shithub: pokecrystal

Download patch

ref: dca6fd37cd16d12b1f35174bcf278d41138903d5
parent: 425b727784801b0d1f2e45f7329a1129f7172f48
author: yenatch <[email protected]>
date: Tue Jul 2 10:10:49 EDT 2013

start using relevant constants in wram.asm

--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9953,7 +9953,7 @@
 	ld [$d123], a
 	ld a, [hl]
 	ld [$d124], a
-	ld a, $3
+	ld a, 3
 	ld [MonType], a
 	ld a, $14
 	ld hl, $4bdd
--- a/constants.asm
+++ b/constants.asm
@@ -184,22 +184,6 @@
 ICON_BIGMON        EQU $26
 
 
-; days of the week
-SUNDAY    EQU 0
-MONDAY    EQU 1
-TUESDAY   EQU 2
-WEDNESDAY EQU 3
-THURSDAY  EQU 4
-FRIDAY    EQU 5
-SATURDAY  EQU 6
-
-; time of day
-MORN     EQU 0
-DAY      EQU 1
-NITE     EQU 2
-DARKNESS EQU 3
-
-
 ; evolution types
 EVOLVE_LEVEL     EQU 1
 EVOLVE_ITEM      EQU 2
@@ -220,23 +204,6 @@
 ATK_EQ_DEF EQU 3
 
 
-; main menu
-CONTINUE       EQU 0
-NEW_GAME       EQU 1
-OPTION         EQU 2
-MYSTERY_GIFT   EQU 3
-MOBILE         EQU 4
-MOBILE_STUDIUM EQU 5
-
-; kris's pc menu items
-WITHDRAW_ITEM EQU 0
-DEPOSIT_ITEM  EQU 1
-TOSS_ITEM     EQU 2
-MAIL_BOX      EQU 3
-DECORATION    EQU 4
-TURN_OFF      EQU 5
-LOG_OFF       EQU 6
-
 ; name length
 PLAYER_NAME_LENGTH EQU 8
 PKMN_NAME_LENGTH EQU 11
@@ -258,20 +225,10 @@
 CHECK_FLAG EQU 2
 
 
-; player states
-PLAYER_NORMAL    EQU 0
-PLAYER_BIKE      EQU 1
-PLAYER_SLIP      EQU 2
-PLAYER_SURF      EQU 4
-PLAYER_SURF_PIKA EQU 8
-
-
 ; joypad
 BUTTONS    EQU %00010000
 D_PAD      EQU %00100000
 
-AUTO_INPUT EQU $ff
-
 NO_INPUT   EQU %00000000
 BUTTON_A   EQU %00000001
 BUTTON_B   EQU %00000010
@@ -284,12 +241,6 @@
 
 
 ; movement
-STANDING EQU -1
-DOWN  EQU 0
-UP    EQU 1
-LEFT  EQU 2
-RIGHT EQU 3
-
 STEP_SLOW EQU 0
 STEP_WALK EQU 1
 STEP_BIKE EQU 2
@@ -299,19 +250,4 @@
 STEP_BACK_LEDGE EQU 6
 STEP_WALK_IN_PLACE EQU 7
 
-; facing
-FACE_CURRENT EQU 0
-FACE_DOWN  EQU 8
-FACE_UP    EQU 4
-FACE_LEFT  EQU 2
-FACE_RIGHT EQU 1
-
-
-; Provisional wram bank 5 labels:
-
-; 8 4-color palettes
-Unkn1Pals EQU $d000
-Unkn2Pals EQU $d040
-BGPals    EQU $d080
-OBPals    EQU $d0c0
 
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -448,7 +448,7 @@
 
 	xor a
 	ld [CurPartyMon], a
-	ld a, $2
+	ld a, BOXMON
 	ld [MonType], a
 	ld de, $d050
 	ld b, $0
@@ -775,7 +775,7 @@
 	push de
 	ld a, [TempEnemyMonSpecies]
 	ld [CurPartySpecies], a
-	ld a, $4
+	ld a, WILDMON
 	ld [MonType], a
 	ld a, $14
 	ld hl, $4bdd
--- a/main.asm
+++ b/main.asm
@@ -8200,7 +8200,8 @@
 OpenPartyStats: ; 12e00
 	call $1d6e
 	call ClearSprites
-	xor a ; partymon
+; PartyMon
+	xor a
 	ld [MonType], a
 	call LowVolume
 	ld a, $25
@@ -8255,7 +8256,7 @@
 GetTimeOfDay: ; 14032
 ; get time of day based on the current hour
 	ld a, [hHours] ; hour
