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)
29 #define SP_FRAMES_PER_SECOND 35
31 // use a much higher value to be able to load ultra-long MPX demo files
32 // (like for level collection 78, level 88 ("WAITING FOR GODOT AGAIN"))
33 // #define SP_MAX_TAPE_LEN 500000
34 #define SP_MAX_TAPE_LEN 64010 // (see "spfix63.doc")
41 #define actExploding 2
44 #define actCollecting 5
50 // ----------------------------------------------------------------------------
51 // data structure definitions
52 // ----------------------------------------------------------------------------
54 #ifndef HAS_SpecialPortType
57 short PortLocation; // = 2*(x+(y*60)) // big endian format
58 byte Gravity; // 1 = turn on, anything else (0) = turn off
59 byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!)
60 byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off
63 #define HAS_SpecialPortType
66 #ifndef HAS_LevelInfoType
70 byte InitialGravity; // 1=on, anything else (0) = off
71 byte Version; // SpeedFixVersion XOR &H20
73 byte InitialFreezeZonks; // 2=on, anything else (0) = off. (1=off too!)
76 // Number of Infotrons needed. 0 means that Supaplex will count the total
77 // amount of Infotrons in the level, and use the low byte of that number.
78 // (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!)
79 byte SpecialPortCount; // Maximum 10 allowed!
80 SpecialPortType SpecialPort[10];
81 byte SpeedByte; // = Speed XOR Highbyte(RandomSeed)
82 byte CheckSumByte; // = CheckSum XOR SpeedByte
83 short DemoRandomSeed; // little endian format
85 #define HAS_LevelInfoType
93 // needed for updating panel
95 int infotrons_still_needed;
99 // needed for engine snapshots
100 char **preceding_buffer;
101 int preceding_buffer_size;
103 int scroll_xoffset, scroll_yoffset;
108 boolean is_available; // structure contains valid demo
110 int level_nr; // number of corresponding level
112 int length; // number of demo entries
113 byte data[SP_MAX_TAPE_LEN]; // array of demo entries
118 LevelInfoType header;
119 byte header_raw_bytes[SP_HEADER_SIZE];
123 byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
125 struct DemoInfo_SP demo;
128 struct GraphicInfo_SP
132 int src_offset_x, src_offset_y;
133 int dst_offset_x, dst_offset_y;
136 Bitmap *crumbled_bitmap;
137 int crumbled_src_x, crumbled_src_y;
138 int crumbled_border_size;
140 boolean has_crumbled_graphics;
141 boolean preserve_background;
143 int unique_identifier; // used to identify needed screen updates
146 struct EngineSnapshotInfo_SP
148 struct GameInfo_SP game_sp;
150 int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
151 byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
152 byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
154 int AnimationPosTable[SP_MAX_PLAYFIELD_SIZE];
155 byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE];
156 byte TerminalState[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
160 // ----------------------------------------------------------------------------
161 // exported functions
162 // ----------------------------------------------------------------------------
164 extern struct GameInfo_SP game_sp;
165 extern struct LevelInfo_SP native_sp_level;
166 extern struct EngineSnapshotInfo_SP engine_snapshot_sp;
168 void sp_open_all(void);
169 void sp_close_all(void);
171 void InitPrecedingPlayfieldMemory(void);
172 void InitGfxBuffers_SP(void);
174 void InitGameEngine_SP(void);
175 void GameActions_SP(byte *, boolean);
177 unsigned int InitEngineRandom_SP(int);
179 void setLevelInfoToDefaults_SP(void);
180 void copyInternalEngineVars_SP(void);
181 boolean LoadNativeLevel_SP(char *, int, boolean);
182 void SaveNativeLevel_SP(char *);
184 int getFieldbufferOffsetX_SP(void);
185 int getFieldbufferOffsetY_SP(void);
187 void BlitScreenToBitmap_SP(Bitmap *);
188 void RedrawPlayfield_SP(boolean);
190 void LoadEngineSnapshotValues_SP(void);
191 void SaveEngineSnapshotValues_SP(ListNode **);
193 int map_key_RND_to_SP(int);
194 int map_key_SP_to_RND(int);
196 int getRedDiskReleaseFlag_SP(void);
198 #endif // GAME_SP_EXPORT_H