Rename "map permissions" to "map environment" (fix #396)

This commit is contained in:
Remy Oukaour 2017-12-24 13:08:38 -05:00
parent 10a1e6c860
commit 20d6c1d876
20 changed files with 70 additions and 57 deletions

View File

@ -3,17 +3,30 @@ MAP_N_A EQU -1
GROUP_NONE EQU 0 GROUP_NONE EQU 0
MAP_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_value SET 1
const TOWN const TOWN
const ROUTE const ROUTE
const INDOOR const INDOOR
const CAVE const CAVE
const PERM_5 const ENVIRONMENT_5
const GATE const GATE
const DUNGEON const DUNGEON
; map palettes (wPermission) ; map palettes (wEnvironment)
const_def const_def
const PALETTE_AUTO const PALETTE_AUTO
const PALETTE_DAY const PALETTE_DAY

View File

@ -680,13 +680,13 @@ NUM_TRAINER_CLASSES EQU __enum__
; TrainerClassAttributes fields (see data/trainers/trainer_attributes.asm) ; TrainerClassAttributes fields (see data/trainers/trainer_attributes.asm)
const_def const_def
const TRNATTR_ITEM1 const TRNATTR_ITEM1 ; 0
const TRNATTR_ITEM2 const TRNATTR_ITEM2 ; 1
const TRNATTR_BASEMONEY const TRNATTR_BASEMONEY ; 2
const TRNATTR_AI_MOVE_WEIGHTS const TRNATTR_AI_MOVE_WEIGHTS ; 3
const TRNATTR_AI2 const TRNATTR_AI2 ; 4
const TRNATTR_AI_ITEM_SWITCH const TRNATTR_AI_ITEM_SWITCH ; 5
const TRNATTR_AI4 const TRNATTR_AI4 ; 6
NUM_TRAINER_ATTRIBUTES EQU const_value NUM_TRAINER_ATTRIBUTES EQU const_value
; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags) ; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags)

View File

@ -1,5 +1,5 @@
; Valid sprite IDs for each map group. ; 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 OutdoorSprites: ; 144b8
dw OlivineGroupSprites dw OlivineGroupSprites

View File

@ -208,10 +208,10 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
jr nc, .okay jr nc, .okay
set 0, e set 0, e
.okay .okay
ld a, [wPermission] ld a, [wEnvironment]
cp CAVE cp CAVE
jr z, .okay2 jr z, .okay2
cp PERM_5 cp ENVIRONMENT_5
jr z, .okay2 jr z, .okay2
cp DUNGEON cp DUNGEON
jr z, .okay2 jr z, .okay2

View File

@ -1310,7 +1310,7 @@ LoadMapPals:
jr c, .got_pals jr c, .got_pals
; Which palette group is based on whether we're outside or inside ; Which palette group is based on whether we're outside or inside
ld a, [wPermission] ld a, [wEnvironment]
and 7 and 7
ld e, a ld e, a
ld d, 0 ld d, 0
@ -1377,7 +1377,7 @@ LoadMapPals:
ld a, BANK(UnknOBPals) ld a, BANK(UnknOBPals)
call FarCopyWRAM call FarCopyWRAM
ld a, [wPermission] ld a, [wEnvironment]
cp TOWN cp TOWN
jr z, .outside jr z, .outside
cp ROUTE cp ROUTE
@ -1411,7 +1411,7 @@ endr
dw .OutdoorColors ; ROUTE dw .OutdoorColors ; ROUTE
dw .IndoorColors ; INDOOR dw .IndoorColors ; INDOOR
dw .DungeonColors ; CAVE dw .DungeonColors ; CAVE
dw .Perm5Colors ; PERM_5 dw .Perm5Colors ; ENVIRONMENT_5
dw .IndoorColors ; GATE dw .IndoorColors ; GATE
dw .DungeonColors ; DUNGEON dw .DungeonColors ; DUNGEON

View File

@ -152,7 +152,7 @@ CanUseSweetScent:: ; 97cfd
ld hl, StatusFlags ld hl, StatusFlags
bit 5, [hl] bit 5, [hl]
jr nz, .no jr nz, .no
ld a, [wPermission] ld a, [wEnvironment]
cp CAVE cp CAVE
jr z, .ice_check jr z, .ice_check
cp DUNGEON cp DUNGEON

View File

