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,74 @@
|
||||
// M2 T1 —— .msa 解析(照 EterGrnLib/Util.cpp CGrannyMotion::LoadMotionData 的字段)。
|
||||
#include "msa.h"
|
||||
#include "textscript.h"
|
||||
#include <cstdlib>
|
||||
|
||||
namespace fmt {
|
||||
|
||||
static void vec3(const std::vector<std::string>* l, float* out) {
|
||||
if (!l) return;
|
||||
for (int k = 0; k < 3 && k + 1 < (int)l->size(); ++k) out[k] = float(std::atof((*l)[k + 1].c_str()));
|
||||
}
|
||||
|
||||
static void loop_data(const Node& root, Msa& out) {
|
||||
if (const Node* loop = root.group("LoopData")) {
|
||||
out.has_loop_data = true;
|
||||
out.motion_loop_count = loop->inum("MotionLoopCount", -1);
|
||||
out.loop_cancel_enable = loop->inum("LoopCancelEnable", 0) != 0;
|
||||
out.loop_start_time = loop->num("LoopStartTime");
|
||||
out.loop_end_time = loop->num("LoopEndTime");
|
||||
}
|
||||
}
|
||||
|
||||
bool parse_msa(const std::string& text, Msa& out, std::string* err) {
|
||||
Node root;
|
||||
if (!parse_textscript(text, root, err)) return false;
|
||||
out = Msa{};
|
||||
|
||||
out.motion_gr2 = root.str("MotionFileName");
|
||||
out.duration = root.num("MotionDuration");
|
||||
vec3(root.find("Accumulation"), out.accumulation);
|
||||
loop_data(root, out);
|
||||
|
||||
if (const Node* med = root.group("MotionEventData")) {
|
||||
int count = med->inum("MotionEventDataCount", int(med->groups.size()));
|
||||
(void)count;
|
||||
for (const Node& ev : med->groups) {
|
||||
MotionEvent e;
|
||||
e.type = ev.inum("MotionEventType");
|
||||
e.start_time = ev.num("StartingTime");
|
||||
e.effect_file = ev.str("EffectFileName");
|
||||
e.sound_file = ev.str("SoundFileName");
|
||||
vec3(ev.find("EffectPosition"), e.position);
|
||||
out.events.push_back(std::move(e));
|
||||
}
|
||||
}
|
||||
|
||||
if (out.motion_gr2.empty()) { if (err) *err = "msa: 缺 MotionFileName"; return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parse_msa_file(const std::string& path, Msa& out, std::string* err) {
|
||||
Node root;
|
||||
if (!parse_textscript_file(path, root, err)) return false;
|
||||
// 复用上面逻辑:重解析文本更简单,这里直接从 root 走一遍
|
||||
out = Msa{};
|
||||
out.motion_gr2 = root.str("MotionFileName");
|
||||
out.duration = root.num("MotionDuration");
|
||||
vec3(root.find("Accumulation"), out.accumulation);
|
||||
loop_data(root, out);
|
||||
if (const Node* med = root.group("MotionEventData"))
|
||||
for (const Node& ev : med->groups) {
|
||||
MotionEvent e;
|
||||
e.type = ev.inum("MotionEventType");
|
||||
e.start_time = ev.num("StartingTime");
|
||||
e.effect_file = ev.str("EffectFileName");
|
||||
e.sound_file = ev.str("SoundFileName");
|
||||
vec3(ev.find("EffectPosition"), e.position);
|
||||
out.events.push_back(std::move(e));
|
||||
}
|
||||
if (out.motion_gr2.empty()) { if (err) *err = "msa: 缺 MotionFileName (" + path + ")"; return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace fmt
|
||||
Reference in New Issue
Block a user