Fixed craters on hi-res terrain

This commit is contained in:
blondie7575 2017-09-17 16:17:27 -07:00
parent 3db012d2c0
commit 21a6d85fc0
7 changed files with 74 additions and 69 deletions

View File

@ -21,6 +21,7 @@
7099E3851F4107B100182A82 /* GenerateVRAMYOffset.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMYOffset.py; sourceTree = "<group>"; }; 7099E3851F4107B100182A82 /* GenerateVRAMYOffset.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMYOffset.py; sourceTree = "<group>"; };
70A80FB01F43D7F200BD34C9 /* gamemanager.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gamemanager.s; sourceTree = "<group>"; }; 70A80FB01F43D7F200BD34C9 /* gamemanager.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gamemanager.s; sourceTree = "<group>"; };
70C073091F5BAA3E009844A9 /* collision.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = collision.s; sourceTree = "<group>"; }; 70C073091F5BAA3E009844A9 /* collision.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = collision.s; sourceTree = "<group>"; };
70E266E31F6F262D005AC7E4 /* circleTable.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = circleTable.s; sourceTree = "<group>"; };
70E9D85F1F2BD95400555C19 /* equates.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = equates.s; sourceTree = "<group>"; }; 70E9D85F1F2BD95400555C19 /* equates.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = equates.s; sourceTree = "<group>"; };
70E9D8601F2BD95400555C19 /* graphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = graphics.s; sourceTree = "<group>"; }; 70E9D8601F2BD95400555C19 /* graphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = graphics.s; sourceTree = "<group>"; };
70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; }; 70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; };
@ -45,6 +46,7 @@
70C073091F5BAA3E009844A9 /* collision.s */, 70C073091F5BAA3E009844A9 /* collision.s */,
70F086A01F4230CB002446C3 /* utility.s */, 70F086A01F4230CB002446C3 /* utility.s */,
700C39C51F2E5CA800C24F9C /* tables.s */, 700C39C51F2E5CA800C24F9C /* tables.s */,
70E266E31F6F262D005AC7E4 /* circleTable.s */,
70F0869F1F413A89002446C3 /* player.s */, 70F0869F1F413A89002446C3 /* player.s */,
700F21DF1F4A364600D7007D /* projectile.s */, 700F21DF1F4A364600D7007D /* projectile.s */,
70A80FB01F43D7F200BD34C9 /* gamemanager.s */, 70A80FB01F43D7F200BD34C9 /* gamemanager.s */,

View File

@ -22,24 +22,25 @@ def main(argv):
print ("circleTable%d:" % radius) print ("circleTable%d:" % radius)
print ("\t.word ",end="") print ("\t.word ",end="")
byteR = radius*2
skipMinus1 = 0 skipMinus1 = 0
for p in range(0,radius): for p in range(0,radius):
x = radius-p x = (radius-p)*2
y = (int)(math.sqrt(radius*radius - x*x)) y = (int)(math.sqrt(byteR*byteR - x*x))
if p==radius-1: # A fudge to make circles close better if p==radius-1: # A fudge to make circles close better
y = radius y = byteR
y*=-2 # Because X=bytes and we need -Y y*=-1 # Because X=bytes and we need -Y
print (y, end=",") print (y, end=",")
skipMinus1 = 0 skipMinus1 = 0
for p in range(0,radius): for p in range(0,radius):
x = p+1 x = (p+1)*2
y = (int)(math.sqrt(radius*radius - x*x)) y = (int)(math.sqrt(byteR*byteR - x*x))
if p==0: # A fudge to make circles close better if p==0: # A fudge to make circles close better
y = radius y = byteR
y*=-2 # Because X=bytes and we need -Y y*=-1 # Because X=bytes and we need -Y
if p==radius-1: if p==radius-1:
print(y) print(y)
else: else:

59
circleTable.s Normal file
View File

