From 10fca8594d78eff08027c0a37bda2b3640c3ada9 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 21 Jan 2016 19:35:30 +0000 Subject: [PATCH] Replace msx/msy global arrays with vec2_t g_origins. Bump BYTEVERSION. git-svn-id: https://svn.eduke32.com/eduke32@5580 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 12 ++++++------ polymer/eduke32/source/config.c | 2 +- polymer/eduke32/source/duke3d.h | 6 +++--- polymer/eduke32/source/game.c | 24 ++++++++++-------------- polymer/eduke32/source/gamedef.c | 4 ++-- polymer/eduke32/source/gameexec.c | 6 ++---- polymer/eduke32/source/global.h | 2 +- polymer/eduke32/source/savegame.c | 3 +-- polymer/eduke32/source/sector.h | 3 ++- 9 files changed, 28 insertions(+), 34 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index e67b8857f..c2dda4c62 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -761,7 +761,7 @@ static void A_MoveSector(int i) for (i = sector[s->sectnum].wallptr; i < endwall; i++) { - vec2_t const v = { msx[j], msy[j] }; + vec2_t const v = g_origins[j]; vec2_t t; rotatepoint(zerovec, v, k & 2047, &t); dragpoint(i, s->x + t.x, s->y + t.y, 0); @@ -1579,7 +1579,7 @@ ACTOR_STATIC void G_MoveStandables(void) case STAT_STANDABLE: case STAT_PLAYER: { - vec3_t vect = { msx[t[4]+1], msy[t[4]+1], sprite[j].z }; + vec3_t vect = { g_origins[t[4]+1].x, g_origins[t[4]+1].y, sprite[j].z }; s->ang = getangle(vect.x-s->x, vect.y-s->y); setsprite(j, &vect); @@ -1680,7 +1680,7 @@ ACTOR_STATIC void G_MoveStandables(void) if ((sector[sect].floorz-s->z) > 8192) s->picnum++; - if (s->z < msx[t[4]+2]) + if (s->z < g_origins[t[4]+2].x) { t[0]++; s->xvel = 0; @@ -1692,9 +1692,9 @@ ACTOR_STATIC void G_MoveStandables(void) { if (s->xvel < 192) s->xvel += 8; - s->ang = getangle(msx[t[4]]-s->x,msy[t[4]]-s->y); + s->ang = getangle(g_origins[t[4]].x - s->x, g_origins[t[4]].y - s->y); A_SetSprite(i,CLIPMASK0); - if (((s->x-msx[t[4]])*(s->x-msx[t[4]])+(s->y-msy[t[4]])*(s->y-msy[t[4]])) < (128*128)) + if (((s->x-g_origins[t[4]].x)*(s->x-g_origins[t[4]].x)+(s->y-g_origins[t[4]].y)*(s->y-g_origins[t[4]].y)) < (128*128)) t[0]++; } @@ -1705,7 +1705,7 @@ ACTOR_STATIC void G_MoveStandables(void) vec3_t vect; Bmemcpy(&vect,s,sizeof(vec3_t)); vect.z -= (34<<8); - setsprite(msy[t[4]+2],&vect); + setsprite(g_origins[t[4]+2].y, &vect); } diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 33aca3b10..324a72e58 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -794,7 +794,7 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE); + SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_EDUKE32,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index d0ae62abc..4ee753369 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -54,16 +54,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // increase by 3, because atomic GRP adds 1, and Shareware adds 2 #ifdef LUNATIC // Lunatic -# define BYTEVERSION_JF 303 +# define BYTEVERSION_EDUKE32 306 #else // Non-Lua build -# define BYTEVERSION_JF 303 +# define BYTEVERSION_EDUKE32 306 #endif //#define BYTEVERSION_13 27 //#define BYTEVERSION_14 116 //#define BYTEVERSION_15 117 -#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) +#define BYTEVERSION (BYTEVERSION_EDUKE32+(PLUTOPAK?1:(VOLUMEONE<<1))) #define NUMPAGES 1 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 41acf9706..f2a279f55 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -5988,28 +5988,23 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->z = sector[sect].ceilingz+(48<<8); T5 = tempwallptr; - msx[tempwallptr] = sp->x; - msy[tempwallptr] = sp->y; - msx[tempwallptr+2] = sp->z; + g_origins[tempwallptr] = *(vec2_t *) sp; + g_origins[tempwallptr+2].x = sp->z; s = headspritestat[STAT_DEFAULT]; while (s >= 0) { if (sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag)) { - msy[tempwallptr+2] = s; + g_origins[tempwallptr+2].y = s; T2 = sprite[s].sectnum; sprite[s].xrepeat = 48; sprite[s].yrepeat = 128; - msx[tempwallptr+1] = sprite[s].x; - msy[tempwallptr+1] = sprite[s].y; - - sprite[s].x = sp->x; - sprite[s].y = sp->y; - sprite[s].z = sp->z; + g_origins[tempwallptr+1] = *(vec2_t *)&sprite[s]; + *(vec3_t *) &sprite[s] = *(vec3_t *) sp; sprite[s].shade = sp->shade; setsprite(s,(vec3_t *)&sprite[s]); @@ -6887,10 +6882,11 @@ int32_t A_Spawn(int32_t j, int32_t pn) T2 = tempwallptr; for (s=startwall; sx; - msy[tempwallptr] = wall[s].y-sp->y; + g_origins[tempwallptr].x = wall[s].x-sp->x; + g_origins[tempwallptr].y = wall[s].y-sp->y; + tempwallptr++; - if (EDUKE32_PREDICT_FALSE(tempwallptr > 2047)) + if (EDUKE32_PREDICT_FALSE(tempwallptr >= MAXANIMPOINTS)) { Bsprintf(tempbuf, "Too many moving sectors at (%d,%d).\n", TrackerCast(wall[s].x),TrackerCast(wall[s].y)); @@ -11593,7 +11589,7 @@ int32_t app_main(int32_t argc, char const * const * argv) G_ScanGroups(); #ifdef STARTUP_SETUP_WINDOW - if (i < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_JF || ud.config.ForceSetup)) || g_commandSetup) + if (i < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_EDUKE32 || ud.config.ForceSetup)) || g_commandSetup) { if (quitevent || !startwin_run()) { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index b8324a5e3..ee2bf0af7 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -4036,10 +4036,10 @@ DO_DEFSTATE: g_scriptPtr--; C_GetNextValue(LABEL_DEFINE); g_scriptPtr--; - if (EDUKE32_PREDICT_FALSE(*g_scriptPtr > BYTEVERSION_JF)) + if (EDUKE32_PREDICT_FALSE(*g_scriptPtr > BYTEVERSION_EDUKE32)) { g_numCompilerWarnings++; - initprintf("%s:%d: warning: need build %d, found build %d\n",g_szScriptFileName,g_lineNumber,k,BYTEVERSION_JF); + initprintf("%s:%d: warning: need build %d, found build %d\n",g_szScriptFileName,g_lineNumber,k,BYTEVERSION_EDUKE32); } continue; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index cac2298cf..abb675e41 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5727,8 +5727,7 @@ void G_SaveMapState(void) Bmemcpy(&save->SpriteDeletionQueue[0],&SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue)); Bmemcpy(&save->g_spriteDeleteQueuePos,&g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos)); Bmemcpy(&save->animwall[0],&animwall[0],sizeof(animwall)); - Bmemcpy(&save->msx[0],&msx[0],sizeof(msx)); - Bmemcpy(&save->msy[0],&msy[0],sizeof(msy)); + Bmemcpy(&save->origins[0],&g_origins[0],sizeof(g_origins)); Bmemcpy(&save->g_mirrorWall[0],&g_mirrorWall[0],sizeof(g_mirrorWall)); Bmemcpy(&save->g_mirrorSector[0],&g_mirrorSector[0],sizeof(g_mirrorSector)); Bmemcpy(&save->g_mirrorCount,&g_mirrorCount,sizeof(g_mirrorCount)); @@ -5851,8 +5850,7 @@ void G_RestoreMapState(void) Bmemcpy(&SpriteDeletionQueue[0],&save->SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue)); Bmemcpy(&g_spriteDeleteQueuePos,&save->g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos)); Bmemcpy(&animwall[0],&save->animwall[0],sizeof(animwall)); - Bmemcpy(&msx[0],&save->msx[0],sizeof(msx)); - Bmemcpy(&msy[0],&save->msy[0],sizeof(msy)); + Bmemcpy(&g_origins[0],&save->origins[0],sizeof(g_origins)); Bmemcpy(&g_mirrorWall[0],&save->g_mirrorWall[0],sizeof(g_mirrorWall)); Bmemcpy(&g_mirrorSector[0],&save->g_mirrorSector[0],sizeof(g_mirrorSector)); Bmemcpy(&g_mirrorCount,&save->g_mirrorCount,sizeof(g_mirrorCount)); diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 626838250..8e4875315 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -111,7 +111,7 @@ G_EXTERN int32_t g_scriptDebug; G_EXTERN int32_t g_showShareware; G_EXTERN int8_t g_numPlayerSprites; G_EXTERN int32_t g_tripbombLaserMode; -G_EXTERN int32_t msx[2048],msy[2048]; +G_EXTERN vec2_t g_origins[MAXANIMPOINTS]; G_EXTERN int32_t neartaghitdist,lockclock,g_startArmorAmount; G_EXTERN int32_t playerswhenstarted; G_EXTERN int32_t screenpeek; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index cff6f3590..ae63f630f 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -1134,8 +1134,7 @@ static const dataspec_t svgm_anmisc[] = { 0, &animateptr[0], sizeof(animateptr[0]), MAXANIMATES }, { DS_SAVEFN|DS_LOADFN , (void *)&sv_postanimateptr, 0, 1 }, { 0, &g_curViewscreen, sizeof(g_curViewscreen), 1 }, - { 0, &msx[0], sizeof(msx[0]), ARRAY_SIZE(msx) }, - { 0, &msy[0], sizeof(msy[0]), ARRAY_SIZE(msy) }, + { 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) }, { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, { DS_NOCHK, &g_spriteDeleteQueueSize, sizeof(g_spriteDeleteQueueSize), 1 }, { DS_CNT(g_spriteDeleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_spriteDeleteQueueSize }, diff --git a/polymer/eduke32/source/sector.h b/polymer/eduke32/source/sector.h index 33ddb4123..dd86337b1 100644 --- a/polymer/eduke32/source/sector.h +++ b/polymer/eduke32/source/sector.h @@ -35,6 +35,7 @@ extern "C" { #define MAXCYCLERS 1024 #define MAXANIMATES 1024 #define MAXANIMWALLS 512 +#define MAXANIMPOINTS 2048 #define VIEWSCREEN_ACTIVE_DISTANCE 8192 @@ -48,7 +49,7 @@ typedef struct { int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount; intptr_t animateptr[MAXANIMATES]; int32_t lockclock; - int32_t msx[2048], msy[2048]; + vec2_t origins[MAXANIMPOINTS]; int32_t randomseed, g_globalRandom; int32_t pskyidx;