From ac48f9877b3918e2c41557fad76c37563678643e Mon Sep 17 00:00:00 2001 From: robojumper Date: Tue, 6 Jan 2026 21:05:51 +0100 Subject: [PATCH] d_camera OK --- config/SOUE01/symbols.txt | 94 +++++++++++++-------------- configure.py | 2 +- include/d/d_camera.h | 28 +++++++- include/toBeSorted/d_camera_base.h | 9 +-- include/toBeSorted/d_camera_event.h | 4 +- include/toBeSorted/d_camera_game.h | 14 +++- include/toBeSorted/d_camera_map.h | 6 +- src/REL/d/a/b/d_a_b_lastboss.cpp | 2 +- src/d/d_camera.cpp | 99 +++++++++++++++++++++++++---- src/d/lyt/d_lyt_map.cpp | 6 +- src/toBeSorted/d_camera_base.cpp | 16 ++--- src/toBeSorted/d_camera_game.cpp | 8 +-- 12 files changed, 198 insertions(+), 90 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index dd0d2ae4..c37f4213 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3066,11 +3066,11 @@ entry__16dEnemySwordMdl_cFP12dAcObjBase_cP15dShadowCircle_cP7mQuat_c = .text:0x8 doCreate__13dCameraBase_cFl = .text:0x8006BBE0; // type:function size:0x70 doRemove__13dCameraBase_cFv = .text:0x8006BC50; // type:function size:0x18 doExecute__13dCameraBase_cFv = .text:0x8006BC70; // type:function size:0xA8 -vt_0x0C__13dCameraBase_cFv = .text:0x8006BD20; // type:function size:0x4 +onBecomeActive__13dCameraBase_cFv = .text:0x8006BD20; // type:function size:0x4 doDraw__13dCameraBase_cFv = .text:0x8006BD30; // type:function size:0x24 setView__13dCameraBase_cFRC7CamView = .text:0x8006BD60; // type:function size:0x44 deactivate__13dCameraBase_cFv = .text:0x8006BDB0; // type:function size:0xC -dactivate__13dCameraBase_cFv = .text:0x8006BDC0; // type:function size:0xC +activate__13dCameraBase_cFv = .text:0x8006BDC0; // type:function size:0xC getView__13dCameraBase_cFv = .text:0x8006BDD0; // type:function size:0x8 __dt__7CamViewFv = .text:0x8006BDE0; // type:function size:0x40 __dt__17dCameraGame_HIO_cFv = .text:0x8006BE20; // type:function size:0x40 @@ -3179,7 +3179,7 @@ doModeChange = .text:0x80081E90; // type:function size:0xEC doStyleChange = .text:0x80081F80; // type:function size:0x58 isCurrentTrend__13dCameraGame_cCFPCc = .text:0x80081FE0; // type:function size:0x40 setView__13dCameraGame_cFRC7CamView = .text:0x80082020; // type:function size:0xB4 -vt_0x08__13dCameraGame_cFv = .text:0x800820E0; // type:function size:0xC8 +onBecomeActive__13dCameraGame_cFv = .text:0x800820E0; // type:function size:0xC8 fn_800821B0 = .text:0x800821B0; // type:function size:0xC0 fn_80082270 = .text:0x80082270; // type:function size:0x44 fn_800822C0 = .text:0x800822C0; // type:function size:0x10 @@ -3314,8 +3314,8 @@ fn_80092E80 = .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 = .text:0x800932E0; // type:function size:0x8 -fn_800932F0 = .text:0x800932F0; // type:function size:0x4C +fn_800932E0__12dCameraMap_cCFv = .text:0x800932E0; // type:function size:0x8 +fn_800932F0__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 @@ -10711,22 +10711,22 @@ debugPrintf7__FPCce = .text:0x8019D720; // type:function size:0x50 doDelete__9dCamera_cFv = .text:0x8019D770; // type:function size:0x78 setWorldOffset__9dCamera_cFff = .text:0x8019D7F0; // type:function size:0xA0 execute__9dCamera_cFv = .text:0x8019D890; // type:function size:0x2E8 -fn_8019DB80__9dCamera_cFv = .text:0x8019DB80; // type:function size:0x158 +checkCameraChange__9dCamera_cFv = .text:0x8019DB80; // type:function size:0x158 updateView__9dCamera_cFv = .text:0x8019DCE0; // type:function size:0x140 draw__9dCamera_cFv = .text:0x8019DE20; // type:function size:0x3C isUnderwater__9dCamera_cCFv = .text:0x8019DE60; // type:function size:0xC apply__9dCamera_cFv = .text:0x8019DE70; // type:function size:0x2A4 setActiveCamera__9dCamera_cFl = .text:0x8019E120; // type:function size:0xC4 -fn_8019E1F0__9dCamera_cFv = .text:0x8019E1F0; // type:function size:0x10 +getEventLetterboxAmount__9dCamera_cFv = .text:0x8019E1F0; // type:function size:0x10 setFrustum__9dCamera_cFfff = .text:0x8019E200; // type:function size:0x18C getYAngle__9dCamera_cCFv = .text:0x8019E390; // type:function size:0xC getYRot__9dCamera_cCFv = .text:0x8019E3A0; // type:function size:0x8 getXZAngle__9dCamera_cCFv = .text:0x8019E3B0; // type:function size:0xC -fn_8019E3C0 = .text:0x8019E3C0; // type:function size:0x44 -fn_8019E410__9dCamera_cFv = .text:0x8019E410; // type:function size:0x1C -fn_8019E430__9dCamera_cFv = .text:0x8019E430; // type:function size:0x18 +fn_8019E3C0__9dCamera_cCFv = .text:0x8019E3C0; // type:function size:0x44 +enterMap__9dCamera_cFv = .text:0x8019E410; // type:function size:0x1C +leaveMap__9dCamera_cFv = .text:0x8019E430; // type:function size:0x18 applyTilt__9dCamera_cFv = .text:0x8019E450; // type:function size:0x7C -fn_8019E4D0 = .text:0x8019E4D0; // type:function size:0x5C +fn_8019E4D0__9dCamera_cCFv = .text:0x8019E4D0; // type:function size:0x5C updateUnderwaterDepth__9dCamera_cFRC7mVec3_c = .text:0x8019E530; // type:function size:0x130 isUnderwater___9dCamera_cCFv = .text:0x8019E660; // type:function size:0x8 getUnderwaterDepth__9dCamera_cCFv = .text:0x8019E670; // type:function size:0x8 @@ -10737,11 +10737,11 @@ fn_8019E890__Q29dCamera_c11substruct_1Fv = .text:0x8019E890; // type:function si fn_8019E8D0__Q29dCamera_c11substruct_1FRC4mAng = .text:0x8019E8D0; // type:function size:0x54 fn_8019E930__Q29dCamera_c11substruct_1CFv = .text:0x8019E930; // type:function size:0xC fn_8019E940__Q29dCamera_c11substruct_1Fv = .text:0x8019E940; // type:function size:0xC0 -fn_8019EA00__9dCamera_cFRC7mVec3_cRC7mVec3_cff = .text:0x8019EA00; // type:function size:0x70 +setEventCamView__9dCamera_cFRC7mVec3_cRC7mVec3_cff = .text:0x8019EA00; // type:function size:0x70 fn_8019EA70__9dCamera_cFb = .text:0x8019EA70; // type:function size:0x11C -fn_8019EB90 = .text:0x8019EB90; // type:function size:0xC -__dt__9dCamera_cFv = .text:0x8019EBA0; // type:function size:0x160 -__sinit_\d_camera_cpp = .text:0x8019ED00; // type:function size:0xC +fn_8019EB90__9dCamera_cFv = .text:0x8019EB90; // type:function size:0xC +__dt__9dCamera_cFv = .text:0x8019EBA0; // type:function size:0x160 scope:weak +__sinit_\d_camera_cpp = .text:0x8019ED00; // type:function size:0xC scope:local GetInstance__11dObjLight_cFv = .text:0x8019ED10; // type:function size:0x8 ObjLight__ctor = .text:0x8019ED20; // type:function size:0x30 spawnLightObject = .text:0x8019ED50; // type:function size:0x40 @@ -35626,12 +35626,12 @@ lbl_8052C0F0 = .data:0x8052C0F0; // type:object size:0x38 g_profile_LAST = .data:0x8052C128; // type:object size:0xC AcLast__vtable = .data:0x8052C134; // type:object size:0x4C g_profile_CAMERA = .data:0x8052C180; // type:object size:0xC -lbl_8052C18C = .data:0x8052C18C; // type:object size:0x1D data:string -lbl_8052C1AC = .data:0x8052C1AC; // type:object size:0xC data:string -lbl_8052C1B8 = .data:0x8052C1B8; // type:object size:0x9 data:string -lbl_8052C1C4 = .data:0x8052C1C4; // type:object size:0xE data:string -lbl_8052C1D4 = .data:0x8052C1D4; // type:object size:0xC -__vt__9dCamera_c = .data:0x8052C1E0; // type:object size:0x50 +@28488 = .data:0x8052C18C; // type:object size:0x1D scope:local data:string +@28490 = .data:0x8052C1AC; // type:object size:0xC scope:local data:string +@28503 = .data:0x8052C1B8; // type:object size:0x9 scope:local data:string +@28766 = .data:0x8052C1C4; // type:object size:0xE scope:local data:string +__vt__13dCamera_HIO_c = .data:0x8052C1D4; // type:object size:0xC +__vt__9dCamera_c = .data:0x8052C1E0; // type:object size:0x4C g_profile_LIGHT_OBJECT = .data:0x8052C230; // type:object size:0xC jumptable_8052C23C = .data:0x8052C23C; // type:object size:0x2C scope:local jumptable_8052C268 = .data:0x8052C268; // type:object size:0x24 scope:local @@ -40712,10 +40712,10 @@ lbl_80572E84 = .sdata:0x80572E84; // type:object size:0x5 data:string lbl_80572E8C = .sdata:0x80572E8C; // type:object size:0x5 data:string lbl_80572E94 = .sdata:0x80572E94; // type:object size:0x7 data:string lbl_80572E9C = .sdata:0x80572E9C; // type:object size:0x4 -lbl_80572EA0 = .sdata:0x80572EA0; // type:object size:0x4 data:4byte -lbl_80572EA4 = .sdata:0x80572EA4; // type:object size:0x4 data:4byte -lbl_80572EA8 = .sdata:0x80572EA8; // type:object size:0x5 data:string -lbl_80572EB0 = .sdata:0x80572EB0; // type:object size:0x8 data:string +@26678 = .sdata:0x80572EA0; // type:object size:0x4 scope:local data:4byte +@26679 = .sdata:0x80572EA4; // type:object size:0x4 scope:local data:4byte +@28489 = .sdata:0x80572EA8; // type:object size:0x5 scope:local data:string +@28606 = .sdata:0x80572EB0; // type:object size:0x8 scope:local data:string lbl_80572EB8 = .sdata:0x80572EB8; // type:object size:0x5 data:string lbl_80572EC0 = .sdata:0x80572EC0; // type:object size:0x5 data:string lbl_80572EC8 = .sdata:0x80572EC8; // type:object size:0x6 data:string @@ -42401,7 +42401,7 @@ lbl_805756FE = .sbss:0x805756FE; // type:object size:0x1 data:byte lbl_805756FF = .sbss:0x805756FF; // type:object size:0x1 data:byte lbl_80575700 = .sbss:0x80575700; // type:object size:0x4 data:4byte lbl_80575704 = .sbss:0x80575704; // type:object size:0x4 data:4byte -lbl_80575708 = .sbss:0x80575708; // type:object size:0x8 data:4byte +@LOCAL@execute__Q29dCamera_c13screen_shakerFv@upOrDown = .sbss:0x80575708; // type:object size:0x4 scope:local data:4byte LIGHT_OBJECT = .sbss:0x80575710; // type:object size:0x4 data:4byte lbl_80575714 = .sbss:0x80575714; // type:object size:0x1 data:byte lbl_80575715 = .sbss:0x80575715; // type:object size:0x1 data:byte @@ -47131,26 +47131,26 @@ lbl_8057AF3C = .sdata2:0x8057AF3C; // type:object size:0x4 align:4 data:float lbl_8057AF40 = .sdata2:0x8057AF40; // type:object size:0x4 align:4 data:float lbl_8057AF44 = .sdata2:0x8057AF44; // type:object size:0x4 align:4 data:float lbl_8057AF48 = .sdata2:0x8057AF48; // type:object size:0x4 align:4 data:float -lbl_8057AF50 = .sdata2:0x8057AF50; // type:object size:0x4 align:4 data:float -lbl_8057AF54 = .sdata2:0x8057AF54; // type:object size:0x4 align:4 data:float -lbl_8057AF58 = .sdata2:0x8057AF58; // type:object size:0x4 align:4 data:float -lbl_8057AF5C = .sdata2:0x8057AF5C; // type:object size:0x4 align:4 data:float -lbl_8057AF60 = .sdata2:0x8057AF60; // type:object size:0x4 align:4 data:float -lbl_8057AF64 = .sdata2:0x8057AF64; // type:object size:0x4 align:4 data:float -lbl_8057AF68 = .sdata2:0x8057AF68; // type:object size:0x4 align:4 data:float -lbl_8057AF6C = .sdata2:0x8057AF6C; // type:object size:0x4 align:4 data:float -lbl_8057AF70 = .sdata2:0x8057AF70; // type:object size:0x4 align:4 data:float -lbl_8057AF74 = .sdata2:0x8057AF74; // type:object size:0x4 align:4 data:float -lbl_8057AF78 = .sdata2:0x8057AF78; // type:object size:0x4 align:4 data:float -lbl_8057AF80 = .sdata2:0x8057AF80; // type:object size:0x8 align:8 data:double -lbl_8057AF88 = .sdata2:0x8057AF88; // type:object size:0x4 align:4 data:float -lbl_8057AF8C = .sdata2:0x8057AF8C; // type:object size:0x4 align:4 data:float -lbl_8057AF90 = .sdata2:0x8057AF90; // type:object size:0x4 align:4 data:float -lbl_8057AF94 = .sdata2:0x8057AF94; // type:object size:0x4 align:4 data:float -lbl_8057AF98 = .sdata2:0x8057AF98; // type:object size:0x4 align:4 data:float -lbl_8057AF9C = .sdata2:0x8057AF9C; // type:object size:0x4 align:4 data:float -lbl_8057AFA0 = .sdata2:0x8057AFA0; // type:object size:0x4 align:4 data:float -lbl_8057AFA4 = .sdata2:0x8057AFA4; // type:object size:0x4 align:4 data:float +@28173 = .sdata2:0x8057AF50; // type:object size:0x4 scope:local align:4 data:float +@28174 = .sdata2:0x8057AF54; // type:object size:0x4 scope:local align:4 data:float +@28175 = .sdata2:0x8057AF58; // type:object size:0x4 scope:local align:4 data:float +@28176 = .sdata2:0x8057AF5C; // type:object size:0x4 scope:local align:4 data:float +@28177 = .sdata2:0x8057AF60; // type:object size:0x4 scope:local align:4 data:float +@28178 = .sdata2:0x8057AF64; // type:object size:0x4 scope:local align:4 data:float +@28383 = .sdata2:0x8057AF68; // type:object size:0x4 scope:local align:4 data:float +@28384 = .sdata2:0x8057AF6C; // type:object size:0x4 scope:local align:4 data:float +@28385 = .sdata2:0x8057AF70; // type:object size:0x4 scope:local align:4 data:float +@28568 = .sdata2:0x8057AF74; // type:object size:0x4 scope:local align:4 data:float +@28569 = .sdata2:0x8057AF78; // type:object size:0x4 scope:local align:4 data:float +@28572 = .sdata2:0x8057AF80; // type:object size:0x8 scope:local align:8 data:double +@28883 = .sdata2:0x8057AF88; // type:object size:0x4 scope:local align:4 data:float +@28884 = .sdata2:0x8057AF8C; // type:object size:0x4 scope:local align:4 data:float +@28885 = .sdata2:0x8057AF90; // type:object size:0x4 scope:local align:4 data:float +@28925 = .sdata2:0x8057AF94; // type:object size:0x4 scope:local align:4 data:float +@28926 = .sdata2:0x8057AF98; // type:object size:0x4 scope:local align:4 data:float +@28927 = .sdata2:0x8057AF9C; // type:object size:0x4 scope:local align:4 data:float +@28928 = .sdata2:0x8057AFA0; // type:object size:0x4 scope:local align:4 data:float +@28929 = .sdata2:0x8057AFA4; // type:object size:0x4 scope:local align:4 data:float lbl_8057AFA8 = .sdata2:0x8057AFA8; // type:object size:0x4 align:4 data:float lbl_8057AFAC = .sdata2:0x8057AFAC; // type:object size:0x4 align:4 data:float lbl_8057AFB0 = .sdata2:0x8057AFB0; // type:object size:0x4 align:4 data:float @@ -52223,7 +52223,7 @@ StageMgr__STATE_READ_OBJECT_SOUND = .bss:0x805B26B0; // type:object size:0x40 da StageMgr__STATE_SCENE_CHANGE_SAVE = .bss:0x805B26F0; // type:object size:0x40 data:4byte StageMgr__STATE_RESTART_SCENE_WAIT = .bss:0x805B2730; // type:object size:0x40 data:4byte StageMgr__STATE_RESTART_SCENE = .bss:0x805B2770; // type:object size:0x30 data:4byte -sHio = .bss:0x805B27A0; // type:object size:0x38 scope:local +sHio = .bss:0x805B27A0; // type:object size:0x34 scope:local lbl_805B27D8 = .bss:0x805B27D8; // type:object size:0xD8 align:4 data:float lbl_805B28B0 = .bss:0x805B28B0; // type:object size:0x10 WeatherTag__STATE_WAIT = .bss:0x805B28C0; // type:object size:0x30 data:4byte diff --git a/configure.py b/configure.py index 4bb8d6c6..5c9aa610 100644 --- a/configure.py +++ b/configure.py @@ -618,7 +618,7 @@ config.libs = [ Object(NonMatching, "d/d_hbm.cpp"), Object(NonMatching, "d/d_stage_mgr.cpp"), Object(NonMatching, "d/d_last.cpp"), - Object(NonMatching, "d/d_camera.cpp"), + Object(Matching, "d/d_camera.cpp"), Object(NonMatching, "d/d_light_obj.cpp"), Object(NonMatching, "d/tg/d_t_weather.cpp"), Object(Matching, "d/d_message.cpp"), diff --git a/include/d/d_camera.h b/include/d/d_camera.h index aa9424c2..7c27f8c9 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -66,6 +66,10 @@ private: }; enum Flags_e { + CAM_FLAGS_MAP = (1 << 1), + CAM_FLAGS_0x4 = (1 << 2), + CAM_FLAGS_0x10 = (1 << 4), + CAM_FLAGS_EVENT = (1 << 5), CAM_FLAGS_UNDERWATER = (1 << 6), CAM_FLAGS_IN_EVENT = (1 << 7), CAM_FLAGS_0x100 = (1 << 8), @@ -123,15 +127,31 @@ public: bool isUnderwater() const; f32 getUnderwaterDepth() const; - void fn_8019EA00(const mVec3_c &, const mVec3_c &, f32, f32); - void fn_8019E430(); - void fn_8019E410(); void fn_8019EA70(bool); + bool setEventCamView(const mVec3_c &, const mVec3_c &, f32, f32); mAng getYAngle() const; mAng getXZAngle() const; void apply(); + + bool fn_8019E3C0() const; + void enterMap(); + void leaveMap(); + bool fn_8019E4D0() const; + f32 fn_8019EB90(); private: + void onFlag(u32 flag) { + mFlags |= flag; + } + + void offFlag(u32 flag) { + mFlags &= ~flag; + } + + bool checkFlag(u32 flag) const { + return mFlags & flag; + } + void updateView(); void applyTilt(); @@ -139,6 +159,8 @@ private: void fn_8019DB80(); f32 fn_8019E1F0(); + void checkCameraChange(); + f32 getEventLetterboxAmount(); void updateUnderwaterDepth(const mVec3_c &pos); bool isUnderwater_() const; diff --git a/include/toBeSorted/d_camera_base.h b/include/toBeSorted/d_camera_base.h index 1bf6eb69..53438ea4 100644 --- a/include/toBeSorted/d_camera_base.h +++ b/include/toBeSorted/d_camera_base.h @@ -7,6 +7,7 @@ // A basic description of a camera perspective, simplified. struct CamView { CamView() : mPosition(0.0f, 0.0f, 0.0f), mTarget(0.0f, 0.0f, 1.0f), mFov(50.0f), mTilt(0.0f) {} + CamView(const mVec3_c &pos, const mVec3_c &target, f32 fov, f32 tilt) : mPosition(pos), mTarget(target), mFov(fov), mTilt(tilt) {} ~CamView() {} /* 0x00 */ mVec3_c mPosition; @@ -20,13 +21,13 @@ struct CamView { class dCameraBase_c { protected: /* 0x00 */ bool mCreated; - /* 0x01 */ u8 field_0x01; + /* 0x01 */ u8 mPrevIsActive; /* 0x02 */ bool mIsActive; /* 0x04 */ s32 mIndex; /* 0x08 */ CamView mView; public: - dCameraBase_c() : mCreated(false), field_0x01(0), mIsActive(false), mIndex(-1) {} + dCameraBase_c() : mCreated(false), mPrevIsActive(0), mIsActive(false), mIndex(-1) {} bool doCreate(s32 index); bool doRemove(); @@ -34,8 +35,8 @@ public: bool doDraw(); // vt at 0x28 - /* vt 0x08 */ virtual void vt_0x08() {} - /* vt 0x0C */ virtual void vt_0x0C() {} + /* vt 0x08 */ virtual void onBecomeActive() {} + /* vt 0x0C */ virtual void onBecomeInactive() {} /* vt 0x10 */ virtual bool create() { return true; } diff --git a/include/toBeSorted/d_camera_event.h b/include/toBeSorted/d_camera_event.h index d4caef6b..c83826fb 100644 --- a/include/toBeSorted/d_camera_event.h +++ b/include/toBeSorted/d_camera_event.h @@ -7,8 +7,8 @@ class dCameraEvent_c : public dCameraBase_c { public: dCameraEvent_c(); - /* vt 0x08 */ virtual void vt_0x08() override; - /* vt 0x0C */ virtual void vt_0x0C() override; + /* vt 0x08 */ virtual void onBecomeActive() override; + /* vt 0x0C */ virtual void onBecomeInactive() override; /* vt 0x10 */ virtual bool create() override; /* vt 0x14 */ virtual bool remove() override; /* vt 0x18 */ virtual bool execute() override; diff --git a/include/toBeSorted/d_camera_game.h b/include/toBeSorted/d_camera_game.h index 439f2811..00f7832c 100644 --- a/include/toBeSorted/d_camera_game.h +++ b/include/toBeSorted/d_camera_game.h @@ -139,8 +139,8 @@ public: static s32 sStyleIdxes[CAM_STYLE_IDX_MAX]; dCameraGame_c(); - /* vt 0x08 */ virtual void vt_0x08() override; - /* vt 0x0C */ virtual void vt_0x0C() override; + /* vt 0x08 */ virtual void onBecomeActive() override; + /* vt 0x0C */ virtual void onBecomeInactive() override; /* vt 0x10 */ virtual bool create() override; /* vt 0x14 */ virtual bool remove() override; /* vt 0x18 */ virtual bool execute() override; @@ -152,6 +152,14 @@ public: return field_0x060; } + bool getField_0x078() const { + return field_0x078; + } + + f32 getField_0x0AC() const { + return field_0x0AC; + } + void clearCamIds(); bool isCurrentTrend(const char *name) const; @@ -184,7 +192,7 @@ private: /* 0x06C */ UNKWORD field_0x06C; /* 0x070 */ UNKWORD field_0x070; /* 0x074 */ UNKWORD field_0x074; - /* 0x078 */ u8 field_0x078; + /* 0x078 */ bool field_0x078; /* 0x079 */ u8 field_0x079; /* 0x07A */ u8 field_0x07A; /* 0x07C */ UNKWORD field_0x07C; diff --git a/include/toBeSorted/d_camera_map.h b/include/toBeSorted/d_camera_map.h index 1d71ec0e..4a0f2633 100644 --- a/include/toBeSorted/d_camera_map.h +++ b/include/toBeSorted/d_camera_map.h @@ -8,8 +8,8 @@ class dAcObjBase_c; class dCameraMap_c : public dCameraBase_c { public: dCameraMap_c() {} - /* vt 0x08 */ virtual void vt_0x08() override; - /* vt 0x0C */ virtual void vt_0x0C() override; + /* vt 0x08 */ virtual void onBecomeActive() override; + /* vt 0x0C */ virtual void onBecomeInactive() override; /* vt 0x10 */ virtual bool create() override; /* vt 0x14 */ virtual bool remove() override; /* vt 0x18 */ virtual bool execute() override; @@ -24,6 +24,8 @@ public: void fn_80093340(); void fn_80093360(); void fn_80093380(); + bool fn_800932E0() const; + void fn_800932F0(); private: /* 0x2C */ u8 _0x2C[0x40 - 0x2C]; diff --git a/src/REL/d/a/b/d_a_b_lastboss.cpp b/src/REL/d/a/b/d_a_b_lastboss.cpp index 718f1cca..fd5656b9 100644 --- a/src/REL/d/a/b/d_a_b_lastboss.cpp +++ b/src/REL/d/a/b/d_a_b_lastboss.cpp @@ -3303,7 +3303,7 @@ void dAcBlastboss_c::executeLightningStrike() { f32 fac = val * 3.0f; tmp1.y += mAng(val * 0x1C20).cos() * fac; } - cam->fn_8019EA00(tmp1, field_0x2D04, field_0x2CFC, 0.0f); + cam->setEventCamView(tmp1, field_0x2D04, field_0x2CFC, 0.0f); if (b2) { mtx1.transS(0.5f, 0.5f, 0.0f); // REGSWAP diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index d8f8e5ef..589d8c8a 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -109,9 +109,9 @@ int dCamera_c::create() { mpCameras[0]->activate(); - mLetterboxAmount = fn_8019E1F0(); + mLetterboxAmount = getEventLetterboxAmount(); field_0x290 = 1.0f; - mFlags |= CAM_FLAGS_IN_EVENT; + onFlag(CAM_FLAGS_IN_EVENT); // TODO maybe struct + inline mGlobalAlpha = 1.0f; @@ -140,7 +140,7 @@ int dCamera_c::create() { if ((dScGame_c::isCurrentStage("F000") && 26 <= dScGame_c::currentSpawnInfo.layer && dScGame_c::currentSpawnInfo.layer <= 28) || dScGame_c::isInCredits() || dScGame_c::isSeekerStoneStageAndLayer()) { - mFlags |= CAM_FLAGS_NO_LETTERBOX_IN_EVENT; + onFlag(CAM_FLAGS_NO_LETTERBOX_IN_EVENT); dScGame_c::GetInstance()->setTargetingScreenLetterboxAmount(0.0f); } @@ -184,7 +184,7 @@ void dCamera_c::setWorldOffset(f32 x, f32 z) { int dCamera_c::execute() { dAcPy_c *link = dAcPy_c::GetLinkM(); - fn_8019DB80(); + checkCameraChange(); for (int i = 0; i < CAM_MAX; i++) { if (mpCameras[i] != nullptr) { @@ -203,10 +203,10 @@ int dCamera_c::execute() { field_0xDCC = false; if (mActiveCameraIdx == CAM_EVENT) { - mFlags |= CAM_FLAGS_IN_EVENT; + onFlag(CAM_FLAGS_IN_EVENT); } - if ((mFlags & (CAM_FLAGS_0x100 | CAM_FLAGS_IN_EVENT)) != 0) { + if (checkFlag(CAM_FLAGS_0x100 | CAM_FLAGS_IN_EVENT)) { field_0x290 += (1.0f / sHio.field_0x24); if (field_0x290 > 1.0f) { field_0x290 = 1.0f; @@ -218,16 +218,16 @@ int dCamera_c::execute() { } } - f32 scale = (mFlags & CAM_FLAGS_IN_EVENT) != 0 ? fn_8019E1F0() : sHio.field_0x20; + f32 scale = checkFlag(CAM_FLAGS_IN_EVENT) != 0 ? getEventLetterboxAmount() : sHio.field_0x20; f32 target = camEaseInOut(field_0x290, 1.0f); mLetterboxAmount += (target * scale - mLetterboxAmount) * 0.5f; - if (mActiveCameraIdx == CAM_EVENT && (mFlags & CAM_FLAGS_NO_LETTERBOX_IN_EVENT) != 0) { + if (mActiveCameraIdx == CAM_EVENT && checkFlag(CAM_FLAGS_NO_LETTERBOX_IN_EVENT) != 0) { mLetterboxAmount = 0.0f; } dScGame_c::GetInstance()->setTargetingScreenLetterboxAmount(mLetterboxAmount); - mFlags &= ~(CAM_FLAGS_0x100 | CAM_FLAGS_IN_EVENT); + offFlag(CAM_FLAGS_0x100 | CAM_FLAGS_IN_EVENT); if (!link->checkActionFlagsCont(0x400000)) { field_0x299 = 0; @@ -256,6 +256,42 @@ int dCamera_c::execute() { return SUCCEEDED; } +void dCamera_c::checkCameraChange() { + offFlag(CAM_FLAGS_0x10); + if (checkFlag(CAM_FLAGS_0x4)) { + getGameCam1()->onFlag(0x400); + offFlag(CAM_FLAGS_0x4); + } + + if (checkFlag(CAM_FLAGS_MAP) && mActiveCameraIdx == CAM_MAP && !mMapCam.fn_800932E0()) { + offFlag(CAM_FLAGS_MAP); + onFlag(CAM_FLAGS_0x4); + getGameCam1()->onFlag(0x10000); + debugPrintf7("off map"); + } + + if (EventManager::isInEvent()) { + onFlag(CAM_FLAGS_EVENT); + offFlag(CAM_FLAGS_MAP); + } else { + offFlag(CAM_FLAGS_EVENT); + } + + if (checkFlag(CAM_FLAGS_EVENT)) { + if (mActiveCameraIdx != CAM_EVENT) { + setActiveCamera(CAM_EVENT); + } + } else if (checkFlag(CAM_FLAGS_MAP)) { + if (mActiveCameraIdx != CAM_MAP) { + setActiveCamera(CAM_MAP); + } + } else { + if (mActiveCameraIdx != CAM_GAME_0) { + setActiveCamera(CAM_GAME_0); + } + } +} + void dCamera_c::updateView() { if (field_0xDCC) { mView = mView1; @@ -277,15 +313,15 @@ int dCamera_c::draw() { } bool dCamera_c::isUnderwater() const { - return mFlags & CAM_FLAGS_UNDERWATER; + return checkFlag(CAM_FLAGS_UNDERWATER); } void dCamera_c::apply() { updateUnderwaterDepth(mView.mPosition); if (isUnderwater_()) { - mFlags |= CAM_FLAGS_UNDERWATER; + onFlag(CAM_FLAGS_UNDERWATER); } else { - mFlags &= ~CAM_FLAGS_UNDERWATER; + offFlag(CAM_FLAGS_UNDERWATER); } if (mScreenShaker.execute()) { @@ -330,7 +366,10 @@ s32 dCamera_c::setActiveCamera(s32 newCamIdx) { mActiveCameraIdx = newCamIdx; return newCamIdx; } +} +f32 dCamera_c::getEventLetterboxAmount() { + return sHio.field_0x1C; } void dCamera_c::setFrustum(f32 fov, f32 near, f32 far) { @@ -374,6 +413,27 @@ mAng dCamera_c::getXZAngle() const { return mXZAngle; } +bool dCamera_c::fn_8019E3C0() const { + if (mActiveCameraIdx == CAM_GAME_0) { + return mGameCam1.getField_0x078() == true; + } else if (mActiveCameraIdx == CAM_GAME_1) { + return mGameCam2.getField_0x078() == true; + } + return false; +} + +void dCamera_c::enterMap() { + if (!checkFlag(CAM_FLAGS_MAP)) { + onFlag(CAM_FLAGS_MAP); + } +} + +void dCamera_c::leaveMap() { + if (checkFlag(CAM_FLAGS_MAP)) { + mMapCam.fn_800932F0(); + } +} + void dCamera_c::applyTilt() { EGG::Matrix34f &mtx = mLookAtCamera.getViewMatrix(); mMtx_c rotMtx; @@ -381,6 +441,11 @@ void dCamera_c::applyTilt() { MTXConcat(rotMtx, mtx.m, mtx.m); } +bool dCamera_c::fn_8019E4D0() const { + dAcPy_c *link = dAcPy_c::GetLinkM(); + return !EventManager::isInEvent() && !(link != nullptr && link->checkActionFlagsCont(0x5d7)); +} + void dCamera_c::updateUnderwaterDepth(const mVec3_c &pos) { mVec3_c chkPos = pos; dBgS_RoofChk roofChk; @@ -498,6 +563,12 @@ void dCamera_c::substruct_1::fn_8019E940() { } } +bool dCamera_c::setEventCamView(const mVec3_c &target, const mVec3_c &pos, f32 fov, f32 tilt) { + CamView view(pos, target, fov, tilt); + getEventCam()->setView(view); + return true; +} + bool dCamera_c::fn_8019EA70(bool b) { CamView view = getEventCam()->getView(); mVec3_c dest; @@ -515,3 +586,7 @@ bool dCamera_c::fn_8019EA70(bool b) { return true; } + +f32 dCamera_c::fn_8019EB90() { + return getGameCam1()->getField_0x0AC(); +} diff --git a/src/d/lyt/d_lyt_map.cpp b/src/d/lyt/d_lyt_map.cpp index fcaddb3a..8357b510 100644 --- a/src/d/lyt/d_lyt_map.cpp +++ b/src/d/lyt/d_lyt_map.cpp @@ -3309,7 +3309,7 @@ void dLytMapMain_c::setupEvent(s32 event, s32 arg1, s32 arg2) { dScGame_c::getCamera(0)->getMapCam()->fn_80093360(); dScGame_c::getCamera(0)->getMapCam()->fn_80093340(); } - dScGame_c::getCamera(0)->fn_8019E410(); + dScGame_c::getCamera(0)->enterMap(); dLytMapMain_vt0x10(); s32 floor = dStage_c::GetInstance()->getMapRelated()->getField_0x1EC(); mCurrentFloor = floor; @@ -3377,7 +3377,7 @@ void dLytMapMain_c::close() { } mEventDone = false; - dScGame_c::getCamera(0)->fn_8019E430(); + dScGame_c::getCamera(0)->leaveMap(); dSndPlayerMgr_c::GetInstance()->leaveMap(); mStateMgr.changeState(StateID_Out); @@ -5048,7 +5048,7 @@ void dLytMapMain_c::forceOut() { 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)->fn_8019E430(); + dScGame_c::getCamera(0)->leaveMap(); mStateMgr.changeState(StateID_Invisible); } diff --git a/src/toBeSorted/d_camera_base.cpp b/src/toBeSorted/d_camera_base.cpp index d8c163d9..7949c539 100644 --- a/src/toBeSorted/d_camera_base.cpp +++ b/src/toBeSorted/d_camera_base.cpp @@ -22,18 +22,18 @@ bool dCameraBase_c::doCreate(s32 index) { } bool dCameraBase_c::doRemove() { - field_0x01 = false; + mPrevIsActive = false; return remove(); } bool dCameraBase_c::doExecute() { - if (mIsActie && !field_0x01) { - vt_0x08(); - } else if (!mIsActie && field_0x01) { - vt_0x0C(); + if (mIsActive && !mPrevIsActive) { + onBecomeActive(); + } else if (!mIsActive && mPrevIsActive) { + onBecomeInactive(); } - field_0x01 = mIsActie; - if (!mIsActie) { + mPrevIsActive = mIsActive; + if (!mIsActive) { return false; } else { return execute(); @@ -41,7 +41,7 @@ bool dCameraBase_c::doExecute() { } bool dCameraBase_c::doDraw() { - if (field_0x01) { + if (mPrevIsActive) { return draw(); } return false; diff --git a/src/toBeSorted/d_camera_game.cpp b/src/toBeSorted/d_camera_game.cpp index 23a43e05..ba8677c3 100644 --- a/src/toBeSorted/d_camera_game.cpp +++ b/src/toBeSorted/d_camera_game.cpp @@ -282,7 +282,7 @@ dCameraGame_c::dCameraGame_c() field_0x06C(0), field_0x070(0xFFFF), field_0x074(0), - field_0x078(0), + field_0x078(false), field_0x07C(0), field_0x08C(-1), field_0x090(-1), @@ -324,7 +324,7 @@ bool dCameraGame_c::create() { mFlags = 0xA00; field_0x07C = 0; field_0x096 = 0; - field_0x078 = 0; + field_0x078 = false; mChk.fn_8007E130(this); mChk.fn_8007E1B0(field_0x098); @@ -416,9 +416,9 @@ void dCameraGame_c::setView(const CamView &view) { mView = view; mVec3_c diff = view.mPosition - view.mTarget; field_0x02C.setCartesian(diff); - field_0x078 = 0; + field_0x078 = false; } -void dCameraGame_c::vt_0x08() { +void dCameraGame_c::onBecomeActive() { // TODO - ... }