Load stage map into level definition
This commit is contained in:
@@ -38,10 +38,11 @@
|
||||
|
||||
## 地图资源入口
|
||||
|
||||
新增 `StageMapResource`:
|
||||
新增 `StageMapResource` 和 `StageMapLoader`:
|
||||
|
||||
```text
|
||||
LoadStageMapResource("map/stage_01.map")
|
||||
LoadStageMap("map/stage_01.map")
|
||||
```
|
||||
|
||||
读取优先级:
|
||||
@@ -53,22 +54,36 @@ LoadStageMapResource("map/stage_01.map")
|
||||
|
||||
当前状态:
|
||||
|
||||
- 已新增 `game/assets/map/stage_01.map` 占位文件。
|
||||
- `CreateWhiteboxLevel()` 会读取地图资源并记录来源。
|
||||
- 地图内容尚未接管 `LevelDefinition`,当前仍使用 C++ 白盒数据作为 fallback。
|
||||
- `game/assets/map/stage_01.map` 已接管第一关主数据。
|
||||
- `StageMapLoader` 会把 `.map` 文本解析成 `LevelDefinition`。
|
||||
- 已迁移世界尺寸、玩家出生点、相机边界、碰撞平台、视觉层、props、battle zone 和 spawn point。
|
||||
- `CreateWhiteboxLevel()` 优先读取 `.map`,读取或解析失败时才使用 C++ 白盒 fallback。
|
||||
- Windows 和 Switch 构建会把 `game/assets/*` 复制到产物 `assets/`,保证运行时 `assets/map/stage_01.map` 路径可用。
|
||||
|
||||
下一步:
|
||||
`.map` 当前支持的命令:
|
||||
|
||||
- 实现 `StageMapLoader`,把 `.map` 转成 `LevelDefinition`。
|
||||
- 将 `whitebox_level.cpp` 中的硬编码平台、props、battle zone 迁移到 `.map`。
|
||||
- 失败时保留 `CreateFallbackWhiteboxLevel()`。
|
||||
```text
|
||||
map <id>
|
||||
world <width> <height>
|
||||
camera <x> <y> <width> <height>
|
||||
player_spawn <x> <y>
|
||||
collision <x> <y> <width> <height>
|
||||
layer <id> <BackgroundFar|BackgroundMid|LevelVisual|PropsBack|PropsFront> <parallax>
|
||||
rect <x> <y> <width> <height> <r> <g> <b> <a>
|
||||
rect_sprite <x> <y> <width> <height> <r> <g> <b> <a> <texture>
|
||||
rect_sprite_src <x> <y> <width> <height> <r> <g> <b> <a> <texture> <sx> <sy> <sw> <sh>
|
||||
endlayer
|
||||
battle_zone <id> <trigger_x> <trigger_y> <trigger_w> <trigger_h> <camera_x> <camera_y> <camera_w> <camera_h>
|
||||
spawn <id> <x> <y>
|
||||
endbattle_zone
|
||||
```
|
||||
|
||||
## 仍待迁移的能力
|
||||
|
||||
- 玩家动画:从手写 spritesheet 帧切换迁移到引擎 `Animation` / PVF ANI。
|
||||
- 场景视觉资源:如果素材进入 NPK,迁移到 `NpkArchive` / `Sprite::createFromNpk`。
|
||||
- 音频:使用 `AudioSystem`、`Sound`、`Music`、`AudioDatabase`。
|
||||
- 地图:完成 `.map` parser,不再用 C++ 手写地图。
|
||||
- 地图:后续可把 `.map` 扩展为工具导出格式或 PVF 脚本格式,当前 C++ 地图只作为 fallback。
|
||||
- 输入配置:通过 `Asset` 或 PVF 读取 `InputConfig`。
|
||||
|
||||
## 原则
|
||||
|
||||
Reference in New Issue
Block a user