mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Some decomp, tons of cleanup
This commit is contained in:
parent
4915acf7a2
commit
4b1f9e0fa5
@ -1,27 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel exec_ShakeCam1
|
||||
/* EFF1C 802CB56C 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* EFF20 802CB570 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* EFF24 802CB574 0080802D */ daddu $s0, $a0, $zero
|
||||
/* EFF28 802CB578 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* EFF2C 802CB57C 00A0882D */ daddu $s1, $a1, $zero
|
||||
/* EFF30 802CB580 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* EFF34 802CB584 00C0902D */ daddu $s2, $a2, $zero
|
||||
/* EFF38 802CB588 3C04802E */ lui $a0, %hi(ShakeCam1)
|
||||
/* EFF3C 802CB58C 24849CB0 */ addiu $a0, $a0, %lo(ShakeCam1)
|
||||
/* EFF40 802CB590 24050001 */ addiu $a1, $zero, 1
|
||||
/* EFF44 802CB594 0000302D */ daddu $a2, $zero, $zero
|
||||
/* EFF48 802CB598 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* EFF4C 802CB59C 0C0B0D74 */ jal start_script_in_group
|
||||
/* EFF50 802CB5A0 24070004 */ addiu $a3, $zero, 4
|
||||
/* EFF54 802CB5A4 AC500084 */ sw $s0, 0x84($v0)
|
||||
/* EFF58 802CB5A8 AC510088 */ sw $s1, 0x88($v0)
|
||||
/* EFF5C 802CB5AC AC52008C */ sw $s2, 0x8c($v0)
|
||||
/* EFF60 802CB5B0 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* EFF64 802CB5B4 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* EFF68 802CB5B8 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* EFF6C 802CB5BC 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* EFF70 802CB5C0 03E00008 */ jr $ra
|
||||
/* EFF74 802CB5C4 27BD0020 */ addiu $sp, $sp, 0x20
|
@ -1,50 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel exec_ShakeCamX
|
||||
/* EFF78 802CB5C8 27BDFFD0 */ addiu $sp, $sp, -0x30
|
||||
/* EFF7C 802CB5CC AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* EFF80 802CB5D0 0080882D */ daddu $s1, $a0, $zero
|
||||
/* EFF84 802CB5D4 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* EFF88 802CB5D8 00A0902D */ daddu $s2, $a1, $zero
|
||||
/* EFF8C 802CB5DC AFB3001C */ sw $s3, 0x1c($sp)
|
||||
/* EFF90 802CB5E0 00C0982D */ daddu $s3, $a2, $zero
|
||||
/* EFF94 802CB5E4 3C04802E */ lui $a0, %hi(ShakeCamX)
|
||||
/* EFF98 802CB5E8 24849CE8 */ addiu $a0, $a0, %lo(ShakeCamX)
|
||||
/* EFF9C 802CB5EC 24050001 */ addiu $a1, $zero, 1
|
||||
/* EFFA0 802CB5F0 0000302D */ daddu $a2, $zero, $zero
|
||||
/* EFFA4 802CB5F4 F7B40028 */ sdc1 $f20, 0x28($sp)
|
||||
/* EFFA8 802CB5F8 4487A000 */ mtc1 $a3, $f20
|
||||
/* EFFAC 802CB5FC 24070004 */ addiu $a3, $zero, 4
|
||||
/* EFFB0 802CB600 AFBF0020 */ sw $ra, 0x20($sp)
|
||||
/* EFFB4 802CB604 0C0B0D74 */ jal start_script_in_group
|
||||
/* EFFB8 802CB608 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* EFFBC 802CB60C 0040802D */ daddu $s0, $v0, $zero
|
||||
/* EFFC0 802CB610 0200202D */ daddu $a0, $s0, $zero
|
||||
/* EFFC4 802CB614 3C05FE36 */ lui $a1, 0xfe36
|
||||
/* EFFC8 802CB618 34A53C80 */ ori $a1, $a1, 0x3c80
|
||||
/* EFFCC 802CB61C 0C0B2026 */ jal set_variable
|
||||
/* EFFD0 802CB620 0220302D */ daddu $a2, $s1, $zero
|
||||
/* EFFD4 802CB624 0200202D */ daddu $a0, $s0, $zero
|
||||
/* EFFD8 802CB628 3C05FE36 */ lui $a1, 0xfe36
|
||||
/* EFFDC 802CB62C 34A53C81 */ ori $a1, $a1, 0x3c81
|
||||
/* EFFE0 802CB630 0C0B2026 */ jal set_variable
|
||||
/* EFFE4 802CB634 0240302D */ daddu $a2, $s2, $zero
|
||||
/* EFFE8 802CB638 0200202D */ daddu $a0, $s0, $zero
|
||||
/* EFFEC 802CB63C 3C05FE36 */ lui $a1, 0xfe36
|
||||
/* EFFF0 802CB640 34A53C82 */ ori $a1, $a1, 0x3c82
|
||||
/* EFFF4 802CB644 0C0B2026 */ jal set_variable
|
||||
/* EFFF8 802CB648 0260302D */ daddu $a2, $s3, $zero
|
||||
/* EFFFC 802CB64C 0200202D */ daddu $a0, $s0, $zero
|
||||
/* F0000 802CB650 3C05FE36 */ lui $a1, 0xfe36
|
||||
/* F0004 802CB654 4406A000 */ mfc1 $a2, $f20
|
||||
/* F0008 802CB658 0C0B2190 */ jal set_float_variable
|
||||
/* F000C 802CB65C 34A53C83 */ ori $a1, $a1, 0x3c83
|
||||
/* F0010 802CB660 8FBF0020 */ lw $ra, 0x20($sp)
|
||||
/* F0014 802CB664 8FB3001C */ lw $s3, 0x1c($sp)
|
||||
/* F0018 802CB668 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* F001C 802CB66C 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* F0020 802CB670 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* F0024 802CB674 D7B40028 */ ldc1 $f20, 0x28($sp)
|
||||
/* F0028 802CB678 03E00008 */ jr $ra
|
||||
/* F002C 802CB67C 27BD0030 */ addiu $sp, $sp, 0x30
|
@ -1,36 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel NpcSetHomePosToCurrent
|
||||
/* F3D6C 802CF3BC 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* F3D70 802CF3C0 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* F3D74 802CF3C4 0080802D */ daddu $s0, $a0, $zero
|
||||
/* F3D78 802CF3C8 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* F3D7C 802CF3CC 8E02000C */ lw $v0, 0xc($s0)
|
||||
/* F3D80 802CF3D0 0C0B1EAF */ jal get_variable
|
||||
/* F3D84 802CF3D4 8C450000 */ lw $a1, ($v0)
|
||||
/* F3D88 802CF3D8 0200202D */ daddu $a0, $s0, $zero
|
||||
/* F3D8C 802CF3DC 0C0B36B0 */ jal resolve_npc
|
||||
/* F3D90 802CF3E0 0040282D */ daddu $a1, $v0, $zero
|
||||
/* F3D94 802CF3E4 0040202D */ daddu $a0, $v0, $zero
|
||||
/* F3D98 802CF3E8 1080000F */ beqz $a0, .L802CF428
|
||||
/* F3D9C 802CF3EC 24020002 */ addiu $v0, $zero, 2
|
||||
/* F3DA0 802CF3F0 C4800038 */ lwc1 $f0, 0x38($a0)
|
||||
/* F3DA4 802CF3F4 C4820040 */ lwc1 $f2, 0x40($a0)
|
||||
/* F3DA8 802CF3F8 4600010D */ trunc.w.s $f4, $f0
|
||||
/* F3DAC 802CF3FC 44032000 */ mfc1 $v1, $f4
|
||||
/* F3DB0 802CF400 C480003C */ lwc1 $f0, 0x3c($a0)
|
||||
/* F3DB4 802CF404 A4830090 */ sh $v1, 0x90($a0)
|
||||
/* F3DB8 802CF408 4600010D */ trunc.w.s $f4, $f0
|
||||
/* F3DBC 802CF40C 44032000 */ mfc1 $v1, $f4
|
||||
/* F3DC0 802CF410 00000000 */ nop
|
||||
/* F3DC4 802CF414 A4830092 */ sh $v1, 0x92($a0)
|
||||
/* F3DC8 802CF418 4600110D */ trunc.w.s $f4, $f2
|
||||
/* F3DCC 802CF41C 44032000 */ mfc1 $v1, $f4
|
||||
/* F3DD0 802CF420 00000000 */ nop
|
||||
/* F3DD4 802CF424 A4830094 */ sh $v1, 0x94($a0)
|
||||
.L802CF428:
|
||||
/* F3DD8 802CF428 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* F3DDC 802CF42C 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* F3DE0 802CF430 03E00008 */ jr $ra
|
||||
/* F3DE4 802CF434 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 SetNpcRotation
|
||||
/* F2760 802CDDB0 27BDFFC8 */ addiu $sp, $sp, -0x38
|
||||
/* F2764 802CDDB4 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* F2768 802CDDB8 0080882D */ daddu $s1, $a0, $zero
|
||||
/* F276C 802CDDBC AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* F2770 802CDDC0 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* F2774 802CDDC4 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* F2778 802CDDC8 F7B80030 */ sdc1 $f24, 0x30($sp)
|
||||
/* F277C 802CDDCC F7B60028 */ sdc1 $f22, 0x28($sp)
|
||||
/* F2780 802CDDD0 F7B40020 */ sdc1 $f20, 0x20($sp)
|
||||
/* F2784 802CDDD4 8E30000C */ lw $s0, 0xc($s1)
|
||||
/* F2788 802CDDD8 8E050000 */ lw $a1, ($s0)
|
||||
/* F278C 802CDDDC 0C0B1EAF */ jal get_variable
|
||||
/* F2790 802CDDE0 26100004 */ addiu $s0, $s0, 4
|
||||
/* F2794 802CDDE4 8E050000 */ lw $a1, ($s0)
|
||||
/* F2798 802CDDE8 26100004 */ addiu $s0, $s0, 4
|
||||
/* F279C 802CDDEC 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F27A0 802CDDF0 0C0B210B */ jal get_float_variable
|
||||
/* F27A4 802CDDF4 0040902D */ daddu $s2, $v0, $zero
|
||||
/* F27A8 802CDDF8 8E050000 */ lw $a1, ($s0)
|
||||
/* F27AC 802CDDFC 26100004 */ addiu $s0, $s0, 4
|
||||
/* F27B0 802CDE00 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F27B4 802CDE04 0C0B210B */ jal get_float_variable
|
||||
/* F27B8 802CDE08 46000606 */ mov.s $f24, $f0
|
||||
/* F27BC 802CDE0C 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F27C0 802CDE10 8E050000 */ lw $a1, ($s0)
|
||||
/* F27C4 802CDE14 0C0B210B */ jal get_float_variable
|
||||
/* F27C8 802CDE18 46000586 */ mov.s $f22, $f0
|
||||
/* F27CC 802CDE1C 0220202D */ daddu $a0, $s1, $zero
|
||||
/* F27D0 802CDE20 0240282D */ daddu $a1, $s2, $zero
|
||||
/* F27D4 802CDE24 0C0B36B0 */ jal resolve_npc
|
||||
/* F27D8 802CDE28 46000506 */ mov.s $f20, $f0
|
||||
/* F27DC 802CDE2C 0040182D */ daddu $v1, $v0, $zero
|
||||
/* F27E0 802CDE30 10600004 */ beqz $v1, .L802CDE44
|
||||
/* F27E4 802CDE34 24020002 */ addiu $v0, $zero, 2
|
||||
/* F27E8 802CDE38 E4780044 */ swc1 $f24, 0x44($v1)
|
||||
/* F27EC 802CDE3C E4760048 */ swc1 $f22, 0x48($v1)
|
||||
/* F27F0 802CDE40 E474004C */ swc1 $f20, 0x4c($v1)
|
||||
.L802CDE44:
|
||||
/* F27F4 802CDE44 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* F27F8 802CDE48 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* F27FC 802CDE4C 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* F2800 802CDE50 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* F2804 802CDE54 D7B80030 */ ldc1 $f24, 0x30($sp)
|
||||
/* F2808 802CDE58 D7B60028 */ ldc1 $f22, 0x28($sp)
|
||||
/* F280C 802CDE5C D7B40020 */ ldc1 $f20, 0x20($sp)
|
||||
/* F2810 802CDE60 03E00008 */ jr $ra
|
||||
/* F2814 802CDE64 27BD0038 */ addiu $sp, $sp, 0x38
|
@ -104,7 +104,7 @@ typedef struct Npc {
|
||||
/* 0x08A */ s16 yawCamOffset;
|
||||
/* 0x08C */ char unk_8C[2];
|
||||
/* 0x08E */ s16 duration; /* formerly interp_counter */
|
||||
/* 0x090 */ s16 homePos[3];
|
||||
/* 0x090 */ Vec3s homePos;
|
||||
/* 0x096 */ char unk_96[12];
|
||||
/* 0x0A2 */ s16 unk_A2;
|
||||
/* 0x0A4 */ u8 npcID;
|
||||
|
@ -267,9 +267,6 @@ ApiStatus func_802CFD30(ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus func_800441F0(ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus func_802D5830(ScriptInstance* script, s32 isInitialCall);
|
||||
|
||||
extern Script ShakeCam1;
|
||||
extern Script ShakeCamX;
|
||||
|
||||
extern Script EnemyNpcHit;
|
||||
extern Script EnemyNpcDefeat;
|
||||
|
||||
|
@ -162,5 +162,7 @@ extern s32 mapScriptLibVram;
|
||||
|
||||
// Scripts
|
||||
extern Bytecode* SCRIPT_NpcDefeat;
|
||||
extern Bytecode* ShakeCam1;
|
||||
extern Bytecode* ShakeCamX;
|
||||
|
||||
#endif
|
||||
|
@ -17,18 +17,19 @@ ApiStatus func_80260DB8(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus func_80260DD8(ScriptInstance* script, s32 isInitialCall) {
|
||||
Actor* player = gBattleStatus.playerActor;
|
||||
s32 var;
|
||||
|
||||
if (!gPlayerData.hasActionCommands) {
|
||||
s32 var = player->varTable[0];
|
||||
if (gPlayerData.hasActionCommands) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
var = player->varTable[0];
|
||||
if (var >= rand_int(100)) {
|
||||
script->varTable[0] = 1;
|
||||
} else {
|
||||
script->varTable[0] = 0;
|
||||
}
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus func_80260E38(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
@ -486,19 +486,17 @@ ApiStatus func_8004580C(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus func_80045838(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Npc* npc;
|
||||
s32 var1 = get_variable(script, *args++);
|
||||
s32 var2 = get_variable(script, *args++);
|
||||
s32 var3 = get_variable(script, *args);
|
||||
Npc* npc = resolve_npc(script, var1);
|
||||
|
||||
npc = resolve_npc(script, var1);
|
||||
if (npc != NULL) {
|
||||
func_800494C0(npc, var2, var3);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
func_800494C0(npc, var2, var3);
|
||||
return ApiStatus_DONE2;
|
||||
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus func_800458CC(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
@ -186,9 +186,24 @@ INCLUDE_ASM(s32, "code_ef070_len_3400", func_802CB008, ScriptInstance* script, s
|
||||
|
||||
INCLUDE_ASM(s32, "code_ef070_len_3400", ShakeCam, ScriptInstance* script, s32 isInitialCall);
|
||||
|
||||
INCLUDE_ASM(s32, "code_ef070_len_3400", exec_ShakeCam1);
|
||||
void exec_ShakeCam1(s32 arg0, s32 arg1, s32 arg2) {
|
||||
ScriptInstance* script;
|
||||
|
||||
INCLUDE_ASM(s32, "code_ef070_len_3400", exec_ShakeCamX);
|
||||
script = start_script_in_group(&ShakeCam1, 1, 0, 4);
|
||||
script->varTable[0] = arg0;
|
||||
script->varTable[1] = arg1;
|
||||
script->varTable[2] = arg2;
|
||||
}
|
||||
|
||||
void exec_ShakeCamX(s32 arg0, s32 arg1, s32 arg2, f32 arg3) {
|
||||
ScriptInstance* script;
|
||||
|
||||
script = start_script_in_group(&ShakeCamX, 1, 0, 4);
|
||||
set_variable(script, SI_VAR(0), arg0);
|
||||
set_variable(script, SI_VAR(1), arg1);
|
||||
set_variable(script, SI_VAR(2), arg2);
|
||||
set_float_variable(script, SI_VAR(3), arg3);
|
||||
}
|
||||
|
||||
ApiStatus SetCamLeadPlayer(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
@ -18,10 +18,11 @@ ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Npc* npc = get_npc_unsafe(get_variable(script, *args++));
|
||||
|
||||
if (npc) {
|
||||
free_npc(npc);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
free_npc(npc);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -36,7 +37,23 @@ ApiStatus GetNpcPointer(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcPos, ScriptInstance* script, s32 isInitialCall);
|
||||
|
||||
INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcRotation, ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus SetNpcRotation(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 npcID = get_variable(script, *args++);
|
||||
f32 rotX = get_float_variable(script, *args++);
|
||||
f32 rotY = get_float_variable(script, *args++);
|
||||
f32 rotZ = get_float_variable(script, *args++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->rotation.x = rotX;
|
||||
npc->rotation.y = rotY;
|
||||
npc->rotation.z = rotZ;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802CDE68(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
@ -45,12 +62,12 @@ ApiStatus func_802CDE68(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* npc;
|
||||
|
||||
npc = resolve_npc(script, npcId);
|
||||
if (npc != NULL) {
|
||||
npc->unk_50 = var1;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->unk_50 = var1;
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus SetNpcScale(ScriptInstance* script, s32 isInitialCall) {
|
||||
@ -61,15 +78,13 @@ ApiStatus SetNpcScale(ScriptInstance* script, s32 isInitialCall) {
|
||||
f32 sizeZ = get_float_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
|
||||
if (todo) {
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->scale.x = sizeX;
|
||||
npc->scale.y = sizeY;
|
||||
npc->scale.z = sizeZ;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -80,14 +95,12 @@ ApiStatus SetNpcCollisionSize(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 radius = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
|
||||
if (todo) {
|
||||
npc->collisionHeight = height;
|
||||
npc->collisionRadius = radius;
|
||||
}
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->collisionHeight = height;
|
||||
npc->collisionRadius = radius;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -97,10 +110,11 @@ ApiStatus SetNpcSpeed(ScriptInstance* script, s32 isInitialCall) {
|
||||
f32 speed = get_float_variable(script, *ptrReadPos);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
npc->moveSpeed = speed;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->moveSpeed = speed;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -110,10 +124,11 @@ ApiStatus SetNpcJumpscale(ScriptInstance* script, s32 isInitialCall) {
|
||||
f32 jumpScale = get_float_variable(script, *ptrReadPos);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
npc->jumpScale = jumpScale;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->jumpScale = jumpScale;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -123,10 +138,11 @@ ApiStatus SetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 animation = get_variable(script, *ptrReadPos);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
set_npc_animation(npc, animation);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
set_npc_animation(npc, animation);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -136,10 +152,11 @@ ApiStatus GetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode outVar = *ptrReadPos++;
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
set_variable(script, outVar, npc->currentAnim);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
set_variable(script, outVar, npc->currentAnim);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -149,10 +166,11 @@ ApiStatus SetNpcAnimationSpeed(ScriptInstance* script, s32 isInitialCall) {
|
||||
f32 animationSpeed = get_float_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
npc->animationSpeed = animationSpeed;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->animationSpeed = animationSpeed;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -176,13 +194,11 @@ ApiStatus GetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode outVar = *ptrReadPos++;
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
|
||||
if (todo) {
|
||||
set_variable(script, outVar, clamp_angle(npc->yaw));
|
||||
}
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
set_variable(script, outVar, clamp_angle(npc->yaw));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -191,10 +207,11 @@ ApiStatus SetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
|
||||
NpcId npcID = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
set_npc_yaw(npc, get_variable(script, *ptrReadPos++));
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
set_npc_yaw(npc, get_variable(script, *ptrReadPos++));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -212,30 +229,28 @@ ApiStatus func_802CF1B4(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode arg1 = *args;
|
||||
Npc* npc;
|
||||
Npc* npc = resolve_npc(script, npcId);
|
||||
|
||||
npc = resolve_npc(script, npcId);
|
||||
if (npc != NULL) {
|
||||
npc->unk_80 = arg1;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->unk_80 = arg1;
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus func_802CF208(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode arg1 = *args;
|
||||
Npc* npc;
|
||||
Npc* npc = resolve_npc(script, npcId);
|
||||
|
||||
npc = resolve_npc(script, npcId);
|
||||
if (npc != NULL) {
|
||||
func_8003AC5C(npc, arg1, 0);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
func_8003AC5C(npc, arg1, 0);
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus EnableNpcShadow(ScriptInstance* script, s32 isInitialCall) {
|
||||
@ -244,11 +259,13 @@ ApiStatus EnableNpcShadow(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 enableShadow = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
if (enableShadow) {
|
||||
enable_npc_shadow(npc);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
if (enableShadow) {
|
||||
enable_npc_shadow(npc);
|
||||
} else {
|
||||
disable_npc_shadow(npc);
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
@ -260,11 +277,13 @@ ApiStatus EnableNpcBlur(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 enableBlur = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
if (enableBlur) {
|
||||
enable_npc_blur(npc);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
if (enableBlur) {
|
||||
enable_npc_blur(npc);
|
||||
} else {
|
||||
disable_npc_blur(npc);
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
@ -275,14 +294,26 @@ ApiStatus ClearPartnerMoveHistory(ScriptInstance* script, s32 isInitialCall) {
|
||||
NpcId npcID = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
clear_partner_move_history(npc);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
clear_partner_move_history(npc);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcSetHomePosToCurrent, ScriptInstance* script, s32 isInitialCall);
|
||||
ApiStatus NpcSetHomePosToCurrent(ScriptInstance* script, s32 isInitialCall) {
|
||||
Npc* npc = resolve_npc(script, get_variable(script, *script->ptrReadPos));
|
||||
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->homePos.x = npc->pos.x;
|
||||
npc->homePos.y = npc->pos.y;
|
||||
npc->homePos.z = npc->pos.z;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus GetPartnerPos(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* ptrReadPos = script->ptrReadPos;
|
||||
@ -291,13 +322,14 @@ ApiStatus GetPartnerPos(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode posZ = *ptrReadPos++;
|
||||
Npc* npc = get_npc_unsafe(-4);
|
||||
|
||||
if (npc != NULL) {
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
set_variable(script, posX, npc->pos.x);
|
||||
set_variable(script, posY, npc->pos.y);
|
||||
set_variable(script, posZ, npc->pos.z);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus DisablePartnerAI(ScriptInstance* script, s32 isInitialCall) {
|
||||
@ -362,30 +394,28 @@ ApiStatus func_802CFE2C(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode arg1 = *args;
|
||||
Npc* npc;
|
||||
Npc* npc = resolve_npc(script, npcId);
|
||||
|
||||
npc = resolve_npc(script, npcId);
|
||||
if (npc != NULL) {
|
||||
npc->unk_A2 = arg1;
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
npc->unk_A2 = arg1;
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
ApiStatus func_802CFE80(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode var1 = get_variable(script, *args++);
|
||||
Npc* npc;
|
||||
Npc* npc = resolve_npc(script, npcId);
|
||||
|
||||
npc = resolve_npc(script, npcId);
|
||||
if (npc != NULL) {
|
||||
func_8003B3D0(npc, var1);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
func_8003B3D0(npc, var1);
|
||||
return ApiStatus_DONE2;
|
||||
do {} while (0); // necessary to match
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CFEEC);
|
||||
@ -399,10 +429,11 @@ ApiStatus SetNpcEffect(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 value2 = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
func_8003C3D8(npc, value1, value2);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
func_8003C3D8(npc, value1, value2);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -413,10 +444,11 @@ ApiStatus PlaySoundAtNpc(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 value2 = get_variable(script, *ptrReadPos++);
|
||||
Npc* npc = resolve_npc(script, npcID);
|
||||
|
||||
if (npc != NULL) {
|
||||
play_sound_at_position(soundID, value2, npc->pos.x, npc->pos.y, npc->pos.z);
|
||||
if (npc == NULL) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
play_sound_at_position(soundID, value2, npc->pos.x, npc->pos.y, npc->pos.z);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -429,4 +461,3 @@ ApiStatus func_802D0244(ScriptInstance* script, s32 isInitialCall) {
|
||||
npc->renderMode = renderMode;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
4
src/si.c
4
src/si.c
@ -4,7 +4,7 @@ s32 si_find_label(ScriptInstance* script, s32 arg1);
|
||||
s32 si_skip_if(ScriptInstance* script);
|
||||
s32 si_skip_else(ScriptInstance* script);
|
||||
s32 si_goto_end_loop(ScriptInstance* script);
|
||||
s32 si_goto_end_case(ScriptInstance* script);
|
||||
Bytecode* si_goto_end_case(ScriptInstance* script);
|
||||
s32 si_goto_next_case(ScriptInstance* script);
|
||||
s32 get_variable_index(ScriptInstance* script, s32 var);
|
||||
|
||||
@ -1475,7 +1475,7 @@ INCLUDE_ASM(s32, "si", si_skip_else, ScriptInstance* script);
|
||||
} while(1);
|
||||
}*/
|
||||
|
||||
INCLUDE_ASM(s32, "si", si_goto_end_case, ScriptInstance* script);
|
||||
INCLUDE_ASM(Bytecode*, "si", si_goto_end_case, ScriptInstance* script);
|
||||
|
||||
INCLUDE_ASM(s32, "si", si_goto_next_case, ScriptInstance* script);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user