diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 11a731a5c..4798eb96d 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -138,6 +138,23 @@ VMFunction* ChooseAction(DECISION decision[]) } } +int ChooseNoise(DECISIONB decision[]) +{ + // !JIM! Here is an opportunity for some AI, instead of randomness! + int random_value = RANDOM_P2(1024 << 5) >> 5; + + for (int i = 0; true; i++) + { + ASSERT(i < 10); + + if (random_value <= decision[i].range) + { + return decision[i].noise; + } + } +} + + //--------------------------------------------------------------------------- /* !AIC - Sometimes just want the offset of the action @@ -163,54 +180,14 @@ int ChooseActionNumber(int16_t decision[]) // //--------------------------------------------------------------------------- -int DoActorNoise(VMFunction* Action, DSWActor* actor) +int DoActorNoise(DSWActor* actor, int noise) { - if (Action == *AF(InitActorAmbientNoise)) + if (noise == attr_alert) { - PlaySpriteSound(actor, attr_ambient, v3df_follow); + if (!actor->hasU() || actor->user.DidAlert) // This only allowed once + return 0; } - else if (Action == *AF(InitActorAlertNoise)) - { - if (actor->hasU() && !actor->user.DidAlert) // This only allowed once - PlaySpriteSound(actor, attr_alert, v3df_follow); - } - else if (Action == *AF(InitActorAttackNoise)) - { - PlaySpriteSound(actor, attr_attack, v3df_follow); - } - else if (Action == *AF(InitActorPainNoise)) - { - PlaySpriteSound(actor, attr_pain, v3df_follow); - } - else if (Action == *AF(InitActorDieNoise)) - { - PlaySpriteSound(actor, attr_die, v3df_none); - } - else if (Action == *AF(InitActorExtra1Noise)) - { - PlaySpriteSound(actor, attr_extra1, v3df_follow); - } - else if (Action == *AF(InitActorExtra2Noise)) - { - PlaySpriteSound(actor, attr_extra2, v3df_follow); - } - else if (Action == *AF(InitActorExtra3Noise)) - { - PlaySpriteSound(actor, attr_extra3, v3df_follow); - } - else if (Action == *AF(InitActorExtra4Noise)) - { - PlaySpriteSound(actor, attr_extra4, v3df_follow); - } - else if (Action == *AF(InitActorExtra5Noise)) - { - PlaySpriteSound(actor, attr_extra5, v3df_follow); - } - else if (Action == *AF(InitActorExtra6Noise)) - { - PlaySpriteSound(actor, attr_extra6, v3df_follow); - } - + PlaySpriteSound(actor, noise, v3df_follow); return 0; } @@ -614,7 +591,7 @@ VMFunction* DoActorActionDecide(DSWActor* actor) //CON_Message("Surprised"); if (!actor->user.DidAlert && ICanSee) { - DoActorNoise(*AF(InitActorAlertNoise), actor); + DoActorNoise(actor, attr_alert); actor->user.DidAlert = true; } return action; @@ -624,8 +601,8 @@ VMFunction* DoActorActionDecide(DSWActor* actor) { // Player has not seen actor, to be fair let him know actor // are there - DoActorNoise(ChooseAction(actor->user.__legacyState.Personality->Broadcast),actor); - //CON_Message("Actor Noise"); + ; + DoActorNoise(actor, ChooseNoise(actor->user.__legacyState.Personality->Broadcast)); return action; } } @@ -647,6 +624,12 @@ int InitActorDecide(DSWActor* actor) return DoActorDecide(actor); } +int InitActorSetDecide(DSWActor* actor) +{ + actor->setActionDecide(); + return 0; +} + //--------------------------------------------------------------------------- // // @@ -697,108 +680,6 @@ int DoActorDecide(DSWActor* actor) return 0; } -// Important note: The functions below are being checked for as state identifiers. -// But they are all identical content wise which makes MSVC merge them together into one. -// Assigning 'sw_snd_scratch' different values makes them different so that merging does not occur. -int sw_snd_scratch = 0; - - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int InitActorAlertNoise(DSWActor* actor) -{ - sw_snd_scratch = 1; - actor->setActionDecide(); - - return 0; -} - - -int InitActorAmbientNoise(DSWActor* actor) -{ - sw_snd_scratch = 2; - actor->setActionDecide(); - - return 0; -} - -int InitActorAttackNoise(DSWActor* actor) -{ - sw_snd_scratch = 3; - actor->setActionDecide(); - - return 0; -} - -int InitActorPainNoise(DSWActor* actor) -{ - sw_snd_scratch = 4; - actor->setActionDecide(); - - return 0; -} - -int InitActorDieNoise(DSWActor* actor) -{ - sw_snd_scratch = 5; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra1Noise(DSWActor* actor) -{ - sw_snd_scratch = 6; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra2Noise(DSWActor* actor) -{ - sw_snd_scratch = 7; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra3Noise(DSWActor* actor) -{ - sw_snd_scratch = 8; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra4Noise(DSWActor* actor) -{ - sw_snd_scratch = 9; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra5Noise(DSWActor* actor) -{ - sw_snd_scratch = 10; - actor->setActionDecide(); - - return 0; -} - -int InitActorExtra6Noise(DSWActor* actor) -{ - sw_snd_scratch = 11; - actor->setActionDecide(); - - return 0; -} - - //--------------------------------------------------------------------------- /* !AIC KEY - Routines handle moving toward the player. @@ -865,7 +746,7 @@ int DoActorMoveCloser(DSWActor* actor) } // Do a noise if ok - DoActorNoise(ChooseAction(actor->user.__legacyState.Personality->Broadcast), actor); + DoActorNoise(actor, ChooseNoise(actor->user.__legacyState.Personality->Broadcast)); // after moving a ways check to see if player is still in sight if (actor->user.DistCheck > 34.375) @@ -1207,7 +1088,7 @@ int DoActorAttack(DSWActor* actor) { int rand_num; - DoActorNoise(ChooseAction(actor->user.__legacyState.Personality->Broadcast),actor); + DoActorNoise(actor, ChooseNoise(actor->user.__legacyState.Personality->Broadcast)); double dist =(actor->spr.pos.XY() - actor->user.targetActor->spr.pos.XY()).Length(); @@ -1766,17 +1647,6 @@ static saveable_code saveable_ai_code[] = { SAVE_CODE(InitActorDecide), SAVE_CODE(DoActorDecide), - SAVE_CODE(InitActorAlertNoise), - SAVE_CODE(InitActorAmbientNoise), - SAVE_CODE(InitActorAttackNoise), - SAVE_CODE(InitActorPainNoise), - SAVE_CODE(InitActorDieNoise), - SAVE_CODE(InitActorExtra1Noise), - SAVE_CODE(InitActorExtra2Noise), - SAVE_CODE(InitActorExtra3Noise), - SAVE_CODE(InitActorExtra4Noise), - SAVE_CODE(InitActorExtra5Noise), - SAVE_CODE(InitActorExtra6Noise), SAVE_CODE(InitActorMoveCloser), SAVE_CODE(DoActorMoveCloser), SAVE_CODE(FindTrackToPlayer), diff --git a/source/games/sw/src/ai.h b/source/games/sw/src/ai.h index 80dcd0111..5df57cebf 100644 --- a/source/games/sw/src/ai.h +++ b/source/games/sw/src/ai.h @@ -39,12 +39,18 @@ struct DECISION VMNativeFunction** action; }; +struct DECISIONB +{ + int range; + int noise; +}; + // Personality structure struct PERSONALITY { DECISION* Battle; DECISION* Offense; - DECISION* Broadcast; + DECISIONB* Broadcast; DECISION* Surprised; DECISION* Evasive; DECISION* LostTarget; @@ -56,7 +62,7 @@ enum ActorStates { SLOW_SPEED, NORM_SPEED, MID_SPEED, FAST_SPEED, MAX_SPEED}; enum ATTRIB_SNDS { - attr_ambient, attr_alert, attr_attack, attr_pain, attr_die, + attr_ambient = 1, attr_alert, attr_attack, attr_pain, attr_die, attr_extra1, attr_extra2, attr_extra3,attr_extra4,attr_extra5, attr_extra6, MAXATTRIBSNDS }; @@ -76,17 +82,6 @@ bool CanSeePlayer(DSWActor* actor); int DoActorPickClosePlayer(DSWActor* actor); int InitActorDecide(DSWActor* actor); int DoActorDecide(DSWActor* actor); -int InitActorAlertNoise(DSWActor* actor); -int InitActorAmbientNoise(DSWActor* actor); -int InitActorAttackNoise(DSWActor* actor); -int InitActorPainNoise(DSWActor* actor); -int InitActorDieNoise(DSWActor* actor); -int InitActorExtra1Noise(DSWActor* actor); -int InitActorExtra2Noise(DSWActor* actor); -int InitActorExtra3Noise(DSWActor* actor); -int InitActorExtra4Noise(DSWActor* actor); -int InitActorExtra5Noise(DSWActor* actor); -int InitActorExtra6Noise(DSWActor* actor); int InitActorMoveCloser(DSWActor* actor); int DoActorCantMoveCloser(DSWActor* actor); int DoActorMoveCloser(DSWActor* actor); diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index eef537c6c..ce23fa914 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -44,23 +44,30 @@ int Bunny_Count = 0; DECISION BunnyBattle[] = { {748, AF(InitActorMoveCloser)}, - {750, AF(InitActorAlertNoise)}, - {760, AF(InitActorAttackNoise)}, + {750, AF(InitActorSetDecide)}, + {760, AF(InitActorSetDecide)}, {1024, AF(InitActorMoveCloser)} }; DECISION BunnyOffense[] = { {600, AF(InitActorMoveCloser)}, - {700, AF(InitActorAlertNoise)}, + {700, AF(InitActorSetDecide)}, {1024, AF(InitActorMoveCloser)} }; -DECISION BunnyBroadcast[] = +DECISIONB BunnyBroadcast[] = { - {21, AF(InitActorAlertNoise)}, - {51, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {21, attr_alert}, + {51, attr_ambient}, + {1024, 0} +}; + +DECISIONB BunnyBroadcast2[] = +{ + {500, 0}, + {1020, 0}, + {1024, attr_ambient} }; DECISION BunnySurprised[] = @@ -74,7 +81,7 @@ DECISION BunnyEvasive[] = { {500, AF(InitActorWanderAround)}, {1020, AF(InitActorRunAway)}, - {1024, AF(InitActorAmbientNoise)} + {1024, AF(InitActorSetDecide)} }; DECISION BunnyLostTarget[] = @@ -109,7 +116,7 @@ PERSONALITY BunnyPersonality = { BunnyEvasive, BunnyEvasive, - BunnyEvasive, + BunnyBroadcast2, BunnyWander, BunnyWander, BunnyWander, diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index 04104f587..3cdae91aa 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -54,10 +54,10 @@ DECISION CoolgOffense[] = {1024, AF(InitActorAttack ) } }; -DECISION CoolgBroadcast[] = +DECISIONB CoolgBroadcast[] = { - {1, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide) } + {1, attr_ambient }, + {1024, 0 } }; DECISION CoolgSurprised[] = diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index d17918344..889959353 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -43,7 +43,7 @@ DECISION CoolieBattle[] = { {700, AF(InitCoolieCharge ) }, {990, AF(InitActorMoveCloser ) }, - {1000, AF(InitActorAttackNoise) }, + {1000, AF(InitActorSetDecide)}, {1024, AF(InitActorRunAway ) } }; @@ -51,19 +51,19 @@ DECISION CoolieOffense[] = { {700, AF(InitCoolieCharge ) }, {1015, AF(InitActorMoveCloser ) }, - {1024, AF(InitActorAttackNoise) } + {1024, AF(InitActorSetDecide) } }; -DECISION CoolieBroadcast[] = +DECISIONB CoolieBroadcast[] = { - {16, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide) } + {16, attr_ambient }, + {1024, 0 } }; DECISION CoolieSurprised[] = { {700, AF(InitActorMoveCloser ) }, - {703, AF(InitActorAmbientNoise) }, + {703, AF(InitActorSetDecide) }, {1024, AF(InitActorDecide ) } }; diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index 7f8d9ce36..b0390e242 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -39,22 +39,22 @@ BEGIN_SW_NS DECISION EelBattle[] = { {649, AF(InitActorMoveCloser) }, - {650, AF(InitActorAlertNoise) }, + {650, AF(InitActorSetDecide) }, {1024, AF(InitActorMoveCloser) } }; DECISION EelOffense[] = { {649, AF(InitActorMoveCloser) }, - {750, AF(InitActorAlertNoise) }, + {750, AF(InitActorSetDecide) }, {1024, AF(InitActorMoveCloser) } }; -DECISION EelBroadcast[] = +DECISIONB EelBroadcast[] = { - {3, AF(InitActorAlertNoise ) }, - {6, AF(InitActorAmbientNoise) }, - {1024, AF( InitActorDecide ) } + {3, attr_alert }, + {6, attr_ambient }, + {1024, 0 } }; DECISION EelSurprised[] = diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 0ebc2998a..c0d6e86d2 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -149,8 +149,6 @@ void markgcroots() void pClearSpriteList(PLAYER* pp); -extern int sw_snd_scratch; - int GameVersion = 20; bool NoMeters = false; @@ -277,8 +275,7 @@ void GameInterface::app_init() else Printf("SHADOW WARRIOR(tm) Version 1.2\n"); - if (sw_snd_scratch == 0) // This is always 0 at this point - this check is only here to prevent whole program optimization from eliminating the variable. - Printf("Copyright (c) 1997 3D Realms Entertainment\n"); + Printf("Copyright (c) 1997 3D Realms Entertainment\n"); registerosdcommands(); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index bb03b7776..6b58afd60 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2430,10 +2430,7 @@ DEF_ANIMATOR(InitEnemyNuke) DEF_ANIMATOR(InitEnemyRail) DEF_ANIMATOR(InitActorRunAway) -DEF_ANIMATOR(InitActorAlertNoise) -DEF_ANIMATOR(InitActorAmbientNoise) DEF_ANIMATOR(InitActorAttack) -DEF_ANIMATOR(InitActorAttackNoise) DEF_ANIMATOR(InitActorDuck) DEF_ANIMATOR(InitActorEvade) DEF_ANIMATOR(InitActorFindPlayer) @@ -2448,14 +2445,7 @@ DEF_ANIMATOR(InitRipper2Charge) DEF_ANIMATOR(InitRipper2Hang) DEF_ANIMATOR(InitRipperHang) DEF_ANIMATOR(InitActorRunToward) -DEF_ANIMATOR(InitActorPainNoise) -DEF_ANIMATOR(InitActorDieNoise) -DEF_ANIMATOR(InitActorExtra1Noise) -DEF_ANIMATOR(InitActorExtra2Noise) -DEF_ANIMATOR(InitActorExtra3Noise) -DEF_ANIMATOR(InitActorExtra4Noise) -DEF_ANIMATOR(InitActorExtra5Noise) -DEF_ANIMATOR(InitActorExtra6Noise) +DEF_ANIMATOR(InitActorSetDecide) END_SW_NS #endif diff --git a/source/games/sw/src/girlninj.cpp b/source/games/sw/src/girlninj.cpp index f11e14f66..aa627b3a6 100644 --- a/source/games/sw/src/girlninj.cpp +++ b/source/games/sw/src/girlninj.cpp @@ -52,10 +52,10 @@ DECISION GirlNinjaOffense[] = {1024, AF(InitActorAttack)} }; -DECISION GirlNinjaBroadcast[] = +DECISIONB GirlNinjaBroadcast[] = { - {6, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {6, attr_ambient}, + {1024, 0} }; DECISION GirlNinjaSurprised[] = diff --git a/source/games/sw/src/goro.cpp b/source/games/sw/src/goro.cpp index b0b7ee079..c81dba0b1 100644 --- a/source/games/sw/src/goro.cpp +++ b/source/games/sw/src/goro.cpp @@ -44,21 +44,21 @@ BEGIN_SW_NS DECISION GoroBattle[] = { {697, AF(InitActorMoveCloser ) }, - {700, AF(InitActorAmbientNoise) }, + {700, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; DECISION GoroOffense[] = { {797, AF(InitActorMoveCloser ) }, - {800, AF(InitActorAttackNoise) }, + {800, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION GoroBroadcast[] = +DECISIONB GoroBroadcast[] = { - {3, AF(InitActorAmbientNoise) }, - {1024, AF( InitActorDecide ) } + {3, attr_ambient }, + {1024, 0 } }; DECISION GoroSurprised[] = diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 518284d84..48599635a 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -44,21 +44,21 @@ DECISION HornetBattle[] = { {50, AF(InitHornetCircle ) }, {798, AF(InitActorMoveCloser) }, - {800, AF(InitActorAlertNoise) }, + {800, AF(InitActorSetDecide) }, {1024, AF(InitActorRunAway ) } }; DECISION HornetOffense[] = { {1022, AF(InitActorMoveCloser) }, - {1024, AF(InitActorAlertNoise) } + {1024, AF(InitActorSetDecide) } }; -DECISION HornetBroadcast[] = +DECISIONB HornetBroadcast[] = { - {3, AF(InitActorAlertNoise ) }, - {6, AF(InitActorAmbientNoise) }, - {1024, AF( InitActorDecide ) } + {3, attr_alert }, + {6, attr_ambient }, + {1024, 0 } }; DECISION HornetSurprised[] = diff --git a/source/games/sw/src/lava.cpp b/source/games/sw/src/lava.cpp index afae37c28..e52fb2b25 100644 --- a/source/games/sw/src/lava.cpp +++ b/source/games/sw/src/lava.cpp @@ -39,7 +39,7 @@ BEGIN_SW_NS DECISION LavaBattle[] = { {600, AF(InitActorMoveCloser) }, - {700, AF(InitActorAlertNoise) }, + {700, AF(InitActorSetDecide) }, {710, AF(InitActorRunAway ) }, {1024, AF(InitActorAttack ) } }; @@ -47,15 +47,15 @@ DECISION LavaBattle[] = DECISION LavaOffense[] = { {700, AF(InitActorMoveCloser) }, - {800, AF(InitActorAlertNoise) }, + {800, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION LavaBroadcast[] = +DECISIONB LavaBroadcast[] = { - {21, AF(InitActorAlertNoise ) }, - {51, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide ) } + {21, attr_alert }, + {51, attr_ambient }, + {1024, 0 } }; DECISION LavaSurprised[] = diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 9b2432392..0c063aa5e 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -66,10 +66,10 @@ DECISION NinjaOffense[] = {1024, AF(InitActorAttack)} }; -DECISION NinjaBroadcast[] = +DECISIONB NinjaBroadcast[] = { - {6, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {6, attr_ambient}, + {1024, 0} }; DECISION NinjaSurprised[] = @@ -118,13 +118,19 @@ PERSONALITY NinjaPersonality = DECISION NinjaSniperRoam[] = { {1023, AF(InitActorDuck)}, - {1024, AF(InitActorAmbientNoise)}, + {1024, AF(InitActorSetDecide)}, +}; + +DECISIONB NinjaSniperBroadcast2[] = +{ + {1023, 0}, + {1024, attr_ambient}, }; DECISION NinjaSniperBattle[] = { {499, AF(InitActorDuck)}, - {500, AF(InitActorAmbientNoise)}, + {500, AF(InitActorSetDecide)}, {1024, AF(InitActorAttack)} }; @@ -132,7 +138,7 @@ PERSONALITY NinjaSniperPersonality = { NinjaSniperBattle, NinjaSniperBattle, - NinjaSniperRoam, + NinjaSniperBroadcast2, NinjaSniperRoam, NinjaSniperRoam, NinjaSniperRoam, diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 0b1107e26..341786d8b 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -43,23 +43,23 @@ ANIMATOR InitRipperHang; DECISION RipperBattle[] = { {748, AF(InitActorMoveCloser)}, - {750, AF(InitActorAlertNoise)}, - {755, AF(InitActorAttackNoise)}, + {750, AF(InitActorSetDecide)}, + {755, AF(InitActorSetDecide)}, {1024, AF(InitActorAttack)} }; DECISION RipperOffense[] = { {700, AF(InitActorMoveCloser)}, - {710, AF(InitActorAlertNoise)}, + {710, AF(InitActorSetDecide)}, {1024, AF(InitActorAttack)} }; -DECISION RipperBroadcast[] = +DECISIONB RipperBroadcast[] = { - {3, AF(InitActorAlertNoise)}, - {6, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {3, attr_alert}, + {6, attr_ambient}, + {1024, 0} }; DECISION RipperSurprised[] = diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 9689b039c..90258af23 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -42,7 +42,7 @@ ANIMATOR InitRipper2Hang, InitRipper2Charge; DECISION Ripper2Battle[] = { {879, AF(InitRipper2Charge)}, - {883, AF(InitActorAttackNoise)}, + {883, AF(InitActorSetDecide)}, {900, AF(InitRipper2Hang)}, {1024, AF(InitActorAttack)} }; @@ -50,15 +50,15 @@ DECISION Ripper2Battle[] = DECISION Ripper2Offense[] = { {789, AF(InitActorMoveCloser)}, - {790, AF(InitActorAttackNoise)}, + {790, AF(InitActorSetDecide)}, {800, AF(InitRipper2Hang)}, {1024, AF(InitActorAttack)} }; -DECISION Ripper2Broadcast[] = +DECISIONB Ripper2Broadcast[] = { - {3, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {3, attr_ambient}, + {1024, 0} }; DECISION Ripper2Surprised[] = diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index c0192cb11..45af0aea8 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -40,7 +40,7 @@ BEGIN_SW_NS DECISION SerpBattle[] = { {670, AF(InitActorMoveCloser ) }, - {700, AF(InitActorAmbientNoise) }, + {700, AF(InitActorSetDecide) }, {710, AF(InitActorRunAway ) }, {1024, AF(InitActorAttack ) } }; @@ -48,14 +48,14 @@ DECISION SerpBattle[] = DECISION SerpOffense[] = { {775, AF(InitActorMoveCloser ) }, - {800, AF(InitActorAmbientNoise) }, + {800, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION SerpBroadcast[] = +DECISIONB SerpBroadcast[] = { - {10, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide ) } + {10, attr_ambient }, + {1024, 0 } }; DECISION SerpSurprised[] = @@ -73,7 +73,7 @@ DECISION SerpEvasive[] = DECISION SerpLostTarget[] = { {900, AF(InitActorFindPlayer ) }, - {921, AF(InitActorAmbientNoise) }, + {921, AF(InitActorSetDecide) }, {1024, AF(InitActorWanderAround) } }; diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index ff192f3b0..94a55d9f6 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -37,7 +37,7 @@ BEGIN_SW_NS DECISION SkelBattle[] = { {600, AF(InitActorMoveCloser) }, - {602, AF(InitActorAlertNoise) }, + {602, AF(InitActorSetDecide) }, {700, AF(InitActorRunAway ) }, {1024, AF(InitActorAttack ) } }; @@ -45,15 +45,15 @@ DECISION SkelBattle[] = DECISION SkelOffense[] = { {700, AF(InitActorMoveCloser) }, - {702, AF(InitActorAlertNoise) }, + {702, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION SkelBroadcast[] = +DECISIONB SkelBroadcast[] = { - {3, AF(InitActorAlertNoise ) }, - {6, AF(InitActorAmbientNoise) }, - {1024, AF( InitActorDecide ) } + {3, attr_alert }, + {6, attr_ambient }, + {1024, 0 } }; DECISION SkelSurprised[] = diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index b46ef58d6..3e87ac45f 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -719,7 +719,7 @@ void Terminate3DSounds(void) void PlaySpriteSound(DSWActor* actor, int attrib_ndx, int flags) { if (actor->hasU()) - PlaySound(actor->user.__legacyState.Attrib->Sounds[attrib_ndx], actor, flags); + PlaySound(actor->user.__legacyState.Attrib->Sounds[attrib_ndx - 1], actor, flags); } //========================================================================== diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index c9efedbf2..c7a1fe850 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -56,28 +56,28 @@ ANIMATOR InitSumoCharge; DECISION SumoBattle[] = { {690, AF(InitActorMoveCloser) }, - {692, AF(InitActorAlertNoise) }, + {692, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; DECISION SumoOffense[] = { {690, AF(InitActorMoveCloser) }, - {692, AF(InitActorAlertNoise) }, + {692, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION SumoBroadcast[] = +DECISIONB SumoBroadcast[] = { - {2, AF(InitActorAlertNoise ) }, - {4, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide ) } + {2, attr_alert }, + {4, attr_ambient }, + {1024, 0 } }; DECISION SumoSurprised[] = { {700, AF(InitActorMoveCloser) }, - {703, AF(InitActorAlertNoise) }, + {703, AF(InitActorSetDecide) }, {1024, AF(InitActorDecide ) } }; diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index 92234846c..a1c5d8750 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -42,7 +42,7 @@ DECISION ZillaBattle[] = { {100, AF(InitActorRunAway ) }, {690, AF(InitActorMoveCloser) }, - {692, AF(InitActorAlertNoise) }, + {692, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; @@ -50,21 +50,21 @@ DECISION ZillaOffense[] = { {100, AF(InitActorRunAway ) }, {690, AF(InitActorMoveCloser) }, - {692, AF(InitActorAlertNoise) }, + {692, AF(InitActorSetDecide) }, {1024, AF(InitActorAttack ) } }; -DECISION ZillaBroadcast[] = +DECISIONB ZillaBroadcast[] = { - {2, AF(InitActorAlertNoise ) }, - {4, AF(InitActorAmbientNoise) }, - {1024, AF(InitActorDecide ) } + {2, attr_alert }, + {4, attr_ambient }, + {1024, 0 } }; DECISION ZillaSurprised[] = { {700, AF(InitActorMoveCloser) }, - {703, AF(InitActorAlertNoise) }, + {703, AF(InitActorSetDecide) }, {1024, AF(InitActorDecide ) } }; diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index ee175d64e..518ca0745 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -54,10 +54,10 @@ DECISION ZombieOffense[] = {1024, AF(InitActorAttack)} }; -DECISION ZombieBroadcast[] = +DECISIONB ZombieBroadcast[] = { - {6, AF(InitActorAmbientNoise)}, - {1024, AF(InitActorDecide)} + {6, attr_ambient}, + {1024, 0} }; DECISION ZombieSurprised[] =