Status->Debuff

This commit is contained in:
Ethan Roseman 2020-11-26 15:34:10 -05:00
parent 0db14af7a9
commit 03349746a4
7 changed files with 71 additions and 146 deletions

View File

@ -1,37 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel ApplyShrinkFromOwner
/* 182A78 80254198 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 182A7C 8025419C AFB10014 */ sw $s1, 0x14($sp)
/* 182A80 802541A0 0080882D */ daddu $s1, $a0, $zero
/* 182A84 802541A4 AFBF001C */ sw $ra, 0x1c($sp)
/* 182A88 802541A8 AFB20018 */ sw $s2, 0x18($sp)
/* 182A8C 802541AC AFB00010 */ sw $s0, 0x10($sp)
/* 182A90 802541B0 8E240148 */ lw $a0, 0x148($s1)
/* 182A94 802541B4 0C09A75B */ jal get_actor
/* 182A98 802541B8 8E32000C */ lw $s2, 0xc($s1)
/* 182A9C 802541BC 0220202D */ daddu $a0, $s1, $zero
/* 182AA0 802541C0 8E450000 */ lw $a1, ($s2)
/* 182AA4 802541C4 0C0B1EAF */ jal get_variable
/* 182AA8 802541C8 0040802D */ daddu $s0, $v0, $zero
/* 182AAC 802541CC 0040302D */ daddu $a2, $v0, $zero
/* 182AB0 802541D0 82030210 */ lb $v1, 0x210($s0)
/* 182AB4 802541D4 2402000A */ addiu $v0, $zero, 0xa
/* 182AB8 802541D8 14620005 */ bne $v1, $v0, .L802541F0
/* 182ABC 802541DC 00000000 */ nop
/* 182AC0 802541E0 18C00003 */ blez $a2, .L802541F0
/* 182AC4 802541E4 000617C2 */ srl $v0, $a2, 0x1f
/* 182AC8 802541E8 00C21021 */ addu $v0, $a2, $v0
/* 182ACC 802541EC 00023043 */ sra $a2, $v0, 1
.L802541F0:
/* 182AD0 802541F0 8E450000 */ lw $a1, ($s2)
/* 182AD4 802541F4 0C0B2026 */ jal set_variable
/* 182AD8 802541F8 0220202D */ daddu $a0, $s1, $zero
/* 182ADC 802541FC 8FBF001C */ lw $ra, 0x1c($sp)
/* 182AE0 80254200 8FB20018 */ lw $s2, 0x18($sp)
/* 182AE4 80254204 8FB10014 */ lw $s1, 0x14($sp)
/* 182AE8 80254208 8FB00010 */ lw $s0, 0x10($sp)
/* 182AEC 8025420C 24020002 */ addiu $v0, $zero, 2
/* 182AF0 80254210 03E00008 */ jr $ra
/* 182AF4 80254214 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,37 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel is_actor_hp_bar_visible
/* 182500 80253C20 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 182504 80253C24 AFB00010 */ sw $s0, 0x10($sp)
/* 182508 80253C28 0080802D */ daddu $s0, $a0, $zero
/* 18250C 80253C2C AFBF0014 */ sw $ra, 0x14($sp)
/* 182510 80253C30 0C03A752 */ jal is_ability_active
/* 182514 80253C34 24040036 */ addiu $a0, $zero, 0x36
/* 182518 80253C38 14400014 */ bnez $v0, .L80253C8C
/* 18251C 80253C3C 24020001 */ addiu $v0, $zero, 1
/* 182520 80253C40 92040136 */ lbu $a0, 0x136($s0)
/* 182524 80253C44 000420C2 */ srl $a0, $a0, 3
/* 182528 80253C48 0C05154E */ jal get_global_byte
/* 18252C 80253C4C 2484016D */ addiu $a0, $a0, 0x16d
/* 182530 80253C50 8E030000 */ lw $v1, ($s0)
/* 182534 80253C54 30631000 */ andi $v1, $v1, 0x1000
/* 182538 80253C58 10600008 */ beqz $v1, .L80253C7C
/* 18253C 80253C5C 0040202D */ daddu $a0, $v0, $zero
/* 182540 80253C60 92020136 */ lbu $v0, 0x136($s0)
/* 182544 80253C64 3C03800E */ lui $v1, %hi(gBattleStatus)
/* 182548 80253C68 2463C070 */ addiu $v1, $v1, %lo(gBattleStatus)
/* 18254C 80253C6C 000210C2 */ srl $v0, $v0, 3
/* 182550 80253C70 00431021 */ addu $v0, $v0, $v1
/* 182554 80253C74 90420440 */ lbu $v0, 0x440($v0)
/* 182558 80253C78 00822025 */ or $a0, $a0, $v0
.L80253C7C:
/* 18255C 80253C7C 92020136 */ lbu $v0, 0x136($s0)
/* 182560 80253C80 30420007 */ andi $v0, $v0, 7
/* 182564 80253C84 00441007 */ srav $v0, $a0, $v0
/* 182568 80253C88 30420001 */ andi $v0, $v0, 1
.L80253C8C:
/* 18256C 80253C8C 8FBF0014 */ lw $ra, 0x14($sp)
/* 182570 80253C90 8FB00010 */ lw $s0, 0x10($sp)
/* 182574 80253C94 03E00008 */ jr $ra
/* 182578 80253C98 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,35 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel is_actortype_hpbar_visible
/* 18257C 80253C9C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 182580 80253CA0 AFB10014 */ sw $s1, 0x14($sp)
/* 182584 80253CA4 0080882D */ daddu $s1, $a0, $zero
/* 182588 80253CA8 24040036 */ addiu $a0, $zero, 0x36
/* 18258C 80253CAC AFBF0018 */ sw $ra, 0x18($sp)
/* 182590 80253CB0 0C03A752 */ jal is_ability_active
/* 182594 80253CB4 AFB00010 */ sw $s0, 0x10($sp)
/* 182598 80253CB8 14400010 */ bnez $v0, .L80253CFC
/* 18259C 80253CBC 24020001 */ addiu $v0, $zero, 1
/* 1825A0 80253CC0 06210002 */ bgez $s1, .L80253CCC
/* 1825A4 80253CC4 0220802D */ daddu $s0, $s1, $zero
/* 1825A8 80253CC8 26300007 */ addiu $s0, $s1, 7
.L80253CCC:
/* 1825AC 80253CCC 001080C3 */ sra $s0, $s0, 3
/* 1825B0 80253CD0 0C05154E */ jal get_global_byte
/* 1825B4 80253CD4 2604016D */ addiu $a0, $s0, 0x16d
/* 1825B8 80253CD8 3C03800E */ lui $v1, %hi(gBattleStatus)
/* 1825BC 80253CDC 2463C070 */ addiu $v1, $v1, %lo(gBattleStatus)
/* 1825C0 80253CE0 02031821 */ addu $v1, $s0, $v1
/* 1825C4 80253CE4 90630440 */ lbu $v1, 0x440($v1)
/* 1825C8 80253CE8 001080C0 */ sll $s0, $s0, 3
/* 1825CC 80253CEC 02308023 */ subu $s0, $s1, $s0
/* 1825D0 80253CF0 00431025 */ or $v0, $v0, $v1
/* 1825D4 80253CF4 02021007 */ srav $v0, $v0, $s0
/* 1825D8 80253CF8 30420001 */ andi $v0, $v0, 1
.L80253CFC:
/* 1825DC 80253CFC 8FBF0018 */ lw $ra, 0x18($sp)
/* 1825E0 80253D00 8FB10014 */ lw $s1, 0x14($sp)
/* 1825E4 80253D04 8FB00010 */ lw $s0, 0x10($sp)
/* 1825E8 80253D08 03E00008 */ jr $ra
/* 1825EC 80253D0C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1300,7 +1300,7 @@ typedef struct Actor {
/* 0x208 */ s8 unk_208;
/* 0x209 */ char unk_209[3];
/* 0x20C */ u32* statusTable;
/* 0x210 */ u8 debuff;
/* 0x210 */ Debuff debuff;
/* 0x211 */ s8 debuffDuration;
/* 0x212 */ s8 staticStatus; /* 0B = yes */
/* 0x213 */ s8 staticDuration;

