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

📄 ref.inc

📁 雷神之锤2(Quake2)Delphi源码
💻 INC
字号:

// PLEASE, don't modify this file
// 50% complete


My current problems:
--------------------
1) C-code:
   typedef struct
   {
           void	(*Shutdown) (void);
           void	( *RenderFrame) (refdef_t *fd);
   }refexport_t

   PAS-code:
   type
     refexport_t = record
       Shutdown : procedure;
       R_RenderFrame : procedure (refdef_t *fd);
     end;

   OR

   PAS-code:
   type
     refexport_t = record
       Shutdown : procedure;                     stdcall;
       R_RenderFrame : procedure (refdef_t *fd); stdcall;
     end;


2) This is COMMON problem:

   C-code: byte *Var_A;
   PAS1:   Var_A : PByte;
   PAS2:   Var_A : PByteArray; //PByteArray = array [0..0] of byte;
   PAS3:   Var_A : PByteArray; //PByteArray = array of byte;


3) Proc & Func in ref.inc(refexport_t) & gl_rmain.pas(refexport_t) - PROBABLY EQUAL!!!
4) refimport_t ??? - line 254  (vid_null.c: VID_Init())


5) ADD info: 1) ../qcommon/qcommon.inc
             2) ../null/vid_null.inc - ???
6) OK!


{----------------------------------------------------------------------------}
{                                                                            }
{ File(s): ref.h                                                             }
{                                                                            }
{ Initial conversion by : YgriK (Igor Karpov) - glYgriK@hotbox.ru            }
{ Initial conversion on : 17-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 :                                                               }
{ Updated by :                                                               }
{                                                                            }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on:                               }
{ 1) ../qcommon/qcommon.inc                                                  }
{ 2) ../null/vid_null.inc -???                                               }
{                                                                            }
{----------------------------------------------------------------------------}
{ * TODO:                                                                    }
{ 1) Do more tests                                                           }
{                                                                            }
{----------------------------------------------------------------------------}

{$I ../qcommon/qcommon.inc}
{$I ../null/vid_null.inc} // -???                                               

const
  MAX_DLIGHTS	    = 32;
  MAX_ENTITIES	    = 128;
  MAX_PARTICLES	    = 4096;
  MAX_LIGHTSTYLES   = 256;

  POWERSUIT_SCALE   = 4.0;

  SHELL_RED_COLOR   = $F2;
  SHELL_GREEN_COLOR = $D0;
  SHELL_BLUE_COLOR  = $F3;

  SHELL_RG_COLOR    = $DC;
//#define SHELL_RB_COLOR		0x86
  SHELL_RB_COLOR    = $68;
  SHELL_BG_COLOR    = $78;

//ROGUE
  SHELL_DOUBLE_COLOR   = $DF; // 223
  SHELL_HALF_DAM_COLOR = $90;
  SHELL_CYAN_COLOR     = $72;
//ROGUE

  SHELL_WHITE_COLOR    = $D7;

type
  entity_s = record
	struct model_s		*model;			// opaque type outside refresh
    angles : array [0..2] of float;

    {*
     ** most recent data
     *}
    origin : array [0..2] of float;     // also used as RF_BEAM's "from"
    frame  : integer;		        // also used as RF_BEAM's diameter

    {*
    ** previous data for lerping
    *}
    oldorigin : array [0..2] of float;  // also used as RF_BEAM's "to"
    oldframe  : integer;

    {*
    ** misc
    *}
    backlerp : float;			// 0.0 = current, 1.0 = old
    skinnum  : integer;			// also used as RF_BEAM's palette index

    lightstyle : integer;		// for flashing entities
    alpha      : float;			// ignore if RF_TRANSLUCENT isn't set

	struct image_s	*skin;			// NULL for inline skin
    flags : integer;
  end;
  entity_t = entity_s;

const
  ENTITY_FLAGS = 68;

type
  dlight_t = record
    origin    : vec3_t;
    color     : vec3_t;
    intensity : float;
  end;

  particle_t = record
    origin : vec3_t;
    color  : integer;
    alpha  : float;
  end;

  lightstyle_t = record
    rgb   : array [0..2] of float;  // 0.0 - 2.0
    white : float;		    // highest of rgb
  end;

  refdef_t = record
    x, y, width, height  : integer;                // in virtual screen coordinates
    fov_x, fov_y         : float;
    vieworg              : array [0..2] of float;
    viewangles           : array [0..2] of float;
    blend                : array [0..3] of float;  // rgba 0-1 full screen blend
    time                 : float;		   // time is uesed to auto animate
    rdflags              : integer;		   // RDF_UNDERWATER, etc

	byte		*areabits;	// if not NULL, only areas with set bits will be drawn

	lightstyle_t	*lightstyles;  // [MAX_LIGHTSTYLES]

    num_entities : integer;
	entity_t	*entities;

    num_dlights : integer;
	dlight_t	*dlights;

    num_particles : integer;
	particle_t	*particles;
  end;

const
  API_VERSION = 3;

