GEWorldRuntime

Wraps a Worlds::World; loads .vwr (default) or mobile-eggbert .txt (secondary); drives tile animation.

Overview

GEWorldRuntime (CNA version) owns a std::unique_ptr<Worlds::World> and centers the 100×100 grid on the origin: kWorldCenterX = kWorldCenterZ = 50 (matches Simple3D's equivalent kWCX/kWCZ).

Sources: src/GalaxyEggbertCNA/Game/GEWorldRuntime.hpp and .cpp.

API

class GEWorldRuntime {
public:
    bool LoadFromVwrFile(const std::string& path);           // default load path
    bool LoadFromMobileEggbertFile(const std::string& path); // secondary/reference path

    void Update(float dt);          // advances 6 fps tile-animation phase

    const Worlds::World& GetWorld() const;
    int   GetSpawnTileX() const;
    int   GetSpawnTileZ() const;
    int   GetSkyRegion() const;
    int   GetAnimPhase() const;
    const std::vector<uint16_t>& GetBigDecor() const;
};

LoadFromVwrFile(path) — the default path

Calls Worlds::World::loadFromFile(path). On exception, returns false leaving the prior world untouched. Resets spawnTileX_/Z_ = 0, skyRegion_ = 0, and clears bigDecor_ — the .vwr format carries no spawn/sky-region header, unlike the mobile-eggbert text format.

LoadFromMobileEggbertFile(path) — secondary/reference path

Parses mobile-eggbert's flat .txt format. Converts each icon ID via BlockTypes::fromMobileIconId and calls world_->setBlock(col, 0, row, ...) — always at Y=0 (this format is inherently flat). Also populates:

This is no longer the default world loader for CNA — it exists for future faithful-remake level porting, not day-to-day use.

Update(dt)

animTimer_ += dt;
constexpr float kAnimPeriod = 1.0f / 6.0f;   // 6 fps
while (animTimer_ >= kAnimPeriod) {
    animTimer_ -= kAnimPeriod;
    ++animPhase_;
}

Matches GalaxyEggbertSimple3D's and mobile-eggbert's original animation rate.

Dependencies

GalaxyEggbert::Worlds::World only — no CNA or Easy3D dependency.