This looks like stuff that needs to be changed for proper 64-bit support

git-svn-id: https://svn.eduke32.com/eduke32@619 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-02-17 05:08:18 +00:00
parent fad541b377
commit b3677fc796
5 changed files with 122 additions and 118 deletions

View file

@ -14,11 +14,11 @@ EDITORLIB=build.lib
!ifdef DEBUG !ifdef DEBUG
# debugging options # debugging options
flags_cl= /Ot /Zi /MTd flags_cl= /Ot /Zi
flags_link=/DEBUG flags_link=/DEBUG
!else !else
# release options # release options
flags_cl=/O2 /Ox /MT #/Ob1gity flags_cl=/O2 /Ox #/Ob1gity
flags_link=/RELEASE flags_link=/RELEASE
!endif !endif
@ -33,7 +33,7 @@ CC=cl
AS=ml AS=ml
LINK=link /opt:nowin98 /nologo /opt:ref LINK=link /opt:nowin98 /nologo /opt:ref
MT=mt MT=mt
CFLAGS= /J /nologo $(flags_cl) \ CFLAGS= /MD /J /nologo $(flags_cl) \
/I$(INC) /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\jaudiolib /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \ /I$(INC) /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\jaudiolib /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \
/DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \ /DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \
/I$(DXROOT)\include /DRENDERTYPEWIN=1 /I$(DXROOT)\include /DRENDERTYPEWIN=1

View file

