more decomp

This commit is contained in:
Seth Barberee 2022-11-11 16:49:48 -08:00
parent e9f8c788da
commit 4c760a92cb
21 changed files with 769 additions and 1457 deletions

View File

@ -834,203 +834,4 @@ _0804498C: .4byte gDungeonGlobalData
_08044990: .4byte 0x0001358c
thumb_func_end sub_8044820
thumb_func_start sub_8044994
sub_8044994:
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r1, _08044A94
ldr r4, _08044A98
ldr r0, [r4]
movs r2, 0xCC
lsls r2, 3
adds r0, r2
movs r3, 0
ldrsh r0, [r0, r3]
lsls r0, 1
adds r1, 0x32
adds r0, r1
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
beq _08044A8A
bl sub_8071B48
ldr r0, [r4]
ldr r2, _08044A9C
adds r0, r2
movs r2, 0
strb r2, [r0]
ldr r0, [r4]
ldr r3, _08044AA0
adds r0, r3
strb r2, [r0]
ldr r0, [r4]
ldr r1, _08044AA4
adds r0, r1
strb r2, [r0]
ldr r0, [r4]
adds r3, 0x2
adds r0, r3
strb r2, [r0]
ldr r0, [r4]
ldr r3, _08044AA8
adds r1, r0, r3
str r2, [r1]
ldr r1, _08044AAC
adds r0, r1
movs r1, 0x2
str r1, [r0]
mov r8, r2
adds r7, r4, 0
_080449F2:
ldr r0, [r7]
mov r2, r8
lsls r1, r2, 2
ldr r3, _08044AB0
adds r0, r3
adds r0, r1
ldr r5, [r0]
adds r0, r5, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _08044A7A
ldr r0, [r5, 0x70]
adds r4, r0, 0
movs r0, 0xA4
lsls r0, 1
adds r1, r4, r0
movs r0, 0
strb r0, [r1]
ldrb r0, [r4, 0x6]
movs r6, 0x1
cmp r0, 0
beq _08044A24
movs r6, 0
_08044A24:
adds r0, r5, 0
movs r1, 0x32
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _08044A46
ldr r1, [r7]
ldr r2, _08044AA8
adds r0, r1, r2
str r5, [r0]
ldr r3, _08044AAC
adds r1, r3
adds r0, r4, 0
adds r0, 0x98
ldr r0, [r0]
str r0, [r1]
_08044A46:
adds r0, r5, 0
movs r1, 0x3F
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _08044A60
ldr r0, [r7]
ldr r1, _08044AA4
adds r0, r1
adds r0, r6
movs r1, 0x1
strb r1, [r0]
_08044A60:
adds r0, r5, 0
movs r1, 0x38
bl HasAbility
lsls r0, 24
cmp r0, 0
beq _08044A7A
ldr r0, [r7]
ldr r2, _08044A9C
adds r0, r2
adds r0, r6
movs r1, 0x1
strb r1, [r0]
_08044A7A:
movs r3, 0x1
add r8, r3
mov r0, r8
cmp r0, 0x13
ble _080449F2
movs r0, 0
bl sub_8043ED0
_08044A8A:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08044A94: .4byte gSpeedTurns
_08044A98: .4byte gDungeonGlobalData
_08044A9C: .4byte 0x000037f8
_08044AA0: .4byte 0x000037f9
_08044AA4: .4byte 0x000037fa
_08044AA8: .4byte 0x00017b2c
_08044AAC: .4byte 0x00017b38
_08044AB0: .4byte 0x000135cc
thumb_func_end sub_8044994
thumb_func_start sub_8044AB4
sub_8044AB4:
push {r4,lr}
ldr r1, _08044ADC
ldr r0, _08044AE0
ldr r0, [r0]
movs r2, 0xCC
lsls r2, 3
adds r0, r2
movs r2, 0
ldrsh r0, [r0, r2]
adds r0, 0x1
lsls r0, 1
adds r1, 0x32
adds r0, r1
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
beq _08044B1A
movs r4, 0
b _08044AE6
.align 2, 0
_08044ADC: .4byte gSpeedTurns
_08044AE0: .4byte gDungeonGlobalData
_08044AE4:
adds r4, 0x1
_08044AE6:
cmp r4, 0x13
bgt _08044B08
ldr r0, _08044B20
ldr r0, [r0]
lsls r1, r4, 2
ldr r2, _08044B24
adds r0, r2
adds r0, r1
ldr r0, [r0]
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _08044AE4
movs r0, 0
bl UseAttack
_08044B08:
movs r0, 0x1
movs r1, 0
bl sub_807EAA0
bl sub_8086AC0
movs r0, 0
bl sub_8043ED0
_08044B1A:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08044B20: .4byte gDungeonGlobalData
_08044B24: .4byte 0x000135cc
thumb_func_end sub_8044AB4
.align 2, 0

View File

@ -3832,7 +3832,7 @@ _0805459E:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_8057E1C
bl FocusEnergyMoveAction
bl _080554BA
_080545AE:
movs r3, 0x80
@ -5278,7 +5278,7 @@ _080551C8:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805B208
bl PerishSongMoveAction
b _080554BA
_080551D6:
adds r0, r7, 0

View File

