MADS: Implement scene 313, come renaming in RGB4 structure, used by AnimPalData

This commit is contained in:
Strangerke 2014-04-19 23:26:27 +02:00
parent 559efad195
commit 34d0bc72b5
6 changed files with 101 additions and 7 deletions

View File

@ -121,6 +121,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
return new Scene310(vm);
case 311:
return new Scene311(vm);
case 313:
return new Scene313(vm);
// Scene group #8
case 804:

View File

@ -1754,5 +1754,80 @@ void Scene311::actions() {
/*------------------------------------------------------------------------*/
void Scene313::setup() {
setPlayerSpritesPrefix();
_game._player._spritesPrefix = "RM313A";
setAAName();
}
void Scene313::enter() {
_scene->_userInterface.setup(kInputLimitedSentences);
gender_timer = 0;
gender_threshold = _vm->getRandomNumber(3, 9) * 600;
if ((_scene->_priorSceneId == 366) || (_scene->_priorSceneId == 316)) {
_game._player._playerPos = Common::Point(30, 80);
_game._player._facing = FACING_NORTH;
} else if ((_scene->_priorSceneId == 311) || (_scene->_priorSceneId == 361) || (_scene->_priorSceneId == 391)) {
_game._player._playerPos = Common::Point(90, 70);
_game._player._facing = FACING_EAST;
} else if (_scene->_priorSceneId == 390) {
_game._player._playerPos = Common::Point(126, 70);
_game._player._facing = FACING_EAST;
} else if ((_scene->_priorSceneId == 389) || (_scene->_priorSceneId == 399)) {
_game._player._playerPos = Common::Point(163, 70);
_game._player._facing = FACING_WEST;
} else if (_scene->_priorSceneId == 388) {
_game._player._playerPos = Common::Point(199, 70);
_game._player._facing = FACING_WEST;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(234, 70);
_game._player._facing = FACING_WEST;
}
if (_globals[kAfterHavoc]) {
for (uint16 i = 0; i < _scene->_animPalData.size(); i++) {
int palIdx = _scene->_animPalData[i]._firstColorIndex;
int size = _scene->_animPalData[i]._colorCount * 3;
memset(&_vm->_palette->_savedPalette[palIdx], 0, size);
memset(&_vm->_palette->_mainPalette[palIdx], 0, size);
}
}
sceneEntrySound();
}
void Scene313::actions() {
if (_action.isAction(0x2FB, 0x2FC))
_scene->_nextSceneId = 387;
else if (_action.isAction(0x2FB, 0x2FD))
_scene->_nextSceneId = 388;
else if (_action.isAction(0x2FB, 0x2FE)) {
if (_globals[kAfterHavoc])
_scene->_nextSceneId = 399;
else
_scene->_nextSceneId = 389;
} else if (_action.isAction(0x2FB, 0x2FF))
_scene->_nextSceneId = 390;
else if (_action.isAction(0x2FB, 0x2EF)) {
if (_globals[kSexOfRex] == REX_FEMALE) {
_globals[kSexOfRex] = REX_MALE;
_vm->_dialogs->show(0x7A45);
}
_scene->_nextSceneId = 391;
} else if (_action.isAction(0x2FB, 0x300)) {
if (_globals[kSexOfRex] == REX_FEMALE) {
_globals[kSexOfRex] = REX_MALE;
_vm->_dialogs->show(0x7A45);
}
_scene->_nextSceneId = 366;
} else if (!_action.isAction(0x301, 0x2D4))
return;
_action._inProgress = false;
}
/*------------------------------------------------------------------------*/
} // End of namespace Nebular
} // End of namespace MADS

View File

@ -217,6 +217,23 @@ public:
virtual void actions();
virtual void postActions() {};
};
class Scene313: public Scene3xx {
private:
uint32 gender_clock;
uint32 gender_timer;
uint32 gender_threshold;
public:
Scene313(MADSEngine *vm) : Scene3xx(vm) {}
virtual void setup();
virtual void enter();
virtual void step() {};
virtual void preActions() {};
virtual void actions();
virtual void postActions() {};
};
} // End of namespace Nebular
} // End of namespace MADS

View File

@ -46,12 +46,12 @@ enum {
};
struct RGB4 {
byte r;
byte _colorCount;
byte g;
byte b;
byte _firstColorIndex;
byte u;
RGB4() { r = g = b = u = 0; }
RGB4() { _colorCount = g = _firstColorIndex = u = 0; }
};
struct RGB6 {

View File

@ -254,7 +254,7 @@ void Scene::initPaletteAnimation(Common::Array<RGB4> &animData, bool animFlag) {
// Calculate total
_animCount = 0;
for (uint i = 0; i < _animPalData.size(); ++i)
_animCount += _animPalData[i].r;
_animCount += _animPalData[i]._colorCount;
_animVal1 = (_animCount > 16) ? 3 : 0;
_cyclingActive = animFlag;

View File

@ -67,9 +67,9 @@ void ARTHeader::load(Common::SeekableReadStream *f) {
palCount = f->readUint16LE();
for (int i = 0; i < palCount; ++i) {
RGB4 rgb;
rgb.r = f->readByte();
rgb._colorCount = f->readByte();
rgb.g = f->readByte();
rgb.b = f->readByte();
rgb._firstColorIndex = f->readByte();
rgb.u = f->readByte();
_palAnimData.push_back(rgb);
@ -219,7 +219,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
for (uint i = 0; i < _palAnimData.size(); ++i) {
byte g = _palAnimData[i].g;
_palAnimData[i].b = artHeader._palette[g]._palIndex;
_palAnimData[i]._firstColorIndex = artHeader._palette[g]._palIndex;
}
}
}