From: Eric S. Raymond Date: Wed, 24 May 2017 00:59:21 +0000 (-0400) Subject: More structurization. X-Git-Tag: seed~72 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=f72141fbe356cd7bfe90a91cf65353e2808197a8;p=open-adventure.git More structurization. --- diff --git a/actions1.c b/actions1.c index 0bbe90e..b84d622 100644 --- a/actions1.c +++ b/actions1.c @@ -442,11 +442,11 @@ L8270: for (I=1; I<=100; I++) { L9270: if(DARK(0)) goto L5190; if(OBJTXT[OBJ] == 0 || PROP[OBJ] < 0) return(2011); - if(OBJ == OYSTER && !CLSHNT) goto L9275; + if(OBJ == OYSTER && !game.clshint) goto L9275; PSPEAK(OBJ,OBJTXT[OBJ]+PROP[OBJ]); return(2012); -L9275: CLSHNT=YES(input,192,193,54); +L9275: game.clshint=YES(input,192,193,54); return(2012); /* Break. Only works for mirror in repository and, of course, the vase. */ @@ -500,11 +500,11 @@ L8305: DATIME(I,K); SAVWDS(OBJ,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,game.setup); SAVWDS(game.spk,game.tally,game.thresh,game.trndex,game.trnluz,game.turns,OBJTXT[OYSTER]); SAVWDS(VERB,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]); - SAVWDS(OBJTXT[SIGN],CLSHNT,game.novice,K,K,K,K); + SAVWDS(OBJTXT[SIGN],game.clshint,game.novice,K,K,K,K); SAVARR(ABB,LOCSIZ); SAVARR(ATLOC,LOCSIZ); SAVARR(DLOC,6); - SAVARR(DSEEN,6); + SAVARR(game.dseen,6); SAVARR(FIXED,100); SAVARR(HINTED,HNTSIZ); SAVARR(HINTLC,HNTSIZ); diff --git a/actions2.c b/actions2.c index 23c8584..2c5f0c4 100644 --- a/actions2.c +++ b/actions2.c @@ -203,7 +203,7 @@ L9128: RSPEAK(game.spk); if(DLOC[I] != LOC) goto L9129; K=K+1; DLOC[I]=61; - DSEEN[I]=false; + game.dseen[I]=false; L9129: /*etc*/ ; } /* end loop */ game.spk=game.spk+1+1/K; @@ -234,7 +234,7 @@ int throw(FILE *cmdin) { L9172: game.spk=48; if(RAN(7) < game.dflag) goto L9175; - DSEEN[I]=false; + game.dseen[I]=false; DLOC[I]=0; game.spk=47; game.dkill=game.dkill+1; diff --git a/init.c b/init.c index eed89a4..bde0512 100644 --- a/init.c +++ b/init.c @@ -532,7 +532,7 @@ L1106: /*etc*/ ; CHLOC=114; CHLOC2=140; for (I=1; I<=6; I++) { - DSEEN[I]=false; + game.dseen[I]=false; } /* end loop */ game.dflag=0; DLOC[1]=19; @@ -591,7 +591,7 @@ L1106: /*etc*/ ; game.closng=false; game.panic=false; game.closed=false; - CLSHNT=false; + game.clshint=false; game.novice=false; game.setup=1; diff --git a/main.c b/main.c index 8cce7c5..c0db189 100644 --- a/main.c +++ b/main.c @@ -20,9 +20,9 @@ signed char INLINE[LINESIZE+1], MAP1[129], MAP2[129]; long ACTVERB[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2, - CLAM, CLSHNT, CLSMAX = 12, CLSSES, + CLAM, CLSMAX = 12, CLSSES, COINS, COND[186], CONDS, CTEXT[13], CVAL[13], DALTLC, - DOOR, DPRSSN, DRAGON, DSEEN[7], DWARF, EGGS, + DOOR, DPRSSN, DRAGON, DWARF, EGGS, EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[101], FOOD, GRATE, HINT, HINTED[21], HINTLC[21], HINTS[21][5], HNTMAX, HNTSIZ = 20, I, INVENT, IGO, J, JADE, K, K2, KEY[186], KEYS, KK, @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { * * game.closed says whether we're all the way closed * game.closng says whether it's closing time yet - * CLSHNT says whether he's read the clue in the endgame + * game.clshint says whether he's read the clue in the endgame * game.lmwarn says whether he's been warned about lamp going dim * game.novice says whether he asked for instructions at start-up * game.panic says whether he's found out he's trapped in the cave @@ -144,7 +144,7 @@ L2: if(!OUTSID(game.newloc) || game.newloc == 0 || !game.closng) goto L71; L71: if(game.newloc == LOC || FORCED(LOC) || CNDBIT(LOC,3)) goto L74; /* 73 */ for (I=1; I<=5; I++) { - if(ODLOC[I] != game.newloc || !DSEEN[I]) goto L73; + if(ODLOC[I] != game.newloc || !game.dseen[I]) goto L73; game.newloc=LOC; RSPEAK(2); goto L74; @@ -215,8 +215,8 @@ L6016: TK[J]=ODLOC[I]; J=1+RAN(J); ODLOC[I]=DLOC[I]; DLOC[I]=TK[J]; - DSEEN[I]=(DSEEN[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC); - if(!DSEEN[I]) goto L6030; + game.dseen[I]=(game.dseen[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC); + if(!game.dseen[I]) goto L6030; DLOC[I]=LOC; if(I != 6) goto L6027; @@ -251,7 +251,7 @@ L6023: /*etc*/ ; } /* end loop */ L6024: DLOC[6]=CHLOC; ODLOC[6]=CHLOC; - DSEEN[6]=false; + game.dseen[6]=false; goto L6030; L6025: RSPEAK(186); @@ -797,7 +797,7 @@ L41000: if(game.tally == 1 && PROP[JADE] < 0) goto L40010; L10000: PROP[GRATE]=0; PROP[FISSUR]=0; for (I=1; I<=6; I++) { - DSEEN[I]=false; + game.dseen[I]=false; DLOC[I]=0; } /* end loop */ MOVE(TROLL,0); diff --git a/main.h b/main.h index 5af50f3..fd51876 100644 --- a/main.h +++ b/main.h @@ -50,6 +50,9 @@ struct game_t { long wzdark; long zzword; /* more state will go here */ + long clshint; long novice; + /* more state will go here */ + long dseen[7]; }; extern struct game_t game; diff --git a/score.c b/score.c index 1b3736e..6e0fc53 100644 --- a/score.c +++ b/score.c @@ -84,7 +84,7 @@ L20020: MXSCOR=MXSCOR+45; if(HINTED[I])SCORE=SCORE-HINTS[I][2]; } /* end loop */ if(game.novice)SCORE=SCORE-5; - if(CLSHNT)SCORE=SCORE-10; + if(game.clshint)SCORE=SCORE-10; SCORE=SCORE-game.trnluz-game.saved; /* Return to score command if that's where we came from. */ diff --git a/share.h b/share.h index a307191..cf8693b 100644 --- a/share.h +++ b/share.h @@ -2,9 +2,8 @@ extern void score(long); extern long ACTVERB[], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2, - CLAM, CLSHNT, CLSMAX, CLSSES, - COINS, COND[], CONDS, CTEXT[], CVAL[], DALTLC, - DOOR, DPRSSN, DRAGON, DSEEN[], DWARF, EGGS, + CLAM, CLSMAX, CLSSES, COINS, COND[], CONDS, CTEXT[], CVAL[], DALTLC, + DOOR, DPRSSN, DRAGON, DWARF, EGGS, EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[], FOOD, GRATE, HINT, HINTED[], HINTLC[], HINTS[][5], HNTMAX, HNTSIZ, I, INVENT, IGO, J, JADE, K, K2, KEY[], KEYS, KK,