📄 g_local.pas
字号:
//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
uses
GameUnit,
g_local_add,
q_shared;
type
damage_p = g_local_add.damage_p;
damage_t = g_local_add.damage_t;
weaponstate_p = g_local_add.weaponstate_p;
weaponstate_t = g_local_add.weaponstate_t;
ammo_p = ^ammo_t;
ammo_t = (
AMMO_BULLETS,
AMMO_SHELLS,
AMMO_ROCKETS,
AMMO_GRENADES,
AMMO_CELLS,
AMMO_SLUGS
);
// edict->movetype values
movetype_p = g_local_add.movetype_p;
movetype_t = g_local_add.movetype_t;
gitem_armor_p = ^gitem_armor_t;
gitem_armor_t = record
base_count: integer;
max_count: integer;
normal_protection: Single;
energy_protection: Single;
armor: integer;
end;
gitem_p = g_local_add.gitem_p;
gitem_t = g_local_add.gitem_t;
// client data that stays across multiple level loads
client_persistant_p = g_local_add.client_persistant_p;
client_persistant_t = g_local_add.client_persistant_t;
// client data that stays across deathmatch respawns
client_respawn_p = g_local_add.client_respawn_p;
client_respawn_t = g_local_add.client_respawn_t;
// this structure is cleared on each PutClientInServer(),
// except for 'client->pers'
gclient_p = g_local_add.gclient_p;
gclient_t = g_local_add.gclient_t;
gclient_at = array[0..MaxInt div sizeof(gclient_t)-1] of gclient_t;
gclient_a = ^gclient_at;
edict_t = g_local_add.edict_t;
edict_p = g_local_add.edict_p;
//
// 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;
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;
//
// 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;
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;
// 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;
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;
moveinfo_p = g_local_add.moveinfo_p;
moveinfo_t = g_local_add.moveinfo_t;
mframe_p = g_local_add.mframe_p;
mframe_t = g_local_add.mframe_t;
mmove_p = g_local_add.mmove_p;
mmove_t = g_local_add.mmove_t;
monsterinfo_p = g_local_add.monsterinfo_p;
monsterinfo_t = g_local_add.monsterinfo_t;
//
// fields are needed for spawning from the entity string
// and saving / loading games
//
fieldtype_p = ^fieldtype_t;
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
);
field_p = ^field_t;
field_t = record
name: PChar;
ofs: integer;
_type: fieldtype_t;
flags: integer;
end;
//============================================================================
// the "gameversion" client command will print this plus compile date
const
GAMEVERSION = 'baseq2';
// protocol bytes that can be directly added to messages
svc_muzzleflash = 1;
svc_muzzleflash2 = 2;
svc_temp_entity = 3;
svc_layout = 4;
svc_inventory = 5;
{$ifndef CTF}
svc_stufftext = 11;
{$endif}
//==================================================================
// view pitching times
DAMAGE_TIME = 0.5;
FALL_TIME = 0.3;
// edict->spawnflags
// these are set with checkboxes on each entity in the map editor
SPAWNFLAG_NOT_EASY = $00000100;
SPAWNFLAG_NOT_MEDIUM = $00000200;
SPAWNFLAG_NOT_HARD = $00000400;
SPAWNFLAG_NOT_DEATHMATCH = $00000800;
SPAWNFLAG_NOT_COOP = $00001000;
// edict->flags
FL_FLY = $00000001;
FL_SWIM = $00000002; // implied immunity to drowining
FL_IMMUNE_LASER = $00000004;
FL_INWATER = $00000008;
FL_GODMODE = $00000010;
FL_NOTARGET = $00000020;
FL_IMMUNE_SLIME = $00000040;
FL_IMMUNE_LAVA = $00000080;
FL_PARTIALGROUND = $00000100; // not all corners are valid
FL_WATERJUMP = $00000200; // player jumping out of water
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -