mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 00:42:34 +01:00
Match RemoveActorDecoration, AddActorDecoration, GetDistanceToGoal (#513)
* Match AddActorDecoration & RemoveActorDecoration * Match GetDistanceToGoal * Delete AddActorDecoration.s * Delete GetDistanceToGoal.s * Delete RemoveActorDecoration.s * Update RemoveActorDecoration Co-authored-by: Alexander Faßbender <31699028+Brotenko@users.noreply.github.com> * Update AddActorDecoration Co-authored-by: Alexander Faßbender <31699028+Brotenko@users.noreply.github.com> * Update GetDistanceToGoal Co-authored-by: Alexander Faßbender <31699028+Brotenko@users.noreply.github.com> * Update GetDistanceToGoal Co-authored-by: Alexander Faßbender <31699028+Brotenko@users.noreply.github.com>
This commit is contained in:
parent
432e891080
commit
97e67dc61c
54
src/197F40.c
54
src/197F40.c
@ -2260,7 +2260,22 @@ ApiStatus GetPlayerActorID(Evt* script, s32 isInitialCall) {
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", func_8026E9A0);
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", GetDistanceToGoal);
|
||||
ApiStatus GetDistanceToGoal(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
s32 outVar = *args++;
|
||||
Actor* actor;
|
||||
f32 dist;
|
||||
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
actor = get_actor(actorID);
|
||||
dist = dist2D(actor->currentPos.x, actor->currentPos.z, actor->state.goalPos.x, actor->state.goalPos.z);
|
||||
evt_set_variable(script, outVar, dist);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", func_8026EA7C);
|
||||
|
||||
@ -2272,9 +2287,42 @@ INCLUDE_ASM(s32, "197F40", func_8026ED20);
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", func_8026EDE4);
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", AddActorDecoration);
|
||||
ApiStatus AddActorDecoration(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
s32 partIndex = evt_get_variable(script, *args++);
|
||||
s32 decorationIndex = evt_get_variable(script, *args++);
|
||||
s32 decorationType = evt_get_variable(script, *args++);
|
||||
Actor* actor;
|
||||
ActorPart* actorPart;
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", RemoveActorDecoration);
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.enemyID;
|
||||
}
|
||||
|
||||
actor = get_actor(actorID);
|
||||
actorPart = get_actor_part(actor, partIndex);
|
||||
add_part_decoration(actorPart, decorationIndex, decorationType);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus RemoveActorDecoration(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
s32 partIndex = evt_get_variable(script, *args++);
|
||||
s32 decorationIndex = evt_get_variable(script, *args++);
|
||||
Actor* actor;
|
||||
ActorPart* actorPart;
|
||||
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.enemyID;
|
||||
}
|
||||
|
||||
actor = get_actor(actorID);
|
||||
actorPart = get_actor_part(actor, partIndex);
|
||||
remove_part_decoration(actorPart, decorationIndex);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "197F40", ModifyActorDecoration);
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel AddActorDecoration
|
||||
/* 19D768 8026EE88 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* 19D76C 8026EE8C AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* 19D770 8026EE90 0080902D */ daddu $s2, $a0, $zero
|
||||
/* 19D774 8026EE94 AFBF0024 */ sw $ra, 0x24($sp)
|
||||
/* 19D778 8026EE98 AFB40020 */ sw $s4, 0x20($sp)
|
||||
/* 19D77C 8026EE9C AFB3001C */ sw $s3, 0x1c($sp)
|
||||
/* 19D780 8026EEA0 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* 19D784 8026EEA4 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 19D788 8026EEA8 8E50000C */ lw $s0, 0xc($s2)
|
||||
/* 19D78C 8026EEAC 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D790 8026EEB0 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D794 8026EEB4 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D798 8026EEB8 0040882D */ daddu $s1, $v0, $zero
|
||||
/* 19D79C 8026EEBC 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D7A0 8026EEC0 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D7A4 8026EEC4 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D7A8 8026EEC8 0240202D */ daddu $a0, $s2, $zero
|
||||
/* 19D7AC 8026EECC 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D7B0 8026EED0 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D7B4 8026EED4 0240202D */ daddu $a0, $s2, $zero
|
||||
/* 19D7B8 8026EED8 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D7BC 8026EEDC 0040A02D */ daddu $s4, $v0, $zero
|
||||
/* 19D7C0 8026EEE0 0240202D */ daddu $a0, $s2, $zero
|
||||
/* 19D7C4 8026EEE4 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D7C8 8026EEE8 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D7CC 8026EEEC 0040982D */ daddu $s3, $v0, $zero
|
||||
/* 19D7D0 8026EEF0 0040802D */ daddu $s0, $v0, $zero
|
||||
/* 19D7D4 8026EEF4 2402FF81 */ addiu $v0, $zero, -0x7f
|
||||
/* 19D7D8 8026EEF8 16220002 */ bne $s1, $v0, .L8026EF04
|
||||
/* 19D7DC 8026EEFC 00000000 */ nop
|
||||
/* 19D7E0 8026EF00 8E510148 */ lw $s1, 0x148($s2)
|
||||
.L8026EF04:
|
||||
/* 19D7E4 8026EF04 0C09A75B */ jal get_actor
|
||||
/* 19D7E8 8026EF08 0220202D */ daddu $a0, $s1, $zero
|
||||
/* 19D7EC 8026EF0C 0040202D */ daddu $a0, $v0, $zero
|
||||
/* 19D7F0 8026EF10 0C099117 */ jal get_actor_part
|
||||
/* 19D7F4 8026EF14 0280282D */ daddu $a1, $s4, $zero
|
||||
/* 19D7F8 8026EF18 0040202D */ daddu $a0, $v0, $zero
|
||||
/* 19D7FC 8026EF1C 0260282D */ daddu $a1, $s3, $zero
|
||||
/* 19D800 8026EF20 0C099C45 */ jal add_part_decoration
|
||||
/* 19D804 8026EF24 0200302D */ daddu $a2, $s0, $zero
|
||||
/* 19D808 8026EF28 8FBF0024 */ lw $ra, 0x24($sp)
|
||||
/* 19D80C 8026EF2C 8FB40020 */ lw $s4, 0x20($sp)
|
||||
/* 19D810 8026EF30 8FB3001C */ lw $s3, 0x1c($sp)
|
||||
/* 19D814 8026EF34 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* 19D818 8026EF38 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* 19D81C 8026EF3C 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 19D820 8026EF40 24020002 */ addiu $v0, $zero, 2
|
||||
/* 19D824 8026EF44 03E00008 */ jr $ra
|
||||
/* 19D828 8026EF48 27BD0028 */ addiu $sp, $sp, 0x28
|
@ -1,37 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel GetDistanceToGoal
|
||||
/* 19D2DC 8026E9FC 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* 19D2E0 8026EA00 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* 19D2E4 8026EA04 0080882D */ daddu $s1, $a0, $zero
|
||||
/* 19D2E8 8026EA08 AFBF0018 */ sw $ra, 0x18($sp)
|
||||
/* 19D2EC 8026EA0C AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 19D2F0 8026EA10 8E30000C */ lw $s0, 0xc($s1)
|
||||
/* 19D2F4 8026EA14 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D2F8 8026EA18 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D2FC 8026EA1C 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D300 8026EA20 0040202D */ daddu $a0, $v0, $zero
|
||||
/* 19D304 8026EA24 2402FF81 */ addiu $v0, $zero, -0x7f
|
||||
/* 19D308 8026EA28 14820002 */ bne $a0, $v0, .L8026EA34
|
||||
/* 19D30C 8026EA2C 8E100000 */ lw $s0, ($s0)
|
||||
/* 19D310 8026EA30 8E240148 */ lw $a0, 0x148($s1)
|
||||
.L8026EA34:
|
||||
/* 19D314 8026EA34 0C09A75B */ jal get_actor
|
||||
/* 19D318 8026EA38 00000000 */ nop
|
||||
/* 19D31C 8026EA3C 8C460018 */ lw $a2, 0x18($v0)
|
||||
/* 19D320 8026EA40 C44C0144 */ lwc1 $f12, 0x144($v0)
|
||||
/* 19D324 8026EA44 C44E014C */ lwc1 $f14, 0x14c($v0)
|
||||
/* 19D328 8026EA48 0C00A7B5 */ jal dist2D
|
||||
/* 19D32C 8026EA4C 8C470020 */ lw $a3, 0x20($v0)
|
||||
/* 19D330 8026EA50 0220202D */ daddu $a0, $s1, $zero
|
||||
/* 19D334 8026EA54 4600008D */ trunc.w.s $f2, $f0
|
||||
/* 19D338 8026EA58 44061000 */ mfc1 $a2, $f2
|
||||
/* 19D33C 8026EA5C 0C0B2026 */ jal evt_set_variable
|
||||
/* 19D340 8026EA60 0200282D */ daddu $a1, $s0, $zero
|
||||
/* 19D344 8026EA64 8FBF0018 */ lw $ra, 0x18($sp)
|
||||
/* 19D348 8026EA68 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* 19D34C 8026EA6C 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 19D350 8026EA70 24020002 */ addiu $v0, $zero, 2
|
||||
/* 19D354 8026EA74 03E00008 */ jr $ra
|
||||
/* 19D358 8026EA78 27BD0020 */ addiu $sp, $sp, 0x20
|
@ -1,46 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel RemoveActorDecoration
|
||||
/* 19D82C 8026EF4C 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* 19D830 8026EF50 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* 19D834 8026EF54 0080902D */ daddu $s2, $a0, $zero
|
||||
/* 19D838 8026EF58 AFBF0020 */ sw $ra, 0x20($sp)
|
||||
/* 19D83C 8026EF5C AFB3001C */ sw $s3, 0x1c($sp)
|
||||
/* 19D840 8026EF60 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* 19D844 8026EF64 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 19D848 8026EF68 8E50000C */ lw $s0, 0xc($s2)
|
||||
/* 19D84C 8026EF6C 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D850 8026EF70 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D854 8026EF74 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D858 8026EF78 0040882D */ daddu $s1, $v0, $zero
|
||||
/* 19D85C 8026EF7C 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D860 8026EF80 26100004 */ addiu $s0, $s0, 4
|
||||
/* 19D864 8026EF84 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D868 8026EF88 0240202D */ daddu $a0, $s2, $zero
|
||||
/* 19D86C 8026EF8C 0240202D */ daddu $a0, $s2, $zero
|
||||
/* 19D870 8026EF90 8E050000 */ lw $a1, ($s0)
|
||||
/* 19D874 8026EF94 0C0B1EAF */ jal evt_get_variable
|
||||
/* 19D878 8026EF98 0040802D */ daddu $s0, $v0, $zero
|
||||
/* 19D87C 8026EF9C 0040982D */ daddu $s3, $v0, $zero
|
||||
/* 19D880 8026EFA0 2402FF81 */ addiu $v0, $zero, -0x7f
|
||||
/* 19D884 8026EFA4 16220002 */ bne $s1, $v0, .L8026EFB0
|
||||
/* 19D888 8026EFA8 00000000 */ nop
|
||||
/* 19D88C 8026EFAC 8E510148 */ lw $s1, 0x148($s2)
|
||||
.L8026EFB0:
|
||||
/* 19D890 8026EFB0 0C09A75B */ jal get_actor
|
||||
/* 19D894 8026EFB4 0220202D */ daddu $a0, $s1, $zero
|
||||
/* 19D898 8026EFB8 0040202D */ daddu $a0, $v0, $zero
|
||||
/* 19D89C 8026EFBC 0C099117 */ jal get_actor_part
|
||||
/* 19D8A0 8026EFC0 0200282D */ daddu $a1, $s0, $zero
|
||||
/* 19D8A4 8026EFC4 0040202D */ daddu $a0, $v0, $zero
|
||||
/* 19D8A8 8026EFC8 0C099C86 */ jal remove_part_decoration
|
||||
/* 19D8AC 8026EFCC 0260282D */ daddu $a1, $s3, $zero
|
||||
/* 19D8B0 8026EFD0 8FBF0020 */ lw $ra, 0x20($sp)
|
||||
/* 19D8B4 8026EFD4 8FB3001C */ lw $s3, 0x1c($sp)
|
||||
/* 19D8B8 8026EFD8 8FB20018 */ lw $s2, 0x18($sp)
|
||||
/* 19D8BC 8026EFDC 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* 19D8C0 8026EFE0 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 19D8C4 8026EFE4 24020002 */ addiu $v0, $zero, 2
|
||||
/* 19D8C8 8026EFE8 03E00008 */ jr $ra
|
||||
/* 19D8CC 8026EFEC 27BD0028 */ addiu $sp, $sp, 0x28
|
Loading…
Reference in New Issue
Block a user