ground script pokemon documentation

This commit is contained in:
DizzyEggg 2025-06-15 23:16:00 +02:00
parent cf06a42eb2
commit ded4524e9f
27 changed files with 282 additions and 304 deletions

View File

@ -7,36 +7,6 @@
.global gUnknown_8116738
gUnknown_8116738: @ 8116738
@ replacing .incbin "baserom.gba", 0x00116738, 0x28
.byte 0x98, 0x9d, 0x03, 0x02, 0x83, 0x01, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x01, 0xe0, 0x00, 0xac, 0x00, 0xbe, 0x00, 0x50, 0x00, 0x14, 0x00, 0x01, 0x00, 0x21, 0x00, 0x20, 0x00, 0x1f, 0x00
.byte 0x20, 0x00, 0x00, 0x00, 0xf8, 0xa7, 0x00, 0x00
.global gUnknown_8116760
gUnknown_8116760: @ 8116760
@ replacing .incbin "baserom.gba", 0x00116760, 0x28
.byte 0x98, 0x9d, 0x03, 0x02, 0x04, 0x01, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x14, 0x00, 0x14, 0x00
.byte 0x10, 0x00, 0x00, 0x00, 0x40, 0x06, 0x00, 0x00
.global gUnknown_8116788
gUnknown_8116788: @ 8116788
.byte 0x06, 0x63, 0x00, 0x00
.global gUnknown_811678C
gUnknown_811678C: @ 811678C
.byte 0x0a, 0x63, 0x00, 0x00
.global gUnknown_8116790
gUnknown_8116790: @ 8116790
.byte 0x0c, 0x63, 0x00, 0x00
.global gUnknown_8116794
gUnknown_8116794: @ 8116794
@ replacing .incbin "baserom.gba", 0x00116794, 0x28
.byte 0x98, 0x9d, 0x03, 0x02, 0x99, 0x01, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x2b, 0x00, 0xb9, 0x00, 0x86, 0x00, 0x7d, 0x00, 0x1e, 0x00, 0x01, 0x00, 0x3c, 0x00, 0x3b, 0x00, 0x2a, 0x00
.byte 0x2c, 0x00, 0x00, 0x00, 0xf8, 0x2b, 0x04, 0x00
.global gUnknown_81167BC
gUnknown_81167BC: @ 81167BC
@ replacing .incbin "baserom.gba", 0x001167bc, 0x28

View File

@ -30,7 +30,7 @@ void sub_80687AC(void);
OpenedFile *GetSpriteData(s32 _species);
void LoadPokemonSprite(s32 _id, bool32 _ignoreDeoxys);
void CloseAllSpriteFiles(void);
void sub_806890C(void);
void SetDungeonMonsFromTeam(void);
void sub_8068A84(Pokemon *pokemon);
void sub_8068BDC(bool8 a0);
void sub_8068F28(void);

View File

@ -46,10 +46,10 @@ TeamInventory *GetMoneyItemsInfo(void);
void InitializeMoneyItems(void);
s32 GetNumberOfFilledInventorySlots(void);
bool8 IsThrowableItem(u8 id);
void ItemIdToSlot(Item *param_1,u8 id,u8 param_3);
void xxx_init_helditem_8090B08(BulkItem *param_1,u8 id);
void HeldItemToSlot(Item *param_1, BulkItem *param_2);
void SlotToHeldItem(BulkItem *held, Item *slot);
void ItemIdToItem(Item *item, u8 id, bool8 makeSticky);
void ItemIdToBulkItem(BulkItem *dst, u8 id);
void BulkItemToItem(Item *dst, BulkItem *src);
void ItemToBulkItem(BulkItem *dst, Item *src);
u8 GetItemCategory(u8 index);
s32 GetStackBuyValue(Item *param_1);
s32 GetStackSellValue(Item *param_1);

View File

@ -86,20 +86,22 @@ void GenerateHiddenPower(HiddenPower *);
s32 GetEvolutionSequence(Pokemon *pokemon, EvolveStage *);
s32 sub_808E400(s32 _species, s16* _a2, bool32 _bodySizeCheck, bool32 _shedinjaCheck);
void sub_808E490(Move* a1, s32 species);
void RecruitedPokemonToDungeonMon(DungeonMon *dst, u32 recruitedPokemonId);
void PokemonToDungeonMon(DungeonMon *, Pokemon *, s32);
void DungeonMonToRecruitedPokemon(s32 id, DungeonMon* src);
void DungeonMonToPokemon(Pokemon* dst, DungeonMon* src);
void WritePoke1Bits(DataSerializer *, Pokemon *pokemon);
void ReadPoke1Bits(DataSerializer *, Pokemon *);
s32 sub_808E218(unkStruct_808E218_arg *, Pokemon *pokemon);
void sub_808CFD0(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, DungeonLocation *location, u16 *moveID);
void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, const DungeonLocation *location, u16 *moves);
void sub_808D0D8(Pokemon *pokemon);
Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, const DungeonLocation *location, u16 *moveID);
Pokemon *GetPlayerPokemonStruct(void);
Pokemon *sub_808D1DC(Pokemon*);
Pokemon *TryAddPokemonToRecruited(Pokemon*);
Pokemon *sub_808D378(void);
Pokemon *sub_808D3BC(void);
Pokemon *sub_808D3F8(void);
Pokemon * sub_808D434(s16 species, s32 param_2);
Pokemon *GetRecruitedMonBySpecies(s16 species_, s32 sameSpeciesCounter);
s32 GetFriendSum_808D480(void);
bool8 sub_808D4B0(void);
bool8 sub_808D500(void);

View File

@ -42,6 +42,7 @@ typedef struct unkStruct_8090F58
} unkStruct_8090F58;
// size: R=0x4 | B=0x3
// Used in Dungeon, has an additional flag field.
typedef struct Item
{
/* 0x0 */ u8 flags;
@ -86,4 +87,4 @@ enum ItemAIFlag
ITEM_AI_FLAG_TARGET_ENEMY
};
#endif // GUARD_STR_ITEMS_H
#endif // GUARD_STR_ITEMS_H

View File

@ -660,7 +660,7 @@ bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, b
{
u32 pickUpItem = GetRandomFloorItem(0);
if (pickUpItem != ITEM_POKE) {
ItemIdToSlot(&entityInfo->heldItem, pickUpItem, 0);
ItemIdToItem(&entityInfo->heldItem, pickUpItem, 0);
entityInfo->unkF3 = TRUE;
}
}

View File

@ -1031,7 +1031,7 @@ bool8 sub_8096A08(u8 dungeon, Pokemon *pokemon)
temp = 0x100;
local_14 |= temp;
sub_808CFD0(pokemon,mail->clientSpecies,NULL,0,(DungeonLocation *) &local_14,NULL);
CreateLevel1Pokemon(pokemon,mail->clientSpecies,NULL,0,(DungeonLocation *) &local_14,NULL);
return TRUE;
}
}

View File

