- floatification of G_CheckSpot and a few other things.

This commit is contained in:
Christoph Oelckers 2016-03-26 09:28:00 +01:00
parent 696fde69b8
commit 30b57fd7b0
7 changed files with 30 additions and 54 deletions

View file

@ -46,7 +46,7 @@ public:
return *this; return *this;
} }
FileReaderBase &operator>> (fixed_t &v) FileReaderBase &operator>> (int &v)
{ {
Read (&v, 4); Read (&v, 4);
v = LittleLong(v); v = LittleLong(v);
@ -171,7 +171,7 @@ public:
return *this; return *this;
} }
FileReaderZ &operator>> (fixed_t &v) FileReaderZ &operator>> (int &v)
{ {
Read (&v, 4); Read (&v, 4);
v = LittleLong(v); v = LittleLong(v);
@ -233,7 +233,7 @@ public:
return *this; return *this;
} }
FileReaderBZ2 &operator>> (fixed_t &v) FileReaderBZ2 &operator>> (int &v)
{ {
Read (&v, 4); Read (&v, 4);
v = LittleLong(v); v = LittleLong(v);
@ -297,7 +297,7 @@ public:
return *this; return *this;
} }
FileReaderLZMA &operator>> (fixed_t &v) FileReaderLZMA &operator>> (int &v)
{ {
Read (&v, 4); Read (&v, 4);
v = LittleLong(v); v = LittleLong(v);

View file

@ -197,9 +197,9 @@ short consistancy[MAXPLAYERS][BACKUPTICS];
float normforwardmove[2] = {0x19, 0x32}; // [RH] For setting turbo from console float normforwardmove[2] = {0x19, 0x32}; // [RH] For setting turbo from console
float normsidemove[2] = {0x18, 0x28}; // [RH] Ditto float normsidemove[2] = {0x18, 0x28}; // [RH] Ditto
fixed_t forwardmove[2], sidemove[2]; int forwardmove[2], sidemove[2];
fixed_t angleturn[4] = {640, 1280, 320, 320}; // + slow turn int angleturn[4] = {640, 1280, 320, 320}; // + slow turn
fixed_t flyspeed[2] = {1*256, 3*256}; int flyspeed[2] = {1*256, 3*256};
int lookspeed[2] = {450, 512}; int lookspeed[2] = {450, 512};
#define SLOWTURNTICS 6 #define SLOWTURNTICS 6
@ -1182,8 +1182,7 @@ void G_Ticker ()
} }
if (players[i].mo) if (players[i].mo)
{ {
DWORD sum = rngsum + players[i].mo->_f_X() + players[i].mo->_f_Y() + players[i].mo->_f_Z() 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();
+ players[i].mo->_f_angle() + players[i].mo->_f_pitch();
sum ^= players[i].health; sum ^= players[i].health;
consistancy[i][buf] = sum; consistancy[i][buf] = sum;
} }
@ -1423,33 +1422,30 @@ void G_PlayerReborn (int player)
bool G_CheckSpot (int playernum, FPlayerStart *mthing) bool G_CheckSpot (int playernum, FPlayerStart *mthing)
{ {
fixed_t x; DVector3 spot;
fixed_t y; double oldz;
fixed_t z, oldz;
int i; int i;
if (mthing->type == 0) return false; if (mthing->type == 0) return false;
x = mthing->_f_X(); spot = mthing->pos;
y = mthing->_f_Y();
z = mthing->_f_Z();
if (!(level.flags & LEVEL_USEPLAYERSTARTZ)) 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) if (!players[playernum].mo)
{ // first spawn of level, before corpses { // first spawn of level, before corpses
for (i = 0; i < playernum; i++) 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 false;
return true; return true;
} }
oldz = players[playernum].mo->_f_Z(); // [RH] Need to save corpse's z-height oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height
players[playernum].mo->_f_SetZ(z); // [RH] Checks are now full 3-D 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 // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid
// corpse to detect collisions with other players in DM starts // corpse to detect collisions with other players in DM starts
@ -1459,9 +1455,9 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
// return false; // return false;
players[playernum].mo->flags |= MF_SOLID; 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->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) if (!i)
return false; return false;

View file

