/* ============== CG_CheckAmmo If the ammo has gone low enough to generate the warning, play a sound ============== */ void CG_CheckAmmo( void ) { // int i; int total; int previous; // int weapons; #if 0 // see about how many seconds of ammo we have remaining weapons = cg.snap->ps.stats[ STAT_WEAPONS ]; total = 0; for ( i = WP_SABER; i < WP_NUM_WEAPONS i++ ) { if ( ! ( weapons & ( 1 << i ) ) ) continue; /* switch ( i ) { case WP_ROCKET_LAUNCHER: case WP_GRENADE_LAUNCHER: case WP_RAILGUN: case WP_SHOTGUN: total += cg.snap->ps.ammo[i] * 1000; break; default: total += cg.snap->ps.ammo[i] * 200; break; } */ if ( total >= 5000 ) { cg.lowAmmoWarning = 0; return; } } #endif // Don't bother drawing the ammo warning when have no weapon selected if ( cg.weaponSelect == WP_NONE ) { return; } total = cg.snap->ps.ammo[weaponData[cg.weaponSelect].ammoIndex]; if (total > weaponData[cg.weaponSelect].ammoLow) // Low on ammo? { cg.lowAmmoWarning = 0; return; } previous = cg.lowAmmoWarning; if (!total) // We're completely freak'in out! { cg.lowAmmoWarning = 2; } else // Got a little left { cg.lowAmmoWarning = 1; } // play a sound on transitions if ( cg.lowAmmoWarning != previous ) { cgi_S_StartLocalSound( cgs.media.noAmmoSound, CHAN_LOCAL_SOUND ); //"sound/weapons/noammo.wav" } }
//------------------------------------------------------ void SFxHelper::PlayLocalSound( int sfxHandle, int channelNum ) { cgi_S_StartLocalSound(sfxHandle, channelNum); }
/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ static void CG_ServerCommand( void ) { const char *cmd; cmd = CG_Argv(0); if ( !strcmp( cmd, "cp" ) ) { CG_CenterPrint( CG_Argv(1), SCREEN_HEIGHT * 0.25, BIGCHAR_WIDTH ); return; } if ( !strcmp( cmd, "cs" ) ) { CG_ConfigStringModified(); return; } if ( !strcmp( cmd, "print" ) ) { CG_Printf( "%s", CG_Argv(1) ); return; } if ( !strcmp( cmd, "chat" ) ) { cgi_S_StartLocalSound ( cgs.media.talkSound, CHAN_LOCAL_SOUND ); CG_Printf( "%s\n", CG_Argv(1) ); return; } // Scroll text if ( !strcmp( cmd, "st" ) ) { CG_ScrollText( CG_Argv(1), SCREEN_HEIGHT * 0.25, BIGCHAR_WIDTH ); return; } // Cinematic text if ( !strcmp( cmd, "ct" ) ) { CG_CaptionText( CG_Argv(1), cgs.sound_precache[atoi(CG_Argv(2))], SCREEN_HEIGHT * 0.25, SMALLCHAR_WIDTH ); return; } // Text stop if ( !strcmp( cmd, "cts" ) ) { CG_CaptionTextStop(); return; } // Game text spoken by a character if ( !strcmp( cmd, "gt" ) ) { CG_GameText(SCREEN_HEIGHT * 0.25, SMALLCHAR_WIDTH ); return; } // Text to appear in center of screen with an LCARS frame around it. if ( !strcmp( cmd, "lt" ) ) { CG_LCARSText( CG_Argv(1), SCREEN_HEIGHT * 0.25, SMALLCHAR_WIDTH ); return; } // clientLevelShot is sent before taking a special screenshot for // the menu system during development if ( !strcmp( cmd, "clientLevelShot" ) ) { cg.levelShot = qtrue; return; } if ( !strcmp( cmd, "vmsg" ) ) { #if 0 char snd[MAX_QPATH]; Com_sprintf(snd, sizeof(snd), "sound/teamplay/vmsg/%s.wav", CG_Argv(1) ); cgi_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgi_S_RegisterSound (snd) ); #endif return; } CG_Printf( "Unknown client game command: %s\n", cmd ); }