small cleanups
This commit is contained in:
parent
c64a587af4
commit
0c65727a52
|
@ -143,7 +143,7 @@ static void tetris_input_chatterProtect(tetris_input_t *pIn,
|
||||||
tetris_input_command_t tetris_input_mapCommand(tetris_bearing_t nBearing,
|
tetris_input_command_t tetris_input_mapCommand(tetris_bearing_t nBearing,
|
||||||
tetris_input_command_t nCmd)
|
tetris_input_command_t nCmd)
|
||||||
{
|
{
|
||||||
tetris_input_command_t const nMapping[] =
|
static uint8_t const nMapping[] PROGMEM =
|
||||||
{
|
{
|
||||||
TETRIS_INCMD_DOWN, TETRIS_INCMD_ROT_CW, TETRIS_INCMD_RIGHT,
|
TETRIS_INCMD_DOWN, TETRIS_INCMD_ROT_CW, TETRIS_INCMD_RIGHT,
|
||||||
TETRIS_INCMD_LEFT,
|
TETRIS_INCMD_LEFT,
|
||||||
|
@ -156,7 +156,7 @@ tetris_input_command_t tetris_input_mapCommand(tetris_bearing_t nBearing,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (nBearing == TETRIS_BEARING_0) || (nCmd >= TETRIS_INCMD_ROT_CCW) ?
|
return (nBearing == TETRIS_BEARING_0) || (nCmd >= TETRIS_INCMD_ROT_CCW) ?
|
||||||
nCmd : (nMapping[(nBearing - 1) * 4 + nCmd]);
|
nCmd : (PM(nMapping[(nBearing - 1) * 4 + nCmd]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* the score impact of every unchanged column to speed up prediction routines.
|
* the score impact of every unchanged column to speed up prediction routines.
|
||||||
* @param pBastet bastet instance which should be preprocessed
|
* @param pBastet bastet instance which should be preprocessed
|
||||||
*/
|
*/
|
||||||
void tetris_bastet_doPreprocessing(tetris_bastet_variant_t *pBastet)
|
static void tetris_bastet_doPreprocessing(tetris_bastet_variant_t *pBastet)
|
||||||
{
|
{
|
||||||
// retrieve sane start and stop values for the column and row indices
|
// retrieve sane start and stop values for the column and row indices
|
||||||
int8_t nWidth = tetris_bucket_getWidth(pBastet->pBucket);
|
int8_t nWidth = tetris_bucket_getWidth(pBastet->pBucket);
|
||||||
|
@ -101,12 +101,12 @@ void tetris_bastet_doPreprocessing(tetris_bastet_variant_t *pBastet)
|
||||||
* @param nStartCol the first column of the range to be predicted
|
* @param nStartCol the first column of the range to be predicted
|
||||||
* @param nStopCol the last column of the range to be predicted
|
* @param nStopCol the last column of the range to be predicted
|
||||||
*/
|
*/
|
||||||
void tetris_bastet_calcPredictedColHeights(tetris_bastet_variant_t *pBastet,
|
static void tetris_bastet_predictColHeights(tetris_bastet_variant_t *pBastet,
|
||||||
tetris_piece_t *pPiece,
|
tetris_piece_t *pPiece,
|
||||||
int8_t nDeepestRow,
|
int8_t nDeepestRow,
|
||||||
int8_t nColumn,
|
int8_t nColumn,
|
||||||
int8_t nStartCol,
|
int8_t nStartCol,
|
||||||
int8_t nStopCol)
|
int8_t nStopCol)
|
||||||
{
|
{
|
||||||
// go through every row and calculate column heights
|
// go through every row and calculate column heights
|
||||||
tetris_bucket_iterator_t iterator;
|
tetris_bucket_iterator_t iterator;
|
||||||
|
@ -238,7 +238,7 @@ static int16_t tetris_bastet_evaluateMove(tetris_bastet_variant_t *pBastet,
|
||||||
}
|
}
|
||||||
|
|
||||||
// predict column heights of this move
|
// predict column heights of this move
|
||||||
tetris_bastet_calcPredictedColHeights(pBastet, pPiece, nDeepestRow, nColumn,
|
tetris_bastet_predictColHeights(pBastet, pPiece, nDeepestRow, nColumn,
|
||||||
nStartCol, nStopCol);
|
nStartCol, nStopCol);
|
||||||
|
|
||||||
// modify score based on predicted column heights
|
// modify score based on predicted column heights
|
||||||
|
|
|
@ -498,10 +498,10 @@ static void tetris_view_blinkLines(tetris_view_t *pV)
|
||||||
|
|
||||||
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
||||||
/**
|
/**
|
||||||
* displays completed Lines (0-399)
|
* draws counter of completed rows (0-399)
|
||||||
* @param pV pointer to the view
|
* @param pV pointer to the view
|
||||||
*/
|
*/
|
||||||
static void tetris_view_showLineNumbers(tetris_view_t *pV)
|
static void tetris_view_drawLineCounter(tetris_view_t *pV)
|
||||||
{
|
{
|
||||||
|
|
||||||
tetris_bearing_t nBearing =
|
tetris_bearing_t nBearing =
|
||||||
|
@ -652,7 +652,7 @@ void tetris_view_update(tetris_view_t *pV)
|
||||||
|
|
||||||
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
||||||
// update line counter
|
// update line counter
|
||||||
tetris_view_showLineNumbers(pV);
|
tetris_view_drawLineCounter(pV);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// draw dump
|
// draw dump
|
||||||
|
|
Loading…
Reference in New Issue