Match src/battle/area_kzn2/59F420.c (petit piranha funcs) (#774)

* Match func_80218D90_59F470 (src/battle/area_kzn2/59F420.c)

* clean up

* Match func_80218D40_59F420

* name funcs

* fix warnings

* remove double newline
This commit is contained in:
Alex Bates 2022-09-16 17:45:16 +01:00 committed by GitHub
parent ccd91aa046
commit 4fa83c8ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 65 deletions

View File

@ -537,10 +537,17 @@ typedef struct PurpleRingFXData {
typedef struct FlameFXData {
/* 0x00 */ s32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
} FlameFXData; // size = 0x??
/* 0x04 */ Vec3f pos;
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x18 */ s32 unk_18;
/* 0x1C */ s32 unk_1C;
/* 0x20 */ s32 unk_20;
/* 0x24 */ s32 unk_24;
/* 0x28 */ f32 unk_28;
/* 0x2C */ f32 unk_2C;
/* 0x30 */ f32 unk_30;
} FlameFXData; // size = 0x34
typedef struct StarsBurstFXData {
/* 0x00 */ char todo[0];

View File

@ -1,7 +1,24 @@
#include "common.h"
#include "effects.h"
#define NAMESPACE b_area_kzn2
#define NAMESPACE b_area_kzn2_petit_piranha
INCLUDE_ASM(s32, "battle/area_kzn2/59F420", func_80218D40_59F420);
ApiStatus N(SetFlameUnk2C)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
EffectInstance* effect = (EffectInstance*) evt_get_variable(script, *args++);
FlameFXData* flame = effect->data.flame;
INCLUDE_ASM(s32, "battle/area_kzn2/59F420", func_80218D90_59F470);
flame->unk_2C = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus N(SetFlameX)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
EffectInstance* effect = (EffectInstance*) evt_get_variable(script, *args++);
FlameFXData* flame = effect->data.flame;
flame->pos.x = evt_get_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -27,8 +27,8 @@ void flame_render(EffectInstance* effect) {
f32 outZ;
f32 outS;
shim_transform_point(gCameras[gCurrentCameraID].perspectiveMatrix[0], data->unk_04, data->unk_08, data->unk_0C, 1.0f, &outX, &outY, &outZ, &outS);
shim_transform_point(gCameras[gCurrentCameraID].perspectiveMatrix[0], data->pos.x, data->pos.y, data->pos.z, 1.0f, &outX, &outY, &outZ, &outS);
outDist = outZ + 5000;
if (outDist < 0) {
outDist = 0;
@ -39,7 +39,7 @@ void flame_render(EffectInstance* effect) {
if (outS < 0.01 && -0.01 < outS) {
outDist = 0;
}
renderTaskPtr->appendGfx = flame_appendGfx;
renderTaskPtr->distance = -outDist;
renderTaskPtr->appendGfxArg = effect;

File diff suppressed because one or more lines are too long

View File

@ -1,24 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80218D40_59F420
/* 59F420 80218D40 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 59F424 80218D44 AFB10014 */ sw $s1, 0x14($sp)
/* 59F428 80218D48 0080882D */ daddu $s1, $a0, $zero
/* 59F42C 80218D4C AFBF0018 */ sw $ra, 0x18($sp)
/* 59F430 80218D50 AFB00010 */ sw $s0, 0x10($sp)
/* 59F434 80218D54 8E30000C */ lw $s0, 0xc($s1)
/* 59F438 80218D58 8E050000 */ lw $a1, ($s0)
/* 59F43C 80218D5C 0C0B1EAF */ jal evt_get_variable
/* 59F440 80218D60 26100004 */ addiu $s0, $s0, 4
/* 59F444 80218D64 8E050000 */ lw $a1, ($s0)
/* 59F448 80218D68 8C50000C */ lw $s0, 0xc($v0)
/* 59F44C 80218D6C 0C0B210B */ jal evt_get_float_variable
/* 59F450 80218D70 0220202D */ daddu $a0, $s1, $zero
/* 59F454 80218D74 E600002C */ swc1 $f0, 0x2c($s0)
/* 59F458 80218D78 8FBF0018 */ lw $ra, 0x18($sp)
/* 59F45C 80218D7C 8FB10014 */ lw $s1, 0x14($sp)
/* 59F460 80218D80 8FB00010 */ lw $s0, 0x10($sp)
/* 59F464 80218D84 24020002 */ addiu $v0, $zero, 2
/* 59F468 80218D88 03E00008 */ jr $ra
/* 59F46C 80218D8C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80218D90_59F470
/* 59F470 80218D90 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 59F474 80218D94 AFB10014 */ sw $s1, 0x14($sp)
/* 59F478 80218D98 0080882D */ daddu $s1, $a0, $zero
/* 59F47C 80218D9C AFBF0018 */ sw $ra, 0x18($sp)
/* 59F480 80218DA0 AFB00010 */ sw $s0, 0x10($sp)
/* 59F484 80218DA4 8E30000C */ lw $s0, 0xc($s1)
/* 59F488 80218DA8 8E050000 */ lw $a1, ($s0)
/* 59F48C 80218DAC 0C0B1EAF */ jal evt_get_variable
/* 59F490 80218DB0 26100004 */ addiu $s0, $s0, 4
/* 59F494 80218DB4 8E050000 */ lw $a1, ($s0)
/* 59F498 80218DB8 8C50000C */ lw $s0, 0xc($v0)
/* 59F49C 80218DBC 0C0B1EAF */ jal evt_get_variable
/* 59F4A0 80218DC0 0220202D */ daddu $a0, $s1, $zero
/* 59F4A4 80218DC4 44820000 */ mtc1 $v0, $f0
/* 59F4A8 80218DC8 00000000 */ nop
/* 59F4AC 80218DCC 46800020 */ cvt.s.w $f0, $f0
/* 59F4B0 80218DD0 E6000004 */ swc1 $f0, 4($s0)
/* 59F4B4 80218DD4 8FBF0018 */ lw $ra, 0x18($sp)
/* 59F4B8 80218DD8 8FB10014 */ lw $s1, 0x14($sp)
/* 59F4BC 80218DDC 8FB00010 */ lw $s0, 0x10($sp)
/* 59F4C0 80218DE0 24020002 */ addiu $v0, $zero, 2
/* 59F4C4 80218DE4 03E00008 */ jr $ra
/* 59F4C8 80218DE8 27BD0020 */ addiu $sp, $sp, 0x20
/* 59F4CC 80218DEC 00000000 */ nop

View File

@ -12610,8 +12610,8 @@ func_80218A98_59F178 = 0x80218A98; // type:func rom:0x59F178
func_80218B38_59F218 = 0x80218B38; // type:func rom:0x59F218
func_80218B90_59F270 = 0x80218B90; // type:func rom:0x59F270
func_80218BE8_59F2C8 = 0x80218BE8; // type:func rom:0x59F2C8
func_80218D40_59F420 = 0x80218D40; // type:func rom:0x59F420
func_80218D90_59F470 = 0x80218D90; // type:func rom:0x59F470
b_area_kzn2_petit_piranha_SetFlameUnk2C = 0x80218D40; // type:func rom:0x59F420
b_area_kzn2_petit_piranha_SetFlameX = 0x80218D90; // type:func rom:0x59F470
func_80218DF0_59F4D0 = 0x80218DF0; // type:func rom:0x59F4D0
b_area_flo_UnkBattleFunc1 = 0x80218000; // type:func rom:0x5B14B0
b_area_flo_UnkFloatFunc4 = 0x802180CC; // type:func rom:0x5B157C