Code for 0-12-00 VMs
Server-side
Yes, there is some bot code updates =)
This commit is contained in:
Victor Chow 2001-09-11 00:12:29 +00:00
parent 1b12240f15
commit c0bef62b6e
13 changed files with 304 additions and 167 deletions

View file

@ -1282,7 +1282,7 @@ int BotSelectActivateWeapon(bot_state_t *bs) {
//
if (bs->inventory[INVENTORY_PISTOL] > 0 && bs->inventory[INVENTORY_PISTOLAMMO] > 0)
return WEAPONINDEX_PISTOL;
else if (bs->inventory[INVENTORY_M3] > 0 && bs->inventory[INVENTORY_SHOTGUNAMMO] > 0)
else if (bs->inventory[INVENTORY_M3] > 0 && bs->inventory[INVENTORY_M3AMMO] > 0)
return WEAPONINDEX_M3;
else if (bs->inventory[INVENTORY_M4] > 0 && bs->inventory[INVENTORY_M4AMMO] > 0)
return WEAPONINDEX_M4;
@ -1296,8 +1296,10 @@ int BotSelectActivateWeapon(bot_state_t *bs) {
#endif
else if (bs->inventory[INVENTORY_SSG3000] > 0 && bs->inventory[INVENTORY_SSG3000AMMO] > 0)
return WEAPONINDEX_SSG3000;
else if (bs->inventory[INVENTORY_HANDCANNON] > 0 && bs->inventory[INVENTORY_SHOTGUNAMMO] > 0)
else if (bs->inventory[INVENTORY_HANDCANNON] > 0 && bs->inventory[INVENTORY_M3AMMO] > 0)
return WEAPONINDEX_HANDCANNON;
else if (bs->inventory[INVENTORY_AKIMBO] > 0 && bs->inventory[INVENTORY_AKIMBOAMMO] > 0)
return WEAPONINDEX_AKIMBO;
else {
return -1;
}

View file

@ -1709,7 +1709,7 @@ void BotUpdateInventory(bot_state_t *bs) {
bs->inventory[INVENTORY_ARMOR] = bs->cur_ps.stats[STAT_ARMOR];
//weapons
//Blaze: Reaction Weapons
bs->inventory[INVENTORY_KNIFE] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE)) !=0;
bs->inventory[INVENTORY_KNIFE] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE)) != 0;
bs->inventory[INVENTORY_PISTOL] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_PISTOL)) != 0;
bs->inventory[INVENTORY_M4] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_M4)) != 0;
bs->inventory[INVENTORY_SSG3000] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_SSG3000)) != 0;
@ -1725,8 +1725,8 @@ void BotUpdateInventory(bot_state_t *bs) {
bs->inventory[INVENTORY_SSG3000AMMO] = bs->cur_ps.ammo[WP_SSG3000];
bs->inventory[INVENTORY_MP5AMMO] = bs->cur_ps.ammo[WP_MP5];
//Blaze: Same ammo for shotgun and handcannon
bs->inventory[INVENTORY_SHOTGUNAMMO] = bs->cur_ps.ammo[WP_HANDCANNON];
bs->inventory[INVENTORY_SHOTGUNAMMO] = bs->cur_ps.ammo[WP_M3];
bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_HANDCANNON];
bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_M3];
//Blaze: Same ammo for Pistol and Akimbo Pistols
bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_AKIMBO];
bs->inventory[INVENTORY_GRENADEAMMO] = bs->cur_ps.ammo[WP_GRENADE];
@ -1734,8 +1734,8 @@ void BotUpdateInventory(bot_state_t *bs) {
// bs->inventory[INVENTORY_BFGAMMO] = bs->cur_ps.ammo[WP_BFG];
//powerups
bs->inventory[INVENTORY_HEALTH] = bs->cur_ps.stats[STAT_HEALTH];
bs->inventory[INVENTORY_TELEPORTER] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_TELEPORTER;
bs->inventory[INVENTORY_MEDKIT] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_MEDKIT;
//bs->inventory[INVENTORY_TELEPORTER] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_TELEPORTER;
//bs->inventory[INVENTORY_MEDKIT] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_MEDKIT;
#ifdef MISSIONPACK
bs->inventory[INVENTORY_KAMIKAZE] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_KAMIKAZE;
bs->inventory[INVENTORY_PORTAL] = bs->cur_ps.stats[STAT_HOLDABLE_ITEM] == MODELINDEX_PORTAL;
@ -2192,13 +2192,16 @@ float BotAggression(bot_state_t *bs) {
//if the bot is very low on health
if (bs->inventory[INVENTORY_HEALTH] < 60) return 0;
//if the bot is low on health
// Elder: ignore armor checks
/*
if (bs->inventory[INVENTORY_HEALTH] < 80) {
//if the bot has insufficient armor
if (bs->inventory[INVENTORY_ARMOR] < 40) return 0;
}
//if the bot can use the Hand cannon
*/
//if the bot can use the Handcannon
if (bs->inventory[INVENTORY_HANDCANNON] > 0 &&
bs->inventory[INVENTORY_SHOTGUNAMMO] > 2) return 100;
bs->inventory[INVENTORY_HANDCANNONAMMO] >= 2) return 100;
//if the bot can use the Sniper
if (bs->inventory[INVENTORY_SSG3000] > 0 &&
bs->inventory[INVENTORY_SSG3000] > 3) return 95;
@ -2210,10 +2213,13 @@ float BotAggression(bot_state_t *bs) {
bs->inventory[INVENTORY_M4AMMO] > 5) return 90;
//if the bot can use the plasmagun
if (bs->inventory[INVENTORY_M3] > 0 &&
bs->inventory[INVENTORY_SHOTGUNAMMO] > 4) return 85;
bs->inventory[INVENTORY_M3AMMO] > 4) return 85;
//if the bot can use the grenade launcher
if (bs->inventory[INVENTORY_GRENADE] > 0 &&
bs->inventory[INVENTORY_GRENADE] > 2) return 80;
// if the bot can use akimbos
if (bs->inventory[INVENTORY_AKIMBO] > 0 &&
bs->inventory[INVENTORY_AKIMBOAMMO] > 4) return 80;
//if the bot can use the shotgun
//if (bs->inventory[INVENTORY_SHOTGUN] > 0 &&
// bs->inventory[INVENTORY_SHELLS] > 10) return 50;
@ -2419,7 +2425,7 @@ int BotHasPersistantPowerupAndWeapon(bot_state_t *bs) {
bs->inventory[INVENTORY_MP5AMMO] > 50) return qtrue;
//if the bot can use the rocketlauncher
if (bs->inventory[INVENTORY_HANDCANNON] > 0 &&
bs->inventory[INVENTORY_SHOTGUNAMMO] > 5) return qtrue;
bs->inventory[INVENTORY_M3AMMO] > 5) return qtrue;
//
/*if (bs->inventory[INVENTORY_NAILGUN] > 0 &&
bs->inventory[INVENTORY_NAILS] > 5) return qtrue;
@ -2496,9 +2502,10 @@ int BotWantsToCamp(bot_state_t *bs) {
//if the bot isn't healthy anough
if (BotAggression(bs) < 50) return qfalse;
//the bot should have at least have the rocket launcher, the railgun or the bfg10k with some ammo
if ((bs->inventory[INVENTORY_HANDCANNON] <= 0 || bs->inventory[INVENTORY_SHOTGUNAMMO < 10]) &&
// Elder: changed a few of the numbers
if ((bs->inventory[INVENTORY_HANDCANNON] <= 0 || bs->inventory[INVENTORY_M3AMMO < 5]) &&
(bs->inventory[INVENTORY_M4] <= 0 || bs->inventory[INVENTORY_M4AMMO] < 10) &&
(bs->inventory[INVENTORY_SSG3000] <= 0 || bs->inventory[INVENTORY_SSG3000AMMO] < 10)) {
(bs->inventory[INVENTORY_SSG3000] <= 0 || bs->inventory[INVENTORY_SSG3000AMMO] < 6)) {
return qfalse;
}
//find the closest camp spot

View file

@ -416,24 +416,6 @@ gitem_t bg_itemlist[] =
/* sounds */ //""
// },
//Elder: just leaving this in for now
/*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
*/
{
"ammo_rockets",
"sound/misc/am_pkup.wav",
{ "models/ammo/m3.md3",
0, 0, 0},
/* icon */ "icons/icona_shells",
/* pickup */ "Shotgun Shells",
7,
IT_AMMO,
//Blaze: Changed from WP_ROCKET_LAUNCHER to WP_SHOTGUN
WP_M3,
/* precache */ "",
/* sounds */ ""
},
/*QUAKED ammo_m4 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
*/
{

View file

@ -1842,8 +1842,12 @@ static void PM_BeginWeaponChange( int weapon ) {
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_StartWeaponAnim(WP_ANIM_DISARM);
else if (pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_StartWeaponAnim(WP_ANIM_THROWDISARM);
}
// Elder: cancel reload stuff here
@ -1860,8 +1864,12 @@ static void PM_BeginWeaponChange( int weapon ) {
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_StartWeaponAnim(WP_ANIM_DISARM);
else if (pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_StartWeaponAnim(WP_ANIM_THROWDISARM);
PM_StartTorsoAnim( TORSO_DROP );
}
@ -1937,8 +1945,12 @@ static void PM_FinishWeaponChange( void ) {
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_StartWeaponAnim(WP_ANIM_ACTIVATE);
else if (pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_StartWeaponAnim(WP_ANIM_THROWACTIVATE);
PM_StartTorsoAnim( TORSO_RAISE );
@ -1961,13 +1973,20 @@ static void PM_TorsoAnimation( void ) {
// QUARANTINE - Weapon Animation
// Should always draw the weapon when it is just ready
//Elder: temp hack
if (pm->ps->weapon == WP_PISTOL ||
if (pm->ps->ammo[pm->ps->weapon] == 0)
PM_ContinueWeaponAnim( WP_ANIM_EMPTY );
else if (pm->ps->weapon == WP_PISTOL ||
pm->ps->weapon == WP_M3 ||
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
PM_ContinueWeaponAnim( WP_ANIM_IDLE );
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_ContinueWeaponAnim(WP_ANIM_IDLE);
else if (pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_ContinueWeaponAnim(WP_ANIM_THROWIDLE);
// PM_ContinueWeaponAnim( WP_ANIM_READY );
return;
@ -2070,7 +2089,7 @@ static void PM_Reload( void )
if (pm->ps->stats[STAT_RELOADTIME] > 0) {
if ( pm->ps->stats[STAT_RQ3] & RQ3_LOCKRELOADS )
{
Com_Printf("============= Locked out in fast-reload interrupt\n");
//Com_Printf("============= Locked out in fast-reload interrupt\n");
}
else
{
@ -2082,7 +2101,7 @@ static void PM_Reload( void )
// add to reload queue and enable fast-reloads flag
pm->ps->stats[STAT_RQ3] |= RQ3_FASTRELOADS;
pm->ps->stats[STAT_RELOADATTEMPTS]++;
Com_Printf("======== Reload attempts: %i ========\n", pm->ps->stats[STAT_RELOADATTEMPTS]);
//Com_Printf("======== Reload attempts: %i ========\n", pm->ps->stats[STAT_RELOADATTEMPTS]);
}
return;
}
@ -2223,19 +2242,19 @@ static void PM_Reload( void )
if (pm->ps->stats[STAT_CLIPS] > 0)
{
Com_Printf("Sending event from continuous fast-reloads\n");
//Com_Printf("Sending event from continuous fast-reloads\n");
PM_AddEvent(EV_RELOAD_WEAPON2);
}
else
{
Com_Printf("Negative event prevented\n");
//Com_Printf("Negative event prevented\n");
pm->ps->stats[STAT_RELOADATTEMPTS] = 0;
}
}
else
{
Com_Printf("============= Locked out in continuous fast-reloads\n");
//Com_Printf("============= Locked out in continuous fast-reloads\n");
}
// finishing up fast reloads
@ -2251,7 +2270,7 @@ static void PM_Reload( void )
pm->ps->stats[STAT_RQ3] &= ~RQ3_FASTRELOADS;
// lock fast-reloads during finish delay
pm->ps->stats[STAT_RQ3] |= RQ3_LOCKRELOADS;
Com_Printf("<<<<<<<<<<<<< Locking\n");
//Com_Printf("<<<<<<<<<<<<< Locking\n");
}
return;
@ -2263,12 +2282,12 @@ static void PM_Reload( void )
// unlock
if (pm->ps->stats[STAT_RQ3] & RQ3_LOCKRELOADS)
{
Com_Printf(">>>>>>>>>>>>> Unlocking\n");
//Com_Printf(">>>>>>>>>>>>> Unlocking\n");
pm->ps->stats[STAT_RQ3] &= ~RQ3_LOCKRELOADS;
}
else
{
Com_Printf("Sending event from normal reload\n");
//Com_Printf("Sending event from normal reload\n");
PM_AddEvent(EV_RELOAD_WEAPON2);
}
@ -2428,14 +2447,23 @@ static void PM_Weapon( void ) {
else
{
//Elder: temp hack
if (pm->ps->weaponstate == WEAPON_READY &&
(pm->ps->weapon == WP_PISTOL ||
pm->ps->weapon == WP_M3 ||
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO))
PM_ContinueWeaponAnim(WP_ANIM_IDLE);
if (pm->ps->weaponstate == WEAPON_READY)
{
if (pm->ps->ammo[pm->ps->weapon] == 0)
PM_ContinueWeaponAnim( WP_ANIM_EMPTY );
else if (pm->ps->weapon == WP_PISTOL ||
pm->ps->weapon == WP_M3 ||
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_ContinueWeaponAnim(WP_ANIM_IDLE);
else if (pm->ps->weapon == WP_KNIFE &&
!(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_ContinueWeaponAnim(WP_ANIM_THROWIDLE);
}
}
}
@ -2477,13 +2505,19 @@ static void PM_Weapon( void ) {
// Should always draw the weapon when it is just ready
// PM_StartWeaponAnim( WP_ANIM_READY );
// temp hack
if (pm->ps->weapon == WP_PISTOL ||
if (pm->ps->ammo[pm->ps->weapon] == 0)
PM_ContinueWeaponAnim( WP_ANIM_EMPTY );
else if (pm->ps->weapon == WP_PISTOL ||
pm->ps->weapon == WP_M3 ||
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
(pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
PM_StartWeaponAnim( WP_ANIM_IDLE );
else if (pm->ps->weapon == WP_KNIFE && !(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
PM_StartWeaponAnim( WP_ANIM_THROWIDLE );
return;
}
@ -2494,6 +2528,7 @@ static void PM_Weapon( void ) {
pm->ps->weaponTime = 0;
// put it in the "cocked" position
pm->ps->weaponstate = WEAPON_COCKED;
PM_StartWeaponAnim(WP_ANIM_EXTRA1);
return;
}
@ -2554,6 +2589,11 @@ static void PM_Weapon( void ) {
// pm->ps->weaponstate = WEAPON_READY;
// return;
// }
if (pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)
PM_StartWeaponAnim( WP_ANIM_FIRE );
else
PM_StartWeaponAnim( WP_ANIM_THROWFIRE );
PM_StartTorsoAnim( TORSO_ATTACK2 );
} else {
// Elder: don't repeat if semi-auto
@ -2568,12 +2608,18 @@ static void PM_Weapon( void ) {
// This should change pm->ps->generic1 so we can animate
// Elder: don't repeat if on semi-auto
// temp hack
if (pm->ps->weapon == WP_PISTOL ||
if (pm->ps->weapon == WP_AKIMBO)
{
// don't repeat animation if on second akimbo shot
if ( !pm->ps->stats[STAT_BURST] )
PM_StartWeaponAnim( WP_ANIM_FIRE );
}
else if (pm->ps->weapon == WP_PISTOL ||
pm->ps->weapon == WP_M3 ||
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_GRENADE)
PM_StartWeaponAnim( WP_ANIM_FIRE );
}
}
@ -3248,7 +3294,9 @@ void PmoveSingle (pmove_t *pmove) {
pm->ps->weapon == WP_HANDCANNON ||
pm->ps->weapon == WP_SSG3000 ||
pm->ps->weapon == WP_M4 ||
pm->ps->weapon == WP_AKIMBO)
pm->ps->weapon == WP_AKIMBO ||
pm->ps->weapon == WP_GRENADE ||
pm->ps->weapon == WP_KNIFE)
PM_WeaponAnimation();
// torso animation

View file

@ -43,7 +43,7 @@
#define MINS_Z -24
#define DEFAULT_VIEWHEIGHT 22
//#define DEFAULT_VIEWHEIGHT 26
//Elder: changed to 8 like AQ2 source BUT is it sync-ed?
//Elder: changed to 8 like AQ2 source
#define CROUCH_VIEWHEIGHT 8
//#define CROUCH_VIEWHEIGHT 12
#define DEAD_VIEWHEIGHT -16
@ -188,7 +188,7 @@ typedef enum {
#define THROW_DAMAGE 250 //Throwing Knife damage
#define GRENADE_DAMAGE 170
#define GRENADE_SPLASH_DAMAGE 170
#define GRENADE_SPLASH_RADIUS 340 //340 Splash damage * 2
#define GRENADE_SPLASH_RADIUS 340 //Damage * 2
#define PISTOL_SPREAD 140
#define MP5_SPREAD 250
@ -222,7 +222,7 @@ typedef enum {
#define RQ3_SSG3000_BOLT_DELAY 1300// Elder: delay before zooming back in
//#define RQ3_AKIMBO_DELAY 500 // Elder: two delays: one for the total delay
//#define RQ3_AKIMBO_DELAY2 200 // one for the time to start the second shot
#define RQ3_AKIMBO_DELAY 200
#define RQ3_AKIMBO_DELAY 100
#define RQ3_AKIMBO_DELAY2 300
#define RQ3_KNIFE_DELAY 800
#define RQ3_THROW_DELAY 800
@ -374,7 +374,7 @@ typedef enum {
typedef enum {
WEAPON_READY, //sync with WP_ANIM_IDLE
WEAPON_COCKED,
WEAPON_COCKED, //sync with WP_ANIM_EXTRA1 for grenade
WEAPON_RAISING, //sync with WP_ANIM_ACTIVATE
WEAPON_DROPPING, //sync with WP_ANIM_DISARM
WEAPON_FIRING, //sync with WP_ANIM_FIRE
@ -389,9 +389,14 @@ typedef enum {
WP_ANIM_IDLE,
WP_ANIM_DISARM,
WP_ANIM_ACTIVATE,
//WP_ANIM_EMPTY,
//WP_ANIM_EXTRA1,
//WP_ANIM_EXTRA2,
WP_ANIM_EMPTY,
WP_ANIM_EXTRA1, // e.g. grenade pulling pin, fast-reload, knife slash to throw switch
WP_ANIM_EXTRA2, // knife throw to slash switch
// Knife exclusives
WP_ANIM_THROWFIRE,
WP_ANIM_THROWIDLE,
WP_ANIM_THROWDISARM,
WP_ANIM_THROWACTIVATE,
MAX_WEAPON_ANIMATIONS
} wpAnimNumber_t;

View file

@ -911,19 +911,30 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
weap = 0;
if (client->uniqueWeapons > 0)
{
weap = client->ps.stats[STAT_WEAPONS];
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M4) ) == (1 << WP_M4))
weap = WP_M4;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M3) ) == (1 << WP_M3))
weap = WP_M3;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_MP5) ) == (1 << WP_MP5))
weap = WP_MP5;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_HANDCANNON) ) == (1 << WP_HANDCANNON))
weap = WP_HANDCANNON;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_SSG3000) ) == (1 << WP_SSG3000))
weap = WP_SSG3000;
if (weap == 0 )
return 0;
if (client->ps.weapon == WP_AKIMBO ||
client->ps.weapon == WP_PISTOL ||
client->ps.weapon == WP_GRENADE ||
client->ps.weapon == WP_KNIFE ||
client->ps.weapon == WP_NONE) // shouldn't have to worry about NONE, but just in case
{
weap = client->ps.stats[STAT_WEAPONS];
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M4) ) == (1 << WP_M4))
weap = WP_M4;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M3) ) == (1 << WP_M3))
weap = WP_M3;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_MP5) ) == (1 << WP_MP5))
weap = WP_MP5;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_HANDCANNON) ) == (1 << WP_HANDCANNON))
weap = WP_HANDCANNON;
if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_SSG3000) ) == (1 << WP_SSG3000))
weap = WP_SSG3000;
if (weap == 0 )
return 0;
}
else
{
weap = client->ps.weapon;
}
xr_item = BG_FindItemForWeapon( weap );
@ -941,7 +952,10 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
}
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
client->weaponCount[weap]--;
if (client->weaponCount[weap] == 0)
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
xr_drop= dropWeapon( ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM );
xr_drop->count= -1; // XRAY FMJ 0 is already taken, -1 means no ammo
client->uniqueWeapons--;

