Fission FSN
Loading...
Searching...
No Matches
gfCHogLevelComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: fsCHogLevel.h
4*
5* Purpose: Create and control game entities.
6*
7*********************************************************************/
8
9#ifndef gfCHogLevelhdr
10#define gfCHogLevelhdr
11
12#include <vector>
13
14#include <fsCore/fsStr.h>
15#include <fsCore/fsPoint.h>
16
17#include "../gfIHogLevel.h"
20
22class fsRect;
23
24
26{
27 friend class fsCComponentFactory;
28
29public:
30
31 static const fsCUniqueId mTypeId;
32
34
36
37
38 void listenersDeregisterDo() override;
39 void listenersRegisterDo() override;
40 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
41 const fsIMessageDispatcher::sMessageParameters& pParam) override;
42
43
44protected:
45
46 static fsIComponent* create(fsCEntity* pParent);
47
48 void skipDo() override;
49
50 void updateDo(fsS32 pDeltaMs) override;
51 void renderDo() override;
52
53 virtual void actAdvance();
55
56 virtual void levelResetDo();
57 void abortDo() override;
58
59 void doLevelCreate() override;
60
62 virtual ~gfCHogLevelComponent();
63
64private:
65
66 enum eDebugRenderEffect
67 {
68 eDEBUG_RENDER_EFFECT_NONE,
69 eDEBUG_RENDER_EFFECT_MAGNIFY,
70 eDEBUG_RENDER_EFFECT_TORCH
71 };
72
73 template<typename TLogic, typename TMinigame>
74 void minigameLogicAdd(std::vector<gfIMinigameLogic*>& pLogicEntities);
75 template<typename TLogic>
76 void minigameLogicAdd(std::vector<gfIMinigameLogic*>& pLogicEntities, const fsStr& pEntityName = "");
77
78 fsBool devCheatKeyTest(fsS32 pTypedChar);
79 void renderEffectApply(eDebugRenderEffect pEffect);
80 void debugRenderEffectCycle();
81 fsBool releaseCheatKeyTest(fsS32 pTypedChar);
82
83 void tutorialAdd();
84
85 void levelReset();
86
87 void reset();
88
89 void miniGameLogicComponentsAdd();
90
91 void actCompleteHandle();
92 fsBool levelSkippedForAnalytics() const;
93 fsS32 adFreeLevelCountGet() const;
94 fsS32 rewardPackSizeGet() const;
95 fsS32 rewardTailGraceCountGet() const;
96 fsS32 rewardUnlockedLevelCountGet(fsS32 pTotalLevels) const;
97 void rewardUnlockedLevelCountSet(fsS32 pUnlockedCount) const;
98 fsBool rewardGateRequiredForNextLevel() const;
99 void rewardUnlockGrantForCurrentBoundary();
100 fsBool interstitialAllowedForCurrentLevel() const;
101 void rewardGatePaywallShow();
102
103 fsBool typedCharacterHandle(fsS32 pTypedChar);
104
105
106 fsBool mResetDuringFade;
107 fsBool mPendingInterstitialOnFadeOut;
108 fsBool mRewardGatePending;
109 fsBool mPaywallDestroyOnFadeOut;
110 fsBool mSkipInterstitialOnce;
111 fsBool mLevelSkippedForAnalytics;
112 eDebugRenderEffect mDebugRenderEffect;
113 fsS32 mDebugRenderEffectCycleIndex;
114};
115
116// Always add/collect the logic, using its full construction plan when an entity name is supplied.
117template<typename TLogic>
118void gfCHogLevelComponent::minigameLogicAdd(std::vector<gfIMinigameLogic*>& logicEntities,
119 const fsStr& entityName)
120{
121 auto* parent = parentGet();
122 auto* logicEntity = parent->firstChildEntityWithComponentsOfFamilyType<TLogic>();
123
124 if (!logicEntity)
125 {
126 if (entityName.emptyGet())
127 {
128 logicEntity = parent->entityFactoryGet()->emptyEntityCreate("minigameLogic");
129 logicEntity->template componentAdd<TLogic>();
130 }
131 else
132 {
133 logicEntity = parent->entityFactoryGet()->entityConstruct(entityName);
134 }
135 parent->childAdd(logicEntity);
136 }
137
138 auto* logic = logicEntity->template firstComponentOfFamilyType<TLogic>();
139
140 if (std::find(logicEntities.begin(), logicEntities.end(), logic) ==
141 logicEntities.end())
142 {
143 logicEntities.push_back(logic);
144 }
145}
146
147// Add/collect the logic only when the minigame exists.
148template<typename TLogic, typename TMinigame>
149void gfCHogLevelComponent::minigameLogicAdd(std::vector<gfIMinigameLogic*>& logicEntities)
150{
151 if (!parentGet()->template firstChildEntityWithComponentsOfFamilyType<TMinigame>())
152 {
153 return;
154 }
155
156 minigameLogicAdd<TLogic>(logicEntities);
157}
158#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
void reset()
Definition fsIComponent.cpp:16
Definition fsRect.h:16
Definition fsStr.h:23
fsBool emptyGet() const
Definition fsStr.h:45
static const fsCUniqueId mTypeId
Definition gfCHogLevelComponent.h:31
void updateDo(fsS32 pDeltaMs) override
Definition gfCHogLevelComponent.cpp:75
static const fsCUniqueId mLevelSkippedMsg
Definition gfCHogLevelComponent.h:33
virtual void actAdvance()
Definition gfCHogLevelComponent.cpp:656
virtual void levelResetDo()
Definition gfCHogLevelComponent.cpp:80
void renderEffectRefresh()
Definition gfCHogLevelComponent.cpp:385
virtual ~gfCHogLevelComponent()
Definition gfCHogLevelComponent.cpp:898
friend class fsCComponentFactory
Definition gfCHogLevelComponent.h:27
static fsIComponent * create(fsCEntity *pParent)
Definition gfCHogLevelComponent.cpp:879
void renderDo() override
Definition gfCHogLevelComponent.cpp:70
void listenersRegisterDo() override
Definition gfCHogLevelComponent.cpp:441
gfCHogLevelComponent(fsCEntity *pParent)
Definition gfCHogLevelComponent.cpp:885
virtual fsStr rewardSequencFileNameGetIfActive()
Definition gfCHogLevelComponent.cpp:616
void skipDo() override
Definition gfCHogLevelComponent.cpp:274
void doLevelCreate() override
Definition gfCHogLevelComponent.cpp:840
void abortDo() override
Definition gfCHogLevelComponent.cpp:411
void listenersDeregisterDo() override
Definition gfCHogLevelComponent.cpp:420
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCHogLevelComponent.cpp:462
Definition gfCSubSceneComponent.h:22
fsCEntity *const parentGet() const
Definition gfIHogLevel.cpp:134
gfIHogLevel(fsCEntity *pParent)
Definition gfIHogLevel.cpp:498
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32