Move some gfx files around, also clock reset fn

This commit is contained in:
PikalaxALT 2015-11-10 11:05:26 -05:00
parent d8cd991b35
commit ba05bfeafe
15 changed files with 511 additions and 489 deletions

View File

@ -3922,7 +3922,7 @@ TryToRunAwayFromBattle: ; 3d8b3
ld a, [BattleMonItem] ld a, [BattleMonItem]
ld [wd265], a ld [wd265], a
ld b, a ld b, a
callab GetItem callab GetItemHeldEffect
ld a, b ld a, b
cp HELD_ESCAPE cp HELD_ESCAPE
pop de pop de
@ -4576,9 +4576,9 @@ UseOpponentItem:
call RefreshBattleHuds call RefreshBattleHuds
callab GetOpponentItem callab GetOpponentItem
ld a, [hl] ld a, [hl]
ld [wd265], a ld [wNamedObjectIndexBuffer], a
call GetItemName call GetItemName
callab Function27192 callab ConsumeHeldItem
ld hl, RecoveredUsingText ld hl, RecoveredUsingText
jp StdBattleTextBox jp StdBattleTextBox
; 3ddc8 ; 3ddc8
@ -4741,7 +4741,7 @@ HandleStatBoostingHeldItems: ; 3de97
push bc push bc
ld a, [bc] ld a, [bc]
ld b, a ld b, a
callab GetItem callab GetItemHeldEffect
ld hl, .StatUpItems ld hl, .StatUpItems
.loop .loop
ld a, [hli] ld a, [hli]
@ -5595,7 +5595,7 @@ BattleMenu_Run: ; 3e489
CheckAmuletCoin: ; 3e4a8 CheckAmuletCoin: ; 3e4a8
ld a, [BattleMonItem] ld a, [BattleMonItem]
ld b, a ld b, a
callab GetItem callab GetItemHeldEffect
ld a, b ld a, b
cp HELD_AMULET_COIN cp HELD_AMULET_COIN
ret nz ret nz
@ -7247,12 +7247,12 @@ BoostStat: ; 3ed7c
Function3ed9f: ; 3ed9f Function3ed9f: ; 3ed9f
callab Functionfb4f2 callab LoadBattleFontsHPBar
ret ret
; 3eda6 ; 3eda6
Function3eda6: ; 3eda6 Function3eda6: ; 3eda6
callab Functionfb50d callab LoadHPBar
ret ret
; 3edad ; 3edad

View File

@ -2996,11 +2996,11 @@ SpeciesItemBoost: ; 353d1
pop hl pop hl
cp b cp b
jr z, .GetItem jr z, .GetItemHeldEffect
cp c cp c
ret nz ret nz
.GetItem .GetItemHeldEffect
push hl push hl
call GetUserItem call GetUserItem
ld a, [hl] ld a, [hl]
@ -9679,7 +9679,7 @@ GetUserItem: ; 37db2
ld hl, EnemyMonItem ld hl, EnemyMonItem
.go .go
ld b, [hl] ld b, [hl]
jp GetItem jp GetItemHeldEffect
; 37dc1 ; 37dc1
@ -9692,11 +9692,11 @@ GetOpponentItem: ; 37dc1
ld hl, BattleMonItem ld hl, BattleMonItem
.go .go
ld b, [hl] ld b, [hl]
jp GetItem jp GetItemHeldEffect
; 37dd0 ; 37dd0
GetItem: ; 37dd0 GetItemHeldEffect: ; 37dd0
; Return the effect of item b in bc. ; Return the effect of item b in bc.
ld a, b ld a, b
and a and a

View File

@ -318,6 +318,7 @@ const_value SET 30
const HELD_SP_DEFENSE_UP const HELD_SP_DEFENSE_UP
const HELD_ACCURACY_UP const HELD_ACCURACY_UP
const HELD_EVASION_UP const HELD_EVASION_UP
const HELD_38
const_value SET 40 const_value SET 40
const HELD_40 const HELD_40

251
engine/clock_reset.asm Executable file
View File

