[Scummvm-cvs-logs] SF.net SVN: scummvm:[49229] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed May 26 10:32:33 CEST 2010


Revision: 49229
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49229&view=rev
Author:   dreammaster
Date:     2010-05-26 08:32:32 +0000 (Wed, 26 May 2010)

Log Message:
-----------
Gave proper names to each flag in the message flag set

Modified Paths:
--------------
    scummvm/trunk/engines/m4/mads_logic.cpp
    scummvm/trunk/engines/m4/mads_views.cpp
    scummvm/trunk/engines/m4/mads_views.h

Modified: scummvm/trunk/engines/m4/mads_logic.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_logic.cpp	2010-05-26 08:27:24 UTC (rev 49228)
+++ scummvm/trunk/engines/m4/mads_logic.cpp	2010-05-26 08:32:32 UTC (rev 49229)
@@ -83,7 +83,7 @@
 		spriteFrame->y + (spriteFrame->height() / 2)));
 
 	return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, v0, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, 
-		-1, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0);
+		true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0);
 }
 
 uint16 MadsSceneLogic::startCycledSpriteSequence(uint16 srcSpriteIdx, int v0, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) {
@@ -92,7 +92,7 @@
 		spriteFrame->y + (spriteFrame->height() / 2)));
 
 	return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, v0, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, 
-		-1, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0);
+		true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0);
 }
 
 uint16 MadsSceneLogic::startSpriteSequence3(uint16 srcSpriteIdx, int v0, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) {
@@ -101,7 +101,7 @@
 		spriteFrame->y + (spriteFrame->height() / 2)));
 
 	return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, v0, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, 
-		-1, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0);
+		true, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0);
 }
 
 void MadsSceneLogic::activateHotspot(int idx, bool active) {

Modified: scummvm/trunk/engines/m4/mads_views.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_views.cpp	2010-05-26 08:27:24 UTC (rev 49228)
+++ scummvm/trunk/engines/m4/mads_views.cpp	2010-05-26 08:32:32 UTC (rev 49229)
@@ -340,13 +340,13 @@
 	_talkFont = _vm->_font->getFont(FONT_CONVERSATION_MADS);
 }
 
