2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/portal/oracle_.h,v 1.2 2000/01/29 13:37:16 adurant Exp $
11 void OracleSmartStart(int answer_flags
);
12 // Oracle start frame. The oracle tries to answer questions
13 // indicated by answer flags. Generally you need to do this
14 // two frames in a row before he starts doing it.
16 void OracleStartFrame(int answer_flags
, int memorize_flags
);
17 // during this frame, answer queries from answer_flags,
18 // and memorize queries from memorize_flags
19 // we can only answer queries if answer_flags == last non-zero
22 // The following functions are actually macros so don't have prototypes
24 // bool OracleAnswer(int flags, void *data, int data_size)
25 // returns true if the oracle answered (in which case results are
28 // bool OracleMemorize(int flags, void *data, int data_size)
29 // returns true if the oracle memorized the results
31 // bool OracleBool(int flags, function-returning-bool)
32 // If the oracle is answering 'flags', then it returns
33 // an appropriate bool. If the oracle is memorizing 'flags',
34 // then the function is called and the result memorized
35 // and returned. Otherwise the function is called, and the
36 // result returned out.
38 // IMPLEMENTATION INNARDS
40 extern int oracle_flags
;
41 extern int oracle_save
;
43 bool OracleFetch(int requeue
, void *data
, int datasize
);
44 bool OracleStore(void *data
, int datasize
);
46 bool OracleFetchBool(int requeue
);
47 bool OracleStoreBool(bool result
); // returns the passed-in bool
50 // pass in data (pointer) and size of data pointed to
51 // returns trye if the Oracle knew the result
52 #define OracleAnswer(f,data,size) \
53 (oracle_flags & (f) ? OracleFetch(oracle_save & (f), data, size) : 0)
55 // always returns false:
56 #define OracleMemorize(f,data,datasize) \
57 (oracle_save & (f) ? OracleStore(data, datasize) : 0)
59 // special convenient boolean oracle:
61 #define OracleBool(flags, func) \
62 (oracle_flags & (flags) \
63 ? OracleFetchBool(oracle_save & (flags)) \
64 : (oracle_save & (flags)) \
65 ? OracleStoreBool(func) \