GRIM: Fix the focus point of the iris.

This commit is contained in:
Giulio Camuffo 2011-07-29 22:49:08 +02:00
parent 59b6af4d18
commit 1c62f04688
7 changed files with 31 additions and 24 deletions

@ -115,7 +115,7 @@ public:
* @param x the width of the Iris
* @param y the height of the Iris
*/
virtual void irisAroundRegion(int x, int y) = 0;
virtual void irisAroundRegion(int x1, int y1, int x2, int y2) = 0;
virtual void drawEmergString(int x, int y, const char *text, const Color &fgColor) = 0;
virtual void loadEmergFont() = 0;

@ -1274,7 +1274,7 @@ void GfxOpenGL::dimRegion(int x, int yReal, int w, int h, float level) {
delete[] data;
}
void GfxOpenGL::irisAroundRegion(int x, int y)
void GfxOpenGL::irisAroundRegion(int x1, int y1, int x2, int y2)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@ -1292,19 +1292,19 @@ void GfxOpenGL::irisAroundRegion(int x, int y)
float points[20] = {
0.0f, 0.0f,
0.0f, y,
0.0f, y1,
_screenWidth, 0.0f,
_screenWidth - x, y,
x2, y1,
_screenWidth, _screenHeight,
_screenWidth - x, _screenHeight - y,
x2, y2,
0.0f, _screenHeight,
0.0f + x, _screenHeight - y,
0.0f, y,
x, y
x1, y2,
0.0f, y1,
x1, y1
};
#ifndef USE_VERTEX_ARRAYS
glBegin(GL_TRIANGLE_STRIP);
for (int i = 0 ;i < 10; i++) {
for (int i = 0; i < 10; i++) {
glVertex2fv(points + 2 * i);
}
glEnd();

@ -103,7 +103,7 @@ public:
void copyStoredToDisplay();
void dimScreen();
void dimRegion(int x, int y, int w, int h, float level);
void irisAroundRegion(int x, int y);
void irisAroundRegion(int x1, int y1, int x2, int y2);
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();

@ -960,13 +960,12 @@ void GfxTinyGL::dimRegion(int x, int y, int w, int h, float level) {
}
}
void GfxTinyGL::irisAroundRegion(int x, int y)
{
void GfxTinyGL::irisAroundRegion(int x1, int y1, int x2, int y2) {
uint16 *data = (uint16 *)_zb->pbuf;
for (int ly = 0; ly < _screenHeight; ly++) {
for (int lx = 0; lx < _screenWidth; lx++) {
// Don't do anything with the data in the region we draw Around
if(lx > x && lx < _screenWidth - x && ly > y && ly < _screenHeight - y)
if(lx > x1 && lx < x2 && ly > y1 && ly < y2)
continue;
// But set everything around it to black.
data[ly * 640 + lx] = (uint16)0.0f;

@ -91,7 +91,7 @@ public:
void dimScreen();
void dimRegion(int x, int y, int w, int h, float level);
void irisAroundRegion(int x, int y);
void irisAroundRegion(int x1, int y1, int x2, int y2);
Bitmap *getScreenshot(int w, int h);
void storeDisplay();

@ -48,12 +48,12 @@ void Iris::play(Iris::Direction dir, int x, int y, int lenght) {
void Iris::draw() {
if (!_playing) {
if (_direction == Close && g_grim->getMode() != ENGINE_MODE_SMUSH) {
g_driver->irisAroundRegion(320, 240);
g_driver->irisAroundRegion(320, 240, 320, 240);
}
return;
}
g_driver->irisAroundRegion(_x, _y);
g_driver->irisAroundRegion(_x1, _y1, _x2, _y2);
}
void Iris::update(int frameTime) {
@ -72,8 +72,10 @@ void Iris::update(int frameTime) {
factor = 1 - factor;
}
_y = (int)(_targetY * factor);
_x = (int)(_targetX * factor);
_y1 = (int)(_targetY * factor);
_x1 = (int)(_targetX * factor);
_y2 = (int)(480 - (480 - _targetY) * factor);
_x2 = (int)(640 - (640 - _targetX) * factor);
}
void Iris::saveState(SaveGame *state) const {
@ -81,8 +83,10 @@ void Iris::saveState(SaveGame *state) const {
state->writeLEBool(_playing);
state->writeLEUint32((uint32)_direction);
state->writeLEUint32(_x);
state->writeLEUint32(_y);
state->writeLEUint32(_x1);
state->writeLEUint32(_y1);
// state->writeLEUint32(_x2);
// state->writeLEUint32(_y2);
state->writeLEUint32(_lenght);
state->writeLEUint32(_currTime);
@ -94,8 +98,10 @@ void Iris::restoreState(SaveGame *state) {
_playing = state->readLEBool();
_direction = (Direction)state->readLEUint32();
_x = state->readLEUint32();
_y = state->readLEUint32();
_x1 = state->readLEUint32();
_y1 = state->readLEUint32();
// _x2 = state->readLEUint32();
// _y2 = state->readLEUint32();
_lenght = state->readLEUint32();
_currTime = state->readLEUint32();

@ -47,8 +47,10 @@ public:
private:
bool _playing;
Direction _direction;
int _x;
int _y;
int _x1;
int _y1;
int _x2;
int _y2;
int _targetX;
int _targetY;
int _lenght;