@ -1228,7 +1228,7 @@ void G_FinishTravel ()
{ {
Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1); 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. // 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; oldpawn = pawndup;

View file

@ -140,13 +140,6 @@ const char* GameInfoBorders[] =
gameinfo.key = sc.Float; \ gameinfo.key = sc.Float; \
} }
#define GAMEINFOKEY_FIXED(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetFloat(); \
gameinfo.key = static_cast<int> (sc.Float*FRACUNIT); \
}
#define GAMEINFOKEY_COLOR(key, variable) \ #define GAMEINFOKEY_COLOR(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \ else if(nextKey.CompareNoCase(variable) == 0) \
{ \ { \
@ -318,7 +311,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_STRING(quitSound, "quitSound")
GAMEINFOKEY_STRING(BorderFlat, "borderFlat") GAMEINFOKEY_STRING(BorderFlat, "borderFlat")
GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight") GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight")
GAMEINFOKEY_FIXED(gibfactor, "gibfactor") GAMEINFOKEY_DOUBLE(gibfactor, "gibfactor")
GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_INT(defKickback, "defKickback")
GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName") GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName")
GAMEINFOKEY_STRING(translator, "translator") GAMEINFOKEY_STRING(translator, "translator")

View file

@ -163,7 +163,7 @@ struct gameinfo_t
FName mFontColorHighlight; FName mFontColorHighlight;
FName mFontColorSelection; FName mFontColorSelection;
FString mBackButton; FString mBackButton;
fixed_t gibfactor; double gibfactor;
int TextScreenX; int TextScreenX;
int TextScreenY; int TextScreenY;
FName DefaultEndSequence; FName DefaultEndSequence;

View file

@ -324,12 +324,8 @@ static int P_Set3DFloor(line_t * line, int param, int param2, int alpha)
void P_PlayerOnSpecial3DFloor(player_t* player) void P_PlayerOnSpecial3DFloor(player_t* player)
{ {
sector_t * sector = player->mo->Sector; for(auto rover : player->mo->Sector->e->XFloor.ffloors)
for(unsigned i=0;i<sector->e->XFloor.ffloors.Size();i++)
{ {
F3DFloor* rover=sector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->flags & FF_FIX) continue; if (rover->flags & FF_FIX) continue;
@ -337,13 +333,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
if(rover->flags & FF_SOLID) if(rover->flags & FF_SOLID)
{ {
// Player must be on top of the floor to be affected... // 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 else
{ {
//Water and DEATH FOG!!! heh //Water and DEATH FOG!!! heh
if (player->mo->_f_Z() > rover->top.plane->ZatPoint(player->mo) || if (player->mo->Z() > rover->top.plane->ZatPointF(player->mo) ||
player->mo->_f_Top() < rover->bottom.plane->ZatPoint(player->mo)) player->mo->Top() < rover->bottom.plane->ZatPointF(player->mo))
continue; continue;
} }
@ -366,19 +362,15 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
//========================================================================== //==========================================================================
bool P_CheckFor3DFloorHit(AActor * mo) bool P_CheckFor3DFloorHit(AActor * mo)
{ {
sector_t * sector = mo->Sector;
if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false;
for(unsigned i=0;i<sector->e->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_EXISTS)) continue;
if(rover->flags & FF_SOLID && rover->model->SecActTarget) 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); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
return true; return true;
@ -396,19 +388,15 @@ bool P_CheckFor3DFloorHit(AActor * mo)
//========================================================================== //==========================================================================
bool P_CheckFor3DCeilingHit(AActor * mo) bool P_CheckFor3DCeilingHit(AActor * mo)
{ {
sector_t * sector = mo->Sector;
if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false;
for(unsigned i=0;i<sector->e->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_EXISTS)) continue;
if(rover->flags & FF_SOLID && rover->model->SecActTarget) 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); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
return true; return true;

View file

@ -3349,7 +3349,6 @@ void AActor::Tick ()
AActor *onmo; AActor *onmo;
int i;
//assert (state != NULL); //assert (state != NULL);
if (state == NULL) if (state == NULL)
@ -6474,7 +6473,7 @@ int AActor::GetGibHealth() const
} }
else else
{ {
return -FixedMul(SpawnHealth(), gameinfo.gibfactor); return -int(SpawnHealth() * gameinfo.gibfactor);
} }
} }