diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index f76e084fa..763bedb73 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -14,11 +14,11 @@ EDITORLIB=build.lib !ifdef DEBUG # debugging options -flags_cl= /Ot /Zi /MTd +flags_cl= /Ot /Zi flags_link=/DEBUG !else # release options -flags_cl=/O2 /Ox /MT #/Ob1gity +flags_cl=/O2 /Ox #/Ob1gity flags_link=/RELEASE !endif @@ -33,7 +33,7 @@ CC=cl AS=ml LINK=link /opt:nowin98 /nologo /opt:ref 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" \ /DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \ /I$(DXROOT)\include /DRENDERTYPEWIN=1 diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 8701aa9f6..31ff6cf6b 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -533,11 +533,12 @@ extern char ready2send; // JBF 20040531: adding 16 extra to the script so we have some leeway // 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 char *label; -extern int *actorscrptr[MAXTILES],*parsing_actor; -extern int *actorLoadEventScrptr[MAXTILES]; +extern intptr_t *actorscrptr[MAXTILES],*parsing_actor; +extern intptr_t *actorLoadEventScrptr[MAXTILES]; extern char actortype[MAXTILES]; extern char *music_pointer; @@ -566,7 +567,7 @@ spriteinterpolate sprpos[MAXSPRITES]; typedef struct { int floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz; 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 tempang,actorstayput,dispicnum; short timetosleep; @@ -817,9 +818,9 @@ enum gamevarflags { }; typedef struct { - int lValue; - int lDefault; - int *plValues; // array of values when 'per-player', or 'per-actor' + intptr_t lValue; + intptr_t lDefault; + intptr_t *plValues; // array of values when 'per-player', or 'per-actor' unsigned int dwFlags; char *szLabel; char bReset; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index c010d8904..ea8a3adaa 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -36,7 +36,7 @@ int total_lines,line_number; static int checking_ifelse,parsing_state; 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. static int casecount = 0; 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 *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine -int *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire) -int *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire -int *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. -int *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon -int *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots -int *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item -int *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn -int *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' -int *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like -int *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound -int *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) -int *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time -int *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID -int *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed -int *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted +intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine +intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire) +intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire +intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none) +intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire. +intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon +intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots +intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item +intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn +intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' +intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like +intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound +intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) +intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time +intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID +intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed +intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted int g_iReturnVarID=-1; // var ID of "RETURN" 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_iThisActorID=-1; // var ID of "THISACTOR" -int *actorLoadEventScrptr[MAXTILES]; +intptr_t *actorLoadEventScrptr[MAXTILES]; -int *apScriptGameEvent[MAXGAMEEVENTS]; -int *parsing_event=NULL; +intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; +intptr_t *parsing_event=NULL; gamevar_t aGameVars[MAXGAMEVARS]; int iGameVarCount=0; @@ -849,7 +849,7 @@ static const memberlabel_t inputlabels[]= static int skipcomments(void) { char c; - int i,j; + intptr_t i, j; while ((c = *textptr)) { @@ -897,18 +897,18 @@ static int skipcomments(void) if ((unsigned)(scriptptr-script) > (unsigned)(g_ScriptSize-32)) { - int oscriptptr = (unsigned)(scriptptr-script); - int ocasescriptptr = (unsigned)(casescriptptr-script); - int oparsing_event = (unsigned)(parsing_event-script); - int oparsing_actor = (unsigned)(parsing_actor-script); + intptr_t oscriptptr = (unsigned)(scriptptr-script); + intptr_t ocasescriptptr = (unsigned)(casescriptptr-script); + intptr_t oparsing_event = (unsigned)(parsing_event-script); + intptr_t oparsing_actor = (unsigned)(parsing_actor-script); char *scriptptrs; - int *newscript; + intptr_t *newscript; for (i=0;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; - j = (int)script[i] - (int)&script[0]; + j = (intptr_t)script[i] - (intptr_t)&script[0]; script[i] = j; } else scriptptrs[i] = 0; @@ -928,28 +928,28 @@ static int skipcomments(void) for (i=0;i1) @@ -3705,7 +3705,7 @@ static int parsecommand(void) } if (tempscrptr) { - tempscrptr[1]=(int)j; // save count of cases + tempscrptr[1]=(intptr_t)j; // save count of cases } else { @@ -3729,7 +3729,7 @@ static int parsecommand(void) //Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr); //AddLog(g_szBuf); } - tempscrptr = (int *)(script+tempoffset); + tempscrptr = (intptr_t *)(script+tempoffset); //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); //AddLog(g_szBuf); @@ -3742,7 +3742,7 @@ static int parsecommand(void) casecount=0; if (tempscrptr) { - int t,n; + intptr_t t,n; for (i=3;i<3+tempscrptr[1]*2-2;i+=2) // sort them { 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]); - tempscrptr[0]= (int)scriptptr - (int)&script[0]; // save 'end' location + tempscrptr[0]= (intptr_t)scriptptr - (intptr_t)&script[0]; // save 'end' location } else { @@ -3777,7 +3777,7 @@ static int parsecommand(void) case CON_CASE: { - int tempoffset; + intptr_t tempoffset; //AddLog("Found Case"); repeatcase: scriptptr--; // don't save in code @@ -3811,7 +3811,7 @@ repeatcase: } //AddLog("Adding value to script"); 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(); //Bsprintf(g_szBuf,"case3: %.12s",textptr); @@ -3836,11 +3836,11 @@ repeatcase: { //AddLog("Found Repeat Case"); transword(); // eat 'case' - tempscrptr = (int *)(script+tempoffset); + tempscrptr = (intptr_t *)(script+tempoffset); goto repeatcase; } } - tempscrptr = (int *)(script+tempoffset); + tempscrptr = (intptr_t *)(script+tempoffset); //AddLog("End Case"); return 0; // break; @@ -3863,7 +3863,7 @@ repeatcase: } 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); //AddLog(g_szBuf); @@ -4000,7 +4000,7 @@ repeatcase: case CON_IFCANSEETARGET: case CON_IFNOSOUNDS: { - int offset; + intptr_t offset; if (tw == CON_IFP) { j = 0; @@ -4022,8 +4022,8 @@ repeatcase: j = keyword(); parsecommand(); - tempscrptr = (int *)script+offset; - *tempscrptr = (int) scriptptr; + tempscrptr = (intptr_t *)script+offset; + *tempscrptr = (intptr_t) scriptptr; checking_ifelse++; return 0; @@ -4924,7 +4924,7 @@ void loadefs(const char *filenam) // clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no? if (script != NULL) Bfree(script); - script = Bcalloc(1,g_ScriptSize * sizeof(int)); + script = Bcalloc(1,g_ScriptSize * sizeof(intptr_t)); labelcnt = defaultlabelcnt = 0; scriptptr = script+1; @@ -4937,7 +4937,7 @@ void loadefs(const char *filenam) Bstrcpy(compilefile, filenam); // JBF 20031130: Store currently compiling file name passone(); //Tokenize - //*script = (int) scriptptr; + //*script = (intptr_t) scriptptr; Bfree(mptr); mptr = NULL; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index a3f8aad1d..11ec270c7 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "osd.h" int g_i,g_p; -static int g_x,*g_t; +static intptr_t g_x,*g_t; static spritetype *g_sp; static int killit_flag; @@ -4017,7 +4017,8 @@ int getincangle(int a,int na) static void alterang(int a) { 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; g_sp->xvel += (*moveptr-g_sp->xvel)/5; @@ -4141,7 +4142,7 @@ static void move(void) 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&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; @@ -4278,7 +4279,7 @@ static inline void parseifelse(int condition) parse(); return; } - insptr = (int *) *(insptr+1); + insptr = (intptr_t *) *(insptr+1); if (*insptr == CON_ELSE) { // else... @@ -4478,9 +4479,9 @@ static int parse(void) case CON_AI: insptr++; g_t[5] = *insptr++; // Ai - g_t[4] = *(int *)(g_t[5]); // Action - g_t[1] = *(int *)(g_t[5]+4); // move - g_sp->hitag = *(int *)(g_t[5]+8); // move flags + g_t[4] = *(intptr_t *)(g_t[5]); // Action + g_t[1] = *(intptr_t *)(g_t[5]+4); // move + 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] = ??? if (g_sp->hitag&random_angle) g_sp->ang = TRAND&2047; @@ -4508,7 +4509,7 @@ static int parse(void) break; case CON_ELSE: - insptr = (int *) *(insptr+1); + insptr = (intptr_t *) *(insptr+1); break; case CON_ADDSTRENGTH: @@ -4889,9 +4890,9 @@ static int parse(void) 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; insptr = tempscrptr; } @@ -5218,7 +5219,8 @@ static int parse(void) // For each case: value, ptr to code //AddLog("Processing Switch..."); 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; insptr+=lCases*2; lTempInsPtr=insptr; @@ -5243,7 +5245,7 @@ static int parse(void) // (int)insptr,(int)lCheckCase,lpCases[lCheckCase*2+1],(int)&script[0]); //AddLog(g_szBuf); // 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); //AddLog(g_szBuf); while (1) @@ -5269,7 +5271,7 @@ static int parse(void) //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); //AddLog(g_szBuf); //AddLog("Done Processing Switch"); @@ -6162,7 +6164,7 @@ static int parse(void) else j = 0; } - parseifelse((int) j); + parseifelse((intptr_t) j); } break; @@ -7014,7 +7016,7 @@ static int parse(void) case CON_WHILEVARN: { int i; - int *savedinsptr=insptr; + intptr_t *savedinsptr=insptr; j=1; while (j) { @@ -7033,7 +7035,7 @@ static int parse(void) case CON_WHILEVARVARN: { int i,k; - int *savedinsptr=insptr; + intptr_t *savedinsptr=insptr; j=1; while (j) { @@ -7256,13 +7258,13 @@ static int parse(void) case CON_GETCURRADDRESS: insptr++; j=*insptr++; - SetGameVarID(j, (int)insptr, g_i, g_p); + SetGameVarID(j, (intptr_t) insptr, g_i, g_p); break; case CON_JUMP: insptr++; j = GetGameVarID(*insptr++, g_i, g_p); - insptr = (int *)j; + insptr = (intptr_t *)j; break; default: @@ -7337,14 +7339,14 @@ void execute(int iActor,int iPlayer,int lDist) { 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_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; } diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 961d8edb1..8ef407b4b 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -101,12 +101,13 @@ int screenpeek; char ready2send; int vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile; -int *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; -int *actorscrptr[MAXTILES],*parsing_actor; +intptr_t *scriptptr,*insptr,*labelcode,*labeltype; +int labelcnt,defaultlabelcnt; +intptr_t *actorscrptr[MAXTILES],*parsing_actor; char *label; char *music_pointer; char actortype[MAXTILES]; -int *script = NULL; +intptr_t *script = NULL; int g_ScriptSize = 16384;