////////////////////////////////////////////////////////////////////// // // // gfxDrawBMP3.pas: Render metacode for the mode 3 framebuffer // // // // The contents of this file are subject to the Bottled Light // // Public License Version 1.0 (the "License"); you may not use this // // file except in compliance with the License. You may obtain a // // copy of the License at http://www.bottledlight.com/BLPL/ // // // // Software distributed under the License is distributed on an // // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or // // implied. See the License for the specific language governing // // rights and limitations under the License. // // // // The Original Code is the Mappy VM Core, released April 1st, 2003 // // The Initial Developer of the Original Code is Bottled Light, // // Inc. Portions created by Bottled Light, Inc. are Copyright // // (C) 2001 - 2003 Bottled Light, Inc. All Rights Reserved. // // // // Author(s): // // Michael Noland (joat), michael@bottledlight.com // // // // Changelog: // // 1.0: First public release (April 1st, 2003) // // // ////////////////////////////////////////////////////////////////////// var x: integer; pix: uint16; a, c, cx, cy: uint32; dx, dy: uint32; wrap: boolean; amVisible: boolean; {$INCLUDE gfxDrawPixelInc.pas} wrap := CR and RS_BG_WRAP <> 0; // Read the coords a := params.a; c := params.c; dx := params.cx; dy := params.cy; // Render the screen x := 0; if wrap then begin while x < 240 do begin // Wrap the position around // eew: mod's in an innerloop, I must be crazy if dx >= 240 shl 8 then dx := dx mod (240 shl 8); if dy >= 160 shl 8 then dy := dy mod (160 shl 8); if (wins^ and mask <> 0) or ((not latchXparent) and (mclock > 0)) then begin pix := Puint16(@(vram[(dx shr 8 + (dy shr 8)*240) shl 1]))^; {$INCLUDE gfxDrawPixel.pas} Inc(dx, a); Inc(dy, c); Inc(x); end; end else begin while x < 240 do begin amVisible := (dx < 240 shl 8) and (dy < 160 shl 8); if amVisible and (wins^ and mask <> 0) or ((not latchXparent) and (mclock > 0)) then begin pix := Puint16(@(vram[(dx shr 8 + (dy shr 8)*240) shl 1]))^; {$INCLUDE gfxDrawPixel.pas} Inc(dx, a); Inc(dy, c); Inc(x); end; end; end;