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;
16 native_em_level.cav = &cav;
19 for (i = 0; i < MAX_PLAYERS; i++)
20 game_em.ply[i] = &ply[i];
25 for (i = 0; i < MAX_PLAYERS; i++)
40 cav.emerald_score = 0;
41 cav.diamond_score = 0;
42 cav.dynamite_score = 0;
45 cav.magnify_score = 0;
48 cav.android_move_time = 0;
49 cav.android_clone_time= 0;
52 cav.wonderwall_time = 0;
59 cav.wind_direction = 0;
61 cav.num_eater_arrays = 8;
62 cav.num_ball_arrays = 8;
68 cav.ball_random = FALSE;
69 cav.ball_active = FALSE;
70 cav.wonderwall_active = FALSE;
71 cav.wheel_active = FALSE;
72 cav.lenses_active = FALSE;
73 cav.magnify_active = FALSE;
75 for (i = 0; i < 8; i++)
76 for (j = 0; j < 9; j++)
77 cav.eater_array[i][j] = Cblank;
79 for (i = 0; i < 8; i++)
80 for (j = 0; j < 8; j++)
81 cav.ball_array[i][j] = Cblank;
83 for (i = 0; i < GAME_TILE_MAX; i++)
84 cav.android_array[i] = Cblank;
86 for (x = 0; x < CAVE_WIDTH; x++)
87 for (y = 0; y < CAVE_HEIGHT; y++)
88 cav.cave[x][y] = Cblank;
94 * completely initializes the level structure, ready for a game
97 #define MAX_EM_LEVEL_SIZE 16384
99 boolean LoadNativeLevel_EM(char *filename, boolean level_info_only)
101 unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
102 int raw_leveldata_length;
106 /* always start with reliable default values */
107 setLevelInfoToDefaults_EM();
109 if (!(file = openFile(filename, MODE_READ)))
111 if (!level_info_only)
112 Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
117 raw_leveldata_length = readFile(file, raw_leveldata, 1, MAX_EM_LEVEL_SIZE);
121 if (raw_leveldata_length <= 0)
123 Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
128 file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length,filename);
130 if (file_version == FILE_VERSION_EM_UNKNOWN)
132 Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
137 convert_em_level(raw_leveldata, file_version);