aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathrxx2011-11-06 17:02:52 +0100
committerJohannes Schickel2011-12-26 16:18:11 +0100
commit9a6be57afd843b0cae09633b3745b104034100fa (patch)
tree67889f2a738c0e5de4e7ef8ac3eb45e17b766fa1
parent77d210765a2e1e299d2321863f5cc543b64ee1bb (diff)
downloadscummvm-rg350-9a6be57afd843b0cae09633b3745b104034100fa.tar.gz
scummvm-rg350-9a6be57afd843b0cae09633b3745b104034100fa.tar.bz2
scummvm-rg350-9a6be57afd843b0cae09633b3745b104034100fa.zip
KYRA: (EOB) - implement explodeObject()
-rw-r--r--devtools/create_kyradat/create_kyradat.cpp42
-rw-r--r--devtools/create_kyradat/create_kyradat.h14
-rw-r--r--devtools/create_kyradat/games.cpp26
-rw-r--r--devtools/create_kyradat/tables.cpp36
-rw-r--r--engines/kyra/eobcommon.cpp34
-rw-r--r--engines/kyra/eobcommon.h24
-rw-r--r--engines/kyra/items_eob.cpp63
-rw-r--r--engines/kyra/lol.h2
-rw-r--r--engines/kyra/loleobbase.cpp4
-rw-r--r--engines/kyra/loleobbase.h4
-rw-r--r--engines/kyra/magic_eob.cpp2
-rw-r--r--engines/kyra/resource.h14
-rw-r--r--engines/kyra/scene_eob.cpp4
-rw-r--r--engines/kyra/scene_lol.cpp2
-rw-r--r--engines/kyra/screen_eob.cpp217
-rw-r--r--engines/kyra/screen_eob.h32
-rw-r--r--engines/kyra/staticres_eob.cpp13
-rw-r--r--engines/kyra/timer_eob.cpp2
18 files changed, 380 insertions, 155 deletions
diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index d20b0045f8..d27b5c10fa 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -318,17 +318,17 @@ const ExtractFilename extractFilenames[] = {
{ kEobBaseMagicStrings2, kTypeStringList, true },
{ kEobBaseMagicStrings3, kTypeStringList, true },
{ kEobBaseMagicStrings4, kTypeStringList, true },
- { kEobBaseMagicStrings5, kTypeStringList, false },
{ kEobBaseMagicStrings6, kTypeStringList, true },
{ kEobBaseMagicStrings7, kTypeStringList, true },
{ kEobBaseMagicStrings8, kTypeStringList, true },
- { kEobBaseFlightObjAnimTiles, kTypeRawData, false },
- { kEobBaseFlightObjAnimIndex, kTypeRawData, false },
- { kEobBaseFlightObjAnimDim, kTypeRawData, false },
- { kEobBaseFlightObjAnimTbl1, kTypeRawData, false },
- { kEobBaseFlightObjAnimTbl2, kTypeRawData, false },
- { kEobBaseFlightObjAnimTbl3, kTypeRawData, false },
+ { kEobBaseExpObjectTlMode, kTypeRawData, false },
+ { kEobBaseExpObjectTblIndex, kTypeRawData, false },
+ { kEobBaseExpObjectShpStart, kTypeRawData, false },
+ { kEobBaseExpObjectTbl1, kTypeRawData, false },
+ { kEobBaseExpObjectTbl2, kTypeRawData, false },
+ { kEobBaseExpObjectTbl3, kTypeRawData, false },
+ { kEobBaseExpObjectY, k3TypeRaw16to8, false },
{ kEobBaseSparkDefSteps, kTypeRawData, false },
{ kEobBaseSparkDefSubSteps, kTypeRawData, false },
@@ -1411,26 +1411,26 @@ const char *getIdString(const int id) {
return "kEobBaseMagicStrings3";
case kEobBaseMagicStrings4:
return "kEobBaseMagicStrings4";
- case kEobBaseMagicStrings5:
- return "kEobBaseMagicStrings5";
case kEobBaseMagicStrings6:
return "kEobBaseMagicStrings6";
case kEobBaseMagicStrings7:
return "kEobBaseMagicStrings7";
case kEobBaseMagicStrings8:
return "kEobBaseMagicStrings8";
- case kEobBaseFlightObjAnimTiles:
- return "kEobBaseFlightObjAnimTiles";
- case kEobBaseFlightObjAnimIndex:
- return "kEobBaseFlightObjAnimIndex";
- case kEobBaseFlightObjAnimDim:
- return "kEobBaseFlightObjAnimDim";
- case kEobBaseFlightObjAnimTbl1:
- return "kEobBaseFlightObjAnimTbl1";
- case kEobBaseFlightObjAnimTbl2:
- return "kEobBaseFlightObjAnimTbl2";
- case kEobBaseFlightObjAnimTbl3:
- return "kEobBaseFlightObjAnimTbl3";
+ case kEobBaseExpObjectTlMode:
+ return "kEobBaseExpObjectTlMode";
+ case kEobBaseExpObjectTblIndex:
+ return "kEobBaseExpObjectTblIndex";
+ case kEobBaseExpObjectShpStart:
+ return "kEobBaseExpObjectShpStart";
+ case kEobBaseExpObjectTbl1:
+ return "kEobBaseExpObjectTbl1";
+ case kEobBaseExpObjectTbl2:
+ return "kEobBaseExpObjectTbl2";
+ case kEobBaseExpObjectTbl3:
+ return "kEobBaseExpObjectTbl3";
+ case kEobBaseExpObjectY:
+ return "kEobBaseExpObjectY";
case kEobBaseSparkDefSteps:
return "kEobBaseSparkDefSteps";
case kEobBaseSparkDefSubSteps:
diff --git a/devtools/create_kyradat/create_kyradat.h b/devtools/create_kyradat/create_kyradat.h
index d1355a8041..7ecc4b256d 100644
--- a/devtools/create_kyradat/create_kyradat.h
+++ b/devtools/create_kyradat/create_kyradat.h
@@ -318,17 +318,17 @@ enum kExtractID {
kEobBaseMagicStrings2,
kEobBaseMagicStrings3,
kEobBaseMagicStrings4,
- kEobBaseMagicStrings5,
kEobBaseMagicStrings6,
kEobBaseMagicStrings7,
kEobBaseMagicStrings8,
- kEobBaseFlightObjAnimTiles,
- kEobBaseFlightObjAnimIndex,
- kEobBaseFlightObjAnimDim,
- kEobBaseFlightObjAnimTbl1,
- kEobBaseFlightObjAnimTbl2,
- kEobBaseFlightObjAnimTbl3,
+ kEobBaseExpObjectTlMode,
+ kEobBaseExpObjectTblIndex,
+ kEobBaseExpObjectShpStart,
+ kEobBaseExpObjectTbl1,
+ kEobBaseExpObjectTbl2,
+ kEobBaseExpObjectTbl3,
+ kEobBaseExpObjectY,
kEobBaseSparkDefSteps,
kEobBaseSparkDefSubSteps,
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 9936d5f668..d4c4186e6b 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -1103,16 +1103,16 @@ const int eob1FloppyNeed[] = {
kEobBaseMagicStrings2,
kEobBaseMagicStrings3,
kEobBaseMagicStrings4,
- kEobBaseMagicStrings5,
kEobBaseMagicStrings6,
kEobBaseMagicStrings7,
kEobBaseMagicStrings8,
- kEobBaseFlightObjAnimIndex,
- kEobBaseFlightObjAnimDim,
- kEobBaseFlightObjAnimTbl1,
- kEobBaseFlightObjAnimTbl2,
- kEobBaseFlightObjAnimTbl3,
+ kEobBaseExpObjectTblIndex,
+ kEobBaseExpObjectShpStart,
+ kEobBaseExpObjectTbl1,
+ kEobBaseExpObjectTbl2,
+ kEobBaseExpObjectTbl3,
+ kEobBaseExpObjectY,
kEobBaseSparkDefSteps,
kEobBaseSparkDefSubSteps,
@@ -1263,17 +1263,17 @@ const int eob2FloppyNeed[] = {
kEobBaseMagicStrings2,
kEobBaseMagicStrings3,
kEobBaseMagicStrings4,
- kEobBaseMagicStrings5,
kEobBaseMagicStrings6,
kEobBaseMagicStrings7,
kEobBaseMagicStrings8,
- kEobBaseFlightObjAnimTiles,
- kEobBaseFlightObjAnimIndex,
- kEobBaseFlightObjAnimDim,
- kEobBaseFlightObjAnimTbl1,
- kEobBaseFlightObjAnimTbl2,
- kEobBaseFlightObjAnimTbl3,
+ kEobBaseExpObjectTlMode,
+ kEobBaseExpObjectTblIndex,
+ kEobBaseExpObjectShpStart,
+ kEobBaseExpObjectTbl1,
+ kEobBaseExpObjectTbl2,
+ kEobBaseExpObjectTbl3,
+ kEobBaseExpObjectY,
kEobBaseSparkDefSteps,
kEobBaseSparkDefSubSteps,
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index 6dcfdac5ae..fe4b18a0de 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -1878,11 +1878,6 @@ const ExtractEntrySearchData kEobBaseMagicStrings4Provider[] = {
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseMagicStrings5Provider[] = {
- { UNK_LANG, kPlatformPC, { 0x00000008, 0x0000016C, { { 0xCF, 0x5B, 0x04, 0xAB, 0x1A, 0xAF, 0xDD, 0x56, 0xAC, 0xF6, 0x23, 0x86, 0x33, 0x06, 0x5A, 0xC6 } } } },
- EXTRACT_END_ENTRY
-};
-
const ExtractEntrySearchData kEobBaseMagicStrings6Provider[] = {
{ EN_ANY, kPlatformPC, { 0x00000029, 0x00000DA4, { { 0x5C, 0x6F, 0xA1, 0xC2, 0x56, 0xDE, 0xFE, 0xD5, 0x01, 0xFB, 0x65, 0x00, 0x24, 0xD1, 0x49, 0x7B } } } },
{ DE_DEU, kPlatformPC, { 0x00000032, 0x00001211, { { 0x13, 0xBC, 0xF1, 0x03, 0x49, 0xDB, 0x16, 0xA5, 0xC3, 0x7C, 0xBF, 0x14, 0x8F, 0x40, 0x07, 0x8E } } } },
@@ -1907,33 +1902,36 @@ const ExtractEntrySearchData kEobBaseMagicStrings8Provider[] = {
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimTilesProvider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectTlModeProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000012, 0x0000000C, { { 0x98, 0x29, 0x54, 0xCD, 0xED, 0xAC, 0x7B, 0x61, 0x8D, 0x4F, 0x19, 0xE8, 0xA6, 0xB1, 0x51, 0x80 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimIndexProvider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectTblIndexProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000009, 0x00000005, { { 0xFE, 0xEA, 0xC4, 0x54, 0x62, 0x7E, 0x43, 0x6E, 0x89, 0x48, 0x03, 0xE7, 0x47, 0xBF, 0x7D, 0x9D } } } }, // EOB 1
{ UNK_LANG, kPlatformPC, { 0x0000000E, 0x00000004, { { 0x63, 0x27, 0x19, 0x17, 0xBD, 0xC3, 0x8A, 0xA7, 0x1E, 0xF7, 0xD1, 0x78, 0x39, 0x3B, 0xD4, 0x4F } } } }, // EOB 2
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimDimProvider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectShpStartProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x00000034, { { 0x27, 0xC5, 0x09, 0x97, 0x8E, 0xD4, 0xF1, 0x8D, 0x77, 0xEB, 0x1D, 0x34, 0x55, 0xB2, 0x48, 0x38 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimTbl1Provider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectTbl1Provider[] = {
{ UNK_LANG, kPlatformPC, { 0x0000000D, 0x0000005D, { { 0x49, 0xC4, 0x47, 0x55, 0xDC, 0x25, 0x08, 0x03, 0x3D, 0x23, 0xAD, 0x09, 0x5F, 0x9C, 0x34, 0x06 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimTbl2Provider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectTbl2Provider[] = {
{ UNK_LANG, kPlatformPC, { 0x0000000A, 0x0000005C, { { 0xAB, 0x6A, 0x97, 0x35, 0xCC, 0x13, 0xC4, 0x17, 0x0B, 0xF2, 0xD3, 0xFD, 0xA2, 0x1C, 0x6C, 0xA8 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEobBaseFlightObjAnimTbl3Provider[] = {
+const ExtractEntrySearchData kEobBaseExpObjectTbl3Provider[] = {
{ UNK_LANG, kPlatformPC, { 0x0000000B, 0x00000032, { { 0x59, 0x23, 0xB9, 0xBE, 0x0E, 0xFA, 0xEB, 0xDD, 0x82, 0x68, 0x5B, 0xB0, 0xBE, 0x9B, 0x1D, 0x8E } } } },
EXTRACT_END_ENTRY
};
-
+const ExtractEntrySearchData kEobBaseExpObjectYProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000008, 0x0000016C, { { 0xCF, 0x5B, 0x04, 0xAB, 0x1A, 0xAF, 0xDD, 0x56, 0xAC, 0xF6, 0x23, 0x86, 0x33, 0x06, 0x5A, 0xC6 } } } },
+ EXTRACT_END_ENTRY
+};
const ExtractEntrySearchData kEobBaseSparkDefStepsProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000008, 0x000002FD, { { 0xB5, 0x6F, 0x31, 0x5F, 0xC6, 0x47, 0xE9, 0x23, 0x0E, 0x73, 0xBF, 0x77, 0xC7, 0xEE, 0xDB, 0x27 } } } },
@@ -3296,17 +3294,17 @@ const ExtractEntry extractProviders[] = {
{ kEobBaseMagicStrings2, kEobBaseMagicStrings2Provider },
{ kEobBaseMagicStrings3, kEobBaseMagicStrings3Provider },
{ kEobBaseMagicStrings4, kEobBaseMagicStrings4Provider },
- { kEobBaseMagicStrings5, kEobBaseMagicStrings5Provider },
{ kEobBaseMagicStrings6, kEobBaseMagicStrings6Provider },
{ kEobBaseMagicStrings7, kEobBaseMagicStrings7Provider },
{ kEobBaseMagicStrings8, kEobBaseMagicStrings8Provider },
- { kEobBaseFlightObjAnimTiles, kEobBaseFlightObjAnimTilesProvider },
- { kEobBaseFlightObjAnimIndex, kEobBaseFlightObjAnimIndexProvider },
- { kEobBaseFlightObjAnimDim, kEobBaseFlightObjAnimDimProvider },
- { kEobBaseFlightObjAnimTbl1, kEobBaseFlightObjAnimTbl1Provider },
- { kEobBaseFlightObjAnimTbl2, kEobBaseFlightObjAnimTbl2Provider },
- { kEobBaseFlightObjAnimTbl3, kEobBaseFlightObjAnimTbl3Provider },
+ { kEobBaseExpObjectTlMode, kEobBaseExpObjectTlModeProvider },
+ { kEobBaseExpObjectTblIndex, kEobBaseExpObjectTblIndexProvider },
+ { kEobBaseExpObjectShpStart, kEobBaseExpObjectShpStartProvider },
+ { kEobBaseExpObjectTbl1, kEobBaseExpObjectTbl1Provider },
+ { kEobBaseExpObjectTbl2, kEobBaseExpObjectTbl2Provider },
+ { kEobBaseExpObjectTbl3, kEobBaseExpObjectTbl3Provider },
+ { kEobBaseExpObjectY, kEobBaseExpObjectYProvider },
{ kEobBaseSparkDefSteps, kEobBaseSparkDefStepsProvider },
{ kEobBaseSparkDefSubSteps, kEobBaseSparkDefSubStepsProvider },
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 49f07acd5f..d40620c7ae 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -22,17 +22,17 @@
#ifdef ENABLE_EOB
-#include "common/config-manager.h"
-
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
-
#include "kyra/loleobbase.h"
#include "kyra/resource.h"
#include "kyra/sound_intern.h"
#include "kyra/script_eob.h"
#include "kyra/timer.h"
+#include "common/config-manager.h"
+
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
namespace Kyra {
EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBaseEngine(system, flags), _numLargeItemShapes(flags.gameID == GI_EOB1 ? 14 : 11),
@@ -229,6 +229,11 @@ Common::Error EobCoreEngine::init() {
assert(_res);
_res->reset();
+ _staticres = new StaticResource(this);
+ assert(_staticres);
+ if (!_staticres->init())
+ error("_staticres->init() failed");
+
if (!screen()->init())
error("screen()->init() failed");
@@ -246,11 +251,6 @@ Common::Error EobCoreEngine::init() {
_screen->loadFont(Screen::FID_6_FNT, "FONT6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "FONT8.FNT");
- _staticres = new StaticResource(this);
- assert(_staticres);
- if (!_staticres->init())
- error("_staticres->init() failed");
-
Common::Error err = LolEobBaseEngine::init();
if (err.getCode() != Common::kNoError)
return err;
@@ -1383,7 +1383,7 @@ void EobCoreEngine::inflictMonsterDamage(EobMonsterInPlay *m, int damage, bool g
m->flags = (m->flags & 0xf7) | 1;
if (_monsterProps[m->type].flags & 0x2000) {
- inflictMonsterDamage_s1(m);
+ explodeMonster(m);
checkSceneUpdateNeed(m->block);
m->hitPointsCur = 0;
} else {
@@ -1827,8 +1827,16 @@ int EobCoreEngine::getMonsterAcHitChanceModifier(int charIndex, int monsterAc) {
return (20 - ((l / mod1[cm]) * mod2[cm])) - monsterAc;
}
-void EobCoreEngine::inflictMonsterDamage_s1(EobMonsterInPlay *m) {
-
+void EobCoreEngine::explodeMonster(EobMonsterInPlay *m) {
+ m->flags |= 2;
+ if (getBlockDistance(m->block, _currentBlock) < 2) {
+ explodeObject(0, _currentBlock, 2);
+ for (int i = 0; i < 6; i++)
+ calcAndInflictCharacterDamage(i, 6, 6, 0, 8, 1, 0);
+ } else {
+ explodeObject(0, m->block, 2);
+ }
+ m->flags &= ~2;
}
void EobCoreEngine::snd_playSoundEffect(int id, int volume) {
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index e2873cbbcf..8b28e86f2e 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -413,7 +413,7 @@ protected:
void launchMagicObject(int charIndex, int type, uint16 startBlock, int startPos, int dir);
bool updateObjectFlight(EobFlyingObject *fo, int block, int pos);
bool updateFlyingObjectHitTest(EobFlyingObject *fo, int block, int pos);
- void updateFlyingObject_s3(EobFlyingObject *fo);
+ void explodeObject(EobFlyingObject *fo, int block, Item item);
void endObjectFlight(EobFlyingObject *fo);
void checkFlyingObjects();
@@ -435,12 +435,15 @@ protected:
const int8 *_flightObjShpMap;
const int8 *_flightObjSclIndex;
- const uint8 *_flightObjAnimTiles;
- const uint8 *_flightObjAnimIndex;
- const uint8 *_flightObjAnimDim;
- const uint8 *_flightObjAnimTbl1;
- const uint8 *_flightObjAnimTbl2;
- const uint8 *_flightObjAnimTbl3;
+ const uint8 *_expObjectTlMode;
+ const uint8 *_expObjectTblIndex;
+ const uint8 *_expObjectShpStart;
+ const uint8 *_expObjectAnimTbl1;
+ int _expObjectAnimTbl1Size;
+ const uint8 *_expObjectAnimTbl2;
+ int _expObjectAnimTbl2Size;
+ const uint8 *_expObjectAnimTbl3;
+ int _expObjectAnimTbl3Size;
// Monsters
void loadMonsterShapes(const char *filename, int monsterIndex, bool hasDecorations, int encodeTableIndex);
@@ -545,7 +548,7 @@ protected:
virtual const uint8 *loadDoorShapes(const char *filename, int doorIndex, const uint8*shapeDefs) { return (const uint8*)filename; }
void drawScene(int update);
- void drawSceneShapes();
+ void drawSceneShapes(int start = 0);
void drawDecorations(int index);
int calcNewBlockPositionAndTestPassability(uint16 curBlock, uint16 direction);
@@ -802,8 +805,8 @@ protected:
int getStrDamageModifier(int charIndex);
int getDexHitChanceModifier(int charIndex);
int getMonsterAcHitChanceModifier(int charIndex, int monsterAc);
- void inflictMonsterDamage_s1(EobMonsterInPlay *m);
-
+ void explodeMonster(EobMonsterInPlay *m);
+
int _dstMonsterIndex;
int _inflictMonsterDamageUnk;
int16 _foundMonstersArray[5];
@@ -933,7 +936,6 @@ protected:
const char *const *_magicStrings2;
const char *const *_magicStrings3;
const char *const *_magicStrings4;
- const char *const *_magicStrings5;
const char *const *_magicStrings6;
const char *const *_magicStrings7;
const char *const *_magicStrings8;
diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp
index 9e87b7c931..e536b67324 100644
--- a/engines/kyra/items_eob.cpp
+++ b/engines/kyra/items_eob.cpp
@@ -569,8 +569,69 @@ bool EobCoreEngine::updateFlyingObjectHitTest(EobFlyingObject *fo, int block, in
return false;
}
-void EobCoreEngine::updateFlyingObject_s3(EobFlyingObject *fo) {
+void EobCoreEngine::explodeObject(EobFlyingObject *fo, int block, Item item) {
+ if (_partyResting) {
+ snd_processEnvironmentalSoundEffect(35, _currentBlock);
+ return;
+ }
+
+ const uint8 *table = (_expObjectTblIndex[item] == 0) ? _expObjectAnimTbl1 : ((_expObjectTblIndex[item] == 1) ? _expObjectAnimTbl2 : _expObjectAnimTbl3);
+ int tableSize = (_expObjectTblIndex[item] == 0) ? _expObjectAnimTbl1Size : ((_expObjectTblIndex[item] == 1) ? _expObjectAnimTbl2Size : _expObjectAnimTbl3Size);
+
+ int tl = 0;
+ for (; tl < 18; tl++) {
+ if (_visibleBlockIndex[tl] == block)
+ break;
+ }
+
+ if (tl == 18)
+ return;
+
+ int b = _expObjectTlMode ? _expObjectTlMode[tl] : 2;
+
+ if (b == 0 || (b == 1 && (fo->direction & 1) == (_currentDirection & 1))) {
+ snd_processEnvironmentalSoundEffect(35, _currentBlock);
+ return;
+ }
+ uint8 dm = _dscDimMap[tl];
+ int16 x1 = 0;
+ int16 x2 = 0;
+
+ setLevelShapesDim(tl, x1, x2, 5);
+
+ if (x2 < x1)
+ return;
+
+ if (fo)
+ fo->enable = 0;
+
+ drawScene(1);
+
+ if (fo)
+ fo->enable = 2;
+
+ _screen->fillRect(0, 0, 176, 120, 0, 2);
+ uint8 col = _screen->getPagePixel(2, 0, 0);
+ drawSceneShapes(_expObjectShpStart[dm]);
+
+ setLevelShapesDim(tl, x1, x2, 5);
+ _screen->updateScreen();
+
+ _screen->setGfxParameters(_dscShapeCoords[(tl * 5 + 4) << 1] + 88, 48, col);
+ snd_processEnvironmentalSoundEffect(35, _currentBlock);
+
+ disableSysTimer(2);
+ if (dm == 0) {
+ _screen->drawExplosion(3, 147, 35, 20, 7, table, tableSize);
+ } else if (dm == 1) {
+ _screen->drawExplosion(2, 147, 35, 20, 7, table, tableSize);
+ } else if (dm == 2) {
+ _screen->drawExplosion(1, 147, 35, 20, 7, table, tableSize);
+ } else if (dm == 3) {
+ _screen->drawExplosion(0, 460, 50, 20, 4, table, tableSize);
+ }
+ enableSysTimer(2);
}
void EobCoreEngine::endObjectFlight(EobFlyingObject *fo) {
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index f4fcbeb269..8ddba8607c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -928,7 +928,7 @@ private:
void drawScene(int pageNum);
- void drawSceneShapes();
+ void drawSceneShapes(int start = 0);
void drawDecorations(int index);
void drawBlockEffects(int index, int type);
void drawSpecialGuiShape(int pageNum);
diff --git a/engines/kyra/loleobbase.cpp b/engines/kyra/loleobbase.cpp
index 02ffbea803..a7a47b6531 100644
--- a/engines/kyra/loleobbase.cpp
+++ b/engines/kyra/loleobbase.cpp
@@ -195,8 +195,8 @@ Common::Error LolEobBaseEngine::init() {
return Common::kNoError;
}
-bool LolEobBaseEngine::posWithinRect(int mouseX, int mouseY, int x1, int y1, int x2, int y2) {
- if (mouseX < x1 || mouseX > x2 || mouseY < y1 || mouseY > y2)
+bool LolEobBaseEngine::posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2) {
+ if (posX < x1 || posX > x2 || posY < y1 || posY > y2)
return false;
return true;
}
diff --git a/engines/kyra/loleobbase.h b/engines/kyra/loleobbase.h
index 43a86465bc..831c64467c 100644
--- a/engines/kyra/loleobbase.h
+++ b/engines/kyra/loleobbase.h
@@ -113,7 +113,7 @@ protected:
void timerProcessDoors(int timerNum);
// mouse
- bool posWithinRect(int mouseX, int mouseY, int x1, int y1, int x2, int y2);
+ bool posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2);
virtual void setHandItem(Item itemIndex) = 0;
// Characters
@@ -143,7 +143,7 @@ protected:
virtual void loadBlockProperties(const char *file) = 0;
virtual void drawScene(int pageNum) = 0;
- virtual void drawSceneShapes() = 0;
+ virtual void drawSceneShapes(int start) = 0;
virtual void drawDecorations(int index) = 0;
void setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim);
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index aefe20c06a..16e8996340 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -482,7 +482,7 @@ bool EobCoreEngine::magicObjectHit(EobFlyingObject *fo, int dcTimes, int dcPips,
}
if (res && (fo->flags & 0x40))
- updateFlyingObject_s3(fo);
+ explodeObject(fo, fo->curBlock, fo->item);
else if ((_flags.gameID == GI_EOB1 && fo->item == 5) || (_flags.gameID == GI_EOB2 && fo->item == 4))
res = false;
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 3e9ba09e69..2f93adde3c 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -391,17 +391,17 @@ enum KyraResources {
kEobBaseMagicStrings2,
kEobBaseMagicStrings3,
kEobBaseMagicStrings4,
- kEobBaseMagicStrings5,
kEobBaseMagicStrings6,
kEobBaseMagicStrings7,
kEobBaseMagicStrings8,
- kEobBaseFlightObjAnimTiles,
- kEobBaseFlightObjAnimIndex,
- kEobBaseFlightObjAnimDim,
- kEobBaseFlightObjAnimTbl1,
- kEobBaseFlightObjAnimTbl2,
- kEobBaseFlightObjAnimTbl3,
+ kEobBaseExpObjectTlMode,
+ kEobBaseExpObjectTblIndex,
+ kEobBaseExpObjectShpStart,
+ kEobBaseExpObjectTbl1,
+ kEobBaseExpObjectTbl2,
+ kEobBaseExpObjectTbl3,
+ kEobBaseExpObjectY,
kEobBaseSparkDefSteps,
kEobBaseSparkDefSubSteps,
diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp
index be106a9ec3..a8ca966d49 100644
--- a/engines/kyra/scene_eob.cpp
+++ b/engines/kyra/scene_eob.cpp
@@ -1037,8 +1037,8 @@ void EobCoreEngine::drawScene(int update) {
_sceneUpdateRequired = false;
}
-void EobCoreEngine::drawSceneShapes() {
- for (int i = 0; i < 18; i++) {
+void EobCoreEngine::drawSceneShapes(int start) {
+ for (int i = start; i < 18; i++) {
uint8 t = _dscTileIndex[i];
uint8 s = _visibleBlocks[t]->walls[_sceneDrawVarDown];
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index c2b16cab88..998fb73364 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -1386,7 +1386,7 @@ void LoLEngine::setDefaultButtonState() {
_lampStatusSuspended = false;
}
-void LoLEngine::drawSceneShapes() {
+void LoLEngine::drawSceneShapes(int) {
for (int i = 0; i < 18; i++) {
uint8 t = _dscTileIndex[i];
uint8 s = _visibleBlocks[t]->walls[_sceneDrawVarDown];
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index f095b0409e..b93ab3eafb 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -42,6 +42,8 @@ Screen_Eob::Screen_Eob(EobCoreEngine *vm, OSystem *system) : Screen(vm, system)
_fadeData = 0;
_fadeDataIndex = 0;
_dsX1 = _dsX2 = _dsY1 = _dsY2 = 0;
+ _gfxX = _gfxY = 0;
+ _gfxCol = 0;
_customDimTable = 0;
_dsTempPage = 0;
}
@@ -57,6 +59,8 @@ bool Screen_Eob::init() {
_customDimTable = new ScreenDim*[_screenDimTableCount];
memset(_customDimTable, 0, sizeof(ScreenDim *)* _screenDimTableCount);
+ int temp;
+ _gfxMaxY = _vm->staticres()->loadRawData(kEobBaseExpObjectY, temp);
_fadeData = _vm->resource()->fileData("FADING.DAT", 0);
if (!_fadeData) {
@@ -605,25 +609,6 @@ void Screen_Eob::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
}
}
-void Screen_Eob::drawShapeSetPixel(uint8 * dst, uint8 c) {
- if (_shapeFadeMode[0]) {
- if (_shapeFadeMode[1]) {
- c = *dst;
- } else {
- _shapeFadeInternal &= 7;
- c = *(dst + _shapeFadeInternal++);
- }
- }
-
- if (_shapeFadeMode[1]) {
- uint8 cnt = _shapeFadeMode[1];
- while (cnt--)
- c = _fadeData[_fadeDataIndex + c];
- }
-
- *dst = c;
-}
-
const uint8 *Screen_Eob::scaleShape(const uint8 *shapeData, int steps) {
setShapeFadeMode(1, steps ? true : false);
@@ -700,24 +685,133 @@ void Screen_Eob::applyShapeOverlay(uint8 *shp, int ovlIndex) {
shp[i] = ovl[shp[i]];
}
-void Screen_Eob::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
- for (int i = 0; i < _dsDiv; i++) {
- *dst++ = *src++;
- *dst++ = READ_BE_UINT16(src) >> 4;
- src += 2;
+void Screen_Eob::setShapeFrame(int x1, int y1, int x2, int y2) {
+ _dsX1 = x1;
+ _dsY1 = y1;
+ _dsX2 = x2;
+ _dsY2 = y2;
+}
+
+void Screen_Eob::setShapeFadeMode (uint8 i, bool b) {
+ if (!i || i == 1)
+ _shapeFadeMode[i] = b;
+}
+
+void Screen_Eob::setGfxParameters(int x, int y, int col) {
+ _gfxX = x;
+ _gfxY = y;
+ _gfxCol = col;
+}
+
+void Screen_Eob::drawExplosion(int scale, int radius, int numSteps, int stepSize, int aspectRatio, const uint8 *colorTable, int colorTableSize) {
+ int ymin = 0;
+ int ymax = _gfxMaxY[scale];
+ int xmin = -100;
+ int xmax = 276;
+
+ if (scale)
+ --scale;
+
+ hideMouse();
+
+ const ScreenDim *dm = getScreenDim(5);
+ int rX1 = dm->sx << 3;
+ int rY1 = dm->sy;
+ int rX2 = rX1 + (dm->w << 3);
+ int rY2 = rY1 + dm->h - 1;
+
+ int16 gx2 = _gfxX;
+ int16 gy2 = _gfxY;
+
+ uint8 *ptr1 = _dsTempPage;
+ int16 *ptr2 = (int16*)_dsTempPage;
+ int16 *ptr3 = (int16*)&_dsTempPage[300];
+ int16 *ptr4 = (int16*)&_dsTempPage[600];
+ int16 *ptr5 = (int16*)&_dsTempPage[900];
+ int16 *ptr6 = (int16*)&_dsTempPage[1200];
+ int16 *ptr7 = (int16*)&_dsTempPage[1500];
+ int16 *ptr8 = (int16*)&_dsTempPage[1800];
+
+ if (numSteps > 150)
+ numSteps = 150;
+
+ for (int i = 0; i < numSteps; i++) {
+ ptr2[i] = ptr3[i] = 0;
+ ptr4[i] = _vm->_rnd.getRandomNumberRng(0, radius) - (radius >> 1);
+ ptr5[i] = _vm->_rnd.getRandomNumberRng(0, radius) - (radius >> 1) - (radius >> (8 - aspectRatio));
+ ptr7[i] = _vm->_rnd.getRandomNumberRng(1024/stepSize, 2048/stepSize);
+ ptr8[i] = scale << 8;
}
- if (_dsRem == 1) {
- *dst++ = *src++;
- *dst++ = _dsScaleTmp;
+ for (int l = 2; l;) {
+ if (l != 2) {
+ for (int i = numSteps - 1; i >= 0; i--) {
+ uint32 end = _system->getMillis() + 1;
+ int16 px = ((ptr2[i] >> 6) >> scale) + gx2;
+ int16 py = ((ptr3[i] >> 6) >> scale) + gy2;
+ if (py > ymax)
+ py = ymax;
+ if (posWithinRect(px, py, rX1, rY1, rX2, rY2)) {
+ setPagePixel(0, px, py, ptr6[i]);
+ if (i % 5 == 0) {
+ updateScreen();
+ uint32 cur = _system->getMillis();
+ if (end > cur)
+ _system->delayMillis(end - cur);
+ }
+ }
+ }
+ }
- } if (_dsRem == 2) {
- *dst++ = (src[0] & 0xf0) | (src[1] >> 4);
- src += 2;
- *dst++ = _dsScaleTmp;
- *dst++ = _dsScaleTmp;
- *dst++ = _dsScaleTmp;
+ l = 0;
+
+ for (int i = 0; i < numSteps; i++) {
+ uint32 end = _system->getMillis() + 1;
+ if (ptr4[i] <= 0)
+ ptr4[i]++;
+ else
+ ptr4[i]--;
+ ptr2[i] += ptr4[i];
+ ptr5[i] += 5;
+ ptr3[i] += ptr5[i];
+ ptr8[i] += ptr7[i];
+
+ int16 px = ((ptr2[i] >> 6) >> scale) + gx2;
+ int16 py = ((ptr3[i] >> 6) >> scale) + gy2;
+ if (py >= ymax || py < ymin)
+ ptr5[i] = -(ptr5[i] >> 1);
+ if (px >= xmax || px < xmin)
+ ptr4[i] = -(ptr4[i] >> 1);
+
+ if (py > ymax)
+ py = ymax;
+
+ int pxVal1 = 0;
+ if (posWithinRect(px, py, 0, 0, 319, 199)) {
+ pxVal1 = getPagePixel(2, px, py);
+ ptr6[i] = getPagePixel(0, px, py);
+ }
+
+ assert((ptr8[i] >> 8) < colorTableSize);
+ int pxVal2 = colorTable[ptr8[i] >> 8];
+ if (pxVal2) {
+ l = 1;
+ if (pxVal1 == _gfxCol && posWithinRect(px, py, rX1, rY1, rX2, rY2)) {
+ setPagePixel(0, px, py, pxVal2);
+ if (i % 5 == 0) {
+ updateScreen();
+ uint32 cur = _system->getMillis();
+ if (end > cur)
+ _system->delayMillis(end - cur);
+ }
+ }
+ } else {
+ ptr7[i] = 0;
+ }
+ }
}
+
+ showMouse();
}
void Screen_Eob::fadeTextColor(Palette *pal, int color1, int rate) {
@@ -778,6 +872,14 @@ bool Screen_Eob::delayedFadePalStep(Palette *fadePal, Palette *destPal, int rate
return res;
}
+int Screen_Eob::getRectSize(int w, int h) {
+ return w * h;
+}
+
+void Screen_Eob::setFadeTableIndex(int index) {
+ _fadeDataIndex = (CLIP(index, 0, 7) << 8);
+}
+
void Screen_Eob::createFadeTable(uint8 *palData, uint8 *dst, uint8 rootColor, uint8 weight) {
if (!palData)
return;
@@ -821,6 +923,55 @@ void Screen_Eob::createFadeTable(uint8 *palData, uint8 *dst, uint8 rootColor, ui
}
}
+uint8 *Screen_Eob::getFadeTable(int index) {
+ return (index >= 0 && index < 5) ? &_fadeData[index << 8] : 0;
+}
+
+void Screen_Eob::drawShapeSetPixel(uint8 * dst, uint8 c) {
+ if (_shapeFadeMode[0]) {
+ if (_shapeFadeMode[1]) {
+ c = *dst;
+ } else {
+ _shapeFadeInternal &= 7;
+ c = *(dst + _shapeFadeInternal++);
+ }
+ }
+
+ if (_shapeFadeMode[1]) {
+ uint8 cnt = _shapeFadeMode[1];
+ while (cnt--)
+ c = _fadeData[_fadeDataIndex + c];
+ }
+
+ *dst = c;
+}
+
+void Screen_Eob::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
+ for (int i = 0; i < _dsDiv; i++) {
+ *dst++ = *src++;
+ *dst++ = READ_BE_UINT16(src) >> 4;
+ src += 2;
+ }
+
+ if (_dsRem == 1) {
+ *dst++ = *src++;
+ *dst++ = _dsScaleTmp;
+
+ } if (_dsRem == 2) {
+ *dst++ = (src[0] & 0xf0) | (src[1] >> 4);
+ src += 2;
+ *dst++ = _dsScaleTmp;
+ *dst++ = _dsScaleTmp;
+ *dst++ = _dsScaleTmp;
+ }
+}
+
+bool Screen_Eob::posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2) {
+ if (posX < x1 || posX > x2 || posY < y1 || posY > y2)
+ return false;
+ return true;
+}
+
OldDOSFont::OldDOSFont() {
_data = 0;
_width = _height = _numGlyphs = 0;
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 038ba85791..19cbdb5b4a 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -61,20 +61,32 @@ public:
void replaceShapePalette(uint8 *shp, const uint8 *pal);
void applyShapeOverlay(uint8 *shp, int ovlIndex);
- void setShapeFrame(int x1, int y1, int x2, int y2) { _dsX1 = x1; _dsY1 = y1; _dsX2 = x2; _dsY2 = y2; }
- void setShapeFadeMode (uint8 i, bool b) { if (!i || i == 1) _shapeFadeMode[i] = b; }
+ void setShapeFrame(int x1, int y1, int x2, int y2);
+ void setShapeFadeMode (uint8 i, bool b);
+
+ void setGfxParameters(int x, int y, int col);
+ void drawExplosion(int scale, int radius, int numSteps, int stepSize, int aspectRatio, const uint8 *colorTable, int colorTableSize);
void fadeTextColor(Palette *pal, int color1, int fadeTextColor);
bool delayedFadePalStep(Palette *fadePal, Palette *destPal, int rate);
void setTextColorMap(const uint8 *cmap) {}
- int getRectSize(int w, int h) { return w * h; }
+ int getRectSize(int w, int h);
- void setFadeTableIndex(int index) { _fadeDataIndex = (CLIP(index, 0, 7) << 8); }
+ void setFadeTableIndex(int index);
void createFadeTable(uint8 *palData, uint8 *dst, uint8 rootColor, uint8 weight);
- uint8 *getFadeTable(int index) { return (index >= 0 && index < 5) ? &_fadeData[index << 8] : 0; }
+ uint8 *getFadeTable(int index);
+
+private:
+ void drawShapeSetPixel(uint8 *dst, uint8 c);
+ void scaleShapeProcessLine(uint8 *&dst, const uint8 *&src);
+ bool posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2);
+
+ int _dsDiv, _dsRem, _dsScaleTmp;
+ int16 _gfxX, _gfxY;
+ uint8 _gfxCol;
+ const uint8 *_gfxMaxY;
-protected:
int16 _dsX1, _dsX2, _dsY1, _dsY2;
bool _shapeFadeMode[2];
uint16 _shapeFadeInternal;
@@ -87,13 +99,7 @@ protected:
static const int _screenDimTableCount;
ScreenDim **_customDimTable;
- int _curDimIndex;
-
-private:
- void drawShapeSetPixel(uint8 *dst, uint8 c);
- void scaleShapeProcessLine(uint8 *&dst, const uint8 *&src);
-
- int _dsDiv, _dsRem, _dsScaleTmp;
+ int _curDimIndex;
};
} // End of namespace Kyra
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index e25508f459..a291a486f4 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -454,17 +454,16 @@ void EobCoreEngine::initStaticResource() {
_magicStrings2 = _staticres->loadStrings(kEobBaseMagicStrings2, temp);
_magicStrings3 = _staticres->loadStrings(kEobBaseMagicStrings3, temp);
_magicStrings4 = _staticres->loadStrings(kEobBaseMagicStrings4, temp);
- _magicStrings5 = _staticres->loadStrings(kEobBaseMagicStrings5, temp);
_magicStrings6 = _staticres->loadStrings(kEobBaseMagicStrings6, temp);
_magicStrings7 = _staticres->loadStrings(kEobBaseMagicStrings7, temp);
_magicStrings8 = _staticres->loadStrings(kEobBaseMagicStrings8, temp);
- _flightObjAnimTiles = _staticres->loadRawData(kEobBaseFlightObjAnimTiles, temp);
- _flightObjAnimIndex = _staticres->loadRawData(kEobBaseFlightObjAnimIndex, temp);
- _flightObjAnimDim = _staticres->loadRawData(kEobBaseFlightObjAnimDim, temp);
- _flightObjAnimTbl1 = _staticres->loadRawData(kEobBaseFlightObjAnimTbl1, temp);
- _flightObjAnimTbl2 = _staticres->loadRawData(kEobBaseFlightObjAnimTbl2, temp);
- _flightObjAnimTbl3 = _staticres->loadRawData(kEobBaseFlightObjAnimTbl3, temp);
+ _expObjectTlMode = _staticres->loadRawData(kEobBaseExpObjectTlMode, temp);
+ _expObjectTblIndex = _staticres->loadRawData(kEobBaseExpObjectTblIndex, temp);
+ _expObjectShpStart = _staticres->loadRawData(kEobBaseExpObjectShpStart, temp);
+ _expObjectAnimTbl1 = _staticres->loadRawData(kEobBaseExpObjectTbl1, _expObjectAnimTbl1Size);
+ _expObjectAnimTbl2 = _staticres->loadRawData(kEobBaseExpObjectTbl2, _expObjectAnimTbl2Size);
+ _expObjectAnimTbl3 = _staticres->loadRawData(kEobBaseExpObjectTbl3, _expObjectAnimTbl3Size);
_sparkEffectDefSteps = _staticres->loadRawData(kEobBaseSparkDefSteps, temp);
_sparkEffectDefSubSteps = _staticres->loadRawData(kEobBaseSparkDefSubSteps, temp);
diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp
index 92c7f34ee6..70b89bee9c 100644
--- a/engines/kyra/timer_eob.cpp
+++ b/engines/kyra/timer_eob.cpp
@@ -232,7 +232,7 @@ void EobCoreEngine::timerProcessFlyingObjects(int timerNum) {
} else {
if (fo->flags & 0x20) {
if (!updateFlyingObjectHitTest(fo, fo->curBlock, fo->curPos))
- updateFlyingObject_s3(fo);
+ explodeObject(fo, fo->curBlock, fo->item);
}
endFlight = true;
}