diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index c11aaeea..93ab667e 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -3718,6 +3718,14 @@ function djui_hud_set_resolution(resolutionType)
-- ...
end
+--- @param rotation integer
+--- @param pivotX number
+--- @param pivotY number
+--- @return nil
+function djui_hud_set_rotation(rotation, pivotX, pivotY)
+ -- ...
+end
+
--- @param pos Vec3f
--- @param out Vec3f
--- @return nil
diff --git a/data/dynos_mgr_builtin_externs.h b/data/dynos_mgr_builtin_externs.h
index 740a5af9..fd780ec5 100644
--- a/data/dynos_mgr_builtin_externs.h
+++ b/data/dynos_mgr_builtin_externs.h
@@ -1592,6 +1592,30 @@ extern ALIGNED8 const Texture wmotr_seg7_texture_07000800[];
extern ALIGNED8 const Texture wmotr_seg7_texture_07000C00[];
extern ALIGNED8 const Texture wmotr_seg7_texture_07001400[];
extern ALIGNED8 const Texture wmotr_seg7_texture_07001600[];
+extern ALIGNED8 Texture gd_texture_hand_open[];
+extern ALIGNED8 Texture gd_texture_hand_closed[];
+extern ALIGNED8 Texture gd_texture_red_star_0[];
+extern ALIGNED8 Texture gd_texture_red_star_1[];
+extern ALIGNED8 Texture gd_texture_red_star_2[];
+extern ALIGNED8 Texture gd_texture_red_star_3[];
+extern ALIGNED8 Texture gd_texture_red_star_4[];
+extern ALIGNED8 Texture gd_texture_red_star_5[];
+extern ALIGNED8 Texture gd_texture_red_star_6[];
+extern ALIGNED8 Texture gd_texture_red_star_7[];
+extern ALIGNED8 Texture gd_texture_white_star_0[];
+extern ALIGNED8 Texture gd_texture_white_star_1[];
+extern ALIGNED8 Texture gd_texture_white_star_2[];
+extern ALIGNED8 Texture gd_texture_white_star_3[];
+extern ALIGNED8 Texture gd_texture_white_star_4[];
+extern ALIGNED8 Texture gd_texture_white_star_5[];
+extern ALIGNED8 Texture gd_texture_white_star_6[];
+extern ALIGNED8 Texture gd_texture_white_star_7[];
+extern ALIGNED8 Texture gd_texture_sparkle_0[];
+extern ALIGNED8 Texture gd_texture_sparkle_1[];
+extern ALIGNED8 Texture gd_texture_sparkle_2[];
+extern ALIGNED8 Texture gd_texture_sparkle_3[];
+extern ALIGNED8 Texture gd_texture_sparkle_4[];
+extern ALIGNED8 Texture gd_texture_sparkle_5[];
extern ALIGNED8 const Texture mario_texture_metal[];
extern ALIGNED8 const Texture mario_texture_yellow_button[];
diff --git a/data/dynos_mgr_builtin_tex.cpp b/data/dynos_mgr_builtin_tex.cpp
index b804e894..1d97577f 100644
--- a/data/dynos_mgr_builtin_tex.cpp
+++ b/data/dynos_mgr_builtin_tex.cpp
@@ -1695,6 +1695,32 @@ static const struct BuiltinTexInfo sDynosBuiltinTexs[] = {
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),
+
+ // Goddard
+ define_builtin_tex(gd_texture_hand_open, "textures/intro_raw/hand_open.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_hand_closed, "textures/intro_raw/hand_closed.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_0, "textures/intro_raw/red_star_0.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_1, "textures/intro_raw/red_star_1.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_2, "textures/intro_raw/red_star_2.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_3, "textures/intro_raw/red_star_3.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_4, "textures/intro_raw/red_star_4.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_5, "textures/intro_raw/red_star_5.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_6, "textures/intro_raw/red_star_6.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_red_star_7, "textures/intro_raw/red_star_7.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_0, "textures/intro_raw/white_star_0.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_1, "textures/intro_raw/white_star_1.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_2, "textures/intro_raw/white_star_2.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_3, "textures/intro_raw/white_star_3.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_4, "textures/intro_raw/white_star_4.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_5, "textures/intro_raw/white_star_5.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_6, "textures/intro_raw/white_star_6.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_white_star_7, "textures/intro_raw/white_star_7.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_0, "textures/intro_raw/sparkle_0.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_1, "textures/intro_raw/sparkle_1.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_2, "textures/intro_raw/sparkle_2.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_3, "textures/intro_raw/sparkle_3.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_4, "textures/intro_raw/sparkle_4.rgba16.png", 32, 32, 16),
+ define_builtin_tex(gd_texture_sparkle_5, "textures/intro_raw/sparkle_5.rgba16.png", 32, 32, 16),
};
const Texture* DynOS_Builtin_Tex_GetFromName(const char* aDataName) {
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index 1051bd4e..a163d824 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -2357,6 +2357,28 @@
+## [djui_hud_set_rotation](#djui_hud_set_rotation)
+
+### Lua Example
+`djui_hud_set_rotation(rotation, pivotX, pivotY)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| rotation | `integer` |
+| pivotX | `number` |
+| pivotY | `number` |
+
+### Returns
+- None
+
+### C Prototype
+`void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY);`
+
+[:arrow_up_small:](#)
+
+
+
## [djui_hud_world_pos_to_screen_pos](#djui_hud_world_pos_to_screen_pos)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 32f7d1c7..283ae7aa 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -731,6 +731,7 @@
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
- [djui_hud_set_render_behind_hud](functions-3.md#djui_hud_set_render_behind_hud)
- [djui_hud_set_resolution](functions-3.md#djui_hud_set_resolution)
+ - [djui_hud_set_rotation](functions-3.md#djui_hud_set_rotation)
- [djui_hud_world_pos_to_screen_pos](functions-3.md#djui_hud_world_pos_to_screen_pos)
diff --git a/src/game/behaviors/recovery_heart.inc.c b/src/game/behaviors/recovery_heart.inc.c
index ef312b5d..1dcb0de6 100644
--- a/src/game/behaviors/recovery_heart.inc.c
+++ b/src/game/behaviors/recovery_heart.inc.c
@@ -27,7 +27,7 @@ void bhv_recovery_heart_loop(void) {
o->oSpinningHeartPlayedSound += 1;
}
- struct MarioState* marioState = nearest_mario_state_to_object(o);
+ struct MarioState* marioState = nearest_interacting_mario_state_to_object(o);
if (marioState) {
o->oAngleVelYaw = (s32)(200.0f * marioState->forwardVel) + 1000;
}
@@ -42,11 +42,11 @@ void bhv_recovery_heart_loop(void) {
if ((o->oSpinningHeartTotalSpin += o->oAngleVelYaw) >= 0x10000) {
- struct MarioState* nearestState = nearest_mario_state_to_object(o);
+ struct MarioState* nearestInteractingState = nearest_interacting_mario_state_to_object(o);
for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!gMarioStates[i].visibleToEnemies) { continue; }
if (!is_player_active(&gMarioStates[i])) { continue; }
- if (&gMarioStates[i] == nearestState || dist_between_objects(o, gMarioStates[i].marioObj) < 1000) {
+ if (&gMarioStates[i] == nearestInteractingState || dist_between_objects(o, gMarioStates[i].marioObj) < 1000) {
gMarioStates[i].healCounter += 4;
}
}
diff --git a/src/game/ingame_menu.h b/src/game/ingame_menu.h
index cd4c30db..05185add 100644
--- a/src/game/ingame_menu.h
+++ b/src/game/ingame_menu.h
@@ -118,6 +118,7 @@ extern s16 gCutsceneMsgYOffset;
void create_dl_identity_matrix(void);
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
+void create_dl_rotation_matrix(s8 pushOp, f32 a, f32 x, f32 y, f32 z);
void create_dl_ortho_matrix(void);
void render_generic_char(u8 c);
u8 str_ascii_char_to_dialog(char c);
diff --git a/src/goddard/renderer.c b/src/goddard/renderer.c
index 933095ef..be356bee 100644
--- a/src/goddard/renderer.c
+++ b/src/goddard/renderer.c
@@ -238,67 +238,67 @@ ALIGNED8 Texture gd_texture_hand_closed[] = {
#include "textures/intro_raw/hand_closed.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_0[] = {
+ALIGNED8 Texture gd_texture_red_star_0[] = {
#include "textures/intro_raw/red_star_0.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_1[] = {
+ALIGNED8 Texture gd_texture_red_star_1[] = {
#include "textures/intro_raw/red_star_1.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_2[] = {
+ALIGNED8 Texture gd_texture_red_star_2[] = {
#include "textures/intro_raw/red_star_2.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_3[] = {
+ALIGNED8 Texture gd_texture_red_star_3[] = {
#include "textures/intro_raw/red_star_3.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_4[] = {
+ALIGNED8 Texture gd_texture_red_star_4[] = {
#include "textures/intro_raw/red_star_4.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_5[] = {
+ALIGNED8 Texture gd_texture_red_star_5[] = {
#include "textures/intro_raw/red_star_5.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_6[] = {
+ALIGNED8 Texture gd_texture_red_star_6[] = {
#include "textures/intro_raw/red_star_6.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_red_star_7[] = {
+ALIGNED8 Texture gd_texture_red_star_7[] = {
#include "textures/intro_raw/red_star_7.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_0[] = {
+ALIGNED8 Texture gd_texture_white_star_0[] = {
#include "textures/intro_raw/white_star_0.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_1[] = {
+ALIGNED8 Texture gd_texture_white_star_1[] = {
#include "textures/intro_raw/white_star_1.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_2[] = {
+ALIGNED8 Texture gd_texture_white_star_2[] = {
#include "textures/intro_raw/white_star_2.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_3[] = {
+ALIGNED8 Texture gd_texture_white_star_3[] = {
#include "textures/intro_raw/white_star_3.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_4[] = {
+ALIGNED8 Texture gd_texture_white_star_4[] = {
#include "textures/intro_raw/white_star_4.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_5[] = {
+ALIGNED8 Texture gd_texture_white_star_5[] = {
#include "textures/intro_raw/white_star_5.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_6[] = {
+ALIGNED8 Texture gd_texture_white_star_6[] = {
#include "textures/intro_raw/white_star_6.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_white_star_7[] = {
+ALIGNED8 Texture gd_texture_white_star_7[] = {
#include "textures/intro_raw/white_star_7.rgba16.inc.c"
};
@@ -469,30 +469,30 @@ static Gfx *gd_silver_star_dl_array[] = {
gd_dl_silver_star_7,
};
-ALIGNED8 static Texture gd_texture_sparkle_0[] = {
+ALIGNED8 Texture gd_texture_sparkle_0[] = {
#include "textures/intro_raw/sparkle_0.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_sparkle_1[] = {
+ALIGNED8 Texture gd_texture_sparkle_1[] = {
#include "textures/intro_raw/sparkle_1.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_sparkle_2[] = {
+ALIGNED8 Texture gd_texture_sparkle_2[] = {
#include "textures/intro_raw/sparkle_2.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_sparkle_3[] = {
+ALIGNED8 Texture gd_texture_sparkle_3[] = {
#include "textures/intro_raw/sparkle_3.rgba16.inc.c"
};
-ALIGNED8 static Texture gd_texture_sparkle_4[] = {
+ALIGNED8 Texture gd_texture_sparkle_4[] = {
#include "textures/intro_raw/sparkle_4.rgba16.inc.c"
};
//! No reference to this texture. Two DL's uses the same previous texture
// instead of using this texture.
// Fixed via setting TEXTURE_FIX to 1.
-ALIGNED8 static Texture gd_texture_sparkle_5[] = {
+ALIGNED8 Texture gd_texture_sparkle_5[] = {
#include "textures/intro_raw/sparkle_5.rgba16.inc.c"
};
diff --git a/src/pc/djui/djui_hud_utils.c b/src/pc/djui/djui_hud_utils.c
index 9c7d2fd3..13c1b914 100644
--- a/src/pc/djui/djui_hud_utils.c
+++ b/src/pc/djui/djui_hud_utils.c
@@ -23,6 +23,7 @@
static enum HudUtilsResolution sResolution = RESOLUTION_DJUI;
static enum DjuiFontType sFont = FONT_NORMAL;
+static struct { f32 rotation; f32 pivotX; f32 pivotY; } sRotation = { 0, 0, 0 };
f32 gDjuiHudUtilsZ = 0;
u8 gDjuiHudLockMouse = false;
@@ -152,6 +153,12 @@ void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a) {
gDPSetEnvColor(gDisplayListHead++, r, g, b, a);
}
+void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY) {
+ sRotation.rotation = (rotation * 180.f) / 0x8000;
+ sRotation.pivotX = pivotX;
+ sRotation.pivotY = pivotY;
+}
+
u32 djui_hud_get_screen_width(void) {
u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight);
@@ -268,11 +275,20 @@ void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32
djui_hud_position_translate(&translatedX, &translatedY);
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
- // translate scale
+ // rotate
f32 translatedW = scaleW;
f32 translatedH = scaleH;
djui_hud_size_translate(&translatedW);
djui_hud_size_translate(&translatedH);
+ if (sRotation.rotation != 0) {
+ f32 pivotTranslationX = width * translatedW * sRotation.pivotX;
+ f32 pivotTranslationY = height * translatedH * sRotation.pivotY;
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
+ create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
+ }
+
+ // translate scale
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
// render
@@ -293,11 +309,21 @@ void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width,
djui_hud_position_translate(&translatedX, &translatedY);
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
- // translate scale
+ // rotate
f32 translatedW = scaleW;
f32 translatedH = scaleH;
djui_hud_size_translate(&translatedW);
djui_hud_size_translate(&translatedH);
+ if (sRotation.rotation != 0) {
+ f32 aspect = tileH ? ((f32) tileW / (f32) tileH) : 1.f;
+ f32 pivotTranslationX = width * translatedW * aspect * sRotation.pivotX;
+ f32 pivotTranslationY = height * translatedH * sRotation.pivotY;
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
+ create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
+ }
+
+ // translate scale
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
// render
@@ -369,11 +395,20 @@ void djui_hud_render_rect(f32 x, f32 y, f32 width, f32 height) {
djui_hud_position_translate(&translatedX, &translatedY);
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
- // translate scale
+ // rotate
f32 translatedW = width;
f32 translatedH = height;
djui_hud_size_translate(&translatedW);
djui_hud_size_translate(&translatedH);
+ if (sRotation.rotation != 0) {
+ f32 pivotTranslationX = translatedW * sRotation.pivotX;
+ f32 pivotTranslationY = translatedH * sRotation.pivotY;
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
+ create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
+ create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
+ }
+
+ // translate scale
create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedW, translatedH, 1.0f);
// render
diff --git a/src/pc/djui/djui_hud_utils.h b/src/pc/djui/djui_hud_utils.h
index 9b73a4da..fcb8bd07 100644
--- a/src/pc/djui/djui_hud_utils.h
+++ b/src/pc/djui/djui_hud_utils.h
@@ -39,6 +39,7 @@ extern u8 gDjuiHudLockMouse;
void djui_hud_set_resolution(enum HudUtilsResolution resolutionType);
void djui_hud_set_font(enum DjuiFontType fontType);
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a);
+void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY);
u32 djui_hud_get_screen_width(void);
u32 djui_hud_get_screen_height(void);
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 803203ff..642b6691 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -11771,6 +11771,27 @@ int smlua_func_djui_hud_set_resolution(lua_State* L) {
return 1;
}
+int smlua_func_djui_hud_set_rotation(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 3) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_rotation", 3, top);
+ return 0;
+ }
+
+ s16 rotation = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_rotation"); return 0; }
+ f32 pivotX = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_set_rotation"); return 0; }
+ f32 pivotY = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_set_rotation"); return 0; }
+
+ djui_hud_set_rotation(rotation, pivotX, pivotY);
+
+ return 1;
+}
+
int smlua_func_djui_hud_world_pos_to_screen_pos(lua_State* L) {
if (L == NULL) { return 0; }
@@ -29889,6 +29910,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
smlua_bind_function(L, "djui_hud_set_resolution", smlua_func_djui_hud_set_resolution);
+ smlua_bind_function(L, "djui_hud_set_rotation", smlua_func_djui_hud_set_rotation);
smlua_bind_function(L, "djui_hud_world_pos_to_screen_pos", smlua_func_djui_hud_world_pos_to_screen_pos);
// djui_popup.h