diff --git a/doomsday/engine/portable/include/cl_player.h b/doomsday/engine/portable/include/cl_player.h index 47d68c4c56..c3b49db20d 100644 --- a/doomsday/engine/portable/include/cl_player.h +++ b/doomsday/engine/portable/include/cl_player.h @@ -48,7 +48,7 @@ extern float cplrThrustMul; void Cl_InitPlayers(void); //void Cl_LocalCommand(void); -void ClPlayer_Move(int plrnum); +//void ClPlayer_Move(int plrnum); void ClPlayer_MoveLocal(float dx, float dy, float dz, boolean onground); void ClPlayer_UpdatePos(int plrnum); //void Cl_MovePsprites(void); diff --git a/doomsday/engine/portable/include/p_object.h b/doomsday/engine/portable/include/p_object.h index 1f2baec125..0ee9122897 100644 --- a/doomsday/engine/portable/include/p_object.h +++ b/doomsday/engine/portable/include/p_object.h @@ -48,9 +48,9 @@ DD_BASE_MOBJ_ELEMENTS()} mobj_t; #define DEFAULT_FRICTION FIX2FLT(0xe800) #define NOMOMENTUM_THRESHOLD (0.000001f) -extern float tmpFloorZ, tmpCeilingZ; -extern mobj_t *blockingMobj; -extern boolean dontHitMobjs; +//extern float tmpFloorZ, tmpCeilingZ; +//extern mobj_t *blockingMobj; +//extern boolean dontHitMobjs; #include "cl_def.h" // for clplayerstate_s @@ -61,14 +61,8 @@ mobj_t *P_MobjCreate(think_t function, float x, float y, float z, int ddflags); void P_MobjDestroy(mobj_t *mo); void P_MobjRecycle(mobj_t *mo); - void P_MobjSetState(mobj_t *mo, int statenum); -void P_MobjMovement(mobj_t *mo); -void P_MobjMovement2(mobj_t *mo, void *pstate); -void P_MobjZMovement(mobj_t *mo); -boolean P_TryMoveXYZ(mobj_t *mo, float x, float y, float z); -boolean P_StepMove(mobj_t *mo, float dx, float dy, float dz); -boolean P_CheckPosXY(mobj_t *mo, float x, float y); -boolean P_CheckPosXYZ(mobj_t *mo, float x, float y, float z); -boolean P_SectorPlanesChanged(uint sectornum); + +boolean P_MobjSetPos(struct mobj_s* mo, float x, float y, float z); + #endif diff --git a/doomsday/engine/portable/include/sv_def.h b/doomsday/engine/portable/include/sv_def.h index dd47497940..d978c66ff6 100644 --- a/doomsday/engine/portable/include/sv_def.h +++ b/doomsday/engine/portable/include/sv_def.h @@ -64,9 +64,6 @@ size_t Sv_InfoToString(serverinfo_t* info, ddstring_t* msg); boolean Sv_StringToInfo(const char* valuePair, serverinfo_t* info); int Sv_GetNumPlayers(void); int Sv_GetNumConnected(void); -void Sv_PlaceMobj(struct mobj_s* mo, float x, float y, float z, - boolean onFloor); - boolean Sv_CheckBandwidth(int playerNumber); #endif diff --git a/doomsday/engine/portable/src/cl_player.c b/doomsday/engine/portable/src/cl_player.c index 74b930add1..aa278621e0 100644 --- a/doomsday/engine/portable/src/cl_player.c +++ b/doomsday/engine/portable/src/cl_player.c @@ -327,6 +327,7 @@ mobj_t* ClPlayer_ClMobj(int plrNum) return ClMobj_Find(clPlayerStates[plrNum].clMobjId); } +#if 0 /** * Predict the movement of the given player. * @@ -389,6 +390,7 @@ void ClPlayer_Move(int plrNum) // Mirror changes in the (hidden) client mobj. ClPlayer_UpdatePos(plrNum); } +#endif /** * Move the (hidden, unlinked) client player mobj to the same coordinates @@ -491,22 +493,22 @@ void ClPlayer_HandleFix(void) pos[VZ] = FIX2FLT(Msg_ReadLong()); #ifdef _DEBUG -Con_Message("Cl_HandlePlayerFix: Fix pos %i. Pos=%f, %f, %f\n", - ddpl->fixAcked.pos, pos[VX], pos[VY], pos[VZ]); + Con_Message("Cl_HandlePlayerFix: Fix pos %i. Pos=%f, %f, %f\n", + ddpl->fixAcked.pos, pos[VX], pos[VY], pos[VZ]); #endif if(mo) { #ifdef _DEBUG -Con_Message(" Applying to mobj %p...\n", mo); + Con_Message(" Applying to mobj %p...\n", mo); #endif - Sv_PlaceMobj(mo, pos[VX], pos[VY], pos[VZ], false); + P_MobjSetPos(mo, pos[VX], pos[VY], pos[VZ]); mo->reactionTime = 18; } if(clmo) { #ifdef _DEBUG -Con_Message(" Applying to clmobj %i...\n", clmo->thinker.id); + Con_Message(" Applying to clmobj %i...\n", clmo->thinker.id); #endif ClPlayer_UpdatePos(plr - ddPlayers); } diff --git a/doomsday/engine/portable/src/cl_world.c b/doomsday/engine/portable/src/cl_world.c index 06ea1a249c..d51d590075 100644 --- a/doomsday/engine/portable/src/cl_world.c +++ b/doomsday/engine/portable/src/cl_world.c @@ -209,7 +209,7 @@ void Cl_MoverThinker(mover_t *mover) mover->sectornum) ); #endif - P_SectorPlanesChanged(mover->sectornum); + //P_SectorPlanesChanged(mover->sectornum); // Make sure the client didn't get stuck as a result of this move. if(freeMove != ClPlayer_IsFreeToMove(consolePlayer)) @@ -221,7 +221,7 @@ void Cl_MoverThinker(mover_t *mover) // Something was blocking the way! Go back to original height. P_SetFloat(DMU_SECTOR, mover->sectornum, mover->property, original); - P_SectorPlanesChanged(mover->sectornum); + //P_SectorPlanesChanged(mover->sectornum); } else if(remove) // Can we remove this thinker? { @@ -647,7 +647,7 @@ void Cl_ReadSectorDelta2(int deltaType, boolean skip) // the sector. if(wasChanged) { - P_SectorPlanesChanged(GET_SECTOR_IDX(sec)); + //P_SectorPlanesChanged(GET_SECTOR_IDX(sec)); } // Do we need to start any moving planes? diff --git a/doomsday/engine/portable/src/p_mobj.c b/doomsday/engine/portable/src/p_mobj.c index 857a081f9d..9f364e3f82 100644 --- a/doomsday/engine/portable/src/p_mobj.c +++ b/doomsday/engine/portable/src/p_mobj.c @@ -47,17 +47,18 @@ // MACROS ------------------------------------------------------------------ // Max. distance to move in one call to P_MobjMoveXY. -#define MAXMOVE 30 +//#define MAXMOVE 30 // Shortest possible movement step. -#define MINMOVE (1.0f/128) +//#define MINMOVE (1.0f/128) -#define MIN_STEP(d) ((d) <= MINMOVE && (d) >= -MINMOVE) +//#define MIN_STEP(d) ((d) <= MINMOVE && (d) >= -MINMOVE) -#define STOPSPEED (0.1f/1.6f) +//#define STOPSPEED (0.1f/1.6f) // TYPES ------------------------------------------------------------------- +/* typedef struct { mobj_t *mo; vec2_t box[2]; @@ -65,6 +66,7 @@ typedef struct { float pos[3]; float height, floorZ, ceilingZ, dropOffZ; } checkpos_data_t; +*/ // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -77,14 +79,14 @@ typedef struct { // PUBLIC DATA DEFINITIONS ------------------------------------------------- // If set to true, P_CheckPosition will skip the mobj hit test. -boolean dontHitMobjs = false; +//boolean dontHitMobjs = false; -float tmpFloorZ; -float tmpCeilingZ; +//float tmpFloorZ; +//float tmpCeilingZ; // When a mobj is contacted in PIT_CheckMobj, this pointer is set. // It's reset to NULL in the beginning of P_CheckPosition. -mobj_t *blockingMobj; +//mobj_t *blockingMobj; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -154,7 +156,9 @@ mobj_t* P_MobjCreate(think_t function, float x, float y, float z, mo->ddFlags = ddflags; mo->thinker.function = function; if(mo->thinker.function) + { P_ThinkerAdd(&mo->thinker, true); // Make it public. + } return mo; } @@ -235,6 +239,21 @@ void P_MobjSetState(mobj_t* mobj, int statenum) } } +/** + * Sets a mobj's position. + * + * @return @c true if successful, @c false otherwise. The object's position is + * not changed if the move fails. + * + * @note Internal to the engine. + */ +boolean P_MobjSetPos(struct mobj_s* mo, float x, float y, float z) +{ + assert(gx.MobjTryMove3f != 0); + return gx.MobjTryMove3f(mo, x, y, z); +} + +#if 0 /** * Adjusts tmpFloorZ and tmpCeilingZ as lines are contacted. */ @@ -279,7 +298,9 @@ boolean PIT_LineCollide(linedef_t* ld, void* parm) tm->mo->wallHit = false; return true; } +#endif +#if 0 boolean PIT_MobjCollide(mobj_t* mo, void* parm) { checkpos_data_t* tm = parm; @@ -353,7 +374,9 @@ boolean PIT_MobjCollide(mobj_t* mo, void* parm) return false; } +#endif +#if 0 /** * @return @c true, if the mobj can be positioned at the * specified coordinates. @@ -418,7 +441,9 @@ boolean P_CheckPosXYZ(mobj_t *mo, float x, float y, float z) tmpDropOffZ = data.dropOffZ; return result; } +#endif +#if 0 /** * @return @c true, if the mobj can be positioned at the * specified coordinates, assuming traditional 2D DOOM @@ -561,7 +586,9 @@ boolean P_StepMove(mobj_t *mo, float dx, float dy, float dz) return notHit; } +#endif +#if 0 /** * Takes a valid mobj and adjusts the mobj->floorZ, mobj->ceilingZ, and * possibly mobj->z. This is called for all nearby mobjs whenever a sector @@ -608,7 +635,9 @@ static boolean heightClip(mobj_t *mo) return false; return true; } +#endif +#if 0 /** * Allows the player to slide along any angled walls. Adjusts the player's * momentum vector so that the next move slides along the linedef. @@ -652,7 +681,9 @@ static void wallMomSlide(linedef_t *ld) tmpMom[VX] = newlen * FIX2FLT(fineCosine[an]); tmpMom[VY] = newlen * FIX2FLT(finesine[an]); } +#endif +#if 0 static boolean slideTraverse(intercept_t *in) { linedef_t *li; @@ -700,7 +731,9 @@ static boolean slideTraverse(intercept_t *in) return false; // Stop iteration. } +#endif +#if 0 /** * The momx / momy move is bad, so try to slide along a wall. * Find the first line hit, move flush to it, and slide along it @@ -799,7 +832,9 @@ static void mobjSlideMove(mobj_t *mo) goto retry; } } +#endif +#if 0 /** * After modifying a sectors floor or ceiling height, call this routine * to adjust the positions of all mobjs that touch the sector. @@ -1001,3 +1036,4 @@ void P_MobjZMovement(mobj_t *mo) mo->pos[VZ] = mo->ceilingZ - mo->height; } } +#endif diff --git a/doomsday/engine/portable/src/sv_main.c b/doomsday/engine/portable/src/sv_main.c index 87cf8daba4..4f7d5c089e 100644 --- a/doomsday/engine/portable/src/sv_main.c +++ b/doomsday/engine/portable/src/sv_main.c @@ -1173,24 +1173,6 @@ boolean Sv_CheckBandwidth(int playerNumber) return qSize <= 10 * limit; } -void Sv_PlaceMobj(mobj_t* mo, float x, float y, float z, boolean onFloor) -{ - P_CheckPosXYZ(mo, x, y, z); - - P_MobjUnlink(mo); - mo->pos[VX] = x; - mo->pos[VY] = y; - mo->pos[VZ] = z; - P_MobjLink(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); - mo->floorZ = tmpFloorZ; - mo->ceilingZ = tmpCeilingZ; - - if(onFloor) - { - mo->pos[VZ] = mo->floorZ; - } -} - /** * Reads a PKT_COORDS packet from the message buffer. We trust the * client's position and change ours to match it. The client better not @@ -1228,32 +1210,25 @@ void Sv_ClientCoords(int plrNum) // If we aren't about to forcibly change the client's position, update // with new pos if it's valid. But it must be a valid pos. - if(ddpl->fixCounter.pos == ddpl->fixAcked.pos && - P_CheckPosXYZ(mo, clientPos[VX], clientPos[VY], clientPos[VZ])) + if(ddpl->fixCounter.pos == ddpl->fixAcked.pos && !(ddpl->flags & DDPF_FIXPOS)) { - // Large differences in the coordinates suggest that player position - // has been misestimated on serverside. - - // Prevent illegal stepups. - /*if(tmpFloorZ - mo->pos[VZ] <= 24 || - // But also allow warping the position. - (fabs(clientPos[VX] - mo->pos[VX]) > WARP_LIMIT || - fabs(clientPos[VY] - mo->pos[VY]) > WARP_LIMIT || - fabs(clientPos[VZ] - mo->pos[VZ]) > WARP_LIMIT)) - {*/ #ifdef _DEBUG - VERBOSE2( Con_Message("Sv_ClientCoords: Setting coords for player %i: %f, %f, %f\n", plrNum, - clientPos[VX], clientPos[VY], clientPos[VZ]) ); + VERBOSE2( Con_Message("Sv_ClientCoords: Setting coords for player %i: %f, %f, %f\n", plrNum, + clientPos[VX], clientPos[VY], clientPos[VZ]) ); #endif - Sv_PlaceMobj(mo, clientPos[VX], clientPos[VY], clientPos[VZ], onFloor); - /* + if(!P_MobjSetPos(mo, clientPos[VX], clientPos[VY], clientPos[VZ])) + { + Con_Message("Sv_ClientCoords: Player %i attempts an illegal move to: %f, %f, %f\n", plrNum, + clientPos[VX], clientPos[VY], clientPos[VZ]); + + // We need to restore the client's old position. + ddpl->flags |= DDPF_FIXPOS; } - else + else // The move was successful. { -#ifdef _DEBUG - Con_Message("Sv_ClientCoords: Discarding coords for player %i.\n", plrNum); -#endif - }*/ + if(onFloor) + mo->pos[VZ] = mo->floorZ; + } } } diff --git a/doomsday/plugins/common/src/p_actor.c b/doomsday/plugins/common/src/p_actor.c index 0fd5c9f5aa..760112c7a6 100644 --- a/doomsday/plugins/common/src/p_actor.c +++ b/doomsday/plugins/common/src/p_actor.c @@ -162,7 +162,7 @@ void P_MobjRemove(mobj_t* mo, boolean noRespawn) */ void P_MobjSetPosition(mobj_t* mo) { - int flags = DDLINK_BLOCKMAP; + int flags = DDLINK_BLOCKMAP; if(!(mo->flags & MF_NOSECTOR)) flags |= DDLINK_SECTOR;