Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hud_element.h File Reference

Go to the source code of this file.

Data Structures

struct  HudCacheEntry
 
struct  PopupMenu
 
struct  Shop
 
struct  IconHudScriptPair
 
struct  VtxRect
 
struct  HudTransform
 
struct  HudElement
 
struct  PartnerPopupProperties
 

Macros

#define HUD_ELEMENT_BATTLE_ID_MASK   0x800
 
#define HS_PTR(sym)   (s32)&sym
 
#define hs_End   HUD_ELEMENT_OP_End,
 
#define hs_SetRGBA(time, image)   HUD_ELEMENT_OP_SetRGBA, time, (s32)image,
 
#define hs_SetCI(time, name)   HUD_ELEMENT_OP_SetCI, time, (s32)name##_png, (s32)name##_pal,
 
#define hs_SetCI_Explicit(time, raster, palette)   HUD_ELEMENT_OP_SetCI, time, (s32)raster##_png, (s32)palette##_pal,
 
#define hs_Restart   HUD_ELEMENT_OP_Restart,
 
#define hs_Loop   HUD_ELEMENT_OP_Loop,
 
#define hs_SetTileSize(size)   HUD_ELEMENT_OP_SetTileSize, size,
 
#define hs_SetSizesAutoScale(size1, size2)   HUD_ELEMENT_OP_SetSizesAutoScale, size1, size2,
 
#define hs_SetSizesFixedScale(size1, size2)   HUD_ELEMENT_OP_SetSizesFixedScale, size1, size2,
 
#define hs_SetVisible   HUD_ELEMENT_OP_SetVisible,
 
#define hs_SetHidden   HUD_ELEMENT_OP_SetHidden,
 
#define hs_AddTexelOffsetX(x)   HUD_ELEMENT_OP_AddTexelOffsetX, x,
 
#define hs_AddTexelOffsetY(y)   HUD_ELEMENT_OP_AddTexelOffsetY, y,
 
#define hs_SetTexelOffset(x, y)   HUD_ELEMENT_OP_SetTexelOffset, x, y,
 
#define hs_SetIcon(time, icon)   HUD_ELEMENT_OP_SetImage, time, ICON_##icon##_raster, ICON_##icon##_palette, 0, 0,
 
#define hs_SetScale(scale)   HUD_ELEMENT_OP_SetScale, (s32)(scale * 65536.0f),
 
#define hs_SetAlpha(alpha)   HUD_ELEMENT_OP_SetAlpha, alpha,
 
#define hs_RandomDelay(arg0, arg1)   HUD_ELEMENT_OP_RandomDelay, arg0, arg1,
 
#define hs_Delete   HUD_ELEMENT_OP_Delete,
 
#define hs_UseIA8   HUD_ELEMENT_OP_UseIA8,
 
#define hs_SetCustomSize(arg0, arg1)   HUD_ELEMENT_OP_SetCustomSize, arg0, arg1,
 
#define hs_RandomRestart(max, cutoff)   HUD_ELEMENT_OP_RandomRestart, max, cutoff,
 Restarts the loop if cutoff < rand_int(max)
 
#define hs_op_15(arg0)   HUD_ELEMENT_OP_op_15, arg0,
 
#define hs_RandomBranch(args...)   HUD_ELEMENT_OP_RandomBranch, (sizeof((s32[]){args})/sizeof(s32)), args,
 
#define hs_SetFlags(arg0)   HUD_ELEMENT_OP_SetFlags, arg0,
 
#define hs_ClearFlags(arg0)   HUD_ELEMENT_OP_ClearFlags, arg0,
 
#define hs_PlaySound(arg0)   HUD_ELEMENT_OP_PlaySound, arg0,
 
#define hs_SetPivot(arg0, arg1)   HUD_ELEMENT_OP_SetPivot, arg0, arg1,
 
#define HES_TEMPLATE_CI_ENUM_SIZE(name, sizeX, sizeY)
 Basic HudScript used for static CI images, setting size with hs_SetTileSize.
 
#define HES_TEMPLATE_CI_CUSTOM_SIZE(name, sizeX, sizeY)
 Basic HudScript used for static CI images, setting size with hs_SetCustomSize.
 
#define HES_TEMPLATE_ITEM(icon)
 
#define HES_TEMPLATE_ITEM_HEART_PIECE()
 
#define HES_TEMPLATE_ITEM_HEART()
 
#define HES_TEMPLATE_ITEM_STAR_POINT()
 
#define HES_TEMPLATE_ITEM_HEART_POINT()
 
#define HES_TEMPLATE_ITEM_FLOWER_POINT()
 
#define HES_TEMPLATE_ITEM_STAR_PIECE()
 
#define HES_TEMPLATE_ITEM_COIN()
 
#define HES_COIN_SPARKLE(dx, dy)
 

Typedefs

typedef s32 HudScript[]
 
typedef s32 HudElemID
 
typedef HudElementHudElementList[320]
 

Enumerations

enum  {
  HUD_ELEMENT_OP_End , HUD_ELEMENT_OP_SetRGBA , HUD_ELEMENT_OP_SetCI , HUD_ELEMENT_OP_Restart ,
  HUD_ELEMENT_OP_Loop , HUD_ELEMENT_OP_SetTileSize , HUD_ELEMENT_OP_SetSizesAutoScale , HUD_ELEMENT_OP_SetSizesFixedScale ,
  HUD_ELEMENT_OP_SetVisible , HUD_ELEMENT_OP_SetHidden , HUD_ELEMENT_OP_AddTexelOffsetX , HUD_ELEMENT_OP_AddTexelOffsetY ,
  HUD_ELEMENT_OP_SetTexelOffset , HUD_ELEMENT_OP_SetImage , HUD_ELEMENT_OP_SetScale , HUD_ELEMENT_OP_SetAlpha ,
  HUD_ELEMENT_OP_RandomDelay , HUD_ELEMENT_OP_Delete , HUD_ELEMENT_OP_UseIA8 , HUD_ELEMENT_OP_SetCustomSize ,
  HUD_ELEMENT_OP_RandomRestart , HUD_ELEMENT_OP_op_15 , HUD_ELEMENT_OP_op_16 , HUD_ELEMENT_OP_RandomBranch ,
  HUD_ELEMENT_OP_SetFlags , HUD_ELEMENT_OP_ClearFlags , HUD_ELEMENT_OP_PlaySound , HUD_ELEMENT_OP_SetPivot
}
 
enum  {
  HUD_ELEMENT_SIZE_8x8 , HUD_ELEMENT_SIZE_16x16 , HUD_ELEMENT_SIZE_24x24 , HUD_ELEMENT_SIZE_32x32 ,
  HUD_ELEMENT_SIZE_48x48 , HUD_ELEMENT_SIZE_64x64 , HUD_ELEMENT_SIZE_8x16 , HUD_ELEMENT_SIZE_16x8 ,
  HUD_ELEMENT_SIZE_16x24 , HUD_ELEMENT_SIZE_16x32 , HUD_ELEMENT_SIZE_64x32 , HUD_ELEMENT_SIZE_32x16 ,
  HUD_ELEMENT_SIZE_12x12 , HUD_ELEMENT_SIZE_48x24 , HUD_ELEMENT_SIZE_32x8 , HUD_ELEMENT_SIZE_24x8 ,
  HUD_ELEMENT_SIZE_64x16 , HUD_ELEMENT_SIZE_16x64 , HUD_ELEMENT_SIZE_192x32 , HUD_ELEMENT_SIZE_40x40 ,
  HUD_ELEMENT_SIZE_24x16 , HUD_ELEMENT_SIZE_32x40 , HUD_ELEMENT_SIZE_40x16 , HUD_ELEMENT_SIZE_40x24 ,
  HUD_ELEMENT_SIZE_32x24
}
 
enum  HudElementFlags {
  HUD_ELEMENT_FLAG_INITIALIZED = 0x00000001 , HUD_ELEMENT_FLAG_DISABLED = 0x00000002 , HUD_ELEMENT_FLAG_ANIMATION_FINISHED = 0x00000004 , HUD_ELEMENT_FLAG_8 = 0x00000008 ,
  HUD_ELEMENT_FLAG_SCALED = 0x00000010 , HUD_ELEMENT_FLAG_TRANSPARENT = 0x00000020 , HUD_ELEMENT_FLAG_FRONTUI = 0x00000040 , HUD_ELEMENT_FLAG_80 = 0x00000080 ,
  HUD_ELEMENT_FLAG_FIXEDSCALE = 0x00000100 , HUD_ELEMENT_FLAG_200 = 0x00000200 , HUD_ELEMENT_FLAG_BATTLE = 0x00000400 , HUD_ELEMENT_FLAG_REPEATED = 0x00000800 ,
  HUD_ELEMENT_FLAG_FLIPX = 0x00001000 , HUD_ELEMENT_FLAG_FLIPY = 0x00002000 , HUD_ELEMENT_FLAG_FMT_CI4 = 0x00004000 , HUD_ELEMENT_FLAG_FILTER_TEX = 0x00008000 ,
  HUD_ELEMENT_FLAG_TRANSFORM = 0x00010000 , HUD_ELEMENT_FLAG_NO_FOLD = 0x00020000 , HUD_ELEMENT_FLAG_DELETE = 0x00040000 , HUD_ELEMENT_FLAG_FMT_IA8 = 0x00080000 ,
  HUD_ELEMENT_FLAG_CUSTOM_SIZE = 0x00100000 , HUD_ELEMENT_FLAG_200000 = 0x00200000 , HUD_ELEMENT_FLAG_MEMOFFSET = 0x00400000 , HUD_ELEMENT_FLAG_ANTIALIASING = 0x00800000 ,
  HUD_ELEMENT_FLAG_1000000 = 0x01000000 , HUD_ELEMENT_FLAG_2000000 = 0x02000000 , HUD_ELEMENT_FLAG_4000000 = 0x04000000 , HUD_ELEMENT_FLAG_8000000 = 0x08000000 ,
  HUD_ELEMENT_FLAG_10000000 = 0x10000000 , HUD_ELEMENT_FLAG_DROP_SHADOW = 0x20000000 , HUD_ELEMENT_FLAG_40000000 = 0x40000000 , HUD_ELEMENT_FLAG_80000000 = 0x80000000
}
 
enum  { HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING = 0 , HUD_ELEMENT_DRAW_NEXT = 1 , HUD_ELEMENT_DRAW_FIRST_WITHOUT_CLIPPING = 2 }
 

Functions

void hud_element_load_script (HudElement *hudElement, HudScript *anim)
 
void hud_element_draw_rect (HudElement *hudElement, s16 texSizeX, s16 texSizeY, s16 drawSizeX, s16 drawSizeY, s16 offsetX, s16 offsetY, s32 clamp, s32 dropShadow)
 
void hud_element_clear_cache (void)
 
void init_hud_element_list (void)
 
s32 hud_element_create (HudScript *anim)
 Creates a new HUD element and returns its ID.
 
void update_hud_elements (void)
 
s32 hud_element_update (HudElement *hudElement)
 
void render_hud_elements_backUI (void)
 
void render_hud_elements_frontUI (void)
 
void render_hud_element (HudElement *hudElement)
 
void render_transformed_hud_elements (void)
 
void func_80143C48 (s32 arg0, s32 arg1, s32 camID)
 
void func_80144218 (s32 arg0)
 
void func_80144238 (s32 arg0)
 
void func_80144258 (s32 arg0)
 
void func_80144278 (s32 arg0)
 
void draw_hud_element_internal (s32 id, s32 clipMode)
 
void hud_element_draw_clipped (s32 id)
 
void hud_element_draw_next (s32 id)
 
void hud_element_draw_without_clipping (s32 id)
 
void hud_element_set_script (s32 id, HudScript *anim)
 
HudScripthud_element_get_script (s32 id)
 
HudElementget_hud_element (s32 id)
 
void hud_element_free (s32 id)
 
void hud_element_set_render_pos (s32 id, s32 x, s32 y)
 
void hud_element_get_render_pos (s32 id, s32 *x, s32 *y)
 
void hud_element_set_render_depth (s32 id, s32 z)
 
void hud_element_set_flags (s32 id, s32 flags)
 Turns on the given flags.
 
void hud_element_clear_flags (s32 id, s32 flags)
 Turns off the given flags.
 
void ALT_clear_hud_element_cache (void)
 
void hud_element_set_scale (s32 index, f32 scale)
 
void hud_element_use_preset_size (s32 id, s8 size)
 
s32 func_80144E4C (s32 id)
 
void func_80144E74 (s32 id, s32 arg1)
 
void hud_element_set_alpha (s32 id, s32 opacity)
 
void hud_element_set_tint (s32 id, s32 r, s32 g, s32 b)
 
void hud_element_create_transform_A (s32 id)
 
void hud_element_create_transform_B (s32 id)
 
void hud_element_create_transform_C (s32 id)
 
void hud_element_free_transform (s32 id)
 
void hud_element_set_transform_pos (s32 id, f32 x, f32 y, f32 z)
 
void hud_element_set_transform_scale (s32 id, f32 x, f32 y, f32 z)
 
void hud_element_set_transform_rotation (s32 id, f32 x, f32 y, f32 z)
 
void hud_element_set_transform_rotation_pivot (s32 id, s32 dx, s32 dy)
 
void copy_world_hud_element_ref_to_battle (s32 worldID, s32 battleID)
 
void hud_element_set_aux_cache (void *base, s32 size)
 
void create_standard_popup_menu (PopupMenu *)
 

Variables

HudScript HES_AnimatedHandPointer
 
HudScript HES_StatusCoin
 
HudScript HES_Refund
 
HudScript HES_MenuTimes
 
PartnerPopupProperties gPartnerPopupProperties [13]
 
HudScriptwDisabledPartnerHudScripts []
 
HudScriptwPartnerHudScripts []
 

Data Structure Documentation

◆ HudCacheEntry

struct HudCacheEntry
Data Fields
s32 id
u8 * data

◆ PopupMenu

struct PopupMenu
Data Fields
HudScript * ptrIcon[32]
char unk_80[0x4]
s32 nameMsg[32]
char unk_104[0x4]
s32 userIndex[32]
char unk_188[0x4]
s32 enabled[32]
char unk_20C[0x4]
s32 value[32]
char unk_290[0x4]
s32 descMsg[32]
char unk_314[0x4]
s32 popupType
s32 dipMode
s32 titleNumber
s32 numEntries
s32 initialPos
s16 result
char unk_32E[0x2]

◆ Shop

struct Shop
Data Fields
s16 flags
s16 numItems
s16 numSpecialPrices
char unk_06[0x2]
s32 curItemSlot
s32 selectedStoreItemSlot
ShopOwner * owner
ShopItemLocation * itemDataPositions
ShopItemData * staticInventory
ShopSellPriceData * staticPriceList
s32 costIconID
s32 inventoryItemFlags
PopupMenu itemSelectMenu
s32 unk_358

◆ IconHudScriptPair

struct IconHudScriptPair
Data Fields
HudScript * enabled
HudScript * disabled

◆ VtxRect

struct VtxRect
Data Fields
Vtx vtx[4]

◆ HudTransform

struct HudTransform
Data Fields
s32 imgfxIdx
Vec3f pos
Vec3f rot
Vec3f scale
Vec2s pivot
VtxRect unk_30[3]

◆ HudElement

struct HudElement
Data Fields
u32 flags
HudScript * readPos
HudScript * anim
HudScript * loopStartPos
u8 * imageAddr
u8 * paletteAddr
s32 memOffset
HudTransform * hudTransform
f32 deltaSizeX
f32 deltaSizeY
f32 unkImgScale[2]
f32 uniformScale
s32 widthScale X10.
s32 heightScale X10.
s16 renderPosX
s16 renderPosY
Vec2b screenPosOffset
Vec3b worldPosOffset
s8 drawSizePreset
s8 tileSizePreset
s8 updateTimer
u8 sizeX
u8 sizeY
u8 opacity
Color_RGB8 tint
Vec2bu customImageSize
Vec2bu customDrawSize

◆ PartnerPopupProperties

struct PartnerPopupProperties
Data Fields
s32 nameMsg
s32 unk_04
s32 worldDescMsg
s32 battleDescMsg

Macro Definition Documentation

◆ HUD_ELEMENT_BATTLE_ID_MASK

#define HUD_ELEMENT_BATTLE_ID_MASK   0x800

Definition at line 7 of file hud_element.h.

Referenced by func_80144E4C(), hud_element_create(), and hud_element_free().

◆ HS_PTR

#define HS_PTR ( sym)    (s32)&sym

Definition at line 235 of file hud_element.h.

◆ hs_End

#define hs_End   HUD_ELEMENT_OP_End,

Definition at line 237 of file hud_element.h.

◆ hs_SetRGBA

#define hs_SetRGBA ( time,
image )   HUD_ELEMENT_OP_SetRGBA, time, (s32)image,

Definition at line 238 of file hud_element.h.

◆ hs_SetCI

#define hs_SetCI ( time,
name )   HUD_ELEMENT_OP_SetCI, time, (s32)name##_png, (s32)name##_pal,

