aboutsummaryrefslogtreecommitdiff
path: root/draw_lorcha.s
diff options
context:
space:
mode:
Diffstat (limited to 'draw_lorcha.s')
-rw-r--r--draw_lorcha.s22
1 files changed, 20 insertions, 2 deletions
diff --git a/draw_lorcha.s b/draw_lorcha.s
index 07c4afe..b08fa50 100644
--- a/draw_lorcha.s
+++ b/draw_lorcha.s
@@ -44,6 +44,10 @@ lorcha_data:
damaged_data:
.incbin "DAMAGED.DAT"
+; fully-damaged version of the lorcha, damaged_shipshape2[] in convfont.c
+damaged_data2:
+ .incbin "DAMAGED2.DAT"
+
.ifdef CART_TARGET
.segment "HIGHCODE"
.else
@@ -176,7 +180,7 @@ _damage_lorcha:
xrand:
; get random number 0-48 in X:
- lda 53770 ; RANDOM
+ lda RANDOM
lsr
lsr
cmp #49
@@ -184,7 +188,15 @@ xrand:
tax
getpiece:
+ bit RANDOM
+ bpl @used2
lda damaged_data,x
+ jmp @can_dmg
+
+@used2:
+ lda damaged_data2,x
+
+@can_dmg:
cmp lorcha_data,x
beq xrand ; if it's a piece that can't show damage,
; ditch it and start over
@@ -204,10 +216,16 @@ calcrow:
bcc calcrow
rowdone:
- lda temp ; the piece
ldy temp+1
+
+ lda (destptr),y
+ cmp lorcha_data,x ; if it's already damaged,
+ bne @ret ; leave it alone.
+
+ lda temp ; the piece
sta (destptr),y
+@ret:
rts ; end of _damage_lorcha
; a couple of utility functions for dealing with destptr: