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

📄 r_local.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 2 页
字号:
// turbulence stuff

const
  AMP = 8 * $10000;
const
  AMP2 = 3;
const
  SPEED = 20;

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

TYPES

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

type
  emitpoint_p = ^emitpoint_t;
  emitpoint_t = record
    u, v: Single;
    s, t: Single;
    zi: single;
  end;
  emitpoint_arr = array[0..MaxInt div SizeOf(emitpoint_t) - 1] of emitpoint_t;
  emitpoint_arrp = ^emitpoint_arr;
(*
** if you change this structure be sure to change the #defines
** listed after it!
*)
{$UNDEF SMALL_FINALVERT} // cnh 08/jan/2002, used undef here, cos no equiv of c code

{$IFDEF SMALL_FINALVERT}

type
  finalvert_p = ^finalvert_t;
  finalvert_t = record
    u, v, s, t: smallint;
    l: integer;
    zi: integer;
    flags: integer;
    xyz: array[0..2] of single; // eye space
  end;

const
  FINALVERT_V0 = 0;
const
  FINALVERT_V1 = 2;
const
  FINALVERT_V2 = 4;
const
  FINALVERT_V3 = 6;
const
  FINALVERT_V4 = 8;
const
  FINALVERT_V5 = 12;
const
  FINALVERT_FLAGS = 16;
const
  FINALVERT_X = 20;
const
  FINALVERT_Y = 24;
const
  FINALVERT_Z = 28;
const
  FINALVERT_SIZE = 32;

{$ELSE}

type
  finalvert_p = ^finalvert_t;
  finalvert_t = record
    u, v, s, t: integer;
    l: integer;
    zi: integer;
    flags: integer;
    xyz: array[0..2] of single; // eye space
  end;
  finalvert_arr = array[0..MaxInt div SizeOf(finalvert_t) - 1] of finalvert_t;
  finalvert_arrp = ^finalvert_arr;

const
  FINALVERT_V0 = 0;
const
  FINALVERT_V1 = 4;
const
  FINALVERT_V2 = 8;
const
  FINALVERT_V3 = 12;
const
  FINALVERT_V4 = 16;
const
  FINALVERT_V5 = 20;
const
  FINALVERT_FLAGS = 24;
const
  FINALVERT_X = 28;
const
  FINALVERT_Y = 32;
const
  FINALVERT_Z = 36;
const
  FINALVERT_SIZE = 40;

{$ENDIF}

type
  affinetridesc_p = ^affinetridesc_t;
  affinetridesc_t = record
    pskin: pointer;
    pskindesc: integer;
    skinwidth: integer;
    skinheight: integer;
    ptriangles: dtriangle_p;
    pfinalverts: finalvert_p;
    numtriangles: integer;
    drawtype: integer;
    seamfixupX16: integer;
    do_vis_thresh: qboolean;
    vis_thresh: integer;
  end;

  drawsurf_p = ^drawsurf_t;
  drawsurf_t = record
    surfdat: pByte; // destination for generated surface
    rowbytes: integer; // destination logical width in bytes
    surf: msurface_p; // description for surface to generate
    lightadj: array[0..MAXLIGHTMAPS - 1] of fixed8_t;
                     // adjust for lightmap levels for dynamic lighting
    image: image_p;
    surfmip: integer; // mipmapped ratio of surface texels / world pixels
    surfwidth: integer; // in mipmapped texels
    surfheight: integer; // in mipmapped texels
  end;

  alight_p = ^alight_t;
  alight_t = record
    ambientlight: integer;
    shadelight: integer;
    plightvec: pSingle;
  end;

// clipped bmodel edges
  bedge_p = ^bedge_t;
  bedge_t = record
    v: array[0..1] of mvertex_p;
    pnext: bedge_p;
  end;
  TBedge_tArray = array[0..MaxInt div SizeOf(bedge_t) - 1] of bedge_t;
  PBedge_tArray = ^TBedge_tArray;

// !!! if this is changed, it must be changed in asm_draw.h too !!!
  clipplane_p = ^clipplane_t;
  clipplane_t = record
    normal: vec3_t;
    dist: single;
    next: clipplane_p;
    leftedge: byte;
    rightedge: byte;
    reserved: array[0..1] of byte;
  end;

// !!! if this is changed, it must be changed in asm_draw.h too !!!
  espan_p = ^espan_t;
  espan_t = record
    u, v, count: integer;
    pNext: espan_p;
  end;
  TEspan_tArray = array[0..MaxInt div SizeOf(espan_t) - 1] of espan_t;
  PEspan_tArray = ^TEspan_tArray;

