home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume6
/
ega-wanderer
/
part03
/
help.c
next >
Wrap
C/C++ Source or Header
|
1989-02-14
|
8KB
|
349 lines
#include "wand_head.h"
char *text1[]={
/* 0 */ " ** W A N D E R E R **",
/* 1 */ " ===========================",
/* 2 */ " by Steven Shipway",
/* 3 */ "How to play:",
/* 4 */ " Collect all the treasure: %*",
/* 5 */ "",
/* 6 */ " Then go through the exit: %X",
/* 7 */ "",
/* 8 */ " %h Left %j Down",
/* 9 */ " %k Up %l Right",
/* 10 */ " 1 Loud q Quit game",
/* 11 */ " 0 Quiet v Look at map",
/* 12 */ " S Save game R Restore Game",
/* 13 */ " ? Help mode @ Center screen",
/* 14 */ " ~ Jump level # Switch mode",
/* 15 */ " (no bonus) ^L Redraw screen",
NULL
},
*text2[]={
/* 0 */ "This is you: You are a spider.",
/* 1 */ " %@ (At least, that's",
/* 2 */ " what you look like)",
/* 3 */ "",
/* 4 */ "The other items you will find are:",
/* 5 */ "",
/* 6 */ " %# %=",
/* 7 */ " and Solid rock",
/* 8 */ " %C",
/* 9 */ " Time capsule (5 points,",
/* 10 */ " +250 extra moves)",
/* 11 */ " %:",
/* 12 */ " Passable earth (one point)",
/* 13 */ "",
/* 14 */ " %T Teleport (50 points for",
/* 15 */ " using it)",
NULL
},
*text3[]={
/* 0 */ " %O Boulder (falls down, other",
/* 1 */ " boulders and arrows fall",
/* 2 */ " off of it)",
/* 3 */ "",
/* 4 */ " %< %> Arrows",
/* 5 */ " and (fly left and right)",
/* 6 */ "",
/* 7 */ " %+ Cage - holds baby monsters",
/* 8 */ " and changes into diamonds",
/* 9 */ "",
/* 10 */ " %* (10 points)",
/* 11 */ " Money (collect it)",
/* 12 */ "",
/* 13 */ " %S Baby monster (kills you)",
/* 14 */ "",
NULL
},
*text4[]={
/* 0 */ "When a baby monster hits a cage it",
/* 1 */ "is captured and you get 50 points.",
/* 2 */ "The cage also becomes a diamond.",
/* 3 */ "",
/* 4 */ " %! Instant annihilation ",
/* 5 */ "",
/* 6 */ "",
/* 7 */ " %\\ %/ Slopes (boulders",
/* 8 */ " and and etc. slide off)",
/* 9 */ "",
/* 10 */ " %M Monster (eats you up whole.",
/* 11 */ " Yum Yum yum..) (100 points)",
/* 12 */ " (kill with a rock or arrow)",
/* 13 */ "",
/* 14 */ " %X Exit -- Must Collect all the",
/* 15 */ " treasure first. (250 bonus)",
NULL
},
*text5[]={
/* 0 */ " %^ Balloons rise and are popped",
/* 1 */ " by arrows. It does not kill",
/* 2 */ " you.",
/* 3 */ "",
/* 4 */ "",
/* 5 */ " %? Unrecognised symbol in map.",
/* 6 */ " This is probably a **bug** !",
/* 7 */ "",
/* 8 */ " Environment variables:",
/* 9 */ "",
/* 10 */ " NEWNAME,NAME : Checked in that",
/* 11 */ " order for the hiscore table",
/* 12 */ " NEWKEYS : Redefine movement keys",
/* 13 */ " (default \"hlkj\")",
/* 14 */ " SAVENAME : File used for saved",
/* 15 */ " games.",
NULL
};
char **texthelp[] ={ text1, text2, text3, text4, text5, NULL };
#ifdef EGA
#include "bitmap.h"
extern bitmap *b48x48[];
extern char *EGAaddr;
char author1[] =" ** W A N D E R E R **";
char author2[] =" by Steven Shipway";
char *ega1[] ={
author1,
author2,
"",
"",
"Environment variables:",
"",
" NEWNAME,NAME,FULLNAME,USER,LOGNAME : Checked in that order for your name",
"",
" NEWKEYS : Redefine movement keys (default \"hlkj\")",
"",
" SAVENAME : File used for saved games",
"",
"",
"",
"How to play:",
" %* %X",
"",
" Collect all the treasure: then go through the exit:",
"",
"",
"",
"",
"",
" Keys are: %h Left %j Down",
" %k Up %l Right",
" 1 Loud q Quit game",
" 0 Quiet v Look at map",
" S Save game R Restore game",
" ? Help @ Center screen",
" ~ Jump level (lose # Switch mode",
" bonus) ^L Redraw screen",
NULL
},
*ega2[]={
author1,
author2,
"",
"Screen Items:",
" %@",
"",
" This is You:",
"",
"",
"",
"",
" The other items you will find are:",
"",
" %# %= %: %!",
"",
"",
"",
"",
"",
" Solid rock Passable earth Land mine",
" (1 point)",
"",
"",
" %* %X %C",
"",
"",
"",
"",
"",
" Money - 10 points Exit - 250 points Time capsule - 5 points",
" (collect all the (250 extra moves)",
" treasures first)",
NULL
},
*ega3[]={
author1,
author2,
"",
" %O %^",
" Boulders (fall down, Balloons (rise up)",
" other boulders fall off,",
" arrows slide off)",
"",
"",
" %< %> %\\ %/",
" Arrows (fly left Slopes (boulders,",
" and right, will balloons and arrows",
" pop balloons) slide off)",
"",
"",
"",
" %M %S",
"",
"",
"",
"",
"",
" Monster - 100 points Baby monster - 50 points",
" (eats you up whole) (kills you)",
"",
" Kill with a rock or arrow When baby monster hits a cage, it",
" is trapped and turns into a diamond",
"",
" %T %+",
" Teleport Cage",
" 50 points for",
" using it",
NULL
};
char **egahelp[] ={ ega1, ega2, ega3, NULL };
#endif
/* remember locations of graphics symbols */
struct graphics
{
int x, y, c;
}
coordinates[10], *nextcoordinate;
static char *blank = " ";
static
char *
expand( y, line, keys )
char *line;
char *keys;
{
static char expansion[100];
char *p;
int c;
for( p = expansion; c = *line++; )
{
if ( c == '%' )
{
if ( (c = *line++) != '%' )
switch( c )
{
case 'h': c = keys[2]; break;
case 'j': c = keys[1]; break;
case 'k': c = keys[0]; break;
case 'l': c = keys[3]; break;
default:
nextcoordinate->y = y;
nextcoordinate->x = p - expansion;
nextcoordinate++->c = c;
c = ' ';
break;
}
}
*p++ = c;
}
*p = '\0';
return( expansion );
}
static
int
dopage( page, keys )
char **page;
char *keys;
{
struct graphics *p;
char *line;
int y;
nextcoordinate = coordinates;
#ifdef EGA
if (EGAaddr)
clear();
#endif
for( y = 0; line = *page++; ++y )
{
line = expand( y, line, keys );
#ifdef EGA
if ( EGAaddr )
egaputs( 0, 10*y, line );
else
#endif
mvprintw(y,0,"%-*s",ROWLEN+2,line);
}
if ( nextcoordinate > coordinates )
for( p = coordinates; p < nextcoordinate; ++p )
#ifdef EGA
if ( EGAaddr )
egapaint( 8*p->x, 10*p->y, b48x48[symbol(p->c)] );
else
#endif
draw_symbol( p->x-1, p->y-1, p->c );
#ifdef EGA
if ( EGAaddr )
egaputs( 4+8*(80-44)/2, 341, "Press <return> to continue, <space> to exit." );
else
#endif
{
while( y < 16 )
mvaddstr(y++,0,blank);
mvaddstr(16,0,blank);
mvaddstr(16+1,0,"<return> to continue, <space> to exit ");
}
refresh();
return( getch() );
}
void
helpme(keys) /* routine to show help menu. */
char *keys;
{
char ***pages, **page;
#ifdef EGA
if ( EGAaddr )
pages = egahelp;
else
#endif
pages = texthelp;
while( page = *pages++ )
if( dopage(page,keys) == ' ' )
break;
#ifdef EGA
if ( ! EGAaddr )
#endif
{
mvaddstr(16,0,blank);
mvaddstr(16+1,0,blank);
}
}