d_stage fixup

This commit is contained in:
Jasper St. Pierre
2023-10-02 22:25:48 -07:00
parent 2dc87a5274
commit b0bfe1c49e
5 changed files with 49 additions and 27 deletions
+1 -1
View File
@@ -822,7 +822,7 @@ inline s8 dComIfGp_getStartStageLayer() {
return g_dComIfG_gameInfo.play.getStartStageLayer();
}
inline s16 dComIfGp_getStartStagePoint() {
inline s32 dComIfGp_getStartStagePoint() {
return g_dComIfG_gameInfo.play.getStartStagePoint();
}
+1
View File
@@ -413,5 +413,6 @@ void dKy_set_vrboxsoracol_ratio(f32 ratio);
void dKy_set_vrboxkumocol_ratio(f32 ratio);
cXyz dKy_get_orion_pos();
cXyz dKy_get_hokuto_pos();
void dKy_DayProc();
#endif /* D_KANKYO_D_KANKYO_H */
+11 -11
View File
@@ -133,13 +133,13 @@ public:
* Translates the `now` Matrix by the given cXyz
* @param xyz The xyz translation vector
*/
/* 8000CD64 */ static inline void transS(cXyz const& xyz) { MTXTrans(now, xyz.x, xyz.y, xyz.z); }
static inline void transS(cXyz const& xyz) { MTXTrans(now, xyz.x, xyz.y, xyz.z); }
/**
* Translates a new Matrix by the given cXyz and then concatenates it with the `now` matrix
* @param xyz The xyz translation vector
*/
/* 8000CD64 */ static inline void transM(cXyz const& xyz) { transM(xyz.x, xyz.y, xyz.z); }
static inline void transM(cXyz const& xyz) { transM(xyz.x, xyz.y, xyz.z); }
/**
* Translates a new Matrix by the given X, Y, and Z values and then concatenates it with the `now` matrix
@@ -147,19 +147,19 @@ public:
* @param y The y-axis translation value
* @param z The z-axis translation value
*/
/* 8000CD9C */ static void transM(f32 x, f32 y, f32 z);
static void transM(f32 x, f32 y, f32 z);
/**
* Scales the `now` Matrix by the given cXyz
* @param xyz The xyz scale vector
*/
/* 8000CE00 */ static void scaleS(cXyz const& xyz);
static void scaleS(cXyz const& xyz);
/**
* Scales a new Matrix by the given cXyz and then concatenates it with the `now` matrix
* @param xyz The xyz scale vector
*/
/* 8000CE70 */ static void scaleM(cXyz const& xyz) { scaleM(xyz.x, xyz.y, xyz.z); }
static void scaleM(cXyz const& xyz) { scaleM(xyz.x, xyz.y, xyz.z); }
/**
* Scales a new Matrix by the given X, Y, and Z values and then concatenates it with the `now` matrix
@@ -167,25 +167,25 @@ public:
* @param y The y-axis scale value
* @param z The z-axis scale value
*/
/* 8000CE38 */ static void scaleM(f32 x, f32 y, f32 z);
static void scaleM(f32 x, f32 y, f32 z);
/* 8000CE9C */ static void XYZrotS(csXyz const& xyz);
static void XYZrotS(csXyz const& xyz);
/**
* Rotates the `now` matrix by the given csXyz in the order X, Y, Z
* @param xyz The xyz rotation vector
*/
/* 8000CED4 */ static void XYZrotM(csXyz const& xyz);
static void XYZrotM(csXyz const& xyz);
/* 8000CF0C */ static void ZXYrotS(csXyz const& xyz);
static void ZXYrotS(csXyz const& xyz);
/**
* Rotates the `now` matrix by the given csXyz in the order Z, X, Y
* @param xyz The xyz rotation vector
*/
/* 8000CF44 */ static void ZXYrotM(csXyz const& xyz) { ZXYrotM(xyz.x, xyz.y, xyz.z); }
static void ZXYrotM(csXyz const& xyz) { ZXYrotM(xyz.x, xyz.y, xyz.z); }
/* 8000CF7C */ static void quatM(Quaternion const*);
static void quatM(Quaternion const*);
/**
* Returns the `now` Matrix
+33 -12
View File
@@ -13,6 +13,7 @@
#include "d/d_bg_s.h"
#include "d/d_bg_s_gnd_chk.h"
#include "d/d_com_inf_game.h"
#include "d/d_path.h"
#include "d/d_procname.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_camera_mng.h"
@@ -220,7 +221,7 @@ dStage_darkStatus_c* dStage_roomControl_c::getDarkStatus() {
return NULL;
// pointer math here seems wrong...
return &mDarkStatus[plist_p->mParam & 0x78];
return &mDarkStatus[(plist_p->mParam & 0x78) >> 3];
}
/* 80041330-80041370 .text getDarkMode__20dStage_roomControl_cFv */
@@ -1338,22 +1339,20 @@ int dStage_arrowInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) {
/* 80041F3C-80041F54 .text dStage_mapInfo_GetOceanX__FP20stage_map_info_class */
int dStage_mapInfo_GetOceanX(stage_map_info_class* i_mapInfo) {
int rt = (i_mapInfo->mOceanXZ & 0xF);
if (!(i_mapInfo->mOceanXZ & 8)) {
if (rt & 8)
return rt - 0x10;
else
return rt;
}
return rt - 0x10;
}
/* 80041F54-80041F6C .text dStage_mapInfo_GetOceanZ__FP20stage_map_info_class */
// NONMATCHING
int dStage_mapInfo_GetOceanZ(stage_map_info_class* i_mapInfo) {
int rt = (i_mapInfo->mOceanXZ >> 4) & 0xF;
if ((i_mapInfo->mOceanXZ >> 4) & 8) {
int rt = (i_mapInfo->mOceanXZ >> 4) & 0x0F;
if (rt & 8)
return rt - 0x10;
}
return rt;
else
return rt;
}
/* 80041F6C-80041FD0 .text dStage_mapInfoInit__FP11dStage_dt_cPviPv */
@@ -1578,7 +1577,13 @@ int dStage_ppntInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) {
/* 8004268C-8004271C .text dStage_pathInfoInit__FP11dStage_dt_cPviPv */
int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) {
/* Nonmatching */
dStage_dPath_c* pStagePath = (dStage_dPath_c*)((char*)i_data + 4);
dPath* pPath = pStagePath->m_path;
i_stage->setPathInfo(pStagePath);
for (s32 i = 0; i < pStagePath->num; i++, pPath++)
*(u32*)pPath->mpPnt += (u32)i_stage->getPntInf();
return 1;
}
/* 8004271C-80042750 .text dStage_rppnInfoInit__FP11dStage_dt_cPviPv */
@@ -2151,7 +2156,23 @@ void dStage_restartRoom(u32 roomParam, u32 mode) {
/* 80043B10-80043BD0 .text dStage_turnRestart__Fv */
void dStage_turnRestart() {
/* Nonmatching */
s8 layerNo = dComIfGp_getStartStageLayer();
if (layerNo >= 0)
layerNo = dComIfGp_getStartStageLayer() ^ 1;
dComIfGp_setNextStage(dComIfGp_getStartStageName(), -3, dComIfGs_getTurnRestartRoomNo(), layerNo, 0.0f, 0, 0, 6);
s32 hour = dKy_getdaytime_hour();
f32 nextTime = 180.0f;
if (hour >= 6 && hour < 18)
nextTime = 0.0f;
if (hour >= 6 && hour <= 23) {
dComIfGs_setDate(dComIfGs_getDate() + 1);
dKy_DayProc();
}
dKy_set_nexttime(nextTime);
}
/* 80043BD0-80043C84 .text dStage_escapeRestart__Fv */
+3 -3
View File
@@ -57,10 +57,10 @@ s32 daThrowstone_c::_create() {
mDoMtx_stack_c::YrotM(shape_angle.y);
mDoMtx_stack_c::scaleM(mScale);
MTXCopy(mDoMtx_stack_c::get(), mMtx);
mDoMtx_copy(mDoMtx_stack_c::get(), mMtx);
mCullMtx = mpModel->getBaseTRMtx();
MTXCopy(mpModel->getBaseTRMtx(), mMtx);
mDoMtx_copy(mpModel->getBaseTRMtx(), mMtx);
}
}
@@ -90,7 +90,7 @@ BOOL daThrowstone_c::_execute() {
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), mMtx);
mDoMtx_copy(mDoMtx_stack_c::get(), mMtx);
return FALSE;
}