Fixed hostage movement so that it fixes #22
This commit is contained in:
parent
d8987e4135
commit
940fd4b084
6 changed files with 44 additions and 25 deletions
|
@ -25,7 +25,7 @@
|
|||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\VGUITeamSelect.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\View.c" />
|
||||
</category>
|
||||
<category name="Server" expanded="yes">
|
||||
<category name="Server" expanded="no">
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Server\AmbientSound.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Server\Ammo.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Server\ArmouryEntity.c" />
|
||||
|
@ -71,7 +71,7 @@
|
|||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Menu\Objects.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Menu\progs.src" />
|
||||
</category>
|
||||
<category name="Shared" expanded="yes">
|
||||
<category name="Shared" expanded="no">
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\Animations.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\BaseMelee.c" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\Effects.c" />
|
||||
|
@ -113,20 +113,11 @@
|
|||
</project>
|
||||
|
||||
<workspace version="Crimson Editor 3.60">
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\View.c" linenum="149" placement="0:1:-1:-1:-4:-23:198:198:1046:663" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Builtins.h" linenum="1402" placement="0:1:-1:-1:-4:-23:220:220:1072:689" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\Defs.h" linenum="109" placement="0:1:-1:-1:-4:-23:0:0:852:469" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\Init.c" linenum="81" placement="0:1:-1:-1:-4:-23:22:22:874:491" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Globals.h" linenum="226" placement="0:1:-1:-1:-4:-23:88:88:940:557" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\Effects.c" linenum="100" placement="0:1:-1:-1:-4:-23:110:110:962:579" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Server\Rules.c" linenum="105" placement="0:1:-1:-1:-4:-23:154:154:1006:623" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\WeaponFlashbang.c" linenum="151" placement="0:1:-1:-1:-4:-23:176:176:1028:645" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Server\Defs.h" linenum="137" placement="0:1:-1:-1:-4:-23:220:220:1072:689" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\Event.c" linenum="503" placement="0:1:-1:-1:-4:-23:0:0:852:469" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\WeaponSmokeGrenade.c" linenum="138" placement="0:1:-1:-1:-4:-23:66:66:918:535" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\Weapons.c" linenum="97" placement="0:1:-1:-1:-4:-23:88:88:940:557" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\WeaponHEGrenade.c" linenum="132" placement="0:1:-1:-1:-4:-23:110:110:962:579" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Shared\Equipment.c" linenum="41" placement="0:1:-1:-1:-4:-23:132:132:984:601" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\README.md" linenum="33" placement="2:3:-1:-1:-4:-23:154:154:1006:623" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Builtins.h" linenum="11" placement="0:1:-1:-1:-4:-23:132:132:980:597" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\FreeCS\Source\Client\Init.c" linenum="29" placement="0:1:-1:-1:-4:-23:154:154:1006:623" />
|
||||
<localfile path="C:\Users\eukara\Dropbox\The Wastes Build\conhistory.txt" linenum="1" placement="0:1:-1:-1:-4:-23:176:176:1028:645" />
|
||||
<localfile path="C:\Users\eukara\Dropbox\The Wastes Build\SDK\COMPILE_ARGS.txt" linenum="1" placement="0:1:-1:-1:-4:-23:110:110:962:579" />
|
||||
<localfile path="C:\Cygwin\home\eukara\Projects\fteqw-code\specs\multiprogs.txt" linenum="1" placement="0:1:-1:-1:-4:-23:132:132:984:601" />
|
||||
<localfile path="E:\WORLDCRAFT\README.TXT" linenum="19" placement="2:3:-1:-1:-4:-23:154:154:1006:623" />
|
||||
</workspace>
|
||||
|
||||
|
|
|
@ -25,6 +25,19 @@ float Math_LerpAngle( float fStart, float fEnd, float fAmount ) {
|
|||
return shortest_angle * fAmount;
|
||||
}
|
||||
|
||||
float Math_Lerp( float fA, float fB, float fPercent ) {
|
||||
return ( fA * ( 1 - fPercent ) ) + ( fB * fPercent );
|
||||
}
|
||||
|
||||
float Math_FixDelta( float fDelta ) {
|
||||
if ( fDelta >= 180 ) {
|
||||
fDelta -= 360;
|
||||
} else if ( fDelta <= -180 ) {
|
||||
fDelta += 360;
|
||||
}
|
||||
return fDelta;
|
||||
}
|
||||
|
||||
float Math_CRandom( void ) {
|
||||
return 2 * ( random() - 0.5 );
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ entity hostage_waypoint( void ) {
|
|||
setsize( ePoint, self.mins, self.maxs );
|
||||
ePoint.classname = "remove_me";
|
||||
ePoint.movetype = MOVETYPE_TOSS;
|
||||
// setmodel( ePoint, "models/chick.mdl" ); // Visual feedback...
|
||||
//setmodel( ePoint, "models/chick.mdl" ); // Visual feedback...
|
||||
return ePoint;
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,16 @@ Determines when we need to spawn a new waypoint
|
|||
=================
|
||||
*/
|
||||
float hostage_waypoint_needed( void ) {
|
||||
if ( self.eUser.fStepTime > time ) {
|
||||
return FALSE;
|
||||
float fState;
|
||||
if ( self.eUser.movement == self.movement ) {
|
||||
fState = FALSE;
|
||||
} else {
|
||||
fState = TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
self.movement = self.eUser.movement;
|
||||
|
||||
return fState;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -125,7 +131,6 @@ void hostage_physics( void ) {
|
|||
input_movevalues = '0 0 0';
|
||||
input_impulse = 0;
|
||||
input_buttons = 0;
|
||||
input_angles = self.angles;
|
||||
|
||||
// Are we meant to follow someone and AREN'T dead?
|
||||
if ( ( self.eUser != world ) && ( self.health > 0 ) ) {
|
||||
|
@ -133,8 +138,10 @@ void hostage_physics( void ) {
|
|||
vector vEndAngle = vectoangles( self.eTargetPoint.origin - self.origin );
|
||||
|
||||
// Slowly turn towards target
|
||||
float fTurn = Math_LerpAngle( self.angles_y, vEndAngle_y, frametime * 4 );
|
||||
self.angles_y += fTurn;
|
||||
float fTurn = Math_LerpAngle( self.v_angle_y, vEndAngle_y, frametime * 4 );
|
||||
self.v_angle_y += fTurn;
|
||||
|
||||
self.v_angle_y = Math_FixDelta( self.v_angle_y );
|
||||
|
||||
// Is the waypoint close? if so, remove and go set the next one!
|
||||
float fDist1 = vlen( self.eTargetPoint.origin - self.origin );
|
||||
|
@ -177,7 +184,6 @@ void hostage_physics( void ) {
|
|||
self.eLastCreated.eTargetPoint = hostage_waypoint();
|
||||
self.eLastCreated = self.eLastCreated.eTargetPoint;
|
||||
}
|
||||
self.fStepTime = time + 0.2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,8 +209,13 @@ void hostage_physics( void ) {
|
|||
}
|
||||
|
||||
input_timelength = frametime;
|
||||
input_angles = self.v_angle;
|
||||
self.movetype = MOVETYPE_WALK;
|
||||
|
||||
runstandardplayerphysics( self );
|
||||
Footsteps_Update();
|
||||
|
||||
self.angles = self.v_angle;
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
}
|
||||
|
||||
|
@ -218,6 +229,10 @@ Entry function for the hostages.
|
|||
void hostage_entity( void ) {
|
||||
|
||||
static void hostage_entity_respawn( void ) {
|
||||
self.v_angle_x = Math_FixDelta ( self.angles_x );
|
||||
self.v_angle_y = Math_FixDelta ( self.angles_y );
|
||||
self.v_angle_z = Math_FixDelta ( self.angles_z );
|
||||
|
||||
setorigin( self, self.origin );
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
|
|
Binary file not shown.
BIN
freecs/menu.dat
BIN
freecs/menu.dat
Binary file not shown.
BIN
freecs/progs.dat
BIN
freecs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue