summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2026-09-15 08:59:02 -0700
committerGitHub <noreply@github.com>2026-09-15 11:59:02 -0400
commit43f8aac7dc5d0df7f980651e08b2ba53aa89345f (patch)
treeae7d7acfadfb339470dc0088ba2c4c521ba983d0 /src
parentff768cc1d9ed10e884e006773a5f9ac6a8d6eff4 (diff)
d_operate_wind mostly done (#1207)
Diffstat (limited to 'src')
-rw-r--r--src/d/d_operate_wind.cpp659
1 files changed, 605 insertions, 54 deletions
diff --git a/src/d/d_operate_wind.cpp b/src/d/d_operate_wind.cpp
index 1021f1eb..ae0a8b36 100644
--- a/src/d/d_operate_wind.cpp
+++ b/src/d/d_operate_wind.cpp
@@ -1,34 +1,33 @@
-//
-// Generated by dtk
-// Translation Unit: d_operate_wind.cpp
-//
-
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_operate_wind.h"
#include "d/d_com_inf_game.h"
+#include "d/d_lib.h"
+#include "d/d_kankyo_wether.h"
+#include "d/d_s_play.h"
+#include "d/d_meter.h"
#include "f_op/f_op_msg_mng.h"
#include "m_Do/m_Do_ext.h"
+#include "m_Do/m_Do_controller_pad.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() {
- field_0x08 = 0x1e;
- field_0x0a = 0x5f;
- field_0x0c = 0x9b;
- field_0x0e = 0x10;
+ field_0x08 = 30;
+ field_0x0a = 95;
+ field_0x0c = 155;
+ field_0x0e = 16;
field_0x18 = 100;
- field_0x10 = 0x78;
- field_0x12 = 0x32;
+ field_0x10 = 120;
+ field_0x12 = 50;
field_0x04 = 7.0f;
- field_0x14 = 0x14;
- field_0x16 = 0x28;
+ field_0x14 = 20;
+ field_0x16 = 40;
}
+dOw_HIO_c g_owHIO;
+
void dDlst_Ow_main_c::drawLine(int width, f32 x1, f32 y1, f32 x2, f32 y2) {
J2DDrawLine(x1, y1, x2, y2, color, width);
}
@@ -39,7 +38,8 @@ void dDlst_Ow_main_c::draw() {
graf->setPort();
for (int i = 0; i < mLineMax; i++) {
- // drawLine(6, mX1[i], mY1[i], mX2[i], mY2[i]);
+ // should probably be `drawLine(6, mX1[i], mY1[i], mX2[i], mY2[i]);`
+ // but it reverses instuction order
J2DDrawLine(mX1[i], mY1[i], mX2[i], mY2[i], color, 6);
}
@@ -77,7 +77,7 @@ int dOperate_wind_c::dOw_angleRegular(f32 angle) {
return 135;
else if (angle < 202.5f)
return 180;
- // missing end return
+ // !@bug missing end return
}
/* 8021E7E4-8021E974 .text dOw_stickControl__15dOperate_wind_cFis */
@@ -126,123 +126,654 @@ int dOperate_wind_c::dOw_stickControl(int ret, s16 ang) {
/* 8021E974-8021ED4C .text screenSet__15dOperate_wind_cFv */
void dOperate_wind_c::screenSet() {
- /* Nonmatching */
+ fopMsgM_setPaneData(&field_0x0c, scrn1, 'wdn');
+ fopMsgM_setPaneData(&field_0x44, scrn1, 'wds');
+ fopMsgM_setPaneData(&field_0x7c, scrn1, 'wdw');
+ fopMsgM_setPaneData(&field_0xb4, scrn1, 'wde');
+ fopMsgM_setPaneData(&field_0x54c, scrn1, 'win');
+ fopMsgM_setPaneData(&field_0xec, scrn1, 'wib');
+
+ fopMsgM_setPaneData(&field_0x124[0], scrn1, 'wi21');
+ fopMsgM_setPaneData(&field_0x124[1], scrn1, 'wi22');
+
+ fopMsgM_setPaneData(&field_0x194, scrn1, 'wi2b');
+
+ fopMsgM_setPaneData(&field_0x1cc[0], scrn1, 'n2');
+ fopMsgM_setPaneData(&field_0x1cc[1], scrn1, 's2');
+ fopMsgM_setPaneData(&field_0x1cc[2], scrn1, 'w2');
+ fopMsgM_setPaneData(&field_0x1cc[3], scrn1, 'e2');
+
+ #if VERSION >= VERSION_USA
+ field_0x1cc[0].pane->hide();
+ field_0x1cc[1].pane->hide();
+ field_0x1cc[2].pane->hide();
+ field_0x1cc[3].pane->hide();
+ #endif
+
+ fopMsgM_setPaneData(&field_0x2ac[0], scrn1, 'str1');
+ fopMsgM_setPaneData(&field_0x2ac[1], scrn1, 'str2');
+ fopMsgM_setPaneData(&field_0x2ac[2], scrn1, 'str3');
+ fopMsgM_setPaneData(&field_0x2ac[3], scrn1, 'str4');
+ fopMsgM_setPaneData(&field_0x2ac[4], scrn1, 'str5');
+ fopMsgM_setPaneData(&field_0x2ac[5], scrn1, 'str6');
+ fopMsgM_setPaneData(&field_0x2ac[6], scrn1, 'str7');
+ fopMsgM_setPaneData(&field_0x2ac[7], scrn1, 'str8');
+
+ fopMsgM_setPaneData(&field_0x46c[0], scrn1, 'ci04');
+ fopMsgM_setPaneData(&field_0x46c[1], scrn1, 'ci05');
+ fopMsgM_setPaneData(&field_0x46c[2], scrn1, 'ci06');
+ fopMsgM_setPaneData(&field_0x46c[3], scrn1, 'ci07');
+
+ fopMsgM_setPaneData(&field_0x554, scrn2, 'mask');
+ field_0x554.mInitAlpha = 130;
+
+ #if VERSION == VERSION_PAL
+ if (dComIfGs_getPalLanguage() == 1) {
+ JKRReadTypeResource(shipfontTimg, 0xC00, 'TIMG', "shipfont_o_big.bti", dComIfGp_getWindResArchive());
+ ((J2DPicture*)field_0xb4.pane)->changeTexture(shipfontTimg, 0);
+ } else if (dComIfGs_getPalLanguage() == 2 || dComIfGs_getPalLanguage() == 3 || dComIfGs_getPalLanguage() == 4) {
+ JKRReadTypeResource(shipfontTimg, 0xC00, 'TIMG', "shipfont_o_big.bti", dComIfGp_getWindResArchive());
+ ((J2DPicture*)field_0x7c.pane)->changeTexture(shipfontTimg, 0);
+ }
+ #endif
+
+ ((J2DPicture*)field_0x54c.pane)->getCornerColor(field_0x568);
+ ((J2DPicture*)field_0x124[0].pane)->getCornerColor(field_0x578);
+ ((J2DPicture*)field_0x554.pane)->getCornerColor(field_0x588);
}
/* 8021ED4C-8021EE9C .text alphaSet__15dOperate_wind_cFf */
-void dOperate_wind_c::alphaSet(f32) {
- /* Nonmatching */
+void dOperate_wind_c::alphaSet(f32 i_alpha) {
+ fopMsgM_setNowAlpha(&field_0x0c, i_alpha);
+ fopMsgM_setNowAlpha(&field_0x44, i_alpha);
+ fopMsgM_setNowAlpha(&field_0x7c, i_alpha);
+ fopMsgM_setNowAlpha(&field_0xb4, i_alpha);
+ fopMsgM_setNowAlpha(&field_0x54c, i_alpha);
+
+ for (int i = 0; i < 2; i++) {
+ fopMsgM_setNowAlpha(&field_0x124[i], i_alpha);
+ }
+
+ fopMsgM_setNowAlpha(&field_0x194, i_alpha);
+
+ for (int i = 0; i < 4; i++) {
+ fopMsgM_setNowAlpha(&field_0x1cc[i], i_alpha);
+ }
+
+ for (int i = 0; i < 8; i++) {
+ fopMsgM_setNowAlpha(&field_0x2ac[i], i_alpha);
+ }
+
+ fopMsgM_setNowAlpha(&field_0x46c[0], i_alpha);
+ fopMsgM_setNowAlpha(&field_0x554, i_alpha);
+
+ field_0x8d4 = g_owHIO.field_0x18 * i_alpha;
}
/* 8021EE9C-8021F550 .text arrowColor1__15dOperate_wind_cFv */
void dOperate_wind_c::arrowColor1() {
- /* Nonmatching */
+ JUtility::TColor sp24;
+ JUtility::TColor sp20;
+
+ field_0xec.mUserArea++;
+ if (field_0xec.mUserArea > 30) {
+ field_0xec.mUserArea = 0;
+ }
+
+ if (field_0xec.mUserArea < 10) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, field_0xec.mUserArea, 0);
+ sp20.r = field_0x568.corner1.r + (temp_f1 * (field_0x568.corner0.r - field_0x568.corner1.r));
+ sp20.g = field_0x568.corner1.g + (temp_f1 * (field_0x568.corner0.g - field_0x568.corner1.g));
+ sp20.b = field_0x568.corner1.b + (temp_f1 * (field_0x568.corner0.b - field_0x568.corner1.b));
+ sp20.a = field_0x568.corner1.a + (temp_f1 * (field_0x568.corner0.a - field_0x568.corner1.a));
+ } else if (field_0xec.mUserArea < 15) {
+ sp20 = field_0x568.corner0;
+ } else if (field_0xec.mUserArea < 25) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, 25 - field_0xec.mUserArea, 0);
+ sp20.r = field_0x568.corner1.r + (temp_f1 * (field_0x568.corner0.r - field_0x568.corner1.r));
+ sp20.g = field_0x568.corner1.g + (temp_f1 * (field_0x568.corner0.g - field_0x568.corner1.g));
+ sp20.b = field_0x568.corner1.b + (temp_f1 * (field_0x568.corner0.b - field_0x568.corner1.b));
+ sp20.a = field_0x568.corner1.a + (temp_f1 * (field_0x568.corner0.a - field_0x568.corner1.a));
+ } else {
+ sp20 = field_0x568.corner1;
+ }
+
+ if (field_0xec.mUserArea < 5) {
+ sp24 = field_0x568.corner0;
+ } else if (field_0xec.mUserArea < 15) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, 15 - field_0xec.mUserArea, 0);
+ sp24.r = field_0x568.corner1.r + (temp_f1 * (field_0x568.corner0.r - field_0x568.corner1.r));
+ sp24.g = field_0x568.corner1.g + (temp_f1 * (field_0x568.corner0.g - field_0x568.corner1.g));
+ sp24.b = field_0x568.corner1.b + (temp_f1 * (field_0x568.corner0.b - field_0x568.corner1.b));
+ sp24.a = field_0x568.corner1.a + (temp_f1 * (field_0x568.corner0.a - field_0x568.corner1.a));
+ } else if (field_0xec.mUserArea < 20) {
+ sp24 = field_0x568.corner1;
+ } else {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, field_0xec.mUserArea - 20, 0);
+ sp24.r = field_0x568.corner1.r + (temp_f1 * (field_0x568.corner0.r - field_0x568.corner1.r));
+ sp24.g = field_0x568.corner1.g + (temp_f1 * (field_0x568.corner0.g - field_0x568.corner1.g));
+ sp24.b = field_0x568.corner1.b + (temp_f1 * (field_0x568.corner0.b - field_0x568.corner1.b));
+ sp24.a = field_0x568.corner1.a + (temp_f1 * (field_0x568.corner0.a - field_0x568.corner1.a));
+ }
+
+ ((J2DPicture*)field_0x54c.pane)->setCornerColor(sp20, sp24, sp20, sp24);
}
/* 8021F550-8021FBC0 .text arrowColor2__15dOperate_wind_cFv */
void dOperate_wind_c::arrowColor2() {
- /* Nonmatching */
+ s16 var_r31 = g_owHIO.field_0x14;
+ s16 var_r30 = g_owHIO.field_0x16;
+ JUtility::TColor sp3C;
+ JUtility::TColor sp38;
+
+ field_0x124[0].mUserArea++;
+ if (field_0x124[0].mUserArea > (s16)(var_r30 + (var_r31 + 20))) {
+ field_0x124[0].mUserArea = 0;
+ }
+
+ if (field_0x124[0].mUserArea < 10) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, field_0x124[0].mUserArea, 0);
+ sp38.r = field_0x578.corner0.r + (temp_f1 * (field_0x578.corner1.r - field_0x578.corner0.r));
+ sp38.g = field_0x578.corner0.g + (temp_f1 * (field_0x578.corner1.g - field_0x578.corner0.g));
+ sp38.b = field_0x578.corner0.b + (temp_f1 * (field_0x578.corner1.b - field_0x578.corner0.b));
+ } else if (field_0x124[0].mUserArea < var_r31 + 10) {
+ sp38 = field_0x578.corner1;
+ } else if (field_0x124[0].mUserArea < var_r31 + 20) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, (var_r31 + 20) - field_0x124[0].mUserArea, 0);
+ sp38.r = field_0x578.corner0.r + (temp_f1 * (field_0x578.corner1.r - field_0x578.corner0.r));
+ sp38.g = field_0x578.corner0.g + (temp_f1 * (field_0x578.corner1.g - field_0x578.corner0.g));
+ sp38.b = field_0x578.corner0.b + (temp_f1 * (field_0x578.corner1.b - field_0x578.corner0.b));
+ } else {
+ sp38 = field_0x578.corner0;
+ }
+
+ if (field_0x124[0].mUserArea < var_r31) {
+ sp3C = field_0x578.corner1;
+ } else if (field_0x124[0].mUserArea < var_r31 + 10) {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, (var_r31 + 10) - field_0x124[0].mUserArea, 0);
+ sp3C.r = field_0x578.corner0.r + (temp_f1 * (field_0x578.corner1.r - field_0x578.corner0.r));
+ sp3C.g = field_0x578.corner0.g + (temp_f1 * (field_0x578.corner1.g - field_0x578.corner0.g));
+ sp3C.b = field_0x578.corner0.b + (temp_f1 * (field_0x578.corner1.b - field_0x578.corner0.b));
+ } else if (field_0x124[0].mUserArea < var_r30 + (var_r31 + 10)) {
+ sp3C = field_0x578.corner0;
+ } else {
+ f32 temp_f1 = fopMsgM_valueIncrease(10, field_0x124[0].mUserArea - (var_r30 + (var_r31 + 10)), 0);
+ sp3C.r = field_0x578.corner0.r + (temp_f1 * (field_0x578.corner1.r - field_0x578.corner0.r));
+ sp3C.g = field_0x578.corner0.g + (temp_f1 * (field_0x578.corner1.g - field_0x578.corner0.g));
+ sp3C.b = field_0x578.corner0.b + (temp_f1 * (field_0x578.corner1.b - field_0x578.corner0.b));
+ }
+
+ sp38.a = 0xFF;
+ sp3C.a = 0x96;
+
+ ((J2DPicture*)field_0x124[0].pane)->setCornerColor(sp3C, sp38, sp3C, sp38);
+ ((J2DPicture*)field_0x124[1].pane)->setCornerColor(sp3C, sp38, sp3C, sp38);
}
/* 8021FBC0-80220360 .text maskColor__15dOperate_wind_cFv */
+// NONMATCHING - some reg alloc / stack slightly off
void dOperate_wind_c::maskColor() {
- /* Nonmatching */
+ s16 var_r31 = g_owHIO.field_0x10;
+ JUtility::TColor sp48[4];
+
+ field_0x46c[0].mUserArea++;
+ if (field_0x46c[0].mUserArea >= (s16)(var_r31 * 4)) {
+ field_0x46c[0].mUserArea = 0;
+ }
+
+ f32 var_f1 = fopMsgM_valueIncrease(var_r31, field_0x46c[0].mUserArea % var_r31, 2);
+
+ sp48[0].r = field_0x588.corner0.r + (var_f1 * (field_0x588.corner2.r - field_0x588.corner0.r));
+ sp48[0].g = field_0x588.corner0.g + (var_f1 * (field_0x588.corner2.g - field_0x588.corner0.g));
+ sp48[0].b = field_0x588.corner0.b + (var_f1 * (field_0x588.corner2.b - field_0x588.corner0.b));
+ sp48[0].a = field_0x588.corner0.a + (var_f1 * (field_0x588.corner2.a - field_0x588.corner0.a));
+
+ sp48[1].r = field_0x588.corner1.r + (var_f1 * (field_0x588.corner0.r - field_0x588.corner1.r));
+ sp48[1].g = field_0x588.corner1.g + (var_f1 * (field_0x588.corner0.g - field_0x588.corner1.g));
+ sp48[1].b = field_0x588.corner1.b + (var_f1 * (field_0x588.corner0.b - field_0x588.corner1.b));
+ sp48[1].a = field_0x588.corner1.a + (var_f1 * (field_0x588.corner0.a - field_0x588.corner1.a));
+
+ sp48[2].r = field_0x588.corner2.r + (var_f1 * (field_0x588.corner3.r - field_0x588.corner2.r));
+ sp48[2].g = field_0x588.corner2.g + (var_f1 * (field_0x588.corner3.g - field_0x588.corner2.g));
+ sp48[2].b = field_0x588.corner2.b + (var_f1 * (field_0x588.corner3.b - field_0x588.corner2.b));
+ sp48[2].a = field_0x588.corner2.a + (var_f1 * (field_0x588.corner3.a - field_0x588.corner2.a));
+
+ sp48[3].r = field_0x588.corner3.r + (var_f1 * (field_0x588.corner1.r - field_0x588.corner0.r));
+ sp48[3].g = field_0x588.corner3.g + (var_f1 * (field_0x588.corner1.g - field_0x588.corner0.g));
+ sp48[3].b = field_0x588.corner3.b + (var_f1 * (field_0x588.corner1.b - field_0x588.corner0.b));
+ sp48[3].a = field_0x588.corner3.a + (var_f1 * (field_0x588.corner1.a - field_0x588.corner0.a));
+
+ if (field_0x46c[0].mUserArea < var_r31) {
+ ((J2DPicture*)field_0x554.pane)->setCornerColor(sp48[0], sp48[1], sp48[2], sp48[3]);
+ } else if (field_0x46c[0].mUserArea < var_r31 * 2) {
+ ((J2DPicture*)field_0x554.pane)->setCornerColor(sp48[2], sp48[0], sp48[3], sp48[1]);
+ } else if (field_0x46c[0].mUserArea < var_r31 * 3) {
+ ((J2DPicture*)field_0x554.pane)->setCornerColor(sp48[3], sp48[2], sp48[1], sp48[0]);
+ } else {
+ ((J2DPicture*)field_0x554.pane)->setCornerColor(sp48[1], sp48[3], sp48[0], sp48[2]);
+ }
}
/* 80220360-802207C8 .text arrowDirection__15dOperate_wind_cFv */
void dOperate_wind_c::arrowDirection() {
- /* Nonmatching */
+ f32 stick_value = stick->getValueStick();
+ s16 var_r31 = field_0xec.pane->getRotate();
+
+ if (stick->getValueStick() >= 0.89999998f && fabs(stick_value) - fabs(field_0x8b8) >= 0.0) {
+ int stick_control = dOw_stickControl(field_0x8d0, stick->getAngleStick());
+ if (field_0x8ca == 0 && stick_control != field_0x8d0) {
+ field_0x8d0 = stick_control;
+
+ switch (stick_control) {
+ case 8:
+ if (mDeg != 315) {
+ field_0x8ca = 7;
+ mDeg = 315;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 7:
+ if (mDeg != 0) {
+ field_0x8ca = 7;
+ mDeg = 0;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 6:
+ if (mDeg != 45) {
+ field_0x8ca = 7;
+ mDeg = 45;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 5:
+ if (mDeg != 90) {
+ field_0x8ca = 7;
+ mDeg = 90;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 4:
+ if (mDeg != 135) {
+ field_0x8ca = 7;
+ mDeg = 135;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 3:
+ if (mDeg != 180) {
+ field_0x8ca = 7;
+ mDeg = 180;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 2:
+ if (mDeg != 225) {
+ field_0x8ca = 7;
+ mDeg = 225;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ case 1:
+ if (mDeg != 270) {
+ field_0x8ca = 7;
+ mDeg = 270;
+ mDoAud_seStart(JA_SE_TAKT_WIND_CURSOR);
+ }
+ break;
+ }
+ }
+ } else if (stick->getValueStick() < 0.89999998f && fabs(stick_value) - fabs(field_0x8b8) < 0.0f) {
+ field_0x8d0 = 0;
+ }
+
+ field_0x8b8 = stick_value;
+ if (field_0x8ca > 0) {
+ field_0x8ca--;
+ }
+
+ s16 var_r29 = mDeg - var_r31;
+ if (var_r29 > 180) {
+ var_r29 -= 360;
+ } else if (var_r29 < -180) {
+ var_r29 += 360;
+ }
+
+ if (abs(var_r29) < 16) {
+ field_0x8ca = 0;
+ }
+
+ f32 temp_f1 = var_r29 * (1.0f - fopMsgM_valueIncrease(7, field_0x8ca, 0));
+ var_r31 += (s16)temp_f1;
+ arrowRotate(&field_0xec, var_r31);
}
/* 802207C8-802208C4 .text windSet__15dOperate_wind_cFv */
void dOperate_wind_c::windSet() {
- /* Nonmatching */
+ switch (mDeg) {
+ case 315:
+ dKyw_tact_wind_set(0, -0x6000);
+ break;
+ case 0:
+ dKyw_tact_wind_set(0, -0x8000);
+ break;
+ case 45:
+ dKyw_tact_wind_set(0, 0x6000);
+ break;
+ case 90:
+ dKyw_tact_wind_set(0, 0x4000);
+ break;
+ case 135:
+ dKyw_tact_wind_set(0, 0x2000);
+ break;
+ case 180:
+ dKyw_tact_wind_set(0, 0);
+ break;
+ case 225:
+ dKyw_tact_wind_set(0, -0x2000);
+ break;
+ case 270:
+ dKyw_tact_wind_set(0, -0x4000);
+ break;
+ }
}
/* 802208C4-8022098C .text ringScale__15dOperate_wind_cFf */
-void dOperate_wind_c::ringScale(f32) {
- /* Nonmatching */
+void dOperate_wind_c::ringScale(f32 i_scale) {
+ for (int i = 0; i < 4; i++) {
+ if (i == 0) {
+ field_0x46c[i].mPosCenter.x = mPosX + i_scale * (field_0x46c[i].mPosCenterOrig.x - mPosX);
+ field_0x46c[i].mPosCenter.y = mPosY + i_scale * (field_0x46c[i].mPosCenterOrig.y - mPosY);
+ } else {
+ field_0x46c[i].mPosCenter.x = field_0x46c[i].mPosCenterOrig.x * i_scale;
+ field_0x46c[i].mPosCenter.y = field_0x46c[i].mPosCenterOrig.y * i_scale;
+ }
+
+ fopMsgM_paneScaleXY(&field_0x46c[i], i_scale);
+ }
}
/* 8022098C-80220A60 .text directionTrans__15dOperate_wind_cFf */
-void dOperate_wind_c::directionTrans(f32) {
- /* Nonmatching */
+void dOperate_wind_c::directionTrans(f32 param_0) {
+ f32 var_f30 = param_0 * 80.0f;
+
+ fopMsgM_paneTrans(&field_0x0c, 0.0f, var_f30);
+ fopMsgM_paneTrans(&field_0x44, 0.0f, -var_f30);
+ fopMsgM_paneTrans(&field_0x7c, var_f30, 0.0f);
+ fopMsgM_paneTrans(&field_0xb4, -var_f30, 0.0f);
+
+ fopMsgM_paneTrans(&field_0x1cc[0], 0.0f, var_f30);
+ fopMsgM_paneTrans(&field_0x1cc[1], 0.0f, -var_f30);
+ fopMsgM_paneTrans(&field_0x1cc[2], var_f30, 0.0f);
+ fopMsgM_paneTrans(&field_0x1cc[3], -var_f30, 0.0f);
}
/* 80220A60-80220CD8 .text lineInit__15dOperate_wind_cFf */
-void dOperate_wind_c::lineInit(f32) {
- /* Nonmatching */
+// NONMATCHING - not sure what the temp_r29 pattern is
+void dOperate_wind_c::lineInit(f32 param_0) {
+ f32 temp_f29 = -((-172.0f - REG6_F(5)) * param_0);
+ f32 temp_f28 = (field_0x2ac[0].mPosTopLeftOrig.y - field_0x194.mPosCenterOrig.y) * param_0;
+ f32 temp_f25 = 360.0f / field_0x8ce;
+ f32 var_f24 = 11.25f;
+
+ for (int i = 0; i < field_0x8ce; i++) {
+ f32 var_f27;
+ f32 var_f26;
+
+ int temp_r29 = (i >= 0) ? i : -i;
+ if (temp_r29) {
+ f32 temp_f26 = M_PI * ((101.25f + var_f24) / 180.0f);
+ var_f27 = mPosX + (temp_f28 * std::sinf(temp_f26));
+ var_f26 = mPosY + (temp_f28 * std::cosf(temp_f26));
+ } else {
+ f32 temp_f26_2 = M_PI * ((78.75f + var_f24) / 180.0f);
+ var_f27 = mPosX + (temp_f28 * std::sinf(temp_f26_2));
+ var_f26 = mPosY + (temp_f28 * std::cosf(temp_f26_2));
+ }
+
+ field_0x598[i] = var_f27 + (temp_f29 * std::sinf(M_PI * (var_f24 / 180.0f)));
+ field_0x660[i] = var_f26 + (temp_f29 * std::cosf(M_PI * (var_f24 / 180.0f)));
+ field_0x728[i] = (2.0f * var_f27) - field_0x598[i];
+ field_0x7f0[i] = (2.0f * var_f26) - field_0x660[i];
+
+ if (temp_r29) {
+ field_0x598[i] = var_f27;
+ field_0x660[i] = var_f26;
+ } else {
+ field_0x728[i] = var_f27;
+ field_0x7f0[i] = var_f26;
+ }
+
+ var_f24 += temp_f25;
+ }
}
/* 80220CD8-80220D80 .text lineDraw__15dOperate_wind_cFv */
+// NONMATCHING - weird stuff happening in the loop
void dOperate_wind_c::lineDraw() {
- /* Nonmatching */
+ JUtility::TColor color(0xFF, 0xFF, 0xFF, field_0x8d4);
+ mMain->setLineColor(color);
+ mMain->setLineMax(field_0x8ce);
+
+ for (int i = 0; i < field_0x8ce; i++) {
+ mMain->mX1[i] = field_0x598[i];
+ mMain->mY1[i] = field_0x660[i];
+ mMain->mX2[i] = field_0x728[i];
+ mMain->mY2[i] = field_0x7f0[i];
+ }
}
/* 80220D80-80220E18 .text arrowRotate__15dOperate_wind_cFP18fopMsgM_pane_classs */
-void dOperate_wind_c::arrowRotate(fopMsgM_pane_class*, s16) {
- /* Nonmatching */
+void dOperate_wind_c::arrowRotate(fopMsgM_pane_class* i_pane, s16 i_angle) {
+ if (i_angle < 0) {
+ i_angle += 360;
+ }
+ if (i_angle > 360) {
+ i_angle -= 360;
+ }
+
+ i_pane->pane->rotate(i_pane->mSizeOrig.x / 2, i_pane->mSizeOrig.y / 2, ROTATE_Z, i_angle);
}
/* 80220E18-80221090 .text initialize__15dOperate_wind_cFv */
void dOperate_wind_c::initialize() {
- /* Nonmatching */
+ mTimer = 0;
+ field_0x8ca = 0;
+ field_0x8ce = g_owHIO.field_0x0e;
+ field_0x8d4 = 0;
+ field_0x8d0 = 0;
+
+ field_0xec.mUserArea = 0;
+ field_0x46c[0].mUserArea = 0;
+ field_0x124[0].mUserArea = 30;
+ field_0x124[1].mUserArea = 35;
+
+ ((J2DPicture*)field_0x124[0].pane)->setCornerColor(
+ JUtility::TColor(0xFFFFFF96),
+ JUtility::TColor(0x00FFFFFF),
+ JUtility::TColor(0xFFFFFF96),
+ JUtility::TColor(0x00FFFFFF)
+ );
+
+ ((J2DPicture*)field_0x124[1].pane)->setCornerColor(
+ JUtility::TColor(0xFFFFFF96),
+ JUtility::TColor(0x00FFFFFF),
+ JUtility::TColor(0xFFFFFF96),
+ JUtility::TColor(0x00FFFFFF)
+ );
+
+ mPosX = field_0x46c[0].mPosTopLeftOrig.x + field_0x46c[0].mSizeOrig.x;
+ mPosY = field_0x46c[0].mPosTopLeftOrig.y;
+
+ cXyz* wind_vec = dKyw_get_wind_vec();
+ s16 temp_r3 = cM_atan2s(wind_vec->x, wind_vec->z) + 0x8000;
+ mDeg = dOw_angleRegular(((180.0f * temp_r3) / (f32)0x8000) - 90.0f);
+ arrowRotate(&field_0xec, mDeg);
+ arrowRotate(&field_0x194, mDeg + 90);
+
+ field_0x8b8 = stick->getValueStick();
+ lineInit(0.0f);
}
/* 80221090-802213B0 .text _create__15dOperate_wind_cFv */
void dOperate_wind_c::_create() {
- /* Nonmatching */
+ scrn1 = new J2DScreen();
+ JUT_ASSERT(VERSION_SELECT(965, 965, 990, 990), scrn1 != NULL);
+ scrn1->set("operate_wind.blo", dComIfGp_getWindResArchive());
+
+ scrn2 = new J2DScreen();
+ JUT_ASSERT(VERSION_SELECT(969, 969, 994, 994), scrn2 != NULL);
+ scrn2->set("operate_wind_mask.blo", dComIfGp_getWindResArchive());
+
+ stick = new STControl(5, 2, 3, 2, 1.0f, 1.0f, 0x1000, 0x2000);
+ JUT_ASSERT(VERSION_SELECT(973, 973, 998, 998), stick != NULL);
+
+ mMain = new dDlst_Ow_main_c();
+ JUT_ASSERT(VERSION_SELECT(976, 976, 1001, 1001), mMain != NULL);
+ mMain->setScreen(scrn1);
+
+ mMask = new dDlst_Ow_mask_c();
+ JUT_ASSERT(VERSION_SELECT(980, 980, 1005, 1005), mMask != NULL);
+ mMask->setScreen(scrn2);
+
+ screenSet();
+ initialize();
}
/* 802213B0-8022147C .text _delete__15dOperate_wind_cFv */
void dOperate_wind_c::_delete() {
- /* Nonmatching */
+ delete scrn1;
+ delete scrn2;
+ delete stick;
+ delete mMain;
+ delete mMask;
+ dComIfGp_getWindResArchive()->removeResourceAll();
}
/* 8022147C-8022151C .text _move__15dOperate_wind_cFv */
void dOperate_wind_c::_move() {
- /* Nonmatching */
+ if (!dMenu_flag()) {
+ if (CPad_CHECK_TRIG_A(0)) {
+ windSet();
+ dComIfGp_setOperateWindChangeOff();
+ } else if (CPad_CHECK_TRIG_B(0)) {
+ dComIfGp_setOperateWindCancelOff();
+ }
+
+ arrowColor1();
+ arrowColor2();
+ maskColor();
+ arrowDirection();
+ }
}
/* 8022151C-8022163C .text _draw__15dOperate_wind_cFv */
void dOperate_wind_c::_draw() {
- /* Nonmatching */
+ fopMsgM_setAlpha(&field_0x0c);
+ fopMsgM_setAlpha(&field_0x44);
+ fopMsgM_setAlpha(&field_0x7c);
+ fopMsgM_setAlpha(&field_0xb4);
+ fopMsgM_setAlpha(&field_0x54c);
+
+ for (int i = 0; i < 2; i++) {
+ fopMsgM_setAlpha(&field_0x124[i]);
+ }
+
+ fopMsgM_setAlpha(&field_0x194);
+
+ for (int i = 0; i < 4; i++) {
+ fopMsgM_setAlpha(&field_0x1cc[i]);
+ }
+
+ for (int i = 0; i < 8; i++) {
+ fopMsgM_setAlpha(&field_0x2ac[i]);
+ }
+
+ fopMsgM_setAlpha(&field_0x46c[0]);
+ fopMsgM_setAlpha(&field_0x554);
+
+ lineDraw();
+ dComIfGd_set2DOpa(mMask);
+ dComIfGd_set2DOpa(mMain);
}
/* 8022163C-802216F0 .text _open__15dOperate_wind_cFv */
bool dOperate_wind_c::_open() {
- /* Nonmatching */
+ bool rt = false;
+ if (mTimer < 10) {
+ mTimer++;
+
+ f32 temp_f1 = fopMsgM_valueIncrease(10, mTimer, 0);
+ alphaSet(temp_f1);
+ ringScale(temp_f1);
+
+ f32 temp_f1_2 = fopMsgM_valueIncrease(10, 10 - mTimer, 0);
+ directionTrans(temp_f1_2);
+ lineInit(temp_f1);
+ }
+
+ if (mTimer >= 10) {
+ rt = true;
+ }
+
+ return rt;
}
/* 802216F0-80221770 .text _close__15dOperate_wind_cFv */
bool dOperate_wind_c::_close() {
- /* Nonmatching */
+ s16 temp_r4 = g_owHIO.field_0x18;
+
+ bool rt = false;
+ if (mTimer > 0) {
+ mTimer--;
+
+ f32 temp_f1 = fopMsgM_valueIncrease(temp_r4, mTimer, 0);
+ alphaSet(temp_f1);
+ }
+
+ if (mTimer <= 0) {
+ rt = true;
+ }
+
+ return rt;
}
/* 80221770-80221830 .text _create__5dOw_cFv */
void dOw_c::_create() {
- /* Nonmatching */
dOw_scrn = new dOperate_wind_c();
- JUT_ASSERT(0x478, dOw_scrn != NULL);
+ JUT_ASSERT(VERSION_SELECT(1119, 1119, 1144, 1144), dOw_scrn != NULL);
+
+#if VERSION == VERSION_PAL
+ void* p = heap->alloc(0xC00, 0x20);
+ JUT_ASSERT(1149, p != NULL);
+ dOw_scrn->shipfontTimg = (ResTIMG*)p;
+#endif
+
dOw_scrn->_create();
}
/* 80221830-80221880 .text _delete__5dOw_cFv */
void dOw_c::_delete() {
- /* Nonmatching */
+#if VERSION == VERSION_PAL
+ if (dOw_scrn->shipfontTimg != NULL) {
+ heap->free(dOw_scrn->shipfontTimg);
+ dOw_scrn->shipfontTimg = NULL;
+ }
+#endif
+
dOw_scrn->_delete();
delete dOw_scrn;
}
bool dOw_c::_draw() {
- if (field_0x104) /* getStatus? */
+ if (getStatus() != 0)
dOw_scrn->_draw();
+
return true;
}
/* 80221880-802218B4 .text dOw_Draw__FP5dOw_c */
static BOOL dOw_Draw(dOw_c* i_this) {
- /* Nonmatching */
return i_this->_draw();
}
@@ -250,7 +781,7 @@ void dOw_c::_close() {
if (!dOw_scrn->_close()) {
dOw_scrn->_move();
} else {
- field_0x104 = 0;
+ setStatus(0);
fopMsgM_Delete(this);
}
}
@@ -262,15 +793,26 @@ void dOw_c::_open() {
/* 802218B4-802219A4 .text dOw_Execute__FP5dOw_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();
+ if (i_this->dOw_scrn->_open()) {
+ i_this->dOw_scrn->_move();
+ }
} else {
- // i_this->dOw_scrn->setTimer ?
- i_this->_close();
+ if (wind_flag == 2) {
+ i_this->setTimer(g_owHIO.field_0x08);
+ }
+
+ if (!i_this->dOw_scrn->_close()) {
+ i_this->dOw_scrn->_move();
+ } else {
+ i_this->setStatus(0);
+ fopMsgM_Delete(i_this);
+ }
}
+
wind_flag = dComIfGp_getOperateWind();
mDoExt_setCurrentHeap(old_heap);
return TRUE;
@@ -288,6 +830,9 @@ static BOOL dOw_Delete(dOw_c* i_this) {
i_this->_delete();
mDoExt_setCurrentHeap(old_heap);
fopMsgM_destroyExpHeap(i_this->getHeap());
+#if VERSION == VERSION_DEMO
+ g_owHIO.removeHIO();
+#endif
return TRUE;
}
@@ -295,11 +840,17 @@ static BOOL dOw_Delete(dOw_c* i_this) {
static cPhs_State dOw_Create(msg_class* i_msg) {
dOw_c* i_this = (dOw_c*)i_msg;
+#if VERSION == VERSION_DEMO
+ // "Wind Direction Control Screen
+ g_owHIO.entryHIO("風向操作表示画面");
+#endif
+
JKRExpHeap* heap = fopMsgM_createExpHeap(20000);
- JUT_ASSERT(0x547, heap != NULL);
+ JUT_ASSERT(VERSION_SELECT(1310, 1310, 1351, 1351), heap != NULL);
i_this->setHeap(heap);
+
JKRHeap* old_heap = mDoExt_setCurrentHeap(i_this->getHeap());
- i_this->field_0x104 = 1; /* setStatus? */
+ i_this->status = 1;
i_this->_create();
mDoExt_setCurrentHeap(old_heap);
return cPhs_COMPLEATE_e;