View File

@ -887,37 +887,37 @@ typedef UNK_TYPE HitSound;
#define HitSound_ICE 0x00000004
#define HitSound_SHOCK 0x00000005
typedef UNK_TYPE Status;
#define Status_NORMAL 0x00000001
#define Status_DEFAULT 0x00000002
#define Status_DEFAULT_TURN_MOD 0x0000001F
#define Status_SLEEP 0x00000006
#define Status_SLEEP_TURN_MOD 0x00000020
#define Status_POISON 0x00000009
#define Status_POISON_TURN_MOD 0x00000025
#define Status_FROZEN 0x00000007
#define Status_FROZEN_TURN_MOD 0x00000022
#define Status_DIZZY 0x00000004
#define Status_DIZZY_TURN_MOD 0x00000024
#define Status_FEAR 0x00000003
#define Status_FEAR_TURN_MOD 0x00000023
#define Status_STATIC 0x0000000B
#define Status_STATIC_TURN_MOD 0x00000021
#define Status_PARALYZE 0x00000005
#define Status_PARALYZE_TURN_MOD 0x00000026
#define Status_SHRINK 0x0000000A
#define Status_SHRINK_TURN_MOD 0x00000027
#define Status_STOP 0x00000008
#define Status_STOP_TURN_MOD 0x00000029
#define Status_STONE 0x0000000C
#define Status_DAZE 0x0000000D
#define Status_END 0x00000000
#define Status_BERSERK 0x00000010
#define Status_TURN_DONE 0x00000012
#define Status_HUSTLE 0x00000019
#define Status_DANGER 0x0000001A
#define Status_THINKING 0x0000001C
#define Status_WEARY 0x0000001D
typedef s8 Debuff;
#define Debuff_NORMAL 0x00000001
#define Debuff_DEFAULT 0x00000002
#define Debuff_DEFAULT_TURN_MOD 0x0000001F
#define Debuff_SLEEP 0x00000006
#define Debuff_SLEEP_TURN_MOD 0x00000020
#define Debuff_POISON 0x00000009
#define Debuff_POISON_TURN_MOD 0x00000025
#define Debuff_FROZEN 0x00000007
#define Debuff_FROZEN_TURN_MOD 0x00000022
#define Debuff_DIZZY 0x00000004
#define Debuff_DIZZY_TURN_MOD 0x00000024
#define Debuff_FEAR 0x00000003
#define Debuff_FEAR_TURN_MOD 0x00000023
#define Debuff_STATIC 0x0000000B
#define Debuff_STATIC_TURN_MOD 0x00000021
#define Debuff_PARALYZE 0x00000005
#define Debuff_PARALYZE_TURN_MOD 0x00000026
#define Debuff_SHRINK 0x0000000A
#define Debuff_SHRINK_TURN_MOD 0x00000027
#define Debuff_STOP 0x00000008
#define Debuff_STOP_TURN_MOD 0x00000029
#define Debuff_STONE 0x0000000C
#define Debuff_DAZE 0x0000000D
#define Debuff_END 0x00000000
#define Debuff_BERSERK 0x00000010
#define Debuff_TURN_DONE 0x00000012
#define Debuff_HUSTLE 0x00000019
#define Debuff_DANGER 0x0000001A
#define Debuff_THINKING 0x0000001C
#define Debuff_WEARY 0x0000001D
typedef UNK_TYPE DoorSwing;
#define DoorSwing_IN 0x00000001

View File

@ -190,9 +190,32 @@ ApiStatus func_80253B30(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "code_181810", MakeStatusField);
INCLUDE_ASM(s32, "code_181810", is_actor_hp_bar_visible);
s32 is_actor_hp_bar_visible(Actor* actor) {
BattleStatus* battleStatus = BATTLE_STATUS;
s32 flags;
INCLUDE_ASM(s32, "code_181810", is_actortype_hpbar_visible);
if (is_ability_active(Ability_PEEKABOO)) {
return TRUE;
}
flags = get_global_byte((actor->actorType >> 3) + 365);
if (actor->flags & 0x1000) {
flags |= battleStatus->tattleFlags[actor->actorType >> 3];
}
return (flags >> (actor->actorType & 7)) & 1;
}
s32 is_actortype_hpbar_visible(s32 actorType) {
BattleStatus* battleStatus = BATTLE_STATUS;
s32 idx;
if (is_ability_active(Ability_PEEKABOO)) {
return TRUE;
}
idx = actorType / 8;
return ((get_global_byte(idx + 365) | battleStatus->tattleFlags[idx]) >> (actorType - (idx * 8))) & 1;
}
INCLUDE_ASM(s32, "code_181810", save_tattle_flags);
@ -217,7 +240,18 @@ INCLUDE_ASM(s32, "code_181810", MultiplyVec2ByActorScale);
INCLUDE_ASM(s32, "code_181810", MultiplyVec3ByActorScale);
INCLUDE_ASM(s32, "code_181810", ApplyShrinkFromOwner);
ApiStatus ApplyShrinkFromOwner(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Actor* actor = get_actor(script->owner1.actorID);
s32 amt = get_variable(script, *args);
if (actor->debuff == Debuff_SHRINK && amt > 0) {
amt /= 2;
}
set_variable(script, *args, amt);
return ApiStatus_DONE2;
}
ApiStatus StartRumble(ScriptInstance* script, s32 isInitialCall) {
start_rumble_type(get_variable(script, *script->ptrReadPos));

View File

@ -124,9 +124,9 @@ INCLUDE_ASM(s32, "code_190B20", lookup_status_duration_mod); // exactly (?) the
INCLUDE_ASM(s32, "code_190B20", inflict_status);
s32 inflict_partner_ko(Actor* target, s32 statusTypeKey, s32 duration) {
if (statusTypeKey == Status_DAZE) {
if (statusTypeKey == Debuff_DAZE) {
if (statusTypeKey != target->koStatus) {
inflict_status(target, Status_DAZE);
inflict_status(target, Debuff_DAZE);
play_sound(0x2107);
} else {
target->koDuration += duration;