Definition at line 239 of file hud_element.h.

◆ hs_SetCI_Explicit

#define hs_SetCI_Explicit ( time,
raster,
palette )   HUD_ELEMENT_OP_SetCI, time, (s32)raster##_png, (s32)palette##_pal,

Definition at line 240 of file hud_element.h.

◆ hs_Restart

#define hs_Restart   HUD_ELEMENT_OP_Restart,

Definition at line 241 of file hud_element.h.

◆ hs_Loop

#define hs_Loop   HUD_ELEMENT_OP_Loop,

Definition at line 242 of file hud_element.h.

◆ hs_SetTileSize

#define hs_SetTileSize ( size)    HUD_ELEMENT_OP_SetTileSize, size,

Definition at line 243 of file hud_element.h.

◆ hs_SetSizesAutoScale

#define hs_SetSizesAutoScale ( size1,
size2 )   HUD_ELEMENT_OP_SetSizesAutoScale, size1, size2,

Definition at line 244 of file hud_element.h.

◆ hs_SetSizesFixedScale

#define hs_SetSizesFixedScale ( size1,
size2 )   HUD_ELEMENT_OP_SetSizesFixedScale, size1, size2,

Definition at line 245 of file hud_element.h.

◆ hs_SetVisible

#define hs_SetVisible   HUD_ELEMENT_OP_SetVisible,

Definition at line 246 of file hud_element.h.

◆ hs_SetHidden

#define hs_SetHidden   HUD_ELEMENT_OP_SetHidden,

Definition at line 247 of file hud_element.h.

◆ hs_AddTexelOffsetX

#define hs_AddTexelOffsetX ( x)    HUD_ELEMENT_OP_AddTexelOffsetX, x,

Definition at line 248 of file hud_element.h.

◆ hs_AddTexelOffsetY

#define hs_AddTexelOffsetY ( y)    HUD_ELEMENT_OP_AddTexelOffsetY, y,

Definition at line 249 of file hud_element.h.

◆ hs_SetTexelOffset

#define hs_SetTexelOffset ( x,
y )   HUD_ELEMENT_OP_SetTexelOffset, x, y,

Definition at line 250 of file hud_element.h.

◆ hs_SetIcon

#define hs_SetIcon ( time,
icon )   HUD_ELEMENT_OP_SetImage, time, ICON_##icon##_raster, ICON_##icon##_palette, 0, 0,

Definition at line 251 of file hud_element.h.

◆ hs_SetScale

#define hs_SetScale ( scale)    HUD_ELEMENT_OP_SetScale, (s32)(scale * 65536.0f),

Definition at line 252 of file hud_element.h.

◆ hs_SetAlpha

#define hs_SetAlpha ( alpha)    HUD_ELEMENT_OP_SetAlpha, alpha,

Definition at line 253 of file hud_element.h.

◆ hs_RandomDelay

#define hs_RandomDelay ( arg0,
arg1 )   HUD_ELEMENT_OP_RandomDelay, arg0, arg1,

Definition at line 254 of file hud_element.h.

◆ hs_Delete

#define hs_Delete   HUD_ELEMENT_OP_Delete,

Definition at line 255 of file hud_element.h.

◆ hs_UseIA8

#define hs_UseIA8   HUD_ELEMENT_OP_UseIA8,

Definition at line 256 of file hud_element.h.

◆ hs_SetCustomSize

#define hs_SetCustomSize ( arg0,
arg1 )   HUD_ELEMENT_OP_SetCustomSize, arg0, arg1,

Definition at line 257 of file hud_element.h.

◆ hs_RandomRestart

#define hs_RandomRestart ( max,
cutoff )   HUD_ELEMENT_OP_RandomRestart, max, cutoff,

Restarts the loop if cutoff < rand_int(max)

Definition at line 260 of file hud_element.h.

◆ hs_op_15

#define hs_op_15 ( arg0)    HUD_ELEMENT_OP_op_15, arg0,

Definition at line 262 of file hud_element.h.

◆ hs_RandomBranch

#define hs_RandomBranch ( args...)    HUD_ELEMENT_OP_RandomBranch, (sizeof((s32[]){args})/sizeof(s32)), args,

Definition at line 263 of file hud_element.h.

◆ hs_SetFlags

#define hs_SetFlags ( arg0)    HUD_ELEMENT_OP_SetFlags, arg0,

Definition at line 264 of file hud_element.h.

◆ hs_ClearFlags

#define hs_ClearFlags ( arg0)    HUD_ELEMENT_OP_ClearFlags, arg0,

Definition at line 265 of file hud_element.h.

◆ hs_PlaySound

#define hs_PlaySound ( arg0)    HUD_ELEMENT_OP_PlaySound, arg0,

Definition at line 266 of file hud_element.h.

◆ hs_SetPivot

#define hs_SetPivot ( arg0,
arg1 )   HUD_ELEMENT_OP_SetPivot, arg0, arg1,

Definition at line 267 of file hud_element.h.

◆ HES_TEMPLATE_CI_ENUM_SIZE

#define HES_TEMPLATE_CI_ENUM_SIZE ( name,
sizeX,
sizeY )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_##sizeX##x##sizeY) \
hs_Loop \
hs_SetCI(60, name) \
hs_Restart \
hs_End \
}

Basic HudScript used for static CI images, setting size with hs_SetTileSize.

Definition at line 270 of file hud_element.h.

270#define HES_TEMPLATE_CI_ENUM_SIZE(name, sizeX, sizeY) \
271 { \
272 hs_SetVisible \
273 hs_SetTileSize(HUD_ELEMENT_SIZE_##sizeX##x##sizeY) \
274 hs_Loop \
275 hs_SetCI(60, name) \
276 hs_Restart \
277 hs_End \
278 }

◆ HES_TEMPLATE_CI_CUSTOM_SIZE

#define HES_TEMPLATE_CI_CUSTOM_SIZE ( name,
sizeX,
sizeY )
Value:
{ \
hs_SetVisible \
hs_SetCustomSize(sizeX, sizeY) \
hs_Loop \
hs_SetCI(60, name) \
hs_Restart \
hs_End \
}

Basic HudScript used for static CI images, setting size with hs_SetCustomSize.

Definition at line 281 of file hud_element.h.

281#define HES_TEMPLATE_CI_CUSTOM_SIZE(name, sizeX, sizeY) \
282 { \
283 hs_SetVisible \
284 hs_SetCustomSize(sizeX, sizeY) \
285 hs_Loop \
286 hs_SetCI(60, name) \
287 hs_Restart \
288 hs_End \
289 }

◆ HES_TEMPLATE_ITEM

#define HES_TEMPLATE_ITEM ( icon)
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(60, icon) \
hs_Restart \
hs_End \
}
@ HUD_ELEMENT_SIZE_32x32
Definition hud_element.h:48

Definition at line 293 of file hud_element.h.

293#define HES_TEMPLATE_ITEM(icon) \
294 { \
295 hs_SetVisible \
296 hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
297 hs_Loop \
298 hs_SetIcon(60, icon) \
299 hs_Restart \
300 hs_End \
301 }

◆ HES_TEMPLATE_ITEM_HEART_PIECE

#define HES_TEMPLATE_ITEM_HEART_PIECE ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
hs_Loop \
hs_SetIcon(60, anim_heart_piece) \
hs_Restart \
hs_End \
}
@ HUD_ELEMENT_SIZE_24x24
Definition hud_element.h:47

Definition at line 303 of file hud_element.h.

303#define HES_TEMPLATE_ITEM_HEART_PIECE() \
304 { \
305 hs_SetVisible \
306 hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
307 hs_Loop \
308 hs_SetIcon(60, anim_heart_piece) \
309 hs_Restart \
310 hs_End \
311 }

◆ HES_TEMPLATE_ITEM_HEART

#define HES_TEMPLATE_ITEM_HEART ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
hs_Loop \
hs_SetIcon(10, anim_heart_0) \
hs_SetIcon(6, anim_heart_1) \
hs_Restart \
hs_End \
}

Definition at line 313 of file hud_element.h.

313#define HES_TEMPLATE_ITEM_HEART() \
314 { \
315 hs_SetVisible \
316 hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
317 hs_Loop \
318 hs_SetIcon(10, anim_heart_0) \
319 hs_SetIcon(6, anim_heart_1) \
320 hs_Restart \
321 hs_End \
322 }

◆ HES_TEMPLATE_ITEM_STAR_POINT

#define HES_TEMPLATE_ITEM_STAR_POINT ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
hs_Loop \
hs_SetIcon(2, anim_sp_0) \
hs_SetIcon(2, anim_sp_1) \
hs_SetIcon(2, anim_sp_2) \
hs_SetIcon(2, anim_sp_3) \
hs_SetIcon(2, anim_sp_4) \
hs_SetIcon(2, anim_sp_5) \
hs_SetIcon(2, anim_sp_6) \
hs_SetIcon(2, anim_sp_7) \
hs_Restart \
hs_End \
}

Definition at line 324 of file hud_element.h.

324#define HES_TEMPLATE_ITEM_STAR_POINT() \
325 { \
326 hs_SetVisible \
327 hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
328 hs_Loop \
329 hs_SetIcon(2, anim_sp_0) \
330 hs_SetIcon(2, anim_sp_1) \
331 hs_SetIcon(2, anim_sp_2) \
332 hs_SetIcon(2, anim_sp_3) \
333 hs_SetIcon(2, anim_sp_4) \
334 hs_SetIcon(2, anim_sp_5) \
335 hs_SetIcon(2, anim_sp_6) \
336 hs_SetIcon(2, anim_sp_7) \
337 hs_Restart \
338 hs_End \
339 }

◆ HES_TEMPLATE_ITEM_HEART_POINT

#define HES_TEMPLATE_ITEM_HEART_POINT ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(8, anim_hp_0) \
hs_SetIcon(5, anim_hp_1) \
hs_SetIcon(8, anim_hp_2) \
hs_Restart \
hs_End \
}

Definition at line 341 of file hud_element.h.

341#define HES_TEMPLATE_ITEM_HEART_POINT() \
342 { \
343 hs_SetVisible \
344 hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
345 hs_Loop \
346 hs_SetIcon(8, anim_hp_0) \
347 hs_SetIcon(5, anim_hp_1) \
348 hs_SetIcon(8, anim_hp_2) \
349 hs_Restart \
350 hs_End \
351 }

◆ HES_TEMPLATE_ITEM_FLOWER_POINT

#define HES_TEMPLATE_ITEM_FLOWER_POINT ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(8, anim_fp_0) \
hs_SetIcon(5, anim_fp_1) \
hs_SetIcon(8, anim_fp_2) \
hs_Restart \
hs_End \
}

Definition at line 353 of file hud_element.h.

353#define HES_TEMPLATE_ITEM_FLOWER_POINT() \
354 { \
355 hs_SetVisible \
356 hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
357 hs_Loop \
358 hs_SetIcon(8, anim_fp_0) \
359 hs_SetIcon(5, anim_fp_1) \
360 hs_SetIcon(8, anim_fp_2) \
361 hs_Restart \
362 hs_End \
363 }

◆ HES_TEMPLATE_ITEM_STAR_PIECE

#define HES_TEMPLATE_ITEM_STAR_PIECE ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(12, anim_star_piece_0) \
hs_SetIcon(4, anim_star_piece_1) \
hs_SetIcon(12, anim_star_piece_2) \
hs_SetIcon(4, anim_star_piece_1) \
hs_Restart \
hs_End \
}

Definition at line 365 of file hud_element.h.

365#define HES_TEMPLATE_ITEM_STAR_PIECE() \
366 { \
367 hs_SetVisible \
368 hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
369 hs_Loop \
370 hs_SetIcon(12, anim_star_piece_0) \
371 hs_SetIcon(4, anim_star_piece_1) \
372 hs_SetIcon(12, anim_star_piece_2) \
373 hs_SetIcon(4, anim_star_piece_1) \
374 hs_Restart \
375 hs_End \
376 }

◆ HES_TEMPLATE_ITEM_COIN

#define HES_TEMPLATE_ITEM_COIN ( )
Value:
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
hs_Loop \
hs_op_15(0) \
hs_SetIcon(3, anim_coin_0) \
hs_SetIcon(3, anim_coin_1) \
hs_SetIcon(3, anim_coin_4) \
hs_SetIcon(3, anim_coin_5) \
hs_SetIcon(3, anim_coin_6) \
hs_SetIcon(3, anim_coin_7) \
hs_SetIcon(3, anim_coin_8) \
hs_SetIcon(3, anim_coin_9) \
hs_RandomRestart(100, 70) \
hs_op_15(1) \
hs_SetIcon(3, anim_coin_0) \
hs_SetIcon(2, anim_coin_1) \
hs_SetIcon(1, anim_coin_2) \
hs_SetIcon(1, anim_coin_3) \
hs_SetIcon(2, anim_coin_4) \
hs_SetIcon(3, anim_coin_5) \
hs_SetIcon(3, anim_coin_6) \
hs_SetIcon(3, anim_coin_7) \
hs_SetIcon(3, anim_coin_8) \
hs_SetIcon(3, anim_coin_9) \
hs_Restart \
hs_End \
}

Definition at line 378 of file hud_element.h.

378#define HES_TEMPLATE_ITEM_COIN() \
379 { \
380 hs_SetVisible \
381 hs_SetTileSize(HUD_ELEMENT_SIZE_24x24) \
382 hs_Loop \
383 hs_op_15(0) \
384 hs_SetIcon(3, anim_coin_0) \
385 hs_SetIcon(3, anim_coin_1) \
386 hs_SetIcon(3, anim_coin_4) \
387 hs_SetIcon(3, anim_coin_5) \
388 hs_SetIcon(3, anim_coin_6) \
389 hs_SetIcon(3, anim_coin_7) \
390 hs_SetIcon(3, anim_coin_8) \
391 hs_SetIcon(3, anim_coin_9) \
392 hs_RandomRestart(100, 70) \
393 hs_op_15(1) \
394 hs_SetIcon(3, anim_coin_0) \
395 hs_SetIcon(2, anim_coin_1) \
396 hs_SetIcon(1, anim_coin_2) \
397 hs_SetIcon(1, anim_coin_3) \
398 hs_SetIcon(2, anim_coin_4) \
399 hs_SetIcon(3, anim_coin_5) \
400 hs_SetIcon(3, anim_coin_6) \
401 hs_SetIcon(3, anim_coin_7) \
402 hs_SetIcon(3, anim_coin_8) \
403 hs_SetIcon(3, anim_coin_9) \
404 hs_Restart \
405 hs_End \
406 }

◆ HES_COIN_SPARKLE

#define HES_COIN_SPARKLE ( dx,
dy )
Value:
{ \
hs_SetTexelOffset(dx, dy) \
hs_SetIcon(1, anim_shimmer_0) \
hs_SetIcon(1, anim_shimmer_1) \
hs_SetIcon(1, anim_shimmer_2) \
hs_SetIcon(2, anim_shimmer_6) \
hs_SetIcon(1, anim_shimmer_2) \
hs_SetIcon(1, anim_shimmer_3) \
hs_SetIcon(1, anim_shimmer_6) \
hs_SetIcon(1, anim_shimmer_4) \
hs_SetIcon(1, anim_shimmer_6) \
hs_SetIcon(1, anim_shimmer_5) \
hs_SetIcon(16, anim_shimmer_6) \
}
#define hs_End

Definition at line 408 of file hud_element.h.

408#define HES_COIN_SPARKLE(dx, dy) \
409 { \
410 hs_SetTexelOffset(dx, dy) \
411 hs_SetIcon(1, anim_shimmer_0) \
412 hs_SetIcon(1, anim_shimmer_1) \
413 hs_SetIcon(1, anim_shimmer_2) \
414 hs_SetIcon(2, anim_shimmer_6) \
415 hs_SetIcon(1, anim_shimmer_2) \
416 hs_SetIcon(1, anim_shimmer_3) \
417 hs_SetIcon(1, anim_shimmer_6) \
418 hs_SetIcon(1, anim_shimmer_4) \
419 hs_SetIcon(1, anim_shimmer_6) \
420 hs_SetIcon(1, anim_shimmer_5) \
421 hs_SetIcon(16, anim_shimmer_6) \
422 hs_End \
423 }

Typedef Documentation

◆ HudScript

typedef s32 HudScript[]

Definition at line 9 of file hud_element.h.

◆ HudElemID

typedef s32 HudElemID

Definition at line 11 of file hud_element.h.

◆ HudElementList

typedef HudElement* HudElementList[320]

