Skip to content

Commit ffae280

Browse files
committed
feat(gfx): curling-wave ocean — three animated deep variants
- wave crest+tail curls that drift with the 4-phase animation - third deep variant (tile 155) at a different height breaks the global wave-row alignment; all three animate in sync - foam glints in the shallows; softer CGB wave blue
1 parent 4906a31 commit ffae280

6 files changed

Lines changed: 128 additions & 65 deletions

File tree

src/defs.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ DEF TILE_FRAME EQU 136 ; thin rule (port screen frame)
138138
DEF TILE_DEEP2 EQU 137 ; second animated deep-water variant
139139
DEF TILE_SHALLOW3 EQU 138 ; second animated shallow-water variant
140140
DEF TILE_EMBLEM EQU 139 ; 139-154: title skull & crossbones (4x4)
141+
DEF TILE_DEEP3 EQU 155 ; third animated deep-water variant
141142

142143
; --- Port towns (S4) ---
143144
; In a port district, four buildings spawn at hashed spots: tavern,

src/sail.asm

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,32 @@ AnimWater::
283283
swap a ; phase << 4
284284
ld c, a
285285
ld b, 0
286+
ld h, b
287+
ld l, c ; hl = phase * 16
286288
sla c
287289
rl b
288290
sla c
289-
rl b ; bc = phase * 64
290-
ld hl, WaterFrames
291-
add hl, bc
291+
rl b ; bc = phase * 64
292+
add hl, bc ; hl = phase * 80
293+
ld de, WaterFrames
294+
add hl, de
292295
push hl
293296
ld de, $8000 + 16 ; tiles 1 (deep) and 2 (shallow)
294297
ld bc, 32
295298
call CopyVRAM
296299
pop hl
297300
ld bc, 32
298301
add hl, bc
302+
push hl
299303
ld de, $8000 + 137 * 16 ; tiles 137-138: the variant waters
300304
ld bc, 32
301305
call CopyVRAM
306+
pop hl
307+
ld bc, 32
308+
add hl, bc
309+
ld de, $8000 + 155 * 16 ; tile 155: third deep variant
310+
ld bc, 16
311+
call CopyVRAM
302312
ret
303313
POPS
304314

src/tiles.asm

Lines changed: 97 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ LoadTiles::
6363
ld de, $8000 + 137 * 16 ; variant waters (AnimWater syncs them)
6464
ld bc, 32
6565
call CopyVRAM
66+
ld hl, WaterFrames + 64
67+
ld de, $8000 + 155 * 16
68+
ld bc, 16
69+
call CopyVRAM
6670
ld hl, EmblemTiles
6771
ld de, $8000 + TILE_EMBLEM * 16
6872
ld bc, 16 * 16
@@ -526,7 +530,7 @@ EmblemTiles:
526530
PUSHS "CGB palette data", ROMX, BANK[3]
527531
CGB_BGP:
528532
dw $7FFF, $5294, $2108, $0000 ; 0 UI: white/lt gray/dk gray/black
529-
dw $7FDA, $7ACC, $69C6, $4903 ; 1 deep sea: foam -> navy
533+
dw $7FDA, $7AEE, $69C6, $4903 ; 1 deep sea: foam -> navy
530534
dw $53BF, $32DB, $1DF4, $112C ; 2 sand: pale dune -> wet brown
531535
dw $3BB6, $26ED, $1A08, $1144 ; 3 grass: light meadow -> loam
532536
dw $7BF8, $634A, $4E45, $3542 ; 4 shallow: lagoon -> teal
@@ -538,9 +542,9 @@ CGB_OBP:
538542
dw $7FFF, $5294, $0850, $0000 ; obj1 pirate: white/gray/dark red/black
539543
POPS
540544

