iw5: test guns (#4)
All checks were successful
Build / build-linux (push) Successful in 7s

This commit is contained in:
2024-05-31 09:59:13 +00:00
parent 6493347cd1
commit a6adab0035
5 changed files with 69 additions and 8 deletions

View File

@ -19,6 +19,7 @@ _ON_PLAYER_CNCT_BEGIN
PLAYER_NOTIFY_CMD( player, "save_pos", "+reload" );
PLAYER_NOTIFY_CMD( player, "load_saved_pos", "+activate" );
player thread onWeaponFired();
player thread jumper();
player thread displaySpeed();
@ -26,6 +27,21 @@ _ON_PLAYER_CNCT_BEGIN
_ON_PLAYER_CNCT_END
onWeaponFired()
{
GENERIC_COROUTINE_END
while ( true )
{
self waittill( "weapon_fired", weapon );
if (weapon == "rpg_mp")
{
self.last_rpg_shot = getTime();
}
}
}
displaySpeed()
{
GENERIC_COROUTINE_END;
@ -36,12 +52,30 @@ displaySpeed()
self.speed_text.label = &"";
self.last_speed_sample = 0;
self.last_z_coordinate = 0.0;
while ( true )
{
player_speed = distance( ZERO_VEC3, self getvelocity() );
current_speed = int( player_speed );
if ( self.origin[2] > self.last_z_coordinate )
{
// We should be going up
if ( isDefined( self.last_rpg_shot ) && self.last_rpg_shot != 0 )
{
late = getTime() - self.last_rpg_shot;
if (late <= 500)
{
iPrintLn( "Late RPG (+" + (late) + ")" );
}
self.last_rpg_shot = 0;
}
}
self.last_z_coordinate = self.origin[2];
if ( self.last_speed_sample == current_speed )
{
// White
@ -115,4 +149,17 @@ _ON_PLAYER_SPAWNED_BEGIN
self setPerk( "specialty_marathon", true, false );
self freezeControls( false );
self takeAllWeapons();
self giveWeapon( "iw5_usp45_mp" );
self giveMaxAmmo( "iw5_usp45_mp" );
self giveWeapon( "rpg_mp" );
self giveMaxAmmo( "rpg_mp" );
wait 1;
self switchToWeaponImmediate( "iw5_usp45_mp" );
_ON_PLAYER_SPAWNED_END

View File

@ -12,15 +12,25 @@
* /Zc:preprocessor is required with the MSVC compiler.
*/
#ifdef IW4
#ifndef IW4MP
#if defined(IW4)
#if !defined(IW4MP)
#define IW4MP
#endif
#ifndef IW4SP
#if !defined(IW4SP)
#define IW4SP
#endif
#endif
#if defined(IW4MP)
#define BOUNCES_DVAR "bg_bounces"
#elif defined(IW4SP) || defined(IW5x)
#define BOUNCES_DVAR "pm_bounces"
#elif defined(IW5)
#define BOUNCES_DVAR "sv_enableBounces"
#else /* Some people from XLabs decided to be creative with the names */
#define BOUNCES_DVAR "pm_bouncing"
#endif
#define TRUE 1
#define FALSE 0
@ -37,6 +47,8 @@
#define GENERIC_INIT \
init() \
{ \
setDvar( BOUNCES_DVAR, 1 ); \
setDvar( "player_sustainAmmo", 1 ); \
thread onPlayerConnect(); \
}
@ -79,7 +91,7 @@
#define PRINT_FUNC_NAME print
#endif
#ifdef _UTILITY_DEBUG
#if defined(_UTILITY_DEBUG)
#define _VERIFY(cond, msg) \
assertEx( cond, msg )