From a8b3fc02293906a2082e645f6c5f0cdd091a93a0 Mon Sep 17 00:00:00 2001 From: Piccio23 <105627859+Piccio23@users.noreply.github.com> Date: Sat, 1 Aug 2026 12:18:50 +0200 Subject: [PATCH] match `Event.c` --- src/cs4/Seimei/src/Event.c | 158 ++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 9 deletions(-) diff --git a/src/cs4/Seimei/src/Event.c b/src/cs4/Seimei/src/Event.c index 1c439d2..b8b812f 100644 --- a/src/cs4/Seimei/src/Event.c +++ b/src/cs4/Seimei/src/Event.c @@ -1,19 +1,159 @@ +#include "Event.h" +#include "Event0001.h" +#include "Event0002.h" +#include "Event0006.h" +#include "Event0008.h" +#include "Event0009.h" +#include "Event0010.h" +#include "Event0031.h" +#include "Event0032.h" +#include "Event0033.h" +#include "Event0034.h" +#include "Event0035.h" +#include "Event0040.h" +#include "Event0041.h" +#include "Event0051.h" +#include "Event0083.h" +#include "Event0085.h" +#include "Ene.h" +#include "Game.h" +#include "Map.h" +#include "MenuTD.h" #include "common.h" -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", SetEventModelDrawAndHit); +// bss +EVENT EventMngSt[50]; -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", EventEneHitCheck); +void SetEventModelDrawAndHit(MDLMNG* lpMdl, u_char OnOff) { + lpMdl->bErase = OnOff; + lpMdl->HitOff = OnOff; +} -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", EasyEneAppearEx); +void EventEneHitCheck(MDLMNG* lpEne) { + + + + if (lpEne->GravOff == 0) lpEne->Pos[1] += 0.1f; + + if (lpEne->MapHitOff == 0) lpEne->HitFlag = CheckHitMapGetMdlMng(lpEne, lpEne->lpHitMap); +} -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", EasyEneAppear); +void EasyEneAppearEx(int CtrlId, u_short AnimId, u_char bLogicFree) { + PARTS* lpParts = GetMapPartsInfoByCtrlId(2, CtrlId); + int MdlMngIndex = GetMdlMngIndexByCtrlId(2, CtrlId); + MDLMNG* lpMdlMng = &MdlMng[MdlMngIndex + 161]; + int EneNo, EneDataIndex; + EneNo = lpParts->MdlKindId; -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", CheckSquareRange); + + EneDataIndex = GetMdlDataIndexFromMapMdlInfo(2, EneNo); -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", ActiEventFunc); + if ((lpParts->Pos != NULL) && (EneDataIndex != -1)) + EneAppear(EneNo, EneDataIndex, lpMdlMng, lpParts->Pos, lpParts->Ang[1], lpParts->Scl, 1, AnimId, bLogicFree, NULL, NULL); -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", PlayEventFunc); -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", InitEventFunc); +} -INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Event", SetEventFunc); +void EasyEneAppear(int CtrlId) { + PARTS* lpParts = GetMapPartsInfoByCtrlId(2, CtrlId); + int MdlMngIndex = GetMdlMngIndexByCtrlId(2, CtrlId); + MDLMNG* lpMdlMng = &MdlMng[MdlMngIndex + 161]; + int EneNo, EneDataIndex; + EneNo = lpParts->MdlKindId; + + + EneDataIndex = GetMdlDataIndexFromMapMdlInfo(2, EneNo); + + if ((lpParts->Pos != NULL) && (EneDataIndex != -1)) + EneAppear(EneNo, EneDataIndex, lpMdlMng, lpParts->Pos, lpParts->Ang[1], lpParts->Scl, 1, 0xFFFF, 0,NULL, NULL); + + +} + +int CheckSquareRange(float* Pos, float* Range) { + + + + + + + + + + + + + + + + + + + + + + + + + if ((Pos[0] < Range[0]) || (Pos[0] > Range[2]) || (Pos[2] < Range[1]) || (Pos[2] > Range[3])) return 0; + else return 1; +} + +void ActiEventFunc(u_int EventNo, u_int Id) { + EVENT* lpEvent = &EventMngSt[EventNo]; + + if (lpEvent->ActiFunc != NULL) lpEvent->ActiFunc(lpEvent, Id); +} + +void PlayEventFunc(void) { // not line matched + EVENT* lpEvent; + + if (GameSt.GameMode == 0) { + if (GameSt.Pause == 0) { + + if (Menu_TD_IsPlay() != 0) return; + + lpEvent = EventMngSt; + do + { + if (lpEvent->PlayFunc != NULL) lpEvent->PlayFunc(lpEvent); + + + + } while (++lpEvent != &EventMngSt[50]); + + } + } +} + +void InitEventFunc(void) { // not line matched + EVENT* lpEvent; // r16 + + lpEvent = EventMngSt; + do { + if (lpEvent->InitFunc != NULL) lpEvent->InitFunc(lpEvent); + } while (++lpEvent != &EventMngSt[50]); +} + +void SetEventFunc(void) { + memset(EventMngSt, 0, sizeof(EventMngSt)); + + switch (GameSt.sceneNo) { + case 1: SetEventFuncS0001(); break; + case 2: SetEventFuncS0002(); break; + case 6: SetEventFuncS0006(); break; + case 8: SetEventFuncS0008(); break; + case 9: SetEventFuncS0009(); break; + case 10: SetEventFuncS0010(); break; + case 31: SetEventFuncS0031(); break; + case 32: SetEventFuncS0032(); break; + case 33: SetEventFuncS0033(); break; + case 34: SetEventFuncS0034(); break; + case 35: SetEventFuncS0035(); break; + case 40: SetEventFuncS0040(); break; + case 41: SetEventFuncS0041(); break; + case 51: SetEventFuncS0051(); break; + case 83: SetEventFuncS0083(); break; + case 85: SetEventFuncS0085(); + } +}