2001-12-31 16:16:59 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// $Log$
|
2006-04-14 18:16:31 +00:00
|
|
|
// Revision 1.58 2006/04/14 18:15:45 makro
|
|
|
|
// no message
|
|
|
|
//
|
2005-09-07 20:27:42 +00:00
|
|
|
// Revision 1.57 2005/09/07 20:27:41 makro
|
|
|
|
// Entity attachment trees
|
|
|
|
//
|
2005-02-15 16:33:39 +00:00
|
|
|
// Revision 1.56 2005/02/15 16:33:39 makro
|
|
|
|
// Tons of updates (entity tree attachment system, UI vectors)
|
|
|
|
//
|
2003-07-30 16:05:47 +00:00
|
|
|
// Revision 1.55 2003/07/30 16:05:46 makro
|
|
|
|
// no message
|
|
|
|
//
|
2003-04-02 22:23:51 +00:00
|
|
|
// Revision 1.54 2003/04/02 22:23:51 jbravo
|
|
|
|
// More replacements tweaks. Added zcam_stfu
|
|
|
|
//
|
2003-03-31 21:04:24 +00:00
|
|
|
// Revision 1.53 2003/03/31 21:04:24 makro
|
|
|
|
// no message
|
|
|
|
//
|
2003-03-29 23:04:56 +00:00
|
|
|
// Revision 1.52 2003/03/29 23:04:56 jbravo
|
|
|
|
// More post _skin cvar fixes
|
|
|
|
//
|
2003-03-29 16:01:36 +00:00
|
|
|
// Revision 1.51 2003/03/29 16:01:36 jbravo
|
|
|
|
// _skin cvars now fully removed. dlight code from Makro added. cvar
|
|
|
|
// defaults fixed.
|
|
|
|
//
|
2003-03-28 22:26:24 +00:00
|
|
|
// Revision 1.50 2003/03/28 22:26:24 makro
|
|
|
|
// no message
|
|
|
|
//
|
2003-02-05 20:21:38 +00:00
|
|
|
// Revision 1.49 2003/02/05 20:21:38 jbravo
|
|
|
|
// Fixed the model replacement system. Its no longer an ugly hack.
|
|
|
|
//
|
2003-02-01 02:15:31 +00:00
|
|
|
// Revision 1.48 2003/02/01 02:15:31 jbravo
|
|
|
|
// Replacement models and items
|
|
|
|
//
|
2003-01-08 04:46:26 +00:00
|
|
|
// Revision 1.47 2003/01/08 04:46:26 jbravo
|
|
|
|
// Wrote a new hackish model replacement system
|
|
|
|
//
|
2002-10-30 20:04:34 +00:00
|
|
|
// Revision 1.46 2002/10/30 20:04:34 jbravo
|
|
|
|
// Adding helmet
|
|
|
|
//
|
2002-10-26 00:37:18 +00:00
|
|
|
// Revision 1.45 2002/10/26 00:37:18 jbravo
|
|
|
|
// New multiple item code and added PB support to the UI
|
|
|
|
//
|
2002-07-22 06:35:03 +00:00
|
|
|
// Revision 1.44 2002/07/22 06:34:13 niceass
|
|
|
|
// cleaned up the powerup code
|
|
|
|
//
|
2002-07-01 02:18:42 +00:00
|
|
|
// Revision 1.43 2002/07/01 02:18:42 jbravo
|
|
|
|
// Small fixes to CTB and possible fix for subs and limchasecam
|
|
|
|
//
|
2002-06-29 04:15:15 +00:00
|
|
|
// Revision 1.42 2002/06/29 04:15:15 jbravo
|
|
|
|
// CTF is now CTB. no weapons while the case is in hand other than pistol or knife
|
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// Revision 1.41 2002/06/16 20:06:14 jbravo
|
|
|
|
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
|
|
|
|
//
|
2002-06-16 17:38:00 +00:00
|
|
|
// Revision 1.40 2002/06/16 17:37:59 jbravo
|
|
|
|
// Removed the MISSIONPACK ifdefs and missionpack only code.
|
|
|
|
//
|
2002-05-29 13:49:26 +00:00
|
|
|
// Revision 1.39 2002/05/29 13:49:25 makro
|
|
|
|
// Elevators/doors
|
|
|
|
//
|
2002-05-12 22:14:13 +00:00
|
|
|
// Revision 1.38 2002/05/12 22:14:13 makro
|
|
|
|
// Impact sounds
|
|
|
|
//
|
2002-05-11 19:18:20 +00:00
|
|
|
// Revision 1.37 2002/05/11 19:18:20 makro
|
|
|
|
// Sand surfaceparm
|
|
|
|
//
|
2002-05-11 14:22:06 +00:00
|
|
|
// Revision 1.36 2002/05/11 14:22:06 makro
|
|
|
|
// Func_statics now reset at the beginning of each round
|
|
|
|
//
|
2002-04-30 11:54:37 +00:00
|
|
|
// Revision 1.35 2002/04/30 11:54:37 makro
|
|
|
|
// Bots rule ! Also, added clips to give all. Maybe some other things
|
|
|
|
//
|
2002-04-23 06:09:18 +00:00
|
|
|
// Revision 1.34 2002/04/23 06:03:39 niceass
|
|
|
|
// pressure stuff
|
|
|
|
//
|
2002-04-20 15:05:08 +00:00
|
|
|
// Revision 1.33 2002/04/20 15:03:47 makro
|
|
|
|
// More footstep sounds, a few other things
|
|
|
|
//
|
2002-04-03 03:13:49 +00:00
|
|
|
// Revision 1.32 2002/04/03 03:13:16 blaze
|
|
|
|
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
|
|
|
|
//
|
2002-03-31 03:31:24 +00:00
|
|
|
// Revision 1.31 2002/03/31 03:31:24 jbravo
|
|
|
|
// Compiler warning cleanups
|
|
|
|
//
|
2002-03-02 12:24:30 +00:00
|
|
|
// Revision 1.30 2002/03/02 12:24:30 jbravo
|
|
|
|
// Removed some debugging messages
|
|
|
|
//
|
2002-02-23 16:55:09 +00:00
|
|
|
// Revision 1.29 2002/02/23 16:55:09 jbravo
|
|
|
|
// Added debugging to help find what was going with can't find item for weapon
|
|
|
|
// error that crash the server.
|
|
|
|
//
|
2002-01-24 14:20:53 +00:00
|
|
|
// Revision 1.28 2002/01/24 14:20:53 jbravo
|
|
|
|
// Adding func_explosive and a few new surfaceparms
|
|
|
|
//
|
2002-01-14 07:31:33 +00:00
|
|
|
// Revision 1.27 2002/01/14 07:31:33 jbravo
|
|
|
|
// Added a small workaround for the HoldableItem not found crash during
|
|
|
|
// mapchanges.
|
|
|
|
//
|
2002-01-11 19:48:33 +00:00
|
|
|
// Revision 1.26 2002/01/11 19:48:29 jbravo
|
|
|
|
// Formatted the source in non DOS format.
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// Revision 1.25 2001/12/31 16:28:42 jbravo
|
|
|
|
// I made a Booboo with the Log tag.
|
|
|
|
//
|
2001-12-31 16:16:59 +00:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2001-05-06 20:50:27 +00:00
|
|
|
// Copyright (C) 1999-2000 Id Software, Inc.
|
|
|
|
//
|
|
|
|
// bg_misc.c -- both games misc functions, all completely stateless
|
|
|
|
|
2009-07-04 02:29:42 +00:00
|
|
|
#include "../qcommon/q_shared.h"
|
2001-05-06 20:50:27 +00:00
|
|
|
#include "bg_public.h"
|
|
|
|
|
|
|
|
/*QUAKED item_***** ( 0 0 0 ) (-16 -16 -16) (16 16 16) suspended
|
|
|
|
DO NOT USE THIS CLASS, IT JUST HOLDS GENERAL INFORMATION.
|
|
|
|
The suspended flag will allow items to hang in the air, otherwise they are dropped to the next surface.
|
|
|
|
|
|
|
|
If an item is the target of another entity, it will not spawn in until fired.
|
|
|
|
|
|
|
|
An item fires all of its targets when it is picked up. If the toucher can't carry it, the targets won't be fired.
|
|
|
|
|
|
|
|
"notfree" if set to 1, don't spawn in free for all games
|
|
|
|
"notteam" if set to 1, don't spawn in team games
|
|
|
|
"notsingle" if set to 1, don't spawn in single player games
|
|
|
|
"wait" override the default wait before respawning. -1 = never respawn automatically, which can be used with targeted spawning.
|
|
|
|
"random" random number of plus or minus seconds varied from the respawn time
|
|
|
|
"count" override quantity or duration on most items.
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
gitem_t bg_itemlist[] = {
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
{NULL,
|
|
|
|
NULL,
|
2011-03-07 03:59:31 +00:00
|
|
|
NULL, NULL}
|
2002-06-16 20:06:15 +00:00
|
|
|
,
|
|
|
|
/* icon */ NULL,
|
|
|
|
/* pickup */ NULL,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
, // leave index 0 alone
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// ARMOR
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
2001-12-17 15:08:34 +00:00
|
|
|
// WEAPONS
|
2001-05-06 20:50:27 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
//Blaze: Reaction weapons
|
|
|
|
//Knife
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_knife",
|
|
|
|
"sound/misc/am_pkup.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/knife/knife.md3",
|
2003-01-08 04:46:26 +00:00
|
|
|
0, 0, 0}
|
2002-06-16 20:06:15 +00:00
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconw_knife",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_KNIFE_NAME,
|
|
|
|
1,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_KNIFE,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Pistol
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_pistol",
|
|
|
|
"sound/weapons/mk23/mk23slide.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/mk23/mk23.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_mk23",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_PISTOL_NAME,
|
|
|
|
12,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_PISTOL,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//M4
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_m4",
|
|
|
|
"sound/weapons/m4/m4slide.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/m4/m4.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_m4",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_M4_NAME,
|
|
|
|
24,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_M4,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//SSG3000
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_ssg3000",
|
|
|
|
"sound/weapons/ssg3000/ssgin.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/ssg3000/ssg3000.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_ssg",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_SSG3000_NAME,
|
|
|
|
6,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_SSG3000,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//MP5
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_mp5",
|
|
|
|
"sound/weapons/mp5/mp5slide.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/mp5/mp5.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_mp5",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_MP5_NAME,
|
|
|
|
30,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_MP5,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Handcannon
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_handcannon",
|
|
|
|
"sound/weapons/handcannon/hcopen.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/handcannon/handcannon.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_handcannon",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_HANDCANNON_NAME,
|
|
|
|
2,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_HANDCANNON,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Shotgun
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_m3",
|
|
|
|
"sound/weapons/m3/m3in.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/m3/m3.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_m3",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_M3_NAME,
|
|
|
|
7,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_M3,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Akimbo Placeholder
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_akimbo",
|
|
|
|
"sound/weapons/mk23/mk23slide.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/akimbo/akimbo.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_akimbo",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_AKIMBO_NAME,
|
|
|
|
24,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_AKIMBO,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Grenade
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"weapon_grenade",
|
|
|
|
//"sound/grenade/tink2.wav",
|
|
|
|
"sound/misc/am_pkup.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/weapons2/grenade/grenade.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
/* icon */ "icons/iconw_grenade",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ RQ3_GRENADE_NAME,
|
|
|
|
1,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_GRENADE,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-07-09 00:32:10 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
//Blaze: 3rd Person Models
|
2001-07-09 00:32:10 +00:00
|
|
|
//Elder: 07/06/2001: Now known as 1st-person models!
|
2001-05-06 20:50:27 +00:00
|
|
|
//Knife
|
|
|
|
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"knife_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/knife/knife_1st.md3", 0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_knife",
|
|
|
|
RQ3_KNIFE_NAME,
|
|
|
|
1,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_KNIFE,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Pistol
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"pistol_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/mk23/mk23_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_mk23",
|
|
|
|
RQ3_PISTOL_NAME,
|
|
|
|
12,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_PISTOL,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//M4
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"m4_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/m4/m4_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_m4",
|
|
|
|
RQ3_M4_NAME,
|
|
|
|
24,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_M4,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//SSG3000
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ssg3000_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/ssg3000/ssg3000_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_ssg",
|
|
|
|
RQ3_SSG3000_NAME,
|
|
|
|
6,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_SSG3000,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//MP5
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"mp5_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/mp5/mp5_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_mp5",
|
|
|
|
RQ3_MP5_NAME,
|
|
|
|
30,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_MP5,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Handcannon
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"handcannon_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/handcannon/handcannon_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_sawedoff",
|
|
|
|
RQ3_HANDCANNON_NAME,
|
|
|
|
2,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_HANDCANNON,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Shotgun
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"m3_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/m3/m3_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_m3",
|
|
|
|
RQ3_M3_NAME,
|
|
|
|
7,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_M3,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Akimbo Placeholder
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"akimbo_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/akimbo/akimbo_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_akimbo",
|
|
|
|
RQ3_AKIMBO_NAME,
|
|
|
|
24,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_AKIMBO,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//Grenade
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"grenade_1st",
|
|
|
|
NULL,
|
|
|
|
{"models/weapons2/grenade/grenade_1st.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
|
|
|
"icons/iconw_gren",
|
|
|
|
RQ3_GRENADE_NAME,
|
|
|
|
1,
|
|
|
|
IT_WEAPON,
|
|
|
|
WP_GRENADE,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// AMMO ITEMS
|
|
|
|
//
|
2001-07-28 14:12:11 +00:00
|
|
|
/*QUAKED ammo_mk23 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
2001-05-06 20:50:27 +00:00
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ammo_mk23",
|
|
|
|
"sound/misc/am_pkup.wav",
|
|
|
|
{"models/ammo/mk23.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-04-02 22:23:51 +00:00
|
|
|
/* icon */ "icons/icona_mk23",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ "MK23 Clip",
|
|
|
|
1,
|
|
|
|
IT_AMMO,
|
|
|
|
//Blaze: Changed from WP_MACHINEGUN to WP_PISTOL
|
|
|
|
WP_PISTOL,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ammo_shells",
|
|
|
|
"sound/misc/am_pkup.wav",
|
|
|
|
{"models/ammo/m3.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-04-02 22:23:51 +00:00
|
|
|
/* icon */ "icons/icona_m3",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ "Shotgun Shells",
|
|
|
|
7,
|
|
|
|
IT_AMMO,
|
|
|
|
//Blaze: Changed from WP_ROCKET_LAUNCHER to WP_SHOTGUN
|
|
|
|
WP_M3,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2001-07-28 14:12:11 +00:00
|
|
|
/*QUAKED ammo_ssg3000 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
2001-05-06 20:50:27 +00:00
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ammo_ssg3000",
|
|
|
|
"sound/misc/am_pkup.wav",
|
|
|
|
{"models/ammo/ssg3000.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-04-02 22:23:51 +00:00
|
|
|
/* icon */ "icons/icona_ssg3000",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ "AP Sniper Ammo",
|
|
|
|
10,
|
|
|
|
IT_AMMO,
|
|
|
|
//Blaze: Changed from WP_RAILGUN to WP_GRENADE
|
|
|
|
WP_SSG3000,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2001-07-28 14:12:11 +00:00
|
|
|
/*QUAKED ammo_mp5 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
2001-05-06 20:50:27 +00:00
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ammo_mp5",
|
|
|
|
"sound/misc/am_pkup.wav",
|
|
|
|
{"models/ammo/mp5.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-04-02 22:23:51 +00:00
|
|
|
/* icon */ "icons/icona_mp5",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ "MP5 Clip",
|
|
|
|
1,
|
|
|
|
IT_AMMO,
|
|
|
|
//Blaze: Changed from WP_PLASMAGUN to WP_MP5
|
|
|
|
WP_MP5,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*QUAKED ammo_lightning (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
|
|
|
*/
|
|
|
|
//Blaze: HC and M3 use same ammo
|
2002-06-16 20:06:15 +00:00
|
|
|
// {
|
|
|
|
// "ammo_lightning",
|
|
|
|
// "sound/misc/am_pkup.wav",
|
2001-12-17 15:08:34 +00:00
|
|
|
// { "models/powerups/ammo/lightningam.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
// 0, 0, 0},
|
|
|
|
/* icon */// "icons/icona_lightning",
|
|
|
|
/* pickup */// "Shotgun Shells",
|
|
|
|
//7,
|
|
|
|
//IT_AMMO,
|
|
|
|
//Blaze: Changed from WP_LIGHTNING to WP_HANDCANNON
|
|
|
|
//WP_HANDCANNON,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */// "",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* sounds *///""
|
|
|
|
// },
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2001-07-28 14:12:11 +00:00
|
|
|
/*QUAKED ammo_m4 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
|
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"ammo_m4",
|
|
|
|
"sound/misc/am_pkup.wav",
|
|
|
|
{"models/ammo/m4.md3",
|
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-04-02 22:23:51 +00:00
|
|
|
/* icon */ "icons/icona_m4",
|
2002-06-16 20:06:15 +00:00
|
|
|
/* pickup */ "M4 Clip",
|
|
|
|
1,
|
|
|
|
IT_AMMO,
|
|
|
|
//Blaze: changed from WP_SHOTGUN to WP_M4
|
|
|
|
WP_M4,
|
2001-07-28 14:12:11 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*QUAKED team_CTF_redflag (1 0 0) (-16 -16 -16) (16 16 16)
|
|
|
|
Only in CTF games
|
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"team_CTF_redflag",
|
|
|
|
NULL,
|
2002-06-29 04:15:15 +00:00
|
|
|
// {"models/flags/r_flag.md3",
|
|
|
|
{"models/cases/s_case.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2002-07-01 02:18:42 +00:00
|
|
|
/* icon */ "icons/iconc_silver",
|
|
|
|
/* pickup */ "Silver Case",
|
2002-06-16 20:06:15 +00:00
|
|
|
0,
|
|
|
|
IT_TEAM,
|
|
|
|
PW_REDFLAG,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*QUAKED team_CTF_blueflag (0 0 1) (-16 -16 -16) (16 16 16)
|
|
|
|
Only in CTF games
|
|
|
|
*/
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"team_CTF_blueflag",
|
|
|
|
NULL,
|
2002-06-29 04:15:15 +00:00
|
|
|
// {"models/flags/b_flag.md3",
|
|
|
|
{"models/cases/b_case.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2002-07-01 02:18:42 +00:00
|
|
|
/* icon */ "icons/iconc_black",
|
|
|
|
/* pickup */ "Black Case",
|
2002-06-16 20:06:15 +00:00
|
|
|
0,
|
|
|
|
IT_TEAM,
|
|
|
|
PW_BLUEFLAG,
|
2001-05-06 20:50:27 +00:00
|
|
|
/* precache */ "",
|
|
|
|
/* sounds */ ""
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2001-07-09 00:32:10 +00:00
|
|
|
//Elder: RQ3 Items
|
2001-06-28 00:13:45 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"item_kevlar",
|
|
|
|
"sound/items/kevlar.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/kevlar.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_kevlar",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_KEVLAR_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_KEVLAR,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-06-28 00:13:45 +00:00
|
|
|
|
2001-07-09 00:32:10 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"item_silencer",
|
|
|
|
"sound/items/silencer.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/silencer.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_silencer",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_SILENCER_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_SILENCER,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-07-09 00:32:10 +00:00
|
|
|
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"item_laser",
|
|
|
|
"sound/items/laser.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/laser.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_laser",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_LASER_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_LASER,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-07-09 00:32:10 +00:00
|
|
|
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"item_bandolier",
|
|
|
|
"sound/items/bandolier.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/bandolier.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_bandolier",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_BANDOLIER_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_BANDOLIER,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-07-09 00:32:10 +00:00
|
|
|
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
"item_slippers",
|
|
|
|
"sound/items/slippers.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/slippers.md3",
|
2002-06-16 20:06:15 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_slippers",
|
2002-06-16 20:06:15 +00:00
|
|
|
RQ3_SLIPPERS_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_SLIPPERS,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2002-10-30 20:04:34 +00:00
|
|
|
// JBravo: adding Helmet
|
|
|
|
{
|
|
|
|
"item_helmet",
|
|
|
|
"sound/items/slippers.wav",
|
2003-02-05 20:21:38 +00:00
|
|
|
{"models/items/helmet.md3",
|
2002-10-30 20:04:34 +00:00
|
|
|
0, 0, 0}
|
|
|
|
,
|
2003-02-05 20:21:38 +00:00
|
|
|
"icons/iconi_helmet",
|
2002-10-30 20:04:34 +00:00
|
|
|
RQ3_HELMET_NAME,
|
|
|
|
0,
|
|
|
|
IT_HOLDABLE,
|
|
|
|
HI_HELMET,
|
|
|
|
"",
|
|
|
|
""}
|
|
|
|
,
|
2001-05-06 20:50:27 +00:00
|
|
|
// end of list marker
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2011-03-07 03:59:31 +00:00
|
|
|
int bg_numItems = ARRAY_LEN( bg_itemlist ) - 1;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
BG_FindItemForPowerup
|
|
|
|
==============
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
gitem_t *BG_FindItemForPowerup(powerup_t pw)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < bg_numItems; i++) {
|
|
|
|
if ((bg_itemlist[i].giType == IT_POWERUP ||
|
|
|
|
bg_itemlist[i].giType == IT_TEAM ||
|
|
|
|
bg_itemlist[i].giType == IT_PERSISTANT_POWERUP) && bg_itemlist[i].giTag == pw) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return &bg_itemlist[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
BG_FindItemForHoldable
|
|
|
|
==============
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
gitem_t *BG_FindItemForHoldable(holdable_t pw)
|
|
|
|
{
|
|
|
|
int i;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-01-14 07:31:33 +00:00
|
|
|
// JBravo: fix for HoldableItem not found error during mapchanges.
|
|
|
|
// I dont understand why this gets called with pw == 0 during map changes.
|
|
|
|
if (pw == 0)
|
2002-03-31 03:31:24 +00:00
|
|
|
return NULL;
|
2002-01-14 07:31:33 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < bg_numItems; i++) {
|
|
|
|
if (bg_itemlist[i].giType == IT_HOLDABLE && bg_itemlist[i].giTag == pw) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return &bg_itemlist[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
Com_Error(ERR_DROP, "HoldableItem not found");
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
BG_FindItemForWeapon
|
|
|
|
|
|
|
|
===============
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
gitem_t *BG_FindItemForWeapon(weapon_t weapon)
|
|
|
|
{
|
|
|
|
gitem_t *it;
|
2001-12-17 15:08:34 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (it = bg_itemlist + 1; it->classname; it++) {
|
|
|
|
if (it->giType == IT_WEAPON && it->giTag == weapon) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
Com_Error(ERR_DROP, "Couldn't find item for weapon %i", weapon);
|
2001-05-06 20:50:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
BG_FindItem
|
|
|
|
|
|
|
|
===============
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
gitem_t *BG_FindItem(const char *pickupName)
|
|
|
|
{
|
|
|
|
gitem_t *it;
|
2001-12-17 15:08:34 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (it = bg_itemlist + 1; it->classname; it++) {
|
|
|
|
if (!Q_stricmp(it->pickup_name, pickupName))
|
2001-05-06 20:50:27 +00:00
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
BG_PlayerTouchesItem
|
|
|
|
|
|
|
|
Items can be picked up without actually touching their physical bounds to make
|
|
|
|
grabbing them easier
|
|
|
|
============
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
qboolean BG_PlayerTouchesItem(playerState_t * ps, entityState_t * item, int atTime)
|
|
|
|
{
|
|
|
|
vec3_t origin;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
BG_EvaluateTrajectory(&item->pos, atTime, origin);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// we are ignoring ducked differences here
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->origin[0] - origin[0] > 44
|
|
|
|
|| ps->origin[0] - origin[0] < -50
|
|
|
|
|| ps->origin[1] - origin[1] > 36
|
|
|
|
|| ps->origin[1] - origin[1] < -36 || ps->origin[2] - origin[2] > 36 || ps->origin[2] - origin[2] < -36) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
2001-06-08 04:47:30 +00:00
|
|
|
Elder: changed from ClipAmountForWeapon - which was an ambiguous name
|
|
|
|
ClipAmountForReload for Cmd_Reload
|
2001-05-06 20:50:27 +00:00
|
|
|
Added by Duffman
|
2001-06-08 04:47:30 +00:00
|
|
|
Returns the amount of ammo a weapon reloads by
|
|
|
|
==================
|
2001-05-06 20:50:27 +00:00
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
int ClipAmountForReload(int w)
|
|
|
|
{
|
2001-05-06 20:50:27 +00:00
|
|
|
//How much each clip holds
|
2001-06-08 04:47:30 +00:00
|
|
|
//Elder: this function is very misleading.
|
|
|
|
//It returns the amount to add when reloading,
|
|
|
|
//Not the actual amount in a weapon clip!!
|
|
|
|
//For that, you should check ClipAmountForAmmo below
|
|
|
|
//Changed to use constants defined in bg_public.h
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (w) {
|
|
|
|
case WP_PISTOL:
|
|
|
|
return RQ3_PISTOL_RELOAD;
|
|
|
|
case WP_KNIFE:
|
|
|
|
return RQ3_KNIFE_RELOAD;
|
|
|
|
case WP_M4:
|
|
|
|
return RQ3_M4_RELOAD;
|
|
|
|
case WP_SSG3000:
|
|
|
|
return RQ3_SSG3000_RELOAD;
|
|
|
|
case WP_MP5:
|
|
|
|
return RQ3_MP5_RELOAD;
|
|
|
|
case WP_HANDCANNON:
|
|
|
|
return RQ3_HANDCANNON_RELOAD;
|
|
|
|
case WP_M3:
|
|
|
|
return RQ3_M3_RELOAD;
|
|
|
|
case WP_AKIMBO:
|
|
|
|
return RQ3_AKIMBO_RELOAD;
|
|
|
|
case WP_GRENADE:
|
|
|
|
return RQ3_GRENADE_RELOAD;
|
|
|
|
default:
|
|
|
|
return RQ3_PISTOL_RELOAD;
|
|
|
|
}
|
2001-05-06 20:50:27 +00:00
|
|
|
// return 12; //this wont happen unless you copy-and-paste too much
|
|
|
|
}
|
|
|
|
|
2001-06-08 04:47:30 +00:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
ClipAmountForAmmo
|
|
|
|
Added by Elder
|
|
|
|
Returns the amount of ammo a weapon can hold
|
|
|
|
==================
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
int ClipAmountForAmmo(int w)
|
|
|
|
{
|
2001-06-08 04:47:30 +00:00
|
|
|
//How much each GUN holds!
|
|
|
|
//Elder: don't confuse with the reload one
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (w) {
|
|
|
|
case WP_PISTOL:
|
|
|
|
return RQ3_PISTOL_AMMO;
|
|
|
|
case WP_KNIFE:
|
|
|
|
return RQ3_KNIFE_AMMO;
|
|
|
|
case WP_M4:
|
|
|
|
return RQ3_M4_AMMO;
|
|
|
|
case WP_SSG3000:
|
|
|
|
return RQ3_SSG3000_AMMO;
|
|
|
|
case WP_MP5:
|
|
|
|
return RQ3_MP5_AMMO;
|
|
|
|
case WP_HANDCANNON:
|
|
|
|
return RQ3_HANDCANNON_AMMO;
|
|
|
|
case WP_M3:
|
|
|
|
return RQ3_M3_AMMO;
|
|
|
|
case WP_AKIMBO:
|
|
|
|
return RQ3_AKIMBO_AMMO;
|
|
|
|
case WP_GRENADE:
|
|
|
|
return RQ3_GRENADE_AMMO;
|
|
|
|
default:
|
|
|
|
return RQ3_PISTOL_AMMO;
|
|
|
|
}
|
2001-06-08 04:47:30 +00:00
|
|
|
}
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
/*
|
|
|
|
================
|
|
|
|
BG_CanItemBeGrabbed
|
|
|
|
|
|
|
|
Returns false if the item should not be picked up.
|
|
|
|
This needs to be the same for client side prediction and server use.
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
qboolean BG_CanItemBeGrabbed(int gametype, const entityState_t * ent, const playerState_t * ps)
|
|
|
|
{
|
|
|
|
gitem_t *item;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->modelindex < 1 || ent->modelindex >= bg_numItems) {
|
|
|
|
Com_Error(ERR_DROP, "BG_CanItemBeGrabbed: index out of range");
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
item = &bg_itemlist[ent->modelindex];
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (item->giType) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case IT_WEAPON:
|
2001-06-18 01:59:58 +00:00
|
|
|
//Elder: gotta check before we can pick it up
|
|
|
|
//if (item->giTag == WP_KNIFE && ps->ammo[WP_KNIFE] >= RQ3_KNIFE_MAXCLIP)
|
2002-06-16 20:06:15 +00:00
|
|
|
//return qfalse;
|
2001-06-19 02:26:18 +00:00
|
|
|
//else
|
|
|
|
//if (item->giTag != WP_KNIFE && ent->pos.trDelta && ent->pos.trDelta[2] != 0)
|
2002-06-16 20:06:15 +00:00
|
|
|
//return qfalse;
|
2001-06-18 01:59:58 +00:00
|
|
|
//else
|
2002-06-16 20:06:15 +00:00
|
|
|
return qtrue; // weapons are always picked up
|
2001-12-17 15:08:34 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
case IT_AMMO:
|
|
|
|
|
|
|
|
//Blaze: pick up all ammo
|
|
|
|
//Blaze: make sure you dont go over max amount of clips
|
|
|
|
//if ( ps->stats[STAT_CLIPS] >= 2)
|
|
|
|
//if ( ps->ammo[ item->giTag ] >= ClipAmountForWeapon(item->giTag )) {
|
|
|
|
//{
|
2002-06-16 20:06:15 +00:00
|
|
|
// return qfalse; // can't hold any more
|
2001-05-06 20:50:27 +00:00
|
|
|
//}
|
|
|
|
return qtrue;
|
|
|
|
|
|
|
|
case IT_ARMOR:
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->stats[STAT_ARMOR] >= 200) { //2 times max healthps->stats[STAT_MAX_HEALTH] * 2 ) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
return qtrue;
|
|
|
|
|
|
|
|
case IT_HEALTH:
|
|
|
|
// small and mega healths will go over the max, otherwise
|
|
|
|
// don't pick up if already at max
|
2002-06-16 20:06:15 +00:00
|
|
|
if (item->quantity == 5 || item->quantity == 100) {
|
|
|
|
if (ps->stats[STAT_HEALTH] >= 200) { //200 is max health x 2 ps->stats[STAT_MAX_HEALTH] * 2 ) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->stats[STAT_HEALTH] >= 100) { //100 is the max health ps->stats[STAT_MAX_HEALTH] ) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
return qtrue;
|
|
|
|
|
|
|
|
case IT_POWERUP:
|
|
|
|
return qtrue; // powerups are always picked up
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
case IT_TEAM: // team items, such as flags
|
|
|
|
if (gametype == GT_CTF) {
|
|
|
|
// ent->modelindex2 is non-zero on items if they are dropped
|
|
|
|
// we need to know this because we can pick up our dropped flag (and return it)
|
|
|
|
// but we can't pick up our flag at base
|
|
|
|
if (ps->persistant[PERS_TEAM] == TEAM_RED) {
|
|
|
|
if (item->giTag == PW_BLUEFLAG ||
|
|
|
|
(item->giTag == PW_REDFLAG && ent->modelindex2) ||
|
|
|
|
(item->giTag == PW_REDFLAG && ps->powerups[PW_BLUEFLAG]))
|
|
|
|
return qtrue;
|
|
|
|
} else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
|
|
|
|
if (item->giTag == PW_REDFLAG ||
|
|
|
|
(item->giTag == PW_BLUEFLAG && ent->modelindex2) ||
|
|
|
|
(item->giTag == PW_BLUEFLAG && ps->powerups[PW_REDFLAG]))
|
|
|
|
return qtrue;
|
|
|
|
}
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return qfalse;
|
|
|
|
|
|
|
|
case IT_HOLDABLE:
|
|
|
|
// can only hold one item at a time
|
2002-10-26 00:37:18 +00:00
|
|
|
// JBravo: I beg to differ
|
|
|
|
/* if (ps->stats[STAT_HOLDABLE_ITEM]) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
2002-10-26 00:37:18 +00:00
|
|
|
} */
|
2001-05-06 20:50:27 +00:00
|
|
|
return qtrue;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
case IT_BAD:
|
|
|
|
Com_Error(ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD");
|
|
|
|
default:
|
2001-08-01 19:52:17 +00:00
|
|
|
#ifndef Q3_VM
|
2002-06-16 20:06:15 +00:00
|
|
|
#ifndef NDEBUG // bk0001204
|
|
|
|
Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType);
|
2001-08-01 19:52:17 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2002-06-16 20:06:15 +00:00
|
|
|
break;
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
BG_EvaluateTrajectory
|
|
|
|
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_EvaluateTrajectory(const trajectory_t * tr, int atTime, vec3_t result)
|
|
|
|
{
|
|
|
|
float deltaTime;
|
|
|
|
float phase;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (tr->trType) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case TR_STATIONARY:
|
|
|
|
case TR_INTERPOLATE:
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(tr->trBase, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_LINEAR:
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) * 0.001; // milliseconds to seconds
|
|
|
|
VectorMA(tr->trBase, deltaTime, tr->trDelta, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_SINE:
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) / (float) tr->trDuration;
|
|
|
|
phase = sin(deltaTime * M_PI * 2);
|
|
|
|
VectorMA(tr->trBase, phase, tr->trDelta, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_LINEAR_STOP:
|
2002-06-16 20:06:15 +00:00
|
|
|
if (atTime > tr->trTime + tr->trDuration) {
|
2001-05-06 20:50:27 +00:00
|
|
|
atTime = tr->trTime + tr->trDuration;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) * 0.001; // milliseconds to seconds
|
|
|
|
if (deltaTime < 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
deltaTime = 0;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorMA(tr->trBase, deltaTime, tr->trDelta, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_GRAVITY:
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) * 0.001; // milliseconds to seconds
|
|
|
|
VectorMA(tr->trBase, deltaTime, tr->trDelta, result);
|
|
|
|
result[2] -= 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-07-21 23:15:13 +00:00
|
|
|
Com_Error(ERR_DROP, "BG_EvaluateTrajectory: unknown trType: %i", tr->trType);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
BG_EvaluateTrajectoryDelta
|
|
|
|
|
|
|
|
For determining velocity at a given time
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_EvaluateTrajectoryDelta(const trajectory_t * tr, int atTime, vec3_t result)
|
|
|
|
{
|
|
|
|
float deltaTime;
|
|
|
|
float phase;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (tr->trType) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case TR_STATIONARY:
|
|
|
|
case TR_INTERPOLATE:
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorClear(result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_LINEAR:
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(tr->trDelta, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_SINE:
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) / (float) tr->trDuration;
|
|
|
|
phase = cos(deltaTime * M_PI * 2); // derivative of sin = cos
|
2001-05-06 20:50:27 +00:00
|
|
|
phase *= 0.5;
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorScale(tr->trDelta, phase, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_LINEAR_STOP:
|
2002-06-16 20:06:15 +00:00
|
|
|
if (atTime > tr->trTime + tr->trDuration) {
|
|
|
|
VectorClear(result);
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(tr->trDelta, result);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case TR_GRAVITY:
|
2002-06-16 20:06:15 +00:00
|
|
|
deltaTime = (atTime - tr->trTime) * 0.001; // milliseconds to seconds
|
|
|
|
VectorCopy(tr->trDelta, result);
|
|
|
|
result[2] -= DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-07-21 23:15:13 +00:00
|
|
|
Com_Error(ERR_DROP, "BG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trType);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *eventnames[] = {
|
|
|
|
"EV_NONE",
|
|
|
|
|
|
|
|
"EV_FOOTSTEP",
|
|
|
|
"EV_FOOTSTEP_METAL",
|
2002-01-24 14:20:53 +00:00
|
|
|
"EV_FOOTSTEP_GRAVEL",
|
2001-08-17 20:48:18 +00:00
|
|
|
"EV_FOOTSTEP_WOOD",
|
|
|
|
"EV_FOOTSTEP_CARPET",
|
|
|
|
"EV_FOOTSTEP_METAL2",
|
2002-01-24 14:20:53 +00:00
|
|
|
"EV_FOOTSTEP_GLASS",
|
|
|
|
"EV_FOOTSTEP_GRASS",
|
|
|
|
"EV_FOOTSTEP_SNOW", // JBravo: adding new sounds
|
|
|
|
"EV_FOOTSTEP_MUD",
|
|
|
|
"EV_FOOTSTEP_WOOD2",
|
|
|
|
"EV_FOOTSTEP_HARDMETAL",
|
2002-04-20 15:05:08 +00:00
|
|
|
//Makro - new sounds
|
|
|
|
"EV_FOOTSTEP_LEAVES",
|
|
|
|
"EV_FOOTSTEP_CEMENT",
|
|
|
|
"EV_FOOTSTEP_MARBLE",
|
|
|
|
"EV_FOOTSTEP_SNOW2",
|
|
|
|
"EV_FOOTSTEP_HARDSTEPS",
|
2002-05-11 19:18:20 +00:00
|
|
|
"EV_FOOTSTEP_SAND",
|
2002-04-20 15:05:08 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_FOOTSPLASH",
|
|
|
|
"EV_FOOTWADE",
|
|
|
|
"EV_SWIM",
|
|
|
|
|
|
|
|
"EV_STEP_4",
|
|
|
|
"EV_STEP_8",
|
|
|
|
"EV_STEP_12",
|
|
|
|
"EV_STEP_16",
|
|
|
|
|
|
|
|
"EV_FALL_SHORT",
|
2001-07-27 00:21:23 +00:00
|
|
|
"EV_FALL_SHORT_NOSOUND",
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_FALL_MEDIUM",
|
2001-07-27 00:21:23 +00:00
|
|
|
"EV_FALL_MEDIUM_NOSOUND",
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_FALL_FAR",
|
2001-07-27 00:21:23 +00:00
|
|
|
"EV_FALL_FAR_NOSOUND",
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_JUMP_PAD", // boing sound at origin", jump sound on player
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
"EV_JUMP",
|
|
|
|
"EV_WATER_TOUCH", // foot touches
|
|
|
|
"EV_WATER_LEAVE", // foot leaves
|
|
|
|
"EV_WATER_UNDER", // head touches
|
|
|
|
"EV_WATER_CLEAR", // head leaves
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_ITEM_PICKUP", // normal item pickups are predictable
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_GLOBAL_ITEM_PICKUP", // powerup / team sounds are broadcast to everyone
|
|
|
|
|
|
|
|
"EV_NOAMMO",
|
|
|
|
"EV_CHANGE_WEAPON",
|
|
|
|
"EV_FIRE_WEAPON",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_RELOAD_WEAPON0", // Elder: reload weapon sounds
|
|
|
|
"EV_RELOAD_WEAPON1", // Elder: reload weapon sounds
|
|
|
|
"EV_RELOAD_WEAPON2", // Elder: reload weapon sounds
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
"EV_USE_ITEM0",
|
|
|
|
"EV_USE_ITEM1",
|
|
|
|
"EV_USE_ITEM2",
|
|
|
|
"EV_USE_ITEM3",
|
|
|
|
"EV_USE_ITEM4",
|
|
|
|
"EV_USE_ITEM5",
|
|
|
|
"EV_USE_ITEM6",
|
|
|
|
"EV_USE_ITEM7",
|
|
|
|
"EV_USE_ITEM8",
|
|
|
|
"EV_USE_ITEM9",
|
|
|
|
"EV_USE_ITEM10",
|
|
|
|
"EV_USE_ITEM11",
|
|
|
|
"EV_USE_ITEM12",
|
|
|
|
"EV_USE_ITEM13",
|
|
|
|
"EV_USE_ITEM14",
|
|
|
|
"EV_USE_ITEM15",
|
|
|
|
|
|
|
|
"EV_ITEM_RESPAWN",
|
|
|
|
"EV_ITEM_POP",
|
|
|
|
"EV_PLAYER_TELEPORT_IN",
|
|
|
|
"EV_PLAYER_TELEPORT_OUT",
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_GRENADE_BOUNCE", // eventParm will be the soundindex
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
"EV_GENERAL_SOUND",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_GLOBAL_SOUND", // no attenuation
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_GLOBAL_TEAM_SOUND",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_RQ3_SOUND", // Elder: play local sounds - primarily for kick
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_DMREWARD", // Duffman: To display exponential reward messages.
|
2001-06-25 23:45:02 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_BULLET_HIT_FLESH",
|
|
|
|
"EV_BULLET_HIT_WALL",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_BULLET_HIT_METAL", // Elder: sparks
|
|
|
|
"EV_BULLET_HIT_KEVLAR", // Elder: sparks
|
|
|
|
"EV_BULLET_HIT_GLASS", // Elder: glass mark
|
|
|
|
"EV_BULLET_HIT_WOOD", // Makro: new sound
|
|
|
|
"EV_BULLET_HIT_BRICK", // Makro: new sound
|
2002-05-12 22:14:13 +00:00
|
|
|
"EV_BULLET_HIT_CERAMIC", // Makro: new sound
|
2003-07-30 16:05:47 +00:00
|
|
|
"EV_BULLET_HIT_SNOW", // Makro: new fx
|
|
|
|
"EV_BULLET_HIT_GRASS", // Makro: new fx
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_SSG3000_HIT_FLESH", // Elder: SSG3000 blood spray
|
|
|
|
"EV_JUMPKICK", // Elder: sound + jumpkick message
|
|
|
|
"EV_EJECTBLOOD", // Elder: when bleeding, every 2s release blood
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
"EV_MISSILE_HIT",
|
|
|
|
"EV_MISSILE_MISS",
|
|
|
|
"EV_MISSILE_MISS_METAL",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_KNIFE_MISS", // Elder: knife slash stuff
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_RAILTRAIL",
|
|
|
|
"EV_SHOTGUN",
|
|
|
|
"EV_HANDCANNON",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_BULLET", // otherEntity is the shooter
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_HEADSHOT", // Elder: spray like SSG shot
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_PAIN",
|
|
|
|
"EV_DEATH1",
|
|
|
|
"EV_DEATH2",
|
|
|
|
"EV_DEATH3",
|
|
|
|
"EV_OBITUARY",
|
2001-06-26 02:06:50 +00:00
|
|
|
//Elder:
|
|
|
|
//Location-specific obits- need separate events b/c you can't stuff >8bits in eventParm
|
|
|
|
"EV_OBITUARY_HEAD",
|
|
|
|
"EV_OBITUARY_CHEST",
|
|
|
|
"EV_OBITUARY_STOMACH",
|
|
|
|
"EV_OBITUARY_LEGS",
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_GIB_PLAYER", // gib a previously living player
|
|
|
|
"EV_BREAK_GLASS1", // Blaze: Breakable glass
|
2001-07-24 01:50:01 +00:00
|
|
|
"EV_BREAK_GLASS2",
|
|
|
|
"EV_BREAK_GLASS3",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_CHIP_GLASS", // Blaze: this even just breaks it a little bit.
|
2002-04-23 06:09:18 +00:00
|
|
|
"EV_PRESSURE_WATER", // NiceAss: Shot an ent under pressure with water
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_SCOREPLUM", // score plum
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_PROXIMITY_MINE_STICK",
|
|
|
|
"EV_PROXIMITY_MINE_TRIGGER",
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_KAMIKAZE", // kamikaze explodes
|
|
|
|
"EV_OBELISKEXPLODE", // obelisk explodes
|
2011-03-07 03:59:31 +00:00
|
|
|
"EV_OBELISKPAIN", // obelisk pain
|
2002-06-16 20:06:15 +00:00
|
|
|
"EV_INVUL_IMPACT", // invulnerability sphere impact
|
|
|
|
"EV_JUICED", // invulnerability juiced effect
|
|
|
|
"EV_LIGHTNINGBOLT", // lightning bolt bounced of invulnerability sphere
|
2001-05-06 20:50:27 +00:00
|
|
|
"EV_DEBUG_LINE",
|
|
|
|
"EV_STOPLOOPINGSOUND",
|
2011-03-07 03:59:31 +00:00
|
|
|
"EV_TAUNT",
|
|
|
|
"EV_TAUNT_YES",
|
|
|
|
"EV_TAUNT_NO",
|
|
|
|
"EV_TAUNT_FOLLOWME",
|
|
|
|
"EV_TAUNT_GETFLAG",
|
|
|
|
"EV_TAUNT_GUARDBASE",
|
|
|
|
"EV_TAUNT_PATROL"
|
2001-05-06 20:50:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
BG_AddPredictableEventToPlayerstate
|
|
|
|
|
|
|
|
Handles the sequence numbers
|
|
|
|
===============
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void trap_Cvar_VariableStringBuffer(const char *var_name, char *buffer, int bufsize);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_AddPredictableEventToPlayerstate(int newEvent, int eventParm, playerState_t * ps)
|
|
|
|
{
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
{
|
|
|
|
char buf[256];
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("showevents", buf, sizeof(buf));
|
2002-06-16 20:06:15 +00:00
|
|
|
if (atof(buf) != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
#ifdef QAGAME
|
2002-06-16 20:06:15 +00:00
|
|
|
Com_Printf(" game event svt %5d -> %5d: num = %20s parm %d\n",
|
|
|
|
ps->pmove_framecount /*ps->commandTime */ , ps->eventSequence, eventnames[newEvent],
|
|
|
|
eventParm);
|
2001-05-06 20:50:27 +00:00
|
|
|
#else
|
2002-06-16 20:06:15 +00:00
|
|
|
Com_Printf("Cgame event svt %5d -> %5d: num = %20s parm %d\n",
|
|
|
|
ps->pmove_framecount /*ps->commandTime */ , ps->eventSequence, eventnames[newEvent],
|
|
|
|
eventParm);
|
2001-05-06 20:50:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2002-06-16 20:06:15 +00:00
|
|
|
ps->events[ps->eventSequence & (MAX_PS_EVENTS - 1)] = newEvent;
|
|
|
|
ps->eventParms[ps->eventSequence & (MAX_PS_EVENTS - 1)] = eventParm;
|
2001-05-06 20:50:27 +00:00
|
|
|
ps->eventSequence++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
BG_TouchJumpPad
|
|
|
|
========================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_TouchJumpPad(playerState_t * ps, entityState_t * jumppad)
|
|
|
|
{
|
2001-05-06 20:50:27 +00:00
|
|
|
int effectNum;
|
|
|
|
|
|
|
|
// spectators don't use jump pads
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->pm_type != PM_NORMAL) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-07-22 06:35:03 +00:00
|
|
|
|
2002-05-29 13:49:26 +00:00
|
|
|
//Makro - disable all this for bot only triggers
|
|
|
|
if (!jumppad->powerups) {
|
|
|
|
// if we didn't hit this same jumppad the previous frame
|
|
|
|
// then don't play the event sound again if we are in a fat trigger
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->jumppad_ent != jumppad->number) {
|
|
|
|
|
2002-05-29 13:49:26 +00:00
|
|
|
/*
|
2002-06-16 20:06:15 +00:00
|
|
|
vectoangles( jumppad->origin2, angles);
|
|
|
|
p = fabs( AngleNormalize180( angles[PITCH] ) );
|
|
|
|
if( p < 45 ) {
|
|
|
|
effectNum = 0;
|
|
|
|
} else {
|
|
|
|
effectNum = 1;
|
|
|
|
}
|
|
|
|
*/
|
2002-05-29 13:49:26 +00:00
|
|
|
// NiceAss: For cutsom sounds...
|
|
|
|
effectNum = jumppad->generic1;
|
2002-06-16 20:06:15 +00:00
|
|
|
BG_AddPredictableEventToPlayerstate(EV_JUMP_PAD, effectNum, ps);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// remember hitting this jumppad this frame
|
|
|
|
ps->jumppad_ent = jumppad->number;
|
|
|
|
ps->jumppad_frame = ps->pmove_framecount;
|
|
|
|
// give the player the velocity from the jumppad
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(jumppad->origin2, ps->velocity);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
BG_PlayerStateToEntityState
|
|
|
|
|
|
|
|
This is done after each set of usercmd_t on the server,
|
|
|
|
and after local prediction on the client
|
|
|
|
========================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_PlayerStateToEntityState(playerState_t * ps, entityState_t * s, qboolean snap)
|
|
|
|
{
|
|
|
|
int i;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eType = ET_INVISIBLE;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (ps->stats[STAT_HEALTH] <= GIB_HEALTH) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eType = ET_INVISIBLE;
|
|
|
|
} else {
|
|
|
|
s->eType = ET_PLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
s->number = ps->clientNum;
|
|
|
|
|
|
|
|
s->pos.trType = TR_INTERPOLATE;
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->origin, s->pos.trBase);
|
|
|
|
if (snap) {
|
|
|
|
SnapVector(s->pos.trBase);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// set the trDelta for flag direction
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->velocity, s->pos.trDelta);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
s->apos.trType = TR_INTERPOLATE;
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->viewangles, s->apos.trBase);
|
|
|
|
if (snap) {
|
|
|
|
SnapVector(s->apos.trBase);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s->angles2[YAW] = ps->movementDir;
|
|
|
|
s->legsAnim = ps->legsAnim;
|
|
|
|
s->torsoAnim = ps->torsoAnim;
|
2002-06-16 20:06:15 +00:00
|
|
|
s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
|
|
|
|
// so corpses can also reference the proper config
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eFlags = ps->eFlags;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->stats[STAT_HEALTH] <= 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eFlags |= EF_DEAD;
|
|
|
|
} else {
|
|
|
|
s->eFlags &= ~EF_DEAD;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->externalEvent) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->event = ps->externalEvent;
|
|
|
|
s->eventParm = ps->externalEventParm;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (ps->entityEventSequence < ps->eventSequence) {
|
|
|
|
int seq;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
seq = ps->entityEventSequence & (MAX_PS_EVENTS - 1);
|
|
|
|
s->event = ps->events[seq] | ((ps->entityEventSequence & 3) << 8);
|
|
|
|
s->eventParm = ps->eventParms[seq];
|
2001-08-01 19:52:17 +00:00
|
|
|
ps->entityEventSequence++;
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s->weapon = ps->weapon;
|
|
|
|
s->groundEntityNum = ps->groundEntityNum;
|
|
|
|
|
|
|
|
s->powerups = 0;
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < MAX_POWERUPS; i++) {
|
|
|
|
if (ps->powerups[i]) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->powerups |= 1 << i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->loopSound = ps->loopSound;
|
|
|
|
s->generic1 = ps->generic1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
BG_PlayerStateToEntityStateExtraPolate
|
|
|
|
|
|
|
|
This is done after each set of usercmd_t on the server,
|
|
|
|
and after local prediction on the client
|
|
|
|
========================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void BG_PlayerStateToEntityStateExtraPolate(playerState_t * ps, entityState_t * s, int time, qboolean snap)
|
|
|
|
{
|
|
|
|
int i;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eType = ET_INVISIBLE;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (ps->stats[STAT_HEALTH] <= GIB_HEALTH) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eType = ET_INVISIBLE;
|
|
|
|
} else {
|
|
|
|
s->eType = ET_PLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
s->number = ps->clientNum;
|
|
|
|
|
|
|
|
s->pos.trType = TR_LINEAR_STOP;
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->origin, s->pos.trBase);
|
|
|
|
if (snap) {
|
|
|
|
SnapVector(s->pos.trBase);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// set the trDelta for flag direction and linear prediction
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->velocity, s->pos.trDelta);
|
2001-05-06 20:50:27 +00:00
|
|
|
// set the time for linear prediction
|
|
|
|
s->pos.trTime = time;
|
|
|
|
// set maximum extra polation time
|
2002-06-16 20:06:15 +00:00
|
|
|
s->pos.trDuration = 50; // 1000 / sv_fps (default = 20)
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
s->apos.trType = TR_INTERPOLATE;
|
2002-06-16 20:06:15 +00:00
|
|
|
VectorCopy(ps->viewangles, s->apos.trBase);
|
|
|
|
if (snap) {
|
|
|
|
SnapVector(s->apos.trBase);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s->angles2[YAW] = ps->movementDir;
|
|
|
|
s->legsAnim = ps->legsAnim;
|
|
|
|
s->torsoAnim = ps->torsoAnim;
|
2002-06-16 20:06:15 +00:00
|
|
|
s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
|
|
|
|
// so corpses can also reference the proper config
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eFlags = ps->eFlags;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->stats[STAT_HEALTH] <= 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->eFlags |= EF_DEAD;
|
|
|
|
} else {
|
|
|
|
s->eFlags &= ~EF_DEAD;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->externalEvent) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->event = ps->externalEvent;
|
|
|
|
s->eventParm = ps->externalEventParm;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (ps->entityEventSequence < ps->eventSequence) {
|
|
|
|
int seq;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
seq = ps->entityEventSequence & (MAX_PS_EVENTS - 1);
|
|
|
|
s->event = ps->events[seq] | ((ps->entityEventSequence & 3) << 8);
|
|
|
|
s->eventParm = ps->eventParms[seq];
|
2001-08-01 19:52:17 +00:00
|
|
|
ps->entityEventSequence++;
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s->weapon = ps->weapon;
|
|
|
|
s->groundEntityNum = ps->groundEntityNum;
|
|
|
|
|
|
|
|
s->powerups = 0;
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < MAX_POWERUPS; i++) {
|
|
|
|
if (ps->powerups[i]) {
|
2001-05-06 20:50:27 +00:00
|
|
|
s->powerups |= 1 << i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->loopSound = ps->loopSound;
|
|
|
|
s->generic1 = ps->generic1;
|
|
|
|
}
|
2002-04-30 11:54:37 +00:00
|
|
|
|
|
|
|
//Makro - weapon string aliases
|
|
|
|
|
|
|
|
typedef struct {
|
2002-06-16 20:06:15 +00:00
|
|
|
const char *name;
|
|
|
|
weapon_t weapon;
|
2002-04-30 11:54:37 +00:00
|
|
|
} weaponAlias_t;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
weaponAlias_t weaponAliases[] = {
|
|
|
|
{RQ3_PISTOL_NAME, WP_PISTOL},
|
|
|
|
{"pistol", WP_PISTOL},
|
|
|
|
{"mk23", WP_PISTOL},
|
|
|
|
{RQ3_M3_NAME, WP_M3},
|
|
|
|
{"m3", WP_M3},
|
|
|
|
{"shotgun", WP_M3},
|
|
|
|
{RQ3_HANDCANNON_NAME, WP_HANDCANNON},
|
|
|
|
{"hc", WP_HANDCANNON},
|
|
|
|
{RQ3_M4_NAME, WP_M4},
|
|
|
|
{"m4", WP_M4},
|
|
|
|
{RQ3_MP5_NAME, WP_MP5},
|
|
|
|
{"mp5", WP_MP5},
|
|
|
|
{"mp5/10", WP_MP5},
|
|
|
|
{RQ3_SSG3000_NAME, WP_SSG3000},
|
|
|
|
{"sniper", WP_SSG3000},
|
|
|
|
{"ssg3000", WP_SSG3000},
|
|
|
|
{"ssg 3000", WP_SSG3000},
|
|
|
|
{"ssg", WP_SSG3000},
|
|
|
|
{RQ3_AKIMBO_NAME, WP_AKIMBO},
|
|
|
|
{"akimbo", WP_AKIMBO},
|
|
|
|
{RQ3_KNIFE_NAME, WP_KNIFE},
|
|
|
|
{"knife", WP_KNIFE},
|
|
|
|
{"knives", WP_KNIFE},
|
|
|
|
{RQ3_GRENADE_NAME, WP_GRENADE},
|
|
|
|
{"grenade", WP_GRENADE},
|
|
|
|
{"grenades", WP_GRENADE},
|
|
|
|
{NULL, WP_PISTOL}
|
2002-04-30 11:54:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define num_weapon_aliases 25
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
weapon_t CharToWeapon(char *name, weapon_t defweapon)
|
|
|
|
{
|
2002-04-30 11:54:37 +00:00
|
|
|
int i;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!name)
|
|
|
|
return defweapon;
|
2002-04-30 11:54:37 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; weaponAliases[i].name != NULL; i++) {
|
|
|
|
if (!Q_stricmp(name, weaponAliases[i].name))
|
2002-04-30 11:54:37 +00:00
|
|
|
return weaponAliases[i].weapon;
|
|
|
|
}
|
|
|
|
|
|
|
|
return defweapon;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Makro - item string aliases
|
|
|
|
|
|
|
|
typedef struct {
|
2002-06-16 20:06:15 +00:00
|
|
|
const char *name;
|
|
|
|
holdable_t item;
|
2002-04-30 11:54:37 +00:00
|
|
|
} itemAlias_t;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
itemAlias_t itemAliases[] = {
|
|
|
|
{RQ3_SLIPPERS_NAME, HI_SLIPPERS},
|
|
|
|
{"slippers", HI_SLIPPERS},
|
|
|
|
{RQ3_KEVLAR_NAME, HI_KEVLAR},
|
|
|
|
{"vest", HI_KEVLAR},
|
|
|
|
{"kevlar", HI_KEVLAR},
|
|
|
|
{RQ3_BANDOLIER_NAME, HI_BANDOLIER},
|
|
|
|
{RQ3_LASER_NAME, HI_LASER},
|
|
|
|
{"laser", HI_LASER},
|
|
|
|
{RQ3_SILENCER_NAME, HI_SILENCER},
|
2002-10-30 20:04:34 +00:00
|
|
|
{RQ3_HELMET_NAME, HI_HELMET},
|
|
|
|
{"helmet", HI_HELMET},
|
2002-06-16 20:06:15 +00:00
|
|
|
{NULL, HI_KEVLAR}
|
2002-04-30 11:54:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define num_item_aliases 9
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
holdable_t CharToItem(char *name, holdable_t defitem)
|
|
|
|
{
|
2002-04-30 11:54:37 +00:00
|
|
|
int i;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!name)
|
|
|
|
return defitem;
|
2002-04-30 11:54:37 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; itemAliases[i].name != NULL; i++) {
|
|
|
|
if (!Q_stricmp(name, itemAliases[i].name))
|
2002-04-30 11:54:37 +00:00
|
|
|
return itemAliases[i].item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return defitem;
|
|
|
|
}
|
|
|
|
|
2002-05-11 19:18:20 +00:00
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
Surfaceparm stuff
|
|
|
|
=====================
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
int MatFlags[] = {
|
2002-05-11 19:18:20 +00:00
|
|
|
SURF_METALSTEPS,
|
|
|
|
SURF_GRAVEL,
|
|
|
|
SURF_WOOD,
|
|
|
|
SURF_CARPET,
|
|
|
|
SURF_METAL2,
|
|
|
|
SURF_GLASS,
|
|
|
|
SURF_GRASS,
|
|
|
|
SURF_SNOW,
|
|
|
|
SURF_MUD,
|
|
|
|
SURF_WOOD2,
|
|
|
|
SURF_HARDMETAL
|
|
|
|
};
|
|
|
|
|
2005-02-15 16:33:39 +00:00
|
|
|
#define MAT_FLAG_COUNT 5
|
2002-05-11 19:18:20 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
int GetMaterialFromFlag(int flag)
|
|
|
|
{
|
2002-05-11 19:18:20 +00:00
|
|
|
int Material = 0;
|
|
|
|
int i = 0;
|
|
|
|
|
2005-02-15 16:33:39 +00:00
|
|
|
for (i = 0; i < MAT_FLAG_COUNT; i++) {
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((flag & MatFlags[i])) {
|
2002-05-11 19:18:20 +00:00
|
|
|
Material += (1 << i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Material;
|
|
|
|
}
|
|
|
|
|
2003-03-28 22:26:24 +00:00
|
|
|
//Makro - added
|
2003-03-29 23:04:56 +00:00
|
|
|
/* char *modelFromStr(char *s)
|
2003-03-28 22:26:24 +00:00
|
|
|
{
|
|
|
|
char *p, *out = s;
|
|
|
|
if (!s)
|
|
|
|
return NULL;
|
2011-07-11 19:05:03 +00:00
|
|
|
if ((p = strrchr(s, '/')) != NULL)
|
2003-03-28 22:26:24 +00:00
|
|
|
{
|
|
|
|
*p=0;
|
|
|
|
out=va("%s", s);
|
|
|
|
*p='/';
|
|
|
|
}
|
|
|
|
return out;
|
2003-03-29 23:04:56 +00:00
|
|
|
} */
|
2003-03-28 22:26:24 +00:00
|
|
|
|
2003-03-29 23:04:56 +00:00
|
|
|
/*char *skinFromStr(char *s)
|
2003-03-28 22:26:24 +00:00
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
if (!s)
|
|
|
|
return NULL;
|
|
|
|
if (!*s)
|
|
|
|
return va("");
|
2011-07-11 19:05:03 +00:00
|
|
|
if ((p = strrchr(s, '/')) != NULL)
|
2003-03-28 22:26:24 +00:00
|
|
|
return p+1;
|
|
|
|
return va("default");
|
2003-03-29 23:04:56 +00:00
|
|
|
} */
|
|
|
|
|
|
|
|
// NiceAss: rewriting to avoid va() overriting data.
|
|
|
|
char *modelFromStr(char *s)
|
|
|
|
{
|
|
|
|
static char buffer[128];
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (!s)
|
|
|
|
return NULL;
|
2005-02-15 16:33:39 +00:00
|
|
|
strncpy(buffer, s, sizeof(buffer));
|
2011-07-11 19:05:03 +00:00
|
|
|
if ((p = strrchr(buffer, '/')) != NULL)
|
2003-03-29 23:04:56 +00:00
|
|
|
*p = '\0';
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *skinFromStr(char *s)
|
|
|
|
{
|
|
|
|
static char buffer[128];
|
|
|
|
char *p;
|
|
|
|
|
2005-02-15 16:33:39 +00:00
|
|
|
memset(buffer, 0, sizeof(buffer));
|
2003-03-29 23:04:56 +00:00
|
|
|
if (!s)
|
|
|
|
return NULL;
|
|
|
|
if (!*s)
|
|
|
|
return buffer;
|
|
|
|
strncpy(buffer, s, 128);
|
2011-07-11 19:05:03 +00:00
|
|
|
if ((p = strrchr(buffer, '/')) != NULL)
|
2003-03-29 23:04:56 +00:00
|
|
|
return p+1;
|
|
|
|
strcpy(buffer, "default");
|
|
|
|
return buffer;
|
2003-03-28 22:26:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *strchrstr(char *s, char *chars)
|
|
|
|
{
|
|
|
|
if (!s || !chars)
|
|
|
|
return NULL;
|
|
|
|
while (*s)
|
|
|
|
if (strchr(chars, *s))
|
|
|
|
return s;
|
|
|
|
else
|
|
|
|
s++;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-03-31 21:04:24 +00:00
|
|
|
char *strins(char *dest, char *s)
|
|
|
|
{
|
|
|
|
int i, l1 = strlen(dest), l2 = strlen(s);
|
|
|
|
|
|
|
|
for (i=l1; i>=0; i--)
|
|
|
|
dest[i+l2]=dest[i];
|
|
|
|
for (i=0; i<l2; i++)
|
|
|
|
dest[i]=s[i];
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *Q_strins(char *dest, char *s, int size)
|
|
|
|
{
|
|
|
|
int l1, l2, i;
|
|
|
|
|
|
|
|
if (!dest || !s)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
l1 = strlen(dest);
|
|
|
|
l2 = strlen(s);
|
|
|
|
|
|
|
|
if (l2+1 > size)
|
|
|
|
l2 = size - 1;
|
|
|
|
|
|
|
|
if (l1+l2+1 > size)
|
|
|
|
{
|
|
|
|
l1 = size - l2 - 1;
|
|
|
|
dest[l1]=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=l1; i>=0; i--)
|
|
|
|
dest[i+l2]=dest[i];
|
|
|
|
for (i=0; i<l2; i++)
|
|
|
|
dest[i]=s[i];
|
|
|
|
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
2005-09-07 20:27:42 +00:00
|
|
|
|
|
|
|
//Makro - used for saving ints to char buffers
|
|
|
|
//not doing this as a simple assignment because
|
|
|
|
//of endianness (darned Mac users)
|
|
|
|
void SetIntBytes(int i, char *buf, char count)
|
|
|
|
{
|
|
|
|
while (count--)
|
|
|
|
{
|
|
|
|
*buf++ = i & 255;
|
|
|
|
i >>= 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetIntBytes(char *buf, char count)
|
|
|
|
{
|
|
|
|
int rez = 0, shift = 0;
|
|
|
|
while (count--)
|
|
|
|
{
|
|
|
|
rez |= (*buf << shift);
|
|
|
|
shift += 8;
|
|
|
|
}
|
|
|
|
return rez;
|
|
|
|
}
|
|
|
|
|
2006-04-14 18:16:31 +00:00
|
|
|
/*
|
|
|
|
====================================================
|
|
|
|
IdMatchesString
|
|
|
|
|
|
|
|
Returns 1 if any of the tokens in the first string
|
|
|
|
matches any of the tokens in the second string
|
|
|
|
|
|
|
|
Added by Makro
|
|
|
|
====================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define IS_DELIM(x) ((x)==',' || (x)==' ' || (x)=='\t')
|
|
|
|
#define SKIP_DELIM(s) while (IS_DELIM(*(s))) (s)++
|
|
|
|
|
|
|
|
qboolean IdMatchesString(const char *id, const char *match)
|
|
|
|
{
|
|
|
|
const char *tok1, *tok2;
|
|
|
|
|
|
|
|
// iterate through all the tokens in "id"
|
|
|
|
while (id && *id)
|
|
|
|
{
|
|
|
|
int len1;
|
|
|
|
const char *tomatch = match;
|
|
|
|
|
|
|
|
// find the end of the current token
|
|
|
|
for (tok1=id, len1=0; *tok1 && !IS_DELIM(*tok1); tok1++, len1++) {}
|
|
|
|
// skip all delimiters
|
|
|
|
SKIP_DELIM(tok1);
|
|
|
|
|
|
|
|
// iterate through all the tokens in "match"
|
|
|
|
while (match && *match)
|
|
|
|
{
|
|
|
|
int len2;
|
|
|
|
char ok = 1;
|
|
|
|
|
|
|
|
// find the end of the current token
|
|
|
|
for (tok2=match, len2=0; *tok2 && !IS_DELIM(*tok2); tok2++, len2++)
|
|
|
|
{
|
|
|
|
if (ok)
|
|
|
|
if (len2 > len1 || toupper(*tok2) != toupper(id[len2]))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
// skip all delimiters
|
|
|
|
SKIP_DELIM(tok2);
|
|
|
|
|
|
|
|
if (len1 == len2 && ok)
|
|
|
|
return qtrue;
|
|
|
|
// fetch next token in "match"
|
|
|
|
match = tok2;
|
|
|
|
}
|
|
|
|
// restore "match" string
|
|
|
|
match = tomatch;
|
|
|
|
|
|
|
|
// fetch next token in "id"
|
|
|
|
id = tok1;
|
|
|
|
}
|
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float SawTooth(int time, int period)
|
|
|
|
{
|
|
|
|
if (period <= 0)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((time / period) & 1)
|
|
|
|
return (time % period) / ((float)period);
|
|
|
|
else
|
|
|
|
return 1.0f - (time % period) / ((float)period);
|
|
|
|
}
|
|
|
|
}
|
2011-03-10 18:52:13 +00:00
|
|
|
|
|
|
|
float SmoothLerp(float x)
|
|
|
|
{
|
|
|
|
return x * x * (3.f - 2.f * x);
|
|
|
|
}
|