diff --git a/include/constants/ground_map.h b/include/constants/ground_map.h index 89c436ad2..34467dda0 100644 --- a/include/constants/ground_map.h +++ b/include/constants/ground_map.h @@ -233,4 +233,9 @@ enum { MAP_COUNT, }; +// These are automatically adjusted via GetAdjustedGroundMap. +#define MAP_TEAM_BASE MAP_TEAM_BASE_PIKACHU_BASIC +#define MAP_TEAM_BASE_INSIDE MAP_TEAM_BASE_INSIDE_PIKACHU_BASIC +#define TEAM_BASE_MAPS_PER_SPECIES 6 // 3 on the inside and 3 on the outside (basic, construction, final) + #endif // GUARD_CONSTANTS_GROUND_MAP_H diff --git a/include/data_script.h b/include/data_script.h index ee7cf97ec..a7458c063 100644 --- a/include/data_script.h +++ b/include/data_script.h @@ -1,6 +1,7 @@ #include "ground_script.h" #include "event_flag.h" #include "constants/item.h" +#include "constants/ground_map.h" #define LPARRAY(x) (sizeof(x)/sizeof(*(x))), x #define CPOS_HALFTILE 0x2 diff --git a/include/ground_map.h b/include/ground_map.h index 5d35c3ee3..35c2ec7f3 100644 --- a/include/ground_map.h +++ b/include/ground_map.h @@ -2,10 +2,10 @@ #define GUARD_GROUND_MAP_H void GroundMap_Reset(void); - void AllocGroundMapAction(void); void FreeGroundMapAction(void); void sub_80A4B38(void); void sub_80A4B54(void); +s16 GetAdjustedGroundMap(s32 mapId); #endif // GUARD_GROUND_MAP_H diff --git a/src/ground_map.c b/src/ground_map.c index d3380ba19..fdbe3fbe1 100644 --- a/src/ground_map.c +++ b/src/ground_map.c @@ -184,26 +184,21 @@ bool8 sub_80A4D48(s16 index) return FALSE; } -s32 GetAdjustedGroundMap(s16 param_1) +s16 GetAdjustedGroundMap(s32 mapId) { - s32 iVar5; + s32 retMapId = (s16) mapId; - iVar5 = param_1; - - switch(iVar5) - { - case 9: - case 0xC: - iVar5 = (s16)(iVar5 + ((GetScriptVarValue(NULL, BASE_KIND) * 6) + GetScriptVarValue(NULL, BASE_LEVEL))); + switch (retMapId) { + case MAP_TEAM_BASE: + case MAP_TEAM_BASE_INSIDE: + retMapId = (s16)(retMapId + ((GetScriptVarValue(NULL, BASE_KIND) * TEAM_BASE_MAPS_PER_SPECIES) + GetScriptVarValue(NULL, BASE_LEVEL))); break; - case 2: + case MAP_WHISCASH_POND: if (sub_80023E4(6)) { - iVar5 = 3; + retMapId = MAP_WHISCASH_POND_OPEN; } break; - default: - break; } - return iVar5; + return retMapId; } diff --git a/src/ground_script.c b/src/ground_script.c index 547374bc8..b7ab60f1c 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -108,7 +108,6 @@ void sub_809D1E4(s32, s32, s32); void sub_809D208(s32, PixelPos*, s32); void sub_809D220(s32, s32, s32); void GroundScriptLockJumpZero(s16); -s16 GetAdjustedGroundMap(s32); void sub_80A87AC(s32, s32); void sub_80A8BD8(s16, s32*); u32 sub_80A8C2C();