gandalf@spock.UUCP (Mark Halstead) (06/14/91)
I recently noticed that DEC included the particulars that mdg needed to run in Ultrix 4.2(maybe earlier I'm not sure). So I decided to try and compile it. I got undefined errors for 'tigetstr' and 'curs_set' in the main 'mdg' program. That was it. Everything elser compiled fine. After a bit of tweeking, and guessing as to possible replacements for the two undefined functions I got it to compile. Everything ran fine, except that once it started up and I got the initial display I couldn't type anything. Hmm... Anybody have any words of wisdom on the topic? -Mark p.s. I'm running a DECstation 2100 with Ultrix 4.2
schaker@triton.unm.edu (Stefan Chakerian) (06/20/91)
In the days of yore <1991Jun14.045857.2837@spock.UUCP> gandalf@spock.UUCP (Mark Halstead) writes: < <I recently noticed that DEC included the particulars that mdg needed to run <in Ultrix 4.2(maybe earlier I'm not sure). So I decided to try and compile <it. I got undefined errors for 'tigetstr' and 'curs_set' in the main 'mdg' <program. That was it. Everything elser compiled fine. After a bit of <tweeking, and guessing as to possible replacements for the two undefined <functions I got it to compile. Everything ran fine, except that once it <started up and I got the initial display I couldn't type anything. Hmm... <Anybody have any words of wisdom on the topic? < <-Mark < <p.s. I'm running a DECstation 2100 with Ultrix 4.2 I got mdg to compile on a ds3100 and Ultrix 4.0 (?) without much difficulty. I was not impressed with the playing speed of the game, so I made magic accrue much faster--you may want to set this back to the orginal. I made the treasure item selection algorithm reasonable (it was pretty horrid before). There are still two obvious bugs in the games: 1) magic can go past the maximum. That's easy to fix but I haven't bothered doing it--instead of doing a "++" to the variable, do a "+= a?b:c". Look for TIME_TO_HEAL in *.c, add this and fill in the abc's. 2) the boomerang is the most powerful item in the game. I won't elaborate on this bug, but it, too, is easy to fix. You can walk into the maze of madness with only a boomerang (and your wits) and come out with $30,000 gold, no sweat (especially if you use the answerback or X cut buffer!). There are many fixes for this bug, but I won't fix it unless too many people figure it out and start killing me. Because a bunch of people may be interested in this, here's the whole patch. It's about 600 lines or so of diffs. It's also only vaguely tested. It used to leave my terminal in a strange state upon exiting mdg, but I just hacked a fix into it and it may work now. I originally commented the bugs with my login, but just now unshared the originals and diffed my changes out. Use patch to install. Edit the makefile. I just looked and noticed a redundancy between install and install2. Life is rough. All in all, mdg is pretty good. I'm impressed and I compliment the author in his (her?) design and implementation. Unfortunately, there doesn't seem to be any real GOAL other than power. Oh well, time for mdg v2.0! stef _---_ Stefan Chakerian / o o \ schaker@triton.unm.edu, schaker@unmb.bitnet | \___/ | \_____/ Have a nice day... somewhere else. ________-----______ 8< --- cut here ----___/ \___ \_____________--- 8< *** ../Makefile Wed Jun 19 10:53:12 1991 --- Makefile Tue Jun 4 10:50:30 1991 *************** *** 6,13 **** SHELL = /bin/sh ! CFLAGS = -g DOBJSA = dmain.o seg.o monsters.o msghandler.o findplayer.o godpower.o DOBJSB = players.o random.o combat.o effect.o ranged.o speak.o dmsg.o DOBJSC = spells.o improve.o dident.o magic.o traps.o loadconfig.o --- 6,19 ---- SHELL = /bin/sh ! CFLAGS = -g -O ! CC = gcc ! LIBS = -lcurses -ltermcap + BINDIR = /u18/schaker/bin/mipsel + # this must match "GAME_HOME" in files.h + LIBDIR = /u18/schaker/lib/mdg_dir + DOBJSA = dmain.o seg.o monsters.o msghandler.o findplayer.o godpower.o DOBJSB = players.o random.o combat.o effect.o ranged.o speak.o dmsg.o DOBJSC = spells.o improve.o dident.o magic.o traps.o loadconfig.o *************** *** 28,51 **** all : $(PROGS) mdg_daemon : $(DOBJSA) $(DOBJSB) $(DOBJSC) ! cc $(CFLAGS) -o mdg_daemon $(DOBJSA) $(DOBJSB) $(DOBJSC) mdg : $(GOBJSA) $(GOBJSB) ! cc $(CFLAGS) -o mdg $(GOBJSA) $(GOBJSB) -ltinfo mdg_clock : $(COBJS) ! cc $(CFLAGS) -o mdg_clock $(COBJS) mdg_save : mdg_stop ln mdg_stop mdg_save mdg_stop : $(SOBJS) ! cc $(CFLAGS) -o mdg_stop $(SOBJS) mdg_char : $(EOBJS) ! cc $(CFLAGS) -o mdg_char $(EOBJS) -ltinfo ident : $(IOBJS) ! cc $(CFLAGS) -o ident $(IOBJS) # end of Makefile. --- 34,71 ---- all : $(PROGS) mdg_daemon : $(DOBJSA) $(DOBJSB) $(DOBJSC) ! $(CC) $(CFLAGS) -o mdg_daemon $(DOBJSA) $(DOBJSB) $(DOBJSC) mdg : $(GOBJSA) $(GOBJSB) ! $(CC) $(CFLAGS) -o mdg $(GOBJSA) $(GOBJSB) $(LIBS) mdg_clock : $(COBJS) ! $(CC) $(CFLAGS) -o mdg_clock $(COBJS) mdg_save : mdg_stop ln mdg_stop mdg_save mdg_stop : $(SOBJS) ! $(CC) $(CFLAGS) -o mdg_stop $(SOBJS) mdg_char : $(EOBJS) ! $(CC) $(CFLAGS) -o mdg_char $(EOBJS) $(LIBS) ident : $(IOBJS) ! $(CC) $(CFLAGS) -o ident $(IOBJS) ! ! install: $(PROGS) install2 ! -mkdir $(LIBDIR) ! -mkdir $(LIBDIR)/bin ! -mkdir $(LIBDIR)/players ! mv ident mdg_clock $(LIBDIR)/bin ! cp mdg_dir/default $(LIBDIR)/players ! cp mdg_dir/item.start mdg_dir/map.start mdg_dir/monster.start mdg_dir/note.start $(LIBDIR) ! ! install2: $(PROGS) ! strip $(PROGS) ! mv mdg_char mdg_daemon mdg_stop mdg $(BINDIR) ! ln $(BINDIR)/mdg_stop $(BINDIR)/mdg_save ! mv ident mdg_clock $(LIBDIR)/bin # end of Makefile. *** ../clock.c Wed Jun 19 10:53:13 1991 --- clock.c Tue Jun 4 10:50:34 1991 *************** *** 37,42 **** --- 37,43 ---- struct dmessage msg_buf; char *strrchr(), *strstr(); int mode; + int exit(); /* schaker */ if((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; *** ../cmain.c Wed Jun 19 10:53:05 1991 --- cmain.c Tue Jun 4 10:50:33 1991 *************** *** 102,107 **** --- 102,108 ---- random(); while(sel != 'q') { + refresh(); /* schaker */ sel = tolower(getch()); switch(sel) { *************** *** 113,118 **** --- 114,120 ---- park_csr(); clrtoeol(); addstr(" Save changes? (y/n) "); + refresh(); /* schaker */ while((ch = tolower(getch())) != 'n' && ch != 'y'); *************** *** 119,125 **** save_flag = (ch == 'y'); addch(ch); park_csr(); - refresh(); break; --- 121,126 ---- *************** *** 140,146 **** break; default : /* huh? */ ! beep(); break; } } --- 141,148 ---- break; default : /* huh? */ ! /* beep(); schaker */ ! printf("%c",'\007'); break; } } *************** *** 190,195 **** --- 192,198 ---- } addstr("; do it? (y/n) "); + refresh(); /* schaker */ while((yesno = tolower(getch())) != 'n' && yesno != 'y'); addch(yesno); *************** *** 256,261 **** --- 259,265 ---- park_csr(); clrtoeol(); addstr(" Select Spell to Study: "); + refresh(); /* schaker */ while((ch = tolower(getch())) != '\033' && (ch > 'z' || ch < 'a')); *************** *** 279,284 **** --- 283,289 ---- } addstr("; do it? (y/n) "); + refresh(); /* schaker */ while((yesno = tolower(getch())) != 'n' && yesno != 'y'); addch(yesno); *************** *** 460,465 **** --- 465,471 ---- park_csr(); clrtoeol(); addstr(" Enter new name: "); + refresh(); /* schaker */ getword(p->name, 20); *************** *** 623,628 **** --- 629,635 ---- pos--; buf[pos] = '\0'; addstr("\b \b"); + refresh(); /* schaker */ } break; case '\n' : *************** *** 637,642 **** --- 644,650 ---- buf[pos++] = ch; buf[pos] = '\0'; addch(ch); + refresh(); /* schaker */ } break; } *** ../combat.c Wed Jun 19 10:52:56 1991 --- combat.c Sat Jun 8 20:08:57 1991 *************** *** 696,702 **** switch(rnd(2)) { case 1 : ! put_item_tr(sector, x, y); break; case 2 : put_treasure(tval * 20, sector, x, y); --- 696,702 ---- switch(rnd(2)) { case 1 : ! put_item_tr(tval, sector, x, y); break; case 2 : put_treasure(tval * 20, sector, x, y); *************** *** 741,760 **** } ! put_item_tr(sector, x, y) ! int sector, x, y; { ! int i, choice; choice = -1; ! for(i = 0; i < pseg->item_count; i++) { ! if(pseg->itm[i].loc.sector == LOC_NONESUCH ! && pseg->itm[i].type != CRYSTAL ! && pseg->itm[i].type != CASH) { ! if(choice == -1 || rnd(2) == 1) ! choice = i; ! } } if(choice == -1) --- 741,764 ---- } ! put_item_tr(mval, sector, x, y) ! int mval, sector, x, y; { ! register int i, tmpi, tmpv, choice; choice = -1; ! for (i = 0; i < (pseg->item_count / 4) && choice < 0; i++) { ! tmpi = rnd(pseg->item_count) - 1; ! if (pseg->itm[tmpi].loc.sector == LOC_NONESUCH ! && pseg->itm[tmpi].type != CRYSTAL ! && pseg->itm[tmpi].type != CASH) { ! if (rnd(tmpv=pseg->itm[tmpi].value)/10 > mval ! || tmpv/40 > mval ! || (tmpv>10 && tmpv * 2 < mval)) ! continue; ! choice = tmpi; ! } } if(choice == -1) *** ../dmain.c Wed Jun 19 10:53:14 1991 --- dmain.c Wed Jun 5 08:39:50 1991 *************** *** 72,81 **** exit(1); } ! if((tmp = creat(LOCKFILE, 0)) == -1) { ! fprintf(stderr, "%s: daemon lock found, aborting...\n", ! progname); ! exit(99); } close(tmp); --- 72,90 ---- exit(1); } ! if((tmp = creat(LOCKFILE, 0444)) == -1) { ! char tmpa[20]; ! tmp = open(LOCKFILE, 0, O_RDONLY); ! (void) read(tmp, tmpa, 20); ! tmpa[19] = '\0'; ! fprintf(stderr, "%s: daemon lock found on %s, aborting...\n", ! progname, tmpa); ! exit(99); ! } else { /* schaker */ ! char tmpa[20]; ! gethostname(tmpa,20); ! tmpa[19] = '\0'; ! write(tmp, tmpa, strlen(tmpa)); } close(tmp); *************** *** 240,246 **** } ! int rename(oldname, newname) char *oldname, *newname; { unlink(newname); --- 249,255 ---- } ! int mdg_rename(oldname, newname) /* schaker */ char *oldname, *newname; { unlink(newname); *************** *** 272,278 **** return fp; } else if(mode[0] == 'w') { strcat(altfile, OLDEXT); ! rename(savefile, altfile); return fopen(savefile, "w"); } --- 281,287 ---- return fp; } else if(mode[0] == 'w') { strcat(altfile, OLDEXT); ! mdg_rename(savefile, altfile); /* schaker */ return fopen(savefile, "w"); } *** ../files.h Wed Jun 19 10:53:27 1991 --- files.h Tue Jun 4 10:50:34 1991 *************** *** 8,14 **** SCCSID @(#) files.h (1.1) created 12/25/90 */ ! #define GAME_HOME "/usr/games/mdg_dir" #define LOCKFILE "LOCK.daemon" --- 8,14 ---- SCCSID @(#) files.h (1.1) created 12/25/90 */ ! #define GAME_HOME "/u18/schaker/lib/mdg_dir" #define LOCKFILE "LOCK.daemon" *** ../gmain.c Wed Jun 19 10:52:39 1991 --- gmain.c Wed Jun 19 09:47:40 1991 *************** *** 10,15 **** --- 10,16 ---- static char *sccsx = "@(#) MDG Copyright 1990 John C. Gonnerman"; static char *sccsvers = "@(#) gmain.c\t(1.4)\tcreated 1/3/91"; + #include <termio.h> #include <curses.h> #include <fcntl.h> #include <signal.h> *************** *** 70,87 **** exit(1); } ! setupterm(NULL, 2, NULL); tputs(tigetstr("clear"), 1, eputc); fputs(BAR, stderr); fputs(TITLE, stderr); fputs(COPYRIGHT, stderr); ! fputs(PRESSMSG, stderr); fputs(INDENT, stderr); io_init(); (void)getchar(); io_reset(); fputs(WAITMSG, stderr); --- 71,94 ---- exit(1); } ! /* setupterm(NULL, 2, NULL); tputs(tigetstr("clear"), 1, eputc); + schaker */ fputs(BAR, stderr); fputs(TITLE, stderr); fputs(COPYRIGHT, stderr); ! /* fputs(PRESSMSG, stderr); */ fputs(INDENT, stderr); + /* + * Use ioctls if you must do this. tty(4) gives the appropriate calls. + */ + #if 0 io_init(); (void)getchar(); io_reset(); + #endif /* 0 */ fputs(WAITMSG, stderr); *************** *** 115,122 **** if((gseg = (struct game_msg *)shmat(gseg_id, 0, 0)) == (struct game_msg *)-1) { ! fprintf(CANTERR, progname, "attach private segment", ! sys_errlist[errno]); exit(1); } --- 122,129 ---- if((gseg = (struct game_msg *)shmat(gseg_id, 0, 0)) == (struct game_msg *)-1) { ! fprintf(stderr, CANTERR, progname, ! "attach private segment", sys_errlist[errno]); exit(1); } *************** *** 156,163 **** /* set up the terminal */ initscr(); ! curs_set(0); ! io_init(); /* we got it, let's do it! */ --- 163,170 ---- /* set up the terminal */ initscr(); ! cbreak(); ! noecho(); /* we got it, let's do it! */ *************** *** 226,231 **** --- 233,239 ---- putc(ch, stderr); } + #if 0 io_init() { *************** *** 245,250 **** --- 253,259 ---- ioctl(0, TCSETA, &save); } + #endif seg_attach() { *************** *** 282,288 **** kill(pid, SIGTERM); wait(&status); ! io_reset(); noecho(); while(getch() != '\n'); --- 291,297 ---- kill(pid, SIGTERM); wait(&status); ! /* io_reset(); schaker */ noecho(); while(getch() != '\n'); *************** *** 289,295 **** endwin(); ! tputs(tigetstr("clear"), 1, eputc); shmdt(mseg); shmdt(pseg); --- 298,304 ---- endwin(); ! /* tputs(tigetstr("clear"), 1, eputc); schaker */ shmdt(mseg); shmdt(pseg); *** ../setup.h Wed Jun 19 10:53:23 1991 --- setup.h Tue Jun 4 19:13:26 1991 *************** *** 33,40 **** #define CRYSTAL_ODDS 4 ! #define HEAL_DIV 15 ! #define CHARGE_INC 1 #define TICKSPERPACE 8 --- 33,40 ---- #define CRYSTAL_ODDS 4 ! #define HEAL_DIV 35 ! #define CHARGE_INC 2 #define TICKSPERPACE 8 *************** *** 41,47 **** #define P_ATTACKS 1 #define M_ATTACKS 1 ! #define TIME_TO_HEAL 15 #define RESURRECTION 75 #define MAX_MONSTERS 6 --- 41,47 ---- #define P_ATTACKS 1 #define M_ATTACKS 1 ! #define TIME_TO_HEAL 5 #define RESURRECTION 75 #define MAX_MONSTERS 6 -- _---_ Stefan Chakerian / o o \ schaker@triton.unm.edu, schaker@unmb.bitnet | \___/ | \_____/ Have a nice day... somewhere else.