OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [adventure/] [funcs.h] - Blame information for rev 235

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 90 ja_rd
/*  STATEMENT FUNCTIONS
2
 *
3
 *  AT(OBJ)     = TRUE IF ON EITHER SIDE OF TWO-PLACED OBJECT
4
 *  CNDBIT(L,N) = TRUE IF COND(L) HAS BIT N SET (BIT 0 IS UNITS BIT)
5
 *  DARK(DUMMY) = TRUE IF LOCATION "LOC" IS DARK
6
 *  FORCED(LOC) = TRUE IF LOC MOVES WITHOUT ASKING FOR INPUT (COND=2)
7
 *  FOREST(LOC)  = TRUE IF LOC IS PART OF THE FOREST
8
 *  GSTONE(OBJ)  = TRUE IF OBJ IS A GEMSTONE
9
 *  HERE(OBJ)   = TRUE IF THE OBJ IS AT "LOC" (OR IS BEING CARRIED)
10
 *  LIQ(DUMMY)  = OBJECT NUMBER OF LIQUID IN BOTTLE
11
 *  LIQLOC(LOC) = OBJECT NUMBER OF LIQUID (IF ANY) AT LOC
12
 *  PCT(N)       = TRUE N% OF THE TIME (N INTEGER FROM 0 TO 100)
13
 *  TOTING(OBJ) = TRUE IF THE OBJ IS BEING CARRIED */
14
 
15
#define TOTING(OBJ)     (PLACE[OBJ] == -1)
16
#define AT(OBJ) (PLACE[OBJ] == LOC || FIXED[OBJ] == LOC)
17
#define HERE(OBJ)       (AT(OBJ) || TOTING(OBJ))
18
#define LIQ2(PBOTL)     ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
19
#define LIQ(DUMMY)      (LIQ2(PROP[BOTTLE]<0 ? -1-PROP[BOTTLE] : PROP[BOTTLE]))
20
#define LIQLOC(LOC)     (LIQ2((MOD(COND[LOC]/2*2,8)-5)*MOD(COND[LOC]/4,2)+1))
21
#define CNDBIT(L,N)     (TSTBIT(COND[L],N))
22
#define FORCED(LOC)     (COND[LOC] == 2)
23
#define DARK(DUMMY)     ((!CNDBIT(LOC,0)) && (PROP[LAMP] == 0 || !HERE(LAMP)))
24
#define PCT(N)  (RAN(100) < (N))
25
#define GSTONE(OBJ)     ((OBJ) == EMRALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
26
#define FOREST(LOC)     ((LOC) >= 145 && (LOC) <= 166)
27
#define VOCWRD(LETTRS,SECT)     (VOCAB(MAKEWD(LETTRS),SECT))
28
 
29
/*  THE FOLLOWING TWO FUNCTIONS WERE ADDED TO FIX A BUG (CLOCK1 DECREMENTED
30
 *  WHILE IN FOREST).  THEY SHOULD PROBABLY BE REPLACED BY USING ANOTHER
31
 *  "COND" BIT.  FOR NOW, HOWEVER, A QUICK FIX...  OUTSID(LOC) IS TRUE IF
32
 *  LOC IS OUTSIDE, INDEEP(LOC) IS TRUE IF LOC IS "DEEP" IN THE CAVE (HALL
33
 *  OF MISTS OR DEEPER).  NOTE SPECIAL KLUDGES FOR "FOOF" LOCS. */
34
 
35
#define OUTSID(LOC)     ((LOC) <= 8 || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == 180 || (LOC) == 182)
36
#define INDEEP(LOC)     ((LOC) >= 15 && !OUTSID(LOC) && (LOC) != 179)
37
 
38
 
39
 
40
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.