weapon prediction stuff

This commit is contained in:
Bryce Hutchings 2002-07-21 18:52:39 +00:00
parent 756baa6d95
commit f6097137ca
3 changed files with 42 additions and 13 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.86 2002/07/21 18:52:39 niceass
// weapon prediction stuff
//
// Revision 1.85 2002/07/16 04:27:19 niceass
// physics back to 2.0
//
@ -158,6 +161,11 @@ static void PM_StartWeaponAnim(int anim)
return;
}
// NiceAss: Don't do client prediction of weapon animations
if ( !pm->predict && (anim == WP_ANIM_FIRE || anim == WP_ANIM_IDLE ||
anim == WP_ANIM_EXTRA1 || anim == WP_ANIM_THROWFIRE ) )
return;
pm->ps->generic1 = ((pm->ps->generic1 & ANIM_TOGGLEBIT) ^ ANIM_TOGGLEBIT) | anim;
}
@ -167,6 +175,11 @@ static void PM_ContinueWeaponAnim(int anim)
return;
}
// NiceAss: Don't do client prediction of weapon animations
if ( !pm->predict && (anim == WP_ANIM_FIRE || anim == WP_ANIM_IDLE ||
anim == WP_ANIM_EXTRA1 || anim == WP_ANIM_THROWFIRE ) )
return;
PM_StartWeaponAnim(anim);
}
@ -1604,6 +1617,7 @@ PM_BeginWeaponChange
static void PM_BeginWeaponChange(int weapon)
{
//G_Printf("CHANGING WEAP TO: %i\n", weapon);
if (weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS) {
return;
}
@ -2179,7 +2193,8 @@ static void PM_Weapon(void)
//NiceAss: I added this for smooth M4 rise
if (pm->ps->weaponstate == WEAPON_FIRING && pm->ps->ammo[pm->ps->weapon] &&
pm->ps->weapon == WP_M4 && !pm->ps->stats[STAT_BURST] &&
!(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_M4MODE)) {
!(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_M4MODE) &&
pm->predict ) {
pm->ps->delta_angles[0] -= ANGLE2SHORT(0.13);
}
@ -2207,7 +2222,8 @@ static void PM_Weapon(void)
if (pm->ps->weapon == WP_GRENADE && pm->ps->weaponstate == WEAPON_COCKED) {
pm->ps->weaponstate = WEAPON_FIRING;
pm->cmd.buttons &= ~BUTTON_ATTACK;
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_GRENADEDROP);
if (pm->predict)
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_GRENADEDROP);
pm->ps->ammo[WP_GRENADE]--;
}
PM_BeginWeaponChange(pm->cmd.weapon);
@ -2458,16 +2474,19 @@ static void PM_Weapon(void)
}
// fire weapon
//Elder: check for silencer
if (bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag == HI_SILENCER &&
(pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_MP5 || pm->ps->weapon == WP_SSG3000)) {
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_SILENCER);
} else if (pm->ps->stats[STAT_BURST] > 1 && pm->ps->weapon == WP_KNIFE &&
(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE) == RQ3_KNIFEMODE) {
// NiceAss: Prevent the client from doing stuff after the first "slash".
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_KNIFENOMARK);
} else
PM_AddEvent(EV_FIRE_WEAPON);
// NiceAss: Check to see if this is game or cgame
if (pm->predict) {
//Elder: check for silencer
if (bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag == HI_SILENCER &&
(pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_MP5 || pm->ps->weapon == WP_SSG3000)) {
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_SILENCER);
} else if (pm->ps->stats[STAT_BURST] > 1 && pm->ps->weapon == WP_KNIFE &&
(pm->ps->persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE) == RQ3_KNIFEMODE) {
// NiceAss: Prevent the client from doing stuff after the first "slash".
PM_AddEvent2(EV_FIRE_WEAPON, RQ3_WPMOD_KNIFENOMARK);
} else
PM_AddEvent(EV_FIRE_WEAPON);
}
switch (pm->ps->weapon) {
default:

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.88 2002/07/21 18:48:24 niceass
// weapon prediction stuff
//
// Revision 1.87 2002/07/19 04:31:12 niceass
// changed ef_dead for bot protection
//
@ -668,6 +671,7 @@ typedef struct {
int (*pointcontents) (const vec3_t point, int passEntityNum);
// JBravo: lca info for the pm stuff
qboolean lca;
qboolean predict;
} pmove_t;
// if a full pmove isn't done on the client, you can just update the angles

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.84 2002/07/21 18:48:06 niceass
// weapon prediction stuff
//
// Revision 1.83 2002/07/07 18:36:13 jbravo
// Added an AntiIdle system. Can play insane sounds for idle players, drop them
// from teams or kick them. Upped version to Beta 2.1
@ -505,7 +508,7 @@ void SpectatorThink(gentity_t * ent, usercmd_t * ucmd)
pm.tracemask = 0; // spectators can fly through bodies
pm.trace = trap_Trace;
pm.pointcontents = trap_PointContents;
pm.predict = qtrue;
// perform a pmove
Pmove(&pm);
// save results of pmove
@ -1133,6 +1136,9 @@ void ClientThink_real(gentity_t * ent)
pm.lca = qtrue;
else
pm.lca = qfalse;
pm.predict = qtrue;
Pmove(&pm);
if ((pm.cmd.upmove > 10) &&