From fe24913d6340b8a8a840bcf6be36e1db5c056768 Mon Sep 17 00:00:00 2001 From: sirlemonhead Date: Fri, 15 Nov 2019 20:11:59 +0000 Subject: [PATCH] Hopefully finally fixed Lion AI. Should now attempt to go underground when shot --- source/exhumed/src/lion.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/source/exhumed/src/lion.cpp b/source/exhumed/src/lion.cpp index 6b6267ade..0caaabd9f 100644 --- a/source/exhumed/src/lion.cpp +++ b/source/exhumed/src/lion.cpp @@ -142,9 +142,9 @@ void FuncLion(int a, int nDamage, int nRun) if (LionList[nLion].nHealth <= 0) { // R.I.P. - sprite[nSprite].zvel = 0; - sprite[nSprite].yvel = 0; sprite[nSprite].xvel = 0; + sprite[nSprite].yvel = 0; + sprite[nSprite].zvel = 0; LionList[nLion].nHealth = 0; sprite[nSprite].cstat &= 0xFEFE; @@ -168,7 +168,7 @@ void FuncLion(int a, int nDamage, int nRun) } else { - if (a >= 0) + if ((a & 0xFFFF) >= 0) { short nTarget = a & 0xFFFF; @@ -181,8 +181,8 @@ void FuncLion(int a, int nDamage, int nRun) if (RandomSize(8) <= (LionList[nLion].nHealth >> 2)) { LionList[nLion].nAction = 4; - sprite[nSprite].yvel = 0; sprite[nSprite].xvel = 0; + sprite[nSprite].yvel = 0; } else if (RandomSize(1)) { @@ -192,12 +192,17 @@ void FuncLion(int a, int nDamage, int nRun) sprite[nSprite].ang = (sprite[nSprite].ang - (RandomSize(1) << 8)) + (RandomSize(1) << 8); } + else + { + sprite[nSprite].xvel = 0; + sprite[nSprite].yvel = 0; + LionList[nLion].nAction = 8; + sprite[nSprite].cstat &= 0xFEFE; + } LionList[nLion]._b = 0; - return; } } - return; } } return; @@ -314,7 +319,14 @@ void FuncLion(int a, int nDamage, int nRun) { if ((nVal & 0x3FFF) == nTarget) { - if (sprite[nSprite].cstat != 0x8000) + if (sprite[nSprite].cstat & 0x8000) + { + LionList[nLion].nAction = 9; + sprite[nSprite].cstat &= 0x7FFF; + sprite[nSprite].xvel = 0; + sprite[nSprite].yvel = 0; + } + else { int nAng = getangle(sprite[nTarget].x - sprite[nSprite].x, sprite[nTarget].y - sprite[nSprite].y); @@ -323,13 +335,6 @@ void FuncLion(int a, int nDamage, int nRun) LionList[nLion].nAction = 3; } } - else - { - LionList[nLion].nAction = 9; - sprite[nSprite].cstat &= 0x7FFF; - sprite[nSprite].xvel = 0; - sprite[nSprite].yvel = 0; - } LionList[nLion]._b = 0; break; @@ -481,6 +486,7 @@ void FuncLion(int a, int nDamage, int nRun) sprite[nSprite].ang = (sprite[nSprite].ang + 256) & kAngleMask; sprite[nSprite].xvel = Sin(sprite[nSprite].ang + 512) >> 1; sprite[nSprite].yvel = Sin(sprite[nSprite].ang) >> 1; + break; } }