aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-04-20 04:09:02 +0000
committerJames Brown2002-04-20 04:09:02 +0000
commiteb773b477a669427ff84e422bbdb1c3d6b63e8ef (patch)
treefdcef5572f381d4760e150fe5558b6de703f5922
parented65e89a897f66eadc53ce27eb5fe6b39d16a0eb (diff)
downloadscummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.tar.gz
scummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.tar.bz2
scummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.zip
Remove \M's, add IRIX support.
svn-id: r4019
-rw-r--r--Makefile.irix46
-rw-r--r--boxes.cpp1
-rw-r--r--gfx.cpp65
-rw-r--r--object.cpp1
-rw-r--r--saveload.cpp2
-rw-r--r--script_v1.cpp20
-rw-r--r--script_v2.cpp1
-rw-r--r--scumm.h3
-rw-r--r--scummsys.h5
-rw-r--r--scummvm.cpp13
-rw-r--r--simon/simon.cpp4
-rw-r--r--simon/simon.h12
-rw-r--r--v4/resource_v4.cpp4
13 files changed, 165 insertions, 12 deletions
diff --git a/Makefile.irix b/Makefile.irix
new file mode 100644
index 0000000000..58e2db8680
--- /dev/null
+++ b/Makefile.irix
@@ -0,0 +1,46 @@
+CC = CC
+CFLAGS = -O2 -Olimit 9000 -mips2
+#CFLAGS = -g -O -Wall -Wstrict-prototypes -Wuninitialized -Wno-long-long -Wno-multichar
+# Remove -DHAVE_NO_BOOL if your compiler has a builtin bool type
+DEFINES = -DUNIX -DHAVE_NO_BOOL -DCOMPRESSED_SOUND_FILE
+LDFLAGS :=
+INCLUDES:= `sdl-config --cflags` -I./ -I./sound
+CPPFLAGS= $(DEFINES) $(INCLUDES)
+
+# Add -lmad for -DCOMPRESSED_SOUND_FILE
+LIBS = `sdl-config --libs` -lmad -lm
+ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
+
+INCS = scumm.h scummsys.h stdafx.h
+
+OBJS = actor.o boxes.o costume.o gfx.o object.o resource.o \
+ saveload.o script.o scummvm.o sound.o string.o \
+ sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \
+ sound/imuse.o sound/fmopl.o sound/mixer.o debugrl.o \
+ akos.o vars.o insane.o gameDetector.o init.o \
+ v3/resource_v3.o v4/resource_v4.o 2xsai.o main.o \
+ simon/midi.o simon/simon.o simon/simonsys.o sound/mididrv.o
+
+DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
+ debugrl.h whatsnew.txt readme.txt copying.txt \
+ scummvm.dsp scummvm.dsw sound/fmopl.h gui.h sound.h \
+
+.cpp.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+
+all: scummvm
+
+scummvm: $(OBJS)
+ $(CC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
+
+$(OBJS): Makefile
+
+clean:
+ rm -f $(OBJS) scummvm
+
+dist:
+ rm -f $(ZIPFILE)
+ zip -q $(ZIPFILE) $(DISTFILES)
+
+check:
+$(OBJS): $(INCS)
diff --git a/boxes.cpp b/boxes.cpp
index 78ee20f48b..2e4b3e4984 100644
--- a/boxes.cpp
+++ b/boxes.cpp
@@ -29,6 +29,7 @@ byte Scumm::getMaskFromBox(int box)
Box *ptr = getBoxBaseAddr(box);
if (!ptr)
return 0;
+
return ptr->mask;
}
diff --git a/gfx.cpp b/gfx.cpp
index e4c01f2602..1db8e99d81 100644
--- a/gfx.cpp
+++ b/gfx.cpp
@@ -2639,68 +2639,133 @@ void Scumm::drawBomp(BompDrawData * bd)
CHECK_HEAP;
}
+
void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, int16 colorMin, int16 colorMax)
+
{
+
byte *palPtr;
+
byte *curPtr;
+
byte *searchPtr;
+
+
byte colorComp1;
+
byte colorComp2;
+
byte colorComp3;
+
+
byte searchComp1;
+
byte searchComp2;
+
byte searchComp3;
+
+
short int bestResult;
+
short int currentResult;
+
byte currentIndex;
+
+
int i;
+
int j;
+
+
palPtr = getPalettePtr();
+
+
for(i=colorMin;i<colorMax;i++)
+
_proc_special_palette[i]=i;
+
+
curPtr = palPtr + colorMin*3;
+
+
for(i=colorMin;i<colorMax;i++)
+
{
+
/* colorComp1=((((*curPtr++)>>2)*c)>>8)&0x7F;
+
colorComp2=((((*curPtr++)>>2)*d)>>8)&0x7F;
+
colorComp3=((((*curPtr++)>>2)*e)>>8)&0x7F;*/
+
+
/* Yazoo: I can't get the right formula, so I made one that just work fine with SamnMax flashlight */
+
+
colorComp1=(*curPtr++)+10;
+
colorComp2=(*curPtr++)+10;
+
colorComp3=(*curPtr++)+10;
+
+
+
searchPtr = palPtr;
+
bestResult = 0x7FFF;
+
currentIndex = 0;
+
+
for(j=0;j<256;j++)
+
{
+
searchComp1 = (*searchPtr++);
+
searchComp2 = (*searchPtr++);
+
searchComp3 = (*searchPtr++);
+
+
currentResult = abs(searchComp1-colorComp1) + abs(searchComp2-colorComp2) + abs(searchComp3-colorComp3);
+
+
if(currentResult<bestResult)
+
if(currentIndex >= a && currentIndex <= b)
+
{
+
_proc_special_palette[i]=currentIndex;
+
bestResult=currentResult;
+
}
+
+
currentIndex++;
+
}
+
+
}
+
} \ No newline at end of file
diff --git a/object.cpp b/object.cpp
index 48a19c820b..c389cfaacf 100644
--- a/object.cpp
+++ b/object.cpp
@@ -44,6 +44,7 @@ void Scumm::putClass(int obj, int cls, bool set)
cls &= 0x7F;
checkRange(32, 1, cls, "Class %d out of range in getClass");
+
if (_features & GF_SMALL_HEADER) {
if (cls == 32) // CLASS_TOUCHABLE
cls = 24;
diff --git a/saveload.cpp b/saveload.cpp
index 8993b34a53..ccfbd5d92f 100644
--- a/saveload.cpp
+++ b/saveload.cpp
@@ -467,6 +467,7 @@ void Scumm::saveOrLoad(Serializer * s)
MKLINE(Scumm, gdi._transparency, sleByte),
MKARRAY(Scumm, _currentPalette[0], sleByte, 768),
+
/* virtscr */
MKARRAY(Scumm, charset._buffer[0], sleByte, 256),
@@ -566,6 +567,7 @@ void Scumm::saveOrLoad(Serializer * s)
MKARRAY(Scumm, gfxUsageBits[0], sleUint32, 200),
MKLINE(Scumm, gdi._transparency, sleByte),
MKARRAY(Scumm, _currentPalette[0], sleByte, 768),
+
MKARRAY(Scumm, _proc_special_palette[0], sleByte, 256),
/* virtscr */
diff --git a/script_v1.cpp b/script_v1.cpp
index 3b15ce6856..2523097a9f 100644
--- a/script_v1.cpp
+++ b/script_v1.cpp
@@ -836,9 +836,12 @@ void Scumm::o5_actorSetClass()
continue;
}
+
if(_gameId == GID_INDY3_256)
+
newClass--;
+
if (newClass & 0x80)
putClass(act, newClass, 1);
else
@@ -1305,32 +1308,46 @@ void Scumm::o5_getActorX()
{
int actor;
getResultPos();
+
if(_gameId == GID_INDY3_256)
+
actor = getVarOrDirectByte(0x80);
+
else
actor = getVarOrDirectWord(0x80);
+
setResult(getObjX(actor));
}
void Scumm::o5_getActorY()
{
+
int actor;
getResultPos();
+
if(_gameId == GID_INDY3_256)
+
actor = getVarOrDirectByte(0x80);
+
else
+
actor = getVarOrDirectWord(0x80);
setResult(getObjY(actor));
}
void Scumm::o5_getAnimCounter()
{
+
Actor *a;
getResultPos();
+
a=derefActorSafe(getVarOrDirectByte(0x80),"o5_getActorAnimCounter");
+
if(a) // FIXME
setResult(a->cost.animCounter1);
+
else
+
setResult(0);
}
@@ -2207,6 +2224,7 @@ void Scumm::o5_soundKludge()
void Scumm::o5_startMusic()
{
+
addSoundToQueue(getVarOrDirectByte(0x80));
}
@@ -2244,7 +2262,9 @@ void Scumm::o5_startScript()
void Scumm::o5_startSound()
{
+
_vars[VAR_MUSIC_FLAG]=0;
+
addSoundToQueue(getVarOrDirectByte(0x80));
}
diff --git a/script_v2.cpp b/script_v2.cpp
index 8a4df8e907..e61a42448e 100644
--- a/script_v2.cpp
+++ b/script_v2.cpp
@@ -2798,6 +2798,7 @@ void Scumm::o6_miscOps()
case 108: /* create proc_special_palette */
case 109:
+
createSpecialPalette(args[1], args[2],args[3], args[4], args[5], 0, 256);
break;
diff --git a/scumm.h b/scumm.h
index 0f9ddd1a78..781a87d98e 100644
--- a/scumm.h
+++ b/scumm.h
@@ -24,7 +24,7 @@
#include "sound/mixer.h"
#define SCUMMVM_VERSION "0.2.0 devel"
-#define SCUMMVM_CVS "031402"
+#define SCUMMVM_CVS "042002"
#define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
@@ -958,6 +958,7 @@ public:
uint16 _mouthSyncTimes[52];
uint _curSoundPos;
int current_cd_sound;
+
int tempMusic;
#ifdef COMPRESSED_SOUND_FILE
diff --git a/scummsys.h b/scummsys.h
index 07b7c96651..e19957555f 100644
--- a/scummsys.h
+++ b/scummsys.h
@@ -19,6 +19,11 @@
*
*/
+#if defined(HAVE_NO_BOOL)
+typedef int bool;
+const bool true(1), false(0);
+#endif /* HAVE_NO_BOOL */
+
#if defined(_MSC_VER)
//#pragma warning (disable: 4244)
diff --git a/scummvm.cpp b/scummvm.cpp
index 0014384a7f..067d64a3d6 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -53,8 +53,10 @@ void Scumm::scummInit()
int i;
Actor *a;
+
tempMusic=0;
+
debug(9, "scummInit");
if (_features & GF_SMALL_HEADER)
@@ -254,18 +256,29 @@ int Scumm::scummLoop(int delta)
}
}
} else if (_features & GF_OLD256)
+
{
+
if(tempMusic == 3)
+
{
+
tempMusic = 0;
_vars[VAR_MUSIC_FLAG]++;
+
}
+
else
+
{
+
tempMusic ++;
+
}
+
}
+
if (_saveLoadFlag) {
if (_saveLoadFlag == 1) {
saveState(_saveLoadSlot, _saveLoadCompatible);
diff --git a/simon/simon.cpp b/simon/simon.cpp
index f0890e600f..0d9e8db987 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -302,7 +302,7 @@ void SimonState::readItemChildren(FILE *in, Item *item, uint tmp) {
uint j, k;
Child1 *child;
- size = sizeof(Child1);
+ size = CHILD1_SIZE;
for(i=0,j=fr2; i!=6; i++, j>>=2)
if (j&3)
size += sizeof(child->array[0]);
@@ -319,7 +319,7 @@ void SimonState::readItemChildren(FILE *in, Item *item, uint tmp) {
uint i,k,size;
Child2 *child;
- size = sizeof(Child2);
+ size = CHILD2_SIZE;
for(i=0; i!=16; i++)
if (fr & (1<<i))
size += sizeof(child->array[0]);
diff --git a/simon/simon.h b/simon/simon.h
index 1581007fbe..d44271dcfb 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -47,10 +47,10 @@ void fileWriteBE16(FILE *in, uint16 value);
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
#define CHECK_BOUNDS(x,y) assert((uint)(x)<ARRAYSIZE(y))
-#ifdef WIN32
-/* don't complain about zero sized arrays */
-#pragma warning (disable: 4200)
-#endif
+enum {
+ CHILD1_SIZE = 12,
+ CHILD2_SIZE = 16
+};
struct Child {
Child *next;
@@ -62,7 +62,7 @@ struct Child2 {
uint16 string_id;
uint32 avail_props;
- int16 array[0];
+ int16 array[1];
};
struct Child1 {
@@ -70,7 +70,7 @@ struct Child1 {
uint16 subroutine_id;
uint16 fr2;
- uint16 array[0];
+ uint16 array[1];
};
struct Child9 {
diff --git a/v4/resource_v4.cpp b/v4/resource_v4.cpp
index 2514641020..f2b897489e 100644
--- a/v4/resource_v4.cpp
+++ b/v4/resource_v4.cpp
@@ -26,9 +26,7 @@
void Scumm_v4::loadCharset(int no)
{
uint32 size;
-
-
-memset(_charsetData, 0, sizeof(_charsetData));
+ memset(_charsetData, 0, sizeof(_charsetData));
checkRange(4, 0, no, "Loading illegal charset %d");
openRoom(-1);