shithub: pokecrystal

Download patch

ref: 41acb0667a321865277f50a45e662b1aae939a00
parent: c6fefd0fe878a350a5e8cb1140d0356c78648ba5
author: Remy Oukaour <[email protected]>
date: Sun Dec 10 20:02:28 EST 2017

Document macros/map.asm
Rename MORN/DAY/NITE to MORN_F/DAY_F/NITE_F; use MORN/DAY/NITE for shifted values (cleaner for person_events)
Prefix FLOOR to the `elevfloor` constants

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -6676,7 +6676,7 @@
 ; Get list for the time of day
 	ld hl, .Morn
 	ld a, [TimeOfDay]
-	cp DAY
+	cp DAY_F
 	jr c, .Check
 	ld hl, .Day
 	jr z, .Check
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9323,7 +9323,7 @@
 
 BattleCommand_HealMorn: ; 37b74
 ; healmorn
-	ld b, MORN
+	ld b, MORN_F
 	jr BattleCommand_TimeBasedHealContinue
 
 ; 37b78
@@ -9330,7 +9330,7 @@
 
 BattleCommand_HealDay: ; 37b78
 ; healday
-	ld b, DAY
+	ld b, DAY_F
 	jr BattleCommand_TimeBasedHealContinue
 
 ; 37b7c
@@ -9337,7 +9337,7 @@
 
 BattleCommand_HealNite: ; 37b7c
 ; healnite
-	ld b, NITE
+	ld b, NITE_F
 	; fallthrough
 ; 37b7e
 
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -716,22 +716,22 @@
 ; elevator floors
 ; used by `elevfloor`
 	const_def
-	const _B4F
-	const _B3F
-	const _B2F
-	const _B1F
-	const _1F
-	const _2F
-	const _3F
-	const _4F
-	const _5F
-	const _6F
-	const _7F
-	const _8F
-	const _9F
-	const _10F
-	const _11F
-	const _ROOF
+	const FLOOR_B4F
+	const FLOOR_B3F
+	const FLOOR_B2F
+	const FLOOR_B1F
+	const FLOOR_1F
+	const FLOOR_2F
+	const FLOOR_3F
+	const FLOOR_4F
+	const FLOOR_5F
+	const FLOOR_6F
+	const FLOOR_7F
+	const FLOOR_8F
+	const FLOOR_9F
+	const FLOOR_10F
+	const FLOOR_11F
+	const FLOOR_ROOF
 
 ; command queue members
 CMDQUEUE_TYPE  EQU 0
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -50,14 +50,14 @@
 ; joypad
 
 	const_def
-	const A_BUTTON_F
-	const B_BUTTON_F
-	const SELECT_F
-	const START_F
-	const D_RIGHT_F
-	const D_LEFT_F
-	const D_UP_F
-	const D_DOWN_F
+	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
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -46,10 +46,15 @@
 
 ; TimeOfDay: ; d269
 	const_def
-	const MORN     ; 0
-	const DAY      ; 1
-	const NITE     ; 2
-	const DARKNESS ; 3
+	const MORN_F     ; 0
+	const DAY_F      ; 1
+	const NITE_F     ; 2
+	const DARKNESS_F ; 3
+
+MORN     EQU 1 << MORN_F
+DAY      EQU 1 << DAY_F
+NITE     EQU 1 << NITE_F
+DARKNESS EQU 1 << DARKNESS_F
 
 ; ScriptFlags: ; d434
 SCRIPT_RUNNING EQU 2
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -1948,7 +1948,7 @@
 	call AddNTimes
 	ld de, UnknOBPals
 	ld bc, 8 palettes
-	ld a, $5 ; BANK(UnknOBPals)
+	ld a, BANK(UnknOBPals)
 	call FarCopyWRAM
 
 	ld a, [wPermission]
@@ -1967,13 +1967,13 @@
 	add hl, de
 	ld a, [TimeOfDayPal]
 	and 3
-	cp NITE
+	cp NITE_F
 	jr c, .morn_day
 rept 4
 	inc hl
 endr
 .morn_day
-	ld de, UnknBGPals + 6 palettes + 2
+	ld de, UnknBGPals palette PAL_BG_ROOF + 2
 	ld bc, 4
 	ld a, $5
 	call FarCopyWRAM
@@ -1983,10 +1983,10 @@
 	dw .OutdoorColors ; unused
 	dw .OutdoorColors ; TOWN
 	dw .OutdoorColors ; ROUTE
-	dw .IndoorColors ; INDOOR
+	dw .IndoorColors  ; INDOOR
 	dw .DungeonColors ; CAVE
-	dw .Perm5Colors ; PERM_5
-	dw .IndoorColors ; GATE
+	dw .Perm5Colors   ; PERM_5
+	dw .IndoorColors  ; GATE
 	dw .DungeonColors ; DUNGEON
 
 ; Valid indices: $00 - $29
--- a/engine/evolve.asm
+++ b/engine/evolve.asm
@@ -133,13 +133,13 @@
 
 ; TR_NITE
 	ld a, [TimeOfDay]
-	cp NITE
+	cp NITE_F
 	jp nz, .dont_evolve_3
 	jr .proceed
 
 .happiness_daylight
 	ld a, [TimeOfDay]
-	cp NITE
+	cp NITE_F
 	jp z, .dont_evolve_3
 	jr .proceed
 
--- a/engine/fish.asm
+++ b/engine/fish.asm
@@ -81,7 +81,7 @@
 
 	ld a, [TimeOfDay]
 	and 3
-	cp NITE
+	cp NITE_F
 	jr c, .time_species
 	inc hl
 	inc hl
--- a/engine/phone.asm
+++ b/engine/phone.asm
@@ -165,7 +165,7 @@
 
 	callba CheckTime
 	pop af
-	and (1 << MORN) + (1 << DAY) + (1 << NITE)
+	and MORN + DAY + NITE
 	and c
 
 	pop de
--- a/engine/rtc.asm
+++ b/engine/rtc.asm
@@ -51,11 +51,11 @@
 TimesOfDay: ; 14044
 ; hours for the time of day
 ; 04-09 morn | 10-17 day | 18-03 nite
-	db 04, NITE
-	db 10, MORN
-	db 18, DAY
-	db 24, NITE
-	db -1, MORN
+	db 04, NITE_F
+	db 10, MORN_F
+	db 18, DAY_F
+	db 24, NITE_F
+	db -1, MORN_F
 ; 1404e
 
 Unknown_1404e: ; Unreferenced
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -362,18 +362,18 @@
 	ld c, l
 	ld a, [wInitHourBuffer]
 	cp 4
-	jr c, .NITE
+	jr c, .nite
 	cp 11
-	jr c, .MORN
+	jr c, .morn
 	cp 18
-	jr c, .DAY
-.NITE:
+	jr c, .day
+.nite:
 	ld hl, .sodark
 	ret
-.MORN:
+.morn:
 	ld hl, .overslept
 	ret
-.DAY:
+.day:
 	ld hl, .yikes
 	ret
 ; 908ec (24:48ec)
@@ -738,19 +738,19 @@
 	cp 18
 	jr c, .day
 .nite
-	ld de, .NITE
+	ld de, .nite_string
 	ret
 .morn
-	ld de, .MORN
+	ld de, .morn_string
 	ret
 .day
-	ld de, .DAY
+	ld de, .day_string
 	ret
 ; 90b71 (24:4b71)
 
-.NITE: db "NITE@"
-.MORN: db "MORN@"
-.DAY: db "DAY@"
+.nite_string: db "NITE@"
+.morn_string: db "MORN@"
+.day_string:  db "DAY@"
 ; 90b7f
 
 AdjustHourForAMorPM:
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -276,9 +276,7 @@
 	ret
 
 .TimeOfDayValues_191e:
-	db 1 << MORN ; 1
-	db 1 << DAY  ; 2
-	db 1 << NITE ; 4
+	db MORN, DAY, NITE
 
 .check_hour
 	ld hl, MAPOBJECT_HOUR
