changeset 27:811c4d1ee25d

Identified light level variables and creature kill handler. Identified creature kill handler including actions taken when the wizard or wizard's image is killed. Also identified variables related to lighting in the dungeon and the flag which freezes creature motion after the wizard is killed.
author William Astle <lost@l-w.ca>
date Fri, 26 Dec 2014 11:23:12 -0700
parents 4245a1b5c333
children 81d1282860e5
files dod.s
diffstat 1 files changed, 43 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Dec 26 10:53:55 2014 -0700
+++ b/dod.s	Fri Dec 26 11:23:12 2014 -0700
@@ -248,10 +248,10 @@
 damagelevel	rmb 2				; player damage level
 V223		rmb 1
 curtorch	rmb 2				; pointer to currently mounted torch
-V226		rmb 2
+baselight	rmb 2				; base light level in dungeon
 nokeyboard	rmb 1				; set if no keyboard operations should be done during IRQ
-backpack	rmb 2
-V22B		rmb 1
+backpack	rmb 2				; pointer to first item in backpack
+creaturefreeze	rmb 1				; nonzero means creatures are frozen
 levbgmask	rmb 1				; the current level background colour mask
 lightlevel	rmb 1				; the current light level, $ff means dark
 lightcount	rmb 1				; counter between pixels when drawing lines
@@ -286,7 +286,7 @@
 V26B		rmb 1
 V26C		rmb 1
 V26D		rmb 1
-V26E		rmb 1
+effectivelight	rmb 1
 V26F		rmb 1
 V270		rmb 3
 V273		rmb 1
@@ -375,7 +375,7 @@
 mazedata	rmb $400
 V9F4		rmb 9
 V9FD		rmb $10a
-emptyhand	rmb 10				; "object" information for empty hand
+emptyhand	rmb 14				; "object" information for empty hand
 objecttab	rmb 72*14			; the object data table (room for 72 entries)
 VF05		equ *
 
@@ -800,7 +800,7 @@
 		stx 4,s				;*
 		rti				; return to caller
 ; SWI 0 routine
-LC384		lda V26E
+LC384		lda effectivelight
 		tst V275
 		beq LC38E
 		lda V26F
@@ -1128,14 +1128,14 @@
 		cmpa #3
 		bgt LC5AE
 		clearcommand
-		lda V26E
+		lda effectivelight
 		sta V270
 LC578		dec V26F
 		jsr [displayptr]		; update the main display area
 		dec pageswap			; set graphics swap required
 		sync				; wait for swap to happen
-		dec V26E
-		lda V26E
+		dec effectivelight
+		lda effectivelight
 		cmpa #$f8
 		bgt LC578
 		cleargfx2
@@ -1150,8 +1150,8 @@
 		dec pageswap			; set graphics swap required
 		sync				; wait for swap to happen
 		inc V26F
-		inc V26E
-		lda V26E
+		inc effectivelight
+		lda effectivelight
 		cmpa V270
 		ble LC599
 		clr nokeyboard
@@ -1241,13 +1241,13 @@
 		dec pageswap			; flag graphics swap required
 		sync				; wait for swap to happen
 LC65F		rts
-LC660		pshs a,b,x,y,u
-		ldd V226
+LC660		pshs a,b,x,y,u			; save registers
+		ldd baselight			; get dungeon base lighting
 		ldu curtorch			; is there a torch lit?
 		beq LC66C			; brif not
-		adda 7,u
-		addb 8,u
-LC66C		std V26E
+		adda 7,u			; add in physical light from torch
+		addb 8,u			; add in magical light from torch
+LC66C		std effectivelight		; save effective light level for dungeon
 		jsr [displayptr]		; update the main display area
 		puls a,b,x,y,u,pc
 ; swi 15 routine
@@ -1479,10 +1479,10 @@
 		fdb LC8A6			; sound 16 - sword sound
 		fdb LC8B2			; sound 17 - torch sound
 		fdb LC93F			; sound 18 - attack hit
-		fdb LC8E6			; sound 19
-		fdb LC872			; sound 20
-		fdb LC86D			; sound 21
-		fdb LC88A			; sound 22 - wizard
+		fdb LC8E6			; sound 19 - ??? attack miss
+		fdb LC872			; sound 20 - ??? walk into wall sound
+		fdb LC86D			; sound 21 - creature death
+		fdb LC88A			; sound 22 - wizard fade sound
 ; sound 12
 LC80A		ldu #LC823			; point to 144Hz base tone
 		lda #4				; repeat sound 4 times
@@ -2596,7 +2596,7 @@
 LD03D		ldd #$0508
 		rts
 LD041		ldy 5,u
-		tst V22B
+		tst creaturefreeze
 		bne LD06A
 		ldb 12,y
 		bne LD04D
@@ -2970,28 +2970,28 @@
 		dec b,x
 		clr 12,u
 		dod S0E
-		playsoundimm $15
-		ldd ,u
-		bsr LD37F
-		addd powerlevel
-		bpl LD351
-		lda #$7f
-LD351		std powerlevel
-		lda 13,u
-		cmpa #10
-		beq LD386
-		cmpa #11
-		bne LD375
-		dec V22B
-		ldd #$713
-		std V226
-		ldx #$b23
-		stx objectfree
-		ldd zero
-		std backpack
-		std curtorch
-		std righthand
-		std lefthand
+		playsoundimm $15		; play the "kill" sound
+		ldd ,u				; fetch creature power level
+		bsr LD37F			; divide by 8
+		addd powerlevel			; add gained power to current power level
+		bpl LD351			; brif power level did not overflow
+		lda #$7f			; maximize power level at 32767
+LD351		std powerlevel			; save adjusted power level for player
+		lda 13,u			; get the dead creature type
+		cmpa #10			; is dead creature wizard's image?
+		beq LD386			; brif so - do the annoyed wizard
+		cmpa #11			; is dead creature the wizard?
+		bne LD375			; brif not
+		dec creaturefreeze		; stop the creatures
+		ldd #$713			; constants for physical light 7, magical light 19
+		std baselight			; set base light level in dungeon
+		ldx #objecttab+14		; pointer to second object slot in object table
+		stx objectfree			; mark end of object table at just past first object
+		ldd zero			; NULL pointer
+		std backpack			; mark backpack empty
+		std curtorch			; mark no torch burning
+		std righthand			; mark right hand empty
+		std lefthand			; mark left hand empty
 		dod S19
 LD375		dod S0C
 LD377		asra