Match 2 funcs in 77480.c (#630)

* update_player_blink

* Delete update_player_blink.s

* Delete check_for_conversation_prompt.s

* Match check_for_conversation_prompt

* Update variables.h

* Update 77480.c

* Warnings
This commit is contained in:
JoshDuMan 2022-01-20 22:46:12 -05:00 committed by GitHub
parent 3bd5a9d91e
commit 3de396c043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 127 deletions

View File

@ -269,7 +269,7 @@ extern UNK_TYPE D_800E92D8;
extern UNK_TYPE D_80147574; extern UNK_TYPE D_80147574;
extern UNK_FUN_PTR(D_8010C920); extern UNK_FUN_PTR(D_8010C920);
extern s32 D_8010C940; extern UNK_FUN_PTR(D_8010C940);
extern Entity* D_8010C954; extern Entity* D_8010C954;
extern UNK_FUN_PTR(D_8010C958); extern UNK_FUN_PTR(D_8010C958);
extern s32 D_8010C95C; extern s32 D_8010C95C;

View File

@ -1,16 +1,16 @@
#include "common.h" #include "common.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#define E20110_VRAM_DEF (s32*)0x802B7000 #define E20110_VRAM_DEF (void*)0x802B7000
#define E21870_VRAM_DEF (s32*)0x802B7000 #define E20EB0_VRAM_DEF (void*)0x802B7000
#define E225B0_VRAM_DEF (s32*)0x802B7000 #define E21870_VRAM_DEF (void*)0x802B7000
#define E225B0_VRAM_DEF (void*)0x802B7000
void appendGfx_player(void* data); void appendGfx_player(void* data);
void appendGfx_player_spin(void* data); void appendGfx_player_spin(void* data);
void func_800F0C9C(void); void func_800F0C9C(void);
extern UNK_FUN_PTR(D_8010C93C); extern UNK_FUN_PTR(D_8010C93C);
extern s32 D_8010C950;
extern s32 D_802BDF60; extern s32 D_802BDF60;
extern s8 D_8015A57A; extern s8 D_8015A57A;
@ -845,7 +845,43 @@ void suggest_player_anim_setUnkFlag(s32 arg0) {
} }
} }
INCLUDE_ASM(s32, "77480", update_player_blink); void update_player_blink(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
s32 phi_a2 = 0;
u8 phi_v1;
u8* alpha;
if (gPartnerActionStatus.actionState.b[3] == 9) {
phi_a2 = gPartnerActionStatus.actionState.b[0] != 0;
}
if (playerStatus->unk_10 > 0) {
playerStatus->unk_10--;
alpha = &playerStatus->alpha1;
if (!(gGameStatusPtr->frameCounter & 1)) {
if (phi_a2) {
phi_v1 = 0xC0;
} else {
phi_v1 = 0xFF;
}
} else {
phi_v1 = 0x60;
}
*alpha = phi_v1;
if (!playerStatus->unk_10) {
if (phi_a2) {
playerStatus->alpha1 = 0x80;
playerStatus->flags |= PLAYER_STATUS_FLAGS_8000;
} else {
playerStatus->alpha1 = 0xFF;
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_8000;
}
} else {
playerStatus->flags |= PLAYER_STATUS_FLAGS_8000;
}
}
}
// dist_to_player2D // dist_to_player2D
f32 get_xz_dist_to_player(f32 x, f32 z) { f32 get_xz_dist_to_player(f32 x, f32 z) {
@ -1015,7 +1051,30 @@ s32 has_valid_conversation_npc(void) {
return ret; return ret;
} }
INCLUDE_ASM(s32, "77480", check_for_conversation_prompt); void check_for_conversation_prompt(void) {
if (gPlayerStatus.animFlags & PLAYER_STATUS_ANIM_FLAGS_100 || D_8010C958 || D_8010C920) {
return;
}
if (D_8010C940 == NULL) {
if (gPlayerStatus.statusMenuCounterinputEnabledCounter || gPlayerStatus.flags & PLAYER_STATUS_FLAGS_20) {
return;
}
if (has_valid_conversation_npc()) {
D_8010C940 = NULL;
dma_copy(E20EB0_ROM_START, E20EB0_ROM_END, E20EB0_VRAM_DEF);
D_8010C940 = func_802B70B4_E201C4;
} else {
D_8010C940 = NULL;
return;
}
}
if (D_8010C940 != NULL) {
D_8010C940();
}
}
void func_800E0658(void) { void func_800E0658(void) {
if ((gPlayerStatusPtr->animFlags & PLAYER_STATUS_ANIM_FLAGS_SPEECH_PROMPT_AVAILABLE) && (D_8010C940 != 0)) { if ((gPlayerStatusPtr->animFlags & PLAYER_STATUS_ANIM_FLAGS_SPEECH_PROMPT_AVAILABLE) && (D_8010C940 != 0)) {
@ -1132,7 +1191,7 @@ void check_for_interactables(void) {
} }
if (D_8010C958 == NULL) { if (D_8010C958 == NULL) {
dma_copy(E20110_ROM_START, E20110_ROM_END, (void *) E20110_VRAM_DEF); dma_copy(E20110_ROM_START, E20110_ROM_END, E20110_VRAM_DEF);
D_8010C958 = &func_802B70B4_E201C4; D_8010C958 = &func_802B70B4_E201C4;
} }

View File

@ -1,61 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel check_for_conversation_prompt
/* 79A30 800E0580 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 79A34 800E0584 3C038011 */ lui $v1, %hi(gPlayerStatus)
/* 79A38 800E0588 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus)
/* 79A3C 800E058C AFBF0014 */ sw $ra, 0x14($sp)
/* 79A40 800E0590 AFB00010 */ sw $s0, 0x10($sp)
/* 79A44 800E0594 8C620004 */ lw $v0, 4($v1)
/* 79A48 800E0598 30420100 */ andi $v0, $v0, 0x100
/* 79A4C 800E059C 1440002A */ bnez $v0, .L800E0648
/* 79A50 800E05A0 00000000 */ nop
/* 79A54 800E05A4 3C028011 */ lui $v0, %hi(D_8010C958)
/* 79A58 800E05A8 8C42C958 */ lw $v0, %lo(D_8010C958)($v0)
/* 79A5C 800E05AC 14400026 */ bnez $v0, .L800E0648
/* 79A60 800E05B0 00000000 */ nop
/* 79A64 800E05B4 3C028011 */ lui $v0, %hi(D_8010C920)
/* 79A68 800E05B8 8C42C920 */ lw $v0, %lo(D_8010C920)($v0)
/* 79A6C 800E05BC 14400022 */ bnez $v0, .L800E0648
/* 79A70 800E05C0 00000000 */ nop
/* 79A74 800E05C4 3C108011 */ lui $s0, %hi(D_8010C940)
/* 79A78 800E05C8 2610C940 */ addiu $s0, $s0, %lo(D_8010C940)
/* 79A7C 800E05CC 8E020000 */ lw $v0, ($s0)
/* 79A80 800E05D0 14400019 */ bnez $v0, .L800E0638
/* 79A84 800E05D4 00000000 */ nop
/* 79A88 800E05D8 80620015 */ lb $v0, 0x15($v1)
/* 79A8C 800E05DC 1440001A */ bnez $v0, .L800E0648
/* 79A90 800E05E0 00000000 */ nop
/* 79A94 800E05E4 8C620000 */ lw $v0, ($v1)
/* 79A98 800E05E8 30420020 */ andi $v0, $v0, 0x20
/* 79A9C 800E05EC 14400016 */ bnez $v0, .L800E0648
/* 79AA0 800E05F0 00000000 */ nop
/* 79AA4 800E05F4 0C03814E */ jal has_valid_conversation_npc
/* 79AA8 800E05F8 00000000 */ nop
/* 79AAC 800E05FC 14400003 */ bnez $v0, .L800E060C
/* 79AB0 800E0600 3C06802B */ lui $a2, 0x802b
/* 79AB4 800E0604 08038192 */ j .L800E0648
/* 79AB8 800E0608 AE000000 */ sw $zero, ($s0)
.L800E060C:
/* 79ABC 800E060C 34C67000 */ ori $a2, $a2, 0x7000
/* 79AC0 800E0610 3C0400E2 */ lui $a0, 0xe2
/* 79AC4 800E0614 24840EB0 */ addiu $a0, $a0, 0xeb0
/* 79AC8 800E0618 3C0500E2 */ lui $a1, 0xe2
/* 79ACC 800E061C 24A51870 */ addiu $a1, $a1, 0x1870
/* 79AD0 800E0620 0C00A5CF */ jal dma_copy
/* 79AD4 800E0624 AE000000 */ sw $zero, ($s0)
/* 79AD8 800E0628 3C02802B */ lui $v0, %hi(func_802B70B4_E201C4)
/* 79ADC 800E062C 244270B4 */ addiu $v0, $v0, %lo(func_802B70B4_E201C4)
/* 79AE0 800E0630 10400005 */ beqz $v0, .L800E0648
/* 79AE4 800E0634 AE020000 */ sw $v0, ($s0)
.L800E0638:
/* 79AE8 800E0638 3C028011 */ lui $v0, %hi(D_8010C940)
/* 79AEC 800E063C 8C42C940 */ lw $v0, %lo(D_8010C940)($v0)
/* 79AF0 800E0640 0040F809 */ jalr $v0
/* 79AF4 800E0644 00000000 */ nop
.L800E0648:
/* 79AF8 800E0648 8FBF0014 */ lw $ra, 0x14($sp)
/* 79AFC 800E064C 8FB00010 */ lw $s0, 0x10($sp)
/* 79B00 800E0650 03E00008 */ jr $ra
/* 79B04 800E0654 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,58 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel update_player_blink
/* 7947C 800DFFCC 3C058011 */ lui $a1, %hi(gPlayerStatus)
/* 79480 800DFFD0 24A5EFC8 */ addiu $a1, $a1, %lo(gPlayerStatus)
/* 79484 800DFFD4 3C048011 */ lui $a0, %hi(gPartnerActionStatus)
/* 79488 800DFFD8 2484EBB0 */ addiu $a0, $a0, %lo(gPartnerActionStatus)
/* 7948C 800DFFDC 80830003 */ lb $v1, 3($a0)
/* 79490 800DFFE0 24020009 */ addiu $v0, $zero, 9
/* 79494 800DFFE4 14620003 */ bne $v1, $v0, .L800DFFF4
/* 79498 800DFFE8 0000302D */ daddu $a2, $zero, $zero
/* 7949C 800DFFEC 80820000 */ lb $v0, ($a0)
/* 794A0 800DFFF0 00C2302B */ sltu $a2, $a2, $v0
.L800DFFF4:
/* 794A4 800DFFF4 84A20010 */ lh $v0, 0x10($a1)
/* 794A8 800DFFF8 94A40010 */ lhu $a0, 0x10($a1)
/* 794AC 800DFFFC 18400020 */ blez $v0, .L800E0080
/* 794B0 800E0000 2482FFFF */ addiu $v0, $a0, -1
/* 794B4 800E0004 3C038007 */ lui $v1, %hi(gGameStatusPtr)
/* 794B8 800E0008 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1)
/* 794BC 800E000C A4A20010 */ sh $v0, 0x10($a1)
/* 794C0 800E0010 94620134 */ lhu $v0, 0x134($v1)
/* 794C4 800E0014 30420001 */ andi $v0, $v0, 1
/* 794C8 800E0018 14400005 */ bnez $v0, .L800E0030
/* 794CC 800E001C 24A4000E */ addiu $a0, $a1, 0xe
/* 794D0 800E0020 10C00004 */ beqz $a2, .L800E0034
/* 794D4 800E0024 240300FF */ addiu $v1, $zero, 0xff
/* 794D8 800E0028 0803800D */ j .L800E0034
/* 794DC 800E002C 240300C0 */ addiu $v1, $zero, 0xc0
.L800E0030:
/* 794E0 800E0030 24030060 */ addiu $v1, $zero, 0x60
.L800E0034:
/* 794E4 800E0034 84A20010 */ lh $v0, 0x10($a1)
/* 794E8 800E0038 1440000E */ bnez $v0, .L800E0074
/* 794EC 800E003C A0830000 */ sb $v1, ($a0)
/* 794F0 800E0040 10C00004 */ beqz $a2, .L800E0054
/* 794F4 800E0044 24030080 */ addiu $v1, $zero, 0x80
/* 794F8 800E0048 8CA20000 */ lw $v0, ($a1)
/* 794FC 800E004C 0803801E */ j .L800E0078
/* 79500 800E0050 A0A3000E */ sb $v1, 0xe($a1)
.L800E0054:
/* 79504 800E0054 3C02FFFF */ lui $v0, 0xffff
/* 79508 800E0058 34427FFF */ ori $v0, $v0, 0x7fff
/* 7950C 800E005C 8CA30000 */ lw $v1, ($a1)
/* 79510 800E0060 240400FF */ addiu $a0, $zero, 0xff
/* 79514 800E0064 A0A4000E */ sb $a0, 0xe($a1)
/* 79518 800E0068 00621824 */ and $v1, $v1, $v0
/* 7951C 800E006C 03E00008 */ jr $ra
/* 79520 800E0070 ACA30000 */ sw $v1, ($a1)
.L800E0074:
/* 79524 800E0074 8CA20000 */ lw $v0, ($a1)
.L800E0078:
/* 79528 800E0078 34428000 */ ori $v0, $v0, 0x8000
/* 7952C 800E007C ACA20000 */ sw $v0, ($a1)
.L800E0080:
/* 79530 800E0080 03E00008 */ jr $ra
/* 79534 800E0084 00000000 */ nop