1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

generate assets only when necessary

This commit is contained in:
Laserlicht 2024-08-29 00:37:39 +02:00
parent f327224d45
commit c6f0f8de03
8 changed files with 29 additions and 14 deletions

View File

@ -18,6 +18,7 @@
#include "gui/CGuiHandler.h"
#include "gui/WindowHandler.h"
#include "render/IRenderHandler.h"
#include "render/AssetGenerator.h"
#include "ClientNetPackVisitors.h"
#include "../lib/CConfigHandler.h"
#include "../lib/gameState/CGameState.h"
@ -502,6 +503,12 @@ void ClientCommandManager::handleVsLog(std::istringstream & singleWordBuffer)
logVisual->setKey(key);
}
void ClientCommandManager::handleGenerateAssets()
{
AssetGenerator::generateAll();
printCommandMessage("All assets generated");
}
void ClientCommandManager::printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType)
{
switch(messageType)
@ -624,6 +631,9 @@ void ClientCommandManager::processCommand(const std::string & message, bool call
else if(commandName == "vslog")
handleVsLog(singleWordBuffer);
else if(message=="generate assets")
handleGenerateAssets();
else
{
if (!commandName.empty() && !vstd::iswithin(commandName[0], 0, ' ')) // filter-out debugger/IDE noise

View File

@ -84,6 +84,9 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
// shows object graph
void handleVsLog(std::istringstream & singleWordBuffer);
// generate all assets
void handleGenerateAssets();
// Prints in Chat the given message
void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
void giveTurn(const PlayerColor &color);

View File

@ -24,7 +24,6 @@
#include "../render/Graphics.h"
#include "../render/IFont.h"
#include "../render/EFont.h"
#include "../render/AssetGenerator.h"
#include "../renderSDL/ScreenHandler.h"
#include "../renderSDL/RenderHandler.h"
#include "../CMT.h"
@ -64,8 +63,6 @@ void CGuiHandler::init()
shortcutsHandlerInstance = std::make_unique<ShortcutHandler>();
inputHandlerInstance = std::make_unique<InputHandler>(); // Must be after windowHandlerInstance and shortcutsHandlerInstance
framerateManagerInstance = std::make_unique<FramerateManager>(settings["video"]["targetfps"].Integer());
AssetGenerator::generate();
}
void CGuiHandler::handleEvents()

View File

@ -18,6 +18,7 @@
#include "../widgets/TextControls.h"
#include "../CServerHandler.h"
#include "../CGameInfo.h"
#include "../render/AssetGenerator.h"
#include "../../lib/StartInfo.h"
#include "../../lib/texts/CGeneralTextHandler.h"
@ -68,6 +69,8 @@ std::vector<SimturnsInfo> OptionsTabBase::getSimturnsPresets() const
OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
{
AssetGenerator::createAdventureOptionsCleanBackground();
recActions = 0;
auto setTimerPresetCallback = [this](int index){

View File

@ -18,7 +18,7 @@
#include "../lib/filesystem/Filesystem.h"
void AssetGenerator::generate()
void AssetGenerator::generateAll()
{
createBigSpellBook();
createAdventureOptionsCleanBackground();

View File

@ -11,9 +11,8 @@
class AssetGenerator
{
public:
static void generateAll();
static void createAdventureOptionsCleanBackground();
static void createBigSpellBook();
public:
static void generate();
};

View File

@ -31,6 +31,7 @@
#include "../widgets/TextControls.h"
#include "../widgets/Buttons.h"
#include "../adventureMap/AdventureMapInterface.h"
#include "../render/AssetGenerator.h"
#include "../../CCallback.h"
@ -115,6 +116,7 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m
if(isBigSpellbook)
{
AssetGenerator::createBigSpellBook();
background = std::make_shared<CPicture>(ImagePath::builtin("SpellBookLarge"), 0, 0);
updateShadow();
}

View File

@ -120,13 +120,14 @@ Below a list of supported commands, with their arguments wrapped in `<>`
`bonuses` - shows bonuses of currently selected adventure map object
#### Extract commands
`translate` - save game texts into json files
`translate maps` - save map and campaign texts into json files
`get config` - save game objects data into json files
`get scripts` - dumps lua script stuff into files (currently inactive due to scripting disabled for default builds)
`get txt` - save game texts into .txt files matching original heroes 3 files
`def2bmp <.def file name>` - extract .def animation as BMP files
`extract <relative file path>` - export file into directory used by other extraction commands
`translate` - save game texts into json files
`translate maps` - save map and campaign texts into json files
`get config` - save game objects data into json files
`get scripts` - dumps lua script stuff into files (currently inactive due to scripting disabled for default builds)
`get txt` - save game texts into .txt files matching original heroes 3 files
`def2bmp <.def file name>` - extract .def animation as BMP files
`extract <relative file path>` - export file into directory used by other extraction commands
`generate assets` - generate all assets at once
#### AI commands
`setBattleAI <ai name>` - change battle AI used by neutral creatures to the one specified, persists through game quit