Example #1
0
//later this could be more complicated
void Game::AdvanceTime(ieDword add)
{
	ieDword h = GameTime/(300*AI_UPDATE_TIME);
	GameTime+=add;
	if (h!=GameTime/(300*AI_UPDATE_TIME)) {
		//asking for a new weather when the hour changes
		WeatherBits&=~WB_HASWEATHER;
		//update clock display
		core->GetGUIScriptEngine()->RunFunction("GUICommonWindows", "UpdateClock");
	}
	Ticks+=add*interval;
	//change the tileset if needed
	Map *map = GetCurrentArea();
	if (map && map->ChangeMap(IsDay())) {
		//play the daylight transition movie appropriate for the area
		//it is needed to play only when the area truly changed its tileset
		//this is signalled by ChangeMap
		int areatype = (area->AreaType&(AT_FOREST|AT_CITY|AT_DUNGEON))>>3;
		ieResRef *res;

		if (IsDay()) {
			res=&nightmovies[areatype];
		} else {
			res=&daymovies[areatype];
		}
		if (*res[0]!='*') {
			core->PlayMovie(*res);
		}
	}
Example #2
0
File: Game.cpp Project: dhewg/gemrb
//later this could be more complicated
void Game::AdvanceTime(ieDword add)
{
	ieDword h = GameTime/(300*AI_UPDATE_TIME);
	GameTime+=add;
	if (h!=GameTime/(300*AI_UPDATE_TIME)) {
		//asking for a new weather when the hour changes
		WeatherBits&=~WB_HASWEATHER;
	}
	Ticks+=add*interval;
	//change the tileset if needed
	Map *map = GetCurrentArea();
	if (map && map->ChangeMap(IsDay())) {
		//play the daylight transition movie appropriate for the area
		//it is needed to play only when the area truly changed its tileset
		//this is signalled by ChangeMap
		int areatype = (area->AreaType&(AT_FOREST|AT_CITY|AT_DUNGEON))>>3;
		ieResRef *res;

		printMessage("Game","Switching DayLight\n",GREEN);
		if (IsDay()) {
			res=&nightmovies[areatype];
		} else {
			res=&daymovies[areatype];
		}
		if (*res[0]!='*') {
			core->PlayMovie(*res);
		}
	}