Several bug fixes for the ray caster.

This commit is contained in:
Martin Haye 2013-09-08 08:10:32 -07:00
parent af12b3862e
commit 99333da6aa
5 changed files with 4045 additions and 4036 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
# This program generates optimized texture expansion code.
import copy, os, re, sys
import copy, math, os, re, sys
# Main control on size vs. speed
rowInterval = 5
@ -147,7 +147,14 @@ def makeCmds(dstHeight):
texOff = 0
if y0 < 0 or y1 > screenHeight:
texOff += int((-y0/2) * srcHeight / dstHeight)
texOff = -y0 / 2.0 * srcHeight / dstHeight
r = int(((texOff*2) % 1) * dstHeight) # the "*2" here is because each byte stores 2 pixels
if (texOff % 1) >= 0.5:
cmds.append("L")
cmds.append("<")
b = 2
#print("y0=%d texOff=%.3f r=%d b=%d" % (y0, texOff, r, b))
texOff = int(texOff)
y0 = max(0, y0)
y1 = min(screenHeight, y1)
@ -207,13 +214,11 @@ for dstHeight in range(128,192,4):
for dstHeight in range(192,256,8):
makeCmds(dstHeight)
# Create the jump tables for sizes 0..127, 128..255
# Create the jump table
dstHeight = 0
for h in range(0, 256, 2):
if h == 0:
outFile.write("expand_vec1:\n")
elif h == 128:
outFile.write("\nexpand_vec2:\n")
outFile.write("expand_vec:\n")
if h in dstHeights:
dstHeight = h
outFile.write(" .addr expand_%d\n" % dstHeight)

View File

@ -215,8 +215,8 @@ function prepCast(angleNum, x)
//
var scaleFactor = 1.116;
rayDirX = (rayDirX / scaleFactor) * 128;
rayDirY = (rayDirY / scaleFactor) * 128;
rayDirX = (rayDirX / scaleFactor) * 127;
rayDirY = (rayDirY / scaleFactor) * 127;
rayDirX = ubyte(Math.round(rayDirX) & 0xFF);
rayDirY = ubyte(Math.round(rayDirY) & 0xFF);

View File

@ -6,7 +6,7 @@ NLINES = 128
SKY_COLOR_E = $11 ; blue
SKY_COLOR_O = $11 ; blue
GROUND_COLOR_E = $14 ; orange
GROUND_COLOR_O = $00 ; black
GROUND_COLOR_O = $10 ; hi-bit black
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1
; Byte offset for each pixel in the blit unroll
@ -59,7 +59,7 @@ resetVec = $3F2
;---------------------------------
; The following are all in aux mem...
expandVec = $800 ; size of expansion code: $30E9
textures = $3900
textures = $4000
; back to main mem
;---------------------------------

File diff suppressed because it is too large Load Diff