Definition at line 212 of file hud_element.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HUD_ELEMENT_OP_End 
HUD_ELEMENT_OP_SetRGBA 
HUD_ELEMENT_OP_SetCI 
HUD_ELEMENT_OP_Restart 
HUD_ELEMENT_OP_Loop 
HUD_ELEMENT_OP_SetTileSize 
HUD_ELEMENT_OP_SetSizesAutoScale 
HUD_ELEMENT_OP_SetSizesFixedScale 
HUD_ELEMENT_OP_SetVisible 
HUD_ELEMENT_OP_SetHidden 
HUD_ELEMENT_OP_AddTexelOffsetX 
HUD_ELEMENT_OP_AddTexelOffsetY 
HUD_ELEMENT_OP_SetTexelOffset 
HUD_ELEMENT_OP_SetImage 
HUD_ELEMENT_OP_SetScale 
HUD_ELEMENT_OP_SetAlpha 
HUD_ELEMENT_OP_RandomDelay 
HUD_ELEMENT_OP_Delete 
HUD_ELEMENT_OP_UseIA8 
HUD_ELEMENT_OP_SetCustomSize 
HUD_ELEMENT_OP_RandomRestart 
HUD_ELEMENT_OP_op_15 
HUD_ELEMENT_OP_op_16 
HUD_ELEMENT_OP_RandomBranch 
HUD_ELEMENT_OP_SetFlags 
HUD_ELEMENT_OP_ClearFlags 
HUD_ELEMENT_OP_PlaySound 
HUD_ELEMENT_OP_SetPivot 

Definition at line 13 of file hud_element.h.

13 {
42};
@ HUD_ELEMENT_OP_SetCI
Definition hud_element.h:16
@ HUD_ELEMENT_OP_Restart
Definition hud_element.h:17
@ HUD_ELEMENT_OP_End
Definition hud_element.h:14
@ HUD_ELEMENT_OP_SetPivot
Definition hud_element.h:41
@ HUD_ELEMENT_OP_op_16
Definition hud_element.h:36
@ HUD_ELEMENT_OP_SetVisible
Definition hud_element.h:22
@ HUD_ELEMENT_OP_AddTexelOffsetY
Definition hud_element.h:25
@ HUD_ELEMENT_OP_SetScale
Definition hud_element.h:28
@ HUD_ELEMENT_OP_SetImage
Definition hud_element.h:27
@ HUD_ELEMENT_OP_RandomBranch
Definition hud_element.h:37
@ HUD_ELEMENT_OP_PlaySound
Definition hud_element.h:40
@ HUD_ELEMENT_OP_SetSizesAutoScale
Definition hud_element.h:20
@ HUD_ELEMENT_OP_SetTexelOffset
Definition hud_element.h:26
@ HUD_ELEMENT_OP_RandomDelay
Definition hud_element.h:30
@ HUD_ELEMENT_OP_Loop
Definition hud_element.h:18
@ HUD_ELEMENT_OP_SetFlags
Definition hud_element.h:38
@ HUD_ELEMENT_OP_SetAlpha
Definition hud_element.h:29
@ HUD_ELEMENT_OP_SetTileSize
Definition hud_element.h:19
@ HUD_ELEMENT_OP_SetSizesFixedScale
Definition hud_element.h:21
@ HUD_ELEMENT_OP_RandomRestart
Definition hud_element.h:34
@ HUD_ELEMENT_OP_SetCustomSize
Definition hud_element.h:33
@ HUD_ELEMENT_OP_AddTexelOffsetX
Definition hud_element.h:24
@ HUD_ELEMENT_OP_SetRGBA
Definition hud_element.h:15
@ HUD_ELEMENT_OP_UseIA8
Definition hud_element.h:32
@ HUD_ELEMENT_OP_ClearFlags
Definition hud_element.h:39
@ HUD_ELEMENT_OP_SetHidden
Definition hud_element.h:23
@ HUD_ELEMENT_OP_Delete
Definition hud_element.h:31
@ HUD_ELEMENT_OP_op_15
Definition hud_element.h:35

◆ anonymous enum

anonymous enum
Enumerator
HUD_ELEMENT_SIZE_8x8 
HUD_ELEMENT_SIZE_16x16 
HUD_ELEMENT_SIZE_24x24 
HUD_ELEMENT_SIZE_32x32 
HUD_ELEMENT_SIZE_48x48 
HUD_ELEMENT_SIZE_64x64 
HUD_ELEMENT_SIZE_8x16 
HUD_ELEMENT_SIZE_16x8 
HUD_ELEMENT_SIZE_16x24 
HUD_ELEMENT_SIZE_16x32 
HUD_ELEMENT_SIZE_64x32 
HUD_ELEMENT_SIZE_32x16 
HUD_ELEMENT_SIZE_12x12 
HUD_ELEMENT_SIZE_48x24 
HUD_ELEMENT_SIZE_32x8 
HUD_ELEMENT_SIZE_24x8 
HUD_ELEMENT_SIZE_64x16 
HUD_ELEMENT_SIZE_16x64 
HUD_ELEMENT_SIZE_192x32 
HUD_ELEMENT_SIZE_40x40 
HUD_ELEMENT_SIZE_24x16 
HUD_ELEMENT_SIZE_32x40 
HUD_ELEMENT_SIZE_40x16 
HUD_ELEMENT_SIZE_40x24 
HUD_ELEMENT_SIZE_32x24 

Definition at line 44 of file hud_element.h.

44 {
70};
@ HUD_ELEMENT_SIZE_192x32
Definition hud_element.h:63
@ HUD_ELEMENT_SIZE_32x16
Definition hud_element.h:56
@ HUD_ELEMENT_SIZE_64x64
Definition hud_element.h:50
@ HUD_ELEMENT_SIZE_40x40
Definition hud_element.h:64
@ HUD_ELEMENT_SIZE_40x24
Definition hud_element.h:68
@ HUD_ELEMENT_SIZE_32x24
Definition hud_element.h:69
@ HUD_ELEMENT_SIZE_12x12
Definition hud_element.h:57
@ HUD_ELEMENT_SIZE_64x16
Definition hud_element.h:61
@ HUD_ELEMENT_SIZE_24x8
Definition hud_element.h:60
@ HUD_ELEMENT_SIZE_40x16
Definition hud_element.h:67
@ HUD_ELEMENT_SIZE_32x40
Definition hud_element.h:66
@ HUD_ELEMENT_SIZE_16x24
Definition hud_element.h:53
@ HUD_ELEMENT_SIZE_16x16
Definition hud_element.h:46
@ HUD_ELEMENT_SIZE_64x32
Definition hud_element.h:55
@ HUD_ELEMENT_SIZE_8x16
Definition hud_element.h:51
@ HUD_ELEMENT_SIZE_32x8
Definition hud_element.h:59
@ HUD_ELEMENT_SIZE_48x24
Definition hud_element.h:58
@ HUD_ELEMENT_SIZE_16x32
Definition hud_element.h:54
@ HUD_ELEMENT_SIZE_48x48
Definition hud_element.h:49
@ HUD_ELEMENT_SIZE_16x8
Definition hud_element.h:52
@ HUD_ELEMENT_SIZE_16x64
Definition hud_element.h:62
@ HUD_ELEMENT_SIZE_8x8
Definition hud_element.h:45
@ HUD_ELEMENT_SIZE_24x16
Definition hud_element.h:65

◆ HudElementFlags

Enumerator
HUD_ELEMENT_FLAG_INITIALIZED 
HUD_ELEMENT_FLAG_DISABLED 
HUD_ELEMENT_FLAG_ANIMATION_FINISHED 
HUD_ELEMENT_FLAG_8 
HUD_ELEMENT_FLAG_SCALED 
HUD_ELEMENT_FLAG_TRANSPARENT 
HUD_ELEMENT_FLAG_FRONTUI 
HUD_ELEMENT_FLAG_80 
HUD_ELEMENT_FLAG_FIXEDSCALE 
HUD_ELEMENT_FLAG_200 
HUD_ELEMENT_FLAG_BATTLE 
HUD_ELEMENT_FLAG_REPEATED 
HUD_ELEMENT_FLAG_FLIPX 
HUD_ELEMENT_FLAG_FLIPY 
HUD_ELEMENT_FLAG_FMT_CI4 
HUD_ELEMENT_FLAG_FILTER_TEX 
HUD_ELEMENT_FLAG_TRANSFORM 
HUD_ELEMENT_FLAG_NO_FOLD 
HUD_ELEMENT_FLAG_DELETE 
HUD_ELEMENT_FLAG_FMT_IA8 
HUD_ELEMENT_FLAG_CUSTOM_SIZE 
HUD_ELEMENT_FLAG_200000 
HUD_ELEMENT_FLAG_MEMOFFSET 
HUD_ELEMENT_FLAG_ANTIALIASING 
HUD_ELEMENT_FLAG_1000000 
HUD_ELEMENT_FLAG_2000000 
HUD_ELEMENT_FLAG_4000000 
HUD_ELEMENT_FLAG_8000000 
HUD_ELEMENT_FLAG_10000000 
HUD_ELEMENT_FLAG_DROP_SHADOW 
HUD_ELEMENT_FLAG_40000000 
HUD_ELEMENT_FLAG_80000000 

Definition at line 72 of file hud_element.h.

72 {
74 HUD_ELEMENT_FLAG_DISABLED = 0x00000002,
76 HUD_ELEMENT_FLAG_8 = 0x00000008,
77 HUD_ELEMENT_FLAG_SCALED = 0x00000010,
79 HUD_ELEMENT_FLAG_FRONTUI = 0x00000040,
80 HUD_ELEMENT_FLAG_80 = 0x00000080,
81 HUD_ELEMENT_FLAG_FIXEDSCALE = 0x00000100,
82 HUD_ELEMENT_FLAG_200 = 0x00000200,
83 HUD_ELEMENT_FLAG_BATTLE = 0x00000400,
84 HUD_ELEMENT_FLAG_REPEATED = 0x00000800,
85 HUD_ELEMENT_FLAG_FLIPX = 0x00001000,
86 HUD_ELEMENT_FLAG_FLIPY = 0x00002000,
87 HUD_ELEMENT_FLAG_FMT_CI4 = 0x00004000,
88 HUD_ELEMENT_FLAG_FILTER_TEX = 0x00008000,
89 HUD_ELEMENT_FLAG_TRANSFORM = 0x00010000,
90 HUD_ELEMENT_FLAG_NO_FOLD = 0x00020000,
91 HUD_ELEMENT_FLAG_DELETE = 0x00040000,
92 HUD_ELEMENT_FLAG_FMT_IA8 = 0x00080000,
94 HUD_ELEMENT_FLAG_200000 = 0x00200000,
95 HUD_ELEMENT_FLAG_MEMOFFSET = 0x00400000,
97 HUD_ELEMENT_FLAG_1000000 = 0x01000000,
98 HUD_ELEMENT_FLAG_2000000 = 0x02000000,
99 HUD_ELEMENT_FLAG_4000000 = 0x04000000,
100 HUD_ELEMENT_FLAG_8000000 = 0x08000000,
101 HUD_ELEMENT_FLAG_10000000 = 0x10000000,
102 HUD_ELEMENT_FLAG_DROP_SHADOW = 0x20000000,
103 HUD_ELEMENT_FLAG_40000000 = 0x40000000,
104 HUD_ELEMENT_FLAG_80000000 = 0x80000000,
105};
@ HUD_ELEMENT_FLAG_200000
Definition hud_element.h:94
@ HUD_ELEMENT_FLAG_ANTIALIASING
Definition hud_element.h:96
@ HUD_ELEMENT_FLAG_4000000
Definition hud_element.h:99
@ HUD_ELEMENT_FLAG_DELETE
Definition hud_element.h:91
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:74
@ HUD_ELEMENT_FLAG_SCALED
Definition hud_element.h:77
@ HUD_ELEMENT_FLAG_FLIPX
Definition hud_element.h:85
@ HUD_ELEMENT_FLAG_1000000
Definition hud_element.h:97
@ HUD_ELEMENT_FLAG_10000000
@ HUD_ELEMENT_FLAG_MEMOFFSET
Definition hud_element.h:95
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:80
@ HUD_ELEMENT_FLAG_FMT_IA8
Definition hud_element.h:92
@ HUD_ELEMENT_FLAG_CUSTOM_SIZE
Definition hud_element.h:93
@ HUD_ELEMENT_FLAG_8
Definition hud_element.h:76
@ HUD_ELEMENT_FLAG_FIXEDSCALE
Definition hud_element.h:81
@ HUD_ELEMENT_FLAG_REPEATED
Definition hud_element.h:84
@ HUD_ELEMENT_FLAG_INITIALIZED
Definition hud_element.h:73
@ HUD_ELEMENT_FLAG_FLIPY
Definition hud_element.h:86
@ HUD_ELEMENT_FLAG_80000000
@ HUD_ELEMENT_FLAG_8000000
@ HUD_ELEMENT_FLAG_DROP_SHADOW
@ HUD_ELEMENT_FLAG_2000000
Definition hud_element.h:98
@ HUD_ELEMENT_FLAG_40000000
@ HUD_ELEMENT_FLAG_NO_FOLD
Definition hud_element.h:90
@ HUD_ELEMENT_FLAG_ANIMATION_FINISHED
Definition hud_element.h:75
@ HUD_ELEMENT_FLAG_BATTLE
Definition hud_element.h:83
@ HUD_ELEMENT_FLAG_FRONTUI
Definition hud_element.h:79
@ HUD_ELEMENT_FLAG_FMT_CI4
Definition hud_element.h:87
@ HUD_ELEMENT_FLAG_200
Definition hud_element.h:82
@ HUD_ELEMENT_FLAG_TRANSFORM
Definition hud_element.h:89
@ HUD_ELEMENT_FLAG_FILTER_TEX
Definition hud_element.h:88
@ HUD_ELEMENT_FLAG_TRANSPARENT
Definition hud_element.h:78

◆ anonymous enum

anonymous enum
Enumerator
HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING 
HUD_ELEMENT_DRAW_NEXT 
HUD_ELEMENT_DRAW_FIRST_WITHOUT_CLIPPING 

Definition at line 107 of file hud_element.h.

107 {
111};
@ HUD_ELEMENT_DRAW_NEXT
@ HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING
@ HUD_ELEMENT_DRAW_FIRST_WITHOUT_CLIPPING

Function Documentation

◆ hud_element_load_script()

void hud_element_load_script ( HudElement * hudElement,
HudScript * anim )

Definition at line 124 of file hud_element.c.

124 {
125 s32* pos = (s32*)anim;
126 s32 raster;
127 s32 palette;
128 s32 preset;
129 HudCacheEntry* entry;
130 s32 i;
131 s32 capacity;
132
133 if (pos == NULL) {
134 return;
135 }
136
137 preset = 0;
138
139 while (TRUE) {
140 switch (*pos++) {
142 return;
144 pos += 3;
145 break;
147 preset = *pos++;
148 hudElement->drawSizePreset = hudElement->tileSizePreset = preset;
149 break;
152 preset = *pos;
153 pos += 2;
154 hudElement->drawSizePreset = hudElement->tileSizePreset = preset;
155 break;
157 hudElement->customDrawSize.x = hudElement->customImageSize.x = *pos++;
158 hudElement->customDrawSize.y = hudElement->customImageSize.y = *pos++;
159 hudElement->flags |= HUD_ELEMENT_FLAG_CUSTOM_SIZE;
160 break;
170 pos++;
171 break;
177 pos += 2;
178 break;
180 pos++;
181 raster = *pos++;
182 palette = *pos++;
183
184 i = 0;
186 while (TRUE) {
187 if (entry->id == -1) {
188 entry->id = raster;
191 capacity = gHudElementCacheCapacity;
192 } else {
193 capacity = gHudElementCacheCapacity / 2;
194 }
195 ASSERT(capacity > *gHudElementCacheSize + gHudElementSizes[preset].size);
196 nuPiReadRom((s32)icon_ROM_START + raster, entry->data, gHudElementSizes[preset].size);
199 *pos = i;
200 } else {
201 *pos = (u16)(*pos) | (i << 16);
202 }
203 i++;
204 break;
205 } else if (entry->id == raster) {
207 *pos = i;
208 } else {
209 *pos = (u16)(*pos) | (i << 16);
210 }
211 break;
212 }
213 entry++;
214 i++;
215 }
216
217 pos++;
219
221 i = 0;
222 while (TRUE) {
223 if (entry->id == -1) {
224 entry->id = palette;
227 capacity = gHudElementCacheCapacity;
228 } else {
229 capacity = gHudElementCacheCapacity / 2;
230 }
231 ASSERT(capacity > *gHudElementCacheSize + 32);
232 nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 32);
235 *pos = i;
236 } else {
237 *pos = (u16)(*pos) | (i << 16);
238 }
239 i++;
240 break;
241 } else if (entry->id == palette) {
243 *pos = i;
244 } else {
245 *pos = (u16)(*pos) | (i << 16);
246 }
247 break;
248 }
249 entry++;
250 i++;
251 }
252
253 pos++;
255 break;
256 }
257 }
258}
Vec3s pos
Definition demo_api.c:17
#define ASSERT(condition)
@ CONTEXT_WORLD
Definition enums.h:3529
u8 * gHudElementCacheBuffer
HudCacheEntry * gHudElementCacheTablePalette
s32 * gHudElementCacheSize
HudCacheEntry * gHudElementCacheTableRaster
#define MAX_HUD_CACHE_ENTRIES
Definition hud_element.c:6
HudElementSize gHudElementSizes[]
Definition hud_element.c:21
s32 gHudElementCacheCapacity
Definition hud_element.c:15
Vec2bu customImageSize
Vec2bu customDrawSize
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by hud_element_create(), hud_element_set_script(), and hud_element_update().

