tetris: start on level 1

This commit is contained in:
nick black 2020-07-12 03:12:42 -04:00
parent 3a7dabd2c8
commit 894c6d15f6
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 12 additions and 4 deletions

View File

@ -820,6 +820,14 @@ int get_controlling_tty(void);
if((nc)->loglevel >= NCLOGLEVEL_INFO){ \
nclog("%s:%d:" fmt, __func__, __LINE__, ##__VA_ARGS__); } }while(0);
#define logverbose(nc, fmt, ...) do{ \
if((nc)->loglevel >= NCLOGLEVEL_VERBOSE){ \
nclog("%s:%d:" fmt, __func__, __LINE__, ##__VA_ARGS__); } }while(0);
#define logdebug(nc, fmt, ...) do{ \
if((nc)->loglevel >= NCLOGLEVEL_DEBUG){ \
nclog("%s:%d:" fmt, __func__, __LINE__, ##__VA_ARGS__); } }while(0);
// Convert a notcurses log level to some multimedia library equivalent.
int ffmpeg_log_level(ncloglevel_e level);

View File

@ -1,4 +1,4 @@
static constexpr int MAX_LEVEL = 15;
static constexpr int MAX_LEVEL = 16;
// the number of milliseconds before a drop is forced at the given level,
// using the NES fps counter of 50ms
static constexpr int Gravity(int level) {

View File

@ -26,8 +26,8 @@ bool LockPiece(){ // returns true if game has ended by reaching level 16
}
linescleared_ += cleared;
static constexpr int points[] = {50, 150, 350, 1000};
score_ += (level_ + 1) * points[cleared - 1];
if((level_ = linescleared_ / 10) > MAX_LEVEL){
score_ += (level_) * points[cleared - 1];
if((level_ = linescleared_ / 10 + 1) > MAX_LEVEL){
return true;
}
mtx_.lock();

View File

@ -29,7 +29,7 @@ public:
stdplane_(nc_.get_stdplane()),
scoreplane_(nullptr),
gameover_(gameover),
level_(0),
level_(1),
linescleared_(0),
msdelay_(Gravity(level_))
{