1
0
Fork 0

Added color to Blocks

This commit is contained in:
acn 2020-03-11 14:17:38 +01:00
parent 32dbe48f04
commit 8163c92e01
3 changed files with 92 additions and 62 deletions

Binary file not shown.

View File

@ -1,21 +1,38 @@
# Blocks
This is a clon (more or less) of SameGame, a tile-matching puzzle video game, originally released under the name Chain Shot! in 1985 by Kuniaki Moribe (Morisuke).
This is a clone (more or less) of SameGame, a tile-matching puzzle video game, originally released under the name Chain Shot! in 1985 by Kuniaki Moribe (Morisuke).
The goal of the game is to remove all the blocks of the board.
Copyright (c) 1999-2018 Miguel García / FloppySoftware
The file ``kslib.h`` has been modified for VT100 compatibility (insted of VT52) by me (Anna Christina Naß <acn@acn.wtf>.
The game has been modified for VT100 compatibility (insted of VT52) and got some color by me (Anna Christina Naß <acn@acn.wtf>.
Original Repository: https://github.com/MiguelVis/RetroProjects
Website: http://www.floppysoftware.es/blocks.html?path=cpm_projects|blocks
The file ``BLOCKS.COM`` is the compiled game file.
## Commands
## The Game
Move the cursor using Q, O, P and A as shown on the screen.
Move the cursor using the numpad keys:
8
|
4 --+-- 6
|
2
Then select a blocks using ``W`` and remove the blocks using ``R``.
You can select just one block, or a group of blocks of the same type
If you are in the normal mode, you can place all the blocks against a side (top, bottom, left or right).
Select the side using the ``E``, ``S``, ``D`` or ``X`` key.
If you are in the automatic mode, the blocks rows will be placed on the bottom side of the board, and the columns will be placed on the middle of the board.
The special block **X**, multiplies that result by 10.
## Compile:

View File

@ -21,6 +21,7 @@
Revisions:
02 Jul 2012 : Generic CP/M version 1.0 for 24x80 VT52 screen.
11 Mar 2020 : modified to VT100 version by acn@acn.wtf
*/
#include <mescc.h> /* MESCC header & runtime */
@ -62,17 +63,26 @@
#define SCORE_ROW 2 /* Screen position for score info */
#define SCORE_COL 73 /* id */
#define K_UP 'Q' /* Key up */
#define K_DOWN 'A' /* Key down */
#define K_LEFT 'O' /* Key left */
#define K_RIGHT 'P' /* Key right */
#define K_EXIT 'X' /* Key exit */
#define K_SELECT 'S' /* Key select */
#define K_KILL 'K' /* Key kill */
#define K_GRAV_UP '1' /* Key gravity up */
#define K_GRAV_LEFT '2' /* Key gravity left */
#define K_GRAV_RIGHT '3' /* Key gravity right */
#define K_GRAV_DOWN '4' /* Key gravity down */
#define K_UP '8' /* Key up */
#define K_DOWN '2' /* Key down */
#define K_LEFT '4' /* Key left */
#define K_RIGHT '6' /* Key right */
#define K_EXIT 'Q' /* Key exit */
#define K_SELECT 'W' /* Key select */
#define K_KILL 'R' /* Key kill */
#define K_GRAV_UP 'E' /* Key gravity up */
#define K_GRAV_LEFT 'S' /* Key gravity left */
#define K_GRAV_RIGHT 'D' /* Key gravity right */
#define K_GRAV_DOWN 'X' /* Key gravity down */
#define RESET "\e[0m" /* reset all attributes */
#define RED "\e[31m"
#define GREEN "\e[32m"
#define YELLOW "\e[33m"
#define BLUE "\e[34;1m"
#define MAGENTA "\e[35m"
#define CYAN "\e[36m"
#define WHITE "\e[37m"
/* VARIABLES
*/
@ -142,19 +152,22 @@ int argc, argv[];
Menu()
{
char str[80];
ScrClr(); ScrCurOff();
ScrTitle(0, "BLOCKS");
ScrTitle(1, "v1.0");
ScrTitle(3, "(c) 2012 FLOPPY SOFTWARE");
sprintf(str, "%sB%sl%so%sc%sk%ss%s", RED, GREEN, BLUE, CYAN, MAGENTA, WHITE, RESET); ScrOutStrRC(0, 37, str);
ScrTitle(1, "v1.1");
ScrTitle(3, "(c) 2012 Floppy Software");
ScrTitle(4, "VT-100 version (c) 2020 by acn@acn.wtf");
ScrOutStrRC( 6, 25, "1 : PLAY GAME IN NORMAL MODE");
ScrOutStrRC( 8, 25, "2 : PLAY GAME IN AUTOMATIC MODE");
ScrOutStrRC(10, 25, "3 : SHOW HELP");
ScrOutStrRC( 8, 25, "1 : Play game in normal mode");
ScrOutStrRC(10, 25, "2 : Play game in automatic mode");
ScrOutStrRC(12, 25, "3 : Show help");
ScrOutStrRC(12, 25, "X : EXIT GAME");
ScrOutStrRC(16, 25, "Q : Quit game");
ScrTitle(SCR_ROWS-2, "SELECT YOUR CHOICE");
ScrTitle(SCR_ROWS-2, "Select your choice");
randindex=0; /* This is used to generate a random number */
@ -171,7 +184,7 @@ Menu()
case '1' : automode=0; return 1;
case '2' : automode=1; return 1;
case '3' : Help(); return 2;
case 'X' : return 0;
case K_EXIT : return 0;
}
}
}
@ -183,22 +196,23 @@ Help()
{
ScrClr();
ScrTitle( 0, "BLOCKS");
ScrTitle( 0, "Blocks");
ScrTitle( 1, "------");
ScrTitle( 2, "The object of the game is to remove all the");
ScrTitle( 3, "blocks of the board.");
ScrTitle( 5, "You can select just one block, or a group of");
ScrTitle( 6, "blocks of the same type.");
ScrTitle( 8, "Then, if you are in the normal mode, you can place all");
ScrTitle( 9, "the blocks against a side (top, bottom, left or right).");
ScrTitle(11, "If you are in the automatic mode, the blocks rows will be");
ScrTitle(12, "placed on the bottom side of the board, and the columns");
ScrTitle(13, "will be placed on the middle of the board.");
ScrTitle(15, "The partial score is the square of the number of");
ScrTitle(16, "blocks selected.");
ScrTitle(18, "The special block 'X', multiplies that result by 10.");
ScrTitle(20, "Good luck!");
ScrTitle(22, "PRESS ANY KEY");
ScrTitle( 3, "The object of the game is to remove all the");
ScrTitle( 4, "blocks of the board.");
ScrTitle( 6, "You can select just one block, or a group of");
ScrTitle( 7, "blocks of the same type.");
ScrTitle( 9, "Then, if you are in the normal mode, you can place all");
ScrTitle(10, "the blocks against a side (top, bottom, left or right).");
ScrTitle(12, "If you are in the automatic mode, the blocks rows will be");
ScrTitle(13, "placed on the bottom side of the board, and the columns");
ScrTitle(14, "will be placed on the middle of the board.");
ScrTitle(16, "The partial score is the square of the number of");
ScrTitle(17, "blocks selected.");
ScrTitle(19, "The special block 'X', multiplies that result by 10.");
ScrTitle(21, "Good luck!");
ScrTitle(23, "PRESS ANY KEY");
KbdIn();
}
@ -209,6 +223,7 @@ Help()
Play()
{
int row, col, run, val, key;
char str[80];
/* SETUP VARIABLES & BOARD
*/
@ -224,11 +239,12 @@ Play()
ScrClr();
ScrBox(0, 0, SCR_ROWS-1, SCR_COLS, NULL); ScrTitle(0, "| BLOCKS |");
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);
ScrOutStrRC(LEVEL_ROW, LEVEL_COL, "BLOCKS"); PrintBlocks();
ScrOutStrRC(LEVEL_ROW, LEVEL_COL, "Blocks"); PrintBlocks();
ScrOutStrRC(SCORE_ROW, SCORE_COL, "SCORE"); PrintScore();
ScrOutStrRC(SCORE_ROW, SCORE_COL, "Score"); PrintScore();
ScrBox(BORDER_ROW, BORDER_COL, BOARD_ROWS*BLOCK_ROWS+2, BOARD_COLS*BLOCK_COLS+2, NULL);
@ -239,24 +255,21 @@ Play()
if(!automode)
{
scrTitle(BORDER_ROW-1, "1");
ScrTitle(BORDER_ROW+BOARD_ROWS+2, "4");
ScrOutStrRC(BORDER_ROW+5, BORDER_COL-2, "2");
ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+3, "3");
sprintf(str, "%c", K_GRAV_UP); ScrTitle(BORDER_ROW-1, str);
sprintf(str, "%c", K_GRAV_DOWN); ScrTitle(BORDER_ROW+BOARD_ROWS+2, str);
sprintf(str, "%c", K_GRAV_LEFT); ScrOutStrRC(BORDER_ROW+5, BORDER_COL-2, str);
sprintf(str, "%c", K_GRAV_RIGHT); ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+3, str);
}
ScrOutStrRC(BORDER_ROW+3, 7, " Q");
sprintf(str, " %c", K_UP); ScrOutStrRC(BORDER_ROW+3, 7, str);
ScrOutStrRC(BORDER_ROW+4, 7, " |");
ScrOutStrRC(BORDER_ROW+5, 7, "O --x-- P");
sprintf(str, "%c --+-- %c", K_LEFT, K_RIGHT); ScrOutStrRC(BORDER_ROW+5, 7, str);
ScrOutStrRC(BORDER_ROW+6, 7, " |");
ScrOutStrRC(BORDER_ROW+7, 7, " A");
sprintf(str, " %c", K_DOWN); ScrOutStrRC(BORDER_ROW+7, 7, str);
ScrOutStrRC(BORDER_ROW+4, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "S> SELECT BLOCKS");
ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "K> KILL BLOCKS");
ScrOutStrRC(BORDER_ROW+6, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "X> EXIT");
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> Quit", K_EXIT); ScrOutStrRC(BORDER_ROW+6, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, str);
/* PLAY GAME
*/
@ -582,13 +595,13 @@ int row, col;
switch(GetBlock(row, col))
{
case '1' : ScrOut('$'); break;
case '2' : ScrOut('O'); break;
case '3' : ScrOut('+'); break;
case '4' : ScrOut('#'); break;
case 'X' : ScrOut('X'); break;
case BLOCK_EMPTY : ScrOut(' '); break;
default : ScrOut('?'); break;
case '1' : ScrOutStr(RED); ScrOut('$'); ScrOutStr(RESET); break;
case '2' : ScrOutStr(GREEN); ScrOut('O'); ScrOutStr(RESET); break;
case '3' : ScrOutStr(BLUE); ScrOut('+'); ScrOutStr(RESET); break;
case '4' : ScrOutStr(MAGENTA); ScrOut('#'); ScrOutStr(RESET); break;
case 'X' : ScrOutStr(WHITE); ScrOut('X'); ScrOutStr(RESET); break;
case BLOCK_EMPTY : ScrOutStr(RESET); ScrOut(' '); break;
default : ScrOutStr(RESET); ScrOut('?'); break;
}
ScrOut(selected ? ':' : ' ');