mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
Implemented GPL commands JustTalk and JustStay.
The basic commands are done. It remains to implement handling music (after we play it at all), fading palette, and controlling the quick-hero and speed-text flags (after I find out what they do). Now the dragon switches between talking and staying during dialogs. However, the left/right direction doesn't work yet, because we don't respect _lookDir and _useDir yet. svn-id: r44964
This commit is contained in:
parent
ca35af2697
commit
1a4dcd3c82
@ -1270,6 +1270,17 @@ void Game::deleteObjectAnimations() {
|
||||
}
|
||||
}
|
||||
|
||||
int Game::playingObjectAnimation(const GameObject *obj) const {
|
||||
for (uint i = 0; i < obj->_anim.size(); ++i) {
|
||||
const int animID = obj->_anim[i];
|
||||
const Animation *anim = _vm->_anims->getAnimation(animID);
|
||||
if (anim && anim->isPlaying()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Game::enterNewRoom(bool force_reload) {
|
||||
if (_newRoom == getRoomNum() && !force_reload) {
|
||||
return;
|
||||
|
@ -272,6 +272,7 @@ public:
|
||||
void deleteObjectAnimations();
|
||||
void deleteAnimationsAfterIndex(int lastAnimIndex);
|
||||
void stopObjectAnimations(const GameObject *obj);
|
||||
int playingObjectAnimation(const GameObject *obj) const;
|
||||
|
||||
int getVariable(int varNum) const;
|
||||
void setVariable(int varNum, int value);
|
||||
|
@ -47,8 +47,8 @@ void Script::setupCommandList() {
|
||||
{ 4, 1, "Start", 2, { 3, 2 }, &Script::start },
|
||||
{ 5, 1, "Load", 2, { 3, 2 }, &Script::load },
|
||||
{ 5, 2, "StartPlay", 2, { 3, 2 }, &Script::startPlay },
|
||||
{ 5, 3, "JustTalk", 0, { 0 }, NULL },
|
||||
{ 5, 4, "JustStay", 0, { 0 }, NULL },
|
||||
{ 5, 3, "JustTalk", 0, { 0 }, &Script::justTalk },
|
||||
{ 5, 4, "JustStay", 0, { 0 }, &Script::justStay },
|
||||
{ 6, 1, "Talk", 2, { 3, 2 }, &Script::talk },
|
||||
{ 7, 1, "ObjStat", 2, { 3, 3 }, &Script::objStat },
|
||||
{ 7, 2, "ObjStat_On", 2, { 3, 3 }, &Script::objStatOn },
|
||||
@ -338,12 +338,11 @@ int Script::funcActPhase(int objID) const {
|
||||
bool visible = (obj->_location == _vm->_game->getRoomNum() && obj->_visible);
|
||||
|
||||
if (objID == kDragonObject || visible) {
|
||||
for (uint i = 0; i < obj->_anim.size(); ++i) {
|
||||
const int i = _vm->_game->playingObjectAnimation(obj);
|
||||
if (i >= 0) {
|
||||
int animID = obj->_anim[i];
|
||||
Animation *anim = _vm->_anims->getAnimation(animID);
|
||||
if (anim && anim->isPlaying()) {
|
||||
ret = anim->currentFrameNum();
|
||||
}
|
||||
ret = anim->currentFrameNum();
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,6 +476,48 @@ void Script::startPlay(Common::Queue<int> ¶ms) {
|
||||
anim->registerCallback(&Animation::doNothing);
|
||||
}
|
||||
|
||||
void Script::justTalk(Common::Queue<int> ¶ms) {
|
||||
const GameObject *dragon = _vm->_game->getObject(kDragonObject);
|
||||
const int last_anim = static_cast<Movement> (_vm->_game->playingObjectAnimation(dragon));
|
||||
if (last_anim >= 0) {
|
||||
_vm->_game->stopObjectAnimations(dragon);
|
||||
}
|
||||
int new_anim;
|
||||
if (last_anim == kSpeakRight || last_anim == kStopRight) {
|
||||
new_anim = kSpeakRight;
|
||||
} else {
|
||||
new_anim = kSpeakLeft;
|
||||
}
|
||||
|
||||
const int animID = dragon->_anim[new_anim];
|
||||
|
||||
Animation *anim = _vm->_anims->getAnimation(animID);
|
||||
_vm->_game->positionAnimAsHero(anim);
|
||||
|
||||
_vm->_anims->play(animID);
|
||||
}
|
||||
|
||||
void Script::justStay(Common::Queue<int> ¶ms) {
|
||||
const GameObject *dragon = _vm->_game->getObject(kDragonObject);
|
||||
const int last_anim = static_cast<Movement> (_vm->_game->playingObjectAnimation(dragon));
|
||||
if (last_anim >= 0) {
|
||||
_vm->_game->stopObjectAnimations(dragon);
|
||||
}
|
||||
int new_anim;
|
||||
if (last_anim == kSpeakRight || last_anim == kStopRight) {
|
||||
new_anim = kStopRight;
|
||||
} else {
|
||||
new_anim = kStopLeft;
|
||||
}
|
||||
|
||||
const int animID = dragon->_anim[new_anim];
|
||||
|
||||
Animation *anim = _vm->_anims->getAnimation(animID);
|
||||
_vm->_game->positionAnimAsHero(anim);
|
||||
|
||||
_vm->_anims->play(animID);
|
||||
}
|
||||
|
||||
void Script::c_If(Common::Queue<int> ¶ms) {
|
||||
int expression = params.pop();
|
||||
int jump = params.pop();
|
||||
|
@ -121,6 +121,8 @@ private:
|
||||
void walkOnPlay(Common::Queue<int> ¶ms);
|
||||
void play(Common::Queue<int> ¶ms);
|
||||
void startPlay(Common::Queue<int> ¶ms);
|
||||
void justTalk(Common::Queue<int> ¶ms);
|
||||
void justStay(Common::Queue<int> ¶ms);
|
||||
void newRoom(Common::Queue<int> ¶ms);
|
||||
void talk(Common::Queue<int> ¶ms);
|
||||
void loadMap(Common::Queue<int> ¶ms);
|
||||
|
Loading…
Reference in New Issue
Block a user