alot of things changed in code file format; preparing for room local scripts
[awish.git] / src / gameglobals.h
blob76a13fbd24057332dc8d9d61ef7b597db89dad85
1 /*
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 #ifndef _GAMEGLOBALS_H_
16 #define _GAMEGLOBALS_H_
18 #include "stdarg.h"
19 #include "stdlib.h"
20 #include "stdio.h"
22 #include "resfile.h"
23 #include "vm.h"
25 #include "SDL.h"
28 extern ResFile resfile;
30 extern SDL_Surface *backs[8]; //0: title
33 typedef struct {
34 int count;
35 SDL_Surface *spr[256][2];
36 } SpriteBank;
38 extern SpriteBank banks[256];
41 enum {
42 LB_MIN_TYPE = 0,
43 LB_GVAR = 0,
44 LB_TVAR,
45 LB_SVAR,
46 LB_CODE,
47 LB_CONST,
48 LB_MAX_TYPE,
49 LB_MARK = -1
53 typedef struct LabelInfo {
54 struct LabelInfo *next;
55 char *name;
56 int type;
57 int value;
58 int pub; // public?
59 } LabelInfo;
61 //extern LabelInfo *labels;
63 extern void fatal (const char *fmt, ...) __attribute__((__noreturn__)) __attribute__((format(printf, 1, 2)));
65 // return code size
66 extern int loadVMCode (ResFile *resfile, int pc);
68 extern void freeLabels (void);
69 extern void freeLabelsUntilMark (void);
71 extern void labelAddMark (void);
72 extern LabelInfo *addLabel (const char *name, int type, int value, int pub);
74 extern LabelInfo *findLabel (const char *name);
76 extern int findPC (const char *name);
77 extern int findVarIndex (const char *name);
78 extern int findGVarIndex (const char *name);
79 extern int findTVarIndex (const char *name);
80 extern int findSVarIndex (const char *name);
81 extern int findConst (const char *name);
83 extern void initLabels (void);
86 #include "vm_gamelabels.h"
89 #endif