From 94acc9ac7eb3bdde02345ea1c5982b198c28ee09 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JIR6MDI\\en1515" Date: Sat, 11 Aug 2018 01:14:17 +0500 Subject: [PATCH] Added xrUICore project. Some ui files moved to xrUICore --- res/gamedata/configs/localization.ltx | 7 + src/Common/CommonImportExport.inl | 6 + src/Include/xrAPI/xrAPI.h | 2 + src/engine.sln | 14 + src/utils/xrSE_Factory/xrUIXmlParser.cpp | 52 +- src/xrEngine/StringTable/IStringTable.cpp | 4 + src/xrEngine/StringTable/IStringTable.h | 18 + .../StringTable/IStringTableDefs.h} | 3 - src/xrEngine/xrEngine.vcxproj | 5 + src/xrEngine/xrEngine.vcxproj.filters | 18 + src/xrEngine/xr_input_xinput.cpp | 518 +++++++ src/xrEngine/xr_input_xinput.h | 165 +++ src/xrGame/Actor.cpp | 5 +- src/xrGame/Actor.h | 2 +- src/xrGame/ActorAnimation.cpp | 2 +- src/xrGame/ActorCondition.cpp | 6 +- src/xrGame/ActorInput.cpp | 4 +- src/xrGame/ActorVehicle.cpp | 2 +- src/xrGame/CustomDetector.cpp | 2 +- src/xrGame/DBG_Car.cpp | 2 +- src/xrGame/DestroyablePhysicsObject.cpp | 2 +- src/xrGame/EliteDetector.cpp | 4 +- src/xrGame/GameObject.cpp | 4 +- src/xrGame/GamePersistent.cpp | 21 +- src/xrGame/GamePersistent.h | 1 - src/xrGame/GameTask.cpp | 6 +- src/xrGame/GametaskManager.cpp | 2 +- src/xrGame/HUDCrosshair.cpp | 3 +- src/xrGame/HUDCrosshair.h | 2 +- src/xrGame/HUDManager.cpp | 108 +- src/xrGame/HUDTarget.cpp | 7 +- src/xrGame/HangingLamp.cpp | 2 +- src/xrGame/Helicopter.cpp | 5 +- src/xrGame/Helicopter2.cpp | 2 +- src/xrGame/HelicopterMovementManager.cpp | 2 +- src/xrGame/HitMarker.cpp | 2 +- src/xrGame/HitMarker.h | 2 +- src/xrGame/HudItem.cpp | 2 +- src/xrGame/Inventory.cpp | 2 +- src/xrGame/InventoryBox.cpp | 2 +- src/xrGame/InventoryOwner.cpp | 2 +- src/xrGame/LevelGraphDebugRender.cpp | 2 +- src/xrGame/Level_input.cpp | 2 +- src/xrGame/Level_network.cpp | 8 +- src/xrGame/Level_network_start_client.cpp | 2 +- src/xrGame/Level_start.cpp | 10 +- src/xrGame/MainMenu.cpp | 13 +- src/xrGame/MainMenu.h | 4 +- src/xrGame/Missile.cpp | 2 +- src/xrGame/PHDebug.cpp | 2 +- src/xrGame/PHScriptCall.h | 2 +- src/xrGame/PhraseScript.cpp | 2 +- src/xrGame/PhysicsShellHolder.cpp | 2 +- src/xrGame/ScriptXMLInit.cpp | 25 +- src/xrGame/ScriptXMLInit.h | 2 +- src/xrGame/Spectator.cpp | 17 +- src/xrGame/StdAfx.h | 53 +- src/xrGame/Tracer.h | 2 +- src/xrGame/UIAchivementsIndicator.cpp | 2 +- src/xrGame/UIAchivementsIndicator.h | 2 +- src/xrGame/UIDialogHolder.cpp | 2 +- src/xrGame/UIGameAHunt.cpp | 2 +- src/xrGame/UIGameCTA.cpp | 5 +- src/xrGame/UIGameCustom.cpp | 2 +- src/xrGame/UIGameCustom_script.cpp | 2 +- src/xrGame/UIGameDM.cpp | 2 +- src/xrGame/UIGameMP.cpp | 2 +- src/xrGame/UIGameSP.cpp | 2 +- src/xrGame/UIPlayerItem.cpp | 5 +- src/xrGame/UIPlayerItem.h | 4 +- src/xrGame/UITeamHeader.cpp | 5 +- src/xrGame/UITeamHeader.h | 4 +- src/xrGame/UITeamPanels.cpp | 4 +- src/xrGame/UITeamPanels.h | 4 +- src/xrGame/UITeamState.cpp | 6 +- src/xrGame/UITeamState.h | 4 +- src/xrGame/UIZoneMap.h | 2 +- src/xrGame/Weapon.cpp | 2 +- src/xrGame/WeaponAmmo.cpp | 2 +- src/xrGame/WeaponBinoculars.cpp | 2 +- src/xrGame/WeaponBinocularsVision.cpp | 2 +- src/xrGame/WeaponBinocularsVision.h | 2 +- src/xrGame/WeaponMagazined.cpp | 8 +- src/xrGame/WeaponMagazinedWGrenade.cpp | 4 +- src/xrGame/actor_communication.cpp | 2 +- src/xrGame/ai/crow/ai_crow.cpp | 2 +- .../basemonster/base_monster_feel.cpp | 4 +- .../ai/monsters/controller/controller.cpp | 2 +- src/xrGame/ai/stalker/ai_stalker_debug.cpp | 2 +- src/xrGame/ai/trader/ai_trader.cpp | 2 +- src/xrGame/ai/trader/trader_animation.cpp | 2 +- src/xrGame/alife_storage_manager.cpp | 2 +- src/xrGame/animation_script_callback.cpp | 2 +- src/xrGame/attachable_item.cpp | 2 +- src/xrGame/client_spawn_manager.h | 2 +- src/xrGame/console_commands.cpp | 6 +- src/xrGame/debug_text_tree.cpp | 2 +- src/xrGame/doors_door.cpp | 2 +- src/xrGame/encyclopedia_article.cpp | 2 +- src/xrGame/encyclopedia_article.h | 2 +- src/xrGame/enemy_manager.h | 2 +- src/xrGame/entity_alive.cpp | 2 +- src/xrGame/file_transfer.cpp | 2 +- src/xrGame/game_cl_artefacthunt.cpp | 10 +- src/xrGame/game_cl_base.cpp | 8 +- src/xrGame/game_cl_capture_the_artefact.cpp | 14 +- ..._capture_the_artefact_captions_manager.cpp | 8 +- ..._cl_capture_the_artefact_messages_menu.cpp | 5 +- src/xrGame/game_cl_deathmatch.cpp | 4 +- src/xrGame/game_cl_mp.cpp | 59 +- src/xrGame/game_cl_mp.h | 2 +- src/xrGame/game_cl_mp_messages_menu.cpp | 5 +- src/xrGame/game_cl_teamdeathmatch.cpp | 16 +- src/xrGame/game_news.h | 2 +- src/xrGame/game_sv_base.cpp | 5 +- src/xrGame/game_sv_capture_the_artefact.cpp | 2 +- src/xrGame/game_sv_mp.cpp | 10 +- src/xrGame/game_sv_teamdeathmatch.cpp | 2 +- src/xrGame/hit_memory_manager.cpp | 2 +- src/xrGame/inventory_item.cpp | 6 +- src/xrGame/inventory_owner_info.cpp | 2 +- src/xrGame/inventory_upgrade.cpp | 4 +- src/xrGame/inventory_upgrade_property.cpp | 2 +- src/xrGame/level_debug.cpp | 2 +- src/xrGame/level_script.cpp | 2 +- src/xrGame/map_location.cpp | 2 +- src/xrGame/map_manager.cpp | 2 +- src/xrGame/map_spot.cpp | 2 +- src/xrGame/map_spot.h | 2 +- src/xrGame/mixed_delegate.h | 2 +- src/xrGame/patrol_path_manager.cpp | 2 +- src/xrGame/patrol_path_manager.h | 2 +- src/xrGame/player_hud.cpp | 2 +- src/xrGame/player_hud_tune.cpp | 2 +- src/xrGame/saved_game_wrapper.cpp | 2 +- src/xrGame/script_entity.cpp | 2 +- src/xrGame/script_game_object3.cpp | 2 +- .../script_game_object_inventory_owner.cpp | 2 +- .../script_game_object_smart_covers.cpp | 2 +- src/xrGame/script_game_object_use.cpp | 2 +- src/xrGame/script_zone.cpp | 2 +- .../smart_cover_planner_target_selector.h | 2 +- src/xrGame/space_restrictor.cpp | 2 +- .../stalker_animation_manager_update.cpp | 2 +- src/xrGame/stalker_animation_script.cpp | 2 +- src/xrGame/string_table.cpp | 14 +- src/xrGame/string_table.h | 9 +- src/xrGame/trade.cpp | 2 +- src/xrGame/trade2.cpp | 2 +- src/xrGame/ui/ArtefactDetectorUI.cpp | 2 +- src/xrGame/ui/ArtefactDetectorUI.h | 2 +- src/xrGame/ui/ChangeWeatherDialog.cpp | 2 +- src/xrGame/ui/FactionState.h | 2 +- src/xrGame/ui/FractionState.h | 2 +- src/xrGame/ui/KillMessageStruct.h | 2 +- src/xrGame/ui/MMSound.cpp | 2 +- src/xrGame/ui/Restrictions.cpp | 2 +- src/xrGame/ui/ServerList.cpp | 41 +- src/xrGame/ui/ServerList.h | 12 +- src/xrGame/ui/TeamInfo.cpp | 8 +- src/xrGame/ui/UIAchievements.cpp | 10 +- src/xrGame/ui/UIAchievements.h | 2 +- src/xrGame/ui/UIActorMenu.cpp | 10 +- src/xrGame/ui/UIActorMenu.h | 4 +- src/xrGame/ui/UIActorMenuDeadBodySearch.cpp | 6 +- src/xrGame/ui/UIActorMenuInitialize.cpp | 22 +- src/xrGame/ui/UIActorMenuInventory.cpp | 20 +- src/xrGame/ui/UIActorMenuTrade.cpp | 8 +- src/xrGame/ui/UIActorMenuUpgrade.cpp | 2 +- src/xrGame/ui/UIActorMenu_action.cpp | 8 +- src/xrGame/ui/UIActorStateInfo.cpp | 12 +- src/xrGame/ui/UIActorStateInfo.h | 2 +- src/xrGame/ui/UIBoosterInfo.cpp | 12 +- src/xrGame/ui/UIBoosterInfo.h | 2 +- src/xrGame/ui/UIBuyWeaponTab.cpp | 2 +- src/xrGame/ui/UIBuyWeaponTab.h | 4 +- src/xrGame/ui/UICDkey.cpp | 22 +- src/xrGame/ui/UICDkey.h | 2 +- src/xrGame/ui/UICellCustomItems.cpp | 2 +- src/xrGame/ui/UICellItem.cpp | 4 +- src/xrGame/ui/UICellItem.h | 2 +- src/xrGame/ui/UIChangeMap.cpp | 10 +- src/xrGame/ui/UICharacterInfo.cpp | 6 +- src/xrGame/ui/UICharacterInfo.h | 2 +- src/xrGame/ui/UIChatWnd.cpp | 4 +- src/xrGame/ui/UIChatWnd.h | 2 +- src/xrGame/ui/UIDebugFonts.cpp | 4 +- src/xrGame/ui/UIDebugFonts.h | 2 +- src/xrGame/ui/UIDemoPlayControl.cpp | 34 +- src/xrGame/ui/UIDemoPlayControl.h | 2 +- src/xrGame/ui/UIDialogWnd.h | 2 +- src/xrGame/ui/UIDragDropListEx.cpp | 4 +- src/xrGame/ui/UIDragDropListEx.h | 4 +- src/xrGame/ui/UIDragDropReferenceList.cpp | 4 +- src/xrGame/ui/UIEditBox_script.cpp | 16 - src/xrGame/ui/UIEditKeyBind.h | 4 +- src/xrGame/ui/UIFactionWarWnd.cpp | 4 +- src/xrGame/ui/UIFactionWarWnd.h | 4 +- src/xrGame/ui/UIGameLog.cpp | 2 +- src/xrGame/ui/UIGameLog.h | 2 +- src/xrGame/ui/UIGameTutorial.cpp | 4 +- src/xrGame/ui/UIGameTutorialSimpleItem.cpp | 4 +- src/xrGame/ui/UIGameTutorialVideoItem.cpp | 6 +- src/xrGame/ui/UIHelper.cpp | 14 +- src/xrGame/ui/UIHudStatesWnd.cpp | 8 +- src/xrGame/ui/UIHudStatesWnd.h | 2 +- src/xrGame/ui/UIInvUpgrade.cpp | 4 +- src/xrGame/ui/UIInvUpgrade.h | 4 +- src/xrGame/ui/UIInvUpgradeInfo.cpp | 26 +- src/xrGame/ui/UIInvUpgradeInfo.h | 4 +- src/xrGame/ui/UIInvUpgradeProperty.cpp | 4 +- src/xrGame/ui/UIInvUpgradeProperty.h | 2 +- src/xrGame/ui/UIInventoryUpgradeWnd.cpp | 8 +- src/xrGame/ui/UIInventoryUpgradeWnd.h | 2 +- src/xrGame/ui/UIInventoryUpgradeWnd_add.cpp | 2 +- src/xrGame/ui/UIInventoryUtilities.cpp | 18 +- src/xrGame/ui/UIInventoryUtilities.h | 2 +- src/xrGame/ui/UIItemInfo.cpp | 12 +- src/xrGame/ui/UIItemInfo.h | 2 +- src/xrGame/ui/UIKeyBinding.cpp | 5 +- src/xrGame/ui/UIKeyBinding.h | 8 +- src/xrGame/ui/UIKickPlayer.cpp | 10 +- src/xrGame/ui/UIListItemServer.cpp | 8 +- src/xrGame/ui/UIListItemServer.h | 4 +- src/xrGame/ui/UILoadingScreen.h | 4 +- src/xrGame/ui/UILogsWnd.cpp | 16 +- src/xrGame/ui/UILogsWnd.h | 6 +- src/xrGame/ui/UIMMShniaga.cpp | 33 +- src/xrGame/ui/UIMMShniaga.h | 18 +- src/xrGame/ui/UIMPAdminMenu.cpp | 8 +- src/xrGame/ui/UIMPAdminMenu.h | 4 +- src/xrGame/ui/UIMPChangeMapAdm.cpp | 10 +- src/xrGame/ui/UIMPChangeMapAdm.h | 4 +- src/xrGame/ui/UIMPPlayersAdm.cpp | 14 +- src/xrGame/ui/UIMPPlayersAdm.h | 4 +- src/xrGame/ui/UIMPServerAdm.cpp | 8 +- src/xrGame/ui/UIMPServerAdm.h | 6 +- src/xrGame/ui/UIMainIngameWnd.cpp | 12 +- src/xrGame/ui/UIMap.h | 4 +- src/xrGame/ui/UIMapDesc.cpp | 8 +- src/xrGame/ui/UIMapInfo.cpp | 24 +- src/xrGame/ui/UIMapInfo.h | 2 +- src/xrGame/ui/UIMapLegend.cpp | 16 +- src/xrGame/ui/UIMapLegend.h | 2 +- src/xrGame/ui/UIMapList.cpp | 26 +- src/xrGame/ui/UIMapList.h | 2 +- src/xrGame/ui/UIMapWnd.cpp | 14 +- src/xrGame/ui/UIMapWnd.h | 4 +- src/xrGame/ui/UIMapWnd2.cpp | 2 +- src/xrGame/ui/UIMessageBoxEx.cpp | 2 +- src/xrGame/ui/UIMessageBoxEx.h | 2 +- src/xrGame/ui/UIMessagesWindow.cpp | 2 +- src/xrGame/ui/UIMessagesWindow.h | 2 +- src/xrGame/ui/UIMoneyIndicator.cpp | 2 +- src/xrGame/ui/UIMoneyIndicator.h | 2 +- src/xrGame/ui/UIMotionIcon.h | 4 +- src/xrGame/ui/UIMpTradeWnd.cpp | 2 +- src/xrGame/ui/UIMpTradeWnd.h | 2 +- src/xrGame/ui/UIMpTradeWnd_init.cpp | 2 +- src/xrGame/ui/UIMpTradeWnd_items.cpp | 2 +- src/xrGame/ui/UIMpTradeWnd_misc.cpp | 4 +- src/xrGame/ui/UIMpTradeWnd_trade.cpp | 20 +- src/xrGame/ui/UINewsItemWnd.cpp | 2 +- src/xrGame/ui/UINewsItemWnd.h | 4 +- src/xrGame/ui/UIOptionsManagerScript.h | 15 - src/xrGame/ui/UIOutfitInfo.cpp | 4 +- src/xrGame/ui/UIOutfitInfo.h | 4 +- src/xrGame/ui/UIPdaKillMessage.h | 2 +- src/xrGame/ui/UIPdaMsgListItem.cpp | 2 +- src/xrGame/ui/UIPdaMsgListItem.h | 2 +- src/xrGame/ui/UIPdaWnd.cpp | 18 +- src/xrGame/ui/UIProgressBar_script.cpp | 15 - src/xrGame/ui/UIRankIndicator.cpp | 2 +- src/xrGame/ui/UIRankIndicator.h | 2 +- src/xrGame/ui/UIRankingWnd.cpp | 12 +- src/xrGame/ui/UIRankingWnd.h | 5 +- src/xrGame/ui/UIScriptWnd.cpp | 2 +- src/xrGame/ui/UISecondTaskWnd.cpp | 18 +- src/xrGame/ui/UISecondTaskWnd.h | 4 +- src/xrGame/ui/UIServerInfo.cpp | 8 +- src/xrGame/ui/UIServerInfo.h | 2 +- src/xrGame/ui/UISkinSelector.cpp | 6 +- src/xrGame/ui/UISleepStatic.cpp | 66 + src/xrGame/ui/UISleepStatic.h | 17 + src/xrGame/ui/UISpawnWnd.cpp | 6 +- src/xrGame/ui/UISpeechMenu.cpp | 6 +- src/xrGame/ui/UIStatix.h | 2 +- src/xrGame/ui/UIStats.cpp | 4 +- src/xrGame/ui/UIStats.h | 2 +- src/xrGame/ui/UIStatsIcon.cpp | 2 +- src/xrGame/ui/UIStatsIcon.h | 2 +- src/xrGame/ui/UIStatsPlayerInfo.cpp | 5 +- src/xrGame/ui/UIStatsPlayerInfo.h | 2 +- src/xrGame/ui/UIStatsPlayerList.cpp | 11 +- src/xrGame/ui/UIStatsPlayerList.h | 2 +- src/xrGame/ui/UITabButtonMP.h | 2 +- src/xrGame/ui/UITalkDialogWnd.cpp | 8 +- src/xrGame/ui/UITalkDialogWnd.h | 8 +- src/xrGame/ui/UITalkWnd.cpp | 7 +- src/xrGame/ui/UITalkWnd.h | 8 +- src/xrGame/ui/UITaskWnd.cpp | 10 +- src/xrGame/ui/UITaskWnd.h | 6 +- src/xrGame/ui/UITextVote.cpp | 2 +- src/xrGame/ui/UIVote.cpp | 8 +- src/xrGame/ui/UIVoteStatusWnd.cpp | 2 +- src/xrGame/ui/UIVoteStatusWnd.h | 2 +- src/xrGame/ui/UIVotingCategory.cpp | 2 +- src/xrGame/ui/UIWarState.cpp | 2 +- src/xrGame/ui/UIWarState.h | 2 +- src/xrGame/ui/UIWindow_script.cpp | 195 +-- src/xrGame/ui/UIWpnParams.h | 5 +- src/xrGame/ui/UIXmlInit.cpp | 1129 +-------------- src/xrGame/ui/UIXmlInit.h | 50 +- src/xrGame/ui/map_hint.cpp | 4 +- src/xrGame/ui/map_hint.h | 2 +- src/xrGame/ui/ui_af_params.cpp | 10 +- src/xrGame/ui/ui_af_params.h | 2 +- src/xrGame/ui/uiscriptwnd_script2.cpp | 22 +- src/xrGame/ui/xrUIXmlParser.cpp | 77 -- src/xrGame/ui_export_script.cpp | 9 - src/xrGame/xrGame.cpp | 5 +- src/xrGame/xrGame.vcxproj | 151 +- src/xrGame/xrGame.vcxproj.filters | 402 +----- src/xrGame/xrServer.cpp | 2 +- src/xrGame/xr_level_controller.cpp | 488 +------ src/xrGame/xr_level_controller.h | 132 +- src/xrGame/xrgame_dll_detach.cpp | 23 +- .../script_callback_ex.h | 2 - src/xrScriptEngine/xrScriptEngine.vcxproj | 1 + .../xrScriptEngine.vcxproj.filters | 9 + src/xrServerEntities/character_info.cpp | 4 +- src/xrServerEntities/smart_cast.cpp | 2 +- src/xrServerEntities/specific_character.cpp | 2 +- src/xrServerEntities/xml_str_id_loader.h | 4 +- .../xrServer_Objects_ALife_Monsters.cpp | 6 +- .../ui => xrUICore/Buttons}/UI3tButton.cpp | 5 +- .../ui => xrUICore/Buttons}/UI3tButton.h | 8 +- .../ui => xrUICore/Buttons}/UIBtnHint.cpp | 19 +- .../ui => xrUICore/Buttons}/UIBtnHint.h | 8 +- .../ui => xrUICore/Buttons}/UIButton.cpp | 8 +- .../ui => xrUICore/Buttons}/UIButton.h | 5 +- .../Buttons}/UIButton_script.cpp | 9 +- .../ui => xrUICore/Buttons}/UICheckButton.cpp | 10 +- .../ui => xrUICore/Buttons}/UICheckButton.h | 7 +- .../ui => xrUICore/Buttons}/UIRadioButton.cpp | 6 +- .../ui => xrUICore/Buttons}/UIRadioButton.h | 4 +- src/xrUICore/CMakeLists.txt | 79 ++ .../Callbacks}/UIWndCallback.cpp | 4 +- .../ui => xrUICore/Callbacks}/UIWndCallback.h | 2 +- .../Callbacks}/callback_info.h | 7 +- .../ui => xrUICore/ComboBox}/UIComboBox.cpp | 39 +- .../ui => xrUICore/ComboBox}/UIComboBox.h | 15 +- .../ComboBox}/UIComboBox_script.cpp | 4 +- src/{xrGame => xrUICore/Cursor}/UICursor.cpp | 8 +- src/{xrGame => xrUICore/Cursor}/UICursor.h | 3 +- .../ui => xrUICore/EditBox}/UICustomEdit.cpp | 6 +- .../ui => xrUICore/EditBox}/UICustomEdit.h | 6 +- .../ui => xrUICore/EditBox}/UIEditBox.cpp | 6 +- .../ui => xrUICore/EditBox}/UIEditBox.h | 6 +- .../ui => xrUICore/EditBox}/UIEditBoxEx.cpp | 5 +- .../ui => xrUICore/EditBox}/UIEditBoxEx.h | 5 +- src/xrUICore/EditBox/UIEditBox_script.cpp | 20 + src/xrUICore/FontManager/FontManager.cpp | 101 ++ src/xrUICore/FontManager/FontManager.h | 33 + src/{xrGame/ui => xrUICore/Hint}/UIHint.cpp | 31 +- src/{xrGame/ui => xrUICore/Hint}/UIHint.h | 6 +- .../UIInteractiveBackground.h | 6 +- .../InteractiveBackground}/UI_IB_Static.cpp | 2 +- .../InteractiveBackground}/UI_IB_Static.h | 5 +- src/{xrGame/ui => xrUICore/Lines}/UILine.cpp | 50 +- src/{xrGame/ui => xrUICore/Lines}/UILine.h | 1 - src/{xrGame/ui => xrUICore/Lines}/UILines.cpp | 13 +- src/{xrGame/ui => xrUICore/Lines}/UILines.h | 10 +- .../ui => xrUICore/Lines}/UISubLine.cpp | 49 +- src/{xrGame/ui => xrUICore/Lines}/UISubLine.h | 0 src/{xrGame/ui => xrUICore/Lines}/uilinestd.h | 1 - .../ui => xrUICore/ListBox}/UIListBox.cpp | 10 +- .../ui => xrUICore/ListBox}/UIListBox.h | 5 +- .../ui => xrUICore/ListBox}/UIListBoxItem.cpp | 7 +- .../ui => xrUICore/ListBox}/UIListBoxItem.h | 4 +- .../ListBox}/UIListBoxItemMsgChain.cpp | 3 +- .../ListBox}/UIListBoxItemMsgChain.h | 0 src/xrUICore/ListBox/UIListBox_script.cpp | 77 ++ .../MessageBox}/UIMessageBox.cpp | 11 +- .../ui => xrUICore/MessageBox}/UIMessageBox.h | 5 +- .../MessageBox}/UIMessageBox_script.cpp | 12 +- .../ui => xrUICore/Options}/UIOptionsItem.cpp | 2 +- .../ui => xrUICore/Options}/UIOptionsItem.h | 12 +- .../Options}/UIOptionsManager.cpp | 2 +- .../Options}/UIOptionsManager.h | 2 +- .../Options}/UIOptionsManagerScript.cpp | 13 +- src/xrUICore/Options/UIOptionsManagerScript.h | 14 + .../ProgressBar}/UIDoubleProgressBar.cpp | 14 +- .../ProgressBar}/UIDoubleProgressBar.h | 8 +- .../ProgressBar}/UIProgressBar.cpp | 11 +- .../ProgressBar}/UIProgressBar.h | 9 +- .../ProgressBar/UIProgressBar_script.cpp | 19 + .../ProgressBar}/UIProgressShape.cpp | 10 +- .../ProgressBar}/UIProgressShape.h | 6 +- .../PropertiesBox}/UIPropertiesBox.cpp | 9 +- .../PropertiesBox}/UIPropertiesBox.h | 7 +- .../PropertiesBox}/UIPropertiesBox_script.cpp | 4 +- .../ScrollBar}/UIFixedScrollBar.cpp | 28 +- .../ScrollBar}/UIFixedScrollBar.h | 2 +- .../ui => xrUICore/ScrollBar}/UIScrollBar.cpp | 24 +- .../ui => xrUICore/ScrollBar}/UIScrollBar.h | 4 +- .../ui => xrUICore/ScrollBar}/UIScrollBox.cpp | 4 +- .../ui => xrUICore/ScrollBar}/UIScrollBox.h | 2 +- .../ScrollView}/UIScrollView.cpp | 8 +- .../ui => xrUICore/ScrollView}/UIScrollView.h | 10 +- .../ui => xrUICore/SpinBox}/UICustomSpin.cpp | 8 +- .../ui => xrUICore/SpinBox}/UICustomSpin.h | 6 +- .../ui => xrUICore/SpinBox}/UISpinNum.cpp | 8 +- .../ui => xrUICore/SpinBox}/UISpinNum.h | 6 +- .../ui => xrUICore/SpinBox}/UISpinText.cpp | 11 +- .../ui => xrUICore/SpinBox}/UISpinText.h | 4 +- .../Static}/UIAnimatedStatic.cpp | 69 +- .../ui => xrUICore/Static}/UIAnimatedStatic.h | 23 +- .../Static}/UILanimController.cpp | 2 +- .../Static}/UILanimController.h | 4 +- .../ui => xrUICore/Static}/UIStatic.cpp | 18 +- src/{xrGame/ui => xrUICore/Static}/UIStatic.h | 14 +- .../Static}/UIStaticItem.cpp | 7 +- .../Static}/UIStaticItem.h | 4 +- .../Static}/UIStatic_script.cpp | 5 +- .../TabControl}/UITabButton.cpp | 3 +- .../ui => xrUICore/TabControl}/UITabButton.h | 4 +- .../TabControl}/UITabControl.cpp | 4 +- .../ui => xrUICore/TabControl}/UITabControl.h | 8 +- .../TabControl}/UITabControl_script.cpp | 2 +- .../ui => xrUICore/TrackBar}/UITrackBar.cpp | 10 +- .../ui => xrUICore/TrackBar}/UITrackBar.h | 7 +- src/{xrGame/ui => xrUICore}/UIMessages.h | 0 .../Windows}/UIFrameLineWnd.cpp | 4 +- .../ui => xrUICore/Windows}/UIFrameLineWnd.h | 3 +- .../ui => xrUICore/Windows}/UIFrameWindow.cpp | 7 +- .../ui => xrUICore/Windows}/UIFrameWindow.h | 4 +- .../ui => xrUICore/Windows}/UIWindow.cpp | 82 +- .../ui => xrUICore/Windows}/UIWindow.h | 15 +- src/xrUICore/Windows/UIWindow_script.cpp | 186 +++ .../ui => xrUICore/XML}/UITextureMaster.cpp | 4 +- .../ui => xrUICore/XML}/UITextureMaster.h | 4 +- src/xrUICore/XML/UIXmlInitBase.cpp | 1215 +++++++++++++++++ src/xrUICore/XML/UIXmlInitBase.h | 94 ++ src/xrUICore/XML/xrUIXmlParser.cpp | 26 + .../ui => xrUICore/XML}/xrUIXmlParser.h | 2 +- .../ui => xrUICore/arrow}/ui_arrow.cpp | 9 +- src/{xrGame/ui => xrUICore/arrow}/ui_arrow.h | 10 +- src/xrUICore/packages.config | 5 + src/xrUICore/pch.cpp | 1 + src/xrUICore/pch.hpp | 9 + src/{xrGame => xrUICore}/ui_base.cpp | 11 +- src/{xrGame => xrUICore}/ui_base.h | 41 +- src/{xrGame => xrUICore}/ui_defs.h | 2 +- src/{xrGame/ui => xrUICore}/uiabstract.h | 1 - src/xrUICore/xrUICore.vcxproj | 392 ++++++ src/xrUICore/xrUICore.vcxproj.filters | 431 ++++++ 457 files changed, 4850 insertions(+), 4313 deletions(-) create mode 100644 res/gamedata/configs/localization.ltx create mode 100644 src/xrEngine/StringTable/IStringTable.cpp create mode 100644 src/xrEngine/StringTable/IStringTable.h rename src/{xrGame/string_table_defs.h => xrEngine/StringTable/IStringTableDefs.h} (59%) create mode 100644 src/xrEngine/xr_input_xinput.cpp create mode 100644 src/xrEngine/xr_input_xinput.h delete mode 100644 src/xrGame/ui/UIEditBox_script.cpp delete mode 100644 src/xrGame/ui/UIOptionsManagerScript.h delete mode 100644 src/xrGame/ui/UIProgressBar_script.cpp create mode 100644 src/xrGame/ui/UISleepStatic.cpp create mode 100644 src/xrGame/ui/UISleepStatic.h delete mode 100644 src/xrGame/ui/xrUIXmlParser.cpp rename src/{xrGame => xrScriptEngine}/script_callback_ex.h (99%) rename src/{xrGame/ui => xrUICore/Buttons}/UI3tButton.cpp (99%) rename src/{xrGame/ui => xrUICore/Buttons}/UI3tButton.h (88%) rename src/{xrGame/ui => xrUICore/Buttons}/UIBtnHint.cpp (76%) rename src/{xrGame/ui => xrUICore/Buttons}/UIBtnHint.h (66%) rename src/{xrGame/ui => xrUICore/Buttons}/UIButton.cpp (97%) rename src/{xrGame/ui => xrUICore/Buttons}/UIButton.h (95%) rename src/{xrGame/ui => xrUICore/Buttons}/UIButton_script.cpp (92%) rename src/{xrGame/ui => xrUICore/Buttons}/UICheckButton.cpp (93%) rename src/{xrGame/ui => xrUICore/Buttons}/UICheckButton.h (87%) rename src/{xrGame/ui => xrUICore/Buttons}/UIRadioButton.cpp (89%) rename src/{xrGame/ui => xrUICore/Buttons}/UIRadioButton.h (85%) create mode 100644 src/xrUICore/CMakeLists.txt rename src/{xrGame/ui => xrUICore/Callbacks}/UIWndCallback.cpp (96%) rename src/{xrGame/ui => xrUICore/Callbacks}/UIWndCallback.h (95%) rename src/{xrGame => xrUICore/Callbacks}/callback_info.h (78%) rename src/{xrGame/ui => xrUICore/ComboBox}/UIComboBox.cpp (92%) rename src/{xrGame/ui => xrUICore/ComboBox}/UIComboBox.h (83%) rename src/{xrGame/ui => xrUICore/ComboBox}/UIComboBox_script.cpp (95%) rename src/{xrGame => xrUICore/Cursor}/UICursor.cpp (97%) rename src/{xrGame => xrUICore/Cursor}/UICursor.h (85%) rename src/{xrGame/ui => xrUICore/EditBox}/UICustomEdit.cpp (99%) rename src/{xrGame/ui => xrUICore/EditBox}/UICustomEdit.h (95%) rename src/{xrGame/ui => xrUICore/EditBox}/UIEditBox.cpp (91%) rename src/{xrGame/ui => xrUICore/EditBox}/UIEditBox.h (79%) rename src/{xrGame/ui => xrUICore/EditBox}/UIEditBoxEx.cpp (92%) rename src/{xrGame/ui => xrUICore/EditBox}/UIEditBoxEx.h (77%) create mode 100644 src/xrUICore/EditBox/UIEditBox_script.cpp create mode 100644 src/xrUICore/FontManager/FontManager.cpp create mode 100644 src/xrUICore/FontManager/FontManager.h rename src/{xrGame/ui => xrUICore/Hint}/UIHint.cpp (80%) rename src/{xrGame/ui => xrUICore/Hint}/UIHint.h (93%) rename src/{xrGame/ui => xrUICore/InteractiveBackground}/UIInteractiveBackground.h (95%) rename src/{xrGame/ui => xrUICore/InteractiveBackground}/UI_IB_Static.cpp (96%) rename src/{xrGame/ui => xrUICore/InteractiveBackground}/UI_IB_Static.h (80%) rename src/{xrGame/ui => xrUICore/Lines}/UILine.cpp (73%) rename src/{xrGame/ui => xrUICore/Lines}/UILine.h (99%) rename src/{xrGame/ui => xrUICore/Lines}/UILines.cpp (97%) rename src/{xrGame/ui => xrUICore/Lines}/UILines.h (94%) rename src/{xrGame/ui => xrUICore/Lines}/UISubLine.cpp (52%) rename src/{xrGame/ui => xrUICore/Lines}/UISubLine.h (100%) rename src/{xrGame/ui => xrUICore/Lines}/uilinestd.h (79%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBox.cpp (97%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBox.h (93%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBoxItem.cpp (95%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBoxItem.h (86%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBoxItemMsgChain.cpp (76%) rename src/{xrGame/ui => xrUICore/ListBox}/UIListBoxItemMsgChain.h (100%) create mode 100644 src/xrUICore/ListBox/UIListBox_script.cpp rename src/{xrGame/ui => xrUICore/MessageBox}/UIMessageBox.cpp (98%) rename src/{xrGame/ui => xrUICore/MessageBox}/UIMessageBox.h (94%) rename src/{xrGame/ui => xrUICore/MessageBox}/UIMessageBox_script.cpp (51%) rename src/{xrGame/ui => xrUICore/Options}/UIOptionsItem.cpp (99%) rename src/{xrGame/ui => xrUICore/Options}/UIOptionsItem.h (79%) rename src/{xrGame/ui => xrUICore/Options}/UIOptionsManager.cpp (99%) rename src/{xrGame/ui => xrUICore/Options}/UIOptionsManager.h (97%) rename src/{xrGame/ui => xrUICore/Options}/UIOptionsManagerScript.cpp (76%) create mode 100644 src/xrUICore/Options/UIOptionsManagerScript.h rename src/{xrGame/ui => xrUICore/ProgressBar}/UIDoubleProgressBar.cpp (78%) rename src/{xrGame/ui => xrUICore/ProgressBar}/UIDoubleProgressBar.h (72%) rename src/{xrGame/ui => xrUICore/ProgressBar}/UIProgressBar.cpp (97%) rename src/{xrGame/ui => xrUICore/ProgressBar}/UIProgressBar.h (90%) create mode 100644 src/xrUICore/ProgressBar/UIProgressBar_script.cpp rename src/{xrGame/ui => xrUICore/ProgressBar}/UIProgressShape.cpp (96%) rename src/{xrGame/ui => xrUICore/ProgressBar}/UIProgressShape.h (75%) rename src/{xrGame/ui => xrUICore/PropertiesBox}/UIPropertiesBox.cpp (97%) rename src/{xrGame/ui => xrUICore/PropertiesBox}/UIPropertiesBox.h (89%) rename src/{xrGame/ui => xrUICore/PropertiesBox}/UIPropertiesBox_script.cpp (85%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIFixedScrollBar.cpp (93%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIFixedScrollBar.h (94%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIScrollBar.cpp (95%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIScrollBar.h (96%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIScrollBox.cpp (96%) rename src/{xrGame/ui => xrUICore/ScrollBar}/UIScrollBox.h (85%) rename src/{xrGame/ui => xrUICore/ScrollView}/UIScrollView.cpp (98%) rename src/{xrGame/ui => xrUICore/ScrollView}/UIScrollView.h (92%) rename src/{xrGame/ui => xrUICore/SpinBox}/UICustomSpin.cpp (97%) rename src/{xrGame/ui => xrUICore/SpinBox}/UICustomSpin.h (87%) rename src/{xrGame/ui => xrUICore/SpinBox}/UISpinNum.cpp (93%) rename src/{xrGame/ui => xrUICore/SpinBox}/UISpinNum.h (91%) rename src/{xrGame/ui => xrUICore/SpinBox}/UISpinText.cpp (90%) rename src/{xrGame/ui => xrUICore/SpinBox}/UISpinText.h (90%) rename src/{xrGame/ui => xrUICore/Static}/UIAnimatedStatic.cpp (54%) rename src/{xrGame/ui => xrUICore/Static}/UIAnimatedStatic.h (82%) rename src/{xrGame/ui => xrUICore/Static}/UILanimController.cpp (98%) rename src/{xrGame/ui => xrUICore/Static}/UILanimController.h (96%) rename src/{xrGame/ui => xrUICore/Static}/UIStatic.cpp (97%) rename src/{xrGame/ui => xrUICore/Static}/UIStatic.h (92%) rename src/{xrGame => xrUICore/Static}/UIStaticItem.cpp (97%) rename src/{xrGame => xrUICore/Static}/UIStaticItem.h (96%) rename src/{xrGame/ui => xrUICore/Static}/UIStatic_script.cpp (93%) rename src/{xrGame/ui => xrUICore/TabControl}/UITabButton.cpp (93%) rename src/{xrGame/ui => xrUICore/TabControl}/UITabButton.h (77%) rename src/{xrGame/ui => xrUICore/TabControl}/UITabControl.cpp (98%) rename src/{xrGame/ui => xrUICore/TabControl}/UITabControl.h (93%) rename src/{xrGame/ui => xrUICore/TabControl}/UITabControl_script.cpp (97%) rename src/{xrGame/ui => xrUICore/TrackBar}/UITrackBar.cpp (97%) rename src/{xrGame/ui => xrUICore/TrackBar}/UITrackBar.h (89%) rename src/{xrGame/ui => xrUICore}/UIMessages.h (100%) rename src/{xrGame/ui => xrUICore/Windows}/UIFrameLineWnd.cpp (99%) rename src/{xrGame/ui => xrUICore/Windows}/UIFrameLineWnd.h (95%) rename src/{xrGame/ui => xrUICore/Windows}/UIFrameWindow.cpp (98%) rename src/{xrGame/ui => xrUICore/Windows}/UIFrameWindow.h (92%) rename src/{xrGame/ui => xrUICore/Windows}/UIWindow.cpp (88%) rename src/{xrGame/ui => xrUICore/Windows}/UIWindow.h (94%) create mode 100644 src/xrUICore/Windows/UIWindow_script.cpp rename src/{xrGame/ui => xrUICore/XML}/UITextureMaster.cpp (98%) rename src/{xrGame/ui => xrUICore/XML}/UITextureMaster.h (96%) create mode 100644 src/xrUICore/XML/UIXmlInitBase.cpp create mode 100644 src/xrUICore/XML/UIXmlInitBase.h create mode 100644 src/xrUICore/XML/xrUIXmlParser.cpp rename src/{xrGame/ui => xrUICore/XML}/xrUIXmlParser.h (79%) rename src/{xrGame/ui => xrUICore/arrow}/ui_arrow.cpp (89%) rename src/{xrGame/ui => xrUICore/arrow}/ui_arrow.h (75%) create mode 100644 src/xrUICore/packages.config create mode 100644 src/xrUICore/pch.cpp create mode 100644 src/xrUICore/pch.hpp rename src/{xrGame => xrUICore}/ui_base.cpp (97%) rename src/{xrGame => xrUICore}/ui_base.h (66%) rename src/{xrGame => xrUICore}/ui_defs.h (97%) rename src/{xrGame/ui => xrUICore}/uiabstract.h (99%) create mode 100644 src/xrUICore/xrUICore.vcxproj create mode 100644 src/xrUICore/xrUICore.vcxproj.filters diff --git a/res/gamedata/configs/localization.ltx b/res/gamedata/configs/localization.ltx new file mode 100644 index 00000000000..eb8d571d7f2 --- /dev/null +++ b/res/gamedata/configs/localization.ltx @@ -0,0 +1,7 @@ +[string_table] +language = rus +font_prefix = ;_west ;_cent + +[Languages] +eng +rus \ No newline at end of file diff --git a/src/Common/CommonImportExport.inl b/src/Common/CommonImportExport.inl index f92b44275d9..b8d87e085ce 100644 --- a/src/Common/CommonImportExport.inl +++ b/src/Common/CommonImportExport.inl @@ -72,6 +72,12 @@ #define XRSOUND_API XR_IMPORT #endif +#ifdef XRUICORE_EXPORTS +#define XRUICORE_API XR_EXPORT +#else +#define XRUICORE_API XR_IMPORT +#endif + #ifndef ENGINE_API #ifndef NO_ENGINE_API #ifdef ENGINE_BUILD diff --git a/src/Include/xrAPI/xrAPI.h b/src/Include/xrAPI/xrAPI.h index 074eff88a05..babadad4e79 100644 --- a/src/Include/xrAPI/xrAPI.h +++ b/src/Include/xrAPI/xrAPI.h @@ -11,6 +11,7 @@ class CRender; class CScriptEngine; class AISpaceBase; class ISoundManager; +class ui_core; class XRAPI_API EngineGlobalEnvironment { @@ -27,6 +28,7 @@ class XRAPI_API EngineGlobalEnvironment CScriptEngine* ScriptEngine; AISpaceBase* AISpace; ISoundManager* Sound; + ui_core* UI; bool isEditor; bool isDedicatedServer; diff --git a/src/engine.sln b/src/engine.sln index c2355c4bd17..f9755cde474 100644 --- a/src/engine.sln +++ b/src/engine.sln @@ -248,6 +248,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrECore", "editors\xrECore\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrEditor", "editors\xrEditor\xrEditor.vcxproj", "{BE4B23E7-2CA8-4607-A473-116C4242F23D}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrUICore", "xrUICore\xrUICore.vcxproj", "{37B3642C-B706-4C93-BC54-BADADC8FC9B1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -1125,6 +1127,18 @@ Global {BE4B23E7-2CA8-4607-A473-116C4242F23D}.Release|x64.Build.0 = Release|x64 {BE4B23E7-2CA8-4607-A473-116C4242F23D}.Release|x86.ActiveCfg = Release|Win32 {BE4B23E7-2CA8-4607-A473-116C4242F23D}.Release|x86.Build.0 = Release|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Debug|x64.ActiveCfg = Debug|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Debug|x64.Build.0 = Debug|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Debug|x86.ActiveCfg = Debug|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Debug|x86.Build.0 = Debug|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Mixed|x64.ActiveCfg = Mixed|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Mixed|x64.Build.0 = Mixed|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Mixed|x86.ActiveCfg = Mixed|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Mixed|x86.Build.0 = Mixed|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Release|x64.ActiveCfg = Release|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Release|x64.Build.0 = Release|x64 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Release|x86.ActiveCfg = Release|Win32 + {37B3642C-B706-4C93-BC54-BADADC8FC9B1}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/utils/xrSE_Factory/xrUIXmlParser.cpp b/src/utils/xrSE_Factory/xrUIXmlParser.cpp index 3376a35b3cb..f18242be9b1 100644 --- a/src/utils/xrSE_Factory/xrUIXmlParser.cpp +++ b/src/utils/xrSE_Factory/xrUIXmlParser.cpp @@ -14,59 +14,9 @@ shared_str CUIXml::correct_file_name(pcstr path, pcstr fn) return fn; } -//#define LOG_ALL_XMLS -#ifdef LOG_ALL_XMLS -int ListXmlCount = 0; -struct DBGList_ -{ - int num; - bool closed; -}; -xr_vector dbg_list_xmls; -void dump_list_xmls() -{ - Msg("------Total xmls %d", dbg_list_xmls.size()); - xr_vector::iterator _it = dbg_list_xmls.begin(); - for (; _it != dbg_list_xmls.end(); ++_it) - if (!(*_it).closed) - Msg("--leak detected ---- xml = %d", (*_it).num); -} -#else -void dump_list_xmls() {} -#endif - CUIXml::CUIXml() { -#ifdef LOG_ALL_XMLS - ListXmlCount++; - m_dbg_id = ListXmlCount; - dbg_list_xmls.push_back(DBGList_()); - dbg_list_xmls.back().num = m_dbg_id; - dbg_list_xmls.back().closed = false; -#endif } CUIXml::~CUIXml() -{ -#ifdef LOG_ALL_XMLS - xr_vector::iterator _it = dbg_list_xmls.begin(); - bool bOK = false; - for (; _it != dbg_list_xmls.end(); ++_it) - { - if ((*_it).num == m_dbg_id && !(*_it).closed) - { - bOK = true; - (*_it).closed = true; - dbg_list_xmls.erase(_it); - break; - } - if ((*_it).num == m_dbg_id && (*_it).closed) - { - Msg("--XML [%d] already deleted", m_dbg_id); - bOK = true; - } - } - if (!bOK) - Msg("CUIXml::~CUIXml.[%d] cannot find xml in list", m_dbg_id); -#endif -} +{} diff --git a/src/xrEngine/StringTable/IStringTable.cpp b/src/xrEngine/StringTable/IStringTable.cpp new file mode 100644 index 00000000000..a5b15ce37ad --- /dev/null +++ b/src/xrEngine/StringTable/IStringTable.cpp @@ -0,0 +1,4 @@ +#include "stdafx.h" +#include "IStringTable.h" + +IStringTable* gStringTable = nullptr; diff --git a/src/xrEngine/StringTable/IStringTable.h b/src/xrEngine/StringTable/IStringTable.h new file mode 100644 index 00000000000..b5d455153b7 --- /dev/null +++ b/src/xrEngine/StringTable/IStringTable.h @@ -0,0 +1,18 @@ +////////////////////////////////////////////////////////////////////////// +// string_table.h: таблица строк, используемых в игре +////////////////////////////////////////////////////////////////////////// + +#pragma once +#include "xrEngine/StringTable/IStringTableDefs.h" +#include "xrCommon/xr_map.h" + +class IStringTable +{ +public: + virtual ~IStringTable() {}; + + virtual STRING_VALUE translate(const STRING_ID& str_id) const = 0; + virtual void rescan() = 0; +}; + +extern ENGINE_API IStringTable* gStringTable; diff --git a/src/xrGame/string_table_defs.h b/src/xrEngine/StringTable/IStringTableDefs.h similarity index 59% rename from src/xrGame/string_table_defs.h rename to src/xrEngine/StringTable/IStringTableDefs.h index aad68a952db..e6050ded88b 100644 --- a/src/xrGame/string_table_defs.h +++ b/src/xrEngine/StringTable/IStringTableDefs.h @@ -2,7 +2,4 @@ #include "xrCore/xrstring.h" typedef shared_str STRING_ID; -//. typedef int STRING_INDEX; typedef shared_str STRING_VALUE; - -//. #define NO_STRING STRING_INDEX(-1) diff --git a/src/xrEngine/xrEngine.vcxproj b/src/xrEngine/xrEngine.vcxproj index 733e663b6a7..db039ce103c 100644 --- a/src/xrEngine/xrEngine.vcxproj +++ b/src/xrEngine/xrEngine.vcxproj @@ -263,6 +263,8 @@ + + @@ -278,6 +280,7 @@ + @@ -372,6 +375,7 @@ Create + @@ -385,6 +389,7 @@ + diff --git a/src/xrEngine/xrEngine.vcxproj.filters b/src/xrEngine/xrEngine.vcxproj.filters index 195442660a3..e1cf0c3e893 100644 --- a/src/xrEngine/xrEngine.vcxproj.filters +++ b/src/xrEngine/xrEngine.vcxproj.filters @@ -232,6 +232,9 @@ {e4d34774-3a5b-468f-9400-12c702636fa1} + + {948b4643-0f42-4027-ac44-dbe3702887f4} + @@ -564,6 +567,15 @@ Rendering Device + + Interfaces\Input + + + Game API\StringTable + + + Game API\StringTable + @@ -881,6 +893,12 @@ Rendering Device + + Interfaces\Input + + + Game API\StringTable + diff --git a/src/xrEngine/xr_input_xinput.cpp b/src/xrEngine/xr_input_xinput.cpp new file mode 100644 index 00000000000..b92c97e4925 --- /dev/null +++ b/src/xrEngine/xr_input_xinput.cpp @@ -0,0 +1,518 @@ +#include "stdafx.h" +#include "xr_input_xinput.h" +#include "xr_input.h" +#include "StringTable/IStringTable.h" + +ENGINE_API _binding g_key_bindings[bindings_count]; +ENGINE_API _key_group g_current_keygroup = _sp; + +// clang-format off +_action actions[] = { + { "left", kLEFT, _both }, + { "right", kRIGHT, _both }, + { "up", kUP, _both }, + { "down", kDOWN, _both }, + { "jump", kJUMP, _both }, + { "crouch", kCROUCH, _both }, + { "accel", kACCEL, _both }, + { "sprint_toggle", kSPRINT_TOGGLE, _both }, + + { "forward", kFWD, _both }, + { "back", kBACK, _both }, + { "lstrafe", kL_STRAFE, _both }, + { "rstrafe", kR_STRAFE, _both }, + + { "llookout", kL_LOOKOUT, _both }, + { "rlookout", kR_LOOKOUT, _both }, + + { "cam_1", kCAM_1, _both }, + { "cam_2", kCAM_2, _both }, + { "cam_3", kCAM_3, _both }, + { "cam_zoom_in", kCAM_ZOOM_IN, _both }, + { "cam_zoom_out", kCAM_ZOOM_OUT, _both }, + + { "torch", kTORCH, _both }, + { "night_vision", kNIGHT_VISION, _both }, + { "show_detector", kDETECTOR, _sp }, + + { "wpn_1", kWPN_1, _both }, + { "wpn_2", kWPN_2, _both }, + { "wpn_3", kWPN_3, _both }, + { "wpn_4", kWPN_4, _both }, + { "wpn_5", kWPN_5, _both }, + { "wpn_6", kWPN_6, _both }, + { "artefact", kARTEFACT, _both /*_mp*/ }, + { "wpn_next", kWPN_NEXT, _both }, // means next ammo type + { "wpn_fire", kWPN_FIRE, _both }, + { "wpn_zoom", kWPN_ZOOM, _both }, + { "wpn_zoom_inc", kWPN_ZOOM_INC, _both }, + { "wpn_zoom_dec", kWPN_ZOOM_DEC, _both }, + { "wpn_reload", kWPN_RELOAD, _both }, + { "wpn_func", kWPN_FUNC, _both }, + { "wpn_firemode_prev", kWPN_FIREMODE_PREV, _both }, + { "wpn_firemode_next", kWPN_FIREMODE_NEXT, _both }, + + { "pause", kPAUSE, _both }, + { "drop", kDROP, _both }, + { "use", kUSE, _both }, + { "scores", kSCORES, _both }, + { "chat", kCHAT, _both }, + { "chat_team", kCHAT_TEAM, _both }, + { "screenshot", kSCREENSHOT, _both }, + { "quit", kQUIT, _both }, + { "console", kCONSOLE, _both }, + { "inventory", kINVENTORY, _both }, + { "buy_menu", kBUY, _both }, + { "skin_menu", kSKIN, _both }, + { "team_menu", kTEAM, _both }, + { "active_jobs", kACTIVE_JOBS, _sp }, + + { "vote_begin", kVOTE_BEGIN, _both }, + { "show_admin_menu", kSHOW_ADMIN_MENU, _both }, + { "vote", kVOTE, _both }, + { "vote_yes", kVOTEYES, _both }, + { "vote_no", kVOTENO, _both }, + + { "next_slot", kNEXT_SLOT, _both }, + { "prev_slot", kPREV_SLOT, _both }, + + { "speech_menu_0", kSPEECH_MENU_0, _both }, + { "speech_menu_1", kSPEECH_MENU_1, _both }, + + { "quick_use_1", kQUICK_USE_1, _both }, + { "quick_use_2", kQUICK_USE_2, _both }, + { "quick_use_3", kQUICK_USE_3, _both }, + { "quick_use_4", kQUICK_USE_4, _both }, + + { "quick_save", kQUICK_SAVE, _sp }, + { "quick_load", kQUICK_LOAD, _sp }, + //{ "alife_command", kALIFE_CMD, _sp}, + + { "custom1", kCUSTOM1, _sp }, + { "custom2", kCUSTOM2, _sp }, + { "custom3", kCUSTOM3, _sp }, + { "custom4", kCUSTOM4, _sp }, + { "custom5", kCUSTOM5, _sp }, + { "custom6", kCUSTOM6, _sp }, + { "custom7", kCUSTOM7, _sp }, + { "custom8", kCUSTOM8, _sp }, + { "custom9", kCUSTOM9, _sp }, + { "custom10", kCUSTOM10, _sp }, + { "custom11", kCUSTOM11, _sp }, + { "custom12", kCUSTOM12, _sp }, + { "custom13", kCUSTOM13, _sp }, + { "custom14", kCUSTOM14, _sp }, + { "custom15", kCUSTOM15, _sp }, + { "cam_autoaim", kCAM_AUTOAIM, _sp }, + { "pda_tab1", kPDA_TAB1, _sp }, + { "pda_tab2", kPDA_TAB2, _sp }, + { "pda_tab3", kPDA_TAB3, _sp }, + { "pda_tab4", kPDA_TAB4, _sp }, + { "pda_tab5", kPDA_TAB5, _sp }, + { "pda_tab6", kPDA_TAB6, _sp }, +#ifdef COC_KICK + { "kick", kKICK, _sp }, +#endif + + { nullptr, kLASTACTION, _both } +}; + +_keyboard keyboards[] = +{ + { "mouse1", MOUSE_1, "Mouse 1" }, + { "mouse2", MOUSE_2, "Mouse 2" }, + { "mouse3", MOUSE_3, "Mouse 3" }, + { "mouse4", MOUSE_4, "Mouse 4" }, + { "mouse5", MOUSE_5, "Mouse 5" }, + { "mouse6", MOUSE_6, "Mouse 6" }, + { "mouse7", MOUSE_7, "Mouse 7" }, + { "mouse8", MOUSE_8, "Mouse 8" }, + + { "kUNKNOWN", SDL_SCANCODE_UNKNOWN, "Unknown" }, + + { "kA", SDL_SCANCODE_A, "A" }, + { "kB", SDL_SCANCODE_B, "B" }, + { "kC", SDL_SCANCODE_C, "C" }, + { "kD", SDL_SCANCODE_D, "D" }, + { "kE", SDL_SCANCODE_E, "E" }, + { "kF", SDL_SCANCODE_F, "F" }, + { "kG", SDL_SCANCODE_G, "G" }, + { "kH", SDL_SCANCODE_H, "H" }, + { "kI", SDL_SCANCODE_I, "I" }, + { "kJ", SDL_SCANCODE_J, "J" }, + { "kK", SDL_SCANCODE_K, "K" }, + { "kL", SDL_SCANCODE_L, "L" }, + { "kM", SDL_SCANCODE_M, "M" }, + { "kN", SDL_SCANCODE_N, "N" }, + { "kO", SDL_SCANCODE_O, "O" }, + { "kP", SDL_SCANCODE_P, "P" }, + { "kQ", SDL_SCANCODE_Q, "Q" }, + { "kR", SDL_SCANCODE_R, "R" }, + { "kS", SDL_SCANCODE_S, "S" }, + { "kT", SDL_SCANCODE_T, "T" }, + { "kU", SDL_SCANCODE_U, "U" }, + { "kV", SDL_SCANCODE_V, "V" }, + { "kW", SDL_SCANCODE_W, "W" }, + { "kX", SDL_SCANCODE_X, "X" }, + { "kY", SDL_SCANCODE_Y, "Y" }, + { "kZ", SDL_SCANCODE_Z, "Z" }, + + { "k1", SDL_SCANCODE_1, "1" }, + { "k2", SDL_SCANCODE_2, "2" }, + { "k3", SDL_SCANCODE_3, "3" }, + { "k4", SDL_SCANCODE_4, "4" }, + { "k5", SDL_SCANCODE_5, "5" }, + { "k6", SDL_SCANCODE_6, "6" }, + { "k7", SDL_SCANCODE_7, "7" }, + { "k8", SDL_SCANCODE_8, "8" }, + { "k9", SDL_SCANCODE_9, "9" }, + { "k0", SDL_SCANCODE_0, "0" }, + + { "kRETURN", SDL_SCANCODE_RETURN, "Return" }, + { "kESCAPE", SDL_SCANCODE_ESCAPE, "Escape" }, + { "kBACK", SDL_SCANCODE_BACKSPACE, "Backspace" }, + { "kTAB", SDL_SCANCODE_TAB, "Tab" }, + { "kSPACE", SDL_SCANCODE_SPACE, "Space" }, + + { "kMINUS", SDL_SCANCODE_MINUS, "Minus" }, + { "kEQUALS", SDL_SCANCODE_EQUALS, "Equals" }, + { "kLBRACKET", SDL_SCANCODE_LEFTBRACKET, "Left bracket" }, + { "kRBRACKET", SDL_SCANCODE_RIGHTBRACKET, "Right bracket" }, + { "kBACKSLASH", SDL_SCANCODE_BACKSLASH, "Backslash" }, + { "kNONUSHASH", SDL_SCANCODE_NONUSHASH, "Non US Hash" }, + + { "kSEMICOLON", SDL_SCANCODE_SEMICOLON, "Semicolon" }, + { "kAPOSTROPHE", SDL_SCANCODE_APOSTROPHE, "Apostrophe" }, + { "kGRAVE", SDL_SCANCODE_GRAVE, "Grave" }, + { "kCOMMA", SDL_SCANCODE_COMMA, "Comma" }, + { "kPERIOD", SDL_SCANCODE_PERIOD, "Period" }, + { "kSLASH", SDL_SCANCODE_SLASH, "Slash" }, + + { "kCAPITAL", SDL_SCANCODE_CAPSLOCK, "Caps Lock" }, + + { "kF1", SDL_SCANCODE_F1, "F1" }, + { "kF2", SDL_SCANCODE_F2, "F2" }, + { "kF3", SDL_SCANCODE_F3, "F3" }, + { "kF4", SDL_SCANCODE_F4, "F4" }, + { "kF5", SDL_SCANCODE_F5, "F5" }, + { "kF6", SDL_SCANCODE_F6, "F6" }, + { "kF7", SDL_SCANCODE_F7, "F7" }, + { "kF8", SDL_SCANCODE_F8, "F8" }, + { "kF9", SDL_SCANCODE_F9, "F9" }, + { "kF10", SDL_SCANCODE_F10, "F10" }, + { "kF11", SDL_SCANCODE_F11, "F11" }, + { "kF12", SDL_SCANCODE_F12, "F12" }, + + { "kPRINTSCREEN", SDL_SCANCODE_PRINTSCREEN, "Print Screen" }, + { "kSCROLL", SDL_SCANCODE_SCROLLLOCK, "Scroll Lock" }, + { "kPAUSE", SDL_SCANCODE_PAUSE, "Pause" }, + { "kINSERT", SDL_SCANCODE_INSERT, "Insert" }, + + { "kHOME", SDL_SCANCODE_HOME, "Home" }, + { "kPGUP", SDL_SCANCODE_PAGEUP, "Page Up" }, + { "kDELETE", SDL_SCANCODE_DELETE, "Delete" }, + { "kEND", SDL_SCANCODE_END, "End" }, + { "kPGDN", SDL_SCANCODE_PAGEDOWN, "Page Down" }, + + { "kRIGHT", SDL_SCANCODE_RIGHT, "Right" }, + { "kLEFT", SDL_SCANCODE_LEFT, "Left" }, + { "kDOWN", SDL_SCANCODE_DOWN, "Down" }, + { "kUP", SDL_SCANCODE_UP, "Up" }, + + { "kNUMLOCK", SDL_SCANCODE_NUMLOCKCLEAR, "Num Lock" }, + + { "kDIVIDE", SDL_SCANCODE_KP_DIVIDE, "Numpad Divide" }, + { "kMULTIPLY", SDL_SCANCODE_KP_MULTIPLY, "Numpad Multiply" }, + { "kSUBTRACT", SDL_SCANCODE_KP_MINUS, "Numpad Minus" }, + { "kADD", SDL_SCANCODE_KP_PLUS, "Numpad Plus" }, + { "kNUMPADENTER", SDL_SCANCODE_KP_ENTER, "Numpad Enter" }, + + { "kNUMPAD1", SDL_SCANCODE_KP_1, "Numpad 1" }, + { "kNUMPAD2", SDL_SCANCODE_KP_2, "Numpad 2" }, + { "kNUMPAD3", SDL_SCANCODE_KP_3, "Numpad 3" }, + { "kNUMPAD4", SDL_SCANCODE_KP_4, "Numpad 4" }, + { "kNUMPAD5", SDL_SCANCODE_KP_5, "Numpad 5" }, + { "kNUMPAD6", SDL_SCANCODE_KP_6, "Numpad 6" }, + { "kNUMPAD7", SDL_SCANCODE_KP_7, "Numpad 7" }, + { "kNUMPAD8", SDL_SCANCODE_KP_8, "Numpad 8" }, + { "kNUMPAD9", SDL_SCANCODE_KP_9, "Numpad 9" }, + { "kNUMPAD0", SDL_SCANCODE_KP_0, "Numpad 0" }, + + { "kNUMPADPERIOD", SDL_SCANCODE_KP_PERIOD, "Numpad Period" }, + { "kNONUSBACKSLASH", SDL_SCANCODE_NONUSBACKSLASH, "Non US Backslash" }, + { "kAPPLICATION", SDL_SCANCODE_APPLICATION, "Application" }, + { "kPOWER", SDL_SCANCODE_POWER, "Power" }, + { "kNUMPADEQUALS", SDL_SCANCODE_KP_EQUALS, "Numpad Equals" }, + + { "kF13", SDL_SCANCODE_F13, "F13" }, + { "kF14", SDL_SCANCODE_F14, "F14" }, + { "kF15", SDL_SCANCODE_F15, "F15" }, + { "kF16", SDL_SCANCODE_F16, "F16" }, + { "kF17", SDL_SCANCODE_F17, "F17" }, + { "kF18", SDL_SCANCODE_F18, "F18" }, + { "kF19", SDL_SCANCODE_F19, "F19" }, + { "kF20", SDL_SCANCODE_F20, "F20" }, + { "kF21", SDL_SCANCODE_F21, "F21" }, + { "kF22", SDL_SCANCODE_F22, "F22" }, + { "kF23", SDL_SCANCODE_F23, "F23" }, + { "kF24", SDL_SCANCODE_F24, "F24" }, + + { "kEXECUTE", SDL_SCANCODE_EXECUTE, "Execute" }, + { "kHELP", SDL_SCANCODE_HELP, "Help" }, + { "kMENU", SDL_SCANCODE_MENU, "Menu" }, + + { "kSELECT", SDL_SCANCODE_SELECT, "Select" }, + { "kSTOP", SDL_SCANCODE_STOP, "Stop" }, + + { "kREDO", SDL_SCANCODE_AGAIN, "Redo" }, + { "kUNDO", SDL_SCANCODE_UNDO, "Undo" }, + + { "kCUT", SDL_SCANCODE_CUT, "Cut" }, + { "kCOPY", SDL_SCANCODE_COPY, "Copy" }, + { "kPASTE", SDL_SCANCODE_PASTE, "Paste" }, + + { "kFIND", SDL_SCANCODE_FIND, "Find" }, + + { "kMUTE", SDL_SCANCODE_MUTE, "Mute" }, + { "kVOLUMEUP", SDL_SCANCODE_VOLUMEUP, "Volume Up" }, + { "kVOLUMEDOWN", SDL_SCANCODE_VOLUMEDOWN, "Volume Down" }, + + { "kNUMPADCOMMA", SDL_SCANCODE_KP_COMMA, "Numpad Comma" }, + { "kNUMPADEQUALSAS400", SDL_SCANCODE_KP_EQUALSAS400, "Equals AS400" }, + + { "kINTERNATIONAL1", SDL_SCANCODE_INTERNATIONAL1 /* Give a better name? */ }, + { "kINTERNATIONAL2", SDL_SCANCODE_INTERNATIONAL2 /* Give a better name? */ }, + { "kYEN", SDL_SCANCODE_INTERNATIONAL3, "Yen" }, + { "kINTERNATIONAL4", SDL_SCANCODE_INTERNATIONAL4 /* Give a better name? */ }, + { "kINTERNATIONAL5", SDL_SCANCODE_INTERNATIONAL5 /* Give a better name? */ }, + { "kINTERNATIONAL6", SDL_SCANCODE_INTERNATIONAL6 /* Give a better name? */ }, + { "kINTERNATIONAL7", SDL_SCANCODE_INTERNATIONAL7 /* Give a better name? */ }, + { "kINTERNATIONAL8", SDL_SCANCODE_INTERNATIONAL8 /* Give a better name? */ }, + { "kINTERNATIONAL9", SDL_SCANCODE_INTERNATIONAL9 /* Give a better name? */ }, + + { "kHANGUL", SDL_SCANCODE_LANG1, "Hangul" }, + { "kHANJA", SDL_SCANCODE_LANG2, "Hanja" }, + { "kKATAKANA", SDL_SCANCODE_LANG3, "Katakana" }, + { "kHIRAGANA", SDL_SCANCODE_LANG4, "Hiragana" }, + { "kZENHANKAKU", SDL_SCANCODE_LANG5, "Zen-Han-kaku" }, + { "kLANG6", SDL_SCANCODE_LANG6 /* Give a better name? */ }, + { "kLANG7", SDL_SCANCODE_LANG7 /* Give a better name? */ }, + { "kLANG8", SDL_SCANCODE_LANG8 /* Give a better name? */ }, + { "kLANG9", SDL_SCANCODE_LANG9 /* Give a better name? */ }, + + { "kALTERASE", SDL_SCANCODE_ALTERASE, "Alterase" }, + { "kCANCEL", SDL_SCANCODE_CANCEL, "Cancel" }, + { "kCLEAR", SDL_SCANCODE_CLEAR, "Clear" }, + { "kPRIOR", SDL_SCANCODE_PRIOR, "Prior" }, + { "kRETURN2", SDL_SCANCODE_RETURN2, "Return 2" }, + { "kSEPARATOR", SDL_SCANCODE_SEPARATOR, "Separator" }, + { "kOUT", SDL_SCANCODE_OUT, "Out" }, + { "kOPER", SDL_SCANCODE_OPER, "Oper" }, + { "kCLEARAGAIN", SDL_SCANCODE_CLEARAGAIN, "Clear Again" }, + { "kCRSEL", SDL_SCANCODE_CRSEL, "Crsel" }, + { "kEXSEL", SDL_SCANCODE_EXSEL, "Excel" }, + + { "kNUMPAD_00", SDL_SCANCODE_KP_00, "Numpad 00" }, + { "kNUMPAD_000", SDL_SCANCODE_KP_000, "Numpad 000" }, + { "kTHOUSANDSSEPARATOR", SDL_SCANCODE_THOUSANDSSEPARATOR, "Thousand Separator" }, + { "kDECIMALSEPARATOR", SDL_SCANCODE_DECIMALSEPARATOR, "Decimal Separator" }, + { "kCURRENCYUNIT", SDL_SCANCODE_CURRENCYUNIT, "Currency Unit" }, + { "kCURRENCYSUBUNIT", SDL_SCANCODE_CURRENCYSUBUNIT, "Currency Subunit" }, + { "kNUMPAD_LEFTPAREN", SDL_SCANCODE_KP_LEFTPAREN, "Numpad Left Paren" }, + { "kNUMPAD_RIGHTPAREN", SDL_SCANCODE_KP_RIGHTPAREN, "Numpad Right Paren" }, + { "kNUMPAD_LEFTBRACE", SDL_SCANCODE_KP_LEFTBRACE, "Numpad Left Brace" }, + { "kNUMPAD_RIGHTBRACE", SDL_SCANCODE_KP_RIGHTBRACE, "Numpad Right Brace" }, + { "kNUMPAD_TAB", SDL_SCANCODE_KP_TAB, "Numpad Tab" }, + { "kNUMPAD_BACKSPACE", SDL_SCANCODE_KP_BACKSPACE, "Numpad Backspace" }, + { "kNUMPAD_A", SDL_SCANCODE_KP_A, "Numpad A" }, + { "kNUMPAD_B", SDL_SCANCODE_KP_B, "Numpad B" }, + { "kNUMPAD_C", SDL_SCANCODE_KP_C, "Numpad C" }, + { "kNUMPAD_D", SDL_SCANCODE_KP_D, "Numpad D" }, + { "kNUMPAD_E", SDL_SCANCODE_KP_E, "Numpad E" }, + { "kNUMPAD_F", SDL_SCANCODE_KP_F, "Numpad F" }, + + { "kNUMPAD_XOR", SDL_SCANCODE_KP_XOR, "Numpad XOR" }, + + { "kNUMPAD_POWER", SDL_SCANCODE_KP_POWER, "Numpad Power" }, + { "kNUMPAD_PERCENT", SDL_SCANCODE_KP_PERCENT, "Numpad Percent" }, + + { "kNUMPAD_LESS", SDL_SCANCODE_KP_LESS, "Numpad Less" }, + { "kNUMPAD_GREATER", SDL_SCANCODE_KP_GREATER, "Numpad Greater" }, + + { "kNUMPAD_AMPERSAND", SDL_SCANCODE_KP_AMPERSAND, "Numpad Ampersand" }, + { "kNUMPAD_DBLAMPERSAND", SDL_SCANCODE_KP_DBLAMPERSAND, "Numpad Double Ampersand" }, + + { "kNUMPAD_VERTICALBAR", SDL_SCANCODE_KP_VERTICALBAR, "Numpad Vertical Bar" }, + { "kNUMPAD_DBLVERTICALBAR", SDL_SCANCODE_KP_DBLVERTICALBAR, "Numpad Double Vertical Bar" }, + + { "kNUMPAD_COLON", SDL_SCANCODE_KP_COLON, "Numpad Colon" }, + { "kNUMPAD_HASH", SDL_SCANCODE_KP_HASH, "Numpad Hash" }, + { "kNUMPAD_SPACE", SDL_SCANCODE_KP_SPACE, "Numpad Space" }, + { "kNUMPAD_AT", SDL_SCANCODE_KP_AT, "Numpad At" }, + { "kNUMPAD_EXCLAM", SDL_SCANCODE_KP_EXCLAM, "Numpad Exclam" }, + + { "kNUMPAD_MEMSTORE", SDL_SCANCODE_KP_MEMSTORE, "Numpad Mem Store" }, + { "kNUMPAD_MEMRECALL", SDL_SCANCODE_KP_MEMRECALL, "Numpad Mem Recall" }, + { "kNUMPAD_MEMCLEAR", SDL_SCANCODE_KP_MEMCLEAR, "Numpad Mem Clear" }, + { "kNUMPAD_MEMADD", SDL_SCANCODE_KP_MEMADD, "Numpad Mem Add" }, + { "kNUMPAD_MEMSUBTRACT", SDL_SCANCODE_KP_MEMSUBTRACT, "Numpad Mem Subtract" }, + { "kNUMPAD_MEMMULTIPLY", SDL_SCANCODE_KP_MEMMULTIPLY, "Numpad Mem Multiply" }, + { "kNUMPAD_MEMDIVIDE", SDL_SCANCODE_KP_MEMDIVIDE, "Numpad Mem Divide" }, + + { "kNUMPAD_PLUSMINUS", SDL_SCANCODE_KP_PLUSMINUS, "Numpad Plus-Minus" }, + { "kNUMPAD_CLEAR", SDL_SCANCODE_KP_CLEAR, "Numpad Clear" }, + { "kNUMPAD_CLEARENTRY", SDL_SCANCODE_KP_CLEARENTRY, "Numpad Clear Entry" }, + { "kNUMPAD_BINARY", SDL_SCANCODE_KP_BINARY, "Numpad Binary" }, + { "kNUMPAD_OCTAL", SDL_SCANCODE_KP_OCTAL, "Numpad Octal" }, + { "kNUMPAD_DECIMAL", SDL_SCANCODE_KP_DECIMAL, "Numpad Decimal" }, + { "kNUMPAD_HEXADECIMAL", SDL_SCANCODE_KP_HEXADECIMAL, "Numpad Hexadecimal" }, + + { "kLCONTROL", SDL_SCANCODE_LCTRL, "Left Ctrl" }, + { "kLSHIFT", SDL_SCANCODE_LSHIFT, "Left shift" }, + { "kLMENU", SDL_SCANCODE_LALT, "Left Alt" }, + { "kLWIN", SDL_SCANCODE_LGUI, "Left Windows" }, + { "kRCONTROL", SDL_SCANCODE_RCTRL, "Right Ctrl" }, + { "kRSHIFT", SDL_SCANCODE_RSHIFT, "Right Shift" }, + { "kRMENU", SDL_SCANCODE_RALT, "Right Alt" }, + { "kRWIN", SDL_SCANCODE_RGUI, "Right Windows" }, + + { "kMODE", SDL_SCANCODE_MODE, "Mode" }, + + { "kAUDIONEXT", SDL_SCANCODE_AUDIONEXT, "Audio Next" }, + { "kAUDIOPREV", SDL_SCANCODE_AUDIOPREV, "Audio Prev" }, + { "kAUDIOSTOP", SDL_SCANCODE_AUDIOSTOP, "Audio Stop" }, + { "kAUDIOPLAY", SDL_SCANCODE_AUDIOPLAY, "Audio Play" }, + { "kAUDIOMUTE", SDL_SCANCODE_AUDIOMUTE, "Audio Mute" }, + + { "kMEDIASELECT", SDL_SCANCODE_MEDIASELECT, "Media Select" }, + { "kWWW", SDL_SCANCODE_WWW, "WWW" }, + { "kMAIL", SDL_SCANCODE_MAIL, "Mail" }, + { "kCALCULATOR", SDL_SCANCODE_CALCULATOR, "Calculator" }, + { "kCOMPUTER", SDL_SCANCODE_COMPUTER, "My Computer" }, + + { "kNUMPAD_AC_SEARCH", SDL_SCANCODE_AC_SEARCH, "AC Search" }, + { "kNUMPAD_AC_HOME", SDL_SCANCODE_AC_HOME, "AC Home" }, + { "kNUMPAD_AC_BACK", SDL_SCANCODE_AC_BACK, "AC Back" }, + { "kNUMPAD_AC_FORWARD", SDL_SCANCODE_AC_FORWARD, "AC Forward" }, + { "kNUMPAD_AC_STOP", SDL_SCANCODE_AC_STOP, "AC Stop" }, + { "kNUMPAD_AC_REFRESH", SDL_SCANCODE_AC_REFRESH, "AC Refresh" }, + { "kNUMPAD_AC_BOOKMARKS", SDL_SCANCODE_AC_BOOKMARKS, "AC Bookmarks" }, + + { "kBRIGHTNESSDOWN", SDL_SCANCODE_BRIGHTNESSDOWN, "Brightness Down" }, + { "kBRIGHTNESSUP", SDL_SCANCODE_BRIGHTNESSUP, "Brightness Up" }, + { "kDISPLAYSWITCH", SDL_SCANCODE_DISPLAYSWITCH, "Display Switch" }, + + { "kKBDILLUMTOGGLE)", SDL_SCANCODE_KBDILLUMTOGGLE, "Illum Toogle" }, + { "kKBDILLUMDOWN", SDL_SCANCODE_KBDILLUMDOWN, "Illum Down" }, + { "kKBDILLUMUP", SDL_SCANCODE_KBDILLUMUP, "Illum Up" }, + + { "kEJECT", SDL_SCANCODE_EJECT, "Eject" }, + { "kSLEEP", SDL_SCANCODE_SLEEP, "Sleep" }, + + { "kAPP1", SDL_SCANCODE_APP1, "App 1" }, + { "kAPP2", SDL_SCANCODE_APP2, "App 2" }, + { nullptr, -1, "(null)" } +}; +// clang-format on + +EGameActions action_name_to_id(pcstr _name) +{ + _action* action = action_name_to_ptr(_name); + if (action) + return action->id; + else + return kNOTBINDED; +} + +_action* action_name_to_ptr(pcstr _name) +{ + int idx = 0; + while (actions[idx].action_name) + { + if (!xr_stricmp(_name, actions[idx].action_name)) + return &actions[idx]; + ++idx; + } + Msg("! [action_name_to_ptr] cant find corresponding 'id' for '%s'", _name); + return NULL; +} + +bool is_binded(EGameActions _action_id, int _dik) +{ + _binding* pbinding = &g_key_bindings[_action_id]; + if (pbinding->m_keyboard[0] && pbinding->m_keyboard[0]->dik == _dik) + return true; + + if (pbinding->m_keyboard[1] && pbinding->m_keyboard[1]->dik == _dik) + return true; + + return false; +} + +int get_action_dik(EGameActions _action_id, int idx) +{ + _binding* pbinding = &g_key_bindings[_action_id]; + + if (idx == -1) + { + if (pbinding->m_keyboard[0]) + return pbinding->m_keyboard[0]->dik; + + if (pbinding->m_keyboard[1]) + return pbinding->m_keyboard[1]->dik; + } + else + { + if (pbinding->m_keyboard[idx]) + return pbinding->m_keyboard[idx]->dik; + } + return SDL_SCANCODE_UNKNOWN; +} + +int keyname_to_dik(pcstr _name) +{ + _keyboard* _kb = keyname_to_ptr(_name); + return _kb->dik; +} + +_keyboard* keyname_to_ptr(pcstr _name) +{ + int idx = 0; + while (keyboards[idx].key_name) + { + _keyboard& kb = keyboards[idx]; + if (!xr_stricmp(_name, kb.key_name)) + return &keyboards[idx]; + ++idx; + } + + Msg("! [keyname_to_ptr] cant find corresponding '_keyboard' for keyname %s", _name); + return NULL; +} + +void GetActionAllBinding(LPCSTR _action, char* dst_buff, int dst_buff_sz) +{ + int action_id = action_name_to_id(_action); + _binding* pbinding = &g_key_bindings[action_id]; + + string128 prim; + string128 sec; + prim[0] = 0; + sec[0] = 0; + + if (pbinding->m_keyboard[0]) + { + xr_strcpy(prim, pbinding->m_keyboard[0]->key_local_name.c_str()); + } + if (pbinding->m_keyboard[1]) + { + xr_strcpy(sec, pbinding->m_keyboard[1]->key_local_name.c_str()); + } + if (NULL == pbinding->m_keyboard[0] && NULL == pbinding->m_keyboard[1]) + { + xr_sprintf(dst_buff, dst_buff_sz, "%s", gStringTable->translate("st_key_notbinded").c_str()); + } + else + xr_sprintf( + dst_buff, dst_buff_sz, "%s%s%s", prim[0] ? prim : "", (sec[0] && prim[0]) ? " , " : "", sec[0] ? sec : ""); +} diff --git a/src/xrEngine/xr_input_xinput.h b/src/xrEngine/xr_input_xinput.h new file mode 100644 index 00000000000..33850949945 --- /dev/null +++ b/src/xrEngine/xr_input_xinput.h @@ -0,0 +1,165 @@ +#pragma once +#include "xrCore/xrstring.h" +#include "xrCommon/xr_string.h" +#include "xrCommon/xr_map.h" +#include "xrEngine/xr_input.h" // Don't remove this include + +enum EGameActions +{ + kLEFT, + kRIGHT, + kUP, + kDOWN, + kJUMP, + kCROUCH, + kACCEL, + kSPRINT_TOGGLE, + + kFWD, + kBACK, + kL_STRAFE, + kR_STRAFE, + + kL_LOOKOUT, + kR_LOOKOUT, + + kCAM_1, + kCAM_2, + kCAM_3, + kCAM_ZOOM_IN, + kCAM_ZOOM_OUT, + + kTORCH, + kNIGHT_VISION, + kDETECTOR, + kWPN_1, + kWPN_2, + kWPN_3, + kWPN_4, + kWPN_5, + kWPN_6, + kARTEFACT, + kWPN_NEXT, + kWPN_FIRE, + kWPN_ZOOM, + kWPN_ZOOM_INC, + kWPN_ZOOM_DEC, + kWPN_RELOAD, + kWPN_FUNC, + kWPN_FIREMODE_PREV, + kWPN_FIREMODE_NEXT, + + kPAUSE, + kDROP, + kUSE, + kSCORES, + kCHAT, + kCHAT_TEAM, + kSCREENSHOT, + kQUIT, + kCONSOLE, + kINVENTORY, + kBUY, + kSKIN, + kTEAM, + kACTIVE_JOBS, + + kVOTE_BEGIN, + kSHOW_ADMIN_MENU, + kVOTE, + kVOTEYES, + kVOTENO, + + kNEXT_SLOT, + kPREV_SLOT, + + kSPEECH_MENU_0, + kSPEECH_MENU_1, + + kQUICK_USE_1, + kQUICK_USE_2, + kQUICK_USE_3, + kQUICK_USE_4, + + kQUICK_SAVE, + kQUICK_LOAD, + // kALIFE_CMD, + + kCUSTOM1, + kCUSTOM2, + kCUSTOM3, + kCUSTOM4, + kCUSTOM5, + kCUSTOM6, + kCUSTOM7, + kCUSTOM8, + kCUSTOM9, + kCUSTOM10, + kCUSTOM11, + kCUSTOM12, + kCUSTOM13, + kCUSTOM14, + kCUSTOM15, + + kCAM_AUTOAIM, + + kPDA_TAB1, + kPDA_TAB2, + kPDA_TAB3, + kPDA_TAB4, + kPDA_TAB5, + kPDA_TAB6, + +#ifdef COC_KICK + kKICK, // alpet: kick dynamic objects +#endif + + kLASTACTION, + kNOTBINDED, + kFORCEDWORD = u32(-1) +}; + +struct ENGINE_API _keyboard +{ + pcstr key_name; + int dik; + xr_string key_local_name; +}; +enum _key_group +{ + _both = (1 << 0), + _sp = _both | (1 << 1), + _mp = _both | (1 << 2), +}; + +extern ENGINE_API _key_group g_current_keygroup; + +struct ENGINE_API _action +{ + pcstr action_name; + EGameActions id; + _key_group key_group; +}; + +extern ENGINE_API _action actions[]; +extern ENGINE_API _keyboard keyboards[]; + +#define bindings_count kLASTACTION +struct ENGINE_API _binding +{ + _action* m_action; + _keyboard* m_keyboard[2]; +}; + +extern ENGINE_API _binding g_key_bindings[]; + +ENGINE_API EGameActions action_name_to_id(pcstr _name); +ENGINE_API _action* action_name_to_ptr(pcstr _name); + +ENGINE_API bool is_binded(EGameActions action_id, int dik); +ENGINE_API int get_action_dik(EGameActions action_id, int idx = -1); + +ENGINE_API int keyname_to_dik(pcstr _name); +ENGINE_API _keyboard* keyname_to_ptr(pcstr _name); + +ENGINE_API void GetActionAllBinding(LPCSTR action, char* dst_buff, int dst_buff_sz); diff --git a/src/xrGame/Actor.cpp b/src/xrGame/Actor.cpp index d2a560b05c6..51d417cd2b0 100644 --- a/src/xrGame/Actor.cpp +++ b/src/xrGame/Actor.cpp @@ -60,7 +60,7 @@ #include "actor_memory.h" #include "Script_Game_Object.h" #include "Game_Object_Space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "InventoryBox.h" #include "location_manager.h" #include "player_hud.h" @@ -433,7 +433,6 @@ void CActor::Load(LPCSTR section) m_AutoPickUp_AABB_Offset = READ_IF_EXISTS(pSettings, r_fvector3, section, "AutoPickUp_AABB_offs", Fvector().set(0, 0, 0)); - CStringTable string_table; m_sCharacterUseAction = "character_use"; m_sDeadCharacterUseAction = "dead_character_use"; m_sDeadCharacterUseOrDragAction = "dead_character_use_or_drag"; @@ -1339,7 +1338,7 @@ void CActor::shedule_Update(u32 DT) { if (m_pUsableObject && m_pUsableObject->tip_text()) { - m_sDefaultObjAction = CStringTable().translate(m_pUsableObject->tip_text()); + m_sDefaultObjAction = StringTable().translate(m_pUsableObject->tip_text()); } else { diff --git a/src/xrGame/Actor.h b/src/xrGame/Actor.h index 0f748333c09..b835f4cb214 100644 --- a/src/xrGame/Actor.h +++ b/src/xrGame/Actor.h @@ -13,7 +13,7 @@ #include "InventoryOwner.h" #include "xrEngine/StatGraph.h" #include "PhraseDialogManager.h" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" #include "step_manager.h" diff --git a/src/xrGame/ActorAnimation.cpp b/src/xrGame/ActorAnimation.cpp index 431fab03114..b470dd82656 100644 --- a/src/xrGame/ActorAnimation.cpp +++ b/src/xrGame/ActorAnimation.cpp @@ -8,7 +8,7 @@ #include "Level.h" #ifdef DEBUG #include "PHDebug.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "xrEngine/GameFont.h" #endif #include "hit.h" diff --git a/src/xrGame/ActorCondition.cpp b/src/xrGame/ActorCondition.cpp index 9b066c9770a..9c7332d5136 100644 --- a/src/xrGame/ActorCondition.cpp +++ b/src/xrGame/ActorCondition.cpp @@ -9,10 +9,10 @@ #include "autosave_manager.h" #include "xrserver.h" #include "ai_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "Common/object_broker.h" #include "weapon.h" @@ -20,7 +20,7 @@ #include "ai/monsters/basemonster/base_monster.h" #include "UIGameCustom.h" #include "ui/UIMainIngameWnd.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #define MAX_SATIETY 1.0f #define START_SATIETY 0.5f diff --git a/src/xrGame/ActorInput.cpp b/src/xrGame/ActorInput.cpp index dd133a62e09..ab9a22044e3 100644 --- a/src/xrGame/ActorInput.cpp +++ b/src/xrGame/ActorInput.cpp @@ -19,7 +19,7 @@ #include "actorcondition.h" #include "actor_input_handler.h" #include "string_table.h" -#include "UI/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UI/UIActorMenu.h" #include "UI/UIDragDropReferenceList.h" #include "CharacterPhysicsSupport.h" @@ -188,7 +188,7 @@ void CActor::IR_OnKeyboardPress(int cmd) StaticDrawableWrapper* _s = CurrentGameUI()->AddCustomStatic("item_used", true); string1024 str; - strconcat(sizeof(str), str, *CStringTable().translate("st_item_used"), ": ", itm->NameItem()); + strconcat(sizeof(str), str, *StringTable().translate("st_item_used"), ": ", itm->NameItem()); _s->wnd()->TextItemControl()->SetText(str); CurrentGameUI()->GetActorMenu().m_pQuickSlot->ReloadReferences(this); diff --git a/src/xrGame/ActorVehicle.cpp b/src/xrGame/ActorVehicle.cpp index 2c9593c05d9..4ed10b020d3 100644 --- a/src/xrGame/ActorVehicle.cpp +++ b/src/xrGame/ActorVehicle.cpp @@ -22,7 +22,7 @@ #include "pch_script.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" void CActor::attach_Vehicle(CHolderCustom* vehicle) diff --git a/src/xrGame/CustomDetector.cpp b/src/xrGame/CustomDetector.cpp index cdae5822091..55837e46e40 100644 --- a/src/xrGame/CustomDetector.cpp +++ b/src/xrGame/CustomDetector.cpp @@ -7,7 +7,7 @@ #include "map_manager.h" #include "ActorEffector.h" #include "actor.h" -#include "ui/UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "player_hud.h" #include "weapon.h" diff --git a/src/xrGame/DBG_Car.cpp b/src/xrGame/DBG_Car.cpp index 40bbdca23f8..915cfca3ecc 100644 --- a/src/xrGame/DBG_Car.cpp +++ b/src/xrGame/DBG_Car.cpp @@ -6,7 +6,7 @@ #include "PHDestroyable.h" #include "Car.h" #include "Level.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "xrEngine/GameFont.h" void CCar::InitDebug() diff --git a/src/xrGame/DestroyablePhysicsObject.cpp b/src/xrGame/DestroyablePhysicsObject.cpp index a27f089b2e6..e3a3a575c75 100644 --- a/src/xrGame/DestroyablePhysicsObject.cpp +++ b/src/xrGame/DestroyablePhysicsObject.cpp @@ -10,7 +10,7 @@ #include "Include/xrRender/Kinematics.h" #include "xrServer_Objects_ALife.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "xrPhysics/PhysicsShell.h" #ifdef DEBUG diff --git a/src/xrGame/EliteDetector.cpp b/src/xrGame/EliteDetector.cpp index 6ce47686ae9..4868ab2e7bc 100644 --- a/src/xrGame/EliteDetector.cpp +++ b/src/xrGame/EliteDetector.cpp @@ -3,8 +3,8 @@ #include "player_hud.h" #include "Include/xrRender/UIRender.h" #include "ui/UIXmlInit.h" -#include "ui/xrUIXmlParser.h" -#include "ui/UIStatic.h" +#include "xrUICore/XML/xrUIXmlParser.h" +#include "xrUICore/Static/UIStatic.h" #include "ui/ArtefactDetectorUI.h" CEliteDetector::CEliteDetector() { m_artefacts.m_af_rank = 3; } diff --git a/src/xrGame/GameObject.cpp b/src/xrGame/GameObject.cpp index b94c5abb8b8..d6cc011c1af 100644 --- a/src/xrGame/GameObject.cpp +++ b/src/xrGame/GameObject.cpp @@ -22,7 +22,7 @@ #include "ai_debug.h" #include "xrEngine/IGame_Level.h" #include "Level.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "xrPhysics/MathUtils.h" #include "game_cl_base_weapon_usage_statistic.h" #include "game_cl_mp.h" @@ -33,7 +33,7 @@ #include "animation_movement_controller.h" #include "xrEngine/xr_collide_form.h" #include "script_game_object.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "doors_door.h" #include "doors.h" diff --git a/src/xrGame/GamePersistent.cpp b/src/xrGame/GamePersistent.cpp index c0059cb0e6e..dbc5b5bd16f 100644 --- a/src/xrGame/GamePersistent.cpp +++ b/src/xrGame/GamePersistent.cpp @@ -6,7 +6,7 @@ #include "Include/xrRender/Kinematics.h" #include "xrEngine/profiler.h" #include "MainMenu.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "game_base_space.h" #include "Level.h" #include "ParticlesObject.h" @@ -18,7 +18,7 @@ #include "actor.h" #include "spectator.h" -#include "UI/UItextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" #include "xrEngine/xrSASH.h" #include "ai_space.h" @@ -116,9 +116,8 @@ CGamePersistent::CGamePersistent(void) ZeroMemory(ambient_sound_next_time, sizeof(ambient_sound_next_time)); - m_pUI_core = NULL; - m_pMainMenu = NULL; - m_intro = NULL; + m_pMainMenu = nullptr; + m_intro = nullptr; m_intro_event.bind(this, &CGamePersistent::start_logo_intro); #ifdef DEBUG m_frame_counter = 0; @@ -207,7 +206,7 @@ void CGamePersistent::OnAppStart() GMLib.Load(); init_game_globals(); inherited::OnAppStart(); - m_pUI_core = new ui_core(); + GEnv.UI = new ui_core(); m_pMainMenu = new CMainMenu(); } @@ -217,7 +216,7 @@ void CGamePersistent::OnAppEnd() m_pMainMenu->Activate(false); xr_delete(m_pMainMenu); - xr_delete(m_pUI_core); + xr_delete(GEnv.UI); inherited::OnAppEnd(); @@ -869,7 +868,7 @@ void CGamePersistent::LoadTitle(bool change_tip, shared_str map_name) tip_num = m_functor(map_name.c_str()); } // tip_num = 83; - xr_sprintf(buff, "%s%d:", CStringTable().translate("ls_tip_number").c_str(), tip_num); + xr_sprintf(buff, "%s%d:", StringTable().translate("ls_tip_number").c_str(), tip_num); shared_str tmp = buff; if (is_single) @@ -878,7 +877,7 @@ void CGamePersistent::LoadTitle(bool change_tip, shared_str map_name) xr_sprintf(buff, "ls_mp_tip_%d", tip_num); pApp->LoadTitleInt( - CStringTable().translate("ls_header").c_str(), tmp.c_str(), CStringTable().translate(buff).c_str()); + StringTable().translate("ls_header").c_str(), tmp.c_str(), StringTable().translate(buff).c_str()); } } @@ -887,7 +886,7 @@ void CGamePersistent::SetLoadStageTitle(pcstr ls_title) string256 buff; if (ls_title) { - xr_sprintf(buff, "%s%s", CStringTable().translate(ls_title).c_str(), "..."); + xr_sprintf(buff, "%s%s", StringTable().translate(ls_title).c_str(), "..."); pApp->SetLoadStageTitle(buff); } else @@ -953,5 +952,5 @@ void CGamePersistent::OnSectorChanged(int sector) void CGamePersistent::OnAssetsChanged() { IGame_Persistent::OnAssetsChanged(); - CStringTable().rescan(); + StringTable().rescan(); } diff --git a/src/xrGame/GamePersistent.h b/src/xrGame/GamePersistent.h index 4a3ca4ad873..10fa503e2b8 100644 --- a/src/xrGame/GamePersistent.h +++ b/src/xrGame/GamePersistent.h @@ -53,7 +53,6 @@ class CGamePersistent : public IGame_Persistent, public IEventReceiver void UpdateDof(); public: - ui_core* m_pUI_core; IReader* pDemoFile; u32 uTime2Change; EVENT eDemoStart; diff --git a/src/xrGame/GameTask.cpp b/src/xrGame/GameTask.cpp index 4d368aea485..c889b81b9d5 100644 --- a/src/xrGame/GameTask.cpp +++ b/src/xrGame/GameTask.cpp @@ -1,6 +1,6 @@ #include "pch_script.h" #include "GameTask.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "encyclopedia_article.h" #include "map_location.h" #include "map_spot.h" @@ -9,7 +9,7 @@ #include "Level.h" #include "actor.h" #include "xrScriptEngine/script_engine.hpp" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "ai_space.h" #include "alife_object_registry.h" @@ -17,7 +17,7 @@ #include "alife_story_registry.h" #include "game_object_space.h" #include "Common/object_broker.h" -#include "ui/uitexturemaster.h" +#include "xrUICore/XML/UITextureMaster.h" CGameTask::CGameTask() : m_map_object_id(0), m_TimeToComplete(0), m_priority(0) diff --git a/src/xrGame/GametaskManager.cpp b/src/xrGame/GametaskManager.cpp index f46518fd48d..2c49b7b6a81 100644 --- a/src/xrGame/GametaskManager.cpp +++ b/src/xrGame/GametaskManager.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "GameTaskManager.h" #include "alife_registry_wrappers.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "GameTask.h" #include "Level.h" #include "map_manager.h" diff --git a/src/xrGame/HUDCrosshair.cpp b/src/xrGame/HUDCrosshair.cpp index b1619953d48..1f509778511 100644 --- a/src/xrGame/HUDCrosshair.cpp +++ b/src/xrGame/HUDCrosshair.cpp @@ -5,8 +5,7 @@ #include "stdafx.h" #include "HUDCrosshair.h" -//.#include "UIStaticItem.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" CHUDCrosshair::CHUDCrosshair() { diff --git a/src/xrGame/HUDCrosshair.h b/src/xrGame/HUDCrosshair.h index 99902091531..59b9bbdea97 100644 --- a/src/xrGame/HUDCrosshair.h +++ b/src/xrGame/HUDCrosshair.h @@ -6,7 +6,7 @@ #define HUD_CURSOR_SECTION "hud_cursor" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" class CHUDCrosshair { diff --git a/src/xrGame/HUDManager.cpp b/src/xrGame/HUDManager.cpp index 1665e44a719..c422505d4f5 100644 --- a/src/xrGame/HUDManager.cpp +++ b/src/xrGame/HUDManager.cpp @@ -10,119 +10,15 @@ #include "spectator.h" #include "Car.h" #include "UIGameCustom.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "string_table.h" #include "game_cl_base.h" -#include "xrEngine/GameFont.h" #ifdef DEBUG #include "phdebug.h" #endif extern CUIGameCustom* CurrentGameUI() { return HUD().GetGameUI(); } -CFontManager::CFontManager() -{ - Device.seqDeviceReset.Add(this, REG_PRIORITY_HIGH); - - m_all_fonts.push_back(&pFontMedium); // used cpp - m_all_fonts.push_back(&pFontDI); // used cpp - m_all_fonts.push_back(&pFontArial14); // used xml - m_all_fonts.push_back(&pFontGraffiti19Russian); - m_all_fonts.push_back(&pFontGraffiti22Russian); - m_all_fonts.push_back(&pFontLetterica16Russian); - m_all_fonts.push_back(&pFontLetterica18Russian); - m_all_fonts.push_back(&pFontGraffiti32Russian); - m_all_fonts.push_back(&pFontGraffiti50Russian); - m_all_fonts.push_back(&pFontLetterica25); - m_all_fonts.push_back(&pFontStat); - - FONTS_VEC_IT it = m_all_fonts.begin(); - FONTS_VEC_IT it_e = m_all_fonts.end(); - for (; it != it_e; ++it) - (**it) = NULL; - - InitializeFonts(); -} - -void CFontManager::InitializeFonts() -{ - InitializeFont(pFontMedium, "hud_font_medium"); - InitializeFont(pFontDI, "hud_font_di", CGameFont::fsGradient | CGameFont::fsDeviceIndependent); - InitializeFont(pFontArial14, "ui_font_arial_14"); - InitializeFont(pFontGraffiti19Russian, "ui_font_graffiti19_russian"); - InitializeFont(pFontGraffiti22Russian, "ui_font_graffiti22_russian"); - InitializeFont(pFontLetterica16Russian, "ui_font_letterica16_russian"); - InitializeFont(pFontLetterica18Russian, "ui_font_letterica18_russian"); - InitializeFont(pFontGraffiti32Russian, "ui_font_graff_32"); - InitializeFont(pFontGraffiti50Russian, "ui_font_graff_50"); - InitializeFont(pFontLetterica25, "ui_font_letter_25"); - InitializeFont(pFontStat, "stat_font", CGameFont::fsDeviceIndependent); - pFontStat->SetInterval(0.75f, 1.0f); -} - -LPCSTR CFontManager::GetFontTexName(LPCSTR section) -{ - constexpr pcstr tex_names[] = { "texture800", "texture", "texture1600" }; - int def_idx = 1; // default 1024x768 - int idx = def_idx; -#if 0 - u32 w = Device.dwWidth; - - if(w<=800) idx = 0; - else if(w<=1280)idx = 1; - else idx = 2; -#else - u32 h = Device.dwHeight; - - if (h <= 600) - idx = 0; - else if (h < 1024) - idx = 1; - else - idx = 2; -#endif - - while (idx >= 0) - { - if (pSettings->line_exist(section, tex_names[idx])) - return pSettings->r_string(section, tex_names[idx]); - --idx; - } - return pSettings->r_string(section, tex_names[def_idx]); -} -void CFontManager::InitializeFont(CGameFont*& F, LPCSTR section, u32 flags) -{ - LPCSTR font_tex_name = GetFontTexName(section); - R_ASSERT(font_tex_name); - - LPCSTR sh_name = pSettings->r_string(section, "shader"); - if (!F) - F = new CGameFont(sh_name, font_tex_name, flags); - else - F->Initialize(sh_name, font_tex_name); - -#ifdef DEBUG - F->m_font_name = section; -#endif -} - -CFontManager::~CFontManager() -{ - Device.seqDeviceReset.Remove(this); - FONTS_VEC_IT it = m_all_fonts.begin(); - FONTS_VEC_IT it_e = m_all_fonts.end(); - for (; it != it_e; ++it) - xr_delete(**it); -} - -void CFontManager::Render() -{ - FONTS_VEC_IT it = m_all_fonts.begin(); - FONTS_VEC_IT it_e = m_all_fonts.end(); - for (; it != it_e; ++it) - (**it)->OnRender(); -} -void CFontManager::OnDeviceReset() { InitializeFonts(); } //-------------------------------------------------------------------- CHUDManager::CHUDManager() : pUIGame(nullptr), m_pHUDTarget(new CHUDTarget()), b_online(false) {} //-------------------------------------------------------------------- @@ -274,7 +170,7 @@ void CHUDManager::RenderUI() { CGameFont* pFont = UI().Font().pFontGraffiti50Russian; pFont->SetColor(0x80FF0000); - LPCSTR _str = CStringTable().translate("st_game_paused").c_str(); + LPCSTR _str = StringTable().translate("st_game_paused").c_str(); Fvector2 _pos; _pos.set(UI_BASE_WIDTH / 2.0f, UI_BASE_HEIGHT / 2.0f); diff --git a/src/xrGame/HUDTarget.cpp b/src/xrGame/HUDTarget.cpp index 3e4dfbbe7d3..684da894e77 100644 --- a/src/xrGame/HUDTarget.cpp +++ b/src/xrGame/HUDTarget.cpp @@ -10,7 +10,7 @@ #include "game_cl_base.h" #include "xrEngine/IGame_Persistent.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "InventoryOwner.h" #include "relation_registry.h" #include "character_info.h" @@ -180,10 +180,9 @@ void CHUDTarget::Render() if (fuzzyShowInfo > 0.5f) { - CStringTable strtbl; F->SetColor(subst_alpha(C, u8(iFloor(255.f * (fuzzyShowInfo - 0.5f) * 2.f)))); - F->OutNext("%s", *strtbl.translate(others_inv_owner->Name())); - F->OutNext("%s", *strtbl.translate(others_inv_owner->CharacterInfo().Community().id())); + F->OutNext("%s", *StringTable().translate(others_inv_owner->Name())); + F->OutNext("%s", *StringTable().translate(others_inv_owner->CharacterInfo().Community().id())); } } diff --git a/src/xrGame/HangingLamp.cpp b/src/xrGame/HangingLamp.cpp index 38c0afcd72e..75862861f10 100644 --- a/src/xrGame/HangingLamp.cpp +++ b/src/xrGame/HangingLamp.cpp @@ -8,7 +8,7 @@ #include "Include/xrRender/Kinematics.h" #include "Include/xrRender/KinematicsAnimated.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "xrScriptEngine/ScriptExporter.hpp" diff --git a/src/xrGame/Helicopter.cpp b/src/xrGame/Helicopter.cpp index b5589edd394..84d6236dec5 100644 --- a/src/xrGame/Helicopter.cpp +++ b/src/xrGame/Helicopter.cpp @@ -6,11 +6,12 @@ #include "ai_sounds.h" #include "Include/xrRender/Kinematics.h" #include "Include/xrRender/KinematicsAnimated.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "script_game_object.h" #include "xrEngine/LightAnimLibrary.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" + #ifdef DEBUG #include "xrEngine/GameFont.h" #endif diff --git a/src/xrGame/Helicopter2.cpp b/src/xrGame/Helicopter2.cpp index 0483ac8e9f4..124992fd1c4 100644 --- a/src/xrGame/Helicopter2.cpp +++ b/src/xrGame/Helicopter2.cpp @@ -6,7 +6,7 @@ #include "Include/xrRender/Kinematics.h" #include "xrEngine/LightAnimLibrary.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "ai/stalker/ai_stalker.h" #include "CustomZone.h" #include "xrPhysics/MathUtils.h" diff --git a/src/xrGame/HelicopterMovementManager.cpp b/src/xrGame/HelicopterMovementManager.cpp index cd1ee10fd89..e6a18d5fd3e 100644 --- a/src/xrGame/HelicopterMovementManager.cpp +++ b/src/xrGame/HelicopterMovementManager.cpp @@ -5,7 +5,7 @@ #include "xrAICore/Navigation/PatrolPath/patrol_path_storage.h" #include "script_game_object.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" SHeliMovementState::~SHeliMovementState() {} void SHeliMovementState::net_Destroy() diff --git a/src/xrGame/HitMarker.cpp b/src/xrGame/HitMarker.cpp index 10bfa97d6fa..5df0dc82228 100644 --- a/src/xrGame/HitMarker.cpp +++ b/src/xrGame/HitMarker.cpp @@ -4,7 +4,7 @@ #include "HitMarker.h" #include "xrEngine/render.h" #include "xrEngine/LightAnimLibrary.h" -#include "UIStaticItem.h" +#include "xrUICore/Static/UIStaticItem.h" #include "grenade.h" diff --git a/src/xrGame/HitMarker.h b/src/xrGame/HitMarker.h index 44a7b9f1d63..2d30836bdf4 100644 --- a/src/xrGame/HitMarker.h +++ b/src/xrGame/HitMarker.h @@ -3,7 +3,7 @@ #define __XR_HITMARKER_H__ #include "Include/xrRender/FactoryPtr.h" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" #include "Common/Noncopyable.hpp" #include "xrCommon/xr_deque.h" diff --git a/src/xrGame/HudItem.cpp b/src/xrGame/HudItem.cpp index 6001296de38..2cd92434865 100644 --- a/src/xrGame/HudItem.cpp +++ b/src/xrGame/HudItem.cpp @@ -12,7 +12,7 @@ #include "xrCore/Animation/SkeletonMotions.hpp" #include "xrNetServer/NET_Messages.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" CHudItem::CHudItem() { diff --git a/src/xrGame/Inventory.cpp b/src/xrGame/Inventory.cpp index 9452986d386..ab10eeec5bd 100644 --- a/src/xrGame/Inventory.cpp +++ b/src/xrGame/Inventory.cpp @@ -1038,7 +1038,7 @@ CInventoryItem* CInventory::get_object_by_id(ALife::_OBJECT_ID tObjectID) //скушать предмет #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" bool CInventory::Eat(PIItem pIItem) { diff --git a/src/xrGame/InventoryBox.cpp b/src/xrGame/InventoryBox.cpp index c8744a093fb..a99a4ea8ba9 100644 --- a/src/xrGame/InventoryBox.cpp +++ b/src/xrGame/InventoryBox.cpp @@ -4,7 +4,7 @@ #include "actor.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "ui/UIActorMenu.h" #include "uigamecustom.h" diff --git a/src/xrGame/InventoryOwner.cpp b/src/xrGame/InventoryOwner.cpp index 8a136118200..90312985432 100644 --- a/src/xrGame/InventoryOwner.cpp +++ b/src/xrGame/InventoryOwner.cpp @@ -18,7 +18,7 @@ #include "alife_registry_wrappers.h" #include "relation_registry.h" #include "xrAICore/Navigation/ai_object_location.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "AI/Monsters/BaseMonster/base_monster.h" #include "trade_parameters.h" diff --git a/src/xrGame/LevelGraphDebugRender.cpp b/src/xrGame/LevelGraphDebugRender.cpp index 7b49d5f6495..aac9413ce14 100644 --- a/src/xrGame/LevelGraphDebugRender.cpp +++ b/src/xrGame/LevelGraphDebugRender.cpp @@ -25,7 +25,7 @@ #include "alife_monster_movement_manager.h" #include "alife_monster_detail_path_manager.h" #include "ai_space.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "CustomMonster.h" #include "ai/stalker/ai_stalker.h" #include "team_base_zone.h" diff --git a/src/xrGame/Level_input.cpp b/src/xrGame/Level_input.cpp index 3fd6d6a7cc1..401066aa5f0 100644 --- a/src/xrGame/Level_input.cpp +++ b/src/xrGame/Level_input.cpp @@ -13,7 +13,7 @@ #include "Inventory.h" #include "xrServer.h" #include "autosave_manager.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "Actor.h" #include "HudItem.h" diff --git a/src/xrGame/Level_network.cpp b/src/xrGame/Level_network.cpp index 5d7e7e61bc2..b8c1525e791 100644 --- a/src/xrGame/Level_network.cpp +++ b/src/xrGame/Level_network.cpp @@ -483,11 +483,11 @@ void CLevel::OnConnectResult(NET_Packet* P) { if (!xr_strlen(ResultStr)) { - MainMenu()->OnSessionTerminate(CStringTable().translate("st_you_have_been_banned").c_str()); + MainMenu()->OnSessionTerminate(StringTable().translate("st_you_have_been_banned").c_str()); } else { - MainMenu()->OnSessionTerminate(CStringTable().translate(ResultStr).c_str()); + MainMenu()->OnSessionTerminate(StringTable().translate(ResultStr).c_str()); } } break; @@ -495,11 +495,11 @@ void CLevel::OnConnectResult(NET_Packet* P) { if (!xr_strlen(ResultStr)) { - MainMenu()->OnSessionTerminate(CStringTable().translate("st_profile_error").c_str()); + MainMenu()->OnSessionTerminate(StringTable().translate("st_profile_error").c_str()); } else { - MainMenu()->OnSessionTerminate(CStringTable().translate(ResultStr).c_str()); + MainMenu()->OnSessionTerminate(StringTable().translate(ResultStr).c_str()); } } } diff --git a/src/xrGame/Level_network_start_client.cpp b/src/xrGame/Level_network_start_client.cpp index 594afb8f057..d482e6cc626 100644 --- a/src/xrGame/Level_network_start_client.cpp +++ b/src/xrGame/Level_network_start_client.cpp @@ -35,7 +35,7 @@ bool CLevel::net_start_client1() string256 temp; xr_sprintf(temp, "%s %s", - CStringTable().translate("st_client_connecting_to").c_str(), + StringTable().translate("st_client_connecting_to").c_str(), name_of_server); pApp->SetLoadStageTitle(temp); diff --git a/src/xrGame/Level_start.cpp b/src/xrGame/Level_start.cpp index 98321b3599b..914e0eb88be 100644 --- a/src/xrGame/Level_start.cpp +++ b/src/xrGame/Level_start.cpp @@ -274,11 +274,10 @@ bool CLevel::net_start6() LPCSTR level_id_string = NULL; LPCSTR dialog_string = NULL; LPCSTR download_url = !!map_data.m_map_download_url ? map_data.m_map_download_url.c_str() : ""; - CStringTable st; LPCSTR tmp_map_ver = !!map_data.m_map_version ? map_data.m_map_version.c_str() : ""; - STRCONCAT(level_id_string, st.translate("st_level"), ":", map_data.m_name.c_str(), "(", tmp_map_ver, "). "); - STRCONCAT(dialog_string, level_id_string, st.translate("ui_st_map_not_found")); + STRCONCAT(level_id_string, StringTable().translate("st_level"), ":", map_data.m_name.c_str(), "(", tmp_map_ver, "). "); + STRCONCAT(dialog_string, level_id_string, StringTable().translate("ui_st_map_not_found")); DEL_INSTANCE(g_pGameLevel); Console->Execute("main_menu on"); @@ -294,11 +293,10 @@ bool CLevel::net_start6() LPCSTR level_id_string = NULL; LPCSTR dialog_string = NULL; LPCSTR download_url = !!map_data.m_map_download_url ? map_data.m_map_download_url.c_str() : ""; - CStringTable st; LPCSTR tmp_map_ver = !!map_data.m_map_version ? map_data.m_map_version.c_str() : ""; - STRCONCAT(level_id_string, st.translate("st_level"), ":", map_data.m_name.c_str(), "(", tmp_map_ver, "). "); - STRCONCAT(dialog_string, level_id_string, st.translate("ui_st_map_data_corrupted")); + STRCONCAT(level_id_string, StringTable().translate("st_level"), ":", map_data.m_name.c_str(), "(", tmp_map_ver, "). "); + STRCONCAT(dialog_string, level_id_string, StringTable().translate("ui_st_map_data_corrupted")); g_pGameLevel->net_Stop(); DEL_INSTANCE(g_pGameLevel); diff --git a/src/xrGame/MainMenu.cpp b/src/xrGame/MainMenu.cpp index f43aeb3b6ce..e16a6003c10 100644 --- a/src/xrGame/MainMenu.cpp +++ b/src/xrGame/MainMenu.cpp @@ -6,10 +6,10 @@ #include "xrEngine/IGame_Level.h" #include "xrEngine/CameraManager.h" #include "xr_Level_controller.h" -#include "ui\UITextureMaster.h" +#include "xrUICore/XML/UItextureMaster.h" #include "ui\UIXmlInit.h" -#include "ui\UIBtnHint.h" -#include "UICursor.h" +#include "xrUICore/Buttons/UIBtnHint.h" +#include "xrUICore/Cursor/UICursor.h" #include "xrGameSpy/GameSpy_Full.h" #include "xrGameSpy/GameSpy_HTTP.h" #include "xrGameSpy/GameSpy_Available.h" @@ -643,8 +643,7 @@ void CMainMenu::OnSessionTerminate(LPCSTR reason) return; m_start_time = Device.dwTimeGlobal; - CStringTable st; - LPCSTR str = st.translate("ui_st_kicked_by_server").c_str(); + LPCSTR str = StringTable().translate("ui_st_kicked_by_server").c_str(); LPSTR text; if (reason && xr_strlen(reason) && reason[0] == '@') @@ -656,13 +655,13 @@ void CMainMenu::OnSessionTerminate(LPCSTR reason) STRCONCAT(text, str, " ", reason); } - m_pMB_ErrDlgs[SessionTerminate]->SetText(st.translate(text).c_str()); + m_pMB_ErrDlgs[SessionTerminate]->SetText(StringTable().translate(text).c_str()); SetErrorDialog(CMainMenu::SessionTerminate); } void CMainMenu::OnLoadError(LPCSTR module) { - LPCSTR str = CStringTable().translate("ui_st_error_loading").c_str(); + LPCSTR str = StringTable().translate("ui_st_error_loading").c_str(); string1024 Text; strconcat(sizeof(Text), Text, str, " "); xr_strcat(Text, sizeof(Text), module); diff --git a/src/xrGame/MainMenu.h b/src/xrGame/MainMenu.h index 6209fad4e20..898ae6382ee 100644 --- a/src/xrGame/MainMenu.h +++ b/src/xrGame/MainMenu.h @@ -12,8 +12,8 @@ class demo_info_loader; #include "xrEngine/IInputReceiver.h" #include "xrEngine/IGame_Persistent.h" #include "UIDialogHolder.h" -#include "ui/UIWndCallback.h" -#include "ui_base.h" +#include "xrUICore/Callbacks/UIWndCallback.h" +#include "xrUICore/ui_base.h" #include "DemoInfo.h" namespace gamespy_gp diff --git a/src/xrGame/Missile.cpp b/src/xrGame/Missile.cpp index d7dbb78df12..61483f9b40b 100644 --- a/src/xrGame/Missile.cpp +++ b/src/xrGame/Missile.cpp @@ -22,7 +22,7 @@ #define PLAYING_ANIM_TIME 10000 -#include "ui/UIProgressShape.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" #include "ui/UIXmlInit.h" #include "physicsshellholder.h" diff --git a/src/xrGame/PHDebug.cpp b/src/xrGame/PHDebug.cpp index 305f812e5ea..57c0c9bd17d 100644 --- a/src/xrGame/PHDebug.cpp +++ b/src/xrGame/PHDebug.cpp @@ -22,7 +22,7 @@ #include "xrCore/xr_token.h" #include "xrEngine/GameFont.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" Flags32 ph_dbg_draw_mask; Flags32 ph_dbg_draw_mask1; diff --git a/src/xrGame/PHScriptCall.h b/src/xrGame/PHScriptCall.h index 7fa465c97d7..f95ba5c1659 100644 --- a/src/xrGame/PHScriptCall.h +++ b/src/xrGame/PHScriptCall.h @@ -3,7 +3,7 @@ #include "phcommander.h" #include "xrScriptEngine/script_engine.hpp" #include "xrScriptEngine/script_space_forward.hpp" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "xrEngine/xr_object.h" // template<> diff --git a/src/xrGame/PhraseScript.cpp b/src/xrGame/PhraseScript.cpp index 1b985e570b8..2d74e7428e9 100644 --- a/src/xrGame/PhraseScript.cpp +++ b/src/xrGame/PhraseScript.cpp @@ -7,7 +7,7 @@ #include "infoportion.h" #include "inventoryowner.h" #include "ai_debug.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "actor.h" //загрузка из XML файла diff --git a/src/xrGame/PhysicsShellHolder.cpp b/src/xrGame/PhysicsShellHolder.cpp index 0742a60aeac..d82bd6a8d75 100644 --- a/src/xrGame/PhysicsShellHolder.cpp +++ b/src/xrGame/PhysicsShellHolder.cpp @@ -4,7 +4,7 @@ #include "xrMessages.h" #include "ph_shell_interface.h" #include "Include/xrRender/Kinematics.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "Level.h" #include "PHCommander.h" #include "PHScriptCall.h" diff --git a/src/xrGame/ScriptXMLInit.cpp b/src/xrGame/ScriptXMLInit.cpp index fc96f3a562a..bf5fd2835b6 100644 --- a/src/xrGame/ScriptXMLInit.cpp +++ b/src/xrGame/ScriptXMLInit.cpp @@ -1,25 +1,26 @@ #include "pch_script.h" #include "ScriptXmlInit.h" #include "ui\UIXmlInit.h" -#include "ui\UITextureMaster.h" -#include "ui\UICheckButton.h" -#include "ui\UISpinNum.h" -#include "ui\UISpinText.h" -#include "ui\UIComboBox.h" -#include "ui\UITabControl.h" -#include "ui\UIFrameWindow.h" +#include "xrUICore/XML/UItextureMaster.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/SpinBox/UISpinNum.h" +#include "xrUICore/SpinBox/UISpinText.h" +#include "xrUICore/ComboBox/UIComboBox.h" +#include "xrUICore/TabControl/UITabControl.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "ui\UILabel.h" #include "ui\ServerList.h" #include "ui\UIMapList.h" #include "ui\UIKeyBinding.h" -#include "ui\UIEditBox.h" -#include "ui\UIAnimatedStatic.h" -#include "ui\UITrackBar.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/Static/UIAnimatedStatic.h" +#include "ui/UISleepStatic.h" +#include "xrUICore/TrackBar/UITrackBar.h" #include "ui\UICDkey.h" #include "ui\UIMapInfo.h" #include "ui\UIMMShniaga.h" -#include "ui\UIScrollView.h" -#include "ui\UIProgressBar.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; diff --git a/src/xrGame/ScriptXMLInit.h b/src/xrGame/ScriptXMLInit.h index c8cc9b58a10..92cae332cee 100644 --- a/src/xrGame/ScriptXMLInit.h +++ b/src/xrGame/ScriptXMLInit.h @@ -1,6 +1,6 @@ #pragma once -#include "ui\xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" class CUIWindow; class CUIFrameWindow; diff --git a/src/xrGame/Spectator.cpp b/src/xrGame/Spectator.cpp index 100d7ccccaf..39f61555283 100644 --- a/src/xrGame/Spectator.cpp +++ b/src/xrGame/Spectator.cpp @@ -641,21 +641,20 @@ void CSpectator::GetSpectatorString(string1024& pStr) return; xr_string SpectatorMsg; - CStringTable st; switch (cam_active) { case eacFreeFly: { - SpectatorMsg = *st.translate("mp_spectator"); + SpectatorMsg = *StringTable().translate("mp_spectator"); SpectatorMsg += " "; - SpectatorMsg += *st.translate("mp_free_fly"); + SpectatorMsg += *StringTable().translate("mp_free_fly"); } break; case eacFirstEye: { - SpectatorMsg = *st.translate("mp_spectator"); + SpectatorMsg = *StringTable().translate("mp_spectator"); SpectatorMsg += " "; - SpectatorMsg += *st.translate("mp_first_eye"); + SpectatorMsg += *StringTable().translate("mp_first_eye"); SpectatorMsg += " "; // SpectatorMsg = "SPECTATOR (First-Eye): "; SpectatorMsg += m_pActorToLookAt ? m_pActorToLookAt->Name() : ""; @@ -663,9 +662,9 @@ void CSpectator::GetSpectatorString(string1024& pStr) break; case eacFreeLook: { - SpectatorMsg = *st.translate("mp_spectator"); + SpectatorMsg = *StringTable().translate("mp_spectator"); SpectatorMsg += " "; - SpectatorMsg += *st.translate("mp_free_look"); + SpectatorMsg += *StringTable().translate("mp_free_look"); SpectatorMsg += " "; // SpectatorMsg = "SPECTATOR (Free-Look):"; SpectatorMsg += m_pActorToLookAt ? m_pActorToLookAt->Name() : ""; @@ -673,9 +672,9 @@ void CSpectator::GetSpectatorString(string1024& pStr) break; case eacLookAt: { - SpectatorMsg = *st.translate("mp_spectator"); + SpectatorMsg = *StringTable().translate("mp_spectator"); SpectatorMsg += " "; - SpectatorMsg += *st.translate("mp_look_at"); + SpectatorMsg += *StringTable().translate("mp_look_at"); SpectatorMsg += " "; // SpectatorMsg = "SPECTATOR (Look-At):"; SpectatorMsg += m_pActorToLookAt ? m_pActorToLookAt->Name() : ""; diff --git a/src/xrGame/StdAfx.h b/src/xrGame/StdAfx.h index 646d6b00b93..e900986cdaf 100644 --- a/src/xrGame/StdAfx.h +++ b/src/xrGame/StdAfx.h @@ -52,7 +52,7 @@ #include "xrGame/Entity.h" // ~490 #include "xrGame/damage_manager.h" // ~490 #include "xrGame/EntityCondition.h" // ~490 -#include "xrGame/ui_defs.h" // ~450 +#include "xrUICore/ui_defs.h" // ~450 #include "xrGame/entity_alive.h" // ~430 #include "xrCore/XML/XMLDocument.hpp" // ~400 #include "xrPhysics/xrPhysics.h" // ~400 @@ -77,16 +77,16 @@ #include "xrGame/script_entity.h" // ~290 #include "xrEngine/Feel_Vision.h" // ~270 #include "xrGame/CustomMonster.h" // ~265 -#include "xrGame/ui_base.h" // ~260 +#include "xrUICore/ui_base.h" // ~260 #include "xrPhysics/MathUtils.h" // ~260 #include "xrGame/WeaponAmmo.h" // ~250 #include "xrEngine/GameFont.h" // ~250 #include "xrGame/detail_path_manager.h" // ~120 + 120 for its inlines #include "xrPhysics/MovementBoxDynamicActivate.h" // ~240 #include "xrPhysics/PHItemList.h" -#include "xrGame/ui/UIEditBox.h" -#include "xrGame/ui/UIWindow.h" // ~225 -#include "xrGame/ui/UIMessages.h" // ~225 one single enum +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/Windows/UIWindow.h" // ~225 +#include "xrUICore/UIMessages.h" // ~225 one single enum #include "xrScriptEngine/Functor.hpp" // ~225 // XXX: See to it this goes to pch_script #include "xrGame/fire_disp_controller.h" // ~220 #include "xrGame/Actor.h" // ~220 @@ -94,8 +94,6 @@ #include "xrEngine/CameraManager.h" // ~190 #include "xrCore/PostProcess/PPInfo.hpp" // ~190 #include "xrScriptEngine/script_engine.hpp" // only ~200, VERY heavy! // XXX: See to it this goes to pch_script -//#include "xrGame/ui/UILine.h" // ~190 -//#include "xrGame/ui/UILines.h" // ~190 #include "xrCore/_fbox2.h" // ~155 #include "xrCore/_vector3d_ext.h" #include "xrCore/buffer_vector.h" @@ -107,34 +105,34 @@ //#include "xrCore/dump_string.h" // ~260 //#include "xrCore/Math/Random32.hpp" // ~220 //#include "xrEngine/LightAnimLibrary.h" // ~200 -#include "xrGame/UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "xrGame/UIDialogHolder.h" // ~135, somewhat heavy to compile -#include "xrGame/UIStaticItem.h" // ~190, and quite heavy to compile +#include "xrUICore/Static/UIStaticItem.h" // ~190, and quite heavy to compile #include "xrGame/ui/Restrictions.h" -#include "xrGame/ui/UI_IB_Static.h" // ~60, very heavy to compile -#include "xrGame/ui/UI3tButton.h" // ~60, very heavy to compile +#include "xrUICore/InteractiveBackground/UI_IB_Static.h" // ~60, very heavy to compile +#include "xrUICore/Buttons/UI3tButton.h" // ~60, very heavy to compile #include "xrGame/ui/UIActorMenu.h" -#include "xrGame/ui/UIButton.h" // ~80, very heavy to compile +#include "xrUICore/Buttons/UIButton.h" // ~80, very heavy to compile #include "xrGame/ui/UIBuyWndBase.h" #include "xrGame/ui/UIBuyWndShared.h" #include "xrGame/ui/UICellItem.h" -#include "xrGame/ui/UICustomEdit.h" +#include "xrUICore/EditBox/UICustomEdit.h" #include "xrGame/ui/UIDialogWnd.h" // ~100 #include "xrGame/ui/UIDragDropListEx.h" -#include "xrGame/ui/UIFrameWindow.h" -#include "xrGame/ui/UIHint.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Hint/UIHint.h" #include "xrGame/ui/UIInventoryUtilities.h" -#include "xrGame/ui/UILanimController.h" // ~190 -#include "xrGame/ui/UILine.h" // ~190 -#include "xrGame/ui/UILines.h" // ~190 -#include "xrGame/ui/UIListBox.h" -#include "xrGame/ui/UIOptionsItem.h" // ~60, somewhat heavy to compile -//#include "xrGame/ui/UIOptionsManager.h" // ~60, somewhat heavy to compile -#include "xrGame/ui/UIProgressBar.h" // ~23, very heavy to compile -#include "xrGame/ui/UIScrollView.h" // ~70, quite heavy to compile -#include "xrGame/ui/UIStatic.h" // ~190 -#include "xrGame/ui/UISubLine.h" // ~190 -#include "xrGame/ui/UIWndCallback.h" // 135, somewhat heavy to compile +#include "xrUICore/Static/UILanimController.h" // ~190 +#include "xrUICore/Lines/UILine.h" // ~190 +#include "xrUICore/Lines/UILines.h" // ~190 +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/Options/UIOptionsItem.h" // ~60, somewhat heavy to compile +//#include "xrUICore/Options/UIOptionsManager.h" // ~60, somewhat heavy to compile +#include "xrUICore/ProgressBar/UIProgressBar.h" // ~23, very heavy to compile +#include "xrUICore/ScrollView/UIScrollView.h" // ~70, quite heavy to compile +#include "xrUICore/Static/UIStatic.h" // ~190 +#include "xrUICore/Lines/UISubLine.h" // ~190 +#include "xrUICore/Callbacks/UIWndCallback.h" // 135, somewhat heavy to compile #include "xrGame/ui/UIXmlInit.h" // ~105, somewhat heavy to compile #include "xrGame/smart_cover.h" // ~30, VERY heavy to compile #include "xrGame/team_hierarchy_holder.h" // ~35, but quite heavy to compile @@ -188,7 +186,7 @@ #include "xrGame/property_evaluator_const.h" #include "xrGame/quadtree.h" #include "xrGame/Random.hpp" // ~150 -#include "xrGame/script_callback_ex.h" // ~120, VERY heavy to compile +#include "xrScriptEngine/script_callback_ex.h" // ~120, VERY heavy to compile #include "xrGame/seniority_hierarchy_holder.h" #include "xrGame/setup_manager.h" #include "xrGame/sight_action.h" @@ -211,6 +209,7 @@ #include "xrGame/game_cl_mp.h" // ~60, INCREDIBLY heavy to compile #include "xrGame/game_events_handler.h" // ~30, INCREDIBLY heavy to compile #include "xrGame/steering_behaviour.h" // ~30, measurable compile time +#include "xr_level_controller.h" #include "xrGame/UIGameCustom.h" // ~85, quite heavy to compile #include "xrGame/UIGameMP.h" #include "xrGame/UIGameSP.h" diff --git a/src/xrGame/Tracer.h b/src/xrGame/Tracer.h index 99de54ba3fc..cbd7a2f5aa2 100644 --- a/src/xrGame/Tracer.h +++ b/src/xrGame/Tracer.h @@ -2,7 +2,7 @@ class CBulletManager; -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" class CTracer { diff --git a/src/xrGame/UIAchivementsIndicator.cpp b/src/xrGame/UIAchivementsIndicator.cpp index c4c766ec68a..034238fd391 100644 --- a/src/xrGame/UIAchivementsIndicator.cpp +++ b/src/xrGame/UIAchivementsIndicator.cpp @@ -2,7 +2,7 @@ #include "UIAchivementsIndicator.h" #include "ui/UIXmlInit.h" #include "ui/UIGameLog.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIPdaMsgListItem.h" #include "profile_data_types.h" diff --git a/src/xrGame/UIAchivementsIndicator.h b/src/xrGame/UIAchivementsIndicator.h index 6bc6b92146b..63d5aac3884 100644 --- a/src/xrGame/UIAchivementsIndicator.h +++ b/src/xrGame/UIAchivementsIndicator.h @@ -1,7 +1,7 @@ #ifndef UI_ACHIVEMENTS_INDICATOR_INCLUDED #define UI_ACHIVEMENTS_INDICATOR_INCLUDED -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "ui/KillMessageStruct.h" #include "xrCore/Containers/AssociativeVector.hpp" diff --git a/src/xrGame/UIDialogHolder.cpp b/src/xrGame/UIDialogHolder.cpp index ddb62619ccd..2d455f8d4fe 100644 --- a/src/xrGame/UIDialogHolder.cpp +++ b/src/xrGame/UIDialogHolder.cpp @@ -2,7 +2,7 @@ #include "UIDialogHolder.h" #include "ui/UIDialogWnd.h" #include "UIGameCustom.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "Level.h" #include "actor.h" #include "xr_level_controller.h" diff --git a/src/xrGame/UIGameAHunt.cpp b/src/xrGame/UIGameAHunt.cpp index 5a1e11671d5..089bc34aad3 100644 --- a/src/xrGame/UIGameAHunt.cpp +++ b/src/xrGame/UIGameAHunt.cpp @@ -4,7 +4,7 @@ #include "team_base_zone.h" #include "Level.h" #include "game_cl_ArtefactHunt.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "ui/UIXmlInit.h" #include "ui/UIMessageBoxEx.h" #include "ui/UIMoneyIndicator.h" diff --git a/src/xrGame/UIGameCTA.cpp b/src/xrGame/UIGameCTA.cpp index 958db266dd5..4efdeffcb7d 100644 --- a/src/xrGame/UIGameCTA.cpp +++ b/src/xrGame/UIGameCTA.cpp @@ -31,7 +31,7 @@ #include "ui/UIBuyWndShared.h" #include "ui/UIMoneyIndicator.h" #include "ui/UIRankIndicator.h" -#include "ui/UIProgressShape.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" #include "ui/UIMessageBoxEx.h" #include "ui/UIVoteStatusWnd.h" #include "ui/UIActorMenu.h" @@ -732,8 +732,7 @@ void CUIGameCTA::ShowBuySpawn(s32 spawn_cost) if (m_pBuySpawnMsgBox->IsShown()) return; - CStringTable st; - LPCSTR format_str = st.translate("mp_press_yes2pay").c_str(); + LPCSTR format_str = StringTable().translate("mp_press_yes2pay").c_str(); VERIFY(format_str); size_t pay_frm_size = xr_strlen(format_str) * sizeof(char) + 64; PSTR pay_frm_str = static_cast(_alloca(pay_frm_size)); diff --git a/src/xrGame/UIGameCustom.cpp b/src/xrGame/UIGameCustom.cpp index b905b909d28..0dca0ec8f03 100644 --- a/src/xrGame/UIGameCustom.cpp +++ b/src/xrGame/UIGameCustom.cpp @@ -2,7 +2,7 @@ #include "UIGameCustom.h" #include "Level.h" #include "ui/UIXmlInit.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "Common/object_broker.h" #include "string_table.h" diff --git a/src/xrGame/UIGameCustom_script.cpp b/src/xrGame/UIGameCustom_script.cpp index 85072722583..b410f965061 100644 --- a/src/xrGame/UIGameCustom_script.cpp +++ b/src/xrGame/UIGameCustom_script.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "UIGameCustom.h" #include "Level.h" -#include "ui/uistatic.h" +#include "xrUICore/Static/UIStatic.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; diff --git a/src/xrGame/UIGameDM.cpp b/src/xrGame/UIGameDM.cpp index d32d2214968..001632b1484 100644 --- a/src/xrGame/UIGameDM.cpp +++ b/src/xrGame/UIGameDM.cpp @@ -13,7 +13,7 @@ #include "InventoryOwner.h" #include "xrserver_objects_alife_items.h" #include "xr_level_controller.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "game_cl_Deathmatch.h" #include "ui/UIMoneyIndicator.h" #include "ui/UIRankIndicator.h" diff --git a/src/xrGame/UIGameMP.cpp b/src/xrGame/UIGameMP.cpp index a8ae6b409dc..0370bf6c99b 100644 --- a/src/xrGame/UIGameMP.cpp +++ b/src/xrGame/UIGameMP.cpp @@ -3,7 +3,7 @@ #include "UIAchivementsIndicator.h" #include "ui/UIDemoPlayControl.h" #include "ui/UIServerInfo.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "Level.h" #include "game_cl_mp.h" diff --git a/src/xrGame/UIGameSP.cpp b/src/xrGame/UIGameSP.cpp index e5ecfe97da2..26d9494d57e 100644 --- a/src/xrGame/UIGameSP.cpp +++ b/src/xrGame/UIGameSP.cpp @@ -20,7 +20,7 @@ #include "ui/UIActorMenu.h" #include "ui/UIPdaWnd.h" #include "ui/UITalkWnd.h" -#include "ui/UIMessageBox.h" +#include "xrUICore/MessageBox/UIMessageBox.h" CUIGameSP::CUIGameSP() : m_game(NULL), m_game_objective(NULL) { diff --git a/src/xrGame/UIPlayerItem.cpp b/src/xrGame/UIPlayerItem.cpp index 425b627a74d..16ae2cf0a26 100644 --- a/src/xrGame/UIPlayerItem.cpp +++ b/src/xrGame/UIPlayerItem.cpp @@ -3,7 +3,7 @@ #include "UITeamState.h" #include "UITeamPanels.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "ui/UIStatsIcon.h" #include "game_cl_capture_the_artefact.h" @@ -132,9 +132,8 @@ void UIPlayerItem::GetTextParamValue( } else if (param_name.equal("mp_status")) { - CStringTable st; if (ps->testFlag(GAME_PLAYER_FLAG_READY)) - xr_strcpy(dest.begin(), dest.size(), st.translate("st_mp_ready").c_str()); + xr_strcpy(dest.begin(), dest.size(), StringTable().translate("st_mp_ready").c_str()); } else if (param_name.equal("mp_ping")) { diff --git a/src/xrGame/UIPlayerItem.h b/src/xrGame/UIPlayerItem.h index 344cb9b6fbf..a43422d32d7 100644 --- a/src/xrGame/UIPlayerItem.h +++ b/src/xrGame/UIPlayerItem.h @@ -2,8 +2,8 @@ #ifndef UIPLAYERITEM #define UIPLAYERITEM -#include "ui/UIWindow.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIXmlInit.h" #include "game_cl_base.h" diff --git a/src/xrGame/UITeamHeader.cpp b/src/xrGame/UITeamHeader.cpp index 459cf92dcce..80c83d7aee2 100644 --- a/src/xrGame/UITeamHeader.cpp +++ b/src/xrGame/UITeamHeader.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UITeamHeader.h" #include "UITeamState.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "xrCore/buffer_vector.h" UITeamHeader::UITeamHeader(UITeamState const* const parent) : m_parent(parent), m_team_header_root() {} @@ -50,7 +50,6 @@ void UITeamHeader::InitFieldsStatics(CUIXml& uiXml) { VERIFY(m_team_header_root); int tempNumber = uiXml.GetNodesNum(m_team_header_root, FILED_NODE_NAME); - CStringTable st; for (int i = 0; i < tempNumber; ++i) { XML_NODE tempFieldNode = uiXml.NavigateToNode(FILED_NODE_NAME, i); @@ -62,7 +61,7 @@ void UITeamHeader::InitFieldsStatics(CUIXml& uiXml) this->AttachChild(static_cast(tempField)); tempField->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, FILED_NODE_NAME, i, tempField); - m_translated_strings.insert(std::make_pair(shared_str(tempFieldName), st.translate(tempFieldName))); + m_translated_strings.insert(std::make_pair(shared_str(tempFieldName), StringTable().translate(tempFieldName))); m_field_fillers.insert(std::make_pair(shared_str(tempFieldName), tempField)); } } diff --git a/src/xrGame/UITeamHeader.h b/src/xrGame/UITeamHeader.h index 0d8ba16270b..78ffc51a9eb 100644 --- a/src/xrGame/UITeamHeader.h +++ b/src/xrGame/UITeamHeader.h @@ -1,8 +1,8 @@ #ifndef UI_TEAM_HEADER #define UI_TEAM_HEADER -#include "ui/UIWindow.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIXmlInit.h" #include "game_cl_base.h" diff --git a/src/xrGame/UITeamPanels.cpp b/src/xrGame/UITeamPanels.cpp index 251ef86bba7..4bb0e2913cc 100644 --- a/src/xrGame/UITeamPanels.cpp +++ b/src/xrGame/UITeamPanels.cpp @@ -1,8 +1,8 @@ #include "StdAfx.h" #include "UITeamPanels.h" #include "ui/UIStatsIcon.h" -#include "ui/UIFrameLineWnd.h" -#include "ui/UIStatic.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Static/UIStatic.h" UITeamPanels::UITeamPanels() { diff --git a/src/xrGame/UITeamPanels.h b/src/xrGame/UITeamPanels.h index e511d307b3d..130a5786b52 100644 --- a/src/xrGame/UITeamPanels.h +++ b/src/xrGame/UITeamPanels.h @@ -1,9 +1,9 @@ #ifndef UITEAMPANELS #define UITEAMPANELS -#include "ui/UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "UIPanelsClassFactory.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIXmlInit.h" class UITeamState; diff --git a/src/xrGame/UITeamState.cpp b/src/xrGame/UITeamState.cpp index 70fa1b4f702..79b99388652 100644 --- a/src/xrGame/UITeamState.cpp +++ b/src/xrGame/UITeamState.cpp @@ -6,9 +6,9 @@ #include "UIPlayerItem.h" #include "UITeamHeader.h" -#include "ui/UIFrameWindow.h" -#include "ui/UIScrollView.h" -#include "ui/UIStatic.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" #include "game_cl_mp.h" diff --git a/src/xrGame/UITeamState.h b/src/xrGame/UITeamState.h index 9f9aceba6fc..e776f888b23 100644 --- a/src/xrGame/UITeamState.h +++ b/src/xrGame/UITeamState.h @@ -1,8 +1,8 @@ #ifndef UITEAMSTATE #define UITEAMSTATE -#include "ui/UIWindow.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIXmlInit.h" #include "game_cl_base.h" diff --git a/src/xrGame/UIZoneMap.h b/src/xrGame/UIZoneMap.h index ab3d8e4011f..11ff7cdb0e8 100644 --- a/src/xrGame/UIZoneMap.h +++ b/src/xrGame/UIZoneMap.h @@ -1,6 +1,6 @@ #pragma once -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CActor; class CUIMiniMap; diff --git a/src/xrGame/Weapon.cpp b/src/xrGame/Weapon.cpp index 2f8d40f187f..da071d60061 100644 --- a/src/xrGame/Weapon.cpp +++ b/src/xrGame/Weapon.cpp @@ -21,7 +21,7 @@ #include "static_cast_checked.hpp" #include "clsid_game.h" #include "weaponBinocularsVision.h" -#include "ui/UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "ui/UIXmlInit.h" #include "Torch.h" #include "xrNetServer/NET_Messages.h" diff --git a/src/xrGame/WeaponAmmo.cpp b/src/xrGame/WeaponAmmo.cpp index b8afad81f23..9d7027865d5 100644 --- a/src/xrGame/WeaponAmmo.cpp +++ b/src/xrGame/WeaponAmmo.cpp @@ -67,7 +67,7 @@ void CCartridge::Load(LPCSTR section, u8 LocalAmmoType) VERIFY(u16(-1) != bullet_material_idx); VERIFY(param_s.fWallmarkSize > 0); - m_InvShortName = CStringTable().translate(pSettings->r_string(section, "inv_name_short")); + m_InvShortName = StringTable().translate(pSettings->r_string(section, "inv_name_short")); } float CCartridge::Weight() const diff --git a/src/xrGame/WeaponBinoculars.cpp b/src/xrGame/WeaponBinoculars.cpp index 8af0f682c97..8933be25239 100644 --- a/src/xrGame/WeaponBinoculars.cpp +++ b/src/xrGame/WeaponBinoculars.cpp @@ -4,7 +4,7 @@ #include "xr_level_controller.h" #include "Level.h" -#include "ui\UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "WeaponBinocularsVision.h" #include "Common/object_broker.h" #include "inventory.h" diff --git a/src/xrGame/WeaponBinocularsVision.cpp b/src/xrGame/WeaponBinocularsVision.cpp index ebfb4aac2cd..8b313c9b9d8 100644 --- a/src/xrGame/WeaponBinocularsVision.cpp +++ b/src/xrGame/WeaponBinocularsVision.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "WeaponBinocularsVision.h" #include "WeaponBinoculars.h" -#include "ui\UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "entity_alive.h" #include "visual_memory_manager.h" #include "actor.h" diff --git a/src/xrGame/WeaponBinocularsVision.h b/src/xrGame/WeaponBinocularsVision.h index f607193ef30..e0b03cd7660 100644 --- a/src/xrGame/WeaponBinocularsVision.h +++ b/src/xrGame/WeaponBinocularsVision.h @@ -1,5 +1,5 @@ #pragma once -#include "ui\uistatic.h" +#include "xrUICore/Static/UIStatic.h" #include "HudSound.h" class IGameObject; diff --git a/src/xrGame/WeaponMagazined.cpp b/src/xrGame/WeaponMagazined.cpp index 5429c3f8803..68dbc96995e 100644 --- a/src/xrGame/WeaponMagazined.cpp +++ b/src/xrGame/WeaponMagazined.cpp @@ -17,9 +17,9 @@ #include "string_table.h" #include "MPPlayersBag.h" #include "ui/UIXmlInit.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "HudSound.h" @@ -1407,13 +1407,13 @@ bool CWeaponMagazined::GetBriefInfo(II_BriefInfo& info) if (ae != 0 && m_magazine.size() != 0) { LPCSTR ammo_type = m_ammoTypes[m_magazine.back().m_LocalAmmoType].c_str(); - info.name = CStringTable().translate(pSettings->r_string(ammo_type, "inv_name_short")); + info.name = StringTable().translate(pSettings->r_string(ammo_type, "inv_name_short")); info.icon = ammo_type; } else { LPCSTR ammo_type = m_ammoTypes[m_ammoType].c_str(); - info.name = CStringTable().translate(pSettings->r_string(ammo_type, "inv_name_short")); + info.name = StringTable().translate(pSettings->r_string(ammo_type, "inv_name_short")); info.icon = ammo_type; } return true; diff --git a/src/xrGame/WeaponMagazinedWGrenade.cpp b/src/xrGame/WeaponMagazinedWGrenade.cpp index 99712e025dd..4e402f782bb 100644 --- a/src/xrGame/WeaponMagazinedWGrenade.cpp +++ b/src/xrGame/WeaponMagazinedWGrenade.cpp @@ -956,13 +956,13 @@ bool CWeaponMagazinedWGrenade::GetBriefInfo(II_BriefInfo& info) if (ae != 0 && m_magazine.size() != 0) { LPCSTR ammo_type = m_ammoTypes[m_magazine.back().m_LocalAmmoType].c_str(); - info.name._set(CStringTable().translate(pSettings->r_string(ammo_type, "inv_name_short"))); + info.name._set(StringTable().translate(pSettings->r_string(ammo_type, "inv_name_short"))); info.icon._set(ammo_type); } else { LPCSTR ammo_type = m_ammoTypes[m_ammoType].c_str(); - info.name._set(CStringTable().translate(pSettings->r_string(ammo_type, "inv_name_short"))); + info.name._set(StringTable().translate(pSettings->r_string(ammo_type, "inv_name_short"))); info.icon._set(ammo_type); } diff --git a/src/xrGame/actor_communication.cpp b/src/xrGame/actor_communication.cpp index 44fc3a172c4..e3960e2dfbb 100644 --- a/src/xrGame/actor_communication.cpp +++ b/src/xrGame/actor_communication.cpp @@ -20,7 +20,7 @@ #include "ui/UIPdaWnd.h" #include "ui/UITalkWnd.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "encyclopedia_article.h" #include "GameTaskManager.h" #include "GameTaskdefs.h" diff --git a/src/xrGame/ai/crow/ai_crow.cpp b/src/xrGame/ai/crow/ai_crow.cpp index b2625cfa57e..8eb2ada057a 100644 --- a/src/xrGame/ai/crow/ai_crow.cpp +++ b/src/xrGame/ai/crow/ai_crow.cpp @@ -15,7 +15,7 @@ #include "Include/xrRender/Kinematics.h" #include "Include/xrRender/KinematicsAnimated.h" #include "Actor.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "script_game_object.h" #include "hit.h" diff --git a/src/xrGame/ai/monsters/basemonster/base_monster_feel.cpp b/src/xrGame/ai/monsters/basemonster/base_monster_feel.cpp index cc46313447a..4fa81482c07 100644 --- a/src/xrGame/ai/monsters/basemonster/base_monster_feel.cpp +++ b/src/xrGame/ai/monsters/basemonster/base_monster_feel.cpp @@ -14,13 +14,13 @@ #include "Include/xrRender/KinematicsAnimated.h" #include "sound_player.h" #include "Level.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "game_object_space.h" #include "ai_monster_space.h" #include "ai/Monsters/control_animation_base.h" #include "UIGameCustom.h" -#include "UI/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "xrAICore/Navigation/ai_object_location.h" #include "xrEngine/profiler.h" #include "ActorEffector.h" diff --git a/src/xrGame/ai/monsters/controller/controller.cpp b/src/xrGame/ai/monsters/controller/controller.cpp index ed06f04f4fd..0e371096889 100644 --- a/src/xrGame/ai/monsters/controller/controller.cpp +++ b/src/xrGame/ai/monsters/controller/controller.cpp @@ -11,7 +11,7 @@ #include "sound_player.h" #include "ai_monster_space.h" #include "UIGameCustom.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "ai/Monsters/monster_velocity_space.h" #include "level_debug.h" #include "game_object_space.h" diff --git a/src/xrGame/ai/stalker/ai_stalker_debug.cpp b/src/xrGame/ai/stalker/ai_stalker_debug.cpp index f0b30cbff66..1477a7fc3aa 100644 --- a/src/xrGame/ai/stalker/ai_stalker_debug.cpp +++ b/src/xrGame/ai/stalker/ai_stalker_debug.cpp @@ -54,7 +54,7 @@ #include "aimers_weapon.h" #include "aimers_bone.h" #include "smart_cover_planner_target_selector.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "doors_actor.h" #include "xrEngine/GameFont.h" diff --git a/src/xrGame/ai/trader/ai_trader.cpp b/src/xrGame/ai/trader/ai_trader.cpp index f2fcdfd9e52..9c811e530fb 100644 --- a/src/xrGame/ai/trader/ai_trader.cpp +++ b/src/xrGame/ai/trader/ai_trader.cpp @@ -19,7 +19,7 @@ #include "Common/object_broker.h" #include "sound_player.h" #include "Level.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "trader_animation.h" #include "xrServerEntities/clsid_game.h" diff --git a/src/xrGame/ai/trader/trader_animation.cpp b/src/xrGame/ai/trader/trader_animation.cpp index 16c00ac381a..8a1bbfd803a 100644 --- a/src/xrGame/ai/trader/trader_animation.cpp +++ b/src/xrGame/ai/trader/trader_animation.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "trader_animation.h" #include "ai_trader.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/xrGame/alife_storage_manager.cpp b/src/xrGame/alife_storage_manager.cpp index 13fb837fbea..61bbf28ba71 100644 --- a/src/xrGame/alife_storage_manager.cpp +++ b/src/xrGame/alife_storage_manager.cpp @@ -192,7 +192,7 @@ bool CALifeStorageManager::load(LPCSTR save_name_no_check) make_string("%s\nSaved game version mismatch or saved game is corrupted", file_name)); string512 temp; - strconcat(sizeof(temp), temp, CStringTable().translate("st_loading_saved_game").c_str(), + strconcat(sizeof(temp), temp, StringTable().translate("st_loading_saved_game").c_str(), "\"", save_name,SAVE_EXTENSION, "\""); g_pGamePersistent->SetLoadStageTitle(temp); diff --git a/src/xrGame/animation_script_callback.cpp b/src/xrGame/animation_script_callback.cpp index 280efa6b637..884506f319f 100644 --- a/src/xrGame/animation_script_callback.cpp +++ b/src/xrGame/animation_script_callback.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "animation_script_callback.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "gameobject.h" #include "game_object_space.h" #include "Include/xrRender/KinematicsAnimated.h" diff --git a/src/xrGame/attachable_item.cpp b/src/xrGame/attachable_item.cpp index edff3556c76..e8c57f8383b 100644 --- a/src/xrGame/attachable_item.cpp +++ b/src/xrGame/attachable_item.cpp @@ -12,7 +12,7 @@ #include "inventoryowner.h" #include "inventory.h" #include "xrEngine/xr_input.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "xrEngine/GameFont.h" #ifdef DEBUG diff --git a/src/xrGame/client_spawn_manager.h b/src/xrGame/client_spawn_manager.h index 1484dd1c5a7..d9693472f47 100644 --- a/src/xrGame/client_spawn_manager.h +++ b/src/xrGame/client_spawn_manager.h @@ -9,7 +9,7 @@ #pragma once #include "alife_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" class CGameObject; diff --git a/src/xrGame/console_commands.cpp b/src/xrGame/console_commands.cpp index 1938312e62f..5a6fb1d774b 100644 --- a/src/xrGame/console_commands.cpp +++ b/src/xrGame/console_commands.cpp @@ -32,7 +32,7 @@ #include "ui/UIOptConCom.h" #include "UIGameSP.h" #include "ui/UIActorMenu.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "zone_effector.h" #include "GameTask.h" #include "MainMenu.h" @@ -86,7 +86,7 @@ extern BOOL g_ShowAnimationInfo; extern BOOL g_bShowHitSectors; // extern BOOL g_bDebugDumpPhysicsStep ; extern ESingleGameDifficulty g_SingleGameDifficulty; -extern BOOL g_show_wnd_rect2; +XRUICORE_API extern BOOL g_show_wnd_rect2; //----------------------------------------------------------- extern float g_fTimeFactor; extern BOOL b_toggle_weapon_aim; @@ -570,7 +570,7 @@ class CCC_ALifeSave : public IConsole_Command #endif StaticDrawableWrapper* _s = CurrentGameUI()->AddCustomStatic("game_saved", true); LPSTR save_name; - STRCONCAT(save_name, CStringTable().translate("st_game_saved").c_str(), ": ", S); + STRCONCAT(save_name, StringTable().translate("st_game_saved").c_str(), ": ", S); _s->wnd()->TextItemControl()->SetText(save_name); xr_strcat(S, ".dds"); diff --git a/src/xrGame/debug_text_tree.cpp b/src/xrGame/debug_text_tree.cpp index 359a391363a..b20a7313224 100644 --- a/src/xrGame/debug_text_tree.cpp +++ b/src/xrGame/debug_text_tree.cpp @@ -9,7 +9,7 @@ #include "stdafx.h" #include "debug_text_tree.h" #include "Level.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "xrEngine/GameFont.h" namespace debug diff --git a/src/xrGame/doors_door.cpp b/src/xrGame/doors_door.cpp index ca2aad486cf..dce048b2682 100644 --- a/src/xrGame/doors_door.cpp +++ b/src/xrGame/doors_door.cpp @@ -7,7 +7,7 @@ #include "pch_script.h" #include "doors_door.h" #include "physicobject.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "doors.h" #include "doors_actor.h" diff --git a/src/xrGame/encyclopedia_article.cpp b/src/xrGame/encyclopedia_article.cpp index 872c2bc36e9..cab475002fc 100644 --- a/src/xrGame/encyclopedia_article.cpp +++ b/src/xrGame/encyclopedia_article.cpp @@ -5,7 +5,7 @@ #include "stdafx.h" #include "encyclopedia_article.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "ui/UIXmlInit.h" #include "ui/UIInventoryUtilities.h" #include "Common/object_broker.h" diff --git a/src/xrGame/encyclopedia_article.h b/src/xrGame/encyclopedia_article.h index 06a6dcacc7b..06492376ccb 100644 --- a/src/xrGame/encyclopedia_article.h +++ b/src/xrGame/encyclopedia_article.h @@ -9,7 +9,7 @@ #include "xml_str_id_loader.h" #include "shared_data.h" -#include "ui\uistatic.h" +#include "xrUICore/Static/UIStatic.h" ////////////////////////////////////////////////////////////////////////// // SInfoPortionData: данные для InfoProtion diff --git a/src/xrGame/enemy_manager.h b/src/xrGame/enemy_manager.h index 2a2d13a418b..2a8b7199037 100644 --- a/src/xrGame/enemy_manager.h +++ b/src/xrGame/enemy_manager.h @@ -11,7 +11,7 @@ #include "object_manager.h" #include "entity_alive.h" #include "custommonster.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" class CAI_Stalker; diff --git a/src/xrGame/entity_alive.cpp b/src/xrGame/entity_alive.cpp index f11e0e93c47..621c4ce7d73 100644 --- a/src/xrGame/entity_alive.cpp +++ b/src/xrGame/entity_alive.cpp @@ -16,7 +16,7 @@ #include "hit.h" #include "PHDestroyable.h" #include "CharacterPhysicsSupport.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "material_manager.h" #include "game_base_space.h" diff --git a/src/xrGame/file_transfer.cpp b/src/xrGame/file_transfer.cpp index 2364902a26f..966a93b4213 100644 --- a/src/xrGame/file_transfer.cpp +++ b/src/xrGame/file_transfer.cpp @@ -3,7 +3,7 @@ #include "file_transfer.h" #include "Level.h" #include "xrServer.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "xrNetServer/NET_Messages.h" #include "xrCore/buffer_vector.h" #ifdef DEBUG diff --git a/src/xrGame/game_cl_artefacthunt.cpp b/src/xrGame/game_cl_artefacthunt.cpp index 6c85f73a4e5..d562b99a5ff 100644 --- a/src/xrGame/game_cl_artefacthunt.cpp +++ b/src/xrGame/game_cl_artefacthunt.cpp @@ -13,7 +13,7 @@ #include "ui/UIPdaWnd.h" #include "ui/UIMapDesc.h" #include "ui/UIMessageBoxEx.h" -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "xr_level_controller.h" #include "Artefact.h" #include "map_location.h" @@ -163,7 +163,7 @@ void game_cl_ArtefactHunt::net_import_state(NET_Packet& P) void game_cl_ArtefactHunt::TranslateGameMessage(u32 msg, NET_Packet& P) { - CStringTable st; + CStringTable& st = StringTable(); string512 Text; string512 tmp; // LPSTR Color_Teams[3] = {"%c[255,255,255,255]", "%c[255,64,255,64]", "%c[255,64,64,255]"}; @@ -349,7 +349,6 @@ void game_cl_ArtefactHunt::GetMapEntities(xr_vector& dst) void game_cl_ArtefactHunt::shedule_Update(u32 dt) { - CStringTable st; string1024 msg; inherited::shedule_Update(dt); @@ -391,7 +390,7 @@ void game_cl_ArtefactHunt::shedule_Update(u32 dt) { if (!(pCurBuyMenu && pCurBuyMenu->IsShown()) && !(pCurSkinMenu && pCurSkinMenu->IsShown())) { - xr_sprintf(msg, *st.translate("mp_press_to_buy"), "B"); + xr_sprintf(msg, *StringTable().translate("mp_press_to_buy"), "B"); if (m_game_ui) m_game_ui->SetBuyMsgCaption(msg); }; @@ -677,7 +676,6 @@ void game_cl_ArtefactHunt::UpdateMapLocations() bool game_cl_ArtefactHunt::NeedToSendReady_Spectator(int key, game_PlayerState* ps) { - CStringTable st; bool res = (GAME_PHASE_PENDING == Phase() && kWPN_FIRE == key) || ((kJUMP == key) && GAME_PHASE_INPROGRESS == Phase() && CanBeReady()); @@ -692,7 +690,7 @@ bool game_cl_ArtefactHunt::NeedToSendReady_Spectator(int key, game_PlayerState* { string1024 BuySpawnText; xr_sprintf( - BuySpawnText, *st.translate("mp_press_yes2pay"), abs(local_player->money_for_round), abs(m_iSpawn_Cost)); + BuySpawnText, *StringTable().translate("mp_press_yes2pay"), abs(local_player->money_for_round), abs(m_iSpawn_Cost)); m_game_ui->m_pBuySpawnMsgBox->SetText(BuySpawnText); if (m_bTeamSelected && m_bSkinSelected) diff --git a/src/xrGame/game_cl_base.cpp b/src/xrGame/game_cl_base.cpp index 6a4df324fc2..e4f281e1463 100644 --- a/src/xrGame/game_cl_base.cpp +++ b/src/xrGame/game_cl_base.cpp @@ -213,8 +213,6 @@ void game_cl_GameState::net_import_update(NET_Packet& P) void game_cl_GameState::net_signal(NET_Packet& P) {} void game_cl_GameState::TranslateGameMessage(u32 msg, NET_Packet& P) { - CStringTable st; - string512 Text; constexpr char Color_Main[] = "%c[255,192,192,192]"; constexpr pcstr Color_Teams[3] = {"%c[255,255,240,190]", "%c[255,64,255,64]", "%c[255,64,64,255]"}; @@ -241,7 +239,7 @@ void game_cl_GameState::TranslateGameMessage(u32 msg, NET_Packet& P) players.insert(std::make_pair(newClientId, PS)); OnNewPlayerConnected(newClientId); } - xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PS->getName(), Color_Main, *st.translate("mp_connected")); + xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PS->getName(), Color_Main, *StringTable().translate("mp_connected")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); //--------------------------------------- @@ -253,7 +251,7 @@ void game_cl_GameState::TranslateGameMessage(u32 msg, NET_Packet& P) string64 PlayerName; P.r_stringZ(PlayerName); - xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PlayerName, Color_Main, *st.translate("mp_disconnected")); + xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PlayerName, Color_Main, *StringTable().translate("mp_disconnected")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); //--------------------------------------- @@ -265,7 +263,7 @@ void game_cl_GameState::TranslateGameMessage(u32 msg, NET_Packet& P) string64 PlayerName; P.r_stringZ(PlayerName); - xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PlayerName, Color_Main, *st.translate("mp_entered_game")); + xr_sprintf(Text, "%s%s %s%s", Color_Teams[0], PlayerName, Color_Main, *StringTable().translate("mp_entered_game")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); } diff --git a/src/xrGame/game_cl_capture_the_artefact.cpp b/src/xrGame/game_cl_capture_the_artefact.cpp index 01b8e8c8a77..855695be67d 100644 --- a/src/xrGame/game_cl_capture_the_artefact.cpp +++ b/src/xrGame/game_cl_capture_the_artefact.cpp @@ -251,7 +251,7 @@ void game_cl_CaptureTheArtefact::UpdateMoneyIndicator() void game_cl_CaptureTheArtefact::TranslateGameMessage(u32 msg, NET_Packet& P) { - CStringTable st; + CStringTable& st = StringTable(); string1024 Text; // string512 tmp; // LPSTR Color_Teams[3] = {"%c[255,255,255,255]", "%c[255,64,255,64]", "%c[255,64,64,255]"}; @@ -1087,7 +1087,6 @@ bool game_cl_CaptureTheArtefact::NeedToSendReady_Actor(int key, game_PlayerState bool game_cl_CaptureTheArtefact::NeedToSendReady_Spectator(int key, game_PlayerState* ps) { - CStringTable st; bool res = inherited::NeedToSendReady_Spectator(key, ps); u32 gphase = Phase(); if ((gphase == GAME_PHASE_INPROGRESS) && (key == kJUMP) && (!m_game_ui->IsBuySpawnShown())) @@ -1238,8 +1237,6 @@ void game_cl_CaptureTheArtefact::OnVoteStart(NET_Packet& P) if (!m_game_ui) return; - CStringTable st; - u32 psize = P.B.count + 1; char* command = static_cast(_alloca(psize)); char* player = static_cast(_alloca(psize)); @@ -1289,7 +1286,7 @@ void game_cl_CaptureTheArtefact::OnVoteStart(NET_Packet& P) { if (!xr_strcmp(cmd_name, ttable[i][0])) { - pcstr ted_str = st.translate(ttable[i][1]).c_str(); + pcstr ted_str = StringTable().translate(ttable[i][1]).c_str(); VERIFY(ted_str); tcmd_len = xr_strlen(ted_str) + 1; tcmd_name = static_cast(_alloca(tcmd_len)); @@ -1310,9 +1307,9 @@ void game_cl_CaptureTheArtefact::OnVoteStart(NET_Packet& P) Msg("---Next cat iteration state: %s", vstr); #endif xr_strcat(vstr, vstr_size, " "); - xr_strcat(vstr, vstr_size, st.translate(args[i]).c_str()); + xr_strcat(vstr, vstr_size, StringTable().translate(args[i]).c_str()); } - pcstr t_vote_str = st.translate("mp_voting_started").c_str(); + pcstr t_vote_str = StringTable().translate("mp_voting_started").c_str(); VERIFY(t_vote_str); u32 fin_str_size = xr_strlen(t_vote_str) + vstr_size + xr_strlen(player) + 1; char* fin_str = static_cast(_alloca(fin_str_size)); @@ -1356,7 +1353,6 @@ void game_cl_CaptureTheArtefact::UpdateVotingTime(u32 current_time) { if (IsVotingEnabled() && IsVotingActive() && (m_dwVoteEndTime >= current_time)) { - CStringTable st; u32 TimeLeft = m_dwVoteEndTime - current_time; string1024 VoteTimeResStr; u32 SecsLeft = (TimeLeft % 60000) / 1000; @@ -1372,7 +1368,7 @@ void game_cl_CaptureTheArtefact::UpdateVotingTime(u32 current_time) NumAgreed++; } - xr_sprintf(VoteTimeResStr, st.translate("mp_timeleft").c_str(), MinitsLeft, SecsLeft, + xr_sprintf(VoteTimeResStr, StringTable().translate("mp_timeleft").c_str(), MinitsLeft, SecsLeft, float(NumAgreed) / players.size()); if (m_game_ui) m_game_ui->SetVoteTimeResultMsg(VoteTimeResStr); diff --git a/src/xrGame/game_cl_capture_the_artefact_captions_manager.cpp b/src/xrGame/game_cl_capture_the_artefact_captions_manager.cpp index a6d7b4d35f2..864fdfbe088 100644 --- a/src/xrGame/game_cl_capture_the_artefact_captions_manager.cpp +++ b/src/xrGame/game_cl_capture_the_artefact_captions_manager.cpp @@ -49,7 +49,6 @@ void CTAGameClCaptionsManager::ShowInProgressCaptions() if (!control_entity) return; - CStringTable st; if (ps->team == static_cast(etSpectatorsTeam)) { VERIFY(smart_cast(control_entity)); @@ -98,11 +97,10 @@ void CTAGameClCaptionsManager::ShowPendingCaptions() {} void CTAGameClCaptionsManager::ShowScoreCaptions() { VERIFY(m_winner_team != etSpectatorsTeam); - CStringTable st; LPCSTR team_name = CTeamInfo::GetTeam_name(m_winner_team + 1); - u32 win_str_size = st.translate("mp_team_wins").size() + xr_strlen(team_name) + 1; + u32 win_str_size = StringTable().translate("mp_team_wins").size() + xr_strlen(team_name) + 1; char* win_str = static_cast(_alloca(win_str_size)); - xr_sprintf(win_str, win_str_size, st.translate("mp_team_wins").c_str(), team_name); + xr_sprintf(win_str, win_str_size, StringTable().translate("mp_team_wins").c_str(), team_name); parent_game_ui->SetRoundResultCaption(win_str); } @@ -176,7 +174,7 @@ u32 CTAGameClCaptionsManager::SetWarmupTime(u32 current_warmup_time, u32 current u32 time_remains = current_warmup_time - current_time; string64 time_str; - CStringTable st; + CStringTable& st = StringTable(); ConvertTime2String(time_str, time_remains); warmup_message[0] = 0; // bad style diff --git a/src/xrGame/game_cl_capture_the_artefact_messages_menu.cpp b/src/xrGame/game_cl_capture_the_artefact_messages_menu.cpp index e8e9e77c043..f71c827dd02 100644 --- a/src/xrGame/game_cl_capture_the_artefact_messages_menu.cpp +++ b/src/xrGame/game_cl_capture_the_artefact_messages_menu.cpp @@ -30,9 +30,8 @@ void game_cl_CaptureTheArtefact::OnSpeechMessage(NET_Packet& P) if (ps->team == local_player->team) { - CStringTable st; if (CurrentGameUI()) - CurrentGameUI()->m_pMessagesWnd->AddChatMessage(*st.translate(*(pMMessage->pMessage)), ps->getName()); + CurrentGameUI()->m_pMessagesWnd->AddChatMessage(*StringTable().translate(*(pMMessage->pMessage)), ps->getName()); if (!Level().MapManager().HasMapLocation(FRIEND_RADION_LOCATION, ps->GameID)) { @@ -60,7 +59,7 @@ void game_cl_CaptureTheArtefact::OnSpeechMessage(NET_Packet& P) { pMSound->mSound_Radio.play_at_pos(NULL, Fvector().set(0, 0, 0), sm_2D, 0); } - Msg("%s said: %s", ps->getName(), *CStringTable().translate(pMMessage->pMessage)); + Msg("%s said: %s", ps->getName(), *StringTable().translate(pMMessage->pMessage)); } else { diff --git a/src/xrGame/game_cl_deathmatch.cpp b/src/xrGame/game_cl_deathmatch.cpp index c9235a54291..4eb1cdf8078 100644 --- a/src/xrGame/game_cl_deathmatch.cpp +++ b/src/xrGame/game_cl_deathmatch.cpp @@ -440,7 +440,7 @@ void game_cl_Deathmatch::OnConnected() void game_cl_Deathmatch::shedule_Update(u32 dt) { - CStringTable st; + CStringTable& st = StringTable(); inherited::shedule_Update(dt); @@ -800,7 +800,7 @@ bool game_cl_Deathmatch::OnKeyboardRelease(int key) #define MAX_VOTE_PARAMS 5 void game_cl_Deathmatch::OnVoteStart(NET_Packet& P) { - CStringTable st; + CStringTable& st = StringTable(); inherited::OnVoteStart(P); string1024 Command = ""; diff --git a/src/xrGame/game_cl_mp.cpp b/src/xrGame/game_cl_mp.cpp index 81711d07590..30eec354bef 100644 --- a/src/xrGame/game_cl_mp.cpp +++ b/src/xrGame/game_cl_mp.cpp @@ -14,8 +14,8 @@ #include "ui/UIChatWnd.h" #include "ui/UIGameLog.h" #include "ui/UIMainIngameWnd.h" -#include "ui/UIStatic.h" -#include "ui/UITextureMaster.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/XML/UITextureMaster.h" #include "ui/UIVotingCategory.h" #include "ui/UIMPAdminMenu.h" #include "ui/UIVote.h" @@ -164,7 +164,6 @@ bool game_cl_mp::OnKeyboardPress(int key) if (inherited::OnKeyboardPress(key)) return true; - CStringTable st; if (kJUMP == key || kWPN_FIRE == key) { bool b_need_to_send_ready = false; @@ -225,7 +224,7 @@ bool game_cl_mp::OnKeyboardPress(int key) R_ASSERT(!pChatWnd->IsShown()); string512 prefix; xr_sprintf( - prefix, "%s> ", st.translate((kCHAT_TEAM == key) ? "st_mp_say_to_team" : "st_mp_say_to_all").c_str()); + prefix, "%s> ", StringTable().translate((kCHAT_TEAM == key) ? "st_mp_say_to_team" : "st_mp_say_to_all").c_str()); pChatWnd->ChatToAll(kCHAT == key); pChatWnd->SetEditBoxPrefix(prefix); pChatWnd->ShowDialog(false); @@ -249,7 +248,7 @@ bool game_cl_mp::OnKeyboardPress(int key) VotingBegin(); else OnCantVoteMsg( - st.translate((IsVotingEnabled()) ? "st_mp_only_one_voting" : "st_mp_disabled_voting").c_str()); + StringTable().translate((IsVotingEnabled()) ? "st_mp_only_one_voting" : "st_mp_disabled_voting").c_str()); } break; case kVOTE: @@ -259,9 +258,9 @@ bool game_cl_mp::OnKeyboardPress(int key) else { if (!IsVotingEnabled()) - OnCantVoteMsg(st.translate("st_mp_disabled_voting").c_str()); + OnCantVoteMsg(StringTable().translate("st_mp_disabled_voting").c_str()); else - OnCantVoteMsg(st.translate("st_mp_no_current_voting").c_str()); + OnCantVoteMsg(StringTable().translate("st_mp_no_current_voting").c_str()); } } break; @@ -347,7 +346,6 @@ constexpr char Color_Green[] = "%c[255,1,255,1]"; void game_cl_mp::TranslateGameMessage(u32 msg, NET_Packet& P) { string4096 Text; - CStringTable st; switch (msg) { @@ -358,7 +356,7 @@ void game_cl_mp::TranslateGameMessage(u32 msg, NET_Packet& P) break; case GAME_EVENT_VOTE_START: { - xr_sprintf(Text, "%s%s", Color_Main, *st.translate("mp_voting_started_msg")); + xr_sprintf(Text, "%s%s", Color_Main, *StringTable().translate("mp_voting_started_msg")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); OnVoteStart(P); @@ -366,7 +364,7 @@ void game_cl_mp::TranslateGameMessage(u32 msg, NET_Packet& P) break; case GAME_EVENT_VOTE_STOP: { - xr_sprintf(Text, "%s%s", Color_Main, *st.translate("mp_voting_broken")); + xr_sprintf(Text, "%s%s", Color_Main, *StringTable().translate("mp_voting_broken")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); @@ -377,7 +375,7 @@ void game_cl_mp::TranslateGameMessage(u32 msg, NET_Packet& P) { string4096 Reason; P.r_stringZ(Reason); - xr_sprintf(Text, "%s%s", Color_Main, *st.translate(Reason)); + xr_sprintf(Text, "%s%s", Color_Main, *StringTable().translate(Reason)); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); OnVoteEnd(P); @@ -414,7 +412,7 @@ void game_cl_mp::TranslateGameMessage(u32 msg, NET_Packet& P) { string1024 mess; P.r_stringZ(mess); - xr_sprintf(Text, "%s%s", Color_Red, *st.translate(mess)); + xr_sprintf(Text, "%s%s", Color_Red, *StringTable().translate(mess)); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); } @@ -539,12 +537,11 @@ void game_cl_mp::OnChatMessage(NET_Packet* P) P->r_s16(team); ///#ifdef DEBUG - CStringTable st; switch (team) { - case 0: Msg("%s: %s : %s", *st.translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; - case 1: Msg("- %s: %s : %s", *st.translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; - case 2: Msg("@ %s: %s : %s", *st.translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; + case 0: Msg("%s: %s : %s", *StringTable().translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; + case 1: Msg("- %s: %s : %s", *StringTable().translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; + case 2: Msg("@ %s: %s : %s", *StringTable().translate("mp_chat"), PlayerName.c_str(), ChatMsg.c_str()); break; } //#endif @@ -682,11 +679,10 @@ void game_cl_mp::OnPlayerVoted(game_PlayerState* ps) if (ps->m_bCurrentVoteAgreed == 2) return; - CStringTable st; string1024 resStr; xr_sprintf(resStr, "%s\"%s\" %s%s %s\"%s\"", Color_Teams[ps->team], ps->getName(), Color_Main, - *st.translate("mp_voted"), ps->m_bCurrentVoteAgreed ? Color_Green : Color_Red, - *st.translate(ps->m_bCurrentVoteAgreed ? "mp_voted_yes" : "mp_voted_no")); + *StringTable().translate("mp_voted"), ps->m_bCurrentVoteAgreed ? Color_Green : Color_Red, + *StringTable().translate(ps->m_bCurrentVoteAgreed ? "mp_voted_yes" : "mp_voted_no")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(resStr); } @@ -823,7 +819,6 @@ const ui_shader& game_cl_mp::GetRankIconsShader() void game_cl_mp::OnPlayerKilled(NET_Packet& P) { - CStringTable st; //----------------------------------------------------------- KILL_TYPE KillType = KILL_TYPE(P.r_u8()); u16 KilledID = P.r_u16(); @@ -874,13 +869,13 @@ void game_cl_mp::OnPlayerKilled(NET_Packet& P) KMS.m_initiator.m_rect.y1 = 202; KMS.m_initiator.m_rect.x2 = KMS.m_initiator.m_rect.x1 + 31; KMS.m_initiator.m_rect.y2 = KMS.m_initiator.m_rect.y1 + 30; - xr_sprintf(sWeapon, *st.translate("mp_by_explosion")); + xr_sprintf(sWeapon, *StringTable().translate("mp_by_explosion")); } else { KMS.m_initiator.m_rect = pIItem->GetKillMsgRect(); KMS.m_initiator.m_rect.rb.add(KMS.m_initiator.m_rect.lt); - xr_sprintf(sWeapon, "%s %s", st.translate("mp_from").c_str(), pIItem->NameShort()); + xr_sprintf(sWeapon, "%s %s", StringTable().translate("mp_from").c_str(), pIItem->NameShort()); } } else @@ -893,7 +888,7 @@ void game_cl_mp::OnPlayerKilled(NET_Packet& P) KMS.m_initiator.m_rect.y1 = 202; KMS.m_initiator.m_rect.x2 = KMS.m_initiator.m_rect.x1 + 31; KMS.m_initiator.m_rect.y2 = KMS.m_initiator.m_rect.y1 + 30; - xr_sprintf(sWeapon, *st.translate("mp_by_anomaly")); + xr_sprintf(sWeapon, *StringTable().translate("mp_by_anomaly")); } } } @@ -949,7 +944,7 @@ void game_cl_mp::OnPlayerKilled(NET_Packet& P) KMS.m_ext_info.m_rect.y2 = pBS->IconRects[0].y1 + pBS->IconRects[0].y2; }; - xr_sprintf(sSpecial, *st.translate("mp_with_headshot")); + xr_sprintf(sSpecial, *StringTable().translate("mp_with_headshot")); if (pOKiller && pOKiller == Level().CurrentViewEntity()) PlaySndMessage(ID_HEADSHOT); @@ -968,7 +963,7 @@ void game_cl_mp::OnPlayerKilled(NET_Packet& P) KMS.m_ext_info.m_rect.y2 = pBS->IconRects[0].y1 + pBS->IconRects[0].y2; }; - xr_sprintf(sSpecial, *st.translate("mp_with_eyeshot")); + xr_sprintf(sSpecial, *StringTable().translate("mp_with_eyeshot")); if (pOKiller && pOKiller == Level().CurrentViewEntity()) PlaySndMessage(ID_ASSASSIN); @@ -987,7 +982,7 @@ void game_cl_mp::OnPlayerKilled(NET_Packet& P) KMS.m_ext_info.m_rect.y2 = pBS->IconRects[0].y1 + pBS->IconRects[0].y2; }; - xr_sprintf(sSpecial, *st.translate("mp_with_backstab")); + xr_sprintf(sSpecial, *StringTable().translate("mp_with_backstab")); if (pOKiller && pOKiller == Level().CurrentViewEntity()) PlaySndMessage(ID_ASSASSIN); } @@ -1075,8 +1070,6 @@ extern void WritePlayerName_ToRegistry(LPSTR name); void game_cl_mp::OnPlayerChangeName(NET_Packet& P) { - CStringTable st; - u16 ObjID = P.r_u16(); s16 Team = P.r_s16(); string1024 OldName, NewName; @@ -1084,7 +1077,7 @@ void game_cl_mp::OnPlayerChangeName(NET_Packet& P) P.r_stringZ(NewName); string1024 resStr; - xr_sprintf(resStr, "%s\"%s\" %s%s %s\"%s\"", Color_Teams[Team], OldName, Color_Main, *st.translate("mp_is_now"), + xr_sprintf(resStr, "%s\"%s\" %s%s %s\"%s\"", Color_Teams[Team], OldName, Color_Main, *StringTable().translate("mp_is_now"), Color_Teams[Team], NewName); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(resStr); @@ -1113,12 +1106,11 @@ void game_cl_mp::LoadSndMessages() void game_cl_mp::OnRankChanged(u8 OldRank) { - CStringTable st; string256 tmp; string1024 RankStr; xr_sprintf(tmp, "rank_%d", local_player->rank); - xr_sprintf(RankStr, "%s : %s", *st.translate("mp_your_rank"), - *st.translate(READ_IF_EXISTS(pSettings, r_string, tmp, "rank_name", ""))); + xr_sprintf(RankStr, "%s : %s", *StringTable().translate("mp_your_rank"), + *StringTable().translate(READ_IF_EXISTS(pSettings, r_string, tmp, "rank_name", ""))); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(RankStr); #ifdef DEBUG @@ -1327,8 +1319,7 @@ void game_cl_mp::OnGameRoundStarted() { // xr_sprintf(Text, "%sRound started !!!",Color_Main); string512 Text; - CStringTable st; - xr_sprintf(Text, "%s%s", Color_Main, *st.translate("mp_match_started")); + xr_sprintf(Text, "%s%s", Color_Main, *StringTable().translate("mp_match_started")); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); OnSwitchPhase_InProgress(); diff --git a/src/xrGame/game_cl_mp.h b/src/xrGame/game_cl_mp.h index 6dae99f44d8..aafe618b4b3 100644 --- a/src/xrGame/game_cl_mp.h +++ b/src/xrGame/game_cl_mp.h @@ -1,7 +1,7 @@ #pragma once #include "game_cl_base.h" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" #include "Spectator.h" #include "file_transfer.h" #include "screenshot_manager.h" diff --git a/src/xrGame/game_cl_mp_messages_menu.cpp b/src/xrGame/game_cl_mp_messages_menu.cpp index 6b2bfdebbca..a495647721e 100644 --- a/src/xrGame/game_cl_mp_messages_menu.cpp +++ b/src/xrGame/game_cl_mp_messages_menu.cpp @@ -174,10 +174,9 @@ void game_cl_mp::OnSpeechMessage(NET_Packet& P) if (ps->team == local_player->team) { - CStringTable st; if (CurrentGameUI()) CurrentGameUI()->m_pMessagesWnd->AddChatMessage( - st.translate(pMMessage->pMessage.c_str()).c_str(), ps->getName()); + StringTable().translate(pMMessage->pMessage.c_str()).c_str(), ps->getName()); if (!Level().MapManager().HasMapLocation(FRIEND_RADION_LOCATION, ps->GameID)) { @@ -203,7 +202,7 @@ void game_cl_mp::OnSpeechMessage(NET_Packet& P) { pMSound->mSound_Radio.play_at_pos(NULL, Fvector().set(0, 0, 0), sm_2D, 0); } - Msg("%s said: %s", ps->getName(), *CStringTable().translate(pMMessage->pMessage)); + Msg("%s said: %s", ps->getName(), *StringTable().translate(pMMessage->pMessage)); } else { diff --git a/src/xrGame/game_cl_teamdeathmatch.cpp b/src/xrGame/game_cl_teamdeathmatch.cpp index 8217e142db9..1690ad8df93 100644 --- a/src/xrGame/game_cl_teamdeathmatch.cpp +++ b/src/xrGame/game_cl_teamdeathmatch.cpp @@ -109,7 +109,6 @@ void game_cl_TeamDeathmatch::net_import_state(NET_Packet& P) } void game_cl_TeamDeathmatch::TranslateGameMessage(u32 msg, NET_Packet& P) { - CStringTable st; string512 Text; // LPSTR Color_Teams[3] = {"%c[255,255,255,255]", "%c[255,64,255,64]", "%c[255,64,64,255]"}; char Color_Main[] = "%c[255,192,192,192]"; @@ -126,12 +125,12 @@ void game_cl_TeamDeathmatch::TranslateGameMessage(u32 msg, NET_Packet& P) xr_sprintf(Text, "%s%s %s%s %s%s", "", // no color - PlayerName, Color_Main, *st.translate("mp_joined"), CTeamInfo::GetTeam_color_tag(int(Team)), + PlayerName, Color_Main, *StringTable().translate("mp_joined"), CTeamInfo::GetTeam_color_tag(int(Team)), CTeamInfo::GetTeam_name(int(Team))); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); //--------------------------------------- - Msg("%s %s %s", PlayerName, *st.translate("mp_joined"), CTeamInfo::GetTeam_name(int(Team))); + Msg("%s %s %s", PlayerName, *StringTable().translate("mp_joined"), CTeamInfo::GetTeam_name(int(Team))); } break; @@ -147,12 +146,12 @@ void game_cl_TeamDeathmatch::TranslateGameMessage(u32 msg, NET_Packet& P) break; xr_sprintf(Text, "%s%s %s%s %s%s", CTeamInfo::GetTeam_color_tag(int(OldTeam)), pPlayer->getName(), Color_Main, - *st.translate("mp_switched_to"), CTeamInfo::GetTeam_color_tag(int(NewTeam)), + *StringTable().translate("mp_switched_to"), CTeamInfo::GetTeam_color_tag(int(NewTeam)), CTeamInfo::GetTeam_name(int(NewTeam))); if (CurrentGameUI()) CurrentGameUI()->CommonMessageOut(Text); //--------------------------------------- - Msg("%s *s %s", pPlayer->getName(), *st.translate("mp_switched_to"), CTeamInfo::GetTeam_name(int(NewTeam))); + Msg("%s *s %s", pPlayer->getName(), *StringTable().translate("mp_switched_to"), CTeamInfo::GetTeam_name(int(NewTeam))); } break; @@ -392,7 +391,6 @@ pcstr game_cl_TeamDeathmatch::getTeamSection(int Team) void game_cl_TeamDeathmatch::shedule_Update(u32 dt) { - CStringTable st; string512 msg; inherited::shedule_Update(dt); @@ -412,7 +410,7 @@ void game_cl_TeamDeathmatch::shedule_Update(u32 dt) { case GAME_PHASE_TEAM1_SCORES: { - xr_sprintf(msg, st.translate("mp_team_wins").c_str(), CTeamInfo::GetTeam_name(1)); + xr_sprintf(msg, StringTable().translate("mp_team_wins").c_str(), CTeamInfo::GetTeam_name(1)); m_game_ui->SetRoundResultCaption(msg); m_game_ui->UpdateTeamPanels(); @@ -423,7 +421,7 @@ void game_cl_TeamDeathmatch::shedule_Update(u32 dt) break; case GAME_PHASE_TEAM2_SCORES: { - xr_sprintf(msg, st.translate("mp_team_wins").c_str(), CTeamInfo::GetTeam_name(2)); + xr_sprintf(msg, StringTable().translate("mp_team_wins").c_str(), CTeamInfo::GetTeam_name(2)); m_game_ui->SetRoundResultCaption(msg); m_game_ui->UpdateTeamPanels(); @@ -451,7 +449,7 @@ void game_cl_TeamDeathmatch::shedule_Update(u32 dt) !local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD)) { string1024 msg; - xr_sprintf(msg, *st.translate("mp_press_to_buy"), "B"); + xr_sprintf(msg, *StringTable().translate("mp_press_to_buy"), "B"); if (m_game_ui) m_game_ui->SetBuyMsgCaption(msg); m_bBuyEnabled = true; diff --git a/src/xrGame/game_news.h b/src/xrGame/game_news.h index 904598fca6f..bd0e16e60a5 100644 --- a/src/xrGame/game_news.h +++ b/src/xrGame/game_news.h @@ -1,7 +1,7 @@ #pragma once #include "alife_space.h" -#include "string_table_defs.h" +#include "xrEngine/StringTable/IStringTableDefs.h" #include "Common/object_interfaces.h" #define DEFAULT_NEWS_SHOW_TIME 5000 diff --git a/src/xrGame/game_sv_base.cpp b/src/xrGame/game_sv_base.cpp index ca0dc86256f..0756f5ff8cb 100644 --- a/src/xrGame/game_sv_base.cpp +++ b/src/xrGame/game_sv_base.cpp @@ -968,15 +968,14 @@ void game_sv_GameState::MapRotation_ListMaps() Msg("- Currently there are no any maps in list."); return; } - CStringTable st; Msg("- ----------- Maps ---------------"); for (u32 i = 0; i < m_pMapRotation_List.size(); i++) { SMapRot& R = m_pMapRotation_List[i]; if (i == 0) - Msg("~ %d. %s (%s) (current)", i + 1, st.translate(R.map_name).c_str(), R.map_name.c_str()); + Msg("~ %d. %s (%s) (current)", i + 1, StringTable().translate(R.map_name).c_str(), R.map_name.c_str()); else - Msg(" %d. %s (%s)", i + 1, st.translate(R.map_name).c_str(), R.map_name.c_str()); + Msg(" %d. %s (%s)", i + 1, StringTable().translate(R.map_name).c_str(), R.map_name.c_str()); } Msg("- --------------------------------"); }; diff --git a/src/xrGame/game_sv_capture_the_artefact.cpp b/src/xrGame/game_sv_capture_the_artefact.cpp index 3c0f4643bed..877efc44f2b 100644 --- a/src/xrGame/game_sv_capture_the_artefact.cpp +++ b/src/xrGame/game_sv_capture_the_artefact.cpp @@ -1383,7 +1383,7 @@ bool game_sv_CaptureTheArtefact::OnKillResult(KILL_RES KillResult, game_PlayerSt if (tmp_client) { LPSTR reason; - STRCONCAT(reason, CStringTable().translate("st_kicked_by_server").c_str()); + STRCONCAT(reason, StringTable().translate("st_kicked_by_server").c_str()); m_server->DisconnectClient(tmp_client, reason); } } diff --git a/src/xrGame/game_sv_mp.cpp b/src/xrGame/game_sv_mp.cpp index ba705430f04..0b49085e172 100644 --- a/src/xrGame/game_sv_mp.cpp +++ b/src/xrGame/game_sv_mp.cpp @@ -1928,10 +1928,10 @@ void game_sv_mp::DumpOnlineStatistic() ini.w_u32(current_section.c_str(), "players_total_cnt", m_server->GetClientsCount()); - xr_sprintf(str_buff, "\"%s\"", CStringTable().translate(Level().name().c_str()).c_str()); + xr_sprintf(str_buff, "\"%s\"", StringTable().translate(Level().name().c_str()).c_str()); ini.w_string(current_section.c_str(), "current_map_name", str_buff); - xr_sprintf(str_buff, "%s", CStringTable().translate(type_name()).c_str()); + xr_sprintf(str_buff, "%s", StringTable().translate(type_name()).c_str()); ini.w_string(current_section.c_str(), "game_mode", str_buff); auto it = m_pMapRotation_List.begin(); @@ -1940,7 +1940,7 @@ void game_sv_mp::DumpOnlineStatistic() { string16 num_buf; xr_sprintf(num_buf, "%d", idx); - xr_sprintf(str_buff, "\"%s\"", CStringTable().translate((*it).map_name.c_str()).c_str()); + xr_sprintf(str_buff, "\"%s\"", StringTable().translate((*it).map_name.c_str()).c_str()); ini.w_string("map_rotation", num_buf, str_buff); } @@ -2130,10 +2130,10 @@ void game_sv_mp::DumpRoundStatistics() timestamp(str_current_time); ini.w_string(current_section.c_str(), "end_time", str_current_time); - xr_sprintf(str_buff, "%s", CStringTable().translate(type_name()).c_str()); + xr_sprintf(str_buff, "%s", StringTable().translate(type_name()).c_str()); ini.w_string(current_section.c_str(), "game_mode", str_buff); - xr_sprintf(str_buff, "\"%s\"", CStringTable().translate(Level().name().c_str()).c_str()); + xr_sprintf(str_buff, "\"%s\"", StringTable().translate(Level().name().c_str()).c_str()); ini.w_string(current_section.c_str(), "current_map_name", str_buff); xr_sprintf(str_buff, "\"%s\"", Level().name().c_str()); diff --git a/src/xrGame/game_sv_teamdeathmatch.cpp b/src/xrGame/game_sv_teamdeathmatch.cpp index 1ae9c0bf54d..91188f6fde0 100644 --- a/src/xrGame/game_sv_teamdeathmatch.cpp +++ b/src/xrGame/game_sv_teamdeathmatch.cpp @@ -413,7 +413,7 @@ void game_sv_TeamDeathmatch::OnPlayerKillPlayer(game_PlayerState* ps_killer, gam Msg("--- Kicking player %s", tmp_client->ps->getName()); #endif LPSTR reason; - STRCONCAT(reason, CStringTable().translate("st_kicked_by_server").c_str()); + STRCONCAT(reason, StringTable().translate("st_kicked_by_server").c_str()); m_server->DisconnectClient(tmp_client, reason); } } diff --git a/src/xrGame/hit_memory_manager.cpp b/src/xrGame/hit_memory_manager.cpp index 27db4d6034a..2befd17922f 100644 --- a/src/xrGame/hit_memory_manager.cpp +++ b/src/xrGame/hit_memory_manager.cpp @@ -12,7 +12,7 @@ #include "custommonster.h" #include "xrAICore/Navigation/ai_object_location.h" #include "xrAICore/Navigation/level_graph.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "agent_manager.h" #include "agent_member_manager.h" diff --git a/src/xrGame/inventory_item.cpp b/src/xrGame/inventory_item.cpp index d3e853df966..e2e4726f7fd 100644 --- a/src/xrGame/inventory_item.cpp +++ b/src/xrGame/inventory_item.cpp @@ -93,8 +93,8 @@ void CInventoryItem::Load(LPCSTR section) self->GetSpatialData().type |= STYPE_VISIBLEFORAI; m_section_id._set(section); - m_name = CStringTable().translate(pSettings->r_string(section, "inv_name")); - m_nameShort = CStringTable().translate(pSettings->r_string(section, "inv_name_short")); + m_name = StringTable().translate(pSettings->r_string(section, "inv_name")); + m_nameShort = StringTable().translate(pSettings->r_string(section, "inv_name_short")); m_weight = pSettings->r_float(section, "inv_weight"); R_ASSERT(m_weight >= 0.f); @@ -103,7 +103,7 @@ void CInventoryItem::Load(LPCSTR section) u32 sl = pSettings->r_u32(section, "slot"); m_ItemCurrPlace.base_slot_id = (sl == -1) ? 0 : (sl + 1); - m_Description = CStringTable().translate(pSettings->r_string(section, "description")); + m_Description = StringTable().translate(pSettings->r_string(section, "description")); m_flags.set(Fbelt, READ_IF_EXISTS(pSettings, r_bool, section, "belt", FALSE)); m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE); diff --git a/src/xrGame/inventory_owner_info.cpp b/src/xrGame/inventory_owner_info.cpp index 498bdcd7c56..dafc764a4ad 100644 --- a/src/xrGame/inventory_owner_info.cpp +++ b/src/xrGame/inventory_owner_info.cpp @@ -15,7 +15,7 @@ #include "Level.h" #include "infoportion.h" #include "alife_registry_wrappers.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" void CInventoryOwner::OnEvent(NET_Packet& P, u16 type) diff --git a/src/xrGame/inventory_upgrade.cpp b/src/xrGame/inventory_upgrade.cpp index 48159912728..90f2c91b761 100644 --- a/src/xrGame/inventory_upgrade.cpp +++ b/src/xrGame/inventory_upgrade.cpp @@ -29,8 +29,8 @@ void Upgrade::construct(const shared_str& upgrade_id, Group& parental_group, Man m_parent_group = &parental_group; // name : StringTable(); icon; description; - m_name = CStringTable().translate(pSettings->r_string(id(), "name")); - m_description = CStringTable().translate(pSettings->r_string(id(), "description")); + m_name = StringTable().translate(pSettings->r_string(id(), "name")); + m_description = StringTable().translate(pSettings->r_string(id(), "description")); m_icon._set(pSettings->r_string(id(), "icon")); // section -------------------------------------------------------------------------- diff --git a/src/xrGame/inventory_upgrade_property.cpp b/src/xrGame/inventory_upgrade_property.cpp index cc7db0ef667..270bdc11a96 100644 --- a/src/xrGame/inventory_upgrade_property.cpp +++ b/src/xrGame/inventory_upgrade_property.cpp @@ -26,7 +26,7 @@ void Property::construct(shared_str const& property_id, Manager& manager_r) VERIFY2( pSettings->section_exist(m_id), make_string("Section of upgrade property [%s] does not exist!", m_id.c_str())); - m_name = CStringTable().translate(pSettings->r_string(id(), "name")); + m_name = StringTable().translate(pSettings->r_string(id(), "name")); m_icon._set(pSettings->r_string(id(), "icon")); // functor diff --git a/src/xrGame/level_debug.cpp b/src/xrGame/level_debug.cpp index df3def0bb9b..e22e379bcb3 100644 --- a/src/xrGame/level_debug.cpp +++ b/src/xrGame/level_debug.cpp @@ -9,7 +9,7 @@ // Lain: added #include "debug_text_tree.h" #include "ai/monsters/basemonster/base_monster.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #endif #ifdef DEBUG diff --git a/src/xrGame/level_script.cpp b/src/xrGame/level_script.cpp index ca494f52bc8..68b21adb9a4 100644 --- a/src/xrGame/level_script.cpp +++ b/src/xrGame/level_script.cpp @@ -573,7 +573,7 @@ void stop_tutorial() g_tutorial->Stop(); } -LPCSTR translate_string(LPCSTR str) { return *CStringTable().translate(str); } +LPCSTR translate_string(LPCSTR str) { return *StringTable().translate(str); } bool has_active_tutotial() { return (g_tutorial != NULL); } //Alundaio: namespace level exports extension diff --git a/src/xrGame/map_location.cpp b/src/xrGame/map_location.cpp index 1d064e1bb0e..e5e29c73577 100644 --- a/src/xrGame/map_location.cpp +++ b/src/xrGame/map_location.cpp @@ -621,7 +621,7 @@ LPCSTR CMapLocation::GetHint() { return NULL; } - return CStringTable().translate(m_hint).c_str(); + return StringTable().translate(m_hint).c_str(); }; CMapSpotPointer* CMapLocation::GetSpotPointer(CMapSpot* sp) diff --git a/src/xrGame/map_manager.cpp b/src/xrGame/map_manager.cpp index 7cfa9b3cae2..91ef1d68759 100644 --- a/src/xrGame/map_manager.cpp +++ b/src/xrGame/map_manager.cpp @@ -10,7 +10,7 @@ #include "GameTaskManager.h" #include "xrServer.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" struct FindLocationBySpotID { diff --git a/src/xrGame/map_spot.cpp b/src/xrGame/map_spot.cpp index a597c57afb6..85758f89c8a 100644 --- a/src/xrGame/map_spot.cpp +++ b/src/xrGame/map_spot.cpp @@ -8,7 +8,7 @@ #include "ui/UIInventoryUtilities.h" #include "xrEngine/xr_object.h" #include "Common/object_broker.h" -#include "ui/UITextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" #include "ui/UIHelper.h" #include "Include/xrRender/UIShader.h" diff --git a/src/xrGame/map_spot.h b/src/xrGame/map_spot.h index 832e2594657..eb0e8435bd9 100644 --- a/src/xrGame/map_spot.h +++ b/src/xrGame/map_spot.h @@ -1,6 +1,6 @@ #pragma once -#include "ui/UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "alife_space.h" class CMapLocation; diff --git a/src/xrGame/mixed_delegate.h b/src/xrGame/mixed_delegate.h index 3b6ef79fdf0..0863d553dd0 100644 --- a/src/xrGame/mixed_delegate.h +++ b/src/xrGame/mixed_delegate.h @@ -4,7 +4,7 @@ #include "xrCore/fastdelegate.h" //#include "pch_script.h" // Don't include PCH headers from a header. It frequently creates circular dependencies! -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "mixed_delegate_unique_tags.h" template diff --git a/src/xrGame/patrol_path_manager.cpp b/src/xrGame/patrol_path_manager.cpp index 3d6aa6a1cda..daa7501f53d 100644 --- a/src/xrGame/patrol_path_manager.cpp +++ b/src/xrGame/patrol_path_manager.cpp @@ -15,7 +15,7 @@ #include "xrScriptEngine/script_engine.hpp" #include "xrAICore/Navigation/ai_object_location.h" #include "script_entity_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "xrAICore/Navigation/level_graph.h" diff --git a/src/xrGame/patrol_path_manager.h b/src/xrGame/patrol_path_manager.h index a689ee6b547..b8b11c982f9 100644 --- a/src/xrGame/patrol_path_manager.h +++ b/src/xrGame/patrol_path_manager.h @@ -12,7 +12,7 @@ #include "xrScriptEngine/script_engine.hpp" #include "xrAICore/Navigation/PatrolPath/patrol_path_storage.h" #include "xrAICore/Navigation/PatrolPath/patrol_path.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" template class CScriptCallbackEx; diff --git a/src/xrGame/player_hud.cpp b/src/xrGame/player_hud.cpp index e6aeb4b3e71..bab070038d3 100644 --- a/src/xrGame/player_hud.cpp +++ b/src/xrGame/player_hud.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "player_hud.h" #include "HudItem.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "actor.h" #include "physic_item.h" #include "static_cast_checked.hpp" diff --git a/src/xrGame/player_hud_tune.cpp b/src/xrGame/player_hud_tune.cpp index 898b99c558f..9a43539a0f0 100644 --- a/src/xrGame/player_hud_tune.cpp +++ b/src/xrGame/player_hud_tune.cpp @@ -8,7 +8,7 @@ #include "xrEngine/Effector.h" #include "xrEngine/CameraManager.h" #include "xrEngine/FDemoRecord.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #include "debug_renderer.h" #include "xrEngine/GameFont.h" diff --git a/src/xrGame/saved_game_wrapper.cpp b/src/xrGame/saved_game_wrapper.cpp index 771de54ab4f..a5dee356cbe 100644 --- a/src/xrGame/saved_game_wrapper.cpp +++ b/src/xrGame/saved_game_wrapper.cpp @@ -164,7 +164,7 @@ CSavedGameWrapper::CSavedGameWrapper(LPCSTR saved_game_name) if (graph.header().level_exist(m_level_id)) m_level_name = graph.header().level(m_level_id).name(); else - m_level_name = CStringTable().translate("ui_st_error"); + m_level_name = StringTable().translate("ui_st_error"); } chunk->close(); diff --git a/src/xrGame/script_entity.cpp b/src/xrGame/script_entity.cpp index cd0e4322109..00c56cf0793 100644 --- a/src/xrGame/script_entity.cpp +++ b/src/xrGame/script_entity.cpp @@ -26,7 +26,7 @@ #include "visual_memory_manager.h" #include "xrAICore/Navigation/ai_object_location.h" #include "movement_manager.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" void __stdcall ActionCallback(IKinematics* tpKinematics); diff --git a/src/xrGame/script_game_object3.cpp b/src/xrGame/script_game_object3.cpp index 622951b2e88..0d77c319bb8 100644 --- a/src/xrGame/script_game_object3.cpp +++ b/src/xrGame/script_game_object3.cpp @@ -46,7 +46,7 @@ #include "CharacterPhysicsSupport.h" #include "player_hud.h" #include "eatable_item.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "xrEngine/feel_touch.h" #endif //-Alundaio diff --git a/src/xrGame/script_game_object_inventory_owner.cpp b/src/xrGame/script_game_object_inventory_owner.cpp index ae77430195e..e216aa37bff 100644 --- a/src/xrGame/script_game_object_inventory_owner.cpp +++ b/src/xrGame/script_game_object_inventory_owner.cpp @@ -36,7 +36,7 @@ #include "stalker_animation_manager.h" #include "CameraFirstEye.h" #include "stalker_movement_manager_smart_cover.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "memory_manager.h" #include "enemy_manager.h" #include "ai/stalker/ai_stalker_impl.h" diff --git a/src/xrGame/script_game_object_smart_covers.cpp b/src/xrGame/script_game_object_smart_covers.cpp index e7db00f05b0..183e8e7badc 100644 --- a/src/xrGame/script_game_object_smart_covers.cpp +++ b/src/xrGame/script_game_object_smart_covers.cpp @@ -11,7 +11,7 @@ #include "script_game_object_impl.h" #include "ai/stalker/ai_stalker.h" #include "stalker_movement_manager_smart_cover.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "smart_cover.h" bool CScriptGameObject::use_smart_covers_only() const diff --git a/src/xrGame/script_game_object_use.cpp b/src/xrGame/script_game_object_use.cpp index d53d875f4fb..d0aca0c0efb 100644 --- a/src/xrGame/script_game_object_use.cpp +++ b/src/xrGame/script_game_object_use.cpp @@ -6,7 +6,7 @@ #include "stalker_planner.h" #include "ai/stalker/ai_stalker.h" #include "searchlight.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #include "memory_manager.h" #include "enemy_manager.h" diff --git a/src/xrGame/script_zone.cpp b/src/xrGame/script_zone.cpp index 712f872fef8..eb714ba0cda 100644 --- a/src/xrGame/script_zone.cpp +++ b/src/xrGame/script_zone.cpp @@ -11,7 +11,7 @@ #include "script_game_object.h" #include "xrserver_objects_alife_monsters.h" #include "xrEngine/xr_collide_form.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "game_object_space.h" #ifdef DEBUG diff --git a/src/xrGame/smart_cover_planner_target_selector.h b/src/xrGame/smart_cover_planner_target_selector.h index 89e442aa863..74b4b607395 100644 --- a/src/xrGame/smart_cover_planner_target_selector.h +++ b/src/xrGame/smart_cover_planner_target_selector.h @@ -11,7 +11,7 @@ #include "Common/Noncopyable.hpp" #include "smart_cover_detail.h" #include "action_planner_action.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" namespace smart_cover { diff --git a/src/xrGame/space_restrictor.cpp b/src/xrGame/space_restrictor.cpp index 4a9aa6745be..8d35c078223 100644 --- a/src/xrGame/space_restrictor.cpp +++ b/src/xrGame/space_restrictor.cpp @@ -217,7 +217,7 @@ bool CSpaceRestrictor::prepared_inside(const Fsphere& sphere) const #ifdef DEBUG #include "customzone.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" extern Flags32 dbg_net_Draw_Flags; diff --git a/src/xrGame/stalker_animation_manager_update.cpp b/src/xrGame/stalker_animation_manager_update.cpp index 13b0829ba65..5eb8f00f633 100644 --- a/src/xrGame/stalker_animation_manager_update.cpp +++ b/src/xrGame/stalker_animation_manager_update.cpp @@ -10,7 +10,7 @@ #include "stalker_animation_manager.h" #include "ai/stalker/ai_stalker.h" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "xrEngine/profiler.h" #include "stalker_movement_manager_smart_cover.h" diff --git a/src/xrGame/stalker_animation_script.cpp b/src/xrGame/stalker_animation_script.cpp index f4b71d679ee..1951225fb4a 100644 --- a/src/xrGame/stalker_animation_script.cpp +++ b/src/xrGame/stalker_animation_script.cpp @@ -11,7 +11,7 @@ #include "ai/stalker/ai_stalker.h" #include "xrScriptEngine/script_engine.hpp" #include "game_object_space.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "ai_space.h" void CStalkerAnimationManager::script_play_callback(CBlend* blend) diff --git a/src/xrGame/string_table.cpp b/src/xrGame/string_table.cpp index 68b9ec08515..b817b1b6b87 100644 --- a/src/xrGame/string_table.cpp +++ b/src/xrGame/string_table.cpp @@ -1,13 +1,19 @@ #include "stdafx.h" #include "string_table.h" - -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "xr_level_controller.h" +CStringTable& StringTable() { return *((CStringTable*)gStringTable); } + STRING_TABLE_DATA* CStringTable::pData = NULL; BOOL CStringTable::m_bWriteErrorsToLog = FALSE; -CStringTable::CStringTable() { Init(); } +CStringTable::CStringTable() +{ + pData = nullptr; +} + +CStringTable::~CStringTable() { Destroy(); } void CStringTable::Destroy() { xr_delete(pData); } void CStringTable::rescan() { @@ -96,13 +102,11 @@ void CStringTable::ReparseKeyBindings() STRING_VALUE CStringTable::ParseLine(LPCSTR str, LPCSTR skey, bool bFirst) { - // LPCSTR str = "1 $$action_left$$ 2 $$action_right$$ 3 $$action_left$$ 4"; xr_string res; int k = 0; const char* b; #define ACTION_STR "$$ACTION_" -//. int LEN = (int)xr_strlen(ACTION_STR); #define LEN 9 string256 buff; diff --git a/src/xrGame/string_table.h b/src/xrGame/string_table.h index c25bcd2a8bf..1bc9ed8c773 100644 --- a/src/xrGame/string_table.h +++ b/src/xrGame/string_table.h @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////////// #pragma once -#include "string_table_defs.h" +#include "xrEngine/StringTable/IStringTable.h" #include "xrCommon/xr_map.h" using STRING_TABLE_MAP = xr_map; @@ -17,11 +17,13 @@ struct STRING_TABLE_DATA STRING_TABLE_MAP m_string_key_binding; }; -class CStringTable +class CStringTable : public IStringTable { public: CStringTable(); + virtual ~CStringTable(); + void Init(); static void Destroy(); STRING_VALUE translate(const STRING_ID& str_id) const; @@ -31,8 +33,9 @@ class CStringTable static void ReparseKeyBindings(); private: - void Init(); void Load(LPCSTR xml_file); static STRING_VALUE ParseLine(LPCSTR str, LPCSTR key, bool bFirst); static STRING_TABLE_DATA* pData; }; + +CStringTable& StringTable(); diff --git a/src/xrGame/trade.cpp b/src/xrGame/trade.cpp index 57718c6a36c..5090350d752 100644 --- a/src/xrGame/trade.cpp +++ b/src/xrGame/trade.cpp @@ -9,7 +9,7 @@ #include "character_info.h" #include "relation_registry.h" #include "Level.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "game_object_space.h" diff --git a/src/xrGame/trade2.cpp b/src/xrGame/trade2.cpp index acc43127a3d..93f53c5b067 100644 --- a/src/xrGame/trade2.cpp +++ b/src/xrGame/trade2.cpp @@ -9,7 +9,7 @@ #include "character_info.h" #include "relation_registry.h" #include "Level.h" -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" #include "script_game_object.h" #include "game_object_space.h" #include "trade_parameters.h" diff --git a/src/xrGame/ui/ArtefactDetectorUI.cpp b/src/xrGame/ui/ArtefactDetectorUI.cpp index daca4624dd0..fdb7d1c561b 100644 --- a/src/xrGame/ui/ArtefactDetectorUI.cpp +++ b/src/xrGame/ui/ArtefactDetectorUI.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "ArtefactDetectorUI.h" #include "UIXmlInit.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" void CUIDetectorWave::SetVelocity(float v) { m_curr_v = v; } void CUIDetectorWave::Update() diff --git a/src/xrGame/ui/ArtefactDetectorUI.h b/src/xrGame/ui/ArtefactDetectorUI.h index ec6ef7f0a68..afab27f389d 100644 --- a/src/xrGame/ui/ArtefactDetectorUI.h +++ b/src/xrGame/ui/ArtefactDetectorUI.h @@ -1,5 +1,5 @@ #pragma once -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" class CUIStatic; class CUIFrameLineWnd; diff --git a/src/xrGame/ui/ChangeWeatherDialog.cpp b/src/xrGame/ui/ChangeWeatherDialog.cpp index 44e7f824ebc..ca0a63bc357 100644 --- a/src/xrGame/ui/ChangeWeatherDialog.cpp +++ b/src/xrGame/ui/ChangeWeatherDialog.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "ChangeWeatherDialog.hpp" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "game_cl_teamdeathmatch.h" #include "UIKickPlayer.h" #include "UIChangeMap.h" diff --git a/src/xrGame/ui/FactionState.h b/src/xrGame/ui/FactionState.h index 7d17be53f16..fda72446858 100644 --- a/src/xrGame/ui/FactionState.h +++ b/src/xrGame/ui/FactionState.h @@ -6,7 +6,7 @@ //////////////////////////////////////////////////////////////////////////// #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class FactionState { diff --git a/src/xrGame/ui/FractionState.h b/src/xrGame/ui/FractionState.h index 3f8b3b0fd3a..89de1cc1d23 100644 --- a/src/xrGame/ui/FractionState.h +++ b/src/xrGame/ui/FractionState.h @@ -7,7 +7,7 @@ //////////////////////////////////////////////////////////////////////////// #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class FractionState { diff --git a/src/xrGame/ui/KillMessageStruct.h b/src/xrGame/ui/KillMessageStruct.h index 7d6c27819f6..1741d33f437 100644 --- a/src/xrGame/ui/KillMessageStruct.h +++ b/src/xrGame/ui/KillMessageStruct.h @@ -7,7 +7,7 @@ #pragma once -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" struct ColoredName { diff --git a/src/xrGame/ui/MMSound.cpp b/src/xrGame/ui/MMSound.cpp index 4e0ad886998..61a6495b3b7 100644 --- a/src/xrGame/ui/MMSound.cpp +++ b/src/xrGame/ui/MMSound.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "MMSound.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" CMMSound::CMMSound() {} CMMSound::~CMMSound() { all_Stop(); } diff --git a/src/xrGame/ui/Restrictions.cpp b/src/xrGame/ui/Restrictions.cpp index 42c8801dfbd..27e66633e87 100644 --- a/src/xrGame/ui/Restrictions.cpp +++ b/src/xrGame/ui/Restrictions.cpp @@ -74,7 +74,7 @@ void CRestrictions::InitGroups() xr_sprintf(rank, "rank_%d", i); AddRestriction4rank(i, pSettings->r_string(rank, "amount_restriction")); - m_names[i] = CStringTable().translate(pSettings->r_string(rank, "rank_name")); + m_names[i] = StringTable().translate(pSettings->r_string(rank, "rank_name")); } #ifndef MASTER_GOLD diff --git a/src/xrGame/ui/ServerList.cpp b/src/xrGame/ui/ServerList.cpp index 47937be527f..724a60efa47 100644 --- a/src/xrGame/ui/ServerList.cpp +++ b/src/xrGame/ui/ServerList.cpp @@ -3,9 +3,9 @@ #include "UIXmlInit.h" #include "string_table.h" #include "xrEngine/xr_ioconsole.h" -#include "UIEditBox.h" +#include "xrUICore/EditBox/UIEditBox.h" #include "UIMessageBoxEx.h" -#include "UIMessageBox.h" +#include "xrUICore/MessageBox/UIMessageBox.h" #include "TeamInfo.h" #include "MainMenu.h" #include "login_manager.h" @@ -209,63 +209,58 @@ void CServerList::AddServerDetail(const GameInfo& info) void CServerList::AddBoolED(const char* keyName, bool value) { - CStringTable st; AddServerDetail( - GameInfo(*st.translate(keyName), value ? *st.translate("mp_si_enabled") : *st.translate("mp_si_disabled"))); + GameInfo(*StringTable().translate(keyName), value ? *StringTable().translate("mp_si_enabled") : + *StringTable().translate("mp_si_disabled"))); } void CServerList::AddBoolYN(const char* keyName, bool value) { - CStringTable st; - AddServerDetail(GameInfo(*st.translate(keyName), value ? *st.translate("mp_si_yes") : *st.translate("mp_si_no"))); + AddServerDetail(GameInfo(*StringTable().translate(keyName), value ? *StringTable().translate("mp_si_yes") : + *StringTable().translate("mp_si_no"))); } void CServerList::AddBoolKeyED(void* s, const char* keyName, int k) { AddBoolED(keyName, browser().GetBool(s, k)); } void CServerList::AddBoolKeyYN(void* s, const char* keyName, int k) { AddBoolYN(keyName, browser().GetBool(s, k)); } void CServerList::AddIntKey(void* s, const char* keyName, int k) { - CStringTable st; string256 tmp; xr_sprintf(tmp, "%d", browser().GetInt(s, k)); - AddServerDetail(GameInfo(*st.translate(keyName), tmp)); + AddServerDetail(GameInfo(*StringTable().translate(keyName), tmp)); } void CServerList::AddIntKeyN(void* s, float m, const char* keyName, const char* suffix, int k) { - CStringTable st; if (browser().GetInt(s, k)) { string256 tmp; xr_sprintf(tmp, "%d%s", int(browser().GetInt(s, k) * m), suffix); - AddServerDetail(GameInfo(*st.translate(keyName), tmp)); + AddServerDetail(GameInfo(*StringTable().translate(keyName), tmp)); } else - AddServerDetail(GameInfo(*st.translate(keyName), *st.translate("mp_si_no"))); + AddServerDetail(GameInfo(*StringTable().translate(keyName), *StringTable().translate("mp_si_no"))); } void CServerList::AddTimeKey(void* s, const char* keyName, const char* format, const char* suffix, int k) { - CStringTable st; if (browser().GetInt(s, k)) { string256 tmp; - xr_sprintf(tmp, format, browser().GetFloat(s, k), *st.translate(suffix)); - AddServerDetail(GameInfo(*st.translate(keyName), tmp)); + xr_sprintf(tmp, format, browser().GetFloat(s, k), *StringTable().translate(suffix)); + AddServerDetail(GameInfo(*StringTable().translate(keyName), tmp)); } else - AddServerDetail(GameInfo(*st.translate(keyName), *st.translate("mp_si_no"))); + AddServerDetail(GameInfo(*StringTable().translate(keyName), *StringTable().translate("mp_si_no"))); } void CServerList::AddString(const char* key, const char* value) { - CStringTable st; - AddServerDetail(GameInfo(*st.translate(key), value)); + AddServerDetail(GameInfo(*StringTable().translate(key), value)); } void CServerList::AddStringSt(const char* key, const char* value) { - CStringTable st; - AddServerDetail(GameInfo(*st.translate(key), *st.translate(value))); + AddServerDetail(GameInfo(*StringTable().translate(key), *StringTable().translate(value))); } void CServerList::FillUpDetailedServerInfo() @@ -300,7 +295,7 @@ void CServerList::FillUpDetailedServerInfo() continue; if (!t1) // add header { - STRCONCAT(_buff, CStringTable().translate("ui_st_team").c_str(), "\"", + STRCONCAT(_buff, StringTable().translate("ui_st_team").c_str(), "\"", CTeamInfo::GetTeam1_name().c_str(), "\""); pItemAdv = m_list[LST_PLAYERS].AddItem(); pItemAdv->SetTextColor(m_list[LST_PLAYERS].GetTextColor()); @@ -331,7 +326,7 @@ void CServerList::FillUpDetailedServerInfo() continue; if (!t2) { - STRCONCAT(_buff, CStringTable().translate("ui_st_team").c_str(), "\"", + STRCONCAT(_buff, StringTable().translate("ui_st_team").c_str(), "\"", CTeamInfo::GetTeam2_name().c_str(), "\""); m_list[LST_PLAYERS].AddTextItem(_buff); t2 = true; @@ -355,7 +350,7 @@ void CServerList::FillUpDetailedServerInfo() continue; if (!spect) { - pItemAdv = m_list[LST_PLAYERS].AddTextItem(CStringTable().translate("mp_spectator").c_str()); + pItemAdv = m_list[LST_PLAYERS].AddTextItem(StringTable().translate("mp_spectator").c_str()); spect = true; } pItemAdv = m_list[LST_PLAYERS].AddItem(); @@ -388,7 +383,7 @@ void CServerList::FillUpDetailedServerInfo() pItemAdv->AddTextField(buf, m_header2[3].GetWidth()); } } - CStringTable st; + void* sv = browser().GetServerByIndex(serverIndex); AddString("mp_si_servername", srvInfo.m_ServerName); AddString("mp_si_version", srvInfo.m_ServerVersion); diff --git a/src/xrGame/ui/ServerList.h b/src/xrGame/ui/ServerList.h index e4105b783d3..114001347bb 100644 --- a/src/xrGame/ui/ServerList.h +++ b/src/xrGame/ui/ServerList.h @@ -1,13 +1,13 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" -#include "UIListBox.h" +#include "xrUICore/ListBox/UIListBox.h" #include "UIListItemServer.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UIEditBox.h" -#include "UI3tButton.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "mixed_delegate.h" class CUIXml; diff --git a/src/xrGame/ui/TeamInfo.cpp b/src/xrGame/ui/TeamInfo.cpp index ee857398e61..bd4a5bc769e 100644 --- a/src/xrGame/ui/TeamInfo.cpp +++ b/src/xrGame/ui/TeamInfo.cpp @@ -46,9 +46,7 @@ shared_str CTeamInfo::GetTeam1_name() if (flags.test(flTeam1_name)) return team1_name; - CStringTable st; - - team1_name = st.translate(pSettings->r_string_wb("team1", "name")); + team1_name = StringTable().translate(pSettings->r_string_wb("team1", "name")); flags.set(flTeam1_name, true); return team1_name; @@ -59,9 +57,7 @@ shared_str CTeamInfo::GetTeam2_name() if (flags.test(flTeam2_name)) return team2_name; - CStringTable st; - - team2_name = st.translate(pSettings->r_string_wb("team2", "name")); + team2_name = StringTable().translate(pSettings->r_string_wb("team2", "name")); flags.set(flTeam2_name, true); return team2_name; diff --git a/src/xrGame/ui/UIAchievements.cpp b/src/xrGame/ui/UIAchievements.cpp index 3be2c9d2344..fe7a8b2793c 100644 --- a/src/xrGame/ui/UIAchievements.cpp +++ b/src/xrGame/ui/UIAchievements.cpp @@ -1,11 +1,11 @@ #include "pch_script.h" #include "UIAchievements.h" -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIXmlInit.h" #include "UIHelper.h" -#include "UIHint.h" -#include "UIStatic.h" -#include "UICursor.h" +#include "xrUICore/Hint/UIHint.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Cursor/UICursor.h" #include "ai_space.h" #include "xrScriptEngine/script_engine.hpp" #include "string_table.h" @@ -68,7 +68,7 @@ void CUIAchievements::SetDescription(LPCSTR desc) SetWndSize(Fvector2().set(GetWndSize().x, descr_size.y)); } -void CUIAchievements::SetHint(LPCSTR hint) { m_hint->set_text(CStringTable().translate(hint).c_str()); } +void CUIAchievements::SetHint(LPCSTR hint) { m_hint->set_text(StringTable().translate(hint).c_str()); } void CUIAchievements::SetIcon(LPCSTR icon) { m_icon->InitTexture(icon); } void CUIAchievements::SetFunctor(LPCSTR func) { diff --git a/src/xrGame/ui/UIAchievements.h b/src/xrGame/ui/UIAchievements.h index a8d539d02ce..bcc091029dc 100644 --- a/src/xrGame/ui/UIAchievements.h +++ b/src/xrGame/ui/UIAchievements.h @@ -1,5 +1,5 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIXml; class CUIStatic; diff --git a/src/xrGame/ui/UIActorMenu.cpp b/src/xrGame/ui/UIActorMenu.cpp index e925eba6a62..e61694ae45e 100644 --- a/src/xrGame/ui/UIActorMenu.cpp +++ b/src/xrGame/ui/UIActorMenu.cpp @@ -21,18 +21,18 @@ #include "CustomOutfit.h" #include "CustomDetector.h" #include "eatable_item.h" -#include "UIProgressBar.h" -#include "UICursor.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/Cursor/UICursor.h" #include "UICellItem.h" #include "UICharacterInfo.h" #include "UIItemInfo.h" #include "UIDragDropListEx.h" #include "UIDragDropReferenceList.h" #include "UIInventoryUpgradeWnd.h" -#include "UI3tButton.h" -#include "UIBtnHint.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Buttons/UIBtnHint.h" #include "UIMessageBoxEx.h" -#include "UIPropertiesBox.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" #include "UIMainIngameWnd.h" #include "Trade.h" diff --git a/src/xrGame/ui/UIActorMenu.h b/src/xrGame/ui/UIActorMenu.h index bc4a16b422b..27556b86807 100644 --- a/src/xrGame/ui/UIActorMenu.h +++ b/src/xrGame/ui/UIActorMenu.h @@ -1,9 +1,9 @@ #pragma once #include "UIDialogWnd.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "xrServerEntities/inventory_space.h" -#include "UIHint.h" +#include "xrUICore/Hint/UIHint.h" class CUICharacterInfo; class CUIDragDropListEx; diff --git a/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp b/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp index 433ddc3191b..823839eed28 100644 --- a/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp +++ b/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp @@ -3,10 +3,10 @@ #include "UIDragDropListEx.h" #include "UICharacterInfo.h" #include "UIInventoryUtilities.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UICellItem.h" #include "UICellItemFactory.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "xrMessages.h" #include "alife_registry_wrappers.h" #include "GameObject.h" @@ -186,7 +186,7 @@ void CUIActorMenu::UpdateDeadBodyBag() { string64 buf; - LPCSTR kg_str = CStringTable().translate("st_kg").c_str(); + LPCSTR kg_str = StringTable().translate("st_kg").c_str(); float total = CalcItemsWeight(m_pDeadBodyBagList); xr_sprintf(buf, "%.1f %s", total, kg_str); m_PartnerWeight->SetText(buf); diff --git a/src/xrGame/ui/UIActorMenuInitialize.cpp b/src/xrGame/ui/UIActorMenuInitialize.cpp index ccf25e2ad00..c7c5fbbee19 100644 --- a/src/xrGame/ui/UIActorMenuInitialize.cpp +++ b/src/xrGame/ui/UIActorMenuInitialize.cpp @@ -1,16 +1,16 @@ #include "stdafx.h" #include "UIActorMenu.h" #include "UIXmlInit.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UICharacterInfo.h" #include "UIDragDropListEx.h" #include "UIDragDropReferenceList.h" #include "UIActorStateInfo.h" #include "UIItemInfo.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "UIMessageBoxEx.h" -#include "UIPropertiesBox.h" -#include "UI3tButton.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIInventoryUpgradeWnd.h" #include "UIInvUpgradeInfo.h" @@ -18,10 +18,10 @@ #include "ai_space.h" #include "alife_simulator.h" #include "Common/object_broker.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "UIHelper.h" -#include "UIProgressBar.h" -#include "ui_base.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ui_base.h" #include "string_table.h" CUIActorMenu::CUIActorMenu() @@ -347,25 +347,25 @@ void CUIActorMenu::InitCallbacks() void CUIActorMenu::UpdateButtonsLayout() { string32 tmp; - LPCSTR str = CStringTable().translate("quick_use_str_1").c_str(); + LPCSTR str = StringTable().translate("quick_use_str_1").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlot1->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_2").c_str(); + str = StringTable().translate("quick_use_str_2").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlot2->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_3").c_str(); + str = StringTable().translate("quick_use_str_3").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlot3->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_4").c_str(); + str = StringTable().translate("quick_use_str_4").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; diff --git a/src/xrGame/ui/UIActorMenuInventory.cpp b/src/xrGame/ui/UIActorMenuInventory.cpp index 99c68526600..3c258c6b540 100644 --- a/src/xrGame/ui/UIActorMenuInventory.cpp +++ b/src/xrGame/ui/UIActorMenuInventory.cpp @@ -10,9 +10,9 @@ #include "UIDragDropReferenceList.h" #include "UICellCustomItems.h" #include "UIItemInfo.h" -#include "UIFrameLineWnd.h" -#include "UIPropertiesBox.h" -#include "UIListBoxItem.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" #include "UIMainIngameWnd.h" #include "UIGameCustom.h" #include "eatable_item_object.h" @@ -27,7 +27,7 @@ #include "Antirad.h" #include "CustomOutfit.h" #include "ActorHelmet.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "MPPlayersBag.h" #include "player_hud.h" #include "CustomDetector.h" @@ -1038,7 +1038,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) { if (item_in_slot_2 && item_in_slot_2->CanAttach(pScope)) { - shared_str str = CStringTable().translate("st_attach_scope_to_pistol"); + shared_str str = StringTable().translate("st_attach_scope_to_pistol"); str.printf("%s %s", str.c_str(), item_in_slot_2->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_2, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_scope_to_pistol", (void*)item_in_slot_2, @@ -1047,7 +1047,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) } if (item_in_slot_3 && item_in_slot_3->CanAttach(pScope)) { - shared_str str = CStringTable().translate("st_attach_scope_to_pistol"); + shared_str str = StringTable().translate("st_attach_scope_to_pistol"); str.printf("%s %s", str.c_str(), item_in_slot_3->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_3, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_scope_to_rifle", (void*)item_in_slot_3, @@ -1061,7 +1061,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) { if (item_in_slot_2 && item_in_slot_2->CanAttach(pSilencer)) { - shared_str str = CStringTable().translate("st_attach_silencer_to_pistol"); + shared_str str = StringTable().translate("st_attach_silencer_to_pistol"); str.printf("%s %s", str.c_str(), item_in_slot_2->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_2, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_silencer_to_pistol", (void*)item_in_slot_2, @@ -1070,7 +1070,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) } if (item_in_slot_3 && item_in_slot_3->CanAttach(pSilencer)) { - shared_str str = CStringTable().translate("st_attach_silencer_to_pistol"); + shared_str str = StringTable().translate("st_attach_silencer_to_pistol"); str.printf("%s %s", str.c_str(), item_in_slot_3->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_3, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_silencer_to_rifle", (void*)item_in_slot_3, @@ -1084,7 +1084,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) { if (item_in_slot_2 && item_in_slot_2->CanAttach(pGrenadeLauncher)) { - shared_str str = CStringTable().translate("st_attach_gl_to_rifle"); + shared_str str = StringTable().translate("st_attach_gl_to_rifle"); str.printf("%s %s", str.c_str(), item_in_slot_2->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_2, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_gl_to_pistol", (void*)item_in_slot_2, @@ -1094,7 +1094,7 @@ void CUIActorMenu::PropertiesBoxForAddon(PIItem item, bool& b_show) } if (item_in_slot_3 && item_in_slot_3->CanAttach(pGrenadeLauncher)) { - shared_str str = CStringTable().translate("st_attach_gl_to_rifle"); + shared_str str = StringTable().translate("st_attach_gl_to_rifle"); str.printf("%s %s", str.c_str(), item_in_slot_3->m_name.c_str()); m_UIPropertiesBox->AddItem(str.c_str(), (void*)item_in_slot_3, INVENTORY_ATTACH_ADDON); // m_UIPropertiesBox->AddItem( "st_attach_gl_to_rifle", (void*)item_in_slot_3, diff --git a/src/xrGame/ui/UIActorMenuTrade.cpp b/src/xrGame/ui/UIActorMenuTrade.cpp index 313f7870447..d4381c23272 100644 --- a/src/xrGame/ui/UIActorMenuTrade.cpp +++ b/src/xrGame/ui/UIActorMenuTrade.cpp @@ -1,10 +1,10 @@ #include "pch_script.h" #include "UIActorMenu.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIDragDropListEx.h" #include "UIDragDropReferenceList.h" #include "UICharacterInfo.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "UICellItem.h" #include "UIInventoryUtilities.h" #include "UICellItemFactory.h" @@ -370,7 +370,7 @@ void CUIActorMenu::UpdatePartnerBag() m_PartnerMoney->SetText(buf); } - LPCSTR kg_str = CStringTable().translate("st_kg").c_str(); + LPCSTR kg_str = StringTable().translate("st_kg").c_str(); float total = CalcItemsWeight(m_pTradePartnerBagList); xr_sprintf(buf, "%.1f %s", total, kg_str); m_PartnerWeight->SetText(buf); @@ -385,7 +385,7 @@ void CUIActorMenu::UpdatePartnerBag() void CUIActorMenu::UpdatePrices() { - LPCSTR kg_str = CStringTable().translate("st_kg").c_str(); + LPCSTR kg_str = StringTable().translate("st_kg").c_str(); UpdateActor(); UpdatePartnerBag(); diff --git a/src/xrGame/ui/UIActorMenuUpgrade.cpp b/src/xrGame/ui/UIActorMenuUpgrade.cpp index c688b98df93..20376f2a144 100644 --- a/src/xrGame/ui/UIActorMenuUpgrade.cpp +++ b/src/xrGame/ui/UIActorMenuUpgrade.cpp @@ -11,7 +11,7 @@ #include "Inventory.h" #include "Actor.h" #include "UIGameSP.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "inventory_upgrade.h" #include "UITalkWnd.h" diff --git a/src/xrGame/ui/UIActorMenu_action.cpp b/src/xrGame/ui/UIActorMenu_action.cpp index 05b3473facb..f531cbf56e1 100644 --- a/src/xrGame/ui/UIActorMenu_action.cpp +++ b/src/xrGame/ui/UIActorMenu_action.cpp @@ -16,16 +16,16 @@ #include "Common/object_broker.h" #include "UIInventoryUtilities.h" #include "game_cl_base.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "UICellItem.h" #include "UICharacterInfo.h" #include "UIItemInfo.h" #include "UIDragDropListEx.h" #include "UIInventoryUpgradeWnd.h" -#include "UI3tButton.h" -#include "UIBtnHint.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Buttons/UIBtnHint.h" #include "UIMessageBoxEx.h" -#include "UIPropertiesBox.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" #include "UIMainIngameWnd.h" bool CUIActorMenu::AllowItemDrops(EDDListType from, EDDListType to) diff --git a/src/xrGame/ui/UIActorStateInfo.cpp b/src/xrGame/ui/UIActorStateInfo.cpp index 66a2daeb9db..2e90525f0c0 100644 --- a/src/xrGame/ui/UIActorStateInfo.cpp +++ b/src/xrGame/ui/UIActorStateInfo.cpp @@ -7,15 +7,15 @@ #include "stdafx.h" #include "UIActorStateInfo.h" -#include "UIProgressBar.h" -#include "UIProgressShape.h" -#include "UIScrollView.h" -#include "UIFrameWindow.h" -#include "UIStatic.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" #include "Common/object_broker.h" #include "UIHelper.h" -#include "ui_arrow.h" +#include "xrUICore/arrow/ui_arrow.h" #include "UIHudStatesWnd.h" #include "Level.h" #include "location_manager.h" diff --git a/src/xrGame/ui/UIActorStateInfo.h b/src/xrGame/ui/UIActorStateInfo.h index 9e009200b8f..5eabf4fad9b 100644 --- a/src/xrGame/ui/UIActorStateInfo.h +++ b/src/xrGame/ui/UIActorStateInfo.h @@ -9,7 +9,7 @@ #define UI_ACTOR_STATE_INFO_H_INCLUDED #include "alife_space.h" -#include "UIHint.h" +#include "xrUICore/Hint/UIHint.h" class CUIProgressBar; class CUIProgressShape; diff --git a/src/xrGame/ui/UIBoosterInfo.cpp b/src/xrGame/ui/UIBoosterInfo.cpp index 55bc289e8df..84bcbfa12da 100644 --- a/src/xrGame/ui/UIBoosterInfo.cpp +++ b/src/xrGame/ui/UIBoosterInfo.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UIBoosterInfo.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "Common/object_broker.h" #include "EntityCondition.h" #include "Actor.h" @@ -56,7 +56,7 @@ void CUIBoosterInfo::InitFromXml(CUIXml& xml) m_booster_items[i]->Init(xml, ef_boosters_section_names[i]); m_booster_items[i]->SetAutoDelete(false); - LPCSTR name = CStringTable().translate(boost_influence_caption[i]).c_str(); + LPCSTR name = StringTable().translate(boost_influence_caption[i]).c_str(); m_booster_items[i]->SetCaption(name); xml.SetLocalRoot(base_node); @@ -65,21 +65,21 @@ void CUIBoosterInfo::InitFromXml(CUIXml& xml) m_booster_satiety = new UIBoosterInfoItem(); m_booster_satiety->Init(xml, "boost_satiety"); m_booster_satiety->SetAutoDelete(false); - LPCSTR name = CStringTable().translate("ui_inv_satiety").c_str(); + LPCSTR name = StringTable().translate("ui_inv_satiety").c_str(); m_booster_satiety->SetCaption(name); xml.SetLocalRoot(base_node); m_booster_anabiotic = new UIBoosterInfoItem(); m_booster_anabiotic->Init(xml, "boost_anabiotic"); m_booster_anabiotic->SetAutoDelete(false); - name = CStringTable().translate("ui_inv_survive_surge").c_str(); + name = StringTable().translate("ui_inv_survive_surge").c_str(); m_booster_anabiotic->SetCaption(name); xml.SetLocalRoot(base_node); m_booster_time = new UIBoosterInfoItem(); m_booster_time->Init(xml, "boost_time"); m_booster_time->SetAutoDelete(false); - name = CStringTable().translate("ui_inv_effect_time").c_str(); + name = StringTable().translate("ui_inv_effect_time").c_str(); m_booster_time->SetCaption(name); xml.SetLocalRoot(stored_root); @@ -207,7 +207,7 @@ void UIBoosterInfoItem::Init(CUIXml& xml, LPCSTR section) m_show_sign = (xml.ReadAttribInt("value", 0, "show_sign", 1) == 1); LPCSTR unit_str = xml.ReadAttrib("value", 0, "unit_str", ""); - m_unit_str._set(CStringTable().translate(unit_str)); + m_unit_str._set(StringTable().translate(unit_str)); LPCSTR texture_minus = xml.Read("texture_minus", 0, ""); if (texture_minus && xr_strlen(texture_minus)) diff --git a/src/xrGame/ui/UIBoosterInfo.h b/src/xrGame/ui/UIBoosterInfo.h index cca33af008d..1e22a35f9fb 100644 --- a/src/xrGame/ui/UIBoosterInfo.h +++ b/src/xrGame/ui/UIBoosterInfo.h @@ -1,5 +1,5 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "EntityCondition.h" class CUIXml; diff --git a/src/xrGame/ui/UIBuyWeaponTab.cpp b/src/xrGame/ui/UIBuyWeaponTab.cpp index 14e3de7ba95..0e739316051 100644 --- a/src/xrGame/ui/UIBuyWeaponTab.cpp +++ b/src/xrGame/ui/UIBuyWeaponTab.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" #include "UIBuyWeaponTab.h" -#include "UITabButton.h" +#include "xrUICore/TabControl/UITabButton.h" void CUIBuyWeaponTab::SendMessage(CUIWindow* pWnd, s16 msg, void* pData) { diff --git a/src/xrGame/ui/UIBuyWeaponTab.h b/src/xrGame/ui/UIBuyWeaponTab.h index f01b45d4019..7f4d269767f 100644 --- a/src/xrGame/ui/UIBuyWeaponTab.h +++ b/src/xrGame/ui/UIBuyWeaponTab.h @@ -1,7 +1,7 @@ #pragma once -#include "UITabControl.h" -#include "UIStatic.h" +#include "xrUICore/TabControl/UITabControl.h" +#include "xrUICore/Static/UIStatic.h" class CUIXml; diff --git a/src/xrGame/ui/UICDkey.cpp b/src/xrGame/ui/UICDkey.cpp index 1cbbf599610..e3af59f0038 100644 --- a/src/xrGame/ui/UICDkey.cpp +++ b/src/xrGame/ui/UICDkey.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UICDkey.h" -#include "UILines.h" +#include "xrUICore/Lines/UILines.h" #include "xrEngine/line_edit_control.h" #include "MainMenu.h" #include "xrEngine/xr_IOConsole.h" @@ -90,10 +90,10 @@ void CUICDkey::Draw() GetAbsoluteRect(rect); Fvector2 out; - out.y = (m_wndSize.y - TextItemControl()->m_pFont->CurrentHeight_()) / 2.0f; + out.y = (m_wndSize.y - TextItemControl()->GetFont()->CurrentHeight_()) / 2.0f; out.x = TextItemControl()->m_TextOffset.x + TextItemControl()->GetIndentByAlign(); - TextItemControl()->m_pFont->SetColor(TextItemControl()->GetTextColor()); - TextItemControl()->m_pFont->SetAligment(TextItemControl()->GetTextAlignment()); + TextItemControl()->GetFont()->SetColor(TextItemControl()->GetTextColor()); + TextItemControl()->GetFont()->SetAligment(TextItemControl()->GetTextAlignment()); Fvector2 pos; pos.set(rect.left + out.x, rect.top + out.y); @@ -121,20 +121,20 @@ void CUICDkey::Draw() LPCSTR res = (m_view_access) ? edt_str : xx_str; LPCSTR res1 = (m_view_access) ? edt_str1 : xx_str1; - TextItemControl()->m_pFont->Out(pos.x, pos.y, "%s", AddHyphens(res)); + TextItemControl()->GetFont()->Out(pos.x, pos.y, "%s", AddHyphens(res)); - float _h = TextItemControl()->m_pFont->CurrentHeight_(); + float _h = TextItemControl()->GetFont()->CurrentHeight_(); UI().ClientToScreenScaledHeight(_h); out.y = rect.top + (m_wndSize.y - _h) / 2.0f; float w_tmp = 0.0f; int i = (int)xr_strlen(res1); - w_tmp = TextItemControl()->m_pFont->SizeOf_(res1); + w_tmp = TextItemControl()->GetFont()->SizeOf_(res1); UI().ClientToScreenScaledWidth(w_tmp); out.x = rect.left + w_tmp; - w_tmp = TextItemControl()->m_pFont->SizeOf_("-"); + w_tmp = TextItemControl()->GetFont()->SizeOf_("-"); UI().ClientToScreenScaledWidth(w_tmp); if (i > 3) @@ -145,13 +145,13 @@ void CUICDkey::Draw() out.x += w_tmp; UI().ClientToScreenScaled(out); - TextItemControl()->m_pFont->Out(out.x, out.y, "_"); + TextItemControl()->GetFont()->Out(out.x, out.y, "_"); } else { - TextItemControl()->m_pFont->Out(pos.x, pos.y, "%s", AddHyphens(xx_str)); + TextItemControl()->GetFont()->Out(pos.x, pos.y, "%s", AddHyphens(xx_str)); } - TextItemControl()->m_pFont->OnRender(); + TextItemControl()->GetFont()->OnRender(); } LPCSTR CUICDkey::GetText() { return AddHyphens(inherited::GetText()); } diff --git a/src/xrGame/ui/UICDkey.h b/src/xrGame/ui/UICDkey.h index eacc3b0c61d..51cefcbf34e 100644 --- a/src/xrGame/ui/UICDkey.h +++ b/src/xrGame/ui/UICDkey.h @@ -1,6 +1,6 @@ // #pragma once -#include "UIEditBox.h" +#include "xrUICore/EditBox/UIEditBox.h" class CUICDkey : public CUIEditBox { diff --git a/src/xrGame/ui/UICellCustomItems.cpp b/src/xrGame/ui/UICellCustomItems.cpp index 98ebb7ae625..eb801e0181b 100644 --- a/src/xrGame/ui/UICellCustomItems.cpp +++ b/src/xrGame/ui/UICellCustomItems.cpp @@ -3,7 +3,7 @@ #include "UIInventoryUtilities.h" #include "Weapon.h" #include "UIDragDropListEx.h" -#include "UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" #define INV_GRID_WIDTHF 50.0f #define INV_GRID_HEIGHTF 50.0f diff --git a/src/xrGame/ui/UICellItem.cpp b/src/xrGame/ui/UICellItem.cpp index 1c86ec02490..b9eca5c7e38 100644 --- a/src/xrGame/ui/UICellItem.cpp +++ b/src/xrGame/ui/UICellItem.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UICellItem.h" -#include "uicursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "inventory_item.h" #include "UIDragDropListEx.h" #include "eatable_item.h" @@ -9,7 +9,7 @@ #include "Level.h" #include "Common/object_broker.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" #include "Weapon.h" #include "CustomOutfit.h" #include "ActorHelmet.h" diff --git a/src/xrGame/ui/UICellItem.h b/src/xrGame/ui/UICellItem.h index b2f1fc7a6b1..f800fee882b 100644 --- a/src/xrGame/ui/UICellItem.h +++ b/src/xrGame/ui/UICellItem.h @@ -1,6 +1,6 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIDialogWnd.h" class CUIDragItem; diff --git a/src/xrGame/ui/UIChangeMap.cpp b/src/xrGame/ui/UIChangeMap.cpp index 5efae44013c..bc56f77f5a5 100644 --- a/src/xrGame/ui/UIChangeMap.cpp +++ b/src/xrGame/ui/UIChangeMap.cpp @@ -2,9 +2,9 @@ #include "UIChangeMap.h" #include "UIVotingCategory.h" #include "UIXmlInit.h" -#include "UI3tButton.h" -#include "UIListBox.h" -#include "UIListBoxItem.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" #include "Level.h" #include "game_cl_teamdeathmatch.h" #include "xrEngine/xr_ioconsole.h" @@ -12,7 +12,7 @@ #include "Common/object_broker.h" #include "UIGameCustom.h" #include "UIDialogHolder.h" -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" CUIChangeMap::CUIChangeMap() { @@ -150,7 +150,7 @@ void CUIChangeMap::FillUpList() u32 cnt = M.m_map_names.size(); for (u32 i = 0; i < cnt; ++i) { - CUIListBoxItem* itm = lst->AddTextItem(CStringTable().translate(M.m_map_names[i].map_name).c_str()); + CUIListBoxItem* itm = lst->AddTextItem(StringTable().translate(M.m_map_names[i].map_name).c_str()); itm->Enable(true); // m_pExtraContentFilter->IsDataEnabled(M.m_map_names[i].map_name.c_str())); } } diff --git a/src/xrGame/ui/UICharacterInfo.cpp b/src/xrGame/ui/UICharacterInfo.cpp index 7292e322182..a38b8f61cfb 100644 --- a/src/xrGame/ui/UICharacterInfo.cpp +++ b/src/xrGame/ui/UICharacterInfo.cpp @@ -9,11 +9,11 @@ #include "string_table.h" #include "relation_registry.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" -#include "uistatic.h" -#include "UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "alife_simulator.h" #include "ai_space.h" diff --git a/src/xrGame/ui/UICharacterInfo.h b/src/xrGame/ui/UICharacterInfo.h index f3ab1ca6d97..c7617e70481 100644 --- a/src/xrGame/ui/UICharacterInfo.h +++ b/src/xrGame/ui/UICharacterInfo.h @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #pragma once -#include "uiwindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "xrServerEntities/alife_space.h" #include "character_info_defs.h" diff --git a/src/xrGame/ui/UIChatWnd.cpp b/src/xrGame/ui/UIChatWnd.cpp index f291fd75d5c..83ab8719fc5 100644 --- a/src/xrGame/ui/UIChatWnd.cpp +++ b/src/xrGame/ui/UIChatWnd.cpp @@ -1,10 +1,10 @@ #include #include "UIChatWnd.h" #include "UIGameLog.h" -#include "UIEditBox.h" +#include "xrUICore/EditBox/UIEditBox.h" #include "UIXmlInit.h" #include "UIHelper.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIDialogHolder.h" #include "game_cl_base.h" #include "xr_level_controller.h" diff --git a/src/xrGame/ui/UIChatWnd.h b/src/xrGame/ui/UIChatWnd.h index 01bed2fa650..90fd24e1f3d 100644 --- a/src/xrGame/ui/UIChatWnd.h +++ b/src/xrGame/ui/UIChatWnd.h @@ -1,6 +1,6 @@ #pragma once #include "UIDialogWnd.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIXml; class CUIGameLog; diff --git a/src/xrGame/ui/UIDebugFonts.cpp b/src/xrGame/ui/UIDebugFonts.cpp index fe3c357c1f0..43f56b35396 100644 --- a/src/xrGame/ui/UIDebugFonts.cpp +++ b/src/xrGame/ui/UIDebugFonts.cpp @@ -46,7 +46,9 @@ void CUIDebugFonts::FillUpList() CUITextWnd* pItem = new CUITextWnd(); pItem->SetWndPos(pos); pItem->SetWndSize(sz); - xr_sprintf(str, "%s:%s", F->m_font_name.c_str(), CStringTable().translate("Test_Font_String").c_str()); +#ifdef DEBUG + xr_sprintf(str, "%s:%s", F->m_font_name.c_str(), StringTable().translate("Test_Font_String").c_str()); +#endif pItem->SetFont(F); pItem->SetText(str); pItem->SetTextComplexMode(false); diff --git a/src/xrGame/ui/UIDebugFonts.h b/src/xrGame/ui/UIDebugFonts.h index 2f6cdf14e28..234768b1d9d 100644 --- a/src/xrGame/ui/UIDebugFonts.h +++ b/src/xrGame/ui/UIDebugFonts.h @@ -8,7 +8,7 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIDialogWnd.h" class CUIDebugFonts : public CUIDialogWnd diff --git a/src/xrGame/ui/UIDemoPlayControl.cpp b/src/xrGame/ui/UIDemoPlayControl.cpp index 30f7ecf6710..3f4381a3347 100644 --- a/src/xrGame/ui/UIDemoPlayControl.cpp +++ b/src/xrGame/ui/UIDemoPlayControl.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" #include "UIXmlInit.h" -#include "UI3tButton.h" -#include "UIProgressBar.h" -#include "UIPropertiesBox.h" -#include "UIListBox.h" -#include "UIListBoxItem.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" #include "UIDemoPlayControl.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "xrEngine/XR_IOConsole.h" #include "string_table.h" #include "Level.h" @@ -132,14 +132,13 @@ void CUIDemoPlayControl::Init() void CUIDemoPlayControl::InitRewindTypeList() { - CStringTable st; m_rewind_type->InitPropertiesBox(Fvector2().set(0, 0), Fvector2().set(100, 200)); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_start").c_str(), NULL, eRewindUntilStart); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_kill").c_str(), NULL, eRewindUntilKill); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_die").c_str(), NULL, eRewindUntilDie); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_arttake").c_str(), NULL, eRewindUntilArtTake); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_artdrop").c_str(), NULL, eRewindUntilArtDrop); - m_rewind_type->AddItem(st.translate("mpd_rewind_until_artdeliver").c_str(), NULL, eRewindUntilArtDeliver); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_start").c_str(), NULL, eRewindUntilStart); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_kill").c_str(), NULL, eRewindUntilKill); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_die").c_str(), NULL, eRewindUntilDie); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_arttake").c_str(), NULL, eRewindUntilArtTake); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_artdrop").c_str(), NULL, eRewindUntilArtDrop); + m_rewind_type->AddItem(StringTable().translate("mpd_rewind_until_artdeliver").c_str(), NULL, eRewindUntilArtDeliver); m_rewind_type->AutoUpdateSize(); m_rewind_type->Hide(); } @@ -154,9 +153,8 @@ void CUIDemoPlayControl::InitAllPlayers() m_players_store = xr_malloc(players_count * sizeof(shared_str)); m_players = new players_collection_t(m_players_store, players_count); - CStringTable st; m_all_players->InitPropertiesBox(Fvector2().set(0, 0), Fvector2().set(100, 200)); - m_all_players->AddItem(st.translate("mpd_any_player").c_str(), NULL, 0); // warning ! zero tag means Any player ! + m_all_players->AddItem(StringTable().translate("mpd_any_player").c_str(), NULL, 0); // warning ! zero tag means Any player ! m_players->clear(); for (u32 i = 0; i != players_count; ++i) @@ -315,14 +313,12 @@ void CUIDemoPlayControl::Update() LPCSTR demo_play_string = NULL; string32 demo_pos; string32 demo_speed; - // st.translate("demo play active : ").c_str() (need to translate ?) - CStringTable st; xr_sprintf(demo_pos, ": %2d %%, ", int(Level().GetDemoPlayPos() * 100)); xr_sprintf(demo_speed, ": %1.1fx", Level().GetDemoPlaySpeed()); - STRCONCAT(demo_play_string, Device.Paused() ? st.translate("mpdemoplay_paused") : st.translate("mpdemoplay_active"), - demo_pos, st.translate("mpdemoplay_speed"), demo_speed); + STRCONCAT(demo_play_string, Device.Paused() ? StringTable().translate("mpdemoplay_paused") : StringTable().translate("mpdemoplay_active"), + demo_pos, StringTable().translate("mpdemoplay_speed"), demo_speed); // m_game_ui->SetDemoPlayCaption(demo_play_string); m_progress_bar->SetProgressPos(Level().GetDemoPlayPos()); m_static_demo_status->SetText(demo_play_string); diff --git a/src/xrGame/ui/UIDemoPlayControl.h b/src/xrGame/ui/UIDemoPlayControl.h index 13d41d507ec..e9199e82b78 100644 --- a/src/xrGame/ui/UIDemoPlayControl.h +++ b/src/xrGame/ui/UIDemoPlayControl.h @@ -3,7 +3,7 @@ #define UIDEMOPLAY_CONTROL #include "UIDialogWnd.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "xrCore/buffer_vector.h" class CUI3tButton; diff --git a/src/xrGame/ui/UIDialogWnd.h b/src/xrGame/ui/UIDialogWnd.h index 72436c52f87..af1681cfaaf 100644 --- a/src/xrGame/ui/UIDialogWnd.h +++ b/src/xrGame/ui/UIDialogWnd.h @@ -1,5 +1,5 @@ #pragma once -#include "uiwindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "UIDialogHolder.h" class CDialogHolder; diff --git a/src/xrGame/ui/UIDragDropListEx.cpp b/src/xrGame/ui/UIDragDropListEx.cpp index 08462030b2a..013b272a9a6 100644 --- a/src/xrGame/ui/UIDragDropListEx.cpp +++ b/src/xrGame/ui/UIDragDropListEx.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" #include "UIDragDropListEx.h" -#include "UIScrollBar.h" +#include "xrUICore/ScrollBar/UIScrollBar.h" #include "Common/object_broker.h" #include "UICellItem.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" //Alundaio #include "Inventory.h" //-Alundaio diff --git a/src/xrGame/ui/UIDragDropListEx.h b/src/xrGame/ui/UIDragDropListEx.h index eabadce780e..3c83a00f393 100644 --- a/src/xrGame/ui/UIDragDropListEx.h +++ b/src/xrGame/ui/UIDragDropListEx.h @@ -1,7 +1,7 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUICellContainer; class CUIScrollBar; diff --git a/src/xrGame/ui/UIDragDropReferenceList.cpp b/src/xrGame/ui/UIDragDropReferenceList.cpp index 1ab530e6f68..ce359f41d2c 100644 --- a/src/xrGame/ui/UIDragDropReferenceList.cpp +++ b/src/xrGame/ui/UIDragDropReferenceList.cpp @@ -2,14 +2,14 @@ #include "UIDragDropReferenceList.h" #include "UICellItem.h" #include "UICellItemFactory.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "Inventory.h" #include "inventoryOwner.h" #include "Actor.h" #include "actor_defs.h" #include "UIInventoryUtilities.h" #include "xrEngine/xr_input.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "UICellItemFactory.h" CUIDragDropReferenceList::CUIDragDropReferenceList() diff --git a/src/xrGame/ui/UIEditBox_script.cpp b/src/xrGame/ui/UIEditBox_script.cpp deleted file mode 100644 index b3abe1ba8bb..00000000000 --- a/src/xrGame/ui/UIEditBox_script.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "pch_script.h" -#include "UIEditBox.h" -#include "xrScriptEngine/ScriptExporter.hpp" - -using namespace luabind; - -SCRIPT_EXPORT(CUIEditBox, (CUIWindow), { - module(luaState)[class_("CUICustomEdit") - .def("SetText", &CUICustomEdit::SetText) - .def("GetText", &CUICustomEdit::GetText) - .def("CaptureFocus", &CUICustomEdit::CaptureFocus) - .def("SetNextFocusCapturer", &CUICustomEdit::SetNextFocusCapturer), - class_("CUIEditBox") - .def(constructor<>()) - .def("InitTexture", &CUIEditBox::InitTexture)]; -}); diff --git a/src/xrGame/ui/UIEditKeyBind.h b/src/xrGame/ui/UIEditKeyBind.h index 21e9f0df22e..301dd3653f6 100644 --- a/src/xrGame/ui/UIEditKeyBind.h +++ b/src/xrGame/ui/UIEditKeyBind.h @@ -1,7 +1,7 @@ #pragma once -#include "UIStatic.h" -#include "UIOptionsItem.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Options/UIOptionsItem.h" struct _action; struct _keyboard; diff --git a/src/xrGame/ui/UIFactionWarWnd.cpp b/src/xrGame/ui/UIFactionWarWnd.cpp index 698eb19f8ff..e3e4dfeebaa 100644 --- a/src/xrGame/ui/UIFactionWarWnd.cpp +++ b/src/xrGame/ui/UIFactionWarWnd.cpp @@ -10,8 +10,8 @@ #include "UIFactionWarWnd.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "UIHelper.h" #include "FactionState.h" diff --git a/src/xrGame/ui/UIFactionWarWnd.h b/src/xrGame/ui/UIFactionWarWnd.h index f6df7c59c07..15f55ba83b6 100644 --- a/src/xrGame/ui/UIFactionWarWnd.h +++ b/src/xrGame/ui/UIFactionWarWnd.h @@ -6,8 +6,8 @@ //////////////////////////////////////////////////////////////////////////// #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "FactionState.h" #include "UIWarState.h" diff --git a/src/xrGame/ui/UIGameLog.cpp b/src/xrGame/ui/UIGameLog.cpp index 25433886eef..4a986e165cc 100644 --- a/src/xrGame/ui/UIGameLog.cpp +++ b/src/xrGame/ui/UIGameLog.cpp @@ -10,7 +10,7 @@ #include "UIXmlInit.h" #include "UIPdaMsgListItem.h" #include "UIPdaKillMessage.h" -#include "UILines.h" +#include "xrUICore/Lines/UILines.h" CUIGameLog::CUIGameLog() { diff --git a/src/xrGame/ui/UIGameLog.h b/src/xrGame/ui/UIGameLog.h index 64e1d18298c..995633bfb4a 100644 --- a/src/xrGame/ui/UIGameLog.h +++ b/src/xrGame/ui/UIGameLog.h @@ -8,7 +8,7 @@ #pragma once -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" class CUIXml; class CUIPdaKillMessage; diff --git a/src/xrGame/ui/UIGameTutorial.cpp b/src/xrGame/ui/UIGameTutorial.cpp index b3aa13265c2..c061c6cdd6d 100644 --- a/src/xrGame/ui/UIGameTutorial.cpp +++ b/src/xrGame/ui/UIGameTutorial.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "UIGameTutorial.h" -#include "UIWindow.h" -#include "UIStatic.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" #include "Common/object_broker.h" #include "xrEngine/xr_input.h" diff --git a/src/xrGame/ui/UIGameTutorialSimpleItem.cpp b/src/xrGame/ui/UIGameTutorialSimpleItem.cpp index 5d34ee69854..c426afb9b14 100644 --- a/src/xrGame/ui/UIGameTutorialSimpleItem.cpp +++ b/src/xrGame/ui/UIGameTutorialSimpleItem.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "UIGameTutorial.h" -#include "UIStatic.h" -#include "uicursor.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Cursor/UICursor.h" #include "UIXmlInit.h" #include "Common/object_broker.h" #include "xrEngine/xr_input.h" diff --git a/src/xrGame/ui/UIGameTutorialVideoItem.cpp b/src/xrGame/ui/UIGameTutorialVideoItem.cpp index add563cd38a..5afa8dba990 100644 --- a/src/xrGame/ui/UIGameTutorialVideoItem.cpp +++ b/src/xrGame/ui/UIGameTutorialVideoItem.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "UIGameTutorial.h" -#include "UIWindow.h" -#include "UIStatic.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" #include "Common/object_broker.h" #include "xrEngine/xr_input.h" @@ -10,7 +10,7 @@ #include "Include/xrRender/UISequenceVideoItem.h" #include "Include/xrRender/UIShader.h" #include "Include/xrRender/UIRender.h" -#include "uicursor.h" +#include "xrUICore/Cursor/UICursor.h" extern ENGINE_API BOOL bShowPauseString; diff --git a/src/xrGame/ui/UIHelper.cpp b/src/xrGame/ui/UIHelper.cpp index c4f826df712..919e7b9809c 100644 --- a/src/xrGame/ui/UIHelper.cpp +++ b/src/xrGame/ui/UIHelper.cpp @@ -9,14 +9,14 @@ #include "UIHelper.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" -#include "UIFrameLineWnd.h" -#include "UIFrameWindow.h" -#include "UI3tButton.h" -#include "UICheckButton.h" -#include "UIHint.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/Hint/UIHint.h" #include "UIDragDropReferenceList.h" -#include "UIEditBox.h" +#include "xrUICore/EditBox/UIEditBox.h" CUIStatic* UIHelper::CreateStatic(CUIXml& xml, LPCSTR ui_path, CUIWindow* parent) { diff --git a/src/xrGame/ui/UIHudStatesWnd.cpp b/src/xrGame/ui/UIHudStatesWnd.cpp index 07cf3e79de2..3db1143bdb3 100644 --- a/src/xrGame/ui/UIHudStatesWnd.cpp +++ b/src/xrGame/ui/UIHudStatesWnd.cpp @@ -7,12 +7,12 @@ #include "ActorHelmet.h" #include "Inventory.h" #include "RadioactiveZone.h" -#include "UIStatic.h" -#include "UIProgressBar.h" -#include "UIProgressShape.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" #include "UIXmlInit.h" #include "UIHelper.h" -#include "ui_arrow.h" +#include "xrUICore/arrow/ui_arrow.h" #include "UIInventoryUtilities.h" #include "CustomDetector.h" #include "ai/Monsters/BaseMonster/base_monster.h" diff --git a/src/xrGame/ui/UIHudStatesWnd.h b/src/xrGame/ui/UIHudStatesWnd.h index d4ab4fd7d0a..e71b3ed5b01 100644 --- a/src/xrGame/ui/UIHudStatesWnd.h +++ b/src/xrGame/ui/UIHudStatesWnd.h @@ -1,5 +1,5 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "xrServerEntities/alife_space.h" #include "xrServerEntities/inventory_space.h" #include "actor_defs.h" diff --git a/src/xrGame/ui/UIInvUpgrade.cpp b/src/xrGame/ui/UIInvUpgrade.cpp index d7a1708aad6..0fbcc8f383d 100644 --- a/src/xrGame/ui/UIInvUpgrade.cpp +++ b/src/xrGame/ui/UIInvUpgrade.cpp @@ -12,7 +12,7 @@ #include "UIInvUpgrade.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "ai_space.h" @@ -248,7 +248,7 @@ void UIUpgrade::OnClick() if (m_state == STATE_ENABLED || m_state == STATE_FOCUSED || m_state == STATE_TOUCHED) { m_parent_wnd->AskUsing( - make_string("%s %s", CStringTable().translate("st_upgrade_install").c_str(), get_upgrade()->name()).c_str(), + make_string("%s %s", StringTable().translate("st_upgrade_install").c_str(), get_upgrade()->name()).c_str(), get_upgrade()->id_str()); } m_parent_wnd->set_info_cur_upgrade(NULL); diff --git a/src/xrGame/ui/UIInvUpgrade.h b/src/xrGame/ui/UIInvUpgrade.h index c3d8fa684f2..09dc5381317 100644 --- a/src/xrGame/ui/UIInvUpgrade.h +++ b/src/xrGame/ui/UIInvUpgrade.h @@ -9,9 +9,9 @@ #ifndef UI_INVENTORY_UPGRADE_H_INCLUDED #define UI_INVENTORY_UPGRADE_H_INCLUDED -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" namespace inventory diff --git a/src/xrGame/ui/UIInvUpgradeInfo.cpp b/src/xrGame/ui/UIInvUpgradeInfo.cpp index a8d0a432379..aa514466ff5 100644 --- a/src/xrGame/ui/UIInvUpgradeInfo.cpp +++ b/src/xrGame/ui/UIInvUpgradeInfo.cpp @@ -11,9 +11,9 @@ #include "string_table.h" #include "Actor.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "UIInvUpgradeProperty.h" @@ -115,34 +115,34 @@ bool UIInvUpgradeInfo::init_upgrade(Upgrade_type* upgr, CInventoryItem* inv_item if (upg_res == inventory::upgrade::result_e_installed) { m_prereq->SetTextColor(color_rgba(117, 255, 123, 255)); - xr_sprintf(str_res, sizeof(str_res), "%s", CStringTable().translate("st_upgr_installed").c_str()); + xr_sprintf(str_res, sizeof(str_res), "%s", StringTable().translate("st_upgr_installed").c_str()); } else if (upg_res == inventory::upgrade::result_e_unknown) { - xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", CStringTable().translate("st_upgr_disable").c_str(), - CStringTable().translate("st_upgr_unknown").c_str()); + xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", StringTable().translate("st_upgr_disable").c_str(), + StringTable().translate("st_upgr_unknown").c_str()); m_cost->Show(false); } else if (upg_res == inventory::upgrade::result_e_group) - xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", CStringTable().translate("st_upgr_disable").c_str(), - CStringTable().translate("st_upgr_group").c_str()); + xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", StringTable().translate("st_upgr_disable").c_str(), + StringTable().translate("st_upgr_group").c_str()); else if (upg_res_script == inventory::upgrade::result_e_precondition_money) - xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", CStringTable().translate("st_upgr_disable").c_str(), - CStringTable().translate("st_upgr_cant_do").c_str()); + xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", StringTable().translate("st_upgr_disable").c_str(), + StringTable().translate("st_upgr_cant_do").c_str()); else { if (upg_res != inventory::upgrade::result_ok) { - xr_sprintf(str_res, sizeof(str_res), "%s:\\n%s", CStringTable().translate("st_upgr_disable").c_str(), + xr_sprintf(str_res, sizeof(str_res), "%s:\\n%s", StringTable().translate("st_upgr_disable").c_str(), m_upgrade->get_prerequisites()); if (upg_res == inventory::upgrade::result_e_parents) xr_sprintf(str_res, sizeof(str_res), "%s\\n - %s", str_res, - CStringTable().translate("st_upgr_parents").c_str()); + StringTable().translate("st_upgr_parents").c_str()); if (upg_res == inventory::upgrade::result_e_precondition_money) xr_sprintf(str_res, sizeof(str_res), "%s:\\n - %s", - CStringTable().translate("st_upgr_disable").c_str(), - CStringTable().translate("st_upgr_cant_do").c_str()); + StringTable().translate("st_upgr_disable").c_str(), + StringTable().translate("st_upgr_cant_do").c_str()); } } m_prereq->SetText(str_res); diff --git a/src/xrGame/ui/UIInvUpgradeInfo.h b/src/xrGame/ui/UIInvUpgradeInfo.h index 93557e7f00a..353ffc95af6 100644 --- a/src/xrGame/ui/UIInvUpgradeInfo.h +++ b/src/xrGame/ui/UIInvUpgradeInfo.h @@ -9,8 +9,8 @@ #ifndef UI_INVENTORY_UPGRADE_INFO_H_INCLUDED #define UI_INVENTORY_UPGRADE_INFO_H_INCLUDED -#include "UIWindow.h" -#include "xrUIXmlParser.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/XML/xrUIXmlParser.h" namespace inventory { diff --git a/src/xrGame/ui/UIInvUpgradeProperty.cpp b/src/xrGame/ui/UIInvUpgradeProperty.cpp index f8367c15567..030f56a296d 100644 --- a/src/xrGame/ui/UIInvUpgradeProperty.cpp +++ b/src/xrGame/ui/UIInvUpgradeProperty.cpp @@ -10,8 +10,8 @@ #include "UIInvUpgradeProperty.h" #include "UIInvUpgradeInfo.h" -#include "UIStatic.h" -#include "xrUIXmlParser.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "ai_space.h" diff --git a/src/xrGame/ui/UIInvUpgradeProperty.h b/src/xrGame/ui/UIInvUpgradeProperty.h index 4992fb93633..a1443a12aaf 100644 --- a/src/xrGame/ui/UIInvUpgradeProperty.h +++ b/src/xrGame/ui/UIInvUpgradeProperty.h @@ -9,7 +9,7 @@ #ifndef UI_INVENTORY_UPGRADE_PROPERTY_H_INCLUDED #define UI_INVENTORY_UPGRADE_PROPERTY_H_INCLUDED -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "inventory_item.h" #include "inventory_upgrade_property.h" diff --git a/src/xrGame/ui/UIInventoryUpgradeWnd.cpp b/src/xrGame/ui/UIInventoryUpgradeWnd.cpp index a5435e9b54a..12aad0d0e3a 100644 --- a/src/xrGame/ui/UIInventoryUpgradeWnd.cpp +++ b/src/xrGame/ui/UIInventoryUpgradeWnd.cpp @@ -10,7 +10,7 @@ #include "Common/object_broker.h" #include "UIInventoryUpgradeWnd.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "string_table.h" #include "Actor.h" @@ -24,10 +24,10 @@ #include "UIInventoryUtilities.h" #include "UIActorMenu.h" #include "UIItemInfo.h" -#include "UIFrameLineWnd.h" -#include "UI3tButton.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIHelper.h" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" #include "Weapon.h" #include "WeaponRPG7.h" #include "CustomOutfit.h" diff --git a/src/xrGame/ui/UIInventoryUpgradeWnd.h b/src/xrGame/ui/UIInventoryUpgradeWnd.h index cb5bb05d88d..6043c4f3005 100644 --- a/src/xrGame/ui/UIInventoryUpgradeWnd.h +++ b/src/xrGame/ui/UIInventoryUpgradeWnd.h @@ -9,7 +9,7 @@ #ifndef UI_INVENTORY_UPGRADE_WND_H_INCLUDED #define UI_INVENTORY_UPGRADE_WND_H_INCLUDED -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIInvUpgrade.h" extern const LPCSTR g_inventory_upgrade_xml; diff --git a/src/xrGame/ui/UIInventoryUpgradeWnd_add.cpp b/src/xrGame/ui/UIInventoryUpgradeWnd_add.cpp index f5a7b534012..62fe71918d9 100644 --- a/src/xrGame/ui/UIInventoryUpgradeWnd_add.cpp +++ b/src/xrGame/ui/UIInventoryUpgradeWnd_add.cpp @@ -9,7 +9,7 @@ #include "pch_script.h" #include "Common/object_broker.h" #include "UIInventoryUpgradeWnd.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "string_table.h" diff --git a/src/xrGame/ui/UIInventoryUtilities.cpp b/src/xrGame/ui/UIInventoryUtilities.cpp index a3d5b256aff..a7be671a841 100644 --- a/src/xrGame/ui/UIInventoryUtilities.cpp +++ b/src/xrGame/ui/UIInventoryUtilities.cpp @@ -1,8 +1,8 @@ #include "pch_script.h" #include "UIInventoryUtilities.h" #include "WeaponAmmo.h" -#include "UIStaticItem.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStaticItem.h" +#include "xrUICore/Static/UIStatic.h" #include "eatable_item.h" #include "Level.h" #include "date_time.h" @@ -321,7 +321,7 @@ const shared_str InventoryUtilities::GetDateAsString(ALife::_TIME_ID date, EDate split_time(date, year, month, day, hours, mins, secs, milisecs); VERIFY(1 <= month && month <= 12); - LPCSTR month_str = CStringTable().translate(st_months[month - 1]).c_str(); + LPCSTR month_str = StringTable().translate(st_months[month - 1]).c_str(); // Date switch (datePrec) @@ -348,20 +348,20 @@ LPCSTR InventoryUtilities::GetTimePeriodAsString(LPSTR _buff, u32 buff_sz, ALife if (month1 != month2) cnt = xr_sprintf( - _buff + cnt, buff_sz - cnt, "%d %s ", month2 - month1, *CStringTable().translate("ui_st_months")); + _buff + cnt, buff_sz - cnt, "%d %s ", month2 - month1, *StringTable().translate("ui_st_months")); if (!cnt && day1 != day2) - cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", day2 - day1, *CStringTable().translate("ui_st_days")); + cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", day2 - day1, *StringTable().translate("ui_st_days")); if (!cnt && hours1 != hours2) cnt = - xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", hours2 - hours1, *CStringTable().translate("ui_st_hours")); + xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", hours2 - hours1, *StringTable().translate("ui_st_hours")); if (!cnt && mins1 != mins2) - cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", mins2 - mins1, *CStringTable().translate("ui_st_mins")); + cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", mins2 - mins1, *StringTable().translate("ui_st_mins")); if (!cnt && secs1 != secs2) - cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", secs2 - secs1, *CStringTable().translate("ui_st_secs")); + cnt = xr_sprintf(_buff + cnt, buff_sz - cnt, "%d %s", secs2 - secs1, *StringTable().translate("ui_st_secs")); return _buff; } @@ -376,7 +376,7 @@ void InventoryUtilities::UpdateWeightStr(CUITextWnd& wnd, CUITextWnd& wnd_max, C float total = pInvOwner->inventory().CalcTotalWeight(); float max = pInvOwner->MaxCarryWeight(); - LPCSTR kg_str = CStringTable().translate("st_kg").c_str(); + LPCSTR kg_str = StringTable().translate("st_kg").c_str(); xr_sprintf(buf, "%.1f %s", total, kg_str); wnd.SetText(buf); diff --git a/src/xrGame/ui/UIInventoryUtilities.h b/src/xrGame/ui/UIInventoryUtilities.h index 6cf2020d867..485c759f13f 100644 --- a/src/xrGame/ui/UIInventoryUtilities.h +++ b/src/xrGame/ui/UIInventoryUtilities.h @@ -1,7 +1,7 @@ #pragma once #include "inventory_item.h" #include "character_info_defs.h" -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" class CUITextWnd; diff --git a/src/xrGame/ui/UIItemInfo.cpp b/src/xrGame/ui/UIItemInfo.cpp index f4b898768a3..ba3a6c561d2 100644 --- a/src/xrGame/ui/UIItemInfo.cpp +++ b/src/xrGame/ui/UIItemInfo.cpp @@ -1,10 +1,10 @@ #include "pch_script.h" #include "uiiteminfo.h" -#include "uistatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" -#include "UIScrollView.h" -#include "UIFrameWindow.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "ai_space.h" #include "alife_simulator.h" #include "string_table.h" @@ -206,7 +206,7 @@ void CUIItemInfo::InitItem(CUICellItem* pCellItem, CInventoryItem* pCompareItem, } if (UIWeight) { - LPCSTR kg_str = CStringTable().translate("st_kg").c_str(); + LPCSTR kg_str = StringTable().translate("st_kg").c_str(); float weight = pInvItem->Weight(); if (!weight) @@ -265,7 +265,7 @@ void CUIItemInfo::InitItem(CUICellItem* pCellItem, CInventoryItem* pCompareItem, UITradeTip->Show(false); else { - UITradeTip->SetText(CStringTable().translate(trade_tip).c_str()); + UITradeTip->SetText(StringTable().translate(trade_tip).c_str()); UITradeTip->AdjustHeightToText(); UITradeTip->SetWndPos(pos); UITradeTip->Show(true); diff --git a/src/xrGame/ui/UIItemInfo.h b/src/xrGame/ui/UIItemInfo.h index a35e16f98c6..4279b5ee8c3 100644 --- a/src/xrGame/ui/UIItemInfo.h +++ b/src/xrGame/ui/UIItemInfo.h @@ -1,5 +1,5 @@ #pragma once -#include "uiwindow.h" +#include "xrUICore/Windows/UIWindow.h" class CInventoryItem; class CUIStatic; diff --git a/src/xrGame/ui/UIKeyBinding.cpp b/src/xrGame/ui/UIKeyBinding.cpp index 687328507e8..991b3409945 100644 --- a/src/xrGame/ui/UIKeyBinding.cpp +++ b/src/xrGame/ui/UIKeyBinding.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" #include "UIKeyBinding.h" #include "UIXmlInit.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIEditKeyBind.h" -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "xr_level_controller.h" #include "string_table.h" @@ -36,7 +36,6 @@ void CUIKeyBinding::FillUpList(CUIXml& xml_doc_ui, LPCSTR path_ui) { string256 buf; CUIXml xml_doc; - CStringTable st; xml_doc.Load(CONFIG_PATH, UI_PATH, "ui_keybinding.xml"); int groupsCount = xml_doc.GetNodesNum("", 0, "group"); diff --git a/src/xrGame/ui/UIKeyBinding.h b/src/xrGame/ui/UIKeyBinding.h index f44825fd70a..8967d9313ef 100644 --- a/src/xrGame/ui/UIKeyBinding.h +++ b/src/xrGame/ui/UIKeyBinding.h @@ -1,9 +1,9 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UIEditBox.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/EditBox/UIEditBox.h" class CUIXml; class CUIScrollView; diff --git a/src/xrGame/ui/UIKickPlayer.cpp b/src/xrGame/ui/UIKickPlayer.cpp index fb079561ef9..e0c6d1a15d9 100644 --- a/src/xrGame/ui/UIKickPlayer.cpp +++ b/src/xrGame/ui/UIKickPlayer.cpp @@ -2,12 +2,12 @@ #include "UIKickPlayer.h" #include "UIVotingCategory.h" #include "UIXmlInit.h" -#include "UI3tButton.h" -#include "UIListBox.h" -#include "UIListBoxItem.h" -#include "UISpinNum.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" +#include "xrUICore/SpinBox/UISpinNum.h" #include "UIGameCustom.h" -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "Level.h" #include "game_cl_base.h" #include "game_cl_teamdeathmatch.h" diff --git a/src/xrGame/ui/UIListItemServer.cpp b/src/xrGame/ui/UIListItemServer.cpp index 03064683ce9..54caae939c0 100644 --- a/src/xrGame/ui/UIListItemServer.cpp +++ b/src/xrGame/ui/UIListItemServer.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "UIListItemServer.h" -#include "UITextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" CUIListItemServer::CUIListItemServer(float height) : inherited(height) { @@ -105,15 +105,15 @@ void CUIListItemServer::SetParams(LIST_SRV_ITEM& params) { string1024 buff; - LPCSTR _srv_name = CStringTable().translate(params.info.server).c_str(); + LPCSTR _srv_name = StringTable().translate(params.info.server).c_str(); cut_string_by_length(m_map->GetFont(), _srv_name, buff, sizeof(buff), m_server->GetWidth()); m_server->SetText(buff); - LPCSTR _map_name = CStringTable().translate(params.info.map).c_str(); + LPCSTR _map_name = StringTable().translate(params.info.map).c_str(); cut_string_by_length(m_map->GetFont(), _map_name, buff, sizeof(buff), m_map->GetWidth()); m_map->SetText(buff); - LPCSTR _game_name = CStringTable().translate(params.info.game).c_str(); + LPCSTR _game_name = StringTable().translate(params.info.game).c_str(); cut_string_by_length(m_game->GetFont(), _game_name, buff, sizeof(buff), m_game->GetWidth()); m_game->SetText(buff); diff --git a/src/xrGame/ui/UIListItemServer.h b/src/xrGame/ui/UIListItemServer.h index b4b8b44a3ed..40d8b9d7d98 100644 --- a/src/xrGame/ui/UIListItemServer.h +++ b/src/xrGame/ui/UIListItemServer.h @@ -1,7 +1,7 @@ #pragma once -#include "UIStatic.h" -#include "UIListBoxItem.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/ListBox/UIListBoxItem.h" struct LIST_SRV_SIZES { diff --git a/src/xrGame/ui/UILoadingScreen.h b/src/xrGame/ui/UILoadingScreen.h index f8f0ab5b517..071b75b06a8 100644 --- a/src/xrGame/ui/UILoadingScreen.h +++ b/src/xrGame/ui/UILoadingScreen.h @@ -9,8 +9,8 @@ #pragma once #include "xrEngine/ILoadingScreen.h" -#include "UIStatic.h" -#include "UIWindow.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Windows/UIWindow.h" class CApplication; diff --git a/src/xrGame/ui/UILogsWnd.cpp b/src/xrGame/ui/UILogsWnd.cpp index dc8884e459c..d895b25c3be 100644 --- a/src/xrGame/ui/UILogsWnd.cpp +++ b/src/xrGame/ui/UILogsWnd.cpp @@ -8,13 +8,13 @@ #include "stdafx.h" #include "UILogsWnd.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" -#include "UIFrameLineWnd.h" -#include "UIFrameWindow.h" -#include "UIScrollBar.h" -#include "UIFixedScrollBar.h" -#include "UIScrollView.h" -#include "UICheckButton.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/ScrollBar/UIScrollBar.h" +#include "xrUICore/ScrollBar/UIFixedScrollBar.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Buttons/UICheckButton.h" #include "UIHelper.h" #include "UICharacterInfo.h" #include "UIInventoryUtilities.h" @@ -106,7 +106,7 @@ void CUILogsWnd::Init() string256 buf; xr_strcpy(buf, sizeof(buf), m_center_caption->GetText()); - xr_strcat(buf, sizeof(buf), CStringTable().translate("ui_logs_center_caption").c_str()); + xr_strcat(buf, sizeof(buf), StringTable().translate("ui_logs_center_caption").c_str()); m_center_caption->SetText(buf); CUIFixedScrollBar* tmp_scroll = new CUIFixedScrollBar(); diff --git a/src/xrGame/ui/UILogsWnd.h b/src/xrGame/ui/UILogsWnd.h index c3b58f166f2..1e66909bddc 100644 --- a/src/xrGame/ui/UILogsWnd.h +++ b/src/xrGame/ui/UILogsWnd.h @@ -8,12 +8,12 @@ #ifndef UI_PDA_LOGS_WND_H_INCLUDED #define UI_PDA_LOGS_WND_H_INCLUDED -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "ai_space.h" #include "xrServerEntities/alife_space.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" class CUIStatic; class CUITextWnd; diff --git a/src/xrGame/ui/UIMMShniaga.cpp b/src/xrGame/ui/UIMMShniaga.cpp index 0aef3bed277..b84f4e16689 100644 --- a/src/xrGame/ui/UIMMShniaga.cpp +++ b/src/xrGame/ui/UIMMShniaga.cpp @@ -1,8 +1,8 @@ #include "StdAfx.h" #include "UIMMShniaga.h" -#include "UICursor.h" -#include "UIStatic.h" -#include "UIScrollView.h" +#include "xrUICore/Cursor/UICursor.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIXmlInit.h" #include "MMsound.h" #include "game_base_space.h" @@ -17,6 +17,31 @@ extern string_path g_last_saved_game; +CUIMMMagnifer::CUIMMMagnifer() : m_bPP(false) {} +CUIMMMagnifer::~CUIMMMagnifer() +{ + if (GetPPMode()) + MainMenu()->UnregisterPPDraw(this); +} + +void CUIMMMagnifer::SetPPMode() +{ + m_bPP = true; + MainMenu()->RegisterPPDraw(this); + Show(false); +}; + +void CUIMMMagnifer::ResetPPMode() +{ + if (GetPPMode()) + { + MainMenu()->UnregisterPPDraw(this); + m_bPP = false; + } +} + +//////////////////////////////////////////// + CUIMMShniaga::CUIMMShniaga() { m_sound = new CMMSound(); @@ -25,7 +50,7 @@ CUIMMShniaga::CUIMMShniaga() AttachChild(m_view); m_shniaga = new CUIStatic(); AttachChild(m_shniaga); - m_magnifier = new CUIStatic(); + m_magnifier = new CUIMMMagnifer(); m_shniaga->AttachChild(m_magnifier); m_magnifier->SetPPMode(); m_mag_pos = 0; diff --git a/src/xrGame/ui/UIMMShniaga.h b/src/xrGame/ui/UIMMShniaga.h index a85ee8bbc0f..347516e757a 100644 --- a/src/xrGame/ui/UIMMShniaga.h +++ b/src/xrGame/ui/UIMMShniaga.h @@ -1,6 +1,5 @@ #pragma once - -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIStatic; class CUITextWnd; @@ -8,6 +7,19 @@ class CUIXml; class CUIScrollView; class CMMSound; +class CUIMMMagnifer : public CUIStatic +{ +public: + CUIMMMagnifer(); + virtual ~CUIMMMagnifer(); + void SetPPMode(); + void ResetPPMode(); + bool GetPPMode() { return m_bPP; }; + +protected: + bool m_bPP; +}; + class CUIMMShniaga : public CUIWindow, public CDeviceResetNotifier { public: @@ -51,7 +63,7 @@ class CUIMMShniaga : public CUIWindow, public CDeviceResetNotifier float pos(float x1, float x2, u32 t); CUIStatic* m_shniaga; - CUIStatic* m_magnifier; + CUIMMMagnifer* m_magnifier; CUIScrollView* m_view; u32 m_start_time; diff --git a/src/xrGame/ui/UIMPAdminMenu.cpp b/src/xrGame/ui/UIMPAdminMenu.cpp index 980d1f95577..043f4cf5072 100644 --- a/src/xrGame/ui/UIMPAdminMenu.cpp +++ b/src/xrGame/ui/UIMPAdminMenu.cpp @@ -5,10 +5,10 @@ #include "UIMPChangeMapAdm.h" #include "UIXmlInit.h" #include "Common/object_broker.h" -#include "UITabControl.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UIMessageBox.h" +#include "xrUICore/TabControl/UITabControl.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/MessageBox/UIMessageBox.h" #include "UIMessageBoxEx.h" #include "xrEngine/xr_ioconsole.h" diff --git a/src/xrGame/ui/UIMPAdminMenu.h b/src/xrGame/ui/UIMPAdminMenu.h index 3a5fdc1e8bf..f311da392ab 100644 --- a/src/xrGame/ui/UIMPAdminMenu.h +++ b/src/xrGame/ui/UIMPAdminMenu.h @@ -1,8 +1,8 @@ #pragma once #include "UIDialogWnd.h" -#include "UIWndCallback.h" -#include "UIMessageBox.h" +#include "xrUICore/Callbacks/UIWndCallback.h" +#include "xrUICore/MessageBox/UIMessageBox.h" class CUIStatic; class CUITabControl; diff --git a/src/xrGame/ui/UIMPChangeMapAdm.cpp b/src/xrGame/ui/UIMPChangeMapAdm.cpp index 2f6a7dd23d8..c3121af57e4 100644 --- a/src/xrGame/ui/UIMPChangeMapAdm.cpp +++ b/src/xrGame/ui/UIMPChangeMapAdm.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" #include "UIMPChangeMapAdm.h" #include "UIXmlInit.h" -#include "UIListBox.h" -#include "UIListBoxItem.h" -#include "UIStatic.h" -#include "UI3tButton.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIDialogWnd.h" #include "Level.h" #include "xrEngine/xr_ioconsole.h" @@ -102,7 +102,7 @@ void CUIMpChangeMapAdm::FillUpList() u32 cnt = M.m_map_names.size(); for (u32 i = 0; i < cnt; ++i) { - CUIListBoxItem* itm = lst->AddTextItem(CStringTable().translate(M.m_map_names[i].map_name).c_str()); + CUIListBoxItem* itm = lst->AddTextItem(StringTable().translate(M.m_map_names[i].map_name).c_str()); itm->Enable(true); } } diff --git a/src/xrGame/ui/UIMPChangeMapAdm.h b/src/xrGame/ui/UIMPChangeMapAdm.h index f83b68bade0..ac2ca498a9b 100644 --- a/src/xrGame/ui/UIMPChangeMapAdm.h +++ b/src/xrGame/ui/UIMPChangeMapAdm.h @@ -1,7 +1,7 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIXml; class CUIStatic; diff --git a/src/xrGame/ui/UIMPPlayersAdm.cpp b/src/xrGame/ui/UIMPPlayersAdm.cpp index cd25d3a65d0..6a877515310 100644 --- a/src/xrGame/ui/UIMPPlayersAdm.cpp +++ b/src/xrGame/ui/UIMPPlayersAdm.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" #include "UIMPPlayersAdm.h" #include "UIXmlInit.h" -#include "UIListBox.h" -#include "UIListBoxItem.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UITrackBar.h" -#include "UIComboBox.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/TrackBar/UITrackBar.h" +#include "xrUICore/ComboBox/UIComboBox.h" #include "Level.h" #include "xrServer.h" #include "game_cl_base.h" @@ -177,7 +177,7 @@ void CUIMpPlayersAdm::SetMaxPingLimitText() { int ping_limit = m_pPingLimitTrack->GetIValue(); string512 tmp_string; - xr_sprintf(tmp_string, "%s %d", CStringTable().translate("ui_mp_am_ping_limit").c_str(), ping_limit * 10); + xr_sprintf(tmp_string, "%s %d", StringTable().translate("ui_mp_am_ping_limit").c_str(), ping_limit * 10); m_pPingLimitText->SetText(tmp_string); } void CUIMpPlayersAdm::GetSelPlayerScreenshot() diff --git a/src/xrGame/ui/UIMPPlayersAdm.h b/src/xrGame/ui/UIMPPlayersAdm.h index bacdc78afac..99cf3a7c094 100644 --- a/src/xrGame/ui/UIMPPlayersAdm.h +++ b/src/xrGame/ui/UIMPPlayersAdm.h @@ -1,7 +1,7 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIXml; class CUIListBox; diff --git a/src/xrGame/ui/UIMPServerAdm.cpp b/src/xrGame/ui/UIMPServerAdm.cpp index 43dfc40432c..ef42775149f 100644 --- a/src/xrGame/ui/UIMPServerAdm.cpp +++ b/src/xrGame/ui/UIMPServerAdm.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" #include "UIMPServerAdm.h" #include "UIXmlInit.h" -#include "UI3tButton.h" -#include "UIEditBox.h" -#include "UISpinNum.h" -#include "UICheckButton.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/SpinBox/UISpinNum.h" +#include "xrUICore/Buttons/UICheckButton.h" #include "xrEngine/xr_ioconsole.h" #include "UIDialogWnd.h" diff --git a/src/xrGame/ui/UIMPServerAdm.h b/src/xrGame/ui/UIMPServerAdm.h index 6f70f385137..f8873a3c1b1 100644 --- a/src/xrGame/ui/UIMPServerAdm.h +++ b/src/xrGame/ui/UIMPServerAdm.h @@ -1,8 +1,8 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" -#include "UI3tButton.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" +#include "xrUICore/Buttons/UI3tButton.h" class CUIXml; class CUI3tButton; diff --git a/src/xrGame/ui/UIMainIngameWnd.cpp b/src/xrGame/ui/UIMainIngameWnd.cpp index 73e647ceeac..4b42bb9ca6f 100644 --- a/src/xrGame/ui/UIMainIngameWnd.cpp +++ b/src/xrGame/ui/UIMainIngameWnd.cpp @@ -35,13 +35,14 @@ #include "attachable_item.h" #include "xrEngine/xr_input.h" #endif -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "map_hint.h" #include "game_news.h" #include "static_cast_checked.hpp" #include "game_cl_capture_the_artefact.h" #include "UIHudStatesWnd.h" #include "UIActorMenu.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" void test_draw(); void test_key(int dik); @@ -71,7 +72,6 @@ CUIMainIngameWnd::CUIMainIngameWnd() UIZoneMap = new CUIZoneMap(); } -#include "UIProgressShape.h" extern CUIProgressShape* g_MissileForceShape; CUIMainIngameWnd::~CUIMainIngameWnd() @@ -773,25 +773,25 @@ void CUIMainIngameWnd::UpdateMainIndicators() void CUIMainIngameWnd::UpdateQuickSlots() { string32 tmp; - LPCSTR str = CStringTable().translate("quick_use_str_1").c_str(); + LPCSTR str = StringTable().translate("quick_use_str_1").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlotText1->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_2").c_str(); + str = StringTable().translate("quick_use_str_2").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlotText2->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_3").c_str(); + str = StringTable().translate("quick_use_str_3").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; m_QuickSlotText3->SetTextST(tmp); - str = CStringTable().translate("quick_use_str_4").c_str(); + str = StringTable().translate("quick_use_str_4").c_str(); strncpy_s(tmp, sizeof(tmp), str, 3); if (tmp[2] == ',') tmp[1] = '\0'; diff --git a/src/xrGame/ui/UIMap.h b/src/xrGame/ui/UIMap.h index e4726454b4f..94fe4938739 100644 --- a/src/xrGame/ui/UIMap.h +++ b/src/xrGame/ui/UIMap.h @@ -1,6 +1,6 @@ #pragma once -#include "UIStatic.h" -#include "UIWndCallback.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIGlobalMapSpot; class CUIMapWnd; diff --git a/src/xrGame/ui/UIMapDesc.cpp b/src/xrGame/ui/UIMapDesc.cpp index 56f298095af..0952fc78ad8 100644 --- a/src/xrGame/ui/UIMapDesc.cpp +++ b/src/xrGame/ui/UIMapDesc.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" #include "UIMapDesc.h" -#include "UIStatic.h" -#include "UICursor.h" -#include "UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Cursor/UICursor.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIGameCustom.h" #include "Level.h" #include "game_cl_teamdeathmatch.h" diff --git a/src/xrGame/ui/UIMapInfo.cpp b/src/xrGame/ui/UIMapInfo.cpp index c85e6eb4f20..cfb21af2655 100644 --- a/src/xrGame/ui/UIMapInfo.cpp +++ b/src/xrGame/ui/UIMapInfo.cpp @@ -1,8 +1,8 @@ #include "StdAfx.h" #include "UIMapInfo.h" -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIXmlInit.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "string_table.h" CUIMapInfo::CUIMapInfo() @@ -23,13 +23,13 @@ void CUIMapInfo::InitMapInfo(Fvector2 pos, Fvector2 size) } #define ADD_TEXT(x, y, z) \ - text = *str_tbl.translate(x); \ + text = *StringTable().translate(x); \ text += ": "; \ text += txt_color_tag; \ if (ltx.line_exist("map_info", y)) \ - text += *str_tbl.translate(ltx.r_string_wb("map_info", y)); \ + text += *StringTable().translate(ltx.r_string_wb("map_info", y)); \ else \ - text += *str_tbl.translate(z); \ + text += *StringTable().translate(z); \ text += "%c[default]\\n"; \ st = new CUITextWnd(); \ st->SetTextComplexMode(true); \ @@ -46,8 +46,6 @@ void CUIMapInfo::InitMap(LPCSTR map_name, LPCSTR map_ver) if (NULL == map_name) return; - CStringTable str_tbl; - CUIXml xml_doc; xml_doc.Load(CONFIG_PATH, UI_PATH, "ui_mapinfo.xml"); @@ -68,7 +66,7 @@ void CUIMapInfo::InitMap(LPCSTR map_name, LPCSTR map_ver) st = new CUITextWnd(); CUIXmlInit::InitTextWnd(xml_doc, "map_name", 0, st); - xr_string S = str_tbl.translate(map_name).c_str(); + xr_string S = StringTable().translate(map_name).c_str(); if (map_ver) { S += "["; @@ -93,27 +91,27 @@ void CUIMapInfo::InitMap(LPCSTR map_name, LPCSTR map_ver) shared_str _modes = ltx.r_string_wb("map_info", "modes"); - text = *str_tbl.translate("modes"); + text = *StringTable().translate("modes"); text += ": "; text += txt_color_tag; bool b_ = false; if (strstr(_modes.c_str(), "st_deathmatch")) { - text += *str_tbl.translate("st_deathmatch"); + text += *StringTable().translate("st_deathmatch"); b_ = true; } if (strstr(_modes.c_str(), "st_team_deathmatch")) { if (b_) text += ", "; - text += *str_tbl.translate("st_team_deathmatch"); + text += *StringTable().translate("st_team_deathmatch"); b_ = true; } if (strstr(_modes.c_str(), "st_artefacthunt")) { if (b_) text += ", "; - text += *str_tbl.translate("st_artefacthunt"); + text += *StringTable().translate("st_artefacthunt"); } text += "%c[default]\\n"; @@ -130,7 +128,7 @@ void CUIMapInfo::InitMap(LPCSTR map_name, LPCSTR map_ver) ADD_TEXT("mp_description", "short_desc", ""); if (ltx.line_exist("map_info", "large_desc")) - m_large_desc = str_tbl.translate(ltx.r_string_wb("map_info", "large_desc")); + m_large_desc = StringTable().translate(ltx.r_string_wb("map_info", "large_desc")); } else { diff --git a/src/xrGame/ui/UIMapInfo.h b/src/xrGame/ui/UIMapInfo.h index 46fb72f9656..896fdc409a8 100644 --- a/src/xrGame/ui/UIMapInfo.h +++ b/src/xrGame/ui/UIMapInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIScrollView; diff --git a/src/xrGame/ui/UIMapLegend.cpp b/src/xrGame/ui/UIMapLegend.cpp index 1ddc3f21e07..fbc6f85c04a 100644 --- a/src/xrGame/ui/UIMapLegend.cpp +++ b/src/xrGame/ui/UIMapLegend.cpp @@ -8,17 +8,17 @@ #include "stdafx.h" #include "UIMapLegend.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "UIHelper.h" -#include "UIFrameWindow.h" -#include "UIScrollView.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UICheckButton.h" -#include "UIFrameLineWnd.h" -#include "UIHint.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Hint/UIHint.h" #include "UIInventoryUtilities.h" #include "string_table.h" diff --git a/src/xrGame/ui/UIMapLegend.h b/src/xrGame/ui/UIMapLegend.h index 4d9f08fbcc2..78d7c77c17d 100644 --- a/src/xrGame/ui/UIMapLegend.h +++ b/src/xrGame/ui/UIMapLegend.h @@ -8,7 +8,7 @@ #ifndef UI_MAP_LEGEND_WND_H_INCLUDED #define UI_MAP_LEGEND_WND_H_INCLUDED -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIXml; class CUIFrameWindow; diff --git a/src/xrGame/ui/UIMapList.cpp b/src/xrGame/ui/UIMapList.cpp index c9f6c546ef1..0920fb4bb6e 100644 --- a/src/xrGame/ui/UIMapList.cpp +++ b/src/xrGame/ui/UIMapList.cpp @@ -1,14 +1,14 @@ #include "StdAfx.h" #include "UIMapList.h" -#include "UIListBox.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UI3tButton.h" -#include "UISpinText.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/SpinBox/UISpinText.h" #include "UIXmlInit.h" #include "UIMapInfo.h" -#include "UIComboBox.h" -#include "UIListBoxItem.h" +#include "xrUICore/ComboBox/UIComboBox.h" +#include "xrUICore/ListBox/UIListBoxItem.h" #include "xrEngine/xr_ioconsole.h" #include "string_table.h" #include "Common/object_broker.h" @@ -154,13 +154,13 @@ EGameIDs CUIMapList::GetCurGameType() if (combo_ms) { text = combo_ms->GetText(); - if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes, eGameIDDeathmatch)))) + if (0 == xr_strcmp(text, StringTable().translate(get_token_name(g_GameModes, eGameIDDeathmatch)))) return eGameIDDeathmatch; - else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes, eGameIDTeamDeathmatch)))) + else if (0 == xr_strcmp(text, StringTable().translate(get_token_name(g_GameModes, eGameIDTeamDeathmatch)))) return eGameIDTeamDeathmatch; - else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes, eGameIDArtefactHunt)))) + else if (0 == xr_strcmp(text, StringTable().translate(get_token_name(g_GameModes, eGameIDArtefactHunt)))) return eGameIDArtefactHunt; - else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes, eGameIDCaptureTheArtefact)))) + else if (0 == xr_strcmp(text, StringTable().translate(get_token_name(g_GameModes, eGameIDCaptureTheArtefact)))) return eGameIDCaptureTheArtefact; else NODEFAULT; @@ -281,7 +281,7 @@ void CUIMapList::SetModeSelector(CUIWindow* ms) { m_pModeSelector = ms; } void CUIMapList::SetMapPic(CUIStatic* map_pic) { m_pMapPic = map_pic; } void CUIMapList::SetMapInfo(CUIMapInfo* map_info) { m_pMapInfo = map_info; } void CUIMapList::SetServerParams(LPCSTR params) { m_srv_params = params; } -#include "uilistboxitem.h" +#include "xrUICore/ListBox/UIListBoxItem.h" void CUIMapList::AddWeather(const shared_str& WeatherType, const shared_str& WeatherTime, u32 _id) { R_ASSERT2(m_pWeatherSelector, "m_pWeatherSelector == NULL"); @@ -318,7 +318,7 @@ void CUIMapList::UpdateMapList(EGameIDs GameType) u32 cnt = M.m_map_names.size(); for (u32 i = 0; i < cnt; ++i) { - CUIListBoxItem* itm = m_pList1->AddTextItem(CStringTable().translate(M.m_map_names[i].map_name).c_str()); + CUIListBoxItem* itm = m_pList1->AddTextItem(StringTable().translate(M.m_map_names[i].map_name).c_str()); itm->SetData((void*)(__int64)i); itm->Enable(true); } diff --git a/src/xrGame/ui/UIMapList.h b/src/xrGame/ui/UIMapList.h index 58f14142508..6c901dbfcb5 100644 --- a/src/xrGame/ui/UIMapList.h +++ b/src/xrGame/ui/UIMapList.h @@ -1,5 +1,5 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "gametype_chooser.h" #include "uiGameCustom.h" diff --git a/src/xrGame/ui/UIMapWnd.cpp b/src/xrGame/ui/UIMapWnd.cpp index 7408c19cdf6..97093943814 100644 --- a/src/xrGame/ui/UIMapWnd.cpp +++ b/src/xrGame/ui/UIMapWnd.cpp @@ -7,16 +7,16 @@ #include "UIInventoryUtilities.h" #include "map_spot.h" #include "map_location.h" -#include "UIFixedScrollBar.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UITabControl.h" -#include "UI3tButton.h" +#include "xrUICore/ScrollBar/UIFixedScrollBar.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/TabControl/UITabControl.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIMapWndActions.h" #include "UIMapWndActionsSpace.h" -#include "UIHint.h" +#include "xrUICore/Hint/UIHint.h" #include "map_hint.h" -#include "uicursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "xrEngine/xr_input.h" //remove me !!! CUIMapWnd* g_map_wnd = NULL; // quick temporary solution -( diff --git a/src/xrGame/ui/UIMapWnd.h b/src/xrGame/ui/UIMapWnd.h index c8958f2eeb3..236b3868349 100644 --- a/src/xrGame/ui/UIMapWnd.h +++ b/src/xrGame/ui/UIMapWnd.h @@ -1,7 +1,7 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUICustomMap; class CUIGlobalMap; diff --git a/src/xrGame/ui/UIMapWnd2.cpp b/src/xrGame/ui/UIMapWnd2.cpp index 533bae0ba75..950b498eb93 100644 --- a/src/xrGame/ui/UIMapWnd2.cpp +++ b/src/xrGame/ui/UIMapWnd2.cpp @@ -2,7 +2,7 @@ #include "UIMapWnd.h" #include "UIMap.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIHelper.h" #include "UITaskWnd.h" diff --git a/src/xrGame/ui/UIMessageBoxEx.cpp b/src/xrGame/ui/UIMessageBoxEx.cpp index 8f2a26dfc87..8ee7dc426d7 100644 --- a/src/xrGame/ui/UIMessageBoxEx.cpp +++ b/src/xrGame/ui/UIMessageBoxEx.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "UIMessageBox.h" +#include "xrUICore/MessageBox/UIMessageBox.h" #include "UIMessageBoxEx.h" #include "UIDialogHolder.h" diff --git a/src/xrGame/ui/UIMessageBoxEx.h b/src/xrGame/ui/UIMessageBoxEx.h index 707bf7967d8..700c2eb469b 100644 --- a/src/xrGame/ui/UIMessageBoxEx.h +++ b/src/xrGame/ui/UIMessageBoxEx.h @@ -1,6 +1,6 @@ #pragma once #include "UIDialogWnd.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIMessageBox; diff --git a/src/xrGame/ui/UIMessagesWindow.cpp b/src/xrGame/ui/UIMessagesWindow.cpp index 47ef564ddb5..1a7390fa678 100644 --- a/src/xrGame/ui/UIMessagesWindow.cpp +++ b/src/xrGame/ui/UIMessagesWindow.cpp @@ -10,7 +10,7 @@ #include "UIMessagesWindow.h" #include "UIGameLog.h" #include "UIChatWnd.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "UIInventoryUtilities.h" #include "game_news.h" diff --git a/src/xrGame/ui/UIMessagesWindow.h b/src/xrGame/ui/UIMessagesWindow.h index c6842475d2f..3a5f80c514b 100644 --- a/src/xrGame/ui/UIMessagesWindow.h +++ b/src/xrGame/ui/UIMessagesWindow.h @@ -8,7 +8,7 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIGameLog; class CUIChatWnd; diff --git a/src/xrGame/ui/UIMoneyIndicator.cpp b/src/xrGame/ui/UIMoneyIndicator.cpp index 5e25263109a..a5a0d2a6d32 100644 --- a/src/xrGame/ui/UIMoneyIndicator.cpp +++ b/src/xrGame/ui/UIMoneyIndicator.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UIMoneyIndicator.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "UIGameLog.h" diff --git a/src/xrGame/ui/UIMoneyIndicator.h b/src/xrGame/ui/UIMoneyIndicator.h index 1f82d6e4c04..e5cd005f64b 100644 --- a/src/xrGame/ui/UIMoneyIndicator.h +++ b/src/xrGame/ui/UIMoneyIndicator.h @@ -1,6 +1,6 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "KillMessageStruct.h" class CUIXml; diff --git a/src/xrGame/ui/UIMotionIcon.h b/src/xrGame/ui/UIMotionIcon.h index cfd41c1384d..79792314b7f 100644 --- a/src/xrGame/ui/UIMotionIcon.h +++ b/src/xrGame/ui/UIMotionIcon.h @@ -1,6 +1,6 @@ #pragma once -#include "UIProgressBar.h" -#include "UIProgressShape.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" class CUIMotionIcon : public CUIWindow { diff --git a/src/xrGame/ui/UIMpTradeWnd.cpp b/src/xrGame/ui/UIMpTradeWnd.cpp index 40ee200ed59..cf850e3654e 100644 --- a/src/xrGame/ui/UIMpTradeWnd.cpp +++ b/src/xrGame/ui/UIMpTradeWnd.cpp @@ -2,7 +2,7 @@ #include "UIMpTradeWnd.h" #include "UIMpItemsStoreWnd.h" #include "UITabButtonMP.h" -#include "UITabControl.h" +#include "xrUICore/TabControl/UITabControl.h" #include "UIDragDropListEx.h" #include "UICellItem.h" #include "UIDialogHolder.h" diff --git a/src/xrGame/ui/UIMpTradeWnd.h b/src/xrGame/ui/UIMpTradeWnd.h index ceeabe69812..4e6b50f8a40 100644 --- a/src/xrGame/ui/UIMpTradeWnd.h +++ b/src/xrGame/ui/UIMpTradeWnd.h @@ -2,7 +2,7 @@ #include "UIBuyWndShared.h" #include "UIBuyWndBase.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "restrictions.h" #include "UIMpItemsStoreWnd.h" diff --git a/src/xrGame/ui/UIMpTradeWnd_init.cpp b/src/xrGame/ui/UIMpTradeWnd_init.cpp index 6fc71ed60b3..bf138bbeaf8 100644 --- a/src/xrGame/ui/UIMpTradeWnd_init.cpp +++ b/src/xrGame/ui/UIMpTradeWnd_init.cpp @@ -3,7 +3,7 @@ #include "UIXmlInit.h" #include "UIMpItemsStoreWnd.h" -#include "UITabControl.h" +#include "xrUICore/TabControl/UITabControl.h" #include "UITabButtonMP.h" #include "UIDragDropListEx.h" #include "UIItemInfo.h" diff --git a/src/xrGame/ui/UIMpTradeWnd_items.cpp b/src/xrGame/ui/UIMpTradeWnd_items.cpp index 6bba4e8402a..a7d780c4e77 100644 --- a/src/xrGame/ui/UIMpTradeWnd_items.cpp +++ b/src/xrGame/ui/UIMpTradeWnd_items.cpp @@ -536,7 +536,7 @@ void CUIMpTradeWnd::StorePreset(ETradePreset idx, bool bSilent, bool check_allow if (!bSilent) { string512 buff; - xr_sprintf(buff, "%s [%d]", CStringTable().translate("ui_st_preset_stored_to").c_str(), idx); + xr_sprintf(buff, "%s [%d]", StringTable().translate("ui_st_preset_stored_to").c_str(), idx); SetInfoString(buff); } auto it = m_all_items.begin(); diff --git a/src/xrGame/ui/UIMpTradeWnd_misc.cpp b/src/xrGame/ui/UIMpTradeWnd_misc.cpp index 02fe96f09f0..43020d80a16 100644 --- a/src/xrGame/ui/UIMpTradeWnd_misc.cpp +++ b/src/xrGame/ui/UIMpTradeWnd_misc.cpp @@ -2,10 +2,10 @@ #include "UIMpTradeWnd.h" #include "UIMpItemsStoreWnd.h" #include "UICellItem.h" -#include "UITabControl.h" +#include "xrUICore/TabControl/UITabControl.h" #include "UIDragDropListEx.h" #include "UIItemInfo.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "inventory_item.h" #include "PhysicsShellHolder.h" #include "Common/object_broker.h" diff --git a/src/xrGame/ui/UIMpTradeWnd_trade.cpp b/src/xrGame/ui/UIMpTradeWnd_trade.cpp index b957c51c215..44076a27055 100644 --- a/src/xrGame/ui/UIMpTradeWnd_trade.cpp +++ b/src/xrGame/ui/UIMpTradeWnd_trade.cpp @@ -214,10 +214,10 @@ bool CUIMpTradeWnd::CheckBuyPossibility(const shared_str& sect_name, u32 buy_fla { if (!b_silent) xr_sprintf(info_buffer, "%s. %s. %s[%d] %s[%d]", - CStringTable().translate("ui_inv_cant_buy_item").c_str(), - CStringTable().translate("ui_inv_not_enought_money").c_str(), - CStringTable().translate("ui_inv_has").c_str(), GetMoneyAmount(), - CStringTable().translate("ui_inv_need").c_str(), _item_cost); + StringTable().translate("ui_inv_cant_buy_item").c_str(), + StringTable().translate("ui_inv_not_enought_money").c_str(), + StringTable().translate("ui_inv_has").c_str(), GetMoneyAmount(), + StringTable().translate("ui_inv_need").c_str(), _item_cost); b_can_buy = false; }; } @@ -225,9 +225,9 @@ bool CUIMpTradeWnd::CheckBuyPossibility(const shared_str& sect_name, u32 buy_fla if (b_can_buy && (buy_flags & bf_check_rank_restr) && !g_mp_restrictions.IsAvailable(sect_name)) { if (!b_silent) - xr_sprintf(info_buffer, "%s. %s. %s[%s] %s[%s] ", CStringTable().translate("ui_inv_cant_buy_item").c_str(), - CStringTable().translate("ui_inv_rank_restr").c_str(), CStringTable().translate("ui_inv_has").c_str(), - g_mp_restrictions.GetRankName(GetRank()).c_str(), CStringTable().translate("ui_inv_need").c_str(), + xr_sprintf(info_buffer, "%s. %s. %s[%s] %s[%s] ", StringTable().translate("ui_inv_cant_buy_item").c_str(), + StringTable().translate("ui_inv_rank_restr").c_str(), StringTable().translate("ui_inv_has").c_str(), + g_mp_restrictions.GetRankName(GetRank()).c_str(), StringTable().translate("ui_inv_need").c_str(), g_mp_restrictions.GetRankName(get_rank(sect_name)).c_str()); b_can_buy = false; } @@ -243,9 +243,9 @@ bool CUIMpTradeWnd::CheckBuyPossibility(const shared_str& sect_name, u32 buy_fla if (cnt_have >= cnt_restr) { if (!b_silent) - xr_sprintf(info_buffer, "%s. %s. %s [%d]", CStringTable().translate("ui_inv_cant_buy_item").c_str(), - CStringTable().translate("ui_inv_count_restr").c_str(), - CStringTable().translate("ui_inv_you_already_have").c_str(), cnt_have); + xr_sprintf(info_buffer, "%s. %s. %s [%d]", StringTable().translate("ui_inv_cant_buy_item").c_str(), + StringTable().translate("ui_inv_count_restr").c_str(), + StringTable().translate("ui_inv_you_already_have").c_str(), cnt_have); b_can_buy = false; } } diff --git a/src/xrGame/ui/UINewsItemWnd.cpp b/src/xrGame/ui/UINewsItemWnd.cpp index 61508c68ad0..af442aa742b 100644 --- a/src/xrGame/ui/UINewsItemWnd.cpp +++ b/src/xrGame/ui/UINewsItemWnd.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UINewsItemWnd.h" #include "UIXmlInit.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "game_news.h" #include "date_time.h" #include "UIInventoryUtilities.h" diff --git a/src/xrGame/ui/UINewsItemWnd.h b/src/xrGame/ui/UINewsItemWnd.h index 02cddbbde38..786f2d4de8a 100644 --- a/src/xrGame/ui/UINewsItemWnd.h +++ b/src/xrGame/ui/UINewsItemWnd.h @@ -1,6 +1,6 @@ #pragma once -#include "UIWindow.h" -#include "xrUIXmlParser.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/XML/xrUIXmlParser.h" class CUIStatic; class CUITextWnd; diff --git a/src/xrGame/ui/UIOptionsManagerScript.h b/src/xrGame/ui/UIOptionsManagerScript.h deleted file mode 100644 index 7b922717508..00000000000 --- a/src/xrGame/ui/UIOptionsManagerScript.h +++ /dev/null @@ -1,15 +0,0 @@ - -#pragma once - -class CUIOptionsManagerScript -{ -public: - void SaveBackupValues(LPCSTR group); - void SetCurrentValues(LPCSTR group); - void SaveValues(LPCSTR group); - void UndoGroup(LPCSTR group); - void OptionsPostAccept(); - void SendMessage2Group(LPCSTR group, LPCSTR message); - bool NeedSystemRestart(); - bool NeedVidRestart(); -}; diff --git a/src/xrGame/ui/UIOutfitInfo.cpp b/src/xrGame/ui/UIOutfitInfo.cpp index bdb42f77f0b..509e09b8f25 100644 --- a/src/xrGame/ui/UIOutfitInfo.cpp +++ b/src/xrGame/ui/UIOutfitInfo.cpp @@ -1,8 +1,8 @@ #include "StdAfx.h" #include "UIOutfitInfo.h" #include "UIXmlInit.h" -#include "UIStatic.h" -#include "UIDoubleProgressBar.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/ProgressBar/UIDoubleProgressBar.h" #include "CustomOutfit.h" #include "ActorHelmet.h" #include "string_table.h" diff --git a/src/xrGame/ui/UIOutfitInfo.h b/src/xrGame/ui/UIOutfitInfo.h index 01a178102a4..f97af99d453 100644 --- a/src/xrGame/ui/UIOutfitInfo.h +++ b/src/xrGame/ui/UIOutfitInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "UIWindow.h" -#include "UIDoubleProgressBar.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/ProgressBar/UIDoubleProgressBar.h" #include "xrServerEntities/alife_space.h" class CCustomOutfit; diff --git a/src/xrGame/ui/UIPdaKillMessage.h b/src/xrGame/ui/UIPdaKillMessage.h index ba65e0dd132..960a2ded1ad 100644 --- a/src/xrGame/ui/UIPdaKillMessage.h +++ b/src/xrGame/ui/UIPdaKillMessage.h @@ -1,7 +1,7 @@ #pragma once #include "KillMessageStruct.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUIPdaKillMessage : public CUIColorAnimConrollerContainer { diff --git a/src/xrGame/ui/UIPdaMsgListItem.cpp b/src/xrGame/ui/UIPdaMsgListItem.cpp index 75dba3d7a7d..65d06830a43 100644 --- a/src/xrGame/ui/UIPdaMsgListItem.cpp +++ b/src/xrGame/ui/UIPdaMsgListItem.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UIPdaMsgListItem.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" void CUIPdaMsgListItem::SetFont(CGameFont* pFont) diff --git a/src/xrGame/ui/UIPdaMsgListItem.h b/src/xrGame/ui/UIPdaMsgListItem.h index b8fc263f61b..6eba337cfde 100644 --- a/src/xrGame/ui/UIPdaMsgListItem.h +++ b/src/xrGame/ui/UIPdaMsgListItem.h @@ -1,5 +1,5 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUIPdaMsgListItem : public CUIColorAnimConrollerContainer { diff --git a/src/xrGame/ui/UIPdaWnd.cpp b/src/xrGame/ui/UIPdaWnd.cpp index c20b9450832..e8bd186d9b1 100644 --- a/src/xrGame/ui/UIPdaWnd.cpp +++ b/src/xrGame/ui/UIPdaWnd.cpp @@ -2,27 +2,27 @@ #include "UIPdaWnd.h" #include "PDA.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "UIInventoryUtilities.h" #include "Level.h" #include "UIGameCustom.h" -#include "UIStatic.h" -#include "UIFrameWindow.h" -#include "UITabControl.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/TabControl/UITabControl.h" #include "UIMapWnd.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "Common/object_broker.h" #include "UIMessagesWindow.h" #include "UIMainIngameWnd.h" -#include "UITabButton.h" -#include "UIAnimatedStatic.h" +#include "xrUICore/TabControl/UITabButton.h" +#include "xrUICore/Static/UIAnimatedStatic.h" #include "UIHelper.h" -#include "UIHint.h" -#include "UIBtnHint.h" +#include "xrUICore/Hint/UIHint.h" +#include "xrUICore/Buttons/UIBtnHint.h" #include "UITaskWnd.h" #include "UIFactionWarWnd.h" #include "UIRankingWnd.h" diff --git a/src/xrGame/ui/UIProgressBar_script.cpp b/src/xrGame/ui/UIProgressBar_script.cpp deleted file mode 100644 index edf5b80bf34..00000000000 --- a/src/xrGame/ui/UIProgressBar_script.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "pch_script.h" -#include "UIProgressBar.h" -#include "xrScriptEngine/ScriptExporter.hpp" - -using namespace luabind; - -SCRIPT_EXPORT(CUIProgressBar, (CUIWindow), { - module(luaState)[class_("CUIProgressBar") - .def(constructor<>()) - .def("SetProgressPos", &CUIProgressBar::SetProgressPos) - .def("GetProgressPos", &CUIProgressBar::GetProgressPos) - - .def("GetRange_min", &CUIProgressBar::GetRange_min) - .def("GetRange_max", &CUIProgressBar::GetRange_max)]; -}); diff --git a/src/xrGame/ui/UIRankIndicator.cpp b/src/xrGame/ui/UIRankIndicator.cpp index 4f0403e0419..716776e4e4c 100644 --- a/src/xrGame/ui/UIRankIndicator.cpp +++ b/src/xrGame/ui/UIRankIndicator.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UIRankIndicator.h" #include "UIXmlInit.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" CUIRankIndicator::CUIRankIndicator() { m_current = u8(-1); } CUIRankIndicator::~CUIRankIndicator() diff --git a/src/xrGame/ui/UIRankIndicator.h b/src/xrGame/ui/UIRankIndicator.h index aa7c312811a..f021c755a47 100644 --- a/src/xrGame/ui/UIRankIndicator.h +++ b/src/xrGame/ui/UIRankIndicator.h @@ -1,6 +1,6 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIStatic; class CUIXml; class CUIStatic; diff --git a/src/xrGame/ui/UIRankingWnd.cpp b/src/xrGame/ui/UIRankingWnd.cpp index 31655cdef8d..08e9e62cf42 100644 --- a/src/xrGame/ui/UIRankingWnd.cpp +++ b/src/xrGame/ui/UIRankingWnd.cpp @@ -7,11 +7,11 @@ #include "pch_script.h" #include "UIRankingWnd.h" -#include "UIFixedScrollBar.h" +#include "xrUICore/ScrollBar/UIFixedScrollBar.h" #include "UIXmlInit.h" -#include "UIProgressBar.h" -#include "UIFrameLineWnd.h" -#include "UIScrollView.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIHelper.h" #include "UIInventoryUtilities.h" #include "Actor.h" @@ -23,7 +23,7 @@ #include "relation_registry.h" #include "string_table.h" #include "UICharacterInfo.h" -#include "ui_base.h" +#include "xrUICore/ui_base.h" #define PDA_RANKING_XML "pda_ranking.xml" @@ -127,7 +127,7 @@ void CUIRankingWnd::Init() string256 buf; xr_strcpy(buf, sizeof(buf), m_center_caption->GetText()); - xr_strcat(buf, sizeof(buf), CStringTable().translate("ui_ranking_center_caption").c_str()); + xr_strcat(buf, sizeof(buf), StringTable().translate("ui_ranking_center_caption").c_str()); m_center_caption->SetText(buf); m_monster_icon_back = UIHelper::CreateStatic(xml, "monster_icon_back", this); diff --git a/src/xrGame/ui/UIRankingWnd.h b/src/xrGame/ui/UIRankingWnd.h index 60257f17e06..22ee4e1410e 100644 --- a/src/xrGame/ui/UIRankingWnd.h +++ b/src/xrGame/ui/UIRankingWnd.h @@ -6,9 +6,8 @@ //////////////////////////////////////////////////////////////////////////// #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" - +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "UIAchievements.h" class CUIStatic; diff --git a/src/xrGame/ui/UIScriptWnd.cpp b/src/xrGame/ui/UIScriptWnd.cpp index 0840fc9b297..b5de0810201 100644 --- a/src/xrGame/ui/UIScriptWnd.cpp +++ b/src/xrGame/ui/UIScriptWnd.cpp @@ -1,7 +1,7 @@ #include "pch_script.h" #include "UIScriptWnd.h" #include "Common/object_broker.h" -#include "callback_info.h" +#include "xrUICore/Callbacks/callback_info.h" CUIDialogWndEx::CUIDialogWndEx() {} CUIDialogWndEx::~CUIDialogWndEx() { delete_data(m_callbacks); } diff --git a/src/xrGame/ui/UISecondTaskWnd.cpp b/src/xrGame/ui/UISecondTaskWnd.cpp index 2540387a60f..c02b207a90e 100644 --- a/src/xrGame/ui/UISecondTaskWnd.cpp +++ b/src/xrGame/ui/UISecondTaskWnd.cpp @@ -7,17 +7,17 @@ #include "stdafx.h" #include "UISecondTaskWnd.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" #include "UIHelper.h" -#include "UIFrameWindow.h" -#include "UIScrollView.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UICheckButton.h" -#include "UIFrameLineWnd.h" -#include "UIFixedScrollBar.h" -#include "UIHint.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/ScrollBar/UIFixedScrollBar.h" +#include "xrUICore/Hint/UIHint.h" #include "UITaskWnd.h" #include "GameTaskDefs.h" #include "GameTask.h" diff --git a/src/xrGame/ui/UISecondTaskWnd.h b/src/xrGame/ui/UISecondTaskWnd.h index 71e6cf3b215..cf400c0e5dc 100644 --- a/src/xrGame/ui/UISecondTaskWnd.h +++ b/src/xrGame/ui/UISecondTaskWnd.h @@ -8,8 +8,8 @@ #ifndef UI_SECOND_TASK_WND_H_INCLUDED #define UI_SECOND_TASK_WND_H_INCLUDED -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #define PDA_TASK_XML "pda_tasks.xml" diff --git a/src/xrGame/ui/UIServerInfo.cpp b/src/xrGame/ui/UIServerInfo.cpp index e7901d494fa..94af18bbc55 100644 --- a/src/xrGame/ui/UIServerInfo.cpp +++ b/src/xrGame/ui/UIServerInfo.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" #include "UIServerInfo.h" -#include "UIStatic.h" -#include "UICursor.h" -#include "UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Cursor/UICursor.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIGameCustom.h" #include "Level.h" #include "game_cl_mp.h" diff --git a/src/xrGame/ui/UIServerInfo.h b/src/xrGame/ui/UIServerInfo.h index 090e16a84f3..82b6c6c9444 100644 --- a/src/xrGame/ui/UIServerInfo.h +++ b/src/xrGame/ui/UIServerInfo.h @@ -2,7 +2,7 @@ #define UISERVER_INFO_INCLUDED #include "UIDialogWnd.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIStatic; class CUIScrollView; diff --git a/src/xrGame/ui/UISkinSelector.cpp b/src/xrGame/ui/UISkinSelector.cpp index fa6d1ce64b4..0a9d192c34e 100644 --- a/src/xrGame/ui/UISkinSelector.cpp +++ b/src/xrGame/ui/UISkinSelector.cpp @@ -1,10 +1,10 @@ #include "StdAfx.h" #include "UISkinSelector.h" #include "UIXmlInit.h" -#include "UIAnimatedStatic.h" -#include "UI3tButton.h" +#include "xrUICore/Static/UIAnimatedStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIStatix.h" -#include "UICursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "UIGameCustom.h" #include "game_cl_deathmatch.h" #include "xr_level_controller.h" diff --git a/src/xrGame/ui/UISleepStatic.cpp b/src/xrGame/ui/UISleepStatic.cpp new file mode 100644 index 00000000000..a71c48520a7 --- /dev/null +++ b/src/xrGame/ui/UISleepStatic.cpp @@ -0,0 +1,66 @@ +#include "stdafx.h" +#include "UISleepStatic.h" +#include "Actor_Flags.h" +#include "Level.h" +#include "date_time.h" +#include "xrUICore/XML/UITextureMaster.h" + +CUISleepStatic::CUISleepStatic() : m_cur_time(0){}; + +void CUISleepStatic::Draw() +{ + // inherited::Draw(); + m_UIStaticItem.Render(); + m_UIStaticItem2.Render(); +} + +void CUISleepStatic::Update() +{ + u32 year = 0, month = 0, day = 0, hours = 0, mins = 0, secs = 0, milisecs = 0; + split_time(Level().GetGameTime(), year, month, day, hours, mins, secs, milisecs); + + u32 start_pixel = 0, end_pixel = 0, start_pixel2 = 0, end_pixel2 = 0; + hours += psActorSleepTime - 1; + if (hours >= 24) + hours -= 24; + + start_pixel = hours * 85; + end_pixel = (hours + 7) * 85; + if (end_pixel > 2048) + { + end_pixel2 = end_pixel - 2048; + end_pixel = 2048; + } + + Fvector2 parent_pos = GetParent()->GetWndPos(); + Fvector2 pos = GetWndPos(); + pos.x += parent_pos.x; + pos.y += parent_pos.y; + + Frect r = Frect().set((float)start_pixel, 0.0f, (float)end_pixel, 128.0f); + m_UIStaticItem.SetTextureRect(r); + m_UIStaticItem.SetSize(Fvector2().set(iFloor((end_pixel - start_pixel) * UI().get_current_kx()), 128)); + m_UIStaticItem.SetPos(pos.x, pos.y); + if (end_pixel2 > 0) + { + r.set((float)start_pixel2, 0.0f, (float)end_pixel2, 128.0f); + m_UIStaticItem2.SetTextureRect(r); + m_UIStaticItem2.SetSize(Fvector2().set(iFloor(end_pixel2 * UI().get_current_kx()), 128)); + m_UIStaticItem2.SetPos(m_UIStaticItem.GetPosX() + m_UIStaticItem.GetSize().x, m_UIStaticItem.GetPosY()); + } + else + m_UIStaticItem2.SetSize(Fvector2().set(1, 1)); +} + +void CUISleepStatic::InitTextureEx(LPCSTR tex_name, LPCSTR sh_name) +{ + inherited::InitTextureEx(tex_name, sh_name); + + LPCSTR res_shname = GEnv.UIRender->UpdateShaderName(tex_name, sh_name); + CUITextureMaster::InitTexture(tex_name, &m_UIStaticItem2, res_shname); + + Fvector2 p = GetWndPos(); + m_UIStaticItem2.SetPos(p.x, p.y); + p.set(1, 1); + m_UIStaticItem2.SetSize(p); +} diff --git a/src/xrGame/ui/UISleepStatic.h b/src/xrGame/ui/UISleepStatic.h new file mode 100644 index 00000000000..af44c580f0a --- /dev/null +++ b/src/xrGame/ui/UISleepStatic.h @@ -0,0 +1,17 @@ +#pragma once +#include "xrUICore/Static/UIStatic.h" + +class CUISleepStatic : public CUIStatic +{ +private: + typedef CUIStatic inherited; + + int m_cur_time; + CUIStaticItem m_UIStaticItem2; + +public: + CUISleepStatic(); + virtual void Draw(); + virtual void Update(); + virtual void InitTextureEx(LPCSTR tex_name, LPCSTR sh_name = "hud\\default"); +}; diff --git a/src/xrGame/ui/UISpawnWnd.cpp b/src/xrGame/ui/UISpawnWnd.cpp index e8c7ddf91e3..5645a3fb1a8 100644 --- a/src/xrGame/ui/UISpawnWnd.cpp +++ b/src/xrGame/ui/UISpawnWnd.cpp @@ -4,10 +4,10 @@ #include "Level.h" #include "game_cl_teamdeathmatch.h" #include "UIStatix.h" -#include "UIScrollView.h" -#include "UI3tButton.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "xr_level_controller.h" -#include "uicursor.h" +#include "xrUICore/Cursor/UICursor.h" #include "uigamecustom.h" CUISpawnWnd::CUISpawnWnd() : m_iCurTeam(0) diff --git a/src/xrGame/ui/UISpeechMenu.cpp b/src/xrGame/ui/UISpeechMenu.cpp index d8e8c168341..6bfb98feb1f 100644 --- a/src/xrGame/ui/UISpeechMenu.cpp +++ b/src/xrGame/ui/UISpeechMenu.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "UISpeechMenu.h" -#include "UIScrollView.h" -#include "UIStatic.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Static/UIStatic.h" #include "UIGameCustom.h" #include "UIXmlInit.h" #include "game_cl_mp.h" @@ -43,7 +43,7 @@ void CUISpeechMenu::InitList(LPCSTR section_name) { LPCSTR s = pSettings->r_string(section_name, phrase); _GetItem(s, 0, phrase); - xr_sprintf(str, "%d. %s", i + 1, CStringTable().translate(phrase).c_str()); + xr_sprintf(str, "%d. %s", i + 1, StringTable().translate(phrase).c_str()); ADD_TEXT_TO_VIEW3(str, pItem, m_pList); pItem->SetFont(m_pFont); diff --git a/src/xrGame/ui/UIStatix.h b/src/xrGame/ui/UIStatix.h index 0093669c332..1c4bede8c3e 100644 --- a/src/xrGame/ui/UIStatix.h +++ b/src/xrGame/ui/UIStatix.h @@ -1,6 +1,6 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUIStatix : public CUIStatic { diff --git a/src/xrGame/ui/UIStats.cpp b/src/xrGame/ui/UIStats.cpp index 6dcf45983ed..7542d781eba 100644 --- a/src/xrGame/ui/UIStats.cpp +++ b/src/xrGame/ui/UIStats.cpp @@ -3,8 +3,8 @@ #include "UIStats.h" #include "UIXmlInit.h" #include "UIStatsPlayerList.h" -#include "UIStatic.h" -#include "UIFrameWindow.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "Level.h" #include "game_base_space.h" diff --git a/src/xrGame/ui/UIStats.h b/src/xrGame/ui/UIStats.h index 6c2a36b0ac2..6d1848cf65c 100644 --- a/src/xrGame/ui/UIStats.h +++ b/src/xrGame/ui/UIStats.h @@ -1,6 +1,6 @@ #pragma once -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIStatsPlayerList.h" class CUIXml; diff --git a/src/xrGame/ui/UIStatsIcon.cpp b/src/xrGame/ui/UIStatsIcon.cpp index 0d70e08486e..71fce1ed4ed 100644 --- a/src/xrGame/ui/UIStatsIcon.cpp +++ b/src/xrGame/ui/UIStatsIcon.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" #include "UIStatsIcon.h" -#include "UITextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" #include "UIInventoryUtilities.h" #include "Include/xrRender/UIShader.h" diff --git a/src/xrGame/ui/UIStatsIcon.h b/src/xrGame/ui/UIStatsIcon.h index 9120a428e53..0d247450e92 100644 --- a/src/xrGame/ui/UIStatsIcon.h +++ b/src/xrGame/ui/UIStatsIcon.h @@ -1,6 +1,6 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUIStatsIcon : public CUIStatic { diff --git a/src/xrGame/ui/UIStatsPlayerInfo.cpp b/src/xrGame/ui/UIStatsPlayerInfo.cpp index 87839f48bbf..fc792a28780 100644 --- a/src/xrGame/ui/UIStatsPlayerInfo.cpp +++ b/src/xrGame/ui/UIStatsPlayerInfo.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" #include "UIStatsPlayerInfo.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "game_cl_base.h" #include "UIStatsIcon.h" #include "game_cl_artefacthunt.h" @@ -104,7 +104,6 @@ void CUIStatsPlayerInfo::AddField(float len, CGameFont* pF, u32 text_col, bool i const char* CUIStatsPlayerInfo::GetInfoByID(const char* id) { static string64 ans; - CStringTable st; if (0 == xr_strcmp(id, "name")) xr_strcpy(ans, m_pPlayerInfo->getName()); @@ -146,7 +145,7 @@ const char* CUIStatsPlayerInfo::GetInfoByID(const char* id) else if (0 == xr_strcmp(id, "status")) { if (m_pPlayerInfo->testFlag(GAME_PLAYER_FLAG_READY)) - xr_strcpy(ans, *st.translate("st_mp_ready")); + xr_strcpy(ans, *StringTable().translate("st_mp_ready")); else xr_strcpy(ans, ""); } diff --git a/src/xrGame/ui/UIStatsPlayerInfo.h b/src/xrGame/ui/UIStatsPlayerInfo.h index 9e00e563818..da5b367d5ce 100644 --- a/src/xrGame/ui/UIStatsPlayerInfo.h +++ b/src/xrGame/ui/UIStatsPlayerInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" struct game_PlayerState; class CUIStatic; diff --git a/src/xrGame/ui/UIStatsPlayerList.cpp b/src/xrGame/ui/UIStatsPlayerList.cpp index 34e73bd7443..f4d575d8abf 100644 --- a/src/xrGame/ui/UIStatsPlayerList.cpp +++ b/src/xrGame/ui/UIStatsPlayerList.cpp @@ -6,7 +6,7 @@ #include "UIStatsIcon.h" #include "string_table.h" #include "Level.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" IC bool DM_Compare_Players(game_PlayerState* p1, game_PlayerState* p2); @@ -231,21 +231,20 @@ void CUIStatsPlayerList::Update() }; pl_count = items.size(); - CStringTable st; if (GameID() == eGameIDArtefactHunt && !m_bSpectator) { game_cl_ArtefactHunt* game = static_cast(&Game()); pl_artefacts = game->teams[m_CurTeam - 1].score; - xr_sprintf(teaminfo, "%s: %u, %s: %u, %s: %d", *st.translate("mp_artefacts_upcase"), pl_artefacts, - *st.translate("mp_players"), pl_count, *st.translate("mp_frags_upcase"), pl_frags); + xr_sprintf(teaminfo, "%s: %u, %s: %u, %s: %d", *StringTable().translate("mp_artefacts_upcase"), pl_artefacts, + *StringTable().translate("mp_players"), pl_count, *StringTable().translate("mp_frags_upcase"), pl_frags); m_header_text->SetText(teaminfo); } else if (GameID() == eGameIDTeamDeathmatch && !m_bSpectator) { game_cl_TeamDeathmatch* game = static_cast(&Game()); pl_frags = game->teams[m_CurTeam - 1].score; - xr_sprintf(teaminfo, "%s: %d, %s: %u", *st.translate("mp_frags_upcase"), pl_frags, *st.translate("mp_players"), - pl_count); + xr_sprintf(teaminfo, "%s: %d, %s: %u", *StringTable().translate("mp_frags_upcase"), pl_frags, + *StringTable().translate("mp_players"), pl_count); m_header_text->SetText(teaminfo); } diff --git a/src/xrGame/ui/UIStatsPlayerList.h b/src/xrGame/ui/UIStatsPlayerList.h index 4f4a17e0fee..a828f55a8c5 100644 --- a/src/xrGame/ui/UIStatsPlayerList.h +++ b/src/xrGame/ui/UIStatsPlayerList.h @@ -1,6 +1,6 @@ #pragma once -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" #include "UIStatsPlayerInfo.h" class CUIXml; diff --git a/src/xrGame/ui/UITabButtonMP.h b/src/xrGame/ui/UITabButtonMP.h index 7db6b42ddb4..3a9489c09f1 100644 --- a/src/xrGame/ui/UITabButtonMP.h +++ b/src/xrGame/ui/UITabButtonMP.h @@ -1,5 +1,5 @@ #pragma once -#include "UITabButton.h" +#include "xrUICore/TabControl/UITabButton.h" class CUITabButtonMP : public CUITabButton { diff --git a/src/xrGame/ui/UITalkDialogWnd.cpp b/src/xrGame/ui/UITalkDialogWnd.cpp index 8f0936f707e..85fdf7ffbb2 100644 --- a/src/xrGame/ui/UITalkDialogWnd.cpp +++ b/src/xrGame/ui/UITalkDialogWnd.cpp @@ -1,13 +1,13 @@ #include "stdafx.h" #include "UITalkDialogWnd.h" -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "UIXmlInit.h" -#include "UIScrollView.h" -#include "UI3tButton.h" +#include "xrUICore/ScrollView/UIScrollView.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UITalkWnd.h" #include "UIInventoryUtilities.h" -#include "UIBtnHint.h" +#include "xrUICore/Buttons/UIBtnHint.h" #include "game_news.h" #include "Level.h" diff --git a/src/xrGame/ui/UITalkDialogWnd.h b/src/xrGame/ui/UITalkDialogWnd.h index bac0a637b90..6d428b77ccb 100644 --- a/src/xrGame/ui/UITalkDialogWnd.h +++ b/src/xrGame/ui/UITalkDialogWnd.h @@ -1,11 +1,11 @@ #pragma once -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "InfoPortion.h" #include "UICharacterInfo.h" #include "UIItemInfo.h" -#include "UIWndCallback.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIScrollView; class CUIXml; diff --git a/src/xrGame/ui/UITalkWnd.cpp b/src/xrGame/ui/UITalkWnd.cpp index dd889a17b7a..94853eccee6 100644 --- a/src/xrGame/ui/UITalkWnd.cpp +++ b/src/xrGame/ui/UITalkWnd.cpp @@ -14,7 +14,7 @@ #include "xr_level_controller.h" #include "xrEngine/cameraBase.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" CUITalkWnd::CUITalkWnd() { @@ -86,7 +86,6 @@ void CUITalkWnd::InitOthersStartDialog() m_pOthersDialogManager->InitDialog(m_pOurDialogManager, m_pCurrentDialog); //сказать фразу - CStringTable stbl; AddAnswer(m_pCurrentDialog->GetPhraseText("0"), m_pOthersInvOwner->Name()); m_pOthersDialogManager->SayPhrase(m_pCurrentDialog, "0"); @@ -293,7 +292,7 @@ void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value, in if (text.size() == 0) return; - UITalkDialogWnd->AddQuestion(CStringTable().translate(text).c_str(), value.c_str(), number, b_finalizer); + UITalkDialogWnd->AddQuestion(StringTable().translate(text).c_str(), value.c_str(), number, b_finalizer); } void CUITalkWnd::AddAnswer(const shared_str& text, LPCSTR SpeakerName) @@ -306,7 +305,7 @@ void CUITalkWnd::AddAnswer(const shared_str& text, LPCSTR SpeakerName) PlaySnd(text.c_str()); bool i_am = (0 == xr_strcmp(SpeakerName, m_pOurInvOwner->Name())); - UITalkDialogWnd->AddAnswer(SpeakerName, *CStringTable().translate(text), i_am); + UITalkDialogWnd->AddAnswer(SpeakerName, *StringTable().translate(text), i_am); } void CUITalkWnd::SwitchToTrade() diff --git a/src/xrGame/ui/UITalkWnd.h b/src/xrGame/ui/UITalkWnd.h index 110b0227562..e461b747908 100644 --- a/src/xrGame/ui/UITalkWnd.h +++ b/src/xrGame/ui/UITalkWnd.h @@ -1,9 +1,9 @@ #pragma once #include "UIDialogWnd.h" -#include "UIStatic.h" -#include "UIButton.h" -#include "UIEditBox.h" -#include "UIFrameWindow.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UIButton.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "PhraseDialogDefs.h" class CActor; diff --git a/src/xrGame/ui/UITaskWnd.cpp b/src/xrGame/ui/UITaskWnd.cpp index 43be2bed286..da542c051dc 100644 --- a/src/xrGame/ui/UITaskWnd.cpp +++ b/src/xrGame/ui/UITaskWnd.cpp @@ -3,13 +3,13 @@ #include "UIMapWnd.h" #include "Common/object_broker.h" #include "UIXmlInit.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" #include "UISecondTaskWnd.h" #include "UIMapLegend.h" #include "UIHelper.h" -#include "UIHint.h" +#include "xrUICore/Hint/UIHint.h" #include "GameTask.h" #include "map_location.h" #include "map_location_defs.h" @@ -19,7 +19,7 @@ #include "Level.h" #include "GametaskManager.h" #include "Actor.h" -#include "UICheckButton.h" +#include "xrUICore/Buttons/UICheckButton.h" CUITaskWnd::CUITaskWnd() { hint_wnd = NULL; } CUITaskWnd::~CUITaskWnd() { delete_data(m_pMapWnd); } diff --git a/src/xrGame/ui/UITaskWnd.h b/src/xrGame/ui/UITaskWnd.h index 6f9a25ffd5a..7195f77ac08 100644 --- a/src/xrGame/ui/UITaskWnd.h +++ b/src/xrGame/ui/UITaskWnd.h @@ -1,9 +1,9 @@ #pragma once -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" #include "xrCore/Containers/AssociativeVector.hpp" #include "GameTaskDefs.h" -#include "UICheckButton.h" +#include "xrUICore/Buttons/UICheckButton.h" class CUIMapWnd; class CUIStatic; diff --git a/src/xrGame/ui/UITextVote.cpp b/src/xrGame/ui/UITextVote.cpp index 8368b78a2c7..49952056fd3 100644 --- a/src/xrGame/ui/UITextVote.cpp +++ b/src/xrGame/ui/UITextVote.cpp @@ -3,7 +3,7 @@ #include "UITextVote.h" #include "UIVotingCategory.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIEditboxEx.h" #include "Level.h" #include "game_cl_teamdeathmatch.h" diff --git a/src/xrGame/ui/UIVote.cpp b/src/xrGame/ui/UIVote.cpp index cad0d7c90a2..fece9c9c2b6 100644 --- a/src/xrGame/ui/UIVote.cpp +++ b/src/xrGame/ui/UIVote.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" #include "UIVote.h" -#include "UIStatic.h" -#include "UI3tButton.h" -#include "UIListBox.h" -#include "UIFrameWindow.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "UIXmlInit.h" #include "Level.h" #include "game_cl_base.h" diff --git a/src/xrGame/ui/UIVoteStatusWnd.cpp b/src/xrGame/ui/UIVoteStatusWnd.cpp index a804814b781..8e750b4d489 100644 --- a/src/xrGame/ui/UIVoteStatusWnd.cpp +++ b/src/xrGame/ui/UIVoteStatusWnd.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UIVoteStatusWnd.h" #include "UIXmlInit.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" void UIVoteStatusWnd::InitFromXML(CUIXml& xml_doc) { diff --git a/src/xrGame/ui/UIVoteStatusWnd.h b/src/xrGame/ui/UIVoteStatusWnd.h index 9358ae06f7b..3e10c980534 100644 --- a/src/xrGame/ui/UIVoteStatusWnd.h +++ b/src/xrGame/ui/UIVoteStatusWnd.h @@ -1,5 +1,5 @@ #pragma once -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" class CUIXml; class CUITextWnd; diff --git a/src/xrGame/ui/UIVotingCategory.cpp b/src/xrGame/ui/UIVotingCategory.cpp index bade4638313..cc0e2c72d03 100644 --- a/src/xrGame/ui/UIVotingCategory.cpp +++ b/src/xrGame/ui/UIVotingCategory.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UIVotingCategory.h" #include "UIXmlInit.h" -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" #include "UIKickPlayer.h" #include "UIChangeMap.h" #include "ChangeWeatherDialog.hpp" diff --git a/src/xrGame/ui/UIWarState.cpp b/src/xrGame/ui/UIWarState.cpp index 19ef18cb6ea..1e6c73d970c 100644 --- a/src/xrGame/ui/UIWarState.cpp +++ b/src/xrGame/ui/UIWarState.cpp @@ -7,7 +7,7 @@ #include "stdafx.h" #include "UIWarState.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" #include "UIHelper.h" diff --git a/src/xrGame/ui/UIWarState.h b/src/xrGame/ui/UIWarState.h index 0107dfe67be..a8f4a83abcf 100644 --- a/src/xrGame/ui/UIWarState.h +++ b/src/xrGame/ui/UIWarState.h @@ -6,7 +6,7 @@ //////////////////////////////////////////////////////////////////////////// #pragma once -#include "UIHint.h" +#include "xrUICore/Hint/UIHint.h" class CUIXml; class CUIStatic; diff --git a/src/xrGame/ui/UIWindow_script.cpp b/src/xrGame/ui/UIWindow_script.cpp index 17dc33f9551..7c3d331fef3 100644 --- a/src/xrGame/ui/UIWindow_script.cpp +++ b/src/xrGame/ui/UIWindow_script.cpp @@ -1,68 +1,18 @@ #include "pch_script.h" -#include "UIWindow.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" #include "UIDialogWnd.h" #include "UIDialogHolder.h" #include "GamePersistent.h" +#include "UIMessageBoxEx.h" #include "UILabel.h" #include "UIMMShniaga.h" -#include "UITextureMaster.h" -#include "UIScrollView.h" +#include "UISleepStatic.h" +#include "ScriptXMLInit.h" #include "xrScriptEngine/ScriptExporter.hpp" -CFontManager& mngr() { return UI().Font(); } -// hud font -CGameFont* GetFontSmall() { return mngr().pFontStat; } -CGameFont* GetFontMedium() { return mngr().pFontMedium; } -CGameFont* GetFontDI() { return mngr().pFontDI; } -//шрифты для интерфейса -CGameFont* GetFontGraffiti19Russian() { return mngr().pFontGraffiti19Russian; } -CGameFont* GetFontGraffiti22Russian() { return mngr().pFontGraffiti22Russian; } -CGameFont* GetFontLetterica16Russian() { return mngr().pFontLetterica16Russian; } -CGameFont* GetFontLetterica18Russian() { return mngr().pFontLetterica18Russian; } -CGameFont* GetFontGraffiti32Russian() { return mngr().pFontGraffiti32Russian; } -CGameFont* GetFontGraffiti50Russian() { return mngr().pFontGraffiti50Russian; } -CGameFont* GetFontLetterica25() { return mngr().pFontLetterica25; } -int GetARGB(u16 a, u16 r, u16 g, u16 b) { return color_argb(a, r, g, b); } -const Fvector2 get_wnd_pos(CUIWindow* w) { return w->GetWndPos(); } using namespace luabind; using namespace luabind::policy; -SCRIPT_EXPORT(CUIWindow, (), { - module(luaState)[def("GetARGB", &GetARGB), def("GetFontSmall", &GetFontSmall), def("GetFontMedium", &GetFontMedium), - def("GetFontDI", &GetFontDI), def("GetFontGraffiti19Russian", &GetFontGraffiti19Russian), - def("GetFontGraffiti22Russian", &GetFontGraffiti22Russian), - def("GetFontLetterica16Russian", &GetFontLetterica16Russian), - def("GetFontLetterica18Russian", &GetFontLetterica18Russian), - def("GetFontGraffiti32Russian", &GetFontGraffiti32Russian), - def("GetFontGraffiti50Russian", &GetFontGraffiti50Russian), def("GetFontLetterica25", &GetFontLetterica25), - - class_("CUIWindow") - .def(constructor<>()) - .def("AttachChild", &CUIWindow::AttachChild, adopt<2>()) - .def("DetachChild", &CUIWindow::DetachChild) - .def("SetAutoDelete", &CUIWindow::SetAutoDelete) - .def("IsAutoDelete", &CUIWindow::IsAutoDelete) - - .def("SetWndRect", (void (CUIWindow::*)(Frect)) & CUIWindow::SetWndRect_script) - .def("SetWndPos", (void (CUIWindow::*)(Fvector2)) & CUIWindow::SetWndPos_script) - .def("SetWndSize", (void (CUIWindow::*)(Fvector2)) & CUIWindow::SetWndSize_script) - .def("GetWndPos", &get_wnd_pos) - .def("GetWidth", &CUIWindow::GetWidth) - .def("GetHeight", &CUIWindow::GetHeight) - - .def("Enable", &CUIWindow::Enable) - .def("IsEnabled", &CUIWindow::IsEnabled) - .def("Show", &CUIWindow::Show) - .def("IsShown", &CUIWindow::IsShown) - - .def("WindowName", &CUIWindow::WindowName_script) - .def("SetWindowName", &CUIWindow::SetWindowName) - .def("SetPPMode", &CUIWindow::SetPPMode) - .def("ResetPPMode", &CUIWindow::ResetPPMode)]; -}); - +// clang-format off SCRIPT_EXPORT(CDialogHolder, (), { module(luaState)[class_("CDialogHolder") .def("AddDialogToRender", &CDialogHolder::AddDialogToRender) @@ -70,106 +20,43 @@ SCRIPT_EXPORT(CDialogHolder, (), { }); SCRIPT_EXPORT(CUIDialogWnd, (CUIWindow), { - module(luaState)[class_("CUIDialogWnd") - .def("ShowDialog", &CUIDialogWnd::ShowDialog) - .def("HideDialog", &CUIDialogWnd::HideDialog) - .def("GetHolder", &CUIDialogWnd::GetHolder)]; -}); - -SCRIPT_EXPORT(CUIFrameWindow, (CUIWindow), { - module(luaState)[class_("CUIFrameWindow") - .def(constructor<>()) - .def("SetWidth", &CUIFrameWindow::SetWidth) - .def("SetHeight", &CUIFrameWindow::SetHeight) - .def("SetColor", &CUIFrameWindow::SetTextureColor)]; -}); - -SCRIPT_EXPORT(CUIFrameLineWnd, (CUIWindow), { - module(luaState)[class_("CUIFrameLineWnd") - .def(constructor<>()) - .def("SetWidth", &CUIFrameLineWnd::SetWidth) - .def("SetHeight", &CUIFrameLineWnd::SetHeight) - .def("SetColor", &CUIFrameLineWnd::SetTextureColor)]; + module(luaState) + [ + class_("CUIDialogWnd") + .def("ShowDialog", &CUIDialogWnd::ShowDialog) + .def("HideDialog", &CUIDialogWnd::HideDialog) + .def("GetHolder", &CUIDialogWnd::GetHolder) + ]; +}); + +SCRIPT_EXPORT(CUIMessageBoxEx, (CUIDialogWnd), { + module(luaState) + [ + class_("CUIMessageBoxEx") + .def(constructor<>()) + .def("InitMessageBox", &CUIMessageBoxEx::InitMessageBox) + .def("SetText", &CUIMessageBoxEx::SetText) + .def("GetHost", &CUIMessageBoxEx::GetHost) + .def("GetPassword", &CUIMessageBoxEx::GetPassword) + ]; }); SCRIPT_EXPORT(CUIMMShniaga, (CUIWindow), { - module(luaState)[class_("CUIMMShniaga") - .enum_("enum_page_id")[value("epi_main", CUIMMShniaga::epi_main), - value("epi_new_game", CUIMMShniaga::epi_new_game), - value("epi_new_network_game", CUIMMShniaga::epi_new_network_game)] - .def("SetVisibleMagnifier", &CUIMMShniaga::SetVisibleMagnifier) - .def("SetPage", &CUIMMShniaga::SetPage) - .def("ShowPage", &CUIMMShniaga::ShowPage)]; -}); - -SCRIPT_EXPORT(CUIScrollView, (CUIWindow), { - module(luaState)[class_("CUIScrollView") - .def(constructor<>()) - .def("AddWindow", &CUIScrollView::AddWindow) - .def("RemoveWindow", &CUIScrollView::RemoveWindow) - .def("Clear", &CUIScrollView::Clear) - .def("ScrollToBegin", &CUIScrollView::ScrollToBegin) - .def("ScrollToEnd", &CUIScrollView::ScrollToEnd) - .def("GetMinScrollPos", &CUIScrollView::GetMinScrollPos) - .def("GetMaxScrollPos", &CUIScrollView::GetMaxScrollPos) - .def("GetCurrentScrollPos", &CUIScrollView::GetCurrentScrollPos) - .def("SetScrollPos", &CUIScrollView::SetScrollPos)]; -}); - -SCRIPT_EXPORT(EnumUIMessages, (), { - class EnumUIMessages - { - }; - module(luaState)[class_("ui_events") - .enum_("events")[ - // CUIWindow - value("WINDOW_LBUTTON_DOWN", int(WINDOW_LBUTTON_DOWN)), - value("WINDOW_RBUTTON_DOWN", int(WINDOW_RBUTTON_DOWN)), - value("WINDOW_LBUTTON_UP", int(WINDOW_LBUTTON_UP)), - value("WINDOW_RBUTTON_UP", int(WINDOW_RBUTTON_UP)), - value("WINDOW_MOUSE_MOVE", int(WINDOW_MOUSE_MOVE)), - value("WINDOW_LBUTTON_DB_CLICK", int(WINDOW_LBUTTON_DB_CLICK)), - value("WINDOW_KEY_PRESSED", int(WINDOW_KEY_PRESSED)), - value("WINDOW_KEY_RELEASED", int(WINDOW_KEY_RELEASED)), - value("WINDOW_KEYBOARD_CAPTURE_LOST", int(WINDOW_KEYBOARD_CAPTURE_LOST)), - - // CUIButton - value("BUTTON_CLICKED", int(BUTTON_CLICKED)), value("BUTTON_DOWN", int(BUTTON_DOWN)), - - // CUITabControl - value("TAB_CHANGED", int(TAB_CHANGED)), - - // CUICheckButton - value("CHECK_BUTTON_SET", int(CHECK_BUTTON_SET)), - value("CHECK_BUTTON_RESET", int(CHECK_BUTTON_RESET)), - - // CUIRadioButton - value("RADIOBUTTON_SET", int(RADIOBUTTON_SET)), - - // CUIScrollBox - value("SCROLLBOX_MOVE", int(SCROLLBOX_MOVE)), - - // CUIScrollBar - value("SCROLLBAR_VSCROLL", int(SCROLLBAR_VSCROLL)), - value("SCROLLBAR_HSCROLL", int(SCROLLBAR_HSCROLL)), - - // CUIListWnd - value("LIST_ITEM_CLICKED", int(LIST_ITEM_CLICKED)), - value("LIST_ITEM_SELECT", int(LIST_ITEM_SELECT)), - - // UIPropertiesBox - value("PROPERTY_CLICKED", int(PROPERTY_CLICKED)), - - // CUIMessageBox - value("MESSAGE_BOX_OK_CLICKED", int(MESSAGE_BOX_OK_CLICKED)), - value("MESSAGE_BOX_YES_CLICKED", int(MESSAGE_BOX_YES_CLICKED)), - value("MESSAGE_BOX_NO_CLICKED", int(MESSAGE_BOX_NO_CLICKED)), - value("MESSAGE_BOX_CANCEL_CLICKED", int(MESSAGE_BOX_CANCEL_CLICKED)), - value("MESSAGE_BOX_COPY_CLICKED", int(MESSAGE_BOX_COPY_CLICKED)), - value("MESSAGE_BOX_QUIT_GAME_CLICKED", int(MESSAGE_BOX_QUIT_GAME_CLICKED)), - value("MESSAGE_BOX_QUIT_WIN_CLICKED", int(MESSAGE_BOX_QUIT_WIN_CLICKED)), - - value("EDIT_TEXT_COMMIT", int(EDIT_TEXT_COMMIT)), - // CMainMenu - value("MAIN_MENU_RELOADED", int(MAIN_MENU_RELOADED))]]; -}); + module(luaState) + [ + class_("CUIMMShniaga") + .enum_("enum_page_id") + [ + value("epi_main", CUIMMShniaga::epi_main), + value("epi_new_game", CUIMMShniaga::epi_new_game), + value("epi_new_network_game", CUIMMShniaga::epi_new_network_game) + ] + .def("SetVisibleMagnifier", &CUIMMShniaga::SetVisibleMagnifier) + .def("SetPage", &CUIMMShniaga::SetPage) + .def("ShowPage", &CUIMMShniaga::ShowPage) + ]; +}); + +SCRIPT_EXPORT(CUISleepStatic, (CUIStatic), + { module(luaState)[class_("CUISleepStatic").def(constructor<>())]; }); +// clang-format on diff --git a/src/xrGame/ui/UIWpnParams.h b/src/xrGame/ui/UIWpnParams.h index b81d924d56c..cd6575be653 100644 --- a/src/xrGame/ui/UIWpnParams.h +++ b/src/xrGame/ui/UIWpnParams.h @@ -1,7 +1,6 @@ #pragma once -#include "UIWindow.h" - -#include "UIDoubleProgressBar.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/ProgressBar/UIDoubleProgressBar.h" class CUIXml; class CInventoryItem; diff --git a/src/xrGame/ui/UIXmlInit.cpp b/src/xrGame/ui/UIXmlInit.cpp index c92051f691e..ae602d6dc22 100644 --- a/src/xrGame/ui/UIXmlInit.cpp +++ b/src/xrGame/ui/UIXmlInit.cpp @@ -2,417 +2,86 @@ #include "UIXmlInit.h" #include "Level.h" #include "string_table.h" -#include "UIFrameWindow.h" -#include "UICheckButton.h" -#include "UICustomSpin.h" -#include "UIRadioButton.h" -#include "UIProgressBar.h" -#include "UIProgressShape.h" -#include "UITabControl.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/SpinBox/UICustomSpin.h" +#include "xrUICore/Buttons/UIRadioButton.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/ProgressBar/UIProgressShape.h" +#include "xrUICore/TabControl/UITabControl.h" #include "UILabel.h" -#include "UIAnimatedStatic.h" +#include "xrUICore/Static/UIAnimatedStatic.h" +#include "UISleepStatic.h" #include "uixmlinit.h" -#include "UIListBox.h" -#include "UIComboBox.h" -#include "UITrackBar.h" -#include "UIHint.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/ComboBox/UIComboBox.h" +#include "xrUICore/TrackBar/UITrackBar.h" #include "game_base_space.h" -#include "UITextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" #include "UIDragDropListEx.h" #include "UIDragDropReferenceList.h" #include "UItabButtonMP.h" -#include "UILines.h" - -extern int keyname_to_dik(LPCSTR); - -#define ARIAL_FONT_NAME "arial" - -#define MEDIUM_FONT_NAME "medium" -#define SMALL_FONT_NAME "small" - -#define GRAFFITI19_FONT_NAME "graffiti19" -#define GRAFFITI22_FONT_NAME "graffiti22" -#define GRAFFITI32_FONT_NAME "graffiti32" -#define GRAFFITI50_FONT_NAME "graffiti50" - -#define LETTERICA16_FONT_NAME "letterica16" -#define LETTERICA18_FONT_NAME "letterica18" -#define LETTERICA25_FONT_NAME "letterica25" - -#define DI_FONT_NAME "di" - -////////////////////////////////////////////////////////////////////////// - -const char* const COLOR_DEFINITIONS = "color_defs.xml"; -CUIXmlInit::ColorDefs* CUIXmlInit::m_pColorDefs = NULL; - -////////////////////////////////////////////////////////////////////////// - -CUIXmlInit::CUIXmlInit() { InitColorDefs(); } -////////////////////////////////////////////////////////////////////////// +#include "xrUICore/Lines/UILines.h" +CUIXmlInit::CUIXmlInit() : baseClass() {} CUIXmlInit::~CUIXmlInit() {} -////////////////////////////////////////////////////////////////////////// Frect CUIXmlInit::GetFRect(CUIXml& xml_doc, LPCSTR path, int index) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - Frect rect; - rect.set(0, 0, 0, 0); - rect.x1 = xml_doc.ReadAttribFlt(path, index, "x"); - rect.y1 = xml_doc.ReadAttribFlt(path, index, "y"); - rect.x2 = rect.x1 + xml_doc.ReadAttribFlt(path, index, "width"); - rect.y2 = rect.y1 + xml_doc.ReadAttribFlt(path, index, "height"); - - return rect; + return baseClass::GetFRect(xml_doc, path, index); } bool CUIXmlInit::InitWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - Fvector2 pos, size; - pos.x = xml_doc.ReadAttribFlt(path, index, "x"); - pos.y = xml_doc.ReadAttribFlt(path, index, "y"); - InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); - size.x = xml_doc.ReadAttribFlt(path, index, "width"); - size.y = xml_doc.ReadAttribFlt(path, index, "height"); - pWnd->SetWndPos(pos); - pWnd->SetWndSize(size); - - string512 buf; - - strconcat(sizeof(buf), buf, path, ":window_name"); - if (xml_doc.NavigateToNode(buf, index)) - pWnd->SetWindowName(xml_doc.Read(buf, index, NULL)); - - InitAutoStaticGroup(xml_doc, path, index, pWnd); - //. InitAutoFrameLineGroup (xml_doc, path, index, pWnd); - - return true; + return baseClass::InitWindow(xml_doc, path, index, pWnd); } ////////////////////////////////////////////////////////////////////////// bool CUIXmlInit::InitFrameWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameWindow* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitTexture(xml_doc, path, index, pWnd); - InitWindow(xml_doc, path, index, pWnd); - return true; + return baseClass::InitFrameWindow(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitOptionsItem(CUIXml& xml_doc, LPCSTR path, int index, CUIOptionsItem* pWnd) { - string256 buf; - strconcat(sizeof(buf), buf, path, ":options_item"); - - if (xml_doc.NavigateToNode(buf, index)) - { - shared_str entry = xml_doc.ReadAttrib(buf, index, "entry"); - shared_str group = xml_doc.ReadAttrib(buf, index, "group"); - pWnd->AssignProps(entry, group); - - LPCSTR depends = xml_doc.ReadAttrib(buf, index, "depend", NULL); - if (depends) - { - CUIOptionsItem::ESystemDepends d = CUIOptionsItem::sdNothing; - - if (0 == xr_stricmp(depends, "vid")) - d = CUIOptionsItem::sdVidRestart; - else if (0 == xr_stricmp(depends, "snd")) - d = CUIOptionsItem::sdSndRestart; - else if (0 == xr_stricmp(depends, "ui")) - d = CUIOptionsItem::sdUIRestart; - else if (0 == xr_stricmp(depends, "restart")) - d = CUIOptionsItem::sdSystemRestart; - else if (0 == xr_stricmp(depends, "runtime")) - d = CUIOptionsItem::sdApplyOnChange; - else - Msg("! unknown param [%s] in optionsItem [%s]", depends, entry.c_str()); - - pWnd->SetSystemDepends(d); - } - return true; - } - else - return false; + return baseClass::InitOptionsItem(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitWindow(xml_doc, path, index, pWnd); - - string256 buf; - InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, pWnd); - InitTexture(xml_doc, path, index, pWnd); - InitTextureOffset(xml_doc, path, index, pWnd); - - int flag = xml_doc.ReadAttribInt(path, index, "heading", 0); - pWnd->EnableHeading((flag) ? true : false); - - float heading_angle = xml_doc.ReadAttribFlt(path, index, "heading_angle", 0.0f); - if (!fis_zero(heading_angle)) - { - pWnd->EnableHeading(true); - pWnd->SetConstHeading(true); - pWnd->SetHeading(deg2rad(heading_angle)); - } - - LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", ""); - int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1); - int flag_text = xml_doc.ReadAttribInt(path, index, "la_text", 1); - int flag_texture = xml_doc.ReadAttribInt(path, index, "la_texture", 1); - int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0); - - u8 flags = 0; - if (flag_cyclic) - flags |= LA_CYCLIC; - if (flag_alpha) - flags |= LA_ONLYALPHA; - if (flag_text) - flags |= LA_TEXTCOLOR; - if (flag_texture) - flags |= LA_TEXTURECOLOR; - - pWnd->SetColorAnimation(str_flag, flags); - - str_flag = xml_doc.ReadAttrib(path, index, "xform_anim", ""); - flag_cyclic = xml_doc.ReadAttribInt(path, index, "xform_anim_cyclic", 1); - - pWnd->SetXformLightAnim(str_flag, (flag_cyclic) ? true : false); - - bool bComplexMode = xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false; - if (bComplexMode) - pWnd->TextItemControl()->SetTextComplexMode(bComplexMode); - - pWnd->m_stat_hint_text = xml_doc.ReadAttrib(path, index, "hint", ""); - - return true; + return baseClass::InitStatic(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitTextWnd(CUIXml& xml_doc, LPCSTR path, int index, CUITextWnd* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitWindow(xml_doc, path, index, pWnd); - - string256 buf; - InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, &pWnd->TextItemControl()); - - LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", ""); - int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1); - int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0); - - u8 flags = LA_TEXTCOLOR; - if (flag_cyclic) - flags |= LA_CYCLIC; - if (flag_alpha) - flags |= LA_ONLYALPHA; - pWnd->SetColorAnimation(str_flag, flags); - - bool bComplexMode = xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false; - if (bComplexMode) - pWnd->SetTextComplexMode(bComplexMode); - - strconcat(sizeof(buf), buf, path, ":texture"); - R_ASSERT3(NULL == xml_doc.NavigateToNode(buf, index), xml_doc.m_xml_file_name, buf); - - R_ASSERT(pWnd->GetChildWndList().size() == 0); - return true; + return baseClass::InitTextWnd(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitCheck(CUIXml& xml_doc, LPCSTR path, int index, CUICheckButton* pWnd) { - InitStatic(xml_doc, path, index, pWnd); - - string256 buf; - strconcat(sizeof(buf), buf, path, ":texture"); - LPCSTR texture = xml_doc.Read(buf, index, "ui_checker"); - - pWnd->InitCheckButton(pWnd->GetWndPos(), pWnd->GetWndSize(), texture); - - u32 color; - strconcat(sizeof(buf), buf, path, ":text_color:e"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Enabled); - } - - strconcat(sizeof(buf), buf, path, ":text_color:d"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Disabled); - } - - strconcat(sizeof(buf), buf, path, ":text_color:t"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Touched); - } - - strconcat(sizeof(buf), buf, path, ":text_color:h"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Highlighted); - } - - InitOptionsItem(xml_doc, path, index, pWnd); - - return true; + return baseClass::InitCheck(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitSpin(CUIXml& xml_doc, LPCSTR path, int index, CUICustomSpin* pWnd) { - InitWindow(xml_doc, path, index, pWnd); - InitOptionsItem(xml_doc, path, index, pWnd); - pWnd->InitSpin(pWnd->GetWndPos(), pWnd->GetWndSize()); - - string256 foo; - u32 color; - strconcat(sizeof(foo), foo, path, ":text_color:e"); - if (xml_doc.NavigateToNode(foo, index)) - { - color = GetColor(xml_doc, foo, index, 0x00); - pWnd->SetTextColor(color); - } - strconcat(sizeof(foo), foo, path, ":text_color:d"); - if (xml_doc.NavigateToNode(foo, index)) - { - color = GetColor(xml_doc, foo, index, 0x00); - pWnd->SetTextColorD(color); - } - - return true; + return baseClass::InitSpin(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitText(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) { - if (!xml_doc.NavigateToNode(path, index)) - return false; - - return InitText(xml_doc, path, index, pWnd->TextItemControl()); + return baseClass::InitText(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitText(CUIXml& xml_doc, LPCSTR path, int index, CUILines* pLines) { - if (!xml_doc.NavigateToNode(path, index)) - return false; - - u32 color; - CGameFont* pTmpFont = NULL; - InitFont(xml_doc, path, index, color, pTmpFont); - pLines->SetTextColor(color); - R_ASSERT(pTmpFont); - pLines->SetFont(pTmpFont); - - // Load font alignment - shared_str al = xml_doc.ReadAttrib(path, index, "align"); - if (0 == xr_strcmp(al, "c")) - pLines->SetTextAlignment(CGameFont::alCenter); - else if (0 == xr_strcmp(al, "r")) - pLines->SetTextAlignment(CGameFont::alRight); - else if (0 == xr_strcmp(al, "l")) - pLines->SetTextAlignment(CGameFont::alLeft); - - al = xml_doc.ReadAttrib(path, index, "vert_align", ""); - - if (0 == xr_strcmp(al, "c")) - pLines->SetVTextAlignment(valCenter); - else if (0 == xr_strcmp(al, "b")) - pLines->SetVTextAlignment(valBotton); - else if (0 == xr_strcmp(al, "t")) - pLines->SetVTextAlignment(valTop); - - pLines->SetTextComplexMode(xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false); - - // Text coordinates - float text_x = xml_doc.ReadAttribFlt(path, index, "x", 0); - float text_y = xml_doc.ReadAttribFlt(path, index, "y", 0); - - pLines->m_TextOffset.set(text_x, text_y); - - shared_str text = xml_doc.Read(path, index, NULL); - if (text.size()) - pLines->SetText(CStringTable().translate(text).c_str()); - - return true; + return baseClass::InitText(xml_doc, path, index, pLines); } -//////////////////////////////////////////////////////////////////////////////////////////// bool CUIXmlInit::Init3tButton(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - pWnd->m_frameline_mode = (xml_doc.ReadAttribInt(path, index, "frame_mode", 0) == 1) ? true : false; - - pWnd->vertical = (xml_doc.ReadAttribInt(path, index, "vertical", 0) == 1) ? true : false; - - InitWindow(xml_doc, path, index, pWnd); - pWnd->InitButton(pWnd->GetWndPos(), pWnd->GetWndSize()); - - string256 buf; - InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, pWnd); - u32 color; - - strconcat(sizeof(buf), buf, path, ":text_color:e"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Enabled); - } - - strconcat(sizeof(buf), buf, path, ":text_color:d"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Disabled); - } - - strconcat(sizeof(buf), buf, path, ":text_color:t"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Touched); - } - - strconcat(sizeof(buf), buf, path, ":text_color:h"); - if (xml_doc.NavigateToNode(buf, index)) - { - color = GetColor(xml_doc, buf, index, 0x00); - pWnd->SetStateTextColor(color, S_Highlighted); - } - - InitMultiTexture(xml_doc, path, index, pWnd); - InitTextureOffset(xml_doc, path, index, pWnd); - InitSound(xml_doc, path, index, pWnd); - - LPCSTR accel = xml_doc.ReadAttrib(path, index, "accel", NULL); - if (accel) - { - int acc = keyname_to_dik(accel); - pWnd->SetAccelerator(acc, 0); - } - accel = xml_doc.ReadAttrib(path, index, "accel_ext", NULL); - if (accel) - { - int acc = keyname_to_dik(accel); - pWnd->SetAccelerator(acc, 1); - } - - LPCSTR text_hint = xml_doc.ReadAttrib(path, index, "hint", NULL); - if (text_hint) - pWnd->m_hint_text = CStringTable().translate(text_hint); - - return true; + return baseClass::Init3tButton(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitTabButtonMP(CUIXml& xml_doc, LPCSTR path, int index, CUITabButtonMP* pWnd) @@ -444,21 +113,7 @@ bool CUIXmlInit::InitTabButtonMP(CUIXml& xml_doc, LPCSTR path, int index, CUITab bool CUIXmlInit::InitSound(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) { - string256 sound_h; - string256 sound_t; - strconcat(sizeof(sound_h), sound_h, path, ":sound_h"); - strconcat(sizeof(sound_t), sound_t, path, ":sound_t"); - - shared_str sound_h_result = xml_doc.Read(sound_h, index, ""); - shared_str sound_t_result = xml_doc.Read(sound_t, index, ""); - - if (xr_strlen(sound_h_result) != 0) - pWnd->InitSoundH(*sound_h_result); - - if (xr_strlen(sound_t_result) != 0) - pWnd->InitSoundT(*sound_t_result); - - return true; + return baseClass::InitSound(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitDragDropListEx(CUIXml& xml_doc, LPCSTR path, int index, CUIDragDropListEx* pWnd) @@ -523,442 +178,59 @@ bool CUIXmlInit::InitDragDropListEx(CUIXml& xml_doc, LPCSTR path, int index, CUI bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressBar* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitAutoStaticGroup(xml_doc, path, index, pWnd); - - string256 buf; - Fvector2 pos, size; - pos.x = xml_doc.ReadAttribFlt(path, index, "x"); - pos.y = xml_doc.ReadAttribFlt(path, index, "y"); - - InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); - - size.x = xml_doc.ReadAttribFlt(path, index, "width"); - size.y = xml_doc.ReadAttribFlt(path, index, "height"); - - CUIProgressBar::EOrientMode mode = CUIProgressBar::om_vert; - int mode_horz = xml_doc.ReadAttribInt(path, index, "horz", 0); - LPCSTR mode_str = xml_doc.ReadAttrib(path, index, "mode"); - if (mode_horz == 1) // om_horz - { - mode = CUIProgressBar::om_horz; - } - else if (xr_stricmp(mode_str, "horz") == 0) - { - mode = CUIProgressBar::om_horz; - } - else if (xr_stricmp(mode_str, "vert") == 0) - { - mode = CUIProgressBar::om_vert; - } - else if (xr_stricmp(mode_str, "back") == 0) - { - mode = CUIProgressBar::om_back; - } - else if (xr_stricmp(mode_str, "down") == 0) - { - mode = CUIProgressBar::om_down; - } - else if (xr_stricmp(mode_str, "from_center") == 0) - { - mode = CUIProgressBar::om_fromcenter; - } - else if (xr_stricmp(mode_str, "vert_from_center") == 0) - { - mode = CUIProgressBar::om_vfromcenter; - } - else if (xr_stricmp(mode_str, "to_center") == 0) - { - mode = CUIProgressBar::om_tocenter; - } - else if (xr_stricmp(mode_str, "vert_to_center") == 0) - { - mode = CUIProgressBar::om_vtocenter; - } - - pWnd->InitProgressBar(pos, size, mode); - - float min = xml_doc.ReadAttribFlt(path, index, "min"); - float max = xml_doc.ReadAttribFlt(path, index, "max"); - float ppos = xml_doc.ReadAttribFlt(path, index, "pos"); - - pWnd->SetRange(min, max); - pWnd->SetProgressPos(ppos); - pWnd->m_inertion = xml_doc.ReadAttribFlt(path, index, "inertion", 0.0f); - pWnd->colorSmoothing = xml_doc.ReadAttribInt(path, index, "color_smoothing"); - - // progress - strconcat(sizeof(buf), buf, path, ":progress"); - - if (!xml_doc.NavigateToNode(buf, index)) - return false; - - InitStatic(xml_doc, buf, index, &pWnd->m_UIProgressItem); - - pWnd->m_UIProgressItem.SetWndSize(pWnd->GetWndSize()); - - // background - strconcat(sizeof(buf), buf, path, ":background"); - - if (xml_doc.NavigateToNode(buf, index)) - { - InitStatic(xml_doc, buf, index, &pWnd->m_UIBackgroundItem); - pWnd->m_bBackgroundPresent = true; - pWnd->m_UIBackgroundItem.SetWndSize(pWnd->GetWndSize()); - } - - strconcat(sizeof(buf), buf, path, ":min_color"); - - if (xml_doc.NavigateToNode(buf, index)) - { - pWnd->m_bUseColor = true; - - u32 color = GetColor(xml_doc, buf, index, 0xff); - pWnd->m_minColor.set(color); - - strconcat(sizeof(buf), buf, path, ":middle_color"); - - color = GetColor(xml_doc, buf, index, 0xff); - pWnd->m_middleColor.set(color); - - strconcat(sizeof(buf), buf, path, ":max_color"); - - color = GetColor(xml_doc, buf, index, 0xff); - pWnd->m_maxColor.set(color); - } - - return true; + return baseClass::InitProgressBar(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitProgressShape(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressShape* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitStatic(xml_doc, path, index, pWnd); - - if (xml_doc.ReadAttribInt(path, index, "text")) - pWnd->SetTextVisible(true); - - string256 _path; - - if (xml_doc.NavigateToNode(strconcat(sizeof(_path), _path, path, ":back"), index)) - { - R_ASSERT2(0, "unused node in progress shape "); - } - - if (xml_doc.NavigateToNode(strconcat(sizeof(_path), _path, path, ":front"), index)) - { - R_ASSERT2(0, "unused node in progress shape "); - } - // InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":front"), index, pWnd->m_pTexture); - - pWnd->m_sectorCount = xml_doc.ReadAttribInt(path, index, "sector_count", 8); - pWnd->m_bClockwise = xml_doc.ReadAttribInt(path, index, "clockwise") ? true : false; - - pWnd->m_blend = (xml_doc.ReadAttribInt(path, index, "blend", 1) == 1) ? true : false; - pWnd->m_angle_begin = xml_doc.ReadAttribFlt(path, index, "begin_angle", 0.0f); - pWnd->m_angle_end = xml_doc.ReadAttribFlt(path, index, "end_angle", PI_MUL_2); - - return true; + return baseClass::InitProgressShape(xml_doc, path, index, pWnd); } void CUIXmlInit::InitAutoStaticGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd) { - XML_NODE _stored_root = xml_doc.GetLocalRoot(); - xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); - - XML_NODE curr_root = xml_doc.GetLocalRoot(); - if (!curr_root) - curr_root = xml_doc.GetRoot(); - - XML_NODE node = curr_root.firstChild(); - int cnt_static = 0; - int cnt_frameline = 0; - int cnt_text = 0; - string512 buff; - - while (node) - { - LPCSTR node_name = node.value(); - if (0 == xr_stricmp(node_name, "auto_static")) - { - CUIStatic* pUIStatic = new CUIStatic(); - InitStatic(xml_doc, "auto_static", cnt_static, pUIStatic); - xr_sprintf(buff, "auto_static_%d", cnt_static); - pUIStatic->SetWindowName(buff); - pUIStatic->SetAutoDelete(true); - pParentWnd->AttachChild(pUIStatic); - - ++cnt_static; - } - else if (0 == xr_stricmp(node_name, "auto_frameline")) - { - CUIFrameLineWnd* pUIFrameline = new CUIFrameLineWnd(); - InitFrameLine(xml_doc, "auto_frameline", cnt_frameline, pUIFrameline); - xr_sprintf(buff, "auto_frameline_%d", cnt_frameline); - pUIFrameline->SetWindowName(buff); - pUIFrameline->SetAutoDelete(true); - pParentWnd->AttachChild(pUIFrameline); - - ++cnt_frameline; - } - else if (0 == xr_stricmp(node_name, "auto_text")) - { - ++cnt_text; - } - node = node.nextSibling(); - } - /* - CUIStatic* pUIStatic = NULL; - string64 sname; - for(int i=0; iSetWindowName (sname); - pUIStatic->SetAutoDelete (true); - pParentWnd->AttachChild (pUIStatic); - pUIStatic = NULL; - } - */ - xml_doc.SetLocalRoot(_stored_root); + baseClass::InitAutoStaticGroup(xml_doc, path, index, pParentWnd); } void CUIXmlInit::InitAutoFrameLineGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd) { - int items_num = xml_doc.GetNodesNum(path, index, "auto_frameline"); - if (items_num == 0) - { - return; - } - XML_NODE _stored_root = xml_doc.GetLocalRoot(); - xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); - - CUIFrameLineWnd* pUIFL = NULL; - string64 sname; - for (int i = 0; i < items_num; ++i) - { - pUIFL = new CUIFrameLineWnd(); - InitFrameLine(xml_doc, "auto_frameline", i, pUIFL); - xr_sprintf(sname, "auto_frameline_%d", i); - pUIFL->SetWindowName(sname); - pUIFL->SetAutoDelete(true); - pParentWnd->AttachChild(pUIFL); - pUIFL = NULL; - } - - xml_doc.SetLocalRoot(_stored_root); + baseClass::InitAutoFrameLineGroup(xml_doc, path, index, pParentWnd); } bool CUIXmlInit::InitFont(CUIXml& xml_doc, LPCSTR path, int index, u32& color, CGameFont*& pFnt) { - color = GetColor(xml_doc, path, index, 0xff); - - LPCSTR font_name = xml_doc.ReadAttrib(path, index, "font", NULL); - if (!font_name) - { - pFnt = NULL; - return false; - } - else - { - if (!xr_strcmp(font_name, GRAFFITI19_FONT_NAME)) - { - pFnt = UI().Font().pFontGraffiti19Russian; - } - else if (!xr_strcmp(font_name, GRAFFITI22_FONT_NAME)) - { - pFnt = UI().Font().pFontGraffiti22Russian; - } - else if (!xr_strcmp(font_name, GRAFFITI32_FONT_NAME)) - { - pFnt = UI().Font().pFontGraffiti32Russian; - } - else if (!xr_strcmp(font_name, GRAFFITI50_FONT_NAME)) - { - pFnt = UI().Font().pFontGraffiti50Russian; - } - else if (!xr_strcmp(font_name, "arial_14")) - { - pFnt = UI().Font().pFontArial14; - } - else if (!xr_strcmp(font_name, MEDIUM_FONT_NAME)) - { - pFnt = UI().Font().pFontMedium; - } - else if (!xr_strcmp(font_name, SMALL_FONT_NAME)) - { - pFnt = UI().Font().pFontStat; - } - else if (!xr_strcmp(font_name, LETTERICA16_FONT_NAME)) - { - pFnt = UI().Font().pFontLetterica16Russian; - } - else if (!xr_strcmp(font_name, LETTERICA18_FONT_NAME)) - { - pFnt = UI().Font().pFontLetterica18Russian; - } - else if (!xr_strcmp(font_name, LETTERICA25_FONT_NAME)) - { - pFnt = UI().Font().pFontLetterica25; - } - else if (!xr_strcmp(font_name, DI_FONT_NAME)) - { - pFnt = UI().Font().pFontDI; - } - else - { - R_ASSERT3(0, "unknown font", font_name); - pFnt = NULL; - } - } - return true; + return baseClass::InitFont(xml_doc, path, index, color, pFnt); } bool CUIXmlInit::InitTabControl(CUIXml& xml_doc, LPCSTR path, int index, CUITabControl* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - bool status = true; - - status &= InitWindow(xml_doc, path, index, pWnd); - InitOptionsItem(xml_doc, path, index, pWnd); - int tabsCount = xml_doc.GetNodesNum(path, index, "button"); - int radio = xml_doc.ReadAttribInt(path, index, "radio"); - - XML_NODE tab_node = xml_doc.NavigateToNode(path, index); - xml_doc.SetLocalRoot(tab_node); - - CUITabButton* newButton; - - for (int i = 0; i < tabsCount; ++i) - { - newButton = radio ? new CUIRadioButton() : new CUITabButton(); - status &= Init3tButton(xml_doc, "button", i, newButton); - newButton->m_btn_id = xml_doc.ReadAttrib("button", i, "id"); - R_ASSERT3(newButton->m_btn_id.size(), xml_doc.m_xml_file_name, path); - pWnd->AddItem(newButton); - } - - xml_doc.SetLocalRoot(xml_doc.GetRoot()); - - return status; + return baseClass::InitTabControl(xml_doc, path, index, pWnd); } ////////////////////////////////////////////////////////////////////////// bool CUIXmlInit::InitFrameLine(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameLineWnd* pWnd) { - R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path); - - string256 buf; - - bool stretch_flag = xml_doc.ReadAttribInt(path, index, "stretch") ? true : false; - R_ASSERT(stretch_flag == false); - //. pWnd->SetStretchTexture( stretch_flag ); - - Fvector2 pos, size; - pos.x = xml_doc.ReadAttribFlt(path, index, "x"); - pos.y = xml_doc.ReadAttribFlt(path, index, "y"); - - InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); - - size.x = xml_doc.ReadAttribFlt(path, index, "width"); - size.y = xml_doc.ReadAttribFlt(path, index, "height"); - bool vertical = !!xml_doc.ReadAttribInt(path, index, "vertical"); - - strconcat(sizeof(buf), buf, path, ":texture"); - shared_str base_name = xml_doc.Read(buf, index, NULL); - - VERIFY(base_name); - - u32 color = GetColor(xml_doc, buf, index, 0xff); - pWnd->SetTextureColor(color); - - InitWindow(xml_doc, path, index, pWnd); - pWnd->InitFrameLineWnd(*base_name, pos, size, !vertical); - return true; + return baseClass::InitFrameLine(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitCustomEdit(CUIXml& xml_doc, LPCSTR path, int index, CUICustomEdit* pWnd) { - InitStatic(xml_doc, path, index, pWnd); - pWnd->InitCustomEdit(pWnd->GetWndPos(), pWnd->GetWndSize()); - - string256 foo; - u32 color; - strconcat(sizeof(foo), foo, path, ":text_color:e"); - if (xml_doc.NavigateToNode(foo, index)) - { - color = GetColor(xml_doc, foo, index, 0x00); - pWnd->TextItemControl()->SetTextColor(color); - } - - int max_count = xml_doc.ReadAttribInt(path, index, "max_symb_count", 0); - bool num_only = (xml_doc.ReadAttribInt(path, index, "num_only", 0) == 1); - bool read_only = (xml_doc.ReadAttribInt(path, index, "read_only", 0) == 1); - bool file_name_mode = (xml_doc.ReadAttribInt(path, index, "file_name_mode", 0) == 1); - - if (file_name_mode || read_only || num_only || 0 < max_count) - { - if (max_count <= 0) - { - max_count = 32; - } - pWnd->Init(max_count, num_only, read_only, file_name_mode); - } - - if (xml_doc.ReadAttribInt(path, index, "password", 0)) - { - pWnd->SetPasswordMode(); - } - return true; + return baseClass::InitCustomEdit(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitEditBox(CUIXml& xml_doc, LPCSTR path, int index, CUIEditBox* pWnd) { - InitCustomEdit(xml_doc, path, index, pWnd); - - InitTexture(xml_doc, path, index, pWnd); - InitOptionsItem(xml_doc, path, index, pWnd); - - return true; + return baseClass::InitEditBox(xml_doc, path, index, pWnd); } ////////////////////////////////////////////////////////////////////////// -bool CUIXmlInit::InitAnimatedStatic(CUIXml& xml_doc, const char* path, int index, CUIAnimatedStatic* pWnd) +bool CUIXmlInit::InitAnimatedStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIAnimatedStatic* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitStatic(xml_doc, path, index, pWnd); - - float x = xml_doc.ReadAttribFlt(path, index, "x_offset", 0); - float y = xml_doc.ReadAttribFlt(path, index, "y_offset", 0); - u32 framesCount = static_cast(xml_doc.ReadAttribInt(path, index, "frames", 0)); - u32 animDuration = static_cast(xml_doc.ReadAttribInt(path, index, "duration", 0)); - u32 animCols = static_cast(xml_doc.ReadAttribInt(path, index, "columns", 0)); - float frameWidth = xml_doc.ReadAttribFlt(path, index, "frame_width", 0); - float frameHeight = xml_doc.ReadAttribFlt(path, index, "frame_height", 0); - bool cyclic = !!xml_doc.ReadAttribInt(path, index, "cyclic", 0); - bool play = !!xml_doc.ReadAttribInt(path, index, "autoplay", 0); - - pWnd->SetFrameDimentions(frameWidth, frameHeight); - pWnd->SetFramesCount(framesCount); - pWnd->m_bCyclic = cyclic; - pWnd->SetAnimCols(animCols); - pWnd->SetAnimationDuration(animDuration); - pWnd->SetOffset(x, y); - pWnd->SetAnimPos(0.0f); - if (play) - pWnd->Play(); - - return true; + return baseClass::InitAnimatedStatic(xml_doc, path, index, pWnd); } -bool CUIXmlInit::InitSleepStatic(CUIXml& xml_doc, const char* path, int index, CUISleepStatic* pWnd) +bool CUIXmlInit::InitSleepStatic(CUIXml& xml_doc, LPCSTR path, int index, CUISleepStatic* pWnd) { R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); @@ -969,355 +241,54 @@ bool CUIXmlInit::InitSleepStatic(CUIXml& xml_doc, const char* path, int index, C bool CUIXmlInit::InitTexture(CUIXml& xml_doc, LPCSTR path, int index, ITextureOwner* pWnd) { - string256 buf; - LPCSTR texture = NULL; - LPCSTR shader = NULL; - strconcat(sizeof(buf), buf, path, ":texture"); - if (xml_doc.NavigateToNode(buf)) - { - texture = xml_doc.Read(buf, index, NULL); - shader = xml_doc.ReadAttrib(buf, index, "shader", NULL); - } - if (texture) - { - if (shader) - pWnd->InitTextureEx(texture, shader); - else - pWnd->InitTexture(texture); - } - //-------------------- - Frect rect; - rect.x1 = xml_doc.ReadAttribFlt(buf, index, "x", 0); - rect.y1 = xml_doc.ReadAttribFlt(buf, index, "y", 0); - rect.x2 = rect.x1 + xml_doc.ReadAttribFlt(buf, index, "width", 0); - rect.y2 = rect.y1 + xml_doc.ReadAttribFlt(buf, index, "height", 0); - - bool stretch_flag = xml_doc.ReadAttribInt(path, index, "stretch") ? true : false; - pWnd->SetStretchTexture(stretch_flag); - - u32 color = GetColor(xml_doc, buf, index, 0xff); - pWnd->SetTextureColor(color); - - if (rect.width() != 0 && rect.height() != 0) - pWnd->SetTextureRect(rect); - - return true; + return baseClass::InitTexture(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitTextureOffset(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) { - string256 textureOffset; - if (0 == xr_strcmp(path, "")) - xr_strcpy(textureOffset, "texture_offset"); - else - strconcat(sizeof(textureOffset), textureOffset, path, ":texture_offset"); - - float x = xml_doc.ReadAttribFlt(textureOffset, index, "x"); - float y = xml_doc.ReadAttribFlt(textureOffset, index, "y"); - - pWnd->SetTextureOffset(x, y); - - return true; + return baseClass::InitTextureOffset(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitMultiTexture(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) { - string256 buff; - bool success = false; - - strconcat(sizeof(buff), buff, path, ":texture"); - shared_str texture = xml_doc.Read(buff, index, NULL); - - if (texture.size() > 0) - { - pWnd->InitTexture(*texture); - return true; - } - - strconcat(sizeof(buff), buff, path, ":texture_e"); - texture = xml_doc.Read(buff, index, NULL); - if (texture.size()) - { - if (pWnd->m_background) - { - pWnd->m_background->InitState(S_Enabled, texture.c_str()); - } - else if (pWnd->m_back_frameline) - { - pWnd->m_back_frameline->InitState(S_Enabled, texture.c_str()); - pWnd->m_back_frameline->Get(S_Enabled)->SetHorizontal(!(pWnd->vertical)); - } - success = true; - } - - strconcat(sizeof(buff), buff, path, ":texture_t"); - texture = xml_doc.Read(buff, index, NULL); - if (texture.size()) - { - if (pWnd->m_background) - { - pWnd->m_background->InitState(S_Touched, texture.c_str()); - } - else if (pWnd->m_back_frameline) - { - pWnd->m_back_frameline->InitState(S_Touched, texture.c_str()); - pWnd->m_back_frameline->Get(S_Touched)->SetHorizontal(!(pWnd->vertical)); - } - success = true; - } - - strconcat(sizeof(buff), buff, path, ":texture_d"); - texture = xml_doc.Read(buff, index, NULL); - if (texture.size()) - { - if (pWnd->m_background) - { - pWnd->m_background->InitState(S_Disabled, texture.c_str()); - } - else if (pWnd->m_back_frameline) - { - pWnd->m_back_frameline->InitState(S_Disabled, texture.c_str()); - pWnd->m_back_frameline->Get(S_Disabled)->SetHorizontal(!(pWnd->vertical)); - } - success = true; - } - - strconcat(sizeof(buff), buff, path, ":texture_h"); - texture = xml_doc.Read(buff, index, NULL); - if (texture.size()) - { - if (pWnd->m_background) - { - pWnd->m_background->InitState(S_Highlighted, texture.c_str()); - } - else if (pWnd->m_back_frameline) - { - pWnd->m_back_frameline->InitState(S_Highlighted, texture.c_str()); - pWnd->m_back_frameline->Get(S_Highlighted)->SetHorizontal(!(pWnd->vertical)); - } - success = true; - } - - if (success) - pWnd->TextureOn(); - - return success; -} - -float CUIXmlInit::ApplyAlignX(float coord, u32 align) { return coord; } -////////////////////////////////////////////////////////////////////////// - -float CUIXmlInit::ApplyAlignY(float coord, u32 align) { return coord; } -////////////////////////////////////////////////////////////////////////// - -void CUIXmlInit::ApplyAlign(float& x, float& y, u32 align) -{ - x = ApplyAlignX(x, align); - y = ApplyAlignY(y, align); + return baseClass::InitMultiTexture(xml_doc, path, index, pWnd); } ////////////////////////////////////////////////////////////////////////// bool CUIXmlInit::InitAlignment(CUIXml& xml_doc, const char* path, int index, float& x, float& y, CUIWindow* pWnd) { - xr_string wnd_alignment = xml_doc.ReadAttrib(path, index, "alignment", ""); - - if (strchr(wnd_alignment.c_str(), 'c')) - pWnd->SetAlignment(waCenter); - - // Alignment: right: "r", bottom: "b". Top, left - useless - shared_str alignStr = xml_doc.ReadAttrib(path, index, "align", ""); - - bool result = false; - - if (strchr(*alignStr, 'r')) - { - x = ApplyAlignX(x, alRight); - result = true; - } - if (strchr(*alignStr, 'b')) - { - y = ApplyAlignY(y, alBottom); - result = true; - } - if (strchr(*alignStr, 'c')) - { - ApplyAlign(x, y, alCenter); - result = true; - } - - return result; + return baseClass::InitAlignment(xml_doc, path, index, x, y, pWnd); } ////////////////////////////////////////////////////////////////////////// -void CUIXmlInit::InitColorDefs() -{ - if (NULL != m_pColorDefs) - return; - - m_pColorDefs = new ColorDefs(); - - CUIXml uiXml; - uiXml.Load(CONFIG_PATH, UI_PATH, COLOR_DEFINITIONS); - - int num = uiXml.GetNodesNum("colors", 0, "color"); - - shared_str name; - int r, b, g, a; - - for (int i = 0; i < num; ++i) - { - name = uiXml.ReadAttrib("color", i, "name", ""); - r = uiXml.ReadAttribInt("color", i, "r", 0); - g = uiXml.ReadAttribInt("color", i, "g", 0); - b = uiXml.ReadAttribInt("color", i, "b", 0); - a = uiXml.ReadAttribInt("color", i, "a", 255); - - (*m_pColorDefs)[name] = color_argb(a, r, g, b); - } -} +void CUIXmlInit::InitColorDefs() { baseClass::InitColorDefs(); } bool CUIXmlInit::InitScrollView(CUIXml& xml_doc, LPCSTR path, int index, CUIScrollView* pWnd) { - R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); - - InitWindow(xml_doc, path, index, pWnd); - pWnd->SetRightIndention(xml_doc.ReadAttribFlt(path, index, "right_ident", 0.0f)); - pWnd->SetLeftIndention(xml_doc.ReadAttribFlt(path, index, "left_ident", 0.0f)); - pWnd->SetUpIndention(xml_doc.ReadAttribFlt(path, index, "top_indent", 0.0f)); - pWnd->SetDownIndention(xml_doc.ReadAttribFlt(path, index, "bottom_indent", 0.0f)); - - float vi = xml_doc.ReadAttribFlt(path, index, "vert_interval", 0.0f); - pWnd->m_vertInterval = (vi); - - bool bInverseDir = (1 == xml_doc.ReadAttribInt(path, index, "inverse_dir", 0)); - pWnd->m_flags.set(CUIScrollView::eInverseDir, bInverseDir); - - pWnd->SetScrollBarProfile(xml_doc.ReadAttrib(path, index, "scroll_profile", "default")); - - pWnd->InitScrollView(); - - bool bVertFlip = (1 == xml_doc.ReadAttribInt(path, index, "flip_vert", 0)); - pWnd->SetVertFlip(bVertFlip); - - bool b = (1 == xml_doc.ReadAttribInt(path, index, "always_show_scroll", 1)); - - pWnd->SetFixedScrollBar(b); - - b = (1 == xml_doc.ReadAttribInt(path, index, "can_select", 0)); - - pWnd->m_flags.set(CUIScrollView::eItemsSelectabe, b); - - ///////////////////////////////////////////////////////////////////// - int tabsCount = xml_doc.GetNodesNum(path, index, "text"); - - XML_NODE _stored_root = xml_doc.GetLocalRoot(); - xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); - - for (int i = 0; i < tabsCount; ++i) - { - CUITextWnd* newText = new CUITextWnd(); - InitText(xml_doc, "text", i, &newText->TextItemControl()); - newText->SetTextComplexMode(true); - newText->SetWidth(pWnd->GetDesiredChildWidth()); - newText->AdjustHeightToText(); - pWnd->AddWindow(newText, true); - } - xml_doc.SetLocalRoot(_stored_root); - return true; + return baseClass::InitScrollView(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitListBox(CUIXml& xml_doc, LPCSTR path, int index, CUIListBox* pWnd) { - InitScrollView(xml_doc, path, index, pWnd); - - string512 _path; - u32 t_color; - CGameFont* pFnt; - strconcat(sizeof(_path), _path, path, ":font"); - InitFont(xml_doc, _path, index, t_color, pFnt); - - pWnd->SetTextColor(t_color); - pWnd->SetFont(pFnt); - - float h = xml_doc.ReadAttribFlt(path, index, "item_height", 20.0f); - pWnd->SetItemHeight(h); - return true; + return baseClass::InitListBox(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitTrackBar(CUIXml& xml_doc, LPCSTR path, int index, CUITrackBar* pWnd) { - InitWindow(xml_doc, path, 0, pWnd); - pWnd->InitTrackBar(pWnd->GetWndPos(), pWnd->GetWndSize()); - int is_integer = xml_doc.ReadAttribInt(path, index, "is_integer", 0); - pWnd->SetType(!is_integer); - InitOptionsItem(xml_doc, path, 0, pWnd); - - int invert = xml_doc.ReadAttribInt(path, index, "invert", 0); - pWnd->SetInvert(!!invert); - float step = xml_doc.ReadAttribFlt(path, index, "step", 0.1f); - pWnd->SetStep(step); - - return true; + return baseClass::InitTrackBar(xml_doc, path, index, pWnd); } bool CUIXmlInit::InitComboBox(CUIXml& xml_doc, LPCSTR path, int index, CUIComboBox* pWnd) { - u32 color; - CGameFont* pFont; - - pWnd->SetListLength(xml_doc.ReadAttribInt(path, index, "list_length", 4)); - - InitWindow(xml_doc, path, index, pWnd); - pWnd->InitComboBox(pWnd->GetWndPos(), pWnd->GetWidth()); - InitOptionsItem(xml_doc, path, index, pWnd); - - bool b = (1 == xml_doc.ReadAttribInt(path, index, "always_show_scroll", 1)); - - pWnd->m_list_box.SetFixedScrollBar(b); - - string512 _path; - strconcat(sizeof(_path), _path, path, ":list_font"); - InitFont(xml_doc, _path, index, color, pFont); - //. pWnd->SetFont (pFont); - pWnd->m_list_box.SetFont(pFont); - pWnd->m_list_box.SetTextColor(color); - - strconcat(sizeof(_path), _path, path, ":text_color:e"); - if (xml_doc.NavigateToNode(_path, index)) - { - color = GetColor(xml_doc, _path, index, 0x00); - pWnd->SetTextColor(color); - } - - strconcat(sizeof(_path), _path, path, ":text_color:d"); - if (xml_doc.NavigateToNode(_path, index)) - { - color = GetColor(xml_doc, _path, index, 0x00); - pWnd->SetTextColorD(color); - } - - return true; + return baseClass::InitComboBox(xml_doc, path, index, pWnd); } -void CUIXmlInit::AssignColor(LPCSTR name, u32 clr) { (*m_pColorDefs)[name] = clr; } +void CUIXmlInit::AssignColor(LPCSTR name, u32 clr) { baseClass::AssignColor(name, clr); } u32 CUIXmlInit::GetColor(CUIXml& xml_doc, LPCSTR path, int index, u32 def_clr) { - LPCSTR clr_def = xml_doc.ReadAttrib(path, index, "color", NULL); - if (clr_def) - { - VERIFY(GetColorDefs()->find(clr_def) != GetColorDefs()->end()); - return (*m_pColorDefs)[clr_def]; - } - else - { - int r = xml_doc.ReadAttribInt(path, index, "r", def_clr); - int g = xml_doc.ReadAttribInt(path, index, "g", def_clr); - int b = xml_doc.ReadAttribInt(path, index, "b", def_clr); - int a = xml_doc.ReadAttribInt(path, index, "a", 0xff); - return color_argb(a, r, g, b); - } + return baseClass::GetColor(xml_doc, path, index, def_clr); } bool CUIXmlInit::InitHintWindow(CUIXml& xml_doc, LPCSTR path, int index, UIHintWindow* pWnd) diff --git a/src/xrGame/ui/UIXmlInit.h b/src/xrGame/ui/UIXmlInit.h index 85994cb7c4f..97179015ebe 100644 --- a/src/xrGame/ui/UIXmlInit.h +++ b/src/xrGame/ui/UIXmlInit.h @@ -1,43 +1,13 @@ #pragma once +#include "xrUICore/XML/UIXmlInitBase.h" -#include "xrUIXmlParser.h" -#include "xrCore/_rect.h" -#include "xrCommon/xr_map.h" - -class ITextureOwner; -class CUIWindow; -class CUIFrameWindow; -class CUIStaticItem; -class CUIStatic; -class CUICheckButton; -class CUICustomSpin; -class CUIButton; -class CUI3tButton; class CUIDragDropList; -class CUIProgressBar; -class CUIProgressShape; -class CUITabControl; -class CUIFrameLineWnd; -class CUIEditBoxEx; -class CUIEditBox; -class CUICustomEdit; -class CUIAnimatedStatic; class CUISleepStatic; -class CUIOptionsItem; -class CUIScrollView; -class CUIListBox; -class CUIStatsPlayerList; -class CUIDragDropListEx; -class CUIComboBox; class CUITabButtonMP; -class CUITrackBar; -class UIHintWindow; -class CUILines; -class CUITextWnd; -class CGameFont; -class CUIXmlInit +class CUIXmlInit : public CUIXmlInitBase { + using baseClass = CUIXmlInitBase; public: CUIXmlInit(); virtual ~CUIXmlInit(); @@ -80,23 +50,15 @@ class CUIXmlInit static void InitAutoStaticGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd); static void InitAutoFrameLineGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd); - static float ApplyAlignX(float coord, u32 align); - static float ApplyAlignY(float coord, u32 align); - static void ApplyAlign(float& x, float& y, u32 align); - // Initialize and store predefined colors - using ColorDefs = xr_map; + using ColorDefs = baseClass::ColorDefs; static const ColorDefs* GetColorDefs() { - R_ASSERT(m_pColorDefs); - return m_pColorDefs; + baseClass::GetColorDefs(); } static void InitColorDefs(); - static void DeleteColorDefs() { xr_delete(m_pColorDefs); } + static void DeleteColorDefs() { baseClass::DeleteColorDefs(); } static void AssignColor(LPCSTR name, u32 clr); - -private: - static ColorDefs* m_pColorDefs; }; diff --git a/src/xrGame/ui/map_hint.cpp b/src/xrGame/ui/map_hint.cpp index 5c45053205f..b4b1a7d65c8 100644 --- a/src/xrGame/ui/map_hint.cpp +++ b/src/xrGame/ui/map_hint.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "map_hint.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "UIXmlInit.h" #include "map_location.h" #include "map_spot.h" @@ -119,7 +119,7 @@ void CUIMapLocationHint::SetInfoTask(CGameTask* task) string512 buff, buff2; InventoryUtilities::GetTimePeriodAsString(buff, sizeof(buff), Level().GetGameTime(), task->m_TimeToComplete); - strconcat(sizeof(buff2), buff2, CStringTable().translate("ui_st_time_remains").c_str(), " ", buff); + strconcat(sizeof(buff2), buff2, StringTable().translate("ui_st_time_remains").c_str(), " ", buff); S->TextItemControl()->SetText(buff2); } pos = S->GetWndPos(); diff --git a/src/xrGame/ui/map_hint.h b/src/xrGame/ui/map_hint.h index 0f7b5323cd6..93b7894a22a 100644 --- a/src/xrGame/ui/map_hint.h +++ b/src/xrGame/ui/map_hint.h @@ -1,5 +1,5 @@ #pragma once -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" #include "xrCore/Containers/AssociativeVector.hpp" class CUIStatic; diff --git a/src/xrGame/ui/ui_af_params.cpp b/src/xrGame/ui/ui_af_params.cpp index 6bcd6f9ae61..418841942ef 100644 --- a/src/xrGame/ui/ui_af_params.cpp +++ b/src/xrGame/ui/ui_af_params.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "ui_af_params.h" -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" #include "Actor.h" #include "ActorCondition.h" #include "Common/object_broker.h" @@ -112,7 +112,7 @@ void CUIArtefactParams::InitFromXml(CUIXml& xml) m_immunity_item[i]->Init(xml, af_immunity_section_names[i]); m_immunity_item[i]->SetAutoDelete(false); - LPCSTR name = CStringTable().translate(af_immunity_caption[i]).c_str(); + LPCSTR name = StringTable().translate(af_immunity_caption[i]).c_str(); m_immunity_item[i]->SetCaption(name); xml.SetLocalRoot(base_node); @@ -124,7 +124,7 @@ void CUIArtefactParams::InitFromXml(CUIXml& xml) m_restore_item[i]->Init(xml, af_restore_section_names[i]); m_restore_item[i]->SetAutoDelete(false); - LPCSTR name = CStringTable().translate(af_restore_caption[i]).c_str(); + LPCSTR name = StringTable().translate(af_restore_caption[i]).c_str(); m_restore_item[i]->SetCaption(name); xml.SetLocalRoot(base_node); @@ -135,7 +135,7 @@ void CUIArtefactParams::InitFromXml(CUIXml& xml) m_additional_weight->Init(xml, "additional_weight"); m_additional_weight->SetAutoDelete(false); - LPCSTR name = CStringTable().translate("ui_inv_weight").c_str(); + LPCSTR name = StringTable().translate("ui_inv_weight").c_str(); m_additional_weight->SetCaption(name); // xml.SetLocalRoot( base_node ); @@ -245,7 +245,7 @@ void UIArtefactParamItem::Init(CUIXml& xml, LPCSTR section) m_sign_inverse = (xml.ReadAttribInt("value", 0, "sign_inverse", 0) == 1); LPCSTR unit_str = xml.ReadAttrib("value", 0, "unit_str", ""); - m_unit_str._set(CStringTable().translate(unit_str)); + m_unit_str._set(StringTable().translate(unit_str)); LPCSTR texture_minus = xml.Read("texture_minus", 0, ""); if (texture_minus && xr_strlen(texture_minus)) diff --git a/src/xrGame/ui/ui_af_params.h b/src/xrGame/ui/ui_af_params.h index 15aa3a6c2d7..a5e7c89e30e 100644 --- a/src/xrGame/ui/ui_af_params.h +++ b/src/xrGame/ui/ui_af_params.h @@ -1,5 +1,5 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "xrServerEntities/alife_space.h" class CUIXml; diff --git a/src/xrGame/ui/uiscriptwnd_script2.cpp b/src/xrGame/ui/uiscriptwnd_script2.cpp index 3b48e805aeb..9a1a528aed8 100644 --- a/src/xrGame/ui/uiscriptwnd_script2.cpp +++ b/src/xrGame/ui/uiscriptwnd_script2.cpp @@ -3,17 +3,17 @@ // UI-controls #include "UIScriptWnd.h" -#include "UIButton.h" -#include "UIMessageBox.h" -#include "UIPropertiesBox.h" -#include "UICheckButton.h" -#include "UIRadioButton.h" -#include "UIStatic.h" -#include "UIEditBox.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UIProgressBar.h" -#include "UITabControl.h" +#include "xrUICore/Buttons/UIButton.h" +#include "xrUICore/MessageBox/UIMessageBox.h" +#include "xrUICore/PropertiesBox/UIPropertiesBox.h" +#include "xrUICore/Buttons/UICheckButton.h" +#include "xrUICore/Buttons/UIRadioButton.h" +#include "xrUICore/Static/UIStatic.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" +#include "xrUICore/TabControl/UITabControl.h" #include "uiscriptwnd_script.h" diff --git a/src/xrGame/ui/xrUIXmlParser.cpp b/src/xrGame/ui/xrUIXmlParser.cpp deleted file mode 100644 index a4e40ec064d..00000000000 --- a/src/xrGame/ui/xrUIXmlParser.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "stdafx.h" -#include "xrUIXmlParser.h" - -#ifdef XRGAME_EXPORTS -#include "ui_base.h" -#endif - -shared_str CUIXml::correct_file_name(pcstr path, pcstr fn) -{ -#ifdef XRGAME_EXPORTS - if (0 == xr_strcmp(path, UI_PATH) || 0 == xr_strcmp(path, "UI")) - { - return UI().get_xml_name(fn); - } - else - return fn; -#else - return fn; -#endif -} - -//#define LOG_ALL_XMLS -#ifdef LOG_ALL_XMLS -int ListXmlCount = 0; -struct DBGList_ -{ - int num; - bool closed; -}; -xr_vector dbg_list_xmls; -void dump_list_xmls() -{ - Msg("------Total xmls %d", dbg_list_xmls.size()); - xr_vector::iterator _it = dbg_list_xmls.begin(); - for (; _it != dbg_list_xmls.end(); ++_it) - if (!(*_it).closed) - Msg("--leak detected ---- xml = %d", (*_it).num); -} -#else -void dump_list_xmls() {} -#endif - -CUIXml::CUIXml() -{ -#ifdef LOG_ALL_XMLS - ListXmlCount++; - m_dbg_id = ListXmlCount; - dbg_list_xmls.push_back(DBGList_()); - dbg_list_xmls.back().num = m_dbg_id; - dbg_list_xmls.back().closed = false; -#endif -} - -CUIXml::~CUIXml() -{ -#ifdef LOG_ALL_XMLS - xr_vector::iterator _it = dbg_list_xmls.begin(); - bool bOK = false; - for (; _it != dbg_list_xmls.end(); ++_it) - { - if ((*_it).num == m_dbg_id && !(*_it).closed) - { - bOK = true; - (*_it).closed = true; - dbg_list_xmls.erase(_it); - break; - } - if ((*_it).num == m_dbg_id && (*_it).closed) - { - Msg("--XML [%d] already deleted", m_dbg_id); - bOK = true; - } - } - if (!bOK) - Msg("CUIXml::~CUIXml.[%d] cannot find xml in list", m_dbg_id); -#endif -} diff --git a/src/xrGame/ui_export_script.cpp b/src/xrGame/ui_export_script.cpp index 88b51e9f467..fddb1e80f48 100644 --- a/src/xrGame/ui_export_script.cpp +++ b/src/xrGame/ui_export_script.cpp @@ -1,16 +1,7 @@ #include "pch_script.h" - #include "MainMenu.h" #include "UIGameCustom.h" #include "UI/UIScriptWnd.h" -#include "UI/UIButton.h" -#include "UI/UIProgressBar.h" -#include "UI/UIEditBox.h" -#include "UI/UIMessageBox.h" -#include "UI/UIPropertiesBox.h" -#include "UI/UITabControl.h" -#include "UI/UIComboBox.h" -#include "ui/UIOptionsManagerScript.h" #include "ui/UIMapInfo.h" #include "ScriptXmlInit.h" #include "login_manager.h" diff --git a/src/xrGame/xrGame.cpp b/src/xrGame/xrGame.cpp index 999ab133cb9..8ace2928146 100644 --- a/src/xrGame/xrGame.cpp +++ b/src/xrGame/xrGame.cpp @@ -8,7 +8,7 @@ #include "stdafx.h" #include "object_factory.h" -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "xr_level_controller.h" #include "xrEngine/profiler.h" @@ -49,12 +49,15 @@ BOOL APIENTRY DllMain(HANDLE hModule, u32 ul_reason_for_call, LPVOID lpReserved) // XXX nitrocaster PROFILER: temporarily disabled due to linkage issues // g_profiler = new CProfiler(); #endif + gStringTable = new CStringTable(); + StringTable().Init(); break; } case DLL_PROCESS_DETACH: { CleanupUIStyleToken(); + xr_delete(gStringTable); break; } } diff --git a/src/xrGame/xrGame.vcxproj b/src/xrGame/xrGame.vcxproj index a94debaea47..c2ce915865d 100644 --- a/src/xrGame/xrGame.vcxproj +++ b/src/xrGame/xrGame.vcxproj @@ -700,7 +700,6 @@ - @@ -1169,7 +1168,6 @@ - @@ -1369,7 +1367,6 @@ - @@ -1392,7 +1389,6 @@ - @@ -1403,7 +1399,6 @@ - @@ -1417,15 +1412,10 @@ - - - - - @@ -1438,29 +1428,17 @@ - - - - - - - - - - - - @@ -1469,13 +1447,6 @@ - - - - - - - @@ -1488,9 +1459,7 @@ - - @@ -1503,61 +1472,37 @@ - - - - - - - - - - + - - - - - - - - - - - - - - - @@ -3334,7 +3279,6 @@ - @@ -3355,7 +3299,6 @@ - @@ -3369,7 +3312,6 @@ - pch_script.h $(IntDir)$(ProjectName)_script.pch @@ -3392,14 +3334,7 @@ $(IntDir)$(ProjectName)_script.pch - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - @@ -3411,34 +3346,16 @@ - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - true true - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - - pch_script.h @@ -3453,7 +3370,6 @@ $(IntDir)$(ProjectName)_script.pch - pch_script.h @@ -3485,16 +3401,6 @@ - - - - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - @@ -3511,12 +3417,7 @@ - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - @@ -3534,28 +3435,10 @@ - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - pch_script.h @@ -3573,63 +3456,36 @@ pch_script.h $(IntDir)$(ProjectName)_script.pch - - - + - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - - - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - - - - pch_script.h $(IntDir)$(ProjectName)_script.pch - - pch_script.h - $(IntDir)$(ProjectName)_script.pch - pch_script.h $(IntDir)$(ProjectName)_script.pch - - - - pch_script.h $(IntDir)$(ProjectName)_script.pch @@ -3840,6 +3696,9 @@ {ccd4afae-aa10-42c6-a452-fdee497ccdf1} + + {37b3642c-b706-4c93-bc54-badadc8fc9b1} + diff --git a/src/xrGame/xrGame.vcxproj.filters b/src/xrGame/xrGame.vcxproj.filters index 870d092c18c..cc3a284ae9a 100644 --- a/src/xrGame/xrGame.vcxproj.filters +++ b/src/xrGame/xrGame.vcxproj.filters @@ -1909,9 +1909,6 @@ {bfd4c1f4-faf7-45fc-855e-1fd70023ad4c} - - {fe660738-cb41-4277-9092-9e2d9a2d9731} - {519f65e1-f943-4b85-928f-462419d21ec0} @@ -1939,69 +1936,18 @@ {ebf2a580-795f-4a30-aedb-2f92cb084382} - - {31d61eb9-a7c5-4527-b6cc-d890d465a560} - {f929b1ad-769e-456e-804d-5d4776fd3fb4} - - {a143c653-e625-4712-addc-2e246193f299} - - - {b1e33d94-b247-463d-9508-374a51bc5c3a} - {810cb2af-200b-4ebc-864c-f6fe45f26e00} - - {e84328d8-4117-4060-a5d8-022c0823060c} - - - {92ec8b27-4fbc-456c-a642-ad3a302eb6a3} - {39d38509-7911-4699-a4d7-9c10c8f29206} - - {6ab408a1-77bc-4a1b-b10d-67275aadf448} - - - {89add78b-1722-4806-b081-5be13f816451} - - - {64a7553d-e422-4b9f-84db-e3ec71dcd52f} - - - {52c08b50-a211-4278-a85a-d4e794004347} - - - {39a86d7b-6f39-4fd8-8646-5989eac29b47} - - - {6ac65b85-b69c-4f46-9f6e-97c5cfd37e18} - - - {c8b00191-d1aa-43c9-a4ef-11fb0981fcd0} - {59ae40a5-3d82-4975-af99-d70e3b756581} - - {a2ba0397-f13a-4bcc-a6d0-a3613ffcbc71} - - - {84975978-12e8-41fd-a796-954a22fdfd2a} - - - {7bdb8f05-f548-40f1-8d33-5c79ee1effbf} - - - {355b0b35-b53e-4e47-935e-67222f25c82a} - - - {daaf29c6-feac-4708-8f68-ff1fdfadda75} - {be2630ed-da7e-40c0-8271-533e359cc040} @@ -2266,9 +2212,6 @@ {9902c3e6-be5f-44b6-b539-cca3243e5e07} - - {c030db0f-190c-4415-a003-bf69d21c43cc} - {0b7f91ec-8546-438f-9598-b42cc9f39725} @@ -4632,9 +4575,6 @@ ScriptClasses\BaseClientClasses - - ScriptClasses\ScriptCallbackEx - ScriptClasses\ScriptParticles @@ -5535,9 +5475,6 @@ Core\Common\StringTable - - Core\Common\StringTable - Core\Common\Registry @@ -5952,12 +5889,6 @@ Core\Server\filetransfer - - UI - - - UI - UI @@ -6063,15 +5994,6 @@ UI\Common\MainIngame - - UI\Common\OptionsItem - - - UI\Common\OptionsItem - - - UI\Common\OptionsItem - UI\Common\OptionsConsoleCommands @@ -6105,132 +6027,21 @@ UI\Common\_Debug Fonts - - UI\UIWindows - - - UI\UIWindows - - - UI\UIWindows - - - UI\UIWindows - - - UI\UIWindows\XML - UI\UIWindows\XML - - UI\UIWindows\XML - - - UI\UIWindows\MessageBox - UI\UIWindows\MessageBox - - UI\UIWindows\PropertiesBox - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\EditBox - - - UI\UIWindows\EditBox - - - UI\UIWindows\EditBox\customEB - UI\UIWindows\Windows - - UI\UIWindows\Windows - - - UI\UIWindows\Windows - - - UI\UIWindows\Windows - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\TabControl - - - UI\UIWindows\TabControl - UI\UIWindows\ScriptWnd UI\UIWindows\ScriptWnd - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\ComboBox - - - UI\UIWindows\InteractiveBackground - - - UI\UIWindows\InteractiveBackground - - - UI\UIWindows\TrackBar - - - UI\UIWindows\ScrollView - - - UI\UIWindows\Lines - - - UI\UIWindows\Lines - - - UI\UIWindows\Lines - - - UI\UIWindows\Lines - UI\UIWindows\DragDrop @@ -6246,39 +6057,6 @@ UI\UIWindows\DragDrop - - UI\UIWindows\ScrollBar - - - UI\UIWindows\ScrollBar - - - UI\UIWindows\ScrollBar - - - UI\UIWindows\SpinBox - - - UI\UIWindows\SpinBox - - - UI\UIWindows\SpinBox - - - UI\UIWindows\arrow - - - UI\UIWindows\Hint - - - UI\UIWindows\ListBox - - - UI\UIWindows\ListBox - - - UI\UIWindows\ListBox - UI\HUD @@ -6450,9 +6228,6 @@ UI\Cursor - - UI\Cursor - UI\Tutorial @@ -6680,6 +6455,9 @@ UI\Common\LoadingScreen + + UI\UIWindows\Static + @@ -9445,9 +9223,6 @@ Core\Server\ServerConnect - - UI - UI @@ -9556,15 +9331,6 @@ UI\Common\MainIngame - - UI\Common\OptionsItem - - - UI\Common\OptionsItem - - - UI\Common\OptionsItem - UI\Common\OptionsConsoleCommands @@ -9619,96 +9385,18 @@ UI\Common\_Debug Fonts - - UI\UIWindows - - - UI\UIWindows\XML - UI\UIWindows\XML - - UI\UIWindows\XML - - - UI\UIWindows\MessageBox - - - UI\UIWindows\MessageBox - UI\UIWindows\MessageBox - - UI\UIWindows\PropertiesBox - - - UI\UIWindows\PropertiesBox - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\Static - - - UI\UIWindows\EditBox - - - UI\UIWindows\EditBox - - - UI\UIWindows\EditBox\customEB - - - UI\UIWindows\EditBox\customEB - UI\UIWindows\Windows - - UI\UIWindows\Windows - - - UI\UIWindows\Windows - - - UI\UIWindows\Windows - UI\UIWindows\Windows - - UI\UIWindows\ProgressBar - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\ProgressBar - - - UI\UIWindows\TabControl - - - UI\UIWindows\TabControl - - - UI\UIWindows\TabControl - UI\UIWindows\ScriptWnd @@ -9718,48 +9406,6 @@ UI\UIWindows\ScriptWnd - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\Buttons - - - UI\UIWindows\ComboBox - - - UI\UIWindows\ComboBox - - - UI\UIWindows\InteractiveBackground - - - UI\UIWindows\TrackBar - - - UI\UIWindows\ScrollView - - - UI\UIWindows\Lines - - - UI\UIWindows\Lines - - - UI\UIWindows\Lines - UI\UIWindows\DragDrop @@ -9775,42 +9421,6 @@ UI\UIWindows\DragDrop - - UI\UIWindows\ScrollBar - - - UI\UIWindows\ScrollBar - - - UI\UIWindows\ScrollBar - - - UI\UIWindows\SpinBox - - - UI\UIWindows\SpinBox - - - UI\UIWindows\SpinBox - - - UI\UIWindows\arrow - - - UI\UIWindows\Hint - - - UI\UIWindows\ListBox - - - UI\UIWindows\ListBox - - - UI\UIWindows\ListBox - - - UI\UIWindows\ListBox - UI\HUD @@ -10000,9 +9610,6 @@ UI\Cursor - - UI\Cursor - UI\Tutorial @@ -10218,6 +9825,9 @@ UI\Common\LoadingScreen + + UI\UIWindows\Static + diff --git a/src/xrGame/xrServer.cpp b/src/xrGame/xrServer.cpp index 21324a2f4b9..70d1782ad5f 100644 --- a/src/xrGame/xrServer.cpp +++ b/src/xrGame/xrServer.cpp @@ -1044,7 +1044,7 @@ void xrServer::PerformCheckClientsForMaxPing() if (Client->m_ping_warn.m_maxPingWarnings >= g_sv_maxPingWarningsCount) { // kick LPSTR reason; - STRCONCAT(reason, CStringTable().translate("st_kicked_by_server").c_str()); + STRCONCAT(reason, StringTable().translate("st_kicked_by_server").c_str()); Level().Server->DisconnectClient(Client, reason); } else diff --git a/src/xrGame/xr_level_controller.cpp b/src/xrGame/xr_level_controller.cpp index 1d6a31ea8f8..a680564f20d 100644 --- a/src/xrGame/xr_level_controller.cpp +++ b/src/xrGame/xr_level_controller.cpp @@ -5,391 +5,6 @@ #include "xr_level_controller.h" #include "string_table.h" -_binding g_key_bindings[bindings_count]; -_key_group g_current_keygroup = _sp; - -_action actions[] = -{ - { "left", kLEFT, _both }, - { "right", kRIGHT, _both }, - { "up", kUP, _both }, - { "down", kDOWN, _both }, - { "jump", kJUMP, _both }, - { "crouch", kCROUCH, _both }, - { "accel", kACCEL, _both }, - { "sprint_toggle", kSPRINT_TOGGLE, _both }, - - { "forward", kFWD, _both }, - { "back", kBACK, _both }, - { "lstrafe", kL_STRAFE, _both }, - { "rstrafe", kR_STRAFE, _both }, - - { "llookout", kL_LOOKOUT, _both }, - { "rlookout", kR_LOOKOUT, _both }, - - { "cam_1", kCAM_1, _both }, - { "cam_2", kCAM_2, _both }, - { "cam_3", kCAM_3, _both }, - { "cam_zoom_in", kCAM_ZOOM_IN, _both }, - { "cam_zoom_out", kCAM_ZOOM_OUT, _both }, - - { "torch", kTORCH, _both }, - { "night_vision", kNIGHT_VISION, _both }, - { "show_detector", kDETECTOR, _sp }, - - { "wpn_1", kWPN_1, _both }, - { "wpn_2", kWPN_2, _both }, - { "wpn_3", kWPN_3, _both }, - { "wpn_4", kWPN_4, _both }, - { "wpn_5", kWPN_5, _both }, - { "wpn_6", kWPN_6, _both }, - { "artefact", kARTEFACT, _both /*_mp*/ }, - { "wpn_next", kWPN_NEXT, _both }, // means next ammo type - { "wpn_fire", kWPN_FIRE, _both }, - { "wpn_zoom", kWPN_ZOOM, _both }, - { "wpn_zoom_inc", kWPN_ZOOM_INC, _both }, - { "wpn_zoom_dec", kWPN_ZOOM_DEC, _both }, - { "wpn_reload", kWPN_RELOAD, _both }, - { "wpn_func", kWPN_FUNC, _both }, - { "wpn_firemode_prev", kWPN_FIREMODE_PREV, _both }, - { "wpn_firemode_next", kWPN_FIREMODE_NEXT, _both }, - - { "pause", kPAUSE, _both }, - { "drop", kDROP, _both }, - { "use", kUSE, _both }, - { "scores", kSCORES, _both }, - { "chat", kCHAT, _mp }, - { "chat_team", kCHAT_TEAM, _mp }, - { "screenshot", kSCREENSHOT, _both }, - { "quit", kQUIT, _both }, - { "console", kCONSOLE, _both }, - { "inventory", kINVENTORY, _both }, - { "buy_menu", kBUY, _mp }, - { "skin_menu", kSKIN, _mp }, - { "team_menu", kTEAM, _mp }, - { "active_jobs", kACTIVE_JOBS, _sp }, - - { "vote_begin", kVOTE_BEGIN, _mp }, - { "show_admin_menu", kSHOW_ADMIN_MENU, _mp }, - { "vote", kVOTE, _mp }, - { "vote_yes", kVOTEYES, _mp }, - { "vote_no", kVOTENO, _mp }, - - { "next_slot", kNEXT_SLOT, _both }, - { "prev_slot", kPREV_SLOT, _both }, - - { "speech_menu_0", kSPEECH_MENU_0, _mp }, - { "speech_menu_1", kSPEECH_MENU_1, _mp }, - - { "quick_use_1", kQUICK_USE_1, _both }, - { "quick_use_2", kQUICK_USE_2, _both }, - { "quick_use_3", kQUICK_USE_3, _both }, - { "quick_use_4", kQUICK_USE_4, _both }, - - { "quick_save", kQUICK_SAVE, _sp }, - { "quick_load", kQUICK_LOAD, _sp }, - //{ "alife_command", kALIFE_CMD, _sp }, - - { nullptr, kLASTACTION, _both } -}; - -_keyboard keyboards[] = -{ - { "mouse1", MOUSE_1, "Mouse 1" }, - { "mouse2", MOUSE_2, "Mouse 2" }, - { "mouse3", MOUSE_3, "Mouse 3" }, - { "mouse4", MOUSE_4, "Mouse 4" }, - { "mouse5", MOUSE_5, "Mouse 5" }, - { "mouse6", MOUSE_6, "Mouse 6" }, - { "mouse7", MOUSE_7, "Mouse 7" }, - { "mouse8", MOUSE_8, "Mouse 8" }, - - { "kUNKNOWN", SDL_SCANCODE_UNKNOWN, "Unknown" }, - - { "kA", SDL_SCANCODE_A, "A" }, - { "kB", SDL_SCANCODE_B, "B" }, - { "kC", SDL_SCANCODE_C, "C" }, - { "kD", SDL_SCANCODE_D, "D" }, - { "kE", SDL_SCANCODE_E, "E" }, - { "kF", SDL_SCANCODE_F, "F" }, - { "kG", SDL_SCANCODE_G, "G" }, - { "kH", SDL_SCANCODE_H, "H" }, - { "kI", SDL_SCANCODE_I, "I" }, - { "kJ", SDL_SCANCODE_J, "J" }, - { "kK", SDL_SCANCODE_K, "K" }, - { "kL", SDL_SCANCODE_L, "L" }, - { "kM", SDL_SCANCODE_M, "M" }, - { "kN", SDL_SCANCODE_N, "N" }, - { "kO", SDL_SCANCODE_O, "O" }, - { "kP", SDL_SCANCODE_P, "P" }, - { "kQ", SDL_SCANCODE_Q, "Q" }, - { "kR", SDL_SCANCODE_R, "R" }, - { "kS", SDL_SCANCODE_S, "S" }, - { "kT", SDL_SCANCODE_T, "T" }, - { "kU", SDL_SCANCODE_U, "U" }, - { "kV", SDL_SCANCODE_V, "V" }, - { "kW", SDL_SCANCODE_W, "W" }, - { "kX", SDL_SCANCODE_X, "X" }, - { "kY", SDL_SCANCODE_Y, "Y" }, - { "kZ", SDL_SCANCODE_Z, "Z" }, - - { "k1", SDL_SCANCODE_1, "1" }, - { "k2", SDL_SCANCODE_2, "2" }, - { "k3", SDL_SCANCODE_3, "3" }, - { "k4", SDL_SCANCODE_4, "4" }, - { "k5", SDL_SCANCODE_5, "5" }, - { "k6", SDL_SCANCODE_6, "6" }, - { "k7", SDL_SCANCODE_7, "7" }, - { "k8", SDL_SCANCODE_8, "8" }, - { "k9", SDL_SCANCODE_9, "9" }, - { "k0", SDL_SCANCODE_0, "0" }, - - { "kRETURN", SDL_SCANCODE_RETURN, "Return" }, - { "kESCAPE", SDL_SCANCODE_ESCAPE, "Escape" }, - { "kBACK", SDL_SCANCODE_BACKSPACE, "Backspace" }, - { "kTAB", SDL_SCANCODE_TAB, "Tab" }, - { "kSPACE", SDL_SCANCODE_SPACE, "Space" }, - - { "kMINUS", SDL_SCANCODE_MINUS, "Minus" }, - { "kEQUALS", SDL_SCANCODE_EQUALS, "Equals" }, - { "kLBRACKET", SDL_SCANCODE_LEFTBRACKET, "Left bracket" }, - { "kRBRACKET", SDL_SCANCODE_RIGHTBRACKET, "Right bracket" }, - { "kBACKSLASH", SDL_SCANCODE_BACKSLASH, "Backslash" }, - { "kNONUSHASH", SDL_SCANCODE_NONUSHASH, "Non US Hash" }, - - { "kSEMICOLON", SDL_SCANCODE_SEMICOLON, "Semicolon" }, - { "kAPOSTROPHE", SDL_SCANCODE_APOSTROPHE, "Apostrophe" }, - { "kGRAVE", SDL_SCANCODE_GRAVE, "Grave" }, - { "kCOMMA", SDL_SCANCODE_COMMA, "Comma" }, - { "kPERIOD", SDL_SCANCODE_PERIOD, "Period" }, - { "kSLASH", SDL_SCANCODE_SLASH, "Slash" }, - - { "kCAPITAL", SDL_SCANCODE_CAPSLOCK, "Caps Lock" }, - - { "kF1", SDL_SCANCODE_F1, "F1" }, - { "kF2", SDL_SCANCODE_F2, "F2" }, - { "kF3", SDL_SCANCODE_F3, "F3" }, - { "kF4", SDL_SCANCODE_F4, "F4" }, - { "kF5", SDL_SCANCODE_F5, "F5" }, - { "kF6", SDL_SCANCODE_F6, "F6" }, - { "kF7", SDL_SCANCODE_F7, "F7" }, - { "kF8", SDL_SCANCODE_F8, "F8" }, - { "kF9", SDL_SCANCODE_F9, "F9" }, - { "kF10", SDL_SCANCODE_F10, "F10" }, - { "kF11", SDL_SCANCODE_F11, "F11" }, - { "kF12", SDL_SCANCODE_F12, "F12" }, - - { "kPRINTSCREEN", SDL_SCANCODE_PRINTSCREEN, "Print Screen" }, - { "kSCROLL", SDL_SCANCODE_SCROLLLOCK, "Scroll Lock" }, - { "kPAUSE", SDL_SCANCODE_PAUSE, "Pause" }, - { "kINSERT", SDL_SCANCODE_INSERT, "Insert" }, - - { "kHOME", SDL_SCANCODE_HOME, "Home" }, - { "kPGUP", SDL_SCANCODE_PAGEUP, "Page Up" }, - { "kDELETE", SDL_SCANCODE_DELETE, "Delete" }, - { "kEND", SDL_SCANCODE_END, "End" }, - { "kPGDN", SDL_SCANCODE_PAGEDOWN, "Page Down" }, - - { "kRIGHT", SDL_SCANCODE_RIGHT, "Right" }, - { "kLEFT", SDL_SCANCODE_LEFT, "Left" }, - { "kDOWN", SDL_SCANCODE_DOWN, "Down" }, - { "kUP", SDL_SCANCODE_UP, "Up" }, - - { "kNUMLOCK", SDL_SCANCODE_NUMLOCKCLEAR, "Num Lock" }, - - { "kDIVIDE", SDL_SCANCODE_KP_DIVIDE, "Numpad Divide" }, - { "kMULTIPLY", SDL_SCANCODE_KP_MULTIPLY, "Numpad Multiply" }, - { "kSUBTRACT", SDL_SCANCODE_KP_MINUS, "Numpad Minus" }, - { "kADD", SDL_SCANCODE_KP_PLUS, "Numpad Plus" }, - { "kNUMPADENTER", SDL_SCANCODE_KP_ENTER, "Numpad Enter" }, - - { "kNUMPAD1", SDL_SCANCODE_KP_1, "Numpad 1" }, - { "kNUMPAD2", SDL_SCANCODE_KP_2, "Numpad 2" }, - { "kNUMPAD3", SDL_SCANCODE_KP_3, "Numpad 3" }, - { "kNUMPAD4", SDL_SCANCODE_KP_4, "Numpad 4" }, - { "kNUMPAD5", SDL_SCANCODE_KP_5, "Numpad 5" }, - { "kNUMPAD6", SDL_SCANCODE_KP_6, "Numpad 6" }, - { "kNUMPAD7", SDL_SCANCODE_KP_7, "Numpad 7" }, - { "kNUMPAD8", SDL_SCANCODE_KP_8, "Numpad 8" }, - { "kNUMPAD9", SDL_SCANCODE_KP_9, "Numpad 9" }, - { "kNUMPAD0", SDL_SCANCODE_KP_0, "Numpad 0" }, - - { "kNUMPADPERIOD", SDL_SCANCODE_KP_PERIOD, "Numpad Period" }, - { "kNONUSBACKSLASH", SDL_SCANCODE_NONUSBACKSLASH, "Non US Backslash" }, - { "kAPPLICATION", SDL_SCANCODE_APPLICATION, "Application" }, - { "kPOWER", SDL_SCANCODE_POWER, "Power" }, - { "kNUMPADEQUALS", SDL_SCANCODE_KP_EQUALS, "Numpad Equals" }, - - { "kF13", SDL_SCANCODE_F13, "F13" }, - { "kF14", SDL_SCANCODE_F14, "F14" }, - { "kF15", SDL_SCANCODE_F15, "F15" }, - { "kF16", SDL_SCANCODE_F16, "F16" }, - { "kF17", SDL_SCANCODE_F17, "F17" }, - { "kF18", SDL_SCANCODE_F18, "F18" }, - { "kF19", SDL_SCANCODE_F19, "F19" }, - { "kF20", SDL_SCANCODE_F20, "F20" }, - { "kF21", SDL_SCANCODE_F21, "F21" }, - { "kF22", SDL_SCANCODE_F22, "F22" }, - { "kF23", SDL_SCANCODE_F23, "F23" }, - { "kF24", SDL_SCANCODE_F24, "F24" }, - - { "kEXECUTE", SDL_SCANCODE_EXECUTE, "Execute" }, - { "kHELP", SDL_SCANCODE_HELP, "Help" }, - { "kMENU", SDL_SCANCODE_MENU, "Menu" }, - - { "kSELECT", SDL_SCANCODE_SELECT, "Select" }, - { "kSTOP", SDL_SCANCODE_STOP, "Stop" }, - - { "kREDO", SDL_SCANCODE_AGAIN, "Redo" }, - { "kUNDO", SDL_SCANCODE_UNDO, "Undo" }, - - { "kCUT", SDL_SCANCODE_CUT, "Cut" }, - { "kCOPY", SDL_SCANCODE_COPY, "Copy" }, - { "kPASTE", SDL_SCANCODE_PASTE, "Paste" }, - - { "kFIND", SDL_SCANCODE_FIND, "Find" }, - - { "kMUTE", SDL_SCANCODE_MUTE, "Mute" }, - { "kVOLUMEUP", SDL_SCANCODE_VOLUMEUP, "Volume Up" }, - { "kVOLUMEDOWN", SDL_SCANCODE_VOLUMEDOWN, "Volume Down" }, - - { "kNUMPADCOMMA", SDL_SCANCODE_KP_COMMA, "Numpad Comma" }, - { "kNUMPADEQUALSAS400", SDL_SCANCODE_KP_EQUALSAS400, "Equals AS400" }, - - { "kINTERNATIONAL1", SDL_SCANCODE_INTERNATIONAL1 /* Give a better name? */ }, - { "kINTERNATIONAL2", SDL_SCANCODE_INTERNATIONAL2 /* Give a better name? */ }, - { "kYEN", SDL_SCANCODE_INTERNATIONAL3, "Yen" }, - { "kINTERNATIONAL4", SDL_SCANCODE_INTERNATIONAL4 /* Give a better name? */ }, - { "kINTERNATIONAL5", SDL_SCANCODE_INTERNATIONAL5 /* Give a better name? */ }, - { "kINTERNATIONAL6", SDL_SCANCODE_INTERNATIONAL6 /* Give a better name? */ }, - { "kINTERNATIONAL7", SDL_SCANCODE_INTERNATIONAL7 /* Give a better name? */ }, - { "kINTERNATIONAL8", SDL_SCANCODE_INTERNATIONAL8 /* Give a better name? */ }, - { "kINTERNATIONAL9", SDL_SCANCODE_INTERNATIONAL9 /* Give a better name? */ }, - - { "kHANGUL", SDL_SCANCODE_LANG1, "Hangul" }, - { "kHANJA", SDL_SCANCODE_LANG2, "Hanja" }, - { "kKATAKANA", SDL_SCANCODE_LANG3, "Katakana" }, - { "kHIRAGANA", SDL_SCANCODE_LANG4, "Hiragana" }, - { "kZENHANKAKU", SDL_SCANCODE_LANG5, "Zen-Han-kaku" }, - { "kLANG6", SDL_SCANCODE_LANG6 /* Give a better name? */ }, - { "kLANG7", SDL_SCANCODE_LANG7 /* Give a better name? */ }, - { "kLANG8", SDL_SCANCODE_LANG8 /* Give a better name? */ }, - { "kLANG9", SDL_SCANCODE_LANG9 /* Give a better name? */ }, - - { "kALTERASE", SDL_SCANCODE_ALTERASE, "Alterase" }, - { "kCANCEL", SDL_SCANCODE_CANCEL, "Cancel" }, - { "kCLEAR", SDL_SCANCODE_CLEAR, "Clear" }, - { "kPRIOR", SDL_SCANCODE_PRIOR, "Prior" }, - { "kRETURN2", SDL_SCANCODE_RETURN2, "Return 2" }, - { "kSEPARATOR", SDL_SCANCODE_SEPARATOR, "Separator" }, - { "kOUT", SDL_SCANCODE_OUT, "Out" }, - { "kOPER", SDL_SCANCODE_OPER, "Oper" }, - { "kCLEARAGAIN", SDL_SCANCODE_CLEARAGAIN, "Clear Again" }, - { "kCRSEL", SDL_SCANCODE_CRSEL, "Crsel" }, - { "kEXSEL", SDL_SCANCODE_EXSEL, "Excel" }, - - { "kNUMPAD_00", SDL_SCANCODE_KP_00, "Numpad 00" }, - { "kNUMPAD_000", SDL_SCANCODE_KP_000, "Numpad 000" }, - { "kTHOUSANDSSEPARATOR", SDL_SCANCODE_THOUSANDSSEPARATOR, "Thousand Separator" }, - { "kDECIMALSEPARATOR", SDL_SCANCODE_DECIMALSEPARATOR, "Decimal Separator" }, - { "kCURRENCYUNIT", SDL_SCANCODE_CURRENCYUNIT, "Currency Unit" }, - { "kCURRENCYSUBUNIT", SDL_SCANCODE_CURRENCYSUBUNIT, "Currency Subunit" }, - { "kNUMPAD_LEFTPAREN", SDL_SCANCODE_KP_LEFTPAREN, "Numpad Left Paren" }, - { "kNUMPAD_RIGHTPAREN", SDL_SCANCODE_KP_RIGHTPAREN, "Numpad Right Paren" }, - { "kNUMPAD_LEFTBRACE", SDL_SCANCODE_KP_LEFTBRACE, "Numpad Left Brace" }, - { "kNUMPAD_RIGHTBRACE", SDL_SCANCODE_KP_RIGHTBRACE, "Numpad Right Brace" }, - { "kNUMPAD_TAB", SDL_SCANCODE_KP_TAB, "Numpad Tab" }, - { "kNUMPAD_BACKSPACE", SDL_SCANCODE_KP_BACKSPACE, "Numpad Backspace" }, - { "kNUMPAD_A", SDL_SCANCODE_KP_A, "Numpad A" }, - { "kNUMPAD_B", SDL_SCANCODE_KP_B, "Numpad B" }, - { "kNUMPAD_C", SDL_SCANCODE_KP_C, "Numpad C" }, - { "kNUMPAD_D", SDL_SCANCODE_KP_D, "Numpad D" }, - { "kNUMPAD_E", SDL_SCANCODE_KP_E, "Numpad E" }, - { "kNUMPAD_F", SDL_SCANCODE_KP_F, "Numpad F" }, - - { "kNUMPAD_XOR", SDL_SCANCODE_KP_XOR, "Numpad XOR" }, - - { "kNUMPAD_POWER", SDL_SCANCODE_KP_POWER, "Numpad Power" }, - { "kNUMPAD_PERCENT", SDL_SCANCODE_KP_PERCENT, "Numpad Percent" }, - - { "kNUMPAD_LESS", SDL_SCANCODE_KP_LESS, "Numpad Less" }, - { "kNUMPAD_GREATER", SDL_SCANCODE_KP_GREATER, "Numpad Greater" }, - - { "kNUMPAD_AMPERSAND", SDL_SCANCODE_KP_AMPERSAND, "Numpad Ampersand" }, - { "kNUMPAD_DBLAMPERSAND", SDL_SCANCODE_KP_DBLAMPERSAND, "Numpad Double Ampersand" }, - - { "kNUMPAD_VERTICALBAR", SDL_SCANCODE_KP_VERTICALBAR, "Numpad Vertical Bar" }, - { "kNUMPAD_DBLVERTICALBAR", SDL_SCANCODE_KP_DBLVERTICALBAR, "Numpad Double Vertical Bar" }, - - { "kNUMPAD_COLON", SDL_SCANCODE_KP_COLON, "Numpad Colon" }, - { "kNUMPAD_HASH", SDL_SCANCODE_KP_HASH, "Numpad Hash" }, - { "kNUMPAD_SPACE", SDL_SCANCODE_KP_SPACE, "Numpad Space" }, - { "kNUMPAD_AT", SDL_SCANCODE_KP_AT, "Numpad At" }, - { "kNUMPAD_EXCLAM", SDL_SCANCODE_KP_EXCLAM, "Numpad Exclam" }, - - { "kNUMPAD_MEMSTORE", SDL_SCANCODE_KP_MEMSTORE, "Numpad Mem Store" }, - { "kNUMPAD_MEMRECALL", SDL_SCANCODE_KP_MEMRECALL, "Numpad Mem Recall" }, - { "kNUMPAD_MEMCLEAR", SDL_SCANCODE_KP_MEMCLEAR, "Numpad Mem Clear" }, - { "kNUMPAD_MEMADD", SDL_SCANCODE_KP_MEMADD, "Numpad Mem Add" }, - { "kNUMPAD_MEMSUBTRACT", SDL_SCANCODE_KP_MEMSUBTRACT, "Numpad Mem Subtract" }, - { "kNUMPAD_MEMMULTIPLY", SDL_SCANCODE_KP_MEMMULTIPLY, "Numpad Mem Multiply" }, - { "kNUMPAD_MEMDIVIDE", SDL_SCANCODE_KP_MEMDIVIDE, "Numpad Mem Divide" }, - - { "kNUMPAD_PLUSMINUS", SDL_SCANCODE_KP_PLUSMINUS, "Numpad Plus-Minus" }, - { "kNUMPAD_CLEAR", SDL_SCANCODE_KP_CLEAR, "Numpad Clear" }, - { "kNUMPAD_CLEARENTRY", SDL_SCANCODE_KP_CLEARENTRY, "Numpad Clear Entry" }, - { "kNUMPAD_BINARY", SDL_SCANCODE_KP_BINARY, "Numpad Binary" }, - { "kNUMPAD_OCTAL", SDL_SCANCODE_KP_OCTAL, "Numpad Octal" }, - { "kNUMPAD_DECIMAL", SDL_SCANCODE_KP_DECIMAL, "Numpad Decimal" }, - { "kNUMPAD_HEXADECIMAL", SDL_SCANCODE_KP_HEXADECIMAL, "Numpad Hexadecimal" }, - - { "kLCONTROL", SDL_SCANCODE_LCTRL, "Left Ctrl" }, - { "kLSHIFT", SDL_SCANCODE_LSHIFT, "Left shift" }, - { "kLMENU", SDL_SCANCODE_LALT, "Left Alt" }, - { "kLWIN", SDL_SCANCODE_LGUI, "Left Windows" }, - { "kRCONTROL", SDL_SCANCODE_RCTRL, "Right Ctrl" }, - { "kRSHIFT", SDL_SCANCODE_RSHIFT, "Right Shift" }, - { "kRMENU", SDL_SCANCODE_RALT, "Right Alt" }, - { "kRWIN", SDL_SCANCODE_RGUI, "Right Windows" }, - - { "kMODE", SDL_SCANCODE_MODE, "Mode" }, - - { "kAUDIONEXT", SDL_SCANCODE_AUDIONEXT, "Audio Next" }, - { "kAUDIOPREV", SDL_SCANCODE_AUDIOPREV, "Audio Prev" }, - { "kAUDIOSTOP", SDL_SCANCODE_AUDIOSTOP, "Audio Stop" }, - { "kAUDIOPLAY", SDL_SCANCODE_AUDIOPLAY, "Audio Play" }, - { "kAUDIOMUTE", SDL_SCANCODE_AUDIOMUTE, "Audio Mute" }, - - { "kMEDIASELECT", SDL_SCANCODE_MEDIASELECT, "Media Select" }, - { "kWWW", SDL_SCANCODE_WWW, "WWW" }, - { "kMAIL", SDL_SCANCODE_MAIL, "Mail" }, - { "kCALCULATOR", SDL_SCANCODE_CALCULATOR, "Calculator" }, - { "kCOMPUTER", SDL_SCANCODE_COMPUTER, "My Computer" }, - - { "kNUMPAD_AC_SEARCH", SDL_SCANCODE_AC_SEARCH, "AC Search" }, - { "kNUMPAD_AC_HOME", SDL_SCANCODE_AC_HOME, "AC Home" }, - { "kNUMPAD_AC_BACK", SDL_SCANCODE_AC_BACK, "AC Back" }, - { "kNUMPAD_AC_FORWARD", SDL_SCANCODE_AC_FORWARD, "AC Forward" }, - { "kNUMPAD_AC_STOP", SDL_SCANCODE_AC_STOP, "AC Stop" }, - { "kNUMPAD_AC_REFRESH", SDL_SCANCODE_AC_REFRESH, "AC Refresh" }, - { "kNUMPAD_AC_BOOKMARKS", SDL_SCANCODE_AC_BOOKMARKS, "AC Bookmarks" }, - - { "kBRIGHTNESSDOWN", SDL_SCANCODE_BRIGHTNESSDOWN, "Brightness Down" }, - { "kBRIGHTNESSUP", SDL_SCANCODE_BRIGHTNESSUP, "Brightness Up" }, - { "kDISPLAYSWITCH", SDL_SCANCODE_DISPLAYSWITCH, "Display Switch" }, - - { "kKBDILLUMTOGGLE)", SDL_SCANCODE_KBDILLUMTOGGLE, "Illum Toogle" }, - { "kKBDILLUMDOWN", SDL_SCANCODE_KBDILLUMDOWN, "Illum Down" }, - { "kKBDILLUMUP", SDL_SCANCODE_KBDILLUMUP, "Illum Up" }, - - { "kEJECT", SDL_SCANCODE_EJECT, "Eject" }, - { "kSLEEP", SDL_SCANCODE_SLEEP, "Sleep" }, - - { "kAPP1", SDL_SCANCODE_APP1, "App 1" }, - { "kAPP2", SDL_SCANCODE_APP2, "App 2" }, - { nullptr, -1, "(null)" } -}; - void initialize_bindings() { #ifdef DEBUG @@ -452,28 +67,6 @@ pcstr id_to_action_name(EGameActions _id) return NULL; } -EGameActions action_name_to_id(pcstr _name) -{ - _action* action = action_name_to_ptr(_name); - if (action) - return action->id; - else - return kNOTBINDED; -} - -_action* action_name_to_ptr(pcstr _name) -{ - int idx = 0; - while (actions[idx].action_name) - { - if (!xr_stricmp(_name, actions[idx].action_name)) - return &actions[idx]; - ++idx; - } - Msg("! cant find corresponding [id] for '%s'", _name); - return NULL; -} - pcstr dik_to_keyname(int _dik) { _keyboard* kb = dik_to_ptr(_dik, true); @@ -494,28 +87,7 @@ _keyboard* dik_to_ptr(int _dik, bool bSafe) ++idx; } if (!bSafe) - Msg("! cant find corresponding [_keyboard] for dik"); - return NULL; -} - -int keyname_to_dik(pcstr _name) -{ - _keyboard* _kb = keyname_to_ptr(_name); - return _kb->dik; -} - -_keyboard* keyname_to_ptr(pcstr _name) -{ - int idx = 0; - while (keyboards[idx].key_name) - { - _keyboard& kb = keyboards[idx]; - if (!xr_stricmp(_name, kb.key_name)) - return &keyboards[idx]; - ++idx; - } - - Msg("! cant find corresponding [_keyboard*] for keyname %s", _name); + Msg("! [dik_to_ptr] cant find corresponding '_keyboard' for dik '%d'", _dik); return NULL; } @@ -525,37 +97,6 @@ bool is_group_not_conflicted(_key_group g1, _key_group g2) } bool is_group_matching(_key_group g1, _key_group g2) { return ((g1 == g2) || (g1 == _both) || (g2 == _both)); } -bool is_binded(EGameActions _action_id, int _dik) -{ - _binding* pbinding = &g_key_bindings[_action_id]; - if (pbinding->m_keyboard[0] && pbinding->m_keyboard[0]->dik == _dik) - return true; - - if (pbinding->m_keyboard[1] && pbinding->m_keyboard[1]->dik == _dik) - return true; - - return false; -} - -int get_action_dik(EGameActions _action_id, int idx) -{ - _binding* pbinding = &g_key_bindings[_action_id]; - - if (idx == -1) - { - if (pbinding->m_keyboard[0]) - return pbinding->m_keyboard[0]->dik; - - if (pbinding->m_keyboard[1]) - return pbinding->m_keyboard[1]->dik; - } - else - { - if (pbinding->m_keyboard[idx]) - return pbinding->m_keyboard[idx]->dik; - } - return SDL_SCANCODE_UNKNOWN; -} EGameActions get_binded_action(int _dik) { @@ -577,33 +118,6 @@ EGameActions get_binded_action(int _dik) return kNOTBINDED; } -void GetActionAllBinding(LPCSTR _action, char* dst_buff, int dst_buff_sz) -{ - int action_id = action_name_to_id(_action); - _binding* pbinding = &g_key_bindings[action_id]; - - string128 prim; - string128 sec; - prim[0] = 0; - sec[0] = 0; - - if (pbinding->m_keyboard[0]) - { - xr_strcpy(prim, pbinding->m_keyboard[0]->key_local_name.c_str()); - } - if (pbinding->m_keyboard[1]) - { - xr_strcpy(sec, pbinding->m_keyboard[1]->key_local_name.c_str()); - } - if (NULL == pbinding->m_keyboard[0] && NULL == pbinding->m_keyboard[1]) - { - xr_sprintf(dst_buff, dst_buff_sz, "%s", CStringTable().translate("st_key_notbinded").c_str()); - } - else - xr_sprintf( - dst_buff, dst_buff_sz, "%s%s%s", prim[0] ? prim : "", (sec[0] && prim[0]) ? " , " : "", sec[0] ? sec : ""); -} - ConsoleBindCmds bindConsoleCmds; BOOL bRemapped = FALSE; diff --git a/src/xrGame/xr_level_controller.h b/src/xrGame/xr_level_controller.h index 021775ecc58..a46046a5811 100644 --- a/src/xrGame/xr_level_controller.h +++ b/src/xrGame/xr_level_controller.h @@ -2,142 +2,14 @@ #include "xrCore/xrstring.h" #include "xrCommon/xr_string.h" #include "xrCommon/xr_map.h" -#include "xrEngine/xr_input.h" // Don't remove this include - -enum EGameActions -{ - kLEFT, - kRIGHT, - kUP, - kDOWN, - kJUMP, - kCROUCH, - kACCEL, - kSPRINT_TOGGLE, - - kFWD, - kBACK, - kL_STRAFE, - kR_STRAFE, - - kL_LOOKOUT, - kR_LOOKOUT, - - kCAM_1, - kCAM_2, - kCAM_3, - kCAM_ZOOM_IN, - kCAM_ZOOM_OUT, - - kTORCH, - kNIGHT_VISION, - kDETECTOR, - kWPN_1, - kWPN_2, - kWPN_3, - kWPN_4, - kWPN_5, - kWPN_6, - kARTEFACT, - kWPN_NEXT, - kWPN_FIRE, - kWPN_ZOOM, - kWPN_ZOOM_INC, - kWPN_ZOOM_DEC, - kWPN_RELOAD, - kWPN_FUNC, - kWPN_FIREMODE_PREV, - kWPN_FIREMODE_NEXT, - - kPAUSE, - kDROP, - kUSE, - kSCORES, - kCHAT, - kCHAT_TEAM, - kSCREENSHOT, - kQUIT, - kCONSOLE, - kINVENTORY, - kBUY, - kSKIN, - kTEAM, - kACTIVE_JOBS, - - kVOTE_BEGIN, - kSHOW_ADMIN_MENU, - kVOTE, - kVOTEYES, - kVOTENO, - - kNEXT_SLOT, - kPREV_SLOT, - - kSPEECH_MENU_0, - kSPEECH_MENU_1, - - kQUICK_USE_1, - kQUICK_USE_2, - kQUICK_USE_3, - kQUICK_USE_4, - - kQUICK_SAVE, - kQUICK_LOAD, - kALIFE_CMD, - - kLASTACTION, - kNOTBINDED, - kFORCEDWORD = u32(-1) -}; - -struct _keyboard -{ - pcstr key_name; - int dik; - xr_string key_local_name; -}; -enum _key_group -{ - _both = (1 << 0), - _sp = _both | (1 << 1), - _mp = _both | (1 << 2), -}; - -extern _key_group g_current_keygroup; +#include "xrEngine/xr_input_xinput.h" bool is_group_not_conflicted(_key_group g1, _key_group g2); -struct _action -{ - pcstr action_name; - EGameActions id; - _key_group key_group; -}; - pcstr dik_to_keyname(int _dik); -int keyname_to_dik(pcstr _name); -_keyboard* keyname_to_ptr(pcstr _name); _keyboard* dik_to_ptr(int _dik, bool bSafe); pcstr id_to_action_name(EGameActions _id); -EGameActions action_name_to_id(pcstr _name); -_action* action_name_to_ptr(pcstr _name); - -extern _action actions[]; -// extern _keyboard keyboards[]; -// extern xr_vector<_keyboard> keyboards; - -#define bindings_count kLASTACTION -struct _binding -{ - _action* m_action; - _keyboard* m_keyboard[2]; -}; - -extern _binding g_key_bindings[]; - -bool is_binded(EGameActions action_id, int dik); -int get_action_dik(EGameActions action_id, int idx = -1); EGameActions get_binded_action(int dik); extern void CCC_RegisterInput(); @@ -159,6 +31,4 @@ class ConsoleBindCmds void save(IWriter* F); }; -void GetActionAllBinding(LPCSTR action, char* dst_buff, int dst_buff_sz); - extern ConsoleBindCmds bindConsoleCmds; diff --git a/src/xrGame/xrgame_dll_detach.cpp b/src/xrGame/xrgame_dll_detach.cpp index 74cbf0ba798..b5eb3e46195 100644 --- a/src/xrGame/xrgame_dll_detach.cpp +++ b/src/xrGame/xrgame_dll_detach.cpp @@ -7,7 +7,7 @@ #include "entity_alive.h" #include "ui/UIInventoryUtilities.h" #include "UI/UIXmlInit.h" -#include "UI/UItextureMaster.h" +#include "xrUICore/XML/UITextureMaster.h" #include "InfoPortion.h" #include "PhraseDialog.h" @@ -30,14 +30,7 @@ typedef xr_vector> STORY_PAIRS; extern STORY_PAIRS story_ids; extern STORY_PAIRS spawn_story_ids; -extern void show_smart_cast_stats(); -extern void clear_smart_cast_stats(); -extern void release_smart_cast_stats(); -extern void dump_list_wnd(); -extern void dump_list_lines(); -extern void dump_list_sublines(); extern void clean_wnd_rects(); -extern void dump_list_xmls(); extern void CreateUIGeom(); extern void DestroyUIGeom(); extern void InitHudSoundSettings(); @@ -82,12 +75,6 @@ void clean_game_globals() if (!GEnv.isDedicatedServer) { - //. CInfoPortion::DeleteSharedData (); - //. CInfoPortion::DeleteIdToIndexData (); - - //. CEncyclopediaArticle::DeleteSharedData (); - //. CEncyclopediaArticle::DeleteIdToIndexData (); - CPhraseDialog::DeleteSharedData(); CPhraseDialog::DeleteIdToIndexData(); @@ -107,8 +94,6 @@ void clean_game_globals() // static shader for blood CEntityAlive::UnloadBloodyWallmarks(); CEntityAlive::UnloadFireParticles(); - //очищение памяти таблицы строк - CStringTable::Destroy(); // Очищение таблицы цветов CUIXmlInit::DeleteColorDefs(); // Очищение таблицы идентификаторов рангов и отношений сталкеров @@ -119,17 +104,13 @@ void clean_game_globals() #ifdef DEBUG // XXX nitrocaster PROFILER: temporarily disabled due to linkage issues // xr_delete (g_profiler); - release_smart_cast_stats(); + // release_smart_cast_stats(); #endif RELATION_REGISTRY::clear_relation_registry(); - dump_list_wnd(); - dump_list_lines(); - dump_list_sublines(); clean_wnd_rects(); xr_delete(g_uiSpotXml); - dump_list_xmls(); DestroyUIGeom(); xr_delete(pWpnScopeXml); CUITextureMaster::FreeTexInfo(); diff --git a/src/xrGame/script_callback_ex.h b/src/xrScriptEngine/script_callback_ex.h similarity index 99% rename from src/xrGame/script_callback_ex.h rename to src/xrScriptEngine/script_callback_ex.h index af5ffbb43c1..2eb2e0637c8 100644 --- a/src/xrGame/script_callback_ex.h +++ b/src/xrScriptEngine/script_callback_ex.h @@ -7,8 +7,6 @@ //////////////////////////////////////////////////////////////////////////// #pragma once - -#include "ai_space.h" #include "xrScriptEngine/script_engine.hpp" IC bool compare_safe(const luabind::object& o1, const luabind::object& o2) diff --git a/src/xrScriptEngine/xrScriptEngine.vcxproj b/src/xrScriptEngine/xrScriptEngine.vcxproj index d93441e732d..390afddcc96 100644 --- a/src/xrScriptEngine/xrScriptEngine.vcxproj +++ b/src/xrScriptEngine/xrScriptEngine.vcxproj @@ -155,6 +155,7 @@ + diff --git a/src/xrScriptEngine/xrScriptEngine.vcxproj.filters b/src/xrScriptEngine/xrScriptEngine.vcxproj.filters index 685c2339f53..d5227082777 100644 --- a/src/xrScriptEngine/xrScriptEngine.vcxproj.filters +++ b/src/xrScriptEngine/xrScriptEngine.vcxproj.filters @@ -28,6 +28,9 @@ {48cb416c-d090-4ae9-b4e3-56abea843d93} + + {b1b81af3-4b79-4435-92cc-5226c808c8ca} + @@ -114,6 +117,9 @@ Engine + + ScriptCallbackEx + @@ -159,4 +165,7 @@ Engine + + + \ No newline at end of file diff --git a/src/xrServerEntities/character_info.cpp b/src/xrServerEntities/character_info.cpp index b11c4fc1afa..2875721f89f 100644 --- a/src/xrServerEntities/character_info.cpp +++ b/src/xrServerEntities/character_info.cpp @@ -7,11 +7,11 @@ #include "character_info.h" #ifdef XRGAME_EXPORTS -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "PhraseDialog.h" #include "xrServer_Objects_ALife_Monsters.h" #else // XRGAME_EXPORTS -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #endif // XRGAME_EXPORTS ////////////////////////////////////////////////////////////////////////// diff --git a/src/xrServerEntities/smart_cast.cpp b/src/xrServerEntities/smart_cast.cpp index 3e8edc61ea7..2f1ccd2973d 100644 --- a/src/xrServerEntities/smart_cast.cpp +++ b/src/xrServerEntities/smart_cast.cpp @@ -16,7 +16,7 @@ #include "actor.h" #include "custommonster.h" #include "ai/stalker/ai_stalker.h" -#include "ui/uiwindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "customzone.h" #include "weapon.h" #include "cameraeffector.h" diff --git a/src/xrServerEntities/specific_character.cpp b/src/xrServerEntities/specific_character.cpp index ecccd01e66e..6c8fe9f2ba7 100644 --- a/src/xrServerEntities/specific_character.cpp +++ b/src/xrServerEntities/specific_character.cpp @@ -101,7 +101,7 @@ void CSpecificCharacter::load_shared(LPCSTR) //игровое имя персонажа data()->m_sGameName = pXML->Read("name", 0, ""); - data()->m_sBioText = CStringTable().translate(pXML->Read("bio", 0, "")); + data()->m_sBioText = StringTable().translate(pXML->Read("bio", 0, "")); data()->m_fPanic_threshold = pXML->ReadFlt("panic_threshold", 0, 0.f); data()->m_fHitProbabilityFactor = pXML->ReadFlt("hit_probability_factor", 0, 1.f); diff --git a/src/xrServerEntities/xml_str_id_loader.h b/src/xrServerEntities/xml_str_id_loader.h index 25487fddb42..8de14378467 100644 --- a/src/xrServerEntities/xml_str_id_loader.h +++ b/src/xrServerEntities/xml_str_id_loader.h @@ -1,9 +1,9 @@ #pragma once #ifdef XRGAME_EXPORTS -#include "ui/xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #else // XRGAME_EXPORTS -#include "xrUIXmlParser.h" +#include "xrUICore/XML/xrUIXmlParser.h" #include "Common/object_broker.h" #endif // XRGAME_EXPORTS diff --git a/src/xrServerEntities/xrServer_Objects_ALife_Monsters.cpp b/src/xrServerEntities/xrServer_Objects_ALife_Monsters.cpp index 2b2334649e5..99ee7861c2d 100644 --- a/src/xrServerEntities/xrServer_Objects_ALife_Monsters.cpp +++ b/src/xrServerEntities/xrServer_Objects_ALife_Monsters.cpp @@ -429,7 +429,7 @@ void CSE_ALifeTraderAbstract::set_specific_character(shared_str new_spec_char) if (NO_REPUTATION == m_reputation) m_reputation = selected_char.Reputation(); - m_character_name = *(CStringTable().translate(selected_char.Name())); + m_character_name = *(StringTable().translate(selected_char.Name())); LPCSTR gen_name = "GENERATE_NAME_"; if (strstr(m_character_name.c_str(), gen_name)) @@ -447,14 +447,14 @@ void CSE_ALifeTraderAbstract::set_specific_character(shared_str new_spec_char) n += subset; n += "_"; n += xr_itoa(::Random.randI(name_cnt), S, 10); - m_character_name = *(CStringTable().translate(n.c_str())); + m_character_name = *(StringTable().translate(n.c_str())); m_character_name += " "; n = "lname_"; n += subset; n += "_"; n += xr_itoa(::Random.randI(last_name_cnt), S, 10); - m_character_name += *(CStringTable().translate(n.c_str())); + m_character_name += *(StringTable().translate(n.c_str())); } u32 min_m = selected_char.MoneyDef().min_money; u32 max_m = selected_char.MoneyDef().max_money; diff --git a/src/xrGame/ui/UI3tButton.cpp b/src/xrUICore/Buttons/UI3tButton.cpp similarity index 99% rename from src/xrGame/ui/UI3tButton.cpp rename to src/xrUICore/Buttons/UI3tButton.cpp index 9744d9a2ce4..cf9e7caa593 100644 --- a/src/xrGame/ui/UI3tButton.cpp +++ b/src/xrUICore/Buttons/UI3tButton.cpp @@ -1,7 +1,6 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UI3tButton.h" -#include "UIXmlInit.h" -#include "UIHint.h" +#include "Hint/UIHint.h" CUI3tButton::CUI3tButton() { diff --git a/src/xrGame/ui/UI3tButton.h b/src/xrUICore/Buttons/UI3tButton.h similarity index 88% rename from src/xrGame/ui/UI3tButton.h rename to src/xrUICore/Buttons/UI3tButton.h index fdb55bff542..af5364f0b00 100644 --- a/src/xrGame/ui/UI3tButton.h +++ b/src/xrUICore/Buttons/UI3tButton.h @@ -1,12 +1,12 @@ #pragma once -#include "UIButton.h" -#include "UI_IB_Static.h" +#include "xrUICore/Buttons/UIButton.h" +#include "xrUICore/InteractiveBackground/UI_IB_Static.h" #include "xrSound/Sound.h" -class CUI3tButton : public CUIButton +class XRUICORE_API CUI3tButton : public CUIButton { typedef CUIButton inherited; - friend class CUIXmlInit; + friend class CUIXmlInitBase; //. using CUIButton::SetTextColor; public: CUI3tButton(); diff --git a/src/xrGame/ui/UIBtnHint.cpp b/src/xrUICore/Buttons/UIBtnHint.cpp similarity index 76% rename from src/xrGame/ui/UIBtnHint.cpp rename to src/xrUICore/Buttons/UIBtnHint.cpp index b01dd6ae719..bb302df1340 100644 --- a/src/xrGame/ui/UIBtnHint.cpp +++ b/src/xrUICore/Buttons/UIBtnHint.cpp @@ -1,17 +1,16 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIBtnHint.h" -#include "UIFrameWindow.h" -#include "UIStatic.h" -#include "UIXmlInit.h" +#include "Static/UIStatic.h" +#include "XML/UIXmlInitBase.h" CUIButtonHint* g_btnHint = NULL; CUIButtonHint* g_statHint = NULL; -CUIButtonHint::CUIButtonHint() : m_ownerWnd(NULL), m_enabledOnFrame(false) +CUIButtonHint::CUIButtonHint() +: m_ownerWnd(NULL) +, m_enabledOnFrame(false) { - // Device.seqRender.Add (this, REG_PRIORITY_LOW-1000); - - CUIXmlInit xml_init; + CUIXmlInitBase xml_init; CUIXml uiXml; uiXml.Load(CONFIG_PATH, UI_PATH, "hint_item.xml"); xml_init.InitFrameWindow(uiXml, "button_hint", 0, this); @@ -23,9 +22,7 @@ CUIButtonHint::CUIButtonHint() : m_ownerWnd(NULL), m_enabledOnFrame(false) } CUIButtonHint::~CUIButtonHint() -{ - // Device.seqRender.Remove (this); -} +{} void CUIButtonHint::OnRender() { diff --git a/src/xrGame/ui/UIBtnHint.h b/src/xrUICore/Buttons/UIBtnHint.h similarity index 66% rename from src/xrGame/ui/UIBtnHint.h rename to src/xrUICore/Buttons/UIBtnHint.h index fd52ae55192..4fc2ee9f030 100644 --- a/src/xrGame/ui/UIBtnHint.h +++ b/src/xrUICore/Buttons/UIBtnHint.h @@ -1,9 +1,9 @@ #pragma once -#include "UIFrameWindow.h" +#include "xrUICore/Windows/UIFrameWindow.h" class CUITextWnd; -class CUIButtonHint : public CUIFrameWindow +class XRUICORE_API CUIButtonHint : public CUIFrameWindow { CUIWindow* m_ownerWnd; @@ -20,5 +20,5 @@ class CUIButtonHint : public CUIFrameWindow void SetHintText(CUIWindow* w, LPCSTR text); }; -extern CUIButtonHint* g_btnHint; -extern CUIButtonHint* g_statHint; +XRUICORE_API extern CUIButtonHint* g_btnHint; +XRUICORE_API extern CUIButtonHint* g_statHint; diff --git a/src/xrGame/ui/UIButton.cpp b/src/xrUICore/Buttons/UIButton.cpp similarity index 97% rename from src/xrGame/ui/UIButton.cpp rename to src/xrUICore/Buttons/UIButton.cpp index 66e567c53f4..7e7bc5ecb40 100644 --- a/src/xrGame/ui/UIButton.cpp +++ b/src/xrUICore/Buttons/UIButton.cpp @@ -1,10 +1,10 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIButton.h" #include "UIBtnHint.h" -#include "UICursor.h" -#include "ui_base.h" +#include "Cursor/UICursor.h" #include "xrEngine/xr_input.h" -#include "xr_level_controller.h" +#include "Windows/UIWindow.h" +#include "xrEngine/xr_input_xinput.h" #define PUSH_OFFSET_RIGHT 1 #define PUSH_OFFSET_DOWN 1 diff --git a/src/xrGame/ui/UIButton.h b/src/xrUICore/Buttons/UIButton.h similarity index 95% rename from src/xrGame/ui/UIButton.h rename to src/xrUICore/Buttons/UIButton.h index 4694b661890..9c9c7c48ac4 100644 --- a/src/xrGame/ui/UIButton.h +++ b/src/xrUICore/Buttons/UIButton.h @@ -1,8 +1,7 @@ #pragma once +#include "xrUICore/Static/UIStatic.h" -#include "UIStatic.h" - -class CUIButton : public CUIStatic +class XRUICORE_API CUIButton : public CUIStatic { private: typedef CUIStatic inherited; diff --git a/src/xrGame/ui/UIButton_script.cpp b/src/xrUICore/Buttons/UIButton_script.cpp similarity index 92% rename from src/xrGame/ui/UIButton_script.cpp rename to src/xrUICore/Buttons/UIButton_script.cpp index 5d905e88bd9..6a1d69faef5 100644 --- a/src/xrGame/ui/UIButton_script.cpp +++ b/src/xrUICore/Buttons/UIButton_script.cpp @@ -1,11 +1,10 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIButton.h" #include "UI3tButton.h" #include "UICheckButton.h" -#include "UIRadioButton.h" -#include "UISpinNum.h" -#include "UISpinText.h" -#include "UITrackBar.h" +#include "SpinBox/UISpinNum.h" +#include "SpinBox/UISpinText.h" +#include "TrackBar/UITrackBar.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; diff --git a/src/xrGame/ui/UICheckButton.cpp b/src/xrUICore/Buttons/UICheckButton.cpp similarity index 93% rename from src/xrGame/ui/UICheckButton.cpp rename to src/xrUICore/Buttons/UICheckButton.cpp index 71f21343eb2..b9e60c3cd5a 100644 --- a/src/xrGame/ui/UICheckButton.cpp +++ b/src/xrUICore/Buttons/UICheckButton.cpp @@ -2,11 +2,11 @@ // с галочкой и без ////////////////////////////////////////////////////////////////////// -#include "stdafx.h" -#include ".\uicheckbutton.h" -#include "UIXmlInit.h" -#include "UIHint.h" +#include "pch.hpp" +#include "UICheckButton.h" +#include "Hint/UIHint.h" #include "xrEngine/xr_input.h" +#include "xrEngine/xr_input_xinput.h" CUICheckButton::CUICheckButton() { @@ -25,7 +25,6 @@ void CUICheckButton::Update() void CUICheckButton::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); SetCheck(GetOptBoolValue()); } @@ -37,7 +36,6 @@ void CUICheckButton::SaveOptValue() void CUICheckButton::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = GetCheck(); } diff --git a/src/xrGame/ui/UICheckButton.h b/src/xrUICore/Buttons/UICheckButton.h similarity index 87% rename from src/xrGame/ui/UICheckButton.h rename to src/xrUICore/Buttons/UICheckButton.h index f37c18d6691..1036ff3abfd 100644 --- a/src/xrGame/ui/UICheckButton.h +++ b/src/xrUICore/Buttons/UICheckButton.h @@ -1,11 +1,10 @@ #pragma once - -#include "ui3tbutton.h" -#include "UIOptionsItem.h" +#include "xrUICore/Buttons/UI3tButton.h" +#include "xrUICore/Options/UIOptionsItem.h" class UIHint; -class CUICheckButton : public CUI3tButton, public CUIOptionsItem +class XRUICORE_API CUICheckButton : public CUI3tButton, public CUIOptionsItem { typedef CUI3tButton inherited; diff --git a/src/xrGame/ui/UIRadioButton.cpp b/src/xrUICore/Buttons/UIRadioButton.cpp similarity index 89% rename from src/xrGame/ui/UIRadioButton.cpp rename to src/xrUICore/Buttons/UIRadioButton.cpp index 884925487bc..947708bd4c0 100644 --- a/src/xrGame/ui/UIRadioButton.cpp +++ b/src/xrUICore/Buttons/UIRadioButton.cpp @@ -1,6 +1,6 @@ -#include "stdafx.h" -#include ".\uiradiobutton.h" -#include "UILines.h" +#include "pch.hpp" +#include "UIRadioButton.h" +#include "Lines/UILines.h" void CUIRadioButton::InitButton(Fvector2 pos, Fvector2 size) { diff --git a/src/xrGame/ui/UIRadioButton.h b/src/xrUICore/Buttons/UIRadioButton.h similarity index 85% rename from src/xrGame/ui/UIRadioButton.h rename to src/xrUICore/Buttons/UIRadioButton.h index 9b30d7b539e..63a1cc9649e 100644 --- a/src/xrGame/ui/UIRadioButton.h +++ b/src/xrUICore/Buttons/UIRadioButton.h @@ -1,7 +1,5 @@ #pragma once - -#pragma once -#include "UITabButton.h" +#include "xrUICore/TabControl/UITabButton.h" class CUIRadioButton : public CUITabButton { diff --git a/src/xrUICore/CMakeLists.txt b/src/xrUICore/CMakeLists.txt new file mode 100644 index 00000000000..c5b62c33eb2 --- /dev/null +++ b/src/xrUICore/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required(VERSION 3.8) + +project(xrUICore) + +file(GLOB ARROW arrow/*.h arrow/*.cpp) +file(GLOB BUTTONS Buttons/*.h Buttons/*.cpp) +file(GLOB CALLBACKS Callbacks/*.h Callbacks/*.cpp) +file(GLOB COMBO_BOX ComboBox/*.h ComboBox/*.cpp) +file(GLOB CURSOR Cursor/*.h Cursor/*.cpp) +file(GLOB EDIT_BOX EditBox/*.h EditBox/*.cpp) +file(GLOB FONT_MANAGER FontManager/*.h FontManager/*.cpp) +file(GLOB HINT Hint/*.h Hint/*.cpp) +file(GLOB INTERACTIVE_BACKGROUND InteractiveBackground/*.h InteractiveBackground/*.cpp) +file(GLOB LINES Lines/*.h Lines/*.cpp) +file(GLOB LIST_BOX ListBox/*.h ListBox/*.cpp) +file(GLOB MESSAGE_BOX MessageBox/*.h MessageBox/*.cpp) +file(GLOB OPTIONS Options/*.h Options/*.cpp) +set(PCH pch.cpp pch.hpp) +file(GLOB PROGRESS_BAR ProgressBar/*.h ProgressBar/*.cpp) +file(GLOB PROPERTIES_BOX PropertiesBox/*.h PropertiesBox/*.cpp) +file(GLOB SCROLL_BAR ScrollBar/*.h ScrollBar/*.cpp) +file(GLOB SCROLL_VIEW ScrollView/*.h ScrollView/*.cpp) +file(GLOB SPIN_BOX SpinBox/*.h SpinBox/*.cpp) +file(GLOB STATIC_WINDS Static/*.h Static/*.cpp) +file(GLOB TAB_CONTROL TabControl/*.h TabControl/*.cpp) +file(GLOB TRACK_BAR TrackBar/*.h TrackBar/*.cpp) +file(GLOB WINDOWS Windows/*.h Windows/*.cpp) +file(GLOB XML XML/*.h XML/*.cpp) +set(GENERAL ui_base.cpp ui_base.h ui_defs.h uiabstract.h UIMessages.h) + +###################################################### + +source_group("arrow" FILES ${ARROW}) +source_group("Buttons" FILES ${BUTTONS}) +source_group("Callbacks" FILES ${CALLBACKS}) +source_group("ComboBox" FILES ${COMBO_BOX}) +source_group("Cursor" FILES ${CURSOR}) +source_group("EditBox" FILES ${EDIT_BOX}) +source_group("FontManager" FILES ${FONT_MANAGER}) +source_group("Hint" FILES ${HINT}) +source_group("InteractiveBackground" FILES ${INTERACTIVE_BACKGROUND}) +source_group("Lines" FILES ${LINES}) +source_group("ListBox" FILES ${LIST_BOX}) +source_group("MessageBox" FILES ${MESSAGE_BOX}) +source_group("Options" FILES ${OPTIONS}) +source_group("PCH" FILES ${PCH}) +source_group("ProgressBar" FILES ${PROGRESS_BAR}) +source_group("PropertiesBox" FILES ${PROPERTIES_BOX}) +source_group("ScrollBar" FILES ${SCROLL_BAR}) +source_group("ScrollView" FILES ${SCROLL_VIEW}) +source_group("SpinBox" FILES ${SPIN_BOX}) +source_group("Static" FILES ${STATIC_WINDS}) +source_group("TabControl" FILES ${TAB_CONTROL}) +source_group("TrackBar" FILES ${TRACK_BAR}) +source_group("Windows" FILES ${WINDOWS}) +source_group("XML" FILES ${XML}) +source_group("" FILES ${GENERAL}) + +########################################## + +message("path " ${CMAKE_CURRENT_SOURCE_DIR}) + +add_definitions(-DXRUICORE_EXPORTS -D_SECURE_SCL=0) + +add_compile_options(/fp:fast "/Yupch.hpp") +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/pch.cpp PROPERTIES COMPILE_FLAGS /Yc) + +add_library(xrUICore SHARED ${ARROW} ${BUTTONS} ${CALLBACKS} + ${COMBO_BOX} ${CURSOR} + ${EDIT_BOX} ${FONT_MANAGER} ${HINT} + ${INTERACTIVE_BACKGROUND} ${LINES} ${LIST_BOX} + ${MESSAGE_BOX} ${OPTIONS} ${PCH} + ${PROGRESS_BAR} ${PROPERTIES_BOX} ${SCROLL_BAR} ${SCROLL_VIEW} ${SPIN_BOX} + ${STATIC_WINDS} ${TAB_CONTROL} ${TRACK_BAR} ${WINDOWS} ${XML} + ${GENERAL}) + +set_target_properties(xrUICore PROPERTIES PREFIX "") +target_include_directories(xrUICore PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ../../Externals/lzo/include) +target_link_libraries(xrUICore xrAPI pugixml xrScriptEngine LuaJIT xrEngine xrMiscMath xrCore luabind) diff --git a/src/xrGame/ui/UIWndCallback.cpp b/src/xrUICore/Callbacks/UIWndCallback.cpp similarity index 96% rename from src/xrGame/ui/UIWndCallback.cpp rename to src/xrUICore/Callbacks/UIWndCallback.cpp index 366a2fb562c..316a1bbb5f7 100644 --- a/src/xrGame/ui/UIWndCallback.cpp +++ b/src/xrUICore/Callbacks/UIWndCallback.cpp @@ -1,6 +1,6 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIWndCallback.h" -#include "UIWindow.h" +#include "Windows/UIWindow.h" #include "Common/object_broker.h" #include "callback_info.h" diff --git a/src/xrGame/ui/UIWndCallback.h b/src/xrUICore/Callbacks/UIWndCallback.h similarity index 95% rename from src/xrGame/ui/UIWndCallback.h rename to src/xrUICore/Callbacks/UIWndCallback.h index 555089dcdb0..ed8e5bbdc8f 100644 --- a/src/xrGame/ui/UIWndCallback.h +++ b/src/xrUICore/Callbacks/UIWndCallback.h @@ -6,7 +6,7 @@ struct SCallbackInfo; class CUIWindow; class shared_str; -class CUIWndCallback +class XRUICORE_API CUIWndCallback { public: typedef fastdelegate::FastDelegate2 void_function; diff --git a/src/xrGame/callback_info.h b/src/xrUICore/Callbacks/callback_info.h similarity index 78% rename from src/xrGame/callback_info.h rename to src/xrUICore/Callbacks/callback_info.h index 7196298b8cc..5ca3e3dd343 100644 --- a/src/xrGame/callback_info.h +++ b/src/xrUICore/Callbacks/callback_info.h @@ -1,9 +1,8 @@ #pragma once - -#include "script_callback_ex.h" +#include "xrScriptEngine/script_callback_ex.h" class CUIWindow; -struct SCallbackInfo +struct XRUICORE_API SCallbackInfo { CScriptCallbackEx m_callback; fastdelegate::FastDelegate2 m_cpp_callback; @@ -13,7 +12,7 @@ struct SCallbackInfo SCallbackInfo() : m_control_ptr(NULL), m_event(-1){}; }; -struct event_comparer +struct XRUICORE_API event_comparer { CUIWindow* pWnd; s16 evt; diff --git a/src/xrGame/ui/UIComboBox.cpp b/src/xrUICore/ComboBox/UIComboBox.cpp similarity index 92% rename from src/xrGame/ui/UIComboBox.cpp rename to src/xrUICore/ComboBox/UIComboBox.cpp index 62284a15230..6e5b830afc6 100644 --- a/src/xrGame/ui/UIComboBox.cpp +++ b/src/xrUICore/ComboBox/UIComboBox.cpp @@ -1,9 +1,9 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UIComboBox.h" -#include "UITextureMaster.h" -#include "UIScrollBar.h" -#include "uilistboxitem.h" -#include "string_table.h" +#include "XML/UITextureMaster.h" +#include "ScrollBar/UIScrollBar.h" +#include "ListBox/UIListBoxItem.h" +#include "xrEngine/StringTable/IStringTable.h" #include "xrCore/xr_token.h" #define CB_HEIGHT 20.0f @@ -118,28 +118,23 @@ void CUIComboBox::enable_id(int id) void CUIComboBox::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); - m_list_box.Clear(); const xr_token* tok = GetOptToken(); - - if (tok) + + R_ASSERT3(tok, "Option token doesnt exist:", m_entry.c_str()); + + while (tok->name) { - while (tok->name) + if (m_disabled.end() == std::find(m_disabled.begin(), m_disabled.end(), tok->id)) { - if (m_disabled.end() == std::find(m_disabled.begin(), m_disabled.end(), tok->id)) - { - AddItem_(tok->name, tok->id); - } - tok++; + AddItem_(tok->name, tok->id); } - - LPCSTR cur_val = *CStringTable().translate(GetOptTokenValue()); - m_text.SetText(cur_val); - m_list_box.SetSelectedText(cur_val); + tok++; } - else - m_text.SetText("-"); + + LPCSTR cur_val = *gStringTable->translate(GetOptTokenValue()); + m_text.SetText(cur_val); + m_list_box.SetSelectedText(cur_val); CUIListBoxItem* itm = m_list_box.GetSelectedItem(); if (itm) @@ -150,7 +145,6 @@ void CUIComboBox::SetCurrentOptValue() void CUIComboBox::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = m_itoken_id; } @@ -165,6 +159,7 @@ void CUIComboBox::UndoOptValue() void CUIComboBox::SaveOptValue() { CUIOptionsItem::SaveOptValue(); + const xr_token* tok = GetOptToken(); if (tok) { diff --git a/src/xrGame/ui/UIComboBox.h b/src/xrUICore/ComboBox/UIComboBox.h similarity index 83% rename from src/xrGame/ui/UIComboBox.h rename to src/xrUICore/ComboBox/UIComboBox.h index 8524b5804a5..816af8f37e3 100644 --- a/src/xrGame/ui/UIComboBox.h +++ b/src/xrUICore/ComboBox/UIComboBox.h @@ -1,16 +1,15 @@ #pragma once - -#include "UIEditBox.h" -#include "UIListBox.h" -#include "UIInteractiveBackground.h" -#include "UIOptionsItem.h" -#include "UIFrameWindow.h" +#include "xrUICore/EditBox/UIEditBox.h" +#include "xrUICore/ListBox/UIListBox.h" +#include "xrUICore/InteractiveBackground/UIInteractiveBackground.h" +#include "xrUICore/Options/UIOptionsItem.h" +#include "xrUICore/Windows/UIFrameWindow.h" class CUIListBoxItem; -class CUIComboBox : public CUIWindow, public CUIOptionsItem, public pureRender +class XRUICORE_API CUIComboBox : public CUIWindow, public CUIOptionsItem, public pureRender { - friend class CUIXmlInit; + friend class CUIXmlInitBase; typedef enum { LIST_EXPANDED, LIST_FONDED } E_COMBO_STATE; xr_vector m_disabled; diff --git a/src/xrGame/ui/UIComboBox_script.cpp b/src/xrUICore/ComboBox/UIComboBox_script.cpp similarity index 95% rename from src/xrGame/ui/UIComboBox_script.cpp rename to src/xrUICore/ComboBox/UIComboBox_script.cpp index b446808b520..cae7862171c 100644 --- a/src/xrGame/ui/UIComboBox_script.cpp +++ b/src/xrUICore/ComboBox/UIComboBox_script.cpp @@ -7,9 +7,9 @@ // Copyright 2004 GSC Game World // -#include "pch_script.h" +#include "pch.hpp" #include "UIComboBox.h" -#include "UIListBoxItem.h" +#include "ListBox\UIListBoxItem.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; diff --git a/src/xrGame/UICursor.cpp b/src/xrUICore/Cursor/UICursor.cpp similarity index 97% rename from src/xrGame/UICursor.cpp rename to src/xrUICore/Cursor/UICursor.cpp index c5f4cd751a8..0bdc38cb8eb 100644 --- a/src/xrGame/UICursor.cpp +++ b/src/xrUICore/Cursor/UICursor.cpp @@ -1,8 +1,8 @@ -#include "stdafx.h" +#include "pch.hpp" #include "uicursor.h" -#include "ui/UIStatic.h" -#include "ui/UIBtnHint.h" +#include "Static/UIStatic.h" +#include "Buttons/UIBtnHint.h" #include "xrEngine/IInputReceiver.h" #include "xrEngine/xr_input.h" @@ -131,6 +131,6 @@ void CUICursor::SetUICursorPosition(Fvector2 pos) POINT p; p.x = iFloor(vPos.x / (UI_BASE_WIDTH / (float)Device.m_rcWindowClient.w)); p.y = iFloor(vPos.y / (UI_BASE_HEIGHT / (float)Device.m_rcWindowClient.h)); - + SDL_WarpMouseInWindow(Device.m_sdlWnd, p.x, p.y); } diff --git a/src/xrGame/UICursor.h b/src/xrUICore/Cursor/UICursor.h similarity index 85% rename from src/xrGame/UICursor.h rename to src/xrUICore/Cursor/UICursor.h index 2b24a1dc1a0..9fba3196a1c 100644 --- a/src/xrGame/UICursor.h +++ b/src/xrUICore/Cursor/UICursor.h @@ -1,9 +1,8 @@ #pragma once -#include "ui_base.h" class CUIStatic; -class CUICursor : public pureRender, public pureScreenResolutionChanged +class XRUICORE_API CUICursor : public pureRender, public pureScreenResolutionChanged { bool bVisible; Fvector2 vPos; diff --git a/src/xrGame/ui/UICustomEdit.cpp b/src/xrUICore/EditBox/UICustomEdit.cpp similarity index 99% rename from src/xrGame/ui/UICustomEdit.cpp rename to src/xrUICore/EditBox/UICustomEdit.cpp index 6008c24a73e..e3b68471f68 100644 --- a/src/xrGame/ui/UICustomEdit.cpp +++ b/src/xrUICore/EditBox/UICustomEdit.cpp @@ -1,8 +1,6 @@ -#include "stdafx.h" - +#include "pch.hpp" #include "UICustomEdit.h" -#include "UILines.h" - +#include "Lines/UILines.h" #include "xrEngine/line_edit_control.h" #include "xrEngine/xr_input.h" diff --git a/src/xrGame/ui/UICustomEdit.h b/src/xrUICore/EditBox/UICustomEdit.h similarity index 95% rename from src/xrGame/ui/UICustomEdit.h rename to src/xrUICore/EditBox/UICustomEdit.h index 4348bfaae20..81c4067969f 100644 --- a/src/xrGame/ui/UICustomEdit.h +++ b/src/xrUICore/EditBox/UICustomEdit.h @@ -1,7 +1,5 @@ - #pragma once - -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" namespace text_editor { @@ -9,7 +7,7 @@ class ENGINE_API line_edit_control; enum init_mode; }; -class CUICustomEdit : public CUIStatic +class XRUICORE_API CUICustomEdit : public CUIStatic { private: typedef CUIStatic inherited; diff --git a/src/xrGame/ui/UIEditBox.cpp b/src/xrUICore/EditBox/UIEditBox.cpp similarity index 91% rename from src/xrGame/ui/UIEditBox.cpp rename to src/xrUICore/EditBox/UIEditBox.cpp index 82a3c9f0d01..a5b20b05c6a 100644 --- a/src/xrGame/ui/UIEditBox.cpp +++ b/src/xrUICore/EditBox/UIEditBox.cpp @@ -2,9 +2,9 @@ // ////////////////////////////////////////////////////////////////////// -#include "stdafx.h" +#include "pch.hpp" #include "uieditbox.h" -#include "UIFrameLineWnd.h" +#include "Windows/UIFrameLineWnd.h" CUIEditBox::CUIEditBox() : m_frameLine(NULL) {} void CUIEditBox::InitCustomEdit(Fvector2 pos, Fvector2 size) @@ -33,7 +33,6 @@ void CUIEditBox::InitTextureEx(LPCSTR texture, LPCSTR shader) void CUIEditBox::InitTexture(LPCSTR texture) { InitTextureEx(texture, "hud\\default"); } void CUIEditBox::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); SetText(GetOptStringValue()); } @@ -45,7 +44,6 @@ void CUIEditBox::SaveOptValue() void CUIEditBox::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = GetText(); } diff --git a/src/xrGame/ui/UIEditBox.h b/src/xrUICore/EditBox/UIEditBox.h similarity index 79% rename from src/xrGame/ui/UIEditBox.h rename to src/xrUICore/EditBox/UIEditBox.h index 912a6655e83..1d864893174 100644 --- a/src/xrGame/ui/UIEditBox.h +++ b/src/xrUICore/EditBox/UIEditBox.h @@ -1,10 +1,10 @@ #pragma once +#include "xrUICore/Options/UIOptionsItem.h" +#include "xrUICore/EditBox/UICustomEdit.h" -#include "UIOptionsItem.h" -#include "UICustomEdit.h" class CUIFrameLineWnd; -class CUIEditBox : public CUIOptionsItem, public CUICustomEdit +class XRUICORE_API CUIEditBox : public CUIOptionsItem, public CUICustomEdit { public: CUIEditBox(); diff --git a/src/xrGame/ui/UIEditBoxEx.cpp b/src/xrUICore/EditBox/UIEditBoxEx.cpp similarity index 92% rename from src/xrGame/ui/UIEditBoxEx.cpp rename to src/xrUICore/EditBox/UIEditBoxEx.cpp index 0ea980c3710..5cc16e5fbaf 100644 --- a/src/xrGame/ui/UIEditBoxEx.cpp +++ b/src/xrUICore/EditBox/UIEditBoxEx.cpp @@ -1,7 +1,6 @@ -#include "stdafx.h" - +#include "pch.hpp" #include "UIEditBoxEx.h" -#include "UIFrameWindow.h" +#include "Windows/UIFrameWindow.h" CUIEditBoxEx::CUIEditBoxEx() { diff --git a/src/xrGame/ui/UIEditBoxEx.h b/src/xrUICore/EditBox/UIEditBoxEx.h similarity index 77% rename from src/xrGame/ui/UIEditBoxEx.h rename to src/xrUICore/EditBox/UIEditBoxEx.h index cb7a01fdfc5..842f1060ad0 100644 --- a/src/xrGame/ui/UIEditBoxEx.h +++ b/src/xrUICore/EditBox/UIEditBoxEx.h @@ -1,10 +1,9 @@ #pragma once - -#include "UICustomEdit.h" +#include "xrUICore/EditBox/UICustomEdit.h" class CUIFrameWindow; -class CUIEditBoxEx : /*public CUIMultiTextureOwner, */ public CUICustomEdit +class CUIEditBoxEx : public CUICustomEdit { public: CUIEditBoxEx(); diff --git a/src/xrUICore/EditBox/UIEditBox_script.cpp b/src/xrUICore/EditBox/UIEditBox_script.cpp new file mode 100644 index 00000000000..6fe6621efeb --- /dev/null +++ b/src/xrUICore/EditBox/UIEditBox_script.cpp @@ -0,0 +1,20 @@ +#include "pch.hpp" +#include "UIEditBox.h" +#include "xrScriptEngine/ScriptExporter.hpp" + +using namespace luabind; + +SCRIPT_EXPORT(CUIEditBox, (CUIWindow), { + module(luaState) + [ + class_("CUICustomEdit") + .def("SetText", &CUICustomEdit::SetText) + .def("GetText", &CUICustomEdit::GetText) + .def("CaptureFocus", &CUICustomEdit::CaptureFocus) + .def("SetNextFocusCapturer", &CUICustomEdit::SetNextFocusCapturer), + + class_("CUIEditBox") + .def(constructor<>()) + .def("InitTexture", &CUIEditBox::InitTexture) + ]; +}); diff --git a/src/xrUICore/FontManager/FontManager.cpp b/src/xrUICore/FontManager/FontManager.cpp new file mode 100644 index 00000000000..231bf8a6d9a --- /dev/null +++ b/src/xrUICore/FontManager/FontManager.cpp @@ -0,0 +1,101 @@ +#include "pch.hpp" +#include "FontManager.h" +#include "xrEngine/GameFont.h" + +CFontManager::CFontManager() +{ + Device.seqDeviceReset.Add(this, REG_PRIORITY_HIGH); + + m_all_fonts.push_back(&pFontMedium); // used cpp + m_all_fonts.push_back(&pFontDI); // used cpp + m_all_fonts.push_back(&pFontArial14); // used xml + m_all_fonts.push_back(&pFontGraffiti19Russian); + m_all_fonts.push_back(&pFontGraffiti22Russian); + m_all_fonts.push_back(&pFontLetterica16Russian); + m_all_fonts.push_back(&pFontLetterica18Russian); + m_all_fonts.push_back(&pFontGraffiti32Russian); + m_all_fonts.push_back(&pFontGraffiti50Russian); + m_all_fonts.push_back(&pFontLetterica25); + m_all_fonts.push_back(&pFontStat); + + FONTS_VEC_IT it = m_all_fonts.begin(); + FONTS_VEC_IT it_e = m_all_fonts.end(); + for (; it != it_e; ++it) + (**it) = NULL; + + InitializeFonts(); +} + +void CFontManager::InitializeFonts() +{ + InitializeFont(pFontMedium, "hud_font_medium"); + InitializeFont(pFontDI, "hud_font_di", CGameFont::fsGradient | CGameFont::fsDeviceIndependent); + InitializeFont(pFontArial14, "ui_font_arial_14"); + InitializeFont(pFontGraffiti19Russian, "ui_font_graffiti19_russian"); + InitializeFont(pFontGraffiti22Russian, "ui_font_graffiti22_russian"); + InitializeFont(pFontLetterica16Russian, "ui_font_letterica16_russian"); + InitializeFont(pFontLetterica18Russian, "ui_font_letterica18_russian"); + InitializeFont(pFontGraffiti32Russian, "ui_font_graff_32"); + InitializeFont(pFontGraffiti50Russian, "ui_font_graff_50"); + InitializeFont(pFontLetterica25, "ui_font_letter_25"); + InitializeFont(pFontStat, "stat_font", CGameFont::fsDeviceIndependent); + pFontStat->SetInterval(0.75f, 1.0f); +} + +LPCSTR CFontManager::GetFontTexName(LPCSTR section) +{ + constexpr pcstr tex_names[] = { "texture800", "texture", "texture1600" }; + int def_idx = 1; // default 1024x768 + int idx = def_idx; + + u32 h = Device.dwHeight; + + if (h <= 600) + idx = 0; + else if (h < 1024) + idx = 1; + else + idx = 2; + + while (idx >= 0) + { + if (pSettings->line_exist(section, tex_names[idx])) + return pSettings->r_string(section, tex_names[idx]); + --idx; + } + return pSettings->r_string(section, tex_names[def_idx]); +} + +void CFontManager::InitializeFont(CGameFont*& F, LPCSTR section, u32 flags) +{ + LPCSTR font_tex_name = GetFontTexName(section); + R_ASSERT(font_tex_name); + + LPCSTR sh_name = pSettings->r_string(section, "shader"); + if (!F) + F = new CGameFont(sh_name, font_tex_name, flags); + else + F->Initialize(sh_name, font_tex_name); + +#ifdef DEBUG + F->m_font_name = section; +#endif +} + +CFontManager::~CFontManager() +{ + Device.seqDeviceReset.Remove(this); + FONTS_VEC_IT it = m_all_fonts.begin(); + FONTS_VEC_IT it_e = m_all_fonts.end(); + for (; it != it_e; ++it) + xr_delete(**it); +} + +void CFontManager::Render() +{ + FONTS_VEC_IT it = m_all_fonts.begin(); + FONTS_VEC_IT it_e = m_all_fonts.end(); + for (; it != it_e; ++it) + (**it)->OnRender(); +} +void CFontManager::OnDeviceReset() { InitializeFonts(); } diff --git a/src/xrUICore/FontManager/FontManager.h b/src/xrUICore/FontManager/FontManager.h new file mode 100644 index 00000000000..af4af1aad0d --- /dev/null +++ b/src/xrUICore/FontManager/FontManager.h @@ -0,0 +1,33 @@ +#pragma once + + +struct XRUICORE_API CFontManager : public pureDeviceReset +{ + CFontManager(); + ~CFontManager(); + + typedef xr_vector FONTS_VEC; + typedef FONTS_VEC::iterator FONTS_VEC_IT; + FONTS_VEC m_all_fonts; + void Render(); + + // hud font + CGameFont* pFontMedium; + CGameFont* pFontDI; + + CGameFont* pFontArial14; + CGameFont* pFontGraffiti19Russian; + CGameFont* pFontGraffiti22Russian; + CGameFont* pFontLetterica16Russian; + CGameFont* pFontLetterica18Russian; + CGameFont* pFontGraffiti32Russian; + CGameFont* pFontGraffiti50Russian; + CGameFont* pFontLetterica25; + CGameFont* pFontStat; + + void InitializeFonts(); + void InitializeFont(CGameFont*& F, LPCSTR section, u32 flags = 0); + LPCSTR GetFontTexName(LPCSTR section); + + virtual void OnDeviceReset(); +}; diff --git a/src/xrGame/ui/UIHint.cpp b/src/xrUICore/Hint/UIHint.cpp similarity index 80% rename from src/xrGame/ui/UIHint.cpp rename to src/xrUICore/Hint/UIHint.cpp index c749fccd820..a971d29905a 100644 --- a/src/xrGame/ui/UIHint.cpp +++ b/src/xrUICore/Hint/UIHint.cpp @@ -5,14 +5,13 @@ // Description : UI Hint (for UIHintWindow) window class implementation //////////////////////////////////////////////////////////////////////////// -#include "stdafx.h" +#include "pch.hpp" #include "UIHint.h" -#include "UIStatic.h" -#include "UIFrameWindow.h" -#include "UIXmlInit.h" -#include "UIHelper.h" -#include "string_table.h" +#include "Static/UIStatic.h" +#include "Windows/UIFrameWindow.h" +#include "XML/UIXmlInitBase.h" +#include "xrEngine/StringTable/IStringTable.h" UIHint::UIHint() { @@ -22,14 +21,22 @@ UIHint::UIHint() void UIHint::init_from_xml(CUIXml& xml, LPCSTR path) { - CUIXmlInit::InitWindow(xml, path, 0, this); + CUIXmlInitBase::InitWindow(xml, path, 0, this); XML_NODE stored_root = xml.GetLocalRoot(); XML_NODE new_root = xml.NavigateToNode(path, 0); xml.SetLocalRoot(new_root); - m_background = UIHelper::CreateFrameWindow(xml, "background", this); - m_text = UIHelper::CreateTextWnd(xml, "text", this); + m_background = new CUIFrameWindow(); + AttachChild(m_background); + m_background->SetAutoDelete(true); + CUIXmlInitBase::InitFrameWindow(xml, "background", 0, m_background); + + m_text = new CUITextWnd(); + AttachChild(m_text); + m_text->SetAutoDelete(true); + CUIXmlInitBase::InitTextWnd(xml, "text", 0, m_text); + m_border = xml.ReadAttribFlt("background", 0, "border", 0.0f); xml.SetLocalRoot(stored_root); @@ -95,7 +102,11 @@ void UIHintWindow::set_hint_text(shared_str const& text) } } -void UIHintWindow::set_hint_text_ST(shared_str const& text) { set_hint_text(CStringTable().translate(text)); } +void UIHintWindow::set_hint_text_ST(shared_str const& text) +{ + set_hint_text(gStringTable->translate(text)); +} + void UIHintWindow::update_hint_text() { if (!m_bCursorOverWindow || !m_hint_text.size() || !m_enable) diff --git a/src/xrGame/ui/UIHint.h b/src/xrUICore/Hint/UIHint.h similarity index 93% rename from src/xrGame/ui/UIHint.h rename to src/xrUICore/Hint/UIHint.h index bd1a9ff98e4..b9d223bc5b9 100644 --- a/src/xrGame/ui/UIHint.h +++ b/src/xrUICore/Hint/UIHint.h @@ -8,14 +8,14 @@ #ifndef UI_HINT_H_INCLUDED #define UI_HINT_H_INCLUDED -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUIStatic; class CUITextWnd; class CUIFrameWindow; class CUIXml; -class UIHint : public CUIWindow +class XRUICORE_API UIHint : public CUIWindow { private: typedef CUIWindow inherited; @@ -47,7 +47,7 @@ class UIHint : public CUIWindow // ================================================================================================= // UIHintWindow = Owner of UIHint -class UIHintWindow : public CUIWindow +class XRUICORE_API UIHintWindow : public CUIWindow { typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIInteractiveBackground.h b/src/xrUICore/InteractiveBackground/UIInteractiveBackground.h similarity index 95% rename from src/xrGame/ui/UIInteractiveBackground.h rename to src/xrUICore/InteractiveBackground/UIInteractiveBackground.h index f13c530a5bd..9c9054651d3 100644 --- a/src/xrGame/ui/UIInteractiveBackground.h +++ b/src/xrUICore/InteractiveBackground/UIInteractiveBackground.h @@ -12,9 +12,9 @@ #pragma once -#include "UIFrameWindow.h" -#include "UIWindow.h" -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" enum IBState { diff --git a/src/xrGame/ui/UI_IB_Static.cpp b/src/xrUICore/InteractiveBackground/UI_IB_Static.cpp similarity index 96% rename from src/xrGame/ui/UI_IB_Static.cpp rename to src/xrUICore/InteractiveBackground/UI_IB_Static.cpp index 247505536e0..9a18f42a7a1 100644 --- a/src/xrGame/ui/UI_IB_Static.cpp +++ b/src/xrUICore/InteractiveBackground/UI_IB_Static.cpp @@ -7,7 +7,7 @@ // Copyright 2005 GSC Game World -#include "StdAfx.h" +#include "pch.hpp" #include "UI_IB_Static.h" void CUI_IB_Static::SetTextureOffset(float x, float y) diff --git a/src/xrGame/ui/UI_IB_Static.h b/src/xrUICore/InteractiveBackground/UI_IB_Static.h similarity index 80% rename from src/xrGame/ui/UI_IB_Static.h rename to src/xrUICore/InteractiveBackground/UI_IB_Static.h index 440df94a6c0..e15558d2521 100644 --- a/src/xrGame/ui/UI_IB_Static.h +++ b/src/xrUICore/InteractiveBackground/UI_IB_Static.h @@ -8,9 +8,8 @@ // Copyright 2005 GSC Game World #pragma once - -#include "UIInteractiveBackground.h" -#include "UIStatic.h" +#include "xrUICore/InteractiveBackground/UIInteractiveBackground.h" +#include "xrUICore/Static/UIStatic.h" class CUI_IB_Static : public CUIInteractiveBackground { diff --git a/src/xrGame/ui/UILine.cpp b/src/xrUICore/Lines/UILine.cpp similarity index 73% rename from src/xrGame/ui/UILine.cpp rename to src/xrUICore/Lines/UILine.cpp index 337e2a09bd0..023b8e3f129 100644 --- a/src/xrGame/ui/UILine.cpp +++ b/src/xrUICore/Lines/UILine.cpp @@ -6,74 +6,26 @@ // // Copyright 2005 GSC Game World -#include "StdAfx.h" +#include "pch.hpp" #include "UILine.h" #include "uilinestd.h" #include "ui_base.h" #include "xrEngine/GameFont.h" -//#define LOG_ALL_LINES -#ifdef LOG_ALL_LINES -int ListLinesCount = 0; -struct DBGList -{ - CUILine* wnd; - int num; -}; -xr_vector dbg_list_lines; -void dump_list_lines() -{ - Msg("------Total Lines %d", dbg_list_lines.size()); - xr_vector::iterator _it = dbg_list_lines.begin(); - for (; _it != dbg_list_lines.end(); ++_it) - Msg("--leak detected ---- Line = %d", (*_it).num); -} -#else -void dump_list_lines() {} -#endif - CUILine::CUILine() { m_tmpLine = NULL; -#ifdef LOG_ALL_LINES - ListLinesCount++; - dbg_list_lines.push_back(DBGList()); - dbg_list_lines.back().wnd = this; - dbg_list_lines.back().num = ListLinesCount; -#endif } CUILine::~CUILine() { xr_delete(m_tmpLine); - -#ifdef LOG_ALL_LINES - xr_vector::iterator _it = dbg_list_lines.begin(); - bool bOK = false; - for (; _it != dbg_list_lines.end(); ++_it) - { - if ((*_it).wnd == this) - { - bOK = true; - dbg_list_lines.erase(_it); - break; - } - } - if (!bOK) - Msg("CUILine::~CUILine()!!!!!!!!!!!!!!!!!!!!!!! cannot find window in list"); -#endif } CUILine::CUILine(const CUILine& other) { m_subLines = other.m_subLines; m_tmpLine = NULL; -#ifdef LOG_ALL_LINES - ListLinesCount++; - dbg_list_lines.push_back(DBGList()); - dbg_list_lines.back().wnd = this; - dbg_list_lines.back().num = ListLinesCount; -#endif } CUILine& CUILine::operator=(const CUILine& other) diff --git a/src/xrGame/ui/UILine.h b/src/xrUICore/Lines/UILine.h similarity index 99% rename from src/xrGame/ui/UILine.h rename to src/xrUICore/Lines/UILine.h index 7e27cadf5a4..9e7ba94e873 100644 --- a/src/xrGame/ui/UILine.h +++ b/src/xrUICore/Lines/UILine.h @@ -7,7 +7,6 @@ // Copyright 2005 GSC Game World #pragma once - #include "UISubLine.h" class Word diff --git a/src/xrGame/ui/UILines.cpp b/src/xrUICore/Lines/UILines.cpp similarity index 97% rename from src/xrGame/ui/UILines.cpp rename to src/xrUICore/Lines/UILines.cpp index 66662af0a3d..007e23ea3d0 100644 --- a/src/xrGame/ui/UILines.cpp +++ b/src/xrUICore/Lines/UILines.cpp @@ -6,12 +6,11 @@ // // Copyright 2005 GSC Game World -#include "StdAfx.h" - +#include "pch.hpp" #include "UILines.h" -#include "UIXmlInit.h" +#include "XML/UIXmlInitBase.h" #include "uilinestd.h" -#include "string_table.h" +#include "xrEngine/StringTable/IStringTable.h" #include "xrCore/Text/StringConversion.hpp" CUILines::CUILines() @@ -70,7 +69,7 @@ void CUILines::SetText(const char* text) Reset(); } } -void CUILines::SetTextST(LPCSTR str_id) { SetText(*CStringTable().translate(str_id)); } +void CUILines::SetTextST(LPCSTR str_id) { SetText(*gStringTable->translate(str_id)); } LPCSTR CUILines::GetText() { return m_text.c_str(); } void CUILines::Reset() { m_lines.clear(); } float get_str_width(CGameFont* pFont, char ch) @@ -447,8 +446,8 @@ u32 CUILines::GetColorFromText(const xr_string& str) const return m_dwTextColor; // Try predefined in XML colors - for (CUIXmlInit::ColorDefs::const_iterator it = CUIXmlInit::GetColorDefs()->begin(); - it != CUIXmlInit::GetColorDefs()->end(); ++it) + for (CUIXmlInitBase::ColorDefs::const_iterator it = CUIXmlInitBase::GetColorDefs()->begin(); + it != CUIXmlInitBase::GetColorDefs()->end(); ++it) { int cmp = str.compare(begin + 3, end - begin - 3, *it->first); if (cmp == 0) diff --git a/src/xrGame/ui/UILines.h b/src/xrUICore/Lines/UILines.h similarity index 94% rename from src/xrGame/ui/UILines.h rename to src/xrUICore/Lines/UILines.h index 43612ed7ac0..4ad0634eb34 100644 --- a/src/xrGame/ui/UILines.h +++ b/src/xrUICore/Lines/UILines.h @@ -1,12 +1,10 @@ #pragma once +#include "xrUICore/Lines/UILine.h" +#include "xrUICore/uiabstract.h" -#include "UILine.h" -#include "uiabstract.h" - -class CUILines : public CDeviceResetNotifier +class XRUICORE_API CUILines : public CDeviceResetNotifier { friend class CUICustomEdit; - friend class CUICDkey; public: CUILines(); @@ -41,6 +39,7 @@ class CUILines : public CDeviceResetNotifier void Reset(); void ParseText(bool force = false); float GetVisibleHeight(); + float GetIndentByAlign() const; Fvector2 m_TextOffset; Fvector2 m_wndSize; @@ -49,7 +48,6 @@ class CUILines : public CDeviceResetNotifier protected: // %c[255,255,255,255] u32 GetColorFromText(const xr_string& str) const; - float GetIndentByAlign() const; float GetVIndentByAlign(); void CutFirstColoredTextEntry(xr_string& entry, u32& color, xr_string& text) const; CUILine* ParseTextToColoredLine(const xr_string& str); diff --git a/src/xrGame/ui/UISubLine.cpp b/src/xrUICore/Lines/UISubLine.cpp similarity index 52% rename from src/xrGame/ui/UISubLine.cpp rename to src/xrUICore/Lines/UISubLine.cpp index 9bc6fa88188..eabbad9365f 100644 --- a/src/xrGame/ui/UISubLine.cpp +++ b/src/xrUICore/Lines/UISubLine.cpp @@ -6,44 +6,18 @@ // // Copyright 2005 GSC Game World -#include "StdAfx.h" +#include "pch.hpp" #include "UISubLine.h" #include "uilinestd.h" #include "ui_base.h" #include "xrEngine/GameFont.h" -//#define LOG_ALL_LINES -#ifdef LOG_ALL_LINES -int ListSubLinesCount = 0; -struct DBGList -{ - CUISubLine* wnd; - int num; -}; -xr_vector dbg_list_sublines; -void dump_list_sublines() -{ - Msg("------Total SubLines %d", dbg_list_sublines.size()); - xr_vector::iterator _it = dbg_list_sublines.begin(); - for (; _it != dbg_list_sublines.end(); ++_it) - Msg("--leak detected ---- SubLine = %d", (*_it).num); -} -#else -void dump_list_sublines() {} -#endif - CUISubLine::CUISubLine(const CUISubLine& other) { m_color = other.m_color; m_last_in_line = other.m_last_in_line; m_text = other.m_text; m_pTempLine = NULL; -#ifdef LOG_ALL_LINES - ListSubLinesCount++; - dbg_list_sublines.push_back(DBGList()); - dbg_list_sublines.back().wnd = this; - dbg_list_sublines.back().num = ListSubLinesCount; -#endif } CUISubLine& CUISubLine::operator=(const CUISubLine& other) @@ -57,32 +31,11 @@ CUISubLine& CUISubLine::operator=(const CUISubLine& other) CUISubLine::CUISubLine() : m_color(0), m_pTempLine(NULL), m_last_in_line(false) { -#ifdef LOG_ALL_LINES - ListSubLinesCount++; - dbg_list_sublines.push_back(DBGList()); - dbg_list_sublines.back().wnd = this; - dbg_list_sublines.back().num = ListSubLinesCount; -#endif } CUISubLine::~CUISubLine() { xr_delete(m_pTempLine); -#ifdef LOG_ALL_LINES - xr_vector::iterator _it = dbg_list_sublines.begin(); - bool bOK = false; - for (; _it != dbg_list_sublines.end(); ++_it) - { - if ((*_it).wnd == this) - { - bOK = true; - dbg_list_sublines.erase(_it); - break; - } - } - if (!bOK) - Msg("CUISubLine::~CUISubLine()!!!!!!!!!!!!!!!!!!!!!!! cannot find window in list"); -#endif } const CUISubLine* CUISubLine::Cut2Pos(int i) diff --git a/src/xrGame/ui/UISubLine.h b/src/xrUICore/Lines/UISubLine.h similarity index 100% rename from src/xrGame/ui/UISubLine.h rename to src/xrUICore/Lines/UISubLine.h diff --git a/src/xrGame/ui/uilinestd.h b/src/xrUICore/Lines/uilinestd.h similarity index 79% rename from src/xrGame/ui/uilinestd.h rename to src/xrUICore/Lines/uilinestd.h index d5ee7fa2faa..64daceec134 100644 --- a/src/xrGame/ui/uilinestd.h +++ b/src/xrUICore/Lines/uilinestd.h @@ -2,6 +2,5 @@ typedef xr_string::size_type StrSize; #define BEGIN "%c[" #define END "]" -//#define xr_string::npos npos const StrSize npos = (StrSize)xr_string::npos; diff --git a/src/xrGame/ui/UIListBox.cpp b/src/xrUICore/ListBox/UIListBox.cpp similarity index 97% rename from src/xrGame/ui/UIListBox.cpp rename to src/xrUICore/ListBox/UIListBox.cpp index f9f187f2d36..b853306310e 100644 --- a/src/xrGame/ui/UIListBox.cpp +++ b/src/xrUICore/ListBox/UIListBox.cpp @@ -1,8 +1,9 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIListBox.h" #include "UIListBoxItem.h" -#include "UIScrollBar.h" -#include "UIStatic.h" +#include "ScrollBar/UIScrollBar.h" +#include "Static/UIStatic.h" +#include "xrEngine/StringTable/IStringTable.h" CUIListBox::CUIListBox() { @@ -38,14 +39,13 @@ bool CUIListBox::OnMouseAction(float x, float y, EUIMessages mouse_action) return false; } -#include "string_table.h" CUIListBoxItem* CUIListBox::AddTextItem(LPCSTR text) { CUIListBoxItem* pItem = AddItem(); pItem->SetWndSize(Fvector2().set(GetDesiredChildWidth(), m_def_item_height)); pItem->SetTextColor(m_text_color); - pItem->SetText(CStringTable().translate(text).c_str()); + pItem->SetText(gStringTable->translate(text).c_str()); pItem->GetTextItem()->SetWidth(GetDesiredChildWidth()); return pItem; } diff --git a/src/xrGame/ui/UIListBox.h b/src/xrUICore/ListBox/UIListBox.h similarity index 93% rename from src/xrGame/ui/UIListBox.h rename to src/xrUICore/ListBox/UIListBox.h index 14ae135aeff..ef980eeb4f1 100644 --- a/src/xrGame/ui/UIListBox.h +++ b/src/xrUICore/ListBox/UIListBox.h @@ -1,10 +1,9 @@ #pragma once - -#include "UIScrollView.h" +#include "xrUICore/ScrollView/UIScrollView.h" class CUIListBoxItem; -class CUIListBox : public CUIScrollView +class XRUICORE_API CUIListBox : public CUIScrollView { public: CUIListBox(); diff --git a/src/xrGame/ui/UIListBoxItem.cpp b/src/xrUICore/ListBox/UIListBoxItem.cpp similarity index 95% rename from src/xrGame/ui/UIListBoxItem.cpp rename to src/xrUICore/ListBox/UIListBoxItem.cpp index c5fcf18acd3..363f9ad8b33 100644 --- a/src/xrGame/ui/UIListBoxItem.cpp +++ b/src/xrUICore/ListBox/UIListBoxItem.cpp @@ -1,8 +1,9 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UIListBoxItem.h" -#include "UIScrollView.h" +#include "ScrollView/UIScrollView.h" #include "Common/object_broker.h" -#include "UIStatic.h" +#include "Static/UIStatic.h" +#include "xrEngine/xr_input_xinput.h" CUIListBoxItem::CUIListBoxItem(float height) : m_text(NULL), tag(u32(-1)) { diff --git a/src/xrGame/ui/UIListBoxItem.h b/src/xrUICore/ListBox/UIListBoxItem.h similarity index 86% rename from src/xrGame/ui/UIListBoxItem.h rename to src/xrUICore/ListBox/UIListBoxItem.h index 19779a37c01..cef7d8016ad 100644 --- a/src/xrGame/ui/UIListBoxItem.h +++ b/src/xrUICore/ListBox/UIListBoxItem.h @@ -1,10 +1,10 @@ #pragma once -#include "UIFrameLineWnd.h" +#include "xrUICore/Windows/UIFrameLineWnd.h" class CUITextWnd; class CUIStatic; -class CUIListBoxItem : public CUIFrameLineWnd, public CUISelectable +class XRUICORE_API CUIListBoxItem : public CUIFrameLineWnd, public CUISelectable { typedef CUIFrameLineWnd inherited; diff --git a/src/xrGame/ui/UIListBoxItemMsgChain.cpp b/src/xrUICore/ListBox/UIListBoxItemMsgChain.cpp similarity index 76% rename from src/xrGame/ui/UIListBoxItemMsgChain.cpp rename to src/xrUICore/ListBox/UIListBoxItemMsgChain.cpp index 934623bffd7..33a6895c762 100644 --- a/src/xrGame/ui/UIListBoxItemMsgChain.cpp +++ b/src/xrUICore/ListBox/UIListBoxItemMsgChain.cpp @@ -1,6 +1,5 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIListBoxItemMsgChain.h" -#include "UIScrollView.h" bool CUIListBoxItemMsgChain::OnMouseDown(int mouse_btn) { diff --git a/src/xrGame/ui/UIListBoxItemMsgChain.h b/src/xrUICore/ListBox/UIListBoxItemMsgChain.h similarity index 100% rename from src/xrGame/ui/UIListBoxItemMsgChain.h rename to src/xrUICore/ListBox/UIListBoxItemMsgChain.h diff --git a/src/xrUICore/ListBox/UIListBox_script.cpp b/src/xrUICore/ListBox/UIListBox_script.cpp new file mode 100644 index 00000000000..506b59d72b1 --- /dev/null +++ b/src/xrUICore/ListBox/UIListBox_script.cpp @@ -0,0 +1,77 @@ +#include "pch.hpp" +#include "UIListBox.h" +#include "UIListBoxItem.h" +#include "UIListBoxItemMsgChain.h" +#include "SpinBox/UISpinText.h" +#include "ComboBox/UIComboBox.h" +#include "xrScriptEngine/ScriptExporter.hpp" + +using namespace luabind; +using namespace luabind::policy; + +struct CUIListBoxItemWrapper : public CUIListBoxItem, public luabind::wrap_base +{ + CUIListBoxItemWrapper(float h) : CUIListBoxItem(h) {} +}; + +struct CUIListBoxItemMsgChainWrapper : public CUIListBoxItemMsgChain, public luabind::wrap_base +{ + CUIListBoxItemMsgChainWrapper(float h) : CUIListBoxItemMsgChain(h) {} +}; + +// clang-format off +SCRIPT_EXPORT(CUIListBox, (CUIScrollView), { + module(luaState) + [ + class_("CUIListBox") + .def(constructor<>()) + .def("ShowSelectedItem", &CUIListBox::Show) + .def("RemoveAll", &CUIListBox::Clear) + .def("GetSize", &CUIListBox::GetSize) + .def("GetSelectedItem", &CUIListBox::GetSelectedItem) + .def("GetSelectedIndex", &CUIListBox::GetSelectedIDX) + .def("SetSelectedIndex", &CUIListBox::SetSelectedIDX) + .def("SetItemHeight", &CUIListBox::SetItemHeight) + .def("GetItemHeight", &CUIListBox::GetItemHeight) + .def("GetItemByIndex", &CUIListBox::GetItemByIDX) + .def("GetItem", &CUIListBox::GetItem) + .def("RemoveItem", &CUIListBox::RemoveWindow) + .def("AddTextItem", &CUIListBox::AddTextItem) + .def("AddExistingItem", &CUIListBox::AddExistingItem, adopt<2>()) + ]; +}); + +SCRIPT_EXPORT(CUIListBoxItem, (CUIFrameLineWnd), { + module(luaState) + [ + class_("CUIListBoxItem") + .def(constructor()) + .def("GetTextItem", &CUIListBoxItem::GetTextItem) + .def("AddTextField", &CUIListBoxItem::AddTextField) + .def("AddIconField", &CUIListBoxItem::AddIconField) + .def("SetTextColor", &CUIListBoxItem::SetTextColor) + ]; +}); + +SCRIPT_EXPORT(CUIListBoxItemMsgChain, (CUIListBoxItem), { + module(luaState) + [ + class_("CUIListBoxItemMsgChain") + .def(constructor()) + ]; +}); + +SCRIPT_EXPORT(EnumGameIDs, (), { + class EnumGameIDs + { + }; + module(luaState) + [ + class_("GAME_TYPE") + .enum_("gametype") + [ + value("GAME_UNKNOWN", int(-1)) + ] + ]; +}); +// clang-format on diff --git a/src/xrGame/ui/UIMessageBox.cpp b/src/xrUICore/MessageBox/UIMessageBox.cpp similarity index 98% rename from src/xrGame/ui/UIMessageBox.cpp rename to src/xrUICore/MessageBox/UIMessageBox.cpp index 4337a4dba91..6a4543467c6 100644 --- a/src/xrGame/ui/UIMessageBox.cpp +++ b/src/xrUICore/MessageBox/UIMessageBox.cpp @@ -1,9 +1,8 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIMessageBox.h" -#include "UIXmlInit.h" -#include "UI3tButton.h" -#include "UIEditBox.h" -#include "string_table.h" +#include "XML/UIXmlInitBase.h" +#include "Buttons/UI3tButton.h" +#include "EditBox/UIEditBox.h" CUIMessageBox::CUIMessageBox() { @@ -54,7 +53,7 @@ void CUIMessageBox::InitMessageBox(LPCSTR box_template) Clear(); CUIXml uiXml; uiXml.Load(CONFIG_PATH, UI_PATH, "message_box.xml"); - CUIXmlInit xml_init; + CUIXmlInitBase xml_init; string512 str; diff --git a/src/xrGame/ui/UIMessageBox.h b/src/xrUICore/MessageBox/UIMessageBox.h similarity index 94% rename from src/xrGame/ui/UIMessageBox.h rename to src/xrUICore/MessageBox/UIMessageBox.h index 5b805b9f958..5784b84ff23 100644 --- a/src/xrGame/ui/UIMessageBox.h +++ b/src/xrUICore/MessageBox/UIMessageBox.h @@ -1,11 +1,10 @@ #pragma once - -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUI3tButton; class CUIEditBox; -class CUIMessageBox : public CUIStatic +class XRUICORE_API CUIMessageBox : public CUIStatic { private: typedef CUIStatic inherited; diff --git a/src/xrGame/ui/UIMessageBox_script.cpp b/src/xrUICore/MessageBox/UIMessageBox_script.cpp similarity index 51% rename from src/xrGame/ui/UIMessageBox_script.cpp rename to src/xrUICore/MessageBox/UIMessageBox_script.cpp index 64594087f3c..3698ae73e08 100644 --- a/src/xrGame/ui/UIMessageBox_script.cpp +++ b/src/xrUICore/MessageBox/UIMessageBox_script.cpp @@ -1,6 +1,5 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIMessageBox.h" -#include "UIMessageBoxEx.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; @@ -13,12 +12,3 @@ SCRIPT_EXPORT(CUIMessageBox, (CUIStatic), { .def("GetHost", &CUIMessageBox::GetHost) .def("GetPassword", &CUIMessageBox::GetPassword)]; }); - -SCRIPT_EXPORT(CUIMessageBoxEx, (CUIDialogWnd), { - module(luaState)[class_("CUIMessageBoxEx") - .def(constructor<>()) - .def("InitMessageBox", &CUIMessageBoxEx::InitMessageBox) - .def("SetText", &CUIMessageBoxEx::SetText) - .def("GetHost", &CUIMessageBoxEx::GetHost) - .def("GetPassword", &CUIMessageBoxEx::GetPassword)]; -}); diff --git a/src/xrGame/ui/UIOptionsItem.cpp b/src/xrUICore/Options/UIOptionsItem.cpp similarity index 99% rename from src/xrGame/ui/UIOptionsItem.cpp rename to src/xrUICore/Options/UIOptionsItem.cpp index 68ca6c0d25b..ddf7894a369 100644 --- a/src/xrGame/ui/UIOptionsItem.cpp +++ b/src/xrUICore/Options/UIOptionsItem.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UIOptionsItem.h" #include "UIOptionsManager.h" #include "xrEngine/xr_ioconsole.h" diff --git a/src/xrGame/ui/UIOptionsItem.h b/src/xrUICore/Options/UIOptionsItem.h similarity index 79% rename from src/xrGame/ui/UIOptionsItem.h rename to src/xrUICore/Options/UIOptionsItem.h index edda81e40fc..5e5c92894c2 100644 --- a/src/xrGame/ui/UIOptionsItem.h +++ b/src/xrUICore/Options/UIOptionsItem.h @@ -4,7 +4,7 @@ // fwd. decl. struct xr_token; -class CUIOptionsItem +class XRUICORE_API CUIOptionsItem { public: enum ESystemDepends @@ -25,11 +25,11 @@ class CUIOptionsItem static CUIOptionsManager* GetOptionsManager() { return &m_optionsManager; } virtual void OnMessage(LPCSTR message); - virtual void SetCurrentOptValue() = 0 {}; // opt->current - virtual void SaveBackUpOptValue() = 0 {}; // current->backup - virtual void SaveOptValue() = 0; // current->opt - virtual void UndoOptValue() = 0; // backup->current - virtual bool IsChangedOptValue() const = 0 {}; // backup!=current + virtual void SetCurrentOptValue() {} // opt->current + virtual void SaveBackUpOptValue() {} // current->backup + virtual void SaveOptValue(); // current->opt + virtual void UndoOptValue(); // backup->current + virtual bool IsChangedOptValue() const = 0; // backup!=current void OnChangedOptValue(); protected: diff --git a/src/xrGame/ui/UIOptionsManager.cpp b/src/xrUICore/Options/UIOptionsManager.cpp similarity index 99% rename from src/xrGame/ui/UIOptionsManager.cpp rename to src/xrUICore/Options/UIOptionsManager.cpp index c69ff24efff..97780728008 100644 --- a/src/xrGame/ui/UIOptionsManager.cpp +++ b/src/xrUICore/Options/UIOptionsManager.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UIOptionsManager.h" #include "UIOptionsItem.h" #include "xrEngine/xr_ioconsole.h" diff --git a/src/xrGame/ui/UIOptionsManager.h b/src/xrUICore/Options/UIOptionsManager.h similarity index 97% rename from src/xrGame/ui/UIOptionsManager.h rename to src/xrUICore/Options/UIOptionsManager.h index e76d0cc7830..953f713cbdb 100644 --- a/src/xrGame/ui/UIOptionsManager.h +++ b/src/xrUICore/Options/UIOptionsManager.h @@ -5,7 +5,7 @@ class CUIOptionsItem; -class CUIOptionsManager +class XRUICORE_API CUIOptionsManager { public: CUIOptionsManager(); diff --git a/src/xrGame/ui/UIOptionsManagerScript.cpp b/src/xrUICore/Options/UIOptionsManagerScript.cpp similarity index 76% rename from src/xrGame/ui/UIOptionsManagerScript.cpp rename to src/xrUICore/Options/UIOptionsManagerScript.cpp index ce9d1bc7ff1..d938406952f 100644 --- a/src/xrGame/ui/UIOptionsManagerScript.cpp +++ b/src/xrUICore/Options/UIOptionsManagerScript.cpp @@ -1,30 +1,31 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIOptionsItem.h" #include "UIOptionsManagerScript.h" #include "xrScriptEngine/ScriptExporter.hpp" using namespace luabind; -void CUIOptionsManagerScript::SetCurrentValues(const char* group) +void CUIOptionsManagerScript::SetCurrentValues(pcstr group) { CUIOptionsItem::GetOptionsManager()->SetCurrentValues(group); } -void CUIOptionsManagerScript::SaveBackupValues(const char* group) +void CUIOptionsManagerScript::SaveBackupValues(pcstr group) { CUIOptionsItem::GetOptionsManager()->SaveBackupValues(group); } -void CUIOptionsManagerScript::SaveValues(const char* group) { CUIOptionsItem::GetOptionsManager()->SaveValues(group); } -void CUIOptionsManagerScript::UndoGroup(const char* group) { CUIOptionsItem::GetOptionsManager()->UndoGroup(group); } +void CUIOptionsManagerScript::SaveValues(pcstr group) { CUIOptionsItem::GetOptionsManager()->SaveValues(group); } +void CUIOptionsManagerScript::UndoGroup(pcstr group) { CUIOptionsItem::GetOptionsManager()->UndoGroup(group); } void CUIOptionsManagerScript::OptionsPostAccept() { CUIOptionsItem::GetOptionsManager()->OptionsPostAccept(); } -void CUIOptionsManagerScript::SendMessage2Group(const char* group, const char* message) +void CUIOptionsManagerScript::SendMessage2Group(pcstr group, pcstr message) { CUIOptionsItem::GetOptionsManager()->SendMessage2Group(group, message); } bool CUIOptionsManagerScript::NeedSystemRestart() { return CUIOptionsItem::GetOptionsManager()->NeedSystemRestart(); } bool CUIOptionsManagerScript::NeedVidRestart() { return CUIOptionsItem::GetOptionsManager()->NeedVidRestart(); } + SCRIPT_EXPORT(CUIOptionsManagerScript, (), { module(luaState)[class_("COptionsManager") .def(constructor<>()) diff --git a/src/xrUICore/Options/UIOptionsManagerScript.h b/src/xrUICore/Options/UIOptionsManagerScript.h new file mode 100644 index 00000000000..f5754a45c44 --- /dev/null +++ b/src/xrUICore/Options/UIOptionsManagerScript.h @@ -0,0 +1,14 @@ +#pragma once + +class CUIOptionsManagerScript +{ +public: + void SaveBackupValues(pcstr group); + void SetCurrentValues(pcstr group); + void SaveValues(pcstr group); + void UndoGroup(pcstr group); + void OptionsPostAccept(); + void SendMessage2Group(pcstr group, pcstr message); + bool NeedSystemRestart(); + bool NeedVidRestart(); +}; diff --git a/src/xrGame/ui/UIDoubleProgressBar.cpp b/src/xrUICore/ProgressBar/UIDoubleProgressBar.cpp similarity index 78% rename from src/xrGame/ui/UIDoubleProgressBar.cpp rename to src/xrUICore/ProgressBar/UIDoubleProgressBar.cpp index 925eb5bfe07..9976aadb2b5 100644 --- a/src/xrGame/ui/UIDoubleProgressBar.cpp +++ b/src/xrUICore/ProgressBar/UIDoubleProgressBar.cpp @@ -1,8 +1,6 @@ -// sea 08.01.2008 - -#include "StdAfx.h" +#include "pch.hpp" #include "UIDoubleProgressBar.h" -#include "UIXmlInit.h" +#include "XML/UIXmlInitBase.h" CUIDoubleProgressBar::CUIDoubleProgressBar() { @@ -13,14 +11,14 @@ CUIDoubleProgressBar::CUIDoubleProgressBar() CUIDoubleProgressBar::~CUIDoubleProgressBar() {} void CUIDoubleProgressBar::InitFromXml(CUIXml& xml_doc, LPCSTR path) { - CUIXmlInit::InitProgressBar(xml_doc, path, 0, &m_progress_one); - CUIXmlInit::InitProgressBar(xml_doc, path, 0, &m_progress_two); + CUIXmlInitBase::InitProgressBar(xml_doc, path, 0, &m_progress_one); + CUIXmlInitBase::InitProgressBar(xml_doc, path, 0, &m_progress_two); string256 buf; strconcat(sizeof(buf), buf, path, ":color_less"); - m_less_color = CUIXmlInit::GetColor(xml_doc, buf, 0, color_rgba(255, 0, 0, 255)); + m_less_color = CUIXmlInitBase::GetColor(xml_doc, buf, 0, color_rgba(255, 0, 0, 255)); strconcat(sizeof(buf), buf, path, ":color_more"); - m_more_color = CUIXmlInit::GetColor(xml_doc, buf, 0, color_rgba(0, 255, 0, 255)); + m_more_color = CUIXmlInitBase::GetColor(xml_doc, buf, 0, color_rgba(0, 255, 0, 255)); m_progress_one.SetRange(0.0f, 100.0f); m_progress_two.SetRange(0.0f, 100.0f); diff --git a/src/xrGame/ui/UIDoubleProgressBar.h b/src/xrUICore/ProgressBar/UIDoubleProgressBar.h similarity index 72% rename from src/xrGame/ui/UIDoubleProgressBar.h rename to src/xrUICore/ProgressBar/UIDoubleProgressBar.h index 7303a72417a..71c7acd0603 100644 --- a/src/xrGame/ui/UIDoubleProgressBar.h +++ b/src/xrUICore/ProgressBar/UIDoubleProgressBar.h @@ -1,10 +1,8 @@ -// sea 08.01.2008 #pragma once +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/ProgressBar/UIProgressBar.h" -#include "UIWindow.h" -#include "UIProgressBar.h" - -class CUIDoubleProgressBar : public CUIWindow +class XRUICORE_API CUIDoubleProgressBar : public CUIWindow { public: // func CUIDoubleProgressBar(); diff --git a/src/xrGame/ui/UIProgressBar.cpp b/src/xrUICore/ProgressBar/UIProgressBar.cpp similarity index 97% rename from src/xrGame/ui/UIProgressBar.cpp rename to src/xrUICore/ProgressBar/UIProgressBar.cpp index 7a7e3c6262c..2f3ffba2b03 100644 --- a/src/xrGame/ui/UIProgressBar.cpp +++ b/src/xrUICore/ProgressBar/UIProgressBar.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" -#include "uiprogressbar.h" +#include "pch.hpp" +#include "UIProgressBar.h" CUIProgressBar::CUIProgressBar(void) { @@ -46,18 +46,15 @@ void CUIProgressBar::UpdateProgressBar() case om_fromcenter: m_CurrentLength = GetWidth() * fCurrentLength; break; - case om_vert: case om_down: case om_vfromcenter: m_CurrentLength = GetHeight() * fCurrentLength; break; - case om_tocenter: case om_vtocenter: R_ASSERT2(false, "to_center mode is not implemented."); break; - default: m_CurrentLength = 0.0f; } @@ -126,7 +123,7 @@ void CUIProgressBar::Draw() case om_vert: progress_rect.set(0, GetHeight() - m_CurrentLength, GetWidth(), GetHeight()); break; case om_back: progress_rect.set(GetWidth() - m_CurrentLength * 1.01f, 0, GetWidth(), GetHeight()); break; case om_down: progress_rect.set(0, 0, GetWidth(), m_CurrentLength); break; - case om_fromcenter: + case om_fromcenter: { const float center = GetWidth() / 2.f; progress_rect.set(center - m_CurrentLength, 0, center + m_CurrentLength, GetHeight()); @@ -138,7 +135,7 @@ void CUIProgressBar::Draw() progress_rect.set(0, center - m_CurrentLength, GetWidth(), center + m_CurrentLength); break; } - // XXX: Implement to_center mode + // XXX: Implement two-way progress bar case om_tocenter: case om_vtocenter: R_ASSERT2(false, "to_center mode is not implemented."); break; default: NODEFAULT; break; diff --git a/src/xrGame/ui/UIProgressBar.h b/src/xrUICore/ProgressBar/UIProgressBar.h similarity index 90% rename from src/xrGame/ui/UIProgressBar.h rename to src/xrUICore/ProgressBar/UIProgressBar.h index 11090ebb0a0..dc9afd76da3 100644 --- a/src/xrGame/ui/UIProgressBar.h +++ b/src/xrUICore/ProgressBar/UIProgressBar.h @@ -1,11 +1,10 @@ #pragma once +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Buttons/UIButton.h" -#include "UIWindow.h" -#include "UIButton.h" - -class CUIProgressBar : public CUIWindow +class XRUICORE_API CUIProgressBar : public CUIWindow { - friend class CUIXmlInit; + friend class CUIXmlInitBase; typedef CUIWindow inherited; protected: diff --git a/src/xrUICore/ProgressBar/UIProgressBar_script.cpp b/src/xrUICore/ProgressBar/UIProgressBar_script.cpp new file mode 100644 index 00000000000..deb4a773798 --- /dev/null +++ b/src/xrUICore/ProgressBar/UIProgressBar_script.cpp @@ -0,0 +1,19 @@ +#include "pch.hpp" +#include "UIProgressBar.h" +#include "xrScriptEngine/ScriptExporter.hpp" + +using namespace luabind; + +SCRIPT_EXPORT(CUIProgressBar, (CUIWindow), +{ + module(luaState) + [ + class_("CUIProgressBar") + .def(constructor<>()) + .def("SetProgressPos", &CUIProgressBar::SetProgressPos) + .def("GetProgressPos", &CUIProgressBar::GetProgressPos) + + .def("GetRange_min", &CUIProgressBar::GetRange_min) + .def("GetRange_max", &CUIProgressBar::GetRange_max) + ]; +}); diff --git a/src/xrGame/ui/UIProgressShape.cpp b/src/xrUICore/ProgressBar/UIProgressShape.cpp similarity index 96% rename from src/xrGame/ui/UIProgressShape.cpp rename to src/xrUICore/ProgressBar/UIProgressShape.cpp index cb35f4129c2..02c92528188 100644 --- a/src/xrGame/ui/UIProgressShape.cpp +++ b/src/xrUICore/ProgressBar/UIProgressShape.cpp @@ -1,15 +1,11 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UIProgressShape.h" - -#include "UIStatic.h" #include "Include/xrRender/UIShader.h" #include "Include/xrRender/UIRender.h" CUIProgressShape::CUIProgressShape() { m_bText = false; - // m_pTexture = new CUIStatic(); - // AttachChild (m_pTexture); m_blend = true; m_angle_begin = 0.0f; m_angle_end = PI_MUL_2; @@ -17,9 +13,7 @@ CUIProgressShape::CUIProgressShape() }; CUIProgressShape::~CUIProgressShape() -{ - // xr_delete (m_pTexture); -} +{} void CUIProgressShape::SetPos(float pos) { m_stage = pos; } void CUIProgressShape::SetPos(int pos, int max) diff --git a/src/xrGame/ui/UIProgressShape.h b/src/xrUICore/ProgressBar/UIProgressShape.h similarity index 75% rename from src/xrGame/ui/UIProgressShape.h rename to src/xrUICore/ProgressBar/UIProgressShape.h index 373c95e0c71..4d431bfe0e3 100644 --- a/src/xrGame/ui/UIProgressShape.h +++ b/src/xrUICore/ProgressBar/UIProgressShape.h @@ -1,12 +1,12 @@ #pragma once -#include "UIStatic.h" +#include "xrUICore/Static/UIStatic.h" class CUIStatic; -class CUIProgressShape : public CUIStatic +class XRUICORE_API CUIProgressShape : public CUIStatic { - friend class CUIXmlInit; + friend class CUIXmlInitBase; public: CUIProgressShape(); diff --git a/src/xrGame/ui/UIPropertiesBox.cpp b/src/xrUICore/PropertiesBox/UIPropertiesBox.cpp similarity index 97% rename from src/xrGame/ui/UIPropertiesBox.cpp rename to src/xrUICore/PropertiesBox/UIPropertiesBox.cpp index e2082f2c4b9..193a6776c59 100644 --- a/src/xrGame/ui/UIPropertiesBox.cpp +++ b/src/xrUICore/PropertiesBox/UIPropertiesBox.cpp @@ -1,8 +1,7 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIPropertiesBox.h" -#include "Level.h" -#include "UIListBoxItem.h" -#include "UIXmlInit.h" +#include "ListBox/UIListBoxItem.h" +#include "XML/UIXmlInitBase.h" #define OFFSET_X (5.0f) #define OFFSET_Y (5.0f) @@ -40,7 +39,7 @@ void CUIPropertiesBox::InitPropertiesBox(Fvector2 pos, Fvector2 size) R_ASSERT(t); InitTexture(t); - CUIXmlInit::InitListBox(xml_doc, "properties_box:list", 0, &m_UIListWnd); + CUIXmlInitBase::InitListBox(xml_doc, "properties_box:list", 0, &m_UIListWnd); m_UIListWnd.SetWndPos(Fvector2().set(OFFSET_X, OFFSET_Y)); m_UIListWnd.SetWndSize(Fvector2().set(size.x - OFFSET_X * 2, size.y - OFFSET_Y * 2)); diff --git a/src/xrGame/ui/UIPropertiesBox.h b/src/xrUICore/PropertiesBox/UIPropertiesBox.h similarity index 89% rename from src/xrGame/ui/UIPropertiesBox.h rename to src/xrUICore/PropertiesBox/UIPropertiesBox.h index 6aaab9fd488..446a3c9c09c 100644 --- a/src/xrGame/ui/UIPropertiesBox.h +++ b/src/xrUICore/PropertiesBox/UIPropertiesBox.h @@ -1,9 +1,8 @@ #pragma once +#include "xrUICore/Windows/UIFrameWindow.h" +#include "xrUICore/ListBox/UIListBox.h" -#include "uiframewindow.h" -#include "uilistbox.h" - -class CUIPropertiesBox : public CUIFrameWindow, public CUIWndCallback +class XRUICORE_API CUIPropertiesBox : public CUIFrameWindow, public CUIWndCallback { private: typedef CUIFrameWindow inherited; diff --git a/src/xrGame/ui/UIPropertiesBox_script.cpp b/src/xrUICore/PropertiesBox/UIPropertiesBox_script.cpp similarity index 85% rename from src/xrGame/ui/UIPropertiesBox_script.cpp rename to src/xrUICore/PropertiesBox/UIPropertiesBox_script.cpp index 4aafb238585..157f0619806 100644 --- a/src/xrGame/ui/UIPropertiesBox_script.cpp +++ b/src/xrUICore/PropertiesBox/UIPropertiesBox_script.cpp @@ -1,4 +1,4 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIPropertiesBox.h" #include "xrScriptEngine/ScriptExporter.hpp" @@ -7,7 +7,6 @@ using namespace luabind; SCRIPT_EXPORT(CUIPropertiesBox, (CUIFrameWindow), { module(luaState)[class_("CUIPropertiesBox") .def(constructor<>()) - // .def("AddItem", &CUIPropertiesBox::AddItem) .def("RemoveItem", &CUIPropertiesBox::RemoveItemByTAG) .def("RemoveAll", &CUIPropertiesBox::RemoveAll) .def("Show", (void (CUIPropertiesBox::*)(int, int)) & CUIPropertiesBox::Show) @@ -15,6 +14,5 @@ SCRIPT_EXPORT(CUIPropertiesBox, (CUIFrameWindow), { // .def("GetClickedIndex", &CUIPropertiesBox::GetClickedIndex) .def("AutoUpdateSize", &CUIPropertiesBox::AutoUpdateSize) .def("AddItem", &CUIPropertiesBox::AddItem_script) - // .def("", &CUIPropertiesBox::) ]; }); diff --git a/src/xrGame/ui/UIFixedScrollBar.cpp b/src/xrUICore/ScrollBar/UIFixedScrollBar.cpp similarity index 93% rename from src/xrGame/ui/UIFixedScrollBar.cpp rename to src/xrUICore/ScrollBar/UIFixedScrollBar.cpp index d7faf60a3bb..7925184e776 100644 --- a/src/xrGame/ui/UIFixedScrollBar.cpp +++ b/src/xrUICore/ScrollBar/UIFixedScrollBar.cpp @@ -1,9 +1,11 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIFixedScrollbar.h" -#include "UI3tButton.h" -#include "UIFrameLineWnd.h" +#include "Buttons/UI3tButton.h" +#include "Windows/UIFrameLineWnd.h" #include "UIScrollBox.h" -#include "UIXmlInit.h" +#include "XML/UIXmlInitBase.h" +#include "Cursor/UICursor.h" +#include "xrEngine/xr_input_xinput.h" CUIFixedScrollBar::CUIFixedScrollBar() { @@ -34,16 +36,16 @@ void CUIFixedScrollBar::InitScrollBar(Fvector2 pos, bool horizontal, LPCSTR prof inherited::SetWndSize(Fvector2().set(width, height)); strconcat(sizeof(_path), _path, profile, ":left_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_DecButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_DecButton); strconcat(sizeof(_path), _path, profile, ":right_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_IncButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_IncButton); strconcat(sizeof(_path), _path, profile, ":box"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_ScrollBox); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_ScrollBox); strconcat(sizeof(_path), _path, profile, ":back"); - CUIXmlInit::InitFrameLine(xml_doc, _path, 0, m_FrameBackground); + CUIXmlInitBase::InitFrameLine(xml_doc, _path, 0, m_FrameBackground); m_ScrollWorkArea = _max(0, iFloor(GetWidth() - 2 * height)); } @@ -52,16 +54,16 @@ void CUIFixedScrollBar::InitScrollBar(Fvector2 pos, bool horizontal, LPCSTR prof inherited::SetWndSize(Fvector2().set(width_v, height_v)); strconcat(sizeof(_path), _path, profile, ":up_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_DecButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_DecButton); strconcat(sizeof(_path), _path, profile, ":down_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_IncButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_IncButton); strconcat(sizeof(_path), _path, profile, ":box_v"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_ScrollBox); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_ScrollBox); strconcat(sizeof(_path), _path, profile, ":back_v"); - CUIXmlInit::InitFrameLine(xml_doc, _path, 0, m_FrameBackground); + CUIXmlInitBase::InitFrameLine(xml_doc, _path, 0, m_FrameBackground); m_ScrollWorkArea = _max(0, iFloor(GetHeight() - 2 * width_v)); } @@ -134,8 +136,6 @@ void CUIFixedScrollBar::ClampByViewRect() } } -#include "UICursor.h" - u32 last_hold_tm = 0; bool CUIFixedScrollBar::OnKeyboardHold(int dik) { diff --git a/src/xrGame/ui/UIFixedScrollBar.h b/src/xrUICore/ScrollBar/UIFixedScrollBar.h similarity index 94% rename from src/xrGame/ui/UIFixedScrollBar.h rename to src/xrUICore/ScrollBar/UIFixedScrollBar.h index d38a6b0ff2a..b108b8c7bd6 100644 --- a/src/xrGame/ui/UIFixedScrollBar.h +++ b/src/xrUICore/ScrollBar/UIFixedScrollBar.h @@ -5,7 +5,7 @@ class CUI3tButton; class CUIScrollBox; class CUIFrameLineWnd; -class CUIFixedScrollBar : public CUIScrollBar +class XRUICORE_API CUIFixedScrollBar : public CUIScrollBar { private: typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIScrollBar.cpp b/src/xrUICore/ScrollBar/UIScrollBar.cpp similarity index 95% rename from src/xrGame/ui/UIScrollBar.cpp rename to src/xrUICore/ScrollBar/UIScrollBar.cpp index a68c1cbb991..21b5dbfe101 100644 --- a/src/xrGame/ui/UIScrollBar.cpp +++ b/src/xrUICore/ScrollBar/UIScrollBar.cpp @@ -1,9 +1,11 @@ -#include "stdafx.h" +#include "pch.hpp" #include "uiscrollbar.h" -#include "UI3tButton.h" +#include "Buttons/UI3tButton.h" #include "UIScrollBox.h" -#include "UIXmlInit.h" -#include "UITextureMaster.h" +#include "XML/UIXmlInitBase.h" +#include "XML/UITextureMaster.h" +#include "Cursor/UICursor.h" +#include "xrEngine/xr_input_xinput.h" CUIScrollBar::CUIScrollBar() { @@ -48,17 +50,17 @@ void CUIScrollBar::InitScrollBar(Fvector2 pos, float length, bool bIsHorizontal, inherited::SetWndSize(Fvector2().set(length, height)); strconcat(sizeof(_path), _path, profile, ":left_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_DecButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_DecButton); m_DecButton->SetWndPos(Fvector2().set(0, 0)); strconcat(sizeof(_path), _path, profile, ":right_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_IncButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_IncButton); m_IncButton->SetWndPos(Fvector2().set(length - m_IncButton->GetWidth(), 0.0f)); m_ScrollBox->SetHorizontal(true); strconcat(sizeof(_path), _path, profile, ":box"); - CUIXmlInit::InitFrameLine(xml_doc, _path, 0, m_ScrollBox); + CUIXmlInitBase::InitFrameLine(xml_doc, _path, 0, m_ScrollBox); strconcat(sizeof(_path), _path, profile, ":back:texture"); LPCSTR texture = xml_doc.Read(_path, 0, ""); @@ -71,17 +73,17 @@ void CUIScrollBar::InitScrollBar(Fvector2 pos, float length, bool bIsHorizontal, inherited::SetWndSize(Fvector2().set(height, length)); strconcat(sizeof(_path), _path, profile, ":up_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_DecButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_DecButton); m_DecButton->SetWndPos(Fvector2().set(0, 0)); strconcat(sizeof(_path), _path, profile, ":down_arrow"); - CUIXmlInit::Init3tButton(xml_doc, _path, 0, m_IncButton); + CUIXmlInitBase::Init3tButton(xml_doc, _path, 0, m_IncButton); m_IncButton->SetWndPos(Fvector2().set(0.0f, length - m_IncButton->GetHeight())); m_ScrollBox->SetHorizontal(false); strconcat(sizeof(_path), _path, profile, ":box_v"); - CUIXmlInit::InitFrameLine(xml_doc, _path, 0, m_ScrollBox); + CUIXmlInitBase::InitFrameLine(xml_doc, _path, 0, m_ScrollBox); strconcat(sizeof(_path), _path, profile, ":back_v:texture"); LPCSTR texture = xml_doc.Read(_path, 0, ""); @@ -198,8 +200,6 @@ void CUIScrollBar::UpdateScrollBar() ClampByViewRect(); } -#include "UICursor.h" - u32 last_hold_time = 0; bool CUIScrollBar::OnKeyboardHold(int dik) diff --git a/src/xrGame/ui/UIScrollBar.h b/src/xrUICore/ScrollBar/UIScrollBar.h similarity index 96% rename from src/xrGame/ui/UIScrollBar.h rename to src/xrUICore/ScrollBar/UIScrollBar.h index 935146a74ef..8b94b7e7e03 100644 --- a/src/xrGame/ui/UIScrollBar.h +++ b/src/xrUICore/ScrollBar/UIScrollBar.h @@ -1,11 +1,11 @@ #pragma once -#include "UIWindow.h" +#include "xrUICore/Windows/UIWindow.h" class CUI3tButton; class CUIScrollBox; class CUIFrameLineWnd; -class CUIScrollBar : public CUIWindow +class XRUICORE_API CUIScrollBar : public CUIWindow { private: typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIScrollBox.cpp b/src/xrUICore/ScrollBar/UIScrollBox.cpp similarity index 96% rename from src/xrGame/ui/UIScrollBox.cpp rename to src/xrUICore/ScrollBar/UIScrollBox.cpp index d81894c68a2..9a02a50ed5a 100644 --- a/src/xrGame/ui/UIScrollBox.cpp +++ b/src/xrUICore/ScrollBar/UIScrollBox.cpp @@ -1,6 +1,6 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIScrollBox.h" -#include "UICursor.h" +#include "Cursor/UICursor.h" CUIScrollBox::CUIScrollBox() {} bool CUIScrollBox::OnMouseAction(float x, float y, EUIMessages mouse_action) diff --git a/src/xrGame/ui/UIScrollBox.h b/src/xrUICore/ScrollBar/UIScrollBox.h similarity index 85% rename from src/xrGame/ui/UIScrollBox.h rename to src/xrUICore/ScrollBar/UIScrollBox.h index 63e1c43c301..d58ac6d1db9 100644 --- a/src/xrGame/ui/UIScrollBox.h +++ b/src/xrUICore/ScrollBar/UIScrollBox.h @@ -1,5 +1,5 @@ #pragma once -#include "uiFrameLineWnd.h" +#include "Windows/uiFrameLineWnd.h" class CUIScrollBox : public CUIFrameLineWnd { diff --git a/src/xrGame/ui/UIScrollView.cpp b/src/xrUICore/ScrollView/UIScrollView.cpp similarity index 98% rename from src/xrGame/ui/UIScrollView.cpp rename to src/xrUICore/ScrollView/UIScrollView.cpp index 21f657606bd..7997132b06b 100644 --- a/src/xrGame/ui/UIScrollView.cpp +++ b/src/xrUICore/ScrollView/UIScrollView.cpp @@ -1,9 +1,9 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIScrollView.h" -#include "UIScrollBar.h" -#include "UIFixedScrollBar.h" +#include "ScrollBar/UIScrollBar.h" +#include "ScrollBar/UIFixedScrollBar.h" #include "ui_base.h" -#include "UICursor.h" +#include "Cursor/UICursor.h" #include "xrEngine/xr_input.h" CUIScrollView::CUIScrollView() diff --git a/src/xrGame/ui/UIScrollView.h b/src/xrUICore/ScrollView/UIScrollView.h similarity index 92% rename from src/xrGame/ui/UIScrollView.h rename to src/xrUICore/ScrollView/UIScrollView.h index 700c36740dc..bc34bb86e38 100644 --- a/src/xrGame/ui/UIScrollView.h +++ b/src/xrUICore/ScrollView/UIScrollView.h @@ -1,15 +1,15 @@ #pragma once -#include "UIScrollBar.h" -#include "UIWindow.h" -#include "UIWndCallback.h" +#include "xrUICore/ScrollBar/UIScrollBar.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Callbacks/UIWndCallback.h" class CUIScrollBar; class CUIFixedScrollBar; -class CUIScrollView : public CUIWindow, public CUIWndCallback +class XRUICORE_API CUIScrollView : public CUIWindow, public CUIWndCallback { typedef CUIWindow inherited; - friend class CUIXmlInit; // for init + friend class CUIXmlInitBase; // for init protected: enum { diff --git a/src/xrGame/ui/UICustomSpin.cpp b/src/xrUICore/SpinBox/UICustomSpin.cpp similarity index 97% rename from src/xrGame/ui/UICustomSpin.cpp rename to src/xrUICore/SpinBox/UICustomSpin.cpp index be7b8f584db..9124ee7f951 100644 --- a/src/xrGame/ui/UICustomSpin.cpp +++ b/src/xrUICore/SpinBox/UICustomSpin.cpp @@ -6,10 +6,10 @@ // // copyright 2005 GSC Game World -#include "StdAfx.h" -#include "UI3tButton.h" -#include "UIFrameLineWnd.h" -#include "UILines.h" +#include "pch.hpp" +#include "Buttons/UI3tButton.h" +#include "Windows/UIFrameLineWnd.h" +#include "Lines/UILines.h" #include "UICustomSpin.h" #define SPIN_HEIGHT 20.0f diff --git a/src/xrGame/ui/UICustomSpin.h b/src/xrUICore/SpinBox/UICustomSpin.h similarity index 87% rename from src/xrGame/ui/UICustomSpin.h rename to src/xrUICore/SpinBox/UICustomSpin.h index bd7c4937d1c..2fe3bbe05d4 100644 --- a/src/xrGame/ui/UICustomSpin.h +++ b/src/xrUICore/SpinBox/UICustomSpin.h @@ -7,14 +7,14 @@ // copyright 2005 GSC Game World #pragma once -#include "UIWindow.h" -#include "UIOptionsItem.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Options/UIOptionsItem.h" class CUI3tButton; class CUIFrameLineWnd; class CUILines; -class CUICustomSpin : public CUIWindow, public CUIOptionsItem +class XRUICORE_API CUICustomSpin : public CUIWindow, public CUIOptionsItem { public: CUICustomSpin(); diff --git a/src/xrGame/ui/UISpinNum.cpp b/src/xrUICore/SpinBox/UISpinNum.cpp similarity index 93% rename from src/xrGame/ui/UISpinNum.cpp rename to src/xrUICore/SpinBox/UISpinNum.cpp index 5d6d428fc0b..50626d602c1 100644 --- a/src/xrGame/ui/UISpinNum.cpp +++ b/src/xrUICore/SpinBox/UISpinNum.cpp @@ -4,21 +4,19 @@ // author: Serge Vynnychenko // -#include "StdAfx.h" +#include "pch.hpp" #include "UISpinNum.h" -#include "UILines.h" +#include "Lines/UILines.h" CUISpinNum::CUISpinNum() : m_iVal(0), m_iMin(0), m_iMax(100), m_iStep(1) {} void CUISpinNum::SetCurrentOptValue() // opt->current { - CUIOptionsItem::SetCurrentOptValue(); GetOptIntegerValue(m_iVal, m_iMin, m_iMax); SetValue(m_iVal); } void CUISpinNum::SaveBackUpOptValue() // current->backup { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = m_iVal; } @@ -85,7 +83,6 @@ bool CUISpinNum::CanPressDown() { return m_iVal - m_iStep >= m_iMin; } CUISpinFlt::CUISpinFlt() : m_fVal(0), m_fMin(0), m_fMax(100), m_fStep(0.1f) {} void CUISpinFlt::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = m_fVal; } @@ -98,7 +95,6 @@ void CUISpinFlt::UndoOptValue() void CUISpinFlt::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); GetOptFloatValue(m_fVal, m_fMin, m_fMax); SetValue(m_fVal); } diff --git a/src/xrGame/ui/UISpinNum.h b/src/xrUICore/SpinBox/UISpinNum.h similarity index 91% rename from src/xrGame/ui/UISpinNum.h rename to src/xrUICore/SpinBox/UISpinNum.h index cca0bc0cea2..acf7ba8df48 100644 --- a/src/xrGame/ui/UISpinNum.h +++ b/src/xrUICore/SpinBox/UISpinNum.h @@ -1,6 +1,6 @@ -#include "UICustomSpin.h" +#include "xrUICore/SpinBox/UICustomSpin.h" -class CUISpinNum : public CUICustomSpin +class XRUICORE_API CUISpinNum : public CUICustomSpin { public: CUISpinNum(); @@ -34,7 +34,7 @@ class CUISpinNum : public CUICustomSpin int m_opt_backup_value; }; -class CUISpinFlt : public CUICustomSpin +class XRUICORE_API CUISpinFlt : public CUICustomSpin { public: CUISpinFlt(); diff --git a/src/xrGame/ui/UISpinText.cpp b/src/xrUICore/SpinBox/UISpinText.cpp similarity index 90% rename from src/xrGame/ui/UISpinText.cpp rename to src/xrUICore/SpinBox/UISpinText.cpp index a296c433f76..c71b16bb060 100644 --- a/src/xrGame/ui/UISpinText.cpp +++ b/src/xrUICore/SpinBox/UISpinText.cpp @@ -1,7 +1,7 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UISpinText.h" -#include "UILines.h" -#include "string_table.h" +#include "Lines/UILines.h" +#include "xrEngine/StringTable/IStringTable.h" #include "xrCore/xr_token.h" CUISpinText::CUISpinText() : m_curItem(-1) {} @@ -9,7 +9,7 @@ void CUISpinText::AddItem_(const char* item, int id) { SInfo _info; _info._orig = item; - _info._transl = CStringTable().translate(item); + _info._transl = gStringTable->translate(item); _info._id = id; m_list.push_back(_info); @@ -34,8 +34,6 @@ LPCSTR CUISpinText::GetTokenText() void CUISpinText::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); - const xr_token* tok = GetOptToken(); while (tok->name) @@ -57,7 +55,6 @@ void CUISpinText::SetCurrentOptValue() void CUISpinText::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = m_curItem; } diff --git a/src/xrGame/ui/UISpinText.h b/src/xrUICore/SpinBox/UISpinText.h similarity index 90% rename from src/xrGame/ui/UISpinText.h rename to src/xrUICore/SpinBox/UISpinText.h index 96d7cce23f0..3e4a9dbaf0a 100644 --- a/src/xrGame/ui/UISpinText.h +++ b/src/xrUICore/SpinBox/UISpinText.h @@ -1,6 +1,6 @@ -#include "UICustomSpin.h" +#include "xrUICore/SpinBox/UICustomSpin.h" -class CUISpinText : public CUICustomSpin +class XRUICORE_API CUISpinText : public CUICustomSpin { public: CUISpinText(); diff --git a/src/xrGame/ui/UIAnimatedStatic.cpp b/src/xrUICore/Static/UIAnimatedStatic.cpp similarity index 54% rename from src/xrGame/ui/UIAnimatedStatic.cpp rename to src/xrUICore/Static/UIAnimatedStatic.cpp index 10e3b2b9aa2..16be9323f6c 100644 --- a/src/xrGame/ui/UIAnimatedStatic.cpp +++ b/src/xrUICore/Static/UIAnimatedStatic.cpp @@ -6,7 +6,7 @@ // Статик для отображения анимированной иконки //============================================================================= -#include "stdafx.h" +#include "pch.hpp" #include "UIAnimatedStatic.h" ////////////////////////////////////////////////////////////////////////// @@ -89,70 +89,3 @@ void CUIAnimatedStatic::SetAnimPos(float pos) SetFrame(m_uCurFrame); } } -//----------------------------------------------------------------------------------------- -// Static for sleep control----------------------------------------------------------------- -//----------------------------------------------------------------------------------------- -#include "Actor_Flags.h" -#include "Level.h" -#include "date_time.h" -#include "UITextureMaster.h" - -CUISleepStatic::CUISleepStatic() : m_cur_time(0){}; - -void CUISleepStatic::Draw() -{ - // inherited::Draw(); - m_UIStaticItem.Render(); - m_UIStaticItem2.Render(); -} - -void CUISleepStatic::Update() -{ - u32 year = 0, month = 0, day = 0, hours = 0, mins = 0, secs = 0, milisecs = 0; - split_time(Level().GetGameTime(), year, month, day, hours, mins, secs, milisecs); - - u32 start_pixel = 0, end_pixel = 0, start_pixel2 = 0, end_pixel2 = 0; - hours += psActorSleepTime - 1; - if (hours >= 24) - hours -= 24; - - start_pixel = hours * 85; - end_pixel = (hours + 7) * 85; - if (end_pixel > 2048) - { - end_pixel2 = end_pixel - 2048; - end_pixel = 2048; - } - - Fvector2 parent_pos = GetParent()->GetWndPos(); - Fvector2 pos = GetWndPos(); - pos.x += parent_pos.x; - pos.y += parent_pos.y; - - Frect r = Frect().set((float)start_pixel, 0.0f, (float)end_pixel, 128.0f); - m_UIStaticItem.SetTextureRect(r); - m_UIStaticItem.SetSize(Fvector2().set(iFloor((end_pixel - start_pixel) * UI().get_current_kx()), 128)); - m_UIStaticItem.SetPos(pos.x, pos.y); - if (end_pixel2 > 0) - { - r.set((float)start_pixel2, 0.0f, (float)end_pixel2, 128.0f); - m_UIStaticItem2.SetTextureRect(r); - m_UIStaticItem2.SetSize(Fvector2().set(iFloor(end_pixel2 * UI().get_current_kx()), 128)); - m_UIStaticItem2.SetPos(m_UIStaticItem.GetPosX() + m_UIStaticItem.GetSize().x, m_UIStaticItem.GetPosY()); - } - else - m_UIStaticItem2.SetSize(Fvector2().set(1, 1)); -} - -void CUISleepStatic::InitTextureEx(LPCSTR tex_name, LPCSTR sh_name) -{ - inherited::InitTextureEx(tex_name, sh_name); - - LPCSTR res_shname = GEnv.UIRender->UpdateShaderName(tex_name, sh_name); - CUITextureMaster::InitTexture(tex_name, &m_UIStaticItem2, res_shname); - - Fvector2 p = GetWndPos(); - m_UIStaticItem2.SetPos(p.x, p.y); - p.set(1, 1); - m_UIStaticItem2.SetSize(p); -} diff --git a/src/xrGame/ui/UIAnimatedStatic.h b/src/xrUICore/Static/UIAnimatedStatic.h similarity index 82% rename from src/xrGame/ui/UIAnimatedStatic.h rename to src/xrUICore/Static/UIAnimatedStatic.h index a9442f0083f..5a4b291bae7 100644 --- a/src/xrGame/ui/UIAnimatedStatic.h +++ b/src/xrUICore/Static/UIAnimatedStatic.h @@ -1,12 +1,7 @@ - -#ifndef UI_ANIMATED_STATIC_H_ -#define UI_ANIMATED_STATIC_H_ - #pragma once - #include "UIStatic.h" -class CUIAnimatedStatic : public CUIStatic +class XRUICORE_API CUIAnimatedStatic : public CUIStatic { typedef CUIStatic inherited; // Количекство кадров анимации @@ -78,19 +73,3 @@ class CUIAnimatedStatic : public CUIStatic virtual void Update(); }; - -class CUISleepStatic : public CUIStatic -{ -private: - typedef CUIStatic inherited; - - int m_cur_time; - CUIStaticItem m_UIStaticItem2; - -public: - CUISleepStatic(); - virtual void Draw(); - virtual void Update(); - virtual void InitTextureEx(LPCSTR tex_name, LPCSTR sh_name = "hud\\default"); -}; -#endif // UI_ANIMATED_STATIC_H_ diff --git a/src/xrGame/ui/UILanimController.cpp b/src/xrUICore/Static/UILanimController.cpp similarity index 98% rename from src/xrGame/ui/UILanimController.cpp rename to src/xrUICore/Static/UILanimController.cpp index a6054ca1a8c..a847d080a07 100644 --- a/src/xrGame/ui/UILanimController.cpp +++ b/src/xrUICore/Static/UILanimController.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UILanimController.h" #include "xrEngine/LightAnimLibrary.h" diff --git a/src/xrGame/ui/UILanimController.h b/src/xrUICore/Static/UILanimController.h similarity index 96% rename from src/xrGame/ui/UILanimController.h rename to src/xrUICore/Static/UILanimController.h index 731a25f20d2..68d408e79ce 100644 --- a/src/xrGame/ui/UILanimController.h +++ b/src/xrUICore/Static/UILanimController.h @@ -1,6 +1,6 @@ #pragma once -#include "uiwindow.h" +#include "xrUICore/Windows/UIWindow.h" #include "xrEngine/LightAnimLibrary.h" #include "xrCore/_color.h" @@ -111,7 +111,7 @@ class CUILightAnimColorConrollerImpl : public CUILightAnimColorConroller } }; -class CUIColorAnimConrollerContainer : public CUIWindow, public CUILightAnimColorConrollerImpl +class XRUICORE_API CUIColorAnimConrollerContainer : public CUIWindow, public CUILightAnimColorConrollerImpl { typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIStatic.cpp b/src/xrUICore/Static/UIStatic.cpp similarity index 97% rename from src/xrGame/ui/UIStatic.cpp rename to src/xrUICore/Static/UIStatic.cpp index 9553baa0414..385e45d69d3 100644 --- a/src/xrGame/ui/UIStatic.cpp +++ b/src/xrUICore/Static/UIStatic.cpp @@ -1,15 +1,13 @@ -#include "stdafx.h" -#include "uistatic.h" -#include "UIXmlInit.h" -#include "UITextureMaster.h" -#include "xrEngine/LightAnimLibrary.h" -#include "uilines.h" -#include "ui_base.h" +#include "pch.hpp" +#include "Windows/UIWindow.h" +#include "UIStatic.h" +#include "XML/UITextureMaster.h" +#include "xrEngine/LightAnimLibrary.h" +#include "Lines/uiLines.h" #include "Include/xrRender/UIRender.h" - -#include "UIBtnHint.h" -#include "UICursor.h" +#include "Buttons/UIBtnHint.h" +#include "Cursor/UICursor.h" bool is_in2(const Frect& b1, const Frect& b2); diff --git a/src/xrGame/ui/UIStatic.h b/src/xrUICore/Static/UIStatic.h similarity index 92% rename from src/xrGame/ui/UIStatic.h rename to src/xrUICore/Static/UIStatic.h index 3a4b094e761..d2c80eaffb4 100644 --- a/src/xrGame/ui/UIStatic.h +++ b/src/xrUICore/Static/UIStatic.h @@ -1,8 +1,8 @@ #pragma once -#include "UILanimController.h" -#include "UIStaticItem.h" - -#include "UILines.h" +#include "xrUICore/Static/UILanimController.h" +#include "xrUICore/Static/UIStaticItem.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Lines/UILines.h" class CUIFrameWindow; class CLAItem; @@ -23,9 +23,9 @@ struct lanim_cont_xf : public lanim_cont void set_defaults(); }; -class CUIStatic : public CUIWindow, public ITextureOwner, public CUILightAnimColorConrollerImpl +class XRUICORE_API CUIStatic : public CUIWindow, public ITextureOwner, public CUILightAnimColorConrollerImpl { - friend class CUIXmlInit; + friend class CUIXmlInitBase; private: typedef CUIWindow inherited; @@ -100,7 +100,7 @@ class CUIStatic : public CUIWindow, public ITextureOwner, public CUILightAnimCol shared_str m_stat_hint_text; }; -class CUITextWnd : public CUIWindow, public CUILightAnimColorConrollerImpl +class XRUICORE_API CUITextWnd : public CUIWindow, public CUILightAnimColorConrollerImpl { typedef CUIWindow inherited; CUILines m_lines; diff --git a/src/xrGame/UIStaticItem.cpp b/src/xrUICore/Static/UIStaticItem.cpp similarity index 97% rename from src/xrGame/UIStaticItem.cpp rename to src/xrUICore/Static/UIStaticItem.cpp index 738de1c2cba..d3ae44bc347 100644 --- a/src/xrGame/UIStaticItem.cpp +++ b/src/xrUICore/Static/UIStaticItem.cpp @@ -1,9 +1,8 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIStaticItem.h" -#include "ui_base.h" -void CreateUIGeom() { GEnv.UIRender->CreateUIGeom(); } -void DestroyUIGeom() { GEnv.UIRender->DestroyUIGeom(); } +XRUICORE_API void CreateUIGeom() { GEnv.UIRender->CreateUIGeom(); } +XRUICORE_API void DestroyUIGeom() { GEnv.UIRender->DestroyUIGeom(); } CUIStaticItem::CUIStaticItem() { uFlags.zero(); diff --git a/src/xrGame/UIStaticItem.h b/src/xrUICore/Static/UIStaticItem.h similarity index 96% rename from src/xrGame/UIStaticItem.h rename to src/xrUICore/Static/UIStaticItem.h index bd3255e97d0..fe1f011062e 100644 --- a/src/xrGame/UIStaticItem.h +++ b/src/xrUICore/Static/UIStaticItem.h @@ -1,12 +1,12 @@ #pragma once -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" #include "xrCore/_flags.h" #include "xrCore/_vector2.h" #ifdef DEBUG #include "xrCore/xrstring.h" #endif -class CUIStaticItem +class XRUICORE_API CUIStaticItem { protected: public: diff --git a/src/xrGame/ui/UIStatic_script.cpp b/src/xrUICore/Static/UIStatic_script.cpp similarity index 93% rename from src/xrGame/ui/UIStatic_script.cpp rename to src/xrUICore/Static/UIStatic_script.cpp index c89e36c4708..043c7896f13 100644 --- a/src/xrGame/ui/UIStatic_script.cpp +++ b/src/xrUICore/Static/UIStatic_script.cpp @@ -1,4 +1,4 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UIStatic.h" #include "UIAnimatedStatic.h" #include "xrScriptEngine/ScriptExporter.hpp" @@ -46,6 +46,3 @@ SCRIPT_EXPORT(CUITextWnd, (CUIWindow), { // .def("", &CUITextWnd::) ]; }); - -SCRIPT_EXPORT(CUISleepStatic, (CUIStatic), - { module(luaState)[class_("CUISleepStatic").def(constructor<>())]; }); diff --git a/src/xrGame/ui/UITabButton.cpp b/src/xrUICore/TabControl/UITabButton.cpp similarity index 93% rename from src/xrGame/ui/UITabButton.cpp rename to src/xrUICore/TabControl/UITabButton.cpp index af4798c18bf..7a190a273a0 100644 --- a/src/xrGame/ui/UITabButton.cpp +++ b/src/xrUICore/TabControl/UITabButton.cpp @@ -1,5 +1,6 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UITabButton.h" +#include "xrEngine\xr_input_xinput.h" CUITabButton::CUITabButton() {} CUITabButton::~CUITabButton() {} diff --git a/src/xrGame/ui/UITabButton.h b/src/xrUICore/TabControl/UITabButton.h similarity index 77% rename from src/xrGame/ui/UITabButton.h rename to src/xrUICore/TabControl/UITabButton.h index 46f2dee0dac..6a1c5950239 100644 --- a/src/xrGame/ui/UITabButton.h +++ b/src/xrUICore/TabControl/UITabButton.h @@ -1,7 +1,7 @@ #pragma once -#include "UI3tButton.h" +#include "xrUICore/Buttons/UI3tButton.h" -class CUITabButton : public CUI3tButton +class XRUICORE_API CUITabButton : public CUI3tButton { typedef CUI3tButton inherited; diff --git a/src/xrGame/ui/UITabControl.cpp b/src/xrUICore/TabControl/UITabControl.cpp similarity index 98% rename from src/xrGame/ui/UITabControl.cpp rename to src/xrUICore/TabControl/UITabControl.cpp index e172657b292..32b1538fd4a 100644 --- a/src/xrGame/ui/UITabControl.cpp +++ b/src/xrUICore/TabControl/UITabControl.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "pch.hpp" #include "UITabControl.h" #include "UITabButton.h" @@ -11,7 +11,6 @@ CUITabControl::CUITabControl() CUITabControl::~CUITabControl() { RemoveAll(); } void CUITabControl::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); shared_str v = GetOptStringValue(); CUITabButton* b = GetButtonById(v); if (NULL == b) @@ -38,7 +37,6 @@ void CUITabControl::UndoOptValue() void CUITabControl::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); m_opt_backup_value = GetActiveId(); } diff --git a/src/xrGame/ui/UITabControl.h b/src/xrUICore/TabControl/UITabControl.h similarity index 93% rename from src/xrGame/ui/UITabControl.h rename to src/xrUICore/TabControl/UITabControl.h index 0abd314ff32..c07633d9772 100644 --- a/src/xrGame/ui/UITabControl.h +++ b/src/xrUICore/TabControl/UITabControl.h @@ -1,14 +1,12 @@ #pragma once - -#include "uiwindow.h" - -#include "UIOptionsItem.h" +#include "xrUICore/Windows/UIWindow.h" +#include "xrUICore/Options/UIOptionsItem.h" class CUITabButton; using TABS_VECTOR = xr_vector; -class CUITabControl : public CUIWindow, public CUIOptionsItem +class XRUICORE_API CUITabControl : public CUIWindow, public CUIOptionsItem { typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UITabControl_script.cpp b/src/xrUICore/TabControl/UITabControl_script.cpp similarity index 97% rename from src/xrGame/ui/UITabControl_script.cpp rename to src/xrUICore/TabControl/UITabControl_script.cpp index b0633781cbc..211e2fe7096 100644 --- a/src/xrGame/ui/UITabControl_script.cpp +++ b/src/xrUICore/TabControl/UITabControl_script.cpp @@ -1,4 +1,4 @@ -#include "pch_script.h" +#include "pch.hpp" #include "UITabControl.h" #include "UITabButton.h" #include "xrScriptEngine/ScriptExporter.hpp" diff --git a/src/xrGame/ui/UITrackBar.cpp b/src/xrUICore/TrackBar/UITrackBar.cpp similarity index 97% rename from src/xrGame/ui/UITrackBar.cpp rename to src/xrUICore/TrackBar/UITrackBar.cpp index e2af6637e07..a0309be92e8 100644 --- a/src/xrGame/ui/UITrackBar.cpp +++ b/src/xrUICore/TrackBar/UITrackBar.cpp @@ -1,8 +1,7 @@ -#include "StdAfx.h" - +#include "pch.hpp" #include "UITrackBar.h" -#include "UI3tButton.h" -#include "UITextureMaster.h" +#include "Buttons/UI3tButton.h" +#include "XML/UITextureMaster.h" #include "xrEngine/xr_input.h" #define DEF_CONTROL_HEIGHT 16.0f @@ -122,7 +121,6 @@ void CUITrackBar::Update() void CUITrackBar::SetCurrentOptValue() { - CUIOptionsItem::SetCurrentOptValue(); if (m_b_is_float) GetOptFloatValue(m_f_val, m_f_min, m_f_max); else @@ -154,8 +152,6 @@ bool CUITrackBar::IsChangedOptValue() const void CUITrackBar::SaveBackUpOptValue() { - CUIOptionsItem::SaveBackUpOptValue(); - if (m_b_is_float) m_f_opt_backup_value = m_f_val; else diff --git a/src/xrGame/ui/UITrackBar.h b/src/xrUICore/TrackBar/UITrackBar.h similarity index 89% rename from src/xrGame/ui/UITrackBar.h rename to src/xrUICore/TrackBar/UITrackBar.h index cccb2be5b11..27758cb9d38 100644 --- a/src/xrGame/ui/UITrackBar.h +++ b/src/xrUICore/TrackBar/UITrackBar.h @@ -1,11 +1,10 @@ #pragma once - -#include "UIOptionsItem.h" -#include "UI_IB_Static.h" +#include "xrUICore/Options/UIOptionsItem.h" +#include "xrUICore/InteractiveBackground/UI_IB_Static.h" class CUI3tButton; -class CUITrackBar : public CUI_IB_FrameLineWnd, public CUIOptionsItem +class XRUICORE_API CUITrackBar : public CUI_IB_FrameLineWnd, public CUIOptionsItem { public: CUITrackBar(); diff --git a/src/xrGame/ui/UIMessages.h b/src/xrUICore/UIMessages.h similarity index 100% rename from src/xrGame/ui/UIMessages.h rename to src/xrUICore/UIMessages.h diff --git a/src/xrGame/ui/UIFrameLineWnd.cpp b/src/xrUICore/Windows/UIFrameLineWnd.cpp similarity index 99% rename from src/xrGame/ui/UIFrameLineWnd.cpp rename to src/xrUICore/Windows/UIFrameLineWnd.cpp index be03a435923..2609426635d 100644 --- a/src/xrGame/ui/UIFrameLineWnd.cpp +++ b/src/xrUICore/Windows/UIFrameLineWnd.cpp @@ -1,6 +1,6 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIFrameLineWnd.h" -#include "UITextureMaster.h" +#include "XML/UITextureMaster.h" CUIFrameLineWnd::CUIFrameLineWnd() : bHorizontal(true), m_bTextureVisible(false) { diff --git a/src/xrGame/ui/UIFrameLineWnd.h b/src/xrUICore/Windows/UIFrameLineWnd.h similarity index 95% rename from src/xrGame/ui/UIFrameLineWnd.h rename to src/xrUICore/Windows/UIFrameLineWnd.h index 137db0b8f23..1cd262b136a 100644 --- a/src/xrGame/ui/UIFrameLineWnd.h +++ b/src/xrUICore/Windows/UIFrameLineWnd.h @@ -1,8 +1,7 @@ #pragma once - #include "UIWindow.h" -class CUIFrameLineWnd : public CUIWindow +class XRUICORE_API CUIFrameLineWnd : public CUIWindow { typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIFrameWindow.cpp b/src/xrUICore/Windows/UIFrameWindow.cpp similarity index 98% rename from src/xrGame/ui/UIFrameWindow.cpp rename to src/xrUICore/Windows/UIFrameWindow.cpp index 0fdfd7bbc02..4a7e681f0c2 100644 --- a/src/xrGame/ui/UIFrameWindow.cpp +++ b/src/xrUICore/Windows/UIFrameWindow.cpp @@ -1,8 +1,7 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIFrameWindow.h" -#include "UITextureMaster.h" -#include "UIXmlInit.h" -#include "UIStatic.h" +#include "XML/UITextureMaster.h" +#include "Static/UIStatic.h" void draw_rect(Fvector2 LTp, Fvector2 RBp, Fvector2 LTt, Fvector2 RBt, u32 clr, Fvector2 const& ts); diff --git a/src/xrGame/ui/UIFrameWindow.h b/src/xrUICore/Windows/UIFrameWindow.h similarity index 92% rename from src/xrGame/ui/UIFrameWindow.h rename to src/xrUICore/Windows/UIFrameWindow.h index 91a7a2e7fad..08542d43677 100644 --- a/src/xrGame/ui/UIFrameWindow.h +++ b/src/xrUICore/Windows/UIFrameWindow.h @@ -1,7 +1,7 @@ #pragma once -#include "uiwindow.h" +#include "UIWindow.h" -class CUIFrameWindow : public CUIWindow, public ITextureOwner +class XRUICORE_API CUIFrameWindow : public CUIWindow, public ITextureOwner { typedef CUIWindow inherited; diff --git a/src/xrGame/ui/UIWindow.cpp b/src/xrUICore/Windows/UIWindow.cpp similarity index 88% rename from src/xrGame/ui/UIWindow.cpp rename to src/xrUICore/Windows/UIWindow.cpp index 70671283282..189acc21afb 100644 --- a/src/xrGame/ui/UIWindow.cpp +++ b/src/xrUICore/Windows/UIWindow.cpp @@ -1,35 +1,14 @@ -#include "stdafx.h" +#include "pch.hpp" #include "UIWindow.h" -#include "UICursor.h" -#include "MainMenu.h" +#include "Cursor/UICursor.h" #include "Include/xrRender/DebugRender.h" #include "Include/xrRender/UIRender.h" - -// #define LOG_ALL_WNDS -#ifdef LOG_ALL_WNDS -int ListWndCount = 0; -struct DBGList -{ - int num; - bool closed; -}; -xr_vector dbg_list_wnds; -void dump_list_wnd() -{ - Msg("------Total wnds %d", dbg_list_wnds.size()); - xr_vector::iterator _it = dbg_list_wnds.begin(); - for (; _it != dbg_list_wnds.end(); ++_it) - if (!(*_it).closed) - Msg("--leak detected ---- wnd = %d", (*_it).num); -} -#else -void dump_list_wnd() {} -#endif +#include "xrEngine\xr_input_xinput.h" xr_vector g_wnds_rects; BOOL g_show_wnd_rect2 = FALSE; -void clean_wnd_rects() +XRUICORE_API void clean_wnd_rects() { #ifdef DEBUG GEnv.DRender->DestroyDebugShader(IDebugRender::dbgShaderWindow); @@ -57,7 +36,8 @@ void draw_rect(Frect& r, u32 color) #endif // DEBUG } -void draw_wnds_rects() + +XRUICORE_API void draw_wnds_rects() { if (0 == g_wnds_rects.size()) return; @@ -76,35 +56,12 @@ void draw_wnds_rects() g_wnds_rects.clear(); } -void CUIWindow::SetPPMode() -{ - m_bPP = true; - MainMenu()->RegisterPPDraw(this); - Show(false); -}; - -void CUIWindow::ResetPPMode() -{ - if (GetPPMode()) - { - MainMenu()->UnregisterPPDraw(this); - m_bPP = false; - } -} - CUIWindow::CUIWindow() : m_pParentWnd(NULL), m_pMouseCapturer(NULL), m_pMessageTarget(NULL), m_pKeyboardCapturer(NULL), - m_bAutoDelete(false), m_bCursorOverWindow(false), m_bPP(false), m_dwFocusReceiveTime(0), m_bCustomDraw(false) + m_bAutoDelete(false), m_bCursorOverWindow(false), m_dwFocusReceiveTime(0), m_bCustomDraw(false) { Show(true); Enable(true); -#ifdef LOG_ALL_WNDS - ListWndCount++; - m_dbg_id = ListWndCount; - dbg_list_wnds.push_back(DBGList()); - dbg_list_wnds.back().num = m_dbg_id; - dbg_list_wnds.back().closed = false; -#endif } CUIWindow::~CUIWindow() @@ -117,31 +74,6 @@ CUIWindow::~CUIWindow() parent->CUIWindow::DetachChild(this); DetachAll(); - - if (GetPPMode()) - MainMenu()->UnregisterPPDraw(this); - -#ifdef LOG_ALL_WNDS - xr_vector::iterator _it = dbg_list_wnds.begin(); - bool bOK = false; - for (; _it != dbg_list_wnds.end(); ++_it) - { - if ((*_it).num == m_dbg_id && !(*_it).closed) - { - bOK = true; - (*_it).closed = true; - dbg_list_wnds.erase(_it); - break; - } - if ((*_it).num == m_dbg_id && (*_it).closed) - { - Msg("--CUIWindow [%d] already deleted", m_dbg_id); - bOK = true; - } - } - if (!bOK) - Msg("CUIWindow::~CUIWindow.[%d] cannot find window in list", m_dbg_id); -#endif } void CUIWindow::Draw() diff --git a/src/xrGame/ui/UIWindow.h b/src/xrUICore/Windows/UIWindow.h similarity index 94% rename from src/xrGame/ui/UIWindow.h rename to src/xrUICore/Windows/UIWindow.h index cc156aee3d1..d4c6f5ea3eb 100644 --- a/src/xrGame/ui/UIWindow.h +++ b/src/xrUICore/Windows/UIWindow.h @@ -1,7 +1,5 @@ #pragma once -#include "xr_level_controller.h" -//#define xr_list xr_list #define ui_list xr_vector #define DEF_UILIST(N, T) \ @@ -10,10 +8,10 @@ ////////////////////////////////////////////////////////////////////////// -#include "UIMessages.h" -#include "uiabstract.h" +#include "xrUICore/UIMessages.h" +#include "xrUICore/uiabstract.h" -class CUIWindow : public CUISimpleWindow +class XRUICORE_API CUIWindow : public CUISimpleWindow { public: CUIWindow(); @@ -98,9 +96,6 @@ class CUIWindow : public CUISimpleWindow //обновление окна передпрорисовкой virtual void Update(); - void SetPPMode(); - void ResetPPMode(); - IC bool GetPPMode() { return m_bPP; }; //для перевода окна и потомков в исходное состояние virtual void Reset(); void ResetAll(); @@ -155,7 +150,6 @@ class CUIWindow : public CUISimpleWindow //флаг автоматического удаления во время вызова деструктора bool m_bAutoDelete; - bool m_bPP; bool m_bIsEnabled; // Если курсор над окном @@ -167,4 +161,5 @@ class CUIWindow : public CUISimpleWindow #endif }; -bool fit_in_rect(CUIWindow* w, Frect const& vis_rect, float border = 0.0f, float dx16pos = 0.0f); +XRUICORE_API extern BOOL g_show_wnd_rect2; +XRUICORE_API bool fit_in_rect(CUIWindow* w, Frect const& vis_rect, float border = 0.0f, float dx16pos = 0.0f); diff --git a/src/xrUICore/Windows/UIWindow_script.cpp b/src/xrUICore/Windows/UIWindow_script.cpp new file mode 100644 index 00000000000..c7cd76ea92d --- /dev/null +++ b/src/xrUICore/Windows/UIWindow_script.cpp @@ -0,0 +1,186 @@ +#include "pch.hpp" +#include "UIWindow.h" +#include "UIFrameWindow.h" +#include "UIFrameLineWnd.h" +#include "XML/UITextureMaster.h" +#include "ScrollView/UIScrollView.h" +#include "Hint/UIHint.h" +#include "Cursor/UICursor.h" +#include "xrScriptEngine/ScriptExporter.hpp" + +CFontManager& mngr() { return UI().Font(); } +// hud font +CGameFont* GetFontSmall() { return mngr().pFontStat; } +CGameFont* GetFontMedium() { return mngr().pFontMedium; } +CGameFont* GetFontDI() { return mngr().pFontDI; } +//шрифты для интерфейса +CGameFont* GetFontGraffiti19Russian() { return mngr().pFontGraffiti19Russian; } +CGameFont* GetFontGraffiti22Russian() { return mngr().pFontGraffiti22Russian; } +CGameFont* GetFontLetterica16Russian() { return mngr().pFontLetterica16Russian; } +CGameFont* GetFontLetterica18Russian() { return mngr().pFontLetterica18Russian; } +CGameFont* GetFontGraffiti32Russian() { return mngr().pFontGraffiti32Russian; } +CGameFont* GetFontGraffiti50Russian() { return mngr().pFontGraffiti50Russian; } +CGameFont* GetFontLetterica25() { return mngr().pFontLetterica25; } +int GetARGB(u16 a, u16 r, u16 g, u16 b) { return color_argb(a, r, g, b); } +const Fvector2 get_wnd_pos(CUIWindow* w) { return w->GetWndPos(); } + +Fvector2 GetCursorPosition_script() { return GetUICursor().GetCursorPosition(); } + +void SetCursorPosition_script(Fvector2& pos) { GetUICursor().SetUICursorPosition(pos); } + +using namespace luabind; +using namespace luabind::policy; + +// clang-format off +SCRIPT_EXPORT(CUIWindow, (), { + module(luaState) + [ + def("GetARGB", &GetARGB), def("GetFontSmall", &GetFontSmall), def("GetFontMedium", &GetFontMedium), + def("GetFontDI", &GetFontDI), def("GetFontGraffiti19Russian", &GetFontGraffiti19Russian), + def("GetFontGraffiti22Russian", &GetFontGraffiti22Russian), + def("GetFontLetterica16Russian", &GetFontLetterica16Russian), + def("GetFontLetterica18Russian", &GetFontLetterica18Russian), + def("GetFontGraffiti32Russian", &GetFontGraffiti32Russian), + def("GetFontGraffiti50Russian", &GetFontGraffiti50Russian), + def("GetFontLetterica25", &GetFontLetterica25), + def("GetCursorPosition", &GetCursorPosition_script), + def("SetCursorPosition", &SetCursorPosition_script), + def("FitInRect", &fit_in_rect), + + class_("CUIWindow") + .def(constructor<>()) + .def("AttachChild", &CUIWindow::AttachChild, adopt<2>()) + .def("DetachChild", &CUIWindow::DetachChild) + .def("SetAutoDelete", &CUIWindow::SetAutoDelete) + .def("IsAutoDelete", &CUIWindow::IsAutoDelete) + + .def("IsCursorOverWindow", &CUIWindow::CursorOverWindow) + .def("FocusReceiveTime", &CUIWindow::FocusReceiveTime) + .def("GetAbsoluteRect", &CUIWindow::GetAbsoluteRect) + + .def("SetWndRect", (void (CUIWindow::*)(Frect)) & CUIWindow::SetWndRect_script) + .def("SetWndPos", (void (CUIWindow::*)(Fvector2)) & CUIWindow::SetWndPos_script) + .def("SetWndSize", (void (CUIWindow::*)(Fvector2)) & CUIWindow::SetWndSize_script) + .def("GetWndPos", &get_wnd_pos) + .def("GetWidth", &CUIWindow::GetWidth) + .def("GetHeight", &CUIWindow::GetHeight) + + .def("Enable", &CUIWindow::Enable) + .def("IsEnabled", &CUIWindow::IsEnabled) + .def("Show", &CUIWindow::Show) + .def("IsShown", &CUIWindow::IsShown) + + .def("WindowName", &CUIWindow::WindowName_script) + .def("SetWindowName", &CUIWindow::SetWindowName) + ]; +}); + +SCRIPT_EXPORT(CUIFrameWindow, (CUIWindow), { + module(luaState)[class_("CUIFrameWindow") + .def(constructor<>()) + .def("SetWidth", &CUIFrameWindow::SetWidth) + .def("SetHeight", &CUIFrameWindow::SetHeight) + .def("SetColor", &CUIFrameWindow::SetTextureColor)]; +}); + +SCRIPT_EXPORT(CUIFrameLineWnd, (CUIWindow), { + module(luaState)[class_("CUIFrameLineWnd") + .def(constructor<>()) + .def("SetWidth", &CUIFrameLineWnd::SetWidth) + .def("SetHeight", &CUIFrameLineWnd::SetHeight) + .def("SetColor", &CUIFrameLineWnd::SetTextureColor)]; +}); + +SCRIPT_EXPORT(UIHint, (CUIWindow), { + module(luaState) + [ + class_("UIHint") + .def(constructor<>()) + .def("SetWidth", &UIHint::SetWidth) + .def("SetHeight", &UIHint::SetHeight) + .def("SetHintText", &UIHint::set_text) + .def("GetHintText", &UIHint::get_text) + ]; +}); + +SCRIPT_EXPORT(CUIScrollView, (CUIWindow), { + module(luaState) + [ + class_("CUIScrollView") + .def(constructor<>()) + .def("AddWindow", &CUIScrollView::AddWindow) + .def("RemoveWindow", &CUIScrollView::RemoveWindow) + .def("Clear", &CUIScrollView::Clear) + .def("ScrollToBegin", &CUIScrollView::ScrollToBegin) + .def("ScrollToEnd", &CUIScrollView::ScrollToEnd) + .def("GetMinScrollPos", &CUIScrollView::GetMinScrollPos) + .def("GetMaxScrollPos", &CUIScrollView::GetMaxScrollPos) + .def("GetCurrentScrollPos", &CUIScrollView::GetCurrentScrollPos) + .def("SetFixedScrollBar", &CUIScrollView::SetFixedScrollBar) + .def("SetScrollPos", &CUIScrollView::SetScrollPos) + ]; +}); + +SCRIPT_EXPORT(EnumUIMessages, (), { + class EnumUIMessages + { + }; + module(luaState) + [ + class_("ui_events") + .enum_("events") + [ + // CUIWindow + value("WINDOW_LBUTTON_DOWN", int(WINDOW_LBUTTON_DOWN)), + value("WINDOW_RBUTTON_DOWN", int(WINDOW_RBUTTON_DOWN)), + value("WINDOW_LBUTTON_UP", int(WINDOW_LBUTTON_UP)), + value("WINDOW_RBUTTON_UP", int(WINDOW_RBUTTON_UP)), + value("WINDOW_MOUSE_MOVE", int(WINDOW_MOUSE_MOVE)), + value("WINDOW_LBUTTON_DB_CLICK", int(WINDOW_LBUTTON_DB_CLICK)), + value("WINDOW_KEY_PRESSED", int(WINDOW_KEY_PRESSED)), + value("WINDOW_KEY_RELEASED", int(WINDOW_KEY_RELEASED)), + value("WINDOW_KEYBOARD_CAPTURE_LOST", int(WINDOW_KEYBOARD_CAPTURE_LOST)), + + // CUIButton + value("BUTTON_CLICKED", int(BUTTON_CLICKED)), value("BUTTON_DOWN", int(BUTTON_DOWN)), + + // CUITabControl + value("TAB_CHANGED", int(TAB_CHANGED)), + + // CUICheckButton + value("CHECK_BUTTON_SET", int(CHECK_BUTTON_SET)), + value("CHECK_BUTTON_RESET", int(CHECK_BUTTON_RESET)), + + // CUIRadioButton + value("RADIOBUTTON_SET", int(RADIOBUTTON_SET)), + + // CUIScrollBox + value("SCROLLBOX_MOVE", int(SCROLLBOX_MOVE)), + + // CUIScrollBar + value("SCROLLBAR_VSCROLL", int(SCROLLBAR_VSCROLL)), + value("SCROLLBAR_HSCROLL", int(SCROLLBAR_HSCROLL)), + + // CUIListWnd + value("LIST_ITEM_CLICKED", int(LIST_ITEM_CLICKED)), + value("LIST_ITEM_SELECT", int(LIST_ITEM_SELECT)), + + // UIPropertiesBox + value("PROPERTY_CLICKED", int(PROPERTY_CLICKED)), + + // CUIMessageBox + value("MESSAGE_BOX_OK_CLICKED", int(MESSAGE_BOX_OK_CLICKED)), + value("MESSAGE_BOX_YES_CLICKED", int(MESSAGE_BOX_YES_CLICKED)), + value("MESSAGE_BOX_NO_CLICKED", int(MESSAGE_BOX_NO_CLICKED)), + value("MESSAGE_BOX_CANCEL_CLICKED", int(MESSAGE_BOX_CANCEL_CLICKED)), + value("MESSAGE_BOX_COPY_CLICKED", int(MESSAGE_BOX_COPY_CLICKED)), + value("MESSAGE_BOX_QUIT_GAME_CLICKED", int(MESSAGE_BOX_QUIT_GAME_CLICKED)), + value("MESSAGE_BOX_QUIT_WIN_CLICKED", int(MESSAGE_BOX_QUIT_WIN_CLICKED)), + + value("EDIT_TEXT_COMMIT", int(EDIT_TEXT_COMMIT)), + // CMainMenu + value("MAIN_MENU_RELOADED", int(MAIN_MENU_RELOADED)) + ] + ]; +}); +// clang-format on diff --git a/src/xrGame/ui/UITextureMaster.cpp b/src/xrUICore/XML/UITextureMaster.cpp similarity index 98% rename from src/xrGame/ui/UITextureMaster.cpp rename to src/xrUICore/XML/UITextureMaster.cpp index bab3276a80d..745bc48a13d 100644 --- a/src/xrGame/ui/UITextureMaster.cpp +++ b/src/xrUICore/XML/UITextureMaster.cpp @@ -7,9 +7,9 @@ // // copyright 2005 GSC Game World -#include "StdAfx.h" +#include "pch.hpp" #include "UITextureMaster.h" -#include "UIStaticItem.h" +#include "Static/UIStaticItem.h" #include "uiabstract.h" #include "xrUIXmlParser.h" #include "Include/xrRender/UIShader.h" diff --git a/src/xrGame/ui/UITextureMaster.h b/src/xrUICore/XML/UITextureMaster.h similarity index 96% rename from src/xrGame/ui/UITextureMaster.h rename to src/xrUICore/XML/UITextureMaster.h index a39082e903b..ae41c9a9d33 100644 --- a/src/xrGame/ui/UITextureMaster.h +++ b/src/xrUICore/XML/UITextureMaster.h @@ -10,7 +10,7 @@ #pragma once class CUIStaticItem; -#include "ui_defs.h" +#include "xrUICore/ui_defs.h" struct TEX_INFO { @@ -33,7 +33,7 @@ struct sh_pair } }; -class CUITextureMaster +class XRUICORE_API CUITextureMaster { public: static void ParseShTexInfo(LPCSTR xml_file); diff --git a/src/xrUICore/XML/UIXmlInitBase.cpp b/src/xrUICore/XML/UIXmlInitBase.cpp new file mode 100644 index 00000000000..4e5ef5ad50e --- /dev/null +++ b/src/xrUICore/XML/UIXmlInitBase.cpp @@ -0,0 +1,1215 @@ +#include "pch.hpp" +#include "UIXmlInitBase.h" +#include "xrEngine/StringTable/IStringTable.h" +#include "Windows/UIFrameWindow.h" +#include "Buttons/UICheckButton.h" +#include "SpinBox/UICustomSpin.h" +#include "Buttons/UIRadioButton.h" +#include "ProgressBar/UIProgressBar.h" +#include "ProgressBar/UIProgressShape.h" +#include "TabControl/UITabControl.h" +#include "Static/UIAnimatedStatic.h" +#include "ListBox/UIListBox.h" +#include "ComboBox/UIComboBox.h" +#include "TrackBar/UITrackBar.h" + +#include "UITextureMaster.h" +#include "Lines/UILines.h" +#include "xrEngine/xr_input_xinput.h" + +#define ARIAL_FONT_NAME "arial" + +#define MEDIUM_FONT_NAME "medium" +#define SMALL_FONT_NAME "small" + +#define GRAFFITI19_FONT_NAME "graffiti19" +#define GRAFFITI22_FONT_NAME "graffiti22" +#define GRAFFITI32_FONT_NAME "graffiti32" +#define GRAFFITI50_FONT_NAME "graffiti50" + +#define LETTERICA16_FONT_NAME "letterica16" +#define LETTERICA18_FONT_NAME "letterica18" +#define LETTERICA25_FONT_NAME "letterica25" + +#define DI_FONT_NAME "di" + +////////////////////////////////////////////////////////////////////////// + +const char* const COLOR_DEFINITIONS = "color_defs.xml"; +CUIXmlInitBase::ColorDefs* CUIXmlInitBase::m_pColorDefs = NULL; + +////////////////////////////////////////////////////////////////////////// + +CUIXmlInitBase::CUIXmlInitBase() { InitColorDefs(); } +////////////////////////////////////////////////////////////////////////// + +CUIXmlInitBase::~CUIXmlInitBase() {} +////////////////////////////////////////////////////////////////////////// + +Frect CUIXmlInitBase::GetFRect(CUIXml& xml_doc, LPCSTR path, int index) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + Frect rect; + rect.set(0, 0, 0, 0); + rect.x1 = xml_doc.ReadAttribFlt(path, index, "x"); + rect.y1 = xml_doc.ReadAttribFlt(path, index, "y"); + rect.x2 = rect.x1 + xml_doc.ReadAttribFlt(path, index, "width"); + rect.y2 = rect.y1 + xml_doc.ReadAttribFlt(path, index, "height"); + + return rect; +} + +bool CUIXmlInitBase::InitWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + Fvector2 pos, size; + pos.x = xml_doc.ReadAttribFlt(path, index, "x"); + pos.y = xml_doc.ReadAttribFlt(path, index, "y"); + InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); + size.x = xml_doc.ReadAttribFlt(path, index, "width"); + size.y = xml_doc.ReadAttribFlt(path, index, "height"); + pWnd->SetWndPos(pos); + pWnd->SetWndSize(size); + + string512 buf; + + strconcat(sizeof(buf), buf, path, ":window_name"); + if (xml_doc.NavigateToNode(buf, index)) + pWnd->SetWindowName(xml_doc.Read(buf, index, NULL)); + + InitAutoStaticGroup(xml_doc, path, index, pWnd); + //. InitAutoFrameLineGroup (xml_doc, path, index, pWnd); + + return true; +} + +////////////////////////////////////////////////////////////////////////// + +bool CUIXmlInitBase::InitFrameWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameWindow* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitTexture(xml_doc, path, index, pWnd); + InitWindow(xml_doc, path, index, pWnd); + return true; +} + +bool CUIXmlInitBase::InitOptionsItem(CUIXml& xml_doc, LPCSTR path, int index, CUIOptionsItem* pWnd) +{ + string256 buf; + strconcat(sizeof(buf), buf, path, ":options_item"); + + if (xml_doc.NavigateToNode(buf, index)) + { + shared_str entry = xml_doc.ReadAttrib(buf, index, "entry"); + shared_str group = xml_doc.ReadAttrib(buf, index, "group"); + pWnd->AssignProps(entry, group); + + LPCSTR depends = xml_doc.ReadAttrib(buf, index, "depend", NULL); + if (depends) + { + CUIOptionsItem::ESystemDepends d = CUIOptionsItem::sdNothing; + + if (0 == xr_stricmp(depends, "vid")) + d = CUIOptionsItem::sdVidRestart; + else if (0 == xr_stricmp(depends, "snd")) + d = CUIOptionsItem::sdSndRestart; + else if (0 == xr_stricmp(depends, "ui")) + d = CUIOptionsItem::sdUIRestart; + else if (0 == xr_stricmp(depends, "restart")) + d = CUIOptionsItem::sdSystemRestart; + else if (0 == xr_stricmp(depends, "runtime")) + d = CUIOptionsItem::sdApplyOnChange; + else + Msg("! unknown param [%s] in optionsItem [%s]", depends, entry.c_str()); + + pWnd->SetSystemDepends(d); + } + return true; + } + else + return false; +} + +bool CUIXmlInitBase::InitStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitWindow(xml_doc, path, index, pWnd); + + string256 buf; + InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, pWnd); + InitTexture(xml_doc, path, index, pWnd); + InitTextureOffset(xml_doc, path, index, pWnd); + + int flag = xml_doc.ReadAttribInt(path, index, "heading", 0); + pWnd->EnableHeading((flag) ? true : false); + + float heading_angle = xml_doc.ReadAttribFlt(path, index, "heading_angle", 0.0f); + if (!fis_zero(heading_angle)) + { + pWnd->EnableHeading(true); + pWnd->SetConstHeading(true); + pWnd->SetHeading(deg2rad(heading_angle)); + } + + LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", ""); + int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1); + int flag_text = xml_doc.ReadAttribInt(path, index, "la_text", 1); + int flag_texture = xml_doc.ReadAttribInt(path, index, "la_texture", 1); + int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0); + + u8 flags = 0; + if (flag_cyclic) + flags |= LA_CYCLIC; + if (flag_alpha) + flags |= LA_ONLYALPHA; + if (flag_text) + flags |= LA_TEXTCOLOR; + if (flag_texture) + flags |= LA_TEXTURECOLOR; + + pWnd->SetColorAnimation(str_flag, flags); + + str_flag = xml_doc.ReadAttrib(path, index, "xform_anim", ""); + flag_cyclic = xml_doc.ReadAttribInt(path, index, "xform_anim_cyclic", 1); + + pWnd->SetXformLightAnim(str_flag, (flag_cyclic) ? true : false); + + bool bComplexMode = xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false; + if (bComplexMode) + pWnd->TextItemControl()->SetTextComplexMode(bComplexMode); + + pWnd->m_stat_hint_text = xml_doc.ReadAttrib(path, index, "hint", ""); + + return true; +} + +bool CUIXmlInitBase::InitTextWnd(CUIXml& xml_doc, LPCSTR path, int index, CUITextWnd* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitWindow(xml_doc, path, index, pWnd); + + string256 buf; + InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, &pWnd->TextItemControl()); + + LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", ""); + int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1); + int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0); + + u8 flags = LA_TEXTCOLOR; + if (flag_cyclic) + flags |= LA_CYCLIC; + if (flag_alpha) + flags |= LA_ONLYALPHA; + pWnd->SetColorAnimation(str_flag, flags); + + bool bComplexMode = xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false; + if (bComplexMode) + pWnd->SetTextComplexMode(bComplexMode); + + strconcat(sizeof(buf), buf, path, ":texture"); + R_ASSERT3(NULL == xml_doc.NavigateToNode(buf, index), xml_doc.m_xml_file_name, buf); + + R_ASSERT(pWnd->GetChildWndList().size() == 0); + return true; +} + +bool CUIXmlInitBase::InitCheck(CUIXml& xml_doc, LPCSTR path, int index, CUICheckButton* pWnd) +{ + InitStatic(xml_doc, path, index, pWnd); + + string256 buf; + strconcat(sizeof(buf), buf, path, ":texture"); + LPCSTR texture = xml_doc.Read(buf, index, "ui_checker"); + + pWnd->InitCheckButton(pWnd->GetWndPos(), pWnd->GetWndSize(), texture); + + u32 color; + strconcat(sizeof(buf), buf, path, ":text_color:e"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Enabled); + } + + strconcat(sizeof(buf), buf, path, ":text_color:d"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Disabled); + } + + strconcat(sizeof(buf), buf, path, ":text_color:t"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Touched); + } + + strconcat(sizeof(buf), buf, path, ":text_color:h"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Highlighted); + } + + InitOptionsItem(xml_doc, path, index, pWnd); + + return true; +} + +bool CUIXmlInitBase::InitSpin(CUIXml& xml_doc, LPCSTR path, int index, CUICustomSpin* pWnd) +{ + InitWindow(xml_doc, path, index, pWnd); + InitOptionsItem(xml_doc, path, index, pWnd); + pWnd->InitSpin(pWnd->GetWndPos(), pWnd->GetWndSize()); + + string256 foo; + u32 color; + strconcat(sizeof(foo), foo, path, ":text_color:e"); + if (xml_doc.NavigateToNode(foo, index)) + { + color = GetColor(xml_doc, foo, index, 0x00); + pWnd->SetTextColor(color); + } + strconcat(sizeof(foo), foo, path, ":text_color:d"); + if (xml_doc.NavigateToNode(foo, index)) + { + color = GetColor(xml_doc, foo, index, 0x00); + pWnd->SetTextColorD(color); + } + + return true; +} + +bool CUIXmlInitBase::InitText(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) +{ + if (!xml_doc.NavigateToNode(path, index)) + return false; + + return InitText(xml_doc, path, index, pWnd->TextItemControl()); +} + +bool CUIXmlInitBase::InitText(CUIXml& xml_doc, LPCSTR path, int index, CUILines* pLines) +{ + if (!xml_doc.NavigateToNode(path, index)) + return false; + + u32 color; + CGameFont* pTmpFont = NULL; + InitFont(xml_doc, path, index, color, pTmpFont); + pLines->SetTextColor(color); + R_ASSERT(pTmpFont); + pLines->SetFont(pTmpFont); + + // Load font alignment + shared_str al = xml_doc.ReadAttrib(path, index, "align"); + if (0 == xr_strcmp(al, "c")) + pLines->SetTextAlignment(CGameFont::alCenter); + else if (0 == xr_strcmp(al, "r")) + pLines->SetTextAlignment(CGameFont::alRight); + else if (0 == xr_strcmp(al, "l")) + pLines->SetTextAlignment(CGameFont::alLeft); + + al = xml_doc.ReadAttrib(path, index, "vert_align", ""); + + if (0 == xr_strcmp(al, "c")) + pLines->SetVTextAlignment(valCenter); + else if (0 == xr_strcmp(al, "b")) + pLines->SetVTextAlignment(valBotton); + else if (0 == xr_strcmp(al, "t")) + pLines->SetVTextAlignment(valTop); + + pLines->SetTextComplexMode(xml_doc.ReadAttribInt(path, index, "complex_mode", 0) ? true : false); + + // Text coordinates + float text_x = xml_doc.ReadAttribFlt(path, index, "x", 0); + float text_y = xml_doc.ReadAttribFlt(path, index, "y", 0); + + pLines->m_TextOffset.set(text_x, text_y); + + shared_str text = xml_doc.Read(path, index, NULL); + if (text.size()) + pLines->SetText(gStringTable->translate(text).c_str()); + + return true; +} + +bool CUIXmlInitBase::Init3tButton(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + pWnd->m_frameline_mode = (xml_doc.ReadAttribInt(path, index, "frame_mode", 0) == 1) ? true : false; + + pWnd->vertical = (xml_doc.ReadAttribInt(path, index, "vertical", 0) == 1) ? true : false; + + InitWindow(xml_doc, path, index, pWnd); + pWnd->InitButton(pWnd->GetWndPos(), pWnd->GetWndSize()); + + string256 buf; + InitText(xml_doc, strconcat(sizeof(buf), buf, path, ":text"), index, pWnd); + u32 color; + + strconcat(sizeof(buf), buf, path, ":text_color:e"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Enabled); + } + + strconcat(sizeof(buf), buf, path, ":text_color:d"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Disabled); + } + + strconcat(sizeof(buf), buf, path, ":text_color:t"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Touched); + } + + strconcat(sizeof(buf), buf, path, ":text_color:h"); + if (xml_doc.NavigateToNode(buf, index)) + { + color = GetColor(xml_doc, buf, index, 0x00); + pWnd->SetStateTextColor(color, S_Highlighted); + } + + InitMultiTexture(xml_doc, path, index, pWnd); + InitTextureOffset(xml_doc, path, index, pWnd); + InitSound(xml_doc, path, index, pWnd); + + LPCSTR accel = xml_doc.ReadAttrib(path, index, "accel", NULL); + if (accel) + { + int acc = keyname_to_dik(accel); + pWnd->SetAccelerator(acc, 0); + } + accel = xml_doc.ReadAttrib(path, index, "accel_ext", NULL); + if (accel) + { + int acc = keyname_to_dik(accel); + pWnd->SetAccelerator(acc, 1); + } + + LPCSTR text_hint = xml_doc.ReadAttrib(path, index, "hint", NULL); + if (text_hint) + pWnd->m_hint_text = gStringTable->translate(text_hint); + + return true; +} + +bool CUIXmlInitBase::InitSound(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) +{ + string256 sound_h; + string256 sound_t; + strconcat(sizeof(sound_h), sound_h, path, ":sound_h"); + strconcat(sizeof(sound_t), sound_t, path, ":sound_t"); + + shared_str sound_h_result = xml_doc.Read(sound_h, index, ""); + shared_str sound_t_result = xml_doc.Read(sound_t, index, ""); + + if (xr_strlen(sound_h_result) != 0) + pWnd->InitSoundH(*sound_h_result); + + if (xr_strlen(sound_t_result) != 0) + pWnd->InitSoundT(*sound_t_result); + + return true; +} + +bool CUIXmlInitBase::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressBar* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitAutoStaticGroup(xml_doc, path, index, pWnd); + + string256 buf; + Fvector2 pos, size; + pos.x = xml_doc.ReadAttribFlt(path, index, "x"); + pos.y = xml_doc.ReadAttribFlt(path, index, "y"); + + InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); + + size.x = xml_doc.ReadAttribFlt(path, index, "width"); + size.y = xml_doc.ReadAttribFlt(path, index, "height"); + + CUIProgressBar::EOrientMode mode = CUIProgressBar::om_vert; + int mode_horz = xml_doc.ReadAttribInt(path, index, "horz", 0); + LPCSTR mode_str = xml_doc.ReadAttrib(path, index, "mode"); + if (mode_horz == 1) // om_horz + { + mode = CUIProgressBar::om_horz; + } + else if (xr_stricmp(mode_str, "horz") == 0) + { + mode = CUIProgressBar::om_horz; + } + else if (xr_stricmp(mode_str, "vert") == 0) + { + mode = CUIProgressBar::om_vert; + } + else if (xr_stricmp(mode_str, "back") == 0) + { + mode = CUIProgressBar::om_back; + } + else if (xr_stricmp(mode_str, "down") == 0) + { + mode = CUIProgressBar::om_down; + } + else if (xr_stricmp(mode_str, "from_center") == 0) + { + mode = CUIProgressBar::om_fromcenter; + } + else if (xr_stricmp(mode_str, "vert_from_center") == 0) + { + mode = CUIProgressBar::om_vfromcenter; + } + else if (xr_stricmp(mode_str, "to_center") == 0) + { + mode = CUIProgressBar::om_tocenter; + } + else if (xr_stricmp(mode_str, "vert_to_center") == 0) + { + mode = CUIProgressBar::om_vtocenter; + } + + pWnd->InitProgressBar(pos, size, mode); + + float min = xml_doc.ReadAttribFlt(path, index, "min"); + float max = xml_doc.ReadAttribFlt(path, index, "max"); + float ppos = xml_doc.ReadAttribFlt(path, index, "pos"); + + pWnd->SetRange(min, max); + pWnd->SetProgressPos(ppos); + pWnd->m_inertion = xml_doc.ReadAttribFlt(path, index, "inertion", 0.0f); + pWnd->colorSmoothing = xml_doc.ReadAttribInt(path, index, "color_smoothing"); + + // progress + strconcat(sizeof(buf), buf, path, ":progress"); + + if (!xml_doc.NavigateToNode(buf, index)) + return false; + + InitStatic(xml_doc, buf, index, &pWnd->m_UIProgressItem); + + pWnd->m_UIProgressItem.SetWndSize(pWnd->GetWndSize()); + + // background + strconcat(sizeof(buf), buf, path, ":background"); + + if (xml_doc.NavigateToNode(buf, index)) + { + InitStatic(xml_doc, buf, index, &pWnd->m_UIBackgroundItem); + pWnd->m_bBackgroundPresent = true; + pWnd->m_UIBackgroundItem.SetWndSize(pWnd->GetWndSize()); + } + + strconcat(sizeof(buf), buf, path, ":min_color"); + + if (xml_doc.NavigateToNode(buf, index)) + { + pWnd->m_bUseColor = true; + + u32 color = GetColor(xml_doc, buf, index, 0xff); + pWnd->m_minColor.set(color); + + strconcat(sizeof(buf), buf, path, ":middle_color"); + + color = GetColor(xml_doc, buf, index, 0xff); + pWnd->m_middleColor.set(color); + + strconcat(sizeof(buf), buf, path, ":max_color"); + + color = GetColor(xml_doc, buf, index, 0xff); + pWnd->m_maxColor.set(color); + } + + return true; +} + +bool CUIXmlInitBase::InitProgressShape(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressShape* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitStatic(xml_doc, path, index, pWnd); + + if (xml_doc.ReadAttribInt(path, index, "text")) + pWnd->SetTextVisible(true); + + string256 _path; + + if (xml_doc.NavigateToNode(strconcat(sizeof(_path), _path, path, ":back"), index)) + { + R_ASSERT2(0, "unused node in progress shape "); + } + + if (xml_doc.NavigateToNode(strconcat(sizeof(_path), _path, path, ":front"), index)) + { + R_ASSERT2(0, "unused node in progress shape "); + } + // InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":front"), index, pWnd->m_pTexture); + + pWnd->m_sectorCount = xml_doc.ReadAttribInt(path, index, "sector_count", 8); + pWnd->m_bClockwise = xml_doc.ReadAttribInt(path, index, "clockwise") ? true : false; + + pWnd->m_blend = (xml_doc.ReadAttribInt(path, index, "blend", 1) == 1) ? true : false; + pWnd->m_angle_begin = xml_doc.ReadAttribFlt(path, index, "begin_angle", 0.0f); + pWnd->m_angle_end = xml_doc.ReadAttribFlt(path, index, "end_angle", PI_MUL_2); + + return true; +} + +void CUIXmlInitBase::InitAutoStaticGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd) +{ + XML_NODE _stored_root = xml_doc.GetLocalRoot(); + xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); + + XML_NODE curr_root = xml_doc.GetLocalRoot(); + if (!curr_root) + curr_root = xml_doc.GetRoot(); + + XML_NODE node = curr_root.firstChild(); + int cnt_static = 0; + int cnt_frameline = 0; + int cnt_text = 0; + string512 buff; + + while (node) + { + LPCSTR node_name = node.value(); + if (0 == xr_stricmp(node_name, "auto_static")) + { + CUIStatic* pUIStatic = new CUIStatic(); + InitStatic(xml_doc, "auto_static", cnt_static, pUIStatic); + xr_sprintf(buff, "auto_static_%d", cnt_static); + pUIStatic->SetWindowName(buff); + pUIStatic->SetAutoDelete(true); + pParentWnd->AttachChild(pUIStatic); + + ++cnt_static; + } + else if (0 == xr_stricmp(node_name, "auto_frameline")) + { + CUIFrameLineWnd* pUIFrameline = new CUIFrameLineWnd(); + InitFrameLine(xml_doc, "auto_frameline", cnt_frameline, pUIFrameline); + xr_sprintf(buff, "auto_frameline_%d", cnt_frameline); + pUIFrameline->SetWindowName(buff); + pUIFrameline->SetAutoDelete(true); + pParentWnd->AttachChild(pUIFrameline); + + ++cnt_frameline; + } + else if (0 == xr_stricmp(node_name, "auto_text")) + { + ++cnt_text; + } + node = node.nextSibling(); + } + /* + CUIStatic* pUIStatic = NULL; + string64 sname; + for(int i=0; iSetWindowName (sname); + pUIStatic->SetAutoDelete (true); + pParentWnd->AttachChild (pUIStatic); + pUIStatic = NULL; + } + */ + xml_doc.SetLocalRoot(_stored_root); +} + +void CUIXmlInitBase::InitAutoFrameLineGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd) +{ + int items_num = xml_doc.GetNodesNum(path, index, "auto_frameline"); + if (items_num == 0) + { + return; + } + XML_NODE _stored_root = xml_doc.GetLocalRoot(); + xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); + + CUIFrameLineWnd* pUIFL = NULL; + string64 sname; + for (int i = 0; i < items_num; ++i) + { + pUIFL = new CUIFrameLineWnd(); + InitFrameLine(xml_doc, "auto_frameline", i, pUIFL); + xr_sprintf(sname, "auto_frameline_%d", i); + pUIFL->SetWindowName(sname); + pUIFL->SetAutoDelete(true); + pParentWnd->AttachChild(pUIFL); + pUIFL = NULL; + } + + xml_doc.SetLocalRoot(_stored_root); +} + +bool CUIXmlInitBase::InitFont(CUIXml& xml_doc, LPCSTR path, int index, u32& color, CGameFont*& pFnt) +{ + color = GetColor(xml_doc, path, index, 0xff); + + LPCSTR font_name = xml_doc.ReadAttrib(path, index, "font", NULL); + if (!font_name) + { + pFnt = NULL; + return false; + } + else + { + if (!xr_strcmp(font_name, GRAFFITI19_FONT_NAME)) + { + pFnt = UI().Font().pFontGraffiti19Russian; + } + else if (!xr_strcmp(font_name, GRAFFITI22_FONT_NAME)) + { + pFnt = UI().Font().pFontGraffiti22Russian; + } + else if (!xr_strcmp(font_name, GRAFFITI32_FONT_NAME)) + { + pFnt = UI().Font().pFontGraffiti32Russian; + } + else if (!xr_strcmp(font_name, GRAFFITI50_FONT_NAME)) + { + pFnt = UI().Font().pFontGraffiti50Russian; + } + else if (!xr_strcmp(font_name, "arial_14")) + { + pFnt = UI().Font().pFontArial14; + } + else if (!xr_strcmp(font_name, MEDIUM_FONT_NAME)) + { + pFnt = UI().Font().pFontMedium; + } + else if (!xr_strcmp(font_name, SMALL_FONT_NAME)) + { + pFnt = UI().Font().pFontStat; + } + else if (!xr_strcmp(font_name, LETTERICA16_FONT_NAME)) + { + pFnt = UI().Font().pFontLetterica16Russian; + } + else if (!xr_strcmp(font_name, LETTERICA18_FONT_NAME)) + { + pFnt = UI().Font().pFontLetterica18Russian; + } + else if (!xr_strcmp(font_name, LETTERICA25_FONT_NAME)) + { + pFnt = UI().Font().pFontLetterica25; + } + else if (!xr_strcmp(font_name, DI_FONT_NAME)) + { + pFnt = UI().Font().pFontDI; + } + else + { + R_ASSERT3(0, "unknown font", font_name); + pFnt = NULL; + } + } + return true; +} + +bool CUIXmlInitBase::InitTabControl(CUIXml& xml_doc, LPCSTR path, int index, CUITabControl* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + bool status = true; + + status &= InitWindow(xml_doc, path, index, pWnd); + InitOptionsItem(xml_doc, path, index, pWnd); + int tabsCount = xml_doc.GetNodesNum(path, index, "button"); + int radio = xml_doc.ReadAttribInt(path, index, "radio"); + + XML_NODE tab_node = xml_doc.NavigateToNode(path, index); + xml_doc.SetLocalRoot(tab_node); + + CUITabButton* newButton; + + for (int i = 0; i < tabsCount; ++i) + { + newButton = radio ? new CUIRadioButton() : new CUITabButton(); + status &= Init3tButton(xml_doc, "button", i, newButton); + newButton->m_btn_id = xml_doc.ReadAttrib("button", i, "id"); + R_ASSERT3(newButton->m_btn_id.size(), xml_doc.m_xml_file_name, path); + pWnd->AddItem(newButton); + } + + xml_doc.SetLocalRoot(xml_doc.GetRoot()); + + return status; +} + +////////////////////////////////////////////////////////////////////////// + +bool CUIXmlInitBase::InitFrameLine(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameLineWnd* pWnd) +{ + R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path); + + string256 buf; + + bool stretch_flag = xml_doc.ReadAttribInt(path, index, "stretch") ? true : false; + R_ASSERT(stretch_flag == false); + //. pWnd->SetStretchTexture( stretch_flag ); + + Fvector2 pos, size; + pos.x = xml_doc.ReadAttribFlt(path, index, "x"); + pos.y = xml_doc.ReadAttribFlt(path, index, "y"); + + InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd); + + size.x = xml_doc.ReadAttribFlt(path, index, "width"); + size.y = xml_doc.ReadAttribFlt(path, index, "height"); + bool vertical = !!xml_doc.ReadAttribInt(path, index, "vertical"); + + strconcat(sizeof(buf), buf, path, ":texture"); + shared_str base_name = xml_doc.Read(buf, index, NULL); + + VERIFY(base_name); + + u32 color = GetColor(xml_doc, buf, index, 0xff); + pWnd->SetTextureColor(color); + + InitWindow(xml_doc, path, index, pWnd); + pWnd->InitFrameLineWnd(*base_name, pos, size, !vertical); + return true; +} + +bool CUIXmlInitBase::InitCustomEdit(CUIXml& xml_doc, LPCSTR path, int index, CUICustomEdit* pWnd) +{ + InitStatic(xml_doc, path, index, pWnd); + pWnd->InitCustomEdit(pWnd->GetWndPos(), pWnd->GetWndSize()); + + string256 foo; + u32 color; + strconcat(sizeof(foo), foo, path, ":text_color:e"); + if (xml_doc.NavigateToNode(foo, index)) + { + color = GetColor(xml_doc, foo, index, 0x00); + pWnd->TextItemControl()->SetTextColor(color); + } + + int max_count = xml_doc.ReadAttribInt(path, index, "max_symb_count", 0); + bool num_only = (xml_doc.ReadAttribInt(path, index, "num_only", 0) == 1); + bool read_only = (xml_doc.ReadAttribInt(path, index, "read_only", 0) == 1); + bool file_name_mode = (xml_doc.ReadAttribInt(path, index, "file_name_mode", 0) == 1); + + if (file_name_mode || read_only || num_only || 0 < max_count) + { + if (max_count <= 0) + { + max_count = 32; + } + pWnd->Init(max_count, num_only, read_only, file_name_mode); + } + + if (xml_doc.ReadAttribInt(path, index, "password", 0)) + { + pWnd->SetPasswordMode(); + } + return true; +} + +bool CUIXmlInitBase::InitEditBox(CUIXml& xml_doc, LPCSTR path, int index, CUIEditBox* pWnd) +{ + InitCustomEdit(xml_doc, path, index, pWnd); + + InitTexture(xml_doc, path, index, pWnd); + InitOptionsItem(xml_doc, path, index, pWnd); + + return true; +} + +////////////////////////////////////////////////////////////////////////// + +bool CUIXmlInitBase::InitAnimatedStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIAnimatedStatic* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitStatic(xml_doc, path, index, pWnd); + + float x = xml_doc.ReadAttribFlt(path, index, "x_offset", 0); + float y = xml_doc.ReadAttribFlt(path, index, "y_offset", 0); + u32 framesCount = static_cast(xml_doc.ReadAttribInt(path, index, "frames", 0)); + u32 animDuration = static_cast(xml_doc.ReadAttribInt(path, index, "duration", 0)); + u32 animCols = static_cast(xml_doc.ReadAttribInt(path, index, "columns", 0)); + float frameWidth = xml_doc.ReadAttribFlt(path, index, "frame_width", 0); + float frameHeight = xml_doc.ReadAttribFlt(path, index, "frame_height", 0); + bool cyclic = !!xml_doc.ReadAttribInt(path, index, "cyclic", 0); + bool play = !!xml_doc.ReadAttribInt(path, index, "autoplay", 0); + + pWnd->SetFrameDimentions(frameWidth, frameHeight); + pWnd->SetFramesCount(framesCount); + pWnd->m_bCyclic = cyclic; + pWnd->SetAnimCols(animCols); + pWnd->SetAnimationDuration(animDuration); + pWnd->SetOffset(x, y); + pWnd->SetAnimPos(0.0f); + if (play) + pWnd->Play(); + + return true; +} + +bool CUIXmlInitBase::InitTexture(CUIXml& xml_doc, LPCSTR path, int index, ITextureOwner* pWnd) +{ + string256 buf; + LPCSTR texture = NULL; + LPCSTR shader = NULL; + strconcat(sizeof(buf), buf, path, ":texture"); + if (xml_doc.NavigateToNode(buf)) + { + texture = xml_doc.Read(buf, index, NULL); + shader = xml_doc.ReadAttrib(buf, index, "shader", NULL); + } + if (texture) + { + if (shader) + pWnd->InitTextureEx(texture, shader); + else + pWnd->InitTexture(texture); + } + //-------------------- + Frect rect; + rect.x1 = xml_doc.ReadAttribFlt(buf, index, "x", 0); + rect.y1 = xml_doc.ReadAttribFlt(buf, index, "y", 0); + rect.x2 = rect.x1 + xml_doc.ReadAttribFlt(buf, index, "width", 0); + rect.y2 = rect.y1 + xml_doc.ReadAttribFlt(buf, index, "height", 0); + + bool stretch_flag = xml_doc.ReadAttribInt(path, index, "stretch") ? true : false; + pWnd->SetStretchTexture(stretch_flag); + + u32 color = GetColor(xml_doc, buf, index, 0xff); + pWnd->SetTextureColor(color); + + if (rect.width() != 0 && rect.height() != 0) + pWnd->SetTextureRect(rect); + + return true; +} + +bool CUIXmlInitBase::InitTextureOffset(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd) +{ + string256 textureOffset; + if (0 == xr_strcmp(path, "")) + xr_strcpy(textureOffset, "texture_offset"); + else + strconcat(sizeof(textureOffset), textureOffset, path, ":texture_offset"); + + float x = xml_doc.ReadAttribFlt(textureOffset, index, "x"); + float y = xml_doc.ReadAttribFlt(textureOffset, index, "y"); + + pWnd->SetTextureOffset(x, y); + + return true; +} + +bool CUIXmlInitBase::InitMultiTexture(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd) +{ + string256 buff; + bool success = false; + + strconcat(sizeof(buff), buff, path, ":texture"); + shared_str texture = xml_doc.Read(buff, index, NULL); + + if (texture.size() > 0) + { + pWnd->InitTexture(*texture); + return true; + } + + strconcat(sizeof(buff), buff, path, ":texture_e"); + texture = xml_doc.Read(buff, index, NULL); + if (texture.size()) + { + if (pWnd->m_background) + { + pWnd->m_background->InitState(S_Enabled, texture.c_str()); + } + else if (pWnd->m_back_frameline) + { + pWnd->m_back_frameline->InitState(S_Enabled, texture.c_str()); + pWnd->m_back_frameline->Get(S_Enabled)->SetHorizontal(!(pWnd->vertical)); + } + success = true; + } + + strconcat(sizeof(buff), buff, path, ":texture_t"); + texture = xml_doc.Read(buff, index, NULL); + if (texture.size()) + { + if (pWnd->m_background) + { + pWnd->m_background->InitState(S_Touched, texture.c_str()); + } + else if (pWnd->m_back_frameline) + { + pWnd->m_back_frameline->InitState(S_Touched, texture.c_str()); + pWnd->m_back_frameline->Get(S_Touched)->SetHorizontal(!(pWnd->vertical)); + } + success = true; + } + + strconcat(sizeof(buff), buff, path, ":texture_d"); + texture = xml_doc.Read(buff, index, NULL); + if (texture.size()) + { + if (pWnd->m_background) + { + pWnd->m_background->InitState(S_Disabled, texture.c_str()); + } + else if (pWnd->m_back_frameline) + { + pWnd->m_back_frameline->InitState(S_Disabled, texture.c_str()); + pWnd->m_back_frameline->Get(S_Disabled)->SetHorizontal(!(pWnd->vertical)); + } + success = true; + } + + strconcat(sizeof(buff), buff, path, ":texture_h"); + texture = xml_doc.Read(buff, index, NULL); + if (texture.size()) + { + if (pWnd->m_background) + { + pWnd->m_background->InitState(S_Highlighted, texture.c_str()); + } + else if (pWnd->m_back_frameline) + { + pWnd->m_back_frameline->InitState(S_Highlighted, texture.c_str()); + pWnd->m_back_frameline->Get(S_Highlighted)->SetHorizontal(!(pWnd->vertical)); + } + success = true; + } + + if (success) + pWnd->TextureOn(); + + return success; +} + +float CUIXmlInitBase::ApplyAlignX(float coord, u32 align) { return coord; } +////////////////////////////////////////////////////////////////////////// + +float CUIXmlInitBase::ApplyAlignY(float coord, u32 align) { return coord; } +////////////////////////////////////////////////////////////////////////// + +void CUIXmlInitBase::ApplyAlign(float& x, float& y, u32 align) +{ + x = ApplyAlignX(x, align); + y = ApplyAlignY(y, align); +} + +////////////////////////////////////////////////////////////////////////// + +bool CUIXmlInitBase::InitAlignment(CUIXml& xml_doc, const char* path, int index, float& x, float& y, CUIWindow* pWnd) +{ + xr_string wnd_alignment = xml_doc.ReadAttrib(path, index, "alignment", ""); + + if (strchr(wnd_alignment.c_str(), 'c')) + pWnd->SetAlignment(waCenter); + + // Alignment: right: "r", bottom: "b". Top, left - useless + shared_str alignStr = xml_doc.ReadAttrib(path, index, "align", ""); + + bool result = false; + + if (strchr(*alignStr, 'r')) + { + x = ApplyAlignX(x, alRight); + result = true; + } + if (strchr(*alignStr, 'b')) + { + y = ApplyAlignY(y, alBottom); + result = true; + } + if (strchr(*alignStr, 'c')) + { + ApplyAlign(x, y, alCenter); + result = true; + } + + return result; +} + +////////////////////////////////////////////////////////////////////////// + +void CUIXmlInitBase::InitColorDefs() +{ + if (NULL != m_pColorDefs) + return; + + m_pColorDefs = new ColorDefs(); + + CUIXml uiXml; + uiXml.Load(CONFIG_PATH, UI_PATH, COLOR_DEFINITIONS); + + int num = uiXml.GetNodesNum("colors", 0, "color"); + + shared_str name; + int r, b, g, a; + + for (int i = 0; i < num; ++i) + { + name = uiXml.ReadAttrib("color", i, "name", ""); + r = uiXml.ReadAttribInt("color", i, "r", 0); + g = uiXml.ReadAttribInt("color", i, "g", 0); + b = uiXml.ReadAttribInt("color", i, "b", 0); + a = uiXml.ReadAttribInt("color", i, "a", 255); + + (*m_pColorDefs)[name] = color_argb(a, r, g, b); + } +} + +bool CUIXmlInitBase::InitScrollView(CUIXml& xml_doc, LPCSTR path, int index, CUIScrollView* pWnd) +{ + R_ASSERT4(xml_doc.NavigateToNode(path, index), "XML node not found", path, xml_doc.m_xml_file_name); + + InitWindow(xml_doc, path, index, pWnd); + pWnd->SetRightIndention(xml_doc.ReadAttribFlt(path, index, "right_ident", 0.0f)); + pWnd->SetLeftIndention(xml_doc.ReadAttribFlt(path, index, "left_ident", 0.0f)); + pWnd->SetUpIndention(xml_doc.ReadAttribFlt(path, index, "top_indent", 0.0f)); + pWnd->SetDownIndention(xml_doc.ReadAttribFlt(path, index, "bottom_indent", 0.0f)); + + float vi = xml_doc.ReadAttribFlt(path, index, "vert_interval", 0.0f); + pWnd->m_vertInterval = (vi); + + bool bInverseDir = (1 == xml_doc.ReadAttribInt(path, index, "inverse_dir", 0)); + pWnd->m_flags.set(CUIScrollView::eInverseDir, bInverseDir); + + pWnd->SetScrollBarProfile(xml_doc.ReadAttrib(path, index, "scroll_profile", "default")); + + pWnd->InitScrollView(); + + bool bVertFlip = (1 == xml_doc.ReadAttribInt(path, index, "flip_vert", 0)); + pWnd->SetVertFlip(bVertFlip); + + bool b = (1 == xml_doc.ReadAttribInt(path, index, "always_show_scroll", 1)); + + pWnd->SetFixedScrollBar(b); + + b = (1 == xml_doc.ReadAttribInt(path, index, "can_select", 0)); + + pWnd->m_flags.set(CUIScrollView::eItemsSelectabe, b); + + ///////////////////////////////////////////////////////////////////// + int tabsCount = xml_doc.GetNodesNum(path, index, "text"); + + XML_NODE _stored_root = xml_doc.GetLocalRoot(); + xml_doc.SetLocalRoot(xml_doc.NavigateToNode(path, index)); + + for (int i = 0; i < tabsCount; ++i) + { + CUITextWnd* newText = new CUITextWnd(); + InitText(xml_doc, "text", i, &newText->TextItemControl()); + newText->SetTextComplexMode(true); + newText->SetWidth(pWnd->GetDesiredChildWidth()); + newText->AdjustHeightToText(); + pWnd->AddWindow(newText, true); + } + xml_doc.SetLocalRoot(_stored_root); + return true; +} + +bool CUIXmlInitBase::InitListBox(CUIXml& xml_doc, LPCSTR path, int index, CUIListBox* pWnd) +{ + InitScrollView(xml_doc, path, index, pWnd); + + string512 _path; + u32 t_color; + CGameFont* pFnt; + strconcat(sizeof(_path), _path, path, ":font"); + InitFont(xml_doc, _path, index, t_color, pFnt); + + pWnd->SetTextColor(t_color); + pWnd->SetFont(pFnt); + + float h = xml_doc.ReadAttribFlt(path, index, "item_height", 20.0f); + pWnd->SetItemHeight(h); + return true; +} + +bool CUIXmlInitBase::InitTrackBar(CUIXml& xml_doc, LPCSTR path, int index, CUITrackBar* pWnd) +{ + InitWindow(xml_doc, path, 0, pWnd); + pWnd->InitTrackBar(pWnd->GetWndPos(), pWnd->GetWndSize()); + int is_integer = xml_doc.ReadAttribInt(path, index, "is_integer", 0); + pWnd->SetType(!is_integer); + InitOptionsItem(xml_doc, path, 0, pWnd); + + int invert = xml_doc.ReadAttribInt(path, index, "invert", 0); + pWnd->SetInvert(!!invert); + float step = xml_doc.ReadAttribFlt(path, index, "step", 0.1f); + pWnd->SetStep(step); + + return true; +} + +bool CUIXmlInitBase::InitComboBox(CUIXml& xml_doc, LPCSTR path, int index, CUIComboBox* pWnd) +{ + u32 color; + CGameFont* pFont; + + pWnd->SetListLength(xml_doc.ReadAttribInt(path, index, "list_length", 4)); + + InitWindow(xml_doc, path, index, pWnd); + pWnd->InitComboBox(pWnd->GetWndPos(), pWnd->GetWidth()); + InitOptionsItem(xml_doc, path, index, pWnd); + + bool b = (1 == xml_doc.ReadAttribInt(path, index, "always_show_scroll", 1)); + + pWnd->m_list_box.SetFixedScrollBar(b); + + string512 _path; + strconcat(sizeof(_path), _path, path, ":list_font"); + InitFont(xml_doc, _path, index, color, pFont); + //. pWnd->SetFont (pFont); + pWnd->m_list_box.SetFont(pFont); + pWnd->m_list_box.SetTextColor(color); + + strconcat(sizeof(_path), _path, path, ":text_color:e"); + if (xml_doc.NavigateToNode(_path, index)) + { + color = GetColor(xml_doc, _path, index, 0x00); + pWnd->SetTextColor(color); + } + + strconcat(sizeof(_path), _path, path, ":text_color:d"); + if (xml_doc.NavigateToNode(_path, index)) + { + color = GetColor(xml_doc, _path, index, 0x00); + pWnd->SetTextColorD(color); + } + + return true; +} + +void CUIXmlInitBase::AssignColor(LPCSTR name, u32 clr) { (*m_pColorDefs)[name] = clr; } +u32 CUIXmlInitBase::GetColor(CUIXml& xml_doc, LPCSTR path, int index, u32 def_clr) +{ + LPCSTR clr_def = xml_doc.ReadAttrib(path, index, "color", NULL); + if (clr_def) + { + VERIFY(GetColorDefs()->find(clr_def) != GetColorDefs()->end()); + return (*m_pColorDefs)[clr_def]; + } + else + { + int r = xml_doc.ReadAttribInt(path, index, "r", def_clr); + int g = xml_doc.ReadAttribInt(path, index, "g", def_clr); + int b = xml_doc.ReadAttribInt(path, index, "b", def_clr); + int a = xml_doc.ReadAttribInt(path, index, "a", 0xff); + return color_argb(a, r, g, b); + } +} diff --git a/src/xrUICore/XML/UIXmlInitBase.h b/src/xrUICore/XML/UIXmlInitBase.h new file mode 100644 index 00000000000..476cb02c713 --- /dev/null +++ b/src/xrUICore/XML/UIXmlInitBase.h @@ -0,0 +1,94 @@ +#pragma once +#include "xrUICore/XML/xrUIXmlParser.h" +#include "xrCore/_rect.h" +#include "xrCommon/xr_map.h" + +class ITextureOwner; +class CUIWindow; +class CUIFrameWindow; +class CUIStaticItem; +class CUIStatic; +class CUICheckButton; +class CUICustomSpin; +class CUIButton; +class CUI3tButton; +class CUIDragDropList; +class CUIProgressBar; +class CUIProgressShape; +class CUITabControl; +class CUIFrameLineWnd; +class CUIEditBoxEx; +class CUIEditBox; +class CUICustomEdit; +class CUIAnimatedStatic; +class CUISleepStatic; +class CUIOptionsItem; +class CUIScrollView; +class CUIListBox; +class CUIDragDropListEx; +class CUIComboBox; +class CUITrackBar; +class CUILines; +class CUITextWnd; +class CGameFont; + +class XRUICORE_API CUIXmlInitBase +{ +public: + CUIXmlInitBase(); + virtual ~CUIXmlInitBase(); + + static bool InitWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pWnd); + static bool InitFrameWindow(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameWindow* pWnd); + static bool InitFrameLine(CUIXml& xml_doc, LPCSTR path, int index, CUIFrameLineWnd* pWnd); + static bool InitCustomEdit(CUIXml& xml_doc, LPCSTR paht, int index, CUICustomEdit* pWnd); + static bool InitEditBox(CUIXml& xml_doc, LPCSTR paht, int index, CUIEditBox* pWnd); + static bool InitStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd); + static bool InitTextWnd(CUIXml& xml_doc, LPCSTR path, int index, CUITextWnd* pWnd); + static bool InitCheck(CUIXml& xml_doc, LPCSTR path, int index, CUICheckButton* pWnd); + static bool InitSpin(CUIXml& xml_doc, LPCSTR path, int index, CUICustomSpin* pWnd); + static bool InitText(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd); + static bool InitText(CUIXml& xml_doc, LPCSTR path, int index, CUILines* pLines); + static bool Init3tButton(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd); + static bool InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressBar* pWnd); + static bool InitProgressShape(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressShape* pWnd); + static bool InitFont(CUIXml& xml_doc, LPCSTR path, int index, u32& color, CGameFont*& pFnt); + static bool InitTabControl(CUIXml& xml_doc, LPCSTR path, int index, CUITabControl* pWnd); + static bool InitAnimatedStatic(CUIXml& xml_doc, LPCSTR path, int index, CUIAnimatedStatic* pWnd); + static bool InitTextureOffset(CUIXml& xml_doc, LPCSTR path, int index, CUIStatic* pWnd); + static bool InitSound(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd); + static bool InitMultiTexture(CUIXml& xml_doc, LPCSTR path, int index, CUI3tButton* pWnd); + static bool InitTexture(CUIXml& xml_doc, LPCSTR path, int index, ITextureOwner* pWnd); + static bool InitOptionsItem(CUIXml& xml_doc, LPCSTR paht, int index, CUIOptionsItem* pWnd); + static bool InitScrollView(CUIXml& xml_doc, LPCSTR path, int index, CUIScrollView* pWnd); + static bool InitListBox(CUIXml& xml_doc, LPCSTR path, int index, CUIListBox* pWnd); + static bool InitComboBox(CUIXml& xml_doc, LPCSTR path, int index, CUIComboBox* pWnd); + static bool InitTrackBar(CUIXml& xml_doc, LPCSTR path, int index, CUITrackBar* pWnd); + static Frect GetFRect(CUIXml& xml_doc, LPCSTR path, int index); + static u32 GetColor(CUIXml& xml_doc, LPCSTR path, int index, u32 def_clr); + + static bool InitAlignment(CUIXml& xml_doc, const char* path, int index, float& x, float& y, CUIWindow* pWnd); + + static void InitAutoStaticGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd); + static void InitAutoFrameLineGroup(CUIXml& xml_doc, LPCSTR path, int index, CUIWindow* pParentWnd); + + static float ApplyAlignX(float coord, u32 align); + static float ApplyAlignY(float coord, u32 align); + static void ApplyAlign(float& x, float& y, u32 align); + + // Initialize and store predefined colors + using ColorDefs = xr_map; + + static const ColorDefs* GetColorDefs() + { + R_ASSERT(m_pColorDefs); + return m_pColorDefs; + } + + static void InitColorDefs(); + static void DeleteColorDefs() { xr_delete(m_pColorDefs); } + static void AssignColor(LPCSTR name, u32 clr); + +private: + static ColorDefs* m_pColorDefs; +}; diff --git a/src/xrUICore/XML/xrUIXmlParser.cpp b/src/xrUICore/XML/xrUIXmlParser.cpp new file mode 100644 index 00000000000..c31be655a1d --- /dev/null +++ b/src/xrUICore/XML/xrUIXmlParser.cpp @@ -0,0 +1,26 @@ +#include "pch.hpp" +#include "xrUIXmlParser.h" + +#ifdef XRUICORE_EXPORTS +#include "ui_base.h" +#endif + +shared_str CUIXml::correct_file_name(pcstr path, pcstr fn) +{ +#ifdef XRUICORE_EXPORTS + if (0 == xr_strcmp(path, UI_PATH) || 0 == xr_strcmp(path, "UI")) + { + return UI().get_xml_name(fn); + } + else + return fn; +#else + return fn; +#endif +} + +CUIXml::CUIXml() +{} + +CUIXml::~CUIXml() +{} diff --git a/src/xrGame/ui/xrUIXmlParser.h b/src/xrUICore/XML/xrUIXmlParser.h similarity index 79% rename from src/xrGame/ui/xrUIXmlParser.h rename to src/xrUICore/XML/xrUIXmlParser.h index d97bd71d32b..e4d87d8c7b4 100644 --- a/src/xrGame/ui/xrUIXmlParser.h +++ b/src/xrUICore/XML/xrUIXmlParser.h @@ -1,7 +1,7 @@ #pragma once #include "xrCore/XML/XMLDocument.hpp" -class CUIXml : public XMLDocument +class XRUICORE_API CUIXml : public XMLDocument { int m_dbg_id; diff --git a/src/xrGame/ui/ui_arrow.cpp b/src/xrUICore/arrow/ui_arrow.cpp similarity index 89% rename from src/xrGame/ui/ui_arrow.cpp rename to src/xrUICore/arrow/ui_arrow.cpp index 602cdf5624d..c41aafa7927 100644 --- a/src/xrGame/ui/ui_arrow.cpp +++ b/src/xrUICore/arrow/ui_arrow.cpp @@ -1,8 +1,6 @@ - -#include "stdafx.h" - +#include "pch.hpp" #include "ui_arrow.h" -#include "UIXmlInit.h" +#include "XML/UIXmlInitBase.h" UI_Arrow::UI_Arrow() { @@ -17,10 +15,9 @@ UI_Arrow::UI_Arrow() UI_Arrow::~UI_Arrow() {} void UI_Arrow::init_from_xml(CUIXml& xml, LPCSTR path, CUIWindow* parent) { - // m_arrow = UIHelper::CreateStatic( xml, "arrow", this ); parent->AttachChild(this); SetAutoDelete(true); - CUIXmlInit::InitStatic(xml, path, 0, this); + CUIXmlInitBase::InitStatic(xml, path, 0, this); m_angle_begin = xml.ReadAttribFlt(path, 0, "begin_angle", 0.0f); m_angle_end = xml.ReadAttribFlt(path, 0, "end_angle", PI_MUL_2); diff --git a/src/xrGame/ui/ui_arrow.h b/src/xrUICore/arrow/ui_arrow.h similarity index 75% rename from src/xrGame/ui/ui_arrow.h rename to src/xrUICore/arrow/ui_arrow.h index 7420ebbb2e4..1844205eda9 100644 --- a/src/xrGame/ui/ui_arrow.h +++ b/src/xrUICore/arrow/ui_arrow.h @@ -1,9 +1,7 @@ -#ifndef UI_ARROW_H_INCLUDED -#define UI_ARROW_H_INCLUDED +#pragma once +#include "xrUICore/Static/UIStatic.h" -#include "UIStatic.h" - -class UI_Arrow : public CUIStatic +class XRUICORE_API UI_Arrow : public CUIStatic { private: typedef CUIStatic inherited; @@ -26,5 +24,3 @@ class UI_Arrow : public CUIStatic float m_pos; }; // class UI_Arrow - -#endif // UI_ARROW_H_INCLUDED diff --git a/src/xrUICore/packages.config b/src/xrUICore/packages.config new file mode 100644 index 00000000000..94957f1a022 --- /dev/null +++ b/src/xrUICore/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/xrUICore/pch.cpp b/src/xrUICore/pch.cpp new file mode 100644 index 00000000000..3854579ae1c --- /dev/null +++ b/src/xrUICore/pch.cpp @@ -0,0 +1 @@ +#include "pch.hpp" diff --git a/src/xrUICore/pch.hpp b/src/xrUICore/pch.hpp new file mode 100644 index 00000000000..266ac67d2ea --- /dev/null +++ b/src/xrUICore/pch.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "Common/Common.hpp" + +#include "xrEngine/stdafx.h" +#include "xrServerEntities/smart_cast.h" +#include "Windows/UIWindow.h" +#include "ui_base.h" +#include "xrEngine/xr_input_xinput.h" diff --git a/src/xrGame/ui_base.cpp b/src/xrUICore/ui_base.cpp similarity index 97% rename from src/xrGame/ui_base.cpp rename to src/xrUICore/ui_base.cpp index 9727885f934..6b8f95dccc2 100644 --- a/src/xrGame/ui_base.cpp +++ b/src/xrUICore/ui_base.cpp @@ -1,12 +1,11 @@ -#include "stdafx.h" +#include "pch.hpp" #include "ui_base.h" -#include "GamePersistent.h" -#include "UICursor.h" +#include "Cursor/UICursor.h" pcstr UI_PATH = "ui"; CUICursor& GetUICursor() { return UI().GetUICursor(); }; -ui_core& UI() { return *GamePersistent().m_pUI_core; }; +ui_core& UI() { return *GEnv.UI; }; extern ENGINE_API Fvector2 g_current_font_scale; void S2DVert::rotate_pt(const Fvector2& pivot, const float cosA, const float sinA, const float kx) @@ -218,8 +217,8 @@ ui_core::ui_core() } else { - m_pUICursor = NULL; - m_pFontManager = NULL; + m_pUICursor = nullptr; + m_pFontManager = nullptr; } m_bPostprocess = false; diff --git a/src/xrGame/ui_base.h b/src/xrUICore/ui_base.h similarity index 66% rename from src/xrGame/ui_base.h rename to src/xrUICore/ui_base.h index d3ad2a4cc8b..feabb0f9266 100644 --- a/src/xrGame/ui_base.h +++ b/src/xrUICore/ui_base.h @@ -4,8 +4,9 @@ #include "xrEngine/device.h" #include "xrCommon/xr_vector.h" #include "xrCommon/xr_stack.h" +#include "xrUICore/FontManager/FontManager.h" -extern pcstr UI_PATH; +XRUICORE_API extern pcstr UI_PATH; class CUICursor; class CUIGameCustom; @@ -18,38 +19,7 @@ class CDeviceResetNotifier : public pureDeviceReset virtual void OnDeviceReset(){}; }; -struct CFontManager : public pureDeviceReset -{ - CFontManager(); - ~CFontManager(); - - typedef xr_vector FONTS_VEC; - typedef FONTS_VEC::iterator FONTS_VEC_IT; - FONTS_VEC m_all_fonts; - void Render(); - - // hud font - CGameFont* pFontMedium; - CGameFont* pFontDI; - - CGameFont* pFontArial14; - CGameFont* pFontGraffiti19Russian; - CGameFont* pFontGraffiti22Russian; - CGameFont* pFontLetterica16Russian; - CGameFont* pFontLetterica18Russian; - CGameFont* pFontGraffiti32Russian; - CGameFont* pFontGraffiti50Russian; - CGameFont* pFontLetterica25; - CGameFont* pFontStat; - - void InitializeFonts(); - void InitializeFont(CGameFont*& F, LPCSTR section, u32 flags = 0); - LPCSTR GetFontTexName(LPCSTR section); - - virtual void OnDeviceReset(); -}; - -class ui_core : public CDeviceResetNotifier +class XRUICORE_API ui_core : public CDeviceResetNotifier { C2DFrustum m_2DFrustum; C2DFrustum m_2DFrustumPP; @@ -96,6 +66,5 @@ class ui_core : public CDeviceResetNotifier IUIRender::ePointType m_currentPointType; }; -extern CUICursor& GetUICursor(); -extern ui_core& UI(); -extern CUIGameCustom* CurrentGameUI(); +XRUICORE_API extern CUICursor& GetUICursor(); +XRUICORE_API extern ui_core& UI(); diff --git a/src/xrGame/ui_defs.h b/src/xrUICore/ui_defs.h similarity index 97% rename from src/xrGame/ui_defs.h rename to src/xrUICore/ui_defs.h index aea31f1d16d..520833709aa 100644 --- a/src/xrGame/ui_defs.h +++ b/src/xrUICore/ui_defs.h @@ -51,7 +51,7 @@ struct S2DVert #define UI_FRUSTUM_SAFE (UI_FRUSTUM_MAXPLANES * 4) typedef svector sPoly2D; -class C2DFrustum +class XRUICORE_API C2DFrustum { svector planes; Frect m_rect; diff --git a/src/xrGame/ui/uiabstract.h b/src/xrUICore/uiabstract.h similarity index 99% rename from src/xrGame/ui/uiabstract.h rename to src/xrUICore/uiabstract.h index 184f9888578..ebfb7478655 100644 --- a/src/xrGame/ui/uiabstract.h +++ b/src/xrUICore/uiabstract.h @@ -3,7 +3,6 @@ #pragma warning(disable : 4511) #pragma warning(disable : 4512) -#include "ui_base.h" #include "Common/Noncopyable.hpp" #include "xrEngine/GameFont.h" diff --git a/src/xrUICore/xrUICore.vcxproj b/src/xrUICore/xrUICore.vcxproj new file mode 100644 index 00000000000..8251cc25afa --- /dev/null +++ b/src/xrUICore/xrUICore.vcxproj @@ -0,0 +1,392 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Mixed_COC + Win32 + + + Mixed_COC + x64 + + + Mixed + Win32 + + + Mixed + x64 + + + Release_COC + Win32 + + + Release_COC + x64 + + + Release + Win32 + + + Release + x64 + + + + {37B3642C-B706-4C93-BC54-BADADC8FC9B1} + xrAICore + 10.0.16299.0 + + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + + + DynamicLibrary + v141 + MultiByte + true + + + DynamicLibrary + v141 + MultiByte + true + + + DynamicLibrary + v141 + MultiByte + true + + + DynamicLibrary + v141 + MultiByte + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.30501.0 + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + XRUICORE_EXPORTS;%(PreprocessorDefinitions) + pch.hpp + .;$(SolutionDir);$(xrExternals);$(ProjectDir);$(xrSdkDir)include;$(xrSdkDir)DXSDK/Include;$(xrExternals)luajit\src;$(xrExternals)luabind;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) + + + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + + {7885cf3c-ee04-4c67-9467-1fbf9a36b037} + + + {132c62de-de85-4978-9675-c78ed4da46f0} + + + {ccd4afae-aa10-42c6-a452-fdee497ccdf1} + + + {632aeeb6-dc06-4e15-9551-b2b09a4b73c5} + + + {07cf01c0-b887-499d-ad9c-799cb6a9fe64} + + + {2578c6d8-660d-48ae-9322-7422f8664f06} + + + {1daec516-e52c-4a3c-a4da-ae3553e6e0f8} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}. + + + + + \ No newline at end of file diff --git a/src/xrUICore/xrUICore.vcxproj.filters b/src/xrUICore/xrUICore.vcxproj.filters new file mode 100644 index 00000000000..d5c4d61170b --- /dev/null +++ b/src/xrUICore/xrUICore.vcxproj.filters @@ -0,0 +1,431 @@ + + + + + + + + {2c4605d6-d85a-4a2b-b9e8-caaa34c51732} + + + {6bf658bd-b309-4948-affa-ba0651ef9a19} + + + {f9ee2ff4-00bf-4896-97b2-fc3aa5495da5} + + + {dc322116-1803-4f16-9e44-23ab18aa76ee} + + + {23ef7748-6827-46d5-9d66-e520ba6b80e4} + + + {04778887-db2f-4107-8021-0992d1092b12} + + + {112e2de6-7862-45a6-8ed4-da4ef7038408} + + + {21d3bc62-8128-4944-be2e-daa914424f01} + + + {4dffbd4b-dc59-492a-aa4c-dba13d613e16} + + + {b3070c87-ea88-489e-8bc0-5ea24ab6ce51} + + + {3e8610b3-1915-40af-83d6-00b2fb6aec05} + + + {b4220112-9a21-4d06-b706-9368d0fc91dc} + + + {753cc68e-2da8-4dec-a993-310e93054da1} + + + {e352fa71-8c90-4ed6-872c-b1865c8acfba} + + + {6f52116b-6102-4390-9f3c-137fbf22f744} + + + {a2648ace-c298-4d95-ae19-80af269a9c74} + + + {618b8ca3-a4e2-4f7e-9c77-4effa1e15b35} + + + {63861209-c6b5-4f82-9afb-490d5f76bc1a} + + + {e071b646-1ee5-4467-ad2f-00f8ac7d37ee} + + + {9cd05982-0d31-4641-afb2-8b6deca5afb1} + + + {f5a509a4-cb23-4a22-aae7-4d8e6030d127} + + + {804a137f-667e-4ec3-9fb4-22ee8f929ba3} + + + {49658579-42e7-425d-b701-eddd1b219e84} + + + {6a4dc39a-f6c8-45f8-9505-11e65cb12e49} + + + + + arrow + + + PCH + + + Static + + + Static + + + Static + + + Static + + + Static + + + Cursor + + + Windows + + + Windows + + + Windows + + + Buttons + + + Buttons + + + Buttons + + + Buttons + + + Buttons + + + Buttons + + + ComboBox + + + ComboBox + + + + Options + + + Options + + + EditBox + + + EditBox + + + EditBox + + + EditBox + + + Hint + + + InteractiveBackground + + + Lines + + + Lines + + + Lines + + + ListBox + + + ListBox + + + ListBox + + + ListBox + + + ProgressBar + + + ProgressBar + + + ProgressBar + + + ProgressBar + + + PropertiesBox + + + PropertiesBox + + + Callbacks + + + MessageBox + + + MessageBox + + + ScrollBar + + + ScrollBar + + + ScrollBar + + + ScrollView + + + SpinBox + + + SpinBox + + + SpinBox + + + TabControl + + + TabControl + + + TabControl + + + TrackBar + + + XML + + + XML + + + XML + + + FontManager + + + Windows + + + Options + + + + + arrow + + + PCH + + + Static + + + Static + + + Static + + + Static + + + Cursor + + + + Windows + + + Windows + + + Windows + + + Buttons + + + Buttons + + + Buttons + + + Buttons + + + Buttons + + + ComboBox + + + + + + Options + + + Options + + + EditBox + + + EditBox + + + EditBox + + + Hint + + + InteractiveBackground + + + InteractiveBackground + + + Lines + + + Lines + + + Lines + + + Lines + + + ListBox + + + ListBox + + + ListBox + + + ProgressBar + + + ProgressBar + + + ProgressBar + + + PropertiesBox + + + Callbacks + + + Callbacks + + + MessageBox + + + ScrollBar + + + ScrollBar + + + ScrollBar + + + ScrollView + + + SpinBox + + + SpinBox + + + SpinBox + + + TabControl + + + TabControl + + + TrackBar + + + XML + + + XML + + + XML + + + FontManager + + + Options + + + + + + \ No newline at end of file