initial commit
This commit is contained in:
110
src/Core/GameParameters.h
Normal file
110
src/Core/GameParameters.h
Normal file
@@ -0,0 +1,110 @@
|
||||
#pragma once
|
||||
|
||||
#include "Gamemode.h"
|
||||
#include "Player.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 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);
|
||||
|
||||
/**
|
||||
* Count the newly cleared lines and update level and stats if needed
|
||||
*/
|
||||
void clearLines(int lineNumber);
|
||||
|
||||
/**
|
||||
* Returns wheter the game ended
|
||||
*/
|
||||
bool hasWon(int framesPassed);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Updates all the parameters
|
||||
*/
|
||||
void updateStats();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Returns the current number of cleared line
|
||||
*/
|
||||
int getClearedLines();
|
||||
|
||||
/**
|
||||
* Returns the current level
|
||||
*/
|
||||
int getLevel();
|
||||
|
||||
/**
|
||||
* Returns the length of the next queue
|
||||
*/
|
||||
int getNextQueueLength();
|
||||
|
||||
/**
|
||||
* Returns wheter the blocks are currently bone blocks
|
||||
*/
|
||||
bool getBoneBlocks();
|
||||
|
||||
/**
|
||||
* Returns the current gravity for a 20-line high board
|
||||
*/
|
||||
int getGravity();
|
||||
|
||||
/**
|
||||
* Returns the current lock delay
|
||||
*/
|
||||
int getLockDelay();
|
||||
|
||||
/**
|
||||
* Returns the current forced lock delay
|
||||
*/
|
||||
int getForcedLockDelay();
|
||||
|
||||
/**
|
||||
* Returns the current ARE
|
||||
*/
|
||||
int getARE();
|
||||
|
||||
/**
|
||||
* Returns the current line ARE
|
||||
*/
|
||||
int getLineARE();
|
||||
|
||||
/**
|
||||
* Returns the current DAS
|
||||
*/
|
||||
int getDAS();
|
||||
|
||||
/**
|
||||
* Returns the current ARR
|
||||
*/
|
||||
int getARR();
|
||||
|
||||
/**
|
||||
* Returns the current SDR
|
||||
*/
|
||||
int getSDR();
|
||||
};
|
||||
Reference in New Issue
Block a user