d_save fixes, d_a_andsw dComIfGp fix

This commit is contained in:
Jasper St. Pierre
2023-09-11 17:31:40 -07:00
parent ec47c5af0c
commit a5bf46f66b
6 changed files with 88 additions and 49 deletions
+10 -10
View File
@@ -97,7 +97,7 @@ BOOL daAndsw2_c::chkAllSw2() {
return false;
}
for (int i = 0; i < num; i++) {
if (!g_dComIfG_gameInfo.info.isSwitch(topSw+i, getRoomNo())) {
if (!dComIfGs_isSwitch(topSw+i, getRoomNo())) {
return false;
}
}
@@ -115,7 +115,7 @@ static s32 daAndsw2_actionOnAll(daAndsw2_c* i_this) {
} else {
int room = i_this->getRoomNo();
int sw = i_this->getSwbit();
g_dComIfG_gameInfo.info.onSwitch(sw, room);
dComIfGs_onSwitch(sw, room);
if (i_this->getType() == TYPE_CONTINUOUS) {
i_this->mAction = ACT_OFF;
@@ -138,7 +138,7 @@ static s32 daAndsw2_actionTimer(daAndsw2_c* i_this) {
} else {
int room = i_this->getRoomNo();
int sw = i_this->getSwbit();
g_dComIfG_gameInfo.info.onSwitch(sw, room);
dComIfGs_onSwitch(sw, room);
if (i_this->getType() == TYPE_CONTINUOUS) {
i_this->mAction = ACT_WAIT;
@@ -153,7 +153,7 @@ static s32 daAndsw2_actionOrder(daAndsw2_c* i_this) {
i_this->mAction = ACT_EVENT;
int room = i_this->getRoomNo();
int sw = i_this->getSwbit();
g_dComIfG_gameInfo.info.onSwitch(sw, room);
dComIfGs_onSwitch(sw, room);
} else if (i_this->getType() == TYPE_CONTINUOUS && !i_this->chkAllSw2()) {
i_this->mAction = ACT_ON_ALL;
} else {
@@ -165,7 +165,7 @@ static s32 daAndsw2_actionOrder(daAndsw2_c* i_this) {
/* 00000438-000004BC .text daAndsw2_actionEvent__FP10daAndsw2_c */
static s32 daAndsw2_actionEvent(daAndsw2_c* i_this) {
dComIfG_play_c* play = &g_dComIfG_gameInfo.play;
if (play->mEventMgr.endCheck(i_this->mEventIdx)) {
if (dComIfGp_evmng_endCheck(i_this->mEventIdx)) {
if (i_this->getType() == TYPE_CONTINUOUS) {
i_this->mAction = ACT_OFF;
} else {
@@ -182,7 +182,7 @@ static s32 daAndsw2_actionOff(daAndsw2_c* i_this) {
i_this->mAction = ACT_ON_ALL;
int room = i_this->getRoomNo();
int sw = i_this->getSwbit();
g_dComIfG_gameInfo.info.offSwitch(sw, room);
dComIfGs_offSwitch(sw, room);
}
return 1;
}
@@ -212,27 +212,27 @@ s32 daAndsw2_c::create() {
switch (getType()) {
case TYPE_ONE_OFF:
if (sw == 0xFF || g_dComIfG_gameInfo.info.isSwitch(sw, getRoomNo())) {
if (sw == 0xFF || dComIfGs_isSwitch(sw, getRoomNo())) {
// Switch invalid or already set.
mAction = ACT_WAIT;
} else {
// Switch not yet set, check for the condition to be met.
mAction = ACT_ON_ALL;
}
mEventIdx = g_dComIfG_gameInfo.play.mEventMgr.getEventIdx(NULL, getEventNo());
mEventIdx = dComIfGp_evmng_getEventIdx(NULL, getEventNo());
break;
case TYPE_CONTINUOUS:
if (sw == 0xFF) {
// Switch invalid.
mAction = ACT_WAIT;
} else if (g_dComIfG_gameInfo.info.isSwitch(sw, getRoomNo())) {
} else if (dComIfGs_isSwitch(sw, getRoomNo())) {
// Switch already set, wait for the condition to no longer be met.
mAction = ACT_OFF;
} else {
// Switch not yet set, check for the condition to be met.
mAction = ACT_ON_ALL;
}
mEventIdx = g_dComIfG_gameInfo.play.mEventMgr.getEventIdx(NULL, getEventNo());
mEventIdx = dComIfGp_evmng_getEventIdx(NULL, getEventNo());
break;
default:
// Invalid type, do nothing.
+24 -14
View File
@@ -6,7 +6,10 @@
#include "d/d_save.h"
#include "d/d_save_init.h"
#include "d/d_com_inf_game.h"
#include "d/d_item_data.h"
#include "d/d_stage.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "MSL_C/string.h"
#include "SSystem/SComponent/c_lib.h"
#include "SSystem/SComponent/c_math.h"
@@ -67,7 +70,7 @@ void dSv_player_status_a_c::init() {
case 29:
case 30:
case 31:
item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 13];
item = g_dComIfG_gameInfo.save.getPlayer().mGetItem.mItemFlags[item_idx + 13];
break;
case 32:
case 33:
@@ -82,7 +85,7 @@ void dSv_player_status_a_c::init() {
case 41:
case 42:
case 43:
item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 9];
item = g_dComIfG_gameInfo.save.getPlayer().mGetItem.mItemFlags[item_idx + 9];
break;
case 44:
case 45:
@@ -97,7 +100,7 @@ void dSv_player_status_a_c::init() {
case 53:
case 54:
case 55:
item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 5];
item = g_dComIfG_gameInfo.save.getPlayer().mGetItem.mItemFlags[item_idx + 5];
break;
}
@@ -352,13 +355,23 @@ void dSv_player_item_record_c::init() {
}
/* 8005987C-80059894 .text resetTimer__24dSv_player_item_record_cFUs */
void dSv_player_item_record_c::resetTimer(u16) {
/* Nonmatching */
void dSv_player_item_record_c::resetTimer(u16 timer) {
mTimer = timer;
g_dComIfG_gameInfo.play.field_0x4956 = 0;
}
/* 80059894-800598D0 .text decTimer__24dSv_player_item_record_cFv */
void dSv_player_item_record_c::decTimer() {
/* Nonmatching */
if (g_dComIfG_gameInfo.play.field_0x4956 != 1)
return;
if (mTimer != 0) {
mTimer--;
return;
}
mTimer = 0;
g_dComIfG_gameInfo.play.field_0x4956 = 0;
}
/* 800598D0-800598D8 .text getTimer__24dSv_player_item_record_cFv */
@@ -815,8 +828,11 @@ void dSv_player_config_c::init() {
}
/* 8005BFA4-8005BFC8 .text checkVibration__19dSv_player_config_cFv */
void dSv_player_config_c::checkVibration() {
/* Nonmatching */
s32 dSv_player_config_c::checkVibration() {
if (JUTGamePad::sRumbleSupported)
return g_dComIfG_gameInfo.play.field_0x4963;
return 0;
}
/* 8005BFC8-8005BFD4 .text init__19dSv_player_priest_cFv */
@@ -867,7 +883,6 @@ void dSv_memBit_c::init() {
mVisitedRoom[i] = 0;
}
field_0x20 = 0;
mDungeonItem = 0;
}
@@ -1265,11 +1280,6 @@ void dSv_info_c::onSwitch(int i_no, int i_roomNo) {
}
}
/* 8005DCD0-8005DCEC .text getZoneNo__20dStage_roomControl_cFi */
int dStage_roomControl_c::getZoneNo(int param_0) {
/* Nonmatching */
}
/* 8005DCEC-8005DE98 .text offSwitch__10dSv_info_cFii */
void dSv_info_c::offSwitch(int i_no, int i_roomNo) {
JUT_ASSERT(3448,