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. Returns the folded delta so siblings sharing the parent can be compensated.
63
64 fsStr pieceNameGet(fsS32 pRow, fsS32 pCol) const;
65
66 std::vector<gfIStencil*> mStencils;
67 std::vector<fsCEntity*> mMinigameEnts;
68
69 std::shared_ptr<fsCBrush> mSourceImage;
70
73
76
77 fsPoint mGridOrigin; // grid layout anchor; legacy scene originX/Y is folded into this
78
81
82private:
83
84 static const fsStr mStencilChunkMarker;
85 static const fsStr mStencilMarker;
86};
87
88#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:75
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:67
fsS32 mPieceWidth
Definition gfICutterComponent.h:71
virtual void stencilsCreate()
Definition gfICutterComponent.h:37
virtual fsStr minigamePieceNameGet() const =0
void deserialiseDo() override
Definition gfICutterComponent.cpp:69
virtual ~gfICutterComponent()
Definition gfICutterComponent.cpp:229
fsPoint originLayerOffsetReconcile(fsCEntity *pPieceParent)
Definition gfICutterComponent.cpp:191
fsPoint mGridOrigin
Definition gfICutterComponent.h:77
void setup(const fsCVariableTable &pStyle, const fsStr &pLevelName, const fsStr &pAutoMiniGameSourceArt)
Definition gfICutterComponent.cpp:164
virtual void cut(fsBool pFirstTime)
Definition gfICutterComponent.cpp:32
virtual void doCut(fsCEntity *pEnt, gfIStencil *pStencil, fsBool pFirstTime)=0
fsCEntity * mSceneRoot
Definition gfICutterComponent.h:79
static fsStr sourceImageFilenameGet(const fsStr &pLevelFolder, const fsStr &pLayerNameSansPrefix)
Definition gfICutterComponent.cpp:126
gfICutterComponent(fsCEntity *pParent)
Definition gfICutterComponent.cpp:217
fsStr pieceNameGet(fsS32 pRow, fsS32 pCol) const
Definition gfICutterComponent.cpp:211
virtual gfIStencil *const stencilRestore()=0
fsS32 mCols
Definition gfICutterComponent.h:74
fsS32 mPieceHeight
Definition gfICutterComponent.h:72
std::vector< gfIStencil * > mStencils
Definition gfICutterComponent.h:66
std::shared_ptr< fsCBrush > mSourceImage
Definition gfICutterComponent.h:69
void serialiseDo() override
Definition gfICutterComponent.cpp:52
fsCEntity * mMinigameLogic
Definition gfICutterComponent.h:80
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