diff --git a/src/pc/chat_commands.c b/src/pc/chat_commands.c index f7b33df1..df498d7d 100644 --- a/src/pc/chat_commands.c +++ b/src/pc/chat_commands.c @@ -226,7 +226,7 @@ bool exec_chat_command(char* command) { return true; } -#if defined(DEBUG) && defined(DEVELOPMENT) +#if defined(DEVELOPMENT) if (gNetworkSystem == &gNetworkSystemSocket && str_starts_with("/warp ", command)) { static const struct { const char *name; s32 num; } sLevelNumByName[] = { #undef STUB_LEVEL @@ -325,7 +325,7 @@ void display_chat_commands(void) { djui_chat_message_create("/permban [NAME|ID] - Ban this player from any game you host"); djui_chat_message_create("/moderator [NAME|ID] - Make this player able to use commands like /kick, /ban, /permban on any game you host"); } -#if defined(DEBUG) && defined(DEVELOPMENT) +#if defined(DEVELOPMENT) djui_chat_message_create("/warp [LEVEL] [AREA] [ACT] - Level can be either a numeric value or a shorthand name"); #endif if (sConfirming != CCC_NONE) { djui_chat_message_create("/confirm"); } diff --git a/src/pc/cliopts.c b/src/pc/cliopts.c index 5b337fa7..720d7a8e 100644 --- a/src/pc/cliopts.c +++ b/src/pc/cliopts.c @@ -61,10 +61,14 @@ void parse_cli_opts(int argc, char* argv[]) { gCLIOpts.Network = NT_SERVER; arg_uint("--server ", argv[++i], &gCLIOpts.NetworkPort); - } else if (strcmp(argv[i], "--client") == 0 && (i + 2) < argc) { // Join server + } else if (strcmp(argv[i], "--client") == 0 && (((i + 1) < argc) || (i + 2) < argc)) { // Join server gCLIOpts.Network = NT_CLIENT; arg_string("--client ", argv[++i], gCLIOpts.JoinIp, IP_MAX_LEN); - arg_uint("--client ", argv[++i], &gCLIOpts.NetworkPort); + if ((i + 2) < argc) { + arg_uint("--client ", argv[++i], &gCLIOpts.NetworkPort); + } else { + gCLIOpts.NetworkPort = 7777; + } } else if (strcmp(argv[i], "--cheats") == 0) // Enable cheats menu Cheats.enabled = true; diff --git a/src/pc/controller/controller_keyboard.c b/src/pc/controller/controller_keyboard.c index 4a3665d4..d5129cc4 100644 --- a/src/pc/controller/controller_keyboard.c +++ b/src/pc/controller/controller_keyboard.c @@ -34,7 +34,7 @@ static int keyboard_map_scancode(int scancode) { } bool keyboard_on_key_down(int scancode) { -#ifdef DEBUG +#ifdef DEVELOPMENT debug_keyboard_on_key_down(scancode); #endif @@ -51,7 +51,7 @@ bool keyboard_on_key_down(int scancode) { } bool keyboard_on_key_up(int scancode) { -#ifdef DEBUG +#ifdef DEVELOPMENT debug_keyboard_on_key_up(scancode); #endif djui_interactable_on_key_up(scancode); diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index 7054876a..72c7d130 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -11,7 +11,7 @@ #include "behavior_data.h" #include "behavior_table.h" -#ifdef DEBUG +#ifdef DEVELOPMENT #include "pc/lua/smlua.h" #include "pc/network/socket/socket.h" @@ -99,7 +99,6 @@ void debug_keyboard_on_key_down(int scancode) { case SCANCODE_ALT: sHoldingAlt = true; break; case SCANCODE_SHIFT: sHoldingShift = true; break; case SCANCODE_3: debug_breakpoint_here(); break; -#ifdef DEVELOPMENT case SCANCODE_1: if (sHoldingAlt) { debug_warp_level1(); } break; case SCANCODE_2: if (sHoldingAlt) { debug_warp_level2(); } break; case SCANCODE_4: if (sHoldingAlt) { debug_warp_level3(); } break; @@ -107,7 +106,6 @@ void debug_keyboard_on_key_down(int scancode) { case SCANCODE_9: if (sHoldingAlt) { debug_warp_to(); } break; case SCANCODE_0: if (sHoldingAlt) { debug_suicide(); } break; case SCANCODE_F5: debug_reload_lua(); break; -#endif } } } diff --git a/src/pc/controller/controller_keyboard_debug.h b/src/pc/controller/controller_keyboard_debug.h index 99735458..7fe5dcdb 100644 --- a/src/pc/controller/controller_keyboard_debug.h +++ b/src/pc/controller/controller_keyboard_debug.h @@ -1,6 +1,6 @@ #ifndef CONTROLLER_KEYBOARD_DEBUG_H #define CONTROLLER_KEYBOARD_DEBUG_H -#ifdef DEBUG +#ifdef DEVELOPMENT void debug_keyboard_on_key_down(int scancode); void debug_keyboard_on_key_up(int scancode); diff --git a/src/pc/djui/djui_font.c b/src/pc/djui/djui_font.c index 68a0b907..82de7989 100644 --- a/src/pc/djui/djui_font.c +++ b/src/pc/djui/djui_font.c @@ -123,7 +123,8 @@ static void djui_font_hud_render_char(char c) { djui_gfx_render_texture(main_hud_lut[index], 16, 16, 16); } -static f32 djui_font_hud_char_width(UNUSED char c) { +static f32 djui_font_hud_char_width(char c) { + if (c == ' ') { return 0.5; } return 0.75f; } diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index f1c4ec5a..b2a2b459 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -47,6 +47,7 @@ #include "pc/discord/discordrpc.h" #endif #include "pc/network/version.h" +#include "pc/network/socket/socket.h" #include "pc/network/network_player.h" #include "pc/djui/djui.h" #include "pc/debuglog.h" @@ -352,7 +353,8 @@ void main_func(void) { if (gCLIOpts.Network == NT_CLIENT) { network_set_system(NS_SOCKET); - strncpy(configJoinIp, gCLIOpts.JoinIp, IP_MAX_LEN); + snprintf(gGetHostName, MAX_CONFIG_STRING, "%s", gCLIOpts.JoinIp); + snprintf(configJoinIp, MAX_CONFIG_STRING, "%s", gCLIOpts.JoinIp); configJoinPort = gCLIOpts.NetworkPort; network_init(NT_CLIENT); } else if (gCLIOpts.Network == NT_SERVER) {