@ -0,0 +1,251 @@
ResetClock_GetWraparoundTime: ; 20000 (8:4000)
push hl
dec a
ld e, a
ld d, 0
ld hl, .WrapAroundTimes
rept 4
add hl, de
endr
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld b, [hl]
inc hl
ld c, [hl]
pop hl
ret
; 20015 (8:4015)
.WrapAroundTimes: ; 20015
dw Buffer4
db 7, 4
dw Buffer5
db 24, 12
dw Buffer6
db 60, 15
; 20021
RestartClock: ; 20021 (8:4021)
; If we're here, we had an RTC overflow.
ld hl, .Text_ClockTimeMayBeWrong
call PrintText
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
call LoadPartyMenuDataHeader
call ClearTileMap
ld hl, .Text_SetWithControlPad
call PrintText
call .SetClock
call ExitMenu
pop bc
ld hl, Options
ld [hl], b
ld c, a
ret
; 20047 (8:4047)
.Text_ClockTimeMayBeWrong: ; 0x20047
; The clock's time may be wrong. Please reset the time.
text_jump UnknownText_0x1c40e6
db "@"
; 0x2004c
.Text_SetWithControlPad: ; 0x2004c
; Set with the Control Pad. Confirm: A Button Cancel: B Button
text_jump UnknownText_0x1c411c
db "@"
; 0x20051
.SetClock: ; 20051 (8:4051)
ld a, 1
ld [Buffer1], a ; which digit
ld [Buffer2], a ; wd1eb (aliases: MovementType)
ld a, 8
ld [Buffer3], a
call UpdateTime
call GetWeekday
ld [Buffer4], a
ld a, [hHours] ; $ff00+$94
ld [Buffer5], a
ld a, [hMinutes] ; $ff00+$96
ld [Buffer6], a
.loop
call .joy_loop
jr nc, .loop
and a
ret nz
call .PrintTime
ld hl, .Text_IsThisOK
call PrintText
call YesNoBox
jr c, .cancel
ld a, [Buffer4]
ld [StringBuffer2], a
ld a, [Buffer5]
ld [StringBuffer2 + 1], a
ld a, [Buffer6]
ld [StringBuffer2 + 2], a
xor a
ld [StringBuffer2 + 3], a
call Function677
call .PrintTime
ld hl, .Text_ClockReset
call PrintText
call Functiona80
xor a
ret
.cancel
ld a, $1
ret
; 200b0 (8:40b0)
.Text_IsThisOK: ; 0x200b0
; Is this OK?
text_jump UnknownText_0x1c415b
db "@"
; 0x200b5
.Text_ClockReset: ; 0x200b5
; The clock has been reset.
text_jump UnknownText_0x1c4168
db "@"
; 0x200ba
.joy_loop
call Function354b
ld c, a
push af
call .PrintTime
pop af
bit 0, a
jr nz, .press_A
bit 1, a
jr nz, .press_B
bit 6, a
jr nz, .pressed_up
bit 7, a
jr nz, .pressed_down
bit 5, a
jr nz, .pressed_left
bit 4, a
jr nz, .pressed_right
jr .joy_loop
.press_A
ld a, $0
scf
ret
.press_B
ld a, $1
scf
ret
.pressed_up
ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
call ResetClock_GetWraparoundTime
ld a, [de]
inc a
ld [de], a
cp b
jr c, .done_scroll
ld a, $0
ld [de], a
jr .done_scroll
.pressed_down
ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
call ResetClock_GetWraparoundTime
ld a, [de]
dec a
ld [de], a
cp -1
jr nz, .done_scroll
ld a, b
dec a
ld [de], a
jr .done_scroll
.pressed_left
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
dec [hl]
jr nz, .done_scroll
ld [hl], $3
jr .done_scroll
.pressed_right
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
inc [hl]
ld a, [hl]
cp $4
jr c, .done_scroll
ld [hl], $1
.done_scroll
xor a
ret
.PrintTime: ; 2011f (8:411f)
hlcoord 0, 5
ld b, 5
ld c, 18
call TextBox
decoord 1, 8
ld a, [Buffer4]
ld b, a
callba PrintDayOfWeek
ld a, [Buffer5]
ld b, a
ld a, [Buffer6]
ld c, a
decoord 11, 8
callba PrintHoursMins
ld a, [Buffer2] ; wd1eb (aliases: MovementType)
lb de, " ", " "
call .PlaceChars
ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
lb de, "▲", "▼"
call .PlaceChars
ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
ld [Buffer2], a ; wd1eb (aliases: MovementType)
ret
; 20160 (8:4160)
.unreferenced: ; 20160
ld a, [Buffer3]
ld b, a
call GetTileCoord
ret
; 20168
.PlaceChars: ; 20168 (8:4168)
push de
call ResetClock_GetWraparoundTime
ld a, [Buffer3]
dec a
ld b, a
call GetTileCoord
pop de
ld [hl], d
ld bc, 2 * SCREEN_WIDTH
add hl, bc
ld [hl], e
ret
; 2017c (8:417c)
String_2017c: ; 2017c
db "じ@" ; HR
; 2017e
String_2017e: ; 2017e
db "ふん@" ; MIN
; 20181

