Napalm and Diggers optimizations (TypeChar)

This commit is contained in:
Pecusx
2023-06-16 17:47:10 +02:00
parent 7621f70656
commit 86d26fe2a1
11 changed files with 33 additions and 40 deletions
+13
View File
@@ -402,6 +402,18 @@ NoClearTanks
; in: CharCode ; in: CharCode
; in: left LOWER corner of the char coordinates (xdraw, ydraw) ; in: left LOWER corner of the char coordinates (xdraw, ydraw)
;-------------------------------------------------- ;--------------------------------------------------
; check coordinates
cpw xdraw #(screenwidth-7)
bcs CharOffTheScreen
lda ydraw
cmp #7
bcc CharOffTheScreen
cmp #(screenHeight-1)
bcc CharOnTheScreen
CharOffTheScreen
rts
CharOnTheScreen
Fast ; Put char without coordinates check!
; char to the table ; char to the table
lda CharCode lda CharCode
sta fontind sta fontind
@@ -560,6 +572,7 @@ EndPutChar
jcs TypeChar.EndPutChar ;nearest RTS jcs TypeChar.EndPutChar ;nearest RTS
; checks ommited. ; checks ommited.
; char to the table ; char to the table
Fast ; Put char without coordinates check!
lda CharCode4x4 lda CharCode4x4
and #%00000001 and #%00000001
beq Upper4bits ; A=0 beq Upper4bits ; A=0
+13
View File
@@ -303,6 +303,18 @@ NoMountain
; in: CharCode ; in: CharCode
; in: left LOWER corner of the char coordinates (xdraw, ydraw) ; in: left LOWER corner of the char coordinates (xdraw, ydraw)
;-------------------------------------------------- ;--------------------------------------------------
; check coordinates
cpw xdraw #(screenwidth-7)
bcs CharOffTheScreen
lda ydraw
cmp #7
bcc CharOffTheScreen
cmp #(screenHeight-1)
bcc CharOnTheScreen
CharOffTheScreen
rts
CharOnTheScreen
Fast ; Put char without coordinates check!
; char to the table ; char to the table
lda CharCode lda CharCode
sta fontind sta fontind
@@ -456,6 +468,7 @@ EndPutChar
jcs TypeChar.EndPutChar ;nearest RTS jcs TypeChar.EndPutChar ;nearest RTS
; checks ommited. ; checks ommited.
; char to the table ; char to the table
Fast ; Put char without coordinates check!
lda CharCode4x4 lda CharCode4x4
and #%00000001 and #%00000001
beq Upper4bits ; A=0 beq Upper4bits ; A=0
Binary file not shown.
+1 -1
View File
@@ -638,7 +638,7 @@ CreditsStart
dta d" "* dta d" "*
dta d"Ideas, help and QA"^ dta d"Ideas, help and QA"^
dta d"Bocianu, Probabilitydragon,"^ dta d"Bocianu, Probabilitydragon,"^
dta d"EnderDude, Dracon,"^ dta d"EnderDude, Dracon, TDC,"^
dta d"Beeblebrox, KrzysRog, lopezpb,"^ dta d"Beeblebrox, KrzysRog, lopezpb,"^
dta d"brad-colbert, archon800, nowy80,"^ dta d"brad-colbert, archon800, nowy80,"^
dta d"Shaggy the Atarian, RetroBorsuk, ZPH" dta d"Shaggy the Atarian, RetroBorsuk, ZPH"
+3 -3
View File
@@ -660,7 +660,7 @@ DrawTankNrX
ldx tanknr ldx tanknr
jsr SetupXYdraw jsr SetupXYdraw
jsr TypeChar jsr TypeChar.Fast
lda Erase lda Erase
jne noTankNoPM jne noTankNoPM
; now P/M graphics on the screen (only for 5 tanks) ; now P/M graphics on the screen (only for 5 tanks)
@@ -787,7 +787,7 @@ DrawTankFlag
sec sec
sbc #8 sbc #8
sta ydraw sta ydraw
jsr TypeChar jsr TypeChar.Fast
NoShieldDraw NoShieldDraw
BarrelChange BarrelChange
ldy #$01 ldy #$01
@@ -925,7 +925,7 @@ tankflash_loop
sbc #8 sbc #8
sta ydraw sta ydraw
jsr SetupXYdraw.X jsr SetupXYdraw.X
jsr TypeChar jsr TypeChar.Fast
ToHighToParachute ToHighToParachute
ldx TankNr ldx TankNr
rts rts
+1 -1
View File
@@ -24,7 +24,7 @@
;--------------------------------------------------- ;---------------------------------------------------
.macro build .macro build
dta d"1.31" ; number of this build (4 bytes) dta d"1.32" ; number of this build (4 bytes)
.endm .endm
.macro RMTSong .macro RMTSong
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -24,7 +24,7 @@
;--------------------------------------------------- ;---------------------------------------------------
.macro build .macro build
dta d"1.28" ; number of this build (4 bytes) dta d"1.32" ; number of this build (4 bytes)
.endm .endm
.macro RMTSong .macro RMTSong
BIN
View File
Binary file not shown.
+1 -34
View File
@@ -294,16 +294,7 @@ LastNapalmRepeat
lda #char_clear_flame ; clear flame symbol lda #char_clear_flame ; clear flame symbol
PutFlameChar PutFlameChar
sta CharCode sta CharCode
; check coordinates
cpw xdraw #(screenwidth-7)
bcs CharOffTheScreen
lda ydraw
cmp #7
bcc CharOffTheScreen
cmp #(screenHeight-1)
bcs CharOffTheScreen
jsr TypeChar jsr TypeChar
CharOffTheScreen
adw xdraw #5 ; reverse half character correction (4 px - we need positon of character center) and next char 1 pixels to righ adw xdraw #5 ; reverse half character correction (4 px - we need positon of character center) and next char 1 pixels to righ
inc magic+1 inc magic+1
lda magic+1 lda magic+1
@@ -443,8 +434,7 @@ WriteToBranches
sta digtabyH,x sta digtabyH,x
dex dex
bpl WriteToBranches bpl WriteToBranches
;jsr DiggerCharacter ; start character ; No memory to check Y range! Let's not draw this char - fix for very high mountans jsr DiggerCharacter ; start character
adw xdraw #4 adw xdraw #4
lda DigLong lda DigLong
; looks strange, but it is (DigLong+2)*4 ; looks strange, but it is (DigLong+2)*4
@@ -503,29 +493,6 @@ DigUp
; sbc #$00 ; sbc #$00
@ ; sta digtabyH,x @ ; sta digtabyH,x
DigCalculateNext DigCalculateNext
;second crashing bug here :) - if too much subtracted from digtaby, it gets under 8 (char height) and starts writing over random areas
lda digtabyH,x
bmi ToHigh
; cmp #0 ; necessary only if screenheight > 255
; bne @+
lda digtabyL,x
cmp #7
;@
bcs CheckLow
ToHigh
lda #0
sta digtabyH,x
lda #7
sta digtabyL,x
CheckLow
;crashing bug here - if too much added to digtaby, it gets over screenheight and starts writing over random areas
;WARNING! fix for 1 byte screenheight. TODO
lda digtabyL,x
cmp #screenheight
bcc @+ ; branch if less
lda #screenheight-1
sta digtabyL,x
@
dex dex
bpl CalculateBranches bpl CalculateBranches
; here we draw... ; here we draw...