diff --git a/asm/nonmatchings/battle/area_hos/47F0B0/func_80218000_47F0B0.s b/asm/nonmatchings/battle/area_hos/47F0B0/func_80218000_47F0B0.s deleted file mode 100644 index 77df927462..0000000000 --- a/asm/nonmatchings/battle/area_hos/47F0B0/func_80218000_47F0B0.s +++ /dev/null @@ -1,12 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80218000_47F0B0 -/* 47F0B0 80218000 24020001 */ addiu $v0, $zero, 1 -/* 47F0B4 80218004 3C018011 */ lui $at, %hi(gPlayerData+0x12) -/* 47F0B8 80218008 A022F2A2 */ sb $v0, %lo(gPlayerData+0x12)($at) -/* 47F0BC 8021800C 03E00008 */ jr $ra -/* 47F0C0 80218010 24020002 */ addiu $v0, $zero, 2 -/* 47F0C4 80218014 00000000 */ nop -/* 47F0C8 80218018 00000000 */ nop -/* 47F0CC 8021801C 00000000 */ nop diff --git a/asm/nonmatchings/code_7bb60_len_41b0/func_800E5150.s b/asm/nonmatchings/code_7bb60_len_41b0/func_800E5150.s deleted file mode 100644 index 391d88aa6b..0000000000 --- a/asm/nonmatchings/code_7bb60_len_41b0/func_800E5150.s +++ /dev/null @@ -1,13 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800E5150 -/* 7E600 800E5150 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E604 800E5154 AFBF0010 */ sw $ra, 0x10($sp) -/* 7E608 800E5158 0C03945D */ jal func_800E5174 -/* 7E60C 800E515C 00000000 */ nop -/* 7E610 800E5160 8FBF0010 */ lw $ra, 0x10($sp) -/* 7E614 800E5164 3C018016 */ lui $at, %hi(gCollisionStatus+0xA) -/* 7E618 800E5168 A422A55A */ sh $v0, %lo(gCollisionStatus+0xA)($at) -/* 7E61C 800E516C 03E00008 */ jr $ra -/* 7E620 800E5170 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_7bb60_len_41b0/func_800E5520.s b/asm/nonmatchings/code_7bb60_len_41b0/func_800E5520.s deleted file mode 100644 index caefc10828..0000000000 --- a/asm/nonmatchings/code_7bb60_len_41b0/func_800E5520.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800E5520 -/* 7E9D0 800E5520 3C018011 */ lui $at, %hi(D_8010C9B0) -/* 7E9D4 800E5524 A420C9B0 */ sh $zero, %lo(D_8010C9B0)($at) -/* 7E9D8 800E5528 03E00008 */ jr $ra -/* 7E9DC 800E552C 00000000 */ nop diff --git a/asm/nonmatchings/code_7bb60_len_41b0/func_800E636C.s b/asm/nonmatchings/code_7bb60_len_41b0/func_800E636C.s deleted file mode 100644 index 4a23e023c5..0000000000 --- a/asm/nonmatchings/code_7bb60_len_41b0/func_800E636C.s +++ /dev/null @@ -1,19 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800E636C -/* 7F81C 800E636C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7F820 800E6370 AFB00010 */ sw $s0, 0x10($sp) -/* 7F824 800E6374 0080802D */ daddu $s0, $a0, $zero -/* 7F828 800E6378 3C048011 */ lui $a0, %hi(D_8010C96C) -/* 7F82C 800E637C 8C84C96C */ lw $a0, %lo(D_8010C96C)($a0) -/* 7F830 800E6380 04800004 */ bltz $a0, .L800E6394 -/* 7F834 800E6384 AFBF0014 */ sw $ra, 0x14($sp) -/* 7F838 800E6388 0C00E2B7 */ jal get_npc_by_index -/* 7F83C 800E638C 00000000 */ nop -/* 7F840 800E6390 AC500028 */ sw $s0, 0x28($v0) -.L800E6394: -/* 7F844 800E6394 8FBF0014 */ lw $ra, 0x14($sp) -/* 7F848 800E6398 8FB00010 */ lw $s0, 0x10($sp) -/* 7F84C 800E639C 03E00008 */ jr $ra -/* 7F850 800E63A0 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_7fd10_len_b40/func_800E6860.s b/asm/nonmatchings/code_7fd10_len_b40/func_800E6860.s deleted file mode 100644 index 8414a3aa09..0000000000 --- a/asm/nonmatchings/code_7fd10_len_b40/func_800E6860.s +++ /dev/null @@ -1,46 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800E6860 -/* 7FD10 800E6860 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 7FD14 800E6864 3C038011 */ lui $v1, %hi(D_8010EBB0) -/* 7FD18 800E6868 2463EBB0 */ addiu $v1, $v1, %lo(D_8010EBB0) -/* 7FD1C 800E686C AFBF0028 */ sw $ra, 0x28($sp) -/* 7FD20 800E6870 AFB10024 */ sw $s1, 0x24($sp) -/* 7FD24 800E6874 AFB00020 */ sw $s0, 0x20($sp) -/* 7FD28 800E6878 80620000 */ lb $v0, ($v1) -/* 7FD2C 800E687C 3C118011 */ lui $s1, %hi(gPlayerStatus) -/* 7FD30 800E6880 2631EFC8 */ addiu $s1, $s1, %lo(gPlayerStatus) -/* 7FD34 800E6884 1040001A */ beqz $v0, .L800E68F0 -/* 7FD38 800E6888 24020009 */ addiu $v0, $zero, 9 -/* 7FD3C 800E688C 80630003 */ lb $v1, 3($v1) -/* 7FD40 800E6890 14620017 */ bne $v1, $v0, .L800E68F0 -/* 7FD44 800E6894 00000000 */ nop -/* 7FD48 800E6898 0C00EABB */ jal get_npc_unsafe -/* 7FD4C 800E689C 2404FFFC */ addiu $a0, $zero, -4 -/* 7FD50 800E68A0 0000202D */ daddu $a0, $zero, $zero -/* 7FD54 800E68A4 2405FFFF */ addiu $a1, $zero, -1 -/* 7FD58 800E68A8 24060007 */ addiu $a2, $zero, 7 -/* 7FD5C 800E68AC 0080382D */ daddu $a3, $a0, $zero -/* 7FD60 800E68B0 9223000E */ lbu $v1, 0xe($s1) -/* 7FD64 800E68B4 0040802D */ daddu $s0, $v0, $zero -/* 7FD68 800E68B8 AFA00010 */ sw $zero, 0x10($sp) -/* 7FD6C 800E68BC AFA00014 */ sw $zero, 0x14($sp) -/* 7FD70 800E68C0 AFA0001C */ sw $zero, 0x1c($sp) -/* 7FD74 800E68C4 0C0B77B9 */ jal func_802DDEE4 -/* 7FD78 800E68C8 AFA30018 */ sw $v1, 0x18($sp) -/* 7FD7C 800E68CC 0200202D */ daddu $a0, $s0, $zero -/* 7FD80 800E68D0 24050007 */ addiu $a1, $zero, 7 -/* 7FD84 800E68D4 9226000E */ lbu $a2, 0xe($s1) -/* 7FD88 800E68D8 0000382D */ daddu $a3, $zero, $zero -/* 7FD8C 800E68DC AFA00010 */ sw $zero, 0x10($sp) -/* 7FD90 800E68E0 AFA00014 */ sw $zero, 0x14($sp) -/* 7FD94 800E68E4 0C00F589 */ jal func_8003D624 -/* 7FD98 800E68E8 AFA00018 */ sw $zero, 0x18($sp) -/* 7FD9C 800E68EC A220000F */ sb $zero, 0xf($s1) -.L800E68F0: -/* 7FDA0 800E68F0 8FBF0028 */ lw $ra, 0x28($sp) -/* 7FDA4 800E68F4 8FB10024 */ lw $s1, 0x24($sp) -/* 7FDA8 800E68F8 8FB00020 */ lw $s0, 0x20($sp) -/* 7FDAC 800E68FC 03E00008 */ jr $ra -/* 7FDB0 800E6900 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/nonmatchings/code_7fd10_len_b40/func_800E6B68.s b/asm/nonmatchings/code_7fd10_len_b40/func_800E6B68.s deleted file mode 100644 index 724041f8df..0000000000 --- a/asm/nonmatchings/code_7fd10_len_b40/func_800E6B68.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800E6B68 -/* 80018 800E6B68 3C018011 */ lui $at, %hi(D_8010CD00) -/* 8001C 800E6B6C A420CD00 */ sh $zero, %lo(D_8010CD00)($at) -/* 80020 800E6B70 03E00008 */ jr $ra -/* 80024 800E6B74 00000000 */ nop diff --git a/include/common_structs.h b/include/common_structs.h index b8fb35a9bb..8ecb5933b6 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1123,7 +1123,8 @@ typedef struct CollisionStatus { /* 0x04 */ s16 lastTouchedFloor; /* valid after jump */ /* 0x06 */ s16 floorBelow; /* 0x08 */ s16 currentCeiling; /* valid on touching with head */ - /* 0x0A */ char unk_0A[8]; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ char unk_0C[0x6]; /* 0x12 */ s16 currentWall; /* 0x14 */ s16 lastWallHammered; /* valid when smashing */ /* 0x16 */ s16 touchingWallTrigger; /* 0/1 */ @@ -1411,7 +1412,10 @@ typedef struct PlayerStatus { /* 0x008 */ s16 framesOnGround; /* Number of frames since last jump landed */ /* 0x00A */ char unk_0A[2]; /* 0x00C */ u8 peachDisguise; - /* 0x00D */ char unk_0D[5]; + /* 0x00D */ char unk_0D[1]; + /* 0x00E */ u8 unk_0E; + /* 0x00F */ u8 unk_0F; + /* 0x010 */ char unk_10[0x2]; /* 0x012 */ s16 moveFrames; /* 0x014 */ s8 enableCollisionOverlapsCheck; /* 0x015 */ s8 statusMenuCounterinputEnabledCounter; /* whether the C-up menu can appear */ diff --git a/include/enums.h b/include/enums.h index 5156552b4b..68349ca77d 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1092,4 +1092,20 @@ typedef UNK_TYPE DamageType; #define DamageType_QUAKE 0x00000800 #define DamageType_THROW 0x00040000 +typedef s8 PartnerID; +enum PartnerID { + PartnerID_NONE, + PartnerID_GOOMBARIO, + PartnerID_KOOPER, + PartnerID_BOMBETTE, + PartnerID_PARAKARRY, + PartnerID_GOOMPA, + PartnerID_WATT, + PartnerID_SUSHIE, + PartnerID_LAKILESTER, + PartnerID_BOW, + PartnerID_GOOMBARIA, + PartnerID_TWINK, +}; + #endif diff --git a/include/functions.h b/include/functions.h index 15c1d32aaf..e21f624388 100644 --- a/include/functions.h +++ b/include/functions.h @@ -100,6 +100,8 @@ void pause_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 s32 func_800DCB7C(s32, f32*, f32*, f32*, f32*); s32 func_800DDC44(s32, f32*, f32*, f32*, f32, f32, f32, f32); +Npc* get_npc_by_index(s32 listIndex); + // Partner void func_800EBA3C(Npc* partner); void func_800EBB40(Npc* partner); diff --git a/src/battle/area_arn/4FEA50.c b/src/battle/area_arn/4FEA50.c index e9d70eff05..3e234e6eb6 100644 --- a/src/battle/area_arn/4FEA50.c +++ b/src/battle/area_arn/4FEA50.c @@ -4,6 +4,6 @@ #include "common/StartRumbleWithParams.inc.c" -INCLUDE_ASM(s32, "battle/area_arn/4FEA50", func_80218058_4FEAA8); +INCLUDE_ASM(s32, "battle/area_arn/4FEA50", func_80218058_4FEAA8, f32 arg0, f32 arg1); INCLUDE_ASM(s32, "battle/area_arn/4FEA50", func_802181E4_4FEC34); diff --git a/src/battle/area_hos/47F0B0.c b/src/battle/area_hos/47F0B0.c index fb372fdb94..e7f56cac0c 100644 --- a/src/battle/area_hos/47F0B0.c +++ b/src/battle/area_hos/47F0B0.c @@ -2,4 +2,9 @@ #define NAMESPACE b_area_hos -INCLUDE_ASM(s32, "battle/area_hos/47F0B0", func_80218000_47F0B0); +ApiStatus func_80218000_47F0B0(ScriptInstance* script, s32 isInitialCall) { + PlayerData* playerData = PLAYER_DATA; + + playerData->currentPartner = PartnerID_GOOMBARIO; + return ApiStatus_DONE2; +} diff --git a/src/code_7bb60_len_41b0.c b/src/code_7bb60_len_41b0.c index c77926fa26..62c381f980 100644 --- a/src/code_7bb60_len_41b0.c +++ b/src/code_7bb60_len_41b0.c @@ -1,8 +1,11 @@ #include "common.h" #include "world/partners.h" +extern s32 D_8010C96C; // npc list index +extern s16 D_8010C9B0; + void func_800E26B0(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; playerStatus->jumpApexHeight = playerStatus->position.y; } @@ -12,7 +15,7 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E26C4); void set_action_state(s32 actionState); void move_player(s32 duration, f32 heading, f32 speed) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; playerStatus->flags |= 0x4000; playerStatus->heading = heading; @@ -43,7 +46,7 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E315C); INCLUDE_ASM(s32, "code_7bb60_len_41b0", phys_player_land); f32 integrate_gravity(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; if (playerStatus->flags & 0x40000) { playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3] / 1.7f; @@ -98,7 +101,9 @@ PartnerID get_current_partner_id(void) { INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5098); -INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5150); +void func_800E5150(void) { + gCollisionStatus.unk_0A = func_800E5174(); +} INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5174); @@ -109,14 +114,16 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5348); INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E546C); void save_ground_pos(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; playerStatus->lastGoodPosition.x = playerStatus->position.x; playerStatus->lastGoodPosition.y = playerStatus->position.y; playerStatus->lastGoodPosition.z = playerStatus->position.z; } -INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5520); +void func_800E5520(void) { + D_8010C9B0 = 0; +} INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5530); @@ -131,8 +138,8 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5A2C); INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E5C78); void set_action_state(s32 actionState) { - PlayerStatus* playerStatus = &gPlayerStatus; - PlayerData* playerData = &gPlayerData; + PlayerStatus* playerStatus = PLAYER_STATUS; + PlayerData* playerData = PLAYER_DATA; UNK_TYPE* unknownStruct = &D_8010F250; if (playerStatus->flags & 0x200) { @@ -204,7 +211,7 @@ void set_action_state(s32 actionState) { } void update_locomotion_state(void) { - PlayerStatus* playerStatus = (&gPlayerStatus); + PlayerStatus* playerStatus = PLAYER_STATUS; do { } while (0); // required to match set_action_state((!is_ability_active(Ability_SLOW_GO) @@ -212,7 +219,7 @@ void update_locomotion_state(void) { } void start_falling(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; set_action_state(ActionState_FALLING); playerStatus->gravityIntegrator[0] = 0.1143f; @@ -222,7 +229,7 @@ void start_falling(void) { } void start_bounce_a(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; set_action_state(ActionState_BOUNCE); playerStatus->gravityIntegrator[0] = 10.0f; @@ -232,7 +239,7 @@ void start_bounce_a(void) { } void start_bounce_b(void) { - PlayerStatus* playerStatus = &gPlayerStatus; + PlayerStatus* playerStatus = PLAYER_STATUS; set_action_state(ActionState_BOUNCE); playerStatus->gravityIntegrator[0] = 8.0f; @@ -243,8 +250,8 @@ void start_bounce_b(void) { } s32 check_input_hammer(void) { - PlayerStatus* playerStatus = &gPlayerStatus; - PlayerData* playerData = &gPlayerData; + PlayerStatus* playerStatus = PLAYER_STATUS; + PlayerData* playerData = PLAYER_DATA; if (playerStatus->pressedButtons & Button_B) { if (!(playerStatus->flags & 4)) { @@ -264,7 +271,13 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", check_input_jump); INCLUDE_ASM(s32, "code_7bb60_len_41b0", check_input_spin); -INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E636C); +void func_800E636C(s32 arg0) { + s32 listIndex = D_8010C96C; + + if (listIndex >= 0) { + get_npc_by_index(listIndex)->currentAnim = arg0; + } +} INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E63A4); diff --git a/src/code_7fd10_len_b40.c b/src/code_7fd10_len_b40.c index 103012d8c8..3ca9f1434b 100644 --- a/src/code_7fd10_len_b40.c +++ b/src/code_7fd10_len_b40.c @@ -1,12 +1,26 @@ #include "common.h" -INCLUDE_ASM(s32, "code_7fd10_len_b40", func_800E6860); +extern s16 D_8010CD00; + +void func_800E6860(void) { + PlayerStatus* playerStatus = PLAYER_STATUS; + + if ((D_8010EBB0[0] != 0) && (D_8010EBB0[3] == 9)) { + Npc* partner = get_npc_unsafe(NpcId_PARTNER); + + func_802DDEE4(0, -1, 7, 0, 0, 0, playerStatus->unk_0E, 0); + func_8003D624(partner, 7, playerStatus->unk_0E, 0, 0, 0, 0); + playerStatus->unk_0F = 0; + } +} INCLUDE_ASM(s32, "code_7fd10_len_b40", func_800E6904); INCLUDE_ASM(s32, "code_7fd10_len_b40", can_pause); -INCLUDE_ASM(s32, "code_7fd10_len_b40", func_800E6B68); +void func_800E6B68(void) { + D_8010CD00 = 0; +} INCLUDE_ASM(s32, "code_7fd10_len_b40", setup_partner_popup); diff --git a/src/world/partners.h b/src/world/partners.h index a4891e4dcf..77b0982a61 100644 --- a/src/world/partners.h +++ b/src/world/partners.h @@ -24,20 +24,4 @@ typedef struct WorldPartner { WorldPartner gWorldPartners[11]; -typedef s8 PartnerID; -enum PartnerID { - PartnerID_NONE, - PartnerID_GOOMBARIO, - PartnerID_KOOPER, - PartnerID_BOMBETTE, - PartnerID_PARAKARRY, - PartnerID_GOOMPA, - PartnerID_WATT, - PartnerID_SUSHIE, - PartnerID_LAKILESTER, - PartnerID_BOW, - PartnerID_GOOMBARIA, - PartnerID_TWINK, -}; - #endif