Added a weapon reload timer hack to prevent a race between input frame and weapon-reload think frame. This fixes that the gun seemingly reloads twice.

This commit is contained in:
Marco Cawthorne 2019-02-21 12:43:59 +01:00
parent f008fd447c
commit a6695de43c
10 changed files with 49 additions and 40 deletions

30
Source/client/cstrike/player.c Executable file → Normal file
View file

@ -14,36 +14,6 @@
.float netflags;
.float netpmove_flags;
string sPModels[CS_WEAPON_COUNT - 1] = {
"models/p_knife.mdl",
"models/p_usp.mdl",
"models/p_glock18.mdl",
"models/p_deagle.mdl",
"models/p_p228.mdl",
"models/p_elite.mdl",
"models/p_fiveseven.mdl",
"models/p_m3.mdl",
"models/p_xm1014.mdl",
"models/p_mp5.mdl",
"models/p_p90.mdl",
"models/p_ump45.mdl",
"models/p_mac10.mdl",
"models/p_tmp.mdl",
"models/p_ak47.mdl",
"models/p_sg552.mdl",
"models/p_m4a1.mdl",
"models/p_aug.mdl",
"models/p_scout.mdl",
"models/p_awp.mdl",
"models/p_g3sg1.mdl",
"models/p_sg550.mdl",
"models/p_m249.mdl",
"models/p_c4.mdl",
"models/p_flashbang.mdl",
"models/p_hegrenade.mdl",
"models/p_smokegrenade.mdl"
};
void Player_ReadEntity(float flIsNew)
{
player pl = (player)self;

View file

@ -39,6 +39,10 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
precache_model("sprites/640_pain.spr");
precache_model("sprites/crosshairs.spr");
precache_model("sprites/muzzleflash1.spr");
precache_model("sprites/muzzleflash2.spr");
precache_model("sprites/muzzleflash3.spr");
/* Fonts */
FONT_16 = loadfont("16", "fonts/default", "16", -1);
FONT_CON = loadfont("font", "", "12", -1);

View file

@ -6,15 +6,48 @@
*
****/
//.float bonecontrol1; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol2; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol3; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol4; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol5; //Halflife model format bone controller. This typically affects the mouth.
//.float subblendfrac; //Weird animation value specific to halflife models. On player models, this typically affects the spine's pitch.
//.float bonecontrol1; //Half-Life model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol2; //Half-Life model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol3; //Half-Life model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol4; //Half-Life model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol5; //Half-Life model format bone controller. This typically affects the mouth.
//.float subblendfrac; //Weird animation value specific to Half-Life models. On player models, this typically affects the spine's pitch.
//.float basesubblendfrac; // legs part.
.float subblend2frac; // Up/Down
// TODO: This needs to be redone.
#ifdef CSTRIKE
string sPModels[CS_WEAPON_COUNT - 1] = {
"models/p_knife.mdl",
"models/p_usp.mdl",
"models/p_glock18.mdl",
"models/p_deagle.mdl",
"models/p_p228.mdl",
"models/p_elite.mdl",
"models/p_fiveseven.mdl",
"models/p_m3.mdl",
"models/p_xm1014.mdl",
"models/p_mp5.mdl",
"models/p_p90.mdl",
"models/p_ump45.mdl",
"models/p_mac10.mdl",
"models/p_tmp.mdl",
"models/p_ak47.mdl",
"models/p_sg552.mdl",
"models/p_m4a1.mdl",
"models/p_aug.mdl",
"models/p_scout.mdl",
"models/p_awp.mdl",
"models/p_g3sg1.mdl",
"models/p_sg550.mdl",
"models/p_m249.mdl",
"models/p_c4.mdl",
"models/p_flashbang.mdl",
"models/p_hegrenade.mdl",
"models/p_smokegrenade.mdl"
};
#endif
void player::gun_offset(void)
{
vector v1, v2;
@ -44,7 +77,9 @@ void player::draw(void)
// Only bother updating the model if the weapon has changed
if (this.lastweapon != this.activeweapon) {
if (this.activeweapon) {
// FIXME: setmodel(this.p_model, sPModels[this.weapon - 1]);
#ifdef CSTRIKE
setmodel(this.p_model, sPModels[this.weapon - 1]);
#endif
} else {
setmodel(this.p_model, "");
}

4
Source/shared/cstrike/basegun.c Executable file → Normal file
View file

@ -175,8 +175,8 @@ float BaseGun_Reload( void ) {
self.think = BaseGun_FinishReload;
self.nextthink = time + wptTable[ self.weapon ].fReloadFinished;
self.fAttackFinished = self.nextthink;
self.nextthink = time + wptTable[ self.weapon ].fReloadFinished - 0.1f; // Hack - in some cases input might happen first
self.fAttackFinished = self.nextthink + 0.1f;
Animation_ReloadWeapon( self );
Client_SendEvent( self, EV_WEAPON_RELOAD );

View file

@ -9,7 +9,7 @@
#define AIRCONTROL
#define PHY_JUMP_CHAINWINDOW 0.5
#define PHY_JUMP_CHAIN 100
#define PHY_JUMP_CHAIN 100
#define PHY_JUMP_CHAINDECAY 50
#define FL_JUMPRELEASED 4096

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.