Skip to content

Commit

Permalink
Fixed jHeretic: The Blaster Missile was not written to saved games. T…
Browse files Browse the repository at this point in the history
…his was due to these mobjs using an alternative thinker (P_BlasterMobjThinker) and the save code has only ever checked for mobjs using P_MobjThinker (all the way back to Heretic.exe). I've gotten rid of P_BlasterMobjThinker and moved the logic into P_MobjThinker which is now used instead.
  • Loading branch information
danij committed Oct 30, 2008
1 parent 0487d61 commit e14a722
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 66 deletions.
1 change: 0 additions & 1 deletion doomsday/plugins/jheretic/include/p_local.h
Expand Up @@ -128,7 +128,6 @@ 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 *mobj);
void P_BlasterMobjThinker(mobj_t *mobj);
void P_SpawnBloodSplatter(float x, float y, float z, mobj_t *originator);
void P_RipperBlood(mobj_t *mo);
boolean P_HitFloor(mobj_t *thing);
Expand Down
3 changes: 0 additions & 3 deletions doomsday/plugins/jheretic/src/h_api.c
Expand Up @@ -110,9 +110,6 @@ void* G_GetVariable(int id)
case DD_ACTION_LINK:
return actionlinks;

case DD_ALT_MOBJ_THINKER:
return P_BlasterMobjThinker;

case DD_XGFUNC_LINK:
return xgClasses;

Expand Down
116 changes: 58 additions & 58 deletions doomsday/plugins/jheretic/src/p_mobj.c
Expand Up @@ -840,85 +840,85 @@ void P_NightmareRespawn(mobj_t *mobj)
P_MobjRemove(mobj, true);
}

/**
* Thinker for the ultra-fast blaster PL2 ripper-spawning missile.
*/
void P_BlasterMobjThinker(mobj_t *mobj)
void P_MobjThinker(mobj_t *mobj)
{
int i;
float frac[3];
float z;
boolean changexy;
if(mobj->ddFlags & DDMF_REMOTE)
return; // Remote mobjs are handled separately.

// Handle movement
if(mobj->mom[MX] != 0 || mobj->mom[MY] != 0 || mobj->mom[MZ] != 0 ||
(mobj->pos[VZ] != mobj->floorZ))
if(mobj->type == MT_BLASTERFX1)
{
frac[MX] = mobj->mom[MX] / 8;
frac[MY] = mobj->mom[MY] / 8;
frac[MZ] = mobj->mom[MZ] / 8;
int i;
float frac[3];
float z;
boolean changexy;

changexy = (frac[MX] != 0 || frac[MY] != 0);
for(i = 0; i < 8; ++i)
// Handle movement
if(mobj->mom[MX] != 0 || mobj->mom[MY] != 0 || mobj->mom[MZ] != 0 ||
(mobj->pos[VZ] != mobj->floorZ))
{
if(changexy)
frac[MX] = mobj->mom[MX] / 8;
frac[MY] = mobj->mom[MY] / 8;
frac[MZ] = mobj->mom[MZ] / 8;

changexy = (frac[MX] != 0 || frac[MY] != 0);
for(i = 0; i < 8; ++i)
{
if(!P_TryMove(mobj, mobj->pos[VX] + frac[MX],
mobj->pos[VY] + frac[MY], false, false))
{ // Blocked move.
if(changexy)
{
if(!P_TryMove(mobj, mobj->pos[VX] + frac[MX],
mobj->pos[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;
P_HitFloor(mobj);
P_ExplodeMissile(mobj);
return;
}
}

mobj->pos[VZ] += frac[MZ];
if(mobj->pos[VZ] <= mobj->floorZ)
{ // Hit the floor.
mobj->pos[VZ] = mobj->floorZ;
P_HitFloor(mobj);
P_ExplodeMissile(mobj);
return;
}

if(mobj->pos[VZ] + mobj->height > mobj->ceilingZ)
{ // Hit the ceiling.
mobj->pos[VZ] = mobj->ceilingZ - mobj->height;
P_ExplodeMissile(mobj);
return;
}
if(mobj->pos[VZ] + mobj->height > mobj->ceilingZ)
{ // Hit the ceiling.
mobj->pos[VZ] = mobj->ceilingZ - mobj->height;
P_ExplodeMissile(mobj);
return;
}

if(changexy && (P_Random() < 64))
{
z = mobj->pos[VZ] - 8;
if(z < mobj->floorZ)
if(changexy && (P_Random() < 64))
{
z = mobj->floorZ;
}
z = mobj->pos[VZ] - 8;
if(z < mobj->floorZ)
{
z = mobj->floorZ;
}

P_SpawnMobj3f(MT_BLASTERSMOKE, mobj->pos[VX], mobj->pos[VY],
z, P_Random() << 24);
P_SpawnMobj3f(MT_BLASTERSMOKE, mobj->pos[VX], mobj->pos[VY],
z, P_Random() << 24);
}
}
}
}

// Advance the state.
if(mobj->tics != -1)
{
mobj->tics--;
while(!mobj->tics)
// Advance the state.
if(mobj->tics != -1)
{
if(!P_MobjChangeState(mobj, mobj->state->nextState))
{ // Mobj was removed.
return;
mobj->tics--;
while(!mobj->tics)
{
if(!P_MobjChangeState(mobj, mobj->state->nextState))
{ // Mobj was removed.
return;
}
}
}

return;
}
}

void P_MobjThinker(mobj_t *mobj)
{
if(mobj->ddFlags & DDMF_REMOTE)
return; // Remote mobjs are handled separately.
#if __JDOOM__
// Spectres get selector = 1.
if(mobj->type == MT_SHADOWS)
Expand Down
5 changes: 1 addition & 4 deletions doomsday/plugins/jheretic/src/p_pspr.c
Expand Up @@ -1164,16 +1164,13 @@ void C_DECL A_FireBlasterPL1(player_t *player, pspdef_t *psp)

void C_DECL A_FireBlasterPL2(player_t* player, pspdef_t* psp)
{
mobj_t* mo;

P_ShotAmmo(player);
S_StartSoundEx(SFX_BLSSHT, player->plr->mo);
if(IS_CLIENT)
return;

mo = P_SpawnMissile(MT_BLASTERFX1, player->plr->mo, NULL);
if(mo)
mo->thinker.function = P_BlasterMobjThinker;
P_SpawnMissile(MT_BLASTERFX1, player->plr->mo, NULL);
}

void C_DECL A_FireGoldWandPL1(player_t *player, pspdef_t *psp)
Expand Down

0 comments on commit e14a722

Please sign in to comment.