[Scummvm-git-logs] scummvm master -> 9eacfeb1ad74bbe56b8890617b7660f22ee763ed
dreammaster
paulfgilbert at gmail.com
Fri Mar 6 05:22:30 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9eacfeb1ad ULTIMA8: Clean up code for pentagram menu
Commit: 9eacfeb1ad74bbe56b8890617b7660f22ee763ed
https://github.com/scummvm/scummvm/commit/9eacfeb1ad74bbe56b8890617b7660f22ee763ed
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-03-05T21:22:26-08:00
Commit Message:
ULTIMA8: Clean up code for pentagram menu
Changed paths:
R engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
R engines/ultima/ultima8/gumps/pentagram_menu_gump.h
R engines/ultima/ultima8/gumps/widgets/game_widget.cpp
R engines/ultima/ultima8/gumps/widgets/game_widget.h
engines/ultima/module.mk
engines/ultima/ultima8/kernel/core_app.cpp
engines/ultima/ultima8/kernel/core_app.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 7ab047c575..f9786dbec3 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -417,7 +417,6 @@ MODULE_OBJS := \
ultima8/gumps/options_gump.o \
ultima8/gumps/paged_gump.o \
ultima8/gumps/paperdoll_gump.o \
- ultima8/gumps/pentagram_menu_gump.o \
ultima8/gumps/quit_gump.o \
ultima8/gumps/readable_gump.o \
ultima8/gumps/resizable_gump.o \
@@ -429,7 +428,6 @@ MODULE_OBJS := \
ultima8/gumps/u8_save_gump.o \
ultima8/gumps/widgets/button_widget.o \
ultima8/gumps/widgets/edit_widget.o \
- ultima8/gumps/widgets/game_widget.o \
ultima8/gumps/widgets/sliding_widget.o \
ultima8/gumps/widgets/text_widget.o \
ultima8/kernel/allocator.o \
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
deleted file mode 100644
index 62713ee234..0000000000
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/gumps/pentagram_menu_gump.h"
-#include "ultima/ultima8/graphics/render_surface.h"
-#include "ultima/ultima8/ultima8.h"
-#include "ultima/ultima8/gumps/widgets/game_widget.h"
-#include "ultima/ultima8/conf/setting_manager.h"
-#include "ultima/ultima8/filesys/file_system.h"
-#include "ultima/ultima8/filesys/idata_source.h"
-#include "ultima/ultima8/graphics/texture_png.h"
-#include "ultima/ultima8/gumps/u8_save_gump.h"
-#include "ultima/ultima8/gumps/gump_notify_process.h"
-#include "ultima/ultima8/kernel/kernel.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-DEFINE_RUNTIME_CLASSTYPE_CODE(PentagramMenuGump, ModalGump)
-
-PentagramMenuGump::PentagramMenuGump(int x, int y, int width, int height) :
- ModalGump(x, y, width, height) {
- _gameScrollPos = 0;
- _gameScrollTarget = 0;
- _gameScrollLastDelta = 0;
- _titleImage = 0;
- _navbarImage = 0;
- _coversImage = 0;
- _flagsImage = 0;
-}
-
-PentagramMenuGump::~PentagramMenuGump() {
- delete _titleImage;
- delete _navbarImage;
- delete _coversImage;
- delete _flagsImage;
-}
-
-void PentagramMenuGump::InitGump(Gump *newparent, bool take_focus) {
- ModalGump::InitGump(newparent, take_focus);
-
- GameWidget *g;
- int y = 50;
-
- Std::vector<istring> games;
- // TODO: listGames() should probably be in CoreApp
- games = SettingManager::get_instance()->listGames();
- unsigned int gameIndex = 0;
- for (unsigned int i = 0; i < games.size(); ++i) {
- istring gameName = games[i];
-
- if (gameName == "pentagram") continue;
- if (!Ultima8Engine::get_instance()->getGameInfo(gameName)) continue;
-
- g = new GameWidget(150, y, gameName);
- g->InitGump(this, false);
- g->SetIndex(gameIndex++);
- y += 114;
- }
-
- _gameCount = gameIndex;
-
- IDataSource *ds = FileSystem::get_instance()->ReadFile("@data/title.png");
- _titleImage = Texture::Create(ds, "title.png");
- delete ds;
-
- ds = FileSystem::get_instance()->ReadFile("@data/navbar.png");
- _navbarImage = Texture::Create(ds, "navbar.png");
- delete ds;
-
- ds = FileSystem::get_instance()->ReadFile("@data/covers.png");
- _coversImage = Texture::Create(ds, "covers.png");
- delete ds;
-
- ds = FileSystem::get_instance()->ReadFile("@data/flags.png");
- _flagsImage = Texture::Create(ds, "flags.png");
- delete ds;
-}
-
-void PentagramMenuGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
- int w = _dims.w, h = _dims.h;
-#if 1
- // CHECKME: fast enough?
- for (int i = 0; i < h; i += 4) {
- unsigned int r = (140 * i) / h;
- unsigned int gb = (21 * i) / h;
- uint32 col = 0xFF000000 + (r << 16) + (gb << 8) + gb;
- surf->Fill32(col, 0, i, w, 4);
- }
-#else
- surf->Fill32(0xFF440A0A, 0, 0, w, h);
-#endif
-
-// surf->Fill32(0xFFDCB95C, 18, 0, 90, 400);
- surf->Blit(_navbarImage, 0, 0, _navbarImage->w, _navbarImage->h, 9, 0);
-
-// surf->Fill32(0xFFC11515, 200, 6, 340, 36);
- surf->Blit(_titleImage, 0, 0, _titleImage->w, _titleImage->h, 200, 6);
-}
-
-void PentagramMenuGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- // Iterate all children
- Std::list<Gump *>::iterator it = _children.begin();
- Std::list<Gump *>::iterator end = _children.end();
-
- Rect game_clip_rect(0, 45, 640, _dims.h - 58);
- Rect cur_clip_rect;
- surf->GetClippingRect(cur_clip_rect);
-
-
- while (it != end) {
- Gump *g = *it;
-
- if (g->IsOfType<GameWidget>()) {
- surf->SetClippingRect(game_clip_rect);
- g->Move(150, 50 + 114 * g->GetIndex() + _gameScrollPos);
- }
-
- g->Paint(surf, lerp_factor, scaled);
-
- surf->SetClippingRect(cur_clip_rect);
-
- ++it;
- }
-}
-
-
-void PentagramMenuGump::ChildNotify(Gump *child, uint32 message) {
- if (child->IsOfType<GameWidget>()) {
-
- GameWidget *gw = p_dynamic_cast<GameWidget *>(child);
- istring gamename = gw->getGameName();
-
- switch (message) {
- case GameWidget::GAME_PLAY:
- Ultima8Engine::get_instance()->changeGame(gamename);
- break;
- case GameWidget::GAME_LOAD: {
- GameInfo *info = Ultima8Engine::get_instance()->getGameInfo(gamename);
- if (info && info->_type == GameInfo::GAME_U8) {
- Ultima8Engine::get_instance()->menuInitMinimal(gamename);
- Gump *gump = U8SaveGump::showLoadSaveGump(0, false);
- if (gump) {
- HideGump();
- gump->CreateNotifier();
-
- PentagramMenuCallbackProcess *p = new PentagramMenuCallbackProcess(getObjId(), gamename);
-
- Kernel::get_instance()->addProcess(p);
- p->waitFor(gump->GetNotifyProcess());
- } else {
- Ultima8Engine::get_instance()->menuInitMinimal("pentagram");
- }
- } else {
- Ultima8Engine::get_instance()->Error("Load Savegame not yet implemented");
- }
- }
- break;
- case GameWidget::GAME_SETTINGS:
- Ultima8Engine::get_instance()->Error("Settings not yet implemented");
- break;
- case GameWidget::GAME_REMOVE:
- Ultima8Engine::get_instance()->Error("Remove not yet implemented");
- break;
- }
- }
-}
-
-void PentagramMenuGump::run() {
- int oldpos = _gameScrollPos;
- ModalGump::run();
-
- if (_gameScrollPos != _gameScrollTarget) {
- int diff = _gameScrollTarget - _gameScrollPos;
- if (diff < 20 && diff > -20) {
- _gameScrollPos = _gameScrollTarget;
- } else {
- _gameScrollPos += diff / 3;
- }
- }
-
- _gameScrollLastDelta = _gameScrollPos - oldpos;
-}
-
-
-bool PentagramMenuGump::OnKeyDown(int key, int mod) {
- int delta = 0;
-
- if (key == Common::KEYCODE_DOWN) {
- delta = -114;
- } else if (key == Common::KEYCODE_UP) {
- delta = 114;
- }
-
- if (delta && _gameCount > 3) {
- _gameScrollTarget += delta;
-
- if (_gameScrollTarget > 0)
- _gameScrollTarget = 0;
- if (_gameScrollTarget < -114 * (_gameCount - 3))
- _gameScrollTarget = -114 * (_gameCount - 3);
-
- return true;
- }
-
- return false;
-}
-
-void PentagramMenuGump::ProcessCallback(const Std::string &gameName, int message) {
- if (message != 0) {
- Ultima8Engine::get_instance()->handleAutoSave();
- Ultima8Engine::get_instance()->changeGame(gameName);
- }
-
- UnhideGump();
- Ultima8Engine::get_instance()->menuInitMinimal("pentagram");
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h b/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
deleted file mode 100644
index d246e739e0..0000000000
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_GUMPS_PENTAGRAMMENUGUMP_H
-#define ULTIMA8_GUMPS_PENTAGRAMMENUGUMP_H
-
-#include "ultima/ultima8/gumps/modal_gump.h"
-#include "ultima/ultima8/kernel/process.h"
-#include "ultima/ultima8/kernel/object_manager.h"
-#include "ultima/ultima8/misc/p_dynamic_cast.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-class Texture;
-
-class PentagramMenuGump : public ModalGump {
- class PentagramMenuCallbackProcess : public Process {
- Std::string _game;
- public:
- PentagramMenuCallbackProcess(ObjId id, const Std::string &game) : Process(id), _game(game) {
- _flags |= PROC_RUNPAUSED;
- }
-
- void run() override {
- pout << "Gump returned: " << _result << Std::endl;
- PentagramMenuGump *menu = p_dynamic_cast<PentagramMenuGump *>(ObjectManager::get_instance()->getObject(getItemNum()));
- if (menu) menu->ProcessCallback(_game, _result);
- terminate();
- }
- };
-
-public:
- ENABLE_RUNTIME_CLASSTYPE()
-
- PentagramMenuGump(int x, int y, int w, int h);
- ~PentagramMenuGump() override;
-
- void InitGump(Gump *newparent, bool take_focus = true) override;
-
- void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
- void PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
-
- void ChildNotify(Gump *child, uint32 message) override;
-
- bool OnKeyDown(int key, int mod) override;
-
- void run() override;
-
-#if 0
- virtual uint16 TraceObjId(int32 mx, int32 my);
-
- virtual bool StartDraggingChild(Gump *gump, int32 mx, int32 my);
- virtual void DraggingChild(Gump *gump, int mx, int my);
- virtual void StopDraggingChild(Gump *gump);
-
- virtual Gump *OnMouseDown(int button, int32 mx, int32 my);
- virtual void OnMouseUp(int button, int32 mx, int32 my);
- virtual void OnMouseClick(int button, int32 mx, int32 my);
- virtual void OnMouseDouble(int button, int32 mx, int32 my);
-
- virtual void RenderSurfaceChanged();
-#endif
-
- Texture *getCovers() const {
- return _coversImage;
- }
- Texture *getFlags() const {
- return _flagsImage;
- }
-
-private:
- int _gameScrollPos;
- int _gameScrollTarget;
- int _gameScrollLastDelta;
-
- int _gameCount;
-
- Texture *_titleImage;
- Texture *_navbarImage;
- Texture *_coversImage;
- Texture *_flagsImage;
-
- void ProcessCallback(const Std::string &gameName, int message);
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
deleted file mode 100644
index 0f838f8e2b..0000000000
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/gumps/widgets/game_widget.h"
-
-#include "ultima/ultima8/ultima8.h"
-#include "ultima/ultima8/games/game_info.h"
-#include "ultima/ultima8/graphics/render_surface.h"
-#include "ultima/ultima8/gumps/widgets/text_widget.h"
-#include "ultima/ultima8/gumps/widgets/button_widget.h"
-#include "ultima/ultima8/gumps/pentagram_menu_gump.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-DEFINE_RUNTIME_CLASSTYPE_CODE(GameWidget, Gump)
-
-
-GameWidget::GameWidget(int x, int y, istring &game)
- : Gump(x, y, 443, 109), _highlight(false) {
- _info = Ultima8Engine::get_instance()->getGameInfo(game);
- assert(_info);
-}
-
-GameWidget::~GameWidget() {
-}
-
-istring GameWidget::getGameName() {
- return _info->_name;
-}
-void GameWidget::InitGump(Gump *newparent, bool take_focus) {
- Gump::InitGump(newparent, take_focus);
-
- // setup children
- Gump *w = new TextWidget(65, 2, _info->getGameTitle(),
- false, 0, 350, 180);
- w->InitGump(this, false);
-
- // FIXME: localize these strings
- Std::string gamename = "Game:";
- gamename += " ";
- gamename += _info->_name;
- w = new TextWidget(65, 29, gamename, false, 0, 350, 180);
- w->InitGump(this, false);
-
- Std::string path = "Path:";
- path += " ";
- w = new TextWidget(65, 50, path, false, 0, 350, 180);
- w->InitGump(this, false);
-
- Std::string version = _info->getPrintableVersion();
- w = new TextWidget(360, 70, version, false, 2, 70, 0, Font::TEXT_RIGHT);
- w->InitGump(this, false);
-
- w = new ButtonWidget(13, 86, "Play Game", false, 1, 0x80D000D0);
- w->SetIndex(static_cast<int32>(GAME_PLAY));
- w->InitGump(this, false);
-
- w = new ButtonWidget(122, 86, "Load Savegame", false, 1, 0x80D000D0);
- w->SetIndex(static_cast<int32>(GAME_LOAD));
- w->InitGump(this, false);
-
- w = new ButtonWidget(270, 86, "Settings", false, 1, 0x80D000D0);
- w->SetIndex(static_cast<int32>(GAME_SETTINGS));
- w->InitGump(this, false);
-
- w = new ButtonWidget(361, 86, "Remove", false, 1, 0x80D000D0);
- w->SetIndex(static_cast<int32>(GAME_REMOVE));
- w->InitGump(this, false);
-}
-
-void GameWidget::ChildNotify(Gump *child, uint32 message) {
- if (child->IsOfType<ButtonWidget>() &&
- message == ButtonWidget::BUTTON_CLICK) {
- int32 index_ = child->GetIndex();
-
- if (_parent)
- _parent->ChildNotify(this, static_cast<uint32>(index_));
- }
-}
-
-uint16 GameWidget::TraceObjId(int32 mx, int32 my) {
- uint16 objId_ = Gump::TraceObjId(mx, my);
- if (!objId_) objId_ = getObjId();
- return objId_;
-}
-
-Gump *GameWidget::OnMouseDown(int button, int32 mx, int32 my) {
- Gump *g = Gump::OnMouseDown(button, mx, my);
- if (!g) g = this;
- return g;
-}
-
-void GameWidget::OnMouseOver() {
- _highlight = true;
-}
-
-void GameWidget::OnMouseLeft() {
- _highlight = false;
-}
-
-
-void GameWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
- PentagramMenuGump *p = p_dynamic_cast<PentagramMenuGump *>(GetParent());
- Texture *coversImage = p->getCovers();
- Texture *flagsImage = p->getFlags();
-
- // Note: we're not painting a background to make this widget transparent
-
- // outer border
- surf->Fill32(0xFFFFFFFF, 0, 0, 443, 1);
- surf->Fill32(0xFFFFFFFF, 0, 0, 1, 109);
- surf->Fill32(0xFFFFFFFF, 0, 108, 443, 1);
- surf->Fill32(0xFFFFFFFF, 442, 0, 1, 109);
-
- // line above buttons
- surf->Fill32(0xFFFFFFFF, 0, 81, 443, 1);
-
- // line to the right of box graphics
- surf->Fill32(0xFFFFFFFF, 57, 0, 1, 81);
-
- // line below game description
- surf->Fill32(0xFFFFFFFF, 57, 23, 443 - 57, 1);
-
- // box graphics
-// surf->Fill32(0xFFAFAFFF,1,1,56,80);
- surf->Blit(coversImage, (_info->_type - 1) * 56, 0, 56, 80, 1, 1); // HACK...
-
- if (_highlight)
- surf->Fill32(0xFF30308F, 58, 1, 443 - 57 - 2, 22);
-
- // flag
-// surf->Fill32(0xFFAFFFAF,415,4,24,16);
- surf->Blit(flagsImage, (_info->_language - 1) * 24, 0, 24, 16, 415, 4); // HACK...
-
-
-#if 0
- Font *font = FontManager::get_instance()->getTTFont(1);
- assert(font);
-
- // FIXME: convert these into ButtonWidgets, localize texts,
- // adjust sizes/positions depending on texts
- surf->Fill32(0xFFE0E0E0, 13, 85, 87, 1);
- surf->Fill32(0xFFC0C0C0, 13, 86, 1, 18);
- surf->Fill32(0xFF808080, 99, 86, 1, 18);
- surf->Fill32(0xFF404040, 13, 104, 87, 1);
-
- unsigned int rem;
- Std::string button = "Play Game";
- RenderedText *t = font->renderText(button, rem, 0, 0);
- t->draw(surf, 19, 99);
- delete t;
-
- surf->Fill32(0xFFE0E0E0, 122, 85, 126, 1);
- surf->Fill32(0xFFC0C0C0, 122, 86, 1, 18);
- surf->Fill32(0xFF808080, 247, 86, 1, 18);
- surf->Fill32(0xFF404040, 122, 104, 126, 1);
-
- button = "Load Savegame";
- t = font->renderText(button, rem, 0, 0);
- t->draw(surf, 128, 99);
- delete t;
-
- surf->Fill32(0xFFE0E0E0, 270, 85, 69, 1);
- surf->Fill32(0xFFC0C0C0, 270, 86, 1, 18);
- surf->Fill32(0xFF808080, 338, 86, 1, 18);
- surf->Fill32(0xFF404040, 270, 104, 69, 1);
-
- button = "Settings";
- t = font->renderText(button, rem, 0, 0);
- t->draw(surf, 276, 99);
- delete t;
-
- surf->Fill32(0xFFE0E0E0, 361, 85, 67, 1);
- surf->Fill32(0xFFC0C0C0, 361, 86, 1, 18);
- surf->Fill32(0xFF808080, 427, 86, 1, 18);
- surf->Fill32(0xFF404040, 361, 104, 67, 1);
-
- button = "Remove";
- t = font->renderText(button, rem, 0, 0);
- t->draw(surf, 367, 99);
- delete t;
-#endif
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.h b/engines/ultima/ultima8/gumps/widgets/game_widget.h
deleted file mode 100644
index c5dbcedcc2..0000000000
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_GUMPS_WIDGETS_GAMEWIDGET_H
-#define ULTIMA8_GUMPS_WIDGETS_GAMEWIDGET_H
-
-#include "ultima/ultima8/gumps/gump.h"
-#include "ultima/ultima8/misc/p_dynamic_cast.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-struct GameInfo;
-
-class GameWidget : public Gump {
-public:
- // p_dynamic_class stuff
- ENABLE_RUNTIME_CLASSTYPE()
-
- GameWidget(int x, int y, istring &game);
- ~GameWidget() override;
-
- istring getGameName();
-
- void InitGump(Gump *newparent, bool take_focus = true) override;
-
- uint16 TraceObjId(int32 mx, int32 my) override;
-
- void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
-
- Gump *OnMouseDown(int button, int32 mx, int32 my) override;
- void OnMouseOver() override;
- void OnMouseLeft() override;
-
- void ChildNotify(Gump *child, uint32 message) override;
-
- enum Message {
- GAME_PLAY = 1,
- GAME_LOAD = 2,
- GAME_SETTINGS = 3,
- GAME_REMOVE = 4
- };
-
-protected:
- GameInfo *_info;
-
- bool _highlight;
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 24ce8dce27..272dcd5cbe 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -42,7 +42,7 @@ CoreApp *CoreApp::_application = 0;
CoreApp::CoreApp(const Ultima::UltimaGameDescription *gameDesc)
: _gameDesc(gameDesc), _isRunning(false), _gameInfo(0), _fileSystem(0),
- _configFileMan(0), _settingMan(0), _oHelp(false), _oQuiet(false), _oVQuiet(false) {
+ _configFileMan(0), _settingMan(0) {
_application = this;
}
@@ -61,29 +61,10 @@ CoreApp::~CoreApp() {
}
void CoreApp::startup() {
- DeclareArgs(); // Note: this is virtual
-
- ParseArgs(0, 0);
-
- if (_oHelp) {
- helpMe(); // Note: this is virtual
- error("Startup failed");
- }
-
-
sysInit();
-
loadConfig(); // load config files
}
-void CoreApp::DeclareArgs() {
- _parameters.declare("--game", &_oGameName, "");
- _parameters.declare("-h", &_oHelp, true);
- _parameters.declare("--help", &_oHelp, true);
- _parameters.declare("-q", &_oQuiet, true);
- _parameters.declare("-qq", &_oVQuiet, true);
-}
-
void CoreApp::sysInit() {
_gameInfo = 0;
@@ -161,12 +142,7 @@ GameInfo *CoreApp::getDefaultGame() {
Std::string defaultgame;
bool defaultset = _settingMan->get("defaultgame", defaultgame,
SettingManager::DOM_GLOBAL);
-
- if (_oGameName != "") {
- // game specified on commandline
- gamename = _oGameName;
-
- } else if (defaultset) {
+ if (defaultset) {
// default game specified in config file
gamename = defaultgame;
@@ -335,13 +311,6 @@ void CoreApp::ParseArgs(const int argc_, const char *const *const argv_) {
_parameters.process(argc_, argv_);
}
-void CoreApp::helpMe() {
- debug(MM_INFO, "\t-h\t\t- quick help menu (this)\n");
- debug(MM_INFO, "\t-q\t\t- silence general logging messages\n");
- debug(MM_INFO, "\t-qq\t\t- silence general logging messages and\n\t\t\t non-critical warnings/errors\n");
- debug(MM_INFO, "\t--game {name}\t- select a game\n");
-}
-
GameInfo *CoreApp::getGameInfo(istring game) const {
GameMap::const_iterator i;
i = _games.find(game);
diff --git a/engines/ultima/ultima8/kernel/core_app.h b/engines/ultima/ultima8/kernel/core_app.h
index 15e3961766..9c2017131a 100644
--- a/engines/ultima/ultima8/kernel/core_app.h
+++ b/engines/ultima/ultima8/kernel/core_app.h
@@ -77,24 +77,7 @@ public:
//! Get GameInfo for other configured game, or 0 for an invalid name.
GameInfo *getGameInfo(istring game) const;
- virtual void helpMe();
-
- bool help() const {
- return _oHelp;
- };
- bool quiet() const {
- return _oQuiet;
- };
- bool vquiet() const {
- return _oVQuiet;
- };
-
protected:
-
- //! Declare commandline arguments.
- //! Should call parent class' DeclareArgs().
- virtual void DeclareArgs();
-
bool _isRunning;
typedef Std::map<Common::String, GameInfo *, Common::IgnoreCase_Hash> GameMap;
@@ -145,11 +128,6 @@ protected:
//! Setup the virtual game paths for the current game (set in gameinfo)
//! Specifically, @game and @work
void setupGamePaths(GameInfo *gameinfo);
-
- Std::string _oGameName;
- bool _oHelp;
- bool _oQuiet;
- bool _oVQuiet;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 4915521b3b..eabf432d6e 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -63,7 +63,6 @@
#include "ultima/ultima8/gumps/minimap_gump.h"
#include "ultima/ultima8/gumps/quit_gump.h"
#include "ultima/ultima8/gumps/menu_gump.h"
-#include "ultima/ultima8/gumps/pentagram_menu_gump.h"
// For gump positioning... perhaps shouldn't do it this way....
#include "ultima/ultima8/gumps/bark_gump.h"
@@ -155,7 +154,6 @@ Ultima8Engine::~Ultima8Engine() {
Common::Error Ultima8Engine::run() {
if (initialize()) {
startup();
-
runGame();
deinitialize();
@@ -279,7 +277,8 @@ void Ultima8Engine::startup() {
if (setupGame(info))
startupGame();
else
- startupPentagramMenu();
+ // Couldn't setup the game, should never happen?
+ CANT_HAPPEN_MSG("default game failed to initialize");
paint();
}
@@ -356,21 +355,6 @@ void Ultima8Engine::startupGame() {
pout << "-- Game Initialized --" << Std::endl << Std::endl;
}
-void Ultima8Engine::startupPentagramMenu() {
- pout << Std::endl << "-- Initializing Pentagram Menu -- " << Std::endl;
-
- setupGame(getGameInfo("pentagram"));
- assert(_gameInfo);
-
- GraphicSysInit();
-
- Rect dims;
- _desktopGump->GetDims(dims);
-
- Gump *menugump = new PentagramMenuGump(0, 0, dims.w, dims.h);
- menugump->InitGump(0, true);
-}
-
void Ultima8Engine::shutdown() {
shutdownGame(false);
}
@@ -467,13 +451,6 @@ void Ultima8Engine::menuInitMinimal(istring gamename) {
pout << "-- Finished loading minimal--" << Std::endl << Std::endl;
}
-void Ultima8Engine::DeclareArgs() {
- // parent's arguments first
- CoreApp::DeclareArgs();
-
- // anything else?
-}
-
void Ultima8Engine::runGame() {
_isRunning = true;
@@ -543,7 +520,7 @@ void Ultima8Engine::runGame() {
if (setupGame(info))
startupGame();
else
- startupPentagramMenu();
+ CANT_HAPPEN_MSG("Failed to start up game with valid info.");
} else {
perr << "Game '" << _changeGameName << "' not found" << Std::endl;
_changeGameName.clear();
@@ -1405,8 +1382,7 @@ void Ultima8Engine::addGump(Gump *gump) {
assert(_desktopGump);
if (gump->IsOfType<ShapeViewerGump>() || gump->IsOfType<MiniMapGump>() ||
- gump->IsOfType<ScalerGump>() || gump->IsOfType<PentagramMenuGump>() ||
- gump->IsOfType<MessageBoxGump>()// ||
+ gump->IsOfType<ScalerGump>() || gump->IsOfType<MessageBoxGump>()// ||
//(_ttfOverrides && (gump->IsOfType<BarkGump>() ||
// gump->IsOfType<AskGump>()))
) {
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 4b72c203fa..82433f2916 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -172,8 +172,6 @@ protected:
bool initialize() override;
- void DeclareArgs() override;
-
/**
* Returns the data archive folder and version that's required
*/
More information about the Scummvm-git-logs
mailing list