|
1 |
| -// COPYRIGHT 2009 - 2023 by the Open Rails project. |
| 1 | +// COPYRIGHT 2009 - 2023 by the Open Rails project. |
2 | 2 | //
|
3 | 3 | // This file is part of Open Rails.
|
4 | 4 | //
|
@@ -151,13 +151,19 @@ public SkyLayer(STFReader stf)
|
151 | 151 |
|
152 | 152 | public class SkySatellite
|
153 | 153 | {
|
| 154 | + public int RiseTime; |
| 155 | + public int SetTime; |
| 156 | + public SkySatelliteType Type; |
154 | 157 | public string TextureName;
|
155 | 158 | public string TextureMode;
|
156 | 159 |
|
157 | 160 | public SkySatellite(STFReader stf)
|
158 | 161 | {
|
159 | 162 | stf.ParseWholeBlock(new[]
|
160 | 163 | {
|
| 164 | + new STFReader.TokenProcessor("world_sky_satellite_rise_time", () => RiseTime = ParseTime(stf.ReadStringBlock("00:00:00"))), |
| 165 | + new STFReader.TokenProcessor("world_sky_satellite_set_time", () => SetTime = ParseTime(stf.ReadStringBlock("00:00:00"))), |
| 166 | + new STFReader.TokenProcessor("world_sky_satellite_light", () => Type = (SkySatelliteType)stf.ReadIntBlock((int)SkySatelliteType.Unknown)), |
161 | 167 | new STFReader.TokenProcessor("world_anim_shader", () => stf.ParseWholeBlock(new[]
|
162 | 168 | {
|
163 | 169 | new STFReader.TokenProcessor("world_shader", () =>
|
@@ -185,6 +191,24 @@ public SkySatellite(STFReader stf)
|
185 | 191 | })),
|
186 | 192 | });
|
187 | 193 | }
|
| 194 | + |
| 195 | + public enum SkySatelliteType |
| 196 | + { |
| 197 | + Unknown = -1, |
| 198 | + Moon = 0, |
| 199 | + Sun = 1, |
| 200 | + } |
| 201 | + |
| 202 | + int ParseTime(string time) |
| 203 | + { |
| 204 | + var timeParts = time.Split(':'); |
| 205 | + if (timeParts.Length != 3 || !byte.TryParse(timeParts[0], out var hours) || !byte.TryParse(timeParts[1], out var minutes) || !byte.TryParse(timeParts[2], out var seconds)) |
| 206 | + { |
| 207 | + return 0; |
| 208 | + } |
| 209 | + |
| 210 | + return (hours * 3600) + (minutes * 60) + seconds; |
| 211 | + } |
188 | 212 | }
|
189 | 213 | }
|
190 | 214 | }
|
0 commit comments