X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Frender.c;h=b0f2485ac1a3d4b07c15b309d8109e64164b2ebd;hb=2bb81ea2565c3627c954b5c37326db89b0048472;hp=55ec317d6801ae0baa6dfc8abbb0a507c567af9e;hpb=fdb3057d3afd5ac13dba3ffd0d1d59a7fae15329;p=flatwaifu.git diff --git a/src/render.c b/src/render.c index 55ec317..b0f2485 100644 --- a/src/render.c +++ b/src/render.c @@ -19,6 +19,9 @@ #include "memory.h" #include "files.h" #include "error.h" +#include "game.h" +#include "sound.h" +#include "music.h" // game static vgaimg *scrnh[3]; // TITLEPIC INTERPIC ENDPIC @@ -61,6 +64,8 @@ static byte gamcor[5][64]={ }; // walls #define ANIT 5 +static int WD, HT; +static int w_o, w_x, w_y; static vgaimg *walp[256]; static int walh[256]; static byte walani[256]; @@ -69,20 +74,6 @@ static byte anic[ANIT]; static int max_textures; static vgaimg *horiz; -extern byte bright[256]; // vga.c -extern byte mixmap[256][256]; // vga.c -extern byte clrmap[256*12]; // vga.c - -extern int g_trans; // game.c -extern byte transdraw; // game.c -extern int sky_type; // view.c -extern int lt_time, lt_type, lt_side, lt_ypos, lt_force; // game.c - -extern byte savname[7][24]; // files.c -extern char g_music[8]; // game.c -extern short snd_vol; // sound.c -extern short mus_vol; // music.c - /* --- misc --- */ static void *Z_getspr (char n[4], int s, int d, char *dir) { @@ -304,9 +295,10 @@ static void Z_drawfld (byte *fld, int bg) { 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); @@ -1263,23 +1255,23 @@ static short getani (char n[8]) { 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) { @@ -1375,7 +1367,7 @@ void R_init () { } R_setgamma(gammaa); V_setrect(0, SCRW, 0, SCRH); - V_setscr(scrbuf); +// V_setscr(scrbuf); V_clr(0, SCRW, 0, SCRH, 0); R_alloc(); }