◆ hud_element_draw_rect()

void hud_element_draw_rect ( HudElement * hudElement,
s16 texSizeX,
s16 texSizeY,
s16 drawSizeX,
s16 drawSizeY,
s16 offsetX,
s16 offsetY,
s32 clamp,
s32 dropShadow )
Parameters
clamp0 = repeat; 1 = clamp
dropShadowWhether to render a drop shadow or not

Definition at line 260 of file hud_element.c.

261 {
262 u32 isFmtCI4;
263 u32 isFmtIA8;
264 s32 flipX, flipY;
265 s32 fmt;
266 s32 widthScale, heightScale;
267 s32 texStartX, texStartY;
268 u32 isLastTileX, isLastTileY;
269 s32 uls, ult, lrs, lrt;
270 s32 uly, lry, ulx, lrx;
271 s32 masks, maskt;
272 s32 screenPosOffsetScaledX, screenPosOffsetScaledY;
273 IMG_PTR imageAddr;
274 PAL_PTR paletteAddr;
275 s16 baseX, baseY;
276 s32 tileMode;
277 u32 flags1, flags2;
278 u16 renderPosX, renderPosY;
279 s16 tempX, tempY;
280
281 imageAddr = hudElement->imageAddr;
282 paletteAddr = (u16*) hudElement->paletteAddr;
283
284 screenPosOffsetScaledX = hudElement->screenPosOffset.x * 1024;
285 screenPosOffsetScaledY = hudElement->screenPosOffset.y * 1024;
286 widthScale = hudElement->widthScale;
287 screenPosOffsetScaledX /= widthScale;
288 heightScale = hudElement->heightScale;
289 screenPosOffsetScaledY /= heightScale;
290
291 renderPosX = hudElement->worldPosOffset.x;
292 renderPosY = hudElement->worldPosOffset.y;
293 renderPosX += hudElement->renderPosX + screenPosOffsetScaledX;
294 renderPosY += hudElement->renderPosY + screenPosOffsetScaledY;
295 tempX = offsetX;
296 tempY = offsetY;
297 tempX += renderPosX;
298 tempY += renderPosY;
299
300 baseX = tempX;
301 baseY = tempY;
302
303 if (dropShadow) {
304 baseX = tempX + 2;
305 baseY = tempY + 2;
306 }
307
308 flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_CI4);
309 isFmtCI4 = flags1 != 0;
310 flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_IA8);
311 isFmtIA8 = flags1 != 0;
312 flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FLIPX);
313 flipX = flags1 != 0;
314 flags2 = (hudElement->flags & HUD_ELEMENT_FLAG_FLIPY);
315 flipY = flags2 != 0;
316
317 fmt = 0;
318 if (isFmtCI4 == FALSE && isFmtIA8 == FALSE) {
319 fmt = 0; // RGBA
320 }
321 if (isFmtCI4 == TRUE && isFmtIA8 == FALSE) {
322 fmt = 1; // CI
323 }
324 if (isFmtCI4 == FALSE && isFmtIA8 == TRUE) {
325 fmt = 2; // IA
326 }
327 if (isFmtCI4 == TRUE && isFmtIA8 == TRUE) {
328 fmt = 2; // IA
329 }
330
331 masks = 6;
332 maskt = 5;
333 if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
334 switch (drawSizeX) {
335 case 8:
336 masks = 3;
337 break;
338 case 16:
339 masks = 4;
340 break;
341 case 32:
342 masks = 5;
343 break;
344 }
345
346 switch (drawSizeY) {
347 case 8:
348 maskt = 3;
349 break;
350 case 16:
351 maskt = 4;
352 break;
353 case 32:
354 maskt = 5;
355 break;
356 }
357 }
358
359 switch (fmt) {
360 case 0:
361 gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
362 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
363 break;
364 case 1:
365 if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
366 if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
367 gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
368 } else {
369 gDPSetRenderMode(gMainGfxPos++, G_RM_AA_TEX_EDGE, G_RM_AA_TEX_EDGE2);
370 }
371 } else {
372 if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
373 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
374 } else {
375 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF | AA_EN, G_RM_CLD_SURF2 | AA_EN);
376 }
377 }
378 gDPSetTextureLUT(gMainGfxPos++, G_TT_RGBA16);
379 gDPLoadTLUT_pal16(gMainGfxPos++, 0, paletteAddr);
380 break;
381 case 2:
382 gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
383 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
384 break;
385 }
386
387 if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
388 gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
389 } else {
390 gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
391 }
392
393 ult = 0;
394 isLastTileY = FALSE;
395 uly = baseY;
396 while (TRUE) {
397 lry = uly + 1024.0 / heightScale * 32.0;
398 lrt = ult + 31;
399 if (flipY) {
400 texStartY = texSizeY;
401 } else {
402 texStartY = 0;
403 }
404
405 if (lry < 0 || uly > SCREEN_HEIGHT) {
406 break;
407 }
408
409 if (lry >= SCREEN_HEIGHT) {
410 s32 temp = ult + SCREEN_HEIGHT + 31;
411 temp -= baseY + lrt;
412 lrt = temp - 1;
413
414 lry = SCREEN_HEIGHT;
415 isLastTileY = TRUE;
416 }
417
418 if (lrt + 1 >= texSizeY) {
419 lrt = texSizeY - 1;
420 if (texSizeY > 16) {
421 lry = baseY + drawSizeY - 1;
422 } else {
423 lry = baseY + drawSizeY;
424 }
425 isLastTileY = TRUE;
426 }
427
428 isLastTileX = FALSE;
429 uls = 0;
430 ulx = baseX;
431 while (TRUE) {
432 lrx = ulx + 1024.0 / widthScale * 64.0;
433 lrs = uls + 63;
434 if (flipX) {
435 texStartX = texSizeX;
436 } else {
437 texStartX = 0;
438 }
439
440 if (lrx < 0 || ulx > SCREEN_WIDTH) {
441 break;
442 }
443
444 if (lrx >= SCREEN_WIDTH) {
445 s32 temp = uls + SCREEN_WIDTH + 63;
446 temp -= baseX + lrs;
447 lrs = temp - 1;
448
449 lrx = SCREEN_WIDTH;
450 isLastTileX = TRUE;
451 }
452
453 if (lrs + 1 >= texSizeX) {
454 lrs = texSizeX - 1;
455 if (texSizeX > 16) {
456 lrx = baseX + drawSizeX - 1;
457 } else {
458 lrx = baseX + drawSizeX;
459 }
460 isLastTileX = TRUE;
461 }
462
463 gDPPipeSync(gMainGfxPos++);
464
465 if (isLastTileX ) {
466 tileMode = !isLastTileY;
467 }
468 if (!isLastTileX && !isLastTileY) {
469 tileMode = 0;
470 }
471 if (!isLastTileX && isLastTileY) {
472 tileMode = 2;
473 }
474 if (isLastTileX && isLastTileY) {
475 tileMode = 3;
476 }
477
478 switch (fmt) {
479 case 0:
480 gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
481 if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
482 gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
483 } else {
484 gDPSetCombineMode(gMainGfxPos++, PM_CC_01, PM_CC_02);
485 }
486
487 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
488 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, hudElement->opacity);
489 }
490
491 if (!flipX && !flipY) {
492 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_RGBA, G_IM_SIZ_32b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
493 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
494 } else {
495 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_RGBA, G_IM_SIZ_32b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
496 G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
497 }
498 break;
499 case 1:
500 if (!dropShadow) {
501 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
502 gDPSetCombineMode(gMainGfxPos++, PM_CC_2F, PM_CC_32);
503 } else {
504 gDPSetCombineMode(gMainGfxPos++, PM_CC_2F, PM_CC_32);
505 }
506
507 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
508 gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
509 } else {
510 gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, 255);
511 }
512 } else {
513 gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
514 gDPSetCombineMode(gMainGfxPos++, PM_CC_07, PM_CC_07);
515 gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, 72);
516 }
517
518 if (!flipX && !flipY) {
519 if (!clamp) {
520 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
521 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
522 } else {
523 switch (tileMode) {
524 case 0:
525 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
526 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
527 break;
528 case 1:
529 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
530 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
531 break;
532 case 2:
533 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
534 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
535 break;
536 case 3:
537 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
538 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
539 break;
540 }
541 }
542 } else {
543 gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
544 G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
545 }
546 break;
547 case 2:
548 gDPSetCombineMode(gMainGfxPos++, PM_CC_47, PM_CC_47);
549 gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
550
551 if (!flipX && !flipY) {
552 if (!clamp) {
553 switch (tileMode) {
554 case 0:
555 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
556 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
557 break;
558 case 1:
559 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
560 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
561 break;
562 case 2:
563 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
564 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
565 break;
566 case 3:
567 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
568 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
569 break;
570 }
571 } else {
572 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
573 G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
574 }
575 } else {
576 gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
577 G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
578 }
579 break;
580 }
581
582 if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
583 gSPScisTextureRectangle(gMainGfxPos++, ulx * 4, uly * 4, lrx * 4, lry * 4, 0, texStartX * 32 + 16, texStartY * 32 + 16, widthScale, heightScale);
584 } else {
585 gSPScisTextureRectangle(gMainGfxPos++, ulx * 4, uly * 4, lrx * 4, lry * 4, 0, texStartX * 32, texStartY * 32, widthScale, heightScale);
586 }
587 if (isLastTileX) {
588 break;
589 }
590 ulx += 1024.0 / widthScale * 64.0;
591 uls += 64;
592 }
593
594 if (isLastTileY) {
595 break;
596 }
597
598 ult += 32;
599 uly += 1024.0 / heightScale * 32.0;
600 }
601
602 gDPPipeSync(gMainGfxPos++);
603}
#define PAL_PTR
#define IMG_PTR
Color_RGB8 tint
u8 * paletteAddr
Vec3b worldPosOffset
Vec2b screenPosOffset
s32 heightScale
X10.
s32 widthScale
X10.
#define PM_CC_07
Definition macros.h:282
#define SCREEN_WIDTH
Definition macros.h:105
#define PM_CC_01
Definition macros.h:276
#define SCREEN_HEIGHT
Definition macros.h:106
#define PM_CC_32
Definition macros.h:385
#define PM_CC_2F
Definition macros.h:384
#define PM_CC_47
Definition macros.h:474
#define PM_CC_02
Definition macros.h:277
Gfx * gMainGfxPos
Definition cam_main.c:15

Referenced by draw_hud_element_internal(), render_hud_elements_backUI(), and render_hud_elements_frontUI().

◆ hud_element_clear_cache()

void hud_element_clear_cache ( void )

Definition at line 605 of file hud_element.c.

605 {
606 HudCacheEntry* entryRaster;
607 HudCacheEntry* entryPalette;
608 s32 i;
609
615 } else {
620 }
621
627 entryRaster = gHudElementCacheTableRaster;
628 entryPalette = gHudElementCacheTablePalette;
629 for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
630 entryRaster[i].id = -1;
631 entryPalette[i].id = -1;
632 }
633 } else {
634 if (gHudElementAuxCache == NULL) {
637 } else {
639 }
642 entryRaster = gHudElementCacheTableRaster;
643 entryPalette = gHudElementCacheTablePalette;
644 for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
645 entryRaster[i].id = -1;
646 entryPalette[i].id = -1;
647 }
648 }
649
650 for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
651 (*gHudElements)[i] = NULL;
652 }
653
655 D_80159180 = 0;
657}
#define general_heap_malloc
BSS HudCacheEntry gHudElementCacheTablePaletteWorld[192]
void hud_element_setup_cam(void)
BSS HudCacheEntry gHudElementCacheTableRasterWorld[192]
BSS s32 D_80159180
BSS HudElementList * gHudElements
BSS u8 * gHudElementCacheBufferWorld
BSS HudElementList gHudElementsWorld
BSS s32 gHudElementCacheSizeBattle
BSS HudElementList gHudElementsBattle
BSS s32 gHudElementCacheSizeWorld
BSS HudCacheEntry gHudElementCacheTableRasterBattle[192]
BSS u8 * gHudElementCacheBufferBattle
u8 * gHudElementAuxCache
Definition hud_element.c:14
BSS HudCacheEntry gHudElementCacheTablePaletteBattle[192]
s32 gHudElementsNumber
#define ARRAY_COUNT(arr)
Definition macros.h:40

Referenced by load_demo_battle(), load_engine_data(), load_map_by_IDs(), state_init_file_select(), state_init_logos(), state_init_title_screen(), state_step_battle(), state_step_demo(), state_step_intro(), state_step_pause(), state_step_startup(), and state_step_title_screen().

◆ init_hud_element_list()

◆ hud_element_create()

s32 hud_element_create ( HudScript * anim)

Creates a new HUD element and returns its ID.

Definition at line 717 of file hud_element.c.

717 {
718 HudElement* hudElement;
719 s32 id;
720
721 for (id = 0; id < ARRAY_COUNT(*gHudElements); id++) {
722 if ((*gHudElements)[id] == NULL) {
723 break;
724 }
725 }
726
728
729 (*gHudElements)[id] = hudElement = heap_malloc(sizeof(*hudElement));
731
732 ASSERT(hudElement != NULL);
733
735 hudElement->readPos = anim;
736 if (anim == NULL) {
737 hudElement->readPos = &HES_Empty;
738 }
739 hudElement->updateTimer = 1;
740 hudElement->drawSizePreset = -1;
741 hudElement->tileSizePreset = -1;
742 hudElement->renderPosX = 0;
743 hudElement->renderPosY = 0;
744 hudElement->loopStartPos = anim;
745 hudElement->widthScale = X10(1.0f);
746 hudElement->heightScale = X10(1.0f);
747 hudElement->anim = hudElement->readPos;
748 hudElement->uniformScale = 1.0f;
749 hudElement->screenPosOffset.x = 0;
750 hudElement->screenPosOffset.y = 0;
751 hudElement->worldPosOffset.x = 0;
752 hudElement->worldPosOffset.y = 0;
753 hudElement->worldPosOffset.z = 0;
754 hudElement->opacity = 255;
755 hudElement->tint.r = 255;
756 hudElement->tint.g = 255;
757 hudElement->tint.b = 255;
758
760 hudElement->flags |= HUD_ELEMENT_FLAG_BATTLE;
762 }
763
764 hud_element_load_script(hudElement, hudElement->readPos);
765 while (hud_element_update(hudElement) != 0);
766
767 return id;
768}
void * heap_malloc(s32 size)
Definition heap.c:34
s32 hud_element_update(HudElement *hudElement)
void hud_element_load_script(HudElement *hudElement, HudScript *anim)
HudScript HES_Empty
Definition hud_element.c:17
HudScript * loopStartPos
HudScript * anim
#define HUD_ELEMENT_BATTLE_ID_MASK
Definition hud_element.h:7
HudScript * readPos
#define X10(f)
X.10 fixed-point literal.
Definition macros.h:174

Referenced by btl_main_menu_update(), btl_state_update_celebration(), btl_state_update_select_target(), btl_submenu_moves_update(), btl_update_message_popup(), btl_update_strats_menu(), create_status_icon_boost_hammer(), create_status_icon_boost_jump(), create_status_icon_boost_partner(), create_status_icon_danger(), create_status_icon_peril(), create_status_icon_surprise(), filemenu_choose_name_init(), filemenu_init(), filemenu_main_init(), initialize_battle(), initialize_status_bar(), pause_badges_init(), pause_init(), pause_items_init(), pause_map_init(), pause_partners_init(), pause_stats_init(), pause_tabs_init(), popup_menu_update(), show_coin_counter(), update_all_status_icons(), and update_item_entity_pickup().

◆ update_hud_elements()

void update_hud_elements ( void )

Definition at line 771 of file hud_element.c.

771 {
772 s32 i;
773
774 for (i = 0; i < ARRAY_COUNT(*gHudElements);) {
775 HudElement* elem = (*gHudElements)[i];
776
777 if (elem != NULL && elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
778 if (elem->flags & HUD_ELEMENT_FLAG_DELETE) {
780 i++;
781 } else if (elem->readPos != NULL) {
782 elem->updateTimer--;
783 if (elem->updateTimer == 0) {
784 while (hud_element_update(elem) != 0);
785 }
787 elem->unkImgScale[0] += elem->deltaSizeX;
788 elem->unkImgScale[1] += elem->deltaSizeY;
789 }
790 i++;
791 } else {
792 break;
793 }
794 } else {
795 i++;
796 }
797 }
798}
void hud_element_free(s32 id)
f32 unkImgScale[2]

Referenced by step_game_loop().

◆ hud_element_update()

s32 hud_element_update ( HudElement * hudElement)
Returns
0 if frame is completed

Definition at line 800 of file hud_element.c.

