From 4ff60232448eea9719178e3fb18ce7e85674acb5 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 19 Feb 2009 09:39:19 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1228 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 11 +- polymer/eduke32/build/src/engine.c | 36 ++--- polymer/eduke32/source/actors.c | 107 ++++++--------- polymer/eduke32/source/astub.c | 4 +- polymer/eduke32/source/game.c | 52 ++++--- polymer/eduke32/source/gamedef.c | 142 +++++++++----------- polymer/eduke32/source/gamedef.h | 1 + polymer/eduke32/source/gameexec.c | 76 ++++++++++- polymer/eduke32/source/gamevars.c | 3 +- polymer/eduke32/source/jaudiolib/_multivc.h | 2 +- polymer/eduke32/source/mdump.cpp | 8 +- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/player.c | 4 +- polymer/eduke32/source/premap.c | 12 +- 14 files changed, 243 insertions(+), 219 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index c21d03ecb..b8bfe2825 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -300,6 +300,15 @@ extern char noclip; EXTERN int32_t editorzrange[2]; +static inline int32_t getrendermode(void) +{ +#ifndef POLYMOST + return 0; +#else + return rendmode; +#endif +} + /************************************************************************* POSITION VARIABLES: @@ -498,8 +507,6 @@ typedef struct s_equation { typedef struct s_point2d { float x, y; } _point2d; -_equation equation(float x1, float y1, float x2, float y2); -int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2); int32_t wallvisible(int16_t wallnum); #define STATUS2DSIZ 144 diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index d2da36c2b..804adc5c4 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5043,7 +5043,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t // // initksqrt (internal) // -static void initksqrt(void) +static inline void initksqrt(void) { int32_t i, j, k; @@ -5101,7 +5101,7 @@ static void dosetaspect(void) // // loadtables (internal) // -static void calcbritable(void) +static inline void calcbritable(void) { int32_t i,j; double a,b; @@ -5382,7 +5382,7 @@ static int32_t deletespritestat(int16_t deleteme) // // lintersect (internal) // -static int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, +static inline int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) { //p1 to p2 is a line segment @@ -5415,7 +5415,7 @@ static int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_ // // rintersect (internal) // -static int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, +static inline int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) { //p1 towards p2 is a ray @@ -5447,7 +5447,7 @@ static int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_ // // keepaway (internal) // -static void keepaway(int32_t *x, int32_t *y, int32_t w) +static inline void keepaway(int32_t *x, int32_t *y, int32_t w) { int32_t dx, dy, ox, oy, x1, y1; char first; @@ -5468,7 +5468,7 @@ static void keepaway(int32_t *x, int32_t *y, int32_t w) // // raytrace (internal) // -static int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) +static inline int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) { int32_t x1, y1, x2, y2, bot, topu, nintx, ninty, cnt, z, hitwall; int32_t x21, y21, x43, y43; @@ -5950,7 +5950,7 @@ typedef struct s_maskleaf _maskleaf maskleaves[MAXWALLSB]; // returns equation of a line given two points -_equation equation(float x1, float y1, float x2, float y2) +static inline _equation equation(float x1, float y1, float x2, float y2) { _equation ret; @@ -5990,7 +5990,7 @@ int32_t wallvisible(int16_t wallnum) else return (0); } - +/* // returns the intersection point between two lines _point2d intersection(_equation eq1, _equation eq2) { @@ -6037,7 +6037,7 @@ int32_t wallobstructswall(_maskleaf* wall1, _maskleaf* wall2) } // recursive mask drawing function -void drawmaskleaf(_maskleaf* wall) +static inline void drawmaskleaf(_maskleaf* wall) { int32_t i; @@ -6056,8 +6056,9 @@ void drawmaskleaf(_maskleaf* wall) //OSD_Printf("Drawing mask %i\n", wall->index); drawmaskwall(wall->index); } +*/ -int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2) +static inline int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2) { float sign1, sign2; @@ -7121,7 +7122,7 @@ static void convertv6sprv7(struct spritetypev6 *from, spritetype *to) } // Powerslave uses v6 -// Witchaven 1 and TekWar use v5 +// Witchaven 1 and TekWar and LameDuke use v5 int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum) { @@ -12029,19 +12030,6 @@ int32_t setrendermode(int32_t renderer) return 0; } -// -// getrendermode -// -int32_t getrendermode(void) -{ -#ifndef POLYMOST - return 0; -#else - return rendmode; -#endif -} - - // // setrollangle // diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 84607f63d..45f129cf0 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2236,6 +2236,44 @@ static void G_MoveWeapons(void) // if( g_sounds[WIERDSHOT_FLY].num == 0 ) // A_PlaySound(WIERDSHOT_FLY,i); + if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS) + { + /* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) + Did this cause the bug with prematurely exploding projectiles? */ + if (s->yvel < 1) + { + + if (ActorExtra[i].projectile.spawns >= 0) + { + k = A_Spawn(i,ActorExtra[i].projectile.spawns); + + Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ + + if (ActorExtra[i].projectile.sxrepeat > 4) + sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; + if (ActorExtra[i].projectile.syrepeat > 4) + sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat; + } + if (ActorExtra[i].projectile.isound >= 0) + A_PlaySound(ActorExtra[i].projectile.isound,i); + + s->extra=ActorExtra[i].projectile.extra; + + if (ActorExtra[i].projectile.extra_rand > 0) + s->extra += (krand()&ActorExtra[i].projectile.extra_rand); + + x = s->extra; + A_RadiusDamage(i,ActorExtra[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x); + + KILLIT(i); + } + } + p = -1; if (ActorExtra[i].projectile.workslike & PROJECTILE_COOLEXPLOSION1) @@ -2261,11 +2299,6 @@ static void G_MoveWeapons(void) } Bmemcpy(&davect,s,sizeof(vec3_t)); - /* - dax = s->x; - day = s->y; - daz = s->z; - */ A_GetZLimits(i); qq = CLIPMASK1; @@ -2326,11 +2359,6 @@ static void G_MoveWeapons(void) k = A_Spawn(i,ActorExtra[i].projectile.spawns); Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2352,45 +2380,6 @@ static void G_MoveWeapons(void) } } - if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS) - { - /* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) - Did this cause the bug with prematurely exploding projectiles? */ - if (s->yvel < 1) - { - - if (ActorExtra[i].projectile.spawns >= 0) - { - k = A_Spawn(i,ActorExtra[i].projectile.spawns); - - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ - - if (ActorExtra[i].projectile.sxrepeat > 4) - sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; - if (ActorExtra[i].projectile.syrepeat > 4) - sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat; - } - if (ActorExtra[i].projectile.isound >= 0) - A_PlaySound(ActorExtra[i].projectile.isound,i); - - s->extra=ActorExtra[i].projectile.extra; - - if (ActorExtra[i].projectile.extra_rand > 0) - s->extra += (krand()&ActorExtra[i].projectile.extra_rand); - - x = s->extra; - A_RadiusDamage(i,ActorExtra[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x); - - KILLIT(i); - } - - } - if ((j&49152) != 49152) if (!(ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)) { @@ -2483,11 +2472,6 @@ static void G_MoveWeapons(void) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2582,11 +2566,6 @@ static void G_MoveWeapons(void) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2696,11 +2675,6 @@ static void G_MoveWeapons(void) } Bmemcpy(&davect,s,sizeof(vec3_t)); - /* - dax = s->x; - day = s->y; - daz = s->z; - */ A_GetZLimits(i); qq = CLIPMASK1; @@ -2892,11 +2866,6 @@ static void G_MoveWeapons(void) { k = A_Spawn(i,EXPLOSION2); Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ if (s->xrepeat < 10) { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 33afd4b91..902a69d7d 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8628,9 +8628,9 @@ int32_t ExtInit(void) { int32_t i; #if 1 - i=wm_ynbox("Texture Caching", + i=wm_ynbox("Texture Cache", "Would you like to enable the on-disk texture cache?\n\n" - "You will generally want to say 'yes' here, especially if using the HRP."); + "You generally want to say 'yes' here, especially if using the HRP."); #else i = 1; #endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ce676e9d4..c41754d75 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4577,6 +4577,8 @@ static void G_DumpDebugInfo(void) { int32_t i,j,x; // FILE * fp=fopen("condebug.log","w"); + + OSD_Printf("Current gamevar values:\n"); for (i=0;i= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && + !(spriteext[i].flags & SPREXT_NOTMD)) { - int32_t v=getangle(t->xvel,t->zvel>>4); - if (v>1023)v-=2048; - spriteext[i].pitch=v; + int32_t v = getangle(t->xvel, t->zvel>>4); + if (v > 1023) + v -= 2048; + spriteext[i].pitch = v; t->cstat &= ~4; break; } @@ -7272,7 +7276,7 @@ PALONLY: } if (g_player[screenpeek].ps->heat_amount > 0 && g_player[screenpeek].ps->heat_on && - (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == 13)) + (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == 13)) { t->pal = 6; t->shade = 0; @@ -9759,16 +9763,16 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) g_noMusic = 1; initprintf("Music off.\n"); } -/* - else if (*c == 'd' || *c == 'D') - { - FILE * fp=fopen("gamevars.txt","w"); - Gv_Init(); - Gv_DumpValues(fp); - fclose(fp); - initprintf("Game variables saved to gamevars.txt.\n"); - } -*/ + /* + else if (*c == 'd' || *c == 'D') + { + FILE * fp=fopen("gamevars.txt","w"); + Gv_Init(); + Gv_DumpValues(fp); + fclose(fp); + initprintf("Game variables saved to gamevars.txt.\n"); + } + */ else { G_ShowParameterHelp(); @@ -10891,9 +10895,9 @@ void app_main(int32_t argc,const char **argv) #if defined(POLYMOST) && defined(USE_OPENGL) if (glusetexcache == -1 || glusetexcachecompression == -1) { - i=wm_ynbox("Texture Caching", + i=wm_ynbox("Texture Cache", "Would you like to enable the on-disk texture cache?\n\n" - "You will generally want to say 'yes' here, especially if using the HRP."); + "You generally want to say 'yes' here, especially if using the HRP."); if (i) ud.config.useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; else glusetexcache = glusetexcachecompression = 0; } @@ -10938,12 +10942,6 @@ void app_main(int32_t argc,const char **argv) if (!ShellExecuteExA(&sinfo)) initprintf("update: error launching browser!\n"); - /* - CONFIG_SetupMouse(); - CONFIG_SetupJoystick(); - CONFIG_WriteSetup(); - G_GameExit(" "); - */ } } else initprintf("... no updates available\n"); @@ -13428,10 +13426,10 @@ FRAGBONUS: if (playerbest > 0) { Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad, - (playerbest/(26*60)), - (playerbest/26)%60, - ((playerbest%26)*38)/10 - ); + (playerbest/(26*60)), + (playerbest/26)%60, + ((playerbest%26)*38)/10 + ); gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10; } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index fede48490..771409cdb 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -38,6 +38,7 @@ char g_szBuf[1024]; intptr_t *g_caseScriptPtr=NULL; // the pointer to the start of the case table in a switch statement // first entry is 'default' code. +static intptr_t *previous_event=NULL; static int32_t g_numCases = 0; static int32_t g_checkingSwitch = 0, g_currentEvent = -1; static int32_t g_labelsOnly = 0, g_skipKeywordCheck = 0, g_dynamicTileMapping = 0; @@ -486,6 +487,7 @@ const char *keyw[] = "ifvarvareither", // 342 "getarraysize", // 343 "savenn", // 344 + "copy", // 345 "" }; @@ -2773,17 +2775,12 @@ static int32_t C_ParseCommand(void) g_numCompilerErrors++; return 0; } - + // if event has already been declared then store previous script location if (apScriptGameEvent[j]) { - tempscrptr = g_parsingEventPtr; - g_parsingEventPtr = g_parsingActorPtr = 0; - C_ReportError(-1); - g_parsingEventPtr = g_parsingActorPtr = tempscrptr; - initprintf("%s:%d: warning: duplicate event `%s'.\n",g_szScriptFileName,g_lineNumber,g_szCurrentBlockName); - g_numCompilerWarnings++; + previous_event =apScriptGameEvent[j]; } - else apScriptGameEvent[j]=g_parsingEventPtr; + apScriptGameEvent[j]=g_parsingEventPtr; g_checkingIfElse = 0; @@ -3863,6 +3860,46 @@ static int32_t C_ParseCommand(void) C_GetNextValue(LABEL_DEFINE); // the number to check against... return 0; + case CON_WRITEARRAYTOFILE: + case CON_READARRAYFROMFILE: + C_GetNextLabelName(); + i=GetADefID(label+(g_numLabels<<6)); + if (i > (-1)) + { + bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + *g_scriptPtr++=i; + } + else + C_ReportError(ERROR_NOTAGAMEARRAY); + C_GetNextValue(LABEL_DEFINE); + return 0; + case CON_COPY: + C_GetNextLabelName(); + i=GetADefID(label+(g_numLabels<<6)); + if (i > (-1)) + { + bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + *g_scriptPtr++=i; + } + else + C_ReportError(ERROR_NOTAGAMEARRAY); + C_SkipComments();// skip comments and whitespace + if (*textptr != '[') + { + g_numCompilerErrors++; + C_ReportError(ERROR_GAMEARRAYBNO); + return 1; + } + textptr++; + C_GetNextVar(); + C_SkipComments();// skip comments and whitespace + if (*textptr != ']') + { + g_numCompilerErrors++; + C_ReportError(ERROR_GAMEARRAYBNC); + return 1; + } + textptr++; case CON_SETARRAY: C_GetNextLabelName(); i=GetADefID(label+(g_numLabels<<6)); @@ -3906,6 +3943,7 @@ static int32_t C_ParseCommand(void) C_SkipComments(); C_GetNextVar(); return 0; + case CON_RANDVARVAR: if (!C_CheckEventSync(g_currentEvent)) { @@ -4885,7 +4923,7 @@ repeatcase: if (j < 0 || j > MAXVOLUMES-1) { initprintf("%s:%d: error: volume number exceeds maximum volume count.\n", - g_szScriptFileName,g_lineNumber); + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4900,7 +4938,7 @@ repeatcase: if (i >= (signed)sizeof(EpisodeNames[j])-1) { initprintf("%s:%d: warning: truncating volume name to %d characters.\n", - g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1); + g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -4920,7 +4958,7 @@ repeatcase: if (j < 0 || j > NUMGAMEFUNCTIONS-1) { initprintf("%s:%d: error: function number exceeds number of game functions.\n", - g_szScriptFileName,g_lineNumber); + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4936,7 +4974,7 @@ repeatcase: if (*textptr == '/' || *textptr == ' ') { initprintf("%s:%d: warning: invalid character in function name.\n", - g_szScriptFileName,g_lineNumber); + g_szScriptFileName,g_lineNumber); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -4944,7 +4982,7 @@ repeatcase: if (i >= MAXGAMEFUNCLEN-1) { initprintf("%s:%d: warning: truncating function name to %d characters.\n", - g_szScriptFileName,g_lineNumber,MAXGAMEFUNCLEN); + g_szScriptFileName,g_lineNumber,MAXGAMEFUNCLEN); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -4972,7 +5010,7 @@ repeatcase: if (j < 0 || j > 4) { initprintf("%s:%d: error: skill number exceeds maximum skill count.\n", - g_szScriptFileName,g_lineNumber); + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4987,7 +5025,7 @@ repeatcase: if (i >= (signed)sizeof(SkillNames[j])-1) { initprintf("%s:%d: warning: truncating skill name to %d characters.\n", - g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1); + g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -5012,7 +5050,7 @@ repeatcase: if (i >= (signed)sizeof(gamename)-1) { initprintf("%s:%d: warning: truncating game name to %d characters.\n", - g_szScriptFileName,g_lineNumber,sizeof(gamename)-1); + g_szScriptFileName,g_lineNumber,sizeof(gamename)-1); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -5142,7 +5180,7 @@ repeatcase: if (i >= (signed)sizeof(GametypeNames[j])-1) { initprintf("%s:%d: warning: truncating gametype name to %d characters.\n", - g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1); + g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -5230,7 +5268,7 @@ repeatcase: if (i >= 32) { initprintf("%s:%d: warning: truncating level name to %d characters.\n", - g_szScriptFileName,g_lineNumber,32); + g_szScriptFileName,g_lineNumber,32); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -5361,7 +5399,7 @@ repeatcase: if (i >= (signed)sizeof(CheatStrings[k])-1) { initprintf("%s:%d: warning: truncating cheat string to %d characters.\n", - g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1); + g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++; break; @@ -5440,6 +5478,16 @@ repeatcase: C_ReportError(ERROR_CLOSEBRACKET); g_numCompilerErrors++; } + // if event has already been declared then put a jump in instead + if (previous_event) + { + g_scriptPtr--; + *(g_scriptPtr++) = CON_JUMP; + *(g_scriptPtr++) = MAXGAMEVARS; + *(g_scriptPtr++) = previous_event-script; + *(g_scriptPtr++) = CON_ENDEVENT; + previous_event = NULL; + } g_parsingEventPtr = 0; g_parsingActorPtr = 0; g_currentEvent = -1; @@ -5622,45 +5670,6 @@ repeatcase: return 0; } -/* -#define NUM_DEFAULT_CONS 4 -static const char *defaultcons[NUM_DEFAULT_CONS] = -{ - "EDUKE.CON", - "GAME.CON", - "USER.CON", - "DEFS.CON" -}; - -void copydefaultcons(void) -{ - int32_t i, fs, fpi; - FILE *fpo; - - for (i=0;i> 8) < *insptr); -/* - if (sprite[vm.g_i].sectnum == g_player[vm.g_p].ps->cursectnum) - OSD_Printf("%d %d\n",ActorExtra[vm.g_i].floorz,ActorExtra[vm.g_i].ceilingz); -*/ + /* + if (sprite[vm.g_i].sectnum == g_player[vm.g_p].ps->cursectnum) + OSD_Printf("%d %d\n",ActorExtra[vm.g_i].floorz,ActorExtra[vm.g_i].ceilingz); + */ break; case CON_IFHITSPACE: @@ -3671,6 +3671,56 @@ static int32_t X_DoExecute(void) aGameArrays[j].plValues[index]=value; break; } + case CON_WRITEARRAYTOFILE: + case CON_READARRAYFROMFILE: + insptr++; + { + int32_t j=*insptr++; + { + int q = *insptr++; + + if (ScriptQuotes[q] == NULL) + { + OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); + break; + } + + if (tw == CON_READARRAYFROMFILE) + { + int32_t fil = kopen4loadfrommod(ScriptQuotes[q], 0); + int32_t asize; + + if (fil < 0) + break; + + asize = kfilelength(fil); + + if (asize > 0) + { + OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize); + aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, sizeof(int) * asize); + aGameArrays[j].size = asize; + } + + kread(fil,aGameArrays[j].plValues,sizeof(int) * asize); + kclose(fil); + } + else + { + FILE *fil; + char temp[BMAX_PATH]; + if (mod_dir[0] != '/') + Bsprintf(temp,"%s/%s",mod_dir,ScriptQuotes[q]); + else Bsprintf(temp,"%s",ScriptQuotes[q]); + if ((fil = fopen(temp,"wb")) == 0) break; + + fwrite(aGameArrays[j].plValues,1,sizeof(int) * aGameArrays[j].size,fil); + fclose(fil); + } + break; + } + } + case CON_GETARRAYSIZE: insptr++; { @@ -3693,6 +3743,24 @@ static int32_t X_DoExecute(void) break; } + case CON_COPY: + insptr++; + { + int32_t j=*insptr++; + { + int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + int32_t j1=*insptr++; + int32_t index1 = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + int32_t value = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + if (index>aGameArrays[j].size) break; + if (index1>aGameArrays[j1].size) break; + if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; + if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1; + memcpy(aGameArrays[j1].plValues+index1,aGameArrays[j].plValues+index,value*sizeof(int)); + break; + } + } + case CON_RANDVAR: insptr++; Gv_SetVarX(*insptr, mulscale16(krand(), *(insptr+1)+1)); diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index dbd0b0241..c811e5b9d 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -565,6 +565,7 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer) return -1; } label = Gv_GetVar(*insptr++, index, iPlayer); +// OSD_Printf("actorvar returned %d\n",label); } else label = *insptr++; @@ -777,7 +778,7 @@ int32_t __fastcall Gv_GetVarX(int32_t id) OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); return -1; } - label = Gv_GetVarX(*insptr++); + label = Gv_GetVar(*insptr++, index, vm.g_p); } else label = *insptr++; diff --git a/polymer/eduke32/source/jaudiolib/_multivc.h b/polymer/eduke32/source/jaudiolib/_multivc.h index 5b496ef62..4e9188233 100644 --- a/polymer/eduke32/source/jaudiolib/_multivc.h +++ b/polymer/eduke32/source/jaudiolib/_multivc.h @@ -80,7 +80,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) #define NumberOfBuffers 16 #define TotalBufferSize ( MixBufferSize * NumberOfBuffers ) -#define PI 3.1415926536 +#define PI 3.14159265358979323 typedef enum { diff --git a/polymer/eduke32/source/mdump.cpp b/polymer/eduke32/source/mdump.cpp index f4c91ec00..4a754f1e6 100644 --- a/polymer/eduke32/source/mdump.cpp +++ b/polymer/eduke32/source/mdump.cpp @@ -57,7 +57,7 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) /*if (!GetTempPath( _MAX_PATH, szDumpPath )) _tcscpy( szDumpPath, "c:\\temp\\" ); */ - Bsprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); + sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); _tcscat( szDumpPath, ".dmp" ); // ask the user if they want to save a dump file @@ -79,20 +79,20 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL ); if (bOK) { - Bsprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); + sprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); szResult = szScratch; retval = EXCEPTION_EXECUTE_HANDLER; } else { - Bsprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() ); + sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() ); szResult = szScratch; } ::CloseHandle(hFile); } else { - Bsprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() ); + sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() ); szResult = szScratch; } } diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 433bfc3d1..0a3af6c67 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -3395,8 +3395,8 @@ cheat_for_port_credits: menutext(c,50,MENUHIGHLIGHT(0),0,"RESOLUTION"); Bsprintf(tempbuf,"%d x %d", - (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim, - (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); + (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim, + (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); mgametext(c+168,50-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); menutext(c,50+16,MENUHIGHLIGHT(1),0,"RENDERER"); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index b0ea60c88..f30303cd4 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -3425,12 +3425,12 @@ void P_DropWeapon(DukePlayer_t *p) if (krand()&1) A_Spawn(p->i,WeaponPickupSprites[cw]); else switch (cw) - { + { case RPG_WEAPON: case HANDBOMB_WEAPON: A_Spawn(p->i,EXPLOSION2); break; - } + } } void P_AddAmmo(int32_t weapon,DukePlayer_t *p,int32_t amount) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 974892392..d8447ad0c 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -37,7 +37,7 @@ static int32_t g_whichPalForPlayer = 9; int32_t g_numRealPalettes; int16_t SpriteCacheList[MAXTILES][3]; -static char precachehightile[2][MAXTILES>>3]; +static uint8_t precachehightile[2][MAXTILES>>3]; static int32_t g_precacheCount; extern char *duke3dgrpstring; @@ -378,17 +378,17 @@ static void G_DoLoadScreen(char *statustext, int32_t percent) { int32_t ii = scale(288,percent,100); int32_t x = 32; -/* - j = usehightile; - usehightile = 0; -*/ + /* + j = usehightile; + usehightile = 0; + */ do { rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1); x++; } while (x < ii); -/* usehightile = j;*/ + /* usehightile = j;*/ } X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); nextpage();