changeset 10:22fa8fa12802

Make loading select the correct hole/ladder table pointer Holes and ladders are kept in a special table. Recalculate the pointer correctly on game load.
author William Astle <lost@l-w.ca>
date Mon, 29 Dec 2014 13:45:14 -0700
parents 2401a0c72921
children e007731b20bd
files dod.s
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Mon Dec 29 13:19:17 2014 -0700
+++ b/dod.s	Mon Dec 29 13:45:14 2014 -0700
@@ -4985,7 +4985,7 @@
 		bhs load_game017		; brif so
 		bsr load_readsched		; read scheduling pointer
 		std ,y				; set pointer to next entry
-		bsr load_read			; read tick count value
+		jsr load_read			; read tick count value
 		lbcs load_gameerr		; brif read error
 		sta 2,y				; save ticks count
 		bsr load_readw			; read a word from file
@@ -5013,6 +5013,13 @@
 		jsr file_close			; close the disk file
 		lbne load_gameerr		; brif error closing (writing buffer failed)
 		jsr LC7B6			; set up backgrounds correctly
+		ldx #holetab			; point to hole/ladder table
+		ldb currentlevel		; fetch current level
+load_game019	stx holetabptr			; save hole/ladder data pointer
+load_game020	lda ,x+				; fetch flag
+		bpl load_game020		; brif we didn't consume a flag
+		decb				; are we at the right set of data for the level?
+		bpl load_game019		; brif not - save new pointer and search again
 		clra				; clear carry for success
 		puls d,x,y,u,pc			; restore registers and return
 load_readsched	ldd #schedtab			; set the bias for the read