changeset 11:e007731b20bd

Update the pointer to the creature counts on game load The creature counts pointer is used during the game for adding revenge monsters. Make sure to set the pointer correctly on game load.
author William Astle <lost@l-w.ca>
date Mon, 29 Dec 2014 13:49:37 -0700
parents 22fa8fa12802
children aa3901cbe279
files dod.s
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Mon Dec 29 13:45:14 2014 -0700
+++ b/dod.s	Mon Dec 29 13:49:37 2014 -0700
@@ -4973,7 +4973,7 @@
 		lbcs load_gameerr		; brif read error
 		bra load_game009		; go handle another creature
 load_game010	ldx #schedlists			; point to scheduling lists
-load_game011	bsr load_readsched		; read a scheduling pointer
+load_game011	jsr load_readsched		; read a scheduling pointer
 		std ,x++			; set scheduling list
 		cmpx #schedlists+14		; done all lists?
 		blo load_game011		; brif not
@@ -5013,6 +5013,11 @@
 		jsr file_close			; close the disk file
 		lbne load_gameerr		; brif error closing (writing buffer failed)
 		jsr LC7B6			; set up backgrounds correctly
+		lda currentlevel		; get current level
+		ldb #12				; number of entries in creature count table
+		mul				; calculate offset to creature counts for this level
+		addd #creaturecounts		; point to correct creature count table for this level
+		std creaturecntptr		; save pointer to creature count table for the correct level
 		ldx #holetab			; point to hole/ladder table
 		ldb currentlevel		; fetch current level
 load_game019	stx holetabptr			; save hole/ladder data pointer