Annotation of src/corr7smk.c, revision 1.1.1.1
1.1 root 1: /***************************************************************************
2: * CORR7SMK.C - Corridor 7 SMACKER routines
3: *
4: * 06/07/96 Les Bird
5: ***************************************************************************/
6:
7: #include "icorp.h"
8: #include "smack.h"
9: #include "svga.h"
10: #include <memcheck.h>
11:
12: #define MAXRADBUFFS 64
13: #define SMACKTILE 4093
14:
15: #pragma pack(1);
16:
17: char smackPalette[768];
18:
19: Smack *smk;
20:
21: struct radbuftype {
22: long cache_ptr;
23: long cache_length;
24: char cache_lock;
25: };
26:
27: struct radbuftype radbuf[MAXRADBUFFS];
28:
29: extern
30: HANDLE hDIGIDriver;
31:
32: RCFUNC
33: void PTR4 *RADLINK
34: radmalloc(u32 numbytes)
35: {
36: int i;
37:
38: for (i = 0; i < MAXRADBUFFS; i++) {
39: if (radbuf[i].cache_ptr == 0L) {
40: break;
41: }
42: }
43: if (i == MAXRADBUFFS) {
44: crash("no more radbuff pointers");
45: }
46: radbuf[i].cache_lock = 200;
47: radbuf[i].cache_length = numbytes;
48: allocache(&(radbuf[i].cache_ptr), radbuf[i].cache_length,
49: &(radbuf[i].cache_lock));
50: if (radbuf[i].cache_ptr == 0L) {
51: crash("radmalloc failed");
52: }
53: return((void PTR4 *) radbuf[i].cache_ptr);
54: }
55:
56: RCFUNC
57: void RADLINK
58: radfree(void PTR4 * ptr)
59: {
60: int i;
61:
62: for (i = 0; i < MAXRADBUFFS; i++) {
63: if (radbuf[i].cache_ptr == (long) ptr) {
64: radbuf[i].cache_lock = 1;
65: break;
66: }
67: }
68: }
69:
70: void
71: SMK_init(void)
72: {
73: #if 0
74: if (hDIGIDriver != -1) {
75: SmackSoundUseSOS4(hDIGIDriver,TMR_getSecondTics(1));
76: }
77: else {
78: SmackSoundUseSOS4(0,0);
79: }
80: #endif
81: }
82:
83: void
84: SMK_loadPalette(char *pal)
85: {
86: memmove(smackPalette,pal,sizeof(smackPalette));
87: }
88:
89: void
90: SMK_setPalette(void)
91: {
92: GFX_setPalette(smackPalette);
93: }
94:
95: void
96: SMK_playFlic(char *path)
97: {
98: #if 0
99: int frames=0,i;
100:
101: if (access(path,F_OK) != 0) {
102: return;
103: }
104: if (!noSoundFlag) {
105: smk=SmackOpen(path,SMACKTRACKS,SMACKAUTOEXTRA);
106: }
107: else {
108: smk=SmackOpen(path,0,SMACKAUTOEXTRA);
109: }
110: if (smk) {
111: GFX_fadeOut(255); // make sure game palette is faded
112: walock[SMACKTILE]=200;
113: allocache(&waloff[SMACKTILE],320L*200L,&walock[SMACKTILE]);
114: tilesizx[SMACKTILE]=200;
115: tilesizy[SMACKTILE]=320;
116: SmackToBuffer(smk,0L,0L,320L,200L,(void *)waloff[SMACKTILE],0);
117: keystatus[1]=0;
118: keystatus[28]=0;
119: keystatus[57]=0;
120: while (1) {
121: if (smk->NewPalette) {
122: SMK_loadPalette(smk->Palette);
123: }
124: SmackDoFrame(smk);
125: SmackNextFrame(smk);
126: rotatesprite(320L<<15,200L<<15,65536L,512,SMACKTILE,0,0,2+4+64,
127: 0L,0L,xdim-1L,ydim-1L);
128: nextpage();
129: SMK_setPalette();
130: while (SmackWait(smk)) {
131: if (keystatus[1] || keystatus[57] || keystatus[28]) {
132: goto done;
133: }
134: }
135: if (keystatus[1] || keystatus[57] || keystatus[28]) {
136: goto done;
137: }
138: frames++;
139: if (frames == smk->Frames) {
140: goto done;
141: }
142: }
143: done:
144: walock[SMACKTILE]=1;
145: SmackClose(smk);
146: for (i = 0 ; i < MAXRADBUFFS ; i++) {
147: radbuf[i].cache_lock=1;
148: }
149: }
150: #endif
151: }
152:
unix.superglobalmegacorp.com