541-
; 4-phase water animation: [deep][shallow][deep2][shallow3] per phase,
542-
; 16 bytes each. AnimWater copies one 64-byte phase over tiles 1-2 and
543-
; 137-138 every 16 frames.
545+
; 4-phase water animation: [deep][shallow][deep2][shallow3][deep3] per
546+
; phase, 16 bytes each. AnimWater copies one 80-byte phase over tiles 1-2,
547+
; 137-138, and 155 every 16 frames.
544548
; Every row is 4-periodic (abcdabcd), so drifting right one pixel per
545549
; phase loops exactly (rotation == shift across tile boundaries).
546550
; ROM0: AnimWater (also ROM0) reads it for both sailing and shore mode.
@@ -551,149 +555,185 @@ WaterFrames::
551555
dw `00000000
552556
dw `00000000
553557
dw `01100110
558+
dw `10001000
554559
dw `00000000
555560
dw `00000000
556-
dw `00000000
557-
dw `10011001
561+
dw `00100010
558562
dw `00000000
559563
; shallow
560564
dw `00000000
561-
dw `00000000
565+
dw `01000100
562566
dw `01100110
567+
dw `10001000
563568
dw `00000000
564-
dw `01000100
565569
dw `00000000
566-
dw `10011001
570+
dw `00100010
567571
dw `00000000
568572
; deep2
569573
dw `00000000
570574
dw `00000000
571575
dw `00000000
572-
dw `00110011
573-
dw `00000000
574576
dw `11001100
577+
dw `00010001
575578
dw `00000000
579+
dw `01000100
576580
dw `00000000
577581
; shallow3
578582
dw `00000000
583+
dw `00100010
579584
dw `00000000
585+
dw `11001100
586+
dw `00010001
580587
dw `00000000
581-
dw `00110011
588+
dw `01000100
582589
dw `00000000
583-
dw `11001100
590+
; deep3
591+
dw `00000000
592+
dw `00000000
593+
dw `00000000
594+
dw `00000000
595+
dw `00000000
596+
dw `01100110
597+
dw `10001000
584598
dw `00000000
585-
dw `00010001
586599
; --- phase 1 ---
587600
; deep
588601
dw `00000000
589602
dw `00000000
590603
dw `00110011
604+
dw `01000100
591605
dw `00000000
592606
dw `00000000
593-
dw `00000000
594-
dw `11001100
607+
dw `00010001
595608
dw `00000000
596609
; shallow
597610
dw `00000000
598-
dw `00000000
611+
dw `00100010
599612
dw `00110011
613+
dw `01000100
600614
dw `00000000
601-
dw `00100010
602615
dw `00000000
603-
dw `11001100
616+
dw `00010001
604617
dw `00000000
605618
; deep2
606619
dw `00000000
607620
dw `00000000
608621
dw `00000000
609-
dw `10011001
610-
dw `00000000
611622
dw `01100110
623+
dw `10001000
612624
dw `00000000
625+
dw `00100010
613626
dw `00000000
614627
; shallow3
615628
dw `00000000
629+
dw `00010001
616630
dw `00000000
631+
dw `01100110
632+
dw `10001000
617633
dw `00000000
618-
dw `10011001
634+
dw `00100010
619635
dw `00000000
620-
dw `01100110
636+
; deep3
637+
dw `00000000
638+
dw `00000000
639+
dw `00000000
640+
dw `00000000
641+
dw `00000000
642+
dw `00110011
643+
dw `01000100
621644
dw `00000000
622-
dw `10001000
623645
; --- phase 2 ---
624646
; deep
625647
dw `00000000
626648
dw `00000000
627649
dw `10011001
650+
dw `00100010
628651
dw `00000000
629652
dw `00000000
630-
dw `00000000
631-
dw `01100110
653+
dw `10001000
632654
dw `00000000
633655
; shallow
634656
dw `00000000
635-
dw `00000000
657+
dw `00010001
636658
dw `10011001
659+
dw `00100010
637660
dw `00000000
638-
dw `00010001
639661
dw `00000000
640-
dw `01100110
662+
dw `10001000
641663
dw `00000000
642664
; deep2
643665
dw `00000000
644666
dw `00000000
645667
dw `00000000
646-
dw `11001100
647-
dw `00000000
648668
dw `00110011
669+
dw `01000100
649670
dw `00000000
671+
dw `00010001
650672
dw `00000000
651673
; shallow3
652674
dw `00000000
675+
dw `10001000
653676
dw `00000000
677+
dw `00110011
678+
dw `01000100
654679
dw `00000000
655-
dw `11001100
680+
dw `00010001
656681
dw `00000000
657-
dw `00110011
682+
; deep3
683+
dw `00000000
684+
dw `00000000
685+
dw `00000000
686+
dw `00000000
687+
dw `00000000
688+
dw `10011001
689+
dw `00100010
658690
dw `00000000
659-
dw `01000100
660691
; --- phase 3 ---
661692
; deep
662693
dw `00000000
663694
dw `00000000
664695
dw `11001100
696+
dw `00010001
665697
dw `00000000
666698
dw `00000000
667-
dw `00000000
668-
dw `00110011
699+
dw `01000100
669700
dw `00000000
670701
; shallow
671702
dw `00000000
672-
dw `00000000
703+
dw `10001000
673704
dw `11001100
705+
dw `00010001
674706
dw `00000000
675-
dw `10001000
676707
dw `00000000
677-
dw `00110011
708+
dw `01000100
678709
dw `00000000
679710
; deep2
680711
dw `00000000
681712
dw `00000000
682713
dw `00000000
683-
dw `01100110
684-
dw `00000000
685714
dw `10011001
715+
dw `00100010
686716
dw `00000000
717+
dw `10001000
687718
dw `00000000
688719
; shallow3
689720
dw `00000000
721+
dw `01000100
690722
dw `00000000
723+
dw `10011001
724+
dw `00100010
691725
dw `00000000
692-
dw `01100110
726+
dw `10001000
693727
dw `00000000
694-
dw `10011001
728+
; deep3
729+
dw `00000000
730+
dw `00000000
731+
dw `00000000
732+
dw `00000000
733+
dw `00000000
734+
dw `11001100
735+
dw `00010001
695736
dw `00000000
696-
dw `00100010
697737
POPS
698738

