mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
CON parser cleanup: make labelcode save offsets to CON code instead of
pointers and make it into an int32_t*. git-svn-id: https://svn.eduke32.com/eduke32@2152 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0b7c08ce0e
commit
03000a52b9
4 changed files with 23 additions and 19 deletions
|
@ -9230,7 +9230,7 @@ static void G_CompileScripts(void)
|
||||||
int32_t psm = pathsearchmode;
|
int32_t psm = pathsearchmode;
|
||||||
|
|
||||||
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
|
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
|
||||||
labelcode = (intptr_t *)§or[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
|
labelcode = (int32_t *)§or[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
|
||||||
labeltype = (int32_t *)&wall[0]; // V8: 16384*32/4 = 131072 V7: 8192*32/4 = 65536
|
labeltype = (int32_t *)&wall[0]; // V8: 16384*32/4 = 131072 V7: 8192*32/4 = 65536
|
||||||
|
|
||||||
Bcorrectfilename(g_scriptNamePtr,0);
|
Bcorrectfilename(g_scriptNamePtr,0);
|
||||||
|
@ -9256,18 +9256,18 @@ static void G_CompileScripts(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *newlabel;
|
char *newlabel;
|
||||||
intptr_t *newlabelcode;
|
int32_t *newlabelcode;
|
||||||
|
|
||||||
newlabel = (char *)Bmalloc(g_numLabels<<6);
|
newlabel = Bmalloc(g_numLabels<<6);
|
||||||
newlabelcode = (intptr_t *)Bmalloc(g_numLabels*sizeof(intptr_t));
|
newlabelcode = Bmalloc(g_numLabels*sizeof(int32_t));
|
||||||
|
|
||||||
if (!newlabel || !newlabelcode)
|
if (!newlabel || !newlabelcode)
|
||||||
{
|
{
|
||||||
G_GameExit("Error: out of memory retaining labels\n");
|
G_GameExit("Error: out of memory retaining labels\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
copybuf(label, newlabel, (g_numLabels*64)/4);
|
Bmemcpy(newlabel, label, g_numLabels*64);
|
||||||
copybuf(labelcode, newlabelcode, (g_numLabels*sizeof(intptr_t))/4);
|
Bmemcpy(newlabelcode, labelcode, g_numLabels*sizeof(int32_t));
|
||||||
|
|
||||||
label = newlabel;
|
label = newlabel;
|
||||||
labelcode = newlabelcode;
|
labelcode = newlabelcode;
|
||||||
|
|
|
@ -1103,14 +1103,14 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
||||||
int32_t osize = g_scriptSize;
|
int32_t osize = g_scriptSize;
|
||||||
char *scriptptrs;
|
char *scriptptrs;
|
||||||
char *newbitptr;
|
char *newbitptr;
|
||||||
|
#if 0
|
||||||
for (i=MAXSECTORS-1; i>=0; i--)
|
for (i=MAXSECTORS-1; i>=0; i--)
|
||||||
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
|
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
|
||||||
{
|
{
|
||||||
j = (intptr_t)labelcode[i]-(intptr_t)&script[0];
|
j = (intptr_t)labelcode[i]-(intptr_t)&script[0];
|
||||||
labelcode[i] = (intptr_t)j;
|
labelcode[i] = (intptr_t)j;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t));
|
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t));
|
||||||
|
|
||||||
for (i=g_scriptSize-1; i>=0; i--)
|
for (i=g_scriptSize-1; i>=0; i--)
|
||||||
|
@ -1174,7 +1174,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
||||||
|
|
||||||
if (g_parsingActorPtr)
|
if (g_parsingActorPtr)
|
||||||
g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr);
|
g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr);
|
||||||
|
#if 0
|
||||||
for (i=MAXSECTORS-1; i>=0; i--)
|
for (i=MAXSECTORS-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
|
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
|
||||||
|
@ -1183,7 +1183,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
||||||
labelcode[i] = j;
|
labelcode[i] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--)
|
for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--)
|
||||||
if (scriptptrs[i])
|
if (scriptptrs[i])
|
||||||
{
|
{
|
||||||
|
@ -1676,6 +1676,9 @@ static int32_t C_GetNextValue(int32_t type)
|
||||||
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((labeltype[i]&LABEL_DEFINE)==0)
|
||||||
|
*(g_scriptPtr++) = (intptr_t)(script + labelcode[i]);
|
||||||
|
else
|
||||||
*(g_scriptPtr++) = labelcode[i];
|
*(g_scriptPtr++) = labelcode[i];
|
||||||
textptr += l;
|
textptr += l;
|
||||||
return labeltype[i];
|
return labeltype[i];
|
||||||
|
@ -1932,7 +1935,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
{
|
{
|
||||||
C_GetNextLabelName();
|
C_GetNextLabelName();
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
labelcode[g_numLabels] = (intptr_t) g_scriptPtr;
|
labelcode[g_numLabels] = g_scriptPtr-script;
|
||||||
labeltype[g_numLabels] = LABEL_STATE;
|
labeltype[g_numLabels] = LABEL_STATE;
|
||||||
|
|
||||||
g_processingState = 1;
|
g_processingState = 1;
|
||||||
|
@ -1964,7 +1967,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
{
|
{
|
||||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||||
initprintf("%s:%d: debug: accepted state label `%s'.\n",g_szScriptFileName,g_lineNumber,label+(j<<6));
|
initprintf("%s:%d: debug: accepted state label `%s'.\n",g_szScriptFileName,g_lineNumber,label+(j<<6));
|
||||||
*g_scriptPtr = labelcode[j];
|
*g_scriptPtr = (intptr_t)(script+labelcode[j]);
|
||||||
#if 0
|
#if 0
|
||||||
if (labelcode[j] >= (intptr_t)&script[0] && labelcode[j] < (intptr_t)&script[g_scriptSize])
|
if (labelcode[j] >= (intptr_t)&script[0] && labelcode[j] < (intptr_t)&script[g_scriptSize])
|
||||||
bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||||
|
@ -2308,7 +2311,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
{
|
{
|
||||||
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
||||||
labeltype[g_numLabels] = LABEL_MOVE;
|
labeltype[g_numLabels] = LABEL_MOVE;
|
||||||
labelcode[g_numLabels++] = (intptr_t) g_scriptPtr;
|
labelcode[g_numLabels++] = g_scriptPtr-script;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j=1; j>=0; j--)
|
for (j=1; j>=0; j--)
|
||||||
|
@ -2445,7 +2448,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
{
|
{
|
||||||
labeltype[g_numLabels] = LABEL_AI;
|
labeltype[g_numLabels] = LABEL_AI;
|
||||||
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
||||||
labelcode[g_numLabels++] = (intptr_t) g_scriptPtr;
|
labelcode[g_numLabels++] = g_scriptPtr-script;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j=0; j<3; j++)
|
for (j=0; j<3; j++)
|
||||||
|
@ -2525,7 +2528,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
labeltype[g_numLabels] = LABEL_ACTION;
|
labeltype[g_numLabels] = LABEL_ACTION;
|
||||||
labelcode[g_numLabels] = (intptr_t) g_scriptPtr;
|
labelcode[g_numLabels] = g_scriptPtr-script;
|
||||||
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0);
|
||||||
g_numLabels++;
|
g_numLabels++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,8 @@ int32_t screenpeek;
|
||||||
char ready2send;
|
char ready2send;
|
||||||
int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRespawnTime=768, g_groupFileHandle;
|
int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRespawnTime=768, g_groupFileHandle;
|
||||||
|
|
||||||
intptr_t *g_scriptPtr,*insptr,*labelcode;
|
intptr_t *g_scriptPtr,*insptr;
|
||||||
int32_t *labeltype;
|
int32_t *labelcode, *labeltype;
|
||||||
int32_t g_numLabels,g_numDefaultLabels;
|
int32_t g_numLabels,g_numDefaultLabels;
|
||||||
intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
|
intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
|
||||||
char *label;
|
char *label;
|
||||||
|
|
|
@ -122,7 +122,8 @@ G_EXTERN int32_t startofdynamicinterpolations;
|
||||||
G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock,g_actorRespawnTime;
|
G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock,g_actorRespawnTime;
|
||||||
G_EXTERN int8_t multiwho,multipos,multiwhat,multiflag;
|
G_EXTERN int8_t multiwho,multipos,multiwhat,multiflag;
|
||||||
G_EXTERN intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
|
G_EXTERN intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
|
||||||
G_EXTERN intptr_t *g_scriptPtr,*insptr,*labelcode,*labeltype;
|
G_EXTERN intptr_t *g_scriptPtr,*insptr;
|
||||||
|
G_EXTERN int32_t *labelcode,*labeltype;
|
||||||
G_EXTERN intptr_t *script;
|
G_EXTERN intptr_t *script;
|
||||||
G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS];
|
G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS];
|
||||||
G_EXTERN playerdata_t g_player[MAXPLAYERS];
|
G_EXTERN playerdata_t g_player[MAXPLAYERS];
|
||||||
|
|
Loading…
Reference in a new issue