-	ld hl, TimeOfDayTable
+	ld hl, TimesOfDay
 	
 .check
 ; if we're within the given time period,
@@ -8276,14 +8277,13 @@
 	ret
 ; 14044
 
-TimeOfDayTable: ; 14044
-; boundaries for the time of day
+TimesOfDay: ; 14044
+; hours for the time of day
 ; 04-09 morn | 10-17 day | 18-03 nite
-;	   hr, time of day
-	db 04, $02 ; NITE
-	db 10, $00 ; MORN
-	db 18, $01 ; DAY
-	db 24, $02 ; NITE
+	db 04, NITE
+	db 10, MORN
+	db 18, DAY
+	db 24, NITE
 ; 1404c
 
 INCBIN "baserom.gbc", $1404c, $152ab - $1404c
@@ -8323,8 +8323,8 @@
 
 KrissPCMenuData: ; 0x15736
 	db %01000000
-	db 0, 0 ; top left corner coords (y, x)
-	db $c, $f ; bottom right corner coords (y, x)
+	db  0,  0 ; top left corner coords (y, x)
+	db 12, 15 ; bottom right corner coords (y, x)
 	dw .KrissPCMenuData2
 	db 1 ; default selected option
 
@@ -8337,36 +8337,30 @@
 	dw .KrissPCMenuPointers
 
 .KrissPCMenuPointers ; 0x15746
-	dw KrisWithdrawItemMenu ; 57d1
-	dw .WithdrawItem
-	dw KrisDepositItemMenu ; 588b
-	dw .DepositItem
-	dw KrisTossItemMenu ; 585f
-	dw .TossItem
-	dw KrisMailBoxMenu ; 587d
-	dw .MailBox
-	dw KrisDecorationMenu ; 597d
-	dw .Decoration
-	dw KrisLogOffMenu ; 5888
-	dw .LogOff
-	dw KrisLogOffMenu ; 5888
-	dw .TurnOff
+	dw KrisWithdrawItemMenu, .WithdrawItem
+	dw KrisDepositItemMenu,  .DepositItem
+	dw KrisTossItemMenu,     .TossItem
+	dw KrisMailBoxMenu,      .MailBox
+	dw KrisDecorationMenu,   .Decoration
+	dw KrisLogOffMenu,       .LogOff
+	dw KrisLogOffMenu,       .TurnOff
 
-.WithdrawItem
-	db "WITHDRAW ITEM@"
-.DepositItem
-	db "DEPOSIT ITEM@"
-.TossItem
-	db "TOSS ITEM@"
-.MailBox
-	db "MAIL BOX@"
-.Decoration
-	db "DECORATION@"
-.TurnOff
-	db "TURN OFF@"
-.LogOff
-	db "LOG OFF@"
+.WithdrawItem db "WITHDRAW ITEM@"
+.DepositItem  db "DEPOSIT ITEM@"
+.TossItem     db "TOSS ITEM@"
+.MailBox      db "MAIL BOX@"
+.Decoration   db "DECORATION@"
+.TurnOff      db "TURN OFF@"
+.LogOff       db "LOG OFF@"
 
+WITHDRAW_ITEM EQU 0
+DEPOSIT_ITEM  EQU 1
+TOSS_ITEM     EQU 2
+MAIL_BOX      EQU 3
+DECORATION    EQU 4
+TURN_OFF      EQU 5
+LOG_OFF       EQU 6
+
 .KrissPCMenuList1
 	db 5
 	db WITHDRAW_ITEM
@@ -8374,7 +8368,7 @@
 	db TOSS_ITEM
 	db MAIL_BOX
 	db TURN_OFF
-	db $FF
+	db $ff
 
 .KrissPCMenuList2
 	db 6
@@ -8384,7 +8378,7 @@
 	db MAIL_BOX
 	db DECORATION
 	db LOG_OFF
-	db $FF
+	db $ff
 
 INCBIN "baserom.gbc", $157bb, $157d1 - $157bb
 
@@ -12010,6 +12004,13 @@
 	dw $5efc ; XXX is this MobileASM?
 	dw $6496 ; XXX is this MobileStudiumASM?
 
+CONTINUE       EQU 0
+NEW_GAME       EQU 1
+OPTION         EQU 2
+MYSTERY_GIFT   EQU 3
+MOBILE         EQU 4
+MOBILE_STUDIUM EQU 5
+
 NewGameMenu: ; 0x49d6c
 	db 2
 	db NEW_GAME
@@ -13358,7 +13359,7 @@
 	
 ; BoxMon data is read directly from SRAM.
 	ld a, [MonType]
