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, R_get_special_id(wfront));
+ DOT_water(p->x, p->y-p->h / 2, p->xv + p->vx, p->yv + p->vy, n, R_get_special_id(wfront) - 1);
}
void Z_calc_time(dword t,word *h,word *m,word *s)
int sx = x * CELW - w_x + WD / 2;
int sy = y * CELH - w_y + HT / 2 + 1 + w_o;
int id = *p;
- if (id != 0) {
+ if (id) {
+ //intptr_t spc = (intptr_t) walp[id];
int spc = R_get_special_id(id);
- if (spc <= 3) {
+ if (spc >= 0 && spc <= 3) {
if (!bg) {
byte *cmap = clrmap + (spc + 7) * 256;
V_remap_rect(sx, sy, CELW, CELH, cmap);
int R_get_special_id (int n) {
assert(n >= 0 && n < 256);
- intptr_t x = (intptr_t)walp[n] - 1;
- return x > 0 && x <= 3 ? x : 0;
+ intptr_t x = (intptr_t)walp[n];
+ return x >= 0 && x <= 3 ? x : -1;
}
void R_begin_load (void) {
int i;
- for (i = 0; i < max_textures; i++) {
-// if (walp[i] != NULL && walh[i] >= 0) {
-// M_unlock(walp[i]);
-// }
+ for (i = 0; i < 256; i++) {
+ if (walp[i] != NULL && walh[i] >= 0) {
+ M_unlock(walp[i]);
+ }
walh[i] = -1;
walp[i] = NULL;
walswp[i] = i;
walani[i] = 0;
}
memset(anic, 0, sizeof(anic));
- max_textures = 0;
+ max_textures = 1;
}
void R_load (char s[8], int f) {
myfread(s[i], 8, 1, h);
}
R_begin_load();
- R_load("", 0); // empty
i = myfread32(h); // ignore
for (i = 1; i < 256; i++) {
walf[i] = myfread32(h);
R_load(s[i], walf[i] & 1);
}
for (i = 0; i < 256; i++) {
- walswp[i] = myfread8(h);
+ //walswp[i] = myfread8(h);
+ (void)myfread8(h); // useless in new code
}
myfread(fldb, FLDW*FLDH, 1, h);
myfread(fld, FLDW*FLDH, 1, h);
switch (blk.t) {
case MB_WALLNAMES:
R_begin_load();
- R_load("", 0); // empty
for (i = 1; i < 256 && blk.sz > 0; i++, blk.sz -= 9) {
myfread(s, 8, 1, h);
t = myfread8(h);