@ -150,8 +150,8 @@ static void sub_803A3BC(void)
CopyMonsterNameToBuffer(buffer, speciesIndex);
CopyStringtoBuffer(buffer, buffer);
buffer[0] = '@';
sub_808CFD0(&pokemon, speciesIndex, buffer, item, &dungeonLoc, moves);
sub_808D1DC(&pokemon);
CreateLevel1Pokemon(&pokemon, speciesIndex, buffer, item, &dungeonLoc, moves);
TryAddPokemonToRecruited(&pokemon);
}
sp_0x80 = 0;

View File

@ -130,7 +130,7 @@ static void sub_803A5A0(void)
sub_803A690();
break;
case 4:
ItemIdToSlot(&item, sUnknown_203B3F0->id, 0);
ItemIdToItem(&item, sUnknown_203B3F0->id, 0);
InitItemDescriptionWindow(&item);
break;
case 5:

View File

@ -162,7 +162,7 @@ void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x2E) && (param_1 == 0x17)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_ROCK_PART,0);
ItemIdToItem(&item,ITEM_ROCK_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regirock's body
@ -184,7 +184,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x2F) && (param_1 == 0x18)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_ICE_PART,0);
ItemIdToItem(&item,ITEM_ICE_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regice's body
@ -206,7 +206,7 @@ void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x30) && (param_1 == 0x19)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_STEEL_PART,0);
ItemIdToItem(&item,ITEM_STEEL_PART,0);
sub_80464C8(GetLeader(),param_3, &item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Registeel's body
@ -329,7 +329,7 @@ static void sub_808B1CC(u8 itemID)
tile->terrainType = tile->terrainType | TERRAIN_TYPE_STAIRS;
if (((itemID != ITEM_NOTHING) && (sub_80860A8(itemID) == 0)) &&
(sub_80860A8(ITEM_MUSIC_BOX) == 0)) {
ItemIdToSlot(&item,itemID,0);
ItemIdToItem(&item,itemID,0);
pos.y--;
AddItemToDungeonAt(&pos,&item,1);
}

View File

@ -25,10 +25,10 @@ static void SpawnItemAtPos(u8 itemId, s32 x, s32 y, s32 quantity, u32 itemFlags)
DungeonPos pos = {x, y};
if (sub_805210C(itemId)) {
ItemIdToSlot(&item, ITEM_LINK_CABLE, 0);
ItemIdToItem(&item, ITEM_LINK_CABLE, 0);
}
else {
ItemIdToSlot(&item, itemId, 0);
ItemIdToItem(&item, itemId, 0);
}
item.flags |= itemFlags;

View File

@ -74,7 +74,7 @@ void CreateItemWithStickyChance(Item *item, u8 itemID, u32 forceSticky)
{
bool8 stickyFlag;
ItemIdToSlot(item, itemID, FALSE);
ItemIdToItem(item, itemID, FALSE);
stickyFlag = FALSE;
if (IsNotSpecialItem(itemID)) {
if (forceSticky == FORCE_STICKY_RANDOM) {
@ -797,7 +797,7 @@ static void MusicBoxCreation(void)
ZeroOutItem(&gTeamInventoryRef->teamItems[indexes[2]]);
// init the music box
ItemIdToSlot(&gTeamInventoryRef->teamItems[indexes[0]], ITEM_MUSIC_BOX, 0);
ItemIdToItem(&gTeamInventoryRef->teamItems[indexes[0]], ITEM_MUSIC_BOX, 0);
}
} while (musicBoxOnce);
@ -884,7 +884,7 @@ void AllItemsToPlainSeed(void)
{
Item *item = &gTeamInventoryRef->teamItems[i];
if ((item->flags & ITEM_FLAG_EXISTS)) {
ItemIdToSlot(item, ITEM_PLAIN_SEED, FALSE);
ItemIdToItem(item, ITEM_PLAIN_SEED, FALSE);
}
}
FillInventoryGaps();
@ -895,7 +895,7 @@ void AllItemsToPlainSeed(void)
EntityInfo *entityInfo = GetEntInfo(entity);
Item *item = &entityInfo->heldItem;
if ((item->flags & ITEM_FLAG_EXISTS)) {
ItemIdToSlot(item, ITEM_PLAIN_SEED, FALSE);
ItemIdToItem(item, ITEM_PLAIN_SEED, FALSE);
}
}
}

View File

@ -1061,7 +1061,7 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
}
if (yesNoAnswer == 1) {
moves[sChosenMoveSlotId].moveFlags = 0;
ResetMoveFlags(&moves[sChosenMoveSlotId]);
for (i = sChosenMoveSlotId + 1; i < 8; i++) {
Move *move = &moves[i];
if (!MoveFlagExists(move))

View File

@ -48,7 +48,6 @@ static void EnsureCastformLoaded(void);
static void EnsureDeoxysLoaded(void);
extern bool8 IsLevelResetTo1(u8 dungeon);
extern void xxx_pokemonstruct_index_to_pokemon2_808DE30(void* r0, u32 r1);
extern void sub_806C264(s32 teamIndex, EntityInfo *entInfo);
extern bool8 sub_806A58C(s16 r0);
extern void sub_8084E00(Entity *entity, u8 param_2, u8 param_3);
@ -223,40 +222,39 @@ void CloseAllSpriteFiles(void)
}
}
void sub_806890C(void)
void SetDungeonMonsFromTeam(void)
{
int index;
int speciesId;
int recruitedId;
index = 0;
for (speciesId = 0; speciesId < NUM_MONSTERS; speciesId++) {
Pokemon stack;
Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[speciesId];
for (recruitedId = 0; recruitedId < NUM_MONSTERS; recruitedId++) {
Pokemon lvl1Mon;
Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[recruitedId];
if (PokemonExists(pokeStruct) && PokemonFlag2(pokeStruct)) {
xxx_pokemonstruct_index_to_pokemon2_808DE30(&gRecruitedPokemonRef->dungeonTeam[index],speciesId);
RecruitedPokemonToDungeonMon(&gRecruitedPokemonRef->dungeonTeam[index],recruitedId);
if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id)) {
struct DungeonLocation dungeonLoc = {.id = DUNGEON_TINY_WOODS, .floor = 1};
sub_808CFD0(&stack,pokeStruct->speciesNum,0,0,&dungeonLoc,0);
gRecruitedPokemonRef->dungeonTeam[index].level = stack.level;
gRecruitedPokemonRef->dungeonTeam[index].IQ = stack.IQ;
gRecruitedPokemonRef->dungeonTeam[index].unk10 = stack.pokeHP;
gRecruitedPokemonRef->dungeonTeam[index].unk12 = stack.pokeHP;
gRecruitedPokemonRef->dungeonTeam[index].offense.att[0] = stack.offense.att[0];
gRecruitedPokemonRef->dungeonTeam[index].offense.att[1] = stack.offense.att[1];
gRecruitedPokemonRef->dungeonTeam[index].offense.def[0] = stack.offense.def[0];
gRecruitedPokemonRef->dungeonTeam[index].offense.def[1] = stack.offense.def[1];
gRecruitedPokemonRef->dungeonTeam[index].currExp = stack.currExp;
gRecruitedPokemonRef->dungeonTeam[index].IQSkills = stack.IQSkills;
gRecruitedPokemonRef->dungeonTeam[index].tacticIndex = stack.tacticIndex;
CopyAndResetMoves(&gRecruitedPokemonRef->dungeonTeam[index].moves, stack.moves);
CreateLevel1Pokemon(&lvl1Mon,pokeStruct->speciesNum,0,0,&dungeonLoc,0);
gRecruitedPokemonRef->dungeonTeam[index].level = lvl1Mon.level;
gRecruitedPokemonRef->dungeonTeam[index].IQ = lvl1Mon.IQ;
gRecruitedPokemonRef->dungeonTeam[index].unk10 = lvl1Mon.pokeHP;
gRecruitedPokemonRef->dungeonTeam[index].unk12 = lvl1Mon.pokeHP;
gRecruitedPokemonRef->dungeonTeam[index].offense.att[0] = lvl1Mon.offense.att[0];
gRecruitedPokemonRef->dungeonTeam[index].offense.att[1] = lvl1Mon.offense.att[1];
gRecruitedPokemonRef->dungeonTeam[index].offense.def[0] = lvl1Mon.offense.def[0];
gRecruitedPokemonRef->dungeonTeam[index].offense.def[1] = lvl1Mon.offense.def[1];
gRecruitedPokemonRef->dungeonTeam[index].currExp = lvl1Mon.currExp;
gRecruitedPokemonRef->dungeonTeam[index].IQSkills = lvl1Mon.IQSkills;
gRecruitedPokemonRef->dungeonTeam[index].tacticIndex = lvl1Mon.tacticIndex;
CopyAndResetMoves(&gRecruitedPokemonRef->dungeonTeam[index].moves, lvl1Mon.moves);
}
gRecruitedPokemonRef->dungeonTeam[index].unkC = index;
index++;
if (index == 4)
if (++index == MAX_TEAM_MEMBERS)
break;
}
}
for (; index < 4; index++) {
for (; index < MAX_TEAM_MEMBERS; index++) {
gRecruitedPokemonRef->dungeonTeam[index].flags = 0;
}
}
@ -406,7 +404,7 @@ void sub_8068BDC(bool8 a0)
s32 k;
for (k = 0; k < j; k++) {
if (monPointers[k]->flags & POKEMON_FLAG_x4000) {
sub_808D1DC(monPointers[k]);
TryAddPokemonToRecruited(monPointers[k]);
}
}
}
@ -437,7 +435,7 @@ void sub_8068BDC(bool8 a0)
}
for (id = 0; id < j; id++) {
if (PokemonExists(monPointers[id]) && (monPointers[id]->flags & POKEMON_FLAG_x4000)) {
sub_808D1DC(monPointers[id]);
TryAddPokemonToRecruited(monPointers[id]);
monPointers[id]->flags = 0;
}
}
@ -1402,7 +1400,7 @@ s32 sub_806A4DC(EntityInfo *info)
loc.id = 0;
loc.floor = 1;
sub_808CFD0(&pokemon, info->id, NULL, 0, &loc, 0);
CreateLevel1Pokemon(&pokemon, info->id, NULL, 0, &loc, 0);
pokemon.speciesNum = info->id;
pokemon.level = info->level;

View File

@ -202,7 +202,7 @@ void sub_8027274(void)
sub_8012D60(&sUnknown_203B2BC->unk7C,sUnknown_203B2BC->menuItems,0,sUnknown_203B2BC->unk16C,sUnknown_203B2BC->menuAction2,2);
break;
case 0xd:
HeldItemToSlot(&slot, &sUnknown_203B2BC->itemToGive);
BulkItemToItem(&slot, &sUnknown_203B2BC->itemToGive);
InitItemDescriptionWindow(&slot);
break;
case 0xe:
@ -685,7 +685,7 @@ void sub_8027D40(u32 r0, BulkItem *heldItem)
CallPrepareTextbox_8008C54(r0);
sub_80073B8(r0);
HeldItemToSlot(&slot, heldItem);
BulkItemToItem(&slot, heldItem);
a3.unk0 = 0;
a3.unk4 = 0;
a3.unk8 = 1;

View File

@ -219,7 +219,7 @@ void sub_8025518(void)
sub_8012D60(&gUnknown_203B2B4->unk78,gUnknown_203B2B4->unkC8,0,gUnknown_203B2B4->unk108,gUnknown_203B2B4->menuAction2,2);
break;
case FRIEND_LIST_MENU_STATE_INFO:
HeldItemToSlot(&item, &gUnknown_203B2B4->item1);
BulkItemToItem(&item, &gUnknown_203B2B4->item1);
InitItemDescriptionWindow(&item);
break;
case FRIEND_LIST_MENU_STATE_ITEM_GIVEN:
@ -534,7 +534,7 @@ void sub_8025CB4(void)
AddHeldItemToInventory(&gUnknown_203B2B4->item2);
nextState = FRIEND_LIST_MENU_STATE_ITEM_EXCHANGE;
}
HeldItemToSlot(&item,&gUnknown_203B2B4->item1);
BulkItemToItem(&item,&gUnknown_203B2B4->item1);
a3.unk0 = 0;
a3.unk4 = 0;
a3.unk8 = 1;
@ -634,7 +634,7 @@ void sub_8025E68(u32 r0, BulkItem *heldItem)
CallPrepareTextbox_8008C54(r0);
sub_80073B8(r0);
HeldItemToSlot(&item, heldItem);
BulkItemToItem(&item, heldItem);
a3.unk0 = 0;
a3.unk4 = 0;
a3.unk8 = 1;

View File

