2022-11-18 17:54:10 +02:00
|
|
|
/*
|
2022-12-21 17:06:47 +02:00
|
|
|
* BattleWindow.h, part of VCMI engine
|
2022-11-18 17:54:10 +02:00
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../gui/CIntObject.h"
|
2022-12-25 12:22:07 +02:00
|
|
|
#include "../gui/InterfaceObjectConfigurable.h"
|
2022-12-20 01:28:20 +02:00
|
|
|
#include "../../lib/battle/CBattleInfoCallback.h"
|
2022-11-18 17:54:10 +02:00
|
|
|
|
2022-11-29 02:00:08 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
2022-11-18 17:54:10 +02:00
|
|
|
class CStack;
|
2022-11-29 02:00:08 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2022-11-18 17:54:10 +02:00
|
|
|
class CButton;
|
2022-12-09 13:26:17 +02:00
|
|
|
class BattleInterface;
|
|
|
|
class BattleConsole;
|
2022-12-21 17:02:53 +02:00
|
|
|
class BattleRenderer;
|
|
|
|
class StackQueue;
|
2022-11-18 17:54:10 +02:00
|
|
|
|
2022-12-11 23:16:23 +02:00
|
|
|
/// GUI object that handles functionality of panel at the bottom of combat screen
|
2023-01-04 16:20:53 +02:00
|
|
|
class BattleWindow : public InterfaceObjectConfigurable
|
2022-11-18 17:54:10 +02:00
|
|
|
{
|
2022-12-13 13:58:16 +02:00
|
|
|
BattleInterface & owner;
|
2022-11-18 17:54:10 +02:00
|
|
|
|
2022-12-21 17:02:53 +02:00
|
|
|
std::shared_ptr<StackQueue> queue;
|
|
|
|
std::shared_ptr<BattleConsole> console;
|
|
|
|
|
2022-12-11 23:16:23 +02:00
|
|
|
/// button press handling functions
|
2022-11-18 17:54:10 +02:00
|
|
|
void bOptionsf();
|
|
|
|
void bSurrenderf();
|
|
|
|
void bFleef();
|
|
|
|
void bAutofightf();
|
|
|
|
void bSpellf();
|
|
|
|
void bWaitf();
|
2022-12-20 01:28:20 +02:00
|
|
|
void bSwitchActionf();
|
2022-11-18 17:54:10 +02:00
|
|
|
void bDefencef();
|
|
|
|
void bConsoleUpf();
|
|
|
|
void bConsoleDownf();
|
|
|
|
void bTacticNextStack();
|
|
|
|
void bTacticPhaseEnd();
|
|
|
|
|
2022-12-11 23:16:23 +02:00
|
|
|
/// functions for handling actions after they were confirmed by popup window
|
|
|
|
void reallyFlee();
|
|
|
|
void reallySurrender();
|
2022-12-20 01:28:20 +02:00
|
|
|
|
|
|
|
/// management of alternative actions
|
|
|
|
std::list<PossiblePlayerBattleAction> alternativeActions;
|
|
|
|
PossiblePlayerBattleAction defaultAction;
|
|
|
|
void showAlternativeActionIcon(PossiblePlayerBattleAction);
|
2022-11-25 11:46:47 +02:00
|
|
|
|
2022-12-21 17:02:53 +02:00
|
|
|
/// Toggle StackQueue visibility
|
|
|
|
void hideQueue();
|
|
|
|
void showQueue();
|
|
|
|
|
2023-01-04 16:20:53 +02:00
|
|
|
std::shared_ptr<BattleConsole> buildBattleConsole(const JsonNode &) const;
|
|
|
|
|
2022-11-18 17:54:10 +02:00
|
|
|
public:
|
2022-12-21 17:06:47 +02:00
|
|
|
BattleWindow(BattleInterface & owner );
|
2022-12-21 18:04:19 +02:00
|
|
|
~BattleWindow();
|
2022-12-21 17:02:53 +02:00
|
|
|
|
2023-01-04 16:20:53 +02:00
|
|
|
/// Closes window once battle finished
|
|
|
|
void close();
|
2022-11-18 17:54:10 +02:00
|
|
|
|
2022-12-11 23:16:23 +02:00
|
|
|
/// block all UI elements when player is not allowed to act, e.g. during enemy turn
|
2022-11-18 17:54:10 +02:00
|
|
|
void blockUI(bool on);
|
|
|
|
|
2022-12-21 17:02:53 +02:00
|
|
|
/// Refresh queue after turn order changes
|
|
|
|
void updateQueue();
|
|
|
|
|
|
|
|
void activate() override;
|
|
|
|
void deactivate() override;
|
|
|
|
void keyPressed(const SDL_KeyboardEvent & key) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void show(SDL_Surface *to) override;
|
|
|
|
void showAll(SDL_Surface *to) override;
|
2022-11-27 02:26:02 +02:00
|
|
|
|
2022-12-11 23:16:23 +02:00
|
|
|
/// Toggle UI to displaying tactics phase
|
2022-11-18 17:54:10 +02:00
|
|
|
void tacticPhaseStarted();
|
2022-12-11 23:16:23 +02:00
|
|
|
|
|
|
|
/// Toggle UI to displaying battle log in place of tactics UI
|
2022-11-18 17:54:10 +02:00
|
|
|
void tacticPhaseEnded();
|
2023-01-04 16:20:53 +02:00
|
|
|
|
2022-12-20 01:28:20 +02:00
|
|
|
/// Set possible alternative options. If more than 1 - the last will be considered as default option
|
|
|
|
void setAlternativeActions(const std::list<PossiblePlayerBattleAction> &);
|
2022-11-18 17:54:10 +02:00
|
|
|
|
|
|
|
};
|
2022-11-27 02:26:02 +02:00
|
|
|
|