From 25432cb16ae24eb055a192d56cd937d7f8285fe3 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Fri, 30 Aug 2013 13:22:56 -0700 Subject: [PATCH] Added keys to rotate and move so you can wanter around BugTown. Crazy. --- .../Apple/virtual/data/tables/precast.bin | Bin 17538 -> 0 bytes Platform/Apple/virtual/src/raycast/expand.s | 833 +----------------- .../Apple/virtual/src/raycast/genExpand.py | 7 +- .../virtual/src/raycast/javascript/intcast.js | 5 + Platform/Apple/virtual/src/raycast/render.s | 108 ++- 5 files changed, 158 insertions(+), 795 deletions(-) delete mode 100644 Platform/Apple/virtual/data/tables/precast.bin diff --git a/Platform/Apple/virtual/data/tables/precast.bin b/Platform/Apple/virtual/data/tables/precast.bin deleted file mode 100644 index 616c6d7cc227938ea83552658781a9d69686ef0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17538 zcmd6vXLu7w+qNl2Ws6q3tC2ObJeFj6)!SMY#uy(I(|hkB^kRysrhoJrdT*fy2rZP* z6ApR}y|)ko0YVEkbU)v1!TSU!5J;Z#zCZFO^0A}Y8C^5?bzV2RiMr3kK|)U}Tvab`m?C{hXc8E@GFlE7`T|CUy%O z#j04AtMZXkPWjb>{fOsyN^Aj|HiPyINdag3@{h8`fQRE=fEz}qw%Q& z1?0S;-r*j}-BLQIW~Q}+@oVTRi0Q&};U0fYdtQ5(+s+N-hH@jhG28@hDmRmx!!6(z zbIZ7u+*)oU_br!?Q*acg;Y2Q)i{aw9c+Sqbxd0d9lDSlF8@G$w#~tF188?}hley+8 z*3q`1Qa?wsE79ZiIRiG?9EuI&WPOU5s!h|t_z!ir#4Ex%;V8d{@6QkBhw-2BWBCdE z6n+Ljo1e!oo?dUKsy`?mKa(*k2qh z4iiU;qs8&!Byp-ZQ=Bc%6BmkKip#{6;u>+CxJmq0%qvETDv=g7q97vCAezKD(JD%! zQ}l=dF;NVQDPj?E8$55XctAWP9urTBXT%HQCC3KW8qadymw^THoY1WBwB*St6H>>f z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%d texOff=%d" % (dstHeight, y0, y1, texOff)) for y in range(y0, y1): if b == 0: diff --git a/Platform/Apple/virtual/src/raycast/javascript/intcast.js b/Platform/Apple/virtual/src/raycast/javascript/intcast.js index 4ccc856d..f9487d56 100644 --- a/Platform/Apple/virtual/src/raycast/javascript/intcast.js +++ b/Platform/Apple/virtual/src/raycast/javascript/intcast.js @@ -160,6 +160,11 @@ function prepCast(angleNum, x) var dirX = Math.cos(angle); var dirY = Math.sin(angle); + if (x == 0) + console.log("angleNum=" + angleNum + + ", dirX=" + wordToHex(uword((dirX*64) & 0xFFFF)) + + ", dirY=" + wordToHex(uword((dirY*64) & 0xFFFF))); + // Compute the camera plane, which is perpendicular to the direction vector var planeX = -Math.sin(angle) * 0.5; var planeY = Math.cos(angle) * 0.5; diff --git a/Platform/Apple/virtual/src/raycast/render.s b/Platform/Apple/virtual/src/raycast/render.s index e32b57af..5a1aef72 100644 --- a/Platform/Apple/virtual/src/raycast/render.s +++ b/Platform/Apple/virtual/src/raycast/render.s @@ -140,6 +140,26 @@ MIP_OFFSET_3 = $540 ; 32*32 + 16*16 + 8*8 MIP_OFFSET_4 = $550 ; 32*32 + 16*16 + 8*8 + 4*4 MIP_OFFSET_5 = $554 ; 32*32 + 16*16 + 8*8 + 4*4 + 2*2 +; Movement amounts when walking at each angle +; Each entry consists of an X bump and a Y bump, in 8.8 fixed point +walkDirs: + .word $0040, $0000 + .word $003B, $0018 + .word $002D, $002D + .word $0018, $003B + .word $0000, $0040 + .word $FFE8, $003B + .word $FFD3, $002D + .word $FFC5, $0018 + .word $FFC0, $0000 + .word $FFC5, $FFE8 + .word $FFD3, $FFD3 + .word $FFE8, $FFC5 + .word $0000, $FFC0 + .word $0018, $FFC5 + .word $002D, $FFD3 + .word $003B, $FFE8 + ; Debug macros .macro DEBUG_STR str .if DEBUG @@ -811,6 +831,7 @@ selectMip5: drawRay: ; Make a pointer to the selected texture ldx txNum + dex ; translate tex 1..4 to 0..3 lda texAddrLo,x sta pTex lda texAddrHi,x @@ -1186,8 +1207,8 @@ test: sta resetVec+2 ; Establish the initial player position and direction - ; X=5.5 - lda #5 + ; X=2.5 + lda #2 sta playerX+1 lda #$80 sta playerX @@ -1375,16 +1396,87 @@ test: lda kbd bpl @pauseLup sta kbdStrobe ; eat the keypress - cmp #$9B - beq @done ; advance + and #$7F + cmp #'w' + beq @forward + cmp #'W' + beq @forward + cmp #'s' + beq @backward + cmp #'S' + beq @backward + cmp #'x' + beq @backward + cmp #'X' + beq @backward + cmp #'a' + beq @left + cmp #'A' + beq @left + cmp #'d' + beq @right + cmp #'D' + beq @right + cmp #$1B + beq @done + jmp @pauseLup +@forward: + lda playerDir + asl + asl + tax lda playerX clc - adc #$40 + adc walkDirs,x sta playerX - bcc :+ - inc playerX+1 -: jmp @oneLevel + lda playerX+1 + adc walkDirs+1,x + sta playerX+1 + lda playerY + clc + adc walkDirs+2,x + sta playerY + lda playerY+1 + adc walkDirs+3,x + sta playerY+1 + jmp @oneLevel +@backward: + lda playerDir + asl + asl + tax + lda playerX + sec + sbc walkDirs,x + sta playerX + lda playerX+1 + sbc walkDirs+1,x + sta playerX+1 + lda playerY + sec + sbc walkDirs+2,x + sta playerY + lda playerY+1 + sbc walkDirs+3,x + sta playerY+1 + jmp @oneLevel +@left: + dec playerDir + lda playerDir + cmp #$FF + bne :+ + lda #15 +: sta playerDir + jmp @oneLevel +@right: + inc playerDir + lda playerDir + cmp #16 + bne :+ + lda #0 +: sta playerDir + jmp @oneLevel @done: bit setText bit page1