diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 469d5893..84078962 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -3250,7 +3250,10 @@ FONT_MENU = 1 FONT_HUD = 2 --- @type DjuiFontType -FONT_COUNT = 3 +FONT_TINY = 3 + +--- @type DjuiFontType +FONT_COUNT = 4 --- @class HudUtilsResolution diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 1465c5c9..bf1d15bd 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5614,6 +5614,17 @@ function network_player_from_global_index(globalIndex) -- ... end +--- @return nil +function network_player_local_restore_lag_state() + -- ... +end + +--- @param otherNp NetworkPlayer +--- @return nil +function network_player_local_set_lag_state(otherNp) + -- ... +end + --- @param np NetworkPlayer --- @param part PlayerParts --- @param out Color diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 2b459602..694dbd5f 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -709,6 +709,7 @@ --- @field public angleVel Vec3s --- @field public animation MarioAnimation --- @field public area Area +--- @field public bounceSquishTimer integer --- @field public bubbleObj Object --- @field public cap integer --- @field public capTimer integer diff --git a/bin/custom_font.c b/bin/custom_font.c index c4e05876..8748fca3 100644 --- a/bin/custom_font.c +++ b/bin/custom_font.c @@ -49,6 +49,29 @@ const f32 font_title_widths[] = { ////////////////////////////////////////////////////////// +ALIGNED8 const u8 texture_font_tiny[] = { +#include "textures/custom_font/custom_font_tiny.rgba32.inc.c" +}; + +const f32 font_tiny_widths[] = { +/* ! " # $ % & ' ( ) * + , - . / */ + 0.3125f, 0.3750f, 0.4375f, 0.3750f, 0.4375f, 0.5000f, 0.2500f, 0.3125f, 0.3125f, 0.3750f, 0.4375f, 0.2500f, 0.3750f, 0.2500f, 0.3125f, +/* 0 1 2 3 4 5 6 7 8 9 */ + 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, +/* : ; < = > ? @ */ + 0.2500f, 0.2500f, 0.3125f, 0.3750f, 0.3125f, 0.4375f, 0.5750f, +/* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z */ + 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.3125f, 0.5000f, 0.5000f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.5000f, 0.4375f, 0.3750f, 0.3750f, +/* [ \ ] ^ _ ` */ + 0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3750f, 0.2500f, +/* a b c d e f g h i j k l m n o p q r s t u v w x y z */ + 0.3750f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.2500f, 0.3125f, 0.3125f, 0.1875f, 0.4375f, 0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.4375f, 0.4375f, 0.3125f, 0.3125f, +/* { | } ~ DEL */ + 0.3125f, 0.2500f, 0.3125f, 0.5000f, 0.5000f +}; + +////////////////////////////////////////////////////////// + ALIGNED8 u8 texture_selectionbox_icon[] = { #include "textures/segment2/custom_selectionbox_icon.rgba16.inc.c" }; diff --git a/data/dynos_mgr_builtin_tex.cpp b/data/dynos_mgr_builtin_tex.cpp index 8d33dfbe..b804e894 100644 --- a/data/dynos_mgr_builtin_tex.cpp +++ b/data/dynos_mgr_builtin_tex.cpp @@ -10,6 +10,7 @@ extern "C" { extern ALIGNED8 const u8 texture_font_normal[]; extern ALIGNED8 const u8 texture_font_title[]; +extern ALIGNED8 const u8 texture_font_tiny[]; #define define_builtin_tex(_ptr, _path, _width, _height, _bitSize) { (const char*)#_ptr, (const void*)_ptr, (const char*)_path, _width, _height, _bitSize } #define define_builtin_tex_(_ptr, _path, _width, _height, _bitSize) { (const char*)#_ptr "_", (const void*)_ptr, (const char*)_path, _width, _height, _bitSize } @@ -1693,6 +1694,7 @@ static const struct BuiltinTexInfo sDynosBuiltinTexs[] = { // Fonts define_builtin_tex(texture_font_normal, "textures/custom_font/custom_font_normal.rgba32.png", 512, 256, 32), define_builtin_tex(texture_font_title, "textures/custom_font/custom_font_title.rgba32.png", 1024, 512, 32), + define_builtin_tex(texture_font_tiny, "textures/custom_font/custom_font_tiny.rgba32.png", 256, 128, 32), }; const Texture* DynOS_Builtin_Tex_GetFromName(const char* aDataName) { diff --git a/docs/lua/constants.md b/docs/lua/constants.md index ee22998f..839127cf 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -1089,7 +1089,8 @@ | FONT_NORMAL | 0 | | FONT_MENU | 1 | | FONT_HUD | 2 | -| FONT_COUNT | 3 | +| FONT_TINY | 3 | +| FONT_COUNT | 4 | ### [enum HudUtilsResolution](#HudUtilsResolution) | Identifier | Value | diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 7b86c458..d4a98321 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -8186,6 +8186,44 @@
+## [network_player_local_restore_lag_state](#network_player_local_restore_lag_state) + +### Lua Example +`network_player_local_restore_lag_state()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void network_player_local_restore_lag_state(void);` + +[:arrow_up_small:](#) + +
+ +## [network_player_local_set_lag_state](#network_player_local_set_lag_state) + +### Lua Example +`network_player_local_set_lag_state(otherNp)` + +### Parameters +| Field | Type | +| ----- | ---- | +| otherNp | [NetworkPlayer](structs.md#NetworkPlayer) | + +### Returns +- None + +### C Prototype +`void network_player_local_set_lag_state(struct NetworkPlayer* otherNp);` + +[:arrow_up_small:](#) + +
+ ## [network_player_palette_to_color](#network_player_palette_to_color) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 13868490..6e32ac9f 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1085,6 +1085,8 @@ - [network_player_color_to_palette](functions-3.md#network_player_color_to_palette) - [network_player_connected_count](functions-3.md#network_player_connected_count) - [network_player_from_global_index](functions-3.md#network_player_from_global_index) + - [network_player_local_restore_lag_state](functions-3.md#network_player_local_restore_lag_state) + - [network_player_local_set_lag_state](functions-3.md#network_player_local_set_lag_state) - [network_player_palette_to_color](functions-3.md#network_player_palette_to_color) - [network_player_set_description](functions-3.md#network_player_set_description) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 828074fe..6f77e822 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -1035,6 +1035,7 @@ | angleVel | [Vec3s](structs.md#Vec3s) | read-only | | animation | [MarioAnimation](structs.md#MarioAnimation) | | | area | [Area](structs.md#Area) | | +| bounceSquishTimer | `integer` | | | bubbleObj | [Object](structs.md#Object) | | | cap | `integer` | | | capTimer | `integer` | | diff --git a/src/pc/djui/djui_font.c b/src/pc/djui/djui_font.c index bc96207b..cb9a0cd4 100644 --- a/src/pc/djui/djui_font.c +++ b/src/pc/djui/djui_font.c @@ -126,6 +126,38 @@ static const struct DjuiFont sDjuiFontHud = { .char_width = djui_font_hud_char_width, }; + ///////////////////////////////// + // font 4 (built-in tiny font) // +///////////////////////////////// + +static void djui_font_tiny_render_char(char* c) { + // replace undisplayable characters + if (*c == ' ') { return; } + + u32 index = djui_unicode_get_sprite_index(c); + u32 tx = index % 32; + u32 ty = index / 32; + + extern ALIGNED8 const u8 texture_font_tiny[]; + djui_gfx_render_texture_tile(texture_font_tiny, 256, 128, 32, tx * 8, ty * 16, 8, 16); +} + +static f32 djui_font_tiny_char_width(char* c) { + if (*c == ' ') { return 0.30f; } + extern const f32 font_tiny_widths[]; + return djui_unicode_get_sprite_width(c, font_tiny_widths); +} + +static const struct DjuiFont sDjuiFontTiny = { + .charWidth = 0.5f, + .charHeight = 1.0f, + .lineHeight = 0.8125f, + .defaultFontScale = 16.0f, + .textBeginDisplayList = NULL, + .render_char = djui_font_tiny_render_char, + .char_width = djui_font_tiny_char_width, +}; + /////////////// // font list // /////////////// @@ -134,4 +166,5 @@ const struct DjuiFont* gDjuiFonts[] = { &sDjuiFontNormal, &sDjuiFontTitle, &sDjuiFontHud, + &sDjuiFontTiny, }; \ No newline at end of file diff --git a/src/pc/djui/djui_hud_utils.h b/src/pc/djui/djui_hud_utils.h index a82cbec9..9b73a4da 100644 --- a/src/pc/djui/djui_hud_utils.h +++ b/src/pc/djui/djui_hud_utils.h @@ -11,6 +11,7 @@ enum DjuiFontType { FONT_NORMAL, FONT_MENU, FONT_HUD, + FONT_TINY, FONT_COUNT, }; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index ff015aab..bc121b77 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -811,7 +811,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO { "wingFlutter", LVT_S8, offsetof(struct MarioBodyState, wingFlutter), false, LOT_NONE }, }; -#define LUA_MARIO_STATE_FIELD_COUNT 77 +#define LUA_MARIO_STATE_FIELD_COUNT 78 static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "action", LVT_U32, offsetof(struct MarioState, action), false, LOT_NONE }, { "actionArg", LVT_U32, offsetof(struct MarioState, actionArg), false, LOT_NONE }, @@ -820,6 +820,7 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "angleVel", LVT_COBJECT, offsetof(struct MarioState, angleVel), true, LOT_VEC3S }, { "animation", LVT_COBJECT_P, offsetof(struct MarioState, animation), false, LOT_MARIOANIMATION }, { "area", LVT_COBJECT_P, offsetof(struct MarioState, area), false, LOT_AREA }, + { "bounceSquishTimer", LVT_U8, offsetof(struct MarioState, bounceSquishTimer), false, LOT_NONE }, { "bubbleObj", LVT_COBJECT_P, offsetof(struct MarioState, bubbleObj), false, LOT_OBJECT }, { "cap", LVT_U32, offsetof(struct MarioState, cap), false, LOT_NONE }, { "capTimer", LVT_U16, offsetof(struct MarioState, capTimer), false, LOT_NONE }, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index f2dd71f4..bf6469a6 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1277,7 +1277,8 @@ char gSmluaConstants[] = "" "FONT_NORMAL = 0\n" "FONT_MENU = 1\n" "FONT_HUD = 2\n" -"FONT_COUNT = 3\n" +"FONT_TINY = 3\n" +"FONT_COUNT = 4\n" "ENVFX_MODE_NONE = 0\n" "ENVFX_SNOW_NORMAL = 1\n" "ENVFX_SNOW_WATER = 2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 97f445e8..8a3b549a 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -18659,6 +18659,38 @@ int smlua_func_network_player_from_global_index(lua_State* L) { return 1; } +int smlua_func_network_player_local_restore_lag_state(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", "network_player_local_restore_lag_state", 0, top); + return 0; + } + + + network_player_local_restore_lag_state(); + + return 1; +} + +int smlua_func_network_player_local_set_lag_state(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", "network_player_local_set_lag_state", 1, top); + return 0; + } + + struct NetworkPlayer* otherNp = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_local_set_lag_state"); return 0; } + + network_player_local_set_lag_state(otherNp); + + return 1; +} + int smlua_func_network_player_palette_to_color(lua_State* L) { if (L == NULL) { return 0; } @@ -30142,6 +30174,8 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "network_player_color_to_palette", smlua_func_network_player_color_to_palette); smlua_bind_function(L, "network_player_connected_count", smlua_func_network_player_connected_count); smlua_bind_function(L, "network_player_from_global_index", smlua_func_network_player_from_global_index); + smlua_bind_function(L, "network_player_local_restore_lag_state", smlua_func_network_player_local_restore_lag_state); + smlua_bind_function(L, "network_player_local_set_lag_state", smlua_func_network_player_local_set_lag_state); smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color); smlua_bind_function(L, "network_player_set_description", smlua_func_network_player_set_description); diff --git a/textures/custom_font/custom_font_tiny.rgba32.png b/textures/custom_font/custom_font_tiny.rgba32.png new file mode 100644 index 00000000..43e8a70f Binary files /dev/null and b/textures/custom_font/custom_font_tiny.rgba32.png differ