--- a/macros/event.asm
+++ b/macros/event.asm
@@ -287,9 +287,9 @@
 	db \1 ; time
 	endm
 
-checkmorn EQUS "checktime 1 << MORN"
-checkday  EQUS "checktime 1 << DAY"
-checknite EQUS "checktime 1 << NITE"
+checkmorn EQUS "checktime MORN"
+checkday  EQUS "checktime DAY"
+checknite EQUS "checktime NITE"
 
 	enum checkpoke_command
 checkpoke: macro
--- a/macros/map.asm
+++ b/macros/map.asm
@@ -1,66 +1,96 @@
-map: MACRO
+map: macro
+;\1: map id
 	db GROUP_\1, MAP_\1
-ENDM
+endm
 
-roam_map: MACRO
-; A map and an arbitrary number of some more maps.
+maptrigger: macro
+;\1: script pointer
+	dw \1, 0
+endm
 
-	map \1
-	db  \2
+warp_def: macro
+;\1: y: top to bottom, starts at 0
+;\2: x: left to right, starts at 0
+;\3: warp destination: starts at 1
+;\4: map id: from constants/map_constants.asm
+	db \1, \2, \3
+	map \4
+endm
 
-	rept \2
-	map \3
-	shift
-	endr
+xy_trigger: macro
+;\1: number: controlled by dotrigger/domaptrigger
+;\2: y: top to bottom, starts at 0
+;\3: x: left to right, starts at 0
+;\4: unknown1: $0
+;\5: script pointer
+;\6: unknown2: $0
+;\7: unknown3: $0
+	db \1, \2, \3, \4
+	dw \5
+	db \6, \7
+endm
 
-	db 0
-ENDM
+signpost: macro
+;\1: y: top to bottom, starts at 0
+;\2: x: left to right, starts at 0
+;\3: function: a SIGNPOST_* constant
+;\4: script pointer
+	db \1, \2, \3
+	dw \4
+endm
 
 person_event: macro
-	db \1 ; sprite
-	db \2 + 4 ; y
-	db \3 + 4 ; x
-	db \4 ; movement function
-	dn \5, \6 ; radius: y, x
-	db \7 ; clock_hour
-	db \8 ; clock_daytime
+;\1: sprite: a SPRITE_* constant
+;\2: y: top to bottom, starts at 0
+;\3: x: left to right, starts at 0
+;\4: movement function: a SPRITEMOVEDATA_* constant
+;\5, \6: movement radius: y, x
+;\7: clock hour: ???
+;\8: clock daytime: sum of MORN, DAY, and/or NITE, or 0 for always
+;\9: color: a PAL_NPC_* constant, or 0 for sprite default
+;\10: function: a PERSONTYPE_* constant
+;\11: sight range: applies to PERSONTYPE_TRAINER
+;\12: script pointer
+;\13: event flag: an EVENT_* constant, or 0 for always
+	db \1, \2 + 4, \3 + 4, \4
+	dn \5, \6
+	db \7, \8
 	shift
-	dn \8, \9 ; color_function
+	dn \8, \9
 	shift
-	db \9 ; sight_range
+	db \9
 	shift
-	dw \9 ; pointer
+	dw \9
 	shift
-	dw \9 ; event flag
-	endm
+	dw \9
+endm
 
-signpost: macro
-	db \1 ; y
-	db \2 ; x
-	db \3 ; function
-	dw \4 ; pointer
-	endm
 
-xy_trigger: macro
-	db \1 ; number
-	db \2 ; y
-	db \3 ; x
-	db \4 ; unknown1
-	dw \5 ; script
-	db \6 ; unknown2
-	db \7 ; unknown3
-	endm
+newgroup: macro
+const_value = const_value + 1
+	enum_start 1
+endm
 
-warp_def: macro
-	db \1 ; y
-	db \2 ; x
-	db \3 ; warp_to
-	map \4 ; map
-	endm
+mapgroup: macro
+;\1: map id
+;\2: height: in blocks
+;\3: width: in blocks
+GROUP_\1 EQU const_value
+	enum MAP_\1
+\1_HEIGHT EQU \2
+\1_WIDTH EQU \3
+endm
 
 
-map_header: MACRO
-	; label, tileset, permission, location, music, phone service flag, time of day, fishing group
+map_header: macro
+;\1: map label
+;\2: tileset: a TILESET_* constant
+;\3: permission: TOWN, ROUTE, INDOOR, CAVE, PERM_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
+;\7: time of day: a PALETTE_* constant
+;\8: fishing group: a FISHGROUP_* constant
 \1_MapHeader:
 	db BANK(\1_SecondMapHeader), \2, \3
 	dw \1_SecondMapHeader
@@ -67,11 +97,14 @@
 	db \4, \5
 	dn \6, \7
 	db \8
-ENDM
+endm
 
 
-map_header_2: MACRO
-; label, map, border block, connections
+map_header_2: macro
+;\1: map label
+;\2: map id
+;\3: border block
+;\4: connections: sum of NORTH, SOUTH, WEST, and/or EAST, or 0 for none
 \1_SecondMapHeader::
 	db \3
 	db \2_HEIGHT, \2_WIDTH
@@ -81,9 +114,9 @@
 	dw \1_MapScriptHeader
 	dw \1_MapEventHeader
 	db \4
-ENDM
+endm
 
-connection: MACRO
+connection: macro
 if "\1" == "north"
 ;\2: map id
 ;\3: map label (eventually will be rolled into map id)
@@ -151,27 +184,12 @@
 	db 0
 	dw OverworldMap + \2_WIDTH + 7
 endc
+endm
 
-ENDM
 
-mapgroup: MACRO
-GROUP_\1 EQU const_value
-	enum MAP_\1
-\1_HEIGHT EQU \2
-\1_WIDTH EQU \3
-ENDM
-
-newgroup: MACRO
-const_value = const_value + 1
-	enum_start 1
-ENDM
-
-elevfloor: MACRO
-	db \1, \2
-	map \3
-ENDM
-
-itemball: MACRO
+itemball: macro
+;\1: item: from constants/item_constants.asm
+;\2: quantity: default 1
 if _NARG == 2
 	db \1, \2
 else
@@ -179,11 +197,30 @@
 endc
 endm
 
-stonetable: MACRO
+elevfloor: macro
+;\1: floor: a FLOOR_* constant
+;\2: warp destination: starts at 1
+;\3: map id
 	db \1, \2
+	map \3
+ENDM
+
+stonetable: macro
+;\1: warp id
+;\2: person_event id
+;\3: script pointer
+	db \1, \2
 	dw \3
 endm
 
-maptrigger: MACRO
-	dw \1, 0
+
+roam_map: macro
+; A map and an arbitrary number of some more maps.
+	map \1
+	db  \2
+rept \2
+	map \3
+	shift
+endr
+	db 0
 endm
--- a/main.asm
+++ b/main.asm
@@ -269,10 +269,10 @@
 	ret
 
 TimeOfDayTable: ; c012
-	db MORN, 1 << MORN
-	db DAY,  1 << DAY
-	db NITE, 1 << NITE
-	db NITE, 1 << NITE
+	db MORN_F, MORN
+	db DAY_F,  DAY
+	db NITE_F, NITE
+	db NITE_F, NITE
 	db -1
 
 INCLUDE "engine/specials.asm"
@@ -1430,7 +1430,7 @@
 
 	ld de, MUSIC_JOHTO_WILD_BATTLE
 	ld a, [TimeOfDay]
-	cp NITE
+	cp NITE_F
 	jr nz, .done
 	ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT
 	jr .done
--- a/maps/CeladonDeptStoreElevator.asm
+++ b/maps/CeladonDeptStoreElevator.asm
@@ -20,12 +20,12 @@
 
 Elevator_0x713be:
 	db 6 ; floors
