189 lines
4.0 KiB
C++
189 lines
4.0 KiB
C++
#pragma once
|
|
|
|
#include "resource.h"
|
|
#include "stdafx.h"
|
|
#include <mmsystem.h>
|
|
|
|
#pragma comment(lib, "winmm.lib")
|
|
|
|
constexpr int GRID = 30;
|
|
constexpr int nGameWidth = 10;
|
|
constexpr int nGameHeight = 20;
|
|
constexpr int nWidth = 16;
|
|
constexpr int nHeight = 22;
|
|
constexpr int WINDOW_PADDING = 28;
|
|
constexpr int SIDE_PANEL_WIDTH = 320;
|
|
constexpr int SIDE_PANEL_GAP = 28;
|
|
constexpr int SIDE_PANEL_HEIGHT = 760;
|
|
constexpr int WINDOW_CLIENT_WIDTH = WINDOW_PADDING * 2 + nGameWidth * GRID + SIDE_PANEL_GAP + SIDE_PANEL_WIDTH;
|
|
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 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 chainBlastLevel;
|
|
int chainBombLevel;
|
|
int laserLevel;
|
|
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 highPressureLevel;
|
|
int tetrisGambleLevel;
|
|
int extremePlayerLevel;
|
|
int extremeSlowTicks;
|
|
int upgradeShockwaveLevel;
|
|
int evolutionImpactLevel;
|
|
int stableStructureLevel;
|
|
int doubleGrowthLevel;
|
|
int gamblerLevel;
|
|
int pieceTuningLevels[7];
|
|
};
|
|
|
|
struct UpgradeOption
|
|
{
|
|
int id;
|
|
int currentLevel;
|
|
int targetPieceType;
|
|
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;
|
|
UpgradeOption options[5];
|
|
};
|
|
|
|
struct FeedbackState
|
|
{
|
|
int visibleTicks;
|
|
TCHAR title[64];
|
|
TCHAR detail[128];
|
|
};
|
|
|
|
enum ScreenState
|
|
{
|
|
SCREEN_MENU = 0,
|
|
SCREEN_PLAYING = 1,
|
|
SCREEN_UPGRADE = 2,
|
|
SCREEN_RULES = 3
|
|
};
|
|
|
|
enum GameMode
|
|
{
|
|
MODE_CLASSIC = 0,
|
|
MODE_ROGUE = 1
|
|
};
|
|
|
|
extern int nType;
|
|
extern int type;
|
|
extern int state;
|
|
extern int tScore;
|
|
extern bool gameOverFlag;
|
|
extern bool suspendFlag;
|
|
extern bool targetFlag;
|
|
extern int workRegion[20][10];
|
|
extern Point point;
|
|
extern Point target;
|
|
extern MenuState menuState;
|
|
extern PlayerStats classicStats;
|
|
extern PlayerStats rogueStats;
|
|
extern UpgradeUiState upgradeUiState;
|
|
extern FeedbackState feedbackState;
|
|
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 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 OpenRulesScreen();
|
|
void OpenUpgradeMenu();
|
|
void ConfirmUpgradeSelection();
|
|
void HoldCurrentPiece();
|
|
void UseScreenBomb();
|
|
int GetRogueFallInterval();
|
|
|
|
void TDrawScreen(HDC hdc, HWND hWnd);
|