Valve: Fixed WEAPON_TRIPMINE and WEAPON_SNARK and tweaked some player

animation stuff
This commit is contained in:
Marco Cawthorne 2020-04-01 16:00:00 +02:00
parent a6b301755e
commit db8c10eeac
7 changed files with 58 additions and 44 deletions

View file

@ -63,60 +63,50 @@ void player::draw(void)
Animation_PlayerUpdate();
/*makevectors([0, this.angles[1], 0]);
makevectors([0, this.angles[1], 0]);
float fDirection = dotproduct(this.velocity, v_forward);
if (fDirection != 0)
print(sprintf("fDirection: %d\n", fDirection));
if (fDirection < 0) {
this.baseframe1time -= clframetime;
this.baseframe2time -= clframetime;
this.frame2time -= clframetime;
this.frame1time -= clframetime;
} else {*/
} else {
this.baseframe1time += clframetime;
this.baseframe2time += clframetime;
this.frame2time += clframetime;
this.frame1time += clframetime;
/*}*/
}
this.bonecontrol5 = getplayerkeyfloat(this.entnum - 1, "voiploudness");
makevectors([0, this.angles[1], 0]);
float fCorrect = dotproduct(this.velocity, v_right);
/* hack, we can't play the animations in reverse the normal way */
if (this.baseframe1time < 0.0f) {
this.baseframe1time = 10.0f;
}
float a, s;
if (this.velocity[0] == 0 && this.velocity[1] == 0) {
a = 0;
s = 0;
} else {
a = this.angles[1] - vectoyaw(this.velocity);
s = vlen(this.velocity);
if (s < 100) {
a *= s/100;
}
}
s /= 400;
/* Clamp */
if (a < -180) {
a += 360;
}
if (a > 180) {
a -= 360;
}
if (a > 120) {
a = 120;
}
if (a < -120) {
a = -120;
}
makevectors([0, this.angles[1], 0]);
float fCorrect = dotproduct(this.velocity, v_right) * 0.25f;
/* Turn torso */
this.basesubblendfrac = (a)/-120;
this.bonecontrol1 = fCorrect;
this.bonecontrol2 = this.bonecontrol1 * 0.5;
this.bonecontrol3 = this.bonecontrol2 * 0.5;
this.bonecontrol4 = this.bonecontrol3 * 0.5;
/* Correct the legs */
this.angles[1] -= a;
this.angles[1] -= fCorrect;
if (cvar("bonetest") == 1) {
this.bonecontrol1 = cvar("bonecontrol1");
this.bonecontrol2 = cvar("bonecontrol2");
this.bonecontrol3 = cvar("bonecontrol3");
this.bonecontrol4 = cvar("bonecontrol4");
this.bonecontrol5 = cvar("bonecontrol5");
this.subblendfrac = cvar("subblendfrac");
this.subblend2frac = cvar("subblend2frac");
this.basesubblendfrac = cvar("basesubblendfrac");
this.basesubblend2frac = cvar("basesubblend2frac");
}
}
var float autocvar_standheight = 0;

View file

@ -96,8 +96,11 @@ Player_ReadEntity(float new)
pl.view_ofs[2] = readfloat();
if (fl & PLAYER_BASEFRAME)
pl.baseframe = readbyte();
if (fl & PLAYER_FRAME)
if (fl & PLAYER_FRAME) {
pl.frame = readbyte();
pl.frame1time = 0.0f;
pl.frame2time = 0.0f;
}
if (fl & PLAYER_AMMO1)
pl.a_ammo1 = readbyte();
if (fl & PLAYER_AMMO2)

View file

@ -289,12 +289,10 @@ void CBaseMonster::Physics(void)
if (m_iSequenceState == SEQUENCESTATE_ENDING) {
input_angles = angles = v_angle = m_vecSequenceAngle;
frame = m_flSequenceEnd;
} else {
movetype = MOVETYPE_WALK;
} else if (movetype == MOVETYPE_WALK) {
CheckRoute();
WalkRoute();
runstandardplayerphysics(this);
movetype = MOVETYPE_NONE;
IdleNoise();
if (style != MONSTER_DEAD) {

View file

@ -123,6 +123,10 @@ void trigger_hurt::Respawn(void)
solid = SOLID_TRIGGER;
touch = Touch;
}
setmodel (this, m_oldModel);
self.movetype = MOVETYPE_NONE;
self.modelindex = 0;
self.model = "";
}
void trigger_hurt::trigger_hurt(void)

View file

@ -44,7 +44,7 @@ depending on what the player is doing
=================
*/
void Animation_PlayerUpdate( void ) {
self.basebone = 16;
self.basebone = gettagindex(self, "Bip01 Spine");
#ifdef SSQC
// TODO: Make this faster
@ -158,4 +158,7 @@ void Animation_PlayerTop( float fFrame ) {
void Animation_PlayerTopTemp( float fFrame, float fTime ) {
self.frame = fFrame;
self.frame_time = time + fTime;
#ifdef SSQC
self.SendFlags |= PLAYER_FRAME;
#endif
}

View file

@ -28,9 +28,11 @@ enum
class monster_snark:CBaseMonster
{
void() monster_snark;
virtual void() customphysics;
virtual void(int) Death;
virtual void(int) Pain;
virtual void() Respawn;
};
void
@ -103,7 +105,7 @@ monster_snark::Pain(int i)
}
void
monster_snark::monster_snark(void)
monster_snark::Respawn(void)
{
netname = "Snark";
classname = "snark";
@ -118,6 +120,12 @@ monster_snark::monster_snark(void)
aiment = __NULL__;
weapon = 1.0f;
}
void
monster_snark::monster_snark(void)
{
Respawn();
}
#endif
int w_snark_pickup(int new)

View file

@ -23,9 +23,11 @@
class monster_tripmine:CBaseMonster
{
void() monster_tripmine;
virtual float(entity, float) SendEntity;
virtual void(int) Trip;
virtual void() Ready;
virtual void() Respawn;
};
float
@ -69,7 +71,7 @@ monster_tripmine::Ready(void)
traceline(origin, origin + v_forward * 2048, FALSE, this);
if (!health) {
SendFlags = 1;
SendFlags = -1;
health = 1;
Death =
Pain = Trip;
@ -85,7 +87,7 @@ monster_tripmine::Ready(void)
}
void
monster_tripmine::monster_tripmine(void)
monster_tripmine::Respawn(void)
{
setmodel(this, "models/v_tripmine.mdl");
solid = SOLID_NOT;
@ -104,6 +106,12 @@ monster_tripmine::monster_tripmine(void)
nextthink = time + 4.0f;
}
}
void
monster_tripmine::monster_tripmine(void)
{
Respawn();
}
#endif
/* The WEAPON_TRIPMINE code