aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/interface/GFXObject.hpp
blob: 51d34c18c402afa7347ab6f614d91b2f5034bfa7 (plain) (blame)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#pragma once

#include "openvic-simulation/interface/LoadBase.hpp"
#include <openvic-simulation/types/unlabelledVec.hpp>
#include <openvic-simulation/types/TextFormat.hpp>

namespace OpenVic::GFX {

   class Object : public Named<> {
   protected:
      Object() = default;

   public:
      Object(Object&&) = default;
      virtual ~Object() = default;

      OV_DETAIL_GET_BASE_TYPE(Object)
      OV_DETAIL_GET_TYPE

      static NodeTools::node_callback_t expect_objects(
         NodeTools::length_callback_t length_callback, NodeTools::callback_t<std::unique_ptr<Object>&&> callback
      );
   };

   class Actor final : public Object {
      friend std::unique_ptr<Actor> std::make_unique<Actor>();

   public:
      class Attachment {
         friend class Actor;

      public:
         using attach_id_t = uint32_t;

      private:
         std::string PROPERTY(actor_name);
         std::string PROPERTY(attach_node);
         attach_id_t PROPERTY(attach_id);

         Attachment(std::string_view new_actor_name, std::string_view new_attach_node, attach_id_t new_attach_id);

      public:
         Attachment(Attachment&&) = default;
      };

      class Animation {
         friend class Actor;

         std::string PROPERTY(file);
         fixed_point_t PROPERTY(scroll_time);

         Animation(std::string_view new_file, fixed_point_t new_scroll_time);

      public:
         Animation(Animation&&) = default;
      };

   private:
      fixed_point_t PROPERTY(scale);
      std::string PROPERTY(model_file);
      std::optional<Animation> PROPERTY(idle_animation);
      std::optional<Animation> PROPERTY(move_animation);
      std::optional<Animation> PROPERTY(attack_animation);
      std::vector<Attachment> PROPERTY(attachments);

      bool _set_animation(std::string_view name, std::string_view file, fixed_point_t scroll_time);

   protected:
      Actor();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      Actor(Actor&&) = default;
      virtual ~Actor() = default;

      OV_DETAIL_GET_TYPE
   };

   /* arrows.gfx */
   class ArrowType final : public Object {
      friend std::unique_ptr<ArrowType> std::make_unique<ArrowType>();
   
   private:
      //Named<> already handles the name property
      fixed_point_t PROPERTY(size);
      //texture_file is unused, body_texture_file determines the appearance of the arrow
      std::string PROPERTY(texture_file); //unused
      std::string PROPERTY(body_texture_file);
      //colours dont appear to be used
      //TODO: Verify these property names for color and colortwo are correct
      colour_t PROPERTY(back_colour);
      colour_t PROPERTY(progress_colour);

      fixed_point_t PROPERTY(end_at); //how should float be repd? >> fixed_point handles it
      fixed_point_t PROPERTY(height);
      uint64_t PROPERTY(arrow_type); //TODO: what does this do?
      fixed_point_t PROPERTY(heading); //also float

      std::string PROPERTY(effect_file);

   protected:
      ArrowType();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      ArrowType(ArrowType&&) = default;
      virtual ~ArrowType() = default;

      OV_DETAIL_GET_TYPE
   };

   /* battlearrow.gfx */
   //TODO: unclear where/how these are used (if at all) in game
   class BattleArrow final : public Object {
      friend std::unique_ptr<BattleArrow> std::make_unique<BattleArrow>();
   
   private:
      //Named<> already handles the name property
      //TODO verify the texture places
      std::string PROPERTY(texture_arrow_body);
      std::string PROPERTY(texture_arrow_head);

      fixed_point_t PROPERTY(start); //labelled 'body start width' in file
      fixed_point_t PROPERTY(stop);  //labelled 'body end width' in file
      fixed_point_t PROPERTY(x);  //labelled 'arrow length' in file
      fixed_point_t PROPERTY(y);  //labelled 'arrow height' in file

      std::string PROPERTY(font);
      fixed_point_t PROPERTY(scale);
      bool PROPERTY(no_fade);
      fixed_point_t PROPERTY(texture_loop);

   protected:
      BattleArrow();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      BattleArrow(BattleArrow&&) = default;
      virtual ~BattleArrow() = default;

      OV_DETAIL_GET_TYPE
   };

