mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Match func_80144E4C (#406)
* Update hud_element.c * Update hud_element.h * Update hud_element.h * Delete func_80144E4C.s
This commit is contained in:
parent
c58b4098f5
commit
09459d19b4
@ -203,9 +203,9 @@ void set_hud_element_anim(s32 id, const HudElementAnim* anim) {
|
||||
hudElement->screenPosOffset.y = 0;
|
||||
hudElement->worldPosOffset.x = 0;
|
||||
hudElement->worldPosOffset.y = 0;
|
||||
hudElement->flags &= ~4;
|
||||
hudElement->flags.as_word &= ~4;
|
||||
hudElement->uniformScale = 1.0f;
|
||||
hudElement->flags &= ~0x930;
|
||||
hudElement->flags.as_word &= ~0x930;
|
||||
load_hud_element(hudElement, anim);
|
||||
|
||||
while (hud_element_update(hudElement) != 0) {}
|
||||
@ -220,7 +220,7 @@ HudElement* get_hud_element(s32 id) {
|
||||
}
|
||||
|
||||
void free_hud_element(s32 id) {
|
||||
if (hudElements[id & ~0x800]->flags & 0x10000) {
|
||||
if (hudElements[id & ~0x800]->flags.as_word & 0x10000) {
|
||||
free_hud_element_transform(id & ~0x800);
|
||||
}
|
||||
|
||||
@ -246,11 +246,11 @@ void get_hud_element_render_pos(s32 id, s32* x, s32* y) {
|
||||
INCLUDE_ASM(void, "hud_element", set_hud_element_render_depth, s32 id, s32 z);
|
||||
|
||||
void set_hud_element_flags(s32 id, s32 flags) {
|
||||
hudElements[id & ~0x800]->flags |= flags;
|
||||
hudElements[id & ~0x800]->flags.as_word |= flags;
|
||||
}
|
||||
|
||||
void clear_hud_element_flags(s32 id, s32 flags) {
|
||||
hudElements[id & ~0x800]->flags &= ~flags;
|
||||
hudElements[id & ~0x800]->flags.as_word &= ~flags;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(void, "hud_element", ALT_clear_hud_element_cache, void);
|
||||
@ -265,27 +265,29 @@ void set_hud_element_size(s32 id, s8 size) {
|
||||
hudElement->tileSizePreset = size;
|
||||
hudElement->drawSizePreset = size;
|
||||
hudElement->uniformScale = 1.0f;
|
||||
hudElement->flags &= ~0x100;
|
||||
hudElement->flags &= ~0x810;
|
||||
hudElement->flags.as_word &= ~0x100;
|
||||
hudElement->flags.as_word &= ~0x810;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "hud_element", func_80144E4C);
|
||||
s32 func_80144E4C(s32 id) {
|
||||
return hudElements[id & ~0x800]->flags.as_bitfields.f4;
|
||||
}
|
||||
|
||||
void func_80144E74(s32 id, s32 arg1) {
|
||||
HudElement* hudElement = hudElements[id & ~0x800];
|
||||
|
||||
hudElement->flags &= ~0xF000000;
|
||||
hudElement->flags |= arg1 << 24;
|
||||
hudElement->flags.as_word &= ~0xF000000;
|
||||
hudElement->flags.as_word |= arg1 << 24;
|
||||
}
|
||||
|
||||
void set_hud_element_alpha(s32 id, s32 opacity) {
|
||||
HudElement* hudElement = hudElements[id & ~0x800];
|
||||
|
||||
hudElement->flags |= 0x20;
|
||||
hudElement->flags.as_word |= 0x20;
|
||||
hudElement->opacity = opacity;
|
||||
|
||||
if (opacity == 255) {
|
||||
hudElement->flags &= ~0x20;
|
||||
hudElement->flags.as_word &= ~0x20;
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,13 +309,13 @@ void free_hud_element_transform(s32 id) {
|
||||
HudElement* hudElement = hudElements[id & ~0x800];
|
||||
s32* hudTransform = hudElement->hudTransform;
|
||||
|
||||
if (!(hudElement->flags & 0x20000)) {
|
||||
if (!(hudElement->flags.as_word & 0x20000)) {
|
||||
func_8013A854(*hudTransform);
|
||||
}
|
||||
|
||||
heap_free(hudElement->hudTransform);
|
||||
hudElement->hudTransform = NULL;
|
||||
hudElement->flags &= ~0x40030000;
|
||||
hudElement->flags.as_word &= ~0x40030000;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(void, "hud_element", set_hud_element_transform_pos, s32 id, f32 x, f32 y, f32 z);
|
||||
|
@ -62,8 +62,17 @@ enum {
|
||||
HUD_ELEMENT_SIZE_32x24,
|
||||
};
|
||||
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u32 f0: 4;
|
||||
u32 f4: 4;
|
||||
} as_bitfields;
|
||||
u32 as_word;
|
||||
} HudFlags;
|
||||
|
||||
typedef struct HudElement {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x00 */ HudFlags flags;
|
||||
/* 0x04 */ const HudElementAnim* readPos;
|
||||
/* 0x08 */ const HudElementAnim* anim;
|
||||
/* 0x0C */ s32* ptrPropertyList;
|
||||
@ -196,7 +205,7 @@ void set_hud_element_scale(s32 index, f32 scale);
|
||||
|
||||
void set_hud_element_size(s32 id, s8 size);
|
||||
|
||||
s32 func_80144E4C();
|
||||
s32 func_80144E4C(s32 id);
|
||||
|
||||
void func_80144E74(s32 id, s32 arg1);
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel func_80144E4C
|
||||
/* DB54C 80144E4C 2402F7FF */ addiu $v0, $zero, -0x801
|
||||
/* DB550 80144E50 00822024 */ and $a0, $a0, $v0
|
||||
/* DB554 80144E54 3C028015 */ lui $v0, %hi(hudElements)
|
||||
/* DB558 80144E58 8C427960 */ lw $v0, %lo(hudElements)($v0)
|
||||
/* DB55C 80144E5C 00042080 */ sll $a0, $a0, 2
|
||||
/* DB560 80144E60 00822021 */ addu $a0, $a0, $v0
|
||||
/* DB564 80144E64 8C820000 */ lw $v0, ($a0)
|
||||
/* DB568 80144E68 90420000 */ lbu $v0, ($v0)
|
||||
/* DB56C 80144E6C 03E00008 */ jr $ra
|
||||
/* DB570 80144E70 3042000F */ andi $v0, $v0, 0xf
|
Loading…
Reference in New Issue
Block a user