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 d

⟦e3b067f50⟧ TextFile

    Length: 3326 (0xcfe)
    Types: TextFile
    Names: »display.c«

Derivation

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

TextFile

#include "wand_head.h"

extern int debug_disp;

void map(row_ptr)
char (*row_ptr)[ROWLEN+1];
{
int  x,y;
char ch;
move(0,0);
addch('+');
for(x = 0;x < ROWLEN; x++)
    addch('-');
addch('+');
for(y = 0;y < NOOFROWS; y++)
    {
    move(y+1,0);
    addch('|');
    for(x = 0; x < ROWLEN; x++)
	{
	ch = (*row_ptr)[x];
	if(!debug_disp)
	    {
	    if((ch == 'M')||(ch == 'S'))
		ch = ' ';
	    addch(ch);
	    }
	else
            if(ch==' '||ch=='#'||ch=='<'||ch=='>'||ch=='O'||ch==':'||
	       ch=='/'||ch=='\\'||ch=='*'||ch=='='||ch=='@'||ch=='T'||
	       ch=='X'||ch=='!'||ch=='M'||ch=='S'||ch=='C'||ch=='+'||
               ch=='A'||ch=='^')
		addch(ch);
	    else
		addch('"');
	}
    addch('|');
    row_ptr++;
    }
move(y+1,0);
addch('+');
for(x = 0;x < ROWLEN; x++)
    addch('-');
addch('+');
if(!debug_disp)
    {
    move(18,0);
    addstr("Press any key to return to the game.");
    refresh();
    (void) getchar();
    move(18,0);
    addstr("                                    ");
    refresh();
    for(y=0;y<=(NOOFROWS+1);y++)
        {
        move(y,0);
        for(x=0;x<=(ROWLEN+2);x++)
	    addch(' ');
	}
    }
else
    refresh();
}

void display(cx,cy,row_ptr,score)
char (*row_ptr)[ROWLEN+1];
int  cx,cy,score;
{
    int  x,y = 0,
         x_coord,y_coord;
    char ch;
    while(y<(cy-3))
    {
        y++;
        row_ptr++;
    };
    move(0,0);
    addstr("+---------------------------------+");
    move(15,0);
    addstr("+---------------------------------+");
    for(y=(cy-3);y<=(cy+3);y++)
    {
        y_coord = (y+3-cy)*2;
        if ((y<0) || (y>=NOOFROWS))
        {
            move(y_coord+1,0);
            addstr("|#################################|");
            move(y_coord+2,0);
            addstr("|#################################|");
        }
        else
	{
	    move(y_coord+1,0);
            addch('|');
	    move(y_coord+1,34);
            addch('|');
	    move(y_coord+2,0);
            addch('|');
	    move(y_coord+2,34);
            addch('|');
            for(x=(cx-5);x<=(cx+5);x++)
            {
                x_coord = (x+5-cx)*3;
                if ((x<0) || (x>ROWLEN-1))
                    draw_symbol(x_coord,y_coord,'#');
                else
                {
                    ch = (*row_ptr)[x];
                    draw_symbol(x_coord,y_coord,ch);
                }
            };
	    row_ptr++;
        }                   /*   end if   */
    }                       /* end y loop */
    move(16,0);
    refresh();
}
void redraw_screen(maxmoves,num,score,nf,diamonds,mx,sx,sy,frow)
int maxmoves,num,score,nf,diamonds,mx,sx,sy;
char **frow;
{
char buffer[50];
clear();
move(0,48);
(void) addstr("Score\t   Diamonds");
move(1,48);
(void) addstr("\tFound\tTotal");
move(3,48);
(void) sprintf(buffer,"%d\t %d\t %d  ",score,nf,diamonds);
(void) addstr(buffer);
move(6,48);
(void) sprintf(buffer,"Current screen %d",num);
(void) addstr(buffer);
if(maxmoves != 0)
(void) sprintf(buffer,"Moves remaining = %d   ",maxmoves);
else
{
    (void) strcpy(buffer,"     Unlimited moves     ");
    maxmoves = -1;
};
move(15,48);
(void) addstr(buffer);
if(mx != -1)                            /* tell player if monster exists */
    draw_symbol(48,10,'M');
else
    draw_symbol(48,10,' ');
if(!debug_disp)
    display(sx,sy,frow,score);
else
    map(frow);
}