From bbb53bc717718a7f5b60fbaca6e1aaf764bae8bc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 2 Apr 2021 11:13:33 +0200 Subject: [PATCH] - refactored the main User array into something that's automatically managed. --- source/games/sw/src/actor.cpp | 44 +- source/games/sw/src/ai.cpp | 104 ++--- source/games/sw/src/break.cpp | 4 +- source/games/sw/src/bunny.cpp | 42 +- source/games/sw/src/cache.cpp | 2 +- source/games/sw/src/coolg.cpp | 26 +- source/games/sw/src/coolie.cpp | 14 +- source/games/sw/src/copysect.cpp | 2 +- source/games/sw/src/draw.cpp | 27 +- source/games/sw/src/eel.cpp | 18 +- source/games/sw/src/game.cpp | 2 +- source/games/sw/src/game.h | 16 +- source/games/sw/src/girlninj.cpp | 14 +- source/games/sw/src/goro.cpp | 12 +- source/games/sw/src/hornet.cpp | 20 +- source/games/sw/src/input.cpp | 6 +- source/games/sw/src/interpso.cpp | 6 +- source/games/sw/src/inv.cpp | 2 +- source/games/sw/src/jweapon.cpp | 92 ++-- source/games/sw/src/lava.cpp | 8 +- source/games/sw/src/light.cpp | 2 +- source/games/sw/src/miscactr.cpp | 106 ++--- source/games/sw/src/ninja.cpp | 38 +- source/games/sw/src/panel.cpp | 12 +- source/games/sw/src/player.cpp | 108 ++--- source/games/sw/src/ripper.cpp | 34 +- source/games/sw/src/ripper2.cpp | 30 +- source/games/sw/src/rotator.cpp | 14 +- source/games/sw/src/save.cpp | 13 +- source/games/sw/src/sbar.cpp | 8 +- source/games/sw/src/sector.cpp | 30 +- source/games/sw/src/serp.cpp | 8 +- source/games/sw/src/skel.cpp | 10 +- source/games/sw/src/skull.cpp | 28 +- source/games/sw/src/slidor.cpp | 16 +- source/games/sw/src/sounds.cpp | 2 +- source/games/sw/src/spike.cpp | 22 +- source/games/sw/src/sprite.cpp | 172 ++++--- source/games/sw/src/sumo.cpp | 20 +- source/games/sw/src/track.cpp | 34 +- source/games/sw/src/vator.cpp | 22 +- source/games/sw/src/vis.cpp | 4 +- source/games/sw/src/wallmove.cpp | 2 +- source/games/sw/src/weapon.cpp | 758 +++++++++++++++---------------- source/games/sw/src/zilla.cpp | 10 +- source/games/sw/src/zombie.cpp | 16 +- 46 files changed, 977 insertions(+), 1003 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 586bcf9ed..d40885300 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -60,7 +60,7 @@ int DoScaleSprite(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int scale_value; if (u->scale_speed) @@ -92,7 +92,7 @@ DoScaleSprite(short SpriteNum) int DoActorDie(short SpriteNum, short weapon) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum]; @@ -299,7 +299,7 @@ DoDebrisCurrent(SPRITEp sp) { int nx, ny; int ret=0; - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); SECT_USERp sectu = SectUser[sp->sectnum]; //sp->clipdist = (256+128)>>2; @@ -329,7 +329,7 @@ int DoActorSectorDamage(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SECT_USERp sectu = SectUser[sp->sectnum]; SECTORp sectp = §or[sp->sectnum]; @@ -396,7 +396,7 @@ DoActorSectorDamage(short SpriteNum) int move_debris(short SpriteNum, int xchange, int ychange, int zchange) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ret = move_sprite(SpriteNum, xchange, ychange, zchange, u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS); @@ -411,7 +411,7 @@ int DoActorDebris(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SECTORp sectp = §or[sp->sectnum]; int nx, ny; @@ -475,7 +475,7 @@ int DoFireFly(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; nx = 4 * ACTORMOVETICS * bcos(sp->ang) >> 14; @@ -497,7 +497,7 @@ int DoGenerateSewerDebris(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short n; static STATEp Debris[] = @@ -527,7 +527,7 @@ DoGenerateSewerDebris(short SpriteNum) void KeepActorOnFloor(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; SECTORp sectp; int depth; @@ -619,7 +619,7 @@ KeepActorOnFloor(short SpriteNum) int DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_SLIDING); @@ -638,7 +638,7 @@ DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec) int DoActorSlide(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14); @@ -665,7 +665,7 @@ DoActorSlide(short SpriteNum) int DoActorBeginJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_JUMPING); RESET(u->Flags, SPR_FALLING); @@ -695,7 +695,7 @@ DoActorBeginJump(short SpriteNum) int DoActorJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int jump_adj; @@ -741,7 +741,7 @@ DoActorJump(short SpriteNum) int DoActorBeginFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_FALLING); RESET(u->Flags, SPR_JUMPING); @@ -773,7 +773,7 @@ DoActorBeginFall(short SpriteNum) int DoActorFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // adjust jump speed by gravity @@ -794,7 +794,7 @@ DoActorFall(short SpriteNum) int DoActorStopFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; sp->z = u->loz; @@ -847,7 +847,7 @@ DoActorDeathMove(short SpriteNum) { ANIMATOR DoFindGround; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -876,7 +876,7 @@ DoActorDeathMove(short SpriteNum) int DoBeginJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_JUMPING); RESET(u->Flags, SPR_FALLING); @@ -892,7 +892,7 @@ DoBeginJump(short SpriteNum) int DoJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int jump_adj; @@ -932,7 +932,7 @@ DoJump(short SpriteNum) int DoBeginFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_FALLING); RESET(u->Flags, SPR_JUMPING); @@ -948,7 +948,7 @@ DoBeginFall(short SpriteNum) int DoFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // adjust jump speed by gravity @@ -970,7 +970,7 @@ DoFall(short SpriteNum) int DoFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // adjust jump speed by gravity diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index d295bd9f0..525969698 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -79,7 +79,7 @@ Distance(int x1, int y1, int x2, int y2) void DebugMoveHit(short SpriteNum) { SPRITEp sp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); return; @@ -116,7 +116,7 @@ void DebugMoveHit(short SpriteNum) bool ActorMoveHitReact(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Should only return true if there is a reaction to what was hit that // would cause the calling function to abort @@ -129,7 +129,7 @@ bool ActorMoveHitReact(short SpriteNum) USERp hu; ANIMATORp action; - hu = User[HitSprite]; + hu = User[HitSprite].Data(); // if you ran into a player - call close range functions @@ -163,7 +163,7 @@ bool ActorMoveHitReact(short SpriteNum) bool ActorFlaming(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if (u->flame >= 0) @@ -186,7 +186,7 @@ bool ActorFlaming(short SpriteNum) void DoActorSetSpeed(short SpriteNum, uint8_t speed) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) @@ -252,7 +252,7 @@ ChooseActionNumber(short decision[]) int DoActorNoise(ANIMATORp Action, short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (Action == InitActorAmbientNoise) { @@ -310,7 +310,7 @@ DoActorNoise(ANIMATORp Action, short SpriteNum) bool CanSeePlayer(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // if actor can still see the player @@ -328,7 +328,7 @@ bool CanSeePlayer(short SpriteNum) int CanHitPlayer(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP, hp; hitdata_t hitinfo; int xvect,yvect,zvect; @@ -391,7 +391,7 @@ int DoActorPickClosePlayer(short SpriteNum) { //extern short Zombies; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c; short pnum; @@ -515,7 +515,7 @@ TARGETACTOR: int GetPlayerSpriteNum(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short pnum; PLAYERp pp; @@ -546,7 +546,7 @@ CloseRangeDist(SPRITEp sp1, SPRITEp sp2) int DoActorOperate(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short nearsector, nearwall, nearsprite; int nearhitdist; int z[2]; @@ -634,7 +634,7 @@ DECISION GenericFlaming[] = ANIMATORp DoActorActionDecide(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int dist; ANIMATORp action; @@ -706,7 +706,7 @@ DoActorActionDecide(short SpriteNum) } - pu = User[GetPlayerSpriteNum(SpriteNum)]; + pu = User[GetPlayerSpriteNum(SpriteNum)].Data(); // check for short range attack possibility if ((dist < CloseRangeDist(sp, u->tgt_sp) && ICanSee) || (pu && pu->WeaponNum == WPN_FIST && u->ID != RIPPER2_RUN_R0 && u->ID != RIPPER_RUN_R0)) @@ -822,7 +822,7 @@ DoActorActionDecide(short SpriteNum) int InitActorDecide(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // NOTE: It is possible to overflow the stack with too many calls to this // routine @@ -842,7 +842,7 @@ InitActorDecide(short SpriteNum) int DoActorDecide(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; ANIMATORp actor_action; @@ -898,7 +898,7 @@ int sw_snd_scratch = 0; int InitActorAlertNoise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 1; // MONO_PRINT(strcpy(ds,"Init Actor Threat Noise")); @@ -914,7 +914,7 @@ InitActorAlertNoise(short SpriteNum) int InitActorAmbientNoise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 2; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -930,7 +930,7 @@ InitActorAmbientNoise(short SpriteNum) int InitActorAttackNoise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 3; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -946,7 +946,7 @@ InitActorAttackNoise(short SpriteNum) int InitActorPainNoise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 4; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -962,7 +962,7 @@ InitActorPainNoise(short SpriteNum) int InitActorDieNoise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 5; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -978,7 +978,7 @@ InitActorDieNoise(short SpriteNum) int InitActorExtra1Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 6; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -993,7 +993,7 @@ InitActorExtra1Noise(short SpriteNum) int InitActorExtra2Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 7; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -1008,7 +1008,7 @@ InitActorExtra2Noise(short SpriteNum) int InitActorExtra3Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 8; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -1023,7 +1023,7 @@ InitActorExtra3Noise(short SpriteNum) int InitActorExtra4Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 9; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -1038,7 +1038,7 @@ InitActorExtra4Noise(short SpriteNum) int InitActorExtra5Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 10; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -1053,7 +1053,7 @@ InitActorExtra5Noise(short SpriteNum) int InitActorExtra6Noise(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sw_snd_scratch = 11; // MONO_PRINT(strcpy(ds,"Init Actor Move Noise")); @@ -1073,7 +1073,7 @@ InitActorExtra6Noise(short SpriteNum) int InitActorMoveCloser(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //MONO_PRINT("Init Actor Move Closer\n"); @@ -1090,7 +1090,7 @@ InitActorMoveCloser(short SpriteNum) int DoActorCantMoveCloser(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //MONO_PRINT("Can't move closer\n"); @@ -1123,7 +1123,7 @@ DoActorCantMoveCloser(short SpriteNum) int DoActorMoveCloser(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -1367,7 +1367,7 @@ FindWanderTrack(USERp u) int InitActorRunAway(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //MONO_PRINT("Init Actor RunAway\n"); @@ -1398,7 +1398,7 @@ InitActorRunAway(short SpriteNum) int InitActorRunToward(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //MONO_PRINT("InitActorRunToward\n"); @@ -1421,7 +1421,7 @@ InitActorRunToward(short SpriteNum) int InitActorAttack(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // zombie is attacking a player @@ -1442,7 +1442,7 @@ InitActorAttack(short SpriteNum) return 0; } - if (User[u->tgt_sp-sprite] && + if (User[u->tgt_sp-sprite].Data() && User[u->tgt_sp-sprite]->Health <= 0) { DoActorPickClosePlayer(SpriteNum); @@ -1458,7 +1458,7 @@ InitActorAttack(short SpriteNum) // if the guy you are after is dead, look for another and // reposition - if (User[u->tgt_sp-sprite] && + if (User[u->tgt_sp-sprite].Data() && User[u->tgt_sp-sprite]->PlayerP && TEST(User[u->tgt_sp-sprite]->PlayerP->Flags, PF_DEAD)) { @@ -1526,7 +1526,7 @@ InitActorAttack(short SpriteNum) int DoActorAttack(short SpriteNum) { - USERp u = User[SpriteNum],pu; + USERp u = User[SpriteNum].Data(),pu; SPRITEp sp = User[SpriteNum]->SpriteP; short rand_num; int dist,a,b,c; @@ -1535,7 +1535,7 @@ DoActorAttack(short SpriteNum) DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c); - pu = User[GetPlayerSpriteNum(SpriteNum)]; + pu = User[GetPlayerSpriteNum(SpriteNum)].Data(); if ((u->ActorActionSet->CloseAttack[0] && dist < CloseRangeDist(sp, u->tgt_sp)) || (pu && pu->WeaponNum == WPN_FIST)) // JBF: added null check { @@ -1563,7 +1563,7 @@ DoActorAttack(short SpriteNum) int InitActorEvade(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //MONO_PRINT("Init Actor Evade\n"); @@ -1591,7 +1591,7 @@ InitActorEvade(short SpriteNum) int InitActorWanderAround(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //DSPRINTF(ds, "InitActorWanderAround\n"); @@ -1616,7 +1616,7 @@ InitActorWanderAround(short SpriteNum) int InitActorFindPlayer(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int DoActorFindPlayer(short SpriteNum); @@ -1649,7 +1649,7 @@ InitActorFindPlayer(short SpriteNum) int InitActorDuck(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; short dist; @@ -1685,7 +1685,7 @@ InitActorDuck(short SpriteNum) int DoActorDuck(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics -= ACTORMOVETICS) < 0) { @@ -1701,7 +1701,7 @@ DoActorDuck(short SpriteNum) int DoActorMoveJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -1723,7 +1723,7 @@ DoActorMoveJump(short SpriteNum) int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int *stopz, short *stopsect) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx,ny; @@ -1789,7 +1789,7 @@ int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int int FindNewAngle(short SpriteNum, signed char dir, int DistToMove) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; static short toward_angle_delta[4][9] = @@ -1932,7 +1932,7 @@ int InitActorReposition(short SpriteNum) { int DoActorReposition(short SpriteNum); - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; short ang; int rnum; @@ -2038,7 +2038,7 @@ InitActorReposition(short SpriteNum) int DoActorReposition(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -2069,7 +2069,7 @@ DoActorReposition(short SpriteNum) int InitActorPause(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ActorActionFunc = DoActorPause; @@ -2085,7 +2085,7 @@ InitActorPause(short SpriteNum) int DoActorPause(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Using Vis instead of WaitTics, var name sucks, but it's the same type // WaitTics is used by too much other actor code and causes problems here @@ -2106,7 +2106,7 @@ int InitActorReposition(short SpriteNum) { int DoActorReposition(short SpriteNum); - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //MONO_PRINT("InitActorReposition\n"); @@ -2125,7 +2125,7 @@ InitActorReposition(short SpriteNum) int DoActorReposition(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -2148,7 +2148,7 @@ DoActorReposition(short SpriteNum) int InitActorPause(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //MONO_PRINT("InitActorPause\n"); @@ -2165,7 +2165,7 @@ InitActorPause(short SpriteNum) int DoActorPause(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if ((u->WaitTics -= ACTORMOVETICS) < 0) diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 115c82d51..b8403d267 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -845,7 +845,7 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short ty int KillBreakSprite(short BreakSprite) { SPRITEp bp = &sprite[BreakSprite]; - USERp bu = User[BreakSprite]; + USERp bu = User[BreakSprite].Data(); // Does not actually kill the sprite so it will be valid for the rest // of the loop traversal. @@ -1047,7 +1047,7 @@ bool NullActor(USERp u) int HitBreakSprite(short BreakSprite, short type) { SPRITEp bp = &sprite[BreakSprite]; - USERp bu = User[BreakSprite]; + USERp bu = User[BreakSprite].Data(); //SPRITEp sp; // ignore as a breakable if true diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index 27eedf564..9ddf29879 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -731,12 +731,12 @@ SetupBunny(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum, BUNNY_RUN_R0, s_BunnyRun[0]); + u = SpawnUser(SpriteNum, BUNNY_RUN_R0, s_BunnyRun[0]); u->Health = 10; } @@ -825,7 +825,7 @@ GetBunnyJumpHeight(short jump_speed, short jump_grav) int PickBunnyJumpSpeed(short SpriteNum, int pix_height) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ASSERT(pix_height < 128); @@ -853,7 +853,7 @@ int DoBunnyBeginJumpAttack(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp psp = User[SpriteNum]->tgt_sp; short tang; @@ -888,7 +888,7 @@ int DoBunnyMoveJump(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -922,7 +922,7 @@ DoBunnyMoveJump(short SpriteNum) int DoPickCloseBunny(short SpriteNum) { - USERp u = User[SpriteNum],tu; + USERp u = User[SpriteNum].Data(), tu; SPRITEp sp = &sprite[SpriteNum],tsp; int dist, near_dist = 1000, a,b,c; int i; @@ -936,7 +936,7 @@ DoPickCloseBunny(short SpriteNum) while ((i = it.NextIndex()) >= 0) { tsp = &sprite[i]; - tu = User[i]; + tu = User[i].Data(); if (sp == tsp) continue; @@ -963,7 +963,7 @@ int DoBunnyQuickJump(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->spal != PALETTE_PLAYER8) return false; @@ -975,7 +975,7 @@ DoBunnyQuickJump(short SpriteNum) { short hit_sprite = u->lo_sp - sprite; SPRITEp tsp = u->lo_sp; - USERp tu = User[hit_sprite]; + USERp tu = User[hit_sprite].Data(); if (!tu || tu->ID != BUNNY_RUN_R0) return false; @@ -1017,7 +1017,7 @@ DoBunnyQuickJump(short SpriteNum) { short hit_sprite = u->lo_sp - sprite; SPRITEp tsp = u->lo_sp; - USERp tu = User[hit_sprite]; + USERp tu = User[hit_sprite].Data(); if (!tu || tu->ID != BUNNY_RUN_R0) return false; @@ -1103,7 +1103,7 @@ DoBunnyQuickJump(short SpriteNum) int NullBunny(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) @@ -1129,7 +1129,7 @@ NullBunny(short SpriteNum) int DoBunnyPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullBunny(SpriteNum); @@ -1141,7 +1141,7 @@ int DoBunnyPain(short SpriteNum) int DoBunnyRipHeart(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = u->tgt_sp; @@ -1156,7 +1156,7 @@ int DoBunnyRipHeart(short SpriteNum) int DoBunnyStandKill(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullBunny(SpriteNum); @@ -1172,7 +1172,7 @@ int DoBunnyStandKill(short SpriteNum) void BunnyHatch(short Weapon) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); short New,i; SPRITEp np; @@ -1198,7 +1198,7 @@ void BunnyHatch(short Weapon) np->ang = rip_ang[i]; np->pal = 0; SetupBunny(New); - nu = User[New]; + nu = User[New].Data(); np->shade = wp->shade; // make immediately active @@ -1267,7 +1267,7 @@ int BunnyHatch2(short Weapon) np->ang = RANDOM_P2(2048); np->pal = 0; SetupBunny(New); - nu = User[New]; + nu = User[New].Data(); np->shade = wp->shade; // make immediately active @@ -1320,7 +1320,7 @@ int DoBunnyMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Parental lock crap if (TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE)) @@ -1403,7 +1403,7 @@ int DoBunnyEat(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) @@ -1455,7 +1455,7 @@ int DoBunnyScrew(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -1505,7 +1505,7 @@ int DoBunnyGrowUp(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (sp->pal == PALETTE_PLAYER1) return 0; // Don't bother white bunnies diff --git a/source/games/sw/src/cache.cpp b/source/games/sw/src/cache.cpp index 0f290f9f1..6a7601123 100644 --- a/source/games/sw/src/cache.cpp +++ b/source/games/sw/src/cache.cpp @@ -356,7 +356,7 @@ PreCacheActor(void) if (sprite[i].statnum >= MAXSTATUS) continue; - if (User[i]) + if (User[i].Data()) pic = User[i]->ID; else pic = sprite[i].picnum; diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index 0bc59215d..53e7254b7 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -501,7 +501,7 @@ void CoolgCommon(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->clipdist = (200) >> 2; //u->floor_dist = Z(5); @@ -524,12 +524,12 @@ SetupCoolg(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,COOLG_RUN_R0,s_CoolgRun[0]); + u = SpawnUser(SpriteNum,COOLG_RUN_R0,s_CoolgRun[0]); u->Health = HEALTH_COOLIE_GHOST; } @@ -553,7 +553,7 @@ extern short TotalKillable; int NewCoolg(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; USERp nu; SPRITEp np; @@ -562,7 +562,7 @@ NewCoolg(short SpriteNum) New = SpawnSprite(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50); - nu = User[New]; + nu = User[New].Data(); np = &sprite[New]; ChangeState(New, &s_CoolgBirth[0]); @@ -590,7 +590,7 @@ DoCoolgBirth(short New) USERp u; ANIMATOR DoActorDecide; - u = User[New]; + u = User[New].Data(); u->Health = HEALTH_COOLIE_GHOST; u->Attrib = &CoolgAttrib; @@ -612,7 +612,7 @@ DoCoolgBirth(short New) int NullCoolg(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ShellNum -= ACTORMOVETICS; @@ -630,7 +630,7 @@ int NullCoolg(short SpriteNum) int DoCoolgMatchPlayerZ(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = User[SpriteNum]->tgt_sp; int zdiff,zdist; int loz,hiz; @@ -712,7 +712,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum) int InitCoolgCircle(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ActorActionFunc = DoCoolgCircle; @@ -745,7 +745,7 @@ int InitCoolgCircle(short SpriteNum) int DoCoolgCircle(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx,ny,bound; @@ -788,7 +788,7 @@ int DoCoolgDeath(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; @@ -833,7 +833,7 @@ DoCoolgDeath(short SpriteNum) int DoCoolgMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->ShellNum -= ACTORMOVETICS) <= 0) { @@ -918,7 +918,7 @@ int DoCoolgMove(short SpriteNum) int DoCoolgPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullCoolg(SpriteNum); diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index d433cbc9a..17eaf864b 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -406,7 +406,7 @@ ACTOR_ACTION_SET CoolieActionSet = void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum]; unsigned int wpn; short wpn_cnt; @@ -531,12 +531,12 @@ SetupCoolie(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,COOLIE_RUN_R0,s_CoolieRun[0]); + u = SpawnUser(SpriteNum,COOLIE_RUN_R0,s_CoolieRun[0]); u->Health = HEALTH_COOLIE; } @@ -576,7 +576,7 @@ int SpawnCoolg(short SpriteNum) int CooliePain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -594,7 +594,7 @@ int CooliePain(short SpriteNum) int NullCoolie(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -610,7 +610,7 @@ int NullCoolie(short SpriteNum) int DoCoolieMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -660,7 +660,7 @@ DoCoolieWaitBirth(short SpriteNum) { USERp u; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); if ((u->Counter -= ACTORMOVETICS) <= 0) { diff --git a/source/games/sw/src/copysect.cpp b/source/games/sw/src/copysect.cpp index 48b36edfb..0da16c661 100644 --- a/source/games/sw/src/copysect.cpp +++ b/source/games/sw/src/copysect.cpp @@ -148,7 +148,7 @@ void CopySectorMatch(short match) // kill anything not invisible if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE)) { - if (User[kill]) + if (User[kill].Data()) { // be safe with the killing //SetSuicide(kill); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 74e3cc003..50a7054f4 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -104,7 +104,7 @@ GetRotation(short tSpriteNum, int viewx, int viewy) short rotation; tspriteptr_t tsp = &tsprite[tSpriteNum]; - USERp tu = User[tsp->owner]; + USERp tu = User[tsp->owner].Data(); short angle2; if (tu->RotNum == 0) @@ -171,7 +171,7 @@ int SetActorRotation(short tSpriteNum, int viewx, int viewy) { tspriteptr_t tsp = &tsprite[tSpriteNum]; - USERp tu = User[tsp->owner]; + USERp tu = User[tsp->owner].Data(); short StateOffset, Rotation; // don't modify ANY tu vars - back them up! @@ -206,7 +206,7 @@ int DoShadowFindGroundPoint(tspriteptr_t sp) { // USES TSPRITE !!!!! - USERp u = User[sp->owner]; + USERp u = User[sp->owner].Data(); SPRITEp hsp; int ceilhit, florhit; int hiz, loz = u->loz; @@ -264,7 +264,7 @@ void DoShadows(tspriteptr_t tsp, int viewz, bool mirror) { tspriteptr_t New = &tsprite[spritesortcnt]; - USERp tu = User[tsp->owner]; + USERp tu = User[tsp->owner].Data(); int ground_dist = 0; int view_dist = 0; int loz; @@ -364,7 +364,7 @@ DoShadows(tspriteptr_t tsp, int viewz, bool mirror) void DoMotionBlur(tspritetype const * const tsp) { - USERp tu = User[tsp->owner]; + USERp tu = User[tsp->owner].Data(); int nx,ny,nz = 0,dx,dy,dz; short i, ang; short xrepeat, yrepeat, repeat_adj = 0; @@ -571,7 +571,7 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror) { SpriteNum = tsprite[tSpriteNum].owner; tspriteptr_t tsp = &tsprite[tSpriteNum]; - tu = User[SpriteNum]; + tu = User[SpriteNum].Data(); #if 0 // Brighten up the sprite if set somewhere else to do so @@ -892,7 +892,7 @@ post_analyzesprites(void) SpriteNum = tsprite[tSpriteNum].owner; if (SpriteNum < 0) continue; // JBF: verify this is safe tspriteptr_t tsp = &tsprite[tSpriteNum]; - tu = User[SpriteNum]; + tu = User[SpriteNum].Data(); if (tu) { @@ -1060,7 +1060,7 @@ void PrintSpriteInfo(PLAYERp pp) short hit_sprite = DoPickTarget(pp->SpriteP, 32, 2); sp = &sprite[hit_sprite]; - u = User[hit_sprite]; + u = User[hit_sprite].Data(); sp->hitag = 9997; // Special tag to make the actor glow red for one frame @@ -1126,7 +1126,7 @@ void DrawCrosshair(PLAYERp pp) if (!(CameraTestMode)) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); ::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10)); } } @@ -1272,7 +1272,7 @@ PostDraw(void) it.Reset(STAT_FAF_COPY); while ((i = it.NextIndex()) >= 0) { - FreeUser(i); + User[i].Clear(); deletesprite(i); } } @@ -1356,7 +1356,7 @@ void PreDrawStackedWater(void) SectIterator it(sprite[si].sectnum); while ((i = it.NextIndex()) >= 0) { - if (User[i]) + if (User[i].Data()) { if (sprite[i].statnum == STAT_ITEM) continue; @@ -1369,13 +1369,14 @@ void PreDrawStackedWater(void) continue; sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); New = ConnectCopySprite((uspritetype const *)sp); if (New >= 0) { // spawn a user - User[New] = nu = NewUser(); + User[New].Alloc(); + nu = User[New].Data(); ASSERT(nu != NULL); nu->xchange = -989898; diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index 33ddf6ac6..c450c379d 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -361,7 +361,7 @@ void EelCommon(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->clipdist = (100) >> 2; u->floor_dist = Z(16); @@ -384,12 +384,12 @@ SetupEel(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,EEL_RUN_R0,s_EelRun[0]); + u = SpawnUser(SpriteNum,EEL_RUN_R0,s_EelRun[0]); u->Health = 40; } @@ -415,7 +415,7 @@ SetupEel(short SpriteNum) int NewEel(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; USERp nu; SPRITEp np; @@ -425,7 +425,7 @@ NewEel(short SpriteNum) New = SpawnSprite(STAT_ENEMY, EEL_RUN_R0, &s_EelBirth, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50); - nu = User[New]; + nu = User[New].Data(); np = &sprite[New]; ChangeState(New, &s_EelBirth); @@ -445,7 +445,7 @@ NewEel(short SpriteNum) int NullEel(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -460,7 +460,7 @@ int NullEel(short SpriteNum) int DoEelMatchPlayerZ(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = User[SpriteNum]->tgt_sp; int zdiff,zdist; int loz,hiz; @@ -561,7 +561,7 @@ int DoEelDeath(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; if (TEST(u->Flags, SPR_FALLING)) { @@ -601,7 +601,7 @@ DoEelDeath(short SpriteNum) int DoEelMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ASSERT(u->Rot != NULL); diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index eea3e0f38..c52b74690 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -480,7 +480,7 @@ void TerminateLevel(void) StatIterator it(stat); if ((i = it.NextIndex()) >= 0) { - if (User[i]) puser[pnum].CopyFromUser(User[i]); + if (User[i].Data()) puser[pnum].CopyFromUser(User[i].Data()); } } diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 79a9691f5..bf48332ae 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1460,7 +1460,7 @@ struct USERSAVE #define SPR2_DONT_TARGET_OWNER (BIT(24)) -extern USERp User[MAXSPRITES]; +extern TPointer User[MAXSPRITES]; typedef struct { @@ -1468,20 +1468,6 @@ typedef struct } RANGE,*RANGEp; -#pragma message ("Remove NewUser/FreeUser!") -inline USER* NewUser() -{ - return new USER; -} - -inline void FreeUser(int num) -{ - if (User[num]) delete User[num]; - User[num] = nullptr; -} - - - /////////////////////////////////////////////////////////////////////////////////////////// // // Sector Stuff - Sector Objects and Tracks diff --git a/source/games/sw/src/girlninj.cpp b/source/games/sw/src/girlninj.cpp index ab7b4d901..582e96f56 100644 --- a/source/games/sw/src/girlninj.cpp +++ b/source/games/sw/src/girlninj.cpp @@ -722,12 +722,12 @@ SetupGirlNinja(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum, GIRLNINJA_RUN_R0, s_GirlNinjaRun[0]); + u = SpawnUser(SpriteNum, GIRLNINJA_RUN_R0, s_GirlNinjaRun[0]); u->Health = 100; } @@ -753,7 +753,7 @@ SetupGirlNinja(short SpriteNum) int DoGirlNinjaMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // jumping and falling if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING) && !TEST(u->Flags, SPR_CLIMBING)) @@ -791,7 +791,7 @@ DoGirlNinjaMove(short SpriteNum) int GirlNinjaJumpActionFunc(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -816,7 +816,7 @@ GirlNinjaJumpActionFunc(short SpriteNum) int NullGirlNinja(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS; @@ -834,7 +834,7 @@ NullGirlNinja(short SpriteNum) int DoGirlNinjaPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullGirlNinja(SpriteNum); @@ -847,7 +847,7 @@ int DoGirlNinjaPain(short SpriteNum) int DoGirlNinjaSpecial(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->spal == PALETTE_PLAYER5) { diff --git a/source/games/sw/src/goro.cpp b/source/games/sw/src/goro.cpp index 7dffea481..106ec7c9f 100644 --- a/source/games/sw/src/goro.cpp +++ b/source/games/sw/src/goro.cpp @@ -490,12 +490,12 @@ SetupGoro(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,GORO_RUN_R0,s_GoroRun[0]); + u = SpawnUser(SpriteNum,GORO_RUN_R0,s_GoroRun[0]); u->Health = HEALTH_GORO; } @@ -515,7 +515,7 @@ SetupGoro(short SpriteNum) int NullGoro(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ASSERT(SpriteNum >= 0); @@ -530,7 +530,7 @@ int NullGoro(short SpriteNum) int DoGoroPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ASSERT(SpriteNum >= 0); @@ -543,7 +543,7 @@ int DoGoroPain(short SpriteNum) int DoGoroMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ASSERT(SpriteNum >= 0); @@ -555,7 +555,7 @@ int DoGoroMove(short SpriteNum) else (*u->ActorActionFunc)(SpriteNum); - ASSERT(User[SpriteNum]); + ASSERT(User[SpriteNum].Data()); KeepActorOnFloor(SpriteNum); diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index ae6e9c9d4..ac4036f26 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -296,12 +296,12 @@ SetupHornet(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,HORNET_RUN_R0,s_HornetRun[0]); + u = SpawnUser(SpriteNum,HORNET_RUN_R0,s_HornetRun[0]); u->Health = HEALTH_HORNET; } @@ -334,7 +334,7 @@ SetupHornet(short SpriteNum) int NullHornet(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -349,7 +349,7 @@ int NullHornet(short SpriteNum) int DoHornetMatchPlayerZ(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = User[SpriteNum]->tgt_sp; int zdiff,zdist; int loz,hiz; @@ -424,7 +424,7 @@ int DoHornetMatchPlayerZ(short SpriteNum) int InitHornetCircle(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ActorActionFunc = DoHornetCircle; @@ -456,7 +456,7 @@ int InitHornetCircle(short SpriteNum) int DoHornetCircle(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx,ny,bound; sp->ang = NORM_ANGLE(sp->ang + u->Counter2); @@ -509,7 +509,7 @@ int DoHornetDeath(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; if (TEST(u->Flags, SPR_FALLING)) @@ -554,7 +554,7 @@ int DoCheckSwarm(short SpriteNum) { int i; SPRITEp sp = &sprite[SpriteNum], tsp; - USERp u = User[SpriteNum], tu; + USERp u = User[SpriteNum].Data(), tu; int dist, pdist, a,b,c; PLAYERp pp; @@ -578,7 +578,7 @@ int DoCheckSwarm(short SpriteNum) while ((i = it.NextIndex()) >= 0) { tsp = &sprite[i]; - tu = User[i]; + tu = User[i].Data(); if (!tu) continue; @@ -599,7 +599,7 @@ int DoCheckSwarm(short SpriteNum) int DoHornetMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Check for swarming // lotag of 1 = Swarm around lotags of 2 diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index 21dce2c70..a3c3a72b7 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -80,7 +80,7 @@ enum static void processWeapon(PLAYERp const pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int i; if (loc.getNewWeapon() == WeaponSel_Next) @@ -120,7 +120,7 @@ static void processWeapon(PLAYERp const pp) } else if (loc.getNewWeapon() == WeaponSel_Prev) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short prev_weapon = u->WeaponNum - 1; short start_weapon; @@ -153,7 +153,7 @@ static void processWeapon(PLAYERp const pp) } else if (loc.getNewWeapon() == WeaponSel_Alt) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short const which_weapon = u->WeaponNum + 1; loc.setNewWeapon(which_weapon); } diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index bcb2c9612..744d2ba6a 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -269,7 +269,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings { if (data->spriteofang >= 0) { - USERp u = User[data->spriteofang]; + USERp u = User[data->spriteofang].Data(); if (u) u->oangdiff = 0; if (!interpolating) @@ -316,7 +316,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b data->lastoldipos = data->oldipos; if (data->spriteofang >= 0) { - USERp u = User[data->spriteofang]; + USERp u = User[data->spriteofang].Data(); data->lastangdiff = u ? u->oangdiff : 0; } } @@ -358,7 +358,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b if (data->curelement >= soi_sprx) { int32_t sprnum = data->curelement & soi_base; - USERp u = User[sprnum]; + USERp u = User[sprnum].Data(); if (u && (sprite[sprnum].statnum != STAT_DEFAULT) && ((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) || (TEST(u->Flags, SPR_SKIP2) && (sprite[sprnum].statnum <= STAT_SKIP2_INTERP_END)))) diff --git a/source/games/sw/src/inv.cpp b/source/games/sw/src/inv.cpp index f2ac14bad..79d6de4b5 100644 --- a/source/games/sw/src/inv.cpp +++ b/source/games/sw/src/inv.cpp @@ -139,7 +139,7 @@ void AutoPickInventory(PLAYERp pp) void UseInventoryMedkit(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short diff; short inv = INVENTORY_MEDKIT; short amt; diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 8dba529c2..32575053b 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -260,7 +260,7 @@ int DoWallBloodDrip(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //sp->z += (300+RANDOM_RANGE(2300)) >> 1; @@ -300,7 +300,7 @@ void SpawnMidSplash(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp np; USERp nu; short New; @@ -309,7 +309,7 @@ SpawnMidSplash(short SpriteNum) sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); //SetOwner(Weapon, New); np->shade = -12; @@ -334,7 +334,7 @@ void SpawnFloorSplash(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp np; USERp nu; short New; @@ -343,7 +343,7 @@ SpawnFloorSplash(short SpriteNum) sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); //SetOwner(Weapon, New); np->shade = -12; @@ -369,7 +369,7 @@ int DoBloodSpray(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int cz,fz; if (TEST(u->Flags, SPR_UNDERWATER)) @@ -563,7 +563,7 @@ DoBloodSpray(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(Weapon, New); np->shade = -12; @@ -596,7 +596,7 @@ int DoPhosphorus(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -636,7 +636,7 @@ DoPhosphorus(int16_t Weapon) hit_sprite = NORM_SPRITE(u->ret); hsp = &sprite[hit_sprite]; - hu = User[hit_sprite]; + hu = User[hit_sprite].Data(); if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { @@ -785,7 +785,7 @@ DoPhosphorus(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->hitag = LUMINOUS; // Always full brightness SetOwner(Weapon, New); @@ -820,7 +820,7 @@ int DoChemBomb(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -1035,7 +1035,7 @@ DoChemBomb(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(Weapon, New); np->shade = -40; @@ -1065,7 +1065,7 @@ DoChemBomb(int16_t Weapon) int DoCaltropsStick(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->Counter = !u->Counter; @@ -1079,7 +1079,7 @@ int DoCaltrops(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -1257,7 +1257,7 @@ int SpawnRadiationCloud(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; short New; @@ -1288,7 +1288,7 @@ SpawnRadiationCloud(short SpriteNum) sp->x, sp->y, sp->z - RANDOM_P2(Z(8)), sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(sp->owner, New); nu->WaitTics = 1 * 120; @@ -1335,7 +1335,7 @@ int DoRadiationCloud(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->z -= sp->zvel; @@ -1358,7 +1358,7 @@ DoRadiationCloud(short SpriteNum) int PlayerInitChemBomb(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -1381,7 +1381,7 @@ PlayerInitChemBomb(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), CHEMBOMB_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); // don't throw it as far if crawling if (TEST(pp->Flags, PF_CRAWLING)) @@ -1444,7 +1444,7 @@ PlayerInitChemBomb(PLAYERp pp) int InitSpriteChemBomb(int16_t SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp sp = &sprite[SpriteNum], wp; int nx, ny, nz; @@ -1463,7 +1463,7 @@ InitSpriteChemBomb(int16_t SpriteNum) nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SET(wu->Flags, SPR_XFLIP_TOGGLE); @@ -1498,7 +1498,7 @@ int InitChemBomb(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -1518,7 +1518,7 @@ InitChemBomb(short SpriteNum) nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); // wu->RotNum = 5; // NewStateGroup(w, &sg_ChemBomb); @@ -1592,7 +1592,7 @@ PlayerInitFlashBomb(PLAYERp pp) while ((i = it.NextIndex()) >= 0) { hp = &sprite[i]; - hu = User[i]; + hu = User[i].Data(); if (i == pp->PlayerSprite) break; @@ -1660,7 +1660,7 @@ InitFlashBomb(int16_t SpriteNum) while ((i = it.NextIndex()) >= 0) { hp = &sprite[i]; - hu = User[i]; + hu = User[i].Data(); DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, tx, ty, tmin); if (dist > 16384) // Flash radius @@ -1710,7 +1710,7 @@ int SpawnFlashBombOnActor(int16_t enemy) { SPRITEp ep = &sprite[enemy]; - USERp eu = User[enemy]; + USERp eu = User[enemy].Data(); SPRITEp np; USERp nu; short New; @@ -1733,7 +1733,7 @@ SpawnFlashBombOnActor(int16_t enemy) int sizez = SPRITEp_SIZE_Z(ep) + DIV4(SPRITEp_SIZE_Z(ep)); np = &sprite[eu->flame]; - nu = User[eu->flame]; + nu = User[eu->flame].Data(); if (nu->Counter >= SPRITEp_SIZE_Z_2_YREPEAT(np, sizez)) @@ -1764,7 +1764,7 @@ SpawnFlashBombOnActor(int16_t enemy) New = SpawnSprite(STAT_MISSILE, FIREBALL_FLAMES, s_FireballFlames, ep->sectnum, ep->x, ep->y, ep->z, ep->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); if (enemy >= 0) eu->flame = New; @@ -1801,7 +1801,7 @@ SpawnFlashBombOnActor(int16_t enemy) int PlayerInitCaltrops(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -1827,7 +1827,7 @@ PlayerInitCaltrops(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); // don't throw it as far if crawling if (TEST(pp->Flags, PF_CRAWLING)) @@ -1885,7 +1885,7 @@ int InitCaltrops(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -1904,7 +1904,7 @@ InitCaltrops(int16_t SpriteNum) nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY / 2); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SET(wu->Flags, SPR_XFLIP_TOGGLE); @@ -1936,7 +1936,7 @@ int InitPhosphorus(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -1958,7 +1958,7 @@ InitPhosphorus(int16_t SpriteNum) nx, ny, nz, daang, CHEMBOMB_VELOCITY/3); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; // Always full brightness SET(wu->Flags, SPR_XFLIP_TOGGLE); @@ -1995,7 +1995,7 @@ int InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -2047,7 +2047,7 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity) nx, ny, nz, ang, vel*2); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SET(wu->Flags, SPR_XFLIP_TOGGLE); if (dogib) @@ -2174,11 +2174,11 @@ int DoCarryFlag(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); #define FLAG_DETONATE_STATE 99 SPRITEp fp = &sprite[u->FlagOwner]; - USERp fu = User[u->FlagOwner]; + USERp fu = User[u->FlagOwner].Data(); // if no owner then die @@ -2214,7 +2214,7 @@ DoCarryFlag(int16_t Weapon) if (u->Counter2 < FLAG_DETONATE_STATE) { SPRITEp ap = &sprite[u->Attach]; - USERp au = User[u->Attach]; + USERp au = User[u->Attach].Data(); if (!au || au->Health <= 0) { @@ -2329,11 +2329,11 @@ int DoCarryFlagNoDet(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp ap = &sprite[u->Attach]; - USERp au = User[u->Attach]; + USERp au = User[u->Attach].Data(); SPRITEp fp = &sprite[u->FlagOwner]; - USERp fu = User[u->FlagOwner]; + USERp fu = User[u->FlagOwner].Data(); if (u->FlagOwner >= 0) @@ -2397,7 +2397,7 @@ int SetCarryFlag(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); // stuck SET(u->Flags, SPR_BOUNCE); @@ -2419,7 +2419,7 @@ int DoFlag(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int16_t hit_sprite = -1; hit_sprite = DoFlagRangeTest(Weapon, 1000); @@ -2448,7 +2448,7 @@ DoFlag(int16_t Weapon) int InitShell(int16_t SpriteNum, int16_t ShellNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp sp = &sprite[SpriteNum], wp; int nx, ny, nz; @@ -2484,7 +2484,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum) nx, ny, nz, sp->ang, 64); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->zvel = -(velocity); diff --git a/source/games/sw/src/lava.cpp b/source/games/sw/src/lava.cpp index ac1003f0d..93980b4a0 100644 --- a/source/games/sw/src/lava.cpp +++ b/source/games/sw/src/lava.cpp @@ -460,12 +460,12 @@ SetupLava(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,LAVA_RUN_R0,s_LavaRun[0]); + u = SpawnUser(SpriteNum,LAVA_RUN_R0,s_LavaRun[0]); u->Health = 100; } @@ -487,7 +487,7 @@ SetupLava(short SpriteNum) int NullLava(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -500,7 +500,7 @@ int NullLava(short SpriteNum) int DoLavaMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); diff --git a/source/games/sw/src/light.cpp b/source/games/sw/src/light.cpp index 4d19decda..64ca1bfcd 100644 --- a/source/games/sw/src/light.cpp +++ b/source/games/sw/src/light.cpp @@ -78,7 +78,7 @@ void SectorLightShade(SPRITEp sp, short intensity) // change wall if (!TEST_BOOL4(sp)) { - ASSERT(User[sp - sprite] && User[sp - sprite]->WallShade.Data()); + ASSERT(User[sp - sprite].Data() && User[sp - sprite]->WallShade.Data()); wall_shade = User[sp - sprite]->WallShade.Data(); startwall = sector[sp->sectnum].wallptr; diff --git a/source/games/sw/src/miscactr.cpp b/source/games/sw/src/miscactr.cpp index 9bff44fcc..dc2d6174c 100644 --- a/source/games/sw/src/miscactr.cpp +++ b/source/games/sw/src/miscactr.cpp @@ -119,12 +119,12 @@ SetupToiletGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,TOILETGIRL_R0,s_ToiletGirlStand); + u = SpawnUser(SpriteNum,TOILETGIRL_R0,s_ToiletGirlStand); u->Health = 60; } @@ -151,7 +151,7 @@ SetupToiletGirl(short SpriteNum) int DoToiletGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -209,7 +209,7 @@ int DoToiletGirl(short SpriteNum) int NullToiletGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -241,7 +241,7 @@ int NullToiletGirl(short SpriteNum) int ToiletGirlUzi(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -258,7 +258,7 @@ int ToiletGirlUzi(short SpriteNum) int ToiletGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullToiletGirl(SpriteNum); @@ -359,12 +359,12 @@ SetupWashGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,WASHGIRL_R0,s_WashGirlStand); + u = SpawnUser(SpriteNum,WASHGIRL_R0,s_WashGirlStand); u->Health = 60; } @@ -390,7 +390,7 @@ SetupWashGirl(short SpriteNum) int DoWashGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -454,7 +454,7 @@ int DoWashGirl(short SpriteNum) int NullWashGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -486,7 +486,7 @@ int NullWashGirl(short SpriteNum) int WashGirlUzi(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -503,7 +503,7 @@ int WashGirlUzi(short SpriteNum) int WashGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullWashGirl(SpriteNum); @@ -568,12 +568,12 @@ SetupTrashCan(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,TRASHCAN,s_TrashCanStand); + u = SpawnUser(SpriteNum,TRASHCAN,s_TrashCanStand); u->Health = 60; } @@ -599,7 +599,7 @@ SetupTrashCan(short SpriteNum) int DoTrashCan(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //(*u->ActorActionFunc) (SpriteNum); @@ -620,7 +620,7 @@ int DoTrashCan(short SpriteNum) int TrashCanPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -676,12 +676,12 @@ SetupPachinkoLight(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKOLIGHT_R0,s_PachinkoLightStand); + u = SpawnUser(SpriteNum,PACHINKOLIGHT_R0,s_PachinkoLightStand); u->Health = 1; } @@ -708,7 +708,7 @@ SetupPachinkoLight(short SpriteNum) int PachinkoLightOperate(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics -= ACTORMOVETICS) <= 0) { @@ -777,12 +777,12 @@ SetupPachinko1(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO1,s_Pachinko1Stand); + u = SpawnUser(SpriteNum,PACHINKO1,s_Pachinko1Stand); u->Health = 1; } @@ -807,7 +807,7 @@ SetupPachinko1(short SpriteNum) int PachinkoCheckWin(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->WaitTics = 0; // Can operate it again now @@ -840,7 +840,7 @@ int PachinkoCheckWin(short SpriteNum) while ((i = it.NextIndex()) >= 0) { tsp = &sprite[i]; - tu = User[i]; + tu = User[i].Data(); if (tsp->lotag == TAG_PACHINKOLIGHT) { @@ -947,12 +947,12 @@ SetupPachinko2(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO2,s_Pachinko2Stand); + u = SpawnUser(SpriteNum,PACHINKO2,s_Pachinko2Stand); u->Health = 1; } @@ -1031,12 +1031,12 @@ SetupPachinko3(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO3,s_Pachinko3Stand); + u = SpawnUser(SpriteNum,PACHINKO3,s_Pachinko3Stand); u->Health = 1; } @@ -1116,12 +1116,12 @@ SetupPachinko4(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO4,s_Pachinko4Stand); + u = SpawnUser(SpriteNum,PACHINKO4,s_Pachinko4Stand); u->Health = 1; } @@ -1229,12 +1229,12 @@ SetupCarGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,CARGIRL_R0,s_CarGirlStand); + u = SpawnUser(SpriteNum,CARGIRL_R0,s_CarGirlStand); u->Health = 60; } @@ -1262,7 +1262,7 @@ SetupCarGirl(short SpriteNum) int DoCarGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1311,7 +1311,7 @@ int DoCarGirl(short SpriteNum) int NullCarGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1350,7 +1350,7 @@ int NullCarGirl(short SpriteNum) int CarGirlUzi(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -1367,7 +1367,7 @@ int CarGirlUzi(short SpriteNum) int CarGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullCarGirl(SpriteNum); @@ -1449,12 +1449,12 @@ SetupMechanicGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,MECHANICGIRL_R0,s_MechanicGirlStand); + u = SpawnUser(SpriteNum,MECHANICGIRL_R0,s_MechanicGirlStand); u->Health = 60; } @@ -1481,7 +1481,7 @@ SetupMechanicGirl(short SpriteNum) int DoMechanicGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1530,7 +1530,7 @@ int DoMechanicGirl(short SpriteNum) int NullMechanicGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1569,7 +1569,7 @@ int NullMechanicGirl(short SpriteNum) int MechanicGirlDrill(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -1586,7 +1586,7 @@ int MechanicGirlDrill(short SpriteNum) int MechanicGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullMechanicGirl(SpriteNum); @@ -1668,12 +1668,12 @@ SetupSailorGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,SAILORGIRL_R0,s_SailorGirlStand); + u = SpawnUser(SpriteNum,SAILORGIRL_R0,s_SailorGirlStand); u->Health = 60; } @@ -1701,7 +1701,7 @@ SetupSailorGirl(short SpriteNum) int DoSailorGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1754,7 +1754,7 @@ int DoSailorGirl(short SpriteNum) int NullSailorGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; static short alreadythrew = 0; @@ -1798,7 +1798,7 @@ int NullSailorGirl(short SpriteNum) int SailorGirlThrow(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -1815,7 +1815,7 @@ int SailorGirlThrow(short SpriteNum) int SailorGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullSailorGirl(SpriteNum); @@ -1881,12 +1881,12 @@ SetupPruneGirl(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,PRUNEGIRL_R0,s_PruneGirlStand); + u = SpawnUser(SpriteNum,PRUNEGIRL_R0,s_PruneGirlStand); u->Health = 60; } @@ -1913,7 +1913,7 @@ SetupPruneGirl(short SpriteNum) int DoPruneGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -1978,7 +1978,7 @@ int DoPruneGirl(short SpriteNum) int NullPruneGirl(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; bool ICanSee = false; @@ -2016,7 +2016,7 @@ int NullPruneGirl(short SpriteNum) int PruneGirlUzi(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags,SPR_CLIMBING)) KeepActorOnFloor(SpriteNum); @@ -2033,7 +2033,7 @@ int PruneGirlUzi(short SpriteNum) int PruneGirlPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullPruneGirl(SpriteNum); diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index ab4a395eb..217f0c0ac 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -1814,7 +1814,7 @@ int DoHariKariBlood(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); return 0; } @@ -1834,12 +1834,12 @@ SetupNinja(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]); + u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]); u->Health = HEALTH_NINJA; } @@ -1945,7 +1945,7 @@ SetupNinja(short SpriteNum) int DoNinjaHariKari(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; short cnt,i; @@ -1975,7 +1975,7 @@ DoNinjaHariKari(short SpriteNum) int DoNinjaGrabThroat(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if ((u->WaitTics -= ACTORMOVETICS) <= 0) @@ -2015,7 +2015,7 @@ DoNinjaGrabThroat(short SpriteNum) int DoNinjaMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags2, SPR2_DYING)) { @@ -2062,7 +2062,7 @@ DoNinjaMove(short SpriteNum) int NinjaJumpActionFunc(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; @@ -2094,7 +2094,7 @@ NinjaJumpActionFunc(short SpriteNum) int NullNinja(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS; @@ -2112,7 +2112,7 @@ NullNinja(short SpriteNum) int DoNinjaPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullNinja(SpriteNum); @@ -2134,7 +2134,7 @@ int DoNinjaPain(short SpriteNum) int DoNinjaSpecial(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->spal == PALETTE_PLAYER5) { @@ -2156,7 +2156,7 @@ int CheckFire(short SpriteNum) int DoNinjaCeiling(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; DoActorSectorDamage(SpriteNum); @@ -2186,7 +2186,7 @@ void PlayerLevelReset(PLAYERp pp) { SPRITEp sp = &sprite[pp->PlayerSprite]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (gNet.MultiGameType == MULTI_GAME_COMMBAT) { @@ -2227,7 +2227,7 @@ void PlayerDeathReset(PLAYERp pp) { SPRITEp sp = &sprite[pp->PlayerSprite]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (TEST(pp->Flags, PF_DIVING)) DoPlayerStopDiveNoWarp(pp); @@ -2304,7 +2304,7 @@ PlayerPanelSetup(void) { pp = Player + pnum; - u = User[pp->PlayerSprite]; + u = User[pp->PlayerSprite].Data(); ASSERT(u != NULL); @@ -2319,7 +2319,7 @@ void PlayerGameReset(PLAYERp pp) { SPRITEp sp = &sprite[pp->PlayerSprite]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); COVER_SetReverb(0); // Turn off any echoing that may have been going before pp->Reverb = 0; @@ -2379,7 +2379,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet; void PlayerSpriteLoadLevel(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ChangeState(SpriteNum, s_NinjaRun[0]); u->Rot = sg_NinjaRun; @@ -2407,7 +2407,7 @@ InitPlayerSprite(PLAYERp pp) SET(sp->extra, SPRX_PLAYER_OR_ENEMY); RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); - u = User[sp_num]; + u = User[sp_num].Data(); // Grouping items that need to be reset after a LoadLevel ChangeState(sp_num, s_NinjaRun[0]); @@ -2465,7 +2465,7 @@ InitPlayerSprite(PLAYERp pp) void SpawnPlayerUnderSprite(PLAYERp pp) { - USERp pu = User[pp->PlayerSprite], u; + USERp pu = User[pp->PlayerSprite].Data(), u; SPRITEp psp = &sprite[pp->PlayerSprite]; SPRITEp sp; int pnum = pp - Player, sp_num; @@ -2474,7 +2474,7 @@ SpawnPlayerUnderSprite(PLAYERp pp) NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0); sp = &sprite[sp_num]; - u = User[sp_num]; + u = User[sp_num].Data(); pp->UnderSpriteP = sp; diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 5494576b0..54c825e8b 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -221,7 +221,7 @@ void ArmorCalc(int damage_amt, int *armor_damage, int *player_damage) void PlayerUpdateHealth(PLAYERp pp, short value) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short x,y; if (Prediction) @@ -328,7 +328,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value) void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short x,y; short WeaponNum; @@ -367,7 +367,7 @@ void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // Weapon Change if (Prediction) @@ -434,7 +434,7 @@ int WeaponOperate(PLAYERp pp) { short weapon; int DoPlayerSpriteReset(short SpriteNum); - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); InventoryKeys(pp); @@ -661,7 +661,7 @@ WeaponOK(PLAYERp pp) if ((unsigned)pp->PlayerSprite >= MAXSPRITES) return(false); - u = User[pp->PlayerSprite]; + u = User[pp->PlayerSprite].Data(); if (u == NULL) return(false); @@ -6887,7 +6887,7 @@ bool DrawBeforeView = false; void pDisplaySprites(PLAYERp pp, double smoothratio) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); PANEL_SPRITEp psp=NULL, next=NULL; short shade, picnum, overlay_shade = 0; double x, y; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 37c80e1a9..eeb4dc683 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1078,7 +1078,7 @@ DoPlayerSpriteThrow(PLAYERp pp) int DoPlayerSpriteReset(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); PLAYERp pp; if (!u->PlayerP) @@ -1146,7 +1146,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets) SPRITEp ep; USERp eu; int16_t* shp; - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); int ezh, ezhl, ezhm; unsigned ndx; TARGET_SORTp ts; @@ -1164,7 +1164,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets) while ((i = it.NextIndex()) >= 0) { ep = &sprite[i]; - eu = User[i]; + eu = User[i].Data(); // don't pick yourself if (i == (sp - sprite)) @@ -1274,7 +1274,7 @@ DoPlayerResetMovement(PLAYERp pp) void DoPlayerTeleportPause(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // SPRITEp sp = pp->SpriteP; // set this so we don't get stuck in teleporting loop @@ -1381,7 +1381,7 @@ DoSpawnTeleporterEffectPlace(SPRITEp sp) void DoPlayerWarpTeleporter(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp sp = pp->SpriteP; short pnum; SPRITEp sp_warp; @@ -1758,7 +1758,7 @@ void UpdatePlayerUnderSprite(PLAYERp pp) { SPRITEp over_sp = pp->SpriteP; - USERp over_u = User[pp->PlayerSprite]; + USERp over_u = User[pp->PlayerSprite].Data(); SPRITEp sp; USERp u; @@ -1804,7 +1804,7 @@ UpdatePlayerUnderSprite(PLAYERp pp) } sp = pp->UnderSpriteP; - u = User[pp->PlayerUnderSprite]; + u = User[pp->PlayerUnderSprite].Data(); SpriteNum = pp->PlayerUnderSprite; @@ -1974,7 +1974,7 @@ DoPlayerZrange(PLAYERp pp) void DoPlayerSlide(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int push_ret; if ((pp->slide_xvect|pp->slide_yvect) == 0) @@ -2067,7 +2067,7 @@ void PlayerSectorBound(PLAYERp pp, int amt) void DoPlayerMove(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int friction; int save_cstat; int push_ret = 0; @@ -2583,7 +2583,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (testpointinquad(sp->x, sp->y, x, y)) { @@ -2670,7 +2670,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) continue; sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (u->PlayerP == pp) continue; @@ -2699,7 +2699,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); // give some extra buffer if (sp->z < sop->crush_z + Z(40)) @@ -2726,7 +2726,7 @@ DoPlayerMoveVehicle(PLAYERp pp) int floor_dist; short save_sectnum; SPRITEp sp = pp->sop->sp_child; - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); int save_cstat; int x[4], y[4], ox[4], oy[4]; int wallcount; @@ -2974,7 +2974,7 @@ DoPlayerMoveTurret(PLAYERp pp) void DoPlayerBeginJump(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_FALLING); @@ -3005,7 +3005,7 @@ DoPlayerBeginJump(PLAYERp pp) void DoPlayerBeginForceJump(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_FALLING|PF_CRAWLING|PF_CLIMBING|PF_LOCK_CRAWL); @@ -3153,7 +3153,7 @@ DoPlayerForceJump(PLAYERp pp) void DoPlayerBeginFall(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SET(pp->Flags, PF_FALLING); RESET(pp->Flags, PF_JUMPING); @@ -3299,7 +3299,7 @@ DoPlayerFall(PLAYERp pp) } else if (pp->jump_speed >= 4000) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! u->Health = 0; } @@ -3348,7 +3348,7 @@ DoPlayerFall(PLAYERp pp) void DoPlayerBeginClimb(PLAYERp pp) { -// USERp u = User[pp->PlayerSprite]; +// USERp u = User[pp->PlayerSprite].Data(); SPRITEp sp = pp->SpriteP; RESET(pp->Flags, PF_JUMPING|PF_FALLING); @@ -3370,7 +3370,7 @@ DoPlayerBeginClimb(PLAYERp pp) void DoPlayerClimb(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int climb_amt; char i; SPRITEp sp = pp->SpriteP; @@ -3647,7 +3647,7 @@ bool PlayerFlyKey(void) void DoPlayerBeginCrawl(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); RESET(pp->Flags, PF_FALLING | PF_JUMPING); SET(pp->Flags, PF_CRAWLING); @@ -3687,7 +3687,7 @@ bool PlayerFallTest(PLAYERp pp, int player_height) void DoPlayerCrawl(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum)) { @@ -3763,7 +3763,7 @@ DoPlayerCrawl(PLAYERp pp) void DoPlayerBeginFly(PLAYERp pp) { -// USERp u = User[pp->PlayerSprite]; +// USERp u = User[pp->PlayerSprite].Data(); RESET(pp->Flags, PF_FALLING | PF_JUMPING | PF_CRAWLING); SET(pp->Flags, PF_FLYING); @@ -4267,7 +4267,7 @@ GetOverlapSector2(int x, int y, short *over, short *under) void DoPlayerWarpToUnderwater(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int i; SECT_USERp sectu = SectUser[pp->cursectnum]; SPRITEp under_sp = NULL, over_sp = NULL; @@ -4344,7 +4344,7 @@ DoPlayerWarpToUnderwater(PLAYERp pp) void DoPlayerWarpToSurface(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int i; SECT_USERp sectu = SectUser[pp->cursectnum]; short over, under; @@ -4449,7 +4449,7 @@ void DoPlayerBeginDive(PLAYERp pp) { SPRITEp sp = &sprite[pp->PlayerSprite]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -4497,7 +4497,7 @@ DoPlayerBeginDive(PLAYERp pp) void DoPlayerBeginDiveNoWarp(PLAYERp pp) { SPRITEp sp = &sprite[pp->PlayerSprite]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -4644,7 +4644,7 @@ DoPlayerDiveMeter(PLAYERp pp) void DoPlayerDive(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SECT_USERp sectu = SectUser[pp->cursectnum]; // whenever your view is not in a water area @@ -4827,7 +4827,7 @@ DoPlayerDive(PLAYERp pp) int DoPlayerTestPlaxDeath(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // landed on a paralax floor if (pp->lo_sectp && TEST(pp->lo_sectp->floorstat, FLOOR_STAT_PLAX)) @@ -4858,7 +4858,7 @@ DoPlayerCurrent(PLAYERp pp) { if (!TEST(pp->Flags, PF_DEAD)) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerCheckDeath(pp, -1); @@ -4875,7 +4875,7 @@ DoPlayerCurrent(PLAYERp pp) { if (!TEST(pp->Flags, PF_DEAD)) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerCheckDeath(pp, -1); @@ -4890,7 +4890,7 @@ DoPlayerCurrent(PLAYERp pp) void DoPlayerFireOutWater(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -4906,7 +4906,7 @@ DoPlayerFireOutWater(PLAYERp pp) void DoPlayerFireOutDeath(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -4920,7 +4920,7 @@ DoPlayerFireOutDeath(PLAYERp pp) void DoPlayerBeginWade(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // landed on a paralax floor? if (DoPlayerTestPlaxDeath(pp)) @@ -4953,7 +4953,7 @@ DoPlayerBeginWade(PLAYERp pp) void DoPlayerWade(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); DoPlayerFireOutWater(pp); @@ -5094,7 +5094,7 @@ DoPlayerWade(PLAYERp pp) void DoPlayerBeginOperateBoat(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); pp->floor_dist = PLAYER_RUN_FLOOR_DIST; pp->ceiling_dist = PLAYER_RUN_CEILING_DIST; @@ -5115,7 +5115,7 @@ DoPlayerBeginOperateBoat(PLAYERp pp) void DoPlayerBeginOperateVehicle(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); pp->floor_dist = PLAYER_RUN_FLOOR_DIST; pp->ceiling_dist = PLAYER_RUN_CEILING_DIST; @@ -5135,7 +5135,7 @@ DoPlayerBeginOperateVehicle(PLAYERp pp) void DoPlayerBeginOperateTurret(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); pp->floor_dist = PLAYER_RUN_FLOOR_DIST; pp->ceiling_dist = PLAYER_RUN_CEILING_DIST; @@ -5816,7 +5816,7 @@ DoPlayerBeginDie(PLAYERp pp) short bak; int choosesnd = 0; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); static void (*PlayerDeathFunc[MAX_PLAYER_DEATHS]) (PLAYERp) = { @@ -5861,7 +5861,7 @@ DoPlayerBeginDie(PLAYERp pp) // Give kill credit to player if necessary if (pp->Killer >= 0) { - USERp ku = User[pp->Killer]; + USERp ku = User[pp->Killer].Data(); ASSERT(ku); @@ -6057,7 +6057,7 @@ DoPlayerDeathTilt(PLAYERp pp, short target, short speed) void DoPlayerDeathZrange(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // make sure we don't land on a regular sprite DoFindGround(pp->PlayerSprite); @@ -6134,7 +6134,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) void DoPlayerDeathCheckKeys(PLAYERp pp) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (pp->input.actions & SB_OPEN) { @@ -6230,7 +6230,7 @@ DoPlayerHeadDebris(PLAYERp pp) SPRITEp DoPlayerDeathCheckKick(PLAYERp pp) { SPRITEp sp = pp->SpriteP, hp; - USERp u = User[pp->PlayerSprite], hu; + USERp u = User[pp->PlayerSprite].Data(), hu; int i; unsigned stat; int dist; @@ -6242,7 +6242,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp) while ((i = it.NextIndex()) >= 0) { hp = &sprite[i]; - hu = User[i]; + hu = User[i].Data(); if (i == pp->PlayerSprite) break; @@ -6293,7 +6293,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp) void DoPlayerDeathMoveHead(PLAYERp pp) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int dax,day; short sectnum; @@ -6445,7 +6445,7 @@ void DoPlayerDeathDrown(PLAYERp pp) void DoPlayerDeathBounce(PLAYERp pp) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -6475,7 +6475,7 @@ void DoPlayerDeathBounce(PLAYERp pp) void DoPlayerDeathCrumble(PLAYERp pp) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -6528,7 +6528,7 @@ void DoPlayerDeathCrumble(PLAYERp pp) void DoPlayerDeathExplode(PLAYERp pp) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (Prediction) return; @@ -6584,7 +6584,7 @@ void DoPlayerDeathExplode(PLAYERp pp) void DoPlayerBeginRun(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // Crawl if in small aread automatically if (DoPlayerTestCrawl(pp)) @@ -6619,7 +6619,7 @@ DoPlayerBeginRun(PLAYERp pp) void DoPlayerRun(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum)) { @@ -6768,7 +6768,7 @@ PlayerStateControl(int16_t SpriteNum) return; // Convienience var - u = User[SpriteNum]; + u = User[SpriteNum].Data(); if (u == NULL) return; @@ -6859,7 +6859,7 @@ MoveSkipSavePos(void) continue; sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (sp == NULL || u == NULL) continue; @@ -6883,7 +6883,7 @@ MoveSkipSavePos(void) if ((unsigned)i >= MAXSPRITES) continue; sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (sp == NULL || u == NULL) continue; @@ -7438,7 +7438,7 @@ InitMultiPlayerInfo(void) start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0); ASSERT(start0 >= 0); - FreeUser(start0); + User[start0].Clear(); sprite[start0].picnum = ST1; } @@ -7473,7 +7473,7 @@ InitMultiPlayerInfo(void) int DoFootPrints(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->PlayerP) { diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 168ec57ba..6c56ec857 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -824,12 +824,12 @@ SetupRipper(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum, RIPPER_RUN_R0, s_RipperRun[0]); + u = SpawnUser(SpriteNum, RIPPER_RUN_R0, s_RipperRun[0]); u->Health = HEALTH_RIPPER/2; // Baby rippers are weaker } @@ -882,7 +882,7 @@ GetJumpHeight(short jump_speed, short jump_grav) int PickJumpSpeed(short SpriteNum, int pix_height) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //ASSERT(pix_height < 128); @@ -907,7 +907,7 @@ int PickJumpMaxSpeed(short SpriteNum, short max_speed) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int zh; ASSERT(max_speed < 0); @@ -940,7 +940,7 @@ int InitRipperHang(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int dist; hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; @@ -1001,7 +1001,7 @@ InitRipperHang(short SpriteNum) int DoRipperHang(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics -= ACTORMOVETICS) > 0) return 0; @@ -1016,7 +1016,7 @@ int DoRipperMoveHang(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; // Move while jumping @@ -1055,7 +1055,7 @@ DoRipperMoveHang(short SpriteNum) int DoRipperHangJF(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -1087,7 +1087,7 @@ int DoRipperBeginJumpAttack(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp psp = User[SpriteNum]->tgt_sp; short tang; @@ -1121,7 +1121,7 @@ DoRipperBeginJumpAttack(short SpriteNum) int DoRipperMoveJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -1150,7 +1150,7 @@ DoRipperMoveJump(short SpriteNum) int DoRipperQuickJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Tests to see if ripper is on top of a player/enemy and then immediatly // does another jump @@ -1175,7 +1175,7 @@ DoRipperQuickJump(short SpriteNum) int NullRipper(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -1188,7 +1188,7 @@ NullRipper(short SpriteNum) int DoRipperPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullRipper(SpriteNum); @@ -1204,7 +1204,7 @@ int DoRipperRipHeart(short SpriteNum) // CTW MODIFICATION END { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = u->tgt_sp; @@ -1221,7 +1221,7 @@ int DoRipperRipHeart(short SpriteNum) int DoRipperStandHeart(short SpriteNum) // CTW MODIFICATION END { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullRipper(SpriteNum); @@ -1259,7 +1259,7 @@ void RipperHatch(short Weapon) np->ang = rip_ang[i]; np->pal = 0; SetupRipper(New); - nu = User[New]; + nu = User[New].Data(); // make immediately active SET(nu->Flags, SPR_ACTIVE); @@ -1284,7 +1284,7 @@ void RipperHatch(short Weapon) int DoRipperMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->scale_speed) { diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 2b7e563b5..ebd2d7867 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -894,12 +894,12 @@ SetupRipper2(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum, RIPPER2_RUN_R0, s_Ripper2Run[0]); + u = SpawnUser(SpriteNum, RIPPER2_RUN_R0, s_Ripper2Run[0]); u->Health = HEALTH_RIPPER2; } @@ -940,7 +940,7 @@ int InitRipper2Hang(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int dist; hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; @@ -1000,7 +1000,7 @@ InitRipper2Hang(short SpriteNum) int DoRipper2Hang(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics -= ACTORMOVETICS) > 0) return 0; @@ -1016,7 +1016,7 @@ int DoRipper2MoveHang(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int nx, ny; // Move while jumping @@ -1062,7 +1062,7 @@ DoRipper2MoveHang(short SpriteNum) int DoRipper2HangJF(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -1094,7 +1094,7 @@ int DoRipper2BeginJumpAttack(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp psp = User[SpriteNum]->tgt_sp; short tang; @@ -1135,7 +1135,7 @@ DoRipper2BeginJumpAttack(short SpriteNum) int DoRipper2MoveJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -1164,7 +1164,7 @@ DoRipper2MoveJump(short SpriteNum) int DoRipper2QuickJump(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // Tests to see if ripper2 is on top of a player/enemy and then immediatly // does another jump @@ -1189,7 +1189,7 @@ DoRipper2QuickJump(short SpriteNum) int NullRipper2(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -1202,7 +1202,7 @@ NullRipper2(short SpriteNum) int DoRipper2Pain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullRipper2(SpriteNum); @@ -1215,7 +1215,7 @@ int DoRipper2Pain(short SpriteNum) int DoRipper2RipHeart(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp tsp = u->tgt_sp; @@ -1230,7 +1230,7 @@ int DoRipper2RipHeart(short SpriteNum) int DoRipper2StandHeart(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullRipper2(SpriteNum); @@ -1274,7 +1274,7 @@ void Ripper2Hatch(short Weapon) np->pal = 0; np->shade = -10; SetupRipper2(New); - nu = User[New]; + nu = User[New].Data(); // make immediately active SET(nu->Flags, SPR_ACTIVE); @@ -1300,7 +1300,7 @@ int DoRipper2Move(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (sp->hitag == TAG_SWARMSPOT && sp->lotag == 1) DoCheckSwarm(SpriteNum); diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 6478545ad..8f05a6e37 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -47,7 +47,7 @@ void DoRotatorStopInterp(short SpriteNum); void ReverseRotator(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ROTATORp r; r = u->rotator.Data(); @@ -97,7 +97,7 @@ RotatorSwitch(short match, short setting) void SetRotatorActive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; ROTATORp r; @@ -120,7 +120,7 @@ void SetRotatorActive(short SpriteNum) void SetRotatorInactive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; DoRotatorStopInterp(SpriteNum); @@ -170,7 +170,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual) if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // single play only vator // bool 8 must be set for message to display @@ -247,7 +247,7 @@ TestRotatorMatchActive(short match) if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // Does not have to be inactive to be operated if (TEST_BOOL6(fsp)) @@ -310,7 +310,7 @@ void DoRotatorStopInterp(short SpriteNum) int DoRotatorMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; ROTATORp r; short ndx,w,startwall,endwall; @@ -435,7 +435,7 @@ int DoRotatorMove(short SpriteNum) int DoRotator(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; // could move this inside sprite control diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index e1c060db5..61a66e134 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -361,17 +361,17 @@ bool GameInterface::SaveGame() for (i = 0; i < MAXSPRITES; i++) { ndx = i; - if (User[i]) + if (User[i].Data()) { // write header MWRITE(&ndx,sizeof(ndx),1,fil); +#if 0 memcpy(&tu, User[i], sizeof(USER)); u = &tu; MWRITE(u,sizeof(USER),1,fil); -#if 0 if (u->WallShade) { MWRITE(u->WallShade, sizeof(*u->WallShade) * u->WallCount, 1, fil); @@ -484,9 +484,9 @@ bool GameInterface::SaveGame() // maintain compatibility with sinking boat which points to user data for (j=0; jptr >= bp && (uint8_t*)a->ptr < bp + sizeof(USER)) { @@ -748,7 +748,8 @@ bool GameInterface::LoadGame() MREAD(&SpriteNum, sizeof(SpriteNum),1,fil); while (SpriteNum != -1) { - User[SpriteNum] = u = NewUser(); + User[SpriteNum].Alloc(); + u = User[SpriteNum].Data(); // We need to be careful with allocated content in User when loading a binary save state. // This needs to be refactored out ASAP. u->rotator.Clear(); @@ -858,7 +859,7 @@ bool GameInterface::LoadGame() int offset; MREAD(&j, sizeof(j),1,fil); MREAD(&offset, sizeof(offset),1,fil); - a->ptr = (int *)(((char *)User[j]) + offset); + a->ptr = (int *)(((char *)User[j].Data()) + offset); } else if ((intptr_t)a->ptr == -3) { diff --git a/source/games/sw/src/sbar.cpp b/source/games/sw/src/sbar.cpp index 51a380646..4da1d6bd0 100644 --- a/source/games/sw/src/sbar.cpp +++ b/source/games/sw/src/sbar.cpp @@ -367,7 +367,7 @@ private: void PlayerUpdateWeaponSummary(PLAYERp pp, int UpdateWeaponNum) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int x, y; int pos; int column; @@ -665,7 +665,7 @@ private: void DrawStatusBar() { auto pp = Player + screenpeek; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); BeginStatusBar(320, 200, tileHeight(STATUS_BAR)); if (hud_size == Hud_StbarOverlay) Set43ClipRect(); @@ -742,7 +742,7 @@ private: { BeginHUD(320, 200, 1); auto pp = Player + screenpeek; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int x, y; INVENTORY_DATAp id; @@ -785,7 +785,7 @@ private: BeginHUD(320, 200, 1); auto pp = Player + screenpeek; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); FString format; FGameTexture* img; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 03876c2a1..8e9c1494c 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -83,7 +83,7 @@ int lavaradx[32][128], lavarady[32][128], lavaradcnt[32]; #endif SECT_USERp SectUser[MAXSECTORS]; -USERp User[MAXSPRITES]; +TPointer User[MAXSPRITES]; ANIM Anim[MAXANIM]; short AnimCnt = 0; @@ -1025,7 +1025,7 @@ void SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short explosion; SPRITEp exp; USERp eu; @@ -1053,7 +1053,7 @@ SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh) explosion = SpawnSectorExp(SpriteNum); ASSERT(explosion >= 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->xrepeat += (RANDOM_P2(32<<8)>>8) - 16; exp->yrepeat += (RANDOM_P2(32<<8)>>8) - 16; @@ -1082,7 +1082,7 @@ DoExplodeSector(short match) if (match != esp->lotag) continue; - if (!User[cf]) + if (!User[cf].Data()) /*u = */SpawnUser(cf, 0, NULL); sectp = §or[esp->sectnum]; @@ -1114,7 +1114,7 @@ DoExplodeSector(short match) int DoSpawnSpot(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics -= synctics) < 0) { @@ -1150,7 +1150,7 @@ DoSpawnSpotsForKill(short match) // change the stat num and set the delay correctly to call SpawnShrap if (sp->hitag == SPAWN_SPOT && sp->lotag == match) { - u = User[sn]; + u = User[sn].Data(); change_sprite_stat(sn, STAT_NO_STATE); u->ActorActionFunc = DoSpawnSpot; u->WaitTics = SP_TAG5(sp) * 15; @@ -1181,7 +1181,7 @@ DoSpawnSpotsForDamage(short match) if (sp->hitag == SPAWN_SPOT && sp->lotag == match) { - u = User[sn]; + u = User[sn].Data(); change_sprite_stat(sn, STAT_NO_STATE); u->ActorActionFunc = DoSpawnSpot; u->WaitTics = SP_TAG7(sp) * 15; @@ -1398,7 +1398,7 @@ WeaponExplodeSectorInRange(short weapon) { int i; SPRITEp wp = &sprite[weapon]; - USERp wu = User[weapon]; + USERp wu = User[weapon].Data(); SPRITEp sp; int dist; int radius; @@ -1668,7 +1668,7 @@ int OperateSprite(short SpriteNum, short player_is_operating) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); PLAYERp pp = NULL; short state; short key_num=0; @@ -1997,7 +1997,7 @@ int DoTrapReset(short match) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (sp->lotag != match) continue; @@ -2029,7 +2029,7 @@ int DoTrapMatch(short match) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (sp->lotag != match) continue; @@ -2161,7 +2161,7 @@ OperateTripTrigger(PLAYERp pp) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (TEST(u->Flags, SPR_WAIT_FOR_TRIGGER)) { @@ -2235,7 +2235,7 @@ OperateContinuousTrigger(PLAYERp pp) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); // if correct type and matches if (sp->hitag == FIREBALL_TRAP && sp->lotag == sector[pp->cursectnum].hitag) @@ -2284,7 +2284,7 @@ OperateContinuousTrigger(PLAYERp pp) short PlayerTakeSectorDamage(PLAYERp pp) { SECT_USERp sectu = SectUser[pp->cursectnum]; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); // the calling routine must make sure sectu exists if ((u->DamageTics -= synctics) < 0) @@ -2711,7 +2711,7 @@ PlayerOperateEnv(PLAYERp pp) } else { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); u->DamageTics = 0; } diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index bba1e6395..911a29605 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -704,12 +704,12 @@ SetupSerp(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,SERP_RUN_R0,s_SerpRun[0]); + u = SpawnUser(SpriteNum,SERP_RUN_R0,s_SerpRun[0]); u->Health = HEALTH_SERP_GOD; } @@ -755,7 +755,7 @@ SetupSerp(short SpriteNum) int NullSerp(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -769,7 +769,7 @@ int NullSerp(short SpriteNum) int DoSerpMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index a47971f8e..114f1a774 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -509,12 +509,12 @@ SetupSkel(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]); + u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]); u->Health = HEALTH_SKEL_PRIEST; } @@ -588,7 +588,7 @@ int DoSkelTermTeleport(short SpriteNum) int NullSkel(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); @@ -601,7 +601,7 @@ int NullSkel(short SpriteNum) int DoSkelPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullSkel(SpriteNum); @@ -613,7 +613,7 @@ int DoSkelPain(short SpriteNum) int DoSkelMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags,SPR_SLIDING)) DoActorSlide(SpriteNum); diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 68bd25c5e..bb343a84c 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -219,12 +219,12 @@ SetupSkull(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]); + u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]); u->Health = HEALTH_SKULL; } @@ -265,7 +265,7 @@ int DoSkullMove(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int32_t dax, day, daz; dax = MOVEx(sp->xvel, sp->ang); @@ -282,7 +282,7 @@ int DoSkullBeginDeath(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int16_t i,num_ord=0; //extern short *DamageRadiusSkull; @@ -369,7 +369,7 @@ DoSkullBeginDeath(int16_t SpriteNum) int DoSkullJump(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (sp->xvel) @@ -432,7 +432,7 @@ int DoSkullJump(short SpriteNum) int DoSkullBob(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // actor does a sine wave about u->sz - this is the z mid point #define SKULL_BOB_AMT (Z(16)) @@ -457,7 +457,7 @@ int DoSkullSpawnShrap(short SpriteNum) int DoSkullWait(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int a,b,c,dist; DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c); @@ -637,12 +637,12 @@ SetupBetty(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]); + u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]); u->Health = HEALTH_SKULL; } @@ -683,7 +683,7 @@ int DoBettyMove(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int32_t dax, day, daz; dax = MOVEx(sp->xvel, sp->ang); @@ -700,7 +700,7 @@ int DoBettyBeginDeath(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int16_t i,num_ord=0; //extern short *DamageRadiusBetty; @@ -782,7 +782,7 @@ DoBettyBeginDeath(int16_t SpriteNum) int DoBettyJump(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (sp->xvel) @@ -843,7 +843,7 @@ int DoBettyJump(short SpriteNum) int DoBettyBob(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // actor does a sine wave about u->sz - this is the z mid point #define BETTY_BOB_AMT (Z(16)) @@ -866,7 +866,7 @@ int DoBettySpawnShrap(short SpriteNum) int DoBettyWait(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int a,b,c,dist; DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 4650bda82..b86f62e83 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -41,7 +41,7 @@ BEGIN_SW_NS void ReverseSlidor(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ROTATORp r; r = u->rotator.Data(); @@ -92,7 +92,7 @@ SlidorSwitch(short match, short setting) void SetSlidorActive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; ROTATORp r; @@ -115,7 +115,7 @@ void SetSlidorActive(short SpriteNum) void SetSlidorInactive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; DoSlidorInterp(SpriteNum, StopInterpolation); @@ -166,7 +166,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual) if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // single play only vator // bool 8 must be set for message to display @@ -243,7 +243,7 @@ TestSlidorMatchActive(short match) if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // Does not have to be inactive to be operated if (TEST_BOOL6(fsp)) @@ -537,7 +537,7 @@ int DoSlidorInstantClose(short SpriteNum) int DoSlidorMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; ROTATORp r; int old_pos; @@ -632,7 +632,7 @@ int DoSlidorMove(short SpriteNum) while ((i = it.NextIndex()) >= 0) { bsp = &sprite[i]; - bu = User[i]; + bu = User[i].Data(); if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY)) { @@ -681,7 +681,7 @@ int DoSlidorMove(short SpriteNum) int DoSlidor(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index bb645b2bd..4733a2dc0 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -788,7 +788,7 @@ void Set3DSoundOwner(short spritenum) void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags) { SPRITEp sp = &sprite[spritenum]; - USERp u = User[spritenum]; + USERp u = User[spritenum].Data(); ASSERT(u); diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index e14235fa9..68cdc8bd0 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -43,7 +43,7 @@ void InterpSectorSprites(short sectnum, bool state); void ReverseSpike(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; // if paused go ahead and start it up again @@ -97,7 +97,7 @@ SpikeSwitch(short match, short setting) void SetSpikeActive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; @@ -125,7 +125,7 @@ void SetSpikeActive(short SpriteNum) void SetSpikeInactive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; @@ -195,7 +195,7 @@ DoSpikeMatch(short match) if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); if (first_spike == -1) first_spike = i; @@ -229,7 +229,7 @@ TestSpikeMatchActive(short match) if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // door war if (TEST_BOOL6(fsp)) @@ -245,7 +245,7 @@ TestSpikeMatchActive(short match) int DoSpikeMove(short SpriteNum, int *lptr) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int zval; zval = *lptr; @@ -282,7 +282,7 @@ int DoSpikeMove(short SpriteNum, int *lptr) void SpikeAlign(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; // either work on single sector or all tagged in SOBJ @@ -313,7 +313,7 @@ void MoveSpritesWithSpike(short sectnum) { sp = &sprite[i]; - if (User[i]) + if (User[i].Data()) continue; if (TEST(sp->extra, SPRX_STAY_PUT_VATOR)) @@ -326,7 +326,7 @@ void MoveSpritesWithSpike(short sectnum) int DoSpike(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; int *lptr; @@ -409,7 +409,7 @@ int DoSpike(short SpriteNum) while ((i = it.NextIndex()) >= 0) { bsp = &sprite[i]; - bu = User[i]; + bu = User[i].Data(); if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY)) { @@ -444,7 +444,7 @@ int DoSpike(short SpriteNum) int DoSpikeAuto(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; int *lptr; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index ebbae6c36..7c7488e7f 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -593,7 +593,7 @@ SetOwner(short owner, short child) if (owner >= 0) { - ASSERT(User[owner]); + ASSERT(User[owner].Data()); SET(User[owner]->Flags2, SPR2_CHILDREN); } else @@ -608,11 +608,11 @@ SetOwner(short owner, short child) void SetAttach(short owner, short child) { - USERp cu = User[child]; + USERp cu = User[child].Data(); ASSERT(cu); - ASSERT(User[owner]); + ASSERT(User[owner].Data()); SET(User[owner]->Flags2, SPR2_CHILDREN); cu->Attach = owner; } @@ -621,7 +621,7 @@ void KillSprite(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int i; unsigned stat; short statnum,sectnum; @@ -727,7 +727,7 @@ KillSprite(int16_t SpriteNum) StatIterator it(MissileStats[stat]); while ((i = it.NextIndex()) >= 0) { - mu = User[i]; + mu = User[i].Data(); if (mu && mu->WpnGoal == SpriteNum) { @@ -753,7 +753,7 @@ KillSprite(int16_t SpriteNum) sprite[i].owner = -1; } - if (User[i] && User[i]->Attach == SpriteNum) + if (User[i].Data() && User[i]->Attach == SpriteNum) { User[i]->Attach = -1; } @@ -766,7 +766,7 @@ KillSprite(int16_t SpriteNum) StatIterator it(STAT_ENEMY); while ((i = it.NextIndex()) >= 0) { - if ((unsigned)i < MAXSPRITES && User[i] != NULL && User[i]->tgt_sp == sp) + if ((unsigned)i < MAXSPRITES && User[i].Data() != NULL && User[i]->tgt_sp == sp) { DoActorPickClosePlayer(i); } @@ -777,10 +777,7 @@ KillSprite(int16_t SpriteNum) { SetSuicide(u->flame); } - - u->rotator.Clear(); - - FreeUser(SpriteNum); + User[SpriteNum].Clear(); } FVector3 pos = GetSoundPos(&sprite[SpriteNum].pos); @@ -795,9 +792,9 @@ KillSprite(int16_t SpriteNum) sp->sectnum = sectnum; // Kill references in all users - slow but unavoidable if we don't want the game to crash on stale pointers. - for (auto u : User) + for (auto& u : User) { - if (u) + if (u.Data()) { if (u->hi_sp == sp) u->hi_sp = nullptr; if (u->lo_sp == sp) u->lo_sp = nullptr; @@ -808,7 +805,7 @@ KillSprite(int16_t SpriteNum) void ChangeState(short SpriteNum, STATEp statep) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u == nullptr) return; @@ -821,7 +818,7 @@ void ChangeState(short SpriteNum, STATEp statep) void change_sprite_stat(short SpriteNum, short stat) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); changespritestat(SpriteNum, stat); @@ -873,7 +870,8 @@ SpawnUser(short SpriteNum, short id, STATEp state) ASSERT(!Prediction); - User[SpriteNum] = u = NewUser(); + User[SpriteNum].Alloc(); + u = User[SpriteNum].Data(); PRODUCTION_ASSERT(u != NULL); @@ -970,7 +968,7 @@ SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int sp->z = z; sp->cstat = 0; - User[SpriteNum] = u = SpawnUser(SpriteNum, id, state); + u = SpawnUser(SpriteNum, id, state); // be careful State can be NULL if (u->State) @@ -1560,7 +1558,7 @@ void IconDefault(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //if (sp->statnum == STAT_ITEM) change_sprite_stat(SpriteNum, STAT_ITEM); @@ -1761,7 +1759,7 @@ SpriteSetupPost(void) if (TEST(ds->cstat, CSTAT_SPRITE_ALIGNMENT_WALL|CSTAT_SPRITE_ALIGNMENT_FLOOR)) continue; - if (User[i]) + if (User[i].Data()) continue; getzsofslope(ds->sectnum, ds->x, ds->y, &cz, &fz); @@ -2593,7 +2591,7 @@ SpriteSetup(void) } } - User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL); + u = SpawnUser(SpriteNum, 0, NULL); u->WallShade.Resize(wallcount); wall_shade = u->WallShade.Data(); @@ -2649,7 +2647,7 @@ SpriteSetup(void) // !LIGHT // make an wall_shade array and put it in User - User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL); + u = SpawnUser(SpriteNum, 0, NULL); u->WallShade.Resize(wallcount); wall_shade = u->WallShade.Data(); @@ -2857,7 +2855,7 @@ SpriteSetup(void) break; case SPAWN_SPOT: - if (!User[SpriteNum]) + if (!User[SpriteNum].Data()) u = SpawnUser(SpriteNum, ST1, NULL); if (SP_TAG14(sp) == ((64<<8)|64)) @@ -3828,7 +3826,7 @@ bool ItemSpotClear(SPRITEp sip, short statnum, short id) void SetupItemForJump(SPRITEp sip, short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // setup item for jumping if (SP_TAG7(sip)) @@ -3850,7 +3848,7 @@ void SetupItemForJump(SPRITEp sip, short SpriteNum) int ActorCoughItem(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short New,choose; SPRITEp np; @@ -4357,7 +4355,7 @@ int SpawnItemsMatch(short match) SpriteNum = SpawnSprite(STAT_ITEM, ICON_ARMOR, s_IconArmor, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); SET(u->Flags2, SPR2_NEVER_RESPAWN); IconDefault(SpriteNum); @@ -4581,7 +4579,7 @@ int SpawnItemsMatch(short match) break; SpriteNum = SpawnSprite(STAT_ITEM, s_Key[num]->Pic, s_Key[num], sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); - u = User[SpriteNum]; + u = User[SpriteNum].Data(); sp = &sprite[SpriteNum]; @@ -4617,7 +4615,7 @@ int // CTW MODIFICATION END NewStateGroup(short SpriteNum, STATEp StateGroup[]) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //if (Prediction) // return; @@ -4650,8 +4648,8 @@ SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) { SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b]; - USERp ua = User[spritenum_a]; - USERp ub = User[spritenum_b]; + USERp ua = User[spritenum_a].Data(); + USERp ub = User[spritenum_b].Data(); int spa_tos, spa_bos, spb_tos, spb_bos, overlap_z; @@ -4846,7 +4844,7 @@ void DoActorZrange(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int ceilhit, florhit; short save_cstat; @@ -4891,7 +4889,7 @@ DoActorZrange(short SpriteNum) int DoActorGlobZ(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->loz = globloz; u->hiz = globhiz; @@ -5017,7 +5015,7 @@ DropAhead(short SpriteNum, short min_height) int move_actor(short SpriteNum, int xchange, int ychange, int zchange) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int x, y, z, loz, hiz; @@ -5151,10 +5149,7 @@ DoGrating(short SpriteNum) if (sp->hitag <= 0) { change_sprite_stat(SpriteNum, STAT_DEFAULT); - if (User[SpriteNum]) - { - FreeUser(SpriteNum); - } + User[SpriteNum].Clear(); } setspritez(SpriteNum, &sp->pos); @@ -5166,7 +5161,7 @@ DoGrating(short SpriteNum) int DoSpriteFade(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; short i; @@ -5196,7 +5191,7 @@ DoSpriteFade(short SpriteNum) int SpearOnFloor(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if (!TEST(u->Flags, SPR_SO_ATTACHED)) @@ -5214,7 +5209,7 @@ SpearOnFloor(short SpriteNum) int SpearOnCeiling(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; if (!TEST(u->Flags, SPR_SO_ATTACHED)) @@ -5245,7 +5240,7 @@ DoKey(short SpriteNum) int DoCoin(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int offset; u->WaitTics -= ACTORMOVETICS * 2; @@ -5281,7 +5276,7 @@ DoCoin(short SpriteNum) int KillGet(short SpriteNum) { - USERp u = User[SpriteNum],nu; + USERp u = User[SpriteNum].Data(),nu; SPRITEp sp = User[SpriteNum]->SpriteP,np; short New; @@ -5312,7 +5307,7 @@ KillGet(short SpriteNum) sp->x, sp->y, sp->z, 0, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->shade = -20; nu->WaitTics = u->WaitTics - 12; @@ -5325,7 +5320,7 @@ KillGet(short SpriteNum) int KillGetAmmo(short SpriteNum) { - USERp u = User[SpriteNum],nu; + USERp u = User[SpriteNum].Data(),nu; SPRITEp sp = User[SpriteNum]->SpriteP,np; short New; @@ -5364,7 +5359,7 @@ KillGetAmmo(short SpriteNum) sp->x, sp->y, sp->z, 0, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->shade = -20; nu->WaitTics = u->WaitTics - 12; @@ -5377,7 +5372,7 @@ KillGetAmmo(short SpriteNum) int KillGetWeapon(short SpriteNum) { - USERp u = User[SpriteNum],nu; + USERp u = User[SpriteNum].Data(),nu; SPRITEp sp = User[SpriteNum]->SpriteP,np; short New; @@ -5424,7 +5419,7 @@ KillGetWeapon(short SpriteNum) sp->x, sp->y, sp->z, 0, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->shade = -20; nu->WaitTics = u->WaitTics - 12; @@ -5467,7 +5462,7 @@ void ChoosePlayerGetSound(PLAYERp pp) bool CanGetWeapon(PLAYERp pp, short SpriteNum, int WPN) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); switch (gNet.MultiGameType) { @@ -5519,8 +5514,8 @@ struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL] = int DoGet(short SpriteNum) { - USERp u = User[SpriteNum], pu; - SPRITEp sp = User[SpriteNum]->SpriteP; + USERp u = User[SpriteNum].Data(), pu; + SPRITEp sp = u->SpriteP; PLAYERp pp; short pnum, key_num; int dist, a,b,c; @@ -5561,8 +5556,8 @@ DoGet(short SpriteNum) TRAVERSE_CONNECT(pnum) { pp = &Player[pnum]; - //pu = User[pp->PlayerSprite]; - pu = User[pp->SpriteP - sprite]; + //pu = User[pp->PlayerSprite].Data(); + pu = User[pp->SpriteP - sprite].Data(); if (TEST(pp->Flags, PF_DEAD)) continue; @@ -6374,7 +6369,7 @@ KeyMain: sp->x, sp->y, sp->z, 0, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->shade = -20; // Attach flag to player @@ -6410,7 +6405,7 @@ KeyMain: void SetEnemyActive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SET(u->Flags, SPR_ACTIVE); u->inactive_time = 0; @@ -6419,7 +6414,7 @@ SetEnemyActive(short SpriteNum) void SetEnemyInactive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); RESET(u->Flags, SPR_ACTIVE); } @@ -6430,7 +6425,7 @@ SetEnemyInactive(short SpriteNum) void ProcessActiveVars(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); #define TIME_TILL_INACTIVE (4*120) if (!TEST(u->Flags, SPR_ACTIVE)) @@ -6452,7 +6447,7 @@ ProcessActiveVars(short SpriteNum) void AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp psp = pp->SpriteP; int look_height; @@ -6589,7 +6584,7 @@ AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist) int StateControl(int16_t SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum]; short StateTics; @@ -6694,8 +6689,8 @@ SpriteControl(void) while ((i = it.NextIndex()) >= 0) { #if INLINE_STATE - ASSERT(User[i]); - u = User[i]; + ASSERT(User[i].Data()); + u = User[i].Data(); sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) // ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); @@ -6715,11 +6710,11 @@ SpriteControl(void) while ((i = it.NextIndex()) >= 0) { #if INLINE_STATE - ASSERT(User[i]); - u = User[i]; + ASSERT(User[i].Data()); + u = User[i].Data(); sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true); #else ASSERT(User[i]); StateControl(i); @@ -6735,12 +6730,11 @@ SpriteControl(void) StatIterator it(STAT_ENEMY); while ((i = it.NextIndex()) >= 0) { - ASSERT(User[i]); + ASSERT(User[i].Data()); - u = User[i]; + u = User[i].Data(); sp = u->SpriteP; - CloseToPlayer = false; ProcessActiveVars(i); @@ -6766,15 +6760,13 @@ SpriteControl(void) if (CloseToPlayer) { #if INLINE_STATE - u = User[i]; + u = User[i].Data(); sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #else StateControl(i); - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #endif - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true); } else { @@ -6793,15 +6785,15 @@ SpriteControl(void) while ((i = it.NextIndex()) >= 0) { #if INLINE_STATE - ASSERT(User[i]); - u = User[i]; + ASSERT(User[i].Data()); + u = User[i].Data(); sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true); #endif } } @@ -6810,7 +6802,7 @@ SpriteControl(void) it.Reset(STAT_NO_STATE); while ((i = it.NextIndex()) >= 0) { - if (User[i] && User[i]->ActorActionFunc) + if (User[i].Data() && User[i]->ActorActionFunc) (*User[i]->ActorActionFunc)(i); ASSERT(it.PeekIndex() >= 0 ? sprite[it.PeekIndex()].statnum != MAXSTATUS : true); } @@ -6821,7 +6813,7 @@ SpriteControl(void) while ((i = it.NextIndex()) >= 0) { extern int DoStaticFlamesDamage(short SpriteNum); - ASSERT(User[i]); + ASSERT(User[i].Data()); DoStaticFlamesDamage(i); } } @@ -6831,11 +6823,11 @@ SpriteControl(void) it.Reset(STAT_WALLBLOOD_QUEUE); while ((i = it.NextIndex()) >= 0) { - ASSERT(User[i]); - u = User[i]; + ASSERT(User[i].Data()); + u = User[i].Data(); sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true); } } @@ -6845,7 +6837,7 @@ SpriteControl(void) it.Reset(STAT_VATOR); while ((i = it.NextIndex()) >= 0) { - u = User[i]; + u = User[i].Data(); if (u == 0) continue; @@ -6866,7 +6858,7 @@ SpriteControl(void) it.Reset(STAT_SPIKE); while ((i = it.NextIndex()) >= 0) { - u = User[i]; + u = User[i].Data(); if (u->Tics) { @@ -6888,7 +6880,7 @@ SpriteControl(void) it.Reset(STAT_ROTATOR); while ((i = it.NextIndex()) >= 0) { - u = User[i]; + u = User[i].Data(); if (u->Tics) { @@ -6907,7 +6899,7 @@ SpriteControl(void) it.Reset(STAT_SLIDOR); while ((i = it.NextIndex()) >= 0) { - u = User[i]; + u = User[i].Data(); if (u->Tics) { @@ -6949,7 +6941,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist int retval=0, zh; short dasectnum, tempshort; SPRITEp spr; - USERp u = User[spritenum]; + USERp u = User[spritenum].Data(); short lastsectnum; spr = &sprite[spritenum]; @@ -7074,7 +7066,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist int pushmove_sprite(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short sectnum, ret; int daz; @@ -7098,7 +7090,7 @@ int pushmove_sprite(short SpriteNum) void MissileWarpUpdatePos(short SpriteNum, short sectnum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; sp->backuppos(); u->oz = sp->oz; @@ -7108,7 +7100,7 @@ void MissileWarpUpdatePos(short SpriteNum, short sectnum) void ActorWarpUpdatePos(short SpriteNum, short sectnum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; sp->backuppos(); u->oz = sp->oz; @@ -7157,7 +7149,7 @@ void ActorWarpType(SPRITEp sp, SPRITEp sp_warp) int MissileWaterAdjust(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->lo_sectp) { @@ -7171,7 +7163,7 @@ MissileWaterAdjust(short SpriteNum) int MissileZrange(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; short tempshort; @@ -7197,7 +7189,7 @@ move_missile(short spritenum, int xchange, int ychange, int zchange, int ceildis int retval, zh; short dasectnum, tempshort; SPRITEp sp; - USERp u = User[spritenum]; + USERp u = User[spritenum].Data(); short lastsectnum; sp = &sprite[spritenum]; @@ -7336,7 +7328,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int int retval=0; short dasectnum; SPRITEp sp; - USERp u = User[spritenum]; + USERp u = User[spritenum].Data(); short lastsectnum; int ox,oy; diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index bdcc4e9d3..df5ed88e6 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -638,12 +638,12 @@ SetupSumo(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]); + u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]); u->Health = 6000; } @@ -680,7 +680,7 @@ SetupSumo(short SpriteNum) int NullSumo(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //if (TEST(u->Flags,SPR_SLIDING)) //DoActorSlide(SpriteNum); @@ -695,7 +695,7 @@ int NullSumo(short SpriteNum) int DoSumoMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //if (TEST(u->Flags,SPR_SLIDING)) //DoActorSlide(SpriteNum); @@ -719,7 +719,7 @@ int DoSumoMove(short SpriteNum) int InitSumoCharge(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (RANDOM_P2(1024) > 950) PlaySound(DIGI_SUMOALERT, sp, v3df_follow); @@ -737,7 +737,7 @@ int InitSumoCharge(short SpriteNum) int DoSumoRumble(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SetSumoQuake(SpriteNum); @@ -787,7 +787,7 @@ int InitSumoClap(short SpriteNum) int DoSumoDeathMelt(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); PlaySound(DIGI_SUMOFART, sp, v3df_follow); @@ -840,7 +840,7 @@ BossHealthMeter(void) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && sp->pal != 16) { @@ -869,7 +869,7 @@ BossHealthMeter(void) if (BossSpriteNum[i] >= 0) { sp = &sprite[BossSpriteNum[i]]; - u = User[BossSpriteNum[i]]; + u = User[BossSpriteNum[i]].Data(); if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sectnum, pp->posx, pp->posy, pp->posz - Z(40), pp->cursectnum)) { @@ -914,7 +914,7 @@ BossHealthMeter(void) continue; sp = &sprite[BossSpriteNum[i]]; - u = User[BossSpriteNum[i]]; + u = User[BossSpriteNum[i]].Data(); if (u->ID == SERP_RUN_R0 && serpwasseen) { diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 8f911fdb8..44d0de861 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -126,7 +126,7 @@ point to the sprite. short ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; int dist, near_dist = 999999, zdiff; @@ -294,7 +294,7 @@ NextTrackPoint(SECTOR_OBJECTp sop) void NextActorTrackPoint(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->point += u->track_dir; @@ -732,7 +732,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) bool FoundOutsideLoop = false; bool SectorInBounds; SECTORp *sectp; - USERp u = User[sop->sp_child - sprite]; + USERp u = User[sop->sp_child - sprite].Data(); static unsigned char StatList[] = { @@ -904,10 +904,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) continue; } - if (User[sp_num] == NULL) + if (User[sp_num].Data() == NULL) u = SpawnUser(sp_num, 0, NULL); else - u = User[sp_num]; + u = User[sp_num].Data(); u->RotNum = 0; @@ -1013,7 +1013,7 @@ cont: for (i = 0; sop->sp_num[i] != -1; i++) { sp = &sprite[sop->sp_num[i]]; - u = User[sop->sp_num[i]]; + u = User[sop->sp_num[i]].Data(); if (sp->z > zmid) zmid = sp->z; @@ -1026,7 +1026,7 @@ cont: for (i = 0; sop->sp_num[i] != -1; i++) { sp = &sprite[sop->sp_num[i]]; - u = User[sop->sp_num[i]]; + u = User[sop->sp_num[i]].Data(); u->sz = sop->zmid - sp->z; } @@ -1129,7 +1129,7 @@ SetupSectorObject(short sectnum, short tag) New = SpawnSprite(STAT_SO_SP_CHILD, 0, NULL, sectnum, sop->xmid, sop->ymid, sop->zmid, 0, 0); sop->sp_child = &sprite[New]; - u = User[New]; + u = User[New].Data(); u->sop_parent = sop; SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test @@ -1560,7 +1560,7 @@ PlaceActorsOnTracks(void) int low_dist = 999999, dist; sp = User[i]->SpriteP; - u = User[i]; + u = User[i].Data(); tag = LOW_TAG_SPRITE(i); @@ -1801,7 +1801,7 @@ PlayerPart: for (i = 0; sop->sp_num[i] != -1; i++) { sp = &sprite[sop->sp_num[i]]; - u = User[sop->sp_num[i]]; + u = User[sop->sp_num[i]].Data(); // if its a player sprite || NOT attached if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED)) @@ -2032,7 +2032,7 @@ void KillSectorObjectSprites(SECTOR_OBJECTp sop) for (i = 0; sop->sp_num[i] != -1; i++) { sp = &sprite[sop->sp_num[i]]; - u = User[sop->sp_num[i]]; + u = User[sop->sp_num[i]].Data(); // not a part of the so anymore RESET(u->Flags, SPR_SO_ATTACHED); @@ -2316,7 +2316,7 @@ void CallbackSOsink(ANIMp ap, void *data) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED)) continue; @@ -2833,7 +2833,7 @@ void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator) while ((SpriteNum = it.NextIndex()) >= 0) { sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); switch (sp->hitag) { @@ -2954,7 +2954,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop) { short SpriteNum = sop->sp_child - sprite; SPRITEp shootp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short delta_ang; int diff; short i; @@ -3110,7 +3110,7 @@ DoActorHitTrackEndPoint(USERp u) void ActorLeaveTrack(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->track == -1) return; @@ -3134,7 +3134,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) { SPRITEp sp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp = u->SpriteP; @@ -3682,7 +3682,7 @@ present time. int ActorFollowTrack(short SpriteNum, short locktics) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; PLAYERp pp; diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index a03da8124..e0cfb2eb4 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -47,7 +47,7 @@ int InitBloodSpray(short, bool, short); void ReverseVator(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; // if paused go ahead and start it up again @@ -101,7 +101,7 @@ VatorSwitch(short match, short setting) void SetVatorActive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; @@ -129,7 +129,7 @@ void SetVatorActive(short SpriteNum) void SetVatorInactive(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; @@ -233,7 +233,7 @@ DoVatorMatch(PLAYERp pp, short match) if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); if (first_vator == -1) first_vator = i; @@ -305,7 +305,7 @@ TestVatorMatchActive(short match) if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match) { - fu = User[i]; + fu = User[i].Data(); // Does not have to be inactive to be operated if (TEST_BOOL6(fsp)) @@ -329,7 +329,7 @@ void InterpSectorSprites(short sectnum, bool state) { sp = &sprite[i]; - if (User[i]) + if (User[i].Data()) { if (TEST(User[i]->Flags, SPR_SKIP4) && sp->statnum <= STAT_SKIP4_INTERP_END) continue; @@ -359,7 +359,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type) { sp = &sprite[i]; - if (User[i]) + if (User[i].Data()) { switch (sp->statnum) { @@ -415,7 +415,7 @@ cont: int DoVatorMove(short SpriteNum, int *lptr) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int zval; int move_amt; @@ -455,7 +455,7 @@ int DoVatorMove(short SpriteNum, int *lptr) int DoVator(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; int *lptr; @@ -550,7 +550,7 @@ int DoVator(short SpriteNum) while ((i = it.NextIndex()) >= 0) { bsp = &sprite[i]; - bu = User[i]; + bu = User[i].Data(); if (bsp->statnum == STAT_ENEMY) { @@ -624,7 +624,7 @@ int DoVator(short SpriteNum) int DoVatorAuto(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SECTORp sectp = §or[sp->sectnum]; int *lptr; diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index 7055a9e61..179426eb3 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -75,7 +75,7 @@ void ProcessVisOn(void) VIS_VisCur(sp) = NormalVisibility; if (sp->owner >= 0) { - ASSERT(User[sp->owner]); + ASSERT(User[sp->owner].Data()); RESET(User[sp->owner]->Flags2, SPR2_VIS_SHADING); } KillSprite(i); @@ -157,7 +157,7 @@ int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt) sp->owner = Parent; - ASSERT(User[Parent]); + ASSERT(User[Parent].Data()); SET(User[Parent]->Flags2, SPR2_CHILDREN); sp->x = sprite[Parent].x; diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index c776db66a..7da5ff07b 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -62,7 +62,7 @@ void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int { short ang; // move orig x and y in saved angle - ASSERT(User[sp - sprite]); + ASSERT(User[sp - sprite].Data()); ang = User[sp - sprite]->sang; *nx = MulScale(dist, bcos(ang), 14); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index ff6176255..d294fbb29 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -2650,7 +2650,7 @@ bool MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) if (WeaponNum <= -1) { ASSERT(Weapon >= 0); - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); WeaponNum = wu->WeaponNum; // can be hit by SO only @@ -2758,7 +2758,7 @@ int SpawnShrapX(short SpriteNum) int DoLavaErupt(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short i,pnum; PLAYERp pp; SPRITEp tsp; @@ -2875,7 +2875,7 @@ SpawnShrap(short ParentNum, short Secondary) { SPRITEp parent = &sprite[ParentNum]; SPRITEp sp; - USERp u, pu = User[ParentNum]; + USERp u, pu = User[ParentNum].Data(); short SpriteNum; short i; @@ -3236,7 +3236,7 @@ SpawnShrap(short ParentNum, short Secondary) else if (TEST(parent->extra, SPRX_BREAKABLE)) { // if no user - if (!User[parent - sprite]) + if (!User[parent - sprite].Data()) { // Jump to shrap type shrap_type = SP_TAG8(parent); @@ -3733,7 +3733,7 @@ AutoShrap: // most of the time is is the weapon if (Secondary >= 0) { - USERp wu = User[Secondary]; + USERp wu = User[Secondary].Data(); if (wu->PlayerP && wu->PlayerP->sop_control) { @@ -3767,7 +3767,7 @@ AutoShrap: parent->x, parent->y, hz[p->zlevel], shrap_ang, 512); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); if (p->random_disperse) { @@ -3881,7 +3881,7 @@ AutoShrap: int DoShrapMove(int16_t SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->ret = move_missile(SpriteNum, u->xchange, u->ychange, 0, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS*2); @@ -3893,7 +3893,7 @@ int DoVomit(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS)); sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14); @@ -3943,7 +3943,7 @@ int DoVomit(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS)); sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14); @@ -3988,7 +3988,7 @@ DoVomit(short SpriteNum) int DoVomitSplash(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if ((u->WaitTics-=MISSILEMOVETICS) < 0) { @@ -4003,7 +4003,7 @@ int DoFastShrapJumpFall(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->x += u->xchange*2; sp->y += u->ychange*2; @@ -4020,7 +4020,7 @@ int DoTracerShrap(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->x += u->xchange; sp->y += u->ychange; @@ -4038,7 +4038,7 @@ DoTracerShrap(short SpriteNum) int DoShrapJumpFall(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING)) { @@ -4070,7 +4070,7 @@ int DoShrapDamage(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_JUMPING)) { @@ -4187,7 +4187,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i short shrap_pal = PALETTE_DEFAULT; short start_ang = 0; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); switch (u->ID) { @@ -4206,7 +4206,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i if (Weapon >= 0) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); switch (wu->ID) { @@ -4290,7 +4290,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i New = SpawnSprite(STAT_SKIP4, p->id, p->state, sp->sectnum, hit_x, hit_y, hit_z, hit_ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); switch (nu->ID) { @@ -4367,7 +4367,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i bool VehicleMoveHit(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp cp; SECTOR_OBJECTp sop; SECTOR_OBJECTp hsop; @@ -4474,7 +4474,7 @@ VehicleMoveHit(short SpriteNum) bool WeaponMoveHit(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; @@ -4571,7 +4571,7 @@ WeaponMoveHit(short SpriteNum) hit_sprite = NORM_SPRITE(u->ret); hsp = &sprite[hit_sprite]; - hu = User[hit_sprite]; + hu = User[hit_sprite].Data(); if (hsp->statnum == STAT_ENEMY) { @@ -4759,7 +4759,7 @@ int DoFireballFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum],ap; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); bool jumping = false; // if no owner then stay where you are @@ -4856,7 +4856,7 @@ int DoBreakFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); bool jumping = false; if (TEST(u->Flags, SPR_JUMPING)) @@ -4932,7 +4932,7 @@ DoBreakFlames(short SpriteNum) int SetSuicide(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u != nullptr) { @@ -4946,7 +4946,7 @@ SetSuicide(short SpriteNum) int DoActorScale(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum]; u->scale_speed = 70; @@ -4965,7 +4965,7 @@ DoActorScale(short SpriteNum) int DoRipperGrow(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum]; u->scale_speed = 70; @@ -4986,7 +4986,7 @@ void UpdateSinglePlayKills(short SpriteNum) // single play and coop kill count if (gNet.MultiGameType != MULTI_GAME_COMMBAT) { - ASSERT(User[SpriteNum]); + ASSERT(User[SpriteNum].Data()); if (TEST(User[SpriteNum]->Flags, SPR_SUICIDE)) { @@ -5028,9 +5028,9 @@ int ActorChooseDeath(short SpriteNum, short Weapon) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); ASSERT(u); @@ -5309,7 +5309,7 @@ int ActorHealth(short SpriteNum, short amt) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); extern int FinishAnim; if (u->ID == TRASHCAN && amt > -75) @@ -5411,7 +5411,7 @@ int SopDamage(SECTOR_OBJECTp sop, short amt) { SPRITEp sp = sop->sp_child; - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); // does not have damage if (sop->max_damage == -9999) @@ -5455,7 +5455,7 @@ SopCheckKill(SECTOR_OBJECTp sop) int ActorPain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); //if (u->LastDamage < u->PainThreshold) // This doesn't work well at all because of // uzi/shotgun damages @@ -5491,7 +5491,7 @@ ActorPain(short SpriteNum) int ActorPainPlasma(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_ELECTRO_TOLERANT)) { @@ -5515,9 +5515,9 @@ int ActorStdMissile(short SpriteNum, short Weapon) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); ASSERT(Weapon >= 0); @@ -5538,7 +5538,7 @@ ActorStdMissile(short SpriteNum, short Weapon) { // attempt to see if it was killed ASSERT(sprite[wu->WpnGoal].sectnum >= 0); - ASSERT(User[Weapon]); + ASSERT(User[Weapon].Data()); // what if the target has been killed? This will crash! RESET(User[wu->WpnGoal]->Flags, SPR_TARGETED); } @@ -5548,7 +5548,7 @@ ActorStdMissile(short SpriteNum, short Weapon) int ActorDamageSlide(short SpriteNum, short damage, short ang) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int slide_vel,slide_dec; if (TEST(u->Flags, SPR_CLIMBING)) @@ -5679,7 +5679,7 @@ RadiusGetDamage(short SpriteNum, short Weapon, int max_damage) { SPRITEp sp = &sprite[SpriteNum]; SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); int dist,a,b,c; int damage_per_pixel, damage_force, damage_amt; @@ -5717,7 +5717,7 @@ int PlayerCheckDeath(PLAYERp pp, short Weapon) { SPRITEp sp = pp->SpriteP; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); int SpawnZombie(PLAYERp pp, short); @@ -5743,7 +5743,7 @@ PlayerCheckDeath(PLAYERp pp, short Weapon) } SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); if (Weapon > -1 && (wu->ID == RIPPER_RUN_R0 || wu->ID == RIPPER2_RUN_R0)) pp->DeathType = PLAYER_DEATH_RIPPER; @@ -5788,9 +5788,9 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) if (Weapon < 0) return true; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); if (gNet.MultiGameType == MULTI_GAME_NONE) { @@ -5816,7 +5816,7 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) return true; // if the weapons owner is YOURSELF take damage - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) return true; // if weapon IS the player no damage @@ -5824,7 +5824,7 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) return false; // if the weapons owner is a player - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->PlayerP) return false; } else if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.TeamPlay) @@ -5838,7 +5838,7 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) return true; // if the weapons owner is YOURSELF take damage - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) return true; if (wu->PlayerP) @@ -5849,7 +5849,7 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) } // if the weapons owner is a player - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->PlayerP) { // if both on the same team then no damage if (User[wp->owner]->spal == u->spal) @@ -5864,7 +5864,7 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) int StarBlood(short SpriteNum, short Weapon) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short blood_num = 1; short i; @@ -5888,7 +5888,7 @@ int DoDamage(short SpriteNum, short Weapon) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp wp; USERp wu; int damage=0; @@ -5906,7 +5906,7 @@ DoDamage(short SpriteNum, short Weapon) return 0; wp = &sprite[Weapon]; - wu = User[Weapon]; + wu = User[Weapon].Data(); ASSERT(wu); @@ -6681,7 +6681,7 @@ DoDamage(short SpriteNum, short Weapon) { // this is special code to prevent the Zombie from taking out the Bosses to quick // if rail gun weapon owner is not player - if (wp->owner >= 0 && User[wp->owner] && !User[wp->owner]->PlayerP) + if (wp->owner >= 0 && User[wp->owner].Data() && !User[wp->owner]->PlayerP) { // if actor is a boss if (u->ID == ZILLA_RUN_R0 || u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0) @@ -6920,7 +6920,7 @@ DoDamage(short SpriteNum, short Weapon) else { // Don't let it hurt the SUMO - if (wp->owner >=0 && User[wp->owner] && User[wp->owner]->ID == SUMO_RUN_R0) break; // JBF: added sanity check for wp->owner and User[wp->owner] + if (wp->owner >=0 && User[wp->owner].Data() && User[wp->owner]->ID == SUMO_RUN_R0) break; // JBF: added sanity check for wp->owner and User[wp->owner] ActorHealth(SpriteNum, damage); ActorPain(SpriteNum); ActorDamageSlide(SpriteNum, damage, ANG2SPRITE(sp, wp)); @@ -6964,7 +6964,7 @@ DoDamage(short SpriteNum, short Weapon) case MINE_EXP: damage = GetDamage(SpriteNum, Weapon, DMG_MINE_EXP); - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->ID == SERP_RUN_R0) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->ID == SERP_RUN_R0) { damage /= 6; } @@ -7044,7 +7044,7 @@ DoDamage(short SpriteNum, short Weapon) damage = GetDamage(SpriteNum, Weapon, DMG_NAPALM_EXP); // Sumo Nap does less - if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->ID == SUMO_RUN_R0) + if (wp->owner >= 0 && User[wp->owner].Data() && User[wp->owner]->ID == SUMO_RUN_R0) damage /= 4; if (u->sop_parent) @@ -7412,7 +7412,7 @@ DoDamage(short SpriteNum, short Weapon) // Select death text based on ID const char *DeathString(short SpriteNum) { - USERp ku = User[SpriteNum]; + USERp ku = User[SpriteNum].Data(); switch (ku->ID) { @@ -7516,7 +7516,7 @@ int DoDamageTest(short Weapon) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); USERp u; SPRITEp sp; @@ -7531,7 +7531,7 @@ DoDamageTest(short Weapon) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin); @@ -7588,7 +7588,7 @@ int DoFlamesDamageTest(short Weapon) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); USERp u; SPRITEp sp; @@ -7603,7 +7603,7 @@ DoFlamesDamageTest(short Weapon) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); switch (u->ID) { @@ -7762,7 +7762,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in int DoExpDamageTest(short Weapon) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); USERp u; SPRITEp sp; @@ -7793,7 +7793,7 @@ int DoExpDamageTest(short Weapon) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin); @@ -7841,7 +7841,7 @@ int DoExpDamageTest(short Weapon) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin); if ((unsigned)dist > wu->Radius) @@ -7915,7 +7915,7 @@ int DoExpDamageTest(short Weapon) int DoMineExpMine(short Weapon) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); USERp u; SPRITEp sp; @@ -7928,7 +7928,7 @@ int DoMineExpMine(short Weapon) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin); if ((unsigned)dist > wu->Radius + u->Radius) @@ -7959,7 +7959,7 @@ int DoStar(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); USERp su; int vel; @@ -8162,7 +8162,7 @@ DoStar(int16_t Weapon) short hit_sprite = NORM_SPRITE(u->ret); if (hit_sprite != -1) { - su = User[hit_sprite]; + su = User[hit_sprite].Data(); if (su && (su->ID == TRASHCAN || su->ID == ZILLA_RUN_R0)) // JBF: added null test PlaySound(DIGI_STARCLINK, sp, v3df_none); } @@ -8185,9 +8185,9 @@ DoStar(int16_t Weapon) int DoCrossBolt(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); - u = User[Weapon]; + u = User[Weapon].Data(); ASSERT(Weapon >= 0); @@ -8224,7 +8224,7 @@ int DoPlasmaDone(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); sp->xrepeat += u->Counter; sp->yrepeat -= 4; @@ -8263,7 +8263,7 @@ int MissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int16_t dang_shift, int16_t turn_limit, int16_t z_limit*/) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int zh; short ang2tgt, delta_ang; @@ -8283,7 +8283,7 @@ MissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int16_t d { if ((hit_sprite = PickEnemyTarget(sp, aware_range)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8292,7 +8292,7 @@ MissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int16_t d } else if ((hit_sprite = DoPickTarget(sp, aware_range, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8346,7 +8346,7 @@ int ComboMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int16_t dang_shift, int16_t turn_limit, int16_t z_limit*/) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int dist; int zh; @@ -8365,7 +8365,7 @@ ComboMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int1 if ((hit_sprite = DoPickTarget(sp, aware_range, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8414,7 +8414,7 @@ int VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_t aware_range1, int16_t aware_range2) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int dist; int zh; @@ -8434,7 +8434,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ { if ((hit_sprite = PickEnemyTarget(sp, aware_range1)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8442,7 +8442,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ } else if ((hit_sprite = PickEnemyTarget(sp, aware_range2)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8453,7 +8453,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ { if ((hit_sprite = DoPickTarget(sp, aware_range1, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8461,7 +8461,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ } else if ((hit_sprite = DoPickTarget(sp, aware_range2, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8507,7 +8507,7 @@ int VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t aware_range2) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int dist; int zh; @@ -8525,7 +8525,7 @@ VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t if ((hit_sprite = DoPickTarget(sp, aware_range1, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8533,7 +8533,7 @@ VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t } else if ((hit_sprite = DoPickTarget(sp, aware_range2, false)) != -1) { - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); u->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -8572,7 +8572,7 @@ VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t int DoBlurExtend(int16_t Weapon, int16_t interval, int16_t blur_num) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (u->motion_blur_num >= blur_num) return 0; @@ -8602,7 +8602,7 @@ InitPlasmaFountain(SPRITEp wp, SPRITEp sp) sp->x, sp->y, SPRITEp_BOS(sp), sp->ang, 0); np = &sprite[SpriteNum]; - nu = User[SpriteNum]; + nu = User[SpriteNum].Data(); np->shade = -40; if (wp) @@ -8623,7 +8623,7 @@ DoPlasmaFountain(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; SPRITEp ap; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short bak_cstat; // if no owner then die @@ -8671,7 +8671,7 @@ int DoPlasma(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int32_t dax, day, daz; int ox,oy,oz; @@ -8697,7 +8697,7 @@ DoPlasma(int16_t Weapon) { short hit_sprite = NORM_SPRITE(u->ret); SPRITEp hsp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { @@ -8750,7 +8750,7 @@ int DoCoolgFire(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -8767,7 +8767,7 @@ DoCoolgFire(int16_t Weapon) { PlaySound(DIGI_CGMAGICHIT, sp, v3df_follow); ChangeState(Weapon, s_CoolgFireDone); - if (sp->owner >= 0 && User[sp->owner] && User[sp->owner]->ID != RIPPER_RUN_R0) // JBF: added range check + if (sp->owner >= 0 && User[sp->owner].Data() && User[sp->owner]->ID != RIPPER_RUN_R0) // JBF: added range check SpawnDemonFist(Weapon); // Just a red magic circle flash return true; } @@ -8779,7 +8779,7 @@ DoCoolgFire(int16_t Weapon) int DoEelFire(short Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256) SpawnBubble(Weapon); @@ -8792,7 +8792,7 @@ DoEelFire(short Weapon) void ScaleSpriteVector(short SpriteNum, int scale) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->xchange = MulScale(u->xchange, scale, 16); u->ychange = MulScale(u->ychange, scale, 16); @@ -8801,7 +8801,7 @@ void ScaleSpriteVector(short SpriteNum, int scale) void WallBounce(short SpriteNum, short ang) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; int old_ang; //short hit_wall; @@ -8844,7 +8844,7 @@ void WallBounce(short SpriteNum, short ang) bool SlopeBounce(short SpriteNum, bool *hit_wall) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; int k,l; int hiz,loz; @@ -8918,7 +8918,7 @@ int DoGrenade(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short i; if (TEST(u->Flags, SPR_UNDERWATER)) @@ -9138,7 +9138,7 @@ DoGrenade(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(Weapon, New); np->shade = -40; @@ -9165,7 +9165,7 @@ int DoVulcanBoulder(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->Counter += 40; u->zchange += u->Counter; @@ -9320,10 +9320,10 @@ bool OwnerIsPlayer(short Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon],uo; + USERp u = User[Weapon].Data(),uo; if (!u || !sp || (unsigned)sp->owner >= (unsigned)MAXSPRITES) return false; - uo = User[sp->owner]; + uo = User[sp->owner].Data(); if (uo && uo->PlayerP) return true; return false; @@ -9350,7 +9350,7 @@ DoMineRangeTest(short Weapon, short range) while ((i = it.NextIndex()) >= 0) { sp = &sprite[i]; - u = User[i]; + u = User[i].Data(); // don't detect the owner or the owners bottom half //if (wp->owner == i || (u->PlayerP && (wp->owner == u->PlayerP->PlayerSprite))) @@ -9391,14 +9391,14 @@ int DoMineStuck(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); #define MINE_DETONATE_STATE 99 // if no owner then die if (u->Attach >= 0) { SPRITEp ap = &sprite[u->Attach]; - USERp au = User[u->Attach]; + USERp au = User[u->Attach].Data(); ASSERT(au); @@ -9554,7 +9554,7 @@ int SetMineStuck(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); // stuck SET(u->Flags, SPR_BOUNCE); @@ -9573,7 +9573,7 @@ int DoMine(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -9610,7 +9610,7 @@ DoMine(int16_t Weapon) { short hit_sprite = NORM_SPRITE(u->ret); SPRITEp hsp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); SetMineStuck(Weapon); // Set the Z position @@ -9631,7 +9631,7 @@ DoMine(int16_t Weapon) if (sp->owner >= 0) { - uo = User[sp->owner]; + uo = User[sp->owner].Data(); if (uo && uo->PlayerP) { @@ -9736,7 +9736,7 @@ int DoPuff(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->x += u->xchange; sp->y += u->ychange; @@ -9760,7 +9760,7 @@ int DoBoltThinMan(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int32_t dax, day, daz; DoBlurExtend(Weapon, 0, 4); @@ -9799,7 +9799,7 @@ int DoTracer(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short i; for (i = 0; i < 4; i++) @@ -9827,7 +9827,7 @@ int DoEMP(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short i; for (i = 0; i < 4; i++) @@ -9866,12 +9866,12 @@ int DoEMPBurst(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (u->Attach >= 0) { SPRITEp ap = &sprite[u->Attach]; - USERp au = User[u->Attach]; + USERp au = User[u->Attach].Data(); ASSERT(au); @@ -9919,7 +9919,7 @@ DoEMPBurst(int16_t Weapon) int DoTankShell(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short i; for (i = 0; i < 4; i++) @@ -9946,7 +9946,7 @@ DoTankShell(int16_t Weapon) int DoTracerStart(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -9969,7 +9969,7 @@ int DoLaser(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp np; USERp nu; short New; @@ -9999,7 +9999,7 @@ DoLaser(int16_t Weapon) New = SpawnSprite(STAT_MISSILE, PUFF, s_LaserPuff, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->shade = -40; np->xrepeat = 16; @@ -10017,7 +10017,7 @@ DoLaser(int16_t Weapon) int DoLaserStart(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (SW_SHAREWARE) return false; // JBF: verify @@ -10042,7 +10042,7 @@ int DoRail(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp np; USERp nu; short New; @@ -10099,7 +10099,7 @@ DoRail(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 20); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->xvel += (RANDOM_RANGE(140)-RANDOM_RANGE(140)); np->yvel += (RANDOM_RANGE(140)-RANDOM_RANGE(140)); @@ -10130,7 +10130,7 @@ DoRail(int16_t Weapon) int DoRailStart(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); if (SW_SHAREWARE) return false; // JBF: verify @@ -10156,7 +10156,7 @@ int DoRocket(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int dist,a,b,c; auto pos = sp->pos; @@ -10215,7 +10215,7 @@ DoRocket(int16_t Weapon) pos.x, pos.y, pos.z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(Weapon, New); np->shade = -40; @@ -10243,7 +10243,7 @@ DoRocket(int16_t Weapon) int DoMicroMini(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short i; for (i = 0; i < 3; i++) @@ -10270,7 +10270,7 @@ int SpawnExtraMicroMini(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp wp; USERp wu; short w; @@ -10279,7 +10279,7 @@ SpawnExtraMicroMini(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, sp->xvel); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(sp->owner, w); wp->yrepeat = wp->xrepeat = sp->xrepeat; @@ -10309,7 +10309,7 @@ int DoMicro(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short New; if (SW_SHAREWARE) return false; // JBF: verify @@ -10333,7 +10333,7 @@ DoMicro(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 100); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); SetOwner(sp->owner, New); np->shade = -40; @@ -10384,7 +10384,7 @@ int DoUziBullet(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int32_t dax, day, daz; int sx,sy; short i; @@ -10456,7 +10456,7 @@ int DoBoltSeeker(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int32_t dax, day, daz; MissileSeek(Weapon, 30, 768/*, 4, 48, 6*/); @@ -10503,7 +10503,7 @@ int DoElectro(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int32_t dax, day, daz; DoBlurExtend(Weapon, 0, 4); @@ -10535,7 +10535,7 @@ DoElectro(int16_t Weapon) case HIT_SPRITE: { SPRITEp hsp = &sprite[NORM_SPRITE(u->ret)]; - USERp hu = User[NORM_SPRITE(u->ret)]; + USERp hu = User[NORM_SPRITE(u->ret)].Data(); if (!TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY) || hu->ID == SKULL_R0 || hu->ID == BETTY_R0) SpawnShrap(Weapon, -1); @@ -10559,7 +10559,7 @@ DoElectro(int16_t Weapon) int DoLavaBoulder(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10588,7 +10588,7 @@ DoLavaBoulder(int16_t Weapon) int DoSpear(int16_t Weapon) { - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10618,7 +10618,7 @@ DoSpear(int16_t Weapon) int SpawnCoolieExp(short SpriteNum) { - USERp u = User[SpriteNum], eu; + USERp u = User[SpriteNum].Data(), eu; SPRITEp sp = &sprite[SpriteNum]; short explosion; @@ -10638,7 +10638,7 @@ int SpawnCoolieExp(short SpriteNum) explosion = SpawnSprite(STAT_MISSILE, BOLT_EXP, s_BoltExp, sp->sectnum, nx, ny, zh, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(SpriteNum, explosion); @@ -10659,7 +10659,7 @@ int SpawnBasicExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -10674,7 +10674,7 @@ SpawnBasicExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, BASIC_EXP, s_BasicExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->xrepeat = 24; @@ -10702,7 +10702,7 @@ int SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp ep; USERp eu; SPRITEp np; @@ -10715,7 +10715,7 @@ SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) if (enemy >= 0) { ep = &sprite[enemy]; - eu = User[enemy]; + eu = User[enemy].Data(); // test for already burned if (TEST(ep->extra, SPRX_BURNABLE) && ep->shade > 40) @@ -10730,7 +10730,7 @@ SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) { int sizez = SPRITEp_SIZE_Z(ep) + DIV4(SPRITEp_SIZE_Z(ep)); np = &sprite[eu->flame]; - nu = User[eu->flame]; + nu = User[eu->flame].Data(); if (TEST(ep->extra, SPRX_BURNABLE)) return eu->flame; @@ -10771,7 +10771,7 @@ SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) New = SpawnSprite(STAT_MISSILE, FIREBALL_FLAMES, s_FireballFlames, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->hitag = LUMINOUS; //Always full brightness @@ -10837,7 +10837,7 @@ int SpawnBreakFlames(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp np; USERp nu; short New; @@ -10845,7 +10845,7 @@ SpawnBreakFlames(int16_t SpriteNum) New = SpawnSprite(STAT_MISSILE, FIREBALL_FLAMES+1, s_BreakFlames, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->hitag = LUMINOUS; //Always full brightness @@ -10879,7 +10879,7 @@ int SpawnBreakStaticFlames(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp np; USERp nu; short New; @@ -10887,7 +10887,7 @@ SpawnBreakStaticFlames(int16_t SpriteNum) New = SpawnSprite(STAT_STATIC_FIRE, FIREBALL_FLAMES, NULL, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); if (RANDOM_RANGE(1000) > 500) np->picnum = 3143; @@ -10929,7 +10929,7 @@ int SpawnFireballExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -10944,7 +10944,7 @@ SpawnFireballExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, FIREBALL_EXP, s_FireballExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->xrepeat = 52; @@ -10972,7 +10972,7 @@ int SpawnGoroFireballExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -10987,7 +10987,7 @@ SpawnGoroFireballExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, 0, s_FireballExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->xrepeat = 16; @@ -11011,7 +11011,7 @@ int SpawnBoltExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11026,7 +11026,7 @@ SpawnBoltExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, BOLT_EXP, s_BoltExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11053,7 +11053,7 @@ int SpawnBunnyExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); ASSERT(u); @@ -11075,7 +11075,7 @@ int SpawnTankShellExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11090,7 +11090,7 @@ SpawnTankShellExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, TANK_SHELL_EXP, s_TankShellExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11115,7 +11115,7 @@ int SpawnNuclearSecondaryExp(int16_t Weapon, short ang) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11125,7 +11125,7 @@ SpawnNuclearSecondaryExp(int16_t Weapon, short ang) explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 512); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11163,7 +11163,7 @@ int SpawnNuclearExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion,ang=0; @@ -11193,7 +11193,7 @@ SpawnNuclearExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, MUSHROOM_CLOUD, s_NukeMushroom, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11212,7 +11212,7 @@ SpawnNuclearExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, MUSHROOM_CLOUD, s_GrenadeExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); SetOwner(sp->owner, explosion); exp->shade = -128; @@ -11257,7 +11257,7 @@ int SpawnTracerExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11274,7 +11274,7 @@ SpawnTracerExp(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11303,7 +11303,7 @@ int SpawnMicroExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11317,7 +11317,7 @@ SpawnMicroExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, MICRO_EXP, s_MicroExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11347,7 +11347,7 @@ int AddSpriteToSectorObject(short SpriteNum, SECTOR_OBJECTp sop) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); unsigned sn; // make sure it has a user @@ -11395,12 +11395,12 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop) } sp = &sprite[Weapon]; - u = User[Weapon]; + u = User[Weapon].Data(); explosion = SpawnSprite(STAT_MISSILE, MICRO_EXP, s_BigGunFlame, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(Operator, explosion); @@ -11460,7 +11460,7 @@ int SpawnGrenadeSecondaryExp(int16_t Weapon, short ang) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11471,7 +11471,7 @@ SpawnGrenadeSecondaryExp(int16_t Weapon, short ang) explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_GrenadeSmallExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 1024); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11519,7 +11519,7 @@ int SpawnGrenadeExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11533,7 +11533,7 @@ SpawnGrenadeExp(int16_t Weapon) if (RANDOM_RANGE(1000) > 990) { - if (sp->owner >= 0 && User[sp->owner] && User[sp->owner]->PlayerP) + if (sp->owner >= 0 && User[sp->owner].Data() && User[sp->owner]->PlayerP) { PLAYERp pp = User[sp->owner]->PlayerP; PlayerSound(DIGI_LIKEFIREWORKS, v3df_follow|v3df_dontpan,pp); @@ -11554,7 +11554,7 @@ SpawnGrenadeExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, sp->sectnum, dx, dy, dz, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11596,8 +11596,8 @@ SpawnGrenadeExp(int16_t Weapon) void SpawnExpZadjust(short Weapon, SPRITEp exp, int upper_zsize, int lower_zsize) { - USERp u = User[Weapon]; - USERp eu = User[exp - sprite]; + USERp u = User[Weapon].Data(); + USERp eu = User[exp - sprite].Data(); int tos_z, bos_z; ASSERT(eu); @@ -11643,7 +11643,7 @@ int SpawnMineExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11659,7 +11659,7 @@ SpawnMineExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, MINE_EXP, s_MineExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness SetOwner(sp->owner, explosion); @@ -11738,7 +11738,7 @@ InitMineShrap(short SpriteNum) int DoMineExp(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); DoExpDamageTest(SpriteNum); //InitMineShrap(SpriteNum); @@ -11750,7 +11750,7 @@ int DoSectorExp(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->x += u->xchange; sp->y += u->ychange; @@ -11762,7 +11762,7 @@ int SpawnSectorExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11776,7 +11776,7 @@ SpawnSectorExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_SectorExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->owner = -1; @@ -11808,7 +11808,7 @@ SpawnLargeExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_SectorExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->owner = -1; @@ -11833,7 +11833,7 @@ int SpawnMeteorExp(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -11855,7 +11855,7 @@ SpawnMeteorExp(int16_t Weapon) } exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->owner = -1; @@ -11892,7 +11892,7 @@ SpawnLittleExp(int16_t Weapon) explosion = SpawnSprite(STAT_MISSILE, BOLT_EXP, s_SectorExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->owner = -1; @@ -11911,9 +11911,9 @@ int DoFireball(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); - u = User[Weapon]; + u = User[Weapon].Data(); ASSERT(Weapon >= 0); @@ -11965,7 +11965,7 @@ DoFireball(int16_t Weapon) USERp hu; hsp = &sprite[NORM_SPRITE(u->ret)]; - hu = User[NORM_SPRITE(u->ret)]; + hu = User[NORM_SPRITE(u->ret)].Data(); if (TEST(hsp->extra, SPRX_BURNABLE)) { @@ -12001,7 +12001,7 @@ int DoFindGround(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum], hsp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int ceilhit, florhit; short save_cstat; short bak_cstat; @@ -12060,7 +12060,7 @@ int DoFindGroundPoint(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum], hsp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int ceilhit, florhit; short save_cstat; short bak_cstat; @@ -12119,13 +12119,13 @@ int DoNapalm(int16_t Weapon) { SPRITEp sp = &sprite[Weapon], exp; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short explosion; int ox, oy, oz; DoBlurExtend(Weapon, 1, 7); - u = User[Weapon]; + u = User[Weapon].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -12186,7 +12186,7 @@ DoNapalm(int16_t Weapon) sp->x, sp->y, sp->z, sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness //exp->owner = sp->owner; @@ -12235,14 +12235,14 @@ int DoBloodWorm(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); short ang; int xvect,yvect; int bx,by; int amt; short sectnum; - u = User[Weapon]; + u = User[Weapon].Data(); u->ret = move_ground_missile(Weapon, u->xchange, u->ychange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -12275,7 +12275,7 @@ DoBloodWorm(int16_t Weapon) while ((i = it.NextIndex()) >= 0) { tsp = &sprite[i]; - tu = User[i]; + tu = User[i].Data(); ASSERT(tu); @@ -12327,7 +12327,7 @@ int DoBloodWorm(int16_t Weapon) { SPRITEp sp = &sprite[Weapon], exp; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int offset; short ang; int x,y,z,xvect,yvect; @@ -12335,7 +12335,7 @@ DoBloodWorm(int16_t Weapon) int amt; short sectnum; - u = User[Weapon]; + u = User[Weapon].Data(); u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -12389,7 +12389,7 @@ DoBloodWorm(int16_t Weapon) while ((i = it.NextIndex()) >= 0) { tsp = &sprite[i]; - tu = User[i]; + tu = User[i].Data(); ASSERT(tu); @@ -12464,7 +12464,7 @@ int DoSerpMeteor(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int ox, oy, oz; ox = sp->x; @@ -12484,7 +12484,7 @@ DoSerpMeteor(int16_t Weapon) if (TEST(u->ret, HIT_MASK) == HIT_SPRITE) { SPRITEp hsp = &sprite[NORM_SPRITE(u->ret)]; - USERp hu = User[NORM_SPRITE(u->ret)]; + USERp hu = User[NORM_SPRITE(u->ret)].Data(); if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP) { @@ -12522,9 +12522,9 @@ int DoMirvMissile(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); - u = User[Weapon]; + u = User[Weapon].Data(); sp->xrepeat += MISSILEMOVETICS * 2; if (sp->xrepeat > 80) @@ -12555,11 +12555,11 @@ int DoMirv(int16_t Weapon) { SPRITEp sp = &sprite[Weapon], np; - USERp u = User[Weapon], nu; + USERp u = User[Weapon].Data(), nu; short New; // int ox, oy, oz; - u = User[Weapon]; + u = User[Weapon].Data(); // ox = sp->x; // oy = sp->y; @@ -12615,7 +12615,7 @@ DoMirv(int16_t Weapon) sp->x, sp->y, sp->z, NORM_ANGLE(sp->ang + angs[i]), 800); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); nu->RotNum = 5; NewStateGroup(New, &sg_MirvMeteor[0]); @@ -12660,7 +12660,7 @@ bool MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); int oldvel, oldzvel; int oldxc, oldyc, oldzc; bool retval = false; @@ -12704,7 +12704,7 @@ bool TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) { SPRITEp wp = &sprite[Weapon]; - USERp wu = User[Weapon]; + USERp wu = User[Weapon].Data(); int oldvel, oldzvel; int oldxc, oldyc, oldzc; bool retval = false; @@ -12748,7 +12748,7 @@ int DoRing(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); PLAYERp pp = User[sp->owner]->PlayerP; SPRITEp so = &sprite[sp->owner]; int cz,fz; @@ -12881,7 +12881,7 @@ InitSpellRing(PLAYERp pp) sp->yrepeat = 32; sp->zvel = 0; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); u->sz = Z(20); u->Dist = RING_INNER_DIST; @@ -12912,8 +12912,8 @@ int DoSerpRing(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; - USERp ou = User[sp->owner]; + USERp u = User[Weapon].Data(); + USERp ou = User[sp->owner].Data(); int dist,a,b,c; int cz,fz; @@ -12977,7 +12977,7 @@ DoSerpRing(int16_t Weapon) if (u->Counter2 > 0) { - if (!User[ou->tgt_sp-sprite] || + if (!User[ou->tgt_sp-sprite].Data() || !User[ou->tgt_sp-sprite]->PlayerP || !TEST(User[ou->tgt_sp-sprite]->PlayerP->Flags, PF_DEAD)) { @@ -13036,7 +13036,7 @@ int InitLavaThrow(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -13054,7 +13054,7 @@ InitLavaThrow(short SpriteNum) nx, ny, nz, nang, NINJA_BOLT_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(SpriteNum, w); wp->hitag = LUMINOUS; //Always full brightness @@ -13127,7 +13127,7 @@ InitVulcanBoulder(short SpriteNum) nx, ny, nz, nang, (vel/2 + vel/4) + RANDOM_RANGE(vel/4)); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(SpriteNum, w); wp->xrepeat = wp->yrepeat = 8 + RANDOM_RANGE(72); @@ -13170,7 +13170,7 @@ int InitSerpRing(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP, np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; short ang, ang_diff, ang_start, ang_finish, missiles, NewSprite; short max_missiles = 16; @@ -13225,7 +13225,7 @@ int InitSerpRing(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP, np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; short ang, ang_diff, ang_start, missiles, New; short max_missiles; @@ -13250,7 +13250,7 @@ InitSerpRing(short SpriteNum) New = SpawnSprite(STAT_SKIP4, SKULL_SERP, &s_SkullRing[0][0], sp->sectnum, sp->x, sp->y, sp->z, ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->xvel = 500; //np->owner = SpriteNum; @@ -13301,7 +13301,7 @@ int InitSerpRing2(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP, np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; short ang, ang_diff, ang_start, ang_finish, missiles, New; short max_missiles; short i; @@ -13329,7 +13329,7 @@ InitSerpRing2(short SpriteNum) New = SpawnSprite(STAT_MISSILE_SKIP4, SKULL_SERP, &s_SkullRing[0][0], sp->sectnum, sp->x, sp->y, sp->z, ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); //np->owner = SpriteNum; SetOwner(SpriteNum, New); @@ -13416,7 +13416,7 @@ InitSpellNapalm(PLAYERp pp) pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), NAPALM_VELOCITY*2); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); sp->hitag = LUMINOUS; //Always full brightness @@ -13477,7 +13477,7 @@ InitEnemyNapalm(short SpriteNum) { short w; SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; short dist; unsigned i; short oclipdist; @@ -13503,7 +13503,7 @@ InitEnemyNapalm(short SpriteNum) sp->x, sp->y, SPRITEp_TOS(sp) + DIV4(SPRITEp_SIZE_Z(sp)), sp->ang, NAPALM_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness if (i==0) // Only attach sound to first projectile @@ -13576,7 +13576,7 @@ InitSpellMirv(PLAYERp pp) pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), MIRV_VELOCITY); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); PlaySound(DIGI_MIRVWIZ, sp, v3df_follow); Set3DSoundOwner(SpriteNum); @@ -13613,7 +13613,7 @@ int InitEnemyMirv(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; short w; int dist; @@ -13623,7 +13623,7 @@ InitEnemyMirv(short SpriteNum) sp->x, sp->y, SPRITEp_TOS(sp) + DIV4(SPRITEp_SIZE_Z(sp)), sp->ang, MIRV_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); PlaySound(DIGI_MIRVWIZ, wp, v3df_follow); Set3DSoundOwner(w); @@ -13659,7 +13659,7 @@ InitEnemyMirv(short SpriteNum) int InitSwordAttack(PLAYERp pp) { - USERp u = User[pp->PlayerSprite],tu; + USERp u = User[pp->PlayerSprite].Data(),tu; SPRITEp sp = NULL; int i; unsigned stat; @@ -13757,7 +13757,7 @@ InitSwordAttack(PLAYERp pp) { extern STATE s_TrashCanPain[]; SPRITEp hsp = &sprite[hitinfo.sprite]; - tu = User[hitinfo.sprite]; + tu = User[hitinfo.sprite].Data(); if (tu) // JBF: added null check switch (tu->ID) @@ -13838,7 +13838,7 @@ InitSwordAttack(PLAYERp pp) int InitFistAttack(PLAYERp pp) { - USERp u = User[pp->PlayerSprite],tu; + USERp u = User[pp->PlayerSprite].Data(),tu; SPRITEp sp = NULL; int i; unsigned stat; @@ -13948,7 +13948,7 @@ InitFistAttack(PLAYERp pp) { extern STATE s_TrashCanPain[]; SPRITEp hsp = &sprite[hitinfo.sprite]; - tu = User[hitinfo.sprite]; + tu = User[hitinfo.sprite].Data(); if (tu) // JBF: added null check switch (tu->ID) @@ -14049,7 +14049,7 @@ InitSumoNapalm(short SpriteNum) { short w; SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; short dist; short i,j,ang; short oclipdist; @@ -14076,7 +14076,7 @@ InitSumoNapalm(short SpriteNum) sp->x, sp->y, SPRITEp_TOS(sp), ang, NAPALM_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness if (i==0) // Only attach sound to first projectile @@ -14134,7 +14134,7 @@ int InitSumoSkull(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP, np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; short New; extern STATE s_SkullExplode[]; @@ -14148,7 +14148,7 @@ InitSumoSkull(short SpriteNum) New = SpawnSprite(STAT_ENEMY, SKULL_R0, &s_SkullWait[0][0], sp->sectnum, sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->xvel = 500; SetOwner(SpriteNum, New); @@ -14189,7 +14189,7 @@ InitSumoSkull(short SpriteNum) int InitSumoStompAttack(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = &sprite[SpriteNum],tsp; int i; unsigned stat; @@ -14232,7 +14232,7 @@ int InitMiniSumoClap(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); int dist; short reach; @@ -14269,8 +14269,8 @@ InitMiniSumoClap(short SpriteNum) int WeaponAutoAim(SPRITEp sp, short Missile, short ang, bool test) { - USERp wu = User[Missile]; - USERp u = User[sp - sprite]; + USERp wu = User[Missile].Data(); + USERp u = User[sp - sprite].Data(); SPRITEp wp = &sprite[Missile]; short hit_sprite = -1; int dist; @@ -14296,7 +14296,7 @@ WeaponAutoAim(SPRITEp sp, short Missile, short ang, bool test) if ((hit_sprite = DoPickTarget(sp, ang, test)) != -1) { SPRITEp hp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); wu->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -14339,8 +14339,8 @@ WeaponAutoAim(SPRITEp sp, short Missile, short ang, bool test) int WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, bool test) { - USERp wu = User[Missile]; - USERp u = User[sp - sprite]; + USERp wu = User[Missile].Data(); + USERp u = User[sp - sprite].Data(); SPRITEp wp = &sprite[Missile]; short hit_sprite = -1; int dist; @@ -14366,7 +14366,7 @@ WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, bool test) if ((hit_sprite = DoPickTarget(sp, ang, test)) != -1) { SPRITEp hp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); wu->WpnGoal = hit_sprite; SET(hu->Flags, SPR_TARGETED); @@ -14410,7 +14410,7 @@ WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, bool test) int AimHitscanToTarget(SPRITEp sp, int *z, short *ang, int z_ratio) { - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); short hit_sprite = -1; int dist; int zh; @@ -14424,7 +14424,7 @@ AimHitscanToTarget(SPRITEp sp, int *z, short *ang, int z_ratio) hit_sprite = u->tgt_sp - sprite; hp = &sprite[hit_sprite]; - hu = User[hit_sprite]; + hu = User[hit_sprite].Data(); SET(hu->Flags, SPR_TARGETED); SET(hu->Flags, SPR_ATTACKED); @@ -14467,7 +14467,7 @@ AimHitscanToTarget(SPRITEp sp, int *z, short *ang, int z_ratio) int WeaponAutoAimHitscan(SPRITEp sp, int *z, short *ang, bool test) { - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); short hit_sprite = -1; int dist; int zh; @@ -14485,7 +14485,7 @@ WeaponAutoAimHitscan(SPRITEp sp, int *z, short *ang, bool test) if ((hit_sprite = DoPickTarget(sp, *ang, test)) != -1) { SPRITEp hp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); SET(hu->Flags, SPR_TARGETED); SET(hu->Flags, SPR_ATTACKED); @@ -14557,7 +14557,7 @@ WeaponHitscanShootFeet(SPRITEp sp, SPRITEp hp, int *zvect) int InitStar(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -14591,7 +14591,7 @@ InitStar(PLAYERp pp) w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), STAR_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //SET(wp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL); SetOwner(pp->PlayerSprite, w); @@ -14638,7 +14638,7 @@ InitStar(PLAYERp pp) { nw = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, NORM_ANGLE(wp->ang + dang[i]), wp->xvel); np = &sprite[nw]; - nu = User[nw]; + nu = User[nw].Data(); SetOwner(wp->owner, nw); np->yrepeat = np->xrepeat = STAR_REPEAT; @@ -14707,7 +14707,7 @@ InitHeartAttack(PLAYERp pp) pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), BLOOD_WORM_VELOCITY*2); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); sp->hitag = LUMINOUS; //Always full brightness @@ -14761,7 +14761,7 @@ InitHeartAttack(PLAYERp pp) USERp u; short i = 0; short oclipdist; - USERp pu = User[pp->PlayerSprite]; + USERp pu = User[pp->PlayerSprite].Data(); typedef struct { @@ -14783,7 +14783,7 @@ InitHeartAttack(PLAYERp pp) pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), BLOOD_WORM_VELOCITY*2); sp = &sprite[SpriteNum]; - u = User[SpriteNum]; + u = User[SpriteNum].Data(); sp->hitag = LUMINOUS; //Always full brightness @@ -14823,7 +14823,7 @@ int ContinueHitscan(PLAYERp pp, short sectnum, int x, int y, int z, short ang, i { short j; hitdata_t hitinfo; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); FAFhitscan(x, y, z, sectnum, xvect, yvect, zvect, @@ -14903,7 +14903,7 @@ int ContinueHitscan(PLAYERp pp, short sectnum, int x, int y, int z, short ang, i int InitShotgun(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short daang,ndaang, i, j; hitdata_t hitinfo; short nsect; @@ -15032,7 +15032,7 @@ InitShotgun(PLAYERp pp) if (hitinfo.sprite >= 0) { SPRITEp hsp = &sprite[hitinfo.sprite]; - USERp hu = User[hitinfo.sprite]; + USERp hu = User[hitinfo.sprite].Data(); if (hu && hu->ID == TRASHCAN) // JBF: added null check { @@ -15079,7 +15079,7 @@ InitShotgun(PLAYERp pp) int InitLaser(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15107,7 +15107,7 @@ InitLaser(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), 300); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness SetOwner(pp->PlayerSprite, w); @@ -15184,7 +15184,7 @@ InitLaser(PLAYERp pp) int InitRail(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15218,7 +15218,7 @@ InitRail(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 52; @@ -15277,7 +15277,7 @@ int InitZillaRail(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15304,7 +15304,7 @@ InitZillaRail(short SpriteNum) nx, ny, nz, sp->ang, 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(SpriteNum, w); wp->yrepeat = 52; @@ -15362,7 +15362,7 @@ InitZillaRail(short SpriteNum) int InitRocket(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15418,7 +15418,7 @@ InitRocket(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = pp->PlayerSprite; SetOwner(pp->PlayerSprite, w); @@ -15496,7 +15496,7 @@ InitRocket(PLAYERp pp) int InitBunnyRocket(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15549,7 +15549,7 @@ InitBunnyRocket(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = pp->PlayerSprite; SetOwner(pp->PlayerSprite, w); @@ -15625,7 +15625,7 @@ InitBunnyRocket(PLAYERp pp) int InitNuke(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15663,7 +15663,7 @@ InitNuke(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), 700); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = pp->PlayerSprite; SetOwner(pp->PlayerSprite, w); @@ -15732,7 +15732,7 @@ int InitEnemyNuke(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -15756,7 +15756,7 @@ InitEnemyNuke(short SpriteNum) nx, ny, nz, sp->ang, 700); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); if (u->ID == ZOMBIE_RUN_R0) SetOwner(sp->owner, w); @@ -15818,7 +15818,7 @@ InitEnemyNuke(short SpriteNum) int InitMicro(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu,hu; SPRITEp wp,hp; int nx, ny, nz, dist; @@ -15848,7 +15848,7 @@ InitMicro(PLAYERp pp) if (ts < &TargetSort[TargetSortCount] && ts->sprite_num >= 0) { hp = &sprite[ts->sprite_num]; - hu = User[ts->sprite_num]; + hu = User[ts->sprite_num].Data(); ang = getangle(hp->x - nx, hp->y - ny); @@ -15871,7 +15871,7 @@ InitMicro(PLAYERp pp) nx, ny, nz, ang, 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 24; @@ -15954,7 +15954,7 @@ InitMicro(PLAYERp pp) int InitRipperSlash(short SpriteNum) { - USERp u = User[SpriteNum], hu; + USERp u = User[SpriteNum].Data(), hu; SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; int i; @@ -15969,7 +15969,7 @@ InitRipperSlash(short SpriteNum) while ((i = it.NextIndex()) >= 0) { hp = &sprite[i]; - hu = User[i]; + hu = User[i].Data(); if (i == SpriteNum) break; @@ -16140,7 +16140,7 @@ DoBladeDamage(short SpriteNum) int DoStaticFlamesDamage(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; int i; @@ -16292,7 +16292,7 @@ InitGoroChop(short SpriteNum) int InitHornetSting(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short HitSprite = NORM_SPRITE(u->ret); DoDamage(HitSprite, SpriteNum); @@ -16305,7 +16305,7 @@ int InitSerpSpell(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; int dist; short New, i; short oclipdist; @@ -16328,7 +16328,7 @@ InitSerpSpell(short SpriteNum) sp->x, sp->y, sp->z, sp->ang, 1500); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->z = SPRITEp_TOS(sp); @@ -16383,7 +16383,7 @@ int SpawnDemonFist(int16_t Weapon) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); SPRITEp exp; USERp eu; short explosion; @@ -16397,7 +16397,7 @@ SpawnDemonFist(int16_t Weapon) sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0); exp = &sprite[explosion]; - eu = User[explosion]; + eu = User[explosion].Data(); exp->hitag = LUMINOUS; //Always full brightness exp->owner = -1; @@ -16422,7 +16422,7 @@ int InitSerpMonstSpell(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], np; - USERp u = User[SpriteNum], nu; + USERp u = User[SpriteNum].Data(), nu; int dist; short New, i; short oclipdist; @@ -16447,7 +16447,7 @@ InitSerpMonstSpell(short SpriteNum) sp->x, sp->y, sp->z, sp->ang, 500); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); nu->spal = np->pal = 25; // Bright Red np->z = SPRITEp_TOS(sp); @@ -16515,7 +16515,7 @@ int InitEnemyRocket(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -16535,7 +16535,7 @@ InitEnemyRocket(short SpriteNum) w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], sp->sectnum, nx, ny, nz-Z(8), u->tgt_sp->ang, NINJA_BOLT_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); // Set default palette wp->pal = wu->spal = 17; // White @@ -16580,7 +16580,7 @@ InitEnemyRocket(short SpriteNum) int InitEnemyRail(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; USERp wu; SPRITEp wp; @@ -16628,7 +16628,7 @@ InitEnemyRail(short SpriteNum) nx, ny, nz, sp->ang, 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); if (u->ID == ZOMBIE_RUN_R0) SetOwner(sp->owner, w); @@ -16677,7 +16677,7 @@ int InitZillaRocket(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w, i; @@ -16714,7 +16714,7 @@ InitZillaRocket(short SpriteNum) w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], sp->sectnum, nx, ny, nz-Z(8), u->tgt_sp->ang, NINJA_BOLT_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(SpriteNum, w); wp->yrepeat = 28; @@ -16765,7 +16765,7 @@ int InitEnemyStar(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -16780,7 +16780,7 @@ InitEnemyStar(short SpriteNum) wp = &sprite[w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, sp->sectnum, nx, ny, nz, u->tgt_sp->ang, NINJA_STAR_VELOCITY)]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -16854,7 +16854,7 @@ int InitEnemyCrossbow(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -16869,7 +16869,7 @@ InitEnemyCrossbow(short SpriteNum) wp = &sprite[w = SpawnSprite(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], sp->sectnum, nx, ny, nz, u->tgt_sp->ang, 800)]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -16949,7 +16949,7 @@ int InitSkelSpell(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -16966,7 +16966,7 @@ InitSkelSpell(short SpriteNum) w = SpawnSprite(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, sp->sectnum, nx, ny, nz, u->tgt_sp->ang, SKEL_ELECTRO_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -16998,7 +16998,7 @@ int InitCoolgFire(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -17019,7 +17019,7 @@ InitCoolgFire(short SpriteNum) nx, ny, nz, u->tgt_sp->ang, COOLG_FIRE_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17062,7 +17062,7 @@ InitCoolgFire(short SpriteNum) int DoCoolgDrip(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); u->Counter += 220; sp->z += u->Counter; @@ -17094,7 +17094,7 @@ InitCoolgDrip(short SpriteNum) nx, ny, nz, sp->ang, 0); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17115,7 +17115,7 @@ int GenerateDrips(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz; short w = 0; @@ -17140,7 +17140,7 @@ GenerateDrips(short SpriteNum) nx, ny, nz, sp->ang, 0); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17162,7 +17162,7 @@ GenerateDrips(short SpriteNum) int InitEelFire(short SpriteNum) { - USERp u = User[SpriteNum], hu; + USERp u = User[SpriteNum].Data(), hu; SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; int i; @@ -17175,7 +17175,7 @@ InitEelFire(short SpriteNum) while ((i = it.NextIndex()) >= 0) { hp = &sprite[i]; - hu = User[i]; + hu = User[i].Data(); if (i == SpriteNum) continue; @@ -17219,7 +17219,7 @@ InitFireballTrap(short SpriteNum) w = SpawnSprite(STAT_MISSILE, FIREBALL, s_Fireball, sp->sectnum, nx, ny, nz, sp->ang, FIREBALL_TRAP_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; wp->hitag = LUMINOUS; //Always full brightness @@ -17257,7 +17257,7 @@ InitBoltTrap(short SpriteNum) w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], sp->sectnum, nx, ny, nz, sp->ang, BOLT_TRAP_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17283,7 +17283,7 @@ int InitEnemyCrossbow(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; int nx, ny, nz, dist, nang; short w; @@ -17298,7 +17298,7 @@ InitEnemyCrossbow(short SpriteNum) wp = &sprite[w = SpawnSprite(STAT_MISSILE, CROSSBOLT, s_CrossBolt, sp->sectnum, nx, ny, nz, u->tgt_sp->ang, 800)]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17337,7 +17337,7 @@ InitSpearTrap(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum], wp; USERp wu; - //USERp u = User[SpriteNum]; + //USERp u = User[SpriteNum].Data(); int nx, ny, nz; short w; //short nang; @@ -17350,7 +17350,7 @@ InitSpearTrap(short SpriteNum) w = SpawnSprite(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], sp->sectnum, nx, ny, nz, sp->ang, 750); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); //wp->owner = SpriteNum; SetOwner(SpriteNum, w); @@ -17403,7 +17403,7 @@ InitTracerUzi(PLAYERp pp) if (pp->cursectnum < 0) return 0; - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp wp; USERp wu; @@ -17426,7 +17426,7 @@ InitTracerUzi(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), TRACER_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness //wp->owner = pp->PlayerSprite; @@ -17484,7 +17484,7 @@ InitTracerUzi(PLAYERp pp) int InitTracerTurret(short SpriteNum, short Operator, fixed_t q16horiz) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp wp; USERp wu; @@ -17503,7 +17503,7 @@ InitTracerTurret(short SpriteNum, short Operator, fixed_t q16horiz) nx, ny, nz, sp->ang, TRACER_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness if (Operator >= 0) @@ -17542,7 +17542,7 @@ InitTracerTurret(short SpriteNum, short Operator, fixed_t q16horiz) int InitTracerAutoTurret(short SpriteNum, short Operator, int xchange, int ychange, int zchange) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp wp; USERp wu; @@ -17561,7 +17561,7 @@ InitTracerAutoTurret(short SpriteNum, short Operator, int xchange, int ychange, nx, ny, nz, sp->ang, TRACER_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness if (Operator >= 0) @@ -17595,7 +17595,7 @@ BulletHitSprite(SPRITEp sp, short hit_sprite, int hit_x, int hit_y, int hit_z, s { vec3_t hit_pos = { hit_x, hit_y, hit_z }; SPRITEp hsp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; + USERp hu = User[hit_sprite].Data(); SPRITEp wp; // USERp wu; short New; @@ -17758,7 +17758,7 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall) int InitUzi(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp wp, hsp; USERp wu; short daang, j; @@ -17893,7 +17893,7 @@ InitUzi(PLAYERp pp) // hit a sprite? if (hitinfo.sprite >= 0) { - USERp hu = User[hitinfo.sprite]; + USERp hu = User[hitinfo.sprite].Data(); hsp = &sprite[hitinfo.sprite]; if (hu) // JBF: added null check @@ -17946,7 +17946,7 @@ InitUzi(PLAYERp pp) j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = UZI_SPARK_REPEAT; wp->yrepeat = UZI_SPARK_REPEAT; @@ -17971,7 +17971,7 @@ InitUzi(PLAYERp pp) int InitEMP(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp wp, hsp=NULL; USERp wu; short daang, j; @@ -18011,7 +18011,7 @@ InitEMP(PLAYERp pp) j = SpawnSprite(STAT_MISSILE, EMP, s_EMPBurst, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wu->WaitTics = SEC(7); wp->shade = -127; @@ -18142,7 +18142,7 @@ InitEMP(PLAYERp pp) int InitTankShell(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp wp; USERp wu; @@ -18155,7 +18155,7 @@ InitTankShell(short SpriteNum, PLAYERp pp) sp->x, sp->y, sp->z, sp->ang, TANK_SHELL_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 8; @@ -18193,10 +18193,10 @@ InitTankShell(short SpriteNum, PLAYERp pp) int InitTurretMicro(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; - USERp pu = User[pp->PlayerSprite]; + USERp pu = User[pp->PlayerSprite].Data(); USERp wu,hu; SPRITEp wp,hp; int nx, ny, nz, dist; @@ -18222,7 +18222,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) if (ts < &TargetSort[TargetSortCount] && ts->sprite_num >= 0) { hp = &sprite[ts->sprite_num]; - hu = User[ts->sprite_num]; + hu = User[ts->sprite_num].Data(); ang = getangle(hp->x - nx, hp->y - ny); @@ -18245,7 +18245,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) nx, ny, nz, ang, 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 24; @@ -18303,7 +18303,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) int InitTurretRocket(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp wp; USERp wu; @@ -18316,7 +18316,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp) sp->x, sp->y, sp->z, sp->ang, ROCKET_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 40; @@ -18351,7 +18351,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp) int InitTurretFireball(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; SPRITEp wp; USERp wu; @@ -18363,7 +18363,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp) sp->x, sp->y, sp->z, sp->ang, FIREBALL_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 40; @@ -18399,7 +18399,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp) int InitTurretRail(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; USERp wu; SPRITEp wp; @@ -18422,7 +18422,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp) nx, ny, nz, sp->ang, 1200); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 52; @@ -18457,7 +18457,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp) int InitTurretLaser(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; USERp wu; SPRITEp wp; @@ -18480,7 +18480,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp) nx, ny, nz, sp->ang, 300); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 52; @@ -18513,7 +18513,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp) int InitSobjMachineGun(short SpriteNum, PLAYERp pp) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = u->SpriteP; short daang; hitdata_t hitinfo; @@ -18757,7 +18757,7 @@ SpawnBoatSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit_sect, hit_x, hit_y, hit_z, hit_ang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = UZI_SPARK_REPEAT + 10; wp->yrepeat = UZI_SPARK_REPEAT + 10; @@ -18778,7 +18778,7 @@ SpawnBoatSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y int SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); short j; SPRITEp wp; USERp wu; @@ -18801,7 +18801,7 @@ SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_ j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit_sect, hit_x, hit_y, hit_z, hit_ang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = wp->yrepeat = 20; SetOwner(pp->PlayerSprite, j); @@ -18842,7 +18842,7 @@ SpawnTurretSparks(/*SPRITEp sp, */short hit_sect, short hit_wall, int hit_x, int j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit_sect, hit_x, hit_y, hit_z, hit_ang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = UZI_SPARK_REPEAT + 10; wp->yrepeat = UZI_SPARK_REPEAT + 10; @@ -18867,7 +18867,7 @@ SpawnShotgunSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hi j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit_sect, hit_x, hit_y, hit_z, hit_ang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = UZI_SPARK_REPEAT; wp->yrepeat = UZI_SPARK_REPEAT; @@ -19067,7 +19067,7 @@ int InitEnemyUzi(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP,wp; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; short daang, j; hitdata_t hitinfo = { { -2, -2, -2 }, -2, -2, -2 }; @@ -19201,7 +19201,7 @@ InitEnemyUzi(short SpriteNum) j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); wp = &sprite[j]; - wu = User[j]; + wu = User[j].Data(); wp->shade = -40; wp->xrepeat = UZI_SPARK_REPEAT; wp->yrepeat = UZI_SPARK_REPEAT; @@ -19226,7 +19226,7 @@ InitEnemyUzi(short SpriteNum) int InitGrenade(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -19258,7 +19258,7 @@ InitGrenade(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), GRENADE_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); // don't throw it as far if crawling if (TEST(pp->Flags, PF_CRAWLING)) @@ -19337,7 +19337,7 @@ int InitSpriteGrenade(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -19356,7 +19356,7 @@ InitSpriteGrenade(short SpriteNum) nx, ny, nz, sp->ang, GRENADE_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wu->RotNum = 5; NewStateGroup(w, &sg_Grenade[0]); @@ -19402,7 +19402,7 @@ InitSpriteGrenade(short SpriteNum) int InitMine(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -19427,7 +19427,7 @@ InitMine(PLAYERp pp) nx, ny, nz, pp->angle.ang.asbuild(), MINE_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(pp->PlayerSprite, w); wp->yrepeat = 32; @@ -19472,7 +19472,7 @@ int InitEnemyMine(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); USERp wu; SPRITEp wp; int nx, ny, nz; @@ -19491,7 +19491,7 @@ InitEnemyMine(short SpriteNum) nx, ny, nz, sp->ang, MINE_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); SetOwner(SpriteNum, w); wp->yrepeat = 32; @@ -19528,7 +19528,7 @@ int HelpMissileLateral(int16_t Weapon, int dist) { SPRITEp sp = &sprite[Weapon]; - USERp u = User[Weapon]; + USERp u = User[Weapon].Data(); int xchange, ychange; short old_xvel; short old_clipdist; @@ -19560,7 +19560,7 @@ HelpMissileLateral(int16_t Weapon, int dist) int InitFireball(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u = User[pp->PlayerSprite].Data(); SPRITEp wp; int nx = 0, ny = 0, nz; short w; @@ -19585,7 +19585,7 @@ InitFireball(PLAYERp pp) w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), FIREBALL_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness wp->xrepeat = 40; @@ -19643,7 +19643,7 @@ int InitEnemyFireball(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP, fp = NULL; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp wp; int nz, dist; int size_z; @@ -19679,7 +19679,7 @@ InitEnemyFireball(short SpriteNum) sp->x, sp->y, nz, sp->ang, GORO_FIREBALL_VELOCITY); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); wp->hitag = LUMINOUS; //Always full brightness wp->xrepeat = 20; @@ -19885,7 +19885,7 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) bool SpriteWarpToUnderwater(SPRITEp sp) { - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); int i; SECT_USERp sectu = SectUser[sp->sectnum]; SPRITEp under_sp = NULL, over_sp = NULL; @@ -19963,7 +19963,7 @@ SpriteWarpToUnderwater(SPRITEp sp) bool SpriteWarpToSurface(SPRITEp sp) { - USERp u = User[sp - sprite]; + USERp u = User[sp - sprite].Data(); int i; SECT_USERp sectu = SectUser[sp->sectnum]; short over, under; @@ -20047,7 +20047,7 @@ SpriteWarpToSurface(SPRITEp sp) int SpawnSplash(short SpriteNum) { - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; SPRITEp sp = User[SpriteNum]->SpriteP, wp; short w; @@ -20070,7 +20070,7 @@ SpawnSplash(short SpriteNum) w = SpawnSprite(STAT_MISSILE, SPLASH, s_Splash, sp->sectnum, sp->x, sp->y, u->loz, sp->ang, 0); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); if (sectu && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) wu->spal = wp->pal = PALETTE_RED_LIGHTING; @@ -20107,7 +20107,7 @@ SpawnSplashXY(int hit_x, int hit_y, int hit_z, short sectnum) w = SpawnSprite(STAT_MISSILE, SPLASH, s_Splash, sectnum, hit_x, hit_y, hit_z, 0, 0); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); if (sectu && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) wu->spal = wp->pal = PALETTE_RED_LIGHTING; @@ -20122,7 +20122,7 @@ SpawnSplashXY(int hit_x, int hit_y, int hit_z, short sectnum) int SpawnUnderSplash(short SpriteNum) { - USERp u = User[SpriteNum], wu; + USERp u = User[SpriteNum].Data(), wu; SPRITEp sp = User[SpriteNum]->SpriteP, wp; short w; @@ -20142,7 +20142,7 @@ SpawnUnderSplash(short SpriteNum) w = SpawnSprite(STAT_MISSILE, SPLASH, s_Splash, sp->sectnum, sp->x, sp->y, u->hiz, sp->ang, 0); wp = &sprite[w]; - wu = User[w]; + wu = User[w].Data(); if (sectu && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA) wu->spal = wp->pal = PALETTE_RED_LIGHTING; @@ -20158,7 +20158,7 @@ SpawnUnderSplash(short SpriteNum) bool MissileHitDiveArea(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; // correctly set underwater bit for missiles @@ -20233,7 +20233,7 @@ SpawnBubble(short SpriteNum) b = SpawnSprite(STAT_MISSILE, BUBBLE, s_Bubble, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); bp = &sprite[b]; - bu = User[b]; + bu = User[b].Data(); //PlaySound(DIGI_BUBBLES, sp, v3df_none); @@ -20258,7 +20258,7 @@ int DoVehicleSmoke(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->z -= sp->zvel; @@ -20293,7 +20293,7 @@ SpawnVehicleSmoke(short SpriteNum) sp->x, sp->y, sp->z - RANDOM_P2(Z(8)), sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); nu->WaitTics = 1*120; np->shade = -40; @@ -20327,7 +20327,7 @@ SpawnSmokePuff(short SpriteNum) sp->x, sp->y, sp->z - RANDOM_P2(Z(8)), sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); nu->WaitTics = 1*120; np->shade = -40; @@ -20356,7 +20356,7 @@ int DoBubble(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); sp->z -= sp->zvel; sp->zvel += 32; @@ -20489,7 +20489,7 @@ bool TestDontStick(short SpriteNum, short hit_wall) if (hit_wall < 0) { ASSERT(SpriteNum>=0); - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); hit_wall = NORM_WALL(u->ret); } @@ -20528,10 +20528,7 @@ int QueueStar(short SpriteNum) if (StarQueue[StarQueueHead] == -1) { // new star - if (User[SpriteNum]) - { - FreeUser(SpriteNum); - } + User[SpriteNum].Clear(); change_sprite_stat(SpriteNum, STAT_STAR_QUEUE); StarQueue[StarQueueHead] = SpriteNum; } @@ -20622,7 +20619,7 @@ int QueueFloorBlood(short hit_sprite) SPRITEp hsp = &sprite[hit_sprite]; short SpriteNum; SPRITEp sp; - USERp u = User[hit_sprite]; + USERp u = User[hit_sprite].Data(); SECTORp sectp = §or[hsp->sectnum]; @@ -20696,7 +20693,7 @@ int QueueFootPrint(short hit_sprite) SPRITEp hsp = &sprite[hit_sprite]; short SpriteNum; SPRITEp sp; - USERp u = User[hit_sprite]; + USERp u = User[hit_sprite].Data(); USERp nu; short rnd_num=0; bool Found=false; @@ -20754,7 +20751,7 @@ int QueueFootPrint(short hit_sprite) sp = &sprite[SpriteNum]; - nu = User[SpriteNum]; + nu = User[SpriteNum].Data(); sp->hitag = 0; sp->owner = -1; sp->xrepeat = 48; @@ -20826,7 +20823,7 @@ int QueueWallBlood(short hit_sprite, short ang) short rndnum; int daz; hitdata_t hitinfo; - USERp u = User[hit_sprite]; + USERp u = User[hit_sprite].Data(); if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || SpriteInDiveArea(hsp)) @@ -21044,10 +21041,7 @@ int QueueGeneric(short SpriteNum, short pic) // can and should kill the user portion if (GenericQueue[GenericQueueHead] == -1) { - if (User[SpriteNum]) - { - FreeUser(SpriteNum); - } + User[SpriteNum].Clear(); change_sprite_stat(SpriteNum, STAT_GENERIC_QUEUE); GenericQueue[GenericQueueHead] = SpriteNum; } @@ -21103,7 +21097,7 @@ int DoShellShrap(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); // If the shell doesn't fall in the allowable range, kill it. if (u->ShellNum < (ShellCount-MAXSHELLS)) @@ -21148,7 +21142,7 @@ int DoShrapVelocity(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(sp)) { @@ -21319,7 +21313,7 @@ int ShrapKillSprite(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short rnd_num; rnd_num = RANDOM_RANGE(1024); @@ -21487,7 +21481,7 @@ int DoItemFly(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (TEST(u->Flags, SPR_UNDERWATER)) { @@ -21616,7 +21610,7 @@ int QueueLoWangs(short SpriteNum) // Point passed in sprite to ps ps = sp; sp = &sprite[NewSprite]; - u = User[NewSprite]; + u = User[NewSprite].Data(); ASSERT(sp); sp->owner = -1; sp->cstat = 0; diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index 65d12a03b..37e234bb0 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -649,12 +649,12 @@ SetupZilla(short SpriteNum) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) { - u = User[SpriteNum]; + u = User[SpriteNum].Data(); ASSERT(u); } else { - User[SpriteNum] = u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]); + u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]); u->Health = 6000; } @@ -680,7 +680,7 @@ SetupZilla(short SpriteNum) int NullZilla(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); SPRITEp sp = User[SpriteNum]->SpriteP; //if (TEST(u->Flags,SPR_SLIDING)) @@ -713,7 +713,7 @@ int NullZilla(short SpriteNum) int DoZillaMove(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); short choose; //if (TEST(u->Flags,SPR_SLIDING)) @@ -763,7 +763,7 @@ extern int SpawnGrenadeExp(int16_t Weapon); int DoZillaDeathMelt(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (RANDOM_RANGE(1000) > 800) SpawnGrenadeExp(SpriteNum); diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 454e3e5b5..ca003308b 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -752,7 +752,7 @@ int SetupZombie(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); ANIMATOR DoActorDecide; u->Health = 100; @@ -790,7 +790,7 @@ SpawnZombie(PLAYERp pp, short Weapon) New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); np->sectnum = pp->cursectnum; np->owner = owner; np->pal = nu->spal = User[owner]->spal; @@ -853,7 +853,7 @@ SpawnZombie2(short Weapon) //Zombies++; New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); np = &sprite[New]; - nu = User[New]; + nu = User[New].Data(); nu->Counter3 = 0; np->owner = owner; np->pal = nu->spal = User[owner]->spal; @@ -882,7 +882,7 @@ SpawnZombie2(short Weapon) int DoZombieMove(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) { @@ -893,7 +893,7 @@ DoZombieMove(short SpriteNum) return 0; } - if (u->tgt_sp && User[u->tgt_sp-sprite] && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) // JBF: added User[] null check + if (u->tgt_sp && User[u->tgt_sp-sprite].Data() && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) // JBF: added User[] null check DoActorPickClosePlayer(SpriteNum); // jumping and falling @@ -932,7 +932,7 @@ DoZombieMove(short SpriteNum) int NullZombie(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) { @@ -943,7 +943,7 @@ NullZombie(short SpriteNum) return 0; } - if (u->tgt_sp && User[u->tgt_sp-sprite] && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) + if (u->tgt_sp && User[u->tgt_sp-sprite].Data() && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) DoActorPickClosePlayer(SpriteNum); if (u->WaitTics > 0) @@ -963,7 +963,7 @@ NullZombie(short SpriteNum) int DoZombiePain(short SpriteNum) { - USERp u = User[SpriteNum]; + USERp u = User[SpriteNum].Data(); NullZombie(SpriteNum);