mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
decompile all pokemon files
This commit is contained in:
parent
5707c5c7c6
commit
084ba7a7a4
111
asm/pokemon_3.s
111
asm/pokemon_3.s
@ -1,111 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_806F47C
|
||||
sub_806F47C: @ 806F47C
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
ldr r1, =gUnknown_020249B4
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
cmp r4, 0
|
||||
beq _0806F4F0
|
||||
ldrb r0, [r4, 0x2]
|
||||
cmp r0, 0xA3
|
||||
beq _0806F4A8
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
movs r2, 0x14
|
||||
bl memset
|
||||
b _0806F4F0
|
||||
.pool
|
||||
_0806F4A8:
|
||||
ldr r0, [r4, 0x10]
|
||||
cmp r0, 0
|
||||
beq _0806F4B6
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4, 0x10]
|
||||
_0806F4B6:
|
||||
ldr r0, [r4, 0xC]
|
||||
cmp r0, 0
|
||||
beq _0806F4C4
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4, 0xC]
|
||||
_0806F4C4:
|
||||
ldr r0, [r4, 0x8]
|
||||
cmp r0, 0
|
||||
beq _0806F4D2
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4, 0x8]
|
||||
_0806F4D2:
|
||||
ldr r0, [r4, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0806F4E0
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4, 0x4]
|
||||
_0806F4E0:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
movs r2, 0x14
|
||||
bl memset
|
||||
adds r0, r4, 0
|
||||
bl Free
|
||||
_0806F4F0:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_806F47C
|
||||
|
||||
thumb_func_start sub_806F4F8
|
||||
sub_806F4F8: @ 806F4F8
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r3, r1, 24
|
||||
ldr r2, =gUnknown_020249B4
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, 0x2]
|
||||
cmp r0, 0xA3
|
||||
beq _0806F51C
|
||||
movs r0, 0
|
||||
b _0806F530
|
||||
.pool
|
||||
_0806F51C:
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 28
|
||||
lsrs r0, 28
|
||||
cmp r3, r0
|
||||
blt _0806F528
|
||||
movs r3, 0
|
||||
_0806F528:
|
||||
ldr r0, [r1, 0x8]
|
||||
lsls r1, r3, 2
|
||||
adds r1, r0
|
||||
ldr r0, [r1]
|
||||
_0806F530:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_806F4F8
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -1,6 +0,0 @@
|
||||
#ifndef GUARD_CALCULATE_BASE_DAMAGE_H
|
||||
#define GUARD_CALCULATE_BASE_DAMAGE_H
|
||||
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef);
|
||||
|
||||
#endif // GUARD_CALCULATE_BASE_DAMAGE_H
|
@ -675,6 +675,13 @@ void BoxMonToMon(const struct BoxPokemon *srcMon, struct Pokemon *dstMon);
|
||||
u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
|
||||
u8 GetMonsStateToDoubles_2(void);
|
||||
|
||||
bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 itemId, u8 partyId, u8 monMoveIndex, u8 a5);
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef);
|
||||
const u8* GetTrainerClassNameFromId(u16 trainerId);
|
||||
const u8* GetTrainerNameFromId(u16 trainerId);
|
||||
void PlayMapChosenOrBattleBGM(u16 song);
|
||||
u8 GetTrainerEncounterMusicId(u16 trainerOpponentId);
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
|
||||
|
@ -1,9 +0,0 @@
|
||||
#ifndef GUARD_POKEMON_3_H
|
||||
#define GUARD_POKEMON_3_H
|
||||
|
||||
const u8* GetTrainerClassNameFromId(u16 trainerId);
|
||||
const u8* GetTrainerNameFromId(u16 trainerId);
|
||||
void PlayMapChosenOrBattleBGM(u16 song);
|
||||
u8 GetTrainerEncounterMusicId(u16 trainerOpponentId);
|
||||
|
||||
#endif // GUARD_POKEMON_3_H
|
@ -1,62 +0,0 @@
|
||||
#ifndef GUARD_POKEMON_ITEM_EFFECTS
|
||||
#define GUARD_POKEMON_ITEM_EFFECTS
|
||||
|
||||
#include "pokemon.h"
|
||||
|
||||
// TODO once pokemon item effects is decompiled
|
||||
/*
|
||||
struct PokemonItemEffect
|
||||
{
|
||||
//field 0
|
||||
u8 xAtk : 4; // x1, x2, x4, x8 = xF
|
||||
u8 field_0_x10 : 1; // x10
|
||||
u8 critRatioUp : 1; // x20
|
||||
u8 field_0_x40 : 1; // x40
|
||||
u8 cureInfatuation : 1; // x80
|
||||
|
||||
/*field 1
|
||||
u8 xSpeed : 4; // x1, x2, x4, x8 = xF
|
||||
u8 xDefense : 4; // x10, x20, x40, xF0
|
||||
|
||||
/*field 2
|
||||
u8 xSpAtk : 4; // x1, x2, x4, x8 = xF
|
||||
u8 xAccuracy : 4; // x10, x20, x40, xF0
|
||||
|
||||
/*field 3
|
||||
u8 cureConfusion : 1; // x1
|
||||
u8 cureParalysis : 1; // x2
|
||||
u8 cureFreeze : 1; // x4
|
||||
u8 cureBurn : 1; // x8
|
||||
u8 curePoison : 1; // x10
|
||||
u8 cureSleep : 1; // x20
|
||||
u8 field_3_x40 : 1; // x40
|
||||
u8 cantLowerStats : 1; // x80
|
||||
|
||||
/*field 4
|
||||
u8 hpEv : 1; // x1
|
||||
u8 attackEv : 1; // x2
|
||||
u8 healHp : 1; // x4
|
||||
u8 field_4_x8 : 1; // x8
|
||||
u8 field_4_x10 : 1; // x10
|
||||
u8 ppUp : 1; // x20
|
||||
u8 levelUp : 1; // x40
|
||||
u8 evolutionStone : 1; // x80
|
||||
|
||||
/*field 5
|
||||
u8 defEv: 1; // x1
|
||||
u8 speedEv : 1; // x2
|
||||
u8 spDefEv : 1; // x4
|
||||
u8 spAtkEv : 1; // x8
|
||||
u8 ppMax : 1; // x10
|
||||
u8 field_5_x20 : 1; // x20
|
||||
u8 field_5_x40 : 1; // x40
|
||||
u8 field_5_x80 : 1; // x80
|
||||
|
||||
/*field 6
|
||||
u8 value;
|
||||
};
|
||||
*/
|
||||
|
||||
bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 itemId, u8 partyId, u8 monMoveIndex, u8 a5);
|
||||
|
||||
#endif // GUARD_POKEMON_ITEM_EFFECTS
|
@ -69,7 +69,6 @@ SECTIONS {
|
||||
src/battle_ai_switch_items.o(.text);
|
||||
src/battle_controller_link_opponent.o(.text);
|
||||
src/pokemon_1.o(.text);
|
||||
asm/pokemon_3.o(.text);
|
||||
src/trig.o(.text);
|
||||
src/random.o(.text);
|
||||
src/util.o(.text);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "random.h"
|
||||
#include "util.h"
|
||||
#include "constants/items.h"
|
||||
#include "pokemon_item_effects.h"
|
||||
|
||||
extern u8 gActiveBattler;
|
||||
extern u8 gAbsentBattlerFlags;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "constants/hold_effects.h"
|
||||
#include "util.h"
|
||||
#include "pokemon.h"
|
||||
#include "calculate_base_damage.h"
|
||||
#include "random.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
@ -31,7 +30,6 @@
|
||||
#include "bg.h"
|
||||
#include "string_util.h"
|
||||
#include "pokemon_icon.h"
|
||||
#include "pokemon_item_effects.h"
|
||||
#include "m4a.h"
|
||||
#include "mail.h"
|
||||
#include "event_data.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "battle_transition.h"
|
||||
#include "main.h"
|
||||
#include "task.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "safari_zone.h"
|
||||
#include "script.h"
|
||||
#include "constants/game_stat.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "event_data.h"
|
||||
#include "calculate_base_damage.h"
|
||||
#include "link.h"
|
||||
#include "berry.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "rtc.h"
|
||||
#include "m4a.h"
|
||||
#include "malloc.h"
|
||||
#include "util.h"
|
||||
|
||||
//Extracts the upper 16 bits of a 32-bit number
|
||||
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
|
||||
@ -39,7 +40,7 @@ struct Unknown_806F160_Struct
|
||||
u8 field_0_0 : 4;
|
||||
u8 field_0_1 : 4;
|
||||
u8 field_1;
|
||||
u8 field_2;
|
||||
u8 magic;
|
||||
u8 field_3_0 : 4;
|
||||
u8 field_3_1 : 4;
|
||||
void *bytes;
|
||||
@ -96,7 +97,6 @@ extern u8 gLastUsedAbility;
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u32 gHitMarker;
|
||||
|
||||
extern const u32 gBitTable[];
|
||||
extern const struct SpriteTemplate gUnknown_08329D98[];
|
||||
extern const struct SpriteTemplate gUnknown_08329DF8[];
|
||||
extern const union AnimCmd* gUnknown_082FF70C[];
|
||||
@ -105,8 +105,6 @@ extern const union AnimCmd* const * const gUnknown_08305D0C[];
|
||||
extern const union AnimCmd* const * const gUnknown_0830536C[];
|
||||
extern const u8 gText_BadEgg[];
|
||||
extern const u8 gText_EggNickname[];
|
||||
extern const u8 gFacilityClassToPicIndex[];
|
||||
extern const u8 gFacilityClassToTrainerClass[];
|
||||
extern const u8 gSecretBaseTrainerClasses[][5];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
||||
@ -122,11 +120,6 @@ extern const u8 gUnknown_08329D22[];
|
||||
extern const u8 gUnknown_08329D26[];
|
||||
extern const u8 gUnknown_08329D2A[];
|
||||
extern const u8 gUnknown_08329EC2[];
|
||||
extern const u16 gSpeciesToHoennPokedexNum[];
|
||||
extern const u16 gSpeciesToNationalPokedexNum[];
|
||||
extern const u16 gHoennToNationalOrder[];
|
||||
extern const u16 gSpeciesIdToCryId[];
|
||||
extern const struct SpindaSpot gSpindaSpotGraphics[];
|
||||
extern const u8* const gStatNamesTable[];
|
||||
extern const u8 gSpeciesNames[][11];
|
||||
extern const u8 gUnknown_08329EC8[];
|
||||
@ -136,7 +129,6 @@ extern const u8 gText_PkmnGettingPumped[];
|
||||
extern const u8 gText_PkmnShroudedInMist[];
|
||||
extern const s8 gNatureStatTable[][5];
|
||||
extern const s8 gUnknown_08329ECE[][3];
|
||||
extern const u32 gBitTable[];
|
||||
extern const u32 gTMHMLearnsets[][2];
|
||||
extern const u8 gText_BattleWallyName[];
|
||||
extern const u8 gText_PkmnsXPreventsSwitching[];
|
||||
@ -145,8 +137,9 @@ extern const struct CompressedSpritePalette gMonShinyPaletteTable[];
|
||||
extern const u16 gHMMoves[];
|
||||
extern const u8 gMonAnimationDelayTable[];
|
||||
extern const u8 gMonFrontAnimIdsTable[];
|
||||
extern const u8 gFacilityClassToPicIndex[];
|
||||
extern const u8 gTrainerClassNames[][13];
|
||||
extern const struct SpriteTemplate gUnknown_08329D98[];
|
||||
extern const struct SpriteTemplate gUnknown_08329F28;
|
||||
|
||||
extern bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 bank);
|
||||
extern u8 pokemon_order_func(u8);
|
||||
@ -157,7 +150,6 @@ extern u16 get_unknown_box_id(void);
|
||||
extern u8 StorageGetCurrentBox(void);
|
||||
extern void set_unknown_box_id(u8);
|
||||
extern struct BoxPokemon* GetBoxedMonPtr(u8 boxNumber, u8 boxPosition);
|
||||
extern s32 GetDeoxysStat(struct Pokemon *mon, s32 statId);
|
||||
extern void sub_803FA70(u8 bank);
|
||||
extern void ClearTemporarySpeciesSpriteData(u8 bank, bool8);
|
||||
extern u32 GetBoxMonDataFromAnyBox(u8 boxNo, u8 boxPos, s32 field);
|
||||
@ -4912,14 +4904,12 @@ bool8 sub_806F104(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern const struct SpriteTemplate gUnknown_08329D98[];
|
||||
extern const struct SpriteTemplate gUnknown_08329F28;
|
||||
#define FORCE_SIGNED(x)(-(x * (-1)))
|
||||
|
||||
void sub_806F160(struct Unknown_806F160_Struct* structPtr)
|
||||
{
|
||||
s32 i;
|
||||
u16 j;
|
||||
for (i = 0; i < structPtr->field_0_0; i = (u16)(i + 1))
|
||||
u16 i, j;
|
||||
for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++)
|
||||
{
|
||||
structPtr->templates[i] = gUnknown_08329D98[i];
|
||||
for (j = 0; j < structPtr->field_1; j++)
|
||||
@ -4933,9 +4923,8 @@ void sub_806F160(struct Unknown_806F160_Struct* structPtr)
|
||||
|
||||
void sub_806F1FC(struct Unknown_806F160_Struct* structPtr)
|
||||
{
|
||||
s32 i;
|
||||
u16 j;
|
||||
for (i = 0; i < structPtr->field_0_0; i = (u16)(i + 1))
|
||||
u16 i, j;
|
||||
for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++)
|
||||
{
|
||||
structPtr->templates[i] = gUnknown_08329F28;
|
||||
for (j = 0; j < structPtr->field_1; j++)
|
||||
@ -4948,14 +4937,14 @@ void sub_806F1FC(struct Unknown_806F160_Struct* structPtr)
|
||||
}
|
||||
}
|
||||
|
||||
struct Unknown_806F160_Struct *sub_806F2AC(u8 arg0, u8 arg1)
|
||||
struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
{
|
||||
u8 i;
|
||||
u8 flags;
|
||||
struct Unknown_806F160_Struct *structPtr;
|
||||
|
||||
flags = 0;
|
||||
arg0 %= 2;
|
||||
id %= 2;
|
||||
structPtr = AllocZeroed(sizeof(*structPtr));
|
||||
if (structPtr == NULL)
|
||||
return NULL;
|
||||
@ -4979,7 +4968,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 arg0, u8 arg1)
|
||||
break;
|
||||
}
|
||||
|
||||
structPtr->bytes = AllocZeroed(structPtr->field_3_0 * structPtr->field_0_0);
|
||||
structPtr->bytes = AllocZeroed(structPtr->field_3_0 * 0x800 * 4 * structPtr->field_0_0);
|
||||
structPtr->byteArrays = AllocZeroed(structPtr->field_0_0 * 32);
|
||||
if (structPtr->bytes == NULL || structPtr->byteArrays == NULL)
|
||||
{
|
||||
@ -4987,7 +4976,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 arg0, u8 arg1)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < structPtr->field_0_0; i++)
|
||||
for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++)
|
||||
structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 0xD));
|
||||
}
|
||||
|
||||
@ -5037,9 +5026,55 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 arg0, u8 arg1)
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->field_2 = 0xA3;
|
||||
gUnknown_020249B4[arg0] = structPtr;
|
||||
structPtr->magic = 0xA3;
|
||||
gUnknown_020249B4[id] = structPtr;
|
||||
}
|
||||
|
||||
return gUnknown_020249B4[arg0];
|
||||
return gUnknown_020249B4[id];
|
||||
}
|
||||
|
||||
void sub_806F47C(u8 id)
|
||||
{
|
||||
struct Unknown_806F160_Struct *structPtr;
|
||||
|
||||
id %= 2;
|
||||
structPtr = gUnknown_020249B4[id];
|
||||
if (structPtr == NULL)
|
||||
return;
|
||||
|
||||
if (structPtr->magic != 0xA3)
|
||||
{
|
||||
memset(structPtr, 0, sizeof(struct Unknown_806F160_Struct));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (structPtr->frameImages != NULL)
|
||||
FREE_AND_SET_NULL(structPtr->frameImages);
|
||||
if (structPtr->templates != NULL)
|
||||
FREE_AND_SET_NULL(structPtr->templates);
|
||||
if (structPtr->byteArrays != NULL)
|
||||
FREE_AND_SET_NULL(structPtr->byteArrays);
|
||||
if (structPtr->bytes != NULL)
|
||||
FREE_AND_SET_NULL(structPtr->bytes);
|
||||
|
||||
memset(structPtr, 0, sizeof(struct Unknown_806F160_Struct));
|
||||
Free(structPtr);
|
||||
}
|
||||
}
|
||||
|
||||
u8 *sub_806F4F8(u8 id, u8 arg1)
|
||||
{
|
||||
struct Unknown_806F160_Struct *structPtr = gUnknown_020249B4[id % 2];
|
||||
if (structPtr->magic != 0xA3)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arg1 >= FORCE_SIGNED(structPtr->field_0_0))
|
||||
arg1 = 0;
|
||||
|
||||
return structPtr->byteArrays[arg1];
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "mystery_event_script.h"
|
||||
#include "palette.h"
|
||||
#include "party_menu.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "random.h"
|
||||
#include "overworld.h"
|
||||
|
Loading…
Reference in New Issue
Block a user