1 /**
2  * @file towners.h
3  *
4  * Interface of functionality for loading and spawning towners.
5  */
6 #ifndef __TOWNERS_H__
7 #define __TOWNERS_H__
8 
9 DEVILUTION_BEGIN_NAMESPACE
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef enum _talker_id {
16 	TOWN_SMITH,
17 	TOWN_HEALER,
18 	TOWN_DEADGUY,
19 	TOWN_TAVERN,
20 	TOWN_STORY,
21 	TOWN_DRUNK,
22 	TOWN_WITCH,
23 	TOWN_BMAID,
24 	TOWN_PEGBOY,
25 	TOWN_COW,
26 	TOWN_FARMER,
27 	TOWN_GIRL,
28 	TOWN_COWFARM,
29 	NUM_TOWNER_TYPES,
30 } _talker_id;
31 
32 typedef struct TNQ {
33 	Uint8 _qsttype;
34 	Uint8 _qstmsg;
35 	bool _qstmsgact;
36 } TNQ;
37 
38 typedef struct TownerStruct {
39 	int _tmode;
40 	int _ttype;
41 	int _tx;    // Tile X-position of NPC
42 	int _ty;    // Tile Y-position of NPC
43 	int _txoff; // Sprite X-offset (unused)
44 	int _tyoff; // Sprite Y-offset (unused)
45 	int _txvel; // X-velocity during movement (unused)
46 	int _tyvel; // Y-velocity during movement (unused)
47 	int _tdir;  // Facing of NPC (unused)
48 	Uint8 *_tAnimData;
49 	int _tAnimDelay; // Tick length of each frame in the current animation
50 	int _tAnimCnt;   // Increases by one each game tick, counting how close we are to _pAnimDelay
51 	int _tAnimLen;   // Number of frames in current animation
52 	int _tAnimFrame; // Current frame of animation.
53 	int _tAnimFrameCnt;
54 	Sint8 _tAnimOrder;
55 	int _tAnimWidth;
56 	int _tAnimWidth2;
57 	int _tTenPer;
58 	int _teflag;
59 	int _tbtcnt;
60 	int _tSelFlag;
61 	bool _tMsgSaid;
62 	TNQ qsts[MAXQUESTS];
63 	int _tSeed;
64 	int _tVar1;
65 	int _tVar2;
66 	int _tVar3;
67 	int _tVar4;
68 	char _tName[PLR_NAME_LEN];
69 	Uint8 *_tNAnim[8];
70 	int _tNFrames;
71 	Uint8 *_tNData;
72 } TownerStruct;
73 
74 extern TownerStruct towner[NUM_TOWNERS];
75 
76 void InitTowners();
77 void FreeTownerGFX();
78 void ProcessTowners();
79 ItemStruct *PlrHasItem(int pnum, int item, int *i);
80 void TalkToTowner(int p, int t);
81 
82 extern _speech_id Qtalklist[NUM_TOWNER_TYPES][MAXQUESTS];
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 DEVILUTION_END_NAMESPACE
89 
90 #endif /* __TOWNERS_H__ */
91