-	cp 2
+	cp BOXMON
 	ld a, 1
 	call z, GetSRAMBank
 	
@@ -13376,8 +13377,8 @@
 	ld b, a
 
 ; Close SRAM if we were dealing with a BoxMon.
-	ld a, [MonType] ; MonType
-	cp 2 ; BOXMON
+	ld a, [MonType]
+	cp BOXMON
 	call z, CloseSRAM
 	
 	
--- a/wram.asm
+++ b/wram.asm
@@ -10,12 +10,14 @@
 VBGMap1:
 
 
-; So far, WRAM banks 0 and 1 are included in this file.
-; Any bank 2-7 labels are in constants.asm.
+; WRAM banks 0 and 1 are included as BSS labels.
+; Other WRAM banks (2-7) are constants for now.
 
 
+SECTION "WRAMBank0",BSS[$c000]
+
 SECTION "stack",BSS[$c000]
-	ds 256
+	ds $100
 Stack: ; c100
 
 
@@ -65,10 +67,7 @@
 Channel1LastMusicAddress: ; c109
 	ds 2
 ; could have been meant as a third-level address
-; unused? ; c10b
-	ds 1
-; unused? ; c10c
-	ds 1
+	ds 2
 Channel1NoteFlags: ; c10d
 ; 0: 
 ; 1: 
@@ -312,8 +311,7 @@
 
 SECTION "auto",BSS[$c2c7]
 InputType: ; c2c7
-; 00 normal
-; ff auto
+AUTO_INPUT EQU $ff
 	ds 1
 AutoInputAddress: ; c2c8
 	ds 2
@@ -824,11 +822,10 @@
 	ds 30
 	
 MonType: ; cf5f
-; 0 partymon
-; 1 otpartymon
-; 2 boxmon
-; 3 ????mon
-; 4 wildmon
+PARTYMON   EQU 0
+OTPARTYMON EQU 1
+BOXMON     EQU 2
+WILDMON    EQU 4
 	ds 1
 
 CurSpecies: ; cf60
@@ -907,7 +904,9 @@
 
 	ds 46
 	
-; d000
+
+SECTION "WRAMBank1",BSS[$d000]
+
 	ds 2
 	
 DefaultFlypoint: ; d002
@@ -937,10 +936,23 @@
 
 MovementAnimation: ; d042
 	ds 1
+
 WalkingDirection: ; d043
+STANDING EQU -1
+DOWN     EQU 0
+UP       EQU 1
+LEFT     EQU 2
+RIGHT    EQU 3
 	ds 1
+
 FacingDirection: ; d044
+FACE_CURRENT EQU 0
+FACE_DOWN  EQU 8
+FACE_UP    EQU 4
+FACE_LEFT  EQU 2
+FACE_RIGHT EQU 1
 	ds 1
+
 WalkingX: ; d045
 	ds 1
 WalkingY: ; d046
@@ -1378,10 +1390,10 @@
 SECTION "TimeOfDay",BSS[$d269]
 
 TimeOfDay: ; d269
-; 0 morn
-; 1 day
-; 2 nite
-; 3 darkness
+MORN     EQU 0
+DAY      EQU 1
+NITE     EQU 2
+DARKNESS EQU 3
 	ds 1
 
 SECTION "OTParty",BSS[$d280]
@@ -1568,6 +1580,13 @@
 	ds 2
 
 CurDay: ; d4cb
+SUNDAY    EQU 0
+MONDAY    EQU 1
+TUESDAY   EQU 2
+WEDNESDAY EQU 3
+THURSDAY  EQU 4
+FRIDAY    EQU 5
+SATURDAY  EQU 6
 	ds 1
 
 	ds 12
@@ -1660,10 +1679,11 @@
 	
 SECTION "overworld",BSS[$d95d]
 PlayerState: ; d95d
-; $00: normal
-; $01: bicycle
-; $04: surf
-; $08: surf (pikachu)
+PLAYER_NORMAL    EQU 0
+PLAYER_BIKE      EQU 1
+PLAYER_SLIP      EQU 2
+PLAYER_SURF      EQU 4
+PLAYER_SURF_PIKA EQU 8
 	ds 1
 
 SECTION "scriptram",BSS[$d962]
@@ -2005,3 +2025,17 @@
 	ds 1
 RoamMon3DVs: ; dfe2
 	ds 2
+
+
+
+; SECTION "WRAMBank5",BSS[$d000]
+
+; 8 4-color palettes
+Unkn1Pals EQU $d000
+Unkn2Pals EQU $d040
+BGPals    EQU $d080
+OBPals    EQU $d0c0
+
+
+
+