From 154c44250512828d56f5431188a7907cd149ef10 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Tue, 25 Jan 2022 22:46:40 -0500 Subject: Decomped CanMoveInDirection() --- src/dungeon_capabilities_1.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ src/dungeon_util.c | 2 +- src/status_checks.c | 4 ++-- 3 files changed, 54 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index 721bdcb..7ad12d8 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -2,10 +2,21 @@ #include "dungeon_capabilities_1.h" #include "constants/dungeon.h" +#include "constants/iq_skill.h" #include "constants/status.h" #include "charge_move.h" #include "dungeon_ai.h" #include "dungeon_capabilities.h" +#include "dungeon_items.h" +#include "dungeon_map_access.h" +#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_util.h" +#include "map.h" + +const u8 gDirectionBitMasks[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; + +extern u8 GetCrossableTerrain(s16); +extern bool8 IsFixedDungeon(); static inline bool8 JoinLocationCannotUseItems(struct DungeonEntityData *pokemonData) { @@ -75,3 +86,43 @@ bool8 CannotAttack(struct DungeonEntity *pokemon, bool8 skipSleep) } return TRUE; } + +bool8 CanMoveInDirection(struct DungeonEntity *pokemon, u32 facingDir) +{ + u8 crossableTerrain = GetCrossableTerrain(pokemon->entityData->entityID); + struct MapTile *currentMapTile = GetMapTileAtPosition(pokemon->posWorld.x + gAdjacentTileOffsets[facingDir].x, + pokemon->posWorld.y + gAdjacentTileOffsets[facingDir].y); + if (currentMapTile->tileType & TILE_TYPE_MAP_EDGE || currentMapTile->pokemon != NULL) + { + return FALSE; + } + if (!IsFixedDungeon()) + { + if (pokemon->entityData->transformStatus == TRANSFORM_STATUS_MOBILE || HasItem(pokemon, ITEM_ID_MOBILE_SCARF)) + { + crossableTerrain = CROSSABLE_TERRAIN_WALL; + } + else if (HasIQSkill(pokemon, IQ_SKILL_ALL_TERRAIN_HIKER)) + { + crossableTerrain = CROSSABLE_TERRAIN_CREVICE; + } + else if (HasIQSkill(pokemon, IQ_SKILL_SUPER_MOBILE)) + { + if (facingDir & 1) + { + // Super Mobile can't break walls diagonally. + crossableTerrain = CROSSABLE_TERRAIN_CREVICE; + } + else + { + crossableTerrain = CROSSABLE_TERRAIN_WALL; + } + } + } + currentMapTile = GetMapTileAtPosition(pokemon->posWorld.x, pokemon->posWorld.y); + if (!(currentMapTile->canMoveAdjacent[crossableTerrain] & gDirectionBitMasks[facingDir & DIRECTION_MASK])) + { + return FALSE; + } + return TRUE; +} diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 5b6bd5a..c5b5695 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -3,7 +3,7 @@ #include "dungeon_map_access.h" -const struct Position gAdjacentTileOffsets[NUM_DIRECTIONS] = { +const struct Position gAdjacentTileOffsets[] = { {0, 1}, {1, 1}, {1, 0}, diff --git a/src/status_checks.c b/src/status_checks.c index ed39e99..b371934 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -6,6 +6,7 @@ #include "constants/status.h" #include "code_80521D0.h" #include "dungeon_action.h" +#include "dungeon_capabilities_1.h" #include "dungeon_random.h" extern char *gPtrFrozenMessage; @@ -17,7 +18,6 @@ extern char *gPtrInfatuatedMessage; extern char gAvailablePokemonNames[]; extern void SetMessageArgument(char[], struct DungeonEntity*, u32); -extern bool8 CanMoveForward2(struct DungeonEntity*, u8); extern void DecideAttack(struct DungeonEntity*); bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon) @@ -74,7 +74,7 @@ bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon) } if (pokemonData->eyesightStatus == EYESIGHT_STATUS_BLINKER) { - if (!CanMoveForward2(pokemon, pokemonData->action.facingDir)) + if (!CanMoveInDirection(pokemon, pokemonData->action.facingDir)) { if (DungeonRandomCapped(2) != 0) { -- cgit v1.2.3 From 42909d03330749e610900d5aa5765758cc05e533 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Tue, 25 Jan 2022 23:17:27 -0500 Subject: Decomped GetCrossableTerrain() --- src/dungeon_ai_movement.c | 287 +++++++++++++++++++++++++++++++++++++++++++ src/dungeon_capabilities_1.c | 2 +- src/dungeon_movement.c | 287 ++----------------------------------------- 3 files changed, 301 insertions(+), 275 deletions(-) create mode 100644 src/dungeon_ai_movement.c (limited to 'src') diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c new file mode 100644 index 0000000..bc109eb --- /dev/null +++ b/src/dungeon_ai_movement.c @@ -0,0 +1,287 @@ +#include "global.h" +#include "dungeon_ai_movement.h" + +#include "constants/dungeon_action.h" +#include "constants/direction.h" +#include "constants/iq_skill.h" +#include "constants/status.h" +#include "constants/targeting.h" +#include "code_80521D0.h" +#include "dungeon_action.h" +#include "dungeon_ai_items.h" +#include "dungeon_capabilities_1.h" +#include "dungeon_global_data.h" +#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_random.h" +#include "dungeon_util.h" +#include "dungeon_util_1.h" +#include "dungeon_visibility.h" +#include "map.h" +#include "pokemon.h" +#include "status_checks.h" + +extern char gAvailablePokemonNames[]; +extern char *gPtrCouldntBeUsedMessage; +extern char *gPtrItsaMonsterHouseMessage; + +extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity*); +extern void SetMessageArgument(char[], struct DungeonEntity*, u32); +extern void ResetAction(u16*); +extern void DecideAttack(struct DungeonEntity*); +extern void MoveIfPossible(struct DungeonEntity*, bool8); +extern u8 sub_8044B28(void); +extern void sub_807AB38(struct DungeonEntity *, u32); +extern void sub_8041888(u32); +extern u8 sub_803F428(s16 *); +extern void sub_803E708(u32, u32); +extern struct DungeonEntity *GetLeaderEntity(); +extern void TargetTileInFront(struct DungeonEntity *); + +u32 sub_8075818(struct DungeonEntity *entity) +{ + struct MapTile *tile; + struct DungeonEntityData *entityData; + struct DungeonEntity *subEntity; + struct ItemSlot *item; + u8 *trapData; // TODO: turn into struct when more research is done.. + u8 r1; + + entityData = entity->entityData; + if(EntityExists(entity)) + { + tile = GetMapEntityForDungeonEntity(entity); + if(HasIQSkill(entity, IQ_SKILL_SUPER_MOBILE)) + if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID))) + return 1; + subEntity = tile->mapObject; + if(subEntity != NULL) + { + switch(GetEntityType(subEntity)) + { + case ENTITY_NONE: + case ENTITY_POKEMON: + case 4: + case 5: + break; + case ENTITY_TRAP: + trapData = (u8*) GetTrapData(subEntity); + r1 = 0; + if(trapData[1] == 0) + { + if(!subEntity->visible || entityData->isEnemy) + goto flag_check; + else + goto error; + } + else if(trapData[1] == 1) + { + if(!entityData->isEnemy) + goto flag_check; + else + goto error; + } + else if(trapData[1] == 2) + { + if(!entityData->isEnemy) + r1 = 1; + } +flag_check: + if(r1 == 0) + break; + else + goto error; + case ENTITY_ITEM: + if(!entityData->isLeader) + { + if(!(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) + { + if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID))) + { + if(entityData->isEnemy) + break; + else + { + item = GetItemData(subEntity); + if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) + { + return 1; + } + } + } + else + { + item = GetItemData(subEntity); + if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) + { +error: + return 1; + } + } + } + } + break; + } + } + } + return 0; +} + +void sub_8075900(struct DungeonEntity *pokemon, u8 r1) +{ + if(EntityExists(pokemon)) + { + if(!pokemon->entityData->isEnemy) + { + if(!sub_8044B28()) + { + if(!gDungeonGlobalData->monsterHouseActive) + { + if((GetMapEntityForDungeonEntity(pokemon)->tileType & TILE_TYPE_MONSTER_HOUSE)) + { + // It's a monster house! + SendMessage(GetLeaderEntity(), gPtrItsaMonsterHouseMessage); + gDungeonGlobalData->unk672 = 1; + sub_807AB38(pokemon, r1); + sub_8041888(0); + if(sub_803F428(&pokemon->posWorld.x) != 0) + sub_803E708(0x78, 0x39); + } + } + } + } + } +} + +void DecideAction(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + if (pokemonData->flags & MOVEMENT_FLAG_SWAPPED_PLACES_PETRIFIED) + { + if (pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED) + { + SendImmobilizeEndMessage(pokemon, pokemon); + } + } + else + { + pokemonData->targetingDecoy = TARGETING_DECOY_NONE; + if (pokemonData->clientType == CLIENT_TYPE_NONE || IsMovingClient(pokemon)) + { + if (pokemonData->clientType != CLIENT_TYPE_CLIENT && pokemonData->useHeldItem) + { + if (CannotUseItems(pokemon)) + { + pokemonData->useHeldItem = FALSE; + SetMessageArgument(gAvailablePokemonNames, pokemon, 0); + SendMessage(pokemon, gPtrCouldntBeUsedMessage); + return; + } + DecideUseItem(pokemon); + if (pokemonData->action.action != DUNGEON_ACTION_NONE) + { + return; + } + } + if (!HasStatusAffectingActions(pokemon)) + { + if (gDungeonGlobalData->decoyActive) + { + s32 i; + struct DungeonEntity *target; + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) + { + target = gDungeonGlobalData->allPokemon[i]; + if (EntityExists(target) && + target->entityData->waitingStatus == WAITING_STATUS_DECOY && + CanSee(pokemon, target)) + { + bool8 enemyDecoy = target->entityData->enemyDecoy; + u8 targetingDecoy = TARGETING_DECOY_TEAM; + if (enemyDecoy) + { + targetingDecoy = TARGETING_DECOY_WILD; + } + pokemonData->targetingDecoy = targetingDecoy; + break; + } + } + } + ResetAction(&pokemonData->action.action); + if (pokemonData->clientType == CLIENT_TYPE_CLIENT) + { + SetWalkAction(&pokemonData->action, pokemonData->entityID); + pokemonData->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); + pokemonData->targetPosition.x = pokemon->posWorld.x; + pokemonData->targetPosition.y = pokemon->posWorld.y - 1; + } + else + { + DecideUseItem(pokemon); + if (pokemonData->action.action == DUNGEON_ACTION_NONE) + { + if (!HasIQSkill(pokemon, IQ_SKILL_DEDICATED_TRAVELER)) + { + DecideAttack(pokemon); + if (pokemonData->action.action != DUNGEON_ACTION_NONE) + { + return; + } + if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED) + { + SetWalkAction(&pokemonData->action, pokemonData->entityID); + } + else + { + if (!GetIsMoving(pokemonData->entityID)) + { + return; + } + MoveIfPossible(pokemon, TRUE); + } + } + else + { + if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED) + { + SetWalkAction(&pokemonData->action, pokemonData->entityID); + } + else + { + if (GetIsMoving(pokemonData->entityID)) + { + MoveIfPossible(pokemon, TRUE); + } + if (pokemonData->action.action > DUNGEON_ACTION_WAIT) + { + return; + } + DecideAttack(pokemon); + if (pokemonData->action.action <= DUNGEON_ACTION_WAIT) + { + return; + } + pokemonData->notAdjacentToTarget = FALSE; + pokemonData->movingIntoTarget = FALSE; + pokemonData->waiting = FALSE; + } + } + } + } + } + } + } +} + +void sub_8075BA4(struct DungeonEntity *param_1,char param_2) +{ + struct DungeonEntityData * iVar2 = param_1->entityData; + + if ((param_2 != '\0') && (iVar2->volatileStatus == VOLATILE_STATUS_COWERING)) { + iVar2->action.facingDir = (iVar2->action.facingDir + 4) & DIRECTION_MASK; + TargetTileInFront(param_1); + } + else if (iVar2->volatileStatus == VOLATILE_STATUS_CONFUSED) { + iVar2->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); + TargetTileInFront(param_1); + } +} diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index 7ad12d8..c4eb53e 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -9,13 +9,13 @@ #include "dungeon_capabilities.h" #include "dungeon_items.h" #include "dungeon_map_access.h" +#include "dungeon_movement.h" #include "dungeon_pokemon_attributes_1.h" #include "dungeon_util.h" #include "map.h" const u8 gDirectionBitMasks[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; -extern u8 GetCrossableTerrain(s16); extern bool8 IsFixedDungeon(); static inline bool8 JoinLocationCannotUseItems(struct DungeonEntityData *pokemonData) diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c index d342262..0ff0509 100644 --- a/src/dungeon_movement.c +++ b/src/dungeon_movement.c @@ -1,287 +1,26 @@ #include "global.h" #include "dungeon_movement.h" - -#include "constants/dungeon_action.h" -#include "constants/direction.h" -#include "constants/iq_skill.h" -#include "constants/status.h" -#include "constants/targeting.h" -#include "code_80521D0.h" -#include "dungeon_action.h" -#include "dungeon_ai_items.h" -#include "dungeon_capabilities_1.h" -#include "dungeon_global_data.h" -#include "dungeon_pokemon_attributes_1.h" -#include "dungeon_random.h" -#include "dungeon_util.h" -#include "dungeon_util_1.h" -#include "dungeon_visibility.h" #include "map.h" #include "pokemon.h" -#include "status_checks.h" - -extern char gAvailablePokemonNames[]; -extern char *gPtrCouldntBeUsedMessage; -extern char *gPtrItsaMonsterHouseMessage; -extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity*); -extern void SetMessageArgument(char[], struct DungeonEntity*, u32); -extern void ResetAction(u16*); -extern void DecideAttack(struct DungeonEntity*); -extern void MoveIfPossible(struct DungeonEntity*, bool8); -extern u8 sub_8044B28(void); -extern void sub_807AB38(struct DungeonEntity *, u32); -extern void sub_8041888(u32); -extern u8 sub_803F428(s16 *); -extern void sub_803E708(u32, u32); -extern struct DungeonEntity *GetLeaderEntity(); -extern void TargetTileInFront(struct DungeonEntity *); +extern u8 gWalkableTileToCrossableTerrain[8]; -u32 sub_8075818(struct DungeonEntity *entity) +u8 GetCrossableTerrain(s16 species) { - struct MapTile *tile; - struct DungeonEntityData *entityData; - struct DungeonEntity *subEntity; - struct ItemSlot *item; - u8 *trapData; // TODO: turn into struct when more research is done.. - u8 r1; - - entityData = entity->entityData; - if(EntityExists(entity)) + u8 walkableTiles = GetWalkableTiles(species); + if (walkableTiles >= NUM_CROSSABLE_TERRAIN) { - tile = GetMapEntityForDungeonEntity(entity); - if(HasIQSkill(entity, IQ_SKILL_SUPER_MOBILE)) - if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID))) - return 1; - subEntity = tile->mapObject; - if(subEntity != NULL) - { - switch(GetEntityType(subEntity)) - { - case ENTITY_NONE: - case ENTITY_POKEMON: - case 4: - case 5: - break; - case ENTITY_TRAP: - trapData = (u8*) GetTrapData(subEntity); - r1 = 0; - if(trapData[1] == 0) - { - if(!subEntity->visible || entityData->isEnemy) - goto flag_check; - else - goto error; - } - else if(trapData[1] == 1) - { - if(!entityData->isEnemy) - goto flag_check; - else - goto error; - } - else if(trapData[1] == 2) - { - if(!entityData->isEnemy) - r1 = 1; - } -flag_check: - if(r1 == 0) - break; - else - goto error; - case ENTITY_ITEM: - if(!entityData->isLeader) - { - if(!(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) - { - if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID))) - { - if(entityData->isEnemy) - break; - else - { - item = GetItemData(subEntity); - if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) - { - return 1; - } - } - } - else - { - item = GetItemData(subEntity); - if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) - { -error: - return 1; - } - } - } - } - break; - } - } - } - return 0; -} - -void sub_8075900(struct DungeonEntity *pokemon, u8 r1) -{ - if(EntityExists(pokemon)) - { - if(!pokemon->entityData->isEnemy) - { - if(!sub_8044B28()) - { - if(!gDungeonGlobalData->monsterHouseActive) - { - if((GetMapEntityForDungeonEntity(pokemon)->tileType & TILE_TYPE_MONSTER_HOUSE)) - { - // It's a monster house! - SendMessage(GetLeaderEntity(), gPtrItsaMonsterHouseMessage); - gDungeonGlobalData->unk672 = 1; - sub_807AB38(pokemon, r1); - sub_8041888(0); - if(sub_803F428(&pokemon->posWorld.x) != 0) - sub_803E708(0x78, 0x39); - } - } - } - } - } -} - -void DecideAction(struct DungeonEntity *pokemon) -{ - struct DungeonEntityData *pokemonData = pokemon->entityData; - if (pokemonData->flags & MOVEMENT_FLAG_SWAPPED_PLACES_PETRIFIED) - { - if (pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED) - { - SendImmobilizeEndMessage(pokemon, pokemon); - } + // Pokémon that can cross water or lava have a walkable tile value of 4 (WALKABLE_TILE_LAVA) or 5 (WALKABLE_TILE_WATER), respectively. + // Indices 4 and 5 in this array are assigned either CROSSABLE_TERRAIN_REGULAR or CROSSABLE_TERRAIN_LIQUID + // depending on whether the dungeon's liquid is water or lava. + // For example, a lava dungeon like Mt. Blaze would have these values: + // gWalkableTileToCrossableTerrain[WALKABLE_TILE_LAVA]: CROSSABLE_TERRAIN_LIQUID + // gWalkableTileToCrossableTerrain[WALKABLE_TILE_WATER]: CROSSABLE_TERRAIN_REGULAR + // This means a Fire-type can cross the dungeon's liquid, while a Water-type cannot. + return gWalkableTileToCrossableTerrain[walkableTiles]; } else { - pokemonData->targetingDecoy = TARGETING_DECOY_NONE; - if (pokemonData->clientType == CLIENT_TYPE_NONE || IsMovingClient(pokemon)) - { - if (pokemonData->clientType != CLIENT_TYPE_CLIENT && pokemonData->useHeldItem) - { - if (CannotUseItems(pokemon)) - { - pokemonData->useHeldItem = FALSE; - SetMessageArgument(gAvailablePokemonNames, pokemon, 0); - SendMessage(pokemon, gPtrCouldntBeUsedMessage); - return; - } - DecideUseItem(pokemon); - if (pokemonData->action.action != DUNGEON_ACTION_NONE) - { - return; - } - } - if (!HasStatusAffectingActions(pokemon)) - { - if (gDungeonGlobalData->decoyActive) - { - s32 i; - struct DungeonEntity *target; - for (i = 0; i < DUNGEON_MAX_POKEMON; i++) - { - target = gDungeonGlobalData->allPokemon[i]; - if (EntityExists(target) && - target->entityData->waitingStatus == WAITING_STATUS_DECOY && - CanSee(pokemon, target)) - { - bool8 enemyDecoy = target->entityData->enemyDecoy; - u8 targetingDecoy = TARGETING_DECOY_TEAM; - if (enemyDecoy) - { - targetingDecoy = TARGETING_DECOY_WILD; - } - pokemonData->targetingDecoy = targetingDecoy; - break; - } - } - } - ResetAction(&pokemonData->action.action); - if (pokemonData->clientType == CLIENT_TYPE_CLIENT) - { - SetWalkAction(&pokemonData->action, pokemonData->entityID); - pokemonData->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); - pokemonData->targetPosition.x = pokemon->posWorld.x; - pokemonData->targetPosition.y = pokemon->posWorld.y - 1; - } - else - { - DecideUseItem(pokemon); - if (pokemonData->action.action == DUNGEON_ACTION_NONE) - { - if (!HasIQSkill(pokemon, IQ_SKILL_DEDICATED_TRAVELER)) - { - DecideAttack(pokemon); - if (pokemonData->action.action != DUNGEON_ACTION_NONE) - { - return; - } - if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED) - { - SetWalkAction(&pokemonData->action, pokemonData->entityID); - } - else - { - if (!GetIsMoving(pokemonData->entityID)) - { - return; - } - MoveIfPossible(pokemon, TRUE); - } - } - else - { - if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED) - { - SetWalkAction(&pokemonData->action, pokemonData->entityID); - } - else - { - if (GetIsMoving(pokemonData->entityID)) - { - MoveIfPossible(pokemon, TRUE); - } - if (pokemonData->action.action > DUNGEON_ACTION_WAIT) - { - return; - } - DecideAttack(pokemon); - if (pokemonData->action.action <= DUNGEON_ACTION_WAIT) - { - return; - } - pokemonData->notAdjacentToTarget = FALSE; - pokemonData->movingIntoTarget = FALSE; - pokemonData->waiting = FALSE; - } - } - } - } - } - } + return walkableTiles; } } - -void sub_8075BA4(struct DungeonEntity *param_1,char param_2) -{ - struct DungeonEntityData * iVar2 = param_1->entityData; - - if ((param_2 != '\0') && (iVar2->volatileStatus == VOLATILE_STATUS_COWERING)) { - iVar2->action.facingDir = (iVar2->action.facingDir + 4) & DIRECTION_MASK; - TargetTileInFront(param_1); - } - else if (iVar2->volatileStatus == VOLATILE_STATUS_CONFUSED) { - iVar2->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS); - TargetTileInFront(param_1); - } -} -- cgit v1.2.3 From f2457501ee643a2fc3b23e93f4e2f0a567a3231c Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Tue, 25 Jan 2022 23:24:14 -0500 Subject: Decomped IsFixedDungeon() --- src/dungeon_capabilities_1.c | 3 +-- src/dungeon_engine.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/dungeon_engine.c (limited to 'src') diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index c4eb53e..bbe48bc 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -7,6 +7,7 @@ #include "charge_move.h" #include "dungeon_ai.h" #include "dungeon_capabilities.h" +#include "dungeon_engine.h" #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_movement.h" @@ -16,8 +17,6 @@ const u8 gDirectionBitMasks[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; -extern bool8 IsFixedDungeon(); - static inline bool8 JoinLocationCannotUseItems(struct DungeonEntityData *pokemonData) { if (pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c new file mode 100644 index 0000000..dd25441 --- /dev/null +++ b/src/dungeon_engine.c @@ -0,0 +1,13 @@ +#include "global.h" +#include "dungeon_engine.h" +#include "constants/dungeon.h" +#include "dungeon_global_data.h" + +bool8 IsFixedDungeon() +{ + if (gDungeonGlobalData->tileset > DUNGEON_OUT_ON_RESCUE) + { + return TRUE; + } + return FALSE; +} -- cgit v1.2.3 From 5dc5b3b1f97f9467005dadd63f5f6e052f984bc3 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Wed, 26 Jan 2022 00:07:18 -0500 Subject: Used official or more common names for music tracks --- src/code_2.c | 2 +- src/luminous_cave.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/code_2.c b/src/code_2.c index 29f1088..8a6987b 100644 --- a/src/code_2.c +++ b/src/code_2.c @@ -138,7 +138,7 @@ void GameLoop(void) FinishReadSavePak(); } tmp3 = 1; - StartNewBGM(MUS_LOADING_SCREEN); + StartNewBGM(MUS_FILE_SELECT); flag = TRUE; sub_80095CC(0, 20); InitMainMenu(); diff --git a/src/luminous_cave.c b/src/luminous_cave.c index eef6acd..2b5afa3 100644 --- a/src/luminous_cave.c +++ b/src/luminous_cave.c @@ -132,7 +132,7 @@ extern void sub_808F468(struct PokemonStruct *, u8 *, u32); bool8 LuminousCave_HasOnly1Member(void); -enum +enum { LUMINOUS_CAVE_ENTRY, LUMINOUS_CAVE_ASK_EVOLVE, @@ -284,7 +284,7 @@ void sub_8024804(void) void UpdateLuminousCaveDialogue(void) { char *monName; - + switch(gUnknown_203B2B0->state) { case LUMINOUS_CAVE_ENTRY: if (LuminousCave_HasOnly1Member()) { @@ -306,7 +306,7 @@ void UpdateLuminousCaveDialogue(void) break; case LUMINOUS_CAVE_SHALL_RETURN: gUnknown_203B2B0->fallbackState = 4; - xxx_call_fade_in_new_bgm(MUS_LOADING_SCREEN,0x3c); + xxx_call_fade_in_new_bgm(MUS_FILE_SELECT,0x3c); sub_80141B4(gLuminousCaveYeShallReturn,0,0,0x305); break; -- cgit v1.2.3