View File

@ -247,7 +247,7 @@ Function967d1: ; 967d1
Function967e1: ; 967e1 Function967e1: ; 967e1
callba RefreshMapAppearDisappear callba RefreshMapAppearDisappear
callba Functiond4d2 callba Functiond4d2
callba Functionb8098 callba PlaceMapNameSign
ret ret
; 967f4 ; 967f4
@ -328,7 +328,7 @@ PlayerEvents: ; 9681f
jr z, .ok2 jr z, .ok2
xor a xor a
ld [wc2da], a ld [wLandmarkSignTimer], a
.ok2 .ok2
scf scf

View File

@ -154,52 +154,52 @@ ENDM
landmark 148, 132, FastShipName landmark 148, 132, FastShipName
NewBarkTownName: db "NEW BARK", $1f, "TOWN@" NewBarkTownName: db "NEW BARK¯TOWN@"
CherrygroveCityName: db "CHERRYGROVE", $1f, "CITY@" CherrygroveCityName: db "CHERRYGROVE¯CITY@"
VioletCityName: db "VIOLET CITY@" VioletCityName: db "VIOLET CITY@"
AzaleaTownName: db "AZALEA TOWN@" AzaleaTownName: db "AZALEA TOWN@"
GoldenrodCityName: db "GOLDENROD", $1f, "CITY@" GoldenrodCityName: db "GOLDENROD¯CITY@"
EcruteakCityName: db "ECRUTEAK", $1f, "CITY@" EcruteakCityName: db "ECRUTEAK¯CITY@"
OlivineCityName: db "OLIVINE", $1f, "CITY@" OlivineCityName: db "OLIVINE¯CITY@"
CianwoodCityName: db "CIANWOOD", $1f, "CITY@" CianwoodCityName: db "CIANWOOD¯CITY@"
MahoganyTownName: db "MAHOGANY", $1f, "TOWN@" MahoganyTownName: db "MAHOGANY¯TOWN@"
BlackthornCityName: db "BLACKTHORN", $1f, "CITY@" BlackthornCityName: db "BLACKTHORN¯CITY@"
LakeOfRageName: db "LAKE OF", $1f, "RAGE@" LakeOfRageName: db "LAKE OF¯RAGE@"
SilverCaveName: db "SILVER CAVE@" SilverCaveName: db "SILVER CAVE@"
SproutTowerName: db "SPROUT", $1f, "TOWER@" SproutTowerName: db "SPROUT¯TOWER@"
RuinsOfAlphName: db "RUINS", $1f, "OF ALPH@" RuinsOfAlphName: db "RUINS¯OF ALPH@"
UnionCaveName: db "UNION CAVE@" UnionCaveName: db "UNION CAVE@"
SlowpokeWellName: db "SLOWPOKE", $1f, "WELL@" SlowpokeWellName: db "SLOWPOKE¯WELL@"
RadioTowerName: db "RADIO TOWER@" RadioTowerName: db "RADIO TOWER@"
PowerPlantName: db "POWER PLANT@" PowerPlantName: db "POWER PLANT@"
NationalParkName: db "NATIONAL", $1f, "PARK@" NationalParkName: db "NATIONAL¯PARK@"
TinTowerName: db "TIN TOWER@" TinTowerName: db "TIN TOWER@"
LighthouseName: db "LIGHTHOUSE@" LighthouseName: db "LIGHTHOUSE@"
WhirlIslandsName: db "WHIRL", $1f, "ISLANDS@" WhirlIslandsName: db "WHIRL¯ISLANDS@"
MtMortarName: db "MT.MORTAR@" MtMortarName: db "MT.MORTAR@"
DragonsDenName: db "DRAGON'S", $1f, "DEN@" DragonsDenName: db "DRAGON'S¯DEN@"
IcePathName: db "ICE PATH@" IcePathName: db "ICE PATH@"
NotApplicableName: db "N/A@" NotApplicableName: db "N/A@"
PalletTownName: db "PALLET TOWN@" PalletTownName: db "PALLET TOWN@"
ViridianCityName: db "VIRIDIAN", $1f, "CITY@" ViridianCityName: db "VIRIDIAN¯CITY@"
PewterCityName: db "PEWTER CITY@" PewterCityName: db "PEWTER CITY@"
CeruleanCityName: db "CERULEAN", $1f, "CITY@" CeruleanCityName: db "CERULEAN¯CITY@"
LavenderTownName: db "LAVENDER", $1f, "TOWN@" LavenderTownName: db "LAVENDER¯TOWN@"
VermilionCityName: db "VERMILION", $1f, "CITY@" VermilionCityName: db "VERMILION¯CITY@"
CeladonCityName: db "CELADON", $1f, "CITY@" CeladonCityName: db "CELADON¯CITY@"
SaffronCityName: db "SAFFRON", $1f, "CITY@" SaffronCityName: db "SAFFRON¯CITY@"
FuchsiaCityName: db "FUCHSIA", $1f, "CITY@" FuchsiaCityName: db "FUCHSIA¯CITY@"
CinnabarIslandName: db "CINNABAR", $1f, "ISLAND@" CinnabarIslandName: db "CINNABAR¯ISLAND@"
IndigoPlateauName: db "INDIGO", $1f, "PLATEAU@" IndigoPlateauName: db "INDIGO¯PLATEAU@"
VictoryRoadName: db "VICTORY", $1f, "ROAD@" VictoryRoadName: db "VICTORY¯ROAD@"
MtMoonName: db "MT.MOON@" MtMoonName: db "MT.MOON@"
RockTunnelName: db "ROCK TUNNEL@" RockTunnelName: db "ROCK TUNNEL@"
LavRadioTowerName: db "LAV", $1f, "RADIO TOWER@" LavRadioTowerName: db "LAV¯RADIO TOWER@"
SilphCoName: db "SILPH CO.@" SilphCoName: db "SILPH CO.@"
SafariZoneName: db "SAFARI ZONE@" SafariZoneName: db "SAFARI ZONE@"
SeafoamIslandsName: db "SEAFOAM", $1f, "ISLANDS@" SeafoamIslandsName: db "SEAFOAM¯ISLANDS@"
PokemonMansionName: db "#MON", $1f, "MANSION@" PokemonMansionName: db "#MON¯MANSION@"
CeruleanCaveNane: db "CERULEAN", $1f, "CAVE@" CeruleanCaveNane: db "CERULEAN¯CAVE@"
Route1Name: db "ROUTE 1@" Route1Name: db "ROUTE 1@"
Route2Name: db "ROUTE 2@" Route2Name: db "ROUTE 2@"
Route3Name: db "ROUTE 3@" Route3Name: db "ROUTE 3@"
@ -247,14 +247,14 @@ Route44Name: db "ROUTE 44@"
Route45Name: db "ROUTE 45@" Route45Name: db "ROUTE 45@"
Route46Name: db "ROUTE 46@" Route46Name: db "ROUTE 46@"
DarkCaveName: db "DARK CAVE@" DarkCaveName: db "DARK CAVE@"
IlexForestName: db "ILEX", $1f, "FOREST@" IlexForestName: db "ILEX¯FOREST@"
BurnedTowerName: db "BURNED", $1f, "TOWER@" BurnedTowerName: db "BURNED¯TOWER@"
FastShipName: db "FAST SHIP@" FastShipName: db "FAST SHIP@"
ViridianForestName: db "VIRIDIAN", $1f, "FOREST@" ViridianForestName: db "VIRIDIAN¯FOREST@"
DiglettsCaveName: db "DIGLETT'S", $1f, "CAVE@" DiglettsCaveName: db "DIGLETT'S¯CAVE@"
TohjoFallsName: db "TOHJO FALLS@" TohjoFallsName: db "TOHJO FALLS@"
UndergroundName: db "UNDERGROUND@" UndergroundName: db "UNDERGROUND@"
BattleTowerName: db "BATTLE", $1f, "TOWER@" BattleTowerName: db "BATTLE¯TOWER@"
SpecialMapName: db "SPECIAL@" SpecialMapName: db "SPECIAL@"

