📄 g_items.pas
字号:
{----------------------------------------------------------------------------}
{ }
{ File(s): g_items.c }
{ }
{ Initial conversion by : Bob Janova (bob@redcorona.com) }
{ Initial conversion on : 30-Apr-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 : 20 Sept 2002 }
{ Updated by : Fabrizio Rossini (FAB) }
{ }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on: }
{ 1) }
{ 2) }
{----------------------------------------------------------------------------}
{ * TODO: }
{ }
{----------------------------------------------------------------------------}
unit g_items;
interface
uses
GameUnit,
p_weapon,
q_shared,
g_local;
//function Pickup_Weapon (Ent,Other:Pedict_t): QBoolean;
function Drop_Item (ent: edict_p; item:gitem_p):edict_p;
function FindItemByClassname(classname: pchar): gitem_p; //Added by FAB
procedure Use_Quad (ent:edict_p; item:gitem_p); cdecl; //Added by FAB
function PowerArmorType(ent: edict_p):integer; //Added by FAB
function ITEM_INDEX(x: gitem_p):integer; //added by FAB
function FindItem(pickup_name: pchar): gitem_p; //added by FAB
procedure SetRespawn(Ent:edict_p; Delay: Single); //added by FAB
function Add_Ammo (ent:edict_p;item: gitem_p; count:integer):qboolean; //added by FAB
function GetItemByIndex(index: Integer): gitem_p; //added by FAB
function ArmorIndex (ent:edict_p):integer; //added by FAB
procedure Touch_Item (ent:edict_p;other:edict_p;plane: cplane_p;surf: csurface_p); cdecl;
procedure SpawnItem (ent:edict_p;item: gitem_p); cdecl;
procedure SetItemNames;
procedure PrecacheItem (it:gitem_p);
procedure InitItems;
procedure SP_item_health (self:edict_p); cdecl;
procedure SP_item_health_small (self:edict_p); cdecl;
procedure SP_item_health_large (self:edict_p); cdecl;
procedure SP_item_health_mega (self:edict_p); cdecl;
const JacketArmor_Info: GItem_Armor_t =
(Base_Count:25; Max_Count:50; Normal_Protection:0.30; Energy_Protection: 0.00; Armor:ARMOR_JACKET);
CombatArmor_Info: GItem_Armor_t =
(Base_Count:50; Max_Count:100; Normal_Protection:0.60; Energy_Protection: 0.30; Armor:ARMOR_COMBAT);
BodyArmor_Info: GItem_Armor_t =
(Base_Count:100; Max_Count:200; Normal_Protection:0.80; Energy_Protection: 0.60; Armor:ARMOR_BODY);
var
jacket_armor_index,
combat_armor_index,
body_armor_index,
power_screen_index,
power_shield_index: Integer;
Quad_drop_timeout_hack: Integer;
const
HEALTH_IGNORE_MAX = 1;
HEALTH_TIMED = 2;
function Pickup_Armor (ent:edict_p;other: edict_p):qboolean; cdecl;
function Pickup_PowerArmor (ent:edict_p;other:edict_p):qboolean; cdecl;
procedure Use_PowerArmor(ent:edict_p;item: gitem_p); cdecl;
procedure Drop_PowerArmor(ent:edict_p;item: gitem_p); cdecl;
function Pickup_Ammo (ent:edict_p;other:edict_p): qboolean; cdecl;
procedure Drop_Ammo(ent:edict_p;item: gitem_p); cdecl;
function Pickup_Powerup (Ent, Other:edict_p): QBoolean; cdecl;
procedure Drop_General(Ent:edict_p;Item: GItem_p); cdecl;
procedure Use_Invulnerability(ent:edict_p;item: gitem_p); cdecl;
procedure Use_Silencer (ent:edict_p;item: gitem_p); cdecl;
procedure Use_Breather (ent:edict_p; item:gitem_p); cdecl;
procedure Use_Envirosuit(ent:edict_p;item:gitem_p); cdecl;
function Pickup_AncientHead (Ent, Other:edict_p): QBoolean; cdecl;
function Pickup_Adrenaline (Ent, Other:edict_p): QBoolean; cdecl;
function Pickup_Bandolier (Ent, Other:edict_p): QBoolean; cdecl;
function Pickup_Pack (Ent, Other:edict_p): QBoolean; cdecl;
function Pickup_Key (ent:edict_p;other:edict_p):qboolean; cdecl;
function Pickup_Health (ent:edict_p;other:edict_p):qboolean; cdecl;
// Burnin : the function hack didn't work since the pointer to itens were needed in some places
const itemlist:array[0..42] of gitem_t = (
(
// nil
), // leave index 0 alone
//
// ARMOR
//
{QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_armor_body';
pickup : Pickup_Armor;
use : nil;
drop : nil;
weaponthink : nil;
pickup_sound : 'misc/ar1_pkup.wav';
world_model : 'models/items/armor/body/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_bodyarmor';
{ pickup} pickup_name :'Body Armor';
{ width } count_width : 3;
quantity : 0;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : @bodyarmor_info;
tag : ARMOR_BODY;
{ precache } precaches : '';
),
{QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_armor_combat';
pickup : Pickup_Armor;
use : nil;
drop : nil;
weaponthink : nil;
pickup_sound : 'misc/ar1_pkup.wav';
world_model : 'models/items/armor/combat/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_combatarmor';
{ pickup} pickup_name :'Combat Armor';
{ width } count_width : 3;
quantity : 0;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : @combatarmor_info;
tag : ARMOR_COMBAT;
{ precache } precaches : '';
),
{QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_armor_jacket';
pickup : Pickup_Armor;
use : nil;
drop : nil;
weaponthink : nil;
pickup_sound : 'misc/ar1_pkup.wav';
world_model : 'models/items/armor/jacket/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_jacketarmor';
{ pickup} pickup_name :'Jacket Armor';
{ width } count_width : 3;
quantity : 0;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : @jacketarmor_info;
tag : ARMOR_JACKET;
{ precache } precaches : '';
),
{QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_armor_shard';
pickup : Pickup_Armor;
use : nil;
drop : nil;
weaponthink : nil;
pickup_sound : 'misc/ar2_pkup.wav';
world_model : 'models/items/armor/shard/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_jacketarmor';
{ pickup} pickup_name : 'Armor Shard';
{ width } count_width : 3;
quantity : 0;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : @jacketarmor_info;
tag : ARMOR_SHARD;
{ precache } precaches : '';
),
{QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_power_screen';
pickup : Pickup_PowerArmor;
use : Use_PowerArmor;
drop : Drop_PowerArmor;
weaponthink : nil;
pickup_sound : 'misc/ar3_pkup.wav';
world_model : 'models/items/armor/screen/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_powerscreen';
{ pickup} pickup_name : 'Power Screen';
{ width } count_width : 0;
quantity : 60;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : nil;
tag : 0;
{ precache } precaches : '';
),
{QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'item_power_shield';
pickup : Pickup_PowerArmor;
use : Use_PowerArmor;
drop : Drop_PowerArmor;
weaponthink : nil;
pickup_sound : 'misc/ar3_pkup.wav';
world_model : 'models/items/armor/shield/tris.md2';
world_model_flags: EF_ROTATE;
view_model : nil;
{ icon } icon : 'i_powershield';
{ pickup} pickup_name : 'Power Shield';
{ width } count_width : 0;
quantity : 60;
ammo : nil;
flags : IT_ARMOR;
weapmodel : 0;
info : nil;
tag : 0;
{ precache } precaches : 'misc/power2.wav misc/power1.wav';
),
//
// WEAPONS
//
{ weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
always owned, never in the world
}
(
classname : 'weapon_blaster';
pickup : nil;
use : Use_Weapon;
drop : nil;
weaponthink : Weapon_Blaster;
pickup_sound : 'misc/w_pkup.wav';
world_model : nil;
world_model_flags: 0;
view_model : 'models/weapons/v_blast/tris.md2';
{ icon } icon : 'w_blaster';
{ pickup} pickup_name : 'Blaster';
{ width } count_width : 0;
quantity : 0;
ammo : nil;
flags : IT_WEAPON or IT_STAY_COOP;
weapmodel : WEAP_BLASTER;
info : nil;
tag : 0;
{ precache } precaches : 'weapons/blastf1a.wav misc/lasfly.wav';
),
{QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'weapon_shotgun';
pickup : Pickup_Weapon;
use : Use_Weapon;
drop : Drop_Weapon;
weaponthink : Weapon_Shotgun;
pickup_sound : 'misc/w_pkup.wav';
world_model : 'models/weapons/g_shotg/tris.md2';
world_model_flags: EF_ROTATE;
view_model : 'models/weapons/v_shotg/tris.md2';
{ icon } icon : 'w_shotgun';
{ pickup} pickup_name : 'Shotgun';
{ width } count_width : 0;
quantity : 1;
ammo : 'Shells';
flags : IT_WEAPON or IT_STAY_COOP;
weapmodel : WEAP_SHOTGUN;
info : nil;
tag : 0;
{ precache } precaches : 'weapons/shotgf1b.wav weapons/shotgr1b.wav';
),
{QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'weapon_supershotgun';
pickup : Pickup_Weapon;
use : Use_Weapon;
drop : Drop_Weapon;
weaponthink : Weapon_SuperShotgun;
pickup_sound : 'misc/w_pkup.wav';
world_model : 'models/weapons/g_shotg2/tris.md2';
world_model_flags: EF_ROTATE;
view_model : 'models/weapons/v_shotg2/tris.md2';
{ icon } icon : 'w_sshotgun';
{ pickup} pickup_name : 'Super Shotgun';
{ width } count_width : 0;
quantity : 2;
ammo : 'Shells';
flags : IT_WEAPON or IT_STAY_COOP;
weapmodel : WEAP_SUPERSHOTGUN;
info : nil;
tag : 0;
{ precache } precaches : 'weapons/sshotgf1b.wav';
),
{QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'weapon_machinegun';
pickup : Pickup_Weapon;
use : Use_Weapon;
drop : Drop_Weapon;
weaponthink : Weapon_Machinegun;
pickup_sound : 'misc/w_pkup.wav';
world_model : 'models/weapons/g_machn/tris.md2';
world_model_flags: EF_ROTATE;
view_model : 'models/weapons/v_machn/tris.md2';
{ icon } icon : 'w_machinegun';
{ pickup} pickup_name : 'Machinegun';
{ width } count_width : 0;
quantity : 1;
ammo : 'Bullets';
flags : IT_WEAPON or IT_STAY_COOP;
weapmodel : WEAP_MACHINEGUN;
info : nil;
tag : 0;
{ precache } precaches : 'weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav'
),
{QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16)
}
(
classname : 'weapon_chaingun';
pickup : Pickup_Weapon;
use : Use_Weapon;
drop : Drop_Weapon;
weaponthink : Weapon_Chaingun;
pickup_sound : 'misc/w_pkup.wav';
world_model : 'models/weapons/g_chain/tris.md2';
world_model_flags: EF_ROTATE;
view_model : 'models/weapons/v_chain/tris.md2';
{ icon } icon : 'w_chaingun';
{ pickup} pickup_name : 'Chaingun';
{ width } count_width : 0;
quantity : 1;
ammo : 'Bullets';
flags : IT_WEAPON or IT_STAY_COOP;
weapmodel : WEAP_CHAINGUN;
info : nil;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -