mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@961 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a71949ed8f
commit
a55cc4479a
3 changed files with 114 additions and 118 deletions
|
@ -573,10 +573,6 @@
|
|||
RelativePath=".\source\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\develop.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\duke3d.h"
|
||||
>
|
||||
|
@ -825,10 +821,6 @@
|
|||
RelativePath=".\source\jmact\control.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\jmact\develop.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\jmact\file_lib.h"
|
||||
>
|
||||
|
|
|
@ -5596,19 +5596,13 @@ static int parse(void)
|
|||
{
|
||||
int distvar = *insptr++, xvar = GetGameVarID(*insptr++, g_i, g_p), yvar = GetGameVarID(*insptr++, g_i, g_p), distx=0;
|
||||
|
||||
if (xvar > -1 && xvar < MAXSPRITES && yvar > -1 && yvar < MAXSPRITES)
|
||||
if (xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES)
|
||||
{
|
||||
switch (tw)
|
||||
{
|
||||
case CON_DIST:
|
||||
distx = dist(&sprite[xvar],&sprite[yvar]);
|
||||
break;
|
||||
case CON_LDIST:
|
||||
distx = ldist(&sprite[xvar],&sprite[yvar]);
|
||||
OSD_Printf(CON_ERROR "CON_DIST/CON_LDIST: invalid sprite\n",line_num);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else OSD_Printf(CON_ERROR "CON_DIST/CON_LDIST: invalid sprite\n",line_num);
|
||||
if (tw == CON_DIST) distx = dist(&sprite[xvar],&sprite[yvar]);
|
||||
else distx = ldist(&sprite[xvar],&sprite[yvar]);
|
||||
|
||||
SetGameVarID(distvar, distx, g_i, g_p);
|
||||
break;
|
||||
|
@ -5644,12 +5638,11 @@ static int parse(void)
|
|||
case CON_INITTIMER:
|
||||
insptr++;
|
||||
j = GetGameVarID(*insptr++, g_i, g_p);
|
||||
if (timer != j)
|
||||
{
|
||||
if (timer == j)
|
||||
break;
|
||||
uninittimer();
|
||||
inittimer(j);
|
||||
timer = j;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_TIME:
|
||||
|
@ -5662,8 +5655,11 @@ static int parse(void)
|
|||
insptr++;
|
||||
{
|
||||
int lIn=GetGameVarID(*insptr++, g_i, g_p);
|
||||
j = -1;
|
||||
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
|
||||
if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "CON_E/Q/EQSPAWNVAR: Invalid sector %d\n",line_num,g_sp->sectnum);
|
||||
break;
|
||||
}
|
||||
j = spawn(g_i, lIn);
|
||||
switch (tw)
|
||||
{
|
||||
|
@ -5686,11 +5682,14 @@ static int parse(void)
|
|||
case CON_QSPAWN:
|
||||
insptr++;
|
||||
|
||||
j=-1;
|
||||
if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "CON_E/Q/EQSPAWN: Invalid sector %d\n",line_num,g_sp->sectnum);
|
||||
insptr++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
|
||||
j = spawn(g_i,*insptr++);
|
||||
else insptr++;
|
||||
|
||||
switch (tw)
|
||||
{
|
||||
|
@ -5718,13 +5717,19 @@ static int parse(void)
|
|||
if (hittype[g_i].temp_data[9] == 0)
|
||||
hittype[g_i].temp_data[9] = 1;
|
||||
}
|
||||
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
|
||||
|
||||
if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS)
|
||||
{
|
||||
if (tw == CON_EZSHOOT || tw == CON_ESHOOT)
|
||||
SetGameVarID(g_iReturnVarID, shoot(g_i,*insptr++), g_i, g_p);
|
||||
else shoot(g_i,*insptr++);
|
||||
OSD_Printf(CON_ERROR "CON_E/Z/EZSHOOT: Invalid sector %d\n",line_num,g_sp->sectnum);
|
||||
insptr++;
|
||||
hittype[g_i].temp_data[9]=0;
|
||||
break;
|
||||
}
|
||||
else insptr++;
|
||||
|
||||
j = shoot(g_i,*insptr++);
|
||||
|
||||
if (tw == CON_EZSHOOT || tw == CON_ESHOOT)
|
||||
SetGameVarID(g_iReturnVarID, j, g_i, g_p);
|
||||
|
||||
hittype[g_i].temp_data[9]=0;
|
||||
break;
|
||||
|
@ -5745,12 +5750,17 @@ static int parse(void)
|
|||
hittype[g_i].temp_data[9] = 1;
|
||||
}
|
||||
j=GetGameVarID(*insptr++, g_i, g_p);
|
||||
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
|
||||
|
||||
if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "CON_E/Z/EZ/SHOOTVAR: Invalid sector %d\n",line_num,g_sp->sectnum);
|
||||
hittype[g_i].temp_data[9]=0;
|
||||
break;
|
||||
}
|
||||
|
||||
lReturn = shoot(g_i, j);
|
||||
if (tw == CON_ESHOOTVAR || tw == CON_EZSHOOTVAR)
|
||||
SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p);
|
||||
}
|
||||
hittype[g_i].temp_data[9]=0;
|
||||
break;
|
||||
}
|
||||
|
@ -5846,7 +5856,7 @@ static int parse(void)
|
|||
|
||||
if (x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "CON_SHOWVIEW: incorrect coordiantes\n",line_num);
|
||||
OSD_Printf(CON_ERROR "CON_SHOWVIEW: incorrect coordinates\n",line_num);
|
||||
break;
|
||||
}
|
||||
if (sect<0 || sect>=numsectors)
|
||||
|
@ -5873,7 +5883,7 @@ static int parse(void)
|
|||
se40code(x,y,z,a,horiz,smoothratio);
|
||||
#endif
|
||||
if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0)
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
#if defined(POLYMER) && defined(USE_OPENGL)
|
||||
&& (getrendermode() != 4)
|
||||
#endif
|
||||
)
|
||||
|
@ -6725,7 +6735,7 @@ static int parse(void)
|
|||
|
||||
if (lVarID&(MAXGAMEVARS<<1))
|
||||
{
|
||||
m = -1;
|
||||
m = -m;
|
||||
lVarID ^= (MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
|
@ -6746,7 +6756,7 @@ static int parse(void)
|
|||
}
|
||||
else if (*insptr&(MAXGAMEVARS<<1))
|
||||
{
|
||||
m = -1;
|
||||
m = -m;
|
||||
lVarID ^= (MAXGAMEVARS<<1);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,41 +33,33 @@ extern void FreeMapState(int mapnum);
|
|||
static void FreeGameVars(void) /* called from ReadGameVars() and ResetGameVars() */
|
||||
{
|
||||
// call this function as many times as needed.
|
||||
int i;
|
||||
int i=(MAXGAMEVARS-1);
|
||||
// AddLog("FreeGameVars");
|
||||
for (i=0;i<MAXGAMEVARS;i++)
|
||||
for (;i>=0;i--)
|
||||
{
|
||||
// aGameVars[i].lValue=0;
|
||||
// if (aGameVars[i].szLabel)
|
||||
//Bfree(aGameVars[i].szLabel);
|
||||
// aGameVars[i].szLabel=NULL;
|
||||
// aGameVars[i].dwFlags=0;
|
||||
|
||||
if (aGameVars[i].plValues)
|
||||
Bfree(aGameVars[i].plValues);
|
||||
aGameVars[i].plValues=NULL;
|
||||
aGameVars[i].bReset=1;
|
||||
}
|
||||
iGameVarCount=0;
|
||||
for (i=0;i<MAXGAMEARRAYS;i++)
|
||||
{
|
||||
if (i >= MAXGAMEARRAYS)
|
||||
continue;
|
||||
if (aGameArrays[i].plValues)
|
||||
Bfree(aGameArrays[i].plValues);
|
||||
aGameArrays[i].plValues=NULL;
|
||||
aGameArrays[i].bReset=1;
|
||||
}
|
||||
iGameArrayCount=0;
|
||||
iGameVarCount=iGameArrayCount=0;
|
||||
return;
|
||||
}
|
||||
|
||||
static void ClearGameVars(void)
|
||||
{
|
||||
// only call this function ONCE...
|
||||
int i;
|
||||
int i=(MAXGAMEVARS-1);
|
||||
|
||||
//AddLog("ClearGameVars");
|
||||
|
||||
for (i=0;i<MAXGAMEVARS;i++)
|
||||
for (;i>=0;i--)
|
||||
{
|
||||
aGameVars[i].lValue=0;
|
||||
if (aGameVars[i].szLabel)
|
||||
|
@ -79,10 +71,8 @@ static void ClearGameVars(void)
|
|||
Bfree(aGameVars[i].plValues);
|
||||
aGameVars[i].plValues=NULL;
|
||||
aGameVars[i].bReset=1;
|
||||
}
|
||||
iGameVarCount=0;
|
||||
for (i=0;i<MAXGAMEARRAYS;i++)
|
||||
{
|
||||
if (i >= MAXGAMEARRAYS)
|
||||
continue;
|
||||
if (aGameArrays[i].szLabel)
|
||||
Bfree(aGameArrays[i].szLabel);
|
||||
aGameArrays[i].szLabel=NULL;
|
||||
|
@ -92,7 +82,7 @@ static void ClearGameVars(void)
|
|||
aGameArrays[i].plValues=NULL;
|
||||
aGameArrays[i].bReset=1;
|
||||
}
|
||||
iGameArrayCount=0;
|
||||
iGameVarCount=iGameArrayCount=0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -564,9 +554,9 @@ int AddGameVar(const char *pszLabel, int lValue, unsigned int dwFlags)
|
|||
|
||||
void ResetActorGameVars(int iActor)
|
||||
{
|
||||
int i;
|
||||
int i=(MAXGAMEVARS-1);
|
||||
// OSD_Printf("resetting vars for actor %d\n",iActor);
|
||||
for (i=0;i<MAXGAMEVARS;i++)
|
||||
for (;i>=0;i--)
|
||||
if ((aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT))
|
||||
{
|
||||
// OSD_Printf("reset %s (%d) to %s (%d)\n",aGameVars[i].szLabel,aGameVars[i].plValues[iActor],aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue);
|
||||
|
@ -593,14 +583,15 @@ static int GetGameID(const char *szGameLabel)
|
|||
|
||||
int GetGameVarID(int id, int iActor, int iPlayer)
|
||||
{
|
||||
int m = 1;
|
||||
|
||||
if (id == MAXGAMEVARS)
|
||||
return(*insptr++);
|
||||
|
||||
if (id == g_iThisActorID)
|
||||
return iActor;
|
||||
|
||||
{
|
||||
int m = 1;
|
||||
|
||||
if (id >= iGameVarCount || id<0)
|
||||
{
|
||||
if (id&(MAXGAMEVARS<<2))
|
||||
|
@ -611,47 +602,49 @@ int GetGameVarID(int id, int iActor, int iPlayer)
|
|||
|
||||
if (id&(MAXGAMEVARS<<1)) // negative array access
|
||||
{
|
||||
m = -1;
|
||||
m = -m;
|
||||
id &= ~(MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
// OSD_Printf("GetGameVarID(): reading from array\n");
|
||||
if ((index < aGameArrays[id].size)&&(index>=0))
|
||||
return(m * aGameArrays[id].plValues[index]);
|
||||
if (index >= aGameArrays[id].size || index < 0)
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "GetGameVarID(): invalid array index (%s[%d])\n",aGameArrays[id].szLabel,index);
|
||||
return -1;
|
||||
}
|
||||
return(m * aGameArrays[id].plValues[index]);
|
||||
}
|
||||
|
||||
if (!(id&(MAXGAMEVARS<<1)))
|
||||
if ((id&(MAXGAMEVARS<<1)) == 0)
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "GetGameVarID(): invalid gamevar ID (%d)\n",id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
m = -1;
|
||||
m = -m;
|
||||
id &= ~(MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER)
|
||||
{
|
||||
// for the current player
|
||||
if (iPlayer >= 0 && iPlayer < MAXPLAYERS)
|
||||
if (iPlayer < 0 || iPlayer >= MAXPLAYERS)
|
||||
{
|
||||
//Bsprintf(g_szBuf,"GetGameVarID(%d, %d, %d) returns %d\n",id,iActor,iPlayer, aGameVars[id].plValues[iPlayer]);
|
||||
//AddLog(g_szBuf);
|
||||
return(m * aGameVars[id].plValues[iPlayer]);
|
||||
OSD_Printf(OSD_ERROR "GetGameVarID(): invalid player ID (%d)\n",iPlayer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return(m * aGameVars[id].lValue);
|
||||
return(m * aGameVars[id].plValues[iPlayer]);
|
||||
}
|
||||
|
||||
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR)
|
||||
{
|
||||
// for the current actor
|
||||
if (iActor >= 0 && iActor <= MAXSPRITES)
|
||||
if (iActor < 0 || iActor >= MAXSPRITES)
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "GetGameVarID(): invalid sprite ID (%d)\n",iActor);
|
||||
return -1;
|
||||
}
|
||||
return(m * aGameVars[id].plValues[iActor]);
|
||||
|
||||
return(m * aGameVars[id].lValue);
|
||||
}
|
||||
|
||||
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_INTPTR)
|
||||
|
@ -665,6 +658,7 @@ int GetGameVarID(int id, int iActor, int iPlayer)
|
|||
|
||||
return(m * aGameVars[id].lValue);
|
||||
}
|
||||
}
|
||||
|
||||
void SetGameArrayID(int id,int index, int lValue)
|
||||
{
|
||||
|
@ -1401,7 +1395,7 @@ void InitGameVarPointers(void)
|
|||
|
||||
//AddLog("InitGameVarPointers");
|
||||
|
||||
for (i=0;i<MAX_WEAPONS;i++)
|
||||
for (i=(MAX_WEAPONS-1);i>=0;i--)
|
||||
{
|
||||
Bsprintf(aszBuf,"WEAPON%d_CLIP",i);
|
||||
aplWeaponClip[i]=GetGameValuePtr(aszBuf);
|
||||
|
|
Loading…
Reference in a new issue