diff --git a/CMakeLists.txt b/CMakeLists.txt index 6916cf12da6..773186a8c19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,13 @@ option(STATIC_BUILD "Use static build" ${MASTER_GOLD}) message(STATUS "STATIC_BUILD: ${STATIC_BUILD}") if (STATIC_BUILD) # XXX: Uncomment only after build with XRAY_STATIC_BUILD is fixed - #add_definitions(-DXRAY_STATIC_BUILD) + add_definitions(-DXRAY_STATIC_BUILD) + set(LIBS_LINK_TYPE STATIC) + set(LUABIND_BUILD_SHARED OFF) # xrLuaBind + set(BUILD_STATIC_LIB ON) # LuaJIT + set(BUILD_DYNAMIC_LIB OFF) # LuaJIT +else() + set(LIBS_LINK_TYPE SHARED) endif() function(xr_install tgt) diff --git a/src/Layers/xrAPI/CMakeLists.txt b/src/Layers/xrAPI/CMakeLists.txt index 8b31e2ceac9..31ffcd680db 100644 --- a/src/Layers/xrAPI/CMakeLists.txt +++ b/src/Layers/xrAPI/CMakeLists.txt @@ -8,7 +8,7 @@ set(KERNEL_SRC source_group("Kernel" FILES ${KERNEL_SRC}) -add_library(${PROJECT_NAME} SHARED ${KERNEL_SRC}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${KERNEL_SRC}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/Layers/xrRender/r__occlusion.cpp b/src/Layers/xrRender/r__occlusion.cpp index 7f6133571be..a0ffc6c33fc 100644 --- a/src/Layers/xrRender/r__occlusion.cpp +++ b/src/Layers/xrRender/r__occlusion.cpp @@ -3,8 +3,14 @@ #include "QueryHelper.h" -R_occlusion::R_occlusion(void) { enabled = strstr(Core.Params, "-no_occq") ? FALSE : TRUE; } +R_occlusion::R_occlusion(void) {} R_occlusion::~R_occlusion(void) { occq_destroy(); } + +void R_occlusion::initialize() +{ + enabled = strstr(Core.Params, "-no_occq") ? FALSE : TRUE; +} + void R_occlusion::occq_create(u32 limit) { pool.reserve(limit); diff --git a/src/Layers/xrRender/r__occlusion.h b/src/Layers/xrRender/r__occlusion.h index 6e0a2ac6a26..2ad44954a18 100644 --- a/src/Layers/xrRender/r__occlusion.h +++ b/src/Layers/xrRender/r__occlusion.h @@ -47,6 +47,8 @@ class R_occlusion R_occlusion(); ~R_occlusion(); + void initialize(); + void occq_create(u32 limit); void occq_destroy(); u32 occq_begin(u32& ID); // returns 'order' diff --git a/src/Layers/xrRenderPC_GL/CMakeLists.txt b/src/Layers/xrRenderPC_GL/CMakeLists.txt index 80fa61183e0..f0a09df3bca 100644 --- a/src/Layers/xrRenderPC_GL/CMakeLists.txt +++ b/src/Layers/xrRenderPC_GL/CMakeLists.txt @@ -386,7 +386,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/Layers/xrRenderPC_R1/CMakeLists.txt b/src/Layers/xrRenderPC_R1/CMakeLists.txt index 28ceb224141..d367e0ea23e 100644 --- a/src/Layers/xrRenderPC_R1/CMakeLists.txt +++ b/src/Layers/xrRenderPC_R1/CMakeLists.txt @@ -25,7 +25,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/Layers/xrRender_R2/r2.cpp b/src/Layers/xrRender_R2/r2.cpp index 5937e0e0661..6b0743a2405 100644 --- a/src/Layers/xrRender_R2/r2.cpp +++ b/src/Layers/xrRender_R2/r2.cpp @@ -211,6 +211,8 @@ static bool must_enable_old_cascades() // Just two static storage void CRender::create() { + HWOCC.initialize(); + Device.seqFrame.Add(this, REG_PRIORITY_HIGH + 0x12345678); m_skinning = -1; diff --git a/src/utils/xrLCUtil/CMakeLists.txt b/src/utils/xrLCUtil/CMakeLists.txt index 85a35eb5cc6..b8106567a91 100644 --- a/src/utils/xrLCUtil/CMakeLists.txt +++ b/src/utils/xrLCUtil/CMakeLists.txt @@ -15,7 +15,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/utils/xrLC_Light/CMakeLists.txt b/src/utils/xrLC_Light/CMakeLists.txt index 0e9ea8133b3..33b80f1b8cf 100644 --- a/src/utils/xrLC_Light/CMakeLists.txt +++ b/src/utils/xrLC_Light/CMakeLists.txt @@ -175,7 +175,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrAICore/CMakeLists.txt b/src/xrAICore/CMakeLists.txt index 9e96971b992..7d92226d844 100644 --- a/src/xrAICore/CMakeLists.txt +++ b/src/xrAICore/CMakeLists.txt @@ -224,7 +224,7 @@ source_group("AI\\Navigation\\PatrolPath\\PatrolPoint" FILES ${AI_NAVIGATION_PAT source_group("AI\\Navigation\\PatrolPath\\Storage" FILES ${AI_NAVIGATION_PATROL_PATH_STORAGE}) source_group("Kernel" FILES ${KERNEL_SRC}) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${AI_SRC} ${AI_COMPONENTS_PROBLEM_SOLVER_SRC} ${AI_COMPONENTS_PROBLEM_SOLVER_CONDITION_STATE_SRC} diff --git a/src/xrCDB/CMakeLists.txt b/src/xrCDB/CMakeLists.txt index 55227097472..4eb4df286ab 100644 --- a/src/xrCDB/CMakeLists.txt +++ b/src/xrCDB/CMakeLists.txt @@ -38,7 +38,7 @@ set(SRC_FILES ${KERNEL_SRC} ) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrCore/CMakeLists.txt b/src/xrCore/CMakeLists.txt index 40d7f4bbf58..3d6187d892c 100644 --- a/src/xrCore/CMakeLists.txt +++ b/src/xrCore/CMakeLists.txt @@ -403,7 +403,7 @@ if (PROJECT_PLATFORM_ARM OR PROJECT_PLATFORM_ARM64) list(REMOVE_ITEM SRC_FILES "Math/PLC_SSE.hpp") endif() -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/src/xrCore/ModuleLookup.cpp b/src/xrCore/ModuleLookup.cpp index d0dd45e3e03..0600a59abc3 100644 --- a/src/xrCore/ModuleLookup.cpp +++ b/src/xrCore/ModuleLookup.cpp @@ -64,7 +64,7 @@ void* ModuleHandle::Open(pcstr moduleName) void ModuleHandle::Close() { - if (dontUnload) + if (dontUnload || !handle) return; #if defined(XR_PLATFORM_LINUX) || defined(XR_PLATFORM_BSD) diff --git a/src/xrEngine/CMakeLists.txt b/src/xrEngine/CMakeLists.txt index 6796e7bcfa9..fa6dc843072 100644 --- a/src/xrEngine/CMakeLists.txt +++ b/src/xrEngine/CMakeLists.txt @@ -338,7 +338,7 @@ source_group("Render\\Particle system" FILES ${RENDER_PARTICLE_SYSTEM_SRC}) source_group("Render\\Visibility" FILES ${RENDER_VISIBILITY_SRC}) source_group("Render\\Visuals\\Skeleton" FILES ${RENDER_VISUALS_SKELETON_SRC}) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${EDITOR_SRC} ${ENGINE_SRC} ${ENGINE_CONSOLE_SRC} @@ -409,6 +409,8 @@ target_link_libraries(${PROJECT_NAME} xrScriptEngine xrNetServer xrImGui + $<$:xrRender_GL> + $<$:xrGame> ${LUA_LIBRARIES} ${SDL2_LIBRARIES} ${OPENAL_LIBRARY} diff --git a/src/xrEngine/EngineAPI.cpp b/src/xrEngine/EngineAPI.cpp index 9b2913469ba..30460ba5352 100644 --- a/src/xrEngine/EngineAPI.cpp +++ b/src/xrEngine/EngineAPI.cpp @@ -12,6 +12,18 @@ #include "xrScriptEngine/ScriptExporter.hpp" +#ifdef XRAY_STATIC_BUILD +extern "C" +{ + XR_EXPORT RendererModule* GetRendererModule(); + + XR_EXPORT IFactoryObject* __cdecl xrFactory_Create(CLASS_ID clsid); + XR_EXPORT void __cdecl xrFactory_Destroy(IFactoryObject* O); + XR_EXPORT void initialize_library(); + XR_EXPORT void finalize_library(); +} +#endif + extern xr_vector VidQualityToken; constexpr pcstr GET_RENDERER_MODULE_FUNC = "GetRendererModule"; @@ -104,6 +116,14 @@ void CEngineAPI::Initialize(void) { InitializeRenderers(); +#ifdef XRAY_STATIC_BUILD + pCreate = xrFactory_Create; + pDestroy = xrFactory_Destroy; + pInitializeGame = initialize_library; + pFinalizeGame = finalize_library; + + pInitializeGame(); +#else hGame = XRay::LoadModule("xrGame"); if (!CanSkipGameModuleLoading()) { @@ -125,6 +145,7 @@ void CEngineAPI::Initialize(void) } CloseUnusedLibraries(); +#endif } void CEngineAPI::Destroy(void) @@ -160,11 +181,16 @@ void CEngineAPI::CreateRendererList() const auto loadLibrary = [&](pcstr library) -> bool { +#ifdef XRAY_STATIC_BUILD + const auto handle = nullptr; + const auto getModule = ::GetRendererModule; +#else auto handle = XRay::LoadModule(library); if (!handle->IsLoaded()) return false; const auto getModule = (GetRendererModule)handle->GetProcAddress(GET_RENDERER_MODULE_FUNC); +#endif RendererModule* module = getModule ? getModule() : nullptr; if (!module) return false; diff --git a/src/xrEngine/FDemoPlay.cpp b/src/xrEngine/FDemoPlay.cpp index abd0bcf7fd1..32fe801654a 100644 --- a/src/xrEngine/FDemoPlay.cpp +++ b/src/xrEngine/FDemoPlay.cpp @@ -198,7 +198,7 @@ void CDemoPlay::stat_Stop() #define FIX(a) \ while (a >= m_count) \ a -= m_count -void spline1(float t, Fvector* p, Fvector* ret) +static void spline1(float t, Fvector* p, Fvector* ret) { float t2 = t * t; float t3 = t2 * t; diff --git a/src/xrGame/CMakeLists.txt b/src/xrGame/CMakeLists.txt index 7dff22f5e93..ae5e039010f 100644 --- a/src/xrGame/CMakeLists.txt +++ b/src/xrGame/CMakeLists.txt @@ -2611,7 +2611,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrGame/Weapon.cpp b/src/xrGame/Weapon.cpp index d03e69ff250..cfa74c965a0 100644 --- a/src/xrGame/Weapon.cpp +++ b/src/xrGame/Weapon.cpp @@ -1273,9 +1273,6 @@ bool CWeapon::IsSilencerAttached() const bool CWeapon::GrenadeLauncherAttachable() { return (ALife::eAddonAttachable == m_eGrenadeLauncherStatus); } bool CWeapon::ScopeAttachable() { return (ALife::eAddonAttachable == m_eScopeStatus); } bool CWeapon::SilencerAttachable() { return (ALife::eAddonAttachable == m_eSilencerStatus); } -shared_str wpn_scope = "wpn_scope"; -shared_str wpn_silencer = "wpn_silencer"; -shared_str wpn_grenade_launcher = "wpn_launcher"; void CWeapon::UpdateHUDAddonsVisibility() { // actor only @@ -1286,37 +1283,37 @@ void CWeapon::UpdateHUDAddonsVisibility() if (ScopeAttachable()) { - HudItemData()->set_bone_visible(wpn_scope, IsScopeAttached()); + HudItemData()->set_bone_visible(m_sWpnScopeName, IsScopeAttached()); } if (m_eScopeStatus == ALife::eAddonDisabled) { - HudItemData()->set_bone_visible(wpn_scope, FALSE, TRUE); + HudItemData()->set_bone_visible(m_sWpnScopeName, FALSE, TRUE); } else if (m_eScopeStatus == ALife::eAddonPermanent) - HudItemData()->set_bone_visible(wpn_scope, TRUE, TRUE); + HudItemData()->set_bone_visible(m_sWpnScopeName, TRUE, TRUE); if (SilencerAttachable()) { - HudItemData()->set_bone_visible(wpn_silencer, IsSilencerAttached()); + HudItemData()->set_bone_visible(m_sWpnSilencerName, IsSilencerAttached()); } if (m_eSilencerStatus == ALife::eAddonDisabled) { - HudItemData()->set_bone_visible(wpn_silencer, FALSE, TRUE); + HudItemData()->set_bone_visible(m_sWpnSilencerName, FALSE, TRUE); } else if (m_eSilencerStatus == ALife::eAddonPermanent) - HudItemData()->set_bone_visible(wpn_silencer, TRUE, TRUE); + HudItemData()->set_bone_visible(m_sWpnSilencerName, TRUE, TRUE); if (GrenadeLauncherAttachable()) { - HudItemData()->set_bone_visible(wpn_grenade_launcher, IsGrenadeLauncherAttached()); + HudItemData()->set_bone_visible(m_sWpnGrenadeLauncher, IsGrenadeLauncherAttached()); } if (m_eGrenadeLauncherStatus == ALife::eAddonDisabled) { - HudItemData()->set_bone_visible(wpn_grenade_launcher, FALSE, TRUE); + HudItemData()->set_bone_visible(m_sWpnGrenadeLauncher, FALSE, TRUE); } else if (m_eGrenadeLauncherStatus == ALife::eAddonPermanent) - HudItemData()->set_bone_visible(wpn_grenade_launcher, TRUE, TRUE); + HudItemData()->set_bone_visible(m_sWpnGrenadeLauncher, TRUE, TRUE); } void CWeapon::UpdateAddonsVisibility() @@ -1329,7 +1326,7 @@ void CWeapon::UpdateAddonsVisibility() pWeaponVisual->CalculateBones_Invalidate(); - bone_id = pWeaponVisual->LL_BoneID(wpn_scope); + bone_id = pWeaponVisual->LL_BoneID(m_sWpnScopeName); if (ScopeAttachable()) { if (IsScopeAttached()) @@ -1348,7 +1345,7 @@ void CWeapon::UpdateAddonsVisibility() pWeaponVisual->LL_SetBoneVisible(bone_id, FALSE, TRUE); // Log("scope", pWeaponVisual->LL_GetBoneVisible (bone_id)); } - bone_id = pWeaponVisual->LL_BoneID(wpn_silencer); + bone_id = pWeaponVisual->LL_BoneID(m_sWpnSilencerName); if (SilencerAttachable()) { if (IsSilencerAttached()) @@ -1368,7 +1365,7 @@ void CWeapon::UpdateAddonsVisibility() // Log("silencer", pWeaponVisual->LL_GetBoneVisible (bone_id)); } - bone_id = pWeaponVisual->LL_BoneID(wpn_grenade_launcher); + bone_id = pWeaponVisual->LL_BoneID(m_sWpnGrenadeLauncher); if (GrenadeLauncherAttachable()) { if (IsGrenadeLauncherAttached()) diff --git a/src/xrGame/Weapon.h b/src/xrGame/Weapon.h index 922d7d219ed..e970891d2c0 100644 --- a/src/xrGame/Weapon.h +++ b/src/xrGame/Weapon.h @@ -182,6 +182,9 @@ class CWeapon : public CHudItemObject, public CShootingObject shared_str m_sScopeName; shared_str m_sSilencerName; shared_str m_sGrenadeLauncherName; + shared_str m_sWpnScopeName = "wpn_scope"; + shared_str m_sWpnSilencerName = "wpn_silencer"; + shared_str m_sWpnGrenadeLauncher = "wpn_launcher"; //смещение иконов апгрейдов в инвентаре int m_iScopeX, m_iScopeY; diff --git a/src/xrGame/ui/UIStatsIcon.cpp b/src/xrGame/ui/UIStatsIcon.cpp index 3561c9b603a..58814e7fad0 100644 --- a/src/xrGame/ui/UIStatsIcon.cpp +++ b/src/xrGame/ui/UIStatsIcon.cpp @@ -2,10 +2,21 @@ #include "UIStatsIcon.h" #include "xrUICore/XML/UITextureMaster.h" #include "UIInventoryUtilities.h" +#include #include "Include/xrRender/UIShader.h" -CUIStatsIcon::TEX_INFO CUIStatsIcon::m_tex_info[MAX_DEF_TEX][2]; +struct CUIStatsIconTextureInfo +{ + ui_shader sh; + Frect rect; +}; + +struct CUIStatsIconTextures { + CUIStatsIconTextureInfo data[CUIStatsIcon::MAX_DEF_TEX][2]; +}; + +std::optional gTexInfo; CUIStatsIcon::CUIStatsIcon() : CUIStatic("CUIStatsIcon") @@ -16,19 +27,22 @@ CUIStatsIcon::CUIStatsIcon() void CUIStatsIcon::InitTexInfo() { - if (m_tex_info[RANK_0][0].sh->inited()) + if (!gTexInfo.has_value()) + gTexInfo.emplace(); + + if (gTexInfo.value().data[RANK_0][0].sh->inited()) return; // ranks string128 rank_tex; for (int i = RANK_0; i <= RANK_4; i++) { xr_sprintf(rank_tex, "ui_hud_status_green_0%d", i + 1); - CUITextureMaster::GetTextureShader(rank_tex, m_tex_info[i][0].sh); - m_tex_info[i][0].rect = CUITextureMaster::GetTextureRect(rank_tex); + CUITextureMaster::GetTextureShader(rank_tex, gTexInfo.value().data[i][0].sh); + gTexInfo.value().data[i][0].rect = CUITextureMaster::GetTextureRect(rank_tex); xr_sprintf(rank_tex, "ui_hud_status_blue_0%d", i + 1); - CUITextureMaster::GetTextureShader(rank_tex, m_tex_info[i][1].sh); - m_tex_info[i][1].rect = CUITextureMaster::GetTextureRect(rank_tex); + CUITextureMaster::GetTextureShader(rank_tex, gTexInfo.value().data[i][1].sh); + gTexInfo.value().data[i][1].rect = CUITextureMaster::GetTextureRect(rank_tex); } // artefact @@ -38,19 +52,19 @@ void CUIStatsIcon::InitTexInfo() float fXPos = pSettings->r_float(artefact_name, "inv_grid_x"); float fYPos = pSettings->r_float(artefact_name, "inv_grid_y"); - m_tex_info[ARTEFACT][0].sh = InventoryUtilities::GetEquipmentIconsShader(); - m_tex_info[ARTEFACT][0].rect.set(fXPos * INV_GRID_WIDTH, fYPos * INV_GRID_HEIGHT, + gTexInfo.value().data[ARTEFACT][0].sh = InventoryUtilities::GetEquipmentIconsShader(); + gTexInfo.value().data[ARTEFACT][0].rect.set(fXPos * INV_GRID_WIDTH, fYPos * INV_GRID_HEIGHT, fXPos * INV_GRID_WIDTH + fGridWidth * INV_GRID_WIDTH, fYPos * INV_GRID_HEIGHT + fGridHeight * INV_GRID_HEIGHT); - m_tex_info[ARTEFACT][1] = m_tex_info[ARTEFACT][0]; + gTexInfo.value().data[ARTEFACT][1] = gTexInfo.value().data[ARTEFACT][0]; // death - m_tex_info[DEATH][0].sh->create("hud" DELIMITER "default", "ui" DELIMITER "ui_mp_icon_kill"); - m_tex_info[DEATH][1] = m_tex_info[DEATH][0]; - m_tex_info[DEATH][0].rect.x1 = 32; - m_tex_info[DEATH][0].rect.y1 = 202; - m_tex_info[DEATH][0].rect.x2 = m_tex_info[DEATH][0].rect.x1 + 30; - m_tex_info[DEATH][0].rect.y2 = m_tex_info[DEATH][0].rect.y1 + 30; + gTexInfo.value().data[DEATH][0].sh->create("hud" DELIMITER "default", "ui" DELIMITER "ui_mp_icon_kill"); + gTexInfo.value().data[DEATH][1] = gTexInfo.value().data[DEATH][0]; + gTexInfo.value().data[DEATH][0].rect.x1 = 32; + gTexInfo.value().data[DEATH][0].rect.y1 = 202; + gTexInfo.value().data[DEATH][0].rect.x2 = gTexInfo.value().data[DEATH][0].rect.x1 + 30; + gTexInfo.value().data[DEATH][0].rect.y2 = gTexInfo.value().data[DEATH][0].rect.y1 + 30; } void CUIStatsIcon::FreeTexInfo() @@ -58,13 +72,13 @@ void CUIStatsIcon::FreeTexInfo() // ranks for (int i = RANK_0; i <= RANK_4; i++) { - m_tex_info[i][0].sh->destroy(); - m_tex_info[i][1].sh->destroy(); + gTexInfo.value().data[i][0].sh->destroy(); + gTexInfo.value().data[i][1].sh->destroy(); } - m_tex_info[ARTEFACT][0].sh->destroy(); - m_tex_info[ARTEFACT][1].sh->destroy(); - m_tex_info[DEATH][0].sh->destroy(); - m_tex_info[DEATH][1].sh->destroy(); + gTexInfo.value().data[ARTEFACT][0].sh->destroy(); + gTexInfo.value().data[ARTEFACT][1].sh->destroy(); + gTexInfo.value().data[DEATH][0].sh->destroy(); + gTexInfo.value().data[DEATH][1].sh->destroy(); } void CUIStatsIcon::SetValue(LPCSTR str) @@ -85,18 +99,18 @@ void CUIStatsIcon::SetValue(LPCSTR str) const int rank = atoi(strchr(str, '0')) - 1; - SetShader(m_tex_info[rank][team].sh); - SetTextureRect(m_tex_info[rank][team].rect); + SetShader(gTexInfo.value().data[rank][team].sh); + SetTextureRect(gTexInfo.value().data[rank][team].rect); } else if (0 == xr_strcmp(str, "death")) { - SetShader(m_tex_info[DEATH][0].sh); - SetTextureRect(m_tex_info[DEATH][0].rect); + SetShader(gTexInfo.value().data[DEATH][0].sh); + SetTextureRect(gTexInfo.value().data[DEATH][0].rect); } else if (0 == xr_strcmp(str, "artefact")) { - SetShader(m_tex_info[ARTEFACT][0].sh); - SetTextureRect(m_tex_info[ARTEFACT][0].rect); + SetShader(gTexInfo.value().data[ARTEFACT][0].sh); + SetTextureRect(gTexInfo.value().data[ARTEFACT][0].rect); } else { diff --git a/src/xrGame/ui/UIStatsIcon.h b/src/xrGame/ui/UIStatsIcon.h index 765481e29aa..6545fa19051 100644 --- a/src/xrGame/ui/UIStatsIcon.h +++ b/src/xrGame/ui/UIStatsIcon.h @@ -12,7 +12,6 @@ class CUIStatsIcon final : public CUIStatic void SetValue(LPCSTR str); pcstr GetDebugType() override { return "CUIStatsIcon"; } -protected: enum DEF_TEX { RANK_0 = 0, @@ -26,13 +25,8 @@ class CUIStatsIcon final : public CUIStatic MAX_DEF_TEX }; - typedef struct - { - ui_shader sh; - Frect rect; - } TEX_INFO; +protected: static void InitTexInfo(); static void FreeTexInfo(); - static TEX_INFO m_tex_info[MAX_DEF_TEX][2]; }; diff --git a/src/xrGameSpy/CMakeLists.txt b/src/xrGameSpy/CMakeLists.txt index 86126958e21..aede51bf619 100644 --- a/src/xrGameSpy/CMakeLists.txt +++ b/src/xrGameSpy/CMakeLists.txt @@ -39,11 +39,7 @@ set(WRAPPER_SRC source_group("Kernel" FILES ${KERNEL_SRC}) source_group("Wrapper" FILES ${WRAPPER_SRC}) -if (STATIC_BUILD) - add_library(${PROJECT_NAME} STATIC ${KERNEL_SRC} ${WRAPPER_SRC}) -else() - add_library(${PROJECT_NAME} SHARED ${KERNEL_SRC} ${WRAPPER_SRC}) -endif() +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${KERNEL_SRC} ${WRAPPER_SRC}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrNetServer/CMakeLists.txt b/src/xrNetServer/CMakeLists.txt index d8b86e44e53..a432b984bc1 100644 --- a/src/xrNetServer/CMakeLists.txt +++ b/src/xrNetServer/CMakeLists.txt @@ -29,7 +29,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrParticles/CMakeLists.txt b/src/xrParticles/CMakeLists.txt index 711ef5f59cc..4390f7c9e6a 100644 --- a/src/xrParticles/CMakeLists.txt +++ b/src/xrParticles/CMakeLists.txt @@ -25,7 +25,7 @@ set(PARTICLE_API_SRC source_group("Kernel" FILES ${KERNEL_SRC}) source_group("ParticleAPI" FILES ${PARTICLE_API_SRC}) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${KERNEL_SRC} ${PARTICLE_API_SRC} ) diff --git a/src/xrPhysics/CMakeLists.txt b/src/xrPhysics/CMakeLists.txt index 3367548a5dd..fa4ed76f825 100644 --- a/src/xrPhysics/CMakeLists.txt +++ b/src/xrPhysics/CMakeLists.txt @@ -349,11 +349,7 @@ set(SRC_FILES ${DAMAGE_RECEIVER} ) -if (STATIC_BUILD) - add_library(${PROJECT_NAME} STATIC ${SRC_FILES}) -else() - add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) -endif() +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/src/xrScriptEngine/CMakeLists.txt b/src/xrScriptEngine/CMakeLists.txt index 7fb216717c0..989038ed413 100644 --- a/src/xrScriptEngine/CMakeLists.txt +++ b/src/xrScriptEngine/CMakeLists.txt @@ -84,7 +84,7 @@ source_group("ScriptCallbackEx" FILES ${SCRIPT_CALLBACK_EX_SRC}) source_group("Thread" FILES ${THREAD_SRC}) source_group("Thread\\StackTracker" FILES ${THREAD_STACK_TRACKER_SRC}) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${DEBUG_SRC} ${ENGINE_SRC} ${EXPORT_SRC} @@ -112,6 +112,7 @@ target_link_libraries(${PROJECT_NAME} xrCore xrLuaFix xrLuabind + $<$:xrGame> ${LUA_LIBRARIES} ) diff --git a/src/xrScriptEngine/ScriptExporter.cpp b/src/xrScriptEngine/ScriptExporter.cpp index 08b30209735..5198d52465f 100644 --- a/src/xrScriptEngine/ScriptExporter.cpp +++ b/src/xrScriptEngine/ScriptExporter.cpp @@ -3,6 +3,331 @@ #include "ScriptExporter.hpp" #include "xrCore/xrCore.h" + +#ifdef XRAY_STATIC_BUILD +#define SCRIPT_EXPORT_PULL(id, dependencies, ...) \ + extern const ScriptExporter::Node id##_ScriptExporterNode; \ + gModulesPull += (intptr_t)&(id##_ScriptExporterNode); + +#define SCRIPT_EXPORT_FUNC_PULL(id, dependencies, func) SCRIPT_EXPORT_PULL(id, dependencies, func) + + +namespace XRay::ScriptExportDetails { +static size_t gModulesPull = 0; + +// List of nodes was gathered by the command: +// grep -r --include="*.cpp" -h --context=0 --no-group-separator SCRIPT_EXPORT > script_exports.txt +static void pull_export_nodes() +{ + SCRIPT_EXPORT_PULL(CScriptSoundType, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeItemPDA, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemDocument, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemGrenade, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemExplosive, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemBolt, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemCustomOutfit, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemHelmet, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemWeaponMagazined, (CSE_ALifeItemWeapon)); + SCRIPT_EXPORT_PULL(CScriptRTokenList, ()); + SCRIPT_EXPORT_PULL(CPureServerObject, ()); + SCRIPT_EXPORT_PULL(CSE_Abstract, (CPureServerObject)); + SCRIPT_EXPORT_PULL(CSE_Shape, ()); + SCRIPT_EXPORT_PULL(CSE_Visual, ()); + SCRIPT_EXPORT_PULL(CSE_Motion, ()); + SCRIPT_EXPORT_PULL(CSE_Spectator, (CSE_Abstract)); + SCRIPT_EXPORT_PULL(CSE_Temporary, (CSE_Abstract)); + SCRIPT_EXPORT_PULL(Fcolor, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeObjectHangingLamp, (CSE_ALifeDynamicObjectVisual, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeObjectPhysic, (CSE_ALifeDynamicObjectVisual, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeSmartZone, (CSE_ALifeSpaceRestrictor, CSE_ALifeSchedulable)); + SCRIPT_EXPORT_PULL(ClientID, ()); + SCRIPT_EXPORT_PULL(NET_Packet, ()); + SCRIPT_EXPORT_PULL(CSE_PHSkeleton, ()); + SCRIPT_EXPORT_PULL(CSE_AbstractVisual, (CSE_Visual, CSE_Abstract)); + //SCRIPT_EXPORT_PULL(CSE_SpawnGroup, (CSE_Abstract)); + SCRIPT_EXPORT_PULL(Flags8, ()); + SCRIPT_EXPORT_PULL(Flags16, ()); + SCRIPT_EXPORT_PULL(Flags32, ()); + SCRIPT_EXPORT_PULL(CObjectFactory, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeInventoryItem, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeItem, (CSE_ALifeDynamicObjectVisual, CSE_ALifeInventoryItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemTorch, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemAmmo, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemWeapon, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemWeaponShotGun, (CSE_ALifeItemWeapon)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemWeaponAutoShotGun, (CSE_ALifeItemWeapon)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemDetector, (CSE_ALifeItem)); + SCRIPT_EXPORT_PULL(CSE_ALifeItemArtefact, (CSE_ALifeItem)); + SCRIPT_EXPORT_FUNC_PULL(CSE_ALifeMonsterAbstract, (CSE_ALifeCreatureAbstract, CSE_ALifeSchedulable), CSE_ALifeMonsterAbstract_Export); + SCRIPT_EXPORT_FUNC_PULL(CSE_ALifeHumanAbstract, (CSE_ALifeTraderAbstract, CSE_ALifeMonsterAbstract), CSE_ALifeHumanAbstract_Export); + SCRIPT_EXPORT_PULL(CSE_ALifePsyDogPhantom, (CSE_ALifeMonsterBase)); + SCRIPT_EXPORT_PULL(IReader, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeCreatureCrow, (CSE_ALifeCreatureAbstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeMonsterZombie, (CSE_ALifeMonsterAbstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeMonsterBase, (CSE_ALifeMonsterAbstract, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeHumanStalker, (CSE_ALifeHumanAbstract, CSE_PHSkeleton)); + SCRIPT_EXPORT_FUNC_PULL(CScriptIniFile, (), CScriptIniFile_Export); + SCRIPT_EXPORT_PULL(Fvector, ()); + SCRIPT_EXPORT_PULL(Fvector2, ()); + SCRIPT_EXPORT_PULL(Fbox, ()); + SCRIPT_EXPORT_PULL(Frect, ()); + SCRIPT_EXPORT_FUNC_PULL(CSE_SmartCover, (CSE_ALifeDynamicObject), CSE_SmartCover_Export); + SCRIPT_EXPORT_PULL(CSE_ALifeItemWeaponMagazinedWGL, (CSE_ALifeItemWeaponMagazined)); + SCRIPT_EXPORT_PULL(CSE_ALifeObjectProjector, (CSE_ALifeDynamicObjectVisual)); + SCRIPT_EXPORT_PULL(CSE_ALifeHelicopter, (CSE_ALifeDynamicObjectVisual, CSE_Motion, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeCar, (CSE_ALifeDynamicObjectVisual, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeObjectBreakable, (CSE_ALifeDynamicObjectVisual)); + SCRIPT_EXPORT_PULL(CSE_ALifeObjectClimable, (CSE_Shape, CSE_Abstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeMountedWeapon, (CSE_ALifeDynamicObjectVisual)); + SCRIPT_EXPORT_PULL(CSE_ALifeTeamBaseZone, (CSE_ALifeSpaceRestrictor)); + SCRIPT_EXPORT_PULL(CSE_ALifeSchedulable, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeGraphPoint, (CSE_Abstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeObject, (CSE_Abstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeGroupAbstract, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeDynamicObject, (CSE_ALifeObject)); + SCRIPT_EXPORT_PULL(CSE_ALifeDynamicObjectVisual, (CSE_ALifeDynamicObject, CSE_Visual)); + SCRIPT_EXPORT_PULL(CSE_ALifePHSkeletonObject, (CSE_ALifeDynamicObjectVisual, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeSpaceRestrictor, (CSE_ALifeDynamicObject, CSE_Shape)); + SCRIPT_EXPORT_PULL(CSE_ALifeLevelChanger, (CSE_ALifeSpaceRestrictor)); + SCRIPT_EXPORT_PULL(CSE_ALifeInventoryBox, (CSE_ALifeDynamicObjectVisual)); + SCRIPT_EXPORT_PULL(Fmatrix, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeTraderAbstract, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeTraderAbstract, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeTrader, (CSE_ALifeDynamicObjectVisual, CSE_ALifeTraderAbstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeCustomZone, (CSE_ALifeDynamicObject, CSE_Shape)); + SCRIPT_EXPORT_PULL(CSE_ALifeAnomalousZone, (CSE_ALifeCustomZone)); + SCRIPT_EXPORT_PULL(CSE_ALifeMonsterRat, (CSE_ALifeMonsterAbstract, CSE_ALifeInventoryItem)); + SCRIPT_EXPORT_PULL(CScriptTokenList, ()); + SCRIPT_EXPORT_PULL(CSE_ALifeCreatureActor, (CSE_ALifeCreatureAbstract, CSE_ALifeTraderAbstract, CSE_PHSkeleton)); + SCRIPT_EXPORT_PULL(CSE_ALifeTorridZone, (CSE_ALifeCustomZone, CSE_Motion)); + SCRIPT_EXPORT_PULL(CSE_ALifeZoneVisual, (CSE_ALifeAnomalousZone, CSE_Visual)); + SCRIPT_EXPORT_PULL(CSE_ALifeCreaturePhantom, (CSE_ALifeCreatureAbstract)); + SCRIPT_EXPORT_PULL(CSE_ALifeCreatureAbstract, (CSE_ALifeDynamicObjectVisual)); + SCRIPT_EXPORT_FUNC_PULL(CSE_ALifeOnlineOfflineGroup, (CSE_ALifeDynamicObject, CSE_ALifeSchedulable), CSE_ALifeOnlineOfflineGroup_Export); + SCRIPT_EXPORT_PULL(Device, ()); + SCRIPT_EXPORT_PULL(KeyBindings, ()); + SCRIPT_EXPORT_PULL(CheckRendererSupport, ()); + //FIXME SCRIPT_EXPORT_PULL(CScriptPropertiesListHelper, ()); + SCRIPT_EXPORT_PULL(CUIComboBox, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIListWnd, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIListItem, (CUIButton)); + SCRIPT_EXPORT_PULL(CUIListItemEx, (CUIListItem)); + SCRIPT_EXPORT_PULL(CUITabControl, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUITabButton, (CUIButton)); + SCRIPT_EXPORT_PULL(UICore, ()); + SCRIPT_EXPORT_PULL(UIStyleManager, ()); + SCRIPT_EXPORT_PULL(CUITextureMaster, ()); + SCRIPT_EXPORT_PULL(CUIWindow, ()); + SCRIPT_EXPORT_PULL(CUIFrameWindow, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIFrameLineWnd, (CUIWindow)); + SCRIPT_EXPORT_PULL(UIHint, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIScrollView, (CUIWindow)); + SCRIPT_EXPORT_PULL(EnumUIMessages, ()); + SCRIPT_EXPORT_PULL(CUIButton, (CUIStatic, CUIWindow)); + SCRIPT_EXPORT_PULL(CUIOptionsManagerScript, ()); + SCRIPT_EXPORT_PULL(CUIProgressBar, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIPropertiesBox, (CUIFrameWindow)); + SCRIPT_EXPORT_PULL(CUIMessageBox, (CUIStatic)); + SCRIPT_EXPORT_PULL(CUILines, ()); + SCRIPT_EXPORT_PULL(CUIStatic, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUITextWnd, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIListBox, (CUIScrollView)); + SCRIPT_EXPORT_PULL(CUIListBoxItem, (CUIFrameLineWnd)); + SCRIPT_EXPORT_PULL(CUIListBoxItemMsgChain, (CUIListBoxItem)); + SCRIPT_EXPORT_PULL(CUIEditBox, (CUIWindow)); + SCRIPT_EXPORT_PULL(CPhysicObject, (CGameObject)); + SCRIPT_EXPORT_PULL(CHangingLamp, (CGameObject)); + SCRIPT_EXPORT_PULL(CHolderCustom, ()); + SCRIPT_EXPORT_PULL(CPHCallOnStepCondition, ()); + SCRIPT_EXPORT_PULL(CPHExpireOnStepCondition, (CPHCallOnStepCondition)); + SCRIPT_EXPORT_PULL(CPHConstForceAction, ()); + SCRIPT_EXPORT_PULL(CScriptZone, (IFactoryObject)); + SCRIPT_EXPORT_PULL(CSmartZone, (IFactoryObject)); + SCRIPT_EXPORT_PULL(CEF_Storage, ()); + SCRIPT_EXPORT_PULL(CGameTask, ()); + SCRIPT_EXPORT_PULL(CScriptParticleAction, ()); + SCRIPT_EXPORT_PULL(game_sv_Deathmatch, (game_sv_GameState)); + SCRIPT_EXPORT_PULL(login_manager, ()); + SCRIPT_EXPORT_PULL(profile, ()); + SCRIPT_EXPORT_PULL(login_operation_cb, ()); + SCRIPT_EXPORT_PULL(CCar, (CGameObject, CHolderCustom)); + SCRIPT_EXPORT_PULL(CScriptSound, ()); + SCRIPT_EXPORT_PULL(SZoneMapEntityData, ()); + SCRIPT_EXPORT_PULL(SZoneMapEntities, ()); + SCRIPT_EXPORT_PULL(RPoint, ()); + SCRIPT_EXPORT_PULL(game_cl_GameState, (game_GameState)); + SCRIPT_EXPORT_PULL(game_cl_mp, (game_cl_GameState)); + SCRIPT_EXPORT_FUNC_PULL(game_cl_mp_script, (game_cl_mp), game_cl_mp_script_script_register); + SCRIPT_EXPORT_PULL(CScope, (CGameObject)); + SCRIPT_EXPORT_FUNC_PULL(CScriptActionPlannerAction, (CScriptActionPlanner, CScriptActionBase), CScriptActionPlannerAction_Export); + SCRIPT_EXPORT_PULL(CALifeMonsterDetailPathManager, ()); + SCRIPT_EXPORT_PULL(profile_store, ()); + SCRIPT_EXPORT_PULL(CPhraseDialogExporter, ()); + SCRIPT_EXPORT_PULL(game_sv_GameState, (game_GameState)); + SCRIPT_EXPORT_PULL(EGameEnums, ()); + SCRIPT_EXPORT_PULL(CPseudoGigant, (CGameObject)); + SCRIPT_EXPORT_PULL(CPoltergeist, (CGameObject)); + SCRIPT_EXPORT_PULL(CController, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Dog, (CGameObject)); + SCRIPT_EXPORT_PULL(CZombie, (CGameObject)); + SCRIPT_EXPORT_PULL(CSnork, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Boar, (CGameObject)); + SCRIPT_EXPORT_PULL(CChimera, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Bloodsucker, (CGameObject)); + SCRIPT_EXPORT_PULL(CFracture, (CGameObject)); + SCRIPT_EXPORT_PULL(CCat, (CGameObject)); + SCRIPT_EXPORT_PULL(CBurer, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Flesh, (CGameObject)); + SCRIPT_EXPORT_PULL(CTushkano, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_PseudoDog, (CGameObject)); + SCRIPT_EXPORT_PULL(CPsyDog, (CGameObject)); + SCRIPT_EXPORT_PULL(CPsyDogPhantom, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Trader, (CGameObject)); + SCRIPT_EXPORT_PULL(CStalkerPlanner, (CScriptActionPlanner)); + SCRIPT_EXPORT_PULL(CAI_Stalker, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptSoundInfo, ()); + SCRIPT_EXPORT_PULL(game_PlayerState, ()); + SCRIPT_EXPORT_FUNC_PULL(game_GameState, (IFactoryObject), game_GameState_script_register); + SCRIPT_EXPORT_PULL(CALifeHumanBrain, (CALifeMonsterBrain)); + SCRIPT_EXPORT_FUNC_PULL(CScriptActionBase, (), CScriptActionBase_Export); + SCRIPT_EXPORT_PULL(CHelicopter, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptActionCondition, ()); + SCRIPT_EXPORT_PULL(CMincer, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptEntityAction, ()); + SCRIPT_EXPORT_PULL(CScriptHit, ()); + SCRIPT_EXPORT_FUNC_PULL(CLevel, (), CLevel_Export); + SCRIPT_EXPORT_PULL(demo_player_info, ()); + SCRIPT_EXPORT_PULL(demo_info, ()); + SCRIPT_EXPORT_PULL(CWeapon, (CGameObject)); + SCRIPT_EXPORT_PULL(CWeaponMagazined, (CWeapon)); + SCRIPT_EXPORT_PULL(CWeaponMagazinedWGrenade, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponBinoculars, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponBM16, (CWeaponShotgun)); + SCRIPT_EXPORT_PULL(CWeaponFN2000, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponFORT, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CF1, (CGameObject, CExplosive)); + SCRIPT_EXPORT_PULL(CWeaponHPSA, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponKnife, (CWeapon)); + SCRIPT_EXPORT_PULL(CWeaponLR300, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponPM, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CRGD5, (CGameObject, CExplosive)); + SCRIPT_EXPORT_PULL(CWeaponRPG7, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponSVD, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponSVU, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponAK74, (CWeaponMagazinedWGrenade)); + SCRIPT_EXPORT_PULL(CWeaponAutomaticShotgun, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponGroza, (CWeaponMagazinedWGrenade)); + SCRIPT_EXPORT_PULL(CWeaponRG6, (CWeaponShotgun)); + SCRIPT_EXPORT_PULL(CWeaponShotgun, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponUSP45, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponVal, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponVintorez, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(CWeaponWalther, (CWeaponMagazined)); + SCRIPT_EXPORT_PULL(IFactoryObject, ()); + SCRIPT_EXPORT_PULL(ISheduled, ()); + SCRIPT_EXPORT_PULL(IRenderable, ()); + SCRIPT_EXPORT_PULL(ICollidable, ()); + SCRIPT_EXPORT_PULL(CGameObject, (IFactoryObject, ISheduled, ICollidable, IRenderable)); + SCRIPT_EXPORT_PULL(IRenderVisual, ()); + SCRIPT_EXPORT_PULL(IKinematicsAnimated, ()); + SCRIPT_EXPORT_PULL(CBlend, ()); + SCRIPT_EXPORT_PULL(CScriptPropertyEvaluator, ()); + SCRIPT_EXPORT_PULL(CPropertyStorage, ()); + SCRIPT_EXPORT_PULL(CSpaceRestrictor, (CGameObject)); + SCRIPT_EXPORT_PULL(profile_data_script_registrator, ()); + SCRIPT_EXPORT_PULL(store_operation_cb, ()); + SCRIPT_EXPORT_PULL(CMapManager, ()); + SCRIPT_EXPORT_PULL(CMapLocation, ()); + SCRIPT_EXPORT_FUNC_PULL(UIRegistrator, (CDialogHolder), UIRegistratorScriptExport) + SCRIPT_EXPORT_FUNC_PULL(CMemoryInfo, (), CMemoryInfo_Export); + SCRIPT_EXPORT_PULL(CScriptWatchAction, ()); + SCRIPT_EXPORT_PULL(CScriptParticles, ()); + SCRIPT_EXPORT_FUNC_PULL(CCustomOutfit, (CGameObject), CCustomOutfit_Export); + SCRIPT_EXPORT_FUNC_PULL(CHelmet, (CGameObject), CHelmet_Export); + SCRIPT_EXPORT_PULL(account_manager, ()); + SCRIPT_EXPORT_PULL(suggest_nicks_cb, ()); + SCRIPT_EXPORT_PULL(account_operation_cb, ()); + SCRIPT_EXPORT_PULL(account_profiles_cb, ()); + SCRIPT_EXPORT_PULL(found_email_cb, ()); + SCRIPT_EXPORT_PULL(CScriptGameObject, ()); + SCRIPT_EXPORT_PULL(CScriptMonsterHitInfo, ()); + SCRIPT_EXPORT_FUNC_PULL(CActor, (CGameObject), CActor_Export); + SCRIPT_EXPORT_PULL(cphysics_world_scripted, ()); + SCRIPT_EXPORT_PULL(CScriptEffector, ()); + SCRIPT_EXPORT_PULL(CConsole, ()); + SCRIPT_EXPORT_PULL(CSavedGameWrapper, ()); + SCRIPT_EXPORT_PULL(CEntityCondition, ()); + SCRIPT_EXPORT_PULL(CActorCondition, (CEntityCondition)); + SCRIPT_EXPORT_PULL(lanim_wrapper, ()); + SCRIPT_EXPORT_PULL(CScriptAnimationAction, ()); + SCRIPT_EXPORT_PULL(cphysics_element_scripted, ()); + SCRIPT_EXPORT_PULL(smart_cover_object, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptMonsterAction, ()); + SCRIPT_EXPORT_PULL(CALifeMonsterMovementManager, ()); + SCRIPT_EXPORT_PULL(fs_registrator, ()); + SCRIPT_EXPORT_PULL(cphysics_shell_scripted, ()); + //SCRIPT_EXPORT_PULL(CPhysicsElement, ()); + //SCRIPT_EXPORT_PULL(CPhysicsJoint, ()); + SCRIPT_EXPORT_PULL(CDialogHolder, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIDialogWnd, (CDialogHolder)); + SCRIPT_EXPORT_PULL(CUIMessageBoxEx, (CUIDialogWnd)); + SCRIPT_EXPORT_PULL(CUIMMShniaga, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUISleepStatic, (CUIStatic)); + SCRIPT_EXPORT_PULL(SServerFilters, ()); + SCRIPT_EXPORT_PULL(connect_error_cb, ()); + SCRIPT_EXPORT_PULL(CServerList, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIMapList, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIVersionList, (CUIWindow)); + SCRIPT_EXPORT_PULL(EnumGameIDs, ()); + SCRIPT_EXPORT_PULL(CUIActorMenu, (CUIDialogWnd)); + SCRIPT_EXPORT_PULL(CUIPdaWnd, (CUIDialogWnd)); + SCRIPT_EXPORT_PULL(FactionState, ()); + SCRIPT_EXPORT_PULL(CUIListBox, (CUIScrollView)); + SCRIPT_EXPORT_PULL(CUIListBoxItem, (CUIFrameLineWnd)); + SCRIPT_EXPORT_PULL(CUIListBoxItemMsgChain, (CUIListBoxItem)); + SCRIPT_EXPORT_PULL(SServerFilters, ()); + SCRIPT_EXPORT_PULL(connect_error_cb, ()); + SCRIPT_EXPORT_PULL(CServerList, (CUIWindow)); + SCRIPT_EXPORT_PULL(CUIMapList, (CUIWindow)); + SCRIPT_EXPORT_PULL(EnumGameIDs, ()); + SCRIPT_EXPORT_PULL(CUIDialogWndEx, (CUIDialogWnd, IFactoryObject)); + SCRIPT_EXPORT_PULL(CUIMapInfo, (CUIWindow)); + SCRIPT_EXPORT_PULL(FractionState, ()); + SCRIPT_EXPORT_PULL(CStalkerOutfit, (CGameObject)); + SCRIPT_EXPORT_PULL(CTorch, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptSoundAction, ()); + SCRIPT_EXPORT_PULL(cphysics_joint_scripted, ()); + SCRIPT_EXPORT_PULL(CMosquitoBald, (CGameObject)); + SCRIPT_EXPORT_PULL(CScriptGameDifficulty, ()); + SCRIPT_EXPORT_PULL(CCoverPoint, ()); + SCRIPT_EXPORT_PULL(CALifeSmartTerrainTask, ()); + SCRIPT_EXPORT_PULL(CALifeMonsterBrain, ()); + SCRIPT_EXPORT_PULL(CScriptObjectAction, ()); + SCRIPT_EXPORT_FUNC_PULL(game_sv_mp, (game_sv_GameState), game_sv_mp_script_register); + SCRIPT_EXPORT_FUNC_PULL(game_sv_mp_script, (game_sv_mp), game_sv_mp_script_script_register); + SCRIPT_EXPORT_PULL(CParticleParams, ()); + SCRIPT_EXPORT_PULL(CALifeSimulator, ()); + SCRIPT_EXPORT_PULL(CUIGameCustom, (CDialogHolder)); + SCRIPT_EXPORT_PULL(CRenderDevice, ()); + SCRIPT_EXPORT_PULL(CArtefact, (CGameObject)); + SCRIPT_EXPORT_PULL(CHairsZone, (CGameObject)); + SCRIPT_EXPORT_PULL(CAI_Crow, (CGameObject)); + SCRIPT_EXPORT_PULL(CALifeMonsterPatrolPathManager, ()); + SCRIPT_EXPORT_PULL(CScriptMovementAction, ()); + SCRIPT_EXPORT_PULL(CClientSpawnManager, ()); + SCRIPT_EXPORT_PULL(CExplosive, ()); + SCRIPT_EXPORT_PULL(CScriptXmlInit, ()); + SCRIPT_EXPORT_FUNC_PULL(CScriptActionPlanner, (), CScriptActionPlanner_Export); + SCRIPT_EXPORT_PULL(CScriptBinderObject, ()); + SCRIPT_EXPORT_PULL(CGameGraph, ()); + SCRIPT_EXPORT_PULL(CPatrolPathParams, ()); + SCRIPT_EXPORT_PULL(CScriptWorldProperty, ()); + SCRIPT_EXPORT_PULL(CScriptWorldState, ()); + SCRIPT_EXPORT_PULL(CScriptEngine, ()); +} +} +#endif + using namespace XRay; ScriptExporter::Node* ScriptExporter::Node::firstNode = nullptr; @@ -120,6 +445,10 @@ void ScriptExporter::Node::InsertAfter(Node* target, Node* node) void ScriptExporter::Export(lua_State* luaState) { +#ifdef XRAY_STATIC_BUILD + ScriptExportDetails::pull_export_nodes(); +#endif + #ifdef CONFIG_SCRIPT_ENGINE_LOG_EXPORTS Msg("* ScriptExporter: total nodes: %zu", Node::GetCount()); for (auto node = Node::GetFirst(); node; node = node->GetNext()) diff --git a/src/xrScriptEngine/ScriptExporter.hpp b/src/xrScriptEngine/ScriptExporter.hpp index e36b62cd160..643e6a74c2a 100644 --- a/src/xrScriptEngine/ScriptExporter.hpp +++ b/src/xrScriptEngine/ScriptExporter.hpp @@ -78,8 +78,9 @@ namespace ScriptExportDetails __pragma(warning(push)) __pragma(warning(disable : 4003)) static const char* const id##_Deps[] = { \ nullptr, SCRIPT_INHERIT(NOOP dependencies)}; \ __pragma(warning(pop)) __pragma(optimize("s", on)) static void id##_ScriptExport(lua_State* luaState) \ - __VA_ARGS__ static const ScriptExporter::Node id##_ScriptExporterNode( \ - #id, sizeof(id##_Deps) / sizeof(*id##_Deps) - 1, id##_Deps + 1, id##_ScriptExport); \ + __VA_ARGS__ \ + extern const ScriptExporter::Node id##_ScriptExporterNode( \ + #id, sizeof(id##_Deps) / sizeof(*id##_Deps) - 1, id##_Deps + 1, id##_ScriptExport); \ \ } \ \ @@ -100,7 +101,7 @@ namespace ScriptExportDetails { \ func(luaState); \ } \ - static const ScriptExporter::Node id##_ScriptExporterNode( \ + extern const ScriptExporter::Node id##_ScriptExporterNode( \ #id, sizeof(id##_Deps) / sizeof(*id##_Deps) - 1, id##_Deps + 1, id##_ScriptExport); \ \ } \ diff --git a/src/xrSound/CMakeLists.txt b/src/xrSound/CMakeLists.txt index 79f994f76fc..27fbe6d38f8 100644 --- a/src/xrSound/CMakeLists.txt +++ b/src/xrSound/CMakeLists.txt @@ -93,7 +93,7 @@ source_group("Source" FILES ${SOURCE_SRC}) source_group("Target" FILES ${TARGET_SRC}) source_group("Target\\OpenAL" FILES ${TARGET_OPENAL_SRC}) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${CACHE_SRC} ${CORE_SRC} ${CORE_OPENAL_SRC} diff --git a/src/xrUICore/CMakeLists.txt b/src/xrUICore/CMakeLists.txt index 2150e028e16..b4a5fdb1a66 100644 --- a/src/xrUICore/CMakeLists.txt +++ b/src/xrUICore/CMakeLists.txt @@ -137,7 +137,7 @@ set(SRC_FILES group_sources(SRC_FILES) -add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +add_library(${PROJECT_NAME} ${LIBS_LINK_TYPE} ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE