init.c is now real C.
This commit is contained in:
parent
1b59175d8d
commit
16d90e4c28
1 changed files with 229 additions and 241 deletions
110
init.c
110
init.c
|
@ -15,9 +15,10 @@
|
||||||
* 12600 words of message text (LINES, LINSIZ).
|
* 12600 words of message text (LINES, LINSIZ).
|
||||||
* 885 travel options (TRAVEL, TRVSIZ).
|
* 885 travel options (TRAVEL, TRVSIZ).
|
||||||
* 330 vocabulary words (KTAB, ATAB, TABSIZ).
|
* 330 vocabulary words (KTAB, ATAB, TABSIZ).
|
||||||
* 185 locations (LTEXT, STEXT, KEY, COND, abbrev, game.atloc, LOCSND, LOCSIZ).
|
* 185 locations (LTEXT, STEXT, KEY, COND, game.abbrev, game.atloc,
|
||||||
* 100 objects (PLAC, game.place, FIXD, game.fixed, game.link (TWICE), PTEXT, game.prop,
|
* LOCSND, LOCSIZ).
|
||||||
* OBJSND, OBJTXT).
|
* 100 objects (PLAC, game.place, FIXD, game.fixed, game.link (twice),
|
||||||
|
* PTEXT, game.prop, OBJSND, OBJTXT).
|
||||||
* 35 "action" verbs (ACTSPK, VRBSIZ).
|
* 35 "action" verbs (ACTSPK, VRBSIZ).
|
||||||
* 277 random messages (RTEXT, RTXSIZ).
|
* 277 random messages (RTEXT, RTXSIZ).
|
||||||
* 12 different player classifications (CTEXT, CVAL, CLSMAX).
|
* 12 different player classifications (CTEXT, CVAL, CLSMAX).
|
||||||
|
@ -28,9 +29,8 @@
|
||||||
* so there can't be more than 1000 words.) These upper limits are:
|
* so there can't be more than 1000 words.) These upper limits are:
|
||||||
* 1000 non-synonymous vocabulary words
|
* 1000 non-synonymous vocabulary words
|
||||||
* 300 locations
|
* 300 locations
|
||||||
* 100 objects */
|
* 100 objects
|
||||||
|
* Note:
|
||||||
/* Note:
|
|
||||||
* - the object count limit has been abstracted as NOBJECTS
|
* - the object count limit has been abstracted as NOBJECTS
|
||||||
* - the random message limit has been abstracted as RTXSIZ
|
* - the random message limit has been abstracted as RTXSIZ
|
||||||
* - maximum locations limit has been abstracted as LOCSIZ
|
* - maximum locations limit has been abstracted as LOCSIZ
|
||||||
|
@ -170,31 +170,26 @@
|
||||||
* %B = Variable number of blanks
|
* %B = Variable number of blanks
|
||||||
* %! = The entire message should be suppressed */
|
* %! = The entire message should be suppressed */
|
||||||
|
|
||||||
static int finish_init(void);
|
void initialise(void)
|
||||||
|
{
|
||||||
void initialise(void) {
|
int i, k;
|
||||||
if (oldstyle)
|
if (oldstyle)
|
||||||
printf("Initialising...\n");
|
printf("Initialising...\n");
|
||||||
finish_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish_init(void) {
|
|
||||||
int i;
|
|
||||||
for (i=1; i<=NOBJECTS; i++) {
|
for (i=1; i<=NOBJECTS; i++) {
|
||||||
game.place[i]=0;
|
game.place[i]=0;
|
||||||
game.prop[i]=0;
|
game.prop[i]=0;
|
||||||
game.link[i]=0;
|
game.link[i+NOBJECTS]=game.link[i]=0;
|
||||||
{long x = i+NOBJECTS; game.link[x]=0;}
|
}
|
||||||
} /* end loop */
|
|
||||||
|
|
||||||
for (i=1; i<=LOCSIZ; i++) {
|
for (i=1; i<=LOCSIZ; i++) {
|
||||||
game.abbrev[i]=0;
|
game.abbrev[i]=0;
|
||||||
if (!(LTEXT[i] == 0 || KEY[i] == 0)) {
|
if (!(LTEXT[i] == 0 || KEY[i] == 0)) {
|
||||||
K=KEY[i];
|
k=KEY[i];
|
||||||
if(MOD(labs(TRAVEL[K]),1000) == 1)COND[i]=2;
|
if(MOD(labs(TRAVEL[k]),1000) == 1)COND[i]=2;
|
||||||
}
|
}
|
||||||
game.atloc[i]=0;
|
game.atloc[i]=0;
|
||||||
} /* end loop */
|
}
|
||||||
|
|
||||||
/* Set up the game.atloc and game.link arrays as described above.
|
/* Set up the game.atloc and game.link arrays as described above.
|
||||||
* We'll use the DROP subroutine, which prefaces new objects on the
|
* We'll use the DROP subroutine, which prefaces new objects on the
|
||||||
|
@ -203,45 +198,41 @@ static int finish_init(void) {
|
||||||
* This also sets up "game.place" and "fixed" as copies of "PLAC" and
|
* This also sets up "game.place" and "fixed" as copies of "PLAC" and
|
||||||
* "FIXD". Also, since two-placed objects are typically best
|
* "FIXD". Also, since two-placed objects are typically best
|
||||||
* described last, we'll drop them first. */
|
* described last, we'll drop them first. */
|
||||||
|
|
||||||
for (i=1; i<=NOBJECTS; i++) {
|
for (i=1; i<=NOBJECTS; i++) {
|
||||||
K=NOBJECTS + 1 - i;
|
k=NOBJECTS + 1 - i;
|
||||||
if(FIXD[K] > 0) {
|
if(FIXD[k] > 0) {
|
||||||
DROP(K+NOBJECTS,FIXD[K]);
|
DROP(k+NOBJECTS,FIXD[k]);
|
||||||
DROP(K,PLAC[K]);
|
DROP(k,PLAC[k]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} /* end loop */
|
|
||||||
|
|
||||||
for (i=1; i<=NOBJECTS; i++) {
|
for (i=1; i<=NOBJECTS; i++) {
|
||||||
K=NOBJECTS + 1 - i;
|
k=NOBJECTS + 1 - i;
|
||||||
game.fixed[K]=FIXD[K];
|
game.fixed[k]=FIXD[k];
|
||||||
if(PLAC[K] != 0 && FIXD[K] <= 0)
|
if(PLAC[k] != 0 && FIXD[k] <= 0)
|
||||||
DROP(K,PLAC[K]);
|
DROP(k,PLAC[k]);
|
||||||
} /* end loop */
|
}
|
||||||
|
|
||||||
/* Treasures, as noted earlier, are objects MINTRS through MAXTRS
|
/* Treasures, as noted earlier, are objects MINTRS through MAXTRS
|
||||||
* Their props are initially -1, and are set to 0 the first time they are
|
* Their props are initially -1, and are set to 0 the first time
|
||||||
* described. game.tally keeps track of how many are not yet found, so we know
|
* they are described. game.tally keeps track of how many are
|
||||||
* when to close the cave. */
|
* not yet found, so we know when to close the cave. */
|
||||||
|
|
||||||
game.tally=0;
|
game.tally=0;
|
||||||
for (i=MINTRS; i<=MAXTRS; i++) {
|
for (i=MINTRS; i<=MAXTRS; i++) {
|
||||||
if(PTEXT[i] != 0)
|
if(PTEXT[i] != 0)
|
||||||
game.prop[i]= -1;
|
game.prop[i]= -1;
|
||||||
game.tally=game.tally-game.prop[i];
|
game.tally=game.tally-game.prop[i];
|
||||||
} /* end loop */
|
}
|
||||||
|
|
||||||
/* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
|
/* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
|
||||||
* with cond bit i. game.hinted[i] is true iff hint i has been
|
* with cond bit i. game.hinted[i] is true iff hint i has been
|
||||||
* used. */
|
* used. */
|
||||||
|
|
||||||
for (i=1; i<=HNTMAX; i++) {
|
for (i=1; i<=HNTMAX; i++) {
|
||||||
game.hinted[i]=false;
|
game.hinted[i]=false;
|
||||||
game.hintlc[i]=0;
|
game.hintlc[i]=0;
|
||||||
} /* end loop */
|
}
|
||||||
|
|
||||||
/* Define some handy mnemonics. These correspond to object numbers. */
|
/* Define some handy mnemonics. These correspond to object numbers. */
|
||||||
|
|
||||||
AXE=VOCWRD(12405,1);
|
AXE=VOCWRD(12405,1);
|
||||||
BATTER=VOCWRD(201202005,1);
|
BATTER=VOCWRD(201202005,1);
|
||||||
BEAR=VOCWRD(2050118,1);
|
BEAR=VOCWRD(2050118,1);
|
||||||
|
@ -283,8 +274,7 @@ static int finish_init(void) {
|
||||||
VOLCAN=VOCWRD(1765120301,1);
|
VOLCAN=VOCWRD(1765120301,1);
|
||||||
WATER=VOCWRD(1851200518,1);
|
WATER=VOCWRD(1851200518,1);
|
||||||
|
|
||||||
/* Objects from 50 through whatever are treasures. Here are a few. */
|
/* Objects from MINTRS through MAXTRS are treasures. Here are a few. */
|
||||||
|
|
||||||
AMBER=VOCWRD(113020518,1);
|
AMBER=VOCWRD(113020518,1);
|
||||||
CHAIN=VOCWRD(308010914,1);
|
CHAIN=VOCWRD(308010914,1);
|
||||||
CHEST=VOCWRD(308051920,1);
|
CHEST=VOCWRD(308051920,1);
|
||||||
|
@ -302,7 +292,6 @@ static int finish_init(void) {
|
||||||
VASE=VOCWRD(22011905,1);
|
VASE=VOCWRD(22011905,1);
|
||||||
|
|
||||||
/* These are motion-verb numbers. */
|
/* These are motion-verb numbers. */
|
||||||
|
|
||||||
BACK=VOCWRD(2010311,0);
|
BACK=VOCWRD(2010311,0);
|
||||||
CAVE=VOCWRD(3012205,0);
|
CAVE=VOCWRD(3012205,0);
|
||||||
DPRSSN=VOCWRD(405161805,0);
|
DPRSSN=VOCWRD(405161805,0);
|
||||||
|
@ -313,32 +302,33 @@ static int finish_init(void) {
|
||||||
STREAM=VOCWRD(1920180501,0);
|
STREAM=VOCWRD(1920180501,0);
|
||||||
|
|
||||||
/* And some action verbs. */
|
/* And some action verbs. */
|
||||||
|
|
||||||
FIND=VOCWRD(6091404,2);
|
FIND=VOCWRD(6091404,2);
|
||||||
INVENT=VOCWRD(914220514,2);
|
INVENT=VOCWRD(914220514,2);
|
||||||
LOCK=VOCWRD(12150311,2);
|
LOCK=VOCWRD(12150311,2);
|
||||||
SAY=VOCWRD(190125,2);
|
SAY=VOCWRD(190125,2);
|
||||||
THROW=VOCWRD(2008181523,2);
|
THROW=VOCWRD(2008181523,2);
|
||||||
|
|
||||||
/* Initialise the dwarves. game.dloc is loc of dwarves, hard-wired in. game.odloc is
|
/* Initialise the dwarves. game.dloc is loc of dwarves,
|
||||||
* prior loc of each dwarf, initially garbage. DALTLC is alternate initial loc
|
* hard-wired in. game.odloc is prior loc of each dwarf,
|
||||||
* for dwarf, in case one of them starts out on top of the adventurer. (No 2
|
* initially garbage. DALTLC is alternate initial loc for dwarf,
|
||||||
* of the 5 initial locs are adjacent.) game.dseen is true if dwarf has seen him.
|
* in case one of them starts out on top of the adventurer. (No
|
||||||
* game.dflag controls the level of activation of all this:
|
* 2 of the 5 initial locs are adjacent.) game.dseen is true if
|
||||||
|
* dwarf has seen him. game.dflag controls the level of
|
||||||
|
* activation of all this:
|
||||||
* 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
|
* 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
|
||||||
* 1 Reached Hall Of Mists, but hasn't met first dwarf
|
* 1 Reached Hall Of Mists, but hasn't met first dwarf
|
||||||
* 2 Met first dwarf, others start moving, no knives thrown yet
|
* 2 Met first dwarf, others start moving, no knives thrown yet
|
||||||
* 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
|
||||||
* eventual location inside the maze. This loc is saved in game.chloc for ref.
|
* chest's eventual location inside the maze. This loc is saved
|
||||||
* the dead end in the other maze has its loc stored in game.chloc2. */
|
* in game.chloc for ref. the dead end in the other maze has its
|
||||||
|
* loc stored in game.chloc2. */
|
||||||
game.chloc=114;
|
game.chloc=114;
|
||||||
game.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 */
|
}
|
||||||
game.dflag=0;
|
game.dflag=0;
|
||||||
game.dloc[1]=19;
|
game.dloc[1]=19;
|
||||||
game.dloc[2]=27;
|
game.dloc[2]=27;
|
||||||
|
@ -364,15 +354,15 @@ static int finish_init(void) {
|
||||||
* MAXDIE Number of reincarnation messages available (up to 5)
|
* MAXDIE Number of reincarnation messages available (up to 5)
|
||||||
* game.numdie Number of times killed so far
|
* game.numdie Number of times killed so far
|
||||||
* game.thresh Next #turns threshhold (-1 if none)
|
* game.thresh Next #turns threshhold (-1 if none)
|
||||||
* game.trndex Index in TRNVAL of next threshhold (section 14 of database)
|
* game.trndex Index in TRNVAL of next threshold (db section 14)
|
||||||
* game.trnluz # points lost so far due to number of turns used
|
* game.trnluz # points lost so far due to number of turns used
|
||||||
* game.turns Tallies how many commands he's given (ignores yes/no)
|
* game.turns Tallies how many commands he's given (ignores yes/no)
|
||||||
* Logicals were explained earlier */
|
* Logicals were explained earlier */
|
||||||
|
|
||||||
game.turns=0;
|
game.turns=0;
|
||||||
game.trndex=1;
|
game.trndex=1;
|
||||||
game.thresh= -1;
|
game.thresh= -1;
|
||||||
if(TRNVLS > 0)game.thresh=MOD(TRNVAL[1],100000)+1;
|
if (TRNVLS > 0)
|
||||||
|
game.thresh=MOD(TRNVAL[1],100000)+1;
|
||||||
game.trnluz=0;
|
game.trnluz=0;
|
||||||
game.lmwarn=false;
|
game.lmwarn=false;
|
||||||
game.iwest=0;
|
game.iwest=0;
|
||||||
|
@ -380,8 +370,10 @@ static int finish_init(void) {
|
||||||
game.detail=0;
|
game.detail=0;
|
||||||
game.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;
|
||||||
} /* end loop */
|
if(RTEXT[x] != 0)
|
||||||
|
MAXDIE=i+1;
|
||||||
|
}
|
||||||
game.numdie=0;
|
game.numdie=0;
|
||||||
game.holdng=0;
|
game.holdng=0;
|
||||||
game.dkill=0;
|
game.dkill=0;
|
||||||
|
@ -398,8 +390,4 @@ static int finish_init(void) {
|
||||||
game.novice=false;
|
game.novice=false;
|
||||||
game.setup=1;
|
game.setup=1;
|
||||||
game.blklin=true;
|
game.blklin=true;
|
||||||
|
|
||||||
/* if we can ever think of how, we should save it at this point */
|
|
||||||
|
|
||||||
return(0); /* then we won't actually return from initialisation */
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue