-
Notifications
You must be signed in to change notification settings - Fork 43
/
wram.asm
executable file
·2379 lines (1901 loc) · 43.4 KB
/
wram.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
INCLUDE "constants.asm"
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
box_struct_length EQU 25 + NUM_MOVES * 2
box_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1OTID:: dw
\1Exp:: ds 3
\1HPExp:: dw
\1AttackExp:: dw
\1DefenseExp:: dw
\1SpeedExp:: dw
\1SpecialExp:: dw
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
ENDM
party_struct: MACRO
box_struct \1
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
ENDM
battle_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
\1PP:: ds NUM_MOVES
ENDM
SECTION "WRAM Bank 0", WRAM0
wc000:: ds 1
wc001:: ds 1
wc002:: ds 1
wc003:: ds 1
wc004:: ds 1
wc005:: ds 1
wc006:: ds 8
wc00e:: ds 4
wc012:: ds 4
wc016:: ds 16
wc026:: ds 1
wc027:: ds 1
wc028:: ds 2
wc02a:: ds 1
wc02b:: ds 1
wc02c:: ds 1
wc02d:: ds 1
wc02e:: ds 8
wc036:: ds 8
wc03e:: ds 8
wc046:: ds 8
wc04e:: ds 8
wc056:: ds 8
wc05e:: ds 8
wc066:: ds 8
wc06e:: ds 8
wc076:: ds 8
wc07e:: ds 8
wc086:: ds 8
wc08e:: ds 8
wc096:: ds 8
wc09e:: ds 8
wc0a6:: ds 8
wc0ae:: ds 8
wc0b6:: ds 8
wc0be:: ds 8
wc0c6:: ds 8
wc0ce:: ds 1
wc0cf:: ds 1
wc0d0:: ds 1
wc0d1:: ds 1
wc0d2:: ds 1
wc0d3:: ds 1
wc0d4:: ds 1
wc0d5:: ds 1
wc0d6:: ds 8
wc0de:: ds 8
wc0e6:: ds 1
wc0e7:: ds 1
wc0e8:: ds 1
wc0e9:: ds 1
wc0ea:: ds 1
wc0eb:: ds 1
wc0ec:: ds 1
wc0ed:: ds 1
wc0ee:: ds 1
wc0ef:: ds 1
wc0f0:: ds 1
wc0f1:: ds 1
wc0f2:: ds 14
SECTION "Sprite State Data", WRAM0[$c100]
wSpriteDataStart::
wSpriteStateData1:: ; c100
; data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C1x0: picture ID (fixed, loaded at map init)
; C1x1: movement status (0: uninitialized, 1: ready, 2: delayed, 3: moving)
; C1x2: sprite image index (changed on update, $ff if off screen, includes facing direction, progress in walking animation and a sprite-specific offset)
; C1x3: Y screen position delta (-1,0 or 1; added to c1x4 on each walking animation update)
; C1x4: Y screen position (in pixels, always 4 pixels above grid which makes sprites appear to be in the center of a tile)
; C1x5: X screen position delta (-1,0 or 1; added to c1x6 on each walking animation update)
; C1x6: X screen position (in pixels, snaps to grid if not currently walking)
; C1x7: intra-animation-frame counter (counting upwards to 4 until c1x8 is incremented)
; C1x8: animation frame counter (increased every 4 updates, hold four states (totalling to 16 walking frames)
; C1x9: facing direction (0: down, 4: up, 8: left, $c: right)
; C1xA
; C1xB
; C1xC
; C1xD
; C1xE
; C1xF
ds $10 * $10
;SECTION "Sprite State Data 2", WRAM0[$c200]
wSpriteStateData2:: ; c200
; more data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C2x0: walk animation counter (counting from $10 backwards when moving)
; C2x1:
; C2x2: Y displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x3: X displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x4: Y position (in 2x2 tile grid steps, topmost 2x2 tile has value 4)
; C2x5: X position (in 2x2 tile grid steps, leftmost 2x2 tile has value 4)
; C2x6: movement byte 1 (determines whether a sprite can move, $ff:not moving, $fe:random movements, others unknown)
; C2x7: (?) (set to $80 when in grass, else $0; may be used to draw grass above the sprite)
; C2x8: delay until next movement (counted downwards, status (c1x1) is set to ready if reached 0)
; C2x9
; C2xA
; C2xB
; C2xC
; C2xD
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
; C2xF
ds $10 * $10
wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0[$c300]
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds 20 * 18
wSerialPartyMonsPatchList:: ; c508
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
wTileMapBackup:: ; c508
; buffer for temporarily saving and restoring current screen's tiles
; (e.g. if menus are drawn on top)
; ds 20 * 18
ds 200
wSerialEnemyMonsPatchList:: ; c5d0
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
ds 200
ds 80
wTempMoveID::
wTempPic::
wOverworldMap:: ; c6e8
ds 1300
wScreenEdgeTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
ds 20 * 2
; coordinates of the position of the cursor for the top menu item (id 0)
wTopMenuItemY:: ; cc24
ds 1
wTopMenuItemX:: ; cc25
ds 1
wCurrentMenuItem:: ; cc26
; the id of the currently selected menu item
; the top item has id 0, the one below that has id 1, etc.
; note that the "top item" means the top item currently visible on the screen
; add this value to [wListScrollOffset] to get the item's position within the list
ds 1
wTileBehindCursor:: ; cc27
; the tile that was behind the menu cursor's current location
ds 1
wMaxMenuItem:: ; cc28
; id of the bottom menu item
ds 1
wMenuWatchedKeys:: ; cc29
; bit mask of keys that the menu will respond to
ds 1
wLastMenuItem:: ; cc2a
; id of previously selected menu item
ds 1
wcc2b:: ds 1
wcc2c:: ds 1
wcc2d:: ds 1
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
ds 1
wMenuCursorLocation:: ; cc30
; the address of the menu cursor's current location within wTileMap
ds 2
ds 2
wMenuJoypadPollCount:: ; cc34
; how many times should HandleMenuInput poll the joypad state before it returns?
ds 1
wMenuItemToSwap:: ; cc35
; id of menu item selected for swapping (counts from 1) (0 means that no menu item has been selected for swapping)
ds 1
wListScrollOffset:: ; cc36
; offset of the current top menu item from the beginning of the list
; keeps track of what section of the list is on screen
ds 1
wcc37:: ds 1
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
wcc3a:: ds 1
wcc3b:: ds 1
wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID
ds 1
wSerialSyncAndExchangeNybbleReceiveData:: ; cc3d
; the final received nybble is stored here by Serial_SyncAndExchangeNybble
wSerialExchangeNybbleTempReceiveData:: ; cc3d
; temporary nybble used by Serial_ExchangeNybble
wLinkMenuSelectionReceiveBuffer:: ; cc3d
; two byte buffer
; the received menu selection is stored twice
wcc3d:: ds 1
wSerialExchangeNybbleReceiveData:: ; cc3e
; the final received nybble is stored here by Serial_ExchangeNybble
ds 1
ds 3
wSerialExchangeNybbleSendData:: ; cc42
; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble
wLinkMenuSelectionSendBuffer:: ; cc42
; two byte buffer
; the menu selection byte is stored twice before sending
ds 5
wLinkTimeoutCounter:: ; cc47
; 1 byte
wUnknownSerialCounter:: ; cc47
; 2 bytes
wcc47:: ds 1
wcc48:: ds 1
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
wcc49:: ds 1
wMenuWrappingEnabled:: ; cc4a
; set to 1 if you can go from the bottom to the top or top to bottom of a menu
; set to 0 if you can't go past the top or bottom of the menu
ds 1
wcc4b:: ds 2
wcc4d:: ds 1
wPredefID:: ; cc4e
ds 1
wPredefRegisters:: ; cc4f
ds 6
wTrainerHeaderFlagBit:: ; cc55
ds 1
ds 1
wNPCMovementScriptPointerTableNum:: ; cc57
; which NPC movement script pointer is being used
; 0 if an NPC movement script is not running
ds 1
wNPCMovementScriptBank:: ; cc58
; ROM bank of current NPC movement script
ds 1
ds 2
wHallOfFame:: ; cc5b
wcc5b:: ds 1
wcc5c:: ds 1
wcc5d:: ds 1
wcc5e:: ds 13
wcc6b:: ds 14
wcc79:: ds 30
wNPCMovementDirections2:: ; cc97
wSwitchPartyMonTempBuffer:: ; cc97
; temporary buffer when swapping party mon data
ds 10
wcca1:: ds 49
wRLEByteCount:: ; ccd2
ds 1
wSimulatedJoypadStatesEnd:: ; ccd3
; this is the end of the joypad states
; the list starts above this address and extends downwards in memory until here
; overloaded with below labels
wccd3:: ds 1
wccd4:: ds 1
wccd5:: ds 2
; current HP of player and enemy substitutes
wPlayerSubstituteHP:: ; ccd7
ds 1
wEnemySubstituteHP:: ; ccd8
ds 1
wccd9:: ds 2
wMoveMenuType:: ; ccdb
; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
ds 1
wPlayerSelectedMove:: ; ccdc
ds 1
wEnemySelectedMove:: ; ccdd
ds 1
wLinkBattleRandomNumberListIndex:: ; ccde
ds 1
wAICount:: ; ccdf
; number of times remaining that AI action can occur
ds 1
ds 2
wEnemyMoveListIndex:: ; cce2
ds 1
wcce3:: ds 1
wcce4:: ds 1
wTotalPayDayMoney:: ; cce5
; total amount of money made using Pay Day during the current battle
ds 3
wSafariEscapeFactor:: ; cce8
ds 1
wSafariBaitFactor:: ; cce9
ds 1;
ds 1
wcceb:: ds 1
wccec:: ds 1
wcced:: ds 1
wccee:: ds 1
wccef:: ds 1
wccf0:: ds 1
wPlayerUsedMove:: ds 1
wEnemyUsedMove:: ds 1
wccf3:: ds 1
wccf4:: ds 1
wPartyFoughtCurrentEnemyFlags::
; flags that indicate which party members have fought the current enemy mon
flag_array 6
wccf6:: ds 1
wccf7:: ds 14
wUnknownSlotVar:: ; cd05
wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc.
wEnemyBideAccumulatedDamage:: ; cd05
; the amount of damage accumulated by the enemy while biding (2 bytes)
ds 10
wInGameTradeGiveMonSpecies:: ; cd0f
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 1
wInGameTradeTextPointerTablePointer:: ; cd10
wPlayerMonUnmodifiedMaxHP:: ; cd10
ds 2
wInGameTradeTextPointerTableIndex:: ; cd12
wPlayerMonUnmodifiedAttack:: ; cd12
ds 1
wInGameTradeGiveMonName:: ; cd13
ds 1
wPlayerMonUnmodifiedDefense:: ; cd14
ds 2
wPlayerMonUnmodifiedSpeed:: ; cd16
ds 2
wPlayerMonUnmodifiedSpecial:: ; cd18
ds 2
; stat modifiers for the player's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wPlayerMonStatMods::
wPlayerMonAttackMod:: ; cd1a
ds 1
wPlayerMonDefenseMod:: ; cd1b
ds 1
wPlayerMonSpeedMod:: ; cd1c
ds 1
wPlayerMonSpecialMod:: ; cd1d
ds 1
wInGameTradeReceiveMonName:: ; cd1e
wPlayerMonAccuracyMod:: ; cd1e
ds 1
wPlayerMonEvasionMod:: ; cd1f
ds 1
ds 3
wEnemyMonUnmodifiedLevel:: ; cd23
ds 1
wEnemyMonUnmodifiedMaxHP:: ; cd24
ds 2
wEnemyMonUnmodifiedAttack:: ; cd26
ds 2
wEnemyMonUnmodifiedDefense:: ; cd28
ds 1
wInGameTradeMonNick:: ; cd29
ds 1
wEnemyMonUnmodifiedSpeed:: ; cd2a
ds 2
wEnemyMonUnmodifiedSpecial:: ; cd2c
ds 1
wEngagedTrainerClass:: ; cd2d
ds 1
wEngagedTrainerSet:: ; cd2e
; ds 1
; stat modifiers for the enemy's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wEnemyMonStatMods::
wEnemyMonAttackMod:: ; cd2e
ds 1
wEnemyMonDefenseMod:: ; cd2f
ds 1
wEnemyMonSpeedMod:: ; cd30
ds 1
wEnemyMonSpecialMod:: ; cd31
ds 1
wEnemyMonAccuracyMod:: ; cd32
ds 1
wEnemyMonEvasionMod:: ; cd33
ds 1
wInGameTradeReceiveMonSpecies::
ds 1
ds 2
wNPCMovementDirections2Index:: ; cd37
wcd37:: ds 1
wSimulatedJoypadStatesIndex:: ; cd38
; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1
; 0 if the joypad state is not being simulated
ds 1
wWastedByteCD39:: ; cd39
; written to but nothing ever reads it
ds 1
wWastedByteCD3A:: ; cd3a
; written to but nothing ever reads it
ds 1
wOverrideSimulatedJoypadStatesMask:: ; cd3b
; mask indicating which real button presses can override simulated ones
; XXX is it ever not 0?
ds 1
ds 1
wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d
wChangeBoxSavedMapTextPointer:: ; cd3d
wFlyAnimUsingCoordList:: ; cd3d
wPlayerSpinInPlaceAnimFrameDelay:: ; cd3d
wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d
wHiddenObjectFunctionArgument:: ; cd3d
wSubtrahend:: ; cd3d
; subtract (BCD) wSubtrahend, wSubtrahend+1, wSubtrahend+2
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
wTrainerSpriteOffset:: ; cd3d
ds 1
wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e
wFlyAnimCounter:: ; cd3e
wPlayerSpinInPlaceAnimFrameDelayDelta:: ; cd3e
wPlayerSpinWhileMovingUpOrDownAnimMaxY:: ; cd3e
wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e
ds 1
wNameOfPlayerMonToBeTraded:: ; cd3f
wFlyAnimBirdSpriteImageIndex:: ; cd3f
wPlayerSpinInPlaceAnimFrameDelayEndValue:: ; cd3f
wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: ; cd3f
wHiddenObjectIndex:: ; cd3f
wTrainerFacingDirection:: ; cd3f
wcd3f::
ds 1
wPlayerSpinInPlaceAnimSoundID:: ; cd40
wHiddenObjectY:: ; cd40
wTrainerScreenY:: ; cd40
ds 1
wTradedPlayerMonOT:: ; cd41
wHiddenObjectX:: ; cd41
wTrainerScreenX:: ; cd41
ds 1
wcd42:: ds 1
wcd43:: ds 1
wcd44:: ds 1
wcd45:: ds 1
wcd46:: ds 1
wcd47:: ds 1
wcd48:: ds 1
wcd49:: ds 1
wcd4a:: ds 1
wcd4b:: ds 1
wTradedPlayerMonOTID:: ; cd4c
wcd4c:: ds 1
wcd4d:: ds 1
wTradedEnemyMonOT:: ; cd4e
wcd4e:: ds 1
wcd4f:: ds 1
wcd50:: ds 9
wTradedEnemyMonOTID:: ; cd59
ds 2
wcd5b:: ds 1
wcd5c:: ds 1
wcd5d:: ds 1
wcd5e:: ds 1
wcd5f:: ds 1
wFlags_0xcd60:: ; cd60
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously)
; bit 1: boulder dust animation (from using Strength) pending
; bit 5: don't play sound when A or B is pressed in menu
; bit 6: tried pushing against boulder once (you need to push twice before it will move)
ds 1
ds 9
wcd6a:: ds 1
wJoyIgnore:: ; cd6b
; Set buttons are ignored.
ds 1
wcd6c:: ds 1
wcd6d:: ds 4
wcd71:: ds 1
wcd72:: ds 5
wcd77:: ds 1
wcd78:: ds 9
wSerialOtherGameboyRandomNumberListBlock:: ; cd81
; buffer for transferring the random number list generated by the other gameboy
wTileMapBackup2:: ; cd81
; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
ds 20 * 18
wBuffer:: ; cee9
; Temporary storage area of 30 bytes.
wHPBarMaxHP:: ; cee9
ds 2
wHPBarOldHP:: ; ceeb
ds 2
wHPBarNewHP:: ; ceed
ds 2
wHPBarDelta:: ; ceef
ds 1
wcef0:: ds 1
wcef1:: ds 12
wHPBarHPDifference:: ; cefd
ds 1
ds 7
wcf05:: ds 1
wcf06:: ds 1
wAnimSoundID:: ; cf07
; sound ID during battle animations
ds 1
wcf08:: ds 1
wcf09:: ds 1
wcf0a:: ds 1
wBattleResult:: ; cf0b
; $00 - win
; $01 - lose
; $02 - draw
ds 1
wAutoTextBoxDrawingControl:: ; cf0c
; bit 0: if set, DisplayTextID automatically draws a text box
ds 1
wcf0d:: ds 1
wcf0e:: ds 1
wcf0f:: ds 1
wNPCMovementScriptFunctionNum:: ; cf10
; which script function within the pointer table indicated by
; wNPCMovementScriptPointerTableNum
ds 1
wcf11:: ds 1
wPredefParentBank:: ; cf12
ds 1
wSpriteIndex:: ds 1
wCurSpriteMovement2:: ; cf14
; movement byte 2 of current sprite
ds 1
ds 2
wNPCMovementScriptSpriteOffset:: ; cf17
; sprite offset of sprite being controlled by NPC movement script
ds 1
wcf18:: ds 2
wGBC:: ; cf1a
ds 1
wOnSGB:: ; cf1b
; if running on SGB, it's 1, else it's 0
ds 1
wcf1c:: ds 1
wcf1d:: ds 1
wcf1e:: ds 1
wcf1f:: ds 6
wcf25:: ds 8
wcf2d:: ds 1
wcf2e:: ds 2
wcf30:: ds 7
wcf37:: ds 20
wcf4b:: ds 1
wcf4c:: ds 1
wcf4d:: ds 18
wGymCityName:: ; cf5f
wStringBuffer1:: ; cf5f
ds 16 + 1
wGymLeaderName:: ; cf70
wStringBuffer2:: ; cf70
ds 16 + 1
wStringBuffer3:: ; cf81
ds 9 + 1
wList:: ; cf8b
ds 2
wcf8d:: ds 1
wcf8e:: ds 1
wItemPrices:: ; cf8f
ds 2
wcf91:: ds 1
wWhichPokemon:: ; cf92
; which pokemon you selected
ds 1
wcf93:: ds 1
wHPBarType:: ; cf94
; type of HP bar
; $00 = enemy HUD in battle
; $01 = player HUD in battle / status screen
; $02 = party menu
wListMenuID:: ; cf94
; ID used by DisplayListMenuID
ds 1
wcf95:: ds 1
wcf96:: ds 1
wcf97:: ds 1
; LoadMonData copies mon data here
wLoadedMon:: party_struct wLoadedMon ; cf98
wFontLoaded:: ; cfc4
; bit 0: The space in VRAM that is used to store walk animation tile patterns
; for the player and NPCs is in use for font tile patterns.
; This means that NPC movement must be disabled.
; The other bits are unused.
ds 1
wWalkCounter:: ; cfc5
; walk animation counter
ds 1
wTileInFrontOfPlayer:: ; cfc6
; background tile number in front of the player (either 1 or 2 steps ahead)
ds 1
wMusicHeaderPointer:: ; cfc7
; (the current music channel address - $4000) / 3
ds 1
wcfc8:: ds 1
wcfc9:: ds 1
wcfca:: ds 1
wUpdateSpritesEnabled:: ; cfcb
; $01 enables UpdateSprites; anything else disables it
ds 1
W_ENEMYMOVENUM:: ; cfcc
ds 1
W_ENEMYMOVEEFFECT:: ; cfcd
ds 1
W_ENEMYMOVEPOWER:: ; cfce
ds 1
W_ENEMYMOVETYPE:: ; cfcf
ds 1
W_ENEMYMOVEACCURACY:: ; cfd0
ds 1
W_ENEMYMOVEMAXPP:: ; cfd1
ds 1
W_PLAYERMOVENUM:: ; cfd2
ds 1
W_PLAYERMOVEEFFECT:: ; cfd3
ds 1
W_PLAYERMOVEPOWER:: ; cfd4
ds 1
W_PLAYERMOVETYPE:: ; cfd5
ds 1
W_PLAYERMOVEACCURACY:: ; cfd6
ds 1
W_PLAYERMOVEMAXPP:: ; cfd7
ds 1
wEnemyMonSpecies2:: ; cfd8
ds 1
wBattleMonSpecies2:: ; cfd9
ds 1
wEnemyMonNick:: ds 11 ; cfda
wEnemyMon:: ; cfe5
; The wEnemyMon struct reaches past 0xcfff,
; the end of wram bank 0 on cgb.
; This has no significance on dmg, where wram
; isn't banked (c000-dfff is contiguous).
; However, recent versions of rgbds have replaced
; dmg-style wram with cgb wram banks.
; Until this is fixed, this struct will have
; to be declared manually.
wEnemyMonSpecies:: db
wEnemyMonHP:: dw
wEnemyMonPartyPos::
wEnemyMonBoxLevel:: db
wEnemyMonStatus:: db
wEnemyMonType::
wEnemyMonType1:: db
wEnemyMonType2:: db
wEnemyMonCatchRate_NotReferenced:: db
wEnemyMonMoves:: ds NUM_MOVES
wEnemyMonDVs:: ds 2
wEnemyMonLevel:: db
wEnemyMonMaxHP:: dw
wEnemyMonAttack:: dw
wEnemyMonDefense:: dw
wEnemyMonSpeed:: dw
wEnemyMonSpecial:: dw
wEnemyMonPP:: ds 2 ; NUM_MOVES - 2
SECTION "WRAM Bank 1", WRAMX, BANK[1]
ds 2 ; NUM_MOVES - 2
wEnemyMonBaseStats:: ds 5
wEnemyMonCatchRate:: ds 1
wEnemyMonBaseExp:: ds 1
wBattleMonNick:: ds 11 ; d009
wBattleMon:: battle_struct wBattleMon ; d014
W_TRAINERCLASS:: ; d031
ds 1
ds 1
wTrainerPicID::
; Defaults to trainer class, can be changed with trainer type $FE
ds 1
wTrainerAINumber::
; Defaults to trainer class, can be changed with trainer type $FE
ds 1
wTrainerPicBank:: ds 1
wd033:: ds 1
wd034:: ds 2
wd036:: ds 16
wd046:: ds 1
wd047:: ds 1
wd048:: ds 2
W_TRAINERNAME:: ; d04a
; 13 bytes for the letters of the opposing trainer
; the name is terminated with $50 with possible
; unused trailing letters
ds 13
W_ISINBATTLE:: ; d057
; no battle, this is 0
; wild battle, this is 1
; trainer battle, this is 2
ds 1
wPartyGainExpFlags:: ; d058
; flags that indicate which party members should be be given exp when GainExperience is called
flag_array 6
W_CUROPPONENT:: ; d059
; in a wild battle, this is the species of pokemon
; in a trainer battle, this is the trainer class + $C8
ds 1
W_BATTLETYPE:: ; d05a
; in normal battle, this is 0
; in old man battle, this is 1
; in safari battle, this is 2
ds 1
wd05b:: ds 1
W_LONEATTACKNO:: ; d05c
; which entry in LoneAttacks to use
W_GYMLEADERNO:: ; d05c
; it's actually the same thing as ^
ds 1
W_TRAINERNO:: ; d05d
; which instance of [youngster, lass, etc] is this?
ds 1
wCriticalHitOrOHKO:: ; d05e
; $00 = normal attack
; $01 = critical hit
; $02 = successful OHKO
; $ff = failed OHKO
ds 1
W_MOVEMISSED:: ; d05f
ds 1
wPlayerStatsToDouble:: ; d060
; always 0
ds 1
wPlayerStatsToHalve:: ; d061