From 4d6447a55bdb835686ab7292feff7b5f4f745cfb Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 8 Apr 2012 04:43:19 +0000 Subject: [PATCH] - Don't call secfriction() twice in the normal part of P_GetFriction(). - Fixed: The 3D floors part of P_GetFriction() did not check for friction still being set to ORIG_FRICTION, so it only worked with lower frictions. SVN r3538 (trunk) --- src/p_map.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 688837594..3b66abedf 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -488,6 +488,7 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) { int friction = ORIG_FRICTION; int movefactor = ORIG_FRICTION_FACTOR; + fixed_t newfriction; const msecnode_t *m; const sector_t *sec; @@ -498,8 +499,8 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) || (mo->waterlevel == 1 && mo->z > mo->floorz + 6*FRACUNIT)) { - friction = secfriction (mo->Sector); - movefactor = secmovefac (mo->Sector) >> 1; + friction = secfriction(mo->Sector); + movefactor = secmovefac(mo->Sector) >> 1; } else if (var_friction && !(mo->flags & (MF_NOCLIP|MF_NOGRAVITY))) { // When the object is straddling sectors with the same @@ -512,16 +513,16 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) #ifdef _3DFLOORS // 3D floors must be checked, too - for(unsigned i=0;ie->XFloor.ffloors.Size();i++) + for (unsigned i = 0; i < sec->e->XFloor.ffloors.Size(); i++) { - F3DFloor * rover=sec->e->XFloor.ffloors[i]; - if (!(rover->flags&FF_EXISTS)) continue; - if(!(rover->flags & FF_SOLID)) continue; + F3DFloor *rover = sec->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_SOLID)) continue; // Player must be on top of the floor to be affected... - if(mo->z != rover->top.plane->ZatPoint(mo->x,mo->y)) continue; - fixed_t newfriction=secfriction(rover->model); - if (newfrictionz != rover->top.plane->ZatPoint(mo->x,mo->y)) continue; + newfriction = secfriction(rover->model); + if (newfriction < friction || friction == ORIG_FRICTION) { friction = newfriction; movefactor = secmovefac(rover->model); @@ -534,13 +535,14 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) { continue; } - if ((secfriction(sec) < friction || friction == ORIG_FRICTION) && - (mo->z <= sec->floorplane.ZatPoint (mo->x, mo->y) || + newfriction = secfriction(sec); + if ((newfriction < friction || friction == ORIG_FRICTION) && + (mo->z <= sec->floorplane.ZatPoint(mo->x, mo->y) || (sec->GetHeightSec() != NULL && - mo->z <= sec->heightsec->floorplane.ZatPoint (mo->x, mo->y)))) + mo->z <= sec->heightsec->floorplane.ZatPoint(mo->x, mo->y)))) { - friction = secfriction (sec); - movefactor = secmovefac (sec); + friction = newfriction; + movefactor = secmovefac(sec); } } }