699739
; tiles 13-14: port marker (chart) + dock planks (in-world)
@@ -1094,23 +1134,23 @@ TerrainTiles:
10941134
dw `00000000
10951135
dw `00000000
10961136
dw `00000000
1097-
; 1 TILE_DEEP — open water: sparse single-tone wavelets (WaterFrames phase 0)
1137+
; 1 TILE_DEEP — open water: little curling waves (WaterFrames phase 0)
10981138
dw `00000000
10991139
dw `00000000
11001140
dw `01100110
1141+
dw `10001000
11011142
dw `00000000
11021143
dw `00000000
1144+
dw `00100010
11031145
dw `00000000
1104-
dw `10011001
1105-
dw `00000000
1106-
; 2 TILE_SHALLOW — wavelets + a glint row (WaterFrames phase 0)
1107-
dw `00000000
1146+
; 2 TILE_SHALLOW — waves + a foam-glint row (WaterFrames phase 0)
11081147
dw `00000000
1148+
dw `01000100
11091149
dw `01100110
1150+
dw `10001000
11101151
dw `00000000
1111-
dw `01000100
11121152
dw `00000000
1113-
dw `10011001
1153+
dw `00100010
11141154
dw `00000000
11151155
; 3 TILE_SAND — flat beach, two pebble clusters
11161156
dw `11111111
@@ -1161,15 +1201,15 @@ TerrainTiles:
11611201
; tiles 121-124: sea-terrain visual variants (DecorateTile, world.asm).
11621202
; Render-only substitutes for the canonical tiles 2-5.
11631203
VariantTiles:
1164-
; 121 TILE_SHALLOW2 — foam-flecked shallow (near-coast band)
1204+
; 121 TILE_SHALLOW2 — calm foam-fleck band near the sand (static)
11651205
dw `00000000
1166-
dw `00000000
1167-
dw `01100110
1168-
dw `00010000
11691206
dw `01000100
11701207
dw `00000000
1171-
dw `10011001
1172-
dw `00000010
1208+
dw `00000000
1209+
dw `00000000
1210+
dw `00000000
1211+
dw `00100010
1212+
dw `00000000
11731213
; 122 TILE_SAND2 — pebbles in a different spot
11741214
dw `11111111
11751215
dw `11122111

src/world.asm

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,19 @@ DecorateTile:
386386
ret
387387
.deep2
388388
ld a, b
389-
and 4 ; 25% alternate deep waves
389+
and 12 ; three deep variants, 25% each
390390
jr z, .keep
391+
cp 4
392+
jr z, .d2
393+
cp 8
394+
jr z, .d3
395+
jr .keep
396+
.d2
391397
ld a, TILE_DEEP2
392398
ret
399+
.d3
400+
ld a, TILE_DEEP3
401+
ret
393402
.shallow3
394403
ld a, b
395404
and 8 ; 50% alternate shallows
@@ -481,7 +490,7 @@ ATTR_TAB:
481490
FOR i, 256
482491
IF i == TILE_BLANK || i == TILE_PORT || i == TILE_LET_X || i == TILE_SKULL
483492
db 0
484-
ELIF i == TILE_DEEP || i == TILE_DEEP_SH25 || i == TILE_DEEP_SH50 || i == TILE_DEEP2
493+
ELIF i == TILE_DEEP || i == TILE_DEEP_SH25 || i == TILE_DEEP_SH50 || i == TILE_DEEP2 || i == TILE_DEEP3
485494
db 1
486495
ELIF i == TILE_DOCK || i == TILE_SAND || i == TILE_SAND2 || i == TILE_SH_SAND50 || i == TILE_SAND_SH25 || i == TILE_SAND_GR25 || i == TILE_SAND_GR50
487496
db 2

0 commit comments

Comments
 (0)