Example #1
0
void CASW_Arena::UpdateArena()
{
	// has arena mode just been turned on?
	if ( !m_bStartedArenaMode )
	{
		for ( int i=0; i< m_ArenaAliens.Count(); i++ )
		{
			UTIL_PrecacheOther( m_ArenaAliens[i]->m_szAlienClass );
		}
		m_bStartedArenaMode = true;
		m_ArenaRestTimer.Start( 3.0f );
	}

	if ( m_ArenaShuffleWallsTimer.HasStarted() && m_ArenaShuffleWallsTimer.IsElapsed() )
	{
		TeleportPlayersToSpawn();
		ShuffleArenaWalls();
		m_ArenaShuffleWallsTimer.Invalidate();
		m_ArenaRestTimer.Start( 2.5f );
	}

	if ( m_ArenaRestTimer.HasStarted() && m_ArenaRestTimer.IsElapsed() )
	{
		SpawnArenaWave();
		m_ArenaRestTimer.Invalidate();
	}

	if ( m_ArenaCheckTimer.HasStarted() && m_ArenaCheckTimer.IsElapsed() )
	{
		// count live aliens
		CBaseEntity* pEntity = NULL;
		int iAliens = 0;
		while ((pEntity = gEntList.NextEnt( pEntity )) != NULL)
		{
			if ( pEntity && pEntity->IsNPC() && pEntity->Classify() != CLASS_ASW_MARINE && pEntity->GetHealth() > 0 )
				iAliens++;
		}

		if ( iAliens <= 0 && !m_ArenaRestTimer.HasStarted() && !m_ArenaShuffleWallsTimer.HasStarted() )
		{						
			RefillMarineAmmo();	

			if ( asw_arena_shuffle_walls.GetInt() > 0 && ( m_iArenaWave % asw_arena_shuffle_walls.GetInt() ) == 0 && ( m_iArenaWave != 0 ) )
			{
				UTIL_CenterPrintAll( UTIL_VarArgs("Wave %d clear!\nThe arena is changing...", m_iArenaWave ) );
				m_ArenaShuffleWallsTimer.Start( 5.0f );
			}
			else
			{
				UTIL_CenterPrintAll( UTIL_VarArgs("Wave %d clear!", m_iArenaWave ) );
				m_ArenaRestTimer.Start( RandomFloat( 8, 12 ) );
			}

			m_ArenaCheckTimer.Invalidate();
		}	
	}
}
//-----------------------------------------------------------------------------
// Purpose: Make sure the version of the map in WC is the same as the map 
//			that's being edited 
// Input  :
// Output :
//-----------------------------------------------------------------------------
bool NWCEdit::IsWCVersionValid(void)
{
	int status = Editor_CheckVersion(STRING(gpGlobals->mapname), gpGlobals->mapversion, false);
	if (!status)
	{
		return true;
	}
	else if (status == Editor_NotRunning)
	{
		Msg("\nAborting map_edit\nWorldcraft not running...\n\n");
		UTIL_CenterPrintAll( "Worldcraft not running..." );
		engine->ServerCommand("disconnect\n");
	}
	else
	{
		Msg("\nAborting map_edit\nWC/Engine map versions different...\n\n");
		UTIL_CenterPrintAll( "WC/Engine map versions different..." );
		engine->ServerCommand("disconnect\n");
	}
	return false;
}