#pragma once #include "resource.h" #include "stdafx.h" #include #pragma comment(lib, "winmm.lib") constexpr int GRID = 40; constexpr int nGameWidth = 10; constexpr int nGameHeight = 20; constexpr int nWidth = 16; constexpr int nHeight = 22; constexpr int WINDOW_PADDING = 36; constexpr int SIDE_PANEL_WIDTH = 304; constexpr int SIDE_PANEL_GAP = 24; constexpr int SIDE_PANEL_HEIGHT = 872; constexpr int WINDOW_CLIENT_WIDTH = WINDOW_PADDING * 2 + nGameWidth * GRID + SIDE_PANEL_GAP * 2 + SIDE_PANEL_WIDTH * 2; constexpr int BOARD_CLIENT_HEIGHT = WINDOW_PADDING * 2 + nGameHeight * GRID + 20; constexpr int WINDOW_CLIENT_HEIGHT = (BOARD_CLIENT_HEIGHT > SIDE_PANEL_HEIGHT) ? BOARD_CLIENT_HEIGHT : SIDE_PANEL_HEIGHT; struct Point { int x; int y; }; struct MenuState { int selectedIndex; int optionCount; }; struct HelpState { int selectedIndex; int optionCount; int currentPage; }; struct PlayerStats { int score; int level; int exp; int requiredExp; int totalLinesCleared; int scoreMultiplierPercent; int expMultiplierPercent; int slowFallStacks; int comboBonusStacks; int comboChain; int previewCount; int lastChanceCount; int scoreUpgradeLevel; int expUpgradeLevel; int previewUpgradeLevel; int lastChanceUpgradeLevel; int holdUnlocked; int pressureReliefLevel; int sweeperLevel; int sweeperCharge; int explosiveLevel; int explosivePieceCounter; int chainBlastLevel; int chainBombLevel; int laserLevel; int crossPieceLevel; int thunderTetrisLevel; int thunderLaserLevel; int feverLevel; int rageStackLevel; int infiniteFeverLevel; int feverLineCharge; int feverTicks; int screenBombLevel; int screenBombCharge; int screenBombCount; int terminalClearLevel; int dualChoiceLevel; int destinyWheelLevel; int perfectRotateLevel; int timeDilationLevel; int timeDilationTicks; int highPressureLevel; int tetrisGambleLevel; int extremePlayerLevel; int extremeSlowTicks; int extremeDangerTicks; int extremeDangerLevel; int upgradeShockwaveLevel; int evolutionImpactLevel; int controlMasterLevel; int holdSlowTicks; int blockStormLevel; int blockStormPiecesRemaining; int blackHoleLevel; int blackHoleCharges; int reshapeLevel; int reshapeCharges; int rainbowPieceLevel; int voidCoreLevel; int pendingRainbowPieceCount; int stableStructureLevel; int doubleGrowthLevel; int gamblerLevel; int difficultyElapsedMs; int difficultyLevel; int lockedRows; int pieceTuningLevels[7]; }; struct UpgradeOption { int id; int currentLevel; int targetPieceType; int rarity; bool cursed; const TCHAR* name; const TCHAR* category; const TCHAR* description; }; struct UpgradeEntry { int id; int maxLevel; int baseWeight; bool repeatable; const TCHAR* name; const TCHAR* category; const TCHAR* description; }; struct UpgradeUiState { int selectedIndex; int optionCount; int pendingCount; int totalChosenCount; int picksRemaining; int markedCount; bool marked[6]; UpgradeOption options[6]; }; struct FeedbackState { int visibleTicks; TCHAR title[64]; TCHAR detail[128]; }; struct ClearEffectState { int ticks; int totalTicks; int rowCount; int rows[8]; }; struct FloatingTextEffect { int ticks; int totalTicks; int boardX; int boardY; TCHAR text[64]; COLORREF color; }; struct ParticleEffect { int ticks; int totalTicks; int boardX; int boardY; int velocityX; int velocityY; int size; COLORREF color; }; struct CellFlashEffect { int ticks; int totalTicks; int x; int y; COLORREF color; }; struct GravityFallEffect { int ticks; int totalTicks; int x; int fromY; int toY; int cellValue; }; enum ScreenState { SCREEN_MENU = 0, SCREEN_PLAYING = 1, SCREEN_UPGRADE = 2, SCREEN_RULES = 3 }; enum GameMode { MODE_CLASSIC = 0, MODE_ROGUE = 1 }; enum UpgradeRarity { UPGRADE_RARITY_COMMON = 0, UPGRADE_RARITY_UNCOMMON = 1, UPGRADE_RARITY_RARE = 2 }; extern int nType; extern int type; extern int state; extern int tScore; extern bool gameOverFlag; extern bool suspendFlag; extern bool targetFlag; extern bool bgmEnabled; extern bool reviveAvailable; extern bool rogueDemoMode; extern int workRegion[20][10]; extern Point point; extern Point target; extern MenuState menuState; extern HelpState helpState; extern int helpScrollOffset; extern int creditPageIndex; extern int creditAnimationTicks; extern int creditAnimationDirection; extern int upgradeListScrollOffset; extern PlayerStats classicStats; extern PlayerStats rogueStats; extern UpgradeUiState upgradeUiState; extern FeedbackState feedbackState; extern ClearEffectState clearEffectState; extern FloatingTextEffect floatingTextEffects[8]; extern ParticleEffect particleEffects[96]; extern CellFlashEffect cellFlashEffects[64]; extern GravityFallEffect gravityFallEffects[80]; extern int currentScreen; extern int currentMode; extern int currentFallInterval; extern int nextTypes[3]; extern int holdType; extern bool holdUsedThisTurn; extern bool currentPieceIsExplosive; extern bool currentPieceIsLaser; extern bool currentPieceIsCross; extern bool currentPieceIsRainbow; extern int bricks[7][4][4][4]; extern COLORREF BrickColor[7]; bool CanMoveDown(); bool CanMoveLeft(); bool CanMoveRight(); void MoveDown(); void MoveLeft(); void MoveRight(); void Rotate(); void DropDown(); void Fixing(); void DeleteOneLine(int number); int DeleteLines(); void ComputeTarget(); void Restart(); void StartGameWithMode(int mode); void ReturnToMainMenu(); void ReviveAfterVideo(); void StartRogueSkillDemo(); void StartRogueSkillDemoAt(int demoIndex); void RestartCurrentRogueSkillDemo(); bool IsRogueSkillDemoMode(); bool TickRogueSkillDemo(); void AdvanceRogueSkillDemo(); int GetRogueSkillDemoCount(); const TCHAR* GetRogueSkillDemoName(int demoIndex); const TCHAR* GetRogueSkillDemoDetail(int demoIndex); const TCHAR* GetCurrentRogueSkillDemoName(); void SetFeedbackMessage(const TCHAR* title, const TCHAR* detail, int ticks); void OpenRulesScreen(); void OpenSkillDemoScreen(); void OpenCreditScreen(); void ChangeCreditPage(int direction); void OpenUpgradeMenu(); void ConfirmUpgradeSelection(); void ResetUpgradeUiState(); void HoldCurrentPiece(); void UseScreenBomb(); void UseBlackHole(); void UseAirReshape(); void ResetPendingRogueVisualEvents(); void ResetVisualEffects(); bool TickVisualEffects(); bool TickCreditAnimation(); void TriggerLineClearEffect(const int* rows, int rowCount, int linesCleared); void PlayPendingLineClearEffect(); void TriggerCellClearEffect(const Point* cells, int cellCount, bool strongBurst); void TriggerColoredCellClearEffect(const Point* cells, int cellCount, COLORREF flashColor, bool strongBurst); void TriggerGravityFallEffect(int x, int fromY, int toY, int cellValue); void AwardRogueSkillClearRewards(int clearedCells, int& scoreGain, int& expGain, bool allowLevelProgress); void CheckRogueLevelProgress(); void ApplyBoardGravity(); int GetRogueFallInterval(); int GetRoguePlayableHeight(); int GetRogueLockedRows(); void AdvanceRogueDifficulty(int elapsedMs); const TCHAR* GetUpgradeSynthesisPath(int upgradeId); void TDrawScreen(HDC hdc, HWND hWnd);