diff --git a/include/d/d_meter2_info.h b/include/d/d_meter2_info.h index 72ca6ad9b2..51f07f4dc3 100644 --- a/include/d/d_meter2_info.h +++ b/include/d/d_meter2_info.h @@ -321,6 +321,7 @@ int dMeter2Info_setNewLetterSender(); bool dMeter2Info_isItemOpenCheck(); bool dMeter2Info_isMapOpenCheck(); s16 dMeter2Info_getNowLifeGauge(); +bool dMeter2Info_isNextStage(const char*, s16, s16, s16); #if WIDESCREEN_SUPPORT void dMeter2Info_onWide2D(); @@ -844,10 +845,6 @@ inline void dMeter2Info_onTempBit(int i_bit) { g_meter2_info.onTempBit(i_bit); } -inline bool dMeter2Info_isNextStage(const char*, s16, s16, s16) { - return false; -} - inline void dMeter2Info_setFloatingMessage(u16 i_msgID, s16 i_msgTimer, bool i_wakuVisible) { g_meter2_info.setFloatingMessage(i_msgID, i_msgTimer, i_wakuVisible); } diff --git a/include/d/d_msg_object.h b/include/d/d_msg_object.h index 45606e4e81..b55ea73904 100644 --- a/include/d/d_msg_object.h +++ b/include/d/d_msg_object.h @@ -562,6 +562,10 @@ inline void dMsgObject_setOffering(u16 i_num) { dComIfGs_setEventReg(0xF8FF, i_num & 0xFF); } +inline void dMsgObject_setLetterNameID(u16 id) { + dMsgObject_getMsgObjectClass()->setLetterNameID(id); +} + class dMsgObject_HowlHIO_c { public: dMsgObject_HowlHIO_c(); diff --git a/include/d/d_path.h b/include/d/d_path.h index d8ac2af674..810e7df04b 100644 --- a/include/d/d_path.h +++ b/include/d/d_path.h @@ -20,7 +20,7 @@ struct dPath { /* 0x2 */ u16 m_nextID; /* 0x4 */ u8 field_0x4; /* 0x5 */ bool m_closed; - /* 0x6 */ u8 field_0x6; + /* 0x6 */ u8 swbit; /* 0x7 */ u8 field_0x7; /* 0x8 */ dPnt* m_points; }; diff --git a/include/d/d_stage.h b/include/d/d_stage.h index d18be4f09f..d01e0243d7 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -263,7 +263,7 @@ struct dStage_MemoryConfig_c { // PATH / RPAT struct dPath; struct dStage_dPath_c { - /* 0x0 */ int m_num; + /* 0x0 */ int num; /* 0x4 */ dPath* m_path; }; diff --git a/include/d/d_vibration.h b/include/d/d_vibration.h index 204f6e759c..4018acea50 100644 --- a/include/d/d_vibration.h +++ b/include/d/d_vibration.h @@ -47,18 +47,21 @@ class dVibTest_c : public JORReflexible { public: dVibTest_c(); + void Init(); + void setDefault(); + virtual void listenPropertyEvent(const JORPropertyEvent*); virtual void genMessage(JORMContext*); - virtual ~dVibTest_c() {} + virtual ~dVibTest_c(); - /* 0x04 */ s8 field_0x4; + /* 0x04 */ s8 id; /* 0x06 */ u16 m_pattern; /* 0x08 */ u16 m_pattern2; /* 0x0A */ u16 field_0xa; /* 0x0C */ s16 m_randombit; /* 0x0E */ s16 m_length; /* 0x10 */ int field_0x10; - /* 0x14 */ int m_vibswitch; + /* 0x14 */ s32 m_vibswitch; /* 0x18 */ u16 m_displayDbg; }; @@ -82,6 +85,10 @@ public: void Pause(); void Remove(); + #if DEBUG + int testShake(); + #endif + static const vib_pattern MS_patt[VIBMODE_S_MAX]; static const vib_pattern CS_patt[VIBMODE_S_MAX]; static const vib_pattern MQ_patt[VIBMODE_Q_MAX]; @@ -123,4 +130,7 @@ private: /* 0x8C */ s32 mMode; }; // Size: 0x90 +extern const char* shock_names[VIBMODE_S_MAX]; +extern const char* quake_names[VIBMODE_Q_MAX]; + #endif /* D_D_VIBRATION_H */ diff --git a/include/m_Do/m_Do_controller_pad.h b/include/m_Do/m_Do_controller_pad.h index 48d5256ea2..588c5950e5 100644 --- a/include/m_Do/m_Do_controller_pad.h +++ b/include/m_Do/m_Do_controller_pad.h @@ -60,7 +60,7 @@ public: static f32 getAnalogR(u32 pad) { return getCpadInfo(pad).mTriggerRight; } static f32 getAnalogL(u32 pad) { return getCpadInfo(pad).mTriggerLeft; } static BOOL isConnect(u32 pad) { return JUTGamePad::getPortStatus((JUTGamePad::EPadPort)pad) == 0; } - static void startMotorWave(u32 pad, void* data, JUTGamePad::CRumble::ERumble rumble, u32 length) { + static void startMotorWave(u32 pad, u8* data, JUTGamePad::CRumble::ERumble rumble, u32 length) { m_gamePad[pad]->startMotorWave(data, rumble, length); } static void stopMotor(u32 pad) { m_gamePad[pad]->stopMotor(); } diff --git a/libs/JSystem/include/JSystem/JUtility/JUTGamePad.h b/libs/JSystem/include/JSystem/JUtility/JUTGamePad.h index bf939f0831..30bf685700 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTGamePad.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTGamePad.h @@ -117,7 +117,7 @@ public: } void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); } - void stopMotor() { mRumble.stopMotor(mPortNum, false); } + void stopMotor() { mRumble.stopMotor(mPortNum); } void stopMotorHard() { CRumble::stopMotorHard(mPortNum); } static s8 getPortStatus(EPadPort port) { @@ -233,7 +233,7 @@ public: /* 0x10 */ u8* field_0x10; }; // Size: 0x14 - void startMotorWave(void* data, CRumble::ERumble rumble, u32 length) { + void startMotorWave(u8* data, CRumble::ERumble rumble, u32 length) { mRumble.startPatternedRumble(data, rumble, length); } diff --git a/src/SSystem/SComponent/c_m3d_g_cyl.cpp b/src/SSystem/SComponent/c_m3d_g_cyl.cpp index 19bf8d795c..c2f292e08d 100644 --- a/src/SSystem/SComponent/c_m3d_g_cyl.cpp +++ b/src/SSystem/SComponent/c_m3d_g_cyl.cpp @@ -6,6 +6,8 @@ #include "SSystem/SComponent/c_m3d_g_cyl.h" #include "SSystem/SComponent/c_m3d.h" +#include "JSystem/JUtility/JUTAssert.h" + cM3dGCyl::cM3dGCyl(const cXyz* center, f32 radius, f32 height) { SetC(*center); SetR(radius); @@ -24,21 +26,30 @@ void cM3dGCyl::Set(const cXyz& center, f32 radius, f32 height) { SetH(height); } -void cM3dGCyl::SetC(const cXyz& center) { - mCenter = center; +void cM3dGCyl::SetC(const cXyz& pos) { + JUT_ASSERT(67, !isnan(pos.x)); + JUT_ASSERT(68, !isnan(pos.y)); + JUT_ASSERT(69, !isnan(pos.z)); + + JUT_ASSERT(72, -1.0e32f < pos.x && pos.x < 1.0e32f && -1.0e32f < pos.y && pos.y < 1.0e32f && -1.0e32f < pos.z && pos.z < 1.0e32f); + + mCenter = pos; } -void cM3dGCyl::SetH(f32 height) { - mHeight = height; +void cM3dGCyl::SetH(f32 h) { + JUT_ASSERT(82, !isnan(h)); + JUT_ASSERT(83, -1.0e32f < h && h < 1.0e32f); + mHeight = h; } -void cM3dGCyl::SetR(f32 radius) { - mRadius = radius; +void cM3dGCyl::SetR(f32 r) { + JUT_ASSERT(106, !isnan(r)); + JUT_ASSERT(107, -1.0e32f < r && r < 1.0e32f); + mRadius = r; } bool cM3dGCyl::cross(const cM3dGSph* other, cXyz* out) const { - f32 f; - return cM3d_Cross_CylSph(this, other, out, &f); + return cM3d_Cross_CylSph(this, other, out); } bool cM3dGCyl::cross(const cM3dGCyl* other, cXyz* out) const { diff --git a/src/SSystem/SComponent/c_m3d_g_sph.cpp b/src/SSystem/SComponent/c_m3d_g_sph.cpp index 3fd65af53a..9d730b0579 100644 --- a/src/SSystem/SComponent/c_m3d_g_sph.cpp +++ b/src/SSystem/SComponent/c_m3d_g_sph.cpp @@ -6,8 +6,16 @@ #include "SSystem/SComponent/c_m3d_g_sph.h" #include "SSystem/SComponent/c_m3d.h" -void cM3dGSph::SetC(const cXyz& center) { - mCenter = center; +#include "JSystem/JUtility/JUTAssert.h" + +void cM3dGSph::SetC(const cXyz& p) { + JUT_ASSERT(19, !isnan(p.x)); + JUT_ASSERT(20, !isnan(p.y)); + JUT_ASSERT(21, !isnan(p.z)); + + JUT_ASSERT(24, -1.0e32f < p.x && p.x < 1.0e32f && -1.0e32f < p.y && p.y < 1.0e32f && -1.0e32f < p.z && p.z < 1.0e32f); + + mCenter = p; } void cM3dGSph::Set(const cXyz& center, f32 radius) { @@ -20,8 +28,10 @@ void cM3dGSph::Set(const cM3dGSphS& other) { SetR(other.mRadius); } -void cM3dGSph::SetR(f32 radius) { - mRadius = radius; +void cM3dGSph::SetR(f32 r) { + JUT_ASSERT(54, !isnan(r)); + JUT_ASSERT(55, -1.0e32f < r && r < 1.0e32f); + mRadius = r; } bool cM3dGSph::cross(const cM3dGSph* other, cXyz* out) const { diff --git a/src/d/actor/d_a_npc_tk.cpp b/src/d/actor/d_a_npc_tk.cpp index adf3a00575..8ecae48dd1 100644 --- a/src/d/actor/d_a_npc_tk.cpp +++ b/src/d/actor/d_a_npc_tk.cpp @@ -2014,7 +2014,7 @@ void daNPC_TK_c::executeWolfPerch() { mWolfPathData = dPath_GetRoomPath(mpPath1->m_nextID, fopAcM_GetRoomNo(this)); JUT_ASSERT(2498, mWolfPathData != NULL); - field_0x6ea = mWolfPathData->field_0x6; + field_0x6ea = mWolfPathData->swbit; field_0x6e8 = mWolfPathData->field_0x4; field_0x6e9 = mWolfPathData->field_0x7; field_0x6d0.Init(mWolfPathData); diff --git a/src/d/actor/d_a_tag_sppath.cpp b/src/d/actor/d_a_tag_sppath.cpp index 81fbe04184..9fdb00fe55 100644 --- a/src/d/actor/d_a_tag_sppath.cpp +++ b/src/d/actor/d_a_tag_sppath.cpp @@ -189,7 +189,7 @@ int daTagSppath_c::execute() { } if (mpBestPath->field_0x4 == 0) { - if (mpBestPath->field_0x6 == 0xff || fopAcM_isSwitch(this, mpBestPath->field_0x6) == 0) { + if (mpBestPath->swbit == 0xff || fopAcM_isSwitch(this, mpBestPath->swbit) == 0) { field_0x6e8 = 1; } else { field_0x6e8 = 2; diff --git a/src/d/d_meter2_info.cpp b/src/d/d_meter2_info.cpp index b74bab0c5d..3e8d2601c1 100644 --- a/src/d/d_meter2_info.cpp +++ b/src/d/d_meter2_info.cpp @@ -11,6 +11,8 @@ #include "d/d_meter_map.h" #include "d/d_msg_class.h" #include "d/d_msg_object.h" +#include "d/d_meter_HIO.h" + #include enum ITEMICON_RES_FILE_ID { @@ -362,19 +364,18 @@ void dMeter2Info_c::getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_ } JMSMesgInfo_c* bmg_inf = (JMSMesgInfo_c*)(msgRes + sizeof(bmg_header_t)); - u8* bmg_data = (u8*)bmg_inf + bmg_inf->header.size + sizeof(bmg_section_t); // pointer to start of message data + u8* bmg_data = (u8*)bmg_inf + bmg_inf->header.size; + u8* string_data = bmg_data + sizeof(bmg_section_t); // pointer to start of message data char* string_ptr = NULL; for (u16 i = 0; i < bmg_inf->entry_num; i++) { - u8* entry = ((u8*)bmg_inf + (i * sizeof(JMSMesgEntry_c))); - // check if i_stringID equals the message entry "Message ID" - if (i_stringID == *(u16*)(entry + 0x14)) { - string_ptr = (char*)(bmg_data + *(u32*)(entry + 0x10)); // use entry "String Offset" to get string pointer + if (i_stringID == bmg_inf->entries[i].message_id) { + string_ptr = (char*)(string_data + bmg_inf->entries[i].string_offset); // use entry "String Offset" to get string pointer strcpy(o_string, string_ptr); if (i_msgEntry != NULL) { - memcpy(i_msgEntry, entry + 0x10, sizeof(JMSMesgEntry_c)); + memcpy(i_msgEntry, &bmg_inf->entries[i], sizeof(JMSMesgEntry_c)); } return; @@ -508,6 +509,10 @@ void dMeter2Info_c::getStringKanji(u32 i_stringID, char* o_string, JMSMesgEntry_ } } +static void dummyString() { + OS_REPORT("レボ用ID=====>%d, %d\n"); +} + f32 dMeter2Info_c::getStringLength(J2DTextBox* i_textbox, char* i_string) { f32 str_width = 0.0f; f32 str_len = 0.0f; @@ -1003,6 +1008,104 @@ s16 dMeter2Info_c::get4thTexture(u8 i_itemType) { } void dMeter2Info_c::set1stColor(u8 i_itemType, J2DPicture* i_pic) { + // TODO: probably some way to rectify this for both versions + #if VERSION == VERSION_SHIELD_DEBUG + static JUtility::TColor const black_color[37] = { + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x60, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0xC0, 0x00), + JUtility::TColor(0xA0, 0x60, 0x00, 0x00), JUtility::TColor(0xA0, 0x00, 0x00, 0x00), JUtility::TColor(0x40, 0x00, 0x60, 0x00), + JUtility::TColor(0xE0, 0x00, 0x00, 0x00), JUtility::TColor(0x40, 0x40, 0x40, 0x00), JUtility::TColor(0x6E, 0x6E, 0x64, 0x00), + JUtility::TColor(0x32, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x7F, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x7F, 0x00), + JUtility::TColor(0xAF, 0x9B, 0x6E, 0x00), JUtility::TColor(0xAA, 0x9B, 0x6E, 0x00), JUtility::TColor(0x55, 0x37, 0x14, 0x00), + JUtility::TColor(0x6E, 0x6E, 0x6E, 0x00), JUtility::TColor(0x6E, 0x6E, 0x6E, 0x00), JUtility::TColor(0xFF, 0x58, 0x00, 0x00), + JUtility::TColor(0x6C, 0x3E, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x32, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x7F, 0x00), JUtility::TColor(0x00, 0x7F, 0x00, 0x00), JUtility::TColor(0x55, 0x37, 0x14, 0x00), + JUtility::TColor(0x00, 0x00, 0x22, 0x00), JUtility::TColor(0x2B, 0x18, 0x22, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x46, 0x46, 0x41, 0x00), JUtility::TColor(0x46, 0x46, 0x41, 0x00), JUtility::TColor(0x46, 0x46, 0x41, 0x00), + JUtility::TColor(0x46, 0x46, 0x41, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), + }; + + static JUtility::TColor const white_color[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0x60, 0xFF, 0x00, 0xFF), JUtility::TColor(0x00, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0x00, 0xFF), JUtility::TColor(0xFF, 0x80, 0x80, 0xFF), JUtility::TColor(0xBE, 0x40, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xC0, 0x00, 0xFF), JUtility::TColor(0xC0, 0xC0, 0xC0, 0xFF), JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xD2, 0xAA, 0xFF), JUtility::TColor(0xEF, 0xF5, 0xC9, 0xFF), JUtility::TColor(0xB0, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xF0, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xF0, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xD7, 0xFF), + JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xC2, 0xFF), + JUtility::TColor(0xFF, 0x9D, 0x00, 0xFF), JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF), JUtility::TColor(0xFF, 0xD2, 0xAA, 0xFF), + JUtility::TColor(0xB0, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xEF, 0xF5, 0xC9, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xD7, 0xFF), + JUtility::TColor(0xD7, 0xCF, 0xF5, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x33, 0xFF), JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF), + JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), + JUtility::TColor(0xF5, 0xF5, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_lu[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), + JUtility::TColor(0xFF, 0x78, 0xAF, 0xFF), JUtility::TColor(0x5C, 0xB4, 0x16, 0xFF), JUtility::TColor(0xA4, 0xFF, 0x00, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x00, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0x78, 0xAF, 0xFF), + JUtility::TColor(0xA4, 0xFF, 0x00, 0xFF), JUtility::TColor(0x5C, 0xB4, 0x16, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x00, 0xFF), + JUtility::TColor(0xC9, 0xB4, 0xFF, 0xFF), JUtility::TColor(0x3C, 0x0A, 0x00, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xA0, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_ru[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), + JUtility::TColor(0xFF, 0xFF, 0x73, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x2A, 0xFF), JUtility::TColor(0x98, 0xFF, 0x00, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x73, 0xFF), + JUtility::TColor(0x98, 0xFF, 0x00, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x2A, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0x39, 0xFF), JUtility::TColor(0xFF, 0xFF, 0x00, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0x00), JUtility::TColor(0xFF, 0xA0, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_ld[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0x78, 0x6E, 0x3C, 0xFF), + JUtility::TColor(0xFF, 0x00, 0x00, 0xFF), JUtility::TColor(0x3C, 0x32, 0x50, 0xFF), JUtility::TColor(0x00, 0x00, 0x74, 0xFF), + JUtility::TColor(0xFA, 0xC8, 0x9B, 0xFF), JUtility::TColor(0xFA, 0xC8, 0x9B, 0xFF), JUtility::TColor(0x46, 0x87, 0x00, 0xFF), + JUtility::TColor(0x5A, 0xB4, 0xB4, 0xFF), JUtility::TColor(0x5A, 0xB4, 0xB4, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0xFF, 0x00, 0x00, 0xFF), + JUtility::TColor(0x00, 0x00, 0x74, 0xFF), JUtility::TColor(0x3C, 0x32, 0x50, 0xFF), JUtility::TColor(0x46, 0x87, 0x00, 0xFF), + JUtility::TColor(0x3C, 0x32, 0x50, 0x49), JUtility::TColor(0xFF, 0xFF, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), + JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), + JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0xE0, 0x00, 0xE0, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_rd[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0x78, 0x6E, 0x3C, 0xFF), + JUtility::TColor(0xFF, 0x96, 0x00, 0xFF), JUtility::TColor(0x55, 0x42, 0x00, 0xFF), JUtility::TColor(0x61, 0x48, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xAA, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xAA, 0xFF), JUtility::TColor(0xAF, 0x91, 0x23, 0xFF), + JUtility::TColor(0xE6, 0xFA, 0xFF, 0xFF), JUtility::TColor(0xE6, 0xFA, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0xFF, 0x96, 0x00, 0xFF), + JUtility::TColor(0x61, 0x48, 0xFF, 0xFF), JUtility::TColor(0x55, 0x42, 0x00, 0xFF), JUtility::TColor(0xAF, 0x91, 0x23, 0xFF), + JUtility::TColor(0x3C, 0x09, 0x4E, 0xFF), JUtility::TColor(0xBA, 0x98, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), + JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0x00, 0x00, 0x00, 0xFF), + JUtility::TColor(0x00, 0x00, 0x00, 0xFF), JUtility::TColor(0xE0, 0x00, 0xE0, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + #else static GXColor const black_color[37] = { {0x00, 0x00, 0x00, 0x00}, {0x00, 0x60, 0x00, 0x00}, {0x00, 0x00, 0xC0, 0x00}, {0xA0, 0x60, 0x00, 0x00}, {0xA0, 0x00, 0x00, 0x00}, {0x40, 0x00, 0x60, 0x00}, @@ -1098,6 +1201,7 @@ void dMeter2Info_c::set1stColor(u8 i_itemType, J2DPicture* i_pic) { {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, }; + #endif i_pic->setBlackWhite(*(JUtility::TColor*)&black_color[i_itemType], *(JUtility::TColor*)&white_color[i_itemType]); @@ -1108,6 +1212,104 @@ void dMeter2Info_c::set1stColor(u8 i_itemType, J2DPicture* i_pic) { } void dMeter2Info_c::set2ndColor(u8 i_itemType, J2DPicture* i_pic) { + // TODO: probably some way to rectify this for both versions + #if VERSION == VERSION_SHIELD_DEBUG + static JUtility::TColor const black_color[37] = { + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x86, 0xD4, 0x00), JUtility::TColor(0xE6, 0x1E, 0xFF, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), JUtility::TColor(0x00, 0x00, 0x00, 0x00), + JUtility::TColor(0x00, 0x00, 0x00, 0x00), + }; + + static JUtility::TColor const white_color[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xF5, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xC8, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_lu[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0x00, 0x00, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_ru[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0x00, 0xFF, 0xFF, 0x58), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x58), JUtility::TColor(0xFF, 0xFF, 0xFF, 0x58), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0x58), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_ld[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + + static JUtility::TColor const vertex_color_rd[37] = { + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xCD, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xCD, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF), + }; + #else static GXColor const black_color[37] = { {0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00}, @@ -1203,6 +1405,7 @@ void dMeter2Info_c::set2ndColor(u8 i_itemType, J2DPicture* i_pic) { {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF}, }; + #endif i_pic->setBlackWhite(*(JUtility::TColor*)&black_color[i_itemType], *(JUtility::TColor*)&white_color[i_itemType]); @@ -1235,6 +1438,8 @@ void dMeter2Info_c::set3rdColor(u8 i_itemType, J2DPicture* i_pic) { } void dMeter2Info_c::set4thColor(u8 i_itemType, J2DPicture* i_pic) { + UNUSED(i_itemType); + i_pic->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0xff, 0xff, 0xff, 0xff)); i_pic->setCornerColor( JUtility::TColor(0xff, 0xff, 0xff, 0xff), JUtility::TColor(0xff, 0xff, 0xff, 0xff), @@ -1443,6 +1648,18 @@ u8 dMeter2Info_getPixel(f32 i_posX, f32 i_posY, f32 param_2, f32 param_3, f32 i_ return (var_r24 & 0x7000) != 0; } +bool dMeter2Info_isNextStage(const char* i_name, s16 i_roomNo, s16 i_point, s16 i_layer) { + if (strcmp(dComIfGp_getNextStageName(), i_name) == 0 + && dComIfGp_getNextStageRoomNo() == i_roomNo + && dComIfGp_getNextStagePoint() == i_point + && dComIfGp_getNextStageLayer() == i_layer + ) { + return true; + } + + return false; +} + void dMeter2Info_setCloth(u8 i_clothId, bool i_offItemBit) { switch (i_clothId) { case dItemNo_WEAR_CASUAL_e: @@ -1586,6 +1803,7 @@ u8 dMeter2Info_getNewLetterNum() { } int dMeter2Info_setNewLetterSender() { + int ret = 0; u8 check = 0; for (int i = 0; i < 0x40; i++) { @@ -1593,10 +1811,9 @@ int dMeter2Info_setNewLetterSender() { u16 letterEvent = dMenu_Letter::getLetterEventFlag(i); if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[letterEvent])) { if (check == 0) { - u16 letterName = dMenu_Letter::getLetterName(i); - dMsgObject_c::setLetterNameID(letterName); + dMsgObject_setLetterNameID(dMenu_Letter::getLetterName(i)); } else { - dMsgObject_c::setLetterNameID(0); + dMsgObject_setLetterNameID(0); return 0; } check++; @@ -1604,7 +1821,7 @@ int dMeter2Info_setNewLetterSender() { } } - return 0; + return ret; } int dMeter2Info_recieveLetter() { @@ -1636,6 +1853,33 @@ int dMeter2Info_recieveLetter() { return rv; } +#if WIDESCREEN_SUPPORT +f32 dMeter2Info_getWide2DPosX(f32* param_0) { + J2DOrthoGraph graf(0.0f, 0.0f, 640.0f, 456.0f, -1.0f, 1.0f); + graf.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), -1.0f, 1.0f); + JGeometry::TBox2* bounds = graf.getBounds(); + const JGeometry::TBox2* ortho = graf.getOrtho(); + + f32 var_f31 = 304.0f; + f32 var_f30 = 608.0f / (ortho->f.x - ortho->i.x); + f32 var_f29 = *param_0 - var_f31; + *param_0 = var_f29 * var_f30 + var_f31; + return *param_0; +} + +void dMeter2Info_onWide2D() { + g_ringHIO.updateOnWide(); + g_drawHIO.updateOnWide(); +} + +void dMeter2Info_offWide2D() { + g_ringHIO.updateOffWide(); + g_drawHIO.updateOffWide(); +} +#endif + +void dMeter2Info_set2DVibrationT() {} + void dMeter2Info_set2DVibration() {} void dMeter2Info_set2DVibrationM() {} diff --git a/src/d/d_path.cpp b/src/d/d_path.cpp index a01cfdc8a6..b1fa3b7891 100644 --- a/src/d/d_path.cpp +++ b/src/d/d_path.cpp @@ -8,7 +8,38 @@ #include "d/d_path.h" #include "d/d_com_inf_game.h" -dPnt* dPath_GetPnt(dPath const* path, int pnt_index) { +#if DEBUG +#include "d/d_debug_viewer.h" +#endif + +class dPath_HIO : public JORReflexible { +public: + dPath_HIO() {} + ~dPath_HIO(); + + void genMessage(JORMContext* mctx) { + mctx->genCheckBox("デバッグ表示", &flags, 2); + mctx->genSlider("部屋番号", &roomNo, -2, 64); + mctx->genLabel("-3=現在プレイヤーのいる部屋, -2=旧常駐、-1=常駐", 0); + } + + void Ct() { + flags = 0; + roomNo = -3; + } + + int GetRoomNo() { return roomNo; } + bool ChkDispLine() { return flags & 2; } + + /* 0x4 */ s8 id; + /* 0x6 */ u16 flags; + /* 0x8 */ s16 roomNo; +}; + +dPnt* dPath_GetPnt(const dPath* path, int pnt_index) { + JUT_ASSERT(27, path != NULL); + JUT_ASSERT(28, 0 <= pnt_index && pnt_index < path->m_num); + if (path == NULL || path->m_points == NULL || pnt_index < 0 || pnt_index >= path->m_num) { return NULL; } @@ -17,116 +48,212 @@ dPnt* dPath_GetPnt(dPath const* path, int pnt_index) { } dPath* dPath_GetRoomPath(int path_index, int room_no) { - dStage_dPath_c* path; + dStage_dPath_c* pd; if (room_no == -1) { - path = dComIfGp_getStage()->getPath2Inf(); + dStage_dt_c* stage = dComIfGp_getStage(); + pd = stage->getPath2Inf(); } else { + JUT_ASSERT(58, 0 <= room_no && room_no < 64); dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(room_no); if (roomDt == NULL) { return NULL; } - path = roomDt->getPath2Inf(); + pd = roomDt->getPath2Inf(); } - if (path == NULL || path_index < 0 || path_index >= path->m_num) { + if (pd == NULL || path_index < 0 || path_index >= pd->num) { return NULL; } - return &path->m_path[path_index]; + return &pd->m_path[path_index]; } -dPath* dPath_GetNextRoomPath(dPath const* p_path, int room_no) { - dStage_dPath_c* path; +dPath* dPath_GetNextRoomPath(const dPath* path, int room_no) { + dStage_dPath_c* pd; if (room_no == -1) { - path = dComIfGp_getStage()->getPath2Inf(); + dStage_dt_c* stage = dComIfGp_getStage(); + pd = stage->getPath2Inf(); } else { dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(room_no); if (roomDt == NULL) { return NULL; } - path = roomDt->getPath2Inf(); + pd = roomDt->getPath2Inf(); } - int next_id = p_path->m_nextID; - if (path == NULL || next_id == 0xFFFF) { + int next_id = path->m_nextID; + if (pd == NULL || next_id == 0xFFFF) { return NULL; } - if (next_id < 0 || next_id >= path->m_num) { + JUT_ASSERT(111, 0 <= next_id && next_id < pd->num); + if (next_id < 0 || next_id >= pd->num) { return NULL; } - return &path->m_path[next_id]; + return &pd->m_path[next_id]; } #if !PLATFORM_GCN // Fakematch due to differing return type on non-GCN platforms -int dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) { +int dPath_GetPolyRoomPathVec(const cBgS_PolyInfo& polyinfo, cXyz* vec, int* param_2) #else -u8 dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) { +u8 dPath_GetPolyRoomPathVec(const cBgS_PolyInfo& polyinfo, cXyz* vec, int* param_2) #endif - int roomId = dComIfG_Bgsp().GetRoomId(poly); - int roomPathId = dComIfG_Bgsp().GetRoomPathId(poly); +{ + int room_no = dComIfG_Bgsp().GetRoomId(polyinfo); + int path_idx = dComIfG_Bgsp().GetRoomPathId(polyinfo); - p_pathVec->x = 0.0f; - p_pathVec->y = 0.0f; - p_pathVec->z = 0.0f; + vec->x = 0.0f; + vec->y = 0.0f; + vec->z = 0.0f; *param_2 = 0; - if (roomId == -1) { + if (room_no == -1) { return 0; } - dPath* path = dPath_GetRoomPath(roomPathId, roomId); + dPath* path = dPath_GetRoomPath(path_idx, room_no); if (path == NULL) { return 0; } - if (path->field_0x6 != 0xFF && dComIfGs_isSwitch(path->field_0x6, roomId)) { + if (path->swbit != 0xFF && dComIfGs_isSwitch(path->swbit, room_no)) { return 0; } - int pnt_no = dComIfG_Bgsp().GetRoomPathPntNo(poly); + int pnt_no = dComIfG_Bgsp().GetRoomPathPntNo(polyinfo); if (pnt_no == 0xFF || pnt_no < 0 || pnt_no >= path->m_num) { return 0; } - dPnt* pnt_start = path->m_points; - dPnt* pnt_end = &pnt_start[pnt_no]; + dPnt* pnt_end = &path->m_points[pnt_no]; dPnt* pnt_begin; if (pnt_no == path->m_num - 1) { - pnt_begin = pnt_start; + pnt_begin = path->m_points; } else { - pnt_begin = &pnt_start[pnt_no + 1]; + pnt_begin = &path->m_points[pnt_no + 1]; } - p_pathVec->x = pnt_begin->m_position.x - pnt_end->m_position.x; - p_pathVec->y = pnt_begin->m_position.y - pnt_end->m_position.y; - p_pathVec->z = pnt_begin->m_position.z - pnt_end->m_position.z; + vec->x = pnt_begin->m_position.x - pnt_end->m_position.x; + vec->y = pnt_begin->m_position.y - pnt_end->m_position.y; + vec->z = pnt_begin->m_position.z - pnt_end->m_position.z; *param_2 = path->field_0x4; return 1; } +#if DEBUG +dPath_HIO::~dPath_HIO() {} + +static dPath_HIO s_hio; +#endif + #if VERSION == VERSION_SHIELD_DEBUG void dPath_Ct() { #if DEBUG + s_hio.Ct(); + s_hio.id = mDoHIO_CREATE_CHILD("レール", &s_hio); #endif } void dPath_Dt() { - #if DEBUG - #endif + mDoHIO_DELETE_CHILD(s_hio.id); } void dPath_Move() {} void dPath_Draw() { #if DEBUG + if (s_hio.ChkDispLine()) { + static int start_counter; + int counter = start_counter / 20; + dStage_dPath_c* pd; + + int hio_roomNo = s_hio.GetRoomNo(); + if (hio_roomNo == -3) { + int roomNo = dComIfGp_roomControl_getStayNo(); + dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo); + if (roomDt == NULL) { + return; + } + + pd = roomDt->getPath2Inf(); + } else if (hio_roomNo == -2) { + pd = dComIfGp_getStage()->getPathInf(); + } else if (hio_roomNo == -1) { + pd = dComIfGp_getStage()->getPath2Inf(); + } else { + dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(hio_roomNo); + if (roomDt == NULL) { + return; + } + + pd = roomDt->getPath2Inf(); + } + + if (pd != NULL) { + dPath* path = pd->m_path; + for (int i = 0; i < pd->num; i++) { + if (path->m_num >= 1) { + dPnt* pnt = path->m_points; + cXyz start_pos; + cXyz end_pos; + + for (int j = 0; j < path->m_num - 1; j++) { + start_pos.set(pnt[0].m_position); + end_pos.set(pnt[1].m_position); + + if (counter == 0) { + dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0xFF, 0xFF, 0xFF}, TRUE, 12); + } else { + dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0, 0, 0xFF}, TRUE, 12); + } + + counter++; + if (counter >= 8) { + counter = 0; + } + + pnt++; + } + + if (dPath_ChkClose(path)) { + start_pos.set(pnt[0].m_position); + end_pos.set(path[1].m_points->m_position); + + if (counter == 0) { + dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0xFF, 0xFF, 0xFF}, TRUE, 12); + } else { + dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0, 0, 0xFF}, TRUE, 12); + } + + counter++; + if (counter >= 8) { + counter = 0; + } + } + } + + path++; + } + } + + start_counter--; + if (start_counter < 0) { + start_counter = 160; + } + } #endif } + +static void dummy() { + cXyz pos; + GXColor color; + dDbVw_drawSphereOpa(pos, 0.0f, color, 0); +} #endif diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index f44f432d2f..0bb387a01f 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -2104,7 +2104,7 @@ static int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int entryNum, i_stage->setPathInfo(path_c); - for (int i = 0; i < path_c->m_num; i++) { + for (int i = 0; i < path_c->num; i++) { if ((uintptr_t)path->m_points < 0x80000000) { path->m_points = (dPnt*)((uintptr_t)path->m_points + i_stage->getPntInf()->m_pnt_offset); } @@ -2129,7 +2129,7 @@ static int dStage_rpatInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, vo dPath* pPath = pStagePath->m_path; i_stage->setPath2Info(pStagePath); - for (s32 i = 0; i < pStagePath->m_num; pPath++, i++, (void)0) { + for (s32 i = 0; i < pStagePath->num; pPath++, i++, (void)0) { if ((uintptr_t)pPath->m_points >= 0x80000000) { continue; } diff --git a/src/d/d_vib_pattern.cpp b/src/d/d_vib_pattern.cpp index d8263b45bd..6c06016cf5 100644 --- a/src/d/d_vib_pattern.cpp +++ b/src/d/d_vib_pattern.cpp @@ -59,3 +59,30 @@ const vib_pattern dVibration_c::CQ_patt[VIBMODE_Q_MAX] = { /* VIBMODE_Q_POWER8 */ {4, 32, 0x6B6D6B6D}, /* VIBMODE_Q_HORSE */ {0, 27, 0x20201000}, }; + +const char* shock_names[VIBMODE_S_MAX] = { + "VIBMODE_S_CUSTOM", + "VIBMODE_S_POWER1", + "VIBMODE_S_POWER2", + "VIBMODE_S_POWER3", + "VIBMODE_S_POWER4", + "VIBMODE_S_POWER5", + "VIBMODE_S_POWER6", + "VIBMODE_S_POWER7", + "VIBMODE_S_POWER8", + "VIBMODE_S_DOKUTT", + "VIBMODE_S_FOR2D", +}; + +const char* quake_names[VIBMODE_Q_MAX] = { + "VIBMODE_Q_CUSTOM", + "VIBMODE_Q_POWER1", + "VIBMODE_Q_POWER2", + "VIBMODE_Q_POWER3", + "VIBMODE_Q_POWER4", + "VIBMODE_Q_POWER5", + "VIBMODE_Q_POWER6", + "VIBMODE_Q_POWER7", + "VIBMODE_Q_POWER8", + "VIBMODE_Q_HORSE", +}; diff --git a/src/d/d_vibration.cpp b/src/d/d_vibration.cpp index d3bd59c5cf..b43a1bdcd9 100644 --- a/src/d/d_vibration.cpp +++ b/src/d/d_vibration.cpp @@ -5,6 +5,7 @@ #include "f_op/f_op_camera_mng.h" #include "m_Do/m_Do_controller_pad.h" #include "SSystem/SComponent/c_math.h" +#include "d/d_s_play.h" #include #define RESET_FRAME -99 @@ -26,27 +27,30 @@ u16* makedata(u16* data, u32 pattern, s32 length) { s32 rollshift(u32 pattern, s32 length, s32 index) { index %= length; - return (pattern >> index) | (pattern << (length - index)); + u32 var_r31 = pattern; + return (var_r31 >> index) | (var_r31 << (length - index)); } u32 makebits(u32 bits, s32 length, s32 numbits) { + bits &= (-1 << (32 - length)); + u32 mask = bits; s32 i; - u32 mask = bits & (-1 << (32 - length)); - bits = mask; for (i = length; i < numbits; i += length) { - bits = mask | (bits >> length); + mask = bits | (mask >> length); } - return bits; + return mask; } u32 randombit(s32 rounds, s32 length) { u32 value = 0; + int i; - for (int i = 0; i < rounds; i++) { + for (i = 0; i < rounds; i++) { value |= 0x40000000 >> (u32)(length * cM_rnd()); } + return value; } }; @@ -65,10 +69,13 @@ int dVibration_c::Run() { mMotor.mQuake.field_0x0 |= 1; } - mMotor.mQuake.mFrame = RESET_FRAME; - mMotor.mShock.mFrame = RESET_FRAME; + mMotor.mShock.mFrame = mMotor.mQuake.mFrame = RESET_FRAME; } + #if DEBUG + testShake(); + #endif + if ((mCamera.mShock.field_0x0 & 1) && mCamera.mShock.mFrame != RESET_FRAME) { mCamera.mShock.mFrame = 0; mCamera.mShock.mVibMode = VIBMODE_S_NONE; @@ -80,6 +87,8 @@ int dVibration_c::Run() { } if (mCamera.mShock.mFrame == 0 || mCamera.mQuake.mFrame == 0) { + s32 pattern; + u32 sp1C = 0; u32 rumble = 0; if (mCamera.mShock.mVibMode == VIBMODE_S_NONE || (mCamera.mShock.field_0x0 & 1)) { mCamera.mShock.mFrame = RESET_FRAME; @@ -99,7 +108,7 @@ int dVibration_c::Run() { rumble |= RUMBLE_QUAKE; } - s32 length, pattern, bits, flags; + s32 length, bits, flags; switch (rumble) { case RUMBLE_SHOCK: length = mCamera.mShock.mLength; @@ -114,6 +123,12 @@ int dVibration_c::Run() { if (dComIfGp_getCamera(0) != NULL && dComIfGp_getCamera(0)->field_0x22f == 0x47) { dCam_getBody()->StartShake(length, (u8*)&pattern, flags, mCamera.mShock.mPos.norm()); } + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start camera(%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; case RUMBLE_QUAKE: length = mCamera.mQuake.mLength; @@ -128,11 +143,18 @@ int dVibration_c::Run() { if (dComIfGp_getCamera(0) != NULL && dComIfGp_getCamera(0)->field_0x22f == 0x47) { dCam_getBody()->StartShake(length, (u8*)&pattern, flags, mCamera.mQuake.mPos.norm()); } + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start camera(%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; case RUMBLE_SHOCK | RUMBLE_QUAKE: pattern = mCamera.mShock.mPattern << mCamera.mShock.mFrame; length = mCamera.mShock.mLength - mCamera.mShock.mFrame; - pattern |= rollshift(makebits(mCamera.mQuake.mPattern, mCamera.mQuake.mLength, length), length, mFrame); + sp1C = makebits(mCamera.mQuake.mPattern, mCamera.mQuake.mLength, length); + pattern |= rollshift(sp1C, length, mFrame); pattern |= randombit(mCamera.mShock.mRounds > mCamera.mQuake.mRounds ? mCamera.mShock.mRounds : mCamera.mQuake.mRounds, length); flags = mCamera.mShock.mFlags | mCamera.mQuake.mFlags; @@ -144,13 +166,24 @@ int dVibration_c::Run() { dCam_getBody()->StartShake(length, (u8*)&pattern, flags, cXyz(mCamera.mShock.mPos + mCamera.mQuake.mPos).norm()); } - mCamera.mQuake.mFrame = 0; - mCamera.mShock.mFrame = 0; + mCamera.mShock.mFrame = mCamera.mQuake.mFrame = 0; + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start camera(%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; default: if (dComIfGp_getCamera(0) != NULL && dComIfGp_getCamera(0)->field_0x22f == 0x47) { dCam_getBody()->StopShake(); } + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: stop camera\n", mFrame); + } + #endif break; } } @@ -166,6 +199,7 @@ int dVibration_c::Run() { } if (mMotor.mShock.mFrame == 0 || mMotor.mQuake.mFrame == 0) { + s32 sp14 = 0; u32 rumble = 0; if (mMotor.mShock.mVibMode == VIBMODE_S_NONE || (mMotor.mShock.field_0x0 & 1)) { mMotor.mShock.mFrame = RESET_FRAME; @@ -194,39 +228,64 @@ int dVibration_c::Run() { pattern = mMotor.mShock.mPattern; pattern |= randombit(mMotor.mShock.mRounds, length); mMotor.mShock.mStopFrame = length; - mDoCPd_c::startMotorWave(PAD_1, makedata(data, pattern, length), JUTGamePad::CRumble::VAL_0, 60); + mDoCPd_c::startMotorWave(PAD_1, (u8*)makedata(data, pattern, length), JUTGamePad::CRumble::VAL_0, 60); + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start motor (%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; case RUMBLE_QUAKE: length = mMotor.mQuake.mLength; pattern = rollshift(mMotor.mQuake.mPattern, length, mFrame); pattern |= randombit(mMotor.mQuake.mRounds, length); mMotor.mQuake.mStopFrame = INT_MAX; - mDoCPd_c::startMotorWave(PAD_1, makedata(data, pattern, length), JUTGamePad::CRumble::VAL_1, 60); + + OS_REPORT("d_vibration mDoCPd_c::startMotorWave\n"); + + mDoCPd_c::startMotorWave(PAD_1, (u8*)makedata(data, pattern, length), JUTGamePad::CRumble::VAL_1, 60); + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start motor (%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; case RUMBLE_SHOCK | RUMBLE_QUAKE: pattern = mMotor.mShock.mPattern << mMotor.mShock.mFrame; length = mMotor.mShock.mLength - mMotor.mShock.mFrame; - pattern |= rollshift(makebits(mMotor.mQuake.mPattern, mMotor.mQuake.mLength, length), length, mFrame); + sp14 = makebits(mMotor.mQuake.mPattern, mMotor.mQuake.mLength, length); + pattern |= rollshift(sp14, length, mFrame); pattern |= randombit(mMotor.mShock.mRounds > mMotor.mQuake.mRounds ? mMotor.mShock.mRounds : mMotor.mQuake.mRounds, length); mMotor.mQuake.mStopFrame = length; mMotor.mShock.mStopFrame = length; - mMotor.mQuake.mFrame = 0; - mMotor.mShock.mFrame = 0; - mDoCPd_c::startMotorWave(PAD_1, makedata(data, pattern, length), JUTGamePad::CRumble::VAL_0, 60); + mMotor.mShock.mFrame = mMotor.mQuake.mFrame = 0; + + mDoCPd_c::startMotorWave(PAD_1, (u8*)makedata(data, pattern, length), JUTGamePad::CRumble::VAL_0, 60); + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: start motor (%d) %x %d\n", mFrame, rumble, pattern, length); + } + #endif break; default: mDoCPd_c::stopMotorWave(PAD_1); mDoCPd_c::stopMotor(PAD_1); - mMotor.mQuake.mStopFrame = RESET_FRAME; - mMotor.mShock.mStopFrame = RESET_FRAME; + mMotor.mShock.mStopFrame = mMotor.mQuake.mStopFrame = RESET_FRAME; + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: stop motor\n", mFrame); + } + #endif break; } } - mCamera.mQuake.field_0x0 = 0; - mCamera.mShock.field_0x0 = 0; - mMotor.mQuake.field_0x0 = 0; - mMotor.mShock.field_0x0 = 0; + mCamera.mShock.field_0x0 = mCamera.mQuake.field_0x0 = 0; + mMotor.mShock.field_0x0 = mMotor.mQuake.field_0x0 = 0; if (mCamera.mShock.mFrame >= 0) { mCamera.mShock.mFrame++; @@ -254,9 +313,22 @@ int dVibration_c::Run() { if (mMotor.mQuake.mFrame >= 930) { mMotor.mQuake.mFrame = 0; + + #if DEBUG + if (mVibTest.m_displayDbg & 0x8000) { + OS_REPORT("vibration: %06d: stop motor @ limit restart\n", mFrame); + } + #endif } else if (mMotor.mQuake.mFrame >= 900) { mDoCPd_c::stopMotorWave(PAD_1); mDoCPd_c::stopMotor(PAD_1); + + #if DEBUG + if ((mVibTest.m_displayDbg & 0x8000) && mMotor.mQuake.mFrame == 900) { + OS_REPORT("vibration: %06d: stop motor @ limit\n", mFrame); + } + #endif + mMotor.mQuake.mFrame++; } else if (mMotor.mQuake.mFrame >= 0) { mMotor.mQuake.mFrame++; @@ -292,6 +364,12 @@ bool dVibration_c::StartShock(int i_vibmode, int i_flags, cXyz i_pos) { ret = true; } + #if DEBUG + if ((mVibTest.m_displayDbg & 0x8000) && ret) { + OS_REPORT("vibration: %06d: start shock %d %d\n", mFrame, i_vibmode, i_flags); + } + #endif + return ret; } @@ -317,6 +395,12 @@ bool dVibration_c::StartQuake(int i_vibmode, int i_flags, cXyz i_pos) { ret = true; } + #if DEBUG + if ((mVibTest.m_displayDbg & 0x8000) && ret) { + OS_REPORT("vibration: %06d: start quake %d %d\n", mFrame, i_vibmode, i_flags); + } + #endif + return ret; } @@ -349,6 +433,12 @@ bool dVibration_c::StartQuake(const u8* i_pattern, int i_rounds, int i_flags, cX ret = true; } + #if DEBUG + if ((mVibTest.m_displayDbg & 0x8000) && ret) { + OS_REPORT("vibration: %06d: start quake %x %d %d\n", mFrame, bits, i_rounds, i_flags); + } + #endif + return ret; } @@ -369,9 +459,114 @@ int dVibration_c::StopQuake(int i_flags) { ret = TRUE; } + #if DEBUG + if ((mVibTest.m_displayDbg & 0x8000) && ret) { + OS_REPORT("vibration: %06d: stop quake %d\n", mFrame, i_flags); + } + #endif + return ret; } +#if DEBUG +int dVibration_c::testShake() { + int var_r29, var_r28; + int ret = FALSE; + s32 cam_bits, cam_len, cam_rounds; + s32 motor_bits, motor_len, motor_rounds; + + switch (mVibTest.field_0x10) { + case 10: + if (mVibTest.m_vibswitch >= 1 && mVibTest.m_vibswitch < 100) { + var_r29 = mVibTest.m_vibswitch; + cam_bits = CS_patt[var_r29].bits; + cam_len = CS_patt[var_r29].length; + cam_rounds = CS_patt[var_r29].rounds; + + motor_bits = MS_patt[var_r29].bits; + motor_len = MS_patt[var_r29].length; + motor_rounds = MS_patt[var_r29].rounds; + + OS_REPORT("vibration: TEST C b %x l %d r %d\n", cam_bits, cam_len, cam_rounds); + OS_REPORT("(SHOCK) m %2d M b %x l %d r %d\n", motor_bits, motor_len, motor_rounds); + } else { + motor_bits = cam_bits = (mVibTest.m_pattern << 0x10) | mVibTest.m_pattern2; + motor_len = cam_len = mVibTest.m_length; + motor_rounds = cam_rounds = mVibTest.m_randombit; + } + + if (mVibTest.field_0xa & 0x7E) { + mCamera.mShock.mVibMode = 0; + mCamera.mShock.mFrame = 0; + mCamera.mShock.mFlags = mVibTest.field_0xa; + mCamera.mShock.mPos = cXyz(0.0f, 1.0f, 0.0f); + mCamera.mShock.mPattern = cam_bits; + mCamera.mShock.mLength = cam_len; + mCamera.mShock.mRounds = cam_rounds; + } + + if (mVibTest.field_0xa & 1) { + mMotor.mShock.mVibMode = 0; + mMotor.mShock.mFrame = 0; + mMotor.mShock.mPattern = motor_bits; + mMotor.mShock.mLength = motor_len; + mMotor.mShock.mRounds = motor_rounds; + } + + mVibTest.field_0x10 = 0; + ret = TRUE; + break; + case 20: + if (mVibTest.m_vibswitch >= 100 && mVibTest.m_vibswitch < 200) { + var_r28 = mVibTest.m_vibswitch - 100; + cam_bits = CQ_patt[var_r28].bits; + cam_len = CQ_patt[var_r28].length; + cam_rounds = CQ_patt[var_r28].rounds; + + motor_bits = MQ_patt[var_r28].bits; + motor_len = MQ_patt[var_r28].length; + motor_rounds = MQ_patt[var_r28].rounds; + + OS_REPORT("vibration: TEST C b %x l %d r %d\n", cam_bits, cam_len, cam_rounds); + OS_REPORT("(QUAKE) m %2d M b %x l %d r %d\n", motor_bits, motor_len, motor_rounds); + } else { + motor_bits = cam_bits = (mVibTest.m_pattern << 0x10) | mVibTest.m_pattern2; + motor_len = cam_len = mVibTest.m_length; + motor_rounds = cam_rounds = mVibTest.m_randombit; + } + + if (mVibTest.field_0xa & 0x7E) { + mCamera.mQuake.mVibMode = 0; + mCamera.mQuake.mFrame = 0; + mCamera.mQuake.mFlags = mVibTest.field_0xa; + mCamera.mQuake.mPos = cXyz(0.0f, 1.0f, 0.0f); + mCamera.mQuake.mPattern = cam_bits; + mCamera.mQuake.mLength = cam_len; + mCamera.mQuake.mRounds = cam_rounds; + } + + if (mVibTest.field_0xa & 1) { + mMotor.mQuake.mVibMode = 0; + mMotor.mQuake.mFrame = 0; + mMotor.mQuake.mPattern = motor_bits; + mMotor.mQuake.mLength = motor_len; + mMotor.mQuake.mRounds = motor_rounds; + } + + mVibTest.field_0x10 = 0; + ret = TRUE; + break; + case 21: + OS_REPORT("vibration: TEST STOP\n"); + StopQuake(0x1F); + mVibTest.field_0x10 = 0; + break; + } + + return ret; +} +#endif + void dVibration_c::Kill() { mDoCPd_c::stopMotorWaveHard(PAD_1); mDoCPd_c::stopMotorHard(PAD_1); @@ -383,30 +578,18 @@ bool dVibration_c::CheckQuake() { } void dVibration_c::setDefault() { - mMotor.mShock.mVibMode = VIBMODE_S_NONE; - mCamera.mShock.mVibMode = VIBMODE_S_NONE; - mMotor.mQuake.mVibMode = VIBMODE_Q_NONE; - mCamera.mQuake.mVibMode = VIBMODE_Q_NONE; - mMotor.mShock.field_0x0 = 0; - mCamera.mShock.field_0x0 = 0; - mMotor.mQuake.field_0x0 = 0; - mCamera.mQuake.field_0x0 = 0; - mMotor.mShock.mPattern = 0; - mCamera.mShock.mPattern = 0; - mMotor.mQuake.mPattern = 0; - mCamera.mQuake.mPattern = 0; - mMotor.mShock.mLength = 0; - mCamera.mShock.mLength = 0; - mMotor.mQuake.mLength = 0; - mCamera.mQuake.mLength = 0; - mMotor.mShock.mRounds = 0; - mCamera.mShock.mRounds = 0; - mMotor.mQuake.mRounds = 0; - mCamera.mQuake.mRounds = 0; - mMotor.mShock.mFrame = RESET_FRAME; - mCamera.mShock.mFrame = RESET_FRAME; - mMotor.mQuake.mFrame = RESET_FRAME; - mCamera.mQuake.mFrame = RESET_FRAME; + mCamera.mShock.mVibMode = mMotor.mShock.mVibMode = VIBMODE_S_NONE; + mCamera.mQuake.mVibMode = mMotor.mQuake.mVibMode = VIBMODE_Q_NONE; + mCamera.mShock.field_0x0 = mMotor.mShock.field_0x0 = 0; + mCamera.mQuake.field_0x0 = mMotor.mQuake.field_0x0 = 0; + mCamera.mShock.mPattern = mMotor.mShock.mPattern = 0; + mCamera.mQuake.mPattern = mMotor.mQuake.mPattern = 0; + mCamera.mShock.mLength = mMotor.mShock.mLength = 0; + mCamera.mQuake.mLength = mMotor.mQuake.mLength = 0; + mCamera.mShock.mRounds = mMotor.mShock.mRounds = 0; + mCamera.mQuake.mRounds = mMotor.mQuake.mRounds = 0; + mCamera.mShock.mFrame = mMotor.mShock.mFrame = RESET_FRAME; + mCamera.mQuake.mFrame = mMotor.mQuake.mFrame = RESET_FRAME; mMotor.mShock.mStopFrame = RESET_FRAME; mMotor.mQuake.mStopFrame = RESET_FRAME; mMode = MODE_WAIT; @@ -416,6 +599,10 @@ void dVibration_c::setDefault() { void dVibration_c::Init() { Kill(); setDefault(); + + #if DEBUG + mVibTest.Init(); + #endif } void dVibration_c::Pause() { @@ -425,10 +612,8 @@ void dVibration_c::Pause() { mDoCPd_c::stopMotorHard(PAD_1); } - mMotor.mShock.mVibMode = VIBMODE_S_NONE; - mCamera.mShock.mVibMode = VIBMODE_S_NONE; - mMotor.mShock.mFrame = RESET_FRAME; - mCamera.mShock.mFrame = RESET_FRAME; + mCamera.mShock.mVibMode = mMotor.mShock.mVibMode = VIBMODE_S_NONE; + mCamera.mShock.mFrame = mMotor.mShock.mFrame = RESET_FRAME; if (mCamera.mQuake.mVibMode != VIBMODE_Q_NONE) { mCamera.mQuake.mFrame = 0; @@ -444,3 +629,133 @@ void dVibration_c::Pause() { void dVibration_c::Remove() { Kill(); } + +#if DEBUG +void dVibTest_c::setDefault() { + m_pattern = m_pattern2 = 0; + field_0xa = 0; + field_0x10 = 0; + m_randombit = 0; + m_vibswitch = 0; + m_displayDbg = 0; + m_length = 32; +} + +dVibTest_c::dVibTest_c() { + setDefault(); + id = mDoHIO_CREATE_CHILD("振動処理", this); +} + +dVibTest_c::~dVibTest_c() { + mDoHIO_DELETE_CHILD(id); +} + +void dVibTest_c::Init() { + setDefault(); +} + +void dVibTest_c::genMessage(JORMContext* mctx) { + int i; + + mctx->genLabel("- パターン", 0, 0); + mctx->genCheckBox(" ", &m_pattern, 0x8000, 0, NULL, 10, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x4000, 0, NULL, 0x1e, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x2000, 0, NULL, 0x32, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x1000, 0, NULL, 0x46, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x800, 0, NULL, 0x5a, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x400, 0, NULL, 0x6e, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x200, 0, NULL, 0x82, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x100, 0, NULL, 0x96, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x80, 0, NULL, 0xaa, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x40, 0, NULL, 0xbe, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x20, 0, NULL, 0xd2, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 0x10, 0, NULL, 0xe6, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 8, 0, NULL, 0xfa, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 4, 0, NULL, 0x10e, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 2, 0, NULL, 0x122, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern, 1, 0, NULL, 0x136, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x8000, 0, NULL, 0x14a, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x4000, 0, NULL, 0x15e, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x2000, 0, NULL, 0x172, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x1000, 0, NULL, 0x186, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x800, 0, NULL, 0x19a, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x400, 0, NULL, 0x1ae, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x200, 0, NULL, 0x1c2, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x100, 0, NULL, 0x1d6, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x80, 0, NULL, 0x1ea, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x40, 0, NULL, 0x1fe, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x20, 0, NULL, 0x212, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 0x10, 0, NULL, 0x226, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 8, 0, NULL, 0x23a, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 4, 0, NULL, 0x24e, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 2, 0, NULL, 0x262, 0x14, 0x14, 0x14); + mctx->genCheckBox(" ", &m_pattern2, 1, 0, NULL, 0x276, 0x14, 0x14, 0x14); + + mctx->genLabel("-", 0, 0); + mctx->startComboBox("振動切替", &m_vibswitch, 0x130); + for (i = 0; i < 11; i++) { + mctx->genComboBoxItem(shock_names[i], i); + } + for (i = 0; i < 10; i++) { + mctx->genComboBoxItem(quake_names[i], i + 100); + } + mctx->endComboBox(); + + mctx->genLabel("- VIBMODE_S_* は衝撃型用、VIBMODE_Q_* は地震型用です", 0); + mctx->genLabel("-", 0); + + mctx->genLabel("- タイプ", 0); + mctx->genCheckBox("振動パック", &field_0xa, 1, 0); + mctx->genCheckBox("座標揺れ", &field_0xa, 2, 0); + mctx->genCheckBox("座標揺れ(強)", &field_0xa, 0x40, 0); + mctx->genCheckBox("画角揺れ", &field_0xa, 4, 0); + mctx->genCheckBox("Z揺れ", &field_0xa, 8, 0); + mctx->genCheckBox("ブラー", &field_0xa, 0x10, 0); + + mctx->genLabel("-", 0); + mctx->genSlider("長さ", &m_length, 0, 0x20); + mctx->genSlider("ランダムビット", &m_randombit, 0, 0x20); + + mctx->genLabel("-", 0); + mctx->genButton("衝撃型揺れ開始", 0x12d, 0); + mctx->genButton("地震型揺れ開始", 0x12e, 0); + mctx->genButton("地震型揺れ停止", 0x12f, 0); + + mctx->genLabel("-", 0, 0); + mctx->genCheckBox(" デバッグ表示", &m_displayDbg, 0x8000); + + mctx->genLabel("-", 0, 0); + mctx->genLabel("-", 0, 0); + mctx->genButton("揺れ実験(強)", 0x131, 0); + mctx->genButton("揺れ実験(中)", 0x132, 0); + mctx->genButton("揺れ実験(弱)", 0x133, 0); + + mctx->genLabel("-", 0, 0); + mctx->genLabel("-", 0, 0); +} + +void dVibTest_c::listenPropertyEvent(const JORPropertyEvent* event) { + JORReflexible::listenPropertyEvent(event); + + switch ((int)event->id) { + case 0x12D: + field_0x10 = 10; + break; + case 0x12E: + field_0x10 = 20; + break; + case 0x12F: + field_0x10 = 21; + break; + case 0x131: + dComIfGp_getVibration().StartShock(XREG_S(1) + 8, 0x1F, cXyz(0.0f, 1.0f, 0.0f)); + break; + case 0x132: + dComIfGp_getVibration().StartShock(XREG_S(2) + 4, 0x1F, cXyz(0.0f, 1.0f, 0.0f)); + break; + case 0x133: + dComIfGp_getVibration().StartShock(XREG_S(3) + 2, 0x1F, cXyz(0.0f, 1.0f, 0.0f)); + break; + } +} +#endif