Fission FSN
Loading...
Searching...
No Matches
gfIHogLevel.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 7/4/2014 13:32
4*
5* File: gfIHogLevel.h
6*
7* Author: Mick Waites
8*
9* Purpose: Create and control game entities.
10*
11*********************************************************************/
12
13#ifndef gfIHogLevelhdr
14#define gfIHogLevelhdr
15
16#include <vector>
17
18#include <fsCore/fsStr.h>
19
21
23{
24 friend class fsCComponentFactory;
26 friend class gfCHogCoreMain;
27 friend class gfCSimpleCoreMain;
28
29public:
30
32
33 fsCEntity* const parentGet() const;
34 fsStr levelNameGet() const;
35
36 void skip();
38
39 // As skip(), but collects the optional bonuses and isn't flagged as a
40 // skip, so achievements and star ratings see a played-out level.
41 void complete();
42
43 // The debug menu's Skip: does what the 'S' cheat key does in a minigame that
44 // handles it (e.g. PBN skips a phase), otherwise skip().
45 void cheatSkip();
46
50 fsStr nextLevelGet() const;
51 const fsStr& levelNameFilenameGet() const { return mLevelName; }
52
53 void abort();
54
55 void levelStateSave();
56 void levelStateRestore(fsStr& pLoadStr);
57
58 virtual ~gfIHogLevel();
59
60 virtual fsStr sceneFolderGet() const;
61 virtual fsStr saveStateKeyGet();
62
63protected:
64
65 void levelCreate(const fsStr& pLevelName);
66
67 void bestRunningTimeSet();
68
69 virtual void skipDo(fsBool pCountAsSkip);
70 // skipDo() on the last level, after the quit to menu is set.
71 virtual void lastLevelSkipDo() {}
72
74 virtual void guiInitDo();
75
76 virtual void levelStateSaveDo();
77
78 fsBool mapLevelGet() const;
79
80 void listenersDeregisterDo() override;
81 void listenersRegisterDo() override;
82 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
83 const fsIMessageDispatcher::sMessageParameters& pParam) override;
84
85 void renderDo() override;
86 void resetDo() override;
87 void deserialiseDo() override;
88 void serialiseDo() override;
89 void updateDo(fsS32 pDeltaMs) override;
90
91 std::vector<fsCEntity*> minigameEntitiesGet();
92
93 void cheatMenuToggle();
94
95 virtual void actAdvance();
96 // actAdvance() once the level is passing on, before it is marked complete.
97 virtual void actAdvanceDo() {}
99
100 virtual void levelResetDo();
101 void levelReset();
102 void reset();
103
105
106 // Dev-cheat keys a subclass adds; tried before the shared ones.
107 virtual fsBool devCheatKeyTestDo(fsS32 pTypedChar) { (void)pTypedChar; return false; }
108 virtual fsBool releaseCheatKeyTest(fsS32 pTypedChar);
109 // Offers a cheat key to the scene's minigames first. True when one consumed it.
111
112 // A tapped navigate hotspot. True when the tap is consumed.
113 virtual fsBool navigateTapHandle(const fsStr& pTarget);
114
115 virtual void abortDo();
116 virtual void doLevelCreate();
117 virtual void doLevelStateRestore() {}
118 virtual void doPostEntityCreation() {}
119
120 gfIHogLevel(fsCEntity* pParent);
121
122private:
123
124 void jigsawEntitiesBorderSet();
125 void cuttersCut(fsBool pFirstTime);
126 void cuttersStencilCreate();
127
128 void miniGameHelpSet();
129 void guiInit();
130 void guiLoad();
131
132 void entitiesCreateFromCoordsFile();
133
134
135 void tutorialGuiLinkToGui();
136
137 fsBool devCheatKeyTest(fsS32 pTypedChar);
138 fsBool typedCharacterHandle(fsS32 pTypedChar);
139
140 void tutorialAdd();
141 void miniGameLogicComponentsAdd();
142
143 void actCompleteHandle();
144 fsS32 adFreeLevelCountGet() const;
145 fsS32 rewardPackSizeGet() const;
146 fsS32 rewardTailGraceCountGet() const;
147 fsS32 rewardUnlockedLevelCountGet(fsS32 pTotalLevels) const;
148 void rewardUnlockedLevelCountSet(fsS32 pUnlockedCount) const;
149 fsBool rewardGateRequiredForNextLevel() const;
150 void rewardUnlockGrantForCurrentBoundary();
151 fsBool interstitialAllowedForCurrentLevel() const;
152 void rewardGatePaywallShow();
153
154 // The level's own message handling, run after the shared handling above it.
155 fsBool levelMessageProcess(const fsCUniqueId& pMessageType);
156
157 fsStr mLevelName;
158 fsS32 mLevelRunningTime; //total level running time - we can revisit a level
159 fsS32 mRunningTime; //running time for this visit to this level
160 fsS32 mBestTime; //best time to complete this level
161
162 fsBool mSkippedMiniGame;
163 fsBool mWaitingForInterstitialTransition;
164
165 fsBool mResetDuringFade;
166 fsBool mPendingInterstitialOnFadeOut;
167 fsBool mRewardGatePending;
168 fsBool mPaywallDestroyOnFadeOut;
169 fsBool mSkipInterstitialOnce;
170 fsBool mLevelSkippedForAnalytics;
171
172 enum eRUN_STATE
173 {
174 eWAITING,
175 eRUNNING,
176 eDONE
177 };
178
179 eRUN_STATE mRunning;
180};
181
182#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
fsIMessageListenerComponent(fsCEntity *pParent)
Definition fsIMessageListenerComponent.cpp:9
Definition fsStr.h:23
void serialiseDo() override
Definition gfIHogLevel.cpp:250
fsS32 bestLevelRunningTimeGet() const
Definition gfIHogLevel.cpp:257
void resetDo() override
Definition gfIHogLevel.cpp:237
fsCEntity *const parentGet() const
Definition gfIHogLevel.cpp:273
virtual void levelResetDo()
Definition gfIHogLevel.cpp:349
virtual void lastLevelSkipDo()
Definition gfIHogLevel.h:71
void bestRunningTimeSet()
Definition gfIHogLevel.cpp:228
virtual void levelStateSaveDo()
Definition gfIHogLevel.cpp:734
fsS32 levelRunningTimeGet() const
Definition gfIHogLevel.cpp:262
void deserialiseDo() override
Definition gfIHogLevel.cpp:243
virtual void abortDo()
Definition gfIHogLevel.cpp:599
friend class gfCSimpleCoreMain
Definition gfIHogLevel.h:27
friend class fsCComponentFactory
Definition gfIHogLevel.h:24
void skippedEntitiesForceCollect()
Definition gfIHogLevel.cpp:170
virtual fsStr rewardSequencFileNameGetIfActive()
Definition gfIHogLevel.cpp:987
virtual void doLevelCreate()
Definition gfIHogLevel.cpp:1213
void updateDo(fsS32 pDeltaMs) override
Definition gfIHogLevel.cpp:292
void listenersRegisterDo() override
Definition gfIHogLevel.cpp:789
friend class gfCHogCoreMain
Definition gfIHogLevel.h:26
fsBool minigameCheatKeyHandle(fsS32 pTypedChar)
Definition gfIHogLevel.cpp:151
void abort()
Definition gfIHogLevel.cpp:608
void skip()
Definition gfIHogLevel.cpp:137
void levelStateRestore(fsStr &pLoadStr)
Definition gfIHogLevel.cpp:752
gfIHogLevel(fsCEntity *pParent)
Definition gfIHogLevel.cpp:1374
fsStr nextLevelGet() const
Definition gfIHogLevel.cpp:325
virtual void actAdvance()
Definition gfIHogLevel.cpp:1027
fsBool mapLevelGet() const
Definition gfIHogLevel.cpp:817
friend class gfCDebugJustCollectablesView
Definition gfIHogLevel.h:25
virtual void guiInitDo()
Definition gfIHogLevel.cpp:223
const fsStr & levelNameFilenameGet() const
Definition gfIHogLevel.h:51
virtual void doPostEntityCreation()
Definition gfIHogLevel.h:118
void bonusEntitiesForceCollect()
Definition gfIHogLevel.cpp:176
void levelStateSave()
Definition gfIHogLevel.cpp:741
static const fsCUniqueId mLevelSkippedMsg
Definition gfIHogLevel.h:31
virtual void actAdvanceDo()
Definition gfIHogLevel.h:97
virtual void skipDo(fsBool pCountAsSkip)
Definition gfIHogLevel.cpp:498
fsBool levelSkippedForAnalytics() const
Definition gfIHogLevel.cpp:1051
virtual fsBool navigateTapHandle(const fsStr &pTarget)
Definition gfIHogLevel.cpp:975
std::vector< fsCEntity * > minigameEntitiesGet()
Definition gfIHogLevel.cpp:278
virtual fsStr saveStateKeyGet()
Definition gfIHogLevel.cpp:720
void cheatSkip()
Definition gfIHogLevel.cpp:143
void cheatMenuToggle()
Definition gfIHogLevel.cpp:330
void reset()
Definition gfIHogLevel.cpp:591
virtual ~gfIHogLevel()
Definition gfIHogLevel.cpp:1392
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfIHogLevel.cpp:824
void levelReset()
Definition gfIHogLevel.cpp:355
void complete()
Definition gfIHogLevel.cpp:163
virtual fsBool releaseCheatKeyTest(fsS32 pTypedChar)
Definition gfIHogLevel.cpp:540
virtual fsStr sceneFolderGet() const
Definition gfIHogLevel.cpp:695
fsS32 totalGameRunningTimeGet() const
Definition gfIHogLevel.cpp:267
void listenersDeregisterDo() override
Definition gfIHogLevel.cpp:761
void renderDo() override
Definition gfIHogLevel.cpp:344
fsStr levelNameGet() const
Definition gfIHogLevel.cpp:204
void levelCreate(const fsStr &pLevelName)
Definition gfIHogLevel.cpp:1288
virtual fsBool devCheatKeyTestDo(fsS32 pTypedChar)
Definition gfIHogLevel.h:107
virtual void doLevelStateRestore()
Definition gfIHogLevel.h:117
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32