Subversion Repositories Kolibri OS

Rev

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