diff --git a/doomsday/plugins/jheretic/include/h_config.h b/doomsday/plugins/jheretic/include/h_config.h index ca212e505c..64d87e52f8 100644 --- a/doomsday/plugins/jheretic/include/h_config.h +++ b/doomsday/plugins/jheretic/include/h_config.h @@ -154,7 +154,7 @@ typedef struct jheretic_config_s { */ byte monstersStuckInDoors; byte avoidDropoffs; - byte moveBlock; // Dont handle large negative movement in P_TryMove. + byte moveBlock; // Dont handle large negative movement in P_TryMoveXY. byte wallRunNorthOnly; // If handle large make exception for wallrunning byte fallOff; // Objects fall under their own weight. diff --git a/doomsday/plugins/jheretic/include/p_local.h b/doomsday/plugins/jheretic/include/p_local.h index cd66255638..b63c1d812d 100644 --- a/doomsday/plugins/jheretic/include/p_local.h +++ b/doomsday/plugins/jheretic/include/p_local.h @@ -104,7 +104,6 @@ void P_PostMorphWeapon(player_t* player, weapontype_t weapon); void P_UpdateBeak(player_t* player, pspdef_t* psp); void P_FireWeapon(player_t* player); -void P_Thrust(player_t* player, angle_t angle, float move); boolean P_UndoPlayerMorph(player_t* player); extern mobjtype_t puffType; @@ -112,12 +111,11 @@ extern mobj_t* missileMobj; 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, float move); +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); boolean P_SeekerMissile(mobj_t* actor, angle_t thresh, angle_t turnMax); void P_MobjThinker(mobj_t* mo); -void P_SpawnBloodSplatter(float x, float y, float z, mobj_t* originator); void P_RipperBlood(mobj_t* mo); boolean P_HitFloor(mobj_t* thing); boolean P_CheckMissileSpawn(mobj_t* missile); diff --git a/doomsday/plugins/jheretic/include/p_mobj.h b/doomsday/plugins/jheretic/include/p_mobj.h index a973fd4144..0c49f49016 100644 --- a/doomsday/plugins/jheretic/include/p_mobj.h +++ b/doomsday/plugins/jheretic/include/p_mobj.h @@ -1,4 +1,4 @@ -/**\file +/**\file p_mobj.h *\section License * License: GPL * Online License Link: http://www.gnu.org/licenses/gpl.html @@ -24,11 +24,11 @@ */ /** - * p_mobj.h: Map Objects, MObj, definition and handling. + * Map Objects, MObj, definition and handling. */ -#ifndef __P_MOBJ_H__ -#define __P_MOBJ_H__ +#ifndef LIBHERETIC_P_MOBJ_H +#define LIBHERETIC_P_MOBJ_H #ifndef __JHERETIC__ # error "Using jHeretic headers without __JHERETIC__" @@ -38,15 +38,15 @@ #include "h_think.h" #include "info.h" -#define NOMOM_THRESHOLD (0.00000001f) // (integer) 0 -#define DROPOFFMOM_THRESHOLD (0.25f) // FRACUNIT/4 +#define NOMOM_THRESHOLD (0.0001) // (integer) 0 +#define DROPOFFMOM_THRESHOLD (0.25) // FRACUNIT/4 #define MAXMOM (30) // 30*FRACUNIT #define MAXMOMSTEP (15) // 30*FRACUNIT/2 -#define FRICTION_LOW (0.97265625f) // 0xf900 -#define FRICTION_FLY (0.91796875f) // 0xeb00 -#define FRICTION_NORMAL (0.90625000f) // 0xe800 -#define FRICTION_HIGH (0.41992187f) // 0xd700/2 +#define FRICTION_LOW (0.97265625) // 0xf900 +#define FRICTION_FLY (0.91796875) // 0xeb00 +#define FRICTION_NORMAL (0.90625000) // 0xe800 +#define FRICTION_HIGH (0.41992187) // 0xd700/2 /** * Mobj flags @@ -187,14 +187,14 @@ typedef struct mobj_s { int special3; // Special info int moveDir; // 0-7 int moveCount; // when 0, select a new dir - struct mobj_s *target; // thing being chased/attacked (or NULL) + struct mobj_s* target; // thing being chased/attacked (or NULL) // also the originator for missiles // used by player to freeze a bit after // teleporting int threshold; // if >0, the target will be chased int intFlags; // $dropoff_fix: internal flags - float dropOffZ; // $dropoff_fix + coord_t dropOffZ; // $dropoff_fix short gear; // used in torque simulation boolean wallRun; // true = last move was the result of a wallrun @@ -204,16 +204,16 @@ typedef struct mobj_s { // For nightmare/multiplayer respawn. struct { - float pos[3]; + coord_t origin[3]; angle_t angle; int flags; // MSF_* flags. } spawnSpot; // Thing being chased/attacked for tracers. - struct mobj_s *tracer; + struct mobj_s* tracer; // Used for pod generating. - struct mobj_s *generator; + struct mobj_s* generator; int turnTime; // $visangle-facetarget int corpseTics; // $vanish: how long has this been dead? @@ -226,21 +226,44 @@ typedef struct polyobj_s { // Heretic-specific data: } Polyobj; -mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, - angle_t angle, int spawnFlags); -mobj_t* P_SpawnMobj3fv(mobjtype_t type, const float pos[3], - angle_t angle, int spawnFlags); +mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, angle_t angle, int spawnFlags); +mobj_t* P_SpawnMobj(mobjtype_t type, coord_t const pos[3], angle_t angle, int spawnFlags); -void P_SpawnPuff(float x, float y, float z, angle_t angle); -void P_SpawnBlood(float x, float y, float z, int damage, - angle_t angle); -mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, - boolean checkSpawn); -mobj_t* P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, - angle_t angle, float momz); -mobj_t* P_SpawnTeleFog(float x, float y, angle_t angle); +void P_SpawnPuff(coord_t x, coord_t y, coord_t z, angle_t angle); -const terraintype_t* P_MobjGetFloorTerrainType(mobj_t *thing); -float P_MobjGetFriction(mobj_t *mo); +void P_SpawnBlood(coord_t x, coord_t y, coord_t z, int damage, angle_t angle); +void P_SpawnBloodSplatter(coord_t x, coord_t y, coord_t z, mobj_t* originator); -#endif +/** + * Tries to aim at a nearby monster if source is a player. Else aim is + * taken at dest. + * + * @param source The mobj doing the shooting. + * @param dest The mobj being shot at. Can be @c NULL if source + * is a player. + * @param type The type of mobj to be shot. + * @param checkSpawn @c true call P_CheckMissileSpawn. + * + * @return Pointer to the newly spawned missile. + */ +mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, boolean checkSpawn); + +/** + * Tries to aim at a nearby monster if 'source' is a player. Else aim is + * the angle of the source mobj. Z angle is specified with momZ. + * + * @param type The type of mobj to be shot. + * @param source The mobj doing the shooting. + * @param angle The X/Y angle to shoot the missile in. + * @param momZ The Z momentum of the missile to be spawned. + * + * @return Pointer to the newly spawned missile. + */ +mobj_t* P_SpawnMissileAngle(mobjtype_t type, mobj_t* source, angle_t angle, coord_t momz); + +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); + +#endif /// LIBHERETIC_P_MOBJ_H diff --git a/doomsday/plugins/jheretic/include/p_spec.h b/doomsday/plugins/jheretic/include/p_spec.h index e465a9fd61..a75e88863f 100644 --- a/doomsday/plugins/jheretic/include/p_spec.h +++ b/doomsday/plugins/jheretic/include/p_spec.h @@ -80,7 +80,7 @@ typedef enum { build16 // Slowly build by 16. } stair_e; -result_e T_MovePlane(Sector* sector, float speed, float dest, +result_e T_MovePlane(Sector* sector, float speed, coord_t dest, int crush, int floorOrCeiling, int direction); int EV_BuildStairs(LineDef* line, stair_e type); diff --git a/doomsday/plugins/jheretic/include/st_stuff.h b/doomsday/plugins/jheretic/include/st_stuff.h index 5c23faf2c6..fac45c2391 100644 --- a/doomsday/plugins/jheretic/include/st_stuff.h +++ b/doomsday/plugins/jheretic/include/st_stuff.h @@ -117,9 +117,9 @@ float ST_AutomapOpacity(int player); boolean ST_AutomapObscures2(int player, const RectRaw* region); boolean ST_AutomapObscures(int player, int x, int y, int width, int height); -int ST_AutomapAddPoint(int player, float x, float y, float z); +int ST_AutomapAddPoint(int player, coord_t x, coord_t y, coord_t z); void ST_AutomapClearPoints(int player); -boolean ST_AutomapPointOrigin(int player, int point, float* x, float* y, float* z); +boolean ST_AutomapPointOrigin(int player, int point, coord_t* x, coord_t* y, coord_t* z); void ST_SetAutomapCameraRotation(int player, boolean on); diff --git a/doomsday/plugins/jheretic/src/h_api.c b/doomsday/plugins/jheretic/src/h_api.c index 1a623fe991..2096923c2a 100644 --- a/doomsday/plugins/jheretic/src/h_api.c +++ b/doomsday/plugins/jheretic/src/h_api.c @@ -187,9 +187,9 @@ game_export_t* GetGameAPI(game_import_t* imports) gx.Responder = G_Responder; gx.EndFrame = H_EndFrame; gx.MobjThinker = P_MobjThinker; - gx.MobjFriction = (float (*)(void *)) P_MobjGetFriction; - gx.MobjCheckPosition3f = P_CheckPosition3f; - gx.MobjTryMove3f = P_TryMove3f; + gx.MobjFriction = (coord_t (*)(void *)) P_MobjGetFriction; + gx.MobjCheckPositionXYZ = P_CheckPositionXYZ; + gx.MobjTryMoveXYZ = P_TryMoveXYZ; gx.SectorHeightChangeNotification = P_HandleSectorHeightChange; gx.UpdateState = G_UpdateState; diff --git a/doomsday/plugins/jheretic/src/m_cheat.c b/doomsday/plugins/jheretic/src/m_cheat.c index 5955612462..48180937c8 100644 --- a/doomsday/plugins/jheretic/src/m_cheat.c +++ b/doomsday/plugins/jheretic/src/m_cheat.c @@ -384,8 +384,8 @@ static void printDebugInfo(int player) mapUri = G_ComposeMapUri(gameEpisode, gameMap); mapPath = Uri_ToString(mapUri); sprintf(textBuffer, "MAP [%s] X:%g Y:%g Z:%g", - Str_Text(mapPath), plr->plr->mo->pos[VX], plr->plr->mo->pos[VY], - plr->plr->mo->pos[VZ]); + Str_Text(mapPath), plr->plr->mo->origin[VX], plr->plr->mo->origin[VY], + plr->plr->mo->origin[VZ]); P_SetMessage(plr, textBuffer, false); Uri_Delete(mapUri); @@ -396,13 +396,13 @@ static void printDebugInfo(int player) uri = Materials_ComposeUri(P_GetIntp(sub, DMU_FLOOR_MATERIAL)); path = Uri_ToString(uri); - Con_Message(" FloorZ:%g Material:%s\n", P_GetFloatp(sub, DMU_FLOOR_HEIGHT), Str_Text(path)); + Con_Message(" FloorZ:%g Material:%s\n", P_GetDoublep(sub, DMU_FLOOR_HEIGHT), Str_Text(path)); Str_Delete(path); Uri_Delete(uri); uri = Materials_ComposeUri(P_GetIntp(sub, DMU_CEILING_MATERIAL)); path = Uri_ToString(uri); - Con_Message(" CeilingZ:%g Material:%s\n", P_GetFloatp(sub, DMU_CEILING_HEIGHT), Str_Text(path)); + Con_Message(" CeilingZ:%g Material:%s\n", P_GetDoublep(sub, DMU_CEILING_HEIGHT), Str_Text(path)); Str_Delete(path); Uri_Delete(uri); diff --git a/doomsday/plugins/jheretic/src/p_enemy.c b/doomsday/plugins/jheretic/src/p_enemy.c index e82628b868..2ed3578198 100644 --- a/doomsday/plugins/jheretic/src/p_enemy.c +++ b/doomsday/plugins/jheretic/src/p_enemy.c @@ -75,7 +75,7 @@ extern LineDef *blockLine; // $unstuck: blocking linedef // Eight directional movement speeds. #define MOVESPEED_DIAGONAL (0.71716309f) -static const float dirSpeed[8][2] = +static const coord_t dirSpeed[8][2] = { {1, 0}, {MOVESPEED_DIAGONAL, MOVESPEED_DIAGONAL}, @@ -93,7 +93,7 @@ int bodyqueslot; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static float dropoffDelta[2], floorZ; +static coord_t dropoffDelta[2], floorZ; // CODE -------------------------------------------------------------------- @@ -107,27 +107,29 @@ void P_ClearBodyQueue(void) * If a monster yells at a player, it will alert other monsters to the * player's whereabouts. */ -void P_NoiseAlert(mobj_t *target, mobj_t *emitter) +void P_NoiseAlert(mobj_t* target, mobj_t* emitter) { VALIDCOUNT++; P_RecursiveSound(target, P_GetPtrp(emitter->bspLeaf, DMU_SECTOR), 0); } -boolean P_CheckMeleeRange(mobj_t *actor) +boolean P_CheckMeleeRange(mobj_t* actor) { - mobj_t *pl; - float dist, range; + mobj_t* pl; + coord_t dist, range; if(!actor->target) return false; pl = actor->target; - dist = P_ApproxDistance(pl->pos[VX] - actor->pos[VX], - pl->pos[VY] - actor->pos[VY]); + dist = M_ApproxDistance(pl->origin[VX] - actor->origin[VX], + pl->origin[VY] - actor->origin[VY]); + if(!cfg.netNoMaxZMonsterMeleeAttack) - { // Account for Z height difference. - if(pl->pos[VZ] > actor->pos[VZ] + actor->height || - pl->pos[VZ] + pl->height < actor->pos[VZ]) + { + // Account for Z height difference. + if(pl->origin[VZ] > actor->origin[VZ] + actor->height || + pl->origin[VZ] + pl->height < actor->origin[VZ]) return false; } @@ -141,9 +143,9 @@ boolean P_CheckMeleeRange(mobj_t *actor) return true; } -boolean P_CheckMissileRange(mobj_t *actor) +boolean P_CheckMissileRange(mobj_t* actor) { - float dist; + coord_t dist; if(!P_CheckSight(actor, actor->target)) return false; @@ -157,10 +159,8 @@ boolean P_CheckMissileRange(mobj_t *actor) if(actor->reactionTime) return false; // Don't attack yet - dist = - (P_ApproxDistance - (actor->pos[VX] - actor->target->pos[VX], - actor->pos[VY] - actor->target->pos[VY])) - 64; + dist = M_ApproxDistance(actor->origin[VX] - actor->target->origin[VX], + actor->origin[VY] - actor->target->origin[VY]) - 64; if(P_GetState(actor->type, SN_MELEE) == S_NULL) dist -= 128; // No melee attack, so fire more frequently. @@ -183,11 +183,11 @@ boolean P_CheckMissileRange(mobj_t *actor) * * @return @c false, if the move is blocked. */ -boolean P_Move(mobj_t *actor, boolean dropoff) +boolean P_Move(mobj_t* actor, boolean dropoff) { - float pos[2], step[2]; - LineDef *ld; - boolean good; + coord_t pos[2], step[2]; + LineDef* ld; + boolean good; if(actor->moveDir == DI_NODIR) return false; @@ -197,20 +197,20 @@ boolean P_Move(mobj_t *actor, boolean dropoff) step[VX] = actor->info->speed * dirSpeed[actor->moveDir][VX]; step[VY] = actor->info->speed * dirSpeed[actor->moveDir][VY]; - pos[VX] = actor->pos[VX] + step[VX]; - pos[VY] = actor->pos[VY] + step[VY]; + pos[VX] = actor->origin[VX] + step[VX]; + pos[VY] = actor->origin[VY] + step[VY]; // killough $dropoff_fix. - if(!P_TryMove(actor, pos[VX], pos[VY], dropoff, false)) + if(!P_TryMoveXY(actor, pos[VX], pos[VY], dropoff, false)) { // Open any specials. if((actor->flags & MF_FLOAT) && floatOk) { // Must adjust height. - if(actor->pos[VZ] < tmFloorZ) - actor->pos[VZ] += FLOATSPEED; + if(actor->origin[VZ] < tmFloorZ) + actor->origin[VZ] += FLOATSPEED; else - actor->pos[VZ] -= FLOATSPEED; + actor->origin[VZ] -= FLOATSPEED; actor->flags |= MF_INFLOAT; return true; @@ -262,10 +262,10 @@ boolean P_Move(mobj_t *actor, boolean dropoff) // $dropoff_fix: fall more slowly, under gravity, if fellDown==true if(!(actor->flags & MF_FLOAT) && !fellDown) { - if(actor->pos[VZ] > actor->floorZ) + if(actor->origin[VZ] > actor->floorZ) P_HitFloor(actor); - actor->pos[VZ] = actor->floorZ; + actor->origin[VZ] = actor->floorZ; } return true; @@ -277,7 +277,7 @@ boolean P_Move(mobj_t *actor, boolean dropoff) * If move is either clear of block only by a door, returns TRUE and sets. * If a door is in the way, an OpenDoor call is made to start it opening. */ -boolean P_TryWalk(mobj_t *actor) +boolean P_TryWalk(mobj_t* actor) { // $dropoff_fix if(!P_Move(actor, false)) @@ -287,7 +287,7 @@ boolean P_TryWalk(mobj_t *actor) return true; } -static void newChaseDir(mobj_t *actor, float deltaX, float deltaY) +static void newChaseDir(mobj_t* actor, coord_t deltaX, coord_t deltaY) { dirtype_t xdir, ydir, tdir; dirtype_t olddir = actor->moveDir; @@ -353,13 +353,13 @@ static void newChaseDir(mobj_t *actor, float deltaX, float deltaY) * * In Doom, they were never allowed to hang over dropoffs, and would remain * stuck if involuntarily forced over one. This logic, combined with - * p_map.c::P_TryMove(), allows monsters to free themselves without making + * p_map.c::P_TryMoveXY(), allows monsters to free themselves without making * them tend to hang over dropoffs. */ -static int PIT_AvoidDropoff(LineDef* line, void* data) +static int PIT_AvoidDropoff(LineDef* line, void* parameters) { Sector* backsector = P_GetPtrp(line, DMU_BACK_SECTOR); - AABoxf* aaBox = P_GetPtrp(line, DMU_BOUNDING_BOX); + AABoxd* aaBox = P_GetPtrp(line, DMU_BOUNDING_BOX); if(backsector && // Linedef must be contacted @@ -367,28 +367,27 @@ static int PIT_AvoidDropoff(LineDef* line, void* data) tmBox.maxX > aaBox->minX && tmBox.minY < aaBox->maxY && tmBox.maxY > aaBox->minY && - P_BoxOnLineSide(&tmBox, line) == -1) + !LineDef_BoxOnSide(line, &tmBox)) { - Sector* frontsector = P_GetPtrp(line, DMU_FRONT_SECTOR); - float front = P_GetFloatp(frontsector, DMU_FLOOR_HEIGHT); - float back = P_GetFloatp(backsector, DMU_FLOOR_HEIGHT); - float d1[2]; - angle_t angle; + Sector* frontsector = P_GetPtrp(line, DMU_FRONT_SECTOR); + coord_t front = P_GetDoublep(frontsector, DMU_FLOOR_HEIGHT); + coord_t back = P_GetDoublep(backsector, DMU_FLOOR_HEIGHT); + coord_t d1[2]; + angle_t angle; - P_GetFloatpv(line, DMU_DXY, d1); + P_GetDoublepv(line, DMU_DXY, d1); // The monster must contact one of the two floors, and the other // must be a tall drop off (more than 24). if(back == floorZ && front < floorZ - 24) { - angle = R_PointToAngle2(0, 0, d1[0], d1[1]); // front side drop off + angle = M_PointXYToAngle2(0, 0, d1[0], d1[1]); // front side drop off } else { if(front == floorZ && back < floorZ - 24) - angle = R_PointToAngle2(d1[0], d1[1], 0, 0); // back side drop off - else - return false; + angle = M_PointXYToAngle2(d1[0], d1[1], 0, 0); // back side drop off + return false; } // Move away from drop off at a standard speed. @@ -402,9 +401,9 @@ static int PIT_AvoidDropoff(LineDef* line, void* data) /** * Driver for above */ -static float P_AvoidDropoff(mobj_t *actor) +static coord_t P_AvoidDropoff(mobj_t* actor) { - floorZ = actor->pos[VZ]; // Remember floor height. + floorZ = actor->origin[VZ]; // Remember floor height. dropoffDelta[VX] = dropoffDelta[VY] = 0; @@ -417,18 +416,18 @@ static float P_AvoidDropoff(mobj_t *actor) return !(FEQUAL(dropoffDelta[VX], 0) || FEQUAL(dropoffDelta[VY], 0)); } -void P_NewChaseDir(mobj_t *actor) +void P_NewChaseDir(mobj_t* actor) { - float delta[2]; + coord_t delta[2]; if(!actor->target) Con_Error("P_NewChaseDir: called with no target"); - delta[VX] = actor->target->pos[VX] - actor->pos[VX]; - delta[VY] = actor->target->pos[VY] - actor->pos[VY]; + delta[VX] = actor->target->origin[VX] - actor->origin[VX]; + delta[VY] = actor->target->origin[VY] - actor->origin[VY]; if(actor->floorZ - actor->dropOffZ > 24 && - actor->pos[VZ] <= actor->floorZ && + actor->origin[VZ] <= actor->floorZ && !(actor->flags & (MF_DROPOFF | MF_FLOAT)) && !cfg.avoidDropoffs && P_AvoidDropoff(actor)) { @@ -451,8 +450,8 @@ typedef struct { size_t maxTries; mobj_t* notThis; mobj_t* foundMobj; - float origin[2]; - float maxDistance; + coord_t origin[2]; + coord_t maxDistance; int minHealth; int compFlags; boolean checkLOS; @@ -478,8 +477,8 @@ static int findMobj(thinker_t* th, void* context) // Out of range? if(params->maxDistance > 0 && - P_ApproxDistance(params->origin[VX] - mo->pos[VX], - params->origin[VY] - mo->pos[VY]) > + M_ApproxDistance(params->origin[VX] - mo->origin[VX], + params->origin[VY] - mo->origin[VY]) > params->maxDistance) return false; // Continue iteration. @@ -509,8 +508,8 @@ boolean P_LookForMonsters(mobj_t* mo) params.count = 0; params.notThis = mo; - params.origin[VX] = mo->pos[VX]; - params.origin[VY] = mo->pos[VY]; + params.origin[VX] = mo->origin[VX]; + params.origin[VY] = mo->origin[VY]; params.foundMobj = NULL; params.maxDistance = MONS_LOOK_RANGE; params.maxTries = MONS_LOOK_LIMIT; @@ -545,7 +544,7 @@ boolean P_LookForPlayers(mobj_t* actor, boolean allAround) /** * Stay in state until a player is sighted. */ -void C_DECL A_Look(mobj_t *actor) +void C_DECL A_Look(mobj_t* actor) { mobj_t *targ; Sector *sec; @@ -698,17 +697,14 @@ void C_DECL A_Chase(mobj_t* actor) } } -void C_DECL A_FaceTarget(mobj_t *actor) +void C_DECL A_FaceTarget(mobj_t* actor) { - if(!actor->target) - return; + if(!actor->target) return; actor->turnTime = true; // $visangle-facetarget actor->flags &= ~MF_AMBUSH; - actor->angle = - R_PointToAngle2(actor->pos[VX], actor->pos[VY], - actor->target->pos[VX], actor->target->pos[VY]); + actor->angle = M_PointToAngle2(actor->origin, actor->target->origin); // Is target a ghost? if(actor->target->flags & MF_SHADOW) @@ -717,20 +713,19 @@ void C_DECL A_FaceTarget(mobj_t *actor) } } -void C_DECL A_Pain(mobj_t *actor) +void C_DECL A_Pain(mobj_t* actor) { if(actor->info->painSound) S_StartSound(actor->info->painSound, actor); } -void C_DECL A_DripBlood(mobj_t *actor) +void C_DECL A_DripBlood(mobj_t* actor) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3f(MT_BLOOD, - actor->pos[VX] + FIX2FLT((P_Random() - P_Random()) << 11), - actor->pos[VY] + FIX2FLT((P_Random() - P_Random()) << 11), - actor->pos[VZ], P_Random() << 24, 0))) + if((mo = P_SpawnMobjXYZ(MT_BLOOD, actor->origin[VX] + FIX2FLT((P_Random() - P_Random()) << 11), + actor->origin[VY] + FIX2FLT((P_Random() - P_Random()) << 11), + actor->origin[VZ], P_Random() << 24, 0))) { mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 10); mo->mom[MY] = FIX2FLT((P_Random() - P_Random()) << 10); @@ -739,7 +734,7 @@ void C_DECL A_DripBlood(mobj_t *actor) } } -void C_DECL A_KnightAttack(mobj_t *actor) +void C_DECL A_KnightAttack(mobj_t* actor) { if(!actor->target) return; @@ -766,16 +761,16 @@ void C_DECL A_KnightAttack(mobj_t *actor) void C_DECL A_ImpExplode(mobj_t* actor) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3fv(MT_IMPCHUNK1, actor->pos, P_Random() << 24, 0))) + if((mo = P_SpawnMobj(MT_IMPCHUNK1, actor->origin, P_Random() << 24, 0))) { mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 10); mo->mom[MY] = FIX2FLT((P_Random() - P_Random()) << 10); mo->mom[MZ] = 9; } - if((mo = P_SpawnMobj3fv(MT_IMPCHUNK2, actor->pos, P_Random() << 24, 0))) + if((mo = P_SpawnMobj(MT_IMPCHUNK2, actor->origin, P_Random() << 24, 0))) { mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 10); mo->mom[MY] = FIX2FLT((P_Random() - P_Random()) << 10); @@ -790,10 +785,10 @@ void C_DECL A_BeastPuff(mobj_t* actor) { if(P_Random() > 64) { - P_SpawnMobj3f(MT_PUFFY, - actor->pos[VX] + FIX2FLT((P_Random() - P_Random()) << 10), - actor->pos[VY] + FIX2FLT((P_Random() - P_Random()) << 10), - actor->pos[VZ] + FIX2FLT((P_Random() - P_Random()) << 10), + P_SpawnMobjXYZ(MT_PUFFY, + actor->origin[VX] + FIX2FLT((P_Random() - P_Random()) << 10), + actor->origin[VY] + FIX2FLT((P_Random() - P_Random()) << 10), + actor->origin[VZ] + FIX2FLT((P_Random() - P_Random()) << 10), P_Random() << 24, 0); } } @@ -813,9 +808,9 @@ void C_DECL A_ImpMeAttack(mobj_t* actor) void C_DECL A_ImpMsAttack(mobj_t* actor) { - mobj_t* dest; - uint an; - int dist; + mobj_t* dest; + uint an; + int dist; if(!actor->target || P_Random() > 64) { @@ -834,19 +829,19 @@ void C_DECL A_ImpMsAttack(mobj_t* actor) actor->mom[MX] = 12 * FIX2FLT(finecosine[an]); actor->mom[MY] = 12 * FIX2FLT(finesine[an]); - dist = P_ApproxDistance(dest->pos[VX] - actor->pos[VX], - dest->pos[VY] - actor->pos[VY]); + dist = M_ApproxDistance(dest->origin[VX] - actor->origin[VX], + dest->origin[VY] - actor->origin[VY]); dist /= 12; if(dist < 1) dist = 1; - actor->mom[MZ] = (dest->pos[VZ] + (dest->height /2) - actor->pos[VZ]) / dist; + actor->mom[MZ] = (dest->origin[VZ] + (dest->height /2) - actor->origin[VZ]) / dist; } /** * Fireball attack of the imp leader. */ -void C_DECL A_ImpMsAttack2(mobj_t *actor) +void C_DECL A_ImpMsAttack2(mobj_t* actor) { if(!actor->target) return; @@ -862,16 +857,16 @@ void C_DECL A_ImpMsAttack2(mobj_t *actor) P_SpawnMissile(MT_IMPBALL, actor, actor->target, true); } -void C_DECL A_ImpDeath(mobj_t *actor) +void C_DECL A_ImpDeath(mobj_t* actor) { actor->flags &= ~MF_SOLID; actor->flags2 |= MF2_FLOORCLIP; - if(actor->pos[VZ] <= actor->floorZ) + if(actor->origin[VZ] <= actor->floorZ) P_MobjChangeState(actor, S_IMP_CRASH1); } -void C_DECL A_ImpXDeath1(mobj_t *actor) +void C_DECL A_ImpXDeath1(mobj_t* actor) { actor->flags &= ~MF_SOLID; actor->flags |= MF_NOGRAVITY; @@ -880,24 +875,24 @@ void C_DECL A_ImpXDeath1(mobj_t *actor) actor->special1 = 666; // Flag the crash routine. } -void C_DECL A_ImpXDeath2(mobj_t *actor) +void C_DECL A_ImpXDeath2(mobj_t* actor) { actor->flags &= ~MF_NOGRAVITY; - if(actor->pos[VZ] <= actor->floorZ) + if(actor->origin[VZ] <= actor->floorZ) P_MobjChangeState(actor, S_IMP_CRASH1); } /** * @return @c true, if the chicken morphs. */ -boolean P_UpdateChicken(mobj_t *actor, int tics) +boolean P_UpdateChicken(mobj_t* actor, int tics) { - mobj_t *fog; - float pos[3]; - mobjtype_t moType; - mobj_t *mo; - mobj_t oldChicken; + mobj_t* fog; + coord_t pos[3]; + mobjtype_t moType; + mobj_t* mo; + mobj_t oldChicken; actor->special1 -= tics; @@ -906,21 +901,22 @@ boolean P_UpdateChicken(mobj_t *actor, int tics) moType = actor->special2; - memcpy(pos, actor->pos, sizeof(pos)); + memcpy(pos, actor->origin, sizeof(pos)); //// \fixme Do this properly! memcpy(&oldChicken, actor, sizeof(oldChicken)); - if(!(mo = P_SpawnMobj3fv(moType, pos, oldChicken.angle, 0))) + if(!(mo = P_SpawnMobj(moType, pos, oldChicken.angle, 0))) return false; P_MobjChangeState(actor, S_FREETARGMOBJ); if(P_TestMobjLocation(mo) == false) - { // Didn't fit. + { + // Didn't fit. P_MobjRemove(mo, true); - if((mo = P_SpawnMobj3fv(MT_CHICKEN, pos, oldChicken.angle, 0))) + if((mo = P_SpawnMobj(MT_CHICKEN, pos, oldChicken.angle, 0))) { mo->flags = oldChicken.flags; mo->health = oldChicken.health; @@ -935,14 +931,14 @@ boolean P_UpdateChicken(mobj_t *actor, int tics) mo->target = oldChicken.target; - if((fog = P_SpawnMobj3f(MT_TFOG, pos[VX], pos[VY], + if((fog = P_SpawnMobjXYZ(MT_TFOG, pos[VX], pos[VY], pos[VZ] + TELEFOGHEIGHT, mo->angle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); return true; } -void C_DECL A_ChicAttack(mobj_t *actor) +void C_DECL A_ChicAttack(mobj_t* actor) { if(P_UpdateChicken(actor, 18)) return; @@ -954,7 +950,7 @@ void C_DECL A_ChicAttack(mobj_t *actor) P_DamageMobj(actor->target, actor, actor, 1 + (P_Random() & 1), false); } -void C_DECL A_ChicLook(mobj_t *actor) +void C_DECL A_ChicLook(mobj_t* actor) { if(P_UpdateChicken(actor, 10)) return; @@ -962,7 +958,7 @@ void C_DECL A_ChicLook(mobj_t *actor) A_Look(actor); } -void C_DECL A_ChicChase(mobj_t *actor) +void C_DECL A_ChicChase(mobj_t* actor) { if(P_UpdateChicken(actor, 3)) return; @@ -970,7 +966,7 @@ void C_DECL A_ChicChase(mobj_t *actor) A_Chase(actor); } -void C_DECL A_ChicPain(mobj_t *actor) +void C_DECL A_ChicPain(mobj_t* actor) { if(P_UpdateChicken(actor, 10)) return; @@ -978,7 +974,7 @@ void C_DECL A_ChicPain(mobj_t *actor) S_StartSound(actor->info->painSound, actor); } -void C_DECL A_Feathers(mobj_t *actor) +void C_DECL A_Feathers(mobj_t* actor) { int i, count; mobj_t *mo; @@ -991,9 +987,9 @@ void C_DECL A_Feathers(mobj_t *actor) for(i = 0; i < count; ++i) { - if((mo = P_SpawnMobj3f(MT_FEATHER, - actor->pos[VX], actor->pos[VY], - actor->pos[VZ] + 20, P_Random() << 24, 0))) + if((mo = P_SpawnMobjXYZ(MT_FEATHER, + actor->origin[VX], actor->origin[VY], + actor->origin[VZ] + 20, P_Random() << 24, 0))) { mo->target = actor; @@ -1006,7 +1002,7 @@ void C_DECL A_Feathers(mobj_t *actor) } } -void C_DECL A_MummyAttack(mobj_t *actor) +void C_DECL A_MummyAttack(mobj_t* actor) { if(!actor->target) return; @@ -1026,7 +1022,7 @@ void C_DECL A_MummyAttack(mobj_t *actor) /** * Mummy leader missile attack. */ -void C_DECL A_MummyAttack2(mobj_t *actor) +void C_DECL A_MummyAttack2(mobj_t* actor) { mobj_t *mo; @@ -1052,11 +1048,12 @@ void C_DECL A_MummyFX1Seek(mobj_t* actor) void C_DECL A_MummySoul(mobj_t* mummy) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3f(MT_MUMMYSOUL, - mummy->pos[VX], mummy->pos[VY], mummy->pos[VZ] + 10, - mummy->angle, 0))) + if((mo = P_SpawnMobjXYZ(MT_MUMMYSOUL, mummy->origin[VX], + mummy->origin[VY], + mummy->origin[VZ] + 10, + mummy->angle, 0))) { mo->mom[MZ] = 1; } @@ -1068,7 +1065,7 @@ void C_DECL A_Sor1Pain(mobj_t* actor) A_Pain(actor); } -void C_DECL A_Sor1Chase(mobj_t *actor) +void C_DECL A_Sor1Chase(mobj_t* actor) { if(actor->special1) { @@ -1082,7 +1079,7 @@ void C_DECL A_Sor1Chase(mobj_t *actor) /** * Sorcerer demon attack. */ -void C_DECL A_Srcr1Attack(mobj_t *actor) +void C_DECL A_Srcr1Attack(mobj_t* actor) { mobj_t *mo; angle_t angle; @@ -1137,7 +1134,7 @@ void C_DECL A_SorcererRise(mobj_t* actor) mobj_t* mo; actor->flags &= ~MF_SOLID; - if((mo = P_SpawnMobj3fv(MT_SORCERER2, actor->pos, actor->angle, 0))) + if((mo = P_SpawnMobj(MT_SORCERER2, actor->origin, actor->angle, 0))) { P_MobjChangeState(mo, S_SOR2_RISE1); mo->target = actor->target; @@ -1149,8 +1146,8 @@ void P_DSparilTeleport(mobj_t* actor) // No spots? if(bossSpotCount > 0) { - int i, tries; - const mapspot_t* dest; + int i, tries; + const mapspot_t* dest; i = P_Random(); tries = bossSpotCount; @@ -1158,25 +1155,25 @@ void P_DSparilTeleport(mobj_t* actor) do { dest = &mapSpots[bossSpots[++i % bossSpotCount]]; - if(P_ApproxDistance(actor->pos[VX] - dest->pos[VX], - actor->pos[VY] - dest->pos[VY]) >= 128) - { // A suitable teleport destination is available. - float prevpos[3]; - angle_t oldAngle; + if(M_ApproxDistance(actor->origin[VX] - dest->origin[VX], + actor->origin[VY] - dest->origin[VY]) >= 128) + { + // A suitable teleport destination is available. + coord_t prevpos[3]; + angle_t oldAngle; - memcpy(prevpos, actor->pos, sizeof(prevpos)); + memcpy(prevpos, actor->origin, sizeof(prevpos)); oldAngle = actor->angle; - if(P_TeleportMove(actor, dest->pos[VX], dest->pos[VY], false)) + if(P_TeleportMove(actor, dest->origin[VX], dest->origin[VY], false)) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3fv(MT_SOR2TELEFADE, prevpos, - oldAngle + ANG180, 0))) + if((mo = P_SpawnMobj(MT_SOR2TELEFADE, prevpos, oldAngle + ANG180, 0))) S_StartSound(SFX_TELEPT, mo); P_MobjChangeState(actor, S_SOR2_TELE1); - actor->pos[VZ] = actor->floorZ; + actor->origin[VZ] = actor->floorZ; actor->angle = dest->angle; actor->mom[MX] = actor->mom[MY] = actor->mom[MZ] = 0; S_StartSound(SFX_TELEPT, actor); @@ -1188,15 +1185,14 @@ void P_DSparilTeleport(mobj_t* actor) } } -void C_DECL A_Srcr2Decide(mobj_t *actor) +void C_DECL A_Srcr2Decide(mobj_t* actor) { static int chance[] = { 192, 120, 120, 120, 64, 64, 32, 16, 0 }; // No spots? - if(!bossSpotCount) - return; + if(!bossSpotCount) return; if(P_Random() < chance[actor->health / (actor->info->spawnHealth / 8)]) { @@ -1204,12 +1200,11 @@ void C_DECL A_Srcr2Decide(mobj_t *actor) } } -void C_DECL A_Srcr2Attack(mobj_t *actor) +void C_DECL A_Srcr2Attack(mobj_t* actor) { - int chance; + int chance; - if(!actor->target) - return; + if(!actor->target) return; S_StartSound(actor->info->attackSound, NULL); @@ -1235,13 +1230,13 @@ void C_DECL A_Srcr2Attack(mobj_t *actor) void C_DECL A_BlueSpark(mobj_t* actor) { - int i; + int i; for(i = 0; i < 2; ++i) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3fv(MT_SOR2FXSPARK, actor->pos, P_Random() << 24, 0))) + if((mo = P_SpawnMobj(MT_SOR2FXSPARK, actor->origin, P_Random() << 24, 0))) { mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 9); mo->mom[MY] = FIX2FLT((P_Random() - P_Random()) << 9); @@ -1252,11 +1247,11 @@ void C_DECL A_BlueSpark(mobj_t* actor) void C_DECL A_GenWizard(mobj_t* actor) { - mobj_t* mo, *fog; + mobj_t* mo, *fog; - if(!(mo = P_SpawnMobj3f(MT_WIZARD, actor->pos[VX], actor->pos[VY], - actor->pos[VZ] - (MOBJINFO[MT_WIZARD].height / 2), - actor->angle, 0))) + if(!(mo = P_SpawnMobjXYZ(MT_WIZARD, actor->origin[VX], actor->origin[VY], + actor->origin[VZ] - (MOBJINFO[MT_WIZARD].height / 2), + actor->angle, 0))) return; if(P_TestMobjLocation(mo) == false) @@ -1271,11 +1266,11 @@ void C_DECL A_GenWizard(mobj_t* actor) actor->flags &= ~MF_MISSILE; - if((fog = P_SpawnMobj3fv(MT_TFOG, actor->pos, actor->angle + ANG180, 0))) + if((fog = P_SpawnMobj(MT_TFOG, actor->origin, actor->angle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); } -void C_DECL A_Sor2DthInit(mobj_t *actor) +void C_DECL A_Sor2DthInit(mobj_t* actor) { // Set the animation loop counter. actor->special1 = 7; @@ -1284,7 +1279,7 @@ void C_DECL A_Sor2DthInit(mobj_t *actor) P_Massacre(); } -void C_DECL A_Sor2DthLoop(mobj_t *actor) +void C_DECL A_Sor2DthLoop(mobj_t* actor) { if(--actor->special1) { // Need to loop. @@ -1295,27 +1290,27 @@ void C_DECL A_Sor2DthLoop(mobj_t *actor) /** * D'Sparil Sound Routines. */ -void C_DECL A_SorZap(mobj_t *actor) +void C_DECL A_SorZap(mobj_t* actor) { S_StartSound(SFX_SORZAP, NULL); } -void C_DECL A_SorRise(mobj_t *actor) +void C_DECL A_SorRise(mobj_t* actor) { S_StartSound(SFX_SORRISE, NULL); } -void C_DECL A_SorDSph(mobj_t *actor) +void C_DECL A_SorDSph(mobj_t* actor) { S_StartSound(SFX_SORDSPH, NULL); } -void C_DECL A_SorDExp(mobj_t *actor) +void C_DECL A_SorDExp(mobj_t* actor) { S_StartSound(SFX_SORDEXP, NULL); } -void C_DECL A_SorDBon(mobj_t *actor) +void C_DECL A_SorDBon(mobj_t* actor) { S_StartSound(SFX_SORDBON, NULL); } @@ -1354,23 +1349,23 @@ void C_DECL A_MinotaurAtk1(mobj_t* actor) */ void C_DECL A_MinotaurDecide(mobj_t* actor) { - uint an; - mobj_t* target; - float dist; + uint an; + mobj_t* target; + coord_t dist; target = actor->target; - if(!target) - return; + if(!target) return; S_StartSound(SFX_MINSIT, actor); - dist = P_ApproxDistance(actor->pos[VX] - target->pos[VX], - actor->pos[VY] - target->pos[VY]); + dist = M_ApproxDistance(actor->origin[VX] - target->origin[VX], + actor->origin[VY] - target->origin[VY]); - if(target->pos[VZ] + target->height > actor->pos[VZ] && - target->pos[VZ] + target->height < actor->pos[VZ] + actor->height && + if(target->origin[VZ] + target->height > actor->origin[VZ] && + target->origin[VZ] + target->height < actor->origin[VZ] + actor->height && dist < 8 * 64 && dist > 1 * 64 && P_Random() < 150) - { // Charge attack. + { + // Charge attack. // Don't call the state function right away. P_SetMobjStateNF(actor, S_MNTR_ATK4_1); actor->flags |= MF_SKULLFLY; @@ -1384,7 +1379,7 @@ void C_DECL A_MinotaurDecide(mobj_t* actor) // Charge duration. actor->special1 = 35 / 2; } - else if(target->pos[VZ] == target->floorZ && dist < 9 * 64 && + else if(target->origin[VZ] == target->floorZ && dist < 9 * 64 && P_Random() < 220) { // Floor fire attack. @@ -1406,7 +1401,7 @@ void C_DECL A_MinotaurCharge(mobj_t* actor) if(actor->special1) { - if((puff = P_SpawnMobj3fv(MT_PHOENIXPUFF, actor->pos, + if((puff = P_SpawnMobj(MT_PHOENIXPUFF, actor->origin, P_Random() << 24, 0))) puff->mom[MZ] = 2; actor->special1--; @@ -1423,10 +1418,9 @@ void C_DECL A_MinotaurCharge(mobj_t* actor) */ void C_DECL A_MinotaurAtk2(mobj_t* actor) { - mobj_t* mo; + mobj_t* mo; - if(!actor->target) - return; + if(!actor->target) return; S_StartSound(SFX_MINAT2, actor); @@ -1439,8 +1433,8 @@ void C_DECL A_MinotaurAtk2(mobj_t* actor) mo = P_SpawnMissile(MT_MNTRFX1, actor, actor->target, true); if(mo) { - angle_t angle = mo->angle; - float momZ = mo->mom[MZ]; + angle_t angle = mo->angle; + coord_t momZ = mo->mom[MZ]; S_StartSound(SFX_MINAT2, mo); @@ -1474,9 +1468,8 @@ void C_DECL A_MinotaurAtk3(mobj_t* actor) } else { - mobj_t* mo; - boolean fixFloorFire = (!cfg.fixFloorFire && - actor->floorClip > 0); + mobj_t* mo; + boolean fixFloorFire = (!cfg.fixFloorFire && actor->floorClip > 0); /** * Original Heretic bug: @@ -1488,7 +1481,7 @@ void C_DECL A_MinotaurAtk3(mobj_t* actor) * z != ONFLOORZ, so rather than being set to the height of the * floor it is left at 2146838915 (float: 32758.162). * - * This in turn means that when P_TryMove is called (via + * This in turn means that when P_TryMoveXY is called (via * P_CheckMissileSpawn), the test which is there to check whether a * missile hits an upper sidedef section will return true * (ceilingheight - thingz > thingheight). @@ -1507,9 +1500,9 @@ void C_DECL A_MinotaurAtk3(mobj_t* actor) { if(fixFloorFire) { - mo->pos[VX] += mo->mom[MX] / 2; - mo->pos[VY] += mo->mom[MY] / 2; - mo->pos[VZ] += mo->mom[MZ] / 2; + mo->origin[VX] += mo->mom[MX] / 2; + mo->origin[VY] += mo->mom[MY] / 2; + mo->origin[VZ] += mo->mom[MZ] / 2; P_ExplodeMissile(mo); } @@ -1529,24 +1522,23 @@ void C_DECL A_MinotaurAtk3(mobj_t* actor) void C_DECL A_MntrFloorFire(mobj_t* actor) { - mobj_t* mo; - float pos[3]; - angle_t angle; + mobj_t* mo; + coord_t pos[3]; + angle_t angle; // Make sure we are on the floor. - actor->pos[VZ] = actor->floorZ; + actor->origin[VZ] = actor->floorZ; - pos[VX] = actor->pos[VX]; - pos[VY] = actor->pos[VY]; + pos[VX] = actor->origin[VX]; + pos[VY] = actor->origin[VY]; pos[VZ] = 0; pos[VX] += FIX2FLT((P_Random() - P_Random()) << 10); pos[VY] += FIX2FLT((P_Random() - P_Random()) << 10); - angle = R_PointToAngle2(actor->pos[VX], actor->pos[VY], - pos[VX], pos[VY]); + angle = M_PointToAngle2(actor->origin, pos); - if((mo = P_SpawnMobj3fv(MT_MNTRFX3, pos, angle, MSF_Z_FLOOR))) + if((mo = P_SpawnMobj(MT_MNTRFX3, pos, angle, MSF_Z_FLOOR))) { mo->target = actor->target; mo->mom[MX] = FIX2FLT(1); // Force block checking. @@ -1571,14 +1563,14 @@ void C_DECL A_BeastAttack(mobj_t* actor) P_SpawnMissile(MT_BEASTBALL, actor, actor->target, true); } -void C_DECL A_HeadAttack(mobj_t *actor) +void C_DECL A_HeadAttack(mobj_t* actor) { - int i; - mobj_t *fire, *baseFire, *mo, *target; - int randAttack; static int atkResolve1[] = { 50, 150 }; static int atkResolve2[] = { 150, 200 }; - float dist; + mobj_t* fire, *baseFire, *mo, *target; + int randAttack; + coord_t dist; + int i; // Ice ball (close 20% : far 60%) // Fire column (close 40% : far 20%) @@ -1597,9 +1589,8 @@ void C_DECL A_HeadAttack(mobj_t *actor) return; } - dist = - P_ApproxDistance(actor->pos[VX] - target->pos[VX], - actor->pos[VY] - target->pos[VY]) > 8 * 64; + dist = M_ApproxDistance(actor->origin[VX] - target->origin[VX], + actor->origin[VY] - target->origin[VY]) > 8 * 64; randAttack = P_Random(); if(randAttack < atkResolve1[(FLT2FIX(dist) != 0)? 1 : 0]) @@ -1617,8 +1608,8 @@ void C_DECL A_HeadAttack(mobj_t *actor) P_MobjChangeState(baseFire, S_HEADFX3_4); // Don't grow for(i = 0; i < 5; ++i) { - if((fire = P_SpawnMobj3fv(MT_HEADFX3, baseFire->pos, - baseFire->angle, 0))) + if((fire = P_SpawnMobj(MT_HEADFX3, baseFire->origin, + baseFire->angle, 0))) { if(i == 0) S_StartSound(SFX_HEDAT1, actor); @@ -1640,7 +1631,7 @@ void C_DECL A_HeadAttack(mobj_t *actor) // Whirlwind. if((mo = P_SpawnMissile(MT_WHIRLWIND, actor, target, true))) { - mo->pos[VZ] -= 32; + mo->origin[VZ] -= 32; mo->tracer = target; mo->special1 = 60; mo->special2 = 50; // Timer for active sound. @@ -1651,7 +1642,7 @@ void C_DECL A_HeadAttack(mobj_t *actor) } } -void C_DECL A_WhirlwindSeek(mobj_t *actor) +void C_DECL A_WhirlwindSeek(mobj_t* actor) { actor->special3 -= 3; if(actor->special3 < 0) @@ -1674,18 +1665,18 @@ void C_DECL A_WhirlwindSeek(mobj_t *actor) P_SeekerMissile(actor, ANGLE_1 * 10, ANGLE_1 * 30); } -void C_DECL A_HeadIceImpact(mobj_t *ice) +void C_DECL A_HeadIceImpact(mobj_t* ice) { - int i; + int i; for(i = 0; i < 8; ++i) { - mobj_t* shard; - angle_t angle = i * ANG45; + mobj_t* shard; + angle_t angle = i * ANG45; - if((shard = P_SpawnMobj3fv(MT_HEADFX2, ice->pos, angle, 0))) + if((shard = P_SpawnMobj(MT_HEADFX2, ice->origin, angle, 0))) { - unsigned int an = angle >> ANGLETOFINESHIFT; + unsigned int an = angle >> ANGLETOFINESHIFT; shard->target = ice->target; shard->mom[MX] = shard->info->speed * FIX2FLT(finecosine[an]); @@ -1697,10 +1688,10 @@ void C_DECL A_HeadIceImpact(mobj_t *ice) } } -void C_DECL A_HeadFireGrow(mobj_t *fire) +void C_DECL A_HeadFireGrow(mobj_t* fire) { fire->special3--; - fire->pos[VZ] += 9; + fire->origin[VZ] += 9; if(fire->special3 == 0) { @@ -1709,7 +1700,7 @@ void C_DECL A_HeadFireGrow(mobj_t *fire) } } -void C_DECL A_SnakeAttack(mobj_t *actor) +void C_DECL A_SnakeAttack(mobj_t* actor) { if(!actor->target) { @@ -1722,7 +1713,7 @@ void C_DECL A_SnakeAttack(mobj_t *actor) P_SpawnMissile(MT_SNAKEPRO_A, actor, actor->target, true); } -void C_DECL A_SnakeAttack2(mobj_t *actor) +void C_DECL A_SnakeAttack2(mobj_t* actor) { if(!actor->target) { @@ -1735,7 +1726,7 @@ void C_DECL A_SnakeAttack2(mobj_t *actor) P_SpawnMissile(MT_SNAKEPRO_B, actor, actor->target, true); } -void C_DECL A_ClinkAttack(mobj_t *actor) +void C_DECL A_ClinkAttack(mobj_t* actor) { int damage; @@ -1750,28 +1741,28 @@ void C_DECL A_ClinkAttack(mobj_t *actor) } } -void C_DECL A_GhostOff(mobj_t *actor) +void C_DECL A_GhostOff(mobj_t* actor) { actor->flags &= ~MF_SHADOW; } -void C_DECL A_WizAtk1(mobj_t *actor) +void C_DECL A_WizAtk1(mobj_t* actor) { A_FaceTarget(actor); actor->flags &= ~MF_SHADOW; } -void C_DECL A_WizAtk2(mobj_t *actor) +void C_DECL A_WizAtk2(mobj_t* actor) { A_FaceTarget(actor); actor->flags |= MF_SHADOW; } -void C_DECL A_WizAtk3(mobj_t *actor) +void C_DECL A_WizAtk3(mobj_t* actor) { - mobj_t *mo; - angle_t angle; - float momZ; + mobj_t* mo; + angle_t angle; + coord_t momZ; actor->flags &= ~MF_SHADOW; @@ -1797,7 +1788,7 @@ void C_DECL A_WizAtk3(mobj_t *actor) } } -void C_DECL A_Scream(mobj_t *actor) +void C_DECL A_Scream(mobj_t* actor) { switch(actor->type) { @@ -1840,13 +1831,13 @@ void C_DECL A_Scream(mobj_t *actor) mobj_t* P_DropItem(mobjtype_t type, mobj_t* source, int special, int chance) { - mobj_t* mo; + mobj_t* mo; if(P_Random() > chance) return NULL; - if((mo = P_SpawnMobj3f(type, source->pos[VX], source->pos[VY], - source->pos[VZ] + source->height / 2, source->angle, 0))) + if((mo = P_SpawnMobjXYZ(type, source->origin[VX], source->origin[VY], + source->origin[VZ] + source->height / 2, source->angle, 0))) { mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 8); mo->mom[MY] = FIX2FLT((P_Random() - P_Random()) << 8); @@ -1860,7 +1851,7 @@ mobj_t* P_DropItem(mobjtype_t type, mobj_t* source, int special, int chance) return mo; } -void C_DECL A_NoBlocking(mobj_t *actor) +void C_DECL A_NoBlocking(mobj_t* actor) { actor->flags &= ~MF_SOLID; @@ -1920,7 +1911,7 @@ void C_DECL A_Explode(mobj_t* actor) { case MT_FIREBOMB: // Time Bombs. - actor->pos[VZ] += 32; + actor->origin[VZ] += 32; actor->flags &= ~MF_SHADOW; actor->flags |= MF_BRIGHTSHADOW | MF_VIEWALIGN; break; @@ -1943,7 +1934,7 @@ void C_DECL A_Explode(mobj_t* actor) P_HitFloor(actor); } -void C_DECL A_PodPain(mobj_t *actor) +void C_DECL A_PodPain(mobj_t* actor) { int i, count, chance; @@ -1960,8 +1951,8 @@ void C_DECL A_PodPain(mobj_t *actor) { mobj_t* goo; - if((goo = P_SpawnMobj3f(MT_PODGOO, actor->pos[VX], actor->pos[VY], - actor->pos[VZ] + 48, actor->angle, 0))) + if((goo = P_SpawnMobjXYZ(MT_PODGOO, actor->origin[VX], actor->origin[VY], + actor->origin[VZ] + 48, actor->angle, 0))) { goo->target = actor; goo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 9); @@ -1990,11 +1981,11 @@ void C_DECL A_MakePod(mobj_t* actor) if(actor->special1 == MAX_GEN_PODS) return; - if(!(mo = P_SpawnMobj3f(MT_POD, actor->pos[VX], actor->pos[VY], 0, + if(!(mo = P_SpawnMobjXYZ(MT_POD, actor->origin[VX], actor->origin[VY], 0, actor->angle, MSF_Z_FLOOR))) return; - if(P_CheckPosition2f(mo, mo->pos[VX], mo->pos[VY]) == false) + if(P_CheckPositionXY(mo, mo->origin[VX], mo->origin[VY]) == false) { // Didn't fit. P_MobjRemove(mo, true); @@ -2128,15 +2119,13 @@ void C_DECL A_ESound(mobj_t *mo) void C_DECL A_SpawnTeleGlitter(mobj_t* actor) { - mobj_t* mo; - - if(!actor) - return; + mobj_t* mo; + if(!actor) return; - if((mo = P_SpawnMobj3f(MT_TELEGLITTER, - actor->pos[VX] + ((P_Random() & 31) - 16), - actor->pos[VY] + ((P_Random() & 31) - 16), - P_GetFloatp(actor->bspLeaf, DMU_FLOOR_HEIGHT), + if((mo = P_SpawnMobjXYZ(MT_TELEGLITTER, + actor->origin[VX] + ((P_Random() & 31) - 16), + actor->origin[VY] + ((P_Random() & 31) - 16), + P_GetDoublep(actor->bspLeaf, DMU_FLOOR_HEIGHT), P_Random() << 24, 0))) { mo->mom[MZ] = 1.0f / 4; @@ -2146,15 +2135,14 @@ void C_DECL A_SpawnTeleGlitter(mobj_t* actor) void C_DECL A_SpawnTeleGlitter2(mobj_t* actor) { - mobj_t* mo; + mobj_t* mo; - if(!actor) - return; + if(!actor) return; - if((mo = P_SpawnMobj3f(MT_TELEGLITTER2, - actor->pos[VX] + ((P_Random() & 31) - 16), - actor->pos[VY] + ((P_Random() & 31) - 16), - P_GetFloatp(actor->bspLeaf, DMU_FLOOR_HEIGHT), + if((mo = P_SpawnMobjXYZ(MT_TELEGLITTER2, + actor->origin[VX] + ((P_Random() & 31) - 16), + actor->origin[VY] + ((P_Random() & 31) - 16), + P_GetDoublep(actor->bspLeaf, DMU_FLOOR_HEIGHT), P_Random() << 24, 0))) { mo->mom[MZ] = 1.0f / 4; @@ -2162,16 +2150,16 @@ void C_DECL A_SpawnTeleGlitter2(mobj_t* actor) } } -void C_DECL A_AccTeleGlitter(mobj_t *actor) +void C_DECL A_AccTeleGlitter(mobj_t* actor) { if(++actor->special3 > 35) actor->mom[MZ] += actor->mom[MZ] / 2; } -void C_DECL A_InitKeyGizmo(mobj_t *gizmo) +void C_DECL A_InitKeyGizmo(mobj_t* gizmo) { - mobj_t* mo; - statenum_t state; + mobj_t* mo; + statenum_t state; switch(gizmo->type) { @@ -2191,9 +2179,9 @@ void C_DECL A_InitKeyGizmo(mobj_t *gizmo) return; } - if((mo = P_SpawnMobj3f(MT_KEYGIZMOFLOAT, - gizmo->pos[VX], gizmo->pos[VY], gizmo->pos[VZ] + 60, - gizmo->angle, 0))) + if((mo = P_SpawnMobjXYZ(MT_KEYGIZMOFLOAT, + gizmo->origin[VX], gizmo->origin[VY], gizmo->origin[VZ] + 60, + gizmo->angle, 0))) { P_MobjChangeState(mo, state); } @@ -2206,17 +2194,17 @@ void C_DECL A_VolcanoSet(mobj_t* volcano) void C_DECL A_VolcanoBlast(mobj_t* volcano) { - int i, count; + int i, count; count = 1 + (P_Random() % 3); for(i = 0; i < count; i++) { - mobj_t* blast; - unsigned int an; + mobj_t* blast; + unsigned int an; - if((blast = P_SpawnMobj3f(MT_VOLCANOBLAST, - volcano->pos[VX], volcano->pos[VY], - volcano->pos[VZ] + 44, P_Random() << 24, 0))) + if((blast = P_SpawnMobjXYZ(MT_VOLCANOBLAST, + volcano->origin[VX], volcano->origin[VY], + volcano->origin[VZ] + 44, P_Random() << 24, 0))) { blast->target = volcano; @@ -2233,23 +2221,23 @@ void C_DECL A_VolcanoBlast(mobj_t* volcano) void C_DECL A_VolcBallImpact(mobj_t* ball) { - int i; + int i; - if(ball->pos[VZ] <= ball->floorZ) + if(ball->origin[VZ] <= ball->floorZ) { ball->flags |= MF_NOGRAVITY; ball->flags2 &= ~MF2_LOGRAV; - ball->pos[VZ] += 28; + ball->origin[VZ] += 28; } P_RadiusAttack(ball, ball->target, 25, 24); for(i = 0; i < 4; ++i) { - mobj_t* tiny; + mobj_t* tiny; - if((tiny = P_SpawnMobj3fv(MT_VOLCANOTBLAST, ball->pos, i * ANG90, 0))) + if((tiny = P_SpawnMobj(MT_VOLCANOTBLAST, ball->origin, i * ANG90, 0))) { - unsigned int an = tiny->angle >> ANGLETOFINESHIFT; + unsigned int an = tiny->angle >> ANGLETOFINESHIFT; tiny->target = ball; tiny->mom[MX] = .7f * FIX2FLT(finecosine[an]); @@ -2263,10 +2251,10 @@ void C_DECL A_VolcBallImpact(mobj_t* ball) void C_DECL A_SkullPop(mobj_t* actor) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3f(MT_BLOODYSKULL, actor->pos[VX], actor->pos[VY], - actor->pos[VZ] + 48, actor->angle, 0))) + if((mo = P_SpawnMobjXYZ(MT_BLOODYSKULL, actor->origin[VX], actor->origin[VY], + actor->origin[VZ] + 48, actor->angle, 0))) { player_t* player; @@ -2293,19 +2281,19 @@ void C_DECL A_SkullPop(mobj_t* actor) } } -void C_DECL A_CheckSkullFloor(mobj_t *actor) +void C_DECL A_CheckSkullFloor(mobj_t* actor) { - if(actor->pos[VZ] <= actor->floorZ) + if(actor->origin[VZ] <= actor->floorZ) P_MobjChangeState(actor, S_BLOODYSKULLX1); } -void C_DECL A_CheckSkullDone(mobj_t *actor) +void C_DECL A_CheckSkullDone(mobj_t* actor) { if(actor->special2 == 666) P_MobjChangeState(actor, S_BLOODYSKULLX2); } -void C_DECL A_CheckBurnGone(mobj_t *actor) +void C_DECL A_CheckBurnGone(mobj_t* actor) { if(actor->special2 == 666) P_MobjChangeState(actor, S_PLAY_FDTH20); @@ -2314,7 +2302,7 @@ void C_DECL A_CheckBurnGone(mobj_t *actor) void C_DECL A_FreeTargMobj(mobj_t *mo) { mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; - mo->pos[VZ] = mo->ceilingZ + 4; + mo->origin[VZ] = mo->ceilingZ + 4; mo->flags &= ~(MF_SHOOTABLE | MF_FLOAT | MF_SKULLFLY | MF_SOLID); mo->flags |= MF_CORPSE | MF_DROPOFF | MF_NOGRAVITY; @@ -2324,7 +2312,7 @@ void C_DECL A_FreeTargMobj(mobj_t *mo) mo->dPlayer = NULL; } -void C_DECL A_AddPlayerCorpse(mobj_t *actor) +void C_DECL A_AddPlayerCorpse(mobj_t* actor) { // Too many player corpses? if(bodyqueslot >= BODYQUESIZE) @@ -2337,19 +2325,19 @@ void C_DECL A_AddPlayerCorpse(mobj_t *actor) bodyqueslot++; } -void C_DECL A_FlameSnd(mobj_t *actor) +void C_DECL A_FlameSnd(mobj_t* actor) { S_StartSound(SFX_HEDAT1, actor); // Burn sound. } -void C_DECL A_HideThing(mobj_t *actor) +void C_DECL A_HideThing(mobj_t* actor) { - //P_MobjUnsetPosition(actor); + //P_MobjUnsetOrigin(actor); actor->flags2 |= MF2_DONTDRAW; } -void C_DECL A_UnHideThing(mobj_t *actor) +void C_DECL A_UnHideThing(mobj_t* actor) { - //P_MobjSetPosition(actor); + //P_MobjSetOrigin(actor); actor->flags2 &= ~MF2_DONTDRAW; } diff --git a/doomsday/plugins/jheretic/src/p_inter.c b/doomsday/plugins/jheretic/src/p_inter.c index ddf284072b..1da0b07438 100644 --- a/doomsday/plugins/jheretic/src/p_inter.c +++ b/doomsday/plugins/jheretic/src/p_inter.c @@ -310,7 +310,7 @@ boolean P_GivePower(player_t* player, powertype_t power) player->powers[power] = FLIGHTTICS; plrmo->flags2 |= MF2_FLY; plrmo->flags |= MF_NOGRAVITY; - if(plrmo->pos[VZ] <= plrmo->floorZ) + if(plrmo->origin[VZ] <= plrmo->floorZ) { player->flyHeight = 10; // Thrust the player in the air a bit. player->plr->flags |= DDPF_FIXMOM; @@ -832,19 +832,19 @@ static boolean giveItem(player_t* plr, itemtype_t item, int quantity) void P_TouchSpecialMobj(mobj_t* special, mobj_t* toucher) { - player_t* player; - float delta; - itemtype_t item; + player_t* player; + coord_t delta; + itemtype_t item; - delta = special->pos[VZ] - toucher->pos[VZ]; + delta = special->origin[VZ] - toucher->origin[VZ]; if(delta > toucher->height || delta < -32) - { // Out of reach. + { + // Out of reach. return; } // Dead thing touching (can happen with a sliding player corpse). - if(toucher->health <= 0) - return; + if(toucher->health <= 0) return; player = toucher->player; @@ -983,10 +983,10 @@ void P_KillMobj(mobj_t* source, mobj_t* target) */ boolean P_MorphPlayer(player_t* player) { - mobj_t* pmo, *fog, *chicken; - float pos[3]; - angle_t angle; - int oldFlags2; + mobj_t* pmo, *fog, *chicken; + coord_t pos[3]; + angle_t angle; + int oldFlags2; #ifdef _DEBUG Con_Message("P_MorphPlayer: Player %i.\n", (int)(player - players)); @@ -1008,16 +1008,16 @@ boolean P_MorphPlayer(player_t* player) } pmo = player->plr->mo; - memcpy(pos, pmo->pos, sizeof(pos)); + memcpy(pos, pmo->origin, sizeof(pos)); angle = pmo->angle; oldFlags2 = pmo->flags2; - if(!(chicken = P_SpawnMobj3fv(MT_CHICPLAYER, pos, angle, 0))) + if(!(chicken = P_SpawnMobj(MT_CHICPLAYER, pos, angle, 0))) return false; P_MobjChangeState(pmo, S_FREETARGMOBJ); - if((fog = P_SpawnMobj3f(MT_TFOG, pos[VX], pos[VY], pos[VZ] + TELEFOGHEIGHT, + if((fog = P_SpawnMobjXYZ(MT_TFOG, pos[VX], pos[VY], pos[VZ] + TELEFOGHEIGHT, angle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); @@ -1036,20 +1036,20 @@ boolean P_MorphPlayer(player_t* player) chicken->flags2 |= MF2_FLY; player->morphTics = CHICKENTICS; - player->plr->flags |= DDPF_FIXPOS | DDPF_FIXMOM; + player->plr->flags |= DDPF_FIXORIGIN | DDPF_FIXMOM; player->update |= PSF_MORPH_TIME | PSF_HEALTH | PSF_POWERS | PSF_ARMOR_POINTS; P_ActivateMorphWeapon(player); return true; } -boolean P_MorphMonster(mobj_t *actor) +boolean P_MorphMonster(mobj_t* actor) { - mobj_t *fog, *chicken, *target; - mobjtype_t moType; - float pos[3]; - angle_t angle; - int ghost; + mobj_t* fog, *chicken, *target; + mobjtype_t moType; + coord_t pos[3]; + angle_t angle; + int ghost; if(actor->player) return false; @@ -1069,16 +1069,16 @@ boolean P_MorphMonster(mobj_t *actor) break; } - memcpy(pos, actor->pos, sizeof(pos)); + memcpy(pos, actor->origin, sizeof(pos)); angle = actor->angle; ghost = actor->flags & MF_SHADOW; target = actor->target; - if((chicken = P_SpawnMobj3fv(MT_CHICKEN, pos, angle, 0))) + if((chicken = P_SpawnMobj(MT_CHICKEN, pos, angle, 0))) { P_MobjChangeState(actor, S_FREETARGMOBJ); - if((fog = P_SpawnMobj3f(MT_TFOG, pos[VX], pos[VY], pos[VZ] + TELEFOGHEIGHT, + if((fog = P_SpawnMobjXYZ(MT_TFOG, pos[VX], pos[VY], pos[VZ] + TELEFOGHEIGHT, angle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); @@ -1308,14 +1308,14 @@ int P_DamageMobj2(mobj_t* target, mobj_t* inflictor, mobj_t* source, case MT_MINOTAUR: if(inflictor->flags & MF_SKULLFLY) - { // Slam only when in charge mode. - angle_t angle; - uint an; - float thrust; - int damageDone; - - angle = R_PointToAngle2(inflictor->pos[VX], inflictor->pos[VY], - target->pos[VX], target->pos[VY]); + { + // Slam only when in charge mode. + angle_t angle; + uint an; + coord_t thrust; + int damageDone; + + angle = M_PointToAngle2(inflictor->origin, target->origin); an = angle >> ANGLETOFINESHIFT; thrust = 16 + FIX2FLT(P_Random() << 10); target->mom[MX] += thrust * FIX2FLT(finecosine[an]); @@ -1408,17 +1408,16 @@ int P_DamageMobj2(mobj_t* target, mobj_t* inflictor, mobj_t* source, source->player->readyWeapon != WT_EIGHTH) && !(inflictor->flags2 & MF2_NODMGTHRUST)) { - uint an; - float thrust; + uint an; + coord_t thrust; - angle = R_PointToAngle2(inflictor->pos[VX], inflictor->pos[VY], - target->pos[VX], target->pos[VY]); + angle = M_PointToAngle2(inflictor->origin, target->origin); thrust = FIX2FLT(damage * (FRACUNIT>>3) * 100 / target->info->mass); // Make fall forwards sometimes. if(damage < 40 && damage > target->health && - target->pos[VZ] - inflictor->pos[VZ] > 64 && (P_Random() & 1)) + target->origin[VZ] - inflictor->origin[VZ] > 64 && (P_Random() & 1)) { angle += ANG180; thrust *= 4; @@ -1427,7 +1426,8 @@ int P_DamageMobj2(mobj_t* target, mobj_t* inflictor, mobj_t* source, if(source && source->player && (source == inflictor) && source->player->powers[PT_WEAPONLEVEL2] && source->player->readyWeapon == WT_FIRST) - { // Staff power level 2. + { + // Staff power level 2. thrust = 10; if(!(target->flags & MF_NOGRAVITY)) diff --git a/doomsday/plugins/jheretic/src/p_maputl.c b/doomsday/plugins/jheretic/src/p_maputl.c index 81d0f9d3c0..de73c37451 100644 --- a/doomsday/plugins/jheretic/src/p_maputl.c +++ b/doomsday/plugins/jheretic/src/p_maputl.c @@ -69,13 +69,13 @@ extern mobj_t *tmThing; * If more than one linedef is contacted, the effects are cumulative, so * balancing is possible. */ -static int PIT_ApplyTorque(LineDef* ld, void* data) +static int PIT_ApplyTorque(LineDef* ld, void* parameters) { - mobj_t* mo = tmThing; - float dist; - Sector* frontsec, *backsec; - float ffloor, bfloor; - float d1[2], vtx[2]; + mobj_t* mo = tmThing; + coord_t dist; + Sector* frontsec, *backsec; + coord_t ffloor, bfloor; + coord_t d1[2], vtx[2]; if(tmThing->player) return false; // Skip players! @@ -84,25 +84,25 @@ static int PIT_ApplyTorque(LineDef* ld, void* data) !(backsec = P_GetPtrp(ld, DMU_BACK_SECTOR))) return false; // Shouldn't ever happen. - ffloor = P_GetFloatp(frontsec, DMU_FLOOR_HEIGHT); - bfloor = P_GetFloatp(backsec, DMU_FLOOR_HEIGHT); - P_GetFloatpv(ld, DMU_DXY, d1); - P_GetFloatpv(P_GetPtrp(ld, DMU_VERTEX0), DMU_XY, vtx); + ffloor = P_GetDoublep(frontsec, DMU_FLOOR_HEIGHT); + bfloor = P_GetDoublep(backsec, DMU_FLOOR_HEIGHT); + P_GetDoublepv(ld, DMU_DXY, d1); + P_GetDoublepv(P_GetPtrp(ld, DMU_VERTEX0), DMU_XY, vtx); // Lever-arm: - dist = +d1[0] * mo->pos[VY] - d1[1] * mo->pos[VX] - - d1[0] * vtx[VY] + d1[1] * vtx[VX]; + dist = +d1[0] * mo->origin[VY] - d1[1] * mo->origin[VX] - + d1[0] * vtx[VY] + d1[1] * vtx[VX]; - if((dist < 0 && ffloor < mo->pos[VZ] && bfloor >= mo->pos[VZ]) || - (dist >= 0 && bfloor < mo->pos[VZ] && ffloor >= mo->pos[VZ])) + if((dist < 0 && ffloor < mo->origin[VZ] && bfloor >= mo->origin[VZ]) || + (dist >= 0 && bfloor < mo->origin[VZ] && ffloor >= mo->origin[VZ])) { // At this point, we know that the object straddles a two-sided // linedef, and that the object's center of mass is above-ground. - float x = fabs(d1[0]), y = fabs(d1[1]); + coord_t x = fabs(d1[0]), y = fabs(d1[1]); if(y > x) { - float tmp = x; + coord_t tmp = x; x = y; y = tmp; } diff --git a/doomsday/plugins/jheretic/src/p_mobj.c b/doomsday/plugins/jheretic/src/p_mobj.c index a9d0caf897..f173f08fe1 100644 --- a/doomsday/plugins/jheretic/src/p_mobj.c +++ b/doomsday/plugins/jheretic/src/p_mobj.c @@ -51,7 +51,9 @@ #define NOMOMENTUM_THRESHOLD (0.000001f) #define WALKSTOP_THRESHOLD (0.062484741f) // FIX2FLT(0x1000-1) + // TYPES ------------------------------------------------------------------- + // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -156,27 +158,26 @@ void P_FloorBounceMissile(mobj_t* mo) P_MobjChangeState(mo, P_GetState(mo->type, SN_DEATH)); } -void P_ThrustMobj(mobj_t* mo, angle_t angle, float move) +void P_ThrustMobj(mobj_t* mo, angle_t angle, coord_t move) { - uint an = angle >> ANGLETOFINESHIFT; + uint an = angle >> ANGLETOFINESHIFT; mo->mom[MX] += move * FIX2FLT(finecosine[an]); mo->mom[MY] += move * FIX2FLT(finesine[an]); } /** - * @param delta The amount 'source' needs to turn. + * @param delta The amount 'source' needs to turn. * - * @return @c 1, = 'source' needs to turn clockwise, or - * @c 0, = 'source' needs to turn counter clockwise. + * @return @c 1, = 'source' needs to turn clockwise, or + * @c 0, = 'source' needs to turn counter clockwise. */ int P_FaceMobj(mobj_t* source, mobj_t* target, angle_t* delta) { - angle_t diff, angle1, angle2; + angle_t diff, angle1, angle2; angle1 = source->angle; - angle2 = R_PointToAngle2(source->pos[VX], source->pos[VY], - target->pos[VX], target->pos[VY]); + angle2 = M_PointToAngle2(source->origin, target->origin); if(angle2 > angle1) { diff = angle2 - angle1; @@ -214,15 +215,14 @@ int P_FaceMobj(mobj_t* source, mobj_t* target, angle_t* delta) */ boolean P_SeekerMissile(mobj_t* actor, angle_t thresh, angle_t turnMax) { - int dir; - uint an; - float dist; - angle_t delta; - mobj_t* target; + int dir; + uint an; + coord_t dist; + angle_t delta; + mobj_t* target; target = actor->tracer; - if(target == NULL) - return false; + if(!target) return false; if(!(target->flags & MF_SHOOTABLE)) { // Target died. @@ -253,16 +253,16 @@ boolean P_SeekerMissile(mobj_t* actor, angle_t thresh, angle_t turnMax) actor->mom[MX] = actor->info->speed * FIX2FLT(finecosine[an]); actor->mom[MY] = actor->info->speed * FIX2FLT(finesine[an]); - if(actor->pos[VZ] + actor->height < target->pos[VZ] || - target->pos[VZ] + target->height < actor->pos[VZ]) + if(actor->origin[VZ] + actor->height < target->origin[VZ] || + target->origin[VZ] + target->height < actor->origin[VZ]) { // Need to seek vertically. - dist = P_ApproxDistance(target->pos[VX] - actor->pos[VX], - target->pos[VY] - actor->pos[VY]); + dist = M_ApproxDistance(target->origin[VX] - actor->origin[VX], + target->origin[VY] - actor->origin[VY]); dist /= actor->info->speed; if(dist < 1) dist = 1; - actor->mom[MZ] = (target->pos[VZ] - actor->pos[VZ]) / dist; + actor->mom[MZ] = (target->origin[VZ] - actor->origin[VZ]) / dist; } return true; @@ -271,12 +271,12 @@ boolean P_SeekerMissile(mobj_t* actor, angle_t thresh, angle_t turnMax) /** * Wind pushes the mobj, if its sector special is a wind type. */ -void P_WindThrust(mobj_t *mo) +void P_WindThrust(mobj_t* mo) { - static int windTab[3] = { 2048 * 5, 2048 * 10, 2048 * 25 }; + static int windTab[3] = { 2048 * 5, 2048 * 10, 2048 * 25 }; - Sector *sec = P_GetPtrp(mo->bspLeaf, DMU_SECTOR); - int special = P_ToXSector(sec)->special; + Sector* sec = P_GetPtrp(mo->bspLeaf, DMU_SECTOR); + int special = P_ToXSector(sec)->special; switch(special) { @@ -309,15 +309,15 @@ void P_WindThrust(mobj_t *mo) } } -float P_MobjGetFriction(mobj_t *mo) +coord_t P_MobjGetFriction(mobj_t* mo) { - if((mo->flags2 & MF2_FLY) && !(mo->pos[VZ] <= mo->floorZ) && !mo->onMobj) + if((mo->flags2 & MF2_FLY) && !(mo->origin[VZ] <= mo->floorZ) && !mo->onMobj) { return FRICTION_FLY; } else { - Sector *sec = P_GetPtrp(mo->bspLeaf, DMU_SECTOR); + Sector* sec = P_GetPtrp(mo->bspLeaf, DMU_SECTOR); if(P_ToXSector(sec)->special == 15) { @@ -330,7 +330,7 @@ float P_MobjGetFriction(mobj_t *mo) void P_MobjMoveXY(mobj_t* mo) { - float pos[2], mom[2]; + coord_t pos[2], mom[2]; player_t* player; boolean largeNegative; @@ -346,7 +346,8 @@ void P_MobjMoveXY(mobj_t* mo) if(FEQUAL(mom[MX], 0) && FEQUAL(mom[MY], 0)) { if(mo->flags & MF_SKULLFLY) - { // A flying mobj slammed into something. + { + // A flying mobj slammed into something. mo->flags &= ~MF_SKULLFLY; mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; P_MobjChangeState(mo, P_GetState(mo->type, SN_SEE)); @@ -376,15 +377,15 @@ void P_MobjMoveXY(mobj_t* mo) if(largeNegative || mom[MX] > MAXMOMSTEP || mom[MY] > MAXMOMSTEP) { - pos[VX] = mo->pos[VX] + mom[MX] / 2; - pos[VY] = mo->pos[VY] + mom[MY] / 2; + pos[VX] = mo->origin[VX] + mom[MX] / 2; + pos[VY] = mo->origin[VY] + mom[MY] / 2; mom[MX] /= 2; mom[MY] /= 2; } else { - pos[VX] = mo->pos[VX] + mom[MX]; - pos[VY] = mo->pos[VY] + mom[MY]; + pos[VX] = mo->origin[VX] + mom[MX]; + pos[VY] = mo->origin[VY] + mom[MY]; mom[MX] = mom[MY] = 0; } @@ -393,23 +394,22 @@ void P_MobjMoveXY(mobj_t* mo) mo->wallRun = false; // $dropoff_fix - if(!P_TryMove(mo, pos[VX], pos[VY], true, false)) + if(!P_TryMoveXY(mo, pos[VX], pos[VY], true, false)) { // Blocked mom. if(mo->flags2 & MF2_SLIDE) { // Try to slide along it. P_SlideMove(mo); } else if(mo->flags & MF_MISSILE) - { // Explode a missile + { + // Explode a missile Sector* backSec; - //// kludge: Prevent missiles exploding against the sky. - if(ceilingLine && - (backSec = P_GetPtrp(ceilingLine, DMU_BACK_SECTOR))) + /// @kludge: Prevent missiles exploding against the sky. + if(ceilingLine && (backSec = P_GetPtrp(ceilingLine, DMU_BACK_SECTOR))) { - if((P_GetIntp(P_GetPtrp(backSec, DMU_CEILING_MATERIAL), - DMU_FLAGS) & MATF_SKYMASK) && - mo->pos[VZ] > P_GetFloatp(backSec, DMU_CEILING_HEIGHT)) + if((P_GetIntp(P_GetPtrp(backSec, DMU_CEILING_MATERIAL), DMU_FLAGS) & MATF_SKYMASK) && + mo->origin[VZ] > P_GetDoublep(backSec, DMU_CEILING_HEIGHT)) { if(mo->type == MT_BLOODYSKULL) { @@ -425,12 +425,10 @@ void P_MobjMoveXY(mobj_t* mo) } } - if(floorLine && - (backSec = P_GetPtrp(floorLine, DMU_BACK_SECTOR))) + if(floorLine && (backSec = P_GetPtrp(floorLine, DMU_BACK_SECTOR))) { - if((P_GetIntp(P_GetPtrp(backSec, DMU_FLOOR_MATERIAL), - DMU_FLAGS) & MATF_SKYMASK) && - mo->pos[VZ] < P_GetFloatp(backSec, DMU_FLOOR_HEIGHT)) + if((P_GetIntp(P_GetPtrp(backSec, DMU_FLOOR_MATERIAL), DMU_FLAGS) & MATF_SKYMASK) && + mo->origin[VZ] < P_GetDoublep(backSec, DMU_FLOOR_HEIGHT)) { if(mo->type == MT_BLOODYSKULL) { @@ -445,7 +443,7 @@ void P_MobjMoveXY(mobj_t* mo) return; } } - //// kludge end. + // kludge end. P_ExplodeMissile(mo); } @@ -461,11 +459,11 @@ void P_MobjMoveXY(mobj_t* mo) Mobj_XYMoveStopping(mo); } -void P_MobjMoveZ(mobj_t *mo) +void P_MobjMoveZ(mobj_t* mo) { - float gravity; - float dist; - float delta; + coord_t gravity; + coord_t dist; + coord_t delta; // $democam: cameramen get special z movement if(P_CameraZMovement(mo)) @@ -474,17 +472,17 @@ void P_MobjMoveZ(mobj_t *mo) gravity = XS_Gravity(P_GetPtrp(mo->bspLeaf, DMU_SECTOR)); // $voodoodolls: Check for smooth step up unless a voodoo doll. - if(mo->player && mo->player->plr->mo == mo && mo->pos[VZ] < mo->floorZ) + if(mo->player && mo->player->plr->mo == mo && mo->origin[VZ] < mo->floorZ) { - mo->player->viewHeight -= mo->floorZ - mo->pos[VZ]; + mo->player->viewHeight -= mo->floorZ - mo->origin[VZ]; mo->player->viewHeightDelta = (cfg.plrViewHeight - mo->player->viewHeight) / 8; } // Adjust height. - mo->pos[VZ] += mo->mom[MZ]; + mo->origin[VZ] += mo->mom[MZ]; if((mo->flags2 & MF2_FLY) && - mo->onMobj && mo->pos[VZ] > mo->onMobj->pos[VZ] + mo->onMobj->height) + mo->onMobj && mo->origin[VZ] > mo->onMobj->origin[VZ] + mo->onMobj->height) mo->onMobj = NULL; // We were on a mobj, we are NOT now. if((mo->flags & MF_FLOAT) && mo->target && !P_MobjIsCamera(mo->target)) @@ -492,26 +490,27 @@ void P_MobjMoveZ(mobj_t *mo) // Float down towards target if too close. if(!(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT)) { - dist = P_ApproxDistance(mo->pos[VX] - mo->target->pos[VX], - mo->pos[VY] - mo->target->pos[VY]); + dist = M_ApproxDistance(mo->origin[VX] - mo->target->origin[VX], + mo->origin[VY] - mo->target->origin[VY]); - delta = (mo->target->pos[VZ] + mo->target->height /2) - - (mo->pos[VZ] + mo->height /2); + delta = (mo->target->origin[VZ] + mo->target->height /2) - + (mo->origin[VZ] + mo->height /2); if(dist < mo->radius + mo->target->radius && fabs(delta) < mo->height + mo->target->height) - { // Don't go INTO the target. + { + // Don't go INTO the target. delta = 0; } if(delta < 0 && dist < -(delta * 3)) { - mo->pos[VZ] -= FLOATSPEED; + mo->origin[VZ] -= FLOATSPEED; P_MobjSetSRVOZ(mo, -FLOATSPEED); } else if(delta > 0 && dist < (delta * 3)) { - mo->pos[VZ] += FLOATSPEED; + mo->origin[VZ] += FLOATSPEED; P_MobjSetSRVOZ(mo, FLOATSPEED); } } @@ -519,14 +518,14 @@ void P_MobjMoveZ(mobj_t *mo) // Do some fly-bobbing. if(mo->player && mo->player->plr->mo == mo && - (mo->flags2 & MF2_FLY) && mo->pos[VZ] > mo->floorZ && + (mo->flags2 & MF2_FLY) && mo->origin[VZ] > mo->floorZ && !mo->onMobj && (mapTime & 2)) { - mo->pos[VZ] += FIX2FLT(finesine[(FINEANGLES / 20 * mapTime >> 2) & FINEMASK]); + mo->origin[VZ] += FIX2FLT(finesine[(FINEANGLES / 20 * mapTime >> 2) & FINEMASK]); } // Clip movement. Another thing? - if(mo->onMobj && mo->pos[VZ] <= mo->onMobj->pos[VZ] + mo->onMobj->height) + if(mo->onMobj && mo->origin[VZ] <= mo->onMobj->origin[VZ] + mo->onMobj->height) { if(mo->mom[MZ] < 0) { @@ -543,7 +542,7 @@ void P_MobjMoveZ(mobj_t *mo) } if(FEQUAL(mo->mom[MZ], 0)) - mo->pos[VZ] = mo->onMobj->pos[VZ] + mo->onMobj->height; + mo->origin[VZ] = mo->onMobj->origin[VZ] + mo->onMobj->height; if((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP)) { @@ -553,7 +552,7 @@ void P_MobjMoveZ(mobj_t *mo) } // The floor. - if(mo->pos[VZ] <= mo->floorZ) + if(mo->origin[VZ] <= mo->floorZ) { // Hit the floor. boolean movingDown; @@ -604,7 +603,7 @@ void P_MobjMoveZ(mobj_t *mo) } } - mo->pos[VZ] = mo->floorZ; + mo->origin[VZ] = mo->floorZ; if(movingDown) P_HitFloor(mo); @@ -668,13 +667,13 @@ void P_MobjMoveZ(mobj_t *mo) mo->mom[MZ] -= gravity; } - if(mo->pos[VZ] + mo->height > mo->ceilingZ) + if(mo->origin[VZ] + mo->height > mo->ceilingZ) { // hit the ceiling if(mo->mom[MZ] > 0) mo->mom[MZ] = 0; - mo->pos[VZ] = mo->ceilingZ - mo->height; + mo->origin[VZ] = mo->ceilingZ - mo->height; if(mo->flags & MF_SKULLFLY) { // the skull slammed into something @@ -712,23 +711,23 @@ void P_NightmareRespawn(mobj_t* mobj) mobj_t* mo; // Something is occupying it's position? - if(!P_CheckPosition2f(mobj, mobj->spawnSpot.pos[VX], - mobj->spawnSpot.pos[VY])) + if(!P_CheckPositionXY(mobj, mobj->spawnSpot.origin[VX], + mobj->spawnSpot.origin[VY])) return; // No respwan. - if((mo = P_SpawnMobj3fv(mobj->type, mobj->spawnSpot.pos, + if((mo = P_SpawnMobj(mobj->type, mobj->spawnSpot.origin, mobj->spawnSpot.angle, mobj->spawnSpot.flags))) { mo->reactionTime = 18; // Spawn a teleport fog at old spot because of removal of the body? - if((mo = P_SpawnMobj3f(MT_TFOG, mobj->pos[VX], mobj->pos[VY], + if((mo = P_SpawnMobjXYZ(MT_TFOG, mobj->origin[VX], mobj->origin[VY], TELEFOGHEIGHT, mobj->angle, MSF_Z_FLOOR))) S_StartSound(SFX_TELEPT, mo); // Spawn a teleport fog at the new spot. - if((mo = P_SpawnMobj3f(MT_TFOG, mobj->spawnSpot.pos[VX], - mobj->spawnSpot.pos[VY], TELEFOGHEIGHT, + if((mo = P_SpawnMobjXYZ(MT_TFOG, mobj->spawnSpot.origin[VX], + mobj->spawnSpot.origin[VY], TELEFOGHEIGHT, mobj->spawnSpot.angle, MSF_Z_FLOOR))) S_StartSound(SFX_TELEPT, mo); } @@ -737,21 +736,21 @@ void P_NightmareRespawn(mobj_t* mobj) P_MobjRemove(mobj, true); } -void P_MobjThinker(mobj_t *mobj) +void P_MobjThinker(mobj_t* mobj) { if(IS_CLIENT && !ClMobj_IsValid(mobj)) return; // We should not touch this right now. if(mobj->type == MT_BLASTERFX1) { - int i; - float frac[3]; - float z; - boolean changexy; + int i; + coord_t frac[3]; + coord_t z; + boolean changexy; // Handle movement if(!FEQUAL(mobj->mom[MX], 0) || !FEQUAL(mobj->mom[MY], 0) || !FEQUAL(mobj->mom[MZ], 0) || - !FEQUAL(mobj->pos[VZ], mobj->floorZ)) + !FEQUAL(mobj->origin[VZ], mobj->floorZ)) { frac[MX] = mobj->mom[MX] / 8; frac[MY] = mobj->mom[MY] / 8; @@ -762,39 +761,40 @@ void P_MobjThinker(mobj_t *mobj) { if(changexy) { - if(!P_TryMove(mobj, mobj->pos[VX] + frac[MX], - mobj->pos[VY] + frac[MY], false, false)) + if(!P_TryMoveXY(mobj, mobj->origin[VX] + frac[MX], + mobj->origin[VY] + frac[MY], false, false)) { // Blocked move. P_ExplodeMissile(mobj); return; } } - mobj->pos[VZ] += frac[MZ]; - if(mobj->pos[VZ] <= mobj->floorZ) - { // Hit the floor. - mobj->pos[VZ] = mobj->floorZ; + mobj->origin[VZ] += frac[MZ]; + if(mobj->origin[VZ] <= mobj->floorZ) + { + // Hit the floor. + mobj->origin[VZ] = mobj->floorZ; P_HitFloor(mobj); P_ExplodeMissile(mobj); return; } - if(mobj->pos[VZ] + mobj->height > mobj->ceilingZ) + if(mobj->origin[VZ] + mobj->height > mobj->ceilingZ) { // Hit the ceiling. - mobj->pos[VZ] = mobj->ceilingZ - mobj->height; + mobj->origin[VZ] = mobj->ceilingZ - mobj->height; P_ExplodeMissile(mobj); return; } if(changexy && (P_Random() < 64)) { - z = mobj->pos[VZ] - 8; + z = mobj->origin[VZ] - 8; if(z < mobj->floorZ) { z = mobj->floorZ; } - P_SpawnMobj3f(MT_BLASTERSMOKE, mobj->pos[VX], mobj->pos[VY], + P_SpawnMobjXYZ(MT_BLASTERSMOKE, mobj->origin[VX], mobj->origin[VY], z, P_Random() << 24, 0); } } @@ -840,7 +840,7 @@ void P_MobjThinker(mobj_t *mobj) if(mobj->flags2 & MF2_FLOATBOB) { // Floating item bobbing motion. // Keep it on the floor. - mobj->pos[VZ] = mobj->floorZ; + mobj->origin[VZ] = mobj->floorZ; // Negative floorclip raises the mobj off the floor. mobj->floorClip = -mobj->special1; @@ -850,7 +850,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->floorClip = -MAX_BOB_OFFSET; } } - else if(!FEQUAL(mobj->pos[VZ], mobj->floorZ) || !FEQUAL(mobj->mom[MZ], 0)) + else if(!FEQUAL(mobj->origin[VZ], mobj->floorZ) || !FEQUAL(mobj->mom[MZ], 0)) { P_MobjMoveZ(mobj); if(mobj->thinker.function != P_MobjThinker) @@ -865,7 +865,7 @@ void P_MobjThinker(mobj_t *mobj) * of ledge if hanging more than halfway off. */ - if(mobj->pos[VZ] > mobj->dropOffZ && // Only objects contacting dropoff + if(mobj->origin[VZ] > mobj->dropOffZ && // Only objects contacting dropoff !(mobj->flags & MF_NOGRAVITY) && cfg.fallOff) { P_ApplyTorque(mobj); @@ -879,8 +879,8 @@ void P_MobjThinker(mobj_t *mobj) if(cfg.slidingCorpses) { - if(((mobj->flags & MF_CORPSE) ? mobj->pos[VZ] > mobj->dropOffZ : - mobj->pos[VZ] - mobj->dropOffZ > 24) && // Only objects contacting drop off. + if(((mobj->flags & MF_CORPSE) ? mobj->origin[VZ] > mobj->dropOffZ : + mobj->origin[VZ] - mobj->dropOffZ > 24) && // Only objects contacting drop off. !(mobj->flags & MF_NOGRAVITY)) // Only objects which fall. { P_ApplyTorque(mobj); // Apply torque. @@ -956,13 +956,13 @@ void P_MobjThinker(mobj_t *mobj) /** * Spawns a mobj of "type" at the specified position. */ -mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, - angle_t angle, int spawnFlags) +mobj_t* P_SpawnMobjXYZ(mobjtype_t type, coord_t x, coord_t y, coord_t z, + angle_t angle, int spawnFlags) { - mobj_t* mo; - mobjinfo_t* info; - float space; - int ddflags = 0; + mobj_t* mo; + mobjinfo_t* info; + coord_t space; + int ddflags = 0; if(type < MT_FIRST || type >= Get(DD_NUMMOBJTYPES)) { @@ -1017,7 +1017,7 @@ mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, if(info->flags2 & MF2_DONTDRAW) ddflags |= DDMF_DONTDRAW; - mo = P_MobjCreate(P_MobjThinker, x, y, z, angle, info->radius, + mo = P_MobjCreateXYZ(P_MobjThinker, x, y, z, angle, info->radius, info->height, ddflags); mo->type = type; mo->info = info; @@ -1042,15 +1042,15 @@ mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, mo->special3 = 1000; // Link the mobj into the world. - P_MobjSetPosition(mo); + P_MobjSetOrigin(mo); - mo->floorZ = P_GetFloatp(mo->bspLeaf, DMU_FLOOR_HEIGHT); + mo->floorZ = P_GetDoublep(mo->bspLeaf, DMU_FLOOR_HEIGHT); mo->dropOffZ = mo->floorZ; - mo->ceilingZ = P_GetFloatp(mo->bspLeaf, DMU_CEILING_HEIGHT); + mo->ceilingZ = P_GetDoublep(mo->bspLeaf, DMU_CEILING_HEIGHT); if((spawnFlags & MSF_Z_CEIL) || (info->flags & MF_SPAWNCEILING)) { - mo->pos[VZ] = mo->ceilingZ - mo->info->height - z; + mo->origin[VZ] = mo->ceilingZ - mo->info->height - z; } else if((spawnFlags & MSF_Z_RANDOM) || (info->flags2 & MF2_SPAWNFLOAT)) { @@ -1058,16 +1058,16 @@ mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, if(space > 48) { space -= 40; - mo->pos[VZ] = ((space * P_Random()) / 256) + mo->floorZ + 40; + mo->origin[VZ] = ((space * P_Random()) / 256) + mo->floorZ + 40; } else { - mo->pos[VZ] = mo->floorZ; + mo->origin[VZ] = mo->floorZ; } } else if(spawnFlags & MSF_Z_FLOOR) { - mo->pos[VZ] = mo->floorZ + z; + mo->origin[VZ] = mo->floorZ + z; } if(spawnFlags & MSF_AMBUSH) @@ -1076,7 +1076,7 @@ mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, mo->floorClip = 0; if((mo->flags2 & MF2_FLOORCLIP) && - mo->pos[VZ] == P_GetFloatp(mo->bspLeaf, DMU_FLOOR_HEIGHT)) + FEQUAL(mo->origin[VZ], P_GetDoublep(mo->bspLeaf, DMU_FLOOR_HEIGHT))) { const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); @@ -1087,19 +1087,18 @@ mobj_t* P_SpawnMobj3f(mobjtype_t type, float x, float y, float z, } // Copy spawn attributes to the new mobj. - mo->spawnSpot.pos[VX] = x; - mo->spawnSpot.pos[VY] = y; - mo->spawnSpot.pos[VZ] = z; + mo->spawnSpot.origin[VX] = x; + mo->spawnSpot.origin[VY] = y; + mo->spawnSpot.origin[VZ] = z; mo->spawnSpot.angle = angle; mo->spawnSpot.flags = spawnFlags; return mo; } -mobj_t* P_SpawnMobj3fv(mobjtype_t type, const float pos[3], angle_t angle, - int spawnFlags) +mobj_t* P_SpawnMobj(mobjtype_t type, coord_t const pos[3], angle_t angle, int spawnFlags) { - return P_SpawnMobj3f(type, pos[VX], pos[VY], pos[VZ], angle, spawnFlags); + return P_SpawnMobjXYZ(type, pos[VX], pos[VY], pos[VZ], angle, spawnFlags); } /** @@ -1108,31 +1107,30 @@ mobj_t* P_SpawnMobj3fv(mobjtype_t type, const float pos[3], angle_t angle, void P_RepositionMace(mobj_t* mo) { mapspotid_t spot; - BspLeaf* ss; + BspLeaf* bspLeaf; - P_MobjUnsetPosition(mo); + P_MobjUnsetOrigin(mo); spot = maceSpots[P_Random() % maceSpotCount]; - mo->pos[VX] = mapSpots[spot].pos[VX]; - mo->pos[VY] = mapSpots[spot].pos[VY]; - ss = P_BspLeafAtPointXY(mo->pos[VX], mo->pos[VY]); + mo->origin[VX] = mapSpots[spot].origin[VX]; + mo->origin[VY] = mapSpots[spot].origin[VY]; + bspLeaf = P_BspLeafAtPoint(mo->origin); - mo->floorZ = P_GetFloatp(ss, DMU_CEILING_HEIGHT); - mo->pos[VZ] = mo->floorZ; + mo->floorZ = P_GetDoublep(bspLeaf, DMU_CEILING_HEIGHT); + mo->origin[VZ] = mo->floorZ; - mo->ceilingZ = P_GetFloatp(ss, DMU_CEILING_HEIGHT); - P_MobjSetPosition(mo); + mo->ceilingZ = P_GetDoublep(bspLeaf, DMU_CEILING_HEIGHT); + P_MobjSetOrigin(mo); } -void P_SpawnPuff(float x, float y, float z, angle_t angle) +void P_SpawnPuff(coord_t x, coord_t y, coord_t z, angle_t angle) { - mobj_t* puff; + mobj_t* puff; // Clients do not spawn puffs. - if(IS_CLIENT) - return; + if(IS_CLIENT) return; z += FIX2FLT((P_Random() - P_Random()) << 10); - if((puff = P_SpawnMobj3f(puffType, x, y, z, angle, 0))) + if((puff = P_SpawnMobjXYZ(puffType, x, y, z, angle, 0))) { if(puff->info->attackSound) { @@ -1156,11 +1154,11 @@ void P_SpawnPuff(float x, float y, float z, angle_t angle) } } -void P_SpawnBloodSplatter(float x, float y, float z, mobj_t* originator) +void P_SpawnBloodSplatter(coord_t x, coord_t y, coord_t z, mobj_t* originator) { - mobj_t* mo; + mobj_t* mo; - if((mo = P_SpawnMobj3f(MT_BLOODSPLATTER, x, y, z, P_Random() << 24, 0))) + if((mo = P_SpawnMobjXYZ(MT_BLOODSPLATTER, x, y, z, P_Random() << 24, 0))) { mo->target = originator; mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 9); @@ -1176,7 +1174,7 @@ void P_SpawnBloodSplatter(float x, float y, float z, mobj_t* originator) */ boolean P_HitFloor(mobj_t* thing) { - mobj_t* mo; + mobj_t* mo; const terraintype_t* tt; if(IS_CLIENT && thing->player) @@ -1186,9 +1184,9 @@ boolean P_HitFloor(mobj_t* thing) return false; } - if(thing->floorZ != P_GetFloatp(thing->bspLeaf, DMU_FLOOR_HEIGHT)) + if(!FEQUAL(thing->floorZ, P_GetDoublep(thing->bspLeaf, DMU_FLOOR_HEIGHT))) { - // Don't splash if landing on the edge above water/lava/etc.... + // Don't splash if landing on the edge above water/lava/etc... return false; } @@ -1209,12 +1207,12 @@ boolean P_HitFloor(mobj_t* thing) tt = P_MobjGetFloorTerrainType(thing); if(tt->flags & TTF_SPAWN_SPLASHES) { - if((mo = P_SpawnMobj3f(MT_SPLASHBASE, thing->pos[VX], thing->pos[VY], - 0, thing->angle + ANG180, MSF_Z_FLOOR))) + if((mo = P_SpawnMobjXYZ(MT_SPLASHBASE, thing->origin[VX], thing->origin[VY], + 0, thing->angle + ANG180, MSF_Z_FLOOR))) mo->floorClip += SMALLSPLASHCLIP; - if((mo = P_SpawnMobj3f(MT_SPLASH, thing->pos[VX], thing->pos[VY], 0, - thing->angle, MSF_Z_FLOOR))) + if((mo = P_SpawnMobjXYZ(MT_SPLASH, thing->origin[VX], thing->origin[VY], 0, + thing->angle, MSF_Z_FLOOR))) { mo->target = thing; mo->mom[MX] = FIX2FLT((P_Random() - P_Random()) << 8); @@ -1228,11 +1226,11 @@ boolean P_HitFloor(mobj_t* thing) } else if(tt->flags & TTF_SPAWN_SMOKE) { - if((mo = P_SpawnMobj3f(MT_LAVASPLASH, thing->pos[VX], thing->pos[VY], 0, + if((mo = P_SpawnMobjXYZ(MT_LAVASPLASH, thing->origin[VX], thing->origin[VY], 0, thing->angle + ANG180, MSF_Z_FLOOR))) mo->floorClip += SMALLSPLASHCLIP; - if((mo = P_SpawnMobj3f(MT_LAVASMOKE, thing->pos[VX], thing->pos[VY], 0, + if((mo = P_SpawnMobjXYZ(MT_LAVASMOKE, thing->origin[VX], thing->origin[VY], 0, P_Random() << 24, MSF_Z_FLOOR))) { mo->mom[MZ] = 1 + FIX2FLT((P_Random() << 7)); @@ -1244,11 +1242,11 @@ boolean P_HitFloor(mobj_t* thing) } else if(tt->flags & TTF_SPAWN_SLUDGE) { - if((mo = P_SpawnMobj3f(MT_SLUDGESPLASH, thing->pos[VX], thing->pos[VY], 0, + if((mo = P_SpawnMobjXYZ(MT_SLUDGESPLASH, thing->origin[VX], thing->origin[VY], 0, thing->angle + ANG180, MSF_Z_FLOOR))) mo->floorClip += SMALLSPLASHCLIP; - if((mo = P_SpawnMobj3f(MT_SLUDGECHUNK, thing->pos[VX], thing->pos[VY], 0, + if((mo = P_SpawnMobjXYZ(MT_SLUDGECHUNK, thing->origin[VX], thing->origin[VY], 0, P_Random() << 24, MSF_Z_FLOOR))) { mo->target = thing; @@ -1263,60 +1261,48 @@ boolean P_HitFloor(mobj_t* thing) } /** - * @return @c true, if the missile is at a valid spawn point, - * otherwise; explode it and return @false. + * @return @c true, if the missile is at a valid spawn point, + * otherwise; explode it and return @false. */ -boolean P_CheckMissileSpawn(mobj_t *missile) +boolean P_CheckMissileSpawn(mobj_t* mo) { // Move a little forward so an angle can be computed if it immediately // explodes - if(missile->type == MT_BLASTERFX1) - { // Ultra-fast ripper spawning missile. - missile->pos[VX] += missile->mom[MX] / 8; - missile->pos[VY] += missile->mom[MY] / 8; - missile->pos[VZ] += missile->mom[MZ] / 8; + if(mo->type == MT_BLASTERFX1) + { + // Ultra-fast ripper spawning missile. + mo->origin[VX] += mo->mom[MX] / 8; + mo->origin[VY] += mo->mom[MY] / 8; + mo->origin[VZ] += mo->mom[MZ] / 8; } else { - missile->pos[VX] += missile->mom[MX] / 2; - missile->pos[VY] += missile->mom[MY] / 2; - missile->pos[VZ] += missile->mom[MZ] / 2; + mo->origin[VX] += mo->mom[MX] / 2; + mo->origin[VY] += mo->mom[MY] / 2; + mo->origin[VZ] += mo->mom[MZ] / 2; } - if(!P_TryMove(missile, missile->pos[VX], missile->pos[VY], false, false)) + if(!P_TryMoveXY(mo, mo->origin[VX], mo->origin[VY], false, false)) { - P_ExplodeMissile(missile); + P_ExplodeMissile(mo); return false; } return true; } -/** - * Tries to aim at a nearby monster if source is a player. Else aim is - * taken at dest. - * - * @param source The mobj doing the shooting. - * @param dest The mobj being shot at. Can be @c NULL if source - * is a player. - * @param type The type of mobj to be shot. - * @param checkSpawn @c true call P_CheckMissileSpawn. - * - * @return Pointer to the newly spawned missile. - */ -mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, - boolean checkSpawn) +mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, boolean checkSpawn) { - float pos[3]; - mobj_t* th = 0; - unsigned int an = 0; - angle_t angle = 0; - float dist = 0; - float slope = 0; - float spawnZOff = 0; - int spawnFlags = 0; + coord_t pos[3]; + mobj_t* th = 0; + unsigned int an = 0; + angle_t angle = 0; + coord_t dist = 0; + float slope = 0; + coord_t spawnZOff = 0; + int spawnFlags = 0; - memcpy(pos, source->pos, sizeof(pos)); + memcpy(pos, source->origin, sizeof(pos)); if(source->player) { @@ -1387,13 +1373,13 @@ mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, if(!source->player) { - angle = R_PointToAngle2(pos[VX], pos[VY], dest->pos[VX], dest->pos[VY]); + angle = M_PointToAngle2(pos, dest->origin); // Fuzzy player. if(dest->flags & MF_SHADOW) angle += (P_Random() - P_Random()) << 21; // note << 20 in jDoom } - if(!(th = P_SpawnMobj3fv(type, pos, angle, spawnFlags))) + if(!(th = P_SpawnMobj(type, pos, angle, spawnFlags))) return NULL; if(th->info->seeSound) @@ -1410,16 +1396,16 @@ mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, } else { - dist = P_ApproxDistance(dest->pos[VX] - pos[VX], - dest->pos[VY] - pos[VY]); + dist = M_ApproxDistance(dest->origin[VX] - pos[VX], + dest->origin[VY] - pos[VY]); dist /= th->info->speed; if(dist < 1) dist = 1; - th->mom[MZ] = (dest->pos[VZ] - source->pos[VZ]) / dist; + th->mom[MZ] = (dest->origin[VZ] - source->origin[VZ]) / dist; } // Make sure the speed is right (in 3D). - dist = P_ApproxDistance(P_ApproxDistance(th->mom[MX], th->mom[MY]), + dist = M_ApproxDistance(M_ApproxDistance(th->mom[MX], th->mom[MY]), th->mom[MZ]); if(!dist) dist = 1; @@ -1430,10 +1416,10 @@ mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, th->mom[MZ] *= dist; #if __JHERETIC__ - //// \kludge Set this global ptr as we need access to the mobj even if it - //// explodes instantly in order to assign values to it. - //// This is a bit of a kludge really... + /// @kludge Set this global ptr as we need access to the mobj even if it + /// explodes instantly in order to assign values to it. missileMobj = th; + // kludge end. #endif if(checkSpawn) @@ -1442,30 +1428,18 @@ mobj_t* P_SpawnMissile(mobjtype_t type, mobj_t* source, mobj_t* dest, return th; } -/** - * Tries to aim at a nearby monster if 'source' is a player. Else aim is - * the angle of the source mobj. Z angle is specified with momZ. - * - * @param type The type of mobj to be shot. - * @param source The mobj doing the shooting. - * @param angle The X/Y angle to shoot the missile in. - * @param momZ The Z momentum of the missile to be spawned. - * - * @return Pointer to the newly spawned missile. - */ -mobj_t *P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, angle_t mangle, - float momZ) +mobj_t* P_SpawnMissileAngle(mobjtype_t type, mobj_t* source, angle_t mangle, coord_t momZ) { - float pos[3]; - mobj_t *th = 0; - unsigned int an = 0; - angle_t angle = 0; - float dist = 0; - float slope = 0; - float spawnZOff = 0; - int spawnFlags = 0; + coord_t pos[3]; + mobj_t* th = 0; + unsigned int an = 0; + angle_t angle = 0; + coord_t dist = 0; + float slope = 0; + coord_t spawnZOff = 0; + int spawnFlags = 0; - memcpy(pos, source->pos, sizeof(pos)); + memcpy(pos, source->origin, sizeof(pos)); angle = mangle; if(source->player) @@ -1529,7 +1503,7 @@ mobj_t *P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, angle_t mangle, pos[VZ] -= source->floorClip; } - if(!(th = P_SpawnMobj3fv(type, pos, angle, spawnFlags))) + if(!(th = P_SpawnMobj(type, pos, angle, spawnFlags))) return NULL; if(th->info->seeSound) @@ -1545,7 +1519,7 @@ mobj_t *P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, angle_t mangle, th->mom[MZ] = th->info->speed * slope; // Make sure the speed is right (in 3D). - dist = P_ApproxDistance(P_ApproxDistance(th->mom[MX], th->mom[MY]), + dist = M_ApproxDistance(M_ApproxDistance(th->mom[MX], th->mom[MY]), th->mom[MZ]); if(dist < 1) dist = 1; @@ -1561,10 +1535,10 @@ mobj_t *P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, angle_t mangle, } #if __JHERETIC__ - //// \kludge Set this global ptr as we need access to the mobj even if it - //// explodes instantly in order to assign values to it. - //// This is a bit of a kludge really... + /// @kludge Set this global ptr as we need access to the mobj even if it + /// explodes instantly in order to assign values to it. missileMobj = th; + // kludge end. #endif if(P_CheckMissileSpawn(th)) @@ -1573,7 +1547,7 @@ mobj_t *P_SpawnMissileAngle(mobjtype_t type, mobj_t *source, angle_t mangle, return NULL; } -void C_DECL A_ContMobjSound(mobj_t *actor) +void C_DECL A_ContMobjSound(mobj_t* actor) { switch(actor->type) { diff --git a/doomsday/plugins/jheretic/src/p_oldsvg.c b/doomsday/plugins/jheretic/src/p_oldsvg.c index de90ee613d..0333fe1964 100644 --- a/doomsday/plugins/jheretic/src/p_oldsvg.c +++ b/doomsday/plugins/jheretic/src/p_oldsvg.c @@ -223,12 +223,12 @@ static void SV_v13_ReadPlayer(player_t* pl) static void SV_v13_ReadMobj(void) { - angle_t angle; - spritenum_t sprite; - int frame, valid, type, ddflags = 0; - float pos[3], mom[3], floorz, ceilingz, radius, height; - mobj_t *mo; - mobjinfo_t* info; + angle_t angle; + spritenum_t sprite; + int frame, valid, type, ddflags = 0; + coord_t pos[3], mom[3], floorz, ceilingz, radius, height; + mobj_t* mo; + mobjinfo_t* info; // The thinker was 3 ints long. SV_v13_ReadLong(); @@ -274,7 +274,7 @@ static void SV_v13_ReadMobj(void) /** * We now have all the information we need to create the mobj. */ - mo = P_MobjCreate(P_MobjThinker, pos[VX], pos[VY], pos[VZ], angle, + mo = P_MobjCreateXYZ(P_MobjThinker, pos[VX], pos[VY], pos[VZ], angle, radius, height, ddflags); mo->sprite = sprite; @@ -330,9 +330,9 @@ static void SV_v13_ReadMobj(void) mo->player = (player_t *) SV_v13_ReadLong(); mo->lastLook = SV_v13_ReadLong(); - mo->spawnSpot.pos[VX] = (float) SV_v13_ReadLong(); - mo->spawnSpot.pos[VY] = (float) SV_v13_ReadLong(); - mo->spawnSpot.pos[VZ] = 0; // Initialize with "something". + mo->spawnSpot.origin[VX] = (coord_t) SV_v13_ReadLong(); + mo->spawnSpot.origin[VY] = (coord_t) SV_v13_ReadLong(); + mo->spawnSpot.origin[VZ] = 0; // Initialize with "something". mo->spawnSpot.angle = (angle_t) (ANG45 * (SV_v13_ReadLong() / 45)); /*mo->spawnSpot.type = (int)*/ SV_v13_ReadLong(); @@ -354,14 +354,14 @@ static void SV_v13_ReadMobj(void) mo->player->plr->mo = mo; mo->player->plr->mo->dPlayer = mo->player->plr; } - P_MobjSetPosition(mo); - mo->floorZ = P_GetFloatp(mo->bspLeaf, DMU_FLOOR_HEIGHT); - mo->ceilingZ = P_GetFloatp(mo->bspLeaf, DMU_CEILING_HEIGHT); + P_MobjSetOrigin(mo); + mo->floorZ = P_GetDoublep(mo->bspLeaf, DMU_FLOOR_HEIGHT); + mo->ceilingZ = P_GetDoublep(mo->bspLeaf, DMU_CEILING_HEIGHT); } void P_v13_UnArchivePlayers(void) { - int i, j; + int i, j; for(i = 0; i < 4; ++i) { @@ -373,7 +373,7 @@ void P_v13_UnArchivePlayers(void) players[i].attacker = NULL; for(j = 0; j < NUMPSPRITES; ++j) { - player_t *plr = &players[i]; + player_t* plr = &players[i]; if(plr->pSprites[j].state) { @@ -402,8 +402,8 @@ void P_v13_UnArchiveWorld(void) sec = P_ToPtr(DMU_SECTOR, i); xsec = P_ToXSector(sec); - P_SetFixedp(sec, DMU_FLOOR_HEIGHT, *get++ << FRACBITS); - P_SetFixedp(sec, DMU_CEILING_HEIGHT, *get++ << FRACBITS); + P_SetDoublep(sec, DMU_FLOOR_HEIGHT, (coord_t)*get++); + P_SetDoublep(sec, DMU_CEILING_HEIGHT, (coord_t)*get++); P_SetPtrp(sec, DMU_FLOOR_MATERIAL, P_ToPtr(DMU_MATERIAL, DD_MaterialForTextureUniqueId(TN_FLATS, *get++))); P_SetPtrp(sec, DMU_CEILING_MATERIAL, P_ToPtr(DMU_MATERIAL, DD_MaterialForTextureUniqueId(TN_FLATS, *get++))); P_SetFloatp(sec, DMU_LIGHT_LEVEL, (float) (*get++) / 255.0f); diff --git a/doomsday/plugins/jheretic/src/p_pspr.c b/doomsday/plugins/jheretic/src/p_pspr.c index f050317a5e..985f146208 100644 --- a/doomsday/plugins/jheretic/src/p_pspr.c +++ b/doomsday/plugins/jheretic/src/p_pspr.c @@ -921,11 +921,11 @@ void P_BulletSlope(mobj_t *mo) bulletSlope = tan(LOOKDIR2RAD(mo->dPlayer->lookDir)) / 1.2; } -void C_DECL A_BeakAttackPL1(player_t *player, pspdef_t *psp) +void C_DECL A_BeakAttackPL1(player_t* player, pspdef_t* psp) { - angle_t angle; - int damage; - float slope; + angle_t angle; + int damage; + float slope; P_ShotAmmo(player); damage = 1 + (P_Random() & 3); @@ -937,9 +937,7 @@ void C_DECL A_BeakAttackPL1(player_t *player, pspdef_t *psp) P_LineAttack(player->plr->mo, angle, MELEERANGE, slope, damage); if(lineTarget) { - player->plr->mo->angle = - R_PointToAngle2(player->plr->mo->pos[VX], player->plr->mo->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + player->plr->mo->angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin); } S_StartSoundEx(SFX_CHICPK1 + (P_Random() % 3), player->plr->mo); @@ -947,11 +945,11 @@ void C_DECL A_BeakAttackPL1(player_t *player, pspdef_t *psp) psp->tics -= P_Random() & 7; } -void C_DECL A_BeakAttackPL2(player_t *player, pspdef_t *psp) +void C_DECL A_BeakAttackPL2(player_t* player, pspdef_t* psp) { - angle_t angle; - int damage; - float slope; + angle_t angle; + int damage; + float slope; P_ShotAmmo(player); damage = HITDICE(4); @@ -963,9 +961,7 @@ void C_DECL A_BeakAttackPL2(player_t *player, pspdef_t *psp) P_LineAttack(player->plr->mo, angle, MELEERANGE, slope, damage); if(lineTarget) { - player->plr->mo->angle = - R_PointToAngle2(player->plr->mo->pos[VX], player->plr->mo->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + player->plr->mo->angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin); } S_StartSoundEx(SFX_CHICPK1 + (P_Random() % 3), player->plr->mo); @@ -973,11 +969,11 @@ void C_DECL A_BeakAttackPL2(player_t *player, pspdef_t *psp) psp->tics -= P_Random() & 3; } -void C_DECL A_StaffAttackPL1(player_t *player, pspdef_t *psp) +void C_DECL A_StaffAttackPL1(player_t* player, pspdef_t* psp) { - angle_t angle; - int damage; - float slope; + angle_t angle; + int damage; + float slope; P_ShotAmmo(player); damage = 5 + (P_Random() & 15); @@ -991,17 +987,15 @@ void C_DECL A_StaffAttackPL1(player_t *player, pspdef_t *psp) if(lineTarget) { // Turn to face target. - player->plr->mo->angle = - R_PointToAngle2(player->plr->mo->pos[VX], player->plr->mo->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + player->plr->mo->angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin); } } -void C_DECL A_StaffAttackPL2(player_t *player, pspdef_t *psp) +void C_DECL A_StaffAttackPL2(player_t* player, pspdef_t* psp) { - angle_t angle; - int damage; - float slope; + angle_t angle; + int damage; + float slope; P_ShotAmmo(player); damage = 18 + (P_Random() & 63); @@ -1016,17 +1010,15 @@ void C_DECL A_StaffAttackPL2(player_t *player, pspdef_t *psp) if(lineTarget) { // Turn to face target. - player->plr->mo->angle = - R_PointToAngle2(player->plr->mo->pos[VX], player->plr->mo->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + player->plr->mo->angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin); } } -void C_DECL A_FireBlasterPL1(player_t *player, pspdef_t *psp) +void C_DECL A_FireBlasterPL1(player_t* player, pspdef_t* psp) { - mobj_t *mo; - angle_t angle; - int damage; + mobj_t* mo; + angle_t angle; + int damage; mo = player->plr->mo; S_StartSoundEx(SFX_GLDHIT, mo); @@ -1080,19 +1072,19 @@ void C_DECL A_FireGoldWandPL1(player_t *player, pspdef_t *psp) P_LineAttack(mo, angle, MISSILERANGE, bulletSlope, damage); } -void C_DECL A_FireGoldWandPL2(player_t *player, pspdef_t *psp) +void C_DECL A_FireGoldWandPL2(player_t* player, pspdef_t* psp) { - int i; - mobj_t *mo; - angle_t angle; - int damage; - float momZ; + int i; + mobj_t* mo; + angle_t angle; + int damage; + coord_t momZ; mo = player->plr->mo; P_ShotAmmo(player); S_StartSoundEx(SFX_GLDHIT, player->plr->mo); - if(IS_CLIENT) - return; + + if(IS_CLIENT) return; puffType = MT_GOLDWANDPUFF2; P_BulletSlope(mo); @@ -1110,27 +1102,25 @@ void C_DECL A_FireGoldWandPL2(player_t *player, pspdef_t *psp) } } -void C_DECL A_FireMacePL1B(player_t *player, pspdef_t *psp) +void C_DECL A_FireMacePL1B(player_t* player, pspdef_t* psp) { - mobj_t *pmo, *ball; - uint an; + mobj_t* pmo, *ball; + uint an; - if(!P_CheckAmmo(player)) - return; + if(!P_CheckAmmo(player)) return; P_ShotAmmo(player); - if(IS_CLIENT) - return; + + if(IS_CLIENT) return; pmo = player->plr->mo; - if((ball = P_SpawnMobj3f(MT_MACEFX2, pmo->pos[VX], pmo->pos[VY], - pmo->pos[VZ] - pmo->floorClip + 28, + if((ball = P_SpawnMobjXYZ(MT_MACEFX2, pmo->origin[VX], pmo->origin[VY], + pmo->origin[VZ] - pmo->floorClip + 28, pmo->angle, 0))) { - ball->mom[MZ] = - 2 + FIX2FLT(((int) player->plr->lookDir) << (FRACBITS - 5)); + ball->mom[MZ] = 2 + FIX2FLT(((int) player->plr->lookDir) << (FRACBITS - 5)); ball->target = pmo; - ball->pos[VZ] += FIX2FLT(((int) player->plr->lookDir) << (FRACBITS - 4)); + ball->origin[VZ] += FIX2FLT(((int) player->plr->lookDir) << (FRACBITS - 4)); an = ball->angle >> ANGLETOFINESHIFT; ball->mom[MX] = (pmo->mom[MX] / 2) + @@ -1143,28 +1133,27 @@ void C_DECL A_FireMacePL1B(player_t *player, pspdef_t *psp) } } -void C_DECL A_FireMacePL1(player_t *player, pspdef_t *psp) +void C_DECL A_FireMacePL1(player_t* player, pspdef_t* psp) { - mobj_t *ball; + mobj_t* ball; if(P_Random() < 28) { A_FireMacePL1B(player, psp); return; } - if(!P_CheckAmmo(player)) - return; + + if(!P_CheckAmmo(player)) return; P_ShotAmmo(player); psp->pos[VX] = ((P_Random() & 3) - 2); psp->pos[VY] = WEAPONTOP + (P_Random() & 3); - if(IS_CLIENT) - return; - ball = - P_SpawnMissileAngle(MT_MACEFX1, player->plr->mo, - player->plr->mo->angle + (((P_Random() & 7) - 4) << 24), - -12345); + if(IS_CLIENT) return; + + ball = P_SpawnMissileAngle(MT_MACEFX1, player->plr->mo, + player->plr->mo->angle + (((P_Random() & 7) - 4) << 24), + -12345); if(ball) { ball->special1 = 16; // Tics till dropoff. @@ -1194,17 +1183,19 @@ void C_DECL A_MacePL1Check(mobj_t *ball) ball->mom[MZ] /= 2; } -void C_DECL A_MaceBallImpact(mobj_t *ball) +void C_DECL A_MaceBallImpact(mobj_t* ball) { - if(ball->pos[VZ] <= ball->floorZ && P_HitFloor(ball)) - { // Landed in some sort of liquid. + if(ball->origin[VZ] <= ball->floorZ && P_HitFloor(ball)) + { + // Landed in some sort of liquid. P_MobjRemove(ball, true); return; } - if(ball->special3 != MAGIC_JUNK && ball->pos[VZ] <= ball->floorZ && + if(ball->special3 != MAGIC_JUNK && ball->origin[VZ] <= ball->floorZ && !FEQUAL(ball->mom[MZ], 0)) - { // Bounce. + { + // Bounce. ball->special3 = MAGIC_JUNK; ball->mom[MZ] = FIX2FLT(FLT2FIX(ball->mom[MZ] * 192) >> 8); ball->flags2 &= ~MF2_FLOORBOUNCE; @@ -1212,38 +1203,40 @@ void C_DECL A_MaceBallImpact(mobj_t *ball) S_StartSound(SFX_BOUNCE, ball); } else - { // Explode. + { + // Explode. ball->flags |= MF_NOGRAVITY; ball->flags2 &= ~MF2_LOGRAV; S_StartSound(SFX_LOBHIT, ball); } } -void C_DECL A_MaceBallImpact2(mobj_t *ball) +void C_DECL A_MaceBallImpact2(mobj_t* ball) { - - - if(ball->pos[VZ] <= ball->floorZ && P_HitFloor(ball)) - { // Landed in some sort of liquid. + if(ball->origin[VZ] <= ball->floorZ && P_HitFloor(ball)) + { + // Landed in some sort of liquid. P_MobjRemove(ball, true); return; } - if(ball->pos[VZ] != ball->floorZ || ball->mom[MZ] < 2) - { // Explode + if(!FEQUAL(ball->origin[VZ], ball->floorZ) || ball->mom[MZ] < 2) + { + // Explode ball->mom[MX] = ball->mom[MY] = ball->mom[MZ] = 0; ball->flags |= MF_NOGRAVITY; ball->flags2 &= ~(MF2_LOGRAV | MF2_FLOORBOUNCE); } else - { // Bounce - mobj_t* tiny; - unsigned int an; + { + // Bounce + mobj_t* tiny; + unsigned int an; ball->mom[MZ] = FIX2FLT(FLT2FIX(ball->mom[MZ] * 192) >> 8); P_MobjChangeState(ball, P_GetState(ball->type, SN_SPAWN)); - if((tiny = P_SpawnMobj3fv(MT_MACEFX3, ball->pos, ball->angle + ANG90, 0))) + if((tiny = P_SpawnMobj(MT_MACEFX3, ball->origin, ball->angle + ANG90, 0))) { tiny->target = ball->target; an = tiny->angle >> ANGLETOFINESHIFT; @@ -1255,7 +1248,7 @@ void C_DECL A_MaceBallImpact2(mobj_t *ball) P_CheckMissileSpawn(tiny); } - if((tiny = P_SpawnMobj3fv(MT_MACEFX3, ball->pos, ball->angle - ANG90, 0))) + if((tiny = P_SpawnMobj(MT_MACEFX3, ball->origin, ball->angle - ANG90, 0))) { tiny->target = ball->target; an = tiny->angle >> ANGLETOFINESHIFT; @@ -1292,21 +1285,23 @@ void C_DECL A_FireMacePL2(player_t *player, pspdef_t *psp) } } -void C_DECL A_DeathBallImpact(mobj_t *ball) +void C_DECL A_DeathBallImpact(mobj_t* ball) { - int i; - mobj_t *target; - angle_t angle; - boolean newAngle; + int i; + mobj_t* target; + angle_t angle; + boolean newAngle; - if(ball->pos[VZ] <= ball->floorZ && P_HitFloor(ball)) - { // Landed in some sort of liquid. + if(ball->origin[VZ] <= ball->floorZ && P_HitFloor(ball)) + { + // Landed in some sort of liquid. P_MobjRemove(ball, true); return; } - if(ball->pos[VZ] <= ball->floorZ && !FEQUAL(ball->mom[MZ], 0)) - { // Bounce. + if(ball->origin[VZ] <= ball->floorZ && !FEQUAL(ball->mom[MZ], 0)) + { + // Bounce. newAngle = false; target = ball->tracer; angle = 0; @@ -1314,26 +1309,27 @@ void C_DECL A_DeathBallImpact(mobj_t *ball) if(target) { if(!(target->flags & MF_SHOOTABLE)) - { // Target died. + { + // Target died. ball->tracer = NULL; } else - { // Seek. - angle = R_PointToAngle2(ball->pos[VX], ball->pos[VY], - target->pos[VX], target->pos[VY]); + { + // Seek. + angle = M_PointToAngle2(ball->origin, target->origin); newAngle = true; } } else - { // Find new target. + { + // Find new target. for(i = 0; i < 16; ++i) { P_AimLineAttack(ball, angle, 10 * 64); if(lineTarget && ball->target != lineTarget) { ball->tracer = lineTarget; - angle = R_PointToAngle2(ball->pos[VX], ball->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + angle = M_PointToAngle2(ball->origin, lineTarget->origin); newAngle = true; break; } @@ -1344,7 +1340,7 @@ void C_DECL A_DeathBallImpact(mobj_t *ball) if(newAngle) { - uint an = angle >> ANGLETOFINESHIFT; + uint an = angle >> ANGLETOFINESHIFT; ball->angle = angle; ball->mom[MX] = ball->info->speed * FIX2FLT(finecosine[an]); @@ -1355,7 +1351,8 @@ void C_DECL A_DeathBallImpact(mobj_t *ball) S_StartSound(SFX_PSTOP, ball); } else - { // Explode. + { + // Explode. ball->flags |= MF_NOGRAVITY; ball->flags2 &= ~MF2_LOGRAV; S_StartSound(SFX_PHOHIT, ball); @@ -1372,7 +1369,7 @@ void C_DECL A_SpawnRippers(mobj_t* actor) uint an; mobj_t* ripper; - if((ripper = P_SpawnMobj3fv(MT_RIPPER, actor->pos, angle, 0))) + if((ripper = P_SpawnMobj(MT_RIPPER, actor->origin, angle, 0))) { ripper->target = actor->target; an = angle >> ANGLETOFINESHIFT; @@ -1400,7 +1397,7 @@ void C_DECL A_FireCrossbowPL1(player_t* player, pspdef_t* psp) void C_DECL A_FireCrossbowPL2(player_t* player, pspdef_t* psp) { - mobj_t* pmo; + mobj_t* pmo; pmo = player->plr->mo; P_ShotAmmo(player); @@ -1416,30 +1413,28 @@ void C_DECL A_FireCrossbowPL2(player_t* player, pspdef_t* psp) void C_DECL A_BoltSpark(mobj_t* bolt) { - mobj_t* spark; + mobj_t* spark; if(IS_NETWORK_SERVER) return; // Would not be visible to anynoe. if(P_Random() > 50) { - if((spark = P_SpawnMobj3fv(MT_CRBOWFX4, bolt->pos, P_Random() << 24, 0))) + if((spark = P_SpawnMobj(MT_CRBOWFX4, bolt->origin, P_Random() << 24, 0))) { - spark->pos[VX] += FIX2FLT((P_Random() - P_Random()) << 10); - spark->pos[VY] += FIX2FLT((P_Random() - P_Random()) << 10); + spark->origin[VX] += FIX2FLT((P_Random() - P_Random()) << 10); + spark->origin[VY] += FIX2FLT((P_Random() - P_Random()) << 10); } } } void C_DECL A_FireSkullRodPL1(player_t* player, pspdef_t* psp) { - mobj_t* mo; + mobj_t* mo; - if(!P_CheckAmmo(player)) - return; + if(!P_CheckAmmo(player)) return; P_ShotAmmo(player); - if(IS_CLIENT) - return; + if(IS_CLIENT) return; if((mo = P_SpawnMissile(MT_HORNRODFX1, player->plr->mo, NULL, true))) { @@ -1537,12 +1532,12 @@ void C_DECL A_AddPlayerRain(mobj_t *actor) } } -void C_DECL A_SkullRodStorm(mobj_t *actor) +void C_DECL A_SkullRodStorm(mobj_t* actor) { - float pos[3]; - mobj_t *mo; - int playerNum; - player_t *player; + coord_t pos[3]; + mobj_t* mo; + int playerNum; + player_t* player; if(actor->special3-- == 0) { @@ -1550,7 +1545,8 @@ void C_DECL A_SkullRodStorm(mobj_t *actor) playerNum = (IS_NETGAME ? actor->special2 : 0); if(!players[playerNum].plr->inGame) - { // Player not left the game. + { + // Player not left the game. return; } @@ -1577,10 +1573,10 @@ void C_DECL A_SkullRodStorm(mobj_t *actor) return; } - pos[VX] = actor->pos[VX] + ((P_Random() & 127) - 64); - pos[VY] = actor->pos[VY] + ((P_Random() & 127) - 64); + pos[VX] = actor->origin[VX] + ((P_Random() & 127) - 64); + pos[VY] = actor->origin[VY] + ((P_Random() & 127) - 64); - if((mo = P_SpawnMobj3f(MT_RAINPLR1 + actor->special2, pos[VX], pos[VY], + if((mo = P_SpawnMobjXYZ(MT_RAINPLR1 + actor->special2, pos[VX], pos[VY], 0, P_Random() << 24, MSF_Z_CEIL))) { mo->flags |= MF_BRIGHTSHADOW; @@ -1600,7 +1596,7 @@ void C_DECL A_SkullRodStorm(mobj_t *actor) void C_DECL A_RainImpact(mobj_t *actor) { - if(actor->pos[VZ] > actor->floorZ) + if(actor->origin[VZ] > actor->floorZ) { P_MobjChangeState(actor, S_RAINAIRXPLR1_1 + actor->special2); } @@ -1612,7 +1608,7 @@ void C_DECL A_RainImpact(mobj_t *actor) void C_DECL A_HideInCeiling(mobj_t* actor) { - actor->pos[VZ] = actor->ceilingZ + 4; + actor->origin[VZ] = actor->ceilingZ + 4; } void C_DECL A_FirePhoenixPL1(player_t* player, pspdef_t* psp) @@ -1638,7 +1634,7 @@ void C_DECL A_PhoenixPuff(mobj_t* actor) P_SeekerMissile(actor, ANGLE_1 * 5, ANGLE_1 * 10); - if((puff = P_SpawnMobj3fv(MT_PHOENIXPUFF, actor->pos, actor->angle + ANG90, 0))) + if((puff = P_SpawnMobj(MT_PHOENIXPUFF, actor->origin, actor->angle + ANG90, 0))) { an = puff->angle >> ANGLETOFINESHIFT; puff->mom[MX] = 1.3 * FIX2FLT(finecosine[an]); @@ -1646,7 +1642,7 @@ void C_DECL A_PhoenixPuff(mobj_t* actor) puff->mom[MZ] = 0; } - if((puff = P_SpawnMobj3fv(MT_PHOENIXPUFF, actor->pos, actor->angle - ANG90, 0))) + if((puff = P_SpawnMobj(MT_PHOENIXPUFF, actor->origin, actor->angle - ANG90, 0))) { an = puff->angle >> ANGLETOFINESHIFT; puff->mom[MX] = 1.3 * FIX2FLT(finecosine[an]); @@ -1663,12 +1659,13 @@ void C_DECL A_InitPhoenixPL2(player_t *player, pspdef_t *psp) /** * Flame thrower effect. */ -void C_DECL A_FirePhoenixPL2(player_t *player, pspdef_t *psp) +void C_DECL A_FirePhoenixPL2(player_t* player, pspdef_t* psp) { - mobj_t *mo, *pmo; - angle_t angle; - uint an; - float pos[3], slope; + mobj_t* mo, *pmo; + angle_t angle; + coord_t pos[3]; + float slope; + uint an; if(IS_CLIENT) return; @@ -1682,7 +1679,7 @@ void C_DECL A_FirePhoenixPL2(player_t *player, pspdef_t *psp) pmo = player->plr->mo; angle = pmo->angle; - memcpy(pos, pmo->pos, sizeof(pos)); + memcpy(pos, pmo->origin, sizeof(pos)); pos[VX] += FIX2FLT((P_Random() - P_Random()) << 9); pos[VY] += FIX2FLT((P_Random() - P_Random()) << 9); pos[VZ] += 26 + player->plr->lookDir / 173; @@ -1690,7 +1687,7 @@ void C_DECL A_FirePhoenixPL2(player_t *player, pspdef_t *psp) slope = sin(LOOKDIR2RAD(player->plr->lookDir)) / 1.2; - if((mo = P_SpawnMobj3fv(MT_PHOENIXFX2, pos, angle, 0))) + if((mo = P_SpawnMobj(MT_PHOENIXFX2, pos, angle, 0))) { mo->target = pmo; an = mo->angle >> ANGLETOFINESHIFT; @@ -1722,11 +1719,12 @@ void C_DECL A_FloatPuff(mobj_t *puff) puff->mom[MZ] += 1.8f; } -void C_DECL A_GauntletAttack(player_t *player, pspdef_t *psp) +void C_DECL A_GauntletAttack(player_t* player, pspdef_t* psp) { - angle_t angle; - int damage, randVal; - float slope, dist; + angle_t angle; + int damage, randVal; + float slope; + coord_t dist; P_ShotAmmo(player); psp->pos[VX] = ((P_Random() & 3) - 2); @@ -1785,8 +1783,7 @@ void C_DECL A_GauntletAttack(player_t *player, pspdef_t *psp) } // Turn to face target. - angle = R_PointToAngle2(player->plr->mo->pos[VX], player->plr->mo->pos[VY], - lineTarget->pos[VX], lineTarget->pos[VY]); + angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin); if(angle - player->plr->mo->angle > ANG180) { if(angle - player->plr->mo->angle < -ANG90 / 20) @@ -1882,10 +1879,10 @@ void C_DECL A_FireBomb(mobj_t* mo) an = mo->angle >> ANGLETOFINESHIFT; - if((bomb = P_SpawnMobj3f(MT_FIREBOMB, - mo->pos[VX] + 24 * FIX2FLT(finecosine[an]), - mo->pos[VY] + 24 * FIX2FLT(finesine[an]), - mo->pos[VZ] - mo->floorClip + 15, + if((bomb = P_SpawnMobjXYZ(MT_FIREBOMB, + mo->origin[VX] + 24 * FIX2FLT(finecosine[an]), + mo->origin[VY] + 24 * FIX2FLT(finesine[an]), + mo->origin[VZ] - mo->floorClip + 15, mo->angle, 0))) { bomb->target = mo; diff --git a/doomsday/plugins/jheretic/src/p_sound.c b/doomsday/plugins/jheretic/src/p_sound.c index 1250e5a782..c0df8601b7 100644 --- a/doomsday/plugins/jheretic/src/p_sound.c +++ b/doomsday/plugins/jheretic/src/p_sound.c @@ -82,7 +82,7 @@ void S_SectorSound(Sector *sec, int origin, int id) { mobj_t* centerorigin, *floororigin, *ceilingorigin; - centerorigin = (mobj_t*) P_GetPtrp(sec, DMU_ORIGIN); + centerorigin = (mobj_t*) P_GetPtrp(sec, DMU_BASE); floororigin = (mobj_t*) P_GetPtrp(sec, DMU_FLOOR_ORIGIN); ceilingorigin = (mobj_t*) P_GetPtrp(sec, DMU_CEILING_ORIGIN); diff --git a/doomsday/plugins/jheretic/src/p_spec.c b/doomsday/plugins/jheretic/src/p_spec.c index 0f0fed5691..78fef2dbab 100644 --- a/doomsday/plugins/jheretic/src/p_spec.c +++ b/doomsday/plugins/jheretic/src/p_spec.c @@ -51,6 +51,7 @@ #include "p_door.h" #include "p_floor.h" #include "p_plat.h" +#include "p_user.h" #include "p_switch.h" #include "d_netsv.h" @@ -957,12 +958,12 @@ static void P_ShootSpecialLine(mobj_t* thing, LineDef* line) /** * Called every tic frame that the player origin is in a special sector. */ -void P_PlayerInSpecialSector(player_t *player) +void P_PlayerInSpecialSector(player_t* player) { Sector *sector = P_GetPtrp(player->plr->mo->bspLeaf, DMU_SECTOR); // Falling, not all the way down yet? - if(player->plr->mo->pos[VZ] != P_GetFloatp(sector, DMU_FLOOR_HEIGHT)) + if(!FEQUAL(player->plr->mo->origin[VZ], P_GetDoublep(sector, DMU_FLOOR_HEIGHT))) return; // Has hitten ground. @@ -1059,10 +1060,10 @@ void P_UpdateSpecials(void) { #define PLANE_MATERIAL_SCROLLUNIT (8.f/35*2) - uint i; - float x; - LineDef* line; - SideDef* side; + uint i; + float x; + LineDef* line; + SideDef* side; // Extended lines and sectors. XG_Ticker(); @@ -1070,8 +1071,8 @@ void P_UpdateSpecials(void) // Update scrolling plane materials. for(i = 0; i < numsectors; ++i) { - xsector_t* sect = P_ToXSector(P_ToPtr(DMU_SECTOR, i)); - float texOff[2]; + xsector_t* sect = P_ToXSector(P_ToPtr(DMU_SECTOR, i)); + float texOff[2]; switch(sect->special) { @@ -1325,7 +1326,7 @@ void P_InitLava(void) void P_PlayerInWindSector(player_t* player) { - static const float pushTab[5] = { + static const coord_t pushTab[5] = { 2048.0 / FRACUNIT * 5, 2048.0 / FRACUNIT * 10, 2048.0 / FRACUNIT * 25, diff --git a/doomsday/plugins/jheretic/src/p_telept.c b/doomsday/plugins/jheretic/src/p_telept.c index 144942f0bf..e2657aef93 100644 --- a/doomsday/plugins/jheretic/src/p_telept.c +++ b/doomsday/plugins/jheretic/src/p_telept.c @@ -1,4 +1,4 @@ -/**\file +/**\file p_telept.c *\section License * License: GPL * Online License Link: http://www.gnu.org/licenses/gpl.html @@ -23,12 +23,6 @@ * Boston, MA 02110-1301 USA */ -/** - * p_telept.c: - */ - -// HEADER FILES ------------------------------------------------------------ - #include #include "jheretic.h" @@ -39,38 +33,20 @@ #include "p_mapspec.h" #include "p_terraintype.h" -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - -mobj_t* P_SpawnTeleFog(float x, float y, angle_t angle) +mobj_t* P_SpawnTeleFog(coord_t x, coord_t y, angle_t angle) { - return P_SpawnMobj3f(MT_TFOG, x, y, TELEFOGHEIGHT, angle, MSF_Z_FLOOR); + return P_SpawnMobjXYZ(MT_TFOG, x, y, TELEFOGHEIGHT, angle, MSF_Z_FLOOR); } -boolean P_Teleport(mobj_t* mo, float x, float y, angle_t angle, boolean spawnFog) +boolean P_Teleport(mobj_t* mo, coord_t x, coord_t y, angle_t angle, boolean spawnFog) { - float oldpos[3], aboveFloor, fogDelta; + coord_t oldpos[3], aboveFloor, fogDelta; angle_t oldAngle; mobj_t* fog; uint an; - memcpy(oldpos, mo->pos, sizeof(oldpos)); - aboveFloor = mo->pos[VZ] - mo->floorZ; + memcpy(oldpos, mo->origin, sizeof(oldpos)); + aboveFloor = mo->origin[VZ] - mo->floorZ; oldAngle = mo->angle; if(!P_TeleportMove(mo, x, y, false)) { @@ -83,52 +59,52 @@ boolean P_Teleport(mobj_t* mo, float x, float y, angle_t angle, boolean spawnFog player_t* player = mo->player; if(player->powers[PT_FLIGHT] && aboveFloor > 0) { - mo->pos[VZ] = mo->floorZ + aboveFloor; - if(mo->pos[VZ] + mo->height > mo->ceilingZ) + mo->origin[VZ] = mo->floorZ + aboveFloor; + if(mo->origin[VZ] + mo->height > mo->ceilingZ) { - mo->pos[VZ] = mo->ceilingZ - mo->height; + mo->origin[VZ] = mo->ceilingZ - mo->height; } - player->viewZ = mo->pos[VZ] + player->viewHeight; + player->viewZ = mo->origin[VZ] + player->viewHeight; } else { //player->plr->clLookDir = 0; /* $unifiedangles */ player->plr->lookDir = 0; - mo->pos[VZ] = mo->floorZ; + mo->origin[VZ] = mo->floorZ; } - player->viewHeight = (float) cfg.plrViewHeight; + player->viewHeight = (coord_t) cfg.plrViewHeight; player->viewHeightDelta = 0; - player->viewZ = mo->pos[VZ] + player->viewHeight; + player->viewZ = mo->origin[VZ] + player->viewHeight; player->viewOffset[VX] = player->viewOffset[VY] = player->viewOffset[VZ] = 0; player->bob = 0; //player->plr->clAngle = angle; /* $unifiedangles */ - player->plr->flags |= DDPF_FIXANGLES | DDPF_FIXPOS | DDPF_FIXMOM; + player->plr->flags |= DDPF_FIXANGLES | DDPF_FIXORIGIN | DDPF_FIXMOM; } else if(mo->flags & MF_MISSILE) { - mo->pos[VZ] = mo->floorZ + aboveFloor; - if(mo->pos[VZ] + mo->height > mo->ceilingZ) + mo->origin[VZ] = mo->floorZ + aboveFloor; + if(mo->origin[VZ] + mo->height > mo->ceilingZ) { - mo->pos[VZ] = mo->ceilingZ - mo->height; + mo->origin[VZ] = mo->ceilingZ - mo->height; } } else { - mo->pos[VZ] = mo->floorZ; + mo->origin[VZ] = mo->floorZ; } if(spawnFog) { // Spawn teleport fog at source and destination fogDelta = ((mo->flags & MF_MISSILE)? 0 : TELEFOGHEIGHT); - if((fog = P_SpawnMobj3f(MT_TFOG, oldpos[VX], oldpos[VY], oldpos[VZ] + fogDelta, oldAngle + ANG180, 0))) + if((fog = P_SpawnMobjXYZ(MT_TFOG, oldpos[VX], oldpos[VY], oldpos[VZ] + fogDelta, oldAngle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); an = angle >> ANGLETOFINESHIFT; - if((fog = P_SpawnMobj3f(MT_TFOG, x + 20 * FIX2FLT(finecosine[an]), y + 20 * FIX2FLT(finesine[an]), mo->pos[VZ] + fogDelta, angle + ANG180, 0))) + if((fog = P_SpawnMobjXYZ(MT_TFOG, x + 20 * FIX2FLT(finecosine[an]), y + 20 * FIX2FLT(finesine[an]), mo->origin[VZ] + fogDelta, angle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); } @@ -142,11 +118,9 @@ boolean P_Teleport(mobj_t* mo, float x, float y, angle_t angle, boolean spawnFog { mo->floorClip = 0; - if(mo->pos[VZ] == - P_GetFloatp(mo->bspLeaf, DMU_FLOOR_HEIGHT)) + if(FEQUAL(mo->origin[VZ], P_GetDoublep(mo->bspLeaf, DMU_FLOOR_HEIGHT))) { const terraintype_t* tt = P_MobjGetFloorTerrainType(mo); - if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; @@ -170,15 +144,15 @@ boolean P_Teleport(mobj_t* mo, float x, float y, angle_t angle, boolean spawnFog } typedef struct { - Sector* sec; - mobjtype_t type; - mobj_t* foundMobj; + Sector* sec; + mobjtype_t type; + mobj_t* foundMobj; } findmobjparams_t; static int findMobj(thinker_t* th, void* context) { - findmobjparams_t* params = (findmobjparams_t*) context; - mobj_t* mo = (mobj_t *) th; + findmobjparams_t* params = (findmobjparams_t*) context; + mobj_t* mo = (mobj_t *) th; // Must be of the correct type? if(params->type >= 0 && params->type != mo->type) @@ -196,13 +170,13 @@ static int findMobj(thinker_t* th, void* context) static mobj_t* getTeleportDestination(short tag) { - iterlist_t* list; + iterlist_t* list; list = P_GetSectorIterListForTag(tag, false); if(list) { - Sector* sec = NULL; - findmobjparams_t params; + Sector* sec = NULL; + findmobjparams_t params; params.type = MT_TELEPORTMAN; params.foundMobj = NULL; @@ -225,23 +199,20 @@ static mobj_t* getTeleportDestination(short tag) boolean EV_Teleport(LineDef* line, int side, mobj_t* mo, boolean spawnFog) { - mobj_t* dest; + mobj_t* dest; // Clients cannot teleport on their own. - if(IS_CLIENT) - return 0; + if(IS_CLIENT) return 0; - if(mo->flags2 & MF2_NOTELEPORT) - return false; + // Are we allowed to teleport this? + if(mo->flags2 & MF2_NOTELEPORT) return false; // Don't teleport if hit back of line, so you can get out of teleporter. - if(side == 1) - return false; + if(side == 1) return false; if((dest = getTeleportDestination(P_ToXLine(line)->tag)) != NULL) { - return P_Teleport(mo, dest->pos[VX], dest->pos[VY], dest->angle, - spawnFog); + return P_Teleport(mo, dest->origin[VX], dest->origin[VY], dest->angle, spawnFog); } return false; @@ -256,7 +227,7 @@ void P_ArtiTele(player_t* player) if((start = P_GetPlayerStart(0, deathmatch? -1 : 0, deathmatch))) { const mapspot_t* spot = &mapSpots[start->spot]; - P_Teleport(player->plr->mo, spot->pos[VX], spot->pos[VY], spot->angle, true); + P_Teleport(player->plr->mo, spot->origin[VX], spot->origin[VY], spot->angle, true); #if __JHEXEN__ if(player->morphTics) diff --git a/doomsday/plugins/jheretic/src/st_stuff.c b/doomsday/plugins/jheretic/src/st_stuff.c index fb96d88c1b..12b925e0fe 100644 --- a/doomsday/plugins/jheretic/src/st_stuff.c +++ b/doomsday/plugins/jheretic/src/st_stuff.c @@ -2628,10 +2628,10 @@ static void initAutomapForCurrentMap(uiwidget_t* obj) UIAutomap_Reset(obj); UIAutomap_SetMinScale(obj, 2 * PLAYERRADIUS); - UIAutomap_SetWorldBounds(obj, *((float*) DD_GetVariable(DD_MAP_MIN_X)), - *((float*) DD_GetVariable(DD_MAP_MAX_X)), - *((float*) DD_GetVariable(DD_MAP_MIN_Y)), - *((float*) DD_GetVariable(DD_MAP_MAX_Y))); + UIAutomap_SetWorldBounds(obj, *((coord_t*) DD_GetVariable(DD_MAP_MIN_X)), + *((coord_t*) DD_GetVariable(DD_MAP_MAX_X)), + *((coord_t*) DD_GetVariable(DD_MAP_MIN_Y)), + *((coord_t*) DD_GetVariable(DD_MAP_MAX_Y))); mcfg = UIAutomap_Config(obj); @@ -2658,7 +2658,7 @@ static void initAutomapForCurrentMap(uiwidget_t* obj) followMobj = UIAutomap_FollowMobj(obj); if(followMobj) { - UIAutomap_SetCameraOrigin(obj, followMobj->pos[VX], followMobj->pos[VY]); + UIAutomap_SetCameraOrigin(obj, followMobj->origin[VX], followMobj->origin[VY]); } if(IS_NETGAME) @@ -3039,7 +3039,7 @@ void ST_AutomapClearPoints(int player) /** * Adds a marker at the specified X/Y location. */ -int ST_AutomapAddPoint(int player, float x, float y, float z) +int ST_AutomapAddPoint(int player, coord_t x, coord_t y, coord_t z) { static char buffer[20]; uiwidget_t* obj = ST_UIAutomapForPlayer(player); @@ -3056,7 +3056,7 @@ int ST_AutomapAddPoint(int player, float x, float y, float z) return newPoint; } -boolean ST_AutomapPointOrigin(int player, int point, float* x, float* y, float* z) +boolean ST_AutomapPointOrigin(int player, int point, coord_t* x, coord_t* y, coord_t* z) { uiwidget_t* obj = ST_UIAutomapForPlayer(player); if(!obj) return false;