rnd-20091011-1-src
[rocksndiamonds.git] / src / game_sp / export.h
1 #ifndef GAME_SP_EXPORT_H
2 #define GAME_SP_EXPORT_H
3
4 /* ========================================================================= */
5 /* functions and definitions exported from game_sp to main program           */
6 /* ========================================================================= */
7
8 /* ------------------------------------------------------------------------- */
9 /* constant definitions                                                      */
10 /* ------------------------------------------------------------------------- */
11
12 #define SP_MAX_PLAYFIELD_WIDTH          MAX_PLAYFIELD_WIDTH
13 #define SP_MAX_PLAYFIELD_HEIGHT         MAX_PLAYFIELD_HEIGHT
14
15 #define SP_NUM_LEVELS_PER_PACKAGE       111
16
17 #define SP_PLAYFIELD_WIDTH              60
18 #define SP_PLAYFIELD_HEIGHT             24
19 #define SP_LEVEL_NAME_LEN               23
20 #define SP_MAX_SPECIAL_PORTS            10
21
22 #define SP_HEADER_SIZE                  96
23 #define SP_PLAYFIELD_SIZE               (SP_PLAYFIELD_WIDTH *           \
24                                          SP_PLAYFIELD_HEIGHT)
25 #define SP_LEVEL_SIZE                   (SP_HEADER_SIZE + SP_PLAYFIELD_SIZE)
26
27 #define SP_FRAMES_PER_SECOND            35
28 #define SP_MAX_TAPE_LEN                 64010   /* (see "spfix63.doc") */
29
30
31 /* ------------------------------------------------------------------------- */
32 /* data structure definitions                                                */
33 /* ------------------------------------------------------------------------- */
34
35 #ifndef HAS_SpecialPortType
36 typedef struct
37 {
38 #if 1
39   short PortLocation; // = 2*(x+(y*60))         /* big endian format */
40 #else
41   int PortLocation; // = 2*(x+(y*60))
42 #endif
43   byte Gravity; // 1 = turn on, anything else (0) = turn off
44   byte FreezeZonks; // 2 = turn on, anything else (0) = turn off  (1=off!)
45   byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off
46   byte UnUsed;
47 } SpecialPortType;
48 #define HAS_SpecialPortType
49 #endif
50
51 #ifndef HAS_LevelInfoType
52 typedef struct
53 {
54   byte UnUsed[4];
55   byte InitialGravity; // 1=on, anything else (0) = off
56   byte Version; // SpeedFixVersion XOR &H20
57   char LevelTitle[23];
58   byte InitialFreezeZonks; // 2=on, anything else (0) = off.  (1=off too!)
59   byte InfotronsNeeded;
60
61   // Number of Infotrons needed. 0 means that Supaplex will count the total
62   // amount of Infotrons in the level, and use the low byte of that number.
63   // (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!)
64   byte SpecialPortCount; // Maximum 10 allowed!
65   SpecialPortType SpecialPort[10];
66   byte SpeedByte; // = Speed XOR Highbyte(RandomSeed)
67   byte CheckSumByte; // = CheckSum XOR SpeedByte
68 #if 1
69   short DemoRandomSeed;                         /* little endian format */
70 #else
71   int DemoRandomSeed;
72 #endif
73 } LevelInfoType;
74 #define HAS_LevelInfoType
75 #endif
76
77 struct GlobalInfo_SP
78 {
79 };
80
81 struct GameInfo_SP
82 {
83 };
84
85 struct LevelInfo_SP
86 {
87   LevelInfoType header;
88
89   byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
90
91   int width, height;
92
93   boolean demo_available;
94
95   byte demo[SP_MAX_TAPE_LEN];
96   int demo_length;
97 };
98
99 struct GraphicInfo_SP
100 {
101   Bitmap *bitmap;
102   int src_x, src_y;
103   int src_offset_x, src_offset_y;
104   int dst_offset_x, dst_offset_y;
105   int width, height;
106
107   Bitmap *crumbled_bitmap;
108   int crumbled_src_x, crumbled_src_y;
109   int crumbled_border_size;
110
111   boolean has_crumbled_graphics;
112   boolean preserve_background;
113
114   int unique_identifier;        /* used to identify needed screen updates */
115 };
116
117 struct EngineSnapshotInfo_SP
118 {
119   struct GameInfo_SP game_sp;
120 };
121
122
123 /* ------------------------------------------------------------------------- */
124 /* exported functions                                                        */
125 /* ------------------------------------------------------------------------- */
126
127 extern struct GlobalInfo_SP global_sp_info;
128 extern struct LevelInfo_SP native_sp_level;
129 extern struct GraphicInfo_SP graphic_info_sp_object[TILE_MAX][8];
130 extern struct GraphicInfo_SP graphic_info_sp_player[MAX_PLAYERS][SPR_MAX][8];
131 extern struct EngineSnapshotInfo_SP engine_snapshot_sp;
132
133 extern void sp_open_all();
134 extern void sp_close_all();
135
136 extern void InitGameEngine_SP();
137 extern void GameActions_SP(byte *, boolean);
138
139 extern unsigned int InitEngineRandom_SP(long);
140
141 extern void setLevelInfoToDefaults_SP();
142 extern void copyInternalEngineVars_SP();
143 extern boolean LoadNativeLevel_SP(char *, int);
144
145 extern void BackToFront_SP(void);
146 extern void BlitScreenToBitmap_SP(Bitmap *);
147 extern void RedrawPlayfield_SP(boolean);
148 extern void DrawGameDoorValues_SP();
149
150 extern void LoadEngineSnapshotValues_SP();
151 extern void SaveEngineSnapshotValues_SP();
152
153 #endif  /* GAME_SP_EXPORT_H */