mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
match all of code_dd930_len_lc0, add commented mostly matching code for update_coin_counter
This commit is contained in:
parent
e60a7bb5e0
commit
3776d9ea93
@ -1,85 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
.include "include/macro.inc"
|
||||
|
||||
glabel UpdateMusicPlayers
|
||||
/* 0DD964 80147264 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0DD968 80147268 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 0DD96C 8014726C 3C108016 */ lui $s0, 0x8016
|
||||
/* 0DD970 80147270 2610C7C0 */ addiu $s0, $s0, -0x3840
|
||||
/* 0DD974 80147274 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0DD978 80147278 86030002 */ lh $v1, 2($s0)
|
||||
/* 0DD97C 8014727C 24020001 */ addiu $v0, $zero, 1
|
||||
/* 0DD980 80147280 10620007 */ beq $v1, $v0, .L801472A0
|
||||
/* 0DD984 80147284 28620002 */ slti $v0, $v1, 2
|
||||
/* 0DD988 80147288 14400033 */ bnez $v0, .L80147358
|
||||
/* 0DD98C 8014728C 24020002 */ addiu $v0, $zero, 2
|
||||
/* 0DD990 80147290 10620015 */ beq $v1, $v0, .L801472E8
|
||||
/* 0DD994 80147294 00000000 */ nop
|
||||
/* 0DD998 80147298 08051CD6 */ j .L80147358
|
||||
/* 0DD99C 8014729C 00000000 */ nop
|
||||
|
||||
.L801472A0:
|
||||
/* 0DD9A0 801472A0 96020000 */ lhu $v0, 0($s0)
|
||||
/* 0DD9A4 801472A4 30420001 */ andi $v0, $v0, 1
|
||||
/* 0DD9A8 801472A8 1040000D */ beqz $v0, .L801472E0
|
||||
/* 0DD9AC 801472AC 24020002 */ addiu $v0, $zero, 2
|
||||
/* 0DD9B0 801472B0 8E050004 */ lw $a1, 4($s0)
|
||||
/* 0DD9B4 801472B4 28A200FA */ slti $v0, $a1, 0xfa
|
||||
/* 0DD9B8 801472B8 10400005 */ beqz $v0, .L801472D0
|
||||
/* 0DD9BC 801472BC 00000000 */ nop
|
||||
/* 0DD9C0 801472C0 0C015529 */ jal func_800554A4
|
||||
/* 0DD9C4 801472C4 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 0DD9C8 801472C8 08051CB6 */ j .L801472D8
|
||||
/* 0DD9CC 801472CC 00000000 */ nop
|
||||
|
||||
.L801472D0:
|
||||
/* 0DD9D0 801472D0 0C01553A */ jal func_800554E8
|
||||
/* 0DD9D4 801472D4 0000202D */ daddu $a0, $zero, $zero
|
||||
.L801472D8:
|
||||
/* 0DD9D8 801472D8 1440001F */ bnez $v0, .L80147358
|
||||
/* 0DD9DC 801472DC 24020002 */ addiu $v0, $zero, 2
|
||||
.L801472E0:
|
||||
/* 0DD9E0 801472E0 08051CD6 */ j .L80147358
|
||||
/* 0DD9E4 801472E4 A6020002 */ sh $v0, 2($s0)
|
||||
|
||||
.L801472E8:
|
||||
/* 0DD9E8 801472E8 96020000 */ lhu $v0, 0($s0)
|
||||
/* 0DD9EC 801472EC 30420001 */ andi $v0, $v0, 1
|
||||
/* 0DD9F0 801472F0 10400008 */ beqz $v0, .L80147314
|
||||
/* 0DD9F4 801472F4 00000000 */ nop
|
||||
/* 0DD9F8 801472F8 0C015579 */ jal func_800555E4
|
||||
/* 0DD9FC 801472FC 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 0DDA00 80147300 14400015 */ bnez $v0, .L80147358
|
||||
/* 0DDA04 80147304 00000000 */ nop
|
||||
/* 0DDA08 80147308 96020000 */ lhu $v0, 0($s0)
|
||||
/* 0DDA0C 8014730C 3042FFFE */ andi $v0, $v0, 0xfffe
|
||||
/* 0DDA10 80147310 A6020000 */ sh $v0, 0($s0)
|
||||
.L80147314:
|
||||
/* 0DDA14 80147314 8E040008 */ lw $a0, 8($s0)
|
||||
/* 0DDA18 80147318 04810003 */ bgez $a0, .L80147328
|
||||
/* 0DDA1C 8014731C 00000000 */ nop
|
||||
/* 0DDA20 80147320 08051CD6 */ j .L80147358
|
||||
/* 0DDA24 80147324 A6000002 */ sh $zero, 2($s0)
|
||||
|
||||
.L80147328:
|
||||
/* 0DDA28 80147328 0C015512 */ jal func_80055448
|
||||
/* 0DDA2C 8014732C 00000000 */ nop
|
||||
/* 0DDA30 80147330 14400009 */ bnez $v0, .L80147358
|
||||
/* 0DDA34 80147334 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 0DDA38 80147338 0C015519 */ jal func_80055464
|
||||
/* 0DDA3C 8014733C 0080282D */ daddu $a1, $a0, $zero
|
||||
/* 0DDA40 80147340 14400005 */ bnez $v0, .L80147358
|
||||
/* 0DDA44 80147344 00000000 */ nop
|
||||
/* 0DDA48 80147348 96020000 */ lhu $v0, 0($s0)
|
||||
/* 0DDA4C 8014734C A6000002 */ sh $zero, 2($s0)
|
||||
/* 0DDA50 80147350 34420001 */ ori $v0, $v0, 1
|
||||
/* 0DDA54 80147354 A6020000 */ sh $v0, 0($s0)
|
||||
.L80147358:
|
||||
/* 0DDA58 80147358 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0DDA5C 8014735C 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 0DDA60 80147360 03E00008 */ jr $ra
|
||||
/* 0DDA64 80147364 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
.include "include/macro.inc"
|
||||
|
||||
glabel play_ambient_sounds
|
||||
/* 0DDA68 80147368 3C028007 */ lui $v0, 0x8007
|
||||
/* 0DDA6C 8014736C 8C42419C */ lw $v0, 0x419c($v0)
|
||||
/* 0DDA70 80147370 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0DDA74 80147374 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 0DDA78 80147378 3C108016 */ lui $s0, 0x8016
|
||||
/* 0DDA7C 8014737C 2610C7C0 */ addiu $s0, $s0, -0x3840
|
||||
/* 0DDA80 80147380 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0DDA84 80147384 8042007A */ lb $v0, 0x7a($v0)
|
||||
/* 0DDA88 80147388 14400009 */ bnez $v0, .L801473B0
|
||||
/* 0DDA8C 8014738C 0200302D */ daddu $a2, $s0, $zero
|
||||
/* 0DDA90 80147390 8E040008 */ lw $a0, 8($s0)
|
||||
/* 0DDA94 80147394 0C015529 */ jal func_800554A4
|
||||
/* 0DDA98 80147398 00000000 */ nop
|
||||
/* 0DDA9C 8014739C 96030000 */ lhu $v1, ($s0)
|
||||
/* 0DDAA0 801473A0 24020001 */ addiu $v0, $zero, 1
|
||||
/* 0DDAA4 801473A4 3063FFFE */ andi $v1, $v1, 0xfffe
|
||||
/* 0DDAA8 801473A8 08051CF5 */ j .L801473D4
|
||||
/* 0DDAAC 801473AC A6030000 */ sh $v1, ($s0)
|
||||
|
||||
.L801473B0:
|
||||
/* 0DDAB0 801473B0 8CC20008 */ lw $v0, 8($a2)
|
||||
/* 0DDAB4 801473B4 10440006 */ beq $v0, $a0, .L801473D0
|
||||
/* 0DDAB8 801473B8 24020001 */ addiu $v0, $zero, 1
|
||||
/* 0DDABC 801473BC 0040182D */ daddu $v1, $v0, $zero
|
||||
/* 0DDAC0 801473C0 ACC40008 */ sw $a0, 8($a2)
|
||||
/* 0DDAC4 801473C4 ACC50004 */ sw $a1, 4($a2)
|
||||
/* 0DDAC8 801473C8 08051CF5 */ j .L801473D4
|
||||
/* 0DDACC 801473CC A4C30002 */ sh $v1, 2($a2)
|
||||
|
||||
.L801473D0:
|
||||
/* 0DDAD0 801473D0 24020002 */ addiu $v0, $zero, 2
|
||||
.L801473D4:
|
||||
/* 0DDAD4 801473D4 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0DDAD8 801473D8 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 0DDADC 801473DC 03E00008 */ jr $ra
|
||||
/* 0DDAE0 801473E0 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _COMMON_STRUCTS_H_
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "types.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ s16 unk_00;
|
||||
|
@ -12,5 +12,10 @@ s32 get_variable(script_context* script, s32 pos);
|
||||
f32 get_float_variable(script_context* script, s32 pos);
|
||||
f32 sin_deg(f32 x);
|
||||
f32 cos_deg(f32 x);
|
||||
s32 func_80055448(s32);
|
||||
s32 func_80055464(s32, s32);
|
||||
s32 func_800554A4(s32, s32);
|
||||
s32 func_800554E8(s32, s32);
|
||||
s32 func_800555E4(s32);
|
||||
|
||||
#endif
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define INCLUDE_ASM(FOLDER, NAME, ARGS...) \
|
||||
__attribute__((naked)) NAME(ARGS) { __asm__( ".include \"asm/nonmatchings/"#FOLDER"/"#NAME".s\"\n.set reorder\n.set at"); }
|
||||
|
||||
#endif
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@ extern s16 D_8010CD12;
|
||||
|
||||
extern UNK_TYPE D_800E92D8;
|
||||
extern UNK_TYPE D_80147474;
|
||||
extern UNK_TYPE D_80147574;
|
||||
extern UNK_TYPE D_80109270;
|
||||
extern UNK_TYPE D_80108558;
|
||||
extern u16 D_800A0940;
|
||||
|
@ -12,19 +12,19 @@ INCLUDE_ASM(code_303c0_len_3e10, func_80055330);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_800553C0);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_80055448);
|
||||
s32 INCLUDE_ASM(code_303c0_len_3e10, func_80055448, s32 arg0);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_80055464);
|
||||
s32 INCLUDE_ASM(code_303c0_len_3e10, func_80055464, s32 arg0, s32 arg1);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_800554A4);
|
||||
s32 INCLUDE_ASM(code_303c0_len_3e10, func_800554A4, s32 arg0, s32 arg1);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_800554E8);
|
||||
s32 INCLUDE_ASM(code_303c0_len_3e10, func_800554E8, s32 arg0, s32 arg1);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_8005553C);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_80055590);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_800555E4);
|
||||
s32 INCLUDE_ASM(code_303c0_len_3e10, func_800555E4, s32 arg0);
|
||||
|
||||
INCLUDE_ASM(code_303c0_len_3e10, func_800556D0);
|
||||
|
||||
|
@ -300,6 +300,55 @@ void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_80850_len_3060, update_coin_counter);
|
||||
// very close to matching, but probably not right.
|
||||
/*
|
||||
void update_coin_counter(void) {
|
||||
ui_status* uiStatus = &gUIStatus;
|
||||
player_data* playerData = &gPlayerData;
|
||||
|
||||
if (uiStatus->unk_6D != 0) {
|
||||
uiStatus->unk_6D -= 1;
|
||||
if ((uiStatus->unk_6D << 24) == 0) {
|
||||
if (uiStatus->iconIndex12 >= 0) {
|
||||
free_icon(uiStatus->iconIndex12);
|
||||
free_icon(uiStatus->iconIndex13);
|
||||
uiStatus->iconIndex12 = -1;
|
||||
}
|
||||
}
|
||||
D_8010CD12 = 0;
|
||||
}
|
||||
|
||||
if (uiStatus->unk_6C != 0) {
|
||||
if (uiStatus->displayCoins == playerData->coins) {
|
||||
if (uiStatus->unk_6C > 30) {
|
||||
uiStatus->unk_6C = 30;
|
||||
}
|
||||
if (uiStatus->displayCoins == playerData->coins) {
|
||||
goto tail;
|
||||
}
|
||||
}
|
||||
|
||||
if (uiStatus->unk_6C > 0x1E) {
|
||||
return;
|
||||
}
|
||||
|
||||
tail:
|
||||
uiStatus->unk_6C -= 1;
|
||||
if (uiStatus->unk_6C == 0) {
|
||||
func_80147E7C(20, &D_80147574);
|
||||
uiStatus->unk_6D = 15;
|
||||
D_8010CD10 = 0;
|
||||
D_8010CD12 = 1;
|
||||
uiStatus->iconIndex12 = uiStatus->iconIndex10;
|
||||
uiStatus->iconIndex13 = uiStatus->iconIndex11;
|
||||
uiStatus->displayCoins = playerData->coins;
|
||||
if (uiStatus->unk_6E > -1) {
|
||||
uiStatus->ignoreChanges = uiStatus->unk_6E;
|
||||
uiStatus->unk_6E = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void show_coin_counter(void) {
|
||||
ui_status* uiStatus = &gUIStatus;
|
||||
|
@ -15,31 +15,61 @@ void func_80147230(void) {
|
||||
D_8015C7C0 = D_8014F140;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_dd930_len_1c0, UpdateMusicPlayers);
|
||||
void UpdateMusicPlayers(void) {
|
||||
struct_80147230* temp = &D_8015C7C0;
|
||||
|
||||
INCLUDE_ASM(code_dd930_len_1c0, play_ambient_sounds);
|
||||
switch (temp->unk2) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if (temp->unk0 & 1) {
|
||||
s32 phi_v0;
|
||||
if (temp->unk4 < 0xFA) {
|
||||
phi_v0 = func_800554A4(0, temp->unk4);
|
||||
} else {
|
||||
phi_v0 = func_800554E8(0, temp->unk4);
|
||||
}
|
||||
if (phi_v0 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
temp->unk2 = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (temp->unk0 & 1) {
|
||||
if (func_800555E4(0) != 0) {
|
||||
return;
|
||||
}
|
||||
temp->unk0 &= ~1;
|
||||
}
|
||||
if (temp->unk8 < 0) {
|
||||
temp->unk2 = 0;
|
||||
} else if (func_80055448(temp->unk8) == 0) {
|
||||
if (func_80055464(0, 0) == 0) {
|
||||
temp->unk2 = 0;
|
||||
temp->unk0 |= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// matches, but clearly isn't correct. Investigate later.
|
||||
/*int play_ambient_sounds(int a0, int a1)
|
||||
{
|
||||
s32 play_ambient_sounds(s32 arg0, s32 arg1) {
|
||||
struct_80147230* temp1 = &D_8015C7C0;
|
||||
struct_80147230* temp2 = &D_8015C7C0;
|
||||
struct_80147230 **temp3 = &temp2;
|
||||
|
||||
if ((*gGameStatusPtr)->musicEnabled == 0)
|
||||
{
|
||||
func_800554A4(temp2->unk8);
|
||||
temp2->unk0 &= ~1;
|
||||
if ((*gGameStatusPtr)->musicEnabled == 0) {
|
||||
func_800554A4(temp1->unk8, arg1);
|
||||
temp1->unk0 &= ~1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (temp2->unk8 == a0)
|
||||
{
|
||||
if (temp1->unk8 == arg0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
temp2->unk8 = a0;
|
||||
temp2->unk4 = a1;
|
||||
temp2->unk8 = arg0;
|
||||
temp2->unk4 = arg1;
|
||||
temp2->unk2 = 1;
|
||||
return 1;
|
||||
}*/
|
||||
}
|
@ -3,6 +3,7 @@ gUIStatus = 0x8010EF58;
|
||||
gPlayerData = 0x8010F290;
|
||||
gPlayerStatus = 0x8010EFC8;
|
||||
gItemTable = 0x800878E0;
|
||||
D_80147574 = 0x80147574;
|
||||
|
||||
D_800E92D8 = 0x800E92D8;
|
||||
D_80147474 = 0x80147474;
|
||||
|
Loading…
Reference in New Issue
Block a user