-
Notifications
You must be signed in to change notification settings - Fork 5
/
wram.asm
executable file
·3214 lines (2433 loc) · 67.3 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
\1PartyPos::
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
\1PP:: ds NUM_MOVES
ENDM
SECTION "Stack", WRAM0
wStack:: ; dfff
SECTION "Audio Engine WRAM", WRAM0
wMusic::
; nonzero if playing
wMusicPlaying:: db ; c100
wChannels::
wChannel1:: channel_struct wChannel1 ; c101
wChannel2:: channel_struct wChannel2 ; c133
wChannel3:: channel_struct wChannel3 ; c165
wChannel4:: channel_struct wChannel4 ; c197
wSFXChannels::
wChannel5:: channel_struct wChannel5 ; c1c9
wChannel6:: channel_struct wChannel6 ; c1fb
wChannel7:: channel_struct wChannel7 ; c22d
wChannel8:: channel_struct wChannel8 ; c25f
ds 1 ; c291
wCurTrackDuty:: db
wCurTrackIntensity:: db
wCurTrackFrequency:: dw
wUnusedBCDNumber:: db ; BCD value, dummied out
wCurNoteDuration:: db ; used in MusicE0 and LoadNote
wCurMusicByte:: db ; c298
wCurChannel:: db ; c299
wVolume:: ; c29a
; corresponds to rNR50
; Channel control / ON-OFF / Volume (R/W)
; bit 7 - Vin->SO2 ON/OFF
; bit 6-4 - SO2 output level (volume) (# 0-7)
; bit 3 - Vin->SO1 ON/OFF
; bit 2-0 - SO1 output level (volume) (# 0-7)
db
wSoundOutput:: ; c29b
; corresponds to rNR51
; bit 4-7: ch1-4 so2 on/off
; bit 0-3: ch1-4 so1 on/off
db
wSoundInput:: ; c29c
; corresponds to rNR52
; bit 7: global on/off
; bit 0: ch1 on/off
; bit 1: ch2 on/off
; bit 2: ch3 on/off
; bit 3: ch4 on/off
db
wMusicID:: dw ; c29d
wMusicBank:: db ; c29f
wNoiseSampleAddress:: dw ; c2a0
wNoiseSampleDelay:: db ; c2a2
ds 1 ; c2a3
wMusicNoiseSampleSet:: db ; c2a4
wSFXNoiseSampleSet:: db ; c2a5
;wLowHealthAlarm:: ; c2a6
; nb kept where it is in red instead
; bit 7: on/off
; bit 4: pitch
; bit 0-3: counter
db
wMusicFade:: ; c2a7
; fades volume over x frames
; bit 7: fade in/out
; bit 0-5: number of frames for each volume level
; $00 = none (default)
db
wMusicFadeCount:: db ; c2a8
wMusicFadeID:: dw ; c2a9
ds 5
wCryPitch:: dw ; c2b0
wCryLength:: dw ; c2b2
wLastVolume:: db ; c2b4
wUnusedMusicF9Flag:: db ; c2b5
wSFXPriority:: ; c2b6
; if nonzero, turn off music when playing sfx
db
ds 1
wChannel1JumpCondition:: db
wChannel2JumpCondition:: db
wChannel3JumpCondition:: db
wChannel4JumpCondition:: db
wStereoPanningMask:: db ; c2bc
wCryTracks:: ; c2bd
; plays only in left or right track depending on what side the monster is on
; both tracks active outside of battle
db
wSFXDuration:: db
wCurSFX:: ; c2bf
; id of sfx currently playing
db
wChannelsEnd::
wMapMusic:: db ; c2c0
wDontPlayMapMusicOnReload:: db
wContinuousSFX:: ds 1
wHaltAudio:: ds 1
wSFXDontWait:: ds 1
wFrequencyModifier:: ds 1
wTempoModifier:: ds 1
wMusicEnd::
SECTION "Sprite State Data", WRAM0
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
spritestatedata1: MACRO
\1PictureID:: db
\1MovementStatus:: db
\1ImageIndex:: db
\1YStepVector:: db
\1YPixels:: db
\1XStepVector:: db
\1XPixels:: db
\1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db
\1FacingDirection:: db
ds 6
\1End::
endm
wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1
wSprite01StateData1:: spritestatedata1 wSprite01StateData1
wSprite02StateData1:: spritestatedata1 wSprite02StateData1
wSprite03StateData1:: spritestatedata1 wSprite03StateData1
wSprite04StateData1:: spritestatedata1 wSprite04StateData1
wSprite05StateData1:: spritestatedata1 wSprite05StateData1
wSprite06StateData1:: spritestatedata1 wSprite06StateData1
wSprite07StateData1:: spritestatedata1 wSprite07StateData1
wSprite08StateData1:: spritestatedata1 wSprite08StateData1
wSprite09StateData1:: spritestatedata1 wSprite09StateData1
wSprite10StateData1:: spritestatedata1 wSprite10StateData1
wSprite11StateData1:: spritestatedata1 wSprite11StateData1
wSprite12StateData1:: spritestatedata1 wSprite12StateData1
wSprite13StateData1:: spritestatedata1 wSprite13StateData1
wSprite14StateData1:: spritestatedata1 wSprite14StateData1
wSprite15StateData1:: spritestatedata1 wSprite15StateData1
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
spritestatedata2: MACRO
\1WalkAnimationCounter:: db
ds 1
\1YDisplacement:: db
\1XDisplacement:: db
\1MapY:: db
\1MapX:: db
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
ds 5
\1ImageBaseOffset:: db
ds 1
\1End::
endm
wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2
wSprite01StateData2:: spritestatedata2 wSprite01StateData2
wSprite02StateData2:: spritestatedata2 wSprite02StateData2
wSprite03StateData2:: spritestatedata2 wSprite03StateData2
wSprite04StateData2:: spritestatedata2 wSprite04StateData2
wSprite05StateData2:: spritestatedata2 wSprite05StateData2
wSprite06StateData2:: spritestatedata2 wSprite06StateData2
wSprite07StateData2:: spritestatedata2 wSprite07StateData2
wSprite08StateData2:: spritestatedata2 wSprite08StateData2
wSprite09StateData2:: spritestatedata2 wSprite09StateData2
wSprite10StateData2:: spritestatedata2 wSprite10StateData2
wSprite11StateData2:: spritestatedata2 wSprite11StateData2
wSprite12StateData2:: spritestatedata2 wSprite12StateData2
wSprite13StateData2:: spritestatedata2 wSprite13StateData2
wSprite14StateData2:: spritestatedata2 wSprite14StateData2
wSprite15StateData2:: spritestatedata2 wSprite15StateData2
wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
SECTION "Other WRAM0", WRAM0
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 160
UNION
wTempPic::
ds BIGGEST_MAP_SIZE
NEXTU
wTempLevel::
ds 1
wHasExpAll::
ds 1
wParticipantCount::
ds 1
wParticipantEXPDivisors::
ds PARTY_LENGTH
wSharedEXPDivisors::
ds PARTY_LENGTH
wCurrentDivisor::
ds 1
wPrintedShareText::
ds 1
wBWXPScratch1::
ds 5
wBWXPScratch2::
ds 5
wBWXPScratch3::
ds 1
wEXPCalcsEnd::
wTempOAMBuffer::
ds 160
ds BIGGEST_MAP_SIZE - (PARTY_LENGTH*2 + 176)
NEXTU
wOverworldMap:: ; c6e8
ds BIGGEST_MAP_SIZE
wOverworldMapEnd::
ENDU
wRedrawRowOrColumnSrcTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
ds SCREEN_WIDTH * 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
wPartyAndBillsPCSavedMenuItem:: ; cc2b
; It is mainly used by the party menu to remember the cursor position while the
; menu isn't active.
; It is also used to remember the cursor position of mon lists (for the
; withdraw/deposit/release actions) in Bill's PC so that it doesn't get lost
; when you choose a mon from the list and a sub-menu is shown. It's reset when
; you return to the main Bill's PC menu.
ds 1
wBagSavedMenuItem:: ; cc2c
; It is used by the bag list to remember the cursor position while the menu
; isn't active.
ds 1
wBattleAndStartSavedMenuItem:: ; cc2d
; It is used by the start menu to remember the cursor position while the menu
; isn't active.
; The battle menu uses it so that the cursor position doesn't get lost when
; a sub-menu is shown. It's reset at the start of each battle.
ds 1
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
; index in party of currently battling mon
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
wMenuWatchMovingOutOfBounds:: ; cc37
; If non-zero, then when wrapping is disabled and the player tries to go past
; the top or bottom of the menu, return from HandleMenuInput. This is useful for
; menus that have too many items to display at once on the screen because it
; allows the caller to scroll the entire menu up or down when this happens.
ds 1
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
wTextDest:: ; cc3a
; destination pointer for text output
; this variable is written to, but is never read from
ds 2
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
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
wEnteringCableClub:: ; cc47
ds 1
ds 1
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
wMonDataLocation:: ; cc49
; 0 = player's party
; 1 = enemy party
; 2 = current box
; 3 = daycare
; 4 = in-battle mon
;
; AddPartyMon uses it slightly differently.
; If the lower nybble is 0, the mon is added to the player's party, else the enemy's.
; If the entire value is 0, then the player is allowed to name the mon.
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
wCheckFor180DegreeTurn:: ; cc4b
; whether to check for 180-degree turn (0 = don't, 1 = do)
ds 1
ds 1
wMissableObjectIndex:: ; cc4d
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
wUnusedCC5B:: ; cc5b
wVermilionDockTileMapBuffer:: ; cc5b
; 180 bytes
wOaksAideRewardItemName:: ; cc5b
wDexRatingNumMonsSeen:: ; cc5b
wFilteredBagItems:: ; cc5b
; List of bag items that has been filtered to a certain type of items,
; such as drinks or fossils.
wElevatorWarpMaps:: ; cc5b
wMonPartySpritesSavedOAM:: ; cc5b
; Saved copy of OAM for the first frame of the animation to make it easy to
; flip back from the second frame.
; $60 bytes
wTrainerCardBlkPacket:: ; cc5b
; $40 bytes
wSlotMachineSevenAndBarModeChance:: ; cc5b
; If a random number greater than this value is generated, then the player is
; allowed to have three 7 symbols or bar symbols line up.
; So, this value is actually the chance of NOT entering that mode.
; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance.
; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance.
wHallOfFame:: ; cc5b
wBoostExpByExpAll:: ; cc5b
wAnimationType:: ; cc5b
; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
wNPCMovementDirections:: ; cc5b
ds 1
wDexRatingNumMonsOwned:: ; cc5c
ds 1
wDexRatingText:: ; cc5d
ds 1
wSlotMachineSavedROMBank:: ; cc5e
; ROM back to return to when the player is done with the slot machine
ds 1
ds 26
wAnimPalette:: ; cc79
ds 1
ds 29
wNPCMovementDirections2:: ; cc97
wSwitchPartyMonTempBuffer:: ; cc97
; temporary buffer when swapping party mon data
ds 10
wNumStepsToTake:: ; cca1
; used in Pallet Town scripted movement
ds 49
wRLEByteCount:: ; ccd2
ds 1
wAddedToParty:: ; ccd3
; 0 = not added
; 1 = added
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
wParentMenuItem:: ; ccd3
wCanEvolveFlags:: ; ccd3
; 1 flag for each party member indicating whether it can evolve
; The purpose of these flags is to track which mons levelled up during the
; current battle at the end of the battle when evolution occurs.
; Other methods of evolution simply set it by calling TryEvolvingMon.
ds 1
wForceEvolution:: ; ccd4
ds 1
; if [ccd5] != 1, the second AI layer is not applied
wAILayer2Encouragement:: ; ccd5
ds 1
ds 1
; current HP of player and enemy substitutes
wPlayerSubstituteHP:: ; ccd7
ds 1
wEnemySubstituteHP:: ; ccd8
ds 1
wTestBattlePlayerSelectedMove:: ; ccd9
; The player's selected move during a test battle.
; InitBattleVariables sets it to the move Pound.
ds 1
ds 1
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
wLastSwitchInEnemyMonHP:: ; cce3
; The enemy mon's HP when it was switched in or when the current player mon
; was switched in, which was more recent.
; It's used to determine the message to print when switching out the player mon.
ds 2
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
wTransformedEnemyMonOriginalDVs:: ; cceb
ds 2
wMonIsDisobedient:: ds 1 ; cced
wPlayerDisabledMoveNumber:: ds 1 ; ccee
wEnemyDisabledMoveNumber:: ds 1 ; ccef
wInHandlePlayerMonFainted:: ; ccf0
; When running in the scope of HandlePlayerMonFainted, it equals 1.
; When running in the scope of HandleEnemyMonFainted, it equals 0.
ds 1
wPlayerUsedMove:: ds 1 ; ccf1
wEnemyUsedMove:: ds 1 ; ccf2
wEnemyMonMinimized:: ds 1 ; ccf3
wMoveDidntMiss:: ds 1 ; ccf4
wPartyFoughtCurrentEnemyFlags:: ; ccf5
; flags that indicate which party members have fought the current enemy mon
flag_array 6
wLowHealthAlarmDisabled:: ; ccf6
; Whether the low health alarm has been disabled due to the player winning the
; battle.
ds 1
wPlayerMonMinimized:: ; ccf7
ds 1
ds 13
wLuckySlotHiddenObjectIndex:: ; 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
wUnusedCD37:: ; cd37
wFilteredBagItemsCount:: ; cd37
; number of items in wFilteredBagItems list
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
wFallingObjectsMovementData:: ; cd3d
; up to 20 bytes (one byte for each falling object)
wSavedY:: ; cd3d
wTempSCX:: ; cd3d
wBattleTransitionCircleScreenQuadrantY:: ; cd3d
; 0 = upper half (Y < 9)
; 1 = lower half (Y >= 9)
wBattleTransitionCopyTilesOffset:: ; cd3d
; 2 bytes
; after 1 row/column has been copied, the offset to the next one to copy from
wInwardSpiralUpdateScreenCounter:: ; cd3d
; counts down from 7 so that every time 7 more tiles of the spiral have been
; placed, the tile map buffer is copied to VRAM so that progress is visible
wHoFTeamIndex:: ; cd3d
wSSAnneSmokeDriftAmount:: ; cd3d
; multiplied by 16 to get the number of times to go right by 2 pixels
wRivalStarterTemp:: ; cd3d
wBoxMonCounts:: ; cd3d
; 12 bytes
; array of the number of mons in each box
wDexMaxSeenMon:: ; cd3d
wPPRestoreItem:: ; cd3d
wWereAnyMonsAsleep:: ; cd3d
wCanPlaySlots:: ; cd3d
wNumShakes:: ; cd3d
wDayCareStartLevel:: ; cd3d
; the level of the mon at the time it entered day care
wWhichBadge:: ; cd3d
wPriceTemp:: ; cd3d
; 3-byte BCD number
wTitleMonSpecies:: ; cd3d
wPlayerCharacterOAMTile:: ; cd3d
wMoveDownSmallStarsOAMCount:: ; cd3d
; the number of small stars OAM entries to move down
wChargeMoveNum:: ; cd3d
wCoordIndex:: ; cd3d
wOptionsTextSpeedCursorX:: ; cd3d
wBoxNumString:: ; cd3d
wTrainerInfoTextBoxWidthPlus1:: ; cd3d
wSwappedMenuItem:: ; cd3d
wHoFMonSpecies:: ; cd3d
wFieldMoves:: ; cd3d
; 4 bytes
; the current mon's field moves
wBadgeNumberTile:: ; cd3d
; tile ID of the badge number being drawn
wRodResponse:: ; cd3d
; 0 = no bite
; 1 = bite
; 2 = no fish on map
wWhichTownMapLocation:: ; cd3d
wStoppingWhichSlotMachineWheel:: ; cd3d
; which wheel the player is trying to stop
; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3
wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d
wChangeBoxSavedMapTextPointer:: ; cd3d
wFlyAnimUsingCoordList:: ; cd3d
wPlayerSpinInPlaceAnimFrameDelay:: ; cd3d
wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d
wHiddenObjectFunctionArgument:: ; cd3d
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
wTrainerSpriteOffset:: ; cd3d
wUnusedCD3D:: ; cd3d
ds 1
wHUDPokeballGfxOffsetX:: ; cd3e
; difference in X between the next ball and the current one
wBattleTransitionCircleScreenQuadrantX:: ; cd3e
; 0 = left half (X < 10)
; 1 = right half (X >= 10)
wSSAnneSmokeX:: ; cd3e
wRivalStarterBallSpriteIndex:: ; cd3e
wDayCareNumLevelsGrown:: ; cd3e
wOptionsBattleAnimCursorX:: ; cd3e
wTrainerInfoTextBoxWidth:: ; cd3e
wHoFPartyMonIndex:: ; cd3e
wNumCreditsMonsDisplayed:: ; cd3e
; the number of credits mons that have been displayed so far
wBadgeNameTile:: ; cd3e
; first tile ID of the name being drawn
wFlyLocationsList:: ; cd3e
; 11 bytes plus $ff sentinel values at each end
wSlotMachineWheel1Offset:: ; cd3e
wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e
wFlyAnimCounter:: ; cd3e
wPlayerSpinInPlaceAnimFrameDelayDelta:: ; cd3e
wPlayerSpinWhileMovingUpOrDownAnimMaxY:: ; cd3e