124 lines
3.3 KiB
C++
124 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include "Gamemode.h"
|
|
#include "Player.h"
|
|
#include "LineClear.h"
|
|
|
|
|
|
/**
|
|
* Computes the parameters of the game depending on the current gamemode and the player's controls,
|
|
* this is basically where all the hard-coded values are stored
|
|
*/
|
|
class GameParameters {
|
|
private:
|
|
Gamemode gamemode; // the current gamemode
|
|
Player controls; // the player's controls
|
|
int clearedLines; // the number of cleared lines
|
|
int level; // the current level
|
|
int grade; // the current amount of points
|
|
int nextQueueLength; // the number of pieces visibles in the next queue
|
|
bool boneBlocks; // wheter all blocks are bone blocks
|
|
int gravity; // the gravity at which pieces drop
|
|
int lockDelay; // the time before the piece lock in place
|
|
int forcedLockDelay; // the forced time before the piece lock in place
|
|
int ARE; // the time before the next piece spawn
|
|
int lineARE; // the time before the next piece spawn, after clearing a line
|
|
int DAS; // the time before the piece repeats moving
|
|
int ARR; // the rate at which the piece repeats moving
|
|
int SDR; // the rate at which the piece soft drops
|
|
|
|
public:
|
|
/**
|
|
* Sets the current gamemode and the player's controls
|
|
*/
|
|
GameParameters(Gamemode gamemode, const Player& controls);
|
|
|
|
/**
|
|
* Resets all stats and parameters
|
|
*/
|
|
void reset();
|
|
|
|
/**
|
|
* Counts the newly cleared lines and update level and stats if needed
|
|
*/
|
|
void lockedPiece(const LineClear& lineClear);
|
|
|
|
/**
|
|
* Checks if the game ended based on the current states and time passed, accorind to the gamemode
|
|
* @return If the player has won
|
|
*/
|
|
bool hasWon(int framesPassed) const;
|
|
|
|
private:
|
|
/**
|
|
* Updates all the parameters
|
|
*/
|
|
void updateStats();
|
|
|
|
public:
|
|
/**
|
|
* @return The current number of cleared line
|
|
*/
|
|
int getClearedLines() const;
|
|
|
|
/**
|
|
* @return The current level
|
|
*/
|
|
int getLevel() const;
|
|
|
|
/**
|
|
* @return The current grade
|
|
*/
|
|
int getGrade() const;
|
|
|
|
/**
|
|
* @return The length of the next queue
|
|
*/
|
|
int getNextQueueLength() const;
|
|
|
|
/**
|
|
* Returns wheter the blocks are currently bone blocks
|
|
*/
|
|
bool getBoneBlocks() const;
|
|
|
|
/**
|
|
* @return The current gravity for a 20-line high board
|
|
*/
|
|
int getGravity() const;
|
|
|
|
/**
|
|
* @return The current lock delay
|
|
*/
|
|
int getLockDelay() const;
|
|
|
|
/**
|
|
* @return The current forced lock delay
|
|
*/
|
|
int getForcedLockDelay() const;
|
|
|
|
/**
|
|
* @return The current ARE
|
|
*/
|
|
int getARE() const;
|
|
|
|
/**
|
|
* @return The current line ARE
|
|
*/
|
|
int getLineARE() const;
|
|
|
|
/**
|
|
* @return The current DAS
|
|
*/
|
|
int getDAS() const;
|
|
|
|
/**
|
|
* @return The current ARR
|
|
*/
|
|
int getARR() const;
|
|
|
|
/**
|
|
* @return The current SDR
|
|
*/
|
|
int getSDR() const;
|
|
};
|