- call the native A_BossDeath directly instead of going through the VM-enabled action function.

- undo some formatting screwup in a_clericstaff.cpp.
This commit is contained in:
Christoph Oelckers 2016-02-10 13:57:21 +01:00
parent dd55e0a4c4
commit b5029e0976
5 changed files with 32 additions and 35 deletions

View file

@ -65,59 +65,59 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
AWeapon *weapon = self->player->ReadyWeapon; AWeapon *weapon = self->player->ReadyWeapon;
pmo = player->mo; pmo = player->mo;
damage = 20+(pr_staffcheck()&15); damage = 20 + (pr_staffcheck() & 15);
max = pmo->GetMaxHealth(); max = pmo->GetMaxHealth();
puff = PClass::FindActor("CStaffPuff"); puff = PClass::FindActor("CStaffPuff");
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
angle = pmo->angle+i*(ANG45/16); angle = pmo->angle + i*(ANG45 / 16);
slope = P_AimLineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget);
if (linetarget != NULL) if (linetarget != NULL)
{ {
pmo->angle = pmo->AngleTo(linetarget); pmo->angle = pmo->AngleTo(linetarget);
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER) if (((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
&& (!(linetarget->flags2&(MF2_DORMANT|MF2_INVULNERABLE)))) && (!(linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE))))
{
newLife = player->health+(damage>>3);
newLife = newLife > max ? max : newLife;
if (newLife > player->health)
{ {
pmo->health = player->health = newLife; newLife = player->health + (damage >> 3);
} newLife = newLife > max ? max : newLife;
if (newLife > player->health)
{
pmo->health = player->health = newLife;
}
if (weapon != NULL) if (weapon != NULL)
{ {
FState * newstate = weapon->FindState("Drain"); FState * newstate = weapon->FindState("Drain");
if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate);
} }
}
if (weapon != NULL)
{
weapon->DepleteAmmo(weapon->bAltFire, false);
} }
if (weapon != NULL)
{
weapon->DepleteAmmo (weapon->bAltFire, false);
}
} }
break; break;
} }
angle = pmo->angle-i*(ANG45/16); angle = pmo->angle - i*(ANG45 / 16);
slope = P_AimLineAttack (player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); slope = P_AimLineAttack(player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget);
if (linetarget != NULL) if (linetarget != NULL)
{ {
pmo->angle = pmo->AngleTo(linetarget); pmo->angle = pmo->AngleTo(linetarget);
if ((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) if ((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
{ {
newLife = player->health+(damage>>4); newLife = player->health + (damage >> 4);
newLife = newLife > max ? max : newLife; newLife = newLife > max ? max : newLife;
pmo->health = player->health = newLife; pmo->health = player->health = newLife;
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain")); P_SetPsprite(player, ps_weapon, weapon->FindState("Drain"));
} }
if (weapon != NULL) if (weapon != NULL)
{ {
weapon->DepleteAmmo (weapon->bAltFire, false); weapon->DepleteAmmo(weapon->bAltFire, false);
} }
} }
break; break;

View file

@ -336,7 +336,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
// [RH] Do some stuff to make this more useful outside Hexen // [RH] Do some stuff to make this more useful outside Hexen
if (self->flags4 & MF4_BOSSDEATH) if (self->flags4 & MF4_BOSSDEATH)
{ {
CALL_ACTION(A_BossDeath, self); A_BossDeath(self);
} }
A_Unblock(self, true); A_Unblock(self, true);

View file

@ -550,10 +550,7 @@ bool P_MorphedDeath(AActor *actor, AActor **morphed, int *morphedstyle, int *mor
if (realme->flags4 & MF4_BOSSDEATH) if (realme->flags4 & MF4_BOSSDEATH)
{ {
realme->health = 0; // make sure that A_BossDeath considers it dead. realme->health = 0; // make sure that A_BossDeath considers it dead.
// FIXME: Use the caller's stack once the whole chain is scriptable. A_BossDeath(realme);
VMFrameStack stack;
VMValue params[3] = { realme, realme, VMValue(NULL, ATAG_STATE) };
stack.Call(A_BossDeath_VMPtr, params, countof(params), NULL, 0, NULL);
} }
} }
fakeme->flags3 |= MF3_STAYMORPHED; // moved here from AMorphedMonster::Die() fakeme->flags3 |= MF3_STAYMORPHED; // moved here from AMorphedMonster::Die()

View file

@ -163,6 +163,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_ProgrammerDeath)
} }
} }
// the sky change scripts are now done as special actions in MAPINFO // the sky change scripts are now done as special actions in MAPINFO
CALL_ACTION(A_BossDeath, self); A_BossDeath(self);
return 0; return 0;
} }

View file

@ -3310,7 +3310,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
// [RH] Do some stuff to make this more useful outside Hexen // [RH] Do some stuff to make this more useful outside Hexen
if (self->flags4 & MF4_BOSSDEATH) if (self->flags4 & MF4_BOSSDEATH)
{ {
CALL_ACTION(A_BossDeath, self); A_BossDeath(self);
} }
A_Unblock(self, true); A_Unblock(self, true);