Add constants for time-of-day boundaries

Split off more misc constants into proper files
This commit is contained in:
Remy Oukaour 2017-12-11 12:20:01 -05:00
parent ec380e6df2
commit c2ad79c4f2
10 changed files with 115 additions and 107 deletions

View File

@ -21,7 +21,9 @@ INCLUDE "constants/sfx_constants.asm"
INCLUDE "constants/animation_constants.asm" INCLUDE "constants/animation_constants.asm"
INCLUDE "constants/phone_constants.asm" INCLUDE "constants/phone_constants.asm"
INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/input_constants.asm"
INCLUDE "constants/pokemon_data_constants.asm" INCLUDE "constants/pokemon_data_constants.asm"
INCLUDE "constants/serial_constants.asm"
INCLUDE "constants/mobile_constants.asm" INCLUDE "constants/mobile_constants.asm"
INCLUDE "constants/misc_constants.asm" INCLUDE "constants/misc_constants.asm"
INCLUDE "constants/std_constants.asm" INCLUDE "constants/std_constants.asm"

View File

@ -1,3 +1,21 @@
LEN_2BPP_TILE EQU 16 LEN_1BPP_TILE EQU 8 ; bytes
LEN_1BPP_TILE EQU 8 LEN_2BPP_TILE EQU 16 ; bytes
TILES_PER_FRAME EQU 6
TILE_WIDTH EQU 8 ; pixels
NUM_PAL_COLORS EQU 4
SCREEN_WIDTH EQU 20 ; tiles
SCREEN_HEIGHT EQU 18 ; tiles
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels
BG_MAP_WIDTH EQU 32 ; tiles
BG_MAP_HEIGHT EQU 32 ; tiles
WMISC_WIDTH EQU 6 * 4
WMISC_HEIGHT EQU 5 * 4
HP_BAR_LENGTH EQU 6 ; tiles
HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels
EXP_BAR_LENGTH EQU 8 ; tiles
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels

View File

@ -0,0 +1,26 @@
; joypad buttons
const_def
const A_BUTTON_F ; 0
const B_BUTTON_F ; 1
const SELECT_F ; 2
const START_F ; 3
const D_RIGHT_F ; 4
const D_LEFT_F ; 5
const D_UP_F ; 6
const D_DOWN_F ; 7
NO_INPUT EQU %00000000
A_BUTTON EQU 1 << A_BUTTON_F
B_BUTTON EQU 1 << B_BUTTON_F
SELECT EQU 1 << SELECT_F
START EQU 1 << START_F
D_RIGHT EQU 1 << D_RIGHT_F
D_LEFT EQU 1 << D_LEFT_F
D_UP EQU 1 << D_UP_F
D_DOWN EQU 1 << D_DOWN_F
BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START
D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN
R_DPAD EQU %00100000
R_BUTTONS EQU %00010000

View File

@ -37,70 +37,11 @@ TRAINER_NAME EQU 7
; broken ptr EQU 8 ; broken ptr EQU 8
; boxes
MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; hall of fame
HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (PKMN_NAME_LENGTH +- 1) ; species, id, dvs, level, nick
HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS = 30
; joypad
const_def
const A_BUTTON_F ; 0
const B_BUTTON_F ; 1
const SELECT_F ; 2
const START_F ; 3
const D_RIGHT_F ; 4
const D_LEFT_F ; 5
const D_UP_F ; 6
const D_DOWN_F ; 7
NO_INPUT EQU %00000000
A_BUTTON EQU 1 << A_BUTTON_F
B_BUTTON EQU 1 << B_BUTTON_F
SELECT EQU 1 << SELECT_F
START EQU 1 << START_F
D_RIGHT EQU 1 << D_RIGHT_F
D_LEFT EQU 1 << D_LEFT_F
D_UP EQU 1 << D_UP_F
D_DOWN EQU 1 << D_DOWN_F
BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START
D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN
R_DPAD EQU %00100000
R_BUTTONS EQU %00010000
; screen
HP_BAR_LENGTH EQU 6
HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * 8
EXP_BAR_LENGTH EQU 8
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * 8
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * 8
SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * 8
BG_MAP_WIDTH EQU 32
BG_MAP_HEIGHT EQU 32
WMISC_WIDTH EQU 6 * 4
WMISC_HEIGHT EQU 5 * 4
TILE_WIDTH EQU 8
; printing text ; printing text
const_value set 5
PRINTNUM_MONEY_F EQU 5 const PRINTNUM_MONEY_F ; 5
PRINTNUM_RIGHTALIGN_F EQU 6 const PRINTNUM_RIGHTALIGN_F ; 6
PRINTNUM_LEADINGZEROS_F EQU 7 const PRINTNUM_LEADINGZEROS_F ; 7
PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F
PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F
@ -119,6 +60,28 @@ PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F
const STEP_WALK_IN_PLACE ; 7 const STEP_WALK_IN_PLACE ; 7
HMENURETURN_SCRIPT EQU %10000000
HMENURETURN_ASM EQU %11111111
; time of day boundaries
MORN_HOUR EQU 4 ; 4 AM
DAY_HOUR EQU 10 ; 10 AM
NITE_HOUR EQU 18 ; 6 PM
NOON_HOUR EQU 12 ; 12 PM
MAX_HOUR EQU 24 ; 12 AM
; boxes
MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; hall of fame
HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (PKMN_NAME_LENGTH +- 1) ; species, id, dvs, level, nick
HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS = 30
; ChangeHappiness arguments (see event/happiness_egg.asm) ; ChangeHappiness arguments (see event/happiness_egg.asm)
const_value = 1 const_value = 1
const HAPPINESS_GAINLEVEL ; 01 const HAPPINESS_GAINLEVEL ; 01
@ -140,19 +103,3 @@ const_value = 1
const HAPPINESS_REVIVALHERB ; 11 const HAPPINESS_REVIVALHERB ; 11
const HAPPINESS_MASSAGE ; 12 const HAPPINESS_MASSAGE ; 12
const HAPPINESS_GAINLEVELATHOME ; 13 const HAPPINESS_GAINLEVELATHOME ; 13
const_def
const LINK_NULL ; 0
const LINK_TIMECAPSULE ; 1
const LINK_TRADECENTER ; 2
const LINK_COLOSSEUM ; 3
const LINK_MOBILE ; 4
SERIAL_TIMECAPSULE EQU $60
SERIAL_TRADECENTER EQU $70
SERIAL_BATTLE EQU $80
HMENURETURN_SCRIPT EQU %10000000
HMENURETURN_ASM EQU %11111111

View File

@ -0,0 +1,12 @@
; link types
const_def
const LINK_NULL ; 0
const LINK_TIMECAPSULE ; 1
const LINK_TRADECENTER ; 2
const LINK_COLOSSEUM ; 3
const LINK_MOBILE ; 4
SERIAL_TIMECAPSULE EQU $60
SERIAL_TRADECENTER EQU $70
SERIAL_BATTLE EQU $80

View File

@ -1837,7 +1837,7 @@ BuenasPassword21:
BuenasPasswordCheckTime: BuenasPasswordCheckTime:
call UpdateTime call UpdateTime
ld a, [hHours] ld a, [hHours]
cp 18 ; 6 PM cp NITE_HOUR
ret ret
BuenasPasswordChannelName: BuenasPasswordChannelName:

View File

@ -50,11 +50,11 @@ GetTimeOfDay:: ; 14032
TimesOfDay: ; 14044 TimesOfDay: ; 14044
; hours for the time of day ; hours for the time of day
; 04-09 morn | 10-17 day | 18-03 nite ; 0400-0959 morn | 1000-1759 day | 1800-0359 nite
db 04, NITE_F db MORN_HOUR, NITE_F
db 10, MORN_F db DAY_HOUR, MORN_F
db 18, DAY_F db NITE_HOUR, DAY_F
db 24, NITE_F db MAX_HOUR, NITE_F
db -1, MORN_F db -1, MORN_F
; 1404e ; 1404e

View File

