diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index d72a597c4e1e7bfd61bdb0e62eb4e154ff029633..b5ece91572f2b1fb2ea11adaa5068db7e15f3837 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -37,15 +37,47 @@ K_ChangePlayerItem #define hyudoro_itemtype(o) ((o)->movefactor) #define hyudoro_itemcount(o) ((o)->movecount) #define hyudoro_hover_stack(o) ((o)->threshold) -#define hyudoro_next(o) ((o)->tracer) + +static mobj_t * +hyudoro_next (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->tracer != NULL && P_MobjWasRemoved(o->tracer) == false); + + return o->tracer; +} + #define hyudoro_stackpos(o) ((o)->reactiontime) -// cannot be combined -#define hyudoro_center(o) ((o)->target) -#define hyudoro_target(o) ((o)->target) +// these next two functions cannot be combined +static mobj_t * +hyudoro_center (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} + +static mobj_t * +hyudoro_target (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} #define hyudoro_center_max_radius(o) ((o)->threshold) -#define hyudoro_center_master(o) ((o)->target) + +static mobj_t * +hyudoro_center_master (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} static angle_t trace_angle (mobj_t *hyu) @@ -94,8 +126,6 @@ get_hyudoro_target_player (mobj_t *hyu) { mobj_t *target = hyudoro_target(hyu); - I_Assert(target != NULL && P_MobjWasRemoved(target) == false); - return target ? target->player : NULL; } @@ -190,8 +220,6 @@ move_to_player (mobj_t *hyu) angle_t angle; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - if (target == NULL || P_MobjWasRemoved(target) == true) return; @@ -211,10 +239,6 @@ deliver_item (mobj_t *hyu) mobj_t *target = hyudoro_target(hyu); player_t *player = target->player; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(target != NULL && P_MobjWasRemoved(target) == false); - I_Assert(player != NULL); - P_SetTarget(&hyudoro_target(hyu), NULL); if (player) @@ -244,8 +268,6 @@ append_hyudoro { INT32 lastpos = 0; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - while (is_hyudoro(*head)) { lastpos = hyudoro_stackpos(*head); @@ -292,11 +314,7 @@ hyudoro_patrol_hit_player mobj_t *center = hyudoro_center(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); - I_Assert(center != NULL && P_MobjWasRemoved(center) == false); - - if (player == NULL) + if (!player) return false; // Cannot hit its master @@ -338,8 +356,6 @@ award_immediately (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - if (player) { if (player->itemamount && @@ -364,9 +380,6 @@ hyudoro_return_hit_player ( mobj_t * hyu, mobj_t * toucher) { - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); - if (toucher != hyudoro_target(hyu)) return false; @@ -386,9 +399,7 @@ hyudoro_hover_await_stack (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - - if (player == NULL) + if (!player) return false; // First in stack goes first @@ -442,8 +453,6 @@ Obj_HyudoroDeploy (mobj_t *master) void Obj_HyudoroThink (mobj_t *hyu) { - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - // Might get set from clipping slopes hyu->momz = 0; diff --git a/src/p_mobj.c b/src/p_mobj.c index 64d0f616c18e1046c296533d0cc15b5d535939d7..009241c623e622c7488e35963a946259cd632059 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13464,8 +13464,6 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo { mobj_t *newmobj; - I_Assert(mobj != NULL && P_MobjWasRemoved(mobj) == false); - xofs = FixedMul(xofs, mobj->scale); yofs = FixedMul(yofs, mobj->scale); zofs = FixedMul(zofs, mobj->scale);