#include "level_definition.h" #include "stage_map_loader.h" #include namespace ns_game { namespace { LevelDefinition CreateFallbackWhiteboxLevel() { LevelDefinition level; level.worldWidth = 3200.0f; level.worldHeight = 720.0f; level.playerSpawn = frostbite2D::Vec2(160.0f, 380.0f); level.cameraBounds = frostbite2D::Rect(0.0f, 0.0f, level.worldWidth, level.worldHeight); level.collision.levelLeft = 0.0f; level.collision.levelRight = level.worldWidth; level.collision.platforms = { frostbite2D::Rect(0.0f, 600.0f, 3200.0f, 80.0f), frostbite2D::Rect(230.0f, 500.0f, 220.0f, 28.0f), frostbite2D::Rect(560.0f, 430.0f, 260.0f, 28.0f), frostbite2D::Rect(930.0f, 510.0f, 260.0f, 28.0f), frostbite2D::Rect(1250.0f, 420.0f, 230.0f, 28.0f), frostbite2D::Rect(1760.0f, 500.0f, 300.0f, 28.0f), frostbite2D::Rect(2180.0f, 455.0f, 260.0f, 28.0f), frostbite2D::Rect(2650.0f, 515.0f, 360.0f, 28.0f), }; level.layers = { {"background_far", StageLayerRole::BackgroundFar, 0.25f, {{frostbite2D::Rect(0.0f, 0.0f, 3200.0f, 720.0f), frostbite2D::Color(0.08f, 0.10f, 0.14f, 1.0f), StageLayerRole::BackgroundFar}, {frostbite2D::Rect(360.0f, 120.0f, 420.0f, 220.0f), frostbite2D::Color(0.13f, 0.16f, 0.21f, 1.0f), StageLayerRole::BackgroundFar}, {frostbite2D::Rect(1380.0f, 90.0f, 560.0f, 260.0f), frostbite2D::Color(0.12f, 0.15f, 0.20f, 1.0f), StageLayerRole::BackgroundFar}, {frostbite2D::Rect(2440.0f, 140.0f, 520.0f, 210.0f), frostbite2D::Color(0.13f, 0.16f, 0.21f, 1.0f), StageLayerRole::BackgroundFar}}}, {"background_mid", StageLayerRole::BackgroundMid, 0.55f, {{frostbite2D::Rect(80.0f, 360.0f, 280.0f, 240.0f), frostbite2D::Color(0.18f, 0.22f, 0.27f, 1.0f), StageLayerRole::BackgroundMid}, {frostbite2D::Rect(1020.0f, 310.0f, 340.0f, 290.0f), frostbite2D::Color(0.18f, 0.22f, 0.27f, 1.0f), StageLayerRole::BackgroundMid}, {frostbite2D::Rect(2020.0f, 330.0f, 360.0f, 270.0f), frostbite2D::Color(0.18f, 0.22f, 0.27f, 1.0f), StageLayerRole::BackgroundMid}, {frostbite2D::Rect(2860.0f, 280.0f, 260.0f, 320.0f), frostbite2D::Color(0.18f, 0.22f, 0.27f, 1.0f), StageLayerRole::BackgroundMid}}}, {"level_visual", StageLayerRole::LevelVisual, 1.0f, {{frostbite2D::Rect(0.0f, 600.0f, 3200.0f, 80.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(230.0f, 500.0f, 220.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(560.0f, 430.0f, 260.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(930.0f, 510.0f, 260.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(1250.0f, 420.0f, 230.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(1760.0f, 500.0f, 300.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(2180.0f, 455.0f, 260.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}, {frostbite2D::Rect(2650.0f, 515.0f, 360.0f, 28.0f), frostbite2D::Color(0.62f, 0.68f, 0.73f, 1.0f), StageLayerRole::LevelVisual}}}, {"props_back", StageLayerRole::PropsBack, 1.0f, {{frostbite2D::Rect(118.0f, 392.0f, 88.0f, 208.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}, {frostbite2D::Rect(780.0f, 250.0f, 72.0f, 180.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}, {frostbite2D::Rect(1440.0f, 300.0f, 80.0f, 300.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}, {frostbite2D::Rect(1880.0f, 360.0f, 110.0f, 240.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}, {frostbite2D::Rect(2520.0f, 390.0f, 92.0f, 210.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}, {frostbite2D::Rect(3040.0f, 315.0f, 82.0f, 285.0f), frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f), StageLayerRole::PropsBack}}}, {"props_front", StageLayerRole::PropsFront, 1.0f, {{frostbite2D::Rect(520.0f, 580.0f, 220.0f, 34.0f), frostbite2D::Color(0.14f, 0.17f, 0.18f, 0.90f), StageLayerRole::PropsFront}, {frostbite2D::Rect(1510.0f, 570.0f, 280.0f, 42.0f), frostbite2D::Color(0.14f, 0.17f, 0.18f, 0.90f), StageLayerRole::PropsFront}, {frostbite2D::Rect(2580.0f, 572.0f, 260.0f, 38.0f), frostbite2D::Color(0.14f, 0.17f, 0.18f, 0.90f), StageLayerRole::PropsFront}}}, }; level.battleZones = { {"zone_01_intro", frostbite2D::Rect(520.0f, 260.0f, 560.0f, 340.0f), frostbite2D::Rect(0.0f, 0.0f, 1940.0f, 720.0f), {{"zone_01_enemy_a", frostbite2D::Vec2(760.0f, 560.0f)}, {"zone_01_enemy_b", frostbite2D::Vec2(980.0f, 560.0f)}}}, {"zone_02_platform", frostbite2D::Rect(1420.0f, 250.0f, 680.0f, 350.0f), frostbite2D::Rect(660.0f, 0.0f, 2300.0f, 720.0f), {{"zone_02_enemy_a", frostbite2D::Vec2(1620.0f, 560.0f)}, {"zone_02_enemy_b", frostbite2D::Vec2(1900.0f, 560.0f)}}}, {"zone_03_exit", frostbite2D::Rect(2380.0f, 250.0f, 720.0f, 350.0f), frostbite2D::Rect(1600.0f, 0.0f, 1600.0f, 720.0f), {{"zone_03_enemy_a", frostbite2D::Vec2(2580.0f, 560.0f)}, {"zone_03_enemy_b", frostbite2D::Vec2(2860.0f, 560.0f)}}}, }; return level; } } // namespace LevelDefinition CreateWhiteboxLevel() { if (auto loadedLevel = LoadStageMap("map/stage_01.map")) { return *loadedLevel; } SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "CreateWhiteboxLevel: using C++ fallback level"); return CreateFallbackWhiteboxLevel(); } } // namespace ns_game