diff --git a/include/code_806CD90.h b/include/code_806CD90.h index 5b6aa9a8e..2714cadcf 100644 --- a/include/code_806CD90.h +++ b/include/code_806CD90.h @@ -17,7 +17,7 @@ u8 sub_806CEBC(Entity *entity); void sub_806CEFC(Entity *entity, u32 newDir); void sub_806CF18(Entity *entity); u8 sub_806CF54(Entity *entity); -void sub_806CF60(void); -u32 sub_806CF98(Entity *entity); +void DetermineAllMonsterShadow(void); +u32 DetermineMonsterShadow(Entity *entity); #endif // GUARD_CODE_806CD90_H diff --git a/include/dungeon_action.h b/include/dungeon_action.h index d8acfa2f8..b9f02a3c8 100644 --- a/include/dungeon_action.h +++ b/include/dungeon_action.h @@ -3,7 +3,7 @@ #include "structs/dungeon_entity.h" -void sub_8044C50(u16 action); +void SetLeaderActionFields(u16 action); void ClearMonsterActionFields(ActionContainer *actionPointer); void SetMonsterActionFields(ActionContainer *actionPointer, u16 action); void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species); diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index b324adcbb..d3d90a252 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -6,5 +6,6 @@ extern const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25]; void RunFractionalTurn(bool8 param_1); +bool8 IsFloorOver(void); #endif diff --git a/include/dungeon_info.h b/include/dungeon_info.h index e43250140..f08c6aab0 100644 --- a/include/dungeon_info.h +++ b/include/dungeon_info.h @@ -10,7 +10,9 @@ s32 GetDungeonFloorCount(u8 dungeon); s32 GetDungeonStartingFloor(u8 dungeon); const u8 *GetDungeonName1(u8 dungeon); bool8 IsStairDirectionUp(u8 dungeon); +bool8 IsLevelResetDungeon(u8 dungeon); u32 GetMaxItemsAllowed(u8 dungeon); +bool8 IsMoneyAllowed(u8 dungeon); s8 GetRescuesAllowed(u8 dungeon); bool8 HasCheckpoint(u8 dungeon); s16 GetRandomMovementChance(u8 dungeon); diff --git a/include/dungeon_items.h b/include/dungeon_items.h index 557f43559..0c1ca3f11 100644 --- a/include/dungeon_items.h +++ b/include/dungeon_items.h @@ -13,12 +13,12 @@ void sub_8045C18(u8 *buffer, Item *item); #define FORCE_STICKY_NEVER 2 void CreateItemWithStickyChance(Item *item, u8 itemID, u32 forceSticky); void CreateFloorItems(void); -void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg); -bool8 AddItemToDungeonAt(DungeonPos *pos, Item *item, bool8 a2); -bool8 RemoveItemFromDungeonAt(DungeonPos *pos, bool8 a2); +void TryLeaderItemPickUp(struct DungeonPos *pos, bool8 printMsg); +bool8 SpawnItem(DungeonPos *pos, Item *item, bool8 a2); +bool8 RemoveGroundItem(DungeonPos *pos, bool8 a2); bool8 sub_80462AC(Entity * entity, u8 hallucinating, u8 a2, u8 a3, u8 a4); const u8 *sub_80464AC(Item *item); -void sub_80464C8(Entity *entity, DungeonPos *pos, Item *item); +void SpawnDroppedItemWrapper(Entity *entity, DungeonPos *pos, Item *item); void SpawnDroppedItem(Entity *entity1, Entity *entity2, Item *item, bool8 a3, DungeonPos *pos); void sub_8046860(Entity *entity, DungeonPos *pos, Item *item, s32 a4); void sub_804687C(Entity *entity, DungeonPos *pos1, DungeonPos *pos2, Item *item, s32 count); diff --git a/include/dungeon_main.h b/include/dungeon_main.h index 33a51ce27..8093a4133 100644 --- a/include/dungeon_main.h +++ b/include/dungeon_main.h @@ -12,7 +12,7 @@ struct UnkMenuBitsStruct { void DungeonHandlePlayerInput(void); void sub_805E804(void); -void sub_805EE30(void); +void CheckLeaderTile(void); void sub_805EFB4(Entity *a0, bool8 a1); void sub_805F02C(void); ActionContainer *GetLeaderActionContainer(void); diff --git a/include/dungeon_map.h b/include/dungeon_map.h index 464d5cccd..4042b4c71 100644 --- a/include/dungeon_map.h +++ b/include/dungeon_map.h @@ -12,11 +12,11 @@ void OpenDungeonMapFile(void); void InitDungeonMap(bool8 a0); void CloseDungeonMapFile(void); void LoadDungeonMapPalette(void); -void ShowDungeonMapAtPos(s32 x, s32 y); +void DrawMinimapTile(s32 x, s32 y); void CopyDungeonMapToVram(void); -void ShowPlayerDotOnMap(void); +void FlashLeaderIcon(void); void ResetMapPlayerDotFrames(void); -void ShowWholeRevealedDungeonMap(void); +void UpdateMinimap(void); void UpdateBgTilemapForDungeonMap(bool8 a0); void TryResetDungeonMapTilesScheduledForCopy(void); diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index 7a5cdf39f..fffa44244 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -6,8 +6,8 @@ const Tile *GetTile(s32 x, s32 y); Tile *GetTileMut(s32 x, s32 y); -void sub_8049ED4(void); -void sub_804AC20(DungeonPos *pos); +void UpdateTrapsVisibility(void); +void DiscoverMinimap(DungeonPos *pos); void sub_80495E4(void); void LoadDungeonTilesetAssets(void); diff --git a/include/dungeon_message.h b/include/dungeon_message.h index a4fc79a83..67ba61848 100644 --- a/include/dungeon_message.h +++ b/include/dungeon_message.h @@ -35,7 +35,7 @@ void LogMessageByIdWithPopupCheckUser(Entity *pokemon, const u8 *str); void TryDisplayDungeonLoggableMessage2(Entity *pokemon, const u8 *str); void TryDisplayDungeonLoggableMessage3(Entity *attacker, Entity *target, const u8 *str); void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u8 *str); -void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos, const u8 *str); +void LogMessageByIdWithPopupCheckUserUnknown(Entity *pokemon, DungeonPos *pos, const u8 *str); // As opposed to the above - these always display the string and save it in the message log. False/True stand for an unknown argument. Not sure what the practical difference is between these. void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str); @@ -51,7 +51,7 @@ bool32 DisplayDungeonYesNoMessage(struct MonDialogueSpriteInfo *monSpriteInfo, c s32 DisplayDungeonMenuMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const u8 *str, const MenuItem *menuItems, u16 unkArg); void sub_8052D44(s16 *ids, Entity *leader, Entity *partner); void TryDisplayGeneralTutorialMessage(void); -void TryDisplayItemPickupTutorialMessage(u8 itemId); +void DisplayItemTip(u8 itemId); void DisplayYouReachedDestFloorStr(void); void sub_8052FB8(const u8 *str); const u8 *GetCurrentDungeonName(void); diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index 3874bd647..4b5b018d8 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -35,7 +35,7 @@ void sub_8068A84(Pokemon *pokemon); void sub_8068BDC(bool8 a0); void sub_8068F28(void); void sub_8068F80(void); -void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3); +void HandleFaint(Entity *entity, s32 param_2, Entity *param_3); void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4); void sub_80695EC(Entity *param_1,int x,int y); Entity * sub_8069660(Entity *target); @@ -47,14 +47,14 @@ bool8 sub_8069D18(DungeonPos *pos,Entity *entity); void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target); void TargetTileInFront(Entity *pokemon); void sub_8069E0C(Entity *pokemon); -void TriggerWeatherAbilities(void); +void TryActivateArtificialWeatherAbilities(void); s32 GetMonsterApparentID(Entity *pokemon, s32 _id); void sub_8069F9C(Entity *pokemon, Entity *target, Move *move); void sub_806A120(Entity * pokemon, Entity * target, Move* move); void sub_806A1B0(Entity *pokemon); void sub_806A1E8(Entity *pokemon); void sub_806A240(Entity *pokemon, Entity *target); -void sub_806A2BC(Entity *pokemon, u8 param_2); +void TryPointCameraToMonster(Entity *pokemon, u8 param_2); void sub_806A338(void); void sub_806A390(Entity *pokemon); void sub_806A3D4(u8 *dst, s32 _a1, s32 id, bool32 _a3); diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 187db092b..0b5e522c6 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -16,16 +16,17 @@ bool8 EntityIsValid(Entity *pokemon); u32 GetEntityType(Entity *entity); u8 GetEntityRoom(Entity *entity); Tile *GetTileAtEntitySafe(Entity *entity); -void sub_804535C(Entity *entity, PixelPos *pos); +void UpdateEntityPixelPos(Entity *entity, PixelPos *pos); void SetEntityPixelPos(Entity *entity, s32 x, s32 y); void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y); -Item *GetItemData(Entity *entity); +Item *GetItemInfo(Entity *entity); Item *GetItemData_1(Entity *entity); -Trap *GetTrapData(Entity *entity); +Trap *GetTrapInfo(Entity *entity); Trap* GetTrapData_1(Entity *entity); Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c); -Entity *sub_8045708(DungeonPos *pos); +Entity *SpawnItemEntity(DungeonPos *pos); void sub_80457DC(Entity* ent); +bool8 ShouldDisplayEntity(Entity *ent); bool8 CanSeeTarget(Entity *entity, Entity *targetEntity); bool8 CanTargetEntity(Entity *entity, Entity *targetEntity); bool8 sub_8045A70(Entity *entity, Entity *targetEntity); diff --git a/include/items.h b/include/items.h index 024dd9490..57f8e392d 100644 --- a/include/items.h +++ b/include/items.h @@ -45,22 +45,22 @@ void LoadItemParameters(void); TeamInventory *GetMoneyItemsInfo(void); void InitializeMoneyItems(void); s32 GetNumberOfFilledInventorySlots(void); -bool8 IsThrowableItem(u8 id); +bool8 IsThrownItem(u8 id); void ItemIdToItem(Item *item, u8 id, bool8 makeSticky); -void ItemIdToBulkItem(BulkItem *dst, u8 id); +void InitBulkItem(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); -s32 GetStackBuyPrice(Item *param_1); -s32 GetStackSellPrice(Item *param_1); +s32 GetActualBuyPrice(Item *param_1); +s32 GetActualSellPrice(Item *param_1); s32 GetItemBuyPrice(u8 id); s32 GetItemSellPrice(u8 id); s32 GetItemOrder(u8 id); s32 GetItemPalette(u8 id); u32 GetItemActionType(u8 id); -u32 GetSpawnAmountRange(u8 id, u32 r1); +u32 GetThrownItemQuantityLimit(u8 id, u32 r1); u8 *GetItemDescription(u8 id); bool8 TestItemAIFlag(u8 id, u32 aiFlag); void BufferItemName(u8 *, u8 id, unkStruct_8090F58 *); @@ -70,7 +70,7 @@ void ConvertMoneyItemToMoney(); void AddToTeamMoney(s32 amount); u32 GetMoneyValue(Item* slot); u16 GetItemMoveID(u8 index); -bool8 CanSellItem(u32 id); +bool8 IsShoppableItem(u32 id); bool8 IsGummiItem(u8); void ShiftItemsDownFrom(s32 start); void ClearItemSlotAt(u32 index); diff --git a/include/pokemon.h b/include/pokemon.h index 1af299928..e9b8ea12a 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -109,7 +109,7 @@ s32 GetUnitSum_808D544(s32 *); s32 sub_808D580(s32 *); bool8 ComparePokemonNames(s16, s16); void PrintPokeNameToBuffer(u8 *buffer, Pokemon *pokemon); -void GetPokemonLevelData(LevelData* a1, s32 _id, s32 level); +void GetLvlUpEntry(LevelData* a1, s32 _id, s32 level); const u8* DecompressMoveID(const u8* a1, u16* moveID); bool8 sub_808DA44(s32, u32); void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src); diff --git a/include/run_dungeon.h b/include/run_dungeon.h index 0402fa5e6..67f962e87 100644 --- a/include/run_dungeon.h +++ b/include/run_dungeon.h @@ -22,7 +22,7 @@ bool8 sub_8043CE4(s32 dungeonId); u8 GetFloorType(void); void sub_8043D50(s32 *a0, s32 *a1); void sub_8043D60(void); -bool8 sub_8043ED0(bool8 a0); +bool8 TryForcedLoss(bool8 a0); void EnforceMaxItemsAndMoney(void); bool8 IsBossFight(void); bool8 IsCurrentFixedRoomBossFight(void); diff --git a/include/trap.h b/include/trap.h index 0f105d064..ae07d1579 100644 --- a/include/trap.h +++ b/include/trap.h @@ -12,7 +12,7 @@ bool8 sub_807FD84(Entity *entity); bool8 sub_807FE04(DungeonPos *pos, char param_2); bool8 sub_807FE44(DungeonPos *pos, char param_2); void GetTrapName(u8 *buffer, u8 trapIndex); -void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); +void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); void HandleMudTrap(Entity *pokemon, Entity *target); void HandleStickyTrap(Entity *pokemon, Entity *target); void HandleGrimyTrap(Entity *pokemon, Entity *target); diff --git a/src/blow_away.c b/src/blow_away.c index 7555c2e66..fcdb75a34 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -29,13 +29,12 @@ void sub_804EB30(); bool8 ExposeTrap(s32 x, s32 y); -u8 sub_8045888(Entity *); void sub_807EC28(u32); -u8 sub_8044B28(void); +u8 IsFloorOver(void); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); -extern void sub_803F580(u32); +extern void UpdateCamera(u32); bool8 sub_808384C(DungeonPos *, DungeonPos *); u8 sub_8083660(DungeonPos *); @@ -93,7 +92,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) for(iVar8 = 0; iVar8 < 6; iVar8++) { IncreaseEntityPixelPos(target,pos32.x,pos32.y); - if (sub_8045888(target) != 0) { + if (ShouldDisplayEntity(target) != 0) { DungeonRunFrameActions(0x19); } } @@ -118,7 +117,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) sub_807D068(target,&target->pos); sub_806F370(pokemon,target,gBlowAwayDmgValue,0,0,0,0x219,0,0,0); } - if (sub_8044B28()) { + if (IsFloorOver()) { return; } if (entity != NULL) { @@ -128,7 +127,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) sub_806F370(pokemon,entity,gBlowAwayDmgValue,0,0,0,0x21a,0,0,0); } } - if (sub_8044B28()) { + if (IsFloorOver()) { return; } if (!EntityIsValid(target)) { @@ -145,7 +144,7 @@ void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) if (GetEntInfo(target)->isTeamLeader) { gDungeon->unk1 = 0; gDungeon->unk5C0 = -1; - sub_804AC20(&target->pos); + DiscoverMinimap(&target->pos); sub_807EC28(FALSE); } sub_806A5B8(target); @@ -187,8 +186,8 @@ void sub_807D068(Entity *pokemon, DungeonPos *pos) local_34.x = pixelX; local_34.y = pixelY; pokemon->unk1C.raw = sin_4096(iVar8) * 0xc; - sub_804535C(pokemon, &local_34); - if (sub_8045888(pokemon)) { + UpdateEntityPixelPos(pokemon, &local_34); + if (ShouldDisplayEntity(pokemon)) { DungeonRunFrameActions(0x1a); } iVar8 = iVar8 + 0xaa; @@ -197,6 +196,6 @@ void sub_807D068(Entity *pokemon, DungeonPos *pos) local_34.x = posX; local_34.y = posY; pokemon->unk1C = IntToF248(0); - sub_804535C(pokemon,&local_34); + UpdateEntityPixelPos(pokemon,&local_34); DungeonRunFrameActions(0x1a); } diff --git a/src/code_801B60C.c b/src/code_801B60C.c index aae966bff..c66d00bb9 100644 --- a/src/code_801B60C.c +++ b/src/code_801B60C.c @@ -41,7 +41,7 @@ bool8 sub_801B60C(u32 r0, u8 id, u8 quantity) sUnknown_203B234->unk0 = r0; sUnknown_203B234->unk10.id = id; - if (IsThrowableItem(sUnknown_203B234->unk10.id)) { + if (IsThrownItem(sUnknown_203B234->unk10.id)) { sUnknown_203B234->unk10.quantity = quantity; sUnknown_203B234->unkC = quantity; } diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index a61e9d422..e4329ad2b 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -52,7 +52,6 @@ extern void sub_80429A0(Entity *); void sub_8042B34(s32 a0, s32 a1, s32 a2); extern bool8 sub_8042CC0(void); extern void sub_8042D7C(void); -extern bool8 sub_8045888(Entity *); extern void sub_800F15C(s32); extern void sub_800EF40(u8 r0, u8 r1); extern s32 sub_800E6D8(s32); @@ -1220,7 +1219,7 @@ s32 sub_8042520(Entity *a0) unkStruct_80416E0 local_58; PixelPos local_2c; - if (sub_8045888(a0)) { + if (ShouldDisplayEntity(a0)) { dir = GetEntInfo(a0)->action.direction; pos.x = a0->pixelPos.x / 0x100; pos.y = a0->pixelPos.y / 0x100; @@ -1327,7 +1326,7 @@ bool8 sub_8042768(Entity* pokemon) else return FALSE; } - return sub_8045888(pokemon); + return ShouldDisplayEntity(pokemon); } void sub_80427AC(void) diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 208ed307e..b6d2f2a35 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -39,10 +39,10 @@ #include "trap.h" #include "dungeon_pos_data.h" #include "dungeon_projectile_throw.h" +#include "dungeon_engine.h" -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void sub_8057588(Entity * pokemon, u8 param_2); -extern bool8 sub_8045888(Entity *); extern Item *sub_8044D90(Entity *, s32, u32); u8 sub_8048D50(); void sub_8042208(Entity *pokemon, u8 r1); @@ -51,7 +51,6 @@ void sub_80479B8(); extern void sub_807AB38(Entity *, u32); extern Entity * sub_8044DA4(Entity *param_1,int param_2); extern void sub_8044DF0(Entity *, u32, u32); -extern bool8 sub_8044B28(void); Entity *sub_806773C(Entity *entity); void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2); void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2); @@ -62,7 +61,7 @@ extern void sub_8084448(Entity *entity); void HandlePickUpPlayerAction(Entity *entity) { GetEntInfo(entity)->action.actionParameters[0].actionUseIndex = 1; - PickUpItemFromPos(&entity->pos,0); + TryLeaderItemPickUp(&entity->pos,0); } void HandleSetItemAction(Entity *param_1, bool8 param_2) @@ -171,7 +170,7 @@ void HandleGiveItemAction(Entity *param_1) item2.flags &= ~(ITEM_FLAG_SET); sub_8044DF0(param_1,0,100); if (bVar3) { - AddItemToDungeonAt(¶m_1->pos,&item1,1); + SpawnItem(¶m_1->pos,&item1,1); } else { AddItemToInventory(&item1); @@ -329,7 +328,7 @@ void HandlePlaceItemAction(Entity *entity) else { item->flags &= ~(ITEM_FLAG_SET); sub_8045BF8(gFormatBuffer_Items[0],item); - if (AddItemToDungeonAt(&entity->pos,item,1) == 0) { + if (SpawnItem(&entity->pos,item,1) == 0) { LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E04); } else { @@ -375,9 +374,9 @@ void sub_8066E14(Entity *entity) newItems[0].flags &= ~(ITEM_FLAG_SET); newItems[1].flags &= ~(ITEM_FLAG_SET); - RemoveItemFromDungeonAt(&info->action.actionParameters[0].itemPos,1); + RemoveGroundItem(&info->action.actionParameters[0].itemPos,1); ZeroOutItem(item[1]); - if (!AddItemToDungeonAt(&info->action.actionParameters[0].itemPos,&newItems[1],1)) { + if (!SpawnItem(&info->action.actionParameters[0].itemPos,&newItems[1],1)) { LogMessageByIdWithPopupCheckUser(entity,gNothingCanBePutDownHere); } else { @@ -420,16 +419,16 @@ void sub_8066FA4(Entity *entity) else { Item newItems[2]; - item[1] = GetItemData(tile->object); + item[1] = GetItemInfo(tile->object); sub_8045BF8(gFormatBuffer_Items[1],item[1]); newItems[0] = *item[0]; newItems[1] = *item[1]; newItems[0].flags &= ~(ITEM_FLAG_SET); newItems[1].flags &= ~(ITEM_FLAG_SET); - RemoveItemFromDungeonAt(&entity->pos,1); + RemoveGroundItem(&entity->pos,1); ZeroOutItem(item[0]); - if (!AddItemToDungeonAt(&entity->pos, &newItems[0],1)) { + if (!SpawnItem(&entity->pos, &newItems[0],1)) { LogMessageByIdWithPopupCheckUser(entity,gNothingCanBePutDownHere); } else { @@ -498,7 +497,7 @@ void sub_80671A0(Entity *entity) if (info->action.actionParameters[0].actionUseIndex == 0x80) { item = NULL; - RemoveItemFromDungeonAt(&info->action.actionParameters[0].itemPos, 1); + RemoveGroundItem(&info->action.actionParameters[0].itemPos, 1); } r7 = TRUE; @@ -515,7 +514,7 @@ void sub_80671A0(Entity *entity) else { if (info->action.actionParameters[0].actionUseIndex == 0x80) { newItem.quantity--; - AddItemToDungeonAt(&info->action.actionParameters[0].itemPos, &newItem, 1); + SpawnItem(&info->action.actionParameters[0].itemPos, &newItem, 1); } else { item->quantity--; @@ -526,7 +525,7 @@ void sub_80671A0(Entity *entity) info->action.direction = DungeonRandInt(NUM_DIRECTIONS); } - if (sub_8045888(entity)) { + if (ShouldDisplayEntity(entity)) { s32 i; s32 dir = info->action.direction; sub_80421C0(entity, 0x164); @@ -743,7 +742,7 @@ void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2) u8 tempText[64]; strncpy(tempText, gFormatBuffer_Monsters[0], sizeof(tempText)); - sub_8068FE0(targetEntity, 0x21D, 0); + HandleFaint(targetEntity, 0x21D, 0); strncpy(gFormatBuffer_Monsters[0], tempText, sizeof(tempText)); DisplayDungeonMessage(NULL, stringPtr2, TRUE); } @@ -757,7 +756,7 @@ void HandleUseMovePlayerAction(Entity *entity) EntityInfo *info = GetEntInfo(entity); sub_8055A00(entity, info->action.actionParameters[1].actionUseIndex, 1, 0, 0); - if (sub_8044B28()) { + if (IsFloorOver()) { break; } if (info->unk159 != 0) { @@ -767,7 +766,7 @@ void HandleUseMovePlayerAction(Entity *entity) } sub_8057588(entity, 1); - if (!sub_8044B28()) { + if (!IsFloorOver()) { if (EntityIsValid(entity)) { sub_806A9B4(entity, GetEntInfo(entity)->action.actionParameters[1].actionUseIndex); } @@ -826,7 +825,7 @@ void sub_8067904(Entity *entity, u16 moveId) pos.y = entity->pos.y + gAdjacentTileOffsets[info->action.direction].y; sub_807FE44(&pos, 1); } - sub_8071DA4(entity); + EnemyEvolution(entity); } } } diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index deaa01a85..c752030bd 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -39,10 +39,9 @@ extern void sub_8042900(Entity *r0); extern void sub_8042968(Entity *r0); extern void EndAbilityImmuneStatus(Entity *, Entity *); void sub_8041BBC(Entity *r0); -extern bool8 sub_8045888(Entity *); -extern void sub_806A2BC(Entity *, u8); +extern void TryPointCameraToMonster(Entity *, u8); extern void sub_804178C(u32); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern void sub_8042B20(Entity *entity); extern void sub_8042B0C(Entity *entity); extern void sub_8072AC8(u16 *param_1, s32 species, s32 param_3); @@ -56,8 +55,8 @@ extern u8 GetRandomFloorItem(s32 a0); extern void sub_80429E8(Entity *r0); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void sub_803F580(s32); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateCamera(s32); +extern void UpdateMinimap(void); extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); extern Entity *sub_80696A8(Entity *a0); @@ -742,7 +741,7 @@ void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, entity->pos.y = -2; sub_80694C0(entity, structPtr->pos.x, structPtr->pos.y, 1); - sub_804535C(entity, NULL); + UpdateEntityPixelPos(entity, NULL); if (!a0) { if (structPtr->species == MONSTER_KECLEON @@ -1057,7 +1056,7 @@ s32 sub_806C444(s32 _species, s32 level) s32 hpCount = GetBaseHP(species); for (i = 2; i <= level; i++) { - GetPokemonLevelData(&levelData, species, i); + GetLvlUpEntry(&levelData, species, i); hpCount += levelData.gainHP; } @@ -1072,7 +1071,7 @@ s32 sub_806C488(s32 _species, s32 level, s32 categoryIndex) s32 offensiveCount = GetBaseOffensiveStat(species, categoryIndex); for (i = 2; i <= level; i++) { - GetPokemonLevelData(&levelData, species, i); + GetLvlUpEntry(&levelData, species, i); offensiveCount += levelData.gainAtt[categoryIndex]; } @@ -1087,7 +1086,7 @@ s32 sub_806C4D4(s32 _species, s32 level, s32 categoryIndex) s32 defensiveCount = GetBaseDefensiveStat(species, categoryIndex); for (i = 2; i <= level; i++) { - GetPokemonLevelData(&levelData, species, i); + GetLvlUpEntry(&levelData, species, i); defensiveCount += levelData.gainDef[categoryIndex]; } diff --git a/src/code_806CD90.c b/src/code_806CD90.c index b82b307e9..eb2a5e151 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -486,7 +486,7 @@ u8 sub_806CF54(Entity *entity) return GetEntInfo(entity)->unk204; } -void sub_806CF60(void) +void DetermineAllMonsterShadow(void) { Entity *entity; s32 i; @@ -495,11 +495,11 @@ void sub_806CF60(void) entity = gDungeon->activePokemon[i]; if (EntityIsValid(entity)) - sub_806CF98(entity); + DetermineMonsterShadow(entity); } } -u32 sub_806CF98(Entity *entity) +u32 DetermineMonsterShadow(Entity *entity) { const Tile *mapTile; u32 shadowSize; diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index b1dc4c941..8590c879e 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -274,7 +274,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa UnlockFriendArea(friendArea); flag = TRUE; } - sub_8068FE0(entity2,500,entity1); + HandleFaint(entity2,500,entity1); pokeStruct2 = &gRecruitedPokemonRef->dungeonTeam[pokeIndex]; pokeStruct2->flags = 3; pokeStruct2->isTeamLeader = FALSE; @@ -441,7 +441,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) flag = TRUE; } IncrementAdventureNumJoined(); - sub_8068FE0(entity2,500,entity1); + HandleFaint(entity2,500,entity1); if (sub_806B8CC(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) { pokeStruct2->flags = 0; } diff --git a/src/code_80718D8.c b/src/code_80718D8.c index 5b54cf8ed..9b8ac87f5 100644 --- a/src/code_80718D8.c +++ b/src/code_80718D8.c @@ -37,8 +37,7 @@ void sub_8083D78(void); void sub_8083D58(void); void sub_8072778(Entity *, Entity *, u8, u8); bool8 sub_80725A4(Entity *, Entity *); -void GetAvailTacticsforLvl_Bool(u8 *tacticsBuffer, s32 pokeLevel); -bool8 sub_80723D0(Entity *, Entity *, u8, u8); +void GetUnlockedTacticFlags(u8 *tacticsBuffer, s32 pokeLevel); void sub_807218C(Entity *); extern void sub_8072B78(Entity *pokemon, Entity *target, s16 id); @@ -53,6 +52,8 @@ static const u8 * const gUnknown_8107018[3] = { _("\n"), }; +static bool8 LevelUp(Entity *, Entity *, u8, u8); + void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp) { s32 newExp; @@ -75,7 +76,7 @@ void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp) } } -void sub_8071DA4(Entity *entity) +void EnemyEvolution(Entity *entity) { int counter; s16 *id; @@ -116,7 +117,7 @@ void sub_8071DA4(Entity *entity) s32 expGained = info->expGainedInTurn; if (expGained != 0) { if (info->isTeamLeader) { - GetAvailTacticsforLvl_Bool(tacticsBuffer1, info->level); + GetUnlockedTacticFlags(tacticsBuffer1, info->level); } maxHP = info->maxHPStat; atk[0] = info->atk[0]; @@ -128,7 +129,7 @@ void sub_8071DA4(Entity *entity) gFormatArgs[0] = expGained; SetMessageArgument_2(gFormatBuffer_Monsters[0],info,0); TryDisplayDungeonLoggableMessage3(entityPtr,target,gUnknown_80F9E64); // $m0 gained $d0 Exp Points - flag = sub_80723D0(entityPtr,target,1,1); + flag = LevelUp(entityPtr,target,1,1); } } if (info->unk149 != 0) { @@ -161,7 +162,7 @@ void sub_8071DA4(Entity *entity) if ((expGained != 0) && (info->isTeamLeader)) { s32 tacticIndex; - GetAvailTacticsforLvl_Bool(tacticsBuffer2,info->level); + GetUnlockedTacticFlags(tacticsBuffer2,info->level); for(tacticIndex = 0; tacticIndex < NUM_TACTICS; tacticIndex++) { if ((tacticsBuffer1[tacticIndex] == 0) && (tacticsBuffer2[tacticIndex] == 1)) { @@ -177,7 +178,6 @@ void sub_8071DA4(Entity *entity) } } } - return; } void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 param_5) @@ -197,7 +197,7 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para flag = 0; info = GetEntInfo(target); if (info->isTeamLeader) { - GetAvailTacticsforLvl_Bool(tacticsBuffer1,info->level); + GetUnlockedTacticFlags(tacticsBuffer1,info->level); } maxHP = info->maxHPStat; atk[0] = info->atk[0]; @@ -210,9 +210,9 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para newLevel = 100; } if (newLevel != info->level) { - GetPokemonLevelData(&leveldata,info->id,newLevel); + GetLvlUpEntry(&leveldata,info->id,newLevel); info->exp = leveldata.expRequired; - flag |= (sub_80723D0(pokemon,target,param_4,param_5)); + flag |= (LevelUp(pokemon,target,param_4,param_5)); if ((flag != 0) && (!info->isNotTeamMember)) { gFormatArgs[0] = info->maxHPStat - maxHP; gFormatArgs[1] = info->atk[0] - atk[0]; @@ -226,7 +226,7 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para } } if (info->isTeamLeader) { - GetAvailTacticsforLvl_Bool(tacticsBuffer2,info->level); + GetUnlockedTacticFlags(tacticsBuffer2,info->level); for(tacticIndex = 0; tacticIndex < NUM_TACTICS; tacticIndex++) { if ((tacticsBuffer1[tacticIndex] == 0) && (tacticsBuffer2[tacticIndex] == 1)) { @@ -256,7 +256,7 @@ void sub_807218C(Entity *pokemon) r6 = 0; info = GetEntInfo(pokemon); - sub_806A2BC(pokemon, 0); + TryPointCameraToMonster(pokemon, 0); SetMessageArgument_2(gFormatBuffer_Monsters[0], info, 0); if(sub_8070BC0(pokemon)) { @@ -322,7 +322,7 @@ void sub_807218C(Entity *pokemon) if(buffer[0]) DisplayDungeonMessage(0, buffer, 1); - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); } void LevelDownTarget(Entity *pokemon, Entity *target, u32 level) @@ -344,7 +344,7 @@ void LevelDownTarget(Entity *pokemon, Entity *target, u32 level) if(newLevel != info->level) { - GetPokemonLevelData(&leveldata, info->id, newLevel); + GetLvlUpEntry(&leveldata, info->id, newLevel); info->exp = leveldata.expRequired; flag |= sub_80725A4(pokemon, target); } @@ -360,7 +360,7 @@ void LevelDownTarget(Entity *pokemon, Entity *target, u32 level) } } -bool8 sub_80723D0(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) +static bool8 LevelUp(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) { EntityInfo *info; LevelData leveldata; @@ -380,7 +380,7 @@ bool8 sub_80723D0(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) for(level = info->level + 1; level <= 100; level++) { - GetPokemonLevelData(&leveldata, id, level); + GetLvlUpEntry(&leveldata, id, level); if(leveldata.expRequired > exp) break; info->level = level; @@ -390,7 +390,7 @@ bool8 sub_80723D0(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) { if(!info->isNotTeamMember) { - sub_806A2BC(target, 0); + TryPointCameraToMonster(target, 0); if(!flag) sub_8083D58(); gFormatArgs[0] = level; @@ -476,7 +476,7 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target) for(level = 1; level < info->level; level++) { - GetPokemonLevelData(&leveldata, id, level); + GetLvlUpEntry(&leveldata, id, level); if(leveldata.expRequired >= exp) break; } @@ -486,7 +486,7 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target) { if(level < 100) { - GetPokemonLevelData(&leveldata, id, level + 1); + GetLvlUpEntry(&leveldata, id, level + 1); info->exp = leveldata.expRequired - 1; } else @@ -496,7 +496,7 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target) if(oldLevel > level) { - GetPokemonLevelData(&leveldata, id, level + 1); + GetLvlUpEntry(&leveldata, id, level + 1); info->level = level; @@ -789,7 +789,7 @@ void sub_8072B78(Entity *pokemon, Entity *target, s16 id) CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1],id_s32); file = GetSpriteData(id_s32); fu(entityInfo, id_s32); - GetPokemonLevelData(&levelData,id_s32,entityInfo->level); + GetLvlUpEntry(&levelData,id_s32,entityInfo->level); entityInfo->exp = levelData.expRequired; target->axObj.spriteFile = file; ResetMonEntityData(entityInfo,0); diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index c2b2418b8..ef23d906d 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -30,8 +30,8 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_strings.h" +#include "dungeon_engine.h" -extern bool8 sub_8044B28(void); extern void DealDamageToEntity(Entity *, s32, u32, u32); extern void sub_805229C(void); extern void sub_807E8F0(Entity *); @@ -42,19 +42,18 @@ extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); extern void sub_80838EC(u8 *a); extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *); -extern bool8 sub_8045888(Entity *); extern void nullsub_97(Entity *entity); extern void sub_805EE30(void); extern void sub_8086AC0(void); extern void sub_8085140(void); extern void sub_8075708(Entity *entity); extern void sub_8043ED0(u32); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void sub_8075900(Entity *pokemon, u8 r1); extern void sub_806A5B8(Entity *); extern void sub_807EC28(bool8); -bool8 UseAttack(Entity *a0); +bool8 DisplayActions(Entity *a0); void sub_8074094(Entity *entity) { @@ -63,7 +62,7 @@ void sub_8074094(Entity *entity) if (entity == NULL) return; - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo = GetEntInfo(entity); @@ -76,8 +75,8 @@ void sub_8074094(Entity *entity) if (DungeonRandInt(100) < gWarpScarfActivationChances[entityInfo->turnsSinceWarpScarfActivation]) { entityInfo->turnsSinceWarpScarfActivation = 0; sub_80444F4(entity); - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; WarpTarget(entity, entity, 0, NULL); if (entityInfo->isTeamLeader) { @@ -137,8 +136,8 @@ void sub_8074094(Entity *entity) if (FixedPointToInt(entityInfo->belly) == 0) { sub_805E804(); sub_80444F4(entity); - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; if (gDungeon->unk644.unk35 < 10) gDungeon->unk644.unk35++; @@ -167,7 +166,7 @@ void sub_8074094(Entity *entity) } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (gDungeon->weather.weatherDamageCounter == 0) { if (GetApparentWeather(entity) == WEATHER_HAIL) { @@ -180,15 +179,15 @@ void sub_8074094(Entity *entity) DealDamageToEntity(entity, gHailSandstormDmgValue, 0x12, 0x220); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } // Abilities check rand = DungeonRandInt(100); if (AbilityIsActive(entity, ABILITY_SHED_SKIN) && rand < gShedSkinActivateChance && HasNegativeStatus(entity)) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; sub_8079F20(entity, entity, 1, 0); } @@ -202,35 +201,35 @@ void sub_8074094(Entity *entity) // Statuses if (entityInfo->sleepClassStatus.status == STATUS_YAWNING) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; sub_80420B8(entity); } if (entityInfo->burnClassStatus.status == STATUS_BURN) { if (entityInfo->burnClassStatus.damageCountdown == 0 || --entityInfo->burnClassStatus.damageCountdown == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->burnClassStatus.damageCountdown = gBurnDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gBurnDmgValue, 1, 0x208); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } if (entityInfo->burnClassStatus.status == STATUS_POISONED) { if (entityInfo->burnClassStatus.damageCountdown == 0 || --entityInfo->burnClassStatus.damageCountdown == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->burnClassStatus.damageCountdown = gPoisonDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gPoisonDmgValue, 3, 0x20A); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } else if (entityInfo->burnClassStatus.status == STATUS_BADLY_POISONED) { @@ -242,46 +241,46 @@ void sub_8074094(Entity *entity) if (turns >= BAD_POISON_DMG_TURN_VALUES_COUNT - 1) turns = BAD_POISON_DMG_TURN_VALUES_COUNT - 1; - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gBadPoisonDmgValuesByTurn[turns], 3, 0x20A); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } if (entityInfo->frozenClassStatus.status == STATUS_CONSTRICTION) { if (entityInfo->frozenClassStatus.damageCountdown == 0 || --entityInfo->frozenClassStatus.damageCountdown == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->frozenClassStatus.damageCountdown = gConstrictionDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); sub_8041C4C(entity, entityInfo->frozenClassStatus.unk4); DealDamageToEntity(entity, gConstrictionDmgValue, 2, 0x209); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } else if (entityInfo->frozenClassStatus.status == STATUS_WRAPPED) { if (entityInfo->frozenClassStatus.damageCountdown == 0 || --entityInfo->frozenClassStatus.damageCountdown == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->frozenClassStatus.damageCountdown = gWrapDmgCountdown; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, gWrapDmgValue, 5, 0x20B); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } else if (entityInfo->frozenClassStatus.status == STATUS_INGRAIN) { if (entityInfo->frozenClassStatus.damageCountdown == 0 || --entityInfo->frozenClassStatus.damageCountdown == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->frozenClassStatus.damageCountdown = gIngrainHealCountdown; HealTargetHP(entity, entity, gIngrainHealValue, 0, TRUE); @@ -294,14 +293,14 @@ void sub_8074094(Entity *entity) if (dmg == 0) dmg = 1; entityInfo->curseClassStatus.damageCountdown = gCurseDmgCountdown; - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; TrySendImmobilizeSleepEndMsg(entity, entity); DealDamageToEntity(entity, dmg, 7, 0x20C); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } @@ -322,8 +321,8 @@ void sub_8074094(Entity *entity) else { bool8 dmgUser = AbilityIsActive(entity, ABILITY_LIQUID_OOZE); sub_80444F4(entity); - UseAttack(NULL); - if (!EntityIsValid(entity) || !EntityIsValid(target) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || !EntityIsValid(target) || IsFloorOver()) return; if (entityInfo->frozenClassStatus.status != STATUS_FROZEN) { @@ -340,15 +339,15 @@ void sub_8074094(Entity *entity) } } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } if (entityInfo->perishSongTurns != 0) { sub_80838EC(&entityInfo->perishSongTurns); if (entityInfo->perishSongTurns == 0) { - UseAttack(NULL); - if (!EntityIsValid(entity) || sub_8044B28()) + DisplayActions(NULL); + if (!EntityIsValid(entity) || IsFloorOver()) return; SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1], entity, 0); LogMessageByIdWithPopupCheckUser(entity, gUnknown_80FEB30); @@ -359,7 +358,7 @@ void sub_8074094(Entity *entity) else { DealDamageToEntity(entity, 0x270F, 0xB, 0x20E); } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } } @@ -371,18 +370,18 @@ void sub_8074094(Entity *entity) if (!CheckVariousStatuses2(entity, FALSE) && !CannotAttack(entity, FALSE) && !CheckVariousStatuses(entity)) { Move bideMove; - UseAttack(NULL); + DisplayActions(NULL); InitPokemonMove(&bideMove, MOVE_BIDE_2); bideMove.moveFlags |= MOVE_FLAG_LAST_USED; TryUseChosenMove(entity, 0, 0, 0, 0, &bideMove); - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; entityInfo->unkA0 = 0; } } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->bideClassStatus.status == STATUS_ENRAGED) { @@ -395,11 +394,11 @@ void sub_8074094(Entity *entity) } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; } -void TickStatusHeal(Entity *entity) +void TickStatusAndHealthRegen(Entity *entity) { s32 i; bool32 spdChange; @@ -407,7 +406,7 @@ void TickStatusHeal(Entity *entity) if (entity == NULL) return; - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; sub_805229C(); @@ -450,7 +449,7 @@ void TickStatusHeal(Entity *entity) EndSleepClassStatus(entity, entity, TRUE, TRUE); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->burnClassStatus.status != 0) { @@ -459,7 +458,7 @@ void TickStatusHeal(Entity *entity) EndBurnClassStatus(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->frozenClassStatus.status != 0) { @@ -468,7 +467,7 @@ void TickStatusHeal(Entity *entity) EndFrozenClassStatus(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->cringeClassStatus.status != 0) { @@ -477,7 +476,7 @@ void TickStatusHeal(Entity *entity) EndCringeClassStatus(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->reflectClassStatus.status != 0) { @@ -486,7 +485,7 @@ void TickStatusHeal(Entity *entity) EndReflectClassStatus(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->curseClassStatus.status != 0) { @@ -495,7 +494,7 @@ void TickStatusHeal(Entity *entity) EndCurseClassStatus(entity, entity, 0); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->leechSeedClassStatus.status != 0) { @@ -504,7 +503,7 @@ void TickStatusHeal(Entity *entity) EndLeechSeedClassStatus(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->sureShotClassStatus.status != 0) { @@ -513,7 +512,7 @@ void TickStatusHeal(Entity *entity) SendMoveEndMessage(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->invisibleClassStatus.status != 0) { @@ -522,7 +521,7 @@ void TickStatusHeal(Entity *entity) SendTransformEndMessage(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->blinkerClassStatus.status != 0) { @@ -531,7 +530,7 @@ void TickStatusHeal(Entity *entity) SendEyesightEndMessage(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->muzzled.muzzled != 0) { @@ -540,7 +539,7 @@ void TickStatusHeal(Entity *entity) SendMuzzledEndMessage(entity, entity); } } - if (!EntityIsValid(entity) || sub_8044B28()) + if (!EntityIsValid(entity) || IsFloorOver()) return; if (entityInfo->terrifiedTurns != 0) { diff --git a/src/code_8075708.c b/src/code_8075708.c index 2747b86ae..b93a80336 100644 --- a/src/code_8075708.c +++ b/src/code_8075708.c @@ -40,9 +40,9 @@ #include "code_8077274_1.h" #include "math.h" #include "dungeon_config.h" +#include "dungeon_engine.h" extern void sub_8073D14(Entity *); -extern bool8 sub_8044B28(void); extern void sub_8075708(Entity *entity); extern void DealDamageToEntity(Entity *, s32, u32, u32); extern void sub_805229C(void); @@ -54,14 +54,13 @@ extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); extern void sub_80838EC(u8 *a); extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *); -extern bool8 sub_8045888(Entity *); extern void nullsub_97(Entity *entity); -extern void sub_805EE30(void); +extern void CheckLeaderTile(void); extern void sub_8086AC0(void); extern void sub_8085140(void); extern void sub_8075708(Entity *entity); -extern void sub_8043ED0(u32); -extern void sub_8071DA4(Entity *); +extern void TryForcedLoss(u32); +extern void EnemyEvolution(Entity *); extern void sub_8075900(Entity *pokemon, u8 r1); extern void sub_806A5B8(Entity *); extern void sub_807EC28(bool8); @@ -157,7 +156,7 @@ void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr) } } -bool8 UseAttack(Entity *a0) +bool8 DisplayActions(Entity *a0) { s32 i, j, loop; Entity *savedEntityPtr; @@ -193,11 +192,11 @@ bool8 UseAttack(Entity *a0) monInfo->flags |= 0x2000; pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.x); pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.y); - sub_804535C(mon, &pos); + UpdateEntityPixelPos(mon, &pos); sub_806CDFC(mon, 0, monInfo->unk184[0].lastMoveDirection); monInfo->notMoving = 0; r7 = TRUE; - if (sub_8045888(mon)) + if (ShouldDisplayEntity(mon)) r9 = TRUE; } } @@ -230,7 +229,7 @@ bool8 UseAttack(Entity *a0) pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x); pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y); - sub_804535C(mon, &pos); + UpdateEntityPixelPos(mon, &pos); sub_806CDFC(mon, 0, monInfo->unk184[monInfo->notMoving].lastMoveDirection); } } @@ -247,7 +246,7 @@ bool8 UseAttack(Entity *a0) monInfo->numMoveTiles = 0; nullsub_97(mon); if (monInfo->flags & 0x2000) { - sub_804535C(mon, NULL); + UpdateEntityPixelPos(mon, NULL); } } } @@ -261,7 +260,7 @@ bool8 UseAttack(Entity *a0) if (!EntityIsValid(mon)) continue; - if (sub_8044B28()) + if (IsFloorOver()) break; monInfo = GetEntInfo(mon); @@ -276,32 +275,32 @@ bool8 UseAttack(Entity *a0) if (monInfo->flags & 0x2000) { monInfo->flags &= ~(0x2000); if (monInfo->isTeamLeader) { - sub_804AC20(&mon->pos); + DiscoverMinimap(&mon->pos); sub_807EC28(FALSE); - sub_805EE30(); + CheckLeaderTile(); } else { sub_8075708(mon); } if (!EntityIsValid(mon)) continue; - if (sub_8044B28()) + if (IsFloorOver()) break; - sub_8043ED0(0); + TryForcedLoss(0); sub_8074094(mon); if (!EntityIsValid(mon)) continue; - if (sub_8044B28()) + if (IsFloorOver()) break; - sub_8071DA4(mon); + EnemyEvolution(mon); sub_8046D20(); sub_8075900(mon, gDungeon->forceMonsterHouse); } if (!EntityIsValid(mon)) continue; - if (sub_8044B28()) + if (IsFloorOver()) break; if (monPosBefore.x != mon->pos.x || monPosBefore.y != mon->pos.y) @@ -315,7 +314,7 @@ bool8 UseAttack(Entity *a0) } sub_8086AC0(); - if (!sub_8044B28()) { + if (!IsFloorOver()) { sub_8085140(); gDungeon->unkB8 = savedEntityPtr; } @@ -384,12 +383,12 @@ void sub_8075708(Entity *entity) switch(GetEntityType(trap)) { case ENTITY_TRAP: - trapData = GetTrapData(trap); + trapData = GetTrapInfo(trap); bVar1 = FALSE; bVar2 = FALSE; if ((IQSkillIsEnabled(entity, IQ_TRAP_SEER)) && (!trap->isVisible)) { trap->isVisible = TRUE; - sub_8049ED4(); + UpdateTrapsVisibility(); bVar2 = TRUE; } @@ -412,7 +411,7 @@ void sub_8075708(Entity *entity) } _ret: if (!bVar2) { - HandleTrap(entity, &entity->pos, 0, 1); + TryTriggerTrap(entity, &entity->pos, 0, 1); } break; case ENTITY_ITEM: @@ -453,7 +452,7 @@ u32 sub_8075818(Entity *entity) case ENTITY_UNK_5: break; case ENTITY_TRAP: - trapData = GetTrapData(subEntity); + trapData = GetTrapInfo(subEntity); r1 = 0; if(trapData->unk1 == 0) { @@ -490,7 +489,7 @@ flag_check: break; else { - item = GetItemData(subEntity); + item = GetItemInfo(subEntity); if(!(item->flags & ITEM_FLAG_IN_SHOP)) { return 1; @@ -499,7 +498,7 @@ flag_check: } else { - item = GetItemData(subEntity); + item = GetItemInfo(subEntity); if(!(item->flags & ITEM_FLAG_IN_SHOP)) { error: @@ -517,7 +516,6 @@ error: extern char *gPtrItsaMonsterHouseMessage; -extern u8 sub_8044B28(void); extern void sub_807AB38(Entity *, u32); extern void sub_8041888(u32); @@ -527,7 +525,7 @@ void sub_8075900(Entity *pokemon, u8 r1) { if(!GetEntInfo(pokemon)->isNotTeamMember) { - if(!sub_8044B28()) + if(!IsFloorOver()) { if(!gDungeon->unk644.monsterHouseTriggered) { diff --git a/src/code_80848F0.c b/src/code_80848F0.c index 5721c03ef..a13817e81 100644 --- a/src/code_80848F0.c +++ b/src/code_80848F0.c @@ -35,6 +35,7 @@ #include "pokemon_3.h" #include "dungeon_boss_dialogue.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" struct RgbS16 { @@ -51,7 +52,7 @@ extern const u8 gUnknown_8107358[25]; extern const DungeonPos gUnknown_80F4598[]; extern bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 brightness, const RGB *ramp, struct RgbS16 *a5); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern s32 GetCameraXPos(void); extern s32 GetCameraYPos(void); extern void sub_803F4A0(u32); @@ -66,7 +67,6 @@ extern void sub_8085F44(s32); extern void sub_8052FB8(const u8 *); extern void BgColorCallNullsub4(void); extern void PlaySoundEffect(u32); -extern u8 sub_8044B28(void); extern void sub_8085EB0(void); extern void sub_803E748(void); extern s32 GetCameraXPos(void); @@ -136,7 +136,7 @@ void sub_80847D4(void) gDungeon->unk3A0D = 0; gDungeon->unk1356C = 0; - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); for(index = 0; index < 0x3e7 && gUnknown_8107234[index].unk0 != 0; index++) { fixedRoomNumber = gDungeon->fixedRoomNumber; if (fixedRoomNumber - 0x1c < 0x16) { @@ -934,7 +934,7 @@ Entity *GetEntityFromMonsterBehavior(u8 entityType) void sub_80856C8(Entity * pokemon, s32 x, s32 y) { sub_80694C0(pokemon, x, y, 1); - sub_804535C(pokemon,NULL); + UpdateEntityPixelPos(pokemon,NULL); } void sub_80856E0(Entity * pokemon, s32 direction) @@ -973,7 +973,7 @@ void sub_8085764(void) { entity = gDungeon->wildPokemon[index]; if ((EntityIsValid(entity)) && (GetEntInfo(entity)->monsterBehavior == BEHAVIOR_ALLY)) { - sub_8068FE0(entity,0x207,&stackEntity); + HandleFaint(entity,0x207,&stackEntity); } } } @@ -991,7 +991,7 @@ void sub_80857B8(void) if (EntityIsValid(entity)) { entityInfo = GetEntInfo(entity); if ((gDungeon->unk4 == 0) && (gDungeon->unk2 == 0)) { - sub_804535C(entity, 0); + UpdateEntityPixelPos(entity, 0); entityInfo->unk15C = 0; entityInfo->unkFE = 99; direction = &entityInfo->action.direction; @@ -1524,7 +1524,7 @@ static void sub_80862DC(Entity *entity) pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x3800; - sub_804535C(entity, &pos); + UpdateEntityPixelPos(entity, &pos); sub_806CDD4(entity, 0, DIRECTION_NORTH); sub_8086A54(entity); } @@ -1535,7 +1535,7 @@ static void sub_8086310(Entity *entity) pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x9000; - sub_804535C(entity, &pos); + UpdateEntityPixelPos(entity, &pos); sub_806CE68(entity, DIRECTION_SOUTH); sub_8086A3C(entity); entity->isVisible = 0; @@ -1547,7 +1547,7 @@ static void sub_8086348(Entity *entity) pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y - 0x2000; - sub_804535C(entity, &pos); + UpdateEntityPixelPos(entity, &pos); sub_806CDD4(entity, 0, DIRECTION_WEST); sub_8086A54(entity); } @@ -1558,7 +1558,7 @@ static void sub_8086384(Entity *entity) pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y; - sub_804535C(entity, &pos); + UpdateEntityPixelPos(entity, &pos); sub_806CDD4(entity, 0, DIRECTION_WEST); sub_8086A54(entity); } @@ -2000,7 +2000,7 @@ void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex) void sub_8086AC0(void) { - if(!sub_8044B28()) + if(!IsFloorOver()) if(gDungeon->unk2 == 0) sub_8097FF8(); } diff --git a/src/code_80958E8.c b/src/code_80958E8.c index c31d6e194..df77e7c38 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -144,7 +144,7 @@ bool8 ValidateWonderMail(WonderMail *data) if(IsInvalidItemReward(data->targetItem)) return FALSE; - if(IsThrowableItem(data->targetItem)) + if(IsThrownItem(data->targetItem)) return FALSE; if(!IsNotMoneyOrUsedTMItem(data->targetItem)) return FALSE; @@ -417,7 +417,7 @@ u8 sub_8095F28(u8 param_1) { if ((param_1 == 0x63) || (xxx_bit_lut_lookup_8091E50(param_1, itemID) != 0)) { - if ((!IsThrowableItem(itemID)) && (IsNotMoneyOrUsedTMItem(itemID))) { + if ((!IsThrownItem(itemID)) && (IsNotMoneyOrUsedTMItem(itemID))) { itemStack[counter] = itemID; counter++; } diff --git a/src/drought_orb.c b/src/drought_orb.c index 343bb6e0b..7b0c817ad 100644 --- a/src/drought_orb.c +++ b/src/drought_orb.c @@ -71,7 +71,7 @@ void HandleDroughtOrbAction(Entity *pokemon, Entity *target) LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD060); } gDungeon->unk644.unk2C = 1; - sub_806CF60(); - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + DetermineAllMonsterShadow(); + UpdateMinimap(); + UpdateTrapsVisibility(); } diff --git a/src/dungeon_8072CF4.c b/src/dungeon_8072CF4.c index a81f0e6dc..48632ce1c 100644 --- a/src/dungeon_8072CF4.c +++ b/src/dungeon_8072CF4.c @@ -30,6 +30,7 @@ #include "dungeon_config.h" #include "dungeon_misc.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" extern u8 gUnknown_202F221; extern u8 gUnknown_202F222; @@ -70,8 +71,7 @@ void HandleTakeItemAction(Entity *); void HandleUseItemAction(Entity *); void sub_8066FA4(Entity *); void HandleUnsetItemAction(Entity *,bool8); -extern u8 sub_8044B28(void); -extern u8 UseAttack(Entity *); +extern u8 DisplayActions(Entity *); void sub_806A1E8(Entity *pokemon); bool8 sub_804AE08(DungeonPos *pos); void HandlePickUpAIAction(Entity *pokemon); @@ -79,7 +79,7 @@ void HandleThrowItemAIAction(Entity *pokemon); void HandleEatAIAction(Entity *pokemon); bool8 sub_8044B84(void); extern void sub_8074094(Entity *); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); u32 sub_8075818(Entity *entity); extern void MarkLastUsedMonMove(Entity *entity, Move *move); bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move); @@ -125,8 +125,8 @@ bool8 sub_8072CF4(Entity *entity) } } if (!IsNotAttacking(entity, FALSE)) { - if (UseAttack(entity)) { - if (sub_8044B28()) { + if (DisplayActions(entity)) { + if (IsFloorOver()) { return FALSE; } if (!EntityIsValid(entity)) { @@ -280,7 +280,7 @@ bool8 sub_8072CF4(Entity *entity) sub_8067904(entity, MOVE_REGULAR_ATTACK); break; case ACTION_STEPPED_ON_TRAP: - HandleTrap(entity,&entity->pos,0,0); + TryTriggerTrap(entity,&entity->pos,0,0); break; case ACTION_PICK_UP_AI: HandlePickUpAIAction(entity); @@ -345,7 +345,7 @@ bool8 sub_8072CF4(Entity *entity) WarpTarget(entity,entity,0,0); } sub_8074094(entity); - sub_8071DA4(entity); + EnemyEvolution(entity); } } } diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 52e540870..71ec6bb16 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -20,18 +20,15 @@ #include "dungeon_engine.h" #include "run_dungeon.h" -extern bool8 sub_8044B28(void); extern void sub_8086AC0(void); -extern void UseAttack(u32); -extern void TriggerWeatherAbilities(void); -extern void sub_8071DA4(Entity *); -extern void TickStatusHeal(Entity *); +extern void DisplayActions(u32); +extern void TryActivateArtificialWeatherAbilities(void); +extern void EnemyEvolution(Entity *); +extern void TickStatusAndHealthRegen(Entity *); EWRAM_DATA SubMenuAction gDungeonSubMenu[10] = {0}; EWRAM_DATA s32 gDungeonSubMenuItemsCount = 0; -extern bool8 sub_8045888(Entity *); - static const u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES] = { [CATEGORY_THROWN_LINE] = 0, [CATEGORY_THROWN_ARC] = 0, @@ -76,7 +73,7 @@ void SetLeaderActionToNothing(bool8 clearActionFields) } } -void sub_8044C50(u16 action) +void SetLeaderActionFields(u16 action) { EntityInfo * entityInfo = GetLeaderInfo(); @@ -127,7 +124,7 @@ Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3) } else if (param_2->actionUseIndex == 0x80) { tile = GetTile((param_2->itemPos).x,(param_2->itemPos).y); - item = GetItemData(tile->object); + item = GetItemInfo(tile->object); } else { if (param_2->actionUseIndex == 0x81) { @@ -163,7 +160,7 @@ bool8 sub_8044D40(ActionContainer *param_1,s32 index) if (puVar1->actionUseIndex != 0x80) { return FALSE; } - RemoveItemFromDungeonAt(&puVar1->itemPos,1); + RemoveGroundItem(&puVar1->itemPos,1); } return TRUE; } @@ -198,7 +195,7 @@ void sub_8044DF0(Entity *entity, s32 index, u32 unused) info = GetEntInfo(entity); item = sub_8044D90(entity,index,unused); if ((info->action).actionParameters[0].actionUseIndex == 0x80) { - RemoveItemFromDungeonAt(&(info->action).actionParameters[0].itemPos,1); + RemoveGroundItem(&(info->action).actionParameters[0].itemPos,1); } else { item->id = ITEM_NOTHING; @@ -222,10 +219,10 @@ void sub_8044E24(Entity *entity,int index,u32 unused) if (info->action.actionParameters[index].actionUseIndex == 0x80) { item = *itemPtr; pos = &info->action.actionParameters[index].itemPos; - RemoveItemFromDungeonAt(pos,1); + RemoveGroundItem(pos,1); item.quantity = itemPtr->id - 125; item.id = ITEM_TM_USED_TM; - AddItemToDungeonAt(pos,&item,1); + SpawnItem(pos,&item,1); } else { itemPtr->quantity = itemPtr->id - 125; @@ -315,7 +312,7 @@ bool8 IsNotAttacking(Entity *param_1, bool8 param_2) info = GetEntInfo(param_1); action = &(info->action).action; - if ((param_2 == 0) || (sub_8045888(param_1))) + if ((param_2 == 0) || (ShouldDisplayEntity(param_1))) { if(*action == ACTION_NOTHING) return TRUE; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 6ae0a8459..576e20559 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -31,6 +31,7 @@ #include "dungeon_misc.h" #include "type_effectiveness.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" #define REGULAR_ATTACK_INDEX 4 @@ -45,14 +46,13 @@ EWRAM_DATA u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS] = {0}; EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0}; EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0}; -extern bool8 sub_8044B28(void); extern void sub_806A1B0(Entity *); extern Item *sub_8044D90(Entity *, s32, u32); extern bool8 sub_8044D40(ActionContainer *, u32); extern void sub_8045BF8(u8 *, struct Item *); extern void sub_8044DF0(struct Entity *, u32, u32); -extern void sub_8071DA4(struct Entity *); -extern void sub_804AC20(DungeonPos *); +extern void EnemyEvolution(struct Entity *); +extern void DiscoverMinimap(DungeonPos *); extern void sub_807EC28(bool8); extern void sub_806A5B8(struct Entity *entity); @@ -936,7 +936,7 @@ void HandleUseMoveAIAction(Entity *target) sub_8055A00(target, entityInfo->action.actionParameters[0].actionUseIndex, 1, 0, 0); if (!EntityIsValid(target)) break; - if (sub_8044B28()) + if (IsFloorOver()) break; if (entityInfo->unk159) break; @@ -1035,11 +1035,11 @@ void HandleUseOrbAction(Entity *pokemon) if (r4) sub_8044DF0(pokemon, 0, 122); - sub_8071DA4(pokemon); + EnemyEvolution(pokemon); sub_806CE68(pokemon, 8); if (entityInfo->isTeamLeader) { - sub_804AC20(&pokemon->pos); + DiscoverMinimap(&pokemon->pos); sub_807EC28(FALSE); } @@ -1049,7 +1049,7 @@ void HandleUseOrbAction(Entity *pokemon) else if (r4) sub_8044D40(&act, 0); - if (!sub_8044B28()) + if (!IsFloorOver()) sub_806A1B0(pokemon); } diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 7ebcefafd..d38b329f4 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -24,11 +24,11 @@ #include "dungeon_music.h" #include "dungeon_items.h" #include "constants/dungeon.h" +#include "dungeon_engine.h" extern void sub_8045BF8(u8 *, Item *); extern void sub_8067110(Entity *); extern void sub_80671A0(Entity *); -extern bool8 sub_8044B28(void); #define NUM_POTENTIAL_ROCK_TARGETS 20 #define GROUND_ITEM_TOOLBOX_INDEX 0x80 @@ -152,7 +152,7 @@ void AIDecideUseItem(Entity *pokemon) u32 objectType = GetEntityType(object); if (objectType == ENTITY_ITEM) { - item = GetItemData(mapTile->object); + item = GetItemInfo(mapTile->object); selectedToolboxIndex = GROUND_ITEM_TOOLBOX_INDEX; } else @@ -441,7 +441,7 @@ void sub_8073D14(Entity *entity) Entity *tileObject = GetTileAtEntitySafe(entity)->object; if (tileObject == NULL) return; - if (sub_8044B28()) + if (IsFloorOver()) return; SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0); if (entityInfo->isTeamLeader) @@ -454,7 +454,7 @@ void sub_8073D14(Entity *entity) return; _entityInfo = GetEntInfo(entity); // Reloaded as a new variable for some reason. - groundItem = GetItemData(tileObject); + groundItem = GetItemInfo(tileObject); if (groundItem->flags & ITEM_FLAG_IN_SHOP) return; @@ -473,7 +473,7 @@ void sub_8073D14(Entity *entity) } AddToTeamMoney(GetMoneyValue(groundItem)); sub_8045BF8(gFormatBuffer_Items[0], groundItem); - RemoveItemFromDungeonAt(&entity->pos, 1); + RemoveGroundItem(&entity->pos, 1); DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem); } else { @@ -535,7 +535,7 @@ void sub_8073D14(Entity *entity) carriedItems[newInventoryId]->flags |= ITEM_FLAG_STICKY; sub_8045BF8(gFormatBuffer_Items[0], groundItem); - RemoveItemFromDungeonAt(&entity->pos, 1); + RemoveGroundItem(&entity->pos, 1); PlaySoundEffect(0x14A); if (inventoryIds[newInventoryId] <= -1) DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2); @@ -566,7 +566,7 @@ void sub_8073D14(Entity *entity) if (inventoryIds[i] <= -1) { _entityInfo->heldItem = *groundItem; sub_8045BF8(gFormatBuffer_Items[0], groundItem); - RemoveItemFromDungeonAt(&entity->pos, 1); + RemoveGroundItem(&entity->pos, 1); DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2); } else if (AddItemToInventory(groundItem)) { @@ -575,7 +575,7 @@ void sub_8073D14(Entity *entity) } else { sub_8045BF8(gFormatBuffer_Items[0], groundItem); - RemoveItemFromDungeonAt(&entity->pos, 1); + RemoveGroundItem(&entity->pos, 1); DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox); } } diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index 1b4a14837..4b8a7ce3c 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -125,7 +125,7 @@ bool8 CanTakeItem(Entity *pokemon) if (!pokemonInfo->isTeamLeader && !(pokemonInfo->heldItem.flags & ITEM_FLAG_EXISTS) && ((mapTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) || !pokemonInfo->isNotTeamMember) && - !(GetItemData(object)->flags & ITEM_FLAG_IN_SHOP)) + !(GetItemInfo(object)->flags & ITEM_FLAG_IN_SHOP)) { return TRUE; } diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index 3f64b3489..150d3d555 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -109,7 +109,7 @@ void sub_8087FF8(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_ARTICUNO)) { - sub_8068FE0(articunoEntity,0x21c,0); + HandleFaint(articunoEntity,0x21c,0); } else { sub_8072008(articunoEntity,articunoEntity,gArticunoConfigLevel,0,0); diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index 38a1c2ffe..3a3085aa2 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -100,7 +100,7 @@ void CelebiJoinDialogue(void) celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI); if ((HasRecruitedMon(MONSTER_CELEBI)) || (!sub_806FD18(celebiEntity))) { - sub_8068FE0(celebiEntity,0x21c,0); + HandleFaint(celebiEntity,0x21c,0); SpriteLookAroundEffect(leaderEntity); sub_803E708(10,0x46); // ......... diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index da73dc46f..5354575f1 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -44,14 +44,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -158,7 +158,7 @@ static void sub_808C550(void) static void sub_808C590(Entity *r0) { - sub_8068FE0(r0, 0x21C, 0); + HandleFaint(r0, 0x21C, 0); } static void SetupDeoxysFacingDirection(Entity *deoxysEntity) diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index f5a302f7b..e7a5b43c6 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -89,7 +89,7 @@ void sub_8089C90(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_ENTEI)) { - sub_8068FE0(EnteiEntity,0x21c,0); + HandleFaint(EnteiEntity,0x21c,0); } else { SetFacingDirection(EnteiEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index 9a9c4d1b3..98e5e15ca 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -106,7 +106,7 @@ void sub_80886C4(void) sub_8085374(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); - sub_8068FE0(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,0x21c,0); SetFacingDirection(groudonEntity, DIRECTION_SOUTH); sub_8086A3C(groudonEntity); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y); @@ -130,9 +130,9 @@ void sub_808875C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - sub_8068FE0(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,0x21c,0); if (sub_8086AE4(MONSTER_GROUDON)) { - sub_8068FE0(groudonEntity,0x21c,0); + HandleFaint(groudonEntity,0x21c,0); } else { sub_8072008(groudonEntity,groudonEntity,gGroudonConfigLevel,0,0); @@ -200,7 +200,7 @@ void GroudonPreFightDialogue(void) sub_80861B8(alakazamEntity,6,DIRECTION_NORTH); PlaySoundEffect(0x205); sub_8086738(); - sub_8068FE0(alakazamEntity,0x21c,0); + HandleFaint(alakazamEntity,0x21c,0); DisplayDungeonDialogue(&GroudonPreFightDialogue_8); sub_803E708(10,0x46); DisplayDungeonDialogue(&GroudonPreFightDialogue_9); diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index 4fde75387..f608e1456 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -95,7 +95,7 @@ void sub_808A668(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_HO_OH)) { - sub_8068FE0(HoOhEntity,0x21c,0); + HandleFaint(HoOhEntity,0x21c,0); } else { SetFacingDirection(HoOhEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 7ac174b43..567ba5871 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -44,14 +44,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -84,7 +84,7 @@ void sub_808B2F4(void) jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI); DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST); CreateJirachiWishWarpTile(); - sub_8049ED4(); + UpdateTrapsVisibility(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); @@ -106,13 +106,13 @@ void sub_808B35C(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (HasRecruitedMon(MONSTER_JIRACHI)) { - sub_8068FE0(jirachiEntity,0x21c,0); + HandleFaint(jirachiEntity,0x21c,0); } else { SetFacingDirection(jirachiEntity, DIRECTION_SOUTH); sub_8086A3C(jirachiEntity); CreateJirachiWishWarpTile(); - sub_8049ED4(); + UpdateTrapsVisibility(); } sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); @@ -139,7 +139,7 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3) sub_808B50C(); } gDungeon->unk1356C = uVar1; - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); } } } @@ -509,8 +509,8 @@ static void CreateJirachiWishWarpTile(void) tile->terrainType &= ~TERRAIN_TYPE_STAIRS; sub_8049884(); sub_8049B8C(); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } static void EnableJirachiWishWarpTile(void) @@ -525,8 +525,8 @@ static void EnableJirachiWishWarpTile(void) tile->unk8 = 1; sub_8049884(); sub_8049B8C(); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } static u8 JirachiFriendAreaSearch(void) diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index f72b29f2e..28e7afd4f 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -44,14 +44,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -81,7 +81,7 @@ void sub_808C10C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_KYOGRE)) { - sub_8068FE0(kyogreEntity,0x21c,0); + HandleFaint(kyogreEntity,0x21c,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index ab969814b..4e881956e 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -44,14 +44,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -108,7 +108,7 @@ void sub_808AA94(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - sub_8068FE0(LatiosEntity,0x21c,0); + HandleFaint(LatiosEntity,0x21c,0); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LATIOS); } diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index 2a04d8d3e..6cc21597a 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -44,14 +44,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -80,7 +80,7 @@ void sub_808BDEC(void) sub_80855E4(sub_8086A3C); if (HasRecruitedMon(MONSTER_LUGIA)) { DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); - sub_8068FE0(lugiaEntity,0x21c,0); + HandleFaint(lugiaEntity,0x21c,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index dee5c11d0..922c59256 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -102,8 +102,8 @@ void sub_8088E5C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - sub_8068FE0(groudonEntity,0x21c,0); - sub_8068FE0(alakazamEntity,0x21c,0); + HandleFaint(groudonEntity,0x21c,0); + HandleFaint(alakazamEntity,0x21c,0); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM); diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index faeae931d..c13a95465 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -173,7 +173,7 @@ void sub_80898E4(void) static void sub_80898F8(Entity *r0) { - sub_8068FE0(r0, 0x21C, 0); + HandleFaint(r0, 0x21C, 0); } static void sub_8089908(Entity *r0) diff --git a/src/dungeon_cutscene_meanies.c b/src/dungeon_cutscene_meanies.c index eb1794535..e2a898348 100644 --- a/src/dungeon_cutscene_meanies.c +++ b/src/dungeon_cutscene_meanies.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index 7c8268ba6..d3e490535 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -124,7 +124,7 @@ void MedichamRescueDialogue(void) sub_806CE68(medichamEntity, DIRECTION_SOUTH); sub_803E708(0x20, 0x46); sub_8042B0C(medichamEntity); - sub_8068FE0(medichamEntity, 0x21C, 0); + HandleFaint(medichamEntity, 0x21C, 0); gDungeon->unk4 = 1; gDungeon->unk11 = 4; } @@ -139,7 +139,7 @@ void sub_808CB5C(void) DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); sub_8085930(DIRECTION_NORTH); - sub_8068FE0(medichamEntity, 0x21C, 0); + HandleFaint(medichamEntity, 0x21C, 0); sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_MEDICHAM); } diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index 252d3a594..8a7c5f8c6 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -95,7 +95,7 @@ void sub_8089978(void) sub_80855E4(sub_8086A3C); if(HasRecruitedMon(MONSTER_MEWTWO)){ DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); - sub_8068FE0(MewtwoEntity,0x21c,0); + HandleFaint(MewtwoEntity,0x21c,0); } else { gDungeon->unk7 = 1; diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index 2c5f727fa..099060fec 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -101,7 +101,7 @@ void sub_8087848(void) sub_8085930(DIRECTION_WEST); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_MOLTRES)) { - sub_8068FE0(moltresEntity,0x21c,0); + HandleFaint(moltresEntity,0x21c,0); } else { sub_8072008(moltresEntity,moltresEntity,gMoltresConfigLevel,0,0); diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 733235d4d..98767430f 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -104,7 +104,7 @@ void sub_8089F8C(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_RAIKOU)) { - sub_8068FE0(RaikouEntity,0x21c,0); + HandleFaint(RaikouEntity,0x21c,0); } else { SetFacingDirection(RaikouEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index a007d64e2..b7515b02e 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -94,7 +94,7 @@ void sub_8089328(void) sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(MONSTER_RAYQUAZA)) { - sub_8068FE0(rayquazaEntity,0x21c,0); + HandleFaint(rayquazaEntity,0x21c,0); } else { sub_8072008(rayquazaEntity,rayquazaEntity,gRayquazaConfigLevel,0,0); diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 2049dd74f..1aec6f1ec 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -73,7 +73,7 @@ void sub_808ACC0(void) if (HasRecruitedMon(MONSTER_REGIROCK)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGIROCK); - sub_8068FE0(entity,0x21c,0); + HandleFaint(entity,0x21c,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_ROCK_PART); @@ -100,7 +100,7 @@ void sub_808AD48(void) if (HasRecruitedMon(MONSTER_REGICE)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGICE); - sub_8068FE0(entity,0x21c,0); + HandleFaint(entity,0x21c,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_ICE_PART); @@ -128,7 +128,7 @@ void sub_808ADCC(void) if (HasRecruitedMon(MONSTER_REGISTEEL)) { entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGISTEEL); - sub_8068FE0(entity,0x21c,0); + HandleFaint(entity,0x21c,0); sub_8097FA8(0x22); sub_8097FA8(0x1d); sub_808B1CC(ITEM_STEEL_PART); @@ -162,7 +162,7 @@ void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3) sub_808B1CC(ITEM_NOTHING); if (!sub_8098100(0x1d)) { ItemIdToItem(&item,ITEM_ROCK_PART,0); - sub_80464C8(GetLeader(),param_3,&item); + SpawnDroppedItemWrapper(GetLeader(),param_3,&item); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Regirock's body // Regirock was apparently guarding this item @@ -184,7 +184,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3) sub_808B1CC(ITEM_NOTHING); if (!sub_8098100(0x1d)) { ItemIdToItem(&item,ITEM_ICE_PART,0); - sub_80464C8(GetLeader(),param_3,&item); + SpawnDroppedItemWrapper(GetLeader(),param_3,&item); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Regice's body // Regice was apparently guarding this item @@ -206,7 +206,7 @@ void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3) sub_808B1CC(ITEM_NOTHING); if (!sub_8098100(0x1d)) { ItemIdToItem(&item,ITEM_STEEL_PART,0); - sub_80464C8(GetLeader(),param_3, &item); + SpawnDroppedItemWrapper(GetLeader(),param_3, &item); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Registeel's body // Registeel was apparently guarding this item @@ -330,10 +330,10 @@ static void sub_808B1CC(u8 itemID) (sub_80860A8(ITEM_MUSIC_BOX) == 0)) { ItemIdToItem(&item,itemID,0); pos.y--; - AddItemToDungeonAt(&pos,&item,1); + SpawnItem(&pos,&item,1); } - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } static void SetupRegiFacingDirection(Entity *regiEntity) diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index f4df56fc9..097a482da 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -94,8 +94,8 @@ void sub_8086B94(void) diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); - sub_8068FE0(skarmoryEntity,0x21c,0); - sub_8068FE0(diglettEntity,0x21c,0); + HandleFaint(skarmoryEntity,0x21c,0); + HandleFaint(diglettEntity,0x21c,0); sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y); diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index e3361f992..87e852662 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -130,7 +130,7 @@ void SmeargleRescueDialogue(void) sub_806CE68(smeargleEntity, DIRECTION_SOUTH); sub_803E708(0x20, 0x46); sub_8042B0C(smeargleEntity); - sub_8068FE0(smeargleEntity, 0x21C, 0); + HandleFaint(smeargleEntity, 0x21C, 0); gDungeon->unk4 = 1; gDungeon->unk11 = 4; } @@ -146,7 +146,7 @@ void sub_808CD44(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - sub_8068FE0(smeargleEntity, 540, 0); + HandleFaint(smeargleEntity, 540, 0); sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SMEARGLE); } diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index 2daaaaef3..66dde9db7 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -107,7 +107,7 @@ void sub_808A308(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(MONSTER_SUICUNE)) { - sub_8068FE0(SuicuneEntity,0x21c,0); + HandleFaint(SuicuneEntity,0x21c,0); } else { SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH); diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index 3a834df7d..f16b22c74 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -42,14 +42,14 @@ extern void BgColorCallNullsub4(void); extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_8086A54(Entity *); extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); @@ -104,7 +104,7 @@ void sub_808729C(void) sub_8085930(4); sub_80855E4(sub_8086A3C); if (sub_8086AE4(0x91) != 0) { - sub_8068FE0(zapdosEntity,0x21c,0); + HandleFaint(zapdosEntity,0x21c,0); } else { sub_8072008(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index f3b137fbf..e8a61c33a 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -55,13 +55,12 @@ extern void sub_8042A24(Entity *r0); extern void sub_806A390(Entity *r0); extern void sub_8078084(Entity * pokemon); extern void sub_800DBBC(void); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon); extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *); extern void EntityUpdateStatusSprites(Entity *); -extern bool8 sub_8045888(Entity *r0); extern void sub_806F500(void); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, struct DamageStruct *dmgStruct); extern void sub_8041B74(Entity *pokemon); extern void sub_8041B5C(Entity *pokemon); @@ -349,7 +348,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1], target, 0); if (dmgStruct->dmg == 0) { - if (sub_8045888(attacker) && sub_8045888(target)) { + if (ShouldDisplayEntity(attacker) && ShouldDisplayEntity(target)) { if (targetData->unk152 == 0) { TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F9688); } @@ -365,11 +364,11 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc return FALSE; } else if (dmgStruct->dmg == 9999) { - if (arg8 != 0 && sub_8045888(target)) { + if (arg8 != 0 && ShouldDisplayEntity(target)) { unkTile = GetTileAtEntitySafe(target); sub_803E708(0x14, 0x18); unkTile->spawnOrVisibilityFlags |= 4; - sub_8049ED4(); + UpdateTrapsVisibility(); } if (targetData->unk152 == 0) { TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80F96A8); @@ -388,7 +387,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc if (targetData->unkA0 > 999) targetData->unkA0 = 999; - if (sub_8045888(target)) { + if (ShouldDisplayEntity(target)) { if (dmgStruct->residualDmgType != 14) { sub_803ED30(-dmgStruct->dmg, target, 1, -1); } @@ -403,7 +402,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc } } - if ((dmgStruct->residualDmgType != 14 || targetData->HP <= 1) && unkTile == NULL && sub_8045888(target)) { + if ((dmgStruct->residualDmgType != 14 || targetData->HP <= 1) && unkTile == NULL && ShouldDisplayEntity(target)) { if ((attacker->pos.x != target->pos.x || attacker->pos.y != target->pos.y) && GetEntityType(attacker) == ENTITY_MONSTER) { bool32 unkBool = FALSE; if (targetData->isTeamLeader) { @@ -466,7 +465,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc if (unkTile != NULL) { unkTile->spawnOrVisibilityFlags &= ~(0x4); - sub_8049ED4(); + UpdateTrapsVisibility(); } return FALSE; } @@ -481,7 +480,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc target->unk22 = 2; sub_803E708(0xA, 0x18); unkTile->spawnOrVisibilityFlags &= ~(0x4); - sub_8049ED4(); + UpdateTrapsVisibility(); } else if (var_24) { target->unk22 = 1; @@ -600,9 +599,9 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_8042148(target); monPos = teamMember->pos; - sub_8068FE0(teamMember, 0x221, target); + HandleFaint(teamMember, 0x221, target); sub_80694C0(target, monPos.x, monPos.y, 1); - sub_804535C(target, NULL); + UpdateEntityPixelPos(target, NULL); target->unk22 = 0; targetData->HP = targetData->maxHPStat; sub_8042A24(target); @@ -688,7 +687,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc } if (!targetData->isTeamLeader && ItemExists(&targetData->heldItem)) { - sub_80464C8(target, &target->pos, &targetData->heldItem); + SpawnDroppedItemWrapper(target, &target->pos, &targetData->heldItem); ZeroOutItem(&targetData->heldItem); } if (targetData->bossFlag) { @@ -751,18 +750,18 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_8069D4C(&sp, target); if (sub_806F660(attacker, target)) { if (!sub_806FA5C(attacker, target, &sp)) { - sub_8068FE0(target, 0x1F5, attacker); + HandleFaint(target, 0x1F5, attacker); } else { gUnknown_202F221 = 1; } } else { - sub_8068FE0(target, arg4, attacker); + HandleFaint(target, arg4, attacker); } } else { - sub_8068FE0(target, arg4, attacker); + HandleFaint(target, arg4, attacker); } return TRUE; @@ -1669,6 +1668,6 @@ void sub_806F63C(Entity *param_1) temp = &gDungeon->unk181e8; if (temp->cameraTarget == param_1) { - sub_803F508(temp->cameraTarget); + PointCameraToMonster(temp->cameraTarget); } } diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 191693790..dac39cfcb 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_engine.h" #include "run_dungeon.h" #include "dungeon_vram.h" #include "constants/dungeon.h" @@ -13,17 +14,16 @@ #include "dungeon_logic.h" #include "menu_input.h" -extern bool8 sub_8044B28(void); extern void TrySpawnMonsterAndActivatePlusMinus(void); extern void sub_807E378(void); extern void sub_8044574(void); extern void sub_8044820(void); extern void sub_8044AB4(void); -extern u8 UseAttack(u32); -extern void TickStatusHeal(Entity *); +extern u8 DisplayActions(u32); +extern void TickStatusAndHealthRegen(Entity *); extern void sub_8086AC0(void); -extern void sub_8071DA4(Entity *); -extern void TriggerWeatherAbilities(void); +extern void EnemyEvolution(Entity *); +extern void TryActivateArtificialWeatherAbilities(void); extern void DungeonHandlePlayerInput(void); extern void sub_805F02C(void); extern void sub_8074094(Entity *); @@ -31,7 +31,7 @@ extern void sub_8071B48(void); extern void sub_807EAA0(u32, u32); static void sub_8044454(void); -static bool8 xxx_dungeon_80442D0(bool8); +static bool8 RunLeaderTurn(bool8); EWRAM_DATA DungeonPos gUnknown_202EE0C = {0}; EWRAM_DATA MenuInputStruct gDungeonMenu = {0}; @@ -46,115 +46,98 @@ const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25] = { void RunFractionalTurn(bool8 param_1) { - bool8 cVar2; + bool8 cVar2; - if (!sub_8044B28()) { + if (IsFloorOver()) return; TrySpawnMonsterAndActivatePlusMinus(); - if (!sub_8044B28()) { - cVar2 = xxx_dungeon_80442D0(param_1); - if (!sub_8044B28()) { - if (cVar2 != 0) { - sub_807E378(); - if (sub_8044B28()) { - return; - } - } - if (!sub_8044B28()) { - sub_8044574(); - if (!sub_8044B28()) { - sub_8044820(); - if (!sub_8044B28()) { - sub_8044AB4(); - gDungeon->unk644.fractionalTurn++; - if (gDungeon->unk644.fractionalTurn == 24) { - gDungeon->unk644.fractionalTurn = 0; - } - } - } - } - } + if (IsFloorOver()) return; + cVar2 = RunLeaderTurn(param_1); + if (IsFloorOver()) return; + if (cVar2) { + sub_807E378(); + if (IsFloorOver()) return; + } + if (IsFloorOver()) return; + sub_8044574(); + if (IsFloorOver()) return; + sub_8044820(); + if (IsFloorOver()) return; + sub_8044AB4(); + if (++gDungeon->unk644.fractionalTurn == 24) { + gDungeon->unk644.fractionalTurn = 0; } - } } -static bool8 xxx_dungeon_80442D0(bool8 param_1) +static bool8 RunLeaderTurn(bool8 param_1) { - EntityInfo *entityInfo; - Entity *entity; - s32 movSpeed; - - entity = GetLeader(); - if (entity == NULL) { - return FALSE; - } - else - { - TriggerWeatherAbilities(); - movSpeed = CalcSpeedStage(entity); - if (gSpeedTurns[movSpeed][gDungeon->unk644.fractionalTurn] == 0) { + EntityInfo *entityInfo; + s32 movSpeed; + Entity *entity = GetLeader(); + if (entity == NULL) return FALSE; - } - else - { - if (GetEntInfo(entity)->attacking) { - return FALSE; - } - else - { - while (1) { - if(entity = GetLeader(), entity == NULL) - { - return FALSE; - } - else - { - if ((UseAttack(0) == 0) && - ((gDungeon->unk644.unk28 != 0 || - (gDungeon->unk644.unk2F != 0)))) { - DungeonRunFrameActions(0xc); - } - GetEntInfo(entity)->speedStageChanged = FALSE; - if (sub_8044B28()) return FALSE; - gDungeon->unkB8 = entity; - gDungeon->unkBC = 0; - if (param_1) { - param_1 = FALSE; - } - else { - TickStatusHeal(entity); - } - if (sub_8044B28()) return FALSE; - sub_8071DA4(entity); - gDungeon->noActionInProgress = TRUE; - DungeonHandlePlayerInput(); - gDungeon->noActionInProgress = FALSE; - if (sub_8044B28()) break; - sub_8072CF4(entity); - sub_8086AC0(); - sub_8043ED0(0); - if (sub_8044B28()) break; - entityInfo = GetEntInfo(entity); - if ((entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) { - GetEntInfo(entity)->flags = (entityInfo->flags & ~(MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) | MOVEMENT_FLAG_UNK_14; - } - if (sub_8044B28() ) break; - sub_8044454(); - if (sub_8044B28()) break; - if (gDungeon->unkBC != 0) { - sub_805F02C(); - gDungeon->unkBC = 0; - param_1 = TRUE; - } - else { - if (!GetEntInfo(entity)->speedStageChanged) break; - gDungeon->unk644.fractionalTurn = 0; - } - } + + TryActivateArtificialWeatherAbilities(); + movSpeed = CalcSpeedStage(entity); + if (gSpeedTurns[movSpeed][gDungeon->unk644.fractionalTurn] == 0) + return FALSE; + if (GetEntInfo(entity)->attacking) + return FALSE; + + while (1) { + entity = GetLeader(); + if (entity == NULL) + return FALSE; + if (DisplayActions(0) == 0 && (gDungeon->unk644.unk28 != 0 || (gDungeon->unk644.unk2F != 0))) { + DungeonRunFrameActions(0xc); + } + GetEntInfo(entity)->speedStageChanged = FALSE; + if (IsFloorOver()) + return FALSE; + gDungeon->unkB8 = entity; + gDungeon->unkBC = 0; + if (param_1) { + param_1 = FALSE; + } + else { + TickStatusAndHealthRegen(entity); + } + + if (IsFloorOver()) + return FALSE; + EnemyEvolution(entity); + gDungeon->noActionInProgress = TRUE; + DungeonHandlePlayerInput(); + gDungeon->noActionInProgress = FALSE; + if (IsFloorOver()) + break; + sub_8072CF4(entity); + sub_8086AC0(); + TryForcedLoss(0); + if (IsFloorOver()) + break; + entityInfo = GetEntInfo(entity); + if (entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY) { + GetEntInfo(entity)->flags = (entityInfo->flags & ~(MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) | MOVEMENT_FLAG_UNK_14; + } + if (IsFloorOver()) + break; + sub_8044454(); + if (IsFloorOver()) + break; + + if (gDungeon->unkBC != 0) { + sub_805F02C(); + gDungeon->unkBC = 0; + param_1 = TRUE; + } + else { + if (!GetEntInfo(entity)->speedStageChanged) + break; + gDungeon->unk644.fractionalTurn = 0; } - } } - } - return TRUE; + + return TRUE; } static void sub_8044454(void) @@ -170,14 +153,14 @@ static void sub_8044454(void) { entity = gDungeon->activePokemon[index]; if ((EntityIsValid(entity)) && (entityInfo = GetEntInfo(entity), (entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY))) { - if (sub_8044B28()) break; - TickStatusHeal(entity); + if (IsFloorOver()) break; + TickStatusAndHealthRegen(entity); if (EntityIsValid(entity)) { - sub_8071DA4(entity); + EnemyEvolution(entity); RunMonsterAI(entity, 0); sub_8072CF4(entity); sub_8086AC0(); - sub_8043ED0(0); + TryForcedLoss(0); entityInfo->flags = (entityInfo->flags & ~(MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) | MOVEMENT_FLAG_UNK_14; } } @@ -198,11 +181,11 @@ void sub_80444F4(Entity *pokemon) { entity = gDungeon->activePokemon[index]; if ((EntityIsValid(entity)) && (pokemon != entity) && (entityInfo = GetEntInfo(entity), (entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY))) { - if (sub_8044B28()) break; + if (IsFloorOver()) break; RunMonsterAI(entity, 0); sub_8072CF4(entity); sub_8086AC0(); - sub_8043ED0(0); + TryForcedLoss(0); } } } @@ -228,10 +211,10 @@ void sub_8044574(void) if (!teamMonInfo->isTeamLeader) { s32 spdStage; - if (sub_8044B28()) + if (IsFloorOver()) break; gDungeon->unkB8 = teamMon; - TriggerWeatherAbilities(); + TryActivateArtificialWeatherAbilities(); teamMonInfo->aiAllySkip = FALSE; spdStage = CalcSpeedStage(teamMon); @@ -244,18 +227,18 @@ void sub_8044574(void) } else { teamMonInfo->recalculateFollow = FALSE; - TickStatusHeal(teamMon); + TickStatusAndHealthRegen(teamMon); if (EntityIsValid(teamMon)) { s32 j; - sub_8071DA4(teamMon); + EnemyEvolution(teamMon); for (j = 0; j < 3; j++) { RunMonsterAI(teamMon, 0); - if (sub_8044B28() || !sub_8072CF4(teamMon)) + if (IsFloorOver() || !sub_8072CF4(teamMon)) break; sub_8086AC0(); - sub_8043ED0(0); - if (sub_8044B28()) + TryForcedLoss(0); + if (IsFloorOver()) break; } } @@ -310,14 +293,14 @@ void sub_8044574(void) RunMonsterAI(entity,1); sub_8072CF4(entity); sub_8086AC0(); - sub_8043ED0(0); + TryForcedLoss(0); EntityIsValid(entity); // Does nothing } ptr = ptr->next; } } - if (!sub_8044B28()) { + if (!IsFloorOver()) { for (i = 0; i < MAX_TEAM_MEMBERS; i++) { Entity *teamMon = gDungeon->teamPokemon[i]; if (EntityIsValid(teamMon)) { @@ -325,7 +308,7 @@ void sub_8044574(void) if (teamMonInfo->aiAllySkip) { sub_8074094(teamMon); if (EntityIsValid(teamMon)) { - sub_8071DA4(teamMon); + EnemyEvolution(teamMon); teamMonInfo->aiAllySkip = FALSE; } } @@ -346,10 +329,10 @@ void sub_8044820(void) for (index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) { entity = gDungeon->wildPokemon[index]; if (EntityIsValid(entity)) { - if (sub_8044B28()) break; + if (IsFloorOver()) break; entityInfo = GetEntInfo(entity); gDungeon->unkB8 = entity; - TriggerWeatherAbilities(); + TryActivateArtificialWeatherAbilities(); if ((entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY) == 0) { if ((u16)(entityInfo->flags & MOVEMENT_FLAG_UNK_14) != 0) { entityInfo->flags &= ~(MOVEMENT_FLAG_UNK_14); @@ -362,15 +345,15 @@ void sub_8044820(void) if (!entityInfo->attacking) { entityInfo->flags &= ~(MOVEMENT_FLAG_UNK_14 | MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY); entityInfo->recalculateFollow = FALSE; - TickStatusHeal(entity); + TickStatusAndHealthRegen(entity); if (EntityIsValid(entity)) { - sub_8071DA4(entity); + EnemyEvolution(entity); RunMonsterAI(entity, 0); - if (sub_8044B28()) break; + if (IsFloorOver()) break; sub_8072CF4(entity); sub_8086AC0(); - sub_8043ED0(0); - if (sub_8044B28()) break; + TryForcedLoss(0); + if (IsFloorOver()) break; } } } @@ -378,7 +361,7 @@ void sub_8044820(void) } } } - if (sub_8044B28() == 0) { + if (IsFloorOver() == 0) { for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) { entity2 = gDungeon->wildPokemon[index]; @@ -386,7 +369,7 @@ void sub_8044820(void) { sub_8074094(entity2); if (EntityIsValid(entity2)) { - sub_8071DA4(entity2); + EnemyEvolution(entity2); entityInfo2->aiAllySkip = FALSE; } } @@ -437,7 +420,7 @@ void TrySpawnMonsterAndActivatePlusMinus(void) } } } - sub_8043ED0(0); + TryForcedLoss(0); } } @@ -448,17 +431,17 @@ void sub_8044AB4(void) if (gSpeedTurns[1][gDungeon->unk644.fractionalTurn + 1] != 0) { for (index = 0; index < DUNGEON_MAX_POKEMON; index++) { if (EntityIsValid(gDungeon->activePokemon[index])) { - UseAttack(0); + DisplayActions(0); break; } } sub_807EAA0(1,0); sub_8086AC0(); - sub_8043ED0(0); + TryForcedLoss(0); } } -bool8 sub_8044B28(void) +bool8 IsFloorOver(void) { if (gDungeon->unk4 == 0) { if (GetLeader() == NULL) { @@ -484,6 +467,6 @@ bool8 sub_8044B84(void) return TRUE; } else { - return sub_8044B28(); + return IsFloorOver(); } } diff --git a/src/dungeon_generation_fixed.c b/src/dungeon_generation_fixed.c index 3125c089a..65ef21fb4 100644 --- a/src/dungeon_generation_fixed.c +++ b/src/dungeon_generation_fixed.c @@ -36,7 +36,7 @@ static void SpawnItemAtPos(u8 itemId, s32 x, s32 y, s32 quantity, u32 itemFlags) item.quantity = quantity; } - AddItemToDungeonAt(&pos, &item, 1); + SpawnItem(&pos, &item, 1); } // s16 species memes strike again. Will the fix ever be discovered? @@ -1049,7 +1049,7 @@ void sub_8051E7C(Entity *pokemon) tile->terrainType &= ~(TERRAIN_TYPE_IMPASSABLE_WALL | TERRAIN_TYPE_UNK_x1000); sub_80498A8(pokemon->pos.x, pokemon->pos.y - 1); sub_8049B8C(); - sub_8049ED4(); + UpdateTrapsVisibility(); sub_80429FC(&pos); LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FDDD0); // The closed corridor was opened! sub_803E708(0x14, 0x3C); diff --git a/src/dungeon_info.c b/src/dungeon_info.c index 11d3c82da..8924de4e7 100644 --- a/src/dungeon_info.c +++ b/src/dungeon_info.c @@ -2414,7 +2414,7 @@ u8 HasCheckpoint(u8 dungeon) return gDungeons[dungeon].hasCheckpoint; } -bool8 IsLevelResetTo1(u8 dungeon) +bool8 IsLevelResetDungeon(u8 dungeon) { return gDungeons[dungeon].levelResetTo1; } @@ -2424,7 +2424,7 @@ u32 GetMaxItemsAllowed(u8 dungeon) return gDungeons[dungeon].maxItemsAllowed; } -bool8 IsKeepMoney(u8 dungeon) +bool8 IsMoneyAllowed(u8 dungeon) { return gDungeons[dungeon].keepMoney; } diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index 6bc1c0df2..ebefd84f0 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -123,9 +123,9 @@ void BlinkerSeedItemAction(Entity *, Entity *); void DoomSeedItemAction(Entity *, Entity *); void sub_80482FC(Entity *, Entity *, u32, u8); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void SetShopkeeperAggression(Entity *, Entity *); -extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); extern void sub_806A6E8(Entity *); extern void sub_8042390(Entity *, Item *); @@ -156,7 +156,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity } if (flag && ((info->heldItem.flags & ITEM_FLAG_EXISTS) == 0)) { if (info->shopkeeper == TRUE) { - sub_80464C8(pokemon,&target->pos,item); + SpawnDroppedItemWrapper(pokemon,&target->pos,item); return; } PlaySoundEffect(0x14d); @@ -178,7 +178,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity TryDisplayDungeonLoggableMessage3(pokemon,target,*gItemStickyDoesntWorkText); if (param_1 != '\0') { sub_806F370(pokemon,target,gUnknown_80F4FAE,1,&uStack_24,0,0x217,0,0,0); - sub_8071DA4(pokemon); + EnemyEvolution(pokemon); return; } else goto _jump; @@ -407,7 +407,7 @@ _jump: break; } _080482B4: - sub_8071DA4(pokemon); + EnemyEvolution(pokemon); } UNUSED void nullsub_205(void) { } diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 097163439..dbbe85752 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -39,7 +39,6 @@ extern void sub_80855E4(void *); extern void PlaySoundEffect(u32); extern void sub_804178C(u32); extern void sub_804219C(PixelPos *pos); -extern bool8 sub_8045888(Entity *); extern u32 GetRandomFloorItem(u32); static void MusicBoxCreation(void); @@ -143,20 +142,20 @@ void CreateFloorItems(void) } } itemID = GetRandomFloorItem(spawnType); - if (!CanSellItem(itemID)) { + if (!IsShoppableItem(itemID)) { shopFlag = FALSE; } CreateItemWithStickyChance(&item,itemID,FORCE_STICKY_RANDOM); if (shopFlag) { item.flags |= flag; } - AddItemToDungeonAt(&pos,&item,TRUE); + SpawnItem(&pos,&item,TRUE); } } } } -void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) +void TryLeaderItemPickUp(struct DungeonPos *pos, bool8 printMsg) { Item *tileItem; int inventoryIds[INVENTORY_SIZE + 1]; @@ -171,7 +170,7 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) if (GetEntityType(tileObject) != ENTITY_ITEM) { return; } - tileItem = GetItemData(tileObject); + tileItem = GetItemInfo(tileObject); if (leaderInfo->action.actionParameters[0].actionUseIndex == 0) { if (!printMsg) { return; @@ -192,9 +191,9 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) PlaySoundEffect(0x14c); AddToTeamMoney(GetMoneyValue(tileItem)); sub_8045BF8(gFormatBuffer_Items[0],tileItem); - RemoveItemFromDungeonAt(pos,TRUE); + RemoveGroundItem(pos,TRUE); LogMessageByIdWithPopupCheckUser(leader,gPickedUpItem); - TryDisplayItemPickupTutorialMessage(tileItem->id); + DisplayItemTip(tileItem->id); } else { s32 i, maxItems; @@ -259,7 +258,7 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) inventoryItems[index]->flags |= ITEM_FLAG_STICKY; } sub_8045BF8(gFormatBuffer_Items[0],tileItem); - RemoveItemFromDungeonAt(pos,TRUE); + RemoveGroundItem(pos,TRUE); PlaySoundEffect(0x14a); if (inventoryIds[index] < 0) { LogMessageByIdWithPopupCheckUser(leader,gPickedUpItem2); @@ -267,7 +266,7 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) else { LogMessageByIdWithPopupCheckUser(leader,gPickedUpItemToolbox); } - TryDisplayItemPickupTutorialMessage(tileItem->id); + DisplayItemTip(tileItem->id); return; } } @@ -290,7 +289,7 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) if (inventoryIds[i] < 0) { leaderInfo->heldItem = *tileItem; sub_8045BF8(gFormatBuffer_Items[0],tileItem); - RemoveItemFromDungeonAt(pos,TRUE); + RemoveGroundItem(pos,TRUE); LogMessageByIdWithPopupCheckUser(leader,gPickedUpItem2); } else if (AddItemToInventory(tileItem) != 0) { @@ -299,19 +298,19 @@ void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg) } else { sub_8045BF8(gFormatBuffer_Items[0],tileItem); - RemoveItemFromDungeonAt(pos,TRUE); + RemoveGroundItem(pos,TRUE); LogMessageByIdWithPopupCheckUser(leader,gPickedUpItemToolbox); } - TryDisplayItemPickupTutorialMessage(tileItem->id); + DisplayItemTip(tileItem->id); } } } -bool8 AddItemToDungeonAt(DungeonPos *pos, Item *item, bool8 a2) +bool8 SpawnItem(DungeonPos *pos, Item *item, bool8 a2) { s32 i, count; Tile *tile; - Entity *itemEntity = sub_8045708(pos); + Entity *itemEntity = SpawnItemEntity(pos); if (itemEntity == NULL) return FALSE; @@ -320,14 +319,14 @@ bool8 AddItemToDungeonAt(DungeonPos *pos, Item *item, bool8 a2) itemEntity->isVisible = TRUE; tile = GetTileMut(pos->x, pos->y); tile->object = itemEntity; - if ((tile->terrainType & TERRAIN_TYPE_SHOP) && CanSellItem(item->id)) { + if ((tile->terrainType & TERRAIN_TYPE_SHOP) && IsShoppableItem(item->id)) { if (item->flags & ITEM_FLAG_IN_SHOP) { if (a2) { - gDungeon->unk644.unk48 += GetStackBuyPrice(item); + gDungeon->unk644.unk48 += GetActualBuyPrice(item); } } else { - gDungeon->unk644.unk4C += GetStackSellPrice(item); + gDungeon->unk644.unk4C += GetActualSellPrice(item); } } @@ -341,7 +340,7 @@ bool8 AddItemToDungeonAt(DungeonPos *pos, Item *item, bool8 a2) return TRUE; } -bool8 RemoveItemFromDungeonAt(DungeonPos *pos, bool8 a2) +bool8 RemoveGroundItem(DungeonPos *pos, bool8 a2) { s32 i, count; Item *item; @@ -350,15 +349,15 @@ bool8 RemoveItemFromDungeonAt(DungeonPos *pos, bool8 a2) if (tileObject == NULL || GetEntityType(tileObject) != ENTITY_ITEM) return FALSE; - item = GetItemData(tileObject); - if ((tile->terrainType & TERRAIN_TYPE_SHOP) && CanSellItem(item->id)) { + item = GetItemInfo(tileObject); + if ((tile->terrainType & TERRAIN_TYPE_SHOP) && IsShoppableItem(item->id)) { if (item->flags & ITEM_FLAG_IN_SHOP) { if (a2) { - gDungeon->unk644.unk48 -= GetStackBuyPrice(item); + gDungeon->unk644.unk48 -= GetActualBuyPrice(item); } } else { - gDungeon->unk644.unk4C -= GetStackSellPrice(item); + gDungeon->unk644.unk4C -= GetActualSellPrice(item); } } @@ -397,7 +396,7 @@ bool8 sub_80462AC(Entity * entity, u8 hallucinating, u8 a2, u8 a3, u8 a4) objMode = 1; } - if (!sub_8045888(entity)) + if (!ShouldDisplayEntity(entity)) return FALSE; } @@ -443,7 +442,7 @@ const u8 *sub_80464AC(Item *item) return gActions[GetItemActionType(item->id)].desc; } -void sub_80464C8(Entity *entity, DungeonPos *pos, Item *item) +void SpawnDroppedItemWrapper(Entity *entity, DungeonPos *pos, Item *item) { s32 x, y; Entity itemEntity; @@ -500,7 +499,7 @@ void SpawnDroppedItem(Entity *entity1, Entity *entity2, Item *item, bool8 a3, Du if (GetTerrainType(tile) != TERRAIN_TYPE_WALL && !(tile->terrainType & TERRAIN_TYPE_STAIRS) && tile->object == NULL) { sub_8046734(entity2, &localPos); localPos2 = localPos; - if (GetTerrainType(tile) == (TERRAIN_TYPE_SECONDARY | TERRAIN_TYPE_NORMAL) || (AddItemToDungeonAt(&localPos, item, TRUE))) { + if (GetTerrainType(tile) == (TERRAIN_TYPE_SECONDARY | TERRAIN_TYPE_NORMAL) || (SpawnItem(&localPos, item, TRUE))) { var_24 = TRUE; } break; @@ -510,19 +509,19 @@ void SpawnDroppedItem(Entity *entity1, Entity *entity2, Item *item, bool8 a3, Du sub_8045BF8(gFormatBuffer_Items[0], item); if (var_24) { - ShowDungeonMapAtPos(localPos.x, localPos.y); + DrawMinimapTile(localPos.x, localPos.y); switch (GetTerrainType(GetTile(localPos.x, localPos.y))) { case TERRAIN_TYPE_NORMAL: - TryDisplayDungeonLoggableMessage5(entity1, &localPos, gItemFellOnGround); + LogMessageByIdWithPopupCheckUserUnknown(entity1, &localPos, gItemFellOnGround); break; case TERRAIN_TYPE_SECONDARY: - TryDisplayDungeonLoggableMessage5(entity1, &localPos, gItemFellInWater); + LogMessageByIdWithPopupCheckUserUnknown(entity1, &localPos, gItemFellInWater); break; case TERRAIN_TYPE_WALL: - TryDisplayDungeonLoggableMessage5(entity1, &localPos, gItemBuried); + LogMessageByIdWithPopupCheckUserUnknown(entity1, &localPos, gItemBuried); break; case TERRAIN_TYPE_SECONDARY | TERRAIN_TYPE_NORMAL: - TryDisplayDungeonLoggableMessage5(entity1, &localPos, gItemFellOutOfSight); + LogMessageByIdWithPopupCheckUserUnknown(entity1, &localPos, gItemFellOutOfSight); break; } } @@ -537,7 +536,7 @@ void SpawnDroppedItem(Entity *entity1, Entity *entity2, Item *item, bool8 a3, Du } sub_804219C(&pixelPos); - TryDisplayDungeonLoggableMessage5(entity1, &localPos, gItemLost); + LogMessageByIdWithPopupCheckUserUnknown(entity1, &localPos, gItemLost); } } @@ -564,7 +563,7 @@ static void sub_8046734(Entity *entity, DungeonPos *pos) calcPixelPos.x += add.x; calcPixelPos.y += add.y; entity->unk1C.raw = sin_4096(sinVal) * 12; - sub_804535C(entity, &calcPixelPos); + UpdateEntityPixelPos(entity, &calcPixelPos); sub_80462AC(entity, hallucinating, 0, unk, 0); DungeonRunFrameActions(0x13); sinVal += 85; @@ -697,7 +696,7 @@ void sub_804687C(Entity *entity, DungeonPos *pos1, DungeonPos *pos2, Item *item, for (i = 0; i < count; i++) { if (targetTilePos[i].x >= 0) { - AddItemToDungeonAt(&targetTilePos[i], &item[i], TRUE); + SpawnItem(&targetTilePos[i], &item[i], TRUE); } } } @@ -822,7 +821,7 @@ static void MusicBoxCreation(void) sub_803E708(10,0x41); sub_804178C(1); gDungeon->unk1356C = 0; - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); } } diff --git a/src/dungeon_jobs.c b/src/dungeon_jobs.c index c15f298f9..902aec840 100644 --- a/src/dungeon_jobs.c +++ b/src/dungeon_jobs.c @@ -127,7 +127,7 @@ void sub_8084448(Entity *pokemon) sub_80843BC(entInfo->id); sub_8042A34(&pokemon->pos); - sub_8068FE0(pokemon,0x21c,0); + HandleFaint(pokemon,0x21c,0); sub_804178C(1); while(1) { if (DisplayDungeonYesNoMessage(0,str,1) == 1) { @@ -186,8 +186,8 @@ void sub_80845E0(Entity *pokemon) info2->joinedAt.id = gDungeon->unk644.dungeonLocation.id; sub_8042A34(&pokemon->pos); sub_8042A34(&entity->pos); - sub_8068FE0(pokemon,0x21c,0); - sub_8068FE0(entity,0x21c,0); + HandleFaint(pokemon,0x21c,0); + HandleFaint(entity,0x21c,0); sub_804178C(1); while(1) { if (DisplayDungeonYesNoMessage(0,gUnknown_80FA4D8,1) == 1) { diff --git a/src/dungeon_kecleon_shop.c b/src/dungeon_kecleon_shop.c index c21bb0704..1415282cd 100644 --- a/src/dungeon_kecleon_shop.c +++ b/src/dungeon_kecleon_shop.c @@ -30,8 +30,7 @@ #include "dungeon_misc.h" #include "sprite.h" #include "dungeon_strings.h" - -extern bool8 sub_8044B28(void); +#include "dungeon_engine.h" bool8 sub_807EF48(void); void sub_807EFFC(bool8 arg0); @@ -45,7 +44,7 @@ void sub_807EC28(bool8 arg0) bool32 prevTileWasShop; bool32 isShopTile; - if (sub_8044B28()) + if (IsFloorOver()) return; leader = GetLeader(); @@ -231,14 +230,14 @@ void sub_807EFFC(bool8 arg0) pos.x = x; tile = GetTile(x,y); if (tile->terrainType & TERRAIN_TYPE_SHOP && tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) { - Item *itemPtr = GetItemData(tile->object); + Item *itemPtr = GetItemInfo(tile->object); if (!ItemInShop(itemPtr)) { Item item = *itemPtr; - RemoveItemFromDungeonAt(&pos, 1); - if (CanSellItem(item.id)) { + RemoveGroundItem(&pos, 1); + if (IsShoppableItem(item.id)) { item.flags |= ITEM_FLAG_IN_SHOP; } - AddItemToDungeonAt(&pos, &item, 1); + SpawnItem(&pos, &item, 1); } } } @@ -278,8 +277,8 @@ s32 sub_807F19C(bool8 arg0) for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) { const Tile *tile = GetTile(x, y); if (!(tile->terrainType & TERRAIN_TYPE_SHOP) && tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) { - Item *itemPtr = GetItemData(tile->object); - if (CanSellItem(itemPtr->id)) { + Item *itemPtr = GetItemInfo(tile->object); + if (IsShoppableItem(itemPtr->id)) { itemPtr->flags &= ~(ITEM_FLAG_IN_SHOP); } } @@ -288,7 +287,7 @@ s32 sub_807F19C(bool8 arg0) for (i = 0; i < INVENTORY_SIZE; i++) { Item *item = &gTeamInventoryRef->teamItems[i]; - if (ItemExists(item) && CanSellItem(item->id)) { + if (ItemExists(item) && IsShoppableItem(item->id)) { item->flags &= ~(ITEM_FLAG_IN_SHOP); } } @@ -298,7 +297,7 @@ s32 sub_807F19C(bool8 arg0) if (EntityIsValid(mon)) { EntityInfo *monInfo = GetEntInfo(mon); Item *item = &monInfo->heldItem; - if (ItemExists(item) && CanSellItem(item->id)) { + if (ItemExists(item) && IsShoppableItem(item->id)) { item->flags &= ~(ITEM_FLAG_IN_SHOP); } } @@ -321,7 +320,7 @@ void sub_807F33C(void) for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) { const Tile *tile = GetTile(x,y); if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) { - Item *item = GetItemData(tile->object); + Item *item = GetItemInfo(tile->object); item->flags &= ~(ITEM_FLAG_IN_SHOP); } } diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 570ed1b63..78943ccf5 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -64,9 +64,9 @@ extern Item *sub_8044D90(Entity *, s32, u32); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); extern void sub_806A6E8(Entity *); -extern void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); +extern void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); bool8 sub_807EF48(void); -void sub_806A2BC(Entity *a0, u8 a1); +void TryPointCameraToMonster(Entity *a0, u8 a1); bool8 sub_80701A4(Entity *a0); void sub_8075680(u32); void sub_8094C88(void); @@ -79,7 +79,7 @@ static void TryCreateModeArrows(Entity *leader); bool8 sub_8094C48(void); void sub_803E724(s32 a0); void HandleTalkFieldAction(Entity *); -bool8 sub_8044B28(void); +bool8 IsFloorOver(void); bool8 IsNotAttacking(Entity *param_1, bool8 param_2); s32 GetTeamMemberEntityIndex(Entity *pokemon); bool8 sub_8070F80(Entity * pokemon, s32 direction); @@ -90,7 +90,7 @@ extern bool8 sub_8071A8C(Entity *pokemon); extern void GetWeatherName(u8 *dst, u8 weatherId); extern bool8 sub_8070F14(Entity * pokemon, s32 direction); extern Entity *sub_80696A8(Entity *a0); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); extern void sub_807EC28(bool8); @@ -160,7 +160,7 @@ void DungeonHandlePlayerInput(void) unkPtr = &gDungeon->unk181e8; var_38 = 3; gDungeon->unk12 = 0; - sub_806A2BC(GetLeader(), 1); + TryPointCameraToMonster(GetLeader(), 1); if (sub_80701A4(GetLeader())) { sub_803E708(60, 16); return; @@ -210,7 +210,7 @@ void DungeonHandlePlayerInput(void) } frames = 0; - sub_8044C50(ACTION_NOTHING); + SetLeaderActionFields(ACTION_NOTHING); sShowThreeArrows1 = FALSE; sShowThreeArrows2 = FALSE; @@ -242,7 +242,7 @@ void DungeonHandlePlayerInput(void) } if (gRealInputs.held & A_BUTTON && gRealInputs.held & B_BUTTON && FixedPointToInt(leaderInfo->belly) != 0) { - sub_8044C50(ACTION_PASS_TURN); + SetLeaderActionFields(ACTION_PASS_TURN); gDungeon->unk644.unk2F = 1; break; } @@ -253,14 +253,14 @@ void DungeonHandlePlayerInput(void) if (gRealInputs.pressed & A_BUTTON) { if (gRealInputs.held & B_BUTTON) { if (FixedPointToInt(leaderInfo->belly) != 0) { - sub_8044C50(ACTION_PASS_TURN); + SetLeaderActionFields(ACTION_PASS_TURN); gDungeon->unk644.unk2F = 1; break; } } else if (ShouldMonsterRunAwayAndShowEffect(leader, TRUE)) { LogMessageByIdWithPopupCheckUser(leader, gUnknown_80FD4B0); - sub_8044C50(ACTION_PASS_TURN); + SetLeaderActionFields(ACTION_PASS_TURN); gDungeon->unk644.unk2F = 1; break; } @@ -410,7 +410,7 @@ void DungeonHandlePlayerInput(void) s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { if (ItemExists(&gTeamInventoryRef->teamItems[i]) && ItemSet(&gTeamInventoryRef->teamItems[i])) { - sub_8044C50(ACTION_THROW_ITEM_PLAYER); + SetLeaderActionFields(ACTION_THROW_ITEM_PLAYER); leaderInfo->action.actionParameters[0].actionUseIndex = i +1; leaderInfo->action.actionParameters[0].itemPos.x = 0; leaderInfo->action.actionParameters[0].itemPos.y = 0; @@ -431,7 +431,7 @@ void DungeonHandlePlayerInput(void) sub_8094C88(); } sub_8052210(1); - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); SetBGOBJEnableFlags(0x1E); sub_803E708(0xA, 0x2F); while (1) { @@ -443,13 +443,13 @@ void DungeonHandlePlayerInput(void) if (gRealInputs.pressed & A_BUTTON) { gShowMonsterDotsInDungeonMap = (gShowMonsterDotsInDungeonMap == FALSE) ? TRUE : FALSE; // Flip - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); } } gDungeon->unk181e8.inFloorMapMode = FALSE; gGameOptionsRef->mapOption = prevMapOption; gShowMonsterDotsInDungeonMap = TRUE; - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); SetBGOBJEnableFlags(0); DungeonRunFrameActions(0x2F); DungeonRunFrameActions(0x2F); @@ -526,11 +526,11 @@ void DungeonHandlePlayerInput(void) if (immobilizedMsg != NULL) { LogMessageByIdWithPopupCheckUser(leader, immobilizedMsg); } - sub_8044C50(ACTION_PASS_TURN); + SetLeaderActionFields(ACTION_PASS_TURN); gDungeon->unk644.unk2F = 1; } else { - sub_8044C50(ACTION_WALK); + SetLeaderActionFields(ACTION_WALK); if ((gRealInputs.held & B_BUTTON || bPress) && FixedPointToInt(leaderInfo->belly) != 0) { if (GetEntInfo(leader)->cringeClassStatus.status != STATUS_CONFUSED) { gDungeon->unk644.unk28 = 1; @@ -558,9 +558,9 @@ void DungeonHandlePlayerInput(void) if (leaderInfo->action.action == 0x2D || leaderInfo->action.action == 0x13) { HandleTalkFieldAction(leader); - if (sub_8044B28()) + if (IsFloorOver()) break; - sub_8044C50(ACTION_NOTHING); + SetLeaderActionFields(ACTION_NOTHING); } else if ((r6.a0_8) == 0) { gDungeon->unk644.unk29 = 0; @@ -581,7 +581,7 @@ void DungeonHandlePlayerInput(void) sInRotateMode = FALSE; unkPtr->unk1821A = 0; sub_804AA60(); - if (sub_8044B28()) + if (IsFloorOver()) break; if (leaderInfo->action.action != 0) { if (leaderInfo->action.action == 0x2B) { @@ -993,14 +993,14 @@ static bool8 sub_805EC4C(Entity *a0, u8 a1) return TRUE; } -void sub_805EE30(void) +void CheckLeaderTile(void) { Entity *tileObject; Tile *tile; Entity *leader = GetLeader(); if (leader == NULL) return; - if (sub_8044B28()) + if (IsFloorOver()) return; tile = GetTileAtEntitySafe(leader); @@ -1015,12 +1015,12 @@ void sub_805EE30(void) switch (GetEntityType(tileObject)) { case ENTITY_TRAP: { - Trap *trap = GetTrapData(tileObject); + Trap *trap = GetTrapInfo(tileObject); bool32 r8 = FALSE; bool32 r7 = FALSE; if (IQSkillIsEnabled(leader, IQ_TRAP_SEER) && !tileObject->isVisible) { tileObject->isVisible = TRUE; - sub_8049ED4(); + UpdateTrapsVisibility(); r7 = TRUE; } if (trap->unk1 != 0) { @@ -1032,14 +1032,14 @@ void sub_805EE30(void) break; } if (!r7) { - HandleTrap(leader, &leader->pos, 0, 1); + TryTriggerTrap(leader, &leader->pos, 0, 1); } } break; case ENTITY_ITEM: { - Item *item = GetItemData(tileObject); + Item *item = GetItemInfo(tileObject); if (!(item->flags & ITEM_FLAG_IN_SHOP)) { - PickUpItemFromPos(&leader->pos, 1); + TryLeaderItemPickUp(&leader->pos, 1); } else { gDungeon->unk5C0 = 4; @@ -1137,7 +1137,7 @@ void sub_805F02C(void) } gLeaderPointer = NULL; r8->action = leaderInfo->action; - sub_803F508(r7); + PointCameraToMonster(r7); sub_8041AD0(leader); sub_8041AE0(GetLeader()); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], r7, 0); @@ -1199,7 +1199,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1) SetLeaderActionToNothing(TRUE); gTeamMenuChosenId = -1; PrintOnMainMenu(printAll); - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); while (1) { AddMenuCursorSprite(&gDungeonMenu); DungeonRunFrameActions(0x1D); @@ -1324,7 +1324,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1) if (i == GetLeaderActionContainer()->actionParameters[0].actionUseIndex) { gTeamMenuChosenId = count; if (GetLeaderActionId() != ACTION_NOTHING) { - sub_806A2BC(teamMon, 0); + TryPointCameraToMonster(teamMon, 0); } break; } @@ -1372,7 +1372,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1) currEntity = GetLeader(); } - sub_806A2BC(currEntity, 0); + TryPointCameraToMonster(currEntity, 0); ChangeDungeonCameraPos(&currEntity->pos, 0, 1, 1); GetLeaderInfo()->action.actionParameters[0].actionUseIndex = currMonId; SetLeaderActionToNothing(FALSE); @@ -1431,7 +1431,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1) break; } } - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); ChangeDungeonCameraPos(&GetLeader()->pos, 0, 1, 1); if (GetLeaderActionId() != ACTION_NOTHING) break; @@ -1522,7 +1522,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1) ResetUnusedInputStruct(); } else { - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); break; } } diff --git a/src/dungeon_map.c b/src/dungeon_map.c index 3d10011c1..05e67279a 100644 --- a/src/dungeon_map.c +++ b/src/dungeon_map.c @@ -25,7 +25,7 @@ extern s32 gUnknown_202EDD0; extern u8 GetFloorType(void); extern bool8 sub_8094C48(void); -extern bool8 sub_8045804(Entity *ent); +extern bool8 ShouldMinimapDisplayEntity(Entity *ent); extern bool8 DoesNotHaveShadedMap(void); struct UnkStruct1 @@ -163,7 +163,7 @@ void LoadDungeonMapPalette(void) } } -void ShowDungeonMapAtPos(s32 x, s32 y) +void DrawMinimapTile(s32 x, s32 y) { s32 yAdd = 0; const Tile *tile; @@ -242,7 +242,7 @@ void ShowDungeonMapAtPos(s32 x, s32 y) Entity *entity = tile->monster; if (entity != NULL) { s32 entType = GetEntityType(entity); - if (gShowMonsterDotsInDungeonMap && entType == ENTITY_MONSTER && sub_8045804(entity)) { + if (gShowMonsterDotsInDungeonMap && entType == ENTITY_MONSTER && ShouldMinimapDisplayEntity(entity)) { EntityInfo *entInfo = GetEntInfo(entity); if (IsExperienceLocked(entInfo->joinedAt.id) || entInfo->monsterBehavior == 1 || entInfo->monsterBehavior == 4) { mapGfxType = MAP_GFX_ALLY; @@ -282,7 +282,7 @@ void ShowDungeonMapAtPos(s32 x, s32 y) else { if (entType == ENTITY_TRAP) { if (entity->isVisible || showHiddenTraps) { - Trap *trap = GetTrapData(entity); + Trap *trap = GetTrapInfo(entity); mapGfxType = sTrapToMapGfxId[trap->id]; lookForMapObject = FALSE; } @@ -479,7 +479,7 @@ void CopyDungeonMapToVram(void) dungeon->dungeonMap.scheduledVramCopiesCount = 0; } -void ShowPlayerDotOnMap(void) +void FlashLeaderIcon(void) { if (gDungeon->unk181e8.inFloorMapMode) return; @@ -522,7 +522,7 @@ void ResetMapPlayerDotFrames(void) sPlayerDotFrames = 0; } -void ShowWholeRevealedDungeonMap(void) +void UpdateMinimap(void) { s32 x, y; @@ -530,7 +530,7 @@ void ShowWholeRevealedDungeonMap(void) for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) { for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) { - ShowDungeonMapAtPos(x, y); + DrawMinimapTile(x, y); } } } diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index b16cb719c..eb57ab659 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -475,7 +475,7 @@ static const s16 gUnknown_80F6C06[] = { 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63 }; -void sub_8049ED4(void) +void UpdateTrapsVisibility(void) { bool32 hallucinating, showInvisibleTrapsMonsters; u16 *src; @@ -1016,7 +1016,7 @@ void sub_804AAD4(void) gDungeon->unk104C0 = maxRooms + 1; } -void sub_804AC20(DungeonPos *pos) +void DiscoverMinimap(DungeonPos *pos) { s32 y; const Tile *tile2; @@ -1058,7 +1058,7 @@ void sub_804AC20(DungeonPos *pos) for (x = xMin; x <= xMax; x++) { tile = GetTileMut(x,y); tile->spawnOrVisibilityFlags |= 3; - ShowDungeonMapAtPos(x,y); + DrawMinimapTile(x,y); } } } @@ -1112,7 +1112,7 @@ bool8 sub_804AD34(DungeonPos *pos) { sub_80498A8(x + pos->x, y + pos->y); sub_8049BB0(x + pos->x, y + pos->y); - ShowDungeonMapAtPos(x + pos->x, y + pos->y); + DrawMinimapTile(x + pos->x, y + pos->y); } } } @@ -1121,10 +1121,10 @@ bool8 sub_804AD34(DungeonPos *pos) { entity = gDungeon->activePokemon[index]; if (EntityIsValid(entity)) { - sub_806CF98(entity); + DetermineMonsterShadow(entity); } } - sub_8049ED4(); + UpdateTrapsVisibility(); sub_8042A14(pos); } return iVar8; @@ -1174,7 +1174,7 @@ void sub_804AE84(DungeonPos *pos) for(x = -1; x < 2; x++) { sub_80498A8(x + pos->x, y + pos->y); - ShowDungeonMapAtPos(x + pos->x, y + pos->y); + DrawMinimapTile(x + pos->x, y + pos->y); } } @@ -1182,10 +1182,10 @@ void sub_804AE84(DungeonPos *pos) { entity = gDungeon->activePokemon[index]; if (EntityIsValid(entity)) { - sub_806CF98(entity); + DetermineMonsterShadow(entity); } } - sub_8049ED4(); + UpdateTrapsVisibility(); sub_8042A14(pos); } } diff --git a/src/dungeon_menu_items.c b/src/dungeon_menu_items.c index b7a76cf8d..caceb923c 100644 --- a/src/dungeon_menu_items.c +++ b/src/dungeon_menu_items.c @@ -29,13 +29,13 @@ extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void sub_806A2BC(Entity *a0, u8 a1); +extern void TryPointCameraToMonster(Entity *a0, u8 a1); extern void SetLeaderActionToNothing(u8 a0); extern Item *sub_8044D90(Entity *, s32, u32); extern bool8 sub_8070F14(Entity * pokemon, s32 direction); bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); extern Entity *sub_80696A8(Entity *a0); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); extern void sub_807EC28(bool8); @@ -184,7 +184,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1) else { r4 = a0; } - sub_806A2BC(r4, 0); + TryPointCameraToMonster(r4, 0); ChangeDungeonCameraPos(&r4->pos, 0, 1, 1); while (1) { @@ -475,7 +475,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b break; case 2: { const Tile *tile = GetTile(a1->pos.x, a1->pos.y); - Item *item = GetItemData(tile->object); + Item *item = GetItemInfo(tile->object); PrintFormattedStringOnWindow(x, 0, gFieldItemMenuGroundTextPtr, 0, 0); if (item->flags & ITEM_FLAG_EXISTS) { gDungeonMenu.currPageEntries++; diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index d807acde0..ff8635426 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -39,7 +39,7 @@ extern void SetLeaderActionToNothing(u8 a0); extern void sub_806752C(ActionContainer *a0); extern void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 a1); extern void sub_8067768(ActionContainer *a0); -extern void sub_806A2BC(Entity *a0, u8 a1); +extern void TryPointCameraToMonster(Entity *a0, u8 a1); extern bool8 sub_8071A8C(Entity *pokemon); extern void sub_8083D1C(void); extern s32 ActionToDungeonSubMenuId(u16 param_1); @@ -96,7 +96,7 @@ void ShowMovesFromTeamMenu(ActionContainer *a0) } } - sub_806A2BC(entityNew, 0); + TryPointCameraToMonster(entityNew, 0); ChangeDungeonCameraPos(&entityNew->pos, 0, 1, 1); SetLeaderActionToNothing(1); if (ShowDungeonMovesMenu(entityNew, 0, 1, countUntilId, count)) { @@ -169,7 +169,7 @@ void ShowMovesFromTeamMenu(ActionContainer *a0) break; } - sub_806A2BC(entityOrg, 0); + TryPointCameraToMonster(entityOrg, 0); ChangeDungeonCameraPos(&entityOrg->pos, 0, 1, 1); } diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index 1b9953b0a..d1f406d35 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -146,7 +146,7 @@ void ShowDungeonOthersMenu(void) break; } - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); sub_803EAF0(0, NULL); } diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index 6d6bceb5a..5c660a277 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -50,9 +50,9 @@ extern Item *sub_8044D90(Entity *, s32, u32); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); extern void sub_806A6E8(Entity *); -extern void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); +extern void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); bool8 sub_807EF48(void); -void sub_806A2BC(Entity *a0, u8 a1); +void TryPointCameraToMonster(Entity *a0, u8 a1); bool8 sub_805E874(void); bool8 sub_80701A4(Entity *a0); void sub_805E738(Entity *a0); @@ -70,7 +70,7 @@ bool8 sub_8094C48(void); bool8 sub_805EC4C(Entity *a0, u8 a1); void sub_803E724(s32 a0); void HandleTalkFieldAction(Entity *); -bool8 sub_8044B28(void); +bool8 IsFloorOver(void); bool8 IsNotAttacking(Entity *param_1, bool8 param_2); void ShowMainMenu(bool8 fromBPress, bool8 a1); bool8 sub_805EF60(Entity *a0, EntityInfo *a1); @@ -92,7 +92,7 @@ extern bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4) extern bool8 sub_8070F14(Entity * pokemon, s32 direction); bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); extern Entity *sub_80696A8(Entity *a0); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); extern void sub_807EC28(bool8); @@ -200,7 +200,7 @@ bool8 ShowDungeonTeamMenu(Entity *a0) s32 id = sp.unk4[gDungeonMenu.menuIndex]; if (id >= 0) { Entity *teamMon = gDungeon->teamPokemon[id]; - sub_806A2BC(teamMon, 0); + TryPointCameraToMonster(teamMon, 0); ChangeDungeonCameraPos(&teamMon->pos, 0, 1, 1); } @@ -240,7 +240,7 @@ bool8 ShowDungeonTeamMenu(Entity *a0) id = sp.unk4[gDungeonMenu.menuIndex]; if (id >= 0) { Entity *teamMon = gDungeon->teamPokemon[id]; - sub_806A2BC(teamMon, 0); + TryPointCameraToMonster(teamMon, 0); ChangeDungeonCameraPos(&teamMon->pos, 0, 1, 1); } @@ -298,7 +298,7 @@ bool8 ShowDungeonTeamMenu(Entity *a0) } if (ret) { - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); } sub_803EAF0(0, NULL); return ret; @@ -1500,7 +1500,7 @@ Entity *ShowDungeonToWhichMonMenu(s32 *teamId, s32 caseId) } } prevId = currId; - sub_806A2BC(entity, 0); + TryPointCameraToMonster(entity, 0); ChangeDungeonCameraPos(&entity->pos, 0, 1, 1); } @@ -1532,7 +1532,7 @@ Entity *ShowDungeonToWhichMonMenu(s32 *teamId, s32 caseId) AddMenuCursorSprite(&gDungeonMenu); DungeonRunFrameActions(0x1B); sub_804AA60(); - sub_806A2BC(GetLeader(), 0); + TryPointCameraToMonster(GetLeader(), 0); sub_803EAF0(0, NULL); sub_803E708(4, 0x3E); if (bPress) { diff --git a/src/dungeon_menu_tile.c b/src/dungeon_menu_tile.c index 80ebd200e..58b596828 100644 --- a/src/dungeon_menu_tile.c +++ b/src/dungeon_menu_tile.c @@ -187,7 +187,7 @@ static void ShowTileDescription(DungeonPos *pos) break; DungeonShowWindows(&windows, FALSE); - trap = GetTrapData(object); + trap = GetTrapInfo(object); GetTrapName(trapName, trap->id); sub_80073B8(0); PrintStringOnWindow(16, 0, trapName, 0, '\0'); diff --git a/src/dungeon_message.c b/src/dungeon_message.c index a195c0053..423632fbe 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -32,7 +32,6 @@ void sub_80526D0(s32 r0); static bool8 sub_8052DC0(Entity *); static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2); -extern bool8 sub_8045888(Entity *pokemon); extern void sub_805E804(void); extern void sub_8083E28(void); extern void PlayDungeonCancelSE(void); @@ -87,14 +86,14 @@ void sub_805229C(void) void LogMessageByIdWithPopupCheckUser(Entity *pokemon, const u8 *str) { - if (sub_8045888(pokemon)){ + if (ShouldDisplayEntity(pokemon)){ DisplayMessageAddToLog(pokemon, str, TRUE); } } UNUSED void TryDisplayDungeonLoggableMessage2(Entity *pokemon, const u8 *str) { - if (sub_8045888(pokemon)){ + if (ShouldDisplayEntity(pokemon)){ DisplayMessageAddToLog(pokemon, str, FALSE); } } @@ -107,7 +106,7 @@ void DisplayDungeonLoggableMessageFalse(Entity *pokemon, const u8 *str) void TryDisplayDungeonLoggableMessage3(Entity *attacker, Entity *target, const u8 *str) { u8 flag; - flag = sub_8045888(attacker) ? TRUE : FALSE; + flag = ShouldDisplayEntity(attacker) ? TRUE : FALSE; if(sub_8052DC0(target) != 0) { flag = TRUE; @@ -121,7 +120,7 @@ void TryDisplayDungeonLoggableMessage3(Entity *attacker, Entity *target, const u void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u8 *str) { u8 flag; - flag = sub_8045888(attacker) ? TRUE : FALSE; + flag = ShouldDisplayEntity(attacker) ? TRUE : FALSE; if(sub_8052DC0(target) != 0) { flag = TRUE; @@ -132,11 +131,11 @@ void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u } } -void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos, +void LogMessageByIdWithPopupCheckUserUnknown(Entity *pokemon, DungeonPos *pos, const u8 *str) { u8 flag; - flag = sub_8045888(pokemon) ? TRUE : FALSE; + flag = ShouldDisplayEntity(pokemon) ? TRUE : FALSE; if(sub_803F428(pos)) { flag = TRUE; @@ -604,7 +603,7 @@ void sub_8052D44(s16 *ids, Entity *leader, Entity *partner) static bool8 sub_8052DC0(Entity *entity) { - return sub_8045888(entity); + return ShouldDisplayEntity(entity); } static inline bool32 DislayTutorialMsg(Entity *leader, const struct TutorialFlagMsg *tutorial, bool32 unkFunctionCall) @@ -641,7 +640,7 @@ void TryDisplayGeneralTutorialMessage(void) } } -void TryDisplayItemPickupTutorialMessage(u8 itemId) +void DisplayItemTip(u8 itemId) { u32 itemCategory = GetItemCategory(itemId); diff --git a/src/dungeon_message_log.c b/src/dungeon_message_log.c index d69de2112..8b35b67fe 100644 --- a/src/dungeon_message_log.c +++ b/src/dungeon_message_log.c @@ -16,7 +16,6 @@ #define MESSAGE_LOG_ROW_COUNT 8 // How many log messages are shown -extern bool8 sub_8045888(Entity *pokemon); extern void sub_805E804(void); extern void sub_8083E28(void); extern u32 GetTouchScreenArrowPress(s32 a0, const void *a1); diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 705f57312..c9cccc9cf 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -48,7 +48,7 @@ static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); -extern bool8 IsLevelResetTo1(u8 dungeon); +extern bool8 IsLevelResetDungeon(u8 dungeon); 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); @@ -61,10 +61,9 @@ extern void sub_8042900(Entity *r0); extern void sub_8042968(Entity *r0); extern void EndAbilityImmuneStatus(Entity *, Entity *); extern void sub_8041BBC(Entity *r0); -extern bool8 sub_8045888(Entity *); -extern void sub_806A2BC(Entity *, u8); +extern void TryPointCameraToMonster(Entity *, u8); extern void sub_804178C(u32); -extern void sub_803F508(Entity *); +extern void PointCameraToMonster(Entity *); extern void sub_8042B20(Entity *entity); extern void sub_8042B0C(Entity *entity); extern void sub_8072AC8(u16 *param_1, s32 species, s32 param_3); @@ -80,8 +79,8 @@ extern s32 gDungeonFramesCounter; extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void sub_803F580(s32); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateCamera(s32); +extern void UpdateMinimap(void); extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); extern Entity *sub_80696A8(Entity *a0); @@ -234,7 +233,7 @@ void SetDungeonMonsFromTeam(void) Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[recruitedId]; if (PokemonExists(pokeStruct) && PokemonFlag2(pokeStruct)) { RecruitedPokemonToDungeonMon(&gRecruitedPokemonRef->dungeonTeam[index],recruitedId); - if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id)) { + if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id)) { struct DungeonLocation dungeonLoc = {.id = DUNGEON_TINY_WOODS, .floor = 1}; CreateLevel1Pokemon(&lvl1Mon,pokeStruct->speciesNum,0,0,&dungeonLoc,0); gRecruitedPokemonRef->dungeonTeam[index].level = lvl1Mon.level; @@ -363,7 +362,7 @@ void sub_8068BDC(bool8 a0) } if (sub_806A58C(monPtr->recruitedPokemonId)) { - if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id)) { + if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id)) { sub_808DFDC(monPtr->recruitedPokemonId, monPtr); } else { @@ -474,7 +473,7 @@ void sub_8068F80(void) bool8 isShop = (GetTileAtEntitySafe(leader)->terrainType & TERRAIN_TYPE_SHOP) != 0; dungeon->unk644.unk54 = isShop; dungeon->unk644.unk55 = isShop; - sub_804AC20(&leader->pos); + DiscoverMinimap(&leader->pos); } } @@ -488,7 +487,7 @@ static inline void ClearMonItemId(Pokemon *mon) mon->heldItem.id = ITEM_NOTHING; } -void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) +void HandleFaint(Entity *entity, s32 param_2, Entity *param_3) { u16 joinId; Entity EStack_a4; @@ -504,7 +503,7 @@ void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) tile->monster = NULL; } - ShowDungeonMapAtPos(entity->pos.x,entity->pos.y); + DrawMinimapTile(entity->pos.x,entity->pos.y); for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { Entity *mon = gDungeon->activePokemon[i]; @@ -587,7 +586,7 @@ void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) DungeonMon *partnerStruct = &gRecruitedPokemonRef->dungeonTeam[partnerInfo->teamIndex]; sub_806C264(partnerInfo->teamIndex,partnerInfo); if (sub_806A58C(partnerStruct->recruitedPokemonId) != 0) { - if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id) == 0) { + if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id) == 0) { DungeonMonToRecruitedPokemon(partnerStruct->recruitedPokemonId, partnerStruct); } if (!IsMakuhitaTrainingMaze()) { @@ -625,7 +624,7 @@ void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) gDungeon->deoxysDefeat = 1; DisplayDungeonLoggableMessageTrue(entity,gUnknown_80FA580); sub_803E178(); - sub_8049ED4(); + UpdateTrapsVisibility(); } } @@ -635,7 +634,7 @@ void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) if (sub_806A58C(mon2Ptr->recruitedPokemonId) != 0) { bool8 uVar10; - if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id) == 0) { + if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id) == 0) { DungeonMonToRecruitedPokemon(mon2Ptr->recruitedPokemonId, mon2Ptr); } if (!IsMakuhitaTrainingMaze()) { @@ -685,7 +684,7 @@ void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4) if (tile2->monster == target) { tile2->monster = NULL; } - ShowDungeonMapAtPos((target->pos).x,(target->pos).y); + DrawMinimapTile((target->pos).x,(target->pos).y); } (target->prevPos).x = (target->pos).x; (target->prevPos).y = (target->pos).y; @@ -701,7 +700,7 @@ void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4) gUnknown_202EE0C.y = y; gDungeon->unk1 = 0; } - ShowDungeonMapAtPos(x,y); + DrawMinimapTile(x,y); switch(param_4) { @@ -721,7 +720,7 @@ void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4) break; } target->room = tile->room; - sub_806CF98(target); + DetermineMonsterShadow(target); } return; } @@ -1058,7 +1057,7 @@ void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target) r0->level = info->level; - GetPokemonLevelData(&leveldata, info->id, info->level); + GetLvlUpEntry(&leveldata, info->id, info->level); r0->exp = leveldata.expRequired; r0->att[0] = info->atk[0]; r0->att[1] = info->atk[1]; @@ -1097,7 +1096,7 @@ void sub_8069E0C(Entity *pokemon) gDungeon->unkC = 1; } -void TriggerWeatherAbilities(void) +void TryActivateArtificialWeatherAbilities(void) { Entity *entity; s32 index; @@ -1262,8 +1261,8 @@ void sub_806A1E8(Entity *pokemon) if (gGameOptionsRef->FarOffPals == '\0') { bVar3 = FALSE; } - if (bVar3 && (!sub_8045888(pokemon))) { - sub_806A2BC(pokemon,1); + if (bVar3 && (!ShouldDisplayEntity(pokemon))) { + TryPointCameraToMonster(pokemon,1); } } } @@ -1279,21 +1278,21 @@ void sub_806A240(Entity *pokemon, Entity *target) entityInfo = GetEntInfo(pokemon); isNotTeamMember = (!entityInfo->isNotTeamMember); } - if (isNotTeamMember && (!sub_8045888(pokemon))) { - sub_806A2BC(pokemon,1); + if (isNotTeamMember && (!ShouldDisplayEntity(pokemon))) { + TryPointCameraToMonster(pokemon,1); return; } else if (GetEntityType(target) == ENTITY_MONSTER) { entityInfo = GetEntInfo(target); isNotTeamMember = (!entityInfo->isNotTeamMember); } - if (isNotTeamMember && (!sub_8045888(target))) { - sub_806A2BC(target,1); + if (isNotTeamMember && (!ShouldDisplayEntity(target))) { + TryPointCameraToMonster(target,1); } } } -void sub_806A2BC(Entity *pokemon, u8 param_2) +void TryPointCameraToMonster(Entity *pokemon, u8 param_2) { if ((EntityIsValid(pokemon)) && (GetEntityType(pokemon) == ENTITY_MONSTER) && (gDungeon->unk181e8.cameraTarget != pokemon)) { if (param_2 != '\0') { @@ -1303,8 +1302,8 @@ void sub_806A2BC(Entity *pokemon, u8 param_2) } } sub_803E708(4,0x44); - sub_803F508(pokemon); - sub_804AC20(&pokemon->pos); + PointCameraToMonster(pokemon); + DiscoverMinimap(&pokemon->pos); gDungeon->unk12 = 0; } } @@ -1312,7 +1311,7 @@ void sub_806A2BC(Entity *pokemon, u8 param_2) void nullsub_95(void) {} -void sub_806A338(void) +void ReevaluateSnatchMonster(void) { s32 i; @@ -1524,8 +1523,8 @@ void sub_806A6E8(Entity *entity) } else { if (info->heldItem.id == ITEM_X_RAY_SPECS || info->unk64 == ITEM_X_RAY_SPECS) { - sub_803F580(1); - ShowWholeRevealedDungeonMap(); + UpdateCamera(1); + UpdateMinimap(); } } sub_807AA30(); diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 64b879982..2909f3196 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -43,18 +43,17 @@ #include "targeting_flags.h" #include "text_util.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" extern void sub_80429C8(Entity *r0); -extern bool8 sub_8045888(Entity *r0); extern void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, struct DamageStruct *dmgStruct, s24_8, u16, u32); extern s16 sub_8057600(Move *move, s32 itemID); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_806A1E8(Entity *pokemon); -extern bool8 sub_8044B28(void); extern void sub_804178C(u32); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); @@ -168,7 +167,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, direction2 &= DIRECTION_MASK; tileEntity = GetTile(currTarget->pos.x + gAdjacentTileOffsets[direction2].x, currTarget->pos.y + gAdjacentTileOffsets[direction2].y)->monster; if (EntityIsValid(tileEntity) && GetEntityType(tileEntity) == ENTITY_MONSTER) { - if (sub_8045888(currTarget)) { + if (ShouldDisplayEntity(currTarget)) { s32 k; for (k = 0; k < 24; k++) { sub_806CE68(currTarget, direction1); @@ -290,7 +289,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, moveHits = FALSE; } - if (sub_8045888(currTarget)) { + if (ShouldDisplayEntity(currTarget)) { sub_803E708(4, 0x4A); sub_8041168(attacker, currTarget, move, NULL); } @@ -317,7 +316,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, TryDisplayDungeonLoggableMessage3(attacker, currTarget, gUnknown_80F9364); // is unaffected! } - if (sub_8045888(currTarget)) { + if (ShouldDisplayEntity(currTarget)) { sub_803ED30(9999, currTarget, 1, -1); } @@ -330,7 +329,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, break; } - if (sub_8044B28()) + if (IsFloorOver()) break; // breaks out of the loop } else { @@ -1313,7 +1312,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, break; } - if (sub_8044B28()) { + if (IsFloorOver()) { break; } @@ -1347,7 +1346,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, } } - if (!sub_8044B28()) { + if (!IsFloorOver()) { if (EntityIsValid(attacker) && GetEntInfo(attacker)->unk154 != 0) { GetEntInfo(attacker)->unk154 = 0; WarpTarget(attacker, attacker, 0, NULL); @@ -1405,7 +1404,7 @@ static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct Dam } else { SetMessageArgument_2(gFormatBuffer_Monsters[1], GetEntInfo(target), 0); - if (sub_8045888(attacker) && sub_8045888(target)) { + if (ShouldDisplayEntity(attacker) && ShouldDisplayEntity(target)) { sub_803ED30(9999, target, 1, -1); TryDisplayDungeonLoggableMessage4(attacker, target, gUnknown_80F9688); // It took no damage! sub_8042238(attacker, target); diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 8ac1015d6..434418131 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -41,15 +41,14 @@ #include "pokemon_types.h" #include "dungeon_run_end.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" extern void sub_80429C8(Entity *r0); -extern bool8 sub_8045888(Entity *r0); extern void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, struct DamageStruct *dmgStruct, s24_8, u16, u32); extern void sub_806A1E8(Entity *pokemon); -extern bool8 sub_8044B28(void); extern void sub_804178C(u32); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); @@ -113,7 +112,7 @@ bool32 sub_8055A00(Entity *attacker, s32 firstMoveId, s32 var_34, s32 itemId, s3 while (1) { Move *currMove = &attackerInfo->moves.moves[moveId]; - if (!EntityIsValid(attacker) || sub_8044B28()) + if (!EntityIsValid(attacker) || IsFloorOver()) break; if (currMove->id == MOVE_SNORE || currMove->id == MOVE_SLEEP_TALK) { @@ -186,7 +185,7 @@ bool32 sub_8055A00(Entity *attacker, s32 firstMoveId, s32 var_34, s32 itemId, s3 } sub_804178C(1); - if (!EntityIsValid(attacker) || sub_8044B28()) + if (!EntityIsValid(attacker) || IsFloorOver()) break; if (++moveId >= MAX_MON_MOVES) break; @@ -218,7 +217,7 @@ bool32 sub_8055A00(Entity *attacker, s32 firstMoveId, s32 var_34, s32 itemId, s3 } if (EntityIsValid(attacker)) { - sub_8071DA4(attacker); + EnemyEvolution(attacker); if (EntityIsValid(attacker) && gUnknown_202F222 != 0) { gUnknown_202F222 = 0; if (EntityIsValid(attacker)) { @@ -412,7 +411,7 @@ bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, var_24 = 1; if (gUnknown_202F220 != 0 || gUnknown_202F221 != 0) break; - if (!EntityIsValid(attacker) || sub_8044B28()) + if (!EntityIsValid(attacker) || IsFloorOver()) return TRUE; entInfo = GetEntInfo(attacker); @@ -487,14 +486,14 @@ bool8 sub_8056468(Entity *entity, Move *move, const u8 *str, Entity **unkArray, { s32 i; bool8 ret = FALSE; - bool32 r7 = (sub_8045888(entity) != FALSE); + bool32 r7 = (ShouldDisplayEntity(entity) != FALSE); if (str != NULL) { for (i = 0; i < 65; i++) { if (unkArray[i] == NULL) { break; } - if (sub_8045888(unkArray[i])) { + if (ShouldDisplayEntity(unkArray[i])) { r7 = TRUE; break; } @@ -1194,7 +1193,7 @@ bool8 sub_80571F0(Entity * pokemon, Move *move) bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance) { bool8 uVar2; - if (sub_8044B28()) + if (IsFloorOver()) return FALSE; if (!EntityIsValid(pokemon) || !EntityIsValid(target)) return FALSE; diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index e804f1d0f..ab73f4f56 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -177,7 +177,7 @@ static void WriteDungeonItems(DataSerializer *seri) notEmpty = FALSE; if (entity != NULL && GetEntityType(entity) == ENTITY_ITEM) { - item = GetItemData(entity); + item = GetItemInfo(entity); WriteItem(seri, item); // 3 bytes WriteBytes(seri, &entity->pos.x, 1); // 1 byte WriteBytes(seri, &entity->pos.y, 1); // 1 byte @@ -207,7 +207,7 @@ static void WriteDungeonTraps(DataSerializer *seri) notEmpty = FALSE; if (entity != NULL && GetEntityType(entity) == ENTITY_TRAP) { - trap = GetTrapData(entity); + trap = GetTrapInfo(entity); WriteBytes(seri, &trap->id, 1); WriteBytes(seri, &trap->unk1, 1); WriteBytes(seri, &entity->isVisible, 1); @@ -873,7 +873,7 @@ static void ReadDungeonItems(DataSerializer *seri) ReadTilePos(seri, &pos); if (item.flags & ITEM_FLAG_EXISTS) - AddItemToDungeonAt(&pos, &item, 0); + SpawnItem(&pos, &item, 0); } } @@ -1101,7 +1101,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index) } LoadIQSkills(mon); - sub_804535C(mon, NULL); + UpdateEntityPixelPos(mon, NULL); } } } diff --git a/src/dungeon_tilemap.c b/src/dungeon_tilemap.c index 238861610..b96906ae0 100644 --- a/src/dungeon_tilemap.c +++ b/src/dungeon_tilemap.c @@ -36,15 +36,15 @@ extern s32 gDungeonFramesCounter; -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_80400D4(void); extern void sub_8041888(u8 param_1); extern void sub_803F7BC(void); -extern void ShowWholeRevealedDungeonMap(); +extern void UpdateMinimap(); void sub_803EC94(void); s32 sub_803EF90(s32 a0, u8 a1); -void sub_803F580(u8 a0); +void UpdateCamera(u8 a0); void sub_803F7BC(void); void sub_803F38C(void); void sub_803FB74(void); @@ -157,7 +157,7 @@ void sub_803F4A0(Entity *a0) strPtr->unk18216 = 1; } - sub_803F580(0); + UpdateCamera(0); sub_803F38C(); if (gDungeon->unk1356C == 0) { sub_806CD90(); @@ -165,7 +165,7 @@ void sub_803F4A0(Entity *a0) } // Very similar to the one above -void sub_803F508(Entity *a0) +void PointCameraToMonster(Entity *a0) { UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8; @@ -180,16 +180,16 @@ void sub_803F508(Entity *a0) } strPtr->cameraTarget = a0; - sub_803F580(0); + UpdateCamera(0); sub_803F38C(); if (gDungeon->unk1356C == 0) { sub_806CD90(); } - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } -void sub_803F580(u8 a0) +void UpdateCamera(u8 a0) { UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8; Entity *cameraTarget = strPtr->cameraTarget; @@ -265,14 +265,14 @@ void sub_803F580(u8 a0) } if (before != strPtr->showInvisibleTrapsMonsters) { - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); sub_8041888(0); } if (a0 && strPtr->unk18213 == 0) { if (abs(strPtr->cameraPixelPosMirror.x - strPtr->cameraPixelPos.x) > 7 || abs(strPtr->cameraPixelPosMirror.y - strPtr->cameraPixelPos.y) > 7) { - sub_8049ED4(); + UpdateTrapsVisibility(); strPtr->unk18213 = 1; } else { @@ -296,7 +296,7 @@ void sub_803F580(u8 a0) for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { Entity *mon = gDungeon->activePokemon[i]; if (EntityIsValid(mon)) { - ShowDungeonMapAtPos(mon->pos.x, mon->pos.y); + DrawMinimapTile(mon->pos.x, mon->pos.y); } } } @@ -352,7 +352,7 @@ void sub_803F878(s32 a0, s32 a1) } if (abs(strPtr->cameraPixelPosMirror.x - strPtr->cameraPixelPos.x) > 7 || abs(strPtr->cameraPixelPosMirror.y - strPtr->cameraPixelPos.y) > 7) { - sub_8049ED4(); + UpdateTrapsVisibility(); strPtr->unk18213 = 1; } else { @@ -716,9 +716,9 @@ void HandleLuminousOrbAction(Entity *pokemon) mapTile->spawnOrVisibilityFlags |= VISIBILITY_FLAG_REVEALED; } } - sub_803F580(0); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateCamera(0); + UpdateTrapsVisibility(); + UpdateMinimap(); LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD040); } diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 780d30dca..c62eafb0a 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -54,12 +54,12 @@ u8 GetEntityRoom(Entity *entity) return entity->room; } -Trap* GetTrapData(Entity *entity) +Trap* GetTrapInfo(Entity *entity) { return entity->axObj.info.trap; } -Item* GetItemData(Entity *entity) +Item* GetItemInfo(Entity *entity) { return entity->axObj.info.item; } @@ -187,16 +187,16 @@ void sub_804522C(void) } } -void sub_804535C(Entity *entity, PixelPos *pos) +void UpdateEntityPixelPos(Entity *entity, PixelPos *pos) { - if (pos != NULL) { - entity->pixelPos.x = pos->x; - entity->pixelPos.y = pos->y; - } - else { - entity->pixelPos.x = X_POS_TO_PIXELPOS(entity->pos.x); - entity->pixelPos.y = Y_POS_TO_PIXELPOS(entity->pos.y); - } + if (pos != NULL) { + entity->pixelPos.x = pos->x; + entity->pixelPos.y = pos->y; + } + else { + entity->pixelPos.x = X_POS_TO_PIXELPOS(entity->pos.x); + entity->pixelPos.y = Y_POS_TO_PIXELPOS(entity->pos.y); + } } void SetEntityPixelPos(Entity *entity, s32 x, s32 y) @@ -360,7 +360,7 @@ Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c) return NULL; } -Entity *sub_8045708(DungeonPos *pos) +Entity *SpawnItemEntity(DungeonPos *pos) { s32 i; Entity *ent; @@ -398,7 +398,7 @@ void sub_80457DC(Entity* ent) ent->unk22 = 0; } -bool8 sub_8045804(Entity *ent) +bool8 ShouldMinimapDisplayEntity(Entity *ent) { UnkDungeonGlobal_unk181E8_sub* saveTyping; Entity* camTarget; @@ -438,7 +438,7 @@ bool8 sub_8045804(Entity *ent) } } -bool8 sub_8045888(Entity *ent) +bool8 ShouldDisplayEntity(Entity *ent) { if (ent->isVisible) { s32 x = (ent->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x; diff --git a/src/dungeon_vram.c b/src/dungeon_vram.c index d337c353c..1c8103571 100644 --- a/src/dungeon_vram.c +++ b/src/dungeon_vram.c @@ -48,7 +48,7 @@ extern OpenedFile *gUnknown_202EC9C; void xxx_draw_string_80524F0(void); void sub_8085F78(void); -void sub_803F580(s32); +void UpdateCamera(s32); void sub_806CC10(); void sub_804522C(); void sub_803F9CC(); @@ -176,7 +176,7 @@ static void sub_803E490(u32 unused) gUnknown_202EDD4++; xxx_draw_string_80524F0(); sub_8085F78(); - sub_803F580(1); + UpdateCamera(1); if(gDungeon->unk181e8.unk1821A) { @@ -202,7 +202,7 @@ static void sub_803E490(u32 unused) sub_8042E5C(); if(gUnknown_202EDD0 == 0 || gUnknown_202EDD0 == 3 || gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) - ShowPlayerDotOnMap(); + FlashLeaderIcon(); sub_803ECE0(); sub_803EDF0(); @@ -571,7 +571,7 @@ void sub_803EAF0(u32 kind, u8 *name) sub_803EC94(); ShowWindows(NULL, TRUE, TRUE); if (gUnknown_203B40C != 0) { - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); UpdateBgTilemapForDungeonMap(FALSE); } break; diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index 3479d0c23..5537cfb90 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -15,11 +15,11 @@ #include "move_util.h" #include "moves.h" #include "structs/str_dungeon.h" +#include "dungeon_engine.h" -extern u8 UseAttack(Entity *); +extern u8 DisplayActions(Entity *); extern void sub_805E804(void); -void sub_806A2BC(Entity *pokemon, u8 param_2); -extern u8 sub_8044B28(void); +void TryPointCameraToMonster(Entity *pokemon, u8 param_2); extern void nullsub_93(DungeonPos *); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); extern void sub_807EC28(bool8); @@ -42,9 +42,9 @@ void sub_807E378(void) if (gDungeon->unk644.unk36 == 0) { if (gDungeon->unk644.windTurns < 0xfa) { sub_805E804(); - sub_806A2BC(leader,1); - UseAttack(leader); - if (sub_8044B28() == 0) { + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (IsFloorOver() == 0) { LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C4C); sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],0); gDungeon->unk644.unk36 = 1; @@ -54,9 +54,9 @@ void sub_807E378(void) else if (gDungeon->unk644.unk36 == 1) { if (gDungeon->unk644.windTurns < 0x96) { sub_805E804(); - sub_806A2BC(leader,1); - UseAttack(leader); - if (sub_8044B28() == 0) { + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (IsFloorOver() == 0) { LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C70); sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],1); gDungeon->unk644.unk36 = 2; @@ -66,9 +66,9 @@ void sub_807E378(void) else if (gDungeon->unk644.unk36 == 2) { if (gDungeon->unk644.windTurns < 0x32) { sub_805E804(); - sub_806A2BC(leader,1); - UseAttack(leader); - if (sub_8044B28() == 0) { + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (IsFloorOver() == 0) { LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C8C); sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],2); gDungeon->unk644.unk36 = 3; @@ -77,13 +77,13 @@ void sub_807E378(void) } else if (gDungeon->unk644.windTurns < 1) { sub_805E804(); - sub_806A2BC(leader,1); - UseAttack(leader); - if (sub_8044B28() == 0) { + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (IsFloorOver() == 0) { LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9CBC); sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],3); gDungeon->unk644.unk36 = 4; - sub_8068FE0(leader,0x21e,leader); + HandleFaint(leader,0x21e,leader); } } } diff --git a/src/explosion.c b/src/explosion.c index 93de0e20d..df491faaf 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -25,8 +25,8 @@ #include "dungeon_misc.h" #include "dungeon_items.h" #include "dungeon_strings.h" +#include "dungeon_engine.h" -extern u8 sub_8044B28(void); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); extern void sub_804216C(Entity *pokemon, Entity *target, u32 r2); extern void sub_804218C(Entity *pokemon, Entity *target); @@ -139,18 +139,18 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para } entity2 = tile->object; if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_ITEM)) { - RemoveItemFromDungeonAt(&pos, 0); + RemoveGroundItem(&pos, 0); } entity2 = tile->monster; if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_MONSTER)) { sub_807E1A0(pokemon,entity2,moveType,uStack_2c,gUnknown_203B444[param_4]); - if (sub_8044B28()) break; + if (IsFloorOver()) break; } } posPtr++; } } - if (sub_8044B28()) { + if (IsFloorOver()) { return; } if (GetEntityType(target) == ENTITY_MONSTER) { @@ -166,8 +166,8 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para sub_8049BB0(x,y); } } - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + UpdateMinimap(); + UpdateTrapsVisibility(); } } diff --git a/src/expose_trap.c b/src/expose_trap.c index 8a416d9a0..8987ab91c 100644 --- a/src/expose_trap.c +++ b/src/expose_trap.c @@ -62,8 +62,8 @@ void sub_807D3CC(Entity *param_1) } if (flag) { LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80FD2F8); // All traps were exposed - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + UpdateMinimap(); + UpdateTrapsVisibility(); } else { LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80FD320); // There appears to be no hidden traps. diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index 994751697..c6c9ebd5e 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -757,7 +757,7 @@ bool8 sub_8027E4C(Pokemon *pokeStruct) return FALSE; else { - if(IsThrowableItem(pokeStruct->heldItem.id)) + if(IsThrownItem(pokeStruct->heldItem.id)) { if(gTeamInventoryRef->teamStorage[pokeStruct->heldItem.id] + pokeStruct->heldItem.quantity > 0x3e7) return FALSE; @@ -785,7 +785,7 @@ void sub_8027EB8(void) break; case 2: PlaySound(0x14d); - if(IsThrowableItem(sUnknown_203B2BC->item2.id)) + if(IsThrownItem(sUnknown_203B2BC->item2.id)) gTeamInventoryRef->teamStorage[sUnknown_203B2BC->item2.id] += sUnknown_203B2BC->item2.quantity; else gTeamInventoryRef->teamStorage[sUnknown_203B2BC->item2.id] += 1; diff --git a/src/hurl_orb.c b/src/hurl_orb.c index e91408117..8dd074309 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -42,7 +42,6 @@ extern void sub_80833E8(DungeonPos *param_1, s32 *param_2); extern void sub_806A5B8(Entity *); -extern bool8 sub_8045888(Entity *ent); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); extern void sub_807D068(Entity *, DungeonPos *); extern void sub_807EC28(bool8 arg0); @@ -145,7 +144,7 @@ void sub_807F43C(Entity *target, Entity *attacker) SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0); TryDisplayDungeonLoggableMessage3(target, attacker, gUnknown_80FE690); // m0 was sent flying! - if (sub_8045888(attacker)) { + if (ShouldDisplayEntity(attacker)) { PlaySoundEffect(0x1A3); } @@ -169,8 +168,8 @@ void sub_807F43C(Entity *target, Entity *attacker) for (i = 0; i < r6; i++) { var_54.x += var_30; var_54.y += r10; - sub_804535C(attacker, &var_54); - if (sub_8045888(attacker)) { + UpdateEntityPixelPos(attacker, &var_54); + if (ShouldDisplayEntity(attacker)) { attacker->unk1C.raw = sin_4096(var_2C) << 5; DungeonRunFrameActions(0x3B); if (!(i & 3)) { @@ -185,7 +184,7 @@ void sub_807F43C(Entity *target, Entity *attacker) var_54.x = pixelPosX; var_54.y = pixelPosY; attacker->unk1C.raw = 0; - sub_804535C(attacker, &var_54); + UpdateEntityPixelPos(attacker, &var_54); DungeonRunFrameActions(0x3B); GetEntInfo(attacker)->action.direction = attackerDirection & DIRECTION_MASK; @@ -241,7 +240,7 @@ void sub_807F9BC(Entity *entity) if (entInfo->isTeamLeader) { gDungeon->unk1 = 0; gDungeon->unk5C0 = -1; - sub_804AC20(&entity->pos); + DiscoverMinimap(&entity->pos); sub_807EC28(FALSE); } sub_806A5B8(entity); diff --git a/src/items.c b/src/items.c index 0fd1799b5..75b4b3541 100644 --- a/src/items.c +++ b/src/items.c @@ -149,7 +149,7 @@ s32 GetNumberOfFilledInventorySlots(void) } // arm9.bin::02060FB0 -bool8 IsThrowableItem(u8 id) +bool8 IsThrownItem(u8 id) { if ((GetItemCategory(id) != CATEGORY_THROWN_LINE) && (GetItemCategory(id) != CATEGORY_THROWN_ARC)) return FALSE; @@ -163,9 +163,9 @@ void ItemIdToItem(Item *item, u8 id, bool8 makeSticky) if (id != ITEM_NOTHING) { 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); + if (IsThrownItem(id)) { + s32 min = GetThrownItemQuantityLimit(id, MIN_SPAWN_AMOUNT); + s32 max = GetThrownItemQuantityLimit(id, MAX_SPAWN_AMOUNT); item->quantity = RandRange(min, max); } else if (GetItemCategory(id) == CATEGORY_POKE) { @@ -187,13 +187,13 @@ void ItemIdToItem(Item *item, u8 id, bool8 makeSticky) } // arm9.bin::02060E80 -void ItemIdToBulkItem(BulkItem *dst, u8 id) +void InitBulkItem(BulkItem *dst, u8 id) { if (id != ITEM_NOTHING) { dst->id = id; - if (IsThrowableItem(id)) { - s32 min = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT); - s32 max = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT); + if (IsThrownItem(id)) { + s32 min = GetThrownItemQuantityLimit(id, MIN_SPAWN_AMOUNT); + s32 max = GetThrownItemQuantityLimit(id, MAX_SPAWN_AMOUNT); dst->quantity = RandRange(min, max); } else if (GetItemCategory(id) == CATEGORY_POKE) @@ -215,7 +215,7 @@ void BulkItemToItem(Item *dst, BulkItem *src) if (src->id != ITEM_NOTHING) { dst->flags = ITEM_FLAG_EXISTS; dst->id = src->id; - is_throwable = IsThrowableItem(dst->id); + is_throwable = IsThrownItem(dst->id); if (is_throwable != 0 || GetItemCategory(dst->id) == CATEGORY_POKE) dst->quantity = src->quantity; else if (dst->id == ITEM_TM_USED_TM) @@ -251,7 +251,7 @@ s32 GetStackBuyValue(Item *param_1) { if (param_1->id == ITEM_POKE) return GetMoneyValue(param_1); - else if (IsThrowableItem(param_1->id)) + else if (IsThrownItem(param_1->id)) return gItemParametersData[param_1->id].buyPrice * param_1->quantity; else return gItemParametersData[param_1->id].buyPrice; @@ -262,29 +262,29 @@ s32 GetStackSellValue(Item *param_1) { if (param_1->id == ITEM_POKE) return GetMoneyValue(param_1); - else if (IsThrowableItem(param_1->id)) + else if (IsThrownItem(param_1->id)) return gItemParametersData[param_1->id].sellPrice * param_1->quantity; else return gItemParametersData[param_1->id].sellPrice; } // arm9.bin::02060C7C -s32 GetStackBuyPrice(Item *param_1) +s32 GetActualBuyPrice(Item *param_1) { - if (!CanSellItem(param_1->id)) + if (!IsShoppableItem(param_1->id)) return 0; - else if (IsThrowableItem(param_1->id)) + else if (IsThrownItem(param_1->id)) return gItemParametersData[param_1->id].buyPrice * param_1->quantity; else return gItemParametersData[param_1->id].buyPrice; } // arm9.bin::02060C18 -s32 GetStackSellPrice(Item *param_1) +s32 GetActualSellPrice(Item *param_1) { - if (!CanSellItem(param_1->id)) + if (!IsShoppableItem(param_1->id)) return 0; - else if (IsThrowableItem(param_1->id)) + else if (IsThrownItem(param_1->id)) return gItemParametersData[param_1->id].sellPrice * param_1->quantity; else return gItemParametersData[param_1->id].sellPrice; @@ -321,7 +321,7 @@ u32 GetItemActionType(u8 id) } // arm9.bin::02060B84 -u32 GetSpawnAmountRange(u8 id, u32 rangeIndex) +u32 GetThrownItemQuantityLimit(u8 id, u32 rangeIndex) { return gItemParametersData[id].spawnAmountRange[rangeIndex]; } @@ -757,7 +757,7 @@ u32 sub_80913E0(Item* slot, u32 windowId, STATUSTEXTS(statuses)) } // arm9.bin::0205FF28 -bool8 CanSellItem(u32 id) +bool8 IsShoppableItem(u32 id) { u8 id_; id = (u8)id; @@ -975,7 +975,7 @@ bool8 HasGummiItem(void) // arm9.bin::0205FB18 void MoveToStorage(Item* slot) { - if (IsThrowableItem(slot->id)) + if (IsThrownItem(slot->id)) gTeamInventoryRef->teamStorage[slot->id] += slot->quantity; else gTeamInventoryRef->teamStorage[slot->id]++; @@ -1092,7 +1092,7 @@ bool8 AddKecleonShopItem(u8 itemIndex) BulkItem held; s32 i; - ItemIdToBulkItem(&held, itemIndex); // initialize + InitBulkItem(&held, itemIndex); // initialize for (i = 0; i < MAX_KECLEON_ITEM_SHOP_ITEMS; i++) { if (!gTeamInventoryRef->kecleonShopItems[i].id) { @@ -1208,7 +1208,7 @@ static bool8 AddKecleonWareItem(u8 itemIndex) BulkItem held; s32 i; - ItemIdToBulkItem(&held, itemIndex); // initialize + InitBulkItem(&held, itemIndex); // initialize for (i = 0; i < MAX_KECLEON_WARE_SHOP_ITEMS; i++) { if (!gTeamInventoryRef->kecleonWareItems[i].id) { diff --git a/src/kangaskhan_storage1.c b/src/kangaskhan_storage1.c index 6eeb9a2f2..a01440601 100644 --- a/src/kangaskhan_storage1.c +++ b/src/kangaskhan_storage1.c @@ -611,7 +611,7 @@ static void sub_8017A1C(void) for (itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++) { if (sub_801CFE0(itemID)) { item.id = itemID; - if (IsThrowableItem(item.id)) { + if (IsThrownItem(item.id)) { if (gTeamInventoryRef->teamStorage[item.id] > 99) item.quantity = 99; else @@ -762,7 +762,7 @@ static void sub_8017D24(void) sub_801CBB8(); UpdateKangaskhanStorageState(KANGASKHAN_STORAGE_TOO_MANY_ITEMS); } - else if (IsThrowableItem(gKangaskhanStorageWork->storedItem.id)) + else if (IsThrownItem(gKangaskhanStorageWork->storedItem.id)) UpdateKangaskhanStorageState(24); else UpdateKangaskhanStorageState(27); diff --git a/src/kangaskhan_storage2.c b/src/kangaskhan_storage2.c index 9c7053194..361c63581 100644 --- a/src/kangaskhan_storage2.c +++ b/src/kangaskhan_storage2.c @@ -422,7 +422,7 @@ static void sub_80186F8(void) if (sub_801CFE0(itemID) != 0) { item.id = itemID; - if (IsThrowableItem(item.id)) { + if (IsThrownItem(item.id)) { if (gTeamInventoryRef->teamStorage[item.id] > 99) item.quantity = 99; else @@ -571,7 +571,7 @@ static void HandleKangaskhanStorage2TakeMenu(void) case TAKE_ACTION: if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) sub_8012EA4(&sUnknown_203B20C->unk70, 1); - else if (IsThrowableItem(sUnknown_203B20C->item.id)) + else if (IsThrownItem(sUnknown_203B20C->item.id)) UpdateKangaskhanStorage2State(12); else { gTeamInventoryRef->teamStorage[sUnknown_203B20C->item.id] -= sUnknown_203B20C->item.quantity; diff --git a/src/kecleon_bros1.c b/src/kecleon_bros1.c index e0a85eeec..577c8d758 100644 --- a/src/kecleon_bros1.c +++ b/src/kecleon_bros1.c @@ -740,7 +740,7 @@ static void HandleKecleonBrosSellAllItemsMenu(void) for (slotIndex = 0; slotIndex < INVENTORY_SIZE; slotIndex++) { item = &gTeamInventoryRef->teamItems[slotIndex]; - if ((item->flags & ITEM_FLAG_EXISTS) && CanSellItem(item->id)) + if ((item->flags & ITEM_FLAG_EXISTS) && IsShoppableItem(item->id)) ClearItemSlotAt(slotIndex); } @@ -781,7 +781,7 @@ static void sub_80199CC(void) ItemIdToItem(&sKecleonBrosWork1->soldItem, item->id, 0); sKecleonBrosWork1->soldItem.quantity = item->quantity; - sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem); + sKecleonBrosWork1->itemSellPrice = GetActualBuyPrice(&sKecleonBrosWork1->soldItem); SetKecleonBrosState(20); break; case 4: @@ -796,7 +796,7 @@ static void sub_80199CC(void) ItemIdToItem(&sKecleonBrosWork1->soldItem, item->id, 0); sKecleonBrosWork1->soldItem.quantity = item->quantity; - sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem); + sKecleonBrosWork1->itemSellPrice = GetActualBuyPrice(&sKecleonBrosWork1->soldItem); SetKecleonBrosState(KECLEON_STORE_BUY_ITEM_INFO); break; case 2: @@ -823,13 +823,13 @@ static void sub_8019B08(void) case 3: sKecleonBrosWork1->soldItemInventoryIndex = sub_801A8AC(); sKecleonBrosWork1->soldItem = gTeamInventoryRef->teamItems[sKecleonBrosWork1->soldItemInventoryIndex]; - sKecleonBrosWork1->itemSellPrice = GetStackSellPrice(&sKecleonBrosWork1->soldItem); + sKecleonBrosWork1->itemSellPrice = GetActualSellPrice(&sKecleonBrosWork1->soldItem); SetKecleonBrosState(28); break; case 4: sKecleonBrosWork1->soldItemInventoryIndex = sub_801A8AC(); sKecleonBrosWork1->soldItem = gTeamInventoryRef->teamItems[sKecleonBrosWork1->soldItemInventoryIndex]; - sKecleonBrosWork1->itemSellPrice = GetStackSellPrice(&sKecleonBrosWork1->soldItem); + sKecleonBrosWork1->itemSellPrice = GetActualSellPrice(&sKecleonBrosWork1->soldItem); sub_8099690(0); SetKecleonBrosState(KECLEON_STORE_SELL_ITEM_INFO); break; @@ -892,7 +892,7 @@ static void HandleKecleonBrosSellItemMenu(void) case SELL_ACTION: sub_8099690(0); - if (!CanSellItem(sKecleonBrosWork1->soldItem.id)) + if (!IsShoppableItem(sKecleonBrosWork1->soldItem.id)) SetKecleonBrosState(KECLEON_STORE_CANT_SELL_ITEM); else if (sKecleonBrosWork1->itemSellPrice + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) SetKecleonBrosState(KECLEON_STORE_SELL_ITEM_TOO_MUCH_MONEY); @@ -969,8 +969,8 @@ static void KecleonCalcSellPriceForAllItems(void) for (index = 0; index < INVENTORY_SIZE; index++) { item = &gTeamInventoryRef->teamItems[index]; - if ((item->flags & ITEM_FLAG_EXISTS) != 0 && CanSellItem(item->id)) { - sellPrice = GetStackSellPrice(item); + if ((item->flags & ITEM_FLAG_EXISTS) != 0 && IsShoppableItem(item->id)) { + sellPrice = GetActualSellPrice(item); sKecleonBrosWork1->inventoryItemSellPrice += sellPrice; sKecleonBrosWork1->numInventoryItemToSell++; } diff --git a/src/kecleon_bros2.c b/src/kecleon_bros2.c index 089cb7a05..ed1851b19 100644 --- a/src/kecleon_bros2.c +++ b/src/kecleon_bros2.c @@ -61,7 +61,7 @@ u32 sub_8019EDC(bool8 r0) slot.id = item->id; slot.quantity = item->quantity; - if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) + if (GetActualBuyPrice(&slot) > gTeamInventoryRef->teamMoney) PlayMenuSoundEffect(2); else PlayMenuSoundEffect(0); @@ -149,7 +149,7 @@ void sub_801A0D8(void) local_7c.unk6 = 88; local_7c.unk8 = 1; sub_8090E14(auStack204, &item, &local_7c); - buyPrice = GetStackBuyPrice(&item); + buyPrice = GetActualBuyPrice(&item); if (buyPrice <= gTeamInventoryRef->teamMoney) { y = GetMenuEntryYCoord(&gUnknown_203B214->m.input, index); diff --git a/src/kecleon_bros3.c b/src/kecleon_bros3.c index 31306fe36..5f2831b81 100644 --- a/src/kecleon_bros3.c +++ b/src/kecleon_bros3.c @@ -61,7 +61,7 @@ u32 sub_801A2A8(bool8 r0) slot.id = item->id; slot.quantity = item->quantity; - if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) + if (GetActualBuyPrice(&slot) > gTeamInventoryRef->teamMoney) PlayMenuSoundEffect(2); else PlayMenuSoundEffect(0); @@ -149,7 +149,7 @@ void sub_801A4A4(void) local_7c.unk6 = 88; local_7c.unk8 = 1; sub_8090E14(buffer1, &item, &local_7c); - buyPrice = GetStackBuyPrice(&item); + buyPrice = GetActualBuyPrice(&item); if (buyPrice <= gTeamInventoryRef->teamMoney) { y = GetMenuEntryYCoord(&gUnknown_203B21C->m.input, index); diff --git a/src/kecleon_bros4.c b/src/kecleon_bros4.c index 6596b7870..8331354f5 100644 --- a/src/kecleon_bros4.c +++ b/src/kecleon_bros4.c @@ -103,7 +103,7 @@ u32 sub_801A6E8(bool8 param_1) case 4: item = gTeamInventoryRef->teamItems[sub_801A8AC()]; - if (CanSellItem(item.id) && GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney <= MAX_TEAM_MONEY) + if (IsShoppableItem(item.id) && GetActualSellPrice(&item) + gTeamInventoryRef->teamMoney <= MAX_TEAM_MONEY) PlayMenuSoundEffect(0); else PlayMenuSoundEffect(2); @@ -260,7 +260,7 @@ void sub_801A9E0(void) struct unkStruct_8090F58 thing; // sp6C u8 buf2[80]; // sp78 - if (CanSellItem(item.id)) { + if (IsShoppableItem(item.id)) { thing.unk0 = 3; thing.unk4 = 0; thing.unk6 = 88; @@ -268,7 +268,7 @@ void sub_801A9E0(void) item.flags = 3; sub_8090E14(buf1, &item, &thing); - if (GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) { + if (GetActualSellPrice(&item) + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) { sprintfStatic(buf2, sFmtRed, buf1); PrintStringOnWindow(8, GetMenuEntryYCoord(&gUnknown_203B224->unk54.m.input, r7), buf2, gUnknown_203B224->unk54.m.menuWinId, 0); } @@ -336,7 +336,7 @@ bool8 sub_801ADA0(s32 param_1) if (!IsNotMoneyOrUsedTMItem(item.id)) return FALSE; - if (IsThrowableItem(item.id)) { + if (IsThrownItem(item.id)) { uVar3_32 = sub_801AE24(item.id); sum1 = gTeamInventoryRef->teamStorage[item.id]; uVar3 = uVar3_32; @@ -368,7 +368,7 @@ static s32 sub_801AE24(u32 itemID) item = gTeamInventoryRef->teamItems[invIndex]; if (item.id == itemID) { - if (IsThrowableItem(item.id)) + if (IsThrownItem(item.id)) count += item.quantity; else count++; diff --git a/src/mission_reward.c b/src/mission_reward.c index 93b8c07b4..254e268f9 100644 --- a/src/mission_reward.c +++ b/src/mission_reward.c @@ -269,7 +269,7 @@ void HandleMissionReward(void) { if (gUnknown_203B310->unk10->moneyReward == 0) { item.id = itemID; - if (IsThrowableItem(item.id)) { + if (IsThrownItem(item.id)) { item.quantity = gUnknown_203B310->unk10->quantity; } else { diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index 225197dfe..3427746de 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -35,7 +35,6 @@ extern void sub_806A5B8(Entity *entity); void sub_8075900(Entity *pokemon, u8 r1); -extern u8 sub_8044B28(void); extern void sub_807EC28(bool8); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index a9494a6e0..e531d30fa 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -34,7 +34,6 @@ #include "dungeon_misc.h" #include "dungeon_strings.h" -extern u8 sub_8044B28(void); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 76de35c98..b950a179c 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -40,8 +40,8 @@ #include "trap.h" #include "weather.h" #include "dungeon_pos_data.h" +#include "dungeon_engine.h" -extern u8 sub_8044B28(void); extern void sub_807EC28(bool8); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); @@ -622,9 +622,9 @@ _0805A8C2: if (sub_80571F0(entity,&stackMove) == 0) { sub_806F370(pokemon,entity,gSplashDmgValue,0,0,TYPE_NONE,sub_8057600(move, param_4),0,1,0); } - if ((sub_8044B28() == 0) && (EntityIsValid(pokemon))) { + if ((IsFloorOver() == 0) && (EntityIsValid(pokemon))) { sub_806F370(pokemon,pokemon,gSplashDmgValue,0,0,0,0x1fe,0,0,0); - if ((sub_8044B28() == 0) && (EntityIsValid(pokemon))) goto _0805A9FE; + if ((IsFloorOver() == 0) && (EntityIsValid(pokemon))) goto _0805A9FE; } } else { @@ -651,13 +651,13 @@ _0805AA5E: #else DungeonPos *pos; #endif - sub_804535C(target, NULL); + UpdateEntityPixelPos(target, NULL); pos = r9; if (sub_80706A4(target, pos)) { WarpTarget(pokemon,target,0,0); } if (GetEntInfo(target)->isTeamLeader) { - sub_804AC20(r9); + DiscoverMinimap(r9); sub_807EC28(FALSE); } sub_806A5B8(target); @@ -1031,7 +1031,7 @@ bool8 SpikesMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_ { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC5A8); // A trap can't be laid here! } - sub_8049ED4(); + UpdateTrapsVisibility(); return trapLaid; } diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index 160a92cc3..fe5792c9c 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -39,7 +39,7 @@ extern void sub_807F43C(Entity *, Entity *); extern void HandleOneRoomOrb(Entity *, Entity *); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void HandleDroughtOrbAction(Entity *); extern void HandleLuminousOrbAction(Entity *pokemon); extern void HandleTrawlOrbAction(Entity *, Entity *); @@ -690,7 +690,7 @@ bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_ for (yCoord = bottomRightCornerY; yCoord <= topLeftCornerY; yCoord++) { object = GetTileMut(xCoord, yCoord)->object; if (((object != 0) && (GetEntityType(object) == ENTITY_TRAP)) && - (trapData = GetTrapData(object), trapData->id != TRAP_WONDER_TILE)) { + (trapData = GetTrapInfo(object), trapData->id != TRAP_WONDER_TILE)) { pos.y = yCoord; pos.x = xCoord; sub_807FE04(&pos, 0); @@ -700,8 +700,8 @@ bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_ } if (foundTrap) { TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FD1B0); - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + UpdateMinimap(); + UpdateTrapsVisibility(); } else { TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FD1CC); diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index 028c5d7b8..80b6682ae 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -51,7 +51,7 @@ bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4) for(x = -1; x < 2; x++) sub_80498A8(tileCoords.x + x, tileCoords.y + y); filledInTile = TRUE; - sub_806CF60(); + DetermineAllMonsterShadow(); } for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++) @@ -65,8 +65,8 @@ bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4) else { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD0B8); } - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + UpdateMinimap(); + UpdateTrapsVisibility(); return filledInTile; } } @@ -93,8 +93,8 @@ bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { target->isVisible = FALSE; CreateItemWithStickyChance(&stack, GetRandomFloorItem(0), 0); - sub_80464C8(pokemon, &posStruct, &stack); - sub_8068FE0(target, 0x218, pokemon); + SpawnDroppedItemWrapper(pokemon, &posStruct, &stack); + HandleFaint(target, 0x218, pokemon); return TRUE; } } diff --git a/src/move_orb_effects_2.c b/src/move_orb_effects_2.c index a54dd8aa8..cbceea9bf 100644 --- a/src/move_orb_effects_2.c +++ b/src/move_orb_effects_2.c @@ -50,7 +50,7 @@ extern void nullsub_82(Entity *); extern void nullsub_83(Entity *); extern void nullsub_84(Entity *); extern void nullsub_85(Entity *); -extern void ShowWholeRevealedDungeonMap(); +extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); extern void sub_807EC28(bool8); @@ -79,7 +79,7 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void sub_803F580(u32); +extern void UpdateCamera(u32); extern void sub_8041E1C(Entity *); extern void nullsub_89(Entity *); extern void nullsub_88(Entity *); @@ -88,13 +88,12 @@ extern void nullsub_86(Entity *); extern void sub_8041E0C(Entity *); extern void sub_8041DD8(Entity *r0, s32 r1); // NOTE: is s16 in another file extern bool8 sub_806AA0C(s32, u32); -extern void sub_803F580(u32); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateCamera(u32); +extern void UpdateMinimap(void); extern void sub_8041D9C(Entity *); extern void sub_8041DB0(Entity *pokemon); extern void sub_8041CA8(Entity *); extern void sub_8041C94(Entity *); -extern bool8 sub_8045888(Entity *r0); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_8041BF8(Entity *); extern void sub_8041BE8(Entity *); @@ -217,13 +216,13 @@ void HealTargetHP(Entity *pokemon, Entity *target, s32 param_3, s32 param_4, boo { r8 = 0; if (maxHPStat != 0) { - if (sub_8045888(target)) { + if (ShouldDisplayEntity(target)) { r8 = maxHPStat; } TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB240); // m0$'s max HP rose by {VALUE_1} } if (HP != 0) { - if (sub_8045888(target)) { + if (ShouldDisplayEntity(target)) { r8 = HP; } if (param_3 != 0) { @@ -252,8 +251,8 @@ void HandleScannerOrb(Entity* pokemon, Entity* target) nullsub_75(target); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FAEA0); // Item locations became evident - sub_803F580(0); - ShowWholeRevealedDungeonMap(); + UpdateCamera(0); + UpdateMinimap(); EntityUpdateStatusSprites(target); } } @@ -277,8 +276,8 @@ void HandleStairsOrb(Entity* pokemon, Entity* target) nullsub_76(target); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FAEC8); - sub_803F580(0); - ShowWholeRevealedDungeonMap(); + UpdateCamera(0); + UpdateMinimap(); EntityUpdateStatusSprites(target); } } @@ -297,8 +296,8 @@ void HandleRadarOrb(Entity* pokemon, Entity* target) nullsub_77(target); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FAFAC); - sub_803F580(0); - ShowWholeRevealedDungeonMap(); + UpdateCamera(0); + UpdateMinimap(); EntityUpdateStatusSprites(target); } } @@ -947,7 +946,7 @@ void TransformStatusTarget(Entity * pokemon, Entity * target) target->axObj.spriteFile = sprite; entityInfo->invisibleClassStatus.status = STATUS_TRANSFORMED; entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target, gTransformedTurnRange, TRUE) + 1; - sub_806CF98(target); + DetermineMonsterShadow(target); nullsub_87(target); sub_806CCB4(target, sub_806CEBC(target)); CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1], entityInfo->apparentID); @@ -1059,8 +1058,8 @@ void BlindTarget(Entity *pokemon, Entity *target) sub_8041E0C(target); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB7F4); DungeonRunFrameActions(0x31); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } else { @@ -1085,9 +1084,9 @@ void CrossEyeVisionTarget(Entity *pokemon, Entity *target) TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB834); entityInfo->blinkerClassStatus.status = STATUS_CROSS_EYED; entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gCrossEyedTurnRange, TRUE) + 1; - sub_803F580(0x1); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateCamera(0x1); + UpdateTrapsVisibility(); + UpdateMinimap(); } else { @@ -1112,8 +1111,8 @@ void RestoreVisionTarget(Entity *pokemon, Entity *target) sub_8041E3C(target); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB880); DungeonRunFrameActions(0x31); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } else { diff --git a/src/move_orb_effects_4.c b/src/move_orb_effects_4.c index dc1edee1c..b2e254902 100644 --- a/src/move_orb_effects_4.c +++ b/src/move_orb_effects_4.c @@ -27,7 +27,7 @@ #include "dungeon_config.h" #include "dungeon_strings.h" -extern void ShowWholeRevealedDungeonMap(); +extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); extern void sub_807EC28(bool8); @@ -59,7 +59,7 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void sub_803F580(u32); +extern void UpdateCamera(u32); extern void sub_8041E1C(Entity *); extern void nullsub_89(Entity *); extern void nullsub_88(Entity *); diff --git a/src/move_orb_effects_5.c b/src/move_orb_effects_5.c index b8e485412..1664a2b19 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -28,7 +28,7 @@ #include "dungeon_strings.h" #include "dungeon_pos_data.h" -extern void ShowWholeRevealedDungeonMap(); +extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); extern void sub_807EC28(bool8); @@ -60,7 +60,7 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void sub_803F580(u32); +extern void UpdateCamera(u32); extern void sub_8041E1C(Entity *); extern void nullsub_89(Entity *); extern void nullsub_88(Entity *); @@ -545,8 +545,8 @@ void SendEyesightEndMessage(Entity * pokemon,Entity * target) EntityUpdateStatusSprites(target); if (entityInfo->isTeamLeader) { DungeonRunFrameActions(0x31); - sub_8049ED4(); - ShowWholeRevealedDungeonMap(); + UpdateTrapsVisibility(); + UpdateMinimap(); } } diff --git a/src/one_room_orb.c b/src/one_room_orb.c index d46e8bd15..fbee76dd9 100644 --- a/src/one_room_orb.c +++ b/src/one_room_orb.c @@ -127,9 +127,9 @@ void HandleOneRoomOrb(Entity *pokemon, Entity *target) sub_804EB30(); sub_804AAD4(); sub_8049884(); - sub_806CF60(); - ShowWholeRevealedDungeonMap(); - sub_8049ED4(); + DetermineAllMonsterShadow(); + UpdateMinimap(); + UpdateTrapsVisibility(); LogMessageByIdWithPopupCheckUser(pokemon,gUnknown_80FD3A0); sub_803E708(0x28,0x2b); sub_8075900(pokemon,1); diff --git a/src/party_list_menu.c b/src/party_list_menu.c index e8688a609..3992382ad 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -839,7 +839,7 @@ bool8 CanTakePokemonHeldItem(Pokemon *r0) { if(IsNotMoneyOrUsedTMItem(r0->heldItem.id)) { - if(IsThrowableItem(r0->heldItem.id)) + if(IsThrownItem(r0->heldItem.id)) { if((gTeamInventoryRef->teamStorage[r0->heldItem.id] + r0->heldItem.quantity) > 999) return FALSE; @@ -870,7 +870,7 @@ void sub_8026FA4(void) break; case 2: PlaySound(0x14d); - if(IsThrowableItem(sUnknown_203B2B8->item2.id)) + if(IsThrownItem(sUnknown_203B2B8->item2.id)) { gTeamInventoryRef->teamStorage[sUnknown_203B2B8->item2.id] += sUnknown_203B2B8->item2.quantity; } diff --git a/src/pokemon.c b/src/pokemon.c index 45899acfd..0a0964af6 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -151,7 +151,7 @@ void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, pokemon->offense.def[0] = GetBaseDefensiveStat(species, 0); pokemon->offense.def[1] = GetBaseDefensiveStat(species, 1); pokemon->speciesNum = species; - ItemIdToBulkItem(&pokemon->heldItem, itemID); + InitBulkItem(&pokemon->heldItem, itemID); pokemon->currExp = 0; pokemon->tacticIndex = TACTIC_LETS_GO_TOGETHER; pokemon->IQ = 1; @@ -214,7 +214,7 @@ void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src) dst->offense.def[0] = src->offenseDef[0]; dst->offense.def[1] = src->offenseDef[1]; dst->speciesNum = src->speciesNum; - ItemIdToBulkItem(&dst->heldItem, src->itemID); + InitBulkItem(&dst->heldItem, src->itemID); dst->currExp = src->currExp; dst->tacticIndex = TACTIC_LETS_GO_TOGETHER; dst->IQ = src->IQ; @@ -1007,7 +1007,7 @@ void sub_808DFDC(s32 a1, DungeonMon* a2) } } -void GetPokemonLevelData(LevelData* a1, s32 _id, s32 level) +void GetLvlUpEntry(LevelData* a1, s32 _id, s32 level) { u8 buffer[12]; s32 id = SpeciesId(_id); diff --git a/src/pokemon_3.c b/src/pokemon_3.c index b433f5d27..360a68bd9 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -357,7 +357,7 @@ void GetAvailTacticsforLvl(u8 *tacticsBuffer, s32 pokeLevel) } // Instead of assigning the Tactic, a bool is assigned showing it is available -void GetAvailTacticsforLvl_Bool(u8 *tacticsBuffer, s32 pokeLevel) +void GetUnlockedTacticFlags(u8 *tacticsBuffer, s32 pokeLevel) { s32 tactic; diff --git a/src/pokemon_evolution.c b/src/pokemon_evolution.c index b282bcf5a..d86187e32 100644 --- a/src/pokemon_evolution.c +++ b/src/pokemon_evolution.c @@ -220,7 +220,7 @@ Pokemon *sub_808F798(Pokemon *pokemon, s16 _species) pokeStruct = *pokemon; r6 = pokeStruct.speciesNum; - GetPokemonLevelData(&levelData,species,pokeStruct.level); + GetLvlUpEntry(&levelData,species,pokeStruct.level); pokeStruct.currExp = levelData.expRequired; pokemon->flags = 0; pokeStruct.speciesNum = species; diff --git a/src/pokemon_summary_window.c b/src/pokemon_summary_window.c index e9a4ad444..cda249aad 100644 --- a/src/pokemon_summary_window.c +++ b/src/pokemon_summary_window.c @@ -40,7 +40,7 @@ void ShowPokemonSummaryWindow(s32 which, s32 currSubWindowId, struct MonSummaryI PrintFormattedStringOnWindow(4,y,gText_ExpPtsUnkMacro,windowId,'\0'); y += 0xA; if (monInfo->level < 100) { - GetPokemonLevelData(&levelData,monInfo->species,monInfo->level + 1); + GetLvlUpEntry(&levelData,monInfo->species,monInfo->level + 1); gFormatArgs[0] = levelData.expRequired - monInfo->exp; PrintFormattedStringOnWindow(4,y,gText_ToNextLevel,windowId,'\0'); } diff --git a/src/pounce_orb.c b/src/pounce_orb.c index 466bc813a..5bcc1749c 100644 --- a/src/pounce_orb.c +++ b/src/pounce_orb.c @@ -27,7 +27,6 @@ #include "dungeon_strings.h" #include "dungeon_pos_data.h" -extern u8 sub_8045888(Entity *); extern void sub_807EC28(u32); void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) @@ -67,8 +66,8 @@ void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) sub_80694C0(target, pos.x, pos.y, 0); - sub_804535C(target, 0); - if(!sub_8045888(target)) continue; + UpdateEntityPixelPos(target, 0); + if(!ShouldDisplayEntity(target)) continue; DungeonRunFrameActions(0x3A); } @@ -80,7 +79,7 @@ void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) sub_806CE68(target, 8); if(info->isTeamLeader) { - sub_804AC20(&target->pos); + DiscoverMinimap(&target->pos); sub_807EC28(0); } sub_806A5B8(target); diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 71f50311b..d7348549f 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -76,19 +76,18 @@ extern void sub_80848F0(void); extern void IncrementAdventureFloorsExplored(void); extern void sub_806AB2C(void); extern void DisplayPreFightDialogue(void); -extern void sub_8071DA4(Entity *); +extern void EnemyEvolution(Entity *); extern void sub_803E748(void); extern void sub_8083D68(void); extern void sub_803E7C8(void); -extern void ShowWholeRevealedDungeonMap(void); +extern void UpdateMinimap(void); extern void sub_807E5AC(void); -extern void TriggerWeatherAbilities(void); +extern void TryActivateArtificialWeatherAbilities(void); extern void sub_807E88C(void); extern void nullsub_16(void); extern void sub_80521D0(void); extern void sub_803F27C(u8); extern void sub_807E7FC(u8); -extern bool8 IsLevelResetTo1(u8 dungeon); extern void sub_8068A84(Pokemon *pokemon); extern void sub_807EAA0(u32, u32); extern void SetFloorItemMonsterSpawns(void); @@ -101,20 +100,18 @@ extern void sub_806B678(void); extern void sub_806C3C0(void); extern void sub_806B168(void); extern void sub_806B6C4(void); -extern void sub_806A338(void); +extern void ReevaluateSnatchMonster(void); extern void sub_8051E3C(void); extern void sub_807FA18(void); extern void sub_806A974(void); -extern void sub_806CF60(void); +extern void DetermineAllMonsterShadow(void); extern void sub_8068F80(void); extern void sub_8042E98(void); -extern bool8 sub_8044B28(void); -extern bool8 sub_8043ED0(bool8); +extern bool8 TryForcedLoss(bool8); extern void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); extern void sub_803F4A0(Entity *a0); extern void ResetMonEntityData(EntityInfo *, u32); extern s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints); -extern bool8 IsKeepMoney(u8 dungeon); extern void sub_8042B0C(Entity *); extern u8 gUnknown_202F32C; @@ -134,6 +131,9 @@ static const s16 sDeoxysForms[4] = {MONSTER_DEOXYS_NORMAL, MONSTER_DEOXYS_ATTACK static void sub_8043CD8(void); +// Actual function in Sky. Macro instead of static inline for matching +#define GetForcedLossReason()(gDungeon->unk10) + // This functions is the main 'loop' when the player is in a Dungeon. It runs from the moment the player enters a dungeon, until they leave(by completing or by fainting). // arm9.bin::0206A848 void RunDungeon_Async(DungeonSetupStruct *setupPtr) @@ -249,7 +249,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) if (r10) { setupPtr->info.mon.heldItem.id = 0; - if (IsLevelResetTo1(gDungeon->unk644.dungeonLocation.id)) { + if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id)) { sub_808D0D8(&setupPtr->info.mon); } sub_8068A84(&setupPtr->info.mon); @@ -400,17 +400,17 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) sub_804AAAC(); } else { - sub_806A338(); + ReevaluateSnatchMonster(); } sub_8068F80(); sub_8049884(); - sub_8049ED4(); + UpdateTrapsVisibility(); if (!r6) { sub_806A914(TRUE, FALSE, FALSE); } else { - sub_806CF60(); + DetermineAllMonsterShadow(); sub_806A974(); } sub_8041888(1); @@ -435,7 +435,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) sub_8040094(0); sub_803EAF0(0, NULL); InitDungeonMap(r6); - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); gDungeon->unkB8 = NULL; gDungeon->unk644.unk28 = 0; gDungeon->unk644.unk29 = 0; @@ -459,7 +459,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) } else { sub_803F4A0(GetLeader()); - ShowWholeRevealedDungeonMap(); + UpdateMinimap(); } } @@ -472,7 +472,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) } } else { - TriggerWeatherAbilities(); + TryActivateArtificialWeatherAbilities(); } if (r6) { @@ -494,16 +494,16 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) do { RunFractionalTurn(param); param = FALSE; - } while (!sub_8044B28()); + } while (!IsFloorOver()); } leader = GetLeader(); if (EntityIsValid(leader)) { - sub_8071DA4(leader); + EnemyEvolution(leader); } if (gDungeon->unk644.unk10 != 1) { - if (sub_8043ED0(TRUE)) { + if (TryForcedLoss(TRUE)) { gDungeon->unk644.unk10 = 1; } } @@ -542,7 +542,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) SetBGPaletteBufferColorRGB(253, &color, gDungeonBrightness, NULL); sub_8040094(1); gDungeon->unk181e8.unk18218 = 1; - if ((gDungeon->unk10 == 2 || gDungeon->unk10 == 3) && gDungeon->unk6 != 0) { + if ((GetForcedLossReason() == 2 || GetForcedLossReason() == 3) && gDungeon->unk6 != 0) { leader = GetLeader(); DisplayDungeonMessage(0, gPtrClientFaintedMessage, 1); gDungeon->unk6 = 0; @@ -757,7 +757,7 @@ void sub_8043D60(void) unk = FALSE; if (unk) { - sub_8068FE0(mon, 0x207, mon); + HandleFaint(mon, 0x207, mon); } } } @@ -790,7 +790,7 @@ void sub_8043D60(void) for (x = 0; x < 56; x++) { Entity *object = GetTileMut(x, y)->object; if (EntityIsValid(object) && GetEntityType(object) == ENTITY_TRAP) { - Trap *trapData = GetTrapData(object); + Trap *trapData = GetTrapInfo(object); if (trapData->id == 27) { trapData->id = TRAP_PITFALL_TRAP; } @@ -801,14 +801,14 @@ void sub_8043D60(void) ClearAllItemsWithFlag(ITEM_FLAG_IN_SHOP); } -bool8 sub_8043ED0(bool8 a0) +bool8 TryForcedLoss(bool8 a0) { bool8 ret = FALSE; - if (!a0 && sub_8044B28()) + if (!a0 && IsFloorOver()) return FALSE; - if (gDungeon->unk10 == 1) { + if (GetForcedLossReason() == 1) { Entity *leader = GetLeader(); if (EntityIsValid(leader)) { if (!a0) { @@ -816,11 +816,11 @@ bool8 sub_8043ED0(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89B4, 1); } sub_8042B0C(leader); - sub_8068FE0(leader, 0x21F, leader); + HandleFaint(leader, 0x21F, leader); ret = TRUE; } } - else if (gDungeon->unk10 == 2) { + else if (GetForcedLossReason() == 2) { Entity *leader = GetLeader(); if (EntityIsValid(leader)) { if (!a0) { @@ -828,11 +828,11 @@ bool8 sub_8043ED0(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89D4, 1); } sub_8042B0C(leader); - sub_8068FE0(leader, 0x222, leader); + HandleFaint(leader, 0x222, leader); ret = TRUE; } } - else if (gDungeon->unk10 == 3) { + else if (GetForcedLossReason() == 3) { Entity *leader = GetLeader(); if (EntityIsValid(leader)) { if (!a0) { @@ -840,7 +840,7 @@ bool8 sub_8043ED0(bool8 a0) DisplayDungeonMessage(0, gUnknown_80F89D8, 1); } sub_8042B0C(leader); - sub_8068FE0(leader, 0x222, leader); + HandleFaint(leader, 0x222, leader); ret = TRUE; } } @@ -865,7 +865,7 @@ static void sub_8043FD0(void) vs32 atk, spAtk, def, spDef; #endif // NONMATCHING - GetPokemonLevelData(&levelData, monStruct->speciesNum, level); + GetLvlUpEntry(&levelData, monStruct->speciesNum, level); monStruct->level = level; monStruct->currExp = levelData.expRequired; monStruct->pokeHP += levelData.gainHP; @@ -928,7 +928,7 @@ void EnforceMaxItemsAndMoney(void) } } - if (!IsKeepMoney(gDungeon->unk644.dungeonLocation.id)) { + if (!IsMoneyAllowed(gDungeon->unk644.dungeonLocation.id)) { gTeamInventoryRef->teamMoney = 0; } } diff --git a/src/switcher_orb.c b/src/switcher_orb.c index 060ba6333..02a650642 100644 --- a/src/switcher_orb.c +++ b/src/switcher_orb.c @@ -54,12 +54,12 @@ void HandleSwitcherOrb(Entity *pokemon,Entity *target) nullsub_93(&targetPos); sub_80694C0(pokemon,targetPos.x,targetPos.y,1); sub_80694C0(target,pokemonPos.x,pokemonPos.y,1); - sub_804535C(pokemon,NULL); - sub_804535C(target,NULL); + UpdateEntityPixelPos(pokemon,NULL); + UpdateEntityPixelPos(target,NULL); if (EntityIsValid(pokemon)) { if (GetEntInfo(pokemon)->isTeamLeader) { - sub_804AC20(&pokemon->pos); + DiscoverMinimap(&pokemon->pos); sub_807EC28(FALSE); } sub_806A5B8(pokemon); @@ -68,7 +68,7 @@ void HandleSwitcherOrb(Entity *pokemon,Entity *target) if (EntityIsValid(target)) { if (GetEntInfo(target)->isTeamLeader) { - sub_804AC20(&target->pos); + DiscoverMinimap(&target->pos); sub_807EC28(FALSE); } sub_806A5B8(target); diff --git a/src/trap.c b/src/trap.c index 07cdbdb20..8bd3b1459 100644 --- a/src/trap.c +++ b/src/trap.c @@ -38,13 +38,12 @@ extern SpriteOAM gUnknown_202EDC0; bool8 sub_806AA0C(s32, s32); void sub_80421EC(DungeonPos *, u32); -bool8 sub_8045888(Entity *); u8 GetFloorType(void); void sub_8045BF8(u8 *, Item *); void DealDamageToEntity(Entity *,s16,u32,u32); void sub_806F480(Entity *, u32); void sub_804225C(Entity *, DungeonPos *, u8); -void sub_8071DA4(Entity *); +void EnemyEvolution(Entity *); void sub_806A1E8(Entity *pokemon); Entity *sub_8045684(u8, DungeonPos *, u8); extern void HandleExplosion(Entity *pokemon, Entity *target, DungeonPos *pos, u32, u8 moveType, s16); @@ -177,8 +176,8 @@ bool8 LayTrap(DungeonPos *pos, u8 trapID, u8 param_3) if (((terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL)) goto _0807FD6E; if (tile->object != NULL) { if (GetEntityType(tile->object) != ENTITY_TRAP) goto _0807FD6E; - GetTrapData(tile->object)->id = trapID; - GetTrapData(tile->object)->unk1 = param_3; + GetTrapInfo(tile->object)->id = trapID; + GetTrapInfo(tile->object)->unk1 = param_3; tile->object->isVisible = TRUE; } else { @@ -207,12 +206,12 @@ bool8 sub_807FD84(Entity *entity) gDungeon->unk13570 = 0; flag = LayTrap(&gDungeon->trapPos,gDungeon->trapID,gDungeon->unk13579); if (flag) { - TryDisplayDungeonLoggableMessage5(entity,&gDungeon->trapPos,gUnknown_80FC5F8); // A trap was laid! + LogMessageByIdWithPopupCheckUserUnknown(entity,&gDungeon->trapPos,gUnknown_80FC5F8); // A trap was laid! } else { - TryDisplayDungeonLoggableMessage5(entity,&gDungeon->trapPos,gUnknown_80FC5FC); // A trap can't be laid here. + LogMessageByIdWithPopupCheckUserUnknown(entity,&gDungeon->trapPos,gUnknown_80FC5FC); // A trap can't be laid here. } - sub_8049ED4(); + UpdateTrapsVisibility(); } return flag; } @@ -226,7 +225,7 @@ bool8 sub_807FE04(DungeonPos *pos, char param_2) tile->object->type = 0; tile->object = NULL; if (param_2 != 0) { - sub_8049ED4(); + UpdateTrapsVisibility(); } return TRUE; } @@ -243,7 +242,7 @@ bool8 sub_807FE44(DungeonPos *pos, char param_2) if ((tile->object != NULL) && (GetEntityType(tile->object) == ENTITY_TRAP)) { tile->object->isVisible = TRUE; if (param_2 != 0) { - sub_8049ED4(); + UpdateTrapsVisibility(); } return TRUE; } @@ -257,7 +256,7 @@ void GetTrapName(u8 *buffer, u8 trapIndex) strcpy(buffer, gTrapNames[trapIndex]); } -void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) +void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) { Tile *tile; bool8 flag1; @@ -278,7 +277,7 @@ void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) if (GetEntityType(entity) != ENTITY_TRAP) { return; } - trapData = GetTrapData(entity); + trapData = GetTrapInfo(entity); GetTrapName(gFormatBuffer_Monsters[0],trapData->id); target = tile->monster; if ((target != NULL) && (GetEntityType(target) != ENTITY_MONSTER)) { @@ -300,7 +299,7 @@ void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) } if (text != NULL) { if (sub_803F428(pos)) { - sub_8049ED4(); + UpdateTrapsVisibility(); } TryDisplayDungeonLoggableMessage3(pokemon,target,text); if (param_3 == 0) { @@ -310,7 +309,7 @@ void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) } if (sub_803F428(pos)) { sub_80421C0(0,0x15c); - sub_8049ED4(); + UpdateTrapsVisibility(); sub_804225C(pokemon,pos,trapData->id); if (gDungeon->unk181e8.blinded) { LogMessageByIdWithPopupCheckUser(pokemon,gUnknown_80FD7F4); @@ -396,7 +395,7 @@ void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) } } if (EntityIsValid(target)) { - sub_8071DA4(target); + EnemyEvolution(target); } if (flag1) { sub_807FE04(pos,1); @@ -577,7 +576,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile) else { info = GetEntInfo(target); - if (sub_8045888(target)) { + if (ShouldDisplayEntity(target)) { SetTrap(tile, 0x1B); flag = TRUE; sub_80421C0(target,0x193); @@ -603,7 +602,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile) else { DisplayDungeonLoggableMessageTrue(pokemon,gUnknown_80F970C); // $m0 fell into the pitfall! } - sub_8068FE0(target,0x215,pokemon); + HandleFaint(target,0x215,pokemon); } if (flag) { SetTrap(tile, TRAP_PITFALL_TRAP); @@ -786,7 +785,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos) for (y = bottomY; y <= maxY; y++) { for (x = bottomX; x <= maxX; x++) { const Tile *tile = GetTile(x,y); - if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM && !(GetItemData(tile->object)->flags & ITEM_FLAG_IN_SHOP)) { + if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM && !(GetItemInfo(tile->object)->flags & ITEM_FLAG_IN_SHOP)) { s32 i, species; local_50.species = MONSTER_KECLEON; @@ -812,11 +811,11 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos) local_50.unk4 = 0; local_50.unk10 = 0; if (sub_806B7F8(&local_50, TRUE) != 0) { - RemoveItemFromDungeonAt(&local_50.pos,0); + RemoveGroundItem(&local_50.pos,0); counter++; } } - ShowDungeonMapAtPos(x,y); + DrawMinimapTile(x,y); } } } @@ -862,9 +861,9 @@ void SetTrap(Tile *tile, u8 id) entity = tile->object; if (EntityIsValid(entity)) { if (GetEntityType(entity) == ENTITY_TRAP) { - trapData = GetTrapData(entity); + trapData = GetTrapInfo(entity); trapData->id = id; } - sub_8049ED4(); + UpdateTrapsVisibility(); } } diff --git a/src/trawl_orb.c b/src/trawl_orb.c index f04e73f98..081253a89 100644 --- a/src/trawl_orb.c +++ b/src/trawl_orb.c @@ -118,8 +118,8 @@ void HandleTrawlOrbAction(Entity *user, Entity *target) for (i = 0; i < itemsCount; i++) { if (EntityIsValid(&itemEntities[i])) { - RemoveItemFromDungeonAt(&itemEntities[i].pos, 1); - ShowDungeonMapAtPos(itemEntities[i].pos.x, itemEntities[i].pos.y); + RemoveGroundItem(&itemEntities[i].pos, 1); + DrawMinimapTile(itemEntities[i].pos.x, itemEntities[i].pos.y); itemVelocity[i].x = (((targetTilePos[i].x * 24 + 4) * 256) - itemEntities[i].pixelPos.x) / 60; itemVelocity[i].y = (((targetTilePos[i].y * 24 + 4) * 256) - itemEntities[i].pixelPos.y) / 60; } @@ -149,8 +149,8 @@ void HandleTrawlOrbAction(Entity *user, Entity *target) for (i = 0; i < itemsCount; i++) { if (targetTilePos[i].x >= 0) { - AddItemToDungeonAt(&targetTilePos[i], GetItemData(&itemEntities[i]), 1); - ShowDungeonMapAtPos(targetTilePos[i].x, targetTilePos[i].y); + SpawnItem(&targetTilePos[i], GetItemInfo(&itemEntities[i]), 1); + DrawMinimapTile(targetTilePos[i].x, targetTilePos[i].y); hasTrawled = TRUE; } } diff --git a/src/warp_target.c b/src/warp_target.c index d34ba01e9..485405d26 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -29,14 +29,13 @@ extern u32 gDungeonFramesCounter; bool8 ExposeTrap(s32 x, s32 y); -void ShowWholeRevealedDungeonMap(); -u8 sub_8045888(Entity *); +void UpdateMinimap(); void sub_807EC28(u32); -u8 sub_8044B28(void); +u8 IsFloorOver(void); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); -extern void sub_803F580(u32); +extern void UpdateCamera(u32); bool8 sub_808384C(DungeonPos *, DungeonPos *); u8 sub_8083660(DungeonPos *); @@ -72,7 +71,7 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC584); // $m0 warped! TrySendImmobilizeSleepEndMsg(target,target); sub_80421AC(pokemon,target); - if (sub_8045888(target)) { + if (ShouldDisplayEntity(target)) { direction = (info->action).direction; target->unk1C.raw += + 0x800; while ( target->unk1C.raw < 0xa000) { @@ -115,10 +114,10 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) } sub_80694C0(target,local_2c.x,local_2c.y,1); - sub_804535C(target,0); + UpdateEntityPixelPos(target,0); sub_807BB78(target); - sub_803F580(1); - if (sub_8045888(target)) { + UpdateCamera(1); + if (ShouldDisplayEntity(target)) { direction = (info->action).direction; target->unk1C.raw = 0x9c00; do { @@ -140,7 +139,7 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) PetrifiedStatusTarget(pokemon,target); } if (info->isTeamLeader) { - sub_804AC20(&target->pos); + DiscoverMinimap(&target->pos); gDungeon->unk1 = 0; gDungeon->unk5C0 = -1; sub_807EC28(0); diff --git a/src/weather.c b/src/weather.c index 5809119b4..a671b20dd 100644 --- a/src/weather.c +++ b/src/weather.c @@ -64,7 +64,7 @@ void sub_807E5AC(void) if(weather == WEATHER_COUNT) weather = DungeonRandInt(WEATHER_COUNT); sub_807E5E4(weather); - TriggerWeatherAbilities(); + TryActivateArtificialWeatherAbilities(); sub_807EAA0(0, 1); }