mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
non audio :floshed:
This commit is contained in:
parent
bb992afece
commit
b753ff25ed
@ -1,42 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel npc_move_heading
|
||||
/* 15E54 8003AA54 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* 15E58 8003AA58 F7B60020 */ sdc1 $f22, 0x20($sp)
|
||||
/* 15E5C 8003AA5C 4485B000 */ mtc1 $a1, $f22
|
||||
/* 15E60 8003AA60 3C0140C9 */ lui $at, 0x40c9
|
||||
/* 15E64 8003AA64 34210FD0 */ ori $at, $at, 0xfd0
|
||||
/* 15E68 8003AA68 44810000 */ mtc1 $at, $f0
|
||||
/* 15E6C 8003AA6C 44862000 */ mtc1 $a2, $f4
|
||||
/* 15E70 8003AA70 F7B40018 */ sdc1 $f20, 0x18($sp)
|
||||
/* 15E74 8003AA74 46002502 */ mul.s $f20, $f4, $f0
|
||||
/* 15E78 8003AA78 00000000 */ nop
|
||||
/* 15E7C 8003AA7C AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 15E80 8003AA80 3C0143B4 */ lui $at, 0x43b4
|
||||
/* 15E84 8003AA84 44810000 */ mtc1 $at, $f0
|
||||
/* 15E88 8003AA88 0080802D */ daddu $s0, $a0, $zero
|
||||
/* 15E8C 8003AA8C AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 15E90 8003AA90 4600A503 */ div.s $f20, $f20, $f0
|
||||
/* 15E94 8003AA94 0C00A85B */ jal sin_rad
|
||||
/* 15E98 8003AA98 4600A306 */ mov.s $f12, $f20
|
||||
/* 15E9C 8003AA9C 4600A306 */ mov.s $f12, $f20
|
||||
/* 15EA0 8003AAA0 0C00A874 */ jal cos_rad
|
||||
/* 15EA4 8003AAA4 46000506 */ mov.s $f20, $f0
|
||||
/* 15EA8 8003AAA8 4614B502 */ mul.s $f20, $f22, $f20
|
||||
/* 15EAC 8003AAAC 00000000 */ nop
|
||||
/* 15EB0 8003AAB0 4600B587 */ neg.s $f22, $f22
|
||||
/* 15EB4 8003AAB4 4600B582 */ mul.s $f22, $f22, $f0
|
||||
/* 15EB8 8003AAB8 00000000 */ nop
|
||||
/* 15EBC 8003AABC C6020038 */ lwc1 $f2, 0x38($s0)
|
||||
/* 15EC0 8003AAC0 46141080 */ add.s $f2, $f2, $f20
|
||||
/* 15EC4 8003AAC4 C6000040 */ lwc1 $f0, 0x40($s0)
|
||||
/* 15EC8 8003AAC8 46160000 */ add.s $f0, $f0, $f22
|
||||
/* 15ECC 8003AACC E6020038 */ swc1 $f2, 0x38($s0)
|
||||
/* 15ED0 8003AAD0 E6000040 */ swc1 $f0, 0x40($s0)
|
||||
/* 15ED4 8003AAD4 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 15ED8 8003AAD8 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 15EDC 8003AADC D7B60020 */ ldc1 $f22, 0x20($sp)
|
||||
/* 15EE0 8003AAE0 D7B40018 */ ldc1 $f20, 0x18($sp)
|
||||
/* 15EE4 8003AAE4 03E00008 */ jr $ra
|
||||
/* 15EE8 8003AAE8 27BD0028 */ addiu $sp, $sp, 0x28
|
@ -1,42 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel set_npc_yaw
|
||||
/* 16740 8003B340 44857000 */ mtc1 $a1, $f14
|
||||
/* 16744 8003B344 3C038007 */ lui $v1, %hi(gCurrentCameraID)
|
||||
/* 16748 8003B348 8C637410 */ lw $v1, %lo(gCurrentCameraID)($v1)
|
||||
/* 1674C 8003B34C 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 16750 8003B350 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 16754 8003B354 0080802D */ daddu $s0, $a0, $zero
|
||||
/* 16758 8003B358 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 1675C 8003B35C 00031080 */ sll $v0, $v1, 2
|
||||
/* 16760 8003B360 00431021 */ addu $v0, $v0, $v1
|
||||
/* 16764 8003B364 00021080 */ sll $v0, $v0, 2
|
||||
/* 16768 8003B368 00431023 */ subu $v0, $v0, $v1
|
||||
/* 1676C 8003B36C 000218C0 */ sll $v1, $v0, 3
|
||||
/* 16770 8003B370 00431021 */ addu $v0, $v0, $v1
|
||||
/* 16774 8003B374 000210C0 */ sll $v0, $v0, 3
|
||||
/* 16778 8003B378 E60E000C */ swc1 $f14, 0xc($s0)
|
||||
/* 1677C 8003B37C 3C01800B */ lui $at, %hi(D_800B1DEC)
|
||||
/* 16780 8003B380 00220821 */ addu $at, $at, $v0
|
||||
/* 16784 8003B384 C42C1DEC */ lwc1 $f12, %lo(D_800B1DEC)($at)
|
||||
/* 16788 8003B388 0C00A70A */ jal get_clamped_angle_diff
|
||||
/* 1678C 8003B38C 00000000 */ nop
|
||||
/* 16790 8003B390 44801000 */ mtc1 $zero, $f2
|
||||
/* 16794 8003B394 00000000 */ nop
|
||||
/* 16798 8003B398 4600103E */ c.le.s $f2, $f0
|
||||
/* 1679C 8003B39C 00000000 */ nop
|
||||
/* 167A0 8003B3A0 45000005 */ bc1f .L8003B3B8
|
||||
/* 167A4 8003B3A4 240200B4 */ addiu $v0, $zero, 0xb4
|
||||
/* 167A8 8003B3A8 A602008A */ sh $v0, 0x8a($s0)
|
||||
/* 167AC 8003B3AC 24020001 */ addiu $v0, $zero, 1
|
||||
/* 167B0 8003B3B0 0800ECF0 */ j .L8003B3C0
|
||||
/* 167B4 8003B3B4 A6020088 */ sh $v0, 0x88($s0)
|
||||
.L8003B3B8:
|
||||
/* 167B8 8003B3B8 A600008A */ sh $zero, 0x8a($s0)
|
||||
/* 167BC 8003B3BC A6000088 */ sh $zero, 0x88($s0)
|
||||
.L8003B3C0:
|
||||
/* 167C0 8003B3C0 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 167C4 8003B3C4 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 167C8 8003B3C8 03E00008 */ jr $ra
|
||||
/* 167CC 8003B3CC 27BD0018 */ addiu $sp, $sp, 0x18
|
@ -1,51 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel MakeNpcs
|
||||
/* 1F698 80044298 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* 1F69C 8004429C AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* 1F6A0 800442A0 0080882D */ daddu $s1, $a0, $zero
|
||||
/* 1F6A4 800442A4 AFBF0018 */ sw $ra, 0x18($sp)
|
||||
/* 1F6A8 800442A8 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 1F6AC 800442AC 8E30000C */ lw $s0, 0xc($s1)
|
||||
/* 1F6B0 800442B0 54A00001 */ bnel $a1, $zero, .L800442B8
|
||||
/* 1F6B4 800442B4 AE200070 */ sw $zero, 0x70($s1)
|
||||
.L800442B8:
|
||||
/* 1F6B8 800442B8 8E240070 */ lw $a0, 0x70($s1)
|
||||
/* 1F6BC 800442BC 10800005 */ beqz $a0, .L800442D4
|
||||
/* 1F6C0 800442C0 24020001 */ addiu $v0, $zero, 1
|
||||
/* 1F6C4 800442C4 10820014 */ beq $a0, $v0, .L80044318
|
||||
/* 1F6C8 800442C8 0000102D */ daddu $v0, $zero, $zero
|
||||
/* 1F6CC 800442CC 080110CB */ j .L8004432C
|
||||
/* 1F6D0 800442D0 00000000 */ nop
|
||||
.L800442D4:
|
||||
/* 1F6D4 800442D4 8E050000 */ lw $a1, ($s0)
|
||||
/* 1F6D8 800442D8 26100004 */ addiu $s0, $s0, 4
|
||||
/* 1F6DC 800442DC 0C0B1EAF */ jal get_variable
|
||||
/* 1F6E0 800442E0 0220202D */ daddu $a0, $s1, $zero
|
||||
/* 1F6E4 800442E4 0220202D */ daddu $a0, $s1, $zero
|
||||
/* 1F6E8 800442E8 8E050000 */ lw $a1, ($s0)
|
||||
/* 1F6EC 800442EC 0C0B1EAF */ jal get_variable
|
||||
/* 1F6F0 800442F0 0040802D */ daddu $s0, $v0, $zero
|
||||
/* 1F6F4 800442F4 3C038007 */ lui $v1, %hi(gGameStatusPtr)
|
||||
/* 1F6F8 800442F8 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1)
|
||||
/* 1F6FC 800442FC 0200202D */ daddu $a0, $s0, $zero
|
||||
/* 1F700 80044300 8465008C */ lh $a1, 0x8c($v1)
|
||||
/* 1F704 80044304 0C00F99E */ jal make_npcs
|
||||
/* 1F708 80044308 0040302D */ daddu $a2, $v0, $zero
|
||||
/* 1F70C 8004430C 24020001 */ addiu $v0, $zero, 1
|
||||
/* 1F710 80044310 080110CA */ j .L80044328
|
||||
/* 1F714 80044314 AE220070 */ sw $v0, 0x70($s1)
|
||||
.L80044318:
|
||||
/* 1F718 80044318 3C03800A */ lui $v1, %hi(gGameState)
|
||||
/* 1F71C 8004431C 8C63A600 */ lw $v1, %lo(gGameState)($v1)
|
||||
/* 1F720 80044320 14640002 */ bne $v1, $a0, .L8004432C
|
||||
/* 1F724 80044324 24020002 */ addiu $v0, $zero, 2
|
||||
.L80044328:
|
||||
/* 1F728 80044328 0000102D */ daddu $v0, $zero, $zero
|
||||
.L8004432C:
|
||||
/* 1F72C 8004432C 8FBF0018 */ lw $ra, 0x18($sp)
|
||||
/* 1F730 80044330 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* 1F734 80044334 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 1F738 80044338 03E00008 */ jr $ra
|
||||
/* 1F73C 8004433C 27BD0020 */ addiu $sp, $sp, 0x20
|
@ -21,6 +21,7 @@ Shadow* get_shadow_by_index(s32 index);
|
||||
void render_player_model();
|
||||
|
||||
f32 integrate_gravity(void);
|
||||
f32 get_clamped_angle_diff(f32, f32);
|
||||
|
||||
// Text
|
||||
PrintContext* load_string(s32 stringID, s32* a1);
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
// Alternative to libultra's M_PI: non-float version; more digits cause issues
|
||||
#define PI 3.141592f
|
||||
#define TAU 6.28318f
|
||||
|
||||
//NOTE: SCRIPT_ALLOC is probably not quite correct, but this is the closest thing to matching for the functions its used in. Needs more work.
|
||||
#define SCRIPT_ALLOC(new, index) \
|
||||
|
@ -52,7 +52,14 @@ INCLUDE_ASM(s32, "code_13870_len_6980", appendGfx_npc);
|
||||
|
||||
INCLUDE_ASM(s32, "code_13870_len_6980", render_npcs);
|
||||
|
||||
INCLUDE_ASM(void, "code_13870_len_6980", npc_move_heading, Npc* npc, f32 speed, f32 yaw);
|
||||
void npc_move_heading(Npc* npc, f32 speed, f32 yaw) {
|
||||
f32 angle = (yaw * TAU) / 360.0f;
|
||||
f32 sin = sin_rad(angle);
|
||||
f32 cos = cos_rad(angle);
|
||||
|
||||
npc->pos.x += speed * sin;
|
||||
npc->pos.z += -speed * cos;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(Npc*, "code_13870_len_6980", get_npc_unsafe, NpcId npcId);
|
||||
|
||||
@ -101,7 +108,17 @@ void func_8003B1A8(void) {
|
||||
|
||||
INCLUDE_ASM(s32, "code_13870_len_6980", func_8003B1B0);
|
||||
|
||||
INCLUDE_ASM(void, "code_13870_len_6980", set_npc_yaw, Npc* npcPtr, f32 angle);
|
||||
void set_npc_yaw(Npc* npc, f32 angle) {
|
||||
npc->yaw = angle;
|
||||
|
||||
if (get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, angle) >= 0.0f) {
|
||||
npc->yawCamOffset = 180;
|
||||
npc->isFacingAway = TRUE;
|
||||
} else {
|
||||
npc->yawCamOffset = 0;
|
||||
npc->isFacingAway = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_13870_len_6980", func_8003B3D0);
|
||||
|
||||
|
@ -37,7 +37,26 @@ ApiStatus func_80044290(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_1f580_len_1940", MakeNpcs, ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus MakeNpcs(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
if (isInitialCall) {
|
||||
script->functionTemp[0].s = 0;
|
||||
}
|
||||
|
||||
switch (script->functionTemp[0].s) {
|
||||
case 0:
|
||||
make_npcs(get_variable(script, *args++), GAME_STATUS->mapID, get_variable(script, *args++));
|
||||
script->functionTemp[0].s = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (gGameState != script->functionTemp[0].s) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
}
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_1f580_len_1940", RemoveNpc, ScriptInstance* script, s32 isInitialCall);
|
||||
|
||||
@ -504,7 +523,46 @@ ApiStatus func_800458CC(ScriptInstance* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
// comments inline, WIP
|
||||
#ifdef NON_MATCHIING
|
||||
ApiStatus func_80045900(ScriptInstance* script) {
|
||||
Enemy* enemy = script->owner1.enemy;
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
s32 var0 = get_variable(script, *script->ptrReadPos);
|
||||
|
||||
enemy->unk_B0 |= 4;
|
||||
|
||||
if (var0 == 0) {
|
||||
// idk what these are supposed to be
|
||||
f32 subroutine_argE;
|
||||
f32 subroutine_argD;
|
||||
f32 subroutine_argC;
|
||||
f32 subroutine_argB;
|
||||
s32 subroutine_argA;
|
||||
|
||||
if (!(enemy->unk_B0 & 0x10)) {
|
||||
npc->currentAnim = *enemy->animList;
|
||||
}
|
||||
|
||||
if (!(enemy->unk_B0 & 0x8)) {
|
||||
fx_emote(2, npc, 0, npc->collisionHeight, 1.0f, 0.0f, -20.0f, 40, &subroutine_argA);
|
||||
}
|
||||
|
||||
if ((npc->flags & 0xA08) == 0x808) {
|
||||
// function decl needed
|
||||
if (func_800DCB7C(npc->unk_80, &subroutine_argB, &subroutine_argC, &subroutine_argD, &subroutine_argE, npc->pos.x,
|
||||
npc->pos.y + npc->collisionHeight, npc->pos.z, 100.0f) != 0) {
|
||||
npc->pos.y = subroutine_argC;
|
||||
}
|
||||
npc->flags &= ~0x800;
|
||||
}
|
||||
}
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "code_1f580_len_1940", func_80045900);
|
||||
#endif
|
||||
|
||||
ApiStatus SetTattleString(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
Loading…
Reference in New Issue
Block a user