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

📄 r_local.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 2 页
字号:
//100%
{$ALIGN 8}{$MINENUMSIZE 4}
{----------------------------------------------------------------------------}
{                                                                            }
{ File(s): r_local.h                                                         }
{                                                                            }
{ Initial conversion by : Clairebear (clairebear69@ntlworld.com)             }
{ Initial conversion on : 10-Jan-2002                                        }
{                                                                            }
{ This File contains part of convertion of Quake2 source to ObjectPascal.    }
{ More information about this project can be found at:                       }
{ http://www.sulaco.co.za/quake2/                                            }
{                                                                            }
{ Copyright (C) 1997-2001 Id Software, Inc.                                  }
{                                                                            }
{ This program is free software; you can redistribute it and/or              }
{ modify it under the terms of the GNU General Public License                }
{ as published by the Free Software Foundation; either version 2             }
{ of the License, or (at your option) any later version.                     }
{                                                                            }
{ This program is distributed in the hope that it will be useful,            }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of             }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                       }
{                                                                            }
{ See the GNU General Public License for more details.                       }
{                                                                            }
{----------------------------------------------------------------------------}
{ Updated on : 25-Feb-2002                                                   }
{ Updated by : Carl Kenner (carl_kenner@hotmail.com)                         }
{                                                                            }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on:                               }
{ none                                                                       }
{----------------------------------------------------------------------------}
{ * TODO:                                                                    }
{ work out what to do with those externs                                     }
{----------------------------------------------------------------------------}

unit r_local;

// There's no C file to go with this header.
// All "extern" variables and functions have been commented out and are
// highlighted with my initials.
// Records not defined as Packed (deliberately!)
// Added uses for types not defined in this unit.
// All original comments retained. Added initials to any comments of mine
// Some types are defined in both r_model and gl_model. I tried to find out
// which one I should include, but no indication. Probs can be found in make
// file.
// CAK - You should include r_model, which I have done below
// the two engines are not supposed to be mixed

interface

uses
  Windows, // CAK - needed for Delphi 3
  q_shared,
  qfiles, // CHANGED FROM Q_FILES BY CARL KENNER (CAK)
  r_model,
  ref;

const
  REF_VERSION = 'SOFT 0.01';

// up / down
const
  PITCH = 0;

// left / right
const
  YAW = 1;

// fall over
const
  ROLL = 2;

/////////// CAK - MOVED TO r_model.h
(*

  skins will be outline flood filled and mip mapped
  pics and sprites with alpha will be outline flood filled
  pic won't be mip mapped

  model skin
  sprite frame
  wall texture
  pic

*)

type
  vec5_arr = array[0..MaxInt div SizeOf(vec5_t) - 1] of vec5_t;
  vec5_arrp = ^vec5_arr;

  lightstyle_arr = array[0..MaxInt div SizeOf(lightstyle_t) - 1] of lightstyle_t;
  lightstyle_arrp = ^lightstyle_arr;

  dlight_arr = array[0..MaxInt div SizeOf(dlight_t) - 1] of dlight_t;
  dlight_arrp = ^dlight_arr;

  dmdl_arr = array[0..MaxInt div SizeOf(dmdl_t) - 1] of dmdl_t;
  dmdl_arrp = ^dmdl_arr;

type
  imagetype_p = r_model.imagetype_p;
  imagetype_t = r_model.imagetype_t;

  image_p = r_model.image_p;
  image_t = r_model.image_t;

//===================================================================
  pixel_t = Byte;
  pixel_p = PByte;

  vrect_p = ^vrect_t;
  vrect_t = record
    x, y, width, height: Integer;
    pnext: vrect_p;
  end;

  viddef_p = ^viddef_t;
  viddef_t = record
    buffer: pixel_p; // invisible buffer
    colormap: pixel_p; // 256 * VID_GRADES size
    alphamap: pixel_p; // 256 * 256 translucency map
    rowbytes: integer; // may be > width if displayed in a window
         // can be negative for stupid dibs
    width: integer;
    height: integer;
  end;

  rserr_p = ^rserr_t;
  rserr_t = (
    rserr_ok,
    rserr_invalid_fullscreen,
    rserr_invalid_mode,
    rserr_unknown
    );