View file

@ -1651,6 +1651,9 @@ void Cmd_Stats_f( gentity_t *ent ) {
*/
void Cmd_Bandage (gentity_t *ent)
{
if (ent->client->ps.pm_type == PM_SPECTATOR)
return;
//Elder: added so you can't "rebandage"
if ( (ent->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK) {
trap_SendServerCommand( ent-g_entities, va("print \"You are already bandaging!\n\""));
@ -1682,11 +1685,18 @@ void Cmd_Bandage (gentity_t *ent)
ent->client->ps.weapon == WP_HANDCANNON ||
ent->client->ps.weapon == WP_SSG3000 ||
ent->client->ps.weapon == WP_M4 ||
ent->client->ps.weapon == WP_AKIMBO)
ent->client->ps.weapon == WP_AKIMBO ||
ent->client->ps.weapon == WP_GRENADE ||
(ent->client->ps.weapon == WP_KNIFE && !(ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE)))
{
ent->client->ps.generic1 = ( ( ent->client->ps.generic1 & ANIM_TOGGLEBIT )
^ ANIM_TOGGLEBIT ) | WP_ANIM_DISARM;
}
else if (ent->client->ps.weapon == WP_KNIFE && (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE))
{
ent->client->ps.generic1 = ( ( ent->client->ps.generic1 & ANIM_TOGGLEBIT )
^ ANIM_TOGGLEBIT ) | WP_ANIM_THROWDISARM;
}
//Elder: always lower the player model
ent->client->ps.torsoAnim = ( ( ent->client->ps.torsoAnim & ANIM_TOGGLEBIT )
@ -1720,6 +1730,9 @@ void Cmd_Reload( gentity_t *ent )
int ammotoadd;
int delay = 0;
if (ent->client->ps.pm_type == PM_SPECTATOR)
return;
//G_Printf("(%i) Cmd_Reload: Attempting reload\n", ent->s.clientNum);
//Elder: added for redundant check but shouldn't need to come here - handled in cgame
@ -2114,8 +2127,8 @@ void Cmd_OpenDoor(gentity_t *ent)
//Use_BinaryMover( ent->parent, ent, other );
gentity_t *door = NULL;
//Don't open doors if dead
if (ent->client->ps.stats[STAT_HEALTH] <= 0)
//Don't open doors if dead or spectating
if (ent->client->ps.stats[STAT_HEALTH] <= 0 || ent->client->ps.pm_type == PM_SPECTATOR)
return;
while ((door = findradius(door,ent->r.currentOrigin,100)) != NULL)
@ -2144,6 +2157,9 @@ void toggleSemi(gentity_t *ent){
/* Hawkins. Reaction weapon command */
void Cmd_Weapon(gentity_t *ent)
{
if (ent->client->ps.pm_type == PM_SPECTATOR)
return;
//Elder: debug code
//G_Printf("PERS_WEAPONMODES: %d\n", ent->client->ps.persistant[PERS_WEAPONMODES]);
@ -2329,6 +2345,8 @@ Cmd_DropWeapon_f XRAY FMJ
*/
void Cmd_DropWeapon_f( gentity_t *ent ) {
if (ent->client->ps.pm_type == PM_SPECTATOR)
return;
//Elder: added -- checked in cgame
//if ( (ent->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK)
//{
@ -2351,6 +2369,9 @@ Cmd_DropItem_f
*/
void Cmd_DropItem_f( gentity_t *ent )
{
if (ent->client->ps.pm_type == PM_SPECTATOR)
return;
if (ent->client->ps.stats[STAT_HOLDABLE_ITEM])
{
//Elder: reset item totals if using bandolier
@ -2374,6 +2395,13 @@ void Cmd_DropItem_f( gentity_t *ent )
ent->client->numClips[WP_KNIFE] = RQ3_KNIFE_MAXCLIP;
if (ent->client->numClips[WP_GRENADE] > RQ3_GRENADE_MAXCLIP)
ent->client->numClips[WP_GRENADE] = RQ3_GRENADE_MAXCLIP;
if (ent->client->uniqueWeapons > g_RQ3_maxWeapons.integer)
{
Cmd_Unzoom( ent );
ThrowWeapon( ent, qtrue );
}
}
//Force laser off
else if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_LASER)

View file

@ -110,43 +110,63 @@ void TossClientItems( gentity_t *self ) {
//as opposed to dropping it, then died
if ( (weaponInventory & (1 << WP_M3) ) == (1 << WP_M3) ) {
item = BG_FindItemForWeapon( WP_M3 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_M3 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
while ( self->client->weaponCount[WP_M3] )
{
item = BG_FindItemForWeapon( WP_M3 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_M3 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
self->client->weaponCount[WP_M3]--;
}
}
if ( (weaponInventory & (1 << WP_M4) ) == (1 << WP_M4) ) {
item = BG_FindItemForWeapon( WP_M4 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_M4 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
while ( self->client->weaponCount[WP_M4] )
{
item = BG_FindItemForWeapon( WP_M4 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_M4 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
self->client->weaponCount[WP_M4]--;
}
}
if ( (weaponInventory & (1 << WP_MP5) ) == (1 << WP_MP5) ) {
item = BG_FindItemForWeapon( WP_MP5 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_MP5 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
while ( self->client->weaponCount[WP_MP5] )
{
item = BG_FindItemForWeapon( WP_MP5 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_MP5 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
self->client->weaponCount[WP_MP5]--;
}
}
if ( (weaponInventory & (1 << WP_HANDCANNON) ) == (1 << WP_HANDCANNON) ) {
item = BG_FindItemForWeapon( WP_HANDCANNON );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_HANDCANNON ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
while ( self->client->weaponCount[WP_HANDCANNON] )
{
item = BG_FindItemForWeapon( WP_HANDCANNON );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_HANDCANNON ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
self->client->weaponCount[WP_HANDCANNON]--;
}
}
if ( (weaponInventory & (1 << WP_SSG3000) ) == (1 << WP_SSG3000) ) {
item = BG_FindItemForWeapon( WP_SSG3000 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_SSG3000 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
while ( self->client->weaponCount[WP_SSG3000] )
{
item = BG_FindItemForWeapon( WP_SSG3000 );
Drop_Item( self, item, angle);
self->client->pers.hadUniqueWeapon[ WP_SSG3000 ] = qfalse;
self->client->uniqueWeapons--;
angle += 30;
self->client->weaponCount[WP_SSG3000]--;
}
}
//Elder: Always drop the pistol
@ -1961,8 +1981,11 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
realBleedTime = BLEED_TIME;
client->bleeding += take * realBleedTime;
VectorSubtract (point, targ->r.absmax, targ->client->bleedloc_offset);
// Elder: Splash damage bleeding happens from the origin
if (dflags == DAMAGE_RADIUS)
VectorClear(targ->client->bleedloc_offset);
else
VectorSubtract (point, targ->r.currentOrigin, targ->client->bleedloc_offset);
//G_Printf("(%d) = damage",damage);
//G_Printf("(%d) = bleeding",client->bleeding);
@ -2038,6 +2061,8 @@ qboolean CanDamage (gentity_t *targ, vec3_t origin) {
/*
============
G_RadiusDamage
Elder: this sucker needed a lot of minor tweaks to behave like AQ2
============
*/
qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, float radius,
@ -2083,7 +2108,8 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
}
dist = VectorLength( v );
if ( dist >= radius ) {
//if ( dist >= radius ) {
if ( dist > radius ) {
continue;
}
// Q2 radius damage
@ -2094,7 +2120,7 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
//Elder: reduce grenade damage if crouching
if (ent->r.maxs[2] < 20)
{
points = points * 0.5; // hefty reduction in damage
points = points * 0.5f; // hefty reduction in damage
}
if( CanDamage (ent, origin) ) {
@ -2104,9 +2130,9 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
VectorSubtract (ent->r.currentOrigin, origin, dir);
// push the center of mass higher than the origin so players
// get knocked into the air more
dir[2] += 24;
// dir[2] += 24;
G_Damage (ent, NULL, attacker, dir, origin, (int)points, DAMAGE_RADIUS, mod);
G_Damage (ent, NULL, attacker, dir, origin, (int)(points * 0.75f), DAMAGE_RADIUS, mod);
}
}

View file

@ -312,14 +312,17 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other, int bandolierFactor) {
// add the weapon if not knife or pistol
if (ent->item->giTag != WP_KNIFE || ent->item->giTag != WP_PISTOL)
{
other->client->weaponCount[ent->item->giTag]++;
other->client->ps.stats[STAT_WEAPONS] |= ( 1 << ent->item->giTag );
}
// Begin Duffman - Adds a clip for each weapon picked up, will want to edit this later
/*Add_Ammo( other, ent->item->giTag, quantity );*/
switch (ent->item->giTag)
{
case WP_KNIFE:
if (other->client->ps.ammo[WP_KNIFE] < RQ3_KNIFE_MAXCLIP)
if (other->client->ps.ammo[WP_KNIFE] < RQ3_KNIFE_MAXCLIP * bandolierFactor)
{
//G_Printf("(%d)\n",other->client->ps.ammo[ent->item->giTag]);
ammotoadd = other->client->ps.ammo[WP_KNIFE] + 1;
@ -642,8 +645,8 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
case WP_MP5:
case WP_M4:
case WP_SSG3000:
//Elder: check to see if it's in mid-air
if (other->client->uniqueWeapons >= g_RQ3_maxWeapons.integer ||
//Elder: check to see if it's in mid-air or over the limit
if (other->client->uniqueWeapons >= g_RQ3_maxWeapons.integer + (bandolierFactor - 1) ||
ent->s.pos.trDelta[2] != 0)
return;
break;

View file

@ -393,6 +393,7 @@ struct gclient_s {
// Begin Duffman
int numClips[MAX_WEAPONS]; // Number of clips each weapon has
// End Duffman
int weaponCount[WP_NUM_WEAPONS]; // Elder: for duplicate unique weapon tracking
qboolean openDoor; //Blaze: used to hold if someone has hit opendoor key
int openDoorTime;

View file

@ -1383,7 +1383,9 @@ MK23 Attack
*/
void Weapon_MK23_Fire(gentity_t *ent)
{
float spread;
int i;
float spread;
// Homer: increment burst if needed
if ( (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_MK23MODE) == RQ3_MK23MODE )
{
@ -1395,7 +1397,6 @@ void Weapon_MK23_Fire(gentity_t *ent)
spread = PISTOL_SPREAD;
}
Bullet_Fire( ent, RQ3_Spread(ent, spread), PISTOL_DAMAGE, MOD_PISTOL);
}
/*

View file

@ -1,34 +1,37 @@
// Elder: we have to seriously repair this file
#define INVENTORY_NONE 0
//armor
#define INVENTORY_ARMOR 1
//weapons
#define INVENTORY_KNIFE 4
//Blaze: I use this later for the reaction shotgun
#define INVENTORY_PISTOL 5
#define INVENTORY_M4 6
#define INVENTORY_SSG3000 7
#define INVENTORY_MP5 8
#define INVENTORY_HANDCANNON 9
#define INVENTORY_M3 10
#define INVENTORY_AKIMBO 11
#define INVENTORY_GRENADE 13
//#define INVENTORY_GRAPPLINGHOOK 14
//#define INVENTORY_NAILGUN 15
//#define INVENTORY_PROXLAUNCHER 16
//#define INVENTORY_CHAINGUN 17
#define INVENTORY_KNIFE 4 // was gauntlet
#define INVENTORY_M3 5 // was shotgun
#define INVENTORY_PISTOL 6 // was machinegun
#define INVENTORY_GRENADE 7 // was grenade launcher
#define INVENTORY_HANDCANNON 8 // was rocket launcher
#define INVENTORY_AKIMBO 9 // was lightning gun
#define INVENTORY_SSG3000 10 // was railgun
#define INVENTORY_MP5 11 // was plasma gun
#define INVENTORY_M4 13 // was BFG10K
/*
#define INVENTORY_GRAPPLINGHOOK 14
#define INVENTORY_NAILGUN 15
#define INVENTORY_PROXLAUNCHER 16
#define INVENTORY_CHAINGUN 17
*/
//ammo
#define INVENTORY_KNIFEAMMO 14
#define INVENTORY_PISTOLAMMO 15
#define INVENTORY_M4AMMO 16
#define INVENTORY_M3AMMO 16
#define INVENTORY_SSG3000AMMO 17
#define INVENTORY_MP5AMMO 18
#define INVENTORY_HANDCANNONAMMO 19
#define INVENTORY_SHOTGUNAMMO 20
#define INVENTORY_M4AMMO 19
#define INVENTORY_HANDCANNONAMMO 20
#define INVENTORY_AKIMBOAMMO 21
#define INVENTORY_GRENADEAMMO 22
// Duffman: I stold the below numbers for RQ3 Items
// Duffman: I stole the below numbers for RQ3 Items
#define INVENTORY_KEVLAR 23
#define INVENTORY_LASER 24
@ -49,6 +52,7 @@
#define INVENTORY_MINES 27
#define INVENTORY_BELT 28
*/
//powerups
#define INVENTORY_HEALTH 29
#define INVENTORY_TELEPORTER 30
@ -73,28 +77,6 @@
#define INVENTORY_REDCUBE 48
#define INVENTORY_BLUECUBE 49
/*
#define INVENTORY_KNIFE 50
#define INVENTORY_PISTOL 51
#define INVENTORY_M4 52
#define INVENTORY_SSG3000 53
#define INVENTORY_MP5 54
#define INVENTORY_HANDCANNON 55
#define INVENTORY_M3 56
#define INVENTORY_AKIMBO 57
#define INVENTORY_GRENADE 58
#define INVENTORY_KNIFEAMMO 59
#define INVENTORY_PISTOLAMMO 60
#define INVENTORY_M4AMMO 61
#define INVENTORY_SSG3000AMMO 62
#define INVENTORY_MP5AMMO 63
#define INVENTORY_HANDCANNONAMMO 64
#define INVENTORY_SHOTGUNAMMO 65
#define INVENTORY_AKIMBOAMMO 66
#define INVENTORY_GRENADEAMMO 67
*/
//enemy stuff
#define ENEMY_HORIZONTAL_DIST 200
#define ENEMY_HEIGHT 201
@ -109,6 +91,43 @@
#endif
//item numbers (make sure they are in sync with bg_itemlist in bg_misc.c)
#define MODELINDEX_KNIFE 1
#define MODELINDEX_PISTOL 2
#define MODELINDEX_M4 3
#define MODELINDEX_SSG3000 4
#define MODELINDEX_MP5 5
#define MODELINDEX_HANDCANNON 6
#define MODELINDEX_M3 7
#define MODELINDEX_AKIMBO 8
#define MODELINDEX_GRENADE 9
// Elder: these are not necessary but oh well
#define MODELINDEX_KNIFE_1ST 10
#define MODELINDEX_PISTOL_1ST 11
#define MODELINDEX_M4_1ST 12
#define MODELINDEX_SSG3000_1ST 13
#define MODELINDEX_MP5_1ST 14
#define MODELINDEX_HANDCANNON_1ST 15
#define MODELINDEX_M3_1ST 16
#define MODELINDEX_AKIMBO_1ST 17
#define MODELINDEX_GRENADE_1ST 18
#define MODELINDEX_PISTOLAMMO 19
#define MODELINDEX_M3AMMO 20
#define MODELINDEX_SSG3000AMMO 21
#define MODELINDEX_MP5AMMO 22
#define MODELINDEX_M4AMMO 23
// Elder: for CTB later?
#define MODELINDEX_REDFLAG 24
#define MODELINDEX_BLUEFLAG 25
#define MODELINDEX_KEVLAR 26
#define MODELINDEX_SILENCER 27
#define MODELINDEX_LASER 28
#define MODELINDEX_BANDOLIER 29
#define MODELINDEX_SLIPPERS 30
/*
#define MODELINDEX_ARMORSHARD 1
#define MODELINDEX_ARMORCOMBAT 2
#define MODELINDEX_ARMORBODY 3
@ -171,7 +190,7 @@
#define MODELINDEX_NAILGUN 49
#define MODELINDEX_PROXLAUNCHER 50
#define MODELINDEX_CHAINGUN 51
*/
//
#define WEAPONINDEX_KNIFE 1
@ -183,7 +202,8 @@
#define WEAPONINDEX_M3 7
#define WEAPONINDEX_AKIMBO 8
#define WEAPONINDEX_GRENADE 9
/*#define WEAPONINDEX_GRAPPLING_HOOK 10
/*
#define WEAPONINDEX_GRAPPLING_HOOK 10
#define WEAPONINDEX_NAILGUN 11
#define WEAPONINDEX_PROXLAUNCHER 12
#define WEAPONINDEX_CHAINGUN 13

View file

@ -64,13 +64,13 @@ void CheckBleeding(gentity_t *targ)
vec3_t bleedOrigin;
targ->client->bleed_delay = level.time + 2000; // 2 seconds
VectorAdd(targ->client->bleedloc_offset, targ->r.absmax, bleedOrigin);
VectorAdd(targ->client->bleedloc_offset, targ->client->ps.origin, bleedOrigin);
//gi.cprintf(ent, PRINT_HIGH, "Bleeding now.\n");
//EjectBlooder(ent, pos, pos);
// do bleeding
//tent = G_TempEntity(bleedOrigin, EV_EJECTBLOOD);
tent = G_TempEntity(bleedOrigin, EV_EJECTBLOOD);
tent->s.otherEntityNum = targ->s.clientNum;
}
}
}