@ -18,7 +18,7 @@ ReturnFromMapSetupScript:: ; b8000
call .CheckNationalParkGate call .CheckNationalParkGate
jr z, .nationalparkgate jr z, .nationalparkgate
call GetMapPermission call GetMapEnvironment
cp GATE cp GATE
jr nz, .not_gate jr nz, .not_gate

View File

@ -362,10 +362,10 @@ CheckReplaceKrisSprite: ; 154f7
jr z, .surfing jr z, .surfing
cp PLAYER_SURF_PIKA cp PLAYER_SURF_PIKA
jr z, .surfing jr z, .surfing
call GetMapPermission call GetMapEnvironment
cp INDOOR cp INDOOR
jr z, .checkbiking jr z, .checkbiking
cp PERM_5 cp ENVIRONMENT_5
jr z, .checkbiking jr z, .checkbiking
cp DUNGEON cp DUNGEON
jr z, .checkbiking jr z, .checkbiking

View File

@ -112,7 +112,7 @@ GetPlayerSprite: ; 14183
AddMapSprites: ; 141c9 AddMapSprites: ; 141c9
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
jr z, .outdoor jr z, .outdoor
call AddIndoorSprites call AddIndoorSprites
@ -179,7 +179,7 @@ MapCallbackSprites_LoadUsedSpritesGFX: ; 14209
ld c, EMOTE_SHADOW ld c, EMOTE_SHADOW
farcall LoadEmote farcall LoadEmote
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
ld c, EMOTE_GRASS_RUSTLE ld c, EMOTE_GRASS_RUSTLE
jr z, .outdoor jr z, .outdoor

View File

@ -308,7 +308,7 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136)
ret ret
SpecialCallOnlyWhenOutside: ; 90188 SpecialCallOnlyWhenOutside: ; 90188
ld a, [wPermission] ld a, [wEnvironment]
cp TOWN cp TOWN
jr z, .outside jr z, .outside
cp ROUTE cp ROUTE

View File

@ -562,14 +562,14 @@ endr
ret ret
.morn_day .morn_day
ld a, [wPermission] ld a, [wEnvironment]
cp ROUTE cp ROUTE
jr z, .route jr z, .route
cp CAVE cp CAVE
jr z, .cave jr z, .cave
cp DUNGEON cp DUNGEON
jr z, .cave jr z, .cave
cp PERM_5 cp ENVIRONMENT_5
jr z, .perm5 jr z, .perm5
cp GATE cp GATE
jr z, .gate jr z, .gate

View File

@ -53,7 +53,7 @@ _GetVarAction:: ; 80648 (20:4648)
dwb MapGroup, RETVAR_STRBUF2 dwb MapGroup, RETVAR_STRBUF2
dwb MapNumber, RETVAR_STRBUF2 dwb MapNumber, RETVAR_STRBUF2
dwb .UnownCaught, RETVAR_EXECUTE dwb .UnownCaught, RETVAR_EXECUTE
dwb wPermission, RETVAR_STRBUF2 dwb wEnvironment, RETVAR_STRBUF2
dwb .BoxFreeSpace, RETVAR_EXECUTE dwb .BoxFreeSpace, RETVAR_EXECUTE
dwb wBugContestMinsRemaining, RETVAR_STRBUF2 dwb wBugContestMinsRemaining, RETVAR_STRBUF2
dwb XCoord, RETVAR_STRBUF2 dwb XCoord, RETVAR_STRBUF2

View File

@ -164,14 +164,14 @@ LoadWarpData: ; 1046c6
ret ret
.SaveDigWarp: ; 1046df (41:46df) .SaveDigWarp: ; 1046df (41:46df)
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
ret nz ret nz
ld a, [wNextMapGroup] ld a, [wNextMapGroup]
ld b, a ld b, a
ld a, [wNextMapNumber] ld a, [wNextMapNumber]
ld c, a ld c, a
call GetAnyMapPermission call GetAnyMapEnvironment
call CheckIndoorMap call CheckIndoorMap
ret nz ret nz
ld a, [wPrevMapGroup] ld a, [wPrevMapGroup]
@ -192,14 +192,14 @@ LoadWarpData: ; 1046c6
ret ret
.SetSpawn: ; 104718 (41:4718) .SetSpawn: ; 104718 (41:4718)
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
ret nz ret nz
ld a, [wNextMapGroup] ld a, [wNextMapGroup]
ld b, a ld b, a
ld a, [wNextMapNumber] ld a, [wNextMapNumber]
ld c, a ld c, a
call GetAnyMapPermission call GetAnyMapEnvironment
call CheckIndoorMap call CheckIndoorMap
ret nz ret nz
ld a, [wNextMapGroup] ld a, [wNextMapGroup]

