DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T e

⟦5529fe054⟧ TextFile

    Length: 3942 (0xf66)
    Types: TextFile
    Names: »edit.c.orig«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Wanderer/edit.c.orig« 

TextFile

#include "wand_head.h"

extern char *playscreen();

extern int debug_disp;
extern char screen[NOOFROWS][ROWLEN+1];

/* Print instructions around the screen */
void instruct()
{
static char *inst[] = { "O   Boulder",
			"< > Arrows",
			":   Earth",
			"!   Landmine",
			"*   Treasure",
			"/ \\ Deflectors",
			"+   Cage",
			"= # Rock",
			"T   Teleport (1 max)",
			"A   Arrival (1 max)",
			"X   Exit (always 1)",
			"@   Start (always 1)",
			"M   Big Monster (1 max)",
			"S   Baby Monster",
			"-   Alternative space",
			"C   Time Capsule" };
int loop;
for(loop = 1;loop < 17; loop++)
    {
    move(loop,55);
    addstr(inst[loop-1]);
    }
move(21,0);
addstr("Use wanderer keys to move. q = quit, p/n = play, m = change no. of moves.");
}

void noins()
{
int loop;
for(loop =1;loop < 17; loop++)
    {
    move(loop,55);
    addstr("                       ");
    }
move(21,0);
addstr("                                                                            ");
}

/* Actual edit function */

void editscreen(num,score,bell,maxmoves,keys)
int  num, maxmoves,
     *bell,
     *score;
char keys[10];
{
int  x,y,sx=0,sy=0,quit=0,nx,ny;
char (*frow)[ROWLEN+1] = screen,
     ch;
char buffer[50];
char *howdead;

for(x=0;x<=ROWLEN;x++)
    for(y=0;y<NOOFROWS;y++)
	{
        if(screen[y][x] == '@')
	    {
	    sx = x;
	    sy = y;
	    }
        if(screen[y][x] == '-')
        	screen[y][x] = ' ';
        };
x=sx;
y=sy;
if(maxmoves != 0)
(void) sprintf(buffer,"Moves remaining = %d   ",maxmoves);
else
(void) strcpy(buffer,"     Unlimited moves     ");
debug_disp=1;
map(frow);
move(18,0);
addstr(buffer);

/* ACTUAL EDIT FUNCTION */

instruct();
while(!quit)
{
move(y+1,x+1);
refresh();
ch = (char)getchar();

nx=x;
ny=y;

if(ch == keys[3]||ch == keys[2]||ch == keys[1]||ch == keys[0])
    {
    if(ch == keys[3])
	    nx++;
    if(ch == keys[2])
	    nx--;
    if(ch == keys[1])
	    ny++;
    if(ch == keys[0])
            ny--;
    }
else if(ch == 'q')
    {
    move(19,0);
    addstr("                                                                          ");
    break;
    }
else if(ch == 'm')              /* change to number of moves for the screen */
    {
    move(19,0);
    addstr("How many moves for this screen? :");
    refresh();echo();
    scanf("%d",&maxmoves);noecho();
    if(maxmoves < 0 ) maxmoves = 0;
    move(19,0);
    addstr("                                           ");
    if(maxmoves != 0)
        (void) sprintf(buffer,"Moves remaining = %d   ",maxmoves);
    else
        (void) strcpy(buffer,"     Unlimited moves     ");
    move(18,0);
    addstr(buffer);
    refresh();            /* for some reason, this seems to add a '.' to */
			  /* the map... Ive no idea why yet... */
    }
else if(ch == 'p' || ch == 'n')       /* play the game (test) */
    {
	noins();
	wscreen(num,maxmoves);
	if(ch == 'p')
	    {
	    debug_disp = 0;
	    clear();
	    }
	*score = 0;
	howdead = playscreen(&num,score,bell,maxmoves,keys);
	move(20,0);
	if(howdead!=0)
	    addstr(howdead);
	else
	    addstr("DONE!");
	printw("; hit any key to continue\n");
	refresh();
	ch = (char)getchar();
	clear();
	rscreen(num,&maxmoves);
	debug_disp = 1;
	map(frow);
	instruct();
    }
else
    {
    if(ch >= 'a' && ch <= 'z') ch = ch - 'a' + 'A';
    if(ch < ' ' || ch == (char)127) ch = '.';  /* no ctrl codes, thankyou */
    if(ch == '"') ch = (char)getchar();
    screen[y][x] = ch;
    move(y+1,x+1);
    addch(ch);
    nx++;
    }
if(nx < 0)
    {
    nx = ROWLEN-1;
    ny--;
    }
if(nx >= ROWLEN)
    {
    nx = 0;
    ny++;
    }
if(ny < 0) ny = NOOFROWS-1;
if(ny >= NOOFROWS) ny = 0;
move(ny+1,nx+1);
x=nx;
y=ny;
}

for(y = 0; y<NOOFROWS;y++)       /* certain editors - eg ded - have a */
			         /* habit of truncating trailing spaces*/
		                 /* so this should stop them! */
    if(screen[y][ROWLEN-1] == ' ')
	screen[y][ROWLEN-1] = '-';
wscreen(num,maxmoves);
move(20,0);
refresh();
}