aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2007-09-23 22:17:57 +0000
committerPaul Gilbert2007-09-23 22:17:57 +0000
commitb4cff6b9bdda3c1d30af9f919a3698b57172522c (patch)
tree9b9d8046b5d50a4c34f13fed19e53c968d9ec2f5 /engines
parent8685b1b45648ffb89468537e8154afbc074a2e4d (diff)
downloadscummvm-rg350-b4cff6b9bdda3c1d30af9f919a3698b57172522c.tar.gz
scummvm-rg350-b4cff6b9bdda3c1d30af9f919a3698b57172522c.tar.bz2
scummvm-rg350-b4cff6b9bdda3c1d30af9f919a3698b57172522c.zip
Converted fields in data that were originally offsets (such as tick proc offsets) to use indexes, allowing for more generic handling of different language versions
svn-id: r29073
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/debugger.cpp2
-rw-r--r--engines/lure/hotspots.cpp97
-rw-r--r--engines/lure/hotspots.h2
-rw-r--r--engines/lure/lure.cpp15
-rw-r--r--engines/lure/luredefs.h39
-rw-r--r--engines/lure/res.cpp24
-rw-r--r--engines/lure/res_struct.cpp6
-rw-r--r--engines/lure/res_struct.h15
-rw-r--r--engines/lure/scripts.cpp2
9 files changed, 115 insertions, 87 deletions
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp
index 87c422c641..bf7793a016 100644
--- a/engines/lure/debugger.cpp
+++ b/engines/lure/debugger.cpp
@@ -311,7 +311,7 @@ bool Debugger::cmd_hotspot(int argc, const char **argv) {
DebugPrintf("Animation Id = %xh, Colour offset = %d\n", hs->animRecordId, hs->colourOffset);
DebugPrintf("Talk Script offset = %xh, Tick Script offset = %xh\n",
hs->talkScriptOffset, hs->tickScriptOffset);
- DebugPrintf("Tick Proc offset = %xh\n", hs->tickProcOffset);
+ DebugPrintf("Tick Proc offset = %xh\n", hs->tickProcId);
DebugPrintf("Tick timeout = %d\n", hs->tickTimeout);
DebugPrintf("NPC Shcedule = %xh\n", hs->npcSchedule);
DebugPrintf("Character mode = %d, delay ctr = %d, pause ctr = %d\n",
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index f3235dd3d9..31f1228a14 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -36,6 +36,7 @@
#include "lure/game.h"
#include "lure/fights.h"
#include "lure/sound.h"
+#include "lure/lure.h"
#include "common/endian.h"
namespace Lure {
@@ -74,7 +75,7 @@ Hotspot::Hotspot(HotspotData *res): _pathFinder(this) {
_override = resources.getHotspotOverride(res->hotspotId);
setAnimation(_data->animRecordId);
- _tickHandler = HotspotTickHandlers::getHandler(_data->tickProcOffset);
+ _tickHandler = HotspotTickHandlers::getHandler(_data->tickProcId);
_nameBuffer[0] = '\0';
if (_hotspotId < FIRST_NONCHARACTER_ID) {
@@ -103,6 +104,11 @@ Hotspot::Hotspot(HotspotData *res): _pathFinder(this) {
Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
assert(character);
+
+ Common::Language language = LureEngine::getReference().getLanguage();
+ uint16 animId = 0x5810;
+ if (language == IT_ITA) animId = 0x58D0;
+
_originalId = objType;
_data = NULL;
_anim = NULL;
@@ -120,7 +126,7 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
_skipFlag = false;
switch (objType) {
- case VOICE_ANIM_ID:
+ case VOICE_ANIM_INDEX:
_roomNumber = character->roomNumber();
_destHotspotId = character->hotspotId();
_startX = character->x() + character->talkX() + 12;
@@ -138,11 +144,11 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
_voiceCtr = 40;
_tickHandler = HotspotTickHandlers::getHandler(VOICE_TICK_PROC_ID);
- setAnimation(VOICE_ANIM_ID);
+ setAnimation(animId);
break;
- case PUZZLED_ANIM_ID:
- case EXCLAMATION_ANIM_ID:
+ case PUZZLED_ANIM_INDEX:
+ case EXCLAMATION_ANIM_INDEX:
_roomNumber = character->roomNumber();
_hotspotId = 0xfffe;
_startX = character->x() + character->talkX() + 12;
@@ -158,8 +164,8 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
_destHotspotId = character->hotspotId();
_tickHandler = HotspotTickHandlers::getHandler(PUZZLED_TICK_PROC_ID);
- setAnimation(VOICE_ANIM_ID);
- setFrameNumber(objType == PUZZLED_ANIM_ID ? 1 : 2);
+ setAnimation(animId);
+ setFrameNumber(objType == PUZZLED_ANIM_INDEX ? 1 : 2);
character->setFrameCtr(_voiceCtr);
break;
@@ -467,7 +473,8 @@ void Hotspot::tick() {
void Hotspot::setTickProc(uint16 newVal) {
if (_data)
- _data->tickProcOffset = newVal;
+ _data->tickProcId = newVal;
+
_tickHandler = HotspotTickHandlers::getHandler(newVal);
}
@@ -763,12 +770,12 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) {
if (idVal == 0x76) {
// Special code id for showing the puzzled talk bubble
- hotspot = new Hotspot(this, PUZZLED_ANIM_ID);
+ hotspot = new Hotspot(this, PUZZLED_ANIM_INDEX);
res.addHotspot(hotspot);
} else if (idVal == 0x120) {
// Special code id for showing the exclamation talk bubble
- hotspot = new Hotspot(this, EXCLAMATION_ANIM_ID);
+ hotspot = new Hotspot(this, EXCLAMATION_ANIM_INDEX);
res.addHotspot(hotspot);
} else if (idVal >= 0x8000) {
@@ -2170,83 +2177,81 @@ void Hotspot::loadFromStream(Common::ReadStream *stream) {
/*------------------------------------------------------------------------*/
-HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) {
- switch (procOffset) {
- case 0:
- case 0x41BD:
+HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procIndex) {
+ switch (procIndex) {
+ case 1:
return defaultHandler;
case STANDARD_CHARACTER_TICK_PROC:
return standardCharacterAnimHandler;
+ case PLAYER_TICK_PROC_ID:
+ return playerAnimHandler;
case VOICE_TICK_PROC_ID:
return voiceBubbleAnimHandler;
case PUZZLED_TICK_PROC_ID:
return puzzledAnimHandler;
- case 0x7207:
+ case 6:
return roomExitAnimHandler;
- case PLAYER_TICK_PROC_ID:
- return playerAnimHandler;
- case 0x7C14:
+ case 7:
case FOLLOWER_TICK_PROC_2:
return followerAnimHandler;
case JAILOR_TICK_PROC_ID:
- case 0x7F02:
+ case 10:
return jailorAnimHandler;
case STANDARD_ANIM_2_TICK_PROC:
return standardAnimHandler2;
case STANDARD_ANIM_TICK_PROC:
return standardAnimHandler;
- case 0x7F54:
+ case 13:
return sonicRatAnimHandler;
- case 0x7F69:
+ case 14:
return droppingTorchAnimHandler;
- case 0x7FA1:
+ case 15:
return playerSewerExitAnimHandler;
- case 0x8009:
+ case 16:
return fireAnimHandler;
- case 0x80C6:
+ case 17:
return sparkleAnimHandler;
- case 0x813F:
+ case 18:
return teaAnimHandler;
- case 0x8180:
+ case 19:
return goewinCaptiveAnimHandler;
- case 0x81B3:
+ case 20:
return prisonerAnimHandler;
- case 0x81F3:
+ case 21:
return catrionaAnimHandler;
- case 0x820E:
+ case 22:
return morkusAnimHandler;
- case 0x8241:
+ case 23:
return grubAnimHandler;
- case 0x82A0:
+ case 24:
return barmanAnimHandler;
- case 0x85ce:
+ case 25:
return skorlAnimHandler;
- case 0x862D:
+ case 26:
return gargoyleAnimHandler;
case GOEWIN_SHOP_TICK_PROC:
return goewinShopAnimHandler;
- case 0x86FA:
- case 0x86FF:
- case 0x871E:
- case 0x873D:
- case 0x8742:
- case 0x8747:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
return skullAnimHandler;
- case 0x87B3:
+ case 34:
return dragonFireAnimHandler;
- case 0x87EC:
+ case 35:
return castleSkorlAnimHandler;
- case 0x882A:
+ case 36:
return rackSerfAnimHandler;
case TALK_TICK_PROC_ID:
return talkAnimHandler;
- case 0x982D:
+ case 38:
return fighterAnimHandler;
case PLAYER_FIGHT_TICK_PROC_ID:
return playerFightAnimHandler;
default:
- error("Unknown tick proc %xh for hotspot", procOffset);
-// return defaultHandler;
+ error("Unknown tick proc Id %xh for hotspot", procIndex);
}
}
@@ -2888,7 +2893,7 @@ void HotspotTickHandlers::followerAnimHandler(Hotspot &h) {
ValueTableData &fields = res.fieldList();
Hotspot *player = res.getActiveHotspot(PLAYER_ID);
- if ((h.resource()->tickProcOffset == FOLLOWER_TICK_PROC_2) || (fields.getField(37) == 0)) {
+ if ((h.resource()->tickProcId == FOLLOWER_TICK_PROC_2) || (fields.getField(37) == 0)) {
if (h.currentActions().isEmpty() && (h.roomNumber() != player->roomNumber())) {
// Character in different room than player
if (h.hotspotId() == GOEWIN_ID)
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index c30faa58c5..78a807b2f9 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -91,7 +91,7 @@ private:
static void fighterAnimHandler(Hotspot &h);
static void playerFightAnimHandler(Hotspot &h);
public:
- static HandlerMethodPtr getHandler(uint16 procOffset);
+ static HandlerMethodPtr getHandler(uint16 procIndex);
};
enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT,
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 6aeb05967f..db71989cba 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -62,6 +62,8 @@ LureEngine::LureEngine(OSystem *system): Engine(system) {
}
int LureEngine::init() {
+ int_engine = this;
+
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
@@ -78,7 +80,6 @@ int LureEngine::init() {
Surface::initialise();
_room = new Room();
_fights = new FightsManager();
- int_engine = this;
return 0;
}
@@ -104,6 +105,18 @@ LureEngine &LureEngine::getReference() {
}
int LureEngine::go() {
+
+ if (ConfMan.getBool("copy_protection")) {
+ CopyProtectionDialog *dialog = new CopyProtectionDialog();
+ bool result = dialog->show();
+ delete dialog;
+ if (_events->quitFlag)
+ return 0;
+
+ if (!result)
+ error("Sorry - copy protection failed");
+ }
+
if (ConfMan.getInt("boot_param") == 0) {
// Show the introduction
Sound.loadSection(INTRO_SOUND_RESOURCE_ID);
diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h
index 091ea7284e..47e39cc283 100644
--- a/engines/lure/luredefs.h
+++ b/engines/lure/luredefs.h
@@ -34,7 +34,7 @@ namespace Lure {
#define SUPPORT_FILENAME "lure.dat"
#define LURE_DAT_MAJOR 1
-#define LURE_DAT_MINOR 21
+#define LURE_DAT_MINOR 22
#define LURE_DEBUG 1
@@ -133,6 +133,10 @@ enum Action {
// Endgame animation constants
#define ENDGAME_PALETTE_ID 0xFF00
#define ENDGAME_ANIM_ID 0xFF01
+// Miscellaneous resources
+#define COPY_PROTECTION_RESOURCE_ID 0x4139
+#define CREDITS_RESOURCE_ID 0x7800
+#define RESTART_RESOURCE_ID 0x7900
// Specifies the maximum buffer sized allocated for decoding animation data
#define MAX_ANIM_DECODER_BUFFER_SIZE 300000
@@ -158,7 +162,6 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
// Font details
#define FONT_RESOURCE_ID 4
-#define NUM_CHARS_IN_FONT 122
#define FONT_WIDTH 8
#define FONT_HEIGHT 8
@@ -224,6 +227,7 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
#define FIGHT_DATA_RESOURCE_ID 0x3f16
#define STRING_LIST_RESOURCE_ID 0x3f17
#define SOUND_DESC_RESOURCE_ID 0x3f18
+#define STRING_DECODER_RESOURCE_ID 0x3f19
// Script constants
#define STARTUP_SCRIPT 0x23FC
@@ -256,25 +260,24 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
#define BRICKS_ID 0x2714
#define BOOK_ID 0x2723
#define START_NONVISUAL_HOTSPOT_ID 0x7530
-#define CREDITS_RESOURCE_ID 0x7800
-#define RESTART_RESOURCE_ID 0x7900
// Milliseconds delay between game frames
#define GAME_FRAME_DELAY 80
#define GAME_TICK_DELAY 20
// Tick proc constants
-#define STANDARD_CHARACTER_TICK_PROC 0x4f82
-#define PLAYER_TICK_PROC_ID 0x5E44
-#define VOICE_TICK_PROC_ID 0x625E
-#define PUZZLED_TICK_PROC_ID 0x6571
-#define FOLLOWER_TICK_PROC_2 0x7C24
-#define JAILOR_TICK_PROC_ID 0x7efa
-#define STANDARD_ANIM_2_TICK_PROC 0x7F37
-#define STANDARD_ANIM_TICK_PROC 0x7f3a
-#define GOEWIN_SHOP_TICK_PROC 0x865A
-#define TALK_TICK_PROC_ID 0x8ABD
-#define PLAYER_FIGHT_TICK_PROC_ID 0x98B6
+#define NULL_TICK_PROC_ID 1
+#define STANDARD_CHARACTER_TICK_PROC 2
+#define PLAYER_TICK_PROC_ID 3
+#define VOICE_TICK_PROC_ID 4
+#define PUZZLED_TICK_PROC_ID 5
+#define FOLLOWER_TICK_PROC_2 8
+#define JAILOR_TICK_PROC_ID 9
+#define STANDARD_ANIM_2_TICK_PROC 11
+#define STANDARD_ANIM_TICK_PROC 12
+#define GOEWIN_SHOP_TICK_PROC 27
+#define TALK_TICK_PROC_ID 37
+#define PLAYER_FIGHT_TICK_PROC_ID 39
// String constants
#define STRANGER_ID 0x17A
@@ -284,9 +287,9 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
// Misc constants
#define GENERAL_MAGIC_ID 42
#define PLAYER_FIGHT_ANIM_ID 0x55F6
-#define VOICE_ANIM_ID 0x5810
-#define PUZZLED_ANIM_ID 0x8001
-#define EXCLAMATION_ANIM_ID 0x8002
+#define VOICE_ANIM_INDEX 1
+#define PUZZLED_ANIM_INDEX 2
+#define EXCLAMATION_ANIM_INDEX 3
#define SERF_ANIM_ID 0x58A0
#define BLACKSMITH_STANDARD 0x8a12
#define BLACKSMITH_HAMMERING_ANIM_ID 0x9c11
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 983afb7357..65dafc95d6 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -480,10 +480,11 @@ void Resources::setTalkingCharacter(uint16 id) {
assert(character);
// Add the special "voice" animation above the character
- Hotspot *hotspot = new Hotspot(character, VOICE_ANIM_ID);
+ Hotspot *hotspot = new Hotspot(character, VOICE_ANIM_INDEX);
addHotspot(hotspot);
}
}
+uint16 englishLoadOffsets[] = {0x3afe, 0x41BD, 0x7167, 0x7172, 0x8617, 0x88ac, 0};
Hotspot *Resources::activateHotspot(uint16 hotspotId) {
HotspotData *res = getHotspot(hotspotId);
@@ -508,24 +509,23 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) {
uint16 talkIndex;
switch (res->loadOffset) {
- case 0x3afe:
- // Copy protection check - since the game is freeware now,
- // don't bother with it
+ case 1:
+ // Copy protection check - since the game is freeware now, ignore it
loadFlag = false;
break;
- case 0x41BD:
+ case 2:
// Empty handler used to prevent loading hotspots that
// are yet to be active (such as the straw fire)
loadFlag = false;
break;
- case 0x7172:
- case 0x7167:
+ case 3:
+ case 4:
// Standard animation load
break;
- case 0x8617:
+ case 5:
// Custom loader used by the notice hotspot 42ah in room #20
talkIndex = _fieldList.getField(TALK_INDEX);
if ((talkIndex < 8) || (talkIndex >= 14))
@@ -536,14 +536,14 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) {
res->startY = 85;
break;
- case 0x88ac:
+ case 6:
// Torch in room #1
loadFlag = _fieldList.getField(TORCH_HIDE) == 0;
break;
default:
// All others simply activate the hotspot
- warning("Hotspot %d uses unknown load offset proc %d",
+ warning("Hotspot %d uses unknown load offset index %d",
res->hotspotId, res->loadOffset);
}
@@ -552,8 +552,8 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) {
assert(hotspot);
// Special post-load handling
- if (res->loadOffset == 0x7167) hotspot->setPersistant(true);
- if (res->loadOffset == 0x8617) hotspot->handleTalkDialog();
+ if (res->loadOffset == 3) hotspot->setPersistant(true);
+ if (res->loadOffset == 5) hotspot->handleTalkDialog();
// TODO: Figure out why there's a room set in the animation decode for a range of characters,
// particularly since it doesn't seem to match what happens in-game
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 4893308cbb..3754cdf0a0 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -410,7 +410,7 @@ HotspotData::HotspotData(HotspotResource *rec) {
animRecordId = FROM_LE_16(rec->animRecordId);
hotspotScriptOffset = FROM_LE_16(rec->hotspotScriptOffset);
talkScriptOffset = FROM_LE_16(rec->talkScriptOffset);
- tickProcOffset = FROM_LE_16(rec->tickProcOffset);
+ tickProcId = FROM_LE_16(rec->tickProcId);
tickTimeout = FROM_LE_16(rec->tickTimeout);
tickScriptOffset = FROM_LE_16(rec->tickScriptOffset);
npcSchedule = FROM_LE_16(rec->npcSchedule);
@@ -454,7 +454,7 @@ void HotspotData::saveToStream(WriteStream *stream) {
stream->writeUint16LE(heightCopy);
stream->writeUint16LE(yCorrection);
stream->writeUint16LE(hotspotScriptOffset);
- stream->writeUint16LE(tickProcOffset);
+ stream->writeUint16LE(tickProcId);
stream->writeUint16LE(tickTimeout);
stream->writeUint16LE(tickScriptOffset);
stream->writeUint16LE(characterMode);
@@ -495,7 +495,7 @@ void HotspotData::loadFromStream(ReadStream *stream) {
heightCopy = stream->readUint16LE();
yCorrection = stream->readUint16LE();
hotspotScriptOffset = stream->readUint16LE();
- tickProcOffset = stream->readUint16LE();
+ tickProcId = stream->readUint16LE();
tickTimeout = stream->readUint16LE();
tickScriptOffset = stream->readUint16LE();
characterMode = (CharacterMode) stream->readUint16LE();
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 81ecd87563..0f73bd019d 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -83,7 +83,7 @@ struct HotspotResource {
uint16 animRecordId;
uint16 hotspotScriptOffset;
uint16 talkScriptOffset;
- uint16 tickProcOffset;
+ uint16 tickProcId;
uint16 tickTimeout;
uint16 tickScriptOffset;
uint16 npcSchedule;
@@ -277,6 +277,13 @@ public:
return last;
}
+
+ T operator[](int index) {
+ typename Common_List::iterator i = Common_List::begin();
+ while (index-- > 0)
+ ++i;
+ return *i;
+ }
};
/** Enumeration used for direction facings */
@@ -452,7 +459,7 @@ public:
uint16 animRecordId;
uint16 hotspotScriptOffset;
uint16 talkScriptOffset;
- uint16 tickProcOffset;
+ uint16 tickProcId;
uint16 tickTimeout;
uint16 tickScriptOffset;
uint16 npcSchedule;
@@ -772,8 +779,8 @@ extern const RoomTranslationRecord roomTranslations[];
enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28,
S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33,
- S_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38,
- S_FINISH = 39};
+ S_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38, S_FINISH = 39,
+ S_CONFIRM_YN = 40, S_ARTICLE_LIST = 41};
class StringList {
private:
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index da1977f00e..31ed7acfbd 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -235,7 +235,7 @@ void Script::setupSkorlFight(uint16 v1, uint16 v2, uint16 v3) {
void Script::remoteRoomViewSetup(uint16 v1, uint16 v2, uint16 v3) {
Hotspot *player = Resources::getReference().getActiveHotspot(PLAYER_ID);
- player->setTickProc(0); // disable player actions
+ player->setTickProc(NULL_TICK_PROC_ID);
Resources::getReference().fieldList().setField(OLD_ROOM_NUMBER,
player->roomNumber());
}