diff --git a/src/xrGame/HudItem.cpp b/src/xrGame/HudItem.cpp index 72064299a07..7498cd32244 100644 --- a/src/xrGame/HudItem.cpp +++ b/src/xrGame/HudItem.cpp @@ -366,7 +366,9 @@ bool CHudItem::isHUDAnimationExist(pcstr anim_name) else // Third person if (g_player_hud->motion_length(anim_name, HudSection(), m_current_motion_def) > 100) return true; +#ifdef DEBUG Msg("~ [WARNING] ------ Animation [%s] does not exist in [%s]", anim_name, HudSection().c_str()); +#endif return false; } diff --git a/src/xrGame/WeaponMagazined.cpp b/src/xrGame/WeaponMagazined.cpp index 3bc7c17c235..488fa2f340c 100644 --- a/src/xrGame/WeaponMagazined.cpp +++ b/src/xrGame/WeaponMagazined.cpp @@ -66,13 +66,15 @@ CWeaponMagazined::~CWeaponMagazined() void CWeaponMagazined::net_Destroy() { inherited::net_Destroy(); } //AVO: for custom added sounds check if sound exists -bool CWeaponMagazined::WeaponSoundExist(LPCSTR section, LPCSTR sound_name) +bool CWeaponMagazined::WeaponSoundExist(pcstr section, pcstr sound_name) const { pcstr str; bool sec_exist = process_if_exists_set(section, sound_name, &CInifile::r_string, str, true); if (sec_exist) return true; +#ifdef DEBUG Msg("~ [WARNING] ------ Sound [%s] does not exist in [%s]", sound_name, section); +#endif return false; } @@ -92,6 +94,8 @@ void CWeaponMagazined::Load(LPCSTR section) #ifdef NEW_SOUNDS //AVO: custom sounds go here if (WeaponSoundExist(section, "snd_reload_empty")) m_sounds.LoadSound(section, "snd_reload_empty", "sndReloadEmpty", true, m_eSoundReloadEmpty); + if (WeaponSoundExist(section, "snd_reload_misfire")) + m_sounds.LoadSound(section, "snd_reload_misfire", "sndReloadMisfire", true, m_eSoundReloadMisfire); #endif //-NEW_SOUNDS m_sSndShotCurrent = "sndShot"; diff --git a/src/xrGame/WeaponMagazined.h b/src/xrGame/WeaponMagazined.h index 0bb6c12ec39..bbfa165667f 100644 --- a/src/xrGame/WeaponMagazined.h +++ b/src/xrGame/WeaponMagazined.h @@ -30,6 +30,7 @@ class CWeaponMagazined : public CWeapon ESoundTypes m_eSoundReload; #ifdef NEW_SOUNDS //AVO: new sounds go here ESoundTypes m_eSoundReloadEmpty; + ESoundTypes m_eSoundReloadMisfire; #endif //-NEW_SOUNDS bool m_sounds_enabled; @@ -176,5 +177,5 @@ class CWeaponMagazined : public CWeapon u16 parent_id, u16 weapon_id, bool send_hit); //AVO: for custom added sounds check if sound exists - bool WeaponSoundExist(pcstr section, pcstr sound_name); + bool WeaponSoundExist(pcstr section, pcstr sound_name) const; }; diff --git a/src/xrScriptEngine/ScriptEngineScript.cpp b/src/xrScriptEngine/ScriptEngineScript.cpp index 2601e8ec3be..d329fb0cc03 100644 --- a/src/xrScriptEngine/ScriptEngineScript.cpp +++ b/src/xrScriptEngine/ScriptEngineScript.cpp @@ -16,6 +16,9 @@ void LuaLog(LPCSTR caMessage) { + if (!GlobalEnv.ScriptEngine->m_stack_is_ready) + Log(caMessage); // Xottab_DUTY: temporary workaround to get lua log output + #ifndef MASTER_GOLD GlobalEnv.ScriptEngine->script_log(LuaMessageType::Message, "%s", caMessage); #endif @@ -27,6 +30,9 @@ void LuaLog(LPCSTR caMessage) void ErrorLog(LPCSTR caMessage) { + if (!GlobalEnv.ScriptEngine->m_stack_is_ready) + Log(caMessage); // Xottab_DUTY: temporary workaround to get lua error output + GlobalEnv.ScriptEngine->error_log("%s", caMessage); #ifdef DEBUG GlobalEnv.ScriptEngine->print_stack(); @@ -44,6 +50,13 @@ void ErrorLog(LPCSTR caMessage) #endif } +//AVO: +void PrintStack() +{ + GlobalEnv.ScriptEngine->print_stack(); +} +//-AVO + void FlushLogs() { #ifdef DEBUG @@ -149,8 +162,8 @@ SCRIPT_EXPORT(CScriptEngine, (), { .def("start", &profile_timer_script::start) .def("stop", &profile_timer_script::stop) .def("time", &profile_timer_script::time), - def("log", &LuaLog), def("error_log", &ErrorLog), def("flush", &FlushLogs), def("prefetch", &prefetch_module), - def("verify_if_thread_is_running", &verify_if_thread_is_running), def("editor", &is_editor), + def("log", &LuaLog), def("error_log", &ErrorLog), def("flush", &FlushLogs), def("print_stack", &PrintStack), + def("prefetch", &prefetch_module), def("verify_if_thread_is_running", &verify_if_thread_is_running), def("bit_and", &bit_and), def("bit_or", &bit_or), def("bit_xor", &bit_xor), def("bit_not", &bit_not), - def("user_name", &user_name)]; + def("editor", &is_editor), def("user_name", &user_name)]; }); diff --git a/src/xrScriptEngine/script_engine.cpp b/src/xrScriptEngine/script_engine.cpp index 5db1b6f45a3..b367755c262 100644 --- a/src/xrScriptEngine/script_engine.cpp +++ b/src/xrScriptEngine/script_engine.cpp @@ -251,7 +251,6 @@ int CScriptEngine::vscript_log(LuaMessageType luaMessageType, LPCSTR caFormat, v #endif } -#ifdef DEBUG void CScriptEngine::print_stack() { if (!m_stack_is_ready) @@ -276,7 +275,6 @@ void CScriptEngine::print_stack() } } } -#endif int CScriptEngine::script_log(LuaMessageType message, LPCSTR caFormat, ...) { @@ -643,7 +641,6 @@ void CScriptEngine::print_error(lua_State* L, int iErrorCode) } } -#ifdef DEBUG void CScriptEngine::flush_log() { string_path log_file_name; @@ -651,7 +648,6 @@ void CScriptEngine::flush_log() FS.update_path(log_file_name, "$logs$", log_file_name); m_output.save_to(log_file_name); } -#endif int CScriptEngine::error_log(LPCSTR format, ...) { diff --git a/src/xrScriptEngine/script_engine.hpp b/src/xrScriptEngine/script_engine.hpp index d55a9310b06..12f7792a649 100644 --- a/src/xrScriptEngine/script_engine.hpp +++ b/src/xrScriptEngine/script_engine.hpp @@ -90,9 +90,9 @@ class XRSCRIPTENGINE_API CScriptEngine protected: CScriptProcessStorage m_script_processes; int m_stack_level; -#ifdef DEBUG + CMemoryWriter m_output; // for call stack -#endif + #ifdef USE_DEBUGGER #ifndef USE_LUA_STUDIO CScriptDebugger* m_scriptDebugger; @@ -103,9 +103,7 @@ class XRSCRIPTENGINE_API CScriptEngine #endif public: -#ifdef DEBUG bool m_stack_is_ready; -#endif private: static CScriptEngine* GetInstance(lua_State* state); @@ -145,10 +143,10 @@ class XRSCRIPTENGINE_API CScriptEngine public: static void on_error(lua_State* state); -#ifdef DEBUG + void flush_log(); void print_stack(); -#endif + using ExporterFunc = XRay::ScriptExporter::Node::ExporterFunc; CScriptEngine(); virtual ~CScriptEngine();