mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 11:04:44 +00:00
XEEN: Add Quick Reference dialog
This commit is contained in:
parent
2b2ce19012
commit
78234db2c0
@ -33,6 +33,7 @@ Combat::Combat(XeenEngine *vm): _vm(vm) {
|
||||
Common::fill(&_elemPow[0], &_elemPow[12], 0);
|
||||
Common::fill(&_elemScale[0], &_elemScale[12], 0);
|
||||
Common::fill(&_shooting[0], &_shooting[8], 0);
|
||||
_globalCombat = 0;
|
||||
}
|
||||
|
||||
void Combat::clear() {
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
int _elemPow[12];
|
||||
int _elemScale[12];
|
||||
bool _shooting[8];
|
||||
int _globalCombat;
|
||||
public:
|
||||
Combat(XeenEngine *vm);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "xeen/dialogs_char_info.h"
|
||||
#include "xeen/dialogs_exchange.h"
|
||||
#include "xeen/dialogs_quick_ref.h"
|
||||
#include "xeen/resources.h"
|
||||
#include "xeen/xeen.h"
|
||||
|
||||
@ -194,6 +195,11 @@ void CharacterInfo::execute(int charIndex) {
|
||||
_vm->_mode = MODE_CHARACTER_INFO;
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_q:
|
||||
QuickReferenceDialog::show(_vm);
|
||||
redrawFlag = true;
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
goto exit;
|
||||
}
|
||||
@ -568,5 +574,4 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace Xeen
|
||||
|
89
engines/xeen/dialogs_quick_ref.cpp
Normal file
89
engines/xeen/dialogs_quick_ref.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/* 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 "xeen/dialogs_quick_ref.h"
|
||||
#include "xeen/resources.h"
|
||||
#include "xeen/xeen.h"
|
||||
|
||||
namespace Xeen {
|
||||
|
||||
void QuickReferenceDialog::show(XeenEngine *vm) {
|
||||
QuickReferenceDialog *dlg = new QuickReferenceDialog(vm);
|
||||
dlg->execute();
|
||||
delete dlg;
|
||||
}
|
||||
|
||||
void QuickReferenceDialog::execute() {
|
||||
Combat &combat = *_vm->_combat;
|
||||
EventsManager &events = *_vm->_events;
|
||||
Interface &intf = *_vm->_interface;
|
||||
Party &party = *_vm->_party;
|
||||
Screen &screen = *_vm->_screen;
|
||||
Common::String lines[8];
|
||||
|
||||
events.setCursor(0);
|
||||
|
||||
for (uint idx = 0; idx < (combat._globalCombat == 2 ? party._combatParty.size() :
|
||||
party._partyCount); ++idx) {
|
||||
Character &c = combat._globalCombat == 2 ? *party._combatParty[idx] :
|
||||
party._activeParty[idx];
|
||||
Condition condition = c.worstCondition();
|
||||
lines[idx] = Common::String::format(QUICK_REF_LINE,
|
||||
idx * 10 + 24, idx + 1, c._name.c_str(),
|
||||
CLASS_NAMES[c._class][0], CLASS_NAMES[c._class][1], CLASS_NAMES[c._class][2],
|
||||
c.statColor(c.getCurrentLevel(), c._level._permanent), c._level._permanent,
|
||||
c.statColor(c._currentHp, c.getMaxHP()), c._currentHp,
|
||||
c.statColor(c._currentSp, c.getMaxSP()), c._currentSp,
|
||||
c.statColor(c.getArmorClass(), c.getArmorClass(true)), c.getArmorClass(),
|
||||
CONDITION_COLORS[condition],
|
||||
CONDITION_NAMES[condition][0], CONDITION_NAMES[condition][1],
|
||||
CONDITION_NAMES[condition][2], CONDITION_NAMES[condition][3]
|
||||
);
|
||||
}
|
||||
|
||||
int food = (party._food / party._partyCount) / 3;
|
||||
Common::String msg = Common::String::format(QUICK_REFERENCE,
|
||||
lines[0].c_str(), lines[1].c_str(), lines[2].c_str(),
|
||||
lines[3].c_str(), lines[4].c_str(), lines[5].c_str(),
|
||||
lines[6].c_str(), lines[7].c_str(),
|
||||
party._gold, party._gems,
|
||||
food, food == 1 ? "" : "s"
|
||||
);
|
||||
|
||||
Window &w = screen._windows[24];
|
||||
bool windowOpen = w._enabled;
|
||||
if (!windowOpen)
|
||||
w.open();
|
||||
w.writeString(msg);
|
||||
w.update();
|
||||
|
||||
// Wait for a key/mouse press
|
||||
events.clearEvents();
|
||||
while (!_vm->shouldQuit() && !events.isKeyMousePressed())
|
||||
events.pollEventsAndWait();
|
||||
events.clearEvents();
|
||||
|
||||
if (!windowOpen)
|
||||
w.close();
|
||||
}
|
||||
|
||||
} // End of namespace Xeen
|
43
engines/xeen/dialogs_quick_ref.h
Normal file
43
engines/xeen/dialogs_quick_ref.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* 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 XEEN_DIALOGS_QUICK_REF_H
|
||||
#define XEEN_DIALOGS_QUICK_REF_H
|
||||
|
||||
#include "xeen/dialogs.h"
|
||||
|
||||
namespace Xeen {
|
||||
|
||||
class QuickReferenceDialog : public ButtonContainer {
|
||||
private:
|
||||
XeenEngine *_vm;
|
||||
|
||||
QuickReferenceDialog(XeenEngine *vm) : ButtonContainer(), _vm(vm) {}
|
||||
|
||||
void execute();
|
||||
public:
|
||||
static void show(XeenEngine *vm);
|
||||
};
|
||||
|
||||
} // End of namespace Xeen
|
||||
|
||||
#endif /* XEEN_DIALOGS_QUICK_REF_H */
|
@ -28,19 +28,13 @@ namespace Xeen {
|
||||
|
||||
FontSurface::FontSurface() : XSurface(), _fontData(nullptr), _bgColor(DEFAULT_BG_COLOR),
|
||||
_fontReduced(false),_fontJustify(JUSTIFY_NONE), _msgWraps(false) {
|
||||
_textColors[0] = 0;
|
||||
_textColors[1] = 0x40;
|
||||
_textColors[2] = 0x30;
|
||||
_textColors[3] = 0x20;
|
||||
setTextColor(0);
|
||||
}
|
||||
|
||||
FontSurface::FontSurface(int wv, int hv) : XSurface(wv, hv), _fontData(nullptr), _msgWraps(false),
|
||||
_bgColor(DEFAULT_BG_COLOR), _fontReduced(false), _fontJustify(JUSTIFY_NONE) {
|
||||
create(w, h);
|
||||
_textColors[0] = 0;
|
||||
_textColors[1] = 0x40;
|
||||
_textColors[2] = 0x30;
|
||||
_textColors[3] = 0x20;
|
||||
setTextColor(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "xeen/dialogs_error.h"
|
||||
#include "xeen/dialogs_automap.h"
|
||||
#include "xeen/dialogs_info.h"
|
||||
#include "xeen/dialogs_quick_ref.h"
|
||||
#include "xeen/resources.h"
|
||||
#include "xeen/xeen.h"
|
||||
|
||||
@ -704,6 +705,11 @@ void Interface::perform() {
|
||||
AutoMapDialog::show(_vm);
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_q:
|
||||
// Show the quick reference dialog
|
||||
QuickReferenceDialog::show(_vm);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ MODULE_OBJS := \
|
||||
dialogs_options.o \
|
||||
dialogs_info.o \
|
||||
dialogs_input.o \
|
||||
dialogs_quick_ref.o \
|
||||
dialogs_spells.o \
|
||||
dialogs_whowill.o \
|
||||
dialogs_yesno.o \
|
||||
|
@ -309,7 +309,7 @@ int Character::statColor(int amount, int threshold) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
int Character::statBonus(int statValue) const {
|
||||
int Character::statBonus(uint statValue) const {
|
||||
int idx;
|
||||
for (idx = 0; STAT_VALUES[idx] <= statValue; ++idx)
|
||||
;
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
|
||||
static int statColor(int amount, int threshold);
|
||||
|
||||
int statBonus(int statValue) const;
|
||||
int statBonus(uint statValue) const;
|
||||
|
||||
bool charSavingThrow(DamageType attackType) const;
|
||||
|
||||
|
@ -543,9 +543,9 @@ const int AGE_RANGES_ADJUST[2][10] = {
|
||||
{ -250, -50, -20, -10, 0, 2, 5, 10, 20, 50 }
|
||||
};
|
||||
|
||||
const int STAT_VALUES[24] = {
|
||||
const uint STAT_VALUES[24] = {
|
||||
3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 25, 30, 35, 40,
|
||||
50, 75, 100, 125, 150, 175, 200, 225, 250, 65535
|
||||
50, 75, 100, 125, 150, 175, 200, 225, 250,
|
||||
};
|
||||
|
||||
const int STAT_BONUSES[24] = {
|
||||
@ -971,4 +971,17 @@ const char *const FOOD_TEXT =
|
||||
|
||||
const char *const EXCHANGE_WITH_WHOM = "\t010\v005Exchange with whom?";
|
||||
|
||||
const char *const QUICK_REF_LINE =
|
||||
"\xB%3d\x9""007%u)\x9""027%s\x9""110%c%c%c\x3r\x9""160\xC%02u%u\xC""d"
|
||||
"\x3l\x9""170\xC%02u%d\xC""d\x9""208\xC%02u%u\xC""d\x9""247\xC"
|
||||
"%02u%u\xC""d\x9""270\xC%02u%c%c%c%c\xC""d";
|
||||
|
||||
const char *const QUICK_REFERENCE =
|
||||
"\xD\x3""cQuick Reference Chart\xB""012\x3l"
|
||||
"\x9""007#\x9""027Name\x9""110Cls\x9""140Lvl\x9""176H.P."
|
||||
"\x9""212S.P.\x9""241A.C.\x9""270Cond"
|
||||
"%s%s%s%s%s%s%s%s"
|
||||
"\xB""110\x9""064\x3""cGold\x9""144Gems\x9""224Food\xB""119"
|
||||
"\x9""064\xC""15%lu\x9""144%lu\x9""224%u day%s\xC""d";
|
||||
|
||||
} // End of namespace Xeen
|
||||
|
@ -147,7 +147,7 @@ extern const int AGE_RANGES[10];
|
||||
|
||||
extern const int AGE_RANGES_ADJUST[2][10];
|
||||
|
||||
extern const int STAT_VALUES[24];
|
||||
extern const uint STAT_VALUES[24];
|
||||
|
||||
extern const int STAT_BONUSES[24];
|
||||
|
||||
@ -323,6 +323,10 @@ extern const char *const FOOD_TEXT;
|
||||
|
||||
extern const char *const EXCHANGE_WITH_WHOM;
|
||||
|
||||
extern const char *const QUICK_REF_LINE;
|
||||
|
||||
extern const char *const QUICK_REFERENCE;
|
||||
|
||||
} // End of namespace Xeen
|
||||
|
||||
#endif /* XEEN_RESOURCES_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user