mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Float funcs fixed
This commit is contained in:
parent
9ef9d08761
commit
b68891331f
2
Makefile
2
Makefile
@ -47,7 +47,7 @@ TARGET = papermario
|
|||||||
|
|
||||||
CPPFLAGS = -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2
|
CPPFLAGS = -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2
|
||||||
ASFLAGS = -EB -Iinclude -march=vr4300 -mtune=vr4300
|
ASFLAGS = -EB -Iinclude -march=vr4300 -mtune=vr4300
|
||||||
OLDASFLAGS = -EB -Iinclude
|
OLDASFLAGS = -EB -Iinclude -G 0
|
||||||
CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32
|
CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32
|
||||||
LDFLAGS = -T undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/papermario.map --no-check-sections
|
LDFLAGS = -T undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/papermario.map --no-check-sections
|
||||||
|
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
.set noat # allow manual use of $at
|
|
||||||
.set noreorder # don't insert nops after branches
|
|
||||||
|
|
||||||
glabel integrate_gravity
|
|
||||||
/* 7C8F8 800E3448 3C048011 */ lui $a0, %hi(gPlayerStatus)
|
|
||||||
/* 7C8FC 800E344C 2484EFC8 */ addiu $a0, $a0, %lo(gPlayerStatus)
|
|
||||||
/* 7C900 800E3450 8C820000 */ lw $v0, ($a0)
|
|
||||||
/* 7C904 800E3454 3C030004 */ lui $v1, 4
|
|
||||||
/* 7C908 800E3458 00431024 */ and $v0, $v0, $v1
|
|
||||||
/* 7C90C 800E345C 10400012 */ beqz $v0, .L800E34A8
|
|
||||||
/* 7C910 800E3460 00000000 */ nop
|
|
||||||
/* 7C914 800E3464 C480007C */ lwc1 $f0, 0x7c($a0)
|
|
||||||
/* 7C918 800E3468 3C013FD9 */ lui $at, 0x3fd9
|
|
||||||
/* 7C91C 800E346C 3421999A */ ori $at, $at, 0x999a
|
|
||||||
/* 7C920 800E3470 44812000 */ mtc1 $at, $f4
|
|
||||||
/* 7C924 800E3474 C4860078 */ lwc1 $f6, 0x78($a0)
|
|
||||||
/* 7C928 800E3478 46040003 */ div.s $f0, $f0, $f4
|
|
||||||
/* 7C92C 800E347C 46003180 */ add.s $f6, $f6, $f0
|
|
||||||
/* 7C930 800E3480 C4820074 */ lwc1 $f2, 0x74($a0)
|
|
||||||
/* 7C934 800E3484 46043003 */ div.s $f0, $f6, $f4
|
|
||||||
/* 7C938 800E3488 46001080 */ add.s $f2, $f2, $f0
|
|
||||||
/* 7C93C 800E348C C4800070 */ lwc1 $f0, 0x70($a0)
|
|
||||||
/* 7C940 800E3490 46041103 */ div.s $f4, $f2, $f4
|
|
||||||
/* 7C944 800E3494 46040000 */ add.s $f0, $f0, $f4
|
|
||||||
/* 7C948 800E3498 E4860078 */ swc1 $f6, 0x78($a0)
|
|
||||||
/* 7C94C 800E349C E4820074 */ swc1 $f2, 0x74($a0)
|
|
||||||
/* 7C950 800E34A0 08038D34 */ j .L800E34D0
|
|
||||||
/* 7C954 800E34A4 E4800070 */ swc1 $f0, 0x70($a0)
|
|
||||||
.L800E34A8:
|
|
||||||
/* 7C958 800E34A8 C4840078 */ lwc1 $f4, 0x78($a0)
|
|
||||||
/* 7C95C 800E34AC C480007C */ lwc1 $f0, 0x7c($a0)
|
|
||||||
/* 7C960 800E34B0 46002100 */ add.s $f4, $f4, $f0
|
|
||||||
/* 7C964 800E34B4 C4800074 */ lwc1 $f0, 0x74($a0)
|
|
||||||
/* 7C968 800E34B8 46040000 */ add.s $f0, $f0, $f4
|
|
||||||
/* 7C96C 800E34BC C4820070 */ lwc1 $f2, 0x70($a0)
|
|
||||||
/* 7C970 800E34C0 46001080 */ add.s $f2, $f2, $f0
|
|
||||||
/* 7C974 800E34C4 E4840078 */ swc1 $f4, 0x78($a0)
|
|
||||||
/* 7C978 800E34C8 E4800074 */ swc1 $f0, 0x74($a0)
|
|
||||||
/* 7C97C 800E34CC E4820070 */ swc1 $f2, 0x70($a0)
|
|
||||||
.L800E34D0:
|
|
||||||
/* 7C980 800E34D0 03E00008 */ jr $ra
|
|
||||||
/* 7C984 800E34D4 C4800070 */ lwc1 $f0, 0x70($a0)
|
|
@ -1,26 +0,0 @@
|
|||||||
.set noat # allow manual use of $at
|
|
||||||
.set noreorder # don't insert nops after branches
|
|
||||||
|
|
||||||
glabel start_bounce_a
|
|
||||||
/* 7F4E4 800E6034 27BDFFE8 */ addiu $sp, $sp, -0x18
|
|
||||||
/* 7F4E8 800E6038 AFBF0010 */ sw $ra, 0x10($sp)
|
|
||||||
/* 7F4EC 800E603C 0C039769 */ jal set_action_state
|
|
||||||
/* 7F4F0 800E6040 24040004 */ addiu $a0, $zero, 4
|
|
||||||
/* 7F4F4 800E6044 3C014120 */ lui $at, 0x4120
|
|
||||||
/* 7F4F8 800E6048 44810000 */ mtc1 $at, $f0
|
|
||||||
/* 7F4FC 800E604C 3C01C000 */ lui $at, 0xc000
|
|
||||||
/* 7F500 800E6050 44811000 */ mtc1 $at, $f2
|
|
||||||
/* 7F504 800E6054 3C013F4C */ lui $at, 0x3f4c
|
|
||||||
/* 7F508 800E6058 3421CCCD */ ori $at, $at, 0xcccd
|
|
||||||
/* 7F50C 800E605C 44812000 */ mtc1 $at, $f4
|
|
||||||
/* 7F510 800E6060 3C01BF40 */ lui $at, 0xbf40
|
|
||||||
/* 7F514 800E6064 44813000 */ mtc1 $at, $f6
|
|
||||||
/* 7F518 800E6068 3C028011 */ lui $v0, %hi(gPlayerStatus)
|
|
||||||
/* 7F51C 800E606C 2442EFC8 */ addiu $v0, $v0, %lo(gPlayerStatus)
|
|
||||||
/* 7F520 800E6070 E4400070 */ swc1 $f0, 0x70($v0)
|
|
||||||
/* 7F524 800E6074 E4420074 */ swc1 $f2, 0x74($v0)
|
|
||||||
/* 7F528 800E6078 E4440078 */ swc1 $f4, 0x78($v0)
|
|
||||||
/* 7F52C 800E607C E446007C */ swc1 $f6, 0x7c($v0)
|
|
||||||
/* 7F530 800E6080 8FBF0010 */ lw $ra, 0x10($sp)
|
|
||||||
/* 7F534 800E6084 03E00008 */ jr $ra
|
|
||||||
/* 7F538 800E6088 27BD0018 */ addiu $sp, $sp, 0x18
|
|
@ -1,29 +0,0 @@
|
|||||||
.set noat # allow manual use of $at
|
|
||||||
.set noreorder # don't insert nops after branches
|
|
||||||
|
|
||||||
glabel start_falling
|
|
||||||
/* 7F480 800E5FD0 27BDFFE8 */ addiu $sp, $sp, -0x18
|
|
||||||
/* 7F484 800E5FD4 AFBF0010 */ sw $ra, 0x10($sp)
|
|
||||||
/* 7F488 800E5FD8 0C039769 */ jal set_action_state
|
|
||||||
/* 7F48C 800E5FDC 24040008 */ addiu $a0, $zero, 8
|
|
||||||
/* 7F490 800E5FE0 3C013DEA */ lui $at, 0x3dea
|
|
||||||
/* 7F494 800E5FE4 3421161E */ ori $at, $at, 0x161e
|
|
||||||
/* 7F498 800E5FE8 44810000 */ mtc1 $at, $f0
|
|
||||||
/* 7F49C 800E5FEC 3C01BE92 */ lui $at, 0xbe92
|
|
||||||
/* 7F4A0 800E5FF0 3421FEC5 */ ori $at, $at, 0xfec5
|
|
||||||
/* 7F4A4 800E5FF4 44811000 */ mtc1 $at, $f2
|
|
||||||
/* 7F4A8 800E5FF8 3C01BE3A */ lui $at, 0xbe3a
|
|
||||||
/* 7F4AC 800E5FFC 3421ACDA */ ori $at, $at, 0xacda
|
|
||||||
/* 7F4B0 800E6000 44812000 */ mtc1 $at, $f4
|
|
||||||
/* 7F4B4 800E6004 3C013C3C */ lui $at, 0x3c3c
|
|
||||||
/* 7F4B8 800E6008 3421BE62 */ ori $at, $at, 0xbe62
|
|
||||||
/* 7F4BC 800E600C 44813000 */ mtc1 $at, $f6
|
|
||||||
/* 7F4C0 800E6010 3C028011 */ lui $v0, %hi(gPlayerStatus)
|
|
||||||
/* 7F4C4 800E6014 2442EFC8 */ addiu $v0, $v0, %lo(gPlayerStatus)
|
|
||||||
/* 7F4C8 800E6018 E4400070 */ swc1 $f0, 0x70($v0)
|
|
||||||
/* 7F4CC 800E601C E4420074 */ swc1 $f2, 0x74($v0)
|
|
||||||
/* 7F4D0 800E6020 E4440078 */ swc1 $f4, 0x78($v0)
|
|
||||||
/* 7F4D4 800E6024 E446007C */ swc1 $f6, 0x7c($v0)
|
|
||||||
/* 7F4D8 800E6028 8FBF0010 */ lw $ra, 0x10($sp)
|
|
||||||
/* 7F4DC 800E602C 03E00008 */ jr $ra
|
|
||||||
/* 7F4E0 800E6030 27BD0018 */ addiu $sp, $sp, 0x18
|
|
@ -1,31 +0,0 @@
|
|||||||
.set noat # allow manual use of $at
|
|
||||||
.set noreorder # don't insert nops after branches
|
|
||||||
|
|
||||||
glabel update_locomotion_state
|
|
||||||
/* 7F418 800E5F68 27BDFFE8 */ addiu $sp, $sp, -0x18
|
|
||||||
/* 7F41C 800E5F6C AFB00010 */ sw $s0, 0x10($sp)
|
|
||||||
/* 7F420 800E5F70 3C108011 */ lui $s0, %hi(gPlayerStatus)
|
|
||||||
/* 7F424 800E5F74 2610EFC8 */ addiu $s0, $s0, %lo(gPlayerStatus)
|
|
||||||
/* 7F428 800E5F78 AFBF0014 */ sw $ra, 0x14($sp)
|
|
||||||
/* 7F42C 800E5F7C 0C03A752 */ jal is_ability_active
|
|
||||||
/* 7F430 800E5F80 2404000B */ addiu $a0, $zero, 0xb
|
|
||||||
/* 7F434 800E5F84 1440000C */ bnez $v0, .L800E5FB8
|
|
||||||
/* 7F438 800E5F88 24040001 */ addiu $a0, $zero, 1
|
|
||||||
/* 7F43C 800E5F8C 8E0200E8 */ lw $v0, 0xe8($s0)
|
|
||||||
/* 7F440 800E5F90 00420018 */ mult $v0, $v0
|
|
||||||
/* 7F444 800E5F94 00001812 */ mflo $v1
|
|
||||||
/* 7F448 800E5F98 8E0200EC */ lw $v0, 0xec($s0)
|
|
||||||
/* 7F44C 800E5F9C 00000000 */ nop
|
|
||||||
/* 7F450 800E5FA0 00420018 */ mult $v0, $v0
|
|
||||||
/* 7F454 800E5FA4 00003012 */ mflo $a2
|
|
||||||
/* 7F458 800E5FA8 00661021 */ addu $v0, $v1, $a2
|
|
||||||
/* 7F45C 800E5FAC 28420BD2 */ slti $v0, $v0, 0xbd2
|
|
||||||
/* 7F460 800E5FB0 50400001 */ beql $v0, $zero, .L800E5FB8
|
|
||||||
/* 7F464 800E5FB4 24040002 */ addiu $a0, $zero, 2
|
|
||||||
.L800E5FB8:
|
|
||||||
/* 7F468 800E5FB8 0C039769 */ jal set_action_state
|
|
||||||
/* 7F46C 800E5FBC 00000000 */ nop
|
|
||||||
/* 7F470 800E5FC0 8FBF0014 */ lw $ra, 0x14($sp)
|
|
||||||
/* 7F474 800E5FC4 8FB00010 */ lw $s0, 0x10($sp)
|
|
||||||
/* 7F478 800E5FC8 03E00008 */ jr $ra
|
|
||||||
/* 7F47C 800E5FCC 27BD0018 */ addiu $sp, $sp, 0x18
|
|
@ -243,6 +243,10 @@ typedef union {
|
|||||||
s32 flags;
|
s32 flags;
|
||||||
} ScriptFlags;
|
} ScriptFlags;
|
||||||
|
|
||||||
|
struct ScriptInstance;
|
||||||
|
|
||||||
|
typedef ApiStatus(*ApiFunc)(struct ScriptInstance*, s32);
|
||||||
|
|
||||||
typedef struct ScriptInstance {
|
typedef struct ScriptInstance {
|
||||||
/* 0x000 */ ScriptFlags flags;
|
/* 0x000 */ ScriptFlags flags;
|
||||||
/* 0x004 */ u8 groupFlags;
|
/* 0x004 */ u8 groupFlags;
|
||||||
@ -1407,7 +1411,7 @@ typedef struct PlayerStatus {
|
|||||||
/* 0x0DC */ s32 currentButtons;
|
/* 0x0DC */ s32 currentButtons;
|
||||||
/* 0x0E0 */ s32 pressedButtons;
|
/* 0x0E0 */ s32 pressedButtons;
|
||||||
/* 0x0E4 */ s32 heldButtons;
|
/* 0x0E4 */ s32 heldButtons;
|
||||||
/* 0x0E8 */ f32 stickAxis[2];
|
/* 0x0E8 */ s32 stickAxis[2];
|
||||||
/* 0x0F0 */ s32 currentButtonsBuffer[10];
|
/* 0x0F0 */ s32 currentButtonsBuffer[10];
|
||||||
/* 0x118 */ s32 pressedButtonsBuffer[10];
|
/* 0x118 */ s32 pressedButtonsBuffer[10];
|
||||||
/* 0x140 */ s32 heldButtonsBuffer[10];
|
/* 0x140 */ s32 heldButtonsBuffer[10];
|
||||||
|
@ -21,8 +21,4 @@ typedef s32 ApiStatus;
|
|||||||
#define ApiStatus_REPEAT 3 /* Call again immediately */
|
#define ApiStatus_REPEAT 3 /* Call again immediately */
|
||||||
#define ApiStatus_FINISH 255 /* Corresponds to SI_FINISH */
|
#define ApiStatus_FINISH 255 /* Corresponds to SI_FINISH */
|
||||||
|
|
||||||
struct ScriptInstance;
|
|
||||||
|
|
||||||
typedef ApiStatus(*ApiFunc)(struct ScriptInstance* script, s32 isInitialCall);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,7 +18,7 @@ void move_player(s16 duration, f32 heading, f32 speed) {
|
|||||||
playerStatus->moveFrames = duration;
|
playerStatus->moveFrames = duration;
|
||||||
playerStatus->currentSpeed = speed;
|
playerStatus->currentSpeed = speed;
|
||||||
|
|
||||||
if (!(playerStatus->animFlags & 0x00400000)) {
|
if (!(playerStatus->animFlags & 0x400000)) {
|
||||||
set_action_state(speed > playerStatus->walkSpeed ? ActionState_RUN : ActionState_WALK);
|
set_action_state(speed > playerStatus->walkSpeed ? ActionState_RUN : ActionState_WALK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,7 +41,20 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E315C);
|
|||||||
|
|
||||||
INCLUDE_ASM(s32, "code_7bb60_len_41b0", phys_player_land);
|
INCLUDE_ASM(s32, "code_7bb60_len_41b0", phys_player_land);
|
||||||
|
|
||||||
INCLUDE_ASM(f32, "code_7bb60_len_41b0", integrate_gravity);
|
f32 integrate_gravity(void) {
|
||||||
|
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||||
|
|
||||||
|
if (playerStatus->flags & 0x40000) {
|
||||||
|
playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3] / 1.7f;
|
||||||
|
playerStatus->gravityIntegrator[1] += playerStatus->gravityIntegrator[2] / 1.7f;
|
||||||
|
playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1] / 1.7f;
|
||||||
|
} else {
|
||||||
|
playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3];
|
||||||
|
playerStatus->gravityIntegrator[1] += playerStatus->gravityIntegrator[2];
|
||||||
|
playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1];
|
||||||
|
}
|
||||||
|
return playerStatus->gravityIntegrator[0];
|
||||||
|
}
|
||||||
|
|
||||||
f32 func_800E34D8(void) {
|
f32 func_800E34D8(void) {
|
||||||
f32 ret = integrate_gravity();
|
f32 ret = integrate_gravity();
|
||||||
@ -189,36 +202,33 @@ void set_action_state(s32 actionState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDE_ASM(s32, "code_7bb60_len_41b0", update_locomotion_state);
|
void update_locomotion_state(void) {
|
||||||
|
PlayerStatus* playerStatus = (&gPlayerStatus);
|
||||||
|
do { } while (0); // required to match
|
||||||
|
|
||||||
|
set_action_state((!is_ability_active(Ability_SLOW_GO)
|
||||||
|
&& (SQ(playerStatus->stickAxis[0]) + SQ(playerStatus->stickAxis[1]) >= 0xBD2)) ? ActionState_RUN : ActionState_WALK);
|
||||||
|
}
|
||||||
|
|
||||||
// todo these floats don't work
|
|
||||||
#ifdef NON_MATCHING
|
|
||||||
void start_falling(void) {
|
void start_falling(void) {
|
||||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||||
|
|
||||||
set_action_state(ActionState_FALLING);
|
set_action_state(ActionState_FALLING);
|
||||||
playerStatus->gravityIntegrator[1] = 0.1143f;
|
playerStatus->gravityIntegrator[0] = 0.1143f;
|
||||||
playerStatus->gravityIntegrator[2] = -0.2871f;
|
playerStatus->gravityIntegrator[1] = -0.2871f;
|
||||||
playerStatus->gravityIntegrator[3] = -0.1823f;
|
playerStatus->gravityIntegrator[2] = -0.1823f;
|
||||||
playerStatus->gravityIntegrator[4] = 0.01152f;
|
playerStatus->gravityIntegrator[3] = 0.01152f;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
INCLUDE_ASM(void, "code_7bb60_len_41b0", start_falling);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NON_MATCHING
|
|
||||||
void start_bounce_a(void) {
|
void start_bounce_a(void) {
|
||||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||||
|
|
||||||
set_action_state(ActionState_BOUNCE);
|
set_action_state(ActionState_BOUNCE);
|
||||||
playerStatus->gravityIntegrator[0] = 10.0f;
|
playerStatus->gravityIntegrator[0] = 10.0f;
|
||||||
playerStatus->gravityIntegrator[1] = -2.0f;
|
playerStatus->gravityIntegrator[1] = -2.0f;
|
||||||
playerStatus->gravityIntegrator[2] = 0.5f; // todo is 0.8f but this doesn't work atm
|
playerStatus->gravityIntegrator[2] = 0.8f;
|
||||||
playerStatus->gravityIntegrator[3] = -0.75f;
|
playerStatus->gravityIntegrator[3] = -0.75f;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
INCLUDE_ASM(void, "code_7bb60_len_41b0", start_bounce_a);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void start_bounce_b(void) {
|
void start_bounce_b(void) {
|
||||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||||
|
Loading…
Reference in New Issue
Block a user