800 {
801 HudCacheEntry* entryRaster;
802 HudCacheEntry* entryPalette;
803 s32 i;
804 s32 drawSizePreset;
805 s32 tileSizePreset;
806 u8 sizePreset;
807 f32 xScaled, yScaled;
808 s32 imageWidth, imageHeight, drawWidth, drawHeight;
809 u32 flags;
810 s32 s1, s2;
811 s32 arg1, arg2;
812 f32 uniformScale;
813 HudScript* newReadPos;
814
815 HudTransform* hudTransform = hudElement->hudTransform;
816 s32* nextPos = (s32*)hudElement->readPos;
817
818 switch (*nextPos++) {
820 hudElement->updateTimer = 60;
821 flags = hudElement->flags;
823 break;
825 hudElement->updateTimer = 60;
826 hudElement->flags |= HUD_ELEMENT_FLAG_DELETE;
827 break;
829 hudElement->readPos = (HudScript*)nextPos;
830 hudElement->flags |= HUD_ELEMENT_FLAG_FMT_IA8;
831 return TRUE;
833 hudElement->readPos = (HudScript*)nextPos;
834 hudElement->flags |= HUD_ELEMENT_FLAG_FMT_CI4;
835 return TRUE;
837 hudElement->readPos = (HudScript*)nextPos;
838 hudElement->flags &= ~HUD_ELEMENT_FLAG_FMT_CI4;
839 return TRUE;
841 s1 = *nextPos++;
842 hudElement->readPos = (HudScript*)nextPos;
843 hudElement->flags |= s1;
844 return TRUE;
846 s1 = *nextPos++;
847 hudElement->readPos = (HudScript*)nextPos;
848 hudElement->flags &= ~s1;
849 return TRUE;
851 hudElement->updateTimer = *nextPos++;
852 hudElement->imageAddr = (u8*)*nextPos++;
853 hudElement->readPos = (HudScript*)nextPos;
854
855 if (hudElement->flags & HUD_ELEMENT_FLAG_MEMOFFSET) {
856 hudElement->imageAddr += hudElement->memOffset;
857 }
858
859 if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
860 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
861 tileSizePreset = hudElement->tileSizePreset;
862 drawSizePreset = hudElement->drawSizePreset;
863 imageWidth = gHudElementSizes[tileSizePreset].width;
864 imageHeight = gHudElementSizes[tileSizePreset].height;
865 drawWidth = gHudElementSizes[drawSizePreset].width;
866 drawHeight = gHudElementSizes[drawSizePreset].height;
867 } else {
868 imageWidth = hudElement->customImageSize.x;
869 imageHeight = hudElement->customImageSize.y;
870 drawWidth = hudElement->customDrawSize.x;
871 drawHeight = hudElement->customDrawSize.y;
872 }
873
874 if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
875 hudElement->flags |= HUD_ELEMENT_FLAG_200;
876 hudElement->unkImgScale[0] = imageWidth;
877 hudElement->unkImgScale[1] = imageHeight;
878 hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
879 hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
880 } else {
881 hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
882 hudElement->unkImgScale[0] = drawWidth;
883 hudElement->unkImgScale[1] = drawHeight;
884 hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
885 hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
886 }
887 }
888 break;
890 hudElement->updateTimer = *nextPos++;
891 hudElement->imageAddr = (u8*)*nextPos++;
892 hudElement->paletteAddr = (u8*)*nextPos++;
893 hudElement->readPos = (HudScript*)nextPos;
894
895 if (hudElement->flags & HUD_ELEMENT_FLAG_MEMOFFSET) {
896 hudElement->imageAddr += hudElement->memOffset;
897 hudElement->paletteAddr += hudElement->memOffset;
898 }
899
900 if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
901 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
902 tileSizePreset = hudElement->tileSizePreset;
903 drawSizePreset = hudElement->drawSizePreset;
904 imageWidth = gHudElementSizes[tileSizePreset].width;
905 imageHeight = gHudElementSizes[tileSizePreset].height;
906 drawWidth = gHudElementSizes[drawSizePreset].width;
907 drawHeight = gHudElementSizes[drawSizePreset].height;
908 } else {
909 imageWidth = hudElement->customImageSize.x;
910 imageHeight = hudElement->customImageSize.y;
911 drawWidth = hudElement->customDrawSize.x;
912 drawHeight = hudElement->customDrawSize.y;
913 }
914
915 if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
916 hudElement->flags |= HUD_ELEMENT_FLAG_200;
917 hudElement->unkImgScale[0] = imageWidth;
918 hudElement->unkImgScale[1] = imageHeight;
919 hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
920 hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
921 } else {
922 hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
923 hudElement->unkImgScale[0] = drawWidth;
924 hudElement->unkImgScale[1] = drawHeight;
925 hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
926 hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
927 }
928 }
929 break;
931 hudElement->updateTimer = *nextPos++;
932
933 if (!(hudElement->flags & HUD_ELEMENT_FLAG_BATTLE)) {
936 } else {
939 }
940
941 i = 0;
942 while (TRUE) {
943 if (entryRaster[i].id == *nextPos) {
944 break;
945 }
947 }
948
949 nextPos++;
950 hudElement->imageAddr = entryRaster[i].data;
951
952 i = 0;
953 while (TRUE) {
954 if (entryPalette[i].id == *nextPos) {
955 break;
956 }
958 }
959 hudElement->paletteAddr = entryPalette[i].data;
960 nextPos += 3;
961 hudElement->readPos = (HudScript*)nextPos;
962
963 if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
964 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
965 tileSizePreset = hudElement->tileSizePreset;
966 drawSizePreset = hudElement->drawSizePreset;
967 imageWidth = gHudElementSizes[tileSizePreset].width;
968 imageHeight = gHudElementSizes[tileSizePreset].height;
969 drawWidth = gHudElementSizes[drawSizePreset].width;
970 drawHeight = gHudElementSizes[drawSizePreset].height;
971 } else {
972 imageWidth = hudElement->customImageSize.x;
973 imageHeight = hudElement->customImageSize.y;
974 drawWidth = hudElement->customDrawSize.x;
975 drawHeight = hudElement->customDrawSize.y;
976 }
977
978 if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
979 hudElement->flags |= HUD_ELEMENT_FLAG_200;
980 hudElement->unkImgScale[0] = imageWidth;
981 hudElement->unkImgScale[1] = imageHeight;
982 hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
983 hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
984 } else {
985 hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
986 hudElement->unkImgScale[0] = drawWidth;
987 hudElement->unkImgScale[1] = drawHeight;
988 hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
989 hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
990 }
991 }
992 break;
994 hudElement->readPos = hudElement->loopStartPos;
995 return TRUE;
997 hudElement->loopStartPos = (HudScript*)nextPos;
998 hudElement->readPos = (HudScript*)nextPos;
999 return TRUE;
1001 s1 = *nextPos++;
1002 s2 = *nextPos++;
1003 if (rand_int(s1) < s2) {
1004 hudElement->readPos = hudElement->loopStartPos;
1005 } else {
1006 hudElement->readPos = (HudScript*)nextPos;
1007 }
1008 return TRUE;
1010 sizePreset = *nextPos++;
1011 hudElement->widthScale = X10(1);
1012 hudElement->heightScale = X10(1);
1013 hudElement->readPos = (HudScript*)nextPos;
1014 hudElement->drawSizePreset = sizePreset;
1015 hudElement->tileSizePreset = sizePreset;
1016 hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
1017 hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
1018 return TRUE;
1020 tileSizePreset = *nextPos++;
1021 arg2 = *nextPos++;
1022
1023 hudElement->readPos = (HudScript*)nextPos;
1024 hudElement->tileSizePreset = tileSizePreset;
1025 hudElement->drawSizePreset = arg2;
1026
1027 imageWidth = gHudElementSizes[tileSizePreset].width;
1028 imageHeight = gHudElementSizes[tileSizePreset].height;
1029 drawWidth = gHudElementSizes[arg2].width;
1030 drawHeight = gHudElementSizes[arg2].height;
1031
1032 xScaled = (f32) drawWidth / (f32) imageWidth;
1033 yScaled = (f32) drawHeight / (f32) imageHeight;
1034
1035 xScaled = 1.0f / xScaled;
1036 yScaled = 1.0f / yScaled;
1037
1038 hudElement->widthScale = X10(xScaled);
1039 hudElement->heightScale = X10(yScaled);
1040
1041 hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
1042 hudElement->flags |= HUD_ELEMENT_FLAG_REPEATED;
1043 return TRUE;
1045 tileSizePreset = *nextPos++;
1046 drawSizePreset = *nextPos++;
1047
1048 hudElement->widthScale = X10(1);
1049 hudElement->heightScale = X10(1);
1050 hudElement->readPos = (HudScript*)nextPos;
1051 hudElement->tileSizePreset = tileSizePreset;
1052 hudElement->drawSizePreset = drawSizePreset;
1053 hudElement->flags |= HUD_ELEMENT_FLAG_FIXEDSCALE;
1054 hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
1055 hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
1056 return TRUE;
1058 s1 = *nextPos++;
1059 hudElement->readPos = (HudScript*)nextPos;
1060 hudElement->screenPosOffset.x += s1;
1061 return TRUE;
1063 s2 = *nextPos++;
1064 if (!(hudElement->flags & HUD_ELEMENT_FLAG_FLIPY)) {
1065 hudElement->screenPosOffset.y += s2;
1066 } else {
1067 hudElement->screenPosOffset.y -= s2;
1068 }
1069 hudElement->readPos = (HudScript*)nextPos;
1070 return TRUE;
1072 s1 = *nextPos++;
1073 s2 = *nextPos++;
1074 hudElement->screenPosOffset.x = s1;
1075 if (!(hudElement->flags & HUD_ELEMENT_FLAG_FLIPY)) {
1076 hudElement->screenPosOffset.y = s2;
1077 } else {
1078 hudElement->screenPosOffset.y = -s2;
1079 }
1080 hudElement->readPos = (HudScript*)nextPos;
1081 return TRUE;
1083 uniformScale = (f32)*nextPos++;
1084 uniformScale /= 65536;
1085 hudElement->uniformScale = uniformScale;
1086 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1087 imageWidth = gHudElementSizes[hudElement->tileSizePreset].width;
1088 imageHeight = gHudElementSizes[hudElement->tileSizePreset].height;
1089 drawWidth = gHudElementSizes[hudElement->drawSizePreset].width;
1090 drawHeight = gHudElementSizes[hudElement->drawSizePreset].height;
1091 } else {
1092 imageWidth = hudElement->customImageSize.x;
1093 imageHeight = hudElement->customImageSize.y;
1094 drawWidth = hudElement->customDrawSize.x;
1095 drawHeight = hudElement->customDrawSize.y;
1096 }
1097
1098 hudElement->sizeX = drawWidth * uniformScale;
1099 hudElement->sizeY = drawHeight * uniformScale;
1100
1101 xScaled = (f32) drawWidth / (f32) imageWidth * uniformScale;
1102 yScaled = (f32) drawHeight / (f32) imageHeight * uniformScale;
1103
1104 xScaled = 1.0f / xScaled;
1105 yScaled = 1.0f / yScaled;
1106
1107 hudElement->widthScale = X10(xScaled);
1108 hudElement->heightScale = X10(yScaled);
1109
1110 hudElement->readPos = (HudScript*)nextPos;
1111 hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
1113 return TRUE;
1115 s1 = *nextPos++;
1116 hudElement->opacity = s1;
1117 hudElement->flags |= HUD_ELEMENT_FLAG_TRANSPARENT;
1118 if (hudElement->opacity == 255) {
1119 hudElement->flags &= ~HUD_ELEMENT_FLAG_TRANSPARENT;
1120 }
1121 hudElement->readPos = (HudScript*)nextPos;
1122 return TRUE;
1124 s1 = *nextPos++;
1125 s2 = *nextPos++;
1126 hudElement->updateTimer = rand_int(s2 - s1) + s1;
1127 hudElement->readPos = (HudScript*)nextPos;
1128 break;
1130 hudElement->customDrawSize.x = hudElement->customImageSize.x = *nextPos++;
1131 hudElement->customDrawSize.y = hudElement->customImageSize.y = *nextPos++;
1132 hudElement->readPos = (HudScript*)nextPos;
1133 hudElement->widthScale = X10(1);
1134 hudElement->heightScale = X10(1);
1135 hudElement->drawSizePreset = 0;
1136 hudElement->tileSizePreset = 0;
1137 hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
1138 hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
1139 hudElement->flags |= HUD_ELEMENT_FLAG_CUSTOM_SIZE;
1140 return TRUE;
1142 s1 = *nextPos++;
1143 hudElement->readPos = (HudScript*)nextPos;
1145 hudElement->flags |= s1 << 24;
1146 return TRUE;
1148 s1 = *nextPos++;
1149 newReadPos = (HudScript*)nextPos[rand_int(s1 - 1)];
1150 hudElement->readPos = newReadPos;
1151 hud_element_load_script(hudElement, newReadPos);
1152 return TRUE;
1154 arg2 = *nextPos++;
1155 sfx_play_sound(arg2);
1156 hudElement->readPos = (HudScript*)nextPos;
1157 return TRUE;
1159 arg1 = *nextPos++;
1160 arg2 = *nextPos++;
1161 hudElement->readPos = (HudScript*)nextPos;
1162 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
1163 hudTransform->pivot.x = arg1;
1164 hudTransform->pivot.y = arg2;
1165 }
1166 return TRUE;
1168 break;
1169 }
1170
1171 return FALSE;
1172}
s8 flags
Definition demo_api.c:15
#define rand_int
HudTransform * hudTransform
s32 HudScript[]
Definition hud_element.h:9
void sfx_play_sound(s32 soundID)
Definition sfx.c:517

Referenced by hud_element_create(), hud_element_set_script(), and update_hud_elements().

◆ render_hud_elements_backUI()

void render_hud_elements_backUI ( void )

Definition at line 1174 of file hud_element.c.

1174 {
1175 s32 i, count, j;
1176 s32 sortedElements[ARRAY_COUNT(*gHudElements)];
1177 s32 el1, el2;
1178 s32 texSizeX, texSizeY;
1179 s32 drawSizeX, drawSizeY, offsetX, offsetY;
1180 HudElement* hudElement;
1181
1182 D_80159180++;
1183 if (D_80159180 > 2) {
1184 D_80159180 = 0;
1185 }
1187
1188 count = 0;
1189 for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
1190 hudElement = (*gHudElements)[i];
1191 if (hudElement != NULL) {
1192 s32 flags = hudElement->flags;
1195 if (!(flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0) {
1196 sortedElements[count++] = i;
1197 }
1198 }
1199 }
1200 }
1201 }
1202
1203 for (i = 0; i < count - 1; i++) {
1204 for (j = i + 1; j < count; j++) {
1205 el1 = sortedElements[i];
1206 el2 = sortedElements[j];
1207 if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
1208 sortedElements[i] = el2;
1209 sortedElements[j] = el1;
1210 }
1211 }
1212 }
1213
1214 for (i = 0; i < count; i++) {
1215 hudElement = (*gHudElements)[sortedElements[i]];
1216
1217 if (hudElement->readPos == NULL) {
1218 break;
1219 }
1220
1221 if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
1222 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1223 texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
1224 texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
1225 } else {
1226 texSizeX = hudElement->customImageSize.x;
1227 texSizeY = hudElement->customImageSize.y;
1228 }
1229
1230 if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
1231 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1232 drawSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
1233 drawSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
1234 offsetX = -drawSizeX / 2;
1235 offsetY = -drawSizeY / 2;
1236 } else {
1237 drawSizeX = hudElement->customDrawSize.x;
1238 drawSizeY = hudElement->customDrawSize.y;
1239 offsetX = -drawSizeX / 2;
1240 offsetY = -drawSizeY / 2;
1241 }
1242 } else {
1243 drawSizeX = hudElement->sizeX;
1244 drawSizeY = hudElement->sizeY;
1245 offsetX = -drawSizeX / 2;
1246 offsetY = -drawSizeY / 2;
1247 }
1248
1249 if (!(hudElement->flags & HUD_ELEMENT_FLAG_REPEATED)) {
1250 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1251 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
1252 }
1253 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
1254 } else {
1255 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1256 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1257 }
1258 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1259 }
1260 } else {
1261 f32 xScaled, yScaled;
1262
1263 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1264 texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
1265 texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
1266 } else {
1267 texSizeX = hudElement->customImageSize.x;
1268 texSizeY = hudElement->customImageSize.y;
1269 }
1270
1271 drawSizeX = hudElement->unkImgScale[0];
1272 drawSizeY = hudElement->unkImgScale[1];
1273
1274 offsetX = -hudElement->unkImgScale[0] / 2;
1275 offsetY = -hudElement->unkImgScale[1] / 2;
1276
1277 xScaled = (f32) drawSizeX / (f32) texSizeX;
1278 yScaled = (f32) drawSizeY / (f32) texSizeY;
1279
1280 xScaled = 1.0f / xScaled;
1281 yScaled = 1.0f / yScaled;
1282
1283 hudElement->widthScale = X10(xScaled);
1284 hudElement->heightScale = X10(yScaled);
1285
1286 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1287 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1288 }
1289 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1290 }
1291 }
1292}
Gfx gHudElementsDLBackUI[]
Definition hud_element.c:51
void hud_element_draw_rect(HudElement *hudElement, s16 texSizeX, s16 texSizeY, s16 drawSizeX, s16 drawSizeY, s16 offsetX, s16 offsetY, s32 clamp, s32 dropShadow)
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47

