rendered paste bodyvoid rvWeapon::State_Reload() {
enum
{
STAGE_INIT,
STAGE_WAIT,
};
switch( currentStage )
{
case STAGE_INIT:
if ( !wsfl.reloading ) {
if( wsfl.netReload )
wsfl.netReload = false;
else
NetReload();
wsfl.reloading = true;
//SetStatus( WP_RELOAD ); // just made "reload" blink on the HUD..
SetState ( WEAP_STATE_LOWER );
SetStage( STAGE_INIT ); // xavior: I'm not 100% sure about these..
return;
}
nextReloadTime = gameLocal.time + reloadTime;
raiselower_time = WEAPON_RAISELOWER_TIME;
raiselower_endtime = gameLocal.time + raiselower_time;
SetStatus( WP_RELOAD );
SetStage( STAGE_WAIT );
return;
case STAGE_WAIT:
if ( gameLocal.time > nextReloadTime ) {
AddToClip( 1 );
if( AmmoInClip() < ClipSize() && AmmoAvailable() > AmmoInClip() ) {
nextReloadTime = gameLocal.time + reloadTime;
SetStatus( WP_RELOAD );
SetStage( STAGE_WAIT );
return;
}
SetStatus( WP_RELOADDONE );
if ( wsfl.lowerWeapon ) {
SetStatus( WP_HOLSTERED );
SetState ( WEAP_STATE_LOWER );
SetStage( STAGE_INIT );
return;
}
SetState ( WEAP_STATE_RAISE );
SetStage( STAGE_INIT );
wsfl.reloading = false;
//nextAttackTime = gameLocal.time + 200;
return;
}
SetStage( STAGE_WAIT );
return;
}
StateError( "Unknown stage #" ); //xavior: this looks like what 3j tried to do with the above states
return; //in place of SRESULT_ERROR
}