   //TODO unclear if these are used or just a hoi3 leftover
   class MapInfo final : public Object {
      friend std::unique_ptr<MapInfo> std::make_unique<MapInfo>();
   
   private:
      std::string PROPERTY(texture_file);
      fixed_point_t PROPERTY(scale);

   protected:
      MapInfo();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      MapInfo(MapInfo&&) = default;
      virtual ~MapInfo() = default;

      OV_DETAIL_GET_TYPE
   };

   /* mapitems.gfx */
   class Projection final : public Object {
      friend std::unique_ptr<Projection> std::make_unique<Projection>();
   
   private:
      //Named<> already handles the name property
      std::string PROPERTY(texture_file);
      //TODO: pulseSpeed, fadeout be ints or fixed points? assume fixed_point_t to start
      fixed_point_t PROPERTY(size);
      fixed_point_t PROPERTY(spin);
      bool PROPERTY(pulsating);
      fixed_point_t PROPERTY(pulse_lowest);
      fixed_point_t PROPERTY(pulse_speed);
      bool PROPERTY(additative);
      fixed_point_t PROPERTY(expanding);
      std::optional<fixed_point_t> PROPERTY(duration); //if present, determines how long until the projection disappears
      std::optional<fixed_point_t> PROPERTY(fadeout); //appears to have no affect

   protected:
      Projection();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      Projection(Projection&&) = default;
      virtual ~Projection() = default;

      OV_DETAIL_GET_TYPE
   };

   class Billboard final : public Object {
      friend std::unique_ptr<Billboard> std::make_unique<Billboard>();

   public:

   private:
      std::string PROPERTY(texture_file);
      fixed_point_t PROPERTY(scale);
      int64_t PROPERTY(no_of_frames);
      int64_t PROPERTY(font_size); //TODO: is this fixed point?
      V2Vector3 PROPERTY(offset);
      std::string PROPERTY(font);

   protected:
      Billboard();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      Billboard(Billboard&&) = default;
      virtual ~Billboard() = default;

      OV_DETAIL_GET_TYPE
   };

   //Appears to be unused, at least as of HoD
   class UnitStatsBillboard final : public Object {
      friend std::unique_ptr<UnitStatsBillboard> std::make_unique<UnitStatsBillboard>();

   private:
      //Named<> already handles the name property
      std::string PROPERTY(texture_file);
      std::string PROPERTY(effect_file);
      std::string PROPERTY(mask_file);
      fixed_point_t PROPERTY(scale);
      int64_t PROPERTY(no_of_frames);
      int64_t PROPERTY(font_size); //TODO: is this fixed point?
      std::string PROPERTY(font);

   protected:
      UnitStatsBillboard();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      UnitStatsBillboard(UnitStatsBillboard&&) = default;
      virtual ~UnitStatsBillboard() = default;

      OV_DETAIL_GET_TYPE
   };

   //TODO: appears to go unused
   class ProgressBar3d final : public Object {
      friend std::unique_ptr<ProgressBar3d> std::make_unique<ProgressBar3d>();

   private:
      colour_t PROPERTY(back_colour);
      colour_t PROPERTY(progress_colour);
      ivec2_t PROPERTY(size);
      std::string PROPERTY(effect_file);

   protected:
      ProgressBar3d();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      ProgressBar3d(ProgressBar3d&&) = default;
      virtual ~ProgressBar3d() = default;

      OV_DETAIL_GET_TYPE
   };

   /* Core.gfx */
   class AnimatedMapText final : public Object {
      friend std::unique_ptr<AnimatedMapText> std::make_unique<AnimatedMapText>();

      using enum text_format_t;

   public:
      struct TextBlock {
         friend class AnimatedMapText;

      private:
         std::string PROPERTY(text);
         colour_t PROPERTY(colour);
         std::string PROPERTY(font);

         fvec2_t PROPERTY(text_position);
         fvec2_t PROPERTY(size);

         text_format_t PROPERTY(format);

         TextBlock();

      public:
         TextBlock(TextBlock&&) = default;
      };

   private:
      fixed_point_t PROPERTY(speed);
      fixed_point_t PROPERTY(scale);
      V2Vector3 PROPERTY(position);
      TextBlock PROPERTY(textblock);

   protected:
      AnimatedMapText();

      bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override;

   public:
      AnimatedMapText(AnimatedMapText&&) = default;
      virtual ~AnimatedMapText() = default;

      OV_DETAIL_GET_TYPE
   };

}