Referenced by gfx_draw_frame().

◆ render_hud_elements_frontUI()

void render_hud_elements_frontUI ( void )

Definition at line 1294 of file hud_element.c.

1294 {
1295 s32 i, count, j;
1296 s32 sortedElements[ARRAY_COUNT(*gHudElements)];
1297 s32 el1, el2;
1298 s32 texSizeX, texSizeY;
1299 s32 drawSizeX, drawSizeY, offsetX, offsetY;
1300 HudElement* hudElement;
1301
1303
1304 count = 0;
1305 for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
1306 hudElement = (*gHudElements)[i];
1307 if (hudElement != NULL) {
1308 s32 flags = hudElement->flags;
1311 if ((flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0) {
1312 sortedElements[count++] = i;
1313 }
1314 }
1315 }
1316 }
1317 }
1318
1319 for (i = 0; i < count - 1; i++) {
1320 for (j = i + 1; j < count; j++) {
1321 el1 = sortedElements[i];
1322 el2 = sortedElements[j];
1323 if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
1324 sortedElements[i] = el2;
1325 sortedElements[j] = el1;
1326 }
1327 }
1328 }
1329
1330 for (i = 0; i < count; i++) {
1331 hudElement = (*gHudElements)[sortedElements[i]];
1332 if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
1333 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1334 texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
1335 texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
1336 } else {
1337 texSizeX = hudElement->customImageSize.x;
1338 texSizeY = hudElement->customImageSize.y;
1339 }
1340
1341 if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
1342 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1343 drawSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
1344 drawSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
1345 offsetX = -drawSizeX / 2;
1346 offsetY = -drawSizeY / 2;
1347 } else {
1348 drawSizeX = hudElement->customDrawSize.x;
1349 drawSizeY = hudElement->customDrawSize.y;
1350 offsetX = -drawSizeX / 2;
1351 offsetY = -drawSizeY / 2;
1352 }
1353 } else {
1354 drawSizeX = hudElement->sizeX;
1355 drawSizeY = hudElement->sizeY;
1356 offsetX = -drawSizeX / 2;
1357 offsetY = -drawSizeY / 2;
1358 }
1359
1360 if (!(hudElement->flags & HUD_ELEMENT_FLAG_REPEATED)) {
1361 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1362 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
1363 }
1364 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
1365 } else {
1366 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1367 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1368 }
1369 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1370 }
1371 } else {
1372 f32 xScaled, yScaled;
1373
1374 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1375 texSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
1376 texSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
1377 } else {
1378 texSizeX = hudElement->customImageSize.x;
1379 texSizeY = hudElement->customImageSize.y;
1380 }
1381
1382 drawSizeX = hudElement->unkImgScale[0];
1383 drawSizeY = hudElement->unkImgScale[1];
1384
1385 offsetX = -hudElement->unkImgScale[0] / 2;
1386 offsetY = -hudElement->unkImgScale[1] / 2;
1387
1388 xScaled = (f32) drawSizeX / (f32) texSizeX;
1389 yScaled = (f32) drawSizeY / (f32) texSizeY;
1390
1391 xScaled = 1.0f / xScaled;
1392 yScaled = 1.0f / yScaled;
1393
1394 hudElement->widthScale = X10(xScaled);
1395 hudElement->heightScale = X10(yScaled);
1396
1397 if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1398 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1399 }
1400 hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1401 }
1402 }
1403}
Gfx gHudElementsDLFrontUI[]
Definition hud_element.c:58

Referenced by gfx_draw_frame().

◆ render_hud_element()

void render_hud_element ( HudElement * hudElement)

Definition at line 1405 of file hud_element.c.

1405 {
1406 Matrix4f sp20;
1407 Matrix4f sp60;
1408 Matrix4f spA0;
1409 Matrix4f spE0;
1410 Matrix4f sp120;
1411 Matrix4f sp160;
1412 Matrix4f sp1A0;
1413 Matrix4f sp1E0;
1414 Matrix4f sp220;
1415 Matrix4f sp260;
1416 ImgFXTexture ifxImg;
1417 f32 xScaleFactor, yScaleFactor;
1418 s32 height, width;
1419 HudTransform* transform;
1420 s32 mode;
1421 PAL_PTR palette;
1422 u32 a0, v1;
1423 Vtx* vtx;
1424 Vtx* vtx2;
1425
1426 if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
1427 gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
1428 } else {
1429 gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
1430 }
1431
1432 if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
1433 xScaleFactor = 1.0f;
1434 yScaleFactor = 1.0f;
1435 } else {
1436 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1437 xScaleFactor = gHudElementSizes[hudElement->tileSizePreset].width;
1438 yScaleFactor = gHudElementSizes[hudElement->tileSizePreset].height;
1439 } else {
1440 xScaleFactor = hudElement->customImageSize.x;
1441 yScaleFactor = hudElement->customImageSize.y;
1442 }
1443 xScaleFactor /= hudElement->unkImgScale[0];
1444 xScaleFactor = 1.0f / xScaleFactor;
1445 yScaleFactor /= hudElement->unkImgScale[1];
1446 yScaleFactor = 1.0f / yScaleFactor;
1447 }
1448
1449 if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1450 width = gHudElementSizes[hudElement->tileSizePreset].width;
1451 height = gHudElementSizes[hudElement->tileSizePreset].height;
1452 } else {
1453 width = hudElement->customImageSize.x;
1454 height = hudElement->customImageSize.y;
1455 }
1456
1457 transform = hudElement->hudTransform;
1458
1459 guTranslateF(sp1E0, transform->pivot.x, -transform->pivot.y, 0.0f);
1460 guTranslateF(sp220, -transform->pivot.x, transform->pivot.y, 0.0f);
1462 sp1A0,
1463 hudElement->renderPosX + hudElement->screenPosOffset.x + hudElement->worldPosOffset.x + transform->pos.x,
1464 -hudElement->renderPosY - hudElement->screenPosOffset.y + hudElement->worldPosOffset.y + transform->pos.y,
1465 - (hudElement->worldPosOffset.z / 10.0) + transform->pos.z
1466 );
1467 guScaleF(sp260, hudElement->uniformScale * xScaleFactor * transform->scale.x,
1468 hudElement->uniformScale * yScaleFactor * transform->scale.y,
1469 transform->scale.z);
1470 guRotateF(sp120, transform->rot.y, 0.0f, 1.0f, 0.0f);
1471 guRotateF(sp160, transform->rot.z, 0.0f, 0.0f, 1.0f);
1472 guRotateF(spE0, transform->rot.x, 1.0f, 0.0f, 0.0f);
1473 guMtxCatF(sp160, spE0, sp20);
1474 guMtxCatF(sp20, sp120, spA0);
1475 guMtxCatF(sp260, sp1E0, sp20);
1476 guMtxCatF(sp20, spA0, sp60);
1477 guMtxCatF(sp60, sp220, sp20);
1478 guMtxCatF(sp20, sp1A0, sp60);
1481 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
1482
1483 mode = 0;
1484 a0 = mode;
1485 a0 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_CI4) > a0;
1486 v1 = mode < (hudElement->flags & HUD_ELEMENT_FLAG_FMT_IA8);
1487
1488 if (a0 == TRUE) {
1489 mode = (v1 < 1);
1490 }
1491 if (a0 == FALSE) {
1492 if (v1 == TRUE) {
1493 mode = 2;
1494 }
1495 }
1496
1497 if (a0 == TRUE) {
1498 if (v1 == a0) {
1499 mode = 2;
1500 }
1501 }
1502
1503 switch (mode) {
1504 case 1:
1505 if (hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD) {
1506 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
1507 imgfx_update(0, IMGFX_SET_ALPHA, 255, 255, 255, hudElement->opacity, 0);
1508 } else {
1509 imgfx_update(0, IMGFX_CLEAR, 0, 0, 0, 0, 0);
1510 }
1511 } else {
1512 if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
1513 imgfx_update(transform->imgfxIdx, IMGFX_SET_ALPHA, 255, 255, 255, hudElement->opacity, 0);
1514 } else {
1515 imgfx_update(transform->imgfxIdx, IMGFX_CLEAR, 0, 0, 0, 0, 0);
1516 }
1517 }
1518
1519 ifxImg.raster = hudElement->imageAddr;
1520 palette = (u16*) hudElement->paletteAddr;
1521 ifxImg.width = width;
1522 ifxImg.height = height;
1523 ifxImg.xOffset = -width / 2;
1524 ifxImg.yOffset = height / 2;
1525 ifxImg.alpha = 255;
1526 ifxImg.palette = palette;
1527
1528 if (hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD) {
1529 if (hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING) {
1530 imgfx_appendGfx_component(0, &ifxImg, IMGFX_FLAG_40, sp60);
1531 } else {
1532 imgfx_appendGfx_component(0, &ifxImg, IMGFX_FLAG_40, sp60);
1533 }
1534 } else {
1535 imgfx_appendGfx_component(transform->imgfxIdx, &ifxImg, IMGFX_FLAG_40, sp60);
1536 }
1537 break;
1538 case 2:
1539 transform->unk_30[D_80159180].vtx[0] = D_8014F0C8[0];
1540 transform->unk_30[D_80159180].vtx[1] = D_8014F0C8[1];
1541 transform->unk_30[D_80159180].vtx[2] = D_8014F0C8[2];
1542 transform->unk_30[D_80159180].vtx[3] = D_8014F0C8[3];
1543
1544 vtx2 = transform->unk_30[D_80159180].vtx;
1545 vtx = vtx2;
1546
1547 vtx2->v.ob[0] = -width / 2;
1548 vtx2->v.ob[1] = -height / 2;
1549 vtx2->v.ob[2] = 0;
1550 vtx2->v.tc[0] = 0;
1551 vtx2->v.tc[1] = height * 32;
1552 vtx2 = vtx2 + 1;
1553 vtx2[0].v.ob[0] = (width / 2) - 1;
1554 vtx2[0].v.ob[1] = -height / 2;
1555 vtx2[0].v.ob[2] = 0;
1556 vtx2[0].v.tc[0] = width * 32;
1557 vtx2[0].v.tc[1] = height * 32;
1558 vtx[2].v.ob[0] = (width / 2) - 1;
1559 vtx[2].v.ob[1] = (height / 2) - 1;
1560 vtx[2].v.ob[2] = 0;
1561 vtx[2].v.tc[0] = width * 32;
1562 vtx[2].v.tc[1] = 0;
1563 vtx[3].v.ob[0] = -width / 2;
1564 vtx[3].v.ob[1] = (height / 2) - 1;
1565 vtx[3].v.ob[2] = 0;
1566 vtx[3].v.tc[0] = 0;
1567 vtx[3].v.tc[1] = 0;
1568
1569 gDPPipeSync(gMainGfxPos++);
1570 gDPSetCombineMode(gMainGfxPos++, PM_CC_47, PM_CC_47);
1571 gDPSetPrimColor(gMainGfxPos++, 0, 0,
1572 hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
1573
1574 if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
1575 if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
1576 gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
1577 } else {
1578 gDPSetRenderMode(gMainGfxPos++, G_RM_AA_TEX_EDGE, G_RM_AA_TEX_EDGE2);
1579 }
1580 } else {
1581 if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
1582 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
1583 } else {
1584 gDPSetRenderMode(gMainGfxPos++, AA_EN | G_RM_CLD_SURF, AA_EN | G_RM_CLD_SURF2);
1585 }
1586 }
1587
1588 gDPLoadTextureBlock(gMainGfxPos++, hudElement->imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0,
1589 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
1590 G_TX_NOLOD, G_TX_NOLOD);
1591
1592 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
1593 gSPVertex(gMainGfxPos++, &transform->unk_30[D_80159180], 4, 0);
1594 gSP1Triangle(gMainGfxPos++, 0, 1, 2, 0);
1595 gSP1Triangle(gMainGfxPos++, 0, 2, 3, 0);
1596 break;
1597 }
1598
1599 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
1600 gDPPipeSync(gMainGfxPos++);
1601}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
@ IMGFX_SET_ALPHA
Definition enums.h:5124
@ IMGFX_CLEAR
Definition enums.h:5117
@ IMGFX_FLAG_40
Definition enums.h:5099
s32 imgfx_appendGfx_component(s32, ImgFXTexture *, u32, Matrix4f)
Definition imgfx.c:704
void imgfx_update(u32, ImgFXType, s32, s32, s32, s32, s32)
Definition imgfx.c:487
Vtx D_8014F0C8[]
Definition hud_element.c:66
VtxRect unk_30[3]
Vtx vtx[4]
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by func_80143C48(), and render_transformed_hud_elements().

◆ render_transformed_hud_elements()

void render_transformed_hud_elements ( void )

Definition at line 1603 of file hud_element.c.

1603 {
1604 s32 i, count, j;
1605 s32 sortedElements[ARRAY_COUNT(*gHudElements)];
1606 s32 el1, el2;
1607 HudElement* hudElement;
1608 s32 flags;
1609
1610 count = 0;
1611 if (gCurrentCamID == CAM_HUD) {
1612 for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
1613 hudElement = (*gHudElements)[i];
1614 if (hudElement == NULL) {
1615 continue;
1616 }
1617
1618 flags = hudElement->flags;
1619 if (flags == 0 || flags & HUD_ELEMENT_FLAG_DISABLED) {
1620 continue;
1621 }
1622
1624 continue;
1625 }
1626
1628 continue;
1629 }
1630
1632 continue;
1633 }
1634
1636 continue;
1637 }
1638
1639 // add element to list
1640 sortedElements[count++] = i;
1641 }
1642
1643 if (count != 0) {
1644 for (i = 0; i < count - 1; i++) {
1645 for (j = i + 1; j < count; j++) {
1646 el1 = sortedElements[i];
1647 el2 = sortedElements[j];
1648
1649 if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
1650 sortedElements[i] = el2;
1651 sortedElements[j] = el1;
1652 }
1653 }
1654 }
1655
1656 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
1657 gDPPipeSync(gMainGfxPos++);
1658 gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
1659 gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
1660 gSPSetLights1(gMainGfxPos++, HudElementLights);
1661 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
1662 gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
1663 gSPSetOtherMode(gMainGfxPos++, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE);
1664
1665 for (i = 0; i < count; i++) {
1666 render_hud_element((*gHudElements)[sortedElements[i]]);
1667 }
1668 }
1669 }
1670
1671 count = 0;
1672 if (gCurrentCamID == CAM_BATTLE) {
1673 for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
1674 hudElement = (*gHudElements)[i];
1675 if (hudElement == NULL) {
1676 continue;
1677 }
1678
1679 flags = hudElement->flags;
1680 if (flags == 0 || flags & HUD_ELEMENT_FLAG_DISABLED) {
1681 continue;
1682 }
1683
1685 continue;
1686 }
1687
1689 continue;
1690 }
1691
1692 // different from CAM_HUD pass
1694 continue;
1695 }
1696
1698 continue;
1699 }
1700
1701 // add element to list
1702 sortedElements[count++] = i;
1703 }
1704
1705 if (count != 0) {
1706 for (i = 0; i < count - 1; i++) {
1707 for (j = i + 1; j < count; j++) {
1708 el1 = sortedElements[i];
1709 el2 = sortedElements[j];
1710
1711 if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
1712 sortedElements[i] = el2;
1713 sortedElements[j] = el1;
1714 }
1715 }
1716 }
1717
1718 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
1719 gDPPipeSync(gMainGfxPos++);
1720 gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
1721 gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
1722 gSPSetLights1(gMainGfxPos++, HudElementLights);
1723 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
1724 gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
1725 gSPSetOtherMode(gMainGfxPos++, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE);
1726
1727 for (i = 0; i < count; i++) {
1728 render_hud_element((*gHudElements)[sortedElements[i]]);
1729 }
1730 }
1731 }
1732}
@ CAM_HUD
Definition enums.h:1803
@ CAM_BATTLE
Definition enums.h:1801
void render_hud_element(HudElement *hudElement)
Lights1 HudElementLights
s16 gCurrentCamID
Definition cam_main.c:13

Referenced by render_frame().

◆ func_80143C48()

void func_80143C48 ( s32 arg0,
s32 arg1,
s32 camID )

Definition at line 1734 of file hud_element.c.

1734 {
1735 Camera* camera = &gCameras[camID];
1736
1737 if (arg1 > 0) {
1738 if (camera->flags == 0 || (camera->flags & CAMERA_FLAG_DISABLED)) {
1739 return;
1740 }
1741
1742 gCurrentCamID = camID;
1743
1744 gSPViewport(gMainGfxPos++, &camera->vp);
1745 gSPClearGeometryMode(gMainGfxPos++, G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
1746 G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
1747 gSPTexture(gMainGfxPos++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
1748 gDPPipelineMode(gMainGfxPos++, G_PM_NPRIMITIVE);
1749 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
1750 gDPSetTextureFilter(gMainGfxPos++, G_TF_BILERP);
1751 gDPSetCombineMode(gMainGfxPos++, G_CC_SHADE, G_CC_SHADE);
1752 gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
1753 gSPClipRatio(gMainGfxPos++, FRUSTRATIO_2);
1754 gDPPipeSync(gMainGfxPos++);
1755 //clear Z buffer inside camera viewport
1756 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
1757 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxZBuffer));
1758 gDPSetFillColor(gMainGfxPos++, GPACK_ZDZ(G_MAXFBZ, 0)<<16 | GPACK_ZDZ(G_MAXFBZ, 0));
1759 gDPFillRectangle(gMainGfxPos++, camera->viewportStartX, camera->viewportStartY,
1760 camera->viewportStartX + camera->viewportW - 1,
1761 camera->viewportStartY + camera->viewportH - 1);
1762 gDPPipeSync(gMainGfxPos++);
1763
1764 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
1765 gDPPipeSync(gMainGfxPos++);
1766
1767 guOrthoF(camera->mtxPerspective, 0.0f, 320.0f, -240.0f, 0.0f, -1000.0f, 1000.0f, 1.0f);
1769
1770 gSPMatrix(gMainGfxPos++, &gDisplayContext->camPerspMatrix[gCurrentCamID], G_MTX_NOPUSH | G_MTX_LOAD |
1771 G_MTX_PROJECTION);
1772 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
1773 gDPPipeSync(gMainGfxPos++);
1774 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
1775 gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING |
1776 G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
1777 gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
1778 gSPSetLights1(gMainGfxPos++, HudElementLights);
1779 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
1780 gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
1781 gDPSetTexturePersp(gMainGfxPos++, G_TP_PERSP);
1782 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
1783 gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
1784 gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
1785 gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
1786 gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
1787 }
1788
1789 if (elemID >= 0) {
1790 HudElement* elem;
1791
1792 elemID &= ~HUD_ELEMENT_BATTLE_ID_MASK;
1793 elem = (*gHudElements)[elemID];
1794
1795 if (elem == NULL) {
1796 return;
1797 }
1798
1799 if (elem->flags == 0 || elem->flags & HUD_ELEMENT_FLAG_DISABLED) {
1800 return;
1801 }
1802
1804 return;
1805 }
1806
1807 if (!(elem->flags & HUD_ELEMENT_FLAG_TRANSFORM)) {
1808 return;
1809 }
1810
1811 if (elem->flags & HUD_ELEMENT_FLAG_FRONTUI || elem->drawSizePreset < 0 || !(elem->flags & HUD_ELEMENT_FLAG_80)) {
1812 return;
1813 }
1814
1815 render_hud_element(elem);
1816 }
1817}
u16 * nuGfxCfb_ptr
Definition cam_main.c:14
#define guOrthoF
@ CAMERA_FLAG_DISABLED
Definition enums.h:4721
u16 * nuGfxZBuffer
Definition main.c:46
s16 viewportStartX
s16 viewportStartY
Matrix4f mtxPerspective
Camera gCameras[4]
Definition cam_main.c:17

Referenced by func_80144218(), func_80144238(), func_80144258(), and func_80144278().

◆ func_80144218()

void func_80144218 ( s32 arg0)

Definition at line 1819 of file hud_element.c.

1819 {
1820 func_80143C48(id, 1, CAM_HUD);
1821}
void func_80143C48(s32 elemID, s32 arg1, s32 camID)

Referenced by btl_main_menu_draw(), btl_message_popup_draw_content(), and btl_state_draw_celebration().

◆ func_80144238()

void func_80144238 ( s32 arg0)

Definition at line 1823 of file hud_element.c.

1823 {
1824 func_80143C48(id, 0, CAM_HUD);
1825}

Referenced by btl_main_menu_draw(), and btl_state_draw_celebration().

◆ func_80144258()

void func_80144258 ( s32 arg0)

Definition at line 1827 of file hud_element.c.

1827 {
1828 func_80143C48(id, 1, CAM_BATTLE);
1829}

◆ func_80144278()

void func_80144278 ( s32 arg0)

Definition at line 1831 of file hud_element.c.

1831 {
1832 func_80143C48(id, 0, CAM_BATTLE);
1833}

◆ draw_hud_element_internal()

void draw_hud_element_internal ( s32 id,
s32 clipMode )

Definition at line 1835 of file hud_element.c.

1835 {
1836 HudElement* elem = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
1837 s32 texSizeX, texSizeY;
1838 s32 drawSizeX, drawSizeY;
1839 s32 offsetX, offsetY;
1840 s32 preset;
1841
1842 if (elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
1843 if (!(elem->flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000)) && (elem->drawSizePreset >= 0)) {
1844 if (clipMode != HUD_ELEMENT_DRAW_NEXT) {
1845 if (clipMode == HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING) {
1846 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, SCREEN_WIDTH - 12, SCREEN_HEIGHT - 20);
1847 }
1848 gDPPipeSync(gMainGfxPos++);
1849 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
1850 gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
1851 gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
1852 gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
1853 gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
1854 gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
1855 gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
1856 gDPNoOp(gMainGfxPos++);
1857 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
1858 gDPSetAlphaDither(gMainGfxPos++, G_AD_DISABLE);
1859 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
1860 }
1861
1862 if (!(elem->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
1863 if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1864 preset = elem->tileSizePreset;
1865 texSizeX = gHudElementSizes[preset].width;
1866 texSizeY = gHudElementSizes[preset].height;
1867 } else {
1868 texSizeX = elem->customImageSize.x;
1869 texSizeY = elem->customImageSize.y;
1870 }
1871
1872 if (!(elem->flags & HUD_ELEMENT_FLAG_SCALED)) {
1873 if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1874 drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
1875 drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
1876 } else {
1877 drawSizeX = elem->customDrawSize.x;
1878 drawSizeY = elem->customDrawSize.y;
1879 }
1880 } else {
1881 drawSizeX = elem->sizeX;
1882 drawSizeY = elem->sizeY;
1883 }
1884
1885 offsetX = -drawSizeX / 2;
1886 offsetY = -drawSizeY / 2;
1887
1888 if (!(elem->flags & HUD_ELEMENT_FLAG_REPEATED)) {
1889 if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1890 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
1891 }
1892 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
1893 } else {
1894 if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1895 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1896 }
1897 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1898 }
1899 } else {
1900 f32 xScaled, yScaled;
1901
1902 if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
1903 preset = elem->tileSizePreset;
1904 texSizeX = gHudElementSizes[preset].width;
1905 texSizeY = gHudElementSizes[preset].height;
1906 } else {
1907 texSizeX = elem->customImageSize.x;
1908 texSizeY = elem->customImageSize.y;
1909 }
1910
1911 drawSizeX = elem->unkImgScale[0];
1912 drawSizeY = elem->unkImgScale[1];
1913
1914 offsetX = -elem->unkImgScale[0] / 2;
1915 offsetY = -elem->unkImgScale[1] / 2;
1916
1917 xScaled = (f32) drawSizeX / (f32) texSizeX;
1918 yScaled = (f32) drawSizeY / (f32) texSizeY;
1919
1920 xScaled = 1.0f / xScaled;
1921 yScaled = 1.0f / yScaled;
1922
1923 elem->widthScale = X10(xScaled);
1924 elem->heightScale = X10(yScaled);
1925
1926 if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
1927 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
1928 }
1929 hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
1930 }
1931 }
1932 }
1933}

Referenced by hud_element_draw_clipped(), hud_element_draw_next(), and hud_element_draw_without_clipping().

◆ hud_element_draw_clipped()

◆ hud_element_draw_next()

◆ hud_element_draw_without_clipping()

◆ hud_element_set_script()

void hud_element_set_script ( s32 id,
HudScript * anim )

Definition at line 1947 of file hud_element.c.

1947 {
1948 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
1949
1950 if (anim == NULL) {
1951 anim = &HES_Empty;
1952 }
1953
1954 hudElement->updateTimer = 1;
1955 hudElement->widthScale = X10(1.0f);
1956 hudElement->heightScale = X10(1.0f);
1957 hudElement->readPos = anim;
1958 hudElement->anim = anim;
1959 hudElement->loopStartPos = anim;
1960 hudElement->screenPosOffset.x = 0;
1961 hudElement->screenPosOffset.y = 0;
1962 hudElement->worldPosOffset.x = 0;
1963 hudElement->worldPosOffset.y = 0;
1964 hudElement->flags &= ~HUD_ELEMENT_FLAG_ANIMATION_FINISHED;
1965 hudElement->uniformScale = 1.0f;
1967 hud_element_load_script(hudElement, anim);
1968
1969 while (hud_element_update(hudElement) != 0) {}
1970}

Referenced by btl_draw_enemy_health_bars(), btl_menu_moves_draw_content(), btl_state_draw_celebration(), btl_state_draw_select_target(), btl_state_update_celebration(), btl_state_update_select_target(), btl_submenu_moves_update(), btl_update_message_popup(), btl_update_starpoints_display(), btl_update_strats_menu(), draw(), func_800F16CC(), func_802A2910(), func_802A2AB8(), func_802A47E0(), func_802A48FC(), pause_badges_draw_contents(), pause_items_draw_contents(), pause_stats_draw_contents(), pause_textbox_draw_contents(), popup_menu_draw_menu_contents(), popup_menu_update(), remove_status_icon_boost_hammer(), remove_status_icon_boost_jump(), status_bar_draw_number(), status_bar_draw_stat(), update(), update_all_status_icons(), update_item_entity_pickup(), and update_status_bar().

◆ hud_element_get_script()

HudScript * hud_element_get_script ( s32 id)

Definition at line 1972 of file hud_element.c.

1972 {
1973 return (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->anim;
1974}

Referenced by btl_state_draw_celebration(), btl_state_draw_select_target(), btl_update_starpoints_display(), draw(), and update().

◆ get_hud_element()

HudElement * get_hud_element ( s32 id)

Definition at line 1976 of file hud_element.c.

1976 {
1977 return (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
1978}

Referenced by update_all_status_icons().

◆ hud_element_free()

◆ hud_element_set_render_pos()

void hud_element_set_render_pos ( s32 id,
s32 x,
s32 y )

Definition at line 1990 of file hud_element.c.

1990 {
1991 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
1992
1993 hudElement->renderPosX = x;
1994 hudElement->renderPosY = y;
1995}

Referenced by btl_draw_enemy_health_bars(), btl_main_menu_draw(), btl_main_menu_update(), btl_menu_moves_draw_content(), btl_menu_moves_show_icon(), btl_menu_strats_draw_content(), btl_message_popup_draw_content(), btl_state_draw_celebration(), btl_state_draw_select_target(), btl_state_update_celebration(), btl_state_update_select_target(), btl_submenu_moves_update(), btl_update_message_popup(), btl_update_starpoints_display(), btl_update_strats_menu(), coin_counter_draw_content(), draw(), draw_all_status_icons(), draw_content_pickup_item_header(), draw_shop_items(), filemenu_draw_contents_choose_name(), filemenu_draw_contents_file_create_header(), filemenu_draw_contents_file_info(), filemenu_draw_contents_mono(), filemenu_draw_contents_stereo(), filemenu_draw_cursor(), func_800F4D28(), pause_badges_draw_contents(), pause_draw_cursor(), pause_items_draw_contents(), pause_map_draw_contents(), pause_partners_draw_movelist(), pause_partners_draw_movelist_flower(), pause_partners_draw_title(), pause_stats_draw_contents(), pause_tabs_draw_badges(), pause_tabs_draw_items(), pause_tabs_draw_map(), pause_tabs_draw_party(), pause_tabs_draw_spirits(), pause_tabs_draw_stats(), pause_textbox_draw_contents(), pause_tutorial_draw_contents(), popup_draw_cost_icon(), popup_menu_draw_menu_contents(), status_bar_draw_number(), status_bar_draw_stat(), update(), update_item_entity_pickup(), and update_status_bar().

◆ hud_element_get_render_pos()

void hud_element_get_render_pos ( s32 id,
s32 * x,
s32 * y )

Definition at line 1997 of file hud_element.c.

1997 {
1998 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
1999
2000 *x = hudElement->renderPosX;
2001 *y = hudElement->renderPosY;
2002}

Referenced by btl_draw_upgrade_windows(), btl_state_update_celebration(), and draw().

◆ hud_element_set_render_depth()

void hud_element_set_render_depth ( s32 id,
s32 z )

Definition at line 2004 of file hud_element.c.

2004 {
2005 (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->worldPosOffset.z = z;
2006}

Referenced by btl_draw_enemy_health_bars(), btl_main_menu_update(), btl_state_update_select_target(), and initialize_battle().

◆ hud_element_set_flags()

◆ hud_element_clear_flags()

◆ ALT_clear_hud_element_cache()

void ALT_clear_hud_element_cache ( void )
See also
hud_element_clear_cache

Definition at line 2016 of file hud_element.c.

2016 {
2017 s32 i;
2018
2029
2030 for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
2033 }
2034 } else {
2035 if (gHudElementAuxCache == NULL) {
2039 } else {
2041 }
2048
2049 for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
2052 }
2053 }
2054}

◆ hud_element_set_scale()

void hud_element_set_scale ( s32 index,
f32 scale )

Definition at line 2056 of file hud_element.c.

2056 {
2057 HudElement* elem = (*gHudElements)[index & ~HUD_ELEMENT_BATTLE_ID_MASK];
2058 s32 drawSizeX;
2059 s32 drawSizeY;
2060 s32 imgSizeX;
2061 s32 imgSizeY;
2062 f32 xScaled, yScaled;
2063
2064 elem->uniformScale = scale;
2065 if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
2066 imgSizeX = gHudElementSizes[elem->tileSizePreset].width;
2067 imgSizeY = gHudElementSizes[elem->tileSizePreset].height;
2068 drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
2069 drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
2070 } else {
2071 imgSizeX = elem->customImageSize.x;
2072 imgSizeY = elem->customImageSize.y;
2073 drawSizeX = elem->customDrawSize.x;
2074 drawSizeY = elem->customDrawSize.y;
2075 }
2076 elem->sizeX = drawSizeX * scale;
2077 elem->sizeY = drawSizeY * scale;
2078 elem->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
2080
2081 xScaled = ((f32) drawSizeX / (f32) imgSizeX) * scale;
2082 yScaled = ((f32) drawSizeY / (f32) imgSizeY) * scale;
2083
2084 xScaled = 1.0f / xScaled;
2085 yScaled = 1.0f / yScaled;
2086
2087 elem->widthScale = X10(xScaled);
2088 elem->heightScale = X10(yScaled);
2089}

Referenced by btl_main_menu_draw(), btl_main_menu_update(), btl_message_popup_draw_content(), btl_state_update_celebration(), btl_submenu_moves_update(), btl_update_strats_menu(), draw_shop_items(), pause_badges_draw_contents(), pause_items_draw_contents(), pause_partners_draw_movelist(), pause_textbox_draw_contents(), pause_tutorial_draw_contents(), popup_menu_draw_menu_contents(), popup_menu_update(), and update().

◆ hud_element_use_preset_size()

void hud_element_use_preset_size ( s32 id,
s8 size )

Definition at line 2091 of file hud_element.c.

2091 {
2092 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2093
2094 hudElement->widthScale = X10(1.0f);
2095 hudElement->heightScale = X10(1.0f);
2096 hudElement->tileSizePreset = sizePreset;
2097 hudElement->drawSizePreset = sizePreset;
2098 hudElement->uniformScale = 1.0f;
2099 hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
2101}

◆ func_80144E4C()

s32 func_80144E4C ( s32 id)

Definition at line 2103 of file hud_element.c.

2103 {
2104 return ((*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->flags >> 24) & 0xF;
2105}

◆ func_80144E74()

void func_80144E74 ( s32 id,
s32 arg1 )

Definition at line 2107 of file hud_element.c.

2107 {
2108 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2109
2111 hudElement->flags |= arg1 << 24;
2112}

◆ hud_element_set_alpha()

void hud_element_set_alpha ( s32 id,
s32 opacity )
Parameters
opacity0 = invisible; 255 = opaque

Definition at line 2114 of file hud_element.c.

2114 {
2115 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2116
2117 hudElement->flags |= HUD_ELEMENT_FLAG_TRANSPARENT;
2118 hudElement->opacity = opacity;
2119
2120 if (opacity == 255) {
2121 hudElement->flags &= ~HUD_ELEMENT_FLAG_TRANSPARENT;
2122 }
2123}

Referenced by btl_main_menu_draw(), btl_main_menu_update(), btl_menu_moves_draw_content(), btl_menu_moves_show_icon(), btl_menu_strats_draw_content(), btl_message_popup_draw_content(), btl_state_draw_select_target(), btl_state_update_celebration(), filemenu_draw_cursor(), func_800F4D28(), pause_draw_cursor(), pause_tabs_draw_badges(), pause_tabs_draw_items(), pause_tabs_draw_map(), pause_tabs_draw_party(), pause_tabs_draw_spirits(), pause_tabs_draw_stats(), popup_draw_cost_icon(), popup_menu_draw_menu_contents(), and update().

◆ hud_element_set_tint()

void hud_element_set_tint ( s32 id,
s32 r,
s32 g,
s32 b )

Definition at line 2125 of file hud_element.c.

2125 {
2126 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2127
2128 hudElement->tint.r = r;
2129 hudElement->tint.g = g;
2130 hudElement->tint.b = b;
2131}

Referenced by btl_main_menu_update(), btl_state_draw_celebration(), btl_state_update_celebration(), btl_submenu_moves_update(), btl_update_strats_menu(), func_800F16CC(), func_802A2910(), func_802A2AB8(), func_802A47E0(), func_802A48FC(), popup_menu_update(), and show_coin_counter().

◆ hud_element_create_transform_A()

void hud_element_create_transform_A ( s32 id)

Definition at line 2133 of file hud_element.c.

2133 {
2134 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2135 HudTransform* transform = general_heap_malloc(sizeof(*transform));
2136
2137 element->hudTransform = transform;
2138 ASSERT(transform != NULL);
2140 transform->imgfxIdx = imgfx_get_free_instances(1);
2141 transform->pos.x = 0.0f;
2142 transform->pos.y = 0.0f;
2143 transform->pos.z = 0.0f;
2144 transform->rot.x = 0.0f;
2145 transform->rot.y = 0.0f;
2146 transform->rot.z = 0.0f;
2147 transform->scale.x = 1.0f;
2148 transform->scale.y = 1.0f;
2149 transform->scale.z = 1.0f;
2150 transform->pivot.x = 0;
2151 transform->pivot.y = 0;
2153}
s32 imgfx_get_free_instances(s32)
Definition imgfx.c:338

◆ hud_element_create_transform_B()

void hud_element_create_transform_B ( s32 id)

Definition at line 2155 of file hud_element.c.

2155 {
2156 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2157 HudTransform* transform = general_heap_malloc(sizeof(*transform));
2158
2159 element->hudTransform = transform;
2160 ASSERT(transform != NULL);
2162 transform->imgfxIdx = 0;
2163 transform->pos.x = 0.0f;
2164 transform->pos.y = 0.0f;
2165 transform->pos.z = 0.0f;
2166 transform->rot.x = 0.0f;
2167 transform->rot.y = 0.0f;
2168 transform->rot.z = 0.0f;
2169 transform->scale.x = 1.0f;
2170 transform->scale.y = 1.0f;
2171 transform->scale.z = 1.0f;
2173}

Referenced by btl_main_menu_update(), btl_state_update_celebration(), and btl_update_message_popup().

◆ hud_element_create_transform_C()

void hud_element_create_transform_C ( s32 id)

Definition at line 2175 of file hud_element.c.

2175 {
2176 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2177 HudTransform* transform = general_heap_malloc(sizeof(*transform));
2178
2179 element->hudTransform = transform;
2180 ASSERT(transform != NULL);
2182 transform->imgfxIdx = 0;
2183 transform->pos.x = 0.0f;
2184 transform->pos.y = 0.0f;
2185 transform->pos.z = 0.0f;
2186 transform->rot.x = 0.0f;
2187 transform->rot.y = 0.0f;
2188 transform->rot.z = 0.0f;
2189 transform->scale.x = 1.0f;
2190 transform->scale.y = 1.0f;
2191 transform->scale.z = 1.0f;
2193}

◆ hud_element_free_transform()

void hud_element_free_transform ( s32 id)

Definition at line 2195 of file hud_element.c.

2195 {
2196 HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2197 HudTransform* hudTransform = hudElement->hudTransform;
2198
2199 if (!(hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD)) {
2200 imgfx_release_instance(hudTransform->imgfxIdx);
2201 }
2202
2203 heap_free(hudElement->hudTransform);
2204 hudElement->hudTransform = NULL;
2206}
void imgfx_release_instance(u32)
Definition imgfx.c:386

Referenced by hud_element_free().

◆ hud_element_set_transform_pos()

void hud_element_set_transform_pos ( s32 id,
f32 x,
f32 y,
f32 z )

Definition at line 2208 of file hud_element.c.

2208 {
2209 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2210 HudTransform* transform = element->hudTransform;
2211
2212 if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
2213 transform->pos.x = x;
2214 transform->pos.y = y;
2215 transform->pos.z = z;
2216 }
2217}

Referenced by btl_main_menu_draw().

◆ hud_element_set_transform_scale()

void hud_element_set_transform_scale ( s32 id,
f32 x,
f32 y,
f32 z )

Definition at line 2219 of file hud_element.c.

2219 {
2220 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2221 HudTransform* transform = element->hudTransform;
2222
2223 if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
2224 transform->scale.x = x;
2225 transform->scale.y = y;
2226 transform->scale.z = z;
2227 }
2228}

Referenced by btl_main_menu_draw(), and btl_state_update_celebration().

◆ hud_element_set_transform_rotation()

void hud_element_set_transform_rotation ( s32 id,
f32 x,
f32 y,
f32 z )

Definition at line 2230 of file hud_element.c.

2230 {
2231 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2232 HudTransform* transform = element->hudTransform;
2233
2234 if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
2235 transform->rot.x = x;
2236 transform->rot.y = y;
2237 transform->rot.z = z;
2238 }
2239}

Referenced by btl_main_menu_draw(), btl_main_menu_update(), btl_state_draw_celebration(), and btl_state_update_celebration().

◆ hud_element_set_transform_rotation_pivot()

void hud_element_set_transform_rotation_pivot ( s32 id,
s32 dx,
s32 dy )

Definition at line 2241 of file hud_element.c.

2241 {
2242 HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
2243 HudTransform* transform = element->hudTransform;
2244
2245 if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
2246 transform->pivot.x = dx;
2247 transform->pivot.y = dy;
2248 }
2249}

Referenced by btl_main_menu_draw(), btl_main_menu_update(), and btl_state_update_celebration().

◆ copy_world_hud_element_ref_to_battle()

void copy_world_hud_element_ref_to_battle ( s32 worldID,
s32 battleID )

Definition at line 2251 of file hud_element.c.

2251 {
2252 gHudElementsBattle[battleID & ~HUD_ELEMENT_BATTLE_ID_MASK] = gHudElementsWorld[worldID & ~HUD_ELEMENT_BATTLE_ID_MASK];
2253}

Referenced by reset_status_bar().

◆ hud_element_set_aux_cache()

void hud_element_set_aux_cache ( void * base,
s32 size )

Definition at line 2255 of file hud_element.c.

2255 {
2256 gHudElementAuxCache = (u8*)base;
2257 if (base == NULL) {
2258 gHudElementCacheCapacity = 0x11000;
2259 } else {
2261 }
2262}

Referenced by state_init_file_select(), state_step_battle(), state_step_end_battle(), state_step_pause(), state_step_startup(), and state_step_unpause().

◆ create_standard_popup_menu()

void create_standard_popup_menu ( PopupMenu * popup)

Definition at line 2224 of file 8a860_len_3f30.c.

2224 {
2225 PopupMenu* otherPopup;
2226 s8 entryCount;
2227 s32 initialPos;
2228 s32 numEntries;
2229
2233 gPopupMenu = popup;
2235 popup->dipMode = 0;
2236 popup->titleNumber = 0;
2237 PopupDipMode = 0;
2238 PopupNotDipping = TRUE;
2239 if (popup->popupType >= POPUP_MENU_DOUBLE_DIP) {
2241 PopupDipMode = 1;
2242 if (popup->popupType >= POPUP_MENU_DOUBLE_DIP) {
2244 PopupDipMode = 2;
2245 }
2246 PopupNotDipping = FALSE;
2247 }
2248
2249 PopupNotBattle = TRUE;
2252
2253 initialPos = gPopupMenu->initialPos;
2254 numEntries = gPopupMenu->numEntries;
2255 PopupMenu_SelectedIndex = initialPos;
2256 if (initialPos >= numEntries) {
2257 PopupMenu_SelectedIndex = numEntries - 1;
2258 }
2261
2262 entryCount = gPopupMenu->numEntries;
2263 PopupMenu_DisplayedEntryCount = entryCount;
2264 if (PopupMenu_MaxDisplayableEntryCount < entryCount) {
2266 }
2267
2271 }
2272
2273 PopupMenu_Alpha = 255;
2274 D_8010D691 = 4;
2275 D_8010D692 = 6;
2276 gPopupWorker = create_worker_frontUI((void (*) (void)) popup_menu_update, NULL);
2277}
BSS s32 PopupMenu_PrevSelectedIndex
BSS s8 D_8010D692
BSS s8 PopupNotBattle
BSS s32 PopupMenu_Alpha
BSS s8 PopupMenu_FirstDisplayIndex
BSS s8 PopupMenu_DisplayedEntryCount
s32 popup_menu_update(void)
BSS s8 PopupDipMode
BSS s8 PopupNotDipping
BSS s32 gPopupWorker
BSS s8 PopupMenu_LastDisplayIndex
s8 status_bar_is_ignoring_changes(void)
Definition inventory.c:1512
BSS s8 D_8010D691
BSS s32 gPopupState
BSS s32 PopupMenu_SelectedIndex
BSS s8 PopupMenu_WasStatusBarIgnoringChanges
BSS PopupMenu * gPopupMenu
BSS s8 PopupMenu_MaxDisplayableEntryCount
@ POPUP_MENU_DOUBLE_DIP
Definition enums.h:3145
@ POPUP_RESULT_CHOOSING
Definition enums.h:3177
@ POPUP_STATE_INIT
Definition enums.h:3150
void status_bar_ignore_changes(void)
Definition inventory.c:1497
void open_status_bar_quickly(void)
Definition inventory.c:1430
s32 create_worker_frontUI(void(*updateFunc)(void), void(*drawFunc)(void))
Definition worker.c:63
s32 titleNumber

Referenced by check_input_open_menus(), and update_item_entity_pickup().

Variable Documentation

◆ HES_AnimatedHandPointer

HudScript HES_AnimatedHandPointer
extern

Definition at line 729 of file global_hud_scripts.c.

729 {
732 hs_Loop
734 hs_SetCI(4, ui_point_right)
736 hs_SetCI(8, ui_point_right)
738 hs_End
739};
#define hs_SetTileSize(size)
#define hs_SetVisible
#define hs_AddTexelOffsetX(x)
#define hs_Restart
#define hs_Loop
#define hs_SetCI(time, name)

Referenced by btl_submenu_moves_update(), btl_update_strats_menu(), func_800F16CC(), func_802A2910(), func_802A2AB8(), func_802A47E0(), func_802A48FC(), and popup_menu_update().

◆ HES_StatusCoin

HudScript HES_StatusCoin
extern

Definition at line 2077 of file global_hud_scripts.c.

2077 {
2080 hs_Loop
2081 hs_op_15(0)
2082 hs_SetCI(3, ui_status_coin_0)
2083 hs_SetCI(3, ui_status_coin_1)
2084 hs_SetCI(3, ui_status_coin_4)
2085 hs_SetCI(3, ui_status_coin_5)
2086 hs_SetCI(3, ui_status_coin_6)
2087 hs_SetCI(3, ui_status_coin_7)
2088 hs_SetCI(3, ui_status_coin_8)
2089 hs_SetCI(3, ui_status_coin_9)
2090 hs_RandomRestart(100, 70)
2091 hs_op_15(1)
2092 hs_SetCI(3, ui_status_coin_0)
2093 hs_SetCI(2, ui_status_coin_1)
2094 hs_SetCI(1, ui_status_coin_2)
2095 hs_SetCI(1, ui_status_coin_3)
2096 hs_SetCI(2, ui_status_coin_4)
2097 hs_SetCI(3, ui_status_coin_5)
2098 hs_SetCI(3, ui_status_coin_6)
2099 hs_SetCI(3, ui_status_coin_7)
2100 hs_SetCI(3, ui_status_coin_8)
2101 hs_SetCI(3, ui_status_coin_9)
2103 hs_End
2104};
#define hs_RandomRestart(max, cutoff)
Restarts the loop if cutoff < rand_int(max)
#define hs_op_15(arg0)

Referenced by initialize_status_bar(), popup_menu_update(), and show_coin_counter().

◆ HES_Refund

HudScript HES_Refund
extern

Definition at line 2198 of file global_hud_scripts.c.

2198 {
2201 hs_Loop
2203 hs_SetCI(8, ui_battle_status_refund)
2205 hs_SetCI(4, ui_battle_status_refund)
2207 hs_End
2208};
#define hs_ClearFlags(arg0)
#define hs_SetFlags(arg0)

◆ HES_MenuTimes

HudScript HES_MenuTimes
extern

Definition at line 2581 of file global_hud_scripts.c.

Referenced by popup_menu_update(), and show_coin_counter().

◆ gPartnerPopupProperties

PartnerPopupProperties gPartnerPopupProperties[13]
extern

Definition at line 331 of file 5B320.c.

331 {
332 [PARTNER_NONE] {
333 (s32) "ăȘし",
334 0,
335 MSG_NONE,
336 MSG_NONE,
337 },
339 MSG_Menus_Party_Goombario,
340 2,
341 MSG_PartnerDesc_Goombario_World,
342 MSG_PartnerDesc_Goombario_Battle,
343 },
345 MSG_Menus_Party_Kooper,
346 3,
347 MSG_PartnerDesc_Kooper_World,
348 MSG_PartnerDesc_Kooper_Battle,
349 },
351 MSG_Menus_Party_Bombette,
352 4,
353 MSG_PartnerDesc_Bombette_World,
354 MSG_PartnerDesc_Bombette_Battle,
355 },
357 MSG_Menus_Party_Parakarry,
358 5,
359 MSG_PartnerDesc_Parakarry_World,
360 MSG_PartnerDesc_Parakarry_Battle,
361 },
363 MSG_Menus_Party_Goompa,
364 1,
367 },
368 [PARTNER_WATT] {
369 MSG_Menus_Party_Watt,
370 7,
371 MSG_PartnerDesc_Watt_World,
372 MSG_PartnerDesc_Watt_Battle,
373 },
375 MSG_Menus_Party_Sushie,
376 8,
377 MSG_PartnerDesc_Sushie_World,
378 MSG_PartnerDesc_Sushie_Battle,
379 },
381 MSG_Menus_Party_Lakilester,
382 9,
383 MSG_PartnerDesc_Lakilester_World,
384 MSG_PartnerDesc_Lakilester_Battle,
385 },
386 [PARTNER_BOW] {
387 MSG_Menus_Party_Bow,
388 6,
389 MSG_PartnerDesc_Bow_World,
390 MSG_PartnerDesc_Bow_Battle,
391 },
393 MSG_Menus_Party_Goombaria,
394 1,
397 },
398 [PARTNER_TWINK] {
399 MSG_Menus_Party_Twink,
400 1,
403 }
404};
#define MSG_PartnerDesc_Goombaria_Battle
Definition 5B320.c:138
#define MSG_PartnerDesc_Goombaria_World
Definition 5B320.c:139
#define MSG_PartnerDesc_Twink_Battle
Definition 5B320.c:142
#define MSG_PartnerDesc_Goompa_Battle
Definition 5B320.c:140
#define MSG_PartnerDesc_Twink_World
Definition 5B320.c:143
#define MSG_PartnerDesc_Goompa_World
Definition 5B320.c:141
@ PARTNER_NONE
Definition enums.h:2885
@ PARTNER_BOMBETTE
Definition enums.h:2888
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ PARTNER_WATT
Definition enums.h:2891
@ PARTNER_BOW
Definition enums.h:2894
@ PARTNER_SUSHIE
Definition enums.h:2892
@ PARTNER_TWINK
Definition enums.h:2896
@ PARTNER_PARAKARRY
Definition enums.h:2889
@ PARTNER_GOOMBARIA
Definition enums.h:2895
@ PARTNER_GOOMPA
Definition enums.h:2890
@ PARTNER_KOOPER
Definition enums.h:2887
@ PARTNER_GOOMBARIO
Definition enums.h:2886

Referenced by btl_state_update_partner_menu(), btl_state_update_player_menu(), pause_partners_draw_title(), and setup_partner_popup().

◆ wDisabledPartnerHudScripts

HudScript* wDisabledPartnerHudScripts[]
extern

Definition at line 136 of file partners.c.

Referenced by setup_partner_popup().

◆ wPartnerHudScripts

HudScript* wPartnerHudScripts[]
extern

Definition at line 130 of file partners.c.

130 {
135};
HudScript HES_Parakarry
HudScript HES_Sushie
HudScript HES_Partner0
HudScript HES_PartnerA
HudScript HES_Kooper
HudScript HES_Watt
HudScript HES_Lakilester
HudScript HES_Bow
HudScript HES_Bombette
HudScript HES_Goombario

Referenced by setup_partner_popup().