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;
67 cav.infinite_true = FALSE; // default: use original EMC behaviour
69 cav.ball_random = FALSE;
70 cav.ball_active = FALSE;
71 cav.wonderwall_active = FALSE;
72 cav.wheel_active = FALSE;
73 cav.lenses_active = FALSE;
74 cav.magnify_active = FALSE;
76 for (i = 0; i < 8; i++)
77 for (j = 0; j < 9; j++)
78 cav.eater_array[i][j] = Cblank;
80 for (i = 0; i < 8; i++)
81 for (j = 0; j < 8; j++)
82 cav.ball_array[i][j] = Cblank;
84 for (i = 0; i < GAME_TILE_MAX; i++)
85 cav.android_array[i] = Cblank;
87 for (x = 0; x < CAVE_WIDTH; x++)
88 for (y = 0; y < CAVE_HEIGHT; y++)
89 cav.cave[x][y] = Cblank;
95 * completely initializes the level structure, ready for a game
98 #define MAX_EM_LEVEL_SIZE 16384
100 boolean LoadNativeLevel_EM(char *filename, boolean level_info_only)
102 unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
103 int raw_leveldata_length;
107 /* always start with reliable default values */
108 setLevelInfoToDefaults_EM();
110 if (!(file = openFile(filename, MODE_READ)))
112 if (!level_info_only)
113 Warn("cannot open level '%s' -- using empty level", filename);
118 raw_leveldata_length = readFile(file, raw_leveldata, 1, MAX_EM_LEVEL_SIZE);
122 if (raw_leveldata_length <= 0)
124 Warn("cannot read level '%s' -- using empty level", filename);
129 file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length, filename);
131 if (file_version == FILE_VERSION_EM_UNKNOWN)
133 Warn("unknown EM level '%s' -- using empty level", filename);
138 convert_em_level(raw_leveldata, file_version);