@ -73,14 +73,14 @@ _08057E0C:
_08057E18: .4byte gUnknown_80FD370
thumb_func_end sub_8057D9C
thumb_func_start sub_8057E1C
sub_8057E1C:
thumb_func_start FocusEnergyMoveAction
FocusEnergyMoveAction:
push {lr}
bl sub_8078348
bl FocusEnergyStatusTarget
movs r0, 0x1
pop {r1}
bx r1
thumb_func_end sub_8057E1C
thumb_func_end FocusEnergyMoveAction
thumb_func_start sub_8057E28
sub_8057E28:
@ -94,7 +94,7 @@ sub_8057E28:
adds r2, r0, 0
adds r0, r5, 0
adds r1, r4, 0
bl sub_807824C
bl WhifferStatusTarget
movs r0, 0x1
pop {r4,r5}
pop {r1}
@ -1731,7 +1731,7 @@ sub_8058A54:
adds r2, r0, 0
adds r0, r5, 0
adds r1, r4, 0
bl sub_80781DC
bl SureShotStatusTarget
movs r0, 0x1
pop {r4,r5}
pop {r1}
@ -3908,7 +3908,7 @@ sub_8059AA8:
thumb_func_start sub_8059AB8
sub_8059AB8:
push {lr}
bl sub_8078758
bl TauntStatusTarget
movs r0, 0x1
pop {r1}
bx r1
@ -5338,7 +5338,7 @@ _0805A558: .4byte gUnknown_80FC770
thumb_func_start sub_805A55C
sub_805A55C:
push {lr}
bl sub_8078594
bl CurseStatusTarget
movs r0, 0x1
pop {r1}
bx r1
@ -6029,7 +6029,7 @@ _0805AACC: .4byte 0x00003a08
sub_805AAD0:
push {lr}
adds r1, r0, 0
bl sub_80782CC
bl FixedDamageStatusTarget
movs r0, 0x1
pop {r1}
bx r1
@ -6664,76 +6664,4 @@ _0805AF9C:
bx r1
thumb_func_end sub_805AF30
thumb_func_start sub_805AFA4
sub_805AFA4:
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
adds r4, r0, 0
adds r5, r1, 0
mov r8, r2
adds r6, r3, 0
bl SendThawedMessage
ldr r3, [r4, 0x70]
movs r0, 0x10
ldrsh r2, [r3, r0]
adds r0, r2, 0
cmp r2, 0
bge _0805AFC6
adds r0, r2, 0x3
_0805AFC6:
movs r7, 0xE
ldrsh r1, [r3, r7]
asrs r0, 2
cmp r1, r0
bgt _0805AFD4
movs r2, 0
b _0805AFFA
_0805AFD4:
movs r0, 0xE
ldrsh r1, [r3, r0]
lsrs r0, r2, 31
adds r0, r2, r0
asrs r0, 1
cmp r1, r0
bgt _0805AFE6
movs r2, 0x1
b _0805AFFA
_0805AFE6:
lsls r0, r2, 1
adds r0, r2
cmp r0, 0
bge _0805AFF0
adds r0, 0x3
_0805AFF0:
asrs r0, 2
movs r2, 0x3
cmp r1, r0
bgt _0805AFFA
movs r2, 0x2
_0805AFFA:
ldr r1, _0805B024
lsls r0, r2, 2
adds r0, r1
ldr r3, [r0]
str r6, [sp]
adds r0, r4, 0
adds r1, r5, 0
mov r2, r8
bl sub_8055640
adds r1, r0, 0
negs r0, r1
orrs r0, r1
lsrs r0, 31
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_0805B024: .4byte gUnknown_80F51C4
thumb_func_end sub_805AFA4
.align 2, 0

View File

@ -1777,8 +1777,8 @@ _08076B3A:
_08076B44: .4byte gUnknown_80FB6C0
thumb_func_end sub_8076AA4
thumb_func_start sub_8076B48
sub_8076B48:
thumb_func_start WrapTarget
WrapTarget:
push {r4-r7,lr}
mov r7, r8
push {r7}
@ -1946,7 +1946,7 @@ _08076C9E:
_08076CA8: .4byte gAvailablePokemonNames
_08076CAC: .4byte gUnknown_80FB6FC
_08076CB0: .4byte gUnknown_80FB718
thumb_func_end sub_8076B48
thumb_func_end WrapTarget
thumb_func_start sub_8076CB4
sub_8076CB4:

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_803A3BC
sub_803A3BC:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x84
movs r5, 0x1
add r4, sp, 0x60
add r6, sp, 0x68
add r0, sp, 0x7C
mov r8, r0
add r0, sp, 0x80
mov r10, r0
_0803A3D6:
lsls r0, r5, 24
lsrs r0, 24
bl UnlockFriendArea
adds r5, 0x1
cmp r5, 0x39
ble _0803A3D6
movs r5, 0
adds r7, r4, 0
_0803A3E8:
movs r0, 0
mov r9, r0
ldr r0, _0803A454
str r0, [sp, 0x7C]
adds r5, 0x1
lsls r4, r5, 16
asrs r4, 16
adds r0, r7, 0
movs r1, 0
movs r2, 0x8
bl memset
movs r0, 0x27
strh r0, [r7]
adds r0, r6, 0
adds r1, r4, 0
bl CopySpeciesNametoBuffer
adds r0, r6, 0
adds r1, r6, 0
bl CopyStringtoBuffer
movs r0, 0x40
strb r0, [r6]
mov r0, r8
str r0, [sp]
str r7, [sp, 0x4]
add r0, sp, 0x8
adds r1, r4, 0
adds r2, r6, 0
movs r3, 0x43
bl sub_808CFD0
add r0, sp, 0x8
bl sub_808D1DC
ldr r0, _0803A458
cmp r5, r0
ble _0803A3E8
mov r0, r9
str r0, [sp, 0x80]
mov r0, r10
movs r1, 0x1
bl WriteSavetoPak
add sp, 0x84
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0803A454: .4byte 0x00001006
_0803A458: .4byte 0x0000012b
thumb_func_end sub_803A3BC
.align 2,0

View File

@ -32,6 +32,10 @@ struct DungeonActionContainer
// Position of the Pokémon the last time it threw an item.
/* 0x8 */ struct Position lastItemThrowPosition;
u8 unkC;
u8 fillD[3];
u8 fill10[4];
// Position of the target that the Pokémon wants throw an item at.
/* 0x14 */ struct Position itemTargetPosition;
};
struct DungeonEntityData
@ -79,9 +83,6 @@ struct DungeonEntityData
u8 fill3F;
/* 0x40 */ u8 joinLocation; // Uses the dungeon index in dungeon.h.
/* 0x44 */ struct DungeonActionContainer action;
u8 fill55[0x58 - 0x55];
// Position of the target that the Pokémon wants throw an item at.
/* 0x58 */ struct Position itemTargetPosition;
/* 0x5C */ u8 types[2];
/* 0x5E */ u8 abilities[2];
/* 0x60 */ struct ItemSlot heldItem;

View File

