[Scummvm-cvs-logs] SF.net SVN: scummvm: [26003] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Tue Mar 6 09:24:53 CET 2007


Revision: 26003
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26003&view=rev
Author:   dreammaster
Date:     2007-03-06 00:24:52 -0800 (Tue, 06 Mar 2007)

Log Message:
-----------
Added support for Blacksmith's hammering animation and added Morkus' animation handler

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/hotspots.h
    scummvm/trunk/engines/lure/luredefs.h

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-03-06 08:22:04 UTC (rev 26002)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-03-06 08:24:52 UTC (rev 26003)
@@ -168,12 +168,27 @@
 	Resources &r = Resources::getReference();
 	HotspotAnimData *tempAnim;
 	_animId = newAnimId;
-	if (newAnimId == 0) tempAnim = NULL;
-	else tempAnim = r.getAnimation(newAnimId); 
+	if (newAnimId == 0) 
+		tempAnim = NULL;
+	else {
+		tempAnim = r.getAnimation(newAnimId); 
+		assert(tempAnim != NULL);
+	}
 	
 	setAnimation(tempAnim);
 }
 
+struct SizeOverrideEntry {
+	uint16 animId;
+	uint16 width, height;
+};
+
+static const SizeOverrideEntry sizeOverrides[] = {
+	{BLACKSMITH_STANDARD, 32, 48},
+	{BLACKSMITH_HAMMERING_ANIM_ID, 48, 47},
+	{0, 0, 0}
+};
+
 void Hotspot::setAnimation(HotspotAnimData *newRecord) {
 	Disk &r = Disk::getReference();
 	uint16 tempWidth, tempHeight;
@@ -189,6 +204,13 @@
 	if (!newRecord) return;
 	if (!r.exists(newRecord->animId)) return;
 
+	// Scan for any size overrides - some animations get their size set after decoding, but
+	// we want it in advance so we can decode the animation straight to a graphic surface
+	const SizeOverrideEntry *p = &sizeOverrides[0];
+	while ((p->animId != 0) && (p->animId != newRecord->animId)) ++p;
+	if (p->animId != 0)
+		setSize(p->width, p->height);
+
 	_anim = newRecord;
 	MemoryBlock *src = Disk::getReference().getEntry(_anim->animId);
 	
@@ -210,6 +232,7 @@
 	_numFrames = *numEntries;
 	_frameNumber = 0;
 	
+	// Special handling need
 	if (newRecord->animRecordId == SERF_ANIM_ID) {
 		_frameStartsUsed = true;
 		_frames = new Surface(416, 27);
@@ -376,11 +399,12 @@
 
 void Hotspot::setSize(uint16 newWidth, uint16 newHeight) {
 	_width = newWidth;
+	_frameWidth = newWidth;
 	_height = newHeight;
 }
 
 bool Hotspot::executeScript() {
-	if (_data->sequenceOffset == 0)
+	if (_data->sequenceOffset == 0xffff)
 		return false;
 	else
 		return HotspotScript::execute(this);
@@ -1988,6 +2012,8 @@
 		return prisonerAnimHandler;
 	case 0x81F3:
 		return catrionaAnimHandler;
+	case 0x820E:
+		return morkusAnimHandler;
 	case 0x8241:
 		return headAnimHandler;
 	case 0x882A:
@@ -2012,7 +2038,7 @@
 
 void HotspotTickHandlers::standardAnimHandler2(Hotspot &h) {
 	h.handleTalkDialog();
-	standardCharacterAnimHandler(h);
+	standardAnimHandler(h);
 }
 
 void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) {
@@ -2810,17 +2836,29 @@
 
 void HotspotTickHandlers::catrionaAnimHandler(Hotspot &h) {
 	h.handleTalkDialog();
-	if (h.frameCtr() > 0)
-	{
+	if (h.frameCtr() > 0) {
 		h.decrFrameCtr();
-	}
-	else
-	{
+	} else {
 		h.executeScript();
 		h.setFrameCtr(h.actionCtr());
 	}
 }
 
+void HotspotTickHandlers::morkusAnimHandler(Hotspot &h) {
+	h.handleTalkDialog();
+	if (h.frameCtr() > 0) {
+		h.decrFrameCtr();
+		return;
+	}
+
+	if (h.executeScript()) {
+		// Script is done - set new script to one of two alternates randomly
+		Common::RandomSource rnd;
+		h.setScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0); 
+		h.setFrameCtr(20 + rnd.getRandomNumber(63));
+	}
+}
+
 // Special variables used across multiple calls to talkAnimHandler
 static TalkEntryData *_talkResponse;
 static uint16 talkDestCharacter;

Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h	2007-03-06 08:22:04 UTC (rev 26002)
+++ scummvm/trunk/engines/lure/hotspots.h	2007-03-06 08:24:52 UTC (rev 26003)
@@ -70,6 +70,7 @@
 	static void fireAnimHandler(Hotspot &h);
 	static void prisonerAnimHandler(Hotspot &h);
 	static void catrionaAnimHandler(Hotspot &h);
+	static void morkusAnimHandler(Hotspot &h);
 	static void talkAnimHandler(Hotspot &h);
 	static void headAnimHandler(Hotspot &h);
 	static void rackSerfAnimHandler(Hotspot &h);

Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h	2007-03-06 08:22:04 UTC (rev 26002)
+++ scummvm/trunk/engines/lure/luredefs.h	2007-03-06 08:24:52 UTC (rev 26003)
@@ -31,7 +31,7 @@
 
 #define SUPPORT_FILENAME "lure.dat"
 #define LURE_DAT_MAJOR 1
-#define LURE_DAT_MINOR 15
+#define LURE_DAT_MINOR 16
 
 #define LURE_DEBUG 1
 
@@ -254,6 +254,9 @@
 #define PUZZLED_ANIM_ID 0x8001
 #define EXCLAMATION_ANIM_ID 0x8002
 #define SERF_ANIM_ID 0x58A0
+#define BLACKSMITH_STANDARD 0x8a12
+#define BLACKSMITH_HAMMERING_ANIM_ID 0x9c11
+
 #define CONVERSE_COUNTDOWN_SIZE 40
 #define IDLE_COUNTDOWN_SIZE 15
 #define MAX_TELL_COMMANDS 8


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list