mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Backport 'A_FaceConsolePlayer' from zandronum.
By Dusk, who authorized me to do this.
This commit is contained in:
parent
71ce4bcf06
commit
eab971500b
2 changed files with 31 additions and 0 deletions
|
@ -3781,6 +3781,36 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// [TP] A_FaceConsolePlayer
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) {
|
||||||
|
ACTION_PARAM_START (1);
|
||||||
|
ACTION_PARAM_ANGLE (MaxTurnAngle, 0);
|
||||||
|
|
||||||
|
angle_t Angle;
|
||||||
|
angle_t DeltaAngle;
|
||||||
|
AActor *pConsolePlayer;
|
||||||
|
|
||||||
|
// Always watch the consoleplayer.
|
||||||
|
pConsolePlayer = players[consoleplayer].mo;
|
||||||
|
if (( playeringame[consoleplayer] == false ) || ( pConsolePlayer == NULL ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Find the angle between the actor and the console player.
|
||||||
|
Angle = R_PointToAngle2( self->x, self->y, pConsolePlayer->x, pConsolePlayer->y );
|
||||||
|
DeltaAngle = Angle - self->angle;
|
||||||
|
|
||||||
|
if (( MaxTurnAngle == 0 ) || ( DeltaAngle < MaxTurnAngle ) || ( DeltaAngle > (unsigned)-MaxTurnAngle ))
|
||||||
|
self->angle = Angle;
|
||||||
|
else if ( DeltaAngle < ANG180 )
|
||||||
|
self->angle += MaxTurnAngle;
|
||||||
|
else
|
||||||
|
self->angle -= MaxTurnAngle;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// A_MonsterRefire
|
// A_MonsterRefire
|
||||||
|
|
|
@ -186,6 +186,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_ClearSoundTarget();
|
action native A_ClearSoundTarget();
|
||||||
action native A_FireAssaultGun();
|
action native A_FireAssaultGun();
|
||||||
action native A_CheckTerrain();
|
action native A_CheckTerrain();
|
||||||
|
action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP]
|
||||||
|
|
||||||
action native A_MissileAttack();
|
action native A_MissileAttack();
|
||||||
action native A_MeleeAttack();
|
action native A_MeleeAttack();
|
||||||
|
|
Loading…
Reference in a new issue