mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 09:49:14 +00:00
MYST3: Movies are now loaded by the scripts
This commit is contained in:
parent
44c5e1103f
commit
ed9269ae4a
@ -24,15 +24,15 @@
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
Movie::Movie(Archive &archive, uint16 id) {
|
||||
Movie::Movie(Archive *archive, uint16 id) {
|
||||
static const float scale = 50.0f;
|
||||
|
||||
const DirectorySubEntry *binkDesc = archive.getDescription(id, 0, DirectorySubEntry::kMovie);
|
||||
const DirectorySubEntry *binkDesc = archive->getDescription(id, 0, DirectorySubEntry::kMovie);
|
||||
|
||||
if (!binkDesc)
|
||||
return;
|
||||
|
||||
Common::MemoryReadStream *binkStream = archive.getData(binkDesc);
|
||||
Common::MemoryReadStream *binkStream = archive->getData(binkDesc);
|
||||
const VideoData &videoData = binkDesc->getVideoData();
|
||||
|
||||
Math::Vector3d planeDirection = videoData.v1;
|
||||
|
@ -32,9 +32,10 @@ namespace Myst3 {
|
||||
|
||||
class Movie {
|
||||
public:
|
||||
Movie(Archive &archive, uint16 id);
|
||||
Movie(Archive *archive, uint16 id);
|
||||
virtual ~Movie();
|
||||
void draw();
|
||||
void setCondition(uint16 condition) { _condition = condition; }
|
||||
|
||||
private:
|
||||
static const int _movieTextureSize = 1024;
|
||||
@ -45,6 +46,8 @@ private:
|
||||
Math::Vector3d _pTopRight;
|
||||
Video::BinkDecoder _bink;
|
||||
GLuint _texture;
|
||||
|
||||
uint16 _condition;
|
||||
};
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
@ -153,10 +153,19 @@ Common::Error Myst3Engine::run() {
|
||||
}
|
||||
_node->draw();
|
||||
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
_movies[i]->draw();
|
||||
}
|
||||
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
delete _movies[i];
|
||||
}
|
||||
_movies.clear();
|
||||
|
||||
_node->unload();
|
||||
delete _node;
|
||||
|
||||
@ -167,6 +176,10 @@ Common::Error Myst3Engine::run() {
|
||||
|
||||
void Myst3Engine::goToNode(uint16 nodeID, uint8 roomID) {
|
||||
if (_node) {
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
delete _movies[i];
|
||||
}
|
||||
_movies.clear();
|
||||
_node->unload();
|
||||
delete _node;
|
||||
_node = 0;
|
||||
@ -250,4 +263,10 @@ void Myst3Engine::runScriptsFromNode(uint16 nodeID, uint8 roomID, uint32 ageID)
|
||||
}
|
||||
}
|
||||
|
||||
void Myst3Engine::loadMovie(uint16 id, bool preload, uint16 condition) {
|
||||
Movie *movie = new Movie(_archive, id);
|
||||
movie->setCondition(condition);
|
||||
_movies.push_back(movie);
|
||||
}
|
||||
|
||||
} // end of namespace Myst3
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "engines/myst3/archive.h"
|
||||
#include "engines/myst3/console.h"
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/movie.h"
|
||||
#include "engines/myst3/node.h"
|
||||
#include "engines/myst3/scene.h"
|
||||
#include "engines/myst3/script.h"
|
||||
@ -72,6 +73,7 @@ public:
|
||||
void runScriptsFromNode(uint16 nodeID, uint8 roomID = 0, uint32 ageID = 0);
|
||||
void runNodeInitScripts();
|
||||
|
||||
void loadMovie(uint16 id, bool preload, uint16 condition);
|
||||
private:
|
||||
OSystem *_system;
|
||||
Console *_console;
|
||||
@ -82,6 +84,8 @@ private:
|
||||
Script *_scriptEngine;
|
||||
Database *_db;
|
||||
|
||||
Common::Array<Movie *> _movies;
|
||||
|
||||
ViewType _viewType;
|
||||
uint16 _currentNode;
|
||||
uint8 _currentRoom;
|
||||
|
@ -47,16 +47,6 @@ void NodeCube::load(Archive &archive, uint16 index) {
|
||||
delete jpegStream;
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: To load some of the movies of a frame
|
||||
loadMovie(archive, index + 10000);
|
||||
loadMovie(archive, index + 11000);
|
||||
loadMovie(archive, index + 20000);
|
||||
}
|
||||
|
||||
void NodeCube::loadMovie(Archive &archive, uint16 id) {
|
||||
Movie *movie = new Movie(archive, id);
|
||||
_movies.push_back(movie);
|
||||
}
|
||||
|
||||
void NodeCube::draw() {
|
||||
@ -117,17 +107,9 @@ void NodeCube::draw() {
|
||||
glEnd();
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
_movies[i]->draw();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeCube::unload() {
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
delete _movies[i];
|
||||
}
|
||||
|
||||
Node::unload();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#define NODECUBE_H_
|
||||
|
||||
#include "engines/myst3/node.h"
|
||||
#include "engines/myst3/movie.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
@ -36,11 +35,6 @@ public:
|
||||
void load(Archive &archive, uint16 id);
|
||||
void unload();
|
||||
void draw();
|
||||
|
||||
void loadMovie(Archive &archive, uint16 id);
|
||||
|
||||
private:
|
||||
Common::Array<Movie *> _movies;
|
||||
};
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
@ -37,6 +37,8 @@ Script::Script(Myst3Engine *vm):
|
||||
OPCODE(8, nodeFrameInitCond);
|
||||
OPCODE(9, nodeFrameInitIndex);
|
||||
OPCODE(11, stopWholeScript);
|
||||
OPCODE(19, movieInitCond);
|
||||
OPCODE(22, movieInitCondPreload);
|
||||
OPCODE(35, sunspotAdd);
|
||||
OPCODE(49, varSetZero);
|
||||
OPCODE(50, varSetOne);
|
||||
@ -221,6 +223,17 @@ void Script::stopWholeScript(Context &c, const Opcode &cmd) {
|
||||
c.endScript = true;
|
||||
}
|
||||
|
||||
void Script::movieInitCond(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Init movie %d with condition %d", cmd.op, cmd.args[0], cmd.args[1]);
|
||||
|
||||
_vm->loadMovie(cmd.args[0], false, cmd.args[1]);
|
||||
}
|
||||
void Script::movieInitCondPreload(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Preload movie %d with condition %d", cmd.op, cmd.args[0], cmd.args[1]);
|
||||
|
||||
_vm->loadMovie(cmd.args[0], true, cmd.args[1]);
|
||||
}
|
||||
|
||||
void Script::sunspotAdd(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Add sunspot: pitch %d heading %d", cmd.op, cmd.args[0], cmd.args[1]);
|
||||
|
||||
|
@ -71,6 +71,8 @@ private:
|
||||
DECLARE_OPCODE(nodeFrameInitCond);
|
||||
DECLARE_OPCODE(nodeFrameInitIndex);
|
||||
DECLARE_OPCODE(stopWholeScript);
|
||||
DECLARE_OPCODE(movieInitCond);
|
||||
DECLARE_OPCODE(movieInitCondPreload);
|
||||
DECLARE_OPCODE(sunspotAdd);
|
||||
DECLARE_OPCODE(varSetZero);
|
||||
DECLARE_OPCODE(varSetOne);
|
||||
|
Loading…
x
Reference in New Issue
Block a user