mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Various cleanup work:
- fix an earlier 'oops': make highpals load correctly again - maphack lights shouldn't be double-loaded now - slight tweak to the loading screen fadein/out timing - two bound checks - make some variables static in engine.c git-svn-id: https://svn.eduke32.com/eduke32@1969 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5d79003e60
commit
5262a0f24c
8 changed files with 143 additions and 130 deletions
|
@ -326,7 +326,7 @@ EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES];
|
|||
EXTERN char picsiz[MAXTILES];
|
||||
EXTERN char walock[MAXTILES];
|
||||
EXTERN int32_t pow2long[32];
|
||||
EXTERN int32_t numtiles, picanm[MAXTILES];
|
||||
EXTERN int32_t picanm[MAXTILES];
|
||||
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA
|
||||
|
||||
EXTERN int32_t windowpos, windowx, windowy;
|
||||
|
|
|
@ -90,7 +90,7 @@ int32_t editorgridextent = 131072;
|
|||
#define MAXYSIZ 256
|
||||
#define MAXZSIZ 255
|
||||
#define MAXVOXMIPS 5
|
||||
intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; char voxlock[MAXVOXELS][MAXVOXMIPS];
|
||||
static intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; char voxlock[MAXVOXELS][MAXVOXMIPS];
|
||||
int32_t voxscale[MAXVOXELS];
|
||||
|
||||
static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1];
|
||||
|
@ -120,23 +120,24 @@ static int16_t *dotp1[MAXYDIM], *dotp2[MAXYDIM];
|
|||
static int8_t tempbuf[MAXWALLS];
|
||||
|
||||
int32_t ebpbak, espbak;
|
||||
intptr_t slopalookup[16384]; // was 2048
|
||||
static intptr_t slopalookup[16384]; // was 2048
|
||||
#if defined(USE_OPENGL)
|
||||
palette_t palookupfog[MAXPALOOKUPS];
|
||||
#endif
|
||||
|
||||
static char permanentlock = 255;
|
||||
int32_t artversion, mapversion=7; // JBF 20040211: default mapversion to 7
|
||||
void *pic = NULL;
|
||||
char picsiz[MAXTILES], tilefilenum[MAXTILES];
|
||||
int32_t lastageclock;
|
||||
int32_t tilefileoffs[MAXTILES];
|
||||
char picsiz[MAXTILES];
|
||||
static void *pic = NULL;
|
||||
static char permanentlock = 255;
|
||||
static char tilefilenum[MAXTILES];
|
||||
static int32_t tilefileoffs[MAXTILES];
|
||||
static int32_t lastageclock;
|
||||
|
||||
int32_t artsize = 0, cachesize = 0;
|
||||
|
||||
// unlikely to occur, but .art files with less than 256 tiles are certainly possible
|
||||
// this would be 60 (MAXTILES/256) if we just assumed there were 256 tiles per .art as in Duke
|
||||
char *artptrs[256];
|
||||
// max tilesXXX <- num to be checked for:
|
||||
#define MAX_TILEFILEI 64
|
||||
static char *artptrs[MAX_TILEFILEI];
|
||||
|
||||
static int16_t radarang2[MAXXDIM];
|
||||
static uint16_t sqrtable[4096], shlookup[4096+256];
|
||||
|
@ -2125,7 +2126,7 @@ int16_t searchbottomwall, searchisbottom;
|
|||
double msens = 1.0;
|
||||
|
||||
static char artfilename[20];
|
||||
static int32_t numtilefiles, artfil = -1, artfilnum, artfilplc;
|
||||
static int32_t artfil = -1, artfilnum, artfilplc;
|
||||
|
||||
char inpreparemirror = 0;
|
||||
static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2;
|
||||
|
@ -7662,12 +7663,11 @@ void uninitengine(void)
|
|||
Bfclose(cacheindexptr); */
|
||||
#endif
|
||||
|
||||
if (artfil != -1) kclose(artfil);
|
||||
|
||||
i=(sizeof(artptrs)/sizeof(intptr_t))-1;
|
||||
if (artfil != -1)
|
||||
kclose(artfil);
|
||||
|
||||
// this leaves a bunch of invalid pointers in waloff... fixme?
|
||||
for (; i>=0; i--)
|
||||
for (i=0; i<MAX_TILEFILEI; i++)
|
||||
{
|
||||
if (artptrs[i])
|
||||
{
|
||||
|
@ -9274,9 +9274,11 @@ void delete_maphack_lights()
|
|||
int32_t i;
|
||||
for (i=0; i<maphacklightcnt; i++)
|
||||
{
|
||||
polymer_deletelight(maphacklight[i]);
|
||||
if (maphacklight[i] >= 0)
|
||||
polymer_deletelight(maphacklight[i]);
|
||||
maphacklight[i] = -1;
|
||||
}
|
||||
|
||||
maphacklightcnt = 0;
|
||||
}
|
||||
#else
|
||||
|
@ -9338,8 +9340,7 @@ int32_t loadmaphack(const char *filename)
|
|||
#ifdef POLYMER
|
||||
int32_t toomanylights = 0;
|
||||
|
||||
for (i=0; i<PR_MAXLIGHTS; i++)
|
||||
maphacklight[i] = -1;
|
||||
delete_maphack_lights();
|
||||
#endif
|
||||
|
||||
if (filename)
|
||||
|
@ -9350,7 +9351,10 @@ int32_t loadmaphack(const char *filename)
|
|||
script = scriptfile_fromfile(filename);
|
||||
}
|
||||
else if (fn[0])
|
||||
{
|
||||
// re-load
|
||||
script = scriptfile_fromfile(fn);
|
||||
}
|
||||
|
||||
if (!script)
|
||||
{
|
||||
|
@ -9423,7 +9427,7 @@ int32_t loadmaphack(const char *filename)
|
|||
if (scriptfile_getnumber(script, &pitch)) break;
|
||||
|
||||
if (whichsprite < 0)
|
||||
{
|
||||
{
|
||||
// no sprite directive preceeding
|
||||
initprintf("Ignoring pitch directive because of absent/invalid sprite number on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
|
@ -9438,7 +9442,7 @@ int32_t loadmaphack(const char *filename)
|
|||
if (scriptfile_getnumber(script, &roll)) break;
|
||||
|
||||
if (whichsprite < 0)
|
||||
{
|
||||
{
|
||||
// no sprite directive preceeding
|
||||
initprintf("Ignoring roll directive because of absent/invalid sprite number on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
|
@ -9453,7 +9457,7 @@ int32_t loadmaphack(const char *filename)
|
|||
if (scriptfile_getnumber(script, &i)) break;
|
||||
|
||||
if (whichsprite < 0)
|
||||
{
|
||||
{
|
||||
// no sprite directive preceeding
|
||||
initprintf("Ignoring mdxoff directive because of absent/invalid sprite number on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
|
@ -9468,7 +9472,7 @@ int32_t loadmaphack(const char *filename)
|
|||
if (scriptfile_getnumber(script, &i)) break;
|
||||
|
||||
if (whichsprite < 0)
|
||||
{
|
||||
{
|
||||
// no sprite directive preceeding
|
||||
initprintf("Ignoring mdyoff directive because of absent/invalid sprite number on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
|
@ -9483,7 +9487,7 @@ int32_t loadmaphack(const char *filename)
|
|||
if (scriptfile_getnumber(script, &i)) break;
|
||||
|
||||
if (whichsprite < 0)
|
||||
{
|
||||
{
|
||||
// no sprite directive preceeding
|
||||
initprintf("Ignoring mdzoff directive because of absent/invalid sprite number on line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
|
@ -9955,27 +9959,22 @@ void nextpage(void)
|
|||
int32_t loadpics(const char *filename, int32_t askedsize)
|
||||
{
|
||||
int32_t offscount, localtilestart, localtileend, dasiz;
|
||||
int16_t fil, i, j, k;
|
||||
int16_t fil, i, j;
|
||||
int32_t tilefilei, numtiles_dummy;
|
||||
|
||||
Bstrcpy(artfilename,filename);
|
||||
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
Bmemset(tilesizx, 0, sizeof(tilesizx));
|
||||
Bmemset(tilesizy, 0, sizeof(tilesizy));
|
||||
Bmemset(picanm, 0, sizeof(picanm));
|
||||
|
||||
artsize = 0;
|
||||
|
||||
for (tilefilei=0; tilefilei<MAX_TILEFILEI; tilefilei++)
|
||||
{
|
||||
tilesizx[i] = 0;
|
||||
tilesizy[i] = 0;
|
||||
picanm[i] = 0L;
|
||||
}
|
||||
|
||||
artsize = 0L;
|
||||
|
||||
numtilefiles = 0;
|
||||
do
|
||||
{
|
||||
k = numtilefiles;
|
||||
|
||||
artfilename[7] = (k%10)+48;
|
||||
artfilename[6] = ((k/10)%10)+48;
|
||||
artfilename[5] = ((k/100)%10)+48;
|
||||
artfilename[7] = (tilefilei%10)+48;
|
||||
artfilename[6] = ((tilefilei/10)%10)+48;
|
||||
artfilename[5] = ((tilefilei/100)%10)+48;
|
||||
|
||||
if ((fil = kopen4load(artfilename,0)) != -1)
|
||||
{
|
||||
|
@ -9983,11 +9982,18 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
|||
if (artversion != 1)
|
||||
{
|
||||
Bprintf("loadpics(): Invalid art file version in %s\n", artfilename);
|
||||
kclose(fil);
|
||||
return(-1);
|
||||
}
|
||||
kread(fil,&numtiles,4); numtiles = B_LITTLE32(numtiles);
|
||||
kread(fil,&numtiles_dummy,4);
|
||||
kread(fil,&localtilestart,4); localtilestart = B_LITTLE32(localtilestart);
|
||||
kread(fil,&localtileend,4); localtileend = B_LITTLE32(localtileend);
|
||||
if ((uint32_t)localtilestart >= MAXTILES || localtileend < localtilestart)
|
||||
{
|
||||
Bprintf("loadpics(): Invalid localtilestart or localtileend in %s\n", artfilename);
|
||||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
kread(fil,&tilesizx[localtilestart],(localtileend-localtilestart+1)<<1);
|
||||
kread(fil,&tilesizy[localtilestart],(localtileend-localtilestart+1)<<1);
|
||||
kread(fil,&picanm[localtilestart],(localtileend-localtilestart+1)<<2);
|
||||
|
@ -10001,7 +10007,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
|||
offscount = 4+4+4+4+((localtileend-localtilestart+1)<<3);
|
||||
for (i=localtilestart; i<=localtileend; i++)
|
||||
{
|
||||
tilefilenum[i] = k;
|
||||
tilefilenum[i] = tilefilei;
|
||||
tilefileoffs[i] = offscount;
|
||||
dasiz = (int32_t)(tilesizx[i]*tilesizy[i]);
|
||||
offscount += dasiz;
|
||||
|
@ -10012,18 +10018,16 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
|||
if (filegrp[fil] == 254) // from zip
|
||||
{
|
||||
i = kfilelength(fil);
|
||||
artptrs[numtilefiles] = Brealloc(artptrs[numtilefiles], i);
|
||||
artptrs[tilefilei] = Brealloc(artptrs[tilefilei], i);
|
||||
klseek(fil, 0, BSEEK_SET);
|
||||
kread(fil, artptrs[numtilefiles], i);
|
||||
kread(fil, artptrs[tilefilei], i);
|
||||
}
|
||||
#endif
|
||||
kclose(fil);
|
||||
}
|
||||
numtilefiles++;
|
||||
}
|
||||
while (k != numtilefiles && k < 64);
|
||||
|
||||
clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
|
||||
Bmemset(gotpic, 0, sizeof(gotpic));
|
||||
|
||||
//cachesize = min((int32_t)((Bgetsysmemsize()/100)*60),max(artsize,askedsize));
|
||||
if (Bgetsysmemsize() <= (uint32_t)askedsize)
|
||||
|
@ -10036,7 +10040,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
|||
cachesize -= 65536L;
|
||||
if (cachesize < 65536) return(-1);
|
||||
}
|
||||
initcache((intptr_t) pic, cachesize);
|
||||
initcache((intptr_t)pic, cachesize);
|
||||
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
{
|
||||
|
@ -10067,7 +10071,8 @@ void loadtile(int16_t tilenume)
|
|||
if ((dasiz = tilesizx[tilenume]*tilesizy[tilenume]) <= 0) return;
|
||||
|
||||
#ifdef WITHKPLIB
|
||||
if (artptrs[(i = tilefilenum[tilenume])]) // from zip
|
||||
i = tilefilenum[tilenume];
|
||||
if (artptrs[i]) // from zip
|
||||
{
|
||||
waloff[tilenume] = (intptr_t)(artptrs[i]) + tilefileoffs[tilenume];
|
||||
faketimerhandler();
|
||||
|
|
|
@ -750,13 +750,13 @@ void polymer_uninit(void)
|
|||
j = 0;
|
||||
while (j < MAXPALOOKUPS)
|
||||
{
|
||||
if (prhighpalookups[i][j].data) {
|
||||
Bfree(prhighpalookups[i][j].data);
|
||||
prhighpalookups[i][j].data = NULL;
|
||||
}
|
||||
// if (prhighpalookups[i][j].data) {
|
||||
// Bfree(prhighpalookups[i][j].data);
|
||||
// prhighpalookups[i][j].data = NULL;
|
||||
// }
|
||||
if (prhighpalookups[i][j].map) {
|
||||
bglDeleteTextures(1, &prhighpalookups[i][j].map);
|
||||
prhighpalookups[i][j].map = 0;
|
||||
// prhighpalookups[i][j].map = 0;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ void G_PlayAnim(const char *fn,char t)
|
|||
|
||||
//setpalette(0L,256L,tempbuf);
|
||||
//setbrightness(ud.brightness>>2,tempbuf,2);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,10);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8+2);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
gltexfiltermode = 0;
|
||||
|
@ -377,7 +377,7 @@ void G_PlayAnim(const char *fn,char t)
|
|||
|
||||
if (g_restorePalette == 1)
|
||||
{
|
||||
P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,0);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 0);
|
||||
g_restorePalette = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1898,8 +1898,14 @@ void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e)
|
|||
if ((e&128) == 0)
|
||||
{
|
||||
int32_t tc;
|
||||
|
||||
nextpage();
|
||||
for (tc = totalclock; totalclock < tc + 4; handleevents(), Net_GetPackets());
|
||||
tc = totalclock;
|
||||
while (totalclock < tc + 4)
|
||||
{
|
||||
handleevents();
|
||||
Net_GetPackets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9020,7 +9026,7 @@ static void G_DisplayLogo(void)
|
|||
//G_FadePalette(0,0,0,63);
|
||||
if (logoflags & LOGO_3DRSCREEN)
|
||||
{
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8+2+1); // JBF 20040308
|
||||
fadepal(0,0,0, 0,64,7);
|
||||
flushperms();
|
||||
rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1);
|
||||
|
@ -9051,7 +9057,7 @@ static void G_DisplayLogo(void)
|
|||
if (logoflags & LOGO_TITLESCREEN)
|
||||
{
|
||||
//g_player[myconnectindex].ps->palette = titlepal;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308
|
||||
flushperms();
|
||||
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16,0,0,xdim-1,ydim-1);
|
||||
KB_FlushKeyboardQueue();
|
||||
|
@ -10803,7 +10809,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
case 0:
|
||||
if (ud.lockout == 0)
|
||||
{
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 8+2+1); // JBF 20040308
|
||||
clearview(0L);
|
||||
rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1);
|
||||
nextpage();
|
||||
|
@ -10866,7 +10872,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
|
||||
KB_FlushKeyboardQueue();
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
|
||||
rotatesprite(0,0,65536L,0,3292,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1);
|
||||
fadepal(0,0,0, 63,0,-1);
|
||||
|
@ -10899,7 +10905,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
setview(0,0,xdim-1,ydim-1);
|
||||
KB_FlushKeyboardQueue();
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
rotatesprite(0,0,65536L,0,3293,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1);
|
||||
fadepal(0,0,0, 63,0,-1);
|
||||
while (!KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open))
|
||||
|
@ -10939,7 +10945,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
KB_FlushKeyBoardQueue();
|
||||
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
G_FadePalette(0,0,0,63);
|
||||
clearview(0L);
|
||||
menutext(160,60,0,0,"THANKS TO ALL OUR");
|
||||
|
@ -11069,7 +11075,7 @@ ENDANM:
|
|||
FRAGBONUS:
|
||||
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
G_FadePalette(0,0,0,63); // JBF 20031228
|
||||
KB_FlushKeyboardQueue();
|
||||
totalclock = 0;
|
||||
|
|
|
@ -555,7 +555,10 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("numwalls",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("numsprites",(intptr_t)&numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
{
|
||||
static int32_t numtiles;
|
||||
Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
}
|
||||
#ifdef YAX_ENABLE
|
||||
Gv_NewVar("numbunches",(intptr_t)&numyaxbunches, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
#endif
|
||||
|
|
|
@ -356,13 +356,17 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
|
|||
clearview(0L);
|
||||
}
|
||||
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1);
|
||||
|
||||
if (j > MAXTILES-1)
|
||||
if ((uint32_t)j < 2*MAXTILES)
|
||||
{
|
||||
rotatesprite(320<<15,200<<15,65536L,0, j > MAXTILES-1?j-MAXTILES:j,0,0,
|
||||
2+8+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||
{
|
||||
menutext(160,90,0,0,"LOADING USER MAP");
|
||||
|
@ -405,15 +409,22 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
|
||||
}
|
||||
/*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/
|
||||
|
||||
aGameVars[g_iReturnVarID].val.lValue = LOADSCREEN;
|
||||
VM_OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = aGameVars[g_iReturnVarID].val.lValue;
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
|
||||
if ((uint32_t)j < 2*MAXTILES)
|
||||
{
|
||||
rotatesprite(320<<15,200<<15,65536L, 0,j > MAXTILES-1?j-MAXTILES:j,0,0,
|
||||
2+8+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
|
||||
menutext(160,105,0,0,"LOADING...");
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
VM_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
|
@ -1072,11 +1083,13 @@ static void premap_setup_fixed_sprites(void)
|
|||
|
||||
static inline void prelevel(char g)
|
||||
{
|
||||
int32_t i, nexti, j, startwall, endwall, lotaglist;
|
||||
int32_t lotags[MAXSPRITES];
|
||||
int32_t i, nexti, j, startwall, endwall;
|
||||
int32_t switchpicnum;
|
||||
extern char ror_protectedsectors[MAXSECTORS];
|
||||
|
||||
uint8_t tagbitmap[65536>>3];
|
||||
Bmemset(tagbitmap, 0, sizeof(tagbitmap));
|
||||
|
||||
clearbufbyte(show2dsector,sizeof(show2dsector),0L);
|
||||
clearbufbyte(show2dwall,sizeof(show2dwall),0L);
|
||||
clearbufbyte(show2dsprite,sizeof(show2dsprite),0L);
|
||||
|
@ -1198,10 +1211,7 @@ static inline void prelevel(char g)
|
|||
|
||||
premap_setup_fixed_sprites();
|
||||
|
||||
lotaglist = 0;
|
||||
|
||||
i = headspritestat[STAT_DEFAULT];
|
||||
while (i >= 0)
|
||||
for (i=headspritestat[STAT_DEFAULT]; i>=0; i=nextspritestat[i])
|
||||
{
|
||||
int32_t ii, dx, dy;
|
||||
int16_t sprsec;
|
||||
|
@ -1242,33 +1252,28 @@ static inline void prelevel(char g)
|
|||
sprite[i].cstat |= 32768;
|
||||
}
|
||||
|
||||
// invisi-make for both switch states, but the lower code only for one
|
||||
if (ii==1)
|
||||
break;
|
||||
|
||||
for (j=0; j<lotaglist; j++)
|
||||
if (SLT == lotags[j])
|
||||
break;
|
||||
|
||||
if (j == lotaglist)
|
||||
// invisi-make for both switch states, but the lower code only
|
||||
// for the 'on' state (*)
|
||||
if (ii==0)
|
||||
{
|
||||
lotags[lotaglist] = SLT;
|
||||
lotaglist++;
|
||||
if (lotaglist > MAXSPRITES-1)
|
||||
G_GameExit("\nToo many switches.");
|
||||
|
||||
for (j=headspritestat[STAT_EFFECTOR]; j>=0; j=nextspritestat[j])
|
||||
{
|
||||
if (sprite[j].lotag == 12 && sprite[j].hitag == SLT)
|
||||
actor[j].t_data[0] = 1;
|
||||
}
|
||||
j = sprite[i].lotag+32768;
|
||||
tagbitmap[j>>3] |= 1<<(j&7);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
i = nextspritestat[i];
|
||||
}
|
||||
|
||||
// initially 'on' SE 12 light (*)
|
||||
for (j=headspritestat[STAT_EFFECTOR]; j>=0; j=nextspritestat[j])
|
||||
{
|
||||
int32_t t = sprite[j].hitag+32768;
|
||||
|
||||
if (sprite[j].lotag == 12 && tagbitmap[t>>3]&(1<<(t&7)))
|
||||
actor[j].t_data[0] = 1;
|
||||
}
|
||||
|
||||
|
||||
g_mirrorCount = 0;
|
||||
|
||||
for (i = 0; i < numwalls; i++)
|
||||
|
@ -1730,34 +1735,28 @@ int32_t G_FindLevelByFile(const char *fn)
|
|||
return MAXLEVELS*MAXVOLUMES;
|
||||
}
|
||||
|
||||
void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step)
|
||||
void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t ticwait)
|
||||
{
|
||||
if (step > 0)
|
||||
{
|
||||
for (; start < end; start += step)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
return;
|
||||
}
|
||||
G_FadePalette(r,g,b,start);
|
||||
flushperms();
|
||||
G_DoLoadScreen(" ", -1);
|
||||
int32_t m = (step < 0) ? -1 : 1;
|
||||
|
||||
}
|
||||
}
|
||||
else for (; start >= end; start += step)
|
||||
int32_t nexttic = totalclock;
|
||||
|
||||
for (; m*start <= m*end; start += step)
|
||||
{
|
||||
while (totalclock < nexttic)
|
||||
sampletimer();
|
||||
nexttic += ticwait;
|
||||
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
return;
|
||||
}
|
||||
G_FadePalette(r,g,b,start);
|
||||
flushperms();
|
||||
G_DoLoadScreen(" ", -1);
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
return;
|
||||
}
|
||||
|
||||
G_FadePalette(r,g,b,start|128);
|
||||
flushperms();
|
||||
G_DoLoadScreen(" ", -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1948,9 +1947,9 @@ int32_t G_EnterLevel(int32_t g)
|
|||
}
|
||||
else
|
||||
{
|
||||
i = strlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
|
||||
copybufbyte(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i);
|
||||
levname[i] = 255;
|
||||
i = Bstrlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
|
||||
Bmemcpy(levname, MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename, i);
|
||||
levname[i] = 255; // leads to flags=1 for kopen4load
|
||||
levname[i+1] = 0;
|
||||
|
||||
if (loadboard(levname,1,&g_player[0].ps->pos.x, &g_player[0].ps->pos.y,
|
||||
|
@ -1967,8 +1966,8 @@ int32_t G_EnterLevel(int32_t g)
|
|||
}
|
||||
|
||||
g_precacheCount = 0;
|
||||
clearbufbyte(gotpic,sizeof(gotpic),0L);
|
||||
clearbufbyte(precachehightile, sizeof(precachehightile), 0l);
|
||||
Bmemset(gotpic, 0, sizeof(gotpic));
|
||||
Bmemset(precachehightile, 0, sizeof(precachehightile));
|
||||
|
||||
//clearbufbyte(Actor,sizeof(Actor),0l); // JBF 20040531: yes? no?
|
||||
|
||||
|
@ -1980,9 +1979,9 @@ int32_t G_EnterLevel(int32_t g)
|
|||
//cachedebug = 0;
|
||||
// automapping = 0;
|
||||
|
||||
G_FadeLoad(0,0,0, 63, 0, -7);
|
||||
G_FadeLoad(0,0,0, 63,0, -7, 4);
|
||||
G_CacheMapData();
|
||||
G_FadeLoad(0,0,0, 0 ,64, 7);
|
||||
G_FadeLoad(0,0,0, 0,63, 7, 4);
|
||||
|
||||
if (ud.recstat != 2)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ extern palette_t CrosshairColors;
|
|||
int32_t G_EnterLevel(int32_t g);
|
||||
int32_t G_FindLevelByFile(const char *fn);
|
||||
void G_CacheMapData(void);
|
||||
void G_FadeLoad(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
|
||||
void G_FadeLoad(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t ticwait);
|
||||
void G_FreeMapState(int32_t mapnum);
|
||||
void G_NewGame(int32_t vn,int32_t ln,int32_t sk);
|
||||
void G_ResetTimers(void);
|
||||
|
|
Loading…
Reference in a new issue