📄 gameunit.pas
字号:
//100%
{$ALIGN ON}{$MINENUMSIZE 4}
//This is the game.h file from the GAME directory
// This unit designed to be compatible with both Game and CTF build
// targets. By default unit compiles to GAME build target. To build
// for CTF one should define "CTF" global conditional define.
//Clootie: "Can you change Game.pas to GameUnit.pas (or something like it) -
// because there is "game" global variable in "g_main" (and it's used
// already in some units) - so we have conflicting names."
{----------------------------------------------------------------------------}
{ }
{ File(s): game\game.h }
{ ctf\game.h (if you define CTF) }
{ Content: game dll information visible to server }
{ }
{ Initial conversion by: Gutter (jeanspayette@videotron.ca) }
{ 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: 26-Feb-2002 }
{ Updated by: Carl A Kenner }
{ With sugestions by: Clootie (Alexey Barkovoy) (clootie@reactor.ru) }
{ }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on: }
{ none }
{----------------------------------------------------------------------------}
{ * TODO: }
{ none }
{----------------------------------------------------------------------------}
{ * Note: }
{ 1.) Gutter - On line (120 to 124 and 133 in that file) }
{ argument we passed as '...'. I changed that to arg: array of PChar, }
{ but I am not sure that its right }
{ }
{ CAK - No, it's not the right thing. Then you just have one pointer on }
{ the stack which points to the fist PChar. }
{ What we need to do is declare it as CDECL, and then leave out all the }
{ optional parameters. When we want to read the parameters we will have }
{ to do it manually in Assembly language. And when we want to call the }
{ functions we have to push the parameters on the stack in assembly. }
{ It's annoying, but PASCAL won't do it for us automatically. }
{ }
{ You can use the gi_ functions I added instead to make things easier. }
{ They accept a variable number of parameters in square brackets. }
{----------------------------------------------------------------------------}
Unit GameUnit;
Interface
Uses g_local, q_shared;
Const
GAME_API_VERSION = 3;
// edict->svflags
SVF_NOCLIENT = $00000001; // don't send entity to clients, even if it has effects
SVF_DEADMONSTER = $00000002; // treat as CONTENTS_DEADMONSTER for collision
SVF_MONSTER = $00000004; // treat as CONTENTS_MONSTER for collision
//=======================================
// CAK - THIS PART IS FROM ctf
// BUT NOT game
//=======================================
{$ifdef CTF}
//ZOID
SVF_PROJECTILE = $00000008; // entity is simple projectile, used for network optimization
// if an entity is projectile, the model index/x/y/z/pitch/yaw are sent, encoded into
// seven (or eight) bytes. This is to speed up projectiles. Currently, only the
// hyperblaster makes use of this. use for items that are moving with a constant
// velocity that don't change direction or model
//ZOID
{$endif}
//=======================================
// CAK - THESE WERE TAKEN FROM HERE AND MOVED TO g_local
// edict->solid values
type
solid_t = g_local.solid_t;
solid_p = g_local.solid_p;
psolid_t = g_local.psolid_t;
TSolid = g_local.TSolid;
PSolid = g_local.Psolid;
solid_at = g_local.solid_at;
solid_a = g_local.solid_a;
TSolidArray = g_local.TSolidArray;
PSolidArray = g_local.PSolidArray;
//===============================================================
// CAK - THESE WERE TAKEN FROM HERE AND MOVED TO g_local
// link_t is only used for entity area links now
type
link_s = g_local.link_s;
link_t = g_local.link_t;
link_p = g_local.link_p;
link_at = g_local.link_at;
link_a = g_local.link_a;
TLinkArray = g_local.TLinkArray;
PLinkArray = g_local.PLinkArray;
// CAK - THIS WAS TAKEN FROM HERE AND MOVED TO g_local
const
MAX_ENT_CLUSTERS = g_local.MAX_ENT_CLUSTERS;
//===============================================================
type
{$define GAME_INCLUDE}
{$ifndef GAME_INCLUDE}
// CAK - this is the stupid small version of gclient_t and edict_t
gclient_p = ^gclient_t;
pgclient_s = gclient_p;
gclient_s = record
ps: player_state_t; // communicated by server to clients
ping: Integer;
// the game dll can add anything it wants after
// this point in the structure
end;
gclient_t = gclient_s;
pgclient_t = gclient_p;
TGClient = gclient_t;
PGClient = gclient_p;
gclient_at = array[0..MaxInt div sizeof(gclient_t)-1] of gclient_t;
gclient_a = ^gclient_at;
TGClientArray = gclient_at;
PGClientArray = gclient_a;
edict_p = ^edict_t;
pedict_s = edict_p;
edict_s = record
s: entity_state_t;
client: gclient_p;
inuse: qboolean;
linkcount: Integer;
// FIXME: move these fields to a server private sv_entity_t
area: link_t; // linked to a division node or leaf
num_clusters: Integer; // if -1, use headnode instead
clusternums : Array[0..MAX_ENT_CLUSTERS-1] of Integer; // CAK - Did -1
headnode: Integer; // unused if num_clusters != -1
areanum,
areanum2: Integer;
//================================
svflags: Integer; // SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc
mins, maxs: vec3_t;
absmin, absmax, size: vec3_t;
solid: solid_t;
clipmask: Integer;
owner: edict_p;
// the game dll can add anything it wants after
// this point in the structure
end;
edict_t = edict_s;
pedict_t = edict_p;
_edict_s = edict_t;
p_edict_s = edict_p;
TEdict = edict_t;
PEdict = edict_p;
edict_at = array [0..MaxInt div SizeOf(edict_t)-1] of edict_t;
edict_a = ^edict_at;
TEdictArray = edict_at;
PEdictArray = edict_a;
// CAK - These two types are thanks to Clootie
// Note - This is an array of POINTERS,
// Most places you should use an array of RECORDS
PEdictPArray = ^TEdictPArray;
TEdictPArray = array [0..MaxInt div SizeOf(edict_p)-1] of edict_p;
{$ELSE}
gclient_p = g_local.gclient_p;
gclient_s = g_local.gclient_s;
gclient_t = g_local.gclient_t;
_gclient_s = g_local._gclient_s;
pgclient_s = g_local.pgclient_s;
pgclient_t = g_local.pgclient_t;
p_gclient_s = g_local.p_gclient_s;
TGClient = g_local.TGClient;
PGClient = g_local.PGClient;
gclient_at = g_local.gclient_at;
gclient_a = g_local.gclient_a;
TGClientArray = g_local.TGClientArray;
PGClientArray = g_local.PGClientArray;
edict_p = g_local.edict_p;
edict_s = g_local.edict_s;
edict_t = g_local.edict_t;
edict_at = g_local.edict_at;
edict_a = g_local.edict_a;
TEdictArray = g_local.TEdictArray;
PEdictArray = g_local.PEdictArray;
// CAK - These two types are thanks to Clootie
// Note - This is an array of POINTERS,
// Most places you should use an array of RECORDS
PEdictPArray = g_local.PEdictPArray;
TEdictPArray = g_local.TEdictPArray;
Tarea_list = array[0..0] of edict_t;
Parea_list = ^Tarea_list;
PParea_list = ^Parea_list;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -