Replace macros with condition bits.
This commit is contained in:
parent
51494657fd
commit
6c6c72f327
3 changed files with 26 additions and 46 deletions
12
advent.h
12
advent.h
|
@ -155,18 +155,12 @@ extern int restore(FILE *);
|
||||||
#define DARK(DUMMY) ((!TSTBIT(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == 0 || !HERE(LAMP)))
|
#define DARK(DUMMY) ((!TSTBIT(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == 0 || !HERE(LAMP)))
|
||||||
#define PCT(N) (randrange(100) < (N))
|
#define PCT(N) (randrange(100) < (N))
|
||||||
#define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
|
#define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
|
||||||
#define FOREST(LOC) ((LOC) >= LOC_FOREST1 && (LOC) <= LOC_FOREST22)
|
#define FOREST(LOC) CNDBIT(LOC, COND_FOREST)
|
||||||
#define VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
|
#define VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
|
||||||
#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
|
#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
|
||||||
|
#define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))
|
||||||
|
|
||||||
/* The following two functions were added to fix a bug (game.clock1 decremented
|
#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC))
|
||||||
* while in forest). They should probably be replaced by using another
|
|
||||||
* "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
|
|
||||||
* of mists or deeper). Note special kludges for "Foof!" locs. */
|
|
||||||
|
|
||||||
#define OUTSID(LOC) ((LOC) <= LOC_GRATE || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == LOC_FOOF2 || (LOC) == LOC_FOOF4)
|
|
||||||
#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC) && (LOC) != LOC_FOOF1)
|
|
||||||
|
|
||||||
/* vocabulary items */
|
/* vocabulary items */
|
||||||
extern long AMBER, ATTACK, AXE, BACK, BATTERY, BEAR,
|
extern long AMBER, ATTACK, AXE, BACK, BATTERY, BEAR,
|
||||||
|
|
|
@ -14,9 +14,8 @@
|
||||||
# array.
|
# array.
|
||||||
#
|
#
|
||||||
# locations: Each item contains a long and short description. Some
|
# locations: Each item contains a long and short description. Some
|
||||||
# short descriptions are empty. Order of these locations is significant;
|
# short descriptions are empty. Order of these locations is not significant.
|
||||||
# see the macros OUTSID and INDEEP. Location conditions can be read
|
# Location conditions can be read as follows:
|
||||||
# as follows:
|
|
||||||
# LIT Light
|
# LIT Light
|
||||||
# OILY If FLUID flag is on: true for oil, false for water
|
# OILY If FLUID flag is on: true for oil, false for water
|
||||||
# FLUID Liquid asset
|
# FLUID Liquid asset
|
||||||
|
@ -222,7 +221,7 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are at one end of a vast hall stretching forward out of sight to\nthe west. There are openings to either side. Nearby, a wide stone\nstaircase leads downward. The hall is filled with wisps of white mist\nswaying to and fro almost as if alive. A cold wind blows up the\nstaircase. There is a passage at the top of a dome behind you.'
|
long: 'You are at one end of a vast hall stretching forward out of sight to\nthe west. There are openings to either side. Nearby, a wide stone\nstaircase leads downward. The hall is filled with wisps of white mist\nswaying to and fro almost as if alive. A cold wind blows up the\nstaircase. There is a passage at the top of a dome behind you.'
|
||||||
short: 'You''re in Hall of Mists.'
|
short: 'You''re in Hall of Mists.'
|
||||||
conditions: {}
|
conditions: {DEEP: true}
|
||||||
hints: [*jade]
|
hints: [*jade]
|
||||||
- LOC_CRACK:
|
- LOC_CRACK:
|
||||||
description:
|
description:
|
||||||
|
@ -902,7 +901,7 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST2:
|
- LOC_FOREST2:
|
||||||
description:
|
description:
|
||||||
|
@ -914,19 +913,19 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST4:
|
- LOC_FOREST4:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: { FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST5:
|
- LOC_FOREST5:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST6:
|
- LOC_FOREST6:
|
||||||
description:
|
description:
|
||||||
|
@ -938,19 +937,19 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST8:
|
- LOC_FOREST8:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST9:
|
- LOC_FOREST9:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST10:
|
- LOC_FOREST10:
|
||||||
description:
|
description:
|
||||||
|
@ -962,19 +961,19 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST12:
|
- LOC_FOREST12:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST13:
|
- LOC_FOREST13:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST14:
|
- LOC_FOREST14:
|
||||||
description:
|
description:
|
||||||
|
@ -986,19 +985,19 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST16:
|
- LOC_FOREST16:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST17:
|
- LOC_FOREST17:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST18:
|
- LOC_FOREST18:
|
||||||
description:
|
description:
|
||||||
|
@ -1010,19 +1009,19 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST20:
|
- LOC_FOREST20:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST21:
|
- LOC_FOREST21:
|
||||||
description:
|
description:
|
||||||
long: 'You are wandering aimlessly through the forest.'
|
long: 'You are wandering aimlessly through the forest.'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {FOREST: true, NOBACK: true, LIT: true, DEEP: true}
|
conditions: {FOREST: true, NOBACK: true, LIT: true}
|
||||||
hints: [*forest]
|
hints: [*forest]
|
||||||
- LOC_FOREST22:
|
- LOC_FOREST22:
|
||||||
description:
|
description:
|
||||||
|
@ -1034,7 +1033,7 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are on a small ledge on one face of a sheer cliff. There are no\npaths away from the ledge. Across the chasm is a small clearing\nsurrounded by forest.'
|
long: 'You are on a small ledge on one face of a sheer cliff. There are no\npaths away from the ledge. Across the chasm is a small clearing\nsurrounded by forest.'
|
||||||
short: 'You''re on ledge.'
|
short: 'You''re on ledge.'
|
||||||
conditions: {DEEP: true, LIT: true}
|
conditions: {ABOVE: true, LIT: true}
|
||||||
- LOC_RESBOTTOM:
|
- LOC_RESBOTTOM:
|
||||||
description:
|
description:
|
||||||
long: 'You are walking across the bottom of the reservoir. Walls of water\nrear up on either side. The roar of the water cascading past is\nnearly deafening, and the mist is so thick you can barely see.'
|
long: 'You are walking across the bottom of the reservoir. Walls of water\nrear up on either side. The roar of the water cascading past is\nnearly deafening, and the mist is so thick you can barely see.'
|
||||||
|
@ -1094,12 +1093,12 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: '>>Foof!<<'
|
long: '>>Foof!<<'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {DEEP: true}
|
conditions: {}
|
||||||
- LOC_FOOF2:
|
- LOC_FOOF2:
|
||||||
description:
|
description:
|
||||||
long: '>>Foof!<<'
|
long: '>>Foof!<<'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {DEEP: true}
|
conditions: {ABOVE: true}
|
||||||
- LOC_FOOF3:
|
- LOC_FOOF3:
|
||||||
description:
|
description:
|
||||||
long: '>>Foof!<<'
|
long: '>>Foof!<<'
|
||||||
|
@ -1109,7 +1108,7 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: '>>Foof!<<'
|
long: '>>Foof!<<'
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {DEEP: true}
|
conditions: {ABOVE: true}
|
||||||
- LOC_FOOF5:
|
- LOC_FOOF5:
|
||||||
description:
|
description:
|
||||||
long: '>>Foof!<<'
|
long: '>>Foof!<<'
|
||||||
|
|
13
init.c
13
init.c
|
@ -377,17 +377,4 @@ void initialise(void)
|
||||||
game.clshnt = false;
|
game.clshnt = false;
|
||||||
game.novice = false;
|
game.novice = false;
|
||||||
game.blklin = true;
|
game.blklin = true;
|
||||||
|
|
||||||
#ifdef ODEBUG
|
|
||||||
# define NEWFLAGS ((1<<COND_ABOVE)|(1<<COND_FOREST)|(1<<COND_DEEP));
|
|
||||||
int mismatches = 0;
|
|
||||||
for (int i = 0; i < LOCSIZ; i++) {
|
|
||||||
long condbits = conditions[i] & ~NEWFLAGS;
|
|
||||||
if (condbits == COND[i] || COND[i] == 2 && condbits == 0)
|
|
||||||
continue;
|
|
||||||
++mismatches;
|
|
||||||
printf("Mismatch at %ld: COND=%x consitions=%x\n", COND[i], condbits);
|
|
||||||
}
|
|
||||||
printf("%d condbit mismatches\n", mismatches);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue