d_t_action OK (#172)

* d_t_action OK
This commit is contained in:
Elijah Thomas
2025-05-24 03:34:09 -04:00
committed by GitHub
parent b8b2375891
commit 9efc1e0ab9
9 changed files with 159 additions and 30 deletions
+12 -12
View File
@@ -2,19 +2,19 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
dTgAction_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C
TgActTag__init = .text:0x000000C0; // type:function size:0x64
fn_202_130 = .text:0x00000130; // type:function size:0x8
fn_202_140 = .text:0x00000140; // type:function size:0x58
fn_202_1A0 = .text:0x000001A0; // type:function size:0x6C
TgActTag__update = .text:0x00000210; // type:function size:0x27C
fn_202_490 = .text:0x00000490; // type:function size:0x8
create__11dTgAction_cFv = .text:0x000000C0; // type:function size:0x64
doDelete__11dTgAction_cFv = .text:0x00000130; // type:function size:0x8
setActiveArea__11dTgAction_cFf = .text:0x00000140; // type:function size:0x58
resetActiveArea__11dTgAction_cFv = .text:0x000001A0; // type:function size:0x6C
actorExecute__11dTgAction_cFv = .text:0x00000210; // type:function size:0x27C
draw__11dTgAction_cFv = .text:0x00000490; // type:function size:0x8
__dt__11dTgAction_cFv = .text:0x000004A0; // type:function size:0x5C
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_202_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
lbl_202_rodata_4 = .rodata:0x00000004; // type:object size:0x4 align:4 data:float
lbl_202_rodata_8 = .rodata:0x00000008; // type:object size:0x4 align:4 data:float
lbl_202_rodata_C = .rodata:0x0000000C; // type:object size:0x4 align:4 data:float
lbl_202_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
lbl_202_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local align:4 data:float
lbl_202_rodata_8 = .rodata:0x00000008; // type:object size:0x4 scope:local align:4 data:float
lbl_202_rodata_C = .rodata:0x0000000C; // type:object size:0x4 scope:local align:4 data:float
g_profile_ACTION_TAG = .data:0x00000000; // type:object size:0x10
lbl_202_data_10 = .data:0x00000010; // type:object size:0x4 data:4byte
TgActTag__vtable = .data:0x00000014; // type:object size:0x74
lbl_202_data_10 = .data:0x00000010; // type:object size:0x4 scope:local data:4byte
__vt__11dTgAction_c = .data:0x00000014; // type:object size:0x74
+1 -1
View File
@@ -1151,7 +1151,7 @@ ActorEnemyBase__shouldUpdateMaybe = .text:0x8002F400; // type:function size:0xB4
ActorEnemyBase__postUpdate = .text:0x8002F4C0; // type:function size:0x7C
ActorEnemyBase__preDraw = .text:0x8002F540; // type:function size:0x74
fn_8002F5C0 = .text:0x8002F5C0; // type:function size:0x110
checkBeetleActorReferences__17daPlayerActBase_cFv = .text:0x8002F6D0; // type:function size:0x8
checkBeetleActorReferences__17daPlayerActBase_cFl = .text:0x8002F6D0; // type:function size:0x8
getBeetleActorReferencesSize__17daPlayerActBase_cFv = .text:0x8002F6E0; // type:function size:0x8
fn_8002F6F0 = .text:0x8002F6F0; // type:function size:0xC
fn_8002F700 = .text:0x8002F700; // type:function size:0x8
+1 -1
View File
@@ -2448,7 +2448,7 @@ config.libs = [
Rel(NonMatching, "d_SoftwareKeyboard", "REL/d/d_SoftwareKeyboard.cpp"),
Rel(NonMatching, "d_s_boot", "REL/d/d_s_boot.cpp"),
Rel(NonMatching, "d_title_manager", "REL/d/d_title_manager.cpp"),
Rel(NonMatching, "d_t_action", "REL/d/t/d_t_action.cpp"),
Rel(Matching, "d_t_action", "REL/d/t/d_t_action.cpp"),
Rel(NonMatching, "d_t_at0", "REL/d/t/d_t_at0.cpp"),
Rel(NonMatching, "d_t_auto_message", "REL/d/t/d_t_auto_message.cpp"),
Rel(NonMatching, "d_t_barrel", "REL/d/t/d_t_barrel.cpp"),
+3 -4
View File
@@ -15,8 +15,8 @@ struct cBgS_PolyInfo;
struct SoundSource {
virtual ~SoundSource() {}
// TODO there's probably multiple inheritance involved and stuff
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset();
// TODO there's probably multiple inheritance involved and stuff
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset();
SOUNDSOURCE_VIRTUAL(0x0C);
SOUNDSOURCE_VIRTUAL(0x10);
@@ -33,7 +33,7 @@ struct SoundSource {
SOUNDSOURCE_VIRTUAL(0x3C);
SOUNDSOURCE_VIRTUAL(0x40);
SOUNDSOURCE_VIRTUAL(0x44);
virtual bool shutdown(); // 0x48
virtual bool shutdown(); // 0x48
SOUNDSOURCE_VIRTUAL(0x4C);
SOUNDSOURCE_VIRTUAL(0x50);
SOUNDSOURCE_VIRTUAL(0x54);
@@ -80,7 +80,6 @@ struct SoundSource {
SOUNDSOURCE_VIRTUAL(0xF8);
SOUNDSOURCE_VIRTUAL(0xFC);
virtual bool isReadyMaybe(); // 0x100
virtual bool load(void *data, const char *name); // 0x104
virtual void setFrame(f32 frame); // 0x108
+10 -3
View File
@@ -131,10 +131,10 @@ public:
// unused; overridden by daPlayerModelBase_c
return nullptr;
}
/* vt 0x11C */ virtual UNKWORD checkBeetleActorReferences() {
return 0;
/* vt 0x11C */ virtual dAcObjBase_c *checkBeetleActorReferences(s32) {
return nullptr;
}
/* vt 0x120 */ virtual UNKWORD getBeetleActorReferencesSize() {
/* vt 0x120 */ virtual s32 getBeetleActorReferencesSize() {
return 0;
}
/* vt 0x124 */ virtual UNKWORD vt_0x124() {
@@ -541,6 +541,13 @@ public:
return (someFlags_0x350 & mask) != 0;
}
inline void onFlags_0x358(u32 mask) {
someFlags_0x358 |= mask;
}
inline void offFlags_0x358(u32 mask) {
someFlags_0x358 &= ~mask;
}
inline void onFlags_0x360(u32 mask) {
field_0x360 |= mask;
}
+36 -2
View File
@@ -1,14 +1,48 @@
#ifndef D_T_ACTION_H
#define D_T_ACTION_H
#include "d/a/d_a_base.h"
#include "d/flag/sceneflag_manager.h"
#include "d/t/d_tg.h"
#include "m/m_angle.h"
#include "m/m_mtx.h"
class dTgAction_c : public dAcBase_c {
class dTgAction_c : public dTg_c {
public:
dTgAction_c() {}
virtual ~dTgAction_c() {}
enum Type_e {
FORCE_FADE_RESTART = 0,
SHOW_DASH_PROMPT = 1,
PREVENT_RESPAWN = 4,
WATER_RELATED = 5,
FORCE_AUTO_JUMP = 6,
PREVENT_LOFTWING_CALL = 7,
};
virtual int create() override;
virtual int doDelete() override;
virtual int draw() override;
virtual int actorExecute() override;
void setActiveArea(f32 scale);
void resetActiveArea();
bool checkActive1() const {
return SceneflagManager::sInstance->checkBoolFlag(roomid, mEnableFlag1);
}
bool checkActive2() const {
return (!(mEnableFlag2 < 0xFF) || SceneflagManager::sInstance->checkBoolFlag(roomid, mEnableFlag2));
}
private:
/* 0x0FC */ mMtx_c mActiveMtx;
/* 0x12C */ f32 mScaleIncrease;
/* 0x130 */ u8 mEnableFlag1;
/* 0x131 */ u8 mEnableFlag2;
/* 0x132 */ u8 mType;
/* 0x133 */ u8 _133;
/* 0x134 */ mAng field_0x134;
};
#endif
+4 -5
View File
@@ -57,6 +57,10 @@ struct mAng {
return *this;
}
static s32 abs(const mAng b) {
return labs(b);
}
s32 step(s16 target, s32 steps, s16 max, s16 min);
f32 sin() const {
@@ -117,11 +121,6 @@ struct mAng {
return rad * (65536.0f / (2.f * M_PI));
}
// Try not to use
s32 diff(const mAng &other) {
return mVal - other.mVal;
}
s16 mVal;
private:
+90
View File
@@ -1,3 +1,93 @@
#include "d/t/d_t_action.h"
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/obj/d_a_obj_bomb.h"
#include "d/d_player.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m_angle.h"
#include "toBeSorted/area_math.h"
SPECIAL_ACTOR_PROFILE(ACTION_TAG, dTgAction_c, fProfile::ACTION_TAG, 0x20, 0, 0);
int dTgAction_c::create() {
mEnableFlag1 = (params >> 6) & 0xFF;
mEnableFlag2 = (params >> 14) & 0xFF;
mType = (params >> 0) & 0x3F;
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, 0.f);
return SUCCEEDED;
}
int dTgAction_c::doDelete() {
return SUCCEEDED;
}
void dTgAction_c::setActiveArea(f32 scale) {
if (mScaleIncrease < 0.1f) {
mScaleIncrease = scale;
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, mScaleIncrease);
}
}
void dTgAction_c::resetActiveArea() {
if (mScaleIncrease > 0.f) {
mScaleIncrease = 0.f;
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, 0.f);
field_0x134 = 0;
}
}
int dTgAction_c::actorExecute() {
dAcPy_c *player = getLinkPtr();
bool enabled = !checkActive1() && checkActive2();
// Check For Bomb within area
if (enabled && mType == WATER_RELATED) {
s32 numRefs = player->getBeetleActorReferencesSize();
for (s32 i = 0; i < numRefs; i++) {
dAcObjBase_c *pObj = player->checkBeetleActorReferences(i);
if (pObj == nullptr) {
break;
}
if (pObj->profile_name == fProfile::BOMB) {
if (checkIfVec3fInMatrix(mActiveMtx, pObj->GetPosition())) {
reinterpret_cast<dAcBomb_c *>(pObj)->On_0xA3C(0x20000000);
}
}
}
}
// Check For Player Within Area
if (enabled && checkIfVec3fInMatrix(mActiveMtx, player->GetPosition())) {
if (mType == FORCE_FADE_RESTART) {
player->onFlags_0x358(0x10000000);
setActiveArea(50.f);
} else if (mType == PREVENT_RESPAWN) {
player->onForceOrPreventActionFlags(0x80);
} else if (mType == FORCE_AUTO_JUMP) {
player->onForceOrPreventActionFlags(0x200000);
} else if (mType == PREVENT_LOFTWING_CALL) {
player->onForceOrPreventActionFlags(0x20000);
setActiveArea(50.f);
} else if (mType == WATER_RELATED) {
player->onForceOrPreventActionFlags(0x400000);
setActiveArea(15.f);
} else if (mType == SHOW_DASH_PROMPT) {
if (mAng::abs(player->rotation.y - rotation.y) < (0x2000 + field_0x134)) {
player->onForceOrPreventActionFlags(0x20000000);
setActiveArea(50.f);
field_0x134.set(0x38E);
} else {
resetActiveArea();
}
}
} else {
resetActiveArea();
}
return SUCCEEDED;
}
int dTgAction_c::draw() {
return SUCCEEDED;
}
+2 -2
View File
@@ -431,8 +431,8 @@ bool dAcBase_c::getDistanceAndAngleToActor(
angleToActorX.set(cLib::targetAngleX(position, actor->position));
if ((distSquared <= distThresh * distThresh)) {
if ((labs(mAng(rotation.y.diff(angleToActorY))) <= yAngle) &&
(labs(mAng(rotation.x.diff(angleToActorX))) <= xAngle)) {
if (mAng::abs((s32)(rotation.y - angleToActorY)) <= yAngle &&
mAng::abs((s32)(rotation.x - angleToActorX)) <= xAngle) {
isWithinRange = true;
}
}