mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-31 07:45:48 -04:00
convert jpn logic changes to runtime checks
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "Z2AudioLib/Z2LinkMgr.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/version.hpp"
|
||||
|
||||
Z2SoundObjMgr::Z2SoundObjMgr() : JASGlobalInstance<Z2SoundObjMgr>(true) {
|
||||
ghostEnemyState_ = 0;
|
||||
twilightBattle_ = 0;
|
||||
@@ -207,6 +209,10 @@ void Z2SoundObjMgr::searchEnemy() {
|
||||
case Z2_ENEMY_RD:
|
||||
case Z2_ENEMY_SH:
|
||||
case Z2_ENEMY_HP:
|
||||
#elif TARGET_PC
|
||||
case Z2_ENEMY_SH:
|
||||
if (enemyId == Z2_ENEMY_SH && !dusk::version::isRegionJpn())
|
||||
continue;
|
||||
#endif
|
||||
if (!Z2GetLink()->isRiding())
|
||||
break;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "dusk/imgui/ImGuiConsole.hpp"
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/speedrun.h"
|
||||
#include "dusk/version.hpp"
|
||||
|
||||
BOOL daAlink_c::checkEventRun() const {
|
||||
return dComIfGp_event_runCheck() || checkPlayerDemoMode();
|
||||
@@ -4399,8 +4400,10 @@ void daAlink_c::checkWarpStart() {
|
||||
if (dMeter2Info_getWarpStatus() == WARP_STATUS_DECIDED_e ||
|
||||
dComIfGp_event_compulsory(this, 0, 0xFFFF))
|
||||
{
|
||||
#if VERSION != VERSION_GCN_JPN && VERSION != VERSION_SHIELD_DEBUG
|
||||
#if TARGET_PC || (VERSION != VERSION_GCN_JPN && VERSION != VERSION_SHIELD_DEBUG)
|
||||
IF_DUSK_BLOCK(!dusk::version::isRegionJpn())
|
||||
onNoResetFlg0(FLG0_UNK_4000);
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
if (dMeter2Info_getWarpStatus() == WARP_STATUS_DECIDED_e) {
|
||||
@@ -4428,8 +4431,10 @@ void daAlink_c::checkWarpStart() {
|
||||
fopAcM_orderOtherEvent(this, portal, 0xFFFF, 1, 1);
|
||||
} else {
|
||||
mDemo.setSpecialDemoType();
|
||||
#if VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG
|
||||
#if TARGET_PC || (VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG)
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
onNoResetFlg0(FLG0_UNK_4000);
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
if (dMeter2Info_getWarpStatus() == 1) {
|
||||
@@ -4513,10 +4518,12 @@ int daAlink_c::procCoWarpInit(int param_0, int param_1) {
|
||||
soundId = Z2SE_WOLF_WARP_IN_TATE;
|
||||
}
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG
|
||||
#if TARGET_PC || (VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG)
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
if (param_1) {
|
||||
onNoResetFlg0(FLG0_UNK_4000);
|
||||
}
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
if (param_1) {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "Z2AudioLib/Z2Instances.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/version.hpp"
|
||||
|
||||
class daE_MK_HIO_c : public JORReflexible {
|
||||
public:
|
||||
virtual ~daE_MK_HIO_c() {}
|
||||
@@ -612,8 +614,10 @@ static void e_mk_shoot(e_mk_class* i_this) {
|
||||
i_this->sound.startCreatureVoice(Z2SE_EN_MK_V_CATCH_BOOM, -1);
|
||||
i_this->sound.startCreatureSound(Z2SE_EN_MK_CATCH_BOOM, 0, -1);
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
return;
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
|
||||
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
||||
|
||||
#include "d/actor/d_a_e_mk_bo.h"
|
||||
#include "Z2AudioLib/Z2Instances.h"
|
||||
#include "c/c_damagereaction.h"
|
||||
#include "d/actor/d_a_e_mk.h"
|
||||
#include "d/actor/d_a_e_mk_bo.h"
|
||||
#include "d/actor/d_a_player.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include "c/c_damagereaction.h"
|
||||
#include "Z2AudioLib/Z2Instances.h"
|
||||
#include "dusk/version.hpp"
|
||||
|
||||
static int daE_MK_BO_Draw(e_mk_bo_class* i_this) {
|
||||
if (i_this->field_0x9b4 != 0) {
|
||||
@@ -569,8 +570,10 @@ static int daE_MK_BO_Execute(e_mk_bo_class* i_this) {
|
||||
|
||||
if (i_this->field_0x600 != 0) {
|
||||
fopAcM_delete(actor);
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
return 1;
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
||||
#include "d/actor/d_a_e_mm_mt.h"
|
||||
#include "d/d_cc_d.h"
|
||||
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
||||
#include "dusk/version.hpp"
|
||||
#include "f_op/f_op_actor_enemy.h"
|
||||
|
||||
static int daE_MM_MT_Draw(e_mm_mt_class* i_this) {
|
||||
@@ -802,7 +803,9 @@ static int daE_MM_MT_Create(fopAc_ac_c* i_this) {
|
||||
if (i_this->argument == 1) {
|
||||
fopAcM_OffStatus(i_this, 0x80000);
|
||||
helmasaurShell->m_sphere.SetAtType(
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC
|
||||
dusk::version::isRegionJpn() ? AT_TYPE_CSTATUE_SWING : 0xD8FBBDFF
|
||||
#elif VERSION == VERSION_GCN_JPN
|
||||
AT_TYPE_CSTATUE_SWING
|
||||
#else
|
||||
0xD8FBBDFF
|
||||
|
||||
@@ -1783,7 +1783,13 @@ static int daFshop_Create(fopAc_ac_c* actor) {
|
||||
};
|
||||
|
||||
if (sp10 == 1) {
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC
|
||||
if (dusk::version::isRegionJpn()) {
|
||||
sp24 = dComIfGs_getEventReg(check_kind[i]);
|
||||
} else {
|
||||
sp24 = 2.54f * dComIfGs_getEventReg(check_kind[i]);
|
||||
}
|
||||
#elif VERSION == VERSION_GCN_JPN
|
||||
sp24 = dComIfGs_getEventReg(check_kind[i]);
|
||||
#else
|
||||
sp24 = 2.54f * dComIfGs_getEventReg(check_kind[i]);
|
||||
|
||||
+14
-4
@@ -12,6 +12,8 @@
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_lib.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/version.hpp"
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#endif
|
||||
@@ -2386,10 +2388,12 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) {
|
||||
u8 draw_sun = false;
|
||||
u16 date = dComIfGs_getDate();
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
if (g_env_light.hide_vrbox) {
|
||||
return;
|
||||
}
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0) {
|
||||
@@ -2754,10 +2758,12 @@ void dKyr_drawLenzflare(Mtx drawMtx, cXyz* ppos, GXColor& param_2, u8** tex) {
|
||||
static s16 S_rot_work1 = 0;
|
||||
static s16 S_rot_work2 = 0;
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
if (g_env_light.hide_vrbox) {
|
||||
return;
|
||||
}
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
Mtx camMtx;
|
||||
@@ -4223,10 +4229,12 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
csXyz(0, 30000, 19000),
|
||||
};
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
if (g_env_light.hide_vrbox) {
|
||||
return;
|
||||
}
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
if (star_packet->mEffectNum != 0) {
|
||||
@@ -4770,10 +4778,12 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
|
||||
int pass = 1;
|
||||
f32 spC4 = 0.0f;
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION == VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
if (g_env_light.hide_vrbox) {
|
||||
return;
|
||||
}
|
||||
IF_DUSK_BLOCK_END
|
||||
#endif
|
||||
|
||||
cXyz sp15C;
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
#include "d/d_msg_object.h"
|
||||
#include "d/d_msg_scrn_explain.h"
|
||||
#include "d/d_stage.h"
|
||||
#include "helpers/string.hpp"
|
||||
#include "dusk/version.hpp"
|
||||
#include "f_op/f_op_msg_mng.h"
|
||||
#include "helpers/string.hpp"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
@@ -1217,7 +1218,8 @@ void dMenu_Fmap_c::spot_map_proc() {
|
||||
{
|
||||
mpDraw2DBack->stageMapMove(mpStick, 1, true);
|
||||
} else if (dMw_Z_TRIGGER() && mpDraw2DTop->isWarpAccept()) {
|
||||
#if VERSION >= VERSION_GCN_JPN
|
||||
#if TARGET_PC || VERSION >= VERSION_GCN_JPN
|
||||
IF_DUSK_BLOCK(dusk::version::isRegionJpn())
|
||||
//! JPN version added a check to make sure if Arbiter's Grounds is cleared that
|
||||
//! the Mirror Chamber Statue has been spun before allowing portal warping from the map screen.
|
||||
if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[265]) && !dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[361])) {
|
||||
@@ -1227,7 +1229,7 @@ void dMenu_Fmap_c::spot_map_proc() {
|
||||
mPrevProcessAlt = mProcess;
|
||||
setProcess(PROC_PORTAL_WARP_FORBID);
|
||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
} else
|
||||
} IF_DUSK_BLOCK_END else
|
||||
#endif
|
||||
if (mpDraw2DTop->checkPlayerWarpAccept()) {
|
||||
mIsWarpMap = true;
|
||||
|
||||
+42
-44
@@ -56,8 +56,7 @@ typedef struct dMsgUnit_inf1_entry_JPN {
|
||||
BE(u16) field_0x14;
|
||||
BE(u16) field_0x16;
|
||||
BE(u16) field_0x18;
|
||||
BE(u16) startFrame;
|
||||
BE(u16) endFrame;
|
||||
BE(u16) field_0x1A;
|
||||
} dMsgUnit_inf1_entry_JPN;
|
||||
|
||||
typedef struct dMsgUnit_inf1_section_JPN {
|
||||
@@ -117,7 +116,7 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa
|
||||
}
|
||||
}
|
||||
|
||||
if ((i_type == 3 && param_4 == true) || i_type == 4 && param_4 == false) {
|
||||
if ((i_type == 3 && param_4 == true) || (i_type == 4 && param_4 == false)) {
|
||||
f32 dayTime = g_env_light.getDaytime();
|
||||
f32 hour = dayTime / 15.0f;
|
||||
|
||||
@@ -141,65 +140,64 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa
|
||||
|
||||
if (!stack9) {
|
||||
bmg_header_t* pHeader = (bmg_header_t*)dMeter2Info_getMsgUnitResource();
|
||||
dMsgUnit_inf1_section_JPN* pInfoBlock = NULL;
|
||||
bmg_section_t* pInfoBlock = NULL;
|
||||
const void* pMsgDataBlock = NULL;
|
||||
str1_section_t* pStrAttributeBlock = NULL;
|
||||
int filepos = sizeof(bmg_header_t);
|
||||
u32 filesize = pHeader->size;
|
||||
bmg_section_t* pSection = (bmg_section_t*)(((u8*)pHeader) + filepos);
|
||||
u8* pSection = ((u8*)pHeader) + filepos;
|
||||
|
||||
for (; filepos < filesize; filepos += pSection->size) {
|
||||
switch(pSection->magic) {
|
||||
case 'FLW1':
|
||||
break;
|
||||
case 'FLI1':
|
||||
break;
|
||||
case 'INF1':
|
||||
pInfoBlock = (dMsgUnit_inf1_section_JPN*)pSection;
|
||||
break;
|
||||
case 'DAT1':
|
||||
pMsgDataBlock = pSection;
|
||||
break;
|
||||
case 'STR1':
|
||||
pStrAttributeBlock = (str1_section_t*)pSection;
|
||||
break;
|
||||
while (filepos < filesize) {
|
||||
switch(((bmg_section_t*)pSection)->magic) {
|
||||
case 'FLW1':
|
||||
break;
|
||||
case 'FLI1':
|
||||
break;
|
||||
case 'INF1':
|
||||
pInfoBlock = (bmg_section_t*)pSection;
|
||||
break;
|
||||
case 'DAT1':
|
||||
pMsgDataBlock = pSection;
|
||||
break;
|
||||
case 'STR1':
|
||||
pStrAttributeBlock = (str1_section_t*)pSection;
|
||||
break;
|
||||
}
|
||||
pSection = (bmg_section_t*)((u8*)pSection + pSection->size);
|
||||
filepos += ((bmg_section_t*)pSection)->size;
|
||||
pSection += ((bmg_section_t*)pSection)->size;
|
||||
}
|
||||
|
||||
u16 vals[12];
|
||||
vals[0] = pInfoBlock->entries[i_type].field_0x04;
|
||||
vals[1] = pInfoBlock->entries[i_type].field_0x06;
|
||||
vals[2] = pInfoBlock->entries[i_type].field_0x08;
|
||||
vals[3] = pInfoBlock->entries[i_type].field_0x0a;
|
||||
vals[4] = pInfoBlock->entries[i_type].field_0x0c;
|
||||
vals[5] = pInfoBlock->entries[i_type].field_0x0e;
|
||||
vals[6] = pInfoBlock->entries[i_type].field_0x10;
|
||||
vals[7] = pInfoBlock->entries[i_type].field_0x12;
|
||||
vals[8] = pInfoBlock->entries[i_type].field_0x14;
|
||||
vals[9] = pInfoBlock->entries[i_type].field_0x16;
|
||||
vals[10] = pInfoBlock->entries[i_type].field_0x18;
|
||||
int entryOff = pInfoBlock->entries[i_type].dat1EntryOffset;
|
||||
vals[0] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x04;
|
||||
vals[1] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x06;
|
||||
vals[2] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x08;
|
||||
vals[3] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0a;
|
||||
vals[4] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0c;
|
||||
vals[5] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0e;
|
||||
vals[6] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x10;
|
||||
vals[7] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x12;
|
||||
vals[8] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x14;
|
||||
vals[9] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x16;
|
||||
vals[10] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x18;
|
||||
u32 dat1EntryOffset = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].dat1EntryOffset;
|
||||
|
||||
char* value2 = (char*)((uintptr_t)pMsgDataBlock + entryOff + 8);
|
||||
char* dat1Entry = (char*)((u8*)pMsgDataBlock + dat1EntryOffset + 8);
|
||||
|
||||
const char* uVar5;
|
||||
if (i_value == 0) {
|
||||
uVar5 = pStrAttributeBlock->entries->str + vals[0];
|
||||
} else if ((i_value % 10) == 0) {
|
||||
uVar5 = pStrAttributeBlock->entries->str + (vals[10]);
|
||||
} else {
|
||||
if ((i_value % 10) == 0) {
|
||||
uVar5 = pStrAttributeBlock->entries->str + (vals[10]);
|
||||
} else {
|
||||
uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10];
|
||||
}
|
||||
uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10];
|
||||
}
|
||||
|
||||
int uVar5Len = strlen(uVar5);
|
||||
if (uVar5Len == 0) {
|
||||
if (stack8) {
|
||||
SAFE_STRCAT(o_buffer, value2);
|
||||
SAFE_STRCAT(o_buffer, dat1Entry);
|
||||
} else {
|
||||
SAFE_SPRINTF(o_buffer, "%d%s", i_value, value2);
|
||||
SAFE_SPRINTF(o_buffer, "%d%s", i_value, dat1Entry);
|
||||
}
|
||||
} else {
|
||||
char unkCharArr[7];
|
||||
@@ -208,15 +206,15 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa
|
||||
unkCharArr[2] = -1;
|
||||
unkCharArr[3] = -1;
|
||||
unkCharArr[4] = 2;
|
||||
unkCharArr[5] = strlen(value2) / 2;
|
||||
unkCharArr[5] = strlen(dat1Entry) / 2;
|
||||
unkCharArr[6] = 0;
|
||||
|
||||
if (stack8) {
|
||||
SAFE_STRCAT(o_buffer, unkCharArr);
|
||||
SAFE_STRCAT(o_buffer, uVar5);
|
||||
SAFE_STRCAT(o_buffer, value2);
|
||||
SAFE_STRCAT(o_buffer, dat1Entry);
|
||||
} else {
|
||||
SAFE_SPRINTF(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, value2);
|
||||
SAFE_SPRINTF(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, dat1Entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,9 +348,10 @@ static void mDoMemCdRWm_BuildHeader(mDoMemCdRWm_HeaderData* header) {
|
||||
|
||||
snprintf(header->mComment, sizeof(header->mComment), HEADER_COMMENT, time.mon + 1, time.mday);
|
||||
} else {
|
||||
// TODO JPN SHIFT-JIS
|
||||
// snprintf(header->mTitle, sizeof(header->mTitle), "ゼルダの伝説 トワイライトプリンセス");
|
||||
// snprintf(header->mComment, sizeof(header->mComment), "%d月%d日のセーブデータです", time.mon + 1, time.mday);
|
||||
// shift-jis "ゼルダの伝説 トワイライトプリンセス"
|
||||
snprintf(header->mTitle, sizeof(header->mTitle), "\x83\x5b\x83\x8b\x83\x5f\x82\xcc\x93\x60\x90\xe0\x20\xc4\xdc\xb2\xd7\xb2\xc4\xcc\xdf\xd8\xdd\xbe\xbd");
|
||||
// shift-jis "%d月%d日のセーブデータです"
|
||||
snprintf(header->mComment, sizeof(header->mComment), "\x25\x64\x8c\x8e\x25\x64\x93\xfa\x82\xcc\x83\x5a\x81\x5b\x83\x75\x83\x66\x81\x5b\x83\x5e\x82\xc5\x82\xb7", time.mon + 1, time.mday);
|
||||
}
|
||||
#elif VERSION == VERSION_GCN_PAL
|
||||
switch (dComIfGs_getPalLanguage()) {
|
||||
|
||||
Reference in New Issue
Block a user