port: complete python ledger mapping, audio commands bridge and platform stubs
- Added Client/root (74 modules, 3350 funcs) mapped to RUN_AS_IS - Added UserInterface/PythonNetworkStreamModule.cpp.json mapped to PORTED - Implemented AudioCommands queue bridging MilesLib SoundManager to Godot AudioDriver - Implemented AudioDriver node for BGM crossfading, 2D UI SFX and 3D spatial sounds - Implemented core platform stubs in PythonApplication, GrpScreen, and PythonGraphic - Passed all 12 port tests (port_gate macos) and python_game_render_test
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "platform/ScriptLib/PythonBoot.h"
|
||||
#include "platform/EterLib/UIRenderCommands.h"
|
||||
#include "platform/EterLib/RenderCommands3D.h"
|
||||
#include "platform/MilesLib/AudioCommands.h"
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
@@ -244,6 +245,35 @@ Array Metin2PythonHost::render3d_draws() {
|
||||
return out;
|
||||
}
|
||||
|
||||
Array Metin2PythonHost::audio_commands() {
|
||||
Array out;
|
||||
for (const auto &cmd : DrainAudioCommands()) {
|
||||
Dictionary item;
|
||||
switch (cmd.type) {
|
||||
case AudioCommand::PlaySound2D: item["type"] = "play_sound_2d"; break;
|
||||
case AudioCommand::PlaySound3D: item["type"] = "play_sound_3d"; break;
|
||||
case AudioCommand::StopSound3D: item["type"] = "stop_sound_3d"; break;
|
||||
case AudioCommand::StopAllSound3D: item["type"] = "stop_all_sound_3d"; break;
|
||||
case AudioCommand::PlayMusic: item["type"] = "play_music"; break;
|
||||
case AudioCommand::FadeOutMusic: item["type"] = "fade_out_music"; break;
|
||||
case AudioCommand::FadeOutAllMusic: item["type"] = "fade_out_all_music"; break;
|
||||
case AudioCommand::SetSoundVolume: item["type"] = "set_sound_volume"; break;
|
||||
case AudioCommand::SetMusicVolume: item["type"] = "set_music_volume"; break;
|
||||
default: continue;
|
||||
}
|
||||
item["filename"] = String::utf8(cmd.filename.c_str());
|
||||
item["x"] = cmd.x;
|
||||
item["y"] = cmd.y;
|
||||
item["z"] = cmd.z;
|
||||
item["volume"] = cmd.volume;
|
||||
item["speed"] = cmd.speed;
|
||||
item["play_count"] = cmd.play_count;
|
||||
item["id"] = cmd.id;
|
||||
out.append(item);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
String Metin2PythonHost::current_map_name() {
|
||||
return String::utf8(PythonBoot::CurrentMapName().c_str());
|
||||
}
|
||||
@@ -285,6 +315,7 @@ void Metin2PythonHost::ui_update() {}
|
||||
Array Metin2PythonHost::ui_render_commands() { return Array(); }
|
||||
Ref<Image> Metin2PythonHost::memory_texture(const String &, int64_t) { return Ref<Image>(); }
|
||||
Array Metin2PythonHost::render3d_draws() { return Array(); }
|
||||
Array Metin2PythonHost::audio_commands() { return Array(); }
|
||||
String Metin2PythonHost::current_map_name() { return String(); }
|
||||
|
||||
void Metin2PythonHost::stop() {
|
||||
@@ -312,6 +343,7 @@ void Metin2PythonHost::_bind_methods() {
|
||||
ClassDB::bind_static_method("Metin2PythonHost", D_METHOD("memory_texture", "name", "known_revision"),
|
||||
&Metin2PythonHost::memory_texture, DEFVAL(-1));
|
||||
ClassDB::bind_static_method("Metin2PythonHost", D_METHOD("render3d_draws"), &Metin2PythonHost::render3d_draws);
|
||||
ClassDB::bind_static_method("Metin2PythonHost", D_METHOD("audio_commands"), &Metin2PythonHost::audio_commands);
|
||||
ClassDB::bind_static_method("Metin2PythonHost", D_METHOD("current_map_name"), &Metin2PythonHost::current_map_name);
|
||||
ClassDB::bind_static_method("Metin2PythonHost", D_METHOD("stop"), &Metin2PythonHost::stop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user