diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index 34498d2a..c9e1c87f 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -32,6 +32,7 @@ in_files = [ "src/game/obj_behaviors.c", "src/game/save_file.h", "src/game/obj_behaviors_2.h", + "include/dialog_ids.h", ] exclude_constants = { diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index d532db10..d0f04df2 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -63,7 +63,7 @@ override_field_names = { override_field_types = { "Surface": { "normal": "Vec3f" }, - "Object": { "oAnimations": "ObjectAnimPointer*"} + "Object": { "oAnimations": "ObjectAnimPointer*"}, } override_field_mutable = { diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index bf4999ec..b58f8d16 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -2570,6 +2570,521 @@ CT_WARIO = 4 --- @type CharacterType CT_MAX = 5 +--- @class DialogId + +--- @type DialogId +DIALOG_000 = 0 + +--- @type DialogId +DIALOG_001 = 1 + +--- @type DialogId +DIALOG_002 = 2 + +--- @type DialogId +DIALOG_003 = 3 + +--- @type DialogId +DIALOG_004 = 4 + +--- @type DialogId +DIALOG_005 = 5 + +--- @type DialogId +DIALOG_006 = 6 + +--- @type DialogId +DIALOG_007 = 7 + +--- @type DialogId +DIALOG_008 = 8 + +--- @type DialogId +DIALOG_009 = 9 + +--- @type DialogId +DIALOG_010 = 10 + +--- @type DialogId +DIALOG_011 = 11 + +--- @type DialogId +DIALOG_012 = 12 + +--- @type DialogId +DIALOG_013 = 13 + +--- @type DialogId +DIALOG_014 = 14 + +--- @type DialogId +DIALOG_015 = 15 + +--- @type DialogId +DIALOG_016 = 16 + +--- @type DialogId +DIALOG_017 = 17 + +--- @type DialogId +DIALOG_018 = 18 + +--- @type DialogId +DIALOG_019 = 19 + +--- @type DialogId +DIALOG_020 = 20 + +--- @type DialogId +DIALOG_021 = 21 + +--- @type DialogId +DIALOG_022 = 22 + +--- @type DialogId +DIALOG_023 = 23 + +--- @type DialogId +DIALOG_024 = 24 + +--- @type DialogId +DIALOG_025 = 25 + +--- @type DialogId +DIALOG_026 = 26 + +--- @type DialogId +DIALOG_027 = 27 + +--- @type DialogId +DIALOG_028 = 28 + +--- @type DialogId +DIALOG_029 = 29 + +--- @type DialogId +DIALOG_030 = 30 + +--- @type DialogId +DIALOG_031 = 31 + +--- @type DialogId +DIALOG_032 = 32 + +--- @type DialogId +DIALOG_033 = 33 + +--- @type DialogId +DIALOG_034 = 34 + +--- @type DialogId +DIALOG_035 = 35 + +--- @type DialogId +DIALOG_036 = 36 + +--- @type DialogId +DIALOG_037 = 37 + +--- @type DialogId +DIALOG_038 = 38 + +--- @type DialogId +DIALOG_039 = 39 + +--- @type DialogId +DIALOG_040 = 40 + +--- @type DialogId +DIALOG_041 = 41 + +--- @type DialogId +DIALOG_042 = 42 + +--- @type DialogId +DIALOG_043 = 43 + +--- @type DialogId +DIALOG_044 = 44 + +--- @type DialogId +DIALOG_045 = 45 + +--- @type DialogId +DIALOG_046 = 46 + +--- @type DialogId +DIALOG_047 = 47 + +--- @type DialogId +DIALOG_048 = 48 + +--- @type DialogId +DIALOG_049 = 49 + +--- @type DialogId +DIALOG_050 = 50 + +--- @type DialogId +DIALOG_051 = 51 + +--- @type DialogId +DIALOG_052 = 52 + +--- @type DialogId +DIALOG_053 = 53 + +--- @type DialogId +DIALOG_054 = 54 + +--- @type DialogId +DIALOG_055 = 55 + +--- @type DialogId +DIALOG_056 = 56 + +--- @type DialogId +DIALOG_057 = 57 + +--- @type DialogId +DIALOG_058 = 58 + +--- @type DialogId +DIALOG_059 = 59 + +--- @type DialogId +DIALOG_060 = 60 + +--- @type DialogId +DIALOG_061 = 61 + +--- @type DialogId +DIALOG_062 = 62 + +--- @type DialogId +DIALOG_063 = 63 + +--- @type DialogId +DIALOG_064 = 64 + +--- @type DialogId +DIALOG_065 = 65 + +--- @type DialogId +DIALOG_066 = 66 + +--- @type DialogId +DIALOG_067 = 67 + +--- @type DialogId +DIALOG_068 = 68 + +--- @type DialogId +DIALOG_069 = 69 + +--- @type DialogId +DIALOG_070 = 70 + +--- @type DialogId +DIALOG_071 = 71 + +--- @type DialogId +DIALOG_072 = 72 + +--- @type DialogId +DIALOG_073 = 73 + +--- @type DialogId +DIALOG_074 = 74 + +--- @type DialogId +DIALOG_075 = 75 + +--- @type DialogId +DIALOG_076 = 76 + +--- @type DialogId +DIALOG_077 = 77 + +--- @type DialogId +DIALOG_078 = 78 + +--- @type DialogId +DIALOG_079 = 79 + +--- @type DialogId +DIALOG_080 = 80 + +--- @type DialogId +DIALOG_081 = 81 + +--- @type DialogId +DIALOG_082 = 82 + +--- @type DialogId +DIALOG_083 = 83 + +--- @type DialogId +DIALOG_084 = 84 + +--- @type DialogId +DIALOG_085 = 85 + +--- @type DialogId +DIALOG_086 = 86 + +--- @type DialogId +DIALOG_087 = 87 + +--- @type DialogId +DIALOG_088 = 88 + +--- @type DialogId +DIALOG_089 = 89 + +--- @type DialogId +DIALOG_090 = 90 + +--- @type DialogId +DIALOG_091 = 91 + +--- @type DialogId +DIALOG_092 = 92 + +--- @type DialogId +DIALOG_093 = 93 + +--- @type DialogId +DIALOG_094 = 94 + +--- @type DialogId +DIALOG_095 = 95 + +--- @type DialogId +DIALOG_096 = 96 + +--- @type DialogId +DIALOG_097 = 97 + +--- @type DialogId +DIALOG_098 = 98 + +--- @type DialogId +DIALOG_099 = 99 + +--- @type DialogId +DIALOG_100 = 100 + +--- @type DialogId +DIALOG_101 = 101 + +--- @type DialogId +DIALOG_102 = 102 + +--- @type DialogId +DIALOG_103 = 103 + +--- @type DialogId +DIALOG_104 = 104 + +--- @type DialogId +DIALOG_105 = 105 + +--- @type DialogId +DIALOG_106 = 106 + +--- @type DialogId +DIALOG_107 = 107 + +--- @type DialogId +DIALOG_108 = 108 + +--- @type DialogId +DIALOG_109 = 109 + +--- @type DialogId +DIALOG_110 = 110 + +--- @type DialogId +DIALOG_111 = 111 + +--- @type DialogId +DIALOG_112 = 112 + +--- @type DialogId +DIALOG_113 = 113 + +--- @type DialogId +DIALOG_114 = 114 + +--- @type DialogId +DIALOG_115 = 115 + +--- @type DialogId +DIALOG_116 = 116 + +--- @type DialogId +DIALOG_117 = 117 + +--- @type DialogId +DIALOG_118 = 118 + +--- @type DialogId +DIALOG_119 = 119 + +--- @type DialogId +DIALOG_120 = 120 + +--- @type DialogId +DIALOG_121 = 121 + +--- @type DialogId +DIALOG_122 = 122 + +--- @type DialogId +DIALOG_123 = 123 + +--- @type DialogId +DIALOG_124 = 124 + +--- @type DialogId +DIALOG_125 = 125 + +--- @type DialogId +DIALOG_126 = 126 + +--- @type DialogId +DIALOG_127 = 127 + +--- @type DialogId +DIALOG_128 = 128 + +--- @type DialogId +DIALOG_129 = 129 + +--- @type DialogId +DIALOG_130 = 130 + +--- @type DialogId +DIALOG_131 = 131 + +--- @type DialogId +DIALOG_132 = 132 + +--- @type DialogId +DIALOG_133 = 133 + +--- @type DialogId +DIALOG_134 = 134 + +--- @type DialogId +DIALOG_135 = 135 + +--- @type DialogId +DIALOG_136 = 136 + +--- @type DialogId +DIALOG_137 = 137 + +--- @type DialogId +DIALOG_138 = 138 + +--- @type DialogId +DIALOG_139 = 139 + +--- @type DialogId +DIALOG_140 = 140 + +--- @type DialogId +DIALOG_141 = 141 + +--- @type DialogId +DIALOG_142 = 142 + +--- @type DialogId +DIALOG_143 = 143 + +--- @type DialogId +DIALOG_144 = 144 + +--- @type DialogId +DIALOG_145 = 145 + +--- @type DialogId +DIALOG_146 = 146 + +--- @type DialogId +DIALOG_147 = 147 + +--- @type DialogId +DIALOG_148 = 148 + +--- @type DialogId +DIALOG_149 = 149 + +--- @type DialogId +DIALOG_150 = 150 + +--- @type DialogId +DIALOG_151 = 151 + +--- @type DialogId +DIALOG_152 = 152 + +--- @type DialogId +DIALOG_153 = 153 + +--- @type DialogId +DIALOG_154 = 154 + +--- @type DialogId +DIALOG_155 = 155 + +--- @type DialogId +DIALOG_156 = 156 + +--- @type DialogId +DIALOG_157 = 157 + +--- @type DialogId +DIALOG_158 = 158 + +--- @type DialogId +DIALOG_159 = 159 + +--- @type DialogId +DIALOG_160 = 160 + +--- @type DialogId +DIALOG_161 = 161 + +--- @type DialogId +DIALOG_162 = 162 + +--- @type DialogId +DIALOG_163 = 163 + +--- @type DialogId +DIALOG_164 = 164 + +--- @type DialogId +DIALOG_165 = 165 + +--- @type DialogId +DIALOG_166 = 166 + +--- @type DialogId +DIALOG_167 = 167 + +--- @type DialogId +DIALOG_168 = 168 + +--- @type DialogId +DIALOG_169 = 169 + +--- @type DialogId +DIALOG_COUNT = 170 + --- @class DjuiFontType --- @type DjuiFontType diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 56ab13e6..dec1cb0d 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -7045,6 +7045,22 @@ function deref_s32_pointer(pointer) -- ... end +--- @param dialogId DialogId +--- @param unused integer +--- @param linesPerBox integer +--- @param leftOffset integer +--- @param width integer +--- @param str string +--- @return nil +function dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str) + -- ... +end + +--- @return nil +function dialog_reset_all() + -- ... +end + --- @return integer function get_current_save_file_num() -- ... diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 9a0d1979..1b1e449e 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -41,6 +41,92 @@ --- @field public terrainType integer --- @field public warpNodes ObjectWarpNode +--- @class BehaviorDialogs +--- @field public BobombBuddyBob1Dialog DialogId +--- @field public BobombBuddyBob2Dialog DialogId +--- @field public BobombBuddyOther1Dialog DialogId +--- @field public BobombBuddyOther2Dialog DialogId +--- @field public Bowser1DefeatedDialog DialogId +--- @field public Bowser1Dialog DialogId +--- @field public Bowser2DefeatedDialog DialogId +--- @field public Bowser2Dialog DialogId +--- @field public Bowser3Defeated120StarsDialog DialogId +--- @field public Bowser3DefeatedDialog DialogId +--- @field public Bowser3Dialog DialogId +--- @field public CapswitchBaseDialog DialogId +--- @field public CapswitchMetalDialog DialogId +--- @field public CapswitchVanishDialog DialogId +--- @field public CapswitchWingDialog DialogId +--- @field public CastleEnterDialog DialogId +--- @field public CollectedStarDialog DialogId +--- @field public DefaultCutsceneDialog DialogId +--- @field public DoorNeed1StarDialog DialogId +--- @field public DoorNeed30StarsDialog DialogId +--- @field public DoorNeed3StarsDialog DialogId +--- @field public DoorNeed50StarsDialog DialogId +--- @field public DoorNeed70StarsDialog DialogId +--- @field public DoorNeed8StarsDialog DialogId +--- @field public DoorNeedKeyDialog DialogId +--- @field public EyerokDefeatedDialog DialogId +--- @field public EyerokIntroDialog DialogId +--- @field public GhostHuntAfterDialog DialogId +--- @field public GhostHuntDialog DialogId +--- @field public HootIntroDialog DialogId +--- @field public HootTiredDialog DialogId +--- @field public HundredCoinsDialog DialogId +--- @field public IntroPipeDialog DialogId +--- @field public KeyDoor1DontHaveDialog DialogId +--- @field public KeyDoor1HaveDialog DialogId +--- @field public KeyDoor2DontHaveDialog DialogId +--- @field public KeyDoor2HaveDialog DialogId +--- @field public KingBobombCheatDialog DialogId +--- @field public KingBobombDefeatDialog DialogId +--- @field public KingBobombIntroDialog DialogId +--- @field public KingWhompDefeatDialog DialogId +--- @field public KingWhompDialog DialogId +--- @field public KoopaQuickBobStartDialog DialogId +--- @field public KoopaQuickBobWinDialog DialogId +--- @field public KoopaQuickCheatedDialog DialogId +--- @field public KoopaQuickLostDialog DialogId +--- @field public KoopaQuickThiStartDialog DialogId +--- @field public KoopaQuickThiWinDialog DialogId +--- @field public LakituIntroDialog DialogId +--- @field public MetalCourseDialog DialogId +--- @field public Mips1Dialog DialogId +--- @field public Mips2Dialog DialogId +--- @field public PeachLetterDialog DialogId +--- @field public RacingPenguinBigStartDialog DialogId +--- @field public RacingPenguinCheatDialog DialogId +--- @field public RacingPenguinLostDialog DialogId +--- @field public RacingPenguinStartDialog DialogId +--- @field public RacingPenguinWinDialog DialogId +--- @field public SnowmanHeadAfterDialog DialogId +--- @field public SnowmanHeadBodyDialog DialogId +--- @field public SnowmanHeadDialog DialogId +--- @field public SnowmanWindDialog DialogId +--- @field public StarCollectionBaseDialog DialogId +--- @field public StarDoorDialog DialogId +--- @field public ToadStar1AfterDialog DialogId +--- @field public ToadStar1Dialog DialogId +--- @field public ToadStar2AfterDialog DialogId +--- @field public ToadStar2Dialog DialogId +--- @field public ToadStar3AfterDialog DialogId +--- @field public ToadStar3Dialog DialogId +--- @field public TuxieMotherBabyFoundDialog DialogId +--- @field public TuxieMotherBabyWrongDialog DialogId +--- @field public TuxieMotherDialog DialogId +--- @field public UkikiCageDialog DialogId +--- @field public UkikiCapGiveDialog DialogId +--- @field public UkikiCapStealDialog DialogId +--- @field public UkikiHeldDialog DialogId +--- @field public VanishCourseDialog DialogId +--- @field public WigglerAttack1Dialog DialogId +--- @field public WigglerAttack2Dialog DialogId +--- @field public WigglerAttack3Dialog DialogId +--- @field public WigglerDialog DialogId +--- @field public WingCourseDialog DialogId +--- @field public YoshiDialog DialogId + --- @class BehaviorTrajectories --- @field public BowlingBallBob2Trajectory Pointer_Trajectory --- @field public BowlingBallBobTrajectory Pointer_Trajectory @@ -75,6 +161,14 @@ --- @field public KoopaBobAgility number --- @field public KoopaCatchupAgility number --- @field public KoopaThiAgility number +--- @field public RacingPenguinBigHeight number +--- @field public RacingPenguinBigRadius number +--- @field public RacingPenguinHeight number +--- @field public RacingPenguinRadius number +--- @field public ToadStar1Requirement integer +--- @field public ToadStar2Requirement integer +--- @field public ToadStar3Requirement integer +--- @field public dialogs BehaviorDialogs --- @field public trajectories BehaviorTrajectories --- @class BullyCollisionData diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 563d657b..4fd1d76b 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -7,6 +7,8 @@ - [characters.h](#charactersh) - [enum CharacterSound](#enum-CharacterSound) - [enum CharacterType](#enum-CharacterType) +- [dialog_ids.h](#dialog_idsh) + - [enum DialogId](#enum-DialogId) - [djui_hud_utils.h](#djui_hud_utilsh) - [enum DjuiFontType](#enum-DjuiFontType) - [enum HudUtilsResolution](#enum-HudUtilsResolution) @@ -843,6 +845,187 @@
+## [dialog_ids.h](#dialog_ids.h) + +### [enum DialogId](#DialogId) +| Identifier | Value | +| :--------- | :---- | +| DIALOG_000 | 0 | +| DIALOG_001 | 1 | +| DIALOG_002 | 2 | +| DIALOG_003 | 3 | +| DIALOG_004 | 4 | +| DIALOG_005 | 5 | +| DIALOG_006 | 6 | +| DIALOG_007 | 7 | +| DIALOG_008 | 8 | +| DIALOG_009 | 9 | +| DIALOG_010 | 10 | +| DIALOG_011 | 11 | +| DIALOG_012 | 12 | +| DIALOG_013 | 13 | +| DIALOG_014 | 14 | +| DIALOG_015 | 15 | +| DIALOG_016 | 16 | +| DIALOG_017 | 17 | +| DIALOG_018 | 18 | +| DIALOG_019 | 19 | +| DIALOG_020 | 20 | +| DIALOG_021 | 21 | +| DIALOG_022 | 22 | +| DIALOG_023 | 23 | +| DIALOG_024 | 24 | +| DIALOG_025 | 25 | +| DIALOG_026 | 26 | +| DIALOG_027 | 27 | +| DIALOG_028 | 28 | +| DIALOG_029 | 29 | +| DIALOG_030 | 30 | +| DIALOG_031 | 31 | +| DIALOG_032 | 32 | +| DIALOG_033 | 33 | +| DIALOG_034 | 34 | +| DIALOG_035 | 35 | +| DIALOG_036 | 36 | +| DIALOG_037 | 37 | +| DIALOG_038 | 38 | +| DIALOG_039 | 39 | +| DIALOG_040 | 40 | +| DIALOG_041 | 41 | +| DIALOG_042 | 42 | +| DIALOG_043 | 43 | +| DIALOG_044 | 44 | +| DIALOG_045 | 45 | +| DIALOG_046 | 46 | +| DIALOG_047 | 47 | +| DIALOG_048 | 48 | +| DIALOG_049 | 49 | +| DIALOG_050 | 50 | +| DIALOG_051 | 51 | +| DIALOG_052 | 52 | +| DIALOG_053 | 53 | +| DIALOG_054 | 54 | +| DIALOG_055 | 55 | +| DIALOG_056 | 56 | +| DIALOG_057 | 57 | +| DIALOG_058 | 58 | +| DIALOG_059 | 59 | +| DIALOG_060 | 60 | +| DIALOG_061 | 61 | +| DIALOG_062 | 62 | +| DIALOG_063 | 63 | +| DIALOG_064 | 64 | +| DIALOG_065 | 65 | +| DIALOG_066 | 66 | +| DIALOG_067 | 67 | +| DIALOG_068 | 68 | +| DIALOG_069 | 69 | +| DIALOG_070 | 70 | +| DIALOG_071 | 71 | +| DIALOG_072 | 72 | +| DIALOG_073 | 73 | +| DIALOG_074 | 74 | +| DIALOG_075 | 75 | +| DIALOG_076 | 76 | +| DIALOG_077 | 77 | +| DIALOG_078 | 78 | +| DIALOG_079 | 79 | +| DIALOG_080 | 80 | +| DIALOG_081 | 81 | +| DIALOG_082 | 82 | +| DIALOG_083 | 83 | +| DIALOG_084 | 84 | +| DIALOG_085 | 85 | +| DIALOG_086 | 86 | +| DIALOG_087 | 87 | +| DIALOG_088 | 88 | +| DIALOG_089 | 89 | +| DIALOG_090 | 90 | +| DIALOG_091 | 91 | +| DIALOG_092 | 92 | +| DIALOG_093 | 93 | +| DIALOG_094 | 94 | +| DIALOG_095 | 95 | +| DIALOG_096 | 96 | +| DIALOG_097 | 97 | +| DIALOG_098 | 98 | +| DIALOG_099 | 99 | +| DIALOG_100 | 100 | +| DIALOG_101 | 101 | +| DIALOG_102 | 102 | +| DIALOG_103 | 103 | +| DIALOG_104 | 104 | +| DIALOG_105 | 105 | +| DIALOG_106 | 106 | +| DIALOG_107 | 107 | +| DIALOG_108 | 108 | +| DIALOG_109 | 109 | +| DIALOG_110 | 110 | +| DIALOG_111 | 111 | +| DIALOG_112 | 112 | +| DIALOG_113 | 113 | +| DIALOG_114 | 114 | +| DIALOG_115 | 115 | +| DIALOG_116 | 116 | +| DIALOG_117 | 117 | +| DIALOG_118 | 118 | +| DIALOG_119 | 119 | +| DIALOG_120 | 120 | +| DIALOG_121 | 121 | +| DIALOG_122 | 122 | +| DIALOG_123 | 123 | +| DIALOG_124 | 124 | +| DIALOG_125 | 125 | +| DIALOG_126 | 126 | +| DIALOG_127 | 127 | +| DIALOG_128 | 128 | +| DIALOG_129 | 129 | +| DIALOG_130 | 130 | +| DIALOG_131 | 131 | +| DIALOG_132 | 132 | +| DIALOG_133 | 133 | +| DIALOG_134 | 134 | +| DIALOG_135 | 135 | +| DIALOG_136 | 136 | +| DIALOG_137 | 137 | +| DIALOG_138 | 138 | +| DIALOG_139 | 139 | +| DIALOG_140 | 140 | +| DIALOG_141 | 141 | +| DIALOG_142 | 142 | +| DIALOG_143 | 143 | +| DIALOG_144 | 144 | +| DIALOG_145 | 145 | +| DIALOG_146 | 146 | +| DIALOG_147 | 147 | +| DIALOG_148 | 148 | +| DIALOG_149 | 149 | +| DIALOG_150 | 150 | +| DIALOG_151 | 151 | +| DIALOG_152 | 152 | +| DIALOG_153 | 153 | +| DIALOG_154 | 154 | +| DIALOG_155 | 155 | +| DIALOG_156 | 156 | +| DIALOG_157 | 157 | +| DIALOG_158 | 158 | +| DIALOG_159 | 159 | +| DIALOG_160 | 160 | +| DIALOG_161 | 161 | +| DIALOG_162 | 162 | +| DIALOG_163 | 163 | +| DIALOG_164 | 164 | +| DIALOG_165 | 165 | +| DIALOG_166 | 166 | +| DIALOG_167 | 167 | +| DIALOG_168 | 168 | +| DIALOG_169 | 169 | +| DIALOG_COUNT | 170 | + +[:arrow_up_small:](#) + +
+ ## [djui_hud_utils.h](#djui_hud_utils.h) ### [enum DjuiFontType](#DjuiFontType) diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 8760fcaa..5341ab6d 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1311,6 +1311,8 @@ - smlua_misc_utils.h - [allocate_mario_action](#allocate_mario_action) - [deref_s32_pointer](#deref_s32_pointer) + - [dialog_replace](#dialog_replace) + - [dialog_reset_all](#dialog_reset_all) - [get_current_save_file_num](#get_current_save_file_num) - [get_environment_region](#get_environment_region) - [get_hand_foot_pos_x](#get_hand_foot_pos_x) @@ -24633,6 +24635,49 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [dialog_replace](#dialog_replace) + +### Lua Example +`dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dialogId | [enum DialogId](constants.md#enum-DialogId) | +| unused | `integer` | +| linesPerBox | `integer` | +| leftOffset | `integer` | +| width | `integer` | +| str | `string` | + +### Returns +- None + +### C Prototype +`void dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);` + +[:arrow_up_small:](#) + +
+ +## [dialog_reset_all](#dialog_reset_all) + +### Lua Example +`dialog_reset_all()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void dialog_reset_all(void);` + +[:arrow_up_small:](#) + +
+ ## [get_current_save_file_num](#get_current_save_file_num) ### Lua Example diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 91cc4a15..a06c85c9 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -4,6 +4,7 @@ - [AnimInfo](#AnimInfo) - [Animation](#Animation) - [Area](#Area) +- [BehaviorDialogs](#BehaviorDialogs) - [BehaviorTrajectories](#BehaviorTrajectories) - [BehaviorValues](#BehaviorValues) - [BullyCollisionData](#BullyCollisionData) @@ -131,6 +132,99 @@
+## [BehaviorDialogs](#BehaviorDialogs) + +| Field | Type | Access | +| ----- | ---- | ------ | +| BobombBuddyBob1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| BobombBuddyBob2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| BobombBuddyOther1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| BobombBuddyOther2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser1DefeatedDialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser2DefeatedDialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser3Defeated120StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser3DefeatedDialog | [enum DialogId](constants.md#enum-DialogId) | | +| Bowser3Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| CapswitchBaseDialog | [enum DialogId](constants.md#enum-DialogId) | | +| CapswitchMetalDialog | [enum DialogId](constants.md#enum-DialogId) | | +| CapswitchVanishDialog | [enum DialogId](constants.md#enum-DialogId) | | +| CapswitchWingDialog | [enum DialogId](constants.md#enum-DialogId) | | +| CastleEnterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| CollectedStarDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DefaultCutsceneDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed1StarDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed30StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed3StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed50StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed70StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeed8StarsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| DoorNeedKeyDialog | [enum DialogId](constants.md#enum-DialogId) | | +| EyerokDefeatedDialog | [enum DialogId](constants.md#enum-DialogId) | | +| EyerokIntroDialog | [enum DialogId](constants.md#enum-DialogId) | | +| GhostHuntAfterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| GhostHuntDialog | [enum DialogId](constants.md#enum-DialogId) | | +| HootIntroDialog | [enum DialogId](constants.md#enum-DialogId) | | +| HootTiredDialog | [enum DialogId](constants.md#enum-DialogId) | | +| HundredCoinsDialog | [enum DialogId](constants.md#enum-DialogId) | | +| IntroPipeDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KeyDoor1DontHaveDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KeyDoor1HaveDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KeyDoor2DontHaveDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KeyDoor2HaveDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KingBobombCheatDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KingBobombDefeatDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KingBobombIntroDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KingWhompDefeatDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KingWhompDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickBobStartDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickBobWinDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickCheatedDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickLostDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickThiStartDialog | [enum DialogId](constants.md#enum-DialogId) | | +| KoopaQuickThiWinDialog | [enum DialogId](constants.md#enum-DialogId) | | +| LakituIntroDialog | [enum DialogId](constants.md#enum-DialogId) | | +| MetalCourseDialog | [enum DialogId](constants.md#enum-DialogId) | | +| Mips1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| Mips2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| PeachLetterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| RacingPenguinBigStartDialog | [enum DialogId](constants.md#enum-DialogId) | | +| RacingPenguinCheatDialog | [enum DialogId](constants.md#enum-DialogId) | | +| RacingPenguinLostDialog | [enum DialogId](constants.md#enum-DialogId) | | +| RacingPenguinStartDialog | [enum DialogId](constants.md#enum-DialogId) | | +| RacingPenguinWinDialog | [enum DialogId](constants.md#enum-DialogId) | | +| SnowmanHeadAfterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| SnowmanHeadBodyDialog | [enum DialogId](constants.md#enum-DialogId) | | +| SnowmanHeadDialog | [enum DialogId](constants.md#enum-DialogId) | | +| SnowmanWindDialog | [enum DialogId](constants.md#enum-DialogId) | | +| StarCollectionBaseDialog | [enum DialogId](constants.md#enum-DialogId) | | +| StarDoorDialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar1AfterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar2AfterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar3AfterDialog | [enum DialogId](constants.md#enum-DialogId) | | +| ToadStar3Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| TuxieMotherBabyFoundDialog | [enum DialogId](constants.md#enum-DialogId) | | +| TuxieMotherBabyWrongDialog | [enum DialogId](constants.md#enum-DialogId) | | +| TuxieMotherDialog | [enum DialogId](constants.md#enum-DialogId) | | +| UkikiCageDialog | [enum DialogId](constants.md#enum-DialogId) | | +| UkikiCapGiveDialog | [enum DialogId](constants.md#enum-DialogId) | | +| UkikiCapStealDialog | [enum DialogId](constants.md#enum-DialogId) | | +| UkikiHeldDialog | [enum DialogId](constants.md#enum-DialogId) | | +| VanishCourseDialog | [enum DialogId](constants.md#enum-DialogId) | | +| WigglerAttack1Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| WigglerAttack2Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| WigglerAttack3Dialog | [enum DialogId](constants.md#enum-DialogId) | | +| WigglerDialog | [enum DialogId](constants.md#enum-DialogId) | | +| WingCourseDialog | [enum DialogId](constants.md#enum-DialogId) | | +| YoshiDialog | [enum DialogId](constants.md#enum-DialogId) | | + +[:arrow_up_small:](#) + +
+ ## [BehaviorTrajectories](#BehaviorTrajectories) | Field | Type | Access | @@ -175,6 +269,14 @@ | KoopaBobAgility | `number` | | | KoopaCatchupAgility | `number` | | | KoopaThiAgility | `number` | | +| RacingPenguinBigHeight | `number` | | +| RacingPenguinBigRadius | `number` | | +| RacingPenguinHeight | `number` | | +| RacingPenguinRadius | `number` | | +| ToadStar1Requirement | `integer` | | +| ToadStar2Requirement | `integer` | | +| ToadStar3Requirement | `integer` | | +| dialogs | [BehaviorDialogs](structs.md#BehaviorDialogs) | read-only | | trajectories | [BehaviorTrajectories](structs.md#BehaviorTrajectories) | read-only | [:arrow_up_small:](#) diff --git a/src/audio/external.c b/src/audio/external.c index 0d962c5f..8f7ae45f 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -10,6 +10,7 @@ #include "game/level_update.h" #include "game/object_list_processor.h" #include "game/camera.h" +#include "game/hardcoded.h" #include "seq_ids.h" #include "dialog_ids.h" #include "level_table.h" @@ -2276,7 +2277,7 @@ void play_dialog_sound(u8 dialogID) { #ifndef VERSION_JP // "You've stepped on the (Wing|Metal|Vanish) Cap Switch" - if (dialogID == DIALOG_010 || dialogID == DIALOG_011 || dialogID == DIALOG_012) { + if (dialogID == gBehaviorValues.dialogs.CapswitchWingDialog || dialogID == gBehaviorValues.dialogs.CapswitchMetalDialog || dialogID == gBehaviorValues.dialogs.CapswitchVanishDialog) { play_puzzle_jingle(); } #endif diff --git a/src/game/behaviors/bobomb.inc.c b/src/game/behaviors/bobomb.inc.c index 115fb7fc..ef2a98b5 100644 --- a/src/game/behaviors/bobomb.inc.c +++ b/src/game/behaviors/bobomb.inc.c @@ -405,9 +405,9 @@ void bobomb_buddy_act_talk(void) { case BOBOMB_BUDDY_ROLE_CANNON: if (gCurrCourseNum == COURSE_BOB) { - bobomb_buddy_cannon_dialog(DIALOG_004, DIALOG_105); + bobomb_buddy_cannon_dialog(gBehaviorValues.dialogs.BobombBuddyBob1Dialog, gBehaviorValues.dialogs.BobombBuddyBob2Dialog); } else { - bobomb_buddy_cannon_dialog(DIALOG_047, DIALOG_106); + bobomb_buddy_cannon_dialog(gBehaviorValues.dialogs.BobombBuddyOther1Dialog, gBehaviorValues.dialogs.BobombBuddyOther2Dialog); } break; } diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.inc.c index 058f88f3..f1c6b8fb 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.inc.c @@ -508,9 +508,9 @@ static void boo_act_4(void) { // If there are no remaining "minion" boos, show the dialog of the Big Boo if (cur_obj_nearest_object_with_behavior(bhvGhostHuntBoo) == NULL) { - dialogID = DIALOG_108; + dialogID = gBehaviorValues.dialogs.GhostHuntAfterDialog; } else { - dialogID = DIALOG_107; + dialogID = gBehaviorValues.dialogs.GhostHuntDialog; } struct MarioState* marioState = nearest_mario_state_to_object(o); @@ -518,7 +518,7 @@ static void boo_act_4(void) { create_sound_spawner(SOUND_OBJ_DYING_ENEMY1); obj_mark_for_deletion(o); - if (dialogID == DIALOG_108) { // If the Big Boo should spawn, play the jingle + if (dialogID == (s32) gBehaviorValues.dialogs.GhostHuntAfterDialog) { // If the Big Boo should spawn, play the jingle play_puzzle_jingle(); } } diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.inc.c index 31e79447..b4c08103 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.inc.c @@ -38,7 +38,11 @@ s8 D_8032F4FC[] = { 7, 8, 9, 12, 13, 14, 15, 4, 3, 16, 17, 19, 3, 3, 3, 3 }; s16 D_8032F50C[] = { 60, 0 }; s16 D_8032F510[] = { 50, 0 }; s8 D_8032F514[] = { 24, 42, 60, -1 }; -s16 sBowserDefeatedDialogText[3] = { DIALOG_119, DIALOG_120, DIALOG_121 }; +s16* sBowserDefeatedDialogText[3] = { + (s16*) &gBehaviorValues.dialogs.Bowser1DefeatedDialog, + (s16*) &gBehaviorValues.dialogs.Bowser2DefeatedDialog, + (s16*) &gBehaviorValues.dialogs.Bowser3DefeatedDialog +}; s16 D_8032F520[][3] = { { 1, 10, 40 }, { 0, 0, 74 }, { -1, -10, 114 }, { 1, -20, 134 }, { -1, 20, 154 }, { 1, 40, 164 }, { -1, -40, 174 }, { 1, -80, 179 }, { -1, 80, 184 }, { 1, 160, 186 }, { -1, -160, 186 }, { 1, 0, 0 }, }; @@ -968,7 +972,7 @@ s32 bowser_dead_not_bits_end(void) { seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); o->oBowserUnkF8++; } - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog(marioState, 2, 18, sBowserDefeatedDialogText[o->oBehParams2ndByte], 0, bowser_dead_not_bits_end_continue_dialog)) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog(marioState, 2, 18, *sBowserDefeatedDialogText[o->oBehParams2ndByte], 0, bowser_dead_not_bits_end_continue_dialog)) { o->oBowserUnkF8++; cur_obj_play_sound_2(SOUND_GENERAL2_BOWSER_EXPLODE); seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); @@ -992,9 +996,9 @@ s32 bowser_dead_bits_end(void) { struct MarioState *marioState = nearest_mario_state_to_object(o); if (o->oBowserUnkF8 < 2) { - s32 dialogID = DIALOG_163; + s32 dialogID = gBehaviorValues.dialogs.Bowser3Defeated120StarsDialog; if (gHudDisplay.stars < 120) { - dialogID = DIALOG_121; + dialogID = gBehaviorValues.dialogs.Bowser3DefeatedDialog; } if (o->oBowserUnkF8 == 0) { seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); diff --git a/src/game/behaviors/camera_lakitu.inc.c b/src/game/behaviors/camera_lakitu.inc.c index 4645e5c0..21f4fedf 100644 --- a/src/game/behaviors/camera_lakitu.inc.c +++ b/src/game/behaviors/camera_lakitu.inc.c @@ -178,7 +178,7 @@ static void camera_lakitu_intro_act_show_dialog(void) { } } } - } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, DIALOG_UNK2_FLAG_0, CUTSCENE_DIALOG, DIALOG_034, camera_lakitu_intro_act_show_dialog_continue_dialog) != 0) { + } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, DIALOG_UNK2_FLAG_0, CUTSCENE_DIALOG, gBehaviorValues.dialogs.LakituIntroDialog, camera_lakitu_intro_act_show_dialog_continue_dialog) != 0) { o->oCameraLakituFinishedDialog = TRUE; } } diff --git a/src/game/behaviors/eyerok.inc.c b/src/game/behaviors/eyerok.inc.c index 8c8e2135..84bf3ee5 100644 --- a/src/game/behaviors/eyerok.inc.c +++ b/src/game/behaviors/eyerok.inc.c @@ -123,7 +123,7 @@ u8 eyerok_boss_act_show_intro_text_continue_dialog(void) { return o->oAction == static void eyerok_boss_act_show_intro_text(void) { // todo: get dialog working again /*struct MarioState* marioState = nearest_mario_state_to_object(o); - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, DIALOG_117, eyerok_boss_act_show_intro_text_continue_dialog)) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, gBehaviorValues.dialogs.EyerokIntroDialog, eyerok_boss_act_show_intro_text_continue_dialog)) { o->oAction = EYEROK_BOSS_ACT_FIGHT; network_send_object_reliability(o, TRUE); }*/ @@ -186,7 +186,7 @@ static void eyerok_boss_act_die(void) { // todo: get dialog working again /*struct MarioState* marioState = nearest_mario_state_to_object(o); if (o->oTimer == 60) { - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, DIALOG_118, eyerok_boss_act_die_continue_dialog)) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, gBehaviorValues.dialogs.EyerokDefeatedDialog, eyerok_boss_act_die_continue_dialog)) { f32* starPos = gLevelValues.starPositions.EyerockStarPos; spawn_default_star(starPos[0], starPos[1], starPos[2]); } else { diff --git a/src/game/behaviors/hoot.inc.c b/src/game/behaviors/hoot.inc.c index c6c1fe54..819bda34 100644 --- a/src/game/behaviors/hoot.inc.c +++ b/src/game/behaviors/hoot.inc.c @@ -206,7 +206,7 @@ void hoot_action_loop(void) { if (o->oPosY < 2700.0f) { //set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS); - if (marioState == &gMarioStates[0] && cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_045)) { + if (marioState == &gMarioStates[0] && cutscene_object_with_dialog(CUTSCENE_DIALOG, o, gBehaviorValues.dialogs.HootTiredDialog)) { clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS); o->oAction = HOOT_ACT_TIRED; @@ -284,7 +284,7 @@ void bhv_hoot_loop(void) { localTalkToHoot = 1; } - if (localTalkToHoot == 1 && set_mario_npc_dialog(&gMarioStates[0], 2, hoot_wants_to_talk_continue_dialog) == 2 && cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_044)) { + if (localTalkToHoot == 1 && set_mario_npc_dialog(&gMarioStates[0], 2, hoot_wants_to_talk_continue_dialog) == 2 && cutscene_object_with_dialog(CUTSCENE_DIALOG, o, gBehaviorValues.dialogs.HootIntroDialog)) { localTalkToHoot = 2; set_mario_npc_dialog(&gMarioStates[0], 0, NULL); cur_obj_become_tangible(); diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index 01fe9551..79fc75d7 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -61,7 +61,7 @@ void king_bobomb_act_0(void) { o->oSubAction++; seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } - } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, DIALOG_017, king_bobomb_act_0_continue_dialog)) { + } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingBobombIntroDialog, king_bobomb_act_0_continue_dialog)) { o->oAction = 2; o->oFlags |= OBJ_FLAG_HOLDABLE; } @@ -220,7 +220,7 @@ void king_bobomb_act_7(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); u8 updateDialog = should_start_or_continue_dialog(marioState, o) || (gMarioStates[0].pos[1] >= o->oPosY - 100.0f); - if (updateDialog && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, DIALOG_116, king_bobomb_act_7_continue_dialog)) { + if (updateDialog && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingBobombDefeatDialog, king_bobomb_act_7_continue_dialog)) { o->oAction = 8; network_send_object(o); } @@ -333,7 +333,7 @@ void king_bobomb_act_5(void) { // bobomb returns home o->oSubAction++; break; case 4: - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, DIALOG_128, king_bobomb_act_5_continue_dialog)) + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingBobombCheatDialog, king_bobomb_act_5_continue_dialog)) o->oAction = 2; break; } diff --git a/src/game/behaviors/koopa.inc.c b/src/game/behaviors/koopa.inc.c index 3db27f03..b0533cf0 100644 --- a/src/game/behaviors/koopa.inc.c +++ b/src/game/behaviors/koopa.inc.c @@ -51,16 +51,16 @@ static u8 sKoopaShelledAttackHandlers[] = { * Data to control the behavior of each instance of Koopa the Quick. */ struct KoopaTheQuickProperties { - s16 initText; - s16 winText; + s16* initText; + s16* winText; }; /** * Properties for the BoB race and the THI race. */ static struct KoopaTheQuickProperties sKoopaTheQuickProperties[] = { - { DIALOG_005, DIALOG_007 }, - { DIALOG_009, DIALOG_031 } + { (s16*) &gBehaviorValues.dialogs.KoopaQuickBobStartDialog, (s16*) &gBehaviorValues.dialogs.KoopaQuickBobWinDialog }, + { (s16*) &gBehaviorValues.dialogs.KoopaQuickThiStartDialog, (s16*) &gBehaviorValues.dialogs.KoopaQuickThiWinDialog } }; static u32 koopaPathedStartWaypoint = 0; @@ -629,7 +629,7 @@ static void koopa_the_quick_act_show_init_text(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); s32 response = 0; if (should_start_or_continue_dialog(marioState, o)) { - response = obj_update_race_proposition_dialog(&gMarioStates[0], sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].initText, koopa_the_quick_act_show_init_text_continue_dialog); + response = obj_update_race_proposition_dialog(&gMarioStates[0], *sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].initText, koopa_the_quick_act_show_init_text_continue_dialog); } if (response == 1) { @@ -849,14 +849,14 @@ static void koopa_the_quick_act_after_race(void) { if (o->parentObj->oKoopaRaceEndpointRaceStatus < 0) { // Mario cheated o->parentObj->oKoopaRaceEndpointRaceStatus = 0; - o->parentObj->oKoopaRaceEndpointUnk100 = DIALOG_006; + o->parentObj->oKoopaRaceEndpointUnk100 = gBehaviorValues.dialogs.KoopaQuickCheatedDialog; } else { // Mario won - o->parentObj->oKoopaRaceEndpointUnk100 = sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].winText; + o->parentObj->oKoopaRaceEndpointUnk100 = *sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].winText; } } else { // KtQ won - o->parentObj->oKoopaRaceEndpointUnk100 = DIALOG_041; + o->parentObj->oKoopaRaceEndpointUnk100 = gBehaviorValues.dialogs.KoopaQuickLostDialog; } o->oFlags &= ~OBJ_FLAG_ACTIVE_FROM_AFAR; diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.inc.c index 205aff4f..4817e897 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.inc.c @@ -276,9 +276,9 @@ void bhv_mips_held(void) { if (o->oMipsStarStatus == MIPS_STAR_STATUS_HAVENT_SPAWNED_STAR) { // Choose dialog based on which MIPS encounter this is. if (o->oBehParams2ndByte == 0) - dialogID = DIALOG_084; + dialogID = gBehaviorValues.dialogs.Mips1Dialog; else - dialogID = DIALOG_162; + dialogID = gBehaviorValues.dialogs.Mips2Dialog; if (should_start_or_continue_dialog(&gMarioStates[o->heldByPlayerIndex], o) && set_mario_npc_dialog(&gMarioStates[0], 1, bhv_mips_held_continue_dialog) == 2) { //o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP; diff --git a/src/game/behaviors/racing_penguin.inc.c b/src/game/behaviors/racing_penguin.inc.c index 87490ac0..755e5713 100644 --- a/src/game/behaviors/racing_penguin.inc.c +++ b/src/game/behaviors/racing_penguin.inc.c @@ -1,12 +1,12 @@ struct RacingPenguinData { - s16 text; - f32 radius; - f32 height; + s16* text; + f32* radius; + f32* height; }; static struct RacingPenguinData sRacingPenguinData[] = { - { DIALOG_055, 200.0f, 200.0f }, - { DIALOG_164, 350.0f, 250.0f }, + { (s16*) &gBehaviorValues.dialogs.RacingPenguinStartDialog, &gBehaviorValues.RacingPenguinRadius, &gBehaviorValues.RacingPenguinHeight }, + { (s16*) &gBehaviorValues.dialogs.RacingPenguinBigStartDialog, &gBehaviorValues.RacingPenguinBigRadius, &gBehaviorValues.RacingPenguinBigHeight }, }; static u32 penguinPathedStartWaypoint = 0; @@ -32,8 +32,8 @@ void bhv_racing_penguin_the_quick_override_ownership(u8* shouldOverride, u8* sho void bhv_racing_penguin_run_once(void) { cur_obj_align_gfx_with_floor(); cur_obj_push_mario_away_from_cylinder( - sRacingPenguinData[o->oBehParams2ndByte].radius, - sRacingPenguinData[o->oBehParams2ndByte].height); + *sRacingPenguinData[o->oBehParams2ndByte].radius, + *sRacingPenguinData[o->oBehParams2ndByte].height); } void bhv_racing_penguin_init(void) { @@ -93,7 +93,7 @@ static void racing_penguin_act_wait_for_mario(void) { u8 racing_penguin_act_show_init_text_continue_dialog(void) { return o->oAction == RACING_PENGUIN_ACT_SHOW_INIT_TEXT; } static void racing_penguin_act_show_init_text(void) { - s32 response = obj_update_race_proposition_dialog(&gMarioStates[0], sRacingPenguinData[o->oBehParams2ndByte].text, racing_penguin_act_show_init_text_continue_dialog); + s32 response = obj_update_race_proposition_dialog(&gMarioStates[0], *sRacingPenguinData[o->oBehParams2ndByte].text, racing_penguin_act_show_init_text_continue_dialog); if (response == 1) { struct Object *child; @@ -227,13 +227,13 @@ static void racing_penguin_act_show_final_text(void) { if (cur_obj_can_mario_activate_textbox_2(&gMarioStates[0], 400.0f, 400.0f)) { if (o->oRacingPenguinMarioWon) { if (o->oRacingPenguinMarioCheated) { - o->oRacingPenguinFinalTextbox = DIALOG_132; + o->oRacingPenguinFinalTextbox = gBehaviorValues.dialogs.RacingPenguinCheatDialog; o->oRacingPenguinMarioWon = FALSE; } else { - o->oRacingPenguinFinalTextbox = DIALOG_056; + o->oRacingPenguinFinalTextbox = gBehaviorValues.dialogs.RacingPenguinWinDialog; } } else { - o->oRacingPenguinFinalTextbox = DIALOG_037; + o->oRacingPenguinFinalTextbox = gBehaviorValues.dialogs.RacingPenguinLostDialog; } } } else { diff --git a/src/game/behaviors/sl_snowman_wind.inc.c b/src/game/behaviors/sl_snowman_wind.inc.c index b388d797..54586b46 100644 --- a/src/game/behaviors/sl_snowman_wind.inc.c +++ b/src/game/behaviors/sl_snowman_wind.inc.c @@ -36,7 +36,7 @@ void bhv_sl_snowman_wind_loop(void) { // Mario has come close, begin dialog. } else if (o->oSubAction == SL_SNOWMAN_WIND_ACT_TALKING) { - if (cur_obj_update_dialog(&gMarioStates[0], 2, 2, DIALOG_153, 0, bhv_sl_snowman_wind_loop_continue_dialog)) { + if (cur_obj_update_dialog(&gMarioStates[0], 2, 2, gBehaviorValues.dialogs.SnowmanWindDialog, 0, bhv_sl_snowman_wind_loop_continue_dialog)) { o->oSubAction++; network_send_object(o); } diff --git a/src/game/behaviors/snowman.inc.c b/src/game/behaviors/snowman.inc.c index 40328023..4d8b22d1 100644 --- a/src/game/behaviors/snowman.inc.c +++ b/src/game/behaviors/snowman.inc.c @@ -140,7 +140,7 @@ void bhv_snowmans_bottom_loop(void) { if (should_start_or_continue_dialog(marioState, o) && (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 400) == 1) && set_mario_npc_dialog(&gMarioStates[0], 1, bhv_snowmans_bottom_loop_continue_dialog) == 2) { - sp1E = cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_110); + sp1E = cutscene_object_with_dialog(CUTSCENE_DIALOG, o, gBehaviorValues.dialogs.SnowmanHeadBodyDialog); if (sp1E) { o->oForwardVel = 10.0f; o->oAction = 1; @@ -217,7 +217,7 @@ void bhv_snowmans_head_loop(void) { switch (o->oAction) { case 0: - if (trigger_obj_dialog_when_facing(&gMarioStates[0], &o->oSnowmansHeadUnkF4, DIALOG_109, 400.0f, 1, bhv_snowmans_head_action_0_continue_dialog)) + if (trigger_obj_dialog_when_facing(&gMarioStates[0], &o->oSnowmansHeadUnkF4, gBehaviorValues.dialogs.SnowmanHeadDialog, 400.0f, 1, bhv_snowmans_head_action_0_continue_dialog)) o->oAction = 1; break; @@ -241,7 +241,7 @@ void bhv_snowmans_head_loop(void) { break; case 4: - if (trigger_obj_dialog_when_facing(&gMarioStates[0], &o->oSnowmansHeadUnkF4, DIALOG_111, 700.0f, 2, bhv_snowmans_head_action_4_continue_dialog)) { + if (trigger_obj_dialog_when_facing(&gMarioStates[0], &o->oSnowmansHeadUnkF4, gBehaviorValues.dialogs.SnowmanHeadAfterDialog, 700.0f, 2, bhv_snowmans_head_action_4_continue_dialog)) { spawn_mist_particles(); f32* starPos = gLevelValues.starPositions.SnowmanHeadStarPos; spawn_default_star(starPos[0], starPos[1], starPos[2]); diff --git a/src/game/behaviors/tuxie.inc.c b/src/game/behaviors/tuxie.inc.c index 9d98f0c7..81110ad4 100644 --- a/src/game/behaviors/tuxie.inc.c +++ b/src/game/behaviors/tuxie.inc.c @@ -58,15 +58,17 @@ void tuxies_mother_act_1(void) { if (!cur_obj_is_mario_on_platform()) { sp2C = (o->oBehParams >> 0x10) & 0xFF; sp28 = (o->prevObj->oBehParams >> 0x10) & 0xFF; - if (sp2C == sp28) - dialogID = DIALOG_058; - else - dialogID = DIALOG_059; + if (sp2C == sp28) { + dialogID = gBehaviorValues.dialogs.TuxieMotherBabyFoundDialog; + } else { + dialogID = gBehaviorValues.dialogs.TuxieMotherBabyWrongDialog; + } if (cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, dialogID, tuxies_mother_act_1_continue_dialog)) { - if (dialogID == DIALOG_058) + if (dialogID == (s32) gBehaviorValues.dialogs.TuxieMotherBabyFoundDialog) { o->oSubAction = 1; - else + } else { o->oSubAction = 2; + } o->prevObj->oInteractionSubtype |= INT_SUBTYPE_DROP_IMMEDIATELY; } } else @@ -134,7 +136,7 @@ void tuxies_mother_act_0(void) { o->oSubAction++; break; case 1: - if (cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, DIALOG_057, tuxies_mother_act_0_continue_dialog)) + if (cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.TuxieMotherDialog, tuxies_mother_act_0_continue_dialog)) o->oSubAction++; break; case 2: diff --git a/src/game/behaviors/ukiki.inc.c b/src/game/behaviors/ukiki.inc.c index 55441b11..d7dd650c 100644 --- a/src/game/behaviors/ukiki.inc.c +++ b/src/game/behaviors/ukiki.inc.c @@ -405,7 +405,7 @@ void ukiki_act_go_to_cage(void) { case UKIKI_SUB_ACT_CAGE_TALK_TO_MARIO: cur_obj_init_animation_with_sound(UKIKI_ANIM_HANDSTAND); - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 3, 1, CUTSCENE_DIALOG, DIALOG_080, ukiki_act_go_to_cage_continue_dialog)) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 3, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.UkikiCageDialog, ukiki_act_go_to_cage_continue_dialog)) { o->oSubAction++; network_send_object_reliability(o, TRUE); } @@ -547,7 +547,7 @@ void cage_ukiki_held_loop(void) { switch(o->oUkikiTextState) { case UKIKI_TEXT_DEFAULT: if (set_mario_npc_dialog(heldByMario, 2, cage_ukiki_held_default_continue_dialog) == 2) { - create_dialog_box_with_response(DIALOG_079); + create_dialog_box_with_response(gBehaviorValues.dialogs.UkikiHeldDialog); o->oUkikiTextState = UKIKI_TEXT_CAGE_TEXTBOX; } break; @@ -611,7 +611,7 @@ void cap_ukiki_held_loop(void) { break; case UKIKI_TEXT_STEAL_CAP: - if (should_start_or_continue_dialog(heldByMario, o) && cur_obj_update_dialog(heldByMario, 2, 2, DIALOG_100, 0, hat_ukiki_held_loop_1)) { + if (should_start_or_continue_dialog(heldByMario, o) && cur_obj_update_dialog(heldByMario, 2, 2, gBehaviorValues.dialogs.UkikiCapStealDialog, 0, hat_ukiki_held_loop_1)) { o->oInteractionSubtype |= INT_SUBTYPE_DROP_IMMEDIATELY; o->oUkikiTextState = UKIKI_TEXT_STOLE_CAP; network_send_object(o); @@ -622,7 +622,7 @@ void cap_ukiki_held_loop(void) { break; case UKIKI_TEXT_HAS_CAP: - if (should_start_or_continue_dialog(heldByMario, o) && cur_obj_update_dialog(heldByMario, 2, 18, DIALOG_101, 0, hat_ukiki_held_loop_2)) { + if (should_start_or_continue_dialog(heldByMario, o) && cur_obj_update_dialog(heldByMario, 2, 18, gBehaviorValues.dialogs.UkikiCapGiveDialog, 0, hat_ukiki_held_loop_2)) { mario_retrieve_cap(heldByMario); set_mario_npc_dialog(heldByMario, 0, NULL); o->oUkikiHasCap &= ~UKIKI_CAP_ON; diff --git a/src/game/behaviors/whomp.inc.c b/src/game/behaviors/whomp.inc.c index 97888aa8..0aee57c9 100644 --- a/src/game/behaviors/whomp.inc.c +++ b/src/game/behaviors/whomp.inc.c @@ -34,7 +34,7 @@ void whomp_act_0(void) { cur_obj_set_pos_to_home(); o->oHealth = 3; } - } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, DIALOG_114, whomp_act_0_continue_dialog)) { + } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingWhompDialog, whomp_act_0_continue_dialog)) { o->oAction = 2; network_send_object(o); } @@ -233,7 +233,7 @@ u8 whomp_act_8_continue_dialog(void) { return o->oAction == 8; } void whomp_act_8(void) { if (o->oBehParams2ndByte != 0) { struct MarioState* marioState = nearest_mario_state_to_object(o); - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, DIALOG_115, whomp_act_8_continue_dialog)) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingWhompDefeatDialog, whomp_act_8_continue_dialog)) { obj_set_angle(o, 0, 0, 0); cur_obj_hide(); cur_obj_become_intangible(); diff --git a/src/game/behaviors/wiggler.inc.c b/src/game/behaviors/wiggler.inc.c index b5dc2023..d5d9b768 100644 --- a/src/game/behaviors/wiggler.inc.c +++ b/src/game/behaviors/wiggler.inc.c @@ -226,7 +226,7 @@ static void wiggler_act_walk(void) { // If Mario is positioned below the wiggler, assume he entered through the // lower cave entrance, so don't display text. - if (player->oPosY < o->oPosY || (cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, DIALOG_150, wiggler_act_walk_continue_dialog) != 0)) { + if (player->oPosY < o->oPosY || (cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 0, CUTSCENE_DIALOG, gBehaviorValues.dialogs.WigglerDialog, wiggler_act_walk_continue_dialog) != 0)) { o->oWigglerTextStatus = WIGGLER_TEXT_STATUS_COMPLETED_DIALOG; network_send_object_reliability(o, TRUE); } @@ -295,7 +295,11 @@ static void wiggler_act_jumped_on(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); // Text to show on first, second, and third attack. - s32 attackText[3] = { DIALOG_152, DIALOG_168, DIALOG_151 }; + s32* attackText[3] = { + (s32*) &gBehaviorValues.dialogs.WigglerAttack1Dialog, + (s32*) &gBehaviorValues.dialogs.WigglerAttack2Dialog, + (s32*) &gBehaviorValues.dialogs.WigglerAttack3Dialog + }; // Shrink until the squish speed becomes 0, then unisquish if (approach_f32_ptr(&o->oWigglerSquishSpeed, 0.0f, 0.05f)) { @@ -309,7 +313,7 @@ static void wiggler_act_jumped_on(void) { // defeated) or go back to walking if (o->header.gfx.scale[1] >= 4.0f) { if (o->oTimer > 30) { - if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(marioState, 2, 0, CUTSCENE_DIALOG, attackText[o->oHealth - 2], wiggler_act_jumped_on_continue_dialog) != 0) { + if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(marioState, 2, 0, CUTSCENE_DIALOG, *attackText[o->oHealth - 2], wiggler_act_jumped_on_continue_dialog) != 0) { // Because we don't want the wiggler to disappear after being // defeated, we leave its health at 1 if (--o->oHealth <= 1) { diff --git a/src/game/behaviors/yoshi.inc.c b/src/game/behaviors/yoshi.inc.c index 7afc1488..90b69e5d 100644 --- a/src/game/behaviors/yoshi.inc.c +++ b/src/game/behaviors/yoshi.inc.c @@ -201,7 +201,7 @@ void bhv_yoshi_loop(void) { break; case 2: - if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_161)) { + if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, gBehaviorValues.dialogs.YoshiDialog)) { sYoshiTalkingState = 3; o->oInteractStatus = 0; o->oHomeX = sYoshiHomeLocations[2]; diff --git a/src/game/camera.c b/src/game/camera.c index fa3d8958..ac6c63c4 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -28,6 +28,7 @@ #include "paintings.h" #include "engine/graph_node.h" #include "level_table.h" +#include "game/hardcoded.h" #include "pc/configfile.h" #include "pc/network/network.h" @@ -6995,7 +6996,7 @@ s16 cutscene_object_with_dialog(u8 cutscene, struct Object *o, s16 dialogID) { if (dialogID != -1) { sCutsceneDialogID = dialogID; } else { - sCutsceneDialogID = DIALOG_001; + sCutsceneDialogID = (s16) gBehaviorValues.dialogs.DefaultCutsceneDialog; } } else { response = sCutsceneDialogResponse; @@ -8256,13 +8257,13 @@ BAD_RETURN(s32) bowser_fight_intro_dialog(UNUSED struct Camera *c) { switch (gCurrLevelNum) { case LEVEL_BOWSER_1: - dialog = DIALOG_067; + dialog = gBehaviorValues.dialogs.Bowser1Dialog; break; case LEVEL_BOWSER_2: - dialog = DIALOG_092; + dialog = gBehaviorValues.dialogs.Bowser2Dialog; break; default: - dialog = DIALOG_093; + dialog = gBehaviorValues.dialogs.Bowser3Dialog; } create_dialog_box(dialog); @@ -9499,7 +9500,7 @@ BAD_RETURN(s32) cutscene_cap_switch_press_pan_left(struct Camera *c) { * Create a dialog box with the cap switch's text. */ BAD_RETURN(s32) cutscene_cap_switch_press_create_dialog(UNUSED struct Camera *c) { - create_dialog_box_with_response(gCutsceneFocus->oBehParams2ndByte + DIALOG_010); + create_dialog_box_with_response(gCutsceneFocus->oBehParams2ndByte + gBehaviorValues.dialogs.CapswitchBaseDialog); } static UNUSED BAD_RETURN(s32) unused_cap_switch_retrieve_info(struct Camera *c) { @@ -9640,7 +9641,7 @@ s32 intro_peach_move_camera_start_to_pipe(struct Camera *c, struct CutsceneSplin * Create a dialog box with the letter text */ BAD_RETURN(s32) peach_letter_text(UNUSED struct Camera *c) { - create_dialog_box(DIALOG_020); + create_dialog_box(gBehaviorValues.dialogs.PeachLetterDialog); } #ifndef VERSION_JP @@ -9712,7 +9713,7 @@ BAD_RETURN(s32) cutscene_intro_peach_handheld_shake_off(UNUSED struct Camera *c) } BAD_RETURN(s32) intro_pipe_exit_text(UNUSED struct Camera *c) { - create_dialog_box(DIALOG_033); + create_dialog_box(gBehaviorValues.dialogs.IntroPipeDialog); } #ifndef VERSION_JP diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index adaac9bc..3f530ea4 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -79,8 +79,101 @@ struct LevelValues gLevelValues = { struct BehaviorValues gBehaviorValues = { .KoopaBobAgility = 4.0f, - .KoopaThiAgility = 6.0f, .KoopaCatchupAgility = 8.0f, + .KoopaThiAgility = 6.0f, + .RacingPenguinBigHeight = 250.0f, + .RacingPenguinBigRadius = 350.0f, + .RacingPenguinHeight = 200.0f, + .RacingPenguinRadius = 200.0f, + .ToadStar1Requirement = 12, + .ToadStar2Requirement = 25, + .ToadStar3Requirement = 35, + .dialogs = { + .BobombBuddyBob1Dialog = DIALOG_004, + .BobombBuddyBob2Dialog = DIALOG_105, + .BobombBuddyOther1Dialog = DIALOG_047, + .BobombBuddyOther2Dialog = DIALOG_106, + .Bowser1DefeatedDialog = DIALOG_119, + .Bowser1Dialog = DIALOG_067, + .Bowser2DefeatedDialog = DIALOG_120, + .Bowser2Dialog = DIALOG_092, + .Bowser3Defeated120StarsDialog = DIALOG_163, + .Bowser3DefeatedDialog = DIALOG_121, + .Bowser3Dialog = DIALOG_093, + .CapswitchBaseDialog = DIALOG_010, + .CapswitchMetalDialog = DIALOG_011, + .CapswitchVanishDialog = DIALOG_012, + .CapswitchWingDialog = DIALOG_010, + .CastleEnterDialog = DIALOG_021, + .CollectedStarDialog = DIALOG_014, + .DefaultCutsceneDialog = DIALOG_001, + .DoorNeed1StarDialog = DIALOG_024, + .DoorNeed30StarsDialog = DIALOG_027, + .DoorNeed3StarsDialog = DIALOG_025, + .DoorNeed50StarsDialog = DIALOG_028, + .DoorNeed70StarsDialog = DIALOG_029, + .DoorNeed8StarsDialog = DIALOG_026, + .DoorNeedKeyDialog = DIALOG_022, + .EyerokDefeatedDialog = DIALOG_118, + .EyerokIntroDialog = DIALOG_117, + .GhostHuntAfterDialog = DIALOG_108, + .GhostHuntDialog = DIALOG_107, + .HootIntroDialog = DIALOG_044, + .HootTiredDialog = DIALOG_045, + .HundredCoinsDialog = DIALOG_013, + .IntroPipeDialog = DIALOG_033, + .KeyDoor1DontHaveDialog = DIALOG_022, + .KeyDoor1HaveDialog = DIALOG_023, + .KeyDoor2DontHaveDialog = DIALOG_022, + .KeyDoor2HaveDialog = DIALOG_023, + .KingBobombCheatDialog = DIALOG_128, + .KingBobombDefeatDialog = DIALOG_116, + .KingBobombIntroDialog = DIALOG_017, + .KingWhompDefeatDialog = DIALOG_115, + .KingWhompDialog = DIALOG_114, + .KoopaQuickBobStartDialog = DIALOG_005, + .KoopaQuickBobWinDialog = DIALOG_007, + .KoopaQuickCheatedDialog = DIALOG_006, + .KoopaQuickLostDialog = DIALOG_041, + .KoopaQuickThiStartDialog = DIALOG_009, + .KoopaQuickThiWinDialog = DIALOG_031, + .LakituIntroDialog = DIALOG_034, + .MetalCourseDialog = DIALOG_130, + .Mips1Dialog = DIALOG_084, + .Mips2Dialog = DIALOG_162, + .PeachLetterDialog = DIALOG_020, + .RacingPenguinBigStartDialog = DIALOG_164, + .RacingPenguinCheatDialog = DIALOG_132, + .RacingPenguinLostDialog = DIALOG_037, + .RacingPenguinStartDialog = DIALOG_055, + .RacingPenguinWinDialog = DIALOG_056, + .SnowmanHeadAfterDialog = DIALOG_111, + .SnowmanHeadBodyDialog = DIALOG_110, + .SnowmanHeadDialog = DIALOG_109, + .SnowmanWindDialog = DIALOG_153, + .StarCollectionBaseDialog = DIALOG_141, + .StarDoorDialog = DIALOG_038, + .ToadStar1AfterDialog = DIALOG_154, + .ToadStar1Dialog = DIALOG_082, + .ToadStar2AfterDialog = DIALOG_155, + .ToadStar2Dialog = DIALOG_076, + .ToadStar3AfterDialog = DIALOG_156, + .ToadStar3Dialog = DIALOG_083, + .TuxieMotherDialog = DIALOG_057, + .TuxieMotherBabyFoundDialog = DIALOG_058, + .TuxieMotherBabyWrongDialog = DIALOG_059, + .UkikiCageDialog = DIALOG_080, + .UkikiCapGiveDialog = DIALOG_101, + .UkikiCapStealDialog = DIALOG_100, + .UkikiHeldDialog = DIALOG_079, + .VanishCourseDialog = DIALOG_129, + .WigglerAttack1Dialog = DIALOG_152, + .WigglerAttack2Dialog = DIALOG_168, + .WigglerAttack3Dialog = DIALOG_151, + .WigglerDialog = DIALOG_150, + .WingCourseDialog = DIALOG_131, + .YoshiDialog = DIALOG_161, + }, .trajectories = { .KoopaBobTrajectory = (Trajectory*) bob_seg7_trajectory_koopa, .KoopaThiTrajectory = (Trajectory*) thi_seg7_trajectory_koopa, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 04430909..2693cc87 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -1,6 +1,7 @@ #ifndef HARDCODED_H #include "types.h" #include "level_table.h" +#include "dialog_ids.h" //////////// // Levels // @@ -77,10 +78,105 @@ struct BehaviorTrajectories { Trajectory* PlatformLll2Trajectory; }; +struct BehaviorDialogs { + enum DialogId BobombBuddyBob1Dialog; + enum DialogId BobombBuddyBob2Dialog; + enum DialogId BobombBuddyOther1Dialog; + enum DialogId BobombBuddyOther2Dialog; + enum DialogId Bowser1DefeatedDialog; + enum DialogId Bowser1Dialog; + enum DialogId Bowser2DefeatedDialog; + enum DialogId Bowser2Dialog; + enum DialogId Bowser3Defeated120StarsDialog; + enum DialogId Bowser3DefeatedDialog; + enum DialogId Bowser3Dialog; + enum DialogId CapswitchBaseDialog; + enum DialogId CapswitchMetalDialog; + enum DialogId CapswitchVanishDialog; + enum DialogId CapswitchWingDialog; + enum DialogId CastleEnterDialog; + enum DialogId CollectedStarDialog; + enum DialogId DefaultCutsceneDialog; + enum DialogId DoorNeed1StarDialog; + enum DialogId DoorNeed30StarsDialog; + enum DialogId DoorNeed3StarsDialog; + enum DialogId DoorNeed50StarsDialog; + enum DialogId DoorNeed70StarsDialog; + enum DialogId DoorNeed8StarsDialog; + enum DialogId DoorNeedKeyDialog; + enum DialogId EyerokDefeatedDialog; + enum DialogId EyerokIntroDialog; + enum DialogId GhostHuntAfterDialog; + enum DialogId GhostHuntDialog; + enum DialogId HootIntroDialog; + enum DialogId HootTiredDialog; + enum DialogId HundredCoinsDialog; + enum DialogId IntroPipeDialog; + enum DialogId KeyDoor1DontHaveDialog; + enum DialogId KeyDoor1HaveDialog; + enum DialogId KeyDoor2DontHaveDialog; + enum DialogId KeyDoor2HaveDialog; + enum DialogId KingBobombCheatDialog; + enum DialogId KingBobombDefeatDialog; + enum DialogId KingBobombIntroDialog; + enum DialogId KingWhompDefeatDialog; + enum DialogId KingWhompDialog; + enum DialogId KoopaQuickBobStartDialog; + enum DialogId KoopaQuickBobWinDialog; + enum DialogId KoopaQuickCheatedDialog; + enum DialogId KoopaQuickLostDialog; + enum DialogId KoopaQuickThiStartDialog; + enum DialogId KoopaQuickThiWinDialog; + enum DialogId LakituIntroDialog; + enum DialogId MetalCourseDialog; + enum DialogId Mips1Dialog; + enum DialogId Mips2Dialog; + enum DialogId PeachLetterDialog; + enum DialogId RacingPenguinBigStartDialog; + enum DialogId RacingPenguinCheatDialog; + enum DialogId RacingPenguinLostDialog; + enum DialogId RacingPenguinStartDialog; + enum DialogId RacingPenguinWinDialog; + enum DialogId SnowmanHeadAfterDialog; + enum DialogId SnowmanHeadBodyDialog; + enum DialogId SnowmanHeadDialog; + enum DialogId SnowmanWindDialog; + enum DialogId StarCollectionBaseDialog; + enum DialogId StarDoorDialog; + enum DialogId ToadStar1AfterDialog; + enum DialogId ToadStar1Dialog; + enum DialogId ToadStar2AfterDialog; + enum DialogId ToadStar2Dialog; + enum DialogId ToadStar3AfterDialog; + enum DialogId ToadStar3Dialog; + enum DialogId TuxieMotherDialog; + enum DialogId TuxieMotherBabyFoundDialog; + enum DialogId TuxieMotherBabyWrongDialog; + enum DialogId UkikiCageDialog; + enum DialogId UkikiCapGiveDialog; + enum DialogId UkikiCapStealDialog; + enum DialogId UkikiHeldDialog; + enum DialogId VanishCourseDialog; + enum DialogId WigglerAttack1Dialog; + enum DialogId WigglerAttack2Dialog; + enum DialogId WigglerAttack3Dialog; + enum DialogId WigglerDialog; + enum DialogId WingCourseDialog; + enum DialogId YoshiDialog; +}; + struct BehaviorValues { f32 KoopaBobAgility; - f32 KoopaThiAgility; f32 KoopaCatchupAgility; + f32 KoopaThiAgility; + f32 RacingPenguinBigHeight; + f32 RacingPenguinBigRadius; + f32 RacingPenguinHeight; + f32 RacingPenguinRadius; + u16 ToadStar1Requirement; + u16 ToadStar2Requirement; + u16 ToadStar3Requirement; + struct BehaviorDialogs dialogs; struct BehaviorTrajectories trajectories; }; diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index bb39b06a..f7b01bf6 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -418,31 +418,73 @@ void render_multi_text_string(s16 *xPos, s16 *yPos, s8 multiTextID) u8 str_ascii_char_to_dialog(char c) { switch (c) { + case '/': return 0xD0; + case '>': return 0x53; + case '<': return 0x52; + case '|': return 0x51; + case '^': return 0x50; + case '\n': return 0xFE; + case '$': return 0xF9; + case '~': return 0xF7; + case '?': return 0xF4; + case '%': return 0xF3; + case '!': return 0xF2; + case ':': return 0xE6; + case '&': return 0xE5; + case '+': return 0xE4; + case ')': return 0xE3; + case '(': return 0xE1; + case '-': return 0x9F; + case ' ': return 0x9E; + case ',': return 0x6F; + case '.': return 0x3F; case '\'': return 0x3E; - case '.': return 0x3F; - case ',': return DIALOG_CHAR_COMMA; - case '-': return 0x9F; - case '(': return 0xE1; - case ')': return 0xE3; - case '&': return 0xE5; - case '!': return 0xF2; - case '%': return 0xF3; - case '?': return 0xF4; - case '"': return 0xF6; // 0xF5 is opening quote - case '~': return 0xF7; - case '*': return 0xFB; - case ' ': return DIALOG_CHAR_SPACE; - case '\n': return DIALOG_CHAR_NEWLINE; case '\0': return DIALOG_CHAR_TERMINATOR; default: return ((u8)c < 0xF0) ? ASCII_TO_DIALOG(c) : c; } } void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) { - for (s32 i = 0; i < length; i++) { - dialog[i] = str_ascii_char_to_dialog(string[i]); + char* c = (char*) string; + u8* d = dialog; + u16 converted = 0; + + while (*c != '\0' && converted < (length - 1)) { + if (!strncmp(c, "you", 3) && (c[3] < 'a' || c[3] > 'z')) { + *d = 0xD2; + c += 2; + } else if (!strncmp(c, "the", 3) && (c[3] < 'a' || c[3] > 'z')) { + *d = 0xD1; + c += 2; + } else if (!strncmp(c, "[R]", 3)) { + *d = 0x58; + c += 2; + } else if (!strncmp(c, "[Z]", 3)) { + *d = 0x57; + c += 2; + } else if (!strncmp(c, "[C]", 3)) { + *d = 0x56; + c += 2; + } else if (!strncmp(c, "[B]", 3)) { + *d = 0x55; + c += 2; + } else if (!strncmp(c, "[A]", 3)) { + *d = 0x54; + c += 2; + } else if (!strncmp(c, "[Z]", 3)) { + *d = 0x57; + c += 2; + } else if (!strncmp(c, ")(", 2)) { + *d = 0xE2; + c += 1; + } else { + *d = str_ascii_char_to_dialog(*c); + } + d++; + c++; + converted++; } - dialog[length] = DIALOG_CHAR_TERMINATOR; + *d = DIALOG_CHAR_TERMINATOR; } f32 get_generic_dialog_width(u8* dialog) { diff --git a/src/game/ingame_menu.h b/src/game/ingame_menu.h index f982f289..417c2644 100644 --- a/src/game/ingame_menu.h +++ b/src/game/ingame_menu.h @@ -6,7 +6,7 @@ #define ASCII_TO_DIALOG(asc) \ (((asc) >= '0' && (asc) <= '9') ? ((asc) - '0') : \ ((asc) >= 'A' && (asc) <= 'Z') ? ((asc) - 'A' + 0x0A) : \ - ((asc) >= 'a' && (asc) <= 'z') ? ((asc) - 'a' + 0x24) : 0x00) + ((asc) >= 'a' && (asc) <= 'z') ? ((asc) - 'a' + 0x24) : 0xF4) #define MENU_MTX_PUSH 1 #define MENU_MTX_NOPUSH 2 diff --git a/src/game/interaction.c b/src/game/interaction.c index f7ea69af..9fdf874e 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -1063,7 +1063,7 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) { if (warpDoorId == 1 && !(saveFlags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) { if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) { - if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_1) ? DIALOG_023 : DIALOG_022)) { + if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_1) ? gBehaviorValues.dialogs.KeyDoor1HaveDialog : gBehaviorValues.dialogs.KeyDoor1DontHaveDialog)) { sDisplayingDoorText = TRUE; } return FALSE; @@ -1074,7 +1074,7 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj if (warpDoorId == 2 && !(saveFlags & SAVE_FLAG_UNLOCKED_BASEMENT_DOOR)) { if (!(saveFlags & SAVE_FLAG_HAVE_KEY_1)) { - if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_2) ? DIALOG_023 : DIALOG_022)) { + if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_2) ? gBehaviorValues.dialogs.KeyDoor2HaveDialog : gBehaviorValues.dialogs.KeyDoor2DontHaveDialog)) { sDisplayingDoorText = TRUE; } return FALSE; @@ -1180,26 +1180,26 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object * return set_mario_action(m, enterDoorAction, actionArg); } else if (!sDisplayingDoorText) { - u32 text = DIALOG_022 << 16; + u32 text = gBehaviorValues.dialogs.DoorNeedKeyDialog << 16; switch (requiredNumStars) { case 1: - text = DIALOG_024 << 16; + text = gBehaviorValues.dialogs.DoorNeed1StarDialog << 16; break; case 3: - text = DIALOG_025 << 16; + text = gBehaviorValues.dialogs.DoorNeed3StarsDialog << 16; break; case 8: - text = DIALOG_026 << 16; + text = gBehaviorValues.dialogs.DoorNeed8StarsDialog << 16; break; case 30: - text = DIALOG_027 << 16; + text = gBehaviorValues.dialogs.DoorNeed30StarsDialog << 16; break; case 50: - text = DIALOG_028 << 16; + text = gBehaviorValues.dialogs.DoorNeed50StarsDialog << 16; break; case 70: - text = DIALOG_029 << 16; + text = gBehaviorValues.dialogs.DoorNeed70StarsDialog << 16; break; } diff --git a/src/game/level_update.c b/src/game/level_update.c index 7d0f8a44..2b25f9d8 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -20,6 +20,7 @@ #include "ingame_menu.h" #include "obj_behaviors.h" #include "save_file.h" +#include "hardcoded.h" #include "debug_course.h" #ifdef VERSION_EU #include "memory.h" @@ -280,26 +281,16 @@ void load_level_init_text(u32 arg) { s32 gotAchievement; u32 dialogID = gCurrentArea->dialog[arg]; - switch (dialogID) { - case DIALOG_129: - gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_VANISH_CAP; - break; - - case DIALOG_130: - gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_METAL_CAP; - break; - - case DIALOG_131: - gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_WING_CAP; - break; - - case 255: - gotAchievement = TRUE; - break; - - default: - gotAchievement = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); - break; + if (dialogID == gBehaviorValues.dialogs.VanishCourseDialog) { + gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_VANISH_CAP; + } else if (dialogID == gBehaviorValues.dialogs.MetalCourseDialog) { + gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_METAL_CAP; + } else if (dialogID == gBehaviorValues.dialogs.WingCourseDialog) { + gotAchievement = save_file_get_flags() & SAVE_FLAG_HAVE_WING_CAP; + } else if (dialogID == 255) { + gotAchievement = TRUE; + } else { + gotAchievement = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); } if (!gotAchievement) { diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index ecbfef33..306a34a1 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -28,6 +28,7 @@ #include "sound_init.h" #include "rumble_init.h" #include "obj_behaviors.h" +#include "hardcoded.h" #include "../../include/libc/stdlib.h" #include "pc/debuglog.h" #include "pc/pc_main.h" @@ -243,7 +244,7 @@ s32 get_star_collection_dialog(struct MarioState *m) { for (s32 i = 0; i < ARRAY_COUNT(sStarsNeededForDialog); i++) { s32 numStarsRequired = sStarsNeededForDialog[i]; if (m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) { - dialogID = i + DIALOG_141; + dialogID = i + gBehaviorValues.dialogs.StarCollectionBaseDialog; break; } } @@ -693,7 +694,9 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) { level_trigger_warp(m, WARP_OP_STAR_EXIT); } else if (m->playerIndex == 0) { enable_time_stop_if_alone(); - create_dialog_box_with_response(gLastCompletedStarNum == 7 ? DIALOG_013 : DIALOG_014); + create_dialog_box_with_response((gLastCompletedStarNum == 7) + ? gBehaviorValues.dialogs.HundredCoinsDialog + : gBehaviorValues.dialogs.CollectedStarDialog); m->actionState = 1; } else { set_mario_action(m, isInWater ? ACT_WATER_IDLE : ACT_IDLE, 0); @@ -957,7 +960,7 @@ s32 act_unlocking_star_door(struct MarioState *m) { if (m->playerIndex != 0) { allowRemoteStarSpawn = TRUE; } if (is_anim_at_end(m)) { save_file_set_flags(get_door_save_file_flag(m->usedObj)); - set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, DIALOG_038); + set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, gBehaviorValues.dialogs.StarDoorDialog); } break; } @@ -1084,7 +1087,7 @@ s32 act_warp_door_spawn(struct MarioState *m) { } else if (m->usedObj == NULL || (m->usedObj->oAction == 0 || m->usedObj->oAction == 100)) { if (m->playerIndex == 0) { if (gNeverEnteredCastle == TRUE && gCurrLevelNum == LEVEL_CASTLE) { - set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, DIALOG_021); + set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, gBehaviorValues.dialogs.CastleEnterDialog); } else { set_mario_action(m, ACT_IDLE, 0); } diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 7c3cc5e2..48a1b700 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -22,20 +22,21 @@ #include "rendering_graph_node.h" #include "save_file.h" #include "skybox.h" +#include "hardcoded.h" #include "sound_init.h" #include "pc/network/network.h" -#define TOAD_STAR_1_REQUIREMENT 12 -#define TOAD_STAR_2_REQUIREMENT 25 -#define TOAD_STAR_3_REQUIREMENT 35 +#define TOAD_STAR_1_REQUIREMENT gBehaviorValues.ToadStar1Requirement +#define TOAD_STAR_2_REQUIREMENT gBehaviorValues.ToadStar2Requirement +#define TOAD_STAR_3_REQUIREMENT gBehaviorValues.ToadStar3Requirement -#define TOAD_STAR_1_DIALOG DIALOG_082 -#define TOAD_STAR_2_DIALOG DIALOG_076 -#define TOAD_STAR_3_DIALOG DIALOG_083 +#define TOAD_STAR_1_DIALOG gBehaviorValues.dialogs.ToadStar1Dialog +#define TOAD_STAR_2_DIALOG gBehaviorValues.dialogs.ToadStar2Dialog +#define TOAD_STAR_3_DIALOG gBehaviorValues.dialogs.ToadStar3Dialog -#define TOAD_STAR_1_DIALOG_AFTER DIALOG_154 -#define TOAD_STAR_2_DIALOG_AFTER DIALOG_155 -#define TOAD_STAR_3_DIALOG_AFTER DIALOG_156 +#define TOAD_STAR_1_DIALOG_AFTER gBehaviorValues.dialogs.ToadStar1AfterDialog +#define TOAD_STAR_2_DIALOG_AFTER gBehaviorValues.dialogs.ToadStar2AfterDialog +#define TOAD_STAR_3_DIALOG_AFTER gBehaviorValues.dialogs.ToadStar3AfterDialog enum ToadMessageStates { TOAD_MESSAGE_FADED, @@ -212,19 +213,17 @@ static void toad_message_talking(void) { != 0) { gCurrentObject->oToadMessageRecentlyTalked = TRUE; gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING; - switch (gCurrentObject->oToadMessageDialogId) { - case TOAD_STAR_1_DIALOG: - gCurrentObject->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 0, TRUE); - break; - case TOAD_STAR_2_DIALOG: - gCurrentObject->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 1, TRUE); - break; - case TOAD_STAR_3_DIALOG: - gCurrentObject->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 2, TRUE); - break; + + u32 dialogId = gCurrentObject->oToadMessageDialogId; + if (dialogId == TOAD_STAR_1_DIALOG) { + gCurrentObject->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 0, TRUE); + } else if (dialogId == TOAD_STAR_2_DIALOG) { + gCurrentObject->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 1, TRUE); + } else if (dialogId == TOAD_STAR_3_DIALOG) { + gCurrentObject->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(gMarioStates[0].marioObj, 2, TRUE); } } } @@ -270,26 +269,23 @@ void bhv_toad_message_init(void) { s32 dialogId = (gCurrentObject->oBehParams >> 24) & 0xFF; s32 enoughStars = TRUE; - switch (dialogId) { - case TOAD_STAR_1_DIALOG: - enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) { - dialogId = TOAD_STAR_1_DIALOG_AFTER; - } - break; - case TOAD_STAR_2_DIALOG: - enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) { - dialogId = TOAD_STAR_2_DIALOG_AFTER; - } - break; - case TOAD_STAR_3_DIALOG: - enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) { - dialogId = TOAD_STAR_3_DIALOG_AFTER; - } - break; + if (dialogId == (s32)TOAD_STAR_1_DIALOG) { + enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) { + dialogId = TOAD_STAR_1_DIALOG_AFTER; + } + } else if (dialogId == (s32)TOAD_STAR_2_DIALOG) { + enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) { + dialogId = TOAD_STAR_2_DIALOG_AFTER; + } + } else if (dialogId == (s32)TOAD_STAR_3_DIALOG) { + enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) { + dialogId = TOAD_STAR_3_DIALOG_AFTER; + } } + if (enoughStars) { gCurrentObject->oToadMessageDialogId = dialogId; gCurrentObject->oToadMessageRecentlyTalked = FALSE; diff --git a/src/game/segment2.h b/src/game/segment2.h index 7eecce54..78e3c785 100644 --- a/src/game/segment2.h +++ b/src/game/segment2.h @@ -3,6 +3,7 @@ #include #include +#include "dialog_ids.h" extern u8 seg2_course_name_table[]; extern u8 seg2_act_name_table[]; @@ -52,6 +53,7 @@ extern void *main_credits_font_lut[]; extern u8* main_hud_camera_lut[6]; extern Gfx dl_draw_text_bg_box[]; extern Gfx dl_draw_triangle[]; +extern const u8* seg2_dialog_original[]; extern void *seg2_dialog_table[]; extern Gfx dl_billboard_num_0[]; extern Gfx dl_billboard_num_1[]; diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index a42298a0..06b84c71 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -2,6 +2,7 @@ #include "pc/mods/mods.h" #include "pc/mods/mods_utils.h" #include "pc/crash_handler.h" +#include "pc/lua/utils/smlua_misc_utils.h" lua_State* gLuaState = NULL; u8 gLuaInitializingScript = 0; @@ -141,6 +142,7 @@ void smlua_update(void) { } void smlua_shutdown(void) { + dialog_reset_all(); smlua_cobject_allowlist_shutdown(); smlua_cpointer_allowlist_shutdown(); lua_State* L = gLuaState; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index e602d246..f8c1d94f 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -72,6 +72,94 @@ static struct LuaObjectField sAreaFields[LUA_AREA_FIELD_COUNT] = { // { "whirlpools", LOT_???, offsetof(struct Area, whirlpools), false, LOT_??? }, <--- UNIMPLEMENTED }; +#define LUA_BEHAVIOR_DIALOGS_FIELD_COUNT 84 +static struct LuaObjectField sBehaviorDialogsFields[LUA_BEHAVIOR_DIALOGS_FIELD_COUNT] = { + { "BobombBuddyBob1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, BobombBuddyBob1Dialog), false, LOT_NONE }, + { "BobombBuddyBob2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, BobombBuddyBob2Dialog), false, LOT_NONE }, + { "BobombBuddyOther1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, BobombBuddyOther1Dialog), false, LOT_NONE }, + { "BobombBuddyOther2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, BobombBuddyOther2Dialog), false, LOT_NONE }, + { "Bowser1DefeatedDialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser1DefeatedDialog), false, LOT_NONE }, + { "Bowser1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser1Dialog), false, LOT_NONE }, + { "Bowser2DefeatedDialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser2DefeatedDialog), false, LOT_NONE }, + { "Bowser2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser2Dialog), false, LOT_NONE }, + { "Bowser3Defeated120StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser3Defeated120StarsDialog), false, LOT_NONE }, + { "Bowser3DefeatedDialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser3DefeatedDialog), false, LOT_NONE }, + { "Bowser3Dialog", LVT_S32, offsetof(struct BehaviorDialogs, Bowser3Dialog), false, LOT_NONE }, + { "CapswitchBaseDialog", LVT_S32, offsetof(struct BehaviorDialogs, CapswitchBaseDialog), false, LOT_NONE }, + { "CapswitchMetalDialog", LVT_S32, offsetof(struct BehaviorDialogs, CapswitchMetalDialog), false, LOT_NONE }, + { "CapswitchVanishDialog", LVT_S32, offsetof(struct BehaviorDialogs, CapswitchVanishDialog), false, LOT_NONE }, + { "CapswitchWingDialog", LVT_S32, offsetof(struct BehaviorDialogs, CapswitchWingDialog), false, LOT_NONE }, + { "CastleEnterDialog", LVT_S32, offsetof(struct BehaviorDialogs, CastleEnterDialog), false, LOT_NONE }, + { "CollectedStarDialog", LVT_S32, offsetof(struct BehaviorDialogs, CollectedStarDialog), false, LOT_NONE }, + { "DefaultCutsceneDialog", LVT_S32, offsetof(struct BehaviorDialogs, DefaultCutsceneDialog), false, LOT_NONE }, + { "DoorNeed1StarDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed1StarDialog), false, LOT_NONE }, + { "DoorNeed30StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed30StarsDialog), false, LOT_NONE }, + { "DoorNeed3StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed3StarsDialog), false, LOT_NONE }, + { "DoorNeed50StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed50StarsDialog), false, LOT_NONE }, + { "DoorNeed70StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed70StarsDialog), false, LOT_NONE }, + { "DoorNeed8StarsDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeed8StarsDialog), false, LOT_NONE }, + { "DoorNeedKeyDialog", LVT_S32, offsetof(struct BehaviorDialogs, DoorNeedKeyDialog), false, LOT_NONE }, + { "EyerokDefeatedDialog", LVT_S32, offsetof(struct BehaviorDialogs, EyerokDefeatedDialog), false, LOT_NONE }, + { "EyerokIntroDialog", LVT_S32, offsetof(struct BehaviorDialogs, EyerokIntroDialog), false, LOT_NONE }, + { "GhostHuntAfterDialog", LVT_S32, offsetof(struct BehaviorDialogs, GhostHuntAfterDialog), false, LOT_NONE }, + { "GhostHuntDialog", LVT_S32, offsetof(struct BehaviorDialogs, GhostHuntDialog), false, LOT_NONE }, + { "HootIntroDialog", LVT_S32, offsetof(struct BehaviorDialogs, HootIntroDialog), false, LOT_NONE }, + { "HootTiredDialog", LVT_S32, offsetof(struct BehaviorDialogs, HootTiredDialog), false, LOT_NONE }, + { "HundredCoinsDialog", LVT_S32, offsetof(struct BehaviorDialogs, HundredCoinsDialog), false, LOT_NONE }, + { "IntroPipeDialog", LVT_S32, offsetof(struct BehaviorDialogs, IntroPipeDialog), false, LOT_NONE }, + { "KeyDoor1DontHaveDialog", LVT_S32, offsetof(struct BehaviorDialogs, KeyDoor1DontHaveDialog), false, LOT_NONE }, + { "KeyDoor1HaveDialog", LVT_S32, offsetof(struct BehaviorDialogs, KeyDoor1HaveDialog), false, LOT_NONE }, + { "KeyDoor2DontHaveDialog", LVT_S32, offsetof(struct BehaviorDialogs, KeyDoor2DontHaveDialog), false, LOT_NONE }, + { "KeyDoor2HaveDialog", LVT_S32, offsetof(struct BehaviorDialogs, KeyDoor2HaveDialog), false, LOT_NONE }, + { "KingBobombCheatDialog", LVT_S32, offsetof(struct BehaviorDialogs, KingBobombCheatDialog), false, LOT_NONE }, + { "KingBobombDefeatDialog", LVT_S32, offsetof(struct BehaviorDialogs, KingBobombDefeatDialog), false, LOT_NONE }, + { "KingBobombIntroDialog", LVT_S32, offsetof(struct BehaviorDialogs, KingBobombIntroDialog), false, LOT_NONE }, + { "KingWhompDefeatDialog", LVT_S32, offsetof(struct BehaviorDialogs, KingWhompDefeatDialog), false, LOT_NONE }, + { "KingWhompDialog", LVT_S32, offsetof(struct BehaviorDialogs, KingWhompDialog), false, LOT_NONE }, + { "KoopaQuickBobStartDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickBobStartDialog), false, LOT_NONE }, + { "KoopaQuickBobWinDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickBobWinDialog), false, LOT_NONE }, + { "KoopaQuickCheatedDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickCheatedDialog), false, LOT_NONE }, + { "KoopaQuickLostDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickLostDialog), false, LOT_NONE }, + { "KoopaQuickThiStartDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickThiStartDialog), false, LOT_NONE }, + { "KoopaQuickThiWinDialog", LVT_S32, offsetof(struct BehaviorDialogs, KoopaQuickThiWinDialog), false, LOT_NONE }, + { "LakituIntroDialog", LVT_S32, offsetof(struct BehaviorDialogs, LakituIntroDialog), false, LOT_NONE }, + { "MetalCourseDialog", LVT_S32, offsetof(struct BehaviorDialogs, MetalCourseDialog), false, LOT_NONE }, + { "Mips1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, Mips1Dialog), false, LOT_NONE }, + { "Mips2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, Mips2Dialog), false, LOT_NONE }, + { "PeachLetterDialog", LVT_S32, offsetof(struct BehaviorDialogs, PeachLetterDialog), false, LOT_NONE }, + { "RacingPenguinBigStartDialog", LVT_S32, offsetof(struct BehaviorDialogs, RacingPenguinBigStartDialog), false, LOT_NONE }, + { "RacingPenguinCheatDialog", LVT_S32, offsetof(struct BehaviorDialogs, RacingPenguinCheatDialog), false, LOT_NONE }, + { "RacingPenguinLostDialog", LVT_S32, offsetof(struct BehaviorDialogs, RacingPenguinLostDialog), false, LOT_NONE }, + { "RacingPenguinStartDialog", LVT_S32, offsetof(struct BehaviorDialogs, RacingPenguinStartDialog), false, LOT_NONE }, + { "RacingPenguinWinDialog", LVT_S32, offsetof(struct BehaviorDialogs, RacingPenguinWinDialog), false, LOT_NONE }, + { "SnowmanHeadAfterDialog", LVT_S32, offsetof(struct BehaviorDialogs, SnowmanHeadAfterDialog), false, LOT_NONE }, + { "SnowmanHeadBodyDialog", LVT_S32, offsetof(struct BehaviorDialogs, SnowmanHeadBodyDialog), false, LOT_NONE }, + { "SnowmanHeadDialog", LVT_S32, offsetof(struct BehaviorDialogs, SnowmanHeadDialog), false, LOT_NONE }, + { "SnowmanWindDialog", LVT_S32, offsetof(struct BehaviorDialogs, SnowmanWindDialog), false, LOT_NONE }, + { "StarCollectionBaseDialog", LVT_S32, offsetof(struct BehaviorDialogs, StarCollectionBaseDialog), false, LOT_NONE }, + { "StarDoorDialog", LVT_S32, offsetof(struct BehaviorDialogs, StarDoorDialog), false, LOT_NONE }, + { "ToadStar1AfterDialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar1AfterDialog), false, LOT_NONE }, + { "ToadStar1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar1Dialog), false, LOT_NONE }, + { "ToadStar2AfterDialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar2AfterDialog), false, LOT_NONE }, + { "ToadStar2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar2Dialog), false, LOT_NONE }, + { "ToadStar3AfterDialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar3AfterDialog), false, LOT_NONE }, + { "ToadStar3Dialog", LVT_S32, offsetof(struct BehaviorDialogs, ToadStar3Dialog), false, LOT_NONE }, + { "TuxieMotherBabyFoundDialog", LVT_S32, offsetof(struct BehaviorDialogs, TuxieMotherBabyFoundDialog), false, LOT_NONE }, + { "TuxieMotherBabyWrongDialog", LVT_S32, offsetof(struct BehaviorDialogs, TuxieMotherBabyWrongDialog), false, LOT_NONE }, + { "TuxieMotherDialog", LVT_S32, offsetof(struct BehaviorDialogs, TuxieMotherDialog), false, LOT_NONE }, + { "UkikiCageDialog", LVT_S32, offsetof(struct BehaviorDialogs, UkikiCageDialog), false, LOT_NONE }, + { "UkikiCapGiveDialog", LVT_S32, offsetof(struct BehaviorDialogs, UkikiCapGiveDialog), false, LOT_NONE }, + { "UkikiCapStealDialog", LVT_S32, offsetof(struct BehaviorDialogs, UkikiCapStealDialog), false, LOT_NONE }, + { "UkikiHeldDialog", LVT_S32, offsetof(struct BehaviorDialogs, UkikiHeldDialog), false, LOT_NONE }, + { "VanishCourseDialog", LVT_S32, offsetof(struct BehaviorDialogs, VanishCourseDialog), false, LOT_NONE }, + { "WigglerAttack1Dialog", LVT_S32, offsetof(struct BehaviorDialogs, WigglerAttack1Dialog), false, LOT_NONE }, + { "WigglerAttack2Dialog", LVT_S32, offsetof(struct BehaviorDialogs, WigglerAttack2Dialog), false, LOT_NONE }, + { "WigglerAttack3Dialog", LVT_S32, offsetof(struct BehaviorDialogs, WigglerAttack3Dialog), false, LOT_NONE }, + { "WigglerDialog", LVT_S32, offsetof(struct BehaviorDialogs, WigglerDialog), false, LOT_NONE }, + { "WingCourseDialog", LVT_S32, offsetof(struct BehaviorDialogs, WingCourseDialog), false, LOT_NONE }, + { "YoshiDialog", LVT_S32, offsetof(struct BehaviorDialogs, YoshiDialog), false, LOT_NONE }, +}; + #define LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT 28 static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT] = { { "BowlingBallBob2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallBob2Trajectory), false, LOT_POINTER }, @@ -104,12 +192,20 @@ static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORI { "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER }, }; -#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 4 +#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 12 static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COUNT] = { - { "KoopaBobAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaBobAgility), false, LOT_NONE }, - { "KoopaCatchupAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaCatchupAgility), false, LOT_NONE }, - { "KoopaThiAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaThiAgility), false, LOT_NONE }, - { "trajectories", LVT_COBJECT, offsetof(struct BehaviorValues, trajectories), true, LOT_BEHAVIORTRAJECTORIES }, + { "KoopaBobAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaBobAgility), false, LOT_NONE }, + { "KoopaCatchupAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaCatchupAgility), false, LOT_NONE }, + { "KoopaThiAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaThiAgility), false, LOT_NONE }, + { "RacingPenguinBigHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigHeight), false, LOT_NONE }, + { "RacingPenguinBigRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigRadius), false, LOT_NONE }, + { "RacingPenguinHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinHeight), false, LOT_NONE }, + { "RacingPenguinRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinRadius), false, LOT_NONE }, + { "ToadStar1Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar1Requirement), false, LOT_NONE }, + { "ToadStar2Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar2Requirement), false, LOT_NONE }, + { "ToadStar3Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar3Requirement), false, LOT_NONE }, + { "dialogs", LVT_COBJECT, offsetof(struct BehaviorValues, dialogs), true, LOT_BEHAVIORDIALOGS }, + { "trajectories", LVT_COBJECT, offsetof(struct BehaviorValues, trajectories), true, LOT_BEHAVIORTRAJECTORIES }, }; #define LUA_BULLY_COLLISION_DATA_FIELD_COUNT 6 @@ -1775,6 +1871,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] { LOT_ANIMINFO, sAnimInfoFields, LUA_ANIM_INFO_FIELD_COUNT }, { LOT_ANIMATION, sAnimationFields, LUA_ANIMATION_FIELD_COUNT }, { LOT_AREA, sAreaFields, LUA_AREA_FIELD_COUNT }, + { LOT_BEHAVIORDIALOGS, sBehaviorDialogsFields, LUA_BEHAVIOR_DIALOGS_FIELD_COUNT }, { LOT_BEHAVIORTRAJECTORIES, sBehaviorTrajectoriesFields, LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT }, { LOT_BEHAVIORVALUES, sBehaviorValuesFields, LUA_BEHAVIOR_VALUES_FIELD_COUNT }, { LOT_BULLYCOLLISIONDATA, sBullyCollisionDataFields, LUA_BULLY_COLLISION_DATA_FIELD_COUNT }, diff --git a/src/pc/lua/smlua_cobject_autogen.h b/src/pc/lua/smlua_cobject_autogen.h index d0bced88..0b4428d6 100644 --- a/src/pc/lua/smlua_cobject_autogen.h +++ b/src/pc/lua/smlua_cobject_autogen.h @@ -8,6 +8,7 @@ enum LuaObjectAutogenType { LOT_ANIMINFO, LOT_ANIMATION, LOT_AREA, + LOT_BEHAVIORDIALOGS, LOT_BEHAVIORTRAJECTORIES, LOT_BEHAVIORVALUES, LOT_BULLYCOLLISIONDATA, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 25bd732f..9cc8220d 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1008,6 +1008,177 @@ char gSmluaConstants[] = "" "CHAR_SOUND_SO_LONGA_BOWSER = 40\n" "CHAR_SOUND_IMA_TIRED = 41\n" "CHAR_SOUND_MAX = 42\n" +"DIALOG_000 = 0\n" +"DIALOG_001 = 1\n" +"DIALOG_002 = 2\n" +"DIALOG_003 = 3\n" +"DIALOG_004 = 4\n" +"DIALOG_005 = 5\n" +"DIALOG_006 = 6\n" +"DIALOG_007 = 7\n" +"DIALOG_008 = 8\n" +"DIALOG_009 = 9\n" +"DIALOG_010 = 10\n" +"DIALOG_011 = 11\n" +"DIALOG_012 = 12\n" +"DIALOG_013 = 13\n" +"DIALOG_014 = 14\n" +"DIALOG_015 = 15\n" +"DIALOG_016 = 16\n" +"DIALOG_017 = 17\n" +"DIALOG_018 = 18\n" +"DIALOG_019 = 19\n" +"DIALOG_020 = 20\n" +"DIALOG_021 = 21\n" +"DIALOG_022 = 22\n" +"DIALOG_023 = 23\n" +"DIALOG_024 = 24\n" +"DIALOG_025 = 25\n" +"DIALOG_026 = 26\n" +"DIALOG_027 = 27\n" +"DIALOG_028 = 28\n" +"DIALOG_029 = 29\n" +"DIALOG_030 = 30\n" +"DIALOG_031 = 31\n" +"DIALOG_032 = 32\n" +"DIALOG_033 = 33\n" +"DIALOG_034 = 34\n" +"DIALOG_035 = 35\n" +"DIALOG_036 = 36\n" +"DIALOG_037 = 37\n" +"DIALOG_038 = 38\n" +"DIALOG_039 = 39\n" +"DIALOG_040 = 40\n" +"DIALOG_041 = 41\n" +"DIALOG_042 = 42\n" +"DIALOG_043 = 43\n" +"DIALOG_044 = 44\n" +"DIALOG_045 = 45\n" +"DIALOG_046 = 46\n" +"DIALOG_047 = 47\n" +"DIALOG_048 = 48\n" +"DIALOG_049 = 49\n" +"DIALOG_050 = 50\n" +"DIALOG_051 = 51\n" +"DIALOG_052 = 52\n" +"DIALOG_053 = 53\n" +"DIALOG_054 = 54\n" +"DIALOG_055 = 55\n" +"DIALOG_056 = 56\n" +"DIALOG_057 = 57\n" +"DIALOG_058 = 58\n" +"DIALOG_059 = 59\n" +"DIALOG_060 = 60\n" +"DIALOG_061 = 61\n" +"DIALOG_062 = 62\n" +"DIALOG_063 = 63\n" +"DIALOG_064 = 64\n" +"DIALOG_065 = 65\n" +"DIALOG_066 = 66\n" +"DIALOG_067 = 67\n" +"DIALOG_068 = 68\n" +"DIALOG_069 = 69\n" +"DIALOG_070 = 70\n" +"DIALOG_071 = 71\n" +"DIALOG_072 = 72\n" +"DIALOG_073 = 73\n" +"DIALOG_074 = 74\n" +"DIALOG_075 = 75\n" +"DIALOG_076 = 76\n" +"DIALOG_077 = 77\n" +"DIALOG_078 = 78\n" +"DIALOG_079 = 79\n" +"DIALOG_080 = 80\n" +"DIALOG_081 = 81\n" +"DIALOG_082 = 82\n" +"DIALOG_083 = 83\n" +"DIALOG_084 = 84\n" +"DIALOG_085 = 85\n" +"DIALOG_086 = 86\n" +"DIALOG_087 = 87\n" +"DIALOG_088 = 88\n" +"DIALOG_089 = 89\n" +"DIALOG_090 = 90\n" +"DIALOG_091 = 91\n" +"DIALOG_092 = 92\n" +"DIALOG_093 = 93\n" +"DIALOG_094 = 94\n" +"DIALOG_095 = 95\n" +"DIALOG_096 = 96\n" +"DIALOG_097 = 97\n" +"DIALOG_098 = 98\n" +"DIALOG_099 = 99\n" +"DIALOG_100 = 100\n" +"DIALOG_101 = 101\n" +"DIALOG_102 = 102\n" +"DIALOG_103 = 103\n" +"DIALOG_104 = 104\n" +"DIALOG_105 = 105\n" +"DIALOG_106 = 106\n" +"DIALOG_107 = 107\n" +"DIALOG_108 = 108\n" +"DIALOG_109 = 109\n" +"DIALOG_110 = 110\n" +"DIALOG_111 = 111\n" +"DIALOG_112 = 112\n" +"DIALOG_113 = 113\n" +"DIALOG_114 = 114\n" +"DIALOG_115 = 115\n" +"DIALOG_116 = 116\n" +"DIALOG_117 = 117\n" +"DIALOG_118 = 118\n" +"DIALOG_119 = 119\n" +"DIALOG_120 = 120\n" +"DIALOG_121 = 121\n" +"DIALOG_122 = 122\n" +"DIALOG_123 = 123\n" +"DIALOG_124 = 124\n" +"DIALOG_125 = 125\n" +"DIALOG_126 = 126\n" +"DIALOG_127 = 127\n" +"DIALOG_128 = 128\n" +"DIALOG_129 = 129\n" +"DIALOG_130 = 130\n" +"DIALOG_131 = 131\n" +"DIALOG_132 = 132\n" +"DIALOG_133 = 133\n" +"DIALOG_134 = 134\n" +"DIALOG_135 = 135\n" +"DIALOG_136 = 136\n" +"DIALOG_137 = 137\n" +"DIALOG_138 = 138\n" +"DIALOG_139 = 139\n" +"DIALOG_140 = 140\n" +"DIALOG_141 = 141\n" +"DIALOG_142 = 142\n" +"DIALOG_143 = 143\n" +"DIALOG_144 = 144\n" +"DIALOG_145 = 145\n" +"DIALOG_146 = 146\n" +"DIALOG_147 = 147\n" +"DIALOG_148 = 148\n" +"DIALOG_149 = 149\n" +"DIALOG_150 = 150\n" +"DIALOG_151 = 151\n" +"DIALOG_152 = 152\n" +"DIALOG_153 = 153\n" +"DIALOG_154 = 154\n" +"DIALOG_155 = 155\n" +"DIALOG_156 = 156\n" +"DIALOG_157 = 157\n" +"DIALOG_158 = 158\n" +"DIALOG_159 = 159\n" +"DIALOG_160 = 160\n" +"DIALOG_161 = 161\n" +"DIALOG_162 = 162\n" +"DIALOG_163 = 163\n" +"DIALOG_164 = 164\n" +"DIALOG_165 = 165\n" +"DIALOG_166 = 166\n" +"DIALOG_167 = 167\n" +"DIALOG_168 = 168\n" +"DIALOG_169 = 169\n" +"DIALOG_COUNT = 170\n" "RESOLUTION_DJUI = 0\n" "RESOLUTION_N64 = 1\n" "RESOLUTION_COUNT = 2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index c2e35f19..bdbde115 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -14656,6 +14656,36 @@ int smlua_func_deref_s32_pointer(lua_State* L) { return 1; } +int smlua_func_dialog_replace(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + + int dialogId = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u32 unused = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s8 linesPerBox = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + s16 leftOffset = smlua_to_integer(L, 4); + if (!gSmLuaConvertSuccess) { return 0; } + s16 width = smlua_to_integer(L, 5); + if (!gSmLuaConvertSuccess) { return 0; } + const char* str = smlua_to_string(L, 6); + if (!gSmLuaConvertSuccess) { return 0; } + + dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str); + + return 1; +} + +int smlua_func_dialog_reset_all(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + dialog_reset_all(); + + return 1; +} + int smlua_func_get_current_save_file_num(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } @@ -16818,6 +16848,8 @@ void smlua_bind_functions_autogen(void) { // smlua_misc_utils.h smlua_bind_function(L, "allocate_mario_action", smlua_func_allocate_mario_action); smlua_bind_function(L, "deref_s32_pointer", smlua_func_deref_s32_pointer); + smlua_bind_function(L, "dialog_replace", smlua_func_dialog_replace); + smlua_bind_function(L, "dialog_reset_all", smlua_func_dialog_reset_all); smlua_bind_function(L, "get_current_save_file_num", smlua_func_get_current_save_file_num); smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region); smlua_bind_function(L, "get_hand_foot_pos_x", smlua_func_get_hand_foot_pos_x); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index e0cd52ae..b3cf69d2 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -6,6 +6,8 @@ #include "pc/lua/smlua.h" #include "smlua_misc_utils.h" #include "pc/debuglog.h" +#include "game/ingame_menu.h" +#include "game/segment2.h" #include "game/object_list_processor.h" @@ -106,3 +108,42 @@ void set_environment_region(u8 index, s32 value) { gEnvironmentRegions[6 * (int)index] = value; } } + +/// + +static bool sReplacedDialog[DIALOG_COUNT] = { 0 }; + +void dialog_reset_all(void) { + void **dialogTable = segmented_to_virtual(seg2_dialog_table); + + for (s32 i = 0; i < DIALOG_COUNT; i++) { + struct DialogEntry *dialog = segmented_to_virtual(dialogTable[i]); + if (sReplacedDialog[i]) { + free((u8*)dialog->str); + dialog->str = seg2_dialog_original[i]; + } + } +} + +void dialog_replace(enum DialogId dialogId, UNUSED u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str) { + if (dialogId >= DIALOG_COUNT) { return; } + + void **dialogTable = segmented_to_virtual(seg2_dialog_table); + struct DialogEntry *dialog = segmented_to_virtual(dialogTable[dialogId]); + + s32 len = strlen(str); + u8* dialogStr = calloc(len + 1, sizeof(u8)); + str_ascii_to_dialog(str, dialogStr, len); + + if (sReplacedDialog[dialogId]) { + free((u8*)dialog->str); + } + + dialog->unused = unused; + dialog->linesPerBox = linesPerBox; + dialog->leftOffset = leftOffset; + dialog->width = width; + dialog->str = (const u8*)dialogStr; + sReplacedDialog[dialogId] = true; +} + diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index e292a0cb..235612ed 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -1,6 +1,8 @@ #ifndef SMLUA_MISC_UTILS_H #define SMLUA_MISC_UTILS_H +#include "dialog_ids.h" + u32 get_network_area_timer(void); s32* get_temp_s32_pointer(s32 initialValue); @@ -20,6 +22,9 @@ f32 get_hand_foot_pos_x(struct MarioState* m, u8 index); f32 get_hand_foot_pos_y(struct MarioState* m, u8 index); f32 get_hand_foot_pos_z(struct MarioState* m, u8 index); +void dialog_reset_all(void); +void dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str); + s16 get_current_save_file_num(void); void movtexqc_register(const char* name, s16 level, s16 area, s16 type); diff --git a/text/define_text.inc.c b/text/define_text.inc.c index d33031f6..15b62d0c 100644 --- a/text/define_text.inc.c +++ b/text/define_text.inc.c @@ -44,9 +44,17 @@ const struct DialogEntry *const seg2_debug_text_table[] = { #include "dialogs.h" +#undef DEFINE_DIALOG +#define DEFINE_DIALOG(id, _1, _2, _3, _4, _5) dialog_text_ ## id, + +const u8* seg2_dialog_original[] = { +#include "dialogs.h" + NULL +}; + #undef DEFINE_DIALOG #define DEFINE_DIALOG(id, unused, linesPerBox, leftOffset, width, _) \ - static const struct DialogEntry dialog_entry_ ## id = { \ + static struct DialogEntry dialog_entry_ ## id = { \ unused, linesPerBox, leftOffset, width, dialog_text_ ## id \ }; @@ -60,7 +68,6 @@ const struct DialogEntry *const seg2_dialog_table[] = { NULL }; - // == courses == // (defines en_course_name_table etc.) // The game duplicates this in levels/menu/leveldata.c in EU, so we split