mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-03-27 12:51:13 +00:00
Elder:
Heavily fixed the weapon-drop code, plus some other miscellaneous fixes
This commit is contained in:
parent
51f4bedd30
commit
ce64cb6c21
6 changed files with 105 additions and 44 deletions
|
@ -52,7 +52,8 @@ gitem_t bg_itemlist[] =
|
|||
//Knife
|
||||
{
|
||||
"weapon_knife",
|
||||
"sound/weapons/knife/knife.wav",
|
||||
//"sound/weapons/knife/knife.wav",
|
||||
"sound/misc/am_pkup.wav",
|
||||
{"models/weapons2/knife/knife.md3",0,0,0},
|
||||
"icons/iconw_knife",
|
||||
"Knife",
|
||||
|
@ -126,7 +127,7 @@ gitem_t bg_itemlist[] =
|
|||
//Handcannon
|
||||
{
|
||||
"weapon_handcannon",
|
||||
"sound/weapons/handcannon/copen.wav",
|
||||
"sound/weapons/handcannon/hcopen.wav",
|
||||
{ "models/weapons2/handcannon/handcannon.md3",
|
||||
0, 0, 0},
|
||||
/* icon */ "icons/iconw_sawedoff",
|
||||
|
@ -172,7 +173,8 @@ gitem_t bg_itemlist[] =
|
|||
//Grenade
|
||||
{
|
||||
"weapon_grenade",
|
||||
"sound/grenade/tink2.wav",
|
||||
//"sound/grenade/tink2.wav",
|
||||
"sound/misc/am_pkup.wav",
|
||||
{ "models/weapons2/grenade/grenade.md3",
|
||||
0, 0, 0},
|
||||
/* icon */ "icons/iconw_grenade",
|
||||
|
@ -942,6 +944,9 @@ qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const play
|
|||
//Elder: gotta check before we can pick it up
|
||||
//if (item->giTag == WP_KNIFE && ps->ammo[WP_KNIFE] >= RQ3_KNIFE_MAXCLIP)
|
||||
//return qfalse;
|
||||
//else
|
||||
//if (item->giTag != WP_KNIFE && ent->pos.trDelta && ent->pos.trDelta[2] != 0)
|
||||
//return qfalse;
|
||||
//else
|
||||
return qtrue; // weapons are always picked up
|
||||
|
||||
|
|
|
@ -177,6 +177,32 @@
|
|||
#define RQ3_THROW_DELAY 800
|
||||
#define RQ3_GRENADE_DELAY 750 // Elder: I made this up
|
||||
|
||||
//Elder: reload delays
|
||||
//Also kinda "derived" from the AQ2 source
|
||||
#define RQ3_PISTOL_RELOAD_DELAY 1100
|
||||
|
||||
#define RQ3_M3_RELOAD_DELAY 1100
|
||||
#define RQ3_M3_ALLOW_FAST_RELOAD_DELAY 800 // Time into reload to enable fast-reloads
|
||||
//#define RQ3_M3_START_RELOAD_DELAY 300 // Start index point of fast reload
|
||||
#define RQ3_M3_FINISH_RELOAD_DELAY 300 // Amount of time after all fast reloads
|
||||
#define RQ3_M3_FAST_RELOAD_DELAY 500 // Fast reload time
|
||||
|
||||
#define RQ3_M4_RELOAD_DELAY 1900
|
||||
#define RQ3_MP5_RELOAD_DELAY 1800
|
||||
#define RQ3_HANDCANNON_RELOAD_DELAY 2100
|
||||
|
||||
#define RQ3_SSG3000_RELOAD_DELAY 3100
|
||||
#define RQ3_SSG3000_ALLOW_RELOAD_DELAY 2300 // Time into reload to enable fast-reloads
|
||||
//#define RQ3_SSG3000_START_RELOAD_DELAY 1700 // Start index point of fast reload
|
||||
#define RQ3_SSG3000_FINISH_RELOAD_DELAY 800 // Amount of time after all fast reloads
|
||||
#define RQ3_SSG3000_FAST_RELOAD_DELAY 600 // Fast reload time
|
||||
|
||||
#define RQ3_AKIMBO_RELOAD_DELAY 2500
|
||||
#define RQ3_KNIFE_RELOAD_DELAY 0 // Elder: shouldn't need
|
||||
#define RQ3_GRENADE_RELOAD_DELAY 0 // Elder: shouldn't need
|
||||
|
||||
//Elder: each weapon also has a different weapon switch delay... ugh
|
||||
|
||||
//Elder: special for grenade: speeds depending on distance select
|
||||
#define GRENADE_SHORT_SPEED 400
|
||||
#define GRENADE_MEDIUM_SPEED 720
|
||||
|
|
|
@ -1675,11 +1675,9 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
//if( ent->client->zoomed ){
|
||||
//ent->client->zoomed=0;
|
||||
//}
|
||||
//Elder: remove zoom bits
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_LOW;
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_MED;
|
||||
//Elder: can't use events
|
||||
//G_AddEvent(ent,EV_ZOOM,0);
|
||||
|
||||
//Elder: can't use events
|
||||
//G_AddEvent(ent,EV_ZOOM,0);
|
||||
|
||||
//Elder: serious debug code
|
||||
/*
|
||||
|
@ -1693,7 +1691,7 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
return;
|
||||
break;
|
||||
case WP_PISTOL:
|
||||
delay = 2500;
|
||||
delay = RQ3_PISTOL_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_PISTOL_AMMO)
|
||||
{
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
|
@ -1702,7 +1700,7 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
break;
|
||||
//Elder: was missing?
|
||||
case WP_M4:
|
||||
delay = 2000;
|
||||
delay = RQ3_M4_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_M4_AMMO)
|
||||
{
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
|
@ -1711,7 +1709,8 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
break;
|
||||
case WP_M3:
|
||||
ammotoadd += ent->client->ps.ammo[weapon];
|
||||
delay = 400; // from 1000 to 400 by hawkins. reloads too slowly.
|
||||
//Elder: temporarily using fast-loads
|
||||
delay = RQ3_M3_FAST_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_M3_AMMO)
|
||||
{
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
|
@ -1719,14 +1718,15 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
}
|
||||
break;
|
||||
case WP_HANDCANNON:
|
||||
delay = 2500;
|
||||
delay = RQ3_HANDCANNON_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_HANDCANNON_AMMO) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case WP_SSG3000:
|
||||
delay = 1000;
|
||||
//Elder: temporarily using fast-loads
|
||||
delay = RQ3_SSG3000_FAST_RELOAD_DELAY;
|
||||
ammotoadd += ent->client->ps.ammo[weapon];
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_SSG3000_AMMO) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
|
@ -1734,15 +1734,14 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
}
|
||||
break;
|
||||
case WP_AKIMBO:
|
||||
//Elder: added- but I don't think it's the right value
|
||||
delay = 2500;
|
||||
delay = RQ3_AKIMBO_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_AKIMBO_AMMO) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case WP_MP5:
|
||||
delay = 2000;
|
||||
delay = RQ3_MP5_RELOAD_DELAY;
|
||||
if (ent->client->ps.ammo[weapon] >= RQ3_MP5_AMMO)
|
||||
{
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"No need to reload.\n\""));
|
||||
|
@ -1750,6 +1749,7 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
//Elder: shouldn't be here
|
||||
delay = 2500;
|
||||
//Elder: changed function
|
||||
if (ent->client->ps.ammo[weapon] >= ClipAmountForAmmo(weapon))
|
||||
|
@ -1770,6 +1770,10 @@ void Cmd_Reload( gentity_t *ent ) {
|
|||
return;
|
||||
}
|
||||
|
||||
//Elder: remove zoom bits
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_LOW;
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_MED;
|
||||
|
||||
//ent->client->ps.weaponstate = WEAPON_RELOADING;
|
||||
ent->client->ps.weaponstate = WEAPON_DROPPING;
|
||||
ent->client->ps.torsoAnim = ( ( ent->client->ps.torsoAnim & ANIM_TOGGLEBIT )
|
||||
|
|
|
@ -104,6 +104,7 @@ void TossClientItems( gentity_t *self ) {
|
|||
//Elder: throw items in a "circle" starting at a random angle
|
||||
i = level.time;
|
||||
angle = Q_random(&i) * 30;
|
||||
//angle = 0;
|
||||
|
||||
//Elder: added hadUniqueWeapons check - returns to qfalse if died with the gun
|
||||
//as opposed to dropping it, then died
|
||||
|
@ -512,17 +513,22 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
|
|||
if ( self->client )
|
||||
{
|
||||
// Hawkins put spread back and zoom out
|
||||
|
||||
//Elder: this wouldn't happen if you copy and paste carefully
|
||||
//ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_LOW;
|
||||
//ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_MED;
|
||||
|
||||
//Elder: remove zoom bits
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_LOW;
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_MED;
|
||||
self->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_LOW;
|
||||
self->client->ps.stats[STAT_RQ3] &= ~RQ3_ZOOM_MED;
|
||||
//self->client->zoomed = 0;
|
||||
self->client->bleeding = 0;
|
||||
//targ->client->bleedcount = 0;
|
||||
self->client->bleed_remain = 0;
|
||||
//Elder: added;
|
||||
//self->client->isBandaging = qfalse;
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_BANDAGE_WORK;
|
||||
ent->client->ps.stats[STAT_RQ3] &= ~RQ3_BANDAGE_NEED;
|
||||
self->client->ps.stats[STAT_RQ3] &= ~RQ3_BANDAGE_WORK;
|
||||
self->client->ps.stats[STAT_RQ3] &= ~RQ3_BANDAGE_NEED;
|
||||
}
|
||||
if ( self->client->ps.pm_type == PM_DEAD ) {
|
||||
return;
|
||||
|
|
|
@ -616,8 +616,10 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
case WP_MP5:
|
||||
case WP_M4:
|
||||
case WP_SSG3000:
|
||||
if (other->client->ps.stats[STAT_UNIQUEWEAPONS] >= g_rxn_maxweapons.integer)
|
||||
return;
|
||||
//Elder: check to see if it's in mid-air
|
||||
if (other->client->ps.stats[STAT_UNIQUEWEAPONS] >= g_rxn_maxweapons.integer ||
|
||||
ent->s.pos.trDelta[2] != 0)
|
||||
return;
|
||||
break;
|
||||
case WP_AKIMBO:
|
||||
default:
|
||||
|
@ -873,7 +875,7 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
dropped->touch = Touch_Item;
|
||||
|
||||
//Elder: suspend thrown knives so they don't jitter
|
||||
G_Printf("xr_flags: %d, condition: %d\n", xr_flags, (xr_flags & FL_THROWN_KNIFE) == FL_THROWN_KNIFE);
|
||||
//G_Printf("xr_flags: %d, condition: %d\n", xr_flags, (xr_flags & FL_THROWN_KNIFE) == FL_THROWN_KNIFE);
|
||||
if (item->giTag == WP_KNIFE && ( (xr_flags & FL_THROWN_KNIFE) == FL_THROWN_KNIFE) ) {
|
||||
G_SetOrigin( dropped, origin );
|
||||
|
||||
|
@ -885,7 +887,6 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
G_SetOrigin( dropped, origin );
|
||||
dropped->s.pos.trType = TR_GRAVITY;
|
||||
dropped->s.pos.trTime = level.time;
|
||||
//Elder: should change to a constant velocity for weapons
|
||||
VectorCopy( velocity, dropped->s.pos.trDelta );
|
||||
|
||||
//Elder: moved from outside else statement
|
||||
|
@ -909,7 +910,6 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
item->giTag != WP_GRENADE && item->giTag != WP_PISTOL &&
|
||||
item->giTag != WP_AKIMBO && item->giTag != WP_KNIFE ) {
|
||||
dropped->think = RQ3_DroppedWeaponThink;
|
||||
//Elder: don't want to wait forever while testing :)
|
||||
dropped->nextthink = level.time + RQ3_RESPAWNTIME_DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -920,11 +920,12 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
|
||||
dropped->flags = xr_flags;//FL_DROPPED_ITEM;
|
||||
if( xr_flags & FL_THROWN_ITEM) {
|
||||
dropped->clipmask = MASK_SHOT; // XRAY FMJ
|
||||
dropped->s.pos.trTime = level.time - 50; // move a bit on the very first frame
|
||||
VectorScale( velocity, 200, dropped->s.pos.trDelta ); // 700 500 400
|
||||
//Elder: we don't want it to clip against players
|
||||
dropped->clipmask = MASK_SOLID; //MASK_SHOT
|
||||
dropped->s.pos.trTime = level.time; // +50; no pre-step if it doesn't clip players
|
||||
VectorScale( velocity, 40, dropped->s.pos.trDelta ); // 700 500 400
|
||||
SnapVector( dropped->s.pos.trDelta ); // save net bandwidth
|
||||
dropped->physicsBounce= 0;
|
||||
dropped->physicsBounce = 0.1;
|
||||
}
|
||||
|
||||
trap_LinkEntity (dropped);
|
||||
|
@ -934,6 +935,8 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
|
||||
/*
|
||||
================
|
||||
Modified by Elder
|
||||
|
||||
dropWeapon XRAY FMJ
|
||||
================
|
||||
*/
|
||||
|
@ -941,31 +944,30 @@ gentity_t *dropWeapon( gentity_t *ent, gitem_t *item, float angle, int xr_flags
|
|||
vec3_t velocity;
|
||||
vec3_t angles;
|
||||
vec3_t origin;
|
||||
int throwheight;
|
||||
|
||||
VectorCopy( ent->s.pos.trBase, origin );
|
||||
VectorCopy( ent->s.apos.trBase, angles );
|
||||
angles[YAW] += angle;
|
||||
angles[PITCH] = 0; // always forward
|
||||
angles[PITCH] = -55; // always at a 55 degree above horizontal angle
|
||||
|
||||
AngleVectors( angles, velocity, NULL, NULL);
|
||||
//VectorScale( velocity, 150, velocity);
|
||||
|
||||
// set aiming directions
|
||||
//AngleVectors (ent->client->ps.viewangles, velocity, NULL, NULL);
|
||||
|
||||
origin[2] += ent->client->ps.viewheight;
|
||||
VectorMA( origin, 10, velocity, origin ); // 14 34
|
||||
|
||||
//Elder: don't toss from the head, but from the "waist"
|
||||
origin[2] += 10; // (ent->client->ps.viewheight / 2);
|
||||
VectorMA( origin, 5, velocity, origin ); // 14 34 10
|
||||
// snap to integer coordinates for more efficient network bandwidth usage
|
||||
SnapVector( origin);
|
||||
|
||||
// less vertical velocity
|
||||
//velocity[2] += 0.2f;
|
||||
//velocity[2] = 20;
|
||||
//G_Printf("Velocity: %s\n", vtos(velocity));
|
||||
VectorNormalize( velocity );
|
||||
VectorScale( velocity, 5, velocity);
|
||||
return LaunchItem( item, origin, velocity, xr_flags );
|
||||
//return LaunchItem( item, ent->s.pos.trBase, velocity, xr_flags );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1360,12 +1362,22 @@ void G_RunItem( gentity_t *ent ) {
|
|||
return;
|
||||
}
|
||||
|
||||
//Elder: debug
|
||||
//if (ent->item && ent->item->giType == IT_WEAPON) {
|
||||
//G_Printf("item velocity: %s\n", vtos(ent->s.pos.trDelta));
|
||||
//}
|
||||
|
||||
// if it is in a nodrop volume, remove it
|
||||
contents = trap_PointContents( ent->r.currentOrigin, -1 );
|
||||
if ( contents & CONTENTS_NODROP ) {
|
||||
if (ent->item && ent->item->giType == IT_TEAM) {
|
||||
Team_FreeEntity(ent);
|
||||
} else {
|
||||
}
|
||||
else if (ent->item && ent->item->giType == IT_WEAPON) {
|
||||
//Elder: force-call the weaponthink function
|
||||
RQ3_DroppedWeaponThink(ent);
|
||||
}
|
||||
else {
|
||||
G_FreeEntity( ent );
|
||||
}
|
||||
return;
|
||||
|
@ -1395,12 +1407,15 @@ void RQ3_DroppedWeaponThink(gentity_t *ent) {
|
|||
case WP_HANDCANNON:
|
||||
case WP_SSG3000:
|
||||
weaponNum = ent->item->giTag;
|
||||
break;
|
||||
|
||||
break;
|
||||
case WP_PISTOL:
|
||||
case WP_KNIFE:
|
||||
case WP_AKIMBO:
|
||||
case WP_GRENADE:
|
||||
//Just free the entity
|
||||
G_FreeEntity(ent);
|
||||
return;
|
||||
break;
|
||||
case WP_AKIMBO:
|
||||
default:
|
||||
//Elder: shouldn't have to come here
|
||||
G_Printf("DroppedWeaponThink: Out of range weapon %d\n", ent->item->giTag);
|
||||
|
|
|
@ -443,7 +443,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
|
|||
//but still set it as a thrown knife
|
||||
//xr_drop->flags |= FL_THROWN_KNIFE;
|
||||
|
||||
//Elder: make the knife stick out a bit more
|
||||
//Elder: move the knife back a bit more
|
||||
//and transfer into shared entityState
|
||||
VectorScale(trace->plane.normal, 16, temp);
|
||||
VectorAdd(trace->endpos, temp, knifeOffset);
|
||||
|
@ -458,7 +458,9 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
|
|||
|
||||
//Elder: make the knife stick out a bit more
|
||||
//and transfer into shared entityState
|
||||
VectorScale(trace->plane.normal, 4, temp);
|
||||
VectorCopy(ent->s.pos.trDelta, temp);
|
||||
VectorNormalize(temp);
|
||||
VectorScale(temp, -4, temp);
|
||||
VectorAdd(trace->endpos, temp, knifeOffset);
|
||||
VectorCopy(xr_drop->s.origin, temp);
|
||||
VectorAdd(temp, knifeOffset, xr_drop->s.origin);
|
||||
|
@ -473,9 +475,12 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
|
|||
|
||||
//Elder: transfer entity data into the shared entityState
|
||||
//They are rotated on the client side in cg_ents.c
|
||||
|
||||
//G_Printf("movedir: %s\n", vtos(ent->s.pos.trDelta));
|
||||
xr_drop->s.eFlags = xr_drop->flags;
|
||||
vectoangles( trace->plane.normal, xr_drop->s.angles );
|
||||
xr_drop->s.angles[0] += 270;
|
||||
//vectoangles( trace->plane.normal, xr_drop->s.angles );
|
||||
vectoangles( ent->s.pos.trDelta, xr_drop->s.angles );
|
||||
xr_drop->s.angles[0] += 90;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue