Counter-Strike: Handle player animation code in its own files, update
weapons to use the newly defined sequences.
This commit is contained in:
parent
b4fffe8858
commit
1891e974d0
34 changed files with 395 additions and 79 deletions
|
@ -94,13 +94,14 @@ Player_ReadEntity(float new)
|
|||
pl.movetype = readbyte();
|
||||
if (fl & PLAYER_VIEWOFS)
|
||||
pl.view_ofs[2] = readfloat();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
if (fl & PLAYER_BASEFRAME) {
|
||||
pl.baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
pl.frame = readbyte();
|
||||
pl.frame1time = 0.0f;
|
||||
pl.frame2time = 0.0f;
|
||||
pl.baseframe1time = 0.0f;
|
||||
pl.baseframe2time = 0.0f;
|
||||
}
|
||||
if (fl & PLAYER_FRAME)
|
||||
pl.frame = readbyte();
|
||||
|
||||
if (fl & PLAYER_AMMO1)
|
||||
pl.a_ammo1 = readbyte();
|
||||
if (fl & PLAYER_AMMO2)
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
../sentences.c
|
||||
../prints.c
|
||||
../voice.c
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/cstrike/player.cpp
|
||||
../../shared/cstrike/animations.c
|
||||
../../shared/cstrike/player.h
|
||||
../player.c
|
||||
../../shared/cstrike/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
|
|
@ -14,13 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
//.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
|
||||
|
||||
void
|
||||
|
@ -81,14 +74,24 @@ player::draw(void)
|
|||
}
|
||||
this.bonecontrol5 = getplayerkeyfloat(this.entnum - 1, "voiploudness");
|
||||
|
||||
makevectors([0, this.angles[1], 0]);
|
||||
float fCorrect = dotproduct(this.velocity, v_right) * 0.25f;
|
||||
|
||||
#ifdef CSTRIKE
|
||||
/* hack, we can't play the animations in reverse the normal way */
|
||||
if (this.frame1time < 0.0f) {
|
||||
this.frame1time = 10.0f;
|
||||
}
|
||||
|
||||
this.subblendfrac = -fCorrect * 0.05f;
|
||||
this.subblend2frac *= -0.1f;
|
||||
this.angles[1] -= fCorrect;
|
||||
#else
|
||||
/* hack, we can't play the animations in reverse the normal way */
|
||||
if (this.baseframe1time < 0.0f) {
|
||||
this.baseframe1time = 10.0f;
|
||||
}
|
||||
|
||||
makevectors([0, this.angles[1], 0]);
|
||||
float fCorrect = dotproduct(this.velocity, v_right) * 0.25f;
|
||||
|
||||
/* Turn torso */
|
||||
this.bonecontrol1 = fCorrect;
|
||||
this.bonecontrol2 = this.bonecontrol1 * 0.5;
|
||||
|
@ -97,6 +100,7 @@ player::draw(void)
|
|||
|
||||
/* Correct the legs */
|
||||
this.angles[1] -= fCorrect;
|
||||
#endif
|
||||
|
||||
if (cvar("bonetest") == 1) {
|
||||
this.bonecontrol1 = cvar("bonecontrol1");
|
||||
|
|
|
@ -31,9 +31,10 @@ CSMultiplayerRules::PlayerDeath(player pl)
|
|||
corpse.movetype = MOVETYPE_TOSS;
|
||||
corpse.solid = SOLID_TRIGGER;
|
||||
corpse.modelindex = pl.modelindex;
|
||||
corpse.frame = ANIM_DIESIMPLE;
|
||||
corpse.frame = ANIM_DEATH1;
|
||||
corpse.angles = pl.angles;
|
||||
corpse.velocity = pl.velocity;
|
||||
corpse.classname = "remove_me";
|
||||
|
||||
/* gamerule stuff */
|
||||
PlayerMakeSpectator(pl);
|
||||
|
@ -446,7 +447,6 @@ This happens whenever an objective is complete or time is up
|
|||
void
|
||||
CSMultiplayerRules::RoundOver(int iTeamWon, int iMoneyReward, int fSilent)
|
||||
{
|
||||
|
||||
if (g_cs_gamestate != GAME_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
@ -864,3 +864,25 @@ void CSEv_JoinTeam_f(float flChar)
|
|||
rules.RoundOver(FALSE, 0, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CSEv_JoinAuto(void)
|
||||
{
|
||||
int ct_count = 0;
|
||||
int t_count = 1;
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) {
|
||||
player pl = (player)eFind;
|
||||
if (pl.team == TEAM_T) {
|
||||
t_count++;
|
||||
}
|
||||
if (pl.team == TEAM_CT) {
|
||||
ct_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ct_count > t_count) {
|
||||
CSEv_JoinTeam_f(floor(random(1,5)));
|
||||
} else {
|
||||
CSEv_JoinTeam_f(floor(random(5,9)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
#define SERVER
|
||||
#define VALVE
|
||||
#define CSTRIKE
|
||||
#define BULLETPENETRATION
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../shared/defs.h
|
||||
../../shared/cstrike/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
|
@ -22,7 +22,7 @@
|
|||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
|
||||
../../shared/cstrike/player.cpp
|
||||
../../shared/cstrike/player.h
|
||||
../cstrike/defs.h
|
||||
|
||||
../../shared/effects.c
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
../../shared/cstrike/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../cstrike/game_money.c
|
||||
|
@ -97,6 +97,8 @@
|
|||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
../../botlib/include.src
|
||||
|
||||
../cstrike/input.c
|
||||
../cstrike/spawn.c
|
||||
../vote.c
|
||||
|
|
159
src/shared/cstrike/animations.c
Executable file
159
src/shared/cstrike/animations.c
Executable file
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
.float baseframe1time;
|
||||
.float baseframe2time;
|
||||
.float baseframe2;
|
||||
.float baseframe_last;
|
||||
.float baseframe_old;
|
||||
.float baseframe_time;
|
||||
.float baselerpfrac;
|
||||
.float frame2;
|
||||
.float frame2time;
|
||||
.float frame_last;
|
||||
.float fWasCrouching;
|
||||
.float lerpfrac;
|
||||
.float subblend2frac;
|
||||
.float subblendfrac;
|
||||
|
||||
void Animation_Print(string sWow) {
|
||||
#ifdef CLIENT
|
||||
print(sprintf("[DEBUG] %s", sWow));
|
||||
#else
|
||||
bprint(PRINT_HIGH, sprintf("SSQC: %s", sWow) );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Animation_PlayerUpdate
|
||||
|
||||
Called every frame to update the animation sequences
|
||||
depending on what the player is doing
|
||||
=================
|
||||
*/
|
||||
void Animation_PlayerUpdate(void) {
|
||||
self.basebone = cvar("spinebone"); // gettagindex(self, "Bip01 Spine");
|
||||
#ifdef SERVER
|
||||
if (self.baseframe_time < time) {
|
||||
player pl = (player)self;
|
||||
self.baseframe = Weapons_GetAim(pl.activeweapon);
|
||||
self.baseframe_old = self.frame;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* in order to appear jumping, we want to not be on ground,
|
||||
* but also make sure we're not just going down a ramp */
|
||||
if (!(self.flags & FL_ONGROUND) && (self.velocity[2] > 0 || self.frame == ANIM_JUMP)) {
|
||||
self.frame = ANIM_JUMP;
|
||||
} else if (vlen(self.velocity) == 0) {
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
self.frame = ANIM_IDLE_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_IDLE;
|
||||
}
|
||||
} else if (vlen(self.velocity) < 150) {
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
self.frame = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_WALK;
|
||||
}
|
||||
} else if (vlen(self.velocity) > 150) {
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
self.frame = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_RUN;
|
||||
}
|
||||
}
|
||||
|
||||
// Lerp it down!
|
||||
if (self.lerpfrac > 0) {
|
||||
self.lerpfrac -= frametime * 5;
|
||||
if (self.lerpfrac < 0) {
|
||||
self.lerpfrac = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.baselerpfrac > 0) {
|
||||
self.baselerpfrac -= frametime * 5;
|
||||
if (self.baselerpfrac < 0) {
|
||||
self.baselerpfrac = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.frame != self.frame_last) {
|
||||
//Animation_Print(sprintf("New Frame: %d, Last Frame: %d\n", self.frame, self.frame_last));
|
||||
|
||||
// Move everything over to frame 2
|
||||
self.frame2time = self.frame1time;
|
||||
self.frame2 = self.frame_last;
|
||||
|
||||
// Set frame_last to avoid this being called again
|
||||
self.frame_last = self.frame;
|
||||
|
||||
self.lerpfrac = 1.0f;
|
||||
self.frame1time = 0.0f;
|
||||
}
|
||||
|
||||
if (self.baseframe != self.baseframe_last) {
|
||||
//Animation_Print(sprintf("New Baseframe: %d, Last Baseframe: %d\n", self.baseframe, self.baseframe_last));
|
||||
|
||||
// Move everything over to frame 2
|
||||
self.baseframe2time = self.baseframe1time;
|
||||
self.baseframe2 = self.baseframe_last;
|
||||
|
||||
// Set frame_last to avoid this being called again
|
||||
self.baseframe_last = self.baseframe;
|
||||
|
||||
self.baselerpfrac = 1.0f;
|
||||
self.baseframe1time = 0.0f;
|
||||
}
|
||||
|
||||
// Force the code above to update if we switched positions
|
||||
if (self.fWasCrouching != (self.flags & FL_CROUCHING)) {
|
||||
self.baseframe_old = 0;
|
||||
self.baseframe_time = 0;
|
||||
self.fWasCrouching = (self.flags & FL_CROUCHING);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
// On the CSQC it's done in Player.c
|
||||
self.subblendfrac =
|
||||
self.subblend2frac = self.v_angle[0] / 90;
|
||||
#endif
|
||||
|
||||
self.angles[0] = self.angles[2] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Animation_PlayerTop
|
||||
|
||||
Changes the animation sequence for the upper body part
|
||||
=================
|
||||
*/
|
||||
void Animation_PlayerTop(float fFrame) {
|
||||
self.baseframe = fFrame;
|
||||
self.baseframe_old = fFrame;
|
||||
}
|
||||
|
||||
void Animation_PlayerTopTemp(float fFrame, float fTime) {
|
||||
self.baseframe = fFrame;
|
||||
self.baseframe_time = time + fTime;
|
||||
#ifdef SERVER
|
||||
self.SendFlags |= PLAYER_FRAME;
|
||||
#endif
|
||||
}
|
117
src/shared/cstrike/animations.h
Normal file
117
src/shared/cstrike/animations.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
ANIM_DUMMY1,
|
||||
ANIM_IDLE,
|
||||
ANIM_IDLE_CROUCH,
|
||||
ANIM_WALK,
|
||||
ANIM_RUN,
|
||||
ANIM_RUN_CROUCH,
|
||||
ANIM_JUMP,
|
||||
ANIM_LONGJUMP,
|
||||
ANIM_SWIM,
|
||||
ANIM_TREADWATER,
|
||||
ANIM_CROUCH_AIM_CARBINE,
|
||||
ANIM_CROUCH_SHOOT_CARBINE,
|
||||
ANIM_CROUCH_RELOAD_CARBINE,
|
||||
ANIM_AIM_CARBINE,
|
||||
ANIM_SHOOT_CARBINE,
|
||||
ANIM_RELOAD_CARBINE,
|
||||
ANIM_CROUCH_AIM_ONEHAND,
|
||||
ANIM_CROUCH_SHOOT_ONEHAND,
|
||||
ANIM_CROUCH_RELOAD_ONEHAND,
|
||||
ANIM_AIM_ONEHAND,
|
||||
ANIM_SHOOT_ONEHAND,
|
||||
ANIM_RELOAD_ONEHAND,
|
||||
ANIM_CROUCH_AIM_DUALPISTOLS,
|
||||
ANIM_CROUCH_SHOOT_DUALPISTOLS,
|
||||
ANIM_CROUCH_SHOOT2_DUALPISTOLS,
|
||||
ANIM_CROUCH_RELOAD_DUALPISTOLS,
|
||||
ANIM_AIM_DUALPISTOLS,
|
||||
ANIM_SHOOT_DUALPISTOLS,
|
||||
ANIM_SHOOT2_DUALPISTOLS,
|
||||
ANIM_RELOAD_DUALPISTOLS,
|
||||
ANIM_CROUCH_AIM_RIFLE,
|
||||
ANIM_CROUCH_SHOOT_RIFLE,
|
||||
ANIM_CROUCH_RELOAD_RIFLE,
|
||||
ANIM_AIM_RIFLE,
|
||||
ANIM_SHOOT_RIFLE,
|
||||
ANIM_RELOAD_RIFLE,
|
||||
ANIM_CROUCH_AIM_MP5,
|
||||
ANIM_CROUCH_SHOOT_MP5,
|
||||
ANIM_CROUCH_RELOAD_MP5,
|
||||
ANIM_AIM_MP5,
|
||||
ANIM_SHOOT_MP5,
|
||||
ANIM_RELOAD_MP5,
|
||||
ANIM_CROUCH_AIM_SHOTGUN,
|
||||
ANIM_CROUCH_SHOOT_SHOTGUN,
|
||||
ANIM_CROUCH_RELOAD_SHOTGUN,
|
||||
ANIM_AIM_SHOTGUN,
|
||||
ANIM_SHOOT_SHOTGUN,
|
||||
ANIM_RELOAD_SHOTGUN,
|
||||
ANIM_CROUCH_AIM_PARA,
|
||||
ANIM_CROUCH_SHOOT_PARA,
|
||||
ANIM_CROUCH_RELOAD_PARA,
|
||||
ANIM_AIM_PARA,
|
||||
ANIM_SHOOT_PARA,
|
||||
ANIM_RELOAD_PARA,
|
||||
ANIM_DUMMY2,
|
||||
ANIM_DUMMY3,
|
||||
ANIM_AIM_GRENADE,
|
||||
ANIM_SHOOT_GRENADE,
|
||||
ANIM_CROUCH_AIM_GRENADE,
|
||||
ANIM_CROUCH_SHOOT_GRENADE,
|
||||
ANIM_CROUCH_AIM_C4,
|
||||
ANIM_CROUCH_SHOOT_C4,
|
||||
ANIM_AIM_C4,
|
||||
ANIM_SHOOT_C4,
|
||||
ANIM_RELOAD_C4,
|
||||
ANIM_DUPLICATE1,
|
||||
ANIM_DUPLICATE2,
|
||||
ANIM_DUPLICATE3,
|
||||
ANIM_DUPLICATE4,
|
||||
ANIM_DUPLICATE5,
|
||||
ANIM_DUPLICATE6,
|
||||
ANIM_DUPLICATE7,
|
||||
ANIM_DUPLICATE8,
|
||||
ANIM_CROUCH_AIM_KNIFE,
|
||||
ANIM_CROUCH_SHOOT_KNIFE,
|
||||
ANIM_AIM_KNIFE,
|
||||
ANIM_SHOOT_KNIFE,
|
||||
ANIM_CROUCH_AIM_AK47,
|
||||
ANIM_CROUCH_SHOOT_AK47,
|
||||
ANIM_CROUCH_RELOAD_AK47,
|
||||
ANIM_AIM_AK47,
|
||||
ANIM_SHOOT_AK47,
|
||||
ANIM_RELOAD_AK47,
|
||||
ANIM_GUT_FLINCH,
|
||||
ANIM_HEAD_FLINCH,
|
||||
ANIM_DEATH1,
|
||||
ANIM_DEATH2,
|
||||
ANIM_DEATH3,
|
||||
ANIM_DIE_HEAD,
|
||||
ANIM_DIE_GUT,
|
||||
ANIM_DIE_LEFT,
|
||||
ANIM_DIE_BACK,
|
||||
ANIM_DIE_RIGHT,
|
||||
ANIM_DIE_FORWARD,
|
||||
ANIM_CROUCH_DIE
|
||||
};
|
||||
|
||||
void Animation_PlayerTop(float);
|
||||
void Animation_PlayerTopTemp(float, float);
|
|
@ -14,6 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "animations.h"
|
||||
#include "radio.h"
|
||||
#include "weapons.h"
|
||||
#include "items.h"
|
||||
|
|
|
@ -136,9 +136,9 @@ w_ak47_primary(void)
|
|||
pl.ak47_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_AK47, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_AK47, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ak47.fire");
|
||||
#endif
|
||||
|
@ -196,7 +196,7 @@ w_ak47_reload(void)
|
|||
float
|
||||
w_ak47_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_AK47 : ANIM_AIM_AK47;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -136,9 +136,9 @@ w_aug_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 32, [accuracy,accuracy], WEAPON_AUG);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_aug.fire");
|
||||
#endif
|
||||
|
|
|
@ -184,9 +184,9 @@ w_awp_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 115, [accuracy,accuracy], WEAPON_AWP);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.fire");
|
||||
#endif
|
||||
|
|
|
@ -259,7 +259,7 @@ w_c4bomb_primary(void)
|
|||
float
|
||||
w_c4bomb_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_C4 : ANIM_AIM_C4;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -139,9 +139,9 @@ w_deagle_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 54, [accuracy,accuracy], WEAPON_DEAGLE);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire");
|
||||
#endif
|
||||
|
@ -201,7 +201,7 @@ w_deagle_reload(void)
|
|||
float
|
||||
w_deagle_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -60,7 +60,7 @@ void
|
|||
w_elites_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, -1);
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, pl.a_ammo3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,8 @@ w_elites_primary(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
|
@ -147,16 +149,21 @@ w_elites_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 45, [accuracy,accuracy], WEAPON_ELITES);
|
||||
pl.elites_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
if (pl.a_ammo3)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_DUALPISTOLS, 0.45f);
|
||||
} else {
|
||||
if (pl.a_ammo3)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_DUALPISTOLS, 0.45f);
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_elites.fire");
|
||||
#endif
|
||||
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
|
||||
int r = (float)input_sequence % 5;
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
|
@ -245,7 +252,7 @@ w_elites_reload(void)
|
|||
float
|
||||
w_elites_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_DUALPISTOLS : ANIM_AIM_DUALPISTOLS;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -139,9 +139,9 @@ w_fiveseven_primary(void)
|
|||
pl.fiveseven_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_fiveseven.fire");
|
||||
#endif
|
||||
|
|
|
@ -216,7 +216,7 @@ w_flashbang_release(void)
|
|||
float
|
||||
w_flashbang_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_GRENADE : ANIM_AIM_GRENADE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -134,9 +134,9 @@ w_g3sg1_primary(void)
|
|||
pl.g3sg1_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_g3sg1.fire");
|
||||
#endif
|
||||
|
|
|
@ -157,9 +157,9 @@ w_glock18_primary(void)
|
|||
pl.glock18_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
if (pl.a_ammo3) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.burstfire");
|
||||
|
|
|
@ -114,6 +114,11 @@ w_knife_primary(void)
|
|||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.miss");
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_KNIFE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_KNIFE, 0.45f);
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return;
|
||||
}
|
||||
|
@ -172,7 +177,7 @@ w_knife_secondary(void)
|
|||
float
|
||||
w_knife_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_KNIFE : ANIM_AIM_KNIFE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -144,9 +144,9 @@ w_m3_primary(void)
|
|||
pl.m3_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m3.fire");
|
||||
#endif
|
||||
|
|
|
@ -167,9 +167,9 @@ w_m4a1_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_M4A1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
#endif
|
||||
|
||||
/* this stuff is predicted */
|
||||
|
|
|
@ -135,9 +135,9 @@ w_mac10_primary(void)
|
|||
pl.mac10_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire");
|
||||
#endif
|
||||
|
|
|
@ -140,9 +140,9 @@ w_mp5_primary(void)
|
|||
pl.mp5_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.fire");
|
||||
#endif
|
||||
|
|
|
@ -143,9 +143,9 @@ w_p228_primary(void)
|
|||
pl.p228_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p228.fire");
|
||||
#endif
|
||||
|
|
|
@ -136,9 +136,9 @@ w_p90_primary(void)
|
|||
pl.p90_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p90.fire");
|
||||
#endif
|
||||
|
|
|
@ -135,9 +135,9 @@ w_para_primary(void)
|
|||
pl.para_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_PARA, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_PARA, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_para.fire");
|
||||
#endif
|
||||
|
|
|
@ -184,9 +184,9 @@ w_scout_primary(void)
|
|||
pl.scout_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
|
||||
#endif
|
||||
|
|
|
@ -135,9 +135,9 @@ w_sg550_primary(void)
|
|||
pl.sg550_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg550.fire");
|
||||
#endif
|
||||
|
|
|
@ -136,9 +136,9 @@ w_sg552_primary(void)
|
|||
pl.sg552_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg552.fire");
|
||||
#endif
|
||||
|
|
|
@ -136,9 +136,9 @@ w_tmp_primary(void)
|
|||
pl.tmp_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_tmp.fire");
|
||||
#endif
|
||||
|
|
|
@ -136,9 +136,9 @@ w_ump45_primary(void)
|
|||
pl.ump45_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ump45.fire");
|
||||
#endif
|
||||
|
|
|
@ -172,9 +172,9 @@ w_usp45_primary(void)
|
|||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_USP45);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
#endif
|
||||
|
||||
/* this stuff is predicted */
|
||||
|
|
|
@ -146,9 +146,9 @@ w_xm1014_primary(void)
|
|||
pl.xm1014_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f);
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.fire");
|
||||
#endif
|
||||
|
|
|
@ -709,7 +709,6 @@ PMove_Run(void)
|
|||
|
||||
float flFallVel = (self.flags & FL_ONGROUND) ? 0 : -self.velocity[2];
|
||||
|
||||
|
||||
/* maxspeed changes when crouching, TODO: make this game-specific */
|
||||
self.maxspeed = GamePMove_Maxspeed((player)self);
|
||||
|
||||
|
|
Loading…
Reference in a new issue