-	elevfloor _1F,  4, CELADON_DEPT_STORE_1F
-	elevfloor _2F,  3, CELADON_DEPT_STORE_2F
-	elevfloor _3F,  3, CELADON_DEPT_STORE_3F
-	elevfloor _4F,  3, CELADON_DEPT_STORE_4F
-	elevfloor _5F,  3, CELADON_DEPT_STORE_5F
-	elevfloor _6F,  2, CELADON_DEPT_STORE_6F
+	elevfloor FLOOR_1F, 4, CELADON_DEPT_STORE_1F
+	elevfloor FLOOR_2F, 3, CELADON_DEPT_STORE_2F
+	elevfloor FLOOR_3F, 3, CELADON_DEPT_STORE_3F
+	elevfloor FLOOR_4F, 3, CELADON_DEPT_STORE_4F
+	elevfloor FLOOR_5F, 3, CELADON_DEPT_STORE_5F
+	elevfloor FLOOR_6F, 2, CELADON_DEPT_STORE_6F
 	db $ff ; end
 
 
--- a/maps/CeladonGameCorner.asm
+++ b/maps/CeladonGameCorner.asm
@@ -341,7 +341,7 @@
 	person_event SPRITE_POKEFAN_M, 10, 14, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, PokefanMScript_0x72123, -1
 	person_event SPRITE_TEACHER, 7, 17, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, TeacherScript_0x7212e, -1
 	person_event SPRITE_FISHING_GURU, 7, 11, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, PERSONTYPE_SCRIPT, 0, FishingGuruScript_0x72139, -1
-	person_event SPRITE_FISHER, 10, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, (1 << DAY), PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, FisherScript_0x72144, -1
-	person_event SPRITE_FISHER, 10, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, (1 << NITE), PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, FisherScript_0x72144, -1
+	person_event SPRITE_FISHER, 10, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, DAY, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, FisherScript_0x72144, -1
+	person_event SPRITE_FISHER, 10, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, NITE, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, FisherScript_0x72144, -1
 	person_event SPRITE_GYM_GUY, 3, 11, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, CeladonGymGuyScript, -1
 	person_event SPRITE_GRAMPS, 8, 2, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_GREEN, PERSONTYPE_SCRIPT, 0, GrampsScript_0x72190, -1
--- a/maps/GoldenrodDeptStoreElevator.asm
+++ b/maps/GoldenrodDeptStoreElevator.asm
@@ -46,13 +46,13 @@
 
 Elevator_0x566e0:
 	db 7 ; floors
-	elevfloor _B1F, 2, GOLDENROD_DEPT_STORE_B1F
-	elevfloor _1F,  4, GOLDENROD_DEPT_STORE_1F
-	elevfloor _2F,  3, GOLDENROD_DEPT_STORE_2F
-	elevfloor _3F,  3, GOLDENROD_DEPT_STORE_3F
-	elevfloor _4F,  3, GOLDENROD_DEPT_STORE_4F
-	elevfloor _5F,  3, GOLDENROD_DEPT_STORE_5F
-	elevfloor _6F,  2, GOLDENROD_DEPT_STORE_6F
+	elevfloor FLOOR_B1F, 2, GOLDENROD_DEPT_STORE_B1F
+	elevfloor FLOOR_1F,  4, GOLDENROD_DEPT_STORE_1F
+	elevfloor FLOOR_2F,  3, GOLDENROD_DEPT_STORE_2F
+	elevfloor FLOOR_3F,  3, GOLDENROD_DEPT_STORE_3F
+	elevfloor FLOOR_4F,  3, GOLDENROD_DEPT_STORE_4F
+	elevfloor FLOOR_5F,  3, GOLDENROD_DEPT_STORE_5F
+	elevfloor FLOOR_6F,  2, GOLDENROD_DEPT_STORE_6F
 	db -1 ; end
 
 