View File

@ -434,13 +434,13 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
ld [rSVBK], a ld [rSVBK], a
ld a, [TimeOfDayPal] ld a, [TimeOfDayPal]
push af push af
ld a, [wPermission] ld a, [wEnvironment]
push af push af
ld a, [TimeOfDay] ld a, [TimeOfDay]
and $3 and $3
ld [TimeOfDayPal], a ld [TimeOfDayPal], a
ld a, $1 ld a, $1
ld [wPermission], a ld [wEnvironment], a
ld b, SCGB_MAPPALS ld b, SCGB_MAPPALS
call GetSGBLayout call GetSGBLayout
call UpdateTimePals call UpdateTimePals
@ -451,7 +451,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
ld a, [rOBP1] ld a, [rOBP1]
ld [wOBP1], a ld [wOBP1], a
pop af pop af
ld [wPermission], a ld [wEnvironment], a
pop af pop af
ld [TimeOfDayPal], a ld [TimeOfDayPal], a
pop af pop af

View File

@ -571,7 +571,7 @@ FlyFunction: ; ca3b
ld de, ENGINE_STORMBADGE ld de, ENGINE_STORMBADGE
call CheckBadge call CheckBadge
jr c, .nostormbadge jr c, .nostormbadge
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
jr z, .outdoors jr z, .outdoors
jr .indoors jr .indoors
@ -783,7 +783,7 @@ dig_incave
dw .FailDig dw .FailDig
.CheckCanDig: ; cbb8 .CheckCanDig: ; cbb8
call GetMapPermission call GetMapEnvironment
cp CAVE cp CAVE
jr z, .incave jr z, .incave
cp DUNGEON cp DUNGEON
@ -905,7 +905,7 @@ TeleportFunction: ; cc61
dw .FailTeleport dw .FailTeleport
.TryTeleport: ; cc78 .TryTeleport: ; cc78
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
jr z, .CheckIfSpawnPoint jr z, .CheckIfSpawnPoint
jr .nope jr .nope
@ -1714,7 +1714,7 @@ BikeFunction: ; d0b3
ret ret
.CheckEnvironment: ; d121 .CheckEnvironment: ; d121
call GetMapPermission call GetMapEnvironment
call CheckOutdoorMap call CheckOutdoorMap
jr z, .ok jr z, .ok
cp CAVE cp CAVE

View File

@ -14,7 +14,7 @@ ResetBikeFlags:: ; 2e56
; 2e5d ; 2e5d
ResetFlashIfOutOfCave:: ; 2e5d ResetFlashIfOutOfCave:: ; 2e5d
ld a, [wPermission] ld a, [wEnvironment]
cp $2 cp $2
jr z, .asm_2e69 jr z, .asm_2e69
cp $1 cp $1

View File

