Add missing map constant usage

This commit is contained in:
GriffinR
2022-02-11 14:43:38 -05:00
parent 91076d9408
commit 24f18af338
7 changed files with 30 additions and 14 deletions
+7 -1
View File
@@ -211,7 +211,13 @@ static void CreateBattleStartTask(u8 transition, u16 song) // song == 0 means de
static bool8 CheckSilphScopeInPokemonTower(u16 mapGroup, u16 mapNum)
{
if (mapGroup == MAP_GROUP(POKEMON_TOWER_1F)
&& ((u16)(mapNum - MAP_NUM(POKEMON_TOWER_1F)) <= 6)
&& (mapNum == MAP_NUM(POKEMON_TOWER_1F)
|| mapNum == MAP_NUM(POKEMON_TOWER_2F)
|| mapNum == MAP_NUM(POKEMON_TOWER_3F)
|| mapNum == MAP_NUM(POKEMON_TOWER_4F)
|| mapNum == MAP_NUM(POKEMON_TOWER_5F)
|| mapNum == MAP_NUM(POKEMON_TOWER_6F)
|| mapNum == MAP_NUM(POKEMON_TOWER_7F))
&& !(CheckBagHasItem(ITEM_SILPH_SCOPE, 1)))
return TRUE;
else
+6 -3
View File
@@ -15,6 +15,7 @@
#include "script.h"
#include "trainer_see.h"
#include "trig.h"
#include "constants/maps.h"
#include "constants/event_object_movement.h"
#include "constants/event_objects.h"
@@ -1214,8 +1215,8 @@ static void ClearObjectEvent(struct ObjectEvent *objectEvent)
{
*objectEvent = (struct ObjectEvent){};
objectEvent->localId = 0xFF;
objectEvent->mapNum = 0xFF;
objectEvent->mapGroup = 0xFF;
objectEvent->mapNum = MAP_NUM(UNDEFINED);
objectEvent->mapGroup = MAP_GROUP(UNDEFINED);
objectEvent->movementActionId = 0xFF;
}
@@ -8038,7 +8039,9 @@ static void CalcWhetherObjectIsOffscreen(struct ObjectEvent *objectEvent, struct
x2 = graphicsInfo->width + (s16)x;
y2 = graphicsInfo->height + (s16)y;
if (gSaveBlock1Ptr->location.mapGroup == 1 && gSaveBlock1Ptr->location.mapNum == 4 && objectEvent->localId == 1)
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SSANNE_EXTERIOR)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SSANNE_EXTERIOR)
&& objectEvent->localId == 1)
{
var = -32;
}
+3 -1
View File
@@ -10,6 +10,7 @@
#include "field_specials.h"
#include "constants/songs.h"
#include "constants/items.h"
#include "constants/maps.h"
static EWRAM_DATA const struct YesNoFuncTable *gUnknown_20399C8 = NULL;
static EWRAM_DATA TaskFunc gUnknown_20399CC = NULL;
@@ -94,7 +95,8 @@ bool8 itemid_link_can_give_berry(u16 itemId)
{
if (itemId != ITEM_ENIGMA_BERRY)
return TRUE;
else if (!gSaveBlock1Ptr->location.mapGroup && gSaveBlock1Ptr->location.mapNum == 1)
else if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRADE_CENTER)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRADE_CENTER))
return FALSE;
else if (InUnionRoom() != TRUE)
return TRUE;
+6 -3
View File
@@ -520,9 +520,9 @@ static void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId
static bool32 IsDummyWarp(struct WarpData *warp)
{
if (warp->mapGroup != -1)
if (warp->mapGroup != (s8)MAP_GROUP(UNDEFINED))
return FALSE;
else if (warp->mapNum != -1)
else if (warp->mapNum != (s8)MAP_NUM(UNDEFINED))
return FALSE;
else if (warp->warpId != -1)
return FALSE;
@@ -895,7 +895,10 @@ bool8 sub_8055B38(u16 metatileBehavior)
{
if (MetatileBehavior_IsSurfable(metatileBehavior) != TRUE)
return FALSE;
if ((gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEAFOAM_ISLANDS_B3F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEAFOAM_ISLANDS_B3F)) || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEAFOAM_ISLANDS_B4F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEAFOAM_ISLANDS_B4F)))
if ((gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEAFOAM_ISLANDS_B3F)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEAFOAM_ISLANDS_B3F))
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEAFOAM_ISLANDS_B4F)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEAFOAM_ISLANDS_B4F)))
return TRUE;
return FALSE;
}
+5 -4
View File
@@ -2,6 +2,7 @@
#include "script.h"
#include "event_data.h"
#include "quest_log.h"
#include "constants/maps.h"
#define RAM_SCRIPT_MAGIC 51
#define SCRIPT_STACK_SIZE 20
@@ -511,9 +512,9 @@ bool32 ValidateRamScript(void)
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
if (scriptData->magic != RAM_SCRIPT_MAGIC)
return FALSE;
if (scriptData->mapGroup != 0xFF)
if (scriptData->mapGroup != MAP_GROUP(UNDEFINED))
return FALSE;
if (scriptData->mapNum != 0xFF)
if (scriptData->mapNum != MAP_NUM(UNDEFINED))
return FALSE;
if (scriptData->objectId != 0xFF)
return FALSE;
@@ -529,9 +530,9 @@ u8 *sub_8069E48(void)
return NULL;
if (scriptData->magic != RAM_SCRIPT_MAGIC)
return NULL;
if (scriptData->mapGroup != 0xFF)
if (scriptData->mapGroup != MAP_GROUP(UNDEFINED))
return NULL;
if (scriptData->mapNum != 0xFF)
if (scriptData->mapNum != MAP_NUM(UNDEFINED))
return NULL;
if (scriptData->objectId != 0xFF)
return NULL;
+1 -1
View File
@@ -182,7 +182,7 @@ static u16 GetCurrentMapWildMonHeaderId(void)
for (i = 0; ; i++)
{
const struct WildPokemonHeader * wildHeader = &gWildMonHeaders[i];
if (wildHeader->mapGroup == 0xFF)
if (wildHeader->mapGroup == MAP_GROUP(UNDEFINED))
break;
if (gWildMonHeaders[i].mapGroup == gSaveBlock1Ptr->location.mapGroup &&
+2 -1
View File
@@ -6,6 +6,7 @@
#include "overworld.h"
#include "pokedex_area_markers.h"
#include "constants/region_map_sections.h"
#include "constants/maps.h"
struct SeviiDexArea
{
@@ -181,7 +182,7 @@ s32 BuildPokedexAreaSubspriteBuffer(u16 species, struct Subsprite * subsprites)
alteringCaveNum = VarGet(VAR_ALTERING_CAVE_WILD_SET);
if (alteringCaveNum > 8)
alteringCaveNum = 0;
for (i = 0, areaCount = 0; gWildMonHeaders[i].mapGroup != 0xFF; i++)
for (i = 0, areaCount = 0; gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED); i++)
{
mapSecId = GetMapSecIdFromWildMonHeader(&gWildMonHeaders[i]);
if (mapSecId == MAPSEC_ALTERING_CAVE)