projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Capture clock variables into the game-state block.
[open-adventure.git]
/
actions1.c
diff --git
a/actions1.c
b/actions1.c
index 0a1155d800c355058c63506e76519b8c2b7f0891..d12052fa42a9949ea13d701482e2bd48c25c9ca9 100644
(file)
--- a/
actions1.c
+++ b/
actions1.c
@@
-1,9
+1,8
@@
#include <stdlib.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdbool.h>
-#include "misc.h"
-#include "main.h"
-#include "share.h"
+#include "advent.h"
#include "funcs.h"
#include "funcs.h"
+#include "database.h"
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
@@
-65,7
+64,6
@@
L4000: VERB=K;
case 31: goto L8320; /* FLY */
case 32: goto L8330; /* LISTEN */
case 33: goto L8340; /* ZZZZ */
case 31: goto L8320; /* FLY */
case 32: goto L8330; /* LISTEN */
case 33: goto L8340; /* ZZZZ */
- case 34: goto L8350; /* SEED */
}
BUG(23);
}
BUG(23);
@@
-106,7
+104,6
@@
L4090: switch (VERB-1) {
case 31: goto L9320; /* FLY */
case 32: return(2011); /* LISTEN */
case 33: goto L8340; /* ZZZZ */
case 31: goto L9320; /* FLY */
case 32: return(2011); /* LISTEN */
case 33: goto L8340; /* ZZZZ */
- case 34: goto L8350; /* SEED */
}
BUG(24);
}
BUG(24);
@@
-204,7
+201,7
@@
L9040: if(OBJ == CLAM || OBJ == OYSTER) goto L9046;
if(OBJ == CHAIN) goto L9048;
if(!CLOSNG) goto L9043;
K=130;
if(OBJ == CHAIN) goto L9048;
if(!CLOSNG) goto L9043;
K=130;
- if(!PANIC)
CLOCK
2=15;
+ if(!PANIC)
game.clock
2=15;
PANIC=true;
return(2010);
PANIC=true;
return(2010);
@@
-251,8
+248,8
@@
L9049: SPK=172;
/* Light. Applicable only to lamp and urn. */
L8070: if(HERE(LAMP) && PROP[LAMP] == 0 && LIMIT >= 0)OBJ=LAMP;
/* Light. Applicable only to lamp and urn. */
L8070: if(HERE(LAMP) && PROP[LAMP] == 0 && LIMIT >= 0)OBJ=LAMP;
- if(HERE(URN) && PROP[URN] == 1)OBJ=OBJ*
100
+URN;
- if(OBJ == 0 || OBJ >
100
) return(8000);
+ if(HERE(URN) && PROP[URN] == 1)OBJ=OBJ*
NOBJECTS
+URN;
+ if(OBJ == 0 || OBJ >
NOBJECTS
) return(8000);
L9070: if(OBJ == URN) goto L9073;
if(OBJ != LAMP) return(2011);
L9070: if(OBJ == URN) goto L9073;
if(OBJ != LAMP) return(2011);
@@
-272,8
+269,8
@@
L9073: SPK=38;
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
L8080: if(HERE(LAMP) && PROP[LAMP] == 1)OBJ=LAMP;
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
L8080: if(HERE(LAMP) && PROP[LAMP] == 1)OBJ=LAMP;
- if(HERE(URN) && PROP[URN] == 2)OBJ=OBJ*
100
+URN;
- if(OBJ == 0 || OBJ >
100
) return(8000);
+ if(HERE(URN) && PROP[URN] == 2)OBJ=OBJ*
NOBJECTS
+URN;
+ if(OBJ == 0 || OBJ >
NOBJECTS
) return(8000);
L9080: if(OBJ == URN) goto L9083;
if(OBJ == LAMP) goto L9086;
L9080: if(OBJ == URN) goto L9083;
if(OBJ == LAMP) goto L9086;
@@
-409,7
+406,7
@@
L9190: if(AT(OBJ) || (LIQ(0) == OBJ && AT(BOTTLE)) || K == LIQLOC(LOC) || (OBJ =
/* Inventory. If object, treat same as find. Else report on current burden. */
L8200: SPK=98;
/* Inventory. If object, treat same as find. Else report on current burden. */
L8200: SPK=98;
- /* 8201 */ for (I=1; I<=
100
; I++) {
+ /* 8201 */ for (I=1; I<=
NOBJECTS
; I++) {
if(I == BEAR || !TOTING(I)) goto L8201;
if(SPK == 98)RSPEAK(99);
BLKLIN=false;
if(I == BEAR || !TOTING(I)) goto L8201;
if(SPK == 98)RSPEAK(99);
BLKLIN=false;
@@
-477,10
+474,10
@@
L8260: SPK=156;
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
-L8270: for (I=1; I<=
100
; I++) {
- if(HERE(I) && OBJTXT[I] != 0 && PROP[I] >= 0)OBJ=OBJ*
100
+I;
+L8270: for (I=1; I<=
NOBJECTS
; I++) {
+ if(HERE(I) && OBJTXT[I] != 0 && PROP[I] >= 0)OBJ=OBJ*
NOBJECTS
+I;
} /* end loop */
} /* end loop */
- if(OBJ >
100
|| OBJ == 0 || DARK(0)) return(8000);
+ if(OBJ >
NOBJECTS
|| OBJ == 0 || DARK(0)) return(8000);
L9270: if(DARK(0)) goto L5190;
if(OBJTXT[OBJ] == 0 || PROP[OBJ] < 0) return(2011);
L9270: if(DARK(0)) goto L5190;
if(OBJTXT[OBJ] == 0 || PROP[OBJ] < 0) return(2011);
@@
-524,7
+521,7
@@
L8300: SPK=201;
/* This next part is shared with the "resume" code. The two cases are
* distinguished by the value of kk (-1 for suspend, +1 for resume). */
/* This next part is shared with the "resume" code. The two cases are
* distinguished by the value of kk (-1 for suspend, +1 for resume). */
-L8305: DATIME(
I,
K);
+L8305: DATIME(
&I,&
K);
K=I+650*K;
SAVWRD(KK,K);
K=VRSION;
K=I+650*K;
SAVWRD(KK,K);
K=VRSION;
@@
-536,28
+533,28
@@
L8305: DATIME(I,K);
* 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
* with junk variables to bring it up to 7 values. */
* 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
* with junk variables to bring it up to 7 values. */
- SAVWDS(ABBNUM,BLKLIN,BONUS,
CLOCK1,CLOCK
2,CLOSED,CLOSNG);
+ SAVWDS(ABBNUM,BLKLIN,BONUS,
game.clock1,game.clock
2,CLOSED,CLOSNG);
SAVWDS(DETAIL,DFLAG,DKILL,DTOTAL,FOOBAR,HOLDNG,IWEST);
SAVWDS(KNFLOC,LIMIT,LL,LMWARN,LOC,NEWLOC,NUMDIE);
SAVWDS(DETAIL,DFLAG,DKILL,DTOTAL,FOOBAR,HOLDNG,IWEST);
SAVWDS(KNFLOC,LIMIT,LL,LMWARN,LOC,NEWLOC,NUMDIE);
- SAVWDS(OBJ,
OLDLC2,OLDLOC
,OLDOBJ,PANIC,SAVED,SETUP);
+ SAVWDS(OBJ,
game.oldlc2,game.oldloc
,OLDOBJ,PANIC,SAVED,SETUP);
SAVWDS(SPK,TALLY,THRESH,TRNDEX,TRNLUZ,TURNS,OBJTXT[OYSTER]);
SAVWDS(SPK,TALLY,THRESH,TRNDEX,TRNLUZ,TURNS,OBJTXT[OYSTER]);
- SAVWDS(VERB,WD1,WD1X,WD2,WZDARK,
ZZWORD
,OBJSND[BIRD]);
+ SAVWDS(VERB,WD1,WD1X,WD2,WZDARK,
game.zzword
,OBJSND[BIRD]);
SAVWDS(OBJTXT[SIGN],CLSHNT,NOVICE,K,K,K,K);
SAVARR(ABB,LOCSIZ);
SAVARR(ATLOC,LOCSIZ);
SAVWDS(OBJTXT[SIGN],CLSHNT,NOVICE,K,K,K,K);
SAVARR(ABB,LOCSIZ);
SAVARR(ATLOC,LOCSIZ);
- SAVARR(
DLOC,6
);
- SAVARR(
DSEEN,6
);
- SAVARR(FIXED,
100
);
+ SAVARR(
game.dloc,NDWARVES
);
+ SAVARR(
game.dseen,NDWARVES
);
+ SAVARR(FIXED,
NOBJECTS
);
SAVARR(HINTED,HNTSIZ);
SAVARR(HINTLC,HNTSIZ);
SAVARR(HINTED,HNTSIZ);
SAVARR(HINTLC,HNTSIZ);
- SAVARR(LINK,
200
);
- SAVARR(
ODLOC,6
);
- SAVARR(PLACE,
100
);
- SAVARR(PROP,
100
);
+ SAVARR(LINK,
NOBJECTS*2
);
+ SAVARR(
game.odloc,NDWARVES
);
+ SAVARR(PLACE,
NOBJECTS
);
+ SAVARR(PROP,
NOBJECTS
);
SAVWRD(KK,K);
if(K != 0) goto L8318;
K=NUL;
SAVWRD(KK,K);
if(K != 0) goto L8318;
K=NUL;
-
ZZWORD=RNDVOC(3,ZZWORD-MESH*2)+MESH*2
;
+
game.zzword=RNDVOC(3,game.zzword)
;
if(KK > 0) return(8);
RSPEAK(266);
exit(0);
if(KK > 0) return(8);
RSPEAK(266);
exit(0);
@@
-588,8
+585,8
@@
L8320: if(PROP[RUG] != 2)SPK=224;
L9320: if(OBJ != RUG) return(2011);
SPK=223;
if(PROP[RUG] != 2) return(2011);
L9320: if(OBJ != RUG) return(2011);
SPK=223;
if(PROP[RUG] != 2) return(2011);
-
OLDLC2=OLDLOC
;
-
OLDLOC
=LOC;
+
game.oldlc2=game.oldloc
;
+
game.oldloc
=LOC;
NEWLOC=PLACE[RUG]+FIXED[RUG]-LOC;
SPK=226;
if(PROP[SAPPH] >= 0)SPK=227;
NEWLOC=PLACE[RUG]+FIXED[RUG]-LOC;
SPK=226;
if(PROP[SAPPH] >= 0)SPK=227;
@@
-601,11
+598,11
@@
L9320: if(OBJ != RUG) return(2011);
L8330: SPK=228;
K=LOCSND[LOC];
if(K == 0) goto L8332;
L8330: SPK=228;
K=LOCSND[LOC];
if(K == 0) goto L8332;
- RSPEAK(
IABS
(K));
+ RSPEAK(
labs
(K));
if(K < 0) return(2012);
SPK=0;
if(K < 0) return(2012);
SPK=0;
-L8332: SETPRM(1,
ZZWORD-MESH*2
,0);
- /* 8335 */ for (I=1; I<=
100
; I++) {
+L8332: SETPRM(1,
game.zzword
,0);
+ /* 8335 */ for (I=1; I<=
NOBJECTS
; I++) {
if(!HERE(I) || OBJSND[I] == 0 || PROP[I] < 0) goto L8335;
PSPEAK(I,OBJSND[I]+PROP[I]);
SPK=0;
if(!HERE(I) || OBJSND[I] == 0 || PROP[I] < 0) goto L8335;
PSPEAK(I,OBJSND[I]+PROP[I]);
SPK=0;
@@
-620,19
+617,9
@@
L8340: if(!AT(RESER) && LOC != FIXED[RESER]-1) return(2011);
PSPEAK(RESER,PROP[RESER]+1);
PROP[RESER]=1-PROP[RESER];
if(AT(RESER)) return(2012);
PSPEAK(RESER,PROP[RESER]+1);
PROP[RESER]=1-PROP[RESER];
if(AT(RESER)) return(2012);
-
OLDLC
2=LOC;
+
game.oldlc
2=LOC;
NEWLOC=0;
RSPEAK(241);
return(2);
NEWLOC=0;
RSPEAK(241);
return(2);
-/* Seed. Expected in game logs to replicate the LCG state */
-
-L8350: {
- long sv;
- int n;
- n = sscanf(raw_input, "seed %ld\n", &sv);
- if (n >= 1)
- set_seed(sv);
- return(2);
- }
}
}