Merge branch 'sethealthredux' of https://github.com/MajorCooke/zdoom

This commit is contained in:
Christoph Oelckers 2015-01-22 13:59:59 +01:00
commit ae282eea53
2 changed files with 39 additions and 1 deletions

View file

@ -5665,7 +5665,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
//
// A_SetFloatBobPhase
//
// Changes the FloatBobPhase of the
// Changes the FloatBobPhase of the actor.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
@ -5678,6 +5678,43 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
self->FloatBobPhase = bob;
}
//===========================================================================
// A_SetHealth
//
// Changes the health of the actor.
// Takes a pointer as well.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(health, 0);
ACTION_PARAM_INT(ptr, 1);
AActor *mobj = COPY_AAPTR(self, ptr);
if (!mobj)
{
return;
}
player_t *player = mobj->player;
if (player)
{
if (health <= 0)
player->mo->health = mobj->health = player->health = 1; //Copied from the buddha cheat.
else
player->mo->health = mobj->health = player->health = health;
}
else if (mobj)
{
if (health <= 0)
mobj->health = 1;
else
mobj->health = health;
}
}
//===========================================================================
//
// A_SetRipperLevel(int level)

View file

@ -327,6 +327,7 @@ ACTOR Actor native //: Thinker
action native A_SetTeleFog(name oldpos, name newpos);
action native A_SwapTeleFog();
action native A_SetFloatBobPhase(int bob);
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);