diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 04d12739e..393bcafa6 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -48,6 +48,8 @@ #include "p_spec.h" #include "r_data/colormaps.h" +EXTERN_CVAR(Int, vid_renderer) + //========================================================================== // // 3D Floors @@ -356,7 +358,7 @@ void P_PlayerOnSpecial3DFloor(player_t* player) // Checks whether the player's feet touch a solid 3D floor in the sector // //========================================================================== -bool P_CheckFor3DFloorHit(AActor * mo) +bool P_CheckFor3DFloorHit(AActor * mo, double z) { if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; @@ -366,7 +368,7 @@ bool P_CheckFor3DFloorHit(AActor * mo) if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->Z() == rover->top.plane->ZatPoint(mo)) + if (fabs(z - rover->top.plane->ZatPoint(mo)) < EQUAL_EPSILON) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); return true; @@ -382,7 +384,7 @@ bool P_CheckFor3DFloorHit(AActor * mo) // Checks whether the player's head touches a solid 3D floor in the sector // //========================================================================== -bool P_CheckFor3DCeilingHit(AActor * mo) +bool P_CheckFor3DCeilingHit(AActor * mo, double z) { if ((mo->player && (mo->player->cheats & CF_PREDICTING))) return false; @@ -392,7 +394,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo) if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->Top() == rover->bottom.plane->ZatPoint(mo)) + if(fabs(z - rover->bottom.plane->ZatPoint(mo)) < EQUAL_EPSILON) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); return true; diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 5268da0e2..fc784c55c 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -122,8 +122,8 @@ struct lightlist_t class player_s; void P_PlayerOnSpecial3DFloor(player_t* player); -bool P_CheckFor3DFloorHit(AActor * mo); -bool P_CheckFor3DCeilingHit(AActor * mo); +bool P_CheckFor3DFloorHit(AActor * mo, double z); +bool P_CheckFor3DCeilingHit(AActor * mo, double z); void P_Recalculate3DFloors(sector_t *); void P_RecalculateAttached3DFloors(sector_t * sec); void P_RecalculateLights(sector_t *sector); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 6c3e375ac..56437e133 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -587,7 +587,7 @@ bool P_Move (AActor *actor) { actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor); } - P_CheckFor3DFloorHit(actor); + P_CheckFor3DFloorHit(actor, actor->Z()); } } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 90c8beef3..bc4501834 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2399,7 +2399,7 @@ void P_ZMovement (AActor *mo, double oldfloorz) { // [RH] Let the sector do something to the actor mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); } - P_CheckFor3DFloorHit(mo); + P_CheckFor3DFloorHit(mo, mo->floorz); // [RH] Need to recheck this because the sector action might have // teleported the actor so it is no longer below the floor. if (mo->Z() <= mo->floorz) @@ -2499,7 +2499,7 @@ void P_ZMovement (AActor *mo, double oldfloorz) { // [RH] Let the sector do something to the actor mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); } - P_CheckFor3DCeilingHit(mo); + P_CheckFor3DCeilingHit(mo, mo->ceilingz); // [RH] Need to recheck this because the sector action might have // teleported the actor so it is no longer above the ceiling. if (mo->Top() > mo->ceilingz) @@ -3861,11 +3861,11 @@ void AActor::CheckSectorTransition(sector_t *oldsec) } if (Z() == floorz) { - P_CheckFor3DFloorHit(this); + P_CheckFor3DFloorHit(this, Z()); } if (Top() == ceilingz) { - P_CheckFor3DCeilingHit(this); + P_CheckFor3DCeilingHit(this, Top()); } } }