mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
Implemented the "placard" functions, because they're such a nice visual
feedback that something right is happening. svn-id: r16371
This commit is contained in:
@@ -986,6 +986,32 @@ int Gfx::blackToPal(SURFACE *surface, PALENTRY *src_pal, double percent) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void Gfx::palToBlackWait(SURFACE *surface, PALENTRY *src_pal, int duration) {
|
||||
uint32 start_time = _vm->_system->getMillis();
|
||||
uint32 cur_time;
|
||||
|
||||
do {
|
||||
cur_time = _vm->_system->getMillis();
|
||||
|
||||
palToBlack(surface, src_pal, (double) (cur_time - start_time) / duration);
|
||||
_vm->_system->updateScreen();
|
||||
_vm->_system->delayMillis(50);
|
||||
} while (cur_time < start_time + duration);
|
||||
}
|
||||
|
||||
void Gfx::blackToPalWait(SURFACE *surface, PALENTRY *src_pal, int duration) {
|
||||
uint32 start_time = _vm->_system->getMillis();
|
||||
uint32 cur_time;
|
||||
|
||||
do {
|
||||
cur_time = _vm->_system->getMillis();
|
||||
|
||||
blackToPal(surface, src_pal, (double) (cur_time - start_time) / duration);
|
||||
_vm->_system->updateScreen();
|
||||
_vm->_system->delayMillis(50);
|
||||
} while (cur_time < start_time + duration);
|
||||
}
|
||||
|
||||
void Gfx::showCursor(bool state) {
|
||||
updateCursor();
|
||||
g_system->showMouse(state);
|
||||
|
||||
@@ -107,6 +107,8 @@ public:
|
||||
int getCurrentPal(PALENTRY *src_pal);
|
||||
int palToBlack(SURFACE *surface, PALENTRY *src_pal, double percent);
|
||||
int blackToPal(SURFACE *surface, PALENTRY *src_pal, double percent);
|
||||
void palToBlackWait(SURFACE *surface, PALENTRY *src_pal, int duration);
|
||||
void blackToPalWait(SURFACE *surface, PALENTRY *src_pal, int duration);
|
||||
void updateCursor() { setCursor(getWhite()); }
|
||||
void showCursor(bool state);
|
||||
|
||||
|
||||
+17
-11
@@ -122,20 +122,22 @@ int Render::drawScene() {
|
||||
bg_pt.x = 0;
|
||||
bg_pt.y = 0;
|
||||
|
||||
// Display scene background
|
||||
_vm->_scene->draw(backbuf_surface);
|
||||
if (!(_flags & RF_PLACARD)) {
|
||||
// Display scene background
|
||||
_vm->_scene->draw(backbuf_surface);
|
||||
|
||||
// Display scene maps, if applicable
|
||||
if (getFlags() & RF_OBJECTMAP_TEST) {
|
||||
if (_vm->_scene->_objectMap)
|
||||
_vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
|
||||
if (_vm->_scene->_actionMap)
|
||||
_vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
|
||||
// Display scene maps, if applicable
|
||||
if (getFlags() & RF_OBJECTMAP_TEST) {
|
||||
if (_vm->_scene->_objectMap)
|
||||
_vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
|
||||
if (_vm->_scene->_actionMap)
|
||||
_vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
|
||||
}
|
||||
|
||||
// Draw queued actors
|
||||
_vm->_actor->drawActors();
|
||||
}
|
||||
|
||||
// Draw queued actors
|
||||
_vm->_actor->drawActors();
|
||||
|
||||
// Draw queued text strings
|
||||
_vm->_scene->getInfo(&scene_info);
|
||||
|
||||
@@ -211,6 +213,10 @@ void Render::setFlag(unsigned int flag) {
|
||||
_flags |= flag;
|
||||
}
|
||||
|
||||
void Render::clearFlag(unsigned int flag) {
|
||||
_flags &= ~flag;
|
||||
}
|
||||
|
||||
void Render::toggleFlag(unsigned int flag) {
|
||||
_flags ^= flag;
|
||||
}
|
||||
|
||||
+3
-2
@@ -37,7 +37,8 @@ enum RENDER_FLAGS {
|
||||
RF_TEXT_TEST = 0x04,
|
||||
RF_OBJECTMAP_TEST = 0x08,
|
||||
RF_RENDERPAUSE = 0x10,
|
||||
RF_GAMEPAUSE = 0x20
|
||||
RF_GAMEPAUSE = 0x20,
|
||||
RF_PLACARD = 0x40
|
||||
};
|
||||
|
||||
struct BUFFER_INFO {
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
int drawScene(void);
|
||||
unsigned int getFlags(void);
|
||||
void setFlag(unsigned int);
|
||||
void clearFlag(unsigned int);
|
||||
void toggleFlag(unsigned int);
|
||||
unsigned int getFrameCount(void);
|
||||
unsigned int resetFrameCount(void);
|
||||
@@ -85,7 +87,6 @@ private:
|
||||
unsigned int _fps;
|
||||
unsigned int _framecount;
|
||||
unsigned int _flags;
|
||||
int _mode;
|
||||
};
|
||||
|
||||
} // End of namespace Saga
|
||||
|
||||
+49
-2
@@ -29,9 +29,11 @@
|
||||
#include "saga/actor.h"
|
||||
#include "saga/animation.h"
|
||||
#include "saga/console.h"
|
||||
#include "saga/font.h"
|
||||
#include "saga/interface.h"
|
||||
#include "saga/music.h"
|
||||
#include "saga/objectdata.h"
|
||||
#include "saga/render.h"
|
||||
#include "saga/sound.h"
|
||||
#include "saga/sndres.h"
|
||||
|
||||
@@ -920,13 +922,58 @@ int Script::SF_simulSpeech2(SCRIPTFUNC_PARAMS) {
|
||||
|
||||
// Script function #48 (0x30)
|
||||
int Script::SF_placard(SCRIPTFUNC_PARAMS) {
|
||||
debug(1, "stub: SF_placard()");
|
||||
GAME_DISPLAYINFO disp_info;
|
||||
SURFACE *back_buf = _vm->_gfx->getBackBuffer();
|
||||
PALENTRY cur_pal[PAL_ENTRIES];
|
||||
PALENTRY *pal;
|
||||
|
||||
_vm->getDisplayInfo(&disp_info);
|
||||
|
||||
_vm->_gfx->showCursor(false);
|
||||
_vm->_gfx->getCurrentPal(cur_pal);
|
||||
_vm->_gfx->palToBlackWait(back_buf, cur_pal, PALETTE_FADE_DURATION);
|
||||
|
||||
_vm->_interface->setStatusText("");
|
||||
|
||||
Rect rect(disp_info.logical_w, disp_info.scene_h);
|
||||
drawRect(back_buf, &rect, 138);
|
||||
|
||||
// TODO: Draw the text at the correct spot. This is (probably) just a
|
||||
// close approximation.
|
||||
_vm->textDraw(MEDIUM_FONT_ID, back_buf, getString(thread->pop()),
|
||||
disp_info.logical_w / 2, disp_info.scene_h / 2,
|
||||
_vm->_gfx->getWhite(), _vm->_gfx->getBlack(),
|
||||
FONT_OUTLINE | FONT_CENTERED);
|
||||
|
||||
_vm->_render->setFlag(RF_PLACARD);
|
||||
_vm->_render->drawScene();
|
||||
|
||||
_vm->_scene->getBGPal(&pal);
|
||||
_vm->_gfx->blackToPalWait(back_buf, pal, PALETTE_FADE_DURATION);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// Script function #49 (0x31)
|
||||
int Script::SF_placardOff(SCRIPTFUNC_PARAMS) {
|
||||
debug(1, "stub: SF_placardOff()");
|
||||
SURFACE *back_buf = _vm->_gfx->getBackBuffer();
|
||||
PALENTRY cur_pal[PAL_ENTRIES];
|
||||
PALENTRY *pal;
|
||||
|
||||
// Fade down
|
||||
_vm->_gfx->showCursor(false);
|
||||
_vm->_gfx->getCurrentPal(cur_pal);
|
||||
_vm->_gfx->palToBlackWait(back_buf, cur_pal, PALETTE_FADE_DURATION);
|
||||
|
||||
_vm->_render->clearFlag(RF_PLACARD);
|
||||
_vm->_render->drawScene();
|
||||
|
||||
// Fade up
|
||||
_vm->_scene->getBGPal(&pal);
|
||||
|
||||
_vm->_gfx->showCursor(true);
|
||||
_vm->_gfx->blackToPalWait(back_buf, pal, PALETTE_FADE_DURATION);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user