diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 22b02f1c1..d38fcfaba 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -3,17 +3,30 @@ MAP_N_A EQU -1 GROUP_NONE EQU 0 MAP_NONE EQU 0 -; map permissions (wPermission) +; map header fields (see maps/map_headers.asm) + const_def + const MAPHEADER_MAPHEADER2_BANK ; 0 + const MAPHEADER_TILESET ; 1 + const MAPHEADER_ENVIRONMENT ; 2 + const MAPHEADER_MAPHEADER2 ; 3 + const MAPHEADER_MAPHEADER2_HI ; 4 + const MAPHEADER_LOCATION ; 5 + const MAPHEADER_MUSIC ; 6 + const MAPHEADER_PALETTE ; 7 + const MAPHEADER_FISHGROUP ; 8 +NUM_MAPHEADER_ATTRIBUTES EQU const_value + +; map environments (wEnvironment) const_value SET 1 const TOWN const ROUTE const INDOOR const CAVE - const PERM_5 + const ENVIRONMENT_5 const GATE const DUNGEON -; map palettes (wPermission) +; map palettes (wEnvironment) const_def const PALETTE_AUTO const PALETTE_DAY diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index f2fb72714..c41a6ed58 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -680,13 +680,13 @@ NUM_TRAINER_CLASSES EQU __enum__ ; TrainerClassAttributes fields (see data/trainers/trainer_attributes.asm) const_def - const TRNATTR_ITEM1 - const TRNATTR_ITEM2 - const TRNATTR_BASEMONEY - const TRNATTR_AI_MOVE_WEIGHTS - const TRNATTR_AI2 - const TRNATTR_AI_ITEM_SWITCH - const TRNATTR_AI4 + const TRNATTR_ITEM1 ; 0 + const TRNATTR_ITEM2 ; 1 + const TRNATTR_BASEMONEY ; 2 + const TRNATTR_AI_MOVE_WEIGHTS ; 3 + const TRNATTR_AI2 ; 4 + const TRNATTR_AI_ITEM_SWITCH ; 5 + const TRNATTR_AI4 ; 6 NUM_TRAINER_ATTRIBUTES EQU const_value ; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags) diff --git a/data/maps/outdoor_sprites.asm b/data/maps/outdoor_sprites.asm index 2b0cd89fe..8064a63e9 100644 --- a/data/maps/outdoor_sprites.asm +++ b/data/maps/outdoor_sprites.asm @@ -1,5 +1,5 @@ ; Valid sprite IDs for each map group. -; Maps with permission ROUTE or TOWN can only use these sprites. +; Maps with environment ROUTE or TOWN can only use these sprites. OutdoorSprites: ; 144b8 dw OlivineGroupSprites diff --git a/engine/battle_transition.asm b/engine/battle_transition.asm index 194f7998b..2af113ddd 100644 --- a/engine/battle_transition.asm +++ b/engine/battle_transition.asm @@ -208,10 +208,10 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365) jr nc, .okay set 0, e .okay - ld a, [wPermission] + ld a, [wEnvironment] cp CAVE jr z, .okay2 - cp PERM_5 + cp ENVIRONMENT_5 jr z, .okay2 cp DUNGEON jr z, .okay2 diff --git a/engine/color.asm b/engine/color.asm index e360f101d..ce9e1dfaa 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1310,7 +1310,7 @@ LoadMapPals: jr c, .got_pals ; Which palette group is based on whether we're outside or inside - ld a, [wPermission] + ld a, [wEnvironment] and 7 ld e, a ld d, 0 @@ -1377,7 +1377,7 @@ LoadMapPals: ld a, BANK(UnknOBPals) call FarCopyWRAM - ld a, [wPermission] + ld a, [wEnvironment] cp TOWN jr z, .outside cp ROUTE @@ -1411,7 +1411,7 @@ endr dw .OutdoorColors ; ROUTE dw .IndoorColors ; INDOOR dw .DungeonColors ; CAVE - dw .Perm5Colors ; PERM_5 + dw .Perm5Colors ; ENVIRONMENT_5 dw .IndoorColors ; GATE dw .DungeonColors ; DUNGEON diff --git a/engine/events_2.asm b/engine/events_2.asm index 6a2a79013..dfa3babdd 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -152,7 +152,7 @@ CanUseSweetScent:: ; 97cfd ld hl, StatusFlags bit 5, [hl] jr nz, .no - ld a, [wPermission] + ld a, [wEnvironment] cp CAVE jr z, .ice_check cp DUNGEON diff --git a/engine/events_3.asm b/engine/events_3.asm index 1b4a4f233..873c511ae 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -18,7 +18,7 @@ ReturnFromMapSetupScript:: ; b8000 call .CheckNationalParkGate jr z, .nationalparkgate - call GetMapPermission + call GetMapEnvironment cp GATE jr nz, .not_gate diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 6360178e1..01f3d05d7 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -362,10 +362,10 @@ CheckReplaceKrisSprite: ; 154f7 jr z, .surfing cp PLAYER_SURF_PIKA jr z, .surfing - call GetMapPermission + call GetMapEnvironment cp INDOOR jr z, .checkbiking - cp PERM_5 + cp ENVIRONMENT_5 jr z, .checkbiking cp DUNGEON jr z, .checkbiking diff --git a/engine/overworld.asm b/engine/overworld.asm index 523021c32..a505ecd66 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -112,7 +112,7 @@ GetPlayerSprite: ; 14183 AddMapSprites: ; 141c9 - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .outdoor call AddIndoorSprites @@ -179,7 +179,7 @@ MapCallbackSprites_LoadUsedSpritesGFX: ; 14209 ld c, EMOTE_SHADOW farcall LoadEmote - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap ld c, EMOTE_GRASS_RUSTLE jr z, .outdoor diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index e49d73c1a..9b451d04a 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -308,7 +308,7 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136) ret SpecialCallOnlyWhenOutside: ; 90188 - ld a, [wPermission] + ld a, [wEnvironment] cp TOWN jr z, .outside cp ROUTE diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index e59fb19d8..36dbde84c 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -562,14 +562,14 @@ endr ret .morn_day - ld a, [wPermission] + ld a, [wEnvironment] cp ROUTE jr z, .route cp CAVE jr z, .cave cp DUNGEON jr z, .cave - cp PERM_5 + cp ENVIRONMENT_5 jr z, .perm5 cp GATE jr z, .gate diff --git a/engine/variables.asm b/engine/variables.asm index edc12ac66..1b418ea3c 100755 --- a/engine/variables.asm +++ b/engine/variables.asm @@ -53,7 +53,7 @@ _GetVarAction:: ; 80648 (20:4648) dwb MapGroup, RETVAR_STRBUF2 dwb MapNumber, RETVAR_STRBUF2 dwb .UnownCaught, RETVAR_EXECUTE - dwb wPermission, RETVAR_STRBUF2 + dwb wEnvironment, RETVAR_STRBUF2 dwb .BoxFreeSpace, RETVAR_EXECUTE dwb wBugContestMinsRemaining, RETVAR_STRBUF2 dwb XCoord, RETVAR_STRBUF2 diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index 6dec2ec78..e442aec8e 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -164,14 +164,14 @@ LoadWarpData: ; 1046c6 ret .SaveDigWarp: ; 1046df (41:46df) - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap ret nz ld a, [wNextMapGroup] ld b, a ld a, [wNextMapNumber] ld c, a - call GetAnyMapPermission + call GetAnyMapEnvironment call CheckIndoorMap ret nz ld a, [wPrevMapGroup] @@ -192,14 +192,14 @@ LoadWarpData: ; 1046c6 ret .SetSpawn: ; 104718 (41:4718) - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap ret nz ld a, [wNextMapGroup] ld b, a ld a, [wNextMapNumber] ld c, a - call GetAnyMapPermission + call GetAnyMapEnvironment call CheckIndoorMap ret nz ld a, [wNextMapGroup] diff --git a/event/magnet_train.asm b/event/magnet_train.asm index 567e0392e..3a2f902c2 100755 --- a/event/magnet_train.asm +++ b/event/magnet_train.asm @@ -434,13 +434,13 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld [rSVBK], a ld a, [TimeOfDayPal] push af - ld a, [wPermission] + ld a, [wEnvironment] push af ld a, [TimeOfDay] and $3 ld [TimeOfDayPal], a ld a, $1 - ld [wPermission], a + ld [wEnvironment], a ld b, SCGB_MAPPALS call GetSGBLayout call UpdateTimePals @@ -451,7 +451,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld a, [rOBP1] ld [wOBP1], a pop af - ld [wPermission], a + ld [wEnvironment], a pop af ld [TimeOfDayPal], a pop af diff --git a/event/overworld.asm b/event/overworld.asm index eff2702b2..584617e27 100755 --- a/event/overworld.asm +++ b/event/overworld.asm @@ -571,7 +571,7 @@ FlyFunction: ; ca3b ld de, ENGINE_STORMBADGE call CheckBadge jr c, .nostormbadge - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .outdoors jr .indoors @@ -783,7 +783,7 @@ dig_incave dw .FailDig .CheckCanDig: ; cbb8 - call GetMapPermission + call GetMapEnvironment cp CAVE jr z, .incave cp DUNGEON @@ -905,7 +905,7 @@ TeleportFunction: ; cc61 dw .FailTeleport .TryTeleport: ; cc78 - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .CheckIfSpawnPoint jr .nope @@ -1714,7 +1714,7 @@ BikeFunction: ; d0b3 ret .CheckEnvironment: ; d121 - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .ok cp CAVE diff --git a/home/flag.asm b/home/flag.asm index ddd3eb235..442c811c2 100644 --- a/home/flag.asm +++ b/home/flag.asm @@ -14,7 +14,7 @@ ResetBikeFlags:: ; 2e56 ; 2e5d ResetFlashIfOutOfCave:: ; 2e5d - ld a, [wPermission] + ld a, [wEnvironment] cp $2 jr z, .asm_2e69 cp $1 diff --git a/home/map.asm b/home/map.asm index 11f3fdf83..4171bf9f3 100644 --- a/home/map.asm +++ b/home/map.asm @@ -389,7 +389,7 @@ CheckIndoorMap:: ; 22f4 ret z cp GATE ret z - cp PERM_5 + cp ENVIRONMENT_5 ret ; 2309 @@ -2154,7 +2154,7 @@ GetMapBank:: ; 2c29 GetAnyMapBank:: ; 2c31 push hl push de - ld de, 0 + ld de, MAPHEADER_MAPHEADER2_BANK call GetAnyMapHeaderMember ld a, c pop de @@ -2163,7 +2163,7 @@ GetAnyMapBank:: ; 2c31 ; 2c3d PartiallyCopyMapHeader:: ; 2c3d -; Copy second map header bank, tileset, permission, and second map header address +; Copy second map header bank, tileset, environment, and second map header address ; from the current map's map header. ld a, [hROMBank] push af @@ -2198,18 +2198,18 @@ GetAnyMapBlockdataBank:: ; 2c5b push bc push bc - ld de, 3 ; second map header pointer + ld de, MAPHEADER_MAPHEADER2 call GetAnyMapHeaderMember ld l, c ld h, b pop bc push hl - ld de, 0 ; second map header bank + ld de, MAPHEADER_MAPHEADER2_BANK call GetAnyMapHeaderMember pop hl - ld de, 3 ; blockdata bank + ld de, MAPHEADER_MAPHEADER2 ; blockdata bank add hl, de ld a, c call GetFarByte @@ -2225,7 +2225,7 @@ GetSecondaryMapHeaderPointer:: ; 0x2c7d ; returns the current map's secondary map header pointer in hl. push bc push de - ld de, 3 ; secondary map header pointer (offset within header) + ld de, MAPHEADER_MAPHEADER2 call GetMapHeaderMember ld l, c ld h, b @@ -2234,11 +2234,11 @@ GetSecondaryMapHeaderPointer:: ; 0x2c7d ret ; 2c8a -GetMapPermission:: ; 2c8a +GetMapEnvironment:: ; 2c8a push hl push de push bc - ld de, 2 ; permission + ld de, MAPHEADER_ENVIRONMENT call GetMapHeaderMember ld a, c pop bc @@ -2250,11 +2250,11 @@ GetMapPermission:: ; 2c8a ret ; XXX ; 2c99 -GetAnyMapPermission:: ; 2c99 +GetAnyMapEnvironment:: ; 2c99 push hl push de push bc - ld de, 2 ; permission + ld de, MAPHEADER_ENVIRONMENT call GetAnyMapHeaderMember ld a, c pop bc @@ -2264,7 +2264,7 @@ GetAnyMapPermission:: ; 2c99 ; 2ca7 GetAnyMapTileset:: ; 2ca7 - ld de, 1 ; tileset + ld de, MAPHEADER_TILESET call GetAnyMapHeaderMember ld a, c ret @@ -2276,7 +2276,7 @@ GetWorldMapLocation:: ; 0x2caf push de push bc - ld de, 5 ; landmark + ld de, MAPHEADER_LOCATION call GetAnyMapHeaderMember ld a, c @@ -2289,7 +2289,7 @@ GetWorldMapLocation:: ; 0x2caf GetMapHeaderMusic:: ; 2cbd push hl push bc - ld de, 6 ; music + ld de, MAPHEADER_MUSIC call GetMapHeaderMember ld a, c cp MUSIC_MAHOGANY_MART @@ -2348,7 +2348,7 @@ GetPhoneServiceTimeOfDayByte:: ; 2d0d push hl push bc - ld de, 7 ; phone service and time of day + ld de, MAPHEADER_PALETTE call GetMapHeaderMember ld a, c @@ -2362,7 +2362,7 @@ GetFishingGroup:: ; 2d19 push hl push bc - ld de, 8 ; fishing group + ld de, MAPHEADER_FISHGROUP call GetMapHeaderMember ld a, c diff --git a/maps/map_headers.asm b/maps/map_headers.asm index 3b2607e31..1ea1ba8ce 100644 --- a/maps/map_headers.asm +++ b/maps/map_headers.asm @@ -1,7 +1,7 @@ map_header: macro ;\1: map label ;\2: tileset: a TILESET_* constant -;\3: permission: TOWN, ROUTE, INDOOR, CAVE, PERM_5, GATE, or DUNGEON +;\3: environment: TOWN, ROUTE, INDOOR, CAVE, ENVIRONMENT_5, GATE, or DUNGEON ;\4: location: from constants/landmark_constants.asm ;\5: music: a MUSIC_* constant ;\6: phone service flag: 1 to prevent phone calls diff --git a/tilesets/special_palettes.asm b/tilesets/special_palettes.asm index 4e83c7390..5674d9f80 100644 --- a/tilesets/special_palettes.asm +++ b/tilesets/special_palettes.asm @@ -25,7 +25,7 @@ LoadSpecialMapPalette: ; 494ac ret .ice_path - ld a, [wPermission] ; permission + ld a, [wEnvironment] and $7 cp INDOOR ; Hall of Fame jr z, .do_nothing diff --git a/wram.asm b/wram.asm index b9bae0e3e..a586413b1 100644 --- a/wram.asm +++ b/wram.asm @@ -1935,7 +1935,7 @@ wMetatileStandingX:: db ; d197 wSecondMapHeaderBank:: db ; d198 wTileset:: db ; d199 -wPermission:: db ; d19a +wEnvironment:: db ; d19a wSecondMapHeaderAddr:: dw ; d19b ; width/height are in blocks (2x2 walkable tiles, 4x4 graphics tiles)