1 /* 2000-08-10T16:43:50Z
9 struct LevelInfo_EM native_em_level;
11 void setLevelInfoToDefaults_EM(void)
15 native_em_level.file_version = FILE_VERSION_EM_ACTUAL;
17 native_em_level.lev = &lev;
18 for (i = 0; i < MAX_PLAYERS; i++)
19 native_em_level.ply[i] = &ply[i];
24 for (i = 0; i < MAX_PLAYERS; i++)
30 lev.lenses_cnt_initial = 0;
31 lev.magnify_cnt_initial = 0;
33 lev.wheel_cnt_initial = 0;
34 lev.wheel_x_initial = 1;
35 lev.wheel_y_initial = 1;
38 lev.wind_cnt_initial = 0;
40 lev.wonderwall_state_initial = 0;
41 lev.wonderwall_time_initial = 0;
43 lev.num_ball_arrays = 8;
45 for (i = 0; i < TILE_MAX; i++)
46 lev.android_array[i] = Xblank;
48 /* initial number of players in this level */
51 for (i = 0; i < MAX_PLAYERS; i++)
54 ply[i].alive_initial = FALSE;
61 * completely initializes the level structure, ready for a game
64 #define MAX_EM_LEVEL_SIZE 16384
66 boolean LoadNativeLevel_EM(char *filename, boolean level_info_only)
68 unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
69 int raw_leveldata_length;
73 /* always start with reliable default values */
74 setLevelInfoToDefaults_EM();
76 if (!(file = openFile(filename, MODE_READ)))
79 Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
84 raw_leveldata_length = readFile(file, raw_leveldata, 1, MAX_EM_LEVEL_SIZE);
88 if (raw_leveldata_length <= 0)
90 Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
95 file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length,filename);
97 if (file_version == FILE_VERSION_EM_UNKNOWN)
99 Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
104 convert_em_level(raw_leveldata, file_version);