@ -389,7 +389,7 @@ CheckIndoorMap:: ; 22f4
ret z ret z
cp GATE cp GATE
ret z ret z
cp PERM_5 cp ENVIRONMENT_5
ret ret
; 2309 ; 2309
@ -2154,7 +2154,7 @@ GetMapBank:: ; 2c29
GetAnyMapBank:: ; 2c31 GetAnyMapBank:: ; 2c31
push hl push hl
push de push de
ld de, 0 ld de, MAPHEADER_MAPHEADER2_BANK
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
ld a, c ld a, c
pop de pop de
@ -2163,7 +2163,7 @@ GetAnyMapBank:: ; 2c31
; 2c3d ; 2c3d
PartiallyCopyMapHeader:: ; 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. ; from the current map's map header.
ld a, [hROMBank] ld a, [hROMBank]
push af push af
@ -2198,18 +2198,18 @@ GetAnyMapBlockdataBank:: ; 2c5b
push bc push bc
push bc push bc
ld de, 3 ; second map header pointer ld de, MAPHEADER_MAPHEADER2
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
ld l, c ld l, c
ld h, b ld h, b
pop bc pop bc
push hl push hl
ld de, 0 ; second map header bank ld de, MAPHEADER_MAPHEADER2_BANK
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
pop hl pop hl
ld de, 3 ; blockdata bank ld de, MAPHEADER_MAPHEADER2 ; blockdata bank
add hl, de add hl, de
ld a, c ld a, c
call GetFarByte call GetFarByte
@ -2225,7 +2225,7 @@ GetSecondaryMapHeaderPointer:: ; 0x2c7d
; returns the current map's secondary map header pointer in hl. ; returns the current map's secondary map header pointer in hl.
push bc push bc
push de push de
ld de, 3 ; secondary map header pointer (offset within header) ld de, MAPHEADER_MAPHEADER2
call GetMapHeaderMember call GetMapHeaderMember
ld l, c ld l, c
ld h, b ld h, b
@ -2234,11 +2234,11 @@ GetSecondaryMapHeaderPointer:: ; 0x2c7d
ret ret
; 2c8a ; 2c8a
GetMapPermission:: ; 2c8a GetMapEnvironment:: ; 2c8a
push hl push hl
push de push de
push bc push bc
ld de, 2 ; permission ld de, MAPHEADER_ENVIRONMENT
call GetMapHeaderMember call GetMapHeaderMember
ld a, c ld a, c
pop bc pop bc
@ -2250,11 +2250,11 @@ GetMapPermission:: ; 2c8a
ret ; XXX ret ; XXX
; 2c99 ; 2c99
GetAnyMapPermission:: ; 2c99 GetAnyMapEnvironment:: ; 2c99
push hl push hl
push de push de
push bc push bc
ld de, 2 ; permission ld de, MAPHEADER_ENVIRONMENT
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
ld a, c ld a, c
pop bc pop bc
@ -2264,7 +2264,7 @@ GetAnyMapPermission:: ; 2c99
; 2ca7 ; 2ca7
GetAnyMapTileset:: ; 2ca7 GetAnyMapTileset:: ; 2ca7
ld de, 1 ; tileset ld de, MAPHEADER_TILESET
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
ld a, c ld a, c
ret ret
@ -2276,7 +2276,7 @@ GetWorldMapLocation:: ; 0x2caf
push de push de
push bc push bc
ld de, 5 ; landmark ld de, MAPHEADER_LOCATION
call GetAnyMapHeaderMember call GetAnyMapHeaderMember
ld a, c ld a, c
@ -2289,7 +2289,7 @@ GetWorldMapLocation:: ; 0x2caf
GetMapHeaderMusic:: ; 2cbd GetMapHeaderMusic:: ; 2cbd
push hl push hl
push bc push bc
ld de, 6 ; music ld de, MAPHEADER_MUSIC
call GetMapHeaderMember call GetMapHeaderMember
ld a, c ld a, c
cp MUSIC_MAHOGANY_MART cp MUSIC_MAHOGANY_MART
@ -2348,7 +2348,7 @@ GetPhoneServiceTimeOfDayByte:: ; 2d0d
push hl push hl
push bc push bc
ld de, 7 ; phone service and time of day ld de, MAPHEADER_PALETTE
call GetMapHeaderMember call GetMapHeaderMember
ld a, c ld a, c
@ -2362,7 +2362,7 @@ GetFishingGroup:: ; 2d19
push hl push hl
push bc push bc
ld de, 8 ; fishing group ld de, MAPHEADER_FISHGROUP
call GetMapHeaderMember call GetMapHeaderMember
ld a, c ld a, c

View File

@ -1,7 +1,7 @@
map_header: macro map_header: macro
;\1: map label ;\1: map label
;\2: tileset: a TILESET_* constant ;\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 ;\4: location: from constants/landmark_constants.asm
;\5: music: a MUSIC_* constant ;\5: music: a MUSIC_* constant
;\6: phone service flag: 1 to prevent phone calls ;\6: phone service flag: 1 to prevent phone calls

View File

@ -25,7 +25,7 @@ LoadSpecialMapPalette: ; 494ac
ret ret
.ice_path .ice_path
ld a, [wPermission] ; permission ld a, [wEnvironment]
and $7 and $7
cp INDOOR ; Hall of Fame cp INDOOR ; Hall of Fame
jr z, .do_nothing jr z, .do_nothing

View File

@ -1935,7 +1935,7 @@ wMetatileStandingX:: db ; d197
wSecondMapHeaderBank:: db ; d198 wSecondMapHeaderBank:: db ; d198
wTileset:: db ; d199 wTileset:: db ; d199
wPermission:: db ; d19a wEnvironment:: db ; d19a
wSecondMapHeaderAddr:: dw ; d19b wSecondMapHeaderAddr:: dw ; d19b
; width/height are in blocks (2x2 walkable tiles, 4x4 graphics tiles) ; width/height are in blocks (2x2 walkable tiles, 4x4 graphics tiles)