summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21e27ad)
raw | patch | inline | side by side (parent: 21e27ad)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 21 Apr 2020 08:03:30 +0000 (12:03 +0400) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 21 Apr 2020 08:03:30 +0000 (12:03 +0400) |
src/files.c | patch | blob | history | |
src/files.h | patch | blob | history | |
src/gl/render.c | patch | blob | history | |
src/memory.c | patch | blob | history | |
src/render.h | patch | blob | history | |
src/soft/render.c | patch | blob | history | |
src/view.c | patch | blob | history |
diff --git a/src/files.c b/src/files.c
index 1b470913c6c4aaf56958889ddfe5c55f43dc730e..dc897ed23cb0fd1daa2c2fd96dc19cc890dc0c3c 100644 (file)
--- a/src/files.c
+++ b/src/files.c
}
// get sprite id
-int F_getsprid (const char n[4], int s, int d) {
+int F_getsprid (const char n[4], int s, int d, char *dir) {
int i;
- byte a,b;
-
- s+='A';d+='0';
- for(i=s_start+1;i<s_end;++i)
- if(cp866_strncasecmp(wad[i].n,n,4)==0 && (wad[i].n[4]==s || wad[i].n[6]==s)) {
- if(wad[i].n[4]==s) a=wad[i].n[5]; else a=0;
- if(wad[i].n[6]==s) b=wad[i].n[7]; else b=0;
- if(a=='0') return i;
- if(b=='0') return(i|0x8000);
- if(a==d) return i;
- if(b==d) return(i|0x8000);
+ byte a, b;
+ s += 'A';
+ d += '0';
+ for (i = s_start + 1; i < s_end; i++) {
+ if (cp866_strncasecmp(wad[i].n, n, 4) == 0 && (wad[i].n[4] == s || wad[i].n[6] == s)) {
+ a = wad[i].n[4] == s ? wad[i].n[5] : 0;
+ b = wad[i].n[6] == s ? wad[i].n[7] : 0;
+ if (a == '0' || b == '0' || a == d || b == d) {
+ if (dir != NULL) {
+ *dir = a != '0' && b == '0' || a != d && b == d;
+ }
+ return i;
+ }
}
- ERR_fatal("F_getsprid: изображение %.4s%c%c не найдено",n,(byte)s,(byte)d);
+ }
+ ERR_fatal("F_getsprid: image %.4s%c%c not found", n, s, d);
return -1;
}
diff --git a/src/files.h b/src/files.h
index dbd99d4b934a79ce4a9308123a4389abf6664c5c..01f2087968a1862f9cad1642a4d4faf00c98bf83 100644 (file)
--- a/src/files.h
+++ b/src/files.h
int F_findres (const char n[8]);
int F_getresid (const char n[8]);
void F_getresname (char n[8], int r);
-int F_getsprid (const char n[4], int s, int d);
+int F_getsprid (const char n[4], int s, int d, char *dir);
int F_getreslen (int r);
void F_nextmus (char *s);
void F_randmus (char *s);
diff --git a/src/gl/render.c b/src/gl/render.c
index 28c5b86976ccb1cb97f6cf464698034798d88587..c4da0dc3844e8644cb14ecdadf740ca49d989e9d 100644 (file)
--- a/src/gl/render.c
+++ b/src/gl/render.c
}
static image R_gl_get_special_spr (const char n[4], int s, int d, rgba *(*fn)(vgaimg*)) {
- return R_gl_get_special_image(F_getsprid(n, s, d), fn);
+ return R_gl_get_special_image(F_getsprid(n, s, d, NULL), fn);
}
static void R_gl_free_image (image *img) {
/* --- Misc --- */
static image Z_getspr (const char n[4], int s, int d, char *dir) {
- int h = F_getsprid(n, s, d);
- if (dir != NULL) {
- *dir = (h & 0x8000) ? 1 : 0;
- }
+ int h = F_getsprid(n, s, d, dir);
return R_gl_getimage(h);
}
max_textures = 1;
}
-void R_load (char s[8], int f) {
+void R_load (char s[8]) {
assert(max_textures < 256);
if (!s[0]) {
walp[max_textures] = (image) {
};
} else {
walp[max_textures] = R_gl_loadimage(s);
- if (f) {
- walp[max_textures].res |= 0x8000;
- }
if (s[0] == 'S' && s[1] == 'W' && s[4] == '_') {
walswp[max_textures] = 0;
}
if (walswp[i] == 0) {
R_get_name(i, s);
s[5] ^= 1;
- g = F_getresid(s) | (walp[i].res & 0x8000);
+ g = F_getresid(s);
k = 1;
while (k < 256 && walp[k].res != g) {
k += 1;
j += 1;
max_textures += 1;
walp[k] = R_gl_getimage(g);
- walf[k] = g & 0x8000 ? 1 : 0;
+ walf[k] = walf[i];
}
walswp[i] = k;
walswp[k] = i;
diff --git a/src/memory.c b/src/memory.c
index 5be719f55d45d1741146a21e3341a5a1d97be3b1..7089cc5cadb64d31aec69a2ecd8dccc6b518821d 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
void *M_lock (int h) {
if(h==-1 || h==0xFFFF) return NULL;
- h&=-1-0x8000;
if(h>=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса");
if(!resl[h]) if(!resp[h]) allocres(h);
++resl[h];
}
int M_locked (int h) {
- return (h != -1) && (h != 0xFFFF) && (resl[h & (-1 - 0x8000)] != 0);
+ return (h != -1) && (h != 0xFFFF) && (resl[h] != 0);
}
int M_was_locked (int h) {
- return (h != -1) && (h != 0xFFFF) && (resp[h & (-1 - 0x8000)] != NULL);
+ return (h != -1) && (h != 0xFFFF) && (resp[h] != NULL);
}
diff --git a/src/render.h b/src/render.h
index f9a4cfb91a9d44970efc3c5a2b9ab9a454c2c17c..7f1b2314df120e65b79b52098c4412d9de03842d 100644 (file)
--- a/src/render.h
+++ b/src/render.h
int R_get_special_id (int n);
int R_get_swp (int n);
void R_begin_load (void);
-void R_load (char s[8], int f);
+void R_load (char s[8]);
void R_end_load (void);
void R_loadsky (int sky);
diff --git a/src/soft/render.c b/src/soft/render.c
index e2cb9bf660cc9a4167a33df9168cba13b8b6383b..25c387226367fae0404daf53cd2c05876549e5be 100644 (file)
--- a/src/soft/render.c
+++ b/src/soft/render.c
/* --- misc --- */
static void *Z_getspr (char n[4], int s, int d, char *dir) {
- int h = F_getsprid(n, s, d);
- if (dir) {
- *dir = (h & 0x8000) ? 1 : 0;
- }
+ int h = F_getsprid(n, s, d, dir);
return V_getvgaimg(h);
}
max_textures = 1;
}
-void R_load (char s[8], int f) {
+void R_load (char s[8]) {
assert(max_textures < 256);
if (!s[0]) {
walh[max_textures] = -1;
} else {
walh[max_textures] = F_getresid(s);
walp[max_textures] = V_getvgaimg(walh[max_textures]);
- if (f) {
- walh[max_textures] |= 0x8000;
- }
if (s[0] == 'S' && s[1] == 'W' && s[4] == '_') {
walswp[max_textures] = 0;
}
if (walswp[i] == 0) {
R_get_name(i, s);
s[5] ^= 1;
- g = F_getresid(s) | (walh[i] & 0x8000);
+ g = F_getresid(s);
k = 1;
while (k < 256 && walh[k] != g) {
k += 1;
j += 1;
walh[k] = g;
walp[k] = V_getvgaimg(g);
- walf[k] = g & 0x8000 ? 1 : 0;
+ walf[k] = walf[i];
}
walswp[i] = k;
walswp[k] = i;
diff --git a/src/view.c b/src/view.c
index 043ac7839b459fd6aa0c3c96d5398bf5111f45ba..f902e23648dbe7727678f94a702feda84f22d4d9 100644 (file)
--- a/src/view.c
+++ b/src/view.c
void W_loadgame (FILE* h) {
int i;
- char s[256][8];
+ char s[8];
sky_type = myfread32(h);
R_loadsky(sky_type);
+ R_begin_load();
for (i = 1; i < 256; ++i) {
- myfread(s[i], 8, 1, h);
+ myfread(s, 8, 1, h);
+ if (s[0]) {
+ R_load(s);
+ }
}
- R_begin_load();
- i = myfread32(h); // ignore
- for (i = 1; i < 256; i++) {
- walf[i] = myfread32(h);
- R_load(s[i], walf[i] & 1);
+ R_end_load();
+ for (i = 0; i < 256; i++) {
+ myfread32(h); // useless
}
for (i = 0; i < 256; i++) {
- //walswp[i] = myfread8(h);
- (void)myfread8(h); // useless in new code
+ walf[i] = myfread8(h);
}
myfread(fldb, FLDW*FLDH, 1, h);
myfread(fld, FLDW*FLDH, 1, h);
myfread(fldf, FLDW*FLDH, 1, h);
- R_end_load();
}
void W_init (void) {
}
int W_load (FILE *h) {
+ int i;
char s[8];
- int i, j, t;
void *p, *buf;
switch (blk.t) {
case MB_WALLNAMES:
R_begin_load();
+ memset(walf, 0, sizeof(walf));
for (i = 1; i < 256 && blk.sz > 0; i++, blk.sz -= 9) {
myfread(s, 8, 1, h);
- t = myfread8(h);
- R_load(s, t);
+ walf[i] = myfread8(h) ? 1 : 0; // ???
+ R_load(s);
if (strncasecmp(s, "VTRAP01", 8) == 0) {
walf[i] |= 2;
}