Customizable dialogs (#411)
* add customizable dialogs * remove testing mod * add HOOK_ON_DIALOG * Reset dialog overrides in `network_shutdown` It may have compile errors idk editing code on phone sucks * typo smh * copy over the file from original repo so this fork can be synced * run autogen again * actually im stupid
This commit is contained in:
parent
73aa3890fd
commit
4c5c88f662
|
@ -60,7 +60,8 @@ in_files = [
|
|||
"src/pc/utils/misc.h",
|
||||
"src/game/level_update.h",
|
||||
"src/game/area.h",
|
||||
"src/engine/level_script.h"
|
||||
"src/engine/level_script.h",
|
||||
"src/game/ingame_menu.h"
|
||||
]
|
||||
|
||||
override_allowed_functions = {
|
||||
|
@ -74,7 +75,8 @@ override_allowed_functions = {
|
|||
"src/pc/utils/misc.h": [ "update_all_mario_stars" ],
|
||||
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp" ],
|
||||
"src/game/area.h": [ "area_get_warp_node" ],
|
||||
"src/engine/level_script.h": [ "area_create_warp_node" ]
|
||||
"src/engine/level_script.h": [ "area_create_warp_node" ],
|
||||
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color" ]
|
||||
}
|
||||
|
||||
override_disallowed_functions = {
|
||||
|
@ -107,7 +109,7 @@ override_disallowed_functions = {
|
|||
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ],
|
||||
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
||||
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ],
|
||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ]
|
||||
}
|
||||
|
||||
override_hide_functions = {
|
||||
|
|
|
@ -8274,7 +8274,10 @@ HOOK_JOINED_GAME = 31
|
|||
HOOK_ON_OBJECT_ANIM_UPDATE = 32
|
||||
|
||||
--- @type LuaHookedEventType
|
||||
HOOK_MAX = 33
|
||||
HOOK_ON_DIALOG = 33
|
||||
|
||||
--- @type LuaHookedEventType
|
||||
HOOK_MAX = 34
|
||||
|
||||
--- @class HudDisplayFlags
|
||||
|
||||
|
|
|
@ -3953,6 +3953,42 @@ function stop_sounds_in_continuous_banks()
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @return nil
|
||||
function reset_dialog_override_color()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return nil
|
||||
function reset_dialog_override_pos()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param bgR integer
|
||||
--- @param bgG integer
|
||||
--- @param bgB integer
|
||||
--- @param bgA integer
|
||||
--- @param textR integer
|
||||
--- @param textG integer
|
||||
--- @param textB integer
|
||||
--- @param textA integer
|
||||
--- @return nil
|
||||
function set_dialog_override_color(bgR, bgG, bgB, bgA, textR, textG, textB, textA)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param x integer
|
||||
--- @param y integer
|
||||
--- @return nil
|
||||
function set_dialog_override_pos(x, y)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param width integer
|
||||
--- @return nil
|
||||
function set_min_dialog_width(width)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param m MarioState
|
||||
--- @param o Object
|
||||
--- @return integer
|
||||
|
|
|
@ -2955,7 +2955,8 @@
|
|||
| HOOK_BEFORE_SET_MARIO_ACTION | 30 |
|
||||
| HOOK_JOINED_GAME | 31 |
|
||||
| HOOK_ON_OBJECT_ANIM_UPDATE | 32 |
|
||||
| HOOK_MAX | 33 |
|
||||
| HOOK_ON_DIALOG | 33 |
|
||||
| HOOK_MAX | 34 |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
@ -3107,6 +3107,116 @@
|
|||
|
||||
<br />
|
||||
|
||||
---
|
||||
# functions from ingame_menu.h
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
## [reset_dialog_override_color](#reset_dialog_override_color)
|
||||
|
||||
### Lua Example
|
||||
`reset_dialog_override_color()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void reset_dialog_override_color();`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [reset_dialog_override_pos](#reset_dialog_override_pos)
|
||||
|
||||
### Lua Example
|
||||
`reset_dialog_override_pos()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void reset_dialog_override_pos();`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_dialog_override_color](#set_dialog_override_color)
|
||||
|
||||
### Lua Example
|
||||
`set_dialog_override_color(bgR, bgG, bgB, bgA, textR, textG, textB, textA)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| bgR | `integer` |
|
||||
| bgG | `integer` |
|
||||
| bgB | `integer` |
|
||||
| bgA | `integer` |
|
||||
| textR | `integer` |
|
||||
| textG | `integer` |
|
||||
| textB | `integer` |
|
||||
| textA | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void set_dialog_override_color(u8 bgR, u8 bgG, u8 bgB, u8 bgA, u8 textR, u8 textG, u8 textB, u8 textA);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_dialog_override_pos](#set_dialog_override_pos)
|
||||
|
||||
### Lua Example
|
||||
`set_dialog_override_pos(x, y)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| x | `integer` |
|
||||
| y | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void set_dialog_override_pos(s16 x, s16 y);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_min_dialog_width](#set_min_dialog_width)
|
||||
|
||||
### Lua Example
|
||||
`set_min_dialog_width(width)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| width | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void set_min_dialog_width(s16 width);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
# functions from interaction.h
|
||||
|
||||
|
|
|
@ -779,6 +779,15 @@
|
|||
|
||||
<br />
|
||||
|
||||
- ingame_menu.h
|
||||
- [reset_dialog_override_color](functions-3.md#reset_dialog_override_color)
|
||||
- [reset_dialog_override_pos](functions-3.md#reset_dialog_override_pos)
|
||||
- [set_dialog_override_color](functions-3.md#set_dialog_override_color)
|
||||
- [set_dialog_override_pos](functions-3.md#set_dialog_override_pos)
|
||||
- [set_min_dialog_width](functions-3.md#set_min_dialog_width)
|
||||
|
||||
<br />
|
||||
|
||||
- interaction.h
|
||||
- [determine_interaction](functions-3.md#determine_interaction)
|
||||
- [does_mario_have_normal_cap_on_head](functions-3.md#does_mario_have_normal_cap_on_head)
|
||||
|
|
|
@ -120,6 +120,7 @@ The lua functions sent to `hook_event()` will be automatically called by SM64 wh
|
|||
| HOOK_JOINED_GAME | Called when the local player finishes the join process (if the player isn't the host) | None |
|
||||
| HOOK_BEFORE_SET_MARIO_ACTION | Called before Mario's action changes. Return an action to change the incoming action or `1` to cancel the action change. | [MarioState](structs.md#MarioState) mario, `integer` incomingAction |
|
||||
| HOOK_ON_OBJECT_ANIM_UPDATE | Called when an object's animation is updated. | [Object](structs.md#Object) objNode |
|
||||
| HOOK_ON_DIALOG | Called when a dialog appears. Return `false` to prevent it from appearing. | `integer` dialogId |
|
||||
|
||||
### Parameters
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "pc/utils/misc.h"
|
||||
#include "data/dynos_mgr_builtin_externs.h"
|
||||
#include "hud.h"
|
||||
#include "pc/lua/smlua_hooks.h"
|
||||
#include "game/camera.h"
|
||||
#ifdef BETTERCAMERA
|
||||
#include "bettercamera.h"
|
||||
#endif
|
||||
|
@ -48,6 +50,19 @@ s16 gDialogY; // D_8032F69C
|
|||
#endif
|
||||
s16 gCutsceneMsgXOffset;
|
||||
s16 gCutsceneMsgYOffset;
|
||||
s16 gDialogMinWidth = 0;
|
||||
s16 gDialogOverrideX = 0;
|
||||
s16 gDialogOverrideY = 0;
|
||||
u8 gOverrideDialogPos = 0;
|
||||
u8 gOverrideDialogColor = 0;
|
||||
u8 gDialogBgColorR = 0;
|
||||
u8 gDialogBgColorG = 0;
|
||||
u8 gDialogBgColorB = 0;
|
||||
u8 gDialogBgColorA = 0;
|
||||
u8 gDialogTextColorR = 0;
|
||||
u8 gDialogTextColorG = 0;
|
||||
u8 gDialogTextColorB = 0;
|
||||
u8 gDialogTextColorA = 0;
|
||||
|
||||
extern u8 gLastCompletedCourseNum;
|
||||
extern u8 gLastCompletedStarNum;
|
||||
|
@ -1094,7 +1109,66 @@ s16 get_dialog_id(void) {
|
|||
return gDialogID;
|
||||
}
|
||||
|
||||
void handle_special_dialog_text(s16 dialogID) { // dialog ID tables, in order
|
||||
// King Bob-omb (Start), Whomp (Start), King Bob-omb (throw him out), Eyerock (Start), Wiggler (Start)
|
||||
s16 dialogBossStart[] = { 17, 114, 128, 117, 150 };
|
||||
// Koopa the Quick (BOB), Koopa the Quick (THI), Penguin Race, Fat Penguin Race (120 stars)
|
||||
s16 dialogRaceSound[] = { 5, 9, 55, 164 };
|
||||
// Red Switch, Green Switch, Blue Switch, 100 coins star, Bowser Red Coin Star
|
||||
s16 dialogStarSound[] = { 10, 11, 12, 13, 14 };
|
||||
// King Bob-omb (Start), Whomp (Defeated), King Bob-omb (Defeated, missing in JP), Eyerock (Defeated), Wiggler (Defeated)
|
||||
#if BUGFIX_KING_BOB_OMB_FADE_MUSIC
|
||||
s16 dialogBossStop[] = { 17, 115, 116, 118, 152 };
|
||||
#else
|
||||
//! @bug JP misses King Bob-omb defeated dialog "116", meaning that the boss music will still
|
||||
//! play after King Bob-omb is defeated until BOB loads it's music after the star cutscene
|
||||
s16 dialogBossStop[] = { 17, 115, 118, 152 };
|
||||
#endif
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStart); i++) {
|
||||
if (dialogBossStart[i] == dialogID) {
|
||||
seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60);
|
||||
play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_BOSS), 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogRaceSound); i++) {
|
||||
if (dialogRaceSound[i] == dialogID && gDialogLineNum == 1) {
|
||||
play_race_fanfare();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogStarSound); i++) {
|
||||
if (dialogStarSound[i] == dialogID && gDialogLineNum == 1) {
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStop); i++) {
|
||||
if (dialogBossStop[i] == dialogID) {
|
||||
seq_player_fade_out(SEQ_PLAYER_LEVEL, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool handle_dialog_hook(s16 dialogId) {
|
||||
bool open = false;
|
||||
smlua_call_event_hooks_int_params_ret_bool(HOOK_ON_DIALOG, dialogId, &open);
|
||||
if (!open) {
|
||||
gDialogLineNum = 1;
|
||||
gDialogBoxState = DIALOG_STATE_CLOSING;
|
||||
gDialogBoxOpenTimer = 20;
|
||||
handle_special_dialog_text(dialogId);
|
||||
}
|
||||
}
|
||||
|
||||
void create_dialog_box(s16 dialog) {
|
||||
handle_dialog_hook(dialog);
|
||||
if (gDialogID == -1) {
|
||||
gDialogID = dialog;
|
||||
gDialogBoxType = DIALOG_TYPE_ROTATE;
|
||||
|
@ -1102,6 +1176,7 @@ void create_dialog_box(s16 dialog) {
|
|||
}
|
||||
|
||||
void create_dialog_box_with_var(s16 dialog, s32 dialogVar) {
|
||||
handle_dialog_hook(dialog);
|
||||
if (gDialogID == -1) {
|
||||
gDialogID = dialog;
|
||||
gDialogVariable = dialogVar;
|
||||
|
@ -1110,6 +1185,7 @@ void create_dialog_box_with_var(s16 dialog, s32 dialogVar) {
|
|||
}
|
||||
|
||||
void create_dialog_inverted_box(s16 dialog) {
|
||||
handle_dialog_hook(dialog);
|
||||
if (gDialogID == -1) {
|
||||
gDialogID = dialog;
|
||||
gDialogBoxType = DIALOG_TYPE_ZOOM;
|
||||
|
@ -1117,6 +1193,7 @@ void create_dialog_inverted_box(s16 dialog) {
|
|||
}
|
||||
|
||||
void create_dialog_box_with_response(s16 dialog) {
|
||||
handle_dialog_hook(dialog);
|
||||
if (gDialogID == -1) {
|
||||
gDialogID = dialog;
|
||||
gDialogBoxType = DIALOG_TYPE_ROTATE;
|
||||
|
@ -1154,7 +1231,12 @@ void reset_dialog_render_state(void) {
|
|||
void render_dialog_box_type(struct DialogEntry *dialog, s8 linesPerBox) {
|
||||
UNUSED s32 unused;
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_NOPUSH, dialog->leftOffset, dialog->width, 0);
|
||||
if (gOverrideDialogPos != 0) {
|
||||
create_dl_translation_matrix(MENU_MTX_NOPUSH, gDialogOverrideX - 61, 240 - gDialogOverrideY - 5, 0);
|
||||
}
|
||||
else {
|
||||
create_dl_translation_matrix(MENU_MTX_NOPUSH, dialog->leftOffset, dialog->width, 0);
|
||||
}
|
||||
|
||||
switch (gDialogBoxType) {
|
||||
case DIALOG_TYPE_ROTATE: // Renders a dialog black box with zoom and rotation
|
||||
|
@ -1191,9 +1273,14 @@ void render_dialog_box_type(struct DialogEntry *dialog, s8 linesPerBox) {
|
|||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 150);
|
||||
break;
|
||||
}
|
||||
if (gOverrideDialogColor) {
|
||||
gDPSetEnvColor(gDisplayListHead++, gDialogBgColorR, gDialogBgColorG, gDialogBgColorB, gDialogBgColorA);
|
||||
}
|
||||
|
||||
f32 dialogWidth = 130 * 1.1f;
|
||||
if (dialogWidth < gDialogMinWidth) dialogWidth = gDialogMinWidth;
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, X_VAL1, Y_VAL1, 0);
|
||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, 1.1f, ((f32) linesPerBox / Y_VAL2) + 0.1, 1.0f);
|
||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, dialogWidth / 130, ((f32) linesPerBox / Y_VAL2) + 0.1, 1.0f);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_text_bg_box);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
|
@ -1222,6 +1309,9 @@ void change_and_flash_dialog_text_color_lines(s8 colorMode, s8 lineNum) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (gOverrideDialogColor) {
|
||||
gDPSetEnvColor(gDisplayListHead++, gDialogTextColorR, gDialogTextColorG, gDialogTextColorB, gDialogTextColorA)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
|
@ -1720,6 +1810,9 @@ void render_dialog_triangle_choice(void) {
|
|||
} else {
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
}
|
||||
if (gOverrideDialogColor) {
|
||||
gDPSetEnvColor(gDisplayListHead++, gDialogTextColorR, gDialogTextColorG, gDialogTextColorB, gDialogTextColorA);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_triangle);
|
||||
}
|
||||
|
@ -1748,7 +1841,10 @@ void render_dialog_string_color(s8 linesPerBox) {
|
|||
return;
|
||||
}
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, X_VAL5, (linesPerBox * Y_VAL5_1) + Y_VAL5_2, 0);
|
||||
f32 triangleOffset = gDialogMinWidth - 143;
|
||||
if (triangleOffset < 0) triangleOffset = 0;
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, X_VAL5 + triangleOffset, (linesPerBox * Y_VAL5_1) + Y_VAL5_2, 0);
|
||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, X_Y_VAL6, X_Y_VAL6, 1.0f);
|
||||
create_dl_rotation_matrix(MENU_MTX_NOPUSH, -DEFAULT_DIALOG_BOX_ANGLE, 0, 0, 1.0f);
|
||||
|
||||
|
@ -1757,58 +1853,14 @@ void render_dialog_string_color(s8 linesPerBox) {
|
|||
} else { // Black Text
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
}
|
||||
if (gOverrideDialogColor) {
|
||||
gDPSetEnvColor(gDisplayListHead++, gDialogTextColorR, gDialogTextColorG, gDialogTextColorB, gDialogTextColorA);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_triangle);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
void handle_special_dialog_text(s16 dialogID) { // dialog ID tables, in order
|
||||
// King Bob-omb (Start), Whomp (Start), King Bob-omb (throw him out), Eyerock (Start), Wiggler (Start)
|
||||
s16 dialogBossStart[] = { 17, 114, 128, 117, 150 };
|
||||
// Koopa the Quick (BOB), Koopa the Quick (THI), Penguin Race, Fat Penguin Race (120 stars)
|
||||
s16 dialogRaceSound[] = { 5, 9, 55, 164 };
|
||||
// Red Switch, Green Switch, Blue Switch, 100 coins star, Bowser Red Coin Star
|
||||
s16 dialogStarSound[] = { 10, 11, 12, 13, 14 };
|
||||
// King Bob-omb (Start), Whomp (Defeated), King Bob-omb (Defeated, missing in JP), Eyerock (Defeated), Wiggler (Defeated)
|
||||
#if BUGFIX_KING_BOB_OMB_FADE_MUSIC
|
||||
s16 dialogBossStop[] = { 17, 115, 116, 118, 152 };
|
||||
#else
|
||||
//! @bug JP misses King Bob-omb defeated dialog "116", meaning that the boss music will still
|
||||
//! play after King Bob-omb is defeated until BOB loads it's music after the star cutscene
|
||||
s16 dialogBossStop[] = { 17, 115, 118, 152 };
|
||||
#endif
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStart); i++) {
|
||||
if (dialogBossStart[i] == dialogID) {
|
||||
seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60);
|
||||
play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_BOSS), 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogRaceSound); i++) {
|
||||
if (dialogRaceSound[i] == dialogID && gDialogLineNum == 1) {
|
||||
play_race_fanfare();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogStarSound); i++) {
|
||||
if (dialogStarSound[i] == dialogID && gDialogLineNum == 1) {
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStop); i++) {
|
||||
if (dialogBossStop[i] == dialogID) {
|
||||
seq_player_fade_out(SEQ_PLAYER_LEVEL, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s16 gMenuMode = -1;
|
||||
|
||||
u8 gEndCutsceneStrEn0[] = { TEXT_FILE_MARIO_EXCLAMATION };
|
||||
|
@ -2039,10 +2091,15 @@ void render_dialog_entries(void) {
|
|||
#else
|
||||
u32 scissorHeight = ensure_nonnegative(240 + ((dialog->linesPerBox * 80) / DIAG_VAL4) - dialog->width);
|
||||
#endif
|
||||
u32 scissorY = ensure_nonnegative(DIAG_VAL2 - dialog->width);
|
||||
if (gOverrideDialogPos) {
|
||||
scissorHeight = ensure_nonnegative(((dialog->linesPerBox * 80) / DIAG_VAL4) + gDialogOverrideY + 5);
|
||||
scissorY = ensure_nonnegative(gDialogOverrideY + 5);
|
||||
}
|
||||
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE,
|
||||
0,
|
||||
ensure_nonnegative(DIAG_VAL2 - dialog->width),
|
||||
scissorY,
|
||||
SCREEN_WIDTH,
|
||||
scissorHeight);
|
||||
#if defined(VERSION_JP)
|
||||
|
@ -3582,3 +3639,33 @@ s16 render_menus_and_dialogs(void) {
|
|||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
void set_min_dialog_width(s16 width) {
|
||||
gDialogMinWidth = width;
|
||||
}
|
||||
|
||||
void set_dialog_override_pos(s16 x, s16 y) {
|
||||
gOverrideDialogPos = 1;
|
||||
gDialogOverrideX = x;
|
||||
gDialogOverrideY = y;
|
||||
}
|
||||
|
||||
void reset_dialog_override_pos() {
|
||||
gOverrideDialogPos = 0;
|
||||
}
|
||||
|
||||
void set_dialog_override_color(u8 bgR, u8 bgG, u8 bgB, u8 bgA, u8 textR, u8 textG, u8 textB, u8 textA) {
|
||||
gOverrideDialogColor = 1;
|
||||
gDialogBgColorR = bgR;
|
||||
gDialogBgColorG = bgG;
|
||||
gDialogBgColorB = bgB;
|
||||
gDialogBgColorA = bgA;
|
||||
gDialogTextColorR = textR;
|
||||
gDialogTextColorG = textG;
|
||||
gDialogTextColorB = textB;
|
||||
gDialogTextColorA = textA;
|
||||
}
|
||||
|
||||
void reset_dialog_override_color() {
|
||||
gOverrideDialogColor = 0;
|
||||
}
|
|
@ -115,6 +115,20 @@ extern s32 gDialogVariable;
|
|||
extern u16 gDialogTextAlpha;
|
||||
extern s16 gCutsceneMsgXOffset;
|
||||
extern s16 gCutsceneMsgYOffset;
|
||||
extern s16 gDialogMinWidth;
|
||||
extern s16 gDialogMinHeight;
|
||||
extern s16 gDialogOverrideX;
|
||||
extern s16 gDialogOverrideY;
|
||||
extern u8 gOverrideDialogPos;
|
||||
extern u8 gOverrideDialogColor;
|
||||
extern u8 gDialogBgColorR;
|
||||
extern u8 gDialogBgColorG;
|
||||
extern u8 gDialogBgColorB;
|
||||
extern u8 gDialogBgColorA;
|
||||
extern u8 gDialogTextColorR;
|
||||
extern u8 gDialogTextColorG;
|
||||
extern u8 gDialogTextColorB;
|
||||
extern u8 gDialogTextColorA;
|
||||
|
||||
void create_dl_identity_matrix(void);
|
||||
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
|
||||
|
@ -160,5 +174,10 @@ void render_hud_cannon_reticle(void);
|
|||
void reset_red_coins_collected(void);
|
||||
s16 render_menus_and_dialogs(void);
|
||||
void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z);
|
||||
void set_min_dialog_width(s16 width);
|
||||
void set_dialog_override_pos(s16 x, s16 y);
|
||||
void reset_dialog_override_pos();
|
||||
void set_dialog_override_color(u8 bgR, u8 bgG, u8 bgB, u8 bgA, u8 textR, u8 textG, u8 textB, u8 textA);
|
||||
void reset_dialog_override_color();
|
||||
|
||||
#endif // INGAME_MENU_H
|
||||
|
|
|
@ -2934,7 +2934,8 @@ char gSmluaConstants[] = ""
|
|||
"HOOK_BEFORE_SET_MARIO_ACTION = 30\n"
|
||||
"HOOK_JOINED_GAME = 31\n"
|
||||
"HOOK_ON_OBJECT_ANIM_UPDATE = 32\n"
|
||||
"HOOK_MAX = 33\n"
|
||||
"HOOK_ON_DIALOG = 33\n"
|
||||
"HOOK_MAX = 34\n"
|
||||
"ACTION_HOOK_EVERY_FRAME = 0\n"
|
||||
"ACTION_HOOK_GRAVITY = 1\n"
|
||||
"ACTION_HOOK_MAX = 2\n"
|
||||
|
@ -4039,4 +4040,4 @@ char gSmluaConstants[] = ""
|
|||
"VERSION_REGION = 'US'\n"
|
||||
"MAX_VERSION_LENGTH = 32\n"
|
||||
"MAX_LOCAL_VERSION_LENGTH = 36\n"
|
||||
;
|
||||
;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "src/game/level_update.h"
|
||||
#include "src/game/area.h"
|
||||
#include "src/engine/level_script.h"
|
||||
#include "src/game/ingame_menu.h"
|
||||
|
||||
|
||||
////////////
|
||||
|
@ -13033,6 +13034,107 @@ int smlua_func_stop_sounds_in_continuous_banks(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// ingame_menu.h //
|
||||
///////////////////
|
||||
|
||||
int smlua_func_reset_dialog_override_color(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_dialog_override_color", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
reset_dialog_override_color();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_reset_dialog_override_pos(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_dialog_override_pos", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
reset_dialog_override_pos();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_dialog_override_color(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 8) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_dialog_override_color", 8, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 bgR = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_dialog_override_color"); return 0; }
|
||||
u8 bgG = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_dialog_override_color"); return 0; }
|
||||
u8 bgB = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_dialog_override_color"); return 0; }
|
||||
u8 bgA = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_dialog_override_color"); return 0; }
|
||||
u8 textR = smlua_to_integer(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "set_dialog_override_color"); return 0; }
|
||||
u8 textG = smlua_to_integer(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "set_dialog_override_color"); return 0; }
|
||||
u8 textB = smlua_to_integer(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "set_dialog_override_color"); return 0; }
|
||||
u8 textA = smlua_to_integer(L, 8);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "set_dialog_override_color"); return 0; }
|
||||
|
||||
set_dialog_override_color(bgR, bgG, bgB, bgA, textR, textG, textB, textA);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_dialog_override_pos(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_dialog_override_pos", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s16 x = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_dialog_override_pos"); return 0; }
|
||||
s16 y = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_dialog_override_pos"); return 0; }
|
||||
|
||||
set_dialog_override_pos(x, y);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_min_dialog_width(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_min_dialog_width", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s16 width = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_min_dialog_width"); return 0; }
|
||||
|
||||
set_min_dialog_width(width);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// interaction.h //
|
||||
///////////////////
|
||||
|
@ -31065,6 +31167,13 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "stop_sounds_from_source", smlua_func_stop_sounds_from_source);
|
||||
smlua_bind_function(L, "stop_sounds_in_continuous_banks", smlua_func_stop_sounds_in_continuous_banks);
|
||||
|
||||
// ingame_menu.h
|
||||
smlua_bind_function(L, "reset_dialog_override_color", smlua_func_reset_dialog_override_color);
|
||||
smlua_bind_function(L, "reset_dialog_override_pos", smlua_func_reset_dialog_override_pos);
|
||||
smlua_bind_function(L, "set_dialog_override_color", smlua_func_set_dialog_override_color);
|
||||
smlua_bind_function(L, "set_dialog_override_pos", smlua_func_set_dialog_override_pos);
|
||||
smlua_bind_function(L, "set_min_dialog_width", smlua_func_set_min_dialog_width);
|
||||
|
||||
// interaction.h
|
||||
smlua_bind_function(L, "determine_interaction", smlua_func_determine_interaction);
|
||||
smlua_bind_function(L, "does_mario_have_normal_cap_on_head", smlua_func_does_mario_have_normal_cap_on_head);
|
||||
|
|
|
@ -44,6 +44,7 @@ enum LuaHookedEventType {
|
|||
HOOK_BEFORE_SET_MARIO_ACTION,
|
||||
HOOK_JOINED_GAME,
|
||||
HOOK_ON_OBJECT_ANIM_UPDATE,
|
||||
HOOK_ON_DIALOG,
|
||||
HOOK_MAX,
|
||||
};
|
||||
|
||||
|
@ -81,6 +82,7 @@ static const char* LuaHookedEventTypeName[] = {
|
|||
"HOOK_BEFORE_SET_MARIO_ACTION",
|
||||
"HOOK_JOINED_GAME",
|
||||
"HOOK_ON_OBJECT_ANIM_UPDATE",
|
||||
"HOOK_ON_DIALOG",
|
||||
"HOOK_MAX"
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "game/object_helpers.h"
|
||||
#include "game/level_geo.h"
|
||||
#include "menu/intro_geo.h"
|
||||
#include "game/ingame_menu.h"
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
#include "pc/discord/discord.h"
|
||||
|
@ -652,6 +653,9 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
gMarioStates[0].cap = 0;
|
||||
extern s16 gTTCSpeedSetting;
|
||||
gTTCSpeedSetting = 0;
|
||||
gOverrideDialogPos = 0;
|
||||
gOverrideDialogColor = 0;
|
||||
gDialogMinWidth = 0;
|
||||
|
||||
struct Controller* cnt = gMarioStates[0].controller;
|
||||
cnt->rawStickX = 0;
|
||||
|
|
Loading…
Reference in New Issue