2012-04-30 09:27:12 +10:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM 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 program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2012-05-14 07:43:50 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on original Tony Tough source code
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997-2003 Nayma Software
|
|
|
|
*/
|
2012-04-30 09:27:12 +10:00
|
|
|
|
2012-04-30 23:16:19 +10:00
|
|
|
#include "common/file.h"
|
|
|
|
#include "common/savefile.h"
|
2012-05-03 01:36:08 +10:00
|
|
|
#include "common/textconsole.h"
|
2012-04-30 23:16:19 +10:00
|
|
|
#include "tony/mpal/lzo.h"
|
|
|
|
#include "tony/mpal/memory.h"
|
|
|
|
#include "tony/mpal/mpal.h"
|
|
|
|
#include "tony/mpal/mpalutils.h"
|
|
|
|
#include "tony/custom.h"
|
2012-04-30 09:27:12 +10:00
|
|
|
#include "tony/game.h"
|
2012-04-30 23:16:19 +10:00
|
|
|
#include "tony/gfxengine.h"
|
|
|
|
#include "tony/tony.h"
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
namespace Tony {
|
|
|
|
|
2012-04-30 23:16:19 +10:00
|
|
|
using namespace MPAL;
|
2012-04-30 09:27:12 +10:00
|
|
|
|
2012-04-30 23:16:19 +10:00
|
|
|
/****************************************/
|
2012-05-21 23:53:13 +02:00
|
|
|
/* Global functions */
|
2012-04-30 23:16:19 +10:00
|
|
|
/****************************************/
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
uint32 mainLoadLocation(int nLoc, RMPoint pt, RMPoint start) {
|
2012-06-05 01:04:53 +02:00
|
|
|
return _vm->getEngine()->loadLocation(nLoc, pt, start);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->unloadLocation(coroParam, bDoOnExit, result);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainLinkGraphicTask(RMGfxTask *task) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->linkGraphicTask(task);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainFreeze(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->freeze();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainUnfreeze(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->unfreeze();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainWaitFrame(CORO_PARAM) {
|
2012-06-04 23:45:36 +02:00
|
|
|
CoroScheduler.waitForSingleObject(coroParam, _vm->_hEndOfFrame, CORO_INFINITE);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainShowMouse(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->enableMouse();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainHideMouse(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->disableMouse();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int nSync) {
|
2012-06-04 23:45:36 +02:00
|
|
|
_vm->playMusic(nChannel, filename, nFX, bLoop, nSync);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainDisableInput(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->disableInput();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainEnableInput(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->enableInput();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainInitWipe(int type) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->initWipe(type);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainCloseWipe(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->closeWipe();
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainWaitWipeEnd(CORO_PARAM) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->waitWipeEnd(coroParam);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainEnableGUI(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->_bGUIInterface = true;
|
|
|
|
_vm->getEngine()->_bGUIInventory = true;
|
|
|
|
_vm->getEngine()->_bGUIOption = true;
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainDisableGUI(void) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->_bGUIInterface = false;
|
|
|
|
_vm->getEngine()->_bGUIInventory = false;
|
|
|
|
_vm->getEngine()->_bGUIOption = false;
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 01:15:25 +02:00
|
|
|
void mainSetPalesati(bool bPalesati) {
|
2012-06-05 01:04:53 +02:00
|
|
|
_vm->getEngine()->setPalesati(bPalesati);
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************\
|
2012-05-20 15:28:48 +10:00
|
|
|
* RMOptionButton Methods
|
2012-04-30 23:16:19 +10:00
|
|
|
\****************************************************************************/
|
|
|
|
|
|
|
|
RMOptionButton::RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState) {
|
|
|
|
RMResRaw raw(dwRes);
|
|
|
|
assert(raw.IsValid());
|
|
|
|
m_buf = new RMGfxSourceBuffer16(false);
|
2012-06-05 08:39:55 +02:00
|
|
|
m_buf->init(raw, raw.Width(), raw.Height());
|
2012-04-30 23:16:19 +10:00
|
|
|
|
|
|
|
m_rect.SetRect(pt.x, pt.y, pt.x + raw.Width() - 1, pt.y + raw.Height() - 1);
|
|
|
|
m_bActive = false;
|
|
|
|
m_bHasGfx = true;
|
|
|
|
m_bDoubleState = bDoubleState;
|
|
|
|
}
|
|
|
|
|
2012-05-13 00:43:02 +10:00
|
|
|
RMOptionButton::RMOptionButton(const RMRect &pt) {
|
2012-04-30 23:16:19 +10:00
|
|
|
m_rect = pt;
|
|
|
|
m_bActive = false;
|
|
|
|
m_bHasGfx = false;
|
|
|
|
m_bDoubleState = false;
|
2012-06-02 16:59:58 +10:00
|
|
|
m_buf = NULL;
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
RMOptionButton::~RMOptionButton() {
|
|
|
|
if (m_bHasGfx)
|
|
|
|
delete m_buf;
|
|
|
|
}
|
|
|
|
|
2012-05-13 00:43:02 +10:00
|
|
|
bool RMOptionButton::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) {
|
2012-04-30 23:16:19 +10:00
|
|
|
if (!m_bDoubleState) {
|
|
|
|
if (m_rect.PtInRect(mousePos)) {
|
|
|
|
if (!m_bActive) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_bActive = true;
|
2012-04-30 23:16:19 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (m_bActive) {
|
2012-05-13 00:43:02 +10:00
|
|
|
m_bActive = false;
|
2012-04-30 23:16:19 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2012-05-14 21:29:27 +02:00
|
|
|
if (bLeftClick && m_rect.PtInRect(mousePos)) {
|
2012-04-30 23:16:19 +10:00
|
|
|
m_bActive = !m_bActive;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
void RMOptionButton::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
CORO_BEGIN_CODE(_ctx);
|
2012-05-12 20:49:36 +10:00
|
|
|
|
2012-04-30 23:16:19 +10:00
|
|
|
if (!m_bActive)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (m_bHasGfx)
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_2(m_buf->draw, bigBuf, prim);
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMOptionButton::AddToList(RMGfxTargetBuffer &bigBuf) {
|
|
|
|
if (m_bHasGfx)
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this, m_rect));
|
2012-04-30 23:16:19 +10:00
|
|
|
}
|
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
/****************************************************************************\
|
2012-05-20 15:28:48 +10:00
|
|
|
* RMOptionSlide Methods
|
2012-05-03 01:36:08 +10:00
|
|
|
\****************************************************************************/
|
|
|
|
|
2012-05-13 00:43:02 +10:00
|
|
|
RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int slideSize) {
|
2012-05-03 01:36:08 +10:00
|
|
|
RMResRaw *raw;
|
|
|
|
|
|
|
|
m_pos = pt;
|
|
|
|
m_nSlideSize = slideSize;
|
|
|
|
m_nMax = nRange;
|
|
|
|
m_nStep = 100 / m_nMax;
|
|
|
|
m_nValue = nStartValue;
|
|
|
|
|
|
|
|
m_SliderCenter = NULL;
|
|
|
|
m_SliderLeft = NULL;
|
|
|
|
m_SliderRight = NULL;
|
|
|
|
m_SliderSingle = NULL;
|
|
|
|
|
|
|
|
// Sliders
|
|
|
|
INIT_GFX16_FROMRAW(20029, m_SliderCenter);
|
|
|
|
INIT_GFX16_FROMRAW(20030, m_SliderLeft);
|
|
|
|
INIT_GFX16_FROMRAW(20031, m_SliderRight);
|
|
|
|
INIT_GFX16_FROMRAW(20032, m_SliderSingle);
|
|
|
|
|
|
|
|
// Buttons
|
|
|
|
m_PushLeft = new RMOptionButton(RMRect(pt.x - 23, pt.y, pt.x - 23 + 22, pt.y + 26));
|
|
|
|
m_PushRight = new RMOptionButton(RMRect(pt.x + m_nSlideSize, pt.y, pt.x + m_nSlideSize + 5 + 22, pt.y + 26));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RMOptionSlide::~RMOptionSlide() {
|
|
|
|
delete m_SliderCenter;
|
|
|
|
m_SliderCenter = NULL;
|
|
|
|
delete m_SliderLeft;
|
|
|
|
m_SliderLeft = NULL;
|
|
|
|
delete m_SliderRight;
|
|
|
|
m_SliderRight = NULL;
|
|
|
|
delete m_SliderSingle;
|
|
|
|
m_SliderSingle = NULL;
|
|
|
|
|
|
|
|
delete m_PushLeft;
|
|
|
|
m_PushLeft = NULL;
|
|
|
|
delete m_PushRight;
|
|
|
|
m_PushRight = NULL;
|
|
|
|
}
|
|
|
|
|
2012-05-13 00:43:02 +10:00
|
|
|
bool RMOptionSlide::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) {
|
2012-05-03 01:36:08 +10:00
|
|
|
bool bRefresh = false;
|
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Do the button DoFrame's
|
2012-05-03 01:36:08 +10:00
|
|
|
m_PushLeft->DoFrame(mousePos, bLeftClick, bRightClick);
|
|
|
|
m_PushRight->DoFrame(mousePos, bLeftClick, bRightClick);
|
|
|
|
|
|
|
|
if (m_PushLeft->IsActive()) {
|
|
|
|
if (bLeftClick) {
|
|
|
|
bRefresh = true;
|
|
|
|
m_nValue--;
|
|
|
|
} else if (bRightClick) {
|
|
|
|
bRefresh = true;
|
|
|
|
m_nValue -= 3;
|
|
|
|
}
|
|
|
|
if (m_nValue < 1)
|
|
|
|
m_nValue = 1;
|
|
|
|
} else if (m_PushRight->IsActive()) {
|
|
|
|
bRefresh = true;
|
|
|
|
|
|
|
|
if (bLeftClick) {
|
|
|
|
bRefresh = true;
|
|
|
|
m_nValue++;
|
|
|
|
} else if (bRightClick) {
|
|
|
|
bRefresh = true;
|
|
|
|
m_nValue += 3;
|
|
|
|
}
|
|
|
|
if (m_nValue > m_nMax)
|
|
|
|
m_nValue = m_nMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRefresh;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
void RMOptionSlide::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
int i;
|
|
|
|
int val;
|
|
|
|
RMPoint pos;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
|
|
|
_ctx->pos = m_pos;
|
|
|
|
_ctx->pos.x += 4;
|
|
|
|
_ctx->pos.y += 4;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->val = m_nValue * m_nStep;
|
|
|
|
if (_ctx->val < 1) _ctx->val = 1;
|
|
|
|
else if (_ctx->val > 100) _ctx->val = 100;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
if (_ctx->val == 1) {
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setDst(_ctx->pos);
|
|
|
|
CORO_INVOKE_2(m_SliderSingle->draw, bigBuf, prim);
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setDst(_ctx->pos);
|
|
|
|
CORO_INVOKE_2(m_SliderLeft->draw, bigBuf, prim);
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->pos.x += 3;
|
|
|
|
|
|
|
|
for (_ctx->i = 1; _ctx->i < _ctx->val - 1; _ctx->i++) {
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setDst(_ctx->pos);
|
|
|
|
CORO_INVOKE_2(m_SliderCenter->draw, bigBuf, prim);
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->pos.x += 3;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setDst(_ctx->pos);
|
|
|
|
CORO_INVOKE_2(m_SliderRight->draw, bigBuf, prim);
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->pos.x += 3;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMOptionSlide::AddToList(RMGfxTargetBuffer &bigBuf) {
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************\
|
2012-05-20 15:28:48 +10:00
|
|
|
* RMOptionScreen Methods
|
2012-05-03 01:36:08 +10:00
|
|
|
\****************************************************************************/
|
|
|
|
|
|
|
|
RMOptionScreen::RMOptionScreen(void) {
|
2012-06-02 16:59:58 +10:00
|
|
|
m_nState = MENUNONE;
|
2012-05-03 01:36:08 +10:00
|
|
|
m_menu = NULL;
|
|
|
|
m_HideLoadSave = NULL;
|
|
|
|
m_QuitConfirm = NULL;
|
2012-05-12 21:54:37 +10:00
|
|
|
m_bQuitConfirm = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
Create(RM_SX, RM_SY);
|
|
|
|
|
|
|
|
m_ButtonExit = NULL;
|
|
|
|
m_ButtonLoad = NULL;
|
|
|
|
m_ButtonSave = NULL;
|
|
|
|
m_ButtonGameMenu = NULL;
|
|
|
|
m_ButtonGfxMenu = NULL;
|
|
|
|
m_ButtonSoundMenu = NULL;
|
|
|
|
m_ButtonSave_ArrowLeft = NULL;
|
|
|
|
m_ButtonSave_ArrowRight = NULL;
|
|
|
|
m_bEditSaveName = false;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++) {
|
|
|
|
m_curThumb[i] = NULL;
|
|
|
|
m_ButtonSave_States[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_statePos = 0;
|
2012-05-12 20:49:36 +10:00
|
|
|
m_ButtonQuitYes = NULL;
|
|
|
|
m_ButtonQuitNo = NULL;
|
|
|
|
m_ButtonQuit = NULL;
|
|
|
|
m_SaveEasy = NULL;
|
|
|
|
m_SaveHard = NULL;
|
|
|
|
m_ButtonGfx_Tips = NULL;
|
|
|
|
m_ButtonSound_DubbingOn = NULL;
|
|
|
|
m_ButtonSound_MusicOn = NULL;
|
|
|
|
m_ButtonSound_SFXOn = NULL;
|
|
|
|
m_SlideTonySpeed = NULL;
|
|
|
|
m_SlideTextSpeed = NULL;
|
|
|
|
m_ButtonGame_Lock = NULL;
|
|
|
|
m_ButtonGfx_Anni30 = NULL;
|
|
|
|
m_SliderSound_Music = NULL;
|
|
|
|
m_ButtonGame_TimerizedText = NULL;
|
|
|
|
m_ButtonGfx_AntiAlias = NULL;
|
|
|
|
m_SliderSound_SFX = NULL;
|
|
|
|
m_ButtonGame_Scrolling = NULL;
|
|
|
|
m_ButtonGfx_Sottotitoli = NULL;
|
|
|
|
m_SliderSound_Dubbing = NULL;
|
|
|
|
m_ButtonGame_InterUp = NULL;
|
|
|
|
m_ButtonGfx_Trans = NULL;
|
|
|
|
|
|
|
|
m_FadeStep = 0;
|
|
|
|
m_FadeY = 0;
|
|
|
|
m_FadeTime = 0;
|
|
|
|
m_nEditPos = 0;
|
|
|
|
m_nLastState = MENUGAME;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
RMOptionScreen::~RMOptionScreen(void) {
|
2012-06-02 16:59:58 +10:00
|
|
|
CloseState();
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::RefreshAll(CORO_PARAM) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
RMGfxSourceBuffer16 *thumb;
|
|
|
|
RMText *title;
|
|
|
|
RMText *num[6];
|
|
|
|
int i;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
2012-06-05 08:39:55 +02:00
|
|
|
clearOT();
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_menu));
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_bNoLoadSave)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_HideLoadSave, RMPoint(0, 401)));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-03 23:08:19 +10:00
|
|
|
if (m_bQuitConfirm) {
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_QuitConfirm, RMPoint(270, 200)));
|
2012-05-03 01:36:08 +10:00
|
|
|
m_ButtonQuitYes->AddToList(*this);
|
|
|
|
m_ButtonQuitNo->AddToList(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ButtonExit->AddToList(*this);
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
|
|
|
|
m_ButtonQuit->AddToList(*this);
|
|
|
|
m_ButtonLoad->AddToList(*this);
|
|
|
|
m_ButtonSave->AddToList(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME) {
|
|
|
|
m_ButtonGame_Lock->AddToList(*this);
|
|
|
|
m_ButtonGame_TimerizedText->AddToList(*this);
|
|
|
|
m_ButtonGame_Scrolling->AddToList(*this);
|
|
|
|
m_ButtonGame_InterUp->AddToList(*this);
|
|
|
|
m_SlideTextSpeed->AddToList(*this);
|
|
|
|
m_SlideTonySpeed->AddToList(*this);
|
|
|
|
} else if (m_nState == MENUGFX) {
|
|
|
|
m_ButtonGfx_Anni30->AddToList(*this);
|
|
|
|
m_ButtonGfx_AntiAlias->AddToList(*this);
|
|
|
|
m_ButtonGfx_Sottotitoli->AddToList(*this);
|
|
|
|
m_ButtonGfx_Trans->AddToList(*this);
|
|
|
|
m_ButtonGfx_Tips->AddToList(*this);
|
|
|
|
} else if (m_nState == MENUSOUND) {
|
|
|
|
m_SliderSound_Dubbing->AddToList(*this);
|
|
|
|
m_SliderSound_Music->AddToList(*this);
|
|
|
|
m_SliderSound_SFX->AddToList(*this);
|
|
|
|
m_ButtonSound_DubbingOn->AddToList(*this);
|
|
|
|
m_ButtonSound_MusicOn->AddToList(*this);
|
|
|
|
m_ButtonSound_SFXOn->AddToList(*this);
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->thumb = NULL;
|
|
|
|
_ctx->title = NULL;
|
|
|
|
Common::fill(&_ctx->num[0], &_ctx->num[6], (RMText *)NULL);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->title = new RMText;
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_nState == MENULOAD) {
|
|
|
|
RMMessage msg(10);
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->title->WriteText(msg[0], 1);
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
|
|
|
RMMessage msg(11);
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->title->WriteText(msg[0], 1);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->title, RMPoint(320, 10)));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[0] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(48, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[0] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(48, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[1] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(240, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[1] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(240, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[2] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(432, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[2] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(432, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[3] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(48, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[3] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(48, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[4] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(240, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[4] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(240, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumbDiff[5] == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(432, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
else if (m_curThumbDiff[5] == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(432, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
|
|
|
|
if (m_curThumb[0] && !(m_bEditSaveName && m_nEditPos == 0))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[0], RMPoint(48, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumb[1] && !(m_bEditSaveName && m_nEditPos == 1))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[1], RMPoint(240, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumb[2] && !(m_bEditSaveName && m_nEditPos == 2))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[2], RMPoint(432, 57)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumb[3] && !(m_bEditSaveName && m_nEditPos == 3))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[3], RMPoint(48, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumb[4] && !(m_bEditSaveName && m_nEditPos == 4))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[4], RMPoint(240, 239)));
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_curThumb[5] && !(m_bEditSaveName && m_nEditPos == 5))
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(m_curThumb[5], RMPoint(432, 239)));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_bEditSaveName) {
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->thumb = new RMGfxSourceBuffer16;
|
2012-06-05 08:39:55 +02:00
|
|
|
_ctx->thumb->init((byte *)_vm->getThumbnail(), 640 / 4, 480 / 4);
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
if (m_nEditPos == 0)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 57)));
|
2012-05-12 20:49:36 +10:00
|
|
|
else if (m_nEditPos == 1)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 57)));
|
2012-05-12 20:49:36 +10:00
|
|
|
else if (m_nEditPos == 2)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 57)));
|
2012-05-12 20:49:36 +10:00
|
|
|
else if (m_nEditPos == 3)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 239)));
|
2012-05-12 20:49:36 +10:00
|
|
|
else if (m_nEditPos == 4)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 239)));
|
2012-05-12 20:49:36 +10:00
|
|
|
else if (m_nEditPos == 5)
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 239)));
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++) {
|
2012-05-03 01:36:08 +10:00
|
|
|
RMString s;
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
if (m_bEditSaveName && m_nEditPos == _ctx->i)
|
|
|
|
s.Format("%02d)%s*", m_statePos + _ctx->i, m_EditName);
|
2012-05-03 01:36:08 +10:00
|
|
|
else {
|
2012-05-12 20:49:36 +10:00
|
|
|
if (m_statePos == 0 && _ctx->i == 0)
|
2012-05-03 01:36:08 +10:00
|
|
|
s.Format("Autosave");
|
|
|
|
else
|
2012-05-12 20:49:36 +10:00
|
|
|
s.Format("%02d)%s", m_statePos + _ctx->i, (const char *)m_curThumbName[_ctx->i]);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->num[_ctx->i] = new RMText;
|
|
|
|
_ctx->num[_ctx->i]->SetAlignType(RMText::HLEFT, RMText::VTOP);
|
|
|
|
_ctx->num[_ctx->i]->WriteText(s, 2);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[0], RMPoint(55 - 3, 180 + 14)));
|
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[1], RMPoint(247 - 3, 180 + 14)));
|
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[2], RMPoint(439 - 3, 180 + 14)));
|
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[3], RMPoint(55 - 3, 362 + 14)));
|
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[4], RMPoint(247 - 3, 362 + 14)));
|
|
|
|
addPrim(new RMGfxPrimitive(_ctx->num[5], RMPoint(439 - 3, 362 + 14)));
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
m_ButtonSave_ArrowLeft->AddToList(*this);
|
|
|
|
m_ButtonSave_ArrowRight->AddToList(*this);
|
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_0(drawOT);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
2012-05-12 20:49:36 +10:00
|
|
|
if (_ctx->thumb) delete _ctx->thumb;
|
|
|
|
if (_ctx->title) delete _ctx->title;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
|
|
|
|
if (_ctx->num[_ctx->i]) delete _ctx->num[_ctx->i];
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMOptionScreen::RefreshThumbnails(void) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++) {
|
|
|
|
if (m_curThumb[i])
|
|
|
|
delete m_curThumb[i];
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
m_curThumb[i] = new RMGfxSourceBuffer16;
|
|
|
|
m_curThumb[i]->Create(640 / 4, 480 / 4);
|
|
|
|
if (!LoadThumbnailFromSaveState(m_statePos + i, *m_curThumb[i], m_curThumbName[i], m_curThumbDiff[i])) {
|
|
|
|
delete m_curThumb[i];
|
|
|
|
m_curThumb[i] = NULL;
|
|
|
|
m_curThumbName[i] = "";
|
|
|
|
m_curThumbDiff[i] = 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::InitState(CORO_PARAM) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
RMResRaw *raw;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND)
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->raw = new RMResRaw(20000 + m_nState);
|
2012-05-03 01:36:08 +10:00
|
|
|
else if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
|
|
|
if (m_bAlterGfx)
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->raw = new RMResRaw(20024);
|
2012-05-03 01:36:08 +10:00
|
|
|
else
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->raw = new RMResRaw(20003);
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
|
|
|
error("Invalid state");
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
assert(_ctx->raw->IsValid());
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_menu == NULL);
|
|
|
|
m_menu = new RMGfxSourceBuffer16(false);
|
2012-06-05 08:39:55 +02:00
|
|
|
m_menu->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
|
2012-05-12 20:49:36 +10:00
|
|
|
delete _ctx->raw;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
|
|
|
if (m_bAlterGfx) {
|
|
|
|
assert(m_ButtonExit == NULL);
|
|
|
|
m_ButtonExit = new RMOptionButton(20025, RMPoint(561, 406));
|
2012-05-03 23:08:19 +10:00
|
|
|
} else {
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonExit == NULL);
|
|
|
|
m_ButtonExit = new RMOptionButton(20012, RMPoint(560, 404));
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
INIT_GFX8_FROMRAW(_ctx->raw, 20036, m_SaveEasy);
|
|
|
|
INIT_GFX8_FROMRAW(_ctx->raw, 20037, m_SaveHard);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
RefreshThumbnails();
|
|
|
|
|
|
|
|
assert(m_ButtonSave_States[0] == NULL);
|
|
|
|
m_ButtonSave_States[0] = new RMOptionButton(RMRect(48, 57, 48 + 160, 57 + 120));
|
|
|
|
assert(m_ButtonSave_States[1] == NULL);
|
|
|
|
m_ButtonSave_States[1] = new RMOptionButton(RMRect(240, 57, 240 + 160, 57 + 120));
|
|
|
|
assert(m_ButtonSave_States[2] == NULL);
|
|
|
|
m_ButtonSave_States[2] = new RMOptionButton(RMRect(432, 57, 432 + 160, 57 + 120));
|
|
|
|
assert(m_ButtonSave_States[3] == NULL);
|
|
|
|
m_ButtonSave_States[3] = new RMOptionButton(RMRect(48, 239, 48 + 160, 239 + 120));
|
|
|
|
assert(m_ButtonSave_States[4] == NULL);
|
|
|
|
m_ButtonSave_States[4] = new RMOptionButton(RMRect(240, 239, 240 + 160, 239 + 120));
|
|
|
|
assert(m_ButtonSave_States[5] == NULL);
|
|
|
|
m_ButtonSave_States[5] = new RMOptionButton(RMRect(432, 239, 432 + 160, 239 + 120));
|
|
|
|
|
|
|
|
if (m_bAlterGfx) {
|
|
|
|
assert(m_ButtonSave_ArrowLeft == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonSave_ArrowLeft = new RMOptionButton(20026, RMPoint(3, 196));
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonSave_ArrowRight == NULL);
|
|
|
|
m_ButtonSave_ArrowRight = new RMOptionButton(20027, RMPoint(601, 197));
|
|
|
|
} else {
|
|
|
|
assert(m_ButtonSave_ArrowLeft == NULL);
|
|
|
|
m_ButtonSave_ArrowLeft = new RMOptionButton(20013, RMPoint(0, 197));
|
|
|
|
assert(m_ButtonSave_ArrowRight == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonSave_ArrowRight = new RMOptionButton(20014, RMPoint(601, 197));
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
} else if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
|
|
|
|
assert(m_ButtonExit == NULL);
|
|
|
|
m_ButtonExit = new RMOptionButton(20005, RMPoint(560, 405));
|
|
|
|
assert(m_ButtonQuit == NULL);
|
|
|
|
m_ButtonQuit = new RMOptionButton(20020, RMPoint(7, 408));
|
|
|
|
assert(m_ButtonLoad == NULL);
|
|
|
|
m_ButtonLoad = new RMOptionButton(20006, RMPoint(231, 401));
|
|
|
|
assert(m_ButtonSave == NULL);
|
|
|
|
m_ButtonSave = new RMOptionButton(20007, RMPoint(325, 401));
|
|
|
|
|
|
|
|
assert(m_ButtonGameMenu == NULL);
|
|
|
|
m_ButtonGameMenu = new RMOptionButton(RMRect(24, 32, 118, 64));
|
|
|
|
assert(m_ButtonGfxMenu == NULL);
|
|
|
|
m_ButtonGfxMenu = new RMOptionButton(RMRect(118, 32, 212, 64));
|
|
|
|
assert(m_ButtonSoundMenu == NULL);
|
|
|
|
m_ButtonSoundMenu = new RMOptionButton(RMRect(212, 32, 306, 64));
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->raw = new RMResRaw(20021);
|
|
|
|
assert(_ctx->raw->IsValid());
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_QuitConfirm == NULL);
|
|
|
|
m_QuitConfirm = new RMGfxSourceBuffer16(false);
|
2012-06-05 08:39:55 +02:00
|
|
|
m_QuitConfirm->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
|
2012-05-12 20:49:36 +10:00
|
|
|
delete _ctx->raw;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
assert(m_ButtonQuitYes == NULL);
|
|
|
|
m_ButtonQuitYes = new RMOptionButton(20022, RMPoint(281, 265));
|
2012-06-05 08:39:55 +02:00
|
|
|
m_ButtonQuitYes->setPriority(30);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonQuitNo == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonQuitNo = new RMOptionButton(20023, RMPoint(337, 264));
|
2012-06-05 08:39:55 +02:00
|
|
|
m_ButtonQuitNo->setPriority(30);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_bNoLoadSave) {
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->raw = new RMResRaw(20028);
|
|
|
|
assert(_ctx->raw->IsValid());
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_HideLoadSave == NULL);
|
|
|
|
m_HideLoadSave = new RMGfxSourceBuffer16(false);
|
2012-06-05 08:39:55 +02:00
|
|
|
m_HideLoadSave->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
|
2012-05-12 20:49:36 +10:00
|
|
|
delete _ctx->raw;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
// Menu GAME
|
|
|
|
if (m_nState == MENUGAME) {
|
|
|
|
assert(m_ButtonGame_Lock == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGame_Lock = new RMOptionButton(20008, RMPoint(176, 262), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGame_Lock->SetActiveState(GLOBALS.bCfgInvLocked);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGame_TimerizedText == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGame_TimerizedText = new RMOptionButton(20009, RMPoint(463, 273), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGame_TimerizedText->SetActiveState(!GLOBALS.bCfgTimerizedText);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGame_Scrolling == NULL);
|
|
|
|
m_ButtonGame_Scrolling = new RMOptionButton(20010, RMPoint(315, 263), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGame_Scrolling->SetActiveState(GLOBALS.bCfgInvNoScroll);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGame_InterUp == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGame_InterUp = new RMOptionButton(20011, RMPoint(36, 258), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGame_InterUp->SetActiveState(GLOBALS.bCfgInvUp);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
assert(m_SlideTextSpeed == NULL);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_SlideTextSpeed = new RMOptionSlide(RMPoint(165, 122), 10, GLOBALS.nCfgTextSpeed);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_SlideTonySpeed == NULL);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_SlideTonySpeed = new RMOptionSlide(RMPoint(165, 226), 5, GLOBALS.nCfgTonySpeed);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
// Menu Graphics
|
|
|
|
else if (m_nState == MENUGFX) {
|
|
|
|
assert(m_ButtonGfx_Anni30 == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGfx_Anni30 = new RMOptionButton(20015, RMPoint(247, 178), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGfx_Anni30->SetActiveState(GLOBALS.bCfgAnni30);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGfx_AntiAlias == NULL);
|
|
|
|
m_ButtonGfx_AntiAlias = new RMOptionButton(20016, RMPoint(430, 83), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGfx_AntiAlias->SetActiveState(!GLOBALS.bCfgAntiAlias);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGfx_Sottotitoli == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGfx_Sottotitoli = new RMOptionButton(20017, RMPoint(98, 82), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGfx_Sottotitoli->SetActiveState(!GLOBALS.bCfgSottotitoli);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGfx_Tips == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGfx_Tips = new RMOptionButton(20018, RMPoint(431, 246), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGfx_Tips->SetActiveState(GLOBALS.bCfgInterTips);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonGfx_Trans == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonGfx_Trans = new RMOptionButton(20019, RMPoint(126, 271), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonGfx_Trans->SetActiveState(!GLOBALS.bCfgTransparence);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
} else if (m_nState == MENUSOUND) {
|
|
|
|
assert(m_SliderSound_Dubbing == NULL);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_SliderSound_Dubbing = new RMOptionSlide(RMPoint(165, 122), 10, GLOBALS.nCfgDubbingVolume);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_SliderSound_Music == NULL);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_SliderSound_Music = new RMOptionSlide(RMPoint(165, 226), 10, GLOBALS.nCfgMusicVolume);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_SliderSound_SFX == NULL);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_SliderSound_SFX = new RMOptionSlide(RMPoint(165, 330), 10, GLOBALS.nCfgSFXVolume);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
assert(m_ButtonSound_DubbingOn == NULL);
|
|
|
|
m_ButtonSound_DubbingOn = new RMOptionButton(20033, RMPoint(339, 75), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonSound_DubbingOn->SetActiveState(GLOBALS.bCfgDubbing);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonSound_MusicOn == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonSound_MusicOn = new RMOptionButton(20034, RMPoint(338, 179), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonSound_MusicOn->SetActiveState(GLOBALS.bCfgMusic);
|
2012-05-03 01:36:08 +10:00
|
|
|
assert(m_ButtonSound_SFXOn == NULL);
|
2012-05-14 21:29:27 +02:00
|
|
|
m_ButtonSound_SFXOn = new RMOptionButton(20035, RMPoint(338, 283), true);
|
2012-05-13 22:34:40 +10:00
|
|
|
m_ButtonSound_SFXOn->SetActiveState(GLOBALS.bCfgSFX);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(RefreshAll);
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMOptionScreen::CloseState(void) {
|
|
|
|
delete m_menu;
|
|
|
|
m_menu = NULL;
|
|
|
|
|
|
|
|
delete m_ButtonExit;
|
2012-05-12 19:40:33 +02:00
|
|
|
m_ButtonExit = NULL;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++) {
|
|
|
|
if (m_curThumb[i] != NULL) {
|
|
|
|
delete m_curThumb[i];
|
|
|
|
m_curThumb[i] = NULL;
|
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonSave_States[i];
|
|
|
|
m_ButtonSave_States[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete m_ButtonSave_ArrowLeft;
|
|
|
|
m_ButtonSave_ArrowLeft = NULL;
|
|
|
|
delete m_ButtonSave_ArrowRight;
|
|
|
|
m_ButtonSave_ArrowRight = NULL;
|
|
|
|
|
|
|
|
delete m_SaveEasy;
|
|
|
|
m_SaveEasy = NULL;
|
|
|
|
delete m_SaveHard;
|
|
|
|
m_SaveHard = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
|
|
|
|
delete m_ButtonQuit;
|
|
|
|
m_ButtonQuit = NULL;
|
|
|
|
delete m_ButtonLoad;
|
|
|
|
m_ButtonLoad = NULL;
|
|
|
|
delete m_ButtonSave;
|
|
|
|
m_ButtonSave = NULL;
|
|
|
|
delete m_ButtonGameMenu;
|
|
|
|
m_ButtonGameMenu = NULL;
|
|
|
|
delete m_ButtonGfxMenu;
|
|
|
|
m_ButtonGfxMenu = NULL;
|
|
|
|
delete m_ButtonSoundMenu;
|
|
|
|
m_ButtonSoundMenu = NULL;
|
|
|
|
delete m_QuitConfirm;
|
|
|
|
m_QuitConfirm = NULL;
|
|
|
|
delete m_ButtonQuitYes;
|
|
|
|
m_ButtonQuitYes = NULL;
|
|
|
|
delete m_ButtonQuitNo;
|
|
|
|
m_ButtonQuitNo = NULL;
|
|
|
|
|
|
|
|
if (m_bNoLoadSave) {
|
|
|
|
delete m_HideLoadSave;
|
|
|
|
m_HideLoadSave = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME) {
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgInvLocked = m_ButtonGame_Lock->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGame_Lock;
|
|
|
|
m_ButtonGame_Lock = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgTimerizedText = !m_ButtonGame_TimerizedText->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGame_TimerizedText;
|
|
|
|
m_ButtonGame_TimerizedText = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgInvNoScroll = m_ButtonGame_Scrolling->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGame_Scrolling;
|
|
|
|
m_ButtonGame_Scrolling = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgInvUp = m_ButtonGame_InterUp->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGame_InterUp;
|
|
|
|
m_ButtonGame_InterUp = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.nCfgTextSpeed = m_SlideTextSpeed->GetValue();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_SlideTextSpeed;
|
|
|
|
m_SlideTextSpeed = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.nCfgTonySpeed = m_SlideTonySpeed->GetValue();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_SlideTonySpeed;
|
|
|
|
m_SlideTonySpeed = NULL;
|
|
|
|
} else if (m_nState == MENUGFX) {
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAnni30 = m_ButtonGfx_Anni30->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGfx_Anni30;
|
|
|
|
m_ButtonGfx_Anni30 = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAntiAlias = !m_ButtonGfx_AntiAlias->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGfx_AntiAlias;
|
|
|
|
m_ButtonGfx_AntiAlias = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgSottotitoli = !m_ButtonGfx_Sottotitoli->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGfx_Sottotitoli;
|
|
|
|
m_ButtonGfx_Sottotitoli = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgInterTips = m_ButtonGfx_Tips->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGfx_Tips;
|
|
|
|
m_ButtonGfx_Tips = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgTransparence = !m_ButtonGfx_Trans->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonGfx_Trans;
|
|
|
|
m_ButtonGfx_Trans = NULL;
|
|
|
|
} else if (m_nState == MENUSOUND) {
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.nCfgDubbingVolume = m_SliderSound_Dubbing->GetValue();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_SliderSound_Dubbing;
|
|
|
|
m_SliderSound_Dubbing = NULL;
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.nCfgMusicVolume = m_SliderSound_Music->GetValue();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_SliderSound_Music;
|
|
|
|
m_SliderSound_Music = NULL;
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.nCfgSFXVolume = m_SliderSound_SFX->GetValue();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_SliderSound_SFX;
|
|
|
|
m_SliderSound_SFX = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgDubbing = m_ButtonSound_DubbingOn->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonSound_DubbingOn;
|
|
|
|
m_ButtonSound_DubbingOn = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgMusic = m_ButtonSound_MusicOn->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonSound_MusicOn;
|
|
|
|
m_ButtonSound_MusicOn = NULL;
|
|
|
|
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgSFX = m_ButtonSound_SFXOn->IsActive();
|
2012-05-03 01:36:08 +10:00
|
|
|
delete m_ButtonSound_SFXOn;
|
|
|
|
m_ButtonSound_SFXOn = NULL;
|
|
|
|
}
|
|
|
|
}
|
2012-06-02 16:59:58 +10:00
|
|
|
|
|
|
|
m_nState = MENUNONE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMOptionScreen::ReInit(RMGfxTargetBuffer &bigBuf) {
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::Init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
|
|
|
if (m_FadeStep != 0) {
|
|
|
|
result = false;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_FadeStep = 1;
|
|
|
|
m_FadeY = -20;
|
|
|
|
m_FadeTime = -1;
|
|
|
|
m_bExit = false;
|
|
|
|
m_bLoadMenuOnly = false;
|
|
|
|
m_bNoLoadSave = false;
|
|
|
|
m_bAlterGfx = false;
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE)
|
|
|
|
m_nState = MENUGAME;
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
CORO_INVOKE_0(InitState);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::InitLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
|
|
|
if (m_FadeStep != 0) {
|
|
|
|
result = false;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_FadeStep = 1;
|
|
|
|
m_FadeY = -20;
|
|
|
|
m_FadeTime = -1;
|
|
|
|
m_bExit = false;
|
|
|
|
m_bLoadMenuOnly = true;
|
|
|
|
m_bNoLoadSave = false;
|
|
|
|
m_bAlterGfx = bAlternateGfx;
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_nState = MENULOAD;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(InitState);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::InitSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
if (m_FadeStep != 0) {
|
|
|
|
result = false;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_FadeStep = 1;
|
|
|
|
m_FadeY = -20;
|
|
|
|
m_FadeTime = -1;
|
|
|
|
m_bExit = false;
|
|
|
|
m_bLoadMenuOnly = true;
|
|
|
|
m_bNoLoadSave = false;
|
|
|
|
m_bAlterGfx = bAlternateGfx;
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_nState = MENUSAVE;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(InitState);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::InitNoLoadSave(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
|
|
|
if (m_FadeStep != 0) {
|
|
|
|
result = false;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_FadeStep = 1;
|
|
|
|
m_FadeY = -20;
|
|
|
|
m_FadeTime = -1;
|
|
|
|
m_bExit = false;
|
|
|
|
m_bLoadMenuOnly = false;
|
|
|
|
m_bNoLoadSave = true;
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf.addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
m_nState = MENUGAME;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(InitState);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
bool RMOptionScreen::Close(void) {
|
|
|
|
if (m_FadeStep != 6)
|
|
|
|
return false;
|
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Start fade out
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeStep++;
|
2012-06-04 23:45:36 +02:00
|
|
|
m_FadeTime = _vm->getTime();
|
2012-05-03 01:36:08 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RMOptionScreen::IsClosing(void) {
|
|
|
|
return m_bExit;
|
|
|
|
}
|
|
|
|
|
2012-06-05 18:51:20 +02:00
|
|
|
int RMOptionScreen::priority() {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Just below the mouse
|
2012-05-03 01:36:08 +10:00
|
|
|
return 190;
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
void RMOptionScreen::ChangeState(CORO_PARAM, STATE newState) {
|
|
|
|
CORO_BEGIN_CONTEXT;
|
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
CloseState();
|
|
|
|
m_nLastState = m_nState;
|
|
|
|
m_nState = newState;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(InitState);
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
|
2012-05-09 23:15:41 +10:00
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
bool bLeftClick, bRightClick;
|
|
|
|
RMPoint mousePos;
|
|
|
|
bool bRefresh;
|
|
|
|
int i;
|
2012-05-09 23:15:41 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// If it is fully open, do nothing
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_FadeStep != 6)
|
|
|
|
return;
|
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Reads input
|
2012-06-05 00:02:15 +02:00
|
|
|
_ctx->mousePos = input->mousePos();
|
|
|
|
_ctx->bLeftClick = input->mouseLeftClicked();
|
|
|
|
_ctx->bRightClick = input->mouseRightClicked();
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_bQuitConfirm) {
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonQuitYes->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonQuitNo->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonExit->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Check if you have clicked on the output
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Buttons without graphics...
|
2012-05-09 23:15:41 +10:00
|
|
|
m_ButtonGameMenu->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
m_ButtonGfxMenu->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
m_ButtonSoundMenu->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Buttons with graphics
|
2012-05-03 23:08:19 +10:00
|
|
|
if (!m_bNoLoadSave) {
|
|
|
|
if (!_vm->getIsDemo()) {
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonLoad->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonSave->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 23:08:19 +10:00
|
|
|
}
|
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonQuit->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
if (m_nState == MENUGAME) {
|
|
|
|
_ctx->bRefresh |= m_ButtonGame_Lock->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGame_TimerizedText->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGame_Scrolling->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGame_InterUp->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_SlideTextSpeed->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_SlideTonySpeed->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
|
|
|
|
} else if (m_nState == MENUGFX) {
|
|
|
|
_ctx->bRefresh |= m_ButtonGfx_Anni30->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGfx_AntiAlias->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGfx_Sottotitoli->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGfx_Tips->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonGfx_Trans->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
|
|
|
|
} else if (m_nState == MENUSOUND) {
|
|
|
|
_ctx->bRefresh |= m_SliderSound_Dubbing->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_SliderSound_Music->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_SliderSound_SFX->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonSound_DubbingOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonSound_MusicOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
_ctx->bRefresh |= m_ButtonSound_SFXOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
} else if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
2012-05-14 21:29:27 +02:00
|
|
|
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
|
2012-05-09 23:15:41 +10:00
|
|
|
m_ButtonSave_States[_ctx->i]->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_statePos > 0)
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonSave_ArrowLeft->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_statePos < 90)
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh |= m_ButtonSave_ArrowRight->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
|
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-06-05 01:04:53 +02:00
|
|
|
#define KEYPRESS(c) (_vm->getEngine()->getInput().getAsyncKeyState(c))
|
2012-05-03 01:36:08 +10:00
|
|
|
#define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \
|
2012-06-05 01:04:53 +02:00
|
|
|
m_EditName[strlen(m_EditName) + 1] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; }
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
/**************** State Buttons **************/
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_bEditSaveName) {
|
|
|
|
if (KEYPRESS(Common::KEYCODE_BACKSPACE)) {
|
|
|
|
if (m_EditName[0] != '\0') {
|
|
|
|
m_EditName[strlen(m_EditName) - 1] = '\0';
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
for (_ctx->i = 0; _ctx->i < 26 && strlen(m_EditName) < 12; _ctx->i++)
|
2012-05-12 20:49:36 +10:00
|
|
|
if (KEYPRESS(Common::KEYCODE_LSHIFT) ||
|
2012-05-14 21:29:27 +02:00
|
|
|
KEYPRESS(Common::KEYCODE_RSHIFT)) {
|
2012-05-09 23:15:41 +10:00
|
|
|
PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'A');
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
2012-05-09 23:15:41 +10:00
|
|
|
PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'a');
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
for (_ctx->i = 0; _ctx->i < 10 && strlen(m_EditName) < 12; _ctx->i++)
|
|
|
|
PROCESS_CHAR((Common::KeyCode)((int)'0' + _ctx->i), _ctx->i + '0');
|
2012-05-14 21:29:27 +02:00
|
|
|
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_SPACE, ' ');
|
|
|
|
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP0, '0');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP1, '1');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP2, '2');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP3, '3');
|
2012-05-03 01:36:08 +10:00
|
|
|
if (strlen(m_EditName) < 12)
|
2012-05-14 21:29:27 +02:00
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP4, '4');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP5, '5');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP6, '6');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP7, '7');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP8, '8');
|
|
|
|
if (strlen(m_EditName) < 12)
|
|
|
|
PROCESS_CHAR(Common::KEYCODE_KP9, '9');
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Cancel
|
2012-05-14 21:29:27 +02:00
|
|
|
if (KEYPRESS(Common::KEYCODE_ESCAPE)) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_bEditSaveName = false;
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
// OK
|
|
|
|
if (KEYPRESS(Common::KEYCODE_RETURN)) {
|
|
|
|
m_bEditSaveName = false;
|
2012-06-04 23:45:36 +02:00
|
|
|
_vm->saveState(m_statePos + m_nEditPos, m_EditName);
|
2012-05-03 01:36:08 +10:00
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
} else if (_ctx->bLeftClick) {
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
|
|
|
|
if (m_ButtonExit->IsActive()) {
|
|
|
|
if (m_bLoadMenuOnly) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// If only the loading menu, close
|
2012-05-03 01:36:08 +10:00
|
|
|
Close();
|
|
|
|
} else {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, m_nLastState);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
} else if (m_ButtonSave_ArrowLeft->IsActive()) {
|
|
|
|
if (m_statePos > 0) {
|
|
|
|
m_statePos -= 6;
|
|
|
|
if (m_statePos < 0) m_statePos = 0;
|
|
|
|
m_ButtonSave_ArrowLeft->SetActiveState(false);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
RefreshThumbnails();
|
|
|
|
}
|
|
|
|
} else if (m_ButtonSave_ArrowRight->IsActive()) {
|
|
|
|
if (m_statePos < 90) {
|
|
|
|
m_statePos += 6;
|
|
|
|
if (m_statePos > 90) m_statePos = 90;
|
|
|
|
m_ButtonSave_ArrowRight->SetActiveState(false);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
RefreshThumbnails();
|
|
|
|
}
|
|
|
|
} else {
|
2012-05-09 23:15:41 +10:00
|
|
|
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_ButtonSave_States[_ctx->i]->IsActive()) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// There by saving or loading!!!
|
2012-05-09 23:15:41 +10:00
|
|
|
if (m_nState == MENULOAD && m_curThumb[_ctx->i] != NULL) {
|
2012-05-03 01:36:08 +10:00
|
|
|
// Caricamento
|
2012-06-04 23:45:36 +02:00
|
|
|
CORO_INVOKE_1(_vm->loadState, m_statePos + _ctx->i);
|
2012-05-03 01:36:08 +10:00
|
|
|
Close();
|
2012-05-09 23:15:41 +10:00
|
|
|
} else if (m_nState == MENUSAVE && (m_statePos != 0 || _ctx->i != 0)) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Turn on edit mode
|
2012-05-03 01:36:08 +10:00
|
|
|
m_bEditSaveName = true;
|
2012-05-09 23:15:41 +10:00
|
|
|
m_nEditPos = _ctx->i;
|
|
|
|
strcpy(m_EditName, m_curThumbName[_ctx->i]);
|
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
|
|
|
|
if (m_bQuitConfirm) {
|
|
|
|
if (m_ButtonQuitNo->IsActive()) {
|
|
|
|
m_bQuitConfirm = false;
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonQuitYes->IsActive()) {
|
|
|
|
m_bQuitConfirm = false;
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-06-04 23:45:36 +02:00
|
|
|
_vm->quitGame();
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (m_ButtonQuit->IsActive()) {
|
|
|
|
m_bQuitConfirm = true;
|
|
|
|
m_ButtonQuitNo->SetActiveState(false);
|
|
|
|
m_ButtonQuitYes->SetActiveState(false);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonExit->IsActive())
|
|
|
|
Close();
|
|
|
|
else if (m_ButtonLoad->IsActive()) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, MENULOAD);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonSave->IsActive()) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, MENUSAVE);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonGameMenu->IsActive() && m_nState != MENUGAME) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, MENUGAME);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonGfxMenu->IsActive() && m_nState != MENUGFX) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, MENUGFX);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
} else if (m_ButtonSoundMenu->IsActive() && m_nState != MENUSOUND) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_1(ChangeState, MENUSOUND);
|
2012-05-09 23:15:41 +10:00
|
|
|
_ctx->bRefresh = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGFX) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// These options take effect immediately
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_ButtonGfx_Anni30->IsActive())
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAnni30 = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
else
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAnni30 = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_ButtonGfx_AntiAlias->IsActive())
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAntiAlias = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
else
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgAntiAlias = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_ButtonGfx_Trans->IsActive())
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgTransparence = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
else
|
2012-05-13 22:34:40 +10:00
|
|
|
GLOBALS.bCfgTransparence = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND)
|
|
|
|
if (!m_bQuitConfirm && KEYPRESS(Common::KEYCODE_ESCAPE))
|
|
|
|
Close();
|
|
|
|
|
2012-05-09 23:15:41 +10:00
|
|
|
if (_ctx->bRefresh)
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_INVOKE_0(RefreshAll);
|
2012-05-09 23:15:41 +10:00
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
int curTime;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
2012-06-04 23:45:36 +02:00
|
|
|
_ctx->curTime = _vm->getTime();
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
#define FADE_SPEED 20
|
2012-05-14 21:29:27 +02:00
|
|
|
#define SYNC (_ctx->curTime-m_FadeTime) / 25
|
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_bExit)
|
|
|
|
return;
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
if (m_FadeStep == 1) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Downhill fast
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_FadeTime == -1)
|
|
|
|
m_FadeY += FADE_SPEED;
|
|
|
|
else
|
2012-05-14 21:29:27 +02:00
|
|
|
m_FadeY += FADE_SPEED * SYNC;
|
2012-05-03 23:08:19 +10:00
|
|
|
if (m_FadeY > 480) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY = 480;
|
|
|
|
m_FadeStep++;
|
|
|
|
}
|
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Set the part to draw the scrolling
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
} else if (m_FadeStep == 2) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Bounce 1
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY -= FADE_SPEED / 2 * SYNC;
|
|
|
|
if (m_FadeY < 400) {
|
|
|
|
m_FadeY = 400;
|
|
|
|
m_FadeStep++;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 3) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY -= FADE_SPEED / 4 * SYNC;
|
|
|
|
if (m_FadeY < 380) {
|
|
|
|
m_FadeY = 380;
|
|
|
|
m_FadeStep++;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 4) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Bounce 1 - 2
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY += FADE_SPEED / 3 * SYNC;
|
|
|
|
if (m_FadeY > 420) {
|
|
|
|
m_FadeY = 420;
|
|
|
|
m_FadeStep++;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 5) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY += FADE_SPEED / 2 * SYNC;
|
|
|
|
if (m_FadeY > 480) {
|
|
|
|
m_FadeY = 480;
|
|
|
|
m_FadeStep++;
|
2012-06-04 23:45:36 +02:00
|
|
|
_vm->hideLocation();
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 6) {
|
|
|
|
// Menu ON
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 7) {
|
|
|
|
// Menu OFF
|
2012-06-04 23:45:36 +02:00
|
|
|
_vm->showLocation();
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeStep++;
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 8) {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeY -= FADE_SPEED * SYNC;
|
|
|
|
if (m_FadeY < 0) {
|
|
|
|
m_FadeY = 0;
|
|
|
|
m_FadeStep++;
|
|
|
|
}
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setSrc(RMRect(0, 480 - m_FadeY, 640, 480));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else if (m_FadeStep == 9) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Hello hello!
|
2012-05-03 01:36:08 +10:00
|
|
|
m_bExit = true;
|
|
|
|
m_FadeStep = 0;
|
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Free memory
|
2012-05-03 01:36:08 +10:00
|
|
|
CloseState();
|
|
|
|
return;
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
} else {
|
2012-05-03 01:36:08 +10:00
|
|
|
m_FadeStep = 0;
|
|
|
|
}
|
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
m_FadeTime = _ctx->curTime;
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 18:51:20 +02:00
|
|
|
void RMOptionScreen::removeThis(CORO_PARAM, bool &result) {
|
2012-05-03 01:36:08 +10:00
|
|
|
if (m_bExit)
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
|
|
|
else
|
|
|
|
result = false;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
bool RMOptionScreen::LoadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMString &name, byte &diff) {
|
2012-05-12 21:54:37 +10:00
|
|
|
Common::String buf;
|
2012-05-14 21:29:27 +02:00
|
|
|
char namebuf[256];
|
2012-05-12 21:54:37 +10:00
|
|
|
int i;
|
|
|
|
Common::InSaveFile *f;
|
2012-05-03 01:36:08 +10:00
|
|
|
char id[4];
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Cleans the destination
|
2012-05-03 01:36:08 +10:00
|
|
|
Common::fill(lpDestBuf, lpDestBuf + 160 * 120 * 2, 0);
|
|
|
|
name = "No name";
|
|
|
|
diff = 10;
|
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
// Get the savegame filename for the given slot
|
2012-06-04 23:45:36 +02:00
|
|
|
buf = _vm->getSaveStateFileName(nState);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
// Try and open the savegame
|
|
|
|
f = g_system->getSavefileManager()->openForLoading(buf);
|
|
|
|
if (f == NULL)
|
2012-05-03 01:36:08 +10:00
|
|
|
return false;
|
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
// Check to see if the file has a valid header
|
|
|
|
f->read(id, 4);
|
2012-05-03 01:36:08 +10:00
|
|
|
if (id[0] != 'R' || id[1] != 'M' || id[2] != 'S') {
|
2012-05-12 21:54:37 +10:00
|
|
|
delete f;
|
2012-05-03 01:36:08 +10:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id[3] < 0x3) {
|
2012-05-12 21:54:37 +10:00
|
|
|
// Very old version that doesn't have screenshots
|
|
|
|
delete f;
|
2012-05-03 01:36:08 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
// Load the screenshot
|
|
|
|
if ((id[3] >= 0x5) && (id[3] < 0x8)) {
|
|
|
|
// Read it as an LZO compressed data block
|
2012-05-03 01:36:08 +10:00
|
|
|
byte *cmpbuf;
|
|
|
|
uint32 cmpsize, size;
|
|
|
|
|
|
|
|
cmpbuf = new byte[160 * 120 * 4];
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-20 17:01:20 +10:00
|
|
|
// Read in the compressed data
|
2012-05-12 21:54:37 +10:00
|
|
|
cmpsize = f->readUint32LE();
|
|
|
|
f->read(cmpbuf, cmpsize);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
lzo1x_decompress(cmpbuf, cmpsize, lpDestBuf, &size);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
delete[] cmpbuf;
|
2012-05-12 21:54:37 +10:00
|
|
|
} else {
|
|
|
|
// Read in the screenshot as an uncompressed data block
|
|
|
|
if (id[3] >= 8)
|
|
|
|
// Recent versions use hardcoded 160x120 uncomrpessed data, so size can be skipped
|
2012-05-14 21:29:27 +02:00
|
|
|
f->skip(4);
|
2012-05-12 21:54:37 +10:00
|
|
|
|
|
|
|
f->read(lpDestBuf, 160 * 120 * 2);
|
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (id[3] >= 0x5) {
|
2012-05-12 21:54:37 +10:00
|
|
|
// Read in the difficulty level
|
|
|
|
diff = f->readByte();
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
if (id[3] < 0x4) {
|
2012-05-12 21:54:37 +10:00
|
|
|
// Savegame version doesn't have a stored name
|
|
|
|
delete f;
|
2012-05-03 01:36:08 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
i = f->readByte();
|
|
|
|
f->read(namebuf, i);
|
2012-05-03 01:36:08 +10:00
|
|
|
namebuf[i] = '\0';
|
|
|
|
name = namebuf;
|
|
|
|
|
2012-05-12 21:54:37 +10:00
|
|
|
delete f;
|
2012-05-03 01:36:08 +10:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************\
|
2012-05-20 15:28:48 +10:00
|
|
|
* RMPointer Methods
|
2012-05-03 01:36:08 +10:00
|
|
|
\****************************************************************************/
|
|
|
|
|
|
|
|
RMPointer::RMPointer() {
|
|
|
|
Common::fill(m_pointer, m_pointer + 16, (RMGfxSourceBuffer8 *)NULL);
|
2012-05-05 11:56:59 +10:00
|
|
|
Common::fill(m_specialPointer, m_specialPointer + 16, (RMItem *)NULL);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
RMPointer::~RMPointer() {
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RMPointer::Init(void) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
RMResRaw res(RES_P_GO + i);
|
|
|
|
|
|
|
|
m_pointer[i] = new RMGfxSourceBuffer8RLEByteAA;
|
2012-06-05 08:39:55 +02:00
|
|
|
m_pointer[i]->init(res, res.Width(), res.Height(), false);
|
|
|
|
m_pointer[i]->loadPaletteWA(RES_P_PAL);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
RMRes res(RES_P_PAP1 + i);
|
|
|
|
RMDataStream ds;
|
|
|
|
|
|
|
|
ds.OpenBuffer(res);
|
|
|
|
m_specialPointer[i] = new RMItem;
|
|
|
|
ds >> *m_specialPointer[i];
|
|
|
|
}
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-05-03 01:36:08 +10:00
|
|
|
//m_hotspot[0].Set(19,5);
|
|
|
|
m_hotspot[0].Set(5, 1);
|
|
|
|
m_hotspot[1].Set(32, 28);
|
|
|
|
m_hotspot[2].Set(45, 23);
|
|
|
|
m_hotspot[3].Set(35, 25);
|
|
|
|
m_hotspot[4].Set(32, 28);
|
|
|
|
|
|
|
|
// Default=GO
|
|
|
|
m_nCurPointer = 0;
|
|
|
|
m_nCurSpecialPointer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RMPointer::Close(void) {
|
|
|
|
int i;
|
|
|
|
|
2012-05-05 11:15:38 +10:00
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
if (m_pointer[i] != NULL) {
|
|
|
|
delete m_pointer[i];
|
|
|
|
m_pointer[i] = NULL;
|
|
|
|
}
|
2012-05-05 11:56:59 +10:00
|
|
|
|
|
|
|
if (m_specialPointer[i] != NULL) {
|
|
|
|
delete m_specialPointer[i];
|
|
|
|
m_specialPointer[i] = NULL;
|
|
|
|
}
|
2012-05-05 11:15:38 +10:00
|
|
|
}
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-05 18:51:20 +02:00
|
|
|
int RMPointer::priority() {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Pointer has minimum priority so it will be drawn last
|
2012-05-03 01:36:08 +10:00
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:39:55 +02:00
|
|
|
void RMPointer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_BEGIN_CONTEXT;
|
2012-05-14 21:29:27 +02:00
|
|
|
int n;
|
2012-05-12 20:49:36 +10:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
2012-05-14 21:29:27 +02:00
|
|
|
CORO_BEGIN_CODE(_ctx);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Check the pointer
|
2012-05-12 20:49:36 +10:00
|
|
|
_ctx->n = m_nCurPointer;
|
|
|
|
if (_ctx->n == TA_COMBINE) _ctx->n = TA_USE;
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// Copy the destination coordinates in the primitive
|
2012-06-05 08:39:55 +02:00
|
|
|
prim->setDst(m_pos);
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_pos.x >= 0 && m_pos.y >= 0 && m_pos.x < RM_SX && m_pos.y < RM_SY) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Call the Draw method of the poitner
|
2012-05-14 21:29:27 +02:00
|
|
|
prim->Dst() -= m_hotspot[_ctx->n];
|
2012-05-03 01:36:08 +10:00
|
|
|
|
|
|
|
if (m_nCurSpecialPointer == 0) {
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_2(m_pointer[_ctx->n]->draw, bigBuf, prim);
|
2012-05-03 01:36:08 +10:00
|
|
|
} else {
|
|
|
|
if (m_nCurSpecialPointer == PTR_CUSTOM)
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_2(m_nCurCustomPointer->draw, bigBuf, prim);
|
2012-05-03 01:36:08 +10:00
|
|
|
else
|
2012-05-20 15:28:48 +10:00
|
|
|
// Call the draw on the special pointer
|
2012-06-05 08:39:55 +02:00
|
|
|
CORO_INVOKE_2(m_specialPointer[m_nCurSpecialPointer - 1]->draw, bigBuf, prim);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
}
|
2012-05-12 20:49:36 +10:00
|
|
|
|
|
|
|
CORO_END_CODE;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void RMPointer::DoFrame(RMGfxTargetBuffer *bigBuf) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Add it to the list of primitives
|
2012-06-05 08:39:55 +02:00
|
|
|
bigBuf->addPrim(new RMGfxPrimitive(this));
|
2012-05-03 01:36:08 +10:00
|
|
|
|
2012-05-20 15:28:48 +10:00
|
|
|
// If there is a special pointer, does DoFrame
|
2012-05-14 21:29:27 +02:00
|
|
|
if (m_nCurSpecialPointer != 0 && m_nCurSpecialPointer != PTR_CUSTOM)
|
|
|
|
m_specialPointer[m_nCurSpecialPointer - 1]->DoFrame(bigBuf, false);
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 18:51:20 +02:00
|
|
|
void RMPointer::removeThis(CORO_PARAM, bool &result) {
|
2012-05-20 15:28:48 +10:00
|
|
|
// Always remove from the OT list, to support disabling the pointer
|
2012-05-12 20:49:36 +10:00
|
|
|
result = true;
|
2012-05-03 01:36:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
int RMPointer::CurAction(void) {
|
|
|
|
if (m_nCurSpecialPointer != 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return m_nCurPointer;
|
|
|
|
}
|
|
|
|
|
2012-04-30 09:27:12 +10:00
|
|
|
} // End of namespace Tony
|