1 /* header file for client */
2 
3 typedef void game;
4 
5 #define Turn_NORMAL	(0)
6 #define Turn_HASTE	(1)
7 #define Turn_TIMESTOP	(2)
8 
9 #define Gesture_NOTHING		(0)
10 #define Gesture_PALM		(1)
11 #define Gesture_DIGIT		(2)
12 #define Gesture_FINGERS		(3)
13 #define Gesture_WAVE		(4)
14 #define Gesture_CLAPHALF	(5)
15 #define Gesture_SNAP		(6)
16 #define Gesture_KNIFE		(7)
17 
18 #define Gesture_ANTISPELL	(8) /* not less than NUMGESTURES, because. */
19 #define Gesture_UNCLEAR		(9) /* not less than NUMGESTURES, because. */
20 
21 #define NUMGESTURES		(8)
22 #define Gesture_DOUBLE		(16)
23 
24 #define MAXPLAYERS		(8)
25 
26 #define Gender_NONE		(0)
27 #define Gender_MALE		(1)
28 #define Gender_FEMALE		(2)
29 #define Gender_NEUTER		(3)
30 
31 #define Stuff_RESIST_HEAT	(1<<0)
32 #define Stuff_RESIST_COLD	(1<<1)
33 #define Stuff_PROTECT_EVIL	(1<<2)
34 #define Stuff_POISON		(1<<3)
35 #define Stuff_DISEASE		(1<<4)
36 #define Stuff_INVISIBLE		(1<<5)
37 #define Stuff_BLIND		(1<<6)
38 
39 #define Qu_NoQuery	(0)
40 /* placeholder; to be ignored by client */
41 #define Qu_LeftHand	(1)
42 #define Qu_RightHand	(2)
43 /* rock is an array of int. rock[0] is the list length; rock[1..len] is a spell number,
44    ORed with QuVal_Hand_Both if the spell requires both hands. Answer is an index
45    into rock (0..len-1) */
46 #define Qu_SetOffDelay	(3)
47 /* rock is the spell number */
48 
49 #define Qu_ElementalType (4)
50 /* no rock */
51 
52 #define Qu_ParalysisHand (5)
53 #define Qu_CharmHand (6)
54 /* rock is index number of target wizard */
55 
56 #define Qu_CharmGesture (7)
57 /* rock is index number of target wizard. Answer is Gesture_*. */
58 
59 #define Qu_MonsterTarget (8)
60 /* rock is (0 if monster gets one attack, 1 or 2 if it gets two) * 256 + monster index.
61    Answer is a wizard/creature number, ORed with QuVal_Target_*. (Or 0 for none). */
62 
63 #define Qu_WhichToDelay (9)
64 #define Qu_WhichToPerm (10)
65 /* rock is a pointer to an int array of spell numbers, terminated by -1. */
66 
67 /* for qtypes higher than this, it's a target picker. rock is the spell number,
68    ORed with QuVal_Hand_*. Answer is a wizard/creature/corpse number, ORed with
69    QuVal_Target_*. (Or 0 for none) */
70 
71 #define Qu_TargetBeing		(20)
72 #define Qu_TargetBeingNone	(21)
73 #define Qu_TargetWizard		(22)
74 #define Qu_TargetWizardNone	(23)
75 #define Qu_TargetRaiseDead	(24)
76 
77 
78 #define QuVal_Hand_Left		(256)
79 #define QuVal_Hand_Right	(512)
80 #define QuVal_Hand_Both		(1024)
81 #define QuVal_Hand_MASK		(QuVal_Hand_Left | QuVal_Hand_Right | QuVal_Hand_Both)
82 
83 #define QuVal_Target_Wizard	(256)
84 #define QuVal_Target_Creature	(512)
85 #define QuVal_Target_Corpse	(1024)
86 #define QuVal_Target_MASK	(QuVal_Target_Wizard | QuVal_Target_Creature | QuVal_Target_Corpse)
87 
88 
89 struct query {
90     int player;
91     int qtype;
92     char *rock;
93     int answer; /* to be filled in */
94 };
95 
96 struct interface {
97     /* in the printing calls, any char * may be NULL */
98     void (*proc_PrintMsg)( /* char *msg, game *game, rock */ );
99     void (*proc_PrintMsg2)( /* int person1, char *msg1, char *msgelse, game *game, rock */ );
100     void (*proc_PrintMsg3)( /* int person1, int person2, char *msg1, char *msg2,
101 		char *msgelse, game *game, rock */ );
102     void (*proc_Queries)( /* int numqueries, struct query *qlist, game *game, rock */ );
103 };
104 
105 extern game *BeginGame( /* int numplayers, char **names, int *genders, struct interface *callbacks, rock */ );
106 /* names is a pointer to an array of name strings. */
107 
108 extern int RunTurn( /* game *game, int *moves */ );
109 /* moves contains two ints for each player (left, right). The encoding is with Gesture_*. */
110 
111 extern void SeeGesture( /* game *game, int player, int asker, int *buf, int size */ );
112 
113 extern void FreeGame( /* game *game */ );
114 
115 extern int TurnType( /* game *game */ );
116 extern int TurnPlayerActive( /* game *game, int player */ );
117 
118 extern int NumberOfTargets( /* game *game, int targettype */);
119 extern char *NameOfTarget( /* game *game, int targettype, int targetnum */);
120 extern int StuffAboutTarget( /* game *game, int targettype, int targetnum */);
121 /* targettype is QuVal_Target_* */
122 
123 extern int NumberOfBeings( /* game *game, int targettype */);
124 extern int HitPointsOfBeing( /* game *game, int targettype, int indexnum */);
125 extern int StuffAboutBeing( /* game *game, int targettype, int indexnum */);
126 extern int OwnerOfCreature( /* game *game, int indexnum */);
127 extern char *NameOfBeing( /* game *game, int targettype, int indexnum */);
128 /* targettype is QuVal_Target_* */
129 
130 extern void LogInTranscript( /* game *game, char *str */);
131 extern void WriteTranscript( /* game *game, FILE *f */);
132