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;
49 /* initial number of players in this level */
52 for (i = 0; i < MAX_PLAYERS; i++)
55 ply[i].alive_initial = FALSE;
58 /* initial number of players in this level */
59 lev.home_initial = (setup.team_mode ? 2 : 1);
61 for (i = 0; i < MAX_PLAYERS; i++)
64 ply[i].alive_initial = (lev.home_initial > i ? TRUE : FALSE);
72 * completely initializes the level structure, ready for a game
75 #define MAX_EM_LEVEL_SIZE 16384
77 boolean LoadNativeLevel_EM(char *filename)
79 unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
80 int raw_leveldata_length;
84 /* always start with reliable default values */
85 setLevelInfoToDefaults_EM();
87 if (!(file = fopen(filename, MODE_READ)))
89 Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
94 raw_leveldata_length = fread(raw_leveldata, 1, MAX_EM_LEVEL_SIZE, file);
98 if (raw_leveldata_length <= 0)
100 Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
105 file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length,filename);
107 if (file_version == FILE_VERSION_EM_UNKNOWN)
109 Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
114 convert_em_level(raw_leveldata, file_version);