1+ -- Sets the HUD color multiplied dependent on the pause status.
2+ --- @param r integer - red
3+ --- @param g integer - green
4+ --- @param b integer - blue
5+ --- @param a integer - alpha
6+ function djui_hud_set_adjusted_color (r , g , b , a )
7+ local multiplier = is_game_paused () and 0.5 or 1
8+ djui_hud_set_color (
9+ r * multiplier ,
10+ g * multiplier ,
11+ b * multiplier ,
12+ a
13+ )
14+ end
15+
16+ -- Renders recolored player heads - modified from EmilyEmmi's Shine Thief
17+ -- https://discord.com/channels/752682015614173235/755907254318006362/1146275236325625897
18+ --- @param index integer
19+ --- @param x integer
20+ --- @param y integer
21+ --- @param scale_x number
22+ --- @param scale_y number
23+ function render_player_head (index , x , y , scale_x , scale_y )
24+ local head_hud = get_texture_info (" hud_head_recolor" )
25+
26+ local parts = {
27+ SKIN ,
28+ HAIR ,
29+ CAP ,
30+ }
31+ local m = gMarioStates [index ]
32+ local np = gNetworkPlayers [index ]
33+
34+ local alpha = (m .health <= 0xff or is_game_paused ()) and 100 or 255
35+ local tile_y = m .character .type
36+ for i = 1 , # parts do
37+ local part = parts [i ]
38+ if tile_y == 2 and
39+ part == HAIR then
40+ part = GLOVES
41+ end
42+ local color = network_player_get_override_palette_color (np , part )
43+
44+ djui_hud_set_color (color .r , color .g , color .b , alpha )
45+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , (i - 1 ) * 16 , tile_y * 16 , 16 , 16 )
46+ end
47+
48+ djui_hud_set_color (255 , 255 , 255 , alpha )
49+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , # parts * 16 , tile_y * 16 , 16 , 16 )
50+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , (# parts + 1 ) * 16 , tile_y * 16 , 16 , 16 )
51+ end
52+
53+ -- Renders recolored player heads from provided model/hair/skin/cap - modified from EmilyEmmi's Shine Thief
54+ -- https://discord.com/channels/752682015614173235/755907254318006362/1146275236325625897
55+ --- @param model integer
56+ --- @param hair integer
57+ --- @param skin integer
58+ --- @param cap integer
59+ --- @param x integer
60+ --- @param y integer
61+ --- @param scale_x number
62+ --- @param scale_y number
63+ function render_player_head_from_parts (model , hair , skin , cap , x , y , scale_x , scale_y )
64+ local head_hud = get_texture_info (" hud_head_recolor" )
65+ local alpha = (m .health <= 0xff or is_game_paused ()) and 100 or 255
66+ local tile_y = model
67+
68+ local skin_color = unpack_color_int (skin )
69+ djui_hud_set_color (skin_color .r , skin_color .g , skin_color .b , alpha )
70+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , (1 - 1 ) * 16 , tile_y * 16 , 16 , 16 )
71+ local hair_color = unpack_color_int (hair )
72+ djui_hud_set_color (hair_color .r , hair_color .g , hair_color .b , alpha )
73+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , (2 - 1 ) * 16 , tile_y * 16 , 16 , 16 )
74+ local cap_color = unpack_color_int (cap )
75+ djui_hud_set_color (cap_color .r , cap_color .g , cap_color .b , alpha )
76+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , (3 - 1 ) * 16 , tile_y * 16 , 16 , 16 )
77+
78+ djui_hud_set_color (255 , 255 , 255 , alpha )
79+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , 3 * 16 , tile_y * 16 , 16 , 16 )
80+ djui_hud_render_texture_tile (head_hud , x , y , scale_x , scale_y , 4 * 16 , tile_y * 16 , 16 , 16 )
81+ end
0 commit comments