VM 0-17-00
Server-side
This commit is contained in:
Victor Chow 2001-11-11 07:24:27 +00:00
parent 4371354291
commit c24d952d34
6 changed files with 56 additions and 96 deletions

View file

@ -1915,6 +1915,9 @@ static void PM_BeginWeaponChange( int weapon ) {
pm->ps->stats[STAT_RQ3] &= ~RQ3_LOCKRELOADS; pm->ps->stats[STAT_RQ3] &= ~RQ3_LOCKRELOADS;
pm->ps->stats[STAT_RQ3] &= ~RQ3_QUEUERELOAD; pm->ps->stats[STAT_RQ3] &= ~RQ3_QUEUERELOAD;
// Elder: cancel burst shots
pm->ps->stats[STAT_BURST] = 0;
pm->ps->weaponstate = WEAPON_DROPPING; pm->ps->weaponstate = WEAPON_DROPPING;
//Elder: temp hack //Elder: temp hack
@ -2285,6 +2288,15 @@ static void PM_Reload( void )
// insert stage 1 sound events here; check against the reload time // insert stage 1 sound events here; check against the reload time
// Special handcannon shell ejection hack
if ( pm->ps->weapon == WP_HANDCANNON &&
!(pm->ps->stats[STAT_RQ3] & RQ3_RELOADWEAPON1) &&
pm->ps->stats[STAT_RELOADTIME] < 1400 )
{
pm->ps->stats[STAT_RQ3] |= RQ3_RELOADWEAPON1;
PM_AddEvent(EV_RELOAD_WEAPON1);
}
// finished reload // finished reload
if (pm->ps->stats[STAT_RELOADTIME] <= 0) if (pm->ps->stats[STAT_RELOADTIME] <= 0)
{ {
@ -2344,11 +2356,11 @@ static void PM_Reload( void )
//PM_StartWeaponAnim(WP_ANIM_RELOAD); //PM_StartWeaponAnim(WP_ANIM_RELOAD);
} }
if (pm->ps->stats[STAT_CLIPS] > 0) 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); PM_AddEvent(EV_RELOAD_WEAPON1);
//PM_AddEvent(EV_RELOAD_WEAPON0);
} }
else else
{ {
@ -2400,6 +2412,7 @@ static void PM_Reload( void )
//Com_Printf("Finished reload\n"); //Com_Printf("Finished reload\n");
pm->ps->stats[STAT_RELOADTIME] = 0; pm->ps->stats[STAT_RELOADTIME] = 0;
pm->ps->stats[STAT_RELOADATTEMPTS] = 0; pm->ps->stats[STAT_RELOADATTEMPTS] = 0;
pm->ps->stats[STAT_RQ3] &= ~RQ3_RELOADWEAPON1;
pm->ps->weaponstate = WEAPON_READY; pm->ps->weaponstate = WEAPON_READY;
//} //}
@ -2481,7 +2494,7 @@ static void PM_Weapon( void ) {
{ {
pm->ps->stats[STAT_BURST] = 0; pm->ps->stats[STAT_BURST] = 0;
} }
else if ((pm->cmd.buttons & BUTTON_ATTACK) && pm->ps->stats[STAT_BURST]) else if ( (pm->cmd.buttons & BUTTON_ATTACK) && pm->ps->stats[STAT_BURST] )
{ {
pm->cmd.buttons &= ~BUTTON_ATTACK; pm->cmd.buttons &= ~BUTTON_ATTACK;
} }
@ -2543,11 +2556,13 @@ static void PM_Weapon( void ) {
// can't change if weapon is firing, but can change // can't change if weapon is firing, but can change
// again if lowering or raising // again if lowering or raising
// Elder: modified so that a dropweapon command is high precedence
//if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING) { //if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING) {
if ( pm->ps->weaponTime <= 0 && if ( (pm->ps->stats[STAT_RQ3] & RQ3_THROWWEAPON) || (pm->ps->weaponTime <= 0 &&
!(pm->ps->weaponstate == WEAPON_FIRING || pm->ps->weaponstate == WEAPON_STALL)) { !(pm->ps->weaponstate == WEAPON_FIRING || pm->ps->weaponstate == WEAPON_STALL))) {
if ( pm->ps->weapon != pm->cmd.weapon ) { if ( pm->ps->weapon != pm->cmd.weapon ) {
//Elder TODO: if switching weapons, fire off the grenade "instantly" //Elder: if switching weapons, fire off the grenade "instantly"
if ( pm->ps->weapon == WP_GRENADE && pm->ps->weaponstate == WEAPON_COCKED) { if ( pm->ps->weapon == WP_GRENADE && pm->ps->weaponstate == WEAPON_COCKED) {
pm->ps->weaponstate = WEAPON_FIRING; pm->ps->weaponstate = WEAPON_FIRING;
pm->cmd.buttons &= ~BUTTON_ATTACK; pm->cmd.buttons &= ~BUTTON_ATTACK;
@ -2654,9 +2669,9 @@ static void PM_Weapon( void ) {
if ( pm->ps->weapon == WP_GRENADE ) if ( pm->ps->weapon == WP_GRENADE )
{ {
pm->ps->weaponTime = 0; pm->ps->weaponTime = 0;
// put it in the "cocked" position // put it in the "cocked" position and play the pin-pull animation
pm->ps->weaponstate = WEAPON_COCKED; pm->ps->weaponstate = WEAPON_COCKED;
PM_StartWeaponAnim(WP_ANIM_EXTRA1); PM_ContinueWeaponAnim(WP_ANIM_EXTRA1);
return; return;
} }
// Elder: stall the thrown knife action // Elder: stall the thrown knife action

View file

@ -498,6 +498,7 @@ typedef enum {
#define RQ3_FASTRELOADS 64 // Fast-reloads flag #define RQ3_FASTRELOADS 64 // Fast-reloads flag
#define RQ3_LOCKRELOADS 128 // Lock-reloads at end of fast-reload cycle #define RQ3_LOCKRELOADS 128 // Lock-reloads at end of fast-reload cycle
#define RQ3_QUEUERELOAD 256 // auto-reload if set #define RQ3_QUEUERELOAD 256 // auto-reload if set
#define RQ3_RELOADWEAPON1 512 // flag off EV_RELOAD_WEAPON1 event so no dupes occur
// player_state->persistant[] indexes // player_state->persistant[] indexes

View file

@ -11,6 +11,7 @@
//Elder: moved kick to g_weapon.c where it belongs //Elder: moved kick to g_weapon.c where it belongs
/* /*
=============== ===============
G_DamageFeedback G_DamageFeedback
@ -741,10 +742,10 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
case EV_RELOAD_WEAPON0: case EV_RELOAD_WEAPON0:
ReloadWeapon ( ent, 0 ); ReloadWeapon ( ent, 0 );
break; break;
*/
case EV_RELOAD_WEAPON1: case EV_RELOAD_WEAPON1:
ReloadWeapon ( ent, 1 ); ReloadWeapon ( ent, 1 );
break; break;
*/
case EV_RELOAD_WEAPON2: case EV_RELOAD_WEAPON2:
ReloadWeapon ( ent, 2 ); ReloadWeapon ( ent, 2 );
break; break;
@ -754,14 +755,6 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
//ent->client->zoomed=0; //ent->client->zoomed=0;
break; break;
/* case EV_ZOOM:
if(ent->client->zoomed==3)
ent->client->zoomed=0;
else
ent->client->zoomed++;
G_Printf("zoomlevel = %d\n",ent->client->zoomed);
break;
*/
case EV_USE_ITEM1: // teleporter case EV_USE_ITEM1: // teleporter
// drop flags in CTF // drop flags in CTF
item = NULL; item = NULL;
@ -921,7 +914,7 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
//weaponTime > 0 or weaponState == weapon_dropping? Or both? //weaponTime > 0 or weaponState == weapon_dropping? Or both?
//Still firing //Still firing
if (!forceThrow) if (!forceThrow)
if ( (ucmd->buttons & BUTTON_ATTACK) == BUTTON_ATTACK || client->ps.weaponTime > 0) if ( (ucmd->buttons & BUTTON_ATTACK) || client->ps.weaponTime > 0)
return 0; return 0;
//Elder: Bandaging case -- handled in cgame //Elder: Bandaging case -- handled in cgame
@ -930,7 +923,8 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
//trap_SendServerCommand( ent-g_entities, va("print \"You are too busy bandaging...\n\"")); //trap_SendServerCommand( ent-g_entities, va("print \"You are too busy bandaging...\n\""));
//return; //return;
//} //}
//Elder: remove zoom bits
Cmd_Unzoom(ent);
weap = 0; weap = 0;
if (client->uniqueWeapons > 0) if (client->uniqueWeapons > 0)
@ -1183,69 +1177,19 @@ void ClientThink_real( gentity_t *ent ) {
// check for the hit-scan gauntlet, don't let the action // check for the hit-scan gauntlet, don't let the action
// go through as an attack unless it actually hits something // go through as an attack unless it actually hits something
//Blaze: no need for the gauntlet check // Blaze: no need for the gauntlet check
// if ( client->ps.weapon == WP_GAUNTLET && !( ucmd->buttons & BUTTON_TALK ) && /*
// ( ucmd->buttons & BUTTON_ATTACK ) && client->ps.weaponTime <= 0 ) { if ( client->ps.weapon == WP_GAUNTLET && !( ucmd->buttons & BUTTON_TALK ) &&
// pm.gauntletHit = CheckGauntletAttack( ent ); ( ucmd->buttons & BUTTON_ATTACK ) && client->ps.weaponTime <= 0 ) {
// } pm.gauntletHit = CheckGauntletAttack( ent );
}
*/
if ( ent->flags & FL_FORCE_GESTURE ) { if ( ent->flags & FL_FORCE_GESTURE ) {
ent->flags &= ~FL_FORCE_GESTURE; ent->flags &= ~FL_FORCE_GESTURE;
ent->client->pers.cmd.buttons |= BUTTON_GESTURE; ent->client->pers.cmd.buttons |= BUTTON_GESTURE;
} }
//**************Elder: moved to bg_pmove.c (PM_Weapon)************// //Elder: 3rb Code moved to bg_pmove.c (resides in PM_Weapon)
//Elder: New 3rb Code
//force fire button down if STAT_BURST is < proper amount
//Otherwise release the button
/*
if ( (client->ps.weapon == WP_M4 &&
(client->ps.persistant[PERS_WEAPONMODES] & RQ3_M4MODE) == RQ3_M4MODE) ||
(client->ps.weapon == WP_MP5 &&
(client->ps.persistant[PERS_WEAPONMODES] & RQ3_MP5MODE) == RQ3_MP5MODE))
{
int weaponNum = client->ps.weapon;
if (client->ps.ammo[weaponNum] == 0)
{
client->ps.stats[STAT_BURST] = 0;
}
else if (ucmd->buttons & BUTTON_ATTACK)// && client->ps.stats[STAT_BURST] > 0)
{
if ( client->ps.stats[STAT_BURST] >= 0 && client->ps.stats[STAT_BURST] < 3)
ucmd->buttons |= BUTTON_ATTACK;
else
ucmd->buttons &= ~BUTTON_ATTACK;
}
else if (client->ps.stats[STAT_BURST] > 2)
{
client->ps.stats[STAT_BURST] = 0;
client->ps.weaponTime += 300;
}
//Don't need?
else if (client->ps.stats[STAT_BURST] > 0)
ucmd->buttons |= BUTTON_ATTACK;
}
//Elder: New semi-auto code
if ( client->ps.weapon == WP_PISTOL &&
(client->ps.persistant[PERS_WEAPONMODES] & RQ3_MK23MODE) == RQ3_MK23MODE)
{
if (client->ps.ammo[WP_PISTOL] == 0)
{
client->ps.stats[STAT_BURST] = 0;
}
else if ((ucmd->buttons & BUTTON_ATTACK) && client->ps.stats[STAT_BURST])
{
ucmd->buttons &= ~BUTTON_ATTACK;
}
else if (client->ps.stats[STAT_BURST])
{
client->ps.weaponTime += 200;
client->ps.stats[STAT_BURST] = 0;
}
}
*/
#ifdef MISSIONPACK #ifdef MISSIONPACK
// check for invulnerability expansion before doing the Pmove // check for invulnerability expansion before doing the Pmove
@ -1327,7 +1271,7 @@ void ClientThink_real( gentity_t *ent ) {
BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue ); BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );
} }
else { else {
BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue ); BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );
} }
SendPendingPredictableEvents( &ent->client->ps ); SendPendingPredictableEvents( &ent->client->ps );

View file

@ -2355,19 +2355,10 @@ void Cmd_DropWeapon_f( gentity_t *ent ) {
if (ent->client->ps.pm_type == PM_SPECTATOR) if (ent->client->ps.pm_type == PM_SPECTATOR)
return; return;
//Elder: added -- checked in cgame //Elder: remove zoom bits
//if ( (ent->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK) //Cmd_Unzoom(ent);
//{ //Throwing away return value here; high precedence weapon drop
//trap_SendServerCommand( ent-g_entities, va("print \"You are too busy bandaging!\n\"")); ThrowWeapon( ent, qtrue );
//return;
//}
//else
//{
//Elder: remove zoom bits
Cmd_Unzoom(ent);
//Throwing away return here
ThrowWeapon( ent, qfalse );
//}
} }
/* /*

View file

@ -132,6 +132,7 @@ static cvarTable_t gameCvarTable[] = {
{ &g_dedicated, "dedicated", "0", 0, 0, qfalse }, { &g_dedicated, "dedicated", "0", 0, 0, qfalse },
// Elder: slow down to 300?
{ &g_speed, "g_speed", "320", 0, 0, qtrue }, { &g_speed, "g_speed", "320", 0, 0, qtrue },
{ &g_gravity, "g_gravity", "800", 0, 0, qtrue }, { &g_gravity, "g_gravity", "800", 0, 0, qtrue },
{ &g_knockback, "g_knockback", "1000", 0, 0, qtrue }, { &g_knockback, "g_knockback", "1000", 0, 0, qtrue },
@ -490,7 +491,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
// make sure we have flags for CTF, etc // make sure we have flags for CTF, etc
if( g_gametype.integer >= GT_TEAM ) { if( g_gametype.integer >= GT_TEAM ) {
G_CheckTeamItems(); G_CheckTeamItems();
} }
//Elder: spawn unique items. //Elder: spawn unique items.
@ -502,7 +503,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
if ( trap_Cvar_VariableIntegerValue( "sv_floodprotect" ) != 0 ) if ( trap_Cvar_VariableIntegerValue( "sv_floodprotect" ) != 0 )
{ {
trap_Cvar_Set( "sv_floodprotect", "0" ); trap_Cvar_Set( "sv_floodprotect", "0" );
G_Printf("sv_floodprotect shut off for RQ3 Beta 1.\n"); G_Printf("sv_floodprotect shut off for RQ3 Release 1.\n");
} }
SaveRegisteredItems(); SaveRegisteredItems();

View file

@ -2405,9 +2405,17 @@ Handles server-side management of numclips
void ReloadWeapon ( gentity_t *ent, int stage ) void ReloadWeapon ( gentity_t *ent, int stage )
{ {
if (stage == 2) if (stage == 1 && (ent->client->ps.weapon == WP_SSG3000 ||
ent->client->ps.weapon == WP_M3) )
{ {
G_Printf("Hit server-side reload\n"); G_Printf("Hit server-side reload stage 1\n");
if ( ent->client->ps.weapon == WP_M3 )
ent->client->numClips[WP_HANDCANNON] = ent->client->numClips[WP_M3];
ent->client->numClips[ent->client->ps.weapon]--;
}
else if (stage == 2)
{
G_Printf("Hit server-side reload stage 2\n");
ent->client->numClips[ent->client->ps.weapon]--; ent->client->numClips[ent->client->ps.weapon]--;
// remove an extra clip if using HC or Akimbos // remove an extra clip if using HC or Akimbos
if (ent->client->ps.weapon == WP_HANDCANNON || if (ent->client->ps.weapon == WP_HANDCANNON ||