summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2024-07-11 23:37:28 -0700
committerJasper St. Pierre <jstpierre@mecheye.net>2024-07-11 23:37:28 -0700
commita597a1902bf49a9da6f4edcbb8926d2f6ce5d425 (patch)
tree1b057cdcbccd45034690a3eb608528a7552c3072
parent7916599cad12c8a6809946ac07e8a2479f38a5cc (diff)
d_operate_wind work
-rw-r--r--include/d/d_com_inf_game.h23
-rw-r--r--include/d/d_operate_wind.h89
-rw-r--r--src/d/d_operate_wind.cpp180
3 files changed, 252 insertions, 40 deletions
diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h
index 9b09c477..b6980554 100644
--- a/include/d/d_com_inf_game.h
+++ b/include/d/d_com_inf_game.h
@@ -378,6 +378,11 @@ public:
u8 getScopeType() { return mScopeType; }
void setScopeType(u8 type) { mScopeType = type; }
+ u8 getOperateWind() { return mOperateWind; }
+ void setOperateWindCancelOff() { mOperateWind = 0; }
+ void setOperateWindChangeOff() { mOperateWind = 1; }
+ void setOperateWindOn() { mOperateWind = 2; }
+
u8 checkMesgSendButton() { return mMesgSendButton; }
u8 checkMesgCancelButton() { return mMesgCancelButton; }
@@ -664,7 +669,7 @@ public:
/* 0x4943 */ u8 field_0x4943;
/* 0x4944 */ u8 field_0x4944;
/* 0x4945 */ u8 mScopeType;
- /* 0x4946 */ u8 field_0x4946;
+ /* 0x4946 */ u8 mOperateWind;
/* 0x4947 */ u8 field_0x4947;
/* 0x4948 */ u8 mMesgSendButton;
/* 0x4949 */ u8 mMesgCancelButton;
@@ -2337,6 +2342,22 @@ inline void dComIfGp_setScopeType(u8 type) {
g_dComIfG_gameInfo.play.setScopeType(type);
}
+inline u8 dComIfGp_getOperateWind() {
+ return g_dComIfG_gameInfo.play.getOperateWind();
+}
+
+inline void dComIfGp_setOperateWindCancelOff() {
+ g_dComIfG_gameInfo.play.setOperateWindCancelOff();
+}
+
+inline void dComIfGp_setOperateWindChangeOff() {
+ g_dComIfG_gameInfo.play.setOperateWindChangeOff();
+}
+
+inline void dComIfGp_setOperateWindOn() {
+ g_dComIfG_gameInfo.play.setOperateWindOn();
+}
+
inline u8 dComIfGp_checkMesgSendButton() {
return g_dComIfG_gameInfo.play.checkMesgSendButton();
}
diff --git a/include/d/d_operate_wind.h b/include/d/d_operate_wind.h
index 73cf1ee5..faecbace 100644
--- a/include/d/d_operate_wind.h
+++ b/include/d/d_operate_wind.h
@@ -1,41 +1,70 @@
#ifndef D_OPERATE_WIND_H
#define D_OPERATE_WIND_H
-#include "dolphin/types.h"
+#include "d/d_drawlist.h"
+#include "f_op/f_op_msg.h"
+#include "f_op/f_op_msg_mng.h"
+#include "m_Do/m_Do_hostIO.h"
#include "JSystem/JUtility/TColor.h"
class fopMsgM_pane_class;
class JKRExpHeap;
class J2DScreen;
+class STControl;
-class dOw_HIO_c {
+class dOw_HIO_c : public mDoHIO_entry_c {
public:
dOw_HIO_c();
+
+public:
+ /* 0x04 */ f32 field_0x04;
+ /* 0x08 */ s16 field_0x08;
+ /* 0x0A */ s16 field_0x0a;
+ /* 0x0C */ s16 field_0x0c;
+ /* 0x0E */ s16 field_0x0e;
+ /* 0x10 */ s16 field_0x10;
+ /* 0x12 */ s16 field_0x12;
+ /* 0x14 */ s16 field_0x14;
+ /* 0x16 */ s16 field_0x16;
+ /* 0x18 */ u8 field_0x18;
};
-class dDlst_Ow_main_c {
+class dDlst_Ow_main_c : public dDlst_base_c {
public:
- void drawLine(int, f32, f32, f32, f32) {}
- void setLineColor(JUtility::TColor) {}
- void setLineMax(int) {}
- void setScreen(J2DScreen*) {}
+ inline void drawLine(int, f32, f32, f32, f32);
+ void setLineColor(JUtility::TColor c) { color = c; }
+ void setLineMax(int v) { mLineMax = v; }
+ void setScreen(J2DScreen* s) { scrn = s; }
void draw();
+
+public:
+ /* 0x004 */ J2DScreen* scrn;
+ /* 0x008 */ JUtility::TColor color;
+ /* 0x00C */ int mLineMax;
+ /* 0x010 */ f32 mX1[50];
+ /* 0x0D8 */ f32 mY1[50];
+ /* 0x1A0 */ f32 mX2[50];
+ /* 0x268 */ f32 mY2[50];
};
-class dDlst_Ow_mask_c {
+class dDlst_Ow_mask_c : public dDlst_base_c {
public:
void setScreen(J2DScreen*) {}
void draw();
+
+public:
+ /* 0x004 */ J2DScreen* scrn;
};
class dOperate_wind_c {
public:
+ virtual ~dOperate_wind_c() {}
void setTimer(s16) {}
- void dOw_angleRegular(f32);
- void dOw_stickControl(int, s16);
+ static int dOw_angleRegular(f32);
+ int dOw_stickControl(int, s16);
void screenSet();
void alphaSet(f32);
void arrowColor1();
@@ -53,24 +82,44 @@ public:
void _delete();
void _move();
void _draw();
- void _open();
- void _close();
+ bool _open();
+ bool _close();
+
+public:
+ /* 0x004 */ J2DScreen* scrn1;
+ /* 0x008 */ J2DScreen* scrn2;
+ /* 0x00C */ fopMsgM_pane_class field_0x0c[5];
+ /* 0x124 */ fopMsgM_pane_class field_0x124[2];
+ /* 0x194 */ fopMsgM_pane_class field_0x194;
+ /* 0x1CC */ fopMsgM_pane_class field_0x1cc[4];
+ /* 0x2AC */ fopMsgM_pane_class field_0x2ac[8];
+ /* 0x46C */ fopMsgM_pane_class field_0x46c[4];
+ /* 0x54C */ fopMsgM_pane_alpha_class field_0x54c;
+ /* 0x554 */ fopMsgM_pane_alpha_class field_0x554;
+ /* 0x55C */ STControl* stick;
+ /* 0x560 */ dDlst_Ow_main_c* mMain;
+ /* 0x564 */ dDlst_Ow_mask_c* mMask;
};
-class dOw_c {
+class dOw_c : public msg_class {
public:
- void _close() {}
- void _draw() {}
- void _move() {}
- void _open() {}
- void getHeap() {}
+ inline void _close();
+ inline bool _draw();
+ inline void _move();
+ inline void _open();
+ JKRExpHeap* getHeap() { return heap; }
void getStatus() {}
- void setHeap(JKRExpHeap*) {}
+ void setHeap(JKRExpHeap* h) { heap = h; }
void setStatus(u8) {}
void setTimer(s16) {}
-
+
void _create();
void _delete();
+
+public:
+ /* 0x0FC */ JKRExpHeap* heap;
+ /* 0x100 */ dOperate_wind_c* dOw_scrn;
+ /* 0x104 */ u8 field_0x104;
};
#endif /* D_OPERATE_WIND_H */
diff --git a/src/d/d_operate_wind.cpp b/src/d/d_operate_wind.cpp
index 8f20b05f..f0f8c41c 100644
--- a/src/d/d_operate_wind.cpp
+++ b/src/d/d_operate_wind.cpp
@@ -4,31 +4,123 @@
//
#include "d/d_operate_wind.h"
-#include "f_op/f_op_msg.h"
+#include "d/d_com_inf_game.h"
+#include "f_op/f_op_msg_mng.h"
+#include "m_Do/m_Do_ext.h"
+#include "JSystem/J2DGraph/J2DOrthoGraph.h"
+#include "JSystem/J2DGraph/J2DScreen.h"
+#include "JSystem/JKernel/JKRExpHeap.h"
+#include "JSystem/JKernel/JKRHeap.h"
+#include "JSystem/JUtility/JUTAssert.h"
+#include "SSystem/SComponent/c_phase.h"
/* 8021E58C-8021E5F8 .text __ct__9dOw_HIO_cFv */
-dOw_HIO_c::dOw_HIO_c() {
- /* Nonmatching */
+dOw_HIO_c::dOw_HIO_c() {
+ field_0x08 = 0x1e;
+ field_0x0a = 0x5f;
+ field_0x0c = 0x9b;
+ field_0x0e = 0x10;
+ field_0x18 = 100;
+ field_0x10 = 0x78;
+ field_0x12 = 0x32;
+ field_0x04 = 7.0f;
+ field_0x14 = 0x14;
+ field_0x16 = 0x28;
+}
+
+void dDlst_Ow_main_c::drawLine(int width, f32 x1, f32 y1, f32 x2, f32 y2) {
+ J2DDrawLine(x1, y1, x2, y2, color, width);
}
/* 8021E5F8-8021E6A4 .text draw__15dDlst_Ow_main_cFv */
void dDlst_Ow_main_c::draw() {
- /* Nonmatching */
+ J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
+ graf->setPort();
+
+ for (int i = 0; i < mLineMax; i++) {
+ // drawLine(6, mX1[i], mY1[i], mX2[i], mY2[i]);
+ J2DDrawLine(mX1[i], mY1[i], mX2[i], mY2[i], color, 6);
+ }
+
+ scrn->draw(0.0f, 0.0f, graf);
}
/* 8021E6A4-8021E708 .text draw__15dDlst_Ow_mask_cFv */
void dDlst_Ow_mask_c::draw() {
- /* Nonmatching */
+ J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
+ graf->setPort();
+ scrn->draw(0.0f, 0.0f, graf);
}
/* 8021E708-8021E7E4 .text dOw_angleRegular__15dOperate_wind_cFf */
-void dOperate_wind_c::dOw_angleRegular(f32) {
- /* Nonmatching */
+int dOperate_wind_c::dOw_angleRegular(f32 angle) {
+ if (angle < -247.5f)
+ return 90;
+ else if (angle < -202.5f)
+ return 135;
+ else if (angle < -157.5f)
+ return 180;
+ else if (angle < -112.5f)
+ return 225;
+ else if (angle < -67.5f)
+ return 270;
+ else if (angle < -22.5f)
+ return 315;
+ else if (angle < 22.5f)
+ return 0;
+ else if (angle < 67.5f)
+ return 45;
+ else if (angle < 112.5f)
+ return 90;
+ else if (angle < 157.5f)
+ return 135;
+ else if (angle < 202.5f)
+ return 180;
+ // missing end return
}
/* 8021E7E4-8021E974 .text dOw_stickControl__15dOperate_wind_cFis */
-void dOperate_wind_c::dOw_stickControl(int, s16) {
- /* Nonmatching */
+int dOperate_wind_c::dOw_stickControl(int ret, s16 ang) {
+ s32 angi = abs(ang);
+ if (ret == 0) {
+ if (angi > 0x7000) {
+ return 1;
+ } else if (ang >= 0x5000) {
+ return 2;
+ } else if (ang <= -0x5000) {
+ return 8;
+ } else if (ang >= 0x3000) {
+ return 3;
+ } else if (ang <= -0x3000) {
+ return 7;
+ } else if (ang >= 0x1000) {
+ return 4;
+ } else if (ang <= -0x1000) {
+ return 6;
+ } else {
+ return 5;
+ }
+ } else {
+ if (angi > 0x7F80) {
+ return 1;
+ } else if (ang >= 0x5800 && ang <= 0x6800) {
+ return 2;
+ } else if (ang <= -0x5800 && ang >= -0x6800) {
+ return 8;
+ } else if (ang >= 0x3F80 && ang <= 0x4080) {
+ return 3;
+ } else if (ang <= -0x3F80 && ang >= -0x4080) {
+ return 7;
+ } else if (ang >= 0x1800 && ang <= 0x2800) {
+ return 4;
+ } else if (ang <= -0x1800 && ang >= -0x2800) {
+ return 6;
+ } else if (angi < 0x80) {
+ return 5;
+ }
+ }
+
+ return ret;
}
/* 8021E974-8021ED4C .text screenSet__15dOperate_wind_cFv */
@@ -117,46 +209,96 @@ void dOperate_wind_c::_draw() {
}
/* 8022163C-802216F0 .text _open__15dOperate_wind_cFv */
-void dOperate_wind_c::_open() {
+bool dOperate_wind_c::_open() {
/* Nonmatching */
}
/* 802216F0-80221770 .text _close__15dOperate_wind_cFv */
-void dOperate_wind_c::_close() {
+bool dOperate_wind_c::_close() {
/* Nonmatching */
}
/* 80221770-80221830 .text _create__5dOw_cFv */
void dOw_c::_create() {
/* Nonmatching */
+ dOw_scrn = new dOperate_wind_c();
+ JUT_ASSERT(0x578, dOw_scrn != NULL);
+ dOw_scrn->_create();
}
/* 80221830-80221880 .text _delete__5dOw_cFv */
void dOw_c::_delete() {
/* Nonmatching */
+ dOw_scrn->_delete();
+ delete dOw_scrn;
+}
+
+bool dOw_c::_draw() {
+ if (field_0x104) /* getStatus? */
+ dOw_scrn->_draw();
+ return true;
}
/* 80221880-802218B4 .text dOw_Draw__FP5dOw_c */
-static void dOw_Draw(dOw_c*) {
+static BOOL dOw_Draw(dOw_c* i_this) {
/* Nonmatching */
+ return i_this->_draw();
+}
+
+void dOw_c::_close() {
+ if (!dOw_scrn->_close()) {
+ dOw_scrn->_move();
+ } else {
+ field_0x104 = 0;
+ fopMsgM_Delete(this);
+ }
+}
+
+void dOw_c::_open() {
+ if (dOw_scrn->_open())
+ dOw_scrn->_move();
}
/* 802218B4-802219A4 .text dOw_Execute__FP5dOw_c */
-static void dOw_Execute(dOw_c*) {
+static BOOL dOw_Execute(dOw_c* i_this) {
/* Nonmatching */
+ static u8 wind_flag = dComIfGp_getOperateWind();
+ JKRHeap* old_heap = mDoExt_setCurrentHeap(i_this->getHeap());
+ if (dComIfGp_getOperateWind() == 2) {
+ i_this->_open();
+ } else {
+ // i_this->dOw_scrn->setTimer ?
+ i_this->_close();
+ }
+ wind_flag = dComIfGp_getOperateWind();
+ mDoExt_setCurrentHeap(old_heap);
+ return TRUE;
}
/* 802219A4-802219AC .text dOw_IsDelete__FP5dOw_c */
-static void dOw_IsDelete(dOw_c*) {
- /* Nonmatching */
+static BOOL dOw_IsDelete(dOw_c* i_this) {
+ return TRUE;
}
/* 802219AC-80221A04 .text dOw_Delete__FP5dOw_c */
-static void dOw_Delete(dOw_c*) {
- /* Nonmatching */
+static BOOL dOw_Delete(dOw_c* i_this) {
+ JKRHeap* old_heap = mDoExt_setCurrentHeap(i_this->getHeap());
+ i_this->_delete();
+ mDoExt_setCurrentHeap(old_heap);
+ fopMsgM_destroyExpHeap(i_this->getHeap());
+ return TRUE;
}
/* 80221A04-80221AA0 .text dOw_Create__FP9msg_class */
-static void dOw_Create(msg_class*) {
- /* Nonmatching */
+static s32 dOw_Create(msg_class* i_msg) {
+ dOw_c* i_this = (dOw_c*)i_msg;
+
+ JKRExpHeap* heap = fopMsgM_createExpHeap(20000);
+ JUT_ASSERT(0x547, heap != NULL);
+ i_this->setHeap(heap);
+ JKRHeap* old_heap = mDoExt_setCurrentHeap(i_this->getHeap());
+ i_this->field_0x104 = 1; /* setStatus? */
+ i_this->_create();
+ mDoExt_setCurrentHeap(old_heap);
+ return cPhs_COMPLEATE_e;
}