Debian Codegraph @

prboom2/src/hexen/p_acs.h

raw
1 //
2 // Copyright(C) 1993-1996 Id Software, Inc.
3 // Copyright(C) 1993-2008 Raven Software
4 // Copyright(C) 2005-2014 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16
17 #ifndef __HEXEN_P_ACS__
18 #define __HEXEN_P_ACS__
19
20 #include "r_defs.h"
21 #include "p_mobj.h"
22
23 #define MAX_ACS_SCRIPT_VARS 10
24 #define MAX_ACS_MAP_VARS 32
25 #define MAX_ACS_WORLD_VARS 64
26 #define ACS_STACK_DEPTH 32
27 #define MAX_ACS_STORE 20
28
29 typedef enum
30 {
31 ASTE_INACTIVE,
32 ASTE_RUNNING,
33 ASTE_SUSPENDED,
34 ASTE_WAITINGFORTAG,
35 ASTE_WAITINGFORPOLY,
36 ASTE_WAITINGFORSCRIPT,
37 ASTE_TERMINATING
38 } aste_t;
39
40 typedef struct acs_s acs_t;
41 typedef struct acsInfo_s acsInfo_t;
42
43 struct acsInfo_s
44 {
45 int number;
46 int offset;
47 int argCount;
48 aste_t state;
49 int waitValue;
50 };
51
52 struct acs_s
53 {
54 thinker_t thinker;
55 mobj_t *activator;
56 line_t *line;
57 int side;
58 int number;
59 int infoIndex;
60 int delayCount;
61 int stack[ACS_STACK_DEPTH];
62 int stackPtr;
63 int vars[MAX_ACS_SCRIPT_VARS];
64 int ip;
65 };
66
67 typedef struct
68 {
69 int map; // Target map
70 int script; // Script number on target map
71 byte args[4]; // Padded to 4 for alignment
72 } acsstore_t;
73
74 void P_LoadACScripts(int lump);
75 dboolean P_StartACS(int number, int map, byte * args, mobj_t * activator, line_t * line, int side);
76 dboolean P_StartLockedACS(line_t * line, byte * args, mobj_t * mo, int side);
77 dboolean P_TerminateACS(int number, int map);
78 dboolean P_SuspendACS(int number, int map);
79 void T_InterpretACS(acs_t * script);
80 void P_TagFinished(int tag);
81 void P_PolyobjFinished(int po);
82 void P_ACSInitNewGame(void);
83 void P_CheckACSStore(void);
84 void CheckACSPresent(int number);
85
86 extern int ACScriptCount;
87 extern const byte *ActionCodeBase;
88 extern acsInfo_t *ACSInfo;
89 extern int MapVars[MAX_ACS_MAP_VARS];
90 extern int WorldVars[MAX_ACS_WORLD_VARS];
91 extern acsstore_t ACSStore[MAX_ACS_STORE + 1]; // +1 for termination marker
92
93 #endif