mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
Some more preliminary cutaway work. The backgrounds are displayed now, but
not the animations themselves. Still, it's enough to make the IHNM intro look fairly interesting. svn-id: r18874
This commit is contained in:
parent
e077fdd9ed
commit
ee4b2ccb02
@ -27,7 +27,10 @@
|
||||
|
||||
#include "saga/console.h"
|
||||
#include "saga/events.h"
|
||||
#include "saga/interface.h"
|
||||
#include "saga/render.h"
|
||||
#include "saga/rscfile.h"
|
||||
#include "saga/scene.h"
|
||||
|
||||
#include "saga/animation.h"
|
||||
|
||||
@ -55,8 +58,8 @@ void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) {
|
||||
MemoryReadStream cutawayS(resourcePointer, resourceLength);
|
||||
|
||||
for (int i = 0; i < _cutawayListLength; i++) {
|
||||
_cutawayList[i].backgroundID = cutawayS.readUint16LE();
|
||||
_cutawayList[i].frameID = cutawayS.readUint16LE();
|
||||
_cutawayList[i].backgroundResourceId = cutawayS.readUint16LE();
|
||||
_cutawayList[i].animResourceId = cutawayS.readUint16LE();
|
||||
_cutawayList[i].maxFrame = (int16)cutawayS.readUint16LE();
|
||||
_cutawayList[i].frameRate = (int16)cutawayS.readUint16LE();
|
||||
}
|
||||
@ -68,6 +71,51 @@ void Anim::freeCutawayList(void) {
|
||||
_cutawayListLength = 0;
|
||||
}
|
||||
|
||||
void Anim::playCutaway(int cut, bool fade) {
|
||||
debug(0, "playCutaway(%d, %d)", cut, fade);
|
||||
|
||||
if (fade) {
|
||||
// TODO: Fade down. Is this blocking or non-blocking?
|
||||
}
|
||||
|
||||
// TODO: Stop all other animations
|
||||
|
||||
_vm->_gfx->showCursor(false);
|
||||
_vm->_interface->setStatusText("");
|
||||
_vm->_interface->setSaveReminderState(0);
|
||||
|
||||
// TODO: Hide the inventory. Perhaps by adding a new panel mode?
|
||||
|
||||
// Set the initial background and palette for the cutaway
|
||||
|
||||
ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
|
||||
|
||||
byte *resourceData;
|
||||
size_t resourceDataLength;
|
||||
|
||||
_vm->_resource->loadResource(context, _cutawayList[cut].backgroundResourceId, resourceData, resourceDataLength);
|
||||
|
||||
byte *buf;
|
||||
size_t buflen;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
_vm->decodeBGImage(resourceData, resourceDataLength, &buf, &buflen, &width, &height);
|
||||
|
||||
PalEntry *palette = (PalEntry *)_vm->getImagePal(resourceData, resourceDataLength);
|
||||
|
||||
Surface *bgSurface = _vm->_render->getBackGroundSurface();
|
||||
const Rect rect(width, height);
|
||||
|
||||
bgSurface->blit(rect, buf);
|
||||
_vm->_gfx->setPalette(palette);
|
||||
|
||||
free(buf);
|
||||
free(resourceData);
|
||||
|
||||
// TODO: Start the animation
|
||||
}
|
||||
|
||||
void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
|
||||
AnimationData *anim;
|
||||
uint16 temp;
|
||||
@ -230,7 +278,6 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
|
||||
event.time = frameTime;
|
||||
|
||||
_vm->_events->queue(&event);
|
||||
|
||||
}
|
||||
|
||||
void Anim::stop(uint16 animId) {
|
||||
|
@ -54,8 +54,8 @@ enum AnimationState {
|
||||
// Cutaway info array member. Cutaways are basically animations with a really
|
||||
// bad attitude.
|
||||
struct Cutaway {
|
||||
uint16 backgroundID;
|
||||
uint16 frameID;
|
||||
uint16 backgroundResourceId;
|
||||
uint16 animResourceId;
|
||||
int16 maxFrame;
|
||||
int16 frameRate;
|
||||
};
|
||||
@ -109,6 +109,7 @@ public:
|
||||
|
||||
void loadCutawayList(const byte *resourcePointer, size_t resourceLength);
|
||||
void freeCutawayList(void);
|
||||
void playCutaway(int cut, bool fade);
|
||||
|
||||
void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
|
||||
void freeId(uint16 animId);
|
||||
|
@ -1840,7 +1840,14 @@ void Script::sf75(SCRIPTFUNC_PARAMS) {
|
||||
}
|
||||
|
||||
void Script::sfScriptStartCutAway(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfScriptStartCutAway", thread, nArgs);
|
||||
int16 cut;
|
||||
int16 fade;
|
||||
|
||||
cut = thread->pop();
|
||||
thread->pop(); // Not used
|
||||
fade = thread->pop();
|
||||
|
||||
_vm->_anim->playCutaway(cut, fade != 0);
|
||||
}
|
||||
|
||||
void Script::sfReturnFromCutAway(SCRIPTFUNC_PARAMS) {
|
||||
|
Loading…
Reference in New Issue
Block a user