@ -44,7 +44,7 @@ InitClock: ; 90672 (24:4672)
ld bc, 50 ld bc, 50
xor a xor a
call ByteFill call ByteFill
ld a, $a ld a, 10 ; default hour = 10 AM
ld [wInitHourBuffer], a ld [wInitHourBuffer], a
.loop .loop
@ -98,7 +98,7 @@ InitClock: ; 90672 (24:4672)
call SetMinutes call SetMinutes
jr nc, .SetMinutesLoop jr nc, .SetMinutesLoop
ld a, [BattleMonNick + 5] ld a, [wInitMinuteBuffer]
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
call .ClearScreen call .ClearScreen
ld hl, Text_WhoaMins ld hl, Text_WhoaMins
@ -237,7 +237,7 @@ SetMinutes: ; 90810 (24:4810)
ret ret
.d_down .d_down
ld hl, BattleMonNick + 5 ld hl, wInitMinuteBuffer
ld a, [hl] ld a, [hl]
and a and a
jr nz, .decrease jr nz, .decrease
@ -248,7 +248,7 @@ SetMinutes: ; 90810 (24:4810)
jr .finish_dpad jr .finish_dpad
.d_up .d_up
ld hl, BattleMonNick + 5 ld hl, wInitMinuteBuffer
ld a, [hl] ld a, [hl]
cp 59 cp 59
jr c, .increase jr c, .increase
@ -271,7 +271,7 @@ SetMinutes: ; 90810 (24:4810)
ret ret
DisplayMinutesWithMinString: ; 90859 (24:4859) DisplayMinutesWithMinString: ; 90859 (24:4859)
ld de, BattleMonNick + 5 ld de, wInitMinuteBuffer
call PrintTwoDigitNumberRightAlign call PrintTwoDigitNumberRightAlign
inc hl inc hl
ld de, String_min ld de, String_min
@ -355,17 +355,17 @@ OakText_ResponseToSetTime: ; 0x908b8
call PrintHour call PrintHour
ld [hl], ":" ld [hl], ":"
inc hl inc hl
ld de, BattleMonNick + 5 ld de, wInitMinuteBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 2 lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum call PrintNum
ld b, h ld b, h
ld c, l ld c, l
ld a, [wInitHourBuffer] ld a, [wInitHourBuffer]
cp 4 cp MORN_HOUR
jr c, .nite jr c, .nite
cp 11 cp DAY_HOUR + 1
jr c, .morn jr c, .morn
cp 18 cp NITE_HOUR
jr c, .day jr c, .day
.nite: .nite:
ld hl, .sodark ld hl, .sodark
@ -482,7 +482,7 @@ Special_SetDayOfWeek: ; 90913
ld a, [hl] ld a, [hl]
and a and a
jr nz, .decrease jr nz, .decrease
ld a, 6 + 1 ld a, SATURDAY + 1
.decrease .decrease
dec a dec a
@ -494,7 +494,7 @@ Special_SetDayOfWeek: ; 90913
ld a, [hl] ld a, [hl]
cp 6 cp 6
jr c, .increase jr c, .increase
ld a, 0 - 1 ld a, SUNDAY - 1
.increase .increase
inc a inc a
@ -531,6 +531,7 @@ Special_SetDayOfWeek: ; 90913
; 909f2 ; 909f2
.WeekdayStrings: ; 909f2 .WeekdayStrings: ; 909f2
; entries correspond to CurDay constants (see constants/wram_constants.asm)
dw .Sunday dw .Sunday
dw .Monday dw .Monday
dw .Tuesday dw .Tuesday
@ -731,11 +732,11 @@ PrintHour: ; 90b3e (24:4b3e)
GetTimeOfDayString: ; 90b58 (24:4b58) GetTimeOfDayString: ; 90b58 (24:4b58)
ld a, c ld a, c
cp 4 cp MORN_HOUR
jr c, .nite jr c, .nite
cp 10 cp DAY_HOUR
jr c, .morn jr c, .morn
cp 18 cp NITE_HOUR
jr c, .day jr c, .day
.nite .nite
ld de, .nite_string ld de, .nite_string
@ -758,12 +759,12 @@ AdjustHourForAMorPM:
ld a, c ld a, c
or a or a
jr z, .midnight jr z, .midnight
cp 12 cp NOON_HOUR
ret c ret c
ret z ret z
sub 12 sub NOON_HOUR
ret ret
.midnight .midnight
ld a, 12 ld a, NOON_HOUR
ret ret

View File

@ -165,13 +165,13 @@ _LoadFontsBattleExtra:: ; fb4be
LoadFrame: ; fb4cc LoadFrame: ; fb4cc
ld a, [TextBoxFrame] ld a, [TextBoxFrame]
and 7 and 7
ld bc, TILES_PER_FRAME * LEN_1BPP_TILE ld bc, LEN_1BPP_TILE * 6
ld hl, Frames ld hl, Frames
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld hl, VTiles2 tile "┌" ; $79 ld hl, VTiles2 tile "┌" ; $79
lb bc, BANK(Frames), TILES_PER_FRAME lb bc, BANK(Frames), 6
call Get1bpp_2 call Get1bpp_2
ld hl, VTiles2 tile " " ; $7f ld hl, VTiles2 tile " " ; $7f
ld de, TextBoxSpaceGFX ld de, TextBoxSpaceGFX

View File

@ -355,6 +355,8 @@ NEXTU ; c608
; timeset temp storage ; timeset temp storage
ds 20 ds 20
wInitHourBuffer:: db ; c61c wInitHourBuffer:: db ; c61c
ds 9
wInitMinuteBuffer:: db ; c626
NEXTU ; c608 NEXTU ; c608
; link engine data ; link engine data