v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
96
source/game/StarWorldStructure.hpp
Normal file
96
source/game/StarWorldStructure.hpp
Normal file
|
@ -0,0 +1,96 @@
|
|||
#ifndef STAR_WORLD_STRUCTURE_HPP
|
||||
#define STAR_WORLD_STRUCTURE_HPP
|
||||
|
||||
#include "StarJson.hpp"
|
||||
#include "StarRect.hpp"
|
||||
#include "StarGameTypes.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_EXCEPTION(WorldStructureException, StarException);
|
||||
|
||||
STAR_CLASS(WorldStructure);
|
||||
|
||||
class WorldStructure {
|
||||
public:
|
||||
struct Overlay {
|
||||
Vec2F min;
|
||||
String image;
|
||||
bool fullbright;
|
||||
};
|
||||
|
||||
struct Block {
|
||||
Vec2I position;
|
||||
MaterialId materialId;
|
||||
// If the material here should not be removed on upgrade, this flag will be
|
||||
// set to true.
|
||||
bool residual;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
Vec2I position;
|
||||
String name;
|
||||
Direction direction;
|
||||
Json parameters;
|
||||
// If an object is not designed to be removed on upgrade, this flag will be
|
||||
// set to true.
|
||||
bool residual;
|
||||
};
|
||||
|
||||
WorldStructure();
|
||||
WorldStructure(String const& configPath);
|
||||
WorldStructure(Json const& store);
|
||||
|
||||
Json configValue(String const& name) const;
|
||||
|
||||
List<Overlay> const& backgroundOverlays() const;
|
||||
List<Overlay> const& foregroundOverlays() const;
|
||||
|
||||
List<Block> const& backgroundBlocks() const;
|
||||
List<Block> const& foregroundBlocks() const;
|
||||
|
||||
List<Object> const& objects() const;
|
||||
|
||||
List<Vec2I> flaggedBlocks(String const& flag) const;
|
||||
|
||||
RectI region() const;
|
||||
Vec2I anchorPosition() const;
|
||||
|
||||
void setAnchorPosition(Vec2I const& anchorPosition);
|
||||
void translate(Vec2I const& distance);
|
||||
|
||||
Json store() const;
|
||||
|
||||
private:
|
||||
struct BlockKey {
|
||||
bool anchor;
|
||||
bool foregroundBlock;
|
||||
MaterialId foregroundMat;
|
||||
bool foregroundResidual;
|
||||
bool backgroundBlock;
|
||||
MaterialId backgroundMat;
|
||||
bool backgroundResidual;
|
||||
String object;
|
||||
Direction objectDirection;
|
||||
Json objectParameters;
|
||||
bool objectResidual;
|
||||
StringList flags;
|
||||
};
|
||||
|
||||
RectI m_region;
|
||||
Vec2I m_anchorPosition;
|
||||
Json m_config;
|
||||
|
||||
List<Overlay> m_backgroundOverlays;
|
||||
List<Overlay> m_foregroundOverlays;
|
||||
|
||||
List<Block> m_backgroundBlocks;
|
||||
List<Block> m_foregroundBlocks;
|
||||
|
||||
List<Object> m_objects;
|
||||
StringMap<List<Vec2I>> m_flaggedBlocks;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue