mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-21 10:51:25 +00:00
- Redid A_SetHealth.
- This function will not take the actor's health below 1, and any attempts to do so will simply set it to 1 in its place.
This commit is contained in:
parent
845bcdf14c
commit
4fd87a1ce9
2 changed files with 39 additions and 1 deletions
|
@ -5656,7 +5656,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
|
||||||
//
|
//
|
||||||
// A_SetFloatBobPhase
|
// A_SetFloatBobPhase
|
||||||
//
|
//
|
||||||
// Changes the FloatBobPhase of the
|
// Changes the FloatBobPhase of the actor.
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
||||||
|
@ -5669,6 +5669,43 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
||||||
self->FloatBobPhase = bob;
|
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)
|
// A_SetRipperLevel(int level)
|
||||||
|
|
|
@ -327,6 +327,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_SetTeleFog(name oldpos, name newpos);
|
action native A_SetTeleFog(name oldpos, name newpos);
|
||||||
action native A_SwapTeleFog();
|
action native A_SwapTeleFog();
|
||||||
action native A_SetFloatBobPhase(int bob);
|
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_SetRipperLevel(int level);
|
||||||
action native A_SetRipMin(int min);
|
action native A_SetRipMin(int min);
|
||||||
action native A_SetRipMax(int max);
|
action native A_SetRipMax(int max);
|
||||||
|
|
Loading…
Reference in a new issue