diff --git a/src/miscc.c b/src/miscc.c
index 4fd6353f0c4feadb1d101572052e082b8850346c..3479689db3e6481c86bb0469a6748147162b019e 100644 (file)
--- a/src/miscc.c
+++ b/src/miscc.c
h=F_getsprid(n,s,d);
if(dir) *dir=(h&0x8000)?1:0;
- return M_lock(h);
+ //return M_lock(h);
+ return V_getvgaimg(h);
}
void *Z_getsnd(char n[6]) {
//if(snd_type==-1) return NULL;
strncpy(s+2,n,6);s[0]='D';
s[1]='S';
- return M_lock(F_getresid(s));
+
+ int id = F_getresid(s);
+ int loaded = M_was_locked(id);
+ snd_t *snd = M_lock(id);
+ if (snd != NULL && !loaded) {
+ snd->len = int2host(snd->len);
+ snd->rate = int2host(snd->rate);
+ snd->lstart = int2host(snd->lstart);
+ snd->llen = int2host(snd->llen);
+ }
+ return snd;
}
int Z_sound(void *s,int v) {
"PLASA0","BFUGA0","GUN2A0"
};
- stone=M_lock(F_getresid("STONE"));
- stone2=M_lock(F_getresid("STONE2"));
- keys[0]=M_lock(F_getresid("KEYRA0"));
- keys[1]=M_lock(F_getresid("KEYGA0"));
- keys[2]=M_lock(F_getresid("KEYBA0"));
+ stone=V_loadvgaimg("STONE");
+ stone2=V_loadvgaimg("STONE2");
+ keys[0]=V_loadvgaimg("KEYRA0");
+ keys[1]=V_loadvgaimg("KEYGA0");
+ keys[2]=V_loadvgaimg("KEYBA0");
for(i=0;i<22;++i)
- sth[i]=M_lock(F_getresid(nm[i]));
+ sth[i]=V_loadvgaimg(nm[i]);
strcpy(s,"STBF_*");
for(i='!';i<160;++i) {
s[5]=i;
- bfh[i-'!']=M_lock(F_findres(s));
+ bfh[i-'!']=V_getvgaimg(F_findres(s));
if(!(i&15)) logo_gas(GAS_START+((i-'!')>>4),GAS_TOTAL);
}
for(i='!';i<160;++i) {
sprintf(s,"STCFN%03d",i);
- sfh[i-'!']=M_lock(F_findres(s));
+ sfh[i-'!']=V_getvgaimg(F_findres(s));
if(!(i&15)) logo_gas(GAS_START+8+((i-'!')>>4),GAS_TOTAL);
}
strcpy(s,"WINUM*");
for(i='0';i<='9';++i) {
s[5]=i;
- bfh[i-'!']=M_lock(F_getresid(s));
+ bfh[i-'!']=V_loadvgaimg(s);
}
- bfh[':'-'!']=M_lock(F_getresid("WICOLON"));
+ bfh[':'-'!']=V_loadvgaimg("WICOLON");
bulsnd[0]=Z_getsnd("BUL1");
bulsnd[1]=Z_getsnd("BUL2");
}
void Z_splash(obj_t *p,int n) {
Z_sound(bulsnd[0],128);
DOT_water(p->x,p->y-p->h/2,p->xv+p->vx,p->yv+p->vy,n,
- (int)walp[wfront]-1);
+ (intptr_t)walp[wfront]-1);
}
void Z_calc_time(dword t,word *h,word *m,word *s)
t = t / 60;
*h = t;
}
+
+#define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0)
+
+int16_t short2swap (int16_t x) {
+ union {
+ uint8_t a[2];
+ int16_t x;
+ } y;
+ y.x = x;
+ SWAP_VAR(y.a[0], y.a[1]);
+ return y.x;
+}
+
+int32_t int2swap (int32_t x) {
+ union {
+ uint8_t a[4];
+ int32_t x;
+ } y;
+ y.x = x;
+ SWAP_VAR(y.a[0], y.a[3]);
+ SWAP_VAR(y.a[1], y.a[2]);
+ return y.x;
+}
+
+#undef SWAP_VAR
+
+int16_t short2host (int16_t x) {
+#if __BIG_ENDIAN__
+ return short2swap(x);
+#else
+ return x;
+#endif
+}
+
+int32_t int2host (int32_t x) {
+#if __BIG_ENDIAN__
+ return int2swap(x);
+#else
+ return x;
+#endif
+}