1 #ifndef GAME_SP_EXPORT_H
2 #define GAME_SP_EXPORT_H
4 /* ========================================================================= */
5 /* functions and definitions exported from game_sp to main program */
6 /* ========================================================================= */
8 /* ------------------------------------------------------------------------- */
9 /* constant definitions */
10 /* ------------------------------------------------------------------------- */
12 #define SP_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH
13 #define SP_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT
15 #define SP_NUM_LEVELS_PER_PACKAGE 111
17 #define SP_STD_PLAYFIELD_WIDTH 60
18 #define SP_STD_PLAYFIELD_HEIGHT 24
19 #define SP_LEVEL_NAME_LEN 23
20 #define SP_MAX_SPECIAL_PORTS 10
22 #define SP_HEADER_SIZE 96
23 #define SP_STD_PLAYFIELD_SIZE (SP_STD_PLAYFIELD_WIDTH * \
24 SP_STD_PLAYFIELD_HEIGHT)
25 #define SP_MAX_PLAYFIELD_SIZE (SP_MAX_PLAYFIELD_WIDTH * \
26 SP_MAX_PLAYFIELD_HEIGHT)
27 #define SP_STD_LEVEL_SIZE (SP_HEADER_SIZE + SP_STD_PLAYFIELD_SIZE)
30 #define SP_SCREEN_BUFFER_XSIZE (SCR_FIELDX + 2)
31 #define SP_SCREEN_BUFFER_YSIZE (SCR_FIELDY + 2)
34 #define SP_FRAMES_PER_SECOND 35
35 #define SP_MAX_TAPE_LEN 64010 /* (see "spfix63.doc") */
42 #define actExploding 2
45 #define actCollecting 5
51 /* ------------------------------------------------------------------------- */
52 /* data structure definitions */
53 /* ------------------------------------------------------------------------- */
55 #ifndef HAS_SpecialPortType
59 short PortLocation; // = 2*(x+(y*60)) /* big endian format */
61 int PortLocation; // = 2*(x+(y*60))
63 byte Gravity; // 1 = turn on, anything else (0) = turn off
64 byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!)
65 byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off
68 #define HAS_SpecialPortType
71 #ifndef HAS_LevelInfoType
75 byte InitialGravity; // 1=on, anything else (0) = off
76 byte Version; // SpeedFixVersion XOR &H20
78 byte InitialFreezeZonks; // 2=on, anything else (0) = off. (1=off too!)
81 // Number of Infotrons needed. 0 means that Supaplex will count the total
82 // amount of Infotrons in the level, and use the low byte of that number.
83 // (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!)
84 byte SpecialPortCount; // Maximum 10 allowed!
85 SpecialPortType SpecialPort[10];
86 byte SpeedByte; // = Speed XOR Highbyte(RandomSeed)
87 byte CheckSumByte; // = CheckSum XOR SpeedByte
89 short DemoRandomSeed; /* little endian format */
94 #define HAS_LevelInfoType
106 /* needed for updating panel */
108 int infotrons_still_needed;
112 /* needed for engine snapshots */
113 char **preceding_buffer;
114 int preceding_buffer_size;
116 int scroll_xoffset, scroll_yoffset;
121 boolean is_available; /* structure contains valid demo */
123 int level_nr; /* number of corresponding level */
125 int length; /* number of demo entries */
126 byte data[SP_MAX_TAPE_LEN]; /* array of demo entries */
131 LevelInfoType header;
132 byte header_raw_bytes[SP_HEADER_SIZE];
136 byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
138 struct DemoInfo_SP demo;
140 /* used for runtime values */
141 struct GameInfo_SP *game_sp;
144 struct GraphicInfo_SP
148 int src_offset_x, src_offset_y;
149 int dst_offset_x, dst_offset_y;
152 Bitmap *crumbled_bitmap;
153 int crumbled_src_x, crumbled_src_y;
154 int crumbled_border_size;
156 boolean has_crumbled_graphics;
157 boolean preserve_background;
159 int unique_identifier; /* used to identify needed screen updates */
162 struct EngineSnapshotInfo_SP
164 struct GameInfo_SP game_sp;
166 int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
167 byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
168 byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
170 int AnimationPosTable[SP_MAX_PLAYFIELD_SIZE];
171 byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE];
172 byte TerminalState[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
176 /* ------------------------------------------------------------------------- */
177 /* exported functions */
178 /* ------------------------------------------------------------------------- */
180 extern struct GlobalInfo_SP global_sp_info;
181 extern struct GameInfo_SP game_sp;
182 extern struct LevelInfo_SP native_sp_level;
183 extern struct GraphicInfo_SP graphic_info_sp_object[TILE_MAX][8];
184 extern struct GraphicInfo_SP graphic_info_sp_player[MAX_PLAYERS][SPR_MAX][8];
185 extern struct EngineSnapshotInfo_SP engine_snapshot_sp;
187 extern void sp_open_all();
188 extern void sp_close_all();
190 extern void InitPrecedingPlayfieldMemory();
191 extern void InitGfxBuffers_SP();
193 extern void InitGameEngine_SP();
194 extern void GameActions_SP(byte *, boolean);
196 extern unsigned int InitEngineRandom_SP(int);
198 extern void setLevelInfoToDefaults_SP();
199 extern void copyInternalEngineVars_SP();
200 extern boolean LoadNativeLevel_SP(char *, int, boolean);
201 extern void SaveNativeLevel_SP(char *);
203 extern void BackToFront_SP(void);
204 extern void BlitScreenToBitmap_SP(Bitmap *);
205 extern void RedrawPlayfield_SP(boolean);
206 extern void DrawGameDoorValues_SP();
208 extern void LoadEngineSnapshotValues_SP();
209 extern void SaveEngineSnapshotValues_SP();
211 extern int map_key_RND_to_SP(int);
212 extern int map_key_SP_to_RND(int);
214 extern int getRedDiskReleaseFlag_SP();
216 #endif /* GAME_SP_EXPORT_H */