@ -72,7 +72,9 @@ struct DungeonGlobalData
/* 0x68A */ u8 unk68A;
u8 fill68B[0x363C - 0x68B];
/* 0x363C */ u8 expYieldRankings[NUM_SPECIES];
u8 fill37E3[0x37FC - 0x37D9];
u8 fill37E3[0x37F8 - 0x37D9];
/* 0x37F8 */ bool8 hasPlus[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FA */ bool8 hasMinus[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FC */ bool8 decoyActive;
u8 fill37FD[0x3A0D - 0x37FD];
/* 0x3A0D */ u8 unk3A0D;
@ -117,10 +119,12 @@ struct DungeonGlobalData
/* 0x1358C */ struct DungeonEntity *wildPokemon[DUNGEON_MAX_WILD_POKEMON];
/* 0x135CC */ struct DungeonEntity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon
/* 0x1361C */ struct DungeonEntity *clientPokemon[2]; // Not sure how large this array is.
u8 fill13624[0x17B30 - 0x13624];
/* 0x17B30 */ u32 unk17B30;
/* 0x17B34 */ u8 fillunk1734[0x17B3C - 0x17B34];
/* 0x17B30 */ u32 unk17B3C;
u8 fill13624[0x17B2C - 0x13624];
/* 0x17B2C */ struct DungeonEntity *lightningRodPokemon;
/* 0x17B30 */ struct DungeonEntity *snatchPokemon;
/* 0x17B34 */ u8 fillunk1734[0x17B38 - 0x17B34];
/* 0x17B38 */ u32 unk17B38;
/* 0x17B3C */ u32 unk17B3C;
u8 fill17B40[0x181E8 - 0x17B40];
/* 0x181E8 */ struct Position posScreenWorld;
/* 0x181EC */ struct Position prevPosScreenWorld;

View File

@ -77,6 +77,7 @@ void sub_8011C40(s32 in);
char *sub_8011C4C(void);
void sub_8011CA8(u32 *out, s32 size);
u32 ReadSaveFromPak(u32 *a);
u32 WriteSavetoPak(s32 *param_1, u32 param_2);
u32 sub_8011F9C(s32 *r0, u8 *dest, s32 size);
u32 sub_8011FA8(void);
bool8 IsSaveCorrupted(void);

View File

@ -175,7 +175,6 @@ SECTIONS {
src/wonder_mail_main_menu.o(.text);
src/ds_menus.o(.text);
src/debug_menu.o(.text);
asm/debug_menu.o(.text);
src/debug_menu_mid.o(.text);
asm/debug_menu_1.o(.text);
src/debug_menu_2.o(.text);

View File

@ -201,27 +201,27 @@ void sub_80485B0(struct DungeonEntity *pokemon, struct DungeonEntity * target)
{
bool8 isMoveBoosted;
s32 moveIndex;
struct DungeonEntityData *iVar5;
struct DungeonEntityData *entityData;
register struct PokemonMove *movePtr1 asm("r4"); // r4
register struct PokemonMove *movePtr2 asm("r5"); // r5
u8 cVar8;
u8 moveBoost;
s32 movePowerBoost;
s32 maxPowerBoost;
isMoveBoosted = FALSE;
cVar8 = 1;
iVar5 = target->entityData;
moveBoost = 1;
entityData = target->entityData;
if (DungeonRandomCapped(100) < gUnknown_80F4F46)
cVar8 = 3;
if (iVar5->isLeader) {
for(moveIndex = 0, movePtr1 = &iVar5->moves[0], movePtr2 = movePtr1; moveIndex < MAX_MON_MOVES; movePtr1++, movePtr2++, moveIndex++)
moveBoost = 3;
if (entityData->isLeader) {
for(moveIndex = 0, movePtr1 = &entityData->moves[0], movePtr2 = movePtr1; moveIndex < MAX_MON_MOVES; movePtr1++, movePtr2++, moveIndex++)
{
if((movePtr1->moveFlags & MOVE_FLAG_EXISTS) && (movePtr1->moveFlags & MOVE_FLAG_SET))
{
if(GetMovePower(movePtr2) == 0) continue;
movePowerBoost = movePtr1->powerBoost;
maxPowerBoost = GetMoveMaxPowerBoost(movePtr2);
movePtr1->powerBoost += cVar8;
movePtr1->powerBoost += moveBoost;
if(movePtr1->powerBoost >= maxPowerBoost)
movePtr1->powerBoost = maxPowerBoost;
if(movePowerBoost != movePtr1->powerBoost)
@ -231,7 +231,7 @@ void sub_80485B0(struct DungeonEntity *pokemon, struct DungeonEntity * target)
if (isMoveBoosted) {
sub_80522F4(pokemon,target,*gUnknown_80FE454);
if (cVar8 != 1) {
if (moveBoost != 1) {
sub_803E708(10,0x40);
sub_80522F4(pokemon,target,*gUnknown_80FE434);
}
@ -251,7 +251,7 @@ void sub_804869C(struct DungeonEntity *pokemon, struct DungeonEntity * target, u
struct DungeonEntity *entity;
u8 auStack28 [4];
if (param_3 != '\0') {
if (param_3 != 0) {
entityData = target->entityData;
entityData_1 = entityData;
if (gDungeonGlobalData->unk675 != 0) {

View File

@ -1410,7 +1410,7 @@ void SendWaitingEndMessage(struct DungeonEntity * pokemon, struct DungeonEntity
if (waitingStatus != WAITING_STATUS_SNATCH) {
SendMessage(target,*gUnknown_80FA7DC);
}
gDungeonGlobalData->unk17B30 = 0;
gDungeonGlobalData->snatchPokemon = NULL;
gDungeonGlobalData->unk17B3C = 0;
break;
case WAITING_STATUS_DECOY:

View File

@ -1,9 +1,14 @@
#include "global.h"
#include "constants/friend_area.h"
#include "debug_menu.h"
#include "friend_area.h"
#include "input.h"
#include "main_menu.h"
#include "menu.h"
#include "memory.h"
#include "pokemon.h"
#include "save.h"
#include "text_util.h"
extern struct DebugMenu *gUnknown_203B3EC;
@ -58,6 +63,8 @@ extern void sub_803A3A0(void);
extern void SetMenuItems(void *menu, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *entries, u32, u32, u32);
extern void sub_8035CF4(struct DebugMenu *, u32, u32);
extern void sub_8035CC0(struct UnkTextStruct2 *, u32);
extern void sub_808D1DC(u8 *);
extern void sub_808CFD0(u8 *, s32, u8 *, u32, u32 *, u16 *);
void CreateDebugMenu(void)
{
@ -148,3 +155,44 @@ void sub_803A3A0(void)
{
sub_8035CC0(gUnknown_203B3EC->unk140, 0);
}
void sub_803A3BC(void)
{
s32 speciesIndex;
u8 sp_0x8 [88];
u16 r7 [4]; // r7
u8 buffer [20]; // r6
u32 sp_0x7C;
s32 sp_0x80;
#ifndef NONMATCHING
register s32 index asm("r5");
register u32 r9 asm("r9");
#else
s32 index;
u32 r9;
#endif
index = 1;
do {
UnlockFriendArea(index);
index++;
} while (index < NUM_FRIEND_AREAS);
index = 0;
do {
r9 = 0;
sp_0x7C = 0x1006;
index = index + 1;
speciesIndex = index * 0x10000 >> 0x10; // dumb way to force s16
memset(r7,0,8);
r7[0] = 0x27;
CopySpeciesNametoBuffer(buffer, speciesIndex);
CopyStringtoBuffer(buffer, buffer);
buffer[0] = 0x40;
sub_808CFD0(sp_0x8,speciesIndex,buffer,0x43,&sp_0x7C,r7);
sub_808D1DC(sp_0x8);
} while (index < 300);
sp_0x80 = r9;
WriteSavetoPak(&sp_0x80,1);
}

View File

@ -161,7 +161,7 @@ void sub_803A504(u32 newState)
void sub_803A51C(void)
{
s32 iVar4;
s32 index;
sub_8006518(gUnknown_203B3F0->unkD8);
switch(gUnknown_203B3F0->state)
@ -173,9 +173,9 @@ void sub_803A51C(void)
gUnknown_203B3F0->unkD8[2] = gUnknown_80E7E4C;
break;
default:
for(iVar4 = 0; iVar4 < 4; iVar4++)
for(index = 0; index < 4; index++)
{
gUnknown_203B3F0->unkD8[iVar4] = gUnknown_80E7E34;
gUnknown_203B3F0->unkD8[index] = gUnknown_80E7E34;
}
break;
}
@ -185,7 +185,7 @@ void sub_803A51C(void)
void sub_803A5A0(void)
{
struct ItemSlot auStack8;
struct ItemSlot item;
switch(gUnknown_203B3F0->state) {
case 0:
@ -212,8 +212,8 @@ void sub_803A5A0(void)
sub_803A690();
break;
case 4:
xxx_init_itemslot_8090A8C(&auStack8,gUnknown_203B3F0->itemIndex,0);
sub_801B3C0(&auStack8);
xxx_init_itemslot_8090A8C(&item,gUnknown_203B3F0->itemIndex,0);
sub_801B3C0(&item);
break;
case 5:
break;

View File

@ -5,12 +5,15 @@
#include "dungeon_entity.h"
#include "dungeon_global_data.h"
#include "dungeon_leader.h"
#include "dungeon_util.h"
#include "dungeon_pokemon_attributes.h"
#include "pokemon.h"
#include "item.h"
extern u8 *gUnknown_80F91EC[];
extern u8 *gUnknown_80F7C50[];
extern u8 gUnknown_80F697C[];
extern s16 gSpeedTurns[2][0x19];
struct ItemText
{
@ -19,9 +22,220 @@ struct ItemText
};
extern const struct ItemText gActions[];
extern void sub_8071B48(void);
extern void sub_8043ED0(u32);
extern u8 sub_8043D10(void);
extern bool8 sub_8044B28(void);
extern void sub_8086AC0(void);
extern void sub_8043ED0(u32);
extern void sub_807EAA0(u32, u32);
extern void UseAttack(u32);
#ifdef NONMATCHING
void CheckElectricAbilities(void)
{
struct DungeonEntityData * entityData;
struct DungeonEntityData * entityData2;
struct DungeonEntity *entity;
u32 isNotEnemy;
s32 index;
if (gSpeedTurns[1][gDungeonGlobalData->speedTurnCounter] != 0) {
sub_8071B48();
gDungeonGlobalData->hasPlus[0] = FALSE;
gDungeonGlobalData->hasPlus[1] = FALSE;
gDungeonGlobalData->hasMinus[0] = FALSE;
gDungeonGlobalData->hasMinus[1] = FALSE;
gDungeonGlobalData->lightningRodPokemon = NULL;
gDungeonGlobalData->unk17B38 = 2;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeonGlobalData->allPokemon[index];
if (EntityExists(entity)) {
entityData = entity->entityData;
entityData2 = entityData;
entityData->attacking = FALSE;
// should be isNotEnemy = (entityData->isEnemy != '\0');
// gets a neg/orr/lsr instead of cmp/beq
isNotEnemy = (entityData->isEnemy == 0);
if (HasAbility(entity, 0x32)) { // ABILITY_LIGHTNINGROD
gDungeonGlobalData->lightningRodPokemon = entity;
gDungeonGlobalData->unk17B38 = entityData2->unk98;
}
if (HasAbility(entity, 0x3f)) { // ABILITY_MINUS
gDungeonGlobalData->hasMinus[isNotEnemy] = TRUE;
}
if (HasAbility(entity, 0x38)) { // ABILITY_PLUS
gDungeonGlobalData->hasPlus[isNotEnemy] = TRUE;
}
}
}
sub_8043ED0(0);
}
}
#else
NAKED
void CheckElectricAbilities(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r8\n"
"\tpush {r7}\n"
"\tldr r1, _08044A94\n"
"\tldr r4, _08044A98\n"
"\tldr r0, [r4]\n"
"\tmovs r2, 0xCC\n"
"\tlsls r2, 3\n"
"\tadds r0, r2\n"
"\tmovs r3, 0\n"
"\tldrsh r0, [r0, r3]\n"
"\tlsls r0, 1\n"
"\tadds r1, 0x32\n"
"\tadds r0, r1\n"
"\tmovs r1, 0\n"
"\tldrsh r0, [r0, r1]\n"
"\tcmp r0, 0\n"
"\tbeq _08044A8A\n"
"\tbl sub_8071B48\n"
"\tldr r0, [r4]\n"
"\tldr r2, _08044A9C\n"
"\tadds r0, r2\n"
"\tmovs r2, 0\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r3, _08044AA0\n"
"\tadds r0, r3\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r1, _08044AA4\n"
"\tadds r0, r1\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tadds r3, 0x2\n"
"\tadds r0, r3\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r4]\n"
"\tldr r3, _08044AA8\n"
"\tadds r1, r0, r3\n"
"\tstr r2, [r1]\n"
"\tldr r1, _08044AAC\n"
"\tadds r0, r1\n"
"\tmovs r1, 0x2\n"
"\tstr r1, [r0]\n"
"\tmov r8, r2\n"
"\tadds r7, r4, 0\n"
"_080449F2:\n"
"\tldr r0, [r7]\n"
"\tmov r2, r8\n"
"\tlsls r1, r2, 2\n"
"\tldr r3, _08044AB0\n"
"\tadds r0, r3\n"
"\tadds r0, r1\n"
"\tldr r5, [r0]\n"
"\tadds r0, r5, 0\n"
"\tbl EntityExists\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _08044A7A\n"
"\tldr r0, [r5, 0x70]\n"
"\tadds r4, r0, 0\n"
"\tmovs r0, 0xA4\n"
"\tlsls r0, 1\n"
"\tadds r1, r4, r0\n"
"\tmovs r0, 0\n"
"\tstrb r0, [r1]\n"
"\tldrb r0, [r4, 0x6]\n"
"\tmovs r6, 0x1\n"
"\tcmp r0, 0\n"
"\tbeq _08044A24\n"
"\tmovs r6, 0\n"
"_08044A24:\n"
"\tadds r0, r5, 0\n"
"\tmovs r1, 0x32\n"
"\tbl HasAbility\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _08044A46\n"
"\tldr r1, [r7]\n"
"\tldr r2, _08044AA8\n"
"\tadds r0, r1, r2\n"
"\tstr r5, [r0]\n"
"\tldr r3, _08044AAC\n"
"\tadds r1, r3\n"
"\tadds r0, r4, 0\n"
"\tadds r0, 0x98\n"
"\tldr r0, [r0]\n"
"\tstr r0, [r1]\n"
"_08044A46:\n"
"\tadds r0, r5, 0\n"
"\tmovs r1, 0x3F\n"
"\tbl HasAbility\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _08044A60\n"
"\tldr r0, [r7]\n"
"\tldr r1, _08044AA4\n"
"\tadds r0, r1\n"
"\tadds r0, r6\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r0]\n"
"_08044A60:\n"
"\tadds r0, r5, 0\n"
"\tmovs r1, 0x38\n"
"\tbl HasAbility\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _08044A7A\n"
"\tldr r0, [r7]\n"
"\tldr r2, _08044A9C\n"
"\tadds r0, r2\n"
"\tadds r0, r6\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r0]\n"
"_08044A7A:\n"
"\tmovs r3, 0x1\n"
"\tadd r8, r3\n"
"\tmov r0, r8\n"
"\tcmp r0, 0x13\n"
"\tble _080449F2\n"
"\tmovs r0, 0\n"
"\tbl sub_8043ED0\n"
"_08044A8A:\n"
"\tpop {r3}\n"
"\tmov r8, r3\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_08044A94: .4byte gSpeedTurns\n"
"_08044A98: .4byte gDungeonGlobalData\n"
"_08044A9C: .4byte 0x000037f8\n"
"_08044AA0: .4byte 0x000037f9\n"
"_08044AA4: .4byte 0x000037fa\n"
"_08044AA8: .4byte 0x00017b2c\n"
"_08044AAC: .4byte 0x00017b38\n"
"_08044AB0: .4byte 0x000135cc");
}
#endif
void sub_8044AB4(void)
{
s32 index;
if (gSpeedTurns[1][gDungeonGlobalData->speedTurnCounter + 1] != 0) {
for (index = 0; index < DUNGEON_MAX_POKEMON; index++) {
if (EntityExists(gDungeonGlobalData->allPokemon[index])) {
UseAttack(0);
break;
}
}
sub_807EAA0(1,0);
sub_8086AC0();
sub_8043ED0(0);
}
}
bool8 sub_8044B28(void)
{
@ -86,8 +300,8 @@ void sub_8044C10(u8 param_1)
{
entityData->action.actionUseIndex = 0;
entityData->action.unkC = 0;
entityData->itemTargetPosition.x = -1;
entityData->itemTargetPosition.y = -1;
entityData->action.itemTargetPosition.x = -1;
entityData->action.itemTargetPosition.y = -1;
}
}
@ -98,8 +312,8 @@ void sub_8044C50(u16 action)
entityData->action.action = action;
entityData->action.actionUseIndex = 0;
entityData->action.unkC = 0;
entityData->itemTargetPosition.x = -1;
entityData->itemTargetPosition.y = -1;
entityData->action.itemTargetPosition.x = -1;
entityData->action.itemTargetPosition.y = -1;
}
void ResetAction(struct DungeonActionContainer *actionPointer)

View File

@ -123,7 +123,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorld, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
pokemonData->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
}
}
else
@ -242,7 +242,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorld, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
pokemonData->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
return;
}
}

View File

@ -5,7 +5,7 @@
extern bool8 sub_8044B28(void);
extern bool8 xxx_dungeon_80442D0(u8);
extern void sub_8044994(void);
extern void CheckElectricAbilities(void);
extern void sub_807E378(void);
extern void sub_8044574(void);
extern void sub_8044820(void);
@ -42,7 +42,7 @@ void RunDungeon(u8 param_1)
bool8 cVar2;
if (!sub_8044B28()) {
sub_8044994();
CheckElectricAbilities();
if (!sub_8044B28()) {
cVar2 = xxx_dungeon_80442D0(param_1);
if (!sub_8044B28()) {

View File

@ -77,8 +77,8 @@ bool8 sub_80717A4(struct DungeonEntity *pokemon, u16 moveID)
for(iVar3 = 0, pokeMove = entityData->moves, pokeMove2 = pokeMove; iVar3 < MAX_MON_MOVES; pokeMove++, pokeMove2++, iVar3++)
{
if (((pokeMove->moveFlags & MOVE_FLAG_EXISTS) != 0) && (entityData->isLeader || ((pokeMove->moveFlags & MOVE_FLAG_ENABLED) != 0)))
if((sub_805744C(pokemon, pokeMove2, 1) != '\0') && (pokeMove->PP != 0))
if (((pokeMove->moveFlags & MOVE_FLAG_EXISTS)) && (entityData->isLeader || ((pokeMove->moveFlags & MOVE_FLAG_ENABLED))))
if((sub_805744C(pokemon, pokeMove2, TRUE) != 0) && (pokeMove->PP != 0))
if(pokeMove->moveID == moveID)
return TRUE;
}

View File

@ -451,7 +451,7 @@ bool8 IsSaveCorrupted(void)
return isCorrupted;
}
u32 WriteSavetoPak(s32 *param_1,u32 param_2)
u32 WriteSavetoPak(s32 *param_1, u32 param_2)
{
struct UnkStruct_sub_8011DAC *iVar1;
char *__src;

View File

@ -5,11 +5,13 @@
#include "constants/type.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_ai_movement.h"
#include "dungeon_global_data.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "dungeon_items.h"
#include "code_808417C.h"
#include "code_8077274_1.h"
#include "map.h"
extern u8 gAvailablePokemonNames[];
@ -76,14 +78,65 @@ extern u8 *gUnknown_80FAA8C[];
extern u8 *gUnknown_80FAE58[];
extern u8 *gUnknown_80FAE7C[];
extern s16 gUnknown_80F4EB0[];
extern u8 *gUnknown_80FBB4C[];
extern u8 *gUnknown_80FBB78[];
extern u8 *gUnknown_80FA79C[];
extern s16 gUnknown_80F4EF0[];
extern u8 *gUnknown_80FB73C[];
extern u8 *gUnknown_80FB764[];
extern u8 *gUnknown_80FB780[];
extern u8 *gUnknown_80FB7A0[];
extern s16 gUnknown_80F4EC4[];
extern u8 *gUnknown_80FB8BC[];
extern u8 *gUnknown_80FB8E4[];
extern s16 gUnknown_80F4EC8[];
extern u8 *gUnknown_80FB900[];
extern u8 *gUnknown_80FB924[];
extern u8 *gUnknown_80FB994[];
extern s16 gUnknown_80F4ED0[];
extern u8 *gUnknown_80FB978[];
extern s16 gUnknown_80F4EA4[];
extern u8 *gUnknown_80FB004[];
extern u32 gUnknown_8106A4C;
extern s16 gUnknown_80F4EA8[];
extern u8 *gUnknown_80FB01C[];
extern s16 gUnknown_80F4ED8[];
extern u8 *gUnknown_80FBA14[];
extern u8 *gUnknown_80FB9F0[];
extern u8 *gUnknown_80FBA38[];
extern u8 *gUnknown_80FBA60[];
extern u8 *gUnknown_80FBAA0[];
extern u8 *gUnknown_80FBA80[];
extern s16 gUnknown_80F4EE4[];
extern s16 gUnknown_80F4EEC[];
extern u8 *gUnknown_80FBB04[];
extern u8 *gUnknown_80FBB28[];
extern s32 gUnknown_202DE30[10];
extern void sub_8041D84(struct DungeonEntity *);
extern void sub_804178C(u32);
extern void sub_8041D5C(struct DungeonEntity *);
extern void sub_8077084(struct DungeonEntity *, struct DungeonEntity *, u32, u32);
extern void sub_8077160(struct DungeonEntity *, struct DungeonEntity *, u32, u32);
extern void sub_8041D48(struct DungeonEntity *);
extern u8 sub_806CEBC(struct DungeonEntity *);
extern void sub_8041D38(struct DungeonEntity * pokemon);
extern void sub_803E46C(u32);
extern void sub_806CCB4(struct DungeonEntity *, u8);
extern u8 sub_8043D10(void);
extern void sub_8041CDC(struct DungeonEntity *pokemon);
extern void sub_8041CEC(struct DungeonEntity *pokemon);
extern void nullsub_73(struct DungeonEntity *);
extern void nullsub_74(struct DungeonEntity *);
extern void nullsub_75(struct DungeonEntity *);
extern void nullsub_76(struct DungeonEntity *);
extern void nullsub_77(struct DungeonEntity *);
extern void nullsub_78(struct DungeonEntity *);
extern void nullsub_79(struct DungeonEntity *);
extern void nullsub_80(struct DungeonEntity *);
extern void nullsub_81(struct DungeonEntity *);
extern void nullsub_82(struct DungeonEntity *);
extern void sub_803F580(u32);
extern void sub_8040A84(void);
extern void sub_8041CA8(struct DungeonEntity *);
@ -421,7 +474,7 @@ void sub_8077780(struct DungeonEntity * pokemon, struct DungeonEntity * target,
}
}
void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 diplayMessage)
void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 turns, bool8 displayMessage)
{
s32 movSpeed;
s32 index;
@ -437,8 +490,8 @@ void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target,
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
movSpeed = GetMovementSpeed(target);
if (movSpeed == 4) {
if (diplayMessage)
if (movSpeed == MAX_MOVEMENT_SPEED) {
if (displayMessage)
sub_80522F4(pokemon,target,*gUnknown_80FC2B8);
}
else {
@ -468,7 +521,7 @@ void sub_8077910(struct DungeonEntity * pokemon, struct DungeonEntity * target,
void sub_80779F0(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 param_3, bool8 displayMessage)
{
s32 movSpeed;
s32 iVar4;
s32 counter;
s32 index;
s32 movSpeed_1;
struct DungeonEntityData *entityData;
@ -487,7 +540,7 @@ void sub_80779F0(struct DungeonEntity * pokemon, struct DungeonEntity * target,
sub_80522F4(pokemon,target,*gUnknown_80FC2D8);
}
else {
for(iVar4 = 0; iVar4 < param_3; iVar4++)
for(counter = 0; counter < param_3; counter++)
{
for(index = 0; index < NUM_SPEED_TURN_COUNTERS; index++)
{
@ -793,3 +846,344 @@ void sub_8078084(struct DungeonEntity * pokemon)
}
}
}
void DestinyBondStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData *entityData;
struct DungeonEntityData *entityData2;
s32 index;
u8 *linkedStatus;
s32 zero;
if (((EntityExists(target)) && (GetEntityType(pokemon) == ENTITY_POKEMON)) &&
(GetEntityType(target) == ENTITY_POKEMON)) {
entityData = pokemon->entityData;
SetMessageArgument(gAvailablePokemonNames,pokemon,0);
linkedStatus = &entityData->linkedStatus;
if (entityData->linkedStatus != LINKED_STATUS_DESTINY_BOND)
{
if (entityData->linkedStatus == LINKED_STATUS_LEECH_SEED)
sub_80522F4(pokemon,target,*gUnknown_80FA79C);
zero = 0;
*linkedStatus = LINKED_STATUS_DESTINY_BOND;
entityData->linkedStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4EF0,TRUE) + 1;
entityData->linkedStatusDamageTimer = zero;
nullsub_74(target);
entityData->unkD8 = 0xff;
}
else
{
sub_80522F4(pokemon,target,*gUnknown_80FBB78);
return;
}
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
if (target == gDungeonGlobalData->allPokemon[index]) {
entityData->unkD8 = index;
entityData2 = target->entityData;
entityData->unkD4 = entityData2->unk98;
}
}
sub_80522F4(pokemon,target,*gUnknown_80FBB4C);
DungeonEntityUpdateStatusSprites(target);
}
}
void SureShotStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target, s32 turns)
{
struct DungeonEntityData *entityData;
if (EntityExists(target)) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->moveStatus != MOVE_STATUS_SURE_SHOT) {
entityData->moveStatus = MOVE_STATUS_SURE_SHOT;
entityData->moveStatusTurnsLeft = turns + 1;
sub_8041CDC(target);
sub_80522F4(pokemon,target,*gUnknown_80FB73C);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FB764);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void WhifferStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target, s32 turns)
{
struct DungeonEntityData *entityData;
if (EntityExists(target) && !HasSafeguardStatus(pokemon, target, TRUE)) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->moveStatus != MOVE_STATUS_WHIFFER) {
entityData->moveStatus = MOVE_STATUS_WHIFFER;
entityData->moveStatusTurnsLeft = turns + 1;
sub_8041CEC(target);
sub_80522F4(pokemon,target,*gUnknown_80FB780);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FB7A0);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void FixedDamageStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData *entityData;
if (EntityExists(target)) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->moveStatus != MOVE_STATUS_SET_DAMAGE) {
entityData->moveStatus = MOVE_STATUS_SET_DAMAGE;
entityData->moveStatusTurnsLeft = CalculateStatusTurns(target, gUnknown_80F4EC4, FALSE) + 1;
nullsub_79(target);
sub_80522F4(pokemon,target,*gUnknown_80FB8BC);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FB8E4);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void FocusEnergyStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData *entityData;
if (EntityExists(target)) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->moveStatus != MOVE_STATUS_FOCUS_ENERGY) {
entityData->moveStatus = MOVE_STATUS_FOCUS_ENERGY;
entityData->moveStatusTurnsLeft = CalculateStatusTurns(target, gUnknown_80F4EC8, FALSE) + 1;
nullsub_80(target);
sub_80522F4(pokemon,target,*gUnknown_80FB900);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FB924);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void sub_80783C4(struct DungeonEntity * pokemon, struct DungeonEntity * target, u8 param_3)
{
struct DungeonEntityData *targetEntityData;
struct DungeonEntityData *entityData;
struct DungeonEntity * entity;
struct DungeonEntity * entity2;
struct DungeonActionContainer action;
s32 index;
if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) {
targetEntityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (targetEntityData->waitingStatus == WAITING_STATUS_DECOY) {
sub_80522F4(pokemon,target,*gUnknown_80FB994);
}
else {
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeonGlobalData->allPokemon[index];
if ((((EntityExists(entity)) && (target != entity)) &&
(u8)(entity->entityData->waitingStatus - 2U) < 2)) {
SendWaitingEndMessage(pokemon,entity,WAITING_STATUS_NONE);
sub_803E46C(0x2a);
}
}
sub_8041D38(target);
SetMessageArgument(gAvailablePokemonNames,target,0);
if (targetEntityData->waitingStatus != WAITING_STATUS_NONE) {
SendWaitingEndMessage(pokemon,target, WAITING_STATUS_DECOY);
}
targetEntityData->waitingStatus = WAITING_STATUS_DECOY;
targetEntityData->enemyDecoy = pokemon->entityData->isEnemy;
targetEntityData->fillCA = param_3;
targetEntityData->waitingStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4ED0,TRUE) + 1;
targetEntityData->cursedDamageTimer = 0;
sub_806CCB4(target,sub_806CEBC(target));
gDungeonGlobalData->decoyActive = TRUE;
sub_80522F4(pokemon,target,*gUnknown_80FB978);
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity2 = gDungeonGlobalData->allPokemon[index];
if (EntityExists(entity2)) {
entityData = entity2->entityData;
entityData->movementAction = MOVEMENT_ACTION_FACE_RANDOM_DIRECTION;
entityData->targetPokemon = NULL;
entityData->targetPokemonSpawnIndex = 0;
if (!entityData->isLeader) {
action = entityData->action;
MoveIfPossible(entity2, TRUE);
entityData->action = action;
}
}
}
DungeonEntityUpdateStatusSprites(target);
}
}
}
void CurseStatusTarget(struct DungeonEntity *pokemon, struct DungeonEntity * target)
{
u32 uVar1;
s32 HP;
struct DungeonEntityData * pokemonEntityData;
struct DungeonEntityData * targetEntityData;
if ((EntityExists(pokemon) ) && (EntityExists(target))) {
pokemonEntityData = pokemon->entityData;
targetEntityData = target->entityData;
if (HasType(pokemon, TYPE_GHOST)) {
if (HasSafeguardStatus(pokemon,target, TRUE)) {
return;
}
SendWaitingEndMessage(pokemon,target,WAITING_STATUS_CURSED);
sub_8041D48(target);
HP = pokemonEntityData->HP / 2;
pokemonEntityData->HP = HP;
if (HP == 0) {
pokemonEntityData->HP = 1;
}
if (targetEntityData->waitingStatus != WAITING_STATUS_CURSED) {
targetEntityData->waitingStatus = WAITING_STATUS_CURSED;
targetEntityData->waitingStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4EA4,TRUE) + 1;
targetEntityData->cursedDamageTimer = 0;
}
SetMessageArgument(gAvailablePokemonNames,target,0);
sub_80522F4(pokemon,target,*gUnknown_80FB004);
}
else {
uVar1 = gUnknown_8106A4C;
sub_8077084(pokemon,pokemon,uVar1,1);
sub_8077160(pokemon,pokemon,uVar1,1);
sub_80779F0(pokemon,pokemon,1,1);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void SnatchStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntity * entity;
s32 index;
struct DungeonEntityData * targetEntityData;
struct DungeonEntityData * targetEntityData2;
if (EntityExists(target)) {
SendWaitingEndMessage(pokemon,target,WAITING_STATUS_SNATCH);
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeonGlobalData->allPokemon[index];
if ((EntityExists(entity)) && (entity->entityData->waitingStatus == WAITING_STATUS_SNATCH)) {
SendWaitingEndMessage(pokemon, entity, WAITING_STATUS_NONE);
}
}
nullsub_81(target);
targetEntityData = target->entityData;
targetEntityData2 = targetEntityData;
if (targetEntityData->waitingStatus != WAITING_STATUS_SNATCH) {
targetEntityData->waitingStatus = WAITING_STATUS_SNATCH;
targetEntityData->waitingStatusTurnsLeft= CalculateStatusTurns(target,gUnknown_80F4EA8,FALSE) + 1;
targetEntityData->cursedDamageTimer = 0;
}
gDungeonGlobalData->snatchPokemon = target;
gDungeonGlobalData->unk17B3C = targetEntityData2->unk98;
SetMessageArgument(gAvailablePokemonNames,target,0);
sub_80522F4(pokemon,target,*gUnknown_80FB01C);
DungeonEntityUpdateStatusSprites(target);
}
}
void TauntStatusTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData *entityData;
if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->volatileStatus != VOLATILE_STATUS_TAUNTED) {
entityData->volatileStatus = VOLATILE_STATUS_TAUNTED;
entityData->volatileStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4ED8,TRUE) + 1;
nullsub_73(target);
sub_80522F4(pokemon,target,*gUnknown_80FB9F0);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FBA14);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void sub_80787E4(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData *entityData;
if ((EntityExists(target))) {
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->stockpileCount < 3) {
entityData->stockpileCount++;
sub_804178C(1);
sub_8041D5C(target);
gUnknown_202DE30[0] = entityData->stockpileCount;
sub_80522F4(pokemon,target,*gUnknown_80FBA38);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FBA60);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void sub_807885C(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData * targetEntityData;
struct DungeonEntityData * targetEntityData_1;
if (EntityExists(target)) {
targetEntityData = target->entityData;
targetEntityData_1 = targetEntityData;
if (targetEntityData_1->transformStatus == TRANSFORM_STATUS_TRANSFORMED) {
SendTransformEndMessage(pokemon,target);
}
SetMessageArgument(gAvailablePokemonNames,target,0);
if (targetEntityData_1->transformStatus != TRANSFORM_STATUS_INVISIBLE) {
targetEntityData_1->transformStatus = TRANSFORM_STATUS_INVISIBLE;
targetEntityData_1->transformStatusTurnsLeft = CalculateStatusTurns(target,gUnknown_80F4EE4,FALSE) + 1;
sub_8041D84(target);
sub_80522F4(pokemon,target,*gUnknown_80FBA80);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FBAA0);
}
DungeonEntityUpdateStatusSprites(target);
}
}
void PerishSongTarget(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
struct DungeonEntityData * entityData;
if (EntityExists(target) && !HasSafeguardStatus(pokemon, target, TRUE)) {
nullsub_82(target);
entityData = target->entityData;
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityData->perishSongTimer == 0) {
entityData->perishSongTimer = CalculateStatusTurns(target,gUnknown_80F4EEC,0) + 1;
sub_80522F4(pokemon,target,*gUnknown_80FBB04);
}
else {
sub_80522F4(pokemon,target,*gUnknown_80FBB28);
}
DungeonEntityUpdateStatusSprites(target);
}
}

View File

@ -74,7 +74,7 @@ extern u8 sub_804AD34(s32 *);
extern u8 sub_8057308(struct DungeonEntity *, u32);
extern void sub_8076F80(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32);
extern void sub_8077084(struct DungeonEntity *, struct DungeonEntity *, u32, u32);
extern void sub_8078678(struct DungeonEntity *, struct DungeonEntity *);
extern void SnatchStatusTarget(struct DungeonEntity *, struct DungeonEntity *);
extern void sub_806F324(struct DungeonEntity *, s32, u32, u32);
extern void sub_8077160(struct DungeonEntity *, struct DungeonEntity *, u32, u32);
extern bool8 sub_805755C(struct DungeonEntity* pokemon,u16 moveID);
@ -83,8 +83,8 @@ extern void DestinyBondStatusTarget(struct DungeonEntity *, struct DungeonEntity
extern void sub_8076E20(struct DungeonEntity *, struct DungeonEntity *, u32, u32, u32, u32);
extern void sub_80783C4(struct DungeonEntity *, struct DungeonEntity *, u32);
extern bool8 sub_807FCD4(struct Position *, u32, u8);
extern void sub_80788E8(struct DungeonEntity *, struct DungeonEntity *);
extern void sub_8076B48(struct DungeonEntity *, struct DungeonEntity *);
extern void PerishSongTarget(struct DungeonEntity *, struct DungeonEntity *);
extern void WrapTarget(struct DungeonEntity *, struct DungeonEntity *);
extern void sub_80768DC(struct DungeonEntity *, struct DungeonEntity *, s32, s32);
extern void sub_807CD9C(struct DungeonEntity *, struct DungeonEntity *, u8 facingDir);
@ -238,6 +238,48 @@ extern s16 gUnknown_80F4DC6;
extern u8 *gUnknown_80FEFF4[];
extern void sub_80763F8(struct DungeonEntity *, struct DungeonEntity *, u32);
extern u32 gUnknown_80F51C4[];
bool8 sub_805AFA4(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, u32 param_4)
{
s32 r0;
s32 r2;
s32 r1;
bool8 flag;
#ifndef NONMATCHING
register struct DungeonEntityData *entityData asm("r3");
#else
struct DungeonEntityData *entityData;
#endif
SendThawedMessage(pokemon, target);
entityData = pokemon->entityData;
r2 = entityData->maxHP;
r0 = r2;
if (r2 < 0) {
r0 = r2 + 3;
}
if (entityData->HP <= r0 >> 2) {
r2 = 0;
}
else if (r1 = entityData->HP, r1 <= r2 / 2) {
r2 = 1;
}
else
{
r0 = r2 * 3;
if (r0 < 0) {
r0 = r0 + 3;
}
if (r0 >>= 2, r2 = 3, r1 <= r0) {
r2 = 2;
}
}
flag = sub_8055640(pokemon,target,move,gUnknown_80F51C4[r2],param_4) ? TRUE : FALSE;
return flag;
}
bool8 sub_805B028(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move)
{
sub_8077780(pokemon,target, 1);
@ -301,13 +343,13 @@ bool8 HandleColorChange(struct DungeonEntity * pokemon, struct DungeonEntity * t
}
}
bool8 sub_805B164(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move,s32 param_4)
bool8 sub_805B164(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4)
{
sub_8077084(pokemon,target,gUnknown_8106A50, 2);
return TRUE;
}
bool8 sub_805B17C(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move,s32 param_4)
bool8 sub_805B17C(struct DungeonEntity * pokemon, struct DungeonEntity * target, struct PokemonMove *move, s32 param_4)
{
s32 uVar4;
bool8 uVar5;
@ -332,15 +374,15 @@ bool8 sub_805B17C(struct DungeonEntity * pokemon, struct DungeonEntity * target,
return uVar5;
}
bool8 sub_805B208(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4)
bool8 PerishSongMoveAction(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4)
{
sub_80788E8(pokemon, target);
PerishSongTarget(pokemon, target);
return TRUE;
}
bool8 sub_805B214(struct DungeonEntity * pokemon,struct DungeonEntity * target,struct PokemonMove *move, s32 param_4)
{
sub_8076B48(pokemon, target);
WrapTarget(pokemon, target);
return TRUE;
}
@ -643,7 +685,7 @@ bool8 sub_805B668(struct DungeonEntity * pokemon, struct DungeonEntity * target,
bool8 sub_805B734(struct DungeonEntity * pokemon, struct DungeonEntity * target)
{
sub_8078678(pokemon, target);
SnatchStatusTarget(pokemon, target);
return TRUE;
}