/* * G_FireWeapon */ void G_FireWeapon( edict_t *ent, int parm ) { gs_weapon_definition_t *weapondef; firedef_t *firedef; edict_t *projectile; vec3_t origin, angles; vec3_t viewoffset = { 0, 0, 0 }; int ucmdSeed; weapondef = GS_GetWeaponDef( ( parm & ~EV_INVERSE ) ); firedef = ( parm & EV_INVERSE ) ? &weapondef->firedef : &weapondef->firedef_weak; // find this shot projection source if( ent->r.client ) { viewoffset[2] += ent->r.client->ps.viewheight; VectorCopy( ent->r.client->ps.viewangles, angles ); is_quad = ( ent->r.client->ps.inventory[POWERUP_QUAD] > 0 ) ? true : false; ucmdSeed = ent->r.client->ucmd.serverTimeStamp & 255; } else { VectorCopy( ent->s.angles, angles ); is_quad = false; ucmdSeed = rand() & 255; } VectorAdd( ent->s.origin, viewoffset, origin ); // shoot projectile = NULL; switch( weapondef->weapon_id ) { default: case WEAP_NONE: break; case WEAP_GUNBLADE: if( firedef->fire_mode == FIRE_MODE_STRONG ) projectile = G_Fire_Gunblade_Blast( origin, angles, firedef, ent, ucmdSeed ); else projectile = G_Fire_Gunblade_Knife( origin, angles, firedef, ent ); break; case WEAP_MACHINEGUN: projectile = G_Fire_Machinegun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_RIOTGUN: projectile = G_Fire_Riotgun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_GRENADELAUNCHER: projectile = G_Fire_Grenade( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_ROCKETLAUNCHER: projectile = G_Fire_Rocket( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_PLASMAGUN: projectile = G_Fire_Plasma( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_LASERGUN: projectile = G_Fire_Lasergun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_ELECTROBOLT: projectile = G_Fire_StrongBolt( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_INSTAGUN: projectile = G_Fire_Instagun( origin, angles, firedef, ent, ucmdSeed ); break; } // add stats if( ent->r.client && weapondef->weapon_id != WEAP_NONE ) ent->r.client->level.stats.accuracy_shots[firedef->ammo_id - AMMO_GUNBLADE] += firedef->projectile_count; if( projectile ) { //if( projectile->s.linearProjectile ) // convert distance to time for linear projectiles // G_ProjectileTimePrestep( projectile, 1000.0f * ( g_projectile_prestep->value / VectorLengthFast( projectile->velocity ) ) ); //else G_ProjectileDistancePrestep( projectile, g_projectile_prestep->value ); } #ifdef NO_ROCKET_ANTILAG // hack for disabling antilag on rockets if( projectile && projectile->s.type == ET_ROCKET ) { int timeOffset; timeOffset = -projectile->timeDelta; projectile->timeDelta = 0; if( projectile->s.linearProjectile ) projectile->s.modelindex2 = 0; G_ProjectileTimePrestep( projectile, timeOffset ); } #endif }
/* * G_FireWeapon */ void G_FireWeapon( edict_t *ent, int parm ) { gs_weapon_definition_t *weapondef; firedef_t *firedef; edict_t *projectile; vec3_t origin, angles; vec3_t viewoffset = { 0, 0, 0 }; int ucmdSeed; // racesow float prestep; // !racesow weapondef = GS_GetWeaponDef( ( parm & ~EV_INVERSE ) ); firedef = ( parm & EV_INVERSE ) ? &weapondef->firedef : &weapondef->firedef_weak; // find this shot projection source if( ent->r.client ) { viewoffset[2] += ent->r.client->ps.viewheight; VectorCopy( ent->r.client->ps.viewangles, angles ); is_quad = ( ent->r.client->ps.inventory[POWERUP_QUAD] > 0 ); ucmdSeed = ent->r.client->ucmd.serverTimeStamp & 255; } else { VectorCopy( ent->s.angles, angles ); is_quad = qfalse; ucmdSeed = rand() & 255; } VectorAdd( ent->s.origin, viewoffset, origin ); // racesow prestep=g_projectile_prestep->value; // !racesow // shoot projectile = NULL; switch( weapondef->weapon_id ) { default: case WEAP_NONE: break; case WEAP_GUNBLADE: if( firedef->fire_mode == FIRE_MODE_STRONG ) projectile = G_Fire_Gunblade_Blast( origin, angles, firedef, ent, ucmdSeed ); else projectile = G_Fire_Gunblade_Knife( origin, angles, firedef, ent ); break; case WEAP_MACHINEGUN: projectile = G_Fire_Machinegun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_RIOTGUN: projectile = G_Fire_Riotgun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_GRENADELAUNCHER: projectile = G_Fire_Grenade( origin, angles, firedef, ent, ucmdSeed ); // racesow if( GS_RaceGametype() ) //prestep/=2; // racesow 0.42 had default prestep=48 and genade prestep=24 prestep=trap_Cvar_Get( "rs_grenade_prestep", "90", CVAR_ARCHIVE )->integer; // !racesow break; case WEAP_ROCKETLAUNCHER: projectile = G_Fire_Rocket( origin, angles, firedef, ent, ucmdSeed ); // racesow if( GS_RaceGametype() ) //prestep=0; // racesow 0.42 had rocket prestep=0 prestep=trap_Cvar_Get( "rs_rocket_prestep", "90", CVAR_ARCHIVE )->integer; // !racesow break; case WEAP_PLASMAGUN: projectile = G_Fire_Plasma( origin, angles, firedef, ent, ucmdSeed ); // racesow if( GS_RaceGametype() ) //prestep*=2/3; // racesow 0.42 had plasma prestep=32 prestep=trap_Cvar_Get( "rs_plasma_prestep", "90", CVAR_ARCHIVE )->integer; // !racesow break; case WEAP_LASERGUN: projectile = G_Fire_Lasergun( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_ELECTROBOLT: projectile = G_Fire_StrongBolt( origin, angles, firedef, ent, ucmdSeed ); break; case WEAP_INSTAGUN: projectile = G_Fire_Instagun( origin, angles, firedef, ent, ucmdSeed ); break; } // add stats if( ent->r.client && weapondef->weapon_id != WEAP_NONE ) ent->r.client->level.stats.accuracy_shots[firedef->ammo_id - AMMO_GUNBLADE] += firedef->projectile_count; if( projectile ) { //if( projectile->s.linearProjectile ) // convert distance to time for linear projectiles // G_ProjectileTimePrestep( projectile, 1000.0f * ( g_projectile_prestep->value / VectorLengthFast( projectile->velocity ) ) ); //else //G_ProjectileDistancePrestep( projectile, g_projectile_prestep->value ); //racesow Seems like this was added in warsow 0.7 -K1ll // racesow: modified prestep G_ProjectileDistancePrestep( projectile, prestep ); // !racesow } // racesow: enable skipping no_antilag if rs_rocket_antilag is 1 if ( GS_RaceGametype() && ((trap_Cvar_Get( "rs_rocket_antilag", "0", CVAR_ARCHIVE )->integer==1 && projectile->s.type == ET_ROCKET))) return; // !racesow #ifdef NO_ROCKET_ANTILAG // hack for disabling antilag on rockets if( projectile && (projectile->s.type == ET_ROCKET || projectile->s.type == ET_PLASMA) )//racesow { int timeOffset; timeOffset = -projectile->timeDelta; projectile->timeDelta = 0; if( projectile->s.linearProjectile ) projectile->s.modelindex2 = 0; // racesow: testing .42 time prestep function, because im really not sure it is equivalent to the .5 one; the difference is not that major anyway.. // G_ProjectileTimePrestep( projectile, timeOffset ); rs_TimeDeltaPrestepProjectile(projectile,-timeOffset); // !racesow } #endif }