From 565e8b6367ccb386b6aa4721261b4ab7ee4852a9 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:44:29 -0400 Subject: [PATCH] DJUI fixes and changes --- src/game/mario_actions_cutscene.c | 2 +- src/game/rumble_init.c | 3 +- src/pc/djui/djui.c | 14 +++--- src/pc/djui/djui.h | 1 - src/pc/djui/djui_gfx.c | 1 + src/pc/djui/djui_panel_changelog.c | 63 +++------------------------ src/pc/djui/djui_panel_info.c | 2 +- src/pc/djui/djui_panel_join_lobbies.c | 4 +- src/pc/djui/djui_panel_rules.c | 7 ++- src/pc/djui/djui_text.c | 8 ++-- src/pc/lua/smlua.c | 2 +- src/pc/network/coopnet/coopnet.c | 9 ---- src/pc/network/packets/packet_join.c | 2 - src/pc/network/version.c | 10 +++++ src/pc/network/version.h | 7 +-- 15 files changed, 44 insertions(+), 91 deletions(-) diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index b234fd3d..3d8d9e27 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -1886,7 +1886,7 @@ s32 act_taking_off_cap(struct MarioState *m) { s16 animFrame = set_character_animation(m, CHAR_ANIM_TAKE_CAP_OFF_THEN_ON); switch (animFrame) { case 0: - if (!gCamera->paletteEditorCap) { + if (gCamera->cutscene != CUTSCENE_PALETTE_EDITOR) { enable_time_stop_if_alone(); } break; diff --git a/src/game/rumble_init.c b/src/game/rumble_init.c index d779c2f9..9236597a 100644 --- a/src/game/rumble_init.c +++ b/src/game/rumble_init.c @@ -5,6 +5,7 @@ #include "main.h" #include "rumble_init.h" #include "object_helpers.h" +#include "pc/djui/djui.h" s8 D_SH_8031D8F8[0x60]; @@ -135,7 +136,7 @@ static void update_rumble_data_queue(void) { } void queue_rumble_data(s16 a0, s16 a1) { - if (gCurrDemoInput != NULL) { + if (gCurrDemoInput != NULL || gDjuiInMainMenu) { return; } diff --git a/src/pc/djui/djui.c b/src/pc/djui/djui.c index 69913d6f..c5e5d072 100644 --- a/src/pc/djui/djui.c +++ b/src/pc/djui/djui.c @@ -21,7 +21,7 @@ static Gfx* sSavedDisplayListHead = NULL; struct DjuiRoot* gDjuiRoot = NULL; static struct DjuiText* sDjuiPauseOptions = NULL; static struct DjuiText* sDjuiLuaError = NULL; -u32 gDjuiLuaErrorTimeout = 0; +static u32 sDjuiLuaErrorTimeout = 0; bool gDjuiInMainMenu = true; bool gDjuiDisabled = false; bool gDjuiShuttingDown = false; @@ -38,7 +38,7 @@ void djui_shutdown(void) { if (sDjuiLuaError) djui_base_destroy(&sDjuiLuaError->base); sDjuiPauseOptions = NULL; sDjuiLuaError = NULL; - gDjuiLuaErrorTimeout = 0; + sDjuiLuaErrorTimeout = 0; if (gDjuiConsole) { djui_base_destroy(&gDjuiConsole->base); @@ -107,7 +107,7 @@ void djui_init_late(void) { gPanelLanguageOnStartup = true; djui_panel_language_create(NULL); } - if (strcmp(configLastVersion, get_version())) { + if (true) { // strcmp(configLastVersion, get_version())) { snprintf(configLastVersion, MAX_CONFIG_STRING, "%s", get_version()); djui_panel_changelog_create(NULL); } @@ -129,7 +129,7 @@ void djui_lua_error(char* text, struct DjuiColor color) { djui_base_set_color(&sDjuiLuaError->base, color.r, color.g, color.b, color.a); djui_text_set_text(sDjuiLuaError, text); djui_base_set_visible(&sDjuiLuaError->base, true); - gDjuiLuaErrorTimeout = 30 * 5; + sDjuiLuaErrorTimeout = 30 * 5; } void djui_reset_hud_params(void) { @@ -163,9 +163,9 @@ void djui_render(void) { djui_fps_display_render(); - if (gDjuiLuaErrorTimeout > 0) { - gDjuiLuaErrorTimeout--; - if (gDjuiLuaErrorTimeout == 0) { + if (sDjuiLuaErrorTimeout > 0) { + sDjuiLuaErrorTimeout--; + if (sDjuiLuaErrorTimeout == 0) { djui_base_set_visible(&sDjuiLuaError->base, false); } } diff --git a/src/pc/djui/djui.h b/src/pc/djui/djui.h index 1d651d59..a3dca5cf 100644 --- a/src/pc/djui/djui.h +++ b/src/pc/djui/djui.h @@ -39,7 +39,6 @@ extern struct DjuiRoot* gDjuiRoot; extern bool gDjuiInMainMenu; extern bool gDjuiDisabled; -extern u32 gDjuiLuaErrorTimeout; void djui_init(void); void djui_init_late(void); diff --git a/src/pc/djui/djui_gfx.c b/src/pc/djui/djui_gfx.c index 9b6a18a6..cf0b8e4c 100644 --- a/src/pc/djui/djui_gfx.c +++ b/src/pc/djui/djui_gfx.c @@ -65,6 +65,7 @@ f32 djui_gfx_get_scale(void) { } } } + ///////////////////////////////////////////// static const Vtx vertex_djui_image[] = { diff --git a/src/pc/djui/djui_panel_changelog.c b/src/pc/djui/djui_panel_changelog.c index c17727fe..6b449bbc 100644 --- a/src/pc/djui/djui_panel_changelog.c +++ b/src/pc/djui/djui_panel_changelog.c @@ -2,7 +2,9 @@ #include "djui_panel.h" #include "djui_panel_menu.h" -static char sChangelog[5][1024]; +#define PAGE_COUNT 1 + +static char sChangelog[PAGE_COUNT][1024]; void djui_panel_changelog_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(CHANGELOG, CHANGELOG_TITLE)); @@ -12,64 +14,9 @@ void djui_panel_changelog_create(struct DjuiBase* caller) { struct DjuiPaginated* paginated = djui_paginated_create(body, 1); struct DjuiBase* layoutBase = &paginated->layout->base; - snprintf(sChangelog[0], 1024, "Welcome back! - \\#ffff00\\v0.2\\#dcdcdc\\:\n\ -\n\ -\\#ffff00\\Changes:\\#dcdcdc\\\n\ -Added an update checker to notify people of new updates\n\ -Made the version on the main menu always the sm64coopdx version\n\ -Added over 40 missing gfx symbols to the DynOS parser\n\ -Increased object pool capacity from 960 to 1200\n\ -Made Mario & Luigi cap emblems use the shirt color\n\ -Moved changelog to the info panel\n\ -Added a properly implemented vanilla singleplayer pause\n\ -Restored the vanilla pause menu red coin display if there are 8\n\ -Restored vanilla camera zoom out with singleplayer\n\ -Forced DynOS and player panels to be uncentered"); - snprintf(sChangelog[1], 1024, "Made the light & dark theme panel backgrounds slightly less opaque\n\ -Disabled any vertex rounding when generating DynOS actors\n\ -Added option to only apply DynOS playermodels onto the local player\n\ -Made dirt particle vertex colorable\n\ -Allowed players to bounce on mid air players' heads\n\ -Made recovery hearts only heal the last person who touched it\n\ -Partially rewrote launch parameter code\n\ -Added --hide-loading-screen param\n\ -Increased vertical tilt range and disabled tilt centering while sliding for free cam"); - snprintf(sChangelog[2], 1024, "\\#ffff00\\Fixes:\\#dcdcdc\\\n\ -\n\ -Fixed console not being openable from the main menu\n\ -Fixed interpolated rectangles using the wrong resolution\n\ -Fixed SDL2 linux compositor with X11\n\ -Fixed memory leak with custom animations that caused strange glitches\n\ -Fixed sm64coopdx exclusive features still working when hosting sm64ex-coop servers\n\ -Fixed a bizzare bug with perfect frame pausing causing you to go to seemingly random warp nodes\n\ -Fixed 1 player lobbies saying 'Waiting for players...'\n\ -Fixed the --help launch parameter not outputting anything\n\ -Fixed --server jank by basically rewriting how it works"); - snprintf(sChangelog[3], 1024, "Fixed the mouse disappearing forever on the window after closing the chat\n\ -Fixed the bugs with transitions such as delays, not being able to pause, flashing, playing repeatedly\n\ -Fixed inconsistent capitalization on the loading screen\n\ -Fixed the cake screen cutting off and returning to the entry level too early\n\ -Fixed hoot having invisible wings\n\ -\n\ -\\#ffff00\\Lua API Changes:\\#dcdcdc\\\n\ -Added the ability to have global star IDs\n\ -Added the ability to not show star collection dialogs\n\ -Allowed FONT_HUD to have texture filtering\n\ -Added the ability to change window title\n\ -Added the ability to get the global timer\n\ -Added get and set functions for the HUD star flash"); - snprintf(sChangelog[4], 1024, "Added HUD_DISPLAY_CAMERA_STATUS for hud_get_value()\n\ -Exposed level_control_timer_running() to check if the timer is running\n\ -Raised max BASS audio files from 128 to 256\n\ -Added '-- pausable' field so mods can mark themselves as being able to function when the game is paused in singleplayer\n\ -Added OBJ_LIST_EXT for Lua mods to use just in case\n\ -\n\ -\\#ffff00\\Mod Changes:\\#dcdcdc\\\n\ -Updated Character Select to v1.7\n\ -Updated Toadette's model in [CS] Extra Characters\n\ -Updated Arena and added Blimp City, new music for levels and fixed KOTH, Rainbow Road collision and level lighting direction"); + snprintf(sChangelog[0], 1024, "Hi! This is Gabe Newell, welcome to sm64coopdx %s. If you have downloaded this build and do not come from the sm64coopdx v1.0 Testing Thread, please delete it and inform agentxlp.", SM64COOPDX_VERSION); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < PAGE_COUNT; i++) { struct DjuiText* text = djui_text_create(layoutBase, sChangelog[i]); djui_base_set_location(&text->base, 0, 0); djui_base_set_size(&text->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 360); diff --git a/src/pc/djui/djui_panel_info.c b/src/pc/djui/djui_panel_info.c index 93f0d5ef..b0c5c828 100644 --- a/src/pc/djui/djui_panel_info.c +++ b/src/pc/djui/djui_panel_info.c @@ -17,7 +17,7 @@ More features, customization, and power to the Lua API allow modders and players struct DjuiText* text = djui_text_create(body, sInfo); djui_base_set_location(&text->base, 0, 0); - djui_base_set_size(&text->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 220); + djui_base_set_size(&text->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 300); djui_base_set_color(&text->base, 220, 220, 220, 255); djui_text_set_drop_shadow(text, 64, 64, 64, 100); djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER); diff --git a/src/pc/djui/djui_panel_join_lobbies.c b/src/pc/djui/djui_panel_join_lobbies.c index d4e20e48..869346db 100644 --- a/src/pc/djui/djui_panel_join_lobbies.c +++ b/src/pc/djui/djui_panel_join_lobbies.c @@ -87,7 +87,7 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t snprintf(mode, 64, "%s", aMode); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); if (strcmp(version, aVersion) != 0) { snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion); } @@ -167,7 +167,7 @@ void djui_panel_join_lobbies_create(struct DjuiBase* caller, const char* passwor djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER); } - djui_button_create(body, DLANG(RULES, RULES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_rules_create); + if (!private) { djui_button_create(body, DLANG(RULES, RULES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_rules_create); } struct DjuiRect* rect2 = djui_rect_container_create(body, 64); { diff --git a/src/pc/djui/djui_panel_rules.c b/src/pc/djui/djui_panel_rules.c index dccd46fa..2de91cf5 100644 --- a/src/pc/djui/djui_panel_rules.c +++ b/src/pc/djui/djui_panel_rules.c @@ -8,6 +8,11 @@ #ifdef COOPNET static char sRules[512]; +static void djui_panel_rules_deny(struct DjuiBase* caller) { + configRulesVersion = 0; + djui_panel_menu_back(caller); +} + static void djui_panel_rules_accept(struct DjuiBase* caller) { configRulesVersion = RULES_VERSION; djui_panel_join_lobbies_create(caller, ""); @@ -52,7 +57,7 @@ DLANG(RULES, RULE_5)); struct DjuiRect* rect = djui_rect_container_create(body, 64); { - djui_button_left_create(&rect->base, DLANG(MENU, NO), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); + djui_button_left_create(&rect->base, DLANG(MENU, NO), DJUI_BUTTON_STYLE_BACK, djui_panel_rules_deny); djui_button_right_create(&rect->base, DLANG(MENU, YES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_rules_accept); } } else { diff --git a/src/pc/djui/djui_text.c b/src/pc/djui/djui_text.c index 3ee795ee..48f362aa 100644 --- a/src/pc/djui/djui_text.c +++ b/src/pc/djui/djui_text.c @@ -239,7 +239,7 @@ static char* djui_text_render_line_parse_escape(char* c1, char* c2) { sSavedR = (r << 4) | r; sSavedG = (g << 4) | g; sSavedB = (b << 4) | b; - } else if (colorPieces == 4) { + /*} else if (colorPieces == 4) { u32 r = (color >> 12) & 0xF; u32 g = (color >> 8) & 0xF; u32 b = (color >> 4) & 0xF; @@ -247,17 +247,17 @@ static char* djui_text_render_line_parse_escape(char* c1, char* c2) { sSavedR = (r << 4) | r; sSavedG = (g << 4) | g; sSavedB = (b << 4) | b; - sSavedA = (a << 4) | a; + sSavedA = (a << 4) | a;*/ } else if (colorPieces == 6) { sSavedR = ((color >> 16) & 0xFF); sSavedG = ((color >> 8) & 0xFF); sSavedB = ((color >> 0) & 0xFF); - } else if (colorPieces == 8) { + }/*else if (colorPieces == 8) { sSavedR = ((color >> 24) & 0xFF); sSavedG = ((color >> 16) & 0xFF); sSavedB = ((color >> 8) & 0xFF); sSavedA = ((color >> 0) & 0xFF); - } + }*/ gDPSetEnvColor(gDisplayListHead++, sSavedR, sSavedG, sSavedB, sSavedA); } diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index b5703995..9c7bf39e 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -34,7 +34,7 @@ void smlua_mod_warning(void) { if (mod == NULL) { return; } if (mod->ignoreScriptWarnings) { return; } char txt[255] = { 0 }; - snprintf(txt, 254, "'%s\\#ffe600\\' is using deprecated functions!", mod->name); + snprintf(txt, 254, "'%s\\#ffe600\\' has script warnings!", mod->name); static const struct DjuiColor color = { 255, 230, 0, 255 }; djui_lua_error(txt, color); } diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index 1d89029d..2ec98d5f 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -17,15 +17,6 @@ // to let other players know the update is out #undef GAME_NAME #define GAME_NAME "sm64ex-coop" -static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; -const char* get_version_online(void) { -#if defined(VERSION_US) - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, VERSION_NUMBER); -#else - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d %s", VERSION_TEXT, VERSION_NUMBER, VERSION_REGION); -#endif - return sVersionString; -} #ifdef COOPNET diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 2f7fa473..857c8936 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -118,7 +118,6 @@ void network_send_join(struct Packet* joinRequestPacket) { packet_write(&p, &gServerSettings.playerKnockbackStrength, sizeof(u8)); packet_write(&p, &gServerSettings.stayInLevelAfterStar, sizeof(u8)); packet_write(&p, &gServerSettings.skipIntro, sizeof(u8)); - packet_write(&p, &gServerSettings.enableCheats, sizeof(u8)); packet_write(&p, &gServerSettings.bubbleDeath, sizeof(u8)); packet_write(&p, &gServerSettings.headlessServer, sizeof(u8)); packet_write(&p, &gServerSettings.nametags, sizeof(u8)); @@ -171,7 +170,6 @@ void network_receive_join(struct Packet* p) { packet_read(p, &gServerSettings.playerKnockbackStrength, sizeof(u8)); packet_read(p, &gServerSettings.stayInLevelAfterStar, sizeof(u8)); packet_read(p, &gServerSettings.skipIntro, sizeof(u8)); - packet_read(p, &gServerSettings.enableCheats, sizeof(u8)); packet_read(p, &gServerSettings.bubbleDeath, sizeof(u8)); packet_read(p, &gServerSettings.headlessServer, sizeof(u8)); packet_read(p, &gServerSettings.nametags, sizeof(u8)); diff --git a/src/pc/network/version.c b/src/pc/network/version.c index b655ee0f..0b61a520 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -3,6 +3,7 @@ #include "types.h" static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; +static char sOnlineVersionString[MAX_VERSION_LENGTH] = { 0 }; const char* get_version(void) { #if defined(VERSION_US) @@ -12,3 +13,12 @@ const char* get_version(void) { #endif return sVersionString; } + +const char* get_version_online(void) { +#if defined(VERSION_US) + snprintf(sOnlineVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, VERSION_NUMBER); +#else + snprintf(sOnlineVersionString, MAX_VERSION_LENGTH, "%s%d %s", VERSION_TEXT, VERSION_NUMBER, VERSION_REGION); +#endif + return sOnlineVersionString; +} diff --git a/src/pc/network/version.h b/src/pc/network/version.h index ddd2708b..68c70344 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -1,9 +1,9 @@ #ifndef VERSION_H #define VERSION_H -#define SM64COOPDX_VERSION "v1.0" +#define SM64COOPDX_VERSION "Prerelease 2" -// sm64ex-coop version, for mod compatibility +// internal version #define VERSION_TEXT "v" #define VERSION_NUMBER 37 #define MINOR_VERSION_NUMBER 0 @@ -24,11 +24,12 @@ #elif !defined(VERSION_US) #define GAME_NAME "sm64coopdx-intl" #else - #define GAME_NAME "sm64coopdx" + #define GAME_NAME "sm64coopdx-TESTING" #endif #define MAX_VERSION_LENGTH 32 const char* get_version(void); +const char* get_version_online(void); #endif