//
// these are the functions exported by the refresh module
//
type
  refexport_t = record //{Y}: gl_main.c
    // if api_version is different, the dll cannot be used
    api_version : integer;

    // called when the library is loaded
    Init : function ( void *hinstance, void *wndproc ) : qboolean; //{Y} mismatch - R_Init

    // called before the library is unloaded
    Shutdown : procedure;

    // All data that will be used in a level should be
    // registered before rendering any frames to prevent disk hits,
    // but they can still be registered at a later time
    // if necessary.
    //
    // EndRegistration will free any remaining data that wasn't registered.
    // Any model_s or skin_s pointers from before the BeginRegistration
    // are no longer valid after EndRegistration.
    //
    // Skins and images need to be differentiated, because skins
    // are flood filled to eliminate mip map edge errors, and pics have
    // an implicit "pics/" prepended to the name. (a pic name that starts with a
    // slash will not use the "pics/" prefix or the ".pcx" postfix)
    BeginRegistration : procedure (char *map);  //gl_model.c
    struct model_s *( *RegisterModel) (char *name);  //gl_model.c
    struct image_s *( *RegisterSkin) (char *name);  //gl_image.c
    struct image_s *( *RegisterPic) (char *name);   //gl_draw.c: Draw_FindPic   image_t
    SetSky            : procedure (char *name, rotate : float; axis : vec3_t); //gl_warp: R_SetSky
    EndRegistration   : procedure;  //gl_model.c

    RenderFrame : procedure (refdef_t *fd);

    DrawGetPicSize : procedure (int *w, int *h, char *name);  // will return 0 0 if not found    //gl_draw: Draw_GetPicSize
    DrawPic        : procedure (int x, int y, char *name); //gl_draw: Draw_Pic
    DrawStretchPic : procedure (int x, int y, int w, int h, char *name); //gl_draw: Draw_StretchPic
    DrawChar       : procedure (int x, int y, int c); //gl_draw: Draw_Char
    DrawTileClear  : procedure (int x, int y, int w, int h, char *name); //gl_draw: Draw_TileClear
    DrawFill       : procedure (int x, int y, int w, int h, int c); //gl_draw: Draw_Fill
    DrawFadeScreen : procedure; //gl_draw: Draw_FadeScreen

    // Draw images for cinematic rendering (which can have a different palette). Note that calls
    DrawStretchRaw : procedure (int x, int y, int w, int h, int cols, int rows, byte *data); //gl_draw: Draw_StretchRaw

    {*
    ** video mode and refresh state management entry points
    *}
    CinematicSetPalette : procedure (const unsigned char *palette);  // NULL = game palette
    BeginFrame          : procedure (camera_separation : float);
    EndFrame            : procedure; //glw_imp: GLimp_EndFrame

    AppActivate : procedure (activate : qboolean); //glw_imp: GLimp_AppActivate
  end;

//
// these are the functions imported by the refresh module
//
  refimport_t = record //{Y}: vid_null.c
//	void	( *Sys_Error) (int err_level, char *str, ...);
Sys_Error : procedure (err_level : integer; str : PChar, ...);

	void	( *Cmd_AddCommand) (char *name, void( *cmd)(void));
	void	( *Cmd_RemoveCommand) (char *name);
	int		( *Cmd_Argc) (void);
	char	*( *Cmd_Argv) (int i);
	void	( *Cmd_ExecuteText) (int exec_when, char *text);

//	void	( *Con_Printf) (int print_level, char *str, ...);
Con_Printf : procedure (print_level : integer; str : PChar, ...);
//??? 3-params (3 &4 : integer; 5 - PChar)

	// files will be memory mapped read only
	// the returned buffer may be part of a larger pak file,
	// or a discrete file from anywhere in the quake search path
	// a -1 return means the file does not exist
	// NULL can be passed for buf to just determine existance
	int		( *FS_LoadFile) (char *name, void **buf);
	void	( *FS_FreeFile) (void *buf);

	// gamedir will be the current directory that generated
	// files should be stored to, ie: "f:\quake\id1"
	char	*( *FS_Gamedir) (void);

//	cvar_t	*( *Cvar_Get) (char *name, char *value, int flags);
Cvar_Get : function (name, value : PChar; flags : integer) : cvar_t;
	cvar_t	*( *Cvar_Set)( char *name, char *value );
//	void	 ( *Cvar_SetValue)( char *name, float value );
Cvar_SetValue : procedure (name : PChar; value : float);

//	qboolean	( *Vid_GetModeInfo)( int *width, int *height, int mode );
Vid_GetModeInfo : functio (var width, height : integer; mode : integer) : qboolean;
	void		( *Vid_MenuInit)( void );
//	void		( *Vid_NewWindow)( int width, int height );
Vid_NewWindow : procedure (width, height : integer);
  end;

(*// this is the only function actually exported at the linker level
typedef	refexport_t	( *GetRefAPI_t) (refimport_t);*)

// End of file

⌨️ 快捷键说明

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