4 16c8e0 funcs

This commit is contained in:
Ethan Roseman 2020-11-17 22:00:47 -05:00
parent cded04dae6
commit a0ec3e79c3
6 changed files with 88 additions and 181 deletions

View File

@ -1,71 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel delete_player_actor
/* 16F648 80240D68 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 16F64C 80240D6C AFB10014 */ sw $s1, 0x14($sp)
/* 16F650 80240D70 0080882D */ daddu $s1, $a0, $zero
/* 16F654 80240D74 AFB00010 */ sw $s0, 0x10($sp)
/* 16F658 80240D78 0000802D */ daddu $s0, $zero, $zero
/* 16F65C 80240D7C AFBF0020 */ sw $ra, 0x20($sp)
/* 16F660 80240D80 AFB3001C */ sw $s3, 0x1c($sp)
/* 16F664 80240D84 AFB20018 */ sw $s2, 0x18($sp)
/* 16F668 80240D88 0220202D */ daddu $a0, $s1, $zero
.L80240D8C:
/* 16F66C 80240D8C 0C099C8D */ jal remove_actor_decoration
/* 16F670 80240D90 0200282D */ daddu $a1, $s0, $zero
/* 16F674 80240D94 26100001 */ addiu $s0, $s0, 1
/* 16F678 80240D98 2A020002 */ slti $v0, $s0, 2
/* 16F67C 80240D9C 1440FFFB */ bnez $v0, .L80240D8C
/* 16F680 80240DA0 0220202D */ daddu $a0, $s1, $zero
/* 16F684 80240DA4 8E2201D0 */ lw $v0, 0x1d0($s1)
/* 16F688 80240DA8 10400003 */ beqz $v0, .L80240DB8
/* 16F68C 80240DAC 00000000 */ nop
/* 16F690 80240DB0 0C0B102B */ jal kill_script_by_ID
/* 16F694 80240DB4 8E2401E0 */ lw $a0, 0x1e0($s1)
.L80240DB8:
/* 16F698 80240DB8 8E2201D8 */ lw $v0, 0x1d8($s1)
/* 16F69C 80240DBC 10400003 */ beqz $v0, .L80240DCC
/* 16F6A0 80240DC0 00000000 */ nop
/* 16F6A4 80240DC4 0C0B102B */ jal kill_script_by_ID
/* 16F6A8 80240DC8 8E2401E8 */ lw $a0, 0x1e8($s1)
.L80240DCC:
/* 16F6AC 80240DCC 8E2201D4 */ lw $v0, 0x1d4($s1)
/* 16F6B0 80240DD0 10400003 */ beqz $v0, .L80240DE0
/* 16F6B4 80240DD4 00000000 */ nop
/* 16F6B8 80240DD8 0C0B102B */ jal kill_script_by_ID
/* 16F6BC 80240DDC 8E2401E4 */ lw $a0, 0x1e4($s1)
.L80240DE0:
/* 16F6C0 80240DE0 8E3001F4 */ lw $s0, 0x1f4($s1)
/* 16F6C4 80240DE4 8E24042C */ lw $a0, 0x42c($s1)
/* 16F6C8 80240DE8 8E1300C0 */ lw $s3, 0xc0($s0)
/* 16F6CC 80240DEC 0C0448CA */ jal func_80112328
/* 16F6D0 80240DF0 8E120010 */ lw $s2, 0x10($s0)
/* 16F6D4 80240DF4 0C011DBD */ jal func_800476F4
/* 16F6D8 80240DF8 86240436 */ lh $a0, 0x436($s1)
/* 16F6DC 80240DFC 0C016914 */ jal remove_effect
/* 16F6E0 80240E00 8E240440 */ lw $a0, 0x440($s1)
/* 16F6E4 80240E04 8E220200 */ lw $v0, 0x200($s1)
/* 16F6E8 80240E08 10400003 */ beqz $v0, .L80240E18
/* 16F6EC 80240E0C 00000000 */ nop
/* 16F6F0 80240E10 8C42000C */ lw $v0, 0xc($v0)
/* 16F6F4 80240E14 AC400024 */ sw $zero, 0x24($v0)
.L80240E18:
/* 16F6F8 80240E18 0C00AB4B */ jal heap_free
/* 16F6FC 80240E1C 0240202D */ daddu $a0, $s2, $zero
/* 16F700 80240E20 0C00AB4B */ jal heap_free
/* 16F704 80240E24 0260202D */ daddu $a0, $s3, $zero
/* 16F708 80240E28 0C00AB4B */ jal heap_free
/* 16F70C 80240E2C 0200202D */ daddu $a0, $s0, $zero
/* 16F710 80240E30 0C00AB4B */ jal heap_free
/* 16F714 80240E34 0220202D */ daddu $a0, $s1, $zero
/* 16F718 80240E38 8FBF0020 */ lw $ra, 0x20($sp)
/* 16F71C 80240E3C 8FB3001C */ lw $s3, 0x1c($sp)
/* 16F720 80240E40 8FB20018 */ lw $s2, 0x18($sp)
/* 16F724 80240E44 8FB10014 */ lw $s1, 0x14($sp)
/* 16F728 80240E48 8FB00010 */ lw $s0, 0x10($sp)
/* 16F72C 80240E4C 03E00008 */ jr $ra
/* 16F730 80240E50 27BD0028 */ addiu $sp, $sp, 0x28
/* 16F734 80240E54 00000000 */ nop
/* 16F738 80240E58 00000000 */ nop
/* 16F73C 80240E5C 00000000 */ nop

View File

@ -1,11 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8023FF84
/* 16E864 8023FF84 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 16E868 8023FF88 AFBF0010 */ sw $ra, 0x10($sp)
/* 16E86C 8023FF8C 0C099F12 */ jal show_foreground_models_unsafe
/* 16E870 8023FF90 00000000 */ nop
/* 16E874 8023FF94 8FBF0010 */ lw $ra, 0x10($sp)
/* 16E878 8023FF98 03E00008 */ jr $ra
/* 16E87C 8023FF9C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,74 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel get_dpad_input_radial
/* 16C8E0 8023E000 27BDFFB8 */ addiu $sp, $sp, -0x48
/* 16C8E4 8023E004 AFB00010 */ sw $s0, 0x10($sp)
/* 16C8E8 8023E008 0080802D */ daddu $s0, $a0, $zero
/* 16C8EC 8023E00C AFB10014 */ sw $s1, 0x14($sp)
/* 16C8F0 8023E010 3C02800E */ lui $v0, %hi(gBattleStatus)
/* 16C8F4 8023E014 2442C070 */ addiu $v0, $v0, %lo(gBattleStatus)
/* 16C8F8 8023E018 AFBF0018 */ sw $ra, 0x18($sp)
/* 16C8FC 8023E01C F7BC0040 */ sdc1 $f28, 0x40($sp)
/* 16C900 8023E020 F7BA0038 */ sdc1 $f26, 0x38($sp)
/* 16C904 8023E024 F7B80030 */ sdc1 $f24, 0x30($sp)
/* 16C908 8023E028 F7B60028 */ sdc1 $f22, 0x28($sp)
/* 16C90C 8023E02C F7B40020 */ sdc1 $f20, 0x20($sp)
/* 16C910 8023E030 C456021C */ lwc1 $f22, 0x21c($v0)
/* 16C914 8023E034 4680B5A0 */ cvt.s.w $f22, $f22
/* 16C918 8023E038 C4400220 */ lwc1 $f0, 0x220($v0)
/* 16C91C 8023E03C 46800020 */ cvt.s.w $f0, $f0
/* 16C920 8023E040 94430212 */ lhu $v1, 0x212($v0)
/* 16C924 8023E044 3C014270 */ lui $at, 0x4270
/* 16C928 8023E048 4481D000 */ mtc1 $at, $f26
/* 16C92C 8023E04C 30620F00 */ andi $v0, $v1, 0xf00
/* 16C930 8023E050 1040000F */ beqz $v0, .L8023E090
/* 16C934 8023E054 00A0882D */ daddu $s1, $a1, $zero
/* 16C938 8023E058 4480B000 */ mtc1 $zero, $f22
/* 16C93C 8023E05C 30620800 */ andi $v0, $v1, 0x800
/* 16C940 8023E060 10400002 */ beqz $v0, .L8023E06C
/* 16C944 8023E064 4600B006 */ mov.s $f0, $f22
/* 16C948 8023E068 4600D006 */ mov.s $f0, $f26
.L8023E06C:
/* 16C94C 8023E06C 30620400 */ andi $v0, $v1, 0x400
/* 16C950 8023E070 54400001 */ bnel $v0, $zero, .L8023E078
/* 16C954 8023E074 4600D007 */ neg.s $f0, $f26
.L8023E078:
/* 16C958 8023E078 30620200 */ andi $v0, $v1, 0x200
/* 16C95C 8023E07C 54400001 */ bnel $v0, $zero, .L8023E084
/* 16C960 8023E080 4600D587 */ neg.s $f22, $f26
.L8023E084:
/* 16C964 8023E084 30620100 */ andi $v0, $v1, 0x100
/* 16C968 8023E088 54400001 */ bnel $v0, $zero, .L8023E090
/* 16C96C 8023E08C 4600D586 */ mov.s $f22, $f26
.L8023E090:
/* 16C970 8023E090 4406B000 */ mfc1 $a2, $f22
/* 16C974 8023E094 4480C000 */ mtc1 $zero, $f24
/* 16C978 8023E098 46000707 */ neg.s $f28, $f0
/* 16C97C 8023E09C 4407E000 */ mfc1 $a3, $f28
/* 16C980 8023E0A0 4600C306 */ mov.s $f12, $f24
/* 16C984 8023E0A4 0C00A7B5 */ jal dist2D
/* 16C988 8023E0A8 4600C386 */ mov.s $f14, $f24
/* 16C98C 8023E0AC 46000506 */ mov.s $f20, $f0
/* 16C990 8023E0B0 4614D03E */ c.le.s $f26, $f20
/* 16C994 8023E0B4 00000000 */ nop
/* 16C998 8023E0B8 45030001 */ bc1tl .L8023E0C0
/* 16C99C 8023E0BC 4600D506 */ mov.s $f20, $f26
.L8023E0C0:
/* 16C9A0 8023E0C0 4600C306 */ mov.s $f12, $f24
/* 16C9A4 8023E0C4 4406B000 */ mfc1 $a2, $f22
/* 16C9A8 8023E0C8 4407E000 */ mfc1 $a3, $f28
/* 16C9AC 8023E0CC 0C00A720 */ jal atan2
/* 16C9B0 8023E0D0 46006386 */ mov.s $f14, $f12
/* 16C9B4 8023E0D4 E6000000 */ swc1 $f0, ($s0)
/* 16C9B8 8023E0D8 E6340000 */ swc1 $f20, ($s1)
/* 16C9BC 8023E0DC 8FBF0018 */ lw $ra, 0x18($sp)
/* 16C9C0 8023E0E0 8FB10014 */ lw $s1, 0x14($sp)
/* 16C9C4 8023E0E4 8FB00010 */ lw $s0, 0x10($sp)
/* 16C9C8 8023E0E8 D7BC0040 */ ldc1 $f28, 0x40($sp)
/* 16C9CC 8023E0EC D7BA0038 */ ldc1 $f26, 0x38($sp)
/* 16C9D0 8023E0F0 D7B80030 */ ldc1 $f24, 0x30($sp)
/* 16C9D4 8023E0F4 D7B60028 */ ldc1 $f22, 0x28($sp)
/* 16C9D8 8023E0F8 D7B40020 */ ldc1 $f20, 0x20($sp)
/* 16C9DC 8023E0FC 03E00008 */ jr $ra
/* 16C9E0 8023E100 27BD0048 */ addiu $sp, $sp, 0x48

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel update_actor_shadows
/* 16CCE4 8023E404 3C02800E */ lui $v0, %hi(gBattleStatus)
/* 16CCE8 8023E408 8C42C070 */ lw $v0, %lo(gBattleStatus)($v0)
/* 16CCEC 8023E40C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 16CCF0 8023E410 30420001 */ andi $v0, $v0, 1
/* 16CCF4 8023E414 10400005 */ beqz $v0, .L8023E42C
/* 16CCF8 8023E418 AFBF0010 */ sw $ra, 0x10($sp)
/* 16CCFC 8023E41C 0C0957D7 */ jal update_enemy_shadows
/* 16CD00 8023E420 00000000 */ nop
/* 16CD04 8023E424 0C0957EB */ jal update_hero_shadows
/* 16CD08 8023E428 00000000 */ nop
.L8023E42C:
/* 16CD0C 8023E42C 8FBF0010 */ lw $ra, 0x10($sp)
/* 16CD10 8023E430 03E00008 */ jr $ra
/* 16CD14 8023E434 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -600,8 +600,8 @@ typedef struct BattleStatus {
/* 0x210 */ s32 currentButtonsDown;
/* 0x214 */ s32 currentButtonsPressed;
/* 0x218 */ s32 currentButtonsHeld;
/* 0x21C */ f32 stickX;
/* 0x220 */ f32 stickY;
/* 0x21C */ s32 stickX;
/* 0x220 */ s32 stickY;
/* 0x224 */ s32 inputBitmask;
/* 0x228 */ s32 dpadX; /* 0-360 */
/* 0x22C */ s32 dpadY; /* 0-60 */
@ -1281,7 +1281,9 @@ typedef struct Actor {
/* 0x1F8 */ s16 lastDamageTaken;
/* 0x1FA */ s16 hpChangeCounter;
/* 0x1FC */ s16 damageCounter;
/* 0x1FE */ char unk_1FE[9];
/* 0x1FE */ char unk_1FE[2];
/* 0x200 */ s32** unk_200; // Probably a struct but not sure what yet
/* 0x204 */ char unk_204[3];
/* 0x207 */ u8 extraCoinBonus;
/* 0x208 */ s8 unk_208;
/* 0x209 */ char unk_209[3];

View File

@ -1,6 +1,42 @@
#include "common.h"
INCLUDE_ASM(s32, "code_16c8e0", get_dpad_input_radial);
void get_dpad_input_radial(f32* angle, f32* magnitude) {
BattleStatus* battleStatus = &gBattleStatus;
u16 currentButtonsDown;
f32 stickX;
f32 stickY;
f32 mag;
f32 sixty = 60.0f;
stickX = battleStatus->stickX;
stickY = battleStatus->stickY;
currentButtonsDown = battleStatus->currentButtonsDown;
if (currentButtonsDown & 0xF00) {
stickY = 0.0f;
stickX = 0.0f;
if (currentButtonsDown & 0x800) {
stickY = sixty;
}
if (currentButtonsDown & 0x400) {
stickY = -sixty;
}
if (currentButtonsDown & 0x200) {
stickX = -sixty;
}
if (currentButtonsDown & 0x100) {
stickX = sixty;
}
}
mag = dist2D(0.0f, 0.0f, stickX, -stickY);
if (mag >= sixty) {
mag = sixty;
}
*angle = atan2(0.0f, 0.0f, stickX, -stickY);
*magnitude = mag;
}
INCLUDE_ASM(s32, "code_16c8e0", func_8023E104);
@ -11,7 +47,12 @@ INCLUDE_ASM(s32, "code_16c8e0", initialize_battle);
void func_8023E3FC(void) {
}
INCLUDE_ASM(s32, "code_16c8e0", update_actor_shadows);
void update_actor_shadows(void) {
if (gBattleStatus.flags1 & 1) {
update_enemy_shadows();
update_hero_shadows();
}
}
INCLUDE_ASM(s32, "code_16c8e0", update_battle_state);
@ -23,7 +64,9 @@ INCLUDE_ASM(s32, "code_16c8e0", func_8023F060);
INCLUDE_ASM(s32, "code_16c8e0", func_8023F088);
INCLUDE_ASM(s32, "code_16c8e0", func_8023FF84);
void func_8023FF84(void) {
show_foreground_models_unsafe();
}
INCLUDE_ASM(s32, "code_16c8e0", draw_enemy_health_bars);
@ -35,4 +78,40 @@ INCLUDE_ASM(s32, "code_16c8e0", func_80240AA8);
INCLUDE_ASM(s32, "code_16c8e0", delete_actor);
INCLUDE_ASM(s32, "code_16c8e0", delete_player_actor);
void delete_player_actor(Actor* player) {
s32 i;
struct ActorPart* partsTable;
struct ActorPartMovement* movement;
struct DecorationTable* decorationTable;
for (i = 0; i < 2; i++) {
remove_actor_decoration(player, i);
}
if (player->idleScript != NULL) {
kill_script_by_ID(player->idleScriptID);
}
if (player->onHitScript != NULL) {
kill_script_by_ID(player->onHitID);
}
if (player->takeTurnScript != NULL) {
kill_script_by_ID(player->takeTurnID);
}
partsTable = player->partsTable;
decorationTable = partsTable->decorationTable;
movement = partsTable->movement;
func_80112328(player->shadow);
func_800476F4(player->unk_436);
remove_effect(player->ptrDefuffIcon);
if (player->unk_200 != NULL) {
player->unk_200[3][9] = 0;
}
heap_free(movement);
heap_free(decorationTable);
heap_free(partsTable);
heap_free(player);
}