this isn't done yet

git-svn-id: https://svn.eduke32.com/eduke32@1213 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-01-16 06:11:25 +00:00
parent 91c6cf8f7a
commit 7e54f9a756
5 changed files with 115 additions and 84 deletions

View File

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h>
#endif
#define BUILDDATE " 20090112"
#define BUILDDATE " 20090114"
#define VERSION " 1.2.0devel"
static int32_t floor_over_floor;

View File

@ -1399,7 +1399,8 @@ static inline int32_t ispecial(char c)
static inline int32_t isaltok(char c)
{
return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' ||
c == '*' || c == '-' || c == '_' || c == '.');
}
static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz)
@ -1544,7 +1545,11 @@ static void C_GetNextVarType(int32_t type)
*g_scriptPtr=atoi(textptr);
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
g_scriptPtr++;
#if 1
while (!ispecial(*textptr) && *textptr != ']') textptr++;
#else
C_GetNextLabelName();
#endif
return;
}
else if ((*textptr == '-')/* && !isdigit(*(textptr+1))*/)
@ -1583,7 +1588,7 @@ static void C_GetNextVarType(int32_t type)
if (i < 0)
{
i=GetDefID(label+(g_numLabels<<6));
if (i < g_iSpriteVarID || i > g_iPlayerVarID)
if (i < g_iSpriteVarID || i > g_iActorVarID)
i = -1;
if (i < 0)
@ -1599,7 +1604,7 @@ static void C_GetNextVarType(int32_t type)
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
*g_scriptPtr++=(i|f);
C_GetNextVarType(0);
C_SkipComments(); //skip comments and whitespace
C_SkipComments();
if (*textptr != ']')
{
@ -1608,7 +1613,10 @@ static void C_GetNextVarType(int32_t type)
return;
}
textptr++;
if (type) //writing arrays in this way is not supported because it would require too many changes to other code
//writing arrays in this way is not supported because it would require too many changes to other code
if (type)
{
g_numCompilerErrors++;
C_ReportError(ERROR_INVALIDARRAYWRITE);
@ -1627,7 +1635,7 @@ static void C_GetNextVarType(int32_t type)
textptr++;
}
if (*textptr!='.')
if (*textptr != '.')
{
g_numCompilerErrors++;
C_ReportError(ERROR_SYNTAXERROR);
@ -1636,7 +1644,7 @@ static void C_GetNextVarType(int32_t type)
textptr++;
/// now pointing at 'xxx'
C_GetNextLabelName();
//printf("found xxx label of '%s'\n", label+(g_numLabels<<6));
initprintf("found xxx label of '%s'\n", label+(g_numLabels<<6));
if (i == g_iSpriteVarID)
lLabelID=C_GetLabelNameOffset(&actorH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6))));
@ -1646,6 +1654,8 @@ static void C_GetNextVarType(int32_t type)
lLabelID=C_GetLabelNameOffset(&wallH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6))));
else if (i == g_iPlayerVarID)
lLabelID=C_GetLabelNameOffset(&playerH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6))));
else if (i == g_iActorVarID)
lLabelID=GetDefID(label+(g_numLabels<<6));
//printf("LabelID is %d\n",lLabelID);
if (lLabelID == -1)
@ -1670,6 +1680,10 @@ static void C_GetNextVarType(int32_t type)
C_GetNextVarType(0);
}
}
else if (i == g_iSectorVarID)
*g_scriptPtr++=SectorLabels[lLabelID].lId;
else if (i == g_iWallVarID)
*g_scriptPtr++=SectorLabels[lLabelID].lId;
else if (i == g_iPlayerVarID)
{
*g_scriptPtr++=PlayerLabels[lLabelID].lId;
@ -1683,6 +1697,8 @@ static void C_GetNextVarType(int32_t type)
C_GetNextVarType(0);
}
}
else if (i == g_iActorVarID)
*g_scriptPtr++=lLabelID;
}
return;
}
@ -1778,7 +1794,7 @@ static int32_t C_GetNextValue(int32_t type)
}
tempbuf[l] = 0;
if (!g_skipKeywordCheck && hash_find(&keywH,label+(g_numLabels<<6))>=0)
if (!g_skipKeywordCheck && hash_find(&keywH,tempbuf /*label+(g_numLabels<<6)*/)>=0)
{
g_numCompilerErrors++;
C_ReportError(ERROR_ISAKEYWORD);
@ -2045,7 +2061,7 @@ static int32_t C_ParseCommand(void)
C_ReportError(ERROR_OPENBRACKET);
g_numCompilerErrors++;
}
if (g_numBraces < 0)
else if (g_numBraces < 0)
{
C_ReportError(ERROR_CLOSEBRACKET);
g_numCompilerErrors++;
@ -2385,12 +2401,7 @@ static int32_t C_ParseCommand(void)
// get the file name...
while (C_GetKeyword() == -1)
{
while (isaltok(*textptr) == 0)
{
if (*textptr == 0x0a) g_lineNumber++;
textptr++;
if (*textptr == 0) break;
}
C_SkipComments();
j = 0;
tempbuf[j] = '/';
while (isaltok(*(textptr+j)))
@ -2417,12 +2428,7 @@ static int32_t C_ParseCommand(void)
i = 0;
while (C_GetKeyword() == -1)
{
while (isaltok(*textptr) == 0)
{
if (*textptr == 0x0a) g_lineNumber++;
textptr++;
if (*textptr == 0) break;
}
C_SkipComments();
j = 0;
while (isaltok(*(textptr+j)))
@ -3551,7 +3557,6 @@ static int32_t C_ParseCommand(void)
g_numCompilerErrors++;
C_ReportError(ERROR_VARREADONLY);
return 0;
}
switch (tw)

View File

@ -660,8 +660,7 @@ static int32_t X_DoExecute(void)
{
int32_t j, l, s, tw = *insptr;
if (vm.g_killitFlag) return 1;
if (vm.g_returnFlag) return 1;
if (vm.g_killitFlag + vm.g_killitFlag) return 1;
// Bsprintf(g_szBuf,"Parsing: %d",*insptr);
// AddLog(g_szBuf);
@ -2321,7 +2320,7 @@ static int32_t X_DoExecute(void)
hitdata_t hitinfo;
vect.x = Gv_GetVarX(*insptr++);
vect.x = Gv_GetVarX(*insptr++);
vect.y = Gv_GetVarX(*insptr++);
vect.z = Gv_GetVarX(*insptr++);
{
@ -3075,7 +3074,7 @@ static int32_t X_DoExecute(void)
index=Gv_GetVarX(*insptr++);
if ((index < aGameArrays[lVarID].size)&&(index>=0))
{
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",g_errorLineNum,keyw[g_tw],
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",keyw[g_tw],g_errorLineNum,
aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]);
break;
}
@ -3088,33 +3087,20 @@ static int32_t X_DoExecute(void)
else if (*insptr&(MAXGAMEVARS<<3))
{
// FIXME FIXME FIXME
int32_t index, label;
lVarID ^= (MAXGAMEVARS<<3);
if (lVarID&(MAXGAMEVARS<<1))
if ((lVarID & (MAXGAMEVARS-1)) == g_iActorVarID)
{
m = -m;
lVarID ^= (MAXGAMEVARS<<1);
intptr_t *oinsptr = insptr++;
int32_t index = Gv_GetVarX(*insptr++);
insptr = oinsptr;
if (index < 0 || index >= MAXSPRITES-1)
{
OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]);
Gv_GetVarX(*insptr++);
break;
}
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",keyw[g_tw],g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.g_p));
break;
}
insptr++;
index=Gv_GetVarX(*insptr++);
label=*insptr++;
/* if ((index < aGameArrays[lVarID].size)&&(index>=0))
{
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",g_errorLineNum,keyw[g_tw],
aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]);
break;
}
else
{
OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]);
break;
} */
break;
}
else if (*insptr&(MAXGAMEVARS<<1))
{
@ -3984,12 +3970,10 @@ static int32_t X_DoExecute(void)
case CON_WHILEVARN:
{
intptr_t *savedinsptr=insptr+2;
j=1;
do
{
insptr=savedinsptr;
if (Gv_GetVarX(*(insptr-1)) == *insptr)
j=0;
j = (Gv_GetVarX(*(insptr-1)) != *insptr);
X_DoConditional(j);
}
while (j);
@ -3998,16 +3982,13 @@ static int32_t X_DoExecute(void)
case CON_WHILEVARVARN:
{
int32_t i,k;
int32_t i;
intptr_t *savedinsptr=insptr+2;
j=1;
do
{
insptr=savedinsptr;
i = Gv_GetVarX(*(insptr-1));
k=*(insptr);
if (i == Gv_GetVarX(k))
j=0;
j = (i != Gv_GetVarX(*insptr));
X_DoConditional(j);
}
while (j);

View File

@ -541,29 +541,42 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
if (id&(MAXGAMEVARS<<1)) // negative array access
negateResult = 1;
id &= ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
if (index >= aGameArrays[id].size || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index);
return -1;
}
return(negateResult?-aGameArrays[id].plValues[index]:aGameArrays[id].plValues[index]);
if (negateResult) return (-aGameArrays[id].plValues[index]);
return (aGameArrays[id].plValues[index]);
}
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
{
int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer), label=*insptr++;
int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer), label;
if (id == g_iActorVarID)
{
if (index >= MAXSPRITES || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
label = Gv_GetVar(*insptr++, index, iPlayer);
}
else label = *insptr++;
if (id&(MAXGAMEVARS<<1)) // negative array access
negateResult = 1;
id &= ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
id &= (MAXGAMEVARS-1); //~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
if (id == g_iSpriteVarID)
{
int32_t parm2 = 0;
OSD_Printf("%d %d %d\n",__LINE__,index,label);
if (ActorLabels[label].flags & LABEL_HASPARM2)
parm2 = Gv_GetVar(*insptr++, iActor, iPlayer);
@ -575,7 +588,7 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
if (negateResult) return (-X_AccessSpriteX(index, label, parm2));
return (X_AccessSpriteX(index, label, parm2));
}
if (id == g_iPlayerVarID)
else if (id == g_iPlayerVarID)
{
int32_t parm2 = 0;
@ -591,7 +604,17 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
if (negateResult) return (-X_AccessPlayerX(index, label, parm2));
return (X_AccessPlayerX(index, label, parm2));
}
if (id == g_iSectorVarID)
else if (id == g_iActorVarID)
{
if (index >= MAXSPRITES || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
if (negateResult) return -label;
return label;
}
else if (id == g_iSectorVarID)
{
if (index == vm.g_i) index = sprite[vm.g_i].sectnum;
if (index >= MAXSECTORS || index < 0)
@ -602,7 +625,7 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
if (negateResult) return (-X_AccessSectorX(index, label));
return (X_AccessSectorX(index, label));
}
if (id == g_iWallVarID)
else if (id == g_iWallVarID)
{
if (index >= MAXWALLS || index < 0)
{
@ -726,7 +749,7 @@ int32_t __fastcall Gv_GetVarX(int32_t id)
if (id&(MAXGAMEVARS<<1)) // negative array access
negateResult = 1;
id &= ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
if (index >= aGameArrays[id].size || index < 0)
{
@ -739,29 +762,41 @@ int32_t __fastcall Gv_GetVarX(int32_t id)
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
{
int32_t index=Gv_GetVarX(*insptr++), label=*insptr++;
int32_t index=Gv_GetVarX(*insptr++), label;
if (id&(MAXGAMEVARS<<1)) // negative array access
negateResult = 1;
id &= ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
if (id == g_iSpriteVarID)
if (id == g_iActorVarID)
{
int32_t parm2 = 0;
if (ActorLabels[label].flags & LABEL_HASPARM2)
parm2 = Gv_GetVarX(*insptr++);
if (index >= MAXSPRITES || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
label = Gv_GetVarX(*insptr++);
}
else label = *insptr++;
if (id == g_iSpriteVarID)
{
int32_t parm2 = 0;
OSD_Printf("%d %d %d\n",__LINE__,index,label);
if (ActorLabels[label].flags & LABEL_HASPARM2)
parm2 = Gv_GetVarX(*insptr++);
if (index >= MAXSPRITES || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
if (negateResult) return (-X_AccessSpriteX(index, label, parm2));
return (X_AccessSpriteX(index, label, parm2));
}
if (id == g_iPlayerVarID)
else if (id == g_iPlayerVarID)
{
int32_t parm2 = 0;
@ -777,7 +812,17 @@ int32_t __fastcall Gv_GetVarX(int32_t id)
if (negateResult) return (-X_AccessPlayerX(index, label, parm2));
return (X_AccessPlayerX(index, label, parm2));
}
if (id == g_iSectorVarID)
else if (id == g_iActorVarID)
{
if (index >= MAXSPRITES || index < 0)
{
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
if (negateResult) return -label;
return label;
}
else if (id == g_iSectorVarID)
{
if (index == vm.g_i) index = sprite[vm.g_i].sectnum;
if (index >= MAXSECTORS || index < 0)
@ -788,7 +833,7 @@ int32_t __fastcall Gv_GetVarX(int32_t id)
if (negateResult) return (-X_AccessSectorX(index, label));
return (X_AccessSectorX(index, label));
}
if (id == g_iWallVarID)
else if (id == g_iWallVarID)
{
if (index >= MAXWALLS || index < 0)
{
@ -1457,11 +1502,11 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
// special vars for struct access
Gv_NewVar("sprite", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
Gv_NewVar("sector", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
Gv_NewVar("wall", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
Gv_NewVar("player", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
Gv_NewVar("actorvar", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("sector", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("wall", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
const char *s_buildDate = "20090112";
const char *s_buildDate = "20090114";
char *MusicPtr = NULL;
int32_t g_musicSize;