summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlepelog <25211966+lepelog@users.noreply.github.com>2022-06-15 22:37:02 +0200
committerlepelog <25211966+lepelog@users.noreply.github.com>2022-06-15 22:37:02 +0200
commitfaea8747414203590cda033d6a2edb0a3c52d3e9 (patch)
tree0170bd99802e50ccc397d48fd3dd95ace0249d19
parent8945d46f0913ec203975ef08864f0dbd6ef6a371 (diff)
match dEvDt_Next_Stage
-rw-r--r--include/d/d_stage.h13
-rw-r--r--src/d/event/d_event_data.cpp30
2 files changed, 26 insertions, 17 deletions
diff --git a/include/d/d_stage.h b/include/d/d_stage.h
index 597a4e8112..7dabe6c936 100644
--- a/include/d/d_stage.h
+++ b/include/d/d_stage.h
@@ -57,6 +57,10 @@ struct stage_scls_info_class {
/* 0xA */ u8 field_0xa;
/* 0xB */ u8 field_0xb;
/* 0xC */ s8 mWipe;
+
+ char* getStage() { return mStage; }
+
+ int getRoom() { return mRoom; }
}; // Size: 0xD
struct stage_scls_info_dummy_class {
@@ -889,8 +893,7 @@ inline s16 dStage_stagInfo_GetUpButton(stage_stag_info_class* p_info) {
inline u32 dStage_stagInfo_GetArg0(stage_stag_info_class* p_info) {
return (p_info->field_0x0c >> 0x14) & 0xFF;
}
-
-inline int dStage_sclsInfo_getSceneLayer(stage_scls_info_class* p_info) {
+inline u32 dStage_sclsInfo_getSceneLayer(stage_scls_info_class* p_info) {
return p_info->field_0xb & 0xF;
}
@@ -898,12 +901,12 @@ inline s8 dStage_sclsInfo_getWipe(stage_scls_info_class* p_info) {
return p_info->mWipe;
}
-inline u32 dStage_sclsInfo_getWipeTime(stage_scls_info_class* p_info) {
- return (p_info->field_0xb & 0xF0) >> 5;
+inline s32 dStage_sclsInfo_getWipeTime(stage_scls_info_class* p_info) {
+ return (p_info->field_0xb >> 5) & 7;
}
inline int dStage_sclsInfo_getTimeH(stage_scls_info_class* p_info) {
- return ((p_info->field_0xa & 0xF0) >> 4) | (p_info->field_0xb & 0x10);
+ return (u8)((p_info->field_0xa >> 4) & 0xF) | (p_info->field_0xb & 0x10 & ~0xF);
}
inline u32 dStage_FileList_dt_getMiniMap(dStage_FileList_dt_c* p_fList) {
diff --git a/src/d/event/d_event_data.cpp b/src/d/event/d_event_data.cpp
index b28ca2bd6b..0bf899fcaf 100644
--- a/src/d/event/d_event_data.cpp
+++ b/src/d/event/d_event_data.cpp
@@ -265,21 +265,26 @@ SECTION_SDATA2 static f32 lit_4265 = 15.0f;
SECTION_SDATA2 static f64 lit_4267 = 4503601774854144.0 /* cast s32 to float */;
/* 80043A14-80043D60 03E354 034C+00 1/1 0/0 0/0 .text dEvDt_Next_Stage__Fii */
-// bunch of issues with sclsInfo section. regalloc for the rest
-// TODO: try struct on stack
#ifdef NONMATCHING
+// matches besides floats
static int dEvDt_Next_Stage(int index, int wipe_type) {
char* stage;
s16 point;
+ int mode;
s8 roomNo;
s8 layer;
- u32 mode = 0; // uvar8 - retail
- s8 wipe = wipe_type; // ivar10
- int noVisit = true;
- int wipe_time = 0; // bvar9
- f32 speed = FLOAT_LABEL(lit_4264); // dvar12
- bool setHour = false; // bvar2
- f32 hour = speed; // set to 0.0f dvar13
+ s8 wipe;
+ s32 noVisit;
+ s32 wipe_time;
+ f32 hour;
+ f32 speed;
+ mode = 0; // uvar8 - retail
+ wipe = wipe_type; // ivar10
+ noVisit = true;
+ wipe_time = 0; // bvar9
+ hour = 0; // dvar12
+ bool setHour = false; // bvar2
+ speed = 0; // set to 0.0f dvar13
int* p_id = dComIfGp_evmng_getMyIntegerP(index, "ID");
if (p_id != NULL) {
@@ -296,9 +301,10 @@ static int dEvDt_Next_Stage(int index, int wipe_type) {
stage_scls_info_class* stgInfo = &info->mEntries[id];
stage = stgInfo->mStage;
point = stgInfo->mStart;
- roomNo = stgInfo->mRoom;
+ roomNo = (s8)stgInfo->mRoom;
+ int tmp; // might be fake idk
layer = dStage_sclsInfo_getSceneLayer(stgInfo);
- wipe = dStage_sclsInfo_getWipe(stgInfo);
+ wipe = (s8)dStage_sclsInfo_getWipe(stgInfo);
wipe_time = dStage_sclsInfo_getWipeTime(stgInfo);
if (wipe == 15) {
@@ -325,7 +331,7 @@ static int dEvDt_Next_Stage(int index, int wipe_type) {
int* roomP = dComIfGp_evmng_getMyIntegerP(index, "RoomNo");
if (roomP != NULL) {
- roomNo = *roomP;
+ roomNo = (s8)*roomP;
}
int* layerP = dComIfGp_evmng_getMyIntegerP(index, "Layer");