Small documentation

This commit is contained in:
robojumper
2025-11-28 11:46:40 +01:00
parent 6805e8ba9c
commit cb5e00197a
3 changed files with 49 additions and 42 deletions
+14 -8
View File
@@ -22,11 +22,17 @@ public:
return field_0x940;
}
void setField_0x941(u8 v) {
field_0x941 = v;
void setForceComplete(bool v) {
mForceComplete = v;
}
private:
enum Variant_e {
VAR_IMP_1,
VAR_IMP_2,
VAR_IMP_3,
};
void buildVariant01();
void buildVariant02();
void buildVariant03();
@@ -56,8 +62,8 @@ private:
/* 0x504 */ d2d::ResAccIf_c mResAcc;
/* 0x874 */ mVec2_c field_0x874;
/* 0x87C */ mVec2_c field_0x87C;
/* 0x884 */ mVec2_c field_0x884;
/* 0x87C */ mVec2_c mDpdPosLastFrame;
/* 0x884 */ mVec2_c mDpdPosScreen;
/* 0x88C */ mVec2_c mStartPositions[6];
/* 0x8BC */ mVec2_c mEndPositions[6];
@@ -65,12 +71,12 @@ private:
/* 0x8EC */ s32 mLineLoopIndex;
/* 0x8F0 */ s32 mVariant;
/* 0x8F4 */ s32 field_0x8F4;
/* 0x8F4 */ s32 mSavedLineLoopIndex;
/* 0x8F8 */ s32 field_0x8F8;
/* 0x8FC */ s32 mLineFixIndex;
/* 0x900 */ s32 field_0x900;
/* 0x904 */ s32 field_0x904;
/* 0x908 */ s32 field_0x908;
/* 0x904 */ s32 mDpdPosInitTimer;
/* 0x908 */ s32 mSampleTimer;
/* 0x90C */ u8 _0x90C[0x910 - 0x90C];
@@ -79,7 +85,7 @@ private:
/* 0x918 */ f32 field_0x918[10];
/* 0x940 */ bool field_0x940;
/* 0x941 */ bool field_0x941;
/* 0x941 */ bool mForceComplete;
/* 0x942 */ bool mLastLine;
/* 0x943 */ bool mNeedEnableLineLoop;
/* 0x944 */ u8 field_0x944;
+1 -1
View File
@@ -360,7 +360,7 @@ int dLytControlGame_c::execute() {
if (mpDrawMark != nullptr) {
if (field_0x15C54 == 0) {
mpDrawMark->setField_0x941(1);
mpDrawMark->setForceComplete(true);
}
mpDrawMark->execute();
if (mpDrawMark->getField_0x940() != 0) {
+34 -33
View File
@@ -75,11 +75,12 @@ STATE_DEFINE(dLytDrawMark_c, Complete);
#define DRAW_MARK_NUM_PANES 13
bool dLytDrawMark_c::build(UNKWORD) {
mVariant = dScGame_c::currentSpawnInfo.layer == 3 ? 1 : dScGame_c::currentSpawnInfo.layer == 4 ? 2 : 0;
// enums cause deoptimization here...
mVariant = dScGame_c::currentSpawnInfo.layer == 3 ? /* VAR_IMP_2*/ 1 : dScGame_c::currentSpawnInfo.layer == 4 ? /* VAR_IMP_3 */ 2 : /* VAR_IMP_1 */ 0;
if (mVariant == 1) {
if (mVariant == VAR_IMP_2) {
buildVariant02();
} else if (mVariant == 2) {
} else if (mVariant == VAR_IMP_3) {
buildVariant03();
} else {
buildVariant01();
@@ -90,21 +91,21 @@ bool dLytDrawMark_c::build(UNKWORD) {
mLastLine = false;
mNeedEnableLineLoop = false;
field_0x940 = false;
field_0x941 = false;
mForceComplete = false;
field_0x8F4 = -1;
mSavedLineLoopIndex = -1;
field_0x8F8 = -1;
mLineFixIndex = 0;
field_0x944 = 0;
field_0x900 = 0;
field_0x904 = 1;
field_0x908 = 0;
mDpdPosInitTimer = 1;
mSampleTimer = 0;
mLineLoopIndex = 0;
field_0x874.x = field_0x874.y = 0.0f;
field_0x87C.x = field_0x87C.y = 0.0f;
mDpdPosLastFrame.x = mDpdPosLastFrame.y = 0.0f;
field_0x910 = 0.0f;
field_0x914 = 0.0f;
@@ -173,9 +174,9 @@ void dLytDrawMark_c::initializeState_In() {
mAnm[DRAW_MARK_ANIM_IN].setToStart();
mAnm[DRAW_MARK_ANIM_IN].setAnimEnable(true);
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SEAL_APPEAR);
if (mVariant == 1) {
if (mVariant == VAR_IMP_2) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SEAL_LINE_APPEAR_2);
} else if (mVariant == 2) {
} else if (mVariant == VAR_IMP_3) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SEAL_LINE_APPEAR_3);
} else {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SEAL_LINE_APPEAR_1);
@@ -214,8 +215,8 @@ void dLytDrawMark_c::initializeState_MoveWait() {
field_0x874 = mStartPositions[mLineLoopIndex];
// unused
mVec2_c _ = mEndPositions[mLineLoopIndex] - mStartPositions[mLineLoopIndex];
if (field_0x8F4 == -1) {
field_0x8F4 = mLineLoopIndex;
if (mSavedLineLoopIndex == -1) {
mSavedLineLoopIndex = mLineLoopIndex;
}
}
void dLytDrawMark_c::executeState_MoveWait() {
@@ -224,14 +225,14 @@ void dLytDrawMark_c::executeState_MoveWait() {
}
dPad::ex_c::getInstance()->setField_0x70(sHio.field_0x18);
fn_800ADC10(mVec2_c(0.0f, 0.0f));
field_0x884.x = field_0x884.y = 0.0f;
field_0x87C.set(0.0f, 0.0f);
mDpdPosScreen.x = mDpdPosScreen.y = 0.0f;
mDpdPosLastFrame.set(0.0f, 0.0f);
mStateMgr.changeState(StateID_MoveDraw);
}
void dLytDrawMark_c::finalizeState_MoveWait() {}
void dLytDrawMark_c::initializeState_MoveDraw() {
field_0x904 = 1;
mDpdPosInitTimer = 1;
field_0x900 = 0;
field_0x914 = 0.0f;
for (int i = 0; i < 10; i++) {
@@ -245,7 +246,7 @@ void dLytDrawMark_c::executeState_MoveDraw() {
if (mAnm[mLineLoopIndex + DRAW_MARK_ANIM_DRAW_LINE_LOOP_OFFSET].getFrame() == 1.0f) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SEAL_LINE_BLINK);
}
if (field_0x941) {
if (mForceComplete) {
mStateMgr.changeState(StateID_Complete);
} else {
detectSwordSwing();
@@ -274,12 +275,12 @@ void dLytDrawMark_c::executeState_MoveFix() {
mLineLoopIndex++;
}
mNeedEnableLineLoop = true;
if (field_0x8F4 < getNumLines()) {
if (mSavedLineLoopIndex < getNumLines()) {
if (mLastLine) {
dLytControlGame_c::getInstance()->setDrawMarkRelated(0, 0);
mStateMgr.changeState(StateID_Complete);
} else {
field_0x8F4 = -1;
mSavedLineLoopIndex = -1;
mStateMgr.changeState(StateID_MoveWait);
}
}
@@ -297,12 +298,12 @@ void dLytDrawMark_c::initializeState_MoveEnd() {
mNeedEnableLineLoop = true;
}
void dLytDrawMark_c::executeState_MoveEnd() {
if (field_0x8F4 < getNumLines()) {
if (mSavedLineLoopIndex < getNumLines()) {
if (mLastLine) {
dLytControlGame_c::getInstance()->setDrawMarkRelated(0, 0);
mStateMgr.changeState(StateID_Complete);
} else {
field_0x8F4 = -1;
mSavedLineLoopIndex = -1;
mStateMgr.changeState(StateID_MoveWait);
}
}
@@ -333,17 +334,17 @@ void dLytDrawMark_c::finalizeState_Complete() {}
void dLytDrawMark_c::detectSwordSwing() {
dPad::ex_c::getInstance()->setField_0x70(sHio.field_0x18);
field_0x884 = dPad::getDpdPosScreen();
if (field_0x904 > 0) {
field_0x87C = field_0x884;
field_0x904--;
mDpdPosScreen = dPad::getDpdPosScreen();
if (mDpdPosInitTimer > 0) {
mDpdPosLastFrame = mDpdPosScreen;
mDpdPosInitTimer--;
}
if (field_0x908 > 0) {
field_0x908--;
field_0x87C = field_0x884;
if (mSampleTimer > 0) {
mSampleTimer--;
mDpdPosLastFrame = mDpdPosScreen;
} else {
mVec2_c swingDir(field_0x884.x - field_0x87C.x, field_0x884.y - field_0x87C.y);
mVec2_c swingDir(mDpdPosScreen.x - mDpdPosLastFrame.x, mDpdPosScreen.y - mDpdPosLastFrame.y);
mAng swingAngle = swingDir.ang2();
mVec2_c lineDir = mEndPositions[mLineLoopIndex] - mStartPositions[mLineLoopIndex];
mAng lineAngle = lineDir.ang2();
@@ -396,7 +397,7 @@ void dLytDrawMark_c::detectSwordSwing() {
if (swingMag >= sHio.field_0x0C) {
field_0x910 += swingMag - sHio.field_0x0C;
if (field_0x910 >= sHio.field_0x08) {
field_0x908 = sHio.field_0x1C;
mSampleTimer = sHio.field_0x1C;
}
}
field_0x900 = 0;
@@ -408,8 +409,8 @@ void dLytDrawMark_c::detectSwordSwing() {
}
fn_800ADC10(mVec2_c(0.0f, 0.0f));
field_0x884.x = field_0x884.y = 0.0f;
field_0x87C.set(0.0f, 0.0f);
mDpdPosScreen.x = mDpdPosScreen.y = 0.0f;
mDpdPosLastFrame.set(0.0f, 0.0f);
dLytDobutton_c::setActionTextStuff(dLytDobutton_c::ICON_2, dLytDobutton_c::ACT_DO_70, true);
}
}
@@ -585,9 +586,9 @@ void dLytDrawMark_c::buildVariant03() {
}
s32 dLytDrawMark_c::getNumLines() const {
if (mVariant == 1) {
if (mVariant == VAR_IMP_2) {
return 4;
} else if (mVariant == 2) {
} else if (mVariant == VAR_IMP_3) {
return 6;
} else {
return 3;