-int MadsKernelMessageList::add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 v2, uint32 timeout, const char *msg) {
+int MadsKernelMessageList::add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg) {
 	// Find a free slot
 	uint idx = 0;
 	while ((idx < _entries.size()) && ((_entries[idx].flags & KMSG_ACTIVE) != 0))
 		++idx;
 	if (idx == _entries.size()) {
-		if (v2 == 0)
+		if (abortTimers == 0)
 			return -1;
 
 		error("MadsKernelList overflow");
@@ -361,28 +361,28 @@
 	rec.textDisplayIndex = -1;
 	rec.timeout = timeout;
 	rec.frameTimer = _madsVm->_currentTimer;
-	rec.field_1C = v2;
+	rec.abortTimers = abortTimers;
 	rec.abortMode = _owner._abortTimersMode2;
 	
 	for (int i = 0; i < 3; ++i)
 		rec.actionNouns[i] = _madsVm->scene()->actionNouns[i];
 
-	if (flags & KMSG_2)
+	if (flags & KMSG_OWNER_TIMEOUT)
 		rec.frameTimer = _owner._ticksAmount + _owner._newTimeout;
 
 	return idx;
 }
 
-int MadsKernelMessageList::addQuote(int quoteId, int v2, uint32 timeout) {
+int MadsKernelMessageList::addQuote(int quoteId, int abortTimers, uint32 timeout) {
 	const char *quoteStr = _madsVm->globals()->getQuote(quoteId);
-	return add(Common::Point(0, 0), 0x1110, KMSG_2 | KMSG_20, v2, timeout, quoteStr);
+	return add(Common::Point(0, 0), 0x1110, KMSG_OWNER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr);
 }
 
-void MadsKernelMessageList::unk1(int msgIndex, int numTicks, int v2) {
+void MadsKernelMessageList::scrollMessage(int msgIndex, int numTicks, bool quoted) {
 	if (msgIndex < 0)
 		return;
 
-	_entries[msgIndex].flags |= (v2 == 0) ? KMSG_8 : (KMSG_8 | KMSG_1);
+	_entries[msgIndex].flags |= quoted ? (KMSG_SCROLL | KMSG_QUOTED) : KMSG_SCROLL;
 	_entries[msgIndex].msgOffset = 0;
 	_entries[msgIndex].numTicks = numTicks;
 	_entries[msgIndex].frameTimer2 = _madsVm->_currentTimer;
@@ -391,7 +391,7 @@
 	_entries[msgIndex].asciiChar = *msgP;
 	_entries[msgIndex].asciiChar2 = *(msgP + 1);
 
-	if (_entries[msgIndex].flags & KMSG_2)
+	if (_entries[msgIndex].flags & KMSG_OWNER_TIMEOUT)
 		_entries[msgIndex].frameTimer2 = _owner._ticksAmount + _owner._newTimeout;
 
 	_entries[msgIndex].frameTimer = _entries[msgIndex].frameTimer2;
@@ -399,7 +399,7 @@
 
 void MadsKernelMessageList::setSeqIndex(int msgIndex, int seqIndex) {
 	if (msgIndex >= 0) {
-		_entries[msgIndex].flags |= KMSG_4;
+		_entries[msgIndex].flags |= KMSG_SEQ_ENTRY;
 		_entries[msgIndex].sequenceIndex = seqIndex;
 	}
 }
@@ -408,9 +408,9 @@
 	MadsKernelMessageEntry &rec = _entries[msgIndex];
 
 	if (rec.flags & KMSG_ACTIVE) {
-		if (rec.flags & KMSG_8) {
-			//*(rec.msg + rec.msgOffset) = rec.asciiChar;
-			//*(rec.msg + rec.msgOffset + 1) = rec.asciiChar2;
+		if (rec.flags & KMSG_SCROLL) {
+			*(rec.msg + rec.msgOffset) = rec.asciiChar;
+			*(rec.msg + rec.msgOffset + 1) = rec.asciiChar2;
 		}
 
 		if (rec.textDisplayIndex >= 0)
@@ -441,26 +441,26 @@
 	uint32 currentTimer = _madsVm->_currentTimer;
 	bool flag = false;
 
-	if ((msg.flags & KMSG_40) != 0) {
+	if ((msg.flags & KMSG_EXPIRE) != 0) {
 		_owner._textDisplay.expire(msg.textDisplayIndex);
 		msg.flags &= !KMSG_ACTIVE;
 		return;
 	}
 
-	if ((msg.flags & KMSG_8) == 0) {
+	if ((msg.flags & KMSG_SCROLL) == 0) {
 		msg.timeout -= 3;
 	}
 
-	if (msg.flags & KMSG_4) {
+	if (msg.flags & KMSG_SEQ_ENTRY) {
 		MadsSequenceEntry &seqEntry = _owner._sequenceList[msg.sequenceIndex];
 		if (seqEntry.doneFlag || !seqEntry.active)
 			msg.timeout = 0;
 	}
 
 	if ((msg.timeout <= 0) && (_owner._abortTimers == 0)) {
-		msg.flags |= KMSG_40;
-		if (msg.field_1C != 0) {
-			_owner._abortTimers = msg.field_1C;
+		msg.flags |= KMSG_EXPIRE;
+		if (msg.abortTimers != 0) {
+			_owner._abortTimers = msg.abortTimers;
 			_owner._abortTimersMode = msg.abortMode;
 
 			if (_owner._abortTimersMode != ABORTMODE_1) {
@@ -473,9 +473,9 @@
 	msg.frameTimer = currentTimer + 3;
 	int x1 = 0, y1 = 0;
 
-	if (msg.flags & KMSG_4) {
+	if (msg.flags & KMSG_SEQ_ENTRY) {
 		MadsSequenceEntry &seqEntry = _owner._sequenceList[msg.sequenceIndex];
-		if (seqEntry.field_12) {
+		if (!seqEntry.nonFixed) {
 			SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(seqEntry.spriteListIndex);
 			M4Sprite *frame = spriteSet.getFrame(seqEntry.frameIndex - 1);
 			x1 = frame->bounds().left;
@@ -486,7 +486,7 @@
 		}
 	}
 	
-	if (msg.flags & KMSG_2) {
+	if (msg.flags & KMSG_OWNER_TIMEOUT) {
 		if (word_8469E != 0) {
 			// TODO: Figure out various flags
 		} else {
@@ -498,7 +498,7 @@
 	x1 += msg.position.x;
 	y1 += msg.position.y;
 
-	if ((msg.flags & KMSG_8) && (msg.frameTimer >= currentTimer)) {
+	if ((msg.flags & KMSG_SCROLL) && (msg.frameTimer >= currentTimer)) {
 		msg.msg[msg.msgOffset] = msg.asciiChar;
 		char *msgP = &msg.msg[++msg.msgOffset];
 		*msgP = msg.asciiChar2;
@@ -507,9 +507,10 @@
 		msg.asciiChar2 = *(msgP + 1);
 
 		if (!msg.asciiChar) {
+			// End of message
 			*msgP = '\0';
-			msg.flags &= ~KMSG_8;
-		} else if (msg.flags & KMSG_1) {
+			msg.flags &= ~KMSG_SCROLL;
+		} else if (msg.flags & KMSG_QUOTED) {
 			*msgP = '"';
 			*(msgP + 1) = '\0';
 		}
@@ -520,8 +521,8 @@
 
 	int strWidth = _talkFont->getWidth(msg.msg, _owner._textSpacing); 
 
-	if (msg.flags & KMSG_30) {
-		x1 -= (msg.flags & KMSG_20) ? strWidth / 2 : strWidth;
+	if (msg.flags & (KMSG_RIGHT_ALIGN | KMSG_CENTER_ALIGN)) {
+		x1 -= (msg.flags & KMSG_CENTER_ALIGN) ? strWidth / 2 : strWidth;
 	}
 
 	// Make sure text appears entirely on-screen
@@ -854,7 +855,7 @@
 }
 
 int MadsSequenceList::add(int spriteListIndex, int v0, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, 
-		int msgX, int msgY, char field_12, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, 
+		int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, 
 		int frameStart) {
 
 	// Find a free slot
@@ -882,7 +883,7 @@
 	_entries[timerIndex].frameInc = frameInc;
 	_entries[timerIndex].depth = depth;
 	_entries[timerIndex].scale = scale;
-	_entries[timerIndex].field_12 = field_12;
+	_entries[timerIndex].nonFixed = nonFixed;
 	_entries[timerIndex].msgPos.x = msgX;
 	_entries[timerIndex].msgPos.y = msgY;
 	_entries[timerIndex].numTicks = numTicks;
@@ -924,7 +925,7 @@
 	spriteSlot.depth = timerEntry.depth;
 	spriteSlot.scale = timerEntry.scale;
 	
-	if (timerEntry.field_12 == 0) {
+	if (!timerEntry.nonFixed) {
 		spriteSlot.xp = timerEntry.msgPos.x;
 		spriteSlot.yp = timerEntry.msgPos.y;
 	} else {

Modified: scummvm/trunk/engines/m4/mads_views.h
===================================================================
--- scummvm/trunk/engines/m4/mads_views.h	2010-05-26 08:27:24 UTC (rev 49228)
+++ scummvm/trunk/engines/m4/mads_views.h	2010-05-26 08:32:32 UTC (rev 49229)
@@ -139,8 +139,8 @@
 #define TIMED_TEXT_SIZE 10
 #define TEXT_4A_SIZE 30
 
-enum KernelMessageFlags {KMSG_1 = 1, KMSG_2 = 2, KMSG_4 = 4, KMSG_8 = 8, KMSG_20 = 0x20, KMSG_30 = 0x30, 
-	KMSG_40 = 0x40, KMSG_ACTIVE = 0x80};
+enum KernelMessageFlags {KMSG_QUOTED = 1, KMSG_OWNER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, KMSG_RIGHT_ALIGN = 0x10, 
+	KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40, KMSG_ACTIVE = 0x80};
 
 class MadsKernelMessageEntry {
 public:
@@ -157,7 +157,7 @@
 	uint32 frameTimer2;
 	uint32 frameTimer;
 	uint32 timeout;
-	bool field_1C;
+	int abortTimers;
 	AbortTimerMode abortMode;
 	uint16 actionNouns[3];
 	char msg[100];
@@ -174,9 +174,9 @@
 	MadsKernelMessageList(MadsView &owner);
 
 	void clear();
-	int add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 v2, uint32 timeout, const char *msg);
-	int addQuote(int quoteId, int v2, uint32 timeout);
-	void unk1(int msgIndex, int v1, int v2);
+	int add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg);
+	int addQuote(int quoteId, int abortTimers, uint32 timeout);
+	void scrollMessage(int msgIndex, int numTicks, bool quoted);
 	void setSeqIndex(int msgIndex, int seqIndex);
 	void remove(int msgIndex);
 	void reset();
@@ -313,7 +313,7 @@
 	int scale;
 	int dynamicHotspotIndex;
 
-	int field_12;
+	bool nonFixed;
 	int field_13;
 	
 	Common::Point msgPos;
@@ -341,7 +341,7 @@
 	void clear();
 	bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal);
 	int add(int spriteListIndex, int v0, int v1, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, 
-		int msgX, int msgY, char field_12, char scale, uint8 depth, int frameInc, SpriteAnimType animType, 
+		int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, 
 		int numSprites, int frameStart);
 	void remove(int timerIndex);
 	void setSpriteSlot(int timerIndex, MadsSpriteSlot &spriteSlot);


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