Fission FSN
Loading...
Searching...
No Matches
gfICutterComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfICutterComponent.h
4*
5* Purpose: Interface for the cutter components that cut out
6* the various mini game tiles
7*
8*********************************************************************/
9
10#ifndef gfICutterComponenthdr
11#define gfICutterComponenthdr
12
13#include <vector>
14
15#include <fsCore/fsStr.h>
16#include <fsCore/fsPoint.h>
18
20
21class fsCEntity;
22class gfIStencil;
23class fsCBrush;
25
26
28{
29public:
30
31 static const fsCUniqueId mTypeId;
32
33 static fsStr sourceImageFilenameGet(const fsStr& pLevelFolder, const fsStr& pLayerNameSansPrefix);
34
35 virtual void cut(fsBool pFirstTime);
36
37 virtual void stencilsCreate()
38 {
39 }
40
41 virtual void minigameEntitiesCreate(const fsCVariableTable& pStyle, const fsStr& pLevelName, fsCEntity* pParent,
42 const fsStr& pAutoMiniGameSourceArt, gfIMinigameLogic* pMingameLogic);
43
44protected:
45
46 void deserialiseDo() override;
47 void serialiseDo() override;
48
49 virtual void doCut(fsCEntity* pEnt, gfIStencil* pStencil, fsBool pFirstTime) = 0;
50 virtual fsStr minigamePieceNameGet() const = 0;
51 virtual gfIStencil* const stencilRestore() = 0;
52
54 virtual ~gfICutterComponent();
55
56 virtual void doSetup(const fsCVariableTable& pStyle, const fsStr& pLevelName) {}
57
58 void setup(const fsCVariableTable& pStyle, const fsStr& pLevelName, const fsStr& pAutoMiniGameSourceArt);
59
60 // If both origin and the piece-parent layer are offset they double up: fold origin into the
61 // layer. Only valid when pieces actually inherit the layer's position via composition.
63
64 // For cutter types whose pieces don't compose the layer's position (jigsaw gets swept off it
65 // by draw-order management; rotate never parents pieces to it): add it into the grid math
66 // directly instead, without touching the layer entity. Sets mLayerPositionBaked.
67 void layerPositionBakeIntoGrid(fsCEntity* pLayerEntity);
68
69 fsStr pieceNameGet(fsS32 pRow, fsS32 pCol) const;
70
71 std::vector<gfIStencil*> mStencils;
72 std::vector<fsCEntity*> mMinigameEnts;
73
74 std::shared_ptr<fsCBrush> mSourceImage;
75
78
81
82 fsPoint mGridOrigin; // grid layout anchor; legacy scene originX/Y is folded into this
83 fsBool mLayerPositionBaked; // true once layerPositionBakeIntoGrid has run - see its comment
84
87
88private:
89
90 static const fsStr mStencilChunkMarker;
91 static const fsStr mStencilMarker;
92};
93
94#endif
Definition fsCBrush.h:26
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsCVariableTable.h:27
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
Definition fsStr.h:23
fsS32 mRows
Definition gfICutterComponent.h:80
virtual void minigameEntitiesCreate(const fsCVariableTable &pStyle, const fsStr &pLevelName, fsCEntity *pParent, const fsStr &pAutoMiniGameSourceArt, gfIMinigameLogic *pMingameLogic)
Definition gfICutterComponent.cpp:79
std::vector< fsCEntity * > mMinigameEnts
Definition gfICutterComponent.h:72
fsS32 mPieceWidth
Definition gfICutterComponent.h:76
virtual void stencilsCreate()
Definition gfICutterComponent.h:37
fsBool mLayerPositionBaked
Definition gfICutterComponent.h:83
virtual fsStr minigamePieceNameGet() const =0
void deserialiseDo() override
Definition gfICutterComponent.cpp:69
virtual ~gfICutterComponent()
Definition gfICutterComponent.cpp:236
fsPoint originLayerOffsetReconcile(fsCEntity *pPieceParent)
Definition gfICutterComponent.cpp:191
fsPoint mGridOrigin
Definition gfICutterComponent.h:82
void setup(const fsCVariableTable &pStyle, const fsStr &pLevelName, const fsStr &pAutoMiniGameSourceArt)
Definition gfICutterComponent.cpp:166
virtual void cut(fsBool pFirstTime)
Definition gfICutterComponent.cpp:32
virtual void doCut(fsCEntity *pEnt, gfIStencil *pStencil, fsBool pFirstTime)=0
fsCEntity * mSceneRoot
Definition gfICutterComponent.h:85
static fsStr sourceImageFilenameGet(const fsStr &pLevelFolder, const fsStr &pLayerNameSansPrefix)
Definition gfICutterComponent.cpp:128
gfICutterComponent(fsCEntity *pParent)
Definition gfICutterComponent.cpp:223
fsStr pieceNameGet(fsS32 pRow, fsS32 pCol) const
Definition gfICutterComponent.cpp:217
virtual gfIStencil *const stencilRestore()=0
fsS32 mCols
Definition gfICutterComponent.h:79
void layerPositionBakeIntoGrid(fsCEntity *pLayerEntity)
Definition gfICutterComponent.cpp:211
fsS32 mPieceHeight
Definition gfICutterComponent.h:77
std::vector< gfIStencil * > mStencils
Definition gfICutterComponent.h:71
std::shared_ptr< fsCBrush > mSourceImage
Definition gfICutterComponent.h:74
void serialiseDo() override
Definition gfICutterComponent.cpp:52
fsCEntity * mMinigameLogic
Definition gfICutterComponent.h:86
virtual void doSetup(const fsCVariableTable &pStyle, const fsStr &pLevelName)
Definition gfICutterComponent.h:56
static const fsCUniqueId mTypeId
Definition gfICutterComponent.h:31
Definition gfIMinigameLogic.h:16
Definition gfIStencil.h:22
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17