@ -172,7 +172,6 @@ u8 sub_80A8D20();
bool8 sub_80A87E0();
s16 sub_80A8BFC(s16);
void sub_80A8F50(const u8 *buffer, s32, s32 size);
Pokemon *sub_808D2E8(s32 species, u8 *name, u32 _itemID, DungeonLocation *location, u16 *moveID);
bool8 HasRecruitedMon(s32 species);
extern Item gUnknown_8116844;
extern Item gUnknown_81167E4;
@ -203,7 +202,7 @@ ALIGNED(4) EWRAM_DATA u8 gScriptLocks[SCRIPT_LOCKS_ARR_COUNT + 7] = {0};
ALIGNED(4) EWRAM_DATA u8 gScriptLockConds[SCRIPT_LOCKS_ARR_COUNT + 7] = {0};
EWRAM_DATA u32 gUnlockBranchLabels[SCRIPT_LOCKS_ARR_COUNT + 1] = {0};
EWRAM_DATA MenuItem gChoices[9] = {0};
EWRAM_DATA char gUnknown_2039D98[POKEMON_NAME_LENGTH + 2] = {0};
static EWRAM_DATA char sPokeNameBuffer[POKEMON_NAME_LENGTH + 2] = {0};
EWRAM_DATA u32 gUnknown_2039DA4 = 0;
EWRAM_DATA u16 gUnknown_2039DA8 = 0;
EWRAM_INIT static int sNumChoices = 0;
@ -1165,7 +1164,7 @@ s16 HandleAction(Action *action, DebugLocation *debug)
Pokemon *mon = sub_80A8D54(id);
s32 i;
for (i = 0; i < POKEMON_NAME_LENGTH; i++) {
mon->name[i] = gUnknown_2039D98[i];
mon->name[i] = sPokeNameBuffer[i];
}
}
}
@ -1181,7 +1180,7 @@ s16 HandleAction(Action *action, DebugLocation *debug)
break;
}
if (val == 1) {
SetRescueTeamName(gUnknown_2039D98);
SetRescueTeamName(sPokeNameBuffer);
}
action->scriptData.script.ptr = ResolveJump(action, val);
action->scriptData.savedState = 3;
@ -1201,7 +1200,7 @@ s16 HandleAction(Action *action, DebugLocation *debug)
name[i] = '\0';
}
CopyStringtoBuffer(gUnknown_2039D98, name);
CopyStringtoBuffer(sPokeNameBuffer, name);
for (i = 0; i < 16; i++) {
if (name[i] != ptr[i]) {
val = 2;
@ -1978,33 +1977,33 @@ s32 ExecuteScriptCommand(Action *action)
Pokemon *mon = sub_80A8D54(curCmd.arg1);
if (mon != NULL) {
for (i = 0; i < POKEMON_NAME_LENGTH; i++) {
gUnknown_2039D98[i] = mon->name[i];
sPokeNameBuffer[i] = mon->name[i];
}
gUnknown_2039D98[POKEMON_NAME_LENGTH] = 0;
sub_809B1C0(4, 0, gUnknown_2039D98);
sPokeNameBuffer[POKEMON_NAME_LENGTH] = 0;
sub_809B1C0(4, 0, sPokeNameBuffer);
sub_80A87AC(0, 11);
return 2;
}
break;
} else {
sub_809B1C0(4, 1, gUnknown_2039D98);
sub_809B1C0(4, 1, sPokeNameBuffer);
sub_80A87AC(0, 11);
return 2;
}
}
case 0x3e: {
sub_80920B8(gUnknown_2039D98);
gUnknown_2039D98[10] = 0;
sub_809B1C0(5, 0, gUnknown_2039D98);
sub_80920B8(sPokeNameBuffer);
sPokeNameBuffer[10] = 0;
sub_809B1C0(5, 0, sPokeNameBuffer);
sub_80A87AC(0, 11);
return 2;
}
case 0x3f: {
int i;
for (i = 0; i < 12; i++) {
gUnknown_2039D98[i] = 0;
sPokeNameBuffer[i] = 0;
}
sub_809B1C0(6, (u8)curCmd.argByte, gUnknown_2039D98);
sub_809B1C0(6, (u8)curCmd.argByte, sPokeNameBuffer);
sub_80A87AC(0, 11);
return 2;
}
@ -3070,7 +3069,6 @@ UNUSED static bool8 GroundScript_ExecuteTrigger(s16 r0)
return FALSE;
}
extern struct StoryMonData gUnknown_8116760;
extern struct StoryMonData gUnknown_8116794;
extern struct StoryMonData gUnknown_81167BC;
extern struct StoryMonData gUnknown_8116738;
@ -3253,13 +3251,13 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
UnlockFriendArea(MIST_RISE_FOREST);
return 0;
case 0x18:
sub_80A8F50(gUnknown_2039D98, 0x3C, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x3C, POKEMON_NAME_LENGTH);
return 0;
case 0x19:
UnlockFriendArea(GetFriendArea(MONSTER_MAGNEMITE));
{
struct StoryMonData sp_4 = {
.name = gUnknown_2039D98,
struct StoryMonData magnemiteData = {
.name = sPokeNameBuffer,
.speciesNum = MONSTER_MAGNEMITE,
.itemID = ITEM_NOTHING,
.dungeonLocation = {.id = DUNGEON_POKEMON_SQUARE_2, .floor = 0},
@ -3271,44 +3269,57 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
.offenseDef = {20, 18},
.currExp = 4560,
};
Pokemon sp_2c;
Pokemon *ptr;
Pokemon magnemiteMon;
Pokemon *recruitPtr;
s32 index;
ConvertStoryMonToPokemon(&sp_2c, &sp_4);
ptr = sub_808D1DC(&sp_2c);
if (ptr == NULL) return 1;
for(index = 0; index < POKEMON_NAME_LENGTH; index++)
{
ptr->name[index] = gUnknown_2039D98[index];
ConvertStoryMonToPokemon(&magnemiteMon, &magnemiteData);
recruitPtr = TryAddPokemonToRecruited(&magnemiteMon);
if (recruitPtr == NULL)
return 1;
for (index = 0; index < POKEMON_NAME_LENGTH; index++) {
recruitPtr->name[index] = sPokeNameBuffer[index];
}
StrncpyCustom(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Names[r2], sPokeNameBuffer, POKEMON_NAME_LENGTH);
IncrementAdventureNumJoined();
return 0;
}
break;
case 0x1A:
sub_80A8F50(gUnknown_2039D98, 0x53, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x53, POKEMON_NAME_LENGTH);
return 0;
case 0x1B:
case 0x1B:
UnlockFriendArea(GetFriendArea(MONSTER_ABSOL));
{
Pokemon *pokemon;
struct StoryMonData sp_84;
Pokemon sp_ac;
Pokemon *recruitPtr;
struct StoryMonData absolData = {
.name = sPokeNameBuffer,
.speciesNum = MONSTER_ABSOL,
.itemID = ITEM_NOTHING,
.dungeonLocation = {.id = DUNGEON_FROSTY_GROTTO_2, .floor = 0},
.moveID = {MOVE_SCRATCH, MOVE_LEER, MOVE_TAUNT, MOVE_QUICK_ATTACK},
.pokeHP = 80,
.level = 20,
.IQ = 1,
.offenseAtk = {33, 32},
.offenseDef = {31, 32},
.currExp = 43000,
};
Pokemon absolMon;
UnlockFriendArea(GetFriendArea(MONSTER_ABSOL));
sp_84 = gUnknown_8116738;
ConvertStoryMonToPokemon(&sp_ac, &sp_84);
pokemon = sub_808D1DC(&sp_ac);
if(pokemon == NULL) return 1;
ConvertStoryMonToPokemon(&absolMon, &absolData);
recruitPtr = TryAddPokemonToRecruited(&absolMon);
if (recruitPtr == NULL)
return 1;
IncrementAdventureNumJoined();
pokemon->flags |= POKEMON_FLAG_ON_TEAM;
recruitPtr->flags |= POKEMON_FLAG_ON_TEAM;
return 0;
}
case 0x1C:
{
Pokemon *pokemon = sub_808D434(MONSTER_ABSOL, 0);
if(pokemon == NULL) return 1;
Pokemon *pokemon = GetRecruitedMonBySpecies(MONSTER_ABSOL, 0);
if (pokemon == NULL)
return 1;
pokemon->flags |= POKEMON_FLAG_ON_TEAM;
return 0;
}
@ -3320,65 +3331,67 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
return 0;
}
case 0x1E:
sub_80A8F50(gUnknown_2039D98, 0x7C, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x7C, POKEMON_NAME_LENGTH);
return 0;
case 0x1F:
{
Pokemon *pokemon;
Pokemon *recruitPtr;
s32 index;
struct StoryMonData sp_108;
Pokemon sp_130;
struct StoryMonData smeargleData = {
.name = sPokeNameBuffer,
.speciesNum = MONSTER_SMEARGLE,
.itemID = ITEM_NOTHING,
.dungeonLocation = {.id = DUNGEON_HOWLING_FOREST_2, .floor = 0},
.moveID = {MOVE_SKETCH, MOVE_NOTHING, MOVE_NOTHING, MOVE_NOTHING},
.pokeHP = 47,
.level = 5,
.IQ = 1,
.offenseAtk = {16, 20},
.offenseDef = {20, 16},
.currExp = 1600,
};
Pokemon smeargleMon;
sp_108 = gUnknown_8116760;
ConvertStoryMonToPokemon(&sp_130, &sp_108);
pokemon = sub_808D1DC(&sp_130);
if(!pokemon) return 1;
for(index = 0; index < POKEMON_NAME_LENGTH; index++)
{
pokemon->name[index] = gUnknown_2039D98[index];
ConvertStoryMonToPokemon(&smeargleMon, &smeargleData);
recruitPtr = TryAddPokemonToRecruited(&smeargleMon);
if (!recruitPtr)
return 1;
for (index = 0; index < POKEMON_NAME_LENGTH; index++) {
recruitPtr->name[index] = sPokeNameBuffer[index];
}
StrncpyCustom(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Names[r2], sPokeNameBuffer, POKEMON_NAME_LENGTH);
IncrementAdventureNumJoined();
return 0;
}
break;
case 0x20:
{
sub_80026E8(0x9E, 0x1);
if(sub_808D434(MONSTER_ZAPDOS, 0) == NULL)
{
if(sub_808D2E8(MONSTER_ZAPDOS, NULL, ITEM_NOTHING, &gUnknown_8116788, NULL))
IncrementAdventureNumJoined();
}
if(sub_808D434(MONSTER_MOLTRES, 0) == NULL)
{
if(sub_808D2E8(MONSTER_MOLTRES, NULL, ITEM_NOTHING, &gUnknown_811678C, NULL))
IncrementAdventureNumJoined();
}
if(sub_808D434(MONSTER_ARTICUNO, 0) == NULL)
{
if(sub_808D2E8(MONSTER_ARTICUNO, NULL, ITEM_NOTHING, &gUnknown_8116790, NULL))
IncrementAdventureNumJoined();
}
return 0;
sub_80026E8(0x9E, 0x1);
if (GetRecruitedMonBySpecies(MONSTER_ZAPDOS, 0) == NULL) {
static const DungeonLocation zapdosLoc = {.id = DUNGEON_MT_THUNDER_PEAK, .floor = 99};
if (TryAddLevel1PokemonToRecruited(MONSTER_ZAPDOS, NULL, ITEM_NOTHING, &zapdosLoc, NULL))
IncrementAdventureNumJoined();
}
break;
if (GetRecruitedMonBySpecies(MONSTER_MOLTRES, 0) == NULL) {
static const DungeonLocation moltresLoc = {.id = DUNGEON_MT_BLAZE_PEAK, .floor = 99};
if (TryAddLevel1PokemonToRecruited(MONSTER_MOLTRES, NULL, ITEM_NOTHING, &moltresLoc, NULL))
IncrementAdventureNumJoined();
}
if (GetRecruitedMonBySpecies(MONSTER_ARTICUNO, 0) == NULL) {
static const DungeonLocation articunoLoc = {.id = DUNGEON_FROSTY_GROTTO, .floor = 99};
if (TryAddLevel1PokemonToRecruited(MONSTER_ARTICUNO, NULL, ITEM_NOTHING, &articunoLoc, NULL))
IncrementAdventureNumJoined();
}
return 0;
case 0x21:
if(HasRecruitedMon(MONSTER_ARTICUNO))
if(HasRecruitedMon(MONSTER_ZAPDOS))
if(HasRecruitedMon(MONSTER_MOLTRES))
return 1;
if (HasRecruitedMon(MONSTER_ARTICUNO) && HasRecruitedMon(MONSTER_ZAPDOS) && HasRecruitedMon(MONSTER_MOLTRES))
return 1;
return 0;
case 0x22:
{
Pokemon *pokemon = GetPlayerPokemonStruct();
if(pokemon->speciesNum != MONSTER_ARTICUNO && pokemon->speciesNum != MONSTER_ZAPDOS && pokemon->speciesNum != MONSTER_MOLTRES)
if (pokemon->speciesNum != MONSTER_ARTICUNO && pokemon->speciesNum != MONSTER_ZAPDOS && pokemon->speciesNum != MONSTER_MOLTRES)
return 1;
}
return 0;
@ -3393,25 +3406,36 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
}
return 0;
case 0x24:
sub_80A8F50(gUnknown_2039D98, 0x79, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x79, POKEMON_NAME_LENGTH);
return 0;
case 0x25:
if (!GetFriendAreaStatus(GetFriendArea(MONSTER_LATIOS)))
UnlockFriendArea(GetFriendArea(MONSTER_LATIOS));
{
Pokemon *pokemon;
Pokemon *recruitPtr;
s32 index;
struct StoryMonData sp_188;
Pokemon sp_1b0;
struct StoryMonData latiosData = {
.name = sPokeNameBuffer,
.speciesNum = MONSTER_LATIOS,
.itemID = ITEM_NOTHING,
.dungeonLocation = {.id = DUNGEON_POKEMON_SQUARE, .floor = 0},
.moveID = {MOVE_PSYWAVE, MOVE_MEMENTO, MOVE_HELPING_HAND, MOVE_SAFEGUARD},
.pokeHP = 125,
.level = 30,
.IQ = 1,
.offenseAtk = {60, 59},
.offenseDef = {42, 44},
.currExp = 273400,
};
Pokemon latiosMon;
if(!GetFriendAreaStatus(GetFriendArea(MONSTER_LATIOS)))
UnlockFriendArea(GetFriendArea(MONSTER_LATIOS));
sp_188 = gUnknown_8116794;
ConvertStoryMonToPokemon(&sp_1b0, &sp_188);
pokemon = sub_808D1DC(&sp_1b0);
if(pokemon == NULL) return 1;
for(index = 0; index < POKEMON_NAME_LENGTH; index++)
{
pokemon->name[index] = gUnknown_2039D98[index];
ConvertStoryMonToPokemon(&latiosMon, &latiosData);
recruitPtr = TryAddPokemonToRecruited(&latiosMon);
if (recruitPtr == NULL)
return 1;
for (index = 0; index < POKEMON_NAME_LENGTH; index++) {
recruitPtr->name[index] = sPokeNameBuffer[index];
}
IncrementAdventureNumJoined();
return 0;
@ -3419,7 +3443,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
break;
case 0x26:
sub_80A8F50(gUnknown_2039D98, 0x7A, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x7A, POKEMON_NAME_LENGTH);
return 0;
case 0x27:
{
@ -3430,11 +3454,11 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
sp_208 = gUnknown_81167BC;
ConvertStoryMonToPokemon(&sp_230, &sp_208);
pokemon = sub_808D1DC(&sp_230);
pokemon = TryAddPokemonToRecruited(&sp_230);
if(pokemon == NULL) return 1;
for(index = 0; index < POKEMON_NAME_LENGTH; index++)
{
pokemon->name[index] = gUnknown_2039D98[index];
pokemon->name[index] = sPokeNameBuffer[index];
}
IncrementAdventureNumJoined();
return 0;
@ -3548,7 +3572,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
}
break;
case 0x2B:
sub_80A8F50(gUnknown_2039D98, 0x20, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x20, POKEMON_NAME_LENGTH);
return 0;
case 0x2C:
{
@ -3564,12 +3588,12 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
if(!GetFriendAreaStatus(GetFriendArea(id)))
UnlockFriendArea(GetFriendArea(id));
pokemon = sub_808D2E8(matchMe, NULL ,ITEM_NOTHING, &gUnknown_81167E8, MOVE_NOTHING);
pokemon = TryAddLevel1PokemonToRecruited(matchMe, NULL ,ITEM_NOTHING, &gUnknown_81167E8, MOVE_NOTHING);
if(pokemon == NULL)
return 0;
for(index = 0; index < POKEMON_NAME_LENGTH; index++)
pokemon->name[index] = gUnknown_2039D98[index];
pokemon->name[index] = sPokeNameBuffer[index];
IncrementAdventureNumJoined();
return 1;
}
@ -3615,7 +3639,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
}
break;
case 0x31:
sub_80A8F50(gUnknown_2039D98, 0x52, POKEMON_NAME_LENGTH);
sub_80A8F50(sPokeNameBuffer, 0x52, POKEMON_NAME_LENGTH);
return 0;
case 0x32:
@ -3624,7 +3648,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
Pokemon sp_2b0;
sp_288 = gUnknown_811681C;
ConvertStoryMonToPokemon(&sp_2b0, &sp_288);
if(sub_808D1DC(&sp_2b0) == 0) {
if(TryAddPokemonToRecruited(&sp_2b0) == 0) {
return 1;
}
else {

View File

@ -158,92 +158,86 @@ bool8 IsThrowableItem(u8 id)
}
// arm9.bin::02060F04
void ItemIdToSlot(Item *slot, u8 id, u8 makeSticky)
void ItemIdToItem(Item *item, u8 id, bool8 makeSticky)
{
if (id != ITEM_NOTHING) {
slot->flags = ITEM_FLAG_EXISTS;
slot->id = id;
item->flags = ITEM_FLAG_EXISTS;
item->id = id;
if (IsThrowableItem(id)) {
s32 min = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT);
s32 max = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT);
slot->quantity = RandRange(min, max);
item->quantity = RandRange(min, max);
}
else if (GetItemCategory(id) == CATEGORY_POKE) {
slot->quantity = 1;
item->quantity = 1;
}
else {
slot->quantity = 0;
item->quantity = 0;
}
if (makeSticky) {
slot->flags |= ITEM_FLAG_STICKY;
item->flags |= ITEM_FLAG_STICKY;
}
}
else {
slot->flags = 0;
slot->id = ITEM_NOTHING;
slot->quantity = 0;
item->flags = 0;
item->id = ITEM_NOTHING;
item->quantity = 0;
}
}
// arm9.bin::02060E80
void xxx_init_helditem_8090B08(BulkItem *held, u8 id)
void ItemIdToBulkItem(BulkItem *dst, u8 id)
{
u32 uVar2;
u32 uVar3;
if (id != ITEM_NOTHING) {
held->id = id;
if (IsThrowableItem(id)) {
uVar2 = GetSpawnAmountRange(id,MIN_SPAWN_AMOUNT);
uVar3 = GetSpawnAmountRange(id,MAX_SPAWN_AMOUNT);
held->quantity = RandRange(uVar2, uVar3);
if (id != ITEM_NOTHING) {
dst->id = id;
if (IsThrowableItem(id)) {
s32 min = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT);
s32 max = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT);
dst->quantity = RandRange(min, max);
}
else if (GetItemCategory(id) == CATEGORY_POKE)
dst->quantity = 1;
else
dst->quantity = 0;
}
else {
dst->id = ITEM_NOTHING;
dst->quantity = 0;
}
else if (GetItemCategory(id) == CATEGORY_POKE)
held->quantity = 1;
else
held->quantity = 0;
}
else {
held->id = ITEM_NOTHING;
held->quantity = 0;
}
}
// arm9.bin::02060DF0
void HeldItemToSlot(Item *slot, BulkItem *held)
void BulkItemToItem(Item *dst, BulkItem *src)
{
u8 is_throwable;
if(held->id != ITEM_NOTHING)
{
slot->flags = ITEM_FLAG_EXISTS;
slot->id = held->id;
is_throwable = IsThrowableItem(slot->id);
if(is_throwable != 0 || GetItemCategory(slot->id) == CATEGORY_POKE)
slot->quantity = held->quantity;
else if(slot->id == ITEM_TM_USED_TM)
slot->quantity = held->quantity;
if (src->id != ITEM_NOTHING) {
dst->flags = ITEM_FLAG_EXISTS;
dst->id = src->id;
is_throwable = IsThrowableItem(dst->id);
if (is_throwable != 0 || GetItemCategory(dst->id) == CATEGORY_POKE)
dst->quantity = src->quantity;
else if (dst->id == ITEM_TM_USED_TM)
dst->quantity = src->quantity;
else
slot->quantity = 0;
dst->quantity = 0;
}
else
{
slot->id = ITEM_NOTHING;
slot->quantity = 0;
slot->flags = 0;
else {
ZeroOutItem(dst);
}
}
// arm9.bin::02060DC0
void SlotToHeldItem(BulkItem *held, Item *slot)
void ItemToBulkItem(BulkItem *dst, Item *src)
{
if ((slot->flags & ITEM_FLAG_EXISTS) != 0) {
held->id = slot->id;
held->quantity = slot->quantity;
if (ItemExists(src)) {
dst->id = src->id;
dst->quantity = src->quantity;
}
else {
dst->id = ITEM_NOTHING;
}
else
held->id = ITEM_NOTHING;
}
// arm9.bin::02060DA8
@ -354,7 +348,7 @@ void BufferItemName(u8* dest, u8 id, struct unkStruct_8090F58* a2)
Item unkItem;
strncpy(acStack104, gItemParametersData[id].name, 80);
ItemIdToSlot(&unkItem, id, 0);
ItemIdToItem(&unkItem, id, 0);
unkItem.quantity = 1;
sub_8090F58(dest, acStack104, &unkItem, a2);
}
@ -631,7 +625,7 @@ bool8 sub_809124C(u8 id, u8 param_3)
{
Item temp;
ItemIdToSlot(&temp, id, param_3);
ItemIdToItem(&temp, id, param_3);
return AddItemToInventory(&temp);
}
@ -640,7 +634,7 @@ bool8 AddHeldItemToInventory(BulkItem* slot)
{
Item temp;
HeldItemToSlot(&temp, slot);
BulkItemToItem(&temp, slot);
return AddItemToInventory(&temp);
}
@ -1098,7 +1092,7 @@ bool8 AddKecleonShopItem(u8 itemIndex)
BulkItem held;
s32 i;
xxx_init_helditem_8090B08(&held, itemIndex); // initialize
ItemIdToBulkItem(&held, itemIndex); // initialize
for (i = 0; i < MAX_KECLEON_ITEM_SHOP_ITEMS; i++) {
if (!gTeamInventoryRef->kecleonShopItems[i].id) {
@ -1214,7 +1208,7 @@ static bool8 AddKecleonWareItem(u8 itemIndex)
BulkItem held;
s32 i;
xxx_init_helditem_8090B08(&held, itemIndex); // initialize
ItemIdToBulkItem(&held, itemIndex); // initialize
for (i = 0; i < MAX_KECLEON_WARE_SHOP_ITEMS; i++) {
if (!gTeamInventoryRef->kecleonWareItems[i].id) {

View File

@ -669,14 +669,14 @@ static void sub_8017B88(void)
UpdateKangaskhanStorageState(28);
else {
gKangaskhanStorageWork->id = sub_801CB24();
ItemIdToSlot(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
ItemIdToItem(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
gKangaskhanStorageWork->storedItem.quantity = 1;
UpdateKangaskhanStorageState(25);
}
break;
case 4:
gKangaskhanStorageWork->id = sub_801CB24();
ItemIdToSlot(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
ItemIdToItem(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
gKangaskhanStorageWork->storedItem.quantity = 1;
UpdateKangaskhanStorageState(26);
break;

View File

@ -448,14 +448,14 @@ static void sub_80186F8(void)
}
else {
sUnknown_203B20C->id = sub_801CB24();
ItemIdToSlot(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
ItemIdToItem(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
sUnknown_203B20C->item.quantity = 1;
UpdateKangaskhanStorage2State(13);
}
break;
case 4:
sUnknown_203B20C->id = sub_801CB24();
ItemIdToSlot(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
ItemIdToItem(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
sUnknown_203B20C->item.quantity = 1;
UpdateKangaskhanStorage2State(14);
break;

View File

@ -779,7 +779,7 @@ static void sub_80199CC(void)
item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex);
}
ItemIdToSlot(&sKecleonBrosWork1->soldItem, item->id, 0);
ItemIdToItem(&sKecleonBrosWork1->soldItem, item->id, 0);
sKecleonBrosWork1->soldItem.quantity = item->quantity;
sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem);
SetKecleonBrosState(20);
@ -794,7 +794,7 @@ static void sub_80199CC(void)
item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex);
}
ItemIdToSlot(&sKecleonBrosWork1->soldItem, item->id, 0);
ItemIdToItem(&sKecleonBrosWork1->soldItem, item->id, 0);
sKecleonBrosWork1->soldItem.quantity = item->quantity;
sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem);
SetKecleonBrosState(KECLEON_STORE_BUY_ITEM_INFO);

View File

@ -271,13 +271,13 @@ bool8 RecycleMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param
{
Item *item = &gTeamInventoryRef->teamItems[i];
if (item->id == ITEM_TM_USED_TM) {
ItemIdToSlot(item, item->quantity + 0x7d,0);
ItemIdToItem(item, item->quantity + 0x7d,0);
isTMRecycled = TRUE;
}
}
}
if (ItemExists(&entityInfo->heldItem) && (entityInfo->heldItem.id == ITEM_TM_USED_TM)) {
ItemIdToSlot(&entityInfo->heldItem,entityInfo->heldItem.quantity + 0x7D,0);
ItemIdToItem(&entityInfo->heldItem,entityInfo->heldItem.quantity + 0x7D,0);
isTMRecycled = TRUE;
}
}

View File

@ -230,7 +230,7 @@ void HandlePartyListMenuCallback(void)
sub_8012D60(&sUnknown_203B2B8->unkCC,sUnknown_203B2B8->unk16C,0,sUnknown_203B2B8->unk20C,sUnknown_203B2B8->menuAction2,2);
break;
case 0x15:
HeldItemToSlot(&item,&sUnknown_203B2B8->item1);
BulkItemToItem(&item,&sUnknown_203B2B8->item1);
InitItemDescriptionWindow(&item);
break;
case PARTY_LIST_STATE_MOVES:
@ -672,7 +672,7 @@ void PartyListMenu_HandleMenu2(void)
AddHeldItemToInventory(&sUnknown_203B2B8->item2);
nextState = PARTY_LIST_STATE_GIVEN_ITEM_HELD_ITEM;
}
HeldItemToSlot(&slot,&sUnknown_203B2B8->item1);
BulkItemToItem(&slot,&sUnknown_203B2B8->item1);
temp.unk0 = 0;
temp.unk4 = 0;
temp.unk8 = 1;
@ -760,7 +760,7 @@ void sub_8026DAC(u32 r0, BulkItem *item)
CallPrepareTextbox_8008C54(r0);
sub_80073B8(r0);
HeldItemToSlot(&slot, item);
BulkItemToItem(&slot, item);
temp.unk0 = 0;
temp.unk4 = 0;
temp.unk8 = 1;

View File

@ -134,7 +134,7 @@ void sub_808CE74(s16 _species, bool32 _isLeader, u8* name)
}
}
void sub_808CFD0(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, DungeonLocation *location, u16 *moveID)
void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, const DungeonLocation *location, u16 *moves)
{
u8 name_buffer[20];
s32 i;
@ -143,7 +143,7 @@ void sub_808CFD0(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, DungeonL
u8 itemID = _itemID;
pokemon->flags = POKEMON_FLAG_EXISTS;
pokemon->isTeamLeader = 0;
pokemon->isTeamLeader = FALSE;
pokemon->level = 1;
pokemon->pokeHP = GetBaseHP(species);
pokemon->offense.att[0] = GetBaseOffensiveStat(species, 0);
@ -151,7 +151,7 @@ void sub_808CFD0(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, DungeonL
pokemon->offense.def[0] = GetBaseDefensiveStat(species, 0);
pokemon->offense.def[1] = GetBaseDefensiveStat(species, 1);
pokemon->speciesNum = species;
xxx_init_helditem_8090B08(&pokemon->heldItem, itemID);
ItemIdToBulkItem(&pokemon->heldItem, itemID);
pokemon->currExp = 0;
pokemon->tacticIndex = TACTIC_LETS_GO_TOGETHER;
pokemon->IQ = 1;
@ -160,22 +160,17 @@ void sub_808CFD0(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, DungeonL
pokemon->unkC[1].level = 0;
SetDefaultIQSkills(&pokemon->IQSkills, FALSE);
if(moveID != NULL)
{
for(i = 0; i < MAX_MON_MOVES; i++)
{
if(moveID[i] != 0)
{
InitZeroedPPPokemonMove(&pokemon->moves[i], moveID[i]);
if (moves != NULL) {
for (i = 0; i < MAX_MON_MOVES; i++) {
if (moves[i] != 0) {
InitZeroedPPPokemonMove(&pokemon->moves[i], moves[i]);
}
else
{
pokemon->moves[i].moveFlags = 0;
else {
ResetMoveFlags(&pokemon->moves[i]);
}
}
}
else
{
else {
sub_808E490(pokemon->moves, species);
}
@ -219,7 +214,7 @@ void ConvertStoryMonToPokemon(Pokemon *dst, struct StoryMonData *src)
dst->offense.def[0] = src->offenseDef[0];
dst->offense.def[1] = src->offenseDef[1];
dst->speciesNum = src->speciesNum;
xxx_init_helditem_8090B08(&dst->heldItem, src->itemID);
ItemIdToBulkItem(&dst->heldItem, src->itemID);
dst->currExp = src->currExp;
dst->tacticIndex = TACTIC_LETS_GO_TOGETHER;
dst->IQ = src->IQ;
@ -242,15 +237,14 @@ void ConvertStoryMonToPokemon(Pokemon *dst, struct StoryMonData *src)
}
}
Pokemon *sub_808D1DC(Pokemon *pokemon)
Pokemon *TryAddPokemonToRecruited(Pokemon *pokemon)
{
u32 friendArea;
s32 i;
s32 species = pokemon->speciesNum;
u32 friendArea = gMonsterParameters[species].friendArea;
s32 species = pokemon->speciesNum;
friendArea = gMonsterParameters[species].friendArea;
if(!gFriendAreas[friendArea]) return NULL;
if (!gFriendAreas[friendArea])
return NULL;
for (i = 0; i < NUM_MONSTERS; i++) {
if (!PokemonExists(&gRecruitedPokemonRef->pokemon[i])) {
u8 speciesFriendArea = sub_80923D4(i);
@ -267,14 +261,13 @@ Pokemon *sub_808D1DC(Pokemon *pokemon)
Pokemon *sub_808D278(s32 species)
{
u32 friendArea;
s32 i;
s16 species_s16 = (s16)species;
u32 friendArea = gMonsterParameters[species_s16].friendArea;
friendArea = gMonsterParameters[species_s16].friendArea;
if (!gFriendAreas[friendArea])
return NULL;
if(!gFriendAreas[friendArea]) return NULL;
for (i = 0; i < NUM_MONSTERS; i++) {
if (!PokemonExists(&gRecruitedPokemonRef->pokemon[i])) {
u8 speciesFriendArea = sub_80923D4(i);
@ -286,12 +279,12 @@ Pokemon *sub_808D278(s32 species)
return NULL;
}
Pokemon *sub_808D2E8(s32 species, u8 *name, u32 _itemID, DungeonLocation *location, u16 *moveID)
Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, const DungeonLocation *location, u16 *moveID)
{
Pokemon pokemon;
sub_808CFD0(&pokemon, species, name, (u8)_itemID, location, moveID);
return sub_808D1DC(&pokemon);
CreateLevel1Pokemon(&pokemon, species, name, (u8)_itemID, location, moveID);
return TryAddPokemonToRecruited(&pokemon);
}
void sub_808D31C(Pokemon *param_1)
@ -356,20 +349,17 @@ Pokemon * sub_808D3F8(void)
return NULL;
}
Pokemon * sub_808D434(s16 species, s32 param_2)
Pokemon *GetRecruitedMonBySpecies(s16 species_, s32 sameSpeciesCounter)
{
Pokemon *pokeStruct;
s32 index;
s32 counter;
s32 species_s32 = species;
s32 i;
s32 species = species_;
Pokemon *recruitMon = gRecruitedPokemonRef->pokemon;
s32 counter = 0;
pokeStruct = gRecruitedPokemonRef->pokemon;
counter = 0;
for(index = 0; index < NUM_MONSTERS; index++, pokeStruct++)
{
if(((PokemonExists(pokeStruct)) && (pokeStruct->speciesNum == species_s32))) {
if (counter == param_2)
return pokeStruct;
for (i = 0; i < NUM_MONSTERS; i++, recruitMon++) {
if (PokemonExists(recruitMon) && recruitMon->speciesNum == species) {
if (counter == sameSpeciesCounter)
return recruitMon;
counter++;
}
}
@ -921,9 +911,9 @@ bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 spriteId)
return (gMonsterParameters[index].dialogueSprites >> spriteId) & 1;
}
void xxx_pokemonstruct_index_to_pokemon2_808DE30(void* r0, u32 recruitedPokemonId)
void RecruitedPokemonToDungeonMon(DungeonMon *dst, u32 recruitedPokemonId)
{
PokemonToDungeonMon(r0, &gRecruitedPokemonRef->pokemon[recruitedPokemonId], recruitedPokemonId);
PokemonToDungeonMon(dst, &gRecruitedPokemonRef->pokemon[recruitedPokemonId], recruitedPokemonId);
}
void PokemonToDungeonMon(DungeonMon *dst, Pokemon *src, s32 recruitedPokemonId)
@ -956,7 +946,7 @@ void PokemonToDungeonMon(DungeonMon *dst, Pokemon *src, s32 recruitedPokemonId)
}
if (BulkItemExists(&src->heldItem)) {
HeldItemToSlot(&dst->itemSlot, &src->heldItem);
BulkItemToItem(&dst->itemSlot, &src->heldItem);
}
else {
ZeroOutItem(&dst->itemSlot);
@ -998,7 +988,7 @@ void DungeonMonToPokemon(Pokemon* dst, DungeonMon* src)
}
if (src->itemSlot.flags & ITEM_FLAG_EXISTS) {
SlotToHeldItem(&dst->heldItem, &src->itemSlot);
ItemToBulkItem(&dst->heldItem, &src->itemSlot);
}
else {
dst->heldItem.id = ITEM_NOTHING;
@ -1010,7 +1000,7 @@ void sub_808DFDC(s32 a1, DungeonMon* a2)
// transfer item from unk to pokemon at index
Pokemon* pokemon = &gRecruitedPokemonRef->pokemon[a1];
if (a2->itemSlot.flags & ITEM_FLAG_EXISTS) {
SlotToHeldItem(&pokemon->heldItem, &a2->itemSlot);
ItemToBulkItem(&pokemon->heldItem, &a2->itemSlot);
}
else {
pokemon->heldItem.id = ITEM_NOTHING;

View File

@ -245,7 +245,7 @@ Pokemon *sub_808F798(Pokemon *pokemon, s16 _species)
if (copy)
BoundedCopyStringtoBuffer(pokeStruct.name, GetMonSpecies(species), POKEMON_NAME_LENGTH);
return sub_808D1DC(&pokeStruct);
return TryAddPokemonToRecruited(&pokeStruct);
}
UNUSED static void sub_808F83C(Pokemon *pokemon, s16 species, u8 *r2)

View File

@ -278,7 +278,7 @@ void SetMonSummaryInfo(struct MonSummaryInfo *dst, struct Pokemon *pokemon, bool
}
}
dst->tactic = pokemon->tacticIndex;
HeldItemToSlot(&dst->item,&pokemon->heldItem);
BulkItemToItem(&dst->item,&pokemon->heldItem);
dst->IQ = pokemon->IQ;
dst->dungeonLocation = pokemon->dungeonLocation;
dst->unk44[0] = pokemon->unkC[0];

View File

@ -73,7 +73,6 @@ extern void sub_8084424(void);
extern void sub_8086130(void);
extern void sub_80847D4(void);
extern void sub_8043D60(void);
extern void sub_806890C(void);
extern void sub_80840A4(void);
extern void sub_80848F0(void);
extern void IncrementAdventureFloorsExplored(void);
@ -237,7 +236,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr)
if (!sub_80980A4() && gDungeon->unk644.dungeonLocation.id == DUNGEON_TINY_WOODS) {
sub_8043FD0();
}
sub_806890C();
SetDungeonMonsFromTeam();
}
if (r9) {