@ -0,0 +1,59 @@
circleTable: ;-Y for each X, in bytes
.addr 0
.addr 0
.addr 0
.addr circleTable3
.addr circleTable4
.addr circleTable5
.addr circleTable6
.addr circleTable7
.addr circleTable8
.addr circleTable9
.addr circleTable10
.addr circleTable11
.addr circleTable12
.addr circleTable13
.addr circleTable14
.addr circleTable15
.addr circleTable16
.addr circleTable17
.addr circleTable18
.addr circleTable19
.addr circleTable20
circleTable3:
.word 0,-4,-6,-6,-4,0
circleTable4:
.word 0,-5,-6,-8,-8,-6,-5,0
circleTable5:
.word 0,-6,-8,-9,-10,-10,-9,-8,-6,0
circleTable6:
.word 0,-6,-8,-10,-11,-12,-12,-11,-10,-8,-6,0
circleTable7:
.word 0,-7,-9,-11,-12,-13,-14,-14,-13,-12,-11,-9,-7,0
circleTable8:
.word 0,-7,-10,-12,-13,-14,-15,-16,-16,-15,-14,-13,-12,-10,-7,0
circleTable9:
.word 0,-8,-11,-13,-14,-16,-16,-17,-18,-18,-17,-16,-16,-14,-13,-11,-8,0
circleTable10:
.word 0,-8,-12,-14,-16,-17,-18,-19,-19,-20,-20,-19,-19,-18,-17,-16,-14,-12,-8,0
circleTable11:
.word 0,-9,-12,-15,-16,-18,-19,-20,-21,-21,-22,-22,-21,-21,-20,-19,-18,-16,-15,-12,-9,0
circleTable12:
.word 0,-9,-13,-15,-17,-19,-20,-21,-22,-23,-23,-24,-24,-23,-23,-22,-21,-20,-19,-17,-15,-13,-9,0
circleTable13:
.word 0,-10,-13,-16,-18,-20,-21,-23,-24,-24,-25,-25,-26,-26,-25,-25,-24,-24,-23,-21,-20,-18,-16,-13,-10,0
circleTable14:
.word 0,-10,-14,-17,-19,-21,-22,-24,-25,-26,-26,-27,-27,-28,-28,-27,-27,-26,-26,-25,-24,-22,-21,-19,-17,-14,-10,0
circleTable15:
.word 0,-10,-14,-18,-20,-22,-24,-25,-26,-27,-28,-28,-29,-29,-30,-30,-29,-29,-28,-28,-27,-26,-25,-24,-22,-20,-18,-14,-10,0
circleTable16:
.word 0,-11,-15,-18,-21,-23,-24,-26,-27,-28,-29,-30,-30,-31,-31,-32,-32,-31,-31,-30,-30,-29,-28,-27,-26,-24,-23,-21,-18,-15,-11,0
circleTable17:
.word 0,-11,-16,-19,-21,-24,-25,-27,-28,-30,-30,-31,-32,-33,-33,-33,-34,-34,-33,-33,-33,-32,-31,-30,-30,-28,-27,-25,-24,-21,-19,-16,-11,0
circleTable18:
.word 0,-11,-16,-19,-22,-24,-26,-28,-29,-31,-32,-33,-33,-34,-35,-35,-35,-36,-36,-35,-35,-35,-34,-33,-33,-32,-31,-29,-28,-26,-24,-22,-19,-16,-11,0
circleTable19:
.word 0,-12,-16,-20,-23,-25,-27,-29,-30,-32,-33,-34,-35,-36,-36,-37,-37,-37,-38,-38,-37,-37,-37,-36,-36,-35,-34,-33,-32,-30,-29,-27,-25,-23,-20,-16,-12,0
circleTable20:
.word 0,-12,-17,-21,-24,-26,-28,-30,-32,-33,-34,-35,-36,-37,-38,-38,-39,-39,-39,-40,-40,-39,-39,-39,-38,-38,-37,-36,-35,-34,-33,-32,-30,-28,-26,-24,-21,-17,-12,0

Binary file not shown.

View File

@ -30,7 +30,7 @@ GRAVITY = $ffff ; 8.8 fixed point
projectileTypes: ; Byte offsets into projectile type data structure projectileTypes: ; Byte offsets into projectile type data structure
.word 50 ; Damage .word 50 ; Damage
.word 12 ; Crater radius .word 6 ; Crater radius
.word 0,0 ; Padding .word 0,0 ; Padding
PT_DAMAGE = 0 PT_DAMAGE = 0

View File

@ -152,62 +152,4 @@ vramYOffset:
.word $6400,$64a0,$6540,$65e0,$6680,$6720,$67c0,$6860,$6900,$69a0,$6a40,$6ae0,$6b80,$6c20,$6cc0,$6d60,$6e00,$6ea0,$6f40,$6fe0 .word $6400,$64a0,$6540,$65e0,$6680,$6720,$67c0,$6860,$6900,$69a0,$6a40,$6ae0,$6b80,$6c20,$6cc0,$6d60,$6e00,$6ea0,$6f40,$6fe0
.word $7080,$7120,$71c0,$7260,$7300,$73a0,$7440,$74e0,$7580,$7620,$76c0,$7760,$7800,$78a0,$7940,$79e0,$7a80,$7b20,$7bc0,$7c60 .word $7080,$7120,$71c0,$7260,$7300,$73a0,$7440,$74e0,$7580,$7620,$76c0,$7760,$7800,$78a0,$7940,$79e0,$7a80,$7b20,$7bc0,$7c60
circleTable: ;-Y for each X, in bytes .include "circleTable.s"
.addr 0
.addr 0
.addr 0
.addr circleTable3
.addr circleTable4
.addr circleTable5
.addr circleTable6
.addr circleTable7
.addr circleTable8
.addr circleTable9
.addr circleTable10
.addr circleTable11
.addr circleTable12
.addr circleTable13
.addr circleTable14
.addr circleTable15
.addr circleTable16
.addr circleTable17
.addr circleTable18
.addr circleTable19
.addr circleTable20
circleTable3:
.word 0,-4,-6,-6,-4,0
circleTable4:
.word 0,-4,-6,-8,-8,-6,-4,0
circleTable5:
.word 0,-6,-8,-8,-10,-10,-8,-8,-6,0
circleTable6:
.word 0,-6,-8,-10,-10,-12,-12,-10,-10,-8,-6,0
circleTable7:
.word 0,-6,-8,-10,-12,-12,-14,-14,-12,-12,-10,-8,-6,0
circleTable8:
.word 0,-6,-10,-12,-12,-14,-14,-16,-16,-14,-14,-12,-12,-10,-6,0
circleTable9:
.word 0,-8,-10,-12,-14,-16,-16,-16,-18,-18,-16,-16,-16,-14,-12,-10,-8,0
circleTable10:
.word 0,-8,-12,-14,-16,-16,-18,-18,-18,-20,-20,-18,-18,-18,-16,-16,-14,-12,-8,0
circleTable11:
.word 0,-8,-12,-14,-16,-18,-18,-20,-20,-20,-22,-22,-20,-20,-20,-18,-18,-16,-14,-12,-8,0
circleTable12:
.word 0,-8,-12,-14,-16,-18,-20,-20,-22,-22,-22,-24,-24,-22,-22,-22,-20,-20,-18,-16,-14,-12,-8,0
circleTable13:
.word 0,-10,-12,-16,-18,-20,-20,-22,-24,-24,-24,-24,-26,-26,-24,-24,-24,-24,-22,-20,-20,-18,-16,-12,-10,0
circleTable14:
.word 0,-10,-14,-16,-18,-20,-22,-24,-24,-26,-26,-26,-26,-28,-28,-26,-26,-26,-26,-24,-24,-22,-20,-18,-16,-14,-10,0
circleTable15:
.word 0,-10,-14,-18,-20,-22,-24,-24,-26,-26,-28,-28,-28,-28,-30,-30,-28,-28,-28,-28,-26,-26,-24,-24,-22,-20,-18,-14,-10,0
circleTable16:
.word 0,-10,-14,-18,-20,-22,-24,-26,-26,-28,-28,-30,-30,-30,-30,-32,-32,-30,-30,-30,-30,-28,-28,-26,-26,-24,-22,-20,-18,-14,-10,0
circleTable17:
.word 0,-10,-16,-18,-20,-24,-24,-26,-28,-30,-30,-30,-32,-32,-32,-32,-34,-34,-32,-32,-32,-32,-30,-30,-30,-28,-26,-24,-24,-20,-18,-16,-10,0
circleTable18:
.word 0,-10,-16,-18,-22,-24,-26,-28,-28,-30,-32,-32,-32,-34,-34,-34,-34,-36,-36,-34,-34,-34,-34,-32,-32,-32,-30,-28,-28,-26,-24,-22,-18,-16,-10,0
circleTable19:
.word 0,-12,-16,-20,-22,-24,-26,-28,-30,-32,-32,-34,-34,-36,-36,-36,-36,-36,-38,-38,-36,-36,-36,-36,-36,-34,-34,-32,-32,-30,-28,-26,-24,-22,-20,-16,-12,0
circleTable20:
.word 0,-12,-16,-20,-24,-26,-28,-30,-32,-32,-34,-34,-36,-36,-38,-38,-38,-38,-38,-40,-40,-38,-38,-38,-38,-38,-36,-36,-34,-34,-32,-32,-30,-28,-26,-24,-20,-16,-12,0

View File

@ -64,8 +64,9 @@ craterTerrain:
lda #TERRAINWIDTH ; Convert X pos to terrain-right byte count lda #TERRAINWIDTH ; Convert X pos to terrain-right byte count
sec sec
sbc PARAML0 sbc PARAML0
sty SCRATCHL ; Center width sty SCRATCHL ; Center width in bytes
sbc SCRATCHL sbc SCRATCHL
; sbc SCRATCHL
and #$fffe ; Force even and #$fffe ; Force even
clc clc
adc #terrainData adc #terrainData