From 30b57fd7b04c478490bf74f47bdc994d0d4ecfda Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Mar 2016 09:28:00 +0100 Subject: [PATCH] - floatification of G_CheckSpot and a few other things. --- src/files.h | 8 ++++---- src/g_game.cpp | 32 ++++++++++++++------------------ src/g_level.cpp | 2 +- src/gi.cpp | 9 +-------- src/gi.h | 2 +- src/p_3dfloors.cpp | 28 ++++++++-------------------- src/p_mobj.cpp | 3 +-- 7 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/files.h b/src/files.h index c417afa09..5889eb6fe 100644 --- a/src/files.h +++ b/src/files.h @@ -46,7 +46,7 @@ public: return *this; } - FileReaderBase &operator>> (fixed_t &v) + FileReaderBase &operator>> (int &v) { Read (&v, 4); v = LittleLong(v); @@ -171,7 +171,7 @@ public: return *this; } - FileReaderZ &operator>> (fixed_t &v) + FileReaderZ &operator>> (int &v) { Read (&v, 4); v = LittleLong(v); @@ -233,7 +233,7 @@ public: return *this; } - FileReaderBZ2 &operator>> (fixed_t &v) + FileReaderBZ2 &operator>> (int &v) { Read (&v, 4); v = LittleLong(v); @@ -297,7 +297,7 @@ public: return *this; } - FileReaderLZMA &operator>> (fixed_t &v) + FileReaderLZMA &operator>> (int &v) { Read (&v, 4); v = LittleLong(v); diff --git a/src/g_game.cpp b/src/g_game.cpp index 2bf490bd2..2334c1ec1 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -197,9 +197,9 @@ short consistancy[MAXPLAYERS][BACKUPTICS]; float normforwardmove[2] = {0x19, 0x32}; // [RH] For setting turbo from console float normsidemove[2] = {0x18, 0x28}; // [RH] Ditto -fixed_t forwardmove[2], sidemove[2]; -fixed_t angleturn[4] = {640, 1280, 320, 320}; // + slow turn -fixed_t flyspeed[2] = {1*256, 3*256}; +int forwardmove[2], sidemove[2]; +int angleturn[4] = {640, 1280, 320, 320}; // + slow turn +int flyspeed[2] = {1*256, 3*256}; int lookspeed[2] = {450, 512}; #define SLOWTURNTICS 6 @@ -1182,8 +1182,7 @@ void G_Ticker () } if (players[i].mo) { - DWORD sum = rngsum + players[i].mo->_f_X() + players[i].mo->_f_Y() + players[i].mo->_f_Z() - + players[i].mo->_f_angle() + players[i].mo->_f_pitch(); + DWORD sum = rngsum + int((players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z())*257) + players[i].mo->Angles.Yaw.BAMs() + players[i].mo->Angles.Pitch.BAMs(); sum ^= players[i].health; consistancy[i][buf] = sum; } @@ -1423,33 +1422,30 @@ void G_PlayerReborn (int player) bool G_CheckSpot (int playernum, FPlayerStart *mthing) { - fixed_t x; - fixed_t y; - fixed_t z, oldz; + DVector3 spot; + double oldz; int i; if (mthing->type == 0) return false; - x = mthing->_f_X(); - y = mthing->_f_Y(); - z = mthing->_f_Z(); + spot = mthing->pos; if (!(level.flags & LEVEL_USEPLAYERSTARTZ)) { - z = 0; + spot.Z = 0; } - z += P_PointInSector (x, y)->floorplane.ZatPoint (x, y); + spot.Z += P_PointInSector (spot)->floorplane.ZatPoint (spot); if (!players[playernum].mo) { // first spawn of level, before corpses for (i = 0; i < playernum; i++) - if (players[i].mo && players[i].mo->_f_X() == x && players[i].mo->_f_Y() == y) + if (players[i].mo && players[i].mo->X() == spot.X && players[i].mo->Y() == spot.Y) return false; return true; } - oldz = players[playernum].mo->_f_Z(); // [RH] Need to save corpse's z-height - players[playernum].mo->_f_SetZ(z); // [RH] Checks are now full 3-D + oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height + players[playernum].mo->SetZ(spot.Z); // [RH] Checks are now full 3-D // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid // corpse to detect collisions with other players in DM starts @@ -1459,9 +1455,9 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing) // return false; players[playernum].mo->flags |= MF_SOLID; - i = P_CheckPosition(players[playernum].mo, x, y); + i = P_CheckPosition(players[playernum].mo, spot); players[playernum].mo->flags &= ~MF_SOLID; - players[playernum].mo->_f_SetZ(oldz); // [RH] Restore corpse's height + players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height if (!i) return false; diff --git a/src/g_level.cpp b/src/g_level.cpp index f0355edf2..5aa65ce3b 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1228,7 +1228,7 @@ void G_FinishTravel () { Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1); // Move to the coordinates this player had when they left the level. - pawn->SetXYZ(pawndup->_f_X(), pawndup->_f_Y(), pawndup->_f_Z()); + pawn->SetXYZ(pawndup->Pos()); } } oldpawn = pawndup; diff --git a/src/gi.cpp b/src/gi.cpp index 9ade879df..313df4f0b 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -140,13 +140,6 @@ const char* GameInfoBorders[] = gameinfo.key = sc.Float; \ } -#define GAMEINFOKEY_FIXED(key, variable) \ - else if(nextKey.CompareNoCase(variable) == 0) \ - { \ - sc.MustGetFloat(); \ - gameinfo.key = static_cast (sc.Float*FRACUNIT); \ - } - #define GAMEINFOKEY_COLOR(key, variable) \ else if(nextKey.CompareNoCase(variable) == 0) \ { \ @@ -318,7 +311,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_STRING(BorderFlat, "borderFlat") GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight") - GAMEINFOKEY_FIXED(gibfactor, "gibfactor") + GAMEINFOKEY_DOUBLE(gibfactor, "gibfactor") GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName") GAMEINFOKEY_STRING(translator, "translator") diff --git a/src/gi.h b/src/gi.h index 223aee2d0..2786b3425 100644 --- a/src/gi.h +++ b/src/gi.h @@ -163,7 +163,7 @@ struct gameinfo_t FName mFontColorHighlight; FName mFontColorSelection; FString mBackButton; - fixed_t gibfactor; + double gibfactor; int TextScreenX; int TextScreenY; FName DefaultEndSequence; diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index bb74986cc..3ba00721e 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -324,12 +324,8 @@ static int P_Set3DFloor(line_t * line, int param, int param2, int alpha) void P_PlayerOnSpecial3DFloor(player_t* player) { - sector_t * sector = player->mo->Sector; - - for(unsigned i=0;ie->XFloor.ffloors.Size();i++) + for(auto rover : player->mo->Sector->e->XFloor.ffloors) { - F3DFloor* rover=sector->e->XFloor.ffloors[i]; - if (!(rover->flags & FF_EXISTS)) continue; if (rover->flags & FF_FIX) continue; @@ -337,13 +333,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player) if(rover->flags & FF_SOLID) { // Player must be on top of the floor to be affected... - if(player->mo->_f_Z() != rover->top.plane->ZatPoint(player->mo)) continue; + if(player->mo->Z() != rover->top.plane->ZatPointF(player->mo)) continue; } else { //Water and DEATH FOG!!! heh - if (player->mo->_f_Z() > rover->top.plane->ZatPoint(player->mo) || - player->mo->_f_Top() < rover->bottom.plane->ZatPoint(player->mo)) + if (player->mo->Z() > rover->top.plane->ZatPointF(player->mo) || + player->mo->Top() < rover->bottom.plane->ZatPointF(player->mo)) continue; } @@ -366,19 +362,15 @@ void P_PlayerOnSpecial3DFloor(player_t* player) //========================================================================== bool P_CheckFor3DFloorHit(AActor * mo) { - sector_t * sector = mo->Sector; - if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; - for(unsigned i=0;ie->XFloor.ffloors.Size();i++) + for (auto rover : mo->Sector->e->XFloor.ffloors) { - F3DFloor* rover=sector->e->XFloor.ffloors[i]; - if (!(rover->flags & FF_EXISTS)) continue; if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->_f_floorz() == rover->top.plane->ZatPoint(mo)) + if(mo->Z() == rover->top.plane->ZatPointF(mo)) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); return true; @@ -396,19 +388,15 @@ bool P_CheckFor3DFloorHit(AActor * mo) //========================================================================== bool P_CheckFor3DCeilingHit(AActor * mo) { - sector_t * sector = mo->Sector; - if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; - for(unsigned i=0;ie->XFloor.ffloors.Size();i++) + for (auto rover : mo->Sector->e->XFloor.ffloors) { - F3DFloor* rover=sector->e->XFloor.ffloors[i]; - if (!(rover->flags & FF_EXISTS)) continue; if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->_f_ceilingz() == rover->bottom.plane->ZatPoint(mo)) + if(mo->Top() == rover->bottom.plane->ZatPointF(mo)) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); return true; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 76aa87127..b64b4777d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3349,7 +3349,6 @@ void AActor::Tick () AActor *onmo; - int i; //assert (state != NULL); if (state == NULL) @@ -6474,7 +6473,7 @@ int AActor::GetGibHealth() const } else { - return -FixedMul(SpawnHealth(), gameinfo.gibfactor); + return -int(SpawnHealth() * gameinfo.gibfactor); } }