mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
TWINE: added debug commands to toggle the dark palette mode
This commit is contained in:
parent
41bb954435
commit
593b7d068d
@ -29,6 +29,7 @@
|
||||
#include "twine/resources/hqr.h"
|
||||
#include "twine/scene/gamestate.h"
|
||||
#include "twine/scene/scene.h"
|
||||
#include "twine/renderer/screens.h"
|
||||
#include "twine/text.h"
|
||||
#include "twine/twine.h"
|
||||
#include "twine/audio/music.h"
|
||||
@ -50,6 +51,7 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
|
||||
registerCmd("dumpfile", WRAP_METHOD(TwinEConsole, doDumpFile));
|
||||
registerCmd("list_menutext", WRAP_METHOD(TwinEConsole, doListMenuText));
|
||||
registerCmd("toggle_debug", WRAP_METHOD(TwinEConsole, doToggleDebug));
|
||||
registerCmd("toggle_darkpal", WRAP_METHOD(TwinEConsole, doToggleDarkPal));
|
||||
registerCmd("toggle_zones", WRAP_METHOD(TwinEConsole, doToggleZoneRendering));
|
||||
registerCmd("toggle_tracks", WRAP_METHOD(TwinEConsole, doToggleTrackRendering));
|
||||
registerCmd("toggle_godmode", WRAP_METHOD(TwinEConsole, doToggleGodMode));
|
||||
@ -303,6 +305,17 @@ bool TwinEConsole::doGiveKashes(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TwinEConsole::doToggleDarkPal(int argc, const char **argv) {
|
||||
if (_engine->_screens->_useAlternatePalette) {
|
||||
debugPrintf("Disabling dark palette\n");
|
||||
_engine->_screens->setNormalPal();
|
||||
} else {
|
||||
debugPrintf("Enabling dark palette\n");
|
||||
_engine->_screens->setDarkPal();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TwinEConsole::doToggleDebug(int argc, const char **argv) {
|
||||
if (_engine->_cfgfile.Debug) {
|
||||
debugPrintf("Disabling debug mode\n");
|
||||
|
@ -47,6 +47,7 @@ private:
|
||||
bool doChangeScene(int argc, const char **argv);
|
||||
bool doListMenuText(int argc, const char **argv);
|
||||
bool doToggleDebug(int argc, const char **argv);
|
||||
bool doToggleDarkPal(int argc, const char **argv);
|
||||
bool doToggleAutoAggressive(int argc, const char **argv);
|
||||
bool doGiveKey(int argc, const char **argv);
|
||||
bool doGiveGas(int argc, const char **argv);
|
||||
|
@ -217,6 +217,25 @@ void Screens::blackToWhite() {
|
||||
}
|
||||
}
|
||||
|
||||
void Screens::setDarkPal() {
|
||||
ScopedEngineFreeze scoped(_engine);
|
||||
HQR::getEntry(_palette, Resources::HQR_RESS_FILE, RESSHQR_DARKPAL);
|
||||
convertPalToRGBA(_palette, _paletteRGBA);
|
||||
if (!_fadePalette) {
|
||||
// set the palette hard if it should not get faded
|
||||
_engine->setPalette(_paletteRGBA);
|
||||
}
|
||||
_useAlternatePalette = true;
|
||||
}
|
||||
|
||||
void Screens::setNormalPal() {
|
||||
_useAlternatePalette = false;
|
||||
if (!_fadePalette) {
|
||||
// reset the palette hard if it should not get faded
|
||||
_engine->setPalette(_mainPaletteRGBA);
|
||||
}
|
||||
}
|
||||
|
||||
void Screens::setBackPal() {
|
||||
memset(_palette, 0, sizeof(_palette));
|
||||
memset(_paletteRGBA, 0, sizeof(_paletteRGBA));
|
||||
|
@ -73,6 +73,16 @@ public:
|
||||
|
||||
void convertPalToRGBA(const uint8 *in, uint32 *out);
|
||||
|
||||
/**
|
||||
* @sa setNormalPal
|
||||
*/
|
||||
void setDarkPal();
|
||||
/**
|
||||
* @sa setDarkPal()
|
||||
* Reset the palette to the main palette after the script changed it via @c setDarkPal()
|
||||
*/
|
||||
void setNormalPal();
|
||||
|
||||
/**
|
||||
* Load a custom palette
|
||||
* @param index \a RESS.HQR entry index (starting from 0)
|
||||
|
@ -1546,14 +1546,7 @@ static int32 lASK_CHOICE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
|
||||
* @note Opcode @c 0x5C
|
||||
*/
|
||||
static int32 lSET_DARK_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
|
||||
ScopedEngineFreeze scoped(engine);
|
||||
HQR::getEntry(engine->_screens->_palette, Resources::HQR_RESS_FILE, RESSHQR_DARKPAL);
|
||||
engine->_screens->convertPalToRGBA(engine->_screens->_palette, engine->_screens->_paletteRGBA);
|
||||
if (!engine->_screens->_fadePalette) {
|
||||
// set the palette hard if it should not get faded
|
||||
engine->setPalette(engine->_screens->_paletteRGBA);
|
||||
}
|
||||
engine->_screens->_useAlternatePalette = true;
|
||||
engine->_screens->setDarkPal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1562,11 +1555,7 @@ static int32 lSET_DARK_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
|
||||
* @note Opcode @c 0x5D
|
||||
*/
|
||||
static int32 lSET_NORMAL_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
|
||||
engine->_screens->_useAlternatePalette = false;
|
||||
if (!engine->_screens->_fadePalette) {
|
||||
// reset the palette hard if it should not get faded
|
||||
engine->setPalette(engine->_screens->_mainPaletteRGBA);
|
||||
}
|
||||
engine->_screens->setNormalPal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user