diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 0ce2157c..ff5d467b 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -426,6 +426,8 @@ toBeSorted/d_camera_event.cpp: .text start:0x80083370 end:0x800928F0 align:16 .ctors start:0x804DB6B0 end:0x804DB6B4 .data start:0x8050EA18 end:0x8050F180 + .sdata2 start:0x80579418 end:0x80579538 + .bss start:0x805A1660 end:0x805A2F18 toBeSorted/d_camera_map.cpp: .text start:0x800928F0 end:0x8009345C align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index c37f4213..b93183cd 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3307,21 +3307,21 @@ fn_80092890 = .text:0x80092890; // type:function size:0x60 __dt__16dCameraMap_HIO_cFv = .text:0x800928F0; // type:function size:0x40 __ct__16dCameraMap_HIO_cFv = .text:0x80092930; // type:function size:0x88 fn_800929C0__FRC7mVec3_cRC7mVec3_cP12dAcObjBase_c = .text:0x800929C0; // type:function size:0x1BC -fn_80092B80 = .text:0x80092B80; // type:function size:0x138 -fn_80092CC0 = .text:0x80092CC0; // type:function size:0x50 -fn_80092D10 = .text:0x80092D10; // type:function size:0x170 -fn_80092E80 = .text:0x80092E80; // type:function size:0x8 +onBecomeActive__12dCameraMap_cFv = .text:0x80092B80; // type:function size:0x138 +onBecomeInactive__12dCameraMap_cFv = .text:0x80092CC0; // type:function size:0x50 +create__12dCameraMap_cFv = .text:0x80092D10; // type:function size:0x170 +remove__12dCameraMap_cFv = .text:0x80092E80; // type:function size:0x8 execute__12dCameraMap_cFv = .text:0x80092E90; // type:function size:0x430 -fn_800932C0 = .text:0x800932C0; // type:function size:0x8 -fn_800932D0 = .text:0x800932D0; // type:function size:0x8 -fn_800932E0__12dCameraMap_cCFv = .text:0x800932E0; // type:function size:0x8 -fn_800932F0__12dCameraMap_cFv = .text:0x800932F0; // type:function size:0x4C +vt_0x34__12dCameraMap_cFv = .text:0x800932C0; // type:function size:0x8 +draw__12dCameraMap_cFv = .text:0x800932D0; // type:function size:0x8 +isActiveOrAnimating__12dCameraMap_cCFv = .text:0x800932E0; // type:function size:0x8 +startOut__12dCameraMap_cFv = .text:0x800932F0; // type:function size:0x4C fn_80093340__12dCameraMap_cFv = .text:0x80093340; // type:function size:0x14 -fn_80093360__12dCameraMap_cFv = .text:0x80093360; // type:function size:0x18 -fn_80093380__12dCameraMap_cFv = .text:0x80093380; // type:function size:0x18 +setNoCameraTransition__12dCameraMap_cFv = .text:0x80093360; // type:function size:0x18 +setCameraTransition__12dCameraMap_cFv = .text:0x80093380; // type:function size:0x18 setView__12dCameraMap_cFRC7CamView = .text:0x800933A0; // type:function size:0x64 -fn_80093410 = .text:0x80093410; // type:function size:0x40 -__sinit_\d_camera_map_cpp = .text:0x80093450; // type:function size:0xC +__dt__12dCameraMap_cFv = .text:0x80093410; // type:function size:0x40 scope:weak +__sinit_\d_camera_map_cpp = .text:0x80093450; // type:function size:0xC scope:local camEaseIn__Fff = .text:0x80093460; // type:function size:0x18C camEaseInOut__Fff = .text:0x800935F0; // type:function size:0xD8 camGetPointOnLine__FRC7mVec3_cRC7mVec3_cRC7mVec3_c = .text:0x800936D0; // type:function size:0xF4 @@ -7850,7 +7850,7 @@ canCenterCursor1__13dLytMapMain_cCFl = .text:0x8013AC00; // type:function size:0 setCursorType__13dLytMapMain_cFv = .text:0x8013AC10; // type:function size:0x138 fn_8013AD50__13dLytMapMain_cFv = .text:0x8013AD50; // type:function size:0x370 calculateBoundingWorldHitboxes__13dLytMapMain_cFv = .text:0x8013B0C0; // type:function size:0x28C -fn_8013B350 = .text:0x8013B350; // type:function size:0x10 +fn_8013B350__13dLytMapMain_cFv = .text:0x8013B350; // type:function size:0x10 initializeState_Invisible__13dLytMapMain_cFv = .text:0x8013B360; // type:function size:0x4 executeState_Invisible__13dLytMapMain_cFv = .text:0x8013B370; // type:function size:0x4 finalizeState_Invisible__13dLytMapMain_cFv = .text:0x8013B380; // type:function size:0x4 @@ -30963,7 +30963,7 @@ lbl_8050F004 = .data:0x8050F004; // type:object size:0x12C __vt__18dCameraEvent_HIO_c = .data:0x8050F130; // type:object size:0xC __vt__14dCameraEvent_c = .data:0x8050F13C; // type:object size:0x34 lbl_8050F170 = .data:0x8050F170; // type:object size:0x10 -__vt__16dCameraMap_HIO_c = .data:0x8050F180; // type:object size:0x10 +__vt__16dCameraMap_HIO_c = .data:0x8050F180; // type:object size:0xC __vt__12dCameraMap_c = .data:0x8050F190; // type:object size:0x38 lbl_8050F1C8 = .data:0x8050F1C8; // type:object size:0xA data:string lbl_8050F1D4 = .data:0x8050F1D4; // type:object size:0x9 data:string @@ -45180,29 +45180,29 @@ lbl_80579528 = .sdata2:0x80579528; // type:object size:0x4 align:4 data:float lbl_8057952C = .sdata2:0x8057952C; // type:object size:0x4 align:4 data:float lbl_80579530 = .sdata2:0x80579530; // type:object size:0x4 align:4 data:float lbl_80579534 = .sdata2:0x80579534; // type:object size:0x4 align:4 data:float -lbl_80579538 = .sdata2:0x80579538; // type:object size:0x4 align:4 data:float -lbl_8057953C = .sdata2:0x8057953C; // type:object size:0x4 align:4 data:float -lbl_80579540 = .sdata2:0x80579540; // type:object size:0x4 align:4 data:float -lbl_80579544 = .sdata2:0x80579544; // type:object size:0x4 align:4 data:float -lbl_80579548 = .sdata2:0x80579548; // type:object size:0x4 align:4 data:float -lbl_8057954C = .sdata2:0x8057954C; // type:object size:0x4 align:4 data:float -lbl_80579550 = .sdata2:0x80579550; // type:object size:0x4 align:4 data:float -lbl_80579554 = .sdata2:0x80579554; // type:object size:0x4 align:4 data:float -lbl_80579558 = .sdata2:0x80579558; // type:object size:0x4 align:4 data:float -lbl_8057955C = .sdata2:0x8057955C; // type:object size:0x4 align:4 data:float -lbl_80579560 = .sdata2:0x80579560; // type:object size:0x4 align:4 data:float -lbl_80579564 = .sdata2:0x80579564; // type:object size:0x4 align:4 data:float -lbl_80579568 = .sdata2:0x80579568; // type:object size:0x4 align:4 data:float -lbl_8057956C = .sdata2:0x8057956C; // type:object size:0x4 align:4 data:float -lbl_80579570 = .sdata2:0x80579570; // type:object size:0x4 align:4 data:float -lbl_80579574 = .sdata2:0x80579574; // type:object size:0x4 align:4 data:float -lbl_80579578 = .sdata2:0x80579578; // type:object size:0x4 align:4 data:float -lbl_8057957C = .sdata2:0x8057957C; // type:object size:0x4 align:4 data:float -lbl_80579580 = .sdata2:0x80579580; // type:object size:0x4 align:4 data:float -lbl_80579584 = .sdata2:0x80579584; // type:object size:0x4 align:4 data:float -lbl_80579588 = .sdata2:0x80579588; // type:object size:0x4 align:4 data:float -lbl_80579590 = .sdata2:0x80579590; // type:object size:0x8 align:8 data:double -lbl_80579598 = .sdata2:0x80579598; // type:object size:0x4 align:4 data:float +@28181 = .sdata2:0x80579538; // type:object size:0x4 scope:local align:4 data:float +@28182 = .sdata2:0x8057953C; // type:object size:0x4 scope:local align:4 data:float +@28183 = .sdata2:0x80579540; // type:object size:0x4 scope:local align:4 data:float +@28184 = .sdata2:0x80579544; // type:object size:0x4 scope:local align:4 data:float +@28185 = .sdata2:0x80579548; // type:object size:0x4 scope:local align:4 data:float +@28186 = .sdata2:0x8057954C; // type:object size:0x4 scope:local align:4 data:float +@28187 = .sdata2:0x80579550; // type:object size:0x4 scope:local align:4 data:float +@28188 = .sdata2:0x80579554; // type:object size:0x4 scope:local align:4 data:float +@28189 = .sdata2:0x80579558; // type:object size:0x4 scope:local align:4 data:float +@28190 = .sdata2:0x8057955C; // type:object size:0x4 scope:local align:4 data:float +@28191 = .sdata2:0x80579560; // type:object size:0x4 scope:local align:4 data:float +@28192 = .sdata2:0x80579564; // type:object size:0x4 scope:local align:4 data:float +@28243 = .sdata2:0x80579568; // type:object size:0x4 scope:local align:4 data:float +@28244 = .sdata2:0x8057956C; // type:object size:0x4 scope:local align:4 data:float +@28283 = .sdata2:0x80579570; // type:object size:0x4 scope:local align:4 data:float +@28337 = .sdata2:0x80579574; // type:object size:0x4 scope:local align:4 data:float +@28338 = .sdata2:0x80579578; // type:object size:0x4 scope:local align:4 data:float +@28339 = .sdata2:0x8057957C; // type:object size:0x4 scope:local align:4 data:float +@28340 = .sdata2:0x80579580; // type:object size:0x4 scope:local align:4 data:float +@28414 = .sdata2:0x80579584; // type:object size:0x4 scope:local align:4 data:float +@28415 = .sdata2:0x80579588; // type:object size:0x4 scope:local align:4 data:float +@28418 = .sdata2:0x80579590; // type:object size:0x8 scope:local align:8 data:double +@28432 = .sdata2:0x80579598; // type:object size:0x4 scope:local align:4 data:float lbl_805795A0 = .sdata2:0x805795A0; // type:object size:0x8 align:8 data:double lbl_805795A8 = .sdata2:0x805795A8; // type:object size:0x8 align:8 data:double lbl_805795B0 = .sdata2:0x805795B0; // type:object size:0x4 align:4 data:float diff --git a/configure.py b/configure.py index 5c9aa610..b686b70b 100644 --- a/configure.py +++ b/configure.py @@ -487,7 +487,7 @@ config.libs = [ Object(NonMatching, "toBeSorted/d_camera_base.cpp"), Object(NonMatching, "toBeSorted/d_camera_game.cpp"), Object(NonMatching, "toBeSorted/d_camera_event.cpp"), - Object(NonMatching, "toBeSorted/d_camera_map.cpp"), + Object(Matching, "toBeSorted/d_camera_map.cpp"), Object(NonMatching, "toBeSorted/d_camera_math.cpp"), Object(NonMatching, "toBeSorted/attention.cpp"), Object(NonMatching, "toBeSorted/d_t_camera.cpp"), diff --git a/include/d/d_camera.h b/include/d/d_camera.h index 7c27f8c9..50a86f1d 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -197,10 +197,6 @@ private: /* 0x728 */ dCameraGame_c mGameCam2; /* 0xB9C */ dCameraEvent_c mEventCam; /* 0xCD0 */ dCameraMap_c mMapCam; - - /* 0xD8C */ u8 _0xD8C[0xD94 - 0xD8C]; - - /* 0xD94 */ f32 field_0xD94; /* 0xD98 */ dCameraBase_c *mpCameras[CAM_MAX]; /* 0xDA8 */ s32 mActiveCameraIdx; /* 0xDAC */ screen_shaker mScreenShaker; diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 69289ffd..30ec9379 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -587,6 +587,7 @@ public: void queueMapEvent(s32 mapEvent, s32 surfaceProvince, s32 c); void startMapEvent(s32 mapEvent, s32 surfaceProvince, s32 c); bool isVisibleNoIntro() const; + void fn_8013B350(); const dMapSaveObjDefinition *getSaveObjDefinition(s32 province, s32 statueIdx) const; @@ -836,7 +837,7 @@ private: /* 0x8C84 */ u8 field_0x8C84; /* 0x8C88 */ f32 field_0x8C88; - /* 0x8C8C */ f32 field_0x8C8C; + /* 0x8C8C */ f32 mOutDuration; /* 0x8C90 */ bool mMapUpDirection; /* 0x8C91 */ bool mNextMapUpDirection; /* 0x8C92 */ bool mMapUpDirectionAfterZoomToDetail; @@ -850,7 +851,7 @@ private: /* 0x8CA8 */ s32 mNextMapMode; /* 0x8CAC */ u8 field_0x8CAC; - /* 0x8CAD */ bool mDoCameraTransition; + /* 0x8CAD */ bool mCameraTransitionPossible; /* 0x8CAE */ bool field_0x8CAE; /* 0x8CB0 */ u32 mEventTimer; @@ -958,6 +959,14 @@ public: return mMapMain.isVisibleNoIntro(); } + void doFn_8013B350() { + mMapMain.fn_8013B350(); + } + + f32 getOutDuration() const { + return mMapMain.mOutDuration; + } + bool build(); bool remove(); bool execute(); diff --git a/include/toBeSorted/d_camera_map.h b/include/toBeSorted/d_camera_map.h index 4a0f2633..cd78c839 100644 --- a/include/toBeSorted/d_camera_map.h +++ b/include/toBeSorted/d_camera_map.h @@ -1,13 +1,15 @@ #ifndef TO_BE_SORTED_D_CAMERA_MAP_H #define TO_BE_SORTED_D_CAMERA_MAP_H +#include "common.h" +#include "m/m_vec.h" #include "toBeSorted/d_camera_base.h" class dAcObjBase_c; class dCameraMap_c : public dCameraBase_c { public: - dCameraMap_c() {} + dCameraMap_c() : field_0xC4(0.0f) {} /* vt 0x08 */ virtual void onBecomeActive() override; /* vt 0x0C */ virtual void onBecomeInactive() override; /* vt 0x10 */ virtual bool create() override; @@ -17,29 +19,30 @@ public: /* vt 0x20 */ virtual ~dCameraMap_c() {} /* vt 0x30 */ virtual void setView(const CamView &view) override; // Not sure what this is... - /* vt 0x34 */ virtual bool vt_0x34() { - return true; - } + /* vt 0x34 */ virtual bool vt_0x34(); void fn_80093340(); - void fn_80093360(); - void fn_80093380(); - bool fn_800932E0() const; - void fn_800932F0(); + void setNoCameraTransition(); + void setCameraTransition(); + bool isActiveOrAnimating() const; + void startOut(); private: - /* 0x2C */ u8 _0x2C[0x40 - 0x2C]; + /* 0x2C */ mVec3_c field_0x2C; + /* 0x38 */ f32 field_0x38; + /* 0x3C */ f32 field_0x3C; /* 0x40 */ f32 field_0x40; /* 0x44 */ dAcObjBase_c *field_0x44; /* 0x48 */ CamView mView1; /* 0x68 */ CamView mSourceView; /* 0x88 */ CamView mTargetView; /* 0xA8 */ u8 _0xA8[0xAC - 0xA8]; - /* 0xAC */ u8 field_0xAC; - /* 0xAD */ u8 _0xAD[0xB4 - 0xAD]; - /* 0xB4 */ u8 field_0xB4; - /* 0xB5 */ u8 _0xB5[0xB8 - 0xB5]; - /* 0xB8 */ UNKWORD field_0xB8; + /* 0xAC */ bool mIsMovingOut; + /* 0xB0 */ UNKWORD field_0xB0; + /* 0xB4 */ bool mIsActiveOrAnimating; + /* 0xB8 */ s32 mTimer; + /* 0xBC */ u8 _0xBC[0xC4 - 0xBC]; + /* 0xC4 */ f32 field_0xC4; }; #endif diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 589d8c8a..59a5bdc1 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -72,7 +72,6 @@ dCamera_c::dCamera_c() mpScreen(dStageMgr_c::GetInstance()->getScreen(0)), mYAngle(0), mXZAngle(0), - field_0xD94(0.0f), field_0x1F8(0), field_0x1FC(0), mFlags(0) { @@ -90,10 +89,10 @@ int dCamera_c::create() { mFlags = 0; mMyCameraIndex = getFromParams(0, 0xF); dScGame_c::setCamera(mMyCameraIndex, nullptr); - mpCameras[0] = &mGameCam1; - mpCameras[1] = &mGameCam2; - mpCameras[2] = &mEventCam; - mpCameras[3] = &mMapCam; + mpCameras[CAM_GAME_0] = &mGameCam1; + mpCameras[CAM_GAME_1] = &mGameCam2; + mpCameras[CAM_EVENT] = &mEventCam; + mpCameras[CAM_MAP] = &mMapCam; for (int i = 0; i < CAM_MAX; i++) { if (mpCameras[i] == nullptr) { @@ -263,7 +262,7 @@ void dCamera_c::checkCameraChange() { offFlag(CAM_FLAGS_0x4); } - if (checkFlag(CAM_FLAGS_MAP) && mActiveCameraIdx == CAM_MAP && !mMapCam.fn_800932E0()) { + if (checkFlag(CAM_FLAGS_MAP) && mActiveCameraIdx == CAM_MAP && !mMapCam.isActiveOrAnimating()) { offFlag(CAM_FLAGS_MAP); onFlag(CAM_FLAGS_0x4); getGameCam1()->onFlag(0x10000); @@ -430,7 +429,7 @@ void dCamera_c::enterMap() { void dCamera_c::leaveMap() { if (checkFlag(CAM_FLAGS_MAP)) { - mMapCam.fn_800932F0(); + mMapCam.startOut(); } } diff --git a/src/d/lyt/d_lyt_map.cpp b/src/d/lyt/d_lyt_map.cpp index 8357b510..6b268ef5 100644 --- a/src/d/lyt/d_lyt_map.cpp +++ b/src/d/lyt/d_lyt_map.cpp @@ -2224,7 +2224,7 @@ static const char *sPriorityGroupNames[] = { }; void dLytMapMain_c::build() { - mIsVisible = 0; + mIsVisible = false; field_0x8DB0 = 0; if (dScGame_c::isCurrentStage("F102")) { // awesome but unnecessary @@ -2359,7 +2359,7 @@ void dLytMapMain_c::build() { mAnmGroups[MAP_MAIN_ANIM_IN].unbind(); mAnmGroups[MAP_MAIN_ANIM_OUT].bind(false); - field_0x8C8C = mAnmGroups[MAP_MAIN_ANIM_OUT].getLastFrame(); + mOutDuration = mAnmGroups[MAP_MAIN_ANIM_OUT].getLastFrame(); mAnmGroups[MAP_MAIN_ANIM_OUT].unbind(); field_0x8CAC = 0; mDisplayedBeaconCount = getMaxBeaconCount(); @@ -3182,18 +3182,17 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { } mMarkers.setLinkRot(link->getRotation()); - // TODO - mAng nonsense? field_0x8D68 = dScGame_c::getCamera(0)->getXZAngle(); mpAllPane->SetVisible(false); getGlobal()->setField_0x55(field_0x8CAE); - mDoCameraTransition = false; + mCameraTransitionPossible = false; switch (event) { case MAP_EVENT_NONE: { if (mRoomType != ROOMTYPE_BOSS_HOUSE && mRoomType != ROOMTYPE_SKYFIELD_INTERIOR && field_0x8CAE) { mCurrentMapMode = dLytMapGlobal_c::MAPMODE_ZOOM; mNextMapMode = mCurrentMapMode; mMapUpDirection = false; - mDoCameraTransition = true; + mCameraTransitionPossible = true; } else { if (!sSavedMapData.entries[mRoomType].isValid) { if (MinigameManager::isInMinigameState(MinigameManager::SPIRAL_CHARGE_TUTORIAL)) { @@ -3201,7 +3200,7 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { fn_80142C80(mCurrentMapMode); // TODO - regswap (???) mMapUpDirection = false; - mDoCameraTransition = true; + mCameraTransitionPossible = true; } else { loadMapState(); if (mRoomType == ROOMTYPE_SKYFIELD) { @@ -3212,21 +3211,21 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { mMapUpDirection = true; } if (mMapUpDirection == false) { - mDoCameraTransition = true; + mCameraTransitionPossible = true; } } } else { loadMapState(); if (mMapUpDirection == false) { - mDoCameraTransition = true; + mCameraTransitionPossible = true; } } if (link->checkActionFlags(daPlayerActBase_c::FLG0_CRAWLING)) { - mDoCameraTransition = false; + mCameraTransitionPossible = false; } } if (mRoomType == ROOMTYPE_DUNGEON) { - mDoCameraTransition = false; + mCameraTransitionPossible = false; } break; } @@ -3255,7 +3254,7 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { case 1: mCurrentMapMode = dLytMapGlobal_c::MAPMODE_ZOOM; break; } mMapUpDirection = true; - mDoCameraTransition = false; + mCameraTransitionPossible = false; break; } case MAP_EVENT_MAP_INTRO: { @@ -3265,7 +3264,7 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { mCurrentMapMode = dLytMapGlobal_c::MAPMODE_WORLD; } mMapUpDirection = true; - mDoCameraTransition = false; + mCameraTransitionPossible = false; break; } case MAP_EVENT_DUNGEON_MAP_GET: @@ -3278,20 +3277,20 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { case MAP_EVENT_SW_BANK_SMALL: { mCurrentMapMode = dLytMapGlobal_c::MAPMODE_STAGE; mMapUpDirection = true; - mDoCameraTransition = false; + mCameraTransitionPossible = false; break; } case MAP_EVENT_FIELD_MAP_CHANGE_5: case MAP_EVENT_FIELD_MAP_CHANGE_8: { mCurrentMapMode = dLytMapGlobal_c::MAPMODE_STAGE; mMapUpDirection = true; - mDoCameraTransition = false; + mCameraTransitionPossible = false; break; } case MAP_EVENT_SAVE_OBJ: { mCurrentMapMode = dLytMapGlobal_c::MAPMODE_PROVINCE; mMapUpDirection = true; - mDoCameraTransition = false; + mCameraTransitionPossible = false; break; } } @@ -3300,13 +3299,13 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { mNextMapMode = mCurrentMapMode; if (mCurrentMapMode == dLytMapGlobal_c::MAPMODE_WORLD || mCurrentMapMode == dLytMapGlobal_c::MAPMODE_PROVINCE || mCurrentMapMode == dLytMapGlobal_c::MAPMODE_WORLD_SKY) { - mDoCameraTransition = false; + mCameraTransitionPossible = false; } - if (mDoCameraTransition) { - dScGame_c::getCamera(0)->getMapCam()->fn_80093380(); + if (mCameraTransitionPossible) { + dScGame_c::getCamera(0)->getMapCam()->setCameraTransition(); } else { - dScGame_c::getCamera(0)->getMapCam()->fn_80093360(); + dScGame_c::getCamera(0)->getMapCam()->setNoCameraTransition(); dScGame_c::getCamera(0)->getMapCam()->fn_80093340(); } dScGame_c::getCamera(0)->enterMap(); @@ -3349,27 +3348,27 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { void dLytMapMain_c::close() { dBase_c::s_DrawControlFlags &= ~dBase_c::BASE_PROP_0x10; - mDoCameraTransition = false; + mCameraTransitionPossible = false; if (mMapEvent == MAP_EVENT_NONE) { if (mRoomType == ROOMTYPE_FIELD || mRoomType == ROOMTYPE_SKYLOFT) { if (!field_0x8CAE && !mMapUpDirection) { - mDoCameraTransition = true; + mCameraTransitionPossible = true; } } else if (mRoomType == ROOMTYPE_DUNGEON && !field_0x8CAE && !mMapUpDirection) { - mDoCameraTransition = false; + mCameraTransitionPossible = false; dScGame_c::getCamera(0)->getMapCam()->fn_80093340(); } } if (mCurrentMapMode == dLytMapGlobal_c::MAPMODE_WORLD || mCurrentMapMode == dLytMapGlobal_c::MAPMODE_PROVINCE || mCurrentMapMode == dLytMapGlobal_c::MAPMODE_WORLD_SKY) { - mDoCameraTransition = false; + mCameraTransitionPossible = false; } - if (mDoCameraTransition) { - dScGame_c::getCamera(0)->getMapCam()->fn_80093380(); + if (mCameraTransitionPossible) { + dScGame_c::getCamera(0)->getMapCam()->setCameraTransition(); } else { - dScGame_c::getCamera(0)->getMapCam()->fn_80093360(); + dScGame_c::getCamera(0)->getMapCam()->setNoCameraTransition(); } if (mMapEvent == MAP_EVENT_NONE) { @@ -4088,6 +4087,10 @@ void dLytMapMain_c::setupFlags() { } } +void dLytMapMain_c::fn_8013B350() { + field_0x8C84 = 1; +} + void dLytMapMain_c::initializeState_In() { if (mMapEvent == MAP_EVENT_SAVE_OBJ) { displaySaveObjs(); @@ -4096,7 +4099,7 @@ void dLytMapMain_c::initializeState_In() { } } - if (mDoCameraTransition || mMapEvent == MAP_EVENT_MAP_INTRO) { + if (mCameraTransitionPossible || mMapEvent == MAP_EVENT_MAP_INTRO) { mpInOutAnmGroup = &mAnmGroups[MAP_MAIN_ANIM_IN]; } else { mpInOutAnmGroup = &mAnmGroups[MAP_MAIN_ANIM_IN_NO_CAM]; @@ -4108,10 +4111,11 @@ void dLytMapMain_c::initializeState_In() { mPinIconAggregate.setScale(getGlobal()->getZoomFrame()); } void dLytMapMain_c::executeState_In() { - mIsVisible = 1; + mIsVisible = true; dLytMapGlobal_c *global = getGlobal(); - if ((!mDoCameraTransition || !field_0x8C84) && mDoCameraTransition) { + // ??? + if ((!mCameraTransitionPossible || !field_0x8C84) && mCameraTransitionPossible) { return; } @@ -4596,7 +4600,7 @@ void dLytMapMain_c::initializeState_Out() { mPopupInfo.mStateMgr.changeState(StateID_Out); } dLytMeter_c::GetInstance()->setMeterMode(dLytMeterMain_c::MODE_MAP_INIT); - if (mDoCameraTransition || mMapEvent == MAP_EVENT_MAP_INTRO) { + if (mCameraTransitionPossible || mMapEvent == MAP_EVENT_MAP_INTRO) { mpInOutAnmGroup = &mAnmGroups[MAP_MAIN_ANIM_OUT]; } else { mpInOutAnmGroup = &mAnmGroups[MAP_MAIN_ANIM_OUT_NO_CAM]; @@ -4604,7 +4608,7 @@ void dLytMapMain_c::initializeState_Out() { mpInOutAnmGroup->bind(false); mpInOutAnmGroup->setFrame(0.0f); - field_0x8C8C = mpInOutAnmGroup->getLastFrame(); + mOutDuration = mpInOutAnmGroup->getLastFrame(); if (fn_80141530()) { dBase_c::s_NextExecuteControlFlags &= ~dBase_c::BASE_PROP_0x10; @@ -4620,7 +4624,7 @@ void dLytMapMain_c::executeState_Out() { dBase_c::s_NextExecuteControlFlags &= ~dBase_c::BASE_PROP_0x10; mLyt.calc(); mpInOutAnmGroup->unbind(); - mIsVisible = 0; + mIsVisible = false; mStateMgr.changeState(StateID_Invisible); } } @@ -5047,7 +5051,7 @@ void dLytMapMain_c::forceOut() { mAnmGroups[MAP_MAIN_ANIM_OUT].unbind(); dBase_c::s_NextExecuteControlFlags &= ~dBase_c::BASE_PROP_0x10; dBase_c::s_DrawControlFlags &= ~dBase_c::BASE_PROP_0x10; - dScGame_c::getCamera(0)->getMapCam()->fn_80093360(); + dScGame_c::getCamera(0)->getMapCam()->setNoCameraTransition(); dScGame_c::getCamera(0)->leaveMap(); mStateMgr.changeState(StateID_Invisible); } diff --git a/src/toBeSorted/d_camera_map.cpp b/src/toBeSorted/d_camera_map.cpp index 81e80eec..7adec892 100644 --- a/src/toBeSorted/d_camera_map.cpp +++ b/src/toBeSorted/d_camera_map.cpp @@ -6,6 +6,8 @@ #include "d/col/bg/d_bg_s.h" #include "d/col/bg/d_bg_s_lin_chk.h" #include "d/col/cc/d_cc_s.h" +#include "d/d_sc_game.h" +#include "d/lyt/d_lyt_map.h" #include "m/m_vec.h" #include "toBeSorted/d_camera_math.h" #include "toBeSorted/deg_angle_util.h" @@ -86,12 +88,67 @@ mVec3_c fn_800929C0(const mVec3_c &p2, const mVec3_c &p3, dAcObjBase_c *obj) { return ret; } -bool dCameraMap_c::execute() { - s16 unk = sHio.field_0x28; +void dCameraMap_c::onBecomeActive() { + mTimer = 0; + mSourceView = mView; + mTargetView = mView; + if (!(sHio.field_0x3C & 0x100)) { + mTargetView.mPosition = mTargetView.mTarget; + } + mTargetView.mPosition.y += sHio.field_0x08; + mTargetView.mFov = sHio.field_0x24; + mTargetView.mTilt = 0.0f; + dLytMap_c::GetInstance()->doFn_8013B350(); + dPolar polar(mView.mPosition - mView.mTarget); + field_0xC4 = polar.V.value; + mIsMovingOut = false; + mIsActiveOrAnimating = true; +} - if ((sHio.field_0x3C & 0x200) && field_0xAC) { +void dCameraMap_c::onBecomeInactive() { + mIsMovingOut = true; + dScGame_c::getCamera()->getGameCam1()->setView(mView); +} + +bool dCameraMap_c::create() { + dAcPy_c *link = dAcPy_c::GetLinkM(); + if (link == nullptr) { + return false; + } + + field_0x44 = link; + mView.mTarget = link->mPosition + mVec3_c(0.0f, 100.0f, 0.0f); + + mVec3_c v(0.0f, 200.0f, 500.0f); + v.rotY(link->mRotation.y - 0x8000); + + mView.mPosition = mView.mTarget + v; + mView.mFov = 55.0f; + mView1 = mView; + + field_0x3C = sHio.field_0x04; + field_0x40 = 0.0f; + field_0x38 = 0.0f; + + field_0x2C = mVec3_c::Zero; + mIsActiveOrAnimating = false; + mIsMovingOut = true; + field_0xB0 = 0; + mTimer = 0; + + return true; +} + +bool dCameraMap_c::remove() { + return true; +} + +bool dCameraMap_c::execute() { + s16 duration = sHio.field_0x28; + + if ((sHio.field_0x3C & 0x200) && mIsMovingOut) { // TODO no-op - unk = sHio.field_0x28; + duration = sHio.field_0x28; } field_0x40 = 1.0f; @@ -107,28 +164,29 @@ bool dCameraMap_c::execute() { if (sHio.field_0x3C & 0x10) { if (sHio.field_0x3E == 1) { + // Reorients the main camera to point to north when opening the map without a transition... unused dPolar polar(mSourceView.mPosition - mSourceView.mTarget); polar.V.Set(0.0f); mSourceView.mPosition = mSourceView.mTarget + polar.toCartesian(); } mTargetView = mSourceView; - field_0xB8 = 1; + mTimer = 1; } - if (field_0xAC != 0) { - if (field_0xB8 > 0) { - field_0xB8--; - if (field_0xB8 == 0) { - field_0xB4 = 0; + if (mIsMovingOut) { + if (mTimer > 0) { + mTimer--; + if (mTimer == 0) { + mIsActiveOrAnimating = false; } } } else { - if (field_0xB8 < unk) { - field_0xB8++; + if (mTimer < duration) { + mTimer++; } } - f32 f = (f32)field_0xB8 / (f32)unk; + f32 f = (f32)mTimer / (f32)duration; f32 f5 = camEaseInOut(f, sHio.field_0x2C); f32 f6 = camEaseInOut(f, sHio.field_0x30); f32 f8 = f5 * 0.99f; @@ -146,6 +204,37 @@ bool dCameraMap_c::execute() { return true; } +bool dCameraMap_c::vt_0x34() { + return true; +} + +bool dCameraMap_c::draw() { + return true; +} + +bool dCameraMap_c::isActiveOrAnimating() const { + return mIsActiveOrAnimating; +} + +void dCameraMap_c::startOut() { + mIsMovingOut = true; + if (sHio.field_0x3C & 0x200) { + mTimer = dLytMap_c::GetInstance()->getOutDuration() + 0.1f; + } +} + +void dCameraMap_c::fn_80093340() { + sHio.field_0x3E = 2; +} + +void dCameraMap_c::setNoCameraTransition() { + sHio.field_0x3C |= 0x10 | 0x8; +} + +void dCameraMap_c::setCameraTransition() { + sHio.field_0x3C &= ~(0x10 | 0x8); +} + void dCameraMap_c::setView(const CamView &view) { mView1 = view; mView = view;