mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
TWINE: parse fla movie frame information
This commit is contained in:
1 parent
252faf42f8
commit
7ac555ecea
3 files changed
+44
-32
No files matched your search
@@ -264,38 +264,9 @@ void FlaMovies::playGIFMovie(const char *flaName) {
|
||||
}
|
||||
|
||||
debug("Play gif %s", flaName);
|
||||
// TODO: use the HQR 23th entry (movies informations)
|
||||
if (!strcmp(flaName, FLA_INTROD)) {
|
||||
prepareGIF(3);
|
||||
prepareGIF(4);
|
||||
prepareGIF(5);
|
||||
} else if (!strcmp(flaName, "BAFFE") || !strcmp(flaName, "BAFFE2") || !strcmp(flaName, "BAFFE3") || !strcmp(flaName, "BAFFE4")) {
|
||||
prepareGIF(6);
|
||||
} else if (!strcmp(flaName, "bateau") || !strcmp(flaName, "bateau2")) {
|
||||
prepareGIF(7);
|
||||
} else if (!strcmp(flaName, "navette")) {
|
||||
prepareGIF(15);
|
||||
} else if (!strcmp(flaName, "templebu")) {
|
||||
prepareGIF(12);
|
||||
} else if (!strcmp(flaName, "flute2")) {
|
||||
prepareGIF(8); // TODO: same as glass2?
|
||||
} else if (!strcmp(flaName, "glass2")) {
|
||||
prepareGIF(8); // TODO: same as flute2?
|
||||
} else if (!strcmp(flaName, "surf")) {
|
||||
prepareGIF(9);
|
||||
} else if (!strcmp(flaName, "verser") || !strcmp(flaName, "verser2")) {
|
||||
prepareGIF(10);
|
||||
} else if (!strcmp(flaName, "neige2")) {
|
||||
prepareGIF(11);
|
||||
} else if (!strcmp(flaName, "capture")) {
|
||||
prepareGIF(14); // TODO: same as sendel?
|
||||
} else if (!strcmp(flaName, "sendel")) {
|
||||
prepareGIF(14); // TODO: same as capture?
|
||||
} else if (!strcmp(flaName, "sendel2")) {
|
||||
prepareGIF(17);
|
||||
} else if (!strcmp(flaName, FLA_DRAGON3)) {
|
||||
prepareGIF(1);
|
||||
prepareGIF(2);
|
||||
const Common::Array<int32>& frames = _engine->_resources->getFlaMovieInfo(flaName);
|
||||
for (int32 frame : frames) {
|
||||
prepareGIF(frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "twine/resources/resources.h"
|
||||
#include "common/tokenizer.h"
|
||||
#include "common/util.h"
|
||||
#include "twine/audio/sound.h"
|
||||
#include "twine/renderer/screens.h"
|
||||
@@ -172,6 +173,39 @@ void Resources::initResources() {
|
||||
preloadAnimations();
|
||||
preloadSamples();
|
||||
preloadInventoryItems();
|
||||
|
||||
loadFlaInfo();
|
||||
}
|
||||
|
||||
void Resources::loadFlaInfo() {
|
||||
uint8 *content = nullptr;
|
||||
const int32 size = HQR::getAllocEntry(&content, Resources::HQR_RESS_FILE, RESSHQR_FLAINFO);
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
const Common::String str((const char*)content, size);
|
||||
free(content);
|
||||
|
||||
Common::StringTokenizer tok(str, "\r\n");
|
||||
while (!tok.empty()) {
|
||||
const Common::String &line = tok.nextToken();
|
||||
Common::StringTokenizer lineTok(line);
|
||||
if (lineTok.empty()) {
|
||||
continue;
|
||||
}
|
||||
const Common::String &name = lineTok.nextToken();
|
||||
Common::Array<int32> frames;
|
||||
while (!lineTok.empty()) {
|
||||
const Common::String &frame = lineTok.nextToken();
|
||||
const int32 frameIdx = atoi(frame.c_str());
|
||||
frames.push_back(frameIdx);
|
||||
}
|
||||
_flaMovieFrames.setVal(name, frames);
|
||||
}
|
||||
}
|
||||
|
||||
const Common::Array<int32>& Resources::getFlaMovieInfo(const Common::String &name) const {
|
||||
return _flaMovieFrames.getVal(name);
|
||||
}
|
||||
|
||||
} // namespace TwinE
|
||||
@@ -23,6 +23,7 @@
|
||||
#ifndef TWINE_RESOURCES_H
|
||||
#define TWINE_RESOURCES_H
|
||||
|
||||
#include "common/hashmap.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "twine/parser/sprite.h"
|
||||
#include "twine/scene/gamestate.h"
|
||||
@@ -142,11 +143,17 @@ private:
|
||||
/** Preload all animations */
|
||||
void preloadAnimations();
|
||||
void preloadSamples();
|
||||
void loadFlaInfo();
|
||||
|
||||
using MovieInfoMap = Common::HashMap<Common::String, Common::Array<int32>>;
|
||||
MovieInfoMap _flaMovieFrames;
|
||||
|
||||
public:
|
||||
Resources(TwinEEngine *engine) : _engine(engine) {}
|
||||
~Resources();
|
||||
|
||||
const Common::Array<int32>& getFlaMovieInfo(const Common::String &name) const;
|
||||
|
||||
/** Table with all loaded samples */
|
||||
uint8 *inventoryTable[NUM_INVENTORY_ITEMS] {nullptr};
|
||||
/** Table with all loaded samples sizes */
|
||||
|
||||
Reference in new issue
Block a user