diff --git a/MazezaM/MAZEZAM.COM b/MazezaM/MAZEZAM.COM new file mode 100644 index 0000000..898e76f Binary files /dev/null and b/MazezaM/MAZEZAM.COM differ diff --git a/MazezaM/README.md b/MazezaM/README.md new file mode 100644 index 0000000..9aa4497 --- /dev/null +++ b/MazezaM/README.md @@ -0,0 +1,93 @@ +# MazezaM + +MazezaM is a puzzle game for CP/M. + +* Copyright (C) 2002 Malcolm Tyrrell +* 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ß + +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. + diff --git a/MazezaM/mazezam.c b/MazezaM/mazezam.c new file mode 100644 index 0000000..7e0b7f9 --- /dev/null +++ b/MazezaM/mazezam.c @@ -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ß + + 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 // We use printf(); putchar(); +#include // 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 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') && j0;Loop--) + Mazezam[(i*uWidth)+Loop]=Mazezam[(i*uWidth)+Loop-1]; + Mazezam[i*uWidth]=' '; + gotogxy(l,t+i); + for (Loop=0;Loop1) + 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;Loop1) + 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; +} diff --git a/README.md b/README.md index 9f8e807..063b18e 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ See this repository: https://git.imzadi.de/acn/backgammon-vt100 * [FindThatMine](FindThatMine/) * [Snake](Snake/) * [Robot Chase](RobotChase/) +* [MazezaM](MazezaM/) ## More Games on the Interwebs