Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;   Fisheye Raycasting Engine Etc. FREE3D for MENUETOS by Dieter Marfurt
  3. ;   Version 0.4 (requires some texture-files to compile (see Data Section))
  4. ;   dietermarfurt@angelfire.com - www.melog.ch/mos_pub/
  5. ;   Don't hit me - I'm an ASM-Newbie... since years :)
  6. ;
  7. ;   Compile with FASM for Menuet (requires .INC files - see DATA Section)
  8. ;
  9.    
  10. use32
  11.    
  12.                org    0x0
  13.    
  14.                db     'MENUET01'              ; 8 byte id
  15.                dd     0x01                    ; header version
  16.                dd     START                   ; start of code
  17.                dd     I_END                   ; size of image
  18.                dd     0x300000                ; memory for app
  19.                dd     0x7fff0                 ; esp
  20.                dd     0x0 , 0x0               ; I_Param , I_Icon
  21.    
  22. include 'lang.inc'  
  23. START:                          ; start of execution
  24.    
  25.     call draw_window            ; at first, draw the window
  26.     call draw_stuff
  27.    
  28. gamestart:
  29. ;   ******* MOUSE CHECK *******
  30. ;    mov eax,37    ; check mouse (use mouse over window to navigate)
  31. ;    mov ebx,2     ; check mousebuttons
  32. ;    int 0x40
  33. ;    cmp eax,0    ; only use mouse when button down
  34. ;    je noneed    ; deactivated cause of disappear-bug etc.
  35.     mov eax,37
  36.     mov ebx,1     ; check mouseposition
  37.     int 0x40
  38.    
  39.     mov ebx,eax
  40.     shr eax,16
  41.     and eax,0x0000FFFF  ; mousex
  42.     and ebx,0x0000FFFF  ; mousey
  43.    
  44.     cmp eax,5  ; mouse out of window ?
  45.     jb check_refresh  ; it will prevent an app-crash
  46.     cmp ebx,22
  47.     jb check_refresh
  48.     cmp eax, 640
  49.     jg check_refresh
  50.     cmp ebx,501
  51.     jg check_refresh
  52.    
  53.     cmp eax,315 ; navigating?
  54.     jb m_left
  55.     cmp eax,325 ;
  56.     jg m_right
  57. continue:
  58.     cmp ebx,220 ;
  59.     jb s_up
  60.     cmp ebx,260 ;
  61.     jg s_down
  62. ;   ******* END OF MOUSE CHECK *******
  63. check_refresh:
  64.    
  65. ;    mov eax,23  ; wait for system event with 10 ms timeout
  66. ;    mov ebx,1   ; thats max 100 FPS
  67.     mov eax,11 ; ask no wait for full speed
  68.     int  0x40
  69.    
  70.     cmp  eax,1                  ; window redraw request ?
  71.     je   red2
  72.     cmp  eax,2                  ; key in buffer ?
  73.     je   key2
  74.     cmp  eax,3                  ; button in buffer ?
  75.     je   button2
  76.    
  77.     mov edi,[mouseya] ; check flag if a refresh has to be done
  78.     cmp edi,1
  79.     jne gamestart
  80.     mov [mouseya],dword 0
  81.     call draw_stuff
  82.    
  83.    
  84.     jmp gamestart
  85.    
  86. ; END OF MAINLOOP
  87.    
  88. red2:                          ; redraw
  89.     call draw_window
  90.     call draw_stuff
  91.     jmp  gamestart
  92.    
  93. key2:                          ; key
  94.     mov  eax,2
  95.     int  0x40
  96.     cmp  al,1
  97.     je   gamestart     ; keybuffer empty
  98.    
  99.     cmp ah,27    ; esc=End App
  100.     je finish
  101.    
  102.     cmp  ah,178  ; up
  103.     je   s_up
  104.     cmp  ah,177  ; down
  105.     je   s_down
  106.     cmp  ah,176  ; left
  107.     je   s_left
  108.     cmp  ah,179  ; right
  109.     je   s_right
  110.    
  111.     jmp gamestart ; was any other key
  112.    
  113.    
  114. s_up:             ; walk forward (key or mouse)
  115.     mov eax,[vpx]
  116.     mov ebx,[vpy]
  117.    
  118.    
  119.     mov ecx,[vheading]
  120.     imul ecx,4
  121.     add ecx,sinus
  122.     mov edi,[ecx]
  123.    
  124.     mov edx,[vheading]
  125.     imul edx,4
  126.     add edx,sinus
  127.     add edx,3600
  128.     cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600
  129.     jb ok200
  130.     sub edx,14400
  131.     ok200:
  132.     mov esi,[edx]
  133. ;    sal esi,1  ; edit walking speed here
  134. ;    sal edi,1
  135.    
  136.     add eax,edi ; newPx
  137.     add ebx,esi ; newPy
  138.     mov edi,eax ; newPx / ffff
  139.     mov esi,ebx ; newPy / ffff
  140.     sar edi,16
  141.     sar esi,16
  142.     mov ecx,esi
  143.     sal ecx,5 ; equal *32
  144.     add ecx,edi
  145.     add ecx,grid
  146.     cmp [ecx],byte 0  ; collision check
  147.     jne cannotwalk0
  148.     mov [vpx],eax
  149.     mov [vpy],ebx
  150.     mov [mouseya],dword 1 ; set refresh flag
  151. cannotwalk0:
  152.     jmp check_refresh
  153.    
  154. s_down:                    ; walk backward
  155.     mov eax,[vpx]
  156.     mov ebx,[vpy]
  157.    
  158.     mov ecx,[vheading]
  159.     imul ecx,4
  160.     add ecx,sinus
  161.     mov edi,[ecx]
  162.    
  163.     mov edx,[vheading]
  164.     imul edx,4
  165.     add edx,sinus
  166.     add edx,3600
  167.     cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600
  168.     jb ok201
  169.     sub edx,14400
  170.     ok201:
  171.    
  172.     mov esi,[edx]
  173. ;    sal esi,1  ; edit walking speed here
  174. ;    sal edi,1
  175.    
  176.     sub eax,edi ; newPx
  177.     sub ebx,esi ; newPy
  178.     mov edi,eax ; newPx / ffff
  179.     mov esi,ebx ; newPy / ffff
  180.     sar edi,16
  181.     sar esi,16
  182.     mov ecx,esi
  183.     sal ecx,5
  184.     add ecx,edi
  185.     add ecx,grid
  186.     cmp [ecx],byte 0
  187.     jne cannotwalk1
  188.     mov [vpx],eax
  189.     mov [vpy],ebx
  190.     mov [mouseya],dword 1
  191. cannotwalk1:
  192.     jmp check_refresh
  193.    
  194. s_left:                                   ; turn left (key)
  195.     mov edi,[vheading]  ; heading
  196.     add edi,50
  197.     cmp edi,3600
  198.     jb ok_heading0
  199.     sub edi,3600
  200.     ok_heading0:
  201.     mov [vheading],edi
  202.     mov [mouseya],dword 1
  203.     jmp check_refresh
  204.    
  205. s_right:                                  ; turn right
  206.     mov edi,[vheading]
  207.     sub edi,50
  208.     cmp edi,-1
  209.     jg ok_heading1
  210.     add edi,3600
  211.     ok_heading1:
  212.     mov [vheading],edi
  213.     mov [mouseya],dword 1
  214.     jmp check_refresh
  215.    
  216. m_left:                                   ; turn left (mouse)
  217.     mov edi,[vheading]  ; heading
  218.     mov ecx,315
  219.     sub ecx,eax
  220.     sar ecx,2
  221.     add edi,ecx
  222.     cmp edi,3600
  223.     jb ok_heading2
  224.     sub edi,3600
  225.     ok_heading2:
  226.     mov [vheading],edi
  227.     mov [mouseya],dword 1
  228.     jmp continue    ; allow both: walk and rotate
  229.    
  230. m_right:                                  ; turn right
  231.     mov edi,[vheading]
  232.     sub eax,325
  233.     sar eax,2
  234.     sub edi,eax
  235.     cmp edi,-1
  236.     jg ok_heading3
  237.     add edi,3600
  238.     ok_heading3:
  239.     mov [vheading],edi
  240.     mov [mouseya],dword 1
  241.     jmp continue
  242.    
  243.    
  244.    
  245.   button2:                       ; button
  246.     mov  eax,17                  ; get id
  247.     int  0x40
  248.     cmp  ah,1                   ; button id=1 ?
  249.     jne  gamestart
  250.    
  251. ; eo GAME mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
  252.  finish:
  253.     mov  eax,-1                 ; close this program
  254.     int  0x40
  255.    
  256.    
  257. ;   *********************************************
  258. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  259. ;   *********************************************
  260.    
  261.    
  262. draw_window:
  263.    
  264.     mov  eax,12                    ; function 12:tell os about windowdraw
  265.     mov  ebx,1                     ; 1, start of draw
  266.     int  0x40
  267.    
  268.                                    ; DRAW WINDOW
  269.     mov  eax,0                     ; function 0 : define and draw window
  270.     mov  ebx,50*65536+649         ; [x start] *65536 + [x size]
  271.     mov  ecx,50*65536+504         ; [y start] *65536 + [y size]
  272.     mov  edx,0x02ffffff            ; color of work area RRGGBB,8->color gl
  273.     mov  esi,0x80777777            ; color of grab bar  RRGGBB,8->color gl
  274.     mov  edi,0x00777777            ; color of frames    RRGGBB
  275.     int  0x40
  276.    
  277.                                    ; WINDOW LABEL
  278.     mov  eax,4                     ; function 4 : write text to window
  279.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  280.     mov  ecx,0x00ddeeff            ; color of text RRGGBB
  281.     mov  edx,labelt                ; pointer to text beginning
  282.     mov  esi,labellen-labelt       ; text length
  283.     int  0x40
  284.    
  285.                                    ; CLOSE BUTTON
  286.     mov  eax,8                     ; function 8 : define and draw button
  287.     mov  ebx,(649-19)*65536+12     ; [x start] *65536 + [x size]
  288.     mov  ecx,5*65536+12            ; [y start] *65536 + [y size]
  289.     mov  edx,1                     ; button id
  290.     mov  esi,0x777777              ; button color RRGGBB
  291.     int  0x40
  292.    
  293.    
  294.     mov  eax,12                    ; function 12:tell os about windowdraw
  295.     mov  ebx,2                     ; 2, end of draw
  296.     int  0x40
  297.    
  298.     ret
  299.    
  300. ;   *********************************************
  301. ;   *******       COMPUTE 3D-VIEW        ********
  302. ;   *********************************************
  303. draw_stuff:
  304.    
  305.    
  306. mov [step1],dword 1
  307. ;mov [step64],dword 64
  308.     mov esi,[vheading]
  309.     add esi,320
  310.     mov [va],esi
  311.     mov eax,[vheading]
  312.     sub eax,320
  313.     mov [vacompare],eax
  314. ;------------------------------------ CAST 640 PIXEL COLUMNS ---------------
  315. ; FOR A=320+heading to -319+heading step -1 (a is stored in [va])
  316. ;---------------------------------------------------------------------------
  317. ;    mov edx,5
  318.     mov [vx1],dword 0  ;5  ;edx        ; init x1 ... pixelcolumn
  319. for_a:
  320. mov edx,[vx1]
  321. mov [vx1b],edx
  322. sub [vx1b],dword 320
  323.     mov edx,[va]  ; a2
  324.     cmp edx,-1   ; a2 is a mod 3600
  325.     jg ok1
  326.     add edx,3600
  327. ok1:
  328.     cmp edx,3600
  329.     jb ok2
  330.     sub edx,3600
  331. ok2:
  332.    
  333. ; get stepx and stepy
  334.     mov ecx,edx
  335.     imul ecx,4
  336.     add ecx,sinus     ; pointer to stepx
  337.     mov esi,[ecx]
  338.     sar esi,4         ; accuracy
  339.     mov [vstepx],esi  ; store stepx
  340.    
  341.     mov esi,edx
  342.     imul esi,4
  343.     add esi,sinus  ; pointer to stepy
  344.     add esi,3600
  345.     cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600)
  346.     jb ok202
  347.     sub esi,14400
  348.     ok202:
  349.    
  350.     mov ecx,[esi]
  351.     sar ecx,4
  352.     mov [vstepy],ecx ; store stepy
  353.    
  354.    
  355.     mov eax,[vpx]    ; get Camera Position
  356.     mov ebx,[vpy]
  357.     mov [vxx],eax    ; init caster position
  358.     mov [vyy],ebx
  359.    
  360.     mov edi,0        ; init L (number of raycsting-steps)
  361.     mov [step1],dword 1  ; init Caster stepwidth for L
  362.    
  363.  ;  raycast a pixel column.................................
  364. raycast:
  365.     add edi,[step1]  ; count caster steps
  366. ;jmp nodouble ; use this to prevent blinking/wobbling textures: much slower!
  367.    
  368.     cmp edi,32
  369.     je double
  370.     cmp edi,512
  371.     je double
  372.     cmp edi,1024
  373.     je double
  374.     jmp nodouble
  375.    
  376.     double:
  377.     mov edx,[step1]
  378.     sal edx,1
  379.     mov [step1],edx
  380.    
  381.     mov edx,[vstepx]
  382.     sal edx,1
  383.     mov [vstepx],edx
  384.    
  385.     mov edx,[vstepy]
  386.     sal edx,1
  387.     mov [vstepy],edx
  388.    
  389. nodouble:
  390.    
  391.     mov eax,32000 ; 3600 ; determine Floors Height based on distance
  392.     mov edx,0
  393.     mov ebx,edi
  394.    
  395.     div ebx
  396.     mov esi,eax
  397.     mov [vdd],esi
  398.     mov edx,260
  399.     sub edx,esi
  400.     mov [vh],edx
  401.    
  402.     cmp edx,22
  403.     jb no_nu_pixel
  404.     cmp edx,259
  405.     jg no_nu_pixel ; draw only new pixels
  406.     cmp edx,[h_old]
  407.     je no_nu_pixel
  408.    
  409.     mov eax,[vxx] ; calc floor pixel
  410.     mov ebx,[vyy]
  411.    
  412.     and eax,0x0000FFFF
  413.     and ebx,0x0000FFFF
  414.    
  415.     shr eax,10
  416.     shr ebx,10    ; pixel coords inside Texture x,y 64*64
  417.     mov [xfrac],eax
  418.     mov [yfrac],ebx
  419.    
  420.    
  421.    
  422.     ; plot floor pixel !!!!
  423.     mov [vl],edi      ; save L
  424.     mov [ytemp],esi ; remember L bzw. H
  425.    
  426.     mov edi,[yfrac] ; get pixel color of this floor pixel
  427.     sal edi,8
  428.     mov esi,[xfrac]
  429.     sal esi,2
  430.     add edi,esi
  431.     add edi,wall ; in fact its floor, just using the wall texture :)
  432.     mov edx,[edi]
  433.     mov [remesi],esi
  434.    
  435.     ;**** calculate pixel adress:****
  436.     mov esi,[ytemp]
  437.     add esi,240
  438.     imul esi,1920
  439.     add esi,[vx1]
  440.     add esi,[vx1]
  441.     add esi,[vx1]
  442.     add esi,0x80000
  443.    
  444.     cmp esi,0x80000+1920*480
  445.     jg foff0
  446.     cmp esi,0x80000
  447.     jb foff0
  448.     ; now we have the adress of the floor-pixel color in edi
  449.     ; and the adress of the pixel in the image in esi
  450.    
  451.     mov edx,[edi]
  452.     ;******************** custom distance DARKEN Floor
  453.    
  454.     mov eax,[vdd]
  455.    
  456. ; jmp nodark0 ; use this to deactivate darkening floor (a bit faster)
  457.    
  458.     cmp eax,80
  459.     jg nodark0
  460.     ;                split rgb
  461.    
  462.     mov [blue],edx
  463.     and [blue],dword 255
  464.    
  465.     shr edx,8
  466.     mov [green],edx
  467.     and [green],dword 255
  468.    
  469.     shr edx,8
  470.     mov [red],edx
  471.     and [red],dword 255
  472.    
  473.     mov eax,81    ; darkness parameter
  474.     sub eax,[vdd]
  475.     sal eax,1
  476.    
  477. ;                        reduce rgb
  478.     sub [red],eax
  479.     cmp [red], dword 0
  480.     jg notblack10
  481.     mov [red],dword 0
  482.     notblack10:
  483.    
  484.     sub [green],eax
  485.     cmp [green],dword 0
  486.     jg notblack20
  487.     mov [green],dword 0
  488.     notblack20:
  489.    
  490.     mov edx,[blue]
  491.     sub [blue],eax
  492.     cmp [blue],dword 0
  493.     jg notblack30
  494.     mov [blue],dword 0
  495.     notblack30:
  496.    
  497.     shl dword [red],16  ; reassemble rgb
  498.     shl dword [green],8
  499.     mov edx,[red]
  500.     or edx,[green]
  501.     or edx,[blue]
  502.    
  503. nodark0:
  504. ;   eo custom darken floor
  505.    
  506.    
  507.     mov eax,edx
  508.     mov [esi],eax ; actually draw the floor pixel
  509.    
  510.  ; paint "forgotten" pixels
  511.    
  512.     mov edx,[lasty]
  513.     sub edx,1920
  514.     cmp esi,edx
  515.     je foff0
  516.     mov [esi+1920],eax
  517.    
  518.     sub edx,1920
  519.     cmp esi,edx
  520.     je foff0
  521.     mov [edx+1920],eax
  522.    
  523.     sub edx,1920
  524.     cmp esi,edx
  525.     je foff0
  526.     mov [edx+1920],eax
  527.    
  528. foff0:
  529. mov [lasty],esi
  530. ;**** end of draw floor pixel ****
  531.    
  532.     mov esi,[remesi]
  533.     mov edi,[vl] ; restore L
  534.    
  535. no_nu_pixel:
  536.    
  537.    
  538.     mov esi,[vh]
  539.     mov [h_old],esi
  540.    
  541.     mov eax,[vxx]
  542.     mov ebx,[vyy]
  543.    
  544.     add eax,[vstepx]  ; casting...
  545.     add ebx,[vstepy]
  546.    
  547.     mov [vxx],eax
  548.     mov [vyy],ebx
  549.    
  550.     sar eax,16
  551.     sar ebx,16
  552.    
  553.     mov [vpxi],eax    ; casters position in Map Grid
  554.     mov [vpyi],ebx
  555.    
  556.     mov edx,ebx
  557. ;    imul edx,32
  558.     shl edx,5
  559.     add edx,grid
  560.     add edx,eax
  561.     cmp [edx],byte 0   ; raycaster reached a wall? (0=no)
  562.     jne getout
  563.     cmp edi,10000        ; limit view range
  564.     jb raycast
  565. ;................................................
  566. getout:
  567.     mov eax,[edx]      ; store Grid Wall Value for Texture Selection
  568.     mov [vk],eax
  569.    
  570.  call blur  ; deactivate this (blurs the near floor) : a bit faster
  571.    
  572. ; simply copy floor to ceil pixel column here
  573. ;jmp nocopy ; use this for test purposes
  574.    
  575.     pusha
  576.     mov eax,0x80000+1920*240
  577.     mov ebx,0x80000+1920*240
  578.    
  579. copyfloor:
  580.     sub eax,1920
  581.     add ebx,1920
  582.    
  583.     mov ecx,0
  584.     add ecx,[vx1]
  585.     add ecx,[vx1]
  586.     add ecx,[vx1]
  587.    
  588.     mov edx,ecx
  589.     add ecx,eax
  590.     add edx,ebx
  591.    
  592.     mov esi,[edx]
  593.     mov [ecx],esi
  594.    
  595.     cmp eax,0x80000
  596.     jg copyfloor
  597.    
  598.     popa
  599. ; *** end of copy floor to ceil
  600. ;nocopy:
  601. ;__________________________________________________________________________
  602.    
  603.    
  604. ; draw this pixelrows wall
  605.     mov [vl],edi
  606.    
  607.     mov edi,260
  608.     sub edi,[vdd]
  609.     cmp edi,0
  610.     jg ok3
  611.     xor edi,edi
  612.     ok3:
  613.     mov [vbottom],edi  ; end wall ceil (or window top)
  614.    
  615.     mov esi,262
  616.     add esi,[vdd]  ; start wall floor
  617.    
  618.     xor edi,edi
  619.    
  620. ; somethin is wrong with xfrac,so recalc...
  621.    
  622.     mov eax,[vxx]
  623.     and eax,0x0000FFFF
  624.     shr eax,10
  625.     mov [xfrac],eax
  626.    
  627.     mov eax,[vyy]
  628.     and eax,0x0000FFFF
  629.     shr eax,10
  630.     mov [yfrac],eax
  631.    
  632.     pixelrow:
  633.    
  634. ; find each pixels color:
  635.    
  636.     add edi,64
  637.     sub esi,1
  638.     cmp esi, 502  ; dont calc offscreen-pixels
  639.     jg speedup
  640.    
  641.     xor edx,edx
  642.     mov eax, edi
  643.     mov ebx,[vdd]
  644.     add ebx,[vdd]
  645.     div ebx
  646.     and eax,63
  647.     mov [ytemp],eax   ; get y of texture for wall
  648.    
  649.     mov eax,[xfrac]
  650.     add eax,[yfrac]
  651.    
  652.     and eax,63
  653.     mov [xtemp],eax   ; get x of texture for wall
  654.    
  655.     ; now prepare to plot that wall-pixel...
  656.     mov [remedi],edi
  657.    
  658.     mov edi,[ytemp]
  659.     sal edi,8
  660.     mov edx,[xtemp]
  661.     sal edx,2
  662.     add edi,edx
  663.    
  664.     mov eax,[vk] ; determine which texture should be used
  665.     and eax,255
  666.    
  667.     cmp eax,1
  668.     jne checkmore1
  669.     add edi,ceil
  670.     jmp foundtex
  671.     checkmore1:
  672.    
  673.     cmp eax,2
  674.     jne checkmore2
  675.     add edi,wall
  676.     jmp foundtex
  677.     checkmore2:
  678.    
  679.     cmp eax,3
  680.     jne checkmore3
  681.     add edi,wall2
  682.     jmp foundtex
  683.     checkmore3:
  684.    
  685.     cmp eax,4
  686.     jne checkmore4
  687.     add edi,wall3
  688.     jmp foundtex
  689.     checkmore4:
  690.    
  691.     cmp eax,5
  692.     jne checkmore5
  693.     add edi,wall4
  694.     jmp foundtex
  695.     checkmore5:
  696.    
  697.     cmp eax,6
  698.     jne checkmore6
  699.     add edi,wall5
  700.     jmp foundtex
  701.     checkmore6:
  702.    
  703.     cmp eax,7
  704.     jne checkmore7
  705.     add edi,wall6
  706.     jmp foundtex
  707.     checkmore7:
  708.    
  709.     cmp eax,8
  710.     jne checkmore8
  711.     add edi,wall7
  712.     jmp foundtex
  713.     checkmore8:
  714.    
  715.     foundtex:
  716.    
  717.     mov edx,[edi]    ; get pixel color inside texture
  718.    
  719. ; ***pseudoshade south-west
  720. jmp east ; activate this for southwest pseudoshade : a bit slower + blink-bug
  721.     mov edi,[yfrac]
  722.     mov [pseudo],dword 0 ; store flag for custom distance darkening
  723.     cmp edi,[xfrac]
  724.     jge east
  725.     and edx,0x00FEFEFE
  726.     shr edx,1
  727.     mov [pseudo],dword 1
  728. east:
  729.    
  730.  call dark_distance ; deactivate wall distance darkening: a bit faster
  731.    
  732. ; ******* DRAW WALL PIXEL *******
  733.     mov eax,esi
  734.     sub eax,22
  735.     imul eax,1920
  736.     add eax,[vx1]
  737.     add eax,[vx1]
  738.     add eax,[vx1]
  739.     add eax,0x80000
  740.    
  741.     cmp eax,0x80000+1920*480
  742.     jg dont_draw
  743.     cmp eax,0x80000
  744.     jb dont_draw
  745.     mov [eax],edx ; actually set the pixel in the image
  746. ; *** eo draw wall pixel
  747. dont_draw:
  748.     mov edi,[remedi]
  749. speedup:
  750.     cmp esi,[vbottom]  ; end of this column?
  751.     jg pixelrow
  752.    
  753.     mov edi,[vl]  ; restoring
  754.     mov eax,[vx1] ; inc X1
  755.     add eax,1
  756.     mov [vx1],eax
  757.    
  758.     ;*** NEXT A ***
  759.     mov esi,[va]
  760.     sub esi,1
  761.     mov [va],esi
  762.     cmp esi,[vacompare]
  763.     jg for_a
  764.     ;*** EO NEXT A ***
  765. ;---------------------------------------------------------------------------
  766.    
  767.    
  768. ; **** put image !!!!!****
  769. ; ***********************
  770.     mov eax,7
  771.     mov ebx,0x80000
  772.     mov ecx,640*65536+480
  773.     mov edx,5*65536+20
  774.     int 0x40
  775.    
  776.     ret
  777.    
  778. blur:
  779.    
  780. pusha
  781. mov eax,0x080000+360*1920
  782.    
  783. copyfloor2:
  784.     add eax,1920
  785.     mov ebx,eax
  786.     add ebx,[vx1]
  787.     add ebx,[vx1]
  788.     add ebx,[vx1]
  789.    
  790.     mov ecx,[ebx-15]
  791.     and ecx,0x00FEFEFE
  792.     shr ecx,1
  793.     mov edx,[ebx-12]
  794.     and edx,0x00FEFEFE
  795.     shr edx,1
  796.     add edx,ecx
  797.     and edx,0x00FEFEFE
  798.     shr edx,1
  799.    
  800.      mov ecx,[ebx-9]
  801.      and ecx,0x00FEFEFE
  802.      shr ecx,1
  803.      add edx,ecx
  804.    
  805.       and edx,0x00FEFEFE
  806.       shr edx,1
  807.    
  808.       mov ecx,[ebx-6]
  809.       and ecx,0x00FEFEFE
  810.       shr ecx,1
  811.       add edx,ecx
  812.    
  813.        and edx,0x00FEFEFE
  814.        shr edx,1
  815.    
  816.        mov ecx,[ebx-3]
  817.        and ecx,0x00FEFEFE
  818.        shr ecx,1
  819.        add edx,ecx
  820.    
  821.         and edx,0x00FEFEFE
  822.         shr edx,1
  823.    
  824.         mov ecx,[ebx]
  825.         and ecx,0x00FEFEFE
  826.         shr ecx,1
  827.         add edx,ecx
  828.    
  829.     mov [ebx],edx
  830.    
  831.     cmp eax,0x80000+478*1920
  832.     jb copyfloor2
  833.    
  834. popa
  835.    
  836. ret
  837.    
  838.    
  839.    
  840. ; ******* Darken by Distance *******
  841. dark_distance:
  842.    
  843. ; color must be in edx, wall height in [vdd]
  844.    
  845.     mov eax,[vdd]
  846.     cmp eax,50
  847.     jg nodark
  848.     ;                split rgb
  849.    
  850.     mov [blue],edx
  851.     and [blue],dword 255
  852.    
  853.     shr edx,8
  854.     mov [green],edx
  855.     and [green],dword 255
  856.    
  857.     shr edx,8
  858.     mov [red],edx
  859.     and [red],dword 255
  860.    
  861.     mov eax,51    ; darkness parameter
  862.     sub eax,[vdd]
  863.     cmp [pseudo],dword 1
  864.     je isdarkside
  865.     sal eax,2
  866. isdarkside:
  867.    
  868. ;                        reduce rgb
  869.     sub [red],eax
  870.     cmp [red], dword 0
  871.     jg notblack10b
  872.     mov [red],dword 0
  873.     notblack10b:
  874.    
  875.     sub [green],eax
  876.     cmp [green],dword 0
  877.     jg notblack20b
  878.     mov [green],dword 0
  879.     notblack20b:
  880.    
  881.     mov edx,[blue]
  882.     sub [blue],eax
  883.     cmp [blue],dword 0
  884.     jg notblack30b
  885.     mov [blue],dword 0
  886.     notblack30b:
  887.    
  888.     shl dword [red],16 ; reassemble rgb
  889.     shl dword [green],8
  890.     mov edx,[red]
  891.     or edx,[green]
  892.     or edx,[blue]
  893.     mov eax,edx
  894.    
  895. nodark:
  896.    
  897.     ret
  898.    
  899.    
  900. ; DATA AREA
  901.    
  902. ;ceil=ceil
  903. ;wall=wall floor
  904. ;2 corner stone
  905. ;3 leaf mosaic
  906. ;4 closed window
  907. ;5 greek mosaic
  908. ;6 old street stones
  909. ;7 maya wall
  910.    
  911. grid:  ; 32*32 Blocks, Map: 0 = Air, 1 to 8 = Wall
  912. db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
  913. db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8
  914. db 5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8
  915. db 1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,3,3,3,3,0,0,0,0,0,0,8
  916. db 5,0,1,2,3,4,5,6,7,8,2,1,3,3,3,0,5,0,2,1,2,3,0,0,0,0,0,0,0,0,0,8
  917. db 1,0,0,0,0,0,0,0,0,0,2,3,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8
  918. db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,5,0,0,0,0,3,3,0,3,3,0,0,0,0,0,8
  919. db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,5,2,1,2,0,3,0,0,0,3,0,0,0,0,0,8
  920. db 5,0,0,0,1,0,0,0,0,0,0,1,0,3,3,3,5,0,0,0,0,3,0,0,0,3,0,0,0,0,0,8
  921. db 1,0,0,0,1,0,0,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,3,0,0,0,0,0,8
  922. db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8
  923. db 1,4,4,4,4,4,4,4,4,4,4,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,8,8
  924. db 2,2,2,2,2,2,8,8,8,8,8,8,8,8,8,0,0,0,6,6,0,7,7,7,7,7,7,7,7,7,8,8
  925. db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1
  926. db 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,2,2,2,2,0,0,0,0,3,3,3,3,3,1
  927. db 1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,6,0,0,0,0,2,0,0,0,0,3,0,0,0,0,1
  928. db 5,0,2,3,2,3,2,3,2,3,2,1,0,0,0,0,6,0,2,2,0,2,0,0,0,0,3,0,5,5,0,1
  929. db 1,0,0,0,0,0,0,4,0,0,0,3,0,0,0,0,6,0,0,2,0,2,0,2,0,0,3,0,0,0,0,1
  930. db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,2,2,2,0,2,0,0,3,3,3,3,0,1
  931. db 1,1,0,1,1,1,1,4,1,0,1,3,7,7,7,0,6,0,0,0,0,0,0,2,0,0,0,0,0,3,0,1
  932. db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,0,0,2,2,2,0,0,0,0,0,3,0,1
  933. db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1
  934. db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,6,0,5,1,0,2,0,0,4,4,0,4,4,0,0,1
  935. db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,6,0,0,5,0,2,0,0,0,4,0,4,0,0,0,1
  936. db 1,0,0,0,0,0,0,4,0,0,0,3,0,3,3,3,6,0,0,1,0,1,0,0,4,4,0,4,4,0,0,1
  937. db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,4,0,0,0,4,4,0,1
  938. db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,6,0,0,1,0,1,0,4,0,0,0,0,0,4,0,1
  939. db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,0,0,0,0,0,4,0,1
  940. db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,1,5,1,0,1,0,4,4,0,0,0,4,4,0,1
  941. db 5,0,0,0,0,0,0,5,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,4,4,4,4,4,0,0,1
  942. db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1
  943. db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  944.    
  945.    
  946. sinus:
  947. dd 0,11,23,34,46,57,69,80,92,103
  948. dd 114,126,137,149,160,172,183,194,206,217
  949. dd 229,240,252,263,274,286,297,309,320,332
  950. dd 343,354,366,377,389,400,411,423,434,446
  951. dd 457,469,480,491,503,514,526,537,548,560
  952. dd 571,583,594,605,617,628,640,651,662,674
  953. dd 685,696,708,719,731,742,753,765,776,787
  954. dd 799,810,821,833,844,855,867,878,889,901
  955. dd 912,923,935,946,957,969,980,991,1003,1014
  956. dd 1025,1036,1048,1059,1070,1082,1093,1104,1115,1127
  957. dd 1138,1149,1161,1172,1183,1194,1206,1217,1228,1239
  958. dd 1250,1262,1273,1284,1295,1307,1318,1329,1340,1351
  959. dd 1363,1374,1385,1396,1407,1418,1430,1441,1452,1463
  960. dd 1474,1485,1496,1508,1519,1530,1541,1552,1563,1574
  961. dd 1585,1597,1608,1619,1630,1641,1652,1663,1674,1685
  962. dd 1696,1707,1718,1729,1740,1751,1762,1773,1784,1795
  963. dd 1806,1817,1828,1839,1850,1861,1872,1883,1894,1905
  964. dd 1916,1927,1938,1949,1960,1971,1982,1992,2003,2014
  965. dd 2025,2036,2047,2058,2069,2079,2090,2101,2112,2123
  966. dd 2134,2144,2155,2166,2177,2188,2198,2209,2220,2231
  967. dd 2241,2252,2263,2274,2284,2295,2306,2316,2327,2338
  968. dd 2349,2359,2370,2381,2391,2402,2413,2423,2434,2444
  969. dd 2455,2466,2476,2487,2497,2508,2518,2529,2540,2550
  970. dd 2561,2571,2582,2592,2603,2613,2624,2634,2645,2655
  971. dd 2666,2676,2686,2697,2707,2718,2728,2738,2749,2759
  972. dd 2770,2780,2790,2801,2811,2821,2832,2842,2852,2863
  973. dd 2873,2883,2893,2904,2914,2924,2934,2945,2955,2965
  974. dd 2975,2985,2996,3006,3016,3026,3036,3046,3056,3067
  975. dd 3077,3087,3097,3107,3117,3127,3137,3147,3157,3167
  976. dd 3177,3187,3197,3207,3217,3227,3237,3247,3257,3267
  977. dd 3277,3287,3297,3306,3316,3326,3336,3346,3356,3365
  978. dd 3375,3385,3395,3405,3414,3424,3434,3444,3453,3463
  979. dd 3473,3483,3492,3502,3512,3521,3531,3540,3550,3560
  980. dd 3569,3579,3588,3598,3608,3617,3627,3636,3646,3655
  981. dd 3665,3674,3684,3693,3703,3712,3721,3731,3740,3750
  982. dd 3759,3768,3778,3787,3796,3806,3815,3824,3834,3843
  983. dd 3852,3861,3871,3880,3889,3898,3907,3917,3926,3935
  984. dd 3944,3953,3962,3971,3980,3990,3999,4008,4017,4026
  985. dd 4035,4044,4053,4062,4071,4080,4089,4098,4106,4115
  986. dd 4124,4133,4142,4151,4160,4169,4177,4186,4195,4204
  987. dd 4213,4221,4230,4239,4247,4256,4265,4274,4282,4291
  988. dd 4299,4308,4317,4325,4334,4342,4351,4360,4368,4377
  989. dd 4385,4394,4402,4411,4419,4427,4436,4444,4453,4461
  990. dd 4469,4478,4486,4495,4503,4511,4519,4528,4536,4544
  991. dd 4552,4561,4569,4577,4585,4593,4602,4610,4618,4626
  992. dd 4634,4642,4650,4658,4666,4674,4682,4690,4698,4706
  993. dd 4714,4722,4730,4738,4746,4754,4762,4769,4777,4785
  994. dd 4793,4801,4808,4816,4824,4832,4839,4847,4855,4863
  995. dd 4870,4878,4885,4893,4901,4908,4916,4923,4931,4938
  996. dd 4946,4953,4961,4968,4976,4983,4991,4998,5006,5013
  997. dd 5020,5028,5035,5042,5050,5057,5064,5071,5079,5086
  998. dd 5093,5100,5107,5115,5122,5129,5136,5143,5150,5157
  999. dd 5164,5171,5178,5185,5192,5199,5206,5213,5220,5227
  1000. dd 5234,5241,5248,5254,5261,5268,5275,5282,5288,5295
  1001. dd 5302,5309,5315,5322,5329,5335,5342,5349,5355,5362
  1002. dd 5368,5375,5381,5388,5394,5401,5407,5414,5420,5427
  1003. dd 5433,5439,5446,5452,5459,5465,5471,5477,5484,5490
  1004. dd 5496,5502,5509,5515,5521,5527,5533,5539,5546,5552
  1005. dd 5558,5564,5570,5576,5582,5588,5594,5600,5606,5612
  1006. dd 5617,5623,5629,5635,5641,5647,5652,5658,5664,5670
  1007. dd 5675,5681,5687,5693,5698,5704,5709,5715,5721,5726
  1008. dd 5732,5737,5743,5748,5754,5759,5765,5770,5776,5781
  1009. dd 5786,5792,5797,5802,5808,5813,5818,5824,5829,5834
  1010. dd 5839,5844,5850,5855,5860,5865,5870,5875,5880,5885
  1011. dd 5890,5895,5900,5905,5910,5915,5920,5925,5930,5935
  1012. dd 5939,5944,5949,5954,5959,5963,5968,5973,5978,5982
  1013. dd 5987,5992,5996,6001,6005,6010,6015,6019,6024,6028
  1014. dd 6033,6037,6041,6046,6050,6055,6059,6063,6068,6072
  1015. dd 6076,6081,6085,6089,6093,6097,6102,6106,6110,6114
  1016. dd 6118,6122,6126,6130,6134,6138,6142,6146,6150,6154
  1017. dd 6158,6162,6166,6170,6174,6178,6181,6185,6189,6193
  1018. dd 6196,6200,6204,6208,6211,6215,6218,6222,6226,6229
  1019. dd 6233,6236,6240,6243,6247,6250,6254,6257,6260,6264
  1020. dd 6267,6270,6274,6277,6280,6284,6287,6290,6293,6296
  1021. dd 6300,6303,6306,6309,6312,6315,6318,6321,6324,6327
  1022. dd 6330,6333,6336,6339,6342,6345,6348,6350,6353,6356
  1023. dd 6359,6362,6364,6367,6370,6372,6375,6378,6380,6383
  1024. dd 6386,6388,6391,6393,6396,6398,6401,6403,6405,6408
  1025. dd 6410,6413,6415,6417,6420,6422,6424,6426,6429,6431
  1026. dd 6433,6435,6437,6440,6442,6444,6446,6448,6450,6452
  1027. dd 6454,6456,6458,6460,6462,6464,6466,6467,6469,6471
  1028. dd 6473,6475,6476,6478,6480,6482,6483,6485,6486,6488
  1029. dd 6490,6491,6493,6494,6496,6497,6499,6500,6502,6503
  1030. dd 6505,6506,6507,6509,6510,6511,6513,6514,6515,6516
  1031. dd 6518,6519,6520,6521,6522,6523,6524,6525,6527,6528
  1032. dd 6529,6530,6531,6531,6532,6533,6534,6535,6536,6537
  1033. dd 6538,6538,6539,6540,6541,6541,6542,6543,6543,6544
  1034. dd 6545,6545,6546,6546,6547,6547,6548,6548,6549,6549
  1035. dd 6550,6550,6550,6551,6551,6551,6552,6552,6552,6552
  1036. dd 6553,6553,6553,6553,6553,6553,6553,6553,6553,6553
  1037. dd 6554,6553,6553,6553,6553,6553,6553,6553,6553,6553
  1038. dd 6553,6552,6552,6552,6552,6551,6551,6551,6550,6550
  1039. dd 6550,6549,6549,6548,6548,6547,6547,6546,6546,6545
  1040. dd 6545,6544,6543,6543,6542,6541,6541,6540,6539,6538
  1041. dd 6538,6537,6536,6535,6534,6533,6532,6531,6531,6530
  1042. dd 6529,6528,6527,6525,6524,6523,6522,6521,6520,6519
  1043. dd 6518,6516,6515,6514,6513,6511,6510,6509,6507,6506
  1044. dd 6505,6503,6502,6500,6499,6497,6496,6494,6493,6491
  1045. dd 6490,6488,6486,6485,6483,6482,6480,6478,6476,6475
  1046. dd 6473,6471,6469,6467,6466,6464,6462,6460,6458,6456
  1047. dd 6454,6452,6450,6448,6446,6444,6442,6440,6437,6435
  1048. dd 6433,6431,6429,6426,6424,6422,6420,6417,6415,6413
  1049. dd 6410,6408,6405,6403,6401,6398,6396,6393,6391,6388
  1050. dd 6386,6383,6380,6378,6375,6372,6370,6367,6364,6362
  1051. dd 6359,6356,6353,6350,6348,6345,6342,6339,6336,6333
  1052. dd 6330,6327,6324,6321,6318,6315,6312,6309,6306,6303
  1053. dd 6300,6296,6293,6290,6287,6284,6280,6277,6274,6270
  1054. dd 6267,6264,6260,6257,6254,6250,6247,6243,6240,6236
  1055. dd 6233,6229,6226,6222,6218,6215,6211,6208,6204,6200
  1056. dd 6196,6193,6189,6185,6181,6178,6174,6170,6166,6162
  1057. dd 6158,6154,6150,6146,6142,6138,6134,6130,6126,6122
  1058. dd 6118,6114,6110,6106,6102,6097,6093,6089,6085,6081
  1059. dd 6076,6072,6068,6063,6059,6055,6050,6046,6041,6037
  1060. dd 6033,6028,6024,6019,6015,6010,6005,6001,5996,5992
  1061. dd 5987,5982,5978,5973,5968,5963,5959,5954,5949,5944
  1062. dd 5939,5935,5930,5925,5920,5915,5910,5905,5900,5895
  1063. dd 5890,5885,5880,5875,5870,5865,5860,5855,5850,5844
  1064. dd 5839,5834,5829,5824,5818,5813,5808,5802,5797,5792
  1065. dd 5786,5781,5776,5770,5765,5759,5754,5748,5743,5737
  1066. dd 5732,5726,5721,5715,5709,5704,5698,5693,5687,5681
  1067. dd 5675,5670,5664,5658,5652,5647,5641,5635,5629,5623
  1068. dd 5617,5612,5606,5600,5594,5588,5582,5576,5570,5564
  1069. dd 5558,5552,5546,5539,5533,5527,5521,5515,5509,5502
  1070. dd 5496,5490,5484,5477,5471,5465,5459,5452,5446,5439
  1071. dd 5433,5427,5420,5414,5407,5401,5394,5388,5381,5375
  1072. dd 5368,5362,5355,5349,5342,5335,5329,5322,5315,5309
  1073. dd 5302,5295,5288,5282,5275,5268,5261,5254,5248,5241
  1074. dd 5234,5227,5220,5213,5206,5199,5192,5185,5178,5171
  1075. dd 5164,5157,5150,5143,5136,5129,5122,5115,5107,5100
  1076. dd 5093,5086,5079,5071,5064,5057,5050,5042,5035,5028
  1077. dd 5020,5013,5006,4998,4991,4983,4976,4968,4961,4953
  1078. dd 4946,4938,4931,4923,4916,4908,4901,4893,4885,4878
  1079. dd 4870,4863,4855,4847,4839,4832,4824,4816,4808,4801
  1080. dd 4793,4785,4777,4769,4762,4754,4746,4738,4730,4722
  1081. dd 4714,4706,4698,4690,4682,4674,4666,4658,4650,4642
  1082. dd 4634,4626,4618,4610,4602,4593,4585,4577,4569,4561
  1083. dd 4552,4544,4536,4528,4519,4511,4503,4495,4486,4478
  1084. dd 4469,4461,4453,4444,4436,4427,4419,4411,4402,4394
  1085. dd 4385,4377,4368,4360,4351,4342,4334,4325,4317,4308
  1086. dd 4299,4291,4282,4274,4265,4256,4247,4239,4230,4221
  1087. dd 4213,4204,4195,4186,4177,4169,4160,4151,4142,4133
  1088. dd 4124,4115,4106,4098,4089,4080,4071,4062,4053,4044
  1089. dd 4035,4026,4017,4008,3999,3990,3980,3971,3962,3953
  1090. dd 3944,3935,3926,3917,3907,3898,3889,3880,3871,3861
  1091. dd 3852,3843,3834,3824,3815,3806,3796,3787,3778,3768
  1092. dd 3759,3750,3740,3731,3721,3712,3703,3693,3684,3674
  1093. dd 3665,3655,3646,3636,3627,3617,3608,3598,3588,3579
  1094. dd 3569,3560,3550,3540,3531,3521,3512,3502,3492,3483
  1095. dd 3473,3463,3453,3444,3434,3424,3414,3405,3395,3385
  1096. dd 3375,3365,3356,3346,3336,3326,3316,3306,3297,3287
  1097. dd 3277,3267,3257,3247,3237,3227,3217,3207,3197,3187
  1098. dd 3177,3167,3157,3147,3137,3127,3117,3107,3097,3087
  1099. dd 3077,3067,3056,3046,3036,3026,3016,3006,2996,2985
  1100. dd 2975,2965,2955,2945,2934,2924,2914,2904,2893,2883
  1101. dd 2873,2863,2852,2842,2832,2821,2811,2801,2790,2780
  1102. dd 2770,2759,2749,2738,2728,2718,2707,2697,2686,2676
  1103. dd 2666,2655,2645,2634,2624,2613,2603,2592,2582,2571
  1104. dd 2561,2550,2540,2529,2518,2508,2497,2487,2476,2466
  1105. dd 2455,2444,2434,2423,2413,2402,2391,2381,2370,2359
  1106. dd 2349,2338,2327,2316,2306,2295,2284,2274,2263,2252
  1107. dd 2241,2231,2220,2209,2198,2188,2177,2166,2155,2144
  1108. dd 2134,2123,2112,2101,2090,2079,2069,2058,2047,2036
  1109. dd 2025,2014,2003,1992,1982,1971,1960,1949,1938,1927
  1110. dd 1916,1905,1894,1883,1872,1861,1850,1839,1828,1817
  1111. dd 1806,1795,1784,1773,1762,1751,1740,1729,1718,1707
  1112. dd 1696,1685,1674,1663,1652,1641,1630,1619,1608,1597
  1113. dd 1585,1574,1563,1552,1541,1530,1519,1508,1496,1485
  1114. dd 1474,1463,1452,1441,1430,1418,1407,1396,1385,1374
  1115. dd 1363,1351,1340,1329,1318,1307,1295,1284,1273,1262
  1116. dd 1250,1239,1228,1217,1206,1194,1183,1172,1161,1149
  1117. dd 1138,1127,1115,1104,1093,1082,1070,1059,1048,1036
  1118. dd 1025,1014,1003,991,980,969,957,946,935,923
  1119. dd 912,901,889,878,867,855,844,833,821,810
  1120. dd 799,787,776,765,753,742,731,719,708,696
  1121. dd 685,674,662,651,640,628,617,605,594,583
  1122. dd 571,560,548,537,526,514,503,491,480,469
  1123. dd 457,446,434,423,411,400,389,377,366,354
  1124. dd 343,332,320,309,297,286,274,263,252,240
  1125. dd 229,217,206,194,183,172,160,149,137,126
  1126. dd 114,103,92,80,69,57,46,34,23,11
  1127. dd 0,-11,-23,-34,-46,-57,-69,-80,-92,-103
  1128. dd -114,-126,-137,-149,-160,-172,-183,-194,-206,-217
  1129. dd -229,-240,-252,-263,-274,-286,-297,-309,-320,-332
  1130. dd -343,-354,-366,-377,-389,-400,-411,-423,-434,-446
  1131. dd -457,-469,-480,-491,-503,-514,-526,-537,-548,-560
  1132. dd -571,-583,-594,-605,-617,-628,-640,-651,-662,-674
  1133. dd -685,-696,-708,-719,-731,-742,-753,-765,-776,-787
  1134. dd -799,-810,-821,-833,-844,-855,-867,-878,-889,-901
  1135. dd -912,-923,-935,-946,-957,-969,-980,-991,-1003,-1014
  1136. dd -1025,-1036,-1048,-1059,-1070,-1082,-1093,-1104,-1115,-1127
  1137. dd -1138,-1149,-1161,-1172,-1183,-1194,-1206,-1217,-1228,-1239
  1138. dd -1250,-1262,-1273,-1284,-1295,-1307,-1318,-1329,-1340,-1351
  1139. dd -1363,-1374,-1385,-1396,-1407,-1418,-1430,-1441,-1452,-1463
  1140. dd -1474,-1485,-1496,-1508,-1519,-1530,-1541,-1552,-1563,-1574
  1141. dd -1585,-1597,-1608,-1619,-1630,-1641,-1652,-1663,-1674,-1685
  1142. dd -1696,-1707,-1718,-1729,-1740,-1751,-1762,-1773,-1784,-1795
  1143. dd -1806,-1817,-1828,-1839,-1850,-1861,-1872,-1883,-1894,-1905
  1144. dd -1916,-1927,-1938,-1949,-1960,-1971,-1982,-1992,-2003,-2014
  1145. dd -2025,-2036,-2047,-2058,-2069,-2079,-2090,-2101,-2112,-2123
  1146. dd -2134,-2144,-2155,-2166,-2177,-2188,-2198,-2209,-2220,-2231
  1147. dd -2241,-2252,-2263,-2274,-2284,-2295,-2306,-2316,-2327,-2338
  1148. dd -2349,-2359,-2370,-2381,-2391,-2402,-2413,-2423,-2434,-2444
  1149. dd -2455,-2466,-2476,-2487,-2497,-2508,-2518,-2529,-2540,-2550
  1150. dd -2561,-2571,-2582,-2592,-2603,-2613,-2624,-2634,-2645,-2655
  1151. dd -2666,-2676,-2686,-2697,-2707,-2718,-2728,-2738,-2749,-2759
  1152. dd -2770,-2780,-2790,-2801,-2811,-2821,-2832,-2842,-2852,-2863
  1153. dd -2873,-2883,-2893,-2904,-2914,-2924,-2934,-2945,-2955,-2965
  1154. dd -2975,-2985,-2996,-3006,-3016,-3026,-3036,-3046,-3056,-3067
  1155. dd -3077,-3087,-3097,-3107,-3117,-3127,-3137,-3147,-3157,-3167
  1156. dd -3177,-3187,-3197,-3207,-3217,-3227,-3237,-3247,-3257,-3267
  1157. dd -3277,-3287,-3297,-3306,-3316,-3326,-3336,-3346,-3356,-3365
  1158. dd -3375,-3385,-3395,-3405,-3414,-3424,-3434,-3444,-3453,-3463
  1159. dd -3473,-3483,-3492,-3502,-3512,-3521,-3531,-3540,-3550,-3560
  1160. dd -3569,-3579,-3588,-3598,-3608,-3617,-3627,-3636,-3646,-3655
  1161. dd -3665,-3674,-3684,-3693,-3703,-3712,-3721,-3731,-3740,-3750
  1162. dd -3759,-3768,-3778,-3787,-3796,-3806,-3815,-3824,-3834,-3843
  1163. dd -3852,-3861,-3871,-3880,-3889,-3898,-3907,-3917,-3926,-3935
  1164. dd -3944,-3953,-3962,-3971,-3980,-3990,-3999,-4008,-4017,-4026
  1165. dd -4035,-4044,-4053,-4062,-4071,-4080,-4089,-4098,-4106,-4115
  1166. dd -4124,-4133,-4142,-4151,-4160,-4169,-4177,-4186,-4195,-4204
  1167. dd -4213,-4221,-4230,-4239,-4247,-4256,-4265,-4274,-4282,-4291
  1168. dd -4299,-4308,-4317,-4325,-4334,-4342,-4351,-4360,-4368,-4377
  1169. dd -4385,-4394,-4402,-4411,-4419,-4427,-4436,-4444,-4453,-4461
  1170. dd -4469,-4478,-4486,-4495,-4503,-4511,-4519,-4528,-4536,-4544
  1171. dd -4552,-4561,-4569,-4577,-4585,-4593,-4602,-4610,-4618,-4626
  1172. dd -4634,-4642,-4650,-4658,-4666,-4674,-4682,-4690,-4698,-4706
  1173. dd -4714,-4722,-4730,-4738,-4746,-4754,-4762,-4769,-4777,-4785
  1174. dd -4793,-4801,-4808,-4816,-4824,-4832,-4839,-4847,-4855,-4863
  1175. dd -4870,-4878,-4885,-4893,-4901,-4908,-4916,-4923,-4931,-4938
  1176. dd -4946,-4953,-4961,-4968,-4976,-4983,-4991,-4998,-5006,-5013
  1177. dd -5020,-5028,-5035,-5042,-5050,-5057,-5064,-5071,-5079,-5086
  1178. dd -5093,-5100,-5107,-5115,-5122,-5129,-5136,-5143,-5150,-5157
  1179. dd -5164,-5171,-5178,-5185,-5192,-5199,-5206,-5213,-5220,-5227
  1180. dd -5234,-5241,-5248,-5254,-5261,-5268,-5275,-5282,-5288,-5295
  1181. dd -5302,-5309,-5315,-5322,-5329,-5335,-5342,-5349,-5355,-5362
  1182. dd -5368,-5375,-5381,-5388,-5394,-5401,-5407,-5414,-5420,-5427
  1183. dd -5433,-5439,-5446,-5452,-5459,-5465,-5471,-5477,-5484,-5490
  1184. dd -5496,-5502,-5509,-5515,-5521,-5527,-5533,-5539,-5546,-5552
  1185. dd -5558,-5564,-5570,-5576,-5582,-5588,-5594,-5600,-5606,-5612
  1186. dd -5617,-5623,-5629,-5635,-5641,-5647,-5652,-5658,-5664,-5670
  1187. dd -5675,-5681,-5687,-5693,-5698,-5704,-5709,-5715,-5721,-5726
  1188. dd -5732,-5737,-5743,-5748,-5754,-5759,-5765,-5770,-5776,-5781
  1189. dd -5786,-5792,-5797,-5802,-5808,-5813,-5818,-5824,-5829,-5834
  1190. dd -5839,-5844,-5850,-5855,-5860,-5865,-5870,-5875,-5880,-5885
  1191. dd -5890,-5895,-5900,-5905,-5910,-5915,-5920,-5925,-5930,-5935
  1192. dd -5939,-5944,-5949,-5954,-5959,-5963,-5968,-5973,-5978,-5982
  1193. dd -5987,-5992,-5996,-6001,-6005,-6010,-6015,-6019,-6024,-6028
  1194. dd -6033,-6037,-6041,-6046,-6050,-6055,-6059,-6063,-6068,-6072
  1195. dd -6076,-6081,-6085,-6089,-6093,-6097,-6102,-6106,-6110,-6114
  1196. dd -6118,-6122,-6126,-6130,-6134,-6138,-6142,-6146,-6150,-6154
  1197. dd -6158,-6162,-6166,-6170,-6174,-6178,-6181,-6185,-6189,-6193
  1198. dd -6196,-6200,-6204,-6208,-6211,-6215,-6218,-6222,-6226,-6229
  1199. dd -6233,-6236,-6240,-6243,-6247,-6250,-6254,-6257,-6260,-6264
  1200. dd -6267,-6270,-6274,-6277,-6280,-6284,-6287,-6290,-6293,-6296
  1201. dd -6300,-6303,-6306,-6309,-6312,-6315,-6318,-6321,-6324,-6327
  1202. dd -6330,-6333,-6336,-6339,-6342,-6345,-6348,-6350,-6353,-6356
  1203. dd -6359,-6362,-6364,-6367,-6370,-6372,-6375,-6378,-6380,-6383
  1204. dd -6386,-6388,-6391,-6393,-6396,-6398,-6401,-6403,-6405,-6408
  1205. dd -6410,-6413,-6415,-6417,-6420,-6422,-6424,-6426,-6429,-6431
  1206. dd -6433,-6435,-6437,-6440,-6442,-6444,-6446,-6448,-6450,-6452
  1207. dd -6454,-6456,-6458,-6460,-6462,-6464,-6466,-6467,-6469,-6471
  1208. dd -6473,-6475,-6476,-6478,-6480,-6482,-6483,-6485,-6486,-6488
  1209. dd -6490,-6491,-6493,-6494,-6496,-6497,-6499,-6500,-6502,-6503
  1210. dd -6505,-6506,-6507,-6509,-6510,-6511,-6513,-6514,-6515,-6516
  1211. dd -6518,-6519,-6520,-6521,-6522,-6523,-6524,-6525,-6527,-6528
  1212. dd -6529,-6530,-6531,-6531,-6532,-6533,-6534,-6535,-6536,-6537
  1213. dd -6538,-6538,-6539,-6540,-6541,-6541,-6542,-6543,-6543,-6544
  1214. dd -6545,-6545,-6546,-6546,-6547,-6547,-6548,-6548,-6549,-6549
  1215. dd -6550,-6550,-6550,-6551,-6551,-6551,-6552,-6552,-6552,-6552
  1216. dd -6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553
  1217. dd -6554,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553
  1218. dd -6553,-6552,-6552,-6552,-6552,-6551,-6551,-6551,-6550,-6550
  1219. dd -6550,-6549,-6549,-6548,-6548,-6547,-6547,-6546,-6546,-6545
  1220. dd -6545,-6544,-6543,-6543,-6542,-6541,-6541,-6540,-6539,-6538
  1221. dd -6538,-6537,-6536,-6535,-6534,-6533,-6532,-6531,-6531,-6530
  1222. dd -6529,-6528,-6527,-6525,-6524,-6523,-6522,-6521,-6520,-6519
  1223. dd -6518,-6516,-6515,-6514,-6513,-6511,-6510,-6509,-6507,-6506
  1224. dd -6505,-6503,-6502,-6500,-6499,-6497,-6496,-6494,-6493,-6491
  1225. dd -6490,-6488,-6486,-6485,-6483,-6482,-6480,-6478,-6476,-6475
  1226. dd -6473,-6471,-6469,-6467,-6466,-6464,-6462,-6460,-6458,-6456
  1227. dd -6454,-6452,-6450,-6448,-6446,-6444,-6442,-6440,-6437,-6435
  1228. dd -6433,-6431,-6429,-6426,-6424,-6422,-6420,-6417,-6415,-6413
  1229. dd -6410,-6408,-6405,-6403,-6401,-6398,-6396,-6393,-6391,-6388
  1230. dd -6386,-6383,-6380,-6378,-6375,-6372,-6370,-6367,-6364,-6362
  1231. dd -6359,-6356,-6353,-6350,-6348,-6345,-6342,-6339,-6336,-6333
  1232. dd -6330,-6327,-6324,-6321,-6318,-6315,-6312,-6309,-6306,-6303
  1233. dd -6300,-6296,-6293,-6290,-6287,-6284,-6280,-6277,-6274,-6270
  1234. dd -6267,-6264,-6260,-6257,-6254,-6250,-6247,-6243,-6240,-6236
  1235. dd -6233,-6229,-6226,-6222,-6218,-6215,-6211,-6208,-6204,-6200
  1236. dd -6196,-6193,-6189,-6185,-6181,-6178,-6174,-6170,-6166,-6162
  1237. dd -6158,-6154,-6150,-6146,-6142,-6138,-6134,-6130,-6126,-6122
  1238. dd -6118,-6114,-6110,-6106,-6102,-6097,-6093,-6089,-6085,-6081
  1239. dd -6076,-6072,-6068,-6063,-6059,-6055,-6050,-6046,-6041,-6037
  1240. dd -6033,-6028,-6024,-6019,-6015,-6010,-6005,-6001,-5996,-5992
  1241. dd -5987,-5982,-5978,-5973,-5968,-5963,-5959,-5954,-5949,-5944
  1242. dd -5939,-5935,-5930,-5925,-5920,-5915,-5910,-5905,-5900,-5895
  1243. dd -5890,-5885,-5880,-5875,-5870,-5865,-5860,-5855,-5850,-5844
  1244. dd -5839,-5834,-5829,-5824,-5818,-5813,-5808,-5802,-5797,-5792
  1245. dd -5786,-5781,-5776,-5770,-5765,-5759,-5754,-5748,-5743,-5737
  1246. dd -5732,-5726,-5721,-5715,-5709,-5704,-5698,-5693,-5687,-5681
  1247. dd -5675,-5670,-5664,-5658,-5652,-5647,-5641,-5635,-5629,-5623
  1248. dd -5617,-5612,-5606,-5600,-5594,-5588,-5582,-5576,-5570,-5564
  1249. dd -5558,-5552,-5546,-5539,-5533,-5527,-5521,-5515,-5509,-5502
  1250. dd -5496,-5490,-5484,-5477,-5471,-5465,-5459,-5452,-5446,-5439
  1251. dd -5433,-5427,-5420,-5414,-5407,-5401,-5394,-5388,-5381,-5375
  1252. dd -5368,-5362,-5355,-5349,-5342,-5335,-5329,-5322,-5315,-5309
  1253. dd -5302,-5295,-5288,-5282,-5275,-5268,-5261,-5254,-5248,-5241
  1254. dd -5234,-5227,-5220,-5213,-5206,-5199,-5192,-5185,-5178,-5171
  1255. dd -5164,-5157,-5150,-5143,-5136,-5129,-5122,-5115,-5107,-5100
  1256. dd -5093,-5086,-5079,-5071,-5064,-5057,-5050,-5042,-5035,-5028
  1257. dd -5020,-5013,-5006,-4998,-4991,-4983,-4976,-4968,-4961,-4953
  1258. dd -4946,-4938,-4931,-4923,-4916,-4908,-4901,-4893,-4885,-4878
  1259. dd -4870,-4863,-4855,-4847,-4839,-4832,-4824,-4816,-4808,-4801
  1260. dd -4793,-4785,-4777,-4769,-4762,-4754,-4746,-4738,-4730,-4722
  1261. dd -4714,-4706,-4698,-4690,-4682,-4674,-4666,-4658,-4650,-4642
  1262. dd -4634,-4626,-4618,-4610,-4602,-4593,-4585,-4577,-4569,-4561
  1263. dd -4552,-4544,-4536,-4528,-4519,-4511,-4503,-4495,-4486,-4478
  1264. dd -4469,-4461,-4453,-4444,-4436,-4427,-4419,-4411,-4402,-4394
  1265. dd -4385,-4377,-4368,-4360,-4351,-4342,-4334,-4325,-4317,-4308
  1266. dd -4299,-4291,-4282,-4274,-4265,-4256,-4247,-4239,-4230,-4221
  1267. dd -4213,-4204,-4195,-4186,-4177,-4169,-4160,-4151,-4142,-4133
  1268. dd -4124,-4115,-4106,-4098,-4089,-4080,-4071,-4062,-4053,-4044
  1269. dd -4035,-4026,-4017,-4008,-3999,-3990,-3980,-3971,-3962,-3953
  1270. dd -3944,-3935,-3926,-3917,-3907,-3898,-3889,-3880,-3871,-3861
  1271. dd -3852,-3843,-3834,-3824,-3815,-3806,-3796,-3787,-3778,-3768
  1272. dd -3759,-3750,-3740,-3731,-3721,-3712,-3703,-3693,-3684,-3674
  1273. dd -3665,-3655,-3646,-3636,-3627,-3617,-3608,-3598,-3588,-3579
  1274. dd -3569,-3560,-3550,-3540,-3531,-3521,-3512,-3502,-3492,-3483
  1275. dd -3473,-3463,-3453,-3444,-3434,-3424,-3414,-3405,-3395,-3385
  1276. dd -3375,-3365,-3356,-3346,-3336,-3326,-3316,-3306,-3297,-3287
  1277. dd -3277,-3267,-3257,-3247,-3237,-3227,-3217,-3207,-3197,-3187
  1278. dd -3177,-3167,-3157,-3147,-3137,-3127,-3117,-3107,-3097,-3087
  1279. dd -3077,-3067,-3056,-3046,-3036,-3026,-3016,-3006,-2996,-2985
  1280. dd -2975,-2965,-2955,-2945,-2934,-2924,-2914,-2904,-2893,-2883
  1281. dd -2873,-2863,-2852,-2842,-2832,-2821,-2811,-2801,-2790,-2780
  1282. dd -2770,-2759,-2749,-2738,-2728,-2718,-2707,-2697,-2686,-2676
  1283. dd -2666,-2655,-2645,-2634,-2624,-2613,-2603,-2592,-2582,-2571
  1284. dd -2561,-2550,-2540,-2529,-2518,-2508,-2497,-2487,-2476,-2466
  1285. dd -2455,-2444,-2434,-2423,-2413,-2402,-2391,-2381,-2370,-2359
  1286. dd -2349,-2338,-2327,-2316,-2306,-2295,-2284,-2274,-2263,-2252
  1287. dd -2241,-2231,-2220,-2209,-2198,-2188,-2177,-2166,-2155,-2144
  1288. dd -2134,-2123,-2112,-2101,-2090,-2079,-2069,-2058,-2047,-2036
  1289. dd -2025,-2014,-2003,-1992,-1982,-1971,-1960,-1949,-1938,-1927
  1290. dd -1916,-1905,-1894,-1883,-1872,-1861,-1850,-1839,-1828,-1817
  1291. dd -1806,-1795,-1784,-1773,-1762,-1751,-1740,-1729,-1718,-1707
  1292. dd -1696,-1685,-1674,-1663,-1652,-1641,-1630,-1619,-1608,-1597
  1293. dd -1585,-1574,-1563,-1552,-1541,-1530,-1519,-1508,-1496,-1485
  1294. dd -1474,-1463,-1452,-1441,-1430,-1418,-1407,-1396,-1385,-1374
  1295. dd -1363,-1351,-1340,-1329,-1318,-1307,-1295,-1284,-1273,-1262
  1296. dd -1250,-1239,-1228,-1217,-1206,-1194,-1183,-1172,-1161,-1149
  1297. dd -1138,-1127,-1115,-1104,-1093,-1082,-1070,-1059,-1048,-1036
  1298. dd -1025,-1014,-1003,-991,-980,-969,-957,-946,-935,-923
  1299. dd -912,-901,-889,-878,-867,-855,-844,-833,-821,-810
  1300. dd -799,-787,-776,-765,-753,-742,-731,-719,-708,-696
  1301. dd -685,-674,-662,-651,-640,-628,-617,-605,-594,-583
  1302. dd -571,-560,-548,-537,-526,-514,-503,-491,-480,-469
  1303. dd -457,-446,-434,-423,-411,-400,-389,-377,-366,-354
  1304. dd -343,-332,-320,-309,-297,-286,-274,-263,-252,-240
  1305. dd -229,-217,-206,-194,-183,-172,-160,-149,-137,-126
  1306. dd -114,-103,-92,-80,-69,-57,-46,-34,-23,-11
  1307.    
  1308. eosinus:
  1309.    
  1310. col1:
  1311.  dd 0
  1312. ; misc raycaster vars:
  1313. vxx:
  1314.  dd 0
  1315. vyy:
  1316.  dd 0
  1317. vl:
  1318.  dd 0
  1319. vpx:
  1320. dd 0x0001FFFF ; initial player position * 0xFFFF
  1321.  vpy:
  1322. dd 0x0001FFFF
  1323. vstepx:
  1324.  dd 0
  1325. vstepy:
  1326.  dd 0
  1327. vxxint:
  1328.  dd 0
  1329. vyyint:
  1330.  dd 0
  1331. vk:
  1332.  dd 0
  1333. va:
  1334.  dd 0
  1335. va2:
  1336.  dd 0
  1337. vdd:
  1338.  dd 0
  1339. vx1:
  1340.  dd 0
  1341. vx1b:
  1342.  dd 0
  1343. vh:
  1344.  dd 0
  1345. vdt:
  1346.  dd 0
  1347. vheading: ; initial heading: 0 to 3599
  1348.  dd 0
  1349. vacompare:
  1350.  dd 0
  1351. vpxi:
  1352.  dd 0
  1353. vpyi:
  1354.  dd 0
  1355. wtolong:
  1356.  dw 0,0
  1357.    
  1358. xtemp:
  1359.  dd 0
  1360. ytemp:
  1361.  dd 0
  1362. xfrac:
  1363.  dd 0
  1364. yfrac:
  1365.  dd 0
  1366. h_old:
  1367.  dd 0
  1368. vbottom:
  1369.  dd 0
  1370. mouseya:
  1371.  dd 0
  1372. remeax:
  1373.  dd 0
  1374. remebx:
  1375.  dd 0
  1376. remecx:
  1377.  dd 0
  1378. remedx:
  1379.  dd 0
  1380. remedi:
  1381.  dd 0
  1382. remesi:
  1383.  dd 0
  1384. red:
  1385.  dd 0
  1386. green:
  1387.  dd 0
  1388. blue:
  1389.  dd 0
  1390. pseudo:
  1391.  dd 0
  1392. step1:
  1393.  dd 0
  1394. step64:
  1395.  dd 0
  1396. lasty:
  1397.  dd 0
  1398. ceil:
  1399. include "ceil.inc"
  1400. wall:
  1401. include "wall.inc"
  1402. wall2:
  1403. include "wall2.inc"
  1404. wall3:
  1405. include "wall3.inc"
  1406. wall4:
  1407. include "wall4.inc"
  1408. wall5:
  1409. include "wall5.inc"
  1410. wall6:
  1411. include "wall6.inc"
  1412. wall7:
  1413. include "wall7.inc"
  1414.    
  1415.    
  1416.    
  1417. labelt:
  1418.       db   'FISHEYE RAYCASTING ENGINE ETC. FREE3D'
  1419.    
  1420. labellen:
  1421.    
  1422. I_END:
  1423.    
  1424.    
  1425.    
  1426.    
  1427.