From 6a6391726ec51d3fadf1206a54b1ae423c58a365 Mon Sep 17 00:00:00 2001 From: Federico Date: Thu, 11 Apr 2024 03:09:40 -0300 Subject: [PATCH] [MONSTER]: Implement MON_Stunned Matching - 100% https://decomp.me/scratch/o2uEz --- KAIN2/Game/MONSTER/MONSTER.C | 56 +++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/KAIN2/Game/MONSTER/MONSTER.C b/KAIN2/Game/MONSTER/MONSTER.C index 8ef28b99..2b2e3631 100644 --- a/KAIN2/Game/MONSTER/MONSTER.C +++ b/KAIN2/Game/MONSTER/MONSTER.C @@ -743,24 +743,46 @@ void MON_StunnedEntry(struct _Instance *instance) } -// autogenerated function stub: -// void /*$ra*/ MON_Stunned(struct _Instance *instance /*$s0*/) -void MON_Stunned(struct _Instance *instance) -{ // line 1332, offset 0x80089464 - /* begin block 1 */ - // Start line: 1333 - // Start offset: 0x80089464 - // Variables: - struct _MonsterVars *mv; // $s1 - /* end block 1 */ - // End offset: 0x80089560 - // End Line: 1363 +void MON_Stunned(struct _Instance* instance) // Matching - 100% +{ + struct _MonsterVars* mv; - /* begin block 2 */ - // Start line: 2862 - /* end block 2 */ - // End Line: 2863 - UNIMPLEMENTED(); + mv = (struct _MonsterVars*)instance->extraData; + + if ((instance->flags2 & 0x10)) + { + if (!(mv->mvFlags & 0x100)) + { + MON_SwitchState(instance, MONSTER_STATE_COMBAT); + } + else + { + MON_PlayAnim(instance, MONSTER_ANIM_STUNNED, 1); + } + } + + if (mv->generalTimer < MON_GetTime(instance)) + { + instance->xVel = 0; + instance->yVel = 0; + instance->zVel = 0; + } + + if ((!(mv->mvFlags & 0x100)) && (MON_AnimPlaying(instance, MONSTER_ANIM_STUNNED_RECOVERY) == 0)) + { + MON_PlayAnim(instance, MONSTER_ANIM_STUNNED_RECOVERY, 1); + } + + MON_DefaultQueueHandler(instance); + + PHYSICS_StopIfCloseToTarget(instance, 0, 0, 0); + + PhysicsMove(instance, &instance->position, gameTrackerX.timeMult); + + if (instance->currentMainState != 9) + { + instance->checkMask &= ~0x20; + } }