diff --git a/src/LawnApp.cpp b/src/LawnApp.cpp index a297089..fe938b8 100644 --- a/src/LawnApp.cpp +++ b/src/LawnApp.cpp @@ -672,7 +672,7 @@ void LawnApp::DoBackToMain() void LawnApp::DoConfirmBackToMain() { LawnDialog *aDialog = (LawnDialog *)DoDialog(Dialogs::DIALOG_CONFIRM_BACK_TO_MAIN, true, "[LEAVE_GAME_HEADER]", - "[LEAVE_GAME]", "", Dialog::BUTTONS_YES_NO); + "[LEAVE_GAME]", "", Dialog::BUTTONS_YES_NO); aDialog->mLawnYesButton->mLabel = TodStringTranslate("[LEAVE_BUTTON]"); aDialog->mLawnNoButton->mLabel = TodStringTranslate("[DIALOG_BUTTON_CANCEL]"); @@ -728,7 +728,7 @@ void LawnApp::DoPauseDialog() //FinishModelessDialogs(); LawnDialog *aDialog = (LawnDialog *)DoDialog(Dialogs::DIALOG_PAUSED, true, "[GAME_PAUSED]", "[CLICK_TO_RESUME]", - "[RESUME_GAME]", Dialog::BUTTONS_FOOTER); + "[RESUME_GAME]", Dialog::BUTTONS_FOOTER); aDialog->mReanimation->AddReanimation(72.0f, 42.0f, ReanimationType::REANIM_ZOMBIE_NEWSPAPER); aDialog->mSpaceAfterHeader = 155; @@ -737,12 +737,12 @@ void LawnApp::DoPauseDialog() } int LawnApp::LawnMessageBox(int theDialogId, const SexyString &theHeaderName, const SexyString &theLinesName, - const SexyString &theButton1Name, const SexyString &theButton2Name, int theButtonMode) + const SexyString &theButton1Name, const SexyString &theButton2Name, int theButtonMode) { Widget *aOldFocus = mWidgetManager->mFocusWidget; LawnDialog *aDialog = - (LawnDialog *)DoDialog(theDialogId, true, theHeaderName, theLinesName, theButton1Name, theButtonMode); + (LawnDialog *)DoDialog(theDialogId, true, theHeaderName, theLinesName, theButton1Name, theButtonMode); if (aDialog->mLawnYesButton) { aDialog->mLawnYesButton->mLabel = TodStringTranslate(theButton1Name); @@ -761,7 +761,7 @@ int LawnApp::LawnMessageBox(int theDialogId, const SexyString &theHeaderName, co } Dialog *LawnApp::DoDialog(int theDialogId, bool isModal, const SexyString &theDialogHeader, - const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) + const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) { SexyString aHeader = TodStringTranslate(theDialogHeader); SexyString aLines = TodStringTranslate(theDialogLines); @@ -777,10 +777,10 @@ Dialog *LawnApp::DoDialog(int theDialogId, bool isModal, const SexyString &theDi } Dialog *LawnApp::DoDialogDelay(int theDialogId, bool isModal, const SexyString &theDialogHeader, - const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) + const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) { LawnDialog *aDialog = (LawnDialog *)SexyAppBase::DoDialog(theDialogId, isModal, theDialogHeader, theDialogLines, - theDialogFooter, theButtonMode); + theDialogFooter, theButtonMode); aDialog->SetButtonDelay(30); return aDialog; } @@ -839,12 +839,12 @@ void LawnApp::FinishCreateUserDialog(bool isYes) if (isYes && aName.empty()) { DoDialog(Dialogs::DIALOG_CREATEUSERERROR, true, "[ENTER_YOUR_NAME]", "[USER_ERROR_MESSAGE]", - "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); + "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); } else if (mPlayerInfo == nullptr && (!isYes || aName.empty())) { DoDialog(Dialogs::DIALOG_CREATEUSERERROR, true, "[ENTER_YOUR_NAME]", "[USER_ERROR_MESSAGE]", - "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); + "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); } else if (!isYes) { @@ -856,7 +856,7 @@ void LawnApp::FinishCreateUserDialog(bool isYes) if (aProfile == nullptr) { DoDialog(Dialogs::DIALOG_CREATEUSERERROR, true, "[NAME_CONFLICT]", "[ENTER_UNIQUE_PLAYER_NAME]", - "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); + "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); } else { @@ -879,8 +879,8 @@ void LawnApp::DoConfirmDeleteUserDialog(const SexyString &theName) { KillDialog(Dialogs::DIALOG_CONFIRMDELETEUSER); DoDialog(Dialogs::DIALOG_CONFIRMDELETEUSER, true, "[ARE_YOU_SURE]", - StrFormat(TodStringTranslate("[DELETE_USER_WARNING]").c_str(), theName.c_str()), "", - Dialog::BUTTONS_YES_NO); + StrFormat(TodStringTranslate("[DELETE_USER_WARNING]").c_str(), theName.c_str()), "", + Dialog::BUTTONS_YES_NO); } void LawnApp::FinishConfirmDeleteUserDialog(bool isYes) @@ -959,7 +959,7 @@ void LawnApp::FinishRenameUserDialog(bool isYes) if (!mProfileMgr->RenameProfile(anOldName, aNewName)) { DoDialog(Dialogs::DIALOG_RENAMEUSERERROR, true, "[NAME_CONFLICT]", "[ENTER_UNIQUE_PLAYER_NAME]", - "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); + "[DIALOG_BUTTON_OK]", Dialog::BUTTONS_FOOTER); return; } @@ -980,7 +980,7 @@ void LawnApp::FinishNameError(int theId) KillDialog(theId); NewUserDialog *aNewUserDialog = (NewUserDialog *)GetDialog( - theId == Dialogs::DIALOG_CREATEUSERERROR ? Dialogs::DIALOG_CREATEUSER : Dialogs::DIALOG_RENAMEUSER); + theId == Dialogs::DIALOG_CREATEUSERERROR ? Dialogs::DIALOG_CREATEUSER : Dialogs::DIALOG_RENAMEUSER); if (aNewUserDialog) { mWidgetManager->SetFocus(aNewUserDialog->mNameEditWidget); @@ -1033,7 +1033,7 @@ void LawnApp::FinishTimesUpDialog() void LawnApp::DoConfirmSellDialog(const SexyString &theMessage) { Dialog *aConfirmDialog = - DoDialog(Dialogs::DIALOG_ZEN_SELL, true, "[ZEN_SELL_HEADER]", theMessage, "", Dialog::BUTTONS_YES_NO); + DoDialog(Dialogs::DIALOG_ZEN_SELL, true, "[ZEN_SELL_HEADER]", theMessage, "", Dialog::BUTTONS_YES_NO); aConfirmDialog->mYesButton->mLabel = TodStringTranslate("[DIALOG_BUTTON_YES]"); aConfirmDialog->mNoButton->mLabel = TodStringTranslate("[DIALOG_BUTTON_NO]"); } @@ -1041,16 +1041,16 @@ void LawnApp::DoConfirmSellDialog(const SexyString &theMessage) void LawnApp::DoConfirmPurchaseDialog(const SexyString &theMessage) { LawnDialog *aComfirmDialog = (LawnDialog *)DoDialog(Dialogs::DIALOG_STORE_PURCHASE, true, "买下这个物品?", - theMessage, "", Dialog::BUTTONS_YES_NO); + theMessage, "", Dialog::BUTTONS_YES_NO); aComfirmDialog->mLawnYesButton->mLabel = TodStringTranslate("[DIALOG_BUTTON_YES]"); aComfirmDialog->mLawnNoButton->mLabel = TodStringTranslate("[DIALOG_BUTTON_NO]"); } Dialog *LawnApp::NewDialog(int theDialogId, bool isModal, const SexyString &theDialogHeader, - const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) + const SexyString &theDialogLines, const SexyString &theDialogFooter, int theButtonMode) { LawnDialog *aDialog = - new LawnDialog(this, theDialogId, isModal, theDialogHeader, theDialogLines, theDialogFooter, theButtonMode); + new LawnDialog(this, theDialogId, isModal, theDialogHeader, theDialogLines, theDialogFooter, theButtonMode); CenterDialog(aDialog, aDialog->mWidth, aDialog->mHeight); return aDialog; @@ -1088,14 +1088,14 @@ bool LawnApp::NeedPauseGame() { int anId = mDialogList.front()->mId; if (anId == Dialogs::DIALOG_CHOOSER_WARNING || anId == Dialogs::DIALOG_PURCHASE_PACKET_SLOT || - anId == Dialogs::DIALOG_IMITATER) + anId == Dialogs::DIALOG_IMITATER) { return false; } } return (mBoard == nullptr || mGameMode != GameMode::GAMEMODE_CHALLENGE_ZEN_GARDEN) && - (mBoard == nullptr || mGameMode != GameMode::GAMEMODE_TREE_OF_WISDOM); + (mBoard == nullptr || mGameMode != GameMode::GAMEMODE_TREE_OF_WISDOM); } void LawnApp::ModalOpen() @@ -1174,13 +1174,13 @@ void LawnApp::Init() // [SETUP] - Here you (can) add a link that contains the LATEST version of your mod. I recommend Github as it's free and easy to setup. (And you are probably using it now) UpdateChecker::gUpdateHost = - "https://raw.githubusercontent.com/LawnProject/ResoddedFramework/refs/heads/main/LawnVersion.txt"; + "https://raw.githubusercontent.com/LawnProject/ResoddedFramework/refs/heads/main/LawnVersion.txt"; UpdateChecker::Check(); if (UpdateChecker::gIsOutdated) TodTraceAndLog("[LawnProject] - OUTDATED: Current Version: %s | Latest Version: %s", - gVersion.toString().c_str(), UpdateChecker::gLatestVersion.toString().c_str()); + gVersion.toString().c_str(), UpdateChecker::gLatestVersion.toString().c_str()); else TodTraceAndLog("[LawnProject] - UP TO DATE: Version : %s", gVersion.toString().c_str()); @@ -1268,10 +1268,24 @@ void LawnApp::Init() #endif mTimer.Start(); - ReanimatorLoadDefinitions(gLawnReanimationArray, ReanimationType::NUM_REANIMS); + if (mRunInCompileMode) + { + TodTraceAndLog("[LawnProject] compile mode - will recompile definitions and exit"); + TodTraceAndLog("[LawnProject] compiling reanims"); + } + + ReanimatorLoadDefinitions(gLawnReanimationArray, ReanimationType::NUM_REANIMS, mRunInCompileMode); ReanimatorEnsureDefinitionLoaded(ReanimationType::REANIM_LOADBAR_SPROUT, true); ReanimatorEnsureDefinitionLoaded(ReanimationType::REANIM_LOADBAR_ZOMBIEHEAD, true); + if (mRunInCompileMode) + { + TodTraceAndLog("[LawnProject] compiling trails"); + TrailLoadDefinitions(gLawnTrailArray, LENGTH(gLawnTrailArray), true); + TodTraceAndLog("[LawnProject] compiling particles"); + TodParticleLoadDefinitions(gLawnParticleArray, LENGTH(gLawnParticleArray), true); + } + #ifdef _DEBUG aDuration = mTimer.GetDuration(); TodTraceAndLog("[LawnProject] - loading: 'loaderbar' %d ms", aDuration); @@ -1311,14 +1325,18 @@ bool LawnApp::DebugKeyDown(int theKey) void LawnApp::HandleCmdLineParam(const std::string &theParamName, const std::string &theParamValue) { -#ifndef _DEBUG if (theParamName == "-tod") { +#ifndef _DEBUG mTodCheatKeys = true; mDebugKeysEnabled = true; +#endif + } + else if (theParamName == "-compile") + { + mRunInCompileMode = true; } else -#endif { SexyApp::HandleCmdLineParam(theParamName, theParamValue); } @@ -1373,7 +1391,7 @@ bool LawnApp::UpdatePlayerProfileForFinishingLevel() mPlayerInfo->mChallengeRecords[GetCurrentChallengeIndex()]++; if (!HasFinishedAdventure() && - (mGameMode == GameMode::GAMEMODE_SCARY_POTTER_3 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_3)) + (mGameMode == GameMode::GAMEMODE_SCARY_POTTER_3 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_3)) { aUnlockedNewChallenge = false; } @@ -1420,7 +1438,7 @@ void LawnApp::CheckForGameEnd() if (IsAdventureMode()) { if (mBoard->mPlantsPlaced > 0 && !IsWhackAZombieLevel() && !IsScaryPotterLevel() && !IsBungeeBlitzLevel() && - !IsChallengeWithoutSeedBank()) + !IsChallengeWithoutSeedBank()) { if (mBoard->StageHasPool() && !mBoard->StageIsNight() && !mBoard->mDontPeaUsedPeashooter) { @@ -1431,7 +1449,7 @@ void LawnApp::CheckForGameEnd() mAchievements->GiveAchievement(AchievementID::ACHIEVEMENT_GROUNDED); } if (!mBoard->StageIsNight() && !mBoard->StageHasPool() && !mBoard->StageHasRoof() && - !mBoard->mGoodMorningUsedNonFungus) + !mBoard->mGoodMorningUsedNonFungus) { mAchievements->GiveAchievement(AchievementID::ACHIEVEMENT_GOOD_MORNING); } @@ -1664,7 +1682,7 @@ void LawnApp::LoadGroup(const char *theGroupName, int theGroupAveMsToLoad) return; bool aResoddedResourceFound = ResoddedFrameworkExtractResourcesByName(mResourceManager, theGroupName); if (mResourceManager->HadError() || - (!ExtractResourcesByName(mResourceManager, theGroupName) && !aResoddedResourceFound)) + (!ExtractResourcesByName(mResourceManager, theGroupName) && !aResoddedResourceFound)) { ShowResourceError(); mLoadingFailed = true; @@ -1689,8 +1707,8 @@ void LawnApp::LoadingThreadProc() mTitleScreen->mLoaderScreenIsLoaded = true; } - const char *groups[] = {"LoadingFonts", "LoadingImages", "LoadingSounds"}; - int group_ave_ms_to_load[] = {54, 9, 54}; + const char *groups[] = { "LoadingFonts", "LoadingImages", "LoadingSounds" }; + int group_ave_ms_to_load[] = { 54, 9, 54 }; for (int i = 0; i < 3; i++) { mNumLoadingThreadTasks += mResourceManager->GetNumResources(groups[i]) * group_ave_ms_to_load[i]; @@ -1728,12 +1746,12 @@ void LawnApp::LoadingThreadProc() TodTraceAndLog("[LawnProject] - loading '%s' %d ms", "stuff", (int)aTimer.GetDuration()); aTimer.Start(); - TrailLoadDefinitions(gLawnTrailArray, LENGTH(gLawnTrailArray)); + TrailLoadDefinitions(gLawnTrailArray, LENGTH(gLawnTrailArray), mRunInCompileMode); TodTraceAndLog("[LawnProject] - loading '%s' %d ms", "trail", (int)aTimer.GetDuration()); aTimer.Start(); TodHesitationTrace("trail"); - TodParticleLoadDefinitions(gLawnParticleArray, LENGTH(gLawnParticleArray)); + TodParticleLoadDefinitions(gLawnParticleArray, LENGTH(gLawnParticleArray), mRunInCompileMode); aDuration = std::max(aTimer.GetDuration(), 0.0); aTimer.Start(); @@ -1783,7 +1801,7 @@ void LawnApp::URLOpenFailed(const std::string &theURL) CopyToClipboard(theURL); std::string aString = "Please open the following URL in your browser\n\n" + theURL + - "\n\nFor your convenience, this URL has already been copied to your clipboard."; + "\n\nFor your convenience, this URL has already been copied to your clipboard."; DoDialog(Dialogs::DIALOG_OPENURL_WAIT, true, "Open Browser", "OK", aString, Dialog::BUTTONS_FOOTER); } @@ -1808,7 +1826,7 @@ void LawnApp::ConfirmQuit() SexyString aBody = TodStringTranslate("[QUIT_MESSAGE]"); SexyString aHeader = TodStringTranslate("[QUIT_HEADER]"); LawnDialog *aDialog = - (LawnDialog *)DoDialog(Dialogs::DIALOG_QUIT, true, aHeader, aBody, "", Dialog::BUTTONS_OK_CANCEL); + (LawnDialog *)DoDialog(Dialogs::DIALOG_QUIT, true, aHeader, aBody, "", Dialog::BUTTONS_OK_CANCEL); aDialog->mLawnYesButton->mLabel = TodStringTranslate("[QUIT_BUTTON]"); CenterDialog(aDialog, aDialog->mWidth, aDialog->mHeight); } @@ -1857,7 +1875,7 @@ void LawnApp::ButtonDepress(int theId) case Dialogs::DIALOG_QUIT: KillDialog(Dialogs::DIALOG_QUIT); { - SDL_Event event = {SDL_EVENT_QUIT}; + SDL_Event event = { SDL_EVENT_QUIT }; SDL_PushEvent(&event); } return; @@ -2020,14 +2038,14 @@ bool LawnApp::IsAdventureMode() bool LawnApp::IsSurvivalMode() { return mGameMode >= GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1 && - mGameMode <= GameMode::GAMEMODE_SURVIVAL_ENDLESS_STAGE_5; + mGameMode <= GameMode::GAMEMODE_SURVIVAL_ENDLESS_STAGE_5; } bool LawnApp::IsPuzzleMode() { return (mGameMode >= GameMode::GAMEMODE_SCARY_POTTER_1 && mGameMode <= GameMode::GAMEMODE_SCARY_POTTER_ENDLESS) || - (mGameMode >= GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_1 && - mGameMode <= GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_ENDLESS); + (mGameMode >= GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_1 && + mGameMode <= GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_ENDLESS); } bool LawnApp::IsChallengeMode() @@ -2066,8 +2084,8 @@ bool LawnApp::IsEndlessIZombie(GameMode theGameMode) bool LawnApp::IsContinuousChallenge() { return IsArtChallenge() || IsSlotMachineLevel() || IsFinalBossLevel() || - mGameMode == GameMode::GAMEMODE_CHALLENGE_BEGHOULED || mGameMode == GameMode::GAMEMODE_UPSELL || - mGameMode == GameMode::GAMEMODE_INTRO || mGameMode == GameMode::GAMEMODE_CHALLENGE_BEGHOULED_TWIST; + mGameMode == GameMode::GAMEMODE_CHALLENGE_BEGHOULED || mGameMode == GameMode::GAMEMODE_UPSELL || + mGameMode == GameMode::GAMEMODE_INTRO || mGameMode == GameMode::GAMEMODE_CHALLENGE_BEGHOULED_TWIST; } bool LawnApp::IsArtChallenge() @@ -2076,8 +2094,8 @@ bool LawnApp::IsArtChallenge() return false; return mGameMode == GameMode::GAMEMODE_CHALLENGE_ART_CHALLENGE_WALLNUT || - mGameMode == GameMode::GAMEMODE_CHALLENGE_ART_CHALLENGE_SUNFLOWER || - mGameMode == GameMode::GAMEMODE_CHALLENGE_SEEING_STARS; + mGameMode == GameMode::GAMEMODE_CHALLENGE_ART_CHALLENGE_SUNFLOWER || + mGameMode == GameMode::GAMEMODE_CHALLENGE_SEEING_STARS; } bool LawnApp::IsSquirrelLevel() @@ -2091,10 +2109,10 @@ bool LawnApp::IsIZombieLevel() return false; return mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_1 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_2 || - mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_3 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_4 || - mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_5 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_6 || - mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_7 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_8 || - mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_9 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_ENDLESS; + mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_3 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_4 || + mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_5 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_6 || + mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_7 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_8 || + mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_9 || mGameMode == GameMode::GAMEMODE_PUZZLE_I_ZOMBIE_ENDLESS; } bool LawnApp::IsShovelLevel() @@ -2108,7 +2126,7 @@ bool LawnApp::IsWallnutBowlingLevel() return false; if (mGameMode == GameMode::GAMEMODE_CHALLENGE_WALLNUT_BOWLING || - mGameMode == GameMode::GAMEMODE_CHALLENGE_WALLNUT_BOWLING_2) + mGameMode == GameMode::GAMEMODE_CHALLENGE_WALLNUT_BOWLING_2) return true; return IsAdventureMode() && mPlayerInfo->mLevel == 5; @@ -2133,7 +2151,7 @@ bool LawnApp::IsWhackAZombieLevel() bool LawnApp::IsLittleTroubleLevel() { return (mBoard && (mGameMode == GameMode::GAMEMODE_CHALLENGE_LITTLE_TROUBLE || - (mGameMode == GameMode::GAMEMODE_ADVENTURE && mPlayerInfo->mLevel == 25))); + (mGameMode == GameMode::GAMEMODE_ADVENTURE && mPlayerInfo->mLevel == 25))); } bool LawnApp::IsScaryPotterLevel() @@ -2172,7 +2190,7 @@ bool LawnApp::IsMiniBossLevel() return false; return (IsAdventureMode() && mPlayerInfo->mLevel == 10) || (IsAdventureMode() && mPlayerInfo->mLevel == 20) || - (IsAdventureMode() && mPlayerInfo->mLevel == 30); + (IsAdventureMode() && mPlayerInfo->mLevel == 30); } bool LawnApp::IsFinalBossLevel() @@ -2189,9 +2207,9 @@ bool LawnApp::IsFinalBossLevel() bool LawnApp::IsChallengeWithoutSeedBank() { return mGameMode == GameMode::GAMEMODE_CHALLENGE_RAINING_SEEDS || mGameMode == GameMode::GAMEMODE_UPSELL || - mGameMode == GameMode::GAMEMODE_INTRO || IsWhackAZombieLevel() || IsSquirrelLevel() || - IsScaryPotterLevel() || mGameMode == GameMode::GAMEMODE_CHALLENGE_ZEN_GARDEN || - mGameMode == GameMode::GAMEMODE_TREE_OF_WISDOM; + mGameMode == GameMode::GAMEMODE_INTRO || IsWhackAZombieLevel() || IsSquirrelLevel() || + IsScaryPotterLevel() || mGameMode == GameMode::GAMEMODE_CHALLENGE_ZEN_GARDEN || + mGameMode == GameMode::GAMEMODE_TREE_OF_WISDOM; } bool LawnApp::IsNight() @@ -2200,7 +2218,7 @@ bool LawnApp::IsNight() return false; return (mPlayerInfo->mLevel >= 11 && mPlayerInfo->mLevel <= 20) || - (mPlayerInfo->mLevel >= 31 && mPlayerInfo->mLevel <= 40) || mPlayerInfo->mLevel == 50; + (mPlayerInfo->mLevel >= 31 && mPlayerInfo->mLevel <= 40) || mPlayerInfo->mLevel == 50; } int LawnApp::GetCurrentChallengeIndex() @@ -2415,7 +2433,7 @@ bool LawnApp::CanSpawnYetis() { const ZombieDefinition &aZombieDef = GetZombieDefinition(ZombieType::ZOMBIE_YETI); return HasFinishedAdventure() && - (mPlayerInfo->mFinishedAdventure >= 2 || mPlayerInfo->mLevel >= aZombieDef.mStartingLevel); + (mPlayerInfo->mFinishedAdventure >= 2 || mPlayerInfo->mLevel >= aZombieDef.mStartingLevel); } bool LawnApp::HasBeatenChallenge(GameMode theGameMode) @@ -2494,7 +2512,7 @@ void LawnApp::CrazyDaveLeave() if (aCrazyDaveReanim) { if (mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) { CrazyDaveDoneHanding(); } @@ -2542,8 +2560,8 @@ void LawnApp::CrazyDaveTalkMessage(const SexyString &theMessage) doHanding = true; } if ((mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) && - !doHanding) + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) && + !doHanding) { CrazyDaveDoneHanding(); } @@ -2644,7 +2662,7 @@ void LawnApp::CrazyDaveTalkMessage(const SexyString &theMessage) ReanimatorTrackInstance *aHandTrackInstance = aCrazyDaveReanim->GetTrackInstanceByName("Dave_handinghand"); AttachEffect *aAttachEffect = - AttachReanim(aHandTrackInstance->mAttachmentID, aWallnutReanim, 100.0f, 393.0f); + AttachReanim(aHandTrackInstance->mAttachmentID, aWallnutReanim, 100.0f, 393.0f); aAttachEffect->mOffset.m00 = 1.2f; aAttachEffect->mOffset.m11 = 1.2f; @@ -2684,7 +2702,7 @@ void LawnApp::CrazyDaveTalkMessage(const SexyString &theMessage) aCrazyDaveReanim->PlayReanim("anim_talk_handing", ReanimLoopType::REANIM_LOOP, 50, 12.0f); Reanimation *aFertilizerReanim = - AddReanimation(0.0f, 0.0f, 0, ReanimationType::REANIM_ZENGARDEN_FERTILIZER); + AddReanimation(0.0f, 0.0f, 0, ReanimationType::REANIM_ZENGARDEN_FERTILIZER); aFertilizerReanim->PlayReanim("bag", ReanimLoopType::REANIM_PLAY_ONCE_AND_HOLD, 0, 24.0f); aFertilizerReanim->mAnimRate = 0.0f; @@ -2799,7 +2817,7 @@ void LawnApp::CrazyDaveStopTalking() mCrazyDaveState = CrazyDaveState::CRAZY_DAVE_HANDING_IDLING; } else if (mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_TALKING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING) + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING) { aCrazyDaveReanim->PlayReanim("anim_idle", ReanimLoopType::REANIM_LOOP, 20, 12.0f); mCrazyDaveState = CrazyDaveState::CRAZY_DAVE_IDLING; @@ -2838,7 +2856,7 @@ void LawnApp::UpdateCrazyDave() } if (mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_IDLING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) { if (mCrazyDaveMessageText.find("{MOUTH_BIG_SMILE}") != std::string::npos) { @@ -2859,8 +2877,8 @@ void LawnApp::UpdateCrazyDave() } if (mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_IDLING || mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_TALKING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING || - mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_TALKING || + mCrazyDaveState == CrazyDaveState::CRAZY_DAVE_HANDING_IDLING) { mCrazyDaveBlinkCounter--; if (mCrazyDaveBlinkCounter <= 0) @@ -2933,11 +2951,11 @@ void LawnApp::DrawCrazyDave(Graphics *g) } TodDrawStringWrapped(g, aBubbleText, aRect, FONT_BRIANNETOD16, Color::Black, - DrawStringJustification::DS_ALIGN_CENTER_VERTICAL_MIDDLE); + DrawStringJustification::DS_ALIGN_CENTER_VERTICAL_MIDDLE); if (clickToContinue) { TodDrawString(g, "[CLICK_TO_CONTINUE]", aPosX + 139, aPosY + 140, FONT_PICO129, Color::Black, - DrawStringJustification::DS_ALIGN_CENTER); + DrawStringJustification::DS_ALIGN_CENTER); } } @@ -2962,8 +2980,8 @@ int LawnApp::GetNumPreloadingTasks() if (HasFinishedAdventure() || mPlayerInfo->mLevel >= GetZombieDefinition(i).mStartingLevel) { if (i != ZombieType::ZOMBIE_BOSS && i != ZombieType::ZOMBIE_CATAPULT && - i != ZombieType::ZOMBIE_GARGANTUAR && i != ZombieType::ZOMBIE_DIGGER && - i != ZombieType::ZOMBIE_ZAMBONI) + i != ZombieType::ZOMBIE_GARGANTUAR && i != ZombieType::ZOMBIE_DIGGER && + i != ZombieType::ZOMBIE_ZAMBONI) { aTaskCount++; } @@ -3033,7 +3051,7 @@ void LawnApp::PreloadForUser() continue; } if (i == ZombieType::ZOMBIE_BOSS || i == ZombieType::ZOMBIE_CATAPULT || - i == ZombieType::ZOMBIE_GARGANTUAR || i == ZombieType::ZOMBIE_DIGGER || i == ZombieType::ZOMBIE_ZAMBONI) + i == ZombieType::ZOMBIE_GARGANTUAR || i == ZombieType::ZOMBIE_DIGGER || i == ZombieType::ZOMBIE_ZAMBONI) { continue; } @@ -3094,7 +3112,7 @@ int LawnApp::GetNumTrophies(ChallengePage thePage) int LawnApp::TrophiesNeedForGoldSunflower() { return 48 - GetNumTrophies(CHALLENGE_PAGE_SURVIVAL) - GetNumTrophies(CHALLENGE_PAGE_CHALLENGE) - - GetNumTrophies(CHALLENGE_PAGE_PUZZLE); + GetNumTrophies(CHALLENGE_PAGE_PUZZLE); } bool LawnApp::EarnedGoldTrophy() @@ -3148,7 +3166,7 @@ SexyString LawnApp::GetMoneyString(int theAmount) if (aValue > 999999) { return StrFormat("$%d,%03d,%03d", aValue / 1000000, (aValue - aValue / 1000000 * 1000000) / 1000, - aValue - aValue / 1000 * 1000); + aValue - aValue / 1000 * 1000); } else if (aValue > 9999) { @@ -3209,7 +3227,7 @@ bool LawnApp::CanDoPinataMode() return false; return mPlayerInfo->mChallengeRecords[(int)GameMode::GAMEMODE_TREE_OF_WISDOM - - (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 1000; + (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 1000; } bool LawnApp::CanDoDanceMode() @@ -3218,7 +3236,7 @@ bool LawnApp::CanDoDanceMode() return false; return mPlayerInfo->mChallengeRecords[(int)GameMode::GAMEMODE_TREE_OF_WISDOM - - (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 500; + (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 500; } bool LawnApp::CanDoDaisyMode() @@ -3227,7 +3245,7 @@ bool LawnApp::CanDoDaisyMode() return false; return mPlayerInfo->mChallengeRecords[(int)GameMode::GAMEMODE_TREE_OF_WISDOM - - (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 100; + (int)GameMode::GAMEMODE_SURVIVAL_NORMAL_STAGE_1] >= 100; } void LawnApp::PlaySample(int theSoundNum) diff --git a/src/LawnApp.h b/src/LawnApp.h index 5c1ddf8..0ba6f56 100644 --- a/src/LawnApp.h +++ b/src/LawnApp.h @@ -140,10 +140,10 @@ class LawnApp : public SexyApp TrialType mTrialType; bool mDebugTrialLocked; bool mMuteSoundsForCutscene; + bool mRunInCompileMode{}; static Version gResoddedVersion; - public: LawnApp(); virtual ~LawnApp(); @@ -355,11 +355,11 @@ class LawnApp : public SexyApp /// @param theButtonMode Button creation flags /// @return The created dialog virtual Dialog *DoDialog(int theDialogId, - bool isModal, - const SexyString &theDialogHeader, - const SexyString &theDialogLines, - const SexyString &theDialogFooter, - int theButtonMode); + bool isModal, + const SexyString &theDialogHeader, + const SexyString &theDialogLines, + const SexyString &theDialogFooter, + int theButtonMode); /// @brief After 30 ticks create a new dialog and focus on it /// @param theDialogId The ID of the dialog (determines the behavior on closing and opening) @@ -370,11 +370,11 @@ class LawnApp : public SexyApp /// @param theButtonMode Button creation flags /// @return The created dialog virtual Dialog *DoDialogDelay(int theDialogId, - bool isModal, - const SexyString &theDialogHeader, - const SexyString &theDialogLines, - const SexyString &theDialogFooter, - int theButtonMode); + bool isModal, + const SexyString &theDialogHeader, + const SexyString &theDialogLines, + const SexyString &theDialogFooter, + int theButtonMode); /// @brief Shutdown the game virtual void Shutdown(); @@ -394,11 +394,11 @@ class LawnApp : public SexyApp /// @param theButtonMode Button creation flags /// @return The created dialog virtual Dialog *NewDialog(int theDialogId, - bool isModal, - const SexyString &theDialogHeader, - const SexyString &theDialogLines, - const SexyString &theDialogFooter, - int theButtonMode); + bool isModal, + const SexyString &theDialogHeader, + const SexyString &theDialogLines, + const SexyString &theDialogFooter, + int theButtonMode); /// @brief Destroy the dialog /// @param theDialogId The ID of the dialog (determines the behavior on closing and opening) @@ -636,7 +636,7 @@ class LawnApp : public SexyApp /// @brief Is the current level a BungeeBlitz level /// @return True if the GameMode is a BungeeBlitz level, false otherwise bool IsBungeeBlitzLevel(); - + /// @brief Get the SeedType awarded in a level /// @param theLevel The level to check /// @return Awarded SeedType @@ -727,15 +727,15 @@ class LawnApp : public SexyApp void PreloadForUser(); /// @brief - /// @return + /// @return int GetNumPreloadingTasks(); int LawnMessageBox(int theDialogId, - const SexyString &theHeaderName, - const SexyString &theLinesName, - const SexyString &theButton1Name, - const SexyString &theButton2Name, - int theButtonMode); + const SexyString &theHeaderName, + const SexyString &theLinesName, + const SexyString &theButton1Name, + const SexyString &theButton2Name, + int theButtonMode); /// @brief Open Credits screen void ShowCreditScreen(); @@ -909,7 +909,6 @@ class LawnApp : public SexyApp /// @param theWidth The width to center it in /// @param theHeight The height to center it in static void CenterDialog(Dialog *theDialog, int theWidth, int theHeight); - }; /// @brief Get the current level name, used for logging @@ -937,4 +936,4 @@ extern bool gSlowMo; extern LawnApp *gLawnApp; extern int gSlowMoCounter; -#endif // __LAWNAPP_H__ \ No newline at end of file +#endif // __LAWNAPP_H__ diff --git a/src/Sexy.TodLib/Definition.cpp b/src/Sexy.TodLib/Definition.cpp index a030eb3..4779e0f 100644 --- a/src/Sexy.TodLib/Definition.cpp +++ b/src/Sexy.TodLib/Definition.cpp @@ -11,7 +11,7 @@ DefSymbol gTrailFlagDefSymbols[] = { { 0, "Loops" }, - { -1, nullptr } + { -1, nullptr } }; DefField gTrailDefFields[] = { { "Image", offsetof(TrailDefinition, mImage), DefFieldType::DT_IMAGE, nullptr }, @@ -44,25 +44,25 @@ DefSymbol gParticleFlagSymbols[] = { }; DefSymbol gEmitterTypeSymbols[] = { { 0, "Circle" }, - { 1, "Box" }, - { 2, "BoxPath" }, - { 3, "CirclePath" }, - { 4, "CircleEvenSpacing" }, - { -1, nullptr } + { 1, "Box" }, + { 2, "BoxPath" }, + { 3, "CirclePath" }, + { 4, "CircleEvenSpacing" }, + { -1, nullptr } }; DefSymbol gParticleTypeSymbols[] = { { 1, "Friction" }, - { 2, "Acceleration" }, - { 3, "Attractor" }, - { 4, "MaxVelocity" }, - { 5, "Velocity" }, - { 6, "Position" }, - { 7, "SystemPosition" }, - { 8, "GroundConstraint" }, - { 9, "Shake" }, - { 10, "Circle" }, - { 11, "Away" }, - { -1, nullptr } + { 2, "Acceleration" }, + { 3, "Attractor" }, + { 4, "MaxVelocity" }, + { 5, "Velocity" }, + { 6, "Position" }, + { 7, "SystemPosition" }, + { 8, "GroundConstraint" }, + { 9, "Shake" }, + { 10, "Circle" }, + { 11, "Away" }, + { -1, nullptr } }; DefField gParticleFieldDefFields[] = { @@ -166,9 +166,9 @@ DefMap gReanimatorDefMap = { gReanimatorDefFields, sizeof(ReanimatorDefinition), static DefLoadResPath gDefLoadResPaths[4] = { { "IMAGE_", "" }, - { "IMAGE_", "particles/" }, - { "IMAGE_REANIM_", "reanim/" }, - { "IMAGE_REANIM_", "images/" } + { "IMAGE_", "particles/" }, + { "IMAGE_REANIM_", "reanim/" }, + { "IMAGE_REANIM_", "images/" } }; void *ParticleFieldConstructor(void *thePointer) @@ -325,9 +325,9 @@ bool DefinitionLoadFont(Font **theFont, const SexyString &theName) return aFont != nullptr; } -bool DefinitionLoadXML(const SexyString &theFileName, DefMap *theDefMap, void *theDefinition) +bool DefinitionLoadXML(const SexyString &theFileName, DefMap *theDefMap, void *theDefinition, bool recompile) { - return DefinitionCompileAndLoad(theFileName, theDefMap, theDefinition); + return DefinitionCompileAndLoad(theFileName, theDefMap, theDefinition, recompile); } bool DefReadFromCacheArray(void *&theReadPtr, DefinitionArrayDef *theArray, DefMap *theDefMap) @@ -555,15 +555,15 @@ bool DefinitionReadCompiledFile(const SexyString &theCompiledFilePath, DefMap *t PerfTimer aTimer; aTimer.Start(); - FILE *pFile = fopen(theCompiledFilePath.c_str(), "rb"); + PFILE *pFile = p_fopen(theCompiledFilePath.c_str(), "rb"); if (pFile) { - fseek(pFile, 0, 2); - size_t aFileSize = ftell(pFile); - fseek(pFile, 0, 0); + p_fseek(pFile, 0, 2); + size_t aFileSize = p_ftell(pFile); + p_fseek(pFile, 0, 0); aCompiledFile.mData.resize(aFileSize); - bool aReadCompressedFailed = fread(aCompiledFile.mData.data(), sizeof(uint8_t), aFileSize, pFile) != aFileSize; - fclose(pFile); + bool aReadCompressedFailed = p_fread(aCompiledFile.mData.data(), sizeof(uint8_t), aFileSize, pFile) != aFileSize; + p_fclose(pFile); if (aReadCompressedFailed) { TodTraceAndLog("[TodLib] - Failed to read compiled file: %s\n", theCompiledFilePath.c_str()); @@ -591,6 +591,10 @@ bool DefinitionReadCompiledFile(const SexyString &theCompiledFilePath, DefMap *t } bool aResult = DefMapReadFromCache(anUncompressedData, theDefMap, theDefinition); + if (!aResult) + { + TodTraceAndLog("[TodLib] - Failed to read from cache: %s\n", theCompiledFilePath.c_str()); + } return aResult; } @@ -606,6 +610,7 @@ bool DefinitionReadCompiledFile(const SexyString &theCompiledFilePath, DefMap *t } return aResult; #else + TodTraceAndLog("[TodLib] - Cache is not valid: %s\n", theCompiledFilePath.c_str()); return false; #endif } @@ -1349,28 +1354,36 @@ bool DefinitionCompileFile(const SexyString theXMLFilePath, const SexyString &th return true; } -bool DefinitionCompileAndLoad(const SexyString &theXMLFilePath, DefMap *theDefMap, void *theDefinition) +bool DefinitionCompileAndLoad(const SexyString &theXMLFilePath, DefMap *theDefMap, void *theDefinition, bool recompile) { SexyString aCompiledFilePath = DefinitionGetCompiledFilePathFromXMLFilePath(theXMLFilePath); TodHesitationTrace("predef"); - try + if (!recompile) { - if (DefinitionReadCompiledFile(aCompiledFilePath, theDefMap, theDefinition)) + try + { + if (DefinitionReadCompiledFile(aCompiledFilePath, theDefMap, theDefinition)) + { + TodHesitationTrace("loaded %s", aCompiledFilePath.c_str()); + return true; + } + } + catch (int anErrorCode) { - TodHesitationTrace("loaded %s", aCompiledFilePath.c_str()); - return true; } - } - catch (int anErrorCode) - { } PerfTimer aTimer; aTimer.Start(); + if (!recompile) + { + //write to fresh_compiled to not overwrite on game re-compile by accident + aCompiledFilePath = "fresh_" + aCompiledFilePath; + } bool aResult = - DefinitionCompileFile(theXMLFilePath, "fresh_" + aCompiledFilePath, theDefMap, - theDefinition); //write to fresh_compiled to not overwrite on game re-compile by accident + DefinitionCompileFile(theXMLFilePath, aCompiledFilePath, theDefMap, + theDefinition); TodTraceAndLog("[TodLib] - compile %d ms:'%s'", (int)aTimer.GetDuration(), aCompiledFilePath.c_str()); TodHesitationTrace("compiled %s", aCompiledFilePath.c_str()); if (aResult) diff --git a/src/Sexy.TodLib/Definition.h b/src/Sexy.TodLib/Definition.h index 39ec213..a2cd150 100644 --- a/src/Sexy.TodLib/Definition.h +++ b/src/Sexy.TodLib/Definition.h @@ -189,11 +189,11 @@ void DefWriteToCacheFont(DefinitionCompiler *theReadPtr, Font **theFont); void DefWriteToCacheFloatTrack(DefinitionCompiler *theReadPtr, FloatParameterTrack *theTrack); void DefMapWriteToCache(DefinitionCompiler *theReadPtr, DefMap *theDefMap, void *theDefinition); -bool DefinitionCompileAndLoad(const SexyString &theXMLFilePath, DefMap *theDefMap, void *theDefinition); +bool DefinitionCompileAndLoad(const SexyString &theXMLFilePath, DefMap *theDefMap, void *theDefinition, bool recompile); bool DefinitionLoadMap(XMLParser *theXmlParser, DefMap *theDefMap, void *theDefinition); bool DefinitionLoadImage(Image **theImage, const SexyString &theName); bool DefinitionLoadFont(Font **theFont, const SexyString &theName); -bool DefinitionLoadXML(const SexyString &theFilename, DefMap *theDefMap, void *theDefinition); +bool DefinitionLoadXML(const SexyString &theFilename, DefMap *theDefMap, void *theDefinition, bool recompile); void DefinitionFreeArrayField(DefinitionArrayDef *theArray, DefMap *theDefMap); void DefinitionFreeMap(DefMap *theDefMap, void *theDefinition); diff --git a/src/Sexy.TodLib/Reanimator.cpp b/src/Sexy.TodLib/Reanimator.cpp index d9f37b4..98ebaae 100644 --- a/src/Sexy.TodLib/Reanimator.cpp +++ b/src/Sexy.TodLib/Reanimator.cpp @@ -1,3 +1,4 @@ +#include #include "TodDebug.h" #include "TodCommon.h" #include "Definition.h" @@ -17,156 +18,156 @@ int gReanimationParamArraySize; ReanimationParams *gReanimationParamArray; ReanimationParams gLawnReanimationArray[(int)ReanimationType::NUM_REANIMS] = { - {ReanimationType::REANIM_LOADBAR_SPROUT, "reanim/LoadBar_sprout.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_LOADBAR_ZOMBIEHEAD, "reanim/LoadBar_Zombiehead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_SODROLL, "reanim/SodRoll.reanim", 0}, - {ReanimationType::REANIM_FINAL_WAVE, "reanim/FinalWave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_PEASHOOTER, "reanim/PeaShooterSingle.reanim", 0}, - {ReanimationType::REANIM_WALLNUT, "reanim/Wallnut.reanim", 0}, - {ReanimationType::REANIM_LILYPAD, "reanim/Lilypad.reanim", 0}, - {ReanimationType::REANIM_SUNFLOWER, "reanim/SunFlower.reanim", 0}, - {ReanimationType::REANIM_LAWNMOWER, "reanim/LawnMower.reanim", 0}, - {ReanimationType::REANIM_READYSETPLANT, "reanim/StartReadySetPlant.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CHERRYBOMB, "reanim/CherryBomb.reanim", 0}, - {ReanimationType::REANIM_SQUASH, "reanim/Squash.reanim", 0}, - {ReanimationType::REANIM_DOOMSHROOM, "reanim/DoomShroom.reanim", 0}, - {ReanimationType::REANIM_SNOWPEA, "reanim/SnowPea.reanim", 0}, - {ReanimationType::REANIM_REPEATER, "reanim/PeaShooter.reanim", 0}, - {ReanimationType::REANIM_SUNSHROOM, "reanim/SunShroom.reanim", 0}, - {ReanimationType::REANIM_TALLNUT, "reanim/Tallnut.reanim", 0}, - {ReanimationType::REANIM_FUMESHROOM, "reanim/Fumeshroom.reanim", 0}, - {ReanimationType::REANIM_PUFFSHROOM, "reanim/Puffshroom.reanim", 0}, - {ReanimationType::REANIM_HYPNOSHROOM, "reanim/Hypnoshroom.reanim", 0}, - {ReanimationType::REANIM_CHOMPER, "reanim/Chomper.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE, "reanim/Zombie.reanim", 0}, - {ReanimationType::REANIM_SUN, "reanim/Sun.reanim", 0}, - {ReanimationType::REANIM_POTATOMINE, "reanim/PotatoMine.reanim", 0}, - {ReanimationType::REANIM_SPIKEWEED, "reanim/Caltrop.reanim", 0}, - {ReanimationType::REANIM_SPIKEROCK, "reanim/SpikeRock.reanim", 0}, - {ReanimationType::REANIM_THREEPEATER, "reanim/ThreePeater.reanim", 0}, - {ReanimationType::REANIM_MARIGOLD, "reanim/Marigold.reanim", 0}, - {ReanimationType::REANIM_ICESHROOM, "reanim/IceShroom.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_FOOTBALL, "reanim/Zombie_football.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_NEWSPAPER, "reanim/Zombie_paper.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_ZAMBONI, "reanim/Zombie_zamboni.reanim", 0}, - {ReanimationType::REANIM_SPLASH, "reanim/splash.reanim", 0}, - {ReanimationType::REANIM_JALAPENO, "reanim/Jalapeno.reanim", 0}, - {ReanimationType::REANIM_JALAPENO_FIRE, "reanim/fire.reanim", 0}, - {ReanimationType::REANIM_COIN_SILVER, "reanim/Coin_silver.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED, "reanim/Zombie_charred.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED_IMP, "reanim/Zombie_charred_imp.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED_DIGGER, "reanim/Zombie_charred_digger.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED_ZAMBONI, "reanim/Zombie_charred_zamboni.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED_CATAPULT, "reanim/Zombie_charred_catapult.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_CHARRED_GARGANTUAR, "reanim/Zombie_charred_gargantuar.reanim", 0}, - {ReanimationType::REANIM_SCRAREYSHROOM, "reanim/ScaredyShroom.reanim", 0}, - {ReanimationType::REANIM_PUMPKIN, "reanim/Pumpkin.reanim", 0}, - {ReanimationType::REANIM_PLANTERN, "reanim/Plantern.reanim", 0}, - {ReanimationType::REANIM_TORCHWOOD, "reanim/Torchwood.reanim", 0}, - {ReanimationType::REANIM_SPLITPEA, "reanim/SplitPea.reanim", 0}, - {ReanimationType::REANIM_SEASHROOM, "reanim/SeaShroom.reanim", 0}, - {ReanimationType::REANIM_BLOVER, "reanim/Blover.reanim", 0}, - {ReanimationType::REANIM_FLOWER_POT, "reanim/Pot.reanim", 0}, - {ReanimationType::REANIM_CACTUS, "reanim/Cactus.reanim", 0}, - {ReanimationType::REANIM_DANCER, "reanim/Zombie_disco.reanim", 0}, - {ReanimationType::REANIM_TANGLEKELP, "reanim/Tanglekelp.reanim", 0}, - {ReanimationType::REANIM_STARFRUIT, "reanim/Starfruit.reanim", 0}, - {ReanimationType::REANIM_POLEVAULTER, "reanim/Zombie_polevaulter.reanim", 0}, - {ReanimationType::REANIM_BALLOON, "reanim/Zombie_balloon.reanim", 0}, - {ReanimationType::REANIM_GARGANTUAR, "reanim/Zombie_gargantuar.reanim", 0}, - {ReanimationType::REANIM_IMP, "reanim/Zombie_imp.reanim", 0}, - {ReanimationType::REANIM_DIGGER, "reanim/Zombie_digger.reanim", 0}, - {ReanimationType::REANIM_DIGGER_DIRT, "reanim/Digger_rising_dirt.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_DOLPHINRIDER, "reanim/Zombie_dolphinrider.reanim", 0}, - {ReanimationType::REANIM_POGO, "reanim/Zombie_pogo.reanim", 0}, - {ReanimationType::REANIM_BACKUP_DANCER, "reanim/Zombie_backup.reanim", 0}, - {ReanimationType::REANIM_BOBSLED, "reanim/Zombie_bobsled.reanim", 0}, - {ReanimationType::REANIM_JACKINTHEBOX, "reanim/Zombie_jackbox.reanim", 0}, - {ReanimationType::REANIM_SNORKEL, "reanim/Zombie_snorkle.reanim", 0}, - {ReanimationType::REANIM_BUNGEE, "reanim/Zombie_bungi.reanim", 0}, - {ReanimationType::REANIM_CATAPULT, "reanim/Zombie_catapult.reanim", 0}, - {ReanimationType::REANIM_LADDER, "reanim/Zombie_ladder.reanim", 0}, - {ReanimationType::REANIM_PUFF, "reanim/Puff.reanim", 0}, - {ReanimationType::REANIM_SLEEPING, "reanim/Z.reanim", 0}, - {ReanimationType::REANIM_GRAVE_BUSTER, "reanim/Gravebuster.reanim", 0}, - {ReanimationType::REANIM_ZOMBIES_WON, "reanim/ZombiesWon.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_MAGNETSHROOM, "reanim/Magnetshroom.reanim", 0}, - {ReanimationType::REANIM_BOSS, "reanim/Zombie_boss.reanim", 0}, - {ReanimationType::REANIM_CABBAGEPULT, "reanim/Cabbagepult.reanim", 0}, - {ReanimationType::REANIM_KERNELPULT, "reanim/Cornpult.reanim", 0}, - {ReanimationType::REANIM_MELONPULT, "reanim/Melonpult.reanim", 0}, - {ReanimationType::REANIM_COFFEEBEAN, "reanim/Coffeebean.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_UMBRELLALEAF, "reanim/Umbrellaleaf.reanim", 0}, - {ReanimationType::REANIM_GATLINGPEA, "reanim/GatlingPea.reanim", 0}, - {ReanimationType::REANIM_CATTAIL, "reanim/Cattail.reanim", 0}, - {ReanimationType::REANIM_GLOOMSHROOM, "reanim/GloomShroom.reanim", 0}, - {ReanimationType::REANIM_BOSS_ICEBALL, "reanim/Zombie_boss_iceball.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_BOSS_FIREBALL, "reanim/Zombie_boss_fireball.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_COBCANNON, "reanim/CobCannon.reanim", 0}, - {ReanimationType::REANIM_GARLIC, "reanim/Garlic.reanim", 0}, - {ReanimationType::REANIM_GOLD_MAGNET, "reanim/GoldMagnet.reanim", 0}, - {ReanimationType::REANIM_WINTER_MELON, "reanim/WinterMelon.reanim", 0}, - {ReanimationType::REANIM_TWIN_SUNFLOWER, "reanim/TwinSunflower.reanim", 0}, - {ReanimationType::REANIM_POOL_CLEANER, "reanim/PoolCleaner.reanim", 0}, - {ReanimationType::REANIM_ROOF_CLEANER, "reanim/RoofCleaner.reanim", 0}, - {ReanimationType::REANIM_FIRE_PEA, "reanim/FirePea.reanim", 0}, - {ReanimationType::REANIM_IMITATER, "reanim/Imitater.reanim", 0}, - {ReanimationType::REANIM_YETI, "reanim/Zombie_yeti.reanim", 0}, - {ReanimationType::REANIM_BOSS_DRIVER, "reanim/Zombie_Boss_driver.reanim", 0}, - {ReanimationType::REANIM_LAWN_MOWERED_ZOMBIE, "reanim/LawnMoweredZombie.reanim", 0}, - {ReanimationType::REANIM_CRAZY_DAVE, "reanim/CrazyDave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_TEXT_FADE_ON, "reanim/TextFadeOn.reanim", 0}, - {ReanimationType::REANIM_HAMMER, "reanim/Hammer.reanim", 0}, - {ReanimationType::REANIM_SLOT_MACHINE_HANDLE, "reanim/SlotMachine.reanim", 0}, - {ReanimationType::REANIM_CREDITS_FOOTBALL, "reanim/Credits_Football.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_JACKBOX, "reanim/Credits_Jackbox.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_SELECTOR_SCREEN, "reanim/SelectorScreen.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE)}, - {ReanimationType::REANIM_PORTAL_CIRCLE, "reanim/Portal_Circle.reanim", 0}, - {ReanimationType::REANIM_PORTAL_SQUARE, "reanim/Portal_Square.reanim", 0}, - {ReanimationType::REANIM_ZENGARDEN_SPROUT, "reanim/ZenGarden_sprout.reanim", 0}, - {ReanimationType::REANIM_ZENGARDEN_WATERINGCAN, "reanim/ZenGarden_wateringcan.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_ZENGARDEN_FERTILIZER, "reanim/ZenGarden_fertilizer.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_ZENGARDEN_BUGSPRAY, "reanim/ZenGarden_bugspray.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_ZENGARDEN_PHONOGRAPH, "reanim/ZenGarden_phonograph.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_DIAMOND, "reanim/Diamond.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_HAND, "reanim/Zombie_hand.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_STINKY, "reanim/Stinky.reanim", 0}, - {ReanimationType::REANIM_RAKE, "reanim/Rake.reanim", 0}, - {ReanimationType::REANIM_RAIN_CIRCLE, "reanim/Rain_circle.reanim", 0}, - {ReanimationType::REANIM_RAIN_SPLASH, "reanim/Rain_splash.reanim", 0}, - {ReanimationType::REANIM_ZOMBIE_SURPRISE, "reanim/Zombie_surprise.reanim", 0}, - {ReanimationType::REANIM_COIN_GOLD, "reanim/Coin_gold.reanim", 0}, - {ReanimationType::REANIM_TREEOFWISDOM, "reanim/TreeOfWisdom.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_TREEOFWISDOM_CLOUDS, "reanim/TreeOfWisdomClouds.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_TREEOFWISDOM_TREEFOOD, "reanim/TreeFood.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_MAIN, "reanim/Credits_Main.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE)}, - {ReanimationType::REANIM_CREDITS_MAIN2, "reanim/Credits_Main2.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE)}, - {ReanimationType::REANIM_CREDITS_MAIN3, "reanim/Credits_Main3.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE)}, - {ReanimationType::REANIM_ZOMBIE_CREDITS_DANCE, "reanim/Zombie_credits_dance.reanim", 0}, - {ReanimationType::REANIM_CREDITS_STAGE, "reanim/Credits_stage.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_BIGBRAIN, "reanim/Credits_BigBrain.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_FLOWER_PETALS, "reanim/Credits_Flower_petals.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_INFANTRY, "reanim/Credits_Infantry.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_THROAT, "reanim/Credits_Throat.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_CRAZYDAVE, "reanim/Credits_CrazyDave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_BOSSDANCE, "reanim/Credits_Bossdance.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_ZOMBIE_CREDITS_SCREEN_DOOR, "reanim/Zombie_Credits_Screendoor.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_ZOMBIE_CREDITS_CONEHEAD, "reanim/Zombie_Credits_Conehead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_ZOMBIEARMY1, "reanim/Credits_ZombieArmy1.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_ZOMBIEARMY2, "reanim/Credits_ZombieArmy2.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_TOMBSTONES, "reanim/Credits_Tombstones.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_SOLARPOWER, "reanim/Credits_SolarPower.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_ANYHOUR, "reanim/Credits_Anyhour.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE)}, - {ReanimationType::REANIM_CREDITS_WEARETHEUNDEAD, "reanim/Credits_WeAreTheUndead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_CREDITS_DISCOLIGHTS, "reanim/Credits_DiscoLights.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, - {ReanimationType::REANIM_FLAG, "reanim/Zombie_FlagPole.reanim", 0}, - {ReanimationType::REANIM_ZOMBATAR_HEAD, "reanim/zombatar_zombie_head.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS)}, + { ReanimationType::REANIM_LOADBAR_SPROUT, "reanim/LoadBar_sprout.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_LOADBAR_ZOMBIEHEAD, "reanim/LoadBar_Zombiehead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_SODROLL, "reanim/SodRoll.reanim", 0 }, + { ReanimationType::REANIM_FINAL_WAVE, "reanim/FinalWave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_PEASHOOTER, "reanim/PeaShooterSingle.reanim", 0 }, + { ReanimationType::REANIM_WALLNUT, "reanim/Wallnut.reanim", 0 }, + { ReanimationType::REANIM_LILYPAD, "reanim/Lilypad.reanim", 0 }, + { ReanimationType::REANIM_SUNFLOWER, "reanim/SunFlower.reanim", 0 }, + { ReanimationType::REANIM_LAWNMOWER, "reanim/LawnMower.reanim", 0 }, + { ReanimationType::REANIM_READYSETPLANT, "reanim/StartReadySetPlant.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CHERRYBOMB, "reanim/CherryBomb.reanim", 0 }, + { ReanimationType::REANIM_SQUASH, "reanim/Squash.reanim", 0 }, + { ReanimationType::REANIM_DOOMSHROOM, "reanim/DoomShroom.reanim", 0 }, + { ReanimationType::REANIM_SNOWPEA, "reanim/SnowPea.reanim", 0 }, + { ReanimationType::REANIM_REPEATER, "reanim/PeaShooter.reanim", 0 }, + { ReanimationType::REANIM_SUNSHROOM, "reanim/SunShroom.reanim", 0 }, + { ReanimationType::REANIM_TALLNUT, "reanim/Tallnut.reanim", 0 }, + { ReanimationType::REANIM_FUMESHROOM, "reanim/Fumeshroom.reanim", 0 }, + { ReanimationType::REANIM_PUFFSHROOM, "reanim/Puffshroom.reanim", 0 }, + { ReanimationType::REANIM_HYPNOSHROOM, "reanim/Hypnoshroom.reanim", 0 }, + { ReanimationType::REANIM_CHOMPER, "reanim/Chomper.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE, "reanim/Zombie.reanim", 0 }, + { ReanimationType::REANIM_SUN, "reanim/Sun.reanim", 0 }, + { ReanimationType::REANIM_POTATOMINE, "reanim/PotatoMine.reanim", 0 }, + { ReanimationType::REANIM_SPIKEWEED, "reanim/Caltrop.reanim", 0 }, + { ReanimationType::REANIM_SPIKEROCK, "reanim/SpikeRock.reanim", 0 }, + { ReanimationType::REANIM_THREEPEATER, "reanim/ThreePeater.reanim", 0 }, + { ReanimationType::REANIM_MARIGOLD, "reanim/Marigold.reanim", 0 }, + { ReanimationType::REANIM_ICESHROOM, "reanim/IceShroom.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_FOOTBALL, "reanim/Zombie_football.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_NEWSPAPER, "reanim/Zombie_paper.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_ZAMBONI, "reanim/Zombie_zamboni.reanim", 0 }, + { ReanimationType::REANIM_SPLASH, "reanim/splash.reanim", 0 }, + { ReanimationType::REANIM_JALAPENO, "reanim/Jalapeno.reanim", 0 }, + { ReanimationType::REANIM_JALAPENO_FIRE, "reanim/fire.reanim", 0 }, + { ReanimationType::REANIM_COIN_SILVER, "reanim/Coin_silver.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED, "reanim/Zombie_charred.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED_IMP, "reanim/Zombie_charred_imp.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED_DIGGER, "reanim/Zombie_charred_digger.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED_ZAMBONI, "reanim/Zombie_charred_zamboni.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED_CATAPULT, "reanim/Zombie_charred_catapult.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_CHARRED_GARGANTUAR, "reanim/Zombie_charred_gargantuar.reanim", 0 }, + { ReanimationType::REANIM_SCRAREYSHROOM, "reanim/ScaredyShroom.reanim", 0 }, + { ReanimationType::REANIM_PUMPKIN, "reanim/Pumpkin.reanim", 0 }, + { ReanimationType::REANIM_PLANTERN, "reanim/Plantern.reanim", 0 }, + { ReanimationType::REANIM_TORCHWOOD, "reanim/Torchwood.reanim", 0 }, + { ReanimationType::REANIM_SPLITPEA, "reanim/SplitPea.reanim", 0 }, + { ReanimationType::REANIM_SEASHROOM, "reanim/SeaShroom.reanim", 0 }, + { ReanimationType::REANIM_BLOVER, "reanim/Blover.reanim", 0 }, + { ReanimationType::REANIM_FLOWER_POT, "reanim/Pot.reanim", 0 }, + { ReanimationType::REANIM_CACTUS, "reanim/Cactus.reanim", 0 }, + { ReanimationType::REANIM_DANCER, "reanim/Zombie_disco.reanim", 0 }, + { ReanimationType::REANIM_TANGLEKELP, "reanim/Tanglekelp.reanim", 0 }, + { ReanimationType::REANIM_STARFRUIT, "reanim/Starfruit.reanim", 0 }, + { ReanimationType::REANIM_POLEVAULTER, "reanim/Zombie_polevaulter.reanim", 0 }, + { ReanimationType::REANIM_BALLOON, "reanim/Zombie_balloon.reanim", 0 }, + { ReanimationType::REANIM_GARGANTUAR, "reanim/Zombie_gargantuar.reanim", 0 }, + { ReanimationType::REANIM_IMP, "reanim/Zombie_imp.reanim", 0 }, + { ReanimationType::REANIM_DIGGER, "reanim/Zombie_digger.reanim", 0 }, + { ReanimationType::REANIM_DIGGER_DIRT, "reanim/Digger_rising_dirt.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_DOLPHINRIDER, "reanim/Zombie_dolphinrider.reanim", 0 }, + { ReanimationType::REANIM_POGO, "reanim/Zombie_pogo.reanim", 0 }, + { ReanimationType::REANIM_BACKUP_DANCER, "reanim/Zombie_backup.reanim", 0 }, + { ReanimationType::REANIM_BOBSLED, "reanim/Zombie_bobsled.reanim", 0 }, + { ReanimationType::REANIM_JACKINTHEBOX, "reanim/Zombie_jackbox.reanim", 0 }, + { ReanimationType::REANIM_SNORKEL, "reanim/Zombie_snorkle.reanim", 0 }, + { ReanimationType::REANIM_BUNGEE, "reanim/Zombie_bungi.reanim", 0 }, + { ReanimationType::REANIM_CATAPULT, "reanim/Zombie_catapult.reanim", 0 }, + { ReanimationType::REANIM_LADDER, "reanim/Zombie_ladder.reanim", 0 }, + { ReanimationType::REANIM_PUFF, "reanim/Puff.reanim", 0 }, + { ReanimationType::REANIM_SLEEPING, "reanim/Z.reanim", 0 }, + { ReanimationType::REANIM_GRAVE_BUSTER, "reanim/Gravebuster.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIES_WON, "reanim/ZombiesWon.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_MAGNETSHROOM, "reanim/Magnetshroom.reanim", 0 }, + { ReanimationType::REANIM_BOSS, "reanim/Zombie_boss.reanim", 0 }, + { ReanimationType::REANIM_CABBAGEPULT, "reanim/Cabbagepult.reanim", 0 }, + { ReanimationType::REANIM_KERNELPULT, "reanim/Cornpult.reanim", 0 }, + { ReanimationType::REANIM_MELONPULT, "reanim/Melonpult.reanim", 0 }, + { ReanimationType::REANIM_COFFEEBEAN, "reanim/Coffeebean.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_UMBRELLALEAF, "reanim/Umbrellaleaf.reanim", 0 }, + { ReanimationType::REANIM_GATLINGPEA, "reanim/GatlingPea.reanim", 0 }, + { ReanimationType::REANIM_CATTAIL, "reanim/Cattail.reanim", 0 }, + { ReanimationType::REANIM_GLOOMSHROOM, "reanim/GloomShroom.reanim", 0 }, + { ReanimationType::REANIM_BOSS_ICEBALL, "reanim/Zombie_boss_iceball.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_BOSS_FIREBALL, "reanim/Zombie_boss_fireball.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_COBCANNON, "reanim/CobCannon.reanim", 0 }, + { ReanimationType::REANIM_GARLIC, "reanim/Garlic.reanim", 0 }, + { ReanimationType::REANIM_GOLD_MAGNET, "reanim/GoldMagnet.reanim", 0 }, + { ReanimationType::REANIM_WINTER_MELON, "reanim/WinterMelon.reanim", 0 }, + { ReanimationType::REANIM_TWIN_SUNFLOWER, "reanim/TwinSunflower.reanim", 0 }, + { ReanimationType::REANIM_POOL_CLEANER, "reanim/PoolCleaner.reanim", 0 }, + { ReanimationType::REANIM_ROOF_CLEANER, "reanim/RoofCleaner.reanim", 0 }, + { ReanimationType::REANIM_FIRE_PEA, "reanim/FirePea.reanim", 0 }, + { ReanimationType::REANIM_IMITATER, "reanim/Imitater.reanim", 0 }, + { ReanimationType::REANIM_YETI, "reanim/Zombie_yeti.reanim", 0 }, + { ReanimationType::REANIM_BOSS_DRIVER, "reanim/Zombie_Boss_driver.reanim", 0 }, + { ReanimationType::REANIM_LAWN_MOWERED_ZOMBIE, "reanim/LawnMoweredZombie.reanim", 0 }, + { ReanimationType::REANIM_CRAZY_DAVE, "reanim/CrazyDave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_TEXT_FADE_ON, "reanim/TextFadeOn.reanim", 0 }, + { ReanimationType::REANIM_HAMMER, "reanim/Hammer.reanim", 0 }, + { ReanimationType::REANIM_SLOT_MACHINE_HANDLE, "reanim/SlotMachine.reanim", 0 }, + { ReanimationType::REANIM_CREDITS_FOOTBALL, "reanim/Credits_Football.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_JACKBOX, "reanim/Credits_Jackbox.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_SELECTOR_SCREEN, "reanim/SelectorScreen.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) }, + { ReanimationType::REANIM_PORTAL_CIRCLE, "reanim/Portal_Circle.reanim", 0 }, + { ReanimationType::REANIM_PORTAL_SQUARE, "reanim/Portal_Square.reanim", 0 }, + { ReanimationType::REANIM_ZENGARDEN_SPROUT, "reanim/ZenGarden_sprout.reanim", 0 }, + { ReanimationType::REANIM_ZENGARDEN_WATERINGCAN, "reanim/ZenGarden_wateringcan.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_ZENGARDEN_FERTILIZER, "reanim/ZenGarden_fertilizer.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_ZENGARDEN_BUGSPRAY, "reanim/ZenGarden_bugspray.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_ZENGARDEN_PHONOGRAPH, "reanim/ZenGarden_phonograph.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_DIAMOND, "reanim/Diamond.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_HAND, "reanim/Zombie_hand.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_STINKY, "reanim/Stinky.reanim", 0 }, + { ReanimationType::REANIM_RAKE, "reanim/Rake.reanim", 0 }, + { ReanimationType::REANIM_RAIN_CIRCLE, "reanim/Rain_circle.reanim", 0 }, + { ReanimationType::REANIM_RAIN_SPLASH, "reanim/Rain_splash.reanim", 0 }, + { ReanimationType::REANIM_ZOMBIE_SURPRISE, "reanim/Zombie_surprise.reanim", 0 }, + { ReanimationType::REANIM_COIN_GOLD, "reanim/Coin_gold.reanim", 0 }, + { ReanimationType::REANIM_TREEOFWISDOM, "reanim/TreeOfWisdom.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_TREEOFWISDOM_CLOUDS, "reanim/TreeOfWisdomClouds.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_TREEOFWISDOM_TREEFOOD, "reanim/TreeFood.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_MAIN, "reanim/Credits_Main.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) }, + { ReanimationType::REANIM_CREDITS_MAIN2, "reanim/Credits_Main2.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) }, + { ReanimationType::REANIM_CREDITS_MAIN3, "reanim/Credits_Main3.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) }, + { ReanimationType::REANIM_ZOMBIE_CREDITS_DANCE, "reanim/Zombie_credits_dance.reanim", 0 }, + { ReanimationType::REANIM_CREDITS_STAGE, "reanim/Credits_stage.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_BIGBRAIN, "reanim/Credits_BigBrain.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_FLOWER_PETALS, "reanim/Credits_Flower_petals.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_INFANTRY, "reanim/Credits_Infantry.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_THROAT, "reanim/Credits_Throat.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_CRAZYDAVE, "reanim/Credits_CrazyDave.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_BOSSDANCE, "reanim/Credits_Bossdance.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_ZOMBIE_CREDITS_SCREEN_DOOR, "reanim/Zombie_Credits_Screendoor.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_ZOMBIE_CREDITS_CONEHEAD, "reanim/Zombie_Credits_Conehead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_ZOMBIEARMY1, "reanim/Credits_ZombieArmy1.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_ZOMBIEARMY2, "reanim/Credits_ZombieArmy2.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_TOMBSTONES, "reanim/Credits_Tombstones.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_SOLARPOWER, "reanim/Credits_SolarPower.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_ANYHOUR, "reanim/Credits_Anyhour.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) | GetBit((int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) }, + { ReanimationType::REANIM_CREDITS_WEARETHEUNDEAD, "reanim/Credits_WeAreTheUndead.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_CREDITS_DISCOLIGHTS, "reanim/Credits_DiscoLights.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, + { ReanimationType::REANIM_FLAG, "reanim/Zombie_FlagPole.reanim", 0 }, + { ReanimationType::REANIM_ZOMBATAR_HEAD, "reanim/zombatar_zombie_head.reanim", GetBit((int)ReanimFlags::REANIM_NO_ATLAS) }, }; ReanimatorTransform::ReanimatorTransform() - : mTransX(DEFAULT_FIELD_PLACEHOLDER), mTransY(DEFAULT_FIELD_PLACEHOLDER), mSkewX(DEFAULT_FIELD_PLACEHOLDER), - mSkewY(DEFAULT_FIELD_PLACEHOLDER), mScaleX(DEFAULT_FIELD_PLACEHOLDER), mScaleY(DEFAULT_FIELD_PLACEHOLDER), - mFrame(DEFAULT_FIELD_PLACEHOLDER), mAlpha(DEFAULT_FIELD_PLACEHOLDER), mImage(nullptr), mFont(nullptr), mText("") + : mTransX(DEFAULT_FIELD_PLACEHOLDER), mTransY(DEFAULT_FIELD_PLACEHOLDER), mSkewX(DEFAULT_FIELD_PLACEHOLDER), + mSkewY(DEFAULT_FIELD_PLACEHOLDER), mScaleX(DEFAULT_FIELD_PLACEHOLDER), mScaleY(DEFAULT_FIELD_PLACEHOLDER), + mFrame(DEFAULT_FIELD_PLACEHOLDER), mAlpha(DEFAULT_FIELD_PLACEHOLDER), mImage(nullptr), mFont(nullptr), mText("") { } @@ -186,9 +187,9 @@ void ReanimationFillInMissingData(void *&thePrev, void *&theValue) thePrev = theValue; } -bool ReanimationLoadDefinition(const SexyString &theFileName, ReanimatorDefinition *theDefinition) +bool ReanimationLoadDefinition(const SexyString &theFileName, ReanimatorDefinition *theDefinition, bool recompile) { - if (!DefinitionLoadXML(theFileName, &gReanimatorDefMap, theDefinition)) + if (!DefinitionLoadXML(theFileName, &gReanimatorDefMap, theDefinition, recompile)) return false; for (int aTrackIndex = 0; aTrackIndex < theDefinition->mTrackCount; aTrackIndex++) @@ -368,7 +369,7 @@ void Reanimation::ReanimationInitialize(float theX, float theY, ReanimatorDefini mFrameCount = mDefinition->mTracks[0].mTransformCount; int aItemSize = theDefinition->mTrackCount * sizeof(ReanimatorTrackInstance); mTrackInstances = (ReanimatorTrackInstance *)FindGlobalAllocator(aItemSize)->Calloc( - aItemSize); + aItemSize); for (int aTrackIndex = 0; aTrackIndex < mDefinition->mTrackCount; aTrackIndex++) { ReanimatorTrackInstance *aTrack = &mTrackInstances[aTrackIndex]; @@ -483,9 +484,9 @@ void Reanimation::Update() } void BlendTransform(ReanimatorTransform *theResult, - const ReanimatorTransform &theTransform1, - const ReanimatorTransform &theTransform2, - float theBlendFactor) + const ReanimatorTransform &theTransform1, + const ReanimatorTransform &theTransform2, + float theBlendFactor) { theResult->mTransX = FloatLerp(theTransform1.mTransX, theTransform2.mTransX, theBlendFactor); theResult->mTransY = FloatLerp(theTransform1.mTransY, theTransform2.mTransY, theBlendFactor); @@ -524,15 +525,15 @@ void Reanimation::GetCurrentTransform(int theTrackIndex, ReanimatorTransform *th { float aBlendFactor = aTrack->mBlendCounter / (float)aTrack->mBlendTime; BlendTransform(theTransformCurrent, - *theTransformCurrent, - aTrack->mBlendTransform, - aBlendFactor); + *theTransformCurrent, + aTrack->mBlendTransform, + aBlendFactor); } } void Reanimation::GetTransformAtTime(int theTrackIndex, - ReanimatorTransform *theTransform, - ReanimatorFrameTime *theFrameTime) + ReanimatorTransform *theTransform, + ReanimatorFrameTime *theFrameTime) { TOD_ASSERT(theTrackIndex >= 0 && theTrackIndex < mDefinition->mTrackCount); ReanimatorTrack *aTrack = &mDefinition->mTracks[theTrackIndex]; @@ -552,7 +553,7 @@ void Reanimation::GetTransformAtTime(int theTrackIndex, theTransform->mText = aTransBefore.mText; if (aTransBefore.mFrame != -1.0f && aTransAfter.mFrame == -1.0f && theFrameTime->mFraction > 0.0f && - mTrackInstances[theTrackIndex].mTruncateDisappearingFrames) + mTrackInstances[theTrackIndex].mTruncateDisappearingFrames) theTransform->mFrame = -1.0f; else theTransform->mFrame = aTransBefore.mFrame; @@ -575,18 +576,18 @@ void Reanimation::MatrixFromTransform(const ReanimatorTransform &theTransform, S } void Reanimation::ReanimBltMatrix(Graphics *g, - Image *theImage, - SexyMatrix3 &theTransform, - const Rect &theClipRect, - const Color &theColor, - int theDrawMode, - const Rect &theSrcRect) -{ - if (!gSexyAppBase->Is3DAccelerated() && - TestBit(gReanimationParamArray[(int)mReanimationType].mReanimParamFlags, (int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) && - FloatApproxEqual(theTransform.m01, 0.0f) && FloatApproxEqual(theTransform.m10, 0.0f) && - theTransform.m00 > 0.0f && theTransform.m11 > 0.0f && - theColor == Color::White) + Image *theImage, + SexyMatrix3 &theTransform, + const Rect &theClipRect, + const Color &theColor, + int theDrawMode, + const Rect &theSrcRect) +{ + if (!gSexyAppBase->Is3DAccelerated() && + TestBit(gReanimationParamArray[(int)mReanimationType].mReanimParamFlags, (int)ReanimFlags::REANIM_FAST_DRAW_IN_SW_MODE) && + FloatApproxEqual(theTransform.m01, 0.0f) && FloatApproxEqual(theTransform.m10, 0.0f) && + theTransform.m00 > 0.0f && theTransform.m11 > 0.0f && + theColor == Color::White) { float aScaleX = theTransform.m00; float aScaleY = theTransform.m11; @@ -661,7 +662,7 @@ bool Reanimation::DrawTrack(Graphics *g, int theTrackIndex, int theRenderGroup, Image *aImage = aTransform.mImage; ReanimAtlasImage *aAtlasImage = nullptr; if (mDefinition->mReanimAtlas != nullptr && - aImage != nullptr) + aImage != nullptr) { aAtlasImage = mDefinition->mReanimAtlas->GetEncodedReanimAtlas(aImage); if (aAtlasImage != nullptr) @@ -700,13 +701,13 @@ bool Reanimation::DrawTrack(Graphics *g, int theTrackIndex, int theRenderGroup, SexyMatrix3 aTransformMatrix; MatrixFromTransform(aTransform, aTransformMatrix); - SexyMatrix3Multiply(aMatrix, aTransformMatrix, aMatrix); + SexyMatrix3Multiply(aMatrix, aTransformMatrix, aMatrix); SexyMatrix3Multiply(aMatrix, mOverlayMatrix, aMatrix); SexyMatrix3Translation(aMatrix, - aTrackInstance->mShakeX + g->mTransX - 0.5f, - aTrackInstance->mShakeY + g->mTransY - 0.5f); + aTrackInstance->mShakeX + g->mTransX - 0.5f, + aTrackInstance->mShakeY + g->mTransY - 0.5f); - if (aAtlasImage != nullptr) + if (aAtlasImage != nullptr) { Rect aSrcRect(aAtlasImage->mX, aAtlasImage->mY, aAtlasImage->mWidth, aAtlasImage->mHeight); aImage = mDefinition->mReanimAtlas->mMemoryImage; @@ -715,22 +716,22 @@ bool Reanimation::DrawTrack(Graphics *g, int theTrackIndex, int theRenderGroup, aImage = FilterEffectGetImage(aImage, mFilterEffect); } theTriangleGroup->AddTriangle( - g, aImage, aMatrix, aClipRect, aColor, g->mDrawMode, aSrcRect); + g, aImage, aMatrix, aClipRect, aColor, g->mDrawMode, aSrcRect); if (mEnableExtraAdditiveDraw && - !aTrackInstance->mIgnoreExtraAdditiveColor) + !aTrackInstance->mIgnoreExtraAdditiveColor) { theTriangleGroup->AddTriangle( - g, aImage, aMatrix, aClipRect, aExtraAdditiveColor, Graphics::DRAWMODE_ADDITIVE, aSrcRect); + g, aImage, aMatrix, aClipRect, aExtraAdditiveColor, Graphics::DRAWMODE_ADDITIVE, aSrcRect); } if (mEnableExtraOverlayDraw) { theTriangleGroup->AddTriangle(g, - FilterEffectGetImage(aImage, FilterEffect::FILTER_EFFECT_WHITE), - aMatrix, - aClipRect, - aExtraOverlayColor, - Graphics::DRAWMODE_NORMAL, - aSrcRect); + FilterEffectGetImage(aImage, FilterEffect::FILTER_EFFECT_WHITE), + aMatrix, + aClipRect, + aExtraOverlayColor, + Graphics::DRAWMODE_NORMAL, + aSrcRect); } } else if (aImage != nullptr) @@ -759,7 +760,7 @@ bool Reanimation::DrawTrack(Graphics *g, int theTrackIndex, int theRenderGroup, { Image *aOverlayImage = FilterEffectGetImage(aImage, FilterEffect::FILTER_EFFECT_WHITE); ReanimBltMatrix( - g, aOverlayImage, aMatrix, aClipRect, aExtraOverlayColor, Graphics::DRAWMODE_NORMAL, aSrcRect); + g, aOverlayImage, aMatrix, aClipRect, aExtraOverlayColor, Graphics::DRAWMODE_NORMAL, aSrcRect); } } else if (aTransform.mFont != nullptr && *aTransform.mText != '\0') @@ -791,7 +792,7 @@ Image *Reanimation::GetCurrentTrackImage(const char *theTrackName) Image *aImage = aTransform.mImage; if (mDefinition->mReanimAtlas != nullptr && - aImage != nullptr) + aImage != nullptr) { ReanimAtlasImage *aAtlasImage = mDefinition->mReanimAtlas->GetEncodedReanimAtlas(aImage); if (aAtlasImage != nullptr) @@ -808,7 +809,7 @@ void Reanimation::GetTrackMatrix(int theTrackIndex, SexyTransform2D &theMatrix) int aImageFrame = FloatRoundToInt(aTransform.mFrame); Image *aImage = aTransform.mImage; if (mDefinition->mReanimAtlas != nullptr && - aImage != nullptr) + aImage != nullptr) { ReanimAtlasImage *aAtlasImage = mDefinition->mReanimAtlas->GetEncodedReanimAtlas(aImage); if (aAtlasImage != nullptr) @@ -837,8 +838,8 @@ void Reanimation::GetFrameTime(ReanimatorFrameTime *theFrameTime) TOD_ASSERT(mFrameStart + mFrameCount <= mDefinition->mTracks[0].mTransformCount); int aFrameCount; if (mLoopType == ReanimLoopType::REANIM_PLAY_ONCE_FULL_LAST_FRAME || - mLoopType == ReanimLoopType::REANIM_LOOP_FULL_LAST_FRAME || - mLoopType == ReanimLoopType::REANIM_PLAY_ONCE_FULL_LAST_FRAME_AND_HOLD) + mLoopType == ReanimLoopType::REANIM_LOOP_FULL_LAST_FRAME || + mLoopType == ReanimLoopType::REANIM_PLAY_ONCE_FULL_LAST_FRAME_AND_HOLD) aFrameCount = mFrameCount; else aFrameCount = mFrameCount - 1; @@ -854,7 +855,7 @@ void Reanimation::GetFrameTime(ReanimatorFrameTime *theFrameTime) else theFrameTime->mAnimFrameAfterInt = theFrameTime->mAnimFrameBeforeInt + 1; TOD_ASSERT(theFrameTime->mAnimFrameBeforeInt >= 0 && - theFrameTime->mAnimFrameAfterInt < mDefinition->mTracks[0].mTransformCount); + theFrameTime->mAnimFrameAfterInt < mDefinition->mTracks[0].mTransformCount); } void Reanimation::DrawRenderGroup(Graphics *g, int theRenderGroup) @@ -925,16 +926,16 @@ void Reanimation::GetTrackBasePoseMatrix(int theTrackIndex, SexyTransform2D &the } int aBasePos = mFrameBasePose == -1 ? mFrameStart : mFrameBasePose; - ReanimatorFrameTime aStartTime = {0.0f, aBasePos, aBasePos + 1}; + ReanimatorFrameTime aStartTime = { 0.0f, aBasePos, aBasePos + 1 }; ReanimatorTransform aTransformStart; GetTransformAtTime(theTrackIndex, &aTransformStart, &aStartTime); MatrixFromTransform(aTransformStart, theBasePosMatrix); } AttachEffect *Reanimation::AttachParticleToTrack(const char *theTrackName, - TodParticleSystem *theParticleSystem, - float thePosX, - float thePosY) + TodParticleSystem *theParticleSystem, + float thePosX, + float thePosY) { int aTrackIndex = FindTrackIndex(theTrackName); ReanimatorTrackInstance *aTrackInstance = &mTrackInstances[aTrackIndex]; @@ -1088,9 +1089,9 @@ void ReanimationHolder::InitializeHolder() } Reanimation *ReanimationHolder::AllocReanimation(float theX, - float theY, - int theRenderOrder, - ReanimationType theReanimationType) + float theY, + int theRenderOrder, + ReanimationType theReanimationType) { TOD_ASSERT(mReanimations.mSize != mReanimations.mMaxSize); Reanimation *aReanim = mReanimations.DataArrayAlloc(); @@ -1099,8 +1100,12 @@ Reanimation *ReanimationHolder::AllocReanimation(float theX, aReanim->ReanimationInitializeType(theX, theY, theReanimationType); return aReanim; } - void ReanimatorEnsureDefinitionLoaded(ReanimationType theReanimType, bool theIsPreloading) +{ + ReanimatorEnsureDefinitionRecompiled(theReanimType, theIsPreloading, false); +} + +void ReanimatorEnsureDefinitionRecompiled(ReanimationType theReanimType, bool theIsPreloading, bool recompile) { TOD_ASSERT(theReanimType >= 0 && theReanimType < gReanimatorDefCount); ReanimatorDefinition *aReanimDef = &gReanimatorDefArray[(int)theReanimType]; @@ -1118,30 +1123,25 @@ void ReanimatorEnsureDefinitionLoaded(ReanimationType theReanimType, bool theIsP TodTraceAndLog("[TodLib] - Cheater failed to preload '%s' on %s", aReanimParams->mReanimFileName, gGetCurrentLevelName().c_str()); else TodTraceAndLog("[TodLib] - Non-cheater failed to preload '%s' on %s", aReanimParams->mReanimFileName, gGetCurrentLevelName().c_str()); - } + } PerfTimer aTimer; aTimer.Start(); TodHesitationBracket aHesitation("Load Reanim '%s'", aReanimParams->mReanimFileName); - if (!ReanimationLoadDefinition(aReanimParams->mReanimFileName, aReanimDef)) + if (!ReanimationLoadDefinition(aReanimParams->mReanimFileName, aReanimDef, recompile)) { - char aBuf[1024]; -#ifdef _WIN32 - sprintf_s<1024U>(aBuf, "Failed to load reanim '%s'", aReanimParams->mReanimFileName); -#else - snprintf(aBuf, 1024, "Failed to load reanim '%s'", aReanimParams->mReanimFileName); -#endif - TodErrorMessageBox(aBuf, "Error"); + auto aMessage = std::format("Failed to load reanim '{}'", aReanimParams->mReanimFileName); + TodErrorMessageBox(aMessage.c_str(), "Error"); } int aDuration = aTimer.GetDuration(); if (aDuration > 100) // (beta only) - report if took too long TodTraceAndLog("[TodLib] - LOADING:Long reanim '%s' %d ms on %s", - aReanimParams->mReanimFileName, - aDuration, - gGetCurrentLevelName().c_str()); + aReanimParams->mReanimFileName, + aDuration, + gGetCurrentLevelName().c_str()); } -void ReanimatorLoadDefinitions(ReanimationParams *theReanimationParamArray, int theReanimationParamArraySize) +void ReanimatorLoadDefinitions(ReanimationParams *theReanimationParamArray, int theReanimationParamArraySize, bool recompile) { TodHesitationBracket aHesitation("ReanimatorLoadDefinitions"); TOD_ASSERT(!gReanimationParamArray && !gReanimatorDefArray); @@ -1154,8 +1154,10 @@ void ReanimatorLoadDefinitions(ReanimationParams *theReanimationParamArray, int { ReanimationParams *aReanimationParams = &theReanimationParamArray[i]; TOD_ASSERT(aReanimationParams->mReanimationType == i); - if (DefinitionIsCompiled(StringToSexyString(aReanimationParams->mReanimFileName))) - ReanimatorEnsureDefinitionLoaded(aReanimationParams->mReanimationType, true); + if (recompile || DefinitionIsCompiled(StringToSexyString(aReanimationParams->mReanimFileName))) + { + ReanimatorEnsureDefinitionRecompiled(aReanimationParams->mReanimationType, true, recompile); + } } } @@ -1180,7 +1182,7 @@ float Reanimation::GetTrackVelocity(const char *theTrackName) ReanimatorTrack *aTrack = &mDefinition->mTracks[aTrackIndex]; float aDis = aTrack->mTransforms[aFrameTime.mAnimFrameAfterInt].mTransX - - aTrack->mTransforms[aFrameTime.mAnimFrameBeforeInt].mTransX; + aTrack->mTransforms[aFrameTime.mAnimFrameBeforeInt].mTransX; return aDis * SECONDS_PER_UPDATE * mAnimRate; } @@ -1199,7 +1201,7 @@ void Reanimation::ShowOnlyTrack(const char *theTrackName) for (int i = 0; i < mDefinition->mTrackCount; i++) { mTrackInstances[i].mRenderGroup = - stricmp(mDefinition->mTracks[i].mName, theTrackName) == 0 ? RENDER_GROUP_NORMAL : RENDER_GROUP_HIDDEN; + stricmp(mDefinition->mTracks[i].mName, theTrackName) == 0 ? RENDER_GROUP_NORMAL : RENDER_GROUP_HIDDEN; } } @@ -1220,7 +1222,7 @@ void Reanimation::AssignRenderGroupToPrefix(const char *theTrackName, int theRen { const char *const aTrackName = mDefinition->mTracks[i].mName; if (strlen(aTrackName) >= aPrifixLength && - !strnicmp(aTrackName, theTrackName, aPrifixLength)) + !strnicmp(aTrackName, theTrackName, aPrifixLength)) mTrackInstances[i].mRenderGroup = theRenderGroup; } } @@ -1229,11 +1231,11 @@ void Reanimation::PropogateColorToAttachments() { for (int i = 0; i < mDefinition->mTrackCount; i++) AttachmentPropogateColor(mTrackInstances[i].mAttachmentID, - mColorOverride, - mEnableExtraAdditiveDraw, - mExtraAdditiveColor, - mEnableExtraOverlayDraw, - mExtraOverlayColor); + mColorOverride, + mEnableExtraAdditiveDraw, + mExtraAdditiveColor, + mEnableExtraOverlayDraw, + mExtraOverlayColor); } bool Reanimation::ShouldTriggerTimedEvent(float theEventTime) @@ -1252,7 +1254,7 @@ void Reanimation::PlayReanim(const char *theTrackName, ReanimLoopType theLoopTyp { if (theBlendTime > 0) StartBlend(theBlendTime); - if (theAnimRate != 0.0f) + if (theAnimRate != 0.0f) mAnimRate = theAnimRate; mLoopType = theLoopType; @@ -1260,7 +1262,6 @@ void Reanimation::PlayReanim(const char *theTrackName, ReanimLoopType theLoopTyp SetFramesForLayer(theTrackName); } - void Reanimation::ParseAttacherTrack(const ReanimatorTransform &theTransform, AttacherInfo &theAttacherInfo) { theAttacherInfo.mReanimName = ""; @@ -1283,18 +1284,18 @@ void Reanimation::ParseAttacherTrack(const ReanimatorTransform &theTransform, At if (aTrackName) { theAttacherInfo.mReanimName.assign(aReanimName + 2, - aTrackName - aReanimName - 2); + aTrackName - aReanimName - 2); if (aTags) theAttacherInfo.mTrackName.assign(aTrackName + 2, aTags - aTrackName - 2); else theAttacherInfo.mTrackName.assign(aTrackName + 2); } - else if (aTags) + else if (aTags) theAttacherInfo.mReanimName.assign(aReanimName + 2, aTags - aReanimName - 2); else theAttacherInfo.mReanimName.assign(aReanimName + 2); - while (aTags) + while (aTags) { const char *aTagEnds = strstr(aTags + 1, "]"); if (aTagEnds == nullptr) @@ -1325,11 +1326,11 @@ void Reanimation::AttacherSynchWalkSpeed(int theTrackIndex, Reanimation *theAtta int aPlaceHolderFrameStart = aFrameTime.mAnimFrameBeforeInt; while (aPlaceHolderFrameStart > mFrameStart && - aTrack->mTransforms[aPlaceHolderFrameStart - 1].mText == aTrack->mTransforms[aPlaceHolderFrameStart].mText) + aTrack->mTransforms[aPlaceHolderFrameStart - 1].mText == aTrack->mTransforms[aPlaceHolderFrameStart].mText) aPlaceHolderFrameStart--; int aPlaceHolderFrameEnd = aFrameTime.mAnimFrameBeforeInt; while (aPlaceHolderFrameEnd < mFrameStart + mFrameCount - 1 && - aTrack->mTransforms[aPlaceHolderFrameEnd + 1].mText == aTrack->mTransforms[aPlaceHolderFrameEnd].mText) + aTrack->mTransforms[aPlaceHolderFrameEnd + 1].mText == aTrack->mTransforms[aPlaceHolderFrameEnd].mText) aPlaceHolderFrameEnd++; int aPlaceHolderFrameCount = aPlaceHolderFrameEnd - aPlaceHolderFrameStart; ReanimatorTransform &aPlaceHolderStartTrans = aTrack->mTransforms[aPlaceHolderFrameStart]; @@ -1340,7 +1341,7 @@ void Reanimation::AttacherSynchWalkSpeed(int theTrackIndex, Reanimation *theAtta return; } float aPlaceHolderDistance = - -(aPlaceHolderEndTrans.mTransX - aPlaceHolderStartTrans.mTransX); + -(aPlaceHolderEndTrans.mTransX - aPlaceHolderStartTrans.mTransX); float aPlaceHolderSeconds = aPlaceHolderFrameCount / mAnimRate; if (FloatApproxEqual(aPlaceHolderSeconds, 0.0f)) { @@ -1352,10 +1353,10 @@ void Reanimation::AttacherSynchWalkSpeed(int theTrackIndex, Reanimation *theAtta ReanimatorTrack *aGroundTrack = &theAttachReanim->mDefinition->mTracks[aGroundTrackIndex]; ReanimatorTransform &aTransformGuyStart = aGroundTrack->mTransforms[theAttachReanim->mFrameStart]; ReanimatorTransform &aTransformGuyEnd = - aGroundTrack->mTransforms[theAttachReanim->mFrameStart + theAttachReanim->mFrameCount - 1]; + aGroundTrack->mTransforms[theAttachReanim->mFrameStart + theAttachReanim->mFrameCount - 1]; float aGuyDistance = aTransformGuyEnd.mTransX - aTransformGuyStart.mTransX; if (aGuyDistance < FLT_EPSILON || - aPlaceHolderDistance < FLT_EPSILON) + aPlaceHolderDistance < FLT_EPSILON) { theAttachReanim->mAnimRate = 0.0f; return; @@ -1368,14 +1369,14 @@ void Reanimation::AttacherSynchWalkSpeed(int theTrackIndex, Reanimation *theAtta if (aAttachEffect != nullptr) { float aGuyCurrentDistance = - aTransformGuyCurrent.mTransX - aTransformGuyStart.mTransX; + aTransformGuyCurrent.mTransX - aTransformGuyStart.mTransX; float aGuyExpectedDistance = - aGuyDistance * theAttachReanim->mAnimTime; + aGuyDistance * theAttachReanim->mAnimTime; aAttachEffect->mOffset.m02 = - aGuyExpectedDistance - aGuyCurrentDistance; + aGuyExpectedDistance - aGuyCurrentDistance; } theAttachReanim->mAnimRate = - aLoops * theAttachReanim->mFrameCount / aPlaceHolderSeconds; + aLoops * theAttachReanim->mFrameCount / aPlaceHolderSeconds; } void Reanimation::UpdateAttacherTrack(int theTrackIndex) @@ -1408,11 +1409,11 @@ void Reanimation::UpdateAttacherTrack(int theTrackIndex) Reanimation *aAttachReanim = FindReanimAttachment(aTrackInstance->mAttachmentID); if (aAttachReanim == nullptr || - aAttachReanim->mReanimationType != aReanimationType) + aAttachReanim->mReanimationType != aReanimationType) { AttachmentDie(aTrackInstance->mAttachmentID); aAttachReanim = gEffectSystem->mReanimationHolder->AllocReanimation( - 0.0f, 0.0f, 0, aReanimationType); + 0.0f, 0.0f, 0, aReanimationType); aAttachReanim->mLoopType = aAttacherInfo.mLoopType; aAttachReanim->mAnimRate = aAttacherInfo.mAnimRate; AttachReanim(aTrackInstance->mAttachmentID, aAttachReanim, 0.0f, 0.0f); @@ -1424,14 +1425,14 @@ void Reanimation::UpdateAttacherTrack(int theTrackIndex) int aAnimFrameStart, aAnimFrameCount; aAttachReanim->GetFramesForLayer(aAttacherInfo.mTrackName.c_str(), aAnimFrameStart, aAnimFrameCount); if (aAttachReanim->mFrameStart != aAnimFrameStart || - aAttachReanim->mFrameCount != aAnimFrameCount) // if (!aAttachReanim->IsAnimPlaying(……)) + aAttachReanim->mFrameCount != aAnimFrameCount) // if (!aAttachReanim->IsAnimPlaying(……)) { aAttachReanim->StartBlend(20); aAttachReanim->SetFramesForLayer(aAttacherInfo.mTrackName.c_str()); } if (aAttachReanim->mAnimRate == 12.0f && aAttacherInfo.mTrackName.compare("anim_walk") == 0 && - aAttachReanim->TrackExists("_ground")) + aAttachReanim->TrackExists("_ground")) AttacherSynchWalkSpeed(theTrackIndex, aAttachReanim, aAttacherInfo); else aAttachReanim->mAnimRate = aAttacherInfo.mAnimRate; @@ -1441,11 +1442,11 @@ void Reanimation::UpdateAttacherTrack(int theTrackIndex) Color aColor = ColorsMultiply(mColorOverride, aTrackInstance->mTrackColor); aColor.mAlpha = ClampInt(FloatRoundToInt(aTransform.mAlpha * aColor.mAlpha), 0, 255); AttachmentPropogateColor(aTrackInstance->mAttachmentID, - aColor, - mEnableExtraAdditiveDraw, - mExtraAdditiveColor, - mEnableExtraOverlayDraw, - mExtraOverlayColor); + aColor, + mEnableExtraAdditiveDraw, + mExtraAdditiveColor, + mEnableExtraOverlayDraw, + mExtraOverlayColor); } bool Reanimation::IsAnimPlaying(const char *theTrackName) diff --git a/src/Sexy.TodLib/Reanimator.h b/src/Sexy.TodLib/Reanimator.h index c146cb4..ce3d94e 100644 --- a/src/Sexy.TodLib/Reanimator.h +++ b/src/Sexy.TodLib/Reanimator.h @@ -78,10 +78,11 @@ extern ReanimationParams *gReanimationParamArray; void ReanimationFillInMissingData(float &thePrev, float &theValue); void ReanimationFillInMissingData(void *&thePrev, void *&theValue); -bool ReanimationLoadDefinition(const SexyString &theFileName, ReanimatorDefinition *theDefinition); +bool ReanimationLoadDefinition(const SexyString &theFileName, ReanimatorDefinition *theDefinition, bool recompile); void ReanimationFreeDefinition(ReanimatorDefinition *theDefinition); void _cdecl ReanimatorEnsureDefinitionLoaded(ReanimationType theReanimType, bool theIsPreloading); -void ReanimatorLoadDefinitions(ReanimationParams *theReanimationParamArray, int theReanimationParamArraySize); +void ReanimatorEnsureDefinitionRecompiled(ReanimationType theReanimType, bool theIsPreloading, bool recompile); +void ReanimatorLoadDefinitions(ReanimationParams *theReanimationParamArray, int theReanimationParamArraySize, bool recompile); void ReanimatorFreeDefinitions(); extern ReanimationParams gLawnReanimationArray[(int)ReanimationType::NUM_REANIMS]; @@ -228,7 +229,7 @@ class Reanimation } Image *GetCurrentTrackImage(const char *theTrackName); AttachEffect *AttachParticleToTrack(const char *theTrackName, TodParticleSystem *theParticleSystem, float thePosX, - float thePosY); + float thePosY); void GetTrackBasePoseMatrix(int theTrackIndex, SexyTransform2D &theBasePosMatrix); bool IsTrackShowing(const char *theTrackName); void SetTruncateDisappearingFrames(const char *theTrackName = nullptr, bool theTruncateDisappearingFrames = false); @@ -242,13 +243,13 @@ class Reanimation bool IsAnimPlaying(const char *theTrackName); void SetBasePoseFromAnim(const char *theTrackName); void ReanimBltMatrix(Graphics *g, Image *theImage, SexyMatrix3 &theTransform, const Rect &theClipRect, - const Color &theColor, int theDrawMode, const Rect &theSrcRect); + const Color &theColor, int theDrawMode, const Rect &theSrcRect); Reanimation *FindSubReanim(ReanimationType theReanimType); }; void ReanimationCreateAtlas(ReanimatorDefinition *theDefinition, ReanimationType theReanimationType); void ReanimationPreload(ReanimationType theReanimationType); void BlendTransform(ReanimatorTransform *theResult, const ReanimatorTransform &theTransform1, - const ReanimatorTransform &theTransform2, float theBlendFactor); + const ReanimatorTransform &theTransform2, float theBlendFactor); #endif diff --git a/src/Sexy.TodLib/TodParticle.cpp b/src/Sexy.TodLib/TodParticle.cpp index 1169212..4627132 100644 --- a/src/Sexy.TodLib/TodParticle.cpp +++ b/src/Sexy.TodLib/TodParticle.cpp @@ -1,3 +1,4 @@ +#include #include "TodDebug.h" #include "Definition.h" #include "TodParticle.h" @@ -6,180 +7,177 @@ #include "../SexyAppFramework/Graphics.h" #include "../SexyAppFramework/Renderer.h" -int gParticleDefCount; // [0x6A9F08] +int gParticleDefCount; // [0x6A9F08] TodParticleDefinition *gParticleDefArray; // [0x6A9F0C] -int gParticleParamArraySize; // [0x6A9F10] -ParticleParams *gParticleParamArray; // [0x6A9F14] +int gParticleParamArraySize; // [0x6A9F10] +ParticleParams *gParticleParamArray; // [0x6A9F14] ParticleParams gLawnParticleArray[(int)ParticleEffect::NUM_PARTICLES] = { - {ParticleEffect::PARTICLE_MELONSPLASH, "particles/MelonImpact.xml"}, - {ParticleEffect::PARTICLE_WINTERMELON, "particles/WinterMelonImpact.xml"}, - {ParticleEffect::PARTICLE_FUMECLOUD, "particles/FumeCloud.xml"}, - {ParticleEffect::PARTICLE_POPCORNSPLASH, "particles/PopcornSplash.xml"}, - {ParticleEffect::PARTICLE_POWIE, "particles/Powie.xml"}, - {ParticleEffect::PARTICLE_JACKEXPLODE, "particles/JackExplode.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_HEAD, "particles/ZombieHead.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_ARM, "particles/ZombieArm.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_TRAFFIC_CONE, "particles/ZombieTrafficCone.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_PAIL, "particles/ZombiePail.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_HELMET, "particles/ZombieHelmet.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_FLAG, "particles/ZombieFlag.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_DOOR, "particles/ZombieDoor.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_NEWSPAPER, "particles/ZombieNewspaper.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_HEADLIGHT, "particles/ZombieHeadLight.xml"}, - {ParticleEffect::PARTICLE_POW, "particles/Pow.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_POGO, "particles/ZombiePogo.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_NEWSPAPER_HEAD, "particles/ZombieNewspaperHead.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_BALLOON_HEAD, "particles/ZombieBalloonHead.xml"}, - {ParticleEffect::PARTICLE_SOD_ROLL, "particles/SodRoll.xml"}, - {ParticleEffect::PARTICLE_GRAVE_STONE_RISE, "particles/GraveStoneRise.xml"}, - {ParticleEffect::PARTICLE_PLANTING, "particles/Planting.xml"}, - {ParticleEffect::PARTICLE_PLANTING_POOL, "particles/PlantingPool.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_RISE, "particles/ZombieRise.xml"}, - {ParticleEffect::PARTICLE_GRAVE_BUSTER, "particles/GraveBuster.xml"}, - {ParticleEffect::PARTICLE_GRAVE_BUSTER_DIE, "particles/GraveBusterDie.xml"}, - {ParticleEffect::PARTICLE_POOL_SPLASH, "particles/PoolSplash.xml"}, - {ParticleEffect::PARTICLE_ICE_SPARKLE, "particles/IceSparkle.xml"}, - {ParticleEffect::PARTICLE_SEED_PACKET, "particles/SeedPacket.xml"}, - {ParticleEffect::PARTICLE_TALL_NUT_BLOCK, "particles/TallNutBlock.xml"}, - {ParticleEffect::PARTICLE_DOOM, "particles/Doom.xml"}, - {ParticleEffect::PARTICLE_DIGGER_RISE, "particles/DiggerRise.xml"}, - {ParticleEffect::PARTICLE_DIGGER_TUNNEL, "particles/DiggerTunnel.xml"}, - {ParticleEffect::PARTICLE_DANCER_RISE, "particles/DancerRise.xml"}, - {ParticleEffect::PARTICLE_POOL_SPARKLY, "particles/PoolSparkly.xml"}, - {ParticleEffect::PARTICLE_WALLNUT_EAT_SMALL, "particles/WallnutEatSmall.xml"}, - {ParticleEffect::PARTICLE_WALLNUT_EAT_LARGE, "particles/WallnutEatLarge.xml"}, - {ParticleEffect::PARTICLE_PEA_SPLAT, "particles/PeaSplat.xml"}, - {ParticleEffect::PARTICLE_BUTTER_SPLAT, "particles/ButterSplat.xml"}, - {ParticleEffect::PARTICLE_CABBAGE_SPLAT, "particles/CabbageSplat.xml"}, - {ParticleEffect::PARTICLE_PUFF_SPLAT, "particles/PuffSplat.xml"}, - {ParticleEffect::PARTICLE_STAR_SPLAT, "particles/StarSplat.xml"}, - {ParticleEffect::PARTICLE_ICE_TRAP, "particles/IceTrap.xml"}, - {ParticleEffect::PARTICLE_SNOWPEA_SPLAT, "particles/SnowPeaSplat.xml"}, - {ParticleEffect::PARTICLE_SNOWPEA_PUFF, "particles/SnowPeaPuff.xml"}, - {ParticleEffect::PARTICLE_SNOWPEA_TRAIL, "particles/SnowPeaTrail.xml"}, - {ParticleEffect::PARTICLE_LANTERN_SHINE, "particles/LanternShine.xml"}, - {ParticleEffect::PARTICLE_SEED_PACKET_PICKUP, "particles/Award.xml"}, - {ParticleEffect::PARTICLE_POTATO_MINE, "particles/PotatoMine.xml"}, - {ParticleEffect::PARTICLE_POTATO_MINE_RISE, "particles/PotatoMineRise.xml"}, - {ParticleEffect::PARTICLE_PUFFSHROOM_TRAIL, "particles/PuffShroomTrail.xml"}, - {ParticleEffect::PARTICLE_PUFFSHROOM_MUZZLE, "particles/PuffShroomMuzzle.xml"}, - {ParticleEffect::PARTICLE_SEED_PACKET_FLASH, "particles/SeedPacketFlash.xml"}, - {ParticleEffect::PARTICLE_WHACK_A_ZOMBIE_RISE, "particles/WhackAZombieRise.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_LADDER, "particles/ZombieLadder.xml"}, - {ParticleEffect::PARTICLE_UMBRELLA_REFLECT, "particles/UmbrellaReflect.xml"}, - {ParticleEffect::PARTICLE_SEED_PACKET_PICK, "particles/SeedPacketPick.xml"}, - {ParticleEffect::PARTICLE_ICE_TRAP_ZOMBIE, "particles/IceTrapZombie.xml"}, - {ParticleEffect::PARTICLE_ICE_TRAP_RELEASE, "particles/IceTrapRelease.xml"}, - {ParticleEffect::PARTICLE_ZAMBONI_SMOKE, "particles/ZamboniSmoke.xml"}, - {ParticleEffect::PARTICLE_GLOOMCLOUD, "particles/GloomCloud.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_POGO_HEAD, "particles/ZombiePogoHead.xml"}, - {ParticleEffect::PARTICLE_ZAMBONI_TIRE, "particles/ZamboniTire.xml"}, - {ParticleEffect::PARTICLE_ZAMBONI_EXPLOSION, "particles/ZamboniExplosion.xml"}, - {ParticleEffect::PARTICLE_ZAMBONI_EXPLOSION2, "particles/ZamboniExplosion2.xml"}, - {ParticleEffect::PARTICLE_CATAPULT_EXPLOSION, "particles/CatapultExplosion.xml"}, - {ParticleEffect::PARTICLE_MOWER_CLOUD, "particles/MowerCloud.xml"}, - {ParticleEffect::PARTICLE_BOSS_ICE_BALL, "particles/BossIceBallTrail.xml"}, - {ParticleEffect::PARTICLE_BLASTMARK, "particles/BlastMark.xml"}, - {ParticleEffect::PARTICLE_COIN_PICKUP_ARROW, "particles/CoinPickupArrow.xml"}, - {ParticleEffect::PARTICLE_PRESENT_PICKUP, "particles/PresentPickup.xml"}, - {ParticleEffect::PARTICLE_IMITATER_MORPH, "particles/ImitaterMorph.xml"}, - {ParticleEffect::PARTICLE_MOWERED_ZOMBIE_HEAD, "particles/MoweredZombieHead.xml"}, - {ParticleEffect::PARTICLE_MOWERED_ZOMBIE_ARM, "particles/MoweredZombieArm.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_HEAD_POOL, "particles/ZombieHeadPool.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_BOSS_FIREBALL, "particles/Zombie_boss_fireball.xml"}, - {ParticleEffect::PARTICLE_FIREBALL_DEATH, "particles/FireballDeath.xml"}, - {ParticleEffect::PARTICLE_ICEBALL_DEATH, "particles/IceballDeath.xml"}, - {ParticleEffect::PARTICLE_ICEBALL_TRAIL, "particles/Iceball_Trail.xml"}, - {ParticleEffect::PARTICLE_FIREBALL_TRAIL, "particles/Fireball_Trail.xml"}, - {ParticleEffect::PARTICLE_BOSS_EXPLOSION, "particles/BossExplosion.xml"}, - {ParticleEffect::PARTICLE_SCREEN_FLASH, "particles/ScreenFlash.xml"}, - {ParticleEffect::PARTICLE_TROPHY_SPARKLE, "particles/TrophySparkle.xml"}, - {ParticleEffect::PARTICLE_PORTAL_CIRCLE, "particles/PortalCircle.xml"}, - {ParticleEffect::PARTICLE_PORTAL_SQUARE, "particles/PortalSquare.xml"}, - {ParticleEffect::PARTICLE_POTTED_PLANT_GLOW, "particles/PottedPlantGlow.xml"}, - {ParticleEffect::PARTICLE_POTTED_WATER_PLANT_GLOW, "particles/PottedWaterPlantGlow.xml"}, - {ParticleEffect::PARTICLE_POTTED_ZEN_GLOW, "particles/PottedZenGlow.xml"}, - {ParticleEffect::PARTICLE_MIND_CONTROL, "particles/MindControl.xml"}, - {ParticleEffect::PARTICLE_VASE_SHATTER, "particles/VaseShatter.xml"}, - {ParticleEffect::PARTICLE_VASE_SHATTER_LEAF, "particles/VaseShatterLeaf.xml"}, - {ParticleEffect::PARTICLE_VASE_SHATTER_ZOMBIE, "particles/VaseShatterZombie.xml"}, - {ParticleEffect::PARTICLE_AWARD_PICKUP_ARROW, "particles/AwardPickupArrow.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_SEAWEED, "particles/Zombie_seaweed.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_MUSTACHE, "particles/ZombieMustache.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_SUNGLASS, "particles/ZombieFutureGlasses.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_PINATA, "particles/Pinata.xml"}, - {ParticleEffect::PARTICLE_DUST_SQUASH, "particles/Dust_Squash.xml"}, - {ParticleEffect::PARTICLE_DUST_FOOT, "particles/Dust_Foot.xml"}, - {ParticleEffect::PARTICLE_ZOMBIE_DAISIES, "particles/Daisy.xml"}, - {ParticleEffect::PARTICLE_CREDIT_STROBE, "particles/Credits_Strobe.xml"}, - {ParticleEffect::PARTICLE_CREDITS_RAYSWIPE, "particles/Credits_RaysWipe.xml"}, - {ParticleEffect::PARTICLE_CREDITS_ZOMBIEHEADWIPE, "particles/Credits_ZombieHeadWipe.xml"}, - {ParticleEffect::PARTICLE_STARBURST, "particles/Starburst.xml"}, - {ParticleEffect::PARTICLE_CREDITS_FOG, "particles/Credits_fog.xml"}, - {ParticleEffect::PARTICLE_PERSENT_PICK_UP_ARROW, "particles/UpsellArrow.xml"}, + { ParticleEffect::PARTICLE_MELONSPLASH, "particles/MelonImpact.xml" }, + { ParticleEffect::PARTICLE_WINTERMELON, "particles/WinterMelonImpact.xml" }, + { ParticleEffect::PARTICLE_FUMECLOUD, "particles/FumeCloud.xml" }, + { ParticleEffect::PARTICLE_POPCORNSPLASH, "particles/PopcornSplash.xml" }, + { ParticleEffect::PARTICLE_POWIE, "particles/Powie.xml" }, + { ParticleEffect::PARTICLE_JACKEXPLODE, "particles/JackExplode.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_HEAD, "particles/ZombieHead.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_ARM, "particles/ZombieArm.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_TRAFFIC_CONE, "particles/ZombieTrafficCone.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_PAIL, "particles/ZombiePail.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_HELMET, "particles/ZombieHelmet.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_FLAG, "particles/ZombieFlag.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_DOOR, "particles/ZombieDoor.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_NEWSPAPER, "particles/ZombieNewspaper.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_HEADLIGHT, "particles/ZombieHeadLight.xml" }, + { ParticleEffect::PARTICLE_POW, "particles/Pow.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_POGO, "particles/ZombiePogo.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_NEWSPAPER_HEAD, "particles/ZombieNewspaperHead.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_BALLOON_HEAD, "particles/ZombieBalloonHead.xml" }, + { ParticleEffect::PARTICLE_SOD_ROLL, "particles/SodRoll.xml" }, + { ParticleEffect::PARTICLE_GRAVE_STONE_RISE, "particles/GraveStoneRise.xml" }, + { ParticleEffect::PARTICLE_PLANTING, "particles/Planting.xml" }, + { ParticleEffect::PARTICLE_PLANTING_POOL, "particles/PlantingPool.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_RISE, "particles/ZombieRise.xml" }, + { ParticleEffect::PARTICLE_GRAVE_BUSTER, "particles/GraveBuster.xml" }, + { ParticleEffect::PARTICLE_GRAVE_BUSTER_DIE, "particles/GraveBusterDie.xml" }, + { ParticleEffect::PARTICLE_POOL_SPLASH, "particles/PoolSplash.xml" }, + { ParticleEffect::PARTICLE_ICE_SPARKLE, "particles/IceSparkle.xml" }, + { ParticleEffect::PARTICLE_SEED_PACKET, "particles/SeedPacket.xml" }, + { ParticleEffect::PARTICLE_TALL_NUT_BLOCK, "particles/TallNutBlock.xml" }, + { ParticleEffect::PARTICLE_DOOM, "particles/Doom.xml" }, + { ParticleEffect::PARTICLE_DIGGER_RISE, "particles/DiggerRise.xml" }, + { ParticleEffect::PARTICLE_DIGGER_TUNNEL, "particles/DiggerTunnel.xml" }, + { ParticleEffect::PARTICLE_DANCER_RISE, "particles/DancerRise.xml" }, + { ParticleEffect::PARTICLE_POOL_SPARKLY, "particles/PoolSparkly.xml" }, + { ParticleEffect::PARTICLE_WALLNUT_EAT_SMALL, "particles/WallnutEatSmall.xml" }, + { ParticleEffect::PARTICLE_WALLNUT_EAT_LARGE, "particles/WallnutEatLarge.xml" }, + { ParticleEffect::PARTICLE_PEA_SPLAT, "particles/PeaSplat.xml" }, + { ParticleEffect::PARTICLE_BUTTER_SPLAT, "particles/ButterSplat.xml" }, + { ParticleEffect::PARTICLE_CABBAGE_SPLAT, "particles/CabbageSplat.xml" }, + { ParticleEffect::PARTICLE_PUFF_SPLAT, "particles/PuffSplat.xml" }, + { ParticleEffect::PARTICLE_STAR_SPLAT, "particles/StarSplat.xml" }, + { ParticleEffect::PARTICLE_ICE_TRAP, "particles/IceTrap.xml" }, + { ParticleEffect::PARTICLE_SNOWPEA_SPLAT, "particles/SnowPeaSplat.xml" }, + { ParticleEffect::PARTICLE_SNOWPEA_PUFF, "particles/SnowPeaPuff.xml" }, + { ParticleEffect::PARTICLE_SNOWPEA_TRAIL, "particles/SnowPeaTrail.xml" }, + { ParticleEffect::PARTICLE_LANTERN_SHINE, "particles/LanternShine.xml" }, + { ParticleEffect::PARTICLE_SEED_PACKET_PICKUP, "particles/Award.xml" }, + { ParticleEffect::PARTICLE_POTATO_MINE, "particles/PotatoMine.xml" }, + { ParticleEffect::PARTICLE_POTATO_MINE_RISE, "particles/PotatoMineRise.xml" }, + { ParticleEffect::PARTICLE_PUFFSHROOM_TRAIL, "particles/PuffShroomTrail.xml" }, + { ParticleEffect::PARTICLE_PUFFSHROOM_MUZZLE, "particles/PuffShroomMuzzle.xml" }, + { ParticleEffect::PARTICLE_SEED_PACKET_FLASH, "particles/SeedPacketFlash.xml" }, + { ParticleEffect::PARTICLE_WHACK_A_ZOMBIE_RISE, "particles/WhackAZombieRise.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_LADDER, "particles/ZombieLadder.xml" }, + { ParticleEffect::PARTICLE_UMBRELLA_REFLECT, "particles/UmbrellaReflect.xml" }, + { ParticleEffect::PARTICLE_SEED_PACKET_PICK, "particles/SeedPacketPick.xml" }, + { ParticleEffect::PARTICLE_ICE_TRAP_ZOMBIE, "particles/IceTrapZombie.xml" }, + { ParticleEffect::PARTICLE_ICE_TRAP_RELEASE, "particles/IceTrapRelease.xml" }, + { ParticleEffect::PARTICLE_ZAMBONI_SMOKE, "particles/ZamboniSmoke.xml" }, + { ParticleEffect::PARTICLE_GLOOMCLOUD, "particles/GloomCloud.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_POGO_HEAD, "particles/ZombiePogoHead.xml" }, + { ParticleEffect::PARTICLE_ZAMBONI_TIRE, "particles/ZamboniTire.xml" }, + { ParticleEffect::PARTICLE_ZAMBONI_EXPLOSION, "particles/ZamboniExplosion.xml" }, + { ParticleEffect::PARTICLE_ZAMBONI_EXPLOSION2, "particles/ZamboniExplosion2.xml" }, + { ParticleEffect::PARTICLE_CATAPULT_EXPLOSION, "particles/CatapultExplosion.xml" }, + { ParticleEffect::PARTICLE_MOWER_CLOUD, "particles/MowerCloud.xml" }, + { ParticleEffect::PARTICLE_BOSS_ICE_BALL, "particles/BossIceBallTrail.xml" }, + { ParticleEffect::PARTICLE_BLASTMARK, "particles/BlastMark.xml" }, + { ParticleEffect::PARTICLE_COIN_PICKUP_ARROW, "particles/CoinPickupArrow.xml" }, + { ParticleEffect::PARTICLE_PRESENT_PICKUP, "particles/PresentPickup.xml" }, + { ParticleEffect::PARTICLE_IMITATER_MORPH, "particles/ImitaterMorph.xml" }, + { ParticleEffect::PARTICLE_MOWERED_ZOMBIE_HEAD, "particles/MoweredZombieHead.xml" }, + { ParticleEffect::PARTICLE_MOWERED_ZOMBIE_ARM, "particles/MoweredZombieArm.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_HEAD_POOL, "particles/ZombieHeadPool.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_BOSS_FIREBALL, "particles/Zombie_boss_fireball.xml" }, + { ParticleEffect::PARTICLE_FIREBALL_DEATH, "particles/FireballDeath.xml" }, + { ParticleEffect::PARTICLE_ICEBALL_DEATH, "particles/IceballDeath.xml" }, + { ParticleEffect::PARTICLE_ICEBALL_TRAIL, "particles/Iceball_Trail.xml" }, + { ParticleEffect::PARTICLE_FIREBALL_TRAIL, "particles/Fireball_Trail.xml" }, + { ParticleEffect::PARTICLE_BOSS_EXPLOSION, "particles/BossExplosion.xml" }, + { ParticleEffect::PARTICLE_SCREEN_FLASH, "particles/ScreenFlash.xml" }, + { ParticleEffect::PARTICLE_TROPHY_SPARKLE, "particles/TrophySparkle.xml" }, + { ParticleEffect::PARTICLE_PORTAL_CIRCLE, "particles/PortalCircle.xml" }, + { ParticleEffect::PARTICLE_PORTAL_SQUARE, "particles/PortalSquare.xml" }, + { ParticleEffect::PARTICLE_POTTED_PLANT_GLOW, "particles/PottedPlantGlow.xml" }, + { ParticleEffect::PARTICLE_POTTED_WATER_PLANT_GLOW, "particles/PottedWaterPlantGlow.xml" }, + { ParticleEffect::PARTICLE_POTTED_ZEN_GLOW, "particles/PottedZenGlow.xml" }, + { ParticleEffect::PARTICLE_MIND_CONTROL, "particles/MindControl.xml" }, + { ParticleEffect::PARTICLE_VASE_SHATTER, "particles/VaseShatter.xml" }, + { ParticleEffect::PARTICLE_VASE_SHATTER_LEAF, "particles/VaseShatterLeaf.xml" }, + { ParticleEffect::PARTICLE_VASE_SHATTER_ZOMBIE, "particles/VaseShatterZombie.xml" }, + { ParticleEffect::PARTICLE_AWARD_PICKUP_ARROW, "particles/AwardPickupArrow.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_SEAWEED, "particles/Zombie_seaweed.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_MUSTACHE, "particles/ZombieMustache.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_SUNGLASS, "particles/ZombieFutureGlasses.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_PINATA, "particles/Pinata.xml" }, + { ParticleEffect::PARTICLE_DUST_SQUASH, "particles/Dust_Squash.xml" }, + { ParticleEffect::PARTICLE_DUST_FOOT, "particles/Dust_Foot.xml" }, + { ParticleEffect::PARTICLE_ZOMBIE_DAISIES, "particles/Daisy.xml" }, + { ParticleEffect::PARTICLE_CREDIT_STROBE, "particles/Credits_Strobe.xml" }, + { ParticleEffect::PARTICLE_CREDITS_RAYSWIPE, "particles/Credits_RaysWipe.xml" }, + { ParticleEffect::PARTICLE_CREDITS_ZOMBIEHEADWIPE, "particles/Credits_ZombieHeadWipe.xml" }, + { ParticleEffect::PARTICLE_STARBURST, "particles/Starburst.xml" }, + { ParticleEffect::PARTICLE_CREDITS_FOG, "particles/Credits_fog.xml" }, + { ParticleEffect::PARTICLE_PERSENT_PICK_UP_ARROW, "particles/UpsellArrow.xml" }, }; -bool TodParticleLoadADef(TodParticleDefinition *theParticleDef, const char *theParticleFileName) +bool TodParticleLoadADef(TodParticleDefinition *theParticleDef, const char *theParticleFileName, bool recompile) { TodHesitationBracket("Load Particle %s", theParticleFileName); - if (!DefinitionLoadXML(theParticleFileName, &gParticleDefMap, theParticleDef)) + if (!DefinitionLoadXML(theParticleFileName, &gParticleDefMap, theParticleDef, recompile)) { - char aBuf[512]; - sprintf(aBuf, "Failed to load particle '%s'", theParticleFileName); - TodErrorMessageBox(aBuf, "Error"); + + auto aMessage = std::format("Failed to load particle '{}'", theParticleFileName); + TodErrorMessageBox(aMessage.c_str(), "Error"); return false; } - else + for (int i = 0; i < theParticleDef->mEmitterDefCount; i++) { - for (int i = 0; i < theParticleDef->mEmitterDefCount; i++) - { - TodEmitterDefinition &aDef = theParticleDef->mEmitterDefs[i]; - FloatTrackSetDefault(aDef.mSystemDuration, 0.0f); - FloatTrackSetDefault(aDef.mSpawnRate, 0.0f); - FloatTrackSetDefault(aDef.mSpawnMinActive, -1.0f); - FloatTrackSetDefault(aDef.mSpawnMaxActive, -1.0f); - FloatTrackSetDefault(aDef.mSpawnMaxLaunched, -1.0f); - FloatTrackSetDefault(aDef.mEmitterRadius, 0.0f); - FloatTrackSetDefault(aDef.mEmitterOffsetX, 0.0f); - FloatTrackSetDefault(aDef.mEmitterOffsetY, 0.0f); - FloatTrackSetDefault(aDef.mEmitterBoxX, 0.0f); - FloatTrackSetDefault(aDef.mEmitterBoxY, 0.0f); - FloatTrackSetDefault(aDef.mEmitterSkewX, 0.0f); - FloatTrackSetDefault(aDef.mEmitterSkewY, 0.0f); - FloatTrackSetDefault(aDef.mParticleDuration, 100.0f); - FloatTrackSetDefault(aDef.mLaunchSpeed, 0.0f); - FloatTrackSetDefault(aDef.mSystemRed, 1.0f); - FloatTrackSetDefault(aDef.mSystemGreen, 1.0f); - FloatTrackSetDefault(aDef.mSystemBlue, 1.0f); - FloatTrackSetDefault(aDef.mSystemAlpha, 1.0f); - FloatTrackSetDefault(aDef.mSystemBrightness, 1.0f); - FloatTrackSetDefault(aDef.mLaunchAngle, 0.0f); - FloatTrackSetDefault(aDef.mCrossFadeDuration, 0.0f); - FloatTrackSetDefault(aDef.mParticleRed, 1.0f); - FloatTrackSetDefault(aDef.mParticleGreen, 1.0f); - FloatTrackSetDefault(aDef.mParticleBlue, 1.0f); - FloatTrackSetDefault(aDef.mParticleAlpha, 1.0f); - FloatTrackSetDefault(aDef.mParticleBrightness, 1.0f); - FloatTrackSetDefault(aDef.mParticleSpinAngle, 0.0f); - FloatTrackSetDefault(aDef.mParticleSpinSpeed, 0.0f); - FloatTrackSetDefault(aDef.mParticleScale, 1.0f); - FloatTrackSetDefault(aDef.mParticleStretch, 1.0f); - FloatTrackSetDefault(aDef.mCollisionReflect, 0.0f); - FloatTrackSetDefault(aDef.mCollisionSpin, 0.0f); - FloatTrackSetDefault(aDef.mClipTop, 0.0f); - FloatTrackSetDefault(aDef.mClipBottom, 0.0f); - FloatTrackSetDefault(aDef.mClipLeft, 0.0f); - FloatTrackSetDefault(aDef.mClipRight, 0.0f); - FloatTrackSetDefault(aDef.mAnimationRate, 0.0f); - if (aDef.mImage) - ((MemoryImage *)aDef.mImage)->mGPUFlags |= ImageFlags::ImageFlag_MinimizeNumSubdivisions; - } - return true; + TodEmitterDefinition &aDef = theParticleDef->mEmitterDefs[i]; + FloatTrackSetDefault(aDef.mSystemDuration, 0.0f); + FloatTrackSetDefault(aDef.mSpawnRate, 0.0f); + FloatTrackSetDefault(aDef.mSpawnMinActive, -1.0f); + FloatTrackSetDefault(aDef.mSpawnMaxActive, -1.0f); + FloatTrackSetDefault(aDef.mSpawnMaxLaunched, -1.0f); + FloatTrackSetDefault(aDef.mEmitterRadius, 0.0f); + FloatTrackSetDefault(aDef.mEmitterOffsetX, 0.0f); + FloatTrackSetDefault(aDef.mEmitterOffsetY, 0.0f); + FloatTrackSetDefault(aDef.mEmitterBoxX, 0.0f); + FloatTrackSetDefault(aDef.mEmitterBoxY, 0.0f); + FloatTrackSetDefault(aDef.mEmitterSkewX, 0.0f); + FloatTrackSetDefault(aDef.mEmitterSkewY, 0.0f); + FloatTrackSetDefault(aDef.mParticleDuration, 100.0f); + FloatTrackSetDefault(aDef.mLaunchSpeed, 0.0f); + FloatTrackSetDefault(aDef.mSystemRed, 1.0f); + FloatTrackSetDefault(aDef.mSystemGreen, 1.0f); + FloatTrackSetDefault(aDef.mSystemBlue, 1.0f); + FloatTrackSetDefault(aDef.mSystemAlpha, 1.0f); + FloatTrackSetDefault(aDef.mSystemBrightness, 1.0f); + FloatTrackSetDefault(aDef.mLaunchAngle, 0.0f); + FloatTrackSetDefault(aDef.mCrossFadeDuration, 0.0f); + FloatTrackSetDefault(aDef.mParticleRed, 1.0f); + FloatTrackSetDefault(aDef.mParticleGreen, 1.0f); + FloatTrackSetDefault(aDef.mParticleBlue, 1.0f); + FloatTrackSetDefault(aDef.mParticleAlpha, 1.0f); + FloatTrackSetDefault(aDef.mParticleBrightness, 1.0f); + FloatTrackSetDefault(aDef.mParticleSpinAngle, 0.0f); + FloatTrackSetDefault(aDef.mParticleSpinSpeed, 0.0f); + FloatTrackSetDefault(aDef.mParticleScale, 1.0f); + FloatTrackSetDefault(aDef.mParticleStretch, 1.0f); + FloatTrackSetDefault(aDef.mCollisionReflect, 0.0f); + FloatTrackSetDefault(aDef.mCollisionSpin, 0.0f); + FloatTrackSetDefault(aDef.mClipTop, 0.0f); + FloatTrackSetDefault(aDef.mClipBottom, 0.0f); + FloatTrackSetDefault(aDef.mClipLeft, 0.0f); + FloatTrackSetDefault(aDef.mClipRight, 0.0f); + FloatTrackSetDefault(aDef.mAnimationRate, 0.0f); + if (aDef.mImage) + ((MemoryImage *)aDef.mImage)->mGPUFlags |= ImageFlags::ImageFlag_MinimizeNumSubdivisions; } + return true; } -void TodParticleLoadDefinitions(ParticleParams *theParticleParamArray, int theParticleParamArraySize) +void TodParticleLoadDefinitions(ParticleParams *theParticleParamArray, int theParticleParamArraySize, bool recompile) { TodHesitationBracket aHesitiation("TodParticleLoadDefinitions"); TOD_ASSERT(!gParticleParamArray && !gParticleDefArray); @@ -192,7 +190,7 @@ void TodParticleLoadDefinitions(ParticleParams *theParticleParamArray, int thePa { ParticleParams &aParticleParams = gParticleParamArray[i]; TOD_ASSERT(aParticleParams.mParticleEffect == i); - if (!TodParticleLoadADef(&gParticleDefArray[i], aParticleParams.mParticleFileName)) + if (!TodParticleLoadADef(&gParticleDefArray[i], aParticleParams.mParticleFileName, recompile)) { char aBuf[512]; sprintf(aBuf, "Failed to load particle '%s'", aParticleParams.mParticleFileName); @@ -231,7 +229,7 @@ TodParticleSystem::~TodParticleSystem() } void TodParticleSystem::TodParticleInitializeFromDef( - float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theEffectType) + float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theEffectType) { TOD_ASSERT(mParticleHolder); mEmitterList.SetAllocator(&mParticleHolder->mEmitterListNodeAllocator); @@ -245,7 +243,7 @@ void TodParticleSystem::TodParticleInitializeFromDef( if (!FloatTrackIsSet(aDef.mCrossFadeDuration)) { if (TestBit(aDef.mParticleFlags, (int)ParticleFlags::PARTICLE_DIE_IF_OVERLOADED) && - mParticleHolder->IsOverLoaded()) + mParticleHolder->IsOverLoaded()) { ParticleSystemDie(); break; @@ -258,9 +256,9 @@ void TodParticleSystem::TodParticleInitializeFromDef( } void TodParticleEmitter::TodEmitterInitialize(float theX, - float theY, - TodParticleSystem *theSystem, - TodEmitterDefinition *theEmitterDef) + float theY, + TodParticleSystem *theSystem, + TodEmitterDefinition *theEmitterDef) { mSpawnAccum = 0.0f; mParticlesSpawned = 0; @@ -333,7 +331,7 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) float aEmitterOffsetXInterp = Sexy::Rand(1.0f); float aEmitterOffsetYInterp = Sexy::Rand(1.0f); aParticle->mParticleDuration = - FloatTrackEvaluate(mEmitterDef->mParticleDuration, mSystemTimeValue, aParticleDurationInterp); + FloatTrackEvaluate(mEmitterDef->mParticleDuration, mSystemTimeValue, aParticleDurationInterp); aParticle->mParticleDuration = std::max(1, aParticle->mParticleDuration); aParticle->mParticleAge = 0; aParticle->mParticleEmitter = this; @@ -348,14 +346,14 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) if (mEmitterDef->mEmitterType == EmitterType::EMITTER_CIRCLE_PATH) { aLaunchAngle = FloatTrackEvaluate(mEmitterDef->mEmitterPath, - mSystemTimeValue, - mTrackInterp[ParticleSystemTracks::TRACK_EMITTER_PATH]) * - 2 * PI; + mSystemTimeValue, + mTrackInterp[ParticleSystemTracks::TRACK_EMITTER_PATH]) * + 2 * PI; aLaunchAngle += DEG_TO_RAD(FloatTrackEvaluate(mEmitterDef->mLaunchAngle, mSystemTimeValue, aLaunchAngleInterp)); } else if (mEmitterDef->mEmitterType == EmitterType::EMITTER_CIRCLE_EVEN_SPACING) aLaunchAngle = 2 * PI * theIndex / theSpawnCount + - DEG_TO_RAD(FloatTrackEvaluate(mEmitterDef->mLaunchAngle, mSystemTimeValue, aLaunchAngleInterp)); + DEG_TO_RAD(FloatTrackEvaluate(mEmitterDef->mLaunchAngle, mSystemTimeValue, aLaunchAngleInterp)); else if (FloatTrackIsConstantZero(mEmitterDef->mLaunchAngle)) aLaunchAngle = Sexy::Rand((float)(2 * PI)); else @@ -382,7 +380,7 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) } case EmitterType::EMITTER_BOX_PATH: { float aEmitterPathPosition = FloatTrackEvaluate( - mEmitterDef->mEmitterPath, mSystemTimeValue, mTrackInterp[ParticleSystemTracks::TRACK_EMITTER_PATH]); + mEmitterDef->mEmitterPath, mSystemTimeValue, mTrackInterp[ParticleSystemTracks::TRACK_EMITTER_PATH]); float aMinX = FloatTrackEvaluate(mEmitterDef->mEmitterBoxX, mSystemTimeValue, 0.0f); float aMaxX = FloatTrackEvaluate(mEmitterDef->mEmitterBoxX, mSystemTimeValue, 1.0f); float aMinY = FloatTrackEvaluate(mEmitterDef->mEmitterBoxY, mSystemTimeValue, 0.0f); @@ -390,18 +388,18 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) float aDistanceX = aMaxX - aMinX; float aDistanceY = aMaxY - aMinY; float aPathPos = - aEmitterPathPosition * (aDistanceY + aDistanceX + aDistanceY + aDistanceX); + aEmitterPathPosition * (aDistanceY + aDistanceX + aDistanceY + aDistanceX); if (aPathPos < aDistanceY) { aPosX = aMinX; aPosY = aMinY + aPathPos; } - else if (aPathPos < aDistanceY + aDistanceX) + else if (aPathPos < aDistanceY + aDistanceX) { aPosX = aMinX + (aPathPos - aDistanceY); aPosY = aMaxY; } - else if (aPathPos < aDistanceY + aDistanceX + aDistanceY) + else if (aPathPos < aDistanceY + aDistanceX + aDistanceY) { aPosX = aMaxX; aPosY = aMaxY - (aPathPos - aDistanceY - aDistanceX); @@ -426,16 +424,16 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) aParticle->mVelocity.x = sin(aLaunchAngle) * aLaunchSpeed; aParticle->mVelocity.y = cos(aLaunchAngle) * aLaunchSpeed; aParticle->mPosition.x += FloatTrackEvaluate( - mEmitterDef->mEmitterOffsetX, mSystemTimeValue, aEmitterOffsetXInterp); + mEmitterDef->mEmitterOffsetX, mSystemTimeValue, aEmitterOffsetXInterp); aParticle->mPosition.y += FloatTrackEvaluate( - mEmitterDef->mEmitterOffsetY, mSystemTimeValue, aEmitterOffsetYInterp); + mEmitterDef->mEmitterOffsetY, mSystemTimeValue, aEmitterOffsetYInterp); aParticle->mAnimationTimeValue = 0.0f; if (mEmitterDef->mAnimated || FloatTrackIsSet(mEmitterDef->mAnimationRate)) aParticle->mImageFrame = 0; else aParticle->mImageFrame = - Sexy::Rand(mEmitterDef->mImageFrames); + Sexy::Rand(mEmitterDef->mImageFrames); if (TestBit(mEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_RANDOM_LAUNCH_SPIN)) aParticle->mSpinPosition = Sexy::Rand((float)(2 * PI)); @@ -455,17 +453,17 @@ TodParticle *TodParticleEmitter::SpawnParticle(int theIndex, int theSpawnCount) } float TodParticleEmitter::ParticleTrackEvaluate(FloatParameterTrack &theTrack, - TodParticle *theParticle, - ParticleTracks theParticleTrack) + TodParticle *theParticle, + ParticleTracks theParticleTrack) { return FloatTrackEvaluate( - theTrack, theParticle->mParticleTimeValue, theParticle->mParticleInterp[(int)theParticleTrack]); + theTrack, theParticle->mParticleTimeValue, theParticle->mParticleInterp[(int)theParticleTrack]); } void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, - ParticleField *theParticleField, - float theParticleTimeValue, - int theFieldIndex) + ParticleField *theParticleField, + float theParticleTimeValue, + int theFieldIndex) { TOD_ASSERT(theFieldIndex < MAX_PARTICLE_FIELDS); float aInterpX = theParticle->mParticleFieldInterp[theFieldIndex][0]; @@ -481,15 +479,14 @@ void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, theParticle->mVelocity.x *= 1 - x; theParticle->mVelocity.y *= 1 - y; break; - case ParticleFieldType::FIELD_ACCELERATION: + case ParticleFieldType::FIELD_ACCELERATION: theParticle->mVelocity.x += 0.01f * x; theParticle->mVelocity.y += 0.01f * y; break; - case ParticleFieldType::FIELD_ATTRACTOR: - { + case ParticleFieldType::FIELD_ATTRACTOR: { float aDiffX = x - (theParticle->mPosition.x - mSystemCenter.x); float aDiffY = y - (theParticle->mPosition.y - mSystemCenter.y); - + theParticle->mVelocity.x += 0.01f * aDiffX; theParticle->mVelocity.y += 0.01f * aDiffY; break; @@ -502,12 +499,11 @@ void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, theParticle->mPosition.x += 0.01 * x; theParticle->mPosition.y += 0.01 * y; break; - case ParticleFieldType::FIELD_POSITION: - { + case ParticleFieldType::FIELD_POSITION: { float aLastX = - FloatTrackEvaluateFromLastTime(theParticleField->mX, theParticle->mParticleLastTimeValue, aInterpX); + FloatTrackEvaluateFromLastTime(theParticleField->mX, theParticle->mParticleLastTimeValue, aInterpX); float aLastY = - FloatTrackEvaluateFromLastTime(theParticleField->mY, theParticle->mParticleLastTimeValue, aInterpY); + FloatTrackEvaluateFromLastTime(theParticleField->mY, theParticle->mParticleLastTimeValue, aInterpY); theParticle->mPosition.x += x - aLastX; theParticle->mPosition.y += y - aLastY; break; @@ -517,25 +513,24 @@ void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, { theParticle->mPosition.y = mSystemCenter.y + y; float aCollisionReflect = - FloatTrackEvaluate(mEmitterDef->mCollisionReflect, - theParticleTimeValue, - theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_COLLISION_REFLECT]); + FloatTrackEvaluate(mEmitterDef->mCollisionReflect, + theParticleTimeValue, + theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_COLLISION_REFLECT]); float aCollisionSpin = - FloatTrackEvaluate(mEmitterDef->mCollisionSpin, - theParticleTimeValue, - theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_COLLISION_SPIN]) / - 1000.0f; + FloatTrackEvaluate(mEmitterDef->mCollisionSpin, + theParticleTimeValue, + theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_COLLISION_SPIN]) / + 1000.0f; theParticle->mSpinVelocity = theParticle->mVelocity.y * aCollisionSpin; theParticle->mVelocity.x *= aCollisionReflect; theParticle->mVelocity.y *= -aCollisionReflect; } break; - case ParticleFieldType::FIELD_SHAKE: - { + case ParticleFieldType::FIELD_SHAKE: { float aLastX = - FloatTrackEvaluateFromLastTime(theParticleField->mX, theParticle->mParticleLastTimeValue, aInterpX); + FloatTrackEvaluateFromLastTime(theParticleField->mX, theParticle->mParticleLastTimeValue, aInterpX); float aLastY = - FloatTrackEvaluateFromLastTime(theParticleField->mY, theParticle->mParticleLastTimeValue, aInterpY); + FloatTrackEvaluateFromLastTime(theParticleField->mY, theParticle->mParticleLastTimeValue, aInterpY); int aLastRandSeed = theParticle->mParticleAge - 1; if (aLastRandSeed == -1) aLastRandSeed = theParticle->mParticleDuration - 1; @@ -547,8 +542,7 @@ void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, theParticle->mPosition.y += y * ((float)rand() / RAND_MAX * 2.0f - 1.0f); break; } - case ParticleFieldType::FIELD_CIRCLE: - { + case ParticleFieldType::FIELD_CIRCLE: { SexyVector2 aToCenter = theParticle->mPosition - mSystemCenter; SexyVector2 aMotion = aToCenter.Perp().Normalize(); float aRadius = aToCenter.Magnitude(); @@ -556,8 +550,7 @@ void TodParticleEmitter::UpdateParticleField(TodParticle *theParticle, theParticle->mPosition += aMotion; break; } - case ParticleFieldType::FIELD_AWAY: - { + case ParticleFieldType::FIELD_AWAY: { SexyVector2 aToCenter = theParticle->mPosition - mSystemCenter; SexyVector2 aMotion = aToCenter.Normalize(); float aRadius = aToCenter.Magnitude(); @@ -577,8 +570,8 @@ float TodParticleEmitter::SystemTrackEvaluate(FloatParameterTrack &theTrack, Par } void TodParticleEmitter::UpdateSystemField(ParticleField *theParticleField, - float theParticleTimeValue, - int theFieldIndex) + float theParticleTimeValue, + int theFieldIndex) { TOD_ASSERT(theFieldIndex < MAX_PARTICLE_FIELDS); float aInterpX = mSystemFieldInterp[theFieldIndex][0]; @@ -618,7 +611,7 @@ bool TodParticleEmitter::CrossFadeParticleToName(TodParticle *theParticle, const TodParticleEmitter *aEmitter = mParticleSystem->mParticleHolder->mEmitters.DataArrayAlloc(); aEmitter->TodEmitterInitialize(mSystemCenter.x, mSystemCenter.y, mParticleSystem, aDef); ParticleEmitterID aEmitterID = - (ParticleEmitterID)mParticleSystem->mParticleHolder->mEmitters.DataArrayGetID(aEmitter); + (ParticleEmitterID)mParticleSystem->mParticleHolder->mEmitters.DataArrayGetID(aEmitter); mParticleSystem->mEmitterList.AddTail(aEmitterID); return CrossFadeParticle(theParticle, aEmitter); } @@ -632,11 +625,11 @@ bool TodParticleEmitter::UpdateParticle(TodParticle *theParticle) else if (theParticle->mCrossFadeDuration > 0) theParticle->mParticleAge = theParticle->mParticleDuration - 1; else if (*mEmitterDef->mOnDuration == '\0' || - !CrossFadeParticleToName(theParticle, mEmitterDef->mOnDuration)) + !CrossFadeParticleToName(theParticle, mEmitterDef->mOnDuration)) return false; } if (theParticle->mCrossFadeParticleID != ParticleID::PARTICLEID_NULL && - mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet(theParticle->mCrossFadeParticleID) == nullptr) + mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet(theParticle->mCrossFadeParticleID) == nullptr) return false; theParticle->mParticleTimeValue = theParticle->mParticleAge / ((float)theParticle->mParticleDuration - 1); @@ -644,22 +637,22 @@ bool TodParticleEmitter::UpdateParticle(TodParticle *theParticle) UpdateParticleField(theParticle, &mEmitterDef->mParticleFields[i], theParticle->mParticleTimeValue, i); theParticle->mPosition += theParticle->mVelocity; float aSpinSpeed = - ParticleTrackEvaluate(mEmitterDef->mParticleSpinSpeed, theParticle, ParticleTracks::TRACK_PARTICLE_SPIN_SPEED) * - 0.01; + ParticleTrackEvaluate(mEmitterDef->mParticleSpinSpeed, theParticle, ParticleTracks::TRACK_PARTICLE_SPIN_SPEED) * + 0.01; float aSpinAngle = - ParticleTrackEvaluate(mEmitterDef->mParticleSpinAngle, theParticle, ParticleTracks::TRACK_PARTICLE_SPIN_ANGLE); + ParticleTrackEvaluate(mEmitterDef->mParticleSpinAngle, theParticle, ParticleTracks::TRACK_PARTICLE_SPIN_ANGLE); float aLastSpinAngle = - FloatTrackEvaluateFromLastTime(mEmitterDef->mParticleSpinAngle, - theParticle->mParticleLastTimeValue, - theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_SPIN_ANGLE]); + FloatTrackEvaluateFromLastTime(mEmitterDef->mParticleSpinAngle, + theParticle->mParticleLastTimeValue, + theParticle->mParticleInterp[ParticleTracks::TRACK_PARTICLE_SPIN_ANGLE]); theParticle->mSpinPosition += - DEG_TO_RAD(aSpinSpeed + aSpinAngle - aLastSpinAngle) + theParticle->mSpinVelocity; + DEG_TO_RAD(aSpinSpeed + aSpinAngle - aLastSpinAngle) + theParticle->mSpinVelocity; if (FloatTrackIsSet(mEmitterDef->mAnimationRate)) { float aAnimTime = ParticleTrackEvaluate( - mEmitterDef->mAnimationRate, theParticle, ParticleTracks::TRACK_PARTICLE_ANIMATION_RATE) * - 0.01; + mEmitterDef->mAnimationRate, theParticle, ParticleTracks::TRACK_PARTICLE_ANIMATION_RATE) * + 0.01; theParticle->mAnimationTimeValue += aAnimTime; while (theParticle->mAnimationTimeValue >= 1.0f) theParticle->mAnimationTimeValue -= 1.0f; @@ -675,25 +668,25 @@ bool TodParticleEmitter::UpdateParticle(TodParticle *theParticle) void TodParticleEmitter::UpdateSpawning() { TodParticleEmitter *aCrossFadeEmitter = - mParticleSystem->mParticleHolder->mEmitters.DataArrayTryToGet((unsigned int)mCrossFadeEmitterID); + mParticleSystem->mParticleHolder->mEmitters.DataArrayTryToGet((unsigned int)mCrossFadeEmitterID); TodParticleEmitter *aSpawningEmitter = - !aCrossFadeEmitter ? this : aCrossFadeEmitter; + !aCrossFadeEmitter ? this : aCrossFadeEmitter; mSpawnAccum += aSpawningEmitter->SystemTrackEvaluate(aSpawningEmitter->mEmitterDef->mSpawnRate, ParticleSystemTracks::TRACK_SPAWN_RATE) * 0.01; int aSpawnCount = (int)mSpawnAccum; mSpawnAccum -= aSpawnCount; int aSpawnMinActive = (int)aSpawningEmitter->SystemTrackEvaluate(aSpawningEmitter->mEmitterDef->mSpawnMinActive, - ParticleSystemTracks::TRACK_SPAWN_MIN_ACTIVE); + ParticleSystemTracks::TRACK_SPAWN_MIN_ACTIVE); if (aSpawnMinActive >= 0 && aSpawnCount < aSpawnMinActive - mParticleList.mSize) aSpawnCount = aSpawnMinActive - mParticleList.mSize; int aSpawnMaxActive = (int)aSpawningEmitter->SystemTrackEvaluate(aSpawningEmitter->mEmitterDef->mSpawnMaxActive, - ParticleSystemTracks::TRACK_SPAWN_MAX_ACTIVE); + ParticleSystemTracks::TRACK_SPAWN_MAX_ACTIVE); if (aSpawnMaxActive >= 0 && aSpawnCount > aSpawnMaxActive - mParticleList.mSize) aSpawnCount = aSpawnMaxActive - mParticleList.mSize; if (FloatTrackIsSet(aSpawningEmitter->mEmitterDef->mSpawnMaxLaunched)) { int aSpawnMaxLaunched = aSpawningEmitter->SystemTrackEvaluate(aSpawningEmitter->mEmitterDef->mSpawnMaxLaunched, - ParticleSystemTracks::TRACK_SPAWN_MAX_LAUNCHED); + ParticleSystemTracks::TRACK_SPAWN_MAX_LAUNCHED); if (aSpawnCount > aSpawnMaxLaunched - mParticlesSpawned) aSpawnCount = aSpawnMaxLaunched - mParticlesSpawned; } @@ -736,7 +729,7 @@ void TodParticleSystem::Update() TodParticleEmitter *aEmitter = mParticleHolder->mEmitters.DataArrayGet((unsigned int)aNode->mValue); aEmitter->Update(); if ((FloatTrackIsSet(aEmitter->mEmitterDef->mCrossFadeDuration) && aEmitter->mParticleList.mSize > 0) || - !aEmitter->mDead) + !aEmitter->mDead) aEmitterAlive = true; } if (!aEmitterAlive) @@ -761,14 +754,14 @@ bool TodParticleEmitter::CrossFadeParticle(TodParticle *theParticle, TodParticle TodParticle *aToParticle = theToEmitter->SpawnParticle(0, 1); if (aToParticle == nullptr) return false; - if (mEmitterCrossFadeCountDown > 0) + if (mEmitterCrossFadeCountDown > 0) theParticle->mCrossFadeDuration = - mEmitterCrossFadeCountDown; + mEmitterCrossFadeCountDown; else { float aCrossFadeDurationInterp = Sexy::Rand(1); int aCrossFadeDuration = FloatTrackEvaluate( - theToEmitter->mEmitterDef->mCrossFadeDuration, mSystemTimeValue, aCrossFadeDurationInterp); + theToEmitter->mEmitterDef->mCrossFadeDuration, mSystemTimeValue, aCrossFadeDurationInterp); theParticle->mCrossFadeDuration = std::max(1, aCrossFadeDuration); } if (!FloatTrackIsSet(theToEmitter->mEmitterDef->mParticleDuration)) @@ -780,7 +773,7 @@ bool TodParticleEmitter::CrossFadeParticle(TodParticle *theParticle, TodParticle void TodParticleEmitter::DeleteParticle(TodParticle *theParticle) { TodParticle *aCrossFadeParticle = - mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet((unsigned int)theParticle->mCrossFadeParticleID); + mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet((unsigned int)theParticle->mCrossFadeParticleID); if (aCrossFadeParticle != nullptr) { aCrossFadeParticle->mParticleEmitter->DeleteParticle(aCrossFadeParticle); @@ -819,7 +812,7 @@ void TodParticleEmitter::Update() if (mCrossFadeEmitterID != ParticleEmitterID::PARTICLEEMITTERID_NULL) { TodParticleEmitter *aCrossFadeEmitter = - mParticleSystem->mParticleHolder->mEmitters.DataArrayTryToGet(mCrossFadeEmitterID); + mParticleSystem->mParticleHolder->mEmitters.DataArrayTryToGet(mCrossFadeEmitterID); if (aCrossFadeEmitter == nullptr || aCrossFadeEmitter->mDead) aDie = true; } @@ -899,17 +892,17 @@ bool TodParticleEmitter::GetRenderParams(TodParticle *theParticle, ParticleRende float aSystemBlue = aEmitter->SystemTrackEvaluate(aDef->mSystemBlue, ParticleSystemTracks::TRACK_SYSTEM_BLUE); float aSystemAlpha = aEmitter->SystemTrackEvaluate(aDef->mSystemAlpha, ParticleSystemTracks::TRACK_SYSTEM_ALPHA); float aSystemBrightness = - aEmitter->SystemTrackEvaluate(aDef->mSystemBrightness, ParticleSystemTracks::TRACK_SYSTEM_BRIGHTNESS); + aEmitter->SystemTrackEvaluate(aDef->mSystemBrightness, ParticleSystemTracks::TRACK_SYSTEM_BRIGHTNESS); float aParticleRed = - aEmitter->ParticleTrackEvaluate(aDef->mParticleRed, theParticle, ParticleTracks::TRACK_PARTICLE_RED); + aEmitter->ParticleTrackEvaluate(aDef->mParticleRed, theParticle, ParticleTracks::TRACK_PARTICLE_RED); float aParticleGreen = - aEmitter->ParticleTrackEvaluate(aDef->mParticleGreen, theParticle, ParticleTracks::TRACK_PARTICLE_GREEN); + aEmitter->ParticleTrackEvaluate(aDef->mParticleGreen, theParticle, ParticleTracks::TRACK_PARTICLE_GREEN); float aParticleBlue = - aEmitter->ParticleTrackEvaluate(aDef->mParticleBlue, theParticle, ParticleTracks::TRACK_PARTICLE_BLUE); + aEmitter->ParticleTrackEvaluate(aDef->mParticleBlue, theParticle, ParticleTracks::TRACK_PARTICLE_BLUE); float aParticleAlpha = - aEmitter->ParticleTrackEvaluate(aDef->mParticleAlpha, theParticle, ParticleTracks::TRACK_PARTICLE_ALPHA); + aEmitter->ParticleTrackEvaluate(aDef->mParticleAlpha, theParticle, ParticleTracks::TRACK_PARTICLE_ALPHA); float aParticleBrightness = aEmitter->ParticleTrackEvaluate( - aDef->mParticleBrightness, theParticle, ParticleTracks::TRACK_PARTICLE_BRIGHTNESS); + aDef->mParticleBrightness, theParticle, ParticleTracks::TRACK_PARTICLE_BRIGHTNESS); float aBrightness = aParticleBrightness * aSystemBrightness; theParams->mRed = aParticleRed * aSystemRed * aEmitter->mColorOverride.mRed * aBrightness; theParams->mGreen = aParticleGreen * aSystemGreen * aEmitter->mColorOverride.mGreen * aBrightness; @@ -918,14 +911,14 @@ bool TodParticleEmitter::GetRenderParams(TodParticle *theParticle, ParticleRende theParams->mPosX = theParticle->mPosition.x; theParams->mPosY = theParticle->mPosition.y; float aParticleScale = - aEmitter->ParticleTrackEvaluate(aDef->mParticleScale, theParticle, ParticleTracks::TRACK_PARTICLE_SCALE); + aEmitter->ParticleTrackEvaluate(aDef->mParticleScale, theParticle, ParticleTracks::TRACK_PARTICLE_SCALE); theParams->mParticleStretch = - aEmitter->ParticleTrackEvaluate(aDef->mParticleStretch, theParticle, ParticleTracks::TRACK_PARTICLE_STRETCH); + aEmitter->ParticleTrackEvaluate(aDef->mParticleStretch, theParticle, ParticleTracks::TRACK_PARTICLE_STRETCH); theParams->mParticleScale = aParticleScale * aEmitter->mScaleOverride; theParams->mSpinPosition = theParticle->mSpinPosition; TodParticle *aCrossFadeParticle = aEmitter->mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet( - (unsigned int)theParticle->mCrossFadeParticleID); + (unsigned int)theParticle->mCrossFadeParticleID); if (aCrossFadeParticle != nullptr) { ParticleRenderParams aCrossFadeParams; @@ -933,47 +926,47 @@ bool TodParticleEmitter::GetRenderParams(TodParticle *theParticle, ParticleRende { float aFraction = theParticle->mParticleAge / (float)(aCrossFadeParticle->mCrossFadeDuration - 1); theParams->mRed = CrossFadeLerp( - aCrossFadeParams.mRed, theParams->mRed, aCrossFadeParams.mRedIsSet, theParams->mRedIsSet, aFraction); + aCrossFadeParams.mRed, theParams->mRed, aCrossFadeParams.mRedIsSet, theParams->mRedIsSet, aFraction); theParams->mGreen = CrossFadeLerp(aCrossFadeParams.mGreen, - theParams->mGreen, - aCrossFadeParams.mGreenIsSet, - theParams->mGreenIsSet, - aFraction); + theParams->mGreen, + aCrossFadeParams.mGreenIsSet, + theParams->mGreenIsSet, + aFraction); theParams->mBlue = CrossFadeLerp(aCrossFadeParams.mBlue, - theParams->mBlue, - aCrossFadeParams.mBlueIsSet, - theParams->mBlueIsSet, - aFraction); + theParams->mBlue, + aCrossFadeParams.mBlueIsSet, + theParams->mBlueIsSet, + aFraction); theParams->mAlpha = CrossFadeLerp(aCrossFadeParams.mAlpha, - theParams->mAlpha, - aCrossFadeParams.mAlphaIsSet, - theParams->mAlphaIsSet, - aFraction); + theParams->mAlpha, + aCrossFadeParams.mAlphaIsSet, + theParams->mAlphaIsSet, + aFraction); theParams->mParticleScale = CrossFadeLerp(aCrossFadeParams.mParticleScale, - theParams->mParticleScale, - aCrossFadeParams.mParticleScaleIsSet, - theParams->mParticleScaleIsSet, - aFraction); + theParams->mParticleScale, + aCrossFadeParams.mParticleScaleIsSet, + theParams->mParticleScaleIsSet, + aFraction); theParams->mParticleStretch = CrossFadeLerp(aCrossFadeParams.mParticleStretch, - theParams->mParticleStretch, - aCrossFadeParams.mParticleStretchIsSet, - theParams->mParticleStretchIsSet, - aFraction); + theParams->mParticleStretch, + aCrossFadeParams.mParticleStretchIsSet, + theParams->mParticleStretchIsSet, + aFraction); theParams->mSpinPosition = CrossFadeLerp(aCrossFadeParams.mSpinPosition, - theParams->mSpinPosition, - aCrossFadeParams.mSpinPositionIsSet, - theParams->mSpinPositionIsSet, - aFraction); + theParams->mSpinPosition, + aCrossFadeParams.mSpinPositionIsSet, + theParams->mSpinPositionIsSet, + aFraction); theParams->mPosX = CrossFadeLerp(aCrossFadeParams.mPosX, - theParams->mPosX, - aCrossFadeParams.mPositionIsSet, - theParams->mPositionIsSet, - aFraction); + theParams->mPosX, + aCrossFadeParams.mPositionIsSet, + theParams->mPositionIsSet, + aFraction); theParams->mPosY = CrossFadeLerp(aCrossFadeParams.mPosY, - theParams->mPosY, - aCrossFadeParams.mPositionIsSet, - theParams->mPositionIsSet, - aFraction); + theParams->mPosY, + aCrossFadeParams.mPositionIsSet, + theParams->mPositionIsSet, + aFraction); theParams->mRedIsSet |= aCrossFadeParams.mRedIsSet; theParams->mGreenIsSet |= aCrossFadeParams.mGreenIsSet; theParams->mBlueIsSet |= aCrossFadeParams.mBlueIsSet; @@ -988,16 +981,16 @@ bool TodParticleEmitter::GetRenderParams(TodParticle *theParticle, ParticleRende } void RenderParticle(Graphics *g, - TodParticle *theParticle, - const Color &theColor, - ParticleRenderParams *theParams, - TodTriangleGroup *theTriangleGroup) + TodParticle *theParticle, + const Color &theColor, + ParticleRenderParams *theParams, + TodTriangleGroup *theTriangleGroup) { TodParticleEmitter *aEmitter = theParticle->mParticleEmitter; TodEmitterDefinition *aEmitterDef = aEmitter->mEmitterDef; Image *aImage = aEmitter->mImageOverride != nullptr - ? aEmitter->mImageOverride - : aEmitterDef->mImage; + ? aEmitter->mImageOverride + : aEmitterDef->mImage; if (aImage == nullptr) return; @@ -1008,12 +1001,12 @@ void RenderParticle(Graphics *g, { if (FloatTrackIsSet(aEmitterDef->mAnimationRate)) aFrame = ClampInt(theParticle->mAnimationTimeValue * aEmitterDef->mImageFrames, - 0, - aEmitterDef->mImageFrames - 1); + 0, + aEmitterDef->mImageFrames - 1); else if (aEmitterDef->mAnimated) aFrame = ClampInt(theParticle->mParticleTimeValue * aEmitterDef->mImageFrames, - 0, - aEmitterDef->mImageFrames - 1); + 0, + aEmitterDef->mImageFrames - 1); else aFrame = theParticle->mImageFrame; } @@ -1022,15 +1015,15 @@ void RenderParticle(Graphics *g, aFrame = aImage->mNumCols - 1; Rect aSrcRect( - aFrame * aCelWidth, std::min(aEmitterDef->mImageRow, aImage->mNumRows - 1) * aCelHeight, aCelWidth, aCelHeight); + aFrame * aCelWidth, std::min(aEmitterDef->mImageRow, aImage->mNumRows - 1) * aCelHeight, aCelWidth, aCelHeight); float aClipTop = TodParticleEmitter::ParticleTrackEvaluate( - aEmitterDef->mClipTop, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_TOP); + aEmitterDef->mClipTop, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_TOP); float aClipBottom = TodParticleEmitter::ParticleTrackEvaluate( - aEmitterDef->mClipBottom, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_BOTTOM); + aEmitterDef->mClipBottom, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_BOTTOM); float aClipLeft = TodParticleEmitter::ParticleTrackEvaluate( - aEmitterDef->mClipLeft, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_LEFT); + aEmitterDef->mClipLeft, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_LEFT); float aClipRight = TodParticleEmitter::ParticleTrackEvaluate( - aEmitterDef->mClipRight, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_RIGHT); + aEmitterDef->mClipRight, theParticle, ParticleTracks::TRACK_PARTICLE_CLIP_RIGHT); TOD_ASSERT(aClipTop >= 0.0f && aClipTop <= 1.0f); TOD_ASSERT(aClipBottom >= 0.0f && aClipBottom <= 1.0f); TOD_ASSERT(aClipLeft >= 0.0f && aClipLeft <= 1.0f); @@ -1046,7 +1039,7 @@ void RenderParticle(Graphics *g, TOD_ASSERT(aSrcRect.mX >= 0 && aSrcRect.mX < 10000); TOD_ASSERT(aSrcRect.mY >= 0 && aSrcRect.mY < 10000); - if (TestBit(aEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_ALIGN_TO_PIXELS)) + if (TestBit(aEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_ALIGN_TO_PIXELS)) { theParams->mPosX = FloatRoundToInt(theParams->mPosX); theParams->mPosY = FloatRoundToInt(theParams->mPosY); @@ -1068,15 +1061,15 @@ void RenderParticle(Graphics *g, { SexyMatrix3 aTransform; TodScaleRotateTransformMatrix(aTransform, - theParams->mPosX, - theParams->mPosY, - theParams->mSpinPosition, - theParams->mParticleScale, - theParams->mParticleStretch * theParams->mParticleScale); + theParams->mPosX, + theParams->mPosY, + theParams->mSpinPosition, + theParams->mParticleScale, + theParams->mParticleStretch * theParams->mParticleScale); theTriangleGroup->AddTriangle(g, aImage, aTransform, g->mClipRect, theColor, aDrawMode, aSrcRect); if (aEmitter->mExtraAdditiveDrawOverride) theTriangleGroup->AddTriangle( - g, aImage, aTransform, g->mClipRect, theColor, Graphics::DRAWMODE_ADDITIVE, aSrcRect); + g, aImage, aTransform, g->mClipRect, theColor, Graphics::DRAWMODE_ADDITIVE, aSrcRect); } } @@ -1089,10 +1082,10 @@ void TodParticleEmitter::DrawParticle(Graphics *g, TodParticle *theParticle, Tod if (GetRenderParams(theParticle, &aParams)) { Color aColor(ClampInt(FloatRoundToInt(aParams.mRed), 0, 255), - ClampInt(FloatRoundToInt(aParams.mGreen), 0, 255), - ClampInt(FloatRoundToInt(aParams.mBlue), 0, 255), - ClampInt(FloatRoundToInt(aParams.mAlpha), 0, 255)); - if (aColor.mAlpha > 0) + ClampInt(FloatRoundToInt(aParams.mGreen), 0, 255), + ClampInt(FloatRoundToInt(aParams.mBlue), 0, 255), + ClampInt(FloatRoundToInt(aParams.mAlpha), 0, 255)); + if (aColor.mAlpha > 0) { aParams.mPosX += g->mTransX; aParams.mPosY += g->mTransY; @@ -1100,9 +1093,9 @@ void TodParticleEmitter::DrawParticle(Graphics *g, TodParticle *theParticle, Tod TodParticle *aParticle; if (mImageOverride || mEmitterDef->mImage) aParticle = theParticle; - else + else aParticle = mParticleSystem->mParticleHolder->mParticles.DataArrayTryToGet( - (unsigned int)theParticle->mCrossFadeParticleID); + (unsigned int)theParticle->mCrossFadeParticleID); if (aParticle != nullptr) RenderParticle(g, aParticle, aColor, &aParams, theTriangleGroup); } @@ -1119,13 +1112,13 @@ void TodParticleEmitter::Draw(Graphics *g) { bool aHardWare = gSexyAppBase->Is3DAccelerated(); if ((TestBit(mEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_SOFTWARE_ONLY) && aHardWare) || - (TestBit(mEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_HARDWARE_ONLY) && !aHardWare)) + (TestBit(mEmitterDef->mParticleFlags, (int)ParticleFlags::PARTICLE_HARDWARE_ONLY) && !aHardWare)) return; TodTriangleGroup aTriangleGroup; for (TodListNode *aNode = mParticleList.mHead; aNode != nullptr; aNode = aNode->mNext) DrawParticle( - g, mParticleSystem->mParticleHolder->mParticles.DataArrayGet((unsigned int)aNode->mValue), &aTriangleGroup); + g, mParticleSystem->mParticleHolder->mParticles.DataArrayGet((unsigned int)aNode->mValue), &aTriangleGroup); aTriangleGroup.DrawGroup(g); } @@ -1149,7 +1142,7 @@ void TodParticleEmitter::SystemMove(float theX, float theY) for (TodListNode *aNode = mParticleList.mHead; aNode != nullptr; aNode = aNode->mNext) { TodParticle *aParticle = - mParticleSystem->mParticleHolder->mParticles.DataArrayGet((unsigned int)aNode->mValue); + mParticleSystem->mParticleHolder->mParticles.DataArrayGet((unsigned int)aNode->mValue); aParticle->mPosition.x += aDeltaX; aParticle->mPosition.y += aDeltaY; } @@ -1244,7 +1237,7 @@ void TodParticleEmitter::CrossFadeEmitter(TodParticleEmitter *theToEmitter) float aCrossFadeDurationInterp = Sexy::Rand(1.0f); mEmitterCrossFadeCountDown = - FloatTrackEvaluate(theToEmitter->mEmitterDef->mCrossFadeDuration, mSystemTimeValue, aCrossFadeDurationInterp); + FloatTrackEvaluate(theToEmitter->mEmitterDef->mCrossFadeDuration, mSystemTimeValue, aCrossFadeDurationInterp); mEmitterCrossFadeCountDown = std::max(1, mEmitterCrossFadeCountDown); mCrossFadeEmitterID = (ParticleEmitterID)mParticleSystem->mParticleHolder->mEmitters.DataArrayGetID(theToEmitter); if (!FloatTrackIsSet(theToEmitter->mEmitterDef->mSystemDuration)) @@ -1252,7 +1245,7 @@ void TodParticleEmitter::CrossFadeEmitter(TodParticleEmitter *theToEmitter) for (TodListNode *aNode = mParticleList.mHead; aNode != nullptr; aNode = aNode->mNext) CrossFadeParticle(mParticleSystem->mParticleHolder->mParticles.DataArrayGet((unsigned int)aNode->mValue), - theToEmitter); + theToEmitter); } void TodParticleSystem::CrossFade(const char *theEmitterName) @@ -1282,9 +1275,9 @@ void TodParticleSystem::CrossFade(const char *theEmitterName) { TodParticleEmitter *aCrossFadeEmitter = mParticleHolder->mEmitters.DataArrayAlloc(); aCrossFadeEmitter->TodEmitterInitialize( - aEmitter->mSystemCenter.x, aEmitter->mSystemCenter.y, this, aEmitterDef); + aEmitter->mSystemCenter.x, aEmitter->mSystemCenter.y, this, aEmitterDef); ParticleEmitterID aCrossFadeEmitterID = - (ParticleEmitterID)mParticleHolder->mEmitters.DataArrayGetID(aCrossFadeEmitter); + (ParticleEmitterID)mParticleHolder->mEmitters.DataArrayGetID(aCrossFadeEmitter); mEmitterList.AddTail(aCrossFadeEmitterID); aEmitter->CrossFadeEmitter(aCrossFadeEmitter); } @@ -1317,11 +1310,11 @@ void TodParticleHolder::DisposeHolder() bool TodParticleHolder::IsOverLoaded() { return mParticleSystems.mSize > MAX_PARTICLES_SIZE || mEmitters.mSize > MAX_PARTICLES_SIZE || - mParticles.mSize > MAX_PARTICLES_SIZE; + mParticles.mSize > MAX_PARTICLES_SIZE; } TodParticleSystem *TodParticleHolder::AllocParticleSystemFromDef( - float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theParticleEffect) + float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theParticleEffect) { if (mParticleSystems.mSize == mParticleSystems.mMaxSize) { @@ -1341,11 +1334,11 @@ TodParticleSystem *TodParticleHolder::AllocParticleSystemFromDef( } TodParticleSystem *TodParticleHolder::AllocParticleSystem(float theX, - float theY, - int theRenderOrder, - ParticleEffect theParticleEffect) + float theY, + int theRenderOrder, + ParticleEffect theParticleEffect) { TOD_ASSERT((int)theParticleEffect >= 0 && (int)theParticleEffect < gParticleDefCount); return AllocParticleSystemFromDef( - theX, theY, theRenderOrder, &gParticleDefArray[(int)theParticleEffect], theParticleEffect); + theX, theY, theRenderOrder, &gParticleDefArray[(int)theParticleEffect], theParticleEffect); } diff --git a/src/Sexy.TodLib/TodParticle.h b/src/Sexy.TodLib/TodParticle.h index 6445918..2a81bbc 100644 --- a/src/Sexy.TodLib/TodParticle.h +++ b/src/Sexy.TodLib/TodParticle.h @@ -49,7 +49,7 @@ enum ParticleFieldType FIELD_CIRCLE, FIELD_AWAY, PARTICLE_FIELD_COUNT -}; +}; // ################################################################################ @@ -74,8 +74,8 @@ class FloatParameterTrackNode class FloatParameterTrack { public: - FloatParameterTrackNode *mNodes; - int mCountNodes; + FloatParameterTrackNode *mNodes{}; + int mCountNodes{}; }; class ParticleField @@ -83,7 +83,7 @@ class ParticleField public: ParticleFieldType mFieldType; FloatParameterTrack mX; - FloatParameterTrack mY; + FloatParameterTrack mY; }; class TodEmitterDefinition @@ -149,7 +149,7 @@ class TodParticleDefinition int mEmitterDefCount; }; -extern int gParticleDefCount; // [0x6A9F08] +extern int gParticleDefCount; // [0x6A9F08] extern TodParticleDefinition *gParticleDefArray; // [0x6A9F0C] class ParticleParams @@ -158,11 +158,11 @@ class ParticleParams ParticleEffect mParticleEffect; const char *mParticleFileName; }; -extern int gParticleParamArraySize; // [0x6A9F10] +extern int gParticleParamArraySize; // [0x6A9F10] extern ParticleParams *gParticleParamArray; // [0x6A9F14] -bool TodParticleLoadADef(TodParticleDefinition *theParticleDef, const char *theParticleFileName); -void TodParticleLoadDefinitions(ParticleParams *theParticleParamArray, int theParticleParamArraySize); +bool TodParticleLoadADef(TodParticleDefinition *theParticleDef, const char *theParticleFileName, bool recompile); +void TodParticleLoadDefinitions(ParticleParams *theParticleParamArray, int theParticleParamArraySize, bool recompile); void TodParticleFreeDefinitions(); extern ParticleParams gLawnParticleArray[(int)ParticleEffect::NUM_PARTICLES]; @@ -221,14 +221,14 @@ class TodParticleHolder void InitializeHolder(); void DisposeHolder(); TodParticleSystem *AllocParticleSystemFromDef(float theX, - float theY, - int theRenderOrder, - TodParticleDefinition *theDefinition, - ParticleEffect theParticleEffect); + float theY, + int theRenderOrder, + TodParticleDefinition *theDefinition, + ParticleEffect theParticleEffect); TodParticleSystem *AllocParticleSystem(float theX, - float theY, - int theRenderOrder, - ParticleEffect theParticleEffect); + float theY, + int theRenderOrder, + ParticleEffect theParticleEffect); bool IsOverLoaded(); }; @@ -301,9 +301,9 @@ class TodParticleEmitter public: void TodEmitterInitialize(float theX, - float theY, - TodParticleSystem *theSystem, - TodEmitterDefinition *theEmitterDef); + float theY, + TodParticleSystem *theSystem, + TodEmitterDefinition *theEmitterDef); void Update(); void Draw(Graphics *g); void SystemMove(float theX, float theY); @@ -317,23 +317,23 @@ class TodParticleEmitter bool CrossFadeParticleToName(TodParticle *theParticle, const char *theEmitterName); void DeleteAll(); void UpdateParticleField(TodParticle *theParticle, - ParticleField *theParticleField, - float theParticleTimeValue, - int theFieldIndex); + ParticleField *theParticleField, + float theParticleTimeValue, + int theFieldIndex); void UpdateSystemField(ParticleField *theParticleField, float theParticleTimeValue, int theFieldIndex); float SystemTrackEvaluate(FloatParameterTrack &theTrack, ParticleSystemTracks theSystemTrack); static float ParticleTrackEvaluate(FloatParameterTrack &theTrack, - TodParticle *theParticle, - ParticleTracks theParticleTrack); + TodParticle *theParticle, + ParticleTracks theParticleTrack); void DeleteParticle(TodParticle *theParticle); void DeleteNonCrossFading(); }; float CrossFadeLerp(float theFrom, float theTo, bool theFromIsSet, bool theToIsSet, float theFraction); void RenderParticle(Graphics *g, - TodParticle *theParticle, - const Color &theColor, - ParticleRenderParams *theParams, - TodTriangleGroup *theTriangleGroup); + TodParticle *theParticle, + const Color &theColor, + ParticleRenderParams *theParams, + TodTriangleGroup *theTriangleGroup); class TodParticleSystem { @@ -352,7 +352,7 @@ class TodParticleSystem ~TodParticleSystem(); void TodParticleInitializeFromDef( - float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theEffectType); + float theX, float theY, int theRenderOrder, TodParticleDefinition *theDefinition, ParticleEffect theEffectType); void ParticleSystemDie(); void Update(); void Draw(Graphics *g); diff --git a/src/Sexy.TodLib/Trail.cpp b/src/Sexy.TodLib/Trail.cpp index ef00b9c..5da7280 100644 --- a/src/Sexy.TodLib/Trail.cpp +++ b/src/Sexy.TodLib/Trail.cpp @@ -9,30 +9,18 @@ int gTrailParamArraySize; TrailParams *gTrailParamArray; TrailParams gLawnTrailArray[(int)TrailType::NUM_TRAILS] = { - {TrailType::TRAIL_ICE, "particles/IceTrail.trail"}}; - -TrailDefinition::TrailDefinition() -{ - memset(this, 0, sizeof(TrailDefinition)); - mMinPointDistance = 1.0f; - mMaxPoints = 2; - mTrailFlags = 0U; - mImage = nullptr; -} - -TrailDefinition::~TrailDefinition() -{ -} + { TrailType::TRAIL_ICE, "particles/IceTrail.trail" } +}; TrailPoint::TrailPoint() { } -bool TrailLoadADef(TrailDefinition *theTrailDef, const char *theTrailFileName) +bool TrailLoadADef(TrailDefinition *theTrailDef, const char *theTrailFileName, bool recompile) { TodHesitationBracket aHesitation("Load Trail '%s'", theTrailFileName); - if (!DefinitionLoadXML(StringToSexyString(theTrailFileName), &gTrailDefMap, theTrailDef)) + if (!DefinitionLoadXML(StringToSexyString(theTrailFileName), &gTrailDefMap, theTrailDef, recompile)) return false; FloatTrackSetDefault(theTrailDef->mWidthOverLength, 1.0f); @@ -43,7 +31,7 @@ bool TrailLoadADef(TrailDefinition *theTrailDef, const char *theTrailFileName) return true; } -void TrailLoadDefinitions(TrailParams *theTrailParamArray, int theTrailParamArraySize) +void TrailLoadDefinitions(TrailParams *theTrailParamArray, int theTrailParamArraySize, bool recompile) { TodHesitationBracket aHesitation("TrailLoadDefinitions"); TOD_ASSERT(!gTrailParamArray && !gTrailDefArray); @@ -57,7 +45,7 @@ void TrailLoadDefinitions(TrailParams *theTrailParamArray, int theTrailParamArra { TrailParams *aTrailParams = &theTrailParamArray[i]; TOD_ASSERT(aTrailParams->mTrailType == (TrailType)i); - if (!TrailLoadADef(&gTrailDefArray[i], aTrailParams->mTrailFileName)) + if (!TrailLoadADef(&gTrailDefArray[i], aTrailParams->mTrailFileName, recompile)) { char aBuf[512]; sprintf(aBuf, "Failed to load trail '%s'", aTrailParams->mTrailFileName); @@ -103,7 +91,7 @@ void Trail::AddPoint(float x, float y) float aDistance = Distance2D(x, y, aPoint.aPos.x, aPoint.aPos.y); if (aDistance < mDefinition->mMinPointDistance) { - return; + return; } } @@ -204,25 +192,25 @@ void Trail::Draw(Graphics *g) float aUCur = 1.0f - i / (float)(mNumTrailPoints - 1); float aUNext = 1.0f - (i + 1) / (float)(mNumTrailPoints - 1); float aWidthOverLengthCur = FloatTrackEvaluate( - mDefinition->mWidthOverLength, aUCur, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_LENGTH]); + mDefinition->mWidthOverLength, aUCur, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_LENGTH]); float aWidthOverLengthNext = FloatTrackEvaluate( - mDefinition->mWidthOverLength, aUNext, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_LENGTH]); + mDefinition->mWidthOverLength, aUNext, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_LENGTH]); float aWidthOverTimeCur = FloatTrackEvaluate( - mDefinition->mWidthOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_TIME]); + mDefinition->mWidthOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_TIME]); float aWidthOverTimeNext = FloatTrackEvaluate( - mDefinition->mWidthOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_TIME]); + mDefinition->mWidthOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_WIDTH_OVER_TIME]); float aAlphaOverLengthCur = FloatTrackEvaluate( - mDefinition->mAlphaOverLength, aUCur, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_LENGTH]); + mDefinition->mAlphaOverLength, aUCur, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_LENGTH]); float aAlphaOverLengthNext = FloatTrackEvaluate( - mDefinition->mAlphaOverLength, aUNext, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_LENGTH]); + mDefinition->mAlphaOverLength, aUNext, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_LENGTH]); float aAlphaOverTimeCur = FloatTrackEvaluate( - mDefinition->mAlphaOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_TIME]); + mDefinition->mAlphaOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_TIME]); float aAlphaOverTimeNext = FloatTrackEvaluate( - mDefinition->mAlphaOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_TIME]); + mDefinition->mAlphaOverTime, aTimeValue, mTrailInterp[(int)TrailTracks::TRACK_ALPHA_OVER_TIME]); int anAlphaCur = - ClampInt(FloatRoundToInt(aAlphaOverLengthCur * aAlphaOverTimeCur * mColorOverride.mAlpha), 0, 255); + ClampInt(FloatRoundToInt(aAlphaOverLengthCur * aAlphaOverTimeCur * mColorOverride.mAlpha), 0, 255); int anAlphaNext = - ClampInt(FloatRoundToInt(aAlphaOverLengthNext * aAlphaOverTimeNext * mColorOverride.mAlpha), 0, 255); + ClampInt(FloatRoundToInt(aAlphaOverLengthNext * aAlphaOverTimeNext * mColorOverride.mAlpha), 0, 255); Sexy::Color aColorCur = mColorOverride; Sexy::Color aColorNext = mColorOverride; aColorCur.mAlpha = anAlphaCur; @@ -236,9 +224,9 @@ void Trail::Draw(Graphics *g) aPosition[2].x = mTrailCenter.x + aPointNext.aPos.x + aNormalNext.x * aWidthOverLengthNext * aWidthOverTimeNext; aPosition[2].y = mTrailCenter.y + aPointNext.aPos.y + aNormalNext.y * aWidthOverLengthNext * aWidthOverTimeNext; aPosition[3].x = - mTrailCenter.x + aPointNext.aPos.x + -aNormalNext.x * aWidthOverLengthNext * aWidthOverTimeNext; + mTrailCenter.x + aPointNext.aPos.x + -aNormalNext.x * aWidthOverLengthNext * aWidthOverTimeNext; aPosition[3].y = - mTrailCenter.y + aPointNext.aPos.y + -aNormalNext.y * aWidthOverLengthNext * aWidthOverTimeNext; + mTrailCenter.y + aPointNext.aPos.y + -aNormalNext.y * aWidthOverLengthNext * aWidthOverTimeNext; int aVertCur = i * 2; int aVertNext = aVertCur + 1; diff --git a/src/Sexy.TodLib/Trail.h b/src/Sexy.TodLib/Trail.h index ebaba29..ea736dc 100644 --- a/src/Sexy.TodLib/Trail.h +++ b/src/Sexy.TodLib/Trail.h @@ -42,22 +42,18 @@ extern TrailParams gLawnTrailArray[(int)TrailType::NUM_TRAILS]; class TrailDefinition { public: - Image *mImage; - int mMaxPoints; - float mMinPointDistance; - int mTrailFlags; + Image *mImage{}; + int mMaxPoints = 2; + float mMinPointDistance = 1.0f; + int mTrailFlags = 0; FloatParameterTrack mTrailDuration; FloatParameterTrack mWidthOverLength; FloatParameterTrack mWidthOverTime; FloatParameterTrack mAlphaOverLength; FloatParameterTrack mAlphaOverTime; - - public: - TrailDefinition(); - ~TrailDefinition(); }; -bool TrailLoadADef(TrailDefinition *theTrailDef, const char *theTrailFileName); -void TrailLoadDefinitions(TrailParams *theTrailParamArray, int theTrailParamArraySize); +bool TrailLoadADef(TrailDefinition *theTrailDef, const char *theTrailFileName, bool recompile); +void TrailLoadDefinitions(TrailParams *theTrailParamArray, int theTrailParamArraySize, bool recompile); void TrailFreeDefinitions(); extern int gTrailDefCount; diff --git a/src/main.cpp b/src/main.cpp index a8d869e..d32e836 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,9 +19,13 @@ int LawnMain() gLawnApp = new LawnApp(); gLawnApp->mChangeDirTo = - (!Sexy::FileExists("properties/resources.xml") && Sexy::FileExists("../properties/resources.xml")) ? ".." : "."; + (!Sexy::FileExists("properties/resources.xml") && Sexy::FileExists("../properties/resources.xml")) ? ".." : "."; gLawnApp->Init(); + if (gLawnApp->mRunInCompileMode) + { + return 0; + } gLawnApp->Start(); gLawnApp->Shutdown();