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
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#include "texture_set.h"
|
||||
|
||||
#include "m2_tokvec.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace fmt {
|
||||
|
||||
bool parse_texture_set(const std::string& text, TextureSet& out, std::string* err) {
|
||||
TokVecMap tv;
|
||||
std::string perr;
|
||||
parse_tokvec(text, tv, &perr);
|
||||
|
||||
out = TextureSet{};
|
||||
|
||||
if (!tv.has("textureset")) {
|
||||
if (err) *err = "textureset 缺首行 `TextureSet`";
|
||||
return false;
|
||||
}
|
||||
if (!tv.has("texturecount")) {
|
||||
if (err) *err = "textureset 缺 TextureCount";
|
||||
return false;
|
||||
}
|
||||
out.declared_count = (int)tv.inum("texturecount");
|
||||
if (out.declared_count < 0) {
|
||||
if (err) *err = "textureset TextureCount 非法";
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= out.declared_count; ++i) {
|
||||
char key[32];
|
||||
std::snprintf(key, sizeof(key), "texture%03d", i);
|
||||
const auto* v = tv.find(key);
|
||||
if (!v) {
|
||||
if (err) *err = std::string("textureset 缺块 ") + key;
|
||||
return false;
|
||||
}
|
||||
if (v->size() < 8) {
|
||||
if (err) *err = std::string("textureset 块 ") + key + " token 不足 8 个";
|
||||
return false;
|
||||
}
|
||||
TextureLayer L;
|
||||
L.texture = (*v)[0];
|
||||
L.u_scale = (float)std::atof((*v)[1].c_str());
|
||||
L.v_scale = (float)std::atof((*v)[2].c_str());
|
||||
L.u_offset = (float)std::atof((*v)[3].c_str());
|
||||
L.v_offset = (float)std::atof((*v)[4].c_str());
|
||||
L.splat_enabled = std::atoi((*v)[5].c_str()) != 0;
|
||||
L.height_begin = (unsigned short)std::atoi((*v)[6].c_str());
|
||||
L.height_end = (unsigned short)std::atoi((*v)[7].c_str());
|
||||
out.layers.push_back(std::move(L));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parse_texture_set_file(const std::string& path, TextureSet& out, std::string* err) {
|
||||
std::string text;
|
||||
if (!read_file(path, text)) {
|
||||
if (err) *err = "打不开 " + path;
|
||||
return false;
|
||||
}
|
||||
return parse_texture_set(text, out, err);
|
||||
}
|
||||
|
||||
} // namespace fmt
|
||||
Reference in New Issue
Block a user