Added const to some static data.

svn-id: r32763
This commit is contained in:
Johannes Schickel 2008-06-24 13:59:48 +00:00
parent 28e32bb7cb
commit df1aa7809a
10 changed files with 19 additions and 17 deletions

View file

@ -665,7 +665,7 @@ void Animator_LoK::animRefreshNPC(int character) {
void Animator_LoK::setCharacterDefaultFrame(int character) { void Animator_LoK::setCharacterDefaultFrame(int character) {
debugC(9, kDebugLevelAnimator, "Animator_LoK::setCharacterDefaultFrame()"); debugC(9, kDebugLevelAnimator, "Animator_LoK::setCharacterDefaultFrame()");
static uint16 initFrameTable[] = { static const uint16 initFrameTable[] = {
7, 41, 77, 0, 0 7, 41, 77, 0, 0
}; };
assert(character < ARRAYSIZE(initFrameTable)); assert(character < ARRAYSIZE(initFrameTable));
@ -678,7 +678,7 @@ void Animator_LoK::setCharacterDefaultFrame(int character) {
void Animator_LoK::setCharactersHeight() { void Animator_LoK::setCharactersHeight() {
debugC(9, kDebugLevelAnimator, "Animator_LoK::setCharactersHeight()"); debugC(9, kDebugLevelAnimator, "Animator_LoK::setCharactersHeight()");
static int8 initHeightTable[] = { static const int8 initHeightTable[] = {
48, 40, 48, 47, 56, 48, 40, 48, 47, 56,
44, 42, 47, 38, 35, 44, 42, 47, 38, 35,
40 40

View file

@ -188,6 +188,7 @@ int KyraEngine_LoK::buttonAmuletCallback(Button *caller) {
#pragma mark - #pragma mark -
GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI(vm), _vm(vm), _screen(screen) { GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI(vm), _vm(vm), _screen(screen) {
_lastScreenUpdate = 0;
_menu = 0; _menu = 0;
initStaticResource(); initStaticResource();
_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollUp); _scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollUp);
@ -479,7 +480,6 @@ int GUI_LoK::buttonMenuCallback(Button *caller) {
void GUI_LoK::getInput() { void GUI_LoK::getInput() {
Common::Event event; Common::Event event;
static uint32 lastScreenUpdate = 0;
uint32 now = _vm->_system->getMillis(); uint32 now = _vm->_system->getMillis();
_mouseWheel = 0; _mouseWheel = 0;
@ -496,7 +496,7 @@ void GUI_LoK::getInput() {
break; break;
case Common::EVENT_MOUSEMOVE: case Common::EVENT_MOUSEMOVE:
_vm->_system->updateScreen(); _vm->_system->updateScreen();
lastScreenUpdate = now; _lastScreenUpdate = now;
break; break;
case Common::EVENT_WHEELUP: case Common::EVENT_WHEELUP:
_mouseWheel = -1; _mouseWheel = -1;
@ -512,9 +512,9 @@ void GUI_LoK::getInput() {
} }
} }
if (now - lastScreenUpdate > 50) { if (now - _lastScreenUpdate > 50) {
_vm->_system->updateScreen(); _vm->_system->updateScreen();
lastScreenUpdate = now; _lastScreenUpdate = now;
} }
_vm->_system->delayMillis(3); _vm->_system->delayMillis(3);
@ -1056,7 +1056,7 @@ void GUI_LoK::fadePalette() {
if (_vm->gameFlags().platform == Common::kPlatformAmiga) if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return; return;
static int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1}; static const int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1};
int index = 0; int index = 0;
memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);

View file

@ -157,6 +157,8 @@ private:
KyraEngine_LoK *_vm; KyraEngine_LoK *_vm;
Screen_LoK *_screen; Screen_LoK *_screen;
uint32 _lastScreenUpdate;
bool _menuRestoreScreen; bool _menuRestoreScreen;
uint8 _toplevelMenu; uint8 _toplevelMenu;
int _savegameOffset; int _savegameOffset;

View file

@ -39,7 +39,7 @@
namespace Kyra { namespace Kyra {
int KyraEngine_LoK::findDuplicateItemShape(int shape) { int KyraEngine_LoK::findDuplicateItemShape(int shape) {
static uint8 dupTable[] = { static const uint8 dupTable[] = {
0x48, 0x46, 0x49, 0x47, 0x4a, 0x46, 0x4b, 0x47, 0x48, 0x46, 0x49, 0x47, 0x4a, 0x46, 0x4b, 0x47,
0x4c, 0x46, 0x4d, 0x47, 0x5b, 0x5a, 0x5c, 0x5a, 0x4c, 0x46, 0x4d, 0x47, 0x5b, 0x5a, 0x5c, 0x5a,
0x5d, 0x5a, 0x5e, 0x5a, 0xFF, 0xFF 0x5d, 0x5a, 0x5e, 0x5a, 0xFF, 0xFF

View file

@ -723,7 +723,7 @@ void KyraEngine_HoF::fadeScenePal(int srcIndex, int delayTime) {
bool KyraEngine_HoF::lineIsPassable(int x, int y) { bool KyraEngine_HoF::lineIsPassable(int x, int y) {
debugC(9, kDebugLevelMain, "KyraEngine_HoF::lineIsPassable(%d, %d)", x, y); debugC(9, kDebugLevelMain, "KyraEngine_HoF::lineIsPassable(%d, %d)", x, y);
static int unkTable[] = { 1, 1, 1, 1, 1, 2, 4, 6, 8 }; static const int widthTable[] = { 1, 1, 1, 1, 1, 2, 4, 6, 8 };
if (_pathfinderFlag & 2) { if (_pathfinderFlag & 2) {
if (x >= 320) if (x >= 320)
@ -743,7 +743,7 @@ bool KyraEngine_HoF::lineIsPassable(int x, int y) {
if (y > 143) if (y > 143)
return false; return false;
int unk1 = unkTable[getScale(x, y) >> 5]; int unk1 = widthTable[getScale(x, y) >> 5];
if (y < 0) if (y < 0)
y = 0; y = 0;

View file

@ -1144,11 +1144,11 @@ void KyraEngine_LoK::setCharactersInDefaultScene() {
} }
void KyraEngine_LoK::setCharactersPositions(int character) { void KyraEngine_LoK::setCharactersPositions(int character) {
static uint16 initXPosTable[] = { static const uint16 initXPosTable[] = {
0x3200, 0x0024, 0x2230, 0x2F00, 0x0020, 0x002B, 0x3200, 0x0024, 0x2230, 0x2F00, 0x0020, 0x002B,
0x00CA, 0x00F0, 0x0082, 0x00A2, 0x0042 0x00CA, 0x00F0, 0x0082, 0x00A2, 0x0042
}; };
static uint8 initYPosTable[] = { static const uint8 initYPosTable[] = {
0x00, 0xA2, 0x00, 0x42, 0x00, 0x00, 0xA2, 0x00, 0x42, 0x00,
0x67, 0x67, 0x60, 0x5A, 0x71, 0x67, 0x67, 0x60, 0x5A, 0x71,
0x76 0x76

View file

@ -35,7 +35,7 @@
namespace Kyra { namespace Kyra {
EMCInterpreter::EMCInterpreter(KyraEngine_v1 *vm) : _vm(vm) { EMCInterpreter::EMCInterpreter(KyraEngine_v1 *vm) : _vm(vm) {
#define COMMAND(x) { &EMCInterpreter::x, #x } #define COMMAND(x) { &EMCInterpreter::x, #x }
static CommandEntry commandProcs[] = { static const CommandEntry commandProcs[] = {
// 0x00 // 0x00
COMMAND(cmd_jmpTo), COMMAND(cmd_jmpTo),
COMMAND(cmd_setRetValue), COMMAND(cmd_setRetValue),

View file

@ -34,7 +34,7 @@ namespace Kyra {
TIMInterpreter::TIMInterpreter(KyraEngine_v1 *vm, OSystem *system) : _vm(vm), _system(system), _currentTim(0) { TIMInterpreter::TIMInterpreter(KyraEngine_v1 *vm, OSystem *system) : _vm(vm), _system(system), _currentTim(0) {
#define COMMAND(x) { &TIMInterpreter::x, #x } #define COMMAND(x) { &TIMInterpreter::x, #x }
#define COMMAND_UNIMPL() { 0, 0 } #define COMMAND_UNIMPL() { 0, 0 }
static CommandEntry commandProcs[] = { static const CommandEntry commandProcs[] = {
// 0x00 // 0x00
COMMAND(cmd_initFunc0), COMMAND(cmd_initFunc0),
COMMAND(cmd_stopCurFunc), COMMAND(cmd_stopCurFunc),

View file

@ -500,7 +500,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
debugC(9, kDebugLevelSequence, "SeqPlayer::seq_playSequence(%p, %d)", (const void *)seqData, skipSeq); debugC(9, kDebugLevelSequence, "SeqPlayer::seq_playSequence(%p, %d)", (const void *)seqData, skipSeq);
assert(seqData); assert(seqData);
static SeqEntry floppySeqProcs[] = { static const SeqEntry floppySeqProcs[] = {
// 0x00 // 0x00
SEQOP(3, s1_wsaOpen), SEQOP(3, s1_wsaOpen),
SEQOP(2, s1_wsaClose), SEQOP(2, s1_wsaClose),
@ -541,7 +541,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
SEQOP(1, s1_endOfScript) SEQOP(1, s1_endOfScript)
}; };
static SeqEntry cdromSeqProcs[] = { static const SeqEntry cdromSeqProcs[] = {
// 0x00 // 0x00
SEQOP(3, s1_wsaOpen), SEQOP(3, s1_wsaOpen),
SEQOP(2, s1_wsaClose), SEQOP(2, s1_wsaClose),

View file

@ -878,7 +878,7 @@ void MidiParser_EuD::parseNextEvent(EventInfo &info) {
pos += 6; pos += 6;
} }
} else if (cmd == 0xF2) { } else if (cmd == 0xF2) {
static uint16 tickTable [] = { 0x180, 0xC0, 0x80, 0x60, 0x40, 0x30, 0x20, 0x18 }; static const uint16 tickTable[] = { 0x180, 0xC0, 0x80, 0x60, 0x40, 0x30, 0x20, 0x18 };
_baseTick += tickTable[_nextBaseTickStep >> 4] * ((_nextBaseTickStep & 0x0f) + 1); _baseTick += tickTable[_nextBaseTickStep >> 4] * ((_nextBaseTickStep & 0x0f) + 1);
_nextBaseTickStep = pos[1]; _nextBaseTickStep = pos[1];
pos += 6; pos += 6;