[Scummvm-cvs-logs] CVS: scummvm/sword1 resman.cpp,1.20,1.21 screen.cpp,1.44,1.45

Chris Apers chrilith at users.sourceforge.net
Thu Oct 21 05:43:20 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17618

Modified Files:
	resman.cpp screen.cpp 
Log Message:
Fixed alignment problem with BS1 demo

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- resman.cpp	19 Aug 2004 15:53:15 -0000	1.20
+++ resman.cpp	21 Oct 2004 12:37:13 -0000	1.21
@@ -21,14 +21,14 @@
 
 #include "stdafx.h"
 #include "scummsys.h"
-#include "memman.h"
-#include "resman.h"
-#include "sworddefs.h"
+#include "sword1/memman.h"
+#include "sword1/resman.h"
+#include "sword1/sworddefs.h"
 #include "base/engine.h"
 #include "common/config-manager.h"
 #include "common/util.h"
 #include "common/str.h"
-#include "swordres.h"
+#include "sword1/swordres.h"
 
 #include "gui/message.h"
 #include "gui/newgui.h"
@@ -308,9 +308,9 @@
 	MemHandle *handle = resHandle(id);
 	// uint32 totSize = handle->size;
 	Header *head = (Header*)handle->data;
-	head->comp_length = FROM_LE_32(head->comp_length);
-	head->decomp_length = FROM_LE_32(head->decomp_length);
-	head->version = FROM_LE_16(head->version);
+	head->comp_length = READ_LE_UINT32(&head->comp_length);
+	head->decomp_length = READ_LE_UINT32(&head->decomp_length);
+	head->version = READ_LE_UINT16(&head->version);
 	uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
 	uint32 size = handle->size - sizeof(Header);
 	if (size & 3)

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- screen.cpp	2 May 2004 13:54:05 -0000	1.44
+++ screen.cpp	21 Oct 2004 12:37:13 -0000	1.45
@@ -20,18 +20,18 @@
  */
 
 #include "stdafx.h"
-#include "screen.h"
-#include "logic.h"
-#include "sworddefs.h"
-#include "text.h"
-#include "resman.h"
-#include "objectman.h"
 #include "scummsys.h"
-#include "common/util.h"
 #include "system.h"
-#include "menu.h"
-#include "sword1.h"
-#include "animation.h"
+#include "common/util.h"
+#include "sword1/screen.h"
+#include "sword1/logic.h"
+#include "sword1/sworddefs.h"
+#include "sword1/text.h"
+#include "sword1/resman.h"
+#include "sword1/objectman.h"
+#include "sword1/menu.h"
+#include "sword1/sword1.h"
+#include "sword1/animation.h"
 
 namespace Sword1 {
 
@@ -368,42 +368,42 @@
 	uint16 spriteY = compact->o_anim_y;
 	if (compact->o_status & STAT_SHRINK) {
 		scale = (compact->o_scale_a * compact->o_ycoord + compact->o_scale_b) / 256;
-		spriteX += ((int16)FROM_LE_16(frameHead->offsetX) * scale) / 256;
-		spriteY += ((int16)FROM_LE_16(frameHead->offsetY) * scale) / 256;
+		spriteX += ((int16)READ_LE_UINT16(&frameHead->offsetX) * scale) / 256;
+		spriteY += ((int16)READ_LE_UINT16(&frameHead->offsetY) * scale) / 256;
 	} else {
 		scale = 256;
-		spriteX += (int16)FROM_LE_16(frameHead->offsetX);
-		spriteY += (int16)FROM_LE_16(frameHead->offsetY);
+		spriteX += (int16)READ_LE_UINT16(&frameHead->offsetX);
+		spriteY += (int16)READ_LE_UINT16(&frameHead->offsetY);
 	}
 	if (scale > 512)
 		debug(1, "compact %d is oversized: scale = %d", id, scale);
 
 	uint8 *tonyBuf = NULL;
 	if (frameHead->runTimeComp[3] == '7') { // RLE7 encoded?
-		decompressRLE7(sprData, FROM_LE_32(frameHead->compSize), _rleBuffer);
+		decompressRLE7(sprData, READ_LE_UINT32(&frameHead->compSize), _rleBuffer);
 		sprData = _rleBuffer;
 	} else if (frameHead->runTimeComp[3] == '0') { // RLE0 encoded?
-		decompressRLE0(sprData, FROM_LE_32(frameHead->compSize), _rleBuffer);
+		decompressRLE0(sprData, READ_LE_UINT32(&frameHead->compSize), _rleBuffer);
 		sprData = _rleBuffer;
 	} else if (frameHead->runTimeComp[1] == 'I') { // new type
-		tonyBuf = (uint8*)malloc(FROM_LE_16(frameHead->width) * FROM_LE_16(frameHead->height));
-		decompressTony(sprData, FROM_LE_32(frameHead->compSize), tonyBuf);
+		tonyBuf = (uint8*)malloc(READ_LE_UINT16(&frameHead->width) * READ_LE_UINT16(&frameHead->height));
+		decompressTony(sprData, READ_LE_UINT32(&frameHead->compSize), tonyBuf);
 		sprData = tonyBuf;
 	}
 
 	uint16 sprSizeX, sprSizeY;
 	if (compact->o_status & STAT_SHRINK) {
-		sprSizeX = (scale * FROM_LE_16(frameHead->width)) / 256;
-		sprSizeY = (scale * FROM_LE_16(frameHead->height)) / 256;
-		fastShrink(sprData, FROM_LE_16(frameHead->width), FROM_LE_16(frameHead->height), scale, _shrinkBuffer);
+		sprSizeX = (scale * READ_LE_UINT16(&frameHead->width)) / 256;
+		sprSizeY = (scale * READ_LE_UINT16(&frameHead->height)) / 256;
+		fastShrink(sprData, READ_LE_UINT16(&frameHead->width), READ_LE_UINT16(&frameHead->height), scale, _shrinkBuffer);
 		sprData = _shrinkBuffer;
 	} else {
-		sprSizeX = FROM_LE_16(frameHead->width);
-		sprSizeY = FROM_LE_16(frameHead->height);
+		sprSizeX = READ_LE_UINT16(&frameHead->width);
+		sprSizeY = READ_LE_UINT16(&frameHead->height);
 	}
 	if (!(compact->o_status & STAT_OVERRIDE)) {
 		//mouse size linked to exact size & coordinates of sprite box - shrink friendly
-		if ((frameHead->offsetX) || (frameHead->offsetY)) {
+		if (READ_LE_UINT16(&frameHead->offsetX) || READ_LE_UINT16(&frameHead->offsetY)) {
 			//for megas the mouse area is reduced to account for sprite not
 			//filling the box size is reduced to 1/2 width, 4/5 height
 			compact->o_mouse_x1 = spriteX + sprSizeX / 4;
@@ -625,7 +625,7 @@
 		if (!(cpt->o_status & STAT_SHRINK)) {     // not a boxed mega using shrinking
 			Header *frameRaw = (Header*)_resMan->openFetchRes(cpt->o_resource);
 			FrameHeader *frameHead = _resMan->fetchFrame(frameRaw, cpt->o_frame);
-			_sortList[_sortLength].y += FROM_LE_16(frameHead->height) - 1; // now pointing to base of sprite
+			_sortList[_sortLength].y += READ_LE_UINT16(&frameHead->height) - 1; // now pointing to base of sprite
 			_resMan->resClose(cpt->o_resource);
 		}
 		_sortLength++;





More information about the Scummvm-git-logs mailing list