Blocks: changed keys, cleaned up code
This commit is contained in:
parent
8163c92e01
commit
13a6c4fb85
Binary file not shown.
@ -23,7 +23,7 @@ Move the cursor using the numpad keys:
|
|||||||
|
|
|
|
||||||
2
|
2
|
||||||
|
|
||||||
Then select a blocks using ``W`` and remove the blocks using ``R``.
|
Then select a blocks using ``7`` and remove the blocks using ``9``.
|
||||||
|
|
||||||
You can select just one block, or a group of blocks of the same type
|
You can select just one block, or a group of blocks of the same type
|
||||||
|
|
||||||
|
@ -68,21 +68,21 @@
|
|||||||
#define K_LEFT '4' /* Key left */
|
#define K_LEFT '4' /* Key left */
|
||||||
#define K_RIGHT '6' /* Key right */
|
#define K_RIGHT '6' /* Key right */
|
||||||
#define K_EXIT 'Q' /* Key exit */
|
#define K_EXIT 'Q' /* Key exit */
|
||||||
#define K_SELECT 'W' /* Key select */
|
#define K_SELECT '7' /* Key select */
|
||||||
#define K_KILL 'R' /* Key kill */
|
#define K_KILL '9' /* Key kill */
|
||||||
#define K_GRAV_UP 'E' /* Key gravity up */
|
#define K_GRAV_UP 'E' /* Key gravity up */
|
||||||
#define K_GRAV_LEFT 'S' /* Key gravity left */
|
#define K_GRAV_LEFT 'S' /* Key gravity left */
|
||||||
#define K_GRAV_RIGHT 'D' /* Key gravity right */
|
#define K_GRAV_RIGHT 'D' /* Key gravity right */
|
||||||
#define K_GRAV_DOWN 'X' /* Key gravity down */
|
#define K_GRAV_DOWN 'X' /* Key gravity down */
|
||||||
|
|
||||||
#define RESET "\e[0m" /* reset all attributes */
|
#define RESET "\e[0m" /* reset all attributes */
|
||||||
#define RED "\e[31m"
|
#define RED "\e[31m"
|
||||||
#define GREEN "\e[32m"
|
#define GREEN "\e[32m"
|
||||||
#define YELLOW "\e[33m"
|
#define YELLOW "\e[33m"
|
||||||
#define BLUE "\e[34;1m"
|
#define BLUE "\e[34;1m"
|
||||||
#define MAGENTA "\e[35m"
|
#define MAGENTA "\e[35m"
|
||||||
#define CYAN "\e[36m"
|
#define CYAN "\e[36m"
|
||||||
#define WHITE "\e[37m"
|
#define WHITE "\e[37m"
|
||||||
|
|
||||||
/* VARIABLES
|
/* VARIABLES
|
||||||
*/
|
*/
|
||||||
@ -152,20 +152,20 @@ int argc, argv[];
|
|||||||
|
|
||||||
Menu()
|
Menu()
|
||||||
{
|
{
|
||||||
char str[80];
|
char str[80];
|
||||||
|
|
||||||
ScrClr(); ScrCurOff();
|
ScrClr(); ScrCurOff();
|
||||||
|
|
||||||
sprintf(str, "%sB%sl%so%sc%sk%ss%s", RED, GREEN, BLUE, CYAN, MAGENTA, WHITE, RESET); ScrOutStrRC(0, 37, str);
|
sprintf(str, "%sB%sl%so%sc%sk%ss%s", RED, GREEN, BLUE, CYAN, MAGENTA, WHITE, RESET); ScrOutStrRC(1, 37, str);
|
||||||
ScrTitle(1, "v1.1");
|
ScrTitle(3, "v1.1");
|
||||||
ScrTitle(3, "(c) 2012 Floppy Software");
|
ScrTitle(5, "(c) 2012 Floppy Software");
|
||||||
ScrTitle(4, "VT-100 version (c) 2020 by acn@acn.wtf");
|
ScrTitle(6, "VT-100 version (c) 2020 acn128");
|
||||||
|
|
||||||
ScrOutStrRC( 8, 25, "1 : Play game in normal mode");
|
ScrOutStrRC(10, 25, "1 : Play game in normal mode");
|
||||||
ScrOutStrRC(10, 25, "2 : Play game in automatic mode");
|
ScrOutStrRC(12, 25, "2 : Play game in automatic mode");
|
||||||
ScrOutStrRC(12, 25, "3 : Show help");
|
ScrOutStrRC(14, 25, "3 : Show help");
|
||||||
|
|
||||||
ScrOutStrRC(16, 25, "Q : Quit game");
|
ScrOutStrRC(18, 25, "Q : Quit game");
|
||||||
|
|
||||||
ScrTitle(SCR_ROWS-2, "Select your choice");
|
ScrTitle(SCR_ROWS-2, "Select your choice");
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ Help()
|
|||||||
ScrClr();
|
ScrClr();
|
||||||
|
|
||||||
ScrTitle( 0, "Blocks");
|
ScrTitle( 0, "Blocks");
|
||||||
ScrTitle( 1, "------");
|
ScrTitle( 1, "------");
|
||||||
|
|
||||||
ScrTitle( 3, "The object of the game is to remove all the");
|
ScrTitle( 3, "The object of the game is to remove all the");
|
||||||
ScrTitle( 4, "blocks of the board.");
|
ScrTitle( 4, "blocks of the board.");
|
||||||
@ -223,7 +223,7 @@ Help()
|
|||||||
Play()
|
Play()
|
||||||
{
|
{
|
||||||
int row, col, run, val, key;
|
int row, col, run, val, key;
|
||||||
char str[80];
|
char str[80];
|
||||||
|
|
||||||
/* SETUP VARIABLES & BOARD
|
/* SETUP VARIABLES & BOARD
|
||||||
*/
|
*/
|
||||||
@ -240,7 +240,7 @@ Play()
|
|||||||
ScrClr();
|
ScrClr();
|
||||||
|
|
||||||
ScrBox(0, 0, SCR_ROWS-1, SCR_COLS, NULL);
|
ScrBox(0, 0, SCR_ROWS-1, SCR_COLS, NULL);
|
||||||
sprintf(str, "| %sB%sL%sO%sC%sK%sS%s |", RED, GREEN, BLUE, CYAN, MAGENTA, WHITE, RESET); ScrOutStrRC(0, 35, str);
|
sprintf(str, "| %sB%sL%sO%sC%sK%sS%s |", RED, GREEN, BLUE, CYAN, MAGENTA, WHITE, RESET); ScrOutStrRC(0, 35, str);
|
||||||
|
|
||||||
ScrOutStrRC(LEVEL_ROW, LEVEL_COL, "Blocks"); PrintBlocks();
|
ScrOutStrRC(LEVEL_ROW, LEVEL_COL, "Blocks"); PrintBlocks();
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ Play()
|
|||||||
ScrOutStrRC(BORDER_ROW+6, 7, " |");
|
ScrOutStrRC(BORDER_ROW+6, 7, " |");
|
||||||
sprintf(str, " %c", K_DOWN); ScrOutStrRC(BORDER_ROW+7, 7, str);
|
sprintf(str, " %c", K_DOWN); ScrOutStrRC(BORDER_ROW+7, 7, str);
|
||||||
|
|
||||||
sprintf(str, "%c> Select blocks", K_SELECT); ScrOutStrRC(BORDER_ROW+4, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
sprintf(str, "%c> Select blocks", K_SELECT); ScrOutStrRC(BORDER_ROW+4, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
||||||
sprintf(str, "%c> Kill blocks", K_KILL); ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
sprintf(str, "%c> Kill blocks", K_KILL); ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
||||||
sprintf(str, "%c> Quit", K_EXIT); ScrOutStrRC(BORDER_ROW+6, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
sprintf(str, "%c> Quit", K_EXIT); ScrOutStrRC(BORDER_ROW+6, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
Revisions:
|
Revisions:
|
||||||
|
|
||||||
02 Jul 2012 : Version 1.0 for 24x80 VT52 screen.
|
02 Jul 2012 : Version 1.0 for 24x80 VT52 screen.
|
||||||
10 Mar 2020 : Version 1.1 for 24x80 VT100 screen.
|
10 Mar 2020 : Version 1.1 for 24x80 VT100 screen.
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ ScrOutStr:
|
|||||||
ScrSetRC(row, col)
|
ScrSetRC(row, col)
|
||||||
int row, col;
|
int row, col;
|
||||||
{
|
{
|
||||||
char str[9];
|
char str[9];
|
||||||
sprintf(str, "%c[%d;%dH", 27, row+1, col+1);
|
sprintf(str, "%c[%d;%dH", 27, row+1, col+1);
|
||||||
ScrOutStr(str);
|
ScrOutStr(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
#asm
|
#asm
|
||||||
|
Loading…
Reference in New Issue
Block a user