@ -533,11 +533,12 @@ extern char ready2send;
// JBF 20040531: adding 16 extra to the script so we have some leeway // JBF 20040531: adding 16 extra to the script so we have some leeway
// to (hopefully) safely abort when hitting the limit // to (hopefully) safely abort when hitting the limit
extern int *script,*scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; extern intptr_t *script,*scriptptr,*insptr,*labelcode,*labeltype;
extern int labelcnt,defaultlabelcnt;
extern int g_ScriptSize; extern int g_ScriptSize;
extern char *label; extern char *label;
extern int *actorscrptr[MAXTILES],*parsing_actor; extern intptr_t *actorscrptr[MAXTILES],*parsing_actor;
extern int *actorLoadEventScrptr[MAXTILES]; extern intptr_t *actorLoadEventScrptr[MAXTILES];
extern char actortype[MAXTILES]; extern char actortype[MAXTILES];
extern char *music_pointer; extern char *music_pointer;
@ -566,7 +567,7 @@ spriteinterpolate sprpos[MAXSPRITES];
typedef struct { typedef struct {
int floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz; int floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
int flags; int flags;
int temp_data[10]; intptr_t temp_data[10]; // sometimes used to hold pointers to con code
short picnum,ang,extra,owner,movflag; short picnum,ang,extra,owner,movflag;
short tempang,actorstayput,dispicnum; short tempang,actorstayput,dispicnum;
short timetosleep; short timetosleep;
@ -817,9 +818,9 @@ enum gamevarflags {
}; };
typedef struct { typedef struct {
int lValue; intptr_t lValue;
int lDefault; intptr_t lDefault;
int *plValues; // array of values when 'per-player', or 'per-actor' intptr_t *plValues; // array of values when 'per-player', or 'per-actor'
unsigned int dwFlags; unsigned int dwFlags;
char *szLabel; char *szLabel;
char bReset; char bReset;

View file

@ -36,7 +36,7 @@ int total_lines,line_number;
static int checking_ifelse,parsing_state; static int checking_ifelse,parsing_state;
char g_szBuf[1024]; char g_szBuf[1024];
int *casescriptptr=NULL; // the pointer to the start of the case table in a switch statement intptr_t *casescriptptr=NULL; // the pointer to the start of the case table in a switch statement
// first entry is 'default' code. // first entry is 'default' code.
static int casecount = 0; static int casecount = 0;
static int checking_switch = 0, current_event = -1; static int checking_switch = 0, current_event = -1;
@ -45,23 +45,23 @@ static int num_braces = 0; // init to some sensible defaults
int redefined_quote_count = 0; int redefined_quote_count = 0;
int *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine
int *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire) intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
int *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
int *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none) intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none)
int *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire. intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire.
int *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
int *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
int *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
int *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
int *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst'
int *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
int *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound
int *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
int *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
int *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
int *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
int *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
int g_iReturnVarID=-1; // var ID of "RETURN" int g_iReturnVarID=-1; // var ID of "RETURN"
int g_iWeaponVarID=-1; // var ID of "WEAPON" int g_iWeaponVarID=-1; // var ID of "WEAPON"
@ -74,10 +74,10 @@ int g_iHiTagID=-1; // var ID of "HITAG"
int g_iTextureID=-1; // var ID of "TEXTURE" int g_iTextureID=-1; // var ID of "TEXTURE"
int g_iThisActorID=-1; // var ID of "THISACTOR" int g_iThisActorID=-1; // var ID of "THISACTOR"
int *actorLoadEventScrptr[MAXTILES]; intptr_t *actorLoadEventScrptr[MAXTILES];
int *apScriptGameEvent[MAXGAMEEVENTS]; intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
int *parsing_event=NULL; intptr_t *parsing_event=NULL;
gamevar_t aGameVars[MAXGAMEVARS]; gamevar_t aGameVars[MAXGAMEVARS];
int iGameVarCount=0; int iGameVarCount=0;
@ -849,7 +849,7 @@ static const memberlabel_t inputlabels[]=
static int skipcomments(void) static int skipcomments(void)
{ {
char c; char c;
int i,j; intptr_t i, j;
while ((c = *textptr)) while ((c = *textptr))
{ {
@ -897,18 +897,18 @@ static int skipcomments(void)
if ((unsigned)(scriptptr-script) > (unsigned)(g_ScriptSize-32)) if ((unsigned)(scriptptr-script) > (unsigned)(g_ScriptSize-32))
{ {
int oscriptptr = (unsigned)(scriptptr-script); intptr_t oscriptptr = (unsigned)(scriptptr-script);
int ocasescriptptr = (unsigned)(casescriptptr-script); intptr_t ocasescriptptr = (unsigned)(casescriptptr-script);
int oparsing_event = (unsigned)(parsing_event-script); intptr_t oparsing_event = (unsigned)(parsing_event-script);
int oparsing_actor = (unsigned)(parsing_actor-script); intptr_t oparsing_actor = (unsigned)(parsing_actor-script);
char *scriptptrs; char *scriptptrs;
int *newscript; intptr_t *newscript;
for (i=0;i<MAXSECTORS;i++) for (i=0;i<MAXSECTORS;i++)
{ {
if (labelcode[i] && labeltype[i] != LABEL_DEFINE) if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{ {
labelcode[i] -= (int)&script[0]; labelcode[i] -= (intptr_t)&script[0];
} }
} }
@ -916,10 +916,10 @@ static int skipcomments(void)
for (i=0;i<g_ScriptSize;i++) for (i=0;i<g_ScriptSize;i++)
{ {
// initprintf("%d\n",i); // initprintf("%d\n",i);
if ((int)script[i] >= (int)(&script[0]) && (int)script[i] < (int)(&script[g_ScriptSize])) if ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_ScriptSize]))
{ {
scriptptrs[i] = 1; scriptptrs[i] = 1;
j = (int)script[i] - (int)&script[0]; j = (intptr_t)script[i] - (intptr_t)&script[0];
script[i] = j; script[i] = j;
} }
else scriptptrs[i] = 0; else scriptptrs[i] = 0;
@ -928,28 +928,28 @@ static int skipcomments(void)
for (i=0;i<MAXTILES;i++) for (i=0;i<MAXTILES;i++)
if (actorscrptr[i]) if (actorscrptr[i])
{ {
j = (int)actorscrptr[i]-(int)&script[0]; j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0];
actorscrptr[i] = (int *)j; actorscrptr[i] = (intptr_t *)j;
} }
for (i=0;i<MAXTILES;i++) for (i=0;i<MAXTILES;i++)
if (actorLoadEventScrptr[i]) if (actorLoadEventScrptr[i])
{ {
j = (int)actorLoadEventScrptr[i]-(int)&script[0]; j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0];
actorLoadEventScrptr[i] = (int *)j; actorLoadEventScrptr[i] = (intptr_t *)j;
} }
for (i=0;i<MAXGAMEEVENTS;i++) for (i=0;i<MAXGAMEEVENTS;i++)
if (apScriptGameEvent[i]) if (apScriptGameEvent[i])
{ {
j = (int)apScriptGameEvent[i]-(int)&script[0]; j = (intptr_t)apScriptGameEvent[i]-(intptr_t)&script[0];
apScriptGameEvent[i] = (int *)j; apScriptGameEvent[i] = (intptr_t *)j;
} }
//initprintf("offset: %d\n",(unsigned)(scriptptr-script)); //initprintf("offset: %d\n",(unsigned)(scriptptr-script));
g_ScriptSize += 16384; g_ScriptSize += 16384;
initprintf("Increasing script buffer size to %d bytes...\n",g_ScriptSize); initprintf("Increasing script buffer size to %d bytes...\n",g_ScriptSize);
newscript = (int *)Brealloc(script, g_ScriptSize * sizeof(int)); newscript = (intptr_t *)Brealloc(script, g_ScriptSize * sizeof(intptr_t));
if (newscript == NULL) if (newscript == NULL)
{ {
@ -960,49 +960,49 @@ static int skipcomments(void)
return 1; return 1;
} }
script = newscript; script = newscript;
scriptptr = (int *)(script+oscriptptr); scriptptr = (intptr_t *)(script+oscriptptr);
//initprintf("offset: %d\n",(unsigned)(scriptptr-script)); //initprintf("offset: %d\n",(unsigned)(scriptptr-script));
if (casescriptptr != NULL) if (casescriptptr != NULL)
casescriptptr = (int *)(script+ocasescriptptr); casescriptptr = (intptr_t *)(script+ocasescriptptr);
if (parsing_event != NULL) if (parsing_event != NULL)
parsing_event = (int *)(script+oparsing_event); parsing_event = (intptr_t *)(script+oparsing_event);
if (parsing_actor != NULL) if (parsing_actor != NULL)
parsing_actor = (int *)(script+oparsing_actor); parsing_actor = (intptr_t *)(script+oparsing_actor);
for (i=0;i<MAXSECTORS;i++) for (i=0;i<MAXSECTORS;i++)
{ {
if (labelcode[i] && labeltype[i] != LABEL_DEFINE) if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{ {
labelcode[i] += (int)&script[0]; labelcode[i] += (intptr_t)&script[0];
} }
} }
for (i=0;i<g_ScriptSize-16384;i++) for (i=0;i<g_ScriptSize-16384;i++)
if (scriptptrs[i]) if (scriptptrs[i])
{ {
j = (int)script[i]+(int)&script[0]; j = (intptr_t)script[i]+(intptr_t)&script[0];
script[i] = j; script[i] = j;
} }
for (i=0;i<MAXTILES;i++) for (i=0;i<MAXTILES;i++)
if (actorscrptr[i]) if (actorscrptr[i])
{ {
j = (int)actorscrptr[i]+(int)&script[0]; j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0];
actorscrptr[i] = (int *)j; actorscrptr[i] = (intptr_t *)j;
} }
for (i=0;i<MAXTILES;i++) for (i=0;i<MAXTILES;i++)
if (actorLoadEventScrptr[i]) if (actorLoadEventScrptr[i])
{ {
j = (int)actorLoadEventScrptr[i]+(int)&script[0]; j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0];
actorLoadEventScrptr[i] = (int *)j; actorLoadEventScrptr[i] = (intptr_t *)j;
} }
for (i=0;i<MAXGAMEEVENTS;i++) for (i=0;i<MAXGAMEEVENTS;i++)
if (apScriptGameEvent[i]) if (apScriptGameEvent[i])
{ {
j = (int)apScriptGameEvent[i]+(int)&script[0]; j = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
apScriptGameEvent[i] = (int *)j; apScriptGameEvent[i] = (intptr_t *)j;
} }
Bfree(scriptptrs); Bfree(scriptptrs);
} }
@ -1568,9 +1568,9 @@ static int CountCaseStatements()
int lCount; int lCount;
char *temptextptr = textptr; char *temptextptr = textptr;
int temp_line_number = line_number; int temp_line_number = line_number;
int scriptoffset = (unsigned)(scriptptr-script); intptr_t scriptoffset = (unsigned)(scriptptr-script);
int caseoffset = (unsigned)(casescriptptr-script); intptr_t caseoffset = (unsigned)(casescriptptr-script);
int i; // int i;
casecount=0; casecount=0;
casescriptptr=NULL; casescriptptr=NULL;
@ -1586,13 +1586,13 @@ static int CountCaseStatements()
checking_switch++; checking_switch++;
textptr=temptextptr; textptr=temptextptr;
scriptptr = (int *)(script+scriptoffset); scriptptr = (intptr_t *)(script+scriptoffset);
line_number = temp_line_number; line_number = temp_line_number;
lCount=casecount; lCount=casecount;
casecount=0; casecount=0;
casescriptptr = (int *)(script+caseoffset); casescriptptr = (intptr_t *)(script+caseoffset);
casecount = 0; casecount = 0;
return lCount; return lCount;
} }
@ -1601,7 +1601,7 @@ static int parsecommand(void)
{ {
int i, j=0, k=0, done, tw; int i, j=0, k=0, done, tw;
char *temptextptr; char *temptextptr;
int *tempscrptr; intptr_t *tempscrptr;
if (quitevent) if (quitevent)
{ {
@ -1637,7 +1637,7 @@ static int parsecommand(void)
{ {
getlabel(); getlabel();
scriptptr--; scriptptr--;
labelcode[labelcnt] = (int) scriptptr; labelcode[labelcnt] = (intptr_t) scriptptr;
labeltype[labelcnt] = LABEL_STATE; labeltype[labelcnt] = LABEL_STATE;
parsing_state = 1; parsing_state = 1;
@ -1967,7 +1967,7 @@ static int parsecommand(void)
if (i == labelcnt) if (i == labelcnt)
{ {
labeltype[labelcnt] = LABEL_MOVE; labeltype[labelcnt] = LABEL_MOVE;
labelcode[labelcnt++] = (int) scriptptr; labelcode[labelcnt++] = (intptr_t) scriptptr;
} }
for (j=0;j<2;j++) for (j=0;j<2;j++)
{ {
@ -2160,7 +2160,7 @@ static int parsecommand(void)
if (i == labelcnt) if (i == labelcnt)
{ {
labeltype[labelcnt] = LABEL_AI; labeltype[labelcnt] = LABEL_AI;
labelcode[labelcnt++] = (int) scriptptr; labelcode[labelcnt++] = (intptr_t) scriptptr;
} }
for (j=0;j<3;j++) for (j=0;j<3;j++)
@ -2227,7 +2227,7 @@ static int parsecommand(void)
if (i == labelcnt) if (i == labelcnt)
{ {
labeltype[labelcnt] = LABEL_ACTION; labeltype[labelcnt] = LABEL_ACTION;
labelcode[labelcnt] = (int) scriptptr; labelcode[labelcnt] = (intptr_t) scriptptr;
labelcnt++; labelcnt++;
} }
@ -2571,14 +2571,14 @@ static int parsecommand(void)
case CON_ELSE: case CON_ELSE:
if (checking_ifelse) if (checking_ifelse)
{ {
int offset; intptr_t offset;
checking_ifelse--; checking_ifelse--;
tempscrptr = scriptptr; tempscrptr = scriptptr;
offset = (unsigned)(tempscrptr-script); offset = (unsigned)(tempscrptr-script);
scriptptr++; //Leave a spot for the fail location scriptptr++; //Leave a spot for the fail location
parsecommand(); parsecommand();
tempscrptr = (int *)script+offset; tempscrptr = (intptr_t *)script+offset;
*tempscrptr = (int) scriptptr; *tempscrptr = (intptr_t) scriptptr;
} }
else else
{ {
@ -3456,7 +3456,7 @@ static int parsecommand(void)
case CON_IFVARVARAND: case CON_IFVARVARAND:
case CON_WHILEVARVARN: case CON_WHILEVARVARN:
{ {
int offset; intptr_t offset;
transmultvars(2); transmultvars(2);
tempscrptr = scriptptr; tempscrptr = scriptptr;
@ -3466,8 +3466,8 @@ static int parsecommand(void)
j = keyword(); j = keyword();
parsecommand(); parsecommand();
tempscrptr = (int *)script+offset; tempscrptr = (intptr_t *)script+offset;
*tempscrptr = (int) scriptptr; *tempscrptr = (intptr_t) scriptptr;
if (tw != CON_WHILEVARVARN) checking_ifelse++; if (tw != CON_WHILEVARVARN) checking_ifelse++;
return 0; return 0;
@ -3494,7 +3494,7 @@ static int parsecommand(void)
case CON_IFVARAND: case CON_IFVARAND:
case CON_WHILEVARN: case CON_WHILEVARN:
{ {
int offset; intptr_t offset;
// get the ID of the DEF // get the ID of the DEF
transvar(); transvar();
@ -3507,8 +3507,8 @@ static int parsecommand(void)
j = keyword(); j = keyword();
parsecommand(); parsecommand();
tempscrptr = (int *)script+offset; tempscrptr = (intptr_t *)script+offset;
*tempscrptr = (int) scriptptr; *tempscrptr = (intptr_t) scriptptr;
if (tw != CON_WHILEVARN) checking_ifelse++; if (tw != CON_WHILEVARN) checking_ifelse++;
return 0; return 0;
@ -3663,7 +3663,7 @@ static int parsecommand(void)
case CON_SWITCH: case CON_SWITCH:
{ {
int tempoffset; intptr_t tempoffset;
//AddLog("Got Switch statement"); //AddLog("Got Switch statement");
if (checking_switch) if (checking_switch)
@ -3691,7 +3691,7 @@ static int parsecommand(void)
j=CountCaseStatements(); j=CountCaseStatements();
// initprintf("Done Counting Case Statements for switch %d: found %d.\n", checking_switch,j); // initprintf("Done Counting Case Statements for switch %d: found %d.\n", checking_switch,j);
tempscrptr = (int *)(script+tempoffset); tempscrptr = (intptr_t *)(script+tempoffset);
//AddLog(g_szBuf); //AddLog(g_szBuf);
if (checking_switch>1) if (checking_switch>1)
@ -3705,7 +3705,7 @@ static int parsecommand(void)
} }
if (tempscrptr) if (tempscrptr)
{ {
tempscrptr[1]=(int)j; // save count of cases tempscrptr[1]=(intptr_t)j; // save count of cases
} }
else else
{ {
@ -3729,7 +3729,7 @@ static int parsecommand(void)
//Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr); //Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr);
//AddLog(g_szBuf); //AddLog(g_szBuf);
} }
tempscrptr = (int *)(script+tempoffset); tempscrptr = (intptr_t *)(script+tempoffset);
//Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr);
//AddLog(g_szBuf); //AddLog(g_szBuf);
@ -3742,7 +3742,7 @@ static int parsecommand(void)
casecount=0; casecount=0;
if (tempscrptr) if (tempscrptr)
{ {
int t,n; intptr_t t,n;
for (i=3;i<3+tempscrptr[1]*2-2;i+=2) // sort them for (i=3;i<3+tempscrptr[1]*2-2;i+=2) // sort them
{ {
t=tempscrptr[i];n=i; t=tempscrptr[i];n=i;
@ -3755,7 +3755,7 @@ static int parsecommand(void)
} }
} }
// for (j=3;j<3+tempscrptr[1]*2;j+=2)initprintf("%5d %8x\n",tempscrptr[j],tempscrptr[j+1]); // for (j=3;j<3+tempscrptr[1]*2;j+=2)initprintf("%5d %8x\n",tempscrptr[j],tempscrptr[j+1]);
tempscrptr[0]= (int)scriptptr - (int)&script[0]; // save 'end' location tempscrptr[0]= (intptr_t)scriptptr - (intptr_t)&script[0]; // save 'end' location
} }
else else
{ {
@ -3777,7 +3777,7 @@ static int parsecommand(void)
case CON_CASE: case CON_CASE:
{ {
int tempoffset; intptr_t tempoffset;
//AddLog("Found Case"); //AddLog("Found Case");
repeatcase: repeatcase:
scriptptr--; // don't save in code scriptptr--; // don't save in code
@ -3811,7 +3811,7 @@ repeatcase:
} }
//AddLog("Adding value to script"); //AddLog("Adding value to script");
casescriptptr[casecount++]=j; // save value casescriptptr[casecount++]=j; // save value
casescriptptr[casecount]=(int)((int*)scriptptr-&script[0]); // save offset casescriptptr[casecount]=(intptr_t)((intptr_t*)scriptptr-&script[0]); // save offset
} }
// j = keyword(); // j = keyword();
//Bsprintf(g_szBuf,"case3: %.12s",textptr); //Bsprintf(g_szBuf,"case3: %.12s",textptr);
@ -3836,11 +3836,11 @@ repeatcase:
{ {
//AddLog("Found Repeat Case"); //AddLog("Found Repeat Case");
transword(); // eat 'case' transword(); // eat 'case'
tempscrptr = (int *)(script+tempoffset); tempscrptr = (intptr_t *)(script+tempoffset);
goto repeatcase; goto repeatcase;
} }
} }
tempscrptr = (int *)(script+tempoffset); tempscrptr = (intptr_t *)(script+tempoffset);
//AddLog("End Case"); //AddLog("End Case");
return 0; return 0;
// break; // break;
@ -3863,7 +3863,7 @@ repeatcase:
} }
if (casescriptptr) if (casescriptptr)
{ {
casescriptptr[0]=(int)(scriptptr-&script[0]); // save offset casescriptptr[0]=(intptr_t)(scriptptr-&script[0]); // save offset
} }
//Bsprintf(g_szBuf,"default: '%.22s'",textptr); //Bsprintf(g_szBuf,"default: '%.22s'",textptr);
//AddLog(g_szBuf); //AddLog(g_szBuf);
@ -4000,7 +4000,7 @@ repeatcase:
case CON_IFCANSEETARGET: case CON_IFCANSEETARGET:
case CON_IFNOSOUNDS: case CON_IFNOSOUNDS:
{ {
int offset; intptr_t offset;
if (tw == CON_IFP) if (tw == CON_IFP)
{ {
j = 0; j = 0;
@ -4022,8 +4022,8 @@ repeatcase:
j = keyword(); j = keyword();
parsecommand(); parsecommand();
tempscrptr = (int *)script+offset; tempscrptr = (intptr_t *)script+offset;
*tempscrptr = (int) scriptptr; *tempscrptr = (intptr_t) scriptptr;
checking_ifelse++; checking_ifelse++;
return 0; return 0;
@ -4924,7 +4924,7 @@ void loadefs(const char *filenam)
// clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no? // clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no?
if (script != NULL) if (script != NULL)
Bfree(script); Bfree(script);
script = Bcalloc(1,g_ScriptSize * sizeof(int)); script = Bcalloc(1,g_ScriptSize * sizeof(intptr_t));
labelcnt = defaultlabelcnt = 0; labelcnt = defaultlabelcnt = 0;
scriptptr = script+1; scriptptr = script+1;
@ -4937,7 +4937,7 @@ void loadefs(const char *filenam)
Bstrcpy(compilefile, filenam); // JBF 20031130: Store currently compiling file name Bstrcpy(compilefile, filenam); // JBF 20031130: Store currently compiling file name
passone(); //Tokenize passone(); //Tokenize
//*script = (int) scriptptr; //*script = (intptr_t) scriptptr;
Bfree(mptr); Bfree(mptr);
mptr = NULL; mptr = NULL;

View file

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osd.h" #include "osd.h"
int g_i,g_p; int g_i,g_p;
static int g_x,*g_t; static intptr_t g_x,*g_t;
static spritetype *g_sp; static spritetype *g_sp;
static int killit_flag; static int killit_flag;
@ -4017,7 +4017,8 @@ int getincangle(int a,int na)
static void alterang(int a) static void alterang(int a)
{ {
int aang = g_sp->ang, angdif, goalang; int aang = g_sp->ang, angdif, goalang;
int ticselapsed = (g_t[0])&31, *moveptr = (int *)g_t[1]; int ticselapsed = (g_t[0])&31;
intptr_t *moveptr = (intptr_t *)g_t[1];
int j = g_player[g_p].ps->holoduke_on; int j = g_player[g_p].ps->holoduke_on;
g_sp->xvel += (*moveptr-g_sp->xvel)/5; g_sp->xvel += (*moveptr-g_sp->xvel)/5;
@ -4141,7 +4142,7 @@ static void move(void)
return; return;
} }
moveptr = (int *)g_t[1]; moveptr = (intptr_t *)g_t[1];
if (a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1; if (a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1;
if (a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; if (a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1;
@ -4278,7 +4279,7 @@ static inline void parseifelse(int condition)
parse(); parse();
return; return;
} }
insptr = (int *) *(insptr+1); insptr = (intptr_t *) *(insptr+1);
if (*insptr == CON_ELSE) if (*insptr == CON_ELSE)
{ {
// else... // else...
@ -4478,9 +4479,9 @@ static int parse(void)
case CON_AI: case CON_AI:
insptr++; insptr++;
g_t[5] = *insptr++; // Ai g_t[5] = *insptr++; // Ai
g_t[4] = *(int *)(g_t[5]); // Action g_t[4] = *(intptr_t *)(g_t[5]); // Action
g_t[1] = *(int *)(g_t[5]+4); // move g_t[1] = *(intptr_t *)(g_t[5]+4); // move
g_sp->hitag = *(int *)(g_t[5]+8); // move flags g_sp->hitag = *(intptr_t *)(g_t[5]+8); // move flags
g_t[0] = g_t[2] = g_t[3] = 0; // count, actioncount... g_t[3] = ??? g_t[0] = g_t[2] = g_t[3] = 0; // count, actioncount... g_t[3] = ???
if (g_sp->hitag&random_angle) if (g_sp->hitag&random_angle)
g_sp->ang = TRAND&2047; g_sp->ang = TRAND&2047;
@ -4508,7 +4509,7 @@ static int parse(void)
break; break;
case CON_ELSE: case CON_ELSE:
insptr = (int *) *(insptr+1); insptr = (intptr_t *) *(insptr+1);
break; break;
case CON_ADDSTRENGTH: case CON_ADDSTRENGTH:
@ -4889,9 +4890,9 @@ static int parse(void)
case CON_STATE: case CON_STATE:
{ {
int *tempscrptr=insptr+2; intptr_t *tempscrptr=insptr+2;
insptr = (int *) *(insptr+1); insptr = (intptr_t *) *(insptr+1);
while (1) if (parse()) break; while (1) if (parse()) break;
insptr = tempscrptr; insptr = tempscrptr;
} }
@ -5218,7 +5219,8 @@ static int parse(void)
// For each case: value, ptr to code // For each case: value, ptr to code
//AddLog("Processing Switch..."); //AddLog("Processing Switch...");
int lValue=GetGameVarID(*insptr++, g_i, g_p), lEnd=*insptr++, lCases=*insptr++; int lValue=GetGameVarID(*insptr++, g_i, g_p), lEnd=*insptr++, lCases=*insptr++;
int *lpDefault=insptr++, *lpCases=insptr, bMatched=0, *lTempInsPtr, lCheckCase; intptr_t *lpDefault=insptr++, *lpCases=insptr, *lTempInsPtr;
int bMatched=0, lCheckCase;
int left,right; int left,right;
insptr+=lCases*2; insptr+=lCases*2;
lTempInsPtr=insptr; lTempInsPtr=insptr;
@ -5243,7 +5245,7 @@ static int parse(void)
// (int)insptr,(int)lCheckCase,lpCases[lCheckCase*2+1],(int)&script[0]); // (int)insptr,(int)lCheckCase,lpCases[lCheckCase*2+1],(int)&script[0]);
//AddLog(g_szBuf); //AddLog(g_szBuf);
// fake a 2-d Array // fake a 2-d Array
insptr=(int*)(lpCases[lCheckCase*2+1] + &script[0]); insptr=(intptr_t*)(lpCases[lCheckCase*2+1] + &script[0]);
//Bsprintf(g_szBuf,"insptr=%d. ", (int)insptr); //Bsprintf(g_szBuf,"insptr=%d. ", (int)insptr);
//AddLog(g_szBuf); //AddLog(g_szBuf);
while (1) while (1)
@ -5269,7 +5271,7 @@ static int parse(void)
//AddLog("No Matching Case: No Default to use"); //AddLog("No Matching Case: No Default to use");
} }
} }
insptr=(int*)(lEnd + (int)&script[0]); insptr=(intptr_t *)(lEnd + (intptr_t)&script[0]);
//Bsprintf(g_szBuf,"insptr=%d. ", (int)insptr); //Bsprintf(g_szBuf,"insptr=%d. ", (int)insptr);
//AddLog(g_szBuf); //AddLog(g_szBuf);
//AddLog("Done Processing Switch"); //AddLog("Done Processing Switch");
@ -6162,7 +6164,7 @@ static int parse(void)
else else
j = 0; j = 0;
} }
parseifelse((int) j); parseifelse((intptr_t) j);
} }
break; break;
@ -7014,7 +7016,7 @@ static int parse(void)
case CON_WHILEVARN: case CON_WHILEVARN:
{ {
int i; int i;
int *savedinsptr=insptr; intptr_t *savedinsptr=insptr;
j=1; j=1;
while (j) while (j)
{ {
@ -7033,7 +7035,7 @@ static int parse(void)
case CON_WHILEVARVARN: case CON_WHILEVARVARN:
{ {
int i,k; int i,k;
int *savedinsptr=insptr; intptr_t *savedinsptr=insptr;
j=1; j=1;
while (j) while (j)
{ {
@ -7256,13 +7258,13 @@ static int parse(void)
case CON_GETCURRADDRESS: case CON_GETCURRADDRESS:
insptr++; insptr++;
j=*insptr++; j=*insptr++;
SetGameVarID(j, (int)insptr, g_i, g_p); SetGameVarID(j, (intptr_t) insptr, g_i, g_p);
break; break;
case CON_JUMP: case CON_JUMP:
insptr++; insptr++;
j = GetGameVarID(*insptr++, g_i, g_p); j = GetGameVarID(*insptr++, g_i, g_p);
insptr = (int *)j; insptr = (intptr_t *)j;
break; break;
default: default:
@ -7337,14 +7339,14 @@ void execute(int iActor,int iPlayer,int lDist)
{ {
g_sp->lotag += TICSPERFRAME; g_sp->lotag += TICSPERFRAME;
if (g_sp->lotag > *(int *)(g_t[4]+16)) if (g_sp->lotag > *(intptr_t *)(g_t[4]+16))
{ {
g_t[2]++; g_t[2]++;
g_sp->lotag = 0; g_sp->lotag = 0;
g_t[3] += *(int *)(g_t[4]+12); g_t[3] += *(intptr_t *)(g_t[4]+12);
} }
if (klabs(g_t[3]) >= klabs(*(int *)(g_t[4]+4) * *(int *)(g_t[4]+12))) if (klabs(g_t[3]) >= klabs(*(intptr_t *)(g_t[4]+4) * *(intptr_t *)(g_t[4]+12)))
g_t[3] = 0; g_t[3] = 0;
} }

View file

@ -101,12 +101,13 @@ int screenpeek;
char ready2send; char ready2send;
int vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile; int vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile;
int *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; intptr_t *scriptptr,*insptr,*labelcode,*labeltype;
int *actorscrptr[MAXTILES],*parsing_actor; int labelcnt,defaultlabelcnt;
intptr_t *actorscrptr[MAXTILES],*parsing_actor;
char *label; char *label;
char *music_pointer; char *music_pointer;
char actortype[MAXTILES]; char actortype[MAXTILES];
int *script = NULL; intptr_t *script = NULL;
int g_ScriptSize = 16384; int g_ScriptSize = 16384;