// used by the polygon drawer (R_POLY.C) and sprite setup code (R_SPRITE.C)
  polydesc_p = ^polydesc_t;
  polydesc_t = record
    nump: integer;
    pverts: emitpoint_p;
    pixels: PByte; // image
    pixel_width: integer; // image width
    pixel_height: integer; // image height
    vup, vright, vpn: vec3_t; // in worldspace, for plane eq
    dist: single;
    s_offset: single;
    t_offset: single;
    viewer_position: array[0..2] of single;
    drawspanlet: procedure; cdecl;
    stipple_parity: integer;
  end;

// FIXME: compress, make a union if that will help
// insubmodel is only 1, flags is fewer than 32, spanstate could be a byte
  surf_p = ^surf_t;
  surf_t = record
    next: surf_p; // active surface stack in r_edge.c
    prev: surf_p; // used in r_edge.c for active surf stack
    spans: espan_p; // pointer to linked list of spans to draw
    key: integer; // sorting key (BSP order)
    last_u: integer; // set during tracing
    spanstate: integer; // 0 = not in span
                                       // 1 = in span
                                       // -1 = in inverted span (end before
                                       //  start)
    flags: integer; // currentface flags
    msurf: msurface_p;
    entity: entity_p;
    nearzi: single; // nearest 1/z on surface, for mipmapping
    insubmodel: Boolean;
    d_ziorigin: single;
    d_zistepu: single;
    d_zistepv: single;

    pad: array[0..1] of integer; // to 64 bytes
  end;
  TSurf_tArray = array[0..MaxInt div SizeOf(surf_t) - 1] of surf_t;
  PSurf_tArray = ^TSurf_tArray;

// !!! if this is changed, it must be changed in asm_draw.h too !!!
  edge_p = ^edge_t;
  edge_t = record
    u: fixed16_t;
    u_step: fixed16_t;
    prev: edge_p;
    next: edge_p;
    surfs: array[0..1] of Word;
    nextremove: edge_p;
    nearzi: single;
    owner: medge_p;
  end;
  TEdge_tArray = array[0..MaxInt div SizeOf(edge_t) - 1] of edge_t;
  PEdge_tArray = ^TEdge_tArray;

  aliastriangleparms_p = ^aliastriangleparms_t;
  paliastriangleparms_t = aliastriangleparms_p;
  aliastriangleparms_t = record
    a, b, c: finalvert_p;
  end;
  TAliasTriangleParms = aliastriangleparms_t;
  PAliasTriangleParms = aliastriangleparms_p;

  swstate_p = ^swstate_t;
  swstate_t = record
    fullscreen: boolean;
    prev_mode: integer; // last valid SW mode

    gammatable: array[0..255] of byte;
    currentpalette: array[0..1023] of byte;
  end;

implementation

uses
  r_main, // to gain access to the ri variable.
  SysUtils; //For Exception Handling Only (Assertions)

procedure ri_Sys_Error(err_level: Integer; Fmt: string; const Args: array of const);
var
  Buffer: array[0..9999] of Char;
begin
  Com_Sprintf(Buffer, sizeof(Buffer), PChar(Fmt), Args);
  ri.Sys_Error(err_level, Buffer);
end;

initialization
// Check the size of types defined in r_local.h
  Assert(sizeof(imagetype_t) = 4);
  Assert(sizeof(image_t) = 100);
  Assert(sizeof(pixel_t) = 1);
  Assert(sizeof(vrect_t) = 20);
  Assert(sizeof(viddef_t) = 24);
  Assert(sizeof(rserr_t) = 4);
  Assert(sizeof(oldrefdef_t) = 140);
  Assert(sizeof(emitpoint_t) = 20);
  Assert(sizeof(finalvert_t) = 40);
  Assert(sizeof(affinetridesc_t) = 44);
  Assert(sizeof(drawsurf_t) = 44);
  Assert(sizeof(alight_t) = 12);
  Assert(sizeof(bedge_t) = 12);
  Assert(sizeof(clipplane_t) = 24);
  Assert(sizeof(surfcache_t) = 52);
  Assert(sizeof(espan_t) = 16);
  Assert(sizeof(polydesc_t) = 88);
  Assert(sizeof(surf_t) = 64);
  Assert(sizeof(edge_t) = 32);
  Assert(sizeof(aliastriangleparms_t) = 12);
  Assert(sizeof(swstate_t) = 1288);
end.

⌨️ 快捷键说明

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