mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-21 15:33:11 +00:00
Added progress bar for anger
Also fixed memory overwrite in health management caused by hit animations
This commit is contained in:
parent
f613e7460c
commit
0ee3e558b6
@ -14,6 +14,7 @@
|
||||
700F21E01F4A3A5500D7007D /* GenerateTrigTables.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateTrigTables.py; sourceTree = "<group>"; };
|
||||
700F72872112428D00225B17 /* RenumberSpriteFiles.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = RenumberSpriteFiles.sh; sourceTree = "<group>"; };
|
||||
701E708A2A649A230030C35D /* tinyNumbers.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = tinyNumbers.s; sourceTree = "<group>"; };
|
||||
701E708B2A660CEB0030C35D /* progressBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = progressBar.s; sourceTree = "<group>"; };
|
||||
705456862A43E03B00A2B866 /* GeneratePixelCircle.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GeneratePixelCircle.py; sourceTree = "<group>"; };
|
||||
705456882A4D336200A2B866 /* animation.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = animation.s; sourceTree = "<group>"; };
|
||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
||||
@ -63,6 +64,7 @@
|
||||
70F011D123B989B800C8873F /* random.s */,
|
||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||
706DF1651F2D4A8100AA6680 /* terrain.s */,
|
||||
701E708B2A660CEB0030C35D /* progressBar.s */,
|
||||
705AAFA920040B0D001BB0ED /* terrain_e1.s */,
|
||||
70F011D023B91B2900C8873F /* dirt.s */,
|
||||
70C073091F5BAA3E009844A9 /* collision.s */,
|
||||
|
@ -46,6 +46,7 @@ beginGameplay:
|
||||
ldy #1
|
||||
jsr playerCreate
|
||||
|
||||
jsr syncPlayerHeader
|
||||
ldy #0
|
||||
jsr renderPlayerHeader
|
||||
|
||||
@ -278,6 +279,7 @@ endTurnRefresh:
|
||||
sta mapScrollRequested
|
||||
|
||||
endTurnHeader:
|
||||
jsr syncPlayerHeader
|
||||
jsr renderPlayerHeader
|
||||
jsr renderInventory
|
||||
stz turnRequested
|
||||
|
2
gscats.s
2
gscats.s
@ -52,6 +52,8 @@ quitGame:
|
||||
.include "inventory.s"
|
||||
.include "dirt.s"
|
||||
.include "crosshair.s"
|
||||
.include "progressBar.s"
|
||||
|
||||
endMainBank2:
|
||||
|
||||
|
||||
|
40
player.s
40
player.s
@ -5,6 +5,7 @@
|
||||
; Created by Quinn Dunki on 8/13/17
|
||||
;
|
||||
|
||||
MAX_ANGER = 100
|
||||
|
||||
playerData:
|
||||
;;;;;;;;;;;; PLAYER 1 ;;;;;;;;;;;;;;
|
||||
@ -18,7 +19,7 @@ playerData:
|
||||
|
||||
.word 24 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.word MAX_ANGER ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
.word 29 ; Base Sprite
|
||||
.word 0,5,7,0,0,0,0,0 ; Prices
|
||||
@ -39,7 +40,7 @@ playerData:
|
||||
|
||||
.word 154 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.word MAX_ANGER ; Anger
|
||||
.byte 8,"TINKER " ; Name
|
||||
.word 20 ; Base Sprite
|
||||
.word 0,5,7,0,0,0,0,0 ; Prices
|
||||
@ -110,6 +111,8 @@ playerCreate:
|
||||
adc SCRATCHL
|
||||
sta PARAML0
|
||||
jsr placeGameObjectOnTerrain
|
||||
|
||||
jsr createProgressBar
|
||||
rts
|
||||
|
||||
|
||||
@ -437,6 +440,7 @@ renderPlayerHeader:
|
||||
adc #playerData
|
||||
adc #PD_NAME
|
||||
sta PARAML0
|
||||
|
||||
phy
|
||||
ldy #$25a1
|
||||
lda #1
|
||||
@ -451,10 +455,6 @@ renderPlayerHeader:
|
||||
; ldx #76 + $2500
|
||||
; jsr drawNumber
|
||||
|
||||
; ldx #88 + 321
|
||||
; lda #angerStr
|
||||
; jsr DrawString
|
||||
|
||||
lda playerData+PD_TREATS,y
|
||||
ldx #$25f0
|
||||
jsr drawNumber
|
||||
@ -465,14 +465,42 @@ renderPlayerHeader:
|
||||
lda #1
|
||||
jsl renderStringFar
|
||||
|
||||
lda #angerStr
|
||||
sta PARAML0
|
||||
ldy #$25ff
|
||||
lda #1
|
||||
jsl renderStringFar
|
||||
jsr renderProgressBar
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
treatsStr:
|
||||
pstring "TREATS:$"
|
||||
angerStr:
|
||||
pstring "ANGER:"
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; syncPlayerHeader
|
||||
;
|
||||
syncPlayerHeader:
|
||||
SAVE_AY
|
||||
ldy currentPlayer
|
||||
PLAYERPTR_Y
|
||||
|
||||
; Convert anger to progress bar value
|
||||
sec
|
||||
lda #MAX_ANGER
|
||||
sbc playerData+PD_ANGER,y
|
||||
lsr
|
||||
lsr
|
||||
jsr setProgressBar
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; playIterativeMeowSound
|
||||
;
|
||||
|
133
progressBar.s
Normal file
133
progressBar.s
Normal file
@ -0,0 +1,133 @@
|
||||
;
|
||||
; progressBar
|
||||
; A simple GUI element to show progress
|
||||
;
|
||||
; Created by Quinn Dunki on 7/17/23
|
||||
;
|
||||
|
||||
BORDER = $FF
|
||||
FILL = $99
|
||||
EMPTY = $ee
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; createProgressBar
|
||||
;
|
||||
;
|
||||
;
|
||||
createProgressBar:
|
||||
lda #1
|
||||
sta currentProgressBar+CBR_ACTIVE
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; advanceProgressBar
|
||||
;
|
||||
; A = Bytes to advance
|
||||
;
|
||||
; Trashes SCRATCHL
|
||||
;
|
||||
advanceProgressBar:
|
||||
sta SCRATCHL
|
||||
lda currentProgressBar+CBR_CURRENT
|
||||
clc
|
||||
adc SCRATCHL
|
||||
cmp currentProgressBar+CBR_FINAL
|
||||
beq advanceProgressBarDone
|
||||
bcs advanceProgressBarClamp
|
||||
|
||||
advanceProgressBarDone:
|
||||
sta currentProgressBar+CBR_CURRENT
|
||||
rts
|
||||
|
||||
advanceProgressBarClamp:
|
||||
lda currentProgressBar+CBR_FINAL
|
||||
bra advanceProgressBarDone
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; setProgressBar
|
||||
;
|
||||
; A = New byte value
|
||||
;
|
||||
setProgressBar:
|
||||
sta currentProgressBar+CBR_CURRENT
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; renderProgressBar
|
||||
;
|
||||
; Not very fast
|
||||
;
|
||||
renderProgressBar:
|
||||
SAVE_AXY
|
||||
ldy #2 ; Room for left and right borders
|
||||
ldx currentProgressBar+CBR_VRAM
|
||||
|
||||
BITS8A
|
||||
lda #BORDER ; Left border
|
||||
sta VRAMBANK,x
|
||||
sta VRAMBANK+160,x
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
sta VRAMBANK+160*7,x
|
||||
inx
|
||||
renderProgressBarLoop:
|
||||
lda #BORDER
|
||||
sta VRAMBANK,x ; Top border
|
||||
sta VRAMBANK+160*7,x ; Bottom border
|
||||
|
||||
cpy currentProgressBar+CBR_CURRENT
|
||||
bcs renderProgressBarEmpty
|
||||
|
||||
lda #FILL
|
||||
|
||||
renderProgressBarFill:
|
||||
sta VRAMBANK+160*1,x ; Bar
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
|
||||
inx
|
||||
iny
|
||||
cpy currentProgressBar+CBR_FINAL
|
||||
bne renderProgressBarLoop
|
||||
|
||||
lda #BORDER ; Right border
|
||||
sta VRAMBANK,x
|
||||
sta VRAMBANK+160,x
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
sta VRAMBANK+160*7,x
|
||||
|
||||
BITS16
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
renderProgressBarEmpty:
|
||||
.a8
|
||||
lda #EMPTY
|
||||
bra renderProgressBarFill
|
||||
|
||||
CBR_ACTIVE = 0
|
||||
CBR_CURRENT = 2
|
||||
CBR_FINAL = 4
|
||||
CBR_VRAM = 6
|
||||
|
||||
|
||||
currentProgressBar:
|
||||
.word 0 ; Active
|
||||
.word 0 ; Current progress in bytes
|
||||
.word 25 ; Final progress in bytes
|
||||
.word $2117 ; VRAM position (top left)
|
||||
|
||||
|
@ -128,7 +128,7 @@ projectileTypes:
|
||||
.endrepeat
|
||||
|
||||
; Fan
|
||||
.word 3 ; Damage
|
||||
.word 0 ; Damage
|
||||
.word 3 ; Crater radius
|
||||
.word 12 ; Frame 0
|
||||
.word 12 ; Frame 1
|
||||
@ -858,13 +858,12 @@ unrenderProjectileDone:
|
||||
;
|
||||
processPlayerImpact:
|
||||
phy
|
||||
phx
|
||||
PLAYERPTR_X
|
||||
|
||||
; Do hit animation
|
||||
plx
|
||||
txy
|
||||
jsr renderHitAnimation
|
||||
|
||||
PLAYERPTR_X
|
||||
|
||||
; Find projectile data structure
|
||||
ply
|
||||
|
Loading…
Reference in New Issue
Block a user