1 /* 2000-08-10T16:43:50Z
11 struct LevelInfo_EM native_em_level;
13 void setLevelInfoToDefaults_EM(void)
17 native_em_level.file_version = FILE_VERSION_EM_ACTUAL;
19 native_em_level.lev = &lev;
20 native_em_level.ply1 = &ply1;
21 native_em_level.ply2 = &ply2;
32 lev.lenses_cnt_initial = 0;
33 lev.magnify_cnt_initial = 0;
35 lev.wheel_cnt_initial = 0;
36 lev.wheel_x_initial = 1;
37 lev.wheel_y_initial = 1;
40 lev.wind_cnt_initial = 0;
42 lev.wonderwall_state_initial = 0;
43 lev.wonderwall_time_initial = 0;
45 for (i = 0; i < TILE_MAX; i++)
46 lev.android_array[i] = Xblank;
48 lev.home_initial = 1; /* initial number of players in this level */
50 ply1.alive_initial = (lev.home_initial >= 1);
51 ply2.alive_initial = (lev.home_initial >= 2);
57 * completely initializes the level structure, ready for a game
60 #define MAX_EM_LEVEL_SIZE 16384
62 boolean LoadNativeLevel_EM(char *filename)
64 unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
65 int raw_leveldata_length;
69 /* always start with reliable default values */
70 setLevelInfoToDefaults_EM();
72 if (!(file = fopen(filename, MODE_READ)))
74 Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
79 raw_leveldata_length = fread(raw_leveldata, 1, MAX_EM_LEVEL_SIZE, file);
83 if (raw_leveldata_length <= 0)
85 Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
90 if (!(file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length)))
92 Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
97 convert_em_level(raw_leveldata, file_version);