⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gfxdrawbmp5.pas

📁 一个不出名的GBA模拟器
💻 PAS
字号:
//////////////////////////////////////////////////////////////////////
//                                                                  //
// gfxDrawBMP5.pas: Render metacode for the mode 5 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;
  base, 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;

  // Choose the appropriate framebuffer
  if registers[DISPLAY_CR] and DISPLAY_CR_FB <> 0 then base := DISP_FB1_START else base := DISP_FB0_START;

  // 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 >= 160 shl 8 then dx := dx mod (160 shl 8);
      if dy >= 128 shl 8 then dy := dy and (128 shl 8 - 1);

      if (wins^ and mask <> 0) or ((not latchXparent) and (mclock > 0)) then begin
        pix := Puint16(@(vram[base + (dx shr 8 + (dy shr 8)*160) shl 1]))^;
      {$INCLUDE gfxDrawPixel.pas}

      Inc(dx, a);
      Inc(dy, c);
      Inc(x);
    end;
  end else begin
    while x < 240 do begin
      amVisible := (dx < 160 shl 8) and (dy < 128 shl 8);
      if amVisible and (wins^ and mask <> 0) or ((not latchXparent) and (mclock > 0)) then begin
        pix := Puint16(@(vram[base + (dx shr 8 + (dy shr 8)*160) shl 1]))^;
      {$INCLUDE gfxDrawPixel.pas}

      Inc(dx, a);
      Inc(dy, c);
      Inc(x);
    end;
  end;
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -