📄 g_local.pas
字号:
{$DEFINE CTF}
//100%
{$ALIGN ON}{$MINENUMSIZE 4}
{----------------------------------------------------------------------------}
{ }
{ File(s): game\g_local.h }
{ ctf\g_local.h (if you define CTF) }
{ Content: local definitions for game module }
{ }
{ Initial conversion by : Massimo Soricetti (max-67@libero.it) }
{ Initial conversion on : 09-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 : 3-Mar-2002 }
{ Updated by : Carl A Kenner (carl_kenner@hotmail.com) }
{ }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on: }
{ none!!!!! (completely self contained) }
{----------------------------------------------------------------------------}
{ * TODO: }
{----------------------------------------------------------------------------}
unit g_local;
interface
{$ifdef CTF}
//ZOID
//uses p_menu;
//ZOID
{$endif}
// CAK - TAKEN FROM q_shared.h
const
MAX_QPATH = 64; // max length of a quake game pathname
MAX_INFO_STRING = 512;
MAX_ITEMS = 256;
MAX_STATS = 32;
// CAK - TAKEN FROM game.h
MAX_ENT_CLUSTERS = 16;
type
// TAKEN FROM q_shared.h
qboolean = LongBool;
PQBoolean = ^qboolean;
TQBooleanArray = array[0..MaxInt div sizeof(qboolean)-1] of qboolean;
PQBooleanArray = ^TQBooleanArray;
vec_t = Single;
vec3_t = array[0..2] of vec_t;
vec5_t = array[0..4] of vec_t;
vec_p = ^vec_t;
vec3_p = ^vec3_t;
vec5_p = ^vec5_t;
pvec_t = vec_p;
pvec3_t = vec3_p;
pvec5_t = vec5_p;
TVec = vec_t;
PVec = vec_p;
TVec3 = vec3_t;
PVec3 = vec3_p;
TVec5 = vec5_t;
PVec5 = vec5_p;
vec_at = Array[0..MaxInt div sizeof(vec_t)-1] of vec_t;
vec_a = ^vec_at;
vec3_at = Array[0..MaxInt div sizeof(vec3_t)-1] of vec3_t;
vec3_a = ^vec3_at;
vec5_at = Array[0..MaxInt div sizeof(vec5_t)-1] of vec5_t;
vec5_a = ^vec5_at;
TVecArray = vec_at;
PVecArray = vec_a;
TVec3Array = vec3_at;
PVec3Array = vec3_a;
TVec5Array = vec5_at;
PVec5Array = vec5_a;
// NOT TAKEN FROM ANYWHERE, NORMAL g_local.h
damage_p = ^damage_t;
pdamage_t = damage_p;
damage_t = (
DAMAGE_NO,
DAMAGE_YES, // will take damage if hit
DAMAGE_AIM // auto targeting recognizes this
);
TDamage = damage_t;
PDamage = damage_p;
damage_at = array[0..MaxInt div SizeOf(damage_t)-1] of damage_t;
damage_a = ^damage_at;
TDamageArray = damage_at;
PDamageArray = ^TDamageArray;
weaponstate_p = ^weaponstate_t;
pweaponstate_t = weaponstate_p;
weaponstate_t = (
WEAPON_READY,
WEAPON_ACTIVATING,
WEAPON_DROPPING,
WEAPON_FIRING
);
TWeaponState = weaponstate_t;
PWeaponState = weaponstate_p;
weaponstate_at = array[0..MaxInt div SizeOf(weaponstate_t)-1] of weaponstate_t;
weaponstate_a = ^weaponstate_at;
TWeaponStateArray = weaponstate_at;
PWeaponStateArray = weaponstate_a;
ammo_p = ^ammo_t;
pammo_t = ammo_p;
ammo_t = (
AMMO_BULLETS,
AMMO_SHELLS,
AMMO_ROCKETS,
AMMO_GRENADES,
AMMO_CELLS,
AMMO_SLUGS
);
TAmmo = ammo_t;
PAmmo = ammo_p;
ammo_at = array[0..MaxInt div SizeOf(ammo_t)-1] of ammo_t;
ammo_a = ^ammo_at;
TAmmoArray = ammo_at;
PAmmoArray = ammo_a;
// edict->movetype values
movetype_p = ^movetype_t;
pmovetype_t = movetype_p;
movetype_t = (
MOVETYPE_NONE, // never moves
MOVETYPE_NOCLIP, // origin and angles change with no interaction
MOVETYPE_PUSH, // no clip to world, push on box contact
MOVETYPE_STOP, // no clip to world, stops on box contact
MOVETYPE_WALK, // gravity
MOVETYPE_STEP, // gravity, special edge handling
MOVETYPE_FLY,
MOVETYPE_TOSS, // gravity
MOVETYPE_FLYMISSILE, // extra size to monsters
MOVETYPE_BOUNCE
);
TMoveType = movetype_t;
PMoveType = movetype_p;
movetype_at = array[0..MaxInt div SizeOf(movetype_t)-1] of movetype_t;
movetype_a = ^movetype_at;
TMoveTypeArray = movetype_at;
PMoveTypeArray = movetype_a;
gitem_armor_p = ^gitem_armor_t;
pgitem_armor_t = gitem_armor_p;
gitem_armor_t = record
base_count: integer;
max_count: integer;
normal_protection: Single;
energy_protection: Single;
armor: integer;
end;
TGItemArmor = gitem_armor_t;
PGItemArmor = gitem_armor_p;
gitem_armor_at = array[0..MaxInt div SizeOf(gitem_armor_t)-1] of gitem_armor_t;
gitem_armor_a = ^gitem_armor_at;
TGItemArmorArray = gitem_armor_at;
PGItemArmorArray = ^TGItemArmorArray;
edict_p = ^edict_s;
gitem_p = ^gitem_t;
BoolFunc_2edict_s = function(ent, other: edict_p): qboolean; cdecl;
Proc_edit_s__gitem_s = procedure(ent: edict_p; item: gitem_p); cdecl;
Proc_edit_s = procedure(ent: edict_p); cdecl;
pgitem_s = gitem_p;
gitem_s = record
classname: PChar; // spawning name
pickup: BoolFunc_2edict_s;
use: Proc_edit_s__gitem_s;
drop: Proc_edit_s__gitem_s;
weaponthink: Proc_edit_s;
pickup_sound: PChar;
world_model: PChar;
world_model_flags: integer;
view_model: PChar;
// client side info
icon: PChar;
pickup_name: PChar; // for printing on pickup
count_width: integer; // number of digits to display by icon
quantity: integer; // for ammo how much, for weapons how much is used per shot
ammo: PChar; // for weapons
flags: integer; // IT_* flags
weapmodel: integer; // weapon model index (for weapons)
info: Pointer;
tag: integer;
precaches: PChar; // string of all models, sounds, and images this item will use
end;
gitem_t = gitem_s;
pgitem_t = gitem_p;
TGItem = gitem_t;
PGItem = gitem_p;
gitem_at = array[0..MaxInt div SizeOf(gitem_t)-1] of gitem_t;
gitem_a = ^gitem_at;
TGItemArray = gitem_at;
PGItemArray = gitem_a;
gclient_p = ^gclient_t;
//
// this structure is left intact through an entire game
// it should be initialized at dll load time, and read/written to
// the server.ssv file for savegames
//
game_locals_p = ^game_locals_t;
pgame_locals_t = game_locals_p;
game_locals_t = record
helpmessage1: array[0..511] of char;
helpmessage2: array[0..511] of char;
helpchanged: integer; // flash F1 icon if non 0, play sound
// and increment only if 1, 2, or 3
clients: gclient_p; // [maxclients]
// can't store spawnpoint in level, because
// it would get overwritten by the savegame restore
spawnpoint: array[0..511] of char; // needed for coop respawns // CAK - Fixed array of PCHAR!!!!!
// store latched cvars here that we want to get at often
maxclients: integer;
maxentities: integer;
// cross level triggers
serverflags: integer;
// items
num_items: integer;
autosaved: qboolean;
end;
TGameLocals = game_locals_t;
PGameLocals = game_locals_p;
game_locals_at = array[0..MaxInt div SizeOf(game_locals_t)-1] of game_locals_t;
game_locals_a = ^game_locals_at;
TGameLocalsArray = game_locals_at;
PGameLocalsArray = game_locals_a;
//
// this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames
//
level_locals_p = ^level_locals_t;
plevel_locals_t = level_locals_p;
level_locals_t = record
framenum: integer;
time: Single;
level_name: array[0..MAX_QPATH - 1] of char; // the descriptive name (Outer Base, etc)
mapname: array[0..MAX_QPATH - 1] of char; // the server name (base1, etc)
nextmap: array[0..MAX_QPATH - 1] of char; // go here when fraglimit is hit
{$ifdef CTF}
forcemap: array[0..MAX_QPATH - 1] of char; // go here
{$endif}
// intermission state
intermissiontime: Single; // time the intermission was started
changemap: PChar;
exitintermission: integer;
intermission_origin: vec3_t;
intermission_angle: vec3_t;
sight_client: edict_p; // changed once each frame for coop games
sight_entity: edict_p;
sight_entity_framenum: integer;
sound_entity: edict_p;
sound_entity_framenum: integer;
sound2_entity: edict_p;
sound2_entity_framenum: integer;
pic_health: integer;
total_secrets: integer;
found_secrets: integer;
total_goals: integer;
found_goals: integer;
total_monsters: integer;
killed_monsters: integer;
current_entity: edict_p; // entity running from G_RunFrame
body_que: integer; // dead bodies
power_cubes: integer; // ugly necessity for coop
end;
TLevelLocals = level_locals_t;
PLevelLocals = level_locals_p;
level_locals_at = array[0..MaxInt div sizeof(level_locals_t)-1] of level_locals_t;
level_locals_a = ^level_locals_at;
TLevelLocalsArray = level_locals_at;
PLevelLocalsArray = level_locals_a;
// spawn_temp_t is only used to hold entity field values that
// can be set from the editor, but aren't actualy present
// in edict_t during gameplay
spawn_temp_p = ^spawn_temp_t;
pspawn_temp_t = spawn_temp_p;
spawn_temp_t = record
// world vars
sky: PChar;
skyrotate: Single;
skyaxis: vec3_t;
nextmap: PChar;
lip,
distance,
height: integer;
noise: PChar;
pausetime: Single;
item,
gravity: PChar;
minyaw,
maxyaw,
minpitch,
maxpitch: Single;
end;
TSpawnTemp = spawn_temp_t;
PSpawnTemp = spawn_temp_p;
spawn_temp_at = array[0..MaxInt div sizeof(spawn_temp_t)-1] of spawn_temp_t;
spawn_temp_a = ^spawn_temp_at;
TSpawnTempArray = spawn_temp_at;
PSpawnTempArray = spawn_temp_a;
Proc_Pedictt = procedure(x: edict_p); cdecl;
moveinfo_p = ^moveinfo_t;
pmoveinfo_t = moveinfo_p;
moveinfo_t = record
// fixed data
start_origin,
start_angles,
end_origin,
end_angles: vec3_t;
sound_start,
sound_middle,
sound_end: integer;
accel,
speed,
decel,
distance: Single;
wait: Single;
// state data
state: integer;
dir: vec3_t;
current_speed,
move_speed,
next_speed,
remaining_distance,
decel_distance: Single;
endfunc: Proc_Pedictt;
end;
TMoveInfo = moveinfo_t;
PMoveInfo = moveinfo_p;
moveinfo_at = array[0..MaxInt div sizeof(moveinfo_t)-1] of moveinfo_t;
moveinfo_a = ^moveinfo_at;
TMoveInfoArray = moveinfo_at;
PMoveInfoArray = moveinfo_a;
Proc_Pedictt_single = procedure(self: edict_p; dist: single); cdecl;
mframe_p = ^mframe_t;
pmframe_t = mframe_p;
mframe_t = record
aifunc: Proc_Pedictt_single;
dist: Single;
thinkfunc: Proc_Pedictt;
end;
TMFrame = mframe_t;
PMFrame = mframe_p;
mframe_at = array[0..MaxInt div sizeof(mframe_t)-1] of mframe_t;
mframe_a = ^mframe_at;
TMFrameArray = mframe_at;
PMFrameArray = mframe_a;
mmove_p = ^mmove_t;
pmmove_t = mmove_p;
mmove_t = record
firstframe,
lastframe: integer;
frame: mframe_p;
endfunc: Proc_Pedictt;
end;
TMMove = mmove_t;
PMMove = mmove_p;
mmove_at = array[0..MaxInt div sizeof(mmove_t)-1] of mmove_t;
mmove_a = ^mmove_at;
TMMoveArray = mmove_at;
PMMoveArray = mmove_a;
Boolfunc_Pedictt = function(self: edict_p): qboolean; cdecl;
Proc_2Pedictt_single = procedure(self, other: edict_p; eta: single); cdecl;
Proc_2Pedictt = procedure(self, other: edict_p); cdecl;
monsterinfo_p = ^monsterinfo_t;
pmonsterinfo_t = monsterinfo_p;
monsterinfo_t = record
currentmove: mmove_p;
aiflags,
nextframe: integer;
scale: Single;
stand,
idle,
search,
walk,
run: Proc_Pedictt;
dodge: Proc_2Pedictt_single;
attack: Proc_Pedictt;
melee: Proc_Pedictt;
sight: Proc_2Pedictt;
checkattack: Boolfunc_Pedictt;
pausetime,
attack_finished: Single; // CAK - FIXED!!! WAS IN WRONG ORDER!!!!! NAUGHTY!!!
saved_goal: vec3_t; // CAK - THIS WHOLE STRUCT WAS WRONG!!!!!!
search_time,
trail_time: Single;
last_sighting: vec3_t;
attack_state,
lefty: integer;
idle_time: Single;
linkcount: integer;
power_armor_type,
power_armor_power: integer;
end;
TMonsterInfo = monsterinfo_t;
PMonsterInfo = monsterinfo_p;
monsterinfo_at = array[0..MaxInt div sizeof(monsterinfo_t)-1] of monsterinfo_t;
monsterinfo_a = ^monsterinfo_at;
TMonsterInfoArray = monsterinfo_at;
PMonsterInfoArray = monsterinfo_a;
//
// fields are needed for spawning from the entity string
// and saving / loading games
//
fieldtype_p = ^fieldtype_t;
pfieldtype_t = fieldtype_p;
fieldtype_t = (
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_ANGLEHACK,
F_EDICT, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
{$ifndef CTF}
F_FUNCTION,
F_MMOVE,
{$endif}
F_IGNORE
);
TFieldType = fieldtype_t;
PFieldType = fieldtype_p;
fieldtype_at = array[0..MaxInt div sizeof(fieldtype_t)-1] of fieldtype_t;
fieldtype_a = ^fieldtype_at;
TFieldTypeArray = fieldtype_at;
PFieldTypeArray = fieldtype_a;
field_p = ^field_t;
pfield_t = field_p;
field_t = record
name: PChar;
ofs: integer;
_type: fieldtype_t;
flags: integer;
end;
TField = field_t;
PField = field_p;
field_at = array[0..MaxInt div sizeof(field_t)-1] of field_t;
field_a = ^field_at;
TFieldArray = field_at;
PFieldArray = field_a;
//============================================================================
// client data that stays across multiple level loads
client_persistant_p = ^client_persistant_t;
pclient_persistant_t = client_persistant_p;
client_persistant_t = record
userinfo: array[0..MAX_INFO_STRING -1] of char;
netname: array[0..15] of char;
hand: integer;
connected: qboolean; // a loadgame will leave valid entities that
// just don't have a connection yet
// values saved and restored from edicts when changing levels
health,
max_health,
savedFlags: integer;
selected_item: integer;
inventory: array[0..MAX_ITEMS-1] of integer;
// ammo capacities
max_bullets,
max_shells,
max_rockets,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -