mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Made nametags mod interpolate names and health
This commit is contained in:
parent
a216b9c2d9
commit
f2a8df7728
14 changed files with 346 additions and 18 deletions
|
@ -343,7 +343,13 @@ INSTANT_WARP_INDEX_START = 0x00
|
||||||
INSTANT_WARP_INDEX_STOP = 0x04
|
INSTANT_WARP_INDEX_STOP = 0x04
|
||||||
|
|
||||||
--- @type integer
|
--- @type integer
|
||||||
MAX_LOADED_GRAPH_NODES = 0x100
|
LOADED_GRAPH_NODES_EXTENDED = 512
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
LOADED_GRAPH_NODES_VANILLA = 256
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
MAX_LOADED_GRAPH_NODES = (LOADED_GRAPH_NODES_VANILLA + LOADED_GRAPH_NODES_EXTENDED)
|
||||||
|
|
||||||
--- @type integer
|
--- @type integer
|
||||||
WARP_TRANSITION_FADE_FROM_BOWSER = 0x12
|
WARP_TRANSITION_FADE_FROM_BOWSER = 0x12
|
||||||
|
|
|
@ -3663,6 +3663,18 @@ function djui_hud_print_text(message, x, y, scale)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param message string
|
||||||
|
--- @param prevX number
|
||||||
|
--- @param prevY number
|
||||||
|
--- @param prevScale number
|
||||||
|
--- @param x number
|
||||||
|
--- @param y number
|
||||||
|
--- @param scale number
|
||||||
|
--- @return nil
|
||||||
|
function djui_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param x number
|
--- @param x number
|
||||||
--- @param y number
|
--- @param y number
|
||||||
--- @param width number
|
--- @param width number
|
||||||
|
@ -3685,6 +3697,11 @@ function djui_hud_render_rect_interpolated(prevX, prevY, prevWidth, prevHeight,
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @return nil
|
||||||
|
function djui_hud_reset_color()
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param r integer
|
--- @param r integer
|
||||||
--- @param g integer
|
--- @param g integer
|
||||||
--- @param b integer
|
--- @param b integer
|
||||||
|
@ -8418,6 +8435,20 @@ function hud_render_power_meter(health, x, y, width, height)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param health integer
|
||||||
|
--- @param prevX number
|
||||||
|
--- @param prevY number
|
||||||
|
--- @param prevWidth number
|
||||||
|
--- @param prevHeight number
|
||||||
|
--- @param x number
|
||||||
|
--- @param y number
|
||||||
|
--- @param width number
|
||||||
|
--- @param height number
|
||||||
|
--- @return nil
|
||||||
|
function hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, prevHeight, x, y, width, height)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param type HudDisplayValue
|
--- @param type HudDisplayValue
|
||||||
--- @param value integer
|
--- @param value integer
|
||||||
--- @return nil
|
--- @return nil
|
||||||
|
|
|
@ -70,6 +70,8 @@
|
||||||
## [area.h](#area.h)
|
## [area.h](#area.h)
|
||||||
- INSTANT_WARP_INDEX_START
|
- INSTANT_WARP_INDEX_START
|
||||||
- INSTANT_WARP_INDEX_STOP
|
- INSTANT_WARP_INDEX_STOP
|
||||||
|
- LOADED_GRAPH_NODES_EXTENDED
|
||||||
|
- LOADED_GRAPH_NODES_VANILLA
|
||||||
- MAX_LOADED_GRAPH_NODES
|
- MAX_LOADED_GRAPH_NODES
|
||||||
- WARP_TRANSITION_FADE_FROM_BOWSER
|
- WARP_TRANSITION_FADE_FROM_BOWSER
|
||||||
- WARP_TRANSITION_FADE_FROM_CIRCLE
|
- WARP_TRANSITION_FADE_FROM_CIRCLE
|
||||||
|
|
|
@ -2198,7 +2198,33 @@
|
||||||
- None
|
- None
|
||||||
|
|
||||||
### C Prototype
|
### C Prototype
|
||||||
`void djui_hud_print_text(const char* message, float x, float y, float scale);`
|
`void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [djui_hud_print_text_interpolated](#djui_hud_print_text_interpolated)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`djui_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| message | `string` |
|
||||||
|
| prevX | `number` |
|
||||||
|
| prevY | `number` |
|
||||||
|
| prevScale | `number` |
|
||||||
|
| x | `number` |
|
||||||
|
| y | `number` |
|
||||||
|
| scale | `number` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale);`
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
@ -2254,6 +2280,24 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [djui_hud_reset_color](#djui_hud_reset_color)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`djui_hud_reset_color()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void djui_hud_reset_color(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [djui_hud_set_color](#djui_hud_set_color)
|
## [djui_hud_set_color](#djui_hud_set_color)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
|
|
|
@ -8553,6 +8553,34 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [hud_render_power_meter_interpolated](#hud_render_power_meter_interpolated)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, prevHeight, x, y, width, height)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| health | `integer` |
|
||||||
|
| prevX | `number` |
|
||||||
|
| prevY | `number` |
|
||||||
|
| prevWidth | `number` |
|
||||||
|
| prevHeight | `number` |
|
||||||
|
| x | `number` |
|
||||||
|
| y | `number` |
|
||||||
|
| width | `number` |
|
||||||
|
| height | `number` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [hud_set_value](#hud_set_value)
|
## [hud_set_value](#hud_set_value)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
|
|
|
@ -724,8 +724,10 @@
|
||||||
- [djui_hud_is_pause_menu_created](functions-3.md#djui_hud_is_pause_menu_created)
|
- [djui_hud_is_pause_menu_created](functions-3.md#djui_hud_is_pause_menu_created)
|
||||||
- [djui_hud_measure_text](functions-3.md#djui_hud_measure_text)
|
- [djui_hud_measure_text](functions-3.md#djui_hud_measure_text)
|
||||||
- [djui_hud_print_text](functions-3.md#djui_hud_print_text)
|
- [djui_hud_print_text](functions-3.md#djui_hud_print_text)
|
||||||
|
- [djui_hud_print_text_interpolated](functions-3.md#djui_hud_print_text_interpolated)
|
||||||
- [djui_hud_render_rect](functions-3.md#djui_hud_render_rect)
|
- [djui_hud_render_rect](functions-3.md#djui_hud_render_rect)
|
||||||
- [djui_hud_render_rect_interpolated](functions-3.md#djui_hud_render_rect_interpolated)
|
- [djui_hud_render_rect_interpolated](functions-3.md#djui_hud_render_rect_interpolated)
|
||||||
|
- [djui_hud_reset_color](functions-3.md#djui_hud_reset_color)
|
||||||
- [djui_hud_set_color](functions-3.md#djui_hud_set_color)
|
- [djui_hud_set_color](functions-3.md#djui_hud_set_color)
|
||||||
- [djui_hud_set_font](functions-3.md#djui_hud_set_font)
|
- [djui_hud_set_font](functions-3.md#djui_hud_set_font)
|
||||||
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
||||||
|
@ -1568,6 +1570,7 @@
|
||||||
- [hud_hide](functions-4.md#hud_hide)
|
- [hud_hide](functions-4.md#hud_hide)
|
||||||
- [hud_is_hidden](functions-4.md#hud_is_hidden)
|
- [hud_is_hidden](functions-4.md#hud_is_hidden)
|
||||||
- [hud_render_power_meter](functions-4.md#hud_render_power_meter)
|
- [hud_render_power_meter](functions-4.md#hud_render_power_meter)
|
||||||
|
- [hud_render_power_meter_interpolated](functions-4.md#hud_render_power_meter_interpolated)
|
||||||
- [hud_set_value](functions-4.md#hud_set_value)
|
- [hud_set_value](functions-4.md#hud_set_value)
|
||||||
- [hud_show](functions-4.md#hud_show)
|
- [hud_show](functions-4.md#hud_show)
|
||||||
- [is_game_paused](functions-4.md#is_game_paused)
|
- [is_game_paused](functions-4.md#is_game_paused)
|
||||||
|
|
|
@ -9,6 +9,17 @@ gGlobalSyncTable.health = true
|
||||||
|
|
||||||
showSelfTag = false
|
showSelfTag = false
|
||||||
|
|
||||||
|
gStateExtras = {}
|
||||||
|
for i = 0, (MAX_PLAYERS - 1) do
|
||||||
|
gStateExtras[i] = {}
|
||||||
|
local e = gStateExtras[i]
|
||||||
|
e.prevPos = {}
|
||||||
|
e.prevPos.x = 0
|
||||||
|
e.prevPos.y = 0
|
||||||
|
e.prevPos.z = 0
|
||||||
|
e.prevScale = 1
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in pairs(gActiveMods) do
|
for k, v in pairs(gActiveMods) do
|
||||||
local name = v.name:lower()
|
local name = v.name:lower()
|
||||||
if v.enabled and (name:find("hide") or name:find("hns") or name:find("hunt")) then
|
if v.enabled and (name:find("hide") or name:find("hns") or name:find("hunt")) then
|
||||||
|
@ -62,16 +73,19 @@ function djui_hud_set_adjusted_color(r, g, b, a)
|
||||||
djui_hud_set_color(r * multiplier, g * multiplier, b * multiplier, a)
|
djui_hud_set_color(r * multiplier, g * multiplier, b * multiplier, a)
|
||||||
end
|
end
|
||||||
|
|
||||||
function djui_hud_print_outlined_text(text, x, y, scale, r, g, b, a, outlineDarkness)
|
function djui_hud_print_outlined_text(text, prevx, prevy, prevscale, x, y, scale, r, g, b, a, outlineDarkness)
|
||||||
|
djui_hud_set_resolution(RESOLUTION_N64)
|
||||||
-- render outline
|
-- render outline
|
||||||
djui_hud_set_adjusted_color(r * outlineDarkness, g * outlineDarkness, b * outlineDarkness, a)
|
djui_hud_set_adjusted_color(r * outlineDarkness, g * outlineDarkness, b * outlineDarkness, a)
|
||||||
djui_hud_print_text(text, x - (1*(scale*2)), y, scale)
|
local offset = (1*(scale*2))
|
||||||
djui_hud_print_text(text, x + (1*(scale*2)), y, scale)
|
local prevoffset = (1*(prevscale*2))
|
||||||
djui_hud_print_text(text, x, y - (1*(scale*2)), scale)
|
djui_hud_print_text_interpolated(text, prevx - prevoffset, prevy, prevscale, x - offset, y, scale)
|
||||||
djui_hud_print_text(text, x, y + (1*(scale*2)), scale)
|
djui_hud_print_text_interpolated(text, prevx + prevoffset, prevy, prevscale, x + offset, y, scale)
|
||||||
|
djui_hud_print_text_interpolated(text, prevx, prevy - prevoffset, prevscale, x, y - offset, scale)
|
||||||
|
djui_hud_print_text_interpolated(text, prevx, prevy + prevoffset, prevscale, x, y + offset, scale)
|
||||||
-- render text
|
-- render text
|
||||||
djui_hud_set_adjusted_color(r, g, b, 255)
|
djui_hud_set_adjusted_color(r, g, b, 255)
|
||||||
djui_hud_print_text(text, x, y, scale)
|
djui_hud_print_text_interpolated(text, prevx, prevy, prevscale, x, y, scale)
|
||||||
djui_hud_set_color(255, 255, 255, 255)
|
djui_hud_set_color(255, 255, 255, 255)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -113,13 +127,24 @@ function on_hud_render()
|
||||||
network_player_palette_to_color(gNetworkPlayers[i], SHIRT, color)
|
network_player_palette_to_color(gNetworkPlayers[i], SHIRT, color)
|
||||||
local measure = djui_hud_measure_text(name) * scale * 0.5
|
local measure = djui_hud_measure_text(name) * scale * 0.5
|
||||||
local alpha = if_then_else(m.action ~= ACT_CROUCHING and m.action ~= ACT_START_CRAWLING and m.action ~= ACT_CRAWLING and m.action ~= ACT_STOP_CRAWLING, 255, 100)
|
local alpha = if_then_else(m.action ~= ACT_CROUCHING and m.action ~= ACT_START_CRAWLING and m.action ~= ACT_CRAWLING and m.action ~= ACT_STOP_CRAWLING, 255, 100)
|
||||||
djui_hud_print_outlined_text(name, out.x - measure, out.y, scale, color.r, color.g, color.b, alpha, 0.25)
|
|
||||||
|
local e = gStateExtras[i]
|
||||||
|
|
||||||
|
djui_hud_print_outlined_text(name, e.prevPos.x - measure, e.prevPos.y, e.prevScale, out.x - measure, out.y, scale, color.r, color.g, color.b, alpha, 0.25)
|
||||||
|
|
||||||
if m.playerIndex ~= 0 and gGlobalSyncTable.health then
|
if m.playerIndex ~= 0 and gGlobalSyncTable.health then
|
||||||
djui_hud_set_adjusted_color(255, 255, 255, alpha)
|
djui_hud_set_adjusted_color(255, 255, 255, alpha)
|
||||||
local healthScale = 75 * scale
|
local healthScale = 75 * scale
|
||||||
hud_render_power_meter(m.health, out.x - (healthScale * 0.5), out.y - healthScale, healthScale, healthScale)
|
local prevHealthScale = 75 * e.prevScale
|
||||||
|
hud_render_power_meter_interpolated(m.health,
|
||||||
|
e.prevPos.x - (prevHealthScale * 0.5), e.prevPos.y - prevHealthScale, prevHealthScale, prevHealthScale,
|
||||||
|
out.x - (healthScale * 0.5), out.y - healthScale, healthScale, healthScale)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
e.prevPos.x = out.x
|
||||||
|
e.prevPos.y = out.y
|
||||||
|
e.prevPos.z = out.z
|
||||||
|
e.prevScale = scale
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void djui_hud_size_translate(f32* size) {
|
||||||
// interp //
|
// interp //
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
#define MAX_INTERP_HUD 128
|
#define MAX_INTERP_HUD 512
|
||||||
struct InterpHud {
|
struct InterpHud {
|
||||||
Gfx* headPos;
|
Gfx* headPos;
|
||||||
f32 z;
|
f32 z;
|
||||||
|
@ -228,7 +228,7 @@ f32 djui_hud_measure_text(const char* message) {
|
||||||
return width * font->defaultFontScale;
|
return width * font->defaultFontScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_hud_print_text(const char* message, float x, float y, float scale) {
|
void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale) {
|
||||||
if (message == NULL) { return; }
|
if (message == NULL) { return; }
|
||||||
gDjuiHudUtilsZ += 0.01f;
|
gDjuiHudUtilsZ += 0.01f;
|
||||||
|
|
||||||
|
@ -275,6 +275,72 @@ void djui_hud_print_text(const char* message, float x, float y, float scale) {
|
||||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale) {
|
||||||
|
if (message == NULL) { return; }
|
||||||
|
f32 savedZ = gDjuiHudUtilsZ;
|
||||||
|
gDjuiHudUtilsZ += 0.01f;
|
||||||
|
|
||||||
|
const struct DjuiFont* font = gDjuiFonts[sFont];
|
||||||
|
f32 fontScale = font->defaultFontScale * scale;
|
||||||
|
|
||||||
|
// setup display list
|
||||||
|
if (font->textBeginDisplayList != NULL) {
|
||||||
|
gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gfx* savedHeadPos = gDisplayListHead;
|
||||||
|
|
||||||
|
// translate position
|
||||||
|
f32 translatedX = x;
|
||||||
|
f32 translatedY = y;
|
||||||
|
djui_hud_position_translate(&translatedX, &translatedY);
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
||||||
|
|
||||||
|
// compute font size
|
||||||
|
f32 translatedFontSize = fontScale;
|
||||||
|
djui_hud_size_translate(&translatedFontSize);
|
||||||
|
create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedFontSize, translatedFontSize, 1.0f);
|
||||||
|
|
||||||
|
// render the line
|
||||||
|
f32 addX = 0;
|
||||||
|
char* c = (char*)message;
|
||||||
|
while (*c != '\0') {
|
||||||
|
f32 charWidth = font->char_width(c);
|
||||||
|
|
||||||
|
if (*c == '\n' && *c == ' ') {
|
||||||
|
addX += charWidth;
|
||||||
|
c++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// render
|
||||||
|
font->render_char(c);
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, charWidth + addX, 0, 0);
|
||||||
|
addX = 0;
|
||||||
|
|
||||||
|
c = djui_unicode_next_char(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// pop
|
||||||
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
|
|
||||||
|
if (sInterpHudCount >= MAX_INTERP_HUD) { return; }
|
||||||
|
struct InterpHud* interp = &sInterpHuds[sInterpHudCount++];
|
||||||
|
interp->headPos = savedHeadPos;
|
||||||
|
interp->prevX = prevX;
|
||||||
|
interp->prevY = prevY;
|
||||||
|
interp->prevScaleW = prevScale;
|
||||||
|
interp->prevScaleH = prevScale;
|
||||||
|
interp->x = x;
|
||||||
|
interp->y = y;
|
||||||
|
interp->scaleW = scale;
|
||||||
|
interp->scaleH = scale;
|
||||||
|
interp->width = font->defaultFontScale;
|
||||||
|
interp->height = font->defaultFontScale;
|
||||||
|
interp->z = savedZ;
|
||||||
|
interp->resolution = sResolution;
|
||||||
|
}
|
||||||
|
|
||||||
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||||
gDjuiHudUtilsZ += 0.01f;
|
gDjuiHudUtilsZ += 0.01f;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ f32 djui_hud_get_raw_mouse_y(void);
|
||||||
void djui_hud_set_mouse_locked(bool locked);
|
void djui_hud_set_mouse_locked(bool locked);
|
||||||
|
|
||||||
f32 djui_hud_measure_text(const char* message);
|
f32 djui_hud_measure_text(const char* message);
|
||||||
void djui_hud_print_text(const char* message, float x, float y, float scale);
|
void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale);
|
||||||
|
void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale);
|
||||||
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||||
|
|
|
@ -1931,7 +1931,7 @@ static struct LuaObjectField sSpawnParticlesInfoFields[LUA_SPAWN_PARTICLES_INFO_
|
||||||
{ "forwardVelBase", LVT_S8, offsetof(struct SpawnParticlesInfo, forwardVelBase), false, LOT_NONE },
|
{ "forwardVelBase", LVT_S8, offsetof(struct SpawnParticlesInfo, forwardVelBase), false, LOT_NONE },
|
||||||
{ "forwardVelRange", LVT_S8, offsetof(struct SpawnParticlesInfo, forwardVelRange), false, LOT_NONE },
|
{ "forwardVelRange", LVT_S8, offsetof(struct SpawnParticlesInfo, forwardVelRange), false, LOT_NONE },
|
||||||
{ "gravity", LVT_S8, offsetof(struct SpawnParticlesInfo, gravity), false, LOT_NONE },
|
{ "gravity", LVT_S8, offsetof(struct SpawnParticlesInfo, gravity), false, LOT_NONE },
|
||||||
{ "model", LVT_U8, offsetof(struct SpawnParticlesInfo, model), true, LOT_NONE },
|
{ "model", LVT_U16, offsetof(struct SpawnParticlesInfo, model), true, LOT_NONE },
|
||||||
{ "offsetY", LVT_S8, offsetof(struct SpawnParticlesInfo, offsetY), false, LOT_NONE },
|
{ "offsetY", LVT_S8, offsetof(struct SpawnParticlesInfo, offsetY), false, LOT_NONE },
|
||||||
{ "sizeBase", LVT_F32, offsetof(struct SpawnParticlesInfo, sizeBase), false, LOT_NONE },
|
{ "sizeBase", LVT_F32, offsetof(struct SpawnParticlesInfo, sizeBase), false, LOT_NONE },
|
||||||
{ "sizeRange", LVT_F32, offsetof(struct SpawnParticlesInfo, sizeRange), false, LOT_NONE },
|
{ "sizeRange", LVT_F32, offsetof(struct SpawnParticlesInfo, sizeRange), false, LOT_NONE },
|
||||||
|
|
|
@ -307,7 +307,9 @@ char gSmluaConstants[] = ""
|
||||||
"COURSE_COUNT = 25\n"
|
"COURSE_COUNT = 25\n"
|
||||||
"--- @type integer\n"
|
"--- @type integer\n"
|
||||||
"COURSE_MIN = 1\n"
|
"COURSE_MIN = 1\n"
|
||||||
"MAX_LOADED_GRAPH_NODES = 0x100\n"
|
"LOADED_GRAPH_NODES_VANILLA = 256\n"
|
||||||
|
"LOADED_GRAPH_NODES_EXTENDED = 512\n"
|
||||||
|
"MAX_LOADED_GRAPH_NODES = (LOADED_GRAPH_NODES_VANILLA + LOADED_GRAPH_NODES_EXTENDED)\n"
|
||||||
"INSTANT_WARP_INDEX_START = 0x00\n"
|
"INSTANT_WARP_INDEX_START = 0x00\n"
|
||||||
"INSTANT_WARP_INDEX_STOP = 0x04\n"
|
"INSTANT_WARP_INDEX_STOP = 0x04\n"
|
||||||
"WARP_TRANSITION_FADE_FROM_COLOR = 0x00\n"
|
"WARP_TRANSITION_FADE_FROM_COLOR = 0x00\n"
|
||||||
|
|
|
@ -11614,11 +11614,11 @@ int smlua_func_djui_hud_print_text(lua_State* L) {
|
||||||
|
|
||||||
const char* message = smlua_to_string(L, 1);
|
const char* message = smlua_to_string(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_print_text"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_print_text"); return 0; }
|
||||||
float x = smlua_to_number(L, 2);
|
f32 x = smlua_to_number(L, 2);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_print_text"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_print_text"); return 0; }
|
||||||
float y = smlua_to_number(L, 3);
|
f32 y = smlua_to_number(L, 3);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_print_text"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_print_text"); return 0; }
|
||||||
float scale = smlua_to_number(L, 4);
|
f32 scale = smlua_to_number(L, 4);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_print_text"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_print_text"); return 0; }
|
||||||
|
|
||||||
djui_hud_print_text(message, x, y, scale);
|
djui_hud_print_text(message, x, y, scale);
|
||||||
|
@ -11626,6 +11626,35 @@ int smlua_func_djui_hud_print_text(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_djui_hud_print_text_interpolated(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 7) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_print_text_interpolated", 7, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* message = smlua_to_string(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 prevX = smlua_to_number(L, 2);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 prevY = smlua_to_number(L, 3);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 prevScale = smlua_to_number(L, 4);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 x = smlua_to_number(L, 5);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 y = smlua_to_number(L, 6);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
f32 scale = smlua_to_number(L, 7);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "djui_hud_print_text_interpolated"); return 0; }
|
||||||
|
|
||||||
|
djui_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_render_rect(lua_State* L) {
|
int smlua_func_djui_hud_render_rect(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -11680,6 +11709,21 @@ int smlua_func_djui_hud_render_rect_interpolated(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_djui_hud_reset_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", "djui_hud_reset_color", 0, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
djui_hud_reset_color();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_set_color(lua_State* L) {
|
int smlua_func_djui_hud_set_color(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -27427,6 +27471,39 @@ int smlua_func_hud_render_power_meter(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_hud_render_power_meter_interpolated(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 9) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_render_power_meter_interpolated", 9, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 health = smlua_to_integer(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 prevX = smlua_to_number(L, 2);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 prevY = smlua_to_number(L, 3);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 prevWidth = smlua_to_number(L, 4);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 prevHeight = smlua_to_number(L, 5);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 x = smlua_to_number(L, 6);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 y = smlua_to_number(L, 7);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 width = smlua_to_number(L, 8);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
f32 height = smlua_to_number(L, 9);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 9, "hud_render_power_meter_interpolated"); return 0; }
|
||||||
|
|
||||||
|
hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, prevHeight, x, y, width, height);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_hud_set_value(lua_State* L) {
|
int smlua_func_hud_set_value(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -29903,8 +29980,10 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "djui_hud_is_pause_menu_created", smlua_func_djui_hud_is_pause_menu_created);
|
smlua_bind_function(L, "djui_hud_is_pause_menu_created", smlua_func_djui_hud_is_pause_menu_created);
|
||||||
smlua_bind_function(L, "djui_hud_measure_text", smlua_func_djui_hud_measure_text);
|
smlua_bind_function(L, "djui_hud_measure_text", smlua_func_djui_hud_measure_text);
|
||||||
smlua_bind_function(L, "djui_hud_print_text", smlua_func_djui_hud_print_text);
|
smlua_bind_function(L, "djui_hud_print_text", smlua_func_djui_hud_print_text);
|
||||||
|
smlua_bind_function(L, "djui_hud_print_text_interpolated", smlua_func_djui_hud_print_text_interpolated);
|
||||||
smlua_bind_function(L, "djui_hud_render_rect", smlua_func_djui_hud_render_rect);
|
smlua_bind_function(L, "djui_hud_render_rect", smlua_func_djui_hud_render_rect);
|
||||||
smlua_bind_function(L, "djui_hud_render_rect_interpolated", smlua_func_djui_hud_render_rect_interpolated);
|
smlua_bind_function(L, "djui_hud_render_rect_interpolated", smlua_func_djui_hud_render_rect_interpolated);
|
||||||
|
smlua_bind_function(L, "djui_hud_reset_color", smlua_func_djui_hud_reset_color);
|
||||||
smlua_bind_function(L, "djui_hud_set_color", smlua_func_djui_hud_set_color);
|
smlua_bind_function(L, "djui_hud_set_color", smlua_func_djui_hud_set_color);
|
||||||
smlua_bind_function(L, "djui_hud_set_font", smlua_func_djui_hud_set_font);
|
smlua_bind_function(L, "djui_hud_set_font", smlua_func_djui_hud_set_font);
|
||||||
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
||||||
|
@ -30692,6 +30771,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "hud_hide", smlua_func_hud_hide);
|
smlua_bind_function(L, "hud_hide", smlua_func_hud_hide);
|
||||||
smlua_bind_function(L, "hud_is_hidden", smlua_func_hud_is_hidden);
|
smlua_bind_function(L, "hud_is_hidden", smlua_func_hud_is_hidden);
|
||||||
smlua_bind_function(L, "hud_render_power_meter", smlua_func_hud_render_power_meter);
|
smlua_bind_function(L, "hud_render_power_meter", smlua_func_hud_render_power_meter);
|
||||||
|
smlua_bind_function(L, "hud_render_power_meter_interpolated", smlua_func_hud_render_power_meter_interpolated);
|
||||||
smlua_bind_function(L, "hud_set_value", smlua_func_hud_set_value);
|
smlua_bind_function(L, "hud_set_value", smlua_func_hud_set_value);
|
||||||
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
|
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
|
||||||
smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused);
|
smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused);
|
||||||
|
|
|
@ -125,6 +125,45 @@ void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height) {
|
||||||
djui_hud_render_texture(&sPowerMeterTexturesInfo[numWedges + 1], x + width / 4, y + height / 4, width / 64, height / 64);
|
djui_hud_render_texture(&sPowerMeterTexturesInfo[numWedges + 1], x + width / 4, y + height / 4, width / 64, height / 64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height) {
|
||||||
|
extern const u8 texture_power_meter_left_side[];
|
||||||
|
extern const u8 texture_power_meter_right_side[];
|
||||||
|
extern const u8 texture_power_meter_full[];
|
||||||
|
extern const u8 texture_power_meter_seven_segments[];
|
||||||
|
extern const u8 texture_power_meter_six_segments[];
|
||||||
|
extern const u8 texture_power_meter_five_segments[];
|
||||||
|
extern const u8 texture_power_meter_four_segments[];
|
||||||
|
extern const u8 texture_power_meter_three_segments[];
|
||||||
|
extern const u8 texture_power_meter_two_segments[];
|
||||||
|
extern const u8 texture_power_meter_one_segments[];
|
||||||
|
static struct TextureInfo sPowerMeterTexturesInfo[] = {
|
||||||
|
{ (u8*)texture_power_meter_left_side, 8, 32, 64 },
|
||||||
|
{ (u8*)texture_power_meter_right_side, 8, 32, 64 },
|
||||||
|
{ (u8*)texture_power_meter_one_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_two_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_three_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_four_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_five_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_six_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_seven_segments, 8, 32, 32 },
|
||||||
|
{ (u8*)texture_power_meter_full, 8, 32, 32 },
|
||||||
|
};
|
||||||
|
|
||||||
|
djui_hud_render_texture_interpolated(&sPowerMeterTexturesInfo[0],
|
||||||
|
prevX, prevY, prevWidth / 64, prevHeight / 64,
|
||||||
|
x, y, width / 64, height / 64);
|
||||||
|
|
||||||
|
djui_hud_render_texture_interpolated(&sPowerMeterTexturesInfo[1],
|
||||||
|
prevX + prevWidth / 2, prevY, prevWidth / 64, prevHeight / 64,
|
||||||
|
x + width / 2, y, width / 64, height / 64);
|
||||||
|
|
||||||
|
s32 numWedges = MIN(MAX(health >> 8, 0), 8);
|
||||||
|
if (numWedges != 0) {
|
||||||
|
djui_hud_render_texture_interpolated(&sPowerMeterTexturesInfo[numWedges + 1],
|
||||||
|
prevX + prevWidth / 4, prevY + prevHeight / 4, prevWidth / 64, prevHeight / 64,
|
||||||
|
x + width / 4, y + height / 4, width / 64, height / 64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ bool hud_is_hidden(void);
|
||||||
s32 hud_get_value(enum HudDisplayValue type);
|
s32 hud_get_value(enum HudDisplayValue type);
|
||||||
void hud_set_value(enum HudDisplayValue type, s32 value);
|
void hud_set_value(enum HudDisplayValue type, s32 value);
|
||||||
void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height);
|
void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height);
|
||||||
|
void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);
|
||||||
|
|
||||||
void camera_freeze(void);
|
void camera_freeze(void);
|
||||||
void camera_unfreeze(void);
|
void camera_unfreeze(void);
|
||||||
|
|
Loading…
Reference in a new issue