XEEN: Refactor FontSurface as ancestors of Window, not Screen

This refactoring allowed Screen to now simply derive from
Graphics::Screen, and several duplicated methods could be removed.
This commit is contained in:
Paul Gilbert 2017-11-29 21:34:28 -05:00
parent 7c74f4f826
commit 2ca0235f44
30 changed files with 351 additions and 406 deletions

View File

@ -133,7 +133,6 @@ void Combat::clear() {
void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) {
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Scripts &scripts = *_vm->_scripts;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
@ -221,8 +220,7 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) {
// Draw the attack effect on the character sprite
sound.playFX(fx);
_powSprites.draw(screen, frame,
Common::Point(Res.CHAR_FACES_X[selectedIndex1], 150));
_powSprites.draw(0, frame, Common::Point(Res.CHAR_FACES_X[selectedIndex1], 150));
windows[33].update();
// Reduce damage if power shield active, and set it zero
@ -265,7 +263,6 @@ void Combat::doCharDamage(Character &c, int charNum, int monsterDataIndex) {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
MonsterStruct &monsterData = map._monsterData[monsterDataIndex];
@ -322,7 +319,7 @@ void Combat::doCharDamage(Character &c, int charNum, int monsterDataIndex) {
}
sound.playFX(fx);
intf._charPowSprites.draw(screen, frame, Common::Point(Res.CHAR_FACES_X[charNum], 150));
intf._charPowSprites.draw(0, frame, Common::Point(Res.CHAR_FACES_X[charNum], 150));
windows[33].update();
damage -= party._powerShield;

View File

@ -60,7 +60,7 @@ void Cutscenes::showSubtitles(uint windowIndex) {
if (!_boxSprites)
// Not already loaded, so load it
_boxSprites = new SpriteResource("box.vga");
_boxSprites->draw(screen, 0, Common::Point(36, 189));
_boxSprites->draw(0, 0, Common::Point(36, 189));
// Write the subtitle line
windows[windowIndex].writeString(_subtitleLine);
@ -150,15 +150,15 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) {
screen.restoreBackground();
if (i > 14) {
hand[14]->draw(screen, 0, Common::Point(SCROLL_L[ctr], 0), SPRFLAG_800);
hand[15]->draw(screen, 0, Common::Point(SCROLL_R[ctr], 0), SPRFLAG_800);
hand[14]->draw(0, 0, Common::Point(SCROLL_L[ctr], 0), SPRFLAG_800);
hand[15]->draw(0, 0, Common::Point(SCROLL_R[ctr], 0), SPRFLAG_800);
--ctr;
} else if (i != 0) {
hand[i - 1]->draw(screen, 0);
hand[i - 1]->draw(0, 0);
}
if (i <= 20)
marb[(i - 1) / 5]->draw(screen, (i - 1) % 5);
marb[(i - 1) / 5]->draw(0, (i - 1) % 5);
screen.update();
while (!_vm->shouldQuit() && events.timeElapsed() == 0)
@ -174,15 +174,15 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) {
screen.restoreBackground();
if (i < 14) {
hand[i]->draw(screen, 0);
hand[i]->draw(0, 0);
} else {
hand[14]->draw(screen, 0, Common::Point(SCROLL_L[ctr], 0), SPRFLAG_800);
hand[15]->draw(screen, 0, Common::Point(SCROLL_R[ctr], 0), SPRFLAG_800);
hand[14]->draw(0, 0, Common::Point(SCROLL_L[ctr], 0), SPRFLAG_800);
hand[15]->draw(0, 0, Common::Point(SCROLL_R[ctr], 0), SPRFLAG_800);
++ctr;
}
if (i < 20) {
marb[i / 5]->draw(screen, i % 5);
marb[i / 5]->draw(0, i % 5);
}
screen.update();
@ -195,8 +195,8 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) {
}
if (rollUp) {
hand[0]->draw(screen, 0);
marb[0]->draw(screen, 0);
hand[0]->draw(0, 0);
marb[0]->draw(0, 0);
} else {
screen.restoreBackground();
}

View File

@ -63,7 +63,6 @@ void ButtonContainer::addPartyButtons(XeenEngine *vm) {
bool ButtonContainer::checkEvents(XeenEngine *vm) {
EventsManager &events = *vm->_events;
Screen &screen = *vm->_screen;
Windows &windows = *_vm->_windows;
_buttonValue = 0;
@ -107,7 +106,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
if (btn._draw && btn._value == _buttonValue) {
// Found the correct button
// Draw button depressed
btn._sprites->draw(screen, btnIndex * 2 + 1,
btn._sprites->draw(0, btnIndex * 2 + 1,
Common::Point(btn._bounds.left, btn._bounds.top));
win.setBounds(btn._bounds);
win.update();
@ -117,7 +116,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
events.wait(2);
// Redraw button in it's original non-depressed form
btn._sprites->draw(screen, btnIndex * 2,
btn._sprites->draw(0, btnIndex * 2,
Common::Point(btn._bounds.left, btn._bounds.top));
win.setBounds(btn._bounds);
win.update();

View File

@ -34,7 +34,6 @@ void AutoMapDialog::show(XeenEngine *vm) {
}
void AutoMapDialog::execute() {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
@ -91,7 +90,7 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 0);
if (map._currentSteppedOn) {
map._tileSprites.draw(screen, map.mazeDataCurrent()._surfaceTypes[v],
map._tileSprites.draw(0, map.mazeDataCurrent()._surfaceTypes[v],
Common::Point(xp, yp));
}
}
@ -103,7 +102,7 @@ void AutoMapDialog::execute() {
int wallType = map.mazeDataCurrent()._wallTypes[v];
if (wallType && map._currentSteppedOn)
map._tileSprites.draw(screen, wallType, Common::Point(xp, yp));
map._tileSprites.draw(0, wallType, Common::Point(xp, yp));
}
}
@ -112,7 +111,7 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 8);
if (v && map._currentSteppedOn)
map._tileSprites.draw(screen, 1, Common::Point(xp, yp));
map._tileSprites.draw(0, 1, Common::Point(xp, yp));
}
}
} else {
@ -125,7 +124,7 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 0, 0xffff);
if (v != INVALID_CELL && map._currentSteppedOn)
map._tileSprites.draw(screen, 0, Common::Point(xp, yp));
map._tileSprites.draw(0, 0, Common::Point(xp, yp));
}
}
@ -134,14 +133,14 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(pt.x - 8, yDiff), 0, 0xffff);
if (v != INVALID_CELL && map._currentSurfaceId != 0 && map._currentSteppedOn)
map._tileSprites.draw(screen, 36 + map.mazeData()._surfaceTypes[
map._tileSprites.draw(0, 36 + map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(75, yp));
}
// Draw thin tile portion on top-left corner of map
v = map.mazeLookup(Common::Point(pt.x - 8, pt.y + 8), 0, 0xffff);
if (v != INVALID_CELL && map._currentSurfaceId != 0 && map._currentSteppedOn)
map._tileSprites.draw(screen, 36 + map.mazeData()._surfaceTypes[
map._tileSprites.draw(0, 36 + map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(75, 35));
// Draw any thin tiles at the very top of the map
@ -149,7 +148,7 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, pt.y + 8), 0, 0xffff);
if (v != INVALID_CELL && map._currentSurfaceId != 0 && map._currentSteppedOn)
map._tileSprites.draw(screen, 36 + map.mazeData()._surfaceTypes[
map._tileSprites.draw(0, 36 + map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(xp, 35));
}
@ -159,7 +158,7 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 0, 0xffff);
if (v != INVALID_CELL && map._currentSurfaceId && map._currentSteppedOn)
map._tileSprites.draw(screen, map.mazeData()._surfaceTypes[
map._tileSprites.draw(0, map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(xp, yp));
}
}
@ -216,7 +215,7 @@ void AutoMapDialog::execute() {
}
if (frame != -1 && map._currentSteppedOn)
map._tileSprites.draw(screen, frame, Common::Point(70, yp));
map._tileSprites.draw(0, frame, Common::Point(70, yp));
// Draw walls on top edge of map
v = map.mazeLookup(Common::Point(xDiff, pt.y + 8), 0);
@ -269,7 +268,7 @@ void AutoMapDialog::execute() {
}
if (frame != -1 && map._currentSteppedOn)
map._tileSprites.draw(screen, frame, Common::Point(xp, 30));
map._tileSprites.draw(0, frame, Common::Point(xp, 30));
}
// Draw any walls on the cells
@ -277,7 +276,7 @@ void AutoMapDialog::execute() {
for (int xCtr = 0, xp = 80, xDiff = pt.x - 7; xCtr < 16; ++xCtr, xp += 10, ++xDiff) {
// Draw the arrow if at the correct position
if ((arrowPt.x / 10) == xCtr && (14 - (arrowPt.y / 10)) == yCtr && frameEndFlag) {
globalSprites.draw(screen, party._mazeDirection + 1,
globalSprites.draw(0, party._mazeDirection + 1,
Common::Point(arrowPt.x + 81, arrowPt.y + 29));
}
@ -331,7 +330,7 @@ void AutoMapDialog::execute() {
}
if (frame != -1 && map._currentSteppedOn)
map._tileSprites.draw(screen, frame, Common::Point(xp, yp));
map._tileSprites.draw(0, frame, Common::Point(xp, yp));
v = map.mazeLookup(Common::Point(xDiff, yDiff), 0);
switch (v) {
@ -382,7 +381,7 @@ void AutoMapDialog::execute() {
}
if (frame != -1 && map._currentSteppedOn)
map._tileSprites.draw(screen, frame, Common::Point(xp, yp));
map._tileSprites.draw(0, frame, Common::Point(xp, yp));
}
}
@ -392,16 +391,16 @@ void AutoMapDialog::execute() {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 0, 0xffff);
if (v == INVALID_CELL || !map._currentSteppedOn)
map._tileSprites.draw(screen, 1, Common::Point(xp, yp));
map._tileSprites.draw(0, 1, Common::Point(xp, yp));
}
}
}
windows[5].frame();
if (!map._isOutdoors) {
map._tileSprites.draw(screen, 52, Common::Point(76, 30));
map._tileSprites.draw(0, 52, Common::Point(76, 30));
} else if (frameEndFlag) {
globalSprites.draw(screen, party._mazeDirection + 1,
globalSprites.draw(0, party._mazeDirection + 1,
Common::Point(arrowPt.x + 76, arrowPt.y + 25));
}

View File

@ -40,7 +40,6 @@ void CharacterInfo::execute(int charIndex) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
bool redrawFlag = true;
@ -319,12 +318,11 @@ Common::String CharacterInfo::loadCharacterDetails(const Character &c) {
}
void CharacterInfo::showCursor(bool flag) {
Screen &screen = *_vm->_screen;
const int CURSOR_X[5] = { 9, 60, 111, 176, 0 };
const int CURSOR_Y[5] = { 23, 46, 69, 92, 115 };
if (_cursorCell < 20) {
_iconSprites.draw(screen, flag ? 49 : 48,
_iconSprites.draw(0, flag ? 49 : 48,
Common::Point(CURSOR_X[_cursorCell / 5], CURSOR_Y[_cursorCell % 5]));
}
}

View File

@ -34,7 +34,6 @@ void Dismiss::show(XeenEngine *vm) {
}
void Dismiss::execute() {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;

View File

@ -34,7 +34,6 @@ void ErrorDialog::show(XeenEngine *vm, const Common::String &msg, ErrorWaitType
}
void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
Windows &windows = *_vm->_windows;
Window &w = windows[6];

View File

@ -33,7 +33,6 @@ void ExchangeDialog::show(XeenEngine *vm, Character *&c, int &charIndex) {
}
void ExchangeDialog::execute(Character *&c, int &charIndex) {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;

View File

@ -118,8 +118,6 @@ Common::KeyCode Input::waitForKey(const Common::String &msg) {
}
void Input::animateCursor() {
Screen &screen = *_vm->_screen;
// Iterate through each frame
_cursorAnimIndex = _cursorAnimIndex ? _cursorAnimIndex - 1 : 5;
static const int CURSOR_ANIMATION_IDS[] = { 32, 124, 126, 127, 126, 124 };
@ -128,9 +126,9 @@ void Input::animateCursor() {
Common::String cursorStr = Common::String::format("%c",
CURSOR_ANIMATION_IDS[_cursorAnimIndex]);
Common::Point writePos = screen._writePos;
Common::Point writePos = _window->_writePos;
_window->writeString(cursorStr);
screen._writePos = writePos;
_window->_writePos = writePos;
}
/*------------------------------------------------------------------------*/
@ -227,7 +225,6 @@ int Choose123::show(XeenEngine *vm, int numOptions) {
int Choose123::execute(int numOptions) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Town &town = *_vm->_town;
Windows &windows = *_vm->_windows;
@ -235,8 +232,8 @@ int Choose123::execute(int numOptions) {
_vm->_mode = MODE_DIALOG_123;
loadButtons(numOptions);
_iconSprites.draw(screen, 7, Common::Point(232, 74));
drawButtons(&screen);
_iconSprites.draw(0, 7, Common::Point(232, 74));
drawButtons(&windows[0]);
windows[34].update();
int result = -1;

View File

@ -41,7 +41,6 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Character *startingChar = c;
@ -100,7 +99,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
}
windows[29].writeString(msg);
drawButtons(&screen);
drawButtons(&windows[0]);
Common::fill(&arr[0], &arr[40], 0);
itemIndex = -1;
@ -110,26 +109,26 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
lines.clear();
if (mode == ITEMMODE_CHAR_INFO || category != 3) {
_iconSprites.draw(screen, 8, Common::Point(148, 109));
_iconSprites.draw(0, 8, Common::Point(148, 109));
}
if (mode != ITEMMODE_ENCHANT && mode != ITEMMODE_RECHARGE && mode != ITEMMODE_TO_GOLD) {
_iconSprites.draw(screen, 10, Common::Point(182, 109));
_iconSprites.draw(screen, 12, Common::Point(216, 109));
_iconSprites.draw(screen, 14, Common::Point(250, 109));
_iconSprites.draw(0, 10, Common::Point(182, 109));
_iconSprites.draw(0, 12, Common::Point(216, 109));
_iconSprites.draw(0, 14, Common::Point(250, 109));
}
switch (mode) {
case ITEMMODE_CHAR_INFO:
_iconSprites.draw(screen, 9, Common::Point(148, 109));
_iconSprites.draw(0, 9, Common::Point(148, 109));
break;
case ITEMMODE_BLACKSMITH:
_iconSprites.draw(screen, 11, Common::Point(182, 109));
_iconSprites.draw(0, 11, Common::Point(182, 109));
break;
case ITEMMODE_REPAIR:
_iconSprites.draw(screen, 15, Common::Point(250, 109));
_iconSprites.draw(0, 15, Common::Point(250, 109));
break;
case ITEMMODE_IDENTIFY:
_iconSprites.draw(screen, 13, Common::Point(216, 109));
_iconSprites.draw(0, 13, Common::Point(216, 109));
break;
default:
break;
@ -776,7 +775,6 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Spells &spells = *_vm->_spells;
Windows &windows = *_vm->_windows;
@ -807,7 +805,7 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
w.open();
w.writeString(Common::String::format(Res.WHICH_ITEM, Res.ITEM_ACTIONS[actionIndex]));
_iconSprites.draw(screen, 0, Common::Point(235, 111));
_iconSprites.draw(0, 0, Common::Point(235, 111));
w.update();
while (!_vm->shouldQuit()) {

View File

@ -696,7 +696,6 @@ void PartyDialog::createChar() {
int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) {
EventsManager &events = *_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Window &w = windows[28];
@ -899,7 +898,6 @@ void PartyDialog::drawDice(SpriteResource &dice) {
int PartyDialog::exchangeAttribute(int srcAttr) {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
SpriteResource icons;
icons.load("create2.icn");
@ -982,7 +980,6 @@ bool PartyDialog::saveCharacter(Character &c, int classId,
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Window &w = windows[6];
Common::String name;

View File

@ -34,7 +34,6 @@ bool Confirm::show(XeenEngine *vm, const Common::String &msg, int mode) {
}
bool Confirm::execute(const Common::String &msg, int mode) {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
Windows &windows = *_vm->_windows;
SpriteResource confirmSprites;
@ -103,7 +102,6 @@ bool YesNo::execute(bool type, bool townFlag) {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Town &town = *_vm->_town;
Windows &windows = *_vm->_windows;
SpriteResource confirmSprites;
@ -114,9 +112,9 @@ bool YesNo::execute(bool type, bool townFlag) {
if (!type) {
confirmSprites.load("confirm.icn");
res._globalSprites.draw(screen, 7, Common::Point(232, 74));
confirmSprites.draw(screen, 0, Common::Point(235, 75));
confirmSprites.draw(screen, 2, Common::Point(260, 75));
res._globalSprites.draw(0, 7, Common::Point(232, 74));
confirmSprites.draw(0, 0, Common::Point(235, 75));
confirmSprites.draw(0, 2, Common::Point(260, 75));
windows[34].update();
addButton(Common::Rect(235, 75, 259, 95), Common::KEYCODE_y, &confirmSprites);

View File

@ -39,7 +39,6 @@ void Quests::show(XeenEngine *vm) {
void Quests::execute() {
EventsManager &events = *_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Mode oldMode = _vm->_mode;
int count = 0;
@ -60,7 +59,7 @@ void Quests::execute() {
}
windows[29].writeString(Res.QUESTS_DIALOG_TEXT);
drawButtons(&screen);
drawButtons(&windows[0]);
while (!_vm->shouldQuit()) {
Common::String lines[MAX_DIALOG_LINES];

View File

@ -36,7 +36,6 @@ void QuickReferenceDialog::execute() {
Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Common::String lines[8];

View File

@ -43,7 +43,6 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Spells &spells = *_vm->_spells;
Windows &windows = *_vm->_windows;
@ -108,9 +107,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
isCasting ? c->_currentSp : party._gold
));
_scrollSprites.draw(screen, 4, Common::Point(39, 26));
_scrollSprites.draw(screen, 0, Common::Point(187, 26));
_scrollSprites.draw(screen, 2, Common::Point(187, 111));
_scrollSprites.draw(0, 4, Common::Point(39, 26));
_scrollSprites.draw(0, 0, Common::Point(187, 26));
_scrollSprites.draw(0, 2, Common::Point(187, 111));
if (isCasting)
_scrollSprites.draw(windows[25], 5, Common::Point(132, 123));
@ -163,7 +162,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
}
if (priorDialog != nullptr)
priorDialog->drawButtons(&screen);
priorDialog->drawButtons(&windows[0]);
windows[10].update();
}
}
@ -479,7 +478,6 @@ int CastSpell::execute(Character *&c) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Spells &spells = *_vm->_spells;
Windows &windows = *_vm->_windows;
Window &w = windows[10];
@ -503,7 +501,7 @@ int CastSpell::execute(Character *&c) {
w.writeString(Common::String::format(Res.CAST_SPELL_DETAILS,
c->_name.c_str(), spells._spellNames[spellId].c_str(),
spCost, gemCost, c->_currentSp));
drawButtons(&screen);
drawButtons(&windows[0]);
w.update();
redrawFlag = false;
@ -666,7 +664,6 @@ int SelectElement::execute(int spellId) {
Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Spells &spells = *_vm->_spells;
Windows &windows = *_vm->_windows;
Window &w = windows[15];
@ -678,7 +675,7 @@ int SelectElement::execute(int spellId) {
w.open();
w.writeString(Res.WHICH_ELEMENT1);
drawButtons(&screen);
drawButtons(&windows[0]);
w.update();
while (result == 999) {
@ -687,7 +684,7 @@ int SelectElement::execute(int spellId) {
intf.draw3d(true);
w.frame();
w.writeString(Res.WHICH_ELEMENT2);
drawButtons(&screen);
drawButtons(&windows[0]);
w.update();
do {
@ -745,7 +742,6 @@ void NotWhileEngaged::show(XeenEngine *vm, int spellId) {
void NotWhileEngaged::execute(int spellId) {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Spells &spells = *_vm->_spells;
Windows &windows = *_vm->_windows;
Window &w = windows[6];
@ -781,7 +777,6 @@ bool LloydsBeacon::execute() {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
Window &w = windows[10];
@ -815,7 +810,7 @@ bool LloydsBeacon::execute() {
w.open();
w.writeString(Common::String::format(Res.LLOYDS_BEACON,
mapName.c_str(), c._lloydPosition.x, c._lloydPosition.y));
drawButtons(&screen);
drawButtons(&windows[0]);
w.update();
bool result = true;
@ -886,7 +881,6 @@ int Teleport::show(XeenEngine *vm) {
int Teleport::execute() {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Window &w = windows[6];
Common::String num;
@ -993,7 +987,6 @@ void IdentifyMonster::execute() {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
Window &w = windows[17];

View File

@ -26,13 +26,18 @@
namespace Xeen {
FontSurface::FontSurface() : XSurface(), _fontData(nullptr), _bgColor(DEFAULT_BG_COLOR),
_fontReduced(false),_fontJustify(JUSTIFY_NONE), _msgWraps(false), _displayString(nullptr) {
const byte *FontData::_fontData;
Common::Point FontData::_writePos;
byte FontData::_textColors[4];
byte FontData::_bgColor;
bool FontData::_fontReduced;
Justify FontData::_fontJustify;
FontSurface::FontSurface() : XSurface() {
setTextColor(0);
}
FontSurface::FontSurface(int wv, int hv) : XSurface(wv, hv), _fontData(nullptr), _msgWraps(false),
_bgColor(DEFAULT_BG_COLOR), _fontReduced(false), _fontJustify(JUSTIFY_NONE), _displayString(nullptr) {
FontSurface::FontSurface(int wv, int hv) : XSurface(wv, hv), _msgWraps(false), _displayString(nullptr) {
create(w, h);
setTextColor(0);
}

View File

@ -33,7 +33,16 @@ namespace Xeen {
enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
class FontSurface: public XSurface {
struct FontData {
static const byte *_fontData;
static Common::Point _writePos;
static byte _textColors[4];
static byte _bgColor;
static bool _fontReduced;
static Justify _fontJustify;
};
class FontSurface: public XSurface, public FontData {
private:
const char *_displayString;
bool _msgWraps;
@ -67,13 +76,6 @@ private:
* Wrie a character to the surface
*/
void writeChar(char c, const Common::Rect &clipRect);
public:
const byte *_fontData;
Common::Point _writePos;
byte _textColors[4];
byte _bgColor;
bool _fontReduced;
Justify _fontJustify;
public:
FontSurface();
FontSurface(int wv, int hv);

View File

@ -50,10 +50,9 @@ void PartyDrawer::drawParty(bool updateFlag) {
Combat &combat = *_vm->_combat;
Party &party = *_vm->_party;
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
bool inCombat = _vm->_mode == MODE_COMBAT;
_restoreSprites.draw(screen, 0, Common::Point(8, 149));
_restoreSprites.draw(0, 0, Common::Point(8, 149));
// Handle drawing the party faces
uint partyCount = inCombat ? combat._combatParty.size() : party._activeParty.size();
@ -66,7 +65,7 @@ void PartyDrawer::drawParty(bool updateFlag) {
if (charFrame > 4)
charFrame -= 5;
sprites->draw(screen, charFrame, Common::Point(Res.CHAR_FACES_X[idx], 150));
sprites->draw(0, charFrame, Common::Point(Res.CHAR_FACES_X[idx], 150));
}
for (uint idx = 0; idx < partyCount; ++idx) {
@ -86,11 +85,11 @@ void PartyDrawer::drawParty(bool updateFlag) {
else
frame = 1;
_hpSprites.draw(screen, frame, Common::Point(Res.HP_BARS_X[idx], 182));
_hpSprites.draw(0, frame, Common::Point(Res.HP_BARS_X[idx], 182));
}
if (_hiliteChar != HILIGHT_CHAR_NONE)
res._globalSprites.draw(screen, 8, Common::Point(Res.CHAR_FACES_X[_hiliteChar] - 1, 149));
res._globalSprites.draw(0, 8, Common::Point(Res.CHAR_FACES_X[_hiliteChar] - 1, 149));
if (updateFlag)
windows[33].update();
@ -98,18 +97,17 @@ void PartyDrawer::drawParty(bool updateFlag) {
void PartyDrawer::highlightChar(int charId) {
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
if (charId != _hiliteChar && _hiliteChar != HILIGHT_CHAR_DISABLED) {
// Handle deselecting any previusly selected char
if (_hiliteChar != HILIGHT_CHAR_NONE) {
res._globalSprites.draw(screen, 9 + _hiliteChar,
res._globalSprites.draw(0, 9 + _hiliteChar,
Common::Point(Res.CHAR_FACES_X[_hiliteChar] - 1, 149));
}
// Highlight new character
res._globalSprites.draw(screen, 8, Common::Point(Res.CHAR_FACES_X[charId] - 1, 149));
res._globalSprites.draw(0, 8, Common::Point(Res.CHAR_FACES_X[charId] - 1, 149));
_hiliteChar = charId;
windows[33].update();
}
@ -117,11 +115,10 @@ void PartyDrawer::highlightChar(int charId) {
void PartyDrawer::unhighlightChar() {
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
if (_hiliteChar != HILIGHT_CHAR_NONE) {
res._globalSprites.draw(screen, _hiliteChar + 9,
res._globalSprites.draw(0, _hiliteChar + 9,
Common::Point(Res.CHAR_FACES_X[_hiliteChar] - 1, 149));
_hiliteChar = HILIGHT_CHAR_NONE;
windows[33].update();
@ -1749,7 +1746,6 @@ void Interface::drawMiniMap() {
void Interface::assembleBorder() {
Combat &combat = *_vm->_combat;
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
// Draw the outer frame
@ -1762,13 +1758,13 @@ void Interface::assembleBorder() {
_levitateUIFrame = (_levitateUIFrame + 1) % 12;
// Draw UI element to indicate whether can spot hidden doors
_borderSprites.draw(screen,
_borderSprites.draw(0,
(_thinWall && _vm->_party->checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28,
Common::Point(194, 91));
_spotDoorsUIFrame = (_spotDoorsUIFrame + 1) % 12;
// Draw UI element to indicate whether can sense danger
_borderSprites.draw(screen,
_borderSprites.draw(0,
(combat._dangerPresent && _vm->_party->checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40,
Common::Point(107, 9));
_dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12;
@ -1791,58 +1787,57 @@ void Interface::assembleBorder() {
_face2UIFrame = 8;
}
_borderSprites.draw(screen, _face1UIFrame, Common::Point(0, 32));
_borderSprites.draw(screen,
windows[10]._enabled || windows[2]._enabled ?
52 : _face2UIFrame,
_borderSprites.draw(0, _face1UIFrame, Common::Point(0, 32));
_borderSprites.draw(0,
windows[10]._enabled || windows[2]._enabled ? 52 : _face2UIFrame,
Common::Point(215, 32));
// Draw resistence indicators
if (!windows[10]._enabled && !windows[2]._enabled
&& windows[38]._enabled) {
_fecpSprites.draw(screen, _vm->_party->_fireResistence ? 1 : 0,
_fecpSprites.draw(0, _vm->_party->_fireResistence ? 1 : 0,
Common::Point(2, 2));
_fecpSprites.draw(screen, _vm->_party->_electricityResistence ? 3 : 2,
_fecpSprites.draw(0, _vm->_party->_electricityResistence ? 3 : 2,
Common::Point(219, 2));
_fecpSprites.draw(screen, _vm->_party->_coldResistence ? 5 : 4,
_fecpSprites.draw(0, _vm->_party->_coldResistence ? 5 : 4,
Common::Point(2, 134));
_fecpSprites.draw(screen, _vm->_party->_poisonResistence ? 7 : 6,
_fecpSprites.draw(0, _vm->_party->_poisonResistence ? 7 : 6,
Common::Point(219, 134));
} else {
_fecpSprites.draw(screen, _vm->_party->_fireResistence ? 9 : 8,
_fecpSprites.draw(0, _vm->_party->_fireResistence ? 9 : 8,
Common::Point(8, 8));
_fecpSprites.draw(screen, _vm->_party->_electricityResistence ? 10 : 11,
_fecpSprites.draw(0, _vm->_party->_electricityResistence ? 10 : 11,
Common::Point(219, 8));
_fecpSprites.draw(screen, _vm->_party->_coldResistence ? 12 : 13,
_fecpSprites.draw(0, _vm->_party->_coldResistence ? 12 : 13,
Common::Point(8, 134));
_fecpSprites.draw(screen, _vm->_party->_poisonResistence ? 14 : 15,
_fecpSprites.draw(0, _vm->_party->_poisonResistence ? 14 : 15,
Common::Point(219, 134));
}
// Draw UI element for blessed
_blessSprites.draw(screen, 16, Common::Point(33, 137));
_blessSprites.draw(0, 16, Common::Point(33, 137));
if (_vm->_party->_blessed) {
_blessedUIFrame = (_blessedUIFrame + 1) % 4;
_blessSprites.draw(screen, _blessedUIFrame, Common::Point(33, 137));
_blessSprites.draw(0, _blessedUIFrame, Common::Point(33, 137));
}
// Draw UI element for power shield
if (_vm->_party->_powerShield) {
_powerShieldUIFrame = (_powerShieldUIFrame + 1) % 4;
_blessSprites.draw(screen, _powerShieldUIFrame + 4,
_blessSprites.draw(0, _powerShieldUIFrame + 4,
Common::Point(55, 137));
}
// Draw UI element for holy bonus
if (_vm->_party->_holyBonus) {
_holyBonusUIFrame = (_holyBonusUIFrame + 1) % 4;
_blessSprites.draw(screen, _holyBonusUIFrame + 8, Common::Point(160, 137));
_blessSprites.draw(0, _holyBonusUIFrame + 8, Common::Point(160, 137));
}
// Draw UI element for heroism
if (_vm->_party->_heroism) {
_heroismUIFrame = (_heroismUIFrame + 1) % 4;
_blessSprites.draw(screen, _heroismUIFrame + 12, Common::Point(182, 137));
_blessSprites.draw(0, _heroismUIFrame + 12, Common::Point(182, 137));
}
// Draw direction character if direction sense is active
@ -1863,7 +1858,6 @@ void Interface::doCombat() {
EventsManager &events = *_vm->_events;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Scripts &scripts = *_vm->_scripts;
Spells &spells = *_vm->_spells;
Sound &sound = *_vm->_sound;
@ -1926,7 +1920,7 @@ void Interface::doCombat() {
// Write out the description of the monsters being battled
w.writeString(combat.getMonsterDescriptions());
_iconSprites.draw(screen, 32, Common::Point(233, combat._monsterIndex * 10 + 27),
_iconSprites.draw(0, 32, Common::Point(233, combat._monsterIndex * 10 + 27),
0x8010000);
w.update();
@ -2244,7 +2238,6 @@ void Interface::spellFX(Character *c) {
Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
@ -2275,7 +2268,7 @@ void Interface::spellFX(Character *c) {
for (int frameNum = 0; frameNum < 4; ++frameNum) {
events.updateGameCounter();
_spellFxSprites.draw(screen, frameNum, Common::Point(
_spellFxSprites.draw(0, frameNum, Common::Point(
Res.CHAR_FACES_X[charIndex], 150));
if (!windows[11]._enabled)

View File

@ -568,7 +568,6 @@ void Party::giveTreasure() {
Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Scripts &scripts = *_vm->_scripts;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
@ -704,7 +703,6 @@ bool Party::arePacksFull() const {
void Party::giveTreasureToCharacter(Character &c, ItemCategory category, int itemIndex) {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
Window &w = windows[10];

View File

@ -35,79 +35,6 @@ Screen::Screen(XeenEngine *vm) : _vm(vm) {
create(SCREEN_WIDTH, SCREEN_HEIGHT);
Common::fill(&_tempPalette[0], &_tempPalette[PALETTE_SIZE], 0);
Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0);
// Load font data for the screen
File f("fnt");
byte *data = new byte[f.size()];
f.read(data, f.size());
_fontData = data;
}
Screen::~Screen() {
delete[] _fontData;
}
void Screen::update() {
// Merge the dirty rects
mergeDirtyRects();
// Loop through copying dirty areas to the physical screen
Common::List<Common::Rect>::iterator i;
for (i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) {
const Common::Rect &r = *i;
const byte *srcP = (const byte *)getBasePtr(r.left, r.top);
g_system->copyRectToScreen(srcP, this->pitch, r.left, r.top,
r.width(), r.height());
}
// Signal the physical screen to update
g_system->updateScreen();
_dirtyRects.clear();
}
void Screen::addDirtyRect(const Common::Rect &r) {
assert(r.isValidRect() && r.width() > 0 && r.height() > 0
&& r.left >= 0 && r.top >= 0
&& r.right <= SCREEN_WIDTH && r.bottom <= SCREEN_HEIGHT);
_dirtyRects.push_back(r);
}
void Screen::mergeDirtyRects() {
Common::List<Common::Rect>::iterator rOuter, rInner;
// Ensure dirty rect list has at least two entries
rOuter = _dirtyRects.begin();
for (int i = 0; i < 2; ++i, ++rOuter) {
if (rOuter == _dirtyRects.end())
return;
}
// Process the dirty rect list to find any rects to merge
for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) {
rInner = rOuter;
while (++rInner != _dirtyRects.end()) {
if ((*rOuter).intersects(*rInner)) {
// these two rectangles overlap or
// are next to each other - merge them
unionRectangle(*rOuter, *rOuter, *rInner);
// remove the inner rect from the list
_dirtyRects.erase(rInner);
// move back to beginning of list
rInner = rOuter;
}
}
}
}
bool Screen::unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2) {
destRect = src1;
destRect.extend(src2);
return !destRect.isEmpty();
}
void Screen::loadPalette(const Common::String &name) {

View File

@ -23,11 +23,8 @@
#ifndef XEEN_SCREEN_H
#define XEEN_SCREEN_H
//#include "common/scummsys.h"
//#include "common/system.h"
// #include "common/array.h"
//#include "common/keyboard.h"
#include "common/rect.h"
#include "graphics/screen.h"
#include "xeen/font.h"
#include "xeen/sprites.h"
@ -40,20 +37,15 @@ namespace Xeen {
class XeenEngine;
class Screen: public FontSurface {
class Screen: public Graphics::Screen {
private:
XeenEngine *_vm;
Common::List<Common::Rect> _dirtyRects;
byte _mainPalette[PALETTE_SIZE];
byte _tempPalette[PALETTE_SIZE];
XSurface _pages[2];
XSurface _savedScreens[10];
bool _fadeIn;
void mergeDirtyRects();
bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2);
/**
* Mark the entire screen for drawing
*/
@ -64,17 +56,15 @@ private:
void updatePalette();
void updatePalette(const byte *pal, int start, int count16);
public:
/**
* Adds an area that requires redrawing on the next frame update
*/
virtual void addDirtyRect(const Common::Rect &r);
public:
Screen(XeenEngine *vm);
virtual ~Screen() {}
virtual ~Screen();
void update();
/**
* Base method that descendent classes can override for recording affected
* dirty areas of the surface
*/
virtual void addDirtyRect(const Common::Rect &r) { Graphics::Screen::addDirtyRect(r); }
/**
* Load a palette resource into the temporary palette

View File

@ -136,7 +136,6 @@ int Scripts::checkEvents() {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Town &town = *_vm->_town;
Windows &windows = *_vm->_windows;
@ -1819,7 +1818,6 @@ bool Scripts::copyProtectionCheck() {
void Scripts::display(bool justifyFlag, int var46) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
Window &w = windows[_windowIndex];

View File

@ -308,6 +308,12 @@ void SpriteResource::draw(Window &dest, int frame, const Common::Point &destPos,
draw(dest, frame, destPos, dest.getBounds(), flags, scale);
}
void SpriteResource::draw(int windowIndex, int frame, const Common::Point &destPos,
int flags, int scale) {
Window &win = (*g_vm->_windows)[windowIndex];
draw(win, frame, destPos, flags, scale);
}
void SpriteResource::draw(XSurface &dest, int frame, const Common::Point &destPos,
const Common::Rect &bounds, int flags, int scale) {
@ -320,6 +326,10 @@ void SpriteResource::draw(XSurface &dest, int frame) {
draw(dest, frame, Common::Point());
}
void SpriteResource::draw(int windowIndex, int frame) {
draw((*g_vm->_windows)[windowIndex], frame, Common::Point());
}
uint SpriteResource::getScaledVal(int xy, uint16 &scaleMask) {
if (!xy)
return 0;

View File

@ -63,6 +63,12 @@ private:
void draw(XSurface &dest, int frame, const Common::Point &destPos,
const Common::Rect &bounds, int flags = 0, int scale = 0);
/**
* Draw the sprite onto a given window
*/
void draw(int windowNum, int frame, const Common::Point &destPos,
const Common::Rect &bounds, int flags = 0, int scale = 0);
/**
* Draw a sprite frame based on a passed offset into the data stream
*/
@ -99,17 +105,34 @@ public:
*/
void clear();
/**
* Draw a sprite onto a surface
*/
void draw(XSurface &dest, int frame, const Common::Point &destPos,
int flags = 0, int scale = 0);
/**
* Draw a sprite onto a specific window
*/
void draw(Window &dest, int frame, const Common::Point &destPos,
int flags = 0, int scale = 0);
/**
* Draw a sprite onto a given window
*/
void draw(int windowIndex, int frame, const Common::Point &destPos,
int flags = 0, int scale = 0);
/**
* Draw the sprite onto the given surface
*/
void draw(XSurface &dest, int frame);
/**
* Draw the sprite onto the given window
*/
void draw(int windowIndex, int frame);
int size() const { return _index.size(); }
bool empty() const { return _index.size() == 0; }

View File

@ -68,7 +68,6 @@ int Town::townAction(TownAction actionId) {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
bool isDarkCc = _vm->_files->_isDarkCc;
@ -220,9 +219,9 @@ int Town::townAction(TownAction actionId) {
intf._spotDoorsUIFrame = 0;
intf._levitateUIFrame = 0;
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _townPos);
if (actionId == BANK && isDarkCc) {
_townSprites[4].draw(screen, _vm->getRandomNumber(13, 18),
_townSprites[4].draw(0, _vm->getRandomNumber(13, 18),
Common::Point(8, 30));
}
@ -231,7 +230,7 @@ int Town::townAction(TownAction actionId) {
// Open up the window and write the string
windows[10].open();
windows[10].writeString(title);
drawButtons(&screen);
drawButtons(&windows[0]);
windows[0].update();
intf.highlightChar(0);
@ -250,7 +249,7 @@ int Town::townAction(TownAction actionId) {
title = createTownText(*charP);
windows[10].writeString(title);
drawButtons(&screen);
drawButtons(&windows[0]);
} while (_buttonValue != Common::KEYCODE_ESCAPE);
switch (actionId) {
@ -598,7 +597,6 @@ Character *Town::doTavernOptions(Character *c) {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
bool isDarkCc = _vm->_files->_isDarkCc;
@ -747,7 +745,7 @@ Character *Town::doTavernOptions(Character *c) {
windows[10].writeString(Common::String::format(Res.TAVERN_TEXT,
c->_name.c_str(), Res.HAVE_A_DRINK,
XeenEngine::printMil(party._gold).c_str()));
drawButtons(&screen);
drawButtons(&windows[0]);
windows[10].update();
townWait();
} else {
@ -756,7 +754,7 @@ Character *Town::doTavernOptions(Character *c) {
windows[10].writeString(Common::String::format(Res.TAVERN_TEXT,
c->_name.c_str(), Res.YOURE_DRUNK,
XeenEngine::printMil(party._gold).c_str()));
drawButtons(&screen);
drawButtons(&windows[0]);
windows[10].update();
townWait();
} else if (party.subtract(0, 1, 0, WT_2)) {
@ -1062,7 +1060,6 @@ void Town::depositWithdrawl(int choice) {
void Town::drawTownAnim(bool flag) {
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
bool isDarkCc = _vm->_files->_isDarkCc;
@ -1070,23 +1067,23 @@ void Town::drawTownAnim(bool flag) {
if (_townActionId == 1) {
if (sound.isPlaying()) {
if (isDarkCc) {
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[2].draw(screen, _vm->getRandomNumber(11) == 1 ? 9 : 10,
_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _townPos);
_townSprites[2].draw(0, _vm->getRandomNumber(11) == 1 ? 9 : 10,
Common::Point(34, 33));
_townSprites[2].draw(screen, _vm->getRandomNumber(5) + 3,
_townSprites[2].draw(0, _vm->getRandomNumber(5) + 3,
Common::Point(34, 54));
}
} else {
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _townPos);
if (isDarkCc) {
_townSprites[2].draw(screen, _vm->getRandomNumber(11) == 1 ? 9 : 10,
_townSprites[2].draw(0, _vm->getRandomNumber(11) == 1 ? 9 : 10,
Common::Point(34, 33));
}
}
} else {
if (!isDarkCc || _townActionId != 5) {
if (!_townSprites[_drawFrameIndex / 8].empty())
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _townPos);
}
}
@ -1095,16 +1092,16 @@ void Town::drawTownAnim(bool flag) {
if (sound.isPlaying() || (isDarkCc && intf._overallFrame)) {
if (isDarkCc) {
if (sound.isPlaying() || intf._overallFrame == 1) {
_townSprites[4].draw(screen, _vm->getRandomNumber(13, 18),
_townSprites[4].draw(0, _vm->getRandomNumber(13, 18),
Common::Point(8, 30));
} else if (intf._overallFrame > 1) {
_townSprites[4].draw(screen, 13 - intf._overallFrame++,
_townSprites[4].draw(0, 13 - intf._overallFrame++,
Common::Point(8, 30));
if (intf._overallFrame > 14)
intf._overallFrame = 0;
}
} else {
_townSprites[2].draw(screen, _vm->getRandomNumber(7, 11), Common::Point(8, 8));
_townSprites[2].draw(0, _vm->getRandomNumber(7, 11), Common::Point(8, 8));
}
}
break;
@ -1114,9 +1111,9 @@ void Town::drawTownAnim(bool flag) {
if (isDarkCc) {
if (intf._overallFrame) {
intf._overallFrame ^= 1;
_townSprites[6].draw(screen, intf._overallFrame, Common::Point(8, 106));
_townSprites[6].draw(0, intf._overallFrame, Common::Point(8, 106));
} else {
_townSprites[6].draw(screen, _vm->getRandomNumber(3), Common::Point(16, 48));
_townSprites[6].draw(0, _vm->getRandomNumber(3), Common::Point(16, 48));
}
}
}
@ -1124,13 +1121,13 @@ void Town::drawTownAnim(bool flag) {
case TAVERN:
if (sound.isPlaying() && isDarkCc) {
_townSprites[4].draw(screen, _vm->getRandomNumber(7), Common::Point(153, 49));
_townSprites[4].draw(0, _vm->getRandomNumber(7), Common::Point(153, 49));
}
break;
case TEMPLE:
if (sound.isPlaying()) {
_townSprites[3].draw(screen, _vm->getRandomNumber(2, 4), Common::Point(8, 8));
_townSprites[3].draw(0, _vm->getRandomNumber(2, 4), Common::Point(8, 8));
}
break;
@ -1138,14 +1135,14 @@ void Town::drawTownAnim(bool flag) {
case TRAINING:
if (sound.isPlaying()) {
if (isDarkCc) {
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _townPos);
}
} else {
if (isDarkCc) {
_townSprites[0].draw(screen, ++intf._overallFrame % 8, Common::Point(8, 8));
_townSprites[5].draw(screen, _vm->getRandomNumber(5), Common::Point(61, 74));
_townSprites[0].draw(0, ++intf._overallFrame % 8, Common::Point(8, 8));
_townSprites[5].draw(0, _vm->getRandomNumber(5), Common::Point(61, 74));
} else {
_townSprites[1].draw(screen, _vm->getRandomNumber(8, 12), Common::Point(8, 8));
_townSprites[1].draw(0, _vm->getRandomNumber(8, 12), Common::Point(8, 8));
}
}
break;
@ -1221,7 +1218,6 @@ bool TownMessage::execute(int portrait, const Common::String &name, const Common
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
Town &town = *_vm->_town;
Windows &windows = *_vm->_windows;
Window &w = windows[11];
@ -1259,14 +1255,14 @@ bool TownMessage::execute(int portrait, const Common::String &name, const Common
}
town._drawCtr2 = wordCount * 2; // Set timeout
town._townSprites[1].draw(screen, 0, Common::Point(16, 16));
town._townSprites[0].draw(screen, town._drawFrameIndex, Common::Point(23, 22));
town._townSprites[1].draw(0, 0, Common::Point(16, 16));
town._townSprites[0].draw(0, town._drawFrameIndex, Common::Point(23, 22));
w.update();
if (!msgEnd && !confirm) {
res._globalSprites.draw(screen, 7, Common::Point(232, 74));
res._globalSprites.draw(screen, 0, Common::Point(235, 75));
res._globalSprites.draw(screen, 2, Common::Point(260, 75));
res._globalSprites.draw(0, 7, Common::Point(232, 74));
res._globalSprites.draw(0, 0, Common::Point(235, 75));
res._globalSprites.draw(0, 2, Common::Point(260, 75));
windows[34].update();
intf._face1State = map._headData[party._mazePosition.y][party._mazePosition.x]._left;

View File

@ -26,6 +26,17 @@
namespace Xeen {
Windows::Windows() {
// Load font data for the game
File f("fnt");
byte *data = new byte[f.size()];
f.read(data, f.size());
_fontData = data;
Common::fill(&_textColors[0], &_textColors[4], 0);
_bgColor = DEFAULT_BG_COLOR;
_fontReduced = false;
_fontJustify = JUSTIFY_NONE;
Window windows[40] = {
Window(Common::Rect(0, 0, 320, 200), 0, 0, 0, 0, 320, 200),
Window(Common::Rect(237, 9, 317, 74), 0, 0, 237, 12, 307, 68),
@ -71,6 +82,10 @@ Windows::Windows() {
_windows = Common::Array<Window>(windows, 40);
}
Windows::~Windows() {
delete[] _fontData;
}
void Windows::closeAll() {
for (int i = (int)_windowStack.size() - 1; i >= 0; --i)
_windowStack[i]->close();
@ -92,11 +107,11 @@ void Windows::removeFromStack(Window *win) {
/*------------------------------------------------------------------------*/
Window::Window() : XSurface(), _enabled(false),
Window::Window() : FontSurface(), _enabled(false),
_a(0), _border(0), _xLo(0), _xHi(0), _ycL(0), _ycH(0) {
}
Window::Window(const Window &src) : XSurface(), _enabled(src._enabled),
Window::Window(const Window &src) : FontSurface(), _enabled(src._enabled),
_a(src._a), _border(src._border), _xLo(src._xLo), _ycL(src._ycL),
_xHi(src._xHi), _ycH(src._ycH) {
@ -105,7 +120,7 @@ Window::Window(const Window &src) : XSurface(), _enabled(src._enabled),
}
Window::Window(const Common::Rect &bounds, int a, int border,
int xLo, int ycL, int xHi, int ycH): XSurface(),
int xLo, int ycL, int xHi, int ycH): FontSurface(),
_enabled(false), _a(a), _border(border),
_xLo(xLo), _ycL(ycL), _xHi(xHi), _ycH(ycH) {
setBounds(bounds);
@ -142,47 +157,46 @@ void Window::open2() {
frame();
fill();
screen._writePos.x = _bounds.right - 8;
screen.writeSymbol(19);
_writePos.x = _bounds.right - 8;
writeSymbol(19);
screen._writePos.x = _innerBounds.left;
screen._writePos.y = _innerBounds.top;
screen._fontJustify = JUSTIFY_NONE;
screen._fontReduced = false;
_writePos.x = _innerBounds.left;
_writePos.y = _innerBounds.top;
_fontJustify = JUSTIFY_NONE;
_fontReduced = false;
}
void Window::frame() {
Screen &screen = *g_vm->_screen;
int xCount = (_bounds.width() - 9) / FONT_WIDTH;
int yCount = (_bounds.height() - 9) / FONT_HEIGHT;
// Write the top line
screen._writePos = Common::Point(_bounds.left, _bounds.top);
screen.writeSymbol(0);
_writePos = Common::Point(_bounds.left, _bounds.top);
writeSymbol(0);
if (xCount > 0) {
int symbolId = 1;
for (int i = 0; i < xCount; ++i) {
screen.writeSymbol(symbolId);
writeSymbol(symbolId);
if (++symbolId == 5)
symbolId = 1;
}
}
screen._writePos.x = _bounds.right - FONT_WIDTH;
screen.writeSymbol(5);
_writePos.x = _bounds.right - FONT_WIDTH;
writeSymbol(5);
// Write the vertical edges
if (yCount > 0) {
int symbolId = 6;
for (int i = 0; i < yCount; ++i) {
screen._writePos.y += 8;
_writePos.y += 8;
screen._writePos.x = _bounds.left;
screen.writeSymbol(symbolId);
_writePos.x = _bounds.left;
writeSymbol(symbolId);
screen._writePos.x = _bounds.right - FONT_WIDTH;
screen.writeSymbol(symbolId + 4);
_writePos.x = _bounds.right - FONT_WIDTH;
writeSymbol(symbolId + 4);
if (++symbolId == 10)
symbolId = 6;
@ -190,20 +204,20 @@ void Window::frame() {
}
// Write the bottom line
screen._writePos = Common::Point(_bounds.left, _bounds.bottom - FONT_HEIGHT);
screen.writeSymbol(14);
_writePos = Common::Point(_bounds.left, _bounds.bottom - FONT_HEIGHT);
writeSymbol(14);
if (xCount > 0) {
int symbolId = 15;
for (int i = 0; i < xCount; ++i) {
screen.writeSymbol(symbolId);
writeSymbol(symbolId);
if (++symbolId == 19)
symbolId = 15;
}
}
screen._writePos.x = _bounds.right - FONT_WIDTH;
screen.writeSymbol(19);
_writePos.x = _bounds.right - FONT_WIDTH;
writeSymbol(19);
}
void Window::close() {
@ -238,11 +252,7 @@ void Window::addDirtyRect(const Common::Rect &r) {
}
void Window::fill() {
fillRect(_innerBounds, g_vm->_screen->_bgColor);
}
const char *Window::writeString(const Common::String &s) {
return g_vm->_screen->writeString(s, _innerBounds);
fillRect(_innerBounds, _bgColor);
}
void Window::drawList(DrawStruct *items, int count) {

View File

@ -25,8 +25,8 @@
#include "common/rect.h"
#include "common/str.h"
#include "xeen/font.h"
#include "xeen/sprites.h"
#include "xeen/xsurface.h"
namespace Xeen {
@ -48,7 +48,7 @@ struct DrawStruct {
DrawStruct(): _sprites(nullptr), _frame(0), _x(0), _y(0), _scale(0), _flags(0) {}
};
class Windows {
class Windows : public FontData {
friend class Window;
private:
Common::Array<Window> _windows;
@ -65,6 +65,7 @@ private:
void removeFromStack(Window *win);
public:
Windows();
~Windows();
/**
* Returns a specified window
@ -77,7 +78,7 @@ public:
void closeAll();
};
class Window: public XSurface {
class Window: public FontSurface {
private:
Common::Rect _bounds;
Common::Rect _innerBounds;
@ -95,6 +96,7 @@ public:
Window(const Window &src);
Window(const Common::Rect &bounds, int a, int border,
int xLo, int ycL, int xHi, int ycH);
virtual ~Window() {}
virtual void addDirtyRect(const Common::Rect &r);
@ -118,11 +120,32 @@ public:
*/
void fill();
const char *writeString(const Common::String &s);
void drawList(DrawStruct *items, int count);
int getString(Common::String &line, uint maxLen, int maxWidth);
/**
* Write a string to the window
* @param s String to display
* @param clipRect Window bounds to display string within
* @returns Any string remainder that couldn't be displayed
* @remarks Note that bounds is just used for wrapping purposes. Unless
* justification is set, the message will be written at _writePos
*/
const char *writeString(const Common::String &s, const Common::Rect &clipRect) {
return FontSurface::writeString(s, clipRect);
}
/**
* Write a string to the window
* @param s String to display
* @returns Any string remainder that couldn't be displayed
* @remarks Note that bounds is just used for wrapping purposes. Unless
* justification is set, the message will be written at _writePos
*/
const char *writeString(const Common::String &s) {
return FontSurface::writeString(s, _innerBounds);
}
};
} // End of namespace Xeen

View File

@ -46,7 +46,7 @@ bool CloudsCutscenes::showCloudsTitle() {
for (int idx = 0; idx < 80; ++idx) {
screen.restoreBackground();
logo[idx / 65].draw(screen, idx % 65);
logo[idx / 65].draw(0, idx % 65);
screen.update();
switch (idx) {
@ -110,21 +110,21 @@ bool CloudsCutscenes::showCloudsIntro() {
screen.loadPalette("intro.pal");
screen.loadBackground("blank.raw");
screen.saveBackground();
stars.draw(screen, 0);
stars.draw(screen, 1, Common::Point(160, 0));
stars.draw(0, 0);
stars.draw(0, 1, Common::Point(160, 0));
screen.loadPage(0);
intro1.draw(screen, 0);
intro1.draw(0, 0);
screen.loadPage(1);
bool fadeFlag = true;
for (int yCtr = SCREEN_HEIGHT, yScroll = 0, xeenCtr = -1; yCtr > 0; --yCtr, ++yScroll) {
screen.vertMerge(yScroll);
if (yCtr < 160) {
xeen.draw(screen, 0);
xeen.draw(0, 0);
} else if (yCtr < 100) {
xeen.draw(screen, 0);
xeen.draw(0, 0);
if (++xeenCtr < 14)
xeen1.draw(screen, xeenCtr);
xeen1.draw(0, xeenCtr);
}
screen.update();
@ -138,9 +138,9 @@ bool CloudsCutscenes::showCloudsIntro() {
// Remainder of vertical scrolling of background
screen.restoreBackground();
intro1.draw(screen, 0);
intro1.draw(0, 0);
screen.loadPage(0);
lake.draw(screen, 0);
lake.draw(0, 0);
screen.loadPage(1);
bool drawFlag = false;
@ -152,11 +152,11 @@ bool CloudsCutscenes::showCloudsIntro() {
lakeCtr = 0;
drawFlag = true;
} else {
lake3.draw(screen, lakeCtr, Common::Point(0, yCtr));
lake3.draw(0, lakeCtr, Common::Point(0, yCtr));
}
}
xeen.draw(screen, 0);
xeen.draw(0, 0);
screen.update();
WAIT(1);
}
@ -164,7 +164,7 @@ bool CloudsCutscenes::showCloudsIntro() {
screen.freePages();
// Flying creatures moving horizontally
lake.draw(screen, 0);
lake.draw(0, 0);
screen.saveBackground();
int frameNum = 0;
@ -172,7 +172,7 @@ bool CloudsCutscenes::showCloudsIntro() {
for (int idx = 0; idx < 100; ++idx) {
frameNum = (frameNum + 1) % 43;
screen.restoreBackground();
lake2.draw(screen, frameNum, Common::Point(0, 0), SPRFLAG_800);
lake2.draw(0, frameNum, Common::Point(0, 0), SPRFLAG_800);
WAIT(1);
}
@ -185,22 +185,22 @@ bool CloudsCutscenes::showCloudsIntro() {
events.updateGameCounter();
screen.restoreBackground();
lake2.draw(screen, frameNum, Common::Point(0, 0), SPRFLAG_800);
lake2.draw(0, frameNum, Common::Point(0, 0), SPRFLAG_800);
frameNum = (frameNum + 1) % 43;
wizTower.draw(screen, 0, Common::Point(XLIST1[idx], YLIST[idx]), 0, idx);
wizTower.draw(screen, 1, Common::Point(XLIST2[idx], YLIST[idx]), 0, idx);
wizTower.draw(0, 0, Common::Point(XLIST1[idx], YLIST[idx]), 0, idx);
wizTower.draw(0, 1, Common::Point(XLIST2[idx], YLIST[idx]), 0, idx);
screen.update();
WAIT(1);
}
// Cloaked figure walks horizontally
wizTower.draw(screen, 0);
wizTower.draw(screen, 1, Common::Point(160, 0));
wizTower.draw(0, 0);
wizTower.draw(0, 1, Common::Point(160, 0));
screen.saveBackground();
for (int idx = 0; idx < 39; ++idx) {
screen.restoreBackground();
wizTower2.draw(screen, idx);
wizTower2.draw(0, idx);
screen.update();
WAIT(2);
@ -215,9 +215,9 @@ bool CloudsCutscenes::showCloudsIntro() {
SpriteResource groupo("groupo.vga"), group("group.vga"),
crodo("crodo.vga"), box("box.vga");
groupo.draw(screen, 0);
groupo.draw(screen, 1, Common::Point(160, 0));
crodo.draw(screen, 0, Common::Point(0, -5));
groupo.draw(0, 0);
groupo.draw(0, 1, Common::Point(160, 0));
crodo.draw(0, 0, Common::Point(0, -5));
windows[0].writeString(Res.CLOUDS_INTRO1);
// Unroll a scroll
@ -237,13 +237,13 @@ bool CloudsCutscenes::showCloudsIntro() {
}
for (int frameCtr = 0, lookup = 0; sound.isPlaying() || _subtitleSize; ) {
groupo.draw(screen, 0);
groupo.draw(screen, 1, Common::Point(160, 0));
groupo.draw(0, 0);
groupo.draw(0, 1, Common::Point(160, 0));
switch (lineCtr) {
case 2:
ctr1 = (ctr1 + 1) % 5;
group.draw(screen, ctr1);
group.draw(0, ctr1);
ctr4 = (ctr4 + 1) % 9;
break;
@ -261,7 +261,7 @@ bool CloudsCutscenes::showCloudsIntro() {
case 9:
case 13:
ctr3 = (ctr3 + 1) % 3;
group.draw(screen, ctr3 + 43, Common::Point(178, 134));
group.draw(0, ctr3 + 43, Common::Point(178, 134));
ctr4 = (ctr4 + 1) % 9;
ctr2 = (ctr2 % 15) + 3;
break;
@ -273,10 +273,10 @@ bool CloudsCutscenes::showCloudsIntro() {
break;
}
group.draw(screen, ctr4 + 5, Common::Point(0, 99));
group.draw(screen, ctr2 + 24, Common::Point(202, 12));
group.draw(0, ctr4 + 5, Common::Point(0, 99));
group.draw(0, ctr2 + 24, Common::Point(202, 12));
if ((++totalCtr % 30) == 0)
group.draw(screen, 43, Common::Point(178, 134));
group.draw(0, 43, Common::Point(178, 134));
switch (lineCtr) {
case 2:
@ -285,7 +285,7 @@ bool CloudsCutscenes::showCloudsIntro() {
case 9:
case 12:
case 13: {
crodo.draw(screen, 0, Common::Point(0, -5));
crodo.draw(0, 0, Common::Point(0, -5));
windows[0].writeString(Res.CLOUDS_INTRO1);
ctr5 = (ctr5 + 1) % 19;
@ -295,7 +295,7 @@ bool CloudsCutscenes::showCloudsIntro() {
}
default:
crodo.draw(screen, frameCtr, Common::Point(0, -5));
crodo.draw(0, frameCtr, Common::Point(0, -5));
if (lookup > 30)
lookup = 30;
frameCtr = _INTRO_FRAMES_VALS[_INTRO_FRAMES_LOOKUP[lineCtr]][lookup];
@ -352,8 +352,8 @@ bool CloudsCutscenes::showCloudsEnding() {
screen.loadPalette("mm4e.pal");
loadScreen(Common::String::format("prec00%02u.frm", 1));
prec.draw(screen, 0);
prec.draw(screen, 1, Common::Point(160, 0));
prec.draw(0, 0);
prec.draw(0, 1, Common::Point(160, 0));
screen.update();
screen.fadeIn();
WAIT(15);
@ -366,8 +366,8 @@ bool CloudsCutscenes::showCloudsEnding() {
loadScreen(Common::String::format("prec00%02u.frm", idx));
// Render castle in front of it
prec.draw(screen, 0);
prec.draw(screen, 1, Common::Point(160, 0));
prec.draw(0, 0);
prec.draw(0, 1, Common::Point(160, 0));
screen.update();
switch (idx) {
@ -401,8 +401,8 @@ bool CloudsCutscenes::showCloudsEnding() {
for (int idx = 1; idx < 16; ++idx) {
loadScreen(Common::String::format("vort%02u.frm", idx));
cast[0].draw(screen, 0);
cast[idx - 1].draw(screen, 0, Common::Point(0, 100));
cast[0].draw(0, 0);
cast[idx - 1].draw(0, 0, Common::Point(0, 100));
}
// TODO

View File

@ -73,7 +73,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
for (int idx = 0; idx < 55 && !_vm->shouldQuit(); ++idx) {
// Render the next frame
screen.vertMerge(0);
nwc[nwcIndex].draw(screen, nwcFrame);
nwc[nwcIndex].draw(0, nwcFrame);
screen.draw();
switch (idx) {
@ -98,7 +98,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
// Loop for dragon using flyspray
for (int idx = 0; idx < 42 && !_vm->shouldQuit(); ++idx) {
screen.vertMerge(SCREEN_HEIGHT);
nwc[3].draw(screen, idx);
nwc[3].draw(0, idx);
screen.draw();
switch (idx) {
@ -188,9 +188,9 @@ bool DarkSideCutscenes::showDarkSideIntro() {
for (int yCtr = SCREEN_HEIGHT, frameNum = 0; yCtr > 0; ) {
screen.vertMerge(yp);
title.draw(screen, 0);
title.draw(0, 0);
if (frameNum)
title.draw(screen, frameNum);
title.draw(0, frameNum);
idx1 = (idx1 + 1) % 4;
if (!idx1)
@ -222,8 +222,8 @@ bool DarkSideCutscenes::showDarkSideIntro() {
// Zoom into the Pharoah's base closeup view
for (int idx = 14; idx >= 0; --idx) {
pyraTop.draw(screen, 0, Common::Point(XLIST1[idx], YLIST1[idx]));
pyraTop.draw(screen, 1, Common::Point(XLIST2[idx], YLIST1[idx]));
pyraTop.draw(0, 0, Common::Point(XLIST1[idx], YLIST1[idx]));
pyraTop.draw(0, 1, Common::Point(XLIST2[idx], YLIST1[idx]));
screen.draw();
if (idx == 2)
@ -242,7 +242,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
bool phar2 = false;
for (int idx = 0; idx < 19; ++idx) {
screen.restoreBackground();
pyramid.draw(screen, idx, Common::Point(132, 62));
pyramid.draw(0, idx, Common::Point(132, 62));
showSubtitles();
if (!sound.isPlaying() && !phar2)
@ -289,13 +289,13 @@ bool DarkSideCutscenes::showDarkSideIntro() {
screen.loadPage(0);
screen.loadBackground("1room.raw");
screen.horizMerge(SCREEN_WIDTH);
dragon.draw(screen, 0, Common::Point(XLIST3[0], YLIST3[0]), SPRFLAG_800);
dragon.draw(0, 0, Common::Point(XLIST3[0], YLIST3[0]), SPRFLAG_800);
int posNum = 0, phar2Index = 0, ctr = 0;
for (int idx = SCREEN_WIDTH, frameNum = 0; idx >= 0; --idx) {
events.updateGameCounter();
screen.horizMerge(idx);
dragon.draw(screen, FRAMES3[frameNum], Common::Point(XLIST3[posNum], YLIST3[posNum]), SPRFLAG_800);
dragon.draw(0, FRAMES3[frameNum], Common::Point(XLIST3[posNum], YLIST3[posNum]), SPRFLAG_800);
showSubtitles();
events.pollEventsAndWait();
if (events.isKeyMousePressed())
@ -348,7 +348,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
SpriteResource faceEnd("face.end");
screen.restoreBackground();
faceEnd.draw(screen, 0, Common::Point(29, 76), SPRFLAG_4000);
faceEnd.draw(0, 0, Common::Point(29, 76), SPRFLAG_4000);
screen.update();
screen.fadeIn();
@ -365,7 +365,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.stopSong();
screen.restoreBackground();
faceEnd.draw(screen, 0, Common::Point(29, idx), SPRFLAG_4000);
faceEnd.draw(0, 0, Common::Point(29, idx), SPRFLAG_4000);
screen.update();
WAIT(2);
@ -379,7 +379,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
// Show the entire throne room
screen.loadBackground("mainback.raw");
SpriteResource sc03a("sc03a.end"), sc03b("sc03b.end"), sc03c("sc03c.end");
sc03a.draw(screen, 0, Common::Point(250, 0));
sc03a.draw(0, 0, Common::Point(250, 0));
screen.saveBackground();
screen.update();
@ -389,7 +389,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("door.voc");
for (int idx = 0; idx < 6; ++idx) {
screen.restoreBackground();
sc03b.draw(screen, idx, Common::Point(72, 125));
sc03b.draw(0, idx, Common::Point(72, 125));
screen.update();
WAIT(4);
@ -398,7 +398,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
// Silhouette of playing entering
for (int idx = 0; idx < 19; ++idx) {
screen.restoreBackground();
sc03c.draw(screen, idx, Common::Point(72, 125));
sc03c.draw(0, idx, Common::Point(72, 125));
screen.update();
if (idx == 3 || idx == 11)
@ -426,10 +426,10 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int xp = 0; xp < 320; xp += 2) {
screen.horizMerge(xp);
disk.draw(screen, frameNum, Common::Point(xp / 2, yp));
disk.draw(0, frameNum, Common::Point(xp / 2, yp));
if (xp < 44)
disk.draw(screen, 11, Common::Point(-xp, 22), SPRFLAG_800);
disk.draw(screen, 10, Common::Point(0, 134));
disk.draw(0, 11, Common::Point(-xp, 22), SPRFLAG_800);
disk.draw(0, 10, Common::Point(0, 134));
if (!(xp % 22))
sound.playSound(whoosh);
@ -474,7 +474,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 34; ++idx) {
screen.restoreBackground();
diskOpen[idx / 8].draw(screen, idx % 8, Common::Point(28, 11));
diskOpen[idx / 8].draw(0, idx % 8, Common::Point(28, 11));
WAIT(3);
if (idx == 0 || idx == 2 || idx == 4 || idx == 6)
@ -495,7 +495,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
};
screen.loadBackground("mainback.raw");
screen.saveBackground();
sc06[0].draw(screen, 0);
sc06[0].draw(0, 0);
screen.update();
sound.playSound("alien2.voc");
@ -506,7 +506,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playFX(3);
screen.restoreBackground();
sc06[idx / 10].draw(screen, idx % 10);
sc06[idx / 10].draw(0, idx % 10);
screen.update();
WAIT(3);
@ -534,7 +534,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 45; ++idx) {
screen.restoreBackground();
sc07[idx / 6].draw(screen, idx % 6, Common::Point(61, 12));
sc07[idx / 6].draw(0, idx % 6, Common::Point(61, 12));
if (_subtitleSize == 0)
screen.update();
@ -566,13 +566,13 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("yes1.voc");
// Animate Corak speaking
sc08.draw(screen, sound.isPlaying() ? getSpeakingFrame(0, 2) : 0);
sc08.draw(0, sound.isPlaying() ? getSpeakingFrame(0, 2) : 0);
showSubtitles();
WAIT(3);
}
do {
sc08.draw(screen, 0);
sc08.draw(0, 0);
showSubtitles();
} while (_subtitleSize);
@ -592,7 +592,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("nowre1.voc");
screen.restoreBackground();
sc09.draw(screen, getSpeakingFrame(0, 8));
sc09.draw(0, getSpeakingFrame(0, 8));
showSubtitles();
WAIT(3);
}
@ -613,7 +613,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("nordo2.voc");
screen.restoreBackground();
sc10.draw(screen, getSpeakingFrame(0, 1));
sc10.draw(0, getSpeakingFrame(0, 1));
showSubtitles();
WAIT(3);
}
@ -635,7 +635,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 15; ++idx) {
screen.restoreBackground();
sc11.draw(screen, idx, Common::Point(100, 44));
sc11.draw(0, idx, Common::Point(100, 44));
if (idx == 0)
screen.fadeIn();
@ -652,9 +652,9 @@ bool DarkSideCutscenes::showDarkSideEnding() {
// Helmet raises, we see the face appear
for (int idx = 80; idx > 20; idx -= 2) {
screen.restoreBackground();
sc11.draw(screen, 15, Common::Point(60, 80));
sc11.draw(screen, 16, Common::Point(61, idx));
sc11.draw(screen, 17);
sc11.draw(0, 15, Common::Point(60, 80));
sc11.draw(0, 16, Common::Point(61, idx));
sc11.draw(0, 17);
screen.update();
if (idx == 80)
@ -681,7 +681,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
if (idx == 1)
sound.playSound("ready2.voc");
sc13.draw(screen, getSpeakingFrame(0, 3));
sc13.draw(0, getSpeakingFrame(0, 3));
showSubtitles();
if (idx == 0)
@ -690,7 +690,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
}
do {
sc13.draw(screen, 0);
sc13.draw(0, 0);
showSubtitles();
events.pollEventsAndWait();
} while (_subtitleSize);
@ -705,7 +705,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("blank.raw");
screen.saveBackground();
sc14.draw(screen, 0, Common::Point(37, 37));
sc14.draw(0, 0, Common::Point(37, 37));
screen.update();
screen.fadeIn();
@ -715,7 +715,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("fight2.voc");
screen.restoreBackground();
sc14.draw(screen, idx, Common::Point(37, 37));
sc14.draw(0, idx, Common::Point(37, 37));
showSubtitles();
WAIT(3);
}
@ -732,12 +732,12 @@ bool DarkSideCutscenes::showDarkSideEnding() {
SpriteResource sc15("sc15.end");
screen.loadBackground("mainback.raw");
screen.saveBackground();
sc15.draw(screen, 0, Common::Point(52, 84));
sc15.draw(0, 0, Common::Point(52, 84));
screen.update();
for (int idx = 0; idx < 21; ++idx) {
screen.restoreBackground();
sc15.draw(screen, idx, Common::Point(52, 84));
sc15.draw(0, idx, Common::Point(52, 84));
screen.update();
WAIT(3);
@ -761,13 +761,13 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("sc170001.raw");
screen.saveBackground();
screen.horizMerge(0);
sc16.draw(screen, 0, Common::Point(7, 29));
sc16.draw(0, 0, Common::Point(7, 29));
showSubtitles();
sound.playSound("fail1.voc");
for (int idx = 0; idx < 5; ++idx) {
screen.horizMerge(0);
sc16.draw(screen, idx, Common::Point(7, 29));
sc16.draw(0, idx, Common::Point(7, 29));
showSubtitles();
WAIT(4);
}
@ -776,11 +776,11 @@ bool DarkSideCutscenes::showDarkSideEnding() {
int val = 5;
for (int idx = 0; idx < 320; idx += 16) {
screen.horizMerge(idx);
sc16.draw(screen, (val >= 12) ? 11 : val++,
sc16.draw(0, (val >= 12) ? 11 : val++,
Common::Point(idx * -1 + 7, 29));
if (val > 10)
sc16.draw(screen, 12, Common::Point(273, 70));
sc16.draw(0, 12, Common::Point(273, 70));
showSubtitles();
WAIT(2);
@ -801,7 +801,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 16; ++idx) {
screen.restoreBackground();
sc17[idx / 8].draw(screen, idx % 8, Common::Point(44, 19));
sc17[idx / 8].draw(0, idx % 8, Common::Point(44, 19));
screen.update();
WAIT(3);
@ -825,7 +825,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 31; ++idx) {
screen.restoreBackground();
sc18[idx / 8].draw(screen, idx % 8, Common::Point(29, 12));
sc18[idx / 8].draw(0, idx % 8, Common::Point(29, 12));
screen.update();
WAIT(3);
@ -847,7 +847,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.songCommand(207);
screen.restoreBackground();
sc19.draw(screen, idx, Common::Point(33, 10));
sc19.draw(0, idx, Common::Point(33, 10));
WAIT(3);
}
@ -869,7 +869,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 9; ++idx) {
screen.restoreBackground();
sc20.draw(screen, idx, Common::Point(80, 18));
sc20.draw(0, idx, Common::Point(80, 18));
screen.update();
WAIT(3);
}
@ -882,7 +882,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
File alien2("alien2.voc");
screen.loadBackground("mainback.raw");
screen.saveBackground();
sc21.draw(screen, 0, Common::Point(133, 81));
sc21.draw(0, 0, Common::Point(133, 81));
screen.update();
for (int boltNum = 0; boltNum < 4; ++boltNum) {
@ -890,13 +890,13 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = (boltNum == 0) ? 0 : 3; idx < 13; ++idx) {
screen.restoreBackground();
sc21.draw(screen, idx, Common::Point(133, 81));
sc21.draw(0, idx, Common::Point(133, 81));
WAIT(2);
}
}
screen.restoreBackground();
sc21.draw(screen, 0, Common::Point(133, 81));
sc21.draw(0, 0, Common::Point(133, 81));
screen.update();
sc21.clear();
@ -916,13 +916,13 @@ bool DarkSideCutscenes::showDarkSideEnding() {
WAIT(1);
}
sc22.draw(screen, 0, Common::Point(156, 28));
sc22.draw(0, 0, Common::Point(156, 28));
screen.update();
sound.playSound("cast.voc");
for (int idx = 0; idx < 5; ++idx) {
screen.horizMerge(SCREEN_WIDTH);
sc22.draw(screen, idx, Common::Point(156, 28));
sc22.draw(0, idx, Common::Point(156, 28));
screen.update();
WAIT(3);
}
@ -933,10 +933,10 @@ bool DarkSideCutscenes::showDarkSideEnding() {
int ctr = 5;
for (int idx = SCREEN_WIDTH, xOffset = 0; idx >= 0; idx -= 16, xOffset += 16) {
screen.horizMerge(idx);
sc22.draw(screen, (ctr >= 8) ? 7 : ctr++,
sc22.draw(0, (ctr >= 8) ? 7 : ctr++,
Common::Point(xOffset + 156, 28), SPRFLAG_800);
if (ctr > 7)
sc22.draw(screen, 8, Common::Point(136, 64));
sc22.draw(0, 8, Common::Point(136, 64));
screen.update();
WAIT(2);
@ -956,7 +956,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 19; ++idx) {
screen.restoreBackground();
sc23[idx / 12].draw(screen, idx % 12, Common::Point(72, 4));
sc23[idx / 12].draw(0, idx % 12, Common::Point(72, 4));
screen.update();
WAIT(3);
@ -967,7 +967,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
}
screen.restoreBackground();
sc23[0].draw(screen, 0, Common::Point(72, 4));
sc23[0].draw(0, 0, Common::Point(72, 4));
screen.update();
screen.fadeOut();
@ -981,14 +981,14 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("mainback.raw");
screen.saveBackground();
sc24[0].draw(screen, 0, Common::Point(148, 0));
sc24[0].draw(0, 0, Common::Point(148, 0));
screen.update();
screen.fadeIn(4);
sound.playSound("cast.voc");
for (int idx = 0; idx < 30; ++idx) {
screen.restoreBackground();
sc24[idx / 15].draw(screen, idx % 15, Common::Point(148, 0));
sc24[idx / 15].draw(0, idx % 15, Common::Point(148, 0));
screen.update();
WAIT(3);
@ -1012,7 +1012,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("sc250001.raw");
screen.saveBackground();
sc25.draw(screen, 0, Common::Point(27, 30));
sc25.draw(0, 0, Common::Point(27, 30));
screen.update();
for (int struggleNum = 0; struggleNum < 2; ++struggleNum) {
@ -1020,7 +1020,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
if (struggleNum == 0 && idx == 2)
sound.playSound("admit2.voc");
sc25.draw(screen, idx, Common::Point(27, 30));
sc25.draw(0, idx, Common::Point(27, 30));
showSubtitles();
WAIT(3);
}
@ -1042,7 +1042,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; sound.isPlaying() || _subtitleSize; ) {
screen.restoreBackground();
sc26[idx / 8].draw(screen, idx % 8, Common::Point(58, 25));
sc26[idx / 8].draw(0, idx % 8, Common::Point(58, 25));
WAIT(2);
idx = (idx == 31) ? 22 : idx + 1;
@ -1070,7 +1070,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sound.playSound("what3.voc");
screen.restoreBackground();
sc27.draw(screen, idx, Common::Point(65, 22));
sc27.draw(0, idx, Common::Point(65, 22));
showSubtitles();
WAIT(3);
}
@ -1093,13 +1093,13 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("mainback.raw");
screen.saveBackground();
sc28[0].draw(screen, 0, Common::Point(74, 0));
sc28[0].draw(0, 0, Common::Point(74, 0));
screen.update();
screen.fadeIn();
for (int idx = 0; idx < 44; ++idx) {
screen.restoreBackground();
sc28[idx / 4].draw(screen, idx % 4, Common::Point(74, 0));
sc28[idx / 4].draw(0, idx % 4, Common::Point(74, 0));
screen.update();
WAIT(3);
@ -1131,7 +1131,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
if (idx == 40)
sound.songCommand(207);
sc29[idx / 10].draw(screen, idx % 10, Common::Point(92, 10));
sc29[idx / 10].draw(0, idx % 10, Common::Point(92, 10));
screen.update();
WAIT(3);
@ -1143,7 +1143,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int loopNum = 0; loopNum < 4; ++loopNum) {
for (int idx = 49; idx < 54; ++idx) {
screen.restoreBackground();
sc29[idx / 10].draw(screen, idx % 10, Common::Point(92, 10));
sc29[idx / 10].draw(0, idx % 10, Common::Point(92, 10));
screen.update();
WAIT(3);
}
@ -1191,10 +1191,10 @@ void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, c
screen.loadBackground("3room.raw");
screen.saveBackground();
screen.loadPalette("dark.pal");
claw.draw(screen, 5, Common::Point(CUTSCENES_XLIST[0], CUTSCENES_YLIST[0]), SPRFLAG_800);
claw.draw(screen, 6, Common::Point(149, 184));
dragon1.draw(screen, FRAMES[0], Common::Point(139, YLIST[0]), SPRFLAG_800);
claw.draw(screen, 0, Common::Point(XLIST2[0], YLIST2[0]), SPRFLAG_800);
claw.draw(0, 5, Common::Point(CUTSCENES_XLIST[0], CUTSCENES_YLIST[0]), SPRFLAG_800);
claw.draw(0, 6, Common::Point(149, 184));
dragon1.draw(0, FRAMES[0], Common::Point(139, YLIST[0]), SPRFLAG_800);
claw.draw(0, 0, Common::Point(XLIST2[0], YLIST2[0]), SPRFLAG_800);
screen.update();
screen.fadeIn();
events.clearEvents();
@ -1206,10 +1206,10 @@ void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, c
do {
// Draw the dragon pharoah
screen.restoreBackground();
claw.draw(screen, 5, Common::Point(CUTSCENES_XLIST[idx], CUTSCENES_YLIST[idx]), SPRFLAG_800);
claw.draw(screen, 6, Common::Point(145, 185));
dragon1.draw(screen, FRAMES[idx], Common::Point(139, YLIST[idx]), SPRFLAG_800);
claw.draw(screen, idx % 5, Common::Point(XLIST2[idx], YLIST2[idx]), SPRFLAG_800);
claw.draw(0, 5, Common::Point(CUTSCENES_XLIST[idx], CUTSCENES_YLIST[idx]), SPRFLAG_800);
claw.draw(0, 6, Common::Point(145, 185));
dragon1.draw(0, FRAMES[idx], Common::Point(139, YLIST[idx]), SPRFLAG_800);
claw.draw(0, idx % 5, Common::Point(XLIST2[idx], YLIST2[idx]), SPRFLAG_800);
// Form the text string to display the text
Common::String str1 = Common::String::format(Res.PHAROAH_ENDING_TEXT1,

View File

@ -52,7 +52,6 @@ void WorldOfXeenMenu::show(XeenEngine *vm) {
void WorldOfXeenMenu::execute() {
SpriteResource special("special.icn");
Screen &screen = *_vm->_screen;
Windows &windows = *_vm->_windows;
EventsManager &events = *_vm->_events;
@ -120,7 +119,7 @@ void WorldOfXeenMenu::showTitles1(SpriteResource &sprites) {
frameNum = (frameNum + 1) % (_vm->getGameID() == GType_WorldOfXeen ? 5 : 10);
screen.restoreBackground();
sprites.draw(screen, frameNum);
sprites.draw(0, frameNum);
events.wait(4);
}
@ -141,14 +140,14 @@ void WorldOfXeenMenu::showTitles2() {
SpriteResource("title2h.int"), SpriteResource("title2i.int"),
};
kludgeSprites.draw(screen, 0);
kludgeSprites.draw(0, 0);
screen.saveBackground();
sound.playSound("elect.voc");
for (int i = 0; i < 30 && !_vm->shouldQuit(); ++i) {
events.updateGameCounter();
screen.restoreBackground();
title2Sprites[i / 4].draw(screen, i % 4);
title2Sprites[i / 4].draw(0, i % 4);
windows[0].update();
if (i == 19)