main window and many fixes
This commit is contained in:
1 parent
80c329a697
commit
69700f8b65
18 files changed
+3280
-95
No files matched your search
@@ -28,20 +28,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// TMainScreen equivalent - PARTIAL PORT (session 1 of what will be a many-
|
||||
// session effort, see /memories/repo/cevo-evo-game.md for the full 183-
|
||||
// method inventory + proposed 10-file split). This slice only covers: the
|
||||
// 17 lazy dialog accessors, arrangeDialog()/arrangeDialogs(), and the
|
||||
// handful of small cross-dialog methods (dipCall/offerCall/
|
||||
// contactRefused/updateViews/setAIName/rememberPeaceViolation) that every
|
||||
// other LocalPlayer dialog already has a `Term::mainScreenXxx`
|
||||
// std::function injection point standing in for - this class's
|
||||
// constructor wires all of those through to real methods below. The full
|
||||
// map/panel/menu system (MainOffscreenPaint/PanelPaint/Client() etc.) is
|
||||
// NOT part of this slice and remains future work - this header is kept
|
||||
// SEPARATE from the widely-included Term.h specifically so consumers that
|
||||
// only need the `Term::mainScreen` pointer don't have to transitively
|
||||
// include all 17 dialog headers below.
|
||||
// TMainScreen equivalent - PARTIAL PORT. Ported so far: the window layer and
|
||||
// paint pipeline (Term.MainScreen.Window.cpp), PanelPaint (…Panel.cpp),
|
||||
// InitTurn/NextUnit/EndTurn/ZoomToCity (…Turn.cpp), most of Client()
|
||||
// (…Client.cpp) and the 17 lazy dialog accessors with the small cross-dialog
|
||||
// methods in Term.MainScreen.cpp. Still missing: the menus, mouse/keyboard
|
||||
// input, MoveUnit/ShowMove and sound. This header is kept SEPARATE from the
|
||||
// widely-included Term.h so consumers that only need the `Term::mainScreen`
|
||||
// pointer don't have to transitively include all the dialog headers below.
|
||||
|
||||
#include "Battle.h"
|
||||
#include "Cevo/CevoArea.h"
|
||||
@@ -157,6 +151,64 @@ public:
|
||||
void panelPaint();
|
||||
void setUnFocus(int uix);
|
||||
void focusOnLoc(int loc, int options = 0);
|
||||
// Moves the focused unit to an adjacent tile (Term.pas's MoveUnit).
|
||||
int moveUnit(int dx, int dy, int options = 0);
|
||||
// Path finder: moves the focused unit to loc, starts a multi-turn goto if too far.
|
||||
void moveToLoc(int loc, bool checkSuicide);
|
||||
// Animates a unit moving from step0 to step1 of nStep.
|
||||
void moveOnScreen(const TShowMove &showMove, int step0, int step1, int nStep, bool restore = true);
|
||||
void processEventsWithDisabledKeyboard();
|
||||
// Client() branches that animate what happens on the map.
|
||||
void clientShow(int command, int newPlayer, void *data);
|
||||
|
||||
// ---- Menus, settings and input (Term.MainScreen.Menus.cpp / Input.cpp) ----
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void updateMusic();
|
||||
void setDebugMap(int p);
|
||||
void setViewpoint(int p);
|
||||
void focusNextUnit(int dir = 1);
|
||||
int doJob(int job);
|
||||
void setFullScreen(bool active);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
enum class MenuCommand {
|
||||
Help, TechTree, Jump, Run, Names, LocCodes, Log, EnhanceDef, CityTypes, RandomMap, FillMap, Website, Resign,
|
||||
Disband, Utilize, City, Pillage, Home, Load, Unload, SelectTransport, GoOn, Cancel, Recover, Wait, NoOrders, Stay,
|
||||
Centre, PrevUnit, NextUnit, UnitStat, CityStat, ScienceStat, EUnitStat, Diagram, Wonders, Ships, Nations, Empire,
|
||||
Revolution, Trans, Afforest, Clear, Fort, AirBase, Canal, Mine, Farm, Irrigation, RailRoad, Road, Pollution,
|
||||
Enhance, TileSmall, TileNormal, TileBig, SoundOn, SoundOnAlt, SoundOff, MusicOn, MusicOff
|
||||
};
|
||||
enum class PopupKind { Game, Unit, Stat, Terrain, Edit };
|
||||
struct Menus;
|
||||
void createMenus();
|
||||
void initPopup(PopupKind kind);
|
||||
void showPopup(PopupKind kind, const QPoint &globalPos);
|
||||
void menuCommand(MenuCommand command);
|
||||
// Triggers a menu item if it is visible and enabled (MenuClick_Check of FormKeyDown).
|
||||
void menuClickChecked(PopupKind kind, MenuCommand command);
|
||||
void mapMouseDown(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QPoint pos);
|
||||
void mapMouseMove(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QPoint pos);
|
||||
void panelMouseDown(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QPoint pos);
|
||||
void panelMouseMove(Qt::MouseButtons buttons, QPoint pos);
|
||||
void panelMouseUp();
|
||||
bool isPanelPixel(int x, int y) const;
|
||||
void mapButtonClicked(ButtonC *button);
|
||||
void mapOptionButtonChanged(ButtonC *button, int option);
|
||||
void panelButtonClicked(ButtonB *button);
|
||||
void disbandOrUtilize(bool utilize);
|
||||
void setTroopLocAndPanel(int loc);
|
||||
void wireControls();
|
||||
QMenu *createUnitMenu();
|
||||
void triggerMenu(MenuCommand command);
|
||||
bool menuItemUsable(MenuCommand command) const;
|
||||
void setTileSize(IsoEngine::TileSize tileSize, int loc, QPoint mapPos);
|
||||
void setTileSizeCenter(IsoEngine::TileSize tileSize);
|
||||
void checkTerrainBtnVisible();
|
||||
@@ -245,10 +297,28 @@ private:
|
||||
Dpi::Bitmap m_blinkTile;
|
||||
QPoint m_blinkTilePos;
|
||||
bool m_blinkTileValid = false;
|
||||
// The map rectangle a moving unit travels through (see moveOnScreen).
|
||||
Dpi::Bitmap m_moveTile;
|
||||
QPoint m_moveTilePos;
|
||||
bool m_moveTileValid = false;
|
||||
bool m_keyboardDisabled = false;
|
||||
struct CurrentMoveInfo {
|
||||
int afterMovePaintRadius = 0;
|
||||
int afterAttackExpeller = -1;
|
||||
bool doShow = false;
|
||||
bool isAlly = false;
|
||||
} m_currentMoveInfo;
|
||||
std::unique_ptr<IsoEngine::IsoMap> m_mainMap;
|
||||
std::unique_ptr<IsoEngine::IsoMap> m_noMap;
|
||||
std::unique_ptr<IsoEngine::IsoMap> m_noMapPanel;
|
||||
std::unique_ptr<MiniMap> m_miniMap;
|
||||
std::unique_ptr<Menus> m_menus;
|
||||
int m_editLoc = -1;
|
||||
int m_mouseX = 0;
|
||||
int m_mouseY = 0;
|
||||
int m_dragStartLoc = -1;
|
||||
QRect m_restoredBounds;
|
||||
bool m_formFullScreen = false;
|
||||
std::unique_ptr<PVScrollBar> m_verticalScrollBar;
|
||||
ButtonB *m_unitBtn = nullptr;
|
||||
ButtonB *m_unitInfoBtn = nullptr;
|
||||
|
||||
Reference in new issue
Block a user