From 2e92ac118e1d9f3b245d657563570d5f58612b27 Mon Sep 17 00:00:00 2001 From: blondie7575 Date: Sat, 22 Dec 2018 11:41:12 -0700 Subject: [PATCH] Basic framework for fan Also added support for delegate methods in projectiles --- Art/013Stand.xcf | Bin 0 -> 975 bytes GSCats.xcodeproj/project.pbxproj | 2 + Makefile | 2 +- equates.s | 10 ++++ fan.s | 57 ++++++++++++++++++++ gscats.2mg | Bin 819264 -> 819264 bytes gscats.s | 1 + macros.s | 9 ++++ projectile.s | 88 ++++++++++++++++++++++++------- 9 files changed, 148 insertions(+), 21 deletions(-) create mode 100644 Art/013Stand.xcf create mode 100644 fan.s diff --git a/Art/013Stand.xcf b/Art/013Stand.xcf new file mode 100644 index 0000000000000000000000000000000000000000..2b9d5a478bde08d93df6ee9d9e755bb8d719c7c0 GIT binary patch literal 975 zcma)4&2G~`5MJA%WE0Y)<>%DHUXYSQP@?h#1*t+J5)x0~I%{{;#ExvYPEO&-k!z1g zs1>|G4pE-~c!Y>I=nH@_-#EJ{QB$>}e41~+nb{rBBv8YV7<;}r>vXyd*3huwE#M`c zzx?{mJ}~?~`a3_)_pj%#7rvjLf6KBgXKXf`Efx!w%|E}rKz5!(V>^IF7d!^a2cH-t zz@7jlpaMM8obsL`{}8?wpry7K4TmyJaW1;peHBYLm3@(^^jI9e>Aj;!qexXlH<0Zh zR(+jqv1XD^22v!^K=oUdrXP6GAc{q^aP2raaz*Dwr?3sAt3xf69&IQ!adA7L(s43! zJrxF`Yu3DrlwpUCuogH(M}S}N=2Y{IgkgUzQ1Th^zcjh{vHRn5>rxwfq0j9%^ AFaQ7m literal 0 HcmV?d00001 diff --git a/GSCats.xcodeproj/project.pbxproj b/GSCats.xcodeproj/project.pbxproj index cbe65fd..a3bfa78 100644 --- a/GSCats.xcodeproj/project.pbxproj +++ b/GSCats.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 700FFAFB1F40F3BF00A442DE /* font.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font.s; sourceTree = ""; }; 7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = ""; }; 705AAFA920040B0D001BB0ED /* terrain_e1.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = terrain_e1.s; sourceTree = ""; }; + 705C54E62124B7F300515A6B /* fan.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = fan.s; sourceTree = ""; }; 706DF1641F2D39F700AA6680 /* loader.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loader.s; sourceTree = ""; }; 706DF1651F2D4A8100AA6680 /* terrain.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = terrain.s; sourceTree = ""; }; 7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateRenderSpans.py; sourceTree = ""; }; @@ -60,6 +61,7 @@ 70F0869F1F413A89002446C3 /* player.s */, 700B5E6F2069831000B31C00 /* inventory.s */, 700F21DF1F4A364600D7007D /* projectile.s */, + 705C54E62124B7F300515A6B /* fan.s */, 70A80FB01F43D7F200BD34C9 /* gamemanager.s */, 70E554C41F807ADB00F3C871 /* spritebank.s */, 70E9D8611F2BD95400555C19 /* gscats.s */, diff --git a/Makefile b/Makefile index a5d7006..755a201 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ SPRITES=SpriteBank FLIPLIST=$(wildcard Art/*Fan.gif) $(wildcard Art/*Spit*.gif) REMOTESYMBOLS=-Wl $(shell ./ParseMapFile.py *.map) -all: terrain_e1 $(PGM) loader +all: clean terrain_e1 $(PGM) loader $(PGM): diff --git a/equates.s b/equates.s index 6558ecf..c9c06c9 100644 --- a/equates.s +++ b/equates.s @@ -53,3 +53,13 @@ terrainData = $f500 ; .word 0 ; .endrepeat terrainDataEnd = terrainData + (TERRAINWIDTH/2 * 2) + + +; projectileData struct offsets +JD_PRECISEX = 132 +JD_PRECISEY = 134 +JD_VX = 136 +JD_VY = 138 +JD_TYPE = 140 +JD_NEW = 142 + diff --git a/fan.s b/fan.s new file mode 100644 index 0000000..f020f49 --- /dev/null +++ b/fan.s @@ -0,0 +1,57 @@ +; +; fan +; Code and data structures related to the special fan weapon +; +; Created by Quinn Dunki on 8/15/18 +; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; deployFan +; +; Y: Index to projectile structure +; +deployFan: + SAVE_AY + + lda #200 ; Drop in from the top of the view + sta projectileData+GO_POSY,y + + lda #$c80 + sta projectileData+JD_PRECISEY,y + + lda #0 + sta projectileData+JD_VX,y + sta projectileData+JD_VY,y + + RESTORE_AY + rts + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; updateFan +; +; +updateFan: + SAVE_AY + + ; Wait for fan to collide with us as it falls from the sky + ldy #0 + lda projectileData+GO_POSX,y + sta rectParams + lda projectileData+GO_POSY,y + sta rectParams+2 + lda #GAMEOBJECTWIDTH + sta rectParams+4 + lda #GAMEOBJECTHEIGHT + sta rectParams+6 + + jsr playerIntersectRect + cmp #0 + beq updateFanDone + +updateFanDone: + RESTORE_AY + + rts + + diff --git a/gscats.2mg b/gscats.2mg index 8fde88c18bb7389b31fc8507e0cae98cb8513049..b332b082ebe2c3dd6c54a34d42047e07ef00f7b6 100644 GIT binary patch delta 1075 zcmYjPUuYCZ7@wWHTkm#r@gP(-DVI#FM%!vxV;?MtT+;J6u4yi(sO>^aC`EQAcPD-6 z!+~{Cjy{z27Bb|g#JKLe^T2M>HBzk=g=lIBxAJu(|r2y=*akIhxe%} zLP)%eK0$>t+6)UOwMwK9Qgws@bM3c?CkjICyDqC{bZtEsjju%G!l|Ex?pi^7X{BN~ zY>oEd)s@r*;Uk%BF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yi_q7i{ g7D0HmzRZP>!cW0ca1?nIJVic*Kp{S?FOyFF0mgkue*gdg diff --git a/gscats.s b/gscats.s index 0b14c9c..ba773c6 100644 --- a/gscats.s +++ b/gscats.s @@ -46,6 +46,7 @@ quitGame: .include "tables.s" .include "gamemanager.s" .include "input.s" +.include "fan.s" .include "projectile.s" .include "inventory.s" diff --git a/macros.s b/macros.s index 8cad5e7..877b385 100644 --- a/macros.s +++ b/macros.s @@ -176,6 +176,7 @@ .endmacro .macro BREAK + .local nobrk pha lda breakpoint beq nobrk @@ -188,6 +189,7 @@ nobrk: .endmacro .macro BREAK_NOSTACK + .local nobrk lda breakpoint beq nobrk lda #1 @@ -212,6 +214,7 @@ deadlock: jmp deadlock .macro BREAKLOCK + .local deadlock pha lda breakpoint beq nobrk @@ -223,6 +226,12 @@ nobrk: .endmacro +.macro JSRA ; Destination in accumulator + .local jsri_smc + sta jsri_smc+1 +jsri_smc: + jsr 0 +.endmacro ;;;;;;;;;; ; Stack Macros diff --git a/projectile.s b/projectile.s index 834541f..3bca1db 100644 --- a/projectile.s +++ b/projectile.s @@ -26,25 +26,27 @@ projectileData: .byte 0 ; Padding to 256-byte boundary .endrepeat -JD_PRECISEX = 132 ; Byte offsets into projectile data structure -JD_PRECISEY = 134 -JD_VX = 136 -JD_VY = 138 -JD_TYPE = 140 -JD_NEW = 142 +; Byte offsets for that ^ data structure can be found in equates.s GRAVITY = $ffff ; 8.8 fixed point projectileTypes: + PT_SPIT = 0 + PT_BOMB = 1 + PT_FAN = 2 + ; Spit .word 3 ; Damage .word 3 ; Crater radius .word 4 ; Frame 0 .word 6 ; Frame 1 .word 8 ; Frame 2 + .addr 0 ; Deploy + .addr 0 ; Update + .addr 0 ; Render - .word 0,0,0 ; Padding to 16-byte boundary + ;.word ; Padding to 16-byte boundary (none needed) ; Bomb .word 50 ; Damage @@ -52,8 +54,11 @@ projectileTypes: .word 3 ; Frame 0 .word 3 ; Frame 1 .word 3 ; Frame 2 + .addr 0 ; Deploy + .addr 0 ; Update + .addr 0 ; Render - .word 0,0,0 ; Padding to 16-byte boundary + ;.word ; Padding to 16-byte boundary (none needed) ; Fan .word 3 ; Damage @@ -61,8 +66,11 @@ projectileTypes: .word 12 ; Frame 0 .word 12 ; Frame 1 .word 12 ; Frame 2 + .addr deployFan ; Deploy + .addr updateFan ; Update + .addr 0 ; Render - .word 0,0,0 ; Padding to 16-byte boundary + ;.word ; Padding to 16-byte boundary (none needed) PT_DAMAGE = 0 ; Byte offsets into projectile type data structure @@ -70,7 +78,9 @@ PT_RADIUS = 2 PT_FRAME0 = 4 PT_FRAME1 = 6 PT_FRAME2 = 8 - +PT_DEPLOY = 10 +PT_UPDATE = 12 +PT_RENDER = 14 .macro PROJECTILEPTR_Y tya ; Pointer to projectile structure from index @@ -107,7 +117,6 @@ projectileParams: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; fireProjectile ; -; Trashes SCRATCHL ; fireProjectile: SAVE_AXY @@ -135,6 +144,43 @@ fireProjectile: asl sta projectileData+JD_PRECISEY,y + lda projectileParams+8 ; Type + sta projectileData+JD_TYPE,y + + ; Check for special deployment code + phy + tay ; Find projectile type data + PROJECTILETYPEPTR_Y + + lda projectileTypes+PT_DEPLOY,y + beq fireProjectileStandardDeploy + ply + JSRA + bra fireProjectileFinish + +fireProjectileStandardDeploy: + ply + + ; Standard physics setup + jsr prepareProjectilePhysics + +fireProjectileFinish: + lda #1 + sta projectileData+JD_NEW,y + stz projectileActive + + RESTORE_AXY + rts + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; prepareProjectilePhysics +; +; Y: Index to projectile structure +; +prepareProjectilePhysics: + SAVE_AXY + lda projectileParams+6 ; Convert power to 8.8 asl asl @@ -167,13 +213,6 @@ fireProjectile: jsr mult88 sta projectileData+JD_VY,y - lda projectileParams+8 ; Type - sta projectileData+JD_TYPE,y - - lda #1 - sta projectileData+JD_NEW,y - stz projectileActive - RESTORE_AXY rts @@ -212,7 +251,7 @@ updateProjectilePhysicsActive: adc projectileData+JD_PRECISEX sta projectileData+JD_PRECISEX - ; Convert to integral for rendering + ; Convert to integer for rendering lsr lsr lsr @@ -238,7 +277,7 @@ updateProjectilePhysicsContinue: adc projectileData+JD_PRECISEY sta projectileData+JD_PRECISEY - ; Convert to integral for rendering + ; Convert to integer for rendering lsr lsr lsr @@ -247,6 +286,15 @@ updateProjectilePhysicsContinue: cmp #GAMEOBJECTHEIGHT bmi updateProjectilePhysicsDelete + ; Check for special update code + ldy #0 + lda projectileData+JD_TYPE,y + tay + PROJECTILETYPEPTR_Y + lda projectileTypes+PT_UPDATE,y + beq updateProjectilePhysicsDone + JSRA + updateProjectilePhysicsDone: RESTORE_AY rts