From ceee7ded31e69bf79bae77f66c593be1454b61aa Mon Sep 17 00:00:00 2001 From: HailSanta Date: Tue, 23 Jan 2024 23:48:57 -0500 Subject: [PATCH 1/6] fix choice box color --- src/msg_draw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/msg_draw.c b/src/msg_draw.c index 054fe8e34f..762d3e5bff 100644 --- a/src/msg_draw.c +++ b/src/msg_draw.c @@ -6,6 +6,11 @@ #include "charset/postcard.png.h" #include "charset/letter_content_1.png.h" +//TODO get a real ceil +s32 my_ceil(f32 f) { + return (s32)(f + 0.999f); +} + extern IMG_BIN ui_msg_bubble_left_png[]; extern IMG_BIN ui_msg_bubble_mid_png[]; extern IMG_BIN ui_msg_bubble_right_png[]; @@ -2011,9 +2016,14 @@ void msg_draw_frame(s32 posX, s32 posY, s32 sizeX, s32 sizeY, s32 style, s32 pal do {} while (0); switch (style) { case MSG_STYLE_CHOICE: - r = UNPACK_PAL_R(((u16*)ui_msg_palettes)[4]) * 8; - g = UNPACK_PAL_G(((u16*)ui_msg_palettes)[4]) * 8; - b = UNPACK_PAL_B(((u16*)ui_msg_palettes)[4]) * 8; + r = UNPACK_PAL_R(((u16*)ui_msg_palettes)[4]); + g = UNPACK_PAL_G(((u16*)ui_msg_palettes)[4]); + b = UNPACK_PAL_B(((u16*)ui_msg_palettes)[4]); + // BUGFIX: properly remap colors to full range [0, 255] + r = my_ceil(255 * r / 31.0); + g = my_ceil(255 * g / 31.0); + b = my_ceil(255 * b / 31.0); + gDPPipeSync(gMainGfxPos++); if (fading != 0 && bgAlpha < 255) { gDPSetRenderMode(gMainGfxPos++, IM_RD | CVG_DST_SAVE | ZMODE_XLU | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), IM_RD | CVG_DST_SAVE | ZMODE_XLU | FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); From 1fb757300de4a37372f30b777c1e3dde162b727f Mon Sep 17 00:00:00 2001 From: HailSanta Date: Wed, 24 Jan 2024 00:23:24 -0500 Subject: [PATCH 2/6] option to skip laggy pause menu opening --- src/background_gfx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/background_gfx.c b/src/background_gfx.c index 7843472b36..101357650d 100644 --- a/src/background_gfx.c +++ b/src/background_gfx.c @@ -258,6 +258,9 @@ void gfx_transfer_frame_to_depth(u16* frameBuffer0, u16* frameBuffer1, u16* zBuf . x . . . */ + //BUGFIX skip laggy blur operations when opening the pause menu on emulator + //TODO emulator test -- find which ones have bad performance here + #ifndef OPT_DISABLE_PAUSE_LAG_FIX if (((frameBuffer1[pixel] >> 2) & 0xF) < 8) { gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x - 1, &filterBuf0[0]); gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x + 1, &filterBuf0[1]); @@ -271,6 +274,9 @@ void gfx_transfer_frame_to_depth(u16* frameBuffer0, u16* frameBuffer1, u16* zBuf // Don't apply any filters to the edges of the screen zBuffer[pixel] = frameBuffer0[pixel] | 1; } + #else + zBuffer[pixel] = frameBuffer0[pixel] | 1; + #endif } } } From e5aaaa97f34a96fb5f6045539fa3a5beba6381ef Mon Sep 17 00:00:00 2001 From: HailSanta Date: Wed, 24 Jan 2024 00:33:27 -0500 Subject: [PATCH 3/6] fix malformed scripts --- src/battle/area/kmr_part_3/actor/final_jr_troopa.c | 1 - src/battle/area/kmr_part_3/actor/jr_troopa.c | 1 - src/world/area_dro/dro_01/dro_01_4_shop.c | 1 - src/world/area_gv/gv_01/gv_01_1_main.c | 4 ++-- src/world/area_kpa/kpa_08/kpa_08_0_header.c | 2 +- src/world/area_kpa/kpa_09/kpa_09_0_header.c | 2 +- src/world/area_kpa/kpa_96/kpa_96_3_npc.c | 1 - src/world/area_kzn/kzn_19/kzn_19_1_music.c | 1 - src/world/area_kzn/kzn_22/kzn_22_4_npc.c | 1 - src/world/area_mac/mac_03/mac_03_6_foliage.c | 3 +-- src/world/area_mac/mac_04/mac_04_5_shop.c | 1 - src/world/area_trd/trd_06/trd_06_1_main.c | 1 - src/world/area_trd/trd_10/trd_10_1_main.c | 1 - src/world/dead/area_kzn/kzn_19/kzn_19_1_music.c | 1 - src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c | 1 - 15 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/battle/area/kmr_part_3/actor/final_jr_troopa.c b/src/battle/area/kmr_part_3/actor/final_jr_troopa.c index 2b06f5d03b..68373b8409 100644 --- a/src/battle/area/kmr_part_3/actor/final_jr_troopa.c +++ b/src/battle/area/kmr_part_3/actor/final_jr_troopa.c @@ -1390,7 +1390,6 @@ EvtScript N(EVS_HandlePhase) = { EndIf CaseEq(PHASE_ENEMY_BEGIN) CaseEq(PHASE_ENEMY_END) - CaseEq(PHASE_PLAYER_BEGIN) //@bug duplicate case, should be PHASE_PLAYER_END EndSwitch Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE) Call(UseIdleAnimation, ACTOR_SELF, TRUE) diff --git a/src/battle/area/kmr_part_3/actor/jr_troopa.c b/src/battle/area/kmr_part_3/actor/jr_troopa.c index 8636be966b..3a779be65a 100644 --- a/src/battle/area/kmr_part_3/actor/jr_troopa.c +++ b/src/battle/area/kmr_part_3/actor/jr_troopa.c @@ -444,7 +444,6 @@ EvtScript N(EVS_HandlePhase) = { Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Call(MoveBattleCamOver, 4) EndIf - EndIf /// @bug END_IF with no IF CaseEq(PHASE_ENEMY_BEGIN) // trying showing the scene where Goompa congratulates the player for dealing damage to Jr Troopa Call(GetActorVar, ACTOR_SELF, AVAR_HitReact_State, LVar0) diff --git a/src/world/area_dro/dro_01/dro_01_4_shop.c b/src/world/area_dro/dro_01/dro_01_4_shop.c index e752a4c485..b3d3049c0e 100644 --- a/src/world/area_dro/dro_01/dro_01_4_shop.c +++ b/src/world/area_dro/dro_01/dro_01_4_shop.c @@ -85,7 +85,6 @@ EvtScript N(EVS_SecretPurcahseOrder_Moustafa) = { Set(GB_StoryProgress, STORY_CH2_BOUGHT_SECRET_ITEMS) Call(func_802D2C14, 0) ExecWait(N(EVS_JumpAway)) - EndIf /// @bug unmatched endif in script Return End }; diff --git a/src/world/area_gv/gv_01/gv_01_1_main.c b/src/world/area_gv/gv_01/gv_01_1_main.c index 237988a96d..505a724e4e 100644 --- a/src/world/area_gv/gv_01/gv_01_1_main.c +++ b/src/world/area_gv/gv_01/gv_01_1_main.c @@ -32,7 +32,7 @@ EvtScript N(EVS_DropLetter) = { Wait(1) EndLoop Return - //@bug not terminated! + End }; EvtScript N(EVS_DropLastLetter) = { @@ -43,7 +43,7 @@ EvtScript N(EVS_DropLastLetter) = { Wait(1) EndLoop Return - //@bug not terminated! + End }; #if VERSION_PAL diff --git a/src/world/area_kpa/kpa_08/kpa_08_0_header.c b/src/world/area_kpa/kpa_08/kpa_08_0_header.c index fd4654018f..0cd1fc07a4 100644 --- a/src/world/area_kpa/kpa_08/kpa_08_0_header.c +++ b/src/world/area_kpa/kpa_08/kpa_08_0_header.c @@ -8,6 +8,6 @@ EntryList N(Entrances) = { MapSettings N(settings) = { .main = &N(EVS_Main), .entryList = &N(Entrances), - .entryCount = 11, //@bug -- should be 2 + .entryCount = 2, .tattle = { MSG_MapTattle_kpa_08 }, }; diff --git a/src/world/area_kpa/kpa_09/kpa_09_0_header.c b/src/world/area_kpa/kpa_09/kpa_09_0_header.c index d63b165e6f..fd6a767b63 100644 --- a/src/world/area_kpa/kpa_09/kpa_09_0_header.c +++ b/src/world/area_kpa/kpa_09/kpa_09_0_header.c @@ -8,6 +8,6 @@ EntryList N(Entrances) = { MapSettings N(settings) = { .main = &N(EVS_Main), .entryList = &N(Entrances), - .entryCount = 11, //@bug -- should be 2 + .entryCount = 2, .tattle = { MSG_MapTattle_kpa_09 }, }; diff --git a/src/world/area_kpa/kpa_96/kpa_96_3_npc.c b/src/world/area_kpa/kpa_96/kpa_96_3_npc.c index 94118dd2da..573f019d20 100644 --- a/src/world/area_kpa/kpa_96/kpa_96_3_npc.c +++ b/src/world/area_kpa/kpa_96/kpa_96_3_npc.c @@ -53,7 +53,6 @@ EvtScript N(EVS_OnBuy) = { CaseEq(SHOP_BUY_RESULT_CANCEL) CaseEq(SHOP_BUY_RESULT_4) CaseEq(SHOP_BUY_RESULT_OK) - CaseEq(SHOP_BUY_RESULT_OK) //@bug duplicate case EndSwitch Return End diff --git a/src/world/area_kzn/kzn_19/kzn_19_1_music.c b/src/world/area_kzn/kzn_19/kzn_19_1_music.c index 4b10dcc226..4b607492f7 100644 --- a/src/world/area_kzn/kzn_19/kzn_19_1_music.c +++ b/src/world/area_kzn/kzn_19/kzn_19_1_music.c @@ -9,7 +9,6 @@ EvtScript N(EVS_SetupMusic) = { Call(PlayAmbientSounds, AMBIENT_LAVA_1) Return EndIf - EndIf //@bug extra endif CaseGe(STORY_CH5_MT_LAVA_LAVA_ERUPTING) Call(PlaySound, SOUND_LOOP_RUMBLE) EndSwitch diff --git a/src/world/area_kzn/kzn_22/kzn_22_4_npc.c b/src/world/area_kzn/kzn_22/kzn_22_4_npc.c index 700b4939da..dd3c69abc1 100644 --- a/src/world/area_kzn/kzn_22/kzn_22_4_npc.c +++ b/src/world/area_kzn/kzn_22/kzn_22_4_npc.c @@ -41,7 +41,6 @@ EvtScript N(EVS_NpcIdle_Kolorado) = { Wait(35) EndIf Wait(10) -EndIf //@bug unmatched endif Call(PlayerFaceNpc, NPC_Kolorado, FALSE) Set(AF_KZN23_SceneStarted, TRUE) Thread diff --git a/src/world/area_mac/mac_03/mac_03_6_foliage.c b/src/world/area_mac/mac_03/mac_03_6_foliage.c index ef940a2f8f..79a1f1cd1d 100644 --- a/src/world/area_mac/mac_03/mac_03_6_foliage.c +++ b/src/world/area_mac/mac_03/mac_03_6_foliage.c @@ -103,9 +103,8 @@ ShakeTreeConfig N(ShakeTree_Tree3) = { .callback = &N(EVS_OnShakeTree3), }; -//@bug x-position should be -265 BombTrigger N(BombPos_Tree3) = { - .pos = { 265.0f, 20.0f, -535.0f }, + .pos = { -265.0f, 20.0f, -535.0f }, .radius = 0.0f }; diff --git a/src/world/area_mac/mac_04/mac_04_5_shop.c b/src/world/area_mac/mac_04/mac_04_5_shop.c index 219d817532..d14e006cf9 100644 --- a/src/world/area_mac/mac_04/mac_04_5_shop.c +++ b/src/world/area_mac/mac_04/mac_04_5_shop.c @@ -51,7 +51,6 @@ EvtScript N(EVS_OnBuy) = { CaseEq(SHOP_BUY_RESULT_CANCEL) CaseEq(SHOP_BUY_RESULT_4) CaseEq(SHOP_BUY_RESULT_OK) - CaseEq(SHOP_BUY_RESULT_OK) //@bug duplicate case EndSwitch Return End diff --git a/src/world/area_trd/trd_06/trd_06_1_main.c b/src/world/area_trd/trd_06/trd_06_1_main.c index 1cfaab2fb4..ad7f212096 100644 --- a/src/world/area_trd/trd_06/trd_06_1_main.c +++ b/src/world/area_trd/trd_06/trd_06_1_main.c @@ -153,7 +153,6 @@ EvtScript N(EVS_Main) = { ExecWait(N(EVS_MakeEntities)) BindTrigger(Ref(N(EVS_ExitDoors_trd_04_5)), TRIGGER_WALL_PRESS_A, COLLIDER_ttw, 1, 0) Call(GetEntryID, LVar0) - Switch(LVar0) //@bug unterminated switch IfLe(LVar0, trd_06_ENTRY_1) IfEq(GF_TRD06_BombedWall, FALSE) BindTrigger(Ref(N(EVS_BombWall_Cell)), TRIGGER_POINT_BOMB, Ref(N(BombPos_CellWall)), 1, 0) diff --git a/src/world/area_trd/trd_10/trd_10_1_main.c b/src/world/area_trd/trd_10/trd_10_1_main.c index 778fbc1277..3a43159e8f 100644 --- a/src/world/area_trd/trd_10/trd_10_1_main.c +++ b/src/world/area_trd/trd_10/trd_10_1_main.c @@ -118,7 +118,6 @@ EvtScript N(EVS_ExitDoors_trd_09_1) = { Exec(ExitDoubleDoor) Wait(17) Call(GotoMap, Ref("trd_09"), trd_09_ENTRY_1) - EndIf //@bug unmatched endif Wait(100) Return End diff --git a/src/world/dead/area_kzn/kzn_19/kzn_19_1_music.c b/src/world/dead/area_kzn/kzn_19/kzn_19_1_music.c index 4b10dcc226..4b607492f7 100644 --- a/src/world/dead/area_kzn/kzn_19/kzn_19_1_music.c +++ b/src/world/dead/area_kzn/kzn_19/kzn_19_1_music.c @@ -9,7 +9,6 @@ EvtScript N(EVS_SetupMusic) = { Call(PlayAmbientSounds, AMBIENT_LAVA_1) Return EndIf - EndIf //@bug extra endif CaseGe(STORY_CH5_MT_LAVA_LAVA_ERUPTING) Call(PlaySound, SOUND_LOOP_RUMBLE) EndSwitch diff --git a/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c b/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c index 700b4939da..dd3c69abc1 100644 --- a/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c +++ b/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c @@ -41,7 +41,6 @@ EvtScript N(EVS_NpcIdle_Kolorado) = { Wait(35) EndIf Wait(10) -EndIf //@bug unmatched endif Call(PlayerFaceNpc, NPC_Kolorado, FALSE) Set(AF_KZN23_SceneStarted, TRUE) Thread From 6961219d51e1f66da72fd44489dcd69e9e281a32 Mon Sep 17 00:00:00 2001 From: HailSanta Date: Wed, 24 Jan 2024 00:49:59 -0500 Subject: [PATCH 4/6] more map fixes --- include/common_structs.h | 6 ------ src/battle/area/arn/actor/tubbas_heart.c | 3 +-- src/battle/btl_states_actions.c | 2 +- src/world/area_flo/flo_24/flo_24_4_water.c | 6 ++---- src/world/area_omo/omo_15/omo_15_3_npc.c | 1 - src/world/area_sam/sam_02/sam_02_2_main.c | 4 +--- src/world/area_sam/sam_07/sam_07_4_frozen_pit.c | 4 ++-- src/world/area_sam/sam_11/sam_11_6_pond.c | 5 ++--- src/world/common/enemy/FrostClubba_Multi.inc.c | 2 +- 9 files changed, 10 insertions(+), 23 deletions(-) diff --git a/include/common_structs.h b/include/common_structs.h index 050e28bb8e..6bb4ff170c 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1761,12 +1761,6 @@ typedef struct BombTrigger { /* 0x0C */ s32 radius; // effective 'size' of the object, usually set to zero because bombettes explosion radius is large enough } BombTrigger; // size = 0x10; -// the use of this is a bug in sam_11 -typedef struct BombTriggerF { - /* 0x00 */ Vec3f pos; - /* 0x0C */ f32 radius; -} BombTriggerF; // size = 0x10; - typedef struct AnimatedModel { /* 0x00 */ s32 animModelID; /* 0x04 */ Vec3f pos; diff --git a/src/battle/area/arn/actor/tubbas_heart.c b/src/battle/area/arn/actor/tubbas_heart.c index 86b6904d71..c969188e38 100644 --- a/src/battle/area/arn/actor/tubbas_heart.c +++ b/src/battle/area/arn/actor/tubbas_heart.c @@ -333,8 +333,7 @@ EvtScript N(EVS_TakeTurn) = { Call(GetCurrentPartnerID, LVar0) IfEq(LVar0, PARTNER_BOW) Call(EnableBattleStatusBar, FALSE) - //@bug -- meant to OR 3 with value of AVAR_Flags, not PARTNER_BOW - Call(GetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) // fix bug + Call(GetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) //BUGFIX BitwiseOrConst(LVar0, AVAL_Flag_TauntBow | AVAL_Flag_HidStatusBar) Call(SetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) Call(UseBattleCamPreset, BTL_CAM_PRESET_14) diff --git a/src/battle/btl_states_actions.c b/src/battle/btl_states_actions.c index 7aa78b63b8..820c467775 100644 --- a/src/battle/btl_states_actions.c +++ b/src/battle/btl_states_actions.c @@ -2020,7 +2020,7 @@ void btl_state_update_end_training_battle(void) { gBattleSubState = BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT; } break; - case BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT: //@bug should be BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT + case BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT: //BUGFIX if (!does_script_exist(partner->handleBatttlePhaseScriptID)) { battleStatus->outtaSightActive = FALSE; gBattleSubState = BTL_SUBSTATE_END_TRAINING_RESET_CAM; diff --git a/src/world/area_flo/flo_24/flo_24_4_water.c b/src/world/area_flo/flo_24/flo_24_4_water.c index 42894671ba..6be32e7229 100644 --- a/src/world/area_flo/flo_24/flo_24_4_water.c +++ b/src/world/area_flo/flo_24/flo_24_4_water.c @@ -14,7 +14,6 @@ EvtScript N(EVS_Scene_FillWithWater) = { Call(SetCamSpeed, CAM_DEFAULT, Float(90.0)) Call(PanToTarget, CAM_DEFAULT, 0, 1) Call(PlaySound, SOUND_LOOP_FLO_FILL_WATER_POOL) - //@bug thread is never terminated Thread Call(MakeLerp, 80, 90, 10, EASING_LINEAR) Label(0) @@ -25,8 +24,7 @@ EvtScript N(EVS_Scene_FillWithWater) = { Wait(1) Goto(0) EndIf - // should end thread here - //@bug thread is never terminated + EndThread Thread Call(MakeLerp, 45, 100, 150, EASING_LINEAR) Loop(0) @@ -37,7 +35,7 @@ EvtScript N(EVS_Scene_FillWithWater) = { BreakLoop EndIf EndLoop - // should end thread here + EndThread Wait(30) Set(GB_StoryProgress, STORY_CH6_FILLED_SPRING_WITH_WATER) Call(GotoMap, Ref("flo_10"), flo_10_ENTRY_2) diff --git a/src/world/area_omo/omo_15/omo_15_3_npc.c b/src/world/area_omo/omo_15/omo_15_3_npc.c index d1a2751ff3..474a43cf41 100644 --- a/src/world/area_omo/omo_15/omo_15_3_npc.c +++ b/src/world/area_omo/omo_15/omo_15_3_npc.c @@ -159,7 +159,6 @@ s32 N(CrowdFleeScriptD)[] = { CS_MOVE( 25, 0) CS_MOVE( -31, -23) CS_MOVE( -97, 0) - -50, //@bug -- ignored by event running this script; previous op should probably be CS_JUMP with this as third arg CS_MOVE(-150, -75) CS_MOVE(-230, -90) CS_MOVE(-309, -55) diff --git a/src/world/area_sam/sam_02/sam_02_2_main.c b/src/world/area_sam/sam_02/sam_02_2_main.c index 6a2d11f5a1..99d462df8a 100644 --- a/src/world/area_sam/sam_02/sam_02_2_main.c +++ b/src/world/area_sam/sam_02/sam_02_2_main.c @@ -20,9 +20,7 @@ BombTrigger N(BombPos_Tree1) = { .radius = 0.0f }; -//@bug model count is 2, but only one is supplied. the extra comma is needed. -// incidentally, the following word is 80243478, which is not a valid modelID. -FoliageModelList N(Tree2_LeafModels) = FOLIAGE_MODEL_LIST(MODEL_o186,); +FoliageModelList N(Tree2_LeafModels) = FOLIAGE_MODEL_LIST(MODEL_o186); ShakeTreeConfig N(ShakeTree_Tree2) = { .leaves = &N(Tree2_LeafModels), diff --git a/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c b/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c index 78041a6114..a9d0edcbb1 100644 --- a/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c +++ b/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c @@ -232,9 +232,9 @@ EvtScript N(EVS_UseGreenSwitch) = { End }; -BombTriggerF N(BombPos_Ice) = { +BombTrigger N(BombPos_Ice) = { .pos = { -940.0f, -130.0f, -75.0f }, - .radius = 60.0f + .radius = 60 }; EvtScript N(EVS_SetupPit) = { diff --git a/src/world/area_sam/sam_11/sam_11_6_pond.c b/src/world/area_sam/sam_11/sam_11_6_pond.c index c729deaa2f..180f29bc98 100644 --- a/src/world/area_sam/sam_11/sam_11_6_pond.c +++ b/src/world/area_sam/sam_11/sam_11_6_pond.c @@ -433,10 +433,9 @@ EvtScript N(EVS_TouchPond_After) = { End }; -// @bug radius is f32 here, should be s32 -BombTriggerF N(BombTrigger_Pond) = { +BombTrigger N(BombTrigger_Pond) = { .pos = { 0.0f, -10.0f, 220.0f }, - .radius = 300.0 + .radius = 300 }; EvtScript N(EVS_SetupPond) = { diff --git a/src/world/common/enemy/FrostClubba_Multi.inc.c b/src/world/common/enemy/FrostClubba_Multi.inc.c index 237267e942..34b535f6d1 100644 --- a/src/world/common/enemy/FrostClubba_Multi.inc.c +++ b/src/world/common/enemy/FrostClubba_Multi.inc.c @@ -143,7 +143,7 @@ EvtScript N(EVS_NpcAI_FrostClubba_Napping) = { NpcSettings N(NpcSettings_FrostClubba_Napping) = { .height = 36, .radius = 34, - .level = ACTOR_LEVEL_CLUBBA, /// @bug should be ACTOR_LEVEL_WHITE_CLUBBA + .level = ACTOR_LEVEL_WHITE_CLUBBA, .ai = &N(EVS_NpcAI_FrostClubba_Napping), .onHit = &EnemyNpcHit, .onDefeat = &EnemyNpcDefeat, From ae8cda294132c4f081ed194e2f98d695d3a92fab Mon Sep 17 00:00:00 2001 From: HailSanta Date: Wed, 24 Jan 2024 03:17:51 -0500 Subject: [PATCH 5/6] altered boot options --- src/background_gfx.c | 4 ++-- src/battle/area/arn/actor/tubbas_heart.c | 2 +- src/battle/btl_states_actions.c | 2 +- src/dx/config.h | 15 ++++++++---- src/filemenu/filemenu_common.c | 5 ---- src/filemenu/filemenu_yesno.c | 15 ------------ src/inventory.c | 1 - src/state_intro.c | 17 ++++++++------ src/state_logos.c | 14 ----------- src/state_startup.c | 28 ++++++++++++++++++---- src/state_title_screen.c | 30 +++++++++++++++++++----- src/world/world.c | 1 - 12 files changed, 71 insertions(+), 63 deletions(-) diff --git a/src/background_gfx.c b/src/background_gfx.c index 101357650d..50142fa061 100644 --- a/src/background_gfx.c +++ b/src/background_gfx.c @@ -4,6 +4,7 @@ #include "hud_element.h" #include "sprite.h" #include "overlay.h" +#include "dx/config.h" extern s32 gPauseBackgroundFade; @@ -258,9 +259,8 @@ void gfx_transfer_frame_to_depth(u16* frameBuffer0, u16* frameBuffer1, u16* zBuf . x . . . */ - //BUGFIX skip laggy blur operations when opening the pause menu on emulator //TODO emulator test -- find which ones have bad performance here - #ifndef OPT_DISABLE_PAUSE_LAG_FIX + #if DX_DISABLE_PAUSE_LAG_FIX if (((frameBuffer1[pixel] >> 2) & 0xF) < 8) { gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x - 1, &filterBuf0[0]); gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x + 1, &filterBuf0[1]); diff --git a/src/battle/area/arn/actor/tubbas_heart.c b/src/battle/area/arn/actor/tubbas_heart.c index c969188e38..330fe3ab58 100644 --- a/src/battle/area/arn/actor/tubbas_heart.c +++ b/src/battle/area/arn/actor/tubbas_heart.c @@ -333,7 +333,7 @@ EvtScript N(EVS_TakeTurn) = { Call(GetCurrentPartnerID, LVar0) IfEq(LVar0, PARTNER_BOW) Call(EnableBattleStatusBar, FALSE) - Call(GetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) //BUGFIX + Call(GetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) BitwiseOrConst(LVar0, AVAL_Flag_TauntBow | AVAL_Flag_HidStatusBar) Call(SetActorVar, ACTOR_SELF, AVAR_Flags, LVar0) Call(UseBattleCamPreset, BTL_CAM_PRESET_14) diff --git a/src/battle/btl_states_actions.c b/src/battle/btl_states_actions.c index 820c467775..d74c01f7fe 100644 --- a/src/battle/btl_states_actions.c +++ b/src/battle/btl_states_actions.c @@ -2020,7 +2020,7 @@ void btl_state_update_end_training_battle(void) { gBattleSubState = BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT; } break; - case BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT: //BUGFIX + case BTL_SUBSTATE_END_TRAINING_AWAIT_OUTTA_SIGHT: if (!does_script_exist(partner->handleBatttlePhaseScriptID)) { battleStatus->outtaSightActive = FALSE; gBattleSubState = BTL_SUBSTATE_END_TRAINING_RESET_CAM; diff --git a/src/dx/config.h b/src/dx/config.h index 75ca24be0a..f195387d62 100644 --- a/src/dx/config.h +++ b/src/dx/config.h @@ -4,15 +4,17 @@ /// Enables the debug menu. #define DX_DEBUG_MENU 1 +/// Loads last used save file +#define DX_QUICK_LAUNCH 0 + /// Skips logos (Nintendo, Intelligent Systems, etc.). #define DX_SKIP_LOGOS 1 -/// Skips the title screen. -#define DX_SKIP_TITLE 1 +/// Skips the introductory storybook. +#define DX_SKIP_STORY 1 -/// Skips the file select. -/// If a save file exists, the game will load it automatically, otherwise it will start a new game. -#define DX_SKIP_FILE_SELECT 1 +/// Skips the demo reel playing while waiting for the player to 'Press Start'. +#define DX_SKIP_DEMO 1 /// Map to load when starting a new game. #define NEW_GAME_MAP_ID "kmr_20" @@ -27,4 +29,7 @@ /// Press L + D-Pad Up to show/hide the profiler. #define USE_PROFILER 1 +/// Skip laggy blur operations when opening the pause menu on emulator +#define DX_DISABLE_PAUSE_LAG_FIX 0 + #endif diff --git a/src/filemenu/filemenu_common.c b/src/filemenu/filemenu_common.c index 5d71da323f..5e587c615d 100644 --- a/src/filemenu/filemenu_common.c +++ b/src/filemenu/filemenu_common.c @@ -4,7 +4,6 @@ #include "fio.h" #include "ld_addrs.h" #include "game_modes.h" -#include "dx/config.h" extern HudScript HES_AnimatedCursorHand; @@ -332,10 +331,6 @@ void filemenu_update(void) { filemenu_heldButtons &= ~BUTTON_A; } -#if DX_SKIP_FILE_SELECT - filemenu_pressedButtons = BUTTON_A; -#endif - if (menu->initialized) { if (menu->fpHandleInput != NULL) { menu->fpHandleInput(menu); diff --git a/src/filemenu/filemenu_yesno.c b/src/filemenu/filemenu_yesno.c index 85f27696ff..1cf2017f34 100644 --- a/src/filemenu/filemenu_yesno.c +++ b/src/filemenu/filemenu_yesno.c @@ -218,21 +218,6 @@ INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_handle_input); void filemenu_yesno_handle_input(MenuPanel* menu) { s32 oldSelected = menu->selected; -#if DX_SKIP_FILE_SELECT - s32 i; - for (i = 0; i < ARRAY_COUNT(gSaveSlotHasData); i++) { - if (gSaveSlotHasData[i]) { - filemenu_menus[0]->selected = i; - break; - } - } - if (i == ARRAY_COUNT(gSaveSlotHasData)) { - menu->page = 2; // create new save - } else { - menu->page = 4; // load save - } -#endif - if (filemenu_heldButtons & BUTTON_STICK_UP) { menu->row--; if (menu->row < 0) { diff --git a/src/inventory.c b/src/inventory.c index c7dd67e256..18d0c3beb7 100644 --- a/src/inventory.c +++ b/src/inventory.c @@ -1,6 +1,5 @@ #include "common.h" #include "hud_element.h" -#include "dx/config.h" #define FULLY_EXTENDED_Y 18 #define FULLY_RETRACTED_Y -100 diff --git a/src/state_intro.c b/src/state_intro.c index a2de9ad898..26e2148eec 100644 --- a/src/state_intro.c +++ b/src/state_intro.c @@ -2,6 +2,7 @@ #include "hud_element.h" #include "sprite.h" #include "game_modes.h" +#include "dx/config.h" enum IntroStates { INTRO_INIT = 0x00000000, @@ -9,7 +10,7 @@ enum IntroStates { INTRO_LOAD_MAP = 0x00000002, INTRO_AWAIT_MAIN = 0x00000003, INTRO_FADE_IN = 0x00000004, - INTRO_ENABLE_DRAW_FRAME = 0x00000015, // unused + INTRO_ENABLE_DRAW_FRAME = 0x00000015, // unused }; SHIFT_BSS s32 IntroEnableDrawFrameDelay; @@ -23,16 +24,13 @@ SHIFT_BSS s32 IntroOverlayType; SHIFT_BSS s32 D_800A0964; // related to skipping the intro void state_init_intro(void) { - s8 viewportMode; - gGameStatusPtr->startupState = INTRO_INIT; set_curtain_scale_goal(1.0f); set_curtain_fade_goal(0.3f); - viewportMode = gGameStatusPtr->introPart; - switch (viewportMode) { - case 0: + switch (gGameStatusPtr->introPart) { + case INTRO_PART_0: startup_set_fade_screen_alpha(0); IntroOverlayAlpha = 255; @@ -49,7 +47,7 @@ void state_init_intro(void) { gGameStatusPtr->mapID = 5; //TODO hard-coded map ID gGameStatusPtr->entryID = 3; break; - case 1: + case INTRO_PART_1: startup_set_fade_screen_alpha(0); IntroOverlayAlpha = 0; @@ -96,6 +94,11 @@ void state_step_intro(void) { u32 pressedButtons = gGameStatusPtr->pressedButtons[0]; s32 i; + #if DX_SKIP_STORY + // immediately quit out of the state when skipping story + pressedButtons = BUTTON_START; + #endif + if (gGameStatusPtr->introPart != INTRO_PART_NONE) { if (D_800A0964 == 0 && pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_START | BUTTON_Z)) { D_800A0964 = 1; diff --git a/src/state_logos.c b/src/state_logos.c index 6cdf43e181..026b96f764 100644 --- a/src/state_logos.c +++ b/src/state_logos.c @@ -6,7 +6,6 @@ #include "nu/nusys.h" #include "fio.h" #include "game_modes.h" -#include "dx/config.h" void appendGfx_intro_logos(void); @@ -127,10 +126,7 @@ void state_init_logos(void) { } void state_step_logos(void) { -#if VERSION_JP int pressedButtons = gGameStatusPtr->pressedButtons[0]; -#endif - if (gGameStatusPtr->skipLogos) { if (startup_fade_screen_out(10)) { set_curtain_scale(1.0f); @@ -138,7 +134,6 @@ void state_step_logos(void) { set_game_mode(GAME_MODE_TITLE_SCREEN); } } else { -#if VERSION_JP if ((gGameStatusPtr->startupState == LOGOS_STATE_N64_HOLD || gGameStatusPtr->startupState == LOGOS_STATE_N64_FADE_OUT || gGameStatusPtr->startupState == LOGOS_STATE_NINTENDO_FADE_IN @@ -154,7 +149,6 @@ void state_step_logos(void) { startup_set_fade_screen_color(208); gGameStatusPtr->skipLogos = TRUE; } -#endif switch (gGameStatusPtr->startupState) { case LOGOS_STATE_N64_FADE_IN: @@ -241,14 +235,6 @@ void state_step_logos(void) { heap_free(gLogosImages); gLogosImages = NULL; startup_set_fade_screen_alpha(255); -#if DX_SKIP_TITLE - if (fio_load_game(0)) { - initialize_curtains(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; - set_game_mode(GAME_MODE_WORLD); - break; - } -#endif gGameStatusPtr->introPart = INTRO_PART_0; set_game_mode(GAME_MODE_INTRO); break; diff --git a/src/state_startup.c b/src/state_startup.c index cf157ea988..f67ed750b8 100644 --- a/src/state_startup.c +++ b/src/state_startup.c @@ -82,11 +82,29 @@ void state_step_startup(void) { } gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; -#if DX_SKIP_LOGOS - set_game_mode(GAME_MODE_TITLE_SCREEN); -#else - set_game_mode(GAME_MODE_LOGOS); -#endif + + #if DX_QUICK_LAUNCH + // immediately jump into the world using last-used save file + gGameStatusPtr->saveSlot = gSaveGlobals.lastFileSelected; + fio_load_game(gGameStatusPtr->saveSlot); + set_game_mode(GAME_MODE_ENTER_WORLD); + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; + #elif DX_SKIP_LOGOS + // go right to the story book or file select + #if DX_SKIP_STORY + set_curtain_scale(1.0f); + set_curtain_fade(0.0f); + set_game_mode(GAME_MODE_TITLE_SCREEN); + #else + set_curtain_scale(1.0f); + set_curtain_fade(0.3f); + gGameStatusPtr->introPart = INTRO_PART_0; + set_game_mode(GAME_MODE_INTRO); + #endif + #else + // use vanilla startup process + set_game_mode(GAME_MODE_LOGOS); + #endif } void state_drawUI_startup(void) { diff --git a/src/state_title_screen.c b/src/state_title_screen.c index 68e8f39b1c..6fbd0ed2a6 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -198,12 +198,6 @@ void state_step_title_screen(void) { set_curtain_scale(1.0f); set_curtain_fade(0.0f); -#if DX_SKIP_TITLE - gGameStatusPtr->startupState = TITLE_STATE_EXIT; - TitleScreenNextState = NEXT_STATE_FILE_SELECT; - TitleScreen_TimeLeft = 0; -#endif - if (TitleScreen_TimeLeft > 0) { TitleScreen_TimeLeft--; } @@ -233,6 +227,29 @@ void state_step_title_screen(void) { startup_fade_screen_update(); break; case TITLE_STATE_HOLD: + + #if DX_SKIP_DEMO && DX_SKIP_STORY + // play neither demo nor story + TitleScreen_TimeLeft = 200; + #elif DX_SKIP_DEMO + // only the story may play + if (TitleScreen_TimeLeft == 120) { + bgm_set_song(0, -1, 0, 3900, 8); + } + if (TitleScreen_TimeLeft == 0) { + gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS; + TitleScreenNextState = NEXT_STATE_INTRO; + return; + } + #elif DX_SKIP_STORY + // only the demo may play + if (TitleScreen_TimeLeft == 0) { + gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS; + TitleScreenNextState = NEXT_STATE_DEMO; + return; + } + #else + // allow either demo or story to play if (PlayIntroNext && TitleScreen_TimeLeft == 120) { bgm_set_song(0, -1, 0, 3900, 8); } @@ -246,6 +263,7 @@ void state_step_title_screen(void) { PlayIntroNext ^= 1; return; } + #endif if (pressedButtons & (BUTTON_A | BUTTON_START)) { gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS; TitleScreenNextState = NEXT_STATE_FILE_SELECT; diff --git a/src/world/world.c b/src/world/world.c index ab6af22086..d582a2062e 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -7,7 +7,6 @@ #include "sprite.h" #include "model.h" #include "gcc/string.h" -#include "dx/config.h" s32 WorldReverbModeMapping[] = { 0, 1, 2, 3 }; From 39e4f3e20716ce3cb2797ea8ee531f2c7efa3fb3 Mon Sep 17 00:00:00 2001 From: HailSanta Date: Wed, 24 Jan 2024 15:47:49 -0500 Subject: [PATCH 6/6] DX_PAUSE_LAG_FIX --- src/background_gfx.c | 2 +- src/dx/config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/background_gfx.c b/src/background_gfx.c index 50142fa061..6710918a0d 100644 --- a/src/background_gfx.c +++ b/src/background_gfx.c @@ -260,7 +260,7 @@ void gfx_transfer_frame_to_depth(u16* frameBuffer0, u16* frameBuffer1, u16* zBuf . . */ //TODO emulator test -- find which ones have bad performance here - #if DX_DISABLE_PAUSE_LAG_FIX + #if !DX_PAUSE_LAG_FIX if (((frameBuffer1[pixel] >> 2) & 0xF) < 8) { gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x - 1, &filterBuf0[0]); gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x + 1, &filterBuf0[1]); diff --git a/src/dx/config.h b/src/dx/config.h index f195387d62..eda9c48ce8 100644 --- a/src/dx/config.h +++ b/src/dx/config.h @@ -30,6 +30,6 @@ #define USE_PROFILER 1 /// Skip laggy blur operations when opening the pause menu on emulator -#define DX_DISABLE_PAUSE_LAG_FIX 0 +#define DX_PAUSE_LAG_FIX 1 #endif