GRIM: Implemented iris animation.
This commit is contained in:
parent
f6d30ca6dd
commit
68427fdad4
8 changed files with 161 additions and 2 deletions
|
@ -381,6 +381,7 @@ GrimEngine::GrimEngine(OSystem *syst, uint32 gameFlags, GrimGameType gameType, C
|
|||
_listFilesIter = NULL;
|
||||
_savedState = NULL;
|
||||
_fps[0] = 0;
|
||||
_iris = new Iris();
|
||||
|
||||
Color *c = new Color(0, 0, 0);
|
||||
registerColor(c);
|
||||
|
@ -455,6 +456,7 @@ GrimEngine::~GrimEngine() {
|
|||
g_resourceloader = NULL;
|
||||
delete g_driver;
|
||||
g_driver = NULL;
|
||||
delete _iris;
|
||||
}
|
||||
|
||||
Common::Error GrimEngine::run() {
|
||||
|
@ -858,6 +860,10 @@ void GrimEngine::drawPrimitives() {
|
|||
}
|
||||
}
|
||||
|
||||
void GrimEngine::playIrisAnimation(Iris::Direction dir, int x, int y, int time) {
|
||||
_iris->play(dir, x, y, time);
|
||||
}
|
||||
|
||||
void GrimEngine::luaUpdate() {
|
||||
if (_savegameLoadRequest || _savegameSaveRequest)
|
||||
return;
|
||||
|
@ -996,6 +1002,7 @@ void GrimEngine::updateDisplayScene() {
|
|||
_currScene->drawBitmaps(ObjectState::OBJSTATE_OVERLAY);
|
||||
|
||||
drawPrimitives();
|
||||
_iris->draw();
|
||||
} else if (_mode == ENGINE_MODE_DRAW) {
|
||||
_doFlip = false;
|
||||
_prevSmushFrame = 0;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "engines/grim/textobject.h"
|
||||
#include "engines/grim/iris.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
|
@ -118,6 +119,7 @@ public:
|
|||
bool getFlipEnable() { return _flipEnable; }
|
||||
void refreshDrawMode() { _refreshDrawNeeded = true; }
|
||||
void drawPrimitives();
|
||||
void playIrisAnimation(Iris::Direction dir, int x, int y, int time);
|
||||
|
||||
void mainLoop();
|
||||
unsigned getFrameStart() const { return _frameStart; }
|
||||
|
@ -272,6 +274,7 @@ private:
|
|||
|
||||
Actor *_selectedActor;
|
||||
Actor *_talkingActor;
|
||||
Iris *_iris;
|
||||
|
||||
SceneListType _scenes;
|
||||
ActorListType _actors;
|
||||
|
|
79
engines/grim/iris.cpp
Normal file
79
engines/grim/iris.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* Residual - A 3D game interpreter
|
||||
*
|
||||
* Residual is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/grim/iris.h"
|
||||
#include "engines/grim/gfx_base.h"
|
||||
#include "engines/grim/grim.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
Iris::Iris() :
|
||||
_playing(false), _direction(Open) {
|
||||
|
||||
}
|
||||
|
||||
Iris::~Iris() {
|
||||
|
||||
}
|
||||
|
||||
void Iris::play(Iris::Direction dir, int x, int y, int lenght) {
|
||||
_playing = true;
|
||||
_direction = dir;
|
||||
_x = x;
|
||||
_y = y;
|
||||
_lenght = lenght;
|
||||
_currTime = 0;
|
||||
}
|
||||
|
||||
void Iris::draw() {
|
||||
if (!_playing) {
|
||||
if (_direction == Close) {
|
||||
g_driver->dimRegion(0, 0, 640, 479, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_currTime += g_grim->getFrameTime();
|
||||
if (_currTime >= _lenght) {
|
||||
_playing = false;
|
||||
if (_direction == Close) {
|
||||
g_driver->dimRegion(0, 0, 640, 479, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float factor = (float)_currTime / (float)_lenght;
|
||||
if (_direction == Open) {
|
||||
factor = 1 - factor;
|
||||
}
|
||||
|
||||
int y = _y * factor;
|
||||
int x = _x * factor;
|
||||
|
||||
// Why doesn't 480 work here??
|
||||
g_driver->dimRegion(0, 0, 640, y, 0);
|
||||
g_driver->dimRegion(0, y, x, 479 - y, 0);
|
||||
g_driver->dimRegion(x, 479 - y, 640 - x, y, 0);
|
||||
g_driver->dimRegion(640 - x, y, x, 479 - y, 0);
|
||||
}
|
||||
|
||||
}
|
52
engines/grim/iris.h
Normal file
52
engines/grim/iris.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Residual - A 3D game interpreter
|
||||
*
|
||||
* Residual is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRIM_IRIS_H
|
||||
#define GRIM_IRIS_H
|
||||
|
||||
namespace Grim {
|
||||
|
||||
class Iris {
|
||||
public:
|
||||
enum Direction {
|
||||
Open,
|
||||
Close
|
||||
};
|
||||
|
||||
Iris();
|
||||
~Iris();
|
||||
|
||||
void play(Direction dir, int x, int y, int lenght);
|
||||
void draw();
|
||||
|
||||
private:
|
||||
bool _playing;
|
||||
Direction _direction;
|
||||
int _x;
|
||||
int _y;
|
||||
int _lenght;
|
||||
int _currTime;
|
||||
};
|
||||
|
||||
} // end of namespace Grim
|
||||
|
||||
#endif
|
|
@ -277,6 +277,8 @@ void L1_SetLightIntensity();
|
|||
void L1_SetLightPosition();
|
||||
void L1_TurnLightOn();
|
||||
void L1_RenderModeUser();
|
||||
void L1_IrisUp();
|
||||
void L1_IrisDown();
|
||||
void L1_SetGamma();
|
||||
void L1_Display();
|
||||
void L1_EngineDisplay();
|
||||
|
|
|
@ -1299,8 +1299,6 @@ STUB_FUNC(L1_NukeResources)
|
|||
STUB_FUNC(L1_ResetTextures)
|
||||
STUB_FUNC(L1_AttachToResources)
|
||||
STUB_FUNC(L1_DetachFromResources)
|
||||
STUB_FUNC(L1_IrisUp)
|
||||
STUB_FUNC(L1_IrisDown)
|
||||
STUB_FUNC(L1_SetActorClipPlane)
|
||||
STUB_FUNC(L1_SetActorClipActive)
|
||||
STUB_FUNC(L1_SetActorCollisionScale)
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "engines/grim/colormap.h"
|
||||
#include "engines/grim/bitmap.h"
|
||||
#include "engines/grim/primitives.h"
|
||||
#include "engines/grim/iris.h"
|
||||
|
||||
#include "engines/grim/movie/movie.h"
|
||||
|
||||
|
@ -538,4 +539,20 @@ void L1_RenderModeUser() {
|
|||
}
|
||||
}
|
||||
|
||||
void L1_IrisUp() {
|
||||
lua_Object xObj = lua_getparam(1);
|
||||
lua_Object yObj = lua_getparam(2);
|
||||
lua_Object timeObj = lua_getparam(3);
|
||||
|
||||
g_grim->playIrisAnimation(Iris::Open, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj));
|
||||
}
|
||||
|
||||
void L1_IrisDown() {
|
||||
lua_Object xObj = lua_getparam(1);
|
||||
lua_Object yObj = lua_getparam(2);
|
||||
lua_Object timeObj = lua_getparam(3);
|
||||
|
||||
g_grim->playIrisAnimation(Iris::Close, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj));
|
||||
}
|
||||
|
||||
} // end of namespace Grim
|
||||
|
|
|
@ -50,6 +50,7 @@ MODULE_OBJS := \
|
|||
gfx_opengl.o \
|
||||
gfx_tinygl.o \
|
||||
grim.o \
|
||||
iris.o \
|
||||
keyframe.o \
|
||||
lab.o \
|
||||
lipsync.o \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue