Merge pull request #257 from robojumper/d_lyt_map_more

some more map things
This commit is contained in:
robojumper
2025-11-22 15:43:26 +01:00
committed by GitHub
50 changed files with 9490 additions and 773 deletions
+2 -2
View File
@@ -257,7 +257,7 @@ bool dCsGame_c::shouldDraw() const {
bool dCsGame_c::isForcedHidden() const {
return (
EventManagerNotDrawControl0x80() && EventManagerNotSkyKeepPuzzle() && EventManagerNotInShop() &&
EventManagerNotInDeposit() && !EventManagerIsMapOpenAndMessage() && !EventManagerIsMapOpenAnd0x9008Eq10()
EventManagerNotInDeposit() && !EventManagerIsMapOpenNormal() && !EventManagerIsMapEventSaveObj()
);
}
@@ -338,7 +338,7 @@ mVec2_c &dCursorInterfaceGame_c::getCursorPos() {
f32 f3 = sHio.field_0x10 + 4.0f;
f32 f4 = sHio.field_0x0C + -15.0f;
if (dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpenMaybe()) {
if (dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpen()) {
if (pos.x < -f0 + f4) {
pos.x = -f0 + f4;
}
+22 -20
View File
@@ -417,35 +417,37 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) {
dStageMgr_c::GetInstance()->getFlagIndex();
SceneflagManager::sInstance->unsetTempflag_i(0x3F, (params1n2 >> 16) & 0xFFFF);
break;
case EVENT_LIGHT_PILLAR_30: {
case EVENT_START_MAP_EVENT: {
s8 p4 = (params1n2 >> 24) & 0xFF;
s8 p1 = params1n2 & 0xFF;
s8 p3 = (params1n2 >> 16) & 0xFF;
s8 p2 = (params1n2 >> 8) & 0xFF;
s32 val = 1;
s8 arg1 = (params1n2 >> 16) & 0xFF;
s8 arg2 = (params1n2 >> 8) & 0xFF;
s32 mapEvent = 1;
switch (p1) {
case 1: val = 4; break;
case 2: val = 3; break;
case 3: val = 5; break;
case 5: val = 7; break;
case 6: val = 8; break;
case 7: val = 9; break;
case 1: mapEvent = dLytMapMain_c::MAP_EVENT_DUNGEON_MAP_GET; break;
case 2: mapEvent = dLytMapMain_c::MAP_EVENT_MAP_INTRO; break;
case 3: mapEvent = dLytMapMain_c::MAP_EVENT_FIELD_MAP_CHANGE_5; break;
case 5: mapEvent = dLytMapMain_c::MAP_EVENT_SIGNAL_ADD; break;
case 6: mapEvent = dLytMapMain_c::MAP_EVENT_FIELD_MAP_CHANGE_8; break;
case 7: mapEvent = dLytMapMain_c::MAP_EVENT_GODDESS_CUBE; break;
}
dMessage_c::getInstance()->setField_0x32C(val);
dMessage_c::getInstance()->setField_0x32C(mapEvent);
dMessage_c::getInstance()->setField_0x329(true);
if (dMessage_c::getInstance()->getField_0x328() == 0) {
dMessage_c::getInstance()->setField_0x328(1);
if (dMessage_c::getInstance()->getInMapEvent() == false) {
dMessage_c::getInstance()->setInMapEvent(true);
dMessage_c::getInstance()->clearLightPillarRelatedArgs();
if (dLytControlGame_c::getInstance()->isStateNormalOrNotInEvent()) {
dLytControlGame_c::getInstance()->somehowRelatedToEnteringLightPillars(val, p3, p2);
dLytControlGame_c::getInstance()->somehowRelatedToEnteringLightPillars(
mapEvent, arg1, arg2
);
}
} else {
dLytMap_c::GetInstance()->lightPillarRelated(val, p3, p2);
dLytMap_c::GetInstance()->queueMapEvent(mapEvent, arg1, arg2);
}
dMessage_c::getInstance()->storeLightPillarRelatedArg(p4);
break;
}
case EVENT_LIGHT_PILLAR_34: {
case EVENT_END_MAP_EVENT: {
// TODO what do these modes do?
if (params1n2 == 1) {
if (!dLytControlGame_c::getInstance()->isNotInStateMap()) {
@@ -463,7 +465,7 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) {
dMessage_c::getInstance()->setField_0x32A(1);
}
}
dMessage_c::getInstance()->setField_0x328(0);
dMessage_c::getInstance()->setInMapEvent(false);
break;
}
case EVENT_SET_STORYFLAG_217:
@@ -710,7 +712,7 @@ bool dFlow_c::handleMessage() {
if (StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_BOSS_RUSH_ACTIVE)) {
// "When you require my analysis..."
v = 200;
} else if (dStageMgr_c::GetInstance()->getSTIFbyte4() == 0) {
} else if (dStageMgr_c::GetInstance()->getSTIFArea() == dStageMgr_c::STIF_AREA_SKY) {
// Sky rumor
v = cM::rndInt(30);
} else {
@@ -1127,7 +1129,7 @@ bool dFlow_c::advanceUntil(s32 searchType, s32 searchParam3, s32 *pOutParams1n2)
case EVENT_LOAD_FI_FLOW:
case EVENT_COUNTER_THRESHOLD:
case 27: keepGoing = handleEvent(); continue;
case EVENT_LIGHT_PILLAR_34:
case EVENT_END_MAP_EVENT:
if (element->params1n2 == 2) {
keepGoing = false;
continue;
@@ -1762,7 +1764,7 @@ void dMessage_c::executeMinigame() {
void dMessage_c::init() {
clearLightPillarRelatedArgs();
// Probably inlines
field_0x328 = 0;
mInMapEvent = false;
field_0x329 = 0;
field_0x32A = 0;
sInstance->setField_0x32C(12);
+1 -1
View File
@@ -498,7 +498,7 @@ void ex_c::fn_80056790(s32 chan) {
f32 f;
if (dScGame_c::GetInstance() != nullptr && dLytMap_c::GetInstance() != nullptr &&
!dLytMap_c::GetInstance()->isNotInvisible()) {
!dLytMap_c::GetInstance()->isVisible()) {
f = dScGame_c::GetInstance()->targetingScreenFn_801BBEC0();
} else {
f = 1.0f;
+4 -4
View File
@@ -70,7 +70,7 @@ int dStage_c::create() {
pcam++;
}
if (mapRelated.field_0x1EB == 0) {
if (mMapRelated.field_0x1EB == 0) {
mVec3_c min, max;
for (s32 i = 0; i < MAX_ROOM_NUMBER - 1; i++) {
dRoom_c *room = getRoom(i);
@@ -89,11 +89,11 @@ int dStage_c::create() {
max.y += 6000.0f;
mVec3_c size = max - min;
mVec3_c center = mVec3_c(min.x + size.x * 0.5f, min.y, min.z + size.z * 0.5f);
mapRelated.fn_801B4B80(0, center, size);
mMapRelated.fn_801B4B80(0, center, size);
mVec3_c v = mVec3_c(10000.0f, 10000.0f, 100000.0f);
mapRelated.fn_801B4C70(v);
mMapRelated.fn_801B4C70(v);
}
mapRelated.fn_801B50C0(0);
mMapRelated.fn_801B50C0(0);
fn_80028A80();
return SUCCEEDED;
+5 -5
View File
@@ -135,15 +135,15 @@ void dLytAreaCaptionParts_c::executeState_Wait() {
if (field_0x54C) {
field_0x54C = false;
s32 typeFrame = 0;
if (dStageMgr_c::GetInstance()->isSTIFbyte4_2or3or4()) {
if (dStageMgr_c::GetInstance()->isSTIFAreaFaron()) {
typeFrame = 1;
} else if (dStageMgr_c::GetInstance()->isSTIFbyte4_5or6()) {
} else if (dStageMgr_c::GetInstance()->isSTIFAreaEldin()) {
typeFrame = 2;
} else if (dStageMgr_c::GetInstance()->isSTIFbyte4_7or8or9or10or11()) {
} else if (dStageMgr_c::GetInstance()->isSTIFAreaLanayru()) {
typeFrame = 3;
} else if (dStageMgr_c::GetInstance()->isSTIFbyte4_1()) {
} else if (dStageMgr_c::GetInstance()->isSTIFAreaSealedGrounds()) {
typeFrame = 4;
} else if (dStageMgr_c::GetInstance()->isSTIFbyte4_0()) {
} else if (dStageMgr_c::GetInstance()->isSTIFAreaSky()) {
typeFrame = 5;
}
+5300 -135
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
#include "d/lyt/d_lyt_map_capture.h"
#include "common.h"
#include "d/d_stage.h"
STATE_DEFINE(dLytMapCapture_c, RenderingWait);
STATE_DEFINE(dLytMapCapture_c, RenderingWaitStep2);
void dLytMapCapture_c::initializeState_RenderingWait() {}
void dLytMapCapture_c::executeState_RenderingWait() {
if (mRenderRequest && !mIsBusyRendering) {
fn_8012D6F0();
mRenderRequest = false;
mIsBusyRendering = true;
mStateMgr.changeState(StateID_RenderingWaitStep2);
}
}
void dLytMapCapture_c::finalizeState_RenderingWait() {}
void dLytMapCapture_c::initializeState_RenderingWaitStep2() {}
void dLytMapCapture_c::executeState_RenderingWaitStep2() {
if (mIsBusyRendering && dStage_c::GetInstance() != nullptr && !dStage_c::GetInstance()->getMapRelated()->getField_0x1EE()) {
mIsBusyRendering = false;
if (mRenderRequest) {
fn_8012D6F0();
mRenderRequest = false;
mIsBusyRendering = true;
} else {
mStateMgr.changeState(StateID_RenderingWait);
}
}
}
void dLytMapCapture_c::finalizeState_RenderingWaitStep2() {}
+87
View File
@@ -0,0 +1,87 @@
#include "d/lyt/d_lyt_map_global.h"
#include "m/m_vec.h"
dLytMapGlobal_c *dLytMapGlobal_c::sInstance;
dLytMapGlobal_c::dLytMapGlobal_c()
: mMapScroll(0.0f, 0.0f, 0.0f),
field_0x0C(0.0f, 0.0f),
mMapRotationCenter(0.0f, 0.0f, 0.0f),
field_0x20(0.0f, 0.0f),
field_0x28(0.0f, 0.0f),
mMapRotation(0),
field_0x40(1.0f),
field_0x44(1.0f),
mFloor(0),
field_0x4C(0),
field_0x4D(0),
mAlpha(0),
field_0x4F(0),
mMapEvent(0) {
sInstance = this;
}
void dLytMapGlobal_c::projectOntoMap(
mVec2_c &result, const mVec3_c &position, const mVec3_c &mapScroll, const mVec3_c &mapRotationCenter, const mAng &rot,
f32 f1, f32 f2
) const {
// Initializing like this fixes regswaps, even if it's not needed...
mVec3_c work(0.0f, 0.0f, 0.0f);
work.x = position.x - mapRotationCenter.x;
work.z = position.z - mapRotationCenter.z;
work.y = 0.0f;
work.rotY(-rot);
work.x += mapRotationCenter.x - mapScroll.x;
work.z += mapRotationCenter.z - mapScroll.z;
work.x *= f2 * f1;
work.z *= f2 * f1;
work.x *= field_0x28.x;
result.x = work.x;
result.y = -work.z;
}
void dLytMapGlobal_c::projectOntoMap(mVec2_c &result, const mVec3_c &position) const {
projectOntoMap(result, position, mMapScroll, mMapRotationCenter, mMapRotation, field_0x44, field_0x40);
}
void dLytMapGlobal_c::unprojectFromMap(mVec3_c &result, const mVec2_c &position) const {
unprojectFromMap(
result, position, field_0x20, mMapScroll, mMapRotationCenter, mMapRotation, field_0x44, field_0x40
);
}
void dLytMapGlobal_c::unprojectFromMap(mVec3_c &result, const mVec2_c &position, const mAng &rot) const {
unprojectFromMap(result, position, field_0x20, mMapScroll, mMapRotationCenter, rot, field_0x44, field_0x40);
}
void dLytMapGlobal_c::unprojectFromMap(mVec3_c &result, const mVec2_c &position, const mVec3_c &v2, const mAng &rot)
const {
unprojectFromMap(result, position, field_0x20, v2, mMapRotationCenter, rot, field_0x44, field_0x40);
}
void dLytMapGlobal_c::unprojectFromMap(
mVec3_c &result, const mVec2_c &position, const mVec2_c &v1, const mVec3_c &mapScroll, const mVec3_c &mapRotationCenter,
const mAng &rot, f32 f1, f32 f2
) const {
mVec3_c work(0.0f, 0.0f, 0.0f);
f1 *= f2;
f32 tmp = 1.0f / f1;
mVec2_c diff = position - v1;
work.x = diff.x * tmp * (1.0f / field_0x28.x);
work.z = -diff.y * tmp;
work = work + mapScroll;
work = work - mapRotationCenter;
work.rotY(rot);
work += mapRotationCenter;
result = work;
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -439,7 +439,7 @@ f32 dTextBox_c::GetLinesHeight() const {
return totalHeight;
}
f32 dTextBox_c::GetUnkWidthRatio() const {
f32 dTextBox_c::getLineDrawWidth() const {
return GetLineWidth(nullptr) / dGfx_c::get16x9to4x3WidthScaleF();
}
+3 -3
View File
@@ -996,7 +996,7 @@ bool dLytMeterMain_c::remove() {
void dLytMeterMain_c::fn_800D5290() {
dLytMeter_c *meter = dLytMeter_c::GetInstance();
if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->isSomeMapFieldEq2Or4Or5Or6()) {
if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->isMapEventEq2Or4Or5Or6()) {
meter->setFlags(METER_BTN_PLUS);
}
@@ -1008,7 +1008,7 @@ void dLytMeterMain_c::fn_800D5290() {
}
bool dLytMeterMain_c::fn_800D5350() {
if (mBasicPosition == POSITION_MAP && dMessage_c::getInstance()->getField_0x328()) {
if (mBasicPosition == POSITION_MAP && dMessage_c::getInstance()->getInMapEvent()) {
return true;
}
return false;
@@ -1093,7 +1093,7 @@ bool dLytMeterMain_c::fn_800D56B0() {
return true;
}
if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->getFn_80139EA0()) {
if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->isVisibleNoIntro()) {
return true;
}
+1 -1
View File
@@ -551,7 +551,7 @@ void dLytMsgWindow_c::finalizeState_WaitKeySelectQuestion() {}
void dLytMsgWindow_c::initializeState_MapOpen() {}
void dLytMsgWindow_c::executeState_MapOpen() {
if ((dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpenMaybe()) ||
if ((dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpen()) ||
!dLytControlGame_c::getInstance()->isInSomeMapState()) {
dMessage_c::getInstance()->setField_0x329(0);
mStateMgr.changeState(StateID_Invisible);
+6 -17
View File
@@ -176,18 +176,9 @@ bool dLytMsgWindowGet_c::execute() {
}
void dLytMsgWindowGet_c::draw() {
// NONMATCHING
// The instruction patterns here are the same that EGG::StateGX::Scoped
// generates, but there's no RAII to be found here. What's the missing
// link that makes the compiler generate these?
// When you fix this, fix other instances of this problem
// by searching for 91657b77
bool bVis[5] = {
mpPanes[0]->IsVisible(),
mpPanes[1]->IsVisible(),
mpPanes[2]->IsVisible(),
mpPanes[3]->IsVisible(),
mpPanes[4]->IsVisible(),
bool bVis[5];
for (int i = 0; i < 5; ++i) {
bVis[i] = mpPanes[i]->IsVisible();
};
mpPanes[0]->SetVisible(bVis[0]);
@@ -207,11 +198,9 @@ void dLytMsgWindowGet_c::draw() {
mLyt.draw();
mpPanes[0]->SetVisible(bVis[0]);
mpPanes[1]->SetVisible(bVis[1]);
mpPanes[2]->SetVisible(bVis[2]);
mpPanes[3]->SetVisible(bVis[3]);
mpPanes[4]->SetVisible(bVis[4]);
for (int i = 0; i < 5; ++i) {
mpPanes[i]->SetVisible(bVis[i]);
};
}
void dLytMsgWindowGet_c::open(dAcObjBase_c *obj, u32 param) {
+12 -19
View File
@@ -1,8 +1,8 @@
#include "d/lyt/msg_window/d_lyt_msg_window_link.h"
#include "common.h"
#include "d/d_tag_processor.h"
#include "d/d_lyt_hio.h"
#include "d/d_tag_processor.h"
#include "d/lyt/d2d.h"
#include "d/lyt/d_textbox.h"
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
@@ -17,10 +17,10 @@ STATE_DEFINE(dLytMsgWindowLink_c, Visible);
STATE_DEFINE(dLytMsgWindowLink_c, Out);
static const d2d::LytBrlanMapping brlanMap[] = {
{ "linkWindow_00_in.brlan", "G_inOut_00"},
{ "linkWindow_00_out.brlan", "G_inOut_00"},
{"linkWindow_00_position.brlan", "G_position_00"},
{"linkWindow_00_loop.brlan", "G_loop_00"},
{ "linkWindow_00_in.brlan", "G_inOut_00"},
{ "linkWindow_00_out.brlan", "G_inOut_00"},
{"linkWindow_00_position.brlan", "G_position_00"},
{ "linkWindow_00_loop.brlan", "G_loop_00"},
};
#define LINK_ANIM_IN 0
@@ -98,7 +98,7 @@ bool dLytMsgWindowLink_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAc
mParam = 0;
mOffset.x = mOffset.y = 0.0f;
mWaitDelay = 0;
mStateMgr.changeState(StateID_Invisible);
@@ -239,16 +239,9 @@ bool dLytMsgWindowLink_c::execute() {
}
void dLytMsgWindowLink_c::draw() {
// NONMATCHING
// The instruction patterns here are the same that EGG::StateGX::Scoped
// generates, but there's no RAII to be found here. What's the missing
// link that makes the compiler generate these?
// When you fix this, fix other instances of this problem
// by searching for 91657b77
bool bVis[3] = {
mpPanes[0]->IsVisible(),
mpPanes[1]->IsVisible(),
mpPanes[2]->IsVisible(),
bool bVis[3];
for (int i = 0; i < 3; ++i) {
bVis[i] = mpPanes[i]->IsVisible();
};
mpPanes[0]->SetVisible(bVis[0]);
@@ -266,9 +259,9 @@ void dLytMsgWindowLink_c::draw() {
mLyt.draw();
mpPanes[0]->SetVisible(bVis[0]);
mpPanes[1]->SetVisible(bVis[1]);
mpPanes[2]->SetVisible(bVis[2]);
for (int i = 0; i < 3; ++i) {
mpPanes[i]->SetVisible(bVis[i]);
};
}
void dLytMsgWindowLink_c::open(dAcObjBase_c *obj, u32 param) {
+7 -14
View File
@@ -1,8 +1,8 @@
#include "d/lyt/msg_window/d_lyt_msg_window_talk.h"
#include "common.h"
#include "d/d_tag_processor.h"
#include "d/d_lyt_hio.h"
#include "d/d_tag_processor.h"
#include "d/lyt/d2d.h"
#include "d/lyt/d_textbox.h"
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
@@ -239,16 +239,9 @@ bool dLytMsgWindowTalk_c::execute() {
}
void dLytMsgWindowTalk_c::draw() {
// NONMATCHING
// The instruction patterns here are the same that EGG::StateGX::Scoped
// generates, but there's no RAII to be found here. What's the missing
// link that makes the compiler generate these?
// When you fix this, fix other instances of this problem
// by searching for 91657b77
bool bVis[3] = {
mpPanes[0]->IsVisible(),
mpPanes[1]->IsVisible(),
mpPanes[2]->IsVisible(),
bool bVis[3];
for (int i = 0; i < 3; ++i) {
bVis[i] = mpPanes[i]->IsVisible();
};
mpPanes[0]->SetVisible(bVis[0]);
@@ -264,9 +257,9 @@ void dLytMsgWindowTalk_c::draw() {
mLyt.draw();
mpPanes[0]->SetVisible(bVis[0]);
mpPanes[1]->SetVisible(bVis[1]);
mpPanes[2]->SetVisible(bVis[2]);
for (int i = 0; i < 3; ++i) {
mpPanes[i]->SetVisible(bVis[i]);
};
}
void dLytMsgWindowTalk_c::open(dAcObjBase_c *obj, u32 param) {
+5
View File
@@ -0,0 +1,5 @@
#include "toBeSorted/d_flow_mgr.h"
dFlowMgrBase_c::dFlowMgrBase_c(dFlow_c *flow): mpFlow(flow) {}
dFlowMgr_c::dFlowMgr_c() : dFlowMgrBase_c(&mFlow) {}
+2 -1
View File
@@ -404,7 +404,8 @@ void FiContext::prepareFiCallOptions() {
}
mFiButtonOptions[0] = KEN8_Advice;
if (dStageMgr_c::GetInstance()->getSTIFbyte4() == 0 && !isInAnySkyKeepRoom() && !isInLeviasFightMaybe()) {
if (dStageMgr_c::GetInstance()->getSTIFArea() == dStageMgr_c::STIF_AREA_SKY && !isInAnySkyKeepRoom() &&
!isInLeviasFightMaybe()) {
// In the Sky, show play time
mFiButtonOptions[1] = KEN8_PlayTime;
} else {