Subversion Repositories Kolibri OS

Rev

Rev 6249 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------------------------------
  2. ; Free3D version 0.6
  3. ;
  4. ; last update:  21/02/2011
  5. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  6. ; changes:      advanced control for mouse
  7. ;               advanced control for keyboard:
  8. ;               W,A,S,D adn Arrow UP,Down,Left,Right
  9. ;---------------------------------------------------------------------
  10. ; Free3D version 0.5
  11. ;
  12. ; last update:  20/02/2011
  13. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  14. ; changes:      PNG textures 128x128
  15. ;               using libraries cnv_png.obj and archiver.obj
  16. ;               using dinamically allocation of memory
  17. ;
  18. ;---------------------------------------------------------------------
  19. ;
  20. ;   Fisheye Raycasting Engine Etc. FREE3D for MENUETOS by Dieter Marfurt
  21. ;   Version 0.4 (requires some texture-files to compile (see Data Section))
  22. ;   dietermarfurt@angelfire.com - www.melog.ch/mos_pub/
  23. ;   Don't hit me - I'm an ASM-Newbie... since years :)
  24. ;
  25. ;   Compile with FASM for Menuet (requires .INC files - see DATA Section)
  26. ;
  27. ;   Willow - greatly srinked code size by using GIF texture and FPU to calculate sine table
  28. ;
  29. ;   !!!! Don't use GIF_LITE.INC in your apps - it's modified for FREE3D !!!!
  30. ;
  31. ;   Heavyiron - new 0-function of drawing window from kolibri (do not work correctly with menuet)
  32.  
  33. TEX_SIZE        equ     128*128*4       ;64*64*4        ;
  34.  
  35. ICON_SIZE_X     equ     128     ;64
  36. ICON_SIZE_Y     equ     128     ;64
  37.  
  38. Floors_Height   equ     32000
  39. ;---------------------------------------------------------------------
  40. use32
  41. org     0x0
  42.         db 'MENUET01'   ; 8 byte id
  43.         dd 0x01         ; header version
  44.         dd START        ; start of code
  45.         dd IM_END       ; size of image
  46.         dd I_END        ; 0x100000 ; memory for app
  47.         dd stacktop     ; 0x100000 ; esp
  48.         dd 0x0
  49.         dd path
  50. ;---------------------------------------------------------------------
  51. include '../../../macros.inc'
  52. ;include        'macros.inc'
  53. include '../../../KOSfuncs.inc'
  54. include '../../../load_lib.mac'
  55. ;include 'load_lib.mac'
  56. @use_library
  57. ;---------------------------------------------------------------------
  58. START:  ; start of execution
  59.         mcall   68,11
  60.         mcall   66,1,1
  61.         mcall   40,0x27
  62.  
  63.         mcall   9,procinfo,-1
  64.         mov     ecx,[ebx+30]    ; PID
  65.         mcall   18,21
  66.         mov     [active_process],eax    ; WINDOW SLOT
  67.  
  68. load_libraries  l_libs_start,end_l_libs
  69.         test    eax,eax
  70.         jnz     finish
  71.  
  72. ; unpack deflate
  73.         mov     eax,[unpack_DeflateUnpack2]
  74.         mov     [deflate_unpack],eax
  75.  
  76.         call    load_icons
  77.         call    convert_icons
  78.  
  79.         mov     esi,sinus
  80.         mov     ecx,360*10
  81.         fninit
  82.         fld     [sindegree]
  83. ;--------------------------------------
  84. .sinlp:
  85.         fst     st1
  86.         fsin
  87.         fmul    [sindiv]
  88.         fistp   dword[esi]
  89.         add     esi,4
  90.         fadd    [sininc]
  91.         loop    .sinlp
  92. ;---------------------------------------------------------------------
  93.         call    cursor_to_screen_center
  94.         call    set_new_cursor_skin
  95. ;--------------------------------------------------------------------- 
  96. align   4
  97. red:    ; redraw
  98.         call    draw_window
  99.         call    draw_stuff
  100. ;---------------------------------------------------------------------
  101. align   4
  102. still:
  103.         mcall   10      ; ask no wait for full speed
  104.  
  105.         cmp     eax,1   ; window redraw request ?
  106.         je      red
  107.  
  108.         cmp     eax,2   ; key in buffer ?
  109.         je      key
  110.  
  111.         cmp     eax,3   ; button in buffer ?
  112.         je      button
  113.  
  114.         cmp     eax,6
  115.         jne     still
  116. ;---------------------------------------------------------------------
  117. mouse:
  118.         mcall   18,7
  119.         cmp     [active_process],eax
  120.         jne     still
  121.  
  122.         mcall   37,1
  123.  
  124.         xor     ebx,ebx
  125.         mov     bx,ax  ; EBX mouse y
  126.         shr     eax,16 ; EAX mouse x
  127.  
  128.         mov     ecx,[mouse_position_old]
  129.         xor     edx,edx
  130.         mov     dx,cx  ; EDX mouse y old
  131.         shr     ecx,16 ; ECX mouse x old
  132.        
  133.         cmp     eax,ecx
  134.         je      .y      ;still
  135.         ja      .turn_left
  136. ;---------------------------------------------------------------------
  137. .turn_right:
  138.         xchg    eax,ecx
  139.         sub     eax,ecx
  140.         mov     edi,[vheading]
  141.         add     edi,eax
  142.         jmp     @f
  143. ;---------------------------------------------------------------------
  144. .turn_left:
  145.         sub     eax,ecx
  146.         mov     edi,[vheading]
  147.         sub     edi,eax
  148. ;--------------------------------------
  149. @@:
  150.         call    check_range
  151. ;---------------------------------------------------------------------
  152. .y:
  153.         cmp     ebx,edx
  154.         je      .red
  155.         ja      .walk_down
  156. ;--------------------------------------
  157. .walk_up:      
  158.         sub     edx,ebx
  159.         mov     ecx,edx
  160.         call    prepare_2
  161.         jz      .1
  162. ;--------------------------------------
  163.         add     eax,edi ; newPx
  164.         add     ebx,esi ; newPy
  165.         jmp     .1
  166. ;---------------------------------------------------------------------
  167. .walk_down:
  168.         sub     ebx,edx
  169.         mov     ecx,ebx
  170.         call    prepare_2
  171.         jz      .1
  172.        
  173.         sub     eax,edi ; newPx
  174.         sub     ebx,esi ; newPy
  175. ;--------------------------------------
  176. .1:
  177.         mov     edi,eax ; newPx / ffff
  178.         mov     esi,ebx ; newPy / ffff
  179.         sar     edi,16
  180.         sar     esi,16
  181.         mov     ecx,esi
  182.         sal     ecx,5
  183.         lea     ecx,[grid+ecx+edi]
  184.         cmp     [ecx],byte 0
  185.         je      @f
  186.        
  187.         call    cursor_to_screen_center
  188.         jmp     still   ;cannotwalk
  189. ;---------------------------------------------------------------------
  190. @@:
  191.         mov     [vpx],eax
  192.         mov     [vpy],ebx
  193. ;--------------------------------------
  194. .red:
  195.         call    cursor_to_screen_center
  196.         jmp     red
  197. ;---------------------------------------------------------------------
  198. align   4
  199. prepare_2:
  200.         shr     ecx,4
  201.         push    ecx
  202.         call    prepare_1
  203.         pop     ecx
  204.         cmp     ecx,3
  205.         jb      @f
  206.         mov     ecx,3
  207. @@:
  208.         shl     edi,cl
  209.         shl     esi,cl
  210.         test    ecx,ecx
  211.         ret
  212. ;---------------------------------------------------------------------
  213. align   4
  214. check_range:
  215.         cmp     edi,0
  216.         jge     @f
  217.  
  218.         mov     edi,3600
  219.         jmp     .store
  220. ;--------------------------------------
  221. @@:
  222.         cmp     edi,3600
  223.         jle     @f
  224.  
  225.         xor     edi,edi
  226. ;--------------------------------------
  227. @@:
  228. .store:
  229.         mov     [vheading],edi
  230.         ret
  231. ;---------------------------------------------------------------------
  232. align   4
  233. cursor_to_screen_center:
  234.         mcall   18,15
  235.         mcall   37,1
  236.         mov     [mouse_position_old],eax
  237.         ret
  238. ;---------------------------------------------------------------------
  239. set_new_cursor_skin:
  240.         mcall   68,12,32*32*4
  241.         mov     ecx,eax
  242.         mcall   37,4,,2
  243.         mov     ecx,eax
  244.         mcall   37,5
  245.         ret
  246. ;---------------------------------------------------------------------
  247. align   4
  248. key:    ; key
  249.         mcall   2
  250.         cmp     [extended_key],1
  251.         je      .extended_key
  252.         test    al, al
  253.         jnz     still
  254.  
  255.         cmp     ah, 0xE0
  256.         jne     @f
  257.  
  258.         mov     [extended_key],1
  259.         jmp     still
  260. ;---------------------------------------------------------------------
  261. @@:
  262.         cmp     ah,1    ; Esc
  263.         je      finish
  264.  
  265.         cmp     ah,17 ; W up
  266.         je      s_up
  267.  
  268.         cmp     ah,31 ; S down
  269.         je      s_down
  270.  
  271.         cmp     ah,30 ; A left
  272.         je      w_left  ;s_left
  273.  
  274.         cmp     ah,32 ; D right
  275.         je      w_right ;s_right
  276.  
  277.         jmp     still
  278. ;---------------------------------------------------------------------
  279. .extended_key:
  280.         mov     [extended_key],0
  281.         mov     [current_key_code],ah
  282.  
  283.         cmp     ah,27   ; esc=End App
  284.         je      finish
  285.  
  286.         cmp     ah,72 ; up arrow
  287.         je      s_up
  288.  
  289.         cmp     ah,80 ; down arrow
  290.         je      s_down
  291.  
  292.         cmp     ah,75 ; left arrow
  293.         je      s_left
  294.  
  295.         cmp     ah,77 ; right arrow
  296.         je      s_right
  297.  
  298.         jmp     still
  299. ;---------------------------------------------------------------------
  300. align   4
  301. smart_clr_key_buf:
  302.         mov     al,[old_key_code]
  303.         mov     ah,[current_key_code]
  304.         mov     [old_key_code],ah
  305.         cmp     al,ah
  306.         jne     .end
  307. ;--------------------------------------
  308. .still:
  309.         mcall   2
  310.         cmp     [extended_key],1
  311.         je      .extended_key
  312.  
  313.         test    al, al
  314.         jnz     .end
  315.  
  316.         cmp     ah, 0xE0
  317.         jne     .end
  318.  
  319.         mov     [extended_key],1
  320.         jmp     .still
  321. .end:
  322.         call    draw_stuff
  323.         jmp     still
  324. ;---------------------------------------------------------------------
  325. .extended_key:
  326.         mov  [extended_key],0
  327.         mov  [current_key_code],ah
  328.         jmp  smart_clr_key_buf
  329. ;---------------------------------------------------------------------
  330. align   4
  331. w_left:         ; walk left
  332.         call    prepare_1
  333.         add     eax,esi ; newPx
  334.         sub     ebx,edi ; newPy
  335.         jmp     s_down.1
  336. ;---------------------------------------------------------------------
  337. align   4
  338. w_right:        ; walk right
  339.         call    prepare_1
  340.         sub     eax,esi ; newPx
  341.         add     ebx,edi ; newPy
  342.         jmp     s_down.1
  343. ;---------------------------------------------------------------------
  344. align   4
  345. s_up:   ; walk forward (key or mouse)
  346.         call    prepare_1
  347. ;       sal     esi,1   ; edit walking speed here
  348. ;       sal     edi,1
  349.         add     eax,edi ; newPx
  350.         add     ebx,esi ; newPy
  351.         jmp     s_down.1
  352. ;---------------------------------------------------------------------
  353. align   4
  354. s_down: ; walk  backward
  355.         call    prepare_1
  356. ;       sal     esi,1   ; edit walking speed here
  357. ;       sal     edi,1
  358.         sub     eax,edi ; newPx
  359.         sub     ebx,esi ; newPy
  360. .1:
  361.         mov     edi,eax ; newPx / ffff
  362.         mov     esi,ebx ; newPy / ffff
  363.         sar     edi,16
  364.         sar     esi,16
  365.         mov     ecx,esi
  366.         sal     ecx,5
  367.         lea     ecx,[grid+ecx+edi]
  368.         cmp     [ecx],byte 0
  369.         jne     smart_clr_key_buf       ;cannotwalk
  370.  
  371.         mov     [vpx],eax
  372.         mov     [vpy],ebx
  373.         jmp     smart_clr_key_buf
  374. ;---------------------------------------------------------------------
  375. align   4
  376. prepare_1:
  377.         mov     eax,[vpx]
  378.         mov     ebx,[vpy]
  379.         mov     ecx,[vheading]
  380.         mov     edx,ecx
  381.         mov     edi,[sinus+ecx*4]
  382.         lea     edx,[sinus+3600+edx*4]
  383.         cmp     edx,eosinus     ; cosinus taken from (sinus plus 900) mod 3600
  384.         jb      @f
  385.  
  386.         sub     edx,14400
  387. ;--------------------------------------
  388. @@:
  389.         mov     esi,[edx]
  390.         ret
  391. ;---------------------------------------------------------------------
  392. align   4
  393. s_left:         ; turn  left    (key)
  394.         mov     edi,[vheading]
  395.         add     edi,50
  396.         jmp     s_right.1
  397. ;---------------------------------------------------------------------
  398. align   4
  399. s_right:        ; turn  right
  400.         mov     edi,[vheading]
  401.         sub     edi,50
  402. .1:
  403.         call    check_range
  404.         jmp     smart_clr_key_buf
  405. ;---------------------------------------------------------------------
  406. align   4
  407. button: ; button
  408.         mcall   17
  409.         cmp     ah,1    ; button id=1 ?
  410.         jne     still   ;gamestart
  411. ;--------------------------------------
  412. finish:
  413.         mcall   -1      ; close this program
  414. ;---------------------------------------------------------------------
  415. ;   *********************************************
  416. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  417. ;   *********************************************
  418. align   4
  419. draw_window:
  420.         mcall   12,1
  421.        
  422.         mcall   0,<50,649>,<50,484>,0x01000000,0x01000000,0x01000000
  423.  
  424.         mcall   12,2
  425.         ret
  426. ;---------------------------------------------------------------------
  427. ;   *********************************************
  428. ;   *******       COMPUTE 3D-VIEW        ********
  429. ;   *********************************************
  430. align   4
  431. draw_stuff:
  432.         mov     [step1],dword 1
  433. ;       mov     [step64],dword 64
  434.         mov     esi,[vheading]
  435.         add     esi,320
  436.         mov     [va],esi
  437.         mov     eax,[vheading]
  438.         sub     eax,320
  439.         mov     [vacompare],eax
  440. ;------------------------------------ CAST 640 PIXEL COLUMNS ---------------
  441. ; FOR A=320+heading to -319+heading step -1 (a is stored in [va])
  442. ;---------------------------------------------------------------------------
  443. ;       mov     edx,5
  444.         mov     [vx1],dword 0   ;5 ;edx ; init x1 ... pixelcolumn
  445. ;--------------------------------------
  446. align   4
  447. for_a:
  448.         mov     edx,[vx1]
  449.         mov     [vx1b],edx
  450.         sub     [vx1b],dword 320
  451.         mov     edx,[va]        ; a2
  452.         cmp     edx,-1  ; a2 is a mod 3600
  453.         jg      ok1
  454.  
  455.         add     edx,3600
  456. ;--------------------------------------
  457. ok1:
  458.         cmp     edx,3600
  459.         jb      ok2
  460.  
  461.         sub     edx,3600
  462. ;--------------------------------------
  463. ok2:
  464. ; get stepx and stepy
  465.         ; pointer to stepx
  466.         lea     ecx,[sinus+edx*4]
  467.         mov     esi,[ecx]
  468.         sar     esi,4   ; accuracy
  469.         mov     [vstepx],esi    ; store stepx
  470.         lea     esi,[sinus+3600+edx*4]
  471.         cmp     esi,eosinus     ;cosinus taken from ((sinus plus 900) mod 3600)
  472.         jb      ok202
  473.  
  474.         sub     esi,14400
  475. ;--------------------------------------
  476. ok202:
  477.         mov     ecx,[esi]
  478.         sar     ecx,4
  479.         mov     [vstepy],ecx    ; store stepy
  480.  
  481.         mov     eax,[vpx]       ; get Camera Position
  482.         mov     ebx,[vpy]
  483.         mov     [vxx],eax       ; init caster position
  484.         mov     [vyy],ebx
  485.  
  486.         mov     edi,0   ; init L (number of raycsting-steps)
  487.         mov     [step1],dword 1 ; init Caster stepwidth for L.
  488. ;--------------------------------------
  489. ;  raycast a pixel column
  490. align   4
  491. raycast:
  492.         add     edi,[step1]     ; count caster steps
  493.         jmp     nodouble        ; use this to prevent blinking/wobbling textures: much slower!
  494.  
  495. ;       cmp     edi,32
  496. ;       je      double
  497.        
  498. ;       cmp     edi,512
  499. ;       je      double
  500.        
  501. ;       cmp     edi,1024
  502. ;       je      double
  503.        
  504. ;       jmp     nodouble
  505. ;---------------------------------------------------------------------
  506. ;double:
  507. ;       mov     edx,[step1]
  508. ;       sal     edx,1
  509. ;       mov     [step1],edx
  510.  
  511. ;       mov     edx,[vstepx]
  512. ;       sal     edx,1
  513. ;       mov     [vstepx],edx
  514.  
  515. ;       mov     edx,[vstepy]
  516. ;       sal     edx,1
  517. ;       mov     [vstepy],edx
  518. ;--------------------------------------
  519. nodouble:
  520.         mov     eax,Floors_Height       ;32000  ; 3600 ; determine Floors Height based on distance
  521.         xor     edx,edx
  522.         mov     ebx,edi
  523.  
  524.         div     ebx
  525.  
  526.         shl     edx,1
  527.         cmp     ebx,edx
  528.         jae     @f
  529.         inc     eax
  530. @@:
  531.  
  532.         mov     esi,eax
  533.         mov     [vdd],esi
  534.         mov     edx,260
  535.         sub     edx,esi
  536.         mov     [vh],edx
  537.  
  538.         cmp     edx,22
  539.         jb      no_nu_pixel
  540.  
  541.         cmp     edx,259
  542.         jg      no_nu_pixel     ; draw only new pixels
  543.  
  544.         cmp     edx,[h_old]
  545.         je      no_nu_pixel
  546.  
  547.         mov     eax,[vxx]       ; calc floor pixel
  548.         mov     ebx,[vyy]
  549.  
  550.         and     eax,0x0000FFFF
  551.         and     ebx,0x0000FFFF
  552.  
  553.         shr     eax,10
  554.         shr     ebx,10  ; pixel coords inside Texture x,y 64*64
  555.         mov     [xfrac],eax
  556.         mov     [yfrac],ebx
  557. ; plot floor pixel !!!!
  558.         mov     [vl],edi        ; save L
  559.         mov     [ytemp],esi     ; remember L bzw. H
  560.  
  561.         mov     edi,[yfrac]     ; get pixel color of this floor pixel
  562.         sal     edi,9   ;8 - for 64x64
  563.         mov     esi,[xfrac]
  564.         sal     esi,3   ;2 - for 64x64
  565. ; in fact its floor, just using the wall texture :)
  566. ;       lea     edi,[wall+edi+esi]
  567.         add     edi,[wall1]
  568.         add     edi,esi
  569.         mov     edx,[edi]
  570.         mov     [remesi],esi
  571. ;**** calculate pixel adress:****
  572.         mov     esi,[ytemp]
  573.         add     esi,240
  574.         imul    esi,1920
  575.         mov     eax,[vx1]
  576.         lea     eax,[eax+eax*2]
  577.         lea     esi,[screen_buffer+eax+esi]
  578.  
  579.         cmp     esi,screen_buffer+1920*480
  580.         jg      foff0
  581.  
  582.         cmp     esi,screen_buffer
  583.         jb      foff0
  584. ; now we have the adress of the floor-pixel color in edi
  585. ; and the adress of the pixel in the image in esi
  586.         mov     edx,[edi]
  587. ;******************** custom distance DARKEN Floor
  588.         mov     eax,[vdd]
  589. ;       jmp     nodark0 ; use this to deactivate darkening floor (a bit faster)
  590.  
  591.         cmp     eax,80
  592.         jg      nodark0
  593. ; split rgb
  594.         mov     [blue_color],edx
  595.         and     [blue_color],dword 255
  596.  
  597.         shr     edx,8
  598.         mov     [green_color],edx
  599.         and     [green_color],dword 255
  600.  
  601.         shr     edx,8
  602.         mov     [red_color],edx
  603.         and     [red_color],dword 255
  604.  
  605.         mov     eax,81  ; darkness parameter
  606.         sub     eax,[vdd]
  607.         sal     eax,1
  608. ; reduce rgb
  609.         sub     [red_color],eax
  610.         cmp     [red_color],dword 0
  611.         jg      notblack10
  612.  
  613.         mov     [red_color],dword 0
  614. ;--------------------------------------
  615. notblack10:
  616.         sub     [green_color],eax
  617.         cmp     [green_color],dword 0
  618.         jg      notblack20
  619.  
  620.         mov     [green_color],dword 0
  621. ;--------------------------------------
  622. notblack20:
  623.         mov     edx,[blue_color]
  624.         sub     [blue_color],eax
  625.         cmp     [blue_color],dword 0
  626.         jg      notblack30
  627.  
  628.         mov     [blue_color],dword 0
  629. ;--------------------------------------
  630. notblack30:
  631.         shl     dword [red_color],16    ; reassemble rgb
  632.         shl     dword [green_color],8
  633.         mov     edx,[red_color]
  634.         or      edx,[green_color]
  635.         or      edx,[blue_color]
  636. ;--------------------------------------
  637. nodark0:
  638. ;   eo custom darken floor
  639.         mov     eax,edx
  640.  
  641. ;       cmp     esi,screen_buffer+1920*480
  642. ;       ja      foff0
  643.  
  644. ;       cmp     esi,screen_buffer
  645. ;       jb      foff0
  646.  
  647.         mov     [esi],eax       ; actually draw the floor pixel
  648. ; paint "forgotten" pixels
  649.         mov     edx,[lasty]
  650.         sub     edx,1920
  651.         cmp     esi,edx
  652.         je      foff0
  653.  
  654.         mov     [esi+1920],eax
  655.         sub     edx,1920
  656.         cmp     esi,edx
  657.         je      foff0
  658.  
  659.         mov     [edx+1920],eax
  660.         sub     edx,1920
  661.         cmp     esi,edx
  662.         je      foff0
  663.        
  664.         mov     [edx+1920],eax
  665. ;--------------------------------------
  666. align   4
  667. foff0:
  668.         mov     [lasty],esi
  669. ;**** end of draw floor pixel ****
  670.         mov     esi,[remesi]
  671.         mov     edi,[vl]        ; restore L
  672. ;--------------------------------------
  673. no_nu_pixel:
  674.         mov     esi,[vh]
  675.         mov     [h_old],esi
  676.  
  677.         mov     eax,[vxx]
  678.         mov     ebx,[vyy]
  679.  
  680.         add     eax,[vstepx]    ; casting...
  681.         add     ebx,[vstepy]
  682.  
  683.         mov     [vxx],eax
  684.         mov     [vyy],ebx
  685.  
  686.         sar     eax,16
  687.         sar     ebx,16
  688.  
  689.         mov     [vpxi],eax      ; casters position in Map Grid
  690.         mov     [vpyi],ebx
  691.  
  692.         mov     edx,ebx
  693.         shl     edx,5
  694.         lea     edx,[grid+edx+eax]
  695.  
  696.         cmp     [edx],byte 0    ; raycaster reached a wall? (0=no)
  697.         jne     getout
  698.  
  699.         cmp     edi,10000       ; limit view range
  700.         jb      raycast
  701. ;--------------------------------------
  702. getout:
  703.         mov     eax,[edx]       ; store Grid Wall Value for Texture Selection
  704.         mov     [vk],eax
  705.         call    blur    ; deactivate this (blurs the near floor) : a bit faster
  706.  
  707. ; simply copy floor to ceil pixel column here
  708. ;       jmp     nocopy  ; use this for test purposes
  709.         pusha
  710.         mov     eax,screen_buffer+1920*240
  711.         mov     ebx,eax ;screen_buffer+1920*240
  712. ;--------------------------------------
  713. align   4
  714. copyfloor:
  715.         sub     eax,1920
  716.         add     ebx,1920
  717.         mov     ecx,[vx1]
  718.         lea     ecx,[ecx+ecx*2]
  719.         lea     edx,[ecx+ebx]
  720.         add     ecx,eax
  721.         mov     esi,[edx]
  722.         mov     [ecx],esi
  723.         cmp     eax,screen_buffer
  724.         jg      copyfloor
  725. ;@@:
  726.         popa
  727. ; *** end of copy floor to ceil
  728. ;nocopy:
  729. ;--------------------------------------
  730. ; draw this pixelrows wall
  731.         mov     [vl],edi
  732.         mov     edi,260
  733.         sub     edi,[vdd]
  734.         cmp     edi,0
  735.         jg      ok3
  736.        
  737.         xor     edi,edi
  738. ;--------------------------------------
  739. ok3:
  740.         mov     [vbottom],edi   ; end wall ceil (or window top)
  741.         mov     esi,262
  742.         add     esi,[vdd]       ; start wall floor
  743.         xor     edi,edi
  744. ; somethin is wrong with xfrac,so recalc...
  745.         mov     eax,[vxx]
  746.         and     eax,0x0000FFFF
  747.         shr     eax,10
  748.         mov     [xfrac],eax
  749.  
  750.         mov     eax,[vyy]
  751.         and     eax,0x0000FFFF
  752.         shr     eax,10
  753.         mov     [yfrac],eax
  754. ;--------------------------------------
  755. pixelrow:
  756. ; find each pixels color:
  757.         add     edi,ICON_SIZE_Y
  758.         sub     esi,1
  759.         cmp     esi,502         ; dont calc offscreen-pixels
  760.         jg      speedup
  761.  
  762.         xor     edx,edx
  763.         mov     eax,edi
  764.         mov     ebx,[vdd]
  765. ;       add     ebx,ebx
  766.         shl     ebx,1
  767.         div     ebx
  768.  
  769.         shl     edx,1
  770.         cmp     ebx,edx
  771.         jae     @f
  772.         inc     eax
  773. @@:
  774.         and     eax,ICON_SIZE_Y-1
  775.         mov     [ytemp],eax     ; get y of texture for wall
  776.  
  777.         mov     eax,[xfrac]
  778.         add     eax,[yfrac]
  779.         and     eax,ICON_SIZE_X-1
  780.         mov     [xtemp],eax     ; get x of texture for wall
  781. ; now prepare to plot that wall-pixel...
  782.         mov     [remedi],edi
  783.         mov     edi,[ytemp]
  784.         sal     edi,9   ;8 - for 64x64
  785.         mov     edx,[xtemp]
  786.         sal     edx,3   ;2 - for 64x64
  787.         add     edi,edx
  788.         mov     eax,[vk]        ; determine which texture should be used
  789.         and     eax,255
  790.  
  791.         cmp     eax,1
  792.         jne     checkmore1
  793.  
  794.         add     edi,[wall0]     ;ceil
  795.         jmp     foundtex
  796. ;---------------------------------------------------------------------
  797. align   4
  798. checkmore1:
  799.         cmp     eax,2
  800.         jne     checkmore2
  801.  
  802.         add     edi,[wall1]
  803.         jmp     foundtex
  804. ;---------------------------------------------------------------------
  805. align   4
  806. checkmore2:
  807.         cmp     eax,3
  808.         jne     checkmore3
  809.  
  810.         add     edi,[wall2]
  811.         jmp     foundtex
  812. ;---------------------------------------------------------------------
  813. align   4
  814. checkmore3:
  815.         cmp     eax,4
  816.         jne     checkmore4
  817.  
  818.         add     edi,[wall3]
  819.         jmp     foundtex
  820. ;---------------------------------------------------------------------
  821. align   4
  822. checkmore4:
  823.         cmp     eax,5
  824.         jne     checkmore5
  825.  
  826.         add     edi,[wall4]
  827.         jmp     foundtex
  828. ;---------------------------------------------------------------------
  829. align   4
  830. checkmore5:
  831.         cmp     eax,6
  832.         jne     checkmore6
  833.  
  834.         add     edi,[wall5]
  835.         jmp     foundtex
  836. ;---------------------------------------------------------------------
  837. align   4
  838. checkmore6:
  839.         cmp     eax,7
  840.         jne     checkmore7
  841.  
  842.         add     edi,[wall6]
  843.         jmp     foundtex
  844. ;---------------------------------------------------------------------
  845. align   4
  846. checkmore7:
  847.         cmp     eax,8
  848.         jne     checkmore8
  849.  
  850.         add     edi,[wall7]
  851.         jmp     foundtex
  852. ;---------------------------------------------------------------------
  853. align   4
  854. checkmore8:
  855. foundtex:
  856.         mov     edx,[edi]       ; get pixel color inside texture
  857. ; ***pseudoshade south-west
  858. ;       jmp     east    ; activate this for southwest pseudoshade : a bit slower + blink-bug
  859. ;---------------------------------------------------------------------
  860. ;       mov     edi,[yfrac]
  861. ;       mov     [pseudo],dword 0        ; store flag for custom distance darkening
  862. ;       cmp     edi,[xfrac]
  863. ;       jge     east
  864.  
  865. ;       and     edx,0x00FEFEFE
  866. ;       shr     edx,1
  867. ;       mov     [pseudo],dword 1
  868. ;--------------------------------------
  869. east:
  870.         call    dark_distance   ; deactivate wall distance darkening: a bit faster
  871. ; ******* DRAW WALL PIXEL *******
  872.         mov     eax,esi
  873.         lea     eax,[esi-22]
  874.         imul    eax,1920
  875.         mov     ebx,[vx1]
  876.         lea     ebx,[ebx+ebx*2]
  877.         lea     eax,[eax+screen_buffer+ebx]
  878.  
  879.         cmp     eax,screen_buffer+1920*480
  880.         ja      dont_draw
  881.  
  882.         cmp     eax,screen_buffer
  883.         jb      dont_draw
  884.  
  885.         mov     [eax],edx       ; actually set the pixel in the image
  886. ;--------------------------------------
  887. ; *** eo draw wall pixel
  888. dont_draw:
  889.         mov     edi,[remedi]
  890. ;--------------------------------------
  891. speedup:
  892.         cmp     esi,[vbottom]   ; end of this column?
  893.         jg      pixelrow
  894.  
  895.         mov     edi,[vl]        ; restoring
  896.         mov     eax,[vx1]       ; inc X1
  897.         add     eax,1
  898.         mov     [vx1],eax
  899. ;*** NEXT A ***
  900.         mov     esi,[va]
  901.         sub     esi,1
  902.         mov     [va],esi
  903.         cmp     esi,[vacompare]
  904.         jg      for_a
  905. ;*** EO NEXT A ***
  906. ;--------------------------------------
  907. ; **** put image !!!!!****
  908.         xor     edx,edx
  909.         mcall   7,screen_buffer,<640,480>
  910.         ret
  911. ;---------------------------------------------------------------------
  912. align   4
  913. blur:
  914.         pusha
  915.         mov     eax,screen_buffer+360*1920
  916. ;--------------------------------------
  917. align   4
  918. copyfloor2:
  919.         add     eax,1920
  920.         mov     ebx,[vx1]
  921.         lea     ebx,[ebx+ebx*2]
  922.         add     ebx,eax
  923.        
  924.         mov     ecx,[ebx-15]
  925.         and     ecx,0x00FEFEFE
  926.         shr     ecx,1
  927.        
  928.         mov     edx,[ebx-12]
  929.         and     edx,0x00FEFEFE
  930.         shr     edx,1
  931.         add     edx,ecx
  932.         and     edx,0x00FEFEFE
  933.         shr     edx,1
  934.  
  935.         mov     ecx,[ebx-9]
  936.         and     ecx,0x00FEFEFE
  937.         shr     ecx,1
  938.         add     edx,ecx
  939.  
  940.         and     edx,0x00FEFEFE
  941.         shr     edx,1
  942.  
  943.         mov     ecx,[ebx-6]
  944.         and     ecx,0x00FEFEFE
  945.         shr     ecx,1
  946.         add     edx,ecx
  947.  
  948.         and     edx,0x00FEFEFE
  949.         shr     edx,1
  950.  
  951.         mov     ecx,[ebx-3]
  952.         and     ecx,0x00FEFEFE
  953.         shr     ecx,1
  954.         add     edx,ecx
  955.  
  956.         and     edx,0x00FEFEFE
  957.         shr     edx,1
  958.  
  959.         mov     ecx,[ebx]
  960.         and     ecx,0x00FEFEFE
  961.         shr     ecx,1
  962.         add     edx,ecx
  963.  
  964.         mov     [ebx],edx
  965.  
  966.         cmp     eax,screen_buffer+478*1920
  967.         jb      copyfloor2
  968.  
  969.         popa
  970.         ret
  971. ;---------------------------------------------------------------------
  972. ; ******* Darken by Distance *******
  973. align   4
  974. dark_distance:
  975. ; color must be in edx, wall height in [vdd]
  976.         mov     eax,[vdd]
  977.         cmp     eax,50
  978.         jg      nodark
  979. ; split rgb
  980.         mov     [blue_color],edx
  981.         and     [blue_color],dword 255
  982.  
  983.         shr     edx,8
  984.         mov     [green_color],edx
  985.         and     [green_color],dword 255
  986.  
  987.         shr     edx,8
  988.         mov     [red_color],edx
  989.         and     [red_color],dword 255
  990.  
  991.         mov     eax,51  ; darkness parameter
  992.         sub     eax,[vdd]
  993.         cmp     [pseudo],dword 1
  994.         je      isdarkside
  995.  
  996.         sal     eax,2
  997. ;--------------------------------------
  998. align   4
  999. isdarkside:
  1000. ; reduce rgb
  1001.         sub     [red_color],eax
  1002.         cmp     [red_color],dword 0
  1003.         jg      notblack10b
  1004.  
  1005.         mov     [red_color],dword 0
  1006. ;--------------------------------------
  1007. align   4
  1008. notblack10b:
  1009.         sub     [green_color],eax
  1010.         cmp     [green_color],dword 0
  1011.         jg      notblack20b
  1012.  
  1013.         mov     [green_color],dword 0
  1014. ;--------------------------------------
  1015. align   4
  1016. notblack20b:
  1017.         mov     edx,[blue_color]
  1018.         sub     [blue_color],eax
  1019.         cmp     [blue_color],dword 0
  1020.         jg      notblack30b
  1021.  
  1022.         mov     [blue_color],dword 0
  1023. ;--------------------------------------
  1024. align   4
  1025. notblack30b:
  1026.         shl     dword [red_color],16    ; reassemble rgb
  1027.         shl     dword [green_color],8
  1028.         mov     edx,[red_color]
  1029.         or      edx,[green_color]
  1030.         or      edx,[blue_color]
  1031.         mov     eax,edx
  1032. ;--------------------------------------
  1033. align   4
  1034. nodark:
  1035.         ret
  1036. ;---------------------------------------------------------------------
  1037. load_icons:
  1038.         mov     ebx,icons_file_name
  1039.         mov     esi,path
  1040.         mov     edi,file_name
  1041.         call    copy_file_path
  1042.  
  1043.         mov     [fileinfo.subfunction],dword 5
  1044.         mov     [fileinfo.size],dword 0
  1045.         mov     [fileinfo.return],dword file_info
  1046.         mcall   70,fileinfo
  1047.         test    eax,eax
  1048.         jnz     .error
  1049.  
  1050.         mov     [fileinfo.subfunction],dword 0
  1051.  
  1052.         mov     ecx,[file_info+32]
  1053.         mov     [fileinfo.size],ecx
  1054.         mov     [img_size],ecx
  1055.        
  1056.         mcall   68,12
  1057.         test    eax,eax
  1058.         jz      finish  ;memory_get_error
  1059.  
  1060.         mov     [fileinfo.return],eax
  1061.         mov     [image_file],eax
  1062.  
  1063.         mcall   70,fileinfo
  1064.         test    eax,eax
  1065.         jnz     .error
  1066.         ret
  1067. .error:
  1068. ;       mov     [N_error],2
  1069. ;       mov     [error_type],eax
  1070.         jmp     finish
  1071. ;---------------------------------------------------------------------
  1072. copy_file_path:
  1073.         xor     eax,eax
  1074.         cld
  1075. @@:
  1076.         lodsb
  1077.         stosb
  1078.         test    eax,eax
  1079.         jnz     @b
  1080.         mov     esi,edi
  1081.         dec     esi
  1082.         std
  1083. @@:
  1084.         lodsb
  1085.         cmp     al,'/'
  1086.         jnz     @b
  1087.         mov     edi,esi
  1088.         add     edi,2
  1089.         mov     esi,ebx
  1090.         cld
  1091. @@:
  1092.         lodsb
  1093.         stosb
  1094.         test    eax,eax
  1095.         jnz     @b
  1096.         ret
  1097. ;---------------------------------------------------------------------
  1098. convert_icons:
  1099.         xor     eax,eax
  1100.         mov     [return_code],eax
  1101.         push    image_file
  1102.         call    [cnv_png_import.Start]
  1103.  
  1104.         mov     ecx,[image_file]
  1105.         mcall   68,13,
  1106.         test    eax,eax
  1107.         jz      finish  ;memory_free_error
  1108.  
  1109.         cmp     [return_code],dword 0
  1110. ;       je      @f
  1111. ;       mov     [N_error],6
  1112. ;       jmp     button.exit
  1113. ;@@:
  1114.         jne     finish
  1115.  
  1116.         mcall   68,20,ICON_SIZE_X*ICON_SIZE_Y*4*8+44,[raw_pointer]
  1117.         mov     [raw_pointer],eax
  1118.  
  1119.         mov     ebx,[raw_pointer]
  1120. ; set RAW area for icon
  1121.         mov     eax,[ebx+28]
  1122.         add     eax,ebx
  1123.         mov     edi,eax
  1124.         mov     esi,eax
  1125.         add     esi,ICON_SIZE_X*ICON_SIZE_Y*8*3-1
  1126.         add     edi,ICON_SIZE_X*ICON_SIZE_Y*8*4-4
  1127.  
  1128. ;       add     eax,TEX_SIZE
  1129.         mov     [wall0],eax
  1130.         add     eax,TEX_SIZE
  1131.         mov     [wall1],eax
  1132.         add     eax,TEX_SIZE
  1133.         mov     [wall2],eax
  1134.         add     eax,TEX_SIZE
  1135.         mov     [wall3],eax
  1136.         add     eax,TEX_SIZE
  1137.         mov     [wall4],eax
  1138.         add     eax,TEX_SIZE
  1139.         mov     [wall5],eax
  1140.         add     eax,TEX_SIZE
  1141.         mov     [wall6],eax
  1142.         add     eax,TEX_SIZE
  1143.         mov     [wall7],eax
  1144.         add     eax,TEX_SIZE
  1145. ; conversion 24b to 32 b
  1146.         mov     ecx,ICON_SIZE_X*ICON_SIZE_Y*8
  1147.         std
  1148. @@:
  1149.         xor     eax,eax
  1150.         lodsb
  1151.         rol     eax,8
  1152.         lodsb
  1153.         rol     eax,8
  1154.         lodsb
  1155. ;       ror     eax,16
  1156.         stosd
  1157.         dec     ecx
  1158.         jnz     @b
  1159.         cld
  1160.         ret
  1161. ;---------------------------------------------------------------------
  1162. ; DATA AREA
  1163. ;ceil=ceil
  1164. ;wall=wall floor
  1165. ;2 corner stone
  1166. ;3 leaf mosaic
  1167. ;4 closed window
  1168. ;5 greek mosaic
  1169. ;6 old street stones
  1170. ;7 maya wall
  1171. ;---------------------------------------------------------------------
  1172. align   4
  1173. grid:   ; 32*32 Blocks, Map: 0 = Air, 1 to 8 = Wall
  1174. 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
  1175. 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
  1176. 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
  1177. 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
  1178. 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
  1179. 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
  1180. 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
  1181. 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
  1182. 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
  1183. 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
  1184. 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
  1185. 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
  1186. 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
  1187. 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
  1188. 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
  1189. 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
  1190. 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
  1191. 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
  1192. 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
  1193. 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
  1194. 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
  1195. 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
  1196. 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
  1197. 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
  1198. 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
  1199. 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
  1200. 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
  1201. 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
  1202. 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
  1203. 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
  1204. 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
  1205. 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
  1206. ;---------------------------------------------------------------------
  1207. vpx:
  1208.         dd 0x0001FFFF   ; initial player position * 0xFFFF
  1209. vpy:
  1210.         dd 0x0001FFFF
  1211.  
  1212. title   db 'Free3D v0.6 - fisheye raycasting engine etc.',0
  1213.  
  1214. sindegree       dd 0.0
  1215. sininc          dd 0.0017453292519943295769236907684886
  1216. sindiv          dd 6553.5
  1217. ;textures:
  1218. ;file 'texture.gif'
  1219. current_key_code        db 0
  1220. old_key_code            db 0
  1221. extended_key            db 0
  1222. ;---------------------------------------------------------------------
  1223. align   4
  1224. fileinfo:
  1225. .subfunction    dd 5
  1226. .Offset         dd 0
  1227. .Offset_1       dd 0
  1228. .size           dd 0
  1229. .return         dd file_info
  1230.                 db 0
  1231. .name:          dd file_name
  1232. ;---------------------------------------------------------------------
  1233. icons_file_name         db 'texture_24b.png',0
  1234. ;---------------------------------------------------------------------
  1235. plugins_directory       db 0
  1236.  
  1237. ;system_dir_Boxlib      db '/sys/lib/box_lib.obj',0
  1238. system_dir_CnvPNG       db '/sys/lib/cnv_png.obj',0
  1239. ;system_dir_Sort                db '/sys/lib/sort.obj',0
  1240. system_dir_UNPACK       db '/sys/lib/archiver.obj',0
  1241.  
  1242. align   4
  1243. l_libs_start:
  1244. library01       l_libs  system_dir_CnvPNG+9,file_name,system_dir_CnvPNG,\
  1245. cnv_png_import,plugins_directory
  1246.  
  1247. library02       l_libs  system_dir_UNPACK+9,file_name,system_dir_UNPACK,\
  1248. UNPACK_import,plugins_directory
  1249.  
  1250. end_l_libs:
  1251. ;---------------------------------------------------------------------
  1252. align   4
  1253. cnv_png_import:
  1254. .Start          dd aCP_Start
  1255. .Version        dd aCP_Version
  1256. .Check          dd aCP_Check
  1257. .Assoc          dd aCP_Assoc
  1258.         dd 0
  1259.         dd 0
  1260. aCP_Start       db 'START',0
  1261. aCP_Version     db 'version',0
  1262. aCP_Check       db 'Check_Header',0
  1263. aCP_Assoc       db 'Associations',0
  1264. ;---------------------------------------------------------------------
  1265. align   4
  1266. UNPACK_import:
  1267. ;unpack_Version                 dd aUnpack_Version
  1268. ;unpack_PluginLoad              dd aUnpack_PluginLoad  
  1269. ;unpack_OpenFilePlugin          dd aUnpack_OpenFilePlugin
  1270. ;unpack_ClosePlugin             dd aUnpack_ClosePlugin
  1271. ;unpack_ReadFolder              dd aUnpack_ReadFolder  
  1272. ;unpack_SetFolder               dd aUnpack_SetFolder
  1273. ;unpack_GetFiles                dd aUnpack_GetFiles
  1274. ;unpack_GetOpenPluginInfo       dd aUnpack_GetOpenPluginInfo
  1275. ;unpack_Getattr                 dd aUnpack_Getattr
  1276. ;unpack_Open                    dd aUnpack_Open
  1277. ;unpack_Read                    dd aUnpack_Read
  1278. ;unpack_Setpos                  dd aUnpack_Setpos
  1279. ;unpack_Close                   dd aUnpack_Close
  1280. ;unpack_DeflateUnpack           dd aUnpack_DeflateUnpack
  1281. unpack_DeflateUnpack2           dd aUnpack_DeflateUnpack2
  1282.         dd 0
  1283.         dd 0
  1284.  
  1285. ;aUnpack_Version                db 'version',0
  1286. ;aUnpack_PluginLoad             db 'plugin_load',0
  1287. ;aUnpack_OpenFilePlugin         db 'OpenFilePlugin',0
  1288. ;aUnpack_ClosePlugin            db 'ClosePlugin',0
  1289. ;aUnpack_ReadFolder             db 'ReadFolder',0
  1290. ;aUnpack_SetFolder              db 'SetFolder',0
  1291. ;aUnpack_GetFiles               db 'GetFiles',0
  1292. ;aUnpack_GetOpenPluginInfo      db 'GetOpenPluginInfo',0
  1293. ;aUnpack_Getattr                db 'getattr',0
  1294. ;aUnpack_Open                   db 'open',0
  1295. ;aUnpack_Read                   db 'read',0
  1296. ;aUnpack_Setpos                 db 'setpos',0
  1297. ;aUnpack_Close                  db 'close',0
  1298. ;aUnpack_DeflateUnpack          db 'deflate_unpack',0
  1299. aUnpack_DeflateUnpack2          db 'deflate_unpack2',0
  1300.  
  1301. ;---------------------------------------------------------------------
  1302. IM_END:
  1303. ;---------------------------------------------------------------------
  1304. ; not   change  this    section!!!
  1305. ; start section
  1306. ;---------------------------------------------------------------------
  1307. align   4
  1308. image_file      rd 1
  1309. raw_pointer     rd 1
  1310. return_code     rd 1
  1311. img_size        rd 1
  1312. deflate_unpack  rd 1
  1313. raw_pointer_2   rd 1    ;+20
  1314. ;---------------------------------------------------------------------
  1315. ; end   section
  1316. ;---------------------------------------------------------------------
  1317. align   4
  1318. ;---------------------------------------------------------------------
  1319. wall0   rd 1
  1320. wall1   rd 1
  1321. wall2   rd 1
  1322. wall3   rd 1
  1323. wall4   rd 1
  1324. wall5   rd 1
  1325. wall6   rd 1
  1326. wall7   rd 1
  1327. ;screen_buffer  rd 1
  1328. active_process  rd 1
  1329.  
  1330. ;mouse_position         rd 1
  1331. mouse_position_old      rd 1
  1332. ;---------------------------------------------------------------------
  1333. align   4
  1334. col1:
  1335.         dd ?    ;-
  1336. ; misc raycaster vars:
  1337. vxx:
  1338.         dd ?    ;-
  1339. vyy:
  1340.         dd ?    ;-
  1341. vl:
  1342.         dd ?    ;-
  1343. vstepx:
  1344.         dd ?    ;-
  1345. vstepy:
  1346.         dd ?    ;-
  1347. vxxint:
  1348.         dd ?    ;-
  1349. vyyint:
  1350.         dd ?    ;-
  1351. vk:
  1352.         dd ?    ;-
  1353. va:
  1354.         dd ?    ;-
  1355. va2:
  1356.         dd ?    ;-
  1357. vdd:
  1358.         dd ?    ;-
  1359. vx1:
  1360.         dd ?    ;-
  1361. vx1b:
  1362.         dd ?    ;-
  1363. vh:
  1364.         dd ?    ;-
  1365. vdt:
  1366.         dd ?    ;-
  1367. vheading:       ; initial heading: 0 to 3599
  1368.         dd ?    ;-
  1369. vacompare:
  1370.         dd ?    ;-
  1371. vpxi:
  1372.         dd ?    ;-
  1373. vpyi:
  1374.         dd ?    ;-
  1375. wtolong:
  1376.         dw ?,;-,?;-
  1377.  
  1378. xtemp:
  1379.         dd ?    ;-
  1380. ytemp:
  1381.         dd ?    ;-
  1382. xfrac:
  1383.         dd ?    ;-
  1384. yfrac:
  1385.         dd ?    ;-
  1386. h_old:
  1387.         dd ?    ;-
  1388. vbottom:
  1389.         dd ?    ;-
  1390. ;mouseya:
  1391. ;       dd ?    ;-
  1392. remeax:
  1393.         dd ?    ;-
  1394. remebx:
  1395.         dd ?    ;-
  1396. remecx:
  1397.         dd ?    ;-
  1398. remedx:
  1399.         dd ?    ;-
  1400. remedi:
  1401.         dd ?    ;-
  1402. remesi:
  1403.         dd ?    ;-
  1404. red_color:
  1405.         dd ?    ;-
  1406. green_color:
  1407.         dd ?    ;-
  1408. blue_color:
  1409.         dd ?    ;-
  1410. pseudo:
  1411.         dd ?    ;-
  1412. step1:
  1413.         dd ?    ;-
  1414. ;step64:
  1415. ;       dd ?    ;-
  1416. lasty:
  1417.         dd ?    ;-
  1418. ;---------------------------------------------------------------------
  1419. ;I_END:
  1420. IncludeUGlobals
  1421. align   4
  1422. sinus   rd 360*10
  1423. eosinus:
  1424. ;       rd 16*1024*4
  1425. ;---------------------------------------------------------------------
  1426. align   4
  1427.         rb 4096
  1428. stacktop:
  1429. ;---------------------------------------------------------------------
  1430. procinfo:
  1431.         rb 1024
  1432. ;---------------------------------------------------------------------
  1433. path:
  1434.         rb 4096
  1435. ;---------------------------------------------------------------------
  1436. file_name:
  1437.         rb 4096
  1438. ;---------------------------------------------------------------------
  1439. file_info:
  1440.         rb 40
  1441. ;---------------------------------------------------------------------
  1442. screen_buffer:
  1443.         rb 640*480*3 *3/2
  1444. ;---------------------------------------------------------------------
  1445. I_END:
  1446. ;---------------------------------------------------------------------