forked from Electr0Gunner/PvZ-QotL-Widescreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLawnApp.h
371 lines (355 loc) · 14.4 KB
/
LawnApp.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#ifndef __LAWNAPP_H__
#define __LAWNAPP_H__
#include "ConstEnums.h"
#include "SexyAppFramework/SexyApp.h"
class Board;
class GameSelector;
class ChallengeDefinition;
class SeedChooserScreen;
class AwardScreen;
class CreditScreen;
class Achievements;
class TodFoley;
class PoolEffect;
class ZenGarden;
class PottedPlant;
class EffectSystem;
class TodParticleSystem;
class Reanimation;
class ReanimatorCache;
class ProfileMgr;
class PlayerInfo;
class Music;
class TitleScreen;
class PopDRMComm;
class ChallengeScreen;
class StoreScreen;
class AlmanacDialog;
class TypingCheck;
class MiniCreditsScreen;
class AchievementScreen;
class QuickPlayScreen;
class ControllerManager;
namespace Sexy
{
class Dialog;
class Graphics;
class ButtonWidget;
};
enum FoleyType;
using namespace Sexy;
typedef std::list<ButtonWidget*> ButtonList;
typedef std::list<Image*> ImageList;
class LevelStats
{
public:
int mUnusedLawnMowers;
public:
LevelStats() { Reset(); }
inline void Reset() { mUnusedLawnMowers = 0; }
};
class LawnApp : public SexyApp
{
public:
Board* mBoard;
TitleScreen* mTitleScreen;
GameSelector* mGameSelector;
SeedChooserScreen* mSeedChooserScreen;
AwardScreen* mAwardScreen;
CreditScreen* mCreditScreen;
ChallengeScreen* mChallengeScreen;
MiniCreditsScreen* mMiniCreditsScreen;
AchievementScreen* mAchievementScreen;
QuickPlayScreen* mQuickPlayScreen;
TodFoley* mSoundSystem;
ButtonList mControlButtonList;
ImageList mCreatedImageList;
std::string mReferId;
std::string mRegisterLink;
std::string mMod;
bool mRegisterResourcesLoaded;
bool mTodCheatKeys;
GameMode mGameMode;
GameScenes mGameScene;
bool mLoadingZombiesThreadCompleted;
bool mFirstTimeGameSelector;
int mGamesPlayed;
int mMaxExecutions;
int mMaxPlays;
int mMaxTime;
bool mEasyPlantingCheat;
PoolEffect* mPoolEffect;
ZenGarden* mZenGarden;
EffectSystem* mEffectSystem;
ReanimatorCache* mReanimatorCache;
ProfileMgr* mProfileMgr;
PlayerInfo* mPlayerInfo;
LevelStats* mLastLevelStats;
bool mCloseRequest;
int mAppCounter;
Music* mMusic;
ReanimationID mCrazyDaveReanimID;
CrazyDaveState mCrazyDaveState;
int mCrazyDaveBlinkCounter;
ReanimationID mCrazyDaveBlinkReanimID;
int mCrazyDaveMessageIndex;
SexyString mCrazyDaveMessageText;
int mAppRandSeed;
HICON mBigArrowCursor;
PopDRMComm* mDRM;
int mSessionID;
int mPlayTimeActiveSession;
int mPlayTimeInactiveSession;
BoardResult mBoardResult;
bool mSawYeti;
TypingCheck* mKonamiCheck;
TypingCheck* mMustacheCheck;
TypingCheck* mMoustacheCheck;
TypingCheck* mSuperMowerCheck;
TypingCheck* mSuperMowerCheck2;
TypingCheck* mFutureCheck;
TypingCheck* mPinataCheck;
TypingCheck* mDanceCheck;
TypingCheck* mDaisyCheck;
TypingCheck* mSukhbirCheck;
bool mMustacheMode;
bool mSuperMowerMode;
bool mFutureMode;
bool mPinataMode;
bool mDanceMode;
bool mDaisyMode;
bool mSukhbirMode;
TrialType mTrialType;
bool mDebugTrialLocked;
bool mMuteSoundsForCutscene;
Achievements* mAchievements;
bool mIsFastMode;
SexyString mVersion;
SexyString mReconVersion;
SexyString mGitCommit;
bool mPlayingQuickplay;
bool mCrazySeeds;
time_t mStartTime;
SexyString mDetails;
SexyString mState;
ControllerManager* mControllerManager;
public:
LawnApp();
virtual ~LawnApp();
float GetSpeedVal();
bool KillNewOptionsDialog();
virtual void GotFocus();
virtual void LostFocus();
virtual void InitHook();
virtual void WriteToRegistry();
virtual void ReadFromRegistry();
virtual void LoadingThreadProc();
virtual void LoadingCompleted();
virtual void LoadingThreadCompleted();
virtual void URLOpenFailed(const std::string& theURL);
virtual void URLOpenSucceeded(const std::string& theURL);
virtual bool OpenURL(const std::string& theURL, bool shutdownOnOpen);
virtual bool DebugKeyDown(int theKey);
virtual void HandleCmdLineParam(const std::string& theParamName, const std::string& theParamValue);
void ConfirmQuit();
void ConfirmCheckForUpdates() { ; }
void CheckForUpdates() { ; }
void DoUserDialog();
void FinishUserDialog(bool isYes);
void DoCreateUserDialog();
void DoCheatDialog();
void FinishCheatDialog(bool isYes);
void FinishCreateUserDialog(bool isYes);
void DoConfirmDeleteUserDialog(const SexyString& theName);
void FinishConfirmDeleteUserDialog(bool isYes);
void DoRenameUserDialog(const SexyString& theName);
void FinishRenameUserDialog(bool isYes);
void FinishNameError(int theId);
void FinishRestartConfirmDialog();
void DoConfirmSellDialog(const SexyString& theMessage);
void DoConfirmPurchaseDialog(const SexyString& theMessage);
void FinishTimesUpDialog();
void DoChallengePagesDialog();
void KillBoard();
void MakeNewBoard();
void StartPlaying();
bool TryLoadGame();
void NewGame();
void PreNewGame(GameMode theGameMode, bool theLookForSavedGame);
void StartQuickPlay();
void ShowGameSelector();
void KillGameSelector();
void ShowAwardScreen(AwardType theAwardType, bool theShowAchievements);
void KillAwardScreen();
void ShowSeedChooserScreen();
void KillSeedChooserScreen();
void DoHighScoreDialog();
void DoBackToMain(bool hasSound = false);
void DoConfirmBackToMain();
void DoNewOptions(bool theFromGameSelector, int theX = -1, int theY = -1);
void DoAdvancedOptions(bool theFromGameSelector, int theX, int theY);
void DoRegister();
void DoRegisterError();
bool CanDoRegisterDialog();
/*inline*/ bool WriteCurrentUserConfig();
void DoNeedRegisterDialog();
void DoContinueDialog();
void DoPauseDialog();
void FinishModelessDialogs();
virtual Dialog* DoDialog(int theDialogId, bool isModal, const SexyString& theDialogHeader, const SexyString& theDialogLines, const SexyString& theDialogFooter, int theButtonMode);
virtual Dialog* DoDialogDelay(int theDialogId, bool isModal, const SexyString& theDialogHeader, const SexyString& theDialogLines, const SexyString& theDialogFooter, int theButtonMode);
virtual void Shutdown();
virtual void Init();
virtual void Start();
void StartDiscord();
virtual Dialog* NewDialog(int theDialogId, bool isModal, const SexyString& theDialogHeader, const SexyString& theDialogLines, const SexyString& theDialogFooter, int theButtonMode);
virtual bool KillDialog(int theDialogId);
virtual void ModalOpen();
virtual void ModalClose();
virtual void PreDisplayHook();
virtual bool ChangeDirHook(const char* theIntendedPath);
virtual bool NeedRegister();
virtual void UpdateRegisterInfo();
virtual void ButtonPress(int theId);
virtual void ButtonDepress(int theId);
virtual void UpdateFrames();
virtual bool UpdateApp();
/*inline*/ bool IsAdventureMode();
/*inline*/ bool IsSurvivalMode();
bool IsContinuousChallenge();
/*inline*/ bool IsArtChallenge();
bool NeedPauseGame();
virtual void ShowResourceError(bool doExit = false);
void ToggleSlowMo();
void ToggleFastMo();
void PlayFoley(FoleyType theFoleyType);
void PlayFoleyPitch(FoleyType theFoleyType, float thePitch);
void PlaySample(int theSoundNum);
void FastLoad(GameMode theGameMode);
static SexyString GetStageString(int theLevel);
/*inline*/ void KillChallengeScreen();
void ShowChallengeScreen(ChallengePage thePage);
ChallengeDefinition& GetCurrentChallengeDef();
void CheckForGameEnd();
virtual void CloseRequestAsync();
/*inline*/ bool IsChallengeWithoutSeedBank();
bool CanShowSeedBankAfterSun();
AlmanacDialog* DoAlmanacDialog(SeedType theSeedType = SeedType::SEED_NONE, ZombieType theZombieType = ZombieType::ZOMBIE_INVALID);
bool KillAlmanacDialog();
int GetSeedsAvailable();
Reanimation* AddReanimation(float theX, float theY, int theRenderOrder, ReanimationType theReanimationType);
TodParticleSystem* AddTodParticle(float theX, float theY, int theRenderOrder, ParticleEffect theEffect);
/*inline*/ ParticleSystemID ParticleGetID(TodParticleSystem* theParticle);
/*inline*/ TodParticleSystem* ParticleGet(ParticleSystemID theParticleID);
/*inline*/ TodParticleSystem* ParticleTryToGet(ParticleSystemID theParticleID);
/*inline*/ ReanimationID ReanimationGetID(Reanimation* theReanimation);
/*inline*/ Reanimation* ReanimationGet(ReanimationID theReanimationID);
/*inline*/ Reanimation* ReanimationTryToGet(ReanimationID theReanimationID);
void RemoveReanimation(ReanimationID theReanimationID);
void RemoveParticle(ParticleSystemID theParticleID);
StoreScreen* ShowStoreScreen();
void KillStoreScreen();
bool HasSeedType(SeedType theSeedType);
/*inline*/ bool SeedTypeAvailable(SeedType theSeedType);
bool HasAllUpgrades();
/*inline*/ void EndLevel();
inline bool IsIceDemo() { return false; }
/*inline*/ bool IsShovelLevel();
/*inline*/ bool IsWallnutBowlingLevel();
/*inline*/ bool IsMiniBossLevel();
/*inline*/ bool IsSlotMachineLevel();
/*inline*/ bool IsLittleTroubleLevel();
/*inline*/ bool IsStormyNightLevel();
/*inline*/ bool IsFinalBossLevel();
/*inline*/ bool IsBungeeBlitzLevel();
static /*inline*/ SeedType GetAwardSeedForLevel(int theLevel);
SexyString GetCrazyDaveText(int theMessageIndex);
/*inline*/ bool CanShowAlmanac();
/*inline*/ bool IsNight();
/*inline*/ bool CanShowStore();
/*inline*/ bool HasBeatenChallenge(GameMode theGameMode);
PottedPlant* GetPottedPlantByIndex(int thePottedPlantIndex);
static /*inline*/ bool IsSurvivalNormal(GameMode theGameMode);
static /*inline*/ bool IsSurvivalHard(GameMode theGameMode);
static /*inline*/ bool IsSurvivalEndless(GameMode theGameMode);
/*inline*/ bool HasFinishedAdventure();
/*inline*/ bool IsFirstTimeAdventureMode();
/*inline*/ bool CanSpawnYetis();
void CrazyDaveEnter();
void UpdateCrazyDave();
void CrazyDaveTalkIndex(int theMessageIndex);
void CrazyDaveTalkMessage(const SexyString& theMessage);
void CrazyDaveLeave();
void DrawCrazyDave(Graphics* g);
void CrazyDaveDie();
void CrazyDaveStopTalking();
void PreloadForUser();
int GetNumPreloadingTasks();
int LawnMessageBox(int theDialogId, const SexyChar* theHeaderName, const SexyChar* theLinesName, const SexyChar* theButton1Name, const SexyChar* theButton2Name, int theButtonMode);
virtual void EnforceCursor();
void ShowCreditScreen();
void KillCreditScreen();
void ShowMiniCreditScreen();
void KillMiniCreditScreen();
void ShowAchievementScreen();
void KillAchievementScreen();
void ShowQuickPlayScreen();
void KillQuickPlayScreen();
static SexyString Pluralize(int theCount, const SexyChar* theSingular, const SexyChar* thePlural);
int GetNumTrophies(ChallengePage thePage);
int GetTotalTrophies(ChallengePage thePage);
/*inline*/ bool EarnedGoldTrophy();
inline bool IsRegistered() { return false; }
inline bool IsExpired() { return false; }
inline bool IsDRMConnected() { return false; }
/*inline*/ bool IsScaryPotterLevel();
static /*inline*/ bool IsEndlessScaryPotter(GameMode theGameMode);
/*inline*/ bool IsSquirrelLevel();
/*inline*/ bool IsIZombieLevel();
/*inline*/ bool CanShowZenGarden();
static SexyString GetMoneyString(int theAmount);
bool AdvanceCrazyDaveText();
/*inline*/ bool IsWhackAZombieLevel();
void BetaSubmit(bool theAskForComments);
void BetaRecordLevelStats();
void UpdatePlayTimeStats();
void BetaAddFile(std::list<std::string>& theUploadFileList, std::string theFileName, std::string theShortName);
bool CanPauseNow();
/*inline*/ bool IsPuzzleMode();
/*inline*/ bool IsChallengeMode();
static /*inline*/ bool IsEndlessIZombie(GameMode theGameMode);
void CrazyDaveDoneHanding();
inline SexyString GetCurrentLevelName() { return _S("Unknown"); }
/*inline*/ int TrophiesNeedForGoldSunflower();
/*inline*/ int GetCurrentChallengeIndex();
void LoadGroup(const char* theGroupName, int theGroupAveMsToLoad);
void TraceLoadGroup(const char* theGroupName, int theGroupTime, int theTotalGroupWeigth, int theTaskWeight);
void CrazyDaveStopSound();
/*inline*/ bool IsTrialStageLocked();
/*inline*/ void FinishZenGardenToturial();
bool UpdatePlayerProfileForFinishingLevel();
bool SaveFileExists();
/*inline*/ bool CanDoPinataMode();
/*inline*/ bool CanDoDanceMode();
/*inline*/ bool CanDoDaisyMode();
virtual void SwitchScreenMode(bool wantWindowed, bool is3d, bool force = false);
virtual void ToggleDebugMode();
static /*inline*/ void CenterDialog(Dialog* theDialog, int theWidth, int theHeight);
void GetAchievement(AchievementType theAchievementType);
void UpdateDiscordState(SexyString theState = "");
bool Is3dAccel();
void LeaveBoard(int theIndex = -1);
};
SexyString LawnGetCurrentLevelName();
bool LawnGetCloseRequest();
bool LawnHasUsedCheatKeys();
void BetaSubmitFunc();
extern bool (*gAppCloseRequest)();
extern bool (*gAppHasUsedCheatKeys)();
extern SexyString (*gGetCurrentLevelName)();
extern bool gIsPartnerBuild;
extern bool gFastMo;
extern bool gSlowMo;
extern LawnApp* gLawnApp;
extern int gSlowMoCounter;
#endif // __LAWNAPP_H__