Merge remote-tracking branch 'Ziemas/playmovie'

This commit is contained in:
Vsevolod Kremianskii 2020-11-16 19:56:08 +07:00
commit b18ac841b3
5 changed files with 17 additions and 3 deletions

View file

@ -442,7 +442,7 @@ void Game::update() {
}
updateCamera(dt);
bool updModule = _module && (_screen == GameScreen::InGame || _screen == GameScreen::Dialog);
bool updModule = !_video && _module && (_screen == GameScreen::InGame || _screen == GameScreen::Dialog);
if (updModule) {
_module->update(dt);
}
@ -662,6 +662,9 @@ bool Game::handleMouseButtonDown(const SDL_MouseButtonEvent &event) {
if (event.button != SDL_BUTTON_LEFT) return false;
if (_video) {
if (_movieAudio) {
_movieAudio->stop();
}
_video->finish();
return true;
}

View file

@ -91,6 +91,8 @@ public:
void startDialog(SpatialObject &owner, const std::string &resRef);
void quit();
void playVideo(const std::string &name);
bool isLoadFromSaveGame() const;
Camera *getActiveCamera() const;
@ -240,7 +242,6 @@ private:
void loadNextModule();
float measureFrameTime();
void playMusic(const std::string &resRef);
void playVideo(const std::string &name);
void runMainLoop();
void toggleInGameCameraType();
void updateCamera(float dt);

View file

@ -104,6 +104,7 @@ private:
script::Variable getLoadFromSaveGame(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable getRunScriptVar(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable getStringByStrRef(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable playMovie(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable random(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable shipBuild(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);
script::Variable startNewModule(const std::vector<script::Variable> &args, script::ExecutionContext &ctx);

View file

@ -279,6 +279,15 @@ Variable Routines::startNewModule(const vector<Variable> &args, ExecutionContext
return Variable();
}
Variable Routines::playMovie(const vector<Variable> &args, ExecutionContext &ctx) {
string movie(args[0].strValue);
boost::to_lower(movie);
_game->playVideo(movie);
return Variable();
}
} // namespace game
} // namespace reone

View file

@ -772,7 +772,7 @@ void Routines::addKotorRoutines() {
add("ActionFollowLeader", Void, { });
add("SetForcePowerUnsuccessful", Void, { Int, Object });
add("GetIsDebilitated", Int, { Object });
add("PlayMovie", Void, { String });
add("PlayMovie", Void, { String }, bind(&Routines::playMovie, this, _1, _2));
add("SaveNPCState", Void, { Int });
add("GetCategoryFromTalent", Int, { Talent });
add("SurrenderByFaction", Void, { Int, Int });