ref: 115fba107d6e319e2a047a17f5c0dfca723a8d05
parent: 1a5a108bdf6904423bfa80cc7bcb5582331740cb
parent: 28dc5686b05477e13a9cc078975315140bee9800
author: luckytyphlosion <alan.rj.huang@gmail.com>
date: Sun Jan 3 09:21:56 EST 2016
Merge pull request #120 from PikalaxALT/master Fix game time labels, wCurrentMapScriptFlags
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -224,12 +224,12 @@
ld de, HoFPlayTimeText
call PlaceString
coord hl, 5, 7
- ld de, wPlayTimeHours + 1
+ ld de, wPlayTimeHours
lb bc, 1, 3
call PrintNumber
ld [hl], $6d
inc hl
- ld de, wPlayTimeMinutes + 1
+ ld de, wPlayTimeMinutes
lb bc, LEADING_ZEROES | 1, 2
call PrintNumber
coord hl, 1, 9
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -402,7 +402,7 @@
.openSecondLock
; Completed the trash can puzzle.
SetEvent EVENT_2ND_LOCK_OPENED
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 6, [hl]
tx_pre_id VermilionGymTrashSuccesText3
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -199,7 +199,7 @@
ld a, [wCurrentMenuItem]
cp c
jr nz, .wrongAnswer
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, [hGymGateIndex]
ld [$ffe0], a
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -90,7 +90,7 @@
jp .mainMenuLoop
.choseContinue
call DisplayContinueGameInfo
- ld hl,wd126
+ ld hl,wCurrentMapScriptFlags
set 5,[hl]
.inputLoop
xor a
@@ -411,12 +411,12 @@
jp PrintNumber
PrintPlayTime: ; 5e55 (1:5e55)
- ld de, wPlayTimeHours + 1
+ ld de, wPlayTimeHours
lb bc, 1, 3
call PrintNumber
ld [hl], $6d
inc hl
- ld de, wPlayTimeMinutes + 1
+ ld de, wPlayTimeMinutes
lb bc, LEADING_ZEROES | 1, 2
jp PrintNumber
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -601,12 +601,12 @@
ld c,$e3
call PrintBCDNumber
coord hl, 9, 6
- ld de,wPlayTimeHours + 1 ; hours
+ ld de,wPlayTimeHours ; hours
lb bc, LEFT_ALIGN | 1, 3
call PrintNumber
ld [hl],$d6 ; colon tile ID
inc hl
- ld de,wPlayTimeMinutes + 1 ; minutes
+ ld de,wPlayTimeMinutes ; minutes
lb bc, LEADING_ZEROES | 1, 2
jp PrintNumber
--- a/engine/overworld/card_key.asm
+++ b/engine/overworld/card_key.asm
@@ -49,7 +49,7 @@
.replaceCardKeyDoorTileBlock
ld [wNewTileBlockID], a
predef ReplaceTileBlock
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, SFX_GO_INSIDE
jp PlaySound
--- a/engine/play_time.asm
+++ b/engine/play_time.asm
@@ -3,7 +3,7 @@
ld a, [wd732]
bit 0, a
ret z
- ld a, [wPlayTimeMinutes]
+ ld a, [wPlayTimeMaxed]
and a
ret nz
ld a, [wPlayTimeFrames]
@@ -20,20 +20,20 @@
ret nz
xor a
ld [wPlayTimeSeconds], a
- ld a, [wPlayTimeMinutes + 1]
+ ld a, [wPlayTimeMinutes]
inc a
- ld [wPlayTimeMinutes + 1], a
+ ld [wPlayTimeMinutes], a
cp 60
ret nz
xor a
- ld [wPlayTimeMinutes + 1], a
- ld a, [wPlayTimeHours + 1]
+ ld [wPlayTimeMinutes], a
+ ld a, [wPlayTimeHours]
inc a
- ld [wPlayTimeHours + 1], a
+ ld [wPlayTimeHours], a
cp $ff
ret nz
ld a, $ff
- ld [wPlayTimeMinutes], a
+ ld [wPlayTimeMaxed], a
ret
CountDownIgnoreInputBitReset: ; 18e36 (6:4e36)
--- a/engine/predefs7.asm
+++ b/engine/predefs7.asm
@@ -19,7 +19,7 @@
ld a, b
ld [wListScrollOffset], a
ret c
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 7, [hl]
ld hl, wElevatorWarpMaps
ld a, [wWhichPokemon]
--- a/home.asm
+++ b/home.asm
@@ -2379,7 +2379,7 @@
ret
EndTrainerBattle:: ; 3275 (0:3275)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
set 6, [hl]
ld hl, wd72d
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -32,7 +32,7 @@
ld hl, wd72d
res 5, [hl]
call UpdateSprites
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
set 6, [hl]
xor a
@@ -317,7 +317,7 @@
res 6,[hl]
ld hl,wFlags_D733
res 3,[hl]
- ld hl,wd126
+ ld hl,wCurrentMapScriptFlags
set 5,[hl]
set 6,[hl]
xor a
--- a/scripts/agatha.asm
+++ b/scripts/agatha.asm
@@ -10,7 +10,7 @@
AgathaShowOrHideExitBlock: ; 76443 (1d:6443)
; Blocks or clears the exit to the next room.
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/bruno.asm
+++ b/scripts/bruno.asm
@@ -10,7 +10,7 @@
BrunoShowOrHideExitBlock: ; 762ec (1d:62ec)
; Blocks or clears the exit to the next room.
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/celadongamecorner.asm
+++ b/scripts/celadongamecorner.asm
@@ -7,7 +7,7 @@
jp CallFunctionInTable
CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
ret z
@@ -24,7 +24,7 @@
ret
CeladonGameCornerScript_48bec: ; 48bec (12:4bec)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -109,7 +109,7 @@
ld a, HS_GAME_CORNER_ROCKET
ld [wMissableObjectIndex], a
predef HideObject
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
set 6, [hl]
ld a, $0
--- a/scripts/celadongym.asm
+++ b/scripts/celadongym.asm
@@ -1,5 +1,5 @@
CeladonGymScript: ; 4890a (12:490a)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
call nz, CeladonGymScript_48927
--- a/scripts/celadonmartelevator.asm
+++ b/scripts/celadonmartelevator.asm
@@ -1,5 +1,5 @@
CeladonMartElevatorScript: ; 48600 (12:4600)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
push hl
--- a/scripts/ceruleangym.asm
+++ b/scripts/ceruleangym.asm
@@ -1,5 +1,5 @@
CeruleanGymScript: ; 5c6b3 (17:46b3)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
call nz, CeruleanGymScript_5c6d0
--- a/scripts/cinnabargym.asm
+++ b/scripts/cinnabargym.asm
@@ -6,7 +6,7 @@
jp CallFunctionInTable
CinnabarGymScript_75759: ; 75759 (1d:5759)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
push hl
@@ -165,7 +165,7 @@
; deactivate gym trainers
SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
jp CinnabarGymScript_75792
--- a/scripts/cinnabarisland.asm
+++ b/scripts/cinnabarisland.asm
@@ -1,6 +1,6 @@
CinnabarIslandScript: ; 1ca19 (7:4a19)
call EnableAutoTextBoxDrawing
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ResetEvent EVENT_MANSION_SWITCH_ON
ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL
--- a/scripts/fuchsiagym.asm
+++ b/scripts/fuchsiagym.asm
@@ -9,7 +9,7 @@
ret
FuchsiaGymScript_75453: ; 75453 (1d:5453)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
ret z
--- a/scripts/indigoplateaulobby.asm
+++ b/scripts/indigoplateaulobby.asm
@@ -1,7 +1,7 @@
IndigoPlateauLobbyScript: ; 19c5b (6:5c5b)
call Serial_TryEstablishingExternallyClockedConnection
call EnableAutoTextBoxDrawing
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
ret z
--- a/scripts/lance.asm
+++ b/scripts/lance.asm
@@ -9,7 +9,7 @@
ret
LanceShowOrHideEntranceBlocks: ; 5a2c4 (16:62c4)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -71,7 +71,7 @@
jr z, WalkToLance
CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR
ret nz
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, SFX_GO_INSIDE
call PlaySound
--- a/scripts/lorelei.asm
+++ b/scripts/lorelei.asm
@@ -10,7 +10,7 @@
LoreleiShowOrHideExitBlock: ; 76191 (1d:6191)
; Blocks or clears the exit to the next room.
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/mansion1.asm
+++ b/scripts/mansion1.asm
@@ -9,7 +9,7 @@
ret
Mansion1Subscript1: ; 442c5 (11:42c5)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -106,7 +106,7 @@
jr nz, .asm_4438c
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld hl, MansionSwitchPressedText
call PrintText
--- a/scripts/mansion2.asm
+++ b/scripts/mansion2.asm
@@ -9,7 +9,7 @@
ret
Mansion2Script_51fee: ; 51fee (14:5fee)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -112,7 +112,7 @@
jr nz, .asm_520b9
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld hl, Mansion2Text_520c7
call PrintText
--- a/scripts/mansion3.asm
+++ b/scripts/mansion3.asm
@@ -9,7 +9,7 @@
ret
Mansion3Script_52204: ; 52204 (14:6204)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/mansion4.asm
+++ b/scripts/mansion4.asm
@@ -9,7 +9,7 @@
ret
Mansion4Script_523cf: ; 523cf (14:63cf)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/pewtergym.asm
+++ b/scripts/pewtergym.asm
@@ -1,5 +1,5 @@
PewterGymScript: ; 5c387 (17:4387)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
call nz, PewterGymScript_5c3a4
--- a/scripts/rockethideout1.asm
+++ b/scripts/rockethideout1.asm
@@ -9,7 +9,7 @@
ret
RocketHideout1Script_44be0: ; 44be0 (11:4be0)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/rockethideout4.asm
+++ b/scripts/rockethideout4.asm
@@ -9,7 +9,7 @@
ret
RocketHideout4Script_45473: ; 45473 (11:5473)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -65,7 +65,7 @@
call GBFadeInFromBlack
xor a
ld [wJoyIgnore], a
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, $0
ld [wRocketHideout4CurScript], a
--- a/scripts/rockethideoutelevator.asm
+++ b/scripts/rockethideoutelevator.asm
@@ -1,5 +1,5 @@
RocketHideoutElevatorScript: ; 45710 (11:5710)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
push hl
--- a/scripts/route23.asm
+++ b/scripts/route23.asm
@@ -6,7 +6,7 @@
jp CallFunctionInTable
Route23Script_511e9: ; 511e9 (14:51e9)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
ret z
--- a/scripts/route25.asm
+++ b/scripts/route25.asm
@@ -9,7 +9,7 @@
ret
Route25Script_515e1: ; 515e1 (14:55e1)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
ret z
--- a/scripts/saffrongym.asm
+++ b/scripts/saffrongym.asm
@@ -1,5 +1,5 @@
SaffronGymScript: ; 5d00d (17:500d)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
call nz, .extra
--- a/scripts/silphco10.asm
+++ b/scripts/silphco10.asm
@@ -9,7 +9,7 @@
ret
SilphCo10Script_5a14f: ; 5a14f (16:614f)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco11.asm
+++ b/scripts/silphco11.asm
@@ -9,7 +9,7 @@
ret
SilphCo11Script_62110: ; 62110 (18:6110)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco2.asm
+++ b/scripts/silphco2.asm
@@ -9,7 +9,7 @@
ret
SilphCo2Script_59d07: ; 59d07 (16:5d07)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco3.asm
+++ b/scripts/silphco3.asm
@@ -9,7 +9,7 @@
ret
SilphCo3Script_59f71: ; 59f71 (16:5f71)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco4.asm
+++ b/scripts/silphco4.asm
@@ -9,7 +9,7 @@
ret
SilphCo4Script_19d21: ; 19d21 (6:5d21)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco5.asm
+++ b/scripts/silphco5.asm
@@ -9,7 +9,7 @@
ret
SilphCo5Script_19f4d: ; 19f4d (6:5f4d)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco6.asm
+++ b/scripts/silphco6.asm
@@ -9,7 +9,7 @@
ret
SilphCo6Script_1a1bf: ; 1a1bf (6:61bf)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco7.asm
+++ b/scripts/silphco7.asm
@@ -9,7 +9,7 @@
ret
SilphCo7Script_51b77: ; 51b77 (14:5b77)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco8.asm
+++ b/scripts/silphco8.asm
@@ -9,7 +9,7 @@
ret
SilphCo8Script_5651a: ; 5651a (15:651a)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphco9.asm
+++ b/scripts/silphco9.asm
@@ -9,7 +9,7 @@
ret
SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
--- a/scripts/silphcoelevator.asm
+++ b/scripts/silphcoelevator.asm
@@ -1,5 +1,5 @@
SilphCoElevatorScript: ; 457c0 (11:57c0)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
push hl
--- a/scripts/vermilioncity.asm
+++ b/scripts/vermilioncity.asm
@@ -1,6 +1,6 @@
VermilionCityScript: ; 197a1 (6:57a1)
call EnableAutoTextBoxDrawing
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
push hl
--- a/scripts/vermiliongym.asm
+++ b/scripts/vermiliongym.asm
@@ -1,5 +1,5 @@
VermilionGymScript: ; 5ca26 (17:4a26)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
push hl
--- a/scripts/victoryroad1.asm
+++ b/scripts/victoryroad1.asm
@@ -1,5 +1,5 @@
VictoryRoad1Script: ; 5da0a (17:5a0a)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
call nz, .next
@@ -29,7 +29,7 @@
ld hl, CoordsData_5da5c
call CheckBoulderCoords
jp nc, CheckFightingMapTrainers
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
SetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH
ret
--- a/scripts/victoryroad2.asm
+++ b/scripts/victoryroad2.asm
@@ -1,9 +1,9 @@
VictoryRoad2Script: ; 5179d (14:579d)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 6, [hl]
res 6, [hl]
call nz, VictoryRoad2Script_517c4
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
call nz, VictoryRoad2Script_517c9
@@ -59,7 +59,7 @@
SetEventReuseHL EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2
ret nz
.asm_51810
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ret
--- a/scripts/victoryroad3.asm
+++ b/scripts/victoryroad3.asm
@@ -9,7 +9,7 @@
ret
VictoryRoad3Script_44996: ; 44996 (11:4996)
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
@@ -36,7 +36,7 @@
ld a, [wCoordIndex]
cp $1
jr nz, .asm_449dc
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
SetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1
ret
--- a/wram.asm
+++ b/wram.asm
@@ -2118,7 +2118,7 @@
wTextBoxID:: ; d125
ds 1
-wd126:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value
+wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value
wCurEnemyLVL:: ; d127
ds 1
@@ -2308,7 +2308,7 @@
ds 1
wObtainedBadges:: ; d356
- ds 1
+ flag_array 8
ds 1
@@ -3107,12 +3107,14 @@
; mostly copied from map-specific map script pointer and wirtten back later
ds 1
- ds 6
+ ds 7
-wPlayTimeHours:: ; da40
- ds 2
-wPlayTimeMinutes:: ; da42
- ds 2
+wPlayTimeHours:: ; da41
+ ds 1
+wPlayTimeMaxed:: ; da42
+ ds 1
+wPlayTimeMinutes:: ; da43
+ ds 1
wPlayTimeSeconds:: ; da44
ds 1
wPlayTimeFrames:: ; da45