match move_player

This commit is contained in:
Alex Bates 2020-08-20 19:26:34 +01:00
parent 56928c3089
commit e54bb887d7
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
4 changed files with 27 additions and 49 deletions

View File

@ -1,34 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel move_player
/* 07BC28 800E2778 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 07BC2C 800E277C 44861000 */ mtc1 $a2, $f2
/* 07BC30 800E2780 3C068011 */ lui $a2, 0x8011
/* 07BC34 800E2784 24C6EFC8 */ addiu $a2, $a2, -0x1038
/* 07BC38 800E2788 AFBF0010 */ sw $ra, 0x10($sp)
/* 07BC3C 800E278C 8CC20000 */ lw $v0, ($a2)
/* 07BC40 800E2790 34424000 */ ori $v0, $v0, 0x4000
/* 07BC44 800E2794 ACC20000 */ sw $v0, ($a2)
/* 07BC48 800E2798 8CC20004 */ lw $v0, 4($a2)
/* 07BC4C 800E279C 3C030040 */ lui $v1, 0x40
/* 07BC50 800E27A0 ACC500A0 */ sw $a1, 0xa0($a2)
/* 07BC54 800E27A4 A4C40012 */ sh $a0, 0x12($a2)
/* 07BC58 800E27A8 00431024 */ and $v0, $v0, $v1
/* 07BC5C 800E27AC 14400009 */ bnez $v0, .L800E27D4
/* 07BC60 800E27B0 E4C20054 */ swc1 $f2, 0x54($a2)
/* 07BC64 800E27B4 C4C00058 */ lwc1 $f0, 0x58($a2)
/* 07BC68 800E27B8 4602003C */ c.lt.s $f0, $f2
/* 07BC6C 800E27BC 00000000 */ nop
/* 07BC70 800E27C0 45000002 */ bc1f .L800E27CC
/* 07BC74 800E27C4 24040001 */ addiu $a0, $zero, 1
/* 07BC78 800E27C8 24040002 */ addiu $a0, $zero, 2
.L800E27CC:
/* 07BC7C 800E27CC 0C039769 */ jal set_action_state
/* 07BC80 800E27D0 00000000 */ nop
.L800E27D4:
/* 07BC84 800E27D4 8FBF0010 */ lw $ra, 0x10($sp)
/* 07BC88 800E27D8 03E00008 */ jr $ra
/* 07BC8C 800E27DC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1328,7 +1328,7 @@ typedef struct PlayerStatus {
/* 0x044 */ f32 decorationPos[2]; /* 0x044 */ f32 decorationPos[2];
/* 0x04C */ char unk_4C[4]; /* 0x04C */ char unk_4C[4];
/* 0x050 */ f32 jumpApexHeight; /* 0x050 */ f32 jumpApexHeight;
/* 0x054 */ s32 currentSpeed; /* 0x054 */ f32 currentSpeed;
/* 0x058 */ f32 walkSpeed; /* 0x058 */ f32 walkSpeed;
/* 0x05C */ f32 runSpeed; /* 0x05C */ f32 runSpeed;
/* 0x060 */ char unk_60[8]; /* 0x060 */ char unk_60[8];

View File

@ -11,19 +11,18 @@ typedef UNK_TYPE EncounterTriggerFlags;
#define EncounterTriggerFlags_HAMMER 0x00000004 #define EncounterTriggerFlags_HAMMER 0x00000004
#define EncounterTriggerFlags_PARTNER 0x00000006 #define EncounterTriggerFlags_PARTNER 0x00000006
typedef UNK_TYPE PartnerId; #define PartnerId_NONE 0x00
#define PartnerId_NONE 0x00000000 #define PartnerId_GOOMBARIO 0x01
#define PartnerId_GOOMBARIO 0x00000001 #define PartnerId_KOOPER 0x02
#define PartnerId_KOOPER 0x00000002 #define PartnerId_BOMBETTE 0x03
#define PartnerId_BOMBETTE 0x00000003 #define PartnerId_PARAKARRY 0x04
#define PartnerId_PARAKARRY 0x00000004 #define PartnerId_GOOMPA 0x05
#define PartnerId_GOOMPA 0x00000005 #define PartnerId_WATT 0x06
#define PartnerId_WATT 0x00000006 #define PartnerId_SUSHIE 0x07
#define PartnerId_SUSHIE 0x00000007 #define PartnerId_LAKILESTER 0x08
#define PartnerId_LAKILESTER 0x00000008 #define PartnerId_BOW 0x09
#define PartnerId_BOW 0x00000009 #define PartnerId_GOOMBARIA 0x0A
#define PartnerId_GOOMBARIA 0x0000000A #define PartnerId_TWINK 0x0B
#define PartnerId_TWINK 0x0000000B
typedef UNK_TYPE SpriteId; typedef UNK_TYPE SpriteId;
#define SpriteId_WORLD_GOOMBARIO 0x00000001 #define SpriteId_WORLD_GOOMBARIO 0x00000001
@ -1224,7 +1223,6 @@ typedef UNK_TYPE DoorSounds;
#define DoorSounds_CREAKY 0x00000003 #define DoorSounds_CREAKY 0x00000003
#define DoorSounds_GATE 0x00000004 #define DoorSounds_GATE 0x00000004
typedef UNK_TYPE ActionState;
#define ActionState_IDLE 0x00000000 #define ActionState_IDLE 0x00000000
#define ActionState_WALK 0x00000001 #define ActionState_WALK 0x00000001
#define ActionState_RUN 0x00000002 #define ActionState_RUN 0x00000002
@ -1236,6 +1234,7 @@ typedef UNK_TYPE ActionState;
#define ActionState_STEP_DOWN 0x00000009 #define ActionState_STEP_DOWN 0x00000009
#define ActionState_LAND 0x0000000A #define ActionState_LAND 0x0000000A
#define ActionState_STEP_DOWN_LAND 0x0000000B #define ActionState_STEP_DOWN_LAND 0x0000000B
// Following states prohibit normal movement:
#define ActionState_CONVERSATION 0x0000000C #define ActionState_CONVERSATION 0x0000000C
#define ActionState_SPIN_JUMP 0x0000000D #define ActionState_SPIN_JUMP 0x0000000D
#define ActionState_GROUND_POUND 0x0000000E #define ActionState_GROUND_POUND 0x0000000E

View File

@ -6,6 +6,19 @@ INCLUDE_ASM("code_7bb60_len_41b0", func_800E26C4);
INCLUDE_ASM("code_7bb60_len_41b0", move_player); INCLUDE_ASM("code_7bb60_len_41b0", move_player);
void move_player(s16 duration, f32 heading, f32 speed) {
PlayerStatus* player_status = &gPlayerStatus;
player_status->flags = player_status->flags | 0x4000;
player_status->heading = heading;
player_status->moveFrames = duration;
player_status->currentSpeed = speed;
if (!(player_status->animFlags & 0x00400000)) {
set_action_state(speed > player_status->walkSpeed ? ActionState_RUN : ActionState_WALK);
}
}
INCLUDE_ASM("code_7bb60_len_41b0", func_800E27E0); INCLUDE_ASM("code_7bb60_len_41b0", func_800E27E0);
INCLUDE_ASM("code_7bb60_len_41b0", func_800E29C8); INCLUDE_ASM("code_7bb60_len_41b0", func_800E29C8);