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
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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)