MADS: General cleanup and minor renamings

This commit is contained in:
Paul Gilbert 2014-04-15 19:28:29 -04:00
parent 3db3aced02
commit 7b907be937
15 changed files with 77 additions and 83 deletions

View File

@ -585,8 +585,7 @@ void MADSAction::leftClick() {
if (_prepType) {
_articleNumber = _prepType;
_interAwaiting = AWAITING_THAT;
}
else {
} else {
_selectedAction = -1;
}

View File

@ -211,7 +211,7 @@ public:
virtual ~Dialogs() {}
virtual void showDialog() = 0;
virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0;
virtual void showItem(int objectId, int messageId, int arg = 0) = 0;
virtual bool show(int msgId) = 0;
};

View File

@ -242,6 +242,33 @@ bool DialogsNebular::show(int msgId) {
return result;
}
void DialogsNebular::showItem(int objectId, int messageId, int arg) {
show(messageId);
#if 0
Scene &scene = _vm->_game->_scene;
byte highPalette[8 * 3];
Common::copy(&_vm->_palette->_mainPalette[0x2E8], &_vm->_palette->_mainPalette[PALETTE_SIZE],
&highPalette[0]);
byte *depthP = scene._depthSurface.getData();
byte greyScale[3];
greyScale[0] = greyScale[1] = greyScale[2] = 0xFFFF;
Common::String setName = Common::String::format("*OBJ%.3d.SS", objectId);
// Turn off cycling if active
bool cyclingActive = scene._cyclingActive;
scene._cyclingActive = false;
// Make a copy of the current screen surface
byte *savedSurface = new byte[MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT];
Common::copy(_vm->_screen.getData(), _vm->_screen.getData() +
MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT, savedSurface);
delete[] savedSurface;
#endif
}
Common::String DialogsNebular::getVocab(int vocabId) {
assert(vocabId > 0);

View File

@ -50,10 +50,9 @@ public:
virtual void showDialog() {
warning("TODO: showDialog");
}
virtual void showPicture(int objId, int msgId, int arg3) {
show(msgId);
warning("TODO: showPicture");
}
virtual void showItem(int objectId, int msgId, int arg);
virtual bool show(int id);
};

View File

