SetNpcFlagBits

This commit is contained in:
Ethan Roseman 2020-11-07 23:33:15 -05:00
parent 24558d98d6
commit 72f4a180f2
6 changed files with 35 additions and 46 deletions

View File

@ -1,44 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetNpcFlagBits
/* F3A10 802CF060 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F3A14 802CF064 AFB10014 */ sw $s1, 0x14($sp)
/* F3A18 802CF068 0080882D */ daddu $s1, $a0, $zero
/* F3A1C 802CF06C AFBF001C */ sw $ra, 0x1c($sp)
/* F3A20 802CF070 AFB20018 */ sw $s2, 0x18($sp)
/* F3A24 802CF074 AFB00010 */ sw $s0, 0x10($sp)
/* F3A28 802CF078 8E30000C */ lw $s0, 0xc($s1)
/* F3A2C 802CF07C 8E050000 */ lw $a1, ($s0)
/* F3A30 802CF080 0C0B1EAF */ jal get_variable
/* F3A34 802CF084 26100004 */ addiu $s0, $s0, 4
/* F3A38 802CF088 0220202D */ daddu $a0, $s1, $zero
/* F3A3C 802CF08C 8E050004 */ lw $a1, 4($s0)
/* F3A40 802CF090 8E100000 */ lw $s0, ($s0)
/* F3A44 802CF094 0C0B1EAF */ jal get_variable
/* F3A48 802CF098 0040902D */ daddu $s2, $v0, $zero
/* F3A4C 802CF09C 0220202D */ daddu $a0, $s1, $zero
/* F3A50 802CF0A0 0240282D */ daddu $a1, $s2, $zero
/* F3A54 802CF0A4 0C0B36B0 */ jal resolve_npc
/* F3A58 802CF0A8 0040882D */ daddu $s1, $v0, $zero
/* F3A5C 802CF0AC 0040202D */ daddu $a0, $v0, $zero
/* F3A60 802CF0B0 5080000A */ beql $a0, $zero, .L802CF0DC
/* F3A64 802CF0B4 24020002 */ addiu $v0, $zero, 2
/* F3A68 802CF0B8 12200004 */ beqz $s1, .L802CF0CC
/* F3A6C 802CF0BC 00101827 */ nor $v1, $zero, $s0
/* F3A70 802CF0C0 8C820000 */ lw $v0, ($a0)
/* F3A74 802CF0C4 080B3C35 */ j .L802CF0D4
/* F3A78 802CF0C8 00501025 */ or $v0, $v0, $s0
.L802CF0CC:
/* F3A7C 802CF0CC 8C820000 */ lw $v0, ($a0)
/* F3A80 802CF0D0 00431024 */ and $v0, $v0, $v1
.L802CF0D4:
/* F3A84 802CF0D4 AC820000 */ sw $v0, ($a0)
/* F3A88 802CF0D8 24020002 */ addiu $v0, $zero, 2
.L802CF0DC:
/* F3A8C 802CF0DC 8FBF001C */ lw $ra, 0x1c($sp)
/* F3A90 802CF0E0 8FB20018 */ lw $s2, 0x18($sp)
/* F3A94 802CF0E4 8FB10014 */ lw $s1, 0x14($sp)
/* F3A98 802CF0E8 8FB00010 */ lw $s0, 0x10($sp)
/* F3A9C 802CF0EC 03E00008 */ jr $ra
/* F3AA0 802CF0F0 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -942,7 +942,15 @@ typedef struct GameStatus {
} GameStatus; // size = 0x178
typedef struct PartnerAnimations {
/* 0x00 */ char unk_00[36];
/* 0x00 */ UNK_PTR standard; // should be "default" but that's a keyword
/* 0x04 */ UNK_PTR walk;
/* 0x08 */ UNK_PTR jump;
/* 0x0C */ UNK_PTR fall;
/* 0x10 */ UNK_PTR fly;
/* 0x14 */ UNK_PTR idle;
/* 0x18 */ UNK_PTR run;
/* 0x1C */ UNK_PTR talk;
/* 0x20 */ UNK_PTR hurt;
} PartnerAnimations; // size = 0x24
typedef struct Shadow {

View File

@ -86,6 +86,9 @@ extern PrintContext* gCurrentPrintContext;
extern s32 D_802DB264;
extern PrintContext* D_802DB268;
// Animation related
extern PartnerAnimations gPartnerAnimations[12];
// Triggers
extern s16 gTriggerCount;
extern TriggerList gTriggerList1;

View File

@ -242,7 +242,25 @@ INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcFacePlayer, ScriptInstance* script, s
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcFaceNpc, ScriptInstance* script, s32 isInitialCall);
INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcFlagBits, ScriptInstance* script, s32 isInitialCall);
ApiStatus SetNpcFlagBits(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
s32 flagBits = *args++;
s32 var1 = get_variable(script, *args++);
Npc* npc = resolve_npc(script, npcID);
if (npc == NULL) {
return ApiStatus_DONE2;
}
if (var1) {
npc->flags |= flagBits;
} else {
npc->flags &= ~flagBits;
}
return ApiStatus_DONE2;
}
ApiStatus GetNpcPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -694,6 +694,7 @@ enable_partner_ai = 0x800EF328;
clear_partner_move_history = 0x800EF45C;
draw_submenu_title = 0x800F4648;
draw_box = 0x800F52E0;
gPartnerAnimations = 0x800F8348; // size:0x1B0
gPlayerStatus = 0x8010EFC8; // size:0x288
gPlayerData = 0x8010F290; // size:0x340
update_entities = 0x8010F6D0;

View File

@ -44,6 +44,9 @@ D_800A0963 = 0x800A0963;
D_800A0964 = 0x800A0964;
D_800E92D8 = 0x800E92D8;
gPartnerAnimations = 0x800F8348;
D_80147474 = 0x80147474;
D_80109270 = 0x80109270;
D_80108558 = 0x80108558;