mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-01 09:42:27 +00:00
- DoActorNoise
This commit is contained in:
parent
3dbd002319
commit
a2dee7681a
2 changed files with 10 additions and 14 deletions
|
@ -55,8 +55,7 @@ short AttackOrRun = 200;
|
||||||
|
|
||||||
#define CHOOSE2(value) (RANDOM_P2(1024) < (value))
|
#define CHOOSE2(value) (RANDOM_P2(1024) < (value))
|
||||||
|
|
||||||
int
|
int Distance(int x1, int y1, int x2, int y2)
|
||||||
Distance(int x1, int y1, int x2, int y2)
|
|
||||||
{
|
{
|
||||||
int min;
|
int min;
|
||||||
|
|
||||||
|
@ -183,8 +182,7 @@ void DoActorSetSpeed(DSWActor* actor, uint8_t speed)
|
||||||
goro.c etc.
|
goro.c etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ANIMATORp
|
ANIMATORp ChooseAction(DECISION decision[])
|
||||||
ChooseAction(DECISION decision[])
|
|
||||||
{
|
{
|
||||||
short random_value;
|
short random_value;
|
||||||
short i;
|
short i;
|
||||||
|
@ -207,8 +205,7 @@ ChooseAction(DECISION decision[])
|
||||||
!AIC - Sometimes just want the offset of the action
|
!AIC - Sometimes just want the offset of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
short
|
short ChooseActionNumber(short decision[])
|
||||||
ChooseActionNumber(short decision[])
|
|
||||||
{
|
{
|
||||||
short random_value;
|
short random_value;
|
||||||
short i;
|
short i;
|
||||||
|
@ -224,10 +221,10 @@ ChooseActionNumber(short decision[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoActorNoise(ANIMATORp Action, DSWActor* actor)
|
||||||
DoActorNoise(ANIMATORp Action, short SpriteNum)
|
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
|
int SpriteNum = actor->GetSpriteIndex();
|
||||||
|
|
||||||
if (Action == InitActorAmbientNoise)
|
if (Action == InitActorAmbientNoise)
|
||||||
{
|
{
|
||||||
|
@ -769,7 +766,7 @@ DoActorActionDecide(short SpriteNum)
|
||||||
//CON_Message("Surprised");
|
//CON_Message("Surprised");
|
||||||
if (!u->DidAlert && ICanSee)
|
if (!u->DidAlert && ICanSee)
|
||||||
{
|
{
|
||||||
DoActorNoise(InitActorAlertNoise, SpriteNum);
|
DoActorNoise(InitActorAlertNoise, actor);
|
||||||
u->DidAlert = true;
|
u->DidAlert = true;
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
|
@ -779,7 +776,7 @@ DoActorActionDecide(short SpriteNum)
|
||||||
{
|
{
|
||||||
// Player has not seen actor, to be fair let him know actor
|
// Player has not seen actor, to be fair let him know actor
|
||||||
// are there
|
// are there
|
||||||
DoActorNoise(ChooseAction(u->Personality->Broadcast),SpriteNum);
|
DoActorNoise(ChooseAction(u->Personality->Broadcast),actor);
|
||||||
//CON_Message("Actor Noise");
|
//CON_Message("Actor Noise");
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1130,7 @@ DoActorMoveCloser(DSWActor* actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do a noise if ok
|
// Do a noise if ok
|
||||||
DoActorNoise(ChooseAction(u->Personality->Broadcast),SpriteNum);
|
DoActorNoise(ChooseAction(u->Personality->Broadcast), actor);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// evasion if targeted
|
// evasion if targeted
|
||||||
|
@ -1526,7 +1523,7 @@ DoActorAttack(DSWActor* actor)
|
||||||
short rand_num;
|
short rand_num;
|
||||||
int dist,a,b,c;
|
int dist,a,b,c;
|
||||||
|
|
||||||
DoActorNoise(ChooseAction(u->Personality->Broadcast),SpriteNum);
|
DoActorNoise(ChooseAction(u->Personality->Broadcast),actor);
|
||||||
|
|
||||||
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);
|
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ extern ATTRIBUTE DefaultAttrib;
|
||||||
void DebugMoveHit(DSWActor* actor);
|
void DebugMoveHit(DSWActor* actor);
|
||||||
bool ActorMoveHitReact(DSWActor* actor);
|
bool ActorMoveHitReact(DSWActor* actor);
|
||||||
short ChooseActionNumber(short decision[]);
|
short ChooseActionNumber(short decision[]);
|
||||||
int DoActorNoise(ANIMATORp Action,short SpriteNum);
|
|
||||||
bool CanSeePlayer(short SpriteNum);
|
bool CanSeePlayer(short SpriteNum);
|
||||||
int CanHitPlayer(short SpriteNum);
|
int CanHitPlayer(short SpriteNum);
|
||||||
int DoActorPickClosePlayer(short SpriteNum);
|
int DoActorPickClosePlayer(short SpriteNum);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue