TETRAEDGE: Fix SetModelPlayer for Syberia 2

This commit is contained in:
Matthew Duggan 2023-02-26 21:46:19 +09:00
parent 7b6118c497
commit 30f84f65fa
4 changed files with 26 additions and 9 deletions

View File

@ -38,7 +38,7 @@
namespace Tetraedge {
class Character : public TeAnimation {
class Character : public TeAnimation, public TeObject {
public:
Character();
virtual ~Character();

View File

@ -874,6 +874,8 @@ bool Game::loadPlayerCharacter(const Common::String &name) {
_scene._character->_characterAnimPlayerFinishedSignal.add(this, &Game::onCharacterAnimationPlayerFinished);
_scene._character->onFinished().remove(this, &Game::onDisplacementPlayerFinished);
_scene._character->onFinished().add(this, &Game::onDisplacementPlayerFinished);
} else {
debug("failed to load player character %s", name.c_str());
}
return result;
}

View File

@ -995,16 +995,31 @@ bool InGameScene::loadPlayerCharacter(const Common::String &name) {
_playerCharacterModel = _character->_model;
if (!findKate()) {
models().push_back(_character->_model);
if (_character->_shadowModel[0]) {
models().push_back(_character->_shadowModel[0]);
models().push_back(_character->_shadowModel[1]);
bool kateFound = findKate();
if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
if (!kateFound) {
models().push_back(_character->_model);
if (_character->_shadowModel[0]) {
models().push_back(_character->_shadowModel[0]);
models().push_back(_character->_shadowModel[1]);
}
}
} else {
if (kateFound) {
for (uint i = 0; i < models().size(); i++) {
if (models()[i] == _character->_model) {
models().remove_at(i);
break;
}
}
}
models().push_back(_character->_model);
}
}
_character->_model->setVisible(true);
_character->setFreeMoveZone(nullptr);
return true;
}
@ -1539,7 +1554,7 @@ void InGameScene::unloadCharacter(const Common::String &name) {
if (_character->_model->anim())
_character->_model->anim()->stop(); // TODO: added this
_character->setFreeMoveZone(nullptr); // TODO: added this
// TODO: deleteLater() something here..
_character->deleteLater();
_character = nullptr;
}
for (uint i = 0; i < _characters.size(); i++) {
@ -1548,7 +1563,7 @@ void InGameScene::unloadCharacter(const Common::String &name) {
c->removeAnim();
c->deleteAnim();
c->deleteAllCallback();
// TODO: deleteLater() something here..
c->deleteLater();
if (c->_model->anim())
c->_model->anim()->stop(); // TODO: added this
c->setFreeMoveZone(nullptr); // TODO: added this

View File

@ -2214,7 +2214,7 @@ static int tolua_ExportedFunctions_EnableRunMode00(lua_State *L) {
static void SetModelPlayer(const Common::String &name) {
Game *game = g_engine->getGame();
Character *character = game->scene().character(name);
Character *character = game->scene()._character;
if (!character) {
warning("[SetModelPlayer] Character not found %s", name.c_str());