Files
shenandClaude Sonnet 5 47baf6c0c6 Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
  phases, EntityStore world model, ~all GC/CG headers. char create/delete,
  private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
  quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
  char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
  token), system-option + game-option + ESC system menu, private-shop 39-grid,
  party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
  dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.

Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.

Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).

ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
2026-08-31 20:02:12 +09:00

45 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 区块二进制:height.raw / tile.raw / attr.atr / water.wtr。
// 真值来源:PRTerrainLib/Terrain.cppLoadHeightMap / RAW_LoadTileMap / LoadAttrMap /
// LoadWaterMapFile+ Terrain.h / TerrainType.h 常量。SHINSOO §5.3。
//
// XSIZE = 128
// height.raw : 无头,u16 LE [131*131] (HEIGHTMAP_RAW = XSIZE+3)
// tile.raw : 无头,u8 [258*258] (TILEMAP_RAW = XSIZE*2+2)
// attr.atr : 6B 头 {u16 magic=2634, u16 w=256, u16 h=256} + u8 [256*256]
// water.wtr : 7B 头 {u16 magic=5426, u16 w=128, u16 h=128, u8 layers}
// + u8 [128*128] + layers×(u16 或 u32) 层高
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace fmt {
constexpr int HEIGHTMAP_RAW_XY = 131; // 128+3
constexpr int TILEMAP_RAW_XY = 258; // 128*2+2
constexpr int ATTRMAP_XY = 256; // 128*2
constexpr int WATERMAP_XY = 128;
constexpr uint16_t ATTR_MAGIC = 2634;
constexpr uint16_t WATER_MAGIC = 5426;
struct HeightMap {
std::vector<uint16_t> raw; // 131*131, 行主序(含 1 圈边界样本)
uint16_t at(int sx, int sy) const { // 与 Terrain.h GetHeight 一致:+1 偏移
return raw[(sy + 1) * HEIGHTMAP_RAW_XY + (sx + 1)];
}
};
struct TileMap { std::vector<uint8_t> raw; }; // 258*258
struct AttrMap { std::vector<uint8_t> data; }; // 256*256(去头)
struct WaterMap {
uint8_t layer_count = 0;
std::vector<uint8_t> ids; // 128*1280xFF = 无水
std::vector<int32_t> heights; // layer_count 个
};
bool load_height_map(const std::string& path, HeightMap& out, std::string* err);
bool load_tile_map(const std::string& path, TileMap& out, std::string* err);
bool load_attr_map(const std::string& path, AttrMap& out, std::string* err);
bool load_water_map(const std::string& path, WaterMap& out, std::string* err);
} // namespace fmt