-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbg_effects.asm
2957 lines (2649 loc) · 43.4 KB
/
bg_effects.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
const_def
const BGSQUARE_SIX
const BGSQUARE_FOUR
const BGSQUARE_TWO
const BGSQUARE_SEVEN
const BGSQUARE_FIVE
const BGSQUARE_THREE
; BG effects for use in battle animations.
ExecuteBGEffects: ; c8000 (32:4000)
ld hl, ActiveBGEffects
ld e, 5
.loop
ld a, [hl]
and a
jr z, .next
ld c, l
ld b, h
push hl
push de
call DoBattleBGEffectFunction
pop de
pop hl
.next
ld bc, 4
add hl, bc
dec e
jr nz, .loop
ret
QueueBGEffect: ; c801a (32:401a)
ld hl, ActiveBGEffects
ld e, 5
.loop
ld a, [hl]
and a
jr z, .load
ld bc, 4
add hl, bc
dec e
jr nz, .loop
scf
ret
.load
ld c, l
ld b, h
ld hl, BG_EFFECT_STRUCT_FUNCTION
add hl, bc
ld a, [wBattleAnimTemp0]
ld [hli], a
ld a, [wBattleAnimTemp1]
ld [hli], a
ld a, [wBattleAnimTemp2]
ld [hli], a
ld a, [wBattleAnimTemp3]
ld [hl], a
ret
EndBattleBGEffect: ; c8043 (32:4043)
ld hl, BG_EFFECT_STRUCT_FUNCTION
add hl, bc
ld [hl], 0
ret
DoBattleBGEffectFunction: ; c804a (32:404a)
ld hl, BG_EFFECT_STRUCT_FUNCTION
add hl, bc
ld e, [hl]
ld d, 0
ld hl, BattleBGEffects
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
BattleBGEffects: ; c805a (32:405a)
dw BattleBGEffect_End
dw BattleBGEffect_FlashInverted
dw BattleBGEffect_FlashWhite
dw BattleBGEffect_WhiteHues
dw BattleBGEffect_BlackHues
dw BattleBGEffect_AlternateHues
dw BattleBGEffect_06
dw BattleBGEffect_07
dw BattleBGEffect_08
dw BattleBGEffect_HideMon
dw BattleBGEffect_ShowMon
dw BattleBGEffect_EnterMon
dw BattleBGEffect_ReturnMon
dw BattleBGEffect_Surf
dw BattleBGEffect_Whirlpool
dw BattleBGEffect_Teleport
dw BattleBGEffect_NightShade
dw BattleBGEffect_FeetFollow
dw BattleBGEffect_HeadFollow
dw BattleBGEffect_DoubleTeam
dw BattleBGEffect_AcidArmor
dw BattleBGEffect_RapidFlash
dw BattleBGEffect_16
dw BattleBGEffect_17
dw BattleBGEffect_18
dw BattleBGEffect_19
dw BattleBGEffect_1a
dw BattleBGEffect_1b
dw BattleBGEffect_1c
dw BattleBGEffect_1d
dw BattleBGEffect_1e
dw BattleBGEffect_1f
dw BattleBGEffect_20
dw BattleBGEffect_Withdraw
dw BattleBGEffect_BounceDown
dw BattleBGEffect_Dig
dw BattleBGEffect_Tackle
dw BattleBGEffect_25
dw BattleBGEffect_26
dw BattleBGEffect_27
dw BattleBGEffect_28
dw BattleBGEffect_Psychic
dw BattleBGEffect_2a
dw BattleBGEffect_2b
dw BattleBGEffect_2c
dw BattleBGEffect_2d
dw BattleBGEffect_2e
dw BattleBGEffect_2f
dw BattleBGEffect_30
dw BattleBGEffect_31
dw BattleBGEffect_32
dw BattleBGEffect_VibrateMon
dw BattleBGEffect_WobbleMon
dw BattleBGEffect_35
BattleBGEffect_End: ; c80c6 (32:40c6)
call EndBattleBGEffect
ret
BatttleBGEffects_GetNamedJumptablePointer: ; c80ca (32:40ca)
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld l, [hl]
ld h, 0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
BattleBGEffects_AnonJumptable: ; c80d7 (32:40d7)
pop de
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld l, [hl]
ld h, 0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
BattleBGEffects_IncrementJumptable: ; c80e5 (32:40e5)
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
inc [hl]
ret
BattleBGEffect_FlashInverted: ; c80eb (32:40eb)
ld de, .inverted
jp BattleBGEffect_FlashContinue
.inverted
db %11100100 ; 3210
db %00011011 ; 0123
; c80f3
BattleBGEffect_FlashWhite: ; c80f3 (32:40f3)
ld de, .white
jp BattleBGEffect_FlashContinue
.white
db %11100100 ; 3210
db %00000000 ; 0000
; c80fb
BattleBGEffect_FlashContinue: ; c80fb (32:40fb)
; current timer, flash duration, number of flashes
ld a, $1
ld [wBattleAnimTemp0], a
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld a, [hl]
and a
jr z, .init
dec [hl]
ret
.init
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld [hl], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
and a
jr nz, .apply_pal
call EndBattleBGEffect
ret
.apply_pal
dec a
ld [hl], a
and 1
ld l, a
ld h, 0
add hl, de
ld a, [hl]
ld [wBGP], a
ret
BattleBGEffect_WhiteHues: ; c812d (32:412d)
ld de, .Pals
call BattleBGEffect_GetNthDMGPal
jr c, .quit
ld [wBGP], a
ret
.quit
call EndBattleBGEffect
ret
.Pals:
db %11100100
db %11100000
db %11010000
db -1
; c8141
BattleBGEffect_BlackHues: ; c8141 (32:4141)
ld de, .Pals
call BattleBGEffect_GetNthDMGPal
jr c, .quit
ld [wBGP], a
ret
.quit
call EndBattleBGEffect
ret
.Pals:
db %11100100
db %11110100
db %11111000
db -1
; c8155
BattleBGEffect_AlternateHues: ; c8155 (32:4155)
ld de, .Pals
call BattleBGEffect_GetNthDMGPal
jr c, .quit
ld [wBGP], a
ld [wOBP1], a
ret
.quit
call EndBattleBGEffect
ret
.Pals:
db %11100100
db %11111000
db %11111100
db %11111000
db %11100100
db %10010000
db %01000000
db %10010000
db -2
; c8171
BattleBGEffect_06: ; c8171 (32:4171)
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
.PalsCGB:
db %11100100
db %10010000
db -2
.PalsSGB:
db %11110000
db %11000000
db -2
; c818b
BattleBGEffect_07: ; c818b (32:418b)
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
.PalsCGB:
db %11100100
db %11011000
db -2
.PalsSGB:
db %11110000
db %11001100
db -2
; c81a5
BattleBGEffect_08: ; c81a5 (32:41a5)
ld de, .Pals
call BattleBGEffect_GetNthDMGPal
ld [wBGP], a
ret
.Pals:
db %00011011
db %01100011
db %10000111
db -2
; c81b3
BattleBGEffect_HideMon: ; c81b3 (32:41b3)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw .four
.zero
call BattleBGEffects_IncrementJumptable
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side
hlcoord 12, 0
lb bc, 7, 7
jr .got_pointer
.player_side
hlcoord 2, 6
lb bc, 6, 6
.got_pointer
call ClearBox
pop bc
xor a
ld [hBGMapThird], a
ld a, $1
ld [hBGMapMode], a
ret
.four
xor a
ld [hBGMapMode], a
call EndBattleBGEffect
ret
BattleBGEffect_ShowMon: ; c81ea (32:41ea)
call BGEffect_CheckFlyDigStatus
jr z, .not_flying
call EndBattleBGEffect
ret
.not_flying
call BGEffect_CheckBattleTurn
jr nz, .player_side
ld de, .EnemyData
jr .got_pointer
.player_side
ld de, .PlayerData
.got_pointer
ld a, e
ld [wBattleAnimTemp1], a
ld a, d
ld [wBattleAnimTemp2], a
call BattleBGEffect_RunPicResizeScript
ret
.PlayerData:
db 0, $31, 0
db -1
.EnemyData:
db 3, $00, 3
db -1
; c8214
BattleBGEffect_FeetFollow: ; c8214 (32:4214)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw .five
.zero
call BGEffect_CheckFlyDigStatus
jr z, .not_flying_digging
ld hl, wNumActiveBattleAnims
inc [hl]
call EndBattleBGEffect
ret
.not_flying_digging
call BattleBGEffects_IncrementJumptable
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_turn
ld a, ANIM_OBJ_PLAYERFEETFOLLOW
ld [wBattleAnimTemp0], a
ld a, 16 * 8 + 4
jr .okay
.player_turn
ld a, ANIM_OBJ_ENEMYFEETFOLLOW
ld [wBattleAnimTemp0], a
ld a, 6 * 8
.okay
ld [wBattleAnimTemp1], a
ld a, 8 * 8
ld [wBattleAnimTemp2], a
xor a
ld [wBattleAnimTemp3], a
call _QueueBattleAnimation
pop bc
ret
.one
call BattleBGEffects_IncrementJumptable
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_turn_2
hlcoord 12, 6
lb bc, 1, 7
jr .okay2
.player_turn_2
hlcoord 2, 6
lb bc, 1, 6
.okay2
call ClearBox
ld a, $1
ld [hBGMapMode], a
pop bc
ret
.five
xor a
ld [hBGMapMode], a
call EndBattleBGEffect
ret
BattleBGEffect_HeadFollow: ; c8281 (32:4281)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw .five
.zero
call BGEffect_CheckFlyDigStatus
jr z, .not_flying_digging
ld hl, wNumActiveBattleAnims
inc [hl]
call EndBattleBGEffect
ret
.not_flying_digging
call BattleBGEffects_IncrementJumptable
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_turn
ld a, ANIM_OBJ_BA
ld [wBattleAnimTemp0], a
ld a, 16 * 8 + 4
jr .okay
.player_turn
ld a, ANIM_OBJ_BB
ld [wBattleAnimTemp0], a
ld a, 6 * 8
.okay
ld [wBattleAnimTemp1], a
ld a, 8 * 8
ld [wBattleAnimTemp2], a
xor a
ld [wBattleAnimTemp3], a
call _QueueBattleAnimation
pop bc
ret
.one
call BattleBGEffects_IncrementJumptable
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_turn_2
hlcoord 12, 5
lb bc, 2, 7
jr .okay2
.player_turn_2
hlcoord 2, 6
lb bc, 2, 6
.okay2
call ClearBox
ld a, $1
ld [hBGMapMode], a
pop bc
ret
.five
xor a
ld [hBGMapMode], a
call EndBattleBGEffect
ret
_QueueBattleAnimation: ; c82ee (32:42ee)
callab QueueBattleAnimation
ret
BattleBGEffect_27: ; c82f5 (32:42f5)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw .four
.zero
call BattleBGEffects_IncrementJumptable
call BGEffect_CheckBattleTurn
ld [hl], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
and a
jr z, .user
ld a, $9
jr .okay
.user
ld a, $8
.okay
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], a
ret
.one
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
and a
jr z, .user_2
hlcoord 0, 6
lb de, 8, 6
.row1
push de
push hl
.col1
inc hl
ld a, [hld]
ld [hli], a
dec d
jr nz, .col1
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop de
dec e
jr nz, .row1
jr .okay2
.user_2
hlcoord 19, 0
lb de, 8, 7
.row2
push de
push hl
.col2
dec hl
ld a, [hli]
ld [hld], a
dec d
jr nz, .col2
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop de
dec e
jr nz, .row2
.okay2
xor a
ld [hBGMapThird], a
ld a, $1
ld [hBGMapMode], a
call BattleBGEffects_IncrementJumptable
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
dec [hl]
ret
.four
xor a
ld [hBGMapMode], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
and a
jr z, .done
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld [hl], $1
ret
.done
call EndBattleBGEffect
ret
BattleBGEffect_EnterMon: ; c837b (32:437b)
call BGEffect_CheckBattleTurn
jr nz, .player_turn
ld de, .EnemyData
jr .okay
.player_turn
ld de, .PlayerData
.okay
ld a, e
ld [wBattleAnimTemp1], a
ld a, d
ld [wBattleAnimTemp2], a
call BattleBGEffect_RunPicResizeScript
ret
.PlayerData:
db 2, $31, 2
db 1, $31, 1
db 0, $31, 0
db -1
.EnemyData:
db 5, $00, 5
db 4, $00, 4
db 3, $00, 3
db -1
; c83a8
BattleBGEffect_ReturnMon: ; c83a8 (32:43a8)
call BGEffect_CheckBattleTurn
jr nz, .player_turn
ld de, .EnemyData
jr .okay
.player_turn
ld de, .PlayerData
.okay
ld a, e
ld [wBattleAnimTemp1], a
ld a, d
ld [wBattleAnimTemp2], a
call BattleBGEffect_RunPicResizeScript
ret
.PlayerData:
db 0, $31, 0
db -2, $66, 0
db 1, $31, 1
db -2, $44, 1
db 2, $31, 2
db -2, $22, 2
db -3, $00, 0
db -1
.EnemyData:
db 3, $00, 3
db -2, $77, 3
db 4, $00, 4
db -2, $55, 4
db 5, $00, 5
db -2, $33, 5
db -3, $00, 0
db -1
; c83ed
BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
dw .restart
dw .end
.zero
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld e, [hl]
ld d, $0
inc [hl]
ld a, [wBattleAnimTemp1]
ld l, a
ld a, [wBattleAnimTemp2]
ld h, a
add hl, de
add hl, de
add hl, de
ld a, [hl]
cp -1
jr z, .end
cp -2
jr z, .clear
cp -3
jr z, .skip
call .PlaceGraphic
.skip
call BattleBGEffects_IncrementJumptable
ld a, $1
ld [hBGMapMode], a
ret
.clear
call .ClearBox
jr .zero
.restart
xor a
ld [hBGMapMode], a
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld [hl], $0
ret
.end
xor a
ld [hBGMapMode], a
call EndBattleBGEffect
ret
.ClearBox:
; get dims
push bc
inc hl
ld a, [hli]
ld b, a
and $f
ld c, a
ld a, b
swap a
and $f
ld b, a
; get coords
ld e, [hl]
ld d, 0
ld hl, .Coords
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call ClearBox
pop bc
ret
.PlaceGraphic:
; get dims
push bc
push hl
ld e, [hl]
ld d, 0
ld hl, .BGSquares
add hl, de
add hl, de
add hl, de
ld a, [hli]
ld b, a
and $f
ld c, a
ld a, b
swap a
and $f
ld b, a
; store pointer
ld e, [hl]
inc hl
ld d, [hl]
; get byte
pop hl
inc hl
ld a, [hli]
ld [wBattleAnimTemp0], a
; get coord
push de
ld e, [hl]
ld d, 0
ld hl, .Coords
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
pop de
; fill box
.row
push bc
push hl
ld a, [wBattleAnimTemp0]
ld b, a
.col
ld a, [de]
add b
ld [hli], a
inc de
dec c
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .row
pop bc
ret
.Coords:
dwcoord 2, 6
dwcoord 3, 8
dwcoord 4, 10
dwcoord 12, 0
dwcoord 13, 2
dwcoord 14, 4
.BGSquares:
bgsquare: MACRO
dn \1,\2
dw \3
endm
bgsquare 6, 6, .SixBySix
bgsquare 4, 4, .FourByFour
bgsquare 2, 2, .TwoByTwo
bgsquare 7, 7, .SevenBySeven
bgsquare 5, 5, .FiveByFive
bgsquare 3, 3, .ThreeByThree
.SixBySix:
db $00, $06, $0c, $12, $18, $1e
db $01, $07, $0d, $13, $19, $1f
db $02, $08, $0e, $14, $1a, $20
db $03, $09, $0f, $15, $1b, $21
db $04, $0a, $10, $16, $1c, $22
db $05, $0b, $11, $17, $1d, $23
.FourByFour:
db $00, $0c, $12, $1e
db $02, $0e, $14, $20
db $03, $0f, $15, $21
db $05, $11, $17, $23
.TwoByTwo:
db $00, $1e
db $05, $23
.SevenBySeven:
db $00, $07, $0e, $15, $1c, $23, $2a
db $01, $08, $0f, $16, $1d, $24, $2b
db $02, $09, $10, $17, $1e, $25, $2c
db $03, $0a, $11, $18, $1f, $26, $2d
db $04, $0b, $12, $19, $20, $27, $2e
db $05, $0c, $13, $1a, $21, $28, $2f
db $06, $0d, $14, $1b, $22, $29, $30
.FiveByFive:
db $00, $07, $15, $23, $2a
db $01, $08, $16, $24, $2b
db $03, $0a, $18, $26, $2d
db $05, $0c, $1a, $28, $2f
db $06, $0d, $1b, $29, $30
.ThreeByThree:
db $00, $15, $2a
db $03, $18, $2d
db $06, $1b, $30
; c8545
BattleBGEffect_Surf: ; c8545 (32:4545)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call BattleBGEffects_IncrementJumptable
lb de, 2, 2
call InitSurfWaves
.one
ld a, [hLCDCPointer]
and a
ret z
push bc
call .RotatewSurfWaveBGEffect
pop bc
ret
.two
call BattleAnim_ResetLCDStatCustom
ret
.RotatewSurfWaveBGEffect:
ld hl, wSurfWaveBGEffect
ld de, wSurfWaveBGEffect + 1
ld c, wSurfWaveBGEffectEnd - wSurfWaveBGEffect - 1
ld a, [hl]
push af
.loop
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .loop
pop af
ld [hl], a
ld de, LYOverridesBackup
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
ld a, [hLYOverrideStart]
cp e
jr nc, .load_zero
push hl
add hl, bc
ld a, [hl]
pop hl
jr .okay
.load_zero
xor a
.okay
ld [de], a
ld a, c
inc a
and $3f
ld c, a
inc de
ld a, e
cp $5f
jr c, .loop2
ret
BattleBGEffect_Whirlpool: ; c8599 (32:4599)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00