View File

@ -101,8 +101,8 @@ FixDays:: ; 5e8
; update dl ; update dl
ld [hRTCDayLo], a ; DL ld [hRTCDayLo], a ; DL
; unknown output ; flag for s0_ac60
ld a, $40 ; %1000000 ld a, %01000000
jr .set jr .set
.daylo .daylo
@ -120,8 +120,8 @@ FixDays:: ; 5e8
; update dl ; update dl
ld [hRTCDayLo], a ; DL ld [hRTCDayLo], a ; DL
; unknown output ; flag for s0_ac60
ld a, $20 ; %100000 ld a, %00100000
.set .set
; update clock with modded day value ; update clock with modded day value
@ -278,6 +278,7 @@ SetClock:: ; 691
Function6c4:: ; 6c4 Function6c4:: ; 6c4
; clear s0_ac60
xor a xor a
push af push af
ld a, BANK(s0_ac60) ld a, BANK(s0_ac60)
@ -289,6 +290,7 @@ Function6c4:: ; 6c4
; 6d3 ; 6d3
Function6d3:: ; 6d3 Function6d3:: ; 6d3
; append flags to s0_ac60
ld hl, s0_ac60 ld hl, s0_ac60
push af push af
ld a, BANK(s0_ac60) ld a, BANK(s0_ac60)
@ -301,6 +303,7 @@ Function6d3:: ; 6d3
; 6e3 ; 6e3
Function6e3:: ; 6e3 Function6e3:: ; 6e3
; check s0_ac60
ld a, BANK(s0_ac60) ld a, BANK(s0_ac60)
call GetSRAMBank call GetSRAMBank
ld a, [s0_ac60] ld a, [s0_ac60]

