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
/********************************************************************
*
*	File:		gfCRotateCutterComponent.h
*
*	Purpose:	Cutter to create rotate minigame tiles
*
*********************************************************************/

#ifndef gfCRotateCutterComponenthdr
#define gfCRotateCutterComponenthdr

#include "../gfISimpleCutterComponent.h"

class gfCRotateCutterComponent : public gfISimpleCutterComponent
{
	friend class fsCComponentFactory;

public:

	static const fsCUniqueId mTypeId;
	static const fsStr mEntityPrefix;

	void minigameEntitiesCreate(const fsCVariableTable& pStyle, const fsStr& pLevelName, fsCEntity* pParent,
	                            const fsStr& pAutoMiniGameSourceArt, gfIMinigameLogic* pMingameLogic) override;

	void stencilsCreate() override;

protected:

	fsStr minigamePieceNameGet() const override;
	void doCut(fsCEntity* pEnt, gfIStencil* pStencil, fsBool pFirstTime) override;
	gfIStencil* const stencilRestore() override;
	void doSetup(const fsCVariableTable& pStyle, const fsStr& pLevelName) override;

	static fsIComponent* create(fsCEntity* pParent);

	gfCRotateCutterComponent(fsCEntity* pParent);
	virtual ~gfCRotateCutterComponent();<--- Destructor in derived class

private:

	void entityCreate(fsS32 pCol, fsS32 pRow, const fsCVariableTable& pStyle);
	void stencilRestore(fsS32 pCol, fsS32 pRow, fsS32 pWidth, fsS32 pHeight);
	void tessellatedStencilCreate(fsS32 pCol, fsS32 pRow, fsS32 pDivisions);

	fsBool tessellatedTileIndexGet(fsS32 pCol, fsS32 pRow) const;
	void tessellatedEntityCreate(fsS32 pCol, fsS32 pRow, fsS32 pDivisions, const fsCVariableTable& pStyle);
	void tessellatedIndicesStore(const fsCVariableTable& pStyle);
	void randomTesselatedIndicesAdd();

	std::shared_ptr<fsCBrush> mTessellatedStencilTexture;
	std::vector<fsS32> mTessellatedIndices;
};

#endif