1
0

Added MazezaM

This commit is contained in:
acn 2020-06-26 13:19:23 +02:00
parent 4f845c64e6
commit 36d7ecd715
4 changed files with 676 additions and 0 deletions

BIN
MazezaM/MAZEZAM.COM Normal file

Binary file not shown.

93
MazezaM/README.md Normal file
View File

@ -0,0 +1,93 @@
# MazezaM
MazezaM is a puzzle game for CP/M.
* Copyright (C) 2002 Malcolm Tyrrell <tyrrelmr@cs.tcd.ie>
* CP/M version (C) 2004-2008 Ventzislav Tzvetkov (drHirudo) (for VT52 terminals)
* z88dk version by Stefano Bodrato (www.z88dk.org)
* VT100 adaption (C) 2020 Anna Christina Naß <acn@acn.wtf>
Licensed under the GPL.
You can find the VT52 version of this game, and also for other platforms, here: http://hirudov.com/
## The game
MazezaM (pronounced "may-zam") is a simple puzzle game. You enter the
mazezam on the left and you have to get to the exit on the right by
pushing rows of blocks left and right.
In the game ``=`` represents a brick, ``#`` represents a block, ``P`` is the Player
and ``O`` is a door.
Good Luck.
## Keys
I changed the keys to 8, 6, 4, 2 on the numpad, but W, A, S, D will also work.
Use R to restart a level (at the cost of one live).
## About the game, by drHirudo
To the best of my knowledge MazezaM's specific game logic is original.
Unfortunately, there are so many puzzles out there that it is impossible for
me to be sure. If you are aware of a prior instance of the idea, please get
in touch. If possible, include a link which I can add to my web page.
The idea for MazezaM came to me while recalling an Oric-1 type-in game
called "Fall Guy" (from the book "Sixty Programs for the Oric-1" by Robert
Erskine, Humphrey Walwyn, Paul Stanley and Michael Bews). The game play is a
reminiscent of the game Sokoban (Thinking Rabbit, Inc) and also bears a
resemblance to "sliding block" or "sliding piece" puzzles where wooden shapes
are moved around in order to get a (usually larger) shape from one side of the
puzzle to the other. The name "MazezaM" was suggested by Robert Byrne.
## Compiling
MazezaM is written in C for the ZXCC compiler which can be found in [z88dk](https://www.z88dk.org/).
Use this command line (tested in Linux) to compile:
zcc +cpm -lndos -o MAZEZAM.COM mazezam.c -O3
## New Levels Wanted:
If you like this game and are good at designing levels, I encourage you to
create levels and send them to any of the authors for include in further
versions. Credit of course will be given.
## Other versions and games my drHirudo
Original Sinclair and Java games - Copyright (C) 2002 Malcolm Tyrrell
http://www.cs.tcd.ie/Malcolm.Tyrrell/
Amiga Version
Copyright (C) 2003-2004 Ventzislav Tzvetkov
http://hirudov.com/
Gameboy Version
Copyright (C) 2003-2004 Ventzislav Tzvetkov
http://hirudov.com/
Developed using GBDK v2.1.0-1 and Wzonka-Lad 1.03.00.
Oric Atmos Version
Copyright (C) 2004 Ventzislav Tzvetkov
http://hirudov.com/
Apple II Version
Copyright (C) 2004 Ventzislav Tzvetkov
http://hirudov.com/
Commodore 64 Version
Copyright (C) 2004 Ventzislav Tzvetkov
http://hirudov.com/
SNES version
Copyright (C) 2004-2006 Ventzislav Tzvetkov
http://hirudov.com/
CP/M version
Copyright (C) 2004-2008 Ventzislav Tzvetkov
http://hirudov.com/
Compiled using Z88DK on AmigaOS 4.
Tested under DOSBox and MYZ80 emulator.

582
MazezaM/mazezam.c Normal file
View File

@ -0,0 +1,582 @@
/*
MazezaM
Copyright (C) 2002
Malcolm Tyrrell
tyrrelmr@cs.tcd.ie
CP/M version (C) 2004-2008
Ventzislav Tzvetkov
http://drhirudo.hit.bg
z88dk version by Stefano Bodrato (www.z88dk.org)
VT100 version by Anna Christina Naß <acn@acn.wtf>
Build:
zcc +cpm -lndos -o MAZEZAM.COM mazezam.c -O3
This code may be used and distributed under
the terms of the GNU General Public Licence.
*/
#pragma output hrgpage = 36096
#include <stdio.h> // We use printf(); putchar();
#include <string.h> // strlen for the Level name centering.
#define LEVELS 12 // Number of Levels
#define TRUE 1
#define FALSE 0
#define PLAYER "P" // player symbol
#define BRICK ":" // brick symbol
#define COLWAY 15 // color of entrance and exit
#define COLDOOR 15 // color of entrance door
#define COLPLAYER 14 // color of player
#define COLBRICK 8 // color of bricks
unsigned int uLives,uWidth,uHeight, i, j, l, t, r, rx, lx, bCloseFlag=FALSE, Column;
/* Global miscellaneous variables - i,j for loops and Player coordinates,
t,r,rx,lx - for the Level build. */
char *MazeLine[12], // Text pointer to the Level (Max 12 lines)
Mazezam[200], // Storage of the level.
PressedKey; // Which key is pressed.
static char *ARGH[]={
"ARGH!",
"OUCH!",
"GRRR!",
"NOOU!",
"NAAH!",
"UUUF!",
"AAAH!",
"OUUF!",
"PUFF!"
};
/* We use escape control combinations for handling of the display */
ClearScreen()
{
printf("\033[2J\033[H");
}
InverseOn()
{
printf("\033[7m");
}
InverseOff()
{
printf("\033[0m");
}
ResetAttr()
{
printf("\033[0m");
}
FgCol(color)
int color;
{
if(color<8)
printf("\033[3%dm", color);
if(color>=8)
printf("\033[3%d;1m", color-8); // bright colors begin at 8
}
BgCol(color)
int color;
{
char str[6];
printf("\033[4%dm", color);
}
PrintPlayer()
{
FgCol(COLPLAYER);
printf(PLAYER);
ResetAttr();
}
ColorLine(line)
int line;
{
FgCol(line);
}
void PrintEnter()
{
printf("\n");
}
void FillRow()
{
FgCol(COLBRICK);
for (Column=0;Column<80;Column++) printf(BRICK);
ResetAttr();
PrintEnter();
}
void FillWall()
{
FgCol(COLBRICK);
for (l=0;l<26;l++) printf(BRICK);
ResetAttr();
}
void FillSpace()
{
for (l=0;l<28;l++) printf(" ");
}
void gotogxy(int x,int y)
{
printf("\033[%d;%dH",y+1,x+1); // Console sequence for setting cursor to X,Y position.
}
void Level(int MazeNumber)
{
int k;
char *LevelName; // Pointer to the Level name string.
ClearScreen();
switch (MazeNumber)
{
case 1:
LevelName="Humble Origins";uWidth=7;uHeight=2;lx=rx=1;
MazeLine[1]=" # # ";
MazeLine[2]=" # ## ";
break;
case 2:
LevelName="Easy Does It";uWidth=8;uHeight=lx=3;rx=2;
MazeLine[1]=" # ###";
MazeLine[2]=" # # # ";
MazeLine[3]=" # # # ";
break;
case 3:
LevelName="Up, Up and Away";uWidth=5;uHeight=lx=11;rx=1;
MazeLine[1]= " # ";
MazeLine[2]= " # ##";
MazeLine[3]= " ## ";
MazeLine[4]= "# # ";
MazeLine[5]= " # # ";
MazeLine[6]= " ### ";
MazeLine[7]= "# # ";
MazeLine[8]= " # # ";
MazeLine[9]= " # # ";
MazeLine[10]="# ## ";
MazeLine[11]=" # ";
break;
case 4:
LevelName="Little Harder";uWidth=5;uHeight=4;lx=2;rx=1;
MazeLine[1]=" # # ";
MazeLine[2]=" # #";
MazeLine[3]=" # ";
MazeLine[4]=" ## #";
break;
case 5:
LevelName="To and Fro";uWidth=13;uHeight=6;lx=rx=1;
MazeLine[1]=" ##### ";
MazeLine[2]="# ##### ### ";
MazeLine[3]=" # ### #### ";
MazeLine[4]="# # ####### ";
MazeLine[5]=" ### # ## ";
MazeLine[6]="# # # ## # ";
break;
case 6:
LevelName="Loop-de-Loop";uWidth=14;uHeight=4;lx=2;rx=4;
MazeLine[1]=" ##### ## ## ";
MazeLine[2]=" ## ## ## ";
MazeLine[3]="## # ## ### ";
MazeLine[4]=" ######## #";
break;
case 7:
LevelName="Somehow Easy";uWidth=5;uHeight=rx=3;lx=1;
MazeLine[1]=" ## ";
MazeLine[2]=" # ";
MazeLine[3]=" # ##";
break;
case 8:
LevelName="Be Prepared";uWidth=7;uHeight=6;lx=5;rx=3;
MazeLine[1]=" # ";
MazeLine[2]=" #### ";
MazeLine[3]=" ### ##";
MazeLine[4]=" # # # ";
MazeLine[5]=" # ## ";
MazeLine[6]="# ## ";
break;
case 9:
LevelName="Two Front Doors";uWidth=16;uHeight=rx=7;lx=1;
MazeLine[1]=" ####### ";
MazeLine[2]=" #### #### # # ";
MazeLine[3]="## ## ###### # #";
MazeLine[4]="## # # ";
MazeLine[5]=" ############# ";
MazeLine[6]=" # ## # ### ";
MazeLine[7]=" # ### ##";
break;
case 10:
LevelName="Through, through";uWidth=15;uHeight=4;lx=3;rx=1;
MazeLine[1]=" #### #### ##";
MazeLine[2]=" # ## ## # ## ";
MazeLine[3]=" # ## #### ## ";
MazeLine[4]=" # ## #### # ";
break;
case 11:
LevelName="Double Cross";uWidth=9;uHeight=lx=7;rx=3;
MazeLine[1]=" # #### ";
MazeLine[2]=" # # ## ";
MazeLine[3]=" # #### #";
MazeLine[4]="# ## # ";
MazeLine[5]=" # ###";
MazeLine[6]=" ###### ";
MazeLine[7]=" # ";
break;
case 12:
LevelName="Inside Out";uWidth=14;uHeight=10;lx=8;rx=1;
MazeLine[1]= " # ";
MazeLine[2]= " ########## #";
MazeLine[3]= " ### ## ";
MazeLine[4]= " # ######## # ";
MazeLine[5]= " ### ### ### ";
MazeLine[6]= " ### # ### ";
MazeLine[7]= " # ####### ## ";
MazeLine[8]= " # # # ### ";
MazeLine[9]= " ############ ";
MazeLine[10]=" ";
break;
default:
ClearScreen();
gotogxy(9,7);
printf("Congratulations!");
gotogxy(2,8);
printf("You've completed the MazezaM");
gotogxy(12,10);
InverseOn();
printf("Well Done!");
InverseOff();
bCloseFlag=TRUE;
getkey();
break;
}
if (bCloseFlag) return;
for (i=1;i<uHeight+1;i++) strcpy(&Mazezam[i*uWidth],MazeLine[i]); // Copy the Level Data.
l=((80-uWidth)/2);
t=((22-uHeight)/2);
r=80-l-uWidth;
FgCol(COLBRICK); printf(BRICK); printf(BRICK);printf(BRICK); ResetAttr();
printf(" Level ");
if (MazeNumber<10) printf("0%d ",MazeNumber);
else printf("%d ",MazeNumber);
FgCol(COLBRICK); for (i=0;i<50;i++) printf(BRICK); ResetAttr();
printf(" Lives ");
if (uLives<10) printf("0%d",uLives);
else printf("%d",uLives);
FgCol(COLBRICK); printf(" "); printf(BRICK); printf(BRICK); printf(BRICK); PrintEnter(); ResetAttr();
for (i=1;i!=t+1;i++) FillRow();
for (i=1;i!=uHeight+1;i++)
{
if (i==lx) for (k=0;k!=l;k++) { FgCol(COLWAY); printf("_"); ResetAttr(); }
if (i!=lx) for (k=0;k!=l;k++) { FgCol(COLBRICK); printf(BRICK); ResetAttr(); }
ColorLine(i); printf(MazeLine[i]); ResetAttr(); // Print the Level line.
if (i==rx) for (k=0;k!=r;k++) { FgCol(COLWAY); printf("_"); ResetAttr(); }
if (i!=rx) for (k=0;k!=r;k++) { FgCol(COLBRICK); printf(BRICK); ResetAttr(); }
PrintEnter();
}
FgCol(COLBRICK); for (i=t+uHeight+1;i!=22;i++) FillRow(); ResetAttr();
j=strlen(LevelName);
FgCol(COLBRICK); for (k=0;k!=((78-j)/2);k++) printf(BRICK); ResetAttr();
printf(" ");
printf(LevelName);
printf(" ");
FgCol(COLBRICK); for (k=0;k!=((78-j)/2);k++) printf(BRICK); ResetAttr();
PrintEnter();
for (i=0;i!=l;i++)
{
gotogxy(i+1,t+lx);
PrintPlayer(); //Start animation
gotogxy(i,t+lx);
FgCol(COLWAY);
printf("_"); // Fill after
}
gotogxy(l-1,t+lx);
FgCol(COLDOOR); printf("O");
PrintPlayer();
i=lx;
j=1;
}
void Title()
{
ClearScreen();
gotogxy(0,2);
FillRow();
FillWall(); BgCol(7); FgCol(13);
printf(" M"); FgCol(10); printf(" a"); FgCol(11); printf(" z");
FgCol(12); printf(" e"); FgCol(11); printf(" z"); FgCol(10); printf(" a");
FgCol(13); printf(" M "); ResetAttr();
FillWall(); PrintEnter();
FillRow();
FillWall(); FillSpace(); FillWall(); PrintEnter();
FillWall(); printf(" CPM version (C) 2004-08 by "); FillWall(); PrintEnter();
FillWall(); printf(" Ventzislav Tzvetkov "); FillWall(); PrintEnter();
FillWall(); printf(" VT100 color (C) 2020 by "); FillWall(); PrintEnter();
FillWall(); printf(" Anna Christina Nass "); FillWall(); PrintEnter();
FillWall(); FillSpace(); FillWall(); PrintEnter();
FillWall(); FillSpace(); FillWall(); PrintEnter();
FillRow();
PrintEnter();
PrintEnter();
printf(" Keys: 8 ^ r - retry level\n");
printf(" | q - quit\n");
printf(" 4 <--+--> 6 \n");
printf(" |\n");
printf(" v 2 Press SPACE to start\n");
printf(" (or use WASD keys)\n");
uLives=3;
Column=40;
for (;;)
{
gotogxy(Column,11);
PrintPlayer();
PressedKey=getkey();
if (PressedKey==' ') break;
if (PressedKey=='Q' || PressedKey=='q')
{
bCloseFlag=TRUE;
break;
}
if (PressedKey=='6')
{
gotogxy(Column,11);
Column+=(Column<53);
printf(" ");
}
if (PressedKey=='4')
{
gotogxy(Column,11);
Column-=(Column>26);
printf(" ");
}
}
}
int main()
{
int Mazeno,Loop,rand;
printf("\033[?25l"); // Hide Cursor escape sequence
for (;;)
{
Title();
Mazeno=1;
if (bCloseFlag) break;
Level(Mazeno);
for(;;)
{
PressedKey=getkey();
// restart level
if (PressedKey=='R' || PressedKey=='r')
{
uLives--;
if (uLives<1) PressedKey='q';
else
{
gotogxy(l+j-3,t+i-1);
InverseOn();
printf(ARGH[rand%9]);
InverseOff();
getkey();
Level(Mazeno);
}
}
// quit
if (PressedKey=='Q' || PressedKey=='q')
{
//gotogxy(l+j-3,t+i-1);
//InverseOn();
//printf(ARGH[rand%9]);
//InverseOff();
//getkey();
gotogxy(35,10);
InverseOn();
printf("GAME OVER!");
InverseOff();
getkey();
bCloseFlag=TRUE;
break;
}
// right - level cleared
if ((PressedKey=='6' || PressedKey=='D' || PressedKey=='d') && (i==rx && j==uWidth))
{
gotogxy(l+j-1,t+i);
printf(" ");
for (i=l+uWidth;i!=80;i++)
{
gotogxy(i,t+rx);
PrintPlayer();
gotogxy(i,t+rx);
FgCol(COLWAY); printf("_"); ResetAttr();
}
InverseOn();
i=t+rx;
switch (rand%6)
{
case 0:
gotogxy(13,i);
printf("Hurray!");
break;
case 1:
gotogxy(13,i);
printf("Hurrah!");
break;
case 2:
gotogxy(16,i);
printf("Yes!");
break;
case 3:
gotogxy(14,i);
printf("Great!");
break;
case 4:
gotogxy(12,i);
printf("Yee-hah!");
break;
default:
gotogxy(16,i);
printf("Yay!");
}
InverseOff();
getkey();
uLives++;
Level(++Mazeno);
PressedKey=0;
}
// right
if ((PressedKey=='6' || PressedKey=='D' || PressedKey=='d') && j<uWidth)
if ((Mazezam[i*uWidth+j])==' ')
{
gotogxy(l+j-1,t+i);
printf(" ");
j++;
gotogxy(l+j-1,t+i);
PrintPlayer();
}
else
if (Mazezam[(i*uWidth)+uWidth-1]==' ')
{
j++;
for (Loop=uWidth-1;Loop>0;Loop--)
Mazezam[(i*uWidth)+Loop]=Mazezam[(i*uWidth)+Loop-1];
Mazezam[i*uWidth]=' ';
gotogxy(l,t+i);
for (Loop=0;Loop<uWidth;Loop++)
{
ColorLine(i);
putchar(Mazezam[i*uWidth+Loop]);
ResetAttr();
}
gotogxy(l+j-1,t+i);
PrintPlayer();
}
// left
if ((PressedKey=='4' || PressedKey=='A' || PressedKey=='a') && j>1)
if (Mazezam[(i*uWidth)+j-2]==' ')
{
gotogxy(l+j-1,t+i);
printf(" ");
j--;
gotogxy(l+j-1,t+i);
PrintPlayer();
}
else
if (Mazezam[i*uWidth]==' ')
{
j--;
for (Loop=1;Loop!=uWidth;Loop++)
Mazezam[(i*uWidth)+Loop-1]=Mazezam[(i*uWidth)+Loop];
Mazezam[(i*uWidth)+uWidth-1]=' ';
gotogxy(l,t+i);
for (Loop=0;Loop<uWidth;Loop++)
{
ColorLine(i);
putchar(Mazezam[i*uWidth+Loop]);
ResetAttr();
}
gotogxy(l+j-1,t+i);
PrintPlayer();
}
// down
if ((PressedKey=='2' || PressedKey=='S' || PressedKey=='s') && i<uHeight)
if (Mazezam[((i+1)*uWidth)+j-1]==' ')
{
gotogxy(l+j-1,t+i);
printf(" ");
i++;
gotogxy(l+j-1,t+i);
PrintPlayer();
}
// up
if ((PressedKey=='8' || PressedKey=='W' || PressedKey=='w') && i>1)
if (Mazezam[((i-1)*uWidth)+j-1]==' ')
{
gotogxy(l+j-1,t+i);
printf(" ");
i--;
gotogxy(l+j-1,t+i);
PrintPlayer();
}
PressedKey=0;
if (bCloseFlag) break;
rand++;
}
if (bCloseFlag) break;
}
ClearScreen();
printf("\033[?25h"); // Show Cursor escape sequence
return 0;
}

View File

@ -32,6 +32,7 @@ See this repository: https://git.imzadi.de/acn/backgammon-vt100
* [FindThatMine](FindThatMine/) * [FindThatMine](FindThatMine/)
* [Snake](Snake/) * [Snake](Snake/)
* [Robot Chase](RobotChase/) * [Robot Chase](RobotChase/)
* [MazezaM](MazezaM/)
## More Games on the Interwebs ## More Games on the Interwebs