XEEN: Simplify showPharaohEndText method to use const char *

This commit is contained in:
Paul Gilbert 2018-02-23 19:01:04 -05:00
parent b5df2f8ec7
commit d5deec56c8
3 changed files with 5 additions and 15 deletions

View File

@ -1203,7 +1203,7 @@ void DarkSideCutscenes::showDarkSideScore(uint endingScore) {
saves.saveGame();
}
void DarkSideCutscenes::showPharaohEndText(const Common::String &msg1, const Common::String &msg2, const Common::String &msg3) {
void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, const char *msg3) {
const int YLIST[32] = {
-3, -3, -3, -3, -3, -3, -3, -3, -1, 0, 0, 0, 0, 0, 0, 0,
-1, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3
@ -1225,12 +1225,8 @@ void DarkSideCutscenes::showPharaohEndText(const Common::String &msg1, const Com
Windows &windows = *_vm->_windows;
SpriteResource claw("claw.int");
SpriteResource dragon1("dragon1.int");
int numPages = 0 + (msg1.empty() ? 0 : 1) + (msg2.empty() ? 0 : 1) + (msg3.empty() ? 0 : 1);
const char *const text[3] = {
msg1.empty() ? nullptr : msg1.c_str(),
msg2.empty() ? nullptr : msg2.c_str(),
msg3.empty() ? nullptr : msg3.c_str()
};
int numPages = 0 + (msg1 ? 1 : 0) + (msg2 ? 1 : 0) + (msg3 ? 1 : 0);
const char *const text[3] = { msg1, msg2, msg3 };
screen.loadBackground("3room.raw");
screen.saveBackground();

View File

@ -61,13 +61,7 @@ protected:
/**
* Shows the Pharaoh ending screen where score text is shown
*/
void showPharaohEndText(const Common::String &msg1, const Common::String &msg2, const Common::String &msg3);
void showPharaohEndText(const Common::String &msg1) {
showPharaohEndText(msg1, "", "");
}
void showPharaohEndText(const Common::String &msg1, const Common::String &msg2) {
showPharaohEndText(msg1, msg2, "");
}
void showPharaohEndText(const char *msg1, const char *msg2 = nullptr, const char *msg3 = nullptr);
public:
DarkSideCutscenes(XeenEngine *vm) : Cutscenes(vm) {}

View File

@ -51,7 +51,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
files.setGameCc(0);
sound.playSong("outday3.m");
showPharaohEndText(Res.WORLD_END_TEXT[0], nullptr, nullptr);
showPharaohEndText(Res.WORLD_END_TEXT[0]);
sound.playSound("elect.voc", 1, 0);
screen.loadBackground("skymain.raw");