mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-04-07 19:37:06 +00:00
Terrain data resolution doubled
This commit is contained in:
parent
9a4d9e7fb7
commit
b0588cd14f
@ -6,9 +6,9 @@ import math
|
||||
def main(argv):
|
||||
|
||||
minRadius = 3
|
||||
maxRadius = 10
|
||||
maxRadius = 20
|
||||
|
||||
print ("circleTable:\t\t;-Y for each X, in words")
|
||||
print ("circleTable:\t\t;-Y for each X, in bytes")
|
||||
|
||||
for radius in range(0,maxRadius+1):
|
||||
if radius < minRadius:
|
||||
@ -29,7 +29,7 @@ def main(argv):
|
||||
y = (int)(math.sqrt(radius*radius - x*x))
|
||||
if p==radius-1: # A fudge to make circles close better
|
||||
y = radius
|
||||
y*=-4 # Because X=words and we need -Y
|
||||
y*=-2 # Because X=bytes and we need -Y
|
||||
print (y, end=",")
|
||||
|
||||
skipMinus1 = 0
|
||||
@ -39,7 +39,7 @@ def main(argv):
|
||||
if p==0: # A fudge to make circles close better
|
||||
y = radius
|
||||
|
||||
y*=-4 # Because X=words and we need -Y
|
||||
y*=-2 # Because X=bytes and we need -Y
|
||||
if p==radius-1:
|
||||
print(y)
|
||||
else:
|
||||
|
@ -31,17 +31,15 @@ intersectRectTerrain:
|
||||
lda rectParams
|
||||
clc
|
||||
adc rectParams+4 ; Reverse rect horizontally
|
||||
lsr ; Convert X to bytes
|
||||
and #$fffe ; Force even
|
||||
sta rectParams
|
||||
|
||||
lda #TERRAINWIDTH/2 ; Reverse X coordinate system
|
||||
lda #TERRAINWIDTH ; Reverse X coordinate system
|
||||
sec
|
||||
sbc rectParams
|
||||
sta rectParams
|
||||
tay ; We'll need this later as an index into height data words
|
||||
|
||||
lsr rectParams+4 ; Convert width to bytes
|
||||
sec
|
||||
sbc rectParams+4 ; Convert width to extent
|
||||
sta rectParams+4
|
||||
|
@ -45,7 +45,7 @@ beginGameplay:
|
||||
ldy #0
|
||||
jsr playerCreate
|
||||
|
||||
lda #190
|
||||
lda #191
|
||||
ldy #1
|
||||
jsr playerCreate
|
||||
|
||||
|
@ -37,8 +37,7 @@ placeGameObjectOnTerrain:
|
||||
sec
|
||||
sbc SCRATCHL
|
||||
|
||||
lsr ; Convert to bytes and force even
|
||||
and #$fffe
|
||||
and #$fffe ; Force even
|
||||
tay
|
||||
lda terrainData,y
|
||||
|
||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
2
player.s
2
player.s
@ -12,7 +12,7 @@ playerData:
|
||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||
|
||||
.word 45 ; Angle in degrees from +X
|
||||
.word 90 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
|
48
tables.s
48
tables.s
@ -152,7 +152,7 @@ vramYOffset:
|
||||
.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
|
||||
|
||||
circleTable: ;-Y for each X, in words
|
||||
circleTable: ;-Y for each X, in bytes
|
||||
.addr 0
|
||||
.addr 0
|
||||
.addr 0
|
||||
@ -164,20 +164,50 @@ circleTable: ;-Y for each X, in words
|
||||
.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,-8,-12,-12,-8,0
|
||||
.word 0,-4,-6,-6,-4,0
|
||||
circleTable4:
|
||||
.word 0,-8,-12,-16,-16,-12,-8,0
|
||||
.word 0,-4,-6,-8,-8,-6,-4,0
|
||||
circleTable5:
|
||||
.word 0,-12,-16,-16,-20,-20,-16,-16,-12,0
|
||||
.word 0,-6,-8,-8,-10,-10,-8,-8,-6,0
|
||||
circleTable6:
|
||||
.word 0,-12,-16,-20,-20,-24,-24,-20,-20,-16,-12,0
|
||||
.word 0,-6,-8,-10,-10,-12,-12,-10,-10,-8,-6,0
|
||||
circleTable7:
|
||||
.word 0,-12,-16,-20,-24,-24,-28,-28,-24,-24,-20,-16,-12,0
|
||||
.word 0,-6,-8,-10,-12,-12,-14,-14,-12,-12,-10,-8,-6,0
|
||||
circleTable8:
|
||||
.word 0,-12,-20,-24,-24,-28,-28,-32,-32,-28,-28,-24,-24,-20,-12,0
|
||||
.word 0,-6,-10,-12,-12,-14,-14,-16,-16,-14,-14,-12,-12,-10,-6,0
|
||||
circleTable9:
|
||||
.word 0,-16,-20,-24,-28,-32,-32,-32,-36,-36,-32,-32,-32,-28,-24,-20,-16,0
|
||||
.word 0,-8,-10,-12,-14,-16,-16,-16,-18,-18,-16,-16,-16,-14,-12,-10,-8,0
|
||||
circleTable10:
|
||||
.word 0,-16,-24,-28,-32,-32,-36,-36,-36,-40,-40,-36,-36,-36,-32,-32,-28,-24,-16,0
|
||||
.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
|
||||
|
33
terrain.s
33
terrain.s
@ -63,19 +63,17 @@ craterTerrain:
|
||||
sbc PARAML0
|
||||
sty SCRATCHL ; Center width
|
||||
sbc SCRATCHL
|
||||
lsr
|
||||
and #$fffe
|
||||
and #$fffe ; Force even
|
||||
clc
|
||||
adc #terrainData
|
||||
sta PARAML0
|
||||
|
||||
phy
|
||||
tya ; Look up circle data
|
||||
lsr
|
||||
tay
|
||||
lda circleTable,y
|
||||
lda circleTable,y ; Look up circle data
|
||||
sta SCRATCHL
|
||||
ply
|
||||
|
||||
tya ; Iterate over diameter
|
||||
asl
|
||||
tay
|
||||
|
||||
craterTerrainLoop:
|
||||
dey
|
||||
@ -229,6 +227,11 @@ compileTerrainDone:
|
||||
; PARAML0 = Start of compiled row data
|
||||
; PARAML1 = Row index
|
||||
;
|
||||
; Note: DA = PHX = BGBG
|
||||
; 48 = PHA = FGFG
|
||||
; 5A = PHY =
|
||||
; 0B = PHD =
|
||||
|
||||
compileTerrainRow:
|
||||
SAVE_AXY
|
||||
ldy #0
|
||||
@ -243,10 +246,13 @@ compileTerrainColumnLoop:
|
||||
bcc compileTerrainColumnBGRight
|
||||
beq compileTerrainColumnBGRight
|
||||
lda #$00da
|
||||
|
||||
compileTerrainColumnLeft:
|
||||
sta compileTerrainOpcode
|
||||
inx
|
||||
inx
|
||||
inx ; Double-up for now
|
||||
inx
|
||||
lda terrainData,x
|
||||
cmp PARAML1
|
||||
bcc compileTerrainColumnBGLeft
|
||||
@ -258,6 +264,8 @@ compileTerrainColumnStore:
|
||||
sta (PARAML0),y
|
||||
inx
|
||||
inx
|
||||
inx ; Double-up for now
|
||||
inx
|
||||
iny
|
||||
iny
|
||||
cpy #VISIBLETERRAINWIDTH
|
||||
@ -305,6 +313,9 @@ generateTerrainLoop:
|
||||
sta (SCRATCHL),y
|
||||
iny
|
||||
iny
|
||||
sta (SCRATCHL),y ; Double-up for now
|
||||
iny
|
||||
iny
|
||||
|
||||
inx
|
||||
inx
|
||||
@ -317,7 +328,7 @@ generateTerrainLoop:
|
||||
and #$03ff
|
||||
tax
|
||||
|
||||
cpy #TERRAINWIDTH/2
|
||||
cpy #TERRAINWIDTH
|
||||
bne generateTerrainLoop
|
||||
|
||||
lda #1
|
||||
@ -326,10 +337,10 @@ generateTerrainLoop:
|
||||
|
||||
|
||||
|
||||
; Terrain data, stored as height values 4 pixels wide (words)
|
||||
; Terrain data, stored as height values 2 pixels wide (bytes)
|
||||
|
||||
terrainData:
|
||||
.repeat TERRAINWIDTH/4 ; VISIBLETERRAINWIDTH
|
||||
.repeat TERRAINWIDTH/2
|
||||
.word 0
|
||||
.endrepeat
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user