diff --git a/planet/Arena.ocf/FrozenFortress.ocs/Script.c b/planet/Arena.ocf/FrozenFortress.ocs/Script.c index 7fe463c5c..160d4a7ff 100644 --- a/planet/Arena.ocf/FrozenFortress.ocs/Script.c +++ b/planet/Arena.ocf/FrozenFortress.ocs/Script.c @@ -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(); diff --git a/planet/Missions.ocf/Crash.ocs/Script.c b/planet/Missions.ocf/Crash.ocs/Script.c index 10eb883d7..a43f43831 100644 --- a/planet/Missions.ocf/Crash.ocs/Script.c +++ b/planet/Missions.ocf/Crash.ocs/Script.c @@ -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); diff --git a/planet/Missions.ocf/MtBrame.ocs/Script.c b/planet/Missions.ocf/MtBrame.ocs/Script.c index cb5034f35..a6b588c26 100644 --- a/planet/Missions.ocf/MtBrame.ocs/Script.c +++ b/planet/Missions.ocf/MtBrame.ocs/Script.c @@ -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); diff --git a/planet/Missions.ocf/Skylands.ocs/Script.c b/planet/Missions.ocf/Skylands.ocs/Script.c index 127bf8797..4d35956e9 100644 --- a/planet/Missions.ocf/Skylands.ocs/Script.c +++ b/planet/Missions.ocf/Skylands.ocs/Script.c @@ -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); diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/DefCore.txt b/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/DefCore.txt deleted file mode 100644 index 7bf67eb5b..000000000 --- a/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/DefCore.txt +++ /dev/null @@ -1,5 +0,0 @@ -[DefCore] -id=Environment_Celestial -Version=6,0 -Category=C4D_Environment|C4D_StaticBack -Picture=0,0,128,128 diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/Graphics.png b/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/Graphics.png deleted file mode 100644 index 0abcae414..000000000 Binary files a/planet/Objects.ocd/Environment.ocd/Time.ocd/CelestialEnv.ocd/Graphics.png and /dev/null differ diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c index e5d54524f..48b523a94 100644 --- a/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c @@ -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()); diff --git a/planet/Parkour.ocf/ShiverPeak.ocs/Script.c b/planet/Parkour.ocf/ShiverPeak.ocs/Script.c index c8abe6b26..b11be399f 100644 --- a/planet/Parkour.ocf/ShiverPeak.ocs/Script.c +++ b/planet/Parkour.ocf/ShiverPeak.ocs/Script.c @@ -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; } + diff --git a/planet/Tutorial.ocf/Tutorial04.ocs/Script.c b/planet/Tutorial.ocf/Tutorial04.ocs/Script.c index e9ea68608..c6ff86980 100644 --- a/planet/Tutorial.ocf/Tutorial04.ocs/Script.c +++ b/planet/Tutorial.ocf/Tutorial04.ocs/Script.c @@ -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); diff --git a/planet/Worlds.ocf/AcidGoldMine.ocs/Script.c b/planet/Worlds.ocf/AcidGoldMine.ocs/Script.c index e2d677830..9089c4738 100644 --- a/planet/Worlds.ocf/AcidGoldMine.ocs/Script.c +++ b/planet/Worlds.ocf/AcidGoldMine.ocs/Script.c @@ -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 diff --git a/planet/Worlds.ocf/GemGrabbers.ocs/Script.c b/planet/Worlds.ocf/GemGrabbers.ocs/Script.c index 81865f790..b4d315de1 100644 --- a/planet/Worlds.ocf/GemGrabbers.ocs/Script.c +++ b/planet/Worlds.ocf/GemGrabbers.ocs/Script.c @@ -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); diff --git a/planet/Worlds.ocf/GoldRush.ocs/Script.c b/planet/Worlds.ocf/GoldRush.ocs/Script.c index ba29cc595..1194584fd 100644 --- a/planet/Worlds.ocf/GoldRush.ocs/Script.c +++ b/planet/Worlds.ocf/GoldRush.ocs/Script.c @@ -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); diff --git a/planet/Worlds.ocf/IronPeak.ocs/Script.c b/planet/Worlds.ocf/IronPeak.ocs/Script.c index eb18a4836..5d114d366 100644 --- a/planet/Worlds.ocf/IronPeak.ocs/Script.c +++ b/planet/Worlds.ocf/IronPeak.ocs/Script.c @@ -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); diff --git a/planet/Worlds.ocf/Krakatoa.ocs/Script.c b/planet/Worlds.ocf/Krakatoa.ocs/Script.c index 08de75972..f2a651368 100644 --- a/planet/Worlds.ocf/Krakatoa.ocs/Script.c +++ b/planet/Worlds.ocf/Krakatoa.ocs/Script.c @@ -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);