From b84ea3ee80a15cc491a20ceef751625d9d577d4e Mon Sep 17 00:00:00 2001 From: danij Date: Thu, 3 Oct 2013 00:25:56 +0100 Subject: [PATCH] libcommon: Consolidated mobj state change functions; cleanup --- doomsday/api/api_map.h | 41 ++++++-- doomsday/api/dd_share.h | 5 - doomsday/client/include/client/cl_player.h | 4 + doomsday/client/include/m_nodepile.h | 2 +- doomsday/client/include/world/p_object.h | 2 +- doomsday/client/src/client/cl_mobj.cpp | 24 ++--- doomsday/client/src/client/cl_player.cpp | 42 ++------ doomsday/client/src/world/api_map.cpp | 29 +++--- doomsday/client/src/world/p_mobj.cpp | 49 +++------ doomsday/plugins/common/include/mobj.h | 44 +++++--- doomsday/plugins/common/include/p_actor.h | 25 +++-- doomsday/plugins/common/src/d_netcl.c | 4 +- doomsday/plugins/common/src/d_netsv.c | 116 +++++---------------- doomsday/plugins/common/src/mobj.c | 57 +++++++++- doomsday/plugins/common/src/p_actor.cpp | 24 ++--- doomsday/plugins/common/src/p_map.c | 10 +- doomsday/plugins/common/src/p_player.c | 4 +- doomsday/plugins/common/src/p_saveg.cpp | 6 +- doomsday/plugins/common/src/p_start.cpp | 4 +- doomsday/plugins/common/src/p_user.c | 30 +----- doomsday/plugins/common/src/p_xgline.c | 112 +++++++------------- doomsday/plugins/common/src/p_xgsec.c | 63 ++++------- doomsday/plugins/doom/include/p_local.h | 1 - doomsday/plugins/doom/include/p_mobj.h | 2 - doomsday/plugins/doom/src/p_enemy.c | 4 +- doomsday/plugins/doom/src/p_mobj.c | 41 +------- doomsday/plugins/doom/src/p_oldsvg.c | 2 +- doomsday/plugins/doom/src/p_telept.c | 2 +- doomsday/plugins/doom64/include/p_mobj.h | 4 - doomsday/plugins/doom64/src/p_mobj.c | 43 +------- doomsday/plugins/doom64/src/p_telept.c | 42 ++++---- doomsday/plugins/heretic/include/p_local.h | 4 - doomsday/plugins/heretic/include/p_mobj.h | 1 - doomsday/plugins/heretic/src/p_enemy.c | 6 +- doomsday/plugins/heretic/src/p_mobj.c | 60 +---------- doomsday/plugins/heretic/src/p_oldsvg.c | 2 +- doomsday/plugins/heretic/src/p_telept.c | 2 +- doomsday/plugins/hexen/include/p_local.h | 4 - doomsday/plugins/hexen/src/a_action.c | 75 +++++-------- doomsday/plugins/hexen/src/p_enemy.c | 36 +++---- doomsday/plugins/hexen/src/p_inter.c | 37 +++---- doomsday/plugins/hexen/src/p_mobj.c | 60 +---------- doomsday/plugins/hexen/src/p_pspr.c | 64 ++++-------- doomsday/plugins/hexen/src/p_spec.c | 2 +- doomsday/plugins/hexen/src/p_telept.c | 2 +- doomsday/plugins/hexen/src/p_things.c | 61 +++-------- 46 files changed, 449 insertions(+), 805 deletions(-) diff --git a/doomsday/api/api_map.h b/doomsday/api/api_map.h index fb304041d8..66125680bd 100644 --- a/doomsday/api/api_map.h +++ b/doomsday/api/api_map.h @@ -84,16 +84,25 @@ struct intercept_s; +/** + * @defgroup mobjLinkFlags Mobj Link Flags + */ +///@{ +#define DDLINK_SECTOR 0x1 ///< Link to map sectors. +#define DDLINK_BLOCKMAP 0x2 ///< Link in the map's mobj blockmap. +#define DDLINK_NOLINE 0x4 ///< Do not link to map lines. +///@} + /** * @defgroup boxLineIteratorFlags Box Line Iterator Flags * @ingroup apiFlags map */ ///@{ -#define BLF_SECTOR 0x1 ///< Process map lines defining sectors -#define BLF_POLYOBJ 0x2 ///< Process map lines defining polyobjs +#define BLF_SECTOR 0x1 ///< Process map lines defining sectors +#define BLF_POLYOBJ 0x2 ///< Process map lines defining polyobjs /// Process all map line types. -#define BLF_ALL BLF_SECTOR | BLF_POLYOBJ +#define BLF_ALL BLF_SECTOR | BLF_POLYOBJ ///@} /** @@ -228,9 +237,27 @@ DENG_API_TYPEDEF(Map) struct mobj_s *(*MO_CreateXYZ)(thinkfunc_t function, coord_t x, coord_t y, coord_t z, angle_t angle, coord_t radius, coord_t height, int ddflags); void (*MO_Destroy)(struct mobj_s *mobj); struct mobj_s *(*MO_MobjForID)(int id); + + /** + * @param statenum Must be a valid state (not null!). + */ void (*MO_SetState)(struct mobj_s *mobj, int statenum); - void (*MO_Link)(struct mobj_s *mobj, byte flags); - int (*MO_Unlink)(struct mobj_s *mobj); + + /** + * To be called after a move, to link the mobj back into the world. + * + * @param mobj Mobj instance. + * @param flags @ref mobjLinkFlags + */ + void (*MO_Link)(struct mobj_s *mobj, int flags); + + /** + * Unlinks a mobj from the world so that it can be moved. + * + * @param mobj Mobj instance. + */ + void (*MO_Unlink)(struct mobj_s *mobj); + void (*MO_SpawnDamageParticleGen)(struct mobj_s *mobj, struct mobj_s *inflictor, int amount); /** @@ -593,8 +620,8 @@ DENG_API_T(Map); #define P_MobjDestroy _api_Map.MO_Destroy #define P_MobjForID _api_Map.MO_MobjForID #define P_MobjSetState _api_Map.MO_SetState -#define P_MobjLink _api_Map.MO_Link -#define P_MobjUnlink _api_Map.MO_Unlink +#define Mobj_Link _api_Map.MO_Link +#define Mobj_Unlink _api_Map.MO_Unlink #define P_SpawnDamageParticleGen _api_Map.MO_SpawnDamageParticleGen #define P_MobjLinesIterator _api_Map.MO_LinesIterator #define P_MobjSectorsIterator _api_Map.MO_SectorsIterator diff --git a/doomsday/api/dd_share.h b/doomsday/api/dd_share.h index 206f7ac85d..b6f0e00ccc 100644 --- a/doomsday/api/dd_share.h +++ b/doomsday/api/dd_share.h @@ -519,11 +519,6 @@ typedef float AudioEnvironmentFactors[NUM_REVERB_DATA]; #define LS_PASSUNDER 0x4 ///< Ray may cross under sector floor height on ray-entry side. ///@} -// For (un)linking. -#define DDLINK_SECTOR 0x1 -#define DDLINK_BLOCKMAP 0x2 -#define DDLINK_NOLINE 0x4 - typedef enum intercepttype_e { ICPT_MOBJ, ICPT_LINE diff --git a/doomsday/client/include/client/cl_player.h b/doomsday/client/include/client/cl_player.h index d1a4ac761f..525545028a 100644 --- a/doomsday/client/include/client/cl_player.h +++ b/doomsday/client/include/client/cl_player.h @@ -68,6 +68,10 @@ void Cl_InitPlayers(void); */ void ClPlayer_MoveLocal(coord_t dx, coord_t dy, coord_t z, boolean onground); +/** + * Move the (hidden, unlinked) client player mobj to the same coordinates + * where the real mobj of the player is. + */ void ClPlayer_UpdateOrigin(int plrnum); void ClPlayer_HandleFix(void); diff --git a/doomsday/client/include/m_nodepile.h b/doomsday/client/include/m_nodepile.h index 7560c08d13..978c3f4c5f 100644 --- a/doomsday/client/include/m_nodepile.h +++ b/doomsday/client/include/m_nodepile.h @@ -36,7 +36,7 @@ * that a single mobj is linked simultaneously to multiple lines (which * is common). * - * All these rings are maintained by P_MobjLink() and P_MobjUnlink(). + * All these rings are maintained by Mobj_Link() and Mobj_Unlink(). * @ingroup mobj */ typedef struct linknode_s { diff --git a/doomsday/client/include/world/p_object.h b/doomsday/client/include/world/p_object.h index 4a34dde97d..5ebfb1c378 100644 --- a/doomsday/client/include/world/p_object.h +++ b/doomsday/client/include/world/p_object.h @@ -59,7 +59,7 @@ void P_InitUnusedMobjList(); */ void Mobj_ConsoleRegister(); -mobj_t *P_MobjCreate(thinkfunc_t function, coord_t const post[3], angle_t angle, +mobj_t *P_MobjCreate(thinkfunc_t function, de::Vector3d const &origin, angle_t angle, coord_t radius, coord_t height, int ddflags); void P_MobjRecycle(mobj_t *mobj); diff --git a/doomsday/client/src/client/cl_mobj.cpp b/doomsday/client/src/client/cl_mobj.cpp index e342675ca7..7825f286df 100644 --- a/doomsday/client/src/client/cl_mobj.cpp +++ b/doomsday/client/src/client/cl_mobj.cpp @@ -188,14 +188,14 @@ int Map::clMobjIterator(int (*callback) (mobj_t *, void *), void *context) return true; } -void ClMobj_Unlink(mobj_t* mo) +void ClMobj_Unlink(mobj_t *mo) { - P_MobjUnlink(mo); + Mobj_Unlink(mo); } -void ClMobj_Link(mobj_t* mo) +void ClMobj_Link(mobj_t *mo) { - clmoinfo_t* info = ClMobj_GetInfo(mo); + clmoinfo_t *info = ClMobj_GetInfo(mo); CL_ASSERT_CLMOBJ(mo); @@ -209,8 +209,8 @@ void ClMobj_Link(mobj_t* mo) DEBUG_VERBOSE2_Message(("ClMobj_Link: id %i, x%f Y%f, solid:%s\n", mo->thinker.id, mo->origin[VX], mo->origin[VY], mo->ddFlags & DDMF_SOLID? "yes" : "no")); - P_MobjLink(mo, (mo->ddFlags & DDMF_DONTDRAW ? 0 : DDLINK_SECTOR) | - (mo->ddFlags & DDMF_SOLID ? DDLINK_BLOCKMAP : 0)); + Mobj_Link(mo, (mo->ddFlags & DDMF_DONTDRAW ? 0 : DDLINK_SECTOR) | + (mo->ddFlags & DDMF_SOLID ? DDLINK_BLOCKMAP : 0)); } #undef ClMobj_EnableLocalActions @@ -233,7 +233,7 @@ void ClMobj_EnableLocalActions(struct mobj_s *mo, boolean enable) #undef ClMobj_LocalActionsEnabled boolean ClMobj_LocalActionsEnabled(struct mobj_s *mo) { - clmoinfo_t* info = ClMobj_GetInfo(mo); + clmoinfo_t *info = ClMobj_GetInfo(mo); if(!isClient || !info) return true; return (info->flags & CLMF_LOCAL_ACTIONS) != 0; } @@ -246,8 +246,8 @@ void ClMobj_SetState(mobj_t *mo, int stnum) { P_MobjSetState(mo, stnum); stnum = states[stnum].nextState; - } - while(!mo->tics && stnum > 0); + + } while(!mo->tics && stnum > 0); } void Cl_UpdateRealPlayerMobj(mobj_t *localMobj, mobj_t *remoteClientMobj, @@ -312,9 +312,9 @@ void Cl_UpdateRealPlayerMobj(mobj_t *localMobj, mobj_t *remoteClientMobj, if(gx.MobjTryMoveXYZ) { if(gx.MobjTryMoveXYZ(localMobj, - remoteClientMobj->origin[VX], - remoteClientMobj->origin[VY], - (flags & MDF_ORIGIN_Z)? remoteClientMobj->origin[VZ] : localMobj->origin[VZ])) + remoteClientMobj->origin[VX], + remoteClientMobj->origin[VY], + (flags & MDF_ORIGIN_Z)? remoteClientMobj->origin[VZ] : localMobj->origin[VZ])) { if((flags & MDF_ORIGIN_Z) && onFloor) { diff --git a/doomsday/client/src/client/cl_player.cpp b/doomsday/client/src/client/cl_player.cpp index 6b2ecfc28a..8a168b5ac5 100644 --- a/doomsday/client/src/client/cl_player.cpp +++ b/doomsday/client/src/client/cl_player.cpp @@ -92,26 +92,18 @@ DENG_EXTERN_C struct mobj_s* ClPlayer_ClMobj(int plrNum) return ClMobj_Find(clPlayerStates[plrNum].clMobjId); } -/** - * Move the (hidden, unlinked) client player mobj to the same coordinates - * where the real mobj of the player is. - */ void ClPlayer_UpdateOrigin(int plrNum) { - player_t *plr; - mobj_t *remoteClientMobj, *localMobj; - clplayerstate_t *s; + DENG2_ASSERT(plrNum >= 0 && plrNum < DDMAXPLAYERS); - assert(plrNum >= 0 && plrNum < DDMAXPLAYERS); - - plr = &ddPlayers[plrNum]; - s = ClPlayer_State(plrNum); + player_t *plr = &ddPlayers[plrNum]; + clplayerstate_t *s = ClPlayer_State(plrNum); if(!s->clMobjId || !plr->shared.mo) return; // Must have a mobj! - remoteClientMobj = ClMobj_Find(s->clMobjId); - localMobj = plr->shared.mo; + mobj_t *remoteClientMobj = ClMobj_Find(s->clMobjId); + mobj_t *localMobj = plr->shared.mo; // The client mobj is never solid. remoteClientMobj->ddFlags &= ~DDMF_SOLID; @@ -121,7 +113,7 @@ void ClPlayer_UpdateOrigin(int plrNum) // The player's client mobj is not linked to any lists, so position // can be updated without any hassles. memcpy(remoteClientMobj->origin, localMobj->origin, sizeof(localMobj->origin)); - P_MobjLink(remoteClientMobj, 0); // Update bspLeaf pointer. + Mobj_Link(remoteClientMobj, 0); // Update bspLeaf pointer. remoteClientMobj->floorZ = localMobj->floorZ; remoteClientMobj->ceilingZ = localMobj->ceilingZ; remoteClientMobj->mom[MX] = localMobj->mom[MX]; @@ -129,24 +121,6 @@ void ClPlayer_UpdateOrigin(int plrNum) remoteClientMobj->mom[MZ] = localMobj->mom[MZ]; } -/* -void ClPlayer_CoordsReceived(void) -{ - if(playback) - return; - -#ifdef _DEBUG - //Con_Printf("ClPlayer_CoordsReceived\n"); -#endif - - fixPos[VX] = (float) Msg_ReadShort(); - fixPos[VY] = (float) Msg_ReadShort(); - fixTics = fixSpeed; - fixPos[VX] /= fixSpeed; - fixPos[VY] /= fixSpeed; -} -*/ - void ClPlayer_ApplyPendingFixes(int plrNum) { clplayerstate_t *state = ClPlayer_State(plrNum); @@ -310,10 +284,10 @@ void ClPlayer_MoveLocal(coord_t dx, coord_t dy, coord_t z, boolean onground) if(dx != 0 || dy != 0) { - P_MobjUnlink(mo); + Mobj_Unlink(mo); mo->origin[VX] += dx; mo->origin[VY] += dy; - P_MobjLink(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); + Mobj_Link(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); } mo->_bspLeaf = &App_World().map().bspLeafAt_FixedPrecision(Mobj_Origin(*mo)); diff --git a/doomsday/client/src/world/api_map.cpp b/doomsday/client/src/world/api_map.cpp index 2501deaa4f..3aae284b3b 100644 --- a/doomsday/client/src/world/api_map.cpp +++ b/doomsday/client/src/world/api_map.cpp @@ -1535,18 +1535,18 @@ DENG_EXTERN_C fixed_t P_GetGMOFixed(int entityId, int elementIndex, int property DENG_EXTERN_C angle_t P_GetGMOAngle(int entityId, int elementIndex, int propertyId); DENG_EXTERN_C float P_GetGMOFloat(int entityId, int elementIndex, int propertyId); -#undef P_MobjLink -DENG_EXTERN_C void P_MobjLink(mobj_t *mo, byte flags) +#undef Mobj_Link +DENG_EXTERN_C void Mobj_Link(mobj_t *mobj, int flags) { - if(!mo || !App_World().hasMap()) return; - App_World().map().link(*mo, flags); + if(!mobj || !App_World().hasMap()) return; // Huh? + App_World().map().link(*mobj, flags); } -#undef P_MobjUnlink -DENG_EXTERN_C int P_MobjUnlink(mobj_t *mo) +#undef Mobj_Unlink +DENG_EXTERN_C void Mobj_Unlink(mobj_t *mobj) { - if(!mo || !Mobj_IsLinked(*mo)) return 0; - return Mobj_BspLeafAtOrigin(*mo).map().unlink(*mo); + if(!mobj || !Mobj_IsLinked(*mobj)) return; + Mobj_BspLeafAtOrigin(*mobj).map().unlink(*mobj); } #undef P_MobjLinesIterator @@ -1696,9 +1696,14 @@ DENG_EXTERN_C void P_SetTraceOpening(Line *line) line->map().setTraceOpening(*line); } +#undef P_MobjCreateXYZ +DENG_EXTERN_C mobj_t *P_MobjCreateXYZ(thinkfunc_t function, coord_t x, coord_t y, coord_t z, + angle_t angle, coord_t radius, coord_t height, int ddflags) +{ + return P_MobjCreate(function, Vector3d(x, y, z), angle, radius, height, ddflags); +} + // p_mobj.c -DENG_EXTERN_C mobj_t *P_MobjCreateXYZ(thinkfunc_t function, coord_t x, coord_t y, coord_t z, angle_t angle, coord_t radius, coord_t height, int ddflags); -DENG_EXTERN_C void P_MobjDestroy(mobj_t *mobj); DENG_EXTERN_C void P_MobjDestroy(mobj_t *mobj); DENG_EXTERN_C void P_MobjSetState(mobj_t *mobj, int statenum); DENG_EXTERN_C angle_t Mobj_AngleSmoothed(mobj_t *mobj); @@ -1850,8 +1855,8 @@ DENG_DECLARE_API(Map) = P_MobjDestroy, P_MobjForID, P_MobjSetState, - P_MobjLink, - P_MobjUnlink, + Mobj_Link, + Mobj_Unlink, P_SpawnDamageParticleGen, P_MobjLinesIterator, P_MobjSectorsIterator, diff --git a/doomsday/client/src/world/p_mobj.cpp b/doomsday/client/src/world/p_mobj.cpp index 0b2734a1c6..47a5eadf79 100644 --- a/doomsday/client/src/world/p_mobj.cpp +++ b/doomsday/client/src/world/p_mobj.cpp @@ -74,27 +74,27 @@ void P_InitUnusedMobjList() /** * All mobjs must be allocated through this routine. Part of the public API. */ -mobj_t *P_MobjCreate(thinkfunc_t function, coord_t const pos[3], angle_t angle, +mobj_t *P_MobjCreate(thinkfunc_t function, Vector3d const &origin, angle_t angle, coord_t radius, coord_t height, int ddflags) { - mobj_t *mo; - if(!function) - Con_Error("P_MobjCreateXYZ: Think function invalid, cannot create mobj."); + Con_Error("P_MobjCreate: Think function invalid, cannot create mobj."); #ifdef _DEBUG if(isClient) { - VERBOSE2( Con_Message("P_MobjCreate: Client creating mobj at [x:%f, y:%f, z:%f]", pos[VX], pos[VY], pos[VZ]) ); + LOG_VERBOSE("P_MobjCreate: Client creating mobj at %s") + << origin.asText(); } #endif // Do we have any unused mobjs we can reuse? + mobj_t *mo; if(unusedMobjs) { mo = unusedMobjs; unusedMobjs = unusedMobjs->sNext; - memset(mo, 0, MOBJ_SIZE); + std::memset(mo, 0, MOBJ_SIZE); } else { @@ -102,7 +102,7 @@ mobj_t *P_MobjCreate(thinkfunc_t function, coord_t const pos[3], angle_t angle, mo = (mobj_t *) Z_Calloc(MOBJ_SIZE, PU_MAP, NULL); } - V3d_Copy(mo->origin, pos); + V3d_Set(mo->origin, origin.x, origin.y, origin.z); mo->angle = angle; mo->visAngle = mo->angle >> 16; // "angle-servo"; smooth actor turning. mo->radius = radius; @@ -118,15 +118,6 @@ mobj_t *P_MobjCreate(thinkfunc_t function, coord_t const pos[3], angle_t angle, return mo; } -#undef P_MobjCreateXYZ -DENG_EXTERN_C mobj_t* P_MobjCreateXYZ(thinkfunc_t function, coord_t x, coord_t y, coord_t z, - angle_t angle, coord_t radius, coord_t height, int ddflags) -{ - coord_t pos[3]; - V3d_Set(pos, x, y, z); - return P_MobjCreate(function, pos, angle, radius, height, ddflags); -} - /** * All mobjs must be destroyed through this routine. Part of the public API. * @@ -144,7 +135,7 @@ DENG_EXTERN_C void P_MobjDestroy(mobj_t *mo) #endif // Unlink from sector and block lists. - P_MobjUnlink(mo); + Mobj_Unlink(mo); S_StopSound(0, mo); @@ -167,32 +158,24 @@ boolean Mobj_IsSectorLinked(mobj_t *mo) return mo != 0 && mo->_bspLeaf != 0 && mo->sPrev != 0; } -/** - * 'statenum' must be a valid state (not null!). - */ #undef P_MobjSetState DENG_EXTERN_C void P_MobjSetState(mobj_t *mobj, int statenum) { - state_t *st = states + statenum; + if(!mobj) return; + #ifdef __CLIENT__ - boolean spawning = (mobj->state == 0); + bool spawning = (mobj->state == 0); #endif #ifdef DENG_DEBUG if(statenum < 0 || statenum >= defs.count.states.num) Con_Error("P_MobjSetState: statenum %i out of bounds.\n", statenum); - /* - if(mobj->ddFlags & DDMF_MISSILE) - { - Con_Message("P_MobjSetState: Missile %i going to state %i.", mobj->thinker.id, statenum); - } - */ #endif - mobj->state = st; - mobj->tics = st->tics; - mobj->sprite = st->sprite; - mobj->frame = st->frame; + mobj->state = states + statenum; + mobj->tics = mobj->state->tics; + mobj->sprite = mobj->state->sprite; + mobj->frame = mobj->state->frame; #ifdef __CLIENT__ // Check for a ptcgen trigger. @@ -381,7 +364,7 @@ void Mobj_GenerateLumobjs(mobj_t *mo) // If the mobj's origin is outside the BSP leaf it is linked within, then // this means it is outside the playable map (and no light should be emitted). - /// @todo Optimize: P_MobjLink() should do this and flag the mobj accordingly. + /// @todo Optimize: Mobj_Link() should do this and flag the mobj accordingly. if(!Mobj_BspLeafAtOrigin(*mo).polyContains(mo->origin)) return; diff --git a/doomsday/plugins/common/include/mobj.h b/doomsday/plugins/common/include/mobj.h index 445fd3d1ec..95ba4c57c1 100644 --- a/doomsday/plugins/common/include/mobj.h +++ b/doomsday/plugins/common/include/mobj.h @@ -1,4 +1,4 @@ -/** @file common/mobj.h Common Map Object (Mobj) functionality. +/** @file mobj.h Common Map Object (Mobj) functionality. * * @authors Copyright © 2003-2013 Jaakko Keränen * @authors Copyright © 2006-2013 Daniel Swanson @@ -31,40 +31,60 @@ extern "C" { /** * Handles the stopping of mobj movement. Also stops player walking animation. * - * @param mo Mobj. + * @param mobj Mobj instance. */ -void Mobj_XYMoveStopping(mobj_t *mo); +void Mobj_XYMoveStopping(mobj_t *mobj); /** * Checks if @a thing is a clmobj of one of the players. + * + * @param mobj Mobj instance. */ -boolean Mobj_IsPlayerClMobj(mobj_t *mo); +boolean Mobj_IsPlayerClMobj(mobj_t *mobj); /** * Determines if a mobj is a player mobj. It could still be a voodoo doll, also. - * @param mo Map object. + * + * @param mobj Mobj instance. + * * @return @c true, iff the mobj is a player. */ -boolean Mobj_IsPlayer(mobj_t const *mo); +boolean Mobj_IsPlayer(mobj_t const *mobj); /** * Determines if a mobj is a voodoo doll. - * @param mo Map object. + * + * @param mobj Mobj instance. + * * @return @c true, iff the mobj is a voodoo doll. */ -boolean Mobj_IsVoodooDoll(mobj_t const *mo); +boolean Mobj_IsVoodooDoll(mobj_t const *mobj); /** + * @param mobj Mobj instance. * @param allAround @c false= only look 180 degrees in front. + * * @return @c true iff a player was targeted. */ -boolean Mobj_LookForPlayers(mobj_t *mo, boolean allAround); +boolean Mobj_LookForPlayers(mobj_t *mobj, boolean allAround); /** - * Determines if it is allowed to execute the action function of @a mo. - * @return @c true, if allowed. + * @param mobj Mobj instance. + * @param stateNum Unique identifier of the state to change to. + * + * @return @c true, if the mobj is still present. + */ +boolean P_MobjChangeState(mobj_t *mobj, statenum_t stateNum); + +/** + * Same as P_MobjChangeState but does not call action functions. + * + * @param mobj Mobj instance. + * @param stateNum Unique identifier of the state to change to. + * + * @return @c true, if the mobj is still present. */ -boolean Mobj_ActionFunctionAllowed(mobj_t *mo); +boolean P_MobjChangeStateNoAction(mobj_t *mobj, statenum_t stateNum); #ifdef __cplusplus } // extern "C" diff --git a/doomsday/plugins/common/include/p_actor.h b/doomsday/plugins/common/include/p_actor.h index 0cc160068a..7c3fccf085 100644 --- a/doomsday/plugins/common/include/p_actor.h +++ b/doomsday/plugins/common/include/p_actor.h @@ -39,14 +39,18 @@ void P_MobjRemove(mobj_t *mo, boolean noRespawn); void P_RemoveAllPlayerMobjs(void); /** - * Unlinks a mobj from the world so that it can be moved. + * To be called after a move, to link the mobj back into the world. + * + * @param mobj Mobj instance. */ -void P_MobjUnsetOrigin(mobj_t *mo); +void P_MobjLink(struct mobj_s *mobj); /** - * To be called after a move, to link the mobj back into the world. + * Unlinks a mobj from the world so that it can be moved. + * + * @param mobj Mobj instance. */ -void P_MobjSetOrigin(mobj_t *mo); +void P_MobjUnlink(struct mobj_s *mobj); /** * The actor has taken a step, set the corresponding short-range visual @@ -76,6 +80,13 @@ void P_MobjAngleSRVOTicker(mobj_t *mo); boolean P_MobjIsCamera(mobj_t const *mo); +/** + * Returns the terraintype_t of the floor plane at the mobj's origin. + * + * @param mobj Mobj instance. + */ +terraintype_t const *P_MobjFloorTerrain(mobj_t *mobj); + /** * The first three bits of the selector special byte contain a relative * health level. @@ -85,10 +96,10 @@ void P_UpdateHealthBits(mobj_t *mo); /** * Given a mobjtype, lookup the statenum associated to the named state. * - * @param mobjType Type of mobj. - * @param name State name identifier. + * @param mobjType Type of mobj. + * @param name State name identifier. * - * @return Statenum of the associated state ELSE @c, S_NULL. + * @return Statenum of the associated state ELSE @c, S_NULL. */ statenum_t P_GetState(mobjtype_t mobjType, statename_t name); diff --git a/doomsday/plugins/common/src/d_netcl.c b/doomsday/plugins/common/src/d_netcl.c index 5766183f93..e8d7b0825a 100644 --- a/doomsday/plugins/common/src/d_netcl.c +++ b/doomsday/plugins/common/src/d_netcl.c @@ -166,11 +166,11 @@ void NetCl_UpdateGameState(Reader* msg) mo = pl->plr->mo; if(mo) { - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); mo->origin[VX] = Reader_ReadFloat(msg); mo->origin[VY] = Reader_ReadFloat(msg); mo->origin[VZ] = Reader_ReadFloat(msg); - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->angle = Reader_ReadUInt32(msg); // Update floorz and ceilingz. #if __JDOOM__ || __JDOOM64__ diff --git a/doomsday/plugins/common/src/d_netsv.c b/doomsday/plugins/common/src/d_netsv.c index 214d6eac2c..aafe7f0998 100644 --- a/doomsday/plugins/common/src/d_netsv.c +++ b/doomsday/plugins/common/src/d_netsv.c @@ -1,34 +1,24 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file d_netsv.c Common code related to net games (server-side). * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson - *\author Copyright © 2007 Jamie Jones + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 2007 Jamie Jones * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -/** - * d_netsv.c : Common code related to net games (server-side). - */ - -// HEADER FILES ------------------------------------------------------------ - #include #include #include @@ -40,6 +30,8 @@ #include "p_player.h" #include "p_user.h" #include "p_map.h" +#include "mobj.h" +#include "p_actor.h" #include "g_common.h" #include "p_tick.h" #include "p_start.h" @@ -49,8 +41,6 @@ # include "s_sequence.h" #endif -// MACROS ------------------------------------------------------------------ - #if __JHEXEN__ || __JSTRIFE__ # define SOUND_COUNTDOWN SFX_PICKUP_KEY #elif __JDOOM__ || __JDOOM64__ @@ -61,14 +51,6 @@ #define SOUND_VICTORY SOUND_COUNTDOWN -//#define UPD_BUFFER_LEN 500 - -// How long is the largest possible sector update? -//#define MAX_SECTORUPD 20 -//#define MAX_SIDEUPD 9 - -// TYPES ------------------------------------------------------------------- - typedef struct maprule_s { boolean usetime, usefrags; int time; // Minutes. @@ -80,23 +62,13 @@ typedef enum cyclemode_s { CYCLE_COUNTDOWN } cyclemode_t; -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - void R_SetAllDoomsdayFlags(); void P_FireWeapon(player_t *player); -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - int NetSv_GetFrags(int pl); void NetSv_MapCycleTicker(void); void NetSv_SendPlayerClass(int pnum, char cls); -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - char cyclingMaps = false; char *mapCycle = ""; char mapCycleNoExit = true; @@ -107,8 +79,6 @@ int netSvAllowCheats = false; // of space-separated keywords. char gameConfigString[128]; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - static int cycleIndex; static int cycleCounter = -1, cycleMode = CYCLE_IDLE; static int cycleRulesCounter[MAXPLAYERS]; @@ -117,8 +87,6 @@ static int cycleRulesCounter[MAXPLAYERS]; static int oldClasses[MAXPLAYERS]; #endif -// CODE -------------------------------------------------------------------- - /** * Update the game config string with keywords that describe the game. * The string is sent out in netgames (also to the master). @@ -1360,13 +1328,13 @@ void NetSv_DoCheat(int player, Reader* msg) * Calls @a callback on @a thing while it is temporarily placed at the * specified position and angle. Afterwards the thing's old position is restored. */ -void NetSv_TemporaryPlacedCallback(mobj_t* thing, void* param, coord_t tempOrigin[3], - angle_t angle, void (*callback)(mobj_t*, void*)) +void NetSv_TemporaryPlacedCallback(mobj_t *thing, void *param, coord_t tempOrigin[3], + angle_t angle, void (*callback)(mobj_t *, void *)) { - coord_t oldOrigin[3] = { thing->origin[VX], thing->origin[VY], thing->origin[VZ] }; - coord_t oldFloorZ = thing->floorZ; - coord_t oldCeilingZ = thing->ceilingZ; - angle_t oldAngle = thing->angle; + coord_t const oldOrigin[3] = { thing->origin[VX], thing->origin[VY], thing->origin[VZ] }; + coord_t const oldFloorZ = thing->floorZ; + coord_t const oldCeilingZ = thing->ceilingZ; + angle_t const oldAngle = thing->angle; // We will temporarily move the object to the temp coords. if(P_CheckPosition(thing, tempOrigin)) @@ -1375,7 +1343,7 @@ void NetSv_TemporaryPlacedCallback(mobj_t* thing, void* param, coord_t tempOrigi thing->origin[VX] = tempOrigin[VX]; thing->origin[VY] = tempOrigin[VY]; thing->origin[VZ] = tempOrigin[VZ]; - P_MobjLink(thing, DDLINK_SECTOR | DDLINK_BLOCKMAP); + P_MobjLink(thing); thing->floorZ = tmFloorZ; thing->ceilingZ = tmCeilingZ; } @@ -1388,7 +1356,7 @@ void NetSv_TemporaryPlacedCallback(mobj_t* thing, void* param, coord_t tempOrigi thing->origin[VX] = oldOrigin[VX]; thing->origin[VY] = oldOrigin[VY]; thing->origin[VZ] = oldOrigin[VZ]; - P_MobjLink(thing, DDLINK_SECTOR | DDLINK_BLOCKMAP); + P_MobjLink(thing); thing->floorZ = oldFloorZ; thing->ceilingZ = oldCeilingZ; thing->angle = oldAngle; @@ -1497,38 +1465,6 @@ void NetSv_DoAction(int player, Reader* msg) NetSv_TemporaryPlacedCallback(pl->plr->mo, pl, pos, angle, type == GPA_USE? NetSv_UseActionCallback : NetSv_FireWeaponCallback); - /* - mobj_t* mo = pl->plr->mo; - coord_t oldPos[3] = { mo->origin[VX], mo->origin[VY], mo->origin[VZ] }; - coord_t oldFloorZ = mo->floorZ; - coord_t oldCeilingZ = mo->ceilingZ; - - // We will temporarily move the object to the action coords. - if(P_CheckPosition(mo, pos)) - { - P_MobjUnlink(mo); - mo->origin[VX] = pos[VX]; - mo->origin[VY] = pos[VY]; - mo->origin[VZ] = pos[VZ]; - P_MobjLink(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); - mo->floorZ = tmFloorZ; - mo->ceilingZ = tmCeilingZ; - } - mo->angle = angle; - - if(type == GPA_USE) - P_UseLines(pl); - else - P_FireWeapon(pl); - - // Restore the old position. - P_MobjUnlink(mo); - mo->origin[VX] = oldPos[VX]; - mo->origin[VY] = oldPos[VY]; - mo->origin[VZ] = oldPos[VZ]; - P_MobjLink(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); - mo->floorZ = oldFloorZ; - mo->ceilingZ = oldCeilingZ;*/ } break; diff --git a/doomsday/plugins/common/src/mobj.c b/doomsday/plugins/common/src/mobj.c index bf71e50550..8dede40778 100644 --- a/doomsday/plugins/common/src/mobj.c +++ b/doomsday/plugins/common/src/mobj.c @@ -263,17 +263,66 @@ boolean Mobj_LookForPlayers(mobj_t* mo, boolean allAround) return foundTarget; } -boolean Mobj_ActionFunctionAllowed(mobj_t* mo) +/** + * Determines if it is allowed to execute the action function of @a mo. + * @return @c true, if allowed. + */ +static boolean shouldCallAction(mobj_t *mobj) { if(IS_CLIENT) { - if(ClMobj_LocalActionsEnabled(mo)) + if(ClMobj_LocalActionsEnabled(mobj)) return true; } - if(!(mo->ddFlags & DDMF_REMOTE) || // only for local mobjs - (mo->flags3 & MF3_CLIENTACTION)) // action functions allowed? + if(!(mobj->ddFlags & DDMF_REMOTE) || // only for local mobjs + (mobj->flags3 & MF3_CLIENTACTION)) // action functions allowed? { return true; } return false; } + +static boolean changeMobjState(mobj_t *mobj, statenum_t stateNum, boolean doCallAction) +{ + state_t *st; + + DENG_ASSERT(mobj != 0); + + // Skip zero-tic states -- call their action but then advance to the next. + do + { + if(stateNum == S_NULL) + { + mobj->state = (state_t *) S_NULL; + P_MobjRemove(mobj, false); + return false; + } + + P_MobjSetState(mobj, stateNum); + mobj->turnTime = false; // $visangle-facetarget + + st = &STATES[stateNum]; + + // Call the action function? + if(doCallAction && st->action) + { + if(shouldCallAction(mobj)) + st->action(mobj); + } + + stateNum = st->nextState; + } while(!mobj->tics); + + // Return false if an action function removed the mobj. + return mobj->thinker.function != (thinkfunc_t) NOPFUNC; +} + +boolean P_MobjChangeState(mobj_t *mobj, statenum_t stateNum) +{ + return changeMobjState(mobj, stateNum, true /*call action functions*/); +} + +boolean P_MobjChangeStateNoAction(mobj_t *mobj, statenum_t stateNum) +{ + return changeMobjState(mobj, stateNum, false /*don't call action functions*/); +} diff --git a/doomsday/plugins/common/src/p_actor.cpp b/doomsday/plugins/common/src/p_actor.cpp index 0dca4860b4..8272f8bee3 100644 --- a/doomsday/plugins/common/src/p_actor.cpp +++ b/doomsday/plugins/common/src/p_actor.cpp @@ -73,7 +73,8 @@ void P_MobjRemove(mobj_t *mo, boolean noRespawn) DENG_UNUSED(noRespawn); #endif - if(mo->ddFlags & DDMF_REMOTE) goto justDoIt; + if(mo->ddFlags & DDMF_REMOTE) + goto justDoIt; #if __JDOOM__ || __JDOOM64__ if(!noRespawn) @@ -124,21 +125,15 @@ void P_RemoveAllPlayerMobjs() } } -void P_MobjSetOrigin(mobj_t *mo) +void P_MobjLink(struct mobj_s *mobj) { - DENG_ASSERT(mo != 0); - - int flags = DDLINK_BLOCKMAP; // Always. - - if(!(mo->flags & MF_NOSECTOR)) - flags |= DDLINK_SECTOR; - - P_MobjLink(mo, flags); + DENG_ASSERT(mobj != 0); + Mobj_Link(mobj, DDLINK_BLOCKMAP | (!(mobj->flags & MF_NOSECTOR)? DDLINK_SECTOR : 0)); } -void P_MobjUnsetOrigin(mobj_t *mo) +void P_MobjUnlink(struct mobj_s *mobj) { - P_MobjUnlink(mo); + Mobj_Unlink(mobj); } void P_MobjSetSRVO(mobj_t *mo, coord_t stepx, coord_t stepy) @@ -217,6 +212,11 @@ boolean P_MobjIsCamera(mobj_t const *mo) (mo->player->plr->flags & DDPF_CAMERA)); } +terraintype_t const *P_MobjFloorTerrain(mobj_t *mobj) +{ + return P_PlaneMaterialTerrainType(Mobj_Sector(mobj), PLN_FLOOR); +} + void P_UpdateHealthBits(mobj_t *mo) { if(!mo || !mo->info) return; diff --git a/doomsday/plugins/common/src/p_map.c b/doomsday/plugins/common/src/p_map.c index 4d4cb9fc1a..8b2a2123c6 100644 --- a/doomsday/plugins/common/src/p_map.c +++ b/doomsday/plugins/common/src/p_map.c @@ -300,7 +300,7 @@ boolean P_TeleportMove(mobj_t *thing, coord_t x, coord_t y, boolean alwaysStomp) return false; // The move is ok, so link the thing into its new position. - P_MobjUnsetOrigin(thing); + P_MobjUnlink(thing); thing->floorZ = tmFloorZ; thing->ceilingZ = tmCeilingZ; @@ -310,7 +310,7 @@ boolean P_TeleportMove(mobj_t *thing, coord_t x, coord_t y, boolean alwaysStomp) thing->origin[VX] = x; thing->origin[VY] = y; - P_MobjSetOrigin(thing); + P_MobjLink(thing); P_MobjClearSRVO(thing); return true; @@ -1484,7 +1484,7 @@ static boolean P_TryMove2(mobj_t *thing, coord_t x, coord_t y, boolean dropoff) } // The move is ok, so link the thing into its new position. - P_MobjUnsetOrigin(thing); + P_MobjUnlink(thing); oldpos[VX] = thing->origin[VX]; oldpos[VY] = thing->origin[VY]; @@ -1499,7 +1499,7 @@ static boolean P_TryMove2(mobj_t *thing, coord_t x, coord_t y, boolean dropoff) thing->origin[VX] = x; thing->origin[VY] = y; - P_MobjSetOrigin(thing); + P_MobjLink(thing); if(thing->flags2 & MF2_FLOORCLIP) { @@ -1507,7 +1507,7 @@ static boolean P_TryMove2(mobj_t *thing, coord_t x, coord_t y, boolean dropoff) if(FEQUAL(thing->origin[VZ], P_GetDoublep(Mobj_Sector(thing), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(thing); + terraintype_t const *tt = P_MobjFloorTerrain(thing); if(tt->flags & TTF_FLOORCLIP) { thing->floorClip = 10; diff --git a/doomsday/plugins/common/src/p_player.c b/doomsday/plugins/common/src/p_player.c index d9e77e945a..5ebe9f16a8 100644 --- a/doomsday/plugins/common/src/p_player.c +++ b/doomsday/plugins/common/src/p_player.c @@ -884,10 +884,10 @@ int P_CameraXYMovement(mobj_t *mo) { #endif - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); mo->origin[VX] += mo->mom[MX]; mo->origin[VY] += mo->mom[MY]; - P_MobjSetOrigin(mo); + P_MobjLink(mo); P_CheckPositionXY(mo, mo->origin[VX], mo->origin[VY]); mo->floorZ = tmFloorZ; mo->ceilingZ = tmCeilingZ; diff --git a/doomsday/plugins/common/src/p_saveg.cpp b/doomsday/plugins/common/src/p_saveg.cpp index bd1ef74a65..0bcd4485a5 100644 --- a/doomsday/plugins/common/src/p_saveg.cpp +++ b/doomsday/plugins/common/src/p_saveg.cpp @@ -1882,7 +1882,7 @@ static void RestoreMobj(mobj_t *mo, int ver) SV_TranslateLegacyMobjFlags(mo, ver); #endif - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->ceilingZ = P_GetDoublep(Mobj_Sector(mo), DMU_CEILING_HEIGHT); @@ -5487,11 +5487,11 @@ void SV_LoadGameClient(uint gameId) } mapTime = hdr->mapTime; - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); mo->origin[VX] = FIX2FLT(SV_ReadLong()); mo->origin[VY] = FIX2FLT(SV_ReadLong()); mo->origin[VZ] = FIX2FLT(SV_ReadLong()); - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = FIX2FLT(SV_ReadLong()); mo->ceilingZ = FIX2FLT(SV_ReadLong()); mo->angle = SV_ReadLong(); /* $unifiedangles */ diff --git a/doomsday/plugins/common/src/p_start.cpp b/doomsday/plugins/common/src/p_start.cpp index 59bd496dd1..88fbd7ddb6 100644 --- a/doomsday/plugins/common/src/p_start.cpp +++ b/doomsday/plugins/common/src/p_start.cpp @@ -1210,10 +1210,10 @@ static int moveMobjOutOfNearbyLines(thinker_t *th, void *paramaters) if(!FEQUAL(mo->origin[VX], params.pos[VX]) || !FEQUAL(mo->origin[VY], params.pos[VY])) { - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); mo->origin[VX] = params.pos[VX]; mo->origin[VY] = params.pos[VY]; - P_MobjSetOrigin(mo); + P_MobjLink(mo); } return false; // Continue iteration. diff --git a/doomsday/plugins/common/src/p_user.c b/doomsday/plugins/common/src/p_user.c index d6c3d262a8..a8fb245155 100644 --- a/doomsday/plugins/common/src/p_user.c +++ b/doomsday/plugins/common/src/p_user.c @@ -238,7 +238,7 @@ void P_Thrust(player_t *player, angle_t angle, coord_t move) Sector *sec = Mobj_Sector(mo); #endif #if __JHEXEN__ - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); #endif #if __JHEXEN__ @@ -323,12 +323,12 @@ void P_CheckPlayerJump(player_t* player) /** * Moves a player according to its smoother. */ -void P_PlayerRemoteMove(player_t* player) +void P_PlayerRemoteMove(player_t *player) { int plrNum = player - players; - ddplayer_t* ddpl = player->plr; - Smoother* smoother = Net_PlayerSmoother(plrNum); - mobj_t* mo = player->plr->mo; + ddplayer_t *ddpl = player->plr; + Smoother *smoother = Net_PlayerSmoother(plrNum); + mobj_t *mo = player->plr->mo; coord_t xyz[3]; /* @@ -410,26 +410,6 @@ void P_PlayerRemoteMove(player_t* player) #endif } } - else - { -#ifdef _DEBUG - //Smoother_Debug(smoother); -#endif - /*Con_Message("P_PlayerRemoteMove: Player %i: Smooth move to %f, %f, %f (floorz)", - plrNum, xyz[VX], xyz[VY], xyz[VZ]);*/ - - /* - // Clientside moves have no side-effects. - P_MobjUnlink(mo); - mo->origin[VX] = xyz[VX]; - mo->origin[VY] = xyz[VY]; - mo->origin[VZ] = xyz[VZ]; - P_MobjLink(mo, DDLINK_SECTOR | DDLINK_BLOCKMAP); - P_CheckPosition(mo, xyz); - mo->floorZ = tmFloorZ; - mo->ceilingZ = tmCeilingZ; - */ - } } void P_MovePlayer(player_t *player) diff --git a/doomsday/plugins/common/src/p_xgline.c b/doomsday/plugins/common/src/p_xgline.c index ac524d2b95..1a7a89c8b8 100644 --- a/doomsday/plugins/common/src/p_xgline.c +++ b/doomsday/plugins/common/src/p_xgline.c @@ -1,59 +1,40 @@ -/**\file p_xgline.c - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_xgline.c Extended generalized line types. * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson - *\author Copyright © 2007 Jamie Jones + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 2007 Jamie Jones * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * Extended Generalized Line Types. - * - * Implements all XG line interactions on a map + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #if __JDOOM__ || __JHERETIC__ || __JDOOM64__ -// HEADER FILES ------------------------------------------------------------ - #include #include #include #include #include -#if __JDOOM__ -# include "jdoom.h" -#elif __JDOOM64__ -# include "jdoom64.h" -#elif __JHERETIC__ -# include "jheretic.h" -#elif __JSTRIFE__ -# include "jstrife.h" -#endif +#include "common.h" #include "dmu_lib.h" #include "p_mapsetup.h" #include "d_net.h" #include "p_xgline.h" #include "p_xgsec.h" +#include "p_actor.h" #include "p_player.h" #include "p_map.h" #include "p_mapspec.h" @@ -62,8 +43,6 @@ #include "p_sound.h" #include "p_switch.h" -// MACROS ------------------------------------------------------------------ - #define XLTIMER_STOPPED 1 // Timer stopped. #define EVTYPESTR(evtype) (evtype == XLE_CHAIN? "CHAIN" \ @@ -129,43 +108,28 @@ : (x) == 1? DMU_BOTTOM_COLOR_GREEN \ : DMU_BOTTOM_COLOR_BLUE) -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -void XL_ChangeMaterial(Line* line, int sidenum, int section, - Material* mat, blendmode_t blend, - byte rgba[4], int flags); - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -int C_DECL XL_DoChainSequence(); -int C_DECL XL_DoDamage(); -int C_DECL XL_DoPower(); -int C_DECL XL_DoKey(); -int C_DECL XL_DoExplode(); -int C_DECL XL_DoCommand(); - -int C_DECL XLTrav_ChangeLineType(); -int C_DECL XLTrav_Activate(); -int C_DECL XLTrav_Music(); -int C_DECL XLTrav_LineCount(); -int C_DECL XLTrav_LeaveMap(); -int C_DECL XLTrav_DisableLine(); -int C_DECL XLTrav_EnableLine(); -int C_DECL XLTrav_ChangeWallMaterial(); -int C_DECL XLTrav_LineTeleport(); - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- +void XL_ChangeMaterial(Line *line, int sidenum, int section, Material *mat, + blendmode_t blend, byte rgba[4], int flags); + +int C_DECL XL_DoChainSequence(); +int C_DECL XL_DoDamage(); +int C_DECL XL_DoPower(); +int C_DECL XL_DoKey(); +int C_DECL XL_DoExplode(); +int C_DECL XL_DoCommand(); + +int C_DECL XLTrav_ChangeLineType(); +int C_DECL XLTrav_Activate(); +int C_DECL XLTrav_Music(); +int C_DECL XLTrav_LineCount(); +int C_DECL XLTrav_LeaveMap(); +int C_DECL XLTrav_DisableLine(); +int C_DECL XLTrav_EnableLine(); +int C_DECL XLTrav_ChangeWallMaterial(); +int C_DECL XLTrav_LineTeleport(); int xgDev = 0; // Print dev messages. -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - static linetype_t typebuffer; static char msgbuf[80]; struct mobj_s dummyThing; @@ -1728,7 +1692,7 @@ int C_DECL XLTrav_LineTeleport(Line* newLine, boolean dummy, if(FEQUAL(mobj->origin[VZ], P_GetDoublep(Mobj_Sector(mobj), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mobj); + terraintype_t const *tt = P_MobjFloorTerrain(mobj); if(tt->flags & TTF_FLOORCLIP) { mobj->floorClip = 10; diff --git a/doomsday/plugins/common/src/p_xgsec.c b/doomsday/plugins/common/src/p_xgsec.c index 7e2e21618b..53a5cdc925 100644 --- a/doomsday/plugins/common/src/p_xgsec.c +++ b/doomsday/plugins/common/src/p_xgsec.c @@ -1,33 +1,24 @@ -/**\file p_xgsec.c - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_xgsec.c Extended generalized sector types. * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * Extended Generalized Sector Types. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #if __JDOOM__ || __JHERETIC__ || __JDOOM64__ -// HEADER FILES ------------------------------------------------------------ #include #include @@ -40,8 +31,6 @@ # include "jdoom64.h" #elif __JHERETIC__ # include "jheretic.h" -#elif __JSTRIFE__ -# include "jstrife.h" #endif #include "dmu_lib.h" @@ -50,13 +39,13 @@ #include "p_xgsec.h" #include "g_common.h" #include "p_map.h" +#include "mobj.h" +#include "p_actor.h" #include "p_mapspec.h" #include "p_sound.h" #include "p_terraintype.h" #include "p_tick.h" -// MACROS ------------------------------------------------------------------ - #define MAX_VALS 128 #define SIGN(x) ((x)>0? 1 : (x)<0? -1 : 0) @@ -113,26 +102,10 @@ : x == 1? DMU_FLOOR_COLOR_GREEN \ : DMU_FLOOR_COLOR_BLUE) -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - void XS_DoChain(Sector *sec, int ch, int activating, void *actThing); -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - static sectortype_t sectypebuffer; -// CODE -------------------------------------------------------------------- - sectortype_t *XS_GetType(int id) { sectortype_t* ptr; @@ -2292,7 +2265,7 @@ int C_DECL XSTrav_Teleport(Sector* sector, boolean ceiling, void* context, if(FEQUAL(thing->origin[VZ], P_GetDoublep(Mobj_Sector(thing), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(thing); + terraintype_t const *tt = P_MobjFloorTerrain(thing); if(tt->flags & TTF_FLOORCLIP) { thing->floorClip = 10; diff --git a/doomsday/plugins/doom/include/p_local.h b/doomsday/plugins/doom/include/p_local.h index 21984c8d95..b872fcdb51 100644 --- a/doomsday/plugins/doom/include/p_local.h +++ b/doomsday/plugins/doom/include/p_local.h @@ -90,7 +90,6 @@ void P_MovePsprites(player_t* plr); void P_DropWeapon(player_t* plr); void P_SetPsprite(player_t* plr, int position, statenum_t stnum); -boolean P_MobjChangeState(mobj_t* mo, statenum_t state); void P_MobjThinker(void *mo); void P_RipperBlood(mobj_t* mo); diff --git a/doomsday/plugins/doom/include/p_mobj.h b/doomsday/plugins/doom/include/p_mobj.h index da810ced59..a3911b7190 100644 --- a/doomsday/plugins/doom/include/p_mobj.h +++ b/doomsday/plugins/doom/include/p_mobj.h @@ -236,8 +236,6 @@ void P_SpawnBlood(coord_t x, coord_t y, coord_t z, int damage, angle_t angle); mobj_t* P_SpawnTeleFog(coord_t x, coord_t y, angle_t angle); -const terraintype_t* P_MobjGetFloorTerrainType(mobj_t* mo); - coord_t P_MobjGetFriction(mobj_t* mo); #ifdef __cplusplus diff --git a/doomsday/plugins/doom/src/p_enemy.c b/doomsday/plugins/doom/src/p_enemy.c index 95cc8aa9a6..b940d59420 100644 --- a/doomsday/plugins/doom/src/p_enemy.c +++ b/doomsday/plugins/doom/src/p_enemy.c @@ -1163,11 +1163,11 @@ void C_DECL A_Fire(mobj_t* actor) an = dest->angle >> ANGLETOFINESHIFT; - P_MobjUnsetOrigin(actor); + P_MobjUnlink(actor); memcpy(actor->origin, dest->origin, sizeof(actor->origin)); actor->origin[VX] += 24 * FIX2FLT(finecosine[an]); actor->origin[VY] += 24 * FIX2FLT(finesine[an]); - P_MobjSetOrigin(actor); + P_MobjLink(actor); } /** diff --git a/doomsday/plugins/doom/src/p_mobj.c b/doomsday/plugins/doom/src/p_mobj.c index 63e9d65dce..ec61eb7903 100644 --- a/doomsday/plugins/doom/src/p_mobj.c +++ b/doomsday/plugins/doom/src/p_mobj.c @@ -42,43 +42,6 @@ #define MAX_BOB_OFFSET (8) -terraintype_t const *P_MobjGetFloorTerrainType(mobj_t *mobj) -{ - return P_PlaneMaterialTerrainType(Mobj_Sector(mobj), PLN_FLOOR); -} - -/** - * @return @c true, if the mobj is still present. - */ -boolean P_MobjChangeState(mobj_t *mobj, statenum_t state) -{ - state_t *st; - - do - { - if(state == S_NULL) - { - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - P_MobjSetState(mobj, state); - st = &STATES[state]; - - mobj->turnTime = false; // $visangle-facetarget - - if(Mobj_ActionFunctionAllowed(mobj)) - { - // Call action functions when the state is set. - if(st->action) st->action(mobj); - } - state = st->nextState; - } while(!mobj->tics); - - return true; -} - void P_ExplodeMissile(mobj_t *mo) { mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; @@ -802,7 +765,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t // Must link before setting state (ID assigned for the mo). P_MobjSetState(mo, P_GetState(mo->type, SN_SPAWN)); - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->dropOffZ = mo->floorZ; @@ -837,7 +800,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t if((mo->flags2 & MF2_FLOORCLIP) && FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/doom/src/p_oldsvg.c b/doomsday/plugins/doom/src/p_oldsvg.c index 058f8d6005..1dbe8fc1c4 100644 --- a/doomsday/plugins/doom/src/p_oldsvg.c +++ b/doomsday/plugins/doom/src/p_oldsvg.c @@ -326,7 +326,7 @@ static void SV_v19_ReadMobj(void) //mo->dPlayer->clAngle = mo->angle; /* $unifiedangles */ mo->dPlayer->lookDir = 0; /* $unifiedangles */ } - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->ceilingZ = P_GetDoublep(Mobj_Sector(mo), DMU_CEILING_HEIGHT); } diff --git a/doomsday/plugins/doom/src/p_telept.c b/doomsday/plugins/doom/src/p_telept.c index 756d48aa2c..f6394ee95d 100644 --- a/doomsday/plugins/doom/src/p_telept.c +++ b/doomsday/plugins/doom/src/p_telept.c @@ -147,7 +147,7 @@ int EV_Teleport(Line* line, int side, mobj_t* mo, boolean spawnFog) if(FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/doom64/include/p_mobj.h b/doomsday/plugins/doom64/include/p_mobj.h index aaeb21acf4..955e2f46f8 100644 --- a/doomsday/plugins/doom64/include/p_mobj.h +++ b/doomsday/plugins/doom64/include/p_mobj.h @@ -281,12 +281,8 @@ mobj_t* P_SpawnTeleFog(coord_t x, coord_t y, angle_t angle); mobj_t* P_SpawnMotherMissile(mobjtype_t type, coord_t x, coord_t y, coord_t z, mobj_t* source, mobj_t* dest); -boolean P_MobjChangeState(mobj_t* mo, statenum_t state); - void P_MobjThinker(void *moThinkerPtr); -const terraintype_t* P_MobjGetFloorTerrainType(mobj_t* mo); - void P_RipperBlood(mobj_t* mo); void P_SetDoomsdayFlags(mobj_t* mo); diff --git a/doomsday/plugins/doom64/src/p_mobj.c b/doomsday/plugins/doom64/src/p_mobj.c index 5e611617b6..b70adb1815 100644 --- a/doomsday/plugins/doom64/src/p_mobj.c +++ b/doomsday/plugins/doom64/src/p_mobj.c @@ -47,43 +47,6 @@ #define MAX_BOB_OFFSET (8) -terraintype_t const *P_MobjGetFloorTerrainType(mobj_t *mobj) -{ - return P_PlaneMaterialTerrainType(Mobj_Sector(mobj), PLN_FLOOR); -} - -/** - * @return @c true, if the mobj is still present. - */ -boolean P_MobjChangeState(mobj_t* mobj, statenum_t state) -{ - state_t* st; - - do - { - if(state == S_NULL) - { - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - P_MobjSetState(mobj, state); - st = &STATES[state]; - - mobj->turnTime = false; // $visangle-facetarget - - if(Mobj_ActionFunctionAllowed(mobj)) - { - if(st->action) st->action(mobj); - } - - state = st->nextState; - } while(!mobj->tics); - - return true; -} - void P_ExplodeMissile(mobj_t *mo) { mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; @@ -798,7 +761,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t ddflags |= DDMF_DONTDRAW; mo = P_MobjCreateXYZ(P_MobjThinker, x, y, z, angle, info->radius, - info->height, ddflags); + info->height, ddflags); mo->type = type; mo->info = info; mo->flags = info->flags; @@ -820,7 +783,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t P_MobjSetState(mo, P_GetState(mo->type, SN_SPAWN)); // Set BSP leaf and/or block links. - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->dropOffZ = mo->floorZ; @@ -862,7 +825,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t if((mo->flags2 & MF2_FLOORCLIP) && FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/doom64/src/p_telept.c b/doomsday/plugins/doom64/src/p_telept.c index 0df8c35b05..88d92e0052 100644 --- a/doomsday/plugins/doom64/src/p_telept.c +++ b/doomsday/plugins/doom64/src/p_telept.c @@ -1,27 +1,23 @@ -/**\file p_telept.c - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_telept.c * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 2003-2005 Samuel Villarreal - *\author Copyright © 1993-1996 by id Software, Inc. + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 2003-2005 Samuel Villarreal + * @authors Copyright © 1993-1996 by id Software, Inc. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #include @@ -32,6 +28,8 @@ #include "dmu_lib.h" #include "p_mapsetup.h" #include "p_map.h" +#include "mobj.h" +#include "p_actor.h" #include "p_mapspec.h" #include "p_terraintype.h" #include "p_start.h" @@ -146,7 +144,7 @@ int EV_Teleport(Line* line, int side, mobj_t* mo, boolean spawnFog) if(FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/heretic/include/p_local.h b/doomsday/plugins/heretic/include/p_local.h index fddfa77b50..756b435357 100644 --- a/doomsday/plugins/heretic/include/p_local.h +++ b/doomsday/plugins/heretic/include/p_local.h @@ -121,10 +121,6 @@ void P_FireWeapon(player_t* player); boolean P_UndoPlayerMorph(player_t* player); - - -boolean P_MobjChangeState(mobj_t* mo, statenum_t state); -boolean P_SetMobjStateNF(mobj_t* mo, statenum_t state); void P_ThrustMobj(mobj_t* mo, angle_t angle, coord_t move); void P_WindThrust(mobj_t* mo); int P_FaceMobj(mobj_t* source, mobj_t* target, angle_t* delta); diff --git a/doomsday/plugins/heretic/include/p_mobj.h b/doomsday/plugins/heretic/include/p_mobj.h index 73c58ba8a4..dee41bb733 100644 --- a/doomsday/plugins/heretic/include/p_mobj.h +++ b/doomsday/plugins/heretic/include/p_mobj.h @@ -270,7 +270,6 @@ mobj_t *Vanilla_P_SpawnMissileAngle(mobj_t *source, mobjtype_t type, angle_t ang mobj_t* P_SpawnTeleFog(coord_t x, coord_t y, angle_t angle); -const terraintype_t* P_MobjGetFloorTerrainType(mobj_t* mobj); coord_t P_MobjGetFriction(mobj_t* mobj); #ifdef __cplusplus diff --git a/doomsday/plugins/heretic/src/p_enemy.c b/doomsday/plugins/heretic/src/p_enemy.c index 18b80b1bcd..f799f023ba 100644 --- a/doomsday/plugins/heretic/src/p_enemy.c +++ b/doomsday/plugins/heretic/src/p_enemy.c @@ -1350,7 +1350,7 @@ void C_DECL A_MinotaurDecide(mobj_t* actor) { // Charge attack. // Don't call the state function right away. - P_SetMobjStateNF(actor, S_MNTR_ATK4_1); + P_MobjChangeStateNoAction(actor, S_MNTR_ATK4_1); actor->flags |= MF_SKULLFLY; A_FaceTarget(actor); @@ -2335,12 +2335,12 @@ void C_DECL A_FlameSnd(mobj_t* actor) void C_DECL A_HideThing(mobj_t* actor) { - //P_MobjUnsetOrigin(actor); + //P_MobjUnlink(actor); actor->flags2 |= MF2_DONTDRAW; } void C_DECL A_UnHideThing(mobj_t* actor) { - //P_MobjSetOrigin(actor); + //P_MobjLink(actor); actor->flags2 &= ~MF2_DONTDRAW; } diff --git a/doomsday/plugins/heretic/src/p_mobj.c b/doomsday/plugins/heretic/src/p_mobj.c index aed5a22190..3ecab7ec61 100644 --- a/doomsday/plugins/heretic/src/p_mobj.c +++ b/doomsday/plugins/heretic/src/p_mobj.c @@ -45,56 +45,6 @@ mobjtype_t puffType; mobj_t *missileMobj; -terraintype_t const *P_MobjGetFloorTerrainType(mobj_t *mobj) -{ - return P_PlaneMaterialTerrainType(Mobj_Sector(mobj), PLN_FLOOR); -} - -/** - * @return @c true, if the mobj is still present. - */ -boolean P_MobjChangeState(mobj_t *mobj, statenum_t state) -{ - state_t *st; - - if(state == S_NULL) - { - // Remove mobj. - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - P_MobjSetState(mobj, state); - mobj->turnTime = false; // $visangle-facetarget. - - st = &STATES[state]; - if(Mobj_ActionFunctionAllowed(mobj)) - { - if(st->action) st->action(mobj); // Call action function. - } - - return true; -} - -/** - * Same as P_MobjChangeState, but does not call the state function. - */ -boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state) -{ - if(state == S_NULL) - { // Remove mobj. - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - mobj->turnTime = false; // $visangle-facetarget - P_MobjSetState(mobj, state); - - return true; -} - void P_ExplodeMissile(mobj_t *mo) { if(!mo->info) return; @@ -1062,7 +1012,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, mo->special3 = 1000; // Link the mobj into the world. - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->dropOffZ = mo->floorZ; @@ -1098,7 +1048,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, if((mo->flags2 & MF2_FLOORCLIP) && FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); + const terraintype_t* tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { @@ -1140,7 +1090,7 @@ void P_RepositionMace(mobj_t *mo) return; } - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); { mo->origin[VX] = mapSpot->origin[VX]; mo->origin[VY] = mapSpot->origin[VY]; @@ -1151,7 +1101,7 @@ void P_RepositionMace(mobj_t *mo) mo->ceilingZ = P_GetDoublep(sector, DMU_CEILING_HEIGHT); } - P_MobjSetOrigin(mo); + P_MobjLink(mo); #if _DEBUG Con_Message("P_RepositionMace: Mobj [%p], thinkerId:%i - now at (%.2f, %.2f, %.2f).", @@ -1239,7 +1189,7 @@ boolean P_HitFloor(mobj_t* thing) break; } - tt = P_MobjGetFloorTerrainType(thing); + tt = P_MobjFloorTerrain(thing); if(tt->flags & TTF_SPAWN_SPLASHES) { P_SpawnMobjXYZ(MT_SPLASHBASE, thing->origin[VX], thing->origin[VY], diff --git a/doomsday/plugins/heretic/src/p_oldsvg.c b/doomsday/plugins/heretic/src/p_oldsvg.c index f780fbade9..7162e60f1f 100644 --- a/doomsday/plugins/heretic/src/p_oldsvg.c +++ b/doomsday/plugins/heretic/src/p_oldsvg.c @@ -346,7 +346,7 @@ static void SV_v13_ReadMobj(void) mo->player->plr->mo = mo; mo->player->plr->mo->dPlayer = mo->player->plr; } - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->ceilingZ = P_GetDoublep(Mobj_Sector(mo), DMU_CEILING_HEIGHT); } diff --git a/doomsday/plugins/heretic/src/p_telept.c b/doomsday/plugins/heretic/src/p_telept.c index ed3cf69cd8..fff3157f7a 100644 --- a/doomsday/plugins/heretic/src/p_telept.c +++ b/doomsday/plugins/heretic/src/p_telept.c @@ -120,7 +120,7 @@ boolean P_Teleport(mobj_t* mo, coord_t x, coord_t y, angle_t angle, boolean spaw if(FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/hexen/include/p_local.h b/doomsday/plugins/hexen/include/p_local.h index cd55c77664..32cbd471a6 100644 --- a/doomsday/plugins/hexen/include/p_local.h +++ b/doomsday/plugins/hexen/include/p_local.h @@ -121,13 +121,9 @@ void P_MobjThinker(void *mo); boolean P_HealRadius(player_t* plr); void P_BlastRadius(player_t* plr); -boolean P_MobjChangeState(mobj_t* mo, statenum_t state); -boolean P_SetMobjStateNF(mobj_t* mo, statenum_t state); - boolean P_CheckMissileSpawn(mobj_t* mo); coord_t P_MobjGetFriction(mobj_t* mo); void P_RipperBlood(mobj_t* mo); -const terraintype_t* P_MobjGetFloorTerrainType(mobj_t* mo); boolean P_HitFloor(mobj_t* mo); void P_NoiseAlert(mobj_t* target, mobj_t* emmiter); diff --git a/doomsday/plugins/hexen/src/a_action.c b/doomsday/plugins/hexen/src/a_action.c index bb37aa0152..35eb1caf8d 100644 --- a/doomsday/plugins/hexen/src/a_action.c +++ b/doomsday/plugins/hexen/src/a_action.c @@ -1,57 +1,34 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file a_action.c * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * a_action.c: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -// HEADER FILES ------------------------------------------------------------ - #include #include #include "jhexen.h" #include "p_map.h" - -// MACROS ------------------------------------------------------------------ +#include "mobj.h" #define TELEPORT_LIFE (1) -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - static coord_t* orbitTableX = NULL; static coord_t* orbitTableY = NULL; @@ -59,10 +36,6 @@ coord_t* FloatBobOffset = NULL; int localQuakeHappening[MAXPLAYERS]; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - void X_CreateLUTs(void) { #define ORBITRES 256 @@ -299,7 +272,7 @@ void C_DECL A_BridgeOrbit(mobj_t* actor) } actor->args[0] += 3; - P_MobjUnsetOrigin(actor); + P_MobjUnlink(actor); actor->origin[VX] = actor->target->origin[VX]; actor->origin[VY] = actor->target->origin[VY]; @@ -307,7 +280,7 @@ void C_DECL A_BridgeOrbit(mobj_t* actor) actor->origin[VX] += orbitTableX[actor->args[0]]; actor->origin[VY] += orbitTableY[actor->args[0]]; - P_MobjSetOrigin(actor); + P_MobjLink(actor); } void C_DECL A_BridgeInit(mobj_t* actor) @@ -513,7 +486,7 @@ void C_DECL A_FogMove(mobj_t* actor) if(actor->args[3]-- <= 0) { - P_SetMobjStateNF(actor, P_GetState(actor->type, SN_DEATH)); + P_MobjChangeStateNoAction(actor, P_GetState(actor->type, SN_DEATH)); return; } @@ -806,9 +779,9 @@ void C_DECL A_ThrustRaise(mobj_t* actor) { // Reached it's target height. actor->args[0] = 1; if(actor->args[1]) - P_SetMobjStateNF(actor, S_BTHRUSTINIT2_1); + P_MobjChangeStateNoAction(actor, S_BTHRUSTINIT2_1); else - P_SetMobjStateNF(actor, S_THRUSTINIT2_1); + P_MobjChangeStateNoAction(actor, S_THRUSTINIT2_1); } // Lose the dirt clump. @@ -830,9 +803,9 @@ void C_DECL A_ThrustLower(mobj_t *actor) { actor->args[0] = 0; if(actor->args[1]) - P_SetMobjStateNF(actor, S_BTHRUSTINIT1_1); + P_MobjChangeStateNoAction(actor, S_BTHRUSTINIT1_1); else - P_SetMobjStateNF(actor, S_THRUSTINIT1_1); + P_MobjChangeStateNoAction(actor, S_THRUSTINIT1_1); } } diff --git a/doomsday/plugins/hexen/src/p_enemy.c b/doomsday/plugins/hexen/src/p_enemy.c index d63a2f437d..7112251840 100644 --- a/doomsday/plugins/hexen/src/p_enemy.c +++ b/doomsday/plugins/hexen/src/p_enemy.c @@ -1046,11 +1046,11 @@ void C_DECL A_MinotaurLook(mobj_t* actor) if(actor->target) { - P_SetMobjStateNF(actor, S_MNTR_WALK1); + P_MobjChangeStateNoAction(actor, S_MNTR_WALK1); } else { - P_SetMobjStateNF(actor, S_MNTR_ROAM1); + P_MobjChangeStateNoAction(actor, S_MNTR_ROAM1); } } @@ -1149,7 +1149,7 @@ void C_DECL A_MinotaurDecide(mobj_t* actor) { // Charge attack. // Don't call the state function right away. - P_SetMobjStateNF(actor, S_MNTR_ATK4_1); + P_MobjChangeStateNoAction(actor, S_MNTR_ATK4_1); actor->flags |= MF_SKULLFLY; A_FaceTarget(actor); @@ -2072,7 +2072,7 @@ void C_DECL A_SerpentHeadCheck(mobj_t *actor) { if(actor->origin[VZ] <= actor->floorZ) { - const terraintype_t* tt = P_MobjGetFloorTerrainType(actor); + const terraintype_t* tt = P_MobjFloorTerrain(actor); if(tt->flags & TTF_NONSOLID) { @@ -3368,7 +3368,7 @@ void C_DECL A_SorcBallOrbit(mobj_t* actor) { // Put sorcerer into special throw spell anim. if(parent->health > 0) - P_SetMobjStateNF(parent, S_SORC_ATTACK1); + P_MobjChangeStateNoAction(parent, S_SORC_ATTACK1); if(actor->type == MT_SORCBALL1 && P_Random() < 200) { @@ -3394,7 +3394,7 @@ void C_DECL A_SorcBallOrbit(mobj_t* actor) parent->args[3] = SORC_STOPPED; // Back to orbit balls. if(parent->health > 0) - P_SetMobjStateNF(parent, S_SORC_ATTACK4); + P_MobjChangeStateNoAction(parent, S_SORC_ATTACK4); } else { @@ -3417,7 +3417,7 @@ void C_DECL A_SorcBallOrbit(mobj_t* actor) } actor->special1 = angle; // Set previous angle. - P_MobjUnsetOrigin(actor); + P_MobjUnlink(actor); actor->origin[VX] = parent->origin[VX]; actor->origin[VY] = parent->origin[VY]; @@ -3429,7 +3429,7 @@ void C_DECL A_SorcBallOrbit(mobj_t* actor) actor->origin[VZ] += parent->info->height; actor->origin[VZ] -= parent->floorClip; - P_MobjSetOrigin(actor); + P_MobjLink(actor); } /** @@ -3540,7 +3540,7 @@ void C_DECL A_CastSorcererSpell(mobj_t* mo) // Put sorcerer into throw spell animation. if(parent->health > 0) - P_SetMobjStateNF(parent, S_SORC_ATTACK4); + P_MobjChangeStateNoAction(parent, S_SORC_ATTACK4); switch(spell) { @@ -3719,7 +3719,7 @@ void C_DECL A_SorcFX2Split(mobj_t* mo) pmo->target = mo->target; pmo->args[0] = 0; // CW. pmo->special1 = mo->angle; // Set angle. - P_SetMobjStateNF(pmo, S_SORCFX2_ORBIT1); + P_MobjChangeStateNoAction(pmo, S_SORCFX2_ORBIT1); } if((pmo = P_SpawnMobj(MT_SORCFX2, mo->origin, mo->angle, 0))) @@ -3727,10 +3727,10 @@ void C_DECL A_SorcFX2Split(mobj_t* mo) pmo->target = mo->target; pmo->args[0] = 1; // CCW. pmo->special1 = mo->angle; // Set angle. - P_SetMobjStateNF(pmo, S_SORCFX2_ORBIT1); + P_MobjChangeStateNoAction(pmo, S_SORCFX2_ORBIT1); } - P_SetMobjStateNF(mo, S_NULL); + P_MobjChangeStateNoAction(mo, S_NULL); } /** @@ -3752,14 +3752,14 @@ void C_DECL A_SorcFX2Orbit(mobj_t* mo) if(parent->health <= 0 || // Sorcerer is dead. !parent->args[0]) // Time expired. { - P_SetMobjStateNF(mo, P_GetState(mo->type, SN_DEATH)); + P_MobjChangeStateNoAction(mo, P_GetState(mo->type, SN_DEATH)); parent->args[0] = 0; parent->flags2 &= ~(MF2_REFLECTIVE | MF2_INVULNERABLE); } if(mo->args[0] && (parent->args[0]-- <= 0)) // Time expired. { - P_SetMobjStateNF(mo, P_GetState(mo->type, SN_DEATH)); + P_MobjChangeStateNoAction(mo, P_GetState(mo->type, SN_DEATH)); parent->args[0] = 0; parent->flags2 &= ~MF2_REFLECTIVE; } @@ -3786,13 +3786,13 @@ void C_DECL A_SorcFX2Orbit(mobj_t* mo) // Spawn trailer. P_SpawnMobj(MT_SORCFX2_T1, pos, angle, 0); - P_MobjUnsetOrigin(mo); + P_MobjUnlink(mo); mo->origin[VX] = pos[VX]; mo->origin[VY] = pos[VY]; mo->origin[VZ] = pos[VZ]; - P_MobjSetOrigin(mo); + P_MobjLink(mo); } /** @@ -3831,7 +3831,7 @@ void C_DECL A_SorcFX4Check(mobj_t* mo) { if(mo->special2-- <= 0) { - P_SetMobjStateNF(mo, P_GetState(mo->type, SN_DEATH)); + P_MobjChangeStateNoAction(mo, P_GetState(mo->type, SN_DEATH)); } } @@ -4087,7 +4087,7 @@ void C_DECL A_FreezeDeath(mobj_t* mo) void C_DECL A_IceSetTics(mobj_t* mo) { - const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); + const terraintype_t* tt = P_MobjFloorTerrain(mo); mo->tics = 70 + (P_Random() & 63); diff --git a/doomsday/plugins/hexen/src/p_inter.c b/doomsday/plugins/hexen/src/p_inter.c index b5508271df..ecd6c8ec15 100644 --- a/doomsday/plugins/hexen/src/p_inter.c +++ b/doomsday/plugins/hexen/src/p_inter.c @@ -1,26 +1,22 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_inter.c * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #include @@ -33,6 +29,7 @@ #include "hu_inventory.h" #include "p_player.h" #include "p_map.h" +#include "mobj.h" #include "p_user.h" #define BONUSADD (6) diff --git a/doomsday/plugins/hexen/src/p_mobj.c b/doomsday/plugins/hexen/src/p_mobj.c index 56e562090f..2b404f346a 100644 --- a/doomsday/plugins/hexen/src/p_mobj.c +++ b/doomsday/plugins/hexen/src/p_mobj.c @@ -52,56 +52,6 @@ extern mobj_t lavaInflictor; mobjtype_t PuffType; mobj_t *MissileMobj; -terraintype_t const *P_MobjGetFloorTerrainType(mobj_t *mobj) -{ - return P_PlaneMaterialTerrainType(Mobj_Sector(mobj), PLN_FLOOR); -} - -/** - * @return @c true if the mobj is still present. - */ -boolean P_MobjChangeState(mobj_t *mobj, statenum_t state) -{ - state_t *st; - - if(state == S_NULL) - { - // Remove mobj. - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - P_MobjSetState(mobj, state); - mobj->turnTime = false; // $visangle-facetarget - - if(Mobj_ActionFunctionAllowed(mobj)) - { - st = &STATES[state]; - if(st->action) st->action(mobj); // Call action function. - } - - // Return false if the action function removed the mobj. - return mobj->thinker.function != (thinkfunc_t) NOPFUNC; -} - -/** - * Same as P_MobjChangeState, but does not call the state function. - */ -boolean P_SetMobjStateNF(mobj_t* mobj, statenum_t state) -{ - if(state == S_NULL) - { // Remove mobj - mobj->state = (state_t *) S_NULL; - P_MobjRemove(mobj, false); - return false; - } - - mobj->turnTime = false; // $visangle-facetarget - P_MobjSetState(mobj, state); - return true; -} - void P_ExplodeMissile(mobj_t* mo) { mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; @@ -326,7 +276,7 @@ coord_t P_MobjGetFriction(mobj_t* mo) } else { - const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); + const terraintype_t* tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FRICTION_LOW) return FRICTION_LOW; @@ -816,7 +766,7 @@ void P_MobjMoveZ(mobj_t* mo) else if(!mo->player->morphTics) { const terraintype_t* tt = - P_MobjGetFloorTerrainType(mo); + P_MobjFloorTerrain(mo); if(!(tt->flags & TTF_NONSOLID)) S_StartSound(SFX_PLAYER_LAND, mo); @@ -1228,7 +1178,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, P_MobjSetState(mo, P_GetState(mo->type, SN_SPAWN)); // Link the mobj into the world. - P_MobjSetOrigin(mo); + P_MobjLink(mo); mo->floorZ = P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT); mo->ceilingZ = P_GetDoublep(Mobj_Sector(mo), DMU_CEILING_HEIGHT); @@ -1265,7 +1215,7 @@ mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, if((mo->flags2 & MF2_FLOORCLIP) && FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - terraintype_t const *tt = P_MobjGetFloorTerrainType(mo); + terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) mo->floorClip = 10; } @@ -1388,7 +1338,7 @@ boolean P_HitFloor(mobj_t *thing) if(thing->info->mass < 10) smallsplash = true; - tt = P_MobjGetFloorTerrainType(thing); + tt = P_MobjFloorTerrain(thing); if(tt->flags & TTF_SPAWN_SPLASHES) { if(smallsplash) diff --git a/doomsday/plugins/hexen/src/p_pspr.c b/doomsday/plugins/hexen/src/p_pspr.c index dc5c86be47..1f0d538c0d 100644 --- a/doomsday/plugins/hexen/src/p_pspr.c +++ b/doomsday/plugins/hexen/src/p_pspr.c @@ -1,37 +1,26 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_pspr.c Weapon sprite animation. * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * Weapon sprite animation, weapon objects. Action functions for weapons. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -/** - * p_pspr.c: Weapon sprite animation. - * - * Weapon sprite animation, weapon objects. - * Action functions for weapons. - */ - -// HEADER FILES ------------------------------------------------------------ - #include #include "common.h" @@ -39,10 +28,9 @@ #include "p_player.h" #include "p_map.h" +#include "mobj.h" #include "p_inventory.h" -// MACROS ------------------------------------------------------------------ - #define LOWERSPEED (6) #define RAISESPEED (6) #define WEAPONBOTTOM (128) @@ -60,18 +48,6 @@ #define SHARDSPAWN_UP (4) #define SHARDSPAWN_DOWN (8) -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - float bulletSlope; weaponinfo_t weaponInfo[NUM_WEAPON_TYPES][NUM_PLAYER_CLASSES] = { @@ -261,10 +237,6 @@ weaponinfo_t weaponInfo[NUM_WEAPON_TYPES][NUM_PLAYER_CLASSES] = { } }; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - void R_GetWeaponBob(int player, float* x, float* y) { if(x) diff --git a/doomsday/plugins/hexen/src/p_spec.c b/doomsday/plugins/hexen/src/p_spec.c index 7ab16f9776..46cd8eec09 100644 --- a/doomsday/plugins/hexen/src/p_spec.c +++ b/doomsday/plugins/hexen/src/p_spec.c @@ -767,7 +767,7 @@ void P_PlayerInSpecialSector(player_t *player) void P_PlayerOnSpecialFloor(player_t* player) { - const terraintype_t* tt = P_MobjGetFloorTerrainType(player->plr->mo); + const terraintype_t* tt = P_MobjFloorTerrain(player->plr->mo); if(!(tt->flags & TTF_DAMAGING)) return; diff --git a/doomsday/plugins/hexen/src/p_telept.c b/doomsday/plugins/hexen/src/p_telept.c index 284f4577e7..1369be667c 100644 --- a/doomsday/plugins/hexen/src/p_telept.c +++ b/doomsday/plugins/hexen/src/p_telept.c @@ -185,7 +185,7 @@ boolean P_Teleport(mobj_t* mo, coord_t x, coord_t y, angle_t angle, boolean useF if(FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { - const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); + const terraintype_t* tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; diff --git a/doomsday/plugins/hexen/src/p_things.c b/doomsday/plugins/hexen/src/p_things.c index 7f38ecf0f1..3a14e106f2 100644 --- a/doomsday/plugins/hexen/src/p_things.c +++ b/doomsday/plugins/hexen/src/p_things.c @@ -1,55 +1,32 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_things.c * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * p_things.c: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -// HEADER FILES ------------------------------------------------------------ - #include "jhexen.h" #include "p_map.h" - -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- +#include "mobj.h" static boolean ActivateThing(mobj_t *mobj); static boolean DeactivateThing(mobj_t *mobj); -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - mobjtype_t TranslateThingType[] = { MT_MAPSPOT, // T_NONE MT_CENTAUR, // T_CENTAUR @@ -162,10 +139,6 @@ mobjtype_t TranslateThingType[] = { MT_WRAITHFX2 // T_SPARK_DRIP }; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - boolean EV_ThingProjectile(byte* args, boolean gravity) { uint an;