Capture clock variables into the game-state block.
This commit is contained in:
parent
c68b92d9da
commit
bb78ca96ce
5 changed files with 26 additions and 23 deletions
|
@ -201,7 +201,7 @@ L9040: if(OBJ == CLAM || OBJ == OYSTER) goto L9046;
|
||||||
if(OBJ == CHAIN) goto L9048;
|
if(OBJ == CHAIN) goto L9048;
|
||||||
if(!CLOSNG) goto L9043;
|
if(!CLOSNG) goto L9043;
|
||||||
K=130;
|
K=130;
|
||||||
if(!PANIC)CLOCK2=15;
|
if(!PANIC)game.clock2=15;
|
||||||
PANIC=true;
|
PANIC=true;
|
||||||
return(2010);
|
return(2010);
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ 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,CLOCK1,CLOCK2,CLOSED,CLOSNG);
|
SAVWDS(ABBNUM,BLKLIN,BONUS,game.clock1,game.clock2,CLOSED,CLOSNG);
|
||||||
SAVWDS(DETAIL,DFLAG,DKILL,DTOTAL,FOOBAR,HOLDNG,IWEST);
|
SAVWDS(DETAIL,DFLAG,DKILL,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);
|
||||||
|
|
4
advent.h
4
advent.h
|
@ -14,6 +14,8 @@ 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 clock1;
|
||||||
|
long clock2;
|
||||||
long oldloc;
|
long oldloc;
|
||||||
long oldlc2;
|
long oldlc2;
|
||||||
long zzword;
|
long zzword;
|
||||||
|
@ -91,7 +93,7 @@ extern void score(long);
|
||||||
extern long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
extern long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
||||||
BIRD, BLOOD, BONUS,
|
BIRD, BLOOD, BONUS,
|
||||||
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
||||||
CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT,
|
CLAM, CLOSED, CLOSNG, CLSHNT,
|
||||||
COINS, CONDS, DALTLC, DETAIL,
|
COINS, CONDS, DALTLC, DETAIL,
|
||||||
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
|
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
|
||||||
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
|
||||||
|
|
2
funcs.h
2
funcs.h
|
@ -29,7 +29,7 @@
|
||||||
#define FOREST(LOC) ((LOC) >= 145 && (LOC) <= 166)
|
#define FOREST(LOC) ((LOC) >= 145 && (LOC) <= 166)
|
||||||
#define VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
|
#define VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
|
||||||
|
|
||||||
/* The following two functions were added to fix a bug (CLOCK1 decremented
|
/* The following two functions were added to fix a bug (game.clock1 decremented
|
||||||
* while in forest). They should probably be replaced by using another
|
* while in forest). They should probably be replaced by using another
|
||||||
* "cond" bit. For now, however, a quick fix... OUTSID(LOC) is true if
|
* "cond" bit. For now, however, a quick fix... OUTSID(LOC) is true if
|
||||||
* LOC is outside, INDEEP(LOC) is true if LOC is "deep" in the cave (hall
|
* LOC is outside, INDEEP(LOC) is true if LOC is "deep" in the cave (hall
|
||||||
|
|
8
init.c
8
init.c
|
@ -345,8 +345,8 @@ L1106: /*etc*/ ;
|
||||||
/* Other random flags and counters, as follows:
|
/* Other random flags and counters, as follows:
|
||||||
* ABBNUM How often we should print non-abbreviated descriptions
|
* ABBNUM How often we should print non-abbreviated descriptions
|
||||||
* BONUS Used to determine amount of bonus if he reaches closing
|
* BONUS Used to determine amount of bonus if he reaches closing
|
||||||
* CLOCK1 Number of turns from finding last treasure till closing
|
* game.clock1 Number of turns from finding last treasure till closing
|
||||||
* 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
|
* CONDS Min value for cond(loc) if loc has any hints
|
||||||
* DETAIL How often we've said "not allowed to give more detail"
|
* DETAIL How often we've said "not allowed to give more detail"
|
||||||
* DKILL Number of dwarves killed (unused in scoring, needed for msg)
|
* DKILL Number of dwarves killed (unused in scoring, needed for msg)
|
||||||
|
@ -383,8 +383,8 @@ L1106: /*etc*/ ;
|
||||||
DKILL=0;
|
DKILL=0;
|
||||||
FOOBAR=0;
|
FOOBAR=0;
|
||||||
BONUS=0;
|
BONUS=0;
|
||||||
CLOCK1=30;
|
game.clock1=30;
|
||||||
CLOCK2=50;
|
game.clock2=50;
|
||||||
CONDS=SETBIT(11);
|
CONDS=SETBIT(11);
|
||||||
SAVED=0;
|
SAVED=0;
|
||||||
CLOSNG=false;
|
CLOSNG=false;
|
||||||
|
|
31
main.c
31
main.c
|
@ -22,9 +22,8 @@ long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
|
||||||
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 ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
|
||||||
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
|
||||||
CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT,
|
CLAM, CLOSED, CLOSNG, CLSHNT, COINS, CONDS, DALTLC, DETAIL,
|
||||||
COINS, CONDS, DALTLC, DETAIL,
|
|
||||||
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
|
DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, 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],
|
||||||
|
@ -173,7 +172,7 @@ static bool do_command(FILE *cmdin) {
|
||||||
if(!OUTSID(NEWLOC) || NEWLOC == 0 || !CLOSNG) goto L71;
|
if(!OUTSID(NEWLOC) || NEWLOC == 0 || !CLOSNG) goto L71;
|
||||||
RSPEAK(130);
|
RSPEAK(130);
|
||||||
NEWLOC=LOC;
|
NEWLOC=LOC;
|
||||||
if(!PANIC)CLOCK2=15;
|
if(!PANIC)game.clock2=15;
|
||||||
PANIC=true;
|
PANIC=true;
|
||||||
|
|
||||||
/* See if a dwarf has seen him and has come from where he wants to go. If so,
|
/* See if a dwarf has seen him and has come from where he wants to go. If so,
|
||||||
|
@ -407,7 +406,7 @@ L2602: /*etc*/ ;
|
||||||
/* If closing time, check for any objects being toted with PROP < 0 and set
|
/* If closing time, check for any objects being toted with PROP < 0 and set
|
||||||
* the prop to -1-PROP. This way objects won't be described until they've
|
* the prop to -1-PROP. This way objects won't be described until they've
|
||||||
* 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 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(!CLOSED) goto L2605;
|
||||||
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
|
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
|
||||||
|
@ -435,10 +434,10 @@ L2607: FOOBAR=(FOOBAR>0 ? -FOOBAR : 0);
|
||||||
}
|
}
|
||||||
if(VERB == SAY && WD2 > 0)VERB=0;
|
if(VERB == SAY && WD2 > 0)VERB=0;
|
||||||
if(VERB == SAY) goto L4090;
|
if(VERB == SAY) goto L4090;
|
||||||
if(TALLY == 0 && INDEEP(LOC) && LOC != 33)CLOCK1=CLOCK1-1;
|
if(TALLY == 0 && INDEEP(LOC) && LOC != 33)game.clock1=game.clock1-1;
|
||||||
if(CLOCK1 == 0) goto L10000;
|
if(game.clock1 == 0) goto L10000;
|
||||||
if(CLOCK1 < 0)CLOCK2=CLOCK2-1;
|
if(game.clock1 < 0)game.clock2=game.clock2-1;
|
||||||
if(CLOCK2 == 0) goto L11000;
|
if(game.clock2 == 0) goto L11000;
|
||||||
if(PROP[LAMP] == 1)LIMIT=LIMIT-1;
|
if(PROP[LAMP] == 1)LIMIT=LIMIT-1;
|
||||||
if(LIMIT <= 30 && HERE(BATTER) && PROP[BATTER] == 0 && HERE(LAMP)) goto
|
if(LIMIT <= 30 && HERE(BATTER) && PROP[BATTER] == 0 && HERE(LAMP)) goto
|
||||||
L12000;
|
L12000;
|
||||||
|
@ -519,11 +518,13 @@ L8000: SETPRM(1,WD1,WD1X);
|
||||||
|
|
||||||
/* Figure out the new location
|
/* Figure out the new location
|
||||||
*
|
*
|
||||||
* Given the current location in "LOC", and a motion verb number in "K", put
|
* Given the current location in "LOC", and a motion verb number in
|
||||||
* the new location in "NEWLOC". The current loc is saved in "OLgame.dloc" in case
|
* "K", put the new location in "NEWLOC". The current loc is saved
|
||||||
* he wants to retreat. The current OLgame.dloc is saved in game.oldlc2, in case he
|
* in "game.olddloc" in case he wants to retreat. The current
|
||||||
* dies. (if he does, NEWLOC will be limbo, and OLgame.dloc will be what killed
|
* game.oldloc is saved in game.oldlc2, in case he dies. (if he
|
||||||
* him, so we need game.oldlc2, which is the last place he was safe.) */
|
* does, NEWLOC will be limbo, and OLgame.dloc will be what killed
|
||||||
|
* him, so we need game.oldlc2, which is the last place he was
|
||||||
|
* safe.) */
|
||||||
|
|
||||||
L8: KK=KEY[LOC];
|
L8: KK=KEY[LOC];
|
||||||
NEWLOC=LOC;
|
NEWLOC=LOC;
|
||||||
|
@ -851,7 +852,7 @@ L10000: PROP[GRATE]=0;
|
||||||
PROP[AXE]=0;
|
PROP[AXE]=0;
|
||||||
FIXED[AXE]=0;
|
FIXED[AXE]=0;
|
||||||
RSPEAK(129);
|
RSPEAK(129);
|
||||||
CLOCK1= -1;
|
game.clock1= -1;
|
||||||
CLOSNG=true;
|
CLOSNG=true;
|
||||||
goto L19999;
|
goto L19999;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue