diff --git a/constants.asm b/constants.asm index dd8a6e11e..988c8b336 100644 --- a/constants.asm +++ b/constants.asm @@ -21,7 +21,9 @@ INCLUDE "constants/sfx_constants.asm" INCLUDE "constants/animation_constants.asm" INCLUDE "constants/phone_constants.asm" INCLUDE "constants/gfx_constants.asm" +INCLUDE "constants/input_constants.asm" INCLUDE "constants/pokemon_data_constants.asm" +INCLUDE "constants/serial_constants.asm" INCLUDE "constants/mobile_constants.asm" INCLUDE "constants/misc_constants.asm" INCLUDE "constants/std_constants.asm" diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 6b8cc33c9..445f0d815 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -1,3 +1,21 @@ -LEN_2BPP_TILE EQU 16 -LEN_1BPP_TILE EQU 8 -TILES_PER_FRAME EQU 6 +LEN_1BPP_TILE EQU 8 ; bytes +LEN_2BPP_TILE EQU 16 ; bytes + +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 diff --git a/constants/input_constants.asm b/constants/input_constants.asm new file mode 100644 index 000000000..3042c3f89 --- /dev/null +++ b/constants/input_constants.asm @@ -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 diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 94244b481..ff416e3cd 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -37,70 +37,11 @@ TRAINER_NAME EQU 7 ; 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 - -PRINTNUM_MONEY_F EQU 5 -PRINTNUM_RIGHTALIGN_F EQU 6 -PRINTNUM_LEADINGZEROS_F EQU 7 +const_value set 5 + const PRINTNUM_MONEY_F ; 5 + const PRINTNUM_RIGHTALIGN_F ; 6 + const PRINTNUM_LEADINGZEROS_F ; 7 PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_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 +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) const_value = 1 const HAPPINESS_GAINLEVEL ; 01 @@ -140,19 +103,3 @@ const_value = 1 const HAPPINESS_REVIVALHERB ; 11 const HAPPINESS_MASSAGE ; 12 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 diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm new file mode 100644 index 000000000..e7b4c4b2c --- /dev/null +++ b/constants/serial_constants.asm @@ -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 diff --git a/engine/radio.asm b/engine/radio.asm index 8760956b2..feded7616 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -1837,7 +1837,7 @@ BuenasPassword21: BuenasPasswordCheckTime: call UpdateTime ld a, [hHours] - cp 18 ; 6 PM + cp NITE_HOUR ret BuenasPasswordChannelName: diff --git a/engine/rtc.asm b/engine/rtc.asm index 1b1b44fa6..f69dc1f6d 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -50,11 +50,11 @@ GetTimeOfDay:: ; 14032 TimesOfDay: ; 14044 ; hours for the time of day -; 04-09 morn | 10-17 day | 18-03 nite - db 04, NITE_F - db 10, MORN_F - db 18, DAY_F - db 24, NITE_F +; 0400-0959 morn | 1000-1759 day | 1800-0359 nite + db MORN_HOUR, NITE_F + db DAY_HOUR, MORN_F + db NITE_HOUR, DAY_F + db MAX_HOUR, NITE_F db -1, MORN_F ; 1404e diff --git a/engine/timeset.asm b/engine/timeset.asm index e8b0642e4..2a578f998 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -44,7 +44,7 @@ InitClock: ; 90672 (24:4672) ld bc, 50 xor a call ByteFill - ld a, $a + ld a, 10 ; default hour = 10 AM ld [wInitHourBuffer], a .loop @@ -98,7 +98,7 @@ InitClock: ; 90672 (24:4672) call SetMinutes jr nc, .SetMinutesLoop - ld a, [BattleMonNick + 5] + ld a, [wInitMinuteBuffer] ld [StringBuffer2 + 2], a call .ClearScreen ld hl, Text_WhoaMins @@ -237,7 +237,7 @@ SetMinutes: ; 90810 (24:4810) ret .d_down - ld hl, BattleMonNick + 5 + ld hl, wInitMinuteBuffer ld a, [hl] and a jr nz, .decrease @@ -248,7 +248,7 @@ SetMinutes: ; 90810 (24:4810) jr .finish_dpad .d_up - ld hl, BattleMonNick + 5 + ld hl, wInitMinuteBuffer ld a, [hl] cp 59 jr c, .increase @@ -271,7 +271,7 @@ SetMinutes: ; 90810 (24:4810) ret DisplayMinutesWithMinString: ; 90859 (24:4859) - ld de, BattleMonNick + 5 + ld de, wInitMinuteBuffer call PrintTwoDigitNumberRightAlign inc hl ld de, String_min @@ -355,17 +355,17 @@ OakText_ResponseToSetTime: ; 0x908b8 call PrintHour ld [hl], ":" inc hl - ld de, BattleMonNick + 5 + ld de, wInitMinuteBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ld b, h ld c, l ld a, [wInitHourBuffer] - cp 4 + cp MORN_HOUR jr c, .nite - cp 11 + cp DAY_HOUR + 1 jr c, .morn - cp 18 + cp NITE_HOUR jr c, .day .nite: ld hl, .sodark @@ -482,7 +482,7 @@ Special_SetDayOfWeek: ; 90913 ld a, [hl] and a jr nz, .decrease - ld a, 6 + 1 + ld a, SATURDAY + 1 .decrease dec a @@ -494,7 +494,7 @@ Special_SetDayOfWeek: ; 90913 ld a, [hl] cp 6 jr c, .increase - ld a, 0 - 1 + ld a, SUNDAY - 1 .increase inc a @@ -531,6 +531,7 @@ Special_SetDayOfWeek: ; 90913 ; 909f2 .WeekdayStrings: ; 909f2 +; entries correspond to CurDay constants (see constants/wram_constants.asm) dw .Sunday dw .Monday dw .Tuesday @@ -731,11 +732,11 @@ PrintHour: ; 90b3e (24:4b3e) GetTimeOfDayString: ; 90b58 (24:4b58) ld a, c - cp 4 + cp MORN_HOUR jr c, .nite - cp 10 + cp DAY_HOUR jr c, .morn - cp 18 + cp NITE_HOUR jr c, .day .nite ld de, .nite_string @@ -758,12 +759,12 @@ AdjustHourForAMorPM: ld a, c or a jr z, .midnight - cp 12 + cp NOON_HOUR ret c ret z - sub 12 + sub NOON_HOUR ret .midnight - ld a, 12 + ld a, NOON_HOUR ret diff --git a/gfx/font.asm b/gfx/font.asm index 8d7186e4c..99e8505b7 100755 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -165,13 +165,13 @@ _LoadFontsBattleExtra:: ; fb4be LoadFrame: ; fb4cc ld a, [TextBoxFrame] and 7 - ld bc, TILES_PER_FRAME * LEN_1BPP_TILE + ld bc, LEN_1BPP_TILE * 6 ld hl, Frames call AddNTimes ld d, h ld e, l ld hl, VTiles2 tile "┌" ; $79 - lb bc, BANK(Frames), TILES_PER_FRAME + lb bc, BANK(Frames), 6 call Get1bpp_2 ld hl, VTiles2 tile " " ; $7f ld de, TextBoxSpaceGFX diff --git a/wram.asm b/wram.asm index 9b96f2bb6..e70457eba 100644 --- a/wram.asm +++ b/wram.asm @@ -355,6 +355,8 @@ NEXTU ; c608 ; timeset temp storage ds 20 wInitHourBuffer:: db ; c61c + ds 9 +wInitMinuteBuffer:: db ; c626 NEXTU ; c608 ; link engine data