diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 8236f7db6..78a079c04 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1023,9 +1023,9 @@ FString GameInterface::GetCoordString() { PLAYER* pp = Player + myconnectindex; FString out; - out.AppendFormat("POSX:%d ", pp->__int_ppos.X); - out.AppendFormat("POSY:%d ", pp->__int_ppos.Y); - out.AppendFormat("POSZ:%d ", pp->__int_ppos.Z); + out.AppendFormat("POSX:%d ", pp->int_ppos().X); + out.AppendFormat("POSY:%d ", pp->int_ppos().Y); + out.AppendFormat("POSZ:%d ", pp->int_ppos().Z); out.AppendFormat("ANG:%d\n", pp->angle.ang.Buildang()); return out; @@ -1383,9 +1383,9 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) else camerapp = pp; - tx = interpolatedvalue(camerapp->__int_popos.X, camerapp->__int_ppos.X, sr); - ty = interpolatedvalue(camerapp->__int_popos.Y, camerapp->__int_ppos.Y, sr); - tz = interpolatedvalue(camerapp->__int_popos.Z, camerapp->__int_ppos.Z, sr); + tx = interpolatedvalue(camerapp->__int_popos.X, camerapp->int_ppos().X, sr); + ty = interpolatedvalue(camerapp->__int_popos.Y, camerapp->int_ppos().Y, sr); + tz = interpolatedvalue(camerapp->__int_popos.Z, camerapp->int_ppos().Z, sr); // Interpolate the player's angle while on a sector object, just like VoidSW. // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 567b274fb..8d0008766 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -403,7 +403,9 @@ void InitLevel(MapRecord *maprec) currentLevel = maprec; int cursect; SpawnSpriteDef sprites; - loadMap(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].__int_ppos, &ang, &cursect, sprites); + vec3_t ppos; + loadMap(maprec->fileName, SW_SHAREWARE ? 1 : 0, &ppos, &ang, &cursect, sprites); + Player[0].__int_ppos = ppos; spawnactors(sprites); Player[0].cursector = §or[cursect]; diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 4c145a5b1..f05d37c63 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -429,8 +429,8 @@ JS_ProcessEchoSpot() { dist = 0x7fffffff; - j = abs(actor->int_pos().X - pp->__int_ppos.X); - j += abs(actor->int_pos().Y - pp->__int_ppos.Y); + j = abs(actor->int_pos().X - pp->int_ppos().X); + j += abs(actor->int_pos().Y - pp->int_ppos().Y); if (j < dist) dist = j; @@ -626,7 +626,7 @@ void JS_DrawCameras(PLAYER* pp, int tx, int ty, int tz, double smoothratio) if (TEST_BOOL11(camactor) && numplayers > 1) { - drawroomstotile(cp->__int_ppos.X, cp->__int_ppos.Y, cp->__int_ppos.Z, cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio); + drawroomstotile(cp->int_ppos().X, cp->int_ppos().Y, cp->int_ppos().Z, cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio); } else { diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index a874ac5c7..e8b091299 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -277,7 +277,7 @@ short RectClipTurn(PLAYER* pp, short new_ang, int *qx, int *qy, int *ox, int *oy for (i = 0; i < 4; i++) { vec2_t const p = { ox[i], oy[i] }; - rotatepoint(pp->__int_ppos.vec2, p, rot_ang, &xy[i]); + rotatepoint(pp->int_ppos().vec2, p, rot_ang, &xy[i]); // cannot use sop->xmid and ymid because the SO is off the map at this point //rotatepoint(&sop->xmid, p, rot_ang, &xy[i]); } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index e68369159..42ec0c8b8 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1186,7 +1186,7 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets continue; if (actor->hasU() && actor->user.PlayerP) - zh = actor->user.PlayerP->__int_ppos.Z; + zh = actor->user.PlayerP->int_ppos().Z; else zh = ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); @@ -1954,10 +1954,10 @@ void PlayerSectorBound(PLAYER* pp, int amt) getzsofslopeptr(pp->cursector, pp->int_ppos().X, pp->int_ppos().Y, &cz, &fz); - if (pp->__int_ppos.Z > fz - amt) + if (pp->int_ppos().Z > fz - amt) pp->__int_ppos.Z = fz - amt; - if (pp->__int_ppos.Z < cz + amt) + if (pp->int_ppos().Z < cz + amt) pp->__int_ppos.Z = cz + amt; } @@ -2121,18 +2121,18 @@ void DoPlayerMove(PLAYER* pp) { if (pp->Flags & (PF_FLYING|PF_JUMPING|PF_FALLING)) { - if (pp->__int_ppos.Z > pp->loz) + if (pp->int_ppos().Z > pp->loz) pp->__int_ppos.Z = pp->loz - PLAYER_HEIGHT; - if (pp->__int_ppos.Z < pp->hiz) + if (pp->int_ppos().Z < pp->hiz) pp->__int_ppos.Z = pp->hiz + PLAYER_HEIGHT; } else if (pp->Flags & (PF_SWIMMING|PF_DIVING)) { - if (pp->__int_ppos.Z > pp->loz) + if (pp->int_ppos().Z > pp->loz) pp->__int_ppos.Z = pp->loz - PLAYER_SWIM_HEIGHT; - if (pp->__int_ppos.Z < pp->hiz) + if (pp->int_ppos().Z < pp->hiz) pp->__int_ppos.Z = pp->hiz + PLAYER_SWIM_HEIGHT; } } @@ -2186,10 +2186,10 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp) // adjust the posz to be in a sector getzsofslopeptr(pp->cursector, pp->int_ppos().X, pp->int_ppos().Y, &cz, &fz); - if (pp->__int_ppos.Z > fz) + if (pp->int_ppos().Z > fz) pp->__int_ppos.Z = fz; - if (pp->__int_ppos.Z < cz) + if (pp->int_ppos().Z < cz) pp->__int_ppos.Z = cz; // try again @@ -3243,7 +3243,7 @@ void DoPlayerClimb(PLAYER* pp) // if floor is ABOVE you && your head goes above it, do a jump up to // terrace - if (pp->__int_ppos.Z < pp->LadderSector->int_floorz() - Z(6)) + if (pp->int_ppos().Z < pp->LadderSector->int_floorz() - Z(6)) { pp->jump_speed = PLAYER_CLIMB_JUMP_AMT; pp->Flags &= ~(PF_CLIMBING|PF_WEAPON_DOWN); @@ -3316,7 +3316,7 @@ void DoPlayerClimb(PLAYER* pp) HitInfo near; // constantly look for new ladder sector because of warping at any time - neartag(pp->__int_ppos, pp->cursector, pp->angle.ang.Buildang(), near, 800, NTAG_SEARCH_LO_HI); + neartag(pp->int_ppos(), pp->cursector, pp->angle.ang.Buildang(), near, 800, NTAG_SEARCH_LO_HI); if (near.hitWall) { @@ -3364,7 +3364,7 @@ int DoPlayerWadeSuperJump(PLAYER* pp) { hit.hitSector = hit.hitWall->nextSector(); - if (hit.hitSector != nullptr && labs(hit.hitSector->int_floorz() - pp->__int_ppos.Z) < Z(50)) + if (hit.hitSector != nullptr && labs(hit.hitSector->int_floorz() - pp->int_ppos().Z) < Z(50)) { if (Distance(pp->int_ppos().X, pp->int_ppos().Y, hit.int_hitpos().X, hit.int_hitpos().Y) < ((((int)pp->actor->spr.clipdist)<<2) + 256)) return true; @@ -3539,7 +3539,7 @@ void PlayerWarpUpdatePos(PLAYER* pp) bool PlayerCeilingHit(PLAYER* pp, int zlimit) { - if (pp->__int_ppos.Z < zlimit) + if (pp->int_ppos().Z < zlimit) { return true; } @@ -3549,7 +3549,7 @@ bool PlayerCeilingHit(PLAYER* pp, int zlimit) bool PlayerFloorHit(PLAYER* pp, int zlimit) { - if (pp->__int_ppos.Z > zlimit) + if (pp->int_ppos().Z > zlimit) { return true; } @@ -3654,7 +3654,7 @@ bool PlayerOnLadder(PLAYER* pp) if (Prediction) return false; - neartag(pp->__int_ppos, pp->cursector, pp->angle.ang.Buildang(), near, 1024 + 768, NTAG_SEARCH_LO_HI); + neartag(pp->int_ppos(), pp->cursector, pp->angle.ang.Buildang(), near, 1024 + 768, NTAG_SEARCH_LO_HI); dir = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14)); @@ -3666,7 +3666,7 @@ bool PlayerOnLadder(PLAYER* pp) for (i = 0; i < SIZ(angles); i++) { - neartag(pp->__int_ppos, pp->cursector, NORM_ANGLE(pp->angle.ang.Buildang() + angles[i]), near, 600, NTAG_SEARCH_LO_HI); + neartag(pp->int_ppos(), pp->cursector, NORM_ANGLE(pp->angle.ang.Buildang() + angles[i]), near, 600, NTAG_SEARCH_LO_HI); if (near.hitWall == nullptr || near.int_hitpos().X < 100 || near.hitWall->lotag != TAG_WALL_CLIMB) return false; @@ -3768,7 +3768,7 @@ int PlayerCanDive(PLAYER* pp) pp->z_speed = Z(20); pp->jump_speed = 0; - if (pp->__int_ppos.Z > pp->loz - Z(pp->WadeDepth) - Z(2)) + if (pp->int_ppos().Z > pp->loz - Z(pp->WadeDepth) - Z(2)) { DoPlayerBeginDive(pp); } @@ -4396,7 +4396,7 @@ void DoPlayerDive(PLAYER* pp) if (pp->z_speed < 0 && FAF_ConnectArea(pp->cursector)) { - if (pp->__int_ppos.Z < pp->cursector->int_ceilingz() + Z(10)) + if (pp->int_ppos().Z < pp->cursector->int_ceilingz() + Z(10)) { auto sect = pp->cursector; @@ -4422,7 +4422,7 @@ void DoPlayerDive(PLAYER* pp) if (sectu && (sectu->number == 0 || (sectu->flags & SECTFU_CANT_SURFACE))) { // for room over room water the hiz will be the top rooms ceiling - if (pp->__int_ppos.Z < pp->hiz + pp->ceiling_dist) + if (pp->int_ppos().Z < pp->hiz + pp->ceiling_dist) { pp->__int_ppos.Z = pp->hiz + pp->ceiling_dist; } @@ -4433,7 +4433,7 @@ void DoPlayerDive(PLAYER* pp) // !JIM! FRANK - I added !pp->hiActor so that you don't warp to surface when // there is a sprite above you since getzrange returns a hiz < ceiling height // if you are clipping into a sprite and not the ceiling. - if (pp->__int_ppos.Z < pp->hiz + Z(4) && !pp->highActor) + if (pp->int_ppos().Z < pp->hiz + Z(4) && !pp->highActor) { DoPlayerStopDive(pp); return; @@ -4441,7 +4441,7 @@ void DoPlayerDive(PLAYER* pp) } // Only get so close to the floor - if (pp->__int_ppos.Z >= pp->loz - PLAYER_DIVE_HEIGHT) + if (pp->int_ppos().Z >= pp->loz - PLAYER_DIVE_HEIGHT) { pp->__int_ppos.Z = pp->loz - PLAYER_DIVE_HEIGHT; } @@ -5100,7 +5100,7 @@ void DoPlayerStopOperate(PLAYER* pp) if (TEST_BOOL1(rsp)) pp->angle.ang = pp->angle.oang = rsp->spr.angle; else - pp->angle.ang = pp->angle.oang = VecToAngle(pp->sop_remote->int_pmid().X - pp->int_ppos().X, pp->sop_remote->int_pmid().Y - pp->__int_ppos.Y); + pp->angle.ang = pp->angle.oang = VecToAngle(pp->sop_remote->int_pmid().X - pp->int_ppos().X, pp->sop_remote->int_pmid().Y - pp->int_ppos().Y); } if (pp->sop_control) @@ -5904,7 +5904,7 @@ void DoPlayerDeathMoveHead(PLAYER* pp) ChangeActorSect(pp->actor, pp->lv_sector); pp->__int_ppos.X = pp->lv.X; pp->__int_ppos.Y = pp->lv.Y; - plActor->set_int_xy(pp->int_ppos().X, pp->__int_ppos.Y); + plActor->set_int_xy(pp->int_ppos().X, pp->int_ppos().Y); } else { @@ -5975,7 +5975,7 @@ void DoPlayerDeathDrown(PLAYER* pp) actor->add_int_z(Z(4)); // Stick like glue when you hit the ground - if (pp->__int_ppos.Z > pp->loz - PLAYER_DEATH_HEIGHT) + if (pp->int_ppos().Z > pp->loz - PLAYER_DEATH_HEIGHT) { pp->__int_ppos.Z = pp->loz - PLAYER_DEATH_HEIGHT; pp->Flags &= ~(PF_FALLING); @@ -6065,7 +6065,7 @@ void DoPlayerDeathCrumble(PLAYER* pp) } DoPlayerDeathCheckKeys(pp); - plActor->set_int_z(pp->__int_ppos.Z+PLAYER_DEAD_HEAD_FLOORZ_OFFSET); + plActor->set_int_z(pp->int_ppos().Z + PLAYER_DEAD_HEAD_FLOORZ_OFFSET); DoPlayerHeadDebris(pp); } @@ -6118,7 +6118,7 @@ void DoPlayerDeathExplode(PLAYER* pp) } DoPlayerDeathCheckKeys(pp); - plActor->set_int_z(pp->__int_ppos.Z+PLAYER_DEAD_HEAD_FLOORZ_OFFSET); + plActor->set_int_z(pp->int_ppos().Z + PLAYER_DEAD_HEAD_FLOORZ_OFFSET); DoPlayerHeadDebris(pp); } @@ -6618,8 +6618,8 @@ void domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - int deltax = Player[myconnectindex].__int_ppos.X - Player[screenpeek].__int_ppos.X; - int deltay = Player[myconnectindex].__int_ppos.Y - Player[screenpeek].__int_ppos.Y; + int deltax = Player[myconnectindex].int_ppos().X - Player[screenpeek].int_ppos().X; + int deltay = Player[myconnectindex].int_ppos().Y - Player[screenpeek].int_ppos().Y; Player[screenpeek].angle.settarget(VecToAngle(deltax, deltay)); } @@ -6759,7 +6759,7 @@ int SearchSpawnPosition(PLAYER* pp) if (opp != pp) // don't test for yourself { - if (FindDistance3D(spawn_sprite->int_pos() - opp->__int_ppos) < 1000) + if (FindDistance3D(spawn_sprite->int_pos() - opp->int_ppos()) < 1000) { blocked = true; break; @@ -6843,7 +6843,7 @@ void PlayerSpawnPosition(PLAYER* pp) getzsofslopeptr(pp->cursector, pp->int_ppos().X, pp->int_ppos().Y, &cz, &fz); // if too close to the floor - stand up - if (pp->__int_ppos.Z > fz - PLAYER_HEIGHT) + if (pp->int_ppos().Z > fz - PLAYER_HEIGHT) { pp->__int_ppos.Z = pp->__int_popos.Z = fz - PLAYER_HEIGHT; } diff --git a/source/games/sw/src/quake.cpp b/source/games/sw/src/quake.cpp index 4ec22e26b..6e88a6c69 100644 --- a/source/games/sw/src/quake.cpp +++ b/source/games/sw/src/quake.cpp @@ -172,7 +172,7 @@ void QuakeViewChange(PLAYER* pp, int *z_diff, int *x_diff, int *y_diff, short *a SWStatIterator it(STAT_QUAKE_ON); while ((actor = it.Next())) { - dist = FindDistance3D(pp->__int_ppos - actor->int_pos()); + dist = FindDistance3D(pp->int_ppos() - actor->int_pos()); // shake whole level if (QUAKE_TestDontTaper(actor)) diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 9912521e8..6dc69568e 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -1842,7 +1842,7 @@ void OperateTripTrigger(PLAYER* pp) { if (actor->user.Flags & (SPR_WAIT_FOR_TRIGGER)) { - if (Distance(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->__int_ppos.Y) < dist) + if (Distance(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->int_ppos().Y) < dist) { actor->user.targetActor = pp->actor; actor->user.Flags &= ~(SPR_WAIT_FOR_TRIGGER); @@ -1939,7 +1939,7 @@ bool NearThings(PLAYER* pp) return false; } - neartag(pp->__int_ppos, pp->cursector, pp->angle.ang.Buildang(), near, 1024, NTAG_SEARCH_LO_HI); + neartag(pp->int_ppos(), pp->cursector, pp->angle.ang.Buildang(), near, 1024, NTAG_SEARCH_LO_HI); // hit a sprite? Check to see if it has sound info in it! @@ -1982,7 +1982,7 @@ bool NearThings(PLAYER* pp) if (hit.hitSector == nullptr) return false; - if (Distance(hit.int_hitpos().X, hit.int_hitpos().Y, pp->int_ppos().X, pp->__int_ppos.Y) > 1500) + if (Distance(hit.int_hitpos().X, hit.int_hitpos().Y, pp->int_ppos().X, pp->int_ppos().Y) > 1500) return false; // hit a sprite? diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index f47993a9a..eca3fd0bb 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -122,9 +122,9 @@ short SoundDist(int x, int y, int z, int basedist) double sqrdist, retval; extern short screenpeek; - tx = fabs(Player[screenpeek].__int_ppos.X - x); - ty = fabs(Player[screenpeek].__int_ppos.Y - y); - tz = fabs((Player[screenpeek].__int_ppos.Z - z) >> 4); + tx = fabs(Player[screenpeek].int_ppos().X - x); + ty = fabs(Player[screenpeek].int_ppos().Y - y); + tz = fabs((Player[screenpeek].int_ppos().Z - z) >> 4); // Use the Pythagreon Theorem to compute the magnitude of a 3D vector sqrdist = fabs(tx * tx + ty * ty + tz * tz); @@ -519,7 +519,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], if (pos != nullptr) { PLAYER* pp = Player + screenpeek; - FVector3 campos = GetSoundPos(pp->__int_ppos); + FVector3 campos = GetSoundPos(pp->int_ppos()); vec3_t vpos = {}; bool pancheck = false; @@ -533,7 +533,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], } else if (type == SOURCE_Actor || type == SOURCE_Player) { - vpos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.int_pos() : ((PLAYER*)source)->__int_ppos; + vpos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.int_pos() : ((PLAYER*)source)->int_ppos(); pancheck = true; FVector3 npos = GetSoundPos(vpos); @@ -605,13 +605,13 @@ void GameInterface::UpdateSounds(void) if (TEST_BOOL1(rsp)) tang = rsp->spr.angle; else - tang = VecToAngle(pp->sop_remote->int_pmid().X - pp->int_ppos().X, pp->sop_remote->int_pmid().Y - pp->__int_ppos.Y); + tang = VecToAngle(pp->sop_remote->int_pmid().X - pp->int_ppos().X, pp->sop_remote->int_pmid().Y - pp->int_ppos().Y); } else tang = pp->angle.ang; listener.angle = float(-tang.Radians()); listener.velocity.Zero(); - listener.position = GetSoundPos(pp->__int_ppos); + listener.position = GetSoundPos(pp->int_ppos()); listener.underwater = false; // This should probably use a real environment instead of the pitch hacking in S_PlaySound3D. // listenactor->waterlevel == 3; @@ -654,7 +654,7 @@ int _PlaySound(int num, DSWActor* actor, PLAYER* pp, const vec3_t* const ppos, i } else if (pp && !ppos) { - pos = pp->__int_ppos; + pos = pp->int_ppos(); pp = nullptr; } } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 9c4a61d3d..3dc40ff4b 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -3404,7 +3404,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics) { pp = &Player[pnum]; - if (Distance(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->__int_ppos.Y) < actor->user.Dist) + if (Distance(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->int_ppos().Y) < actor->user.Dist) { actor->user.targetActor = pp->actor; actor->user.Flags &= ~(SPR_WAIT_FOR_PLAYER); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 1a446a8c2..b3629e519 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11875,7 +11875,7 @@ int InitSwordAttack(PLAYER* pp) if (hit.hitSector == nullptr) return 0; - if (FindDistance3D(pp->__int_ppos - hit.int_hitpos()) < 700) + if (FindDistance3D(pp->int_ppos() - hit.int_hitpos()) < 700) { if (hit.actor() != nullptr) @@ -12056,7 +12056,7 @@ int InitFistAttack(PLAYER* pp) if (hit.hitSector == nullptr) return 0; - if (FindDistance3D(pp->__int_ppos - hit.int_hitpos()) < 700) + if (FindDistance3D(pp->int_ppos() - hit.int_hitpos()) < 700) { if (hit.actor() != nullptr) diff --git a/source/games/sw/src/weapon.h b/source/games/sw/src/weapon.h index ac4d9eab9..a374731b8 100644 --- a/source/games/sw/src/weapon.h +++ b/source/games/sw/src/weapon.h @@ -39,7 +39,7 @@ inline int AngToSprite(DSWActor* actor, DSWActor* other) inline int AngToPlayer(PLAYER* player, DSWActor* other) { - return (getangle(player->__int_ppos.X - other->int_pos().X, player->__int_ppos.Y - other->int_pos().Y)); + return (getangle(player->int_ppos().X - other->int_pos().X, player->int_ppos().Y - other->int_pos().Y)); }