From 48c47af5dcb4d29db181ebd8e97f83949fd0753c Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 23 Dec 2012 14:00:08 +0000 Subject: [PATCH] Pack actor_t's bposx/bposy/bposz members into a vec3_t named "bpos". git-svn-id: https://svn.eduke32.com/eduke32@3314 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 82 ++++++++++++------------ polymer/eduke32/source/actors.h | 6 +- polymer/eduke32/source/game.c | 10 +-- polymer/eduke32/source/gameexec.c | 6 +- polymer/eduke32/source/gamestructures.c | 18 +++--- polymer/eduke32/source/lunatic/defs.ilua | 3 +- polymer/eduke32/source/premap.c | 12 ++-- polymer/eduke32/source/sector.c | 4 +- 8 files changed, 72 insertions(+), 69 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 46b5dd33e..7956fe0bd 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -418,7 +418,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) spr->y += (sprite[OW].y-SY); spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; - Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); + Bmemcpy(&actor[spritenum].bpos.x, &sprite[spritenum], sizeof(vec3_t)); changespritesect(spritenum,sprite[OW].sectnum); } @@ -435,7 +435,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) spr->y += (sprite[OW].y-SY); spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; - Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); + Bmemcpy(&actor[spritenum].bpos.x, &sprite[spritenum], sizeof(vec3_t)); changespritesect(spritenum,sprite[OW].sectnum); } @@ -1053,7 +1053,7 @@ ACTOR_STATIC void G_MovePlayers(void) { s->x = p->opos.x; s->y = p->opos.y; - actor[i].bposz = s->z = p->opos.z+PHEIGHT; + actor[i].bpos.z = s->z = p->opos.z+PHEIGHT; s->ang = p->oang; setsprite(i,(vec3_t *)s); } @@ -1150,7 +1150,7 @@ ACTOR_STATIC void G_MovePlayers(void) if (p->holoduke_on == -1) KILLIT(i); - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); s->cstat = 0; if (s->xrepeat < 42) @@ -1441,7 +1441,7 @@ ACTOR_STATIC void G_MoveStandables(void) // 'fixed' sprites in rotating sectors already have bpos* updated if ((t[7]&(0xffff0000))!=0x18190000) - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); IFWITHIN(CRANE,CRANE+3) { @@ -1611,7 +1611,7 @@ ACTOR_STATIC void G_MoveStandables(void) { setsprite(s->owner,(vec3_t *)s); - Bmemcpy(&actor[s->owner].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[s->owner].bpos.x, s, sizeof(vec3_t)); s->zvel = 0; } @@ -2256,7 +2256,7 @@ CLEAR_THE_BOLT: } else { - actor[i].bposz = s->z = t[0]; + actor[i].bpos.z = s->z = t[0]; t[1] = 48+(krand()&31); } } @@ -2522,7 +2522,7 @@ ACTOR_STATIC void G_MoveWeapons(void) if (s->sectnum < 0) KILLIT(i); - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); /* Custom projectiles */ if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE)) @@ -3296,9 +3296,9 @@ ACTOR_STATIC void G_MoveTransports(void) else ps->pos.z = sprite[OW].z+6144; ps->opos.z = ps->pos.z; - actor[ps->i].bposx = ps->pos.x; - actor[ps->i].bposy = ps->pos.y; - actor[ps->i].bposz = ps->pos.z; + actor[ps->i].bpos.x = ps->pos.x; + actor[ps->i].bpos.y = ps->pos.y; + actor[ps->i].bpos.z = ps->pos.z; changespritesect(j,sprite[OW].sectnum); ps->cursectnum = sprite[OW].sectnum; @@ -3416,7 +3416,7 @@ ACTOR_STATIC void G_MoveTransports(void) sprite[j].z = sectlotag==ST_1_ABOVE_WATER ? sector[osect].ceilingz : sector[osect].floorz; - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); + Bmemcpy(&actor[j].bpos.x, &sprite[j], sizeof(vec3_t)); changespritesect(j, sprite[OW].sectnum); } @@ -3432,7 +3432,7 @@ ACTOR_STATIC void G_MoveTransports(void) sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz; sprite[j].ang = sprite[OW].ang; - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); + Bmemcpy(&actor[j].bpos.x, &sprite[j], sizeof(vec3_t)); if (sprite[i].pal == 0) { @@ -3458,7 +3458,7 @@ ACTOR_STATIC void G_MoveTransports(void) sprite[j].y += (sprite[OW].y-SY); sprite[j].z = sprite[OW].z+4096; - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); + Bmemcpy(&actor[j].bpos.x, &sprite[j], sizeof(vec3_t)); changespritesect(j,sprite[OW].sectnum); } @@ -3517,7 +3517,7 @@ ACTOR_STATIC void G_MoveActors(void) t = &actor[i].t_data[0]; - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); switchpicnum=s->picnum; @@ -4875,7 +4875,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (sect < 0 || s->xrepeat == 0) KILLIT(i); - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); switchpicnum = s->picnum; if (s->picnum > NUKEBUTTON && s->picnum <= NUKEBUTTON+3) @@ -5453,7 +5453,7 @@ static void HandleSE31(int32_t i, int32_t zref, int32_t t2val, int32_t movesigne g_player[sprite[j].yvel].ps->pos.z += l; if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) { - actor[j].bposz = sprite[j].z += l; + actor[j].bpos.z = sprite[j].z += l; actor[j].floorz = sc->floorz; } } @@ -5682,8 +5682,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sprite[p].z += zchange; // interpolation fix - actor[p].bposx = sprite[p].x; - actor[p].bposy = sprite[p].y; + actor[p].bpos.x = sprite[p].x; + actor[p].bpos.y = sprite[p].y; if (move_fixed_sprite(p, j, t[2])) rotatepoint(sprite[j].x,sprite[j].y,sprite[p].x,sprite[p].y,(q*l),&sprite[p].x,&sprite[p].y); @@ -5706,8 +5706,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0) continue; - actor[p].bposx = sprite[p].x; - actor[p].bposy = sprite[p].y; + actor[p].bpos.x = sprite[p].x; + actor[p].bpos.y = sprite[p].y; } } } @@ -5909,8 +5909,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 // fix interpolation if (numplayers < 2 && !g_netServer) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } if (move_fixed_sprite(j, s-sprite, t[2])) @@ -5923,8 +5923,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 if (g_netServer || numplayers > 1) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } } j = nextspritesect[j]; @@ -5961,8 +5961,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 (sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT)) && sprite[j].picnum != LOCATORS) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } } } @@ -6013,8 +6013,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 { if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } j = nextspritesect[j]; } @@ -6068,8 +6068,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 { if (numplayers < 2 && !g_netServer) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } sprite[j].x += l; @@ -6077,8 +6077,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 if (g_netServer || numplayers > 1) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; } } j = nextspritesect[j]; @@ -6769,7 +6769,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 } if (sprite[j].statnum != STAT_EFFECTOR) { - actor[j].bposz = sprite[j].z; + actor[j].bpos.z = sprite[j].z; sprite[j].z += q; } @@ -6848,7 +6848,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sprite[k].z = sector[sprite[j].sectnum].floorz- (sc->floorz-sprite[k].z); - Bmemcpy(&actor[k].bposx, &sprite[k], sizeof(vec3_t)); + Bmemcpy(&actor[k].bpos.x, &sprite[k], sizeof(vec3_t)); changespritesect(k,sprite[j].sectnum); setsprite(k,(vec3_t *)&sprite[k]); @@ -6889,7 +6889,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 g_player[sprite[j].yvel].ps->pos.z += sc->extra; if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) { - actor[j].bposz = sprite[j].z += sc->extra; + actor[j].bpos.z = sprite[j].z += sc->extra; actor[j].floorz = sc->floorz; } j = nextspritesect[j]; @@ -6923,7 +6923,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 g_player[sprite[j].yvel].ps->pos.z -= sc->extra; if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) { - actor[j].bposz = sprite[j].z -= sc->extra; + actor[j].bpos.z = sprite[j].z -= sc->extra; actor[j].floorz = sc->floorz; } j = nextspritesect[j]; @@ -7209,8 +7209,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 { if (sprite[j].z > (actor[j].floorz-(16<<8))) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; sprite[j].x += x>>2; sprite[j].y += l>>2; @@ -7321,8 +7321,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 nextj = nextspritesect[j]; if (sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PLAYER) { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; + actor[j].bpos.x = sprite[j].x; + actor[j].bpos.y = sprite[j].y; sprite[j].x += l; sprite[j].y += x; diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 3c696fd05..8cc396518 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -110,7 +110,8 @@ typedef struct { const int16_t padding_; #endif - int32_t flags, bposx,bposy,bposz; //16b + int32_t flags; //4b + vec3_t bpos; //12b int32_t floorz,ceilingz,lastvx,lastvy; //16b int32_t lasttransport; //4b @@ -157,7 +158,8 @@ typedef struct { const int16_t padding_; #endif - int32_t flags, bposx,bposy,bposz; //16b + int32_t flags; //4b + vec3_t bpos; //12b int32_t floorz,ceilingz,lastvx,lastvy; //16b int32_t lasttransport; //4b diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 68e1d2528..e67b9c786 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3991,7 +3991,7 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3 Bmemcpy(s, &spr_temp, sizeof(spritetype)); Bmemset(&actor[i], 0, sizeof(actor_t)); - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); // update bposx/y/z + Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t)); // update bposx/y/z if ((unsigned)s_ow < MAXSPRITES) { @@ -4085,7 +4085,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) i = pn; Bmemset(&actor[i], 0, sizeof(actor_t)); - Bmemcpy(&actor[i].bposx, &sprite[i], sizeof(vec3_t)); + Bmemcpy(&actor[i].bpos.x, &sprite[i], sizeof(vec3_t)); actor[i].picnum = PN; @@ -6353,9 +6353,9 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo else if ((s->statnum == STAT_DEFAULT && s->picnum != CRANEPOLE) || s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_PROJECTILE || s->statnum == STAT_MISC || s->statnum == STAT_ACTOR) { - t->x -= mulscale16(65536-smoothratio,s->x-actor[i].bposx); - t->y -= mulscale16(65536-smoothratio,s->y-actor[i].bposy); - t->z -= mulscale16(65536-smoothratio,s->z-actor[i].bposz); + t->x -= mulscale16(65536-smoothratio,s->x-actor[i].bpos.x); + t->y -= mulscale16(65536-smoothratio,s->y-actor[i].bpos.y); + t->z -= mulscale16(65536-smoothratio,s->z-actor[i].bpos.z); } sect = s->sectnum; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 01eadf4a2..222ceb5dc 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -555,10 +555,10 @@ GAMEEXEC_STATIC void VM_Move(void) if (vm.g_t[1] == 0 || a == 0) { - if (deadflag || (actor[vm.g_i].bposx != vm.g_sp->x) || (actor[vm.g_i].bposy != vm.g_sp->y)) + if (deadflag || (actor[vm.g_i].bpos.x != vm.g_sp->x) || (actor[vm.g_i].bpos.y != vm.g_sp->y)) { - actor[vm.g_i].bposx = vm.g_sp->x; - actor[vm.g_i].bposy = vm.g_sp->y; + actor[vm.g_i].bpos.x = vm.g_sp->x; + actor[vm.g_i].bpos.y = vm.g_sp->y; setsprite(vm.g_i, (vec3_t *)vm.g_sp); } return; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index de2a31b4b..6925665f5 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -2610,15 +2610,15 @@ static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa return; case ACTOR_HTBPOSX: - actor[iActor].bposx=lVar1; + actor[iActor].bpos.x=lVar1; return; case ACTOR_HTBPOSY: - actor[iActor].bposy=lVar1; + actor[iActor].bpos.y=lVar1; return; case ACTOR_HTBPOSZ: - actor[iActor].bposz=lVar1; + actor[iActor].bpos.z=lVar1; return; case ACTOR_HTG_T: @@ -2860,15 +2860,15 @@ static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa return; case ACTOR_HTBPOSX: - Gv_SetVarX(lVar2,actor[iActor].bposx); + Gv_SetVarX(lVar2,actor[iActor].bpos.x); return; case ACTOR_HTBPOSY: - Gv_SetVarX(lVar2,actor[iActor].bposy); + Gv_SetVarX(lVar2,actor[iActor].bpos.y); return; case ACTOR_HTBPOSZ: - Gv_SetVarX(lVar2,actor[iActor].bposz); + Gv_SetVarX(lVar2,actor[iActor].bpos.z); return; case ACTOR_HTG_T: @@ -3518,9 +3518,9 @@ static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int case ACTOR_HTCEILINGZ: return actor[iActor].ceilingz; case ACTOR_HTLASTVX: return actor[iActor].lastvx; case ACTOR_HTLASTVY: return actor[iActor].lastvy; - case ACTOR_HTBPOSX: return actor[iActor].bposx; - case ACTOR_HTBPOSY: return actor[iActor].bposy; - case ACTOR_HTBPOSZ: return actor[iActor].bposz; + case ACTOR_HTBPOSX: return actor[iActor].bpos.x; + case ACTOR_HTBPOSY: return actor[iActor].bpos.y; + case ACTOR_HTBPOSZ: return actor[iActor].bpos.z; case ACTOR_HTG_T: return actor[iActor].t_data[lParm2]; case ACTOR_ANGOFF: return spriteext[iActor].angoff; case ACTOR_PITCH: return spriteext[iActor].pitch; diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index c3079bf69..a4bda3568 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -135,7 +135,8 @@ local ACTOR_STRUCT = [[ const struct action ac; const int16_t _padding[1]; - int32_t flags, bposx,bposy,bposz; //16b + int32_t flags; //4b + vec3_t bpos; //12b int32_t floorz,ceilingz,lastvx,lastvy; //16b int32_t lasttransport; //4b diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 61cc5125d..95e72a797 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -662,9 +662,9 @@ void P_ResetPlayer(int32_t snum) tmpvect.y = pl->pos.y; tmpvect.z = pl->pos.z+PHEIGHT; P_RandomSpawnPoint(snum); - sp->x = actor[pl->i].bposx = pl->bobposx = pl->opos.x = pl->pos.x; - sp->y = actor[pl->i].bposy = pl->bobposy = pl->opos.y = pl->pos.y; - sp->z = actor[pl->i].bposy = pl->opos.z =pl->pos.z; + sp->x = actor[pl->i].bpos.x = pl->bobposx = pl->opos.x = pl->pos.x; + sp->y = actor[pl->i].bpos.y = pl->bobposy = pl->opos.y = pl->pos.y; + sp->z = actor[pl->i].bpos.y = pl->opos.z =pl->pos.z; updatesector(pl->pos.x,pl->pos.y,&pl->cursectnum); setsprite(pl->i,&tmpvect); sp->cstat = 257; @@ -1619,9 +1619,9 @@ static void resetpspritevars(char g) g_player[j].ps->autostep = (20L<<8); g_player[j].ps->autostep_sbw = (4L<<8); - actor[i].bposx = g_player[j].ps->bobposx = g_player[j].ps->opos.x = g_player[j].ps->pos.x = s->x; - actor[i].bposy = g_player[j].ps->bobposy = g_player[j].ps->opos.y = g_player[j].ps->pos.y = s->y; - actor[i].bposz = g_player[j].ps->opos.z = g_player[j].ps->pos.z = s->z; + actor[i].bpos.x = g_player[j].ps->bobposx = g_player[j].ps->opos.x = g_player[j].ps->pos.x = s->x; + actor[i].bpos.y = g_player[j].ps->bobposy = g_player[j].ps->opos.y = g_player[j].ps->pos.y = s->y; + actor[i].bpos.z = g_player[j].ps->opos.z = g_player[j].ps->pos.z = s->z; g_player[j].ps->oang = g_player[j].ps->ang = s->ang; updatesector(s->x,s->y,&g_player[j].ps->cursectnum); diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index d85d10bb7..304d4197e 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -249,7 +249,7 @@ void G_DoSectorAnimations(void) if (animateptr[i] == §or[animatesect[i]].floorz) for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) if (sprite[j].statnum != STAT_EFFECTOR) - actor[j].bposz = sprite[j].z; + actor[j].bpos.z = sprite[j].z; g_animateCount--; animateptr[i] = animateptr[g_animateCount]; @@ -294,7 +294,7 @@ void G_DoSectorAnimations(void) for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) if (sprite[j].statnum != STAT_EFFECTOR) { - actor[j].bposz = sprite[j].z; + actor[j].bpos.z = sprite[j].z; sprite[j].z += v; actor[j].floorz = sector[dasect].floorz+v; }