@ -362,7 +362,7 @@ void GameNebular::doObjectAction() {
_objects.addToInventory(OBJ_BLOWGUN);
_objects.setRoom(OBJ_PLANT_STALK, PLAYER_INVENTORY);
_globals[kBlowgunStatus] = 0;
dialogs.showPicture(OBJ_BLOWGUN, 809);
dialogs.showItem(OBJ_BLOWGUN, 809);
} else if (action.isAction(VERB_PUT, 276, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS)
&& _objects.isInInventory(OBJ_BLOWGUN)) {
dialogs.show(433);
@ -374,7 +374,7 @@ void GameNebular::doObjectAction() {
action.isAction(936) && _objects.isInInventory(OBJ_NOTE)) {
_objects.setRoom(OBJ_NOTE, PLAYER_INVENTORY);
_objects.addToInventory(OBJ_COMBINATION);
dialogs.showPicture(OBJ_COMBINATION, 851);
dialogs.showItem(OBJ_COMBINATION, 851);
} else if ((action.isAction(VERB_LOOK) || action.isAction(NOUN_READ)) &&
((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) > 0 ||
(action._activeAction._indirectObjectId > 0 &&
@ -390,7 +390,7 @@ void GameNebular::doObjectAction() {
dialogs._indexList[7] = _globals[kTeleporterCode + 5];
dialogs._indexList[8] = _globals[kTeleporterCode + 2];
dialogs.showPicture(id, 402);
dialogs.showItem(id, 402);
} else {
int messageId = 800 + id;
if (id == OBJ_CHARGE_CASES) {
@ -410,14 +410,14 @@ void GameNebular::doObjectAction() {
if (id == OBJ_PHONE_HANDSET && _globals[kHandsetCellStatus])
messageId = 861;
dialogs.showPicture(id, messageId);
dialogs.showItem(id, messageId);
}
} else if (action.isAction(VERB_PUT, NOUN_BURGER, NOUN_DEAD_FISH)) {
if (_objects.isInInventory(OBJ_BURGER) || _objects.isInInventory(OBJ_DEAD_FISH)) {
_objects.removeFromInventory(OBJ_DEAD_FISH, PLAYER_INVENTORY);
_objects.removeFromInventory(OBJ_BURGER, PLAYER_INVENTORY);
_objects.addToInventory(OBJ_STUFFED_FISH);
dialogs.showPicture(OBJ_STUFFED_FISH, 803);
dialogs.showItem(OBJ_STUFFED_FISH, 803);
}
} else if (action.isAction(VERB_PUT, 26, 357) && _objects.isInInventory(OBJ_AUDIO_TAPE) &&
_objects.isInInventory(OBJ_TAPE_PLAYER)) {
@ -449,7 +449,7 @@ void GameNebular::doObjectAction() {
_objects.setRoom(OBJ_TIMER_MODULE, PLAYER_INVENTORY);
_objects.addToInventory(OBJ_TIMEBOMB);
dialogs.showPicture(OBJ_TIMEBOMB, 404);
dialogs.showItem(OBJ_TIMEBOMB, 404);
} else if (action.isAction(140, 271)) {
dialogs.show(410);
} else if (action.isAction(119, 46)) {
@ -458,7 +458,7 @@ void GameNebular::doObjectAction() {
} else if (action.isAction(108, 136)) {
if (_objects[OBJ_FISHING_LINE]._roomNumber == 3) {
_objects.addToInventory(OBJ_FISHING_LINE);
dialogs.showPicture(OBJ_FISHING_LINE, 409);
dialogs.showItem(OBJ_FISHING_LINE, 409);
} else {
dialogs.show(428);
}
@ -467,19 +467,19 @@ void GameNebular::doObjectAction() {
case 1:
case 2:
_objects.addToInventory(OBJ_DURAFAIL_CELLS);
dialogs.showPicture(OBJ_DURAFAIL_CELLS, 412);
dialogs.showItem(OBJ_DURAFAIL_CELLS, 412);
break;
case 3:
_objects.addToInventory(OBJ_PHONE_CELLS);
dialogs.showPicture(OBJ_DURAFAIL_CELLS, 413);
dialogs.showItem(OBJ_DURAFAIL_CELLS, 413);
break;
case 5:
_objects.addToInventory(OBJ_DURAFAIL_CELLS);
dialogs.showPicture(OBJ_DURAFAIL_CELLS, 411);
dialogs.showItem(OBJ_DURAFAIL_CELLS, 411);
break;
case 6:
_objects.addToInventory(OBJ_DURAFAIL_CELLS);
dialogs.showPicture(OBJ_DURAFAIL_CELLS, 429);
dialogs.showItem(OBJ_DURAFAIL_CELLS, 429);
break;
default:
dialogs.show(478);
@ -489,24 +489,24 @@ void GameNebular::doObjectAction() {
switch (_globals[kHandsetCellStatus]) {
case 1:
_objects.addToInventory(OBJ_DURAFAIL_CELLS);
dialogs.showPicture(OBJ_DURAFAIL_CELLS,
dialogs.showItem(OBJ_DURAFAIL_CELLS,
_difficulty != 1 || _globals[kDurafailRecharged] ? 415 : 414);
break;
case 2:
_objects.addToInventory(OBJ_DURAFAIL_CELLS);
if (_difficulty == 1) {
dialogs.showPicture(OBJ_DURAFAIL_CELLS, 416);
dialogs.showItem(OBJ_DURAFAIL_CELLS, 416);
} else {
_globals[kHandsetCellStatus] = 0;
}
break;
case 3:
_objects.addToInventory(OBJ_PHONE_CELLS);
dialogs.showPicture(OBJ_PHONE_CELLS, 418);
dialogs.showItem(OBJ_PHONE_CELLS, 418);
break;
case 4:
_objects.addToInventory(OBJ_PHONE_CELLS);
dialogs.showPicture(OBJ_PHONE_CELLS, 417);
dialogs.showItem(OBJ_PHONE_CELLS, 417);
break;
default:
dialogs.show(478);
@ -525,8 +525,7 @@ void GameNebular::doObjectAction() {
_globals[kHandsetCellStatus] = 3;
_objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY);
dialogs.show(421);
}
else {
} else {
dialogs.show(422);
}
} else if (action.isAction(VERB_PUT, 115, 262)) {
@ -557,7 +556,7 @@ void GameNebular::doObjectAction() {
}
_objects.addToInventory(OBJ_CHICKEN_BOMB);
dialogs.showPicture(OBJ_CHICKEN_BOMB, 430);
dialogs.showItem(OBJ_CHICKEN_BOMB, 430);
} else {
return;
}

View File

@ -396,12 +396,12 @@ void Scene101::actions() {
}
if ((_action.isAction(VERB_TAKE, 0x137) || _action.isAction(VERB_PULL, 0x137)) && _game._objects.isInRoom(0x18)) {
_game._objects.addToInventory(0x18);
_game._objects.addToInventory(OBJ_SHIELD_MODULATOR);
_scene->_sequences.remove(_globals._sequenceIndexes[13]);
_globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2);
_scene->_hotspots.activate(0x137, false);
_vm->_dialogs->showPicture(0x18, 0x2788);
_vm->_dialogs->showItem(OBJ_SHIELD_MODULATOR, 10120);
_vm->_sound->command(22);
_action._inProgress = false;
return;
@ -1133,7 +1133,7 @@ void Scene102::actions() {
_game._player._visible = true;
_game._player._stepEnabled = true;
_vm->_sound->command(22);
_vm->_dialogs->showPicture(OBJ_BINOCULARS, 0x27D9);
_vm->_dialogs->showItem(OBJ_BINOCULARS, 10201);
break;
}
_action._inProgress = false;
@ -1142,7 +1142,7 @@ void Scene102::actions() {
if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) {
if (_game._trigger == 0) {
_vm->_dialogs->showPicture(OBJ_BURGER, 0x27FB);
_vm->_dialogs->showItem(OBJ_BURGER, 10235);
_scene->_sequences.remove(_globals._sequenceIndexes[10]);
_game._objects.addToInventory(OBJ_BURGER);
_scene->_hotspots.activate(0x35, false);
@ -1358,7 +1358,7 @@ void Scene103::actions() {
_scene->_hotspots.activate(371, false);
_vm->_game->_player._visible = true;
_vm->_game->_player._stepEnabled = true;
_vm->_dialogs->showPicture(OBJ_REBREATHER, 805);
_vm->_dialogs->showItem(OBJ_REBREATHER, 805);
break;
default:
@ -1386,7 +1386,7 @@ void Scene103::actions() {
_scene->_hotspots.activate(289, false);
_vm->_game->_player._visible = true;
_vm->_game->_player._stepEnabled = true;
_vm->_dialogs->showPicture(OBJ_REBREATHER, 804);
_vm->_dialogs->showItem(OBJ_REBREATHER, 804);
break;
default:
@ -1822,7 +1822,7 @@ void Scene105::actions() {
_scene->_sequences.remove(_globals._sequenceIndexes[4]);
_game._objects.addToInventory(OBJ_DEAD_FISH);
_globals[kFishIn105] = false;
_vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322, 0);
_vm->_dialogs->showItem(OBJ_DEAD_FISH, 802, 0);
}
} else if (_action.isAction(VERB_LOOK, 0x195))
_vm->_dialogs->show(0x2905);
@ -2141,7 +2141,7 @@ void Scene107::actions() {
_scene->_sequences.remove(_globals._sequenceIndexes[4]);
_game._objects.addToInventory(OBJ_DEAD_FISH);
_globals[kFishIn107] = false;
_vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322);
_vm->_dialogs->showItem(OBJ_DEAD_FISH, 802);
}
} else if (_action.isAction(0x15D, 0xEE))
_scene->_nextSceneId = 105;
@ -2227,7 +2227,7 @@ void Scene108::actions() {
_scene->_sequences.remove(_globals._sequenceIndexes[4]);
_game._objects.addToInventory(OBJ_DEAD_FISH);
_globals[kFishIn108] = false;
_vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x2A38);
_vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808);
}
} else if (_action.isAction(0x15D, 0xF4))
_scene->_nextSceneId = 107;

View File

@ -781,10 +781,10 @@ void Scene202::actions() {
if (_game._objects.isInInventory(OBJ_BONE)) {
_game._objects.removeFromInventory(OBJ_BONE, 1);
_game._objects.addToInventory(OBJ_BONES);
_vm->_dialogs->showPicture(OBJ_BONES, 0x4EFA, 0);
_vm->_dialogs->showItem(OBJ_BONES, 0x4EFA, 0);
} else {
_game._objects.addToInventory(OBJ_BONE);
_vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0);
_vm->_dialogs->showItem(OBJ_BONE, 0x4EFA, 0);
}
_scene->changeVariant(_globals[kBone202Status]);
_game._player._stepEnabled = true;
@ -1352,9 +1352,9 @@ void Scene207::preActions() {
void Scene207::actions() {
if (_action._savedFields._lookFlag) {
_vm->_dialogs->show(0x50E7);
} else if (_action.isAction(0x18B, 0x70))
} else if (_action.isAction(0x18B, 0x70)) {
_scene->_nextSceneId = 214;
else {
} else {
if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) &&
(_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) {
if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) &&
@ -1622,7 +1622,7 @@ void Scene208::actions() {
} else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) {
subAction(1);
if (_game._player._stepEnabled)
_vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0);
_vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0);
} else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) {
subAction(2);
} else if (_action.isAction(VERB_PUT, 0x17A, 0x1A9)) {
@ -1820,9 +1820,9 @@ void Scene209::handleLookStay() {
_scene->_sequences.remove(_globals._sequenceIndexes[3]);
_globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6);
if (!_dodgeFl)
if (!_dodgeFl) {
_scene->_sequences.addTimer(90, 149);
else {
} else {
_scene->_sequences.addTimer(1, 149);
_shouldDodgeFl = true;
}
@ -3137,7 +3137,7 @@ void Scene209::actions() {
_game._player._visible = true;
_game._player._stepEnabled = true;
_scene->_sequences.addTimer(4, 3);
_vm->_dialogs->showPicture(OBJ_PLANT_STALK, 0x328);
_vm->_dialogs->showItem(OBJ_PLANT_STALK, 0x328);
break;
case 3:
@ -3173,7 +3173,7 @@ void Scene209::actions() {
break;
case 3:
_vm->_dialogs->showPicture (OBJ_BINOCULARS, 0x51AF);
_vm->_dialogs->showItem (OBJ_BINOCULARS, 0x51AF);
_scene->_sprites.remove(_globals._spriteIndexes[10]);
break;
}
@ -4763,7 +4763,7 @@ void Scene214::actions() {
case 3:
_game._player._stepEnabled = true;
_vm->_dialogs->showPicture(OBJ_POISON_DARTS, 0x53A5);
_vm->_dialogs->showItem(OBJ_POISON_DARTS, 0x53A5);
break;
}
} else if (_action.isAction(VERB_TAKE, 0x29) && (_game._trigger || _game._objects.isInRoom(OBJ_BLOWGUN))) {
@ -4792,7 +4792,7 @@ void Scene214::actions() {
case 3:
_game._player._stepEnabled = true;
_vm->_dialogs->showPicture(OBJ_BLOWGUN, 0x329);
_vm->_dialogs->showItem(OBJ_BLOWGUN, 0x329);
break;
}
} else if (_action.isAction(VERB_LOOK, 0x197))

View File

@ -230,8 +230,7 @@ void Player::updateFrame() {
if (!_visible) {
_upcomingTrigger = 0;
}
else {
} else {
_upcomingTrigger = _stopWalkerTrigger[_stopWalkerIndex];
if (_stopWalkerIndex > 0)
@ -597,11 +596,11 @@ void Player::startMovement() {
// Figure out direction that will need to be moved in
int majorDir;
if (xDiff == 0)
if (xDiff == 0) {
majorDir = 1;
else if (yDiff == 0)
} else if (yDiff == 0) {
majorDir = 3;
else {
} else {
if ((scaleAmount < xDiff) && ((xAmt33 / scaleAmount) >= 141))
majorDir = 3;
else if (yDiff <= xDiff)

View File

@ -195,8 +195,7 @@ void Rails::setNodePosition(int nodeIndex, const Common::Point &pt) {
int entry;
if (idx == (uint)nodeIndex) {
entry = 0x3FFF;
}
else {
} else {
// Process the node
flags = getRouteFlags(pt, _nodes[idx]._walkPos);

View File

@ -426,11 +426,6 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) {
// Draw text elements onto the view
_textDisplay.draw(&_vm->_screen);
//
_vm->_screen.setPointer(&_vm->_screen);
_userInterface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y,
_vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h));
if (transitionType) {
// Fading in the screen
_vm->_screen.transition(transitionType, surfaceFlag);

View File

@ -85,8 +85,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) {
_bounds.top = 0;
width = MADS_SCREEN_WIDTH;
height = MADS_SCENE_HEIGHT;
}
else {
} else {
// Standard sprite slots
_bounds.left = spriteSlot->_position.x - scene._posAdjust.x;
_bounds.top = spriteSlot->_position.y - scene._posAdjust.y;
@ -548,7 +547,6 @@ void ScreenObjects::setActive(ScrCategory category, int descId, bool active) {
/*------------------------------------------------------------------------*/
ScreenSurface::ScreenSurface() {
_dataP = nullptr;
}
void ScreenSurface::init() {
@ -610,10 +608,6 @@ void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag
}
}
void ScreenSurface::setPointer(MSurface *s) {
_dataP = s->getData();
}
void ScreenSurface::fadeOut() {
warning("TODO: Proper fade out");
}

View File

@ -205,7 +205,6 @@ private:
void fadeIn();
public:
Common::Point _offset;
byte *_dataP;
public:
/**
* Constructor
@ -217,8 +216,6 @@ public:
*/
void init();
void setPointer(MSurface *s);
/**
* Copys an area of the screen surface to a given destination position on
* the ScummVM physical screen buffer

View File

@ -400,9 +400,9 @@ void SpriteSets::remove(int idx) {
if (idx >= 0) {
delete (*this)[idx];
if (idx < ((int)size() - 1))
if (idx < ((int)size() - 1)) {
(*this)[idx] = nullptr;
else {
} else {
do {
remove_at(size() - 1);
} while (size() > 0 && (*this)[size() - 1] == nullptr);

View File

@ -163,10 +163,6 @@ void UISlots::draw(bool updateFlag, bool delFlag) {
// Mark areas of the screen surface for updating
if (updateFlag) {
_vm->_screen.setPointer(&userInterface);
userInterface.setBounds(Common::Rect(0, scene._interfaceY,
MADS_SCREEN_WIDTH - 1, userInterface.h + scene._interfaceY - 1));
for (uint idx = 0; idx < size(); ++idx) {
DirtyArea &dirtyArea = userInterface._dirtyAreas[idx];
@ -502,10 +498,6 @@ void UserInterface::writeVocab(ScrCategory category, int id) {
}
}
void UserInterface::setBounds(const Common::Rect &r) {
_drawBounds = r;
}
void UserInterface::loadElements() {
Scene &scene = _vm->_game->_scene;
Common::Rect bounds;
@ -881,9 +873,6 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx
}
void UserInterface::updateRect(const Common::Rect &bounds) {
_vm->_screen.setPointer(&_surface);
setBounds(Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH - 1, MADS_SCREEN_HEIGHT));
Common::Rect r = bounds;
r.translate(0, MADS_SCENE_HEIGHT);
_vm->_screen.copyRectToScreen(r);

View File

@ -164,7 +164,6 @@ public:
UISlots _uiSlots;
DirtyAreas _dirtyAreas;
ScrCategory _category;
Common::Rect _drawBounds;
Common::Rect *_rectP;
int _inventoryTopIndex;
int _selectedInvIndex;
@ -199,8 +198,6 @@ public:
void drawTextElements();
void setBounds(const Common::Rect &r);
/**
* Loads the animation sprite data for a given inventory object
*/