TEXTURE.TXT

Full screen texturing:
It runs full screen (320x200) at 70 frames/second on a 486DX-66 Local Bus or
even larger areas.
It runs at about half screen (200x120 or so) on a 486DX-33 without Local Bus
or at 35 frames/second full screen.
(and looks alot better than in 2nd Reality =)
BTW, this was coded quite a time before that; but couldn't be released
earlier due to upload problems (fuck the sysops!)

                                       coded by ¤The Faker« / AARDVARK

Feel free to use this in your productions - Feel free to credit me  =)

Notes: This is the same routine as in TEXTURE.PAS except that the 'db 66h'
(386er opcodes) are replaced. That may be also useful for ASM-only programmers.

PROCEDURE PutTexture(IncX,IncY:Integer; P:Pointer);
VAR
   Y,PosX,PosY,PX,PY:Integer;
BEGIN
     PosX:=-(ScreenX SHR 1)*IncX;   { ScreenX,-Y are size of screen; PosX,-Y }
     PosY:=-(ScreenY SHR 1)*IncY;   { are set so rotation is around middle }
     FOR Y:=0 TO ScreenY-1 DO
     BEGIN
          PX:=PosX;   { PosX,-Y is updated every line, PX,-Y taken from those }
          PY:=PosY;
          ASM
             push ds
             mov ax,0a000h
             mov es,ax
             mov ax,y
             xchg al,ah
             mov di,ax
             shr di,2
             add di,ax
             lds si,p   { in P there should be a 256x256 bitmap }
             mov cx,screenx shr 1
             cld
             mov ax,incx
             shl eax,16
             mov ax,incy
             mov esi,eax
             mov dx,px
             shl edx,16
             mov dx,py
@1:          add edx,esi
             mov ebx,edx
             shr ebx,16
             mov bl,dh
             mov al,[bx]
             add edx,esi
             mov ebx,edx
             shr ebx,16
             mov bl,dh
             mov ah,[bx]
             stosw
             dec cx
             jnz @1
             pop ds
          END;
          Inc(PosX,IncY);
          Inc(PosY,-IncX);
     END;
END;