X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=init.c;h=d33dd927ea3e9543a2167adb41ec9dc011dcbb50;hb=df46df697917304a78ae9d3392ffff9b535ae5a5;hp=ae42f258c7554f5e0c400873bfde4825849195c6;hpb=fa1f8591629eccdaf53da24c29fdf02acb84255f;p=open-adventure.git diff --git a/init.c b/init.c index ae42f25..d33dd92 100644 --- a/init.c +++ b/init.c @@ -7,6 +7,7 @@ #include "main.h" #include "share.h" #include "funcs.h" +#include "database.h" /* * Initialisation @@ -175,7 +176,7 @@ static void quick_io(void); void initialise(void) { if (oldstyle) printf("Initialising...\n"); - if(!quick_init()){raw_init(); report(); quick_save();} + if(!quick_init()){raw_init(); report(); quick_save();} finish_init(); } @@ -218,7 +219,7 @@ L1001: /*etc*/ ; /* Start new data section. Sect is the section number. */ L1002: SECT=GETNUM(OPENED); - game.oldloc= -1; + OLDLOC= -1; switch (SECT) { case 0: return(0); case 1: goto L1004; case 2: goto L1004; case 3: goto L1030; case 4: goto L1040; case 5: goto L1004; case 6: goto L1004; case 7: goto L1050; case 8: goto L1060; case @@ -238,11 +239,11 @@ L1005: LINUSE=KK; if(LNLENG < LNPOSN)BUG(1); L1006: KK=KK+1; if(KK >= LINSIZ)BUG(2); - LINES[KK]=GETTXT(false,false,false,KK); + LINES[KK]=GETTXT(false,false,false); if(LINES[KK] != -1) goto L1006; LINES[LINUSE]=KK; - if(LOC == game.oldloc) goto L1005; - game.oldloc=LOC; + if(LOC == OLDLOC) goto L1005; + OLDLOC=LOC; LINES[LINUSE]= -KK; if(SECT == 14) goto L1014; if(SECT == 10) goto L1012; @@ -278,20 +279,20 @@ L1014: TRNVLS=TRNVLS+1; /* The stuff for section 3 is encoded here. Each "from-location" gets a * contiguous section of the "TRAVEL" array. Each entry in travel is - * game.newloc*1000 + KEYWORD (from section 4, motion verbs), and is negated if + * NEWLOC*1000 + KEYWORD (from section 4, motion verbs), and is negated if * this is the last entry for this location. KEY(N) is the index in travel * of the first option at location N. */ L1030: LOC=GETNUM(OPENED); if(LOC == -1) goto L1002; - game.newloc=GETNUM(NULL); + NEWLOC=GETNUM(NULL); if(KEY[LOC] != 0) goto L1033; KEY[LOC]=TRVS; goto L1035; L1033: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++; L1035: L=GETNUM(NULL); if(L == 0) goto L1039; - TRAVEL[TRVS]=game.newloc*1000+L; + TRAVEL[TRVS]=NEWLOC*1000+L; TRVS=TRVS+1; if(TRVS == TRVSIZ)BUG(3); goto L1035; @@ -300,17 +301,14 @@ L1039: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++; /* Here we read in the vocabulary. KTAB(N) is the word number, ATAB(N) is * the corresponding word. The -1 at the end of section 4 is left in KTAB - * as an end-marker. The words are given a minimal hash to make deciphering - * the core-image harder. (We don't use gettxt's hash since that would force - * us to hash each input line to make comparisons work, and that in turn - * would make it harder to detect particular input words.) */ + * as an end-marker. */ L1040: J=10000; for (TABNDX=1; TABNDX<=TABSIZ; TABNDX++) { KTAB[TABNDX]=GETNUM(OPENED); if(KTAB[TABNDX] == -1) goto L1002; J=J+7; - ATAB[TABNDX]=GETTXT(true,true,true,0)+J*J; + ATAB[TABNDX]=GETTXT(true,true,true); } /* end loop */ BUG(4); @@ -519,7 +517,7 @@ L1106: /*etc*/ ; * prior loc of each dwarf, initially garbage. DALTLC is alternate initial loc * for dwarf, in case one of them starts out on top of the adventurer. (No 2 * of the 5 initial locs are adjacent.) DSEEN is true if dwarf has seen him. - * game.dflag controls the level of activation of all this: + * DFLAG controls the level of activation of all this: * 0 No dwarf stuff yet (wait until reaches Hall Of Mists) * 1 Reached Hall Of Mists, but hasn't met first dwarf * 2 Met first dwarf, others start moving, no knives thrown yet @@ -534,7 +532,7 @@ L1106: /*etc*/ ; for (I=1; I<=6; I++) { DSEEN[I]=false; } /* end loop */ - game.dflag=0; + DFLAG=0; DLOC[1]=19; DLOC[2]=27; DLOC[3]=33; @@ -544,21 +542,21 @@ L1106: /*etc*/ ; DALTLC=18; /* Other random flags and counters, as follows: - * game.abbnum How often we should print non-abbreviated descriptions - * game.bonus Used to determine amount of bonus if he reaches closing - * game.clock1 Number of turns from finding last treasure till closing - * game.clock2 Number of turns from first warning till blinding flash + * ABBNUM How often we should print non-abbreviated descriptions + * BONUS Used to determine amount of bonus if he reaches closing + * CLOCK1 Number of turns from finding last treasure till closing + * CLOCK2 Number of turns from first warning till blinding flash * CONDS Min value for cond(loc) if loc has any hints - * game.detail How often we've said "not allowed to give more detail" - * game.dkill Number of dwarves killed (unused in scoring, needed for msg) - * game.foobar Current progress in saying "FEE FIE FOE FOO". - * game.holdng Number of objects being carried + * DETAIL How often we've said "not allowed to give more detail" + * DKILL Number of dwarves killed (unused in scoring, needed for msg) + * FOOBAR Current progress in saying "FEE FIE FOE FOO". + * HOLDNG Number of objects being carried * IGO How many times he's said "go XXX" instead of "XXX" - * game.iwest How many times he's said "west" instead of "w" - * game.knfloc 0 if no knife here, loc if knife here, -1 after caveat - * game.limit Lifetime of lamp (not set here) + * IWEST How many times he's said "west" instead of "w" + * KNFLOC 0 if no knife here, loc if knife here, -1 after caveat + * LIMIT Lifetime of lamp (not set here) * MAXDIE Number of reincarnation messages available (up to 5) - * game.numdie Number of times killed so far + * NUMDIE Number of times killed so far * THRESH Next #turns threshhold (-1 if none) * TRNDEX Index in TRNVAL of next threshhold (section 14 of database) * TRNLUZ # points lost so far due to number of turns used @@ -570,29 +568,29 @@ L1106: /*etc*/ ; THRESH= -1; if(TRNVLS > 0)THRESH=MOD(TRNVAL[1],100000)+1; TRNLUZ=0; - game.lmwarn=false; + LMWARN=false; IGO=0; - game.iwest=0; - game.knfloc=0; - game.detail=0; - game.abbnum=5; + IWEST=0; + KNFLOC=0; + DETAIL=0; + ABBNUM=5; for (I=0; I<=4; I++) { {long x = 2*I+81; if(RTEXT[x] != 0)MAXDIE=I+1;} } /* end loop */ - game.numdie=0; - game.holdng=0; - game.dkill=0; - game.foobar=0; - game.bonus=0; - game.clock1=30; - game.clock2=50; + NUMDIE=0; + HOLDNG=0; + DKILL=0; + FOOBAR=0; + BONUS=0; + CLOCK1=30; + CLOCK2=50; CONDS=SETBIT(11); - game.saved=0; - game.closng=false; - game.panic=false; - game.closed=false; + SAVED=0; + CLOSNG=false; + PANIC=false; + CLOSED=false; CLSHNT=false; - game.novice=false; + NOVICE=false; SETUP=1; /* if we can ever think of how, we should save it at this point */