[Scummvm-cvs-logs] CVS: residual Makefile,1.14,1.15 README,1.14,1.15 bitmap.cpp,1.17,1.18 blocky16.cpp,1.5,1.6 lua.cpp,1.45,1.46 main.cpp,1.21,1.22 model.cpp,1.13,1.14 smush.cpp,1.32,1.33

Joost Peters joostp at users.sourceforge.net
Sun Mar 21 07:28:02 CET 2004


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

Modified Files:
	Makefile README bitmap.cpp blocky16.cpp lua.cpp main.cpp 
	model.cpp smush.cpp 
Log Message:
Preliminary BE/Mac support.

To compile on Mac OSX: edit the Makefile and uncomment the OSX LIBS/CXXFLAGS additions (and comment out the -lGL -lGLU line)
and edit lua/src/lvm.c to use the Big Endian macro.


Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile	20 Mar 2004 08:29:12 -0000	1.14
+++ Makefile	21 Mar 2004 15:16:56 -0000	1.15
@@ -4,8 +4,14 @@
 CXXFLAGS = -g -W -Wall -Ilua/include `sdl-config --cflags` -DUNIX \
 	   -Wno-multichar # -O2
 LDFLAGS = -g -W -Wall # -O2
-LIBS =  -Llua/lib -llua -llualib `sdl-config --libs` \
-	-lGL -lGLU -lz
+LIBS =  -Llua/lib -llua -llualib `sdl-config --libs` -lz 
+
+LIBS += -lGL -lGLU
+
+# For OSX use these instead of -lGL and -lGLU
+#LIBS += -framework OpenGL -framework GLUT 
+#CXXFLAGS += -DOSX
+
 OBJS = main.o lab.o bitmap.o model.o resource.o material.o debug.o \
 	textsplit.o lua.o registry.o localize.o scene.o engine.o actor.o \
 	sound.o timer.o keyframe.o costume.o walkplane.o textobject.o \

Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- README	20 Mar 2004 06:22:41 -0000	1.14
+++ README	21 Mar 2004 15:16:56 -0000	1.15
@@ -5,7 +5,7 @@
 What is Residual?
 -----------------
 Residual is a ScummVM (http://www.scummvm.org/) sub-project to play LucasArts'
-LUA-bassed 3D adventures, such as Grim Fandango. Residual is an OpenGL program,
+LUA-based 3D adventures, such as Grim Fandango. Residual is an OpenGL program,
 and requires a 3D card with working OpenGL support.
 
 The main ScummVM program can run LucasArts 2D SCUMM adventures (among others).

Index: bitmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- bitmap.cpp	29 Feb 2004 18:38:25 -0000	1.17
+++ bitmap.cpp	21 Mar 2004 15:16:56 -0000	1.18
@@ -50,13 +50,19 @@
 		if (codec == 0) {
 			memcpy(data_[i], data + pos, 2 * width_ * height_);
 			pos += 2 * width_ * height_ + 8;
-			} else if (codec == 3) {
+		} else if (codec == 3) {
 				int compressed_len = READ_LE_UINT32(data + pos);
 				decompress_codec3(data + pos + 4, data_[i]);
 				pos += compressed_len + 12;
-			}
 		}
 
+	#ifdef SYSTEM_BIG_ENDIAN
+		for (int j = 0; j < width_ * height_; ++j) {
+			((uint16 *)data_[i])[j] = SWAP_BYTES_16(((uint16 *)data_[i])[j]);
+		}
+	#endif
+	}	
+	
 	if (format_ == 1) {
 		num_tex_ = ((width_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
 			((height_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);

Index: blocky16.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/blocky16.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- blocky16.cpp	14 Mar 2004 19:46:24 -0000	1.5
+++ blocky16.cpp	21 Mar 2004 15:16:56 -0000	1.6
@@ -645,10 +645,18 @@
 }
 
 static void bompDecodeMain(byte *dst, const byte *src, int size) {
+	int count = size / 2;
+	byte *start = dst;
+
 	bompInit(src);
 	while (size--) {
 		*dst++ = bompDecode();
 	}
+#ifdef SYSTEM_BIG_ENDIAN              
+        for (int i = 0; i < count; ++i) {
+                ((uint16 *)start)[i] = SWAP_BYTES_16(((uint16 *)start)[i]);
+        }       
+#endif  
 }
 
 void Blocky16::decode(byte *dst, const byte *src) {
@@ -680,6 +688,11 @@
 
 	switch(src[18]) {
 	case 0:
+	#ifdef SYSTEM_BIG_ENDIAN
+                for (int i = 0; i < _width * _height; ++i) {
+                        ((uint16*)gfx_data)[i] = TO_LE_16(((uint16*)gfx_data)[i]);
+                }
+	#endif
 		memcpy(_curBuf, gfx_data, _frameSize);
 		break;
 	case 1:

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- lua.cpp	20 Mar 2004 07:45:34 -0000	1.45
+++ lua.cpp	21 Mar 2004 15:16:56 -0000	1.46
@@ -1084,7 +1084,9 @@
 	if (!unk2)
 		unk3 = check_int(6);		// ?
 
+#ifndef OSX
 	warning("Stub: newObjectState(%d, %s, %s)", setupID, bitmap, zbitmap);
+#endif
 	// object = scene.addObjectState;
 	// lua_pushusertag(object, object_tag);
 }

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- main.cpp	20 Mar 2004 05:47:21 -0000	1.21
+++ main.cpp	21 Mar 2004 15:16:56 -0000	1.22
@@ -88,16 +88,24 @@
 	Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
 
 	SDL_Event event;
+	
+// For some reason we don't get the SDL_VIDEOEXPOSE event on OSX, so just don't wait for it.
+#ifndef OSX
 	while (SDL_PollEvent(&event)) {
 		if (event.type == SDL_VIDEOEXPOSE) {
+#else
+	SDL_PollEvent(&event);
+#endif	
 			g_driver->clearScreen();
 
 			Bitmap::prepareDraw();
 			splash_bm->draw();
 
 			g_driver->flipBuffer();
+#ifndef OSX
 		}
 	}
+#endif
 
 	lua_open();
 

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- model.cpp	24 Feb 2004 22:43:32 -0000	1.13
+++ model.cpp	21 Mar 2004 15:16:56 -0000	1.14
@@ -691,7 +691,7 @@
 		}
 
 		if (SCREENBLOCKS_GLOBAL == 1)
-			screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
+			screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
 	}
 	/*
 	glDisable(GL_DEPTH_TEST);

Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- smush.cpp	20 Mar 2004 05:47:21 -0000	1.32
+++ smush.cpp	21 Mar 2004 15:16:57 -0000	1.33
@@ -63,7 +63,13 @@
 	_movieTime = 0;
 	_videoFinished = false;
 	_videoPause = false;
+//HACK: If we don't set it here, it'll never get set at all..
+//	This is BAD - but until we find the source of the problem, this'll have to do.
+#ifndef OSX
 	_updateNeeded = false;
+#else
+	_updateNeeded = true;
+#endif
 	if (!_surface)
 		_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
 	if (!_bufSurface)
@@ -94,9 +100,11 @@
 	int16 *dst = new int16[size * _channels];
 	decompressVima((char *)src, dst, size * _channels * 2, destTable);
 
+#ifndef SYSTEM_BIG_ENDIAN
 	for (uint32 j = 0; j < size * _channels; j++)
 		dst[j] = SWAP_BYTES_16(dst[j]);
- 
+#endif
+	
 	int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE;
 //	int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN;
 	if (_channels == 2)





More information about the Scummvm-git-logs mailing list