2012-05-07 06:56:00 +00:00
|
|
|
/**
|
|
|
|
* \addtogroup tetris
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file view.c
|
|
|
|
* @brief Implementation of Tetris' graphical output routines.
|
|
|
|
* @author Christian Kroll
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2010-08-28 15:13:35 +00:00
|
|
|
#include <string.h>
|
2008-12-03 05:40:16 +00:00
|
|
|
#include <assert.h>
|
2010-08-24 23:00:40 +00:00
|
|
|
#include <stdint.h>
|
2010-08-28 15:13:35 +00:00
|
|
|
#include "../../config.h"
|
2009-01-02 02:18:20 +00:00
|
|
|
#include "../../pixel.h"
|
|
|
|
#include "../../util.h"
|
|
|
|
#include "../../scrolltext/scrolltext.h"
|
2010-08-22 03:07:46 +00:00
|
|
|
#include "bucket.h"
|
2010-08-28 15:13:35 +00:00
|
|
|
#include "piece.h"
|
|
|
|
#include "variants.h"
|
2008-12-03 05:40:16 +00:00
|
|
|
#include "view.h"
|
|
|
|
|
|
|
|
|
|
|
|
/***********
|
|
|
|
* defines *
|
|
|
|
***********/
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/** how often should the border blink (to indicate level up) */
|
2008-12-03 05:40:16 +00:00
|
|
|
#define TETRIS_VIEW_BORDER_BLINK_COUNT 2
|
2010-04-01 03:11:59 +00:00
|
|
|
/** amount of time (in ms) between border color changes */
|
2008-12-03 05:40:16 +00:00
|
|
|
#define TETRIS_VIEW_BORDER_BLINK_DELAY 100
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/** how often should the lines blink when they get removed */
|
2008-12-03 05:40:16 +00:00
|
|
|
#define TETRIS_VIEW_LINE_BLINK_COUNT 3
|
2010-04-01 03:11:59 +00:00
|
|
|
/** amount of time (in ms) between line color changes */
|
2008-12-03 05:40:16 +00:00
|
|
|
#define TETRIS_VIEW_LINE_BLINK_DELAY 75
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of space */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORSPACE 0
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of border */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORBORDER 1
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of fading lines */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORFADE 2
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of a piece */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORPIECE 3
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of pause mode */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORPAUSE 1
|
2010-04-01 03:11:59 +00:00
|
|
|
/** color of line counter */
|
2009-12-27 02:11:58 +00:00
|
|
|
#define TETRIS_VIEW_COLORCOUNTER 2
|
2008-12-03 05:40:16 +00:00
|
|
|
|
2014-07-15 22:10:58 +00:00
|
|
|
#if (((NUM_ROWS < 16) && (NUM_COLS > NUM_ROWS)) || \
|
|
|
|
((NUM_ROWS == 16) && (NUM_COLS == 80))) && (!defined GAME_TETRIS_FP)
|
2014-05-25 16:12:12 +00:00
|
|
|
# define VIEWCOLS NUM_ROWS
|
|
|
|
# define VIEWROWS NUM_COLS
|
|
|
|
# define VIEW_TILT
|
|
|
|
#else
|
|
|
|
# define VIEWCOLS NUM_COLS
|
|
|
|
# define VIEWROWS NUM_ROWS
|
|
|
|
#endif
|
2010-01-21 20:15:05 +00:00
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
#if VIEWROWS >= 20
|
|
|
|
#define TETRIS_VIEW_YOFFSET_DUMP ((VIEWROWS - 20) / 2)
|
|
|
|
#define TETRIS_VIEW_HEIGHT_DUMP 20
|
|
|
|
#else
|
|
|
|
#define TETRIS_VIEW_YOFFSET_DUMP 0
|
|
|
|
#define TETRIS_VIEW_HEIGHT_DUMP VIEWROWS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if VIEWCOLS >= 16
|
|
|
|
#define TETRIS_VIEW_XOFFSET_DUMP (((VIEWCOLS - 16) / 2) + 1)
|
|
|
|
#define TETRIS_VIEW_WIDTH_DUMP 10
|
|
|
|
|
|
|
|
#if VIEWROWS >= 16
|
|
|
|
#define TETRIS_VIEW_XOFFSET_COUNTER \
|
|
|
|
(TETRIS_VIEW_XOFFSET_DUMP + TETRIS_VIEW_WIDTH_DUMP + 1)
|
2014-07-15 22:10:58 +00:00
|
|
|
#define TETRIS_VIEW_YOFFSET_COUNT100 + \
|
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + ((TETRIS_VIEW_HEIGHT_DUMP - 14) / 2)
|
2010-04-01 03:11:59 +00:00
|
|
|
#define TETRIS_VIEW_YOFFSET_COUNT10 (TETRIS_VIEW_YOFFSET_COUNT100 + 2)
|
|
|
|
#define TETRIS_VIEW_YOFFSET_COUNT1 (TETRIS_VIEW_YOFFSET_COUNT10 + 4)
|
|
|
|
|
|
|
|
#define TETRIS_VIEW_XOFFSET_PREVIEW \
|
|
|
|
(TETRIS_VIEW_XOFFSET_DUMP + TETRIS_VIEW_WIDTH_DUMP + 1)
|
|
|
|
#define TETRIS_VIEW_YOFFSET_PREVIEW (TETRIS_VIEW_YOFFSET_COUNT1 + 4)
|
|
|
|
#elif VIEWROWS < 16 && VIEWROWS >= 4
|
|
|
|
#define TETRIS_VIEW_XOFFSET_PREVIEW \
|
|
|
|
(TETRIS_VIEW_XOFFSET_DUMP + TETRIS_VIEW_WIDTH_DUMP + 1)
|
|
|
|
#define TETRIS_VIEW_YOFFSET_PREVIEW ((VIEWROWS - 4) / 2)
|
|
|
|
#endif
|
|
|
|
#elif (VIEWCOLS < 16) && (VIEWCOLS >= 12)
|
|
|
|
#define TETRIS_VIEW_XOFFSET_DUMP ((VIEWCOLS - 10) / 2)
|
|
|
|
#define TETRIS_VIEW_WIDTH_DUMP 10
|
|
|
|
#elif VIEWCOLS == 11
|
|
|
|
#define TETRIS_VIEW_XOFFSET_DUMP 1
|
|
|
|
#define TETRIS_VIEW_WIDTH_DUMP 10
|
|
|
|
#else
|
|
|
|
#define TETRIS_VIEW_XOFFSET_DUMP 0
|
|
|
|
#define TETRIS_VIEW_WIDTH_DUMP VIEWCOLS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-01-21 20:15:05 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
/***************************
|
|
|
|
* non-interface functions *
|
|
|
|
***************************/
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/**
|
|
|
|
* setpixel replacement which may transform the pixel coordinates
|
2010-08-22 03:07:46 +00:00
|
|
|
* @param nBearing bearing of the view
|
2010-04-01 03:11:59 +00:00
|
|
|
* @param x x-coordinate of the pixel
|
|
|
|
* @param y y-coordinate of the pixel
|
|
|
|
* @param nColor Color of the pixel
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_setpixel(tetris_bearing_t nBearing,
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
uint8_t nColor)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
2014-05-25 16:12:12 +00:00
|
|
|
#ifdef VIEW_TILT
|
|
|
|
// tilt counter clockwise
|
|
|
|
nBearing = (nBearing + 3) % 4u;
|
|
|
|
#endif
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
x = VIEWCOLS - 1 - x;
|
|
|
|
|
2010-12-15 15:25:56 +00:00
|
|
|
pixel px;
|
2010-08-22 03:07:46 +00:00
|
|
|
switch (nBearing)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
2011-01-30 22:47:44 +00:00
|
|
|
default:
|
2010-08-22 03:07:46 +00:00
|
|
|
case TETRIS_BEARING_0:
|
2010-12-15 15:25:56 +00:00
|
|
|
px = (pixel){x, y};
|
2010-04-01 03:11:59 +00:00
|
|
|
break;
|
2010-08-22 03:07:46 +00:00
|
|
|
case TETRIS_BEARING_90:
|
2010-12-15 15:25:56 +00:00
|
|
|
px = (pixel){y, VIEWCOLS - 1 - x};
|
2010-04-01 03:11:59 +00:00
|
|
|
break;
|
2010-08-22 03:07:46 +00:00
|
|
|
case TETRIS_BEARING_180:
|
2010-12-15 15:25:56 +00:00
|
|
|
px = (pixel){VIEWCOLS - 1 - x, VIEWROWS - 1 - y};
|
2010-04-01 03:11:59 +00:00
|
|
|
break;
|
2010-08-22 03:07:46 +00:00
|
|
|
case TETRIS_BEARING_270:
|
2010-12-15 15:25:56 +00:00
|
|
|
px = (pixel){VIEWROWS - 1 - y, x};
|
2010-04-01 03:11:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-12-15 15:25:56 +00:00
|
|
|
setpixel(px, nColor);
|
2010-04-01 03:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* draws a horizontal line
|
2010-08-22 03:07:46 +00:00
|
|
|
* @param nBearing bearing of the view
|
2010-04-01 03:11:59 +00:00
|
|
|
* @param x1 first x-coordinate of the line
|
|
|
|
* @param x2 second x-coordinate of the line
|
|
|
|
* @param y y-coordinate of the line
|
|
|
|
* @param nColor Color of the line
|
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
inline static void tetris_view_drawHLine(tetris_bearing_t nBearing,
|
2011-01-30 22:47:44 +00:00
|
|
|
uint8_t x1,
|
|
|
|
uint8_t x2,
|
|
|
|
uint8_t y,
|
|
|
|
uint8_t nColor)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
|
|
|
assert(x1 <= x2);
|
|
|
|
|
|
|
|
for (uint8_t x = x1; x <= x2; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, x, y, nColor);
|
2010-04-01 03:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* draws a vertical line
|
2010-08-22 03:07:46 +00:00
|
|
|
* @param nBearing bearing of the view
|
2010-04-01 03:11:59 +00:00
|
|
|
* @param x x-coordinate of the line
|
|
|
|
* @param y1 first y-coordinate of the line
|
|
|
|
* @param y2 second y-coordinate of the line
|
|
|
|
* @param nColor Color of the line
|
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
inline static void tetris_view_drawVLine(tetris_bearing_t nBearing,
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y1,
|
|
|
|
uint8_t y2,
|
|
|
|
uint8_t nColor)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
|
|
|
assert(y1 <= y2);
|
|
|
|
|
|
|
|
for (uint8_t y = y1; y <= y2; ++y)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, x, y, nColor);
|
2010-04-01 03:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* helper function to dim the piece color if game is paused
|
|
|
|
* @param pV pointer to the view whose pause status is of interest
|
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
inline static uint8_t tetris_view_getPieceColor(tetris_view_t *pV)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
if (pV->modeCurrent == TETRIS_VIMO_RUNNING)
|
|
|
|
{
|
|
|
|
return TETRIS_VIEW_COLORPIECE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-12-27 02:11:58 +00:00
|
|
|
return TETRIS_VIEW_COLORPAUSE;
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/**
|
|
|
|
* redraws the dump and the falling piece (if necessary)
|
|
|
|
* @param pV pointer to the view on which the dump should be drawn
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_drawDump(tetris_view_t *pV)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
assert(pV->pBucket != NULL);
|
|
|
|
if (tetris_bucket_getRow(pV->pBucket) <= -4)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2010-12-17 23:33:06 +00:00
|
|
|
tetris_bearing_t const nBearing =
|
|
|
|
pV->pVariantMethods->getBearing(pV->pVariant);
|
2008-12-03 05:40:16 +00:00
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
for (int8_t nRow = TETRIS_VIEW_HEIGHT_DUMP - 1; nRow >= 0; --nRow)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-12-15 15:25:56 +00:00
|
|
|
uint16_t nRowMap = tetris_bucket_getDumpRow(pV->pBucket, nRow);
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
// if a piece is hovering or gliding it needs to be drawn
|
2010-12-15 15:25:56 +00:00
|
|
|
int8_t nPieceRow = tetris_bucket_getRow(pV->pBucket);
|
|
|
|
tetris_bucket_status_t status = tetris_bucket_getStatus(pV->pBucket);
|
|
|
|
if (((status == TETRIS_BUS_HOVERING) || (status == TETRIS_BUS_GLIDING)
|
|
|
|
|| (status == TETRIS_BUS_GAMEOVER)) && (nRow >= nPieceRow)
|
|
|
|
&& (nRow <= nPieceRow + 3))
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-12-15 15:25:56 +00:00
|
|
|
int8_t nColumn = tetris_bucket_getColumn(pV->pBucket);
|
|
|
|
uint16_t nPieceMap =
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_piece_getBitmap(tetris_bucket_getPiece(pV->pBucket));
|
2010-12-15 15:25:56 +00:00
|
|
|
// clear all bits of the piece we are not interested in and
|
|
|
|
// align the remaining row to LSB
|
2012-09-08 01:35:32 +00:00
|
|
|
uint8_t y = (uint8_t)(nRow - nPieceRow);
|
|
|
|
nPieceMap = (nPieceMap & (0x000Fu << (y * 4u))) >> (y * 4u);
|
2010-12-15 15:25:56 +00:00
|
|
|
// shift remaining part to current column and embed piece into view
|
|
|
|
nRowMap |= nColumn >= 0 ?
|
|
|
|
nPieceMap << nColumn : nPieceMap >> -nColumn;
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 15:25:56 +00:00
|
|
|
uint16_t nElementMask = 0x0001;
|
2011-01-25 22:56:49 +00:00
|
|
|
for (uint8_t x = 0; x < TETRIS_VIEW_WIDTH_DUMP; ++x)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-12-15 15:25:56 +00:00
|
|
|
unsigned char nColor = (nRowMap & nElementMask) ?
|
|
|
|
tetris_view_getPieceColor(pV) : TETRIS_VIEW_COLORSPACE;
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, TETRIS_VIEW_XOFFSET_DUMP + x,
|
2012-09-08 01:35:32 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + (uint8_t)nRow, nColor);
|
2008-12-03 05:40:16 +00:00
|
|
|
nElementMask <<= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 15:25:56 +00:00
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
#ifdef TETRIS_VIEW_XOFFSET_PREVIEW
|
|
|
|
/**
|
|
|
|
* redraws the preview window
|
|
|
|
* @param pV pointer to the view on which the piece should be drawn
|
|
|
|
* @param pPc pointer to the piece for the preview window (may be NULL)
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2012-11-17 20:19:14 +00:00
|
|
|
static void tetris_view_drawPreviewPiece(tetris_view_t *pV,
|
|
|
|
tetris_piece_t *pPc)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_bearing_t nBearing =
|
|
|
|
pV->pVariantMethods->getBearing(pV->pVariant);
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
if (pPc != NULL)
|
|
|
|
{
|
|
|
|
uint8_t nColor;
|
|
|
|
uint16_t nElementMask = 0x0001;
|
|
|
|
uint16_t nPieceMap;
|
|
|
|
if (pV->modeCurrent == TETRIS_VIMO_RUNNING)
|
|
|
|
{
|
|
|
|
nPieceMap = tetris_piece_getBitmap(pPc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
// an iconized "P"
|
2008-12-03 05:40:16 +00:00
|
|
|
nPieceMap = 0x26a6;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint8_t y = 0; y < 4; ++y)
|
|
|
|
{
|
|
|
|
for (uint8_t x = 0; x < 4; ++x)
|
|
|
|
{
|
|
|
|
if ((nPieceMap & nElementMask) != 0)
|
|
|
|
{
|
|
|
|
nColor = TETRIS_VIEW_COLORPIECE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nColor = TETRIS_VIEW_COLORSPACE;
|
|
|
|
}
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_PREVIEW + x,
|
|
|
|
TETRIS_VIEW_YOFFSET_PREVIEW + y,
|
|
|
|
nColor);
|
2008-12-03 05:40:16 +00:00
|
|
|
nElementMask <<= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (uint8_t y = 0; y < 4; ++y)
|
|
|
|
{
|
|
|
|
for (uint8_t x = 0; x < 4; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_PREVIEW + x,
|
|
|
|
TETRIS_VIEW_YOFFSET_PREVIEW + y,
|
|
|
|
TETRIS_VIEW_COLORSPACE);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-01 03:11:59 +00:00
|
|
|
#endif
|
2008-12-03 05:40:16 +00:00
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/**
|
|
|
|
* draws borders in the given color
|
|
|
|
* @param pV pointer to the view on which the borders should be drawn
|
|
|
|
* @param nColor the color for the border
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_drawBorders(tetris_view_t *pV,
|
2012-11-17 20:19:14 +00:00
|
|
|
uint8_t nColor)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_bearing_t nBearing =
|
|
|
|
pV->pVariantMethods->getBearing(pV->pVariant);
|
2010-04-01 03:11:59 +00:00
|
|
|
|
|
|
|
#if TETRIS_VIEW_YOFFSET_DUMP != 0
|
|
|
|
// fill upper space if required
|
|
|
|
for (uint8_t y = 0; y < TETRIS_VIEW_YOFFSET_DUMP; ++y)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawHLine(nBearing, 0, VIEWCOLS - 1, y, nColor);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
2010-04-01 03:11:59 +00:00
|
|
|
#endif
|
2009-12-27 02:11:58 +00:00
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
#if VIEWROWS > TETRIS_VIEW_HEIGHT_DUMP
|
|
|
|
// fill lower space if required
|
|
|
|
uint8_t y = TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP;
|
|
|
|
for (; y < VIEWROWS; ++y)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawHLine(nBearing, 0, VIEWCOLS - 1, y, nColor);
|
2010-04-01 03:11:59 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if TETRIS_VIEW_XOFFSET_DUMP != 0
|
|
|
|
// fill left space if required
|
|
|
|
for (uint8_t x = 0; x < TETRIS_VIEW_XOFFSET_DUMP; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_DUMP,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if VIEWCOLS > 16
|
|
|
|
// fill right space if required
|
|
|
|
uint8_t x = TETRIS_VIEW_XOFFSET_DUMP + TETRIS_VIEW_WIDTH_DUMP + 5;
|
|
|
|
for (; x < VIEWCOLS; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_DUMP,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER - 1,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP,
|
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
|
|
|
|
for (uint8_t x = TETRIS_VIEW_XOFFSET_COUNTER;
|
|
|
|
x < TETRIS_VIEW_XOFFSET_COUNTER + 3; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_DUMP,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_COUNT100 - 1, nColor);
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_PREVIEW + 4,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER + 3,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP, TETRIS_VIEW_YOFFSET_COUNT1 + 3, nColor);
|
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER + 3,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_PREVIEW + 4,
|
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawHLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_COUNTER + 3, TETRIS_VIEW_YOFFSET_COUNT100 + 1,
|
|
|
|
nColor);
|
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawHLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_COUNTER + 3, TETRIS_VIEW_YOFFSET_COUNT10 + 3,
|
|
|
|
nColor);
|
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawHLine(nBearing, TETRIS_VIEW_XOFFSET_COUNTER,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_COUNTER + 3, TETRIS_VIEW_YOFFSET_COUNT1 + 3,
|
|
|
|
nColor);
|
|
|
|
#elif defined TETRIS_VIEW_XOFFSET_PREVIEW
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, TETRIS_VIEW_XOFFSET_PREVIEW - 1,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP,
|
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
|
|
|
|
for (uint8_t x = TETRIS_VIEW_XOFFSET_PREVIEW;
|
|
|
|
x < TETRIS_VIEW_XOFFSET_PREVIEW + 4; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_DUMP,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_PREVIEW - 1, nColor);
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_PREVIEW + 4,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
}
|
|
|
|
#elif TETRIS_VIEW_WIDTH_DUMP < VIEWCOLS
|
|
|
|
for (uint8_t x = TETRIS_VIEW_XOFFSET_DUMP + TETRIS_VIEW_WIDTH_DUMP;
|
|
|
|
x < VIEWCOLS; ++x)
|
|
|
|
{
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_drawVLine(nBearing, x, TETRIS_VIEW_YOFFSET_DUMP,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + TETRIS_VIEW_HEIGHT_DUMP - 1, nColor);
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/**
|
|
|
|
* lets the borders blink to notify player of a level change
|
|
|
|
* @param pV pointer to the view whose borders should blink
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_blinkBorders(tetris_view_t *pV)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2011-01-30 22:47:44 +00:00
|
|
|
for (uint8_t i = TETRIS_VIEW_BORDER_BLINK_COUNT * 2; i--;)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2011-01-30 22:47:44 +00:00
|
|
|
tetris_view_drawBorders(pV, (i & 0x01) ?
|
|
|
|
TETRIS_VIEW_COLORBORDER : TETRIS_VIEW_COLORPIECE);
|
2010-08-28 15:13:35 +00:00
|
|
|
wait(TETRIS_VIEW_BORDER_BLINK_DELAY);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
/**
|
|
|
|
* lets complete lines blink to emphasize their removal
|
2010-08-22 03:07:46 +00:00
|
|
|
* @param pV pointer to the view whose complete lines should blink
|
2008-12-03 05:40:16 +00:00
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_blinkLines(tetris_view_t *pV)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
// reduce necessity of pointer arithmetic
|
2010-08-22 03:07:46 +00:00
|
|
|
int8_t nRow = tetris_bucket_getRow(pV->pBucket);
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_bearing_t nBearing =
|
|
|
|
pV->pVariantMethods->getBearing(pV->pVariant);
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
// don't try to draw below the border
|
2010-04-01 03:11:59 +00:00
|
|
|
int8_t nDeepestRowOffset = ((nRow + 3) < TETRIS_VIEW_HEIGHT_DUMP ?
|
|
|
|
3 : TETRIS_VIEW_HEIGHT_DUMP - (nRow + 1));
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
// this loop controls how often the lines should blink
|
|
|
|
for (uint8_t i = 0; i < TETRIS_VIEW_LINE_BLINK_COUNT; ++i)
|
|
|
|
{
|
|
|
|
// this loop determines the color of the line to be drawn
|
|
|
|
for (uint8_t nColIdx = 0; nColIdx < 2; ++nColIdx)
|
|
|
|
{
|
|
|
|
// iterate through the possibly complete lines
|
2011-01-30 22:47:44 +00:00
|
|
|
for (uint8_t j = 0, nMask = 0x01; j <= nDeepestRowOffset; ++j)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
// is current line a complete line?
|
2011-01-30 22:47:44 +00:00
|
|
|
if ((tetris_bucket_getRowMask(pV->pBucket) & nMask) != 0)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
// draw line in current color
|
2011-01-30 22:47:44 +00:00
|
|
|
int8_t y = nRow + j;
|
|
|
|
for (int8_t x = tetris_bucket_getWidth(pV->pBucket); x--;)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t nColor = (nColIdx == 0 ? TETRIS_VIEW_COLORFADE
|
|
|
|
: TETRIS_VIEW_COLORPIECE);
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing,
|
2012-09-08 01:35:32 +00:00
|
|
|
TETRIS_VIEW_XOFFSET_DUMP + (uint8_t)x,
|
|
|
|
TETRIS_VIEW_YOFFSET_DUMP + (uint8_t)y,
|
2010-04-01 03:11:59 +00:00
|
|
|
nColor);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 22:47:44 +00:00
|
|
|
nMask <<= 1;
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
// wait a few ms to make the blink effect visible
|
2010-08-28 15:13:35 +00:00
|
|
|
wait(TETRIS_VIEW_LINE_BLINK_DELAY);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
|
|
|
/**
|
2010-12-20 22:52:08 +00:00
|
|
|
* draws counter of completed rows (0-399)
|
2010-04-01 03:11:59 +00:00
|
|
|
* @param pV pointer to the view
|
2009-10-10 21:18:04 +00:00
|
|
|
*/
|
2010-12-20 22:52:08 +00:00
|
|
|
static void tetris_view_drawLineCounter(tetris_view_t *pV)
|
2009-10-10 21:18:04 +00:00
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_bearing_t nBearing =
|
|
|
|
pV->pVariantMethods->getBearing(pV->pVariant);
|
2010-04-01 03:11:59 +00:00
|
|
|
|
2009-12-27 02:11:58 +00:00
|
|
|
// get number of completed lines
|
2010-04-01 03:11:59 +00:00
|
|
|
uint16_t nLines = pV->pVariantMethods->getLines(pV->pVariant);
|
2009-12-27 02:11:58 +00:00
|
|
|
|
|
|
|
// get decimal places
|
2011-01-30 22:47:44 +00:00
|
|
|
uint8_t nOnes = nLines % 10;
|
|
|
|
uint8_t nTens = (nLines / 10) % 10;
|
|
|
|
uint8_t nHundreds = (nLines / 100) % 10;
|
2009-12-27 02:11:58 +00:00
|
|
|
|
|
|
|
// draws the decimal places as 3x3 squares with 9 pixels
|
2011-01-25 22:56:49 +00:00
|
|
|
for (uint8_t i = 0, x = 0, y = 0; i < 9; ++i)
|
2009-10-10 21:18:04 +00:00
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
// pick drawing color for the ones
|
2009-12-27 02:11:58 +00:00
|
|
|
uint8_t nOnesPen = nOnes > i ?
|
|
|
|
TETRIS_VIEW_COLORCOUNTER : TETRIS_VIEW_COLORSPACE;
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, TETRIS_VIEW_XOFFSET_COUNTER + x,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_COUNT1 + y, nOnesPen);
|
|
|
|
|
|
|
|
// pick drawing color for the tens
|
2009-12-27 02:11:58 +00:00
|
|
|
uint8_t nTensPen = nTens > i ?
|
|
|
|
TETRIS_VIEW_COLORCOUNTER : TETRIS_VIEW_COLORSPACE;
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, TETRIS_VIEW_XOFFSET_COUNTER + x,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_COUNT10 + y, nTensPen);
|
|
|
|
|
|
|
|
// a maximum of 399 lines can be displayed
|
|
|
|
if (i < 3)
|
|
|
|
{
|
|
|
|
// pick drawing color for the hundreds
|
|
|
|
uint8_t nHundredsPen = nHundreds > i ?
|
|
|
|
TETRIS_VIEW_COLORCOUNTER : TETRIS_VIEW_COLORSPACE;
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_view_setpixel(nBearing, TETRIS_VIEW_XOFFSET_COUNTER + x,
|
2010-04-01 03:11:59 +00:00
|
|
|
TETRIS_VIEW_YOFFSET_COUNT100 + y, nHundredsPen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-12-27 02:11:58 +00:00
|
|
|
// wrap lines if required
|
2010-04-01 03:11:59 +00:00
|
|
|
if ((++x % 3) == 0)
|
2009-12-27 02:11:58 +00:00
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
++y;
|
|
|
|
x = 0;
|
2009-12-27 02:11:58 +00:00
|
|
|
}
|
2009-10-10 21:18:04 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-01 03:11:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* unpacks the champion's initials from the uint16_t packed form
|
|
|
|
* @param nHighscoreName the champion's initials packed into a uint16_t
|
|
|
|
* @param pszName pointer to an array of char for the unpacked initials
|
|
|
|
*/
|
2010-12-15 15:25:56 +00:00
|
|
|
static void tetris_view_formatHighscoreName(uint16_t nHighscoreName,
|
|
|
|
char *pszName)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
2011-01-30 22:47:44 +00:00
|
|
|
for (uint8_t i = 3; i--; nHighscoreName >>= 5)
|
2010-04-01 03:11:59 +00:00
|
|
|
{
|
2011-01-30 22:47:44 +00:00
|
|
|
if ((pszName[i] = (nHighscoreName & 0x1F) + 65) == '_')
|
|
|
|
{
|
|
|
|
pszName[i] = ' ';
|
|
|
|
}
|
2010-04-01 03:11:59 +00:00
|
|
|
}
|
|
|
|
pszName[3] = '\0';
|
|
|
|
}
|
2009-10-10 21:18:04 +00:00
|
|
|
|
2009-12-27 02:11:58 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
/****************************
|
|
|
|
* construction/destruction *
|
|
|
|
****************************/
|
|
|
|
|
2010-08-24 23:00:40 +00:00
|
|
|
tetris_view_t *tetris_view_construct(tetris_variant_t const *const pVarMethods,
|
2010-04-01 03:11:59 +00:00
|
|
|
void *pVariantData,
|
2010-08-22 03:07:46 +00:00
|
|
|
tetris_bucket_t *pBucket)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
|
|
|
// memory allocation
|
2010-08-22 03:07:46 +00:00
|
|
|
assert((pVariantData != NULL) && (pBucket != NULL));
|
2008-12-03 05:40:16 +00:00
|
|
|
tetris_view_t *pView =
|
|
|
|
(tetris_view_t *) malloc(sizeof(tetris_view_t));
|
|
|
|
assert(pView != NULL);
|
|
|
|
|
|
|
|
// init
|
|
|
|
memset(pView, 0, sizeof(tetris_view_t));
|
2010-04-01 03:11:59 +00:00
|
|
|
pView->pVariantMethods = pVarMethods;
|
|
|
|
pView->pVariant = pVariantData;
|
2010-08-22 03:07:46 +00:00
|
|
|
pView->pBucket = pBucket;
|
2010-04-01 03:11:59 +00:00
|
|
|
pView->modeCurrent = pView->modeOld = TETRIS_VIMO_RUNNING;
|
2010-01-21 20:15:05 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
// drawing some first stuff
|
|
|
|
clear_screen(0);
|
2010-04-01 03:11:59 +00:00
|
|
|
tetris_view_drawBorders(pView, TETRIS_VIEW_COLORBORDER);
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
return pView;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************
|
|
|
|
* view related functions *
|
|
|
|
***************************/
|
|
|
|
|
|
|
|
void tetris_view_getDimensions(int8_t *w,
|
|
|
|
int8_t *h)
|
|
|
|
{
|
|
|
|
assert((w != NULL) && (h != NULL));
|
2010-04-01 03:11:59 +00:00
|
|
|
*w = TETRIS_VIEW_WIDTH_DUMP;
|
|
|
|
*h = TETRIS_VIEW_HEIGHT_DUMP;
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tetris_view_update(tetris_view_t *pV)
|
|
|
|
{
|
|
|
|
assert(pV != NULL);
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
tetris_view_drawBorders(pV, TETRIS_VIEW_COLORBORDER);
|
|
|
|
|
|
|
|
#ifdef TETRIS_VIEW_XOFFSET_PREVIEW
|
|
|
|
// draw preview piece
|
|
|
|
tetris_view_drawPreviewPiece(pV,
|
|
|
|
pV->pVariantMethods->getPreviewPiece(pV->pVariant));
|
|
|
|
#endif
|
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
// let complete lines blink (if there are any)
|
2010-08-22 03:07:46 +00:00
|
|
|
if (tetris_bucket_getRowMask(pV->pBucket) != 0)
|
2008-12-03 05:40:16 +00:00
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
tetris_view_blinkLines(pV);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
|
2010-04-01 03:11:59 +00:00
|
|
|
#ifdef TETRIS_VIEW_XOFFSET_COUNTER
|
|
|
|
// update line counter
|
2010-12-20 22:52:08 +00:00
|
|
|
tetris_view_drawLineCounter(pV);
|
2010-04-01 03:11:59 +00:00
|
|
|
#endif
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
// draw dump
|
|
|
|
tetris_view_drawDump(pV);
|
|
|
|
|
|
|
|
// visual feedback to inform about a level change
|
2010-04-01 03:11:59 +00:00
|
|
|
uint8_t nLevel = pV->pVariantMethods->getLevel(pV->pVariant);
|
2008-12-03 05:40:16 +00:00
|
|
|
if (nLevel != pV->nOldLevel)
|
|
|
|
{
|
2010-04-01 03:11:59 +00:00
|
|
|
tetris_view_blinkBorders(pV);
|
2008-12-03 05:40:16 +00:00
|
|
|
pV->nOldLevel = nLevel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tetris_view_showResults(tetris_view_t *pV)
|
|
|
|
{
|
2010-01-13 19:24:10 +00:00
|
|
|
#ifdef SCROLLTEXT_SUPPORT
|
2010-08-22 03:07:46 +00:00
|
|
|
char pszResults[55], pszHighscoreName[4];
|
2010-04-01 03:11:59 +00:00
|
|
|
uint16_t nScore = pV->pVariantMethods->getScore(pV->pVariant);
|
|
|
|
uint16_t nHighscore = pV->pVariantMethods->getHighscore(pV->pVariant);
|
|
|
|
uint16_t nLines = pV->pVariantMethods->getLines(pV->pVariant);
|
|
|
|
uint16_t nHighscoreName =
|
|
|
|
pV->pVariantMethods->getHighscoreName(pV->pVariant);
|
2010-01-11 21:47:56 +00:00
|
|
|
tetris_view_formatHighscoreName(nHighscoreName, pszHighscoreName);
|
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
if (nScore <= nHighscore)
|
|
|
|
{
|
2010-01-11 21:47:56 +00:00
|
|
|
snprintf(pszResults, sizeof(pszResults),
|
|
|
|
"</#Lines %u Score %u Highscore %u (%s)",
|
|
|
|
nLines, nScore, nHighscore, pszHighscoreName);
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-11 21:47:56 +00:00
|
|
|
snprintf(pszResults, sizeof(pszResults),
|
2008-12-03 05:40:16 +00:00
|
|
|
"</#Lines %u New Highscore %u", nLines, nScore);
|
|
|
|
}
|
|
|
|
scrolltext(pszResults);
|
2009-01-02 02:18:20 +00:00
|
|
|
#endif
|
2008-12-03 05:40:16 +00:00
|
|
|
}
|
2012-05-07 06:56:00 +00:00
|
|
|
|
|
|
|
/*@}*/
|