mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 08:52:40 +01:00
a couple
This commit is contained in:
parent
3d7357eeb7
commit
7376b736d0
6
Makefile
6
Makefile
@ -58,7 +58,7 @@ CPP := cpp
|
||||
LD := $(CROSS)ld
|
||||
OBJCOPY := $(CROSS)objcopy
|
||||
|
||||
CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment -MP -MD
|
||||
CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment
|
||||
ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300
|
||||
OLDASFLAGS := -EB -Iinclude -G 0
|
||||
CFLAGS := -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 -Wimplicit -Wuninitialized -Wshadow
|
||||
@ -133,12 +133,12 @@ $(BUILD_DIR)/%.Yay0.o: $(BUILD_DIR)/%.bin.Yay0
|
||||
# Compile C files
|
||||
$(BUILD_DIR)/%.c.o: %.c $(BUILD_DIR)/%.d
|
||||
@mkdir -p $(shell dirname $@)
|
||||
$(CPP) $(CPPFLAGS) -o - $< -MF $@.mk -MT $(BUILD_DIR)/$*.d | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
$(CPP) $(CPPFLAGS) -MP -MD -o - $< -MF $@.mk -MT $(BUILD_DIR)/$*.d | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
|
||||
# Compile C files (with DSL macros)
|
||||
$(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c $(BUILD_DIR)/%.d
|
||||
@mkdir -p $(shell dirname $@)
|
||||
$(CPP) $(CPPFLAGS) -o - $< -MF $@.mk -MT $(BUILD_DIR)/$*.d | tools/compile_dsl_macros.py | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
$(CPP) $(CPPFLAGS) -MP -MD -o - $< -MF $@.mk -MT $(BUILD_DIR)/$*.d | tools/compile_dsl_macros.py | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
|
||||
|
||||
# Assemble handwritten ASM
|
||||
$(BUILD_DIR)/%.s.o: %.s
|
||||
|
@ -1,86 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel PlayerMoveTo
|
||||
/* F5AE4 802D1134 27BDFFD0 */ addiu $sp, $sp, -0x30
|
||||
/* F5AE8 802D1138 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* F5AEC 802D113C 0080882D */ daddu $s1, $a0, $zero
|
||||
/* F5AF0 802D1140 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* F5AF4 802D1144 3C128011 */ lui $s2, %hi(gPlayerStatus)
|
||||
/* F5AF8 802D1148 2652EFC8 */ addiu $s2, $s2, %lo(gPlayerStatus)
|
||||
/* F5AFC 802D114C AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* F5B00 802D1150 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* F5B04 802D1154 F7B60028 */ sdc1 $f22, 0x28($sp)
|
||||
/* F5B08 802D1158 F7B40020 */ sdc1 $f20, 0x20($sp)
|
||||
/* F5B0C 802D115C 10A00038 */ beqz $a1, .L802D1240
|
||||
/* F5B10 802D1160 8E30000C */ lw $s0, 0xc($s1)
|
||||
/* F5B14 802D1164 8E050000 */ lw $a1, ($s0)
|
||||
/* F5B18 802D1168 0C0B1EAF */ jal get_variable
|
||||
/* F5B1C 802D116C 26100004 */ addiu $s0, $s0, 4
|
||||
/* F5B20 802D1170 8E050000 */ lw $a1, ($s0)
|
||||
/* F5B24 802D1174 26100004 */ addiu $s0, $s0, 4
|
||||
/* F5B28 802D1178 4482B000 */ mtc1 $v0, $f22
|
||||
/* F5B2C 802D117C 00000000 */ nop
|
||||
/* F5B30 802D1180 4680B5A0 */ cvt.s.w $f22, $f22
|
||||
/* F5B34 802D1184 0C0B1EAF */ jal get_variable
|
||||
/* F5B38 802D1188 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F5B3C 802D118C 8E050000 */ lw $a1, ($s0)
|
||||
/* F5B40 802D1190 4482A000 */ mtc1 $v0, $f20
|
||||
/* F5B44 802D1194 00000000 */ nop
|
||||
/* F5B48 802D1198 4680A520 */ cvt.s.w $f20, $f20
|
||||
/* F5B4C 802D119C 0C0B1EAF */ jal get_variable
|
||||
/* F5B50 802D11A0 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F5B54 802D11A4 AE220070 */ sw $v0, 0x70($s1)
|
||||
/* F5B58 802D11A8 C64C0028 */ lwc1 $f12, 0x28($s2)
|
||||
/* F5B5C 802D11AC C64E0030 */ lwc1 $f14, 0x30($s2)
|
||||
/* F5B60 802D11B0 4406B000 */ mfc1 $a2, $f22
|
||||
/* F5B64 802D11B4 4407A000 */ mfc1 $a3, $f20
|
||||
/* F5B68 802D11B8 0C00A720 */ jal atan2
|
||||
/* F5B6C 802D11BC 00000000 */ nop
|
||||
/* F5B70 802D11C0 E6400080 */ swc1 $f0, 0x80($s2)
|
||||
/* F5B74 802D11C4 8E220070 */ lw $v0, 0x70($s1)
|
||||
/* F5B78 802D11C8 1440000F */ bnez $v0, .L802D1208
|
||||
/* F5B7C 802D11CC 00000000 */ nop
|
||||
/* F5B80 802D11D0 C64C0028 */ lwc1 $f12, 0x28($s2)
|
||||
/* F5B84 802D11D4 C64E0030 */ lwc1 $f14, 0x30($s2)
|
||||
/* F5B88 802D11D8 4406B000 */ mfc1 $a2, $f22
|
||||
/* F5B8C 802D11DC 4407A000 */ mfc1 $a3, $f20
|
||||
/* F5B90 802D11E0 0C00A7B5 */ jal dist2D
|
||||
/* F5B94 802D11E4 00000000 */ nop
|
||||
/* F5B98 802D11E8 3C02802E */ lui $v0, %hi(gPlayerNpcPtr)
|
||||
/* F5B9C 802D11EC 8C429D20 */ lw $v0, %lo(gPlayerNpcPtr)($v0)
|
||||
/* F5BA0 802D11F0 C4420018 */ lwc1 $f2, 0x18($v0)
|
||||
/* F5BA4 802D11F4 46020003 */ div.s $f0, $f0, $f2
|
||||
/* F5BA8 802D11F8 4600010D */ trunc.w.s $f4, $f0
|
||||
/* F5BAC 802D11FC E6240070 */ swc1 $f4, 0x70($s1)
|
||||
/* F5BB0 802D1200 080B448B */ j .L802D122C
|
||||
/* F5BB4 802D1204 C4400018 */ lwc1 $f0, 0x18($v0)
|
||||
.L802D1208:
|
||||
/* F5BB8 802D1208 C64C0028 */ lwc1 $f12, 0x28($s2)
|
||||
/* F5BBC 802D120C C64E0030 */ lwc1 $f14, 0x30($s2)
|
||||
/* F5BC0 802D1210 4406B000 */ mfc1 $a2, $f22
|
||||
/* F5BC4 802D1214 4407A000 */ mfc1 $a3, $f20
|
||||
/* F5BC8 802D1218 0C00A7B5 */ jal dist2D
|
||||
/* F5BCC 802D121C 00000000 */ nop
|
||||
/* F5BD0 802D1220 C6220070 */ lwc1 $f2, 0x70($s1)
|
||||
/* F5BD4 802D1224 468010A0 */ cvt.s.w $f2, $f2
|
||||
/* F5BD8 802D1228 46020003 */ div.s $f0, $f0, $f2
|
||||
.L802D122C:
|
||||
/* F5BDC 802D122C 8E240070 */ lw $a0, 0x70($s1)
|
||||
/* F5BE0 802D1230 8E450080 */ lw $a1, 0x80($s2)
|
||||
/* F5BE4 802D1234 44060000 */ mfc1 $a2, $f0
|
||||
/* F5BE8 802D1238 0C0389DE */ jal move_player
|
||||
/* F5BEC 802D123C 00000000 */ nop
|
||||
.L802D1240:
|
||||
/* F5BF0 802D1240 8E230070 */ lw $v1, 0x70($s1)
|
||||
/* F5BF4 802D1244 2463FFFF */ addiu $v1, $v1, -1
|
||||
/* F5BF8 802D1248 AE230070 */ sw $v1, 0x70($s1)
|
||||
/* F5BFC 802D124C 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* F5C00 802D1250 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* F5C04 802D1254 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* F5C08 802D1258 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* F5C0C 802D125C D7B60028 */ ldc1 $f22, 0x28($sp)
|
||||
/* F5C10 802D1260 D7B40020 */ ldc1 $f20, 0x20($sp)
|
||||
/* F5C14 802D1264 000317C2 */ srl $v0, $v1, 0x1f
|
||||
/* F5C18 802D1268 03E00008 */ jr $ra
|
||||
/* F5C1C 802D126C 27BD0030 */ addiu $sp, $sp, 0x30
|
@ -1,27 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel func_802D249C
|
||||
/* F6E4C 802D249C 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* F6E50 802D24A0 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* F6E54 802D24A4 0080882D */ daddu $s1, $a0, $zero
|
||||
/* F6E58 802D24A8 3C028016 */ lui $v0, 0x8016
|
||||
/* F6E5C 802D24AC 8442A552 */ lh $v0, -0x5aae($v0)
|
||||
/* F6E60 802D24B0 AFBF0018 */ sw $ra, 0x18($sp)
|
||||
/* F6E64 802D24B4 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* F6E68 802D24B8 8E30000C */ lw $s0, 0xc($s1)
|
||||
/* F6E6C 802D24BC 04400004 */ bltz $v0, .L802D24D0
|
||||
/* F6E70 802D24C0 0000302D */ daddu $a2, $zero, $zero
|
||||
/* F6E74 802D24C4 0C0B48FE */ jal func_802D23F8
|
||||
/* F6E78 802D24C8 00000000 */ nop
|
||||
/* F6E7C 802D24CC 0002302B */ sltu $a2, $zero, $v0
|
||||
.L802D24D0:
|
||||
/* F6E80 802D24D0 8E050000 */ lw $a1, ($s0)
|
||||
/* F6E84 802D24D4 0C0B2026 */ jal set_variable
|
||||
/* F6E88 802D24D8 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F6E8C 802D24DC 8FBF0018 */ lw $ra, 0x18($sp)
|
||||
/* F6E90 802D24E0 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* F6E94 802D24E4 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* F6E98 802D24E8 24020002 */ addiu $v0, $zero, 2
|
||||
/* F6E9C 802D24EC 03E00008 */ jr $ra
|
||||
/* F6EA0 802D24F0 27BD0020 */ addiu $sp, $sp, 0x20
|
@ -102,6 +102,7 @@ s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, ItemSpawnMode item
|
||||
void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height);
|
||||
|
||||
void disable_player_shadow(void);
|
||||
void move_player(s32 duration, f32 heading, f32 speed);
|
||||
|
||||
Npc* get_npc_safe(NpcId npcId);
|
||||
Npc* get_npc_unsafe(NpcId npcId);
|
||||
|
@ -10,7 +10,7 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E26C4);
|
||||
|
||||
void set_action_state(s32 actionState);
|
||||
|
||||
void move_player(s16 duration, f32 heading, f32 speed) {
|
||||
void move_player(s32 duration, f32 heading, f32 speed) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
playerStatus->flags |= 0x4000;
|
||||
|
@ -122,7 +122,32 @@ ApiStatus SetPlayerAnimationSpeed(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_F5750", PlayerMoveTo, ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus PlayerMoveTo(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
PlayerStatus* playerStatus = PLAYER_STATUS;
|
||||
f32 var0;
|
||||
f32 var1;
|
||||
f32 moveSpeed;
|
||||
|
||||
if (isInitialCall) {
|
||||
var1 = get_variable(script, *args++);
|
||||
var0 = get_variable(script, *args++);
|
||||
script->functionTemp[0].s = get_variable(script, *args++);
|
||||
playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, var1, var0);
|
||||
|
||||
if (script->functionTemp[0].s == 0) {
|
||||
script->functionTemp[0].s = (dist2D(playerStatus->position.x, playerStatus->position.z, var1,
|
||||
var0) / gPlayerNpcPtr->moveSpeed);
|
||||
moveSpeed = gPlayerNpcPtr->moveSpeed;
|
||||
} else {
|
||||
moveSpeed = dist2D(playerStatus->position.x, playerStatus->position.z, var1, var0) / script->functionTemp[0].s;
|
||||
}
|
||||
move_player(script->functionTemp[0].s, playerStatus->targetYaw, moveSpeed);
|
||||
}
|
||||
|
||||
script->functionTemp[0].s--;
|
||||
return script->functionTemp[0].s < 0;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_F5750", func_802D1270);
|
||||
|
||||
@ -236,7 +261,16 @@ INCLUDE_ASM(s32, "code_F5750", func_802D244C);
|
||||
|
||||
INCLUDE_ASM(s32, "code_F5750", func_802D2484);
|
||||
|
||||
INCLUDE_ASM(s32, "code_F5750", func_802D249C);
|
||||
ApiStatus func_802D249C(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val = 0;
|
||||
if (gCollisionStatus.currentFloor >= 0) {
|
||||
val = func_802D23F8() != 0;
|
||||
}
|
||||
set_variable(script, *args, val);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802D24F4(ScriptInstance* script, s32 isInitialCall) {
|
||||
return (gPlayerStatus.moveFrames == 0) * ApiStatus_DONE2;
|
||||
|
Loading…
Reference in New Issue
Block a user