aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-09 20:34:36 +0000
committerFlorian Kagerer2009-03-09 20:34:36 +0000
commitcbf2602783b6c29ef0108030509a851c3fff1e21 (patch)
treeb292998040223f55fec35522297eb5a6409ee432
parenta00559136ff5d4d09f3ee3c0a879c8766ae0c24e (diff)
downloadscummvm-rg350-cbf2602783b6c29ef0108030509a851c3fff1e21.tar.gz
scummvm-rg350-cbf2602783b6c29ef0108030509a851c3fff1e21.tar.bz2
scummvm-rg350-cbf2602783b6c29ef0108030509a851c3fff1e21.zip
LOL: - fixed inventory bug
- fixed monster speed svn-id: r39275
-rw-r--r--engines/kyra/gui_lol.cpp17
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/lol.h9
-rw-r--r--engines/kyra/script_lol.cpp2
-rw-r--r--engines/kyra/sprites_lol.cpp14
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/timer_lol.cpp8
7 files changed, 27 insertions, 29 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index a70935e43d..ad4a7cc15c 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -277,11 +277,11 @@ void LoLEngine::gui_changeCharacterStats(int charNum) {
void LoLEngine::gui_drawCharInventoryItem(int itemIndex) {
static const uint8 slotShapes[] = { 0x30, 0x34, 0x30, 0x34, 0x2E, 0x2F, 0x32, 0x33, 0x31, 0x35, 0x35 };
- const int8 *coords = &_charInvDefs[_charInvIndex[_characters[_selectedCharacter].raceClassSex] * 22 + itemIndex * 2];
- int8 x = *coords++;
- int8 y = *coords;
+ const uint8 *coords = &_charInvDefs[_charInvIndex[_characters[_selectedCharacter].raceClassSex] * 22 + itemIndex * 2];
+ uint8 x = *coords++;
+ uint8 y = *coords;
- if (y == -1)
+ if (y == 0xff)
return;
if (!_screen->_curPage)
@@ -291,6 +291,11 @@ void LoLEngine::gui_drawCharInventoryItem(int itemIndex) {
int shapeNum = i ? ((itemIndex < 9) ? 4 : 5) : slotShapes[itemIndex];
_screen->drawShape(_screen->_curPage, _gameShapes[shapeNum], x, y, 0, 0);
+ if (itemIndex > 8) {
+ x -= 5;
+ y -= 5;
+ }
+
if (i)
_screen->drawShape(_screen->_curPage, getItemIconShapePtr(i), x + 1, y + 1, 0, 0);
}
@@ -859,10 +864,10 @@ void LoLEngine::gui_initCharacterControlButtons(int index, int xOffs) {
}
void LoLEngine::gui_initCharInventorySpecialButtons(int charNum) {
- const int8 *s = &_charInvDefs[_charInvIndex[_characters[charNum].raceClassSex] * 22];
+ const uint8 *s = &_charInvDefs[_charInvIndex[_characters[charNum].raceClassSex] * 22];
for (int i = 0; i < 11; i++) {
- if (*s != -1)
+ if (*s != 0xff)
gui_initButton(33 + i, s[0], s[1], i);
s += 2;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index f3bc4aa960..102416c5ae 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1395,10 +1395,6 @@ void LoLEngine::snd_stopSpeech(bool setFlag) {
_tim->_abortFlag = 1;
}
-uint32 LoLEngine::snd_getElapsedSpeechTime() {
- return _sound->voicePlayedTime(_activeVoiceFile);
-}
-
void LoLEngine::snd_playSoundEffect(int track, int volume) {
debugC(9, kDebugLevelMain | kDebugLevelSound, "LoLEngine::snd_playSoundEffect(%d, %d)", track, volume);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index ad24ec5ecf..5e49012dab 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -112,7 +112,7 @@ struct MonsterProperty {
uint16 unk3[8];
uint16 itemProtection;
uint16 might;
- uint8 b;
+ uint8 waitTicks;
uint16 flags;
uint16 unk5;
uint16 unk6[5];
@@ -144,7 +144,7 @@ struct MonsterInPlay {
uint8 field_1B;
uint8 field_1C;
int16 might;
- uint8 field_1F;
+ uint8 tick;
uint8 type;
MonsterProperty *properties;
uint8 field_25;
@@ -312,7 +312,7 @@ private:
void timerProcessMonsters(int timerNum);
void timerSub3(int timerNum);
void timerSub4(int timerNum);
- void timerUpdateSceneAnims(int timerNum);
+ void timerRunSceneAnimScript(int timerNum);
void timerSub6(int timerNum);
void timerUpdatePortraitAnimations(int skipUpdate);
void timerUpdateLampState(int timerNum);
@@ -327,7 +327,6 @@ private:
bool snd_playCharacterSpeech(int id, int8 speaker, int);
int snd_characterSpeaking();
void snd_stopSpeech(bool setFlag);
- uint32 snd_getElapsedSpeechTime();
void snd_playSoundEffect(int track, int volume);
void snd_processEnvironmentalSoundEffect(int soundId, int block);
void snd_loadSoundFile(int track);
@@ -936,7 +935,7 @@ private:
const uint8 *_charInvIndex;
int _charInvIndexSize;
- const int8 *_charInvDefs;
+ const uint8 *_charInvDefs;
int _charInvDefsSize;
EMCData _itemScript;
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 77a83ea91c..d0f70d062b 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -693,7 +693,7 @@ int LoLEngine::olol_loadMonsterProperties(EMCState *script) {
l->pos = &l->field2[0];
l->itemProtection = stackPos(25);
l->might = stackPos(26);
- l->b = 1;
+ l->waitTicks = 1;
l->flags = stackPos(27);
l->unk5 = stackPos(28);
// FIXME???
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index d05a585bac..9b59181d62 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -836,17 +836,15 @@ int LoLEngine::calcDrawingLayerParameters(int x1, int y1, int16 &x2, int16 &y2,
}
void LoLEngine::updateMonster(MonsterInPlay *monster) {
- static const uint8 monsterState[] = { 1, 0, 1, 3, 3, 0, 0, 3, 4, 1, 0, 0, 4, 0, 0 };
+ static const uint8 flags[] = { 1, 0, 1, 3, 3, 0, 0, 3, 4, 1, 0, 0, 4, 0, 0 };
if (monster->mode > 14)
return;
- int s = monsterState[monster->mode];
- int a = monster->field_1F++;
-
- if ((a < monster->properties->b) && (s & 4))
+ int f = flags[monster->mode];
+ if ((monster->tick++ < monster->properties->waitTicks) && (!(f & 4)))
return;
- monster->field_1F = 0;
+ monster->tick = 0;
if (monster->properties->flags & 0x40) {
monster->might += _rnd.getRandomNumberRng(1, 8);
@@ -859,13 +857,13 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
monster->destY = _partyPosY;
}
- if (s & 2) {
+ if (f & 2) {
/////
// TODO
}
- if ((s & 1) && (monster->flags & 0x10))
+ if ((f & 1) && (monster->flags & 0x10))
setMonsterMode(monster, 7);
if ((monster->mode != 11) && (monster->mode != 14)) {
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index d06957350f..03bc59448b 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1755,7 +1755,7 @@ void LoLEngine::initStaticResource() {
_spellProperties = _staticres->loadSpellData(kLolSpellProperties, _spellPropertiesSize);
_gameShapeMap = (const int8*)_staticres->loadRawData(kLolGameShapeMap, _gameShapeMapSize);
_charInvIndex = _staticres->loadRawData(kLolCharInvIndex, _charInvIndexSize);
- _charInvDefs = (const int8*)_staticres->loadRawData(kLolCharInvDefs, _charInvDefsSize);
+ _charInvDefs = _staticres->loadRawData(kLolCharInvDefs, _charInvDefsSize);
_charDefsMan = _staticres->loadRawDataBe16(kLolCharDefsMan, _charDefsManSize);
_charDefsWoman = _staticres->loadRawDataBe16(kLolCharDefsWoman, _charDefsWomanSize);
_charDefsKieran = _staticres->loadRawDataBe16(kLolCharDefsKieran, _charDefsKieranSize);
diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp
index 58270b112c..30ef9d6a26 100644
--- a/engines/kyra/timer_lol.cpp
+++ b/engines/kyra/timer_lol.cpp
@@ -42,9 +42,9 @@ void LoLEngine::setupTimers() {
_timer->setNextRun(0x11, _system->getMillis() + 3 * _tickLength);
_timer->addTimer(3, TimerV2(timerSub3), 15, true);
_timer->addTimer(4, TimerV2(timerSub4), 1, true);
- _timer->addTimer(0x50, TimerV2(timerUpdateSceneAnims), 0, false);
- _timer->addTimer(0x51, TimerV2(timerUpdateSceneAnims), 0, false);
- _timer->addTimer(0x52, TimerV2(timerUpdateSceneAnims), 0, false);
+ _timer->addTimer(0x50, TimerV2(timerRunSceneAnimScript), 0, false);
+ _timer->addTimer(0x51, TimerV2(timerRunSceneAnimScript), 0, false);
+ _timer->addTimer(0x52, TimerV2(timerRunSceneAnimScript), 0, false);
_timer->addTimer(8, TimerV2(timerSub6), 1200, true);
_timer->addTimer(9, TimerV2(timerUpdatePortraitAnimations), 10, true);
_timer->addTimer(10, TimerV2(timerUpdateLampState), 360, true);
@@ -119,7 +119,7 @@ void LoLEngine::timerSub4(int timerNum) {
}
-void LoLEngine::timerUpdateSceneAnims(int timerNum) {
+void LoLEngine::timerRunSceneAnimScript(int timerNum) {
runLevelScript(0x401 + (timerNum & 0x0f), -1);
}