mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-21 11:01:39 +00:00
I bet this breaks something
git-svn-id: https://svn.eduke32.com/eduke32@1200 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a3ed643794
commit
0614f0b64c
8 changed files with 274 additions and 140 deletions
|
@ -97,6 +97,36 @@ void freeallmodels()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void freevbos()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0;i<nextmodelid;i++)
|
||||||
|
if (models[i]->mdnum == 3)
|
||||||
|
{
|
||||||
|
md3model *m = (md3model *)models[i];
|
||||||
|
if (m->vbos)
|
||||||
|
{
|
||||||
|
// OSD_Printf("freeing model %d vbo\n",i);
|
||||||
|
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
||||||
|
free(m->vbos);
|
||||||
|
m->vbos = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allocvbos)
|
||||||
|
{
|
||||||
|
bglDeleteBuffersARB(allocvbos, indexvbos);
|
||||||
|
bglDeleteBuffersARB(allocvbos, vertvbos);
|
||||||
|
/*
|
||||||
|
free(indexvbos);
|
||||||
|
free(vertvbos);
|
||||||
|
indexvbos = vertvbos = NULL;
|
||||||
|
*/
|
||||||
|
allocvbos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void clearskins()
|
void clearskins()
|
||||||
{
|
{
|
||||||
mdmodel *m;
|
mdmodel *m;
|
||||||
|
@ -2074,10 +2104,11 @@ static void md3free(md3model *m)
|
||||||
if (m->vindexes) free(m->vindexes);
|
if (m->vindexes) free(m->vindexes);
|
||||||
if (m->maxdepths) free(m->maxdepths);
|
if (m->maxdepths) free(m->maxdepths);
|
||||||
|
|
||||||
if (r_vbos && m->vbos)
|
if (m->vbos)
|
||||||
{
|
{
|
||||||
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
||||||
free(m->vbos);
|
free(m->vbos);
|
||||||
|
m->vbos = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(m);
|
free(m);
|
||||||
|
|
|
@ -636,6 +636,7 @@ float glox1, gloy1, glox2, gloy2;
|
||||||
|
|
||||||
//Use this for both initialization and uninitialization of OpenGL.
|
//Use this for both initialization and uninitialization of OpenGL.
|
||||||
static int gltexcacnum = -1;
|
static int gltexcacnum = -1;
|
||||||
|
extern void freevbos(void);
|
||||||
void polymost_glreset()
|
void polymost_glreset()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -717,6 +718,7 @@ void polymost_glreset()
|
||||||
}
|
}
|
||||||
firstcacheindex.next = NULL;
|
firstcacheindex.next = NULL;
|
||||||
}
|
}
|
||||||
|
freevbos();
|
||||||
}
|
}
|
||||||
|
|
||||||
// one-time initialization of OpenGL for polymost
|
// one-time initialization of OpenGL for polymost
|
||||||
|
|
|
@ -7246,23 +7246,23 @@ static void InitCustomColors(void)
|
||||||
vgapal16[9*4+2] = 7; */
|
vgapal16[9*4+2] = 7; */
|
||||||
int i;
|
int i;
|
||||||
palette_t *edcol;
|
palette_t *edcol;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
char vgapal16[4*256] =
|
char vgapal16[4*256] =
|
||||||
{
|
{
|
||||||
00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00,
|
00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00,
|
||||||
42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00,
|
42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00,
|
||||||
21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00,
|
21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00,
|
||||||
63,63,63,00
|
63,63,63,00
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/* editorcolors[0] = getclosestcol(0,0,0);
|
/* editorcolors[0] = getclosestcol(0,0,0);
|
||||||
editorcolors[1] = getclosestcol(0,0,42);
|
editorcolors[1] = getclosestcol(0,0,42);
|
||||||
editorcolors[2] = getclosestcol(0,42,0);
|
editorcolors[2] = getclosestcol(0,42,0);
|
||||||
editorcolors[3] = getclosestcol(0,42,42);
|
editorcolors[3] = getclosestcol(0,42,42);
|
||||||
editorcolors[4] = getclosestcol(42,0,0);
|
editorcolors[4] = getclosestcol(42,0,0);
|
||||||
editorcolors[5] = getclosestcol(0,0,0);
|
editorcolors[5] = getclosestcol(0,0,0);
|
||||||
*/
|
*/
|
||||||
extern int getclosestcol(int r, int g, int b);
|
extern int getclosestcol(int r, int g, int b);
|
||||||
|
|
||||||
|
|
||||||
|
@ -8879,39 +8879,39 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
||||||
case LIZMANFEEDING :
|
case LIZMANFEEDING :
|
||||||
case LIZMANJUMP :
|
case LIZMANJUMP :
|
||||||
|
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
if (frames!=0)
|
||||||
{
|
{
|
||||||
int k;
|
if (frames==10) frames=0;
|
||||||
if (frames!=0)
|
k = 1536;//getangle(tspr->x-posx,tspr->y-posy);
|
||||||
|
k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7;
|
||||||
|
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
|
||||||
|
if (k <= 4)
|
||||||
{
|
{
|
||||||
if (frames==10) frames=0;
|
picnum += k;
|
||||||
k = 1536;//getangle(tspr->x-posx,tspr->y-posy);
|
ang = 0;
|
||||||
k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7;
|
flags &= ~4;
|
||||||
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
|
|
||||||
if (k <= 4)
|
|
||||||
{
|
|
||||||
picnum += k;
|
|
||||||
ang = 0;
|
|
||||||
flags &= ~4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
picnum += 8-k;
|
|
||||||
ang = 1024;
|
|
||||||
flags |= 4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (graphicsmode == 2)
|
|
||||||
{
|
{
|
||||||
if (frames==2) picnum+=((((4-(totalclock>>5)))&1)*5);
|
picnum += 8-k;
|
||||||
if (frames==4) picnum+=((((4-(totalclock>>5)))&3)*5);
|
ang = 1024;
|
||||||
if (frames==5) picnum+=(((totalclock>>5)%5))*5;
|
flags |= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tilesizx[picnum] == 0)
|
|
||||||
picnum -= 5; //Hack, for actors
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
if (graphicsmode == 2)
|
||||||
|
{
|
||||||
|
if (frames==2) picnum+=((((4-(totalclock>>5)))&1)*5);
|
||||||
|
if (frames==4) picnum+=((((4-(totalclock>>5)))&3)*5);
|
||||||
|
if (frames==5) picnum+=(((totalclock>>5)%5))*5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tilesizx[picnum] == 0)
|
||||||
|
picnum -= 5; //Hack, for actors
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -8932,7 +8932,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
||||||
if (xp1 < 4 || xp1 > xdim-6 || yp1 < 4 || yp1 > ydim16-6)
|
if (xp1 < 4 || xp1 > xdim-6 || yp1 < 4 || yp1 > ydim16-6)
|
||||||
continue;
|
continue;
|
||||||
rotatesprite(xp1<<16,yp1<<16,zoom<<5,ang,picnum,
|
rotatesprite(xp1<<16,yp1<<16,zoom<<5,ang,picnum,
|
||||||
shade,sprite[i].pal,flags,0,0,xdim-1,ydim16-1);
|
shade,sprite[i].pal,flags,0,0,xdim-1,ydim16-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1278,10 +1278,10 @@ void faketimerhandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myconnectindex == connecthead)
|
if (myconnectindex == connecthead)
|
||||||
for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||||
packbuf[j++] = min(max(g_player[i].myminlag,-128),127);
|
packbuf[j++] = min(max(g_player[i].myminlag,-128),127);
|
||||||
|
|
||||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||||
g_player[i].myminlag = 0x7fffffff;
|
g_player[i].myminlag = 0x7fffffff;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -81,7 +81,7 @@ int g_iThisActorID=-1; // var ID of "THISACTOR"
|
||||||
intptr_t *actorLoadEventScrptr[MAXTILES];
|
intptr_t *actorLoadEventScrptr[MAXTILES];
|
||||||
|
|
||||||
intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
|
intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
|
||||||
intptr_t *g_parsingEventPtr=NULL;
|
static intptr_t *g_parsingEventPtr=NULL;
|
||||||
|
|
||||||
gamevar_t aGameVars[MAXGAMEVARS];
|
gamevar_t aGameVars[MAXGAMEVARS];
|
||||||
gamearray_t aGameArrays[MAXGAMEARRAYS];
|
gamearray_t aGameArrays[MAXGAMEARRAYS];
|
||||||
|
@ -1000,6 +1000,8 @@ void freehash()
|
||||||
HASH_free(&labelH);
|
HASH_free(&labelH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int g_ifElseAborted;
|
||||||
|
|
||||||
static int C_IncreaseScriptSize(int size)
|
static int C_IncreaseScriptSize(int size)
|
||||||
{
|
{
|
||||||
intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script);
|
intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script);
|
||||||
|
@ -1024,11 +1026,11 @@ static int C_IncreaseScriptSize(int size)
|
||||||
for (i=g_scriptSize-1;i>=0;i--)
|
for (i=g_scriptSize-1;i>=0;i--)
|
||||||
{
|
{
|
||||||
// initprintf("%d\n",i);
|
// initprintf("%d\n",i);
|
||||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
|
/* if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
|
||||||
{
|
{
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
initprintf("Internal compiler error at %d (0x%x)\n",i,i);
|
initprintf("Internal compiler error at %d (0x%x)\n",i,i);
|
||||||
}
|
} */
|
||||||
// if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
|
// if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
|
||||||
// initprintf("oh no!\n");
|
// initprintf("oh no!\n");
|
||||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) /*&& ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))*/)
|
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) /*&& ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))*/)
|
||||||
|
@ -1148,6 +1150,7 @@ static int C_IncreaseScriptSize(int size)
|
||||||
j = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
|
j = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
|
||||||
apScriptGameEvent[i] = (intptr_t *)j;
|
apScriptGameEvent[i] = (intptr_t *)j;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bfree(scriptptrs);
|
Bfree(scriptptrs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1507,7 +1510,9 @@ static int C_GetNextKeyword(void) //Returns its code #
|
||||||
i = HASH_find(&keywH,tempbuf);
|
i = HASH_find(&keywH,tempbuf);
|
||||||
if (i>=0)
|
if (i>=0)
|
||||||
{
|
{
|
||||||
*g_scriptPtr = i + (g_lineNumber<<12);
|
if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP)
|
||||||
|
*g_scriptPtr = i + (31337<<12);
|
||||||
|
else *g_scriptPtr = i + (g_lineNumber<<12);
|
||||||
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
||||||
textptr += l;
|
textptr += l;
|
||||||
g_scriptPtr++;
|
g_scriptPtr++;
|
||||||
|
@ -1795,6 +1800,30 @@ static int C_GetNextValue(int type)
|
||||||
return 0; // literal value
|
return 0; // literal value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int C_CheckEmptyBranch(int tw, intptr_t lastScriptPtr)
|
||||||
|
{
|
||||||
|
if (Bstrncmp(keyw[tw],"if",2) && tw != CON_ELSE)
|
||||||
|
{
|
||||||
|
g_ifElseAborted = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*(g_scriptPtr) & 0xFFF) != CON_NULLOP || *(g_scriptPtr)>>12 != 31337)
|
||||||
|
g_ifElseAborted = 0;
|
||||||
|
|
||||||
|
if (g_ifElseAborted)
|
||||||
|
{
|
||||||
|
// C_ReportError(-1);
|
||||||
|
g_scriptPtr = lastScriptPtr + &script[0];
|
||||||
|
initprintf("%s:%d: removing empty '%s' branch\n",g_szScriptFileName,g_lineNumber,
|
||||||
|
keyw[*(g_scriptPtr) & 0xFFF]);
|
||||||
|
if (g_ifElseAborted)
|
||||||
|
*(g_scriptPtr) = (CON_NULLOP + (31337<<12));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int C_ParseCommand(void);
|
static int C_ParseCommand(void);
|
||||||
|
|
||||||
static int C_CountCaseStatements()
|
static int C_CountCaseStatements()
|
||||||
|
@ -1844,7 +1873,8 @@ static int C_ParseCommand(void)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) return 1;
|
if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0'))
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (g_scriptDebug)
|
if (g_scriptDebug)
|
||||||
C_ReportError(-1);
|
C_ReportError(-1);
|
||||||
|
@ -2921,11 +2951,20 @@ static int C_ParseCommand(void)
|
||||||
if (g_checkingIfElse)
|
if (g_checkingIfElse)
|
||||||
{
|
{
|
||||||
intptr_t offset;
|
intptr_t offset;
|
||||||
|
intptr_t lastScriptPtr = g_scriptPtr - &script[0] - 1;
|
||||||
|
g_ifElseAborted = 0;
|
||||||
g_checkingIfElse--;
|
g_checkingIfElse--;
|
||||||
tempscrptr = g_scriptPtr;
|
tempscrptr = g_scriptPtr;
|
||||||
offset = (unsigned)(tempscrptr-script);
|
offset = (unsigned)(tempscrptr-script);
|
||||||
g_scriptPtr++; //Leave a spot for the fail location
|
g_scriptPtr++; //Leave a spot for the fail location
|
||||||
C_ParseCommand();
|
C_ParseCommand();
|
||||||
|
|
||||||
|
if (C_CheckEmptyBranch(tw, lastScriptPtr))
|
||||||
|
{
|
||||||
|
// g_scriptPtr;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
tempscrptr = (intptr_t *)script+offset;
|
tempscrptr = (intptr_t *)script+offset;
|
||||||
*tempscrptr = (intptr_t) g_scriptPtr;
|
*tempscrptr = (intptr_t) g_scriptPtr;
|
||||||
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
||||||
|
@ -4002,15 +4041,20 @@ static int C_ParseCommand(void)
|
||||||
case CON_WHILEVARVARN:
|
case CON_WHILEVARVARN:
|
||||||
{
|
{
|
||||||
intptr_t offset;
|
intptr_t offset;
|
||||||
|
intptr_t lastScriptPtr = g_scriptPtr - &script[0] - 1;
|
||||||
|
|
||||||
|
g_ifElseAborted = 0;
|
||||||
|
|
||||||
C_GetManyVars(2);
|
C_GetManyVars(2);
|
||||||
tempscrptr = g_scriptPtr;
|
tempscrptr = g_scriptPtr;
|
||||||
offset = (unsigned)(g_scriptPtr-script);
|
offset = (unsigned)(g_scriptPtr-script);
|
||||||
g_scriptPtr++; // Leave a spot for the fail location
|
g_scriptPtr++; // Leave a spot for the fail location
|
||||||
|
|
||||||
j = C_GetKeyword();
|
|
||||||
C_ParseCommand();
|
C_ParseCommand();
|
||||||
|
|
||||||
|
if (C_CheckEmptyBranch(tw, lastScriptPtr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
tempscrptr = (intptr_t *)script+offset;
|
tempscrptr = (intptr_t *)script+offset;
|
||||||
*tempscrptr = (intptr_t) g_scriptPtr;
|
*tempscrptr = (intptr_t) g_scriptPtr;
|
||||||
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
||||||
|
@ -4044,7 +4088,9 @@ static int C_ParseCommand(void)
|
||||||
case CON_WHILEVARN:
|
case CON_WHILEVARN:
|
||||||
{
|
{
|
||||||
intptr_t offset;
|
intptr_t offset;
|
||||||
|
intptr_t lastScriptPtr = (g_scriptPtr-script-1);
|
||||||
|
|
||||||
|
g_ifElseAborted = 0;
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
C_GetNextVar();
|
C_GetNextVar();
|
||||||
C_GetNextValue(LABEL_DEFINE); // the number to check against...
|
C_GetNextValue(LABEL_DEFINE); // the number to check against...
|
||||||
|
@ -4053,9 +4099,11 @@ static int C_ParseCommand(void)
|
||||||
offset = (unsigned)(tempscrptr-script);
|
offset = (unsigned)(tempscrptr-script);
|
||||||
g_scriptPtr++; //Leave a spot for the fail location
|
g_scriptPtr++; //Leave a spot for the fail location
|
||||||
|
|
||||||
j = C_GetKeyword();
|
|
||||||
C_ParseCommand();
|
C_ParseCommand();
|
||||||
|
|
||||||
|
if (C_CheckEmptyBranch(tw, lastScriptPtr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
tempscrptr = (intptr_t *)script+offset;
|
tempscrptr = (intptr_t *)script+offset;
|
||||||
*tempscrptr = (intptr_t) g_scriptPtr;
|
*tempscrptr = (intptr_t) g_scriptPtr;
|
||||||
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
||||||
|
@ -4243,7 +4291,6 @@ static int C_ParseCommand(void)
|
||||||
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
||||||
*g_scriptPtr++=0; // leave spot for 'default' location (null if none)
|
*g_scriptPtr++=0; // leave spot for 'default' location (null if none)
|
||||||
|
|
||||||
j = C_GetKeyword();
|
|
||||||
temptextptr=textptr;
|
temptextptr=textptr;
|
||||||
// probably does not allow nesting...
|
// probably does not allow nesting...
|
||||||
|
|
||||||
|
@ -4532,6 +4579,13 @@ repeatcase:
|
||||||
case CON_IFAI:
|
case CON_IFAI:
|
||||||
case CON_IFACTION:
|
case CON_IFACTION:
|
||||||
case CON_IFMOVE:
|
case CON_IFMOVE:
|
||||||
|
case CON_IFP:
|
||||||
|
{
|
||||||
|
intptr_t offset;
|
||||||
|
intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1);
|
||||||
|
|
||||||
|
g_ifElseAborted = 0;
|
||||||
|
|
||||||
switch (tw)
|
switch (tw)
|
||||||
{
|
{
|
||||||
case CON_IFAI:
|
case CON_IFAI:
|
||||||
|
@ -4553,6 +4607,19 @@ repeatcase:
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
break;
|
break;
|
||||||
|
case CON_IFP:
|
||||||
|
j = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
|
g_scriptPtr--;
|
||||||
|
j |= *g_scriptPtr;
|
||||||
|
}
|
||||||
|
while (C_GetKeyword() == -1);
|
||||||
|
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
||||||
|
*g_scriptPtr = j;
|
||||||
|
g_scriptPtr++;
|
||||||
|
break;
|
||||||
case CON_IFSOUND:
|
case CON_IFSOUND:
|
||||||
if (C_CheckEventSync(g_currentEvent))
|
if (C_CheckEventSync(g_currentEvent))
|
||||||
{
|
{
|
||||||
|
@ -4564,6 +4631,24 @@ repeatcase:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempscrptr = g_scriptPtr;
|
||||||
|
offset = (unsigned)(tempscrptr-script);
|
||||||
|
|
||||||
|
g_scriptPtr++; //Leave a spot for the fail location
|
||||||
|
|
||||||
|
C_ParseCommand();
|
||||||
|
|
||||||
|
if (C_CheckEmptyBranch(tw, lastScriptPtr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
tempscrptr = (intptr_t *)script+offset;
|
||||||
|
*tempscrptr = (intptr_t) g_scriptPtr;
|
||||||
|
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
||||||
|
|
||||||
|
g_checkingIfElse++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
case CON_IFONWATER:
|
case CON_IFONWATER:
|
||||||
case CON_IFINWATER:
|
case CON_IFINWATER:
|
||||||
case CON_IFACTORNOTSTAYPUT:
|
case CON_IFACTORNOTSTAYPUT:
|
||||||
|
@ -4572,7 +4657,6 @@ repeatcase:
|
||||||
case CON_IFSQUISHED:
|
case CON_IFSQUISHED:
|
||||||
case CON_IFDEAD:
|
case CON_IFDEAD:
|
||||||
case CON_IFCANSHOOTTARGET:
|
case CON_IFCANSHOOTTARGET:
|
||||||
case CON_IFP:
|
|
||||||
case CON_IFHITSPACE:
|
case CON_IFHITSPACE:
|
||||||
case CON_IFOUTSIDE:
|
case CON_IFOUTSIDE:
|
||||||
case CON_IFMULTIPLAYER:
|
case CON_IFMULTIPLAYER:
|
||||||
|
@ -4586,28 +4670,20 @@ repeatcase:
|
||||||
case CON_IFNOSOUNDS:
|
case CON_IFNOSOUNDS:
|
||||||
{
|
{
|
||||||
intptr_t offset;
|
intptr_t offset;
|
||||||
if (tw == CON_IFP)
|
intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1);
|
||||||
{
|
|
||||||
j = 0;
|
g_ifElseAborted = 0;
|
||||||
do
|
|
||||||
{
|
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
|
||||||
g_scriptPtr--;
|
|
||||||
j |= *g_scriptPtr;
|
|
||||||
}
|
|
||||||
while (C_GetKeyword() == -1);
|
|
||||||
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
|
|
||||||
*g_scriptPtr = j;
|
|
||||||
g_scriptPtr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
tempscrptr = g_scriptPtr;
|
tempscrptr = g_scriptPtr;
|
||||||
offset = (unsigned)(tempscrptr-script);
|
offset = (unsigned)(tempscrptr-script);
|
||||||
|
|
||||||
g_scriptPtr++; //Leave a spot for the fail location
|
g_scriptPtr++; //Leave a spot for the fail location
|
||||||
|
|
||||||
j = C_GetKeyword();
|
|
||||||
C_ParseCommand();
|
C_ParseCommand();
|
||||||
|
|
||||||
|
if (C_CheckEmptyBranch(tw, lastScriptPtr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
tempscrptr = (intptr_t *)script+offset;
|
tempscrptr = (intptr_t *)script+offset;
|
||||||
*tempscrptr = (intptr_t) g_scriptPtr;
|
*tempscrptr = (intptr_t) g_scriptPtr;
|
||||||
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
|
||||||
|
@ -4615,28 +4691,32 @@ repeatcase:
|
||||||
g_checkingIfElse++;
|
g_checkingIfElse++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CON_LEFTBRACE:
|
case CON_LEFTBRACE:
|
||||||
if (!(g_processingState || g_parsingActorPtr || g_parsingEventPtr))
|
if (!(g_processingState || g_parsingActorPtr || g_parsingEventPtr))
|
||||||
{
|
{
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
C_ReportError(ERROR_SYNTAXERROR);
|
C_ReportError(ERROR_SYNTAXERROR);
|
||||||
}
|
}
|
||||||
if (C_GetKeyword() == CON_NULLOP)
|
/* if (C_GetKeyword() == CON_NULLOP)
|
||||||
|
{
|
||||||
|
// initprintf("%s:%d: warning: 'nullop' statement has no effect\n",g_szScriptFileName,g_lineNumber);
|
||||||
|
C_GetNextKeyword();
|
||||||
|
g_scriptPtr--;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
if (C_GetKeyword() == CON_RIGHTBRACE) // rewrite "{ }" into "nullop"
|
||||||
{
|
{
|
||||||
initprintf("%s:%d: warning: 'nullop' statement has no effect\n",g_szScriptFileName,g_lineNumber);
|
// initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from left\n",g_szScriptFileName,g_lineNumber);
|
||||||
C_GetNextKeyword();
|
|
||||||
g_scriptPtr--;
|
|
||||||
}
|
|
||||||
if (C_GetKeyword() == CON_RIGHTBRACE) // optimize "{ }" into "nullop"
|
|
||||||
{
|
|
||||||
if (g_scriptDebug)
|
|
||||||
initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop'\n",g_szScriptFileName,g_lineNumber);
|
|
||||||
*(--g_scriptPtr) = CON_NULLOP;
|
*(--g_scriptPtr) = CON_NULLOP;
|
||||||
C_GetNextKeyword();
|
C_GetNextKeyword();
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
g_numBraces++;
|
g_numBraces++;
|
||||||
|
|
||||||
do
|
do
|
||||||
done = C_ParseCommand();
|
done = C_ParseCommand();
|
||||||
while (done == 0);
|
while (done == 0);
|
||||||
|
@ -4644,6 +4724,21 @@ repeatcase:
|
||||||
|
|
||||||
case CON_RIGHTBRACE:
|
case CON_RIGHTBRACE:
|
||||||
g_numBraces--;
|
g_numBraces--;
|
||||||
|
|
||||||
|
if ((*(g_scriptPtr-2)>>12) == (31337) &&
|
||||||
|
((*(g_scriptPtr-2) & 0xFFF) == CON_LEFTBRACE)) // rewrite "{ }" into "nullop"
|
||||||
|
{
|
||||||
|
// initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from right\n",g_szScriptFileName,g_lineNumber);
|
||||||
|
*(g_scriptPtr-2) = CON_NULLOP + (31337<<12);
|
||||||
|
g_scriptPtr -= 2;
|
||||||
|
|
||||||
|
if (C_GetKeyword() != CON_ELSE && (*(g_scriptPtr-2)&0xFFF) != CON_ELSE)
|
||||||
|
g_ifElseAborted = 1;
|
||||||
|
else g_ifElseAborted = 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_numBraces < 0)
|
if (g_numBraces < 0)
|
||||||
{
|
{
|
||||||
if (g_checkingSwitch)
|
if (g_checkingSwitch)
|
||||||
|
@ -5273,7 +5368,12 @@ repeatcase:
|
||||||
if (tw == CON_NULLOP)
|
if (tw == CON_NULLOP)
|
||||||
{
|
{
|
||||||
if (C_GetKeyword() != CON_ELSE)
|
if (C_GetKeyword() != CON_ELSE)
|
||||||
initprintf("%s:%d: warning: found 'nullop' without 'else'\n",g_szScriptFileName,g_lineNumber);
|
{
|
||||||
|
C_ReportError(-1);
|
||||||
|
initprintf("%s:%d: removing 'nullop' found without 'else'\n",g_szScriptFileName,g_lineNumber);
|
||||||
|
g_scriptPtr--;
|
||||||
|
g_ifElseAborted = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case CON_STOPALLSOUNDS:
|
case CON_STOPALLSOUNDS:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -52,13 +52,13 @@ void X_ScriptInfo(void)
|
||||||
{
|
{
|
||||||
intptr_t *p;
|
intptr_t *p;
|
||||||
if (insptr)
|
if (insptr)
|
||||||
for (p=insptr-20;p<insptr+20;p++)
|
for (p=insptr-20;p<insptr+20;p++)
|
||||||
{
|
{
|
||||||
if (*p>>12&&(*p&0xFFF)<CON_END)
|
if (*p>>12&&(*p&0xFFF)<CON_END)
|
||||||
initprintf("\n%5d: %5d %s ",p-script,*p>>12,keyw[*p&0xFFF]);
|
initprintf("\n%5d: %5d %s ",p-script,*p>>12,keyw[*p&0xFFF]);
|
||||||
else
|
else
|
||||||
initprintf(" %d",*p);
|
initprintf(" %d",*p);
|
||||||
}
|
}
|
||||||
if (g_i)
|
if (g_i)
|
||||||
initprintf("current actor: %d (%d)\n",g_i,g_sp->picnum);
|
initprintf("current actor: %d (%d)\n",g_i,g_sp->picnum);
|
||||||
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
|
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
|
||||||
|
@ -1101,7 +1101,7 @@ static int X_DoExecute(void)
|
||||||
default:
|
default:
|
||||||
// fix for flying/jumping monsters getting stuck in water
|
// fix for flying/jumping monsters getting stuck in water
|
||||||
if (g_sp->hitag & jumptoplayer || (actorscrptr[g_sp->picnum] &&
|
if (g_sp->hitag & jumptoplayer || (actorscrptr[g_sp->picnum] &&
|
||||||
moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1)))
|
moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1)))
|
||||||
{
|
{
|
||||||
// OSD_Printf("%d\n",*(moveptr+1));
|
// OSD_Printf("%d\n",*(moveptr+1));
|
||||||
break;
|
break;
|
||||||
|
@ -1656,44 +1656,44 @@ static int X_DoExecute(void)
|
||||||
int i = Gv_GetVarX(*insptr++);
|
int i = Gv_GetVarX(*insptr++);
|
||||||
j = Gv_GetVarX(*insptr++);
|
j = Gv_GetVarX(*insptr++);
|
||||||
|
|
||||||
if ((i<0 || i>=MAXSPRITES) && g_scriptSanityChecks)
|
if ((i<0 || i>=MAXSPRITES) && g_scriptSanityChecks)
|
||||||
{
|
{
|
||||||
OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i);
|
OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i);
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((j<0 || j>=MAXSTATUS) && g_scriptSanityChecks)
|
|
||||||
{
|
|
||||||
OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sprite[i].statnum == j) break;
|
|
||||||
|
|
||||||
/* initialize actor data when changing to an actor statnum because there's usually
|
|
||||||
garbage left over from being handled as a hard coded object */
|
|
||||||
|
|
||||||
if (sprite[i].statnum > STAT_ZOMBIEACTOR && (j == STAT_ACTOR || j == STAT_ZOMBIEACTOR))
|
|
||||||
{
|
|
||||||
ActorExtra[i].lastvx = 0;
|
|
||||||
ActorExtra[i].lastvy = 0;
|
|
||||||
ActorExtra[i].timetosleep = 0;
|
|
||||||
ActorExtra[i].cgg = 0;
|
|
||||||
ActorExtra[i].movflag = 0;
|
|
||||||
ActorExtra[i].tempang = 0;
|
|
||||||
ActorExtra[i].dispicnum = 0;
|
|
||||||
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
|
||||||
ActorExtra[i].flags = 0;
|
|
||||||
sprite[i].hitag = 0;
|
|
||||||
|
|
||||||
// pointers
|
|
||||||
if (actorscrptr[sprite[i].picnum])
|
|
||||||
{
|
|
||||||
T5 = *(actorscrptr[sprite[i].picnum]+1);
|
|
||||||
T2 = *(actorscrptr[sprite[i].picnum]+2);
|
|
||||||
sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
changespritestat(i,j);
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if ((j<0 || j>=MAXSTATUS) && g_scriptSanityChecks)
|
||||||
|
{
|
||||||
|
OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (sprite[i].statnum == j) break;
|
||||||
|
|
||||||
|
/* initialize actor data when changing to an actor statnum because there's usually
|
||||||
|
garbage left over from being handled as a hard coded object */
|
||||||
|
|
||||||
|
if (sprite[i].statnum > STAT_ZOMBIEACTOR && (j == STAT_ACTOR || j == STAT_ZOMBIEACTOR))
|
||||||
|
{
|
||||||
|
ActorExtra[i].lastvx = 0;
|
||||||
|
ActorExtra[i].lastvy = 0;
|
||||||
|
ActorExtra[i].timetosleep = 0;
|
||||||
|
ActorExtra[i].cgg = 0;
|
||||||
|
ActorExtra[i].movflag = 0;
|
||||||
|
ActorExtra[i].tempang = 0;
|
||||||
|
ActorExtra[i].dispicnum = 0;
|
||||||
|
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
||||||
|
ActorExtra[i].flags = 0;
|
||||||
|
sprite[i].hitag = 0;
|
||||||
|
|
||||||
|
// pointers
|
||||||
|
if (actorscrptr[sprite[i].picnum])
|
||||||
|
{
|
||||||
|
T5 = *(actorscrptr[sprite[i].picnum]+1);
|
||||||
|
T2 = *(actorscrptr[sprite[i].picnum]+2);
|
||||||
|
sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
changespritestat(i,j);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CON_STARTLEVEL:
|
case CON_STARTLEVEL:
|
||||||
|
|
|
@ -560,7 +560,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
if (neg) return (-aGameVars[id].val.lValue);
|
if (neg) return (-aGameVars[id].val.lValue);
|
||||||
|
@ -606,7 +606,7 @@ void __fastcall Gv_SetVar(int id, int lValue, int iActor, int iPlayer)
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
aGameVars[id].val.lValue=lValue;
|
aGameVars[id].val.lValue=lValue;
|
||||||
|
@ -683,7 +683,7 @@ int __fastcall Gv_GetVarX(int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
if (neg) return (-aGameVars[id].val.lValue);
|
if (neg) return (-aGameVars[id].val.lValue);
|
||||||
|
@ -710,7 +710,7 @@ int __fastcall Gv_GetVarX(int id)
|
||||||
void __fastcall Gv_SetVarX(int id, int lValue)
|
void __fastcall Gv_SetVarX(int id, int lValue)
|
||||||
{
|
{
|
||||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
aGameVars[id].val.lValue=lValue;
|
aGameVars[id].val.lValue=lValue;
|
||||||
|
|
|
@ -369,11 +369,11 @@ static void G_DoLoadScreen(char *statustext, int percent)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||||
/* j = usehightile;
|
/* j = usehightile;
|
||||||
usehightile = 0;
|
usehightile = 0;
|
||||||
rotatesprite(34<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1);
|
rotatesprite(34<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1);
|
||||||
rotatesprite(154<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1);
|
rotatesprite(154<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(scale(xdim-1,288,320),percent,100),ydim-1);
|
||||||
usehightile = j; */
|
usehightile = j; */
|
||||||
{
|
{
|
||||||
int ii = scale(288,percent,100);
|
int ii = scale(288,percent,100);
|
||||||
int x = 32;
|
int x = 32;
|
||||||
|
@ -381,9 +381,10 @@ static void G_DoLoadScreen(char *statustext, int percent)
|
||||||
usehightile = 0;
|
usehightile = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1);
|
rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1);
|
||||||
x++;
|
x++;
|
||||||
} while (x < ii);
|
}
|
||||||
|
while (x < ii);
|
||||||
usehightile = j;
|
usehightile = j;
|
||||||
}
|
}
|
||||||
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
|
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||||
|
|
Loading…
Reference in a new issue