diff --git a/src/k_kart.c b/src/k_kart.c index 1832930d8..ce88915e5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3335,8 +3335,8 @@ static void K_StretchPlayerGravity(player_t *player) mobj_t *pmo = player->mo; - fixed_t tempxscale = pmo->realxscale; - fixed_t tempyscale = pmo->realyscale; + const fixed_t tempxscale = pmo->realxscale; + const fixed_t tempyscale = pmo->realyscale; stretchScaleFactor = FixedDiv(mapobjectscale*60, cv_gravstretch.value); stretchScaleFactor = min(stretchScaleFactor, MAXSTRETCHDIV); @@ -3390,8 +3390,8 @@ static void K_SaltySquish(player_t *player) mobj_t *pmo = player->mo; - fixed_t tempxscale = pmo->realxscale; - fixed_t tempyscale = pmo->realyscale; + const fixed_t tempxscale = pmo->realxscale; + const fixed_t tempyscale = pmo->realyscale; if (pmo->stretchslam > 0) { diff --git a/src/p_mobj.c b/src/p_mobj.c index d4e244002..6500d3945 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9297,6 +9297,12 @@ static boolean P_MobjPushableThink(mobj_t *mobj) static void P_FiringThink(mobj_t *mobj) { + if (!mobj->target) + return; + + if (mobj->health <= 0) + return; + if (mobj->state->action == (actionf_p1)A_Boss1Laser) { var1 = mobj->state->var1; @@ -9359,7 +9365,12 @@ void P_MobjThinker(mobj_t *mobj) mobj->flags2 &= ~MF2_PUSHED; mobj->eflags &= ~(MFE_SPRUNG|MFE_JUSTBOUNCEDWALL); +#ifdef PHOBOS_BUILD + P_SetTarget(&tmfloorthing, NULL); + P_SetTarget(&tmhitthing, NULL); +#else tmfloorthing = tmhitthing = NULL; +#endif // do NOT trigger linedef executors for "local" mobjs if (!mobj->islocal) @@ -9375,8 +9386,13 @@ void P_MobjThinker(mobj_t *mobj) } if (mobj->scale != mobj->destscale) + { P_MobjScaleThink(mobj); // Slowly scale up/down to reach your destscale. + if (P_MobjWasRemovedCompat(mobj)) + return; + } + if (!mobj->player) { if (mobj->type == MT_GHOST && mobj->fuse > 0 // Not guaranteed to be MF_SCENERY or not MF_SCENERY! @@ -9421,6 +9437,21 @@ void P_MobjThinker(mobj_t *mobj) { if (!P_MobjDeadThink(mobj)) return; + + // Fading tile + if (mobj->type >= MT_BOUNCEPICKUP && mobj->type <= MT_GRENADEPICKUP) + { + INT32 value = mobj->info->damage/10; + value = mobj->fuse/value; + value = 10-value; + value--; + + if (value <= 0) + value = 1; + + mobj->frame &= ~FF_TRANSMASK; + mobj->frame |= value << FF_TRANSSHIFT; + } } else { @@ -9431,7 +9462,7 @@ void P_MobjThinker(mobj_t *mobj) if (P_MobjWasRemoved(mobj)) return; - if (mobj->flags2 & MF2_FIRING && mobj->target && mobj->health > 0) + if (mobj->flags2 & MF2_FIRING) P_FiringThink(mobj); if (mobj->flags & MF_AMBIENT) @@ -9498,23 +9529,27 @@ void P_MobjThinker(mobj_t *mobj) P_ButteredSlope(mobj); } - if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health && - P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz + if (mobj->health) { - P_KillMobj(mobj, NULL, NULL); - return; - } - - // Crush enemies! - if (mobj->ceilingz - mobj->floorz < mobj->height) - { - if (((mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->flags & MF_SHOOTABLE) || mobj->type == MT_EGGSHIELD) && - !(mobj->flags & MF_NOCLIPHEIGHT) && - mobj->health > 0) + // extra pit check in case these didn't have momz + if ((mobj->flags & (MF_ENEMY|MF_BOSS)) && + P_CheckDeathPitCollide(mobj)) { P_KillMobj(mobj, NULL, NULL); return; } + + // Crush enemies! + if ((mobj->ceilingz - mobj->floorz) < mobj->height) + { + if ((((mobj->flags & (MF_ENEMY|MF_BOSS)) && (mobj->flags & MF_SHOOTABLE)) || mobj->type == MT_EGGSHIELD) && + !(mobj->flags & MF_NOCLIPHEIGHT) && + mobj->health > 0) + { + P_KillMobj(mobj, NULL, NULL); + return; + } + } } if (P_MobjWasRemovedCompat(mobj)) @@ -9522,24 +9557,6 @@ void P_MobjThinker(mobj_t *mobj) // Can end up here if a player dies. P_CycleMobjState(mobj); - - if (P_MobjWasRemoved(mobj)) - return; - - if ((mobj->health == 0) && // Fading tile - (mobj->type >= MT_BOUNCEPICKUP && mobj->type <= MT_GRENADEPICKUP)) - { - INT32 value = mobj->info->damage/10; - value = mobj->fuse/value; - value = 10-value; - value--; - - if (value <= 0) - value = 1; - - mobj->frame &= ~FF_TRANSMASK; - mobj->frame |= value << FF_TRANSSHIFT; - } } // Quick, optimized function for the Rail Rings @@ -9793,20 +9810,13 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // All mobjs are created at 100% scale. mobj->scale = FRACUNIT; - mobj->destscale = mobj->scale; - mobj->scalespeed = FRACUNIT/12; - - if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) - { - mobj->destscale = mapobjectscale; - mobj->scalespeed = mapobjectscale/12; - } + mobj->destscale = mapobjectscale; + mobj->scalespeed = mapobjectscale/12; // Sprite rendering mobj->blendmode = AST_TRANSLUCENT; - mobj->realxscale = mobj->realyscale = mobj->scale; - mobj->spritexscale = mobj->realxscale; - mobj->spriteyscale = mobj->realyscale; + mobj->realxscale = mobj->realyscale = + mobj->spritexscale = mobj->spriteyscale = mobj->scale; // set subsector and/or block links P_SetThingPosition(mobj); @@ -10248,20 +10258,13 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster) // All mobjs are created at 100% scale. mobj->scale = FRACUNIT; - mobj->destscale = mobj->scale; - mobj->scalespeed = FRACUNIT/12; - - if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) - { - mobj->destscale = mapobjectscale; - mobj->scalespeed = mapobjectscale/12; - } + mobj->destscale = mapobjectscale; + mobj->scalespeed = mapobjectscale/12; // Sprite rendering mobj->blendmode = AST_TRANSLUCENT; - mobj->realxscale = mobj->realyscale = mobj->scale; - mobj->spritexscale = mobj->realxscale; - mobj->spriteyscale = mobj->realyscale; + mobj->realxscale = mobj->realyscale = + mobj->spritexscale = mobj->spriteyscale = mobj->scale; // set subsector and/or block links P_SetThingPosition(mobj); @@ -10361,7 +10364,9 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype P_CalculatePrecipFloor(mobj); if (mobj->floorz != starting_floorz) - mobj->precipflags |= PCF_FOF; + { + ; //mobj->precipflags |= PCF_FOF; + } else { const INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1); @@ -10495,7 +10500,13 @@ void P_RemoveMobj(mobj_t *mobj) // clear the reference from the mapthing if (mobj->spawnpoint) + { +#ifdef PHOBOS_BUILD + P_SetTarget(&mobj->spawnpoint->mobj, NULL); +#else mobj->spawnpoint->mobj = NULL; +#endif + } R_RemoveMobjInterpolator(mobj); @@ -10706,6 +10717,9 @@ void P_PrecipitationEffects(void) P_SpawnLightningFlash(ss); // Spawn a quick flash thinker } + if (sound_disabled) + return; // Sound off? D'aw, no fun. + const mobj_t *pmo = players[displayplayers[0]].mo; // Local effects from here on out! @@ -10713,9 +10727,6 @@ void P_PrecipitationEffects(void) if (!playeringame[displayplayers[0]] || !pmo) return; - if (sound_disabled) - return; // Sound off? D'aw, no fun. - const boolean sounds_rain = ((cv_drawdist_precip.value != 0) && rainsfx && (!leveltime || leveltime % 80 == 1)); if (!sounds_rain && !sounds_thunder) @@ -10963,7 +10974,9 @@ void P_SpawnPlayer(INT32 playernum) mobj_t *mobj; if (p->playerstate == PST_REBORN) + { G_PlayerReborn(playernum); + } for (i = 0; i < MAXPLAYERS; i++) { @@ -11037,9 +11050,15 @@ void P_SpawnPlayer(INT32 playernum) } mobj = P_SpawnMobj(0, 0, 0, MT_PLAYER); + I_Assert(mobj != NULL); + +#ifdef PHOBOS_BUILD + mobj->player = p; + P_SetTarget(&p->mo, mobj); +#else (mobj->player = p)->mo = mobj; - //P_SetTarget(&p->mo, mobj); +#endif mobj->angle = mobj->old_angle = 0; diff --git a/src/p_mobj.h b/src/p_mobj.h index 8868e80f4..ee672be2c 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -258,12 +258,10 @@ typedef enum // PRECIPITATION flags ?! ?! ?! // typedef enum { - PCF_INVISIBLE = 1, // Don't draw. + PCF_INVISIBLE = 1, // Don't draw. PCF_PIT = 1<<1, // Above pit. - PCF_FOF = 1<<2, // Above FOF. - PCF_MOVINGFOF = 1<<3, // Above MOVING FOF (this means we need to keep floorz up to date...) - PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over - PCF_THUNK = 1<<5, // Ran the thinker this tic. + PCF_SPLASH = 1<<2, // Splashed on the ground, return to the ceiling after the animation's over + PCF_THUNK = 1<<3, // Ran the thinker this tic. } precipflag_t; typedef enum { diff --git a/src/p_user.c b/src/p_user.c index c3a1cf2e4..07dccacb6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -91,7 +91,7 @@ void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move) mo->momx = FixedMul(move, FINECOSINE(angle)); if (!twodmo(mo)) - mo->momy = FixedMul(move,FINESINE(angle)); + mo->momy = FixedMul(move, FINESINE(angle)); } void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)