Erm... not quite sure what you're talking about. To clarify, this is all done in the original Blitz Basic (I'm writing a simple, pseudo-3D engine in BB). I've actually sort of got what I want laid out in code now... but it doesn't work :(
Type hit Field num ;Which side is being hit Field ht# ;Time at which hit occurs Field x# ;X-location of hit Field y# ;Y-location of hit End Type ;These two bits weren't actually together, but are needed to understand what's going on tx# = Floor(rxp#) ;x pos. of the block ty# = Floor(ryp#) ;y pos. of the block rxp# = rxp# - rxm# * 2 ;last x position of the ray ryp# = ryp# - rym# * 2 ;last y position of the ray allhit.hit = New hit allhit\num = 0 allhit\ht# = (tx# - rxp#) / rxm# ;Time at which the ray passes through the same x as the left-vertical side allhit\x# = tx# allhit\y# = rym# * allhit\ht# + ryp# allhit.hit = New hit allhit\num = 1 allhit\ht# = (tx# + 1 - rxp#) / rxm# ;" " right vertical side allhit\x# = tx# + 1 allhit\y# = rym# * allhit\ht# + ryp# allhit.hit = New hit allhit\num = 2 allhit\ht# = (ty# - ryp#) / rym# ;Time at which the ray passes through the same y as the top horizontal side allhit\x# = rxm# * allhit\ht# + rxp# allhit\y# = ty# allhit.hit = New hit allhit\num = 3 allhit\ht# = (ty# + 1 - ryp#) / rym# ;" " bottom horizontal side allhit\x# = rxm# * allhit\ht# + rxp# allhit\y# = ty# + 1 For allhit.hit = Each hit ; Weeds out "hits" that are out of bounds (and so do not actually hit) Select allhit\num Case 0: If allhit\y# < ty# Or allhit\y# > ty# + 1 Then Delete allhit Case 1: If allhit\y# < ty# Or allhit\y# > ty# + 1 Then Delete allhit Case 2: If allhit\x# < tx# Or allhit\x# > tx# + 1 Then Delete allhit Case 3: If allhit\x# < tx# Or allhit\x# > tx# + 1 Then Delete allhit End Select Next besthit.hit = First hit For allhit.hit = Each hit ;Figures out which of the viable hits strikes first If allhit\ht# < besthit\ht# Then besthit.hit = allhit.hit Next ;Sets the ray's location to the exact point at which it first hit the block rxp# = besthit\x# ryp# = besthit\y# Select besthit\num ;Extra data (tells which part of a texture to draw for this line) Case 0: tex# = ryp# - ty# Case 1: tex# = ryp# - ty# Case 2: tex# = rxp# - tx# Case 3: tex# = rxp# - tx# End Select