// !!! if this is changed, it must be changed in asm_draw.h too !!!
type
  oldrefdef_p = ^oldrefdef_t;
  oldrefdef_t = record
    vrect: vrect_t; // subwindow in video for refresh
                    // FIXME: not need vrect next field here?
    aliasvrect: vrect_t; // scaled Alias version
    vrectright, vrectbottom: integer; // right & bottom screen coords
    aliasvrectright, aliasvrectbottom: integer; // scaled Alias versions
    vrectrightedge: Single; // rightmost right edge we care about,
       // for use in edge list
    fvrectx, fvrecty: single; // for floating-point compares
    fvrectx_adj, fvrecty_adj: single; // left and top edges, for clamping
    vrect_x_adj_shift20: integer; // (vrect.x + 0.5 - epsilon) << 20
    vrectright_adj_shift20: integer; // (vrectright + 0.5 - epsilon) << 20
    fvrectright_adj, fvrectbottom_adj: single;
                                 // right and bottom edges, for clamping
    fvrectright: single; // rightmost edge, for Alias clamping
    fvrectbottom: single; // bottommost edge, for Alias clamping
    horizontalFieldOfView: single; // at Z = 1.0, this many X is visible
                                    // 2.0 = 90 degrees
    xOrigin: single; // should probably always be 0.5
    yOrigin: single; // between be around 0.3 to 0.5

    vieworg: vec3_t;
    viewangles: vec3_t;

    ambientlight: integer;
  end;

const
  CACHE_SIZE = 32;

(*
====================================================

  CONSTANTS

====================================================
*)

const
  VID_CBITS = 6;
const
  VID_GRADES = (1 shl VID_CBITS);

// r_shared.h: general refresh-related stuff shared between the refresh and the
// driver

const
  MAXVERTS = 64; // max points in a surface polygon
const
  MAXWORKINGVERTS = (MAXVERTS + 4); // max points in an intermediate
           //  polygon (while processing)
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
const
  MAXHEIGHT = 1200;
const
  MAXWIDTH = 1600;

const
  INFINITE_DISTANCE = $10000; // distance that's always guaranteed to
                                  //  be farther away than anything in
                                  //  the scene

// d_iface.h: interface header file for rasterization driver modules

const
  WARP_WIDTH = 320;
const
  WARP_HEIGHT = 240;

const
  MAX_LBM_HEIGHT = 480;

const
  PARTICLE_Z_CLIP = 8.0;

// !!! must be kept the same as in quakeasm.h !!!
const
  TRANSPARENT_COLOR = $FF;

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
const
  TURB_TEX_SIZE = 64; // base turbulent texture size

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
const
  CYCLE = 128; // turbulent cycle size

const
  SCANBUFFERPAD = $1000;

const
  DS_SPAN_LIST_END = -128;

const
  NUMSTACKEDGES = 2000;
const
  MINEDGES = NUMSTACKEDGES;
const
  NUMSTACKSURFACES = 1000;
const
  MINSURFACES = NUMSTACKSURFACES;
const
  MAXSPANS = 3000;

// flags in finalvert_t.flags
const
  ALIAS_LEFT_CLIP = $0001;
const
  ALIAS_TOP_CLIP = $0002;
const
  ALIAS_RIGHT_CLIP = $0004;
const
  ALIAS_BOTTOM_CLIP = $0008;
const
  ALIAS_Z_CLIP = $0010;
const
  ALIAS_XY_CLIP_MASK = $000F;

const
  SURFCACHE_SIZE_AT_320X240 = 1024 * 768;

const
  BMODEL_FULLY_CLIPPED = $10; // value returned by R_BmodelCheckBBox ()
                                  //  if bbox is trivially rejected

const
  XCENTERING = (1.0 / 2.0);
const
  YCENTERING = (1.0 / 2.0);

const
  CLIP_EPSILON = 0.001;

const
  BACKFACE_EPSILON = 0.01;

// !!! if this is changed, it must be changed in asm_draw.h too !!!
const
  NEAR_CLIP = 0.01;

const
  MAXALIASVERTS = 2000; // TODO: tune this
const
  ALIAS_Z_CLIP_PLANE = 4;

⌨️ 快捷键说明

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