aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DAMAGED2.DATbin0 -> 49 bytes
-rw-r--r--Makefile5
-rw-r--r--convfont.c16
-rw-r--r--draw_lorcha.s22
-rw-r--r--taipan.c19
5 files changed, 49 insertions, 13 deletions
diff --git a/DAMAGED2.DAT b/DAMAGED2.DAT
new file mode 100644
index 0000000..be67315
--- /dev/null
+++ b/DAMAGED2.DAT
Binary files differ
diff --git a/Makefile b/Makefile
index 041ab25..34ca678 100644
--- a/Makefile
+++ b/Makefile
@@ -404,7 +404,7 @@ procsizes: clean all taipan.lst
$(PERLF) procsizes.pl > procsizes
cat procsizes
-# These 2 are informational only, for when you're editing the ship
+# These 3 are informational only, for when you're editing the ship
# graphics in convfont.c.
lorcha.txt: shipshape.pl LORCHA.DAT
$(PERLF) shipshape.pl LORCHA.DAT > lorcha.txt
@@ -412,6 +412,9 @@ lorcha.txt: shipshape.pl LORCHA.DAT
damaged.txt: shipshape.pl LORCHA.DAT
$(PERLF) shipshape.pl DAMAGED.DAT > damaged.txt
+damaged2.txt: shipshape.pl LORCHA.DAT
+ $(PERLF) shipshape.pl DAMAGED2.DAT > damaged2.txt
+
# This one build the sound code as a standalone xex.
soundtest: sounds.c
$(CC) -DTESTXEX -t atari -o sounds.xex sounds.c
diff --git a/convfont.c b/convfont.c
index 211eb30..f48542f 100644
--- a/convfont.c
+++ b/convfont.c
@@ -190,6 +190,18 @@ char damaged_shipshape[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+/* DAMAGED2.DAT - as above. damage_lorcha randomly picks
+ from the 2 damaged ship shapes. */
+char damaged_shipshape2[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x42, 0x4e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x48, 0x4c, 0x56, 0x57, 0x60,
+ 0x00, 0x00, 0x5e, 0x49, 0x4b, 0x57, 0x5f,
+ 0x00, 0x7d, 0x7e, 0x7c, 0x7e, 0x50, 0x7f,
+ 0x00, 0x46, 0xd4, 0x49, 0x4c, 0x5d, 0x47,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
void bitswap(unsigned char *b, int lim) {
unsigned char j, k;
// fprintf(stderr, "bitswap(%x, %d)\n", b, lim);
@@ -310,5 +322,9 @@ int main(int argc, char **argv) {
write(i, damaged_shipshape, sizeof(damaged_shipshape));
close(i);
+ i = open("DAMAGED2.DAT", O_WRONLY | O_CREAT, 0666);
+ write(i, damaged_shipshape2, sizeof(damaged_shipshape2));
+ close(i);
+
return 0;
}
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:
diff --git a/taipan.c b/taipan.c
index a7518e6..7dbb0d3 100644
--- a/taipan.c
+++ b/taipan.c
@@ -1005,7 +1005,8 @@ unsigned int gunamt(void) {
void new_ship(void) {
unsigned long amount;
- amount = gunamt() * (capacity / 50) + 1000;
+ /* TODO: check against applesoft, line 1060 */
+ amount = gunamt() * (capacity / 50) + 1000;
if(cash < amount) {
return;
@@ -3405,16 +3406,14 @@ int main(void) {
#endif
#ifdef LORCHA_TEST
+ gotox0y(0);
+ clrtoeol();
+ for(choice = 0; choice < 10; choice++) {
+ draw_lorcha(choice);
+ }
while(1) {
- gotox0y(0);
- clrtoeol();
- for(choice = 0; choice < 10; choice++) {
- draw_lorcha(choice);
- sink_lorcha(choice);
- cprintuint(PEEK(0xda));
- cspace();
- }
- agetc();
+ choice = agetc() % 10;
+ damage_lorcha(choice);
}
#endif