Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarSkyTypes.hpp
blob: 844b8266318146782bc74f506420c8fb899ad24f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once

#include "StarColor.hpp"
#include "StarBiMap.hpp"
#include "StarJson.hpp"

namespace Star {

STAR_EXCEPTION(SkyException, StarException);

enum class SkyType : uint8_t {
  Barren,
  Atmospheric,
  Atmosphereless,
  Orbital,
  Warp,
  Space
};
extern EnumMap<SkyType> const SkyTypeNames;

enum class FlyingType : uint8_t {
  None,
  Disembarking,
  Warp,
  Arriving
};
extern EnumMap<FlyingType> const FlyingTypeNames;

enum class WarpPhase : int8_t {
  SlowingDown = -1,
  Maintain = 0,
  SpeedingUp = 1
};
extern EnumMap<WarpPhase> const WarpPhaseNames;

struct SkyColoring {
  SkyColoring();
  explicit SkyColoring(Json const& variant);

  Json toJson() const;

  Color mainColor;

  pair<Color, Color> morningColors;
  pair<Color, Color> dayColors;
  pair<Color, Color> eveningColors;
  pair<Color, Color> nightColors;

  Color morningLightColor;
  Color dayLightColor;
  Color eveningLightColor;
  Color nightLightColor;
};

DataStream& operator>>(DataStream& ds, SkyColoring& skyColoring);
DataStream& operator<<(DataStream& ds, SkyColoring const& skyColoring);

enum class SkyOrbiterType { Sun, Moon, HorizonCloud, SpaceDebris };

struct SkyOrbiter {
  SkyOrbiter();
  SkyOrbiter(SkyOrbiterType type, float scale, float angle, String const& image, Vec2F position);

  SkyOrbiterType type;
  float scale;
  float angle;
  String image;
  Vec2F position;
};

struct SkyWorldHorizon {
  SkyWorldHorizon();
  SkyWorldHorizon(Vec2F center, float scale, float rotation);

  bool empty() const;

  Vec2F center;

  float scale;
  float rotation;

  // List of L/R images for each layer of the world horizon, bottom to top.
  List<pair<String, String>> layers;
};

}