remove celestial environment object in favor of scenario callback

stable-6.1
Maikel de Vries 2015-04-06 22:06:04 +02:00
parent 1cf1e309ea
commit e9b076f6d3
14 changed files with 18 additions and 35 deletions

View File

@ -10,7 +10,6 @@ protected func Initialize()
{
// Environment
CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36);
CreateObject(Environment_Celestial);
var time=CreateObject(Environment_Time);
time->SetTime();
time->SetCycleSpeed();

View File

@ -13,7 +13,6 @@ func DoInit(int first_player)
// Set time of day to evening and create some clouds and celestials.
Cloud->Place(20);
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(600);
time->SetCycleSpeed(20);

View File

@ -16,7 +16,6 @@ func DoInit(int first_player)
{
// Set time of day to morning and create some clouds and celestials.
Cloud->Place(20);
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(400);
time->SetCycleSpeed(6);

View File

@ -14,7 +14,6 @@ func DoInit(int first_player)
//CreateObjectAbove(LiftTower, 178,405, first_player);
// Set time of day to evening and create some clouds and celestials.
Cloud->Place(15);
EnsureObject(Environment_Celestial,0,0,-1);
EnsureObject(Rule_BuyAtFlagpole,0,0,-1);
SetSkyAdjust(0xff000000);
var storm = EnsureObject(Storm,0,0,NO_OWNER);

View File

@ -1,5 +0,0 @@
[DefCore]
id=Environment_Celestial
Version=6,0
Category=C4D_Environment|C4D_StaticBack
Picture=0,0,128,128

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -58,16 +58,17 @@ protected func Initialize()
// Only one time control object.
if (ObjectCount(Find_ID(Environment_Time)) > 1)
return RemoveObject();
// Determine the frame times for day and night events.
time_set = {
sunrise_start = 10800, // 3:00
sunrise_end = 32400, // 9:00
sunset_start = 54000, // 15:00
sunset_end = 75600, // 21:00
sunrise_start = 3 * 60 * 60, // 3:00
sunrise_end = 9 * 60 * 60, // 9:00
sunset_start = 15 * 60 * 60, // 15:00
sunset_end = 21 * 60 * 60, // 21:00
};
// Create moon and stars.
if (FindObject(Find_ID(Environment_Celestial)))
// Create moon and stars if celestial objects are not blocked by the scenario.
if (!GameCall("HasNoCelestials"))
{
PlaceStars();
CreateObjectAbove(Moon, LandscapeWidth() / 2, LandscapeHeight() / 6);
@ -102,12 +103,12 @@ public func IsNight()
private func PlaceStars()
{
// since stars are almost completely parallax (=in screen coordinates), we only need
// to place stars for max. a reasonable maximum resolution. Lets say 1600x1200
var lw = Min(LandscapeWidth(), 1600);
// Since stars are almost completely parallax (=in screen coordinates), we only need
// to place stars for max. a reasonable maximum resolution, let's say 1920x1200.
var lw = Min(LandscapeWidth(), 1920);
var lh = Min(LandscapeHeight(), 1200);
//Star Creation
// Star Creation.
var maxfailedtries = lw * lh / 40000;
var failed = 0;
@ -120,8 +121,7 @@ private func PlaceStars()
continue;
}
failed++;
}
}
return;
}
@ -285,11 +285,6 @@ public func SaveScenarioObject(props)
{
if (!inherited(props, ...))
return false;
// Initialize function depends on this object implicitely.
// So make sure it's created before this.
var celestial_env = FindObject(Find_ID(Environment_Celestial));
if (celestial_env)
celestial_env->MakeScenarioSaveName();
// Save time props.
if (GetTime() != 43200)
props->AddCall("Time", this, "SetTime", GetTime());

View File

@ -108,3 +108,7 @@ global func FxSnowfallTimer(object target, effect, int timer)
CastPXS("Snow", 5, 1, RandomX(0, LandscapeWidth()), 1);
return 1;
}
// This scenario has day and night but no celestial objects.
public func HasNoCelestials() { return true; }

View File

@ -13,7 +13,6 @@ protected func Initialize()
// Environment
PlaceGrass(85);
Cloud->Place(15);
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(22*60);
time->SetCycleSpeed(0);

View File

@ -25,8 +25,7 @@ protected func Initialize()
Volcano->SetMaterial("DuroLava");
Meteor->SetChance(22);
// We aren't doing much outside anyway; celestials are a bit of a waste
/*CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
/*var time = CreateObject(Environment_Time);
time->SetTime(60*12);
time->SetCycleSpeed(20);*/
// Starting materials in lorry

View File

@ -91,7 +91,6 @@ protected func InitializePlayer(int plr)
private func InitEnvironment(int difficulty)
{
// Set time to almost night and have stars.
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(20 * 60 + 15);
time->SetCycleSpeed(0);

View File

@ -96,7 +96,6 @@ private func InitEnvironment()
// Set time of day to evening and create some clouds and celestials.
Cloud->Place(10);
Cloud->SetPrecipitation("Water", 8);
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(60 * 12);
time->SetCycleSpeed(20);

View File

@ -107,8 +107,6 @@ private func InitEnvironment(int difficulty)
// Set time of day to evening and create some clouds and celestials.
Cloud->Place(20);
Cloud->SetPrecipitation("Snow", 20 + 5 * difficulty);
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(60 * 22);
time->SetCycleSpeed(0);

View File

@ -113,7 +113,6 @@ private func InitEnvironment(int difficulty)
SetGamma(RGB(0, 0, 0), RGB(128 - dark, 128 - dark, 128 - dark), RGB(255 - 2 * dark, 255 - 2 * dark, 255 - 2 * dark));
// Time of days and celestials.
CreateObject(Environment_Celestial);
var time = CreateObject(Environment_Time);
time->SetTime(60 * 20);
time->SetCycleSpeed(20);