match create_part_shadow and heroes_is_ability_active

This commit is contained in:
Alex Bates 2020-10-16 17:23:13 +01:00
parent 369cb32bbc
commit ddbb46112d
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
6 changed files with 57 additions and 78 deletions

View File

@ -1,37 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel create_part_shadow
/* 195BFC 8026731C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 195C00 80267320 AFB00010 */ sw $s0, 0x10($sp)
/* 195C04 80267324 AFBF0014 */ sw $ra, 0x14($sp)
/* 195C08 80267328 0C09A75B */ jal get_actor
/* 195C0C 8026732C 00A0802D */ daddu $s0, $a1, $zero
/* 195C10 80267330 0040202D */ daddu $a0, $v0, $zero
/* 195C14 80267334 0C099117 */ jal get_actor_part
/* 195C18 80267338 0200282D */ daddu $a1, $s0, $zero
/* 195C1C 8026733C 0000202D */ daddu $a0, $zero, $zero
/* 195C20 80267340 0040802D */ daddu $s0, $v0, $zero
/* 195C24 80267344 2403FFFB */ addiu $v1, $zero, -5
/* 195C28 80267348 8E050058 */ lw $a1, 0x58($s0)
/* 195C2C 8026734C 8E020000 */ lw $v0, ($s0)
/* 195C30 80267350 8E06005C */ lw $a2, 0x5c($s0)
/* 195C34 80267354 8E070060 */ lw $a3, 0x60($s0)
/* 195C38 80267358 00431024 */ and $v0, $v0, $v1
/* 195C3C 8026735C 0C044898 */ jal create_shadow_type
/* 195C40 80267360 AE020000 */ sw $v0, ($s0)
/* 195C44 80267364 AE02009C */ sw $v0, 0x9c($s0)
/* 195C48 80267368 92020072 */ lbu $v0, 0x72($s0)
/* 195C4C 8026736C 3C014038 */ lui $at, 0x4038
/* 195C50 80267370 44811800 */ mtc1 $at, $f3
/* 195C54 80267374 44801000 */ mtc1 $zero, $f2
/* 195C58 80267378 44820000 */ mtc1 $v0, $f0
/* 195C5C 8026737C 00000000 */ nop
/* 195C60 80267380 46800021 */ cvt.d.w $f0, $f0
/* 195C64 80267384 46220003 */ div.d $f0, $f0, $f2
/* 195C68 80267388 46200020 */ cvt.s.d $f0, $f0
/* 195C6C 8026738C E60000A0 */ swc1 $f0, 0xa0($s0)
/* 195C70 80267390 8FBF0014 */ lw $ra, 0x14($sp)
/* 195C74 80267394 8FB00010 */ lw $s0, 0x10($sp)
/* 195C78 80267398 03E00008 */ jr $ra
/* 195C7C 8026739C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,34 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel heroes_is_ability_active
/* 195B8C 802672AC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 195B90 802672B0 AFBF0010 */ sw $ra, 0x10($sp)
/* 195B94 802672B4 94820192 */ lhu $v0, 0x192($a0)
/* 195B98 802672B8 30430700 */ andi $v1, $v0, 0x700
/* 195B9C 802672BC 24020100 */ addiu $v0, $zero, 0x100
/* 195BA0 802672C0 1062000F */ beq $v1, $v0, .L80267300
/* 195BA4 802672C4 0000202D */ daddu $a0, $zero, $zero
/* 195BA8 802672C8 28620101 */ slti $v0, $v1, 0x101
/* 195BAC 802672CC 1040000F */ beqz $v0, .L8026730C
/* 195BB0 802672D0 00000000 */ nop
/* 195BB4 802672D4 1460000D */ bnez $v1, .L8026730C
/* 195BB8 802672D8 00000000 */ nop
/* 195BBC 802672DC 3C02800E */ lui $v0, 0x800e
/* 195BC0 802672E0 8C42C074 */ lw $v0, -0x3f8c($v0)
/* 195BC4 802672E4 30420040 */ andi $v0, $v0, 0x40
/* 195BC8 802672E8 14400008 */ bnez $v0, .L8026730C
/* 195BCC 802672EC 00000000 */ nop
/* 195BD0 802672F0 0C03A752 */ jal is_ability_active
/* 195BD4 802672F4 00A0202D */ daddu $a0, $a1, $zero
/* 195BD8 802672F8 08099CC3 */ j .L8026730C
/* 195BDC 802672FC 0040202D */ daddu $a0, $v0, $zero
.L80267300:
/* 195BE0 80267300 0C03A82E */ jal is_partner_ability_active
/* 195BE4 80267304 00A0202D */ daddu $a0, $a1, $zero
/* 195BE8 80267308 0040202D */ daddu $a0, $v0, $zero
.L8026730C:
/* 195BEC 8026730C 8FBF0010 */ lw $ra, 0x10($sp)
/* 195BF0 80267310 0080102D */ daddu $v0, $a0, $zero
/* 195BF4 80267314 03E00008 */ jr $ra
/* 195BF8 80267318 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,6 +1,4 @@
#include "common.h"
ActorPart* get_actor_part(Actor* actor, s32 partIndex);
#include "code_190B20.h"
INCLUDE_ASM(s32, "code_190B20", create_target_list);
@ -150,9 +148,31 @@ void remove_part_decoration(ActorPart* part, s32 decorationIndex) {
INCLUDE_ASM(s32, "code_190B20", remove_actor_decoration);
INCLUDE_ASM(s32, "code_190B20", heroes_is_ability_active);
s32 heroes_is_ability_active(Actor* actor, Ability ability) {
s32 actorGenus = actor->actorID & 0x700;
s32 hasAbility = FALSE;
INCLUDE_ASM(s32, "code_190B20", create_part_shadow);
if (actorGenus != 0x100) {
// Separate ifs required to match
if (actorGenus <= 0x100) {
if (actorGenus == 0 && (gBattleStatus.flags2 & 0x40) == 0) {
hasAbility = is_ability_active(ability);
}
}
} else {
hasAbility = is_partner_ability_active(ability);
}
return hasAbility;
}
void create_part_shadow(s32 actorId, s32 partIndex) {
ActorPart* part = get_actor_part(get_actor(actorId), partIndex);
part->flags &= ~4;
part->shadow = create_shadow_type(0, part->currentPos.x, part->currentPos.y, part->currentPos.z);
part->shadowScale = part->size[0] / 24.0;
}
void remove_part_shadow(s32 actorId, s32 partIndex) {
ActorPart* part = get_actor_part(get_actor(actorId), partIndex);

22
src/code_190B20.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef _CODE_190B20_H_
#define _CODE_190B20_H_
#include "common.h"
#include "code_a5dd0_len_114e0.h"
void player_create_target_list(Actor* actor);
void enemy_create_target_list(Actor* actor);
void set_actor_yaw(s32 actorId, s32 yaw);
void set_part_yaw(s32 actorID, s32 partIndex, s32 value);
ActorPart* get_actor_part(Actor* actor, s32 partIndex);
void remove_part_decoration(ActorPart* part, s32 decorationIndex);
s32 heroes_is_ability_active(Actor* actor, Ability ability);
void create_part_shadow(s32 actorId, s32 partIndex);
void remove_part_shadow(s32 actorId, s32 partIndex);
#endif

View File

@ -1,4 +1,4 @@
#include "common.h"
#include "code_a5dd0_len_114e0.h"
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", update_entities);
@ -135,7 +135,7 @@ INCLUDE_ASM(s32, "code_a5dd0_len_114e0", AssignCrateFlag, ScriptInstance* script
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", create_entity_shadow);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", create_shadow_type);
INCLUDE_ASM(Shadow*, "code_a5dd0_len_114e0", create_shadow_type, s32 type, f32 x, f32 y, f32 z);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_80112328);

View File

@ -0,0 +1,8 @@
#ifndef _CODE_A5DD0_LEN_114E0_H_
#define _CODE_A5DD0_LEN_114E0_H_
#include "common.h"
Shadow* create_shadow_type(s32 type, f32 x, f32 y, f32 z);
#endif