View File

@ -358,7 +358,7 @@ endr
push de push de
; BUG: callba overwrites a, ; BUG: callba overwrites a,
; and GetItem takes b anyway. ; and GetItemHeldEffect takes b anyway.
; This is probably the reason ; This is probably the reason
; the HELD_CATCH_CHANCE effect ; the HELD_CATCH_CHANCE effect
@ -368,7 +368,7 @@ endr
ld a, [BattleMonItem] ld a, [BattleMonItem]
; ld b, a ; ld b, a
callba GetItem callba GetItemHeldEffect
ld a, b ld a, b
cp HELD_CATCH_CHANCE cp HELD_CATCH_CHANCE

View File

@ -2,8 +2,10 @@
charmap "<START>", $00 charmap "<START>", $00
charmap "<PLAY_G>", $14 ; <PLAYER> + gender charmap "<PLAY_G>", $14 ; <PLAYER> + gender
charmap "<DAY>", $15 charmap "<DAY>", $15
charmap "¯", $1f
charmap "<LNBRK>", $22 charmap "<LNBRK>", $22
charmap "<POKE>", $24 charmap "<POKE>", $24
charmap "%", $25
charmap "<RED>", $38 charmap "<RED>", $38
charmap "<GREEN>", $39 charmap "<GREEN>", $39
charmap "<ENEMY>", $3f charmap "<ENEMY>", $3f
@ -31,6 +33,7 @@
charmap "<DEXEND>", $5f charmap "<DEXEND>", $5f
; Actual characters ; Actual characters
charmap "▲", $61
charmap "_", $62 charmap "_", $62
charmap "", $6e charmap "", $6e
charmap "<LV>", $6e charmap "<LV>", $6e

624
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -306,9 +306,9 @@ wc2d4:: ds 1
wc2d5:: ds 1 wc2d5:: ds 1
wc2d6:: ds 1 wc2d6:: ds 1
wc2d7:: ds 1 wc2d7:: ds 1
wc2d8:: ds 1 wPreviousLandmark:: ds 1
wc2d9:: ds 1 wCurrentLandmark:: ds 1
wc2da:: ds 2 wLandmarkSignTimer:: ds 2
wLinkMode:: ; c2dc wLinkMode:: ; c2dc
; 0 not in link battle ; 0 not in link battle
; 1 link battle ; 1 link battle
@ -2193,8 +2193,8 @@ wObjectMasks:: ds NUM_OBJECTS ; d81e
VariableSprites:: ; d82e VariableSprites:: ; d82e
ds $10 ds $10
wd83e:: ds 3 wEnteredMapFromContinue:: ds 1 ; d83e
ds 2
TimeOfDayPal:: ; d841 TimeOfDayPal:: ; d841
ds 1 ds 1
ds 4 ds 4