| 179 | } |
| 180 | |
| 181 | void G_loadLevel(const char* file) |
| 182 | { |
| 183 | // TODO |
| 184 | camera.initialize(64, 0, game.sceneRect.w, game.sceneRect.h); |
| 185 | camera.isTargeting = true; |
| 186 | |
| 187 | world.loadLevel(file, &camera); |
| 188 | world.constraints = WorldRect( |
| 189 | world.level.layer[2].w_tileSize.x, 0, |
| 190 | world.level.layer[2].t_mapSize.x * world.level.layer[2].w_tileSize.x - |
| 191 | 2 * world.level.layer[2].w_tileSize.x, |
| 192 | world.level.layer[2].t_mapSize.y * world.level.layer[2].w_tileSize.y); |
| 193 | world.enemies.clear(); |
| 194 | for (int i = 0; i < world.level.enemySpawns.size(); i++) |
| 195 | { |
| 196 | float top_padding = (world.level.enemySpawns[i].type == 2 || |
| 197 | world.level.enemySpawns[i].type == 1) |
| 198 | ? 72.0f |
| 199 | : 32.0f; |
| 200 | world.enemies.push_back( |
| 201 | Enemy((ENEMY_TYPE)world.level.enemySpawns[i].type, |
| 202 | world.level.enemySpawns[i].position.x, |
| 203 | world.level.enemySpawns[i].position.y, 64.0f, 128.0f, |
| 204 | world.level.enemySpawns[i].direction * ENEMY1_X_SPEED, 0.0f, |
| 205 | 8.0f, 8.0f, top_padding, 8.0f, &game.atlases.sprites)); |
| 206 | } |
| 207 | |
| 208 | player.initialize(world.level.playerSpawn.position.x, |
| 209 | world.level.playerSpawn.position.y, 64.0f, 128.0f, 8.0f, |
| 210 | 8.0f, 16.0f, 8.0f, &game.atlases.sprites); |
| 211 | player.direction = world.level.playerSpawn.direction; |
| 212 | player.hit = 0; |
| 213 | player.hitEnemy = 0; |
| 214 | player.health = 2; |
| 215 | |
| 216 | sound.setReverb(world.level.reverb); |
| 217 | sound.StopAll(); |
| 218 | if (world.level.musicID > -1) |
| 219 | sound.PlayMusic((SOUND_ID)world.level.musicID); |
| 220 | |
| 221 | gametime.currentFrame = 0; |
| 222 | } |
| 223 | |
| 224 | void U_Load_demo() |
| 225 | { |
no test coverage detected