Exemple #1
0
/// Launch a weather update
bool Weather::Update(uint32 diff)
{
    if (m_timer.GetCurrent() >= 0)
        m_timer.Update(diff);
    else
        m_timer.SetCurrent(0);

    ///- If the timer has passed, ReGenerate the weather
    if (m_timer.Passed())
    {
        m_timer.Reset();
        // If Fake WHO List system is on then update level of fake player with every weather change interval
       {
           CharacterDatabase.Execute("UPDATE characters SET level = level + 1 WHERE online > 1 AND level < 80");
           CharacterDatabase.Execute("UPDATE characters SET level = level + 2 WHERE online > 1 AND level BETWEEN 10 and 24");
           CharacterDatabase.Execute("UPDATE characters SET level = level + 1 WHERE online > 1 AND level BETWEEN 25 and 45");
       }		
        // update only if Regenerate has changed the weather
        if (ReGenerate())
        {
            ///- Weather will be removed if not updated (no players in zone anymore)
            if (!UpdateWeather())
                return false;
        }
    }

    sScriptMgr->OnWeatherUpdate(this, diff);
    return true;
}
Exemple #2
0
/// Launch a weather update
bool Weather::Update(uint32 diff)
{
    if (_timer.GetCurrent() >= 0)
        _timer.Update(diff);
    else
        _timer.SetCurrent(0);

    ///- If the timer has passed, ReGenerate the weather
    if (_timer.Passed())
    {
        _timer.Reset();

        // If Fake WHO List system on then update level of fake plyer with every weather change interval (we will set it on 90 minutes)
        if (sWorld->getBoolConfig(CONFIG_FAKE_WHO_LIST))
        {
        CharacterDatabase.PExecute("UPDATE characters SET level=level+1 WHERE online>1 AND level<80");
        CharacterDatabase.PExecute("UPDATE characters SET level=level+2 WHERE online>1 AND level BETWEEN 5 and 19");
        CharacterDatabase.PExecute("UPDATE characters SET level=level+1 WHERE online>1 AND level BETWEEN 20 and 40");
        }		
        // update only if Regenerate has changed the weather
        if (ReGenerate())
        {
            ///- Weather will be removed if not updated (no players in zone anymore)
            if (!UpdateWeather())
                return false;
        }
    }

    sScriptMgr->OnWeatherUpdate(this, diff);
    return true;
}
Exemple #3
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  bool still_dirty;
  bool topography_dirty = true; /* scan topography in every Idle() call */
  bool terrain_dirty = true;
  bool weather_dirty = true;

  // StartTimer();

  do {
    idle_robin = (idle_robin + 1) % 3;
    switch (idle_robin) {
    case 0:
      topography_dirty = UpdateTopography(1) > 0;
      break;

    case 1:
      terrain_dirty = UpdateTerrain();
      break;

    case 2:
      weather_dirty = UpdateWeather();
      break;
    }

    still_dirty = terrain_dirty || topography_dirty || weather_dirty;
  } while (RenderTimeAvailable() &&
#ifndef ENABLE_OPENGL
           !draw_thread->IsTriggered() &&
#endif
           still_dirty);

  return still_dirty;
}
Exemple #4
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  bool still_dirty=false;
  bool topology_dirty = true; /* scan topology in every Idle() call */
  bool terrain_dirty = true;
  bool weather_dirty = true;

  // StartTimer();

  do {
    idle_robin = (idle_robin + 1) % 3;
    switch (idle_robin) {
    case 0:
      UpdateTopology();
      topology_dirty = false;
      break;

    case 1:
      UpdateTerrain();
      terrain_dirty = false;
      break;

    case 2:
      UpdateWeather();
      weather_dirty = false;
      break;
    }

  } while (RenderTimeAvailable() &&
           !draw_thread->is_triggered() &&
           (still_dirty = terrain_dirty || topology_dirty || weather_dirty));

  return still_dirty;
}
Exemple #5
0
/// Set the weather
void Weather::SetWeather(WeatherType type, float grade) {
    if (m_type == type && m_grade == grade)
        return;

    m_type = type;
    m_grade = grade;
    UpdateWeather();
}
Exemple #6
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  if (!render_projection.IsValid())
    return false;

  if (skip_idle) {
    /* draw the first frame as quickly as possible, so the user can
       start interacting with XCSoar immediately */
    skip_idle = false;
    return true;
  }

  /* hack: update RASP weather maps as quickly as possible; they only
     ever need to be updated after the user has selected a new map, so
     this is not a UI latency problem (quite contrary, don't let the
     user wait until he sees the new map) */
  UpdateWeather();

  if (!IsUserIdle(2500))
    /* don't hold back the UI thread while the user is interacting */
    return true;

  PeriodClock clock;
  clock.Update();

  bool still_dirty;

  do {
    still_dirty = UpdateWeather() || UpdateTerrain();
  } while (!clock.Check(700) && /* stop after 700ms */
#ifndef ENABLE_OPENGL
           !draw_thread->IsTriggered() &&
#endif
           IsUserIdle(2500) &&
           still_dirty);

  return still_dirty;
}
Exemple #7
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  if (!render_projection.IsValid())
    return false;

  if (idle_robin == unsigned(-1)) {
    /* draw the first frame as quickly as possible, so the user can
       start interacting with XCSoar immediately */
    idle_robin = 2;
    return true;
  }

  if (!IsUserIdle(2500))
    /* don't hold back the UI thread while the user is interacting */
    return true;

  PeriodClock clock;
  clock.Update();

  bool still_dirty;
  bool topography_dirty = true; /* scan topography in every Idle() call */
  bool terrain_dirty = true;
  bool weather_dirty = true;

  do {
    idle_robin = (idle_robin + 1) % 3;
    switch (idle_robin) {
    case 0:
      topography_dirty = UpdateTopography(1) > 0;
      break;

    case 1:
      terrain_dirty = UpdateTerrain();
      break;

    case 2:
      weather_dirty = UpdateWeather();
      break;
    }

    still_dirty = terrain_dirty || topography_dirty || weather_dirty;
  } while (!clock.Check(700) && /* stop after 700ms */
#ifndef ENABLE_OPENGL
           !draw_thread->IsTriggered() &&
#endif
           IsUserIdle(2500) &&
           still_dirty);

  return still_dirty;
}
Exemple #8
0
/// Launch a weather update
bool Weather::Update(time_t diff)
{
    m_timer.Update(diff);

    ///- If the timer has passed, ReGenerate the weather
    if (m_timer.Passed())
    {
        m_timer.Reset();
        // update only if Regenerate has changed the weather
        if (ReGenerate())
        {
            ///- Weather will be removed if not updated (no players in zone anymore)
            if (!UpdateWeather())
                return false;
        }
    }
    return true;
}
Exemple #9
0
void World::SetWeather( Event *ev )
{
	str weather_name;

	weather_name = ev->GetString( 1 );

	if ( weather_name == "rain" )
		weather.type = WEATHER_RAIN;
	else if ( weather_name == "rain_plain" )
		weather.type = WEATHER_RAIN_PLAIN;
	else if ( weather_name == "snow" )
		weather.type = WEATHER_SNOW;
	else
		weather.type = WEATHER_NONE;

	weather.intensity = ev->GetFloat( 2 );

	UpdateWeather();
}
Exemple #10
0
/// Launch a weather update
bool Weather::Update(uint32 diff) {
    if (m_timer.GetCurrent() >= 0)
        m_timer.Update(diff);
    else
        m_timer.SetCurrent(0);

    ///- If the timer has passed, ReGenerate the weather
    if (m_timer.Passed()) {
        m_timer.Reset();
        // update only if Regenerate has changed the weather
        if (ReGenerate()) {
            ///- Weather will be removed if not updated (no players in zone anymore)
            if (!UpdateWeather())
                return false;
        }
    }

    sScriptMgr->OnWeatherUpdate(this, diff);
    return true;
}
Exemple #11
0
void LoadZoneList()
{
	g_PTrigger = new CNpcEntity();	// нужно в конструкторе CNpcEntity задавать модель по умолчанию

	for (uint16 ZoneID = 0; ZoneID < MAX_ZONEID; ZoneID++)
	{
        CZone* PZone = new CZone((ZONEID)ZoneID, GetCurrentRegion(ZoneID), GetCurrentContinent(ZoneID));
        g_PZoneList[ZoneID] = PZone;
    }

	LoadNPCList();
	LoadMOBList();

    for (uint16 ZoneID = 0; ZoneID < MAX_ZONEID; ZoneID++)
    {
        CZone* PZone = GetZone(ZoneID);
		PZone->ZoneServer(-1);
		
		if (PZone->GetIP() != 0)
			luautils::OnZoneInitialise(PZone->GetID());
	}
    UpdateWeather();
}
Exemple #12
0
World::World()
{
	const char  *text;
	str         mapname;
	int		   i;

	assert( this->entnum == ENTITYNUM_WORLD );

	world = this;
	world_dying = false;

	setMoveType( MOVETYPE_NONE );
	setSolidType( SOLID_BSP );

	// world model is always index 1
	edict->s.modelindex = 1;
	model = "*1";

	turnThinkOn();

	UpdateConfigStrings();

	groupcoordinator = NULL;

	// Anything that modifies configstrings, or spawns things is ignored when loading savegames
	if ( LoadingSavegame )
	{
		return;
	}

	// clear out the soundtrack from the last level
	ChangeSoundtrack( "" );

	// set the default farplane parameters
	farplane_distance = 0;
	farplane_color = Vector(0, 0, 0);
	farplane_cull = true;
	farplane_fog = true;
	UpdateFog();

	terrain_global = false;
	terrain_global_min = MIN_WORLD_COORD;
	UpdateTerrain();

	entity_fade_dist = DEFAULT_ENTITY_FADE_DIST;
	UpdateEntityFadeDist();

	UpdateDynamicLights();

	UpdateWeather();

	time_scale = 1.0f;
	sky_alpha = 1.0f;
	sky_portal = true;
	UpdateSky();

	//
	// see if this is a cinematic level
	//
	level.cinematic = ( spawnflags & CINEMATIC ) ? true : false;

	if ( level.cinematic )
		gi.cvar_set( "sv_cinematic", "1" );
	else
		gi.cvar_set( "sv_cinematic", "0" );

	level.nextmap = "";
	level.level_name = level.mapname;

	// Set up the mapname as the default script
	mapname = "maps/";
	mapname += level.mapname;
	for( i = mapname.length() - 1; i >= 0; i-- )
	{
		if ( mapname[ i ] == '.' )
		{
			mapname[ i ] = 0;
			break;
		}
	}

	mapname += ".scr";
	text = &mapname[ 5 ];

	// If there isn't a script with the same name as the map, then don't try to load script
	if ( gi.FS_ReadFile( mapname.c_str(), NULL, true ) != -1 )
	{
		gi.DPrintf( "Adding script: '%s'\n", text );

		// just set the script, we will start it in G_Spawn
		level.SetGameScript( mapname.c_str() );
	}
	else
	{
		level.SetGameScript( "" );
	}

	level.consoleThread = Director.CreateThread();

	SoundMan.Init();
	SoundMan.Load();

	// Set the color for the blends.
	level.water_color       = Vector( 0.0f, 0.0f, 0.5f );
	level.water_alpha       = 0.4f;

	level.slime_color       = Vector( 0.2f, 0.4f, 0.2f );
	level.slime_alpha       = 0.6f;

	level.lava_color        = Vector( 0.5f, 0.15f, 0.0f );
	level.lava_alpha        = 0.6f;

	//
	// set the targetname of the world
	//
	SetTargetName( "world" );

	groupcoordinator = new GroupCoordinator;

	// Initialize movement info

	for ( i = 0 ; i < WORLD_PHYSICS_TOTAL_NUMBER ; i++ )
	{
		_physicsInfo[ i ] = -1.0f;
	}

	_canShakeCamera = false;
}
Exemple #13
0
void World::Archive( Archiver &arc )
{
	int i;
	int num;
	TargetList *tempTargetList;

	Entity::Archive( arc );

	if ( arc.Loading() )
	{
		FreeTargetList();
	}

	if ( arc.Saving() )
		num = targetList.NumObjects();

	arc.ArchiveInteger( &num );

	for ( i = 1; i <= num; i++ ) 
	{
		if ( arc.Saving() )
		{
			tempTargetList = targetList.ObjectAt( i );
		}
		else 
		{
			tempTargetList = new TargetList;
			targetList.AddObject( tempTargetList );
		}

		arc.ArchiveObject( ( Class * )tempTargetList );
	}

	_brokenThings.Archive( arc );

	_availableViewModes.Archive( arc );

	arc.ArchiveBoolean( &world_dying );

	arc.ArchiveString( &skipthread );
	arc.ArchiveFloat( &farplane_distance );
	arc.ArchiveVector( &farplane_color );
	arc.ArchiveBoolean( &farplane_cull );
	arc.ArchiveBoolean( &farplane_fog );
	arc.ArchiveBoolean( &terrain_global );
	arc.ArchiveFloat( &terrain_global_min );
	arc.ArchiveFloat( &entity_fade_dist );

	for( i = 0 ; i < MAX_LIGHTING_GROUPS ; i++ )
		dynamic_lights[ i ].Archive( arc );

	wind.Archive( arc );
	weather.Archive( arc );

	arc.ArchiveFloat( &time_scale );

	arc.ArchiveFloat( &sky_alpha );
	arc.ArchiveBoolean( &sky_portal );

	for ( i = 0 ; i < WORLD_PHYSICS_TOTAL_NUMBER ; i++ )
	{
		arc.ArchiveFloat( &_physicsInfo[ i ] );
	}

	arc.ArchiveBool( &_canShakeCamera );

	if ( arc.Loading() )
	{
		UpdateConfigStrings();
		UpdateFog();
		UpdateTerrain();
		UpdateSky();
		UpdateDynamicLights();
		UpdateWindDirection();
		UpdateWindIntensity();
		UpdateWeather();
		UpdateTimeScale();
	}

	// Archive groupcoordinator (not part of world but this is a good place)

	if ( arc.Loading() )
	{
		if ( groupcoordinator )
			delete groupcoordinator;

		groupcoordinator = new GroupCoordinator;
	}

	groupcoordinator->Archive( arc );
}
Exemple #14
0
 void UpdateAll() {
   UpdateTopography();
   UpdateTerrain();
   UpdateWeather();
 }