Pack more globals into the game block structure.
This commit is contained in:
parent
bb78ca96ce
commit
62ee15c892
7 changed files with 109 additions and 101 deletions
40
actions1.c
40
actions1.c
|
@ -199,7 +199,7 @@ L9040: if(OBJ == CLAM || OBJ == OYSTER) goto L9046;
|
||||||
if(OBJ == GRATE || OBJ == CHAIN)SPK=31;
|
if(OBJ == GRATE || OBJ == CHAIN)SPK=31;
|
||||||
if(SPK != 31 || !HERE(KEYS)) return(2011);
|
if(SPK != 31 || !HERE(KEYS)) return(2011);
|
||||||
if(OBJ == CHAIN) goto L9048;
|
if(OBJ == CHAIN) goto L9048;
|
||||||
if(!CLOSNG) goto L9043;
|
if(!game.closng) goto L9043;
|
||||||
K=130;
|
K=130;
|
||||||
if(!PANIC)game.clock2=15;
|
if(!PANIC)game.clock2=15;
|
||||||
PANIC=true;
|
PANIC=true;
|
||||||
|
@ -257,7 +257,7 @@ L9070: if(OBJ == URN) goto L9073;
|
||||||
if(LIMIT < 0) return(2011);
|
if(LIMIT < 0) return(2011);
|
||||||
PROP[LAMP]=1;
|
PROP[LAMP]=1;
|
||||||
RSPEAK(39);
|
RSPEAK(39);
|
||||||
if(WZDARK) return(2000);
|
if(game.wzdark) return(2000);
|
||||||
return(2012);
|
return(2012);
|
||||||
|
|
||||||
L9073: SPK=38;
|
L9073: SPK=38;
|
||||||
|
@ -289,12 +289,12 @@ L9086: PROP[LAMP]=0;
|
||||||
/* Wave. No effect unless waving rod at fissure or at bird. */
|
/* Wave. No effect unless waving rod at fissure or at bird. */
|
||||||
|
|
||||||
L9090: if((!TOTING(OBJ)) && (OBJ != ROD || !TOTING(ROD2)))SPK=29;
|
L9090: if((!TOTING(OBJ)) && (OBJ != ROD || !TOTING(ROD2)))SPK=29;
|
||||||
if(OBJ != ROD || !TOTING(OBJ) || (!HERE(BIRD) && (CLOSNG || !AT(FISSUR))))
|
if(OBJ != ROD || !TOTING(OBJ) || (!HERE(BIRD) && (game.closng || !AT(FISSUR))))
|
||||||
return(2011);
|
return(2011);
|
||||||
if(HERE(BIRD))SPK=206+MOD(PROP[BIRD],2);
|
if(HERE(BIRD))SPK=206+MOD(PROP[BIRD],2);
|
||||||
if(SPK == 206 && LOC == PLACE[STEPS] && PROP[JADE] < 0) goto L9094;
|
if(SPK == 206 && LOC == PLACE[STEPS] && PROP[JADE] < 0) goto L9094;
|
||||||
if(CLOSED) return(18999);
|
if(game.closed) return(18999);
|
||||||
if(CLOSNG || !AT(FISSUR)) return(2011);
|
if(game.closng || !AT(FISSUR)) return(2011);
|
||||||
if(HERE(BIRD))RSPEAK(SPK);
|
if(HERE(BIRD))RSPEAK(SPK);
|
||||||
PROP[FISSUR]=1-PROP[FISSUR];
|
PROP[FISSUR]=1-PROP[FISSUR];
|
||||||
PSPEAK(FISSUR,2-PROP[FISSUR]);
|
PSPEAK(FISSUR,2-PROP[FISSUR]);
|
||||||
|
@ -399,7 +399,7 @@ L8180: if(YES(input,22,54,54)) score(1);
|
||||||
|
|
||||||
L9190: if(AT(OBJ) || (LIQ(0) == OBJ && AT(BOTTLE)) || K == LIQLOC(LOC) || (OBJ ==
|
L9190: if(AT(OBJ) || (LIQ(0) == OBJ && AT(BOTTLE)) || K == LIQLOC(LOC) || (OBJ ==
|
||||||
DWARF && ATDWRF(LOC) > 0))SPK=94;
|
DWARF && ATDWRF(LOC) > 0))SPK=94;
|
||||||
if(CLOSED)SPK=138;
|
if(game.closed)SPK=138;
|
||||||
if(TOTING(OBJ))SPK=24;
|
if(TOTING(OBJ))SPK=24;
|
||||||
return(2011);
|
return(2011);
|
||||||
|
|
||||||
|
@ -409,9 +409,9 @@ L8200: SPK=98;
|
||||||
/* 8201 */ for (I=1; I<=NOBJECTS; I++) {
|
/* 8201 */ for (I=1; I<=NOBJECTS; I++) {
|
||||||
if(I == BEAR || !TOTING(I)) goto L8201;
|
if(I == BEAR || !TOTING(I)) goto L8201;
|
||||||
if(SPK == 98)RSPEAK(99);
|
if(SPK == 98)RSPEAK(99);
|
||||||
BLKLIN=false;
|
game.blklin=false;
|
||||||
PSPEAK(I,-1);
|
PSPEAK(I,-1);
|
||||||
BLKLIN=true;
|
game.blklin=true;
|
||||||
SPK=0;
|
SPK=0;
|
||||||
L8201: /*etc*/ ;
|
L8201: /*etc*/ ;
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
|
@ -425,11 +425,11 @@ L9220: return(fill());
|
||||||
|
|
||||||
/* Blast. No effect unless you've got dynamite, which is a neat trick! */
|
/* Blast. No effect unless you've got dynamite, which is a neat trick! */
|
||||||
|
|
||||||
L9230: if(PROP[ROD2] < 0 || !CLOSED) return(2011);
|
L9230: if(PROP[ROD2] < 0 || !game.closed) return(2011);
|
||||||
BONUS=133;
|
game.bonus=133;
|
||||||
if(LOC == 115)BONUS=134;
|
if(LOC == 115)game.bonus=134;
|
||||||
if(HERE(ROD2))BONUS=135;
|
if(HERE(ROD2))game.bonus=135;
|
||||||
RSPEAK(BONUS);
|
RSPEAK(game.bonus);
|
||||||
score(0);
|
score(0);
|
||||||
|
|
||||||
/* Score. Call scoring routine but tell it to return. */
|
/* Score. Call scoring routine but tell it to return. */
|
||||||
|
@ -468,8 +468,8 @@ L8252: FOOBAR=K;
|
||||||
/* Brief. Intransitive only. Suppress long descriptions after first time. */
|
/* Brief. Intransitive only. Suppress long descriptions after first time. */
|
||||||
|
|
||||||
L8260: SPK=156;
|
L8260: SPK=156;
|
||||||
ABBNUM=10000;
|
game.abbnum=10000;
|
||||||
DETAIL=3;
|
game.detail=3;
|
||||||
return(2011);
|
return(2011);
|
||||||
|
|
||||||
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
|
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
|
||||||
|
@ -492,7 +492,7 @@ L9275: CLSHNT=YES(input,192,193,54);
|
||||||
|
|
||||||
L9280: if(OBJ == MIRROR)SPK=148;
|
L9280: if(OBJ == MIRROR)SPK=148;
|
||||||
if(OBJ == VASE && PROP[VASE] == 0) goto L9282;
|
if(OBJ == VASE && PROP[VASE] == 0) goto L9282;
|
||||||
if(OBJ != MIRROR || !CLOSED) return(2011);
|
if(OBJ != MIRROR || !game.closed) return(2011);
|
||||||
SPK=197;
|
SPK=197;
|
||||||
return(18999);
|
return(18999);
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ L9282: SPK=198;
|
||||||
|
|
||||||
/* Wake. Only use is to disturb the dwarves. */
|
/* Wake. Only use is to disturb the dwarves. */
|
||||||
|
|
||||||
L9290: if(OBJ != DWARF || !CLOSED) return(2011);
|
L9290: if(OBJ != DWARF || !game.closed) return(2011);
|
||||||
SPK=199;
|
SPK=199;
|
||||||
return(18999);
|
return(18999);
|
||||||
|
|
||||||
|
@ -533,12 +533,12 @@ L8305: DATIME(&I,&K);
|
||||||
* suspended or resumed are guaranteed to match. If unsure whether a value
|
* suspended or resumed are guaranteed to match. If unsure whether a value
|
||||||
* needs to be saved, include it. Overkill can't hurt. Pad the last savwds
|
* needs to be saved, include it. Overkill can't hurt. Pad the last savwds
|
||||||
* with junk variables to bring it up to 7 values. */
|
* with junk variables to bring it up to 7 values. */
|
||||||
SAVWDS(ABBNUM,BLKLIN,BONUS,game.clock1,game.clock2,CLOSED,CLOSNG);
|
SAVWDS(game.abbnum,game.blklin,game.bonus,game.clock1,game.clock2,game.closed,game.closng);
|
||||||
SAVWDS(DETAIL,DFLAG,DKILL,DTOTAL,FOOBAR,HOLDNG,IWEST);
|
SAVWDS(game.detail,DFLAG,game.dkill,game.dtotal,FOOBAR,HOLDNG,IWEST);
|
||||||
SAVWDS(KNFLOC,LIMIT,LL,LMWARN,LOC,NEWLOC,NUMDIE);
|
SAVWDS(KNFLOC,LIMIT,LL,LMWARN,LOC,NEWLOC,NUMDIE);
|
||||||
SAVWDS(OBJ,game.oldlc2,game.oldloc,OLDOBJ,PANIC,SAVED,SETUP);
|
SAVWDS(OBJ,game.oldlc2,game.oldloc,OLDOBJ,PANIC,SAVED,SETUP);
|
||||||
SAVWDS(SPK,TALLY,THRESH,TRNDEX,TRNLUZ,TURNS,OBJTXT[OYSTER]);
|
SAVWDS(SPK,TALLY,THRESH,TRNDEX,TRNLUZ,TURNS,OBJTXT[OYSTER]);
|
||||||
SAVWDS(VERB,WD1,WD1X,WD2,WZDARK,game.zzword,OBJSND[BIRD]);
|
SAVWDS(VERB,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]);
|
||||||
SAVWDS(OBJTXT[SIGN],CLSHNT,NOVICE,K,K,K,K);
|
SAVWDS(OBJTXT[SIGN],CLSHNT,NOVICE,K,K,K,K);
|
||||||
SAVARR(ABB,LOCSIZ);
|
SAVARR(ABB,LOCSIZ);
|
||||||
SAVARR(ATLOC,LOCSIZ);
|
SAVARR(ATLOC,LOCSIZ);
|
||||||
|
|
12
actions2.c
12
actions2.c
|
@ -61,7 +61,7 @@ int discard(bool just_do_it) {
|
||||||
if(!TOTING(OBJ)) return(2011);
|
if(!TOTING(OBJ)) return(2011);
|
||||||
if(OBJ != BIRD || !HERE(SNAKE)) goto L9023;
|
if(OBJ != BIRD || !HERE(SNAKE)) goto L9023;
|
||||||
RSPEAK(30);
|
RSPEAK(30);
|
||||||
if(CLOSED) return(19000);
|
if(game.closed) return(19000);
|
||||||
DSTROY(SNAKE);
|
DSTROY(SNAKE);
|
||||||
/* SET PROP FOR USE BY TRAVEL OPTIONS */
|
/* SET PROP FOR USE BY TRAVEL OPTIONS */
|
||||||
PROP[SNAKE]=1;
|
PROP[SNAKE]=1;
|
||||||
|
@ -148,7 +148,7 @@ int attack(FILE *input) {
|
||||||
if(OBJ > NOBJECTS) return(8000);
|
if(OBJ > NOBJECTS) return(8000);
|
||||||
L9124: if(OBJ == BIRD) {
|
L9124: if(OBJ == BIRD) {
|
||||||
SPK=137;
|
SPK=137;
|
||||||
if(CLOSED) return(2011);
|
if(game.closed) return(2011);
|
||||||
DSTROY(BIRD);
|
DSTROY(BIRD);
|
||||||
PROP[BIRD]=0;
|
PROP[BIRD]=0;
|
||||||
SPK=45;
|
SPK=45;
|
||||||
|
@ -162,7 +162,7 @@ L9126: if(OBJ == 0)SPK=44;
|
||||||
if(OBJ == CLAM || OBJ == OYSTER)SPK=150;
|
if(OBJ == CLAM || OBJ == OYSTER)SPK=150;
|
||||||
if(OBJ == SNAKE)SPK=46;
|
if(OBJ == SNAKE)SPK=46;
|
||||||
if(OBJ == DWARF)SPK=49;
|
if(OBJ == DWARF)SPK=49;
|
||||||
if(OBJ == DWARF && CLOSED) return(19000);
|
if(OBJ == DWARF && game.closed) return(19000);
|
||||||
if(OBJ == DRAGON)SPK=167;
|
if(OBJ == DRAGON)SPK=167;
|
||||||
if(OBJ == TROLL)SPK=157;
|
if(OBJ == TROLL)SPK=157;
|
||||||
if(OBJ == OGRE)SPK=203;
|
if(OBJ == OGRE)SPK=203;
|
||||||
|
@ -236,8 +236,8 @@ L9172: SPK=48;
|
||||||
game.dseen[I]=false;
|
game.dseen[I]=false;
|
||||||
game.dloc[I]=0;
|
game.dloc[I]=0;
|
||||||
SPK=47;
|
SPK=47;
|
||||||
DKILL=DKILL+1;
|
game.dkill=game.dkill+1;
|
||||||
if(DKILL == 1)SPK=149;
|
if(game.dkill == 1)SPK=149;
|
||||||
L9175: RSPEAK(SPK);
|
L9175: RSPEAK(SPK);
|
||||||
DROP(AXE,LOC);
|
DROP(AXE,LOC);
|
||||||
K=NUL;
|
K=NUL;
|
||||||
|
@ -278,7 +278,7 @@ L9212: if(OBJ != SNAKE && OBJ != DRAGON && OBJ != TROLL) goto L9213;
|
||||||
SPK=102;
|
SPK=102;
|
||||||
if(OBJ == DRAGON && PROP[DRAGON] != 0)SPK=110;
|
if(OBJ == DRAGON && PROP[DRAGON] != 0)SPK=110;
|
||||||
if(OBJ == TROLL)SPK=182;
|
if(OBJ == TROLL)SPK=182;
|
||||||
if(OBJ != SNAKE || CLOSED || !HERE(BIRD)) return(2011);
|
if(OBJ != SNAKE || game.closed || !HERE(BIRD)) return(2011);
|
||||||
SPK=101;
|
SPK=101;
|
||||||
DSTROY(BIRD);
|
DSTROY(BIRD);
|
||||||
PROP[BIRD]=0;
|
PROP[BIRD]=0;
|
||||||
|
|
24
advent.h
24
advent.h
|
@ -14,10 +14,22 @@ typedef long token_t; /* word token - someday this will be char[TOKLEN+1] */
|
||||||
typedef long vocab_t; /* index into a vocabulary array */
|
typedef long vocab_t; /* index into a vocabulary array */
|
||||||
|
|
||||||
struct game_t {
|
struct game_t {
|
||||||
|
long abbnum;
|
||||||
|
long blklin;
|
||||||
|
long bonus;
|
||||||
|
long chloc;
|
||||||
|
long chloc2;
|
||||||
long clock1;
|
long clock1;
|
||||||
long clock2;
|
long clock2;
|
||||||
|
long closed;
|
||||||
|
long closng;
|
||||||
|
long conds;
|
||||||
|
long detail;
|
||||||
|
long dkill;
|
||||||
|
long dtotal;
|
||||||
long oldloc;
|
long oldloc;
|
||||||
long oldlc2;
|
long oldlc2;
|
||||||
|
long wzdark;
|
||||||
long zzword;
|
long zzword;
|
||||||
long dseen[NDWARVES+1];
|
long dseen[NDWARVES+1];
|
||||||
long dloc[NDWARVES+1];
|
long dloc[NDWARVES+1];
|
||||||
|
@ -90,12 +102,9 @@ extern unsigned long get_next_lcg_value(void);
|
||||||
extern long randrange(long);
|
extern long randrange(long);
|
||||||
|
|
||||||
extern void score(long);
|
extern void score(long);
|
||||||
extern long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
||||||
BIRD, BLOOD, BONUS,
|
BIRD, BLOOD, BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST,
|
||||||
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
CLAM, CLSHNT, COINS, DALTLC, DOOR, DPRSSN, DRAGON, DWARF, EGGS,
|
||||||
CLAM, CLOSED, CLOSNG, CLSHNT,
|
|
||||||
COINS, CONDS, DALTLC, DETAIL,
|
|
||||||
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
|
|
||||||
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
||||||
GRATE, HINT, HINTED[], HINTLC[],
|
GRATE, HINT, HINTED[], HINTLC[],
|
||||||
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
|
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
|
||||||
|
@ -110,6 +119,5 @@ extern long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
||||||
STREAM, TALLY, THRESH, THROW, TK[], TRIDNT,
|
STREAM, TALLY, THRESH, THROW, TK[], TRIDNT,
|
||||||
TRNDEX, TRNLUZ, TROLL, TROLL2,
|
TRNDEX, TRNLUZ, TROLL, TROLL2,
|
||||||
TURNS, URN, V1, V2, VASE, VEND, VERB,
|
TURNS, URN, V1, V2, VASE, VEND, VERB,
|
||||||
VOLCAN, VRSION, WATER, WD1, WD1X, WD2, WD2X,
|
VOLCAN, VRSION, WATER, WD1, WD1X, WD2, WD2X;
|
||||||
WZDARK;
|
|
||||||
|
|
||||||
|
|
35
init.c
35
init.c
|
@ -325,11 +325,11 @@ L1106: /*etc*/ ;
|
||||||
* 3 A knife has been thrown (first set always misses)
|
* 3 A knife has been thrown (first set always misses)
|
||||||
* 3+ Dwarves are mad (increases their accuracy)
|
* 3+ Dwarves are mad (increases their accuracy)
|
||||||
* Sixth dwarf is special (the pirate). He always starts at his chest's
|
* Sixth dwarf is special (the pirate). He always starts at his chest's
|
||||||
* eventual location inside the maze. This loc is saved in CHLOC for ref.
|
* eventual location inside the maze. This loc is saved in game.chloc for ref.
|
||||||
* the dead end in the other maze has its loc stored in CHLOC2. */
|
* the dead end in the other maze has its loc stored in game.chloc2. */
|
||||||
|
|
||||||
CHLOC=114;
|
game.chloc=114;
|
||||||
CHLOC2=140;
|
game.chloc2=140;
|
||||||
for (I=1; I<=NDWARVES; I++) {
|
for (I=1; I<=NDWARVES; I++) {
|
||||||
game.dseen[I]=false;
|
game.dseen[I]=false;
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
|
@ -339,17 +339,17 @@ L1106: /*etc*/ ;
|
||||||
game.dloc[3]=33;
|
game.dloc[3]=33;
|
||||||
game.dloc[4]=44;
|
game.dloc[4]=44;
|
||||||
game.dloc[5]=64;
|
game.dloc[5]=64;
|
||||||
game.dloc[6]=CHLOC;
|
game.dloc[6]=game.chloc;
|
||||||
DALTLC=18;
|
DALTLC=18;
|
||||||
|
|
||||||
/* Other random flags and counters, as follows:
|
/* Other random flags and counters, as follows:
|
||||||
* ABBNUM How often we should print non-abbreviated descriptions
|
* game.abbnum How often we should print non-abbreviated descriptions
|
||||||
* BONUS Used to determine amount of bonus if he reaches closing
|
* game.bonus Used to determine amount of bonus if he reaches closing
|
||||||
* game.clock1 Number of turns from finding last treasure till closing
|
* game.clock1 Number of turns from finding last treasure till closing
|
||||||
* game.clock2 Number of turns from first warning till blinding flash
|
* game.clock2 Number of turns from first warning till blinding flash
|
||||||
* CONDS Min value for cond(loc) if loc has any hints
|
* game.conds Min value for cond(loc) if loc has any hints
|
||||||
* DETAIL How often we've said "not allowed to give more detail"
|
* game.detail How often we've said "not allowed to give more detail"
|
||||||
* DKILL Number of dwarves killed (unused in scoring, needed for msg)
|
* game.dkill # of dwarves killed (unused in scoring, needed for msg)
|
||||||
* FOOBAR Current progress in saying "FEE FIE FOE FOO".
|
* FOOBAR Current progress in saying "FEE FIE FOE FOO".
|
||||||
* HOLDNG Number of objects being carried
|
* HOLDNG Number of objects being carried
|
||||||
* IGO How many times he's said "go XXX" instead of "XXX"
|
* IGO How many times he's said "go XXX" instead of "XXX"
|
||||||
|
@ -373,26 +373,27 @@ L1106: /*etc*/ ;
|
||||||
IGO=0;
|
IGO=0;
|
||||||
IWEST=0;
|
IWEST=0;
|
||||||
KNFLOC=0;
|
KNFLOC=0;
|
||||||
DETAIL=0;
|
game.detail=0;
|
||||||
ABBNUM=5;
|
game.abbnum=5;
|
||||||
for (I=0; I<=4; I++) {
|
for (I=0; I<=4; I++) {
|
||||||
{long x = 2*I+81; if(RTEXT[x] != 0)MAXDIE=I+1;}
|
{long x = 2*I+81; if(RTEXT[x] != 0)MAXDIE=I+1;}
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
NUMDIE=0;
|
NUMDIE=0;
|
||||||
HOLDNG=0;
|
HOLDNG=0;
|
||||||
DKILL=0;
|
game.dkill=0;
|
||||||
FOOBAR=0;
|
FOOBAR=0;
|
||||||
BONUS=0;
|
game.bonus=0;
|
||||||
game.clock1=30;
|
game.clock1=30;
|
||||||
game.clock2=50;
|
game.clock2=50;
|
||||||
CONDS=SETBIT(11);
|
game.conds=SETBIT(11);
|
||||||
SAVED=0;
|
SAVED=0;
|
||||||
CLOSNG=false;
|
game.closng=false;
|
||||||
PANIC=false;
|
PANIC=false;
|
||||||
CLOSED=false;
|
game.closed=false;
|
||||||
CLSHNT=false;
|
CLSHNT=false;
|
||||||
NOVICE=false;
|
NOVICE=false;
|
||||||
SETUP=1;
|
SETUP=1;
|
||||||
|
game.blklin=true;
|
||||||
|
|
||||||
/* if we can ever think of how, we should save it at this point */
|
/* if we can ever think of how, we should save it at this point */
|
||||||
|
|
||||||
|
|
73
main.c
73
main.c
|
@ -14,17 +14,17 @@
|
||||||
|
|
||||||
struct game_t game;
|
struct game_t game;
|
||||||
|
|
||||||
long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
|
long ABB[186], ATLOC[186], DFLAG,
|
||||||
FIXED[NOBJECTS+1], HOLDNG,
|
FIXED[NOBJECTS+1], HOLDNG,
|
||||||
LINK[NOBJECTS*2 + 1], LNLENG, LNPOSN,
|
LINK[NOBJECTS*2 + 1], LNLENG, LNPOSN,
|
||||||
PARMS[26], PLACE[NOBJECTS+1],
|
PARMS[26], PLACE[NOBJECTS+1],
|
||||||
SETUP = 0;
|
SETUP = 0;
|
||||||
char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
|
char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
|
||||||
|
|
||||||
long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
|
long AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
|
||||||
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST,
|
||||||
CLAM, CLOSED, CLOSNG, CLSHNT, COINS, CONDS, DALTLC, DETAIL,
|
CLAM, CLSHNT, COINS, DALTLC,
|
||||||
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
|
DOOR, DPRSSN, DRAGON, DWARF, EGGS,
|
||||||
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
||||||
GRATE, HINT, HINTED[21], HINTLC[21],
|
GRATE, HINT, HINTED[21], HINTLC[21],
|
||||||
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
|
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
|
||||||
|
@ -40,8 +40,7 @@ long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
|
||||||
STREAM, TALLY, THRESH, THROW, TK[21], TRIDNT,
|
STREAM, TALLY, THRESH, THROW, TK[21], TRIDNT,
|
||||||
TRNDEX, TRNLUZ, TROLL, TROLL2,
|
TRNDEX, TRNLUZ, TROLL, TROLL2,
|
||||||
TURNS, URN, V1, V2, VASE, VEND, VERB,
|
TURNS, URN, V1, V2, VASE, VEND, VERB,
|
||||||
VOLCAN, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
|
VOLCAN, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X;
|
||||||
WZDARK = false;
|
|
||||||
FILE *logfp;
|
FILE *logfp;
|
||||||
bool oldstyle = false;
|
bool oldstyle = false;
|
||||||
lcg_state lcgstate;
|
lcg_state lcgstate;
|
||||||
|
@ -95,13 +94,13 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
/* Logical variables:
|
/* Logical variables:
|
||||||
*
|
*
|
||||||
* CLOSED says whether we're all the way closed
|
* game.closed says whether we're all the way closed
|
||||||
* CLOSNG says whether it's closing time yet
|
* game.closng says whether it's closing time yet
|
||||||
* CLSHNT says whether he's read the clue in the endgame
|
* CLSHNT says whether he's read the clue in the endgame
|
||||||
* LMWARN says whether he's been warned about lamp going dim
|
* LMWARN says whether he's been warned about lamp going dim
|
||||||
* NOVICE says whether he asked for instructions at start-up
|
* NOVICE says whether he asked for instructions at start-up
|
||||||
* PANIC says whether he's found out he's trapped in the cave
|
* PANIC says whether he's found out he's trapped in the cave
|
||||||
* WZDARK says whether the loc he's leaving was dark */
|
* game.wzdark says whether the loc he's leaving was dark */
|
||||||
|
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
|
|
||||||
|
@ -169,7 +168,7 @@ static bool do_command(FILE *cmdin) {
|
||||||
|
|
||||||
/* Can't leave cave once it's closing (except by main office). */
|
/* Can't leave cave once it's closing (except by main office). */
|
||||||
|
|
||||||
if(!OUTSID(NEWLOC) || NEWLOC == 0 || !CLOSNG) goto L71;
|
if(!OUTSID(NEWLOC) || NEWLOC == 0 || !game.closng) goto L71;
|
||||||
RSPEAK(130);
|
RSPEAK(130);
|
||||||
NEWLOC=LOC;
|
NEWLOC=LOC;
|
||||||
if(!PANIC)game.clock2=15;
|
if(!PANIC)game.clock2=15;
|
||||||
|
@ -227,7 +226,7 @@ L6000: if(DFLAG != 1) goto L6010;
|
||||||
* they don't back up unless there's no alternative. If they don't have to
|
* they don't back up unless there's no alternative. If they don't have to
|
||||||
* move, they attack. And, of course, dead dwarves don't do much of anything. */
|
* move, they attack. And, of course, dead dwarves don't do much of anything. */
|
||||||
|
|
||||||
L6010: DTOTAL=0;
|
L6010: game.dtotal=0;
|
||||||
ATTACK=0;
|
ATTACK=0;
|
||||||
STICK=0;
|
STICK=0;
|
||||||
/* 6030 */ for (I=1; I<=NDWARVES; I++) {
|
/* 6030 */ for (I=1; I<=NDWARVES; I++) {
|
||||||
|
@ -262,7 +261,7 @@ L6016: TK[J]=game.odloc[I];
|
||||||
* the pirate be spotted. Note that PLACE(CHEST)=0 might mean that he's
|
* the pirate be spotted. Note that PLACE(CHEST)=0 might mean that he's
|
||||||
* thrown it to the troll, but in that case he's seen the chest (PROP=0). */
|
* thrown it to the troll, but in that case he's seen the chest (PROP=0). */
|
||||||
|
|
||||||
if(LOC == CHLOC || PROP[CHEST] >= 0) goto L6030;
|
if(LOC == game.chloc || PROP[CHEST] >= 0) goto L6030;
|
||||||
K=0;
|
K=0;
|
||||||
/* 6020 */ for (J=50; J<=MAXTRS; J++) {
|
/* 6020 */ for (J=50; J<=MAXTRS; J++) {
|
||||||
/* Pirate won't take pyramid from plover room or dark room (too easy!). */
|
/* Pirate won't take pyramid from plover room or dark room (too easy!). */
|
||||||
|
@ -277,28 +276,28 @@ L6020: if(HERE(J))K=1;
|
||||||
|
|
||||||
L6021: if(PLACE[CHEST] != 0) goto L6022;
|
L6021: if(PLACE[CHEST] != 0) goto L6022;
|
||||||
/* Install chest only once, to insure it is the last treasure in the list. */
|
/* Install chest only once, to insure it is the last treasure in the list. */
|
||||||
MOVE(CHEST,CHLOC);
|
MOVE(CHEST,game.chloc);
|
||||||
MOVE(MESSAG,CHLOC2);
|
MOVE(MESSAG,game.chloc2);
|
||||||
L6022: RSPEAK(128);
|
L6022: RSPEAK(128);
|
||||||
/* 6023 */ for (J=50; J<=MAXTRS; J++) {
|
/* 6023 */ for (J=50; J<=MAXTRS; J++) {
|
||||||
if(J == PYRAM && (LOC == PLAC[PYRAM] || LOC == PLAC[EMRALD])) goto L6023;
|
if(J == PYRAM && (LOC == PLAC[PYRAM] || LOC == PLAC[EMRALD])) goto L6023;
|
||||||
if(AT(J) && FIXED[J] == 0)CARRY(J,LOC);
|
if(AT(J) && FIXED[J] == 0)CARRY(J,LOC);
|
||||||
if(TOTING(J))DROP(J,CHLOC);
|
if(TOTING(J))DROP(J,game.chloc);
|
||||||
L6023: /*etc*/ ;
|
L6023: /*etc*/ ;
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
L6024: game.dloc[6]=CHLOC;
|
L6024: game.dloc[6]=game.chloc;
|
||||||
game.odloc[6]=CHLOC;
|
game.odloc[6]=game.chloc;
|
||||||
game.dseen[6]=false;
|
game.dseen[6]=false;
|
||||||
goto L6030;
|
goto L6030;
|
||||||
|
|
||||||
L6025: RSPEAK(186);
|
L6025: RSPEAK(186);
|
||||||
MOVE(CHEST,CHLOC);
|
MOVE(CHEST,game.chloc);
|
||||||
MOVE(MESSAG,CHLOC2);
|
MOVE(MESSAG,game.chloc2);
|
||||||
goto L6024;
|
goto L6024;
|
||||||
|
|
||||||
/* This threatening little dwarf is in the room with him! */
|
/* This threatening little dwarf is in the room with him! */
|
||||||
|
|
||||||
L6027: DTOTAL=DTOTAL+1;
|
L6027: game.dtotal=game.dtotal+1;
|
||||||
if(game.odloc[I] != game.dloc[I]) goto L6030;
|
if(game.odloc[I] != game.dloc[I]) goto L6030;
|
||||||
ATTACK=ATTACK+1;
|
ATTACK=ATTACK+1;
|
||||||
if(KNFLOC >= 0)KNFLOC=LOC;
|
if(KNFLOC >= 0)KNFLOC=LOC;
|
||||||
|
@ -310,9 +309,9 @@ L6030: /*etc*/ ;
|
||||||
* Note that various of the "knife" messages must have specific relative
|
* Note that various of the "knife" messages must have specific relative
|
||||||
* positions in the RSPEAK database. */
|
* positions in the RSPEAK database. */
|
||||||
|
|
||||||
if(DTOTAL == 0) goto L2000;
|
if(game.dtotal == 0) goto L2000;
|
||||||
SETPRM(1,DTOTAL,0);
|
SETPRM(1,game.dtotal,0);
|
||||||
RSPEAK(4+1/DTOTAL);
|
RSPEAK(4+1/game.dtotal);
|
||||||
if(ATTACK == 0) goto L2000;
|
if(ATTACK == 0) goto L2000;
|
||||||
if(DFLAG == 2)DFLAG=3;
|
if(DFLAG == 2)DFLAG=3;
|
||||||
SETPRM(1,ATTACK,0);
|
SETPRM(1,ATTACK,0);
|
||||||
|
@ -336,15 +335,15 @@ L6030: /*etc*/ ;
|
||||||
|
|
||||||
L2000: if(LOC == 0) goto L99;
|
L2000: if(LOC == 0) goto L99;
|
||||||
KK=STEXT[LOC];
|
KK=STEXT[LOC];
|
||||||
if(MOD(ABB[LOC],ABBNUM) == 0 || KK == 0)KK=LTEXT[LOC];
|
if(MOD(ABB[LOC],game.abbnum) == 0 || KK == 0)KK=LTEXT[LOC];
|
||||||
if(FORCED(LOC) || !DARK(0)) goto L2001;
|
if(FORCED(LOC) || !DARK(0)) goto L2001;
|
||||||
if(WZDARK && PCT(35)) goto L90;
|
if(game.wzdark && PCT(35)) goto L90;
|
||||||
KK=RTEXT[16];
|
KK=RTEXT[16];
|
||||||
L2001: if(TOTING(BEAR))RSPEAK(141);
|
L2001: if(TOTING(BEAR))RSPEAK(141);
|
||||||
SPEAK(KK);
|
SPEAK(KK);
|
||||||
K=1;
|
K=1;
|
||||||
if(FORCED(LOC)) goto L8;
|
if(FORCED(LOC)) goto L8;
|
||||||
if(LOC == 33 && PCT(25) && !CLOSNG)RSPEAK(7);
|
if(LOC == 33 && PCT(25) && !game.closng)RSPEAK(7);
|
||||||
|
|
||||||
/* Print out descriptions of objects at this location. If not closing and
|
/* Print out descriptions of objects at this location. If not closing and
|
||||||
* property value is negative, tally off another treasure. Rug is special
|
* property value is negative, tally off another treasure. Rug is special
|
||||||
|
@ -360,7 +359,7 @@ L2004: if(I == 0) goto L2012;
|
||||||
if(OBJ > NOBJECTS)OBJ=OBJ-NOBJECTS;
|
if(OBJ > NOBJECTS)OBJ=OBJ-NOBJECTS;
|
||||||
if(OBJ == STEPS && TOTING(NUGGET)) goto L2008;
|
if(OBJ == STEPS && TOTING(NUGGET)) goto L2008;
|
||||||
if(PROP[OBJ] >= 0) goto L2006;
|
if(PROP[OBJ] >= 0) goto L2006;
|
||||||
if(CLOSED) goto L2008;
|
if(game.closed) goto L2008;
|
||||||
PROP[OBJ]=0;
|
PROP[OBJ]=0;
|
||||||
if(OBJ == RUG || OBJ == CHAIN)PROP[OBJ]=1;
|
if(OBJ == RUG || OBJ == CHAIN)PROP[OBJ]=1;
|
||||||
TALLY=TALLY-1;
|
TALLY=TALLY-1;
|
||||||
|
@ -394,7 +393,7 @@ L2012: VERB=0;
|
||||||
* to finish the loop. Ignore "HINTS" < 4 (special stuff, see database notes).
|
* to finish the loop. Ignore "HINTS" < 4 (special stuff, see database notes).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
L2600: if(COND[LOC] < CONDS) goto L2603;
|
L2600: if(COND[LOC] < game.conds) goto L2603;
|
||||||
/* 2602 */ for (HINT=1; HINT<=HNTMAX; HINT++) {
|
/* 2602 */ for (HINT=1; HINT<=HNTMAX; HINT++) {
|
||||||
if(HINTED[HINT]) goto L2602;
|
if(HINTED[HINT]) goto L2602;
|
||||||
if(!CNDBIT(LOC,HINT+10))HINTLC[HINT]= -1;
|
if(!CNDBIT(LOC,HINT+10))HINTLC[HINT]= -1;
|
||||||
|
@ -408,12 +407,12 @@ L2602: /*etc*/ ;
|
||||||
* been picked up and put down separate from their respective piles. Don't
|
* been picked up and put down separate from their respective piles. Don't
|
||||||
* tick game.clock1 unless well into cave (and not at Y2). */
|
* tick game.clock1 unless well into cave (and not at Y2). */
|
||||||
|
|
||||||
L2603: if(!CLOSED) goto L2605;
|
L2603: if(!game.closed) goto L2605;
|
||||||
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
|
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
|
||||||
for (I=1; I<=NOBJECTS; I++) {
|
for (I=1; I<=NOBJECTS; I++) {
|
||||||
if(TOTING(I) && PROP[I] < 0)PROP[I]= -1-PROP[I];
|
if(TOTING(I) && PROP[I] < 0)PROP[I]= -1-PROP[I];
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
L2605: WZDARK=DARK(0);
|
L2605: game.wzdark=DARK(0);
|
||||||
if(KNFLOC > 0 && KNFLOC != LOC)KNFLOC=0;
|
if(KNFLOC > 0 && KNFLOC != LOC)KNFLOC=0;
|
||||||
I=0;
|
I=0;
|
||||||
if (!GETIN(cmdin, WD1,WD1X,WD2,WD2X))
|
if (!GETIN(cmdin, WD1,WD1X,WD2,WD2X))
|
||||||
|
@ -661,9 +660,9 @@ L23: KK=K2;
|
||||||
/* Look. Can't give more detail. Pretend it wasn't dark (though it may "now"
|
/* Look. Can't give more detail. Pretend it wasn't dark (though it may "now"
|
||||||
* be dark) so he won't fall into a pit while staring into the gloom. */
|
* be dark) so he won't fall into a pit while staring into the gloom. */
|
||||||
|
|
||||||
L30: if(DETAIL < 3)RSPEAK(15);
|
L30: if(game.detail < 3)RSPEAK(15);
|
||||||
DETAIL=DETAIL+1;
|
game.detail=game.detail+1;
|
||||||
WZDARK=false;
|
game.wzdark=false;
|
||||||
ABB[LOC]=0;
|
ABB[LOC]=0;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -711,7 +710,7 @@ L90: RSPEAK(23);
|
||||||
|
|
||||||
/* Okay, he's dead. Let's get on with it. */
|
/* Okay, he's dead. Let's get on with it. */
|
||||||
|
|
||||||
L99: if(CLOSNG) goto L95;
|
L99: if(game.closng) goto L95;
|
||||||
NUMDIE=NUMDIE+1;
|
NUMDIE=NUMDIE+1;
|
||||||
if(!YES(cmdin,79+NUMDIE*2,80+NUMDIE*2,54)) score(0);
|
if(!YES(cmdin,79+NUMDIE*2,80+NUMDIE*2,54)) score(0);
|
||||||
if(NUMDIE == MAXDIE) score(0);
|
if(NUMDIE == MAXDIE) score(0);
|
||||||
|
@ -853,7 +852,7 @@ L10000: PROP[GRATE]=0;
|
||||||
FIXED[AXE]=0;
|
FIXED[AXE]=0;
|
||||||
RSPEAK(129);
|
RSPEAK(129);
|
||||||
game.clock1= -1;
|
game.clock1= -1;
|
||||||
CLOSNG=true;
|
game.closng=true;
|
||||||
goto L19999;
|
goto L19999;
|
||||||
|
|
||||||
/* Once he's panicked, and clock2 has run out, we come here to set up the
|
/* Once he's panicked, and clock2 has run out, we come here to set up the
|
||||||
|
@ -899,7 +898,7 @@ L11000: PROP[BOTTLE]=PUT(BOTTLE,115,1);
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
|
|
||||||
RSPEAK(132);
|
RSPEAK(132);
|
||||||
CLOSED=true;
|
game.closed=true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Another way we can force an end to things is by having the lamp give out.
|
/* Another way we can force an end to things is by having the lamp give out.
|
||||||
|
|
8
misc.c
8
misc.c
|
@ -16,10 +16,10 @@ void SPEAK(vocab_t N) {
|
||||||
long BLANK, CASE, I, K, L, NEG, NPARMS, PARM, PRMTYP, STATE;
|
long BLANK, CASE, I, K, L, NEG, NPARMS, PARM, PRMTYP, STATE;
|
||||||
|
|
||||||
/* Print the message which starts at LINES(N). Precede it with a blank line
|
/* Print the message which starts at LINES(N). Precede it with a blank line
|
||||||
* unless BLKLIN is false. */
|
* unless game.blklin is false. */
|
||||||
|
|
||||||
if(N == 0)return;
|
if(N == 0)return;
|
||||||
BLANK=BLKLIN;
|
BLANK=game.blklin;
|
||||||
K=N;
|
K=N;
|
||||||
NPARMS=1;
|
NPARMS=1;
|
||||||
L10: L=labs(LINES[K])-1;
|
L10: L=labs(LINES[K])-1;
|
||||||
|
@ -168,12 +168,12 @@ long JUNK;
|
||||||
* WORD2 (chars 6 thru 10 in WORD2X), else WORD2 is -1. */
|
* WORD2 (chars 6 thru 10 in WORD2X), else WORD2 is -1. */
|
||||||
|
|
||||||
|
|
||||||
L10: if(BLKLIN)TYPE0();
|
L10: if(game.blklin)TYPE0();
|
||||||
MAPLIN(input);
|
MAPLIN(input);
|
||||||
if (feof(input))
|
if (feof(input))
|
||||||
return false;
|
return false;
|
||||||
WORD1=GETTXT(true,true,true);
|
WORD1=GETTXT(true,true,true);
|
||||||
if(BLKLIN && WORD1 < 0) goto L10;
|
if(game.blklin && WORD1 < 0) goto L10;
|
||||||
WORD1X=GETTXT(false,true,true);
|
WORD1X=GETTXT(false,true,true);
|
||||||
L12: JUNK=GETTXT(false,true,true);
|
L12: JUNK=GETTXT(false,true,true);
|
||||||
if(JUNK > 0) goto L12;
|
if(JUNK > 0) goto L12;
|
||||||
|
|
18
score.c
18
score.c
|
@ -17,7 +17,7 @@ void score(long MODE) {
|
||||||
* Each treasure > chest 16 224
|
* Each treasure > chest 16 224
|
||||||
* Surviving (MAX-NUM)*10 30
|
* Surviving (MAX-NUM)*10 30
|
||||||
* Not quitting 4 4
|
* Not quitting 4 4
|
||||||
* Reaching "CLOSNG" 25 25
|
* Reaching "game.closng" 25 25
|
||||||
* "Closed": Quit/Killed 10
|
* "Closed": Quit/Killed 10
|
||||||
* Klutzed 25
|
* Klutzed 25
|
||||||
* Wrong way 30
|
* Wrong way 30
|
||||||
|
@ -47,9 +47,9 @@ L20010: /*etc*/ ;
|
||||||
|
|
||||||
/* Now look at how he finished and how far he got. MAXDIE and NUMDIE tell us
|
/* Now look at how he finished and how far he got. MAXDIE and NUMDIE tell us
|
||||||
* how well he survived. DFLAG will
|
* how well he survived. DFLAG will
|
||||||
* tell us if he ever got suitably deep into the cave. CLOSNG still indicates
|
* tell us if he ever got suitably deep into the cave. game.closng still indicates
|
||||||
* whether he reached the endgame. And if he got as far as "cave closed"
|
* whether he reached the endgame. And if he got as far as "cave closed"
|
||||||
* (indicated by "CLOSED"), then bonus is zero for mundane exits or 133, 134,
|
* (indicated by "game.closed"), then bonus is zero for mundane exits or 133, 134,
|
||||||
* 135 if he blew it (so to speak). */
|
* 135 if he blew it (so to speak). */
|
||||||
|
|
||||||
SCORE=SCORE+(MAXDIE-NUMDIE)*10;
|
SCORE=SCORE+(MAXDIE-NUMDIE)*10;
|
||||||
|
@ -58,13 +58,13 @@ L20010: /*etc*/ ;
|
||||||
MXSCOR=MXSCOR+4;
|
MXSCOR=MXSCOR+4;
|
||||||
if(DFLAG != 0)SCORE=SCORE+25;
|
if(DFLAG != 0)SCORE=SCORE+25;
|
||||||
MXSCOR=MXSCOR+25;
|
MXSCOR=MXSCOR+25;
|
||||||
if(CLOSNG)SCORE=SCORE+25;
|
if(game.closng)SCORE=SCORE+25;
|
||||||
MXSCOR=MXSCOR+25;
|
MXSCOR=MXSCOR+25;
|
||||||
if(!CLOSED) goto L20020;
|
if(!game.closed) goto L20020;
|
||||||
if(BONUS == 0)SCORE=SCORE+10;
|
if(game.bonus == 0)SCORE=SCORE+10;
|
||||||
if(BONUS == 135)SCORE=SCORE+25;
|
if(game.bonus == 135)SCORE=SCORE+25;
|
||||||
if(BONUS == 134)SCORE=SCORE+30;
|
if(game.bonus == 134)SCORE=SCORE+30;
|
||||||
if(BONUS == 133)SCORE=SCORE+45;
|
if(game.bonus == 133)SCORE=SCORE+45;
|
||||||
L20020: MXSCOR=MXSCOR+45;
|
L20020: MXSCOR=MXSCOR+45;
|
||||||
|
|
||||||
/* Did he come to Witt's End as he should? */
|
/* Did he come to Witt's End as he should? */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue