diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index dc0388b1b..9a9b7f4cc 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -383,6 +383,12 @@ TARGETACTOR: return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DSWActor* GetPlayerSpriteNum(DSWActor* actor) { int pnum; @@ -400,6 +406,12 @@ DSWActor* GetPlayerSpriteNum(DSWActor* actor) return nullptr; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int CloseRangeDist(DSWActor* actor1, DSWActor* actor2) { int clip1 = actor1->spr.clipdist; @@ -416,6 +428,12 @@ double CloseRangeDistF(DSWActor* actor1, DSWActor* actor2) return CloseRangeDist(actor1, actor2) * inttoworld; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorOperate(DSWActor* actor) { HitInfo near{}; @@ -453,6 +471,12 @@ int DoActorOperate(DSWActor* actor) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DECISION GenericFlaming[] = { {30, InitActorAttack}, @@ -639,10 +663,11 @@ ANIMATOR* DoActorActionDecide(DSWActor* actor) return action; } -/* - !AIC - Setup to do the decision -*/ - +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int InitActorDecide(DSWActor* actor) { @@ -650,6 +675,12 @@ int InitActorDecide(DSWActor* actor) return DoActorDecide(actor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorDecide(DSWActor* actor) { ANIMATOR* actor_action; @@ -701,6 +732,12 @@ int DoActorDecide(DSWActor* actor) int sw_snd_scratch = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorAlertNoise(DSWActor* actor) { sw_snd_scratch = 1; @@ -791,9 +828,11 @@ int InitActorExtra6Noise(DSWActor* actor) } +//--------------------------------------------------------------------------- /* !AIC KEY - Routines handle moving toward the player. */ +//--------------------------------------------------------------------------- int InitActorMoveCloser(DSWActor* actor) { @@ -807,6 +846,12 @@ int InitActorMoveCloser(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorCantMoveCloser(DSWActor* actor) { actor->user.track = FindTrackToPlayer(actor); @@ -830,6 +875,12 @@ int DoActorCantMoveCloser(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorMoveCloser(DSWActor* actor) { // if cannot move the sprite @@ -874,10 +925,11 @@ int DoActorMoveCloser(DSWActor* actor) } +//--------------------------------------------------------------------------- /* !AIC - Find tracks of different types. Toward target, away from target, etc. */ - +//--------------------------------------------------------------------------- int FindTrackToPlayer(DSWActor* actor) { @@ -955,7 +1007,11 @@ int FindTrackToPlayer(DSWActor* actor) } - +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int FindTrackAwayFromPlayer(DSWActor* actor) { @@ -994,6 +1050,11 @@ int FindTrackAwayFromPlayer(DSWActor* actor) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int FindWanderTrack(DSWActor* actor) { @@ -1031,6 +1092,11 @@ int FindWanderTrack(DSWActor* actor) return -1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int InitActorRunAway(DSWActor* actor) { @@ -1055,6 +1121,12 @@ int InitActorRunAway(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorRunToward(DSWActor* actor) { actor->user.ActorActionFunc = DoActorDecide; @@ -1066,12 +1138,13 @@ int InitActorRunToward(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- /* !AIC - Where actors do their attacks. There is some special case code throughout these. Both close and long range attacks are handled here by transitioning to the correct attack state. */ - +//--------------------------------------------------------------------------- int InitActorAttack(DSWActor* actor) { @@ -1153,6 +1226,11 @@ int InitActorAttack(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int DoActorAttack(DSWActor* actor) { @@ -1187,6 +1265,12 @@ int DoActorAttack(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorEvade(DSWActor* actor) { // Evade is same thing as run away except when you get to the end of the track @@ -1209,6 +1293,12 @@ int InitActorEvade(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorWanderAround(DSWActor* actor) { actor->user.ActorActionFunc = DoActorDecide; @@ -1228,6 +1318,12 @@ int InitActorWanderAround(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorFindPlayer(DSWActor* actor) { actor->user.ActorActionFunc = DoActorDecide; @@ -1249,11 +1345,15 @@ int InitActorFindPlayer(DSWActor* actor) { InitActorReposition(actor); } - - return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int InitActorDuck(DSWActor* actor) { int dist; @@ -1285,6 +1385,12 @@ int InitActorDuck(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorDuck(DSWActor* actor) { if ((actor->user.WaitTics -= ACTORMOVETICS) < 0) @@ -1297,6 +1403,12 @@ int DoActorDuck(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DoActorMoveJump(DSWActor* actor) { move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)); @@ -1309,6 +1421,11 @@ int DoActorMoveJump(DSWActor* actor) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- Collision move_scan(DSWActor* actor, int ang, int dist, DVector3& stop) {