--- a/maps/GoldenrodGameCorner.asm
+++ b/maps/GoldenrodGameCorner.asm
@@ -493,8 +493,8 @@
 	person_event SPRITE_CLERK, 2, 3, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, GoldenrodGmeCornerCoinVendorScript, -1
 	person_event SPRITE_RECEPTIONIST, 2, 16, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, GoldenrodGmeCornerTMVendorScript, -1
 	person_event SPRITE_RECEPTIONIST, 2, 18, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPrizeMonVendorScript, -1
-	person_event SPRITE_PHARMACIST, 7, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, (1 << DAY), PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1
-	person_event SPRITE_PHARMACIST, 7, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, (1 << NITE), PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1
+	person_event SPRITE_PHARMACIST, 7, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, DAY, PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1
+	person_event SPRITE_PHARMACIST, 7, 8, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, NITE, PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1
 	person_event SPRITE_POKEFAN_M, 10, 11, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BROWN, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanM1Script, -1
 	person_event SPRITE_COOLTRAINER_M, 8, 14, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BLUE, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerCooltrainerMScript, -1
 	person_event SPRITE_POKEFAN_F, 6, 17, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanFScript, -1
--- a/maps/KrissHouse1F.asm
+++ b/maps/KrissHouse1F.asm
@@ -410,7 +410,7 @@
 .PersonEvents:
 	db 5
 	person_event SPRITE_MOM, 4, 7, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_1
-	person_event SPRITE_MOM, 2, 2, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, (1 << MORN), 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
-	person_event SPRITE_MOM, 4, 7, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, (1 << DAY), 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
-	person_event SPRITE_MOM, 2, 0, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, (1 << NITE), 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
+	person_event SPRITE_MOM, 2, 2, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, MORN, 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
+	person_event SPRITE_MOM, 4, 7, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, DAY, 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
+	person_event SPRITE_MOM, 2, 0, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, NITE, 0, PERSONTYPE_SCRIPT, 0, MomScript_0x7a582, EVENT_KRISS_HOUSE_MOM_2
 	person_event SPRITE_POKEFAN_F, 4, 4, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, PERSONTYPE_SCRIPT, 0, NeighborScript, EVENT_KRISS_HOUSE_1F_NEIGHBOR
--- a/maps/MountMoonGiftShop.asm
+++ b/maps/MountMoonGiftShop.asm
@@ -44,7 +44,7 @@
 
 .PersonEvents:
 	db 4
-	person_event SPRITE_GRAMPS, 3, 4, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, (1 << MORN), 0, PERSONTYPE_SCRIPT, 0, GrampsScript_0x771a8, -1
-	person_event SPRITE_GRAMPS, 2, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, (1 << DAY), 0, PERSONTYPE_SCRIPT, 0, GrampsScript_0x771a8, -1
-	person_event SPRITE_LASS, 6, 1, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 0, 1, -1, (1 << MORN), 0, PERSONTYPE_SCRIPT, 0, LassScript_0x771b0, -1
-	person_event SPRITE_LASS, 4, 5, SPRITEMOVEDATA_WALK_UP_DOWN, 1, 0, -1, (1 << DAY), 0, PERSONTYPE_SCRIPT, 0, LassScript_0x771b0, -1
+	person_event SPRITE_GRAMPS, 3, 4, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, MORN, 0, PERSONTYPE_SCRIPT, 0, GrampsScript_0x771a8, -1
+	person_event SPRITE_GRAMPS, 2, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, DAY, 0, PERSONTYPE_SCRIPT, 0, GrampsScript_0x771a8, -1
+	person_event SPRITE_LASS, 6, 1, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 0, 1, -1, MORN, 0, PERSONTYPE_SCRIPT, 0, LassScript_0x771b0, -1
+	person_event SPRITE_LASS, 4, 5, SPRITEMOVEDATA_WALK_UP_DOWN, 1, 0, -1, DAY, 0, PERSONTYPE_SCRIPT, 0, LassScript_0x771b0, -1
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -556,7 +556,7 @@
 
 .GetMapPalsIndex: ; 8a0c
 	ld a, [TimeOfDayPal]
-	cp NITE
+	cp NITE_F
 	jr c, .morn_day
 	ld a, $19
 	ret