From fingolfin at users.sourceforge.net Thu Apr 1 17:57:10 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 1 17:57:10 2004
Subject: [Scummvm-cvs-logs] CVS: web/news 20040401.xml,NONE,1.1 20040402.xml,NONE,1.1
Message-ID:
Update of /cvsroot/scummvm/web/news
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32684/news
Added Files:
20040401.xml 20040402.xml
Log Message:
The story of the CABAL...
--- NEW FILE: 20040401.xml ---
Announcing CABAL
Apr 1, 2004
April 1st, THE INTERNET: The FreeSCI,
Sarien and
ScummVM teams
today announced the formation of CABAL (Coalesced 'Adventures beyond
Architecture' League), a universal adventure game interpreter. This
new project will unite the strengths and capabilities of the projects
involved, creating what the project members believe will be a
revolution for adventure game fans around the globe.
When asked about the relevance of CABAL for the worldwide adventure
gaming market, ScummVM project lead Max Horn commented that "[with]
the market for adventure titles waning, we believe that the formation
of a project with the explicit goal of running every adventure game
ever released will infuse it with new life." FreeSCI maintainer
Lars Skovlund added that "this will certainly cause an upheaval in
the gaming world. Adventure game fans around the world, rejoice!".
In addition to supporting LucasArts' SCUMM games (including famous
titles such as "Monkey Island", "Indiana Jones" and "Sam and Max"),
Sierra's SCI and AGI lines ("King's Quest", "Leisure Suit Larry",
"Space Quest"...), and other games already supported by the
retrospective engines, the newly united team plans to continue to add
further titles to their already impressive list.
Some of the juicy new modules include:
- An Infocom module (based on the
Frotz
Z-machine interpreter), so you can now play your favorite text
adventures anywhere you go!
- Exult is being merged in as a plugin, allowing Ultima 7 fans
around the world to play their favorite game on the many platforms
already supported by the CABAL component engines - including
Palm/PocketPC PDAs and the Dreamcast.
- Revolution software has offered the source-code for Broken Sword 3,
which will be added to the titles supported by the upcoming CABAL3D
project - alongside with Grim Fandango and, possibly, Ultima IX
(negotiations are ongoing).
- Support for the SNES games Final Fantasy IV through VI (Japanese
numbering, i.e. FF2/FF3 according to US releases) is planned for
sometime this Fall. Whilst these are not strictly adventure games,
the storyline and plots in this series are more imaginative than any
'action adventure' title published in recent years.
Offers by various companies, including Microsoft and Amiga
International, to buy out the team have been gently but firmly
declined by the leads of the joint project. "We know that we could
earn a lot of money from this, but we are idealists and at this time
we have the goal to reform the worlds adventure market. Once that is
achieved, we can reconsider about making some money out of this."
--- NEW FILE: 20040402.xml ---
Denouncing CABAL
Apr 2, 2004
Five to one against and falling. Four to one against and falling. Three to one. Two. One. Probability factor of one to one. We have normality. I repeat, we have normality. Anything you still can't cope with is therefore your own problem.
from Douglas Adams' The Hitchhiker's Guide to the Galaxy
We hope we were able to contribute to your personal experience during this year's April's fools day. Yes, we know we are evil and mean. No, we will not implement support for your favorite game. Read the FAQ. Read the README. Live long and prosper :-)
From ender at users.sourceforge.net Thu Apr 1 18:10:02 2004
From: ender at users.sourceforge.net (James Brown)
Date: Thu Apr 1 18:10:02 2004
Subject: [Scummvm-cvs-logs] CVS: web/news 20040402.xml,1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/web/news
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2101
Modified Files:
20040402.xml
Log Message:
The real april 2nd announec
Index: 20040402.xml
===================================================================
RCS file: /cvsroot/scummvm/web/news/20040402.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 20040402.xml 2 Apr 2004 01:44:27 -0000 1.1
+++ 20040402.xml 2 Apr 2004 01:57:07 -0000 1.2
@@ -1,10 +1,28 @@
-Denouncing CABAL
-Apr 2, 2004
+There is no Cabal
+Apr 02, 2004
-
-Five to one against and falling. Four to one against and falling. Three to one. Two. One. Probability factor of one to one. We have normality. I repeat, we have normality. Anything you still can't cope with is therefore your own problem.
-from Douglas Adams' The Hitchhiker's Guide to the Galaxy
-
-
-We hope we were able to contribute to your personal experience during this year's April's fools day. Yes, we know we are evil and mean. No, we will not implement support for your favorite game. Read the FAQ. Read the README. Live long and prosper :-)
+
+ CABAL team splits over fundamental design issues
+
+
+ After yesterdays ground-breaking announcement, we are sad to announce the immediate disbandment of the CABAL team.
+ Over the last several days there has been heated debate regarding several important design issues, and current
+tension in the team has risen to an insurmountable level.
+
+
+ "It's really unfortunate", Max Horn, senior developer on ScummVM and Exult, was quoted as saying,
+"but [former FreeSCI maintainer] Christoph [Reichenbach]'s ideas of aligning curly braces with the left-hand
+side of function declarations while appending them to the end of the line for 'while' and 'for' loops did not make
+any sense at all."
+The latter replied by pointing out that "using anything but tabs for indentation is calling for trouble."
+
+
+Claudio Matsuoka, of the Sarien project, pointed out his disappointment and noted that he didn't see much of a
+point in trying to co-operate with people entirely incapable of reaching agreements on such trivial issues. "I
+mean, we haven't even resolved the entire EMACS vs. vi dispute, and they're already at each other's throats
+again."
+James Brown, another senior developer on the ScummVM project, sadly announced that he was laughed out of the project
+meer hours before a decision to split was made. "They just said I didn't belong, since I prefer nano as a
+editor..." he admitted.
+
From fingolfin at users.sourceforge.net Fri Apr 2 12:44:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 12:44:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.205,1.206 script_v6.cpp,1.324,1.325
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4296
Modified Files:
string.cpp script_v6.cpp
Log Message:
Added support for %___ strings (used in localized version of The Dig)
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- string.cpp 19 Mar 2004 23:19:57 -0000 1.205
+++ string.cpp 2 Apr 2004 20:31:39 -0000 1.206
@@ -589,8 +589,15 @@
num = readVar(var);
if (num) {
const byte *ptr = getObjOrActorName(num);
- if (ptr)
- addMessageToStack(ptr, 0, 0);
+ if (ptr) {
+ if ((_version >= 7) && (ptr[0] == '/')) {
+ byte buf[128];
+ translateText(ptr, buf);
+ addMessageToStack(buf, 0, 0);
+ } else {
+ addMessageToStack(ptr, 0, 0);
+ }
+ }
}
}
@@ -613,9 +620,10 @@
if (var) {
ptr = getStringAddress(var);
if (ptr) {
- if ((_version == 8) && (ptr[0] == '/')) {
- translateText(ptr, _transText);
- addMessageToStack(_transText, 0, 0);
+ if ((_version >= 7) && (ptr[0] == '/')) {
+ byte buf[128];
+ translateText(ptr, buf);
+ addMessageToStack(buf, 0, 0);
} else {
addMessageToStack(ptr, 0, 0);
}
@@ -898,6 +906,30 @@
found = (LangIndexNode *)bsearch(&target, _languageIndex, _languageIndexSize, sizeof(LangIndexNode), indexCompare);
if (found != NULL) {
strcpy((char *)trans_buff, _languageBuffer + found->offset);
+
+ // FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
+ if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
+ // Replace any '%___' by the corresponding special codes in the source text
+ const byte *src = text;
+ char *dst = (char *)trans_buff;
+
+ while ((dst = strstr(dst, "%___"))) {
+ // Search for a special code in the message. They have
+ // the form: 255-byte OP-byte ARG-int16
+ while (*src && *src != 0xFF) {
+ src++;
+ }
+
+ // Replace the %___ by the special code
+ if (*src == 0xFF) {
+ memcpy(dst, src, 4);
+ src += 4;
+ dst += 4;
+ } else
+ break;
+ }
+ }
+
return;
}
}
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- script_v6.cpp 27 Mar 2004 20:55:26 -0000 1.324
+++ script_v6.cpp 2 Apr 2004 20:31:39 -0000 1.325
@@ -2479,32 +2479,16 @@
break;
case 16:
case 17:{
- const byte *message;
- byte buf_input[300], buf_output[300];
- message = buf_input;
- addMessageToStack(getStringAddressVar(VAR_STRING2DRAW), buf_input, sizeof(buf_input));
+ byte buf_input[300];
+ const byte *message = getStringAddressVar(VAR_STRING2DRAW);
+
if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
- byte buf_trans[300];
- char *t_ptr = (char *)buf_input;
- buf_output[0] = 0;
- while (t_ptr != NULL) {
- if (*t_ptr == '/') {
- translateText((byte *)t_ptr, buf_trans);
- // hack
- if (strstr((char *)buf_trans, "%___") != 0) {
- strcat((char *)buf_output, " ");
- } else {
- strcat((char *)buf_output, (char *)buf_trans);
- }
- }
- t_ptr = strchr((char *)t_ptr + 1, '/');
- if (t_ptr == NULL)
- break;
- t_ptr = strchr((char *)t_ptr + 1, '/');
- }
- message = buf_output;
+ translateText(message, _transText);
+ message = _transText;
}
- enqueueText(message, args[3], args[4], args[2], args[1], true);
+
+ addMessageToStack(message, buf_input, sizeof(buf_input));
+ enqueueText(buf_input, args[3], args[4], args[2], args[1], true);
break;}
case 20:
// it's used for turn on/off 'RadioChatter' effect for voice in the dig, but i's not needed
From fingolfin at users.sourceforge.net Fri Apr 2 12:48:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 12:48:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v8.cpp,2.241,2.242
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4946
Modified Files:
script_v8.cpp
Log Message:
Shouldn't be necessary to do a second translation run in this place (at least I couldn't find any place were it is)
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.241
retrieving revision 2.242
diff -u -d -r2.241 -r2.242
--- script_v8.cpp 28 Mar 2004 16:30:49 -0000 2.241
+++ script_v8.cpp 2 Apr 2004 20:35:04 -0000 2.242
@@ -531,8 +531,7 @@
case 5:{
byte buffer[256];
addMessageToStack(_transText, buffer, sizeof(buffer));
- translateText(buffer, _transText);
- enqueueText(_transText, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
+ enqueueText(buffer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
}
break;
}
From fingolfin at users.sourceforge.net Fri Apr 2 13:55:07 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 13:55:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.242,1.243 script_v6.cpp,1.325,1.326 script_v6he.cpp,2.40,2.41 script_v8.cpp,2.242,2.243 scumm.h,1.389,1.390 string.cpp,1.206,1.207
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21918
Modified Files:
actor.cpp script_v6.cpp script_v6he.cpp script_v8.cpp scumm.h
string.cpp
Log Message:
simplify code by integrating a call to translateText() into addMessageToStack(); improved translateText() further
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- actor.cpp 19 Mar 2004 23:19:57 -0000 1.242
+++ actor.cpp 2 Apr 2004 21:42:33 -0000 1.243
@@ -1147,14 +1147,11 @@
void ScummEngine::actorTalk(const byte *msg) {
Actor *a;
+ _lastStringTag[0] = 0;
addMessageToStack(msg, _charsetBuffer, sizeof(_charsetBuffer));
- while ((_gameId == GID_DIG || _gameId == GID_CMI) && (_charsetBuffer[0] == '/')) {
- translateText(_charsetBuffer, _transText);
- if (_transText[0] != '/')
- playSpeech(_charsetBuffer);
- memcpy(_charsetBuffer, _transText, MIN(sizeof(_charsetBuffer), sizeof(_transText)));
- }
+ // Play associated speech, if any
+ playSpeech((byte *)_lastStringTag);
// FIXME: Workaround for bugs #770039 and #770049
if (_gameId == GID_LOOM || _gameId == GID_LOOM256) {
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -d -r1.325 -r1.326
--- script_v6.cpp 2 Apr 2004 20:31:39 -0000 1.325
+++ script_v6.cpp 2 Apr 2004 21:42:34 -0000 1.326
@@ -2482,11 +2482,6 @@
byte buf_input[300];
const byte *message = getStringAddressVar(VAR_STRING2DRAW);
- if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
- translateText(message, _transText);
- message = _transText;
- }
-
addMessageToStack(message, buf_input, sizeof(buf_input));
enqueueText(buf_input, args[3], args[4], args[2], args[1], true);
break;}
@@ -3106,20 +3101,18 @@
_string[m].no_talk_anim = true;
break;
case 75: // SO_TEXTSTRING
- translateText(_scriptPointer, _transText);
-
switch (m) {
case 0:
actorTalk(_scriptPointer);
break;
case 1:
- drawString(1, _transText);
+ drawString(1, _scriptPointer);
break;
case 2:
- unkMessage1(_transText);
+ unkMessage1(_scriptPointer);
break;
case 3:
- unkMessage2(_transText);
+ unkMessage2(_scriptPointer);
break;
}
_scriptPointer += resStrLen(_scriptPointer) + 1;
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.40
retrieving revision 2.41
diff -u -d -r2.40 -r2.41
--- script_v6he.cpp 19 Mar 2004 23:19:57 -0000 2.40
+++ script_v6he.cpp 2 Apr 2004 21:42:35 -0000 2.41
@@ -1439,20 +1439,18 @@
_string[m].no_talk_anim = true;
break;
case 75: // SO_TEXTSTRING
- translateText(_scriptPointer, _transText);
-
switch (m) {
case 0:
actorTalk(_scriptPointer);
break;
case 1:
- drawString(1, _transText);
+ drawString(1, _scriptPointer);
break;
case 2:
- unkMessage1(_transText);
+ unkMessage1(_scriptPointer);
break;
case 3:
- unkMessage2(_transText);
+ unkMessage2(_scriptPointer);
break;
}
_scriptPointer += resStrLen(_scriptPointer) + 1;
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.242
retrieving revision 2.243
diff -u -d -r2.242 -r2.243
--- script_v8.cpp 2 Apr 2004 20:35:04 -0000 2.242
+++ script_v8.cpp 2 Apr 2004 21:42:35 -0000 2.243
@@ -513,24 +513,22 @@
_string[m].no_talk_anim = true;
break;
case 0xD1: // SO_PRINT_STRING
- translateText(_scriptPointer, _transText);
-
switch (m) {
case 0:
actorTalk(_scriptPointer);
break;
case 1:
- drawString(1, _transText);
+ drawString(1, _scriptPointer);
break;
case 2:
- unkMessage1(_transText);
+ unkMessage1(_scriptPointer);
break;
case 3:
- unkMessage2(_transText);
+ unkMessage2(_scriptPointer);
break;
case 5:{
byte buffer[256];
- addMessageToStack(_transText, buffer, sizeof(buffer));
+ addMessageToStack(_scriptPointer, buffer, sizeof(buffer));
enqueueText(buffer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
}
break;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.389
retrieving revision 1.390
diff -u -d -r1.389 -r1.390
--- scumm.h 29 Mar 2004 11:02:45 -0000 1.389
+++ scumm.h 2 Apr 2004 21:42:42 -0000 1.390
@@ -1078,6 +1078,7 @@
char *_languageBuffer;
LangIndexNode *_languageIndex;
int _languageIndexSize;
+ char _lastStringTag[12+1];
byte _transText[512];
void loadLanguageBundle();
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- string.cpp 2 Apr 2004 20:31:39 -0000 1.206
+++ string.cpp 2 Apr 2004 21:42:42 -0000 1.207
@@ -470,7 +470,8 @@
uint num = 0;
uint32 val;
byte chr;
- byte buf[512];
+ const byte *buf;
+ byte transBuf[384];
if (dstBuffer) {
_msgPtrToAdd = dstBuffer;
@@ -481,21 +482,11 @@
return;
}
- while ((buf[num++] = chr = *msg++) != 0) {
- if (num >= sizeof(buf))
- error("Message stack overflow");
-
- if (chr == 0xff) { // 0xff is an escape character
- buf[num++] = chr = *msg++; // followed by a "command" code
- if (chr != 1 && chr != 2 && chr != 3 && chr != 8) {
- buf[num++] = *msg++; // and some commands are followed by parameters to the functions below
- buf[num++] = *msg++; // these are numbers of names, strings, verbs, variables, etc
- if (_version == 8) {
- buf[num++] = *msg++;
- buf[num++] = *msg++;
- }
- }
- }
+ if (_version >= 7 && msg[0] == '/') {
+ translateText(msg, transBuf);
+ buf = transBuf;
+ } else {
+ buf = msg;
}
num = 0;
@@ -590,13 +581,7 @@
if (num) {
const byte *ptr = getObjOrActorName(num);
if (ptr) {
- if ((_version >= 7) && (ptr[0] == '/')) {
- byte buf[128];
- translateText(ptr, buf);
- addMessageToStack(buf, 0, 0);
- } else {
- addMessageToStack(ptr, 0, 0);
- }
+ addMessageToStack(ptr, 0, 0);
}
}
}
@@ -620,13 +605,7 @@
if (var) {
ptr = getStringAddress(var);
if (ptr) {
- if ((_version >= 7) && (ptr[0] == '/')) {
- byte buf[128];
- translateText(ptr, buf);
- addMessageToStack(buf, 0, 0);
- } else {
- addMessageToStack(ptr, 0, 0);
- }
+ addMessageToStack(ptr, 0, 0);
}
}
}
@@ -863,15 +842,9 @@
}
void ScummEngine::playSpeech(const byte *ptr) {
- if ((_gameId == GID_DIG || _gameId == GID_CMI) && (ptr[0] == '/')) {
+ if ((_gameId == GID_DIG || _gameId == GID_CMI) && ptr[0]) {
char pointer[20];
- int i, j;
-
- for (i = 0, j = 0; (ptr[i] != '/' || j == 0) && j < 19; i++) {
- if (ptr[i] != '/')
- pointer[j++] = ptr[i];
- }
- pointer[j] = 0;
+ strcpy(pointer, (const char *)ptr);
// Play speech
if (!(_features & GF_DEMO) && (_gameId == GID_CMI)) // CMI demo does not have .IMX for voice
@@ -884,71 +857,61 @@
}
void ScummEngine::translateText(const byte *text, byte *trans_buff) {
- int l;
+ LangIndexNode target;
+ int i;
- if ((text[0] == '/') && _existLanguageFile) {
- LangIndexNode target;
- LangIndexNode *found = NULL;
-
+ if (_version >= 7 && text[0] == '/') {
// copy name from text /..../
- for (l = 0; (l < 12) && (text[l + 1] != '/'); l++)
- target.tag[l] = toupper(text[l + 1]);
- target.tag[l] = 0;
-
- // HACK: These are used for the object line when
- // using one object on another. I don't know if the
- // text in the language file is a placeholder or if
- // we're supposed to use it, but at least in the
- // English version things will work so much better if
- // we can't find translations for these.
-
- if (strcmp(target.tag, "PU_M001") != 0 && strcmp(target.tag, "PU_M002") != 0)
- found = (LangIndexNode *)bsearch(&target, _languageIndex, _languageIndexSize, sizeof(LangIndexNode), indexCompare);
- if (found != NULL) {
- strcpy((char *)trans_buff, _languageBuffer + found->offset);
-
- // FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
- if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
- // Replace any '%___' by the corresponding special codes in the source text
- const byte *src = text;
- char *dst = (char *)trans_buff;
+ for (i = 0; (i < 12) && (text[i + 1] != '/'); i++)
+ _lastStringTag[i] = target.tag[i] = toupper(text[i + 1]);
+ _lastStringTag[i] = target.tag[i] = 0;
+ text += i + 2;
- while ((dst = strstr(dst, "%___"))) {
- // Search for a special code in the message. They have
- // the form: 255-byte OP-byte ARG-int16
- while (*src && *src != 0xFF) {
- src++;
+ if (_existLanguageFile) {
+ LangIndexNode *found = NULL;
+
+ // HACK: These are used for the object line when
+ // using one object on another. I don't know if the
+ // text in the language file is a placeholder or if
+ // we're supposed to use it, but at least in the
+ // English version things will work so much better if
+ // we can't find translations for these.
+
+ if (strcmp(target.tag, "PU_M001") != 0 && strcmp(target.tag, "PU_M002") != 0)
+ found = (LangIndexNode *)bsearch(&target, _languageIndex, _languageIndexSize, sizeof(LangIndexNode), indexCompare);
+ if (found != NULL) {
+ strcpy((char *)trans_buff, _languageBuffer + found->offset);
+
+ // FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
+ if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
+ // Replace any '%___' by the corresponding special codes in the source text
+ const byte *src = text;
+ char *dst = (char *)trans_buff;
+
+ while ((dst = strstr(dst, "%___"))) {
+ // Search for a special code in the message. They have
+ // the form: 255-byte OP-byte ARG-int16
+ while (*src && *src != 0xFF) {
+ src++;
+ }
+
+ // Replace the %___ by the special code
+ if (*src == 0xFF) {
+ memcpy(dst, src, 4);
+ src += 4;
+ dst += 4;
+ } else
+ break;
}
-
- // Replace the %___ by the special code
- if (*src == 0xFF) {
- memcpy(dst, src, 4);
- src += 4;
- dst += 4;
- } else
- break;
}
- }
-
- return;
- }
- }
- byte *pointer = (byte *)strchr((const char *)text + 1, '/');
- if (pointer != NULL) {
- pointer++;
- if (_gameId == GID_CMI) {
- memcpy(trans_buff, pointer, resStrLen(pointer) + 1);
- } else if (_gameId == GID_DIG) {
- l = 0;
- while (*pointer != '/' && *pointer != 0xff && *pointer != 0) {
- trans_buff[l++] = *pointer++;
+ return;
}
- trans_buff[l] = '\0';
}
- } else {
- memcpy(trans_buff, text, resStrLen(text) + 1);
}
+
+ // Default: just copy the string
+ memcpy(trans_buff, text, resStrLen(text) + 1);
}
} // End of namespace Scumm
From fingolfin at users.sourceforge.net Fri Apr 2 13:57:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 13:57:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.107,1.108
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22309
Modified Files:
TODO
Log Message:
One item less on the TODO
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- TODO 29 Mar 2004 09:25:34 -0000 1.107
+++ TODO 2 Apr 2004 21:44:07 -0000 1.108
@@ -251,7 +251,6 @@
Or constantly (well, at least whenever the camera moves) redraw the text.
That would require buffering the text; maybe the blast text code could be
reused for this...
-* Finish formating stuff in subtitles/translation code in the dig.
* Add tool and support for compress *.la* file resources (ex. sounds) to fit
on small devices
* Fix codec44 for nut fonts
From fingolfin at users.sourceforge.net Fri Apr 2 14:05:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 14:05:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm verbs.cpp,1.94,1.95
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23773
Modified Files:
verbs.cpp
Log Message:
Remove obsolete code fragment (a good sign for a refactoring is if it allows you to remove crufty hacks you didn't even think of :-)
Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- verbs.cpp 15 Mar 2004 03:09:48 -0000 1.94
+++ verbs.cpp 2 Apr 2004 21:51:56 -0000 1.95
@@ -399,11 +399,6 @@
if (!msg)
return;
- if ((_version == 8) && (msg[0] == '/')) {
- translateText(msg, _transText);
- msg = _transText;
- }
-
tmp = _charset->_center;
_charset->_center = 0;
drawString(4, msg);
From fingolfin at users.sourceforge.net Fri Apr 2 14:08:13 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 14:08:13 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.207,1.208
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24438
Modified Files:
string.cpp
Log Message:
cleanup
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- string.cpp 2 Apr 2004 21:42:42 -0000 1.207
+++ string.cpp 2 Apr 2004 21:55:30 -0000 1.208
@@ -858,18 +858,19 @@
void ScummEngine::translateText(const byte *text, byte *trans_buff) {
LangIndexNode target;
+ LangIndexNode *found = NULL;
int i;
if (_version >= 7 && text[0] == '/') {
- // copy name from text /..../
+ // Extract the string tag from the text: /..../
for (i = 0; (i < 12) && (text[i + 1] != '/'); i++)
_lastStringTag[i] = target.tag[i] = toupper(text[i + 1]);
_lastStringTag[i] = target.tag[i] = 0;
text += i + 2;
+ // If a language file was loaded, try to find a translated version
+ // by doing a lookup on the string tag.
if (_existLanguageFile) {
- LangIndexNode *found = NULL;
-
// HACK: These are used for the object line when
// using one object on another. I don't know if the
// text in the language file is a placeholder or if
@@ -879,39 +880,38 @@
if (strcmp(target.tag, "PU_M001") != 0 && strcmp(target.tag, "PU_M002") != 0)
found = (LangIndexNode *)bsearch(&target, _languageIndex, _languageIndexSize, sizeof(LangIndexNode), indexCompare);
- if (found != NULL) {
- strcpy((char *)trans_buff, _languageBuffer + found->offset);
-
- // FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
- if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
- // Replace any '%___' by the corresponding special codes in the source text
- const byte *src = text;
- char *dst = (char *)trans_buff;
-
- while ((dst = strstr(dst, "%___"))) {
- // Search for a special code in the message. They have
- // the form: 255-byte OP-byte ARG-int16
- while (*src && *src != 0xFF) {
- src++;
- }
-
- // Replace the %___ by the special code
- if (*src == 0xFF) {
- memcpy(dst, src, 4);
- src += 4;
- dst += 4;
- } else
- break;
- }
+ }
+ }
+
+ if (found != NULL) {
+ strcpy((char *)trans_buff, _languageBuffer + found->offset);
+
+ // FIXME / TODO: Maybe this should be enabled for Full Throttle, too?
+ if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) {
+ // Replace any '%___' by the corresponding special codes in the source text
+ const byte *src = text;
+ char *dst = (char *)trans_buff;
+
+ while ((dst = strstr(dst, "%___"))) {
+ // Search for a special code in the message.
+ while (*src && *src != 0xFF) {
+ src++;
}
-
- return;
+
+ // Replace the %___ by the special code. Luckily, we can do
+ // that in-place.
+ if (*src == 0xFF) {
+ memcpy(dst, src, 4);
+ src += 4;
+ dst += 4;
+ } else
+ break;
}
}
+ } else {
+ // Default: just copy the string
+ memcpy(trans_buff, text, resStrLen(text) + 1);
}
-
- // Default: just copy the string
- memcpy(trans_buff, text, resStrLen(text) + 1);
}
} // End of namespace Scumm
From fingolfin at users.sourceforge.net Fri Apr 2 14:09:10 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 14:09:10 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush smush_player.cpp,1.114,1.115
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24601/smush
Modified Files:
smush_player.cpp
Log Message:
Got rid of _transText
Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- smush_player.cpp 28 Mar 2004 16:30:49 -0000 1.114
+++ smush_player.cpp 2 Apr 2004 21:56:27 -0000 1.115
@@ -512,11 +512,12 @@
str++; // For Full Throttle text resources
}
+ byte transBuf[512];
if (_vm->_gameId == GID_CMI) {
- _vm->translateText((const byte *)str - 1, _vm->_transText);
+ _vm->translateText((const byte *)str - 1, _transText);
while (*str++ != '/')
;
- string2 = (char *)_vm->_transText;
+ string2 = (char *)transBuf;
// If string2 contains formatting information there probably
// wasn't any translation for it in the language.tab file. In
From fingolfin at users.sourceforge.net Fri Apr 2 14:09:11 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 14:09:11 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v8.cpp,2.243,2.244 scumm.cpp,1.13,1.14 scumm.h,1.390,1.391
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24601
Modified Files:
script_v8.cpp scumm.cpp scumm.h
Log Message:
Got rid of _transText
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.243
retrieving revision 2.244
diff -u -d -r2.243 -r2.244
--- script_v8.cpp 2 Apr 2004 21:42:35 -0000 2.243
+++ script_v8.cpp 2 Apr 2004 21:56:27 -0000 2.244
@@ -1559,13 +1559,14 @@
int oldID = _charset->getCurID();
int width;
const byte *msg = _scriptPointer;
+ byte transBuf[512];
// Skip to the next instruction
_scriptPointer += resStrLen(_scriptPointer) + 1;
if (msg[0] == '/') {
- translateText(msg, _transText);
- msg = _transText;
+ translateText(msg, transBuf);
+ msg = transBuf;
}
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- scumm.cpp 30 Mar 2004 22:56:57 -0000 1.13
+++ scumm.cpp 2 Apr 2004 21:56:27 -0000 1.14
@@ -511,7 +511,6 @@
_existLanguageFile = false;
_languageBuffer = NULL;
_languageIndex = NULL;
- memset(_transText, 0, sizeof(_transText));
_costumeRenderer = NULL;
_2byteFontPtr = 0;
_V1_talkingActor = 0;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.390
retrieving revision 1.391
diff -u -d -r1.390 -r1.391
--- scumm.h 2 Apr 2004 21:42:42 -0000 1.390
+++ scumm.h 2 Apr 2004 21:56:27 -0000 1.391
@@ -1079,7 +1079,6 @@
LangIndexNode *_languageIndex;
int _languageIndexSize;
char _lastStringTag[12+1];
- byte _transText[512];
void loadLanguageBundle();
void playSpeech(const byte *ptr);
From fingolfin at users.sourceforge.net Fri Apr 2 14:14:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 14:14:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush smush_player.cpp,1.115,1.116
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25577/smush
Modified Files:
smush_player.cpp
Log Message:
oops
Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- smush_player.cpp 2 Apr 2004 21:56:27 -0000 1.115
+++ smush_player.cpp 2 Apr 2004 22:01:25 -0000 1.116
@@ -514,7 +514,7 @@
byte transBuf[512];
if (_vm->_gameId == GID_CMI) {
- _vm->translateText((const byte *)str - 1, _transText);
+ _vm->translateText((const byte *)str - 1, transBuf);
while (*str++ != '/')
;
string2 = (char *)transBuf;
From fingolfin at users.sourceforge.net Fri Apr 2 17:10:05 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 2 17:10:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.14,1.15 sound.cpp,1.322,1.323 string.cpp,1.208,1.209
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22377
Modified Files:
scumm.cpp sound.cpp string.cpp
Log Message:
cleanup
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- scumm.cpp 2 Apr 2004 21:56:27 -0000 1.14
+++ scumm.cpp 3 Apr 2004 00:56:53 -0000 1.15
@@ -505,7 +505,6 @@
_copyProtection = false;
_demoMode = false;
_confirmExit = false;
- _msgPtrToAdd = NULL;
_talkDelay = 0;
_keepText = false;
_existLanguageFile = false;
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.322
retrieving revision 1.323
diff -u -d -r1.322 -r1.323
--- sound.cpp 15 Mar 2004 03:33:08 -0000 1.322
+++ sound.cpp 3 Apr 2004 00:56:54 -0000 1.323
@@ -881,8 +881,8 @@
#ifdef USE_FLAC
if (!file->isOpen()) {
sprintf(buf, "%s.sof", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath()))
- file->open("monster.sof", _vm->getGameDataPath());
+ if (!file->open(buf))
+ file->open("monster.sof");
if (file->isOpen())
_sound_mode = kFlacMode;
}
@@ -891,8 +891,8 @@
#ifdef USE_MAD
if (!file->isOpen()) {
sprintf(buf, "%s.so3", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath()))
- file->open("monster.so3", _vm->getGameDataPath());
+ if (!file->open(buf))
+ file->open("monster.so3");
if (file->isOpen())
_sound_mode = kMP3Mode;
}
@@ -901,8 +901,8 @@
#ifdef USE_VORBIS
if (!file->isOpen()) {
sprintf(buf, "%s.sog", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath()))
- file->open("monster.sog", _vm->getGameDataPath());
+ if (!file->open(buf))
+ file->open("monster.sog");
if (file->isOpen())
_sound_mode = kVorbisMode;
}
@@ -943,8 +943,8 @@
}
sprintf(buf, "%s.sou", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.sou", _vm->getGameDataPath());
+ if (!file->open(buf)) {
+ file->open("monster.sou");
}
if (!file->isOpen()) {
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- string.cpp 2 Apr 2004 21:55:30 -0000 1.208
+++ string.cpp 3 Apr 2004 00:56:55 -0000 1.209
@@ -719,9 +719,9 @@
int32 size;
if (_gameId == GID_DIG) {
- file.open("language.bnd", getGameDataPath());
+ file.open("language.bnd");
} else if (_gameId == GID_CMI) {
- file.open("language.tab", getGameDataPath());
+ file.open("language.tab");
} else {
return;
}
From khalek at users.sourceforge.net Fri Apr 2 23:32:00 2004
From: khalek at users.sourceforge.net (Jonathan Gray)
Date: Fri Apr 2 23:32:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.72,1.73
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7924
Modified Files:
Makefile
Log Message:
make hdiutil overwrite the disk image if it already exists, although it will still fail if it is already attached
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- Makefile 29 Mar 2004 12:22:03 -0000 1.72
+++ Makefile 3 Apr 2004 07:19:10 -0000 1.73
@@ -121,7 +121,7 @@
cp COPYING ./ScummVM-snapshot/License
/Developer/Tools/SetFile -t TEXT -c ttxt ./ScummVM-snapshot/*
/Developer/Tools/CpMac -r $(bundle_name) ./ScummVM-snapshot/
- hdiutil create -format UDZO -srcfolder ScummVM-snapshot ScummVM-snapshot.dmg
+ hdiutil create -ov -format UDZO -srcfolder ScummVM-snapshot ScummVM-snapshot.dmg
rm -rf ScummVM-snapshot
# Special target to create a win32 snapshot binary
From khalek at users.sourceforge.net Fri Apr 2 23:48:02 2004
From: khalek at users.sourceforge.net (Jonathan Gray)
Date: Fri Apr 2 23:48:02 2004
Subject: [Scummvm-cvs-logs] CVS: web downloads.php,1.87,1.88
Message-ID:
Update of /cvsroot/scummvm/web
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10102
Modified Files:
downloads.php
Log Message:
Change heading to reflect most of the builds not being generated on a daily basis.
Index: downloads.php
===================================================================
RCS file: /cvsroot/scummvm/web/downloads.php,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- downloads.php 29 Mar 2004 12:39:54 -0000 1.87
+++ downloads.php 3 Apr 2004 07:35:20 -0000 1.88
@@ -137,7 +137,7 @@
- Daily CVS Builds:
+ CVS Builds:
View the ChangeLog to see the latest updates of ScummVM.
From fingolfin at users.sourceforge.net Sat Apr 3 05:29:28 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 05:29:28 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.209,1.210
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31125/scumm
Modified Files:
string.cpp
Log Message:
Fix for bug #896844 (DIG: Missing subtitle at the lab console)
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- string.cpp 3 Apr 2004 00:56:55 -0000 1.209
+++ string.cpp 3 Apr 2004 13:16:02 -0000 1.210
@@ -107,7 +107,7 @@
if (getTalkingActor() != 0xFF)
a = derefActorSafe(getTalkingActor(), "CHARSET_1");
- if (a && _string[0].overhead != 0) {
+ if (a && a->isInCurrentRoom() && _string[0].overhead != 0) {
if (_version <= 5) {
_string[0].xpos = a->_pos.x - camera._cur.x + (_screenWidth / 2);
From cyx at users.sourceforge.net Sat Apr 3 10:12:03 2004
From: cyx at users.sourceforge.net (Gregory Montoir)
Date: Sat Apr 3 10:12:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.73,1.74 command.h,1.20,1.21 journal.cpp,1.35,1.36 logic.cpp,1.197,1.198 talk.cpp,1.96,1.97 talk.h,1.32,1.33
Message-ID:
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13226/queen
Modified Files:
command.cpp command.h journal.cpp logic.cpp talk.cpp talk.h
Log Message:
patch #910779 (with minor tweaks), fotaq hebrew support :
- reversed button captions in journal
- reversed command text in pinnacle room
- reverse order of lines in dialogue chooser
thanks Ori Avtalion !
Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- command.cpp 14 Mar 2004 13:26:01 -0000 1.73
+++ command.cpp 3 Apr 2004 17:58:58 -0000 1.74
@@ -35,16 +35,21 @@
namespace Queen {
+CmdText::CmdText(bool reversed, uint8 y, QueenEngine *vm)
+ : _isReversed(reversed), _y(y), _vm(vm) {
+ clear();
+}
+
void CmdText::clear() {
memset(_command, 0, sizeof(_command));
}
void CmdText::display(uint8 color) {
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, _command, false);
+ _vm->display()->setTextCentered(_y, _command, false);
}
-void CmdText::displayTemp(uint8 color, Verb v, const char *name) {
+void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN] = "";
if (_isReversed) {
if (name != NULL)
@@ -58,17 +63,17 @@
}
}
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
-void CmdText::displayTemp(uint8 color, const char *name) {
+void CmdText::displayTemp(uint8 color, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN];
if (_isReversed)
sprintf(temp, "%s %s", name, _command);
else
sprintf(temp, "%s %s", _command, name);
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
void CmdText::setVerb(Verb v) {
@@ -117,9 +122,7 @@
}
Command::Command(QueenEngine *vm)
- : _vm(vm) {
- _cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
- _cmdText._vm = vm;
+ : _cmdText((vm->resource()->getLanguage() == HEBREW), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
}
void Command::clear(bool clearTexts) {
Index: command.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- command.h 14 Mar 2004 00:53:24 -0000 1.20
+++ command.h 3 Apr 2004 17:58:58 -0000 1.21
@@ -32,10 +32,12 @@
struct CmdText {
+ CmdText(bool reversed, uint8 y, QueenEngine *vm);
+
void clear();
void display(uint8 color);
- void displayTemp(uint8 color, Verb v, const char *name = NULL);
- void displayTemp(uint8 color, const char *name);
+ void displayTemp(uint8 color, Verb v, const char *name = NULL, bool outlined = false);
+ void displayTemp(uint8 color, const char *name, bool outlined = false);
void setVerb(Verb v);
void addLinkWord(Verb v);
void addObject(const char *objName);
@@ -46,6 +48,7 @@
COMMAND_Y_POS = 151
};
+ uint8 _y;
bool _isReversed;
char _command[MAX_COMMAND_LEN];
QueenEngine *_vm;
Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- journal.cpp 25 Mar 2004 21:40:35 -0000 1.35
+++ journal.cpp 3 Apr 2004 17:58:58 -0000 1.36
@@ -353,8 +353,13 @@
_panelTextY[_panelTextCount++] = y;
} else {
*p++ = '\0';
- drawPanelText(y - 5, s);
- drawPanelText(y + 5, p);
+ if (_vm->resource()->getLanguage() == HEBREW) {
+ drawPanelText(y - 5, p);
+ drawPanelText(y + 5, s);
+ } else {
+ drawPanelText(y - 5, s);
+ drawPanelText(y + 5, p);
+ }
}
}
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- logic.cpp 26 Mar 2004 18:00:13 -0000 1.197
+++ logic.cpp 3 Apr 2004 17:58:58 -0000 1.198
@@ -1196,10 +1196,11 @@
_vm->update();
_vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y);
- _vm->display()->textCurrentColor(INK_PINNACLE_ROOM);
_entryObj = 0;
uint16 prevObj = 0;
+ CmdText cmdText((_vm->resource()->getLanguage() == HEBREW), 5, _vm);
+ cmdText.setVerb(VERB_WALK_TO);
while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
_vm->update();
@@ -1222,9 +1223,7 @@
ObjectData *objData = objectData(curObj);
if (objData->name > 0) {
_entryObj = objData->entryObj;
- char textCmd[CmdText::MAX_COMMAND_LEN];
- sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), objectName(objData->name));
- _vm->display()->setTextCentered(5, textCmd);
+ cmdText.displayTemp(INK_PINNACLE_ROOM, objectName(objData->name), true);
}
prevObj = curObj;
}
Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- talk.cpp 23 Mar 2004 20:34:19 -0000 1.96
+++ talk.cpp 3 Apr 2004 17:58:58 -0000 1.97
@@ -1185,15 +1185,69 @@
int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
debug(6, "Talk::splitOption(%s)", str);
- // Check to see if option fits on one line, and exit early
+ int lines;
+ memset(optionText, 0, 5 * MAX_STRING_SIZE);
if (_vm->resource()->getLanguage() == ENGLISH ||
_vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
strcpy(optionText[0], str);
- return 1;
+ lines = 1;
+ } else if (_vm->resource()->getLanguage() == HEBREW) {
+ lines = splitOptionHebrew(str, optionText);
+ } else {
+ lines = splitOptionDefault(str, optionText);
+ }
+ return lines;
+}
+
+int Talk::splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]) {
+ char tmpString[MAX_STRING_SIZE] = "";
+ uint16 len = 0;
+ uint16 spaceCharWidth = _vm->display()->textWidth(" ");
+ uint16 width = 0;
+ uint16 optionLines = 0;
+ uint16 maxTextLen = MAX_TEXT_WIDTH;
+ char *p = strchr(str, '\0');
+ while (p != str - 1) {
+ while (*p != ' ' && p != str - 1) {
+ --p;
+ ++len;
+ }
+ if (p != str - 1) {
+ uint16 wordWidth = _vm->display()->textWidth(p, len);
+ width += wordWidth;
+ if (width > maxTextLen) {
+ ++optionLines;
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ width = wordWidth;
+ maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN;
+ } else {
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ --p;
+ len = 1;
+ width += spaceCharWidth;
+ } else {
+ if (len > 1) {
+ if (width + _vm->display()->textWidth(p + 1, len) > maxTextLen) {
+ ++optionLines;
+ }
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p + 1, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ ++optionLines;
+ }
}
+ return optionLines;
+}
+int Talk::splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]) {
// Split up multiple line option at closest space character
- memset(optionText, 0, 5 * MAX_STRING_SIZE);
uint16 spaceCharWidth = _vm->display()->textWidth(" ");
uint16 width = 0;
uint16 optionLines = 0;
@@ -1205,7 +1259,7 @@
uint16 len = p - str;
uint16 wordWidth = _vm->display()->textWidth(str, len);
width += wordWidth;
- if (width> maxTextLen) {
+ if (width > maxTextLen) {
++optionLines;
strncpy(optionText[optionLines], str, len + 1);
width = wordWidth;
Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- talk.h 17 Mar 2004 14:10:51 -0000 1.32
+++ talk.h 3 Apr 2004 17:58:58 -0000 1.33
@@ -238,7 +238,10 @@
int faceDirection);
int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
+
+ int splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]);
+ int splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]);
};
From fingolfin at users.sourceforge.net Sat Apr 3 11:54:05 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 11:54:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.149,1.150 script_v2.cpp,2.244,2.245 script_v5.cpp,1.233,1.234 script_v6.cpp,1.326,1.327 script_v6he.cpp,2.41,2.42 script_v8.cpp,2.244,2.245 scumm.cpp,1.15,1.16 scumm.h,1.391,1.392 string.cpp,1.210,1.211
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30900
Modified Files:
saveload.cpp script_v2.cpp script_v5.cpp script_v6.cpp
script_v6he.cpp script_v8.cpp scumm.cpp scumm.h string.cpp
Log Message:
cleanup StringTab stuff
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- saveload.cpp 28 Mar 2004 16:30:49 -0000 1.149
+++ saveload.cpp 3 Apr 2004 19:41:30 -0000 1.150
@@ -573,27 +573,23 @@
};
const SaveLoadEntry stringTabEntries[] = {
- // TODO - It makes no sense to have all these t_* fields in StringTab
- // Rather let's dump them all when the save game format changes, and
- // keep two StringTab objects where we have one now: a "normal" one,
- // and a temporar y"t_" one.
// Then backup/restore of a StringTab entry becomes a one liner.
MKLINE(StringTab, xpos, sleInt16, VER(8)),
- MKLINE(StringTab, t_xpos, sleInt16, VER(8)),
+ MKLINE(StringTab, backup.xpos, sleInt16, VER(8)),
MKLINE(StringTab, ypos, sleInt16, VER(8)),
- MKLINE(StringTab, t_ypos, sleInt16, VER(8)),
+ MKLINE(StringTab, backup.ypos, sleInt16, VER(8)),
MKLINE(StringTab, right, sleInt16, VER(8)),
- MKLINE(StringTab, t_right, sleInt16, VER(8)),
+ MKLINE(StringTab, backup.right, sleInt16, VER(8)),
MKLINE(StringTab, color, sleInt8, VER(8)),
- MKLINE(StringTab, t_color, sleInt8, VER(8)),
+ MKLINE(StringTab, backup.color, sleInt8, VER(8)),
MKLINE(StringTab, charset, sleInt8, VER(8)),
- MKLINE(StringTab, t_charset, sleInt8, VER(8)),
+ MKLINE(StringTab, backup.charset, sleInt8, VER(8)),
MKLINE(StringTab, center, sleByte, VER(8)),
- MKLINE(StringTab, t_center, sleByte, VER(8)),
+ MKLINE(StringTab, backup.center, sleByte, VER(8)),
MKLINE(StringTab, overhead, sleByte, VER(8)),
- MKLINE(StringTab, t_overhead, sleByte, VER(8)),
+ MKLINE(StringTab, backup.overhead, sleByte, VER(8)),
MKLINE(StringTab, no_talk_anim, sleByte, VER(8)),
- MKLINE(StringTab, t_no_talk_anim, sleByte, VER(8)),
+ MKLINE(StringTab, backup.no_talk_anim, sleByte, VER(8)),
MKEND()
};
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.244
retrieving revision 2.245
diff -u -d -r2.244 -r2.245
--- script_v2.cpp 17 Mar 2004 01:50:14 -0000 2.244
+++ script_v2.cpp 3 Apr 2004 19:41:30 -0000 2.245
@@ -847,7 +847,7 @@
vs->dimcolor = 8;
}
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].t_charset;
+ vs->charset_nr = _string[0].backup.charset;
vs->curmode = 1;
vs->saveid = 0;
vs->key = 0;
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- script_v5.cpp 17 Mar 2004 01:50:14 -0000 1.233
+++ script_v5.cpp 3 Apr 2004 19:41:30 -0000 1.234
@@ -707,7 +707,7 @@
} else {
getWordVararg(table);
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)table[i];
+ _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)table[i];
}
break;
}
@@ -2405,7 +2405,7 @@
vs->hicolor = (_version == 3) ? 14 : 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].t_charset;
+ vs->charset_nr = _string[0].backup.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -2616,7 +2616,7 @@
textSlot = 0;
}
- setStringVars(textSlot);
+ _string[textSlot].restoreString();
while ((_opcode = fetchScriptByte()) != 0xFF) {
switch (_opcode & 0xF) {
@@ -2709,9 +2709,9 @@
// speaks during the intro are put at position 0,0.
// In addition, Loom needs to remember the text colour.
if (_gameId == GID_LOOM || _gameId == GID_INDY3) {
- _string[textSlot].t_xpos = _string[textSlot].xpos;
- _string[textSlot].t_ypos = _string[textSlot].ypos;
- _string[textSlot].t_color = _string[textSlot].color;
+ _string[textSlot].backup.xpos = _string[textSlot].xpos;
+ _string[textSlot].backup.ypos = _string[textSlot].ypos;
+ _string[textSlot].backup.color = _string[textSlot].color;
}
return;
default:
@@ -2720,13 +2720,7 @@
}
}
- _string[textSlot].t_xpos = _string[textSlot].xpos;
- _string[textSlot].t_ypos = _string[textSlot].ypos;
- _string[textSlot].t_center = _string[textSlot].center;
- _string[textSlot].t_overhead = _string[textSlot].overhead;
- _string[textSlot].t_right = _string[textSlot].right;
- _string[textSlot].t_color = _string[textSlot].color;
- _string[textSlot].t_charset = _string[textSlot].charset;
+ _string[textSlot].backupString();
}
void ScummEngine_v5::o5_oldRoomEffect() {
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.326
retrieving revision 1.327
diff -u -d -r1.326 -r1.327
--- script_v6.cpp 2 Apr 2004 21:42:34 -0000 1.326
+++ script_v6.cpp 3 Apr 2004 19:41:30 -0000 1.327
@@ -949,7 +949,7 @@
case 0x9D: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
+ _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i];
break;
case 0xD6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
makeCursorColorTransparent(pop());
@@ -1925,7 +1925,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].t_charset;
+ vs->charset_nr = _string[0].backup.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -2294,7 +2294,7 @@
void ScummEngine_v6::o6_talkActor() {
_actorToPrintStrFor = pop();
- setStringVars(0);
+ _string[0].restoreString();
actorTalk(_scriptPointer);
_scriptPointer += resStrLen(_scriptPointer) + 1;
@@ -3119,19 +3119,12 @@
break;
case 0xFE:
- setStringVars(m);
+ _string[m].restoreString();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xFF:
- _string[m].t_xpos = _string[m].xpos;
- _string[m].t_ypos = _string[m].ypos;
- _string[m].t_center = _string[m].center;
- _string[m].t_overhead = _string[m].overhead;
- _string[m].t_no_talk_anim = _string[m].no_talk_anim;
- _string[m].t_right = _string[m].right;
- _string[m].t_color = _string[m].color;
- _string[m].t_charset = _string[m].charset;
+ _string[m].backupString();
break;
default:
error("decodeParseString: default case 0x%x", b);
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -d -r2.41 -r2.42
--- script_v6he.cpp 2 Apr 2004 21:42:35 -0000 2.41
+++ script_v6he.cpp 3 Apr 2004 19:41:30 -0000 2.42
@@ -756,7 +756,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].t_charset;
+ vs->charset_nr = _string[0].backup.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -1468,19 +1468,12 @@
warning("decodeParseString case 0xF9 stub");
break;
case 0xFE:
- setStringVars(m);
+ _string[m].restoreString();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xFF:
- _string[m].t_xpos = _string[m].xpos;
- _string[m].t_ypos = _string[m].ypos;
- _string[m].t_center = _string[m].center;
- _string[m].t_overhead = _string[m].overhead;
- _string[m].t_no_talk_anim = _string[m].no_talk_anim;
- _string[m].t_right = _string[m].right;
- _string[m].t_color = _string[m].color;
- _string[m].t_charset = _string[m].charset;
+ _string[m].backupString();
break;
default:
error("decodeParseString: default case 0x%x", b);
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.244
retrieving revision 2.245
diff -u -d -r2.244 -r2.245
--- script_v8.cpp 2 Apr 2004 21:56:27 -0000 2.244
+++ script_v8.cpp 3 Apr 2004 19:41:30 -0000 2.245
@@ -472,19 +472,12 @@
switch (b) {
case 0xC8: // SO_PRINT_BASEOP
- setStringVars(m);
+ _string[m].restoreString();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xC9: // SO_PRINT_END
- _string[m].t_xpos = _string[m].xpos;
- _string[m].t_ypos = _string[m].ypos;
- _string[m].t_center = _string[m].center;
- _string[m].t_overhead = _string[m].overhead;
- _string[m].t_no_talk_anim = _string[m].no_talk_anim;
- _string[m].t_right = _string[m].right;
- _string[m].t_color = _string[m].color;
- _string[m].t_charset = _string[m].charset;
+ _string[m].backupString();
break;
case 0xCA: // SO_PRINT_AT
_string[m].ypos = pop();
@@ -769,7 +762,7 @@
case 0xE8: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
+ _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i];
break;
case 0xE9: // SO_CURSOR_PUT
{
@@ -1151,7 +1144,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].t_charset;
+ vs->charset_nr = _string[0].backup.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- scumm.cpp 3 Apr 2004 00:56:53 -0000 1.15
+++ scumm.cpp 3 Apr 2004 19:41:30 -0000 1.16
@@ -1128,16 +1128,16 @@
for (i = 0; i < 6; i++) {
if (_version == 3) { // FIXME - what is this?
- _string[i].t_xpos = 0;
- _string[i].t_ypos = 0;
+ _string[i].backup.xpos = 0;
+ _string[i].backup.ypos = 0;
} else {
- _string[i].t_xpos = 2;
- _string[i].t_ypos = 5;
+ _string[i].backup.xpos = 2;
+ _string[i].backup.ypos = 5;
}
- _string[i].t_right = _screenWidth - 1;
- _string[i].t_color = 0xF;
- _string[i].t_center = 0;
- _string[i].t_charset = 0;
+ _string[i].backup.right = _screenWidth - 1;
+ _string[i].backup.color = 0xF;
+ _string[i].backup.center = 0;
+ _string[i].backup.charset = 0;
}
// all keys are released
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.391
retrieving revision 1.392
diff -u -d -r1.391 -r1.392
--- scumm.h 2 Apr 2004 21:56:27 -0000 1.391
+++ scumm.h 3 Apr 2004 19:41:31 -0000 1.392
@@ -252,21 +252,33 @@
uint8 freezeCount;
};
-// TODO / FIXME: next time save game format changes, Fingolfin would like to
-// revise StringTab. In particular, all t_* fields can be removed, making some
-// code a bit cleaner & easier to understand.
-struct StringTab {
- int16 t_xpos, t_ypos;
- int16 t_right;
- int16 xpos, ypos;
+struct StringSlot {
+ int16 xpos;
+ int16 ypos;
int16 right;
- byte color, t_color;
- byte charset, t_charset;
- bool center, t_center;
- bool overhead, t_overhead;
- bool no_talk_anim, t_no_talk_anim;
+ byte color;
+ byte charset;
+ bool center;
+ bool overhead;
+ bool no_talk_anim;
+};
+
+struct StringTab : StringSlot {
+ StringSlot backup;
+
+ void backupString() {
+ StringSlot &s = *this;
+ backup = s;
+ }
+
+ void restoreString() {
+ StringSlot &s = *this;
+ s = backup;
+ }
};
+
+
enum WhereIsObject {
WIO_NOT_FOUND = -1,
WIO_INVENTORY = 0,
@@ -582,7 +594,6 @@
void copyScriptString(byte *dst);
int resStrLen(const byte *src) const;
void doSentence(int c, int b, int a);
- void setStringVars(int i);
/* Should be in Resource class */
File _fileHandle;
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- string.cpp 3 Apr 2004 13:16:02 -0000 1.210
+++ string.cpp 3 Apr 2004 19:41:31 -0000 1.211
@@ -34,18 +34,6 @@
namespace Scumm {
-void ScummEngine::setStringVars(int slot) {
- StringTab *st = &_string[slot];
- st->xpos = st->t_xpos;
- st->ypos = st->t_ypos;
- st->center = st->t_center;
- st->overhead = st->t_overhead;
- st->no_talk_anim = st->t_no_talk_anim;
- st->right = st->t_right;
- st->color = st->t_color;
- st->charset = st->t_charset;
-}
-
void ScummEngine::unkMessage1(const byte *msg) {
byte buffer[100];
addMessageToStack(msg, buffer, sizeof(buffer));
@@ -616,8 +604,8 @@
if (!getResourceAddress(rtCharset, charsetno))
loadCharset(charsetno);
- _string[0].t_charset = charsetno;
- _string[1].t_charset = charsetno;
+ _string[0].backup.charset = charsetno;
+ _string[1].backup.charset = charsetno;
for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[charsetno][i];
From fingolfin at users.sourceforge.net Sat Apr 3 13:09:09 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 13:09:09 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.114,1.115 costume.cpp,1.126,1.127
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11388
Modified Files:
akos.cpp costume.cpp
Log Message:
fixed hypothetical off-by-one error when computing _draw_bottom (a semantical problem: _draw_bottom is supposed to be the bottom most pixel which is actually drawn; in the other case, it's top+height, i.e. one pixel *below* that last drawn pixel row. In addition, some cleanup
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- akos.cpp 27 Mar 2004 20:55:24 -0000 1.114
+++ akos.cpp 3 Apr 2004 20:56:19 -0000 1.115
@@ -732,8 +732,8 @@
if (_draw_top > rect.top)
_draw_top = rect.top;
- if (_draw_bottom < rect.bottom)
- _draw_bottom = rect.bottom;
+ if (_draw_bottom < rect.bottom - 1)
+ _draw_bottom = rect.bottom - 1;
v1.destptr = _outptr + v1.y * _outwidth + v1.x;
@@ -762,22 +762,22 @@
}
clip.top = _actorY + ymoveCur;
- clip.right = (clip.left + _width) - 1;
- clip.bottom = (clip.top + _height) - 1;
- maxw = _outwidth - 1;
- maxh = _outheight - 1;
+ clip.right = clip.left + _width;
+ clip.bottom = clip.top + _height;
+ maxw = _outwidth;
+ maxh = _outheight;
- _vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, clip , _actorID);
clip.clip(maxw, maxh);
- if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
+ if (!clip.isValidRect())
return 0;
if (_draw_top > clip.top)
_draw_top = clip.top;
- if (_draw_bottom < clip.bottom)
- _draw_bottom = clip.bottom + 1;
+ if (_draw_bottom < clip.bottom - 1)
+ _draw_bottom = clip.bottom - 1;
BompDrawData bdd;
@@ -805,10 +805,8 @@
if (_zbuf != 0) {
bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
- _vm->drawBomp(bdd, !_mirror);
- } else {
- _vm->drawBomp(bdd, !_mirror);
}
+ _vm->drawBomp(bdd, !_mirror);
_vm->_bompActorPalettePtr = NULL;
@@ -966,17 +964,17 @@
}
clip.top = ymoveCur + _actorY;
- clip.right = (clip.left + _width) - 1;
- clip.bottom = (clip.top + _height) - 1;
- maxw = _outwidth - 1;
- maxh = _outheight - 1;
+ clip.right = clip.left + _width;
+ clip.bottom = clip.top + _height;
+ maxw = _outwidth;
+ maxh = _outheight;
skip_x = 0;
skip_y = 0;
cur_x = _width - 1;
cur_y = _height - 1;
- _vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
if (clip.left < 0) {
skip_x = -clip.left;
@@ -998,13 +996,13 @@
clip.bottom = maxh;
}
- if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
+ if (!clip.isValidRect())
return 0;
if (_draw_top > clip.top)
_draw_top = clip.top;
- if (_draw_bottom < clip.bottom)
- _draw_bottom = clip.bottom + 1;
+ if (_draw_bottom < clip.bottom - 1)
+ _draw_bottom = clip.bottom - 1;
int32 width_unk, height_unk;
@@ -1019,7 +1017,7 @@
int tmp_skip_x = skip_x;
skip_x = _width - 1 - cur_x;
cur_x = _width - 1 - tmp_skip_x;
- width_unk = clip.right;
+ width_unk = clip.right - 1;
} else {
dir = 1;
width_unk = clip.left;
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- costume.cpp 8 Jan 2004 03:10:16 -0000 1.126
+++ costume.cpp 3 Apr 2004 20:56:19 -0000 1.127
@@ -262,8 +262,8 @@
if (_draw_top > rect.top)
_draw_top = rect.top;
- if (_draw_bottom < rect.bottom)
- _draw_bottom = rect.bottom;
+ if (_draw_bottom < rect.bottom - 1)
+ _draw_bottom = rect.bottom - 1;
if (_height + rect.top >= 256) {
CHECK_HEAP
From fingolfin at users.sourceforge.net Sat Apr 3 15:05:06 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 15:05:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.115,1.116
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29586
Modified Files:
akos.cpp
Log Message:
cleanup
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- akos.cpp 3 Apr 2004 20:56:19 -0000 1.115
+++ akos.cpp 3 Apr 2004 22:52:36 -0000 1.116
@@ -767,7 +767,7 @@
maxw = _outwidth;
maxh = _outheight;
- _vm->markRectAsDirty(kMainVirtScreen, clip , _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
clip.clip(maxw, maxh);
@@ -963,19 +963,19 @@
clip.left = _actorX + xmoveCur;
}
- clip.top = ymoveCur + _actorY;
+ clip.top = _actorY + ymoveCur;
clip.right = clip.left + _width;
clip.bottom = clip.top + _height;
maxw = _outwidth;
maxh = _outheight;
+ _vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
+
skip_x = 0;
skip_y = 0;
cur_x = _width - 1;
cur_y = _height - 1;
- _vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
-
if (clip.left < 0) {
skip_x = -clip.left;
clip.left = 0;
From fingolfin at users.sourceforge.net Sat Apr 3 15:15:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 15:15:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.193.2.1,1.193.2.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31708/scumm
Modified Files:
Tag: branch-0-6-0
string.cpp
Log Message:
backport fix from HEAD
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.193.2.1
retrieving revision 1.193.2.2
diff -u -d -r1.193.2.1 -r1.193.2.2
--- string.cpp 22 Feb 2004 08:04:33 -0000 1.193.2.1
+++ string.cpp 3 Apr 2004 23:01:44 -0000 1.193.2.2
@@ -112,7 +112,7 @@
if (talkingActor() != 0xFF)
a = derefActorSafe(talkingActor(), "CHARSET_1");
- if (a && _string[0].overhead != 0) {
+ if (a && a->isInCurrentRoom() && _string[0].overhead != 0) {
if (_version <= 5) {
_string[0].xpos = a->_pos.x - camera._cur.x + (_screenWidth / 2);
From fingolfin at users.sourceforge.net Sat Apr 3 15:57:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 15:57:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.86,2.87
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6158/scumm
Modified Files:
charset.cpp
Log Message:
Fix for bugs #915586, #905856, part of bug #766749 (COMI: Bug with text being printed on the edge of the screen)
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.86
retrieving revision 2.87
diff -u -d -r2.86 -r2.87
--- charset.cpp 22 Feb 2004 21:02:05 -0000 2.86
+++ charset.cpp 3 Apr 2004 23:44:06 -0000 2.87
@@ -1279,10 +1279,10 @@
// details.
if (_firstChar) {
- _str.left = shadow.left;
- _str.top = shadow.top;
- _str.right = shadow.left;
- _str.bottom = shadow.top;
+ _str.left = (shadow.left >= 0) ? shadow.left : 0;
+ _str.top = (shadow.top >= 0) ? shadow.top : 0;
+ _str.right = _str.left;
+ _str.bottom = _str.top;
_firstChar = false;
}
From fingolfin at users.sourceforge.net Sat Apr 3 15:57:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 15:57:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.85,2.85.2.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6231/scumm
Modified Files:
Tag: branch-0-6-0
charset.cpp
Log Message:
Fix for bugs #915586, #905856, part of bug #766749 (COMI: Bug with text being printed on the edge of the screen)
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.85
retrieving revision 2.85.2.1
diff -u -d -r2.85 -r2.85.2.1
--- charset.cpp 15 Jan 2004 22:37:48 -0000 2.85
+++ charset.cpp 3 Apr 2004 23:44:14 -0000 2.85.2.1
@@ -1279,10 +1279,10 @@
// details.
if (_firstChar) {
- _str.left = shadow.left;
- _str.top = shadow.top;
- _str.right = shadow.left;
- _str.bottom = shadow.top;
+ _str.left = (shadow.left >= 0) ? shadow.left : 0;
+ _str.top = (shadow.top >= 0) ? shadow.top : 0;
+ _str.right = _str.left;
+ _str.bottom = _str.top;
_firstChar = false;
}
From fingolfin at users.sourceforge.net Sat Apr 3 16:42:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 16:42:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.h,1.392,1.393 string.cpp,1.211,1.212
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12599
Modified Files:
scumm.h string.cpp
Log Message:
got rid of _msgPtrToAdd; slightly improved error checking in addMessageToStack()
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.392
retrieving revision 1.393
diff -u -d -r1.392 -r1.393
--- scumm.h 3 Apr 2004 19:41:31 -0000 1.392
+++ scumm.h 4 Apr 2004 00:29:13 -0000 1.393
@@ -1067,21 +1067,21 @@
int _charsetBufPos;
byte _charsetBuffer[512];
-protected:
+ bool _keepText;
+
void initCharset(int charset);
void CHARSET_1();
void drawString(int a, const byte *msg);
- void addMessageToStack(const byte *msg, byte *dstBuffer, int dstBufferSize);
- void addIntToStack(int var);
- void addVerbToStack(int var);
- void addNameToStack(int var);
- void addStringToStack(int var);
void unkMessage1(const byte *msg);
void unkMessage2(const byte *msg);
-protected:
- byte *_msgPtrToAdd;
- bool _keepText;
+
+ int addMessageToStack(const byte *msg, byte *dst, int dstSize);
+ int addIntToStack(byte *dst, int dstSize, int var);
+ int addVerbToStack(byte *dst, int dstSize, int var);
+ int addNameToStack(byte *dst, int dstSize, int var);
+ int addStringToStack(byte *dst, int dstSize, int var);
+
public:
Common::Language _language;
protected:
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- string.cpp 3 Apr 2004 19:41:31 -0000 1.211
+++ string.cpp 4 Apr 2004 00:29:13 -0000 1.212
@@ -454,55 +454,55 @@
}
}
-void ScummEngine::addMessageToStack(const byte *msg, byte *dstBuffer, int dstBufferSize) {
+int ScummEngine::addMessageToStack(const byte *msg, byte *dst, int dstSize) {
uint num = 0;
uint32 val;
byte chr;
- const byte *buf;
+ const byte *src;
+ byte *end;
byte transBuf[384];
- if (dstBuffer) {
- _msgPtrToAdd = dstBuffer;
- }
+ assert(dst);
+ end = dst + dstSize;
if (msg == NULL) {
warning("Bad message in addMessageToStack, ignoring");
- return;
+ return 0;
}
if (_version >= 7 && msg[0] == '/') {
translateText(msg, transBuf);
- buf = transBuf;
+ src = transBuf;
} else {
- buf = msg;
+ src = msg;
}
num = 0;
while (1) {
- chr = buf[num++];
+ chr = src[num++];
if (chr == 0)
break;
if (chr == 0xFF) {
- chr = buf[num++];
+ chr = src[num++];
if (chr == 1 || chr == 2 || chr == 3 || chr == 8) {
// Simply copy these special codes
- *_msgPtrToAdd++ = 0xFF;
- *_msgPtrToAdd++ = chr;
+ *dst++ = 0xFF;
+ *dst++ = chr;
} else {
- val = (_version == 8) ? READ_LE_UINT32(buf + num) : READ_LE_UINT16(buf + num);
+ val = (_version == 8) ? READ_LE_UINT32(src + num) : READ_LE_UINT16(src + num);
switch (chr) {
case 4:
- addIntToStack(val);
+ dst += addIntToStack(dst, end - dst, val);
break;
case 5:
- addVerbToStack(val);
+ dst += addVerbToStack(dst, end - dst, val);
break;
case 6:
- addNameToStack(val);
+ dst += addNameToStack(dst, end - dst, val);
break;
case 7:
- addStringToStack(val);
+ dst += addStringToStack(dst, end - dst, val);
break;
case 9:
case 10:
@@ -510,13 +510,13 @@
case 13:
case 14:
// Simply copy these special codes
- *_msgPtrToAdd++ = 0xFF;
- *_msgPtrToAdd++ = chr;
- *_msgPtrToAdd++ = buf[num+0];
- *_msgPtrToAdd++ = buf[num+1];
+ *dst++ = 0xFF;
+ *dst++ = chr;
+ *dst++ = src[num+0];
+ *dst++ = src[num+1];
if (_version == 8) {
- *_msgPtrToAdd++ = buf[num+2];
- *_msgPtrToAdd++ = buf[num+3];
+ *dst++ = src[num+2];
+ *dst++ = src[num+3];
}
break;
default:
@@ -527,27 +527,27 @@
}
} else {
if (chr != '@') {
- *_msgPtrToAdd++ = chr;
+ *dst++ = chr;
}
}
- }
- *_msgPtrToAdd = 0;
-
- if (dstBuffer) {
+
// Check for a buffer overflow
- if (_msgPtrToAdd >= dstBuffer + dstBufferSize)
+ if (dst >= end)
error("addMessageToStack: buffer overflow!");
}
+ *dst = 0;
+
+ return dstSize - (end - dst);
}
-void ScummEngine::addIntToStack(int var) {
+int ScummEngine::addIntToStack(byte *dst, int dstSize, int var) {
int num;
num = readVar(var);
- _msgPtrToAdd += sprintf((char *)_msgPtrToAdd, "%d", num);
+ return snprintf((char *)dst, dstSize, "%d", num);
}
-void ScummEngine::addVerbToStack(int var) {
+int ScummEngine::addVerbToStack(byte *dst, int dstSize, int var) {
int num, k;
num = readVar(var);
@@ -555,36 +555,40 @@
for (k = 1; k < _numVerbs; k++) {
if (num == _verbs[k].verbid && !_verbs[k].type && !_verbs[k].saveid) {
const byte *ptr = getResourceAddress(rtVerb, k);
- addMessageToStack(ptr, 0, 0);
- break;
+ return addMessageToStack(ptr, dst, dstSize);
}
}
}
+ return 0;
}
-void ScummEngine::addNameToStack(int var) {
+int ScummEngine::addNameToStack(byte *dst, int dstSize, int var) {
int num;
num = readVar(var);
if (num) {
const byte *ptr = getObjOrActorName(num);
if (ptr) {
- addMessageToStack(ptr, 0, 0);
+ return addMessageToStack(ptr, dst, dstSize);
}
}
+ return 0;
}
-void ScummEngine::addStringToStack(int var) {
+int ScummEngine::addStringToStack(byte *dst, int dstSize, int var) {
const byte *ptr;
if (_version <= 2) {
byte chr;
+ int i = 0;
while ((chr = (byte)_scummVars[var++])) {
- if (chr != '@')
- *_msgPtrToAdd++ = chr;
+ if (chr != '@') {
+ *dst++ = chr;
+ i++;
+ }
}
- return;
+ return i;
}
if (_version == 3 || _version >= 6)
@@ -593,9 +597,10 @@
if (var) {
ptr = getStringAddress(var);
if (ptr) {
- addMessageToStack(ptr, 0, 0);
+ return addMessageToStack(ptr, dst, dstSize);
}
}
+ return 0;
}
void ScummEngine::initCharset(int charsetno) {
From fingolfin at users.sourceforge.net Sat Apr 3 17:24:24 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 3 17:24:24 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.116,1.117 akos.h,1.27,1.28
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18791
Modified Files:
akos.cpp akos.h
Log Message:
Fix for bug #885466 (FT: Text gets drawn under moving bits), by making AKOS codec 16 honor the charset mask
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- akos.cpp 3 Apr 2004 22:52:36 -0000 1.116
+++ akos.cpp 4 Apr 2004 01:11:27 -0000 1.117
@@ -882,36 +882,12 @@
}
}
-void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency) {
- byte *tmp_buf = akos16.buffer;
-
- if (dir < 0) {
- dest -= (t_width - 1);
- tmp_buf += (t_width - 1);
- }
-
- akos16SetupBitReader(src);
-
- if (numskip_before != 0) {
- akos16SkipData(numskip_before);
- }
-
- assert(t_height > 0);
- assert(t_width > 0);
- while (t_height--) {
- akos16DecodeLine(tmp_buf, t_width, dir);
- bompApplyShadow(_shadow_mode, _shadow_table, akos16.buffer, dest, t_width, transparency);
-
- if (numskip_after != 0) {
- akos16SkipData(numskip_after);
- }
- dest += pitch;
- }
-}
-
-void AkosRenderer::akos16DecompressMask(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte * maskptr, int32 bitpos_start) {
+void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir,
+ int32 numskip_before, int32 numskip_after, byte transparency, int maskLeft, int maskTop, int zBuf) {
byte *tmp_buf = akos16.buffer;
int maskpitch;
+ byte *maskptr = 0, *charsetMask = 0;
+ const byte maskbit = revBitMask[maskLeft & 7];
if (dir < 0) {
dest -= (t_width - 1);
@@ -925,19 +901,27 @@
}
maskpitch = _numStrips;
+
+ charsetMask = _vm->getMaskBuffer(maskLeft, maskTop, 0);
+ if (zBuf != 0)
+ maskptr = _vm->getMaskBuffer(maskLeft, maskTop, zBuf);
assert(t_height > 0);
assert(t_width > 0);
while (t_height--) {
akos16DecodeLine(tmp_buf, t_width, dir);
- bompApplyMask(akos16.buffer, maskptr, (byte)bitpos_start, t_width, transparency);
+ bompApplyMask(akos16.buffer, charsetMask, maskbit, t_width, transparency);
+ if (maskptr) {
+ bompApplyMask(akos16.buffer, maskptr, maskbit, t_width, transparency);
+ maskptr += maskpitch;
+ }
bompApplyShadow(_shadow_mode, _shadow_table, akos16.buffer, dest, t_width, transparency);
if (numskip_after != 0) {
akos16SkipData(numskip_after);
}
dest += pitch;
- maskptr += maskpitch;
+ charsetMask += maskpitch;
}
}
@@ -1040,15 +1024,9 @@
int32 numskip_before = skip_x + (skip_y * _width);
int32 numskip_after = _width - cur_x;
- byte *dest = _outptr + width_unk + height_unk * _outwidth;
+ byte *dst = _outptr + width_unk + height_unk * _outwidth;
- if (_zbuf == 0) {
- akos16Decompress(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency);
- } else {
- byte *ptr = _vm->getMaskBuffer(clip.left, clip.top, _zbuf);
- akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip.left / 8);
- }
-
+ akos16Decompress(dst, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf);
return 0;
}
Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- akos.h 6 Jan 2004 12:45:29 -0000 1.27
+++ akos.h 4 Apr 2004 01:11:27 -0000 1.28
@@ -96,8 +96,7 @@
void akos16SetupBitReader(const byte *src);
void akos16SkipData(int32 numskip);
void akos16DecodeLine(byte *buf, int32 numbytes, int32 dir);
- void akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency);
- void akos16DecompressMask(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte *maskptr, int32 bitpos_start);
+ void akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, int maskLeft, int maskTop, int zBuf);
};
} // End of namespace Scumm
From fingolfin at users.sourceforge.net Sun Apr 4 05:50:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 05:50:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.197,1.198
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24011
Modified Files:
resource.cpp
Log Message:
Exit quietly if we just told the user we are going to exit; no need to call error() (which pops up the console etc.)
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- resource.cpp 29 Mar 2004 11:02:45 -0000 1.197
+++ resource.cpp 4 Apr 2004 12:36:50 -0000 1.198
@@ -242,13 +242,16 @@
#endif
result = displayMessage("Quit", buf);
- if (result == 2)
- error("Cannot find file: '%s'", filename);
+ if (result == 2) {
+ //error("Cannot find file: '%s'", filename);
+ _system->quit();
+ }
} else {
sprintf(buf, "Cannot find file: '%s'", filename);
InfoDialog dialog(this, (char*)buf);
runDialog(dialog);
- error("Cannot find file: '%s'", filename);
+ //error("Cannot find file: '%s'", filename);
+ _system->quit();
}
}
From eriktorbjorn at users.sourceforge.net Sun Apr 4 08:29:07 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Sun Apr 4 08:29:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2 icons.cpp,1.34,1.35 sword2.h,1.53,1.54
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17445
Modified Files:
icons.cpp sword2.h
Log Message:
Cleanup.
Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/icons.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- icons.cpp 17 Mar 2004 09:03:14 -0000 1.34
+++ icons.cpp 4 Apr 2004 15:16:05 -0000 1.35
@@ -30,12 +30,7 @@
int32 Logic::fnAddMenuObject(int32 *params) {
// params: 0 pointer to a MenuObject structure to copy down
- assert(_vm->_totalTemp < TOTAL_engine_pockets);
-
- // copy the structure to our in-the-engine list
- memcpy(&_vm->_tempList[_vm->_totalTemp], _vm->_memory->intToPtr(params[0]), sizeof(MenuObject));
- _vm->_totalTemp++;
-
+ _vm->addMenuObject((MenuObject *) _vm->_memory->intToPtr(params[0]));
return IR_CONT;
}
@@ -59,160 +54,136 @@
return IR_CONT;
}
-void Sword2Engine::buildMenu(void) {
- // create and start the inventory menu - NOW AT THE BOTTOM OF THE
- // SCREEN!
+void Sword2Engine::addMenuObject(MenuObject *obj) {
+ assert(_totalTemp < TOTAL_engine_pockets);
+ memcpy(&_tempList[_totalTemp], obj, sizeof(MenuObject));
+ _totalTemp++;
+}
- uint32 null_pc = 0;
- uint32 j, k;
- bool icon_coloured;
- uint8 *icon;
- uint8 *head;
- uint32 res = 0;
+/**
+ * Create and start the inventory (bottom) menu
+ */
- // reset temp list which will be totally rebuilt
- _totalTemp = 0;
+void Sword2Engine::buildMenu(void) {
+ uint32 i, j;
- debug(5, "build top menu %d", _totalMasters);
+ // Clear the temporary inventory list, since we are going to build a
+ // new one from scratch.
- // clear the temp list before building a new temp list in-case list
- // gets smaller. check each master
+ for (i = 0; i < TOTAL_engine_pockets; i++)
+ _tempList[i].icon_resource = 0;
- for (j = 0; j < TOTAL_engine_pockets; j++)
- _tempList[j].icon_resource = 0;
+ _totalTemp = 0;
- // Call menu builder script which will register all carried menu
- // objects. Run the 'build_menu' script in the 'menu_master' object
+ // Run the 'build_menu' script in the 'menu_master' object. This will
+ // register all carried menu objects.
- head = _resman->openResource(MENU_MASTER_OBJECT);
- _logic->runScript((char *) head, (char *) head, &null_pc);
+ uint32 null_pc = 0;
+ char *menuScript = (char *) _resman->openResource(MENU_MASTER_OBJECT);
+ _logic->runScript(menuScript, menuScript, &null_pc);
_resman->closeResource(MENU_MASTER_OBJECT);
+ // Create a new master list based on the old master inventory list and
+ // the new temporary inventory list. The purpose of all this is, as
+ // far as I can tell, that the new list is ordered in the same way as
+ // the old list, with new objects added to the end of it.
+
// Compare new with old. Anything in master thats not in new gets
// removed from master - if found in new too, remove from temp
- if (_totalMasters) {
- // check each master
+ for (i = 0; i < _totalMasters; i++) {
+ bool found_in_temp = false;
- for (j = 0; j < _totalMasters; j++) {
- for (k = 0; k < TOTAL_engine_pockets; k++) {
- res = 0;
- // if master is in temp
- if (_masterMenuList[j].icon_resource == _tempList[k].icon_resource) {
- // kill it in the temp
- _tempList[k].icon_resource = 0;
- res = 1;
- break;
- }
- }
- if (!res) {
- // otherwise not in temp so kill in main
- _masterMenuList[j].icon_resource = 0;
- debug(5, "Killed menu %d", j);
+ for (j = 0; j < TOTAL_engine_pockets; j++) {
+ if (_masterMenuList[i].icon_resource == _tempList[j].icon_resource) {
+ // We alread know about this object, so kill it
+ // in the temporary list.
+ _tempList[j].icon_resource = 0;
+ found_in_temp = true;
+ break;
}
}
+
+ if (!found_in_temp) {
+ // The object is in the master list, but not in the
+ // temporary list. The player must have lost the object
+ // since the last time we checked, so kill it in the
+ // master list.
+ _masterMenuList[i].icon_resource = 0;
+ }
}
- // merge master downwards
+ // Eliminate blank entries from the master list.
_totalMasters = 0;
- //check each master slot
-
- for (j = 0; j < TOTAL_engine_pockets; j++) {
- // not current end - meaning out over the end so move down
- if (_masterMenuList[j].icon_resource && j != _totalMasters) {
- memcpy(&_masterMenuList[_totalMasters++], &_masterMenuList[j], sizeof(MenuObject));
-
- // moved down now so kill here
- _masterMenuList[j].icon_resource = 0;
- } else if (_masterMenuList[j].icon_resource) {
- // skip full slots
+ for (i = 0; i < TOTAL_engine_pockets; i++) {
+ if (_masterMenuList[i].icon_resource) {
+ if (i != _totalMasters) {
+ memcpy(&_masterMenuList[_totalMasters], &_masterMenuList[i], sizeof(MenuObject));
+ _masterMenuList[i].icon_resource = 0;
+ }
_totalMasters++;
}
}
- // add those new to menu still in temp but not yet in master to the
- // end of the master
-
- // check each master slot
+ // Add the new objects - i.e. the ones still in the temporary list but
+ // not yet in the master list - to the end of the master.
- for (j = 0; j < TOTAL_engine_pockets; j++) {
- if (_tempList[j].icon_resource) {
- // here's a new temp
- memcpy(&_masterMenuList[_totalMasters++], &_tempList[j], sizeof(MenuObject));
+ for (i = 0; i < TOTAL_engine_pockets; i++) {
+ if (_tempList[i].icon_resource) {
+ memcpy(&_masterMenuList[_totalMasters++], &_tempList[i], sizeof(MenuObject));
}
}
- // init top menu from master list
-
- for (j = 0; j < 15; j++) {
- if (_masterMenuList[j].icon_resource) {
- // 'res' is now the resource id of the icon
- res = _masterMenuList[j].icon_resource;
+ // Initialise the menu from the master list.
- if (_examiningMenuIcon) {
- // WHEN AN ICON HAS BEEN RIGHT-CLICKED FOR
- // 'EXAMINE' - SELECTION COLOURED, THE REST
- // GREYED OUT
+ for (i = 0; i < 15; i++) {
+ uint32 res = _masterMenuList[i].icon_resource;
+ uint8 *icon = NULL;
- // If this is the icon being examined, make
- // it coloured. If not, grey this one out.
+ if (res) {
+ bool icon_coloured;
- if (res == Logic::_scriptVars[OBJECT_HELD])
- icon_coloured = true;
- else
- icon_coloured = false;
+ if (_examiningMenuIcon) {
+ // When examining an object, that object is
+ // coloured. The rest are greyed out.
+ icon_coloured = (res == Logic::_scriptVars[OBJECT_HELD]);
} else if (Logic::_scriptVars[COMBINE_BASE]) {
- // WHEN ONE MENU OBJECT IS BEING USED WITH
- // ANOTHER - BOTH TO BE COLOURED, THE REST
- // GREYED OUT
-
- // if this if either of the icons being
- // combined...
-
- if (res == Logic::_scriptVars[OBJECT_HELD] || res == Logic::_scriptVars[COMBINE_BASE])
- icon_coloured = true;
- else
- icon_coloured = false;
+ // When combining two menu object (i.e. using
+ // one on another), both are coloured. The rest
+ // are greyed out.
+ icon_coloured = (res == Logic::_scriptVars[OBJECT_HELD] || res == Logic::_scriptVars[COMBINE_BASE]);
} else {
- // NORMAL ICON SELECTION - SELECTION GREYED
- // OUT, THE REST COLOURED
-
- // If this is the selction, grey it out. If
- // not, make it coloured.
-
- if (res == Logic::_scriptVars[OBJECT_HELD])
- icon_coloured = false;
- else
- icon_coloured = true;
+ // If an object is selected but we are not yet
+ // doing anything with it, the selected object
+ // is greyed out. The rest are coloured.
+ icon_coloured = (res != Logic::_scriptVars[OBJECT_HELD]);
}
- icon = _resman->openResource(_masterMenuList[j].icon_resource) + sizeof(StandardHeader);
+ icon = _resman->openResource(res) + sizeof(StandardHeader);
// The coloured icon is stored directly after the
// greyed out one.
if (icon_coloured)
icon += (RDMENU_ICONWIDE * RDMENU_ICONDEEP);
+ }
- _graphics->setMenuIcon(RDMENU_BOTTOM, j, icon);
+ _graphics->setMenuIcon(RDMENU_BOTTOM, i, icon);
+
+ if (res)
_resman->closeResource(res);
- } else {
- // no icon here
- _graphics->setMenuIcon(RDMENU_BOTTOM, j, NULL);
- debug(5, " NULL for %d", j);
- }
}
_graphics->showMenu(RDMENU_BOTTOM);
}
-void Sword2Engine::buildSystemMenu(void) {
- // start a fresh top system menu
-
- uint8 *icon;
+/**
+ * Build a fresh system (top) menu.
+ */
+void Sword2Engine::buildSystemMenu(void) {
uint32 icon_list[5] = {
OPTIONS_ICON,
QUIT_ICON,
@@ -221,11 +192,11 @@
RESTART_ICON
};
- // build them all high in full colour - when one is clicked on all the
- // rest will grey out
+ // Build them all high in full colour - when one is clicked on all the
+ // rest will grey out.
for (int i = 0; i < ARRAYSIZE(icon_list); i++) {
- icon = _resman->openResource(icon_list[i]) + sizeof(StandardHeader);
+ uint8 *icon = _resman->openResource(icon_list[i]) + sizeof(StandardHeader);
// The only case when an icon is grayed is when the player
// is dead. Then SAVE is not available.
Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- sword2.h 29 Mar 2004 06:37:46 -0000 1.53
+++ sword2.h 4 Apr 2004 15:16:05 -0000 1.54
@@ -127,6 +127,12 @@
void pauseGame(void);
void unpauseGame(void);
+ MenuObject _tempList[TOTAL_engine_pockets];
+ uint32 _totalTemp;
+
+ MenuObject _masterMenuList[TOTAL_engine_pockets];
+ uint32 _totalMasters;
+
public:
Sword2Engine(GameDetector *detector, OSystem *syst);
~Sword2Engine();
@@ -196,14 +202,9 @@
// Set by fnPassMega()
ObjectMega _engineMega;
- MenuObject _tempList[TOTAL_engine_pockets];
- uint32 _totalTemp;
-
- MenuObject _masterMenuList[TOTAL_engine_pockets];
- uint32 _totalMasters;
-
int menuClick(int menu_items);
+ void addMenuObject(MenuObject *obj);
void buildMenu(void);
void buildSystemMenu(void);
From fingolfin at users.sourceforge.net Sun Apr 4 11:10:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 11:10:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm bomp.cpp,2.17,2.18
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14291
Modified Files:
bomp.cpp
Log Message:
let compiler optimize code better
Index: bomp.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bomp.cpp,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -d -r2.17 -r2.18
--- bomp.cpp 31 Jan 2004 16:49:52 -0000 2.17
+++ bomp.cpp 4 Apr 2004 17:56:30 -0000 2.18
@@ -195,7 +195,6 @@
void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
const byte *src;
byte *dst;
- byte maskbit;
byte *mask = 0;
byte *charset_mask;
Common::Rect clip;
@@ -230,7 +229,7 @@
src = bd.dataptr;
dst = bd.out + bd.y * bd.outwidth + bd.x + clip.left;
- maskbit = revBitMask[(bd.x + clip.left) & 7];
+ const byte maskbit = revBitMask[(bd.x + clip.left) & 7];
// Always mask against the charset mask
charset_mask = getMaskBuffer(bd.x + clip.left, bd.y, 0);
From fingolfin at users.sourceforge.net Sun Apr 4 11:20:08 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 11:20:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm nut_renderer.cpp,1.43,1.44 nut_renderer.h,1.17,1.18
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16636
Modified Files:
nut_renderer.cpp nut_renderer.h
Log Message:
allow disabling of text shadow in NUT font renderer
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- nut_renderer.cpp 2 Feb 2004 22:40:19 -0000 1.43
+++ nut_renderer.cpp 4 Apr 2004 18:07:26 -0000 1.44
@@ -240,8 +240,8 @@
return _chars[c].height;
}
-void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask) {
- debug(8, "NutRenderer::drawShadowChar('%c', %d, %d, %d, %d) called", c, x, y, (int)color, useMask);
+void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask, bool showShadow) {
+ debug(8, "NutRenderer::drawShadowChar('%c', %d, %d, %d, %d, %d) called", c, x, y, (int)color, useMask, showShadow);
if (!_loaded) {
warning("NutRenderer::drawShadowChar() Font is not loaded");
return;
@@ -261,8 +261,12 @@
int offsetX[7] = { -1, 0, 1, 0, 1, 2, 0 };
int offsetY[7] = { 0, -1, 0, 1, 2, 1, 0 };
int cTable[7] = { 0, 0, 0, 0, 0, 0, color };
+ int i = 0;
+
+ if (!showShadow)
+ i = 6;
- for (int i = 0; i < 7; i++) {
+ for (; i < 7; i++) {
x += offsetX[i];
y += offsetY[i];
color = cTable[i];
Index: nut_renderer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- nut_renderer.h 6 Jan 2004 12:45:30 -0000 1.17
+++ nut_renderer.h 4 Apr 2004 18:07:26 -0000 1.18
@@ -54,7 +54,7 @@
bool loadFont(const char *filename, const char *dir);
void drawFrame(byte *dst, int c, int x, int y);
- void drawShadowChar(int c, int x, int y, byte color, bool useMask);
+ void drawShadowChar(int c, int x, int y, byte color, bool useMask, bool showShadow);
int getCharWidth(byte c);
int getCharHeight(byte c);
From fingolfin at users.sourceforge.net Sun Apr 4 12:30:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 12:30:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.87,2.88
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29246
Modified Files:
charset.cpp
Log Message:
Fix for last part of bug #766749 (COMI: Text should not always have a shadow): do not draw shadow for charset 3
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.87
retrieving revision 2.88
diff -u -d -r2.87 -r2.88
--- charset.cpp 3 Apr 2004 23:44:06 -0000 2.87
+++ charset.cpp 4 Apr 2004 19:17:28 -0000 2.88
@@ -1296,7 +1296,7 @@
shadow.bottom = _top + height + 2;
_hasMask = true;
- _current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask);
+ _current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask, _curId != 3);
_vm->markRectAsDirty(kMainVirtScreen, shadow);
if (_str.left > _left)
From fingolfin at users.sourceforge.net Sun Apr 4 12:37:04 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 12:37:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v8.cpp,2.245,2.246
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30548
Modified Files:
script_v8.cpp
Log Message:
Implement V8 queryQuit opcode
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.245
retrieving revision 2.246
diff -u -d -r2.245 -r2.246
--- script_v8.cpp 3 Apr 2004 19:41:30 -0000 2.245
+++ script_v8.cpp 4 Apr 2004 19:24:03 -0000 2.246
@@ -1371,7 +1371,10 @@
warning("o8_kernelSetFunctions: paletteSetIntensity(%d, %d)", args[1], args[2]);
break;
case 34: // queryQuit
- warning("o8_kernelSetFunctions: queryQuit()");
+ if (_confirmExit)
+ confirmexitDialog();
+ else
+ _quit = true;
break;
case 108: // buildPaletteShadow
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
From fingolfin at users.sourceforge.net Sun Apr 4 12:54:04 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 12:54:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.117,1.118 costume.cpp,1.127,1.128
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1182
Modified Files:
akos.cpp costume.cpp
Log Message:
My recent change to _draw_bottom caused a regression in The Dig (and maybe elsewhere). Ah well, probably better to draw one line more than one line less anyway
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- akos.cpp 4 Apr 2004 01:11:27 -0000 1.117
+++ akos.cpp 4 Apr 2004 19:41:02 -0000 1.118
@@ -732,8 +732,8 @@
if (_draw_top > rect.top)
_draw_top = rect.top;
- if (_draw_bottom < rect.bottom - 1)
- _draw_bottom = rect.bottom - 1;
+ if (_draw_bottom < rect.bottom)
+ _draw_bottom = rect.bottom;
v1.destptr = _outptr + v1.y * _outwidth + v1.x;
@@ -776,8 +776,8 @@
if (_draw_top > clip.top)
_draw_top = clip.top;
- if (_draw_bottom < clip.bottom - 1)
- _draw_bottom = clip.bottom - 1;
+ if (_draw_bottom < clip.bottom)
+ _draw_bottom = clip.bottom;
BompDrawData bdd;
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- costume.cpp 3 Apr 2004 20:56:19 -0000 1.127
+++ costume.cpp 4 Apr 2004 19:41:02 -0000 1.128
@@ -262,8 +262,8 @@
if (_draw_top > rect.top)
_draw_top = rect.top;
- if (_draw_bottom < rect.bottom - 1)
- _draw_bottom = rect.bottom - 1;
+ if (_draw_bottom < rect.bottom)
+ _draw_bottom = rect.bottom;
if (_height + rect.top >= 256) {
CHECK_HEAP
From fingolfin at users.sourceforge.net Sun Apr 4 13:04:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 13:04:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm nut_renderer.cpp,1.44,1.45
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3036
Modified Files:
nut_renderer.cpp
Log Message:
Added TODO/FIXME comment
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- nut_renderer.cpp 4 Apr 2004 18:07:26 -0000 1.44
+++ nut_renderer.cpp 4 Apr 2004 19:50:52 -0000 1.45
@@ -144,14 +144,29 @@
}
_nbChars = READ_LE_UINT16(dataSrc + 10);
- uint32 offset = READ_BE_UINT32(dataSrc + 4) + 8;
+ uint32 offset = 0;
int32 decoded_length;
+
for (int l = 0; l < _nbChars; l++) {
+ offset += READ_BE_UINT32(dataSrc + offset + 4) + 8;
+
+ // TODO/FIXME: The code checks for a "shift" in the FRME headers. Well, neither
+ // in my german nor in my english NUT fonts does that occur, but it's very typical
+ // for IFF style formats (like this here) to "pad" odd sized blocks. Hence, it might
+ // be a cleaner solution to insert this adjustment here:
+ // if (offset & 1)
+ // offset++;
+ // And then get rid of the hack for the shifted FRME. I'd do that right now, but since
+ // I have no way to test this (read: no data files where this issue occurs), I am
+ // deferring this job for now :-)
+
if ((READ_BE_UINT32(dataSrc + offset) == 'FRME') || (READ_BE_UINT32(dataSrc + offset + 1) == 'FRME')) {
- if (READ_BE_UINT32(dataSrc + offset) == 'FRME')
+ if (READ_BE_UINT32(dataSrc + offset) == 'FRME') {
offset += 8;
- else if (READ_BE_UINT32(dataSrc + offset + 1) == 'FRME') // hack for proper offset
+ } else { // hack for proper offset
offset += 9;
+ }
+
if (READ_BE_UINT32(dataSrc + offset) == 'FOBJ') {
int codec = READ_LE_UINT16(dataSrc + offset + 8);
_chars[l].xoffs = READ_LE_UINT16(dataSrc + offset + 10);
@@ -159,6 +174,7 @@
_chars[l].width = READ_LE_UINT16(dataSrc + offset + 14);
_chars[l].height = READ_LE_UINT16(dataSrc + offset + 16);
_chars[l].src = new byte[(_chars[l].width + 2) * _chars[l].height + 1000];
+
// If characters have transparency, then bytes just get skipped and
// so there may appear some garbage. That's why we have to fill it
// with zeroes first.
@@ -181,8 +197,6 @@
if (l == 134 && !strcmp(filename, "titlfnt.nut"))
_chars[l].width--;
}
-
- offset += READ_BE_UINT32(dataSrc + offset + 4) + 8;
} else {
warning("NutRenderer::loadFont(%s, %s) there is no FOBJ chunk in FRME chunk %d (offset %x)", filename, directory, l, offset);
break;
From fingolfin at users.sourceforge.net Sun Apr 4 13:33:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 13:33:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm camera.cpp,2.23,2.24 charset.h,2.25,2.26 gfx.cpp,2.270,2.271 saveload.cpp,1.150,1.151 string.cpp,1.212,1.213
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8551
Modified Files:
camera.cpp charset.h gfx.cpp saveload.cpp string.cpp
Log Message:
Removed CharsetRenderer::_mask (this was used to optimize charset mask handling). This shouldn't cause any noticable slowdowns, but allows us to get rid of two nasty hacks, and fixes bug #895355 (DIG: Subtitles sometimes stay on the screen), maybe also others
Index: camera.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/camera.cpp,v
retrieving revision 2.23
retrieving revision 2.24
diff -u -d -r2.23 -r2.24
--- camera.cpp 8 Jan 2004 21:21:40 -0000 2.23
+++ camera.cpp 4 Apr 2004 20:20:08 -0000 2.24
@@ -338,23 +338,6 @@
#else
virtscr[0].xstart = _screenStartStrip * 8;
#endif
-
- if (_charset->_hasMask && _version > 3) {
- int dx = camera._cur.x - camera._last.x;
- int dy = camera._cur.y - camera._last.y;
-
- // Fixes subtitle glitches during room scrolling in two cut scenes
- // When talking to Rusty for first time
- // When sleeping in straw at Blacksmith's Guild.
- if ((_gameId == GID_LOOM256 || _gameId == GID_PASS) && dx)
- _charset->_mask.left -= 8;
- else if (dx || dy) {
- _charset->_mask.left -= dx;
- _charset->_mask.right -= dx;
- _charset->_mask.top -= dy;
- _charset->_mask.bottom -= dy;
- }
- }
}
void ScummEngine::panCameraTo(int x, int y) {
Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.25
retrieving revision 2.26
diff -u -d -r2.25 -r2.26
--- charset.h 8 Jan 2004 21:21:40 -0000 2.25
+++ charset.h 4 Apr 2004 20:20:08 -0000 2.26
@@ -33,12 +33,6 @@
class CharsetRenderer {
public:
- /**
- * Charset mask - rectangle covering the parts of the screen which are
- * currently (partially) masked.
- */
- Common::Rect _mask;
-
Common::Rect _str;
int _nextLeft, _nextTop;
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.270
retrieving revision 2.271
diff -u -d -r2.270 -r2.271
--- gfx.cpp 28 Mar 2004 16:30:48 -0000 2.270
+++ gfx.cpp 4 Apr 2004 20:20:08 -0000 2.271
@@ -608,10 +608,20 @@
void CharsetRenderer::restoreCharsetBg() {
if (_hasMask) {
- _vm->restoreBG(_mask);
+ // Restore background on the whole text area. To do this, we simply
+ // pass a large rect to restoreBG, and then rely on it clipping that
+ // rect. Also, restoreBG() will use findVirtScreen(rect.top) to
+ // determine the virtual screen on which to operate. This is fine
+ // for us, since we pass in rect.top, so in older games, the text
+ // display area is used; in newer games, the main virtscreen gets
+ // restored. That's exactly what we need.
+ //
+ // Of course this will break down if one of the older games (with
+ // multiple virtual screens in use) draw text outside the text virtual
+ // screen (verbs are excluded, they are handled in a special fashion).
+ // But I have no indication that this does ever happen.
+ _vm->restoreBG(Common::Rect(5000, 5000));
_hasMask = false;
- _mask.top = _mask.left = 32767;
- _mask.right = _mask.bottom = 0;
_str.left = -1;
_left = -1;
}
@@ -622,14 +632,10 @@
void CharsetRenderer::clearCharsetMask() {
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]);
- _mask.top = _mask.left = 32767;
- _mask.right = _mask.bottom = 0;
}
bool CharsetRenderer::hasCharsetMask(int left, int top, int right, int bottom) {
- Common::Rect rect(left, top, right, bottom);
-
- return _hasMask && rect.intersects(_mask);
+ return _hasMask;
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
@@ -1652,6 +1658,7 @@
src += _vm->_screenWidth;
} while (--height);
}
+
void Gdi::clear8Col(byte *dst, int height)
{
do {
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- saveload.cpp 3 Apr 2004 19:41:30 -0000 1.150
+++ saveload.cpp 4 Apr 2004 20:20:09 -0000 1.151
@@ -265,8 +265,6 @@
_completeScreenRedraw = true;
// Reset charset mask
- _charset->_mask.top = _charset->_mask.left = 32767;
- _charset->_mask.right = _charset->_mask.bottom = 0;
_charset->_hasMask = false;
// With version 22, we replaced the scale items with scale slots. So when
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- string.cpp 4 Apr 2004 00:29:13 -0000 1.212
+++ string.cpp 4 Apr 2004 20:20:09 -0000 1.213
@@ -142,10 +142,6 @@
for (i = 0; i < 4; i++)
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
- if (_keepText) {
- _charset->_str = _charset->_mask;
- }
-
if (_talkDelay)
return;
@@ -166,12 +162,6 @@
if (!_keepText) {
if (_version <= 3 && _gameId != GID_LOOM) {
_charset->_hasMask = true;
- _charset->_mask.left = _string[0].xpos;
- _charset->_mask.top = _string[0].ypos;
- _charset->_mask.bottom = _string[0].ypos + 8;
- _charset->_mask.right = _screenWidth;
- if (_string[0].ypos <= 16) // If we are cleaning the text line, clean 2 lines.
- _charset->_mask.bottom = 16;
}
_charset->restoreCharsetBg();
}
@@ -321,9 +311,9 @@
_charsetBufPos = buffer - _charsetBuffer;
_charset->_hasMask = (_charset->_str.left != -1);
- _charset->_mask = _charset->_str;
}
+
void ScummEngine::drawString(int a, const byte *msg) {
byte buf[256];
byte *space;
@@ -450,7 +440,6 @@
if (_version >= 7) {
_charset->_hasMask = true;
- _charset->_mask.extend(_charset->_str);
}
}
From fingolfin at users.sourceforge.net Sun Apr 4 15:57:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 15:57:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.118,1.119 base-costume.h,1.18,1.19 costume.cpp,1.128,1.129
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2837
Modified Files:
akos.cpp base-costume.h costume.cpp
Log Message:
Fix signedness issue (lead to incorred address computations on 64 bit machines)
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- akos.cpp 4 Apr 2004 19:41:02 -0000 1.118
+++ akos.cpp 4 Apr 2004 22:43:54 -0000 1.119
@@ -347,7 +347,8 @@
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
bool skip_column = false;
@@ -376,7 +377,7 @@
do {
if (*scaleytab++ < _scaleY) {
if (_actorHitMode) {
- if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+ if (color && y == _actorHitY && v1.x == _actorHitX) {
_actorHitResult = true;
return;
}
@@ -413,7 +414,7 @@
if (v1.scaletable[v1.scaleXindex] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -613,7 +614,7 @@
j = startScaleIndexX;
for (i = 0, skip = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
startScaleIndexX = j;
skip++;
}
@@ -678,10 +679,10 @@
} else
_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -724,10 +725,10 @@
if (v1.skip_width <= 0 || _height <= 0)
return 0;
- if ((uint) rect.top > _outheight)
+ if (rect.top > _outheight)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- base-costume.h 12 Jan 2004 14:09:39 -0000 1.18
+++ base-costume.h 4 Apr 2004 22:43:54 -0000 1.19
@@ -69,7 +69,7 @@
// Destination
byte *_outptr;
- uint _outwidth, _outheight;
+ int _outwidth, _outheight;
int32 _numStrips;
// Source pointer
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- costume.cpp 4 Apr 2004 19:41:02 -0000 1.128
+++ costume.cpp 4 Apr 2004 22:43:54 -0000 1.129
@@ -148,7 +148,7 @@
rect.right = rect.left = v1.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
skip++;
startScaleIndexX = _scaleIndexX;
}
@@ -205,10 +205,10 @@
else
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -254,10 +254,10 @@
if (rect.left < 0)
rect.left = 0;
- if ((uint) rect.top > _outheight)
+ if (rect.top > _outheight)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
@@ -352,7 +352,8 @@
const byte *mask, *src;
byte *dst;
byte len;
- uint y, height;
+ int y;
+ uint height;
byte color, pcolor;
bool rep;
@@ -409,7 +410,7 @@
height = _height;
y = v1.y;
v1.x += 8 * v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
mask = v1.mask_ptr;
v1.destptr += 8 * v1.scaleXstep;
@@ -426,7 +427,8 @@
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
@@ -482,7 +484,7 @@
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -501,7 +503,7 @@
byte *dst;
byte maskbit, len, height, width;
int color;
- uint y;
+ int y;
bool masked;
int oldXpos, oldScaleIndexX;
@@ -525,7 +527,7 @@
if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
- if (color && v1.x >= 0 && v1.x < (int)_outwidth && !masked) {
+ if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
*dst = _palette[color];
}
From fingolfin at users.sourceforge.net Sun Apr 4 16:42:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 16:42:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.155,1.156 resource.cpp,1.198,1.199
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10508
Modified Files:
script.cpp resource.cpp
Log Message:
these debug() calls look as if they should be debugC() calls
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- script.cpp 28 Mar 2004 22:06:38 -0000 1.155
+++ script.cpp 4 Apr 2004 23:29:09 -0000 1.156
@@ -460,7 +460,7 @@
else
copyprotbypassed = true;
- debug(DEBUG_VARS, "readvar(%d)", var);
+ debugC(DEBUG_VARS, "readvar(%d)", var);
if (var & 0x2000 && !(_features & GF_NEW_OPCODES)) {
a = fetchScriptWord();
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- resource.cpp 4 Apr 2004 12:36:50 -0000 1.198
+++ resource.cpp 4 Apr 2004 23:29:10 -0000 1.199
@@ -1734,7 +1734,7 @@
setResourceCounter(type, idx, 1);
- debug(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
+ debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
return ptr + sizeof(MemBlkHeader);
}
From fingolfin at users.sourceforge.net Sun Apr 4 17:38:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 4 17:38:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.h,1.393,1.394
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19191
Modified Files:
scumm.h
Log Message:
pedantic const correction
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.393
retrieving revision 1.394
diff -u -d -r1.393 -r1.394
--- scumm.h 4 Apr 2004 00:29:13 -0000 1.393
+++ scumm.h 5 Apr 2004 00:24:26 -0000 1.394
@@ -526,7 +526,7 @@
const byte *_scriptPointer, *_scriptOrgPointer;
byte _opcode, _currentScript;
uint16 _curExecScript;
- byte **_lastCodePtr;
+ const byte * const *_lastCodePtr;
int _resultVarNumber, _scummStackPos;
int _vmStack[150];
int _keyScriptKey, _keyScriptNo;
From kirben at users.sourceforge.net Sun Apr 4 18:40:01 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Sun Apr 4 18:40:01 2004
Subject: [Scummvm-cvs-logs] CVS: residual/lua/src/lua Makefile,1.1.1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/residual/lua/src/lua
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27596/lua/src/lua
Modified Files:
Makefile
Log Message:
Fix mingw compile
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/src/lua/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 15 Aug 2003 18:00:44 -0000 1.1.1.1
+++ Makefile 5 Apr 2004 01:26:43 -0000 1.2
@@ -14,7 +14,7 @@
all: $T
$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
- $(CC) -o $@ $(OBJS) -L$(LIB) -llua -llualib -lm
+ $(CC) -o $@ $(OBJS) -L$(LIB) -llua -llualib -lm `sdl-config --libs`
$(LIB)/liblua.a:
cd ..; make
From kirben at users.sourceforge.net Sun Apr 4 18:40:02 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Sun Apr 4 18:40:02 2004
Subject: [Scummvm-cvs-logs] CVS: residual/lua/src/luac Makefile,1.1.1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/residual/lua/src/luac
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27596/lua/src/luac
Modified Files:
Makefile
Log Message:
Fix mingw compile
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/src/luac/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile 15 Aug 2003 18:00:44 -0000 1.1.1.1
+++ Makefile 5 Apr 2004 01:26:43 -0000 1.2
@@ -13,7 +13,7 @@
all: $T
$T: $(OBJS) $(LIB)/liblua.a
- $(CC) -o $@ $(OBJS) -L$(LIB) -llua
+ $(CC) -o $@ $(OBJS) -L$(LIB) -llua `sdl-config --libs`
$(LIB)/liblua.a:
cd ..; make
From kirben at users.sourceforge.net Sun Apr 4 19:14:02 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Sun Apr 4 19:14:02 2004
Subject: [Scummvm-cvs-logs] CVS: residual Makefile.common,NONE,1.1 Makefile,1.17,1.18 Makefile.cross,1.11,1.12 Makefile.mingw,1.19,1.20
Message-ID:
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv674
Modified Files:
Makefile Makefile.cross Makefile.mingw
Added Files:
Makefile.common
Log Message:
Merge Makefiles a bit
--- NEW FILE: Makefile.common ---
DEPS = $(OBJS:.o=.d)
OBJS =\
actor.o \
bitmap.o \
blocky16.o \
costume.o \
debug.o \
driver_gl.o \
engine.o \
keyframe.o \
lab.o \
localize.o \
lua.o \
main.o \
material.o \
matrix3.o \
matrix4.o \
model.o \
objectstate.o \
registry.o \
resource.o \
scene.o \
screen.o \
smush.o \
sound.o \
textobject.o \
textsplit.o \
timer.o \
vima.o \
walkplane.o \
mixer/mixer.o \
mixer/rate.o \
mixer/audiostream.o
residual: $(OBJS) lua/lib/liblua.a lua/lib/liblualib.a
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
.cpp.o:
$(CXX) $(CXXFLAGS) -MMD -c $(<) -o $*.o
lua/lib/liblua.a lua/lib/liblualib.a: lua-build
lua-build:
$(MAKE) -C lua
clean: lua-clean
-rm -f residual$(EXEEXT) *.o mixer\*.o *.d mixer\*.d *~
lua-clean:
$(MAKE) -C lua clean
-include $(DEPS)
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Makefile 25 Mar 2004 22:17:09 -0000 1.17
+++ Makefile 5 Apr 2004 02:00:33 -0000 1.18
@@ -12,31 +12,6 @@
# ... and instead uncomment this if you are on Mac OS X
#CXXFLAGS += -DMACOSX
-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 \
- matrix3.o matrix4.o screen.o blocky16.o smush.o vima.o driver_gl.o \
- objectstate.o mixer/mixer.o mixer/rate.o mixer/audiostream.o
-
-DEPS = $(OBJS:.o=.d)
-
-residual: $(OBJS) lua/lib/liblua.a lua/lib/liblualib.a
- $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-
-.cpp.o:
- $(CXX) $(CXXFLAGS) -MMD -c $(<) -o $*.o
-
-lua/lib/liblua.a lua/lib/liblualib.a: lua-build
-
-lua-build:
- $(MAKE) -C lua
-
-clean: lua-clean
- -rm -f residual *.o mixer\*.o *.d mixer\*.d *~
-
-lua-clean:
- $(MAKE) -C lua clean
-
--include $(DEPS)
+include Makefile.common
.PHONY: lua-build lua-clean
Index: Makefile.cross
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.cross,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.cross 22 Feb 2004 07:58:57 -0000 1.11
+++ Makefile.cross 5 Apr 2004 02:00:33 -0000 1.12
@@ -3,35 +3,12 @@
SDL_LIBS=-L/usr/i586-mingw32msvc/lib -lSDL
CXX = i586-mingw32msvc-g++
-CXXFLAGS = -W -Wall -Ilua/include $(SDL_CFLAGS) # -O2
+CXXFLAGS = -W -Wall -Wno-multichar -Ilua/include $(SDL_CFLAGS) # -O2
LDFLAGS = -W -Wall # -O2
LIBS = -Llua/lib -llua -llualib -lmingw32 -lopengl32 -lglu32 -lgdi32 \
$(SDL_LIBS) -lz
-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 \
- matrix3.o matrix4.o screen.o blocky16.o smush.o vima.o driver_gl.o \
- mixer/mixer.o mixer/rate.o mixer/audiostream.o
-DEPS = $(OBJS:.o=.d)
-
-residual: $(OBJS) lua/lib/liblua.a lua/lib/liblualib.a
- $(CXX) $(LDFLAGS) -o residual.exe $(OBJS) $(LIBS)
- strip residual.exe
-
-.cpp.o:
- $(CXX) $(CXXFLAGS) -MMD -c $(<) -o $*.o
-
-lua/lib/liblua.a lua/lib/liblualib.a: lua-build
-
-lua-build:
- $(MAKE) -C lua
-
-clean: lua-clean
- -rm -f residual.exe *.o mixer\*.o *.d mixer\*.d *~
-
-lua-clean:
- $(MAKE) -C lua clean
+EXEEXT =.exe
--include $(DEPS)
+include Makefile.common
.PHONY: lua-build lua-clean
Index: Makefile.mingw
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.mingw,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Makefile.mingw 23 Mar 2004 05:49:51 -0000 1.19
+++ Makefile.mingw 5 Apr 2004 02:00:33 -0000 1.20
@@ -2,40 +2,17 @@
RESIDUALPATH=C:/residual
### Modify these paths
-SDL_CFLAGS=-I$(SRC)sdl/include
-SDL_LIBS=-L$(SRC)sdl/lib -lSDL
+SDL_CFLAGS=`sdl-config --cflags`
+SDL_LIBS=`sdl-config --libs`
CXX = g++
-CXXFLAGS = -g -W -Wall -Ilua/include $(SDL_CFLAGS) # -O2
+CXXFLAGS = -g -W -Wall -Wno-multichar -Ilua/include $(SDL_CFLAGS) # -O2
LDFLAGS = -g -W -Wall # -O2
LIBS = -Llua/lib -llua -llualib -lmingw32 -lopengl32 -lglu32 -lgdi32 \
$(SDL_LIBS) -lz
-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 \
- matrix3.o matrix4.o screen.o blocky16.o smush.o vima.o driver_gl.o \
- objectstate.o mixer/mixer.o mixer/rate.o mixer/audiostream.o
-DEPS = $(OBJS:.o=.d)
EXEEXT =.exe
-residual: $(OBJS) lua/lib/liblua.a lua/lib/liblualib.a
- $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-
-.cpp.o:
- $(CXX) $(CXXFLAGS) -MMD -c $(<) -o $*.o
-
-lua/lib/liblua.a lua/lib/liblualib.a: lua-build
-
-lua-build:
- $(MAKE) -C lua
-
-clean: lua-clean
- -rm -f residual.exe *.o mixer\*.o *.d mixer\*.d *~
-
-lua-clean:
- $(MAKE) -C lua clean
-
--include $(DEPS)
+include Makefile.common
.PHONY: lua-build lua-clean
From kirben at users.sourceforge.net Sun Apr 4 19:16:02 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Sun Apr 4 19:16:02 2004
Subject: [Scummvm-cvs-logs] CVS: residual Makefile.common,1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1341
Modified Files:
Makefile.common
Log Message:
Ooops
Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.common 5 Apr 2004 02:00:33 -0000 1.1
+++ Makefile.common 5 Apr 2004 02:03:08 -0000 1.2
@@ -1,5 +1,3 @@
-DEPS = $(OBJS:.o=.d)
-
OBJS =\
actor.o \
bitmap.o \
@@ -33,6 +31,8 @@
mixer/rate.o \
mixer/audiostream.o
+DEPS = $(OBJS:.o=.d)
+
residual: $(OBJS) lua/lib/liblua.a lua/lib/liblualib.a
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
@@ -45,7 +45,7 @@
$(MAKE) -C lua
clean: lua-clean
- -rm -f residual$(EXEEXT) *.o mixer\*.o *.d mixer\*.d *~
+ -rm -f residual$(EXEEXT) *.o mixer\*.o *.d mixer\*.d *~
lua-clean:
$(MAKE) -C lua clean
From aquadran at users.sourceforge.net Mon Apr 5 11:38:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.73,1.74
Message-ID:
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526/base
Modified Files:
gameDetector.cpp
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- gameDetector.cpp 31 Mar 2004 18:00:45 -0000 1.73
+++ gameDetector.cpp 5 Apr 2004 18:24:34 -0000 1.74
@@ -63,6 +63,7 @@
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
" -o, --master-volume=NUM Set the master volume, 0-255 (default: 192)\n"
" -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)\n"
+ " -r, --voice-volume=NUM Set the voice volume, 0-255 (default: 192)\n"
" -n, --subtitles Enable subtitles (use with games that have voice)\n"
" -b, --boot-param=NUM Pass number to the boot script (boot param)\n"
" -d, --debuglevel=NUM Set debug verbosity level\n"
@@ -107,6 +108,7 @@
ConfMan.registerDefault("master_volume", 192);
ConfMan.registerDefault("music_volume", 192);
ConfMan.registerDefault("sfx_volume", 192);
+ ConfMan.registerDefault("voice_volume", 192);
ConfMan.registerDefault("multi_midi", false);
ConfMan.registerDefault("native_mt32", false);
@@ -367,6 +369,10 @@
ConfMan.set("sfx_volume", (int)strtol(option, 0, 10), kTransientDomain);
END_OPTION
+ DO_OPTION('r', "voice-volume")
+ ConfMan.set("voice_volume", (int)strtol(option, 0, 10), kTransientDomain);
+ END_OPTION
+
DO_OPTION_CMD('t', "list-targets")
listTargets();
exit(0);
From aquadran at users.sourceforge.net Mon Apr 5 11:38:06 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/doc 05_01.tex,1.7,1.8
Message-ID:
Update of /cvsroot/scummvm/scummvm/doc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526/doc
Modified Files:
05_01.tex
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: 05_01.tex
===================================================================
RCS file: /cvsroot/scummvm/scummvm/doc/05_01.tex,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- 05_01.tex 13 Feb 2004 10:51:33 -0000 1.7
+++ 05_01.tex 5 Apr 2004 18:24:34 -0000 1.8
@@ -21,6 +21,7 @@
-m, --music-volume=NUM &Set the music volume, 0-255 (default: 192)\\
-o, --master-volume=NUM &Set the master volume, 0-255 (default: 192)\\
-s, --sfx-volume=NUM &Set the sfx volume, 0-255 (default: 192)\\
+ -r, --voice-volume=NUM &Set the voice volume, 0-255 (default: 192)\\
-n, --subtitles &Enable subtitles (use with games that have voice)\\
-b, --boot-param=NUM &Pass number to the boot script (boot param)\\
-d, --debuglevel=NUM &Set debug verbosity level\\
From aquadran at users.sourceforge.net Mon Apr 5 11:38:08 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.92,1.93 options.cpp,1.53,1.54 options.h,1.18,1.19
Message-ID:
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526/gui
Modified Files:
launcher.cpp options.cpp options.h
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- launcher.cpp 25 Mar 2004 21:31:03 -0000 1.92
+++ launcher.cpp 5 Apr 2004 18:24:34 -0000 1.93
@@ -225,7 +225,8 @@
e = ConfMan.hasKey("master_volume", _domain) ||
ConfMan.hasKey("music_volume", _domain) ||
- ConfMan.hasKey("sfx_volume", _domain);
+ ConfMan.hasKey("sfx_volume", _domain) ||
+ ConfMan.hasKey("voice_volume", _domain);
_globalVolumeOverride->setState(e);
// TODO: game path
Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- options.cpp 17 Mar 2004 00:07:43 -0000 1.53
+++ options.cpp 5 Apr 2004 18:24:35 -0000 1.54
@@ -49,6 +49,7 @@
kMasterVolumeChanged = 'mavc',
kMusicVolumeChanged = 'muvc',
kSfxVolumeChanged = 'sfvc',
+ kVoiceVolumeChanged = 'vcvc',
kChooseSaveDirCmd = 'chos'
};
@@ -62,7 +63,8 @@
_enableVolumeSettings(false),
_masterVolumeSlider(0), _masterVolumeLabel(0),
_musicVolumeSlider(0), _musicVolumeLabel(0),
- _sfxVolumeSlider(0), _sfxVolumeLabel(0) {
+ _sfxVolumeSlider(0), _sfxVolumeLabel(0),
+ _voiceVolumeSlider(0), _voiceVolumeLabel(0) {
}
@@ -137,6 +139,10 @@
vol = ConfMan.getInt("sfx_volume", _domain);
_sfxVolumeSlider->setValue(vol);
_sfxVolumeLabel->setValue(vol);
+
+ vol = ConfMan.getInt("voice_volume", _domain);
+ _voiceVolumeSlider->setValue(vol);
+ _voiceVolumeLabel->setValue(vol);
}
}
@@ -161,10 +167,12 @@
ConfMan.set("master_volume", _masterVolumeSlider->getValue(), _domain);
ConfMan.set("music_volume", _musicVolumeSlider->getValue(), _domain);
ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
+ ConfMan.set("voice_volume", _voiceVolumeSlider->getValue(), _domain);
} else {
ConfMan.removeKey("master_volume", _domain);
ConfMan.removeKey("music_volume", _domain);
ConfMan.removeKey("sfx_volume", _domain);
+ ConfMan.removeKey("voice_volume", _domain);
}
}
@@ -209,6 +217,10 @@
_sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue());
_sfxVolumeLabel->draw();
break;
+ case kVoiceVolumeChanged:
+ _voiceVolumeLabel->setValue(_voiceVolumeSlider->getValue());
+ _voiceVolumeLabel->draw();
+ break;
case kOKCmd:
setResult(1);
close();
@@ -246,6 +258,8 @@
_musicVolumeLabel->setEnabled(enabled);
_sfxVolumeSlider->setEnabled(enabled);
_sfxVolumeLabel->setEnabled(enabled);
+ _voiceVolumeSlider->setEnabled(enabled);
+ _voiceVolumeLabel->setEnabled(enabled);
}
int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) {
@@ -335,6 +349,12 @@
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
+ _voiceVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Voice volume: ", 100, kVoiceVolumeChanged);
+ _voiceVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
+ _voiceVolumeSlider->setMinValue(0); _voiceVolumeSlider->setMaxValue(255);
+ _voiceVolumeLabel->setFlags(WIDGET_CLEARBG);
+ yoffset += 16;
+
_enableVolumeSettings = true;
return yoffset;
@@ -344,13 +364,13 @@
GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector)
- : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 20, 320 - 2 * 10, 200 - 2 * 20) {
+ : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 20, 320 - 2 * 10, 200 - 1 * 20) {
- const int vBorder = 5;
+ const int vBorder = 4;
int yoffset;
// The tab widget
- TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2*vBorder);
+ TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
//
// 1) The graphics tab
Index: options.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- options.h 15 Mar 2004 02:28:47 -0000 1.18
+++ options.h 5 Apr 2004 18:24:35 -0000 1.19
@@ -90,6 +90,9 @@
SliderWidget *_sfxVolumeSlider;
StaticTextWidget *_sfxVolumeLabel;
+
+ SliderWidget *_voiceVolumeSlider;
+ StaticTextWidget *_voiceVolumeLabel;
};
From aquadran at users.sourceforge.net Mon Apr 5 11:38:10 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:10 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.55,1.56 dimuse.h,1.35,1.36 dimuse_sndmgr.h,1.19,1.20
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526/scumm/imuse_digi
Modified Files:
dimuse.cpp dimuse.h dimuse_sndmgr.h
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- dimuse.cpp 28 Mar 2004 20:31:18 -0000 1.55
+++ dimuse.cpp 5 Apr 2004 18:24:36 -0000 1.56
@@ -20,6 +20,7 @@
#include "stdafx.h"
#include "common/timer.h"
+#include "common/config-manager.h"
#include "scumm/actor.h"
#include "scumm/scumm.h"
@@ -46,6 +47,9 @@
_mutex = g_system->createMutex();
_pause = false;
_sound = new ImuseDigiSndMgr(_vm);
+ _volVoice = 0;
+ _volSfx = 0;
+ _volMusic = 0;
resetState();
_vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this);
}
@@ -60,6 +64,28 @@
g_system->deleteMutex(_mutex);
}
+void IMuseDigital::resetState() {
+ _curMusicState = 0;
+ _curMusicSeq = 0;
+ _curMusicCue = 0;
+ memset(_attributes, 0, sizeof(_attributes));
+ _curSeqAtribPos = 0;
+}
+
+static const Common::String &kTransientDomain = Common::ConfigManager::kTransientDomain;
+
+void IMuseDigital::setGroupVoiceVolume(int volume) {
+ _volVoice = volume;
+}
+
+void IMuseDigital::setGroupMusicVolume(int volume) {
+ _volMusic = volume;
+}
+
+void IMuseDigital::setGroupSfxVolume(int volume) {
+ _volSfx = volume;
+}
+
void IMuseDigital::callback() {
Common::StackLock lock(_mutex, "IMuseDigital::callback()");
int l = 0;
@@ -113,14 +139,22 @@
}
int pan = (_track[l].pan != 64) ? 2 * _track[l].pan - 127 : 0;
+ int vol = _track[l].vol / 1000;
+
+ if (_track[l].soundGroup == 1)
+ vol = (vol * _volVoice) / 128;
+ if (_track[l].soundGroup == 2)
+ vol = (vol * _volSfx) / 128;
+ if (_track[l].soundGroup == 3)
+ vol = (vol * _volMusic) / 128;
if (_vm->_mixer->isReady()) {
if (_track[l].stream2) {
if (!_track[l].started) {
_track[l].started = true;
- _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, true, _track[l].vol / 1000, _track[l].pan, -1, false);
+ _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, false, _track[l].vol / 1000, _track[l].pan, -1, false);
} else {
- _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000);
+ _vm->_mixer->setChannelVolume(_track[l].handle, vol);
_vm->_mixer->setChannelBalance(_track[l].handle, pan);
}
continue;
@@ -174,7 +208,7 @@
result = mixer_size;
if (_vm->_mixer->isReady()) {
- _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000);
+ _vm->_mixer->setChannelVolume(_track[l].handle, vol);
_vm->_mixer->setChannelBalance(_track[l].handle, pan);
_track[l].stream->append(data, result);
_track[l].regionOffset += result;
@@ -345,7 +379,7 @@
} else {
_track[l].stream2 = NULL;
_track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000);
- _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, true, _track[l].vol / 1000, _track[l].pan, -1);
+ _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, false, _track[l].vol / 1000, _track[l].pan, -1);
}
_track[l].used = true;
@@ -373,7 +407,7 @@
void IMuseDigital::setPriority(int soundId, int priority) {
Common::StackLock lock(_mutex, "IMuseDigital::setPriority()");
- debug(5, "IMuseDigital::setPrioritySound(%d, %d)", soundId, priority);
+ debug(5, "IMuseDigital::setPriority(%d, %d)", soundId, priority);
assert ((priority >= 0) && (priority <= 127));
@@ -386,7 +420,7 @@
void IMuseDigital::setVolume(int soundId, int volume) {
Common::StackLock lock(_mutex, "IMuseDigital::setVolume()");
- debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, volume);
+ debug(5, "IMuseDigital::setVolume(%d, %d)", soundId, volume);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].vol = volume * 1000;
@@ -396,7 +430,7 @@
void IMuseDigital::setPan(int soundId, int pan) {
Common::StackLock lock(_mutex, "IMuseDigital::setPan()");
- debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, pan);
+ debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].pan = pan;
@@ -404,6 +438,17 @@
}
}
+void IMuseDigital::selectGroupVolume(int soundId, int groupId) {
+ Common::StackLock lock(_mutex, "IMuseDigital::setGroupVolume()");
+ debug(5, "IMuseDigital::setGroupVolume(%d, %d)", soundId, groupId);
+ assert((groupId >= 1) && (groupId <= 3));
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ if ((_track[l].soundId == soundId) && _track[l].used) {
+ _track[l].soundGroup = groupId;
+ }
+ }
+}
+
void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
Common::StackLock lock(_mutex, "IMuseDigital::setFade()");
debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks);
@@ -497,8 +542,8 @@
break;
case 12: // ImuseSetParam
switch (sub_cmd) {
- case 0x400: // set group volume
- debug(5, "set group volume (0x400), soundId(%d), group volume(%d)", soundId, d);
+ case 0x400: // select group volume
+ selectGroupVolume(soundId, d);
break;
case 0x500: // set priority
setPriority(soundId, d);
@@ -593,17 +638,17 @@
_attributes[b] = c;
}
break;
- case 0x2000: // ImuseSetMasterSFXVolume
- debug(5, "ImuseSetMasterSFXVolume (%d)", b);
- // TODO
+ case 0x2000: // ImuseSetGroupSfxVolume
+ debug(5, "ImuseSetGroupSFXVolume (%d)", b);
+// setGroupSfxVolume(b);
break;
- case 0x2001: // ImuseSetMasterVoiceVolume
- debug(5, "ImuseSetMasterVoiceVolume (%d)", b);
- // TODO
+ case 0x2001: // ImuseSetGroupVoiceVolume
+ debug(5, "ImuseSetGroupVoiceVolume (%d)", b);
+// setGroupVoiceVolume(b);
break;
- case 0x2002: // ImuseSetMasterMusicVolume
- debug(5, "ImuseSetMasterMusicVolume (%d)", b);
- // TODO
+ case 0x2002: // ImuseSetGroupMusicVolume
+ debug(5, "ImuseSetGroupMusicVolume (%d)", b);
+// setGroupMusicVolume(b);
break;
default:
warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- dimuse.h 27 Mar 2004 20:26:25 -0000 1.35
+++ dimuse.h 5 Apr 2004 18:24:36 -0000 1.36
@@ -76,6 +76,11 @@
OSystem::MutexRef _mutex;
ScummEngine *_vm;
ImuseDigiSndMgr *_sound;
+
+ int _volVoice;
+ int _volSfx;
+ int _volMusic;
+
bool _pause;
int _attributes[188];
@@ -125,18 +130,21 @@
{ debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, 0, 127, priority); }
void startSound(int soundId)
{ error("MusicEngine::startSound() Should be never called"); }
- void resetState() {
- _curMusicState = 0;
- _curMusicSeq = 0;
- _curMusicCue = 0;
- memset(_attributes, 0, sizeof(_attributes));
- _curSeqAtribPos = 0;
- }
+
+ void resetState();
+
+ void setGroupVoiceVolume(int volume);
+ void setGroupSfxVolume(int volume);
+ void setGroupMusicVolume(int volume);
+ int getGroupVoiceVolume() { return _volVoice; }
+ int getGroupSfxVolume() { return _volSfx; }
+ int getGroupMusicVolume() { return _volMusic; }
void setPriority(int soundId, int priority);
void setVolume(int soundId, int volume);
void setPan(int soundId, int pan);
void setFade(int soundId, int destVolume, int delay60HzTicks);
+ void selectGroupVolume(int soundId, int groupId);
void setMasterVolume(int vol) {}
void stopSound(int soundId);
void stopAllSounds() { stopAllSounds(false); }
Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dimuse_sndmgr.h 22 Jan 2004 19:43:36 -0000 1.19
+++ dimuse_sndmgr.h 5 Apr 2004 18:24:36 -0000 1.20
@@ -41,6 +41,7 @@
#define IMUSE_RESOURCE 1
#define IMUSE_BUNDLE 2
+
#define IMUSE_VOICE 1
#define IMUSE_SFX 2
#define IMUSE_MUSIC 3
From aquadran at users.sourceforge.net Mon Apr 5 11:38:11 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:11 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.108,1.109 script_v8.cpp,2.246,2.247 scumm.cpp,1.16,1.17
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526/scumm
Modified Files:
dialogs.cpp script_v8.cpp scumm.cpp
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- dialogs.cpp 28 Mar 2004 13:02:27 -0000 1.108
+++ dialogs.cpp 5 Apr 2004 18:24:35 -0000 1.109
@@ -30,6 +30,7 @@
#include "scumm/sound.h"
#include "scumm/scumm.h"
#include "scumm/imuse.h"
+#include "scumm/imuse_digi/dimuse.h"
#include "scumm/player_v2.h"
#include "scumm/verbs.h"
#include "sound/mididrv.h"
@@ -430,7 +431,7 @@
//
// Some misc options
//
- subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 62, 200, 16, "Show subtitles", 0, 'S');
+ subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 78, 200, 16, "Show subtitles", 0, 'S');
//
// Create the sub dialog(s)
@@ -469,10 +470,20 @@
int soundVolumeMaster = ConfMan.getInt("master_volume");
int soundVolumeMusic = ConfMan.getInt("music_volume");
int soundVolumeSfx = ConfMan.getInt("sfx_volume");
+ int soundVolumeVoice = ConfMan.getInt("voice_volume");
+
+ if (_vm->_imuseDigital) {
+ _vm->_mixer->setVolume(soundVolumeMaster);
+ _vm->_imuseDigital->setGroupMusicVolume(soundVolumeMusic / 2);
+ _vm->_imuseDigital->setGroupSfxVolume(soundVolumeSfx / 2);
+ _vm->_imuseDigital->setGroupVoiceVolume(soundVolumeVoice / 2);
+ return;
+ }
if (_vm->_imuse) {
_vm->_imuse->set_music_volume(soundVolumeMusic);
}
+
if (_vm->_musicEngine) {
_vm->_musicEngine->setMasterVolume(soundVolumeMaster);
}
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.246
retrieving revision 2.247
diff -u -d -r2.246 -r2.247
--- script_v8.cpp 4 Apr 2004 19:24:03 -0000 2.246
+++ script_v8.cpp 5 Apr 2004 18:24:35 -0000 2.247
@@ -1461,14 +1461,14 @@
push(a->talkStartFrame);
}
break;
- case 0xDD: // getMasterSFXVol
- push(ConfMan.getInt("sfx_volume") / 2);
+ case 0xDD: // getGroupSfxVol
+ push(_imuseDigital->getGroupSfxVolume());
break;
- case 0xDE: // getMasterVoiceVol
- push(ConfMan.getInt("sfx_volume") / 2);
+ case 0xDE: // getGroupVoiceVol
+ push(_imuseDigital->getGroupVoiceVolume());
break;
- case 0xDF: // getMasterMusicVol
- push(ConfMan.getInt("music_volume") / 2);
+ case 0xDF: // getGroupMusicVol
+ push(_imuseDigital->getGroupMusicVolume());
break;
case 0xE0: // readRegistryValue
{
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- scumm.cpp 3 Apr 2004 19:41:30 -0000 1.16
+++ scumm.cpp 5 Apr 2004 18:24:35 -0000 1.17
@@ -711,6 +711,10 @@
// Init iMuse
if (_features & GF_DIGI_IMUSE) {
_musicEngine = _imuseDigital = new IMuseDigital(this);
+ _mixer->setVolume(ConfMan.getInt("master_volume"));
+ _imuseDigital->setGroupMusicVolume(ConfMan.getInt("music_volume") / 2);
+ _imuseDigital->setGroupSfxVolume(ConfMan.getInt("sfx_volume") / 2);
+ _imuseDigital->setGroupVoiceVolume(ConfMan.getInt("voice_volume") / 2);
} else if ((_features & GF_AMIGA) && (_version == 2)) {
_musicEngine = new Player_V2A(this);
} else if ((_features & GF_AMIGA) && (_version == 3)) {
From aquadran at users.sourceforge.net Mon Apr 5 11:38:18 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:38:18 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.261,1.262 TODO,1.108,1.109
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526
Modified Files:
README TODO
Log Message:
added voice group volume to scumm engine for imuse digital and implemeted volume groups control
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -d -r1.261 -r1.262
--- README 21 Mar 2004 01:21:41 -0000 1.261
+++ README 5 Apr 2004 18:24:32 -0000 1.262
@@ -299,6 +299,7 @@
-m, --music-volume=NUM Set the music volume, 0-255 (default: 192)
-o, --master-volume=NUM Set the master volume, 0-255 (default: 192)
-s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)
+ -r, --voice-volume=NUM Set the voice volume, 0-255 (default: 192)
-n, --subtitles Enable subtitles (use with games that have voice)
-b, --boot-param=NUM Pass number to the boot script (boot param)
-d, --debuglevel=NUM Set debug verbosity level
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- TODO 2 Apr 2004 21:44:07 -0000 1.108
+++ TODO 5 Apr 2004 18:24:33 -0000 1.109
@@ -261,8 +261,6 @@
- Change code to new mixer pool method procedure
- Check if VAR_SYNC if it's set to nonzero value
- Add pool method for FT voc samples from resource
- - Add missing volume channels into sound mixer needed by imuse and add code
- into imuse
- Implement tuning volume level or something(not sure yet what is)
- Implement stuff for fadeParam in JUMP opcode (maybe never implemented)
- Recheck 'next region' code
From aquadran at users.sourceforge.net Mon Apr 5 11:59:04 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 11:59:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm nut_renderer.cpp,1.45,1.46
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21067
Modified Files:
nut_renderer.cpp
Log Message:
removed exception for no used nut font
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- nut_renderer.cpp 4 Apr 2004 19:50:52 -0000 1.45
+++ nut_renderer.cpp 5 Apr 2004 18:45:40 -0000 1.46
@@ -149,23 +149,8 @@
for (int l = 0; l < _nbChars; l++) {
offset += READ_BE_UINT32(dataSrc + offset + 4) + 8;
-
- // TODO/FIXME: The code checks for a "shift" in the FRME headers. Well, neither
- // in my german nor in my english NUT fonts does that occur, but it's very typical
- // for IFF style formats (like this here) to "pad" odd sized blocks. Hence, it might
- // be a cleaner solution to insert this adjustment here:
- // if (offset & 1)
- // offset++;
- // And then get rid of the hack for the shifted FRME. I'd do that right now, but since
- // I have no way to test this (read: no data files where this issue occurs), I am
- // deferring this job for now :-)
-
- if ((READ_BE_UINT32(dataSrc + offset) == 'FRME') || (READ_BE_UINT32(dataSrc + offset + 1) == 'FRME')) {
- if (READ_BE_UINT32(dataSrc + offset) == 'FRME') {
- offset += 8;
- } else { // hack for proper offset
- offset += 9;
- }
+ if (READ_BE_UINT32(dataSrc + offset) == 'FRME') {
+ offset += 8;
if (READ_BE_UINT32(dataSrc + offset) == 'FOBJ') {
int codec = READ_LE_UINT16(dataSrc + offset + 8);
From aquadran at users.sourceforge.net Mon Apr 5 12:08:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 12:08:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6he.cpp,2.42,2.43 script_v7he.cpp,2.9,2.10
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22838
Modified Files:
script_v6he.cpp script_v7he.cpp
Log Message:
there is no imuse in he engine
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.42
retrieving revision 2.43
diff -u -d -r2.42 -r2.43
--- script_v6he.cpp 3 Apr 2004 19:41:30 -0000 2.42
+++ script_v6he.cpp 5 Apr 2004 18:54:50 -0000 2.43
@@ -27,8 +27,6 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
-#include "scumm/imuse.h"
-#include "scumm/imuse_digi/dimuse.h"
#include "scumm/intern.h"
#include "scumm/object.h"
#include "scumm/resource.h"
@@ -1109,10 +1107,7 @@
int volume = pop();
switch (subOp) {
case 222:
- if (_imuse)
- _imuse->set_music_volume(volume);
- else
- _mixer->setMusicVolume(volume);
+ _mixer->setMusicVolume(volume);
break;
case 224:
soundVolumeMaster = ConfMan.getInt("master_volume");
Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -d -r2.9 -r2.10
--- script_v7he.cpp 2 Mar 2004 10:22:55 -0000 2.9
+++ script_v7he.cpp 5 Apr 2004 18:54:51 -0000 2.10
@@ -27,8 +27,6 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
-#include "scumm/imuse.h"
-#include "scumm/imuse_digi/dimuse.h"
#include "scumm/intern.h"
#include "scumm/object.h"
#include "scumm/resource.h"
From joostp at users.sourceforge.net Mon Apr 5 12:20:09 2004
From: joostp at users.sourceforge.net (Joost Peters)
Date: Mon Apr 5 12:20:09 2004
Subject: [Scummvm-cvs-logs] CVS: residual Makefile.common,1.2,1.3
Message-ID:
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25033
Modified Files:
Makefile.common
Log Message:
Fix compilation (on OSX)
Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.common,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.common 5 Apr 2004 02:03:08 -0000 1.2
+++ Makefile.common 5 Apr 2004 19:06:44 -0000 1.3
@@ -1,35 +1,35 @@
OBJS =\
- actor.o \
- bitmap.o \
- blocky16.o \
- costume.o \
- debug.o \
- driver_gl.o \
- engine.o \
- keyframe.o \
- lab.o \
- localize.o \
- lua.o \
- main.o \
- material.o \
- matrix3.o \
- matrix4.o \
- model.o \
- objectstate.o \
- registry.o \
- resource.o \
- scene.o \
- screen.o \
- smush.o \
- sound.o \
- textobject.o \
- textsplit.o \
- timer.o \
- vima.o \
- walkplane.o \
- mixer/mixer.o \
- mixer/rate.o \
- mixer/audiostream.o
+ actor.o \
+ bitmap.o \
+ blocky16.o \
+ costume.o \
+ debug.o \
+ driver_gl.o \
+ engine.o \
+ keyframe.o \
+ lab.o \
+ localize.o \
+ lua.o \
+ main.o \
+ material.o \
+ matrix3.o \
+ matrix4.o \
+ model.o \
+ objectstate.o \
+ registry.o \
+ resource.o \
+ scene.o \
+ screen.o \
+ smush.o \
+ sound.o \
+ textobject.o \
+ textsplit.o \
+ timer.o \
+ vima.o \
+ walkplane.o \
+ mixer/mixer.o \
+ mixer/rate.o \
+ mixer/audiostream.o
DEPS = $(OBJS:.o=.d)
From aquadran at users.sourceforge.net Mon Apr 5 13:00:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 13:00:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.109,1.110
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv597
Modified Files:
TODO
Log Message:
droped
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- TODO 5 Apr 2004 18:24:33 -0000 1.109
+++ TODO 5 Apr 2004 19:47:07 -0000 1.110
@@ -261,7 +261,6 @@
- Change code to new mixer pool method procedure
- Check if VAR_SYNC if it's set to nonzero value
- Add pool method for FT voc samples from resource
- - Implement tuning volume level or something(not sure yet what is)
- Implement stuff for fadeParam in JUMP opcode (maybe never implemented)
- Recheck 'next region' code
- Recheck original imuse stream stuff if match logicaly our code
From aquadran at users.sourceforge.net Mon Apr 5 13:20:06 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 13:20:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.110,1.111
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4711
Modified Files:
TODO
Log Message:
remove usage VAR_SYNC. in scripts used only one time, it's set to 0
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- TODO 5 Apr 2004 19:47:07 -0000 1.110
+++ TODO 5 Apr 2004 20:07:04 -0000 1.111
@@ -259,7 +259,6 @@
- Recheck music code
- Add sound mixer procedure for pool method
- Change code to new mixer pool method procedure
- - Check if VAR_SYNC if it's set to nonzero value
- Add pool method for FT voc samples from resource
- Implement stuff for fadeParam in JUMP opcode (maybe never implemented)
- Recheck 'next region' code
From aquadran at users.sourceforge.net Mon Apr 5 13:20:08 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 13:20:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.56,1.57
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4711/scumm/imuse_digi
Modified Files:
dimuse.cpp
Log Message:
remove usage VAR_SYNC. in scripts used only one time, it's set to 0
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- dimuse.cpp 5 Apr 2004 18:24:36 -0000 1.56
+++ dimuse.cpp 5 Apr 2004 20:07:04 -0000 1.57
@@ -726,7 +726,7 @@
int32 IMuseDigital::getCurVoiceLipSyncWidth() {
Common::StackLock lock(_mutex, "IMuseDigital::getCutVoiceLipSyncWidth()");
- int32 msPos = getPosInMs(kTalkSoundID) + _vm->VAR(_vm->VAR_SYNC) + 50;
+ int32 msPos = getPosInMs(kTalkSoundID) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d)", kTalkSoundID);
@@ -736,7 +736,7 @@
int32 IMuseDigital::getCurVoiceLipSyncHeight() {
Common::StackLock lock(_mutex, "IMuseDigital::getCurVoiceLipSyncHeight()");
- int32 msPos = getPosInMs(kTalkSoundID) + _vm->VAR(_vm->VAR_SYNC) + 50;
+ int32 msPos = getPosInMs(kTalkSoundID) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d)", kTalkSoundID);
@@ -754,7 +754,7 @@
}
}
- int32 msPos = getPosInMs(soundId) + _vm->VAR(_vm->VAR_SYNC) + 50;
+ int32 msPos = getPosInMs(soundId) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d, %d)", soundId, msPos);
@@ -772,7 +772,7 @@
}
}
- int32 msPos = getPosInMs(soundId) + _vm->VAR(_vm->VAR_SYNC) + 50;
+ int32 msPos = getPosInMs(soundId) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d, %d)", soundId, msPos);
From fingolfin at users.sourceforge.net Mon Apr 5 15:14:06 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 15:14:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm config.guess,NONE,1.1
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25889
Added Files:
config.guess
Log Message:
GNUs config.guess script - portable way to detect the host OS/cpu/vendor (also used by autoconf, but actually maintained seperately) - to be used by our hand rolled configure script
--- NEW FILE: config.guess ---
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-01-24'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
[...1396 lines suppressed...]
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
From fingolfin at users.sourceforge.net Mon Apr 5 15:16:11 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 15:16:11 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.156,1.157
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26306
Modified Files:
script.cpp
Log Message:
Paranoid fix for potential 64bit issue; some possibly useful debug output added
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- script.cpp 4 Apr 2004 23:29:09 -0000 1.156
+++ script.cpp 5 Apr 2004 22:02:58 -0000 1.157
@@ -429,7 +429,7 @@
byte ScummEngine::fetchScriptByte() {
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
- uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
+ long oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
_scriptPointer = _scriptOrgPointer + oldoffs;
}
@@ -439,7 +439,7 @@
uint ScummEngine::fetchScriptWord() {
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
- uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
+ long oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
_scriptPointer = _scriptOrgPointer + oldoffs;
}
@@ -540,6 +540,8 @@
}
void ScummEngine::writeVar(uint var, int value) {
+ debugC(DEBUG_VARS, "writeVar(%d, %d)", var, value);
+
if (!(var & 0xF000)) {
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)");
@@ -630,6 +632,7 @@
void ScummEngine::push(int a) {
assert(_scummStackPos >= 0 && _scummStackPos < ARRAYSIZE(_vmStack));
+ //debug(9, "push %d", a);
_vmStack[_scummStackPos++] = a;
}
@@ -637,8 +640,9 @@
if (_scummStackPos < 1 || _scummStackPos > ARRAYSIZE(_vmStack)) {
error("No items on stack to pop() for %s (0x%X) at [%d-%d]", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number);
}
-
- return _vmStack[--_scummStackPos];
+ --_scummStackPos;
+ //debug(9, "pop %d", _vmStack[_scummStackPos]);
+ return _vmStack[_scummStackPos];
}
void ScummEngine::stopObjectCode() {
From fingolfin at users.sourceforge.net Mon Apr 5 15:20:09 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 15:20:09 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm configure,1.83,1.84
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27219
Modified Files:
configure
Log Message:
Use config.guess to detect host OS/cpu/vendor; enforce memory alignment on Alpha machines; do not use printf directly, rather use echo_n (not sure how portable 'printf' is)
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- configure 23 Mar 2004 00:30:50 -0000 1.83
+++ configure 5 Apr 2004 22:07:09 -0000 1.84
@@ -45,8 +45,14 @@
_backend=sdl
_ranlib=ranlib
_sdlconfig=sdl-config
-_host=""
_sdlpath="$PATH"
+
+# For cross compiling
+_host=""
+_host_cpu=""
+_host_vendor=""
+_host_os=""
+
# config.h defaults
_def_linupy="#undef LINUPY"
@@ -97,7 +103,7 @@
# TODO: small bit of code to test sdl useability
find_sdlconfig()
{
- printf "Looking for sdl-config... "
+ echo_n "Looking for sdl-config... "
sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
_sdlconfig=
@@ -328,16 +334,21 @@
CXXFLAGS="$CXXFLAGS $DEBFLAGS"
if test "$_host" = "linupy"; then
- _host=arm-linux
- def_linupy="#define DLINUPY"
+ _host_os=linux
+ _host_cpu=arm
+else
+ guessed_host=`./config.guess`
+ _host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ _host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ _host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
fi
#
# Determine the C++ compiler
#
-printf "Looking for C++ compiler... "
+echo_n "Looking for C++ compiler... "
if test -n "$_host"; then
- compilers="$CXX $_host-g++ $_host-c++"
+ compilers="$CXX $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++"
else
compilers="$CXX g++ c++"
fi
@@ -403,9 +414,8 @@
#
if test "$_cxx_major" -ge "3" ; then
- hosttype=`uname -s`
- case $hosttype in
- MINGW32* | CYGWIN*)
+ case $_host_os in
+ mingw* | cygwin*)
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
;;
*)
@@ -464,11 +474,12 @@
if test -n "$_host"; then
# Cross-compiling mode - add your target here if needed
case "$_host" in
- arm-linux)
+ linupy)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
DEFINES="$DEFINES -DUNIX"
_def_endianess='#define SCUMM_LITTLE_ENDIAN'
_def_align='#define SCUMM_NEED_ALIGNMENT'
+ _def_linupy="#define DLINUPY"
type_1_byte='char'
type_2_byte='short'
type_4_byte='int'
@@ -481,34 +492,32 @@
else
#
- # Determine hosttype
+ # Determine build settings
#
# TODO - also add an command line option to override this?!?
- # TODO - recognize more systems, e.g. *BSD
- printf "Checking hosttype... "
- hosttype=`uname -s`
- echo $hosttype
- case $hosttype in
- Linux | OpenBSD | FreeBSD | NetBSD | BSD/OS | SunOS | HP-UX | BeOS)
+ echo_n "Checking hosttype... "
+ echo $_host_os
+ case $_host_os in
+ linux* | openbsd* | freebsd* | netbsd* | bsd* | sunos* | hpux* | beos*)
DEFINES="$DEFINES -DUNIX"
;;
- IRIX)
+ irix*)
DEFINES="$DEFINES -DUNIX"
ranlib=ar -r
;;
- Darwin)
+ darwin*)
DEFINES="$DEFINES -DUNIX -DMACOSX"
LIBS="$LIBS -framework QuickTime -framework AudioUnit -framework Carbon"
# TODO: Add proper check for Altivec support in the compiler...
DEFINES="$DEFINES -DHAS_ALTIVEC"
CXXFLAGS="$CXXFLAGS -faltivec"
;;
- MINGW32*)
+ mingw*)
DEFINES="$DEFINES -DWIN32"
LIBS="$LIBS -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
;;
- CYGWIN*)
+ cygwin*)
DEFINES="$DEFINES -mno-cygwin -DWIN32"
LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
@@ -523,7 +532,7 @@
#
# Check for endianess
#
- printf "Checking endianess... "
+ echo_n "Checking endianess... "
cat <tmp_endianess_check.cpp
#include
#include
@@ -560,7 +569,14 @@
# Check whether memory alignment is required
#
echo_n "Alignment required... "
- cat > $TMPC << EOF
+ case $_host_cpu in
+ alpha*)
+ # Hardcode alignment requirements for Alpha processsors
+ _need_memalign=yes
+ ;;
+ *)
+ # Try to auto-detect....
+ cat > $TMPC << EOF
#include
#include
int main(int argc, char **argv)
@@ -575,8 +591,11 @@
return 0;
}
EOF
- _need_memalign=yes
- cc_check && $TMPO && _need_memalign=no
+ _need_memalign=yes
+ cc_check && $TMPO && _need_memalign=no
+ ;;
+ esac
+
if test "$_need_memalign" = yes ; then
_def_align='#define SCUMM_NEED_ALIGNMENT'
else
@@ -587,16 +606,21 @@
#
# Determine data type sizes
# TODO: proper error checking
+ # TODO: Actually, we should check individually for both signed & unsigned
+ # data types - there are systems on which the size of an unsigned int
+ # differs from that of a signed int!
+ # However, so far we haven't encountered one of those, so we can live with
+ # the limited check for now.
#
- printf "Type with 1 byte... "
+ echo_n "Type with 1 byte... "
type_1_byte=`find_type_with_size 1`
echo "$type_1_byte"
- printf "Type with 2 bytes... "
+ echo_n "Type with 2 bytes... "
type_2_byte=`find_type_with_size 2`
echo "$type_2_byte"
- printf "Type with 4 bytes... "
+ echo_n "Type with 4 bytes... "
type_4_byte=`find_type_with_size 4`
echo "$type_4_byte"
@@ -608,8 +632,8 @@
echocheck "Plugin support"
_mak_plugins=
if test "$_build_plugins" = yes ; then
- case $hosttype in
- Linux)
+ case $_host_os in
+ linux)
_mak_plugins='
BUILD_PLUGINS := 1
CXXFLAGS += -DDYNAMIC_MODULES
@@ -620,7 +644,7 @@
LIBS += -ldl
'
;;
- Darwin)
+ darwin)
_mak_plugins='
BUILD_PLUGINS := 1
CXXFLAGS += -DDYNAMIC_MODULES
From fingolfin at users.sourceforge.net Mon Apr 5 17:08:36 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 17:08:36 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.151,1.152 script_v2.cpp,2.245,2.246 script_v5.cpp,1.234,1.235 script_v6.cpp,1.327,1.328 script_v6he.cpp,2.43,2.44 script_v8.cpp,2.247,2.248 scumm.cpp,1.17,1.18 scumm.h,1.394,1.395 string.cpp,1.213,1.214
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13209
Modified Files:
saveload.cpp script_v2.cpp script_v5.cpp script_v6.cpp
script_v6he.cpp script_v8.cpp scumm.cpp scumm.h string.cpp
Log Message:
Renamed StringTab::backup to StringTab::_default, as that describes better what it does
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- saveload.cpp 4 Apr 2004 20:20:09 -0000 1.151
+++ saveload.cpp 5 Apr 2004 23:54:55 -0000 1.152
@@ -571,23 +571,23 @@
};
const SaveLoadEntry stringTabEntries[] = {
- // Then backup/restore of a StringTab entry becomes a one liner.
+ // Then _default/restore of a StringTab entry becomes a one liner.
MKLINE(StringTab, xpos, sleInt16, VER(8)),
- MKLINE(StringTab, backup.xpos, sleInt16, VER(8)),
+ MKLINE(StringTab, _default.xpos, sleInt16, VER(8)),
MKLINE(StringTab, ypos, sleInt16, VER(8)),
- MKLINE(StringTab, backup.ypos, sleInt16, VER(8)),
+ MKLINE(StringTab, _default.ypos, sleInt16, VER(8)),
MKLINE(StringTab, right, sleInt16, VER(8)),
- MKLINE(StringTab, backup.right, sleInt16, VER(8)),
+ MKLINE(StringTab, _default.right, sleInt16, VER(8)),
MKLINE(StringTab, color, sleInt8, VER(8)),
- MKLINE(StringTab, backup.color, sleInt8, VER(8)),
+ MKLINE(StringTab, _default.color, sleInt8, VER(8)),
MKLINE(StringTab, charset, sleInt8, VER(8)),
- MKLINE(StringTab, backup.charset, sleInt8, VER(8)),
+ MKLINE(StringTab, _default.charset, sleInt8, VER(8)),
MKLINE(StringTab, center, sleByte, VER(8)),
- MKLINE(StringTab, backup.center, sleByte, VER(8)),
+ MKLINE(StringTab, _default.center, sleByte, VER(8)),
MKLINE(StringTab, overhead, sleByte, VER(8)),
- MKLINE(StringTab, backup.overhead, sleByte, VER(8)),
+ MKLINE(StringTab, _default.overhead, sleByte, VER(8)),
MKLINE(StringTab, no_talk_anim, sleByte, VER(8)),
- MKLINE(StringTab, backup.no_talk_anim, sleByte, VER(8)),
+ MKLINE(StringTab, _default.no_talk_anim, sleByte, VER(8)),
MKEND()
};
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.245
retrieving revision 2.246
diff -u -d -r2.245 -r2.246
--- script_v2.cpp 3 Apr 2004 19:41:30 -0000 2.245
+++ script_v2.cpp 5 Apr 2004 23:54:55 -0000 2.246
@@ -847,7 +847,7 @@
vs->dimcolor = 8;
}
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].backup.charset;
+ vs->charset_nr = _string[0]._default.charset;
vs->curmode = 1;
vs->saveid = 0;
vs->key = 0;
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.234
retrieving revision 1.235
diff -u -d -r1.234 -r1.235
--- script_v5.cpp 3 Apr 2004 19:41:30 -0000 1.234
+++ script_v5.cpp 5 Apr 2004 23:54:56 -0000 1.235
@@ -707,7 +707,7 @@
} else {
getWordVararg(table);
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)table[i];
+ _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)table[i];
}
break;
}
@@ -2405,7 +2405,7 @@
vs->hicolor = (_version == 3) ? 14 : 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].backup.charset;
+ vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -2616,7 +2616,7 @@
textSlot = 0;
}
- _string[textSlot].restoreString();
+ _string[textSlot].loadDefault();
while ((_opcode = fetchScriptByte()) != 0xFF) {
switch (_opcode & 0xF) {
@@ -2709,9 +2709,9 @@
// speaks during the intro are put at position 0,0.
// In addition, Loom needs to remember the text colour.
if (_gameId == GID_LOOM || _gameId == GID_INDY3) {
- _string[textSlot].backup.xpos = _string[textSlot].xpos;
- _string[textSlot].backup.ypos = _string[textSlot].ypos;
- _string[textSlot].backup.color = _string[textSlot].color;
+ _string[textSlot]._default.xpos = _string[textSlot].xpos;
+ _string[textSlot]._default.ypos = _string[textSlot].ypos;
+ _string[textSlot]._default.color = _string[textSlot].color;
}
return;
default:
@@ -2720,7 +2720,7 @@
}
}
- _string[textSlot].backupString();
+ _string[textSlot].saveDefault();
}
void ScummEngine_v5::o5_oldRoomEffect() {
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- script_v6.cpp 3 Apr 2004 19:41:30 -0000 1.327
+++ script_v6.cpp 5 Apr 2004 23:54:56 -0000 1.328
@@ -949,7 +949,7 @@
case 0x9D: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i];
+ _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
break;
case 0xD6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
makeCursorColorTransparent(pop());
@@ -1925,7 +1925,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].backup.charset;
+ vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -2294,7 +2294,7 @@
void ScummEngine_v6::o6_talkActor() {
_actorToPrintStrFor = pop();
- _string[0].restoreString();
+ _string[0].loadDefault();
actorTalk(_scriptPointer);
_scriptPointer += resStrLen(_scriptPointer) + 1;
@@ -3119,12 +3119,12 @@
break;
case 0xFE:
- _string[m].restoreString();
+ _string[m].loadDefault();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xFF:
- _string[m].backupString();
+ _string[m].saveDefault();
break;
default:
error("decodeParseString: default case 0x%x", b);
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.43
retrieving revision 2.44
diff -u -d -r2.43 -r2.44
--- script_v6he.cpp 5 Apr 2004 18:54:50 -0000 2.43
+++ script_v6he.cpp 5 Apr 2004 23:54:58 -0000 2.44
@@ -754,7 +754,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].backup.charset;
+ vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
@@ -1463,12 +1463,12 @@
warning("decodeParseString case 0xF9 stub");
break;
case 0xFE:
- _string[m].restoreString();
+ _string[m].loadDefault();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xFF:
- _string[m].backupString();
+ _string[m].saveDefault();
break;
default:
error("decodeParseString: default case 0x%x", b);
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.247
retrieving revision 2.248
diff -u -d -r2.247 -r2.248
--- script_v8.cpp 5 Apr 2004 18:24:35 -0000 2.247
+++ script_v8.cpp 5 Apr 2004 23:54:58 -0000 2.248
@@ -472,12 +472,12 @@
switch (b) {
case 0xC8: // SO_PRINT_BASEOP
- _string[m].restoreString();
+ _string[m].loadDefault();
if (n)
_actorToPrintStrFor = pop();
break;
case 0xC9: // SO_PRINT_END
- _string[m].backupString();
+ _string[m].saveDefault();
break;
case 0xCA: // SO_PRINT_AT
_string[m].ypos = pop();
@@ -762,7 +762,7 @@
case 0xE8: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
- _charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i];
+ _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
break;
case 0xE9: // SO_CURSOR_PUT
{
@@ -1144,7 +1144,7 @@
vs->hicolor = 0;
vs->dimcolor = 8;
vs->type = kTextVerbType;
- vs->charset_nr = _string[0].backup.charset;
+ vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0;
vs->saveid = 0;
vs->key = 0;
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- scumm.cpp 5 Apr 2004 18:24:35 -0000 1.17
+++ scumm.cpp 5 Apr 2004 23:54:58 -0000 1.18
@@ -1132,16 +1132,16 @@
for (i = 0; i < 6; i++) {
if (_version == 3) { // FIXME - what is this?
- _string[i].backup.xpos = 0;
- _string[i].backup.ypos = 0;
+ _string[i]._default.xpos = 0;
+ _string[i]._default.ypos = 0;
} else {
- _string[i].backup.xpos = 2;
- _string[i].backup.ypos = 5;
+ _string[i]._default.xpos = 2;
+ _string[i]._default.ypos = 5;
}
- _string[i].backup.right = _screenWidth - 1;
- _string[i].backup.color = 0xF;
- _string[i].backup.center = 0;
- _string[i].backup.charset = 0;
+ _string[i]._default.right = _screenWidth - 1;
+ _string[i]._default.color = 0xF;
+ _string[i]._default.center = 0;
+ _string[i]._default.charset = 0;
}
// all keys are released
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.394
retrieving revision 1.395
diff -u -d -r1.394 -r1.395
--- scumm.h 5 Apr 2004 00:24:26 -0000 1.394
+++ scumm.h 5 Apr 2004 23:54:58 -0000 1.395
@@ -264,16 +264,19 @@
};
struct StringTab : StringSlot {
- StringSlot backup;
+ // The 'default' values for this string slot. This is used so that the
+ // string slot can temporarily be set to different values, and then be
+ // easily reset to a previously set default.
+ StringSlot _default;
- void backupString() {
+ void saveDefault() {
StringSlot &s = *this;
- backup = s;
+ _default = s;
}
- void restoreString() {
+ void loadDefault() {
StringSlot &s = *this;
- s = backup;
+ s = _default;
}
};
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- string.cpp 4 Apr 2004 20:20:09 -0000 1.213
+++ string.cpp 5 Apr 2004 23:54:58 -0000 1.214
@@ -598,8 +598,8 @@
if (!getResourceAddress(rtCharset, charsetno))
loadCharset(charsetno);
- _string[0].backup.charset = charsetno;
- _string[1].backup.charset = charsetno;
+ _string[0]._default.charset = charsetno;
+ _string[1]._default.charset = charsetno;
for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[charsetno][i];
From fingolfin at users.sourceforge.net Mon Apr 5 17:10:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 17:10:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v5.cpp,1.235,1.236
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13597
Modified Files:
script_v5.cpp
Log Message:
Replaced FIXME with proper explanation and code (the previous hack was actually correct, just incomplete)
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -d -r1.235 -r1.236
--- script_v5.cpp 5 Apr 2004 23:54:56 -0000 1.235
+++ script_v5.cpp 5 Apr 2004 23:56:28 -0000 1.236
@@ -2701,17 +2701,16 @@
break;
}
- // FIXME: Store positions, this is needed for Indy3 (Grail Diary)..
- // I don't believe this is the correct fix, may cause other problems
- // later in the game.
+ // In SCUMM V1-V3, there were no 'default' values for the text slot
+ // values. Hence to achieve correct behaviour, we have to keep the
+ // 'default' values in sync with the active values. To do that we
+ // simply call saveDefault() on the StringTab in question.
//
- // It's also needed for Loom, or the lines Bobbin
- // speaks during the intro are put at position 0,0.
- // In addition, Loom needs to remember the text colour.
- if (_gameId == GID_LOOM || _gameId == GID_INDY3) {
- _string[textSlot]._default.xpos = _string[textSlot].xpos;
- _string[textSlot]._default.ypos = _string[textSlot].ypos;
- _string[textSlot]._default.color = _string[textSlot].color;
+ // Note: This is needed for Indy3 (Grail Diary). It's also needed
+ // for Loom, or the lines Bobbin speaks during the intro are put
+ // at position 0,0.
+ if (_version <= 3) {
+ _string[textSlot].saveDefault();
}
return;
default:
From fingolfin at users.sourceforge.net Mon Apr 5 18:20:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 5 18:20:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.119,1.120 costume.cpp,1.129,1.130
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24468
Modified Files:
akos.cpp costume.cpp
Log Message:
Fix for bug #929724 (MI2: Intro regression) -> since _outheight can be negative, negative y values aren't filtered out automatically anymore, so we have to explicitly check for them
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- akos.cpp 4 Apr 2004 22:43:54 -0000 1.119
+++ akos.cpp 6 Apr 2004 01:06:54 -0000 1.120
@@ -382,9 +382,9 @@
return;
}
} else {
- masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
- if (color && y < _outheight && !masked && !skip_column) {
+ if (color && !masked && !skip_column) {
pcolor = palette[color];
if (_shadow_mode == 1) {
if (pcolor == 13)
@@ -725,9 +725,15 @@
if (v1.skip_width <= 0 || _height <= 0)
return 0;
- if (rect.top > _outheight)
+ if (rect.left < 0)
+ rect.left = 0;
+
+ if (rect.top < 0)
rect.top = 0;
+ if (rect.top > _outheight)
+ rect.top = _outheight;
+
if (rect.bottom > _outheight)
rect.bottom = _outheight;
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- costume.cpp 4 Apr 2004 22:43:54 -0000 1.129
+++ costume.cpp 6 Apr 2004 01:06:54 -0000 1.130
@@ -200,7 +200,7 @@
v1.scaleXstep = _mirror ? 1 : -1;
if (_vm->_version == 1)
- //HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left
+ //HACK: it fix gfx glitches left by actor costume in V1 games, when actor moving to left
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID);
else
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
@@ -254,9 +254,12 @@
if (rect.left < 0)
rect.left = 0;
- if (rect.top > _outheight)
+ if (rect.top < 0)
rect.top = 0;
+ if (rect.top > _outheight)
+ rect.top = _outheight;
+
if (rect.bottom > _outheight)
rect.bottom = _outheight;
@@ -394,7 +397,7 @@
if (!rep)
color = *src++;
- if (y < _outheight) {
+ if (0 <= y && y < _outheight) {
if (!_mirror) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
@@ -455,9 +458,9 @@
do {
if (_scaleY == 255 || *scaleytab++ < _scaleY) {
- masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
- if (color && y < _outheight && !masked) {
+ if (color && !masked) {
// FIXME: Fully implement _shadow_mode.
// For now, it's enough for Sam & Max
// transparency.
@@ -525,7 +528,7 @@
len = *src++;
do {
if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
- masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
*dst = _palette[color];
From aquadran at users.sourceforge.net Mon Apr 5 23:19:00 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 23:19:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.111,1.112
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4732
Modified Files:
TODO
Log Message:
update
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- TODO 5 Apr 2004 20:07:04 -0000 1.111
+++ TODO 6 Apr 2004 06:05:17 -0000 1.112
@@ -255,25 +255,21 @@
on small devices
* Fix codec44 for nut fonts
* iMUSE Digital:
- - Fix continue playing 'state' music paused by 'sequence' music
- - Recheck music code
- - Add sound mixer procedure for pool method
- - Change code to new mixer pool method procedure
+ - Cleanup startSound code
+ - Make struct sync, jump, regions use dynamic memory usage
- Add pool method for FT voc samples from resource
- - Implement stuff for fadeParam in JUMP opcode (maybe never implemented)
+ - Fix music code
- Recheck 'next region' code
- - Recheck original imuse stream stuff if match logicaly our code
- - Make struct sync, jump, regions use dynamic memory usage
- - Split startSound mess into more clear code
+ - Implement pool method data transfer between imuse and sound mixer
+ - Implement split track for fadeout track needed by fadeParam in JUMP opcode
- Add save/load code
- Add code for MP3 and Ogg Vorbis compressed datafiles
* SMUSH:
+ - Add support for compressed gfx frames by zlib
- Add support for codec 37 opcode 1, for PC version of FT demo
- - Get rid smush mixer add code for imuse to handle smush tracks
- - Cleanup channel mess
- - Make code more clear in some places (subtiles code for ex.)
+ - Get rid smush mixer add code for imuse to handle smush tracks and cleanup channel code
- Add code for MP3 encoded sound tracks (distant future)
- - Add support for compressed gfx frames by zlib
+ - Make code more clear in some places (subtiles code for ex.)
* Humongous Entertainment Games
- Add proper handling of sound and speech in Humongous games
- Add support for returning the correct music status for the digital music
From aquadran at users.sourceforge.net Mon Apr 5 23:33:03 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 23:33:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.57,1.58
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6592
Modified Files:
dimuse.cpp
Log Message:
that is not needed anymore
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- dimuse.cpp 5 Apr 2004 20:07:04 -0000 1.57
+++ dimuse.cpp 6 Apr 2004 06:19:52 -0000 1.58
@@ -72,8 +72,6 @@
_curSeqAtribPos = 0;
}
-static const Common::String &kTransientDomain = Common::ConfigManager::kTransientDomain;
-
void IMuseDigital::setGroupVoiceVolume(int volume) {
_volVoice = volume;
}
From aquadran at users.sourceforge.net Mon Apr 5 23:34:12 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 5 23:34:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.58,1.59
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6790
Modified Files:
dimuse.cpp
Log Message:
that is not needed anymore
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- dimuse.cpp 6 Apr 2004 06:19:52 -0000 1.58
+++ dimuse.cpp 6 Apr 2004 06:20:51 -0000 1.59
@@ -20,7 +20,6 @@
#include "stdafx.h"
#include "common/timer.h"
-#include "common/config-manager.h"
#include "scumm/actor.h"
#include "scumm/scumm.h"
From fingolfin at users.sourceforge.net Tue Apr 6 04:24:08 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Tue Apr 6 04:24:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/common rect.h,1.19,1.20
Message-ID:
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22600
Modified Files:
rect.h
Log Message:
Fixed Rect(width, height) constructor
Index: rect.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/rect.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- rect.h 4 Mar 2004 22:26:31 -0000 1.19
+++ rect.h 6 Apr 2004 11:11:10 -0000 1.20
@@ -53,7 +53,7 @@
int16 bottom, right; //!< The point at the bottom right of the rectangle (not part of the rect).
Rect() : top(0), left(0), bottom(0), right(0) {}
- Rect(int16 x, int16 y) : top(0), left(0), bottom(x), right(y) {}
+ Rect(int16 w, int16 h) : top(0), left(0), bottom(h), right(w) {}
Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) {
assert(isValidRect());
}
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:04:03 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:04:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/doc 08.tex,1.6,1.7
Message-ID:
Update of /cvsroot/scummvm/scummvm/doc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29111/doc
Modified Files:
08.tex
Log Message:
Changed "voice_volume" to "speech_volume" for consistency with the Broken
Sword games. (The digial iMUSE code still calls it voice volume, though.)
Index: 08.tex
===================================================================
RCS file: /cvsroot/scummvm/scummvm/doc/08.tex,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- 08.tex 4 Mar 2004 02:47:39 -0000 1.6
+++ 08.tex 6 Apr 2004 11:50:34 -0000 1.7
@@ -101,6 +101,7 @@
& there is a true Roland MT-32 available.\\
sfx\_volume &number The sfx volume setting (0-255)\\
tempo &number The music tempo (50-200) (default: 100)\\
+ speech\_volume &number The speech volume setting (0-255)\\
\\
copy\_protection&bool Enable copy protection in SCUMM games ,when\\
& ScummVM disables it by default.\\
@@ -122,12 +123,10 @@
reverse\_stereo &bool &If true, stereo channels are reversed\\
sfx\_mute &bool &If true, sound effects are muted\\
speech\_mute &bool &If true, speech is muted\\
- speech\_volume &number &The speech volume setting (0-255)\\
\end{tabular}
Flight of the Amazon Queen adds the following non-standard keywords:\\
\begin{tabular}[h]{lll}
- alt\_intro &bool &Use alternative version of introduction\\
music\_mute &bool &If true, music is muted\\
sfx\_mute &bool &If true, sound effects are muted\\
speech\_mute &bool &If true, speech is muted\\
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:04:05 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:04:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.262,1.263
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29111
Modified Files:
README
Log Message:
Changed "voice_volume" to "speech_volume" for consistency with the Broken
Sword games. (The digial iMUSE code still calls it voice volume, though.)
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -d -r1.262 -r1.263
--- README 5 Apr 2004 18:24:32 -0000 1.262
+++ README 6 Apr 2004 11:50:34 -0000 1.263
@@ -933,6 +933,7 @@
there is a true Roland MT-32 available.
sfx_volume number The sfx volume setting (0-255)
tempo number The music tempo (50-200) (default: 100)
+ speech_volume number The speech volume setting (0-255)
copy_protection bool Enable copy protection in SCUMM games ,when
ScummVM disables it by default.
@@ -953,7 +954,6 @@
reverse_stereo bool If true, stereo channels are reversed
sfx_mute bool If true, sound effects are muted
speech_mute bool If true, speech is muted
- speech_volume number The speech volume setting (0-255)
Flight of the Amazon Queen adds the following non-standard keywords:
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:04:06 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:04:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.93,1.94 options.cpp,1.54,1.55 options.h,1.19,1.20
Message-ID:
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29111/gui
Modified Files:
launcher.cpp options.cpp options.h
Log Message:
Changed "voice_volume" to "speech_volume" for consistency with the Broken
Sword games. (The digial iMUSE code still calls it voice volume, though.)
Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- launcher.cpp 5 Apr 2004 18:24:34 -0000 1.93
+++ launcher.cpp 6 Apr 2004 11:50:35 -0000 1.94
@@ -226,7 +226,7 @@
e = ConfMan.hasKey("master_volume", _domain) ||
ConfMan.hasKey("music_volume", _domain) ||
ConfMan.hasKey("sfx_volume", _domain) ||
- ConfMan.hasKey("voice_volume", _domain);
+ ConfMan.hasKey("speech_volume", _domain);
_globalVolumeOverride->setState(e);
// TODO: game path
Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- options.cpp 5 Apr 2004 18:24:35 -0000 1.54
+++ options.cpp 6 Apr 2004 11:50:35 -0000 1.55
@@ -49,7 +49,7 @@
kMasterVolumeChanged = 'mavc',
kMusicVolumeChanged = 'muvc',
kSfxVolumeChanged = 'sfvc',
- kVoiceVolumeChanged = 'vcvc',
+ kSpeechVolumeChanged = 'vcvc',
kChooseSaveDirCmd = 'chos'
};
@@ -64,7 +64,7 @@
_masterVolumeSlider(0), _masterVolumeLabel(0),
_musicVolumeSlider(0), _musicVolumeLabel(0),
_sfxVolumeSlider(0), _sfxVolumeLabel(0),
- _voiceVolumeSlider(0), _voiceVolumeLabel(0) {
+ _speechVolumeSlider(0), _speechVolumeLabel(0) {
}
@@ -140,9 +140,9 @@
_sfxVolumeSlider->setValue(vol);
_sfxVolumeLabel->setValue(vol);
- vol = ConfMan.getInt("voice_volume", _domain);
- _voiceVolumeSlider->setValue(vol);
- _voiceVolumeLabel->setValue(vol);
+ vol = ConfMan.getInt("speech_volume", _domain);
+ _speechVolumeSlider->setValue(vol);
+ _speechVolumeLabel->setValue(vol);
}
}
@@ -167,12 +167,12 @@
ConfMan.set("master_volume", _masterVolumeSlider->getValue(), _domain);
ConfMan.set("music_volume", _musicVolumeSlider->getValue(), _domain);
ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
- ConfMan.set("voice_volume", _voiceVolumeSlider->getValue(), _domain);
+ ConfMan.set("speech_volume", _speechVolumeSlider->getValue(), _domain);
} else {
ConfMan.removeKey("master_volume", _domain);
ConfMan.removeKey("music_volume", _domain);
ConfMan.removeKey("sfx_volume", _domain);
- ConfMan.removeKey("voice_volume", _domain);
+ ConfMan.removeKey("speech_volume", _domain);
}
}
@@ -217,9 +217,9 @@
_sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue());
_sfxVolumeLabel->draw();
break;
- case kVoiceVolumeChanged:
- _voiceVolumeLabel->setValue(_voiceVolumeSlider->getValue());
- _voiceVolumeLabel->draw();
+ case kSpeechVolumeChanged:
+ _speechVolumeLabel->setValue(_speechVolumeSlider->getValue());
+ _speechVolumeLabel->draw();
break;
case kOKCmd:
setResult(1);
@@ -258,8 +258,8 @@
_musicVolumeLabel->setEnabled(enabled);
_sfxVolumeSlider->setEnabled(enabled);
_sfxVolumeLabel->setEnabled(enabled);
- _voiceVolumeSlider->setEnabled(enabled);
- _voiceVolumeLabel->setEnabled(enabled);
+ _speechVolumeSlider->setEnabled(enabled);
+ _speechVolumeLabel->setEnabled(enabled);
}
int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) {
@@ -349,10 +349,10 @@
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
- _voiceVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Voice volume: ", 100, kVoiceVolumeChanged);
- _voiceVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
- _voiceVolumeSlider->setMinValue(0); _voiceVolumeSlider->setMaxValue(255);
- _voiceVolumeLabel->setFlags(WIDGET_CLEARBG);
+ _speechVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Speech volume: ", 100, kSpeechVolumeChanged);
+ _speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
+ _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(255);
+ _speechVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
_enableVolumeSettings = true;
Index: options.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- options.h 5 Apr 2004 18:24:35 -0000 1.19
+++ options.h 6 Apr 2004 11:50:35 -0000 1.20
@@ -91,8 +91,8 @@
SliderWidget *_sfxVolumeSlider;
StaticTextWidget *_sfxVolumeLabel;
- SliderWidget *_voiceVolumeSlider;
- StaticTextWidget *_voiceVolumeLabel;
+ SliderWidget *_speechVolumeSlider;
+ StaticTextWidget *_speechVolumeLabel;
};
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:04:08 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:04:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.109,1.110
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29111/scumm
Modified Files:
dialogs.cpp
Log Message:
Changed "voice_volume" to "speech_volume" for consistency with the Broken
Sword games. (The digial iMUSE code still calls it voice volume, though.)
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- dialogs.cpp 5 Apr 2004 18:24:35 -0000 1.109
+++ dialogs.cpp 6 Apr 2004 11:50:35 -0000 1.110
@@ -470,13 +470,13 @@
int soundVolumeMaster = ConfMan.getInt("master_volume");
int soundVolumeMusic = ConfMan.getInt("music_volume");
int soundVolumeSfx = ConfMan.getInt("sfx_volume");
- int soundVolumeVoice = ConfMan.getInt("voice_volume");
+ int soundVolumeSpeech = ConfMan.getInt("speech_volume");
if (_vm->_imuseDigital) {
_vm->_mixer->setVolume(soundVolumeMaster);
_vm->_imuseDigital->setGroupMusicVolume(soundVolumeMusic / 2);
_vm->_imuseDigital->setGroupSfxVolume(soundVolumeSfx / 2);
- _vm->_imuseDigital->setGroupVoiceVolume(soundVolumeVoice / 2);
+ _vm->_imuseDigital->setGroupVoiceVolume(soundVolumeSpeech / 2);
return;
}
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:04:09 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:04:09 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.74,1.75
Message-ID:
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29111/base
Modified Files:
gameDetector.cpp
Log Message:
Changed "voice_volume" to "speech_volume" for consistency with the Broken
Sword games. (The digial iMUSE code still calls it voice volume, though.)
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- gameDetector.cpp 5 Apr 2004 18:24:34 -0000 1.74
+++ gameDetector.cpp 6 Apr 2004 11:50:35 -0000 1.75
@@ -63,7 +63,7 @@
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
" -o, --master-volume=NUM Set the master volume, 0-255 (default: 192)\n"
" -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)\n"
- " -r, --voice-volume=NUM Set the voice volume, 0-255 (default: 192)\n"
+ " -r, --speech-volume=NUM Set the speech volume, 0-255 (default: 192)\n"
" -n, --subtitles Enable subtitles (use with games that have voice)\n"
" -b, --boot-param=NUM Pass number to the boot script (boot param)\n"
" -d, --debuglevel=NUM Set debug verbosity level\n"
@@ -108,7 +108,7 @@
ConfMan.registerDefault("master_volume", 192);
ConfMan.registerDefault("music_volume", 192);
ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("voice_volume", 192);
+ ConfMan.registerDefault("speech_volume", 192);
ConfMan.registerDefault("multi_midi", false);
ConfMan.registerDefault("native_mt32", false);
@@ -369,8 +369,8 @@
ConfMan.set("sfx_volume", (int)strtol(option, 0, 10), kTransientDomain);
END_OPTION
- DO_OPTION('r', "voice-volume")
- ConfMan.set("voice_volume", (int)strtol(option, 0, 10), kTransientDomain);
+ DO_OPTION('r', "speech-volume")
+ ConfMan.set("speech_volume", (int)strtol(option, 0, 10), kTransientDomain);
END_OPTION
DO_OPTION_CMD('t', "list-targets")
From eriktorbjorn at users.sourceforge.net Tue Apr 6 05:09:02 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Tue Apr 6 05:09:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.263,1.264
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30116
Modified Files:
README
Log Message:
Forgot to make this change before the last commit.
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -d -r1.263 -r1.264
--- README 6 Apr 2004 11:50:34 -0000 1.263
+++ README 6 Apr 2004 11:55:35 -0000 1.264
@@ -957,7 +957,6 @@
Flight of the Amazon Queen adds the following non-standard keywords:
- alt_intro bool Use alternative version of introduction
music_mute bool If true, music is muted
sfx_mute bool If true, sound effects are muted
speech_mute bool If true, speech is muted
From fingolfin at users.sourceforge.net Tue Apr 6 11:56:12 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Tue Apr 6 11:56:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.18,1.19
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13591/scumm
Modified Files:
scumm.cpp
Log Message:
voice_volume is now speech_volume
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- scumm.cpp 5 Apr 2004 23:54:58 -0000 1.18
+++ scumm.cpp 6 Apr 2004 18:42:53 -0000 1.19
@@ -714,7 +714,7 @@
_mixer->setVolume(ConfMan.getInt("master_volume"));
_imuseDigital->setGroupMusicVolume(ConfMan.getInt("music_volume") / 2);
_imuseDigital->setGroupSfxVolume(ConfMan.getInt("sfx_volume") / 2);
- _imuseDigital->setGroupVoiceVolume(ConfMan.getInt("voice_volume") / 2);
+ _imuseDigital->setGroupVoiceVolume(ConfMan.getInt("speech_volume") / 2);
} else if ((_features & GF_AMIGA) && (_version == 2)) {
_musicEngine = new Player_V2A(this);
} else if ((_features & GF_AMIGA) && (_version == 3)) {
From aquadran at users.sourceforge.net Tue Apr 6 13:00:07 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Tue Apr 6 13:00:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.112,1.113
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28790
Modified Files:
TODO
Log Message:
- split imuse digital code,
- cleanup a little,
- added pool method for FT voc sample from resource,
- make struct sync, jump, regions dynamic memory allocation
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- TODO 6 Apr 2004 06:05:17 -0000 1.112
+++ TODO 6 Apr 2004 19:46:41 -0000 1.113
@@ -255,9 +255,6 @@
on small devices
* Fix codec44 for nut fonts
* iMUSE Digital:
- - Cleanup startSound code
- - Make struct sync, jump, regions use dynamic memory usage
- - Add pool method for FT voc samples from resource
- Fix music code
- Recheck 'next region' code
- Implement pool method data transfer between imuse and sound mixer
From aquadran at users.sourceforge.net Tue Apr 6 13:00:14 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Tue Apr 6 13:00:14 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm module.mk,1.36,1.37
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28790/scumm
Modified Files:
module.mk
Log Message:
- split imuse digital code,
- cleanup a little,
- added pool method for FT voc sample from resource,
- make struct sync, jump, regions dynamic memory allocation
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- module.mk 7 Mar 2004 03:32:53 -0000 1.36
+++ module.mk 6 Apr 2004 19:46:42 -0000 1.37
@@ -50,6 +50,8 @@
scumm/imuse_digi/dimuse_codecs.o \
scumm/imuse_digi/dimuse_music.o \
scumm/imuse_digi/dimuse_sndmgr.o \
+ scumm/imuse_digi/dimuse_script.o \
+ scumm/imuse_digi/dimuse_track.o \
scumm/imuse_digi/dimuse_tables.o \
scumm/insane/insane.o \
scumm/insane/insane_ben.o \
From aquadran at users.sourceforge.net Tue Apr 6 13:00:15 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Tue Apr 6 13:00:15 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/dists/msvc7 scumm.vcproj,1.20,1.21
Message-ID:
Update of /cvsroot/scummvm/scummvm/dists/msvc7
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28790/dists/msvc7
Modified Files:
scumm.vcproj
Log Message:
- split imuse digital code,
- cleanup a little,
- added pool method for FT voc sample from resource,
- make struct sync, jump, regions dynamic memory allocation
Index: scumm.vcproj
===================================================================
RCS file: /cvsroot/scummvm/scummvm/dists/msvc7/scumm.vcproj,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- scumm.vcproj 14 Mar 2004 16:19:33 -0000 1.20
+++ scumm.vcproj 6 Apr 2004 19:46:42 -0000 1.21
@@ -176,6 +176,9 @@
RelativePath="..\..\scumm\imuse_digi\dimuse_music.cpp">
+
+
+
+
+ RelativePath="..\..\scumm\scumm.cpp">
+ RelativePath="..\..\scumm\scumm.h">
From aquadran at users.sourceforge.net Tue Apr 6 13:00:17 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Tue Apr 6 13:00:17 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_script.cpp,NONE,1.1 dimuse_track.cpp,NONE,1.1 dimuse.cpp,1.59,1.60 dimuse.h,1.36,1.37 dimuse_music.cpp,1.20,1.21 dimuse_sndmgr.cpp,1.27,1.28 dimuse_sndmgr.h,1.20,1.21
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28790/scumm/imuse_digi
Modified Files:
dimuse.cpp dimuse.h dimuse_music.cpp dimuse_sndmgr.cpp
dimuse_sndmgr.h
Added Files:
dimuse_script.cpp dimuse_track.cpp
Log Message:
- split imuse digital code,
- cleanup a little,
- added pool method for FT voc sample from resource,
- make struct sync, jump, regions dynamic memory allocation
--- NEW FILE: dimuse_script.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001-2004 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v 1.1 2004/04/06 19:46:43 aquadran Exp $
*/
#include "stdafx.h"
#include "common/timer.h"
#include "scumm/actor.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse_digi/dimuse_bndmgr.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
namespace Scumm {
void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h) {
int cmd = a;
int soundId = b;
int sub_cmd = c;
if (!cmd)
return;
switch (cmd) {
case 10: // ImuseStopAllSounds
stopAllSounds();
break;
case 12: // ImuseSetParam
switch (sub_cmd) {
case 0x400: // select group volume
selectVolumeGroup(soundId, d);
break;
case 0x500: // set priority
setPriority(soundId, d);
break;
case 0x600: // set volume
setVolume(soundId, d);
break;
case 0x700: // set pan
setPan(soundId, d);
break;
default:
warning("IMuseDigital::doCommand SetParam DEFAULT command %d", sub_cmd);
break;
}
break;
case 14: // ImuseFadeParam
switch (sub_cmd) {
case 0x600: // set volume fading
if ((d != 0) && (e == 0))
setVolume(soundId, d);
else if ((d == 0) && (e == 0))
stopSound(soundId);
else
setFade(soundId, d, e);
break;
default:
warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
break;
}
break;
case 25: // ImuseStartStream
debug(5, "ImuseStartStream (%d, %d, %d)", soundId, c, d);
break;
case 26: // ImuseSwitchStream
debug(5, "ImuseSwitchStream (%d, %d, %d, %d, %d)", soundId, c, d, e, f);
break;
case 0x1000: // ImuseSetState
debug(5, "ImuseSetState (%d)", b);
if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) {
if (b == 1) {
fadeOutMusic(200);
startMusic(1, 127);
} else {
if (getSoundStatus(2) == 0) {
fadeOutMusic(200);
startMusic(2, 127);
}
}
} else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) {
fadeOutMusic(120);
if (b == 2) {
startMusic("in1.imx", 1100, 0, 127);
} else if (b == 4) {
startMusic("in2.imx", 1120, 0, 127);
} else if (b == 8) {
startMusic("out1.imx", 1140, 0, 127);
} else if (b == 9) {
startMusic("out2.imx", 1150, 0, 127);
} else if (b == 16) {
startMusic("gun.imx", 1210, 0, 127);
} else {
warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, _vm->_currentRoom);
}
} else if (_vm->_gameId == GID_DIG) {
setDigMusicState(b);
} else if (_vm->_gameId == GID_CMI) {
setComiMusicState(b);
} else if (_vm->_gameId == GID_FT) {
setFtMusicState(b);
}
break;
case 0x1001: // ImuseSetSequence
debug(5, "ImuseSetSequence (%d)", b);
if (_vm->_gameId == GID_DIG) {
setDigMusicSequence(b);
} else if (_vm->_gameId == GID_CMI) {
setComiMusicSequence(b);
} else if (_vm->_gameId == GID_FT) {
setFtMusicSequence(b);
}
break;
case 0x1002: // ImuseSetCuePoint
debug(5, "ImuseSetCuePoint (%d)", b);
if (_vm->_gameId == GID_FT) {
setFtMusicCuePoint(b);
}
break;
case 0x1003: // ImuseSetAttribute
debug(5, "ImuseSetAttribute (%d, %d)", b, c);
assert((_vm->_gameId == GID_DIG) || (_vm->_gameId == GID_FT));
if (_vm->_gameId == GID_DIG) {
_attributes[b] = c;
}
break;
case 0x2000: // ImuseSetGroupSfxVolume
debug(5, "ImuseSetGroupSFXVolume (%d)", b);
// setGroupSfxVolume(b);
break;
case 0x2001: // ImuseSetGroupVoiceVolume
debug(5, "ImuseSetGroupVoiceVolume (%d)", b);
// setGroupVoiceVolume(b);
break;
case 0x2002: // ImuseSetGroupMusicVolume
debug(5, "ImuseSetGroupMusicVolume (%d)", b);
// setGroupMusicVolume(b);
break;
default:
warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
}
}
void IMuseDigital::startVoice(int soundId, AudioStream *input) {
debug(5, "startVoiceStream(%d)", soundId);
startSound(soundId, NULL, 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
}
void IMuseDigital::startVoice(int soundId, const char *soundName) {
debug(5, "startVoiceBundle(%s)", soundName);
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_VOICE, NULL, 0, 127, 127);
}
void IMuseDigital::startMusic(int soundId, int volume) {
debug(5, "startMusicResource(%d)", soundId);
startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126);
}
void IMuseDigital::startMusic(const char *soundName, int soundId, int hookId, int volume) {
debug(5, "startMusicBundle(%s)", soundName);
startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126);
}
void IMuseDigital::startSfx(int soundId, int priority) {
debug(5, "startSfx(%d)", soundId);
startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority);
}
void IMuseDigital::getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height) {
int32 sync_size;
byte *sync_ptr;
msPos /= 16;
if (msPos < 65536) {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_sound->getSyncSizeAndPtrById(_track[l].soundHandle, syncId, sync_size, &sync_ptr);
if ((sync_size != 0) && (sync_ptr != NULL)) {
sync_size /= 4;
while (sync_size--) {
if (READ_BE_UINT16(sync_ptr) >= msPos)
break;
sync_ptr += 4;
}
if (sync_size < 0)
sync_ptr -= 4;
else
if (READ_BE_UINT16(sync_ptr) > msPos)
sync_ptr -= 4;
width = sync_ptr[2];
height = sync_ptr[3];
return;
}
}
}
}
}
int32 IMuseDigital::getPosInMs(int soundId) {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && (_track[l].used)) {
int32 pos = (5 * (_track[l].dataOffset + _track[l].regionOffset)) / (_track[l].iteration / 200);
return pos;
}
}
return 0;
}
int IMuseDigital::getSoundStatus(int sound) const {
Common::StackLock lock(_mutex, "IMuseDigital::getSoundStatus()");
debug(5, "IMuseDigital::getSoundStatus(%d)", sound);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == sound) && _track[l].used) {
return 1;
}
}
return 0;
}
void IMuseDigital::stopSound(int soundId) {
Common::StackLock lock(_mutex, "IMuseDigital::stopSound()");
debug(5, "IMuseDigital::stopSound(%d)", soundId);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
if (_track[l].stream) {
_track[l].toBeRemoved = true;
}
else if (_track[l].stream2)
_vm->_mixer->stopHandle(_track[l].handle);
}
}
}
int32 IMuseDigital::getCurMusicPosInMs() {
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicPosInMs()");
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
soundId = _track[l].soundId;
}
}
int32 msPos = getPosInMs(soundId);
debug(5, "IMuseDigital::getCurMusicPosInMs(%d) = %d", soundId, msPos);
return msPos;
}
int32 IMuseDigital::getCurVoiceLipSyncWidth() {
Common::StackLock lock(_mutex, "IMuseDigital::getCutVoiceLipSyncWidth()");
int32 msPos = getPosInMs(kTalkSoundID) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d)", kTalkSoundID);
getLipSync(kTalkSoundID, 0, msPos, width, height);
return width;
}
int32 IMuseDigital::getCurVoiceLipSyncHeight() {
Common::StackLock lock(_mutex, "IMuseDigital::getCurVoiceLipSyncHeight()");
int32 msPos = getPosInMs(kTalkSoundID) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d)", kTalkSoundID);
getLipSync(kTalkSoundID, 0, msPos, width, height);
return height;
}
int32 IMuseDigital::getCurMusicLipSyncWidth(int syncId) {
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncWidth()");
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
soundId = _track[l].soundId;
}
}
int32 msPos = getPosInMs(soundId) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d, %d)", soundId, msPos);
getLipSync(soundId, syncId, msPos, width, height);
return width;
}
int32 IMuseDigital::getCurMusicLipSyncHeight(int syncId) {
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncHeight()");
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
soundId = _track[l].soundId;
}
}
int32 msPos = getPosInMs(soundId) + 50;
int32 width = 0, height = 0;
debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d, %d)", soundId, msPos);
getLipSync(soundId, syncId, msPos, width, height);
return height;
}
void IMuseDigital::stopAllSounds(bool waitForStop) {
debug(5, "IMuseDigital::stopAllSounds");
{
Common::StackLock lock(_mutex, "IMuseDigital::stopAllSounds()");
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (_track[l].used) {
if (_track[l].stream) {
_track[l].toBeRemoved = true;
} else if (_track[l].stream2)
_vm->_mixer->stopHandle(_track[l].handle);
}
}
}
if (waitForStop) {
bool used;
do {
used = false;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (_track[l].used)
used = true;
}
g_system->delay_msecs(10);
} while (used);
}
}
void IMuseDigital::pause(bool p) {
Common::StackLock lock(_mutex, "IMuseDigital::pause()");
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (_track[l].used) {
_vm->_mixer->pauseHandle(_track[l].handle, p);
}
}
_pause = p;
}
} // End of namespace Scumm
--- NEW FILE: dimuse_track.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001-2004 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v 1.1 2004/04/06 19:46:43 aquadran Exp $
*/
#include "stdafx.h"
#include "common/timer.h"
#include "scumm/actor.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse_digi/dimuse_bndmgr.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
namespace Scumm {
void IMuseDigital::allocSlot(int priority) {
int l;
int lower_priority = 127;
bool found_free = false;
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (!_track[l].used && !_track[l].handle.isActive())
found_free = true;
}
if (!found_free) {
warning("IMuseDigital::startSound(): All slots are full");
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (_track[l].used && _track[l].handle.isActive() &&
(lower_priority > _track[l].priority) && (!_track[l].stream2))
lower_priority = _track[l].priority;
}
if (lower_priority <= priority) {
int track_id = -1;
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (_track[l].used && _track[l].handle.isActive() &&
(lower_priority == _track[l].priority) && (!_track[l].stream2)) {
track_id = l;
}
}
assert(track_id != -1);
_track[track_id].stream->finish();
_track[track_id].stream = NULL;
_vm->_mixer->stopHandle(_track[track_id].handle);
_sound->closeSound(_track[track_id].soundHandle);
_track[track_id].used = false;
assert(!_track[track_id].handle.isActive());
warning("IMuseDigital::startSound(): Removed sound %d from track %d", _track[track_id].soundId, track_id);
} else {
warning("IMuseDigital::startSound(): Priority sound too low");
return;
}
}
}
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority) {
Common::StackLock lock(_mutex, "IMuseDigital::startSound()");
debug(5, "IMuseDigital::startSound(%d)", soundId);
int l;
allocSlot(priority);
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (!_track[l].used && !_track[l].handle.isActive()) {
_track[l].pan = 64;
_track[l].vol = volume * 1000;
_track[l].volFadeDest = 0;
_track[l].volFadeStep = 0;
_track[l].volFadeDelay = 0;
_track[l].volFadeUsed = false;
_track[l].soundId = soundId;
_track[l].started = false;
_track[l].volGroupId = volGroupId;
_track[l].curHookId = hookId;
_track[l].priority = priority;
_track[l].curRegion = -1;
_track[l].dataOffset = 0;
_track[l].regionOffset = 0;
_track[l].trackOffset = 0;
_track[l].mod = 0;
_track[l].toBeRemoved = false;
int bits = 0, freq = 0, channels = 0, mixerFlags = 0;
if (input) {
_track[l].iteration = 1; // ?
// Do nothing here, we already have an audio stream
} else {
_track[l].soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId);
if (_track[l].soundHandle == NULL)
return;
bits = _sound->getBits(_track[l].soundHandle);
channels = _sound->getChannels(_track[l].soundHandle);
freq = _sound->getFreq(_track[l].soundHandle);
if ((soundId == kTalkSoundID) && (soundType == IMUSE_BUNDLE)) {
if (_vm->_actorToPrintStrFor != 0xFF && _vm->_actorToPrintStrFor != 0) {
Actor *a = _vm->derefActor(_vm->_actorToPrintStrFor, "IMuseDigital::startSound");
freq = (freq * a->talkFrequency) / 256;
_track[l].pan = a->talkPan;
_track[l].vol = a->talkVolume * 1000;
}
}
assert(bits == 8 || bits == 12 || bits == 16);
assert(channels == 1 || channels == 2);
assert(0 < freq && freq <= 65535);
// Round the frequency to a multiple of 25. This is done to
// ensure we don't run into data under-/overflows (this is a
// design limitation of the current IMuseDigital code, which
// pushes data 'blindly' into the mixer, instead of providing
// a pull based interface, i.e. a custom AudioInputStream
// subclass).
freq -= (freq % 25);
_track[l].iteration = _track[l].pullSize = freq * channels;
if (channels == 2)
mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
if ((bits == 12) || (bits == 16)) {
mixerFlags |= SoundMixer::FLAG_16BITS;
_track[l].iteration = _track[l].pullSize *= 2;
} else if (bits == 8) {
mixerFlags |= SoundMixer::FLAG_UNSIGNED;
} else
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
_track[l].pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
}
if (input) {
_track[l].stream2 = input;
_track[l].stream = NULL;
} else {
_track[l].stream2 = NULL;
_track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000);
_vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, false, _track[l].vol / 1000, _track[l].pan, -1);
}
_track[l].used = true;
return;
}
}
warning("it should not happen");
assert(0);
}
void IMuseDigital::setPriority(int soundId, int priority) {
Common::StackLock lock(_mutex, "IMuseDigital::setPriority()");
debug(5, "IMuseDigital::setPriority(%d, %d)", soundId, priority);
assert ((priority >= 0) && (priority <= 127));
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].priority = priority;
}
}
}
void IMuseDigital::setVolume(int soundId, int volume) {
Common::StackLock lock(_mutex, "IMuseDigital::setVolume()");
debug(5, "IMuseDigital::setVolume(%d, %d)", soundId, volume);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].vol = volume * 1000;
}
}
}
void IMuseDigital::setPan(int soundId, int pan) {
Common::StackLock lock(_mutex, "IMuseDigital::setPan()");
debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].pan = pan;
}
}
}
void IMuseDigital::selectVolumeGroup(int soundId, int volGroupId) {
Common::StackLock lock(_mutex, "IMuseDigital::setGroupVolume()");
debug(5, "IMuseDigital::setGroupVolume(%d, %d)", soundId, volGroupId);
assert((volGroupId >= 1) && (volGroupId <= 3));
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].volGroupId = volGroupId;
}
}
}
void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
Common::StackLock lock(_mutex, "IMuseDigital::setFade()");
debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].volFadeDelay = delay60HzTicks;
_track[l].volFadeDest = destVolume * 1000;
_track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * delay60HzTicks);
_track[l].volFadeUsed = true;
}
}
}
void IMuseDigital::fadeOutMusic(int fadeDelay) {
Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusic()");
debug(5, "IMuseDigital::fadeOutMusic");
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
_track[l].volFadeDelay = fadeDelay;
_track[l].volFadeDest = 0;
_track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay);
_track[l].volFadeUsed = true;
}
}
}
} // End of namespace Scumm
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- dimuse.cpp 6 Apr 2004 06:20:51 -0000 1.59
+++ dimuse.cpp 6 Apr 2004 19:46:42 -0000 1.60
@@ -71,18 +71,6 @@
_curSeqAtribPos = 0;
}
-void IMuseDigital::setGroupVoiceVolume(int volume) {
- _volVoice = volume;
-}
-
-void IMuseDigital::setGroupMusicVolume(int volume) {
- _volMusic = volume;
-}
-
-void IMuseDigital::setGroupSfxVolume(int volume) {
- _volSfx = volume;
-}
-
void IMuseDigital::callback() {
Common::StackLock lock(_mutex, "IMuseDigital::callback()");
int l = 0;
@@ -138,11 +126,11 @@
int pan = (_track[l].pan != 64) ? 2 * _track[l].pan - 127 : 0;
int vol = _track[l].vol / 1000;
- if (_track[l].soundGroup == 1)
+ if (_track[l].volGroupId == 1)
vol = (vol * _volVoice) / 128;
- if (_track[l].soundGroup == 2)
+ if (_track[l].volGroupId == 2)
vol = (vol * _volSfx) / 128;
- if (_track[l].soundGroup == 3)
+ if (_track[l].volGroupId == 3)
vol = (vol * _volMusic) / 128;
if (_vm->_mixer->isReady()) {
@@ -257,524 +245,4 @@
_track[track].regionOffset = 0;
}
-void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, int hookId, int volume, int priority) {
- Common::StackLock lock(_mutex, "IMuseDigital::startSound()");
- debug(5, "IMuseDigital::startSound(%d)", soundId);
- int l;
- int lower_priority = 127;
- bool found_free = false;
-
- for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (!_track[l].used && !_track[l].handle.isActive())
- found_free = true;
- }
-
- if (!found_free) {
- warning("IMuseDigital::startSound(): All slots are full");
- for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used && _track[l].handle.isActive() &&
- (lower_priority > _track[l].priority) && (!_track[l].stream2))
- lower_priority = _track[l].priority;
- }
- if (lower_priority <= priority) {
- int track_id = -1;
- for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used && _track[l].handle.isActive() &&
- (lower_priority == _track[l].priority) && (!_track[l].stream2)) {
- track_id = l;
- }
- }
- assert(track_id != -1);
- _track[track_id].stream->finish();
- _track[track_id].stream = NULL;
- _vm->_mixer->stopHandle(_track[track_id].handle);
- _sound->closeSound(_track[track_id].soundHandle);
- _track[track_id].used = false;
- assert(!_track[track_id].handle.isActive());
- warning("IMuseDigital::startSound(): Removed sound %d from track %d", _track[track_id].soundId, track_id);
- } else {
- warning("IMuseDigital::startSound(): Priority sound too low");
- return;
- }
- }
-
- for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (!_track[l].used && !_track[l].handle.isActive()) {
- _track[l].pan = 64;
- _track[l].vol = volume * 1000;
- _track[l].volFadeDest = 0;
- _track[l].volFadeStep = 0;
- _track[l].volFadeDelay = 0;
- _track[l].volFadeUsed = false;
- _track[l].soundId = soundId;
- _track[l].started = false;
- _track[l].soundGroup = soundGroup;
- _track[l].curHookId = hookId;
- _track[l].priority = priority;
- _track[l].curRegion = -1;
- _track[l].dataOffset = 0;
- _track[l].regionOffset = 0;
- _track[l].trackOffset = 0;
- _track[l].mod = 0;
- _track[l].toBeRemoved = false;
-
- int bits = 0, freq = 0, channels = 0, mixerFlags = 0;
-
- if (input) {
- _track[l].iteration = 1; // ?
- // Do nothing here, we already have an audio stream
- } else {
- _track[l].soundHandle = _sound->openSound(soundId, soundName, soundType, soundGroup);
-
- if (_track[l].soundHandle == NULL)
- return;
-
- bits = _sound->getBits(_track[l].soundHandle);
- channels = _sound->getChannels(_track[l].soundHandle);
- freq = _sound->getFreq(_track[l].soundHandle);
-
- if ((soundId == kTalkSoundID) && (soundType == IMUSE_BUNDLE)) {
- if (_vm->_actorToPrintStrFor != 0xFF && _vm->_actorToPrintStrFor != 0) {
- Actor *a = _vm->derefActor(_vm->_actorToPrintStrFor, "IMuseDigital::startSound");
- freq = (freq * a->talkFrequency) / 256;
- _track[l].pan = a->talkPan;
- _track[l].vol = a->talkVolume * 1000;
- }
- }
-
- assert(bits == 8 || bits == 12 || bits == 16);
- assert(channels == 1 || channels == 2);
- assert(0 < freq && freq <= 65535);
-
- // Round the frequency to a multiple of 25. This is done to
- // ensure we don't run into data under-/overflows (this is a
- // design limitation of the current IMuseDigital code, which
- // pushes data 'blindly' into the mixer, instead of providing
- // a pull based interface, i.e. a custom AudioInputStream
- // subclass).
- freq -= (freq % 25);
-
- _track[l].iteration = _track[l].pullSize = freq * channels;
-
- if (channels == 2)
- mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
-
- if ((bits == 12) || (bits == 16)) {
- mixerFlags |= SoundMixer::FLAG_16BITS;
- _track[l].iteration = _track[l].pullSize *= 2;
- } else if (bits == 8) {
- mixerFlags |= SoundMixer::FLAG_UNSIGNED;
- } else
- error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
-
- _track[l].pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
- }
-
- if (input) {
- _track[l].stream2 = input;
- _track[l].stream = NULL;
- } else {
- _track[l].stream2 = NULL;
- _track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000);
- _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, false, _track[l].vol / 1000, _track[l].pan, -1);
- }
-
- _track[l].used = true;
- return;
- }
- }
-
- warning("it should not happen");
- assert(0);
-}
-
-void IMuseDigital::stopSound(int soundId) {
- Common::StackLock lock(_mutex, "IMuseDigital::stopSound()");
- debug(5, "IMuseDigital::stopSound(%d)", soundId);
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- if (_track[l].stream) {
- _track[l].toBeRemoved = true;
- }
- else if (_track[l].stream2)
- _vm->_mixer->stopHandle(_track[l].handle);
- }
- }
-}
-
-void IMuseDigital::setPriority(int soundId, int priority) {
- Common::StackLock lock(_mutex, "IMuseDigital::setPriority()");
- debug(5, "IMuseDigital::setPriority(%d, %d)", soundId, priority);
-
- assert ((priority >= 0) && (priority <= 127));
-
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].priority = priority;
- }
- }
-}
-
-void IMuseDigital::setVolume(int soundId, int volume) {
- Common::StackLock lock(_mutex, "IMuseDigital::setVolume()");
- debug(5, "IMuseDigital::setVolume(%d, %d)", soundId, volume);
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].vol = volume * 1000;
- }
- }
-}
-
-void IMuseDigital::setPan(int soundId, int pan) {
- Common::StackLock lock(_mutex, "IMuseDigital::setPan()");
- debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan);
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].pan = pan;
- }
- }
-}
-
-void IMuseDigital::selectGroupVolume(int soundId, int groupId) {
- Common::StackLock lock(_mutex, "IMuseDigital::setGroupVolume()");
- debug(5, "IMuseDigital::setGroupVolume(%d, %d)", soundId, groupId);
- assert((groupId >= 1) && (groupId <= 3));
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].soundGroup = groupId;
- }
- }
-}
-
-void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
- Common::StackLock lock(_mutex, "IMuseDigital::setFade()");
- debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks);
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].volFadeDelay = delay60HzTicks;
- _track[l].volFadeDest = destVolume * 1000;
- _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * delay60HzTicks);
- _track[l].volFadeUsed = true;
- }
- }
-}
-
-void IMuseDigital::refreshScripts() {
- bool found = false;
- {
- Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
- found = true;
- }
- }
- }
-
- if ((!found) && (_curMusicSeq != 0)) {
- parseScriptCmds(0x1001, 0, 0, 0, 0, 0, 0, 0);
- }
-}
-
-void IMuseDigital::stopAllSounds(bool waitForStop) {
- debug(5, "IMuseDigital::stopAllSounds");
- {
- Common::StackLock lock(_mutex, "IMuseDigital::stopAllSounds()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used) {
- if (_track[l].stream) {
- _track[l].toBeRemoved = true;
- } else if (_track[l].stream2)
- _vm->_mixer->stopHandle(_track[l].handle);
- }
- }
- }
-
- if (waitForStop) {
- bool used;
- do {
- used = false;
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used)
- used = true;
- }
- g_system->delay_msecs(10);
- } while (used);
- }
-}
-
-void IMuseDigital::fadeOutMusic(int fadeDelay) {
- Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusic()");
- debug(5, "IMuseDigital::fadeOutMusic");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
- _track[l].volFadeDelay = fadeDelay;
- _track[l].volFadeDest = 0;
- _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay);
- _track[l].volFadeUsed = true;
- }
- }
-}
-
-void IMuseDigital::pause(bool p) {
- Common::StackLock lock(_mutex, "IMuseDigital::pause()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used) {
- _vm->_mixer->pauseHandle(_track[l].handle, p);
- }
- }
- _pause = p;
-}
-
-void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h) {
- int cmd = a;
- int soundId = b;
- int sub_cmd = c;
-
- if (!cmd)
- return;
-
- switch (cmd) {
- case 10: // ImuseStopAllSounds
- stopAllSounds();
- break;
- case 12: // ImuseSetParam
- switch (sub_cmd) {
- case 0x400: // select group volume
- selectGroupVolume(soundId, d);
- break;
- case 0x500: // set priority
- setPriority(soundId, d);
- break;
- case 0x600: // set volume
- setVolume(soundId, d);
- break;
- case 0x700: // set pan
- setPan(soundId, d);
- break;
- default:
- warning("IMuseDigital::doCommand SetParam DEFAULT command %d", sub_cmd);
- break;
- }
- break;
- case 14: // ImuseFadeParam
- switch (sub_cmd) {
- case 0x600: // set volume fading
- if ((d != 0) && (e == 0))
- setVolume(soundId, d);
- else if ((d == 0) && (e == 0))
- stopSound(soundId);
- else
- setFade(soundId, d, e);
- break;
- default:
- warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
- break;
- }
- break;
- case 25: // ImuseStartStream
- debug(5, "ImuseStartStream (%d, %d, %d)", soundId, c, d);
- break;
- case 26: // ImuseSwitchStream
- debug(5, "ImuseSwitchStream (%d, %d, %d, %d, %d)", soundId, c, d, e, f);
- break;
- case 0x1000: // ImuseSetState
- debug(5, "ImuseSetState (%d)", b);
- if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) {
- if (b == 1) {
- fadeOutMusic(200);
- startMusic(1, 127);
- } else {
- if (getSoundStatus(2) == 0) {
- fadeOutMusic(200);
- startMusic(2, 127);
- }
- }
- } else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) {
- fadeOutMusic(120);
- if (b == 2) {
- startMusic("in1.imx", 1100, 0, 127);
- } else if (b == 4) {
- startMusic("in2.imx", 1120, 0, 127);
- } else if (b == 8) {
- startMusic("out1.imx", 1140, 0, 127);
- } else if (b == 9) {
- startMusic("out2.imx", 1150, 0, 127);
- } else if (b == 16) {
- startMusic("gun.imx", 1210, 0, 127);
- } else {
- warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, _vm->_currentRoom);
- }
- } else if (_vm->_gameId == GID_DIG) {
- setDigMusicState(b);
- } else if (_vm->_gameId == GID_CMI) {
- setComiMusicState(b);
- } else if (_vm->_gameId == GID_FT) {
- setFtMusicState(b);
- }
- break;
- case 0x1001: // ImuseSetSequence
- debug(5, "ImuseSetSequence (%d)", b);
- if (_vm->_gameId == GID_DIG) {
- setDigMusicSequence(b);
- } else if (_vm->_gameId == GID_CMI) {
- setComiMusicSequence(b);
- } else if (_vm->_gameId == GID_FT) {
- setFtMusicSequence(b);
- }
- break;
- case 0x1002: // ImuseSetCuePoint
- debug(5, "ImuseSetCuePoint (%d)", b);
- if (_vm->_gameId == GID_FT) {
- setFtMusicCuePoint(b);
- }
- break;
- case 0x1003: // ImuseSetAttribute
- debug(5, "ImuseSetAttribute (%d, %d)", b, c);
- assert((_vm->_gameId == GID_DIG) || (_vm->_gameId == GID_FT));
- if (_vm->_gameId == GID_DIG) {
- _attributes[b] = c;
- }
- break;
- case 0x2000: // ImuseSetGroupSfxVolume
- debug(5, "ImuseSetGroupSFXVolume (%d)", b);
-// setGroupSfxVolume(b);
- break;
- case 0x2001: // ImuseSetGroupVoiceVolume
- debug(5, "ImuseSetGroupVoiceVolume (%d)", b);
-// setGroupVoiceVolume(b);
- break;
- case 0x2002: // ImuseSetGroupMusicVolume
- debug(5, "ImuseSetGroupMusicVolume (%d)", b);
-// setGroupMusicVolume(b);
- break;
- default:
- warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
- }
-}
-
-int IMuseDigital::getSoundStatus(int sound) const {
- Common::StackLock lock(_mutex, "IMuseDigital::getSoundStatus()");
- debug(5, "IMuseDigital::getSoundStatus(%d)", sound);
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == sound) && _track[l].used) {
- return 1;
- }
- }
-
- return 0;
-}
-
-void IMuseDigital::getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height) {
- int32 sync_size;
- byte *sync_ptr;
-
- msPos /= 16;
- if (msPos < 65536) {
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _sound->getSyncSizeAndPtrById(_track[l].soundHandle, syncId, sync_size, &sync_ptr);
- if ((sync_size != 0) && (sync_ptr != NULL)) {
- sync_size /= 4;
- while (sync_size--) {
- if (READ_BE_UINT16(sync_ptr) >= msPos)
- break;
- sync_ptr += 4;
- }
- if (sync_size < 0)
- sync_ptr -= 4;
- else
- if (READ_BE_UINT16(sync_ptr) > msPos)
- sync_ptr -= 4;
-
- width = sync_ptr[2];
- height = sync_ptr[3];
- return;
- }
- }
- }
- }
-}
-
-int32 IMuseDigital::getPosInMs(int soundId) {
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && (_track[l].used)) {
- int32 pos = (5 * (_track[l].dataOffset + _track[l].regionOffset)) / (_track[l].iteration / 200);
- return pos;
- }
- }
-
- return 0;
-}
-
-int32 IMuseDigital::getCurMusicPosInMs() {
- Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicPosInMs()");
- int soundId = -1;
-
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
- }
- }
-
- int32 msPos = getPosInMs(soundId);
- debug(5, "IMuseDigital::getCurMusicPosInMs(%d) = %d", soundId, msPos);
- return msPos;
-}
-
-int32 IMuseDigital::getCurVoiceLipSyncWidth() {
- Common::StackLock lock(_mutex, "IMuseDigital::getCutVoiceLipSyncWidth()");
- int32 msPos = getPosInMs(kTalkSoundID) + 50;
- int32 width = 0, height = 0;
-
- debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d)", kTalkSoundID);
- getLipSync(kTalkSoundID, 0, msPos, width, height);
- return width;
-}
-
-int32 IMuseDigital::getCurVoiceLipSyncHeight() {
- Common::StackLock lock(_mutex, "IMuseDigital::getCurVoiceLipSyncHeight()");
- int32 msPos = getPosInMs(kTalkSoundID) + 50;
- int32 width = 0, height = 0;
-
- debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d)", kTalkSoundID);
- getLipSync(kTalkSoundID, 0, msPos, width, height);
- return height;
-}
-
-int32 IMuseDigital::getCurMusicLipSyncWidth(int syncId) {
- Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncWidth()");
- int soundId = -1;
-
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
- }
- }
-
- int32 msPos = getPosInMs(soundId) + 50;
- int32 width = 0, height = 0;
-
- debug(5, "IMuseDigital::getCurVoiceLipSyncWidth(%d, %d)", soundId, msPos);
- getLipSync(soundId, syncId, msPos, width, height);
- return width;
-}
-
-int32 IMuseDigital::getCurMusicLipSyncHeight(int syncId) {
- Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncHeight()");
- int soundId = -1;
-
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
- }
- }
-
- int32 msPos = getPosInMs(soundId) + 50;
- int32 width = 0, height = 0;
-
- debug(5, "IMuseDigital::getCurVoiceLipSyncHeight(%d, %d)", soundId, msPos);
- getLipSync(soundId, syncId, msPos, width, height);
- return height;
-}
-
} // End of namespace Scumm
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- dimuse.h 5 Apr 2004 18:24:36 -0000 1.36
+++ dimuse.h 6 Apr 2004 19:46:43 -0000 1.37
@@ -59,7 +59,7 @@
int32 dataOffset;
int curRegion;
int curHookId;
- int soundGroup;
+ int volGroupId;
int iteration;
int mod;
int32 pullSize;
@@ -93,7 +93,8 @@
static void timer_handler(void *refConf);
void callback();
void switchToNextRegion(int track);
- void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, int hookId, int volume, int priority);
+ void allocSlot(int priority);
+ void startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority);
int32 getPosInMs(int soundId);
void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height);
@@ -118,24 +119,19 @@
IMuseDigital(ScummEngine *scumm);
virtual ~IMuseDigital();
- void startVoice(int soundId, AudioStream *input)
- { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, 0, 127, 127); }
- void startVoice(int soundId, const char *soundName)
- { debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, 0, 127, 127); }
- void startMusic(int soundId, int volume)
- { debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, 0, volume, 126); }
- void startMusic(const char *soundName, int soundId, int hookId, int volume)
- { debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, hookId, volume, 126); }
- void startSfx(int soundId, int priority)
- { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, 0, 127, priority); }
+ void startVoice(int soundId, AudioStream *input);
+ void startVoice(int soundId, const char *soundName);
+ void startMusic(int soundId, int volume);
+ void startMusic(const char *soundName, int soundId, int hookId, int volume);
+ void startSfx(int soundId, int priority);
void startSound(int soundId)
{ error("MusicEngine::startSound() Should be never called"); }
void resetState();
- void setGroupVoiceVolume(int volume);
- void setGroupSfxVolume(int volume);
- void setGroupMusicVolume(int volume);
+ void setGroupVoiceVolume(int volume) { _volVoice = volume; }
+ void setGroupSfxVolume(int volume) { _volSfx = volume; }
+ void setGroupMusicVolume(int volume) { _volMusic = volume; }
int getGroupVoiceVolume() { return _volVoice; }
int getGroupSfxVolume() { return _volSfx; }
int getGroupMusicVolume() { return _volMusic; }
@@ -144,7 +140,7 @@
void setVolume(int soundId, int volume);
void setPan(int soundId, int pan);
void setFade(int soundId, int destVolume, int delay60HzTicks);
- void selectGroupVolume(int soundId, int groupId);
+ void selectVolumeGroup(int soundId, int volGroupId);
void setMasterVolume(int vol) {}
void stopSound(int soundId);
void stopAllSounds() { stopAllSounds(false); }
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dimuse_music.cpp 27 Mar 2004 18:12:18 -0000 1.20
+++ dimuse_music.cpp 6 Apr 2004 19:46:43 -0000 1.21
@@ -30,6 +30,22 @@
#define COMI_STATE_OFFSET 3
#define COMI_SEQ_OFFSET (COMI_STATE_OFFSET + 94)
+void IMuseDigital::refreshScripts() {
+ bool found = false;
+ {
+ Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
+ found = true;
+ }
+ }
+ }
+
+ if ((!found) && (_curMusicSeq != 0)) {
+ parseScriptCmds(0x1001, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
void IMuseDigital::setDigMusicState(int stateId) {
int l, num = -1;
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- dimuse_sndmgr.cpp 14 Feb 2004 15:14:30 -0000 1.27
+++ dimuse_sndmgr.cpp 6 Apr 2004 19:46:43 -0000 1.28
@@ -47,38 +47,111 @@
#endif
}
+void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs) {
+ uint32 tag;
+ int32 size = 0;
+
+ do {
+ tag = READ_BE_UINT32(ptr); ptr += 4;
+ switch(tag) {
+ case MKID_BE('TEXT'):
+ case MKID_BE('STOP'):
+ case MKID_BE('FRMT'):
+ case MKID_BE('DATA'):
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
+ case MKID_BE('REGN'):
+ numRegions++;
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
+ case MKID_BE('JUMP'):
+ numJumps++;
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
+ case MKID_BE('SYNC'):
+ numSyncs++;
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
+ default:
+ error("ImuseDigiSndMgr::countElements() Unknown sfx header '%s'", tag2str(tag));
+ }
+ } while (tag != MKID_BE('DATA'));
+}
+
void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
if (READ_UINT32(ptr) == MKID('Crea')) {
- int size = 0, rate = 0, loops = 0, begin_loop = 0, end_loop = 0;
- _sounds[slot].resPtr = readVOCFromMemory(ptr, size, rate, loops, begin_loop, end_loop);
- _sounds[slot].freeResPtr = true;
+ bool quit = false;
+
+ int32 offset = READ_LE_UINT16(ptr + 20);
+ int16 version = READ_LE_UINT16(ptr + 22);
+ int16 code = READ_LE_UINT16(ptr + 24);
+ assert(version == 0x010A || version == 0x0114);
+ assert(code == ~version + 0x1234);
+
+ _sounds[slot].region = (_region *)malloc(sizeof(_region) * 4);
+ _sounds[slot].jump = (_jump *)malloc(sizeof(_jump));
+ _sounds[slot].resPtr = ptr;
_sounds[slot].bits = 8;
- _sounds[slot].freq = rate;
_sounds[slot].channels = 1;
- _sounds[slot].region[0].offset = 0;
- _sounds[slot].region[0].length = size;
- _sounds[slot].numRegions++;
- if (loops != 0) {
- if (begin_loop == 0) {
- _sounds[slot].region[1].offset = end_loop;
+
+ while (!quit) {
+ int len = READ_LE_UINT32(ptr + offset);
+ offset += 4;
+ code = len & 0xFF;
+ len >>= 8;
+ switch(code) {
+ case 0:
+ quit = true;
+ break;
+ case 1:
+ {
+ int time_constant = ptr[offset];
+ offset += 2;
+ len -= 2;
+ _sounds[slot].freq = getSampleRateFromVOCRate(time_constant);
+ _sounds[slot].region[_sounds[slot].numRegions].offset = offset;
+ _sounds[slot].region[_sounds[slot].numRegions].length = len;
+ _sounds[slot].numRegions++;
+ }
+ break;
+ case 6: // begin of loop
+ _sounds[slot].jump[0].dest = offset + 8;
+ _sounds[slot].jump[0].hookId = 0;
+ _sounds[slot].jump[0].fadeDelay = 0;
+ break;
+ case 7: // end of loop
+ _sounds[slot].jump[0].offset = offset - 4;
+ _sounds[slot].numJumps++;
+ _sounds[slot].region[_sounds[slot].numRegions].offset = offset - 4;
+ _sounds[slot].region[_sounds[slot].numRegions].length = 0;
_sounds[slot].numRegions++;
- } else {
- _sounds[slot].region[0].length = begin_loop;
- _sounds[slot].region[1].offset = begin_loop;
- _sounds[slot].region[1].length = end_loop - begin_loop;
- _sounds[slot].region[2].offset = end_loop;
- _sounds[slot].numRegions += 2;
+ break;
+ default:
+ error("Invalid code in VOC file : %d", code);
+ quit = true;
+ break;
}
- _sounds[slot].jump[0].dest = begin_loop;
- _sounds[slot].jump[0].offset = end_loop;
- _sounds[slot].numJumps++;
+ // FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
+ offset += len;
}
} else if (READ_UINT32(ptr) == MKID('iMUS')) {
uint32 tag;
int32 size = 0;
byte *s_ptr = ptr;
-
ptr += 16;
+
+ int curIndexRegion = 0;
+ int curIndexJump = 0;
+ int curIndexSync = 0;
+
+ _sounds[slot].numRegions = 0;
+ _sounds[slot].numJumps = 0;
+ _sounds[slot].numSyncs = 0;
+ countElements(ptr, _sounds[slot].numRegions, _sounds[slot].numJumps, _sounds[slot].numSyncs);
+ _sounds[slot].region = (_region *)malloc(sizeof(_region) * _sounds[slot].numRegions);
+ _sounds[slot].jump = (_jump *)malloc(sizeof(_jump) * _sounds[slot].numJumps);
+ _sounds[slot].sync = (_sync *)malloc(sizeof(_sync) * _sounds[slot].numSyncs);
+
do {
tag = READ_BE_UINT32(ptr); ptr += 4;
switch(tag) {
@@ -87,57 +160,35 @@
_sounds[slot].bits = READ_BE_UINT32(ptr); ptr += 4;
_sounds[slot].freq = READ_BE_UINT32(ptr); ptr += 4;
_sounds[slot].channels = READ_BE_UINT32(ptr); ptr += 4;
- break;
+ break;
case MKID_BE('TEXT'):
+ case MKID_BE('STOP'):
size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
case MKID_BE('REGN'):
- size = READ_BE_UINT32(ptr); ptr += 4;
- if (_sounds[slot].numRegions >= MAX_IMUSE_REGIONS) {
- warning("ImuseDigiSndMgr::prepareSound(%d/%s) Not enough space for Region", _sounds[slot].soundId, _sounds[slot].name);
- ptr += 8;
- break;
- }
- _sounds[slot].region[_sounds[slot].numRegions].offset = READ_BE_UINT32(ptr); ptr += 4;
- _sounds[slot].region[_sounds[slot].numRegions].length = READ_BE_UINT32(ptr); ptr += 4;
-// if (_sounds[slot].soundId == 2311)
-// printf("REGN: offset: %d, length: %d\n", _sounds[slot].region[_sounds[slot].numRegions].offset, _sounds[slot].region[_sounds[slot].numRegions].length);
- _sounds[slot].numRegions++;
- break;
- case MKID_BE('STOP'):
ptr += 4;
- _sounds[slot].offsetStop = READ_BE_UINT32(ptr); ptr += 4;
+ _sounds[slot].region[curIndexRegion].offset = READ_BE_UINT32(ptr); ptr += 4;
+ _sounds[slot].region[curIndexRegion].length = READ_BE_UINT32(ptr); ptr += 4;
+ curIndexRegion++;
break;
case MKID_BE('JUMP'):
- size = READ_BE_UINT32(ptr); ptr += 4;
- if (_sounds[slot].numJumps >= MAX_IMUSE_JUMPS) {
- warning("ImuseDigiSndMgr::prepareSound(%d/%s) Not enough space for Jump", _sounds[slot].soundId, _sounds[slot].name);
- ptr += size;
- break;
- }
- _sounds[slot].jump[_sounds[slot].numJumps].offset = READ_BE_UINT32(ptr); ptr += 4;
- _sounds[slot].jump[_sounds[slot].numJumps].dest = READ_BE_UINT32(ptr); ptr += 4;
- _sounds[slot].jump[_sounds[slot].numJumps].hookId = READ_BE_UINT32(ptr); ptr += 4;
- _sounds[slot].jump[_sounds[slot].numJumps].fadeDelay = READ_BE_UINT32(ptr); ptr += 4;
-// if (_sounds[slot].soundId == 2311)
-// printf("JUMP: offset: %d, dest: %d, hookId: %d\n", _sounds[slot].jump[_sounds[slot].numJumps].offset, _sounds[slot].jump[_sounds[slot].numJumps].dest, _sounds[slot].jump[_sounds[slot].numJumps].hookId);
- _sounds[slot].numJumps++;
+ ptr += 4;
+ _sounds[slot].jump[curIndexJump].offset = READ_BE_UINT32(ptr); ptr += 4;
+ _sounds[slot].jump[curIndexJump].dest = READ_BE_UINT32(ptr); ptr += 4;
+ _sounds[slot].jump[curIndexJump].hookId = READ_BE_UINT32(ptr); ptr += 4;
+ _sounds[slot].jump[curIndexJump].fadeDelay = READ_BE_UINT32(ptr); ptr += 4;
+ curIndexJump++;
break;
case MKID_BE('SYNC'):
size = READ_BE_UINT32(ptr); ptr += 4;
- if (_sounds[slot].numSyncs >= MAX_IMUSE_SYNCS) {
- warning("ImuseDigiSndMgr::prepareSound(%d/%s) Not enough space for Sync", _sounds[slot].soundId, _sounds[slot].name);
- ptr += size;
- break;
- }
- _sounds[slot].sync[_sounds[slot].numSyncs].size = size;
- _sounds[slot].sync[_sounds[slot].numSyncs].ptr = (byte *)malloc(size);
- memcpy(_sounds[slot].sync[_sounds[slot].numSyncs].ptr, ptr, size);
- _sounds[slot].numSyncs++;
+ _sounds[slot].sync[curIndexSync].size = size;
+ _sounds[slot].sync[curIndexSync].ptr = (byte *)malloc(size);
+ memcpy(_sounds[slot].sync[curIndexSync].ptr, ptr, size);
+ curIndexSync++;
ptr += size;
break;
case MKID_BE('DATA'):
- size = READ_BE_UINT32(ptr); ptr += 4;
+ ptr += 4;
break;
default:
error("ImuseDigiSndMgr::prepareSound(%d/%s) Unknown sfx header '%s'", _sounds[slot].soundId, _sounds[slot].name, tag2str(tag));
@@ -163,24 +214,24 @@
bool ImuseDigiSndMgr::openMusicBundle(int slot) {
bool result = false;
- _sounds[slot]._bundle = new BundleMgr(_cacheBundleDir);
+ _sounds[slot].bundle = new BundleMgr(_cacheBundleDir);
if (_vm->_gameId == GID_CMI) {
if (_vm->_features & GF_DEMO) {
- result = _sounds[slot]._bundle->openFile("music.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("music.bun", _vm->getGameDataPath());
} else {
char musicfile[20];
sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK))
- _sounds[slot]._bundle->closeFile();
+ _sounds[slot].bundle->closeFile();
- result = _sounds[slot]._bundle->openFile(musicfile, _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile(musicfile, _vm->getGameDataPath());
if (result == false)
- result = _sounds[slot]._bundle->openFile("music.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("music.bun", _vm->getGameDataPath());
_disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK);
}
} else if (_vm->_gameId == GID_DIG)
- result = _sounds[slot]._bundle->openFile("digmusic.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("digmusic.bun", _vm->getGameDataPath());
else
error("ImuseDigiSndMgr::openMusicBundle() Don't know which bundle file to load");
@@ -190,31 +241,31 @@
bool ImuseDigiSndMgr::openVoiceBundle(int slot) {
bool result = false;
- _sounds[slot]._bundle = new BundleMgr(_cacheBundleDir);
+ _sounds[slot].bundle = new BundleMgr(_cacheBundleDir);
if (_vm->_gameId == GID_CMI) {
if (_vm->_features & GF_DEMO) {
- result = _sounds[slot]._bundle->openFile("voice.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("voice.bun", _vm->getGameDataPath());
} else {
char voxfile[20];
sprintf(voxfile, "voxdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK))
- _sounds[slot]._bundle->closeFile();
+ _sounds[slot].bundle->closeFile();
- result = _sounds[slot]._bundle->openFile(voxfile, _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile(voxfile, _vm->getGameDataPath());
if (result == false)
- result = _sounds[slot]._bundle->openFile("voice.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("voice.bun", _vm->getGameDataPath());
_disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK);
}
} else if (_vm->_gameId == GID_DIG)
- result = _sounds[slot]._bundle->openFile("digvoice.bun", _vm->getGameDataPath());
+ result = _sounds[slot].bundle->openFile("digvoice.bun", _vm->getGameDataPath());
else
error("ImuseDigiSndMgr::openVoiceBundle() Don't know which bundle file to load");
return result;
}
-ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const char *soundName, int soundType, int soundGroup) {
+ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const char *soundName, int soundType, int volGroupId) {
assert(soundId >= 0);
assert(soundType);
@@ -237,13 +288,13 @@
result = true;
} else if (soundType == IMUSE_BUNDLE) {
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
- if (soundGroup == IMUSE_VOICE)
+ if (volGroupId == IMUSE_VOLGRP_VOICE)
result = openVoiceBundle(slot);
- else if (soundGroup == IMUSE_MUSIC)
+ else if (volGroupId == IMUSE_VOLGRP_MUSIC)
result = openMusicBundle(slot);
- else
+ else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
- _sounds[slot]._bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside);
+ _sounds[slot].bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside);
_sounds[slot].name[0] = 0;
_sounds[slot].soundId = soundId;
} else {
@@ -252,13 +303,13 @@
} else {
if (soundType == IMUSE_BUNDLE) {
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
- if (soundGroup == IMUSE_VOICE)
+ if (volGroupId == IMUSE_VOLGRP_VOICE)
result = openVoiceBundle(slot);
- else if (soundGroup == IMUSE_MUSIC)
+ else if (volGroupId == IMUSE_VOLGRP_MUSIC)
result = openMusicBundle(slot);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
- _sounds[slot]._bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside);
+ _sounds[slot].bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside);
strcpy(_sounds[slot].name, soundName);
_sounds[slot].soundId = soundId;
} else {
@@ -283,13 +334,17 @@
for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
if (&_sounds[l] == soundHandle) {
- if (_sounds[l].freeResPtr)
- free(_sounds[l].resPtr);
- if (_sounds[l]._bundle)
- delete _sounds[l]._bundle;
+ if (_sounds[l].bundle)
+ delete _sounds[l].bundle;
for (int r = 0; r < _sounds[l].numSyncs; r++)
if (_sounds[l].sync[r].ptr)
free(_sounds[l].sync[r].ptr);
+ if (_sounds[l].region)
+ free(_sounds[l].region);
+ if (_sounds[l].jump)
+ free(_sounds[l].jump);
+ if (_sounds[l].sync)
+ free(_sounds[l].sync);
memset(&_sounds[l], 0, sizeof(soundStruct));
}
}
@@ -408,8 +463,8 @@
int header_size = soundHandle->offsetData;
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
- if (soundHandle->_bundle) {
- size = soundHandle->_bundle->decompressSampleByCurIndex(start + offset, size, buf, header_size, header_outside);
+ if (soundHandle->bundle) {
+ size = soundHandle->bundle->decompressSampleByCurIndex(start + offset, size, buf, header_size, header_outside);
} else if (soundHandle->resPtr) {
*buf = (byte *)malloc(size);
memcpy(*buf, soundHandle->resPtr + start + offset + header_size, size);
Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dimuse_sndmgr.h 5 Apr 2004 18:24:36 -0000 1.20
+++ dimuse_sndmgr.h 6 Apr 2004 19:46:43 -0000 1.21
@@ -34,17 +34,14 @@
class ImuseDigiSndMgr {
public:
-#define MAX_IMUSE_SOUNDS 16
-#define MAX_IMUSE_JUMPS 80
-#define MAX_IMUSE_REGIONS 85
-#define MAX_IMUSE_SYNCS 4
+#define MAX_IMUSE_SOUNDS 10
#define IMUSE_RESOURCE 1
#define IMUSE_BUNDLE 2
-#define IMUSE_VOICE 1
-#define IMUSE_SFX 2
-#define IMUSE_MUSIC 3
+#define IMUSE_VOLGRP_VOICE 1
+#define IMUSE_VOLGRP_SFX 2
+#define IMUSE_VOLGRP_MUSIC 3
private:
struct _region {
@@ -55,25 +52,27 @@
struct _jump {
int32 offset; // jump offset position
int32 dest; // jump to dest position
- byte hookId; // id of hook
- int16 fadeDelay; // fade delay in ms
+ byte hookId; // id of hook
+ int16 fadeDelay; // fade delay in ms
};
struct _sync {
- int32 size; // size of sync
- byte *ptr; // pointer to sync
+ int32 size; // size of sync
+ byte *ptr; // pointer to sync
};
public:
struct soundStruct {
- uint16 freq; // frequency
+ uint16 freq; // frequency
byte channels; // stereo or mono
byte bits; // 8, 12, 16
- int8 numJumps; // number of Jumps
- int8 numRegions; // number of Regions
- int8 numSyncs; // number of Syncs
- int32 offsetStop; // end offset in source data
+ int numJumps; // number of Jumps
+ int numRegions; // number of Regions
+ int numSyncs; // number of Syncs
+ _region *region;
+ _jump *jump;
+ _sync *sync;
bool endFlag;
bool inUse;
byte *allData;
@@ -81,11 +80,7 @@
byte *resPtr;
char name[15];
int16 soundId;
- bool freeResPtr;
- BundleMgr *_bundle;
- _region region[MAX_IMUSE_REGIONS];
- _jump jump[MAX_IMUSE_JUMPS];
- _sync sync[MAX_IMUSE_SYNCS];
+ BundleMgr *bundle;
};
private:
@@ -103,12 +98,14 @@
bool openMusicBundle(int slot);
bool openVoiceBundle(int slot);
+ void countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs);
+
public:
ImuseDigiSndMgr(ScummEngine *scumm);
~ImuseDigiSndMgr();
-
- soundStruct * openSound(int32 soundId, const char *soundName, int soundType, int soundGroup);
+
+ soundStruct * openSound(int32 soundId, const char *soundName, int soundType, int volGroupId);
void closeSound(soundStruct *soundHandle);
int getFreq(soundStruct *soundHandle);
From fingolfin at users.sourceforge.net Tue Apr 6 13:17:16 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Tue Apr 6 13:17:16 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm configure,1.84,1.85
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv687
Modified Files:
configure
Log Message:
Fix building from external directory
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- configure 5 Apr 2004 22:07:09 -0000 1.84
+++ configure 6 Apr 2004 20:04:05 -0000 1.85
@@ -47,6 +47,8 @@
_sdlconfig=sdl-config
_sdlpath="$PATH"
+_srcdir=`dirname $0`
+
# For cross compiling
_host=""
_host_cpu=""
@@ -337,7 +339,7 @@
_host_os=linux
_host_cpu=arm
else
- guessed_host=`./config.guess`
+ guessed_host=`$_srcdir/config.guess`
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
_host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
_host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
@@ -932,7 +934,6 @@
# TODO: Add a better check than just looking for 'Makefile'
#
if test ! -f Makefile ; then
-_srcdir=`dirname $0`
echo "Creating Makefile"
cat > Makefile << EOF
From cyx at users.sourceforge.net Tue Apr 6 13:29:02 2004
From: cyx at users.sourceforge.net (Gregory Montoir)
Date: Tue Apr 6 13:29:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.127,1.128 cutaway.h,1.35,1.36 graphics.cpp,1.100,1.101 graphics.h,1.69,1.70
Message-ID:
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3668/queen
Modified Files:
cutaway.cpp cutaway.h graphics.cpp graphics.h
Log Message:
fix for bug #928549.
Animations on objects/persons setup by cutaways can still be played after the end of the cutscene. (the only ?) one room in which this is reproducable is the first time you talk to the Oracle (first c44, then c47).
As a Cutaway object is created for each cutscene, the _cutAnim member should be moved to an more "persistant" object.
Otherwise we're reading data from free'd memory...
Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- cutaway.cpp 23 Mar 2004 23:47:01 -0000 1.127
+++ cutaway.cpp 6 Apr 2004 20:15:19 -0000 1.128
@@ -1229,23 +1229,20 @@
int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objAnim, int frameCount) {
int frameIndex[256];
int i;
- int bobNum = objAnim[0].object;
- assert(bobNum < 21);
+ assert(frameCount < 30);
+ AnimFrame cutAnim[30];
memset(frameIndex, 0, sizeof(frameIndex));
debug(6, "[Cutaway::makeComplexAnimation] currentImage = %i", currentImage);
- BobSlot *bob = _vm->graphics()->bob(bobNum);
- bob->xflip = objAnim[0].flip;
-
for (i = 0; i < frameCount; i++) {
- _cutAnim[bobNum][i].frame = objAnim[i].unpackFrame;
- _cutAnim[bobNum][i].speed = objAnim[i].speed;
+ cutAnim[i].frame = objAnim[i].unpackFrame;
+ cutAnim[i].speed = objAnim[i].speed;
frameIndex[objAnim[i].unpackFrame] = 1;
}
- _cutAnim[bobNum][frameCount].frame = 0;
- _cutAnim[bobNum][frameCount].speed = 0;
+ cutAnim[frameCount].frame = 0;
+ cutAnim[frameCount].speed = 0;
int nextFrameIndex = 1;
@@ -1254,20 +1251,17 @@
frameIndex[i] = nextFrameIndex++;
for (i = 0; i < frameCount; i++) {
- _cutAnim[bobNum][i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
- //debug(6, "_cutAnim[%i][%i].frame = %i", bobNum, i, _cutAnim[bobNum][i].frame);
+ cutAnim[i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
}
for (i = 1; i < 256; i++) {
if (frameIndex[i]) {
currentImage++;
- //debug(6, "bankUnpack(%i, %i, %i)", i, currentImage, objAnim[0].bank);
_vm->bankMan()->unpack(i, currentImage, objAnim[0].bank);
}
}
- bob->animString(_cutAnim[bobNum]);
-
+ _vm->graphics()->setBobCutawayAnim(objAnim[0].object, objAnim[0].flip, cutAnim, frameCount + 1);
return currentImage;
}
Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- cutaway.h 7 Mar 2004 10:46:01 -0000 1.35
+++ cutaway.h 6 Apr 2004 20:15:19 -0000 1.36
@@ -194,8 +194,6 @@
int16 _currentImage;
- AnimFrame _cutAnim[21][30];
-
Cutaway(const char *filename,
QueenEngine *vm);
~Cutaway();
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- graphics.cpp 18 Mar 2004 21:53:49 -0000 1.100
+++ graphics.cpp 6 Apr 2004 20:15:19 -0000 1.101
@@ -600,6 +600,13 @@
}
}
+void Graphics::setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount) {
+ assert(bobNum < 21 && frameCount < 30);
+ memcpy(_cutAnim[bobNum], af, sizeof(AnimFrame) * frameCount);
+ _bobs[bobNum].xflip = xflip;
+ _bobs[bobNum].animString(_cutAnim[bobNum]);
+}
+
void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {
for (;;) {
// anim frame format is "%3hu,%3hu," (frame number, frame speed)
Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- graphics.h 17 Mar 2004 14:10:51 -0000 1.69
+++ graphics.h 6 Apr 2004 20:15:19 -0000 1.70
@@ -115,6 +115,7 @@
void setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount);
+ void setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount);
void fillAnimBuffer(const char *anim, AnimFrame *af);
uint16 countAnimFrames(const char *anim);
void setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible);
@@ -165,8 +166,12 @@
//! used to scale a BobFrame
BobFrame _shrinkBuffer;
+ //! in-game objects/persons animations
AnimFrame _newAnim[17][30];
+ //! cutaway objects/persons animations
+ AnimFrame _cutAnim[21][30];
+
uint16 _personFrames[4];
//! Number of animated furniture in current room
From fingolfin at users.sourceforge.net Tue Apr 6 15:05:50 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Tue Apr 6 15:05:50 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.73,1.74
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22766
Modified Files:
Makefile
Log Message:
Fix for building from an external dir (ensures that the correct config.h gets included)
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- Makefile 3 Apr 2004 07:19:10 -0000 1.73
+++ Makefile 6 Apr 2004 21:50:04 -0000 1.74
@@ -20,7 +20,7 @@
DEFINES := -DHAVE_CONFIG_H
LDFLAGS :=
-INCLUDES := -I$(srcdir) -I$(srcdir)/common
+INCLUDES := -I. -I$(srcdir) -I$(srcdir)/common
LIBS :=
OBJS :=
From fingolfin at users.sourceforge.net Tue Apr 6 15:15:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Tue Apr 6 15:15:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.88,2.89
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25461
Modified Files:
charset.cpp
Log Message:
cleanup
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.88
retrieving revision 2.89
diff -u -d -r2.88 -r2.89
--- charset.cpp 4 Apr 2004 19:17:28 -0000 2.88
+++ charset.cpp 6 Apr 2004 22:02:02 -0000 2.89
@@ -946,8 +946,7 @@
// Indy3 / Zak256 / Loom
VirtScreen *vs;
byte *char_ptr, *dest_ptr, *mask_ptr;
- bool useMask;
- int w, h;
+ int width, height;
int drawTop;
checkRange(_vm->_numCharsets - 1, 0, _curId, "Printing with bad charset %d");
@@ -966,21 +965,20 @@
_firstChar = false;
}
- w = h = 8;
+ width = height = 8;
if (_dropShadow) {
- w++;
- h++;
+ width++;
+ height++;
}
drawTop = _top - vs->topline;
char_ptr = _fontPtr + chr * 8;
dest_ptr = vs->screenPtr + vs->xstart + drawTop * vs->width + _left;
mask_ptr = _vm->getMaskBuffer(_left, drawTop, 0);
- useMask = (vs->number == kMainVirtScreen && !_ignoreCharsetMask);
- _vm->markRectAsDirty(vs->number, _left, _left + w, drawTop, drawTop + h);
+ _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height);
- if (vs->number == kMainVirtScreen)
+ if (vs->number == kMainVirtScreen && !_ignoreCharsetMask)
_hasMask = true;
drawBits1(vs, dest_ptr, char_ptr, mask_ptr, drawTop, 8, 8);
@@ -996,8 +994,8 @@
_str.right++;
}
- if (_str.bottom < _top + h)
- _str.bottom = _top + h;
+ if (_str.bottom < _top + height)
+ _str.bottom = _top + height;
}
void CharsetRendererClassic::printChar(int chr) {
@@ -1086,8 +1084,6 @@
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY);
- if (!vs->hasTwoBuffers)
- _blitAlso = false;
if (vs->number == kMainVirtScreen && !_ignoreCharsetMask)
_hasMask = true;
@@ -1096,7 +1092,7 @@
byte *dst = vs->screenPtr + vs->xstart + drawTop * vs->width + _left;
byte *back = dst;
- if (_blitAlso) {
+ if (_blitAlso && vs->hasTwoBuffers) {
dst = vs->backBuf + vs->xstart + drawTop * vs->width + _left;
}
@@ -1107,7 +1103,7 @@
drawBitsN(vs, dst, charPtr, mask, bpp, drawTop, origWidth, origHeight);
}
- if (_blitAlso) {
+ if (_blitAlso && vs->hasTwoBuffers) {
int h = height;
do {
memcpy(back, dst, width);
From eriktorbjorn at users.sourceforge.net Wed Apr 7 00:11:01 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Wed Apr 7 00:11:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.43,1.44
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18937
Modified Files:
interpreter.cpp
Log Message:
Cleanup. (Mostly to change the wording and priority of the debugging
messages to be more like in BS1.)
Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- interpreter.cpp 29 Mar 2004 06:37:46 -0000 1.43
+++ interpreter.cpp 7 Apr 2004 06:57:37 -0000 1.44
@@ -194,6 +194,8 @@
stack[stackPtr++] = (value); \
} while (false)
+#define push_ptr(ptr) push(_vm->_memory->ptrToInt(ptr))
+
#define pop() (assert(stackPtr < ARRAYSIZE(stack)), stack[--stackPtr])
uint32 *Logic::_scriptVars = NULL;
@@ -222,9 +224,9 @@
// Get the start of variables and start of code
- uint32 *variables = (uint32 *) (scriptData + sizeof(int32));
- const char *code = scriptData + (int32) READ_LE_UINT32(scriptData) + sizeof(int32);
- uint32 noScripts = (int32) READ_LE_UINT32(code);
+ uint32 *localVars = (uint32 *) (scriptData + sizeof(int32));
+ char *code = scriptData + READ_LE_UINT32(scriptData) + sizeof(int32);
+ uint32 noScripts = READ_LE_UINT32(code);
code += sizeof(int32);
@@ -299,8 +301,7 @@
int retVal;
int caseCount;
bool foundCase;
- int32 ptrval;
- int i;
+ uint8 *ptr;
curCommand = code[ip++];
@@ -310,7 +311,6 @@
case CP_END_SCRIPT:
// End the script
- debug(5, "End script");
runningScript = false;
// WORKAROUND: Pyramid Bug. See explanation above.
@@ -320,21 +320,22 @@
_scriptVars[913] = 0;
}
+ debug(9, "CP_END_SCRIPT");
break;
case CP_QUIT:
// Quit out for a cycle
- debug(5, "Quit script for a cycle");
*offset = ip;
+ debug(9, "CP_QUIT");
return 0;
case CP_TERMINATE:
// Quit out immediately without affecting the offset
// pointer
- debug(5, "Terminate script");
+ debug(9, "CP_TERMINATE");
return 3;
case CP_RESTART_SCRIPT:
// Start the script again
- debug(5, "Restart script");
ip = FROM_LE_32(offsetTable[scriptNumber]);
+ debug(9, "CP_RESTART_SCRIPT");
break;
// Stack-related opcodes
@@ -342,91 +343,91 @@
case CP_PUSH_INT32:
// Push a long word value on to the stack
Read32ip(parameter);
- debug(5, "Push int32 %d", parameter);
push(parameter);
+ debug(9, "CP_PUSH_INT32: %d", parameter);
break;
case CP_PUSH_LOCAL_VAR32:
// Push the contents of a local variable
Read16ip(parameter);
parameter /= 4;
- debug(5, "Push local var %d (%d)", parameter, variables[parameter]);
- push(variables[parameter]);
+ push(localVars[parameter]);
+ debug(9, "CP_PUSH_LOCAL_VAR32: localVars[%d] => %d", parameter, localVars[parameter]);
break;
case CP_PUSH_GLOBAL_VAR32:
// Push a global variable
- Read16ip(parameter);
assert(_scriptVars);
- debug(5, "Push global var %d (%d)", parameter, _scriptVars[parameter]);
+ Read16ip(parameter);
push(_scriptVars[parameter]);
+ debug(9, "CP_PUSH_GLOBAL_VAR32: scriptVars[%d] => %d", parameter, _scriptVars[parameter]);
break;
case CP_PUSH_LOCAL_ADDR:
// push the address of a local variable
Read16ip(parameter);
parameter /= 4;
- ptrval = _vm->_memory->ptrToInt((const uint8 *) &variables[parameter]);
- debug(5, "Push address of local variable %d (%x)", parameter, ptrval);
- push(ptrval);
+ ptr = (uint8 *) &localVars[parameter];
+ push_ptr(ptr);
+ debug(9, "CP_PUSH_LOCAL_ADDR: &localVars[%d] => %p", parameter, ptr);
break;
case CP_PUSH_STRING:
// Push the address of a string on to the stack
// Get the string size
Read8ip(parameter);
- // ip points to the string
- ptrval = _vm->_memory->ptrToInt((const uint8 *) (code + ip));
- debug(5, "Push address of string (%x)\n", ptrval);
- push(ptrval);
+ // ip now points to the string
+ ptr = (uint8 *) (code + ip);
+ push_ptr(ptr);
+ debug(9, "CP_PUSH_STRING: \"%s\"", ptr);
ip += (parameter + 1);
break;
case CP_PUSH_DEREFERENCED_STRUCTURE:
// Push the address of a dereferenced structure
Read32ip(parameter);
- ptrval = _vm->_memory->ptrToInt((const uint8 *) (objectData + sizeof(int32) + sizeof(StandardHeader) + sizeof(ObjectHub) + parameter));
- debug(5, "Push address of far variable (%x)", ptrval);
- push(ptrval);
+ ptr = (uint8 *) (objectData + sizeof(int32) + sizeof(StandardHeader) + sizeof(ObjectHub) + parameter);
+ push_ptr(ptr);
+ debug(9, "CP_PUSH_DEREFERENCED_STRUCTURE: %d => %p", parameter, ptr);
break;
case CP_POP_LOCAL_VAR32:
// Pop a value into a local word variable
Read16ip(parameter);
parameter /= 4;
value = pop();
- debug(5, "Pop %d into local var %d", value, parameter);
- variables[parameter] = value;
+ localVars[parameter] = value;
+ debug(9, "CP_POP_LOCAL_VAR32: localVars[%d] = %d", parameter, value);
break;
case CP_POP_GLOBAL_VAR32:
// Pop a global variable
Read16ip(parameter);
value = pop();
- debug(5, "Pop %d into global var %d", value, parameter);
_scriptVars[parameter] = value;
+ debug(9, "CP_POP_GLOBAL_VAR32: scriptsVars[%d] = %d", parameter, value);
break;
case CP_ADDNPOP_LOCAL_VAR32:
Read16ip(parameter);
parameter /= 4;
value = pop();
- variables[parameter] += value;
- debug(5, "+= %d into local var %d -> %d", value, parameter, variables[parameter]);
+ localVars[parameter] += value;
+ debug(9, "CP_ADDNPOP_LOCAL_VAR32: localVars[%d] += %d => %d", parameter, value, localVars[parameter]);
break;
case CP_SUBNPOP_LOCAL_VAR32:
Read16ip(parameter);
parameter /= 4;
value = pop();
- variables[parameter] -= value;
- debug(5, "-= %d into local var %d -> %d", value, parameter, variables[parameter]);
+ localVars[parameter] -= value;
+ debug(9, "CP_SUBNPOP_LOCAL_VAR32: localVars[%d] -= %d => %d", parameter, value, localVars[parameter]);
break;
case CP_ADDNPOP_GLOBAL_VAR32:
// Add and pop a global variable
Read16ip(parameter);
value = pop();
_scriptVars[parameter] += value;
- debug(5, "+= %d into global var %d -> %d", value, parameter, _scriptVars[parameter]);
+ debug(9, "CP_ADDNPOP_GLOBAL_VAR32: scriptVars[%d] += %d => %d", parameter, value, _scriptVars[parameter]);
break;
case CP_SUBNPOP_GLOBAL_VAR32:
// Sub and pop a global variable
Read16ip(parameter);
value = pop();
_scriptVars[parameter] -= value;
- debug(5, "-= %d into global var %d -> %d", value, parameter, _scriptVars[parameter]);
+ debug(9, "CP_SUBNPOP_GLOBAL_VAR32: scriptVars[%d] -= %d => %d", parameter, value, _scriptVars[parameter]);
break;
// Jump opcodes
@@ -435,27 +436,31 @@
// Skip if the value on the stack is true
Read32ipLeaveip(parameter);
value = pop();
- debug(5, "Skip %d if %d is false", parameter, value);
- if (!value)
+ if (!value) {
ip += sizeof(int32);
- else
+ debug(9, "CP_SKIPONTRUE: %d (IS FALSE (NOT SKIPPED))", parameter);
+ } else {
ip += parameter;
+ debug(9, "CP_SKIPONTRUE: %d (IS TRUE (SKIPPED))", parameter);
+ }
break;
case CP_SKIPONFALSE:
// Skip if the value on the stack is false
Read32ipLeaveip(parameter);
value = pop();
- debug(5, "Skip %d if %d is false", parameter, value);
- if (value)
+ if (value) {
ip += sizeof(int32);
- else
+ debug(9, "CP_SKIPONFALSE: %d (IS TRUE (NOT SKIPPED))", parameter);
+ } else {
ip += parameter;
+ debug(9, "CP_SKIPONFALSE: %d (IS FALSE (SKIPPED))", parameter);
+ }
break;
case CP_SKIPALWAYS:
// skip a block
Read32ipLeaveip(parameter);
- debug(5, "Skip %d", parameter);
ip += parameter;
+ debug(9, "CP_SKIPALWAYS: %d", parameter);
break;
case CP_SWITCH:
// switch
@@ -464,7 +469,7 @@
// Search the cases
foundCase = false;
- for (i = 0; i < caseCount && !foundCase; i++) {
+ for (int i = 0; i < caseCount && !foundCase; i++) {
if (value == (int32) READ_LE_UINT32(code + ip)) {
// We have found the case, so lets
// jump to it
@@ -479,11 +484,13 @@
if (!foundCase)
ip += READ_LE_UINT32(code + ip);
+ debug(9, "CP_SWITCH: [SORRY, NO DEBUG INFO]");
break;
case CP_SAVE_MCODE_START:
// Save the start position on an mcode instruction in
// case we need to restart it again
savedStartOfMcode = ip - 1;
+ debug(9, "CP_SAVE_MCODE_START");
break;
case CP_CALL_MCODE:
// Call an mcode routine
@@ -491,7 +498,7 @@
assert(parameter < ARRAYSIZE(opcodes));
// amount to adjust stack by (no of parameters)
Read8ip(value);
- debug(5, "Calling '%s' with %d parameters", opcodes[parameter].desc, value);
+ debug(9, "CP_CALL_MCODE: '%s', %d", opcodes[parameter].desc, value);
stackPtr -= value;
assert(stackPtr >= 0);
retVal = (this->*opcodes[parameter].proc)(&stack[stackPtr]);
@@ -527,6 +534,9 @@
// Get the maximum value
Read8ip(parameter);
+ debug(9, "CP_JUMP_ON_RETURNED: %d => %d",
+ parameterReturnedFromMcodeFunction,
+ READ_LE_UINT32(code + ip + parameterReturnedFromMcodeFunction * 4));
ip += READ_LE_UINT32(code + ip + parameterReturnedFromMcodeFunction * 4);
break;
@@ -536,87 +546,86 @@
b = pop();
a = pop();
push(a == b);
- debug(5, "operation %d == %d", a, b);
+ debug(9, "OP_ISEQUAL: RESULT = %d", a == b);
break;
case OP_NOTEQUAL:
b = pop();
a = pop();
push(a != b);
- debug(5, "operation %d != %d", a, b);
+ debug(9, "OP_NOTEQUAL: RESULT = %d", a != b);
break;
case OP_GTTHAN:
b = pop();
a = pop();
push(a > b);
- debug(5, "operation %d > %d", a, b);
+ debug(9, "OP_GTTHAN: RESULT = %d", a > b);
break;
case OP_LSTHAN:
b = pop();
a = pop();
push(a < b);
- debug(5, "operation %d < %d", a, b);
+ debug(9, "OP_LSTHAN: RESULT = %d", a < b);
break;
case OP_GTTHANE:
b = pop();
a = pop();
push(a >= b);
- debug(5, "operation %d >= %d", a, b);
+ debug(9, "OP_GTTHANE: RESULT = %d", a >= b);
break;
case OP_LSTHANE:
b = pop();
a = pop();
push(a <= b);
- debug(5, "operation %d <= %d", a, b);
+ debug(9, "OP_LSTHANE: RESULT = %d", a <= b);
break;
case OP_PLUS:
b = pop();
a = pop();
push(a + b);
- debug(5, "operation %d + %d", a, b);
+ debug(9, "OP_PLUS: RESULT = %d", a + b);
break;
case OP_MINUS:
b = pop();
a = pop();
push(a - b);
- debug(5, "operation %d - %d", a, b);
+ debug(9, "OP_MINUS: RESULT = %d", a - b);
break;
case OP_TIMES:
b = pop();
a = pop();
push(a * b);
- debug(5, "operation %d * %d", a, b);
+ debug(9, "OP_TIMES: RESULT = %d", a * b);
break;
case OP_DIVIDE:
b = pop();
a = pop();
push(a / b);
- debug(5, "operation %d / %d", a, b);
+ debug(9, "OP_DIVIDE: RESULT = %d", a / b);
break;
case OP_ANDAND:
b = pop();
a = pop();
push(a && b);
- debug(5, "operation %d && %d", a, b);
+ debug(9, "OP_ANDAND: RESULT = %d", a && b);
break;
case OP_OROR:
b = pop();
a = pop();
push(a || b);
- debug(5, "operation %d || %d", a, b);
+ debug(9, "OP_OROR: RESULT = %d", a || b);
break;
// Debugging opcodes, I think
case CP_DEBUGON:
- // Turn debugging on
+ debug(9, "CP_DEBUGON");
break;
case CP_DEBUGOFF:
- // Turn debugging off
+ debug(9, "CP_DEBUGOFF");
break;
case CP_TEMP_TEXT_PROCESS:
- // Process a text line
Read32ip(parameter);
- debug(5, "Process text id %d", parameter);
+ debug(9, "CP_TEMP_TEXT_PROCESS: %d", parameter);
break;
default:
error("Invalid script command %d", curCommand);
From aquadran at users.sourceforge.net Wed Apr 7 00:31:04 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Wed Apr 7 00:31:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.21,1.22
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22175
Modified Files:
dimuse_music.cpp
Log Message:
corections to music code
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- dimuse_music.cpp 6 Apr 2004 19:46:43 -0000 1.21
+++ dimuse_music.cpp 7 Apr 2004 07:17:16 -0000 1.22
@@ -89,7 +89,7 @@
if (_curMusicSeq == 0) {
if (num == 0)
- playDigMusic(NULL, &_digStateMusicTable[0], 0, false);
+ playDigMusic(NULL, &_digStateMusicTable[0], num, false);
else
playDigMusic(_digStateMusicTable[num].name, &_digStateMusicTable[num], num, false);
}
@@ -123,10 +123,10 @@
_curSeqAtribPos = 0;
_attributes[DIG_SEQ_OFFSET + num] = 1;
} else {
- if ((_digSeqMusicTable[_curMusicSeq].opcode == 4) && (_digSeqMusicTable[_curMusicSeq].opcode == 6)) {
+ if ((_digSeqMusicTable[_curMusicSeq].opcode == 4) || (_digSeqMusicTable[_curMusicSeq].opcode == 6)) {
_curSeqAtribPos = num;
return;
- } else if (_digSeqMusicTable[_curMusicSeq].opcode == 6) {
+ } else {
playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true);
_curSeqAtribPos = 0;
_attributes[DIG_SEQ_OFFSET + num] = 1;
@@ -142,7 +142,7 @@
if (_curMusicState != 0) {
playDigMusic(_digStateMusicTable[_curMusicState].name, &_digStateMusicTable[_curMusicState], _curMusicState, true);
} else
- playDigMusic(NULL, &_digStateMusicTable[0], 0, true);
+ playDigMusic(NULL, &_digStateMusicTable[0], _curMusicState, true);
num = 0;
}
}
@@ -185,28 +185,25 @@
}
}
+ fadeOutMusic(120);
+
if (table->filename[0] == 0) {
- fadeOutMusic(120);
return;
}
- fadeOutMusic(120);
-
switch(table->opcode) {
case 0:
case 5:
case 6:
break;
case 3:
+ case 4:
if ((!sequence) && (table->param != 0)) {
if (table->param == _digStateMusicTable[_curMusicState].param) {
startMusic(table->filename, table->soundId, 0, 127);
- }
- } else {
- startMusic(table->filename, table->soundId, hookId, 127);
+ return;
+ }
}
- break;
- case 4:
startMusic(table->filename, table->soundId, hookId, 127);
break;
}
@@ -232,7 +229,7 @@
if (_curMusicSeq == 0) {
if (num == 0)
- playComiMusic(NULL, &_comiStateMusicTable[0], 0, false);
+ playComiMusic(NULL, &_comiStateMusicTable[0], num, false);
else
playComiMusic(_comiStateMusicTable[num].name, &_comiStateMusicTable[num], num, false);
}
@@ -260,14 +257,14 @@
if (num != 0) {
if (_curMusicSeq == 0) {
- playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true);
+ playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[0], 0, true);
_curSeqAtribPos = 0;
_attributes[COMI_SEQ_OFFSET + num] = 1;
} else {
- if ((_comiSeqMusicTable[_curMusicSeq].opcode == 4) && (_comiSeqMusicTable[_curMusicSeq].opcode == 6)) {
+ if ((_comiSeqMusicTable[_curMusicSeq].opcode == 4) || (_comiSeqMusicTable[_curMusicSeq].opcode == 6)) {
_curSeqAtribPos = num;
return;
- } else if (_comiSeqMusicTable[_curMusicSeq].opcode == 6) {
+ } else {
playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true);
_curSeqAtribPos = 0;
_attributes[COMI_SEQ_OFFSET + num] = 1;
@@ -283,7 +280,7 @@
if (_curMusicState != 0) {
playComiMusic(_comiStateMusicTable[_curMusicState].name, &_comiStateMusicTable[_curMusicState], _curMusicState, true);
} else
- playComiMusic(NULL, &_comiStateMusicTable[0], 0, true);
+ playComiMusic(NULL, &_comiStateMusicTable[0], _curMusicState, true);
num = 0;
}
}
@@ -295,6 +292,8 @@
int hookId = 0;
if ((songName != NULL) && (atribPos != 0)) {
+ if (table->param != 0)
+ atribPos = table->param;
hookId = _attributes[COMI_STATE_OFFSET + atribPos];
if (table->hookId != 0) {
if ((hookId != 0) && (table->hookId <= 1)) {
@@ -328,24 +327,21 @@
startMusic(table->filename, table->soundId, table->hookId, 127);
break;
case 3:
+ case 4:
+ case 12:
+ fadeOutMusic(table->fadeOut60TicksDelay);
if ((!sequence) && (table->param != 0)) {
if (table->param == _comiStateMusicTable[_curMusicState].param) {
- fadeOutMusic(table->fadeOut60TicksDelay);
startMusic(table->filename, table->soundId, 0, 127);
}
} else {
- fadeOutMusic(table->fadeOut60TicksDelay);
- startMusic(table->filename, table->soundId, hookId, 127);
+ if (table->opcode == 12) {
+ startMusic(table->filename, table->soundId, table->hookId, 127);
+ } else {
+ startMusic(table->filename, table->soundId, hookId, 127);
+ }
}
break;
- case 4:
- fadeOutMusic(120);
- startMusic(table->filename, table->soundId, table->hookId, 127);
- break;
- case 12:
- fadeOutMusic(table->fadeOut60TicksDelay);
- startMusic(table->filename, table->soundId, table->hookId, 127);
- break;
}
}
From eriktorbjorn at users.sourceforge.net Wed Apr 7 02:07:06 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Wed Apr 7 02:07:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.44,1.45
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5812
Modified Files:
interpreter.cpp
Log Message:
Added notice about how I think CP_PUSH_LOCAL_ADDR is used.
Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- interpreter.cpp 7 Apr 2004 06:57:37 -0000 1.44
+++ interpreter.cpp 7 Apr 2004 08:53:24 -0000 1.45
@@ -361,7 +361,15 @@
debug(9, "CP_PUSH_GLOBAL_VAR32: scriptVars[%d] => %d", parameter, _scriptVars[parameter]);
break;
case CP_PUSH_LOCAL_ADDR:
- // push the address of a local variable
+ // Push the address of a local variable
+
+ // From what I understand, some scripts store data
+ // (e.g. mouse pointers) in their local variable space
+ // from the very beginning, and use this mechanism to
+ // pass that data to the opcode function. I don't yet
+ // know the conceptual difference between this and the
+ // CP_PUSH_DEREFERENCED_STRUCTURE opcode.
+
Read16ip(parameter);
parameter /= 4;
ptr = (uint8 *) &localVars[parameter];
From eriktorbjorn at users.sourceforge.net Wed Apr 7 05:45:06 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Wed Apr 7 05:45:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2/driver _mouse.cpp,1.33,1.34 render.cpp,1.59,1.60
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15408/driver
Modified Files:
_mouse.cpp render.cpp
Log Message:
Cleanup.
Index: _mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/_mouse.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- _mouse.cpp 28 Mar 2004 16:30:50 -0000 1.33
+++ _mouse.cpp 7 Apr 2004 12:31:31 -0000 1.34
@@ -64,13 +64,6 @@
return NULL;
}
-void Graphics::resetRenderEngine(void) {
- _parallaxScrollX = 0;
- _parallaxScrollY = 0;
- _scrollX = 0;
- _scrollY = 0;
-}
-
// FIXME: The original code used 0 for transparency, while our backend uses
// 0xFF. That means that parts of the mouse cursor that weren't meant to be
// transparent may be now.
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/render.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- render.cpp 28 Mar 2004 16:30:50 -0000 1.59
+++ render.cpp 7 Apr 2004 12:31:32 -0000 1.60
@@ -673,6 +673,17 @@
}
/**
+ * Reset scrolling stuff. This function is called from initBackground()
+ */
+
+void Graphics::resetRenderEngine(void) {
+ _parallaxScrollX = 0;
+ _parallaxScrollY = 0;
+ _scrollX = 0;
+ _scrollY = 0;
+}
+
+/**
* Sets the scroll target position for the end of the game cycle. The driver
* will then automatically scroll as many times as it can to reach this
* position in the allotted time.
From eriktorbjorn at users.sourceforge.net Wed Apr 7 05:45:08 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Wed Apr 7 05:45:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2 build_display.cpp,1.57,1.58 layers.cpp,1.26,1.27 layers.h,1.9,1.10 sword2.h,1.54,1.55
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15408
Modified Files:
build_display.cpp layers.cpp layers.h sword2.h
Log Message:
Cleanup.
Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/build_display.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- build_display.cpp 28 Mar 2004 14:52:19 -0000 1.57
+++ build_display.cpp 7 Apr 2004 12:31:31 -0000 1.58
@@ -761,11 +761,9 @@
// if last screen was using a shading mask (see below)
if (_vm->_thisScreen.mask_flag) {
uint32 rv = _vm->_graphics->closeLightMask();
-
if (rv)
error("Driver Error %.8x", rv);
-
- _vm->_thisScreen.mask_flag = 0;
+ _vm->_thisScreen.mask_flag = false;
}
return IR_CONT;
Index: layers.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/layers.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- layers.cpp 28 Mar 2004 13:16:01 -0000 1.26
+++ layers.cpp 7 Apr 2004 12:31:31 -0000 1.27
@@ -27,6 +27,7 @@
#include "common/stdafx.h"
#include "sword2/sword2.h"
+#include "sword2/interpreter.h"
#include "sword2/logic.h"
#include "sword2/resman.h"
#include "sword2/driver/d_draw.h"
@@ -42,40 +43,28 @@
return _vm->initBackground(params[0], params[1]);
}
+/**
+ * This function is called when entering a new room.
+ * @param res resource id of the normal background layer
+ * @param new_palette 1 for new palette, otherwise 0
+ */
+
int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
- MultiScreenHeader *screenLayerTable;
- ScreenHeader *screen_head;
- LayerHeader *layer;
- SpriteInfo spriteInfo;
- uint8 *file;
- uint32 rv;
+ int i;
- debug(5, "CHANGED TO LOCATION \"%s\"", fetchObjectName(res));
+ assert(res);
+ debug(1, "CHANGED TO LOCATION \"%s\"", fetchObjectName(res));
- // stop all fx & clears the queue
clearFxQueue();
-
-#ifdef _SWORD2_DEBUG
- debug(5, "fnInitBackground(%d)", res);
-
- if (!res) {
- error("ERROR: fnInitBackground cannot have 0 for background layer id!");
- }
-#endif
-
- // if the screen is still fading down then wait for black
_graphics->waitForFade();
// if last screen was using a shading mask (see below)
if (_thisScreen.mask_flag) {
- rv = _graphics->closeLightMask();
- if (rv)
- error("Driver Error %.8x", rv);
+ if (_graphics->closeLightMask() != RD_OK)
+ error("Could not close light mask");
}
-
- // New stuff for faster screen drivers
- // for drivers: close the previous screen if one is open
+ // Close the previous screen, if one is open
if (_thisScreen.background_layer_id)
_graphics->closeBackgroundLayer();
@@ -86,80 +75,69 @@
// info/and set them up at the beginning of the sort list - why do it
// each cycle
- // file points to 1st byte in the layer file
- file = _resman->openResource(_thisScreen.background_layer_id);
-
- screen_head = fetchScreenHeader(file);
+ uint8 *file = _resman->openResource(_thisScreen.background_layer_id);
+ ScreenHeader *screen_head = fetchScreenHeader(file);
// set number of special sort layers
_thisScreen.number_of_layers = screen_head->noLayers;
_thisScreen.screen_wide = screen_head->width;
_thisScreen.screen_deep = screen_head->height;
- debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
+ debug(2, "layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
// initialise the driver back buffer
_graphics->setLocationMetrics(screen_head->width, screen_head->height);
- if (screen_head->noLayers) {
- for (int i = 0; i < screen_head->noLayers; i++) {
- // get layer header for layer i
- layer = fetchLayerHeader(file, i);
+ for (i = 0; i < screen_head->noLayers; i++) {
+ debug(3, "init layer %d", i);
- // add into the sort list
+ LayerHeader *layer = fetchLayerHeader(file, i);
- // need this for sorting - but leave the rest blank,
- // we'll take from the header at print time
- _sortList[i].sort_y = layer->y + layer->height;
- // signifies a layer
- _sortList[i].layer_number = i + 1;
+ // Add the layer to the sort list. We only provide just enough
+ // information so that it's clear that it's a layer, and where
+ // to sort it in relation to other things in the list.
- debug(5, "init layer %d", i);
- }
+ _sortList[i].layer_number = i + 1;
+ _sortList[i].sort_y = layer->y + layer->height;
}
- // using the screen size setup the scrolling variables
+ // reset scroll offsets
+ _thisScreen.scroll_offset_x = 0;
+ _thisScreen.scroll_offset_y = 0;
- // if layer is larger than physical screen
if (screen_head->width > _graphics->_screenWide || screen_head->height > _graphics->_screenDeep) {
- // switch on scrolling (2 means first time on screen)
+ // The layer is larger than the physical screen. Switch on
+ // scrolling. (2 means first time on screen)
_thisScreen.scroll_flag = 2;
- // note, if we've already set the player up then we could do
+ // Note: if we've already set the player up then we could do
// the initial scroll set here
- // reset scroll offsets
-
- _thisScreen.scroll_offset_x = 0;
- _thisScreen.scroll_offset_y = 0;
+ // Calculate the maximum scroll offsets to prevent scrolling
+ // off the edge. The minimum offsets are both 0.
- // calc max allowed offsets (to prevent scrolling off edge) -
- // MOVE TO NEW_SCREEN in GTM_CORE.C !!
- // NB. min scroll offsets are both zero
_thisScreen.max_scroll_offset_x = screen_head->width - _graphics->_screenWide;
- // 'screenDeep' includes the menu's, so take away 80 pixels
_thisScreen.max_scroll_offset_y = screen_head->height - (_graphics->_screenDeep - (RDMENU_MENUDEEP * 2));
} else {
- // layer fits on physical screen - scrolling not required
- _thisScreen.scroll_flag = 0; // switch off scrolling
- _thisScreen.scroll_offset_x = 0; // reset scroll offsets
- _thisScreen.scroll_offset_y = 0;
+ // The later fits on the phyiscal screen. Switch off scrolling.
+ _thisScreen.scroll_flag = 0;
}
- // no inter-cycle scroll between new screens (see setScrollTarget in
- // build display)
_graphics->resetRenderEngine();
- // these are the physical screen coords where the system
- // will try to maintain George's actual feet coords
+ // These are the physical screen coords where the system will try to
+ // maintain George's actual feet coords.
+
_thisScreen.feet_x = 320;
_thisScreen.feet_y = 340;
// shading mask
- screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader));
+ MultiScreenHeader *screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader));
if (screenLayerTable->maskOffset) {
+ SpriteInfo spriteInfo;
+
spriteInfo.x = 0;
spriteInfo.y = 0;
spriteInfo.w = screen_head->width;
@@ -172,71 +150,40 @@
spriteInfo.data = fetchShadingMask(file);
spriteInfo.colourTable = 0;
- rv = _graphics->openLightMask(&spriteInfo);
- if (rv)
- error("Driver Error %.8x", rv);
+ if (_graphics->openLightMask(&spriteInfo) != RD_OK)
+ error("Could not open light mask");
// so we know to close it later! (see above)
- _thisScreen.mask_flag = 1;
+ _thisScreen.mask_flag = true;
} else {
// no need to close a mask later
- _thisScreen.mask_flag = 0;
+ _thisScreen.mask_flag = false;
}
- // close the screen file
- _resman->closeResource(_thisScreen.background_layer_id);
-
- setUpBackgroundLayers();
-
- debug(5, "end init");
- return 1;
-}
-
-// called from fnInitBackground and also from control panel
-
-void Sword2Engine::setUpBackgroundLayers(void) {
- MultiScreenHeader *screenLayerTable;
- ScreenHeader *screen_head;
- uint8 *file;
- int i;
-
- // if we actually have a screen to initialise (in case not called from
- // control panel)
- if (_thisScreen.background_layer_id) {
- // open resource & set pointers to headers
- // file points to 1st byte in the layer file
-
- file = _resman->openResource(_thisScreen.background_layer_id);
-
- screen_head = fetchScreenHeader(file);
-
- screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader));
-
- // Background parallax layers
-
- for (i = 0; i < 2; i++) {
- if (screenLayerTable->bg_parallax[i])
- _graphics->initialiseBackgroundLayer(fetchBackgroundParallaxLayer(file, i));
- else
- _graphics->initialiseBackgroundLayer(NULL);
- }
+ // Background parallax layers
- // Normal backround layer
+ for (i = 0; i < 2; i++) {
+ if (screenLayerTable->bg_parallax[i])
+ _graphics->initialiseBackgroundLayer(fetchBackgroundParallaxLayer(file, i));
+ else
+ _graphics->initialiseBackgroundLayer(NULL);
+ }
- _graphics->initialiseBackgroundLayer(fetchBackgroundLayer(file));
+ // Normal backround layer
- // Foreground parallax layers
+ _graphics->initialiseBackgroundLayer(fetchBackgroundLayer(file));
- for (i = 0; i < 2; i++) {
- if (screenLayerTable->fg_parallax[i])
- _graphics->initialiseBackgroundLayer(fetchForegroundParallaxLayer(file, i));
- else
- _graphics->initialiseBackgroundLayer(NULL);
- }
+ // Foreground parallax layers
- // close the screen file
- _resman->closeResource(_thisScreen.background_layer_id);
+ for (i = 0; i < 2; i++) {
+ if (screenLayerTable->fg_parallax[i])
+ _graphics->initialiseBackgroundLayer(fetchForegroundParallaxLayer(file, i));
+ else
+ _graphics->initialiseBackgroundLayer(NULL);
}
+
+ _resman->closeResource(_thisScreen.background_layer_id);
+ return IR_CONT;
}
} // End of namespace Sword2
Index: layers.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/layers.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- layers.h 6 Jan 2004 13:44:17 -0000 1.9
+++ layers.h 7 Apr 2004 12:31:31 -0000 1.10
@@ -43,7 +43,7 @@
// palette held within layer file
// fading up after a build_display
uint8 scroll_flag; // Scroll mode 0 off 1 on
- uint8 mask_flag; // Using shading mask
+ bool mask_flag; // Using shading mask
};
} // End of namespace Sword2
Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- sword2.h 4 Apr 2004 15:16:05 -0000 1.54
+++ sword2.h 7 Apr 2004 12:31:31 -0000 1.55
@@ -213,8 +213,6 @@
ScreenInfo _thisScreen;
- void setUpBackgroundLayers(void);
-
uint32 _curMouse;
MouseUnit _mouseList[TOTAL_mouse_list];
From eriktorbjorn at users.sourceforge.net Wed Apr 7 07:32:01 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Wed Apr 7 07:32:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sword2 logic.cpp,1.42,1.43 logic.h,1.30,1.31 speech.cpp,1.59,1.60
Message-ID:
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7235
Modified Files:
logic.cpp logic.h speech.cpp
Log Message:
Cleanup.
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- logic.cpp 17 Mar 2004 09:03:14 -0000 1.42
+++ logic.cpp 7 Apr 2004 14:18:26 -0000 1.43
@@ -46,121 +46,90 @@
*/
int Logic::processSession(void) {
- uint32 run_list;
- uint32 ret, script;
- uint32 *game_object_list;
- char *raw_script_ad;
- char *raw_data_ad;
- uint32 null_pc;
- StandardHeader *head;
- StandardHeader *far_head;
- uint32 id;
-
// might change during the session, so take a copy here
- run_list = _currentRunList;
+ uint32 run_list = _currentRunList;
- // point to first object in list
- _pc = 0;
+ _pc = 0; // first object in list
// by minusing the pc we can cause an immediate cessation of logic
// processing on the current list
while (_pc != 0xffffffff) {
- head = (StandardHeader *) _vm->_resman->openResource(run_list);
+ uint32 ret, script;
+ char *raw_script_ad;
- if (head->fileType != RUN_LIST)
- error("processSession: %d not a run_list", run_list);
+ StandardHeader *head = (StandardHeader *) _vm->_resman->openResource(run_list);
+ assert(head->fileType == RUN_LIST);
- game_object_list = (uint32 *) (head + 1);
+ uint32 *game_object_list = (uint32 *) (head + 1);
// read the next id
- _scriptVars[ID] = game_object_list[_pc++];
- id = _scriptVars[ID];
+ uint id = game_object_list[_pc++];
+ _scriptVars[ID] = id;
- // release the list again so it can float in memory - at this
+ // Release the list again so it can float in memory - at this
// point not one thing should be locked
_vm->_resman->closeResource(run_list);
- debug(5, "%d", _scriptVars[ID]);
-
- // null terminated
if (!_scriptVars[ID]) {
- // end the session naturally
+ // End of list - end the session naturally
return 0;
}
head = (StandardHeader *) _vm->_resman->openResource(_scriptVars[ID]);
-
- if (head->fileType != GAME_OBJECT)
- error("processSession: %d not an object", _scriptVars[ID]);
+ assert(head->fileType == GAME_OBJECT);
_curObjectHub = (ObjectHub *) (head + 1);
- debug(5, " %d id(%d) pc(%d)",
+ debug(5, "Level %d id(%d) pc(%d)",
LEVEL,
_curObjectHub->script_id[LEVEL],
_curObjectHub->script_pc[LEVEL]);
- // do the logic for this object
- // we keep going until a function says to stop - remember,
- // system operations are run via function calls to drivers now
+ // Do the logic for this object. We keep going until a function
+ // says to stop - remember, system operations are run via
+ // function calls to drivers now.
do {
- // get the script id as we may be running a script
- // from another object...
+ // There is a distinction between running one of our
+ // own scripts and that of another object.
script = _curObjectHub->script_id[LEVEL];
- // there is a distinction between running one of our
- // own scripts and that of another object
if (script / SIZE == _scriptVars[ID]) {
- // its our script
+ // It's our own script
- debug(5, "run script %d pc%d",
+ debug(5, "Run script %d pc=%d",
script / SIZE,
_curObjectHub->script_pc[LEVEL]);
- // this is the script data
- // raw_script_ad = (char *) (_curObjectHub + 1);
+ // This is the script data. Script and data
+ // object are the same.
raw_script_ad = (char *) head;
- // script and data object are us/same
ret = runScript(raw_script_ad, raw_script_ad, &_curObjectHub->script_pc[LEVEL]);
} else {
- // we're running the script of another game
- // object - get our data object address
-
- // get the foreign objects script data address
-
- raw_data_ad = (char *) head;
-
- far_head = (StandardHeader *) _vm->_resman->openResource(script / SIZE);
-
- if (far_head->fileType != GAME_OBJECT && far_head->fileType != SCREEN_MANAGER)
- error("processSession: %d not a far object (its a %d)", script / SIZE, far_head->fileType);
-
- // raw_script_ad = (char *) (head + 1) + sizeof(StandardHeader);
+ // We're running the script of another game
+ // object - get our data object address.
- // get our objects data address
- // raw_data_ad = (char *) (_curObjectHub + 1);
+ StandardHeader *far_head = (StandardHeader *) _vm->_resman->openResource(script / SIZE);
+ assert(far_head->fileType == GAME_OBJECT || far_head->fileType == SCREEN_MANAGER);
raw_script_ad = (char *) far_head;
+ char *raw_data_ad = (char *) head;
ret = runScript(raw_script_ad, raw_data_ad, &_curObjectHub->script_pc[LEVEL]);
- // close foreign object again
_vm->_resman->closeResource(script / SIZE);
// reset to us for service script
raw_script_ad = raw_data_ad;
}
- // this script has finished - drop down a level
-
if (ret == 1) {
- // check that it's not already on level 0 !
+ // The script finished - drop down a level
if (LEVEL)
LEVEL--;
else {
@@ -168,12 +137,13 @@
// be different this time and simply
// let it restart next go :-)
- debug(5, "**WARNING object %d script 0 terminated!", id);
+ // Note that this really does happen a
+ // lot, so don't make it a warning.
- // reset to rerun
- _curObjectHub->script_pc[LEVEL] = _curObjectHub->script_id[LEVEL] & 0xffff;
+ debug(5, "object %d script 0 terminated!", id);
- // cause us to drop out for a cycle
+ // reset to rerun, drop out for a cycle
+ _curObjectHub->script_pc[LEVEL] = _curObjectHub->script_id[LEVEL] & 0xffff;
ret = 0;
}
} else if (ret > 2) {
@@ -186,36 +156,32 @@
// keep processing scripts until 0 for quit is returned
} while (ret);
- // any post logic system requests to go here
+ // Any post logic system requests to go here
- // clear any syncs that were waiting for this character - it
+ // Clear any syncs that were waiting for this character - it
// has used them or now looses them
clearSyncs(_scriptVars[ID]);
if (_pc != 0xffffffff) {
- // the session is still valid so run the service script
- null_pc = 0;
-
- // call the base script - this is the graphic/mouse
- // service call
-
+ // The session is still valid so run the graphics/mouse
+ // service script
+ uint32 null_pc = 0;
runScript(raw_script_ad, raw_script_ad, &null_pc);
}
- // made for all live objects
-
// and that's it so close the object resource
_vm->_resman->closeResource(_scriptVars[ID]);
}
- // leaving a room so remove all ids that must reboot correctly
- processKillList();
+ // Leaving a room so remove all ids that must reboot correctly. Then
+ // restart the loop.
- debug(5, "RESTART the loop");
+ for (uint32 i = 0; i < _kills; i++)
+ _vm->_resman->remove(_objectKillList[i]);
- // means restart the loop
+ resetKillList();
return 1;
}
@@ -225,43 +191,25 @@
*/
void Logic::expressChangeSession(uint32 sesh_id) {
- //set to new
+ // Set new session and force the old one to quit.
_currentRunList = sesh_id;
-
- //causes session to quit
_pc = 0xffffffff;
- // reset now in case we double-clicked an exit prior to changing screen
+ // Reset now in case we double-clicked an exit prior to changing screen
_scriptVars[EXIT_FADING] = 0;
- // we're trashing the list - presumably to change room
- // in theory sync waiting in the list could be left behind and never
- // removed - so we trash the lot
-
+ // We're trashing the list - presumably to change room. In theory,
+ // sync waiting in the list could be left behind and never removed -
+ // so we trash the lot
memset(_syncList, 0, sizeof(_syncList));
- // reset walkgrid list (see fnRegisterWalkGrid)
+ // Various clean-ups
_router->clearWalkGridList();
-
- // stops all fx & clears the queue
_vm->clearFxQueue();
-
- // free all the route memory blocks from previous game
_router->freeAllRouteMem();
}
/**
- * A new session will begin next game cycle. The current cycle will conclude
- * and build the screen and flip into view as normal.
- *
- * @note This functino doesn't seem to be used anywhere.
- */
-
-void Logic::naturalChangeSession(uint32 sesh_id) {
- _currentRunList = sesh_id;
-}
-
-/**
* @return The private _currentRunList variable.
*/
@@ -269,9 +217,11 @@
return _currentRunList;
}
-int32 Logic::fnSetSession(int32 *params) {
- // used by player invoked start scripts
+/**
+ * This function is by start scripts.
+ */
+int32 Logic::fnSetSession(int32 *params) {
// params: 0 id of new run list
expressChangeSession(params[0]);
@@ -301,19 +251,13 @@
*/
void Logic::logicUp(uint32 new_script) {
- // going up a level - and we'll keeping going this cycle
- LEVEL++;
-
- // can be 0, 1, 2
- if (LEVEL == 3)
- error("logicUp id %d has run off script tree! :-O", _scriptVars[ID]);
-
- // setup new script on next level (not the current level)
-
debug(5, "new pc = %d", new_script & 0xffff);
- _curObjectHub->script_id[LEVEL] = new_script;
- _curObjectHub->script_pc[LEVEL] = new_script & 0xffff;
+ // going up a level - and we'll keep going this cycle
+ LEVEL++;
+
+ assert(LEVEL < 3); // Can be 0, 1, 2
+ logicReplace(new_script);
}
/**
@@ -322,10 +266,7 @@
void Logic::logicOne(uint32 new_script) {
LEVEL = 1;
-
- // setup new script on level 1
- _curObjectHub->script_id[1] = new_script;
- _curObjectHub->script_pc[1] = new_script & 0xffff;
+ logicReplace(new_script);
}
/**
@@ -334,7 +275,6 @@
*/
void Logic::logicReplace(uint32 new_script) {
- // setup new script on this level
_curObjectHub->script_id[LEVEL] = new_script;
_curObjectHub->script_pc[LEVEL] = new_script & 0xffff;
}
@@ -364,20 +304,14 @@
* Reset the object and restart script 1 on level 0
*/
-void Logic::totalRestart(void) {
- LEVEL = 0;
-
- // reset to rerun
- _curObjectHub->script_pc[0] = 1;
-}
-
int32 Logic::fnTotalRestart(int32 *params) {
// mega runs this to restart its base logic again - like being cached
// in again
// params: none
- totalRestart();
+ LEVEL = 0;
+ _curObjectHub->script_pc[0] = 1;
return IR_TERMINATE;
}
@@ -394,47 +328,31 @@
int32 Logic::fnAddToKillList(int32 *params) {
// params: none
- uint32 entry;
-
// DON'T EVER KILL GEORGE!
- if (_scriptVars[ID] != 8) {
- // first, scan list to see if this object is already included
+ if (_scriptVars[ID] == 8)
+ return IR_CONT;
- entry = 0;
- while (entry < _kills && _objectKillList[entry] != _scriptVars[ID])
- entry++;
+ // Scan the list to see if it's already included
- // if this ID isn't already in the list, then add it,
- // (otherwise finish)
+ for (uint32 i = 0; i < _kills; i++) {
+ if (_objectKillList[i] == _scriptVars[ID])
+ return IR_CONT;
+ }
- if (entry == _kills) {
- // no room at the inn
- assert(_kills < OBJECT_KILL_LIST_SIZE);
+ assert(_kills < OBJECT_KILL_LIST_SIZE); // no room at the inn
- // add this 'ID' to the kill list
- _objectKillList[_kills] = _scriptVars[ID];
- _kills++;
+ _objectKillList[_kills++] = _scriptVars[ID];
- // "another one bites the dust"
+ // "another one bites the dust"
- // when we leave the screen, all these object
- // resources are to be cleaned out of memory and the
- // kill list emptied by doing '_kills = 0', ensuring
- // that all resources are in fact still in memory &
- // more importantly closed before killing!
- }
- }
+ // When we leave the screen, all these object resources are to be
+ // cleaned out of memory and the kill list emptied by doing
+ // '_kills = 0', ensuring that all resources are in fact still in
+ // memory and, more importantly, closed before killing!
return IR_CONT;
}
-void Logic::processKillList(void) {
- for (uint32 i = 0; i < _kills; i++)
- _vm->_resman->remove(_objectKillList[i]);
-
- _kills = 0;
-}
-
void Logic::resetKillList(void) {
_kills = 0;
}
Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- logic.h 29 Mar 2004 06:37:46 -0000 1.30
+++ logic.h 7 Apr 2004 14:18:26 -0000 1.31
@@ -62,8 +62,6 @@
// each object has one of these tacked onto the beginning
ObjectHub *_curObjectHub;
- void processKillList(void);
-
struct EventUnit {
uint32 id;
uint32 interact_id;
@@ -358,9 +356,6 @@
// cause the logic loop to terminate and drop out
void expressChangeSession(uint32 sesh_id);
- // new logic begins next cycle
- void naturalChangeSession(uint32 sesh_id);
-
uint32 getRunList(void);
// setup script_id and script_pc in _curObjectHub - called by fnGosub()
@@ -368,7 +363,6 @@
void logicReplace(uint32 new_script);
void logicOne(uint32 new_script);
- void totalRestart(void);
void examineRunList(void);
void resetKillList(void);
Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/speech.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- speech.cpp 17 Mar 2004 09:03:15 -0000 1.59
+++ speech.cpp 7 Apr 2004 14:18:27 -0000 1.60
@@ -273,10 +273,6 @@
}
_scriptVars[TALK_FLAG] = 0; // in-case DC forgets
-
- // restart george's base script
- // totalRestart();
-
return IR_CONT;
}
From aquadran at users.sourceforge.net Wed Apr 7 11:03:03 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Wed Apr 7 11:03:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.113,1.114
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20666
Modified Files:
TODO
Log Message:
ops and forgot :)
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- TODO 6 Apr 2004 19:46:41 -0000 1.113
+++ TODO 7 Apr 2004 17:49:21 -0000 1.114
@@ -255,8 +255,7 @@
on small devices
* Fix codec44 for nut fonts
* iMUSE Digital:
- - Fix music code
- - Recheck 'next region' code
+ - Fix music code and 'next region' code
- Implement pool method data transfer between imuse and sound mixer
- Implement split track for fadeout track needed by fadeParam in JUMP opcode
- Add save/load code
From aquadran at users.sourceforge.net Wed Apr 7 11:03:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Wed Apr 7 11:03:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.22,1.23
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20666/scumm/imuse_digi
Modified Files:
dimuse_music.cpp
Log Message:
ops and forgot :)
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- dimuse_music.cpp 7 Apr 2004 07:17:16 -0000 1.22
+++ dimuse_music.cpp 7 Apr 2004 17:49:22 -0000 1.23
@@ -257,7 +257,7 @@
if (num != 0) {
if (_curMusicSeq == 0) {
- playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[0], 0, true);
+ playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true);
_curSeqAtribPos = 0;
_attributes[COMI_SEQ_OFFSET + num] = 1;
} else {
From fingolfin at users.sourceforge.net Wed Apr 7 17:20:52 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Wed Apr 7 17:20:52 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm NEWS,1.59,1.60
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32319
Modified Files:
NEWS
Log Message:
Updated NEWS file a bit (I hope people who work on the resp. frontends / backends understand they can add stuff here themselves... ? :-)
Index: NEWS
===================================================================
RCS file: /cvsroot/scummvm/scummvm/NEWS,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- NEWS 28 Mar 2004 20:28:45 -0000 1.59
+++ NEWS 8 Apr 2004 00:06:32 -0000 1.60
@@ -10,6 +10,26 @@
SCUMM:
- Added graphics decoders for 3DO Humongous Entertainment games
+ - Rewrote parts of the text engine for improved subtitle support
+ - Many improvements made to iMuseDigital (used by The Dig, FT and COMI)
+ - Fixed several annoying bugs
+ - Fixed crash on 64 bit architectures (like AMD64)
+
+ Queen:
+ - Various fixes [TODO: Somebody of the Queen team please fill this in]
+
+ Sword1:
+ - ??? [TODO: Somebody of the Sword1 team please fill this in]
+
+ Sword2:
+ - Various fixes [TODO: Somebody of the Sword2 team please fill this in]
+
+ BASS
+ - ???
+
+ Simon
+ - ???
+
0.6.0 (2004-03-14)
New Games:
@@ -31,11 +51,11 @@
and plugin capabilities
Simon:
- - Added data files decoder for Amiga disk versions
- - Added support for inventory graphics in Amiga versions
- - Fixed various brief freezes
- - Fixed minor glitches in load/save dialog in non-English versions
- - Fixed missing inventory arrows in some versions of Simon the Sorcerer 1
+ - Added data files decoder for Amiga disk versions
+ - Added support for inventory graphics in Amiga versions
+ - Fixed various brief freezes
+ - Fixed minor glitches in load/save dialog in non-English versions
+ - Fixed missing inventory arrows in some versions of Simon the Sorcerer 1
SCUMM:
- Many, Many, Many SCUMM game engine fixes. Many of them. And that's a lot.
From fingolfin at users.sourceforge.net Wed Apr 7 18:52:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Wed Apr 7 18:52:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.214,1.215 charset.cpp,2.89,2.90
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15994
Modified Files:
string.cpp charset.cpp
Log Message:
Semi-experimental change: revised _hasMask handling -> simpler code (after removing those FIXME's that is :-), which should still produce identical results (let's wait for the regressions rolling in :-)
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -d -r1.214 -r1.215
--- string.cpp 5 Apr 2004 23:54:58 -0000 1.214
+++ string.cpp 8 Apr 2004 01:38:07 -0000 1.215
@@ -161,7 +161,10 @@
if (!_keepText) {
if (_version <= 3 && _gameId != GID_LOOM) {
- _charset->_hasMask = true;
+// FIXME: Remove this commented out code eventually
+// if (!_charset->_hasMask)
+// warning("_hasMask mismatch (case C) - please report to Fingolfin");
+// _charset->_hasMask = true;
}
_charset->restoreCharsetBg();
}
@@ -310,7 +313,10 @@
_charsetBufPos = buffer - _charsetBuffer;
- _charset->_hasMask = (_charset->_str.left != -1);
+ // FIXME: Remove this and the next three lines eventually!
+ if (_charset->_hasMask != (_charset->_str.left != -1))
+ warning("_hasMask mismatch (case A %d) - please report to Fingolfin", _charset->_hasMask);
+// _charset->_hasMask = (_charset->_str.left != -1);
}
@@ -439,6 +445,9 @@
_string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning
if (_version >= 7) {
+ // FIXME: Remove this and the next three lines eventually!
+ if (!_charset->_hasMask)
+ warning("_hasMask mismatch (case B %d) - please report to Fingolfin", _charset->_hasMask);
_charset->_hasMask = true;
}
}
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.89
retrieving revision 2.90
diff -u -d -r2.89 -r2.90
--- charset.cpp 6 Apr 2004 22:02:02 -0000 2.89
+++ charset.cpp 8 Apr 2004 01:38:07 -0000 2.90
@@ -978,7 +978,7 @@
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height);
- if (vs->number == kMainVirtScreen && !_ignoreCharsetMask)
+ if (!_ignoreCharsetMask)
_hasMask = true;
drawBits1(vs, dest_ptr, char_ptr, mask_ptr, drawTop, 8, 8);
@@ -1084,10 +1084,9 @@
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY);
- if (vs->number == kMainVirtScreen && !_ignoreCharsetMask)
+ if (!_ignoreCharsetMask)
_hasMask = true;
-
byte *mask = _vm->getMaskBuffer(_left, drawTop, 0);
byte *dst = vs->screenPtr + vs->xstart + drawTop * vs->width + _left;
@@ -1291,7 +1290,9 @@
shadow.right = _left + width + 2;
shadow.bottom = _top + height + 2;
- _hasMask = true;
+ if (!_ignoreCharsetMask)
+ _hasMask = true;
+
_current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask, _curId != 3);
_vm->markRectAsDirty(kMainVirtScreen, shadow);
From chrilith at users.sourceforge.net Thu Apr 8 05:02:07 2004
From: chrilith at users.sourceforge.net (Chris Apers)
Date: Thu Apr 8 05:02:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.199,1.200
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22482
Modified Files:
resource.cpp
Log Message:
Can't do that on PalmOS, exit is event based
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- resource.cpp 4 Apr 2004 23:29:10 -0000 1.199
+++ resource.cpp 8 Apr 2004 11:48:35 -0000 1.200
@@ -243,15 +243,21 @@
result = displayMessage("Quit", buf);
if (result == 2) {
- //error("Cannot find file: '%s'", filename);
+#ifdef __PALM_OS__
+ error("Cannot find file: '%s'", filename);
+#else
_system->quit();
+#endif
}
} else {
sprintf(buf, "Cannot find file: '%s'", filename);
InfoDialog dialog(this, (char*)buf);
runDialog(dialog);
- //error("Cannot find file: '%s'", filename);
+#ifdef __PALM_OS__
+ error("Cannot find file: '%s'", filename);
+#else
_system->quit();
+#endif
}
}
From cyx at users.sourceforge.net Thu Apr 8 11:14:08 2004
From: cyx at users.sourceforge.net (Gregory Montoir)
Date: Thu Apr 8 11:14:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.68.2.5,1.68.2.6 command.h,1.18.2.2,1.18.2.3 cutaway.cpp,1.123.2.4,1.123.2.5 cutaway.h,1.34.2.1,1.34.2.2 debug.cpp,1.11.2.1,1.11.2.2 graphics.cpp,1.94.2.3,1.94.2.4 graphics.h,1.66.2.2,1.66.2.3 journal.cpp,1.29.2.5,1.29.2.6 logic.cpp,1.187.2.7,1.187.2.8 talk.cpp,1.89.2.3,1.89.2.4 talk.h,1.29.2.2,1.29.2.3
Message-ID:
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4504/queen
Modified Files:
Tag: branch-0-6-0
command.cpp command.h cutaway.cpp cutaway.h debug.cpp
graphics.cpp graphics.h journal.cpp logic.cpp talk.cpp talk.h
Log Message:
backport of fixed/new stuff :
- journal in spanish version is now fully usable
- hebrew version support
- no more crash during Oracle scene
Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.68.2.5
retrieving revision 1.68.2.6
diff -u -d -r1.68.2.5 -r1.68.2.6
--- command.cpp 14 Mar 2004 13:23:55 -0000 1.68.2.5
+++ command.cpp 8 Apr 2004 18:00:19 -0000 1.68.2.6
@@ -35,16 +35,21 @@
namespace Queen {
+CmdText::CmdText(bool reversed, uint8 y, QueenEngine *vm)
+ : _isReversed(reversed), _y(y), _vm(vm) {
+ clear();
+}
+
void CmdText::clear() {
memset(_command, 0, sizeof(_command));
}
void CmdText::display(uint8 color) {
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, _command, false);
+ _vm->display()->setTextCentered(_y, _command, false);
}
-void CmdText::displayTemp(uint8 color, Verb v, const char *name) {
+void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN] = "";
if (_isReversed) {
if (name != NULL)
@@ -58,17 +63,17 @@
}
}
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
-void CmdText::displayTemp(uint8 color, const char *name) {
+void CmdText::displayTemp(uint8 color, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN];
if (_isReversed)
sprintf(temp, "%s %s", name, _command);
else
sprintf(temp, "%s %s", _command, name);
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
void CmdText::setVerb(Verb v) {
@@ -117,9 +122,7 @@
}
Command::Command(QueenEngine *vm)
- : _vm(vm) {
- _cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
- _cmdText._vm = vm;
+ : _cmdText((vm->resource()->getLanguage() == HEBREW), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
}
void Command::clear(bool clearTexts) {
Index: command.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.h,v
retrieving revision 1.18.2.2
retrieving revision 1.18.2.3
diff -u -d -r1.18.2.2 -r1.18.2.3
--- command.h 14 Mar 2004 00:52:53 -0000 1.18.2.2
+++ command.h 8 Apr 2004 18:00:19 -0000 1.18.2.3
@@ -32,10 +32,12 @@
struct CmdText {
+ CmdText(bool reversed, uint8 y, QueenEngine *vm);
+
void clear();
void display(uint8 color);
- void displayTemp(uint8 color, Verb v, const char *name = NULL);
- void displayTemp(uint8 color, const char *name);
+ void displayTemp(uint8 color, Verb v, const char *name = NULL, bool outlined = false);
+ void displayTemp(uint8 color, const char *name, bool outlined = false);
void setVerb(Verb v);
void addLinkWord(Verb v);
void addObject(const char *objName);
@@ -47,6 +49,7 @@
};
bool _isReversed;
+ uint8 _y;
char _command[MAX_COMMAND_LEN];
QueenEngine *_vm;
};
Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.123.2.4
retrieving revision 1.123.2.5
diff -u -d -r1.123.2.4 -r1.123.2.5
--- cutaway.cpp 23 Mar 2004 23:46:36 -0000 1.123.2.4
+++ cutaway.cpp 8 Apr 2004 18:00:20 -0000 1.123.2.5
@@ -1229,23 +1229,20 @@
int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objAnim, int frameCount) {
int frameIndex[256];
int i;
- int bobNum = objAnim[0].object;
- assert(bobNum < 21);
+ assert(frameCount < 30);
+ AnimFrame cutAnim[30];
memset(frameIndex, 0, sizeof(frameIndex));
debug(6, "[Cutaway::makeComplexAnimation] currentImage = %i", currentImage);
- BobSlot *bob = _vm->graphics()->bob(bobNum);
- bob->xflip = objAnim[0].flip;
-
for (i = 0; i < frameCount; i++) {
- _cutAnim[bobNum][i].frame = objAnim[i].unpackFrame;
- _cutAnim[bobNum][i].speed = objAnim[i].speed;
+ cutAnim[i].frame = objAnim[i].unpackFrame;
+ cutAnim[i].speed = objAnim[i].speed;
frameIndex[objAnim[i].unpackFrame] = 1;
}
- _cutAnim[bobNum][frameCount].frame = 0;
- _cutAnim[bobNum][frameCount].speed = 0;
+ cutAnim[frameCount].frame = 0;
+ cutAnim[frameCount].speed = 0;
int nextFrameIndex = 1;
@@ -1254,20 +1251,17 @@
frameIndex[i] = nextFrameIndex++;
for (i = 0; i < frameCount; i++) {
- _cutAnim[bobNum][i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
- //debug(6, "_cutAnim[%i][%i].frame = %i", bobNum, i, _cutAnim[bobNum][i].frame);
+ cutAnim[i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
}
for (i = 1; i < 256; i++) {
if (frameIndex[i]) {
currentImage++;
- //debug(6, "bankUnpack(%i, %i, %i)", i, currentImage, objAnim[0].bank);
_vm->bankMan()->unpack(i, currentImage, objAnim[0].bank);
}
}
- bob->animString(_cutAnim[bobNum]);
-
+ _vm->graphics()->setBobCutawayAnim(objAnim[0].object, objAnim[0].flip, cutAnim, frameCount + 1);
return currentImage;
}
Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.34.2.1
retrieving revision 1.34.2.2
diff -u -d -r1.34.2.1 -r1.34.2.2
--- cutaway.h 7 Mar 2004 10:44:43 -0000 1.34.2.1
+++ cutaway.h 8 Apr 2004 18:00:20 -0000 1.34.2.2
@@ -194,8 +194,6 @@
int16 _currentImage;
- AnimFrame _cutAnim[21][30];
-
Cutaway(const char *filename,
QueenEngine *vm);
~Cutaway();
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.94.2.3
retrieving revision 1.94.2.4
diff -u -d -r1.94.2.3 -r1.94.2.4
--- graphics.cpp 18 Mar 2004 21:53:20 -0000 1.94.2.3
+++ graphics.cpp 8 Apr 2004 18:00:20 -0000 1.94.2.4
@@ -593,6 +593,13 @@
}
}
+void Graphics::setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount) {
+ assert(bobNum < 21 && frameCount < 30);
+ memcpy(_cutAnim[bobNum], af, sizeof(AnimFrame) * frameCount);
+ _bobs[bobNum].xflip = xflip;
+ _bobs[bobNum].animString(_cutAnim[bobNum]);
+}
+
void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {
for (;;) {
// anim frame format is "%3hu,%3hu," (frame number, frame speed)
Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.66.2.2
retrieving revision 1.66.2.3
diff -u -d -r1.66.2.2 -r1.66.2.3
--- graphics.h 7 Mar 2004 10:44:43 -0000 1.66.2.2
+++ graphics.h 8 Apr 2004 18:00:20 -0000 1.66.2.3
@@ -115,6 +115,7 @@
void setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount);
+ void setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount);
void fillAnimBuffer(const char *anim, AnimFrame *af);
uint16 countAnimFrames(const char *anim);
void setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible);
@@ -165,8 +166,12 @@
//! used to scale a BobFrame
BobFrame _shrinkBuffer;
+ //! in-game objects/persons animations
AnimFrame _newAnim[17][30];
+ //! cutaway objects/persons animations
+ AnimFrame _cutAnim[21][30];
+
uint16 _personFrames[4];
//! Number of animated furniture in current room
Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.29.2.5
retrieving revision 1.29.2.6
diff -u -d -r1.29.2.5 -r1.29.2.6
--- journal.cpp 9 Mar 2004 00:58:57 -0000 1.29.2.5
+++ journal.cpp 8 Apr 2004 18:00:20 -0000 1.29.2.6
@@ -34,14 +34,12 @@
namespace Queen {
-
Journal::Journal(QueenEngine *vm)
: _vm(vm) {
_currentSavePage = 0;
_currentSaveSlot = 0;
}
-
void Journal::use() {
BobSlot *joe = _vm->graphics()->bob(0);
_prevJoeX = joe->x;
@@ -97,7 +95,6 @@
}
}
-
void Journal::prepare() {
_vm->display()->horizontalScroll(0);
_vm->display()->fullscreen(true);
@@ -140,7 +137,6 @@
_vm->bankMan()->close(JOURNAL_BANK);
}
-
void Journal::restore() {
_vm->display()->fullscreen(false);
_vm->display()->forceFullRefresh();
@@ -152,7 +148,6 @@
_vm->logic()->displayRoom(_vm->logic()->currentRoom(), RDM_FADE_JOE, 0, 0, false);
}
-
void Journal::redraw() {
drawNormalPanel();
drawConfigPanel();
@@ -160,7 +155,6 @@
drawSaveSlot();
}
-
void Journal::update() {
_vm->graphics()->update(JOURNAL_ROOM);
if (_edit.enable) {
@@ -172,19 +166,16 @@
_vm->display()->update();
}
-
void Journal::showBob(int bobNum, int16 x, int16 y, int frameNum) {
BobSlot *bob = _vm->graphics()->bob(bobNum);
bob->curPos(x, y);
bob->frameNum = JOURNAL_FRAMES + frameNum;
}
-
void Journal::hideBob(int bobNum) {
_vm->graphics()->bob(bobNum)->active = false;
}
-
void Journal::drawSaveDescriptions() {
int i;
for (i = 0; i < SAVE_PER_PAGE; ++i) {
@@ -199,19 +190,16 @@
showBob(BOB_SAVE_PAGE, 300, 3 + _currentSavePage * 15, 6 + _currentSavePage);
}
-
void Journal::drawSaveSlot() {
showBob(BOB_SAVE_DESC, 130, 6 + _currentSaveSlot * 13, 17);
}
-
void Journal::enterYesNoMode(int16 zoneNum, int titleNum) {
_mode = M_YES_NO;
_prevZoneNum = zoneNum;
drawYesNoPanel(titleNum);
}
-
void Journal::exitYesNoMode() {
_mode = M_NORMAL;
if (_prevZoneNum == ZN_MAKE_ENTRY) {
@@ -223,7 +211,6 @@
redraw();
}
-
void Journal::handleNormalMode(int16 zoneNum, int x) {
if (zoneNum == ZN_REVIEW_ENTRY) {
enterYesNoMode(zoneNum, TXT_REVIEW_ENTRY);
@@ -271,13 +258,11 @@
}
}
-
void Journal::handleInfoBoxMode(int16 zoneNum) {
hideInformationBox();
_mode = M_NORMAL;
}
-
void Journal::handleYesNoMode(int16 zoneNum) {
if (zoneNum == ZN_YES) {
_mode = M_NORMAL;
@@ -316,7 +301,6 @@
}
}
-
void Journal::handleMouseWheel(int inc) {
if (_mode == M_NORMAL) {
int curSave = _currentSavePage * SAVE_PER_PAGE + _currentSaveSlot + inc;
@@ -330,7 +314,6 @@
}
}
-
void Journal::handleMouseDown(int x, int y) {
int16 zone = _vm->grid()->findZoneForPos(GS_ROOM, x, y);
if (_mode == M_INFO_BOX) {
@@ -343,7 +326,6 @@
update();
}
-
void Journal::handleKeyDown(uint16 ascii, int keycode) {
if (_mode == M_YES_NO) {
if (keycode == 27) { // escape
@@ -356,7 +338,6 @@
}
}
-
void Journal::clearPanelTexts() {
int i;
for (i = 0; i < _panelTextCount; ++i) {
@@ -364,23 +345,28 @@
}
}
-
void Journal::drawPanelText(int y, const char *text) {
+ debug(5, "Journal::drawPanelText(%d, '%s')", y, text);
char s[80];
strcpy(s, text);
char *p = strchr(s, ' ');
if (p == NULL) {
int x = (128 - _vm->display()->textWidth(s)) / 2;
_vm->display()->setText(x, y, s, false);
+ assert(_panelTextCount < MAX_PANEL_TEXTS);
_panelTextY[_panelTextCount++] = y;
} else {
*p++ = '\0';
- drawPanelText(y - 5, s);
- drawPanelText(y + 5, p);
+ if (_vm->resource()->getLanguage() == HEBREW) {
+ drawPanelText(y - 5, p);
+ drawPanelText(y + 5, s);
+ } else {
+ drawPanelText(y - 5, s);
+ drawPanelText(y + 5, p);
+ }
}
}
-
void Journal::drawCheckBox(bool active, int bobNum, int16 x, int16 y, int frameNum) {
if (active) {
showBob(bobNum, x, y, frameNum);
@@ -389,12 +375,10 @@
}
}
-
void Journal::drawSlideBar(int value, int hi, int lo, int bobNum, int16 x, int16 y, int frameNum) {
showBob(bobNum, x + value * hi / lo, y, frameNum);
}
-
void Journal::drawPanel(const int *frames, const int *titles, int n) {
clearPanelTexts();
_panelTextCount = 0;
@@ -407,14 +391,12 @@
}
}
-
void Journal::drawNormalPanel() {
int frames[] = { FRAME_BLUE_1, FRAME_BLUE_2, FRAME_BLUE_1, FRAME_ORANGE };
int titles[] = { TXT_REVIEW_ENTRY, TXT_MAKE_ENTRY, TXT_CLOSE, TXT_GIVE_UP };
drawPanel(frames, titles, 4);
}
-
void Journal::drawYesNoPanel(int titleNum) {
int frames[] = { FRAME_GREY, FRAME_BLUE_1, FRAME_BLUE_2 };
int titles[] = { titleNum, TXT_YES, TXT_NO };
@@ -429,7 +411,6 @@
hideBob(BOB_MUSIC_TOGGLE);
}
-
void Journal::drawConfigPanel() {
_vm->checkOptionSettings();
@@ -442,7 +423,6 @@
drawCheckBox(_vm->sound()->musicOn(), BOB_MUSIC_TOGGLE, 125, 181, FRAME_CHECK_BOX);
}
-
void Journal::showInformationBox() {
_vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1);
showBob(BOB_INFO_BOX, 72, 221, FRAME_INFO_BOX);
@@ -490,14 +470,12 @@
_vm->display()->setTextCentered(156, versionId, false);
}
-
void Journal::hideInformationBox() {
_vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1);
hideBob(BOB_INFO_BOX);
redraw();
}
-
void Journal::initEditBuffer(const char *desc) {
OSystem::Property prop;
prop.show_keyboard = true;
@@ -509,7 +487,6 @@
strcpy(_edit.text, desc);
}
-
void Journal::updateEditBuffer(uint16 ascii, int keycode) {
bool dirty = false;
switch (keycode) {
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.187.2.7
retrieving revision 1.187.2.8
diff -u -d -r1.187.2.7 -r1.187.2.8
--- logic.cpp 23 Mar 2004 20:32:18 -0000 1.187.2.7
+++ logic.cpp 8 Apr 2004 18:00:20 -0000 1.187.2.8
@@ -43,6 +43,17 @@
namespace Queen {
+static char *trim(char *str) {
+ char *p = str + strlen(str) - 1;
+ while (p != str && *p == ' ') {
+ *p-- = '\0';
+ }
+ while (str != p && *str == ' ') {
+ ++str;
+ }
+ return str;
+}
+
Logic::Logic(QueenEngine *vm)
: _queen2jas(NULL), _credits(NULL), _vm(vm) {
_joe.x = _joe.y = 0;
@@ -204,6 +215,15 @@
_joeResponse[0] = 0;
for (i = 1; i <= JOE_RESPONSE_MAX; i++)
_joeResponse[i] = _queen2jas->nextLine();
+
+ // FIXME - the spanish version adds some space characters (0x20) at the
+ // beginning and the end of the journal button captions. As we don't need
+ // that 'trick' to center horizontally the texts, we simply trim them.
+ if (_vm->resource()->getLanguage() == SPANISH) {
+ for (i = 30; i <= 35; i++) {
+ _joeResponse[i] = trim(_joeResponse[i]);
+ }
+ }
_aAnim = new char*[_numAAnim + 1];
_aAnim[0] = 0;
@@ -1176,10 +1196,11 @@
_vm->update();
_vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y);
- _vm->display()->textCurrentColor(INK_PINNACLE_ROOM);
_entryObj = 0;
uint16 prevObj = 0;
+ CmdText cmdText((_vm->resource()->getLanguage() == HEBREW), 5, _vm);
+ cmdText.setVerb(VERB_WALK_TO);
while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
_vm->update();
@@ -1202,9 +1223,7 @@
ObjectData *objData = objectData(curObj);
if (objData->name > 0) {
_entryObj = objData->entryObj;
- char textCmd[CmdText::MAX_COMMAND_LEN];
- sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), objectName(objData->name));
- _vm->display()->setTextCentered(5, textCmd);
+ cmdText.displayTemp(INK_PINNACLE_ROOM, objectName(objData->name), true);
}
prevObj = curObj;
}
Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.89.2.3
retrieving revision 1.89.2.4
diff -u -d -r1.89.2.3 -r1.89.2.4
--- talk.cpp 23 Mar 2004 20:32:18 -0000 1.89.2.3
+++ talk.cpp 8 Apr 2004 18:00:20 -0000 1.89.2.4
@@ -1181,15 +1181,69 @@
int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
debug(6, "Talk::splitOption(%s)", str);
- // Check to see if option fits on one line, and exit early
+ int lines;
+ memset(optionText, 0, 5 * MAX_STRING_SIZE);
if (_vm->resource()->getLanguage() == ENGLISH ||
_vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
strcpy(optionText[0], str);
- return 1;
+ lines = 1;
+ } else if (_vm->resource()->getLanguage() == HEBREW) {
+ lines = splitOptionHebrew(str, optionText);
+ } else {
+ lines = splitOptionDefault(str, optionText);
+ }
+ return lines;
+}
+
+int Talk::splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]) {
+ char tmpString[MAX_STRING_SIZE] = "";
+ uint16 len = 0;
+ uint16 spaceCharWidth = _vm->display()->textWidth(" ");
+ uint16 width = 0;
+ uint16 optionLines = 0;
+ uint16 maxTextLen = MAX_TEXT_WIDTH;
+ char *p = strchr(str, '\0');
+ while (p != str - 1) {
+ while (*p != ' ' && p != str - 1) {
+ --p;
+ ++len;
+ }
+ if (p != str - 1) {
+ uint16 wordWidth = _vm->display()->textWidth(p, len);
+ width += wordWidth;
+ if (width > maxTextLen) {
+ ++optionLines;
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ width = wordWidth;
+ maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN;
+ } else {
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ --p;
+ len = 1;
+ width += spaceCharWidth;
+ } else {
+ if (len > 1) {
+ if (width + _vm->display()->textWidth(p + 1, len) > maxTextLen) {
+ ++optionLines;
+ }
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p + 1, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ ++optionLines;
+ }
}
+ return optionLines;
+}
+int Talk::splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]) {
// Split up multiple line option at closest space character
- memset(optionText, 0, 5 * MAX_STRING_SIZE);
uint16 spaceCharWidth = _vm->display()->textWidth(" ");
uint16 width = 0;
uint16 optionLines = 0;
@@ -1201,7 +1255,7 @@
uint16 len = p - str;
uint16 wordWidth = _vm->display()->textWidth(str, len);
width += wordWidth;
- if (width> maxTextLen) {
+ if (width > maxTextLen) {
++optionLines;
strncpy(optionText[optionLines], str, len + 1);
width = wordWidth;
Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.29.2.2
retrieving revision 1.29.2.3
diff -u -d -r1.29.2.2 -r1.29.2.3
--- talk.h 7 Mar 2004 10:44:43 -0000 1.29.2.2
+++ talk.h 8 Apr 2004 18:00:20 -0000 1.29.2.3
@@ -224,7 +224,10 @@
int faceDirection);
int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
+
+ int splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]);
+ int splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]);
};
From aquadran at users.sourceforge.net Thu Apr 8 14:27:12 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 14:27:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.60,1.61 dimuse_sndmgr.cpp,1.28,1.29 dimuse_sndmgr.h,1.21,1.22
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14246
Modified Files:
dimuse.cpp dimuse_sndmgr.cpp dimuse_sndmgr.h
Log Message:
fix for region code
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- dimuse.cpp 6 Apr 2004 19:46:42 -0000 1.60
+++ dimuse.cpp 8 Apr 2004 21:13:24 -0000 1.61
@@ -222,21 +222,21 @@
return;
}
- int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, _track[track].curHookId);
+ int jumpId = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion);
if (jumpId != -1) {
int region = _sound->getRegionIdByJumpId(_track[track].soundHandle, jumpId);
- if (region != -1) {
- int sampleHookId = _sound->getJumpHookId(_track[track].soundHandle, jumpId);
- if (sampleHookId != 0) {
- if (_track[track].curHookId == sampleHookId) {
- _track[track].curRegion = region;
- debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
- _track[track].curHookId = 0;
- }
- } else {
+ assert(region != -1);
+ int sampleHookId = _sound->getJumpHookId(_track[track].soundHandle, jumpId);
+ assert(sampleHookId != -1);
+ if (sampleHookId != 0) {
+ if (_track[track].curHookId == sampleHookId) {
_track[track].curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
+ _track[track].curHookId = 0;
}
+ } else {
+ _track[track].curRegion = region;
+ debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
}
}
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- dimuse_sndmgr.cpp 6 Apr 2004 19:46:43 -0000 1.28
+++ dimuse_sndmgr.cpp 8 Apr 2004 21:13:25 -0000 1.29
@@ -395,13 +395,12 @@
return soundHandle->region[region].offset;
}
-int ImuseDigiSndMgr::getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId) {
+int ImuseDigiSndMgr::getJumpIdByRegion(soundStruct *soundHandle, int region) {
assert(soundHandle && checkForProperHandle(soundHandle));
assert(region >= 0 && region < soundHandle->numRegions);
for (int l = 0; l < soundHandle->numJumps; l++) {
if (soundHandle->jump[l].offset == soundHandle->region[region].offset) {
- if (soundHandle->jump[l].hookId == hookId)
- return l;
+ return l;
}
}
Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- dimuse_sndmgr.h 6 Apr 2004 19:46:43 -0000 1.21
+++ dimuse_sndmgr.h 8 Apr 2004 21:13:25 -0000 1.22
@@ -115,7 +115,7 @@
int getNumRegions(soundStruct *soundHandle);
int getNumJumps(soundStruct *soundHandle);
int getRegionOffset(soundStruct *soundHandle, int region);
- int getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId);
+ int getJumpIdByRegion(soundStruct *soundHandle, int region);
int getRegionIdByJumpId(soundStruct *soundHandle, int jumpId);
int getJumpHookId(soundStruct *soundHandle, int number);
int getJumpFade(soundStruct *soundHandle, int number);
From aquadran at users.sourceforge.net Thu Apr 8 15:13:04 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 15:13:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.23,1.24
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22694
Modified Files:
dimuse_music.cpp
Log Message:
fix for music code
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- dimuse_music.cpp 7 Apr 2004 17:49:22 -0000 1.23
+++ dimuse_music.cpp 8 Apr 2004 21:59:40 -0000 1.24
@@ -198,11 +198,10 @@
break;
case 3:
case 4:
- if ((!sequence) && (table->param != 0)) {
- if (table->param == _digStateMusicTable[_curMusicState].param) {
- startMusic(table->filename, table->soundId, 0, 127);
- return;
- }
+ if ((!sequence) && (table->param != 0) &&
+ (table->param == _digStateMusicTable[_curMusicState].param)) {
+ startMusic(table->filename, table->soundId, 0, 127);
+ return;
}
startMusic(table->filename, table->soundId, hookId, 127);
break;
@@ -330,10 +329,9 @@
case 4:
case 12:
fadeOutMusic(table->fadeOut60TicksDelay);
- if ((!sequence) && (table->param != 0)) {
- if (table->param == _comiStateMusicTable[_curMusicState].param) {
- startMusic(table->filename, table->soundId, 0, 127);
- }
+ if ((!sequence) && (table->param != 0) &&
+ (table->param == _comiStateMusicTable[_curMusicState].param)) {
+ startMusic(table->filename, table->soundId, 0, 127);
} else {
if (table->opcode == 12) {
startMusic(table->filename, table->soundId, table->hookId, 127);
From aquadran at users.sourceforge.net Thu Apr 8 16:00:10 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 16:00:10 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.24,1.25
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32004
Modified Files:
dimuse_music.cpp
Log Message:
another fix
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dimuse_music.cpp 8 Apr 2004 21:59:40 -0000 1.24
+++ dimuse_music.cpp 8 Apr 2004 22:46:22 -0000 1.25
@@ -332,12 +332,12 @@
if ((!sequence) && (table->param != 0) &&
(table->param == _comiStateMusicTable[_curMusicState].param)) {
startMusic(table->filename, table->soundId, 0, 127);
+ return;
+ }
+ if (table->opcode == 12) {
+ startMusic(table->filename, table->soundId, table->hookId, 127);
} else {
- if (table->opcode == 12) {
- startMusic(table->filename, table->soundId, table->hookId, 127);
- } else {
- startMusic(table->filename, table->soundId, hookId, 127);
- }
+ startMusic(table->filename, table->soundId, hookId, 127);
}
break;
}
From fingolfin at users.sourceforge.net Thu Apr 8 16:00:13 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:00:13 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sound mixer.h,1.76,1.77
Message-ID:
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32078/sound
Modified Files:
mixer.h
Log Message:
seems it is 'endianness' and not 'endianess'
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- mixer.h 22 Feb 2004 14:11:11 -0000 1.76
+++ mixer.h 8 Apr 2004 22:46:46 -0000 1.77
@@ -98,8 +98,8 @@
* it needs to generate any data, before any other mixing takes place. The
* premixer than has a chanve to fill the mix buffer with data (usually
* music samples). It should generate the specified number of 16bit stereo
- * samples (i.e. len * 4 bytes). The endianess of these samples shall be
- * the native endianess.
+ * samples (i.e. len * 4 bytes). The endianness of these samples shall be
+ * the native endianness.
*/
void setupPremix(PremixProc *proc, void *param);
From fingolfin at users.sourceforge.net Thu Apr 8 16:00:14 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:00:14 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.328,1.329
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32078/scumm
Modified Files:
script_v6.cpp
Log Message:
seems it is 'endianness' and not 'endianess'
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- script_v6.cpp 5 Apr 2004 23:54:56 -0000 1.328
+++ script_v6.cpp 8 Apr 2004 22:46:46 -0000 1.329
@@ -478,7 +478,7 @@
return 0;
// Workaround for a long standing bug where we save array headers in native
- // endianess, instead of a fixed endianess. We try to detect savegames
+ // endianness, instead of a fixed endianness. We try to detect savegames
// which were created on a big endian system and convert them to little
// endian.
if ((ah->dim1 & 0xF000) || (ah->dim2 & 0xF000) || (ah->type & 0xFF00)) {
From fingolfin at users.sourceforge.net Thu Apr 8 16:00:15 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:00:15 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm configure,1.85,1.86
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32078
Modified Files:
configure
Log Message:
seems it is 'endianness' and not 'endianess'
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- configure 6 Apr 2004 20:04:05 -0000 1.85
+++ configure 8 Apr 2004 22:46:46 -0000 1.86
@@ -479,7 +479,7 @@
linupy)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
DEFINES="$DEFINES -DUNIX"
- _def_endianess='#define SCUMM_LITTLE_ENDIAN'
+ _def_endianness='#define SCUMM_LITTLE_ENDIAN'
_def_align='#define SCUMM_NEED_ALIGNMENT'
_def_linupy="#define DLINUPY"
type_1_byte='char'
@@ -532,10 +532,10 @@
esac
#
- # Check for endianess
+ # Check for endianness
#
- echo_n "Checking endianess... "
- cat <tmp_endianess_check.cpp
+ echo_n "Checking endianness... "
+ cat <tmp_endianness_check.cpp
#include
#include
int main(int argc, char **argv)
@@ -551,21 +551,21 @@
return 0;
}
EOF
- $CXX -o tmp_endianess_check tmp_endianess_check.cpp
- endianess=`./tmp_endianess_check`
- echo $endianess;
- case $endianess in
+ $CXX -o tmp_endianness_check tmp_endianness_check.cpp
+ endianness=`./tmp_endianness_check`
+ echo $endianness;
+ case $endianness in
big)
- _def_endianess='#define SCUMM_BIG_ENDIAN'
+ _def_endianness='#define SCUMM_BIG_ENDIAN'
;;
little)
- _def_endianess='#define SCUMM_LITTLE_ENDIAN'
+ _def_endianness='#define SCUMM_LITTLE_ENDIAN'
;;
*)
exit 1
;;
esac
- rm -f tmp_endianess_check tmp_endianess_check.cpp
+ rm -f tmp_endianness_check tmp_endianness_check.cpp
#
# Check whether memory alignment is required
@@ -875,7 +875,7 @@
#ifndef CONFIG_H
#define CONFIG_H
-$_def_endianess
+$_def_endianness
$_def_align
$_def_linupy
From fingolfin at users.sourceforge.net Thu Apr 8 16:08:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:08:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm configure,1.86,1.87
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1517
Modified Files:
configure
Log Message:
Partially added EXEEXT support to configure script (incomplete; and boy, our configure script sure needs a cleanup :-)
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- configure 8 Apr 2004 22:46:46 -0000 1.86
+++ configure 8 Apr 2004 22:54:22 -0000 1.87
@@ -93,9 +93,9 @@
if test -n "$_host"; then
# In cross-compiling mode, we cannot run the result
- eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && rm -f tmp_cxx_compiler tmp_cxx_compiler.cpp
+ eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
else
- eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler tmp_cxx_compiler.cpp
+ eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
fi
}
@@ -170,7 +170,7 @@
exit 1
fi
fi
-rm -f tmp_find_type_with_size tmp_find_type_with_size.cpp
+rm -f tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp
echo $datatype
}
@@ -346,6 +346,18 @@
fi
#
+# Determine extension used for executables
+#
+case $_host_os in
+mingw* | cygwin*)
+ EXEEXT=".exe"
+ ;;
+*)
+ EXEEXT=""
+ ;;
+esac
+
+#
# Determine the C++ compiler
#
echo_n "Looking for C++ compiler... "
@@ -565,7 +577,7 @@
exit 1
;;
esac
- rm -f tmp_endianness_check tmp_endianness_check.cpp
+ rm -f tmp_endianness_check$EXEEXT tmp_endianness_check.cpp
#
# Check whether memory alignment is required
@@ -912,6 +924,7 @@
BACKEND := $_backend
MODULES += $MODULES
MODULE_DIRS += $MODULE_DIRS
+EXEEXT := $EXEEXT
$_mak_plugins
$_make_def_HAVE_GCC3
From fingolfin at users.sourceforge.net Thu Apr 8 16:52:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:52:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.215,1.216 nut_renderer.cpp,1.46,1.47
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10131
Modified Files:
string.cpp nut_renderer.cpp
Log Message:
cleanup
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -d -r1.215 -r1.216
--- string.cpp 8 Apr 2004 01:38:07 -0000 1.215
+++ string.cpp 8 Apr 2004 23:38:08 -0000 1.216
@@ -160,12 +160,6 @@
_talkDelay = 60;
if (!_keepText) {
- if (_version <= 3 && _gameId != GID_LOOM) {
-// FIXME: Remove this commented out code eventually
-// if (!_charset->_hasMask)
-// warning("_hasMask mismatch (case C) - please report to Fingolfin");
-// _charset->_hasMask = true;
- }
_charset->restoreCharsetBg();
}
@@ -313,10 +307,9 @@
_charsetBufPos = buffer - _charsetBuffer;
- // FIXME: Remove this and the next three lines eventually!
+ // FIXME: Remove this and the next two lines eventually!
if (_charset->_hasMask != (_charset->_str.left != -1))
warning("_hasMask mismatch (case A %d) - please report to Fingolfin", _charset->_hasMask);
-// _charset->_hasMask = (_charset->_str.left != -1);
}
@@ -445,10 +438,9 @@
_string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning
if (_version >= 7) {
- // FIXME: Remove this and the next three lines eventually!
+ // FIXME: Remove this and the next two lines eventually!
if (!_charset->_hasMask)
warning("_hasMask mismatch (case B %d) - please report to Fingolfin", _charset->_hasMask);
- _charset->_hasMask = true;
}
}
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- nut_renderer.cpp 5 Apr 2004 18:45:40 -0000 1.46
+++ nut_renderer.cpp 8 Apr 2004 23:38:09 -0000 1.47
@@ -254,8 +254,6 @@
// This way we achieve the exact look as the original CMI had. However,
// the question remains whether they did it this way, too, or if there is
// some "font shadow" resource we don't know yet.
- // One problem remains: the fonts on the save/load screen don't have a
- // shadow. So how do we know whether to draw text with or without shadow?
int offsetX[7] = { -1, 0, 1, 0, 1, 2, 0 };
int offsetY[7] = { 0, -1, 0, 1, 2, 1, 0 };
From fingolfin at users.sourceforge.net Thu Apr 8 16:55:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:55:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.90,2.91 charset.h,2.26,2.27
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10772
Modified Files:
charset.cpp charset.h
Log Message:
Record on which virtual screen we last drew masked text
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.90
retrieving revision 2.91
diff -u -d -r2.90 -r2.91
--- charset.cpp 8 Apr 2004 01:38:07 -0000 2.90
+++ charset.cpp 8 Apr 2004 23:41:10 -0000 2.91
@@ -40,6 +40,7 @@
_dropShadow = false;
_center = false;
_hasMask = false;
+ _textScreenID = kMainVirtScreen;
_ignoreCharsetMask = false;
_blitAlso = false;
_firstChar = false;
@@ -978,8 +979,10 @@
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height);
- if (!_ignoreCharsetMask)
+ if (!_ignoreCharsetMask) {
_hasMask = true;
+ _textScreenID = vs->number;
+ }
drawBits1(vs, dest_ptr, char_ptr, mask_ptr, drawTop, 8, 8);
@@ -1084,8 +1087,10 @@
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY);
- if (!_ignoreCharsetMask)
+ if (!_ignoreCharsetMask) {
_hasMask = true;
+ _textScreenID = vs->number;
+ }
byte *mask = _vm->getMaskBuffer(_left, drawTop, 0);
byte *dst = vs->screenPtr + vs->xstart + drawTop * vs->width + _left;
@@ -1290,8 +1295,10 @@
shadow.right = _left + width + 2;
shadow.bottom = _top + height + 2;
- if (!_ignoreCharsetMask)
+ if (!_ignoreCharsetMask) {
_hasMask = true;
+ _textScreenID = kMainVirtScreen;
+ }
_current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask, _curId != 3);
_vm->markRectAsDirty(kMainVirtScreen, shadow);
Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.26
retrieving revision 2.27
diff -u -d -r2.26 -r2.27
--- charset.h 4 Apr 2004 20:20:08 -0000 2.26
+++ charset.h 8 Apr 2004 23:41:10 -0000 2.27
@@ -21,8 +21,9 @@
#ifndef CHARSET_H
#define CHARSET_H
-#include "common/rect.h"
#include "common/scummsys.h"
+#include "common/rect.h"
+#include "scumm/gfx.h"
namespace Scumm {
@@ -47,7 +48,10 @@
public:
bool _center;
- bool _hasMask;
+
+ bool _hasMask; // True if "removable" text is visible somewhere (should be called _hasText or so)
+ VirtScreenNumber _textScreenID; // ID of the virtual screen on which the text is visible.
+
bool _ignoreCharsetMask;
bool _blitAlso;
bool _firstChar;
From fingolfin at users.sourceforge.net Thu Apr 8 16:57:04 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Thu Apr 8 16:57:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.271,2.272
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11229
Modified Files:
gfx.cpp
Log Message:
Fix for bugs #929722 (MI2: Difficulty selection screen regression) and #930385 (Subtitles are not shown correctly) by changing restoreCharsetBg() to only restore the screen area which is actually masked by text
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.271
retrieving revision 2.272
diff -u -d -r2.271 -r2.272
--- gfx.cpp 4 Apr 2004 20:20:08 -0000 2.271
+++ gfx.cpp 8 Apr 2004 23:43:30 -0000 2.272
@@ -156,6 +156,44 @@
};
#endif
+static inline void copy8PixelsWithMasking(byte *dst, const byte *src, byte maskbits) {
+ if (!(maskbits & 0x80))
+ dst[0] = src[0];
+ if (!(maskbits & 0x40))
+ dst[1] = src[1];
+ if (!(maskbits & 0x20))
+ dst[2] = src[2];
+ if (!(maskbits & 0x10))
+ dst[3] = src[3];
+ if (!(maskbits & 0x08))
+ dst[4] = src[4];
+ if (!(maskbits & 0x04))
+ dst[5] = src[5];
+ if (!(maskbits & 0x02))
+ dst[6] = src[6];
+ if (!(maskbits & 0x01))
+ dst[7] = src[7];
+}
+
+static inline void clear8PixelsWithMasking(byte *dst, const byte color, byte maskbits) {
+ if (!(maskbits & 0x80))
+ dst[0] = color;
+ if (!(maskbits & 0x40))
+ dst[1] = color;
+ if (!(maskbits & 0x20))
+ dst[2] = color;
+ if (!(maskbits & 0x10))
+ dst[3] = color;
+ if (!(maskbits & 0x08))
+ dst[4] = color;
+ if (!(maskbits & 0x04))
+ dst[5] = color;
+ if (!(maskbits & 0x02))
+ dst[6] = color;
+ if (!(maskbits & 0x01))
+ dst[7] = color;
+}
+
#pragma mark -
#pragma mark --- Virtual Screens ---
#pragma mark -
@@ -544,7 +582,7 @@
void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
VirtScreen *vs;
- byte *backbuff;
+ byte *screenBuf;
if (rect.top < 0)
rect.top = 0;
@@ -557,41 +595,33 @@
if (rect.left > vs->width)
return;
- const int topline = vs->topline;
-
- // Move rect up
- rect.top -= topline;
- rect.bottom -= topline;
+ // Convert 'rect' to local (virtual screen) coordinates
+ rect.top -= vs->topline;
+ rect.bottom -= vs->topline;
rect.clip(vs->width, vs->height);
markRectAsDirty(vs->number, rect, USAGE_BIT_RESTORED);
- int offset = rect.top * vs->width + vs->xstart + rect.left;
- backbuff = vs->screenPtr + offset;
+ const int offset = rect.top * vs->width + vs->xstart + rect.left;
+ screenBuf = vs->screenPtr + offset;
int height = rect.height();
int width = rect.width();
+
+ if (!height)
+ return;
if (vs->hasTwoBuffers && _currentRoom != 0 && isLightOn()) {
- blit(backbuff, vs->backBuf + offset, width, height);
- if (vs->number == kMainVirtScreen && _charset->_hasMask && height) {
- byte *mask;
-
- // Move rect back
- rect.top += topline;
- rect.bottom += topline;
-
+ blit(screenBuf, vs->backBuf + offset, width, height);
+ if (vs->number == kMainVirtScreen && _charset->_hasMask) {
// Note: At first sight it may look as if this could
// be optimized to (rect.right - rect.left) / 8 and
// thus to width / 8, but that's not the case since
// we are dealing with integer math here.
- int mask_width = (rect.right / 8) - (rect.left / 8);
-
- if (rect.right & 0x07)
- mask_width++;
+ const int mask_width = ((rect.right + 7) / 8) - (rect.left / 8);
- mask = getMaskBuffer(rect.left, rect.top + topline, 0);
+ byte *mask = getMaskBuffer(rect.left, rect.top, 0);
do {
memset(mask, 0, mask_width);
@@ -600,34 +630,69 @@
}
} else {
while (height--) {
- memset(backbuff, backColor, width);
- backbuff += vs->width;
+ memset(screenBuf, backColor, width);
+ screenBuf += vs->width;
}
}
}
void CharsetRenderer::restoreCharsetBg() {
+ _nextLeft = _vm->_string[0].xpos;
+ _nextTop = _vm->_string[0].ypos;
+
if (_hasMask) {
- // Restore background on the whole text area. To do this, we simply
- // pass a large rect to restoreBG, and then rely on it clipping that
- // rect. Also, restoreBG() will use findVirtScreen(rect.top) to
- // determine the virtual screen on which to operate. This is fine
- // for us, since we pass in rect.top, so in older games, the text
- // display area is used; in newer games, the main virtscreen gets
- // restored. That's exactly what we need.
- //
- // Of course this will break down if one of the older games (with
- // multiple virtual screens in use) draw text outside the text virtual
- // screen (verbs are excluded, they are handled in a special fashion).
- // But I have no indication that this does ever happen.
- _vm->restoreBG(Common::Rect(5000, 5000));
_hasMask = false;
_str.left = -1;
_left = -1;
- }
- _nextLeft = _vm->_string[0].xpos;
- _nextTop = _vm->_string[0].ypos;
+ // Restore background on the whole text area. This code is based on
+ // restoreBG(), but was changed to only restore those parts which are
+ // currently covered by the charset mask.
+
+ // Loop over first three virtual screens
+ VirtScreen *vs = &_vm->virtscr[_textScreenID];
+
+ if (!vs->height)
+ return;
+
+ _vm->markRectAsDirty(vs->number, Common::Rect(vs->width, vs->height), USAGE_BIT_RESTORED);
+
+ byte *screenBuf = vs->screenPtr + vs->xstart;
+
+ if (vs->hasTwoBuffers && _vm->_currentRoom != 0 && _vm->isLightOn()) {
+ const byte *backBuf = vs->backBuf + vs->xstart;
+
+ if (vs->number == kMainVirtScreen) {
+ // Restore from back buffer, but only those parts which are
+ // currently covered by the charset mask. In addition, we
+ // clean out the charset mask
+
+ const int mask_width = _vm->gdi._numStrips;
+ byte *mask = _vm->getMaskBuffer(0, vs->topline, 0);
+ assert(vs->width == 8 * _vm->gdi._numStrips);
+
+ int height = vs->height;
+ while (height--) {
+ for (int w = 0; w < mask_width; ++w) {
+ const byte maskbits = mask[w];
+ if (maskbits) {
+ copy8PixelsWithMasking(screenBuf + w*8, backBuf + w*8, ~maskbits);
+ mask[w] = 0;
+ }
+ }
+ screenBuf += vs->width;
+ backBuf += vs->width;
+ mask += _vm->gdi._numStrips;
+ }
+ } else {
+ // Restore from back buffer
+ _vm->blit(screenBuf, backBuf, vs->width, vs->height);
+ }
+ } else {
+ // Clear area
+ memset(screenBuf, 0, vs->height * vs->width);
+ }
+ }
}
void CharsetRenderer::clearCharsetMask() {
@@ -639,8 +704,7 @@
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
- return getResourceAddress(rtBuffer, 9)
- + _screenStartStrip + (x / 8) + y * gdi._numStrips + gdi._imgBufOffs[z];
+ return gdi.getMaskBuffer(x / 8, y, z) + _screenStartStrip;
}
byte *Gdi::getMaskBuffer(int x, int y, int z) {
@@ -1581,22 +1645,7 @@
do {
maskbits = *mask;
if (maskbits) {
- if (!(maskbits & 0x80))
- dst[0] = src[0];
- if (!(maskbits & 0x40))
- dst[1] = src[1];
- if (!(maskbits & 0x20))
- dst[2] = src[2];
- if (!(maskbits & 0x10))
- dst[3] = src[3];
- if (!(maskbits & 0x08))
- dst[4] = src[4];
- if (!(maskbits & 0x04))
- dst[5] = src[5];
- if (!(maskbits & 0x02))
- dst[6] = src[6];
- if (!(maskbits & 0x01))
- dst[7] = src[7];
+ copy8PixelsWithMasking(dst, src, maskbits);
} else {
#if defined(SCUMM_NEED_ALIGNMENT)
memcpy(dst, src, 8);
@@ -1617,22 +1666,7 @@
do {
maskbits = *mask;
if (maskbits) {
- if (!(maskbits & 0x80))
- dst[0] = 0;
- if (!(maskbits & 0x40))
- dst[1] = 0;
- if (!(maskbits & 0x20))
- dst[2] = 0;
- if (!(maskbits & 0x10))
- dst[3] = 0;
- if (!(maskbits & 0x08))
- dst[4] = 0;
- if (!(maskbits & 0x04))
- dst[5] = 0;
- if (!(maskbits & 0x02))
- dst[6] = 0;
- if (!(maskbits & 0x01))
- dst[7] = 0;
+ clear8PixelsWithMasking(dst, 0, maskbits);
} else {
#if defined(SCUMM_NEED_ALIGNMENT)
memset(dst, 0, 8);
From kirben at users.sourceforge.net Thu Apr 8 18:58:01 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Thu Apr 8 18:58:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.74,1.75
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31316
Modified Files:
Makefile
Log Message:
Update
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- Makefile 6 Apr 2004 21:50:04 -0000 1.74
+++ Makefile 9 Apr 2004 01:43:51 -0000 1.75
@@ -125,9 +125,9 @@
rm -rf ScummVM-snapshot
# Special target to create a win32 snapshot binary
-win32dist: scummvm
+win32dist: scummvm$(EXEEXT)
mkdir -p $(WIN32PATH)
- strip scummvm.exe -o $(WIN32PATH)/scummvm.exe
+ strip scummvm.exe -o $(WIN32PATH)/scummvm$(EXEEXT)
cp COPYING $(WIN32PATH)/copying.txt
cp README $(WIN32PATH)/readme.txt
cp NEWS $(WIN32PATH)/news.txt
From aquadran at users.sourceforge.net Thu Apr 8 21:11:03 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 21:11:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.61,1.62 dimuse.h,1.37,1.38 dimuse_music.cpp,1.25,1.26
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20993
Modified Files:
dimuse.cpp dimuse.h dimuse_music.cpp
Log Message:
rename to _nextSeqToPlay
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- dimuse.cpp 8 Apr 2004 21:13:24 -0000 1.61
+++ dimuse.cpp 9 Apr 2004 03:57:18 -0000 1.62
@@ -68,7 +68,7 @@
_curMusicSeq = 0;
_curMusicCue = 0;
memset(_attributes, 0, sizeof(_attributes));
- _curSeqAtribPos = 0;
+ _nextSeqToPlay = 0;
}
void IMuseDigital::callback() {
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- dimuse.h 6 Apr 2004 19:46:43 -0000 1.37
+++ dimuse.h 9 Apr 2004 03:57:18 -0000 1.38
@@ -84,8 +84,7 @@
bool _pause;
int _attributes[188];
- int _curSeqAtribPos;
-
+ int _nextSeqToPlay;
int _curMusicState;
int _curMusicSeq;
int _curMusicCue;
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dimuse_music.cpp 8 Apr 2004 22:46:22 -0000 1.25
+++ dimuse_music.cpp 9 Apr 2004 03:57:18 -0000 1.26
@@ -120,24 +120,24 @@
if (num != 0) {
if (_curMusicSeq == 0) {
playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true);
- _curSeqAtribPos = 0;
+ _nextSeqToPlay = 0;
_attributes[DIG_SEQ_OFFSET + num] = 1;
} else {
if ((_digSeqMusicTable[_curMusicSeq].opcode == 4) || (_digSeqMusicTable[_curMusicSeq].opcode == 6)) {
- _curSeqAtribPos = num;
+ _nextSeqToPlay = num;
return;
} else {
playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true);
- _curSeqAtribPos = 0;
+ _nextSeqToPlay = 0;
_attributes[DIG_SEQ_OFFSET + num] = 1;
}
}
} else {
- if (_curSeqAtribPos != 0) {
- playDigMusic(_digSeqMusicTable[_curSeqAtribPos].name, &_digSeqMusicTable[_curSeqAtribPos], 0, true);
- _attributes[DIG_SEQ_OFFSET + _curSeqAtribPos] = 1;
- num = _curSeqAtribPos;
- _curSeqAtribPos = 0;
+ if (_nextSeqToPlay != 0) {
+ playDigMusic(_digSeqMusicTable[_nextSeqToPlay].name, &_digSeqMusicTable[_nextSeqToPlay], 0, true);
+ _attributes[DIG_SEQ_OFFSET + _nextSeqToPlay] = 1;
+ num = _nextSeqToPlay;
+ _nextSeqToPlay = 0;
} else {
if (_curMusicState != 0) {
playDigMusic(_digStateMusicTable[_curMusicState].name, &_digStateMusicTable[_curMusicState], _curMusicState, true);
@@ -257,24 +257,24 @@
if (num != 0) {
if (_curMusicSeq == 0) {
playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true);
- _curSeqAtribPos = 0;
+ _nextSeqToPlay = 0;
_attributes[COMI_SEQ_OFFSET + num] = 1;
} else {
if ((_comiSeqMusicTable[_curMusicSeq].opcode == 4) || (_comiSeqMusicTable[_curMusicSeq].opcode == 6)) {
- _curSeqAtribPos = num;
+ _nextSeqToPlay = num;
return;
} else {
playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true);
- _curSeqAtribPos = 0;
+ _nextSeqToPlay = 0;
_attributes[COMI_SEQ_OFFSET + num] = 1;
}
}
} else {
- if (_curSeqAtribPos != 0) {
- playComiMusic(_comiSeqMusicTable[_curSeqAtribPos].name, &_comiSeqMusicTable[_curSeqAtribPos], 0, true);
- _attributes[COMI_SEQ_OFFSET + _curSeqAtribPos] = 1;
- num = _curSeqAtribPos;
- _curSeqAtribPos = 0;
+ if (_nextSeqToPlay != 0) {
+ playComiMusic(_comiSeqMusicTable[_nextSeqToPlay].name, &_comiSeqMusicTable[_nextSeqToPlay], 0, true);
+ _attributes[COMI_SEQ_OFFSET + _nextSeqToPlay] = 1;
+ num = _nextSeqToPlay;
+ _nextSeqToPlay = 0;
} else {
if (_curMusicState != 0) {
playComiMusic(_comiStateMusicTable[_curMusicState].name, &_comiStateMusicTable[_curMusicState], _curMusicState, true);
From aquadran at users.sourceforge.net Thu Apr 8 21:34:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 21:34:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.26,1.27
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24810
Modified Files:
dimuse_music.cpp
Log Message:
correction for stoping sequence
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dimuse_music.cpp 9 Apr 2004 03:57:18 -0000 1.26
+++ dimuse_music.cpp 9 Apr 2004 04:20:17 -0000 1.27
@@ -31,18 +31,16 @@
#define COMI_SEQ_OFFSET (COMI_STATE_OFFSET + 94)
void IMuseDigital::refreshScripts() {
+ Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
bool found = false;
- {
- Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- found = true;
- }
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
+ found = true;
}
}
if ((!found) && (_curMusicSeq != 0)) {
- parseScriptCmds(0x1001, 0, 0, 0, 0, 0, 0, 0);
+ parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
}
}
From aquadran at users.sourceforge.net Thu Apr 8 22:10:05 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 22:10:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.19,1.20
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30617
Modified Files:
scumm.cpp
Log Message:
refreshScript was wrong used
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- scumm.cpp 6 Apr 2004 18:42:53 -0000 1.19
+++ scumm.cpp 9 Apr 2004 04:56:18 -0000 1.20
@@ -1577,8 +1577,6 @@
}
_sound->processSoundQues();
- if ((_imuseDigital) && (_gameId != GID_FT))
- _imuseDigital->refreshScripts();
camera._last = camera._cur;
From aquadran at users.sourceforge.net Thu Apr 8 22:10:06 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 22:10:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.h,1.38,1.39 dimuse_music.cpp,1.27,1.28 dimuse_script.cpp,1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30617/imuse_digi
Modified Files:
dimuse.h dimuse_music.cpp dimuse_script.cpp
Log Message:
refreshScript was wrong used
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- dimuse.h 9 Apr 2004 03:57:18 -0000 1.38
+++ dimuse.h 9 Apr 2004 04:56:18 -0000 1.39
@@ -146,7 +146,6 @@
void stopAllSounds(bool waitForStop);
void pause(bool pause);
void parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h);
- void refreshScripts();
int getSoundStatus(int sound) const;
int32 getCurMusicPosInMs();
int32 getCurVoiceLipSyncWidth();
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- dimuse_music.cpp 9 Apr 2004 04:20:17 -0000 1.27
+++ dimuse_music.cpp 9 Apr 2004 04:56:18 -0000 1.28
@@ -30,20 +30,6 @@
#define COMI_STATE_OFFSET 3
#define COMI_SEQ_OFFSET (COMI_STATE_OFFSET + 94)
-void IMuseDigital::refreshScripts() {
- Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
- bool found = false;
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- found = true;
- }
- }
-
- if ((!found) && (_curMusicSeq != 0)) {
- parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
- }
-}
-
void IMuseDigital::setDigMusicState(int stateId) {
int l, num = -1;
Index: dimuse_script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dimuse_script.cpp 6 Apr 2004 19:46:43 -0000 1.1
+++ dimuse_script.cpp 9 Apr 2004 04:56:18 -0000 1.2
@@ -155,7 +155,7 @@
// setGroupMusicVolume(b);
break;
default:
- warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
+ error("IMuseDigital::doCommand DEFAULT command %d", cmd);
}
}
From aquadran at users.sourceforge.net Thu Apr 8 22:57:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 22:57:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.20,1.21
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5333
Modified Files:
scumm.cpp
Log Message:
back refreshScript only for DIG, add stopping music while changing bundle
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- scumm.cpp 9 Apr 2004 04:56:18 -0000 1.20
+++ scumm.cpp 9 Apr 2004 05:43:19 -0000 1.21
@@ -1577,6 +1577,8 @@
}
_sound->processSoundQues();
+ if ((_imuseDigital) && (_gameId == GID_DIG))
+ _imuseDigital->refreshScripts();
camera._last = camera._cur;
From aquadran at users.sourceforge.net Thu Apr 8 22:57:02 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 22:57:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.h,1.39,1.40 dimuse_music.cpp,1.28,1.29 dimuse_script.cpp,1.2,1.3 dimuse_sndmgr.cpp,1.29,1.30
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5333/imuse_digi
Modified Files:
dimuse.h dimuse_music.cpp dimuse_script.cpp dimuse_sndmgr.cpp
Log Message:
back refreshScript only for DIG, add stopping music while changing bundle
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- dimuse.h 9 Apr 2004 04:56:18 -0000 1.39
+++ dimuse.h 9 Apr 2004 05:43:24 -0000 1.40
@@ -146,6 +146,7 @@
void stopAllSounds(bool waitForStop);
void pause(bool pause);
void parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h);
+ void refreshScripts();
int getSoundStatus(int sound) const;
int32 getCurMusicPosInMs();
int32 getCurVoiceLipSyncWidth();
Index: dimuse_script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dimuse_script.cpp 9 Apr 2004 04:56:18 -0000 1.2
+++ dimuse_script.cpp 9 Apr 2004 05:43:24 -0000 1.3
@@ -159,6 +159,20 @@
}
}
+void IMuseDigital::refreshScripts() {
+ Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
+ bool found = false;
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
+ found = true;
+ }
+ }
+
+ if ((!found) && (_curMusicSeq != 0)) {
+ parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
void IMuseDigital::startVoice(int soundId, AudioStream *input) {
debug(5, "startVoiceStream(%d)", soundId);
startSound(soundId, NULL, 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- dimuse_sndmgr.cpp 8 Apr 2004 21:13:25 -0000 1.29
+++ dimuse_sndmgr.cpp 9 Apr 2004 05:43:24 -0000 1.30
@@ -23,6 +23,7 @@
#include "common/util.h"
#include "sound/voc.h"
#include "scumm/scumm.h"
+#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse_digi/dimuse_sndmgr.h"
#include "scumm/imuse_digi/dimuse_bndmgr.h"
@@ -221,8 +222,12 @@
} else {
char musicfile[20];
sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
- if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK))
+ if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
+ _vm->_imuseDigital->parseScriptCmds(0x1000, 0, 0, 0, 0, 0, 0, 0);
+ _vm->_imuseDigital->parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
+ _vm->_imuseDigital->stopAllSounds(true);
_sounds[slot].bundle->closeFile();
+ }
result = _sounds[slot].bundle->openFile(musicfile, _vm->getGameDataPath());
@@ -248,8 +253,12 @@
} else {
char voxfile[20];
sprintf(voxfile, "voxdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
- if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK))
+ if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
+ _vm->_imuseDigital->parseScriptCmds(0x1000, 0, 0, 0, 0, 0, 0, 0);
+ _vm->_imuseDigital->parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
+ _vm->_imuseDigital->stopAllSounds(true);
_sounds[slot].bundle->closeFile();
+ }
result = _sounds[slot].bundle->openFile(voxfile, _vm->getGameDataPath());
From aquadran at users.sourceforge.net Thu Apr 8 23:31:02 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Thu Apr 8 23:31:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_music.cpp,1.29,1.30 dimuse_sndmgr.cpp,1.30,1.31 dimuse_track.cpp,1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10107
Modified Files:
dimuse_music.cpp dimuse_sndmgr.cpp dimuse_track.cpp
Log Message:
-fix for dig demo
-handle some music opcodes without filename
Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- dimuse_music.cpp 9 Apr 2004 05:43:24 -0000 1.29
+++ dimuse_music.cpp 9 Apr 2004 06:17:12 -0000 1.30
@@ -171,10 +171,6 @@
fadeOutMusic(120);
- if (table->filename[0] == 0) {
- return;
- }
-
switch(table->opcode) {
case 0:
case 5:
@@ -182,6 +178,9 @@
break;
case 3:
case 4:
+ if (table->filename[0] == 0) {
+ return;
+ }
if ((!sequence) && (table->param != 0) &&
(table->param == _digStateMusicTable[_curMusicState].param)) {
startMusic(table->filename, table->soundId, 0, 127);
@@ -289,11 +288,6 @@
}
}
- if (table->filename[0] == 0) {
- fadeOutMusic(120);
- return;
- }
-
switch(table->opcode) {
case 0:
case 8:
@@ -301,17 +295,29 @@
fadeOutMusic(120);
break;
case 1:
+ if (table->filename[0] == 0) {
+ fadeOutMusic(120);
+ return;
+ }
fadeOutMusic(120);
startMusic(table->filename, table->soundId, 0, 1);
setFade(table->soundId, 127, 120);
break;
case 2:
+ if (table->filename[0] == 0) {
+ fadeOutMusic(60);
+ return;
+ }
fadeOutMusic(table->fadeOut60TicksDelay);
startMusic(table->filename, table->soundId, table->hookId, 127);
break;
case 3:
case 4:
case 12:
+ if (table->filename[0] == 0) {
+ fadeOutMusic(60);
+ return;
+ }
fadeOutMusic(table->fadeOut60TicksDelay);
if ((!sequence) && (table->param != 0) &&
(table->param == _comiStateMusicTable[_curMusicState].param)) {
Index: dimuse_track.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dimuse_track.cpp 6 Apr 2004 19:46:43 -0000 1.1
+++ dimuse_track.cpp 9 Apr 2004 06:17:20 -0000 1.2
@@ -205,7 +205,11 @@
void IMuseDigital::selectVolumeGroup(int soundId, int volGroupId) {
Common::StackLock lock(_mutex, "IMuseDigital::setGroupVolume()");
debug(5, "IMuseDigital::setGroupVolume(%d, %d)", soundId, volGroupId);
- assert((volGroupId >= 1) && (volGroupId <= 3));
+ assert((volGroupId >= 1) && (volGroupId <= 4));
+
+ if (volGroupId == 4)
+ volGroupId = 3;
+
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].soundId == soundId) && _track[l].used) {
_track[l].volGroupId = volGroupId;
From eriktorbjorn at users.sourceforge.net Fri Apr 9 00:38:01 2004
From: eriktorbjorn at users.sourceforge.net (Torbj?rn Andersson)
Date: Fri Apr 9 00:38:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sound flac.cpp,1.1,1.2 flac.h,1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20467
Modified Files:
flac.cpp flac.h
Log Message:
Changed the UNIX line breaks.
Fixed the problem where the lookout music didn't play in the MI1CD intro.
At least, I *think* I fixed it. It worked at home, but I can't test it on
this particular computer.
Index: flac.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/flac.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- flac.cpp 22 Feb 2004 14:11:10 -0000 1.1
+++ flac.cpp 9 Apr 2004 07:24:08 -0000 1.2
@@ -1,840 +1,843 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2004 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[...1652 lines suppressed...]
+
+ delete file;
+ return NULL;
+}
+
+AudioStream *makeFlacStream(File *file, uint32 length)
+{
+ assert(file != NULL);
+ uint32 start = file->pos();
+
+ FlacInputStream *flac = new FlacInputStream(file, start, start + length);
+ if (flac->init())
+ return flac;
+
+ delete flac;
+ return NULL;
+}
+
+
+#endif // #ifdef USE_FLAC
Index: flac.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/flac.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- flac.h 22 Feb 2004 14:11:11 -0000 1.1
+++ flac.h 9 Apr 2004 07:24:08 -0000 1.2
@@ -1,39 +1,39 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2004 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Header$
- *
- */
-
-#ifndef SOUND_FLAC_H
-#define SOUND_FLAC_H
-
-#include "stdafx.h"
-#include "common/scummsys.h"
-
-#ifdef USE_FLAC
-
-class AudioStream;
-class DigitalTrackInfo;
-class File;
-
-DigitalTrackInfo *getFlacTrack(int track);
-
-AudioStream *makeFlacStream(File *file, uint32 size);
-
-#endif // #ifdef USE_FLAC
-#endif // #ifndef SOUND_FLAC_H
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2004 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef SOUND_FLAC_H
+#define SOUND_FLAC_H
+
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+#ifdef USE_FLAC
+
+class AudioStream;
+class DigitalTrackInfo;
+class File;
+
+DigitalTrackInfo *getFlacTrack(int track);
+
+AudioStream *makeFlacStream(File *file, uint32 size);
+
+#endif // #ifdef USE_FLAC
+#endif // #ifndef SOUND_FLAC_H
From ender at users.sourceforge.net Fri Apr 9 01:58:02 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 01:58:02 2004
Subject: [Scummvm-cvs-logs] CVS: web subprojects.php,1.4,1.5
Message-ID:
Update of /cvsroot/scummvm/web
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv449
Modified Files:
subprojects.php
Log Message:
Stop referring to Residual as stalled. Most of the issues that caused it to be 'stalled' have since been resolved.
Index: subprojects.php
===================================================================
RCS file: /cvsroot/scummvm/web/subprojects.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- subprojects.php 25 Mar 2004 12:26:31 -0000 1.4
+++ subprojects.php 9 Apr 2004 08:44:21 -0000 1.5
@@ -42,10 +42,8 @@
pun.
-Residual's core is in a fairly decent state, however the base code uses C++ functionality
-to such an extent that some developers on the main ScummVM team who wish to work on it simply
-cannot understand the code that needs work (specifically the costume renderer) and it has several issues with MSVC. Hence
-progress on this program is currently stalled.
+Residual's core is in a fairly decent state, however it is not in full-time development and
+as such is progressing slowly.
Also, a software renderer needs to be written as older OpenGL cards cannot blit the static
From ender at users.sourceforge.net Fri Apr 9 02:08:03 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 02:08:03 2004
Subject: [Scummvm-cvs-logs] CVS: web faq.php,1.31,1.32
Message-ID:
Update of /cvsroot/scummvm/web
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2213
Modified Files:
faq.php
Log Message:
Update a few things in the FAQ.
Index: faq.php
===================================================================
RCS file: /cvsroot/scummvm/web/faq.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- faq.php 6 Jan 2004 17:20:07 -0000 1.31
+++ faq.php 9 Apr 2004 08:54:00 -0000 1.32
@@ -110,16 +110,14 @@
We have a compatibility list on our website
that contains an up to date list of what games work, and how well they work. As
well as SCUMM games, we also include virtual machines for the first two Simon the Sorcerer
- games (by Adventure Soft), and Beneath a Steel Sky by Revolution. Other games may be added,
+ games (by Adventure Soft), Broken Sword 1/2 and Beneath a Steel Sky (by
+ Revolution), as well as Flight of the Amazon Queen. Other games may be added,
but this is not a common occurrence - see below.
Will ScummVM support other games?
- The ScummVM team is working to make newer SCUMM games, such as "Full Throttle" playable
- We are also working to correct make the currently supported games more accurate, and are adding support (over time) for Broken Sword 1 and 2, by Revolution.
- As Revolution Software Ltd are really nice people, and have provided us with source code
- for their games, so we are more than happy to add support for these classic adventures.
- However we do NOT generally add support for non-SCUMM games!
+ The ScummVM team is currently focusing on bugfixes for our next release.
+ We do NOT generally add support for non-SCUMM games!
Reverse engineering a completely new game without source is a long process, and our
developers are all very busy as it is... so unless you work for a company interested
in providing us with source code for one of your classic titles, please do not ask.
@@ -143,16 +141,19 @@
ports collections and included in Debian testing and unstable
Does ScummVM run any non-SCUMM games?
- Yes. Currently the only non-SCUMM games supported are Simon The Sorcerer (1 and 2),
- and Beneath a Steel Sky. Simon support was originally written by the
- founder of ScummVM as a separate program, and later included in the main binary.
+ Yes. As well as SCUMM titles, ScummVM supports Simon the Sorcerer (1 and 2),
+ Flight of the Amazon Queen, and the Revolution Games: Broken Sword 1, Broken Sword
+ 2, and Beneath a Steel Sky.
+ Simon support was initially written by the original founder of ScummVM as a
+ separate program, and later included in the main binary.
Revolution Software Ltd. are very nice people and kindly provided us with the
- source code to BASS, on which we based our interpreter. We are currently working
- on support for Broken Sword 1 and 2, again thanks to Revolutions kind support.
+ source code to BASS and Broken Sword 1/2, from which we based our interpreters.
+ John Passfield and Steven Stamatiadis kindly provided the original source code to
+ Flight of the Amazon Queen.
We do not have any plans to support any other non-SCUMM games at this time. If we
do, it will be added to the Compatibility List.
Unless you work for a company interested providing us with source code for one of your
- classic titles, please do not ask us to support game XXX.
+ classic titles, please do not ask us to support a game.
Can I use ScummVM to make new games?
@@ -205,9 +206,10 @@
README
for more info.
- Does ScummVM support using MP3/Ogg files instead of CD audio?
+
Does ScummVM support using MP3/Ogg/FLAC files instead of CD audio?
Yes. You can use LAME or some other CD audio conversion utility to convert your CD audio to MP3. Since
- version 0.3.0 we also support Ogg Vorbis files. See the
+ version 0.3.0 we also support Ogg Vorbis files. FLAC is also supported in the current CVS
+ tree, although not in the latest released 0.6.x version. See the
README
for more info.
@@ -217,8 +219,9 @@
for more info.
Can I run my game full screen?
- Yes. You can either start your game using the -f command line parameter. Or you can hit
- Alt+Enter in game to switch between full screen and windowed modes.
+ Yes. You can either start your game using the -f command line parameter, setting
+ the game to Full Screen in the ScummVM Options dialog, or by using the Alt+Enter key
+ combination in-game to switch between full screen and windowed modes.
@@ -244,13 +247,14 @@
reproduce this crash more than once, please report it to our Bug Tracker. See 4.8.
The game colors are messed up.
- This is a known issue with using Amiga version datafiles. Use the --platform=amiga command
- line parameter (or tick the Amiga checkbox in the Launcher / F5 menu) to enable Amiga
- palette conversion.
+ This is a known issue with using Amiga version datafiles. Select Amiga as a
+ platform in the ScummVM Game Options dialog, or use the --platform=amiga command
+ line parameter to enable Amiga-specific code.
The characters in my non english game are messed up.
You are most likely using a game such as Maniac Mansion or Zak McKracken if you have this problem.
- You need to specify a language with the -q parameter or use the language config file option.
+ You need to specify a language in the ScummVM Game Options dialog, with the -q parameter or by
+ using the 'language' config file option.
Consult the
README
or command line help for further information.
@@ -260,7 +264,9 @@
understands. To do this you need to use the rescumm tool in the scummvm-tools package.
An example usage might look like: rescumm "Sam & Max Demo Data". Some CDs may appear to
only contain a application, in which case there is still a seperate data file but it is invisible.
- The older games which have LFL files should only need the --platform=macintosh option to run.
+ The older games which have LFL files should only need the platform set to 'macintosh' to
+ run. See 4.5 for information on specifying the game platform.
+
Reporting Bugs.
To report a bug, please create a SourceForge account and follow the
From ender at users.sourceforge.net Fri Apr 9 02:25:10 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 02:25:10 2004
Subject: [Scummvm-cvs-logs] CVS: web compatibility.php,1.314,1.315
Message-ID:
Update of /cvsroot/scummvm/web
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4688
Modified Files:
compatibility.php
Log Message:
Update compat. list.
Index: compatibility.php
===================================================================
RCS file: /cvsroot/scummvm/web/compatibility.php,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- compatibility.php 29 Mar 2004 13:07:21 -0000 1.314
+++ compatibility.php 9 Apr 2004 09:10:31 -0000 1.315
@@ -60,8 +60,8 @@
$games = array(
'Maniac Mansion (original)' => array('1','maniac','90'),
'Maniac Mansion (enhanced)' => array('2','maniac','95'),
- 'Zak McKracken and the Alien Mindbenders (original)' => array('1','zak','80'),
- 'Zak McKracken and the Alien Mindbenders (enhanced)' => array('2','zak','80'),
+ 'Zak McKracken and the Alien Mindbenders (original)' => array('1','zak','85'),
+ 'Zak McKracken and the Alien Mindbenders (enhanced)' => array('2','zak','90'),
'Zak McKracken and the Alien Mindbenders (256 - FmTowns)' => array('3','zaktowns','90'),
'Indiana Jones and the Last Crusade' => array('3','indy3ega','90'),
'Indiana Jones and the Last Crusade (256)' => array('3','indy3','90'),
@@ -89,15 +89,15 @@
'Fatty Bears Fun Pack' => array('6','fbpack','50'),
'Day Of The Tentacle' => array('6','tentacle','95'),
'Day Of The Tentacle (Demo)' => array('6','dottdemo','95'),
- 'Sam & Max' => array('6','samnmax','93'),
+ 'Sam & Max' => array('6','samnmax','95'),
'Sam & Max (Demo)' => array('6','samdemo','95'),
'Full Throttle' => array('7','ft','80'),
'The Dig' => array('7','dig','85'),
'Curse of Monkey Island' => array('8','comi','80'),
'Beneath a Steel Sky' => array('n/a','sky','90'),
- 'Broken Sword I' => array('n/a','sword1','80'),
- 'Broken Sword II' => array('n/a','sword2','85'),
- 'Flight of the Amazon Queen' => array('n/a','queen','80'),
+ 'Broken Sword I' => array('n/a','sword1','85'),
+ 'Broken Sword II' => array('n/a','sword2','90'),
+ 'Flight of the Amazon Queen' => array('n/a','queen','90'),
'Simon The Sorcerer 1 Talkie (Win)' => array('n/a','simon1win','95'),
'Simon The Sorcerer 1 Talkie (DOS)' => array('n/a','simon1talkie','93'),
'Simon The Sorcerer 1 Talkie (Amiga CD32)' => array('n/a','simon1cd32','8'),
@@ -112,12 +112,10 @@
);
$notes = array(
-"maniac" => "Enhanced PC version is completable".
- "
Classic version is completable".
+"maniac" => "No known issues, game is completable.".
"
- Minor graphical glitches with actors in classic verison".
"
- Amiga, Atari ST, Mac and PC versions supported by this target",
-"zak" => "Enhanced PC version is completable, with several minor glitches".
- "
Classic version is completable, with several minor glitches".
+"zak" => "No known issues, game is completable.".
"
- Minor graphical glitches with actors in classic verison".
"
- Amiga, Atari ST and PC versions supported by this target",
"indy3ega" => "Game is completable".
@@ -125,14 +123,12 @@
"
- Indiana may be able to walk in odd places, in some rooms".
"
- No inventory in Mac version".
"
- Atari ST and Mac versions require pcjr or pcspk music driver",
-"indy3" => "Game is completable".
- "
- Indiana may be able to walk in odd places, in some rooms",
-"indy3towns" => "Game is completable." .
- "
- Indiana may be able to walk in odd places, in some rooms".
+"indy3" => "No known issues, game is completable.",
+"indy3towns" => "No known issues, game is completable." .
"
- Kanji version isn't supported",
-"zaktowns" => "Game is completable.".
+"zaktowns" => "No known issues, game is completable.".
"
- Kanji version isn't supported",
-"loom" => "No known problems - should be playable to the end".
+"loom" => "No known issues, game is completable.".
"
- Amiga, Atari ST, Mac and PC versions supported by this target".
"
- No music or sound effects with Mac version".
"
- Atari ST and Mac versions require pcjr or pcspk music driver".
@@ -147,35 +143,35 @@
"1 standard".
"2 expert".
"
- Kanji version isn't supported",
-"monkeyega" => "Game is completable".
+"monkeyega" => "No known issues, game is completable.".
"
- Atari ST version requires pcjr or pcspk music driver".
"
- MIDI support requires the Roland update from LucasArts",
"pass" => "All three demos are completable.",
-"loomcd" => "No known problems - should be playable to the end",
+"loomcd" => "No known issues, game is completable.",
"monkeyvga" => "Game is completable.".
"
- Both Amiga and PC versions supported by this target".
"
- No music with Amiga version",
-"monkey" => "No known problems - should be playable to the end",
-"monkey1" => "No known problems - should be playable to the end".
+"monkey" => "No known issues, game is completable.",
+"monkey1" => "No known issues, game is completable.".
"
- Both Mac and PC versions supported by this target",
-"game" => "No known problems - should be playable to the end".
+"game" => "No known issues, game is completable.".
"
- No sound effects",
-"monkey2" => "No known problems - should be playable to the end".
+"monkey2" => "No known issues, game is completable.".
"
- Amiga, FM Towns, Mac and PC versions supported by this target".
"
- Various graphical glitches with Amiga version".
"
- Kanji version requires the FM Towns Font ROM",
"mi2demo" => "Often crashes due to missing resources, since it was never meant to be playable".
"
- No support for playing back the recorded file of gameplay",
-"atlantis" => "No known problems - should be playable to the end".
+"atlantis" => "No known issues, game is completable.".
"
- Amiga, FM Towns, Mac and PC versions supported by this target".
"
- Both disk and cd PC versions are supported by this target".
"
- Music loud on some systems, run with -m30 to lower music volume.".
"
- Various graphical glitches with Amiga version".
"
- Kanji version requires the FM Towns Font ROM",
-"playfate" => "No known problems - should be playable to the end",
-"puttdemo" => "Should be playable to the end".
+"playfate" => "No known issues, game is completable.",
+"puttdemo" => "No known issues, game is completable.".
"
- Some sound effects missing",
-"puttputt" => "Game should be completable".
+"puttputt" => "No known issues, game is completable.".
"
- Minor graphical glitches when cars come out of their garages on streets",
"puttmoon" => "Fails an AKOS related assertion shortly after starting".
"
- scummvm: scumm/akos.cpp:267: virtual byte AkosRenderer::drawLimb(const CostumeData&, int): Assertion `(code & 0xFFF) * 6 < READ_BE_UINT32((byte *)akof - 4) - 8' failed.",
@@ -193,24 +189,24 @@
"
- Reversi/Go Fish/Lines and Boxes: o6_actorOps: case 218 graphics glitches".
"
- Coloring: Painting has no effect".
"
- Tangrams: Can only use central tangram piece",
-"tentacle" => "No known problems - should be playable to the end".
+"tentacle" => "No known issues, game is completable.".
"
- Both Mac and PC versions supported by this target".
"
- Both disk and cd versions are supported by this target".
"
- Maniac Mansion isn't playable on Ed's computer. To play the included copy, use 'Add Game' from the main ScummVM launcher and select the MANIAC directory inside the DOTT game directory",
-"dottdemo" => "No known problems - should be playable to the end",
-"samnmax" => "No major problems - should be playable to the end".
+"dottdemo" => "No known issues, game is completable.",
+"samnmax" => "No known issues, game is completable.".
"
- Both Mac and PC versions supported by this target".
"
- Both disk and cd versions are supported by this target".
"
- Highway subgame doesn't behave correctly",
"samdemo" => "No known problems - should be playable to the end",
-"ft" => "Game is completable to the end, but with several glitches".
+"ft" => "Game is completable, with several glitches".
"
- Both Mac and PC versions supported by this target".
"
- Music is not continuous, and may pause, restart, and otherwise act oddly".
"
- SMUSH audio (movie cutscenes) is a lot quieter than in-game voice, which is abnormally loud",
-"dig" => "Game is fully completable, with some minor sound issues".
+"dig" => "Game is completable, with some minor sound issues".
"
- Both Mac and PC versions supported by this target",
-"comi" => "Game is fully completable, although ship-to-ship combat is broken and several graphical glitches are present",
-"sky" => "Game is completable".
+"comi" => "Game is completable, with some minor glitches.",
+"sky" => "No known issues, game is completable.".
"
- Floppy demos are unsupported".
"
- Amiga versions aren't supported and probably never will be".
"
".
@@ -219,28 +215,28 @@
"
This is especially noticeable in the court- and Mrs. Piermont sequence.".
"
- The fonts for the LINC terminal are partially incorrect and the text sometimes passes the screen borders".
"
- Special characters for french and italian subtitles are incorrect sometimes",
-"sword1" => "Game is completable.".
+"sword1" => "No known issues, game is completable.".
"
- Czech support is untested. If you have a czech version, please contact us.".
"
- Only the PC version has been tested. We don't have any other versions, so we can't make any promises about them.",
-"sword2" => "Game is completable.".
+"sword2" => "No known issues, game is completable.".
"
- Only the PC version has been tested. We don't have any other versions, so we can't make any promises about them.",
-"queen" => "Game is completable.".
+"queen" => "No known issues, game is completable.".
"
- Some versions may require the queen.tbl resource file to be placed in the game directory. This is not required for the freeware releases",
-"simon1win" => "No known problems - game is completable.",
-"simon1talkie" => "Game is completable.",
+"simon1win" => "No known issues, game is completable.",
+"simon1talkie" => "No known issues, game is completable.",
"simon1cd32" => "Game is completable, with major graphics glitches".
"
- Character and background graphics are decoded incorrectly".
"
- No music",
-"simon1acorn" => "Game is completable.",
-"simon1dos" => "Game is completable.",
+"simon1acorn" => "No known issues, game is completable.",
+"simon1dos" => "No known issues, game is completable.",
"simon1amiga" => "Game works a bit but can't see anything".
"
- Character and background graphics are decoded incorrectly".
"
- No music",
-"simon1demo" => "Game demo is completable",
-"simon2win" => "No known problems - game is completable.",
-"simon2talkie" => "No known problems - game is completable.",
-"simon2dos" => "No known problems - game is completable.",
-"simon2mac" => "Game is completable.".
+"simon1demo" => "No known issues, game demo is completable.",
+"simon2win" => "No known issues, game is completable.",
+"simon2talkie" => "No known issues, game is completable.",
+"simon2dos" => "No known issues, game is completable.",
+"simon2mac" => "No known issues, game is completable.".
"
- Only default language (English) in data files is supported".
"
- F10 key animation is different"
);
From ender at users.sourceforge.net Fri Apr 9 05:48:09 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 05:48:09 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/kyra - New directory
Message-ID:
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9727/kyra
Log Message:
Directory /cvsroot/scummvm/scummvm/kyra added to the repository
From ender at users.sourceforge.net Fri Apr 9 05:50:12 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 05:50:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile.common,1.85,1.86 configure,1.87,1.88
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10031
Modified Files:
Makefile.common configure
Log Message:
Add Kyrandia base
Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile.common,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- Makefile.common 21 Mar 2004 21:20:25 -0000 1.85
+++ Makefile.common 9 Apr 2004 12:36:05 -0000 1.86
@@ -85,6 +85,12 @@
MODULES += saga
endif
+ifdef DISABLE_KYRA
+DEFINES += -DDISABLE_KYRA
+else
+MODULES += kyra
+endif
+
# After the game specific modules follow the shared modules
MODULES += \
gui \
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- configure 8 Apr 2004 22:54:22 -0000 1.87
+++ configure 9 Apr 2004 12:36:05 -0000 1.88
@@ -38,6 +38,7 @@
_build_sword1=yes
_build_sword2=yes
_build_queen=yes
+_build_kyra=no
_build_saga=no
_need_memalign=no
_build_plugins=no
@@ -212,6 +213,7 @@
--disable-sword1 don't build the Broken Sword I engine
--disable-sword2 don't build the Broken Sword II engine
--disable-queen don't build the Flight of the Amazon Queen engine
+ --enable-kyra build the Legend of Kyrandia engine
--enable-saga build the SAGA engine
--enable-plugins build engines as loadable modules instead of
static linking them
@@ -261,6 +263,7 @@
--disable-sword1) _build_sword1=no ;;
--disable-sword2) _build_sword2=no ;;
--disable-queen) _build_queen=no ;;
+ --enable-kyra) _build_kyra=yes ;;
--enable-saga) _build_saga=yes ;;
--enable-alsa) _alsa=yes ;;
--disable-alsa) _alsa=no ;;
@@ -478,6 +481,12 @@
_mak_queen='# DISABLE_QUEEN = 1'
fi
+if test "$_build_kyra" = no ; then
+ _mak_queen='DISABLE_KYRA = 1'
+else
+ _mak_queen='# DISABLE_KYRA = 1'
+fi
+
if test "$_build_saga" = no ; then
_mak_saga='DISABLE_SAGA = 1'
else
@@ -848,6 +857,9 @@
if test "$_build_saga" = yes ; then
echo " SAGA Engine"
fi
+if test "$_build_kyra" = yes ; then
+ echo " Legend of Kyrandia"
+fi
echo
echo_n "Backend... "
@@ -934,6 +946,7 @@
$_mak_sword1
$_mak_sword2
$_mak_queen
+$_mak_kyra
$_mak_saga
INCLUDES += $INCLUDES
From ender at users.sourceforge.net Fri Apr 9 05:50:13 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 05:50:13 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/base plugins.cpp,1.30,1.31 plugins.h,1.17,1.18
Message-ID:
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10031/base
Modified Files:
plugins.cpp plugins.h
Log Message:
Add Kyrandia base
Index: plugins.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- plugins.cpp 23 Mar 2004 00:16:36 -0000 1.30
+++ plugins.cpp 9 Apr 2004 12:36:06 -0000 1.31
@@ -245,6 +245,10 @@
LOAD_MODULE("queen", QUEEN);
#endif
+#ifndef DISABLE_KYRA
+ LOAD_MODULE("kyra", KYRA);
+#endif
+
#ifndef DISABLE_SAGA
LOAD_MODULE("saga", SAGA);
#endif
Index: plugins.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- plugins.h 14 Mar 2004 23:37:11 -0000 1.17
+++ plugins.h 9 Apr 2004 12:36:06 -0000 1.18
@@ -165,6 +165,10 @@
DECLARE_PLUGIN(QUEEN)
#endif
+#ifndef DISABLE_KYRA
+DECLARE_PLUGIN(KYRA)
+#endif
+
#ifndef DISABLE_SAGA
DECLARE_PLUGIN(SAGA)
#endif
From ender at users.sourceforge.net Fri Apr 9 05:50:14 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 05:50:14 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/kyra .cvsignore,NONE,1.1 kyra.cpp,NONE,1.1 kyra.h,NONE,1.1 kyra.o,NONE,1.1 libkyra.a,NONE,1.1 module.mk,NONE,1.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10031/kyra
Added Files:
.cvsignore kyra.cpp kyra.h kyra.o libkyra.a module.mk
Log Message:
Add Kyrandia base
--- NEW FILE: .cvsignore ---
.deps
--- NEW FILE: kyra.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v 1.1 2004/04/09 12:36:06 ender Exp $
*
*/
#include "stdafx.h"
#include "base/gameDetector.h"
#include "base/plugins.h"
#include "backends/fs/fs.h"
#include "sound/mixer.h"
#include "common/file.h"
#include "common/config-manager.h"
#include "kyra.h"
static const GameSettings kyra_setting =
{ "kyra", "Legend of Kyrandia", 0 };
GameList Engine_KYRA_gameList() {
GameList games;
games.push_back(kyra_setting);
return games;
}
// TODO: Improve this :)
DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
File test_file;
printf("Detecting Kyra...\n");
// Iterate over all files in the given directory
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *name = file->displayName().c_str();
if ((0 == scumm_stricmp("chapter1.vrm", name)) ||
(0 == scumm_stricmp("chapter5.vrm", name))) {
detectedGames.push_back(kyra_setting);
break;
}
}
return detectedGames;
}
Engine *Engine_KYRA_create(GameDetector *detector, OSystem *syst) {
return new Kyra::KyraEngine(detector, syst);
}
REGISTER_PLUGIN("Legend of Kyrandia Engine", Engine_KYRA_gameList, Engine_KYRA_create, Engine_KYRA_detectGames)
namespace Kyra {
KyraEngine::KyraEngine(GameDetector *detector, OSystem *syst)
: Engine(syst) {
// Setup mixer
if (!_mixer->isReady()) {
warning("Sound initialization failed.");
}
_mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255);
//getGameDataPath();
// Initialize backend
syst->initSize(320, 240);
}
KyraEngine::~KyraEngine() {
}
void KyraEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1);
}
void KyraEngine::go() {
warning("Kyrandia Engine ::go()");
}
void KyraEngine::shutdown() {
_system->quit();
}
} // End of namespace KYRA
--- NEW FILE: kyra.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/kyra/kyra.h,v 1.1 2004/04/09 12:36:06 ender Exp $
*
*/
#ifndef KYRA_H
#define KYRA_H
#include "common/scummsys.h"
#include "base/engine.h"
#include "base/gameDetector.h"
#include "common/util.h"
namespace Kyra {
class KyraEngine : public Engine {
void errorString( const char *buf_input, char *buf_output);
protected:
void go();
void shutdown();
public:
KyraEngine(GameDetector *detector, OSystem *syst);
virtual ~KyraEngine();
};
} // End of namespace Kyra
#endif
--- NEW FILE: kyra.o ---
ELF
2
2
2
2
2<
2<
�
�
$
$
�
�
L
L
�
d(
Y
+
�
�
%�
,[
-�
.�
/�
0�
1�
2
3�
4�
5
�
�
6�
<�
H�
B
C6
D�
Fn
G�
�
�
O�
M
N�
R(
_1
YD
Z�
[�
\�
]�
^6
�
�
f�
dJE
e�
_
_
j�
p�
q6
r�
s�
t�
u�
v�
w�
7
7
xu
�X
}>
~�
�
�
�
��
��
�t
�6
��
��
��
�
�
��
�b
��
�i
�
�
�
�
�
�
�
�
o
o
Q
}
G
M
X
d
�
�
�
�
�
�
Q
:
Q
Q
Q
}
�
M
G
M
X
d
�
M
M
^
^
l
w
d
�
l
�
p
p
B
B
@
@
W
W
6
6
�
(
�
l
(
�
�
�
�
�
�
�
S!
S!
�"
�"
�"
�"
�"
�"
#
#
�#
�#
#
#
#
$
$
�$
�$
�%
�%
�&
�&
P'
P'
�'
�'
�(
�(
)
)
$*
$*
-
-
-
�
-
�
�
�
-
�
-
-
-
.
.
l
#.
-
/
/
�0
�0
�
�0
-
1
�
�
-
�7
�L
�L
'�%
M
M
M
M
RO
RO
*O
�
�N
�
(
(
:
�
:
{
(
(
�N
cO
(
:
{
�
�N
cO
(
:
{
�
�N
�O
8-
:
{
�
8-
�N
(
:
(
:
{
N
�
(
N
�
N
8-
�
8-
N
8-
N
:
N
{
N
�
�
�N
FO
$O
(
�
�O
�
�8
�8
(
(
(
(
'W,
�9
�9
�:
�:
$X
/
$X
�
/
�
�
�
$X
�
�=
�=
/
�8
�9
Y
�=
Y
�
�=
�
�
�
Y
�
�D
�D
�D
�
�D
�
�
�
�D
�
UD
UD
�D
�D
rD
�D
bI
bI
I
bI
�D
�D
mI
�
3I
>I
3I
�
>I
�
�
�
3I
�
kJ
�
�
kJ
kJ
kJ
�L
�L
�
�
�
�
�
�
�
�
kJ
�L
�L
�
�L
�
�
�
�
kJ
N
N
N
l
�N
�N
�
�
$O
(
U
U
4U
4U
-
-
-
-
�W
�W
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
S
-
l
-
-
�
-
-
8-
-
-
-
-
l
-
�
-
8-
-
-
-
-
-
-
X
-
X
�W
�W
�W
�
�W
�
�
�
�W
�
_
_
l
�0
1
nsert_atEiRKS3_
ertChannelEP18PlayingSoundHandleP7Channel
R
`
--- NEW FILE: libkyra.a ---
!
/ 1081514833 0 0 0 678 `
ELF
2
2
2
2
2<
2<
�
�
$
$
�
�
L
L
�
d(
Y
+
�
�
%�
,[
-�
.�
/�
0�
1�
2
3�
4�
5
�
�
6�
<�
H�
B
C6
D�
Fn
G�
�
�
O�
M
N�
R(
_1
YD
Z�
[�
\�
]�
^6
�
�
f�
dJE
e�
_
_
j�
p�
q6
r�
s�
t�
u�
v�
w�
7
7
xu
�X
}>
~�
�
�
�
��
��
�t
�6
��
��
��
�
�
��
�b
��
�i
�
�
�
�
�
�
�
�
o
o
Q
}
G
M
X
d
�
�
�
�
�
�
Q
:
Q
Q
Q
}
�
M
G
M
X
d
�
M
M
^
^
l
w
d
�
l
�
p
p
B
B
@
@
W
W
6
6
�
(
�
l
(
�
�
�
�
�
�
�
S!
S!
�"
�"
�"
�"
�"
�"
#
#
�#
�#
#
#
#
$
$
�$
�$
�%
�%
�&
�&
P'
P'
�'
�'
�(
�(
)
)
$*
$*
-
-
-
�
-
�
�
�
-
�
-
-
-
.
.
l
#.
-
/
/
�0
�0
�
�0
-
1
�
�
-
�7
�L
�L
'�%
M
M
M
M
RO
RO
*O
�
�N
�
(
(
:
�
:
{
(
(
�N
cO
(
:
{
�
�N
cO
(
:
{
�
�N
�O
8-
:
{
�
8-
�N
(
:
(
:
{
N
�
(
N
�
N
8-
�
8-
N
8-
N
:
N
{
N
�
�
�N
FO
$O
(
�
�O
�
�8
�8
(
(
(
(
'W,
�9
�9
�:
�:
$X
/
$X
�
/
�
�
�
$X
�
�=
�=
/
�8
�9
Y
�=
Y
�
�=
�
�
�
Y
�
�D
�D
�D
�
�D
�
�
�
�D
�
UD
UD
�D
�D
rD
�D
bI
bI
I
bI
�D
�D
mI
�
3I
>I
3I
�
>I
�
�
�
3I
�
kJ
�
�
kJ
kJ
kJ
�L
�L
�
�
�
�
�
�
�
�
kJ
�L
�L
�
�L
�
�
�
�
kJ
N
N
N
l
�N
�N
�
�
$O
(
U
U
4U
4U
-
-
-
-
�W
�W
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
S
-
l
-
-
�
-
-
8-
-
-
-
-
l
-
�
-
8-
-
-
-
-
-
-
X
-
X
�W
�W
�W
�
�W
�
�
�
�W
�
_
_
l
�0
1
nsert_atEiRKS3_
ertChannelEP18PlayingSoundHandleP7Channel
R
`
--- NEW FILE: module.mk ---
MODULE := kyra
MODULE_OBJS = \
kyra/kyra.o
MODULE_DIRS += \
kyra
# This module can be built as a plugin
ifdef BUILD_PLUGINS
PLUGIN := 1
endif
# Include common rules
include $(srcdir)/common.rules
From ender at users.sourceforge.net Fri Apr 9 05:59:05 2004
From: ender at users.sourceforge.net (James Brown)
Date: Fri Apr 9 05:59:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/kyra kyra.o,1.1,NONE libkyra.a,1.1,NONE
Message-ID:
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11807
Removed Files:
kyra.o libkyra.a
Log Message:
Whoops. Remember to make clean/distclean before commiting whole directories :)
--- kyra.o DELETED ---
--- libkyra.a DELETED ---
From joostp at users.sourceforge.net Fri Apr 9 06:45:02 2004
From: joostp at users.sourceforge.net (Joost Peters)
Date: Fri Apr 9 06:45:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.256.2.4,1.256.2.5
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21740
Modified Files:
Tag: branch-0-6-0
README
Log Message:
add instructions on using non-freeware FOTAQ and some extra keys
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.256.2.4
retrieving revision 1.256.2.5
diff -u -d -r1.256.2.4 -r1.256.2.5
--- README 14 Mar 2004 13:59:52 -0000 1.256.2.4
+++ README 9 Apr 2004 13:31:10 -0000 1.256.2.5
@@ -16,7 +16,8 @@
* 3.1 Copy Protection
* 3.2 Simon the Sorcerer notes
* 3.3 Broken Sword notes
- * 3.4 Known Bugs
+ * 3.4 Flight of the Amazon Queen notes
+ * 3.5 Known Bugs
4.0) Supported Platforms
5.0) Running ScummVM
* 5.1 Command Line Options
@@ -217,7 +218,20 @@
currently this requires either copying the game to harddisk or reburning
customised versions of the game CDs.
-3.4) Known Problems in ScummVM 0.6.0
+3.4) Flight of the Amazon Queen notes
+---- --------------------------------
+In order to use a non-freeware version of Flight of the Amazon Queen (i.e.
+your own), you will need to have the 'queen.tbl' file (available from the
+Compatibility page on our website) in either the directory containing the
+'queen.1' datafile or in the directory where your ScummVM executable resides.
+
+Alternatively, you can use the 'queenrebuild' tool from the Tools module to
+'rebuild' your FOTAQ datafile to include the table for that specific version,
+and thus removing the run-time dependency on the 'queen.tbl' file.
+This tool also allows you to compress the speech and sound effects with MP3
+or OGG.
+
+3.5) Known Problems in ScummVM 0.6.0
---- -----------------------------------
This release has the following known problems. There is no need to report them,
although patches to fix them are welcome. If you discover a bug that is not
@@ -358,7 +372,7 @@
--alt-intro Use alternative intro for CD versions of Beneath a
Steel Sky and Flight of the Amazon Queen
- --copy-protection Enable copy protection in SCUMM games ,when
+ --copy-protection Enable copy protection in SCUMM games, when
ScummVM disables it by default.
--demo-mode Start demo mode of Maniac Mansion (Classic version)
--tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games
@@ -536,6 +550,11 @@
Flight of the Amazon Queen:
Ctrl-d - Starts the debugger
+ F1 - Use Journal (saving/loading)
+ F11 - Quicksave
+ F12 - Quickload
+ Escape - Skips cutscenes
+ Space - Skips current line of text
Simon the Sorcerer 1 & 2:
Ctrl 0-9 and Alt 0-9 - Load and save game state
@@ -1037,7 +1056,7 @@
* You can now type 'make' to create a command line binary.
* To get a version you can run from Finder, type 'make bundle' which
will create ScummVM.app (this only works if you installed SDL
- etc. via Fink and into \texttt{/sw}. If you have installed SDL
+ etc. via Fink and into /sw. If you have installed SDL
in another way, you'll have to edit the Makefile).
X.X Credits:
From joostp at users.sourceforge.net Fri Apr 9 06:45:12 2004
From: joostp at users.sourceforge.net (Joost Peters)
Date: Fri Apr 9 06:45:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.264,1.265
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21829
Modified Files:
README
Log Message:
add instructions on using non-freeware FOTAQ and some extra keys
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -d -r1.264 -r1.265
--- README 6 Apr 2004 11:55:35 -0000 1.264
+++ README 9 Apr 2004 13:31:36 -0000 1.265
@@ -16,7 +16,8 @@
* 3.1 Copy Protection
* 3.2 Simon the Sorcerer notes
* 3.3 Broken Sword notes
- * 3.4 Known Bugs
+ * 3.4 Flight of the Amazon Queen notes
+ * 3.5 Known Bugs
4.0) Supported Platforms
5.0) Running ScummVM
* 5.1 Command Line Options
@@ -217,7 +218,21 @@
currently this requires either copying the game to harddisk or reburning
customised versions of the game CDs.
-3.4) Known Problems in ScummVM 0.7.0CVS
+3.4) Flight of the Amazon Queen notes
+---- --------------------------------
+In order to use a non-freeware version of Flight of the Amazon Queen (i.e.
+your own), you will need to have the 'queen.tbl' file (available from the
+Compatibility page on our website) in either the directory containing the
+'queen.1' datafile or in the directory where your ScummVM executable resides.
+
+Alternatively, you can use the 'queenrebuild' tool from the Tools module to
+'rebuild' your FOTAQ datafile to include the table for that specific version,
+and thus removing the run-time dependency on the 'queen.tbl' file.
+This tool also allows you to compress the speech and sound effects with MP3,
+OGG or FLAC.
+
+
+3.5) Known Problems in ScummVM 0.7.0CVS
---- -----------------------------------
This release has the following known problems. There is no need to report them,
although patches to fix them are welcome. If you discover a bug that is not
@@ -318,7 +333,7 @@
--alt-intro Use alternative intro for CD versions of Beneath a
Steel Sky and Flight of the Amazon Queen
- --copy-protection Enable copy protection in SCUMM games ,when
+ --copy-protection Enable copy protection in SCUMM games, when
ScummVM disables it by default.
--demo-mode Start demo mode of Maniac Mansion (Classic version)
--tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games
@@ -496,7 +511,11 @@
Flight of the Amazon Queen:
Ctrl-d - Starts the debugger
- F1 - Displays save/load box
+ F1 - Use Journal (saving/loading)
+ F11 - Quicksave
+ F12 - Quickload
+ Escape - Skips cutscenes
+ Space - Skips current line of text
Simon the Sorcerer 1 & 2:
Ctrl 0-9 and Alt 0-9 - Load and save game state
@@ -1027,7 +1046,7 @@
* You can now type 'make' to create a command line binary.
* To get a version you can run from Finder, type 'make bundle' which
will create ScummVM.app (this only works if you installed SDL
- etc. via Fink and into \texttt{/sw}. If you have installed SDL
+ etc. via Fink and into /sw. If you have installed SDL
in another way, you'll have to edit the Makefile).
X.X Credits:
From fingolfin at users.sourceforge.net Fri Apr 9 08:24:10 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 08:24:10 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/backends/fs fs.h,1.17,1.18
Message-ID:
Update of /cvsroot/scummvm/scummvm/backends/fs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9458/backends/fs
Modified Files:
fs.h
Log Message:
Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
Index: fs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/fs.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- fs.h 28 Mar 2004 13:02:28 -0000 1.17
+++ fs.h 9 Apr 2004 15:10:22 -0000 1.18
@@ -55,7 +55,7 @@
* i.e. the root dir is usually not the best starting point for browsing.
*/
-#include "common/list.h"
+#include "common/array.h"
#include "common/str.h"
class FSList;
@@ -149,7 +149,7 @@
/**
* Sorted list of multiple file system nodes. E.g. the contents of a given directory.
*/
-class FSList : private Common::List {
+class FSList : private Common::Array {
public:
class const_iterator {
friend class FSList;
From fingolfin at users.sourceforge.net Fri Apr 9 08:24:12 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 08:24:12 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/base plugins.h,1.18,1.19
Message-ID:
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9458/base
Modified Files:
plugins.h
Log Message:
Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
Index: plugins.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- plugins.h 9 Apr 2004 12:36:06 -0000 1.18
+++ plugins.h 9 Apr 2004 15:10:22 -0000 1.19
@@ -23,7 +23,7 @@
#ifndef COMMON_PLUGINS_H
#define COMMON_PLUGINS_H
-#include "common/list.h"
+#include "common/array.h"
#include "common/singleton.h"
#include "common/util.h"
@@ -34,7 +34,7 @@
struct GameSettings;
/** List of games. */
-typedef Common::List GameList;
+typedef Common::Array GameList;
/**
* A detected game. Carries the GameSettings, but also (optionally)
@@ -51,7 +51,7 @@
};
/** List of detected games. */
-typedef Common::List DetectedGameList;
+typedef Common::Array DetectedGameList;
/**
@@ -100,7 +100,7 @@
/** List of plugins. */
-typedef Common::List PluginList;
+typedef Common::Array PluginList;
/**
From fingolfin at users.sourceforge.net Fri Apr 9 08:24:13 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 08:24:13 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/common array.h,NONE,1.1 list.h,1.13,1.14 config-manager.h,1.15,1.16 str.h,1.20,1.21
Message-ID:
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9458/common
Modified Files:
list.h config-manager.h str.h
Added Files:
array.h
Log Message:
Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
--- NEW FILE: array.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2002-2004 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/common/array.h,v 1.1 2004/04/09 15:10:21 fingolfin Exp $
*/
#ifndef COMMON_ARRAY_H
#define COMMON_ARRAY_H
#include "common/scummsys.h"
#include
namespace Common {
template
class Array {
protected:
int _capacity;
int _size;
T *_data;
public:
typedef T *iterator;
typedef const T *const_iterator;
public:
Array() : _capacity(0), _size(0), _data(0) {}
Array(const Array& array) : _capacity(0), _size(0), _data(0) {
_size = array._size;
_capacity = _size + 32;
_data = new T[_capacity];
for (int i = 0; i < _size; i++)
_data[i] = array._data[i];
}
~Array() {
if (_data)
delete [] _data;
}
void push_back(const T& element) {
ensureCapacity(_size + 1);
_data[_size++] = element;
}
void push_back(const Array& array) {
ensureCapacity(_size + array._size);
for (int i = 0; i < array._size; i++)
_data[_size++] = array._data[i];
}
void insert_at(int idx, const T& element) {
assert(idx >= 0 && idx <= _size);
ensureCapacity(_size + 1);
// The following loop is not efficient if you can just memcpy things around.
// e.g. if you have a list of ints. But for real objects (String...), memcpy
// usually isn't correct (specifically, for any class which has a non-default
// copy behaviour. E.g. the String class uses a refCounter which has to be
// updated whenever a String is copied.
for (int i = _size; i > idx; i--) {
_data[i] = _data[i-1];
}
_data[idx] = element;
_size++;
}
T& remove_at(int idx) {
T& tmp;
assert(idx >= 0 && idx < _size);
tmp = _data[idx];
for (int i = idx; i < _size - 1; i++)
_data[i] = _data[i+1];
_size--;
return tmp;
}
// TODO: insert, remove, ...
T& operator [](int idx) {
assert(idx >= 0 && idx < _size);
return _data[idx];
}
const T& operator [](int idx) const {
assert(idx >= 0 && idx < _size);
return _data[idx];
}
Array& operator =(const Array& array) {
if (_data)
delete [] _data;
_size = array._size;
_capacity = _size + 32;
_data = new T[_capacity];
for (int i = 0; i < _size; i++)
_data[i] = array._data[i];
return *this;
}
uint size() const {
return _size;
}
void clear() {
if (_data) {
delete [] _data;
_data = 0;
}
_size = 0;
_capacity = 0;
}
bool isEmpty() const {
return (_size == 0);
}
iterator begin() {
return _data;
}
iterator end() {
return _data + _size;
}
const_iterator begin() const {
return _data;
}
const_iterator end() const {
return _data + _size;
}
protected:
void ensureCapacity(int new_len) {
if (new_len <= _capacity)
return;
T *old_data = _data;
_capacity = new_len + 32;
_data = new T[_capacity];
if (old_data) {
// Copy old data
for (int i = 0; i < _size; i++)
_data[i] = old_data[i];
delete [] old_data;
}
}
};
} // End of namespace Common
#endif
Index: list.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/list.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- list.h 15 Mar 2004 02:45:40 -0000 1.13
+++ list.h 9 Apr 2004 15:10:22 -0000 1.14
@@ -26,25 +26,48 @@
namespace Common {
+/*
+TODO: Add a true list class, based on a linked list data structure
+
template
class List {
protected:
- int _capacity;
- int _size;
- T *_data;
+ template
+ class Node {
+ Node *_prev;
+ Node *_next;
+ T _data;
+ }
+
+ template
+ class Iterator {
+ friend class List;
+ private:
+ Node *_node;
+
+ public:
+ Node &operator++() {
+ _node = _node->_next;
+ }
+
+ T& operator*() const {
+ return _node->_data;
+ }
+ T* operator->() const {
+ return &(_node->_data);
+ }
+ };
+
+ Iterator *_anchor;
public:
- typedef T *iterator;
- typedef const T *const_iterator;
+ typedef Node *iterator;
+ typedef const Node *const_iterator;
public:
- List() : _capacity(0), _size(0), _data(0) {}
- List(const List& list) : _capacity(0), _size(0), _data(0) {
- _size = list._size;
- _capacity = _size + 32;
- _data = new T[_capacity];
- for (int i = 0; i < _size; i++)
- _data[i] = list._data[i];
+ List() : _anchor(...) {}
+ List(const List& list) : _anchor(...) {
+ ... copy list ...
}
~List() {
@@ -53,117 +76,75 @@
}
void push_back(const T& element) {
- ensureCapacity(_size + 1);
- _data[_size++] = element;
+ ...
}
void push_back(const List& list) {
- ensureCapacity(_size + list._size);
- for (int i = 0; i < list._size; i++)
- _data[_size++] = list._data[i];
+ ...
}
- void insert_at(int idx, const T& element) {
- assert(idx >= 0 && idx <= _size);
- ensureCapacity(_size + 1);
- // The following loop is not efficient if you can just memcpy things around.
- // e.g. if you have a list of ints. But for real objects (String...), memcpy
- // usually isn't correct (specifically, for any class which has a non-default
- // copy behaviour. E.g. the String class uses a refCounter which has to be
- // updated whenever a String is copied.
- for (int i = _size; i > idx; i--) {
- _data[i] = _data[i-1];
- }
- _data[idx] = element;
- _size++;
+ void insert(iterator pos, const T& element) {
+ ...
}
- T& remove_at(int idx) {
- T& tmp;
-
- assert(idx >= 0 && idx < _size);
- tmp = _data[idx];
- for (int i = idx; i < _size - 1; i++)
- _data[i] = _data[i+1];
- _size--;
- return tmp;
+ void insert(iterator pos, iterator beg, Iterator end) {
+ ...
}
- // TODO: insert, remove, ...
-
- T& operator [](int idx) {
- assert(idx >= 0 && idx < _size);
- return _data[idx];
+ void erase(iterator beg, Iterator end) {
+ ...
}
- const T& operator [](int idx) const {
- assert(idx >= 0 && idx < _size);
- return _data[idx];
+ void remove(const T &val) {
}
- List& operator =(const List& list) {
- if (_data)
- delete [] _data;
- _size = list._size;
- _capacity = _size + 32;
- _data = new T[_capacity];
- for (int i = 0; i < _size; i++)
- _data[i] = list._data[i];
- return *this;
+ List& operator =(const List& list) {
+ // Careful here: handle self-assignment properly! I.e. situations like
+ // List x;
+ // ...
+ // x = x;
+ // In particular, we can't just do this:
+ // clear();
+ // insert(_first, list.begin(), list.end());
+ ...
}
uint size() const {
- return _size;
+ int size = 0;
+ for (const_iterator i = begin(); i != end(); ++i)
+ size++;
+ return size;
}
void clear() {
- if (_data) {
- delete [] _data;
- _data = 0;
- }
- _size = 0;
- _capacity = 0;
+ erase(begin(), end());
}
bool isEmpty() const {
- return (_size == 0);
+ return (_anchor._node == _anchor._node._next);
}
iterator begin() {
- return _data;
+ Iterator iter = _anchor;
+ return ++iter;
}
iterator end() {
- return _data + _size;
+ return _anchor;
}
const_iterator begin() const {
- return _data;
+ Iterator iter = _anchor;
+ return ++iter;
}
const_iterator end() const {
- return _data + _size;
- }
-
-protected:
- void ensureCapacity(int new_len) {
- if (new_len <= _capacity)
- return;
-
- T *old_data = _data;
- _capacity = new_len + 32;
- _data = new T[_capacity];
-
- if (old_data) {
- // Copy old data
- for (int i = 0; i < _size; i++)
- _data[i] = old_data[i];
- delete [] old_data;
- }
+ return _anchor;
}
};
+*/
} // End of namespace Common
Index: config-manager.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- config-manager.h 29 Mar 2004 19:15:22 -0000 1.15
+++ config-manager.h 9 Apr 2004 15:10:22 -0000 1.16
@@ -23,7 +23,7 @@
#ifndef COMMON_CONFIG_H
#define COMMON_CONFIG_H
-#include "common/list.h"
+#include "common/array.h"
#include "common/map.h"
#include "common/singleton.h"
#include "common/str.h"
@@ -127,7 +127,7 @@
DomainMap _globalDomains;
Domain _defaultsDomain;
- List _searchOrder;
+ Array _searchOrder;
String _activeDomain;
String _filename;
Index: str.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/str.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- str.h 5 Feb 2004 00:19:54 -0000 1.20
+++ str.h 9 Apr 2004 15:10:22 -0000 1.21
@@ -22,7 +22,7 @@
#define COMMON_STRING_H
#include "common/scummsys.h"
-#include "common/list.h"
+#include "common/array.h"
#include
#include
@@ -126,7 +126,7 @@
bool operator == (const char *x, const ConstString &y);
bool operator != (const char *x, const ConstString &y);
-class StringList : public List {
+class StringList : public Array {
public:
void push_back(const char *str) {
ensureCapacity(_size + 1);
From fingolfin at users.sourceforge.net Fri Apr 9 08:24:15 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 08:24:15 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/backends/wince/CEkeys KeysBuffer.h,1.2,1.3
Message-ID:
Update of /cvsroot/scummvm/scummvm/backends/wince/CEkeys
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9458/backends/wince/CEkeys
Modified Files:
KeysBuffer.h
Log Message:
Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
Index: KeysBuffer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEkeys/KeysBuffer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- KeysBuffer.h 26 Jan 2004 20:32:29 -0000 1.2
+++ KeysBuffer.h 9 Apr 2004 15:10:22 -0000 1.3
@@ -25,7 +25,6 @@
#include "common/stdafx.h"
#include "common/scummsys.h"
#include "common/system.h"
-#include "common/list.h"
#include "Key.h"
From fingolfin at users.sourceforge.net Fri Apr 9 08:24:22 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 08:24:22 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/gui PopUpWidget.h,1.11,1.12 TabWidget.h,1.6,1.7
Message-ID:
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9458/gui
Modified Files:
PopUpWidget.h TabWidget.h
Log Message:
Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
Index: PopUpWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- PopUpWidget.h 13 Mar 2004 12:33:31 -0000 1.11
+++ PopUpWidget.h 9 Apr 2004 15:10:23 -0000 1.12
@@ -23,7 +23,7 @@
#include "gui/widget.h"
#include "common/str.h"
-#include "common/list.h"
+#include "common/array.h"
namespace GUI {
@@ -46,7 +46,7 @@
String name;
uint32 tag;
};
- typedef Common::List EntryList;
+ typedef Common::Array EntryList;
protected:
EntryList _entries;
int _selectedItem;
Index: TabWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/TabWidget.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TabWidget.h 6 Jan 2004 12:45:28 -0000 1.6
+++ TabWidget.h 9 Apr 2004 15:10:23 -0000 1.7
@@ -23,7 +23,7 @@
#include "widget.h"
#include "common/str.h"
-#include "common/list.h"
+#include "common/array.h"
namespace GUI {
@@ -33,7 +33,7 @@
String title;
Widget *firstWidget;
};
- typedef Common::List TabList;
+ typedef Common::Array TabList;
protected:
int _activeTab;
TabList _tabs;
From fingolfin at users.sourceforge.net Fri Apr 9 09:32:04 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 09:32:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm configure,1.88,1.89
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23756
Modified Files:
configure
Log Message:
Fix plugin building
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- configure 9 Apr 2004 12:36:05 -0000 1.88
+++ configure 9 Apr 2004 16:17:57 -0000 1.89
@@ -656,7 +656,7 @@
_mak_plugins=
if test "$_build_plugins" = yes ; then
case $_host_os in
- linux)
+ linux*)
_mak_plugins='
BUILD_PLUGINS := 1
CXXFLAGS += -DDYNAMIC_MODULES
@@ -667,7 +667,7 @@
LIBS += -ldl
'
;;
- darwin)
+ darwin*)
_mak_plugins='
BUILD_PLUGINS := 1
CXXFLAGS += -DDYNAMIC_MODULES
From aquadran at users.sourceforge.net Fri Apr 9 11:33:02 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Fri Apr 9 11:33:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.21,1.22
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15180
Modified Files:
scumm.cpp
Log Message:
refreshScripts only for full game dig, and cmi demo
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- scumm.cpp 9 Apr 2004 05:43:19 -0000 1.21
+++ scumm.cpp 9 Apr 2004 18:18:42 -0000 1.22
@@ -1577,7 +1577,9 @@
}
_sound->processSoundQues();
- if ((_imuseDigital) && (_gameId == GID_DIG))
+ if (_imuseDigital &&
+ ( ((_gameId == GID_DIG) && (!(_features & GF_DEMO))) ||
+ ((_gameId == GID_CMI) && (_features & GF_DEMO)) ) )
_imuseDigital->refreshScripts();
camera._last = camera._cur;
From aquadran at users.sourceforge.net Fri Apr 9 11:33:08 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Fri Apr 9 11:33:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_script.cpp,1.3,1.4
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15356
Modified Files:
dimuse_script.cpp
Log Message:
revert
Index: dimuse_script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dimuse_script.cpp 9 Apr 2004 05:43:24 -0000 1.3
+++ dimuse_script.cpp 9 Apr 2004 18:19:22 -0000 1.4
@@ -169,7 +169,7 @@
}
if ((!found) && (_curMusicSeq != 0)) {
- parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
+ parseScriptCmds(0x1001, 0, 0, 0, 0, 0, 0, 0);
}
}
From aquadran at users.sourceforge.net Fri Apr 9 11:45:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Fri Apr 9 11:45:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/dists/msvc7 kyra.vcproj,NONE,1.1 scummvm.sln,1.6,1.7 scummvm.vcproj,1.24,1.25
Message-ID:
Update of /cvsroot/scummvm/scummvm/dists/msvc7
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17598
Modified Files:
scummvm.sln scummvm.vcproj
Added Files:
kyra.vcproj
Log Message:
update
--- NEW FILE: kyra.vcproj ---
Index: scummvm.sln
===================================================================
RCS file: /cvsroot/scummvm/scummvm/dists/msvc7/scummvm.sln,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- scummvm.sln 22 Mar 2004 21:26:04 -0000 1.6
+++ scummvm.sln 9 Apr 2004 18:30:44 -0000 1.7
@@ -15,19 +15,22 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saga", "saga.vcproj", "{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kyra", "kyra.vcproj", "{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}"
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.0 = {6CC3E421-779D-4E80-8100-520886A0F9FF}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.1 = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.2 = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.3 = {B6AFD548-63D2-40CD-A652-E87095AFCBAF}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.4 = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.5 = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}
- {8434CB15-D08F-427D-9E6D-581AE5B28440}.6 = {C8AAE83E-198B-4ECA-A877-166827953979}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.0 = {C8AAE83E-198B-4ECA-A877-166827953979}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.1 = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.2 = {6CC3E421-779D-4E80-8100-520886A0F9FF}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.3 = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.4 = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.5 = {B6AFD548-63D2-40CD-A652-E87095AFCBAF}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.6 = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}
+ {8434CB15-D08F-427D-9E6D-581AE5B28440}.7 = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{8434CB15-D08F-427D-9E6D-581AE5B28440}.Debug.ActiveCfg = Debug|Win32
@@ -62,6 +65,10 @@
{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Debug.Build.0 = Debug|Win32
{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release.ActiveCfg = Release|Win32
{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release.Build.0 = Release|Win32
+ {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug.ActiveCfg = Debug|Win32
+ {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug.Build.0 = Debug|Win32
+ {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release.ActiveCfg = Release|Win32
+ {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Index: scummvm.vcproj
===================================================================
RCS file: /cvsroot/scummvm/scummvm/dists/msvc7/scummvm.vcproj,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- scummvm.vcproj 30 Mar 2004 07:10:15 -0000 1.24
+++ scummvm.vcproj 9 Apr 2004 18:30:44 -0000 1.25
@@ -39,7 +39,7 @@
Name="VCCustomBuildTool"/>
+
+
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24168
Modified Files:
scumm.cpp
Log Message:
it seems to be needed for comi too, hmm
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- scumm.cpp 9 Apr 2004 18:18:42 -0000 1.22
+++ scumm.cpp 9 Apr 2004 21:42:37 -0000 1.23
@@ -1577,9 +1577,8 @@
}
_sound->processSoundQues();
- if (_imuseDigital &&
- ( ((_gameId == GID_DIG) && (!(_features & GF_DEMO))) ||
- ((_gameId == GID_CMI) && (_features & GF_DEMO)) ) )
+ if (_imuseDigital &&
+ ( ((_gameId == GID_DIG) && (!(_features & GF_DEMO))) || (_gameId == GID_CMI) ))
_imuseDigital->refreshScripts();
camera._last = camera._cur;
From aquadran at users.sourceforge.net Fri Apr 9 14:59:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Fri Apr 9 14:59:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.62,1.63 dimuse_sndmgr.cpp,1.31,1.32 dimuse_sndmgr.h,1.22,1.23
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24594
Modified Files:
dimuse.cpp dimuse_sndmgr.cpp dimuse_sndmgr.h
Log Message:
fixed 'region' code
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- dimuse.cpp 9 Apr 2004 03:57:18 -0000 1.62
+++ dimuse.cpp 9 Apr 2004 21:44:29 -0000 1.63
@@ -222,7 +222,9 @@
return;
}
- int jumpId = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion);
+ int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, _track[track].curHookId);
+ if (jumpId == -1)
+ jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, 0);
if (jumpId != -1) {
int region = _sound->getRegionIdByJumpId(_track[track].soundHandle, jumpId);
assert(region != -1);
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- dimuse_sndmgr.cpp 9 Apr 2004 06:17:20 -0000 1.31
+++ dimuse_sndmgr.cpp 9 Apr 2004 21:44:29 -0000 1.32
@@ -404,12 +404,13 @@
return soundHandle->region[region].offset;
}
-int ImuseDigiSndMgr::getJumpIdByRegion(soundStruct *soundHandle, int region) {
+int ImuseDigiSndMgr::getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId) {
assert(soundHandle && checkForProperHandle(soundHandle));
assert(region >= 0 && region < soundHandle->numRegions);
for (int l = 0; l < soundHandle->numJumps; l++) {
if (soundHandle->jump[l].offset == soundHandle->region[region].offset) {
- return l;
+ if (soundHandle->jump[l].hookId == hookId)
+ return l;
}
}
Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- dimuse_sndmgr.h 8 Apr 2004 21:13:25 -0000 1.22
+++ dimuse_sndmgr.h 9 Apr 2004 21:44:29 -0000 1.23
@@ -115,7 +115,7 @@
int getNumRegions(soundStruct *soundHandle);
int getNumJumps(soundStruct *soundHandle);
int getRegionOffset(soundStruct *soundHandle, int region);
- int getJumpIdByRegion(soundStruct *soundHandle, int region);
+ int getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId);
int getRegionIdByJumpId(soundStruct *soundHandle, int jumpId);
int getJumpHookId(soundStruct *soundHandle, int number);
int getJumpFade(soundStruct *soundHandle, int number);
From fingolfin at users.sourceforge.net Fri Apr 9 17:23:11 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 17:23:11 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.323,1.324 sound.h,1.63,1.64
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16337
Modified Files:
sound.cpp sound.h
Log Message:
Cleanup Sound constructor; change search order of SFX files
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.323
retrieving revision 1.324
diff -u -d -r1.323 -r1.324
--- sound.cpp 3 Apr 2004 00:56:54 -0000 1.323
+++ sound.cpp 10 Apr 2004 00:07:58 -0000 1.324
@@ -50,13 +50,31 @@
};
-Sound::Sound(ScummEngine *parent) {
- memset(this,0,sizeof(Sound)); // palmos
+Sound::Sound(ScummEngine *parent)
+ :
+ _vm(parent),
+ _soundQuePos(0),
+ _soundQue2Pos(0),
+ _sfxFile(0),
+ _offsetTable(0),
+ _numSoundEffects(0),
+ _soundMode(kVOCMode),
+ _talk_sound_a1(0),
+ _talk_sound_a2(0),
+ _talk_sound_b1(0),
+ _talk_sound_b2(0),
+ _talk_sound_mode(0),
+ _talk_sound_frame(0),
+ _mouthSyncMode(false),
+ _endOfMouthSync(false),
+ _curSoundPos(0),
+ _currentCDSound(0),
+ _soundsPaused(false),
+ _sfxMode(0) {
- _vm = parent;
- _currentCDSound = 0;
-
- _sfxFile = 0;
+ memset(_soundQue, 0, sizeof(_soundQue));
+ memset(_soundQue2, 0, sizeof(_soundQue2));
+ memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
}
Sound::~Sound() {
@@ -553,11 +571,11 @@
num = (b - 8) >> 1;
}
- if (offset_table != NULL) {
+ if (_offsetTable != NULL) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
+ result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects,
sizeof(MP3OffsetTable), compareMP3OffsetTable);
if (result == NULL) {
@@ -834,25 +852,23 @@
AudioStream *input = NULL;
- if (file_size > 0) {
- switch (_sound_mode) {
- case kMP3Mode:
+ switch (_soundMode) {
+ case kMP3Mode:
#ifdef USE_MAD
- input = makeMP3Stream(file, file_size);
+ input = makeMP3Stream(file, file_size);
#endif
- break;
- case kVorbisMode:
+ break;
+ case kVorbisMode:
#ifdef USE_VORBIS
- input = makeVorbisStream(file, file_size);
+ input = makeVorbisStream(file, file_size);
#endif
- break;
- case kFlacMode:
+ break;
+ case kFlacMode:
#ifdef USE_FLAC
- input = makeFlacStream(file, file_size);
+ input = makeFlacStream(file, file_size);
#endif
- break;
- }
- } else {
+ break;
+ default:
input = makeVOCStream(_sfxFile);
}
@@ -872,43 +888,51 @@
File *Sound::openSfxFile() {
char buf[256];
File *file = new File();
-
- /* Try opening the file <_gameName>.sou first, eg tentacle.sou.
- * That way, you can keep .sou files for multiple games in the
- * same directory */
- offset_table = NULL;
-
+ _offsetTable = NULL;
+
+ struct SoundFileExtensions {
+ const char *ext;
+ SoundMode mode;
+ };
+
+ const SoundFileExtensions extensions[] = {
#ifdef USE_FLAC
- if (!file->isOpen()) {
- sprintf(buf, "%s.sof", _vm->getGameName());
- if (!file->open(buf))
- file->open("monster.sof");
- if (file->isOpen())
- _sound_mode = kFlacMode;
- }
+ { "sof", kFlacMode },
#endif
-
#ifdef USE_MAD
- if (!file->isOpen()) {
- sprintf(buf, "%s.so3", _vm->getGameName());
- if (!file->open(buf))
- file->open("monster.so3");
- if (file->isOpen())
- _sound_mode = kMP3Mode;
- }
+ { "so3", kMP3Mode },
#endif
-
#ifdef USE_VORBIS
- if (!file->isOpen()) {
- sprintf(buf, "%s.sog", _vm->getGameName());
- if (!file->open(buf))
- file->open("monster.sog");
- if (file->isOpen())
- _sound_mode = kVorbisMode;
- }
+ { "sog", kVorbisMode },
#endif
+ { "sou", kVOCMode },
+ { 0, kVOCMode }
+ };
- if (file->isOpen()) {
+ /* Try opening the file <_gameName>.sou first, eg tentacle.sou.
+ * That way, you can keep .sou files for multiple games in the
+ * same directory */
+
+ int i, j;
+ const char *basename[3] = { 0, 0, 0 };
+ basename[0] = _vm->getGameName();
+ basename[1] = "monster";
+
+ for (j = 0; basename[j] && !file->isOpen(); ++j) {
+ for (i = 0; extensions[i].ext; ++i) {
+ sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
+ if (file->open(buf)) {
+ _soundMode = extensions[i].mode;
+ break;
+ }
+ }
+ }
+
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.tlk", _vm->getGameName());
+ file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
+ _soundMode = kVOCMode;
+ } else if (_soundMode != kVOCMode) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -926,11 +950,11 @@
int size, compressed_offset;
MP3OffsetTable *cur;
compressed_offset = file->readUint32BE();
- offset_table = (MP3OffsetTable *) malloc(compressed_offset);
- num_sound_effects = compressed_offset / 16;
+ _offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
+ _numSoundEffects = compressed_offset / 16;
size = compressed_offset;
- cur = offset_table;
+ cur = _offsetTable;
while (size > 0) {
cur[0].org_offset = file->readUint32BE();
cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
@@ -939,18 +963,8 @@
size -= 4 * 4;
cur++;
}
- return file;
}
- sprintf(buf, "%s.sou", _vm->getGameName());
- if (!file->open(buf)) {
- file->open("monster.sou");
- }
-
- if (!file->isOpen()) {
- sprintf(buf, "%s.tlk", _vm->getGameName());
- file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
- }
return file;
}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- sound.h 22 Feb 2004 14:11:14 -0000 1.63
+++ sound.h 10 Apr 2004 00:07:58 -0000 1.64
@@ -38,10 +38,23 @@
class Sound {
protected:
+ enum SoundMode {
+ kVOCMode,
+ kMP3Mode,
+ kVorbisMode,
+ kFlacMode
+ };
+
+ ScummEngine *_vm;
+
int16 _soundQuePos, _soundQue[0x100];
int16 _soundQue2Pos, _soundQue2[10];
File *_sfxFile;
+ SoundMode _soundMode;
+ MP3OffsetTable *_offsetTable; // For compressed audio
+ int _numSoundEffects; // For compressed audio
+
uint32 _talk_sound_a1, _talk_sound_a2, _talk_sound_b1, _talk_sound_b2;
byte _talk_sound_mode;
int _talk_sound_frame;
@@ -50,14 +63,7 @@
uint16 _mouthSyncTimes[64];
uint _curSoundPos;
- MP3OffsetTable *offset_table; // SO3 MP3 compressed audio
- int num_sound_effects; // SO3 MP3 compressed audio
- enum { kMP3Mode, kVorbisMode, kFlacMode } _sound_mode;
-
int _currentCDSound;
-
- ScummEngine *_vm;
-
public:
PlayingSoundHandle _talkChannelHandle; // Handle of mixer channel actor is talking on
bool _soundsPaused;
From fingolfin at users.sourceforge.net Fri Apr 9 17:33:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 17:33:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.63,1.64 dimuse_sndmgr.cpp,1.32,1.33 dimuse_track.cpp,1.2,1.3
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18252/imuse_digi
Modified Files:
dimuse.cpp dimuse_sndmgr.cpp dimuse_track.cpp
Log Message:
cleanup
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- dimuse.cpp 9 Apr 2004 21:44:29 -0000 1.63
+++ dimuse.cpp 10 Apr 2004 00:17:42 -0000 1.64
@@ -82,7 +82,7 @@
if (_track[l].used) {
if (_track[l].stream2) {
if (!_track[l].handle.isActive() && _track[l].started) {
- debug(5, "IMuseDigital::callback(): stoped sound: %d", _track[l].soundId);
+ debug(5, "IMuseDigital::callback() A: stopped sound: %d", _track[l].soundId);
delete _track[l].stream2;
_track[l].stream2 = NULL;
_track[l].used = false;
@@ -90,7 +90,7 @@
}
} else if (_track[l].stream) {
if (_track[l].toBeRemoved) {
- debug(5, "IMuseDigital::callback(): stoped sound: %d", _track[l].soundId);
+ debug(5, "IMuseDigital::callback() B: stopped sound: %d", _track[l].soundId);
_track[l].stream->finish();
_track[l].stream = NULL;
_sound->closeSound(_track[l].soundHandle);
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- dimuse_sndmgr.cpp 9 Apr 2004 21:44:29 -0000 1.32
+++ dimuse_sndmgr.cpp 10 Apr 2004 00:17:42 -0000 1.33
@@ -341,22 +341,13 @@
void ImuseDigiSndMgr::closeSound(soundStruct *soundHandle) {
assert(soundHandle && checkForProperHandle(soundHandle));
- for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
- if (&_sounds[l] == soundHandle) {
- if (_sounds[l].bundle)
- delete _sounds[l].bundle;
- for (int r = 0; r < _sounds[l].numSyncs; r++)
- if (_sounds[l].sync[r].ptr)
- free(_sounds[l].sync[r].ptr);
- if (_sounds[l].region)
- free(_sounds[l].region);
- if (_sounds[l].jump)
- free(_sounds[l].jump);
- if (_sounds[l].sync)
- free(_sounds[l].sync);
- memset(&_sounds[l], 0, sizeof(soundStruct));
- }
- }
+ delete soundHandle->bundle;
+ for (int r = 0; r < soundHandle->numSyncs; r++)
+ free(soundHandle->sync[r].ptr);
+ free(soundHandle->region);
+ free(soundHandle->jump);
+ free(soundHandle->sync);
+ memset(soundHandle, 0, sizeof(soundStruct));
}
bool ImuseDigiSndMgr::checkForProperHandle(soundStruct *soundHandle) {
Index: dimuse_track.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dimuse_track.cpp 9 Apr 2004 06:17:20 -0000 1.2
+++ dimuse_track.cpp 10 Apr 2004 00:17:42 -0000 1.3
@@ -165,8 +165,7 @@
}
}
- warning("it should not happen");
- assert(0);
+ error("IMuseDigital::startSound(): We should never get here");
}
void IMuseDigital::setPriority(int soundId, int priority) {
From fingolfin at users.sourceforge.net Fri Apr 9 17:51:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 17:51:02 2004
Subject: [Scummvm-cvs-logs] CVS: tools extract-common.c,1.7,1.8 extract.c,1.38,1.39 extract.h,1.10,1.11 simon2mp3.c,1.32,1.33
Message-ID:
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21261
Modified Files:
extract-common.c extract.c extract.h simon2mp3.c
Log Message:
A little cleanup - this code could stand more (copying a file byte-for-byte? Uh-oh)
Index: extract-common.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract-common.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- extract-common.c 28 Mar 2004 16:37:15 -0000 1.7
+++ extract-common.c 10 Apr 2004 00:37:21 -0000 1.8
@@ -51,14 +51,10 @@
int numArgs;
} flaccparams;
-FILE *input, *output_idx, *output_snd;
-
lameparams encparms = { minBitrDef, maxBitrDef, false, algqualDef, vbrqualDef, 0 };
oggencparams oggparms = { -1, -1, -1, oggqualDef, 0 };
flaccparams flacparms;
-CompressMode gCompMode = kMP3Mode;
-
const char *tempEncoded = TEMP_MP3;
@@ -150,7 +146,7 @@
}
}
-void get_wav(void) {
+void get_wav(FILE *input, CompressMode compMode) {
int length;
FILE *f;
char fbuf[2048];
@@ -173,10 +169,10 @@
fclose(f);
/* Convert the WAV temp file to OGG/MP3 */
- encodeAudio(TEMP_WAV, false, -1, tempEncoded, gCompMode);
+ encodeAudio(TEMP_WAV, false, -1, tempEncoded, compMode);
}
-void get_voc(void) {
+void get_voc(FILE *input, CompressMode compMode) {
int blocktype;
blocktype = fgetc(input);
@@ -225,7 +221,7 @@
fclose(f);
/* Convert the raw temp file to OGG/MP3 */
- encodeAudio(TEMP_RAW, true, real_samplerate, tempEncoded, gCompMode);
+ encodeAudio(TEMP_RAW, true, real_samplerate, tempEncoded, compMode);
break;
}
Index: extract.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- extract.c 22 Feb 2004 12:54:27 -0000 1.38
+++ extract.c 10 Apr 2004 00:37:21 -0000 1.39
@@ -22,28 +22,22 @@
#include "extract.h"
-char f_hdr[] = {
+static const char f_hdr[] = {
'S', 'O', 'U', ' ', 0, 0, 0, 0, 0
};
-byte v_hdr[] = {
- 'V', 'C', 'T', 'L', 0, 0, 0, 0xA, 0xF, 0xFF
-};
-
-char c_hdr[] = {
- 'C', 'r', 'e', 'a', 't', 'i', 'v', 'e', ' ', 'V', 'o', 'i', 'c', 'e',
- ' ', 'F', 'i', 'l', 'e', 0x1a, 0x1a, 0x00, 0x0A, 0x01, 0x29, 0x11
-};
-
#define OUTPUT_MP3 "monster.so3"
#define OUTPUT_OGG "monster.sog"
#define OUTPUT_FLAC "monster.sof"
-const char *outputName = OUTPUT_MP3;
+static const char *outputName = OUTPUT_MP3;
#define TEMP_DAT "tempfile.dat"
#define TEMP_IDX "tempfile.idx"
+static FILE *input, *output_idx, *output_snd;
+
+static CompressMode gCompMode = kMP3Mode;
void end_of_file(void)
@@ -135,7 +129,7 @@
printf("Voice file found (pos = %d) :", pos);
/* Conver the VOC data */
- get_voc();
+ get_voc(input, gCompMode);
/* Append the converted data to the master output file */
sprintf(outname, tempEncoded);
Index: extract.h
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- extract.h 22 Feb 2004 12:54:27 -0000 1.10
+++ extract.h 10 Apr 2004 00:37:21 -0000 1.11
@@ -45,19 +45,15 @@
/*
* Stuff which is in extract-common.c
*/
-extern FILE *input, *output_idx, *output_snd;
const extern char *tempEncoded;
-extern CompressMode gCompMode;
-
-
extern void process_mp3_parms(int argc, char *argv[], int i);
extern void process_ogg_parms(int argc, char *argv[], int i);
extern void process_flac_parms(int argc, char *argv[], int i);
-extern void get_voc(void);
-extern void get_wav(void);
+extern void get_voc(FILE *input, CompressMode compMode);
+extern void get_wav(FILE *input, CompressMode compMode);
/*
Index: simon2mp3.c
===================================================================
RCS file: /cvsroot/scummvm/tools/simon2mp3.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- simon2mp3.c 28 Mar 2004 21:11:15 -0000 1.32
+++ simon2mp3.c 10 Apr 2004 00:37:21 -0000 1.33
@@ -21,6 +21,10 @@
#include "extract.h"
+static FILE *input, *output_idx, *output_snd;
+
+static CompressMode gCompMode = kMP3Mode;
+
static char infile_base[256];
static void end(void)
@@ -121,10 +125,10 @@
if (!memcmp(buf, "Creative", 8)) {
printf("VOC found (pos = %d) :\n", offset);
fseek(input, 18, SEEK_CUR);
- get_voc();
+ get_voc(input, gCompMode);
} else if (!memcmp(buf, "RIFF", 4)) {
printf("WAV found (pos = %d) :\n", offset);
- get_wav();
+ get_wav(input, gCompMode);
} else {
error("Unexpected data at offset: %i", offset);
}
From fingolfin at users.sourceforge.net Fri Apr 9 18:05:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 18:05:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.324,1.325
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23350
Modified Files:
sound.cpp
Log Message:
cleanup
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- sound.cpp 10 Apr 2004 00:07:58 -0000 1.324
+++ sound.cpp 10 Apr 2004 00:51:12 -0000 1.325
@@ -852,19 +852,24 @@
AudioStream *input = NULL;
+ printf("startSfxSound: file_size = %d\n", file_size);
+
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
+ assert(file_size > 0);
input = makeMP3Stream(file, file_size);
#endif
break;
case kVorbisMode:
#ifdef USE_VORBIS
+ assert(file_size > 0);
input = makeVorbisStream(file, file_size);
#endif
break;
case kFlacMode:
#ifdef USE_FLAC
+ assert(file_size > 0);
input = makeFlacStream(file, file_size);
#endif
break;
@@ -956,10 +961,10 @@
size = compressed_offset;
cur = _offsetTable;
while (size > 0) {
- cur[0].org_offset = file->readUint32BE();
- cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur[0].num_tags = file->readUint32BE();
- cur[0].compressed_size = file->readUint32BE();
+ cur->org_offset = file->readUint32BE();
+ cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur->num_tags = file->readUint32BE();
+ cur->compressed_size = file->readUint32BE();
size -= 4 * 4;
cur++;
}
From fingolfin at users.sourceforge.net Fri Apr 9 18:59:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 18:59:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.325,1.326
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32213
Modified Files:
sound.cpp
Log Message:
oops
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -d -r1.325 -r1.326
--- sound.cpp 10 Apr 2004 00:51:12 -0000 1.325
+++ sound.cpp 10 Apr 2004 01:45:00 -0000 1.326
@@ -852,8 +852,6 @@
AudioStream *input = NULL;
- printf("startSfxSound: file_size = %d\n", file_size);
-
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
From fingolfin at users.sourceforge.net Fri Apr 9 19:01:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 19:01:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.14,1.15 voc.h,1.11,1.12
Message-ID:
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32678
Modified Files:
voc.cpp voc.h
Log Message:
Fix for bug #885490 (FT: Ben stops talking mid-scentence @ the gorge) -> this only works for monster.sou files; compressed audio is incomplete, and we have to fix the extract tool to correct that
Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- voc.cpp 14 Feb 2004 15:14:30 -0000 1.14
+++ voc.cpp 10 Apr 2004 01:46:38 -0000 1.15
@@ -70,7 +70,7 @@
int packing = ptr[offset++];
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
- debug(9, "VOC Data Bloc : %d, %d, %d", rate, packing, len);
+ debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
if (packing == 0) {
if (size) {
ret_sound = (byte *)realloc(ret_sound, size + len);
@@ -98,62 +98,78 @@
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
offset += len;
}
- debug(9, "VOC Data Size : %d", size);
+ debug(4, "VOC Data Size : %d", size);
return ret_sound;
}
-enum {
- SOUND_HEADER_SIZE = 26
-};
-
// FIXME/TODO: loadVOCFile() essentially duplicates all the code from
-// readCreativeVoc(). Obviously this is bad, it should rather use that function
-// (after some tweaks to readCreativeVoc, to deal with the alternate VTLK
-// header).
+// readCreativeVoc(). Obviously this is bad, they should share as much
+// code as possible. One way to do that would be to abstract the
+// reading from memory / from file into a stream class (similar to the
+// RWOps of SDL, for example).
byte *loadVOCFile(File *file, int &size, int &rate) {
- char ident[8];
+ VocFileHeader fileHeader;
- if (file->read(ident, 8) != 8)
+ if (file->read(&fileHeader, 8) != 8)
goto invalid;
- if (!memcmp(ident, "VTLK", 4)) {
- file->seek(SOUND_HEADER_SIZE, SEEK_CUR);
- } else if (!memcmp(ident, "Creative", 8)) {
- file->seek(SOUND_HEADER_SIZE - 8, SEEK_CUR);
+ if (!memcmp(&fileHeader, "VTLK", 4)) {
+ if (file->read(&fileHeader, sizeof(VocFileHeader)) != sizeof(VocFileHeader))
+ goto invalid;
+ } else if (!memcmp(&fileHeader, "Creative", 8)) {
+ if (file->read(((byte *)&fileHeader) + 8, sizeof(VocFileHeader) - 8) != sizeof(VocFileHeader) - 8)
+ goto invalid;
} else {
invalid:;
warning("loadVOCFile: invalid header");
return NULL;
}
- VocBlockHeader voc_block_hdr;
-
- file->read(&voc_block_hdr, sizeof(voc_block_hdr));
- if (voc_block_hdr.blocktype != 1) {
- warning("loadVOCFile: Expecting block_type == 1, got %d", voc_block_hdr.blocktype);
- return NULL;
- }
-
- size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2;
- rate = getSampleRateFromVOCRate(voc_block_hdr.sr);
- int comp = voc_block_hdr.pack;
-
- if (comp != 0) {
- warning("loadVOCFile: Unsupported compression type %d", comp);
- return NULL;
- }
+ assert(memcmp(&fileHeader, "Creative Voice File\x1A", 20) == 0);
+ //int32 offset = FROM_LE_16(fileHeader.datablock_offset);
+ int16 version = FROM_LE_16(fileHeader.version);
+ int16 code = FROM_LE_16(fileHeader.id);
+ assert(version == 0x010A || version == 0x0114);
+ assert(code == ~version + 0x1234);
- byte *data = (byte *)malloc(size);
- if (data == NULL) {
- error("loadVOCFile: out of memory");
- }
+ bool quit = false;
+ byte *ret_sound = 0;
+ size = 0;
- if ((int)file->read(data, size) != size) {
- /* no need to free the memory since error will shut down */
- error("loadVOCFile: cannot read %d bytes", size);
+ while (!quit) {
+ int len = file->readUint32LE();
+ code = len & 0xFF;
+ len >>= 8;
+ switch(code) {
+ case 0:
+ quit = true;
+ break;
+ case 1: {
+ int time_constant = file->readByte();
+ int packing = file->readByte();
+ len -= 2;
+ rate = getSampleRateFromVOCRate(time_constant);
+ debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
+ if (packing == 0) {
+ if (size) {
+ ret_sound = (byte *)realloc(ret_sound, size + len);
+ } else {
+ ret_sound = (byte *)malloc(len);
+ }
+ file->read(ret_sound + size, len);
+ size += len;
+ } else {
+ warning("VOC file packing %d unsupported", packing);
+ }
+ } break;
+ default:
+ warning("Invalid code in VOC file : %d", code);
+ quit = true;
+ break;
+ }
}
-
- return data;
+ debug(4, "VOC Data Size : %d", size);
+ return ret_sound;
}
AudioStream *makeVOCStream(byte *ptr) {
Index: voc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- voc.h 14 Feb 2004 15:14:30 -0000 1.11
+++ voc.h 10 Apr 2004 01:46:38 -0000 1.12
@@ -33,7 +33,7 @@
#pragma START_PACK_STRUCTS
#endif
-struct VocHeader {
+struct VocFileHeader {
uint8 desc[20];
uint16 datablock_offset;
uint16 version;
From fingolfin at users.sourceforge.net Fri Apr 9 19:01:07 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Fri Apr 9 19:01:07 2004
Subject: [Scummvm-cvs-logs] CVS: tools extract-common.c,1.8,1.9
Message-ID:
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv418
Modified Files:
extract-common.c
Log Message:
Added comment regarding bug #885490
Index: extract-common.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract-common.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- extract-common.c 10 Apr 2004 00:37:21 -0000 1.8
+++ extract-common.c 10 Apr 2004 01:47:13 -0000 1.9
@@ -175,6 +175,12 @@
void get_voc(FILE *input, CompressMode compMode) {
int blocktype;
+// FIXME HIGH PRIORITY: We aren't handling all types of blocks, and what is
+// worse, we aren't handling multiple blocks occuring in a single VOC file.
+// This is bad, because multiple type 1 blocks occur in Full Throttle.
+// As a result of this lacking feature, we generates compressed audio files
+// which are missing some data. Ouch! See also bug #885490
+
blocktype = fgetc(input);
switch (blocktype) {
case 0x01:{
From aquadran at users.sourceforge.net Sat Apr 10 02:32:00 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sat Apr 10 02:32:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush codec37.cpp,1.26,1.27 smush_player.cpp,1.116,1.117 smush_player.h,1.26,1.27
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28957
Modified Files:
codec37.cpp smush_player.cpp smush_player.h
Log Message:
special case for 384x242 smush resolution for ft pc demo, it use additional buffer
Index: codec37.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec37.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- codec37.cpp 6 Jan 2004 12:45:31 -0000 1.26
+++ codec37.cpp 10 Apr 2004 09:17:34 -0000 1.27
@@ -464,7 +464,7 @@
memcpy(_deltaBufs[_curtable], src + 16, decoded_size);
break;
case 1:
- error("codec37: missing opcode 1");
+ warning("codec37: missing opcode 1");
break;
case 2:
bompDecodeLine(_deltaBufs[_curtable], src + 16, decoded_size);
Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- smush_player.cpp 2 Apr 2004 22:01:25 -0000 1.116
+++ smush_player.cpp 10 Apr 2004 09:17:35 -0000 1.117
@@ -224,7 +224,8 @@
_sf[4] = NULL;
_base = NULL;
_frameBuffer = NULL;
-
+ _specialBuffer = NULL;
+
_skipNext = false;
_subtitles = ConfMan.getBool("subtitles");
_dst = NULL;
@@ -283,6 +284,10 @@
delete _base;
_base = NULL;
}
+ if (_specialBuffer) {
+ free(_specialBuffer);
+ _specialBuffer = NULL;
+ }
_vm->_mixer->stopHandle(_IACTchannel);
@@ -676,18 +681,19 @@
}
int codec = b.getWord();
- int left = b.getWord(); // left
- int top = b.getWord(); // top
+ int left = b.getWord();
+ int top = b.getWord();
int width = b.getWord();
int height = b.getWord();
- if ((height > _vm->_screenHeight) || (width > _vm->_screenWidth))
+ if ((height == 242) && (width == 384)) {
+ _dst = _specialBuffer = (byte *)malloc(242 * 384);
+ } else if ((height > _vm->_screenHeight) || (width > _vm->_screenWidth))
return;
-
// FT Insane uses smaller frames to draw overlays with moving objects
// Other .san files do have them as well but their purpose in unknown
// and often it causes memory overdraw. So just skip those frames
- if (!_insanity && ((height != _vm->_screenHeight) || (width != _vm->_screenWidth)))
+ else if (!_insanity && ((height != _vm->_screenHeight) || (width != _vm->_screenWidth)))
return;
if (!_alreadyInit) {
@@ -696,8 +702,8 @@
_alreadyInit = true;
}
- _width = _vm->_screenWidth;
- _height = _vm->_screenHeight;
+ _width = width;
+ _height = height;
b.getWord();
b.getWord();
Index: smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- smush_player.h 9 Feb 2004 18:57:05 -0000 1.26
+++ smush_player.h 10 Apr 2004 09:17:36 -0000 1.27
@@ -49,6 +49,7 @@
Codec47Decoder _codec47;
FileChunk *_base;
byte *_frameBuffer;
+ byte *_specialBuffer;
bool _skipNext;
bool _subtitles;
From fingolfin at users.sourceforge.net Sat Apr 10 11:29:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 10 11:29:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.107.2.2,1.107.2.3 base-costume.h,1.18,1.18.2.1 costume.cpp,1.126,1.126.2.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21839
Modified Files:
Tag: branch-0-6-0
akos.cpp base-costume.h costume.cpp
Log Message:
backport 64 bit fix to 0.6.0 branch
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.107.2.2
retrieving revision 1.107.2.3
diff -u -d -r1.107.2.2 -r1.107.2.3
--- akos.cpp 19 Feb 2004 10:01:02 -0000 1.107.2.2
+++ akos.cpp 10 Apr 2004 18:14:56 -0000 1.107.2.3
@@ -347,7 +347,8 @@
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
bool skip_column = false;
@@ -376,14 +377,14 @@
do {
if (*scaleytab++ < _scaleY) {
if (_actorHitMode) {
- if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+ if (color && y == _actorHitY && v1.x == _actorHitX) {
_actorHitResult = true;
return;
}
} else {
- masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
- if (color && y < _outheight && !masked && !skip_column) {
+ if (color && !masked && !skip_column) {
pcolor = palette[color];
if (_shadow_mode == 1) {
if (pcolor == 13)
@@ -413,7 +414,7 @@
if (v1.scaletable[v1.scaleXindex] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -548,7 +549,6 @@
v1.scaletable = defaultScaleTable;
- // FIXME - which value for VAR_CUSTOMSCALETABLE in V8 ?
if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->isGlobInMemory(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE);
}
@@ -614,7 +614,7 @@
j = startScaleIndexX;
for (i = 0, skip = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
startScaleIndexX = j;
skip++;
}
@@ -679,10 +679,10 @@
} else
_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -725,10 +725,16 @@
if (v1.skip_width <= 0 || _height <= 0)
return 0;
- if ((uint) rect.top > _outheight)
+ if (rect.left < 0)
+ rect.left = 0;
+
+ if (rect.top < 0)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.top > _outheight)
+ rect.top = _outheight;
+
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -d -r1.18 -r1.18.2.1
--- base-costume.h 12 Jan 2004 14:09:39 -0000 1.18
+++ base-costume.h 10 Apr 2004 18:14:56 -0000 1.18.2.1
@@ -69,7 +69,7 @@
// Destination
byte *_outptr;
- uint _outwidth, _outheight;
+ int _outwidth, _outheight;
int32 _numStrips;
// Source pointer
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.126
retrieving revision 1.126.2.1
diff -u -d -r1.126 -r1.126.2.1
--- costume.cpp 8 Jan 2004 03:10:16 -0000 1.126
+++ costume.cpp 10 Apr 2004 18:14:56 -0000 1.126.2.1
@@ -148,7 +148,7 @@
rect.right = rect.left = v1.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
skip++;
startScaleIndexX = _scaleIndexX;
}
@@ -200,15 +200,15 @@
v1.scaleXstep = _mirror ? 1 : -1;
if (_vm->_version == 1)
- //HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left
+ //HACK: it fix gfx glitches left by actor costume in V1 games, when actor moving to left
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID);
else
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -254,10 +254,13 @@
if (rect.left < 0)
rect.left = 0;
- if ((uint) rect.top > _outheight)
+ if (rect.top < 0)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.top > _outheight)
+ rect.top = _outheight;
+
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
@@ -352,7 +355,8 @@
const byte *mask, *src;
byte *dst;
byte len;
- uint y, height;
+ int y;
+ uint height;
byte color, pcolor;
bool rep;
@@ -393,7 +397,7 @@
if (!rep)
color = *src++;
- if (y < _outheight) {
+ if (0 <= y && y < _outheight) {
if (!_mirror) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
@@ -409,7 +413,7 @@
height = _height;
y = v1.y;
v1.x += 8 * v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
mask = v1.mask_ptr;
v1.destptr += 8 * v1.scaleXstep;
@@ -426,7 +430,8 @@
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
@@ -453,9 +458,9 @@
do {
if (_scaleY == 255 || *scaleytab++ < _scaleY) {
- masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
- if (color && y < _outheight && !masked) {
+ if (color && !masked) {
// FIXME: Fully implement _shadow_mode.
// For now, it's enough for Sam & Max
// transparency.
@@ -482,7 +487,7 @@
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -501,7 +506,7 @@
byte *dst;
byte maskbit, len, height, width;
int color;
- uint y;
+ int y;
bool masked;
int oldXpos, oldScaleIndexX;
@@ -523,9 +528,9 @@
len = *src++;
do {
if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
- masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
- if (color && v1.x >= 0 && v1.x < (int)_outwidth && !masked) {
+ if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
*dst = _palette[color];
}
From fingolfin at users.sourceforge.net Sat Apr 10 14:23:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 10 14:23:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.13.2.1,1.13.2.2 voc.h,1.10.2.1,1.10.2.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20596
Modified Files:
Tag: branch-0-6-0
voc.cpp voc.h
Log Message:
Backported VOC loading fix to 0.6.0 branch
Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -d -r1.13.2.1 -r1.13.2.2
--- voc.cpp 15 Feb 2004 06:30:48 -0000 1.13.2.1
+++ voc.cpp 10 Apr 2004 21:08:46 -0000 1.13.2.2
@@ -70,7 +70,7 @@
int packing = ptr[offset++];
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
- debug(9, "VOC Data Bloc : %d, %d, %d", rate, packing, len);
+ debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
if (packing == 0) {
if (size) {
ret_sound = (byte *)realloc(ret_sound, size + len);
@@ -98,62 +98,78 @@
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
offset += len;
}
- debug(9, "VOC Data Size : %d", size);
+ debug(4, "VOC Data Size : %d", size);
return ret_sound;
}
-enum {
- SOUND_HEADER_SIZE = 26
-};
-
// FIXME/TODO: loadVOCFile() essentially duplicates all the code from
-// readCreativeVoc(). Obviously this is bad, it should rather use that function
-// (after some tweaks to readCreativeVoc, to deal with the alternate VTLK
-// header).
+// readCreativeVoc(). Obviously this is bad, they should share as much
+// code as possible. One way to do that would be to abstract the
+// reading from memory / from file into a stream class (similar to the
+// RWOps of SDL, for example).
byte *loadVOCFile(File *file, int &size, int &rate) {
- char ident[8];
+ VocFileHeader fileHeader;
- if (file->read(ident, 8) != 8)
+ if (file->read(&fileHeader, 8) != 8)
goto invalid;
- if (!memcmp(ident, "VTLK", 4)) {
- file->seek(SOUND_HEADER_SIZE, SEEK_CUR);
- } else if (!memcmp(ident, "Creative", 8)) {
- file->seek(SOUND_HEADER_SIZE - 8, SEEK_CUR);
+ if (!memcmp(&fileHeader, "VTLK", 4)) {
+ if (file->read(&fileHeader, sizeof(VocFileHeader)) != sizeof(VocFileHeader))
+ goto invalid;
+ } else if (!memcmp(&fileHeader, "Creative", 8)) {
+ if (file->read(((byte *)&fileHeader) + 8, sizeof(VocFileHeader) - 8) != sizeof(VocFileHeader) - 8)
+ goto invalid;
} else {
invalid:;
warning("loadVOCFile: invalid header");
return NULL;
}
- VocBlockHeader voc_block_hdr;
-
- file->read(&voc_block_hdr, sizeof(voc_block_hdr));
- if (voc_block_hdr.blocktype != 1) {
- warning("loadVOCFile: Expecting block_type == 1, got %d", voc_block_hdr.blocktype);
- return NULL;
- }
-
- size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2;
- rate = getSampleRateFromVOCRate(voc_block_hdr.sr);
- int comp = voc_block_hdr.pack;
-
- if (comp != 0) {
- warning("loadVOCFile: Unsupported compression type %d", comp);
- return NULL;
- }
+ assert(memcmp(&fileHeader, "Creative Voice File\x1A", 20) == 0);
+ //int32 offset = FROM_LE_16(fileHeader.datablock_offset);
+ int16 version = FROM_LE_16(fileHeader.version);
+ int16 code = FROM_LE_16(fileHeader.id);
+ assert(version == 0x010A || version == 0x0114);
+ assert(code == ~version + 0x1234);
- byte *data = (byte *)malloc(size);
- if (data == NULL) {
- error("loadVOCFile: out of memory");
- }
+ bool quit = false;
+ byte *ret_sound = 0;
+ size = 0;
- if ((int)file->read(data, size) != size) {
- /* no need to free the memory since error will shut down */
- error("loadVOCFile: cannot read %d bytes", size);
+ while (!quit) {
+ int len = file->readUint32LE();
+ code = len & 0xFF;
+ len >>= 8;
+ switch(code) {
+ case 0:
+ quit = true;
+ break;
+ case 1: {
+ int time_constant = file->readByte();
+ int packing = file->readByte();
+ len -= 2;
+ rate = getSampleRateFromVOCRate(time_constant);
+ debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
+ if (packing == 0) {
+ if (size) {
+ ret_sound = (byte *)realloc(ret_sound, size + len);
+ } else {
+ ret_sound = (byte *)malloc(len);
+ }
+ file->read(ret_sound + size, len);
+ size += len;
+ } else {
+ warning("VOC file packing %d unsupported", packing);
+ }
+ } break;
+ default:
+ warning("Invalid code in VOC file : %d", code);
+ quit = true;
+ break;
+ }
}
-
- return data;
+ debug(4, "VOC Data Size : %d", size);
+ return ret_sound;
}
AudioStream *makeVOCStream(byte *ptr) {
Index: voc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.h,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- voc.h 15 Feb 2004 06:30:48 -0000 1.10.2.1
+++ voc.h 10 Apr 2004 21:08:46 -0000 1.10.2.2
@@ -33,7 +33,7 @@
#pragma START_PACK_STRUCTS
#endif
-struct VocHeader {
+struct VocFileHeader {
uint8 desc[20];
uint16 datablock_offset;
uint16 version;
From fingolfin at users.sourceforge.net Sat Apr 10 14:35:03 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 10 14:35:03 2004
Subject: [Scummvm-cvs-logs] CVS: tools extract-common.c,1.9,1.10 extract.c,1.39,1.40 extract.h,1.11,1.12 simon2mp3.c,1.33,1.34
Message-ID:
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22591
Modified Files:
extract-common.c extract.c extract.h simon2mp3.c
Log Message:
cleanup
Index: extract-common.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract-common.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- extract-common.c 10 Apr 2004 01:47:13 -0000 1.9
+++ extract-common.c 10 Apr 2004 21:20:56 -0000 1.10
@@ -146,7 +146,7 @@
}
}
-void get_wav(FILE *input, CompressMode compMode) {
+void extractAndEncodeWAV(const char *outName, FILE *input, CompressMode compMode) {
int length;
FILE *f;
char fbuf[2048];
@@ -158,7 +158,7 @@
fseek(input, -8, SEEK_CUR);
/* Copy the WAV data to a temporary file */
- f = fopen(TEMP_WAV, "wb");
+ f = fopen(outName, "wb");
while (length > 0) {
size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : length, input);
if (size <= 0)
@@ -169,17 +169,18 @@
fclose(f);
/* Convert the WAV temp file to OGG/MP3 */
- encodeAudio(TEMP_WAV, false, -1, tempEncoded, compMode);
+ encodeAudio(outName, false, -1, tempEncoded, compMode);
}
-void get_voc(FILE *input, CompressMode compMode) {
+void extractAndEncodeVOC(const char *outName, FILE *input, CompressMode compMode) {
int blocktype;
-// FIXME HIGH PRIORITY: We aren't handling all types of blocks, and what is
-// worse, we aren't handling multiple blocks occuring in a single VOC file.
-// This is bad, because multiple type 1 blocks occur in Full Throttle.
-// As a result of this lacking feature, we generates compressed audio files
-// which are missing some data. Ouch! See also bug #885490
+/* FIXME HIGH PRIORITY: We aren't handling all types of blocks, and what is
+ worse, we aren't handling multiple blocks occuring in a single VOC file.
+ This is bad, because multiple type 1 blocks occur in Full Throttle.
+ As a result of this lacking feature, we generates compressed audio files
+ which are missing some data. Ouch! See also bug #885490
+ */
blocktype = fgetc(input);
switch (blocktype) {
@@ -216,7 +217,7 @@
error("Cannot handle compressed VOC data");
/* Copy the raw data to a temporary file */
- f = fopen(TEMP_RAW, "wb");
+ f = fopen(outName, "wb");
while (length > 0) {
size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : (uint32)length, input);
if (size <= 0)
@@ -227,7 +228,7 @@
fclose(f);
/* Convert the raw temp file to OGG/MP3 */
- encodeAudio(TEMP_RAW, true, real_samplerate, tempEncoded, compMode);
+ encodeAudio(outName, true, real_samplerate, tempEncoded, compMode);
break;
}
Index: extract.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- extract.c 10 Apr 2004 00:37:21 -0000 1.39
+++ extract.c 10 Apr 2004 21:20:57 -0000 1.40
@@ -129,7 +129,7 @@
printf("Voice file found (pos = %d) :", pos);
/* Conver the VOC data */
- get_voc(input, gCompMode);
+ extractAndEncodeVOC(TEMP_RAW, input, gCompMode);
/* Append the converted data to the master output file */
sprintf(outname, tempEncoded);
Index: extract.h
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- extract.h 10 Apr 2004 00:37:21 -0000 1.11
+++ extract.h 10 Apr 2004 21:20:57 -0000 1.12
@@ -52,8 +52,8 @@
extern void process_ogg_parms(int argc, char *argv[], int i);
extern void process_flac_parms(int argc, char *argv[], int i);
-extern void get_voc(FILE *input, CompressMode compMode);
-extern void get_wav(FILE *input, CompressMode compMode);
+extern void extractAndEncodeVOC(const char *outName, FILE *input, CompressMode compMode);
+extern void extractAndEncodeWAV(const char *outName, FILE *input, CompressMode compMode);
/*
Index: simon2mp3.c
===================================================================
RCS file: /cvsroot/scummvm/tools/simon2mp3.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- simon2mp3.c 10 Apr 2004 00:37:21 -0000 1.33
+++ simon2mp3.c 10 Apr 2004 21:20:57 -0000 1.34
@@ -125,10 +125,10 @@
if (!memcmp(buf, "Creative", 8)) {
printf("VOC found (pos = %d) :\n", offset);
fseek(input, 18, SEEK_CUR);
- get_voc(input, gCompMode);
+ extractAndEncodeVOC(TEMP_RAW, input, gCompMode);
} else if (!memcmp(buf, "RIFF", 4)) {
printf("WAV found (pos = %d) :\n", offset);
- get_wav(input, gCompMode);
+ extractAndEncodeWAV(TEMP_WAV, input, gCompMode);
} else {
error("Unexpected data at offset: %i", offset);
}
From fingolfin at users.sourceforge.net Sat Apr 10 15:48:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 10 15:48:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.15,1.16
Message-ID:
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3438
Modified Files:
voc.cpp
Log Message:
Clean up VOC code, and fix potential out-of-bounds access
Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- voc.cpp 10 Apr 2004 01:46:38 -0000 1.15
+++ voc.cpp 10 Apr 2004 22:34:07 -0000 1.16
@@ -50,24 +50,22 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
begin_loop = 0;
end_loop = 0;
+
+ ptr += offset;
+ while ((code = *ptr++)) {
+ len = *ptr++;
+ len |= *ptr++ << 8;
+ len |= *ptr++ << 16;
- while (!quit) {
- int len = READ_LE_UINT32(ptr + offset);
- offset += 4;
- code = len & 0xFF;
- len >>= 8;
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
- int time_constant = ptr[offset++];
- int packing = ptr[offset++];
+ int time_constant = *ptr++;
+ int packing = *ptr++;
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
@@ -77,7 +75,7 @@
} else {
ret_sound = (byte *)malloc(len);
}
- memcpy(ret_sound + size, ptr + offset, len);
+ memcpy(ret_sound + size, ptr, len);
begin_loop = size;
size += len;
end_loop = size;
@@ -86,17 +84,16 @@
}
} break;
case 6: // begin of loop
- loops = (uint16)READ_LE_UINT16(ptr + offset);
+ loops = (uint16)READ_LE_UINT16(ptr);
break;
case 7: // end of loop
break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
- offset += len;
+ ptr += len;
}
debug(4, "VOC Data Size : %d", size);
return ret_sound;
@@ -132,18 +129,16 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
- while (!quit) {
- int len = file->readUint32LE();
- code = len & 0xFF;
- len >>= 8;
+ while ((code = file->readByte())) {
+ len = file->readByte();
+ len |= file->readByte() << 8;
+ len |= file->readByte() << 16;
+
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
int time_constant = file->readByte();
int packing = file->readByte();
@@ -164,8 +159,7 @@
} break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
}
debug(4, "VOC Data Size : %d", size);
From fingolfin at users.sourceforge.net Sat Apr 10 16:43:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sat Apr 10 16:43:01 2004
Subject: [Scummvm-cvs-logs] CVS: tools extract-common.c,1.10,1.11 extract.c,1.40,1.41
Message-ID:
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11756
Modified Files:
extract-common.c extract.c
Log Message:
Fixed extract tool to support multi-block VOCs better
Index: extract-common.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract-common.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- extract-common.c 10 Apr 2004 21:20:56 -0000 1.10
+++ extract-common.c 10 Apr 2004 23:28:40 -0000 1.11
@@ -173,51 +173,54 @@
}
void extractAndEncodeVOC(const char *outName, FILE *input, CompressMode compMode) {
+ FILE *f;
int blocktype;
+ int length;
+ int sample_rate;
+ int comp;
+ char fbuf[2048];
+ size_t size;
+ int real_samplerate = -1;
-/* FIXME HIGH PRIORITY: We aren't handling all types of blocks, and what is
- worse, we aren't handling multiple blocks occuring in a single VOC file.
- This is bad, because multiple type 1 blocks occur in Full Throttle.
- As a result of this lacking feature, we generates compressed audio files
- which are missing some data. Ouch! See also bug #885490
- */
-
- blocktype = fgetc(input);
- switch (blocktype) {
- case 0x01:{
- int length = 0;
- int i;
- int sample_rate;
- int comp;
- FILE *f;
- char fbuf[2048];
- size_t size;
- int real_samplerate;
+ f = fopen(outName, "wb");
+ while ((blocktype = fgetc(input))) {
+ if (blocktype != 1) {
+ /*
+ We only generate a warning, instead of erroring out, because
+ at least the monster.sou file of Full Throttle contains VOCs
+ with an invalid length field (value to small). So we encounter
+ the "block types" 0x80, 0x82 etc.. Not sure if there is another
+ (maybe even better) way to work around that... ?
+ */
+ warning("Unsupported VOC block type: %02x", blocktype);
+ break;
+ }
+
/* Sound Data */
printf(" Sound Data\n");
- for (i = 0; i < 3; i++)
- length = length | (fgetc(input) << (i * 8));
+ length = fgetc(input);
+ length |= fgetc(input) << 8;
+ length |= fgetc(input) << 16;
length -= 2;
- printf(" - length = %d\n", length);
sample_rate = fgetc(input);
comp = fgetc(input);
real_samplerate = getSampleRateFromVOCRate(sample_rate);
+ printf(" - length = %d\n", length);
printf(" - sample rate = %d (%02x)\n", real_samplerate, sample_rate);
printf(" - compression = %s (%02x)\n",
- (comp == 0 ? "8bits" :
- (comp == 1 ? "4bits" :
- (comp == 2 ? "2.6bits" :
- (comp == 3 ? "2bits" :
- "Multi")))), comp);
+ (comp == 0 ? "8bits" :
+ (comp == 1 ? "4bits" :
+ (comp == 2 ? "2.6bits" :
+ (comp == 3 ? "2bits" :
+ "Multi")))), comp);
if (comp != 0)
error("Cannot handle compressed VOC data");
/* Copy the raw data to a temporary file */
- f = fopen(outName, "wb");
while (length > 0) {
size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : (uint32)length, input);
if (size <= 0)
@@ -225,17 +228,14 @@
length -= size;
fwrite(fbuf, 1, size, f);
}
- fclose(f);
-
- /* Convert the raw temp file to OGG/MP3 */
- encodeAudio(outName, true, real_samplerate, tempEncoded, compMode);
- break;
}
- default:
- error("Unknown chunk: %02x", blocktype);
- break;
- }
+ fclose(f);
+
+ assert(real_samplerate != -1);
+
+ /* Convert the raw temp file to OGG/MP3 */
+ encodeAudio(outName, true, real_samplerate, tempEncoded, compMode);
}
void process_mp3_parms(int argc, char *argv[], int i) {
Index: extract.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- extract.c 10 Apr 2004 21:20:57 -0000 1.40
+++ extract.c 10 Apr 2004 23:28:40 -0000 1.41
@@ -78,13 +78,9 @@
void append_byte(int size, char buf[])
{
int i;
- int c;
for (i = 0; i < (size - 1); i++)
buf[i] = buf[i + 1];
- c = fgetc(input);
- if (c == EOF)
- end_of_file();
- buf[i] = c;
+ buf[i] = fgetc(input);
}
void get_part(void)
@@ -99,11 +95,13 @@
int pos = ftell(input);
uint32 tags;
- /* The VCTL header */
+ /* Scan for the VCTL header */
fread(buf, 1, 4, input);
while (memcmp(buf, "VCTL", 4)) {
pos++;
append_byte(4, buf);
+ if (feof(input))
+ end_of_file();
}
tags = readUint32BE(input);
if (tags < 8)
From kirben at users.sourceforge.net Sat Apr 10 21:34:06 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Sat Apr 10 21:34:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.23,1.24
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22219/scumm
Modified Files:
scumm.cpp
Log Message:
Allow copy protection in FOA (Disk) to be enabled.
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- scumm.cpp 9 Apr 2004 21:42:37 -0000 1.23
+++ scumm.cpp 11 Apr 2004 04:20:09 -0000 1.24
@@ -929,7 +929,7 @@
// if (_gameId==GID_MONKEY2 && _bootParam == 0)
// _bootParam = 10001;
- if (_gameId == GID_INDY4 && _bootParam == 0) {
+ if (!_copyProtection && _gameId == GID_INDY4 && _bootParam == 0) {
_bootParam = -7873;
}
From aquadran at users.sourceforge.net Sat Apr 10 23:09:00 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sat Apr 10 23:09:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.114,1.115
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1644
Modified Files:
TODO
Log Message:
update
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- TODO 7 Apr 2004 17:49:21 -0000 1.114
+++ TODO 11 Apr 2004 05:55:06 -0000 1.115
@@ -255,9 +255,9 @@
on small devices
* Fix codec44 for nut fonts
* iMUSE Digital:
- - Fix music code and 'next region' code
+ - Fix music code (done, but not tested yet)
+ - Implement 'fade buffers' stuff, to handle fadeParam in JUMP opcode
- Implement pool method data transfer between imuse and sound mixer
- - Implement split track for fadeout track needed by fadeParam in JUMP opcode
- Add save/load code
- Add code for MP3 and Ogg Vorbis compressed datafiles
* SMUSH:
From aquadran at users.sourceforge.net Sat Apr 10 23:21:07 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sat Apr 10 23:21:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/dists/msvc7 kyra.vcproj,1.1,1.2 queen.vcproj,1.19,1.20 saga.vcproj,1.1,1.2 scumm.vcproj,1.21,1.22 scummvm.vcproj,1.25,1.26 simon.vcproj,1.7,1.8 sky.vcproj,1.6,1.7 sword1.vcproj,1.6,1.7 sword2.vcproj,1.11,1.12
Message-ID:
Update of /cvsroot/scummvm/scummvm/dists/msvc7
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3063
Modified Files:
kyra.vcproj queen.vcproj saga.vcproj scumm.vcproj
scummvm.vcproj simon.vcproj sky.vcproj sword1.vcproj
sword2.vcproj
Log Message:
disable warning 4189
Index: kyra.vcproj
===================================================================
RCS file: /cvsroot/scummvm/scummvm/dists/msvc7/kyra.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- kyra.vcproj 9 Apr 2004 18:30:44 -0000 1.1
+++ kyra.vcproj 11 Apr 2004 06:06:36 -0000 1.2
@@ -18,7 +18,7 @@
CharacterSet="2">
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4026
Modified Files:
Tag: branch-0-6-0
voc.cpp voc.h
Log Message:
Backported recent VOC changes
Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -u -d -r1.13.2.2 -r1.13.2.3
--- voc.cpp 10 Apr 2004 21:08:46 -0000 1.13.2.2
+++ voc.cpp 11 Apr 2004 12:31:22 -0000 1.13.2.3
@@ -50,24 +50,22 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
begin_loop = 0;
end_loop = 0;
+
+ ptr += offset;
+ while ((code = *ptr++)) {
+ len = *ptr++;
+ len |= *ptr++ << 8;
+ len |= *ptr++ << 16;
- while (!quit) {
- int len = READ_LE_UINT32(ptr + offset);
- offset += 4;
- code = len & 0xFF;
- len >>= 8;
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
- int time_constant = ptr[offset++];
- int packing = ptr[offset++];
+ int time_constant = *ptr++;
+ int packing = *ptr++;
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
@@ -77,7 +75,7 @@
} else {
ret_sound = (byte *)malloc(len);
}
- memcpy(ret_sound + size, ptr + offset, len);
+ memcpy(ret_sound + size, ptr, len);
begin_loop = size;
size += len;
end_loop = size;
@@ -86,17 +84,16 @@
}
} break;
case 6: // begin of loop
- loops = (uint16)READ_LE_UINT16(ptr + offset);
+ loops = (uint16)READ_LE_UINT16(ptr);
break;
case 7: // end of loop
break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
- offset += len;
+ ptr += len;
}
debug(4, "VOC Data Size : %d", size);
return ret_sound;
@@ -132,18 +129,16 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
- while (!quit) {
- int len = file->readUint32LE();
- code = len & 0xFF;
- len >>= 8;
+ while ((code = file->readByte())) {
+ len = file->readByte();
+ len |= file->readByte() << 8;
+ len |= file->readByte() << 16;
+
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
int time_constant = file->readByte();
int packing = file->readByte();
@@ -164,8 +159,7 @@
} break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
}
debug(4, "VOC Data Size : %d", size);
From fingolfin at users.sourceforge.net Sun Apr 11 05:46:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 05:46:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.326,1.327
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4133
Modified Files:
sound.cpp
Log Message:
Fix for bug #907266 (MI Mac Music Bug)
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.326
retrieving revision 1.327
diff -u -d -r1.326 -r1.327
--- sound.cpp 10 Apr 2004 01:45:00 -0000 1.326
+++ sound.cpp 11 Apr 2004 12:31:46 -0000 1.327
@@ -395,7 +395,8 @@
}
else {
- if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA) {
+ if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA
+ || (_vm->_gameId == GID_MONKEY && _vm->_features & GF_MACINTOSH)) {
// Sound is currently not supported at all in the amiga versions of these games
if (_vm->_features & GF_AMIGA) {
int track = -1;
From fingolfin at users.sourceforge.net Sun Apr 11 05:46:04 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 05:46:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.320,1.320.2.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4374
Modified Files:
Tag: branch-0-6-0
sound.cpp
Log Message:
Fix for bug #907266 (MI Mac Music Bug)
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.320
retrieving revision 1.320.2.1
diff -u -d -r1.320 -r1.320.2.1
--- sound.cpp 14 Feb 2004 04:12:22 -0000 1.320
+++ sound.cpp 11 Apr 2004 12:32:18 -0000 1.320.2.1
@@ -37,6 +37,7 @@
#include "sound/mp3.h"
#include "sound/voc.h"
#include "sound/vorbis.h"
+#include "sound/flac.h"
namespace Scumm {
@@ -49,13 +50,31 @@
};
-Sound::Sound(ScummEngine *parent) {
- memset(this,0,sizeof(Sound)); // palmos
+Sound::Sound(ScummEngine *parent)
+ :
+ _vm(parent),
+ _soundQuePos(0),
+ _soundQue2Pos(0),
+ _sfxFile(0),
+ _offsetTable(0),
+ _numSoundEffects(0),
+ _soundMode(kVOCMode),
+ _talk_sound_a1(0),
+ _talk_sound_a2(0),
+ _talk_sound_b1(0),
+ _talk_sound_b2(0),
+ _talk_sound_mode(0),
+ _talk_sound_frame(0),
+ _mouthSyncMode(false),
+ _endOfMouthSync(false),
+ _curSoundPos(0),
+ _currentCDSound(0),
+ _soundsPaused(false),
+ _sfxMode(0) {
- _vm = parent;
- _currentCDSound = 0;
-
- _sfxFile = 0;
+ memset(_soundQue, 0, sizeof(_soundQue));
+ memset(_soundQue2, 0, sizeof(_soundQue2));
+ memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
}
Sound::~Sound() {
@@ -376,7 +395,8 @@
}
else {
- if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA) {
+ if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA
+ || (_vm->_gameId == GID_MONKEY && _vm->_features & GF_MACINTOSH)) {
// Sound is currently not supported at all in the amiga versions of these games
if (_vm->_features & GF_AMIGA) {
int track = -1;
@@ -422,7 +442,7 @@
_talk_sound_mode = 0;
}
- const int act = _vm->talkingActor();
+ const int act = _vm->getTalkingActor();
if ((_sfxMode & 2) && act != 0) {
Actor *a;
bool b, finished;
@@ -552,11 +572,11 @@
num = (b - 8) >> 1;
}
- if (offset_table != NULL) {
+ if (_offsetTable != NULL) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
+ result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects,
sizeof(MP3OffsetTable), compareMP3OffsetTable);
if (result == NULL) {
@@ -831,19 +851,28 @@
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- AudioStream *input = 0;
+ AudioStream *input = NULL;
- if (file_size > 0) {
- if (_vorbis_mode) {
+ switch (_soundMode) {
+ case kMP3Mode:
+#ifdef USE_MAD
+ assert(file_size > 0);
+ input = makeMP3Stream(file, file_size);
+#endif
+ break;
+ case kVorbisMode:
#ifdef USE_VORBIS
- input = makeVorbisStream(file, file_size);
+ assert(file_size > 0);
+ input = makeVorbisStream(file, file_size);
#endif
- } else {
-#ifdef USE_MAD
- input = makeMP3Stream(file, file_size);
+ break;
+ case kFlacMode:
+#ifdef USE_FLAC
+ assert(file_size > 0);
+ input = makeFlacStream(file, file_size);
#endif
- }
- } else {
+ break;
+ default:
input = makeVOCStream(_sfxFile);
}
@@ -863,32 +892,51 @@
File *Sound::openSfxFile() {
char buf[256];
File *file = new File();
+ _offsetTable = NULL;
+
+ struct SoundFileExtensions {
+ const char *ext;
+ SoundMode mode;
+ };
+
+ const SoundFileExtensions extensions[] = {
+#ifdef USE_FLAC
+ { "sof", kFlacMode },
+#endif
+#ifdef USE_MAD
+ { "so3", kMP3Mode },
+#endif
+#ifdef USE_VORBIS
+ { "sog", kVorbisMode },
+#endif
+ { "sou", kVOCMode },
+ { 0, kVOCMode }
+ };
/* Try opening the file <_gameName>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
- offset_table = NULL;
-
-#ifdef USE_MAD
- sprintf(buf, "%s.so3", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.so3", _vm->getGameDataPath());
+
+ int i, j;
+ const char *basename[3] = { 0, 0, 0 };
+ basename[0] = _vm->getGameName();
+ basename[1] = "monster";
+
+ for (j = 0; basename[j] && !file->isOpen(); ++j) {
+ for (i = 0; extensions[i].ext; ++i) {
+ sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
+ if (file->open(buf)) {
+ _soundMode = extensions[i].mode;
+ break;
+ }
+ }
}
- if (file->isOpen())
- _vorbis_mode = false;
-#endif
-#ifdef USE_VORBIS
if (!file->isOpen()) {
- sprintf(buf, "%s.sog", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath()))
- file->open("monster.sog", _vm->getGameDataPath());
- if (file->isOpen())
- _vorbis_mode = true;
- }
-#endif
-
- if (file->isOpen()) {
+ sprintf(buf, "%s.tlk", _vm->getGameName());
+ file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
+ _soundMode = kVOCMode;
+ } else if (_soundMode != kVOCMode) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -906,31 +954,21 @@
int size, compressed_offset;
MP3OffsetTable *cur;
compressed_offset = file->readUint32BE();
- offset_table = (MP3OffsetTable *) malloc(compressed_offset);
- num_sound_effects = compressed_offset / 16;
+ _offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
+ _numSoundEffects = compressed_offset / 16;
size = compressed_offset;
- cur = offset_table;
+ cur = _offsetTable;
while (size > 0) {
- cur[0].org_offset = file->readUint32BE();
- cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur[0].num_tags = file->readUint32BE();
- cur[0].compressed_size = file->readUint32BE();
+ cur->org_offset = file->readUint32BE();
+ cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur->num_tags = file->readUint32BE();
+ cur->compressed_size = file->readUint32BE();
size -= 4 * 4;
cur++;
}
- return file;
}
- sprintf(buf, "%s.sou", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.sou", _vm->getGameDataPath());
- }
-
- if (!file->isOpen()) {
- sprintf(buf, "%s.tlk", _vm->getGameName());
- file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
- }
return file;
}
From aquadran at users.sourceforge.net Sun Apr 11 08:03:03 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 08:03:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm TODO,1.115,1.116
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26342
Modified Files:
TODO
Log Message:
implemented 'fade buffers' stuff
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/scummvm/TODO,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- TODO 11 Apr 2004 05:55:06 -0000 1.115
+++ TODO 11 Apr 2004 14:48:49 -0000 1.116
@@ -256,7 +256,6 @@
* Fix codec44 for nut fonts
* iMUSE Digital:
- Fix music code (done, but not tested yet)
- - Implement 'fade buffers' stuff, to handle fadeParam in JUMP opcode
- Implement pool method data transfer between imuse and sound mixer
- Add save/load code
- Add code for MP3 and Ogg Vorbis compressed datafiles
From aquadran at users.sourceforge.net Sun Apr 11 08:03:04 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 08:03:04 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.64,1.65 dimuse.h,1.40,1.41 dimuse_script.cpp,1.4,1.5 dimuse_sndmgr.cpp,1.33,1.34 dimuse_sndmgr.h,1.23,1.24 dimuse_track.cpp,1.3,1.4
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26342/scumm/imuse_digi
Modified Files:
dimuse.cpp dimuse.h dimuse_script.cpp dimuse_sndmgr.cpp
dimuse_sndmgr.h dimuse_track.cpp
Log Message:
implemented 'fade buffers' stuff
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- dimuse.cpp 10 Apr 2004 00:17:42 -0000 1.64
+++ dimuse.cpp 11 Apr 2004 14:48:50 -0000 1.65
@@ -50,6 +50,10 @@
_volSfx = 0;
_volMusic = 0;
resetState();
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ _track[l] = new Track;
+ _track[l]->used = false;
+ }
_vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this);
}
@@ -59,6 +63,9 @@
Common::StackLock lock(_mutex, "IMuseDigital::~IMuseDigital()");
_vm->_timer->removeTimerProc(timer_handler);
}
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ delete _track[l];
+ }
delete _sound;
g_system->deleteMutex(_mutex);
}
@@ -78,113 +85,114 @@
if (_pause || !_vm)
return;
- for (l = 0; l < MAX_DIGITAL_TRACKS;l ++) {
- if (_track[l].used) {
- if (_track[l].stream2) {
- if (!_track[l].handle.isActive() && _track[l].started) {
- debug(5, "IMuseDigital::callback() A: stopped sound: %d", _track[l].soundId);
- delete _track[l].stream2;
- _track[l].stream2 = NULL;
- _track[l].used = false;
+ for (l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (_track[l]->used) {
+ if (_track[l]->stream2) {
+ if (!_track[l]->handle.isActive() && _track[l]->started) {
+ debug(5, "IMuseDigital::callback() A: stopped sound: %d", _track[l]->soundId);
+ delete _track[l]->stream2;
+ _track[l]->stream2 = NULL;
+ _track[l]->used = false;
continue;
}
- } else if (_track[l].stream) {
- if (_track[l].toBeRemoved) {
- debug(5, "IMuseDigital::callback() B: stopped sound: %d", _track[l].soundId);
- _track[l].stream->finish();
- _track[l].stream = NULL;
- _sound->closeSound(_track[l].soundHandle);
- _track[l].used = false;
+ } else if (_track[l]->stream) {
+ if (_track[l]->toBeRemoved) {
+ debug(5, "IMuseDigital::callback() B: stopped sound: %d", _track[l]->soundId);
+ _track[l]->stream->finish();
+ _track[l]->stream = NULL;
+ _sound->closeSound(_track[l]->soundHandle);
+ _track[l]->soundHandle = NULL;
+ _track[l]->used = false;
continue;
}
}
- if (_track[l].volFadeUsed) {
- if (_track[l].volFadeStep < 0) {
- if (_track[l].vol > _track[l].volFadeDest) {
- _track[l].vol += _track[l].volFadeStep;
- if (_track[l].vol < _track[l].volFadeDest) {
- _track[l].vol = _track[l].volFadeDest;
- _track[l].volFadeUsed = false;
+ if (_track[l]->volFadeUsed) {
+ if (_track[l]->volFadeStep < 0) {
+ if (_track[l]->vol > _track[l]->volFadeDest) {
+ _track[l]->vol += _track[l]->volFadeStep;
+ if (_track[l]->vol < _track[l]->volFadeDest) {
+ _track[l]->vol = _track[l]->volFadeDest;
+ _track[l]->volFadeUsed = false;
}
- if (_track[l].vol == 0) {
- _track[l].toBeRemoved = true;
+ if (_track[l]->vol == 0) {
+ _track[l]->toBeRemoved = true;
}
}
- } else if (_track[l].volFadeStep > 0) {
- if (_track[l].vol < _track[l].volFadeDest) {
- _track[l].vol += _track[l].volFadeStep;
- if (_track[l].vol > _track[l].volFadeDest) {
- _track[l].vol = _track[l].volFadeDest;
- _track[l].volFadeUsed = false;
+ } else if (_track[l]->volFadeStep > 0) {
+ if (_track[l]->vol < _track[l]->volFadeDest) {
+ _track[l]->vol += _track[l]->volFadeStep;
+ if (_track[l]->vol > _track[l]->volFadeDest) {
+ _track[l]->vol = _track[l]->volFadeDest;
+ _track[l]->volFadeUsed = false;
}
}
}
- debug(5, "Fade: sound(%d), Vol(%d)", _track[l].soundId, _track[l].vol / 1000);
+ debug(5, "Fade: sound(%d), Vol(%d)", _track[l]->soundId, _track[l]->vol / 1000);
}
- int pan = (_track[l].pan != 64) ? 2 * _track[l].pan - 127 : 0;
- int vol = _track[l].vol / 1000;
+ int pan = (_track[l]->pan != 64) ? 2 * _track[l]->pan - 127 : 0;
+ int vol = _track[l]->vol / 1000;
- if (_track[l].volGroupId == 1)
+ if (_track[l]->volGroupId == 1)
vol = (vol * _volVoice) / 128;
- if (_track[l].volGroupId == 2)
+ if (_track[l]->volGroupId == 2)
vol = (vol * _volSfx) / 128;
- if (_track[l].volGroupId == 3)
+ if (_track[l]->volGroupId == 3)
vol = (vol * _volMusic) / 128;
if (_vm->_mixer->isReady()) {
- if (_track[l].stream2) {
- if (!_track[l].started) {
- _track[l].started = true;
- _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, false, _track[l].vol / 1000, _track[l].pan, -1, false);
+ if (_track[l]->stream2) {
+ if (!_track[l]->started) {
+ _track[l]->started = true;
+ _vm->_mixer->playInputStream(&_track[l]->handle, _track[l]->stream2, false, _track[l]->vol / 1000, _track[l]->pan, -1, false);
} else {
- _vm->_mixer->setChannelVolume(_track[l].handle, vol);
- _vm->_mixer->setChannelBalance(_track[l].handle, pan);
+ _vm->_mixer->setChannelVolume(_track[l]->handle, vol);
+ _vm->_mixer->setChannelBalance(_track[l]->handle, pan);
}
continue;
}
}
- if (_track[l].stream) {
- int32 mixer_size = _track[l].pullSize;
+ if (_track[l]->stream) {
+ int32 mixer_size = _track[l]->pullSize;
byte *data = NULL;
int32 result = 0;
- if (_track[l].stream->endOfData()) {
+ if (_track[l]->stream->endOfData()) {
mixer_size *= 2;
}
- if (_track[l].curRegion == -1)
+ if (_track[l]->curRegion == -1)
switchToNextRegion(l);
- int bits = _sound->getBits(_track[l].soundHandle);
+ int bits = _sound->getBits(_track[l]->soundHandle);
do {
if (bits == 12) {
byte *ptr = NULL;
- mixer_size += _track[l].mod;
+ mixer_size += _track[l]->mod;
int mixer_size_12 = (mixer_size * 3) / 4;
int length = (mixer_size_12 / 3) * 4;
- _track[l].mod = mixer_size - length;
+ _track[l]->mod = mixer_size - length;
- int32 offset = (_track[l].regionOffset * 3) / 4;
- int result2 = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &ptr, offset, mixer_size_12);
+ int32 offset = (_track[l]->regionOffset * 3) / 4;
+ int result2 = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &ptr, offset, mixer_size_12);
result = BundleCodecs::decode12BitsSample(ptr, &data, result2);
free(ptr);
} else if (bits == 16) {
- result = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &data, _track[l].regionOffset, mixer_size);
- if (_sound->getChannels(_track[l].soundHandle) == 1) {
+ result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
+ if (_sound->getChannels(_track[l]->soundHandle) == 1) {
result &= ~1;
}
- if (_sound->getChannels(_track[l].soundHandle) == 2) {
+ if (_sound->getChannels(_track[l]->soundHandle) == 2) {
if (result & 2)
result &= ~2;
}
} else if (bits == 8) {
- result = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &data, _track[l].regionOffset, mixer_size);
- if (_sound->getChannels(_track[l].soundHandle) == 2) {
+ result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
+ if (_sound->getChannels(_track[l]->soundHandle) == 2) {
result &= ~1;
}
}
@@ -193,17 +201,17 @@
result = mixer_size;
if (_vm->_mixer->isReady()) {
- _vm->_mixer->setChannelVolume(_track[l].handle, vol);
- _vm->_mixer->setChannelBalance(_track[l].handle, pan);
- _track[l].stream->append(data, result);
- _track[l].regionOffset += result;
- _track[l].trackOffset += result;
+ _vm->_mixer->setChannelVolume(_track[l]->handle, vol);
+ _vm->_mixer->setChannelBalance(_track[l]->handle, pan);
+ _track[l]->stream->append(data, result);
+ _track[l]->regionOffset += result;
+ _track[l]->trackOffset += result;
free(data);
}
- if (_sound->isEndOfRegion(_track[l].soundHandle, _track[l].curRegion)) {
+ if (_sound->isEndOfRegion(_track[l]->soundHandle, _track[l]->curRegion)) {
switchToNextRegion(l);
- if (_track[l].toBeRemoved)
+ if (_track[l]->toBeRemoved)
break;
}
mixer_size -= result;
@@ -215,36 +223,51 @@
}
void IMuseDigital::switchToNextRegion(int track) {
- int num_regions = _sound->getNumRegions(_track[track].soundHandle);
+ if (track >= MAX_DIGITAL_TRACKS) {
+ _track[track]->toBeRemoved = true;
+ return;
+ }
- if (++_track[track].curRegion == num_regions) {
- _track[track].toBeRemoved = true;
+ int num_regions = _sound->getNumRegions(_track[track]->soundHandle);
+
+ if (++_track[track]->curRegion == num_regions) {
+ _track[track]->toBeRemoved = true;
return;
}
- int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, _track[track].curHookId);
+ int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track]->soundHandle, _track[track]->curRegion, _track[track]->curHookId);
if (jumpId == -1)
- jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, 0);
+ jumpId = _sound->getJumpIdByRegionAndHookId(_track[track]->soundHandle, _track[track]->curRegion, 0);
if (jumpId != -1) {
- int region = _sound->getRegionIdByJumpId(_track[track].soundHandle, jumpId);
+ int region = _sound->getRegionIdByJumpId(_track[track]->soundHandle, jumpId);
assert(region != -1);
- int sampleHookId = _sound->getJumpHookId(_track[track].soundHandle, jumpId);
+ int sampleHookId = _sound->getJumpHookId(_track[track]->soundHandle, jumpId);
assert(sampleHookId != -1);
+ int fadeDelay = (60 * _sound->getJumpFade(_track[track]->soundHandle, jumpId)) / 1000;
if (sampleHookId != 0) {
- if (_track[track].curHookId == sampleHookId) {
- _track[track].curRegion = region;
- debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
- _track[track].curHookId = 0;
+ if (_track[track]->curHookId == sampleHookId) {
+ int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
+ _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
+ _track[fadeTrack]->regionOffset = 0;
+ debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ _track[track]->curRegion = region;
+ debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track]->soundId, _track[track]->curRegion, _track[track]->curHookId);
+ _track[track]->curHookId = 0;
+ _track[fadeTrack]->curHookId = 0;
}
} else {
- _track[track].curRegion = region;
- debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
+ int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
+ _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
+ _track[fadeTrack]->regionOffset = 0;
+ debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ _track[track]->curRegion = region;
+ debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track]->soundId, _track[track]->curRegion, _track[track]->curHookId);
}
}
- debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
- _track[track].dataOffset = _sound->getRegionOffset(_track[track].soundHandle, _track[track].curRegion);
- _track[track].regionOffset = 0;
+ debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[track]->soundId, _track[track]->curRegion, _track[track]->curHookId);
+ _track[track]->dataOffset = _sound->getRegionOffset(_track[track]->soundHandle, _track[track]->curRegion);
+ _track[track]->regionOffset = 0;
}
} // End of namespace Scumm
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- dimuse.h 9 Apr 2004 05:43:24 -0000 1.40
+++ dimuse.h 11 Apr 2004 14:48:50 -0000 1.41
@@ -34,6 +34,7 @@
namespace Scumm {
#define MAX_DIGITAL_TRACKS 8
+#define MAX_DIGITAL_FADETRACKS 8
struct imuseDigTable;
struct imuseComiTable;
@@ -63,6 +64,8 @@
int iteration;
int mod;
int32 pullSize;
+ int32 mixerFlags;
+
ImuseDigiSndMgr::soundStruct *soundHandle;
PlayingSoundHandle handle;
AppendableAudioStream *stream;
@@ -71,7 +74,7 @@
Track();
};
- Track _track[MAX_DIGITAL_TRACKS];
+ Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS];
OSystem::MutexRef _mutex;
ScummEngine *_vm;
@@ -94,12 +97,14 @@
void switchToNextRegion(int track);
void allocSlot(int priority);
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority);
+ void selectVolumeGroup(int soundId, int volGroupId);
int32 getPosInMs(int soundId);
void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height);
int getSoundIdByName(const char *soundName);
void fadeOutMusic(int fadeDelay);
+ int cloneToFadeOutTrack(int track, int fadeDelay, int killNormalTrack);
void setFtMusicState(int stateId);
void setFtMusicSequence(int seqId);
@@ -139,7 +144,6 @@
void setVolume(int soundId, int volume);
void setPan(int soundId, int pan);
void setFade(int soundId, int destVolume, int delay60HzTicks);
- void selectVolumeGroup(int soundId, int volGroupId);
void setMasterVolume(int vol) {}
void stopSound(int soundId);
void stopAllSounds() { stopAllSounds(false); }
Index: dimuse_script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dimuse_script.cpp 9 Apr 2004 18:19:22 -0000 1.4
+++ dimuse_script.cpp 11 Apr 2004 14:48:50 -0000 1.5
@@ -163,7 +163,7 @@
Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
bool found = false;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
+ if ((_track[l]->used) && (_track[l]->volGroupId == IMUSE_VOLGRP_MUSIC)) {
found = true;
}
}
@@ -175,7 +175,7 @@
void IMuseDigital::startVoice(int soundId, AudioStream *input) {
debug(5, "startVoiceStream(%d)", soundId);
- startSound(soundId, NULL, 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
+ startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
}
void IMuseDigital::startVoice(int soundId, const char *soundName) {
@@ -185,7 +185,7 @@
void IMuseDigital::startMusic(int soundId, int volume) {
debug(5, "startMusicResource(%d)", soundId);
- startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126);
+ startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126);
}
void IMuseDigital::startMusic(const char *soundName, int soundId, int hookId, int volume) {
@@ -195,7 +195,7 @@
void IMuseDigital::startSfx(int soundId, int priority) {
debug(5, "startSfx(%d)", soundId);
- startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority);
+ startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority);
}
void IMuseDigital::getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height) {
@@ -205,8 +205,8 @@
msPos /= 16;
if (msPos < 65536) {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _sound->getSyncSizeAndPtrById(_track[l].soundHandle, syncId, sync_size, &sync_ptr);
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _sound->getSyncSizeAndPtrById(_track[l]->soundHandle, syncId, sync_size, &sync_ptr);
if ((sync_size != 0) && (sync_ptr != NULL)) {
sync_size /= 4;
while (sync_size--) {
@@ -231,8 +231,8 @@
int32 IMuseDigital::getPosInMs(int soundId) {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && (_track[l].used)) {
- int32 pos = (5 * (_track[l].dataOffset + _track[l].regionOffset)) / (_track[l].iteration / 200);
+ if ((_track[l]->soundId == soundId) && (_track[l]->used)) {
+ int32 pos = (5 * (_track[l]->dataOffset + _track[l]->regionOffset)) / (_track[l]->iteration / 200);
return pos;
}
}
@@ -244,7 +244,7 @@
Common::StackLock lock(_mutex, "IMuseDigital::getSoundStatus()");
debug(5, "IMuseDigital::getSoundStatus(%d)", sound);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == sound) && _track[l].used) {
+ if ((_track[l]->soundId == sound) && _track[l]->used) {
return 1;
}
}
@@ -256,12 +256,12 @@
Common::StackLock lock(_mutex, "IMuseDigital::stopSound()");
debug(5, "IMuseDigital::stopSound(%d)", soundId);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- if (_track[l].stream) {
- _track[l].toBeRemoved = true;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ if (_track[l]->stream) {
+ _track[l]->toBeRemoved = true;
}
- else if (_track[l].stream2)
- _vm->_mixer->stopHandle(_track[l].handle);
+ else if (_track[l]->stream2)
+ _vm->_mixer->stopHandle(_track[l]->handle);
}
}
}
@@ -271,8 +271,8 @@
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
+ if ((_track[l]->used) && (_track[l]->volGroupId == IMUSE_VOLGRP_MUSIC)) {
+ soundId = _track[l]->soundId;
}
}
@@ -306,8 +306,8 @@
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
+ if ((_track[l]->used) && (_track[l]->volGroupId == IMUSE_VOLGRP_MUSIC)) {
+ soundId = _track[l]->soundId;
}
}
@@ -324,8 +324,8 @@
int soundId = -1;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- soundId = _track[l].soundId;
+ if ((_track[l]->used) && (_track[l]->volGroupId == IMUSE_VOLGRP_MUSIC)) {
+ soundId = _track[l]->soundId;
}
}
@@ -341,12 +341,12 @@
debug(5, "IMuseDigital::stopAllSounds");
{
Common::StackLock lock(_mutex, "IMuseDigital::stopAllSounds()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used) {
- if (_track[l].stream) {
- _track[l].toBeRemoved = true;
- } else if (_track[l].stream2)
- _vm->_mixer->stopHandle(_track[l].handle);
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (_track[l]->used) {
+ if (_track[l]->stream) {
+ _track[l]->toBeRemoved = true;
+ } else if (_track[l]->stream2)
+ _vm->_mixer->stopHandle(_track[l]->handle);
}
}
}
@@ -355,8 +355,8 @@
bool used;
do {
used = false;
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used)
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (_track[l]->used)
used = true;
}
g_system->delay_msecs(10);
@@ -366,9 +366,9 @@
void IMuseDigital::pause(bool p) {
Common::StackLock lock(_mutex, "IMuseDigital::pause()");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used) {
- _vm->_mixer->pauseHandle(_track[l].handle, p);
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (_track[l]->used) {
+ _vm->_mixer->pauseHandle(_track[l]->handle, p);
}
}
_pause = p;
Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- dimuse_sndmgr.cpp 10 Apr 2004 00:17:42 -0000 1.33
+++ dimuse_sndmgr.cpp 11 Apr 2004 14:48:50 -0000 1.34
@@ -286,7 +286,8 @@
bool result = false;
byte *ptr = NULL;
- if (soundName == NULL) {
+ if (soundName[0] == 0) {
+ _sounds[slot].name[0] = 0;
if ((soundType == IMUSE_RESOURCE)) {
ptr = _vm->getResourceAddress(rtSound, soundId);
if (ptr == NULL) {
@@ -294,6 +295,9 @@
return NULL;
}
_sounds[slot].resPtr = ptr;
+ _sounds[slot].soundId = soundId;
+ _sounds[slot].type = soundType;
+ _sounds[slot].volGroupId = volGroupId;
result = true;
} else if (soundType == IMUSE_BUNDLE) {
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
@@ -304,8 +308,9 @@
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
_sounds[slot].bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside);
- _sounds[slot].name[0] = 0;
_sounds[slot].soundId = soundId;
+ _sounds[slot].type = soundType;
+ _sounds[slot].volGroupId = volGroupId;
} else {
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
}
@@ -321,6 +326,8 @@
_sounds[slot].bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside);
strcpy(_sounds[slot].name, soundName);
_sounds[slot].soundId = soundId;
+ _sounds[slot].type = soundType;
+ _sounds[slot].volGroupId = volGroupId;
} else {
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %s", soundName);
}
@@ -350,6 +357,12 @@
memset(soundHandle, 0, sizeof(soundStruct));
}
+ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::cloneSound(soundStruct *soundHandle) {
+ assert(soundHandle && checkForProperHandle(soundHandle));
+
+ return openSound(soundHandle->soundId, soundHandle->name, soundHandle->type, soundHandle->volGroupId);
+}
+
bool ImuseDigiSndMgr::checkForProperHandle(soundStruct *soundHandle) {
for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
if (soundHandle == &_sounds[l])
Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- dimuse_sndmgr.h 9 Apr 2004 21:44:29 -0000 1.23
+++ dimuse_sndmgr.h 11 Apr 2004 14:48:50 -0000 1.24
@@ -81,6 +81,8 @@
char name[15];
int16 soundId;
BundleMgr *bundle;
+ int type;
+ int volGroupId;
};
private:
@@ -105,8 +107,9 @@
ImuseDigiSndMgr(ScummEngine *scumm);
~ImuseDigiSndMgr();
- soundStruct * openSound(int32 soundId, const char *soundName, int soundType, int volGroupId);
+ soundStruct *openSound(int32 soundId, const char *soundName, int soundType, int volGroupId);
void closeSound(soundStruct *soundHandle);
+ soundStruct *cloneSound(soundStruct *soundHandle);
int getFreq(soundStruct *soundHandle);
int getBits(soundStruct *soundHandle);
Index: dimuse_track.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dimuse_track.cpp 10 Apr 2004 00:17:42 -0000 1.3
+++ dimuse_track.cpp 11 Apr 2004 14:48:50 -0000 1.4
@@ -38,33 +38,33 @@
bool found_free = false;
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (!_track[l].used && !_track[l].handle.isActive())
+ if (!_track[l]->used && !_track[l]->handle.isActive())
found_free = true;
}
if (!found_free) {
warning("IMuseDigital::startSound(): All slots are full");
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used && _track[l].handle.isActive() &&
- (lower_priority > _track[l].priority) && (!_track[l].stream2))
- lower_priority = _track[l].priority;
+ if (_track[l]->used && _track[l]->handle.isActive() &&
+ (lower_priority > _track[l]->priority) && (!_track[l]->stream2))
+ lower_priority = _track[l]->priority;
}
if (lower_priority <= priority) {
int track_id = -1;
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used && _track[l].handle.isActive() &&
- (lower_priority == _track[l].priority) && (!_track[l].stream2)) {
+ if (_track[l]->used && _track[l]->handle.isActive() &&
+ (lower_priority == _track[l]->priority) && (!_track[l]->stream2)) {
track_id = l;
}
}
assert(track_id != -1);
- _track[track_id].stream->finish();
- _track[track_id].stream = NULL;
- _vm->_mixer->stopHandle(_track[track_id].handle);
- _sound->closeSound(_track[track_id].soundHandle);
- _track[track_id].used = false;
- assert(!_track[track_id].handle.isActive());
- warning("IMuseDigital::startSound(): Removed sound %d from track %d", _track[track_id].soundId, track_id);
+ _track[track_id]->stream->finish();
+ _track[track_id]->stream = NULL;
+ _vm->_mixer->stopHandle(_track[track_id]->handle);
+ _sound->closeSound(_track[track_id]->soundHandle);
+ _track[track_id]->used = false;
+ assert(!_track[track_id]->handle.isActive());
+ warning("IMuseDigital::startSound(): Removed sound %d from track %d", _track[track_id]->soundId, track_id);
} else {
warning("IMuseDigital::startSound(): Priority sound too low");
return;
@@ -80,46 +80,47 @@
allocSlot(priority);
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (!_track[l].used && !_track[l].handle.isActive()) {
- _track[l].pan = 64;
- _track[l].vol = volume * 1000;
- _track[l].volFadeDest = 0;
- _track[l].volFadeStep = 0;
- _track[l].volFadeDelay = 0;
- _track[l].volFadeUsed = false;
- _track[l].soundId = soundId;
- _track[l].started = false;
- _track[l].volGroupId = volGroupId;
- _track[l].curHookId = hookId;
- _track[l].priority = priority;
- _track[l].curRegion = -1;
- _track[l].dataOffset = 0;
- _track[l].regionOffset = 0;
- _track[l].trackOffset = 0;
- _track[l].mod = 0;
- _track[l].toBeRemoved = false;
+ if (!_track[l]->used && !_track[l]->handle.isActive()) {
+ _track[l]->pan = 64;
+ _track[l]->vol = volume * 1000;
+ _track[l]->volFadeDest = 0;
+ _track[l]->volFadeStep = 0;
+ _track[l]->volFadeDelay = 0;
+ _track[l]->volFadeUsed = false;
+ _track[l]->soundId = soundId;
+ _track[l]->started = false;
+ _track[l]->volGroupId = volGroupId;
+ _track[l]->curHookId = hookId;
+ _track[l]->priority = priority;
+ _track[l]->curRegion = -1;
+ _track[l]->dataOffset = 0;
+ _track[l]->regionOffset = 0;
+ _track[l]->trackOffset = 0;
+ _track[l]->mod = 0;
+ _track[l]->mixerFlags = 0;
+ _track[l]->toBeRemoved = false;
- int bits = 0, freq = 0, channels = 0, mixerFlags = 0;
+ int bits = 0, freq = 0, channels = 0;
if (input) {
- _track[l].iteration = 1; // ?
+ _track[l]->iteration = 1; // ?
// Do nothing here, we already have an audio stream
} else {
- _track[l].soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId);
+ _track[l]->soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId);
- if (_track[l].soundHandle == NULL)
+ if (_track[l]->soundHandle == NULL)
return;
- bits = _sound->getBits(_track[l].soundHandle);
- channels = _sound->getChannels(_track[l].soundHandle);
- freq = _sound->getFreq(_track[l].soundHandle);
+ bits = _sound->getBits(_track[l]->soundHandle);
+ channels = _sound->getChannels(_track[l]->soundHandle);
+ freq = _sound->getFreq(_track[l]->soundHandle);
if ((soundId == kTalkSoundID) && (soundType == IMUSE_BUNDLE)) {
if (_vm->_actorToPrintStrFor != 0xFF && _vm->_actorToPrintStrFor != 0) {
Actor *a = _vm->derefActor(_vm->_actorToPrintStrFor, "IMuseDigital::startSound");
freq = (freq * a->talkFrequency) / 256;
- _track[l].pan = a->talkPan;
- _track[l].vol = a->talkVolume * 1000;
+ _track[l]->pan = a->talkPan;
+ _track[l]->vol = a->talkVolume * 1000;
}
}
@@ -135,32 +136,32 @@
// subclass).
freq -= (freq % 25);
- _track[l].iteration = _track[l].pullSize = freq * channels;
+ _track[l]->iteration = _track[l]->pullSize = freq * channels;
if (channels == 2)
- mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
+ _track[l]->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
if ((bits == 12) || (bits == 16)) {
- mixerFlags |= SoundMixer::FLAG_16BITS;
- _track[l].iteration = _track[l].pullSize *= 2;
+ _track[l]->mixerFlags |= SoundMixer::FLAG_16BITS;
+ _track[l]->iteration = _track[l]->pullSize *= 2;
} else if (bits == 8) {
- mixerFlags |= SoundMixer::FLAG_UNSIGNED;
+ _track[l]->mixerFlags |= SoundMixer::FLAG_UNSIGNED;
} else
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
- _track[l].pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
+ _track[l]->pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
}
if (input) {
- _track[l].stream2 = input;
- _track[l].stream = NULL;
+ _track[l]->stream2 = input;
+ _track[l]->stream = NULL;
} else {
- _track[l].stream2 = NULL;
- _track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000);
- _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, false, _track[l].vol / 1000, _track[l].pan, -1);
+ _track[l]->stream2 = NULL;
+ _track[l]->stream = makeAppendableAudioStream(freq, _track[l]->mixerFlags, 100000);
+ _vm->_mixer->playInputStream(&_track[l]->handle, _track[l]->stream, false, _track[l]->vol / 1000, _track[l]->pan, -1);
}
- _track[l].used = true;
+ _track[l]->used = true;
return;
}
}
@@ -175,8 +176,8 @@
assert ((priority >= 0) && (priority <= 127));
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].priority = priority;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _track[l]->priority = priority;
}
}
}
@@ -185,8 +186,8 @@
Common::StackLock lock(_mutex, "IMuseDigital::setVolume()");
debug(5, "IMuseDigital::setVolume(%d, %d)", soundId, volume);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].vol = volume * 1000;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _track[l]->vol = volume * 1000;
}
}
}
@@ -195,8 +196,8 @@
Common::StackLock lock(_mutex, "IMuseDigital::setPan()");
debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].pan = pan;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _track[l]->pan = pan;
}
}
}
@@ -210,8 +211,8 @@
volGroupId = 3;
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].volGroupId = volGroupId;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _track[l]->volGroupId = volGroupId;
}
}
}
@@ -220,11 +221,11 @@
Common::StackLock lock(_mutex, "IMuseDigital::setFade()");
debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].soundId == soundId) && _track[l].used) {
- _track[l].volFadeDelay = delay60HzTicks;
- _track[l].volFadeDest = destVolume * 1000;
- _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * delay60HzTicks);
- _track[l].volFadeUsed = true;
+ if ((_track[l]->soundId == soundId) && _track[l]->used) {
+ _track[l]->volFadeDelay = delay60HzTicks;
+ _track[l]->volFadeDest = destVolume * 1000;
+ _track[l]->volFadeStep = (_track[l]->volFadeDest - _track[l]->vol) * 60 * 40 / (1000 * delay60HzTicks);
+ _track[l]->volFadeUsed = true;
}
}
}
@@ -233,13 +234,72 @@
Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusic()");
debug(5, "IMuseDigital::fadeOutMusic");
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if ((_track[l].used) && (_track[l].volGroupId == IMUSE_VOLGRP_MUSIC) && (!_track[l].volFadeUsed)) {
- _track[l].volFadeDelay = fadeDelay;
- _track[l].volFadeDest = 0;
- _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay);
- _track[l].volFadeUsed = true;
+ if ((_track[l]->used) && (_track[l]->volGroupId == IMUSE_VOLGRP_MUSIC)) {
+ cloneToFadeOutTrack(l, fadeDelay, true);
+ }
+ }
+}
+
+int IMuseDigital::cloneToFadeOutTrack(int track, int fadeDelay, int killNormalTrack) {
+ Common::StackLock lock(_mutex, "IMuseDigital::cloneToFadeOutTrack()");
+ debug(5, "IMuseDigital::cloneToFadeOutTrack(%d, %d)", track, fadeDelay);
+ int fadeTrack = -1;
+
+ for (int l = MAX_DIGITAL_TRACKS; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (!_track[l]->used) {
+ fadeTrack = l;
+ break;
}
}
+ if (fadeTrack == -1)
+ error("IMuseDigital::cloneToFadeTrack() Can't find free fade track");
+
+ // swap track to fade track
+ Track *tmpTrack = _track[track];
+ _track[track] = _track[fadeTrack];
+ _track[fadeTrack] = tmpTrack;
+
+ // copy track params from swaped fade track to new track
+ _track[track]->pan = _track[fadeTrack]->pan;
+ _track[track]->vol = _track[fadeTrack]->vol;
+ _track[track]->volGroupId = _track[fadeTrack]->volGroupId;
+ _track[track]->volFadeDelay = _track[fadeTrack]->volFadeDelay;
+ _track[track]->volFadeDest = _track[fadeTrack]->volFadeDest;
+ _track[track]->volFadeStep = _track[fadeTrack]->volFadeStep;
+ _track[track]->volFadeUsed = _track[fadeTrack]->volFadeUsed;
+ _track[track]->priority = _track[fadeTrack]->priority;
+ _track[track]->soundId = _track[fadeTrack]->soundId;
+ _track[track]->dataOffset = _track[fadeTrack]->dataOffset;
+ _track[track]->regionOffset = _track[fadeTrack]->regionOffset;
+ _track[track]->trackOffset = _track[fadeTrack]->trackOffset;
+ _track[track]->curRegion = _track[fadeTrack]->curRegion;
+ _track[track]->curHookId = _track[fadeTrack]->curHookId;
+ _track[track]->iteration = _track[fadeTrack]->iteration;
+ _track[track]->mixerFlags = _track[fadeTrack]->mixerFlags;
+ _track[track]->mod = _track[fadeTrack]->mod;
+ _track[track]->pullSize = _track[fadeTrack]->pullSize;
+ _track[track]->used = _track[fadeTrack]->used;
+ _track[track]->toBeRemoved = _track[fadeTrack]->toBeRemoved;
+ _track[track]->started = _track[fadeTrack]->started;
+ _track[track]->stream2 = _track[fadeTrack]->stream2;
+
+ _track[track]->soundHandle = NULL;
+ _track[track]->stream = NULL;
+
+ _track[fadeTrack]->volFadeDelay = fadeDelay;
+ _track[fadeTrack]->volFadeDest = 0;
+ _track[fadeTrack]->volFadeStep = (_track[fadeTrack]->volFadeDest - _track[fadeTrack]->vol) * 60 * 40 / (1000 * fadeDelay);
+ _track[fadeTrack]->volFadeUsed = true;
+
+ if (killNormalTrack) {
+ _track[track]->used = false;
+ } else {
+ _track[track]->soundHandle = _sound->cloneSound(_track[fadeTrack]->soundHandle);
+ _track[track]->stream = makeAppendableAudioStream(_sound->getFreq(_track[track]->soundHandle), _track[track]->mixerFlags, 100000);
+ _vm->_mixer->playInputStream(&_track[track]->handle, _track[track]->stream, false, _track[track]->vol / 1000, _track[track]->pan, -1);
+ }
+
+ return fadeTrack;
}
} // End of namespace Scumm
From aquadran at users.sourceforge.net Sun Apr 11 08:10:03 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 08:10:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.65,1.66
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27767
Modified Files:
dimuse.cpp
Log Message:
exclude for FT sound loops
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- dimuse.cpp 11 Apr 2004 14:48:50 -0000 1.65
+++ dimuse.cpp 11 Apr 2004 14:56:11 -0000 1.66
@@ -246,20 +246,24 @@
int fadeDelay = (60 * _sound->getJumpFade(_track[track]->soundHandle, jumpId)) / 1000;
if (sampleHookId != 0) {
if (_track[track]->curHookId == sampleHookId) {
- int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
- _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
- _track[fadeTrack]->regionOffset = 0;
- debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ if (fadeDelay != 0) {
+ int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
+ _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
+ _track[fadeTrack]->regionOffset = 0;
+ debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ _track[fadeTrack]->curHookId = 0;
+ }
_track[track]->curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track]->soundId, _track[track]->curRegion, _track[track]->curHookId);
_track[track]->curHookId = 0;
- _track[fadeTrack]->curHookId = 0;
}
} else {
- int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
- _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
- _track[fadeTrack]->regionOffset = 0;
- debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ if (fadeDelay != 0) {
+ int fadeTrack = cloneToFadeOutTrack(track, fadeDelay, false);
+ _track[fadeTrack]->dataOffset = _sound->getRegionOffset(_track[fadeTrack]->soundHandle, _track[fadeTrack]->curRegion);
+ _track[fadeTrack]->regionOffset = 0;
+ debug(5, "switchToNextRegion-sound(%d) select %d region, curHookId: %d", _track[fadeTrack]->soundId, _track[fadeTrack]->curRegion, _track[fadeTrack]->curHookId);
+ }
_track[track]->curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track]->soundId, _track[track]->curRegion, _track[track]->curHookId);
}
From aquadran at users.sourceforge.net Sun Apr 11 11:21:00 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 11:21:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.120,1.121
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27784
Modified Files:
akos.cpp
Log Message:
forgot that
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- akos.cpp 6 Apr 2004 01:06:54 -0000 1.120
+++ akos.cpp 11 Apr 2004 18:07:03 -0000 1.121
@@ -1344,7 +1344,7 @@
case 9:
if (param_1 != 0) {
if (_imuseDigital) {
-// _imuseDigital->setPriority(param_1, param_2);
+ _imuseDigital->setPriority(param_1, param_2);
}
}
break;
From aquadran at users.sourceforge.net Sun Apr 11 12:11:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 12:11:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.66,1.67 dimuse.h,1.41,1.42
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3813
Modified Files:
dimuse.cpp dimuse.h
Log Message:
add initial code for pull procedure
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- dimuse.cpp 11 Apr 2004 14:56:11 -0000 1.66
+++ dimuse.cpp 11 Apr 2004 18:56:32 -0000 1.67
@@ -78,6 +78,72 @@
_nextSeqToPlay = 0;
}
+void IMuseDigital::poolDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream) {
+ Common::StackLock lock(_mutex, "IMuseDigital::poolDataForMixer()");
+ for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
+ if (_track[l]->stream == stream) {
+ int32 mixer_size = pullSize;
+ byte *data = NULL;
+ int32 result = 0, pos = 0;
+
+ if (_track[l]->curRegion == -1)
+ switchToNextRegion(l);
+
+ int bits = _sound->getBits(_track[l]->soundHandle);
+ do {
+ if (bits == 12) {
+ byte *ptr = NULL;
+
+ mixer_size += _track[l]->mod;
+ int mixer_size_12 = (mixer_size * 3) / 4;
+ int length = (mixer_size_12 / 3) * 4;
+ _track[l]->mod = mixer_size - length;
+
+ int32 offset = (_track[l]->regionOffset * 3) / 4;
+ int result2 = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &ptr, offset, mixer_size_12);
+ result = BundleCodecs::decode12BitsSample(ptr, &data, result2);
+
+ free(ptr);
+ } else if (bits == 16) {
+ result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
+ if (_sound->getChannels(_track[l]->soundHandle) == 1) {
+ result &= ~1;
+ }
+ if (_sound->getChannels(_track[l]->soundHandle) == 2) {
+ if (result & 2)
+ result &= ~2;
+ }
+ } else if (bits == 8) {
+ result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
+ if (_sound->getChannels(_track[l]->soundHandle) == 2) {
+ result &= ~1;
+ }
+ }
+
+ if (result > mixer_size)
+ result = mixer_size;
+
+ memcpy(mixerBuffer + pos, data, result);
+ pos += result;
+ free(data);
+
+ _track[l]->regionOffset += result;
+ _track[l]->trackOffset += result;
+
+ if (_sound->isEndOfRegion(_track[l]->soundHandle, _track[l]->curRegion)) {
+ switchToNextRegion(l);
+ if (_track[l]->toBeRemoved)
+ break;
+ }
+ mixer_size -= result;
+ assert(mixer_size >= 0);
+ } while (mixer_size != 0);
+ return;
+ }
+ }
+ error("IMuseDigital::poolDataForMixer() Can't match streams");
+}
+
void IMuseDigital::callback() {
Common::StackLock lock(_mutex, "IMuseDigital::callback()");
int l = 0;
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- dimuse.h 11 Apr 2004 14:48:50 -0000 1.41
+++ dimuse.h 11 Apr 2004 18:56:32 -0000 1.42
@@ -93,6 +93,7 @@
int _curMusicCue;
static void timer_handler(void *refConf);
+ void poolDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream);
void callback();
void switchToNextRegion(int track);
void allocSlot(int priority);
From aquadran at users.sourceforge.net Sun Apr 11 12:12:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 12:12:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.67,1.68 dimuse.h,1.42,1.43
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3980
Modified Files:
dimuse.cpp dimuse.h
Log Message:
pull not pool
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- dimuse.cpp 11 Apr 2004 18:56:32 -0000 1.67
+++ dimuse.cpp 11 Apr 2004 18:57:44 -0000 1.68
@@ -78,8 +78,8 @@
_nextSeqToPlay = 0;
}
-void IMuseDigital::poolDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream) {
- Common::StackLock lock(_mutex, "IMuseDigital::poolDataForMixer()");
+void IMuseDigital::pullDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream) {
+ Common::StackLock lock(_mutex, "IMuseDigital::pullDataForMixer()");
for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
if (_track[l]->stream == stream) {
int32 mixer_size = pullSize;
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- dimuse.h 11 Apr 2004 18:56:32 -0000 1.42
+++ dimuse.h 11 Apr 2004 18:57:44 -0000 1.43
@@ -93,7 +93,7 @@
int _curMusicCue;
static void timer_handler(void *refConf);
- void poolDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream);
+ void pullDataForMixer(int32 pullSize, byte *mixerBuffer, AudioStream *stream);
void callback();
void switchToNextRegion(int track);
void allocSlot(int priority);
From aquadran at users.sourceforge.net Sun Apr 11 12:13:01 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Sun Apr 11 12:13:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.68,1.69
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281
Modified Files:
dimuse.cpp
Log Message:
pull not pool
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- dimuse.cpp 11 Apr 2004 18:57:44 -0000 1.68
+++ dimuse.cpp 11 Apr 2004 18:58:50 -0000 1.69
@@ -141,7 +141,7 @@
return;
}
}
- error("IMuseDigital::poolDataForMixer() Can't match streams");
+ error("IMuseDigital::pullDataForMixer() Can't match streams");
}
void IMuseDigital::callback() {
From fingolfin at users.sourceforge.net Sun Apr 11 14:10:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 14:10:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.327,1.328
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25045
Modified Files:
sound.cpp
Log Message:
Oops! Accidentally copied the HEAD sound.cpp into the 0.6.0 branch
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- sound.cpp 11 Apr 2004 12:31:46 -0000 1.327
+++ sound.cpp 11 Apr 2004 20:55:46 -0000 1.328
@@ -37,7 +37,6 @@
#include "sound/mp3.h"
#include "sound/voc.h"
#include "sound/vorbis.h"
-#include "sound/flac.h"
namespace Scumm {
@@ -50,31 +49,13 @@
};
-Sound::Sound(ScummEngine *parent)
- :
- _vm(parent),
- _soundQuePos(0),
- _soundQue2Pos(0),
- _sfxFile(0),
- _offsetTable(0),
- _numSoundEffects(0),
- _soundMode(kVOCMode),
- _talk_sound_a1(0),
- _talk_sound_a2(0),
- _talk_sound_b1(0),
- _talk_sound_b2(0),
- _talk_sound_mode(0),
- _talk_sound_frame(0),
- _mouthSyncMode(false),
- _endOfMouthSync(false),
- _curSoundPos(0),
- _currentCDSound(0),
- _soundsPaused(false),
- _sfxMode(0) {
+Sound::Sound(ScummEngine *parent) {
+ memset(this,0,sizeof(Sound)); // palmos
- memset(_soundQue, 0, sizeof(_soundQue));
- memset(_soundQue2, 0, sizeof(_soundQue2));
- memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
+ _vm = parent;
+ _currentCDSound = 0;
+
+ _sfxFile = 0;
}
Sound::~Sound() {
@@ -442,7 +423,7 @@
_talk_sound_mode = 0;
}
- const int act = _vm->getTalkingActor();
+ const int act = _vm->talkingActor();
if ((_sfxMode & 2) && act != 0) {
Actor *a;
bool b, finished;
@@ -572,11 +553,11 @@
num = (b - 8) >> 1;
}
- if (_offsetTable != NULL) {
+ if (offset_table != NULL) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects,
+ result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
sizeof(MP3OffsetTable), compareMP3OffsetTable);
if (result == NULL) {
@@ -851,28 +832,19 @@
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- AudioStream *input = NULL;
+ AudioStream *input = 0;
- switch (_soundMode) {
- case kMP3Mode:
-#ifdef USE_MAD
- assert(file_size > 0);
- input = makeMP3Stream(file, file_size);
-#endif
- break;
- case kVorbisMode:
+ if (file_size > 0) {
+ if (_vorbis_mode) {
#ifdef USE_VORBIS
- assert(file_size > 0);
- input = makeVorbisStream(file, file_size);
+ input = makeVorbisStream(file, file_size);
#endif
- break;
- case kFlacMode:
-#ifdef USE_FLAC
- assert(file_size > 0);
- input = makeFlacStream(file, file_size);
+ } else {
+#ifdef USE_MAD
+ input = makeMP3Stream(file, file_size);
#endif
- break;
- default:
+ }
+ } else {
input = makeVOCStream(_sfxFile);
}
@@ -892,51 +864,32 @@
File *Sound::openSfxFile() {
char buf[256];
File *file = new File();
- _offsetTable = NULL;
-
- struct SoundFileExtensions {
- const char *ext;
- SoundMode mode;
- };
-
- const SoundFileExtensions extensions[] = {
-#ifdef USE_FLAC
- { "sof", kFlacMode },
-#endif
-#ifdef USE_MAD
- { "so3", kMP3Mode },
-#endif
-#ifdef USE_VORBIS
- { "sog", kVorbisMode },
-#endif
- { "sou", kVOCMode },
- { 0, kVOCMode }
- };
/* Try opening the file <_gameName>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
-
- int i, j;
- const char *basename[3] = { 0, 0, 0 };
- basename[0] = _vm->getGameName();
- basename[1] = "monster";
-
- for (j = 0; basename[j] && !file->isOpen(); ++j) {
- for (i = 0; extensions[i].ext; ++i) {
- sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
- if (file->open(buf)) {
- _soundMode = extensions[i].mode;
- break;
- }
- }
+ offset_table = NULL;
+
+#ifdef USE_MAD
+ sprintf(buf, "%s.so3", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath())) {
+ file->open("monster.so3", _vm->getGameDataPath());
}
+ if (file->isOpen())
+ _vorbis_mode = false;
+#endif
+#ifdef USE_VORBIS
if (!file->isOpen()) {
- sprintf(buf, "%s.tlk", _vm->getGameName());
- file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
- _soundMode = kVOCMode;
- } else if (_soundMode != kVOCMode) {
+ sprintf(buf, "%s.sog", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath()))
+ file->open("monster.sog", _vm->getGameDataPath());
+ if (file->isOpen())
+ _vorbis_mode = true;
+ }
+#endif
+
+ if (file->isOpen()) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -954,21 +907,31 @@
int size, compressed_offset;
MP3OffsetTable *cur;
compressed_offset = file->readUint32BE();
- _offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
- _numSoundEffects = compressed_offset / 16;
+ offset_table = (MP3OffsetTable *) malloc(compressed_offset);
+ num_sound_effects = compressed_offset / 16;
size = compressed_offset;
- cur = _offsetTable;
+ cur = offset_table;
while (size > 0) {
- cur->org_offset = file->readUint32BE();
- cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur->num_tags = file->readUint32BE();
- cur->compressed_size = file->readUint32BE();
+ cur[0].org_offset = file->readUint32BE();
+ cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur[0].num_tags = file->readUint32BE();
+ cur[0].compressed_size = file->readUint32BE();
size -= 4 * 4;
cur++;
}
+ return file;
}
+ sprintf(buf, "%s.sou", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath())) {
+ file->open("monster.sou", _vm->getGameDataPath());
+ }
+
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.tlk", _vm->getGameName());
+ file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
+ }
return file;
}
From fingolfin at users.sourceforge.net Sun Apr 11 14:11:10 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 14:11:10 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.229.2.3,1.229.2.4 script_v5.cpp,1.226.2.1,1.226.2.2 script_v6.cpp,1.293.2.7,1.293.2.8 scumm.h,1.369.2.1,1.369.2.2 scummvm.cpp,2.577.2.7,2.577.2.8 string.cpp,1.193.2.2,1.193.2.3
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25412
Modified Files:
Tag: branch-0-6-0
actor.cpp script_v5.cpp script_v6.cpp scumm.h scummvm.cpp
string.cpp
Log Message:
backported various small changes from HEAD to 0.6.0 branch
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.229.2.3
retrieving revision 1.229.2.4
diff -u -d -r1.229.2.3 -r1.229.2.4
--- actor.cpp 16 Mar 2004 23:51:34 -0000 1.229.2.3
+++ actor.cpp 11 Apr 2004 20:56:41 -0000 1.229.2.4
@@ -75,6 +75,8 @@
_pos.x = 0;
_pos.y = 0;
facing = 180;
+ if (_vm->_version >= 7)
+ visible = false;
} else if (mode == 2) {
facing = 180;
}
@@ -99,9 +101,11 @@
setActorWalkSpeed(8, 2);
animSpeed = 0;
+ if (_vm->_version >= 6)
+ animProgress = 0;
ignoreBoxes = false;
- forceClip = 0;
+ forceClip = (_vm->_version >= 7) ? 100 : 0;
ignoreTurns = false;
flip = 0;
@@ -562,8 +566,8 @@
}
void Actor::putActor(int dstX, int dstY, byte newRoom) {
- if (visible && _vm->_currentRoom != newRoom && _vm->talkingActor() == number) {
- _vm->clearMsgQueue();
+ if (visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == number) {
+ _vm->stopTalk();
}
// HACK: The green transparency of the tank in the Hall of Oddities is
@@ -784,14 +788,14 @@
// V1 Maniac doesn't have a ScummVar for VAR_TALK_ACTOR, and just uses
// an internal variable. Emulate this to prevent overwriting script vars...
-int ScummEngine::talkingActor() {
+int ScummEngine::getTalkingActor() {
if (_gameId == GID_MANIAC && _version == 1)
return _V1_talkingActor;
else
return VAR(VAR_TALK_ACTOR);
}
-void ScummEngine::talkingActor(int value) {
+void ScummEngine::setTalkingActor(int value) {
if (_gameId == GID_MANIAC && _version == 1)
_V1_talkingActor = value;
else
@@ -1155,7 +1159,7 @@
if (_actorToPrintStrFor == 0xFF) {
if (!_keepText)
stopTalk();
- talkingActor(0xFF);
+ setTalkingActor(0xFF);
} else {
int oldact;
@@ -1171,21 +1175,21 @@
} else {
if (!_keepText)
stopTalk();
- talkingActor(a->number);
+ setTalkingActor(a->number);
if (!_string[0].no_talk_anim) {
a->startAnimActor(a->talkStartFrame);
_useTalkAnims = true;
}
- oldact = talkingActor();
+ oldact = getTalkingActor();
}
if (oldact >= 0x80)
return;
}
- if (((_gameId == GID_MANIAC) && (_version == 1)) || talkingActor() > 0x7F) {
+ if (((_gameId == GID_MANIAC) && (_version == 1)) || getTalkingActor() > 0x7F) {
_charsetColor = (byte)_string[0].color;
} else {
- a = derefActor(talkingActor(), "actorTalk(2)");
+ a = derefActor(getTalkingActor(), "actorTalk(2)");
_charsetColor = a->talkColor;
}
_charsetBufPos = 0;
@@ -1205,7 +1209,7 @@
_haveMsg = 0;
_talkDelay = 0;
- act = talkingActor();
+ act = getTalkingActor();
if (act && act < 0x80) {
Actor *a = derefActor(act, "stopTalk");
if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
@@ -1213,10 +1217,10 @@
_useTalkAnims = false;
}
if (!(_features & GF_HUMONGOUS))
- talkingActor(0xFF);
+ setTalkingActor(0xFF);
}
if (_features & GF_HUMONGOUS)
- talkingActor(0);
+ setTalkingActor(0);
_keepText = false;
_charset->restoreCharsetBg();
}
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.226.2.1
retrieving revision 1.226.2.2
diff -u -d -r1.226.2.1 -r1.226.2.2
--- script_v5.cpp 27 Mar 2004 18:05:39 -0000 1.226.2.1
+++ script_v5.cpp 11 Apr 2004 20:56:49 -0000 1.226.2.2
@@ -1648,7 +1648,7 @@
a = derefActor(act, "o5_putActorInRoom");
- if (a->visible && _currentRoom != room && talkingActor() == a->number) {
+ if (a->visible && _currentRoom != room && getTalkingActor() == a->number) {
clearMsgQueue();
}
a->room = room;
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.293.2.7
retrieving revision 1.293.2.8
diff -u -d -r1.293.2.7 -r1.293.2.8
--- script_v6.cpp 5 Mar 2004 11:13:56 -0000 1.293.2.7
+++ script_v6.cpp 11 Apr 2004 20:56:49 -0000 1.293.2.8
@@ -1166,7 +1166,7 @@
if (room == 0xFF || room == 0x7FFFFFFF) {
room = a->room;
} else {
- if (a->visible && _currentRoom != room && talkingActor() == a->number) {
+ if (a->visible && _currentRoom != room && getTalkingActor() == a->number) {
clearMsgQueue();
}
if (room != 0)
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.369.2.1
retrieving revision 1.369.2.2
diff -u -d -r1.369.2.1 -r1.369.2.2
--- scumm.h 24 Feb 2004 00:44:16 -0000 1.369.2.1
+++ scumm.h 11 Apr 2004 20:56:50 -0000 1.369.2.2
@@ -771,8 +771,8 @@
int16 _talkDelay;
void actorTalk();
void stopTalk();
- int talkingActor(); // Wrapper around VAR_TALK_ACTOR for V1 Maniac
- void talkingActor(int variable);
+ int getTalkingActor(); // Wrapper around VAR_TALK_ACTOR for V1 Maniac
+ void setTalkingActor(int variable);
// Costume class
void cost_decodeData(Actor *a, int frame, uint usemask);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/Attic/scummvm.cpp,v
retrieving revision 2.577.2.7
retrieving revision 2.577.2.8
diff -u -d -r2.577.2.7 -r2.577.2.8
--- scummvm.cpp 11 Mar 2004 03:37:43 -0000 2.577.2.7
+++ scummvm.cpp 11 Apr 2004 20:56:50 -0000 2.577.2.8
@@ -909,7 +909,7 @@
// if (_gameId==GID_MONKEY2 && _bootParam == 0)
// _bootParam = 10001;
- if (_gameId == GID_INDY4 && _bootParam == 0) {
+ if (!_copyProtection && _gameId == GID_INDY4 && _bootParam == 0) {
_bootParam = -7873;
}
@@ -1212,8 +1212,11 @@
VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
}
+ if (_gameId == GID_MONKEY || _gameId == GID_MONKEY_SEGA)
+ _scummVars[74] = 1225;
+
VAR(VAR_CHARINC) = 4;
- talkingActor(0);
+ setTalkingActor(0);
}
#pragma mark -
@@ -1327,8 +1330,8 @@
VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y;
VAR(VAR_MOUSE_X) = _mouse.x;
VAR(VAR_MOUSE_Y) = _mouse.y;
- if ((_features & GF_MACINTOSH) && (_version == 3)) {
- // This is for the Mac version of Indy3/Loom
+ if (!((_features & GF_MACINTOSH) && (_version == 3))) {
+ // This is NOT for the Mac version of Indy3/Loom
VAR(VAR_DEBUGMODE) = _debugMode;
}
}
@@ -1627,7 +1630,7 @@
}
if (_keyPressed >= 512)
- warning("_keyPressed > 512 (%d)", _keyPressed);
+ debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed);
else
_keyDownMap[_keyPressed] = true;
break;
@@ -1636,7 +1639,7 @@
// FIXME: for some reason OSystem::KBD_ALT is set sometimes
// possible to a bug in sdl-common.cpp
if (event.kbd.ascii >= 512)
- warning("keyPressed > 512 (%d)", event.kbd.ascii);
+ debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
else
_keyDownMap[event.kbd.ascii] = false;
break;
@@ -2075,7 +2078,7 @@
a->moving = 0;
}
} else if (_version >= 7) {
- if (a) {
+ if ((_gameId == GID_DIG) && a) {
// FIXME: This hack mostly is there to fix the tomb/statue room
// in The Dig. What happens there is that when you enter, you are
// placed at object 399, coords (307,141), which is in box 25.
@@ -2489,14 +2492,11 @@
}
_sound->setupSound(); // Reinit sound engine
- if (_gameId == GID_MONKEY || _gameId == GID_MONKEY_SEGA)
- _scummVars[74] = 1225;
-
// Re-run bootscript
int args[16];
memset(args, 0, sizeof(args));
args[0] = _bootParam;
- if (_gameId == GID_MANIAC && _version == 1 && _demoMode)
+ if (_gameId == GID_MANIAC && _demoMode)
runScript(9, 0, 0, args);
else
runScript(1, 0, 0, args);
@@ -2504,7 +2504,7 @@
void ScummEngine::startManiac() {
warning("stub startManiac()");
- displayError("Alright", "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.");
+ displayError(0, "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.");
}
#pragma mark -
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.193.2.2
retrieving revision 1.193.2.3
diff -u -d -r1.193.2.2 -r1.193.2.3
--- string.cpp 3 Apr 2004 23:01:44 -0000 1.193.2.2
+++ string.cpp 11 Apr 2004 20:56:51 -0000 1.193.2.3
@@ -103,14 +103,14 @@
if (!_haveMsg)
return;
- if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && talkingActor() == 0xFF)) {
+ if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && getTalkingActor() == 0xFF)) {
if ((camera._dest.x / 8) != (camera._cur.x / 8) || camera._cur.x != camera._last.x)
return;
}
a = NULL;
- if (talkingActor() != 0xFF)
- a = derefActorSafe(talkingActor(), "CHARSET_1");
+ if (getTalkingActor() != 0xFF)
+ a = derefActorSafe(getTalkingActor(), "CHARSET_1");
if (a && a->isInCurrentRoom() && _string[0].overhead != 0) {
if (_version <= 5) {
From fingolfin at users.sourceforge.net Sun Apr 11 15:25:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 15:25:00 2004
Subject: [Scummvm-cvs-logs] CVS: tools simon1decr.c,1.4,1.5
Message-ID:
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7477
Modified Files:
simon1decr.c
Log Message:
fix lineends
Index: simon1decr.c
===================================================================
RCS file: /cvsroot/scummvm/tools/simon1decr.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- simon1decr.c 22 May 2003 05:36:05 -0000 1.4
+++ simon1decr.c 11 Apr 2004 22:10:19 -0000 1.5
@@ -1,137 +1,137 @@
-/* Simon1Decr - Decrunch Simon the Sorcerer 1 Amiga (AGA/ECS) graphics and music files
- * Copyright (C) 2003 The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include
-#include
-#include
-
-typedef unsigned int ULONG;
-typedef unsigned char UBYTE;
-
-#define EndGetM32(a) ((((a)[0])<<24)|(((a)[1])<<16)|(((a)[2])<<8)|((a)[3]))
-
-#define SD_GETBIT(var) do { \
- if (!bits--) { s -= 4; if (s < src) return 0; bb=EndGetM32(s); bits=31; } \
- (var) = bb & 1; bb >>= 1; \
-} while (0)
-
-#define SD_GETBITS(var, nbits) do { \
- bc=(nbits); (var)=0; while (bc--) {(var)<<=1; SD_GETBIT(bit); (var)|=bit; } \
-} while (0)
-
-#define SD_TYPE_LITERAL (0)
-#define SD_TYPE_MATCH (1)
-
-int simon_decr(UBYTE *src, UBYTE *dest, ULONG srclen) {
- UBYTE *s = &src[srclen - 4];
- ULONG destlen = EndGetM32(s), bb, x, y;
- UBYTE *d = &dest[destlen], bc, bit, bits, type;
-
- /* initialise bit buffer */
- s -= 4; x = EndGetM32(s); bb = x;
- bits = 0; do { x >>= 1; bits++; } while (x); bits--;
-
- while (d > dest) {
- SD_GETBIT(x);
- if (x) {
- SD_GETBITS(x, 2);
- if (x == 0) { type = SD_TYPE_MATCH; x = 9; y = 2; }
- else if (x == 1) { type = SD_TYPE_MATCH; x = 10; y = 3; }
- else if (x == 2) { type = SD_TYPE_MATCH; x = 12; SD_GETBITS(y, 8); }
- else { type = SD_TYPE_LITERAL; x = 8; y = 8; }
- }
- else {
- SD_GETBIT(x);
- if (x) { type = SD_TYPE_MATCH; x = 8; y = 1; }
- else { type = SD_TYPE_LITERAL; x = 3; y = 0; }
- }
-
- if (type == SD_TYPE_LITERAL) {
- SD_GETBITS(x, x); y += x;
- if ((y + 1) > (d - dest)) return 0; /* overflow? */
- do { SD_GETBITS(x, 8); *--d = x; } while (y-- > 0);
- }
- else {
- if ((y + 1) > (d - dest)) return 0; /* overflow? */
- SD_GETBITS(x, x);
- if ((d + x) > (dest + destlen)) return 0; /* offset overflow? */
- do { d--; *d = d[x]; } while (y-- > 0);
- }
- }
- /* successful decrunch */
- return 1;
-}
-
-ULONG simon_decr_length(UBYTE *src, ULONG srclen) {
- return EndGetM32(&src[srclen - 4]);
-}
-
-
-/* - loadfile(filename) loads a file from disk, and returns a pointer to that
- * loaded file, or returns NULL on failure
- * - call free() on ptr to free memory
- * - size of loaded file is available in global var 'filelen'
- */
-size_t filelen;
-void *loadfile(char *name) {
- void *mem = NULL; FILE *fd;
- if ((fd = fopen(name, "rb"))) {
- if ((fseek(fd, 0, SEEK_END) == 0) && (filelen = ftell(fd))
- && (fseek(fd, 0, SEEK_SET) == 0) && (mem = malloc(filelen))) {
- if (fread(mem, 1, filelen, fd) < filelen) { free(mem); mem = NULL; }
- }
- fclose(fd);
- }
- return mem;
-}
-
-/* - savefile(filename, mem, length) saves [length] bytes from [mem] into
- * the file named by [filename]
- * - returns zero if failed, or non-zero if successful
- */
-int savefile(char *name, void *mem, size_t length) {
- FILE *fd = fopen(name, "wb");
- int ok = fd && (fwrite(mem, 1, length, fd) == length);
- if (fd) fclose(fd);
- return ok;
-}
-
-char filename[256];
-
-int main(int argc, char *argv[]) {
- for (argv++; *argv; argv++) {
- UBYTE *x = (UBYTE *) loadfile(*argv);
- if (x) {
- ULONG decrlen = simon_decr_length(x, (ULONG) filelen);
- UBYTE *out = (UBYTE *) malloc(decrlen);
- if (out) {
- if (simon_decr(x, out, filelen)) {
- strcpy(filename, *argv);
- strcat(filename, ".out");
- savefile(filename, out, decrlen);
- }
- else {
- printf("%s: decrunch error\n", filename);
- }
- free((void *) x);
- }
- }
- }
- return 0;
-}
+/* Simon1Decr - Decrunch Simon the Sorcerer 1 Amiga (AGA/ECS) graphics and music files
+ * Copyright (C) 2003 The ScummVM Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include
+#include
+#include
+
+typedef unsigned int ULONG;
+typedef unsigned char UBYTE;
+
+#define EndGetM32(a) ((((a)[0])<<24)|(((a)[1])<<16)|(((a)[2])<<8)|((a)[3]))
+
+#define SD_GETBIT(var) do { \
+ if (!bits--) { s -= 4; if (s < src) return 0; bb=EndGetM32(s); bits=31; } \
+ (var) = bb & 1; bb >>= 1; \
+} while (0)
+
+#define SD_GETBITS(var, nbits) do { \
+ bc=(nbits); (var)=0; while (bc--) {(var)<<=1; SD_GETBIT(bit); (var)|=bit; } \
+} while (0)
+
+#define SD_TYPE_LITERAL (0)
+#define SD_TYPE_MATCH (1)
+
+int simon_decr(UBYTE *src, UBYTE *dest, ULONG srclen) {
+ UBYTE *s = &src[srclen - 4];
+ ULONG destlen = EndGetM32(s), bb, x, y;
+ UBYTE *d = &dest[destlen], bc, bit, bits, type;
+
+ /* initialise bit buffer */
+ s -= 4; x = EndGetM32(s); bb = x;
+ bits = 0; do { x >>= 1; bits++; } while (x); bits--;
+
+ while (d > dest) {
+ SD_GETBIT(x);
+ if (x) {
+ SD_GETBITS(x, 2);
+ if (x == 0) { type = SD_TYPE_MATCH; x = 9; y = 2; }
+ else if (x == 1) { type = SD_TYPE_MATCH; x = 10; y = 3; }
+ else if (x == 2) { type = SD_TYPE_MATCH; x = 12; SD_GETBITS(y, 8); }
+ else { type = SD_TYPE_LITERAL; x = 8; y = 8; }
+ }
+ else {
+ SD_GETBIT(x);
+ if (x) { type = SD_TYPE_MATCH; x = 8; y = 1; }
+ else { type = SD_TYPE_LITERAL; x = 3; y = 0; }
+ }
+
+ if (type == SD_TYPE_LITERAL) {
+ SD_GETBITS(x, x); y += x;
+ if ((y + 1) > (d - dest)) return 0; /* overflow? */
+ do { SD_GETBITS(x, 8); *--d = x; } while (y-- > 0);
+ }
+ else {
+ if ((y + 1) > (d - dest)) return 0; /* overflow? */
+ SD_GETBITS(x, x);
+ if ((d + x) > (dest + destlen)) return 0; /* offset overflow? */
+ do { d--; *d = d[x]; } while (y-- > 0);
+ }
+ }
+ /* successful decrunch */
+ return 1;
+}
+
+ULONG simon_decr_length(UBYTE *src, ULONG srclen) {
+ return EndGetM32(&src[srclen - 4]);
+}
+
+
+/* - loadfile(filename) loads a file from disk, and returns a pointer to that
+ * loaded file, or returns NULL on failure
+ * - call free() on ptr to free memory
+ * - size of loaded file is available in global var 'filelen'
+ */
+size_t filelen;
+void *loadfile(char *name) {
+ void *mem = NULL; FILE *fd;
+ if ((fd = fopen(name, "rb"))) {
+ if ((fseek(fd, 0, SEEK_END) == 0) && (filelen = ftell(fd))
+ && (fseek(fd, 0, SEEK_SET) == 0) && (mem = malloc(filelen))) {
+ if (fread(mem, 1, filelen, fd) < filelen) { free(mem); mem = NULL; }
+ }
+ fclose(fd);
+ }
+ return mem;
+}
+
+/* - savefile(filename, mem, length) saves [length] bytes from [mem] into
+ * the file named by [filename]
+ * - returns zero if failed, or non-zero if successful
+ */
+int savefile(char *name, void *mem, size_t length) {
+ FILE *fd = fopen(name, "wb");
+ int ok = fd && (fwrite(mem, 1, length, fd) == length);
+ if (fd) fclose(fd);
+ return ok;
+}
+
+char filename[256];
+
+int main(int argc, char *argv[]) {
+ for (argv++; *argv; argv++) {
+ UBYTE *x = (UBYTE *) loadfile(*argv);
+ if (x) {
+ ULONG decrlen = simon_decr_length(x, (ULONG) filelen);
+ UBYTE *out = (UBYTE *) malloc(decrlen);
+ if (out) {
+ if (simon_decr(x, out, filelen)) {
+ strcpy(filename, *argv);
+ strcat(filename, ".out");
+ savefile(filename, out, decrlen);
+ }
+ else {
+ printf("%s: decrunch error\n", filename);
+ }
+ free((void *) x);
+ }
+ }
+ }
+ return 0;
+}
From fingolfin at users.sourceforge.net Sun Apr 11 15:28:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 15:28:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.328,1.329
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7955
Modified Files:
sound.cpp
Log Message:
oops
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- sound.cpp 11 Apr 2004 20:55:46 -0000 1.328
+++ sound.cpp 11 Apr 2004 22:13:20 -0000 1.329
@@ -423,7 +423,7 @@
_talk_sound_mode = 0;
}
- const int act = _vm->talkingActor();
+ const int act = _vm->getTalkingActor();
if ((_sfxMode & 2) && act != 0) {
Actor *a;
bool b, finished;
From fingolfin at users.sourceforge.net Sun Apr 11 15:35:05 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 15:35:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.329,1.330
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9384/scumm
Modified Files:
sound.cpp
Log Message:
Fixing up the mess I made out of the branches
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.329
retrieving revision 1.330
diff -u -d -r1.329 -r1.330
--- sound.cpp 11 Apr 2004 22:13:20 -0000 1.329
+++ sound.cpp 11 Apr 2004 22:20:41 -0000 1.330
@@ -37,6 +37,7 @@
#include "sound/mp3.h"
#include "sound/voc.h"
#include "sound/vorbis.h"
+#include "sound/flac.h"
namespace Scumm {
@@ -49,13 +50,31 @@
};
-Sound::Sound(ScummEngine *parent) {
- memset(this,0,sizeof(Sound)); // palmos
+Sound::Sound(ScummEngine *parent)
+ :
+ _vm(parent),
+ _soundQuePos(0),
+ _soundQue2Pos(0),
+ _sfxFile(0),
+ _offsetTable(0),
+ _numSoundEffects(0),
+ _soundMode(kVOCMode),
+ _talk_sound_a1(0),
+ _talk_sound_a2(0),
+ _talk_sound_b1(0),
+ _talk_sound_b2(0),
+ _talk_sound_mode(0),
+ _talk_sound_frame(0),
+ _mouthSyncMode(false),
+ _endOfMouthSync(false),
+ _curSoundPos(0),
+ _currentCDSound(0),
+ _soundsPaused(false),
+ _sfxMode(0) {
- _vm = parent;
- _currentCDSound = 0;
-
- _sfxFile = 0;
+ memset(_soundQue, 0, sizeof(_soundQue));
+ memset(_soundQue2, 0, sizeof(_soundQue2));
+ memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
}
Sound::~Sound() {
@@ -553,11 +572,11 @@
num = (b - 8) >> 1;
}
- if (offset_table != NULL) {
+ if (_offsetTable != NULL) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
+ result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects,
sizeof(MP3OffsetTable), compareMP3OffsetTable);
if (result == NULL) {
@@ -832,19 +851,28 @@
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- AudioStream *input = 0;
+ AudioStream *input = NULL;
- if (file_size > 0) {
- if (_vorbis_mode) {
+ switch (_soundMode) {
+ case kMP3Mode:
+#ifdef USE_MAD
+ assert(file_size > 0);
+ input = makeMP3Stream(file, file_size);
+#endif
+ break;
+ case kVorbisMode:
#ifdef USE_VORBIS
- input = makeVorbisStream(file, file_size);
+ assert(file_size > 0);
+ input = makeVorbisStream(file, file_size);
#endif
- } else {
-#ifdef USE_MAD
- input = makeMP3Stream(file, file_size);
+ break;
+ case kFlacMode:
+#ifdef USE_FLAC
+ assert(file_size > 0);
+ input = makeFlacStream(file, file_size);
#endif
- }
- } else {
+ break;
+ default:
input = makeVOCStream(_sfxFile);
}
@@ -864,32 +892,51 @@
File *Sound::openSfxFile() {
char buf[256];
File *file = new File();
+ _offsetTable = NULL;
+
+ struct SoundFileExtensions {
+ const char *ext;
+ SoundMode mode;
+ };
+
+ const SoundFileExtensions extensions[] = {
+#ifdef USE_FLAC
+ { "sof", kFlacMode },
+#endif
+#ifdef USE_MAD
+ { "so3", kMP3Mode },
+#endif
+#ifdef USE_VORBIS
+ { "sog", kVorbisMode },
+#endif
+ { "sou", kVOCMode },
+ { 0, kVOCMode }
+ };
/* Try opening the file <_gameName>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
- offset_table = NULL;
-
-#ifdef USE_MAD
- sprintf(buf, "%s.so3", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.so3", _vm->getGameDataPath());
+
+ int i, j;
+ const char *basename[3] = { 0, 0, 0 };
+ basename[0] = _vm->getGameName();
+ basename[1] = "monster";
+
+ for (j = 0; basename[j] && !file->isOpen(); ++j) {
+ for (i = 0; extensions[i].ext; ++i) {
+ sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
+ if (file->open(buf)) {
+ _soundMode = extensions[i].mode;
+ break;
+ }
+ }
}
- if (file->isOpen())
- _vorbis_mode = false;
-#endif
-#ifdef USE_VORBIS
if (!file->isOpen()) {
- sprintf(buf, "%s.sog", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath()))
- file->open("monster.sog", _vm->getGameDataPath());
- if (file->isOpen())
- _vorbis_mode = true;
- }
-#endif
-
- if (file->isOpen()) {
+ sprintf(buf, "%s.tlk", _vm->getGameName());
+ file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
+ _soundMode = kVOCMode;
+ } else if (_soundMode != kVOCMode) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -907,31 +954,21 @@
int size, compressed_offset;
MP3OffsetTable *cur;
compressed_offset = file->readUint32BE();
- offset_table = (MP3OffsetTable *) malloc(compressed_offset);
- num_sound_effects = compressed_offset / 16;
+ _offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
+ _numSoundEffects = compressed_offset / 16;
size = compressed_offset;
- cur = offset_table;
+ cur = _offsetTable;
while (size > 0) {
- cur[0].org_offset = file->readUint32BE();
- cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur[0].num_tags = file->readUint32BE();
- cur[0].compressed_size = file->readUint32BE();
+ cur->org_offset = file->readUint32BE();
+ cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur->num_tags = file->readUint32BE();
+ cur->compressed_size = file->readUint32BE();
size -= 4 * 4;
cur++;
}
- return file;
}
- sprintf(buf, "%s.sou", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.sou", _vm->getGameDataPath());
- }
-
- if (!file->isOpen()) {
- sprintf(buf, "%s.tlk", _vm->getGameName());
- file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
- }
return file;
}
From fingolfin at users.sourceforge.net Sun Apr 11 15:35:11 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 15:35:11 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.320.2.1,1.320.2.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9378/scumm
Modified Files:
Tag: branch-0-6-0
sound.cpp
Log Message:
Fixing up the mess I made out of the branches
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.320.2.1
retrieving revision 1.320.2.2
diff -u -d -r1.320.2.1 -r1.320.2.2
--- sound.cpp 11 Apr 2004 12:32:18 -0000 1.320.2.1
+++ sound.cpp 11 Apr 2004 22:21:09 -0000 1.320.2.2
@@ -37,7 +37,6 @@
#include "sound/mp3.h"
#include "sound/voc.h"
#include "sound/vorbis.h"
-#include "sound/flac.h"
namespace Scumm {
@@ -50,31 +49,13 @@
};
-Sound::Sound(ScummEngine *parent)
- :
- _vm(parent),
- _soundQuePos(0),
- _soundQue2Pos(0),
- _sfxFile(0),
- _offsetTable(0),
- _numSoundEffects(0),
- _soundMode(kVOCMode),
- _talk_sound_a1(0),
- _talk_sound_a2(0),
- _talk_sound_b1(0),
- _talk_sound_b2(0),
- _talk_sound_mode(0),
- _talk_sound_frame(0),
- _mouthSyncMode(false),
- _endOfMouthSync(false),
- _curSoundPos(0),
- _currentCDSound(0),
- _soundsPaused(false),
- _sfxMode(0) {
+Sound::Sound(ScummEngine *parent) {
+ memset(this,0,sizeof(Sound)); // palmos
- memset(_soundQue, 0, sizeof(_soundQue));
- memset(_soundQue2, 0, sizeof(_soundQue2));
- memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
+ _vm = parent;
+ _currentCDSound = 0;
+
+ _sfxFile = 0;
}
Sound::~Sound() {
@@ -572,11 +553,11 @@
num = (b - 8) >> 1;
}
- if (_offsetTable != NULL) {
+ if (offset_table != NULL) {
MP3OffsetTable *result = NULL, key;
key.org_offset = offset;
- result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects,
+ result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
sizeof(MP3OffsetTable), compareMP3OffsetTable);
if (result == NULL) {
@@ -851,28 +832,19 @@
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- AudioStream *input = NULL;
+ AudioStream *input = 0;
- switch (_soundMode) {
- case kMP3Mode:
-#ifdef USE_MAD
- assert(file_size > 0);
- input = makeMP3Stream(file, file_size);
-#endif
- break;
- case kVorbisMode:
+ if (file_size > 0) {
+ if (_vorbis_mode) {
#ifdef USE_VORBIS
- assert(file_size > 0);
- input = makeVorbisStream(file, file_size);
+ input = makeVorbisStream(file, file_size);
#endif
- break;
- case kFlacMode:
-#ifdef USE_FLAC
- assert(file_size > 0);
- input = makeFlacStream(file, file_size);
+ } else {
+#ifdef USE_MAD
+ input = makeMP3Stream(file, file_size);
#endif
- break;
- default:
+ }
+ } else {
input = makeVOCStream(_sfxFile);
}
@@ -892,51 +864,32 @@
File *Sound::openSfxFile() {
char buf[256];
File *file = new File();
- _offsetTable = NULL;
-
- struct SoundFileExtensions {
- const char *ext;
- SoundMode mode;
- };
-
- const SoundFileExtensions extensions[] = {
-#ifdef USE_FLAC
- { "sof", kFlacMode },
-#endif
-#ifdef USE_MAD
- { "so3", kMP3Mode },
-#endif
-#ifdef USE_VORBIS
- { "sog", kVorbisMode },
-#endif
- { "sou", kVOCMode },
- { 0, kVOCMode }
- };
/* Try opening the file <_gameName>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
-
- int i, j;
- const char *basename[3] = { 0, 0, 0 };
- basename[0] = _vm->getGameName();
- basename[1] = "monster";
-
- for (j = 0; basename[j] && !file->isOpen(); ++j) {
- for (i = 0; extensions[i].ext; ++i) {
- sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
- if (file->open(buf)) {
- _soundMode = extensions[i].mode;
- break;
- }
- }
+ offset_table = NULL;
+
+#ifdef USE_MAD
+ sprintf(buf, "%s.so3", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath())) {
+ file->open("monster.so3", _vm->getGameDataPath());
}
+ if (file->isOpen())
+ _vorbis_mode = false;
+#endif
+#ifdef USE_VORBIS
if (!file->isOpen()) {
- sprintf(buf, "%s.tlk", _vm->getGameName());
- file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
- _soundMode = kVOCMode;
- } else if (_soundMode != kVOCMode) {
+ sprintf(buf, "%s.sog", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath()))
+ file->open("monster.sog", _vm->getGameDataPath());
+ if (file->isOpen())
+ _vorbis_mode = true;
+ }
+#endif
+
+ if (file->isOpen()) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -954,21 +907,31 @@
int size, compressed_offset;
MP3OffsetTable *cur;
compressed_offset = file->readUint32BE();
- _offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
- _numSoundEffects = compressed_offset / 16;
+ offset_table = (MP3OffsetTable *) malloc(compressed_offset);
+ num_sound_effects = compressed_offset / 16;
size = compressed_offset;
- cur = _offsetTable;
+ cur = offset_table;
while (size > 0) {
- cur->org_offset = file->readUint32BE();
- cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur->num_tags = file->readUint32BE();
- cur->compressed_size = file->readUint32BE();
+ cur[0].org_offset = file->readUint32BE();
+ cur[0].new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur[0].num_tags = file->readUint32BE();
+ cur[0].compressed_size = file->readUint32BE();
size -= 4 * 4;
cur++;
}
+ return file;
}
+ sprintf(buf, "%s.sou", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath())) {
+ file->open("monster.sou", _vm->getGameDataPath());
+ }
+
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.tlk", _vm->getGameName());
+ file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69);
+ }
return file;
}
From fingolfin at users.sourceforge.net Sun Apr 11 16:34:00 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 16:34:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm boxes.cpp,1.73,1.74
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20309
Modified Files:
boxes.cpp
Log Message:
Workaround for bug #847827 (FOA: Wrong sprite z-order at specific place)
Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- boxes.cpp 6 Jan 2004 12:45:29 -0000 1.73
+++ boxes.cpp 11 Apr 2004 23:19:19 -0000 1.74
@@ -60,8 +60,8 @@
int32 urx, ury;
int32 lrx, lry;
int32 llx, lly;
- uint32 mask; // FIXME - is 'mask' really here?
- uint32 flags; // FIXME - is 'flags' really here?
+ uint32 mask;
+ uint32 flags;
uint32 scaleSlot;
uint32 scale;
uint32 unk2;
@@ -92,6 +92,11 @@
if (!ptr)
return 0;
+ // WORKAROUND for bug #847827: This is a bug in the data files, as it also
+ // occurs with the original engine. We work around it here anyway.
+ if (_gameId == GID_INDY4 && _currentRoom == 225 && _roomResource == 94 && box == 8)
+ return 0;
+
if (_version == 8)
return (byte) FROM_LE_32(ptr->v8.mask);
else if (_version <= 2)
From fingolfin at users.sourceforge.net Sun Apr 11 16:34:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 16:34:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm boxes.cpp,1.73,1.73.2.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20368
Modified Files:
Tag: branch-0-6-0
boxes.cpp
Log Message:
Workaround for bug #847827 (FOA: Wrong sprite z-order at specific place)
Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.73
retrieving revision 1.73.2.1
diff -u -d -r1.73 -r1.73.2.1
--- boxes.cpp 6 Jan 2004 12:45:29 -0000 1.73
+++ boxes.cpp 11 Apr 2004 23:19:39 -0000 1.73.2.1
@@ -60,8 +60,8 @@
int32 urx, ury;
int32 lrx, lry;
int32 llx, lly;
- uint32 mask; // FIXME - is 'mask' really here?
- uint32 flags; // FIXME - is 'flags' really here?
+ uint32 mask;
+ uint32 flags;
uint32 scaleSlot;
uint32 scale;
uint32 unk2;
@@ -92,6 +92,11 @@
if (!ptr)
return 0;
+ // WORKAROUND for bug #847827: This is a bug in the data files, as it also
+ // occurs with the original engine. We work around it here anyway.
+ if (_gameId == GID_INDY4 && _currentRoom == 225 && _roomResource == 94 && box == 8)
+ return 0;
+
if (_version == 8)
return (byte) FROM_LE_32(ptr->v8.mask);
else if (_version <= 2)
From fingolfin at users.sourceforge.net Sun Apr 11 18:34:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 18:34:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/common list.h,1.14,1.15
Message-ID:
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6245
Modified Files:
list.h
Log Message:
simple double linked list template class (completely untested)
Index: list.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/list.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- list.h 9 Apr 2004 15:10:22 -0000 1.14
+++ list.h 12 Apr 2004 01:19:26 -0000 1.15
@@ -26,95 +26,157 @@
namespace Common {
-/*
-TODO: Add a true list class, based on a linked list data structure
-
+/**
+ * Simple double linked list, modelled after the list template of the standard
+ * C++ library.
+ * Warning: as of now, this code is 100% untested.
+ */
template
class List {
protected:
- template
- class Node {
- Node *_prev;
- Node *_next;
- T _data;
- }
-
- template
- class Iterator {
- friend class List;
- private:
- Node *_node;
+ struct NodeBase {
+ NodeBase *_prev;
+ NodeBase *_next;
+ };
- public:
- Node &operator++() {
+ template
+ struct Node : public NodeBase {
+ T2 _data;
+
+ Node(const T2 &x) : _data(x) {}
+ };
+
+ template
+ struct Iterator {
+ NodeBase *_node;
+
+ Iterator(NodeBase *node) : _node(node) {}
+
+ // Prefix inc
+ Iterator &operator++() {
_node = _node->_next;
+ return *this;
+ }
+ // Postfix inc
+ Iterator operator++(int) {
+ Iterator tmp = *this;
+ _node = _node->_next;
+ return tmp;
+ }
+ // Prefix dec
+ Iterator &operator--() {
+ _node = _node->_prev;
+ return *this;
+ }
+ // Postfix dec
+ Iterator operator--(int) {
+ Iterator tmp = *this;
+ _node = _node->_prev;
+ return tmp;
}
-
T& operator*() const {
- return _node->_data;
+ return static_cast*>(_node)->_data;
}
T* operator->() const {
- return &(_node->_data);
+ return &(operator*());
+ }
+
+ bool operator==(const Iterator& x) const {
+ return _node == x._node;
+ }
+
+ bool operator!=(const Iterator& x) const {
+ return _node != x._node;
}
};
- Iterator *_anchor;
+ NodeBase *_anchor;
public:
- typedef Node *iterator;
- typedef const Node *const_iterator;
+ typedef Iterator iterator;
+ typedef const Iterator const_iterator;
public:
- List() : _anchor(...) {}
- List(const List& list) : _anchor(...) {
- ... copy list ...
+ List() {
+ _anchor = new NodeBase;
+ _anchor->_prev = _anchor;
+ _anchor->_next = _anchor;
+ }
+ List(const List& list) {
+ _anchor = new NodeBase;
+ _anchor->_prev = _anchor;
+ _anchor->_next = _anchor;
+
+ insert(begin(), list.begin(), list.end());
}
~List() {
- if (_data)
- delete [] _data;
+ clear();
+ delete _anchor;
}
- void push_back(const T& element) {
- ...
+ void push_front(const T& element) {
+ insert(begin(), element);
}
- void push_back(const List& list) {
- ...
+ void push_back(const T& element) {
+ insert(end(), element);
}
void insert(iterator pos, const T& element) {
- ...
+ NodeBase *newNode = new Node(element);
+
+ newNode->_next = pos._node;
+ newNode->_prev = pos._node->_prev;
+ newNode->_prev->_next = newNode;
+ newNode->_next->_prev = newNode;
}
- void insert(iterator pos, iterator beg, Iterator end) {
- ...
+ template
+ void insert(iterator pos, iterator2 first, iterator2 last) {
+ for (; first != last; ++first)
+ insert(pos, *first);
}
- void erase(iterator beg, Iterator end) {
- ...
+ iterator erase(iterator pos) {
+ assert(pos != end());
+
+ NodeBase *next = pos._node->_next;
+ NodeBase *prev = pos._node->_prev;
+ Node *node = static_cast *>(pos._node);
+ prev->_next = next;
+ next->_prev = prev;
+ delete node;
+ return next;
}
- void remove(const T &val) {
+ iterator erase(iterator first, iterator last) {
+ while (first != last)
+ erase(first++);
+ return last;
}
+// void remove(const T &val) {
+// ...
+// }
+
List& operator =(const List& list) {
- // Careful here: handle self-assignment properly! I.e. situations like
- // List x;
- // ...
- // x = x;
- // In particular, we can't just do this:
- // clear();
- // insert(_first, list.begin(), list.end());
- ...
+ if (this != &list) {
+ // TODO: This could (and should) be optimized, by reusing
+ // the existing nodes...
+ clear();
+ insert(begin(), list.begin(), list.end());
+ }
+
+ return *this;
}
uint size() const {
- int size = 0;
+ int n = 0;
for (const_iterator i = begin(); i != end(); ++i)
- size++;
- return size;
+ ++n;
+ return n;
}
void clear() {
@@ -122,13 +184,12 @@
}
bool isEmpty() const {
- return (_anchor._node == _anchor._node._next);
+ return (_anchor == _anchor->_next);
}
iterator begin() {
- Iterator iter = _anchor;
- return ++iter;
+ return _anchor->_next;
}
iterator end() {
@@ -136,15 +197,13 @@
}
const_iterator begin() const {
- Iterator iter = _anchor;
- return ++iter;
+ return _anchor->_next;
}
const_iterator end() const {
return _anchor;
}
};
-*/
} // End of namespace Common
From fingolfin at users.sourceforge.net Sun Apr 11 18:34:02 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Sun Apr 11 18:34:02 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/test/common array.h,NONE,1.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/test/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6308
Added Files:
array.h
Log Message:
Skeleton unit test for array class
--- NEW FILE: array.h ---
#include
#include "stdafx.h"
#include "common/array.h"
class ArrayTestSuite : public CxxTest::TestSuite
{
public:
void test_isEmpty_clear( void )
{
Common::Array array;
TS_ASSERT( array.isEmpty() );
array.push_back(17);
array.push_back(33);
TS_ASSERT( !array.isEmpty() );
array.clear();
TS_ASSERT( array.isEmpty() );
}
};
From khalek at users.sourceforge.net Sun Apr 11 22:01:07 2004
From: khalek at users.sourceforge.net (Jonathan Gray)
Date: Sun Apr 11 22:01:07 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.75,1.76
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3604
Modified Files:
Makefile
Log Message:
this no longer exists
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- Makefile 9 Apr 2004 01:43:51 -0000 1.75
+++ Makefile 12 Apr 2004 04:47:08 -0000 1.76
@@ -53,7 +53,6 @@
config.mak: $(srcdir)/configure
@echo "You need to run ./configure before you can run make"
@echo "Either you haven't run it before or it has changed."
- @echo "If you cannot run configure, use 'make -f Makefile.noconf'"
@exit 1
scummvmico.o: scummvm.ico
From olki at users.sourceforge.net Mon Apr 12 05:40:06 2004
From: olki at users.sourceforge.net (Oliver Kiehl)
Date: Mon Apr 12 05:40:06 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.432,1.433
Message-ID:
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9196
Modified Files:
simon.cpp
Log Message:
Enable hack for old games too. don't pass larger size on to resfile_read
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.432
retrieving revision 1.433
diff -u -d -r1.432 -r1.433
--- simon.cpp 28 Mar 2004 16:30:49 -0000 1.432
+++ simon.cpp 12 Apr 2004 12:25:51 -0000 1.433
@@ -4304,6 +4304,12 @@
}
byte *SimonEngine::read_vga_from_datfile_2(uint id) {
+ // !!! HACK !!!
+ // allocate more space for text to cope with foreign languages that use
+ // up more space than english. I hope 6400 bytes are enough. This number
+ // is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki
+ int extraBuffer = (id == 5 ? 6400 : 0);
+
if (_game & GF_OLD_BUNDLE) {
File in;
char buf[15];
@@ -4327,10 +4333,10 @@
byte *buffer = new byte[size];
if (in.read(buffer, size) != size)
error("read_vga_from_datfile_2: read failed");
- dst = setup_vga_destination (READ_BE_UINT32 (buffer + size - 4));
+ dst = setup_vga_destination (READ_BE_UINT32(buffer + size - 4) + extraBuffer);
decrunch_file_amiga (buffer, dst, size);
} else {
- dst = setup_vga_destination(size);
+ dst = setup_vga_destination(size + extraBuffer);
if (in.read(dst, size) != size)
error("read_vga_from_datfile_2: read failed");
}
@@ -4342,14 +4348,7 @@
uint32 size = _game_offsets_ptr[id + 1] - offs_a;
byte *dst;
- // !!! HACK !!!
- // allocate more space for text to cope with foreign languages that use
- // up more space than english. I hope 6400 bytes are enough. This number
- // is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki
- if (id == 5)
- size += 6400;
-
- dst = setup_vga_destination(size);
+ dst = setup_vga_destination(size + extraBuffer);
resfile_read(dst, offs_a, size);
return dst;
From kirben at users.sourceforge.net Mon Apr 12 05:44:05 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Mon Apr 12 05:44:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.422.2.1,1.422.2.2
Message-ID:
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10166/simon
Modified Files:
Tag: branch-0-6-0
simon.cpp
Log Message:
Add crash fix from main branch, for long strings in some language versions of Simon1/2.
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.422.2.1
retrieving revision 1.422.2.2
diff -u -d -r1.422.2.1 -r1.422.2.2
--- simon.cpp 26 Feb 2004 12:08:22 -0000 1.422.2.1
+++ simon.cpp 12 Apr 2004 12:29:38 -0000 1.422.2.2
@@ -2557,16 +2557,6 @@
void SimonEngine::add_vga_timer(uint num, byte *code_ptr, uint cur_sprite, uint cur_file) {
VgaTimerEntry *vte;
- // When Simon talks to the Golum about stew in French version of
- // Simon the Sorcerer 1 the code_ptr is at wrong location for
- // sprite 200. This was a bug in the original game, which
- // caused several glitches in this scene.
- // We work around the problem by correcting the code_ptr for sprite
- // 200 in this scene, if it is wrong.
- if (!(_game & GF_SIMON2) && (_language == 2) &&
- (code_ptr - _vga_buffer_pointers[cur_file].vgaFile1 == 4) && (cur_sprite == 200) && (cur_file == 2))
- code_ptr += 0x66;
-
_lock_word |= 1;
for (vte = _vga_timer_list; vte->delay; vte++) {
@@ -4484,6 +4474,12 @@
}
byte *SimonEngine::read_vga_from_datfile_2(uint id) {
+ // !!! HACK !!!
+ // allocate more space for text to cope with foreign languages that use
+ // up more space than english. I hope 6400 bytes are enough. This number
+ // is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki
+ int extraBuffer = (id == 5 ? 6400 : 0);
+
if (_game & GF_OLD_BUNDLE) {
File in;
char buf[15];
@@ -4507,10 +4503,10 @@
byte *buffer = new byte[size];
if (in.read(buffer, size) != size)
error("read_vga_from_datfile_2: read failed");
- dst = setup_vga_destination (READ_BE_UINT32 (buffer + size - 4));
+ dst = setup_vga_destination (READ_BE_UINT32 (buffer + size - 4) + extraBuffer);
decrunch_file_amiga (buffer, dst, size);
} else {
- dst = setup_vga_destination(size);
+ dst = setup_vga_destination(size + extraBuffer);
if (in.read(dst, size) != size)
error("read_vga_from_datfile_2: read failed");
}
@@ -4522,7 +4518,7 @@
uint32 size = _game_offsets_ptr[id + 1] - offs_a;
byte *dst;
- dst = setup_vga_destination(size);
+ dst = setup_vga_destination(size + extraBuffer);
resfile_read(dst, offs_a, size);
return dst;
From kirben at users.sourceforge.net Mon Apr 12 06:05:00 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Mon Apr 12 06:05:00 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.62.2.2,1.62.2.3 configure,1.67.2.2,1.67.2.3 Makefile.mingw,1.36,NONE
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13906
Modified Files:
Tag: branch-0-6-0
Makefile configure
Removed Files:
Tag: branch-0-6-0
Makefile.mingw
Log Message:
Back port mingw configure changes.
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.62.2.2
retrieving revision 1.62.2.3
diff -u -d -r1.62.2.2 -r1.62.2.3
--- Makefile 25 Feb 2004 10:00:07 -0000 1.62.2.2
+++ Makefile 12 Apr 2004 12:50:21 -0000 1.62.2.3
@@ -10,6 +10,7 @@
RM_REC := $(RM) -r
ZIP := zip -q
CP := cp
+WIN32PATH=C:/scummvm
#######################################################################
# Default compilation parameters. Normally don't edit these #
@@ -55,6 +56,9 @@
@echo "If you cannot run configure, use 'make -f Makefile.noconf'"
@exit 1
+scummvmico.o: scummvm.ico
+ windres scummvm.rc scummvmico.o
+
dist:
$(RM) $(ZIPFILE)
$(ZIP) $(ZIPFILE) $(DISTFILES)
@@ -106,4 +110,15 @@
-framework OpenGL -framework AGL -framework QuickTime \
-framework AudioUnit -framework AudioToolbox
+# Special target to create a win32 snapshot binary
+win32dist: scummvm$(EXEEXT)
+ mkdir -p $(WIN32PATH)
+ strip scummvm.exe -o $(WIN32PATH)/scummvm$(EXEEXT)
+ cp COPYING $(WIN32PATH)/copying.txt
+ cp README $(WIN32PATH)/readme.txt
+ cp NEWS $(WIN32PATH)/news.txt
+ cp SDL/README-SDL.txt $(WIN32PATH)
+ cp SDL/lib/SDL.dll $(WIN32PATH)
+ u2d $(WIN32PATH)/*.txt
+
.PHONY: deb bundle test
Index: configure
===================================================================
RCS file: /cvsroot/scummvm/scummvm/configure,v
retrieving revision 1.67.2.2
retrieving revision 1.67.2.3
diff -u -d -r1.67.2.2 -r1.67.2.3
--- configure 17 Mar 2004 01:28:11 -0000 1.67.2.2
+++ configure 12 Apr 2004 12:50:21 -0000 1.67.2.3
@@ -82,9 +82,9 @@
if test -n "$_host"; then
# In cross-compiling mode, we cannot run the result
- eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && rm -f tmp_cxx_compiler tmp_cxx_compiler.cpp
+ eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
else
- eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler tmp_cxx_compiler.cpp
+ eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
fi
}
@@ -159,7 +159,7 @@
exit 1
fi
fi
-rm -f tmp_find_type_with_size tmp_find_type_with_size.cpp
+rm -f tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp
echo $datatype
}
@@ -315,6 +315,19 @@
fi
#
+# Determine extension used for executables
+#
+hosttype=`uname -s`
+case $hosttype in
+ MINGW32* | CYGWIN*)
+ EXEEXT=".exe"
+ ;;
+*)
+ EXEEXT=""
+ ;;
+esac
+
+#
# Determine the C++ compiler
#
printf "Looking for C++ compiler... "
@@ -385,8 +398,16 @@
#
if test "$_cxx_major" -ge "3" ; then
+ hosttype=`uname -s`
+ case $hosttype in
+ MINGW32* | CYGWIN*)
+ CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
+ ;;
+ *)
CXXFLAGS="$CXXFLAGS -ansi -W -Wno-unused-parameter"
- _make_def_HAVE_GCC3='HAVE_GCC3 = 1'
+ ;;
+ esac
+ _make_def_HAVE_GCC3='HAVE_GCC3 = 1'
fi;
#
@@ -472,13 +493,14 @@
CXXFLAGS="$CXXFLAGS -faltivec"
;;
MINGW32*)
- echo "mingw32 not supported by configure script"
- echo "Try 'make -f Makefile.mingw'"
- exit 1
+ DEFINES="$DEFINES -DWIN32"
+ LIBS="$LIBS -lmingw32 -lwinmm"
+ OBJS="$OBJS scummvmico.o"
;;
CYGWIN*)
- echo "cygwin not supported by configure script"
- exit 1
+ DEFINES="$DEFINES -mno-cygwin -DWIN32"
+ LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
+ OBJS="$OBJS scummvmico.o"
;;
# given this is a shell script assume some type of unix
*)
@@ -521,7 +543,7 @@
exit 1
;;
esac
- rm -f tmp_endianess_check tmp_endianess_check.cpp
+ rm -f tmp_endianess_check$EXEEXT tmp_endianess_check.cpp
#
# Check whether memory alignment is required
@@ -791,6 +813,7 @@
BACKEND := $_backend
MODULES += $MODULES
MODULE_DIRS += $MODULE_DIRS
+EXEEXT := $EXEEXT
$_make_def_HAVE_GCC3
$_mak_scumm
--- Makefile.mingw DELETED ---
From kirben at users.sourceforge.net Mon Apr 12 06:06:03 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Mon Apr 12 06:06:03 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm README,1.256.2.5,1.256.2.6
Message-ID:
Update of /cvsroot/scummvm/scummvm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14158
Modified Files:
Tag: branch-0-6-0
README
Log Message:
Back port mingw configure changes
Index: README
===================================================================
RCS file: /cvsroot/scummvm/scummvm/README,v
retrieving revision 1.256.2.5
retrieving revision 1.256.2.6
diff -u -d -r1.256.2.5 -r1.256.2.6
--- README 9 Apr 2004 13:31:10 -0000 1.256.2.5
+++ README 12 Apr 2004 12:51:59 -0000 1.256.2.6
@@ -1012,10 +1012,6 @@
* Type make (or gmake, or gnumake, depending on what GNU make is
called on your system) and hopefully ScummVM will compile for you.
- Mingw - Windows 95/98/ME/NT/2000/XP/2003:
- * Open Makefile.mingw, alter SDL paths and choose compiling options.
- * Type make -f Makefile.mingw, hopefully ScummVM will compile for you.
-
Microsoft Visual C++ 6.0:
* Open the workspace, scummwm.dsw
* Enter the path to the needed libraries and includes in Tools|Options|Directories
From kirben at users.sourceforge.net Mon Apr 12 06:06:05 2004
From: kirben at users.sourceforge.net (Travis Howell)
Date: Mon Apr 12 06:06:05 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/doc 09.tex,1.5,1.5.2.1
Message-ID:
Update of /cvsroot/scummvm/scummvm/doc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14158/doc
Modified Files:
Tag: branch-0-6-0
09.tex
Log Message:
Back port mingw configure changes
Index: 09.tex
===================================================================
RCS file: /cvsroot/scummvm/scummvm/doc/09.tex,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- 09.tex 9 Feb 2004 06:51:04 -0000 1.5
+++ 09.tex 12 Apr 2004 12:52:04 -0000 1.5.2.1
@@ -23,12 +23,6 @@
on what GNU make is called on your system) and hopefully ScummVM will
compile for you.
\end{itemize}
-\subsection{MingW - Windows 5/98/ME/NT/2000/XP/2003}
- \begin{itemize}
- \item Open Makefile.mingw, alter SDL paths and choose compiling
- options.
- \item Type make -f Makefile.mingw, hopefully ScummVM will compile for you.
- \end{itemize}
\subsection{Microsoft Visual C++ 6.0}
\begin{itemize}
\item Open the workspace, scummwm.dsw
From aquadran at users.sourceforge.net Mon Apr 12 06:49:08 2004
From: aquadran at users.sourceforge.net (Pawel Kolodziejski)
Date: Mon Apr 12 06:49:08 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse_script.cpp,1.5,1.6
Message-ID:
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22332
Modified Files:
dimuse_script.cpp
Log Message:
disabled wait in stopAllSounds in imuse digital, it can cause deadlock
Index: dimuse_script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dimuse_script.cpp 11 Apr 2004 14:48:50 -0000 1.5
+++ dimuse_script.cpp 12 Apr 2004 13:34:34 -0000 1.6
@@ -351,6 +351,9 @@
}
}
+ // FIXME: ignore wait, it can cause deadlock, it need better implementaion
+ return;
+
if (waitForStop) {
bool used;
do {
From joostp at users.sourceforge.net Mon Apr 12 08:39:01 2004
From: joostp at users.sourceforge.net (Joost Peters)
Date: Mon Apr 12 08:39:01 2004
Subject: [Scummvm-cvs-logs] CVS: residual lua.cpp,1.61,1.62
Message-ID:
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10800
Modified Files:
lua.cpp
Log Message:
Big Endian fix
Inventory, walking backwards, picking up items, etc. work now
Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- lua.cpp 30 Mar 2004 07:08:40 -0000 1.61
+++ lua.cpp 12 Apr 2004 15:24:25 -0000 1.62
@@ -87,13 +87,6 @@
return static_cast(lua_getuserdata(lua_getparam(num)));
}
-static inline float check_float(int num) {
- float val = luaL_check_number(num);
- val = get_float((const char *)&val);
-
- return val;
-}
-
static inline int check_int(int num) {
double val = luaL_check_number(num);
@@ -352,9 +345,9 @@
static void PutActorAt() {
Actor *act = check_actor(1);
- float x = check_float(2);
- float y = check_float(3);
- float z = check_float(4);
+ float x = luaL_check_number(2);
+ float y = luaL_check_number(3);
+ float z = luaL_check_number(4);
act->setPos(Vector3d(x, y, z));
}
@@ -369,9 +362,9 @@
static void SetActorRot() {
Actor *act = check_actor(1);
- float pitch = check_float(2);
- float yaw = check_float(3);
- float roll = check_float(4);
+ float pitch = luaL_check_number(2);
+ float yaw = luaL_check_number(3);
+ float roll = luaL_check_number(4);
if (getbool(5))
act->turnTo(pitch, yaw, roll);
@@ -415,7 +408,7 @@
static void SetActorWalkRate() {
Actor *act = check_actor(1);
- float rate = check_float(2);
+ float rate = luaL_check_number(2);
act->setWalkRate(rate);
}
@@ -446,9 +439,9 @@
static void WalkActorTo() {
Actor *act = check_actor(1);
- float x = check_float(2);
- float y = check_float(3);
- float z = check_float(4);
+ float x = luaL_check_number(2);
+ float y = luaL_check_number(3);
+ float z = luaL_check_number(4);
act->walkTo(Vector3d(x, y, z));
}
From joostp at users.sourceforge.net Mon Apr 12 08:39:02 2004
From: joostp at users.sourceforge.net (Joost Peters)
Date: Mon Apr 12 08:39:02 2004
Subject: [Scummvm-cvs-logs] CVS: residual/lua/src lundump.c,1.1.1.1,1.2
Message-ID:
Update of /cvsroot/scummvm/residual/lua/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10800/lua/src
Modified Files:
lundump.c
Log Message:
Big Endian fix
Inventory, walking backwards, picking up items, etc. work now
Index: lundump.c
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/src/lundump.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- lundump.c 15 Aug 2003 18:00:40 -0000 1.1.1.1
+++ lundump.c 12 Apr 2004 15:24:25 -0000 1.2
@@ -12,15 +12,28 @@
#include "lstring.h"
#include "lundump.h"
+#include
+
#define LoadBlock(b,size,Z) ezread(Z,b,size)
#define LoadNative(t,Z) LoadBlock(&t,sizeof(t),Z)
-#if ID_NUMBER=='F'
+#if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
#define doLoadNumber(f,Z) LoadNative(f,Z)
#else
#define doLoadNumber(f,Z) f=LoadNumber(Z)
#endif
+
+static float conv_float(const char *data) {
+ const unsigned char *udata = (const unsigned char *)(data);
+ unsigned char fdata[4];
+ fdata[0] = udata[3];
+ fdata[1] = udata[2];
+ fdata[2] = udata[1];
+ fdata[3] = udata[0];
+ return *(const float *)(fdata);
+}
+
static void unexpectedEOZ(ZIO* Z)
{
luaL_verror("unexpected end of file in %s",zname(Z));
@@ -59,9 +72,7 @@
static float LoadFloat(ZIO* Z)
{
unsigned long l=LoadLong(Z);
- float f;
- memcpy(&f,&l,sizeof(f));
- return f;
+ return conv_float((const char *)&l);
}
#endif
From fingolfin at users.sourceforge.net Mon Apr 12 14:31:01 2004
From: fingolfin at users.sourceforge.net (Max Horn)
Date: Mon Apr 12 14:31:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/common scaler.cpp,1.55,1.56
Message-ID:
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21947
Modified Files:
scaler.cpp
Log Message:
Updated to match scale2x 2.0
Index: scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- scaler.cpp 27 Feb 2004 15:52:23 -0000 1.55
+++ scaler.cpp 12 Apr 2004 21:16:32 -0000 1.56
@@ -176,10 +176,18 @@
A = B; B = C; C = *(p - nextlineSrc);
D = E; E = F; F = *(p);
G = H; H = I; I = *(p + nextlineSrc);
- *(q + 0) = D == B && B != F && D != H ? D : E;
- *(q + 1) = B == F && B != D && F != H ? F : E;
- *(q + nextlineDst + 0) = D == H && D != B && H != F ? D : E;
- *(q + nextlineDst + 1) = H == F && D != H && B != F ? F : E;
+
+ if (B != H && D != F) {
+ *(q + 0) = D == B ? D : E;
+ *(q + 1) = B == F ? F : E;
+ *(q + nextlineDst + 0) = D == H ? D : E;
+ *(q + nextlineDst + 1) = H == F ? F : E;
+ } else {
+ *(q + 0) = E;
+ *(q + 1) = E;
+ *(q + nextlineDst + 0) = E;
+ *(q + nextlineDst + 1) = E;
+ }
q += 2;
}
p += nextlineSrc - width;
@@ -216,16 +224,29 @@
A = B; B = C; C = *(p - nextlineSrc);
D = E; E = F; F = *(p);
G = H; H = I; I = *(p + nextlineSrc);
+
+ if (B != H && D != F) {
+ *(q + 0) = D == B ? D : E;
+ *(q + 1) = (D == B && E != C) || (B == F && E != A) ? B : E;
+ *(q + 2) = B == F ? F : E;
+ *(q + nextlineDst + 0) = (D == B && E != G) || (D == B && E != A) ? D : E;
+ *(q + nextlineDst + 1) = E;
+ *(q + nextlineDst + 2) = (B == F && E != I) || (H == F && E != C) ? F : E;
+ *(q + 2 * nextlineDst + 0) = D == H ? D : E;
+ *(q + 2 * nextlineDst + 1) = (D == H && E != I) || (H == F && E != G) ? H : E;
+ *(q + 2 * nextlineDst + 2) = H == F ? F : E;
+ } else {
+ *(q + 0) = E;
+ *(q + 1) = E;
+ *(q + 2) = E;
+ *(q + nextlineDst + 0) = E;
+ *(q + nextlineDst + 1) = E;
+ *(q + nextlineDst + 2) = E;
+ *(q + 2 * nextlineDst + 0) = E;
+ *(q + 2 * nextlineDst + 1) = E;
+ *(q + 2 * nextlineDst + 2) = E;
+ }
- *(q) = D == B && B != F && D != H ? D : E;
- *(q + 1) = E;
- *(q + 2) = B == F && B != D && F != H ? F : E;
- *(q + nextlineDst) = E;
- *(q + nextlineDst + 1) = E;
- *(q + nextlineDst + 2) = E;
- *(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
- *(q + 2 * nextlineDst + 1) = E;
- *(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
q += 3;
}
p += nextlineSrc - width;
From sev at users.sourceforge.net Mon Apr 12 14:56:01 2004
From: sev at users.sourceforge.net (Eugene Sandulenko)
Date: Mon Apr 12 14:56:01 2004
Subject: [Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,NONE,1.1 actionmap.h,NONE,1.1 actionmap_mod.h,NONE,1.1 actor.cpp,NONE,1.1 actor.h,NONE,1.1 actor_mod.h,NONE,1.1 actordata.cpp,NONE,1.1 actordata.h,NONE,1.1 animation.cpp,NONE,1.1 animation.h,NONE,1.1 animation_mod.h,NONE,1.1 cmdline.cpp,NONE,1.1 console.cpp,NONE,1.1 console.h,NONE,1.1 console_mod.h,NONE,1.1 cvar.cpp,NONE,1.1 cvar.h,NONE,1.1 cvar_mod.h,NONE,1.1 events.cpp,NONE,1.1 events.h,NONE,1.1 events_mod.h,NONE,1.1 expr.cpp,NONE,1.1 expr.h,NONE,1.1 font.cpp,NONE,1.1 font.h,NONE,1.1 font_map.cpp,NONE,1.1 font_mod.h,NONE,1.1 game.cpp,NONE,1.1 game.h,NONE,1.1 game_mod.h,NONE,1.1 gfx.cpp,NONE,1.1 gfx.h,NONE,1.1 gfx_mod.h,NONE,1.1 ihnm_introproc.cpp,NONE,1.1 ihnm_introproc.h,NONE,1.1 image.cpp,NONE,1.1 image.h,NONE,1.1 image_mod.h,NONE,1.1 interface.cpp,NONE,1.1 interface.h,NONE,1.1 interface_mod.h,NONE,1.1 isomap.cpp,NONE,1.1 isomap.h,NONE,1.1 isomap_mod.h,NONE,1.1 ite_introproc.cpp,NONE,1.1 ite_introproc.h,NONE,1.1 ite_introproc_mod.h,NONE,1.1 math.cpp,NONE,1.1 math.h,NONE,1.1 math_mod.h,NONE,1.1 misc.cpp,NONE,1.1 objectmap.cpp,NONE,1.1 objectmap.h,NONE,1.1 objectmap_mod.h,NONE,1.1 palanim.cpp,NONE,1.1 palanim.h,NONE,1.1 palanim_mod.h,NONE,1.1 reinherit.h,NONE,1.1 render.cpp,NONE,1.1 render.h,NONE,1.1 render_mod.h,NONE,1.1 rscfile.cpp,NONE,1.1 rscfile.h,NONE,1.1 rscfile_mod.h,NONE,1.1 scene.cpp,NONE,1.1 scene.h,NONE,1.1 scene_mod.h,NONE,1.1 sceneproc.cpp,NONE,1.1 sceneproc.h,NONE,1.1 script.cpp,NONE,1.1 script.h,NONE,1.1 script_mod.h,NONE,1.1 sdata.cpp,NONE,1.1 sdata.h,NONE,1.1 sdebug.cpp,NONE,1.1 sfuncs.cpp,NONE,1.1 sfuncs.h,NONE,1.1 sndres.cpp,NONE,1.1 sndres.h,NONE,1.1 sndres_mod.h,NONE,1.1 sprite.cpp,NONE,1.1 sprite.h,NONE,1.1 sprite_mod.h,NONE,1.1 sstack.cpp,NONE,1.1 sstack.h,NONE,1.1 stack.cpp,NONE,1.1 stack.h,NONE,1.1 stack_mod.h,NONE,1.1 sthread.cpp,NONE,1.1 sthread.h,NONE,1.1 sys_fs.cpp,NONE,1.1 sys_interface.h,NONE,1.1 sysgfx.cpp,NONE,1.1 sysgfx.h,NONE,1.1 sysinput.cpp,NONE,1.1 sysio.cpp,NONE,1.1 sysmusic.cpp,NONE,1.1 syssound.cpp,NONE,1.1 systimer.cpp,NONE,1.1 systimer.h,NONE,1.1 text.cpp,NONE,1.1 text.h,NONE,1.1 text_mod.h,NONE,1.1 transitions.cpp,NONE,1.1 x86_32.h,NONE,1.1 xmidi.cpp,NONE,1.1 xmidi.h,NONE,1.1 xmidi_mod.h,NONE,1.1 ys_binread.cpp,NONE,1.1 ys_binwrite.cpp,NONE,1.1 ys_dl_list.cpp,NONE,1.1 ys_file.cpp,NONE,1.1 yslib.h,NONE,1.1 gamedesc_priv.h,1.3,1.4 module.mk,1.1,1.2 saga.cpp,1.3,1.4 saga.h,1.3,1.4 binread.cpp,1.4,NONE binread.h,1.2,NONE gamedesc.cpp,1.6,NONE gamedesc.h,1.4,NONE resfile.cpp,1.5,NONE resfile.h,1.3,NONE resnames.h,1.2,NONE
Message-ID:
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25930
Modified Files:
gamedesc_priv.h module.mk saga.cpp saga.h
Added Files:
actionmap.cpp actionmap.h actionmap_mod.h actor.cpp actor.h
actor_mod.h actordata.cpp actordata.h animation.cpp
animation.h animation_mod.h cmdline.cpp console.cpp console.h
console_mod.h cvar.cpp cvar.h cvar_mod.h events.cpp events.h
events_mod.h expr.cpp expr.h font.cpp font.h font_map.cpp
font_mod.h game.cpp game.h game_mod.h gfx.cpp gfx.h gfx_mod.h
ihnm_introproc.cpp ihnm_introproc.h image.cpp image.h
image_mod.h interface.cpp interface.h interface_mod.h
isomap.cpp isomap.h isomap_mod.h ite_introproc.cpp
ite_introproc.h ite_introproc_mod.h math.cpp math.h math_mod.h
misc.cpp objectmap.cpp objectmap.h objectmap_mod.h palanim.cpp
palanim.h palanim_mod.h reinherit.h render.cpp render.h
render_mod.h rscfile.cpp rscfile.h rscfile_mod.h scene.cpp
scene.h scene_mod.h sceneproc.cpp sceneproc.h script.cpp
script.h script_mod.h sdata.cpp sdata.h sdebug.cpp sfuncs.cpp
sfuncs.h sndres.cpp sndres.h sndres_mod.h sprite.cpp sprite.h
sprite_mod.h sstack.cpp sstack.h stack.cpp stack.h stack_mod.h
sthread.cpp sthread.h sys_fs.cpp sys_interface.h sysgfx.cpp
sysgfx.h sysinput.cpp sysio.cpp sysmusic.cpp syssound.cpp
systimer.cpp systimer.h text.cpp text.h text_mod.h
transitions.cpp x86_32.h xmidi.cpp xmidi.h xmidi_mod.h
ys_binread.cpp ys_binwrite.cpp ys_dl_list.cpp ys_file.cpp
yslib.h
Removed Files:
binread.cpp binread.h gamedesc.cpp gamedesc.h resfile.cpp
resfile.h resnames.h
Log Message:
WIP for SAGA engine.
o text formatting is not consistent with rules, just indent utility is too
dumb for that
o it does not use OSystem, i.e. it runs on direct SDL calls
o it may not even compile on your box
o if you enable it, expect zillions of warnings
o no sound
Now it runs ITE intro as reinherit did
--- NEW FILE: actionmap.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Action map module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "cvar_mod.h"
#include "console_mod.h"
#include "gfx_mod.h"
/*
* Begin module component
\*--------------------------------------------------------------------------*/
#include "actionmap_mod.h"
#include "actionmap.h"
namespace Saga {
static R_ACTIONMAP_INFO ActmapModule;
int ACTIONMAP_Register(void)
{
CVAR_RegisterFunc(CF_action_info,
"action_info", NULL, R_CVAR_NONE, 0, 0);
return R_SUCCESS;
}
int ACTIONMAP_Init(void)
{
R_printf(R_STDOUT, "ACTIONMAP Module: Initializing...\n");
ActmapModule.init = 1;
return R_SUCCESS;
}
int ACTIONMAP_Load(const uchar * exmap_res, size_t exmap_res_len)
/*--------------------------------------------------------------------------*\
* Loads exit map data from specified exit map resource
\*--------------------------------------------------------------------------*/
{
R_ACTIONMAP_ENTRY *exmap_entry;
R_POINT *exmap_pt_tbl;
int exit_ct;
int i, pt;
const uchar *read_p = exmap_res;
size_t read_len = exmap_res_len;
assert(ActmapModule.init);
assert(exmap_res != NULL);
(void)read_len;
/* Load exits
* \*------------------------------------------------------------- */
exit_ct = ys_read_s16_le(read_p, &read_p);
if (exit_ct < 0) {
return R_FAILURE;
}
exmap_entry = (R_ACTIONMAP_ENTRY *)malloc(exit_ct * sizeof *exmap_entry);
if (exmap_entry == NULL) {
R_printf(R_STDERR, "Memory allocation failure.\n");
return R_MEM;
}
for (i = 0; i < exit_ct; i++) {
exmap_entry[i].unknown00 = ys_read_s16_le(read_p, &read_p);
exmap_entry[i].unknown02 = ys_read_s16_le(read_p, &read_p);
exmap_entry[i].exit_scene = ys_read_s16_le(read_p, &read_p);
exmap_entry[i].unknown06 = ys_read_s16_le(read_p, &read_p);
exmap_entry[i].pt_count = ys_read_s16_le(read_p, &read_p);
if (exmap_entry[i].pt_count < 0) {
free(exmap_entry);
return R_FAILURE;
}
exmap_pt_tbl =
(R_POINT *)malloc(exmap_entry[i].pt_count * sizeof *exmap_pt_tbl);
if (exmap_pt_tbl == NULL) {
R_printf(R_STDERR, "Memory allocation failure.\n");
return R_MEM;
}
for (pt = 0; pt < exmap_entry[i].pt_count; pt++) {
exmap_pt_tbl[pt].x = ys_read_s16_le(read_p, &read_p);
exmap_pt_tbl[pt].y = ys_read_s16_le(read_p, &read_p);
}
exmap_entry[i].pt_tbl = exmap_pt_tbl;
}
ActmapModule.exits_loaded = 1;
ActmapModule.n_exits = exit_ct;
ActmapModule.exits_tbl = exmap_entry;
ActmapModule.exmap_res = exmap_res;
ActmapModule.exmap_res_len = exmap_res_len;
return R_SUCCESS;
}
int ACTIONMAP_Free(void)
/*--------------------------------------------------------------------------*\
* Frees the currently loaded exit map data
\*--------------------------------------------------------------------------*/
{
R_ACTIONMAP_ENTRY *exmap_entry;
int i;
if (!ActmapModule.exits_loaded) {
return R_SUCCESS;
}
for (i = 0; i < ActmapModule.n_exits; i++) {
exmap_entry = &ActmapModule.exits_tbl[i];
free(exmap_entry->pt_tbl);
}
free(ActmapModule.exits_tbl);
ActmapModule.exits_loaded = 0;
ActmapModule.exits_tbl = NULL;
ActmapModule.n_exits = 0;
return R_SUCCESS;
}
int ACTIONMAP_Shutdown(void)
/*--------------------------------------------------------------------------*\
\*--------------------------------------------------------------------------*/
{
return R_SUCCESS;
}
int ACTIONMAP_Draw(R_SURFACE * ds, int color)
{
int i;
assert(ActmapModule.init);
if (!ActmapModule.exits_loaded) {
return R_FAILURE;
}
for (i = 0; i < ActmapModule.n_exits; i++) {
if (ActmapModule.exits_tbl[i].pt_count == 2) {
GFX_DrawFrame(ds,
&ActmapModule.exits_tbl[i].pt_tbl[0],
&ActmapModule.exits_tbl[i].pt_tbl[1], color);
} else if (ActmapModule.exits_tbl[i].pt_count > 2) {
GFX_DrawPolyLine(ds,
ActmapModule.exits_tbl[i].pt_tbl,
ActmapModule.exits_tbl[i].pt_count, color);
}
}
return R_SUCCESS;
}
void CF_action_info(int argc, char *argv[])
{
R_POINT *pt;
int i;
int pt_i;
YS_IGNORE_PARAM(argc);
YS_IGNORE_PARAM(argv);
if (!ActmapModule.exits_loaded) {
return;
}
CON_Print("%d exits loaded.\n", ActmapModule.n_exits);
for (i = 0; i < ActmapModule.n_exits; i++) {
CON_Print
("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
i, ActmapModule.exits_tbl[i].exit_scene,
ActmapModule.exits_tbl[i].pt_count,
ActmapModule.exits_tbl[i].unknown00,
ActmapModule.exits_tbl[i].unknown02,
ActmapModule.exits_tbl[i].unknown06);
for (pt_i = 0; pt_i < ActmapModule.exits_tbl[i].pt_count;
pt_i++) {
pt = &ActmapModule.exits_tbl[i].pt_tbl[pt_i];
CON_Print(" pt: %d (%d, %d)", pt_i, pt->x, pt->y);
}
}
return;
}
} // End of namespace Saga
--- NEW FILE: actionmap.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actionmap.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Action map module - private header
Notes:
*/
#ifndef SAGA_ACTIONMAP_H_
#define SAGA_ACTIONMAP_H_
namespace Saga {
typedef struct R_ACTIONMAP_ENTRY_tag {
int unknown00;
int unknown02;
int exit_scene;
int unknown06;
int pt_count;
R_POINT *pt_tbl;
} R_ACTIONMAP_ENTRY;
typedef struct R_ACTIONMAP_INFO_tag {
int init;
int exits_loaded;
int n_exits;
R_ACTIONMAP_ENTRY *exits_tbl;
const uchar *exmap_res;
size_t exmap_res_len;
} R_ACTIONMAP_INFO;
void CF_action_info(int argc, char *argv[]);
} // End of namespace Saga
#endif /* R_ACTIONMAP_H_ */
/* end "r_actionmap.h" */
--- NEW FILE: actionmap_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actionmap_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Action map module - public module header
Notes:
*/
#ifndef SAGA_ACTIONMAP_MOD_H_
#define SAGA_ACTIONMAP_MOD_H_
namespace Saga {
int ACTIONMAP_Register(void);
int ACTIONMAP_Init(void);
int ACTIONMAP_Load(const uchar * exmap_res, size_t exmap_res_len);
int ACTIONMAP_Draw(R_SURFACE * ds, int color);
int ACTIONMAP_Free(void);
int ACTIONMAP_Shutdown(void);
} // End of namespace Saga
#endif /* R_ACTIONMAP_MOD_H_ */
/* end "r_actionmap_mod.h" */
--- NEW FILE: actor.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
[...1417 lines suppressed...]
}
if ((action_n < 0) || (action_n >= actor->action_ct)) {
CON_Print("Invalid action number.");
return;
}
CON_Print("Action frame counts: %d %d %d %d.",
actor->act_tbl[action_n].dir[0].frame_count,
actor->act_tbl[action_n].dir[1].frame_count,
actor->act_tbl[action_n].dir[2].frame_count,
actor->act_tbl[action_n].dir[3].frame_count);
ACTOR_SetAction(index, action_n, ACTION_LOOP);
return;
}
} // End of namespace Saga
--- NEW FILE: actor.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actor.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Actor management module header file
Notes:
Hardcoded actor table present in r_actordata.c
*/
#ifndef SAGA_ACTOR_H__
#define SAGA_ACTOR_H__
namespace Saga {
#define ACTOR_BASE_SPEED 0.25
#define ACTOR_BASE_ZMOD 0.5
#define ACTOR_DEFAULT_ORIENT 2
#define ACTOR_ORIENTMAX 7
#define ACTOR_ACTIONTIME 80
#define ACTOR_DIALOGUE_LETTERTIME 50
#define ACTOR_DIALOGUE_HEIGHT 100
#define R_ACTOR_LMULT 4
enum R_ACTOR_INTENTS {
INTENT_NONE = 0,
INTENT_PATH = 1,
INTENT_SPEAK = 2
};
typedef struct R_ACTORACTIONITEM_tag {
int frame_index;
int frame_count;
} R_ACTORACTIONITEM;
typedef struct R_ACTORACTION_tag {
R_ACTORACTIONITEM dir[4];
} R_ACTORACTION;
typedef struct R_WALKINTENT_tag {
int wi_active;
uint wi_flags;
int wi_init;
int time;
float slope;
int x_dir;
R_POINT org;
R_POINT cur;
R_POINT dst_pt;
YS_DL_LIST *nodelist;
int sem_held;
R_SEMAPHORE *sem;
} R_WALKINTENT;
typedef struct R_WALKNODE_tag {
int calc_flag;
R_POINT node_pt;
} R_WALKNODE;
typedef struct R_SPEAKINTENT_tag {
int si_init;
uint si_flags;
int si_last_action;
YS_DL_LIST *si_diaglist; /* Actor dialogue list */
} R_SPEAKINTENT;
typedef struct R_ACTORINTENT_tag {
int a_itype;
uint a_iflags;
int a_idone;
void *a_data;
} R_ACTORINTENT;
typedef struct R_ACTOR_tag {
int id; /* Actor id */
int name_i; /* Actor's index in actor name string list */
uint flags;
R_POINT a_pt; /* Actor's logical coordinates */
R_POINT s_pt; /* Actor's screen coordinates */
int sl_rn; /* Actor's sprite list res # */
int si_rn; /* Actor's sprite index res # */
R_SPRITELIST *sl_p; /* Actor's sprite list data */
int idle_time;
int orient;
int speaking;
int a_dcolor; /* Actor dialogue color */
/* The actor intent list describes what the actor intends to do;
* multiple intents can be queued. The actor must complete an
* intent before moving on to the next; thus actor movements, esp
* as described from scripts, can be serialized */
YS_DL_LIST *a_intentlist;
/*
R_WALKPATH path;
*/
int def_action;
uint def_action_flags;
int action;
uint action_flags;
int action_frame;
int action_time;
R_ACTORACTION *act_tbl; /* Action lookup table */
int action_ct; /* Number of actions in the action LUT */
YS_DL_NODE *node; /* Actor's node in the actor list */
} R_ACTOR;
typedef struct R_ACTORDIALOGUE_tag {
int d_playing;
char *d_string;
uint d_voice_rn;
long d_time;
int d_sem_held;
R_SEMAPHORE *d_sem;
} R_ACTORDIALOGUE;
typedef struct R_ACTIONTIMES_tag {
int action;
int time;
} R_ACTIONTIMES;
typedef struct R_ACTOR_MODULE_tag {
int init;
R_RSCFILE_CONTEXT *actor_ctxt;
uint count;
int *alias_tbl;
YS_DL_NODE **tbl;
YS_DL_LIST *list;
int err_n;
const char *err_str;
} R_ACTOR_MODULE;
R_ACTOR *LookupActor(int index);
int AddActor(R_ACTOR * actor);
int Z_Compare(const void *elem1, const void *elem2);
int
HandleWalkIntent(R_ACTOR * actor,
R_WALKINTENT * a_walk_int, int *complete_p, int msec);
int
HandleSpeakIntent(R_ACTOR * actor,
R_SPEAKINTENT * a_speakint, int *complete_p, int msec);
int
ACTOR_SetPathNode(R_WALKINTENT * walk_int,
R_POINT * src_pt, R_POINT * dst_pt, R_SEMAPHORE * sem);
int LoadActorSpriteIndex(R_ACTOR * actor, int si_rn, int *last_frame_p);
static void CF_actor_add(int argc, char *argv[]);
static void CF_actor_del(int argc, char *argv[]);
static void CF_actor_move(int argc, char *argv[]);
static void CF_actor_moverel(int argc, char *argv[]);
static void CF_actor_seto(int argc, char *argv[]);
static void CF_actor_setact(int argc, char *argv[]);
} // End of namespace Saga
#endif /* R_ACTOR_H__ */
/* end "r_actor.h" */
--- NEW FILE: actor_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actor_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Actor management module public header file
Notes:
*/
#ifndef SAGA_ACTOR_MOD_H
#define SAGA_ACTOR_MOD_H
namespace Saga {
enum R_ACTOR_WALKFLAGS {
WALK_NONE = 0x00,
WALK_NOREORIENT = 0x01
};
enum R_ACTOR_ORIENTATIONS {
ORIENT_N = 0,
ORIENT_NE = 1,
ORIENT_E = 2,
ORIENT_SE = 3,
ORIENT_S = 4,
ORIENT_SW = 5,
ORIENT_W = 6,
ORIENT_NW = 7
};
enum R_ACTOR_ACTIONS {
ACTION_IDLE = 0,
ACTION_WALK = 1,
ACTION_SPEAK = 2,
ACTION_COUNT
};
enum R_ACTOR_ACTIONFLAGS {
ACTION_NONE = 0x00,
ACTION_LOOP = 0x01
};
int ACTOR_Register(void);
int ACTOR_Init(void);
int ACTOR_Shutdown(void);
int ACTOR_Direct(int msec);
int ACTOR_Create(int actor_id, int x, int y);
int ACTOR_ActorExists(uint actor_id);
int ACTOR_DrawList(void);
int ACTOR_AtoS(R_POINT * logical, const R_POINT * actor);
int ACTOR_StoA(R_POINT * actor, const R_POINT * screen);
int ACTOR_Move(int index, R_POINT * move_pt);
int ACTOR_MoveRelative(int index, R_POINT * move_pt);
int ACTOR_WalkTo(int index, R_POINT * walk_pt, uint flags, R_SEMAPHORE * sem);
int ACTOR_GetActorIndex(uint actor_id);
int ACTOR_Speak(int index, char *d_string, uint d_voice_rn, R_SEMAPHORE * sem);
int ACTOR_SkipDialogue(void);
int ACTOR_GetSpeechTime(const char *d_string, uint d_voice_rn);
int ACTOR_SetOrientation(int index, int orient);
int ACTOR_SetAction(int index, int action_n, uint action_flags);
int ACTOR_SetDefaultAction(int index, int action_n, uint action_flags);
} // End of namespace Saga
#endif /* R_ACTOR_MOD_H */
/* end "r_actor_mod.h" */
--- NEW FILE: actordata.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actordata.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Actor data table
Notes:
*/
#include "actordata.h"
namespace Saga {
/* Lookup table to convert 8 cardinal directions to 4 */
int ActorOrientationLUT[] = { 2, 0, 0, 0, 3, 1, 1, 1 };
R_ACTORTABLE ActorTable[R_ACTORCOUNT] = {
/* namei sl_rn si_rn col
----- ----- ----- --- */
{0, 1, 0, 0, 0, 37, 135, 0, 1, 0, 0, 0},
/* original okk entry
* { 1, 0, 0, 0, 0, 0, 0, 1, 132, 0, 0, 0 }, */
{1, 0, 0, 0, 0, 45, 144, 1, 132, 0, 0, 0},
{2, 0, 0, 0, 0, 48, 143, 2, 161, 0, 0, 0},
{3, 0, 240, 480, 0, 115, 206, 0, 25, 0, 0, 0},
{4, 17, 368, 400, 0, 115, 206, 4, 49, 0, 0, 0},
{5, 11, 552, 412, 0, 54, 152, 1, 171, 0, 0, 0},
{17, 2, 1192, 888, 0, 57, 153, 17, 49, 0, 0, 0},
{17, 2, 816, 1052, 0, 57, 153, 18, 49, 0, 0, 0},
{17, 2, 928, 932, 0, 58, 153, 19, 49, 0, 0, 0},
{17, 2, 1416, 1160, 0, 58, 153, 20, 49, 0, 0, 0},
{19, 49, 1592, 1336, 0, 92, 175, 15, 162, 0, 0, 0},
{20, 49, 744, 824, 0, 63, 156, 19, 112, 0, 4, 4},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{9, 49, 1560, 1624, 0, 94, 147, 18, 132, 0, 4, 4},
{56, 49, 1384, 792, 0, 95, 193, 20, 72, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0},
{18, 32, 764, 448, 0, 55, 150, 0, 48, 10, 4, 4},
{35, 32, 0, 0, 0, 56, 151, 0, 112, 0, 0, 0},
{36, 32, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0},
{32, 32, 0, 0, 0, 91, 190, 0, 98, 0, 0, 0},
{31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0},
{31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0},
{31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0},
{31, 32, 0, 0, 0, 79, 172, 0, 18, 0, 0, 0},
{21, 50, 664, 400, 0, 76, 171, 2, 74, 0, 4, 4},
{21, 50, 892, 428, 0, 76, 171, 2, 74, 0, 4, 4},
{9, 51, 904, 936, 0, 51, 145, 35, 5, 0, 0, 0},
{9, 51, 872, 840, 0, 51, 145, 36, 5, 0, 0, 0},
{9, 51, 1432, 344, 0, 51, 145, 37, 5, 0, 0, 0},
{9, 51, 664, 472, 0, 51, 145, 38, 5, 0, 0, 0},
{10, 51, 1368, 1464, 0, 80, 146, 39, 147, 0, 0, 0},
{10, 51, 1416, 1624, 0, 80, 146, 40, 147, 0, 0, 0},
{10, 51, 1752, 120, 0, 80, 146, 41, 147, 0, 0, 0},
{10, 51, 984, 408, 0, 80, 146, 42, 147, 0, 0, 0},
{14, 52, 856, 376, 0, 82, 174, 8, 73, 0, 0, 0},
{14, 52, 808, 664, 0, 82, 174, 9, 73, 0, 0, 0},
{14, 52, 440, 568, 0, 82, 174, 10, 73, 0, 0, 0},
{14, 52, 392, 776, 0, 82, 174, 11, 73, 0, 0, 0},
{21, 4, 240, 384, 0, 79, 172, 0, 18, 0, 2, 2},
{23, 4, 636, 268, 0, 77, 173, 0, 74, 0, 4, 4},
{22, 4, 900, 320, 0, 78, 179, 0, 60, 0, 4, 4},
{14, 4, 788, 264, 0, 75, 170, 0, 171, 0, 2, 2},
{14, 4, 1088, 264, 0, 75, 170, 0, 171, 0, 6, 6},
{24, 19, 728, 396, 0, 65, 181, 47, 146, 0, 6, 6},
{24, 21, -20, -20, 0, 66, 182, 0, 146, 0, 4, 4},
{25, 19, 372, 464, 0, 67, 183, 73, 146, 0, 2, 2},
{26, 5, 564, 476, 27, 53, 149, 1, 5, 0, 4, 4},
{27, 31, 868, 344, 0, 81, 180, 0, 171, 0, 4, 4},
{28, 73, 568, 380, 0, 83, 176, 30, 120, 0, 4, 4},
{14, 7, 808, 480, 0, 82, 174, 9, 73, 0, 0, 0},
{29, 10, 508, 432, 0, 84, 186, 6, 112, 0, 4, 4},
{33, 10, 676, 420, 0, 86, 184, 6, 171, 0, 4, 4},
{30, 10, 388, 452, 0, 88, 185, 6, 171, 0, 4, 4},
{30, 10, 608, 444, 0, 89, 185, 6, 171, 0, 4, 4},
{31, 10, 192, 468, 0, 90, 189, 6, 171, 0, 4, 4},
{31, 10, 772, 432, 0, 90, 189, 6, 171, 0, 4, 4},
{14, 10, 1340, 444, 0, 87, 188, 6, 171, 0, 4, 4},
{20, 18, 808, 360, 7, 60, 154, 64, 88, 0, 4, 4},
{34, 49, 1128, 1256, 0, 96, 191, 16, 35, 0, 4, 4},
{34, 49, 1384, 792, 0, 93, 192, 17, 66, 0, 4, 4},
{24, 21, 0, -40, 0, 65, 181, 50, 146, 0, 6, 6},
{3, 21, 0, -40, 0, 64, 158, 49, 112, 0, 0, 0},
{17, 21, 0, -40, 0, 62, 157, 74, 48, 0, 0, 0},
{17, 21, 0, -40, 0, 62, 157, 74, 49, 0, 0, 0},
{17, 21, 0, -40, 0, 62, 157, 74, 50, 0, 0, 0},
{12, 244, 1056, 504, 0, 107, 167, 21, 124, 0, 6, 6},
{8, 33, 248, 440, 0, 68, 169, 14, 112, 0, 0, 0},
{11, 23, 308, 424, 0, 106, 166, 6, 48, 0, 2, 2},
{17, 2, 1864, 1336, 0, 58, 153, 21, 49, 0, 0, 0},
{17, 2, 760, 216, 0, 58, 153, 22, 49, 0, 0, 0},
{44, 29, 0, 0, 0, 72, 159, 0, 112, 0, 0, 0},
{45, 29, 0, 0, 0, 71, 163, 0, 146, 0, 6, 6},
{45, 29, 0, 0, 0, 71, 163, 0, 124, 0, 2, 2},
{45, 29, 0, 0, 0, 71, 163, 0, 169, 0, 0, 0},
{7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0},
{7, 257, 552, 408, 0, 70, 165, 0, 4, 0, 2, 2},
{7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0},
{7, 257, 712, 380, 0, 69, 164, 0, 4, 0, 4, 4},
{7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 0, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0},
{7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0},
{47, 30, 0, 0, 0, 102, 199, 1, 186, 0, 0, 0},
{48, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0},
{49, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0},
{50, 69, 0, 0, 0, 111, 203, 16, 67, 0, 0, 0},
{51, 20, 0, 0, 0, 112, 204, 15, 26, 0, 0, 0},
{50, 20, 0, 0, 0, 111, 203, 14, 67, 0, 0, 0},
{49, 20, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0},
{48, 256, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0},
{21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0},
{21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0},
{21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0},
{52, 15, 152, 400, 0, 108, 168, 19, 48, 10, 2, 2},
{47, 251, 640, 360, 0, 113, 205, 5, 186, 10, 2, 2},
{41, 75, 152, 400, 0, 100, 197, 5, 81, 0, 0, 0},
{44, 9, 0, 0, 0, 73, 160, 54, 112, 0, 0, 0},
{0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0},
{1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0},
{0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0},
{1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0},
{53, 42, 640, 400, 0, 104, 201, 8, 141, 0, 0, 0},
{54, 21, -20, -20, 0, 120, 211, 48, 238, 0, 0, 0},
{0, 4, -20, -20, 0, 42, 140, 0, 1, 0, 0, 0},
{26, 5, -20, -20, 27, 52, 148, 1, 5, 0, 4, 4},
{36, 4, -20, -20, 0, 116, 207, 0, 155, 0, 0, 0},
{36, 0, -20, -20, 0, 117, 208, 0, 155, 0, 0, 0},
{46, 252, -20, -20, 0, 74, 162, 29, 34, 0, 0, 0},
{0, 32, -20, -20, 0, 41, 137, 0, 1, 0, 0, 0},
{0, 259, -20, -20, 0, 44, 138, 0, 1, 0, 0, 0},
{0, 5, -20, -20, 0, 43, 139, 0, 1, 0, 0, 0},
{0, 31, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{0, 252, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{0, 15, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{0, 20, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{0, 25, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0},
{0, 50, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0},
{50, 71, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0},
{50, 274, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0},
{50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0},
{50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0},
{50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0},
{57, 272, 909, 909, 48, 121, 213, 0, 171, 0, 0, 0},
{58, 15, -20, -20, 0, 122, 214, 0, 171, 0, 0, 0},
{37, 246, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0},
{38, 246, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0},
{59, 246, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0},
{41, 245, -20, -20, 0, 100, 197, 0, 81, 0, 0, 0},
{47, 250, 640, 360, 0, 114, 205, 0, 186, 10, 2, 2},
{0, 278, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0},
{0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0},
{41, 77, -20, -20, 0, 100, 197, 24, 81, 0, 0, 0},
{37, 261, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0},
{38, 261, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0},
{39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0},
{39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0},
{39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0},
{39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0},
{59, 279, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0},
{38, 279, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0},
{42, 77, -20, -20, 0, 101, 198, 25, 171, 0, 0, 0},
{59, 281, -20, -20, 0, 103, 200, 26, 26, 0, 0, 0},
{59, 279, -20, -20, 0, 123, 215, 0, 1, 0, 0, 0},
{59, 279, -20, -20, 0, 123, 215, 0, 132, 0, 0, 0},
{59, 279, -20, -20, 0, 123, 215, 0, 161, 0, 0, 0},
{54, 279, -20, -20, 0, 120, 211, 0, 133, 0, 6, 6},
{44, 9, -20, -20, 0, 124, 161, 0, 171, 0, 6, 6},
{7, 255, 588, 252, 0, 70, 165, 0, 3, 0, 2, 2},
{7, 255, 696, 252, 0, 70, 165, 0, 5, 0, 6, 6},
{36, 4, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0},
{44, 272, 1124, 1124, 120, 72, 159, 0, 112, 0, 0, 0},
{7, 272, 1124, 1108, 120, 70, 165, 0, 4, 0, 0, 0},
{7, 272, 1108, 1124, 120, 70, 165, 0, 4, 0, 0, 0},
{29, 288, 508, 432, 0, 85, 187, 0, 112, 0, 4, 4},
{29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4},
{29, 0, 508, 432, 0, 84, 186, 0, 98, 0, 4, 4},
{29, 0, 508, 432, 0, 84, 186, 0, 104, 0, 4, 4},
{29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4},
{36, 288, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0},
{1, 27, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 252, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 25, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 259, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 279, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 273, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0},
{1, 26, -20, -20, 0, 8, 178, 0, 171, 0, 0, 0},
{1, 0, -20, -20, 0, 0, 0, 0, 50, 0, 0, 0},
{1, 0, -20, -20, 0, 0, 0, 0, 82, 0, 0, 0},
{1, 0, -20, -20, 0, 0, 0, 0, 35, 0, 0, 0},
{9, 74, -20, -20, 0, 51, 145, 0, 5, 0, 0, 0}
};
} // End of namespace Saga
--- NEW FILE: actordata.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/actordata.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Actor data table header file
Notes:
*/
#ifndef SAGA_ACTORDATA_H
#define SAGA_ACTORDATA_H
namespace Saga {
typedef struct R_ACTORTABLE_tag {
int name_index;
int unknown1;
int unknown2;
int unknown3;
int unknown4;
int spritelist_rn;
int spriteindex_rn;
int unknown5;
unsigned char color;
unsigned char unknown6;
unsigned char unknown7;
unsigned char unknown8;
} R_ACTORTABLE;
#define R_ACTORCOUNT 181
extern int ActorOrientationLUT[];
extern R_ACTORTABLE ActorTable[R_ACTORCOUNT];
} // End of namespace Saga
#endif /* R_ACTORDATA_H */
/* end "r_actordata.h" */
--- NEW FILE: animation.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
[...1153 lines suppressed...]
anim_ct = AnimInfo.anim_count;
CON_Print("There are %d animations loaded:", anim_ct);
for (idx = 0, i = 0; i < anim_ct; idx++, i++) {
while (AnimInfo.anim_tbl[idx] == NULL) {
idx++;
}
CON_Print("%02d: Frames: %u Flags: %u",
i,
AnimInfo.anim_tbl[idx]->n_frames,
AnimInfo.anim_tbl[idx]->flags);
}
return;
}
} // End of namespace Saga
--- NEW FILE: animation.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/animation.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Background animation management module private header
Notes:
*/
#ifndef SAGA_ANIMATION_H_
#define SAGA_ANIMATION_H_
namespace Saga {
#define R_MAX_ANIMATIONS 7
#define R_DEFAULT_FRAME_TIME 140
#define SAGA_FRAME_HEADER_MAGIC 15
#define SAGA_FRAME_HEADER_LEN 12
/* All animation resources begin with an ANIMATION_HEADER
* at 0x00, followed by a RLE code stream
\*--------------------------------------------------------------------------*/
typedef struct R_ANIMATION_HEADER_tag {
uint magic;
uint screen_w;
uint screen_h;
uint unknown06;
uint unknown07;
uint nframes;
uint flags;
uint unknown10;
uint unknown11;
} R_ANIMATION_HEADER;
/* A byte from the code stream of FRAME_HEADER_MAGIC signifies that a
* FRAME_HEADER structure follows
\*--------------------------------------------------------------------------*/
typedef struct R_FRAME_HEADER_tag {
int x_start;
int y_start;
int x_pos;
int y_pos;
int width;
int height;
} R_FRAME_HEADER;
/* Animation info array member */
typedef struct R_ANIMATION_tag {
const uchar *resdata;
size_t resdata_len;
uint n_frames;
size_t *frame_offsets;
uint current_frame;
uint end_frame;
uint stop_frame;
const uchar *cur_frame_p;
size_t cur_frame_len;
int frame_time;
uint play_flag;
int link_flag;
uint link_id;
uint flags;
} R_ANIMATION;
typedef struct R_ANIMINFO_tag {
int initialized;
uint anim_count;
uint anim_limit;
R_ANIMATION *anim_tbl[R_MAX_ANIMATIONS];
} R_ANIMINFO;
int ANIM_GetNumFrames(const uchar * anim_resource, uint * n_frames);
int
ITE_DecodeFrame(const uchar * anim_resource,
size_t frame_offset, uchar * buf, size_t buf_len);
int
IHNM_DecodeFrame(uchar * decode_buf,
size_t decode_buf_len,
const uchar * thisf_p,
size_t thisf_len, const uchar ** nextf_p, size_t * nextf_len);
int
ANIM_GetFrameOffset(const uchar * anim_resource,
uint find_frame, size_t * frame_offset);
static void CF_anim_info(int argc, char *argv[]);
} // End of namespace Saga
#endif /* R_ANIMATION_H_ */
/* end "r_animation.h" */
--- NEW FILE: animation_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/animation_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Background animation management module public header
Notes:
*/
#ifndef SAGA_ANIMATION_MOD_H__
#define SAGA_ANIMATION_MOD_H__
namespace Saga {
enum ANIM_FLAGS {
ANIM_LOOP = 0x01,
ANIM_ENDSCENE = 0x80 /* When animation ends, dispatch scene end event */
};
int ANIM_Register(void);
int ANIM_Init(void);
int ANIM_Shutdown(void);
int
ANIM_Load(const uchar * anim_resdata,
size_t anim_resdata_len, uint * anim_id_p);
int ANIM_Free(uint anim_id);
int ANIM_Play(uint anim_id, int vector_time);
int ANIM_Link(uint anim_id1, uint anim_id2);
int ANIM_SetFlag(uint anim_id, uint flag);
int ANIM_SetFrameTime(uint anim_id, int time);
int ANIM_Reset(void);
} // End of namespace Saga
#endif /* R_ANIMATION_MOD_H__ */
/* end "r_animation_mod.h__ */
--- NEW FILE: cmdline.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/cmdline.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Command line parser
Notes:
*/
#include "reinherit.h"
namespace Saga {
int R_ReadCommandLine(int argc, char **argv, R_EXECINFO * execinfo)
{
int arg;
int intparam;
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-scene") == 0) {
arg++;
if (arg <= argc) {
intparam = atoi(argv[arg]);
execinfo->start_scene = intparam;
if (intparam == 0) {
R_printf(R_STDERR,
"Error: Invalid parameter to '-scene'.\n");
return -1;
}
} else {
R_printf(R_STDERR,
"Error: '-scene' requires a parameter.\n");
return -1;
}
}
if (strcmp(argv[arg], "-gamedir") == 0) {
arg++;
if (arg <= argc) {
execinfo->game_dir = argv[arg];
} else {
R_printf(R_STDERR,
"Error: '-gamedir' requires a parameter.\n");
return -1;
}
}
if (strcmp(argv[arg], "-noverify") == 0) {
execinfo->no_verify = 1;
}
if (strcmp(argv[arg], "-nosound") == 0) {
execinfo->no_sound = 1;
}
if (strcmp(argv[arg], "-nomusic") == 0) {
execinfo->no_music = 1;
}
if (strcmp(argv[arg], "-windowed") == 0) {
execinfo->windowed = 1;
}
}
return 0;
}
} // End of namespace Saga
--- NEW FILE: console.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/console.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Console module
Notes:
*/
#include "reinherit.h"
/*
Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "font_mod.h"
#include "cvar_mod.h"
#include "events_mod.h"
#include "gfx_mod.h"
/*
Begin module
\*--------------------------------------------------------------------------*/
#include "console_mod.h"
#include "console.h"
namespace Saga {
static R_CONSOLEINFO ConInfo = {
0,
R_CON_DEFAULTPOS,
R_CON_DEFAULTLINES,
R_CON_DEFAULTCMDS
};
static char InputBuf[R_CON_INPUTBUF_LEN];
static R_CON_SCROLLBACK ConScrollback;
static R_CON_SCROLLBACK ConHistory;
static int CV_ConResize = R_CON_DEFAULTPOS;
static int CV_ConDroptime = R_CON_DROPTIME;
int CON_Register(void)
{
CVAR_Register_I(&CV_ConResize, "con_h",
NULL, R_CVAR_NONE, 12, R_CON_DEFAULTPOS);
CVAR_Register_I(&CV_ConDroptime, "con_droptime",
NULL, R_CVAR_NONE, 0, 5000);
CVAR_Register_I(&ConInfo.line_max, "con_lines",
NULL, R_CVAR_NONE, 5, 5000);
return R_SUCCESS;
}
int CON_Init(void)
{
return R_SUCCESS;
}
int CON_Shutdown(void)
{
R_printf(R_STDOUT,
"CON_Shutdown(): Deleting console scrollback and command history.\n");
CON_DeleteScroll(&ConScrollback);
CON_DeleteScroll(&ConHistory);
return R_SUCCESS;
}
int CON_Activate(void)
{
R_EVENT con_event;
if (ConInfo.active) {
return R_FAILURE;
}
con_event.type = R_CONTINUOUS_EVENT;
con_event.code = R_CONSOLE_EVENT | R_NODESTROY;
con_event.op = EVENT_ACTIVATE;
con_event.time = 0;
con_event.duration = CV_ConDroptime;
EVENT_Queue(&con_event);
ConInfo.active = 1;
return R_SUCCESS;
}
int CON_Deactivate(void)
{
R_EVENT con_event;
if (!ConInfo.active) {
return R_FAILURE;
}
con_event.type = R_CONTINUOUS_EVENT;
con_event.code = R_CONSOLE_EVENT | R_NODESTROY;
con_event.op = EVENT_DEACTIVATE;
con_event.time = 0;
con_event.duration = CV_ConDroptime;
EVENT_Queue(&con_event);
return R_SUCCESS;
}
int CON_IsActive(void)
{
return ConInfo.active;
}
int CON_Type(int in_char)
/****************************************************************************\
Responsible for processing character input to the console and maintaining
the console input buffer.
Input buffer is processed by EXPR_Parse on enter.
High ASCII characters are ignored.
\****************************************************************************/
{
int input_pos = ConInfo.input_pos;
const char *expr;
int expr_len;
int result;
/*char *lvalue; */
char *rvalue = NULL;
R_CVAR_P con_cvar = NULL;
char *expr_err;
char *err_str;
if (ConInfo.y_pos != ConInfo.y_max) {
/* Ignore keypress until console fully down */
return R_SUCCESS;
}
if ((in_char > 127) || (!in_char)) {
/* Ignore non-ascii codes */
return R_SUCCESS;
}
switch (in_char) {
case '\r':
expr = ConInfo.input_buf;
CON_Print("> %s", ConInfo.input_buf);
expr_len = strlen(ConInfo.input_buf);
result = EXPR_Parse(&expr, &expr_len, &con_cvar, &rvalue);
CON_AddLine(&ConHistory, ConInfo.hist_max, ConInfo.input_buf);
memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
ConInfo.input_pos = 0;
ConInfo.hist_pos = 0;
if (result != R_SUCCESS) {
EXPR_GetError(&expr_err);
CON_Print("Parse error: %s", expr_err);
break;
}
if (rvalue == NULL) {
CVAR_Print(con_cvar);
break;
}
if (CVAR_IsFunc(con_cvar)) {
CVAR_Exec(con_cvar, rvalue);
} else if (CVAR_SetValue(con_cvar, rvalue) != R_SUCCESS) {
CVAR_GetError(&err_str);
CON_Print("Illegal assignment: %s.", err_str);
}
break;
case '\b':
ConInfo.input_buf[input_pos] = 0;
if (input_pos > 0) {
ConInfo.input_pos--;
ConInfo.input_buf[ConInfo.input_pos] = 0;
}
break;
default:
if (input_pos < R_CON_INPUTBUF_LEN) {
ConInfo.input_buf[input_pos] = (char)in_char;
ConInfo.input_pos++;
}
break;
}
if (rvalue)
free(rvalue);
return R_SUCCESS;
}
int CON_Draw(R_SURFACE * ds)
{
int line_y;
R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *start_ptr;
int txt_fgcolor;
int txt_shcolor;
R_RECT fill_rect;
int i;
if (!ConInfo.active) {
return R_FAILURE;
}
if (CV_ConResize != ConInfo.y_max) {
ConInfo.y_max = CV_ConResize;
ConInfo.y_pos = CV_ConResize;
}
fill_rect.x1 = 0;
fill_rect.y1 = 0;
fill_rect.x2 = ds->buf_w - 1;
fill_rect.y2 = ConInfo.y_pos;
GFX_DrawRect(ds, &fill_rect, SYSGFX_MatchColor(R_CONSOLE_BGCOLOR));
txt_fgcolor = SYSGFX_MatchColor(R_CONSOLE_TXTCOLOR);
txt_shcolor = SYSGFX_MatchColor(R_CONSOLE_TXTSHADOW);
FONT_Draw(SMALL_FONT_ID,
ds,
">", 1,
2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
FONT_Draw(SMALL_FONT_ID,
ds,
ConInfo.input_buf, strlen(ConInfo.input_buf),
10, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y = ConInfo.y_pos - (R_CON_INPUT_H + R_CON_LINE_H);
start_ptr = ConScrollback.head;
for (i = 0; i < ConInfo.line_pos; i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
break;
}
}
for (walk_ptr = start_ptr; walk_ptr; walk_ptr = walk_ptr->next) {
FONT_Draw(SMALL_FONT_ID,
ds,
walk_ptr->str_p,
walk_ptr->str_len,
2, line_y, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y -= R_CON_LINE_H;
if (line_y < -R_CON_LINE_H)
break;
}
return R_SUCCESS;
}
int CON_Print(const char *fmt_str, ...)
{
char vsstr_p[R_CON_PRINTFLIMIT + 1];
va_list argptr;
int ret_val;
va_start(argptr, fmt_str);
ret_val = vsprintf(vsstr_p, fmt_str, argptr);
CON_AddLine(&ConScrollback, ConInfo.line_max, vsstr_p);
va_end(argptr);
ConInfo.line_pos = 0;
return ret_val;
}
int CON_CmdUp(void)
{
R_CONSOLE_LINE *start_ptr = ConHistory.head;
int i;
if (!start_ptr) {
return R_SUCCESS;
}
if (ConInfo.hist_pos < ConHistory.lines) {
ConInfo.hist_pos++;
}
for (i = 1; (i < ConInfo.hist_pos); i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
break;
}
}
memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
strcpy(ConInfo.input_buf, start_ptr->str_p);
ConInfo.input_pos = start_ptr->str_len - 1;
R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos,
ConHistory.lines);
return R_SUCCESS;
}
int CON_CmdDown(void)
{
R_CONSOLE_LINE *start_ptr = ConHistory.head;
int i;
if (ConInfo.hist_pos == 1) {
R_printf(R_STDOUT, "Erased input buffer.");
memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
ConInfo.input_pos = 0;
ConInfo.hist_pos--;
return R_SUCCESS;
} else if (ConInfo.hist_pos) {
ConInfo.hist_pos--;
} else {
return R_SUCCESS;
}
for (i = 1; i < ConInfo.hist_pos; i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
break;
}
}
memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
strcpy(ConInfo.input_buf, start_ptr->str_p);
ConInfo.input_pos = start_ptr->str_len - 1;
R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos,
ConHistory.lines);
return R_SUCCESS;
}
int CON_PageUp(void)
{
int n_lines;
n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
if (ConInfo.line_pos < (ConScrollback.lines - n_lines)) {
ConInfo.line_pos += n_lines;
}
R_printf(R_STDOUT, "Line pos: %d", ConInfo.line_pos);
return R_SUCCESS;
}
int CON_PageDown(void)
{
int n_lines;
n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
if (ConInfo.line_pos > n_lines) {
ConInfo.line_pos -= n_lines;
} else {
ConInfo.line_pos = 0;
}
return R_SUCCESS;
}
int CON_DropConsole(double percent)
{
R_SURFACE *back_buf;
if (percent > 1.0) {
percent = 1.0;
}
back_buf = SYSGFX_GetBackBuffer();
CON_SetDropPos(percent);
CON_Draw(back_buf);
return R_SUCCESS;
}
int CON_RaiseConsole(double percent)
{
R_SURFACE *back_buf;
if (percent >= 1.0) {
percent = 1.0;
ConInfo.active = 0;
}
back_buf = SYSGFX_GetBackBuffer();
CON_SetDropPos(1.0 - percent);
CON_Draw(back_buf);
return R_SUCCESS;
}
static int CON_SetDropPos(double percent)
{
double exp_percent;
if (percent > 1.0)
percent = 1.0;
if (percent < 0.0)
percent = 0.0;
exp_percent = percent * percent;
ConInfo.y_pos = (int)(ConInfo.y_max * exp_percent);
return R_SUCCESS;
}
static int
CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p)
{
int constr_len;
char *newstr_p;
R_CONSOLE_LINE *newline_p;
int del_lines;
int i;
constr_len = strlen(constr_p) + 1;
newstr_p = (char *)malloc(constr_len);
if (newstr_p == NULL) {
return R_MEM;
}
newline_p = (R_CONSOLE_LINE *)malloc(sizeof(R_CONSOLE_LINE));
if (newline_p == NULL) {
return R_MEM;
}
newline_p->next = NULL;
newline_p->prev = NULL;
strcpy(newstr_p, constr_p);
newline_p->str_p = newstr_p;
newline_p->str_len = constr_len;
if (scroll->head == NULL) {
scroll->head = newline_p;
scroll->tail = newline_p;
} else {
scroll->head->prev = newline_p;
newline_p->next = scroll->head;
scroll->head = newline_p;
}
scroll->lines++;
if (scroll->lines > line_max) {
del_lines = scroll->lines - line_max;
for (i = 0; i < del_lines; i++) {
CON_DeleteLine(scroll);
}
}
return R_SUCCESS;
}
static int CON_DeleteLine(R_CON_SCROLLBACK * scroll)
{
R_CONSOLE_LINE *temp_p = scroll->tail;
if (temp_p->prev == NULL) {
scroll->head = NULL;
scroll->tail = NULL;
} else {
temp_p->prev->next = NULL;
scroll->tail = temp_p->prev;
}
if (temp_p->str_p)
free(temp_p->str_p);
free(temp_p);
scroll->lines--;
return R_SUCCESS;
}
static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll)
{
R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *temp_ptr;
for (walk_ptr = scroll->head; walk_ptr; walk_ptr = temp_ptr) {
if (walk_ptr->str_p)
free(walk_ptr->str_p);
temp_ptr = walk_ptr->next;
free(walk_ptr);
}
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: console.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/console.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Console module header file
Notes:
*/
#ifndef SAGA_CONSOLE_H_
#define SAGA_CONSOLE_H_
namespace Saga {
#define R_CON_INPUTBUF_LEN 80
#define R_CONSOLE_BGCOLOR 0x00A0A0A0UL
#define R_CONSOLE_TXTCOLOR 0x00FFFFFFUL
#define R_CONSOLE_TXTSHADOW 0x00202020UL
typedef struct R_CONSOLEINFO_tag {
int active;
int y_max;
int line_max;
int hist_max;
int hist_pos;
int line_pos;
int y_pos;
char *prompt;
int prompt_w;
char input_buf[R_CON_INPUTBUF_LEN + 1];
int input_pos;
} R_CONSOLEINFO;
typedef struct R_CONSOLE_LINE_tag {
struct R_CONSOLE_LINE_tag *next;
struct R_CONSOLE_LINE_tag *prev;
char *str_p;
int str_len;
} R_CONSOLE_LINE;
typedef struct R_CON_SCROLLBACK_tag {
struct R_CONSOLE_LINE_tag *head;
struct R_CONSOLE_LINE_tag *tail;
int lines;
} R_CON_SCROLLBACK;
static int
CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p);
static int CON_DeleteLine(R_CON_SCROLLBACK * scroll);
static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll);
static int CON_SetDropPos(double percent);
#define R_CON_DEFAULTPOS 136
#define R_CON_DEFAULTLINES 100
#define R_CON_DEFAULTCMDS 10
#define R_CON_DROPTIME 400
#define R_CON_PRINTFLIMIT 1024
#define R_CON_LINE_H 10
#define R_CON_INPUT_H 10
} // End of namespace Saga
#endif /* R_CONSOLE_H_ */
/* end "r_console.h" */
--- NEW FILE: console_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/console_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Console module public header file
Notes:
*/
#ifndef SAGA_CONSOLE_MOD_H_
#define SAGA_CONSOLE_MOD_H_
namespace Saga {
int CON_Register(void);
int CON_Init(void);
int CON_Shutdown(void);
int CON_Activate(void);
int CON_Deactivate(void);
int CON_IsActive(void);
int CON_Type(int in_char);
int CON_Draw(R_SURFACE * ds);
int CON_Print(const char *fmt_str, ...);
int CON_CmdUp(void);
int CON_CmdDown(void);
int CON_PageUp(void);
int CON_PageDown(void);
int CON_DropConsole(double percent);
int CON_RaiseConsole(double percent);
} // End of namespace Saga
#endif /* R_CONSOLE_MOD_H_ */
/* end "r_console_mod.h" */
--- NEW FILE: cvar.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/cvar.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Configuration Variable Module
Notes:
*/
#include "reinherit.h"
#include
#include
/*
Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "console_mod.h"
/*
Begin module
\*--------------------------------------------------------------------------*/
#include "cvar_mod.h"
#include "cvar.h"
namespace Saga {
R_CVAR *CVHashTbl[R_CVAR_HASHLEN];
char *CVAR_ErrMsg[] = {
"No Error",
"Not implememented.",
"Memory allocation failed",
"Value overflowed while parsing",
"Invalid numeric constant",
"Value overflows destination type",
"Assignment of negative value to unsigned variable",
"Value outside of specified bounds",
"Invalid string literal",
"Invalid type for assignment",
"Variable is read-only",
"Not a valid function"
};
enum CVAR_Errors {
CVERR_NONE,
CVERR_NOTIMPL,
CVERR_MEM,
CVERR_PARSEOVERFLOW,
CVERR_INVALID,
CVERR_DESTOVERFLOW,
CVERR_SIGN,
CVERR_BOUND,
CVERR_STRING,
CVERR_TYPE,
CVERR_READONLY,
CVERR_NOTFUNC
};
static enum CVAR_Errors CVAR_ErrorState;
int CVAR_GetError(char **err_str)
/****************************************************************************\
Returns the appropriate cvar error string
\****************************************************************************/
{
*err_str = CVAR_ErrMsg[CVAR_ErrorState];
return CVAR_ErrorState;
}
int CVAR_Shutdown(void)
/****************************************************************************\
Frees the cvar hash table
\****************************************************************************/
{
R_CVAR *walk_ptr;
R_CVAR *temp_ptr;
int i;
R_printf(R_STDOUT, "CVAR_Shutdown(): Deleting cvar hash table.\n");
for (i = 0; i < R_CVAR_HASHLEN; i++) {
for (walk_ptr = CVHashTbl[i]; walk_ptr; walk_ptr = temp_ptr) {
temp_ptr = walk_ptr->next;
free(walk_ptr);
}
}
return R_SUCCESS;
}
unsigned int CVAR_HashString(const char *str)
/****************************************************************************\
Returns hash index for string 'str'.
Cannot fail.
\****************************************************************************/
{
unsigned int index;
for (index = 0; *str != '\0'; str++) {
index = *str + 31 * index;
}
return index % R_CVAR_HASHLEN;
}
int CVAR_Add(int index, R_CVAR * cvar)
/****************************************************************************\
Adds a copy of the given cvar into the hash table.
Returns R_SUCCESS if cvar was added, R_MEM if allocation failed.
\****************************************************************************/
{
R_CVAR *new_cvar;
R_CVAR *temp_ptr;
new_cvar = (R_CVAR *)malloc(sizeof(R_CVAR));
if (new_cvar == NULL) {
CVAR_ErrorState = CVERR_MEM;
return R_MEM;
}
memcpy(new_cvar, cvar, sizeof(R_CVAR));
if (CVHashTbl[index] == NULL) {
CVHashTbl[index] = new_cvar;
new_cvar->next = NULL;
} else {
temp_ptr = CVHashTbl[index];
CVHashTbl[index] = new_cvar;
new_cvar->next = temp_ptr;
}
CVAR_ErrorState = CVERR_NONE;
return R_SUCCESS;
}
int CVAR_Exec(R_CVAR_P cvar_func, char *r_value)
/****************************************************************************\
Attempts to execute the specified console function with the given argument
string.
Returns R_FAILURE if cvar_func is not a valid console function
\****************************************************************************/
{
int cf_argc = 0;
char **cf_argv = NULL;
int max_args;
if (cvar_func->type != R_CVAR_FUNC) {
CVAR_ErrorState = CVERR_NOTFUNC;
return R_FAILURE;
}
cf_argc = EXPR_GetArgs(r_value, &cf_argv);
if (cf_argc < cvar_func->t.func.min_args) {
CON_Print("Too few arguments to function.");
if (cf_argv)
free(cf_argv);
return R_FAILURE;
}
max_args = cvar_func->t.func.max_args;
if ((max_args > -1) && (cf_argc > max_args)) {
CON_Print("Too many arguments to function.");
if (cf_argv)
free(cf_argv);
return R_FAILURE;
}
/* Call function */
(cvar_func->t.func.func_p) (cf_argc, cf_argv);
if (cf_argv)
free(cf_argv);
return R_SUCCESS;
}
int CVAR_SetValue(R_CVAR_P cvar, char *r_value)
/****************************************************************************\
Attempts to assign the value contained in the string 'r_value' to cvar.
Returns R_FAILURE if there was an error parsing 'r_value'
\****************************************************************************/
{
long int int_param;
unsigned long uint_param;
char *end_p;
ptrdiff_t scan_len;
int r_value_len;
r_value_len = strlen(r_value);
if (cvar->flags & R_CVAR_READONLY) {
CVAR_ErrorState = CVERR_READONLY;
return R_FAILURE;
}
switch (cvar->type) {
case R_CVAR_INT:
int_param = strtol(r_value, &end_p, 10);
if ((int_param == LONG_MIN) || (int_param == LONG_MAX)) {
CVAR_ErrorState = CVERR_PARSEOVERFLOW;
return R_FAILURE;
}
scan_len = end_p - r_value;
if (int_param == 0) {
if (!scan_len || r_value[scan_len - 1] != '0') {
/* strtol() returned 0, but string isn't "0". Invalid. */
CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE;
}
}
if (scan_len != r_value_len) {
/* Entire string wasn't converted...Invalid */
CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE;
}
if ((int_param < CV_INTMIN) || (int_param > CV_INTMAX)) {
/* Overflows destination type */
CVAR_ErrorState = CVERR_DESTOVERFLOW;
return R_FAILURE;
}
/* Ignore bounds if equal */
if (cvar->t.i.lbound != cvar->t.i.ubound) {
if ((int_param < cvar->t.i.lbound) ||
(int_param > cvar->t.i.ubound)) {
/* Value is outside of cvar bounds */
CVAR_ErrorState = CVERR_BOUND;
return R_FAILURE;
}
}
*(cvar->t.i.var_p) = (cv_int_t) int_param;
#ifdef R_CVAR_TRACE
printf("Set cvar to value %ld.\n", int_param);
#endif
break;
case R_CVAR_UINT:
if (*r_value == '-') {
CVAR_ErrorState = CVERR_SIGN;
return R_FAILURE;
}
uint_param = strtoul(r_value, &end_p, 10);
if (uint_param == ULONG_MAX) {
CVAR_ErrorState = CVERR_PARSEOVERFLOW;
return R_FAILURE;
}
scan_len = end_p - r_value;
if (uint_param == 0) {
if (!scan_len || r_value[scan_len - 1] != '0') {
/* strtol() returned 0, but string isn't "0". Invalid. */
CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE;
}
}
if (scan_len != r_value_len) {
/* Entire string wasn't converted...Invalid */
CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE;
}
if (uint_param > CV_UINTMAX) {
/* Overflows destination type */
CVAR_ErrorState = CVERR_DESTOVERFLOW;
return R_FAILURE;
}
/* Ignore bounds if equal */
if (cvar->t.ui.lbound != cvar->t.ui.ubound) {
if ((uint_param < cvar->t.ui.lbound) ||
(uint_param > cvar->t.ui.ubound)) {
/* Value is outside cvar bounds */
CVAR_ErrorState = CVERR_BOUND;
return R_FAILURE;
}
}
*(cvar->t.ui.var_p) = (cv_uint_t) uint_param;
#ifdef R_CVAR_TRACE
printf("Set cvar to value %lu.\n", uint_param);
#endif
break;
case R_CVAR_FLOAT:
CVAR_ErrorState = CVERR_NOTIMPL;
return R_FAILURE;
break;
case R_CVAR_STRING:
if (strrchr(r_value, '\"') != NULL) {
CVAR_ErrorState = CVERR_STRING;
return R_FAILURE;
}
strncpy(cvar->t.s.var_str, r_value, cvar->t.s.ubound);
if (cvar->t.s.ubound < r_value_len) {
cvar->t.s.var_str[cvar->t.s.ubound] = 0;
}
#ifdef R_CVAR_TRACE
printf("Set cvar to value \"%s\".\n", cvar->t.s.var_str);
#endif
break;
default:
CVAR_ErrorState = CVERR_TYPE;
return R_FAILURE;
break;
}
CVAR_ErrorState = CVERR_NONE;
return R_SUCCESS;
}
R_CVAR_P CVAR_Find(const char *var_str)
/****************************************************************************\
Given a cvar name this function returns a pointer to the appropriate
cvar structure or NULL if no match was found.
\****************************************************************************/
{
R_CVAR *walk_ptr;
int hash;
hash = CVAR_HashString(var_str);
#ifdef R_CVAR_TRACE
printf("Performing lookup on hash bucket %d.\n", hash);
#endif
walk_ptr = CVHashTbl[hash];
while (walk_ptr != NULL) {
if (strcmp(var_str, walk_ptr->name) == 0) {
return walk_ptr;
}
walk_ptr = walk_ptr->next;
}
return NULL;
}
int CVAR_IsFunc(R_CVAR_P cvar_func)
{
if (cvar_func->type == R_CVAR_FUNC)
return 1;
else
return 0;
}
int
CVAR_RegisterFunc(cv_func_t func,
const char *func_name,
const char *func_argstr, uint flags, int min_args, int max_args)
/****************************************************************************\
Registers a console function 'cvar'
(could think of a better place to put these...?)
\****************************************************************************/
{
R_CVAR new_cvar;
int hash;
new_cvar.name = func_name;
new_cvar.type = R_CVAR_FUNC;
new_cvar.section = NULL;
new_cvar.flags = flags;
new_cvar.t.func.func_p = func;
new_cvar.t.func.func_argstr = func_argstr;
new_cvar.t.func.min_args = min_args;
new_cvar.t.func.max_args = max_args;
hash = CVAR_HashString(func_name);
#ifdef R_CVAR_TRACE
printf("Added FUNC cvar to hash bucket %d.\n", hash);
#endif
return CVAR_Add(hash, &new_cvar);
}
int
CVAR_Register_I(cv_int_t * var_p,
const char *var_name,
const char *section, uint flags, cv_int_t lbound, cv_int_t ubound)
/****************************************************************************\
Registers an integer type cvar.
\****************************************************************************/
{
R_CVAR new_cvar;
int hash;
new_cvar.name = var_name;
new_cvar.type = R_CVAR_INT;
new_cvar.section = section;
new_cvar.flags = flags;
new_cvar.t.i.var_p = var_p;
new_cvar.t.i.lbound = lbound;
new_cvar.t.i.ubound = ubound;
hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE
printf("Added INT cvar to hash bucket %d.\n", hash);
#endif
return CVAR_Add(hash, &new_cvar);
}
int
CVAR_Register_UI(cv_uint_t * var_p,
const char *var_name,
const char *section, uint flags, cv_uint_t lbound, cv_uint_t ubound)
/****************************************************************************\
Registers an unsigned integer type cvar.
\****************************************************************************/
{
R_CVAR new_cvar;
int hash;
new_cvar.name = var_name;
new_cvar.type = R_CVAR_UINT;
new_cvar.section = section;
new_cvar.flags = flags;
new_cvar.t.ui.var_p = var_p;
new_cvar.t.ui.lbound = lbound;
new_cvar.t.ui.ubound = ubound;
hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE
printf("Added UNSIGNED INT ccvar to hash bucket %d.\n", hash);
#endif
return CVAR_Add(hash, &new_cvar);
}
int
CVAR_Register_F(cv_float_t * var_p,
const char *var_name,
const char *section, uint flags, cv_float_t lbound, cv_float_t ubound)
/****************************************************************************\
Registers a floating point type cvar.
\****************************************************************************/
{
R_CVAR new_cvar;
int hash;
new_cvar.name = var_name;
new_cvar.type = R_CVAR_FLOAT;
new_cvar.section = section;
new_cvar.flags = flags;
new_cvar.t.f.var_p = var_p;
new_cvar.t.f.lbound = lbound;
new_cvar.t.f.ubound = ubound;
hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE
printf("Added FLOAT cvar to hash bucket %d.\n", hash);
#endif
return CVAR_Add(hash, &new_cvar);
}
int
CVAR_Register_S(cv_char_t * var_str,
const char *var_name, const char *section, uint flags, int ubound)
/****************************************************************************\
Registers a string type cvar. Storage must be provided in var_p for 'ubound'
characters plus 1 for NUL char.
\****************************************************************************/
{
R_CVAR new_cvar;
int hash;
new_cvar.name = var_name;
new_cvar.type = R_CVAR_STRING;
new_cvar.section = section;
new_cvar.flags = flags;
new_cvar.t.s.var_str = var_str;
new_cvar.t.s.ubound = ubound;
hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE
printf("Added UNSIGNED INT var to hash bucket %d.\n", hash);
#endif
return CVAR_Add(hash, &new_cvar);
}
int CVAR_Print(R_CVAR_P con_cvar)
/****************************************************************************\
Displays the value and type of the given cvar to the console.
\****************************************************************************/
{
switch (con_cvar->type) {
case R_CVAR_INT:
CON_Print("\"%s\"(i) = %d",
con_cvar->name, *(con_cvar->t.i.var_p));
break;
case R_CVAR_UINT:
CON_Print("\"%s\"(ui) = %u",
con_cvar->name, *(con_cvar->t.ui.var_p));
break;
case R_CVAR_FLOAT:
CON_Print("\"%s\"(ui) = %f",
con_cvar->name, *(con_cvar->t.f.var_p));
break;
case R_CVAR_STRING:
CON_Print("\"%s\"(s) = \"%s\"", con_cvar->name,
con_cvar->t.s.var_str);
break;
case R_CVAR_FUNC:
if (con_cvar->t.func.func_argstr) {
CON_Print("\"%s\"(func) Args: %s", con_cvar->name,
con_cvar->t.func.func_argstr);
} else {
CON_Print("\"%s\"(func) No arguments.",
con_cvar->name);
}
break;
default:
CON_Print("Invalid variable type.\n");
break;
}
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: cvar.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/cvar.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Configuration Variable Module
Notes:
*/
#ifndef SAGA_CVAR_H_
#define SAGA_CVAR_H_
namespace Saga {
#define R_CVAR_HASHLEN 32
typedef struct R_SUBCVAR_INT_tag {
cv_int_t *var_p;
cv_int_t ubound;
cv_int_t lbound;
} R_SUBCVAR_INT;
typedef struct R_SUBCVAR_UINT_tag {
cv_uint_t *var_p;
cv_uint_t ubound;
cv_uint_t lbound;
} R_SUBCVAR_UINT;
typedef struct R_SUBCVAR_FLOAT_tag {
cv_float_t *var_p;
cv_float_t ubound;
cv_float_t lbound;
} R_SUBCVAR_FLOAT;
typedef struct R_SUBCVAR_STRING_tag {
cv_char_t *var_str;
int ubound;
} R_SUBCVAR_STRING;
typedef struct R_SUBCVAR_FUNC_tag {
cv_func_t func_p;
const char *func_argstr;
int min_args;
int max_args;
} R_SUBCVAR_FUNC;
typedef struct R_CVAR_tag {
int type;
const char *name;
const char *section;
uint flags;
union {
R_SUBCVAR_INT i;
R_SUBCVAR_UINT ui;
R_SUBCVAR_FLOAT f;
R_SUBCVAR_STRING s;
R_SUBCVAR_FUNC func;
} t;
struct R_CVAR_tag *next;
} R_CVAR;
} // End of namespace Saga
#endif /* R_CVAR_H_ */
/* end "r_cvar.h" */
--- NEW FILE: cvar_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/cvar_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Configuration variable module public header file
Notes:
*/
#ifndef SAGA_CVAR_MOD_H_
#define SAGA_CVAR_MOD_H_
namespace Saga {
/* Modify these to change base cvar types */
#define CV_INTMAX INT_MAX
#define CV_INTMIN INT_MIN
#define CV_UINTMAX UINT_MAX
typedef int cv_int_t;
typedef unsigned int cv_uint_t;
typedef float cv_float_t;
typedef char cv_char_t;
typedef void (*cv_func_t) (int cv_argc, char *cv_argv[]);
/******************************************/
typedef struct R_CVAR_tag *R_CVAR_P; /* opaque typedef */
typedef enum R_CVAR_TYPES_tag {
R_CVAR_INVALID,
R_CVAR_INT,
R_CVAR_UINT,
R_CVAR_FLOAT,
R_CVAR_STRING,
R_CVAR_FUNC
} R_CVAR_TYPES;
typedef enum R_CVAR_FLAGS_tag {
R_CVAR_NONE,
R_CVAR_READONLY,
R_CVAR_LBOUND,
R_CVAR_UBOUND,
R_CVAR_CFG,
R_CVAR_SECTION
} R_CVAR_FLAGS;
#define R_CVAR_BOUNDED ( R_CVAR_LBOUND | R_CVAR_UBOUND )
int CVAR_Shutdown(void);
R_CVAR_P CVAR_Find(const char *var_str);
int CVAR_SetValue(R_CVAR_P cvar, char *r_value);
int CVAR_Print(R_CVAR_P con_cvar);
int CVAR_GetError(char **err_str);
int CVAR_IsFunc(R_CVAR_P cvar_func);
int CVAR_Exec(R_CVAR_P cvar_func, char *r_value);
int
CVAR_RegisterFunc(cv_func_t func,
const char *func_name,
const char *func_argstr, uint flags, int min_args, int max_args);
int CVAR_Register_I(cv_int_t * var_p,
const char *var_name,
const char *section, uint flags, cv_int_t lbound, cv_int_t ubound);
int CVAR_Register_UI(cv_uint_t * var_p,
const char *var_name,
const char *section, uint flags, cv_uint_t lbound, cv_uint_t ubound);
int CVAR_Register_F(cv_float_t * var_p,
const char *var_name,
const char *section, uint flags, cv_float_t lbound, cv_float_t ubound);
int CVAR_Register_S(cv_char_t * var_str,
const char *var_name, const char *section, uint flags, int ubound);
int EXPR_Parse(const char **exp_pp, int *len, R_CVAR_P * expr_cvar,
char **rvalue);
char *EXPR_ReadString(const char **string_p, int *len, int term_char);
int EXPR_GetError(char **err_str);
int EXPR_GetArgs(char *cmd_str, char ***expr_argv);
} // End of namespace Saga
#endif /* R_CVAR_MOD_H_ */
/* end r_cvar_mod.h_ */
--- NEW FILE: events.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/events.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Event management module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "animation_mod.h"
#include "console_mod.h"
#include "scene_mod.h"
#include "gfx_mod.h"
#include "interface_mod.h"
#include "text_mod.h"
#include "palanim_mod.h"
#include "render_mod.h"
#include "sndres_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "events_mod.h"
#include "events.h"
namespace Saga {
static YS_DL_LIST *EventList;
int EVENT_Init(void)
{
R_printf(R_STDOUT, "Initializing event subsystem...\n");
EventList = ys_dll_create();
return (EventList != NULL) ? R_SUCCESS : R_FAILURE;
}
int EVENT_Shutdown(void)
{
R_printf(R_STDOUT, "Shutting down event subsystem...\n");
EVENT_FreeList();
return R_SUCCESS;
}
int EVENT_HandleEvents(long msec)
/*--------------------------------------------------------------------------*\
* Function to process event list once per frame.
* First advances event times, then processes each event with the appropriate
* handler depending on the type of event.
\*--------------------------------------------------------------------------*/
{
YS_DL_NODE *walk_node;
YS_DL_NODE *next_node;
R_EVENT *event_p;
long delta_time;
int result;
/* Advance event times
* \*------------------------------------------------------------- */
ProcessEventTime(msec);
/* Process each event in list
* \*------------------------------------------------------------- */
for (walk_node = ys_dll_head(EventList);
walk_node != NULL; walk_node = next_node) {
event_p = (R_EVENT *)ys_dll_get_data(walk_node);
/* Save next event in case current event is handled and removed */
next_node = ys_dll_next(walk_node);
/* Call the appropriate event handler for the specific event type */
switch (event_p->type) {
case R_ONESHOT_EVENT:
result = HandleOneShot(event_p);
break;
case R_CONTINUOUS_EVENT:
result = HandleContinuous(event_p);
break;
case R_INTERVAL_EVENT:
result = HandleInterval(event_p);
break;
default:
result = R_EVENT_INVALIDCODE;
R_printf(R_STDERR,
"Invalid event code encountered.\n");
break;
}
/* Process the event appropriately based on result code from
* handler */
if ((result == R_EVENT_DELETE) ||
(result == R_EVENT_INVALIDCODE)) {
/* If there is no event chain, delete the base event. */
if (event_p->chain == NULL) {
ys_dll_delete(walk_node);
} else {
/* If there is an event chain present, move the next event
* in the chain up, adjust it by the previous delta time,
* and reprocess the event by adjusting next_node. */
delta_time = event_p->time;
ys_dll_replace(walk_node, event_p->chain,
sizeof *event_p);
event_p = (R_EVENT *)ys_dll_get_data(walk_node);
event_p->time += delta_time;
next_node = walk_node;
}
} else if (result == R_EVENT_BREAK) {
break;
}
} /* end for () */
return R_SUCCESS;
}
int HandleContinuous(R_EVENT * event)
{
double event_pc = 0.0; /* Event completion percentage */
int event_done = 0;
R_BUFFER_INFO buf_info;
SCENE_BGINFO bg_info;
R_SURFACE *back_buf;
event_pc = ((double)event->duration - event->time) / event->duration;
if (event_pc >= 1.0) {
/* Cap percentage to 100 */
event_pc = 1.0;
event_done = 1;
}
if (event_pc < 0.0) {
/* Event not signaled, skip it */
return R_EVENT_CONTINUE;
} else if (!(event->code & R_SIGNALED)) {
/* Signal event */
event->code |= R_SIGNALED;
event_pc = 0.0;
}
switch (event->code & R_EVENT_MASK) {
case R_PAL_EVENT:
switch (event->op) {
case EVENT_BLACKTOPAL:
back_buf = SYSGFX_GetBackBuffer();
SYSGFX_BlackToPal(back_buf, (PALENTRY *)event->data, event_pc);
break;
case EVENT_PALTOBLACK:
back_buf = SYSGFX_GetBackBuffer();
SYSGFX_PalToBlack(back_buf, (PALENTRY *)event->data, event_pc);
break;
default:
break;
} /* end switch() */
break;
case R_TRANSITION_EVENT:
switch (event->op) {
case EVENT_DISSOLVE:
RENDER_GetBufferInfo(&buf_info);
SCENE_GetBGInfo(&bg_info);
TRANSITION_Dissolve(buf_info.r_bg_buf,
buf_info.r_bg_buf_w,
buf_info.r_bg_buf_h,
buf_info.r_bg_buf_w,
bg_info.bg_buf, bg_info.bg_p, 0, event_pc);
break;
default:
break;
}
break;
case R_CONSOLE_EVENT:
switch (event->op) {
case EVENT_ACTIVATE:
CON_DropConsole(event_pc);
break;
case EVENT_DEACTIVATE:
CON_RaiseConsole(event_pc);
break;
default:
break;
}
break;
default:
break;
} /* end switch( event->event_code ) */
if (event_done) {
return R_EVENT_DELETE;
}
return R_EVENT_CONTINUE;
}
static int HandleOneShot(R_EVENT * event)
{
R_SURFACE *back_buf;
static SCENE_BGINFO bginfo;
if (event->time > 0) {
return R_EVENT_CONTINUE;
}
/* Event has been signaled */
switch (event->code & R_EVENT_MASK) {
case R_TEXT_EVENT:
switch (event->op) {
case EVENT_DISPLAY:
TEXT_SetDisplay((R_TEXTLIST_ENTRY *)event->data, 1);
break;
case EVENT_REMOVE:
{
R_SCENE_INFO scene_info;
SCENE_GetInfo(&scene_info);
TEXT_DeleteEntry(scene_info.text_list,
(R_TEXTLIST_ENTRY *)event->data);
}
break;
default:
break;
}
break;
case R_VOICE_EVENT:
SND_PlayVoice(event->param);
break;
case R_MUSIC_EVENT:
SYSMUSIC_Play(event->param, event->param2);
break;
case R_BG_EVENT:
{
R_BUFFER_INFO rbuf_info;
R_POINT bg_pt;
if (SCENE_GetMode() == R_SCENE_MODE_NORMAL) {
back_buf = SYSGFX_GetBackBuffer();
RENDER_GetBufferInfo(&rbuf_info);
SCENE_GetBGInfo(&bginfo);
bg_pt.x = bginfo.bg_x;
bg_pt.y = bginfo.bg_y;
GFX_BufToBuffer(rbuf_info.r_bg_buf,
rbuf_info.r_bg_buf_w,
rbuf_info.r_bg_buf_h,
bginfo.bg_buf,
bginfo.bg_w, bginfo.bg_h, NULL, &bg_pt);
if (event->param == SET_PALETTE) {
PALENTRY *pal_p;
SCENE_GetBGPal(&pal_p);
SYSGFX_SetPalette(back_buf, pal_p);
}
}
}
break;
case R_ANIM_EVENT:
switch (event->op) {
case EVENT_FRAME:
ANIM_Play(event->param, event->time);
break;
default:
break;
}
break;
case R_SCENE_EVENT:
switch (event->op) {
case EVENT_END:
SCENE_Next();
return R_EVENT_BREAK;
break;
default:
break;
}
break;
case R_PALANIM_EVENT:
switch (event->op) {
case EVENT_CYCLESTART:
PALANIM_CycleStart();
break;
case EVENT_CYCLESTEP:
PALANIM_CycleStep(event->time);
break;
default:
break;
}
break;
case R_INTERFACE_EVENT:
switch (event->op) {
case EVENT_ACTIVATE:
INTERFACE_Activate();
break;
default:
break;
}
break;
default:
break;
} /* end switch( event->code ) */
return R_EVENT_DELETE;
}
static int HandleInterval(R_EVENT * event)
{
YS_IGNORE_PARAM(event);
return R_EVENT_DELETE;
}
R_EVENT *EVENT_Queue(R_EVENT * event)
/*--------------------------------------------------------------------------*\
* Schedules an event in the event list; returns a pointer to the scheduled
* event suitable for chaining if desired.
\*--------------------------------------------------------------------------*/
{
YS_DL_NODE *new_node;
R_EVENT *queued_event;
event->chain = NULL;
new_node = ys_dll_add_tail(EventList, event, sizeof *event);
if (new_node == NULL) {
return NULL;
}
queued_event = (R_EVENT *)ys_dll_get_data(new_node);
InitializeEvent(queued_event);
return queued_event;
}
R_EVENT *EVENT_Chain(R_EVENT * head_event, R_EVENT * add_event)
/*--------------------------------------------------------------------------*\
* Places a 'add_event' on the end of an event chain given by 'head_event'
* (head_event may be in any position in the event chain)
\*--------------------------------------------------------------------------*/
{
R_EVENT *walk_event;
R_EVENT *new_event;
/* Allocate space for new event */
new_event = (R_EVENT *)malloc(sizeof *new_event);
if (new_event == NULL) {
return NULL;
}
/* Copy event data to new event */
*new_event = *add_event;
/* Walk to end of chain */
for (walk_event = head_event;
walk_event->chain != NULL; walk_event = walk_event->chain) {
continue;
}
/* Place new event */
walk_event->chain = new_event;
new_event->chain = NULL;
InitializeEvent(new_event);
return new_event;
}
static int InitializeEvent(R_EVENT * event)
{
switch (event->type) {
case R_ONESHOT_EVENT:
break;
case R_CONTINUOUS_EVENT:
event->time += event->duration;
break;
case R_INTERVAL_EVENT:
break;
default:
return R_FAILURE;
break;
}
return R_SUCCESS;
}
int EVENT_ClearList(void)
/*--------------------------------------------------------------------------*\
* Removes all events from the list except NODESTROY (engine) events
\*--------------------------------------------------------------------------*/
{
YS_DL_NODE *walk_node;
YS_DL_NODE *next_node;
struct R_EVENT_tag *chain_walk;
struct R_EVENT_tag *next_chain;
R_EVENT *event_p;
/* Walk down event list */
for (walk_node = ys_dll_head(EventList);
walk_node != NULL; walk_node = next_node) {
next_node = ys_dll_next(walk_node);
event_p = (R_EVENT *)ys_dll_get_data(walk_node);
/* Only remove events not marked R_NODESTROY (engine events) */
if (!(event_p->code & R_NODESTROY)) {
/* Remove any events chained off this one */
for (chain_walk = event_p->chain;
chain_walk != NULL; chain_walk = next_chain) {
next_chain = chain_walk->chain;
free(chain_walk);
}
ys_dll_delete(walk_node);
}
}
return R_SUCCESS;
}
int EVENT_FreeList(void)
/*--------------------------------------------------------------------------*\
* Removes all events from the list (even R_NODESTROY)
\*--------------------------------------------------------------------------*/
{
YS_DL_NODE *walk_node;
YS_DL_NODE *next_node;
struct R_EVENT_tag *chain_walk;
struct R_EVENT_tag *next_chain;
R_EVENT *event_p;
/* Walk down event list */
for (walk_node = ys_dll_head(EventList);
walk_node != NULL; walk_node = next_node) {
event_p = (R_EVENT *)ys_dll_get_data(walk_node);
/* Remove any events chained off current node */
for (chain_walk = event_p->chain;
chain_walk != NULL; chain_walk = next_chain) {
next_chain = chain_walk->chain;
free(chain_walk);
}
/* Delete current node */
next_node = ys_dll_next(walk_node);
ys_dll_delete(walk_node);
}
return R_SUCCESS;
}
static int ProcessEventTime(long msec)
/*--------------------------------------------------------------------------*\
* Walks down the event list, updating event times by 'msec'.
\*--------------------------------------------------------------------------*/
{
YS_DL_NODE *walk_node;
R_EVENT *event_p;
uint event_count = 0;
for (walk_node = ys_dll_head(EventList);
walk_node != NULL; walk_node = ys_dll_next(walk_node)) {
event_p = (R_EVENT *)ys_dll_get_data(walk_node);
event_p->time -= msec;
event_count++;
if (event_count > R_EVENT_WARNINGCOUNT) {
R_printf(R_STDERR,
"WARNING: Event list exceeds %u.\n");
}
}
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: events.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/events.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Event management module header file
Notes:
*/
#ifndef SAGA_EVENT_H
#define SAGA_EVENT_H
namespace Saga {
#define R_EVENT_DBGLVL R_DEBUG_NONE
#define R_EVENT_WARNINGCOUNT 1000
#define R_EVENT_MASK 0x00FF
enum R_EVENT_STATUSCODE {
R_EVENT_INVALIDCODE = 0,
R_EVENT_DELETE,
R_EVENT_CONTINUE,
R_EVENT_BREAK
};
static int HandleContinuous(R_EVENT * event);
static int HandleOneShot(R_EVENT * event);
static int HandleInterval(R_EVENT * event);
static int ProcessEventTime(long msec);
static int InitializeEvent(R_EVENT * event);
} // End of namespace Saga
#endif /* R_EVENT_H */
--- NEW FILE: events_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/events_mod.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Event module public header
Notes:
*/
#ifndef SAGA_EVENTS_MOD_H
#define SAGA_EVENTS_MOD_H
namespace Saga {
enum R_EVENT_TYPES {
R_ONESHOT_EVENT,
R_CONTINUOUS_EVENT,
R_INTERVAL_EVENT
};
enum R_EVENT_FLAGS {
R_SIGNALED = 0x8000,
R_NODESTROY = 0x4000
};
enum R_EVENT_CODES {
R_BG_EVENT = 1,
R_ANIM_EVENT,
R_MUSIC_EVENT,
R_VOICE_EVENT,
R_SOUND_EVENT,
R_SCENE_EVENT,
R_TEXT_EVENT,
R_PAL_EVENT,
R_PALANIM_EVENT,
R_TRANSITION_EVENT,
R_INTERFACE_EVENT,
R_CONSOLE_EVENT,
R_ACTOR_EVENT
};
enum R_EVENT_OPS {
/* INSTANTANEOUS events
* \*------------------------------------------------------------- */
/* BG events */
EVENT_DISPLAY = 1,
/* ANIM events */
EVENT_FRAME = 1,
/* MUISC & SOUND events */
EVENT_PLAY = 1,
EVENT_STOP = 2,
/* SCENE events */
EVENT_END = 2,
/* TEXT events */
EVENT_HIDE = 2,
EVENT_REMOVE = 3,
/* PALANIM events */
EVENT_CYCLESTART = 1,
EVENT_CYCLESTEP = 2,
/* INTERFACE events */
EVENT_ACTIVATE = 1,
EVENT_DEACTIVATE,
/* ACTOR events */
EVENT_MOVE = 1,
/* CONTINUOUS events
* \*------------------------------------------------------------- */
/* PALETTE events */
EVENT_PALTOBLACK = 1,
EVENT_BLACKTOPAL = 2,
/* TRANSITION events */
EVENT_DISSOLVE = 1
};
enum R_EVENT_PARAMS {
NO_SET_PALETTE,
SET_PALETTE
};
typedef struct R_EVENT_tag {
unsigned int type;
unsigned int code; /* Event operation category & flags */
int op; /* Event operation */
long param; /* Optional event parameter */
long param2;
void *data; /* Optional event data */
long time; /* Elapsed time until event */
long duration; /* Duration of event */
long d_reserved;
struct R_EVENT_tag *chain; /* Event chain
* (For consecutive events) */
} R_EVENT;
int EVENT_Init(void);
int EVENT_Shutdown(void);
int EVENT_HandleEvents(long msec);
int EVENT_ClearList(void);
int EVENT_FreeList(void);
R_EVENT *EVENT_Queue(R_EVENT * event);
R_EVENT *EVENT_Chain(R_EVENT * head_event, R_EVENT * add_event);
} // End of namespace Saga
#endif /* R_EVENTS_MOD_H */
--- NEW FILE: expr.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/expr.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Expression parsing module, and string handling functions
Notes:
EXPR_ParseArgs() lifted wholesale from SDL win32 initialization code by
Sam Lantinga
*/
#include "reinherit.h"
/*
Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "cvar_mod.h"
/*
Begin module
\*--------------------------------------------------------------------------*/
#include "expr.h"
namespace Saga {
char *EXPR_ErrMsg[] = {
"Invalid error state.",
"No Error",
"Memory allocation failed",
"Illegal variable name",
"Expected \'=\' or \'(\' in expression",
"Expected \'(\' in function call",
"Illegal \'(\', identifier is not function",
"Expected a value to assign",
"Unterminated string literal",
"Unmatched parenthesis in function call",
"Error reading value string",
"Expected a number or boolean",
"Unknown variable or function"
};
enum EXPR_Errors {
EXERR_ASSERT,
EXERR_NONE,
EXERR_MEM,
EXERR_ILLEGAL,
EXERR_EXPR,
EXERR_FUNC,
EXERR_NOTFUNC,
EXERR_RVALUE,
EXERR_LITERAL,
EXERR_PAREN,
EXERR_STRING,
EXERR_NUMBER,
EXERR_NOTFOUND
};
static enum EXPR_Errors EXPR_ErrorState;
int EXPR_GetError(char **err_str)
/*--------------------------------------------------------------------------*\
Returns the appropriate expression parser error string given an error code.
\*--------------------------------------------------------------------------*/
{
*err_str = EXPR_ErrMsg[EXPR_ErrorState];
return EXPR_ErrorState;
}
int
EXPR_Parse(const char **exp_pp, int *len, R_CVAR_P * expr_cvar, char **rvalue)
/*--------------------------------------------------------------------------*\
Parses an interactive expression.
Sets 'expr_cvar' to the cvar/cfunction identifier input by the user, and
'rvalue' to the corresponding rvalue ( in an expression ) or argument string
( in a function call ).
Memory pointed to by rvalue after return must be explicitly freed by the
caller.
\*--------------------------------------------------------------------------*/
{
int i;
int in_char;
int equ_offset;
int rvalue_offset;
char *lvalue_str;
int lvalue_len;
char *rvalue_str;
int rvalue_len;
const char *scan_p;
int scan_len;
const char *expr_p;
int expr_len;
int test_char = '\0';
int have_func = 0;
R_CVAR_P lvalue_cvar;
expr_p = *exp_pp;
expr_len = strlen(*exp_pp);
scan_p = *exp_pp;
scan_len = expr_len;
/**lvalue = NULL;*/
*rvalue = NULL;
EXPR_ErrorState = EXERR_ASSERT;
for (i = 0; i <= scan_len; i++, scan_p++) {
in_char = *scan_p;
if ((i == 0) && isdigit(in_char)) {
/* First character of a valid identifier cannot be a digit */
EXPR_ErrorState = EXERR_ILLEGAL;
return R_FAILURE;
}
/* If we reach a character that isn't valid in an identifier... */
if ((!isalnum(in_char)) && ((in_char != '_'))) {
/* then eat remaining whitespace, if any */
equ_offset = strspn(scan_p, R_EXPR_WHITESPACE);
test_char = scan_p[equ_offset];
/* and test for the only valid characters after an identifier */
if ((test_char != '=') &&
(test_char != '\0') && (test_char != '(')) {
if ((equ_offset == 0)
&& ((scan_p - expr_p) != expr_len)) {
EXPR_ErrorState = EXERR_ILLEGAL;
} else {
EXPR_ErrorState = EXERR_EXPR;
}
return R_FAILURE;
}
break;
}
}
lvalue_len = (scan_p - expr_p);
lvalue_str = (char *)malloc(lvalue_len + 1);
if (lvalue_str == NULL) {
EXPR_ErrorState = EXERR_MEM;
return R_FAILURE;
}
strncpy(lvalue_str, expr_p, lvalue_len);
lvalue_str[lvalue_len] = 0;
/* We now have the lvalue, so attempt to find it */
lvalue_cvar = CVAR_Find(lvalue_str);
if (lvalue_cvar == NULL) {
EXPR_ErrorState = EXERR_NOTFOUND;
return R_FAILURE;
}
if (lvalue_str) {
free(lvalue_str);
lvalue_str = NULL;
}
/* Skip parsed character, if any */
scan_p += equ_offset + 1;
scan_len = (scan_p - expr_p);
/* Check if the 'cvar' is really a function */
have_func = CVAR_IsFunc(lvalue_cvar);
if (test_char == '(') {
if (have_func) {
rvalue_str =
EXPR_ReadString(&scan_p, &rvalue_len, ')');
if (rvalue_str != NULL) {
/* Successfully read string */
/*CON_Print( "Read function parameters \"%s\".", rvalue_str ); */
*expr_cvar = lvalue_cvar;
*rvalue = rvalue_str;
scan_len = (scan_p - expr_p);
*exp_pp = scan_p;
*len -= scan_len;
EXPR_ErrorState = EXERR_NONE;
return R_SUCCESS;
} else {
EXPR_ErrorState = EXERR_PAREN;
return R_FAILURE;
}
} else {
EXPR_ErrorState = EXERR_NOTFUNC;
return R_FAILURE;
}
}
/* Eat more whitespace */
rvalue_offset = strspn(scan_p, R_EXPR_WHITESPACE);
if (rvalue_offset + i == expr_len) {
/* Only found single lvalue */
*expr_cvar = lvalue_cvar;
*exp_pp = scan_p;
*len -= scan_len;
return R_SUCCESS;
}
scan_p += rvalue_offset;
scan_len = (scan_p - expr_p) + 1;
in_char = *scan_p;
in_char = toupper(in_char);
switch (in_char) {
case '\"':
scan_p++;
scan_len--;
rvalue_str = EXPR_ReadString(&scan_p, &rvalue_len, '\"');
if (rvalue_str != NULL) {
/* Successfully read string */
break;
} else {
EXPR_ErrorState = EXERR_LITERAL;
return R_FAILURE;
}
break;
#if 0
case 'Y': /* Y[es] */
case 'T': /* T[rue] */
break;
case 'N': /* N[o] */
case 'F': /* F[alse] */
break;
#endif
default:
if (isdigit(in_char) || (in_char == '-') || (in_char == '+')) {
rvalue_str = EXPR_ReadString(&scan_p, &rvalue_len, 0);
if (rvalue_str != NULL) {
/* Successfully read string */
break;
} else {
EXPR_ErrorState = EXERR_STRING;
return R_FAILURE;
}
} else {
EXPR_ErrorState = EXERR_NUMBER;
return R_FAILURE;
}
break;
}
*expr_cvar = lvalue_cvar;
*rvalue = rvalue_str;
scan_len = (scan_p - expr_p);
*exp_pp = scan_p;
*len -= scan_len;
EXPR_ErrorState = EXERR_NONE;
return R_SUCCESS;
}
char *EXPR_ReadString(const char **string_p, int *len, int term_char)
/****************************************************************************\
Reads in a string of characters from '*string_p' until 'term_char' is
encountered. If 'term_char' == 0, the function reads characters until
whitespace is encountered.
Upon reading a string, the function modifies *string_p and len based on
the number of characters read.
\****************************************************************************/
{
int string_len;
char *str_p;
char *term_p;
const char *scan_p;
int in_char;
if (term_char > 0) {
term_p = strchr(*string_p, term_char);
if (term_p == NULL) {
return NULL;
}
string_len = (int)(term_p - *string_p);
str_p = (char *)malloc(string_len + 1);
if (str_p == NULL) {
return NULL;
}
strncpy(str_p, *string_p, string_len);
str_p[string_len] = 0;
*string_p += (string_len + 1); /* Add 1 for terminating char */
*len -= (string_len + 1);
} else {
scan_p = *string_p;
string_len = 0;
while (scan_p) {
in_char = *scan_p++;
if (!isspace(in_char)) {
string_len++;
} else if (string_len) {
str_p = (char *)malloc(string_len + 1);
if (str_p == NULL) {
return NULL;
}
strncpy(str_p, *string_p, string_len);
str_p[string_len] = 0;
*string_p += string_len;
*len -= string_len;
break;
} else {
return NULL;
}
}
}
return str_p;
}
int EXPR_GetArgs(char *cmd_str, char ***expr_argv)
/****************************************************************************\
Parses the string 'cmd_str' into argc/argv format, returning argc.
The resulting argv pointers point into the 'cmd_str' string, so any argv
entries should not be used after cmd_str is deallocated.
Memory pointed to by expr_argv must be explicitly freed by the caller.
\****************************************************************************/
{
int expr_argc;
expr_argc = EXPR_ParseArgs(cmd_str, NULL);
*expr_argv = (char **)malloc((expr_argc + 1) * sizeof(**expr_argv));
if (expr_argv == NULL) {
return R_FAILURE;
}
EXPR_ParseArgs(cmd_str, *expr_argv);
return expr_argc;
}
int EXPR_ParseArgs(char *cmd_str, char **argv)
{
char *bufp;
int argc;
argc = 0;
for (bufp = cmd_str; *bufp;) {
/* Skip leading whitespace */
while (isspace(*bufp)) {
++bufp;
}
/* Skip over argument */
if (*bufp == '"') {
++bufp;
if (*bufp) {
if (argv) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while (*bufp && (*bufp != '"')) {
++bufp;
}
} else {
if (*bufp) {
if (argv) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while (*bufp && !isspace(*bufp)) {
++bufp;
}
}
if (*bufp) {
if (argv) {
*bufp = '\0';
}
++bufp;
}
}
if (argv) {
argv[argc] = NULL;
}
return (argc);
}
} // End of namespace Saga
--- NEW FILE: expr.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/expr.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Expression parsing module header file
Notes:
*/
#ifndef SAGA_EXPR_H_
#define SAGA_EXPR_H_
namespace Saga {
#define R_EXPR_WHITESPACE "\t\n "
int EXPR_ParseArgs(char *cmd_str, char **argv);
} // End of namespace Saga
#endif /* R_EXPR_H_ */
/* end "r_expr.h" */
--- NEW FILE: font.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/font.cpp,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Font management and font drawing module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "rscfile_mod.h"
#include "game_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "font_mod.h"
#include "font.h"
namespace Saga {
static R_FONT_MODULE FontModule;
int FONT_Init(void)
{
R_GAME_FONTDESC *gamefonts;
int i;
if (FontModule.init) {
FontModule.err_str = "Font module already initialized.";
return R_FAILURE;
}
/* Load font module resource context
* \*------------------------------------------------------------ */
if (GAME_GetFileContext(&FontModule.font_ctxt,
R_GAME_RESOURCEFILE, 0) != R_SUCCESS) {
FontModule.err_str = "Couldn't get resource context.";
return R_FAILURE;
}
/* Allocate font table
* \*------------------------------------------------------------ */
GAME_GetFontInfo(&gamefonts, &FontModule.n_fonts);
assert(FontModule.n_fonts > 0);
FontModule.fonts = (R_FONT **)malloc(FontModule.n_fonts *
sizeof *FontModule.fonts);
if (FontModule.fonts == NULL) {
FontModule.err_str = "Memory allocation failure.";
return R_MEM;
}
for (i = 0; i < FontModule.n_fonts; i++) {
FONT_Load(gamefonts[i].font_rn, gamefonts[i].font_id);
}
FontModule.init = 1;
return R_SUCCESS;
}
int FONT_Shutdown(void)
{
int i;
R_printf(R_STDOUT, "FONT_Shutdown(): Freeing fonts.\n");
/*
for ( i = 0 ; i < R_FONT_COUNT ; i ++ ) {
if ( FontModule.fonts[i] != NULL ) {
if ( FontModule.fonts[i]->normal_loaded ) {
free( FontModule.fonts[i]->normal->font_free_p );
free( FontModule.fonts[i]->normal );
}
if ( FontModule.fonts[i]->outline_loaded ) {
free( FontModule.fonts[i]->outline->font_free_p );
free( FontModule.fonts[i]->outline );
}
}
free( FontModule.fonts[i] );
}
*/
return R_SUCCESS;
}
int FONT_Load(ulong font_rn, int font_id)
{
R_FONT_HEADER fh;
R_FONT *font;
R_FONT_STYLE *normal_font;
uchar *fontres_p;
size_t fontres_len;
size_t remain;
const uchar *read_p;
int nbits;
int c;
if ((font_id < 0) || (font_id >= FontModule.n_fonts)) {
return R_FAILURE;
}
/* Load font resource
* \*------------------------------------------------------------- */
if (RSC_LoadResource(FontModule.font_ctxt,
font_rn, &fontres_p, &fontres_len) != R_SUCCESS) {
FontModule.err_str = "Couldn't load font resource.";
return R_FAILURE;
}
if (fontres_len < R_FONT_DESCSIZE) {
FontModule.err_str = "Invalid font length.";
}
read_p = fontres_p;
remain = fontres_len;
/* Create new font structure
* \*------------------------------------------------------------- */
font = (R_FONT *)malloc(sizeof *font);
if (font == NULL) {
FontModule.err_str = "Memory allocation error.";
return R_MEM;
}
/* Read font header
* \*------------------------------------------------------------- */
fh.c_height = ys_read_u16_le(read_p, &read_p);
fh.c_width = ys_read_u16_le(read_p, &read_p);
fh.row_length = ys_read_u16_le(read_p, &read_p);
#if R_FONT_DBGLVL >= R_DEBUG_INFO
R_printf(R_STDOUT, "FONT_Load(): Reading font resource...\n");
#endif
#if R_FONT_DBGLVL >= R_DEBUG_VERBOSE
R_printf(R_STDOUT, "Character width:\t%d\n", fh.c_width);
R_printf(R_STDOUT, "Character height:\t%d\n", fh.c_height);
R_printf(R_STDOUT, "Row padding:\t%d\n", fh.row_length);
#endif
/* Create normal font style
* \*------------------------------------------------------------- */
normal_font = (R_FONT_STYLE *)malloc(sizeof *normal_font);
if (normal_font == NULL) {
FontModule.err_str = "Memory allocation error.";
free(font);
return R_MEM;
}
normal_font->font_free_p = fontres_p;
normal_font->hdr.c_height = fh.c_height;
normal_font->hdr.c_width = fh.c_width;
normal_font->hdr.row_length = fh.row_length;
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
normal_font->fce[c].index = ys_read_u16_le(read_p, &read_p);
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
nbits = normal_font->fce[c].width =
ys_read_u8(read_p, &read_p);
normal_font->fce[c].byte_width = GetByteLen(nbits);
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
normal_font->fce[c].flag = ys_read_u8(read_p, &read_p);
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
normal_font->fce[c].tracking = ys_read_u8(read_p, &read_p);
}
if ((read_p - fontres_p) != R_FONT_DESCSIZE) {
R_printf(R_STDERR, "Invalid font resource size.\n");
return R_FAILURE;
}
normal_font->font_p = (uchar *) read_p;
font->normal = normal_font;
font->normal_loaded = 1;
/* Create outline font style
* \*------------------------------------------------------------- */
font->outline = FONT_CreateOutline(normal_font);
font->outline_loaded = 1;
/* Set font data
* \*------------------------------------------------------------- */
FontModule.fonts[font_id] = font;
return R_SUCCESS;
}
int FONT_GetHeight(int font_id)
{
R_FONT *font;
if (!FontModule.init) {
return R_FAILURE;
}
if ((font_id < 0) ||
(font_id >= FontModule.n_fonts) ||
(FontModule.fonts[font_id] == NULL)) {
FontModule.err_str = "Invalid font id.";
return R_FAILURE;
}
font = FontModule.fonts[font_id];
return font->normal->hdr.c_height;
}
static R_FONT_STYLE *FONT_CreateOutline(R_FONT_STYLE * src_font)
{
R_FONT_STYLE *new_font;
unsigned char *new_font_data;
size_t new_font_data_len;
int s_width = src_font->hdr.c_width;
int s_height = src_font->hdr.c_height;
int new_row_len = 0;
int row;
int i;
int index;
size_t index_offset = 0;
int new_byte_width;
int old_byte_width;
int current_byte;
unsigned char *base_ptr;
unsigned char *src_ptr;
unsigned char *dest_ptr1;
unsigned char *dest_ptr2;
unsigned char *dest_ptr3;
unsigned char c_rep;
/* Create new font style structure
* \*------------------------------------------------------------- */
new_font = (R_FONT_STYLE *)malloc(sizeof *new_font);
if (new_font == NULL) {
FontModule.err_str = "Memory allocation error.";
return NULL;
}
memset(new_font, 0, sizeof *new_font);
/* Populate new font style character data
* \*------------------------------------------------------------- */
for (i = 0; i < R_FONT_CHARCOUNT; i++) {
new_byte_width = 0;
old_byte_width = 0;
index = src_font->fce[i].index;
if ((index > 0) || (i == R_FONT_FIRSTCHAR)) {
index += index_offset;
}
new_font->fce[i].index = index;
new_font->fce[i].tracking = src_font->fce[i].tracking;
new_font->fce[i].flag = src_font->fce[i].flag;
if (src_font->fce[i].width != 0) {
new_byte_width =
GetByteLen(src_font->fce[i].width + 2);
old_byte_width = GetByteLen(src_font->fce[i].width);
if (new_byte_width > old_byte_width) {
index_offset++;
}
}
new_font->fce[i].width = src_font->fce[i].width + 2;
new_font->fce[i].byte_width = new_byte_width;
new_row_len += new_byte_width;
}
#if R_FONT_DBGLVL >= R_DEBUG_VERBOSE
R_printf(R_STDOUT, "New row length: %d\n", new_row_len);
#endif
new_font->hdr.c_width = s_width + 2;
new_font->hdr.c_height = s_height + 2;
new_font->hdr.row_length = new_row_len;
/* Allocate new font representation storage
* \*------------------------------------------------------------- */
new_font_data_len = new_row_len * (s_height + 2);
new_font_data = (unsigned char *)malloc(new_font_data_len);
if (new_font_data == NULL) {
FontModule.err_str = "Memory allocation error.";
return NULL;
}
memset(new_font_data, 0, new_font_data_len);
new_font->font_free_p = new_font_data;
new_font->font_p = new_font_data;
/* Generate outline font representation
* \*------------------------------------------------------------- */
for (i = 0; i < R_FONT_CHARCOUNT; i++) {
for (row = 0; row < s_height; row++) {
for (current_byte = 0;
current_byte < new_font->fce[i].byte_width;
current_byte++) {
base_ptr =
new_font->font_p + new_font->fce[i].index +
current_byte;
dest_ptr1 =
base_ptr + new_font->hdr.row_length * row;
dest_ptr2 =
base_ptr +
new_font->hdr.row_length * (row + 1);
dest_ptr3 =
base_ptr +
new_font->hdr.row_length * (row + 2);
if (current_byte > 0) {
/* Get last two columns from previous byte */
src_ptr = src_font->font_p +
src_font->hdr.row_length * row +
src_font->fce[i].index +
(current_byte - 1);
c_rep = *src_ptr;
*dest_ptr1 |=
((c_rep << 6) | (c_rep << 7));
*dest_ptr2 |=
((c_rep << 6) | (c_rep << 7));
*dest_ptr3 |=
((c_rep << 6) | (c_rep << 7));
}
if (current_byte < src_font->fce[i].byte_width) {
src_ptr = src_font->font_p +
src_font->hdr.row_length * row +
src_font->fce[i].index +
current_byte;
c_rep = *src_ptr;
*dest_ptr1 |=
c_rep | (c_rep >> 1) | (c_rep >>
2);
*dest_ptr2 |=
c_rep | (c_rep >> 1) | (c_rep >>
2);
*dest_ptr3 |=
c_rep | (c_rep >> 1) | (c_rep >>
2);
}
}
}
/* "Hollow out" character to prevent overdraw */
for (row = 0; row < s_height; row++) {
for (current_byte = 0;
current_byte < new_font->fce[i].byte_width;
current_byte++) {
dest_ptr2 = new_font->font_p +
new_font->hdr.row_length * (row + 1) +
new_font->fce[i].index + current_byte;
if (current_byte > 0) {
/* Get last two columns from previous byte */
src_ptr = src_font->font_p +
src_font->hdr.row_length * row +
src_font->fce[i].index +
(current_byte - 1);
*dest_ptr2 &=
((*src_ptr << 7) ^ 0xFFU);
}
if (current_byte < src_font->fce[i].byte_width) {
src_ptr = src_font->font_p +
src_font->hdr.row_length * row +
src_font->fce[i].index +
current_byte;
*dest_ptr2 &=
((*src_ptr >> 1) ^ 0xFFU);
}
}
}
}
return new_font;
}
static int GetByteLen(int num_bits)
{
int byte_len;
byte_len = num_bits / 8;
if (num_bits % 8) {
byte_len++;
}
return byte_len;
}
int
FONT_GetStringWidth(int font_id,
const char *test_str, size_t test_str_ct, int flags)
/*--------------------------------------------------------------------------*\
* Returns the horizontal length in pixels of the graphical representation
* of at most 'test_str_ct' characters of the string 'test_str', taking
* into account any formatting options specified by 'flags'.
* If 'test_str_ct' is 0, all characters of 'test_str' are counted.
\*--------------------------------------------------------------------------*/
{
R_FONT *font;
size_t ct;
int width = 0;
int ch;
uchar *txt_p;
if (!FontModule.init) {
return R_FAILURE;
}
if ((font_id < 0) ||
(font_id >= FontModule.n_fonts) ||
(FontModule.fonts[font_id] == NULL)) {
FontModule.err_str = "Invalid font id.";
return R_FAILURE;
}
font = FontModule.fonts[font_id];
assert(font != NULL);
txt_p = (uchar *) test_str;
for (ct = test_str_ct;
*txt_p && (!test_str_ct || ct > 0); txt_p++, ct--) {
ch = *txt_p & 0xFFU;
/* Translate character */
ch = CharMap[ch];
assert(ch < R_FONT_CHARCOUNT);
width += font->normal->fce[ch].tracking;
}
if ((flags & FONT_BOLD) || (flags & FONT_OUTLINE)) {
width += 1;
}
return width;
}
int
FONT_Draw(int font_id,
R_SURFACE * ds,
const char *draw_str,
size_t draw_str_ct,
int text_x, int text_y, int color, int effect_color, int flags)
{
R_FONT *font;
if (!FontModule.init) {
FontModule.err_str = "Font Module not initialized.";
return R_FAILURE;
}
if ((font_id < 0) ||
(font_id >= FontModule.n_fonts) ||
(FontModule.fonts[font_id] == NULL)) {
FontModule.err_str = "Invalid font id.";
return R_FAILURE;
}
font = FontModule.fonts[font_id];
if (flags & FONT_OUTLINE) {
FONT_Out(font->outline,
ds,
draw_str,
draw_str_ct, text_x - 1, text_y - 1, effect_color);
FONT_Out(font->normal,
ds, draw_str, draw_str_ct, text_x, text_y, color);
} else if (flags & FONT_SHADOW) {
FONT_Out(font->normal,
ds,
draw_str,
draw_str_ct, text_x - 1, text_y + 1, effect_color);
FONT_Out(font->normal,
ds, draw_str, draw_str_ct, text_x, text_y, color);
} else { /* FONT_NORMAL */
FONT_Out(font->normal,
ds, draw_str, draw_str_ct, text_x, text_y, color);
}
return R_SUCCESS;
}
int
FONT_Out(R_FONT_STYLE * draw_font,
R_SURFACE * ds,
const char *draw_str,
size_t draw_str_ct, int text_x, int text_y, int color)
{
const uchar *draw_str_p;
uchar *c_data_ptr;
int c_code;
int char_row;
uchar *output_ptr;
uchar *output_ptr_min;
uchar *output_ptr_max;
int row;
int row_limit;
int c_byte_len;
int c_byte;
int c_bit;
int ct;
if ((text_x > ds->buf_w) || (text_y > ds->buf_h)) {
/* Output string can't be visible */
return R_SUCCESS;
}
draw_str_p = (uchar *) draw_str;
ct = draw_str_ct;
/* Draw string one character at a time, maximum of 'draw_str'_ct
* characters, or no limit if 'draw_str_ct' is 0 */
for (; *draw_str_p && (!draw_str_ct || ct); draw_str_p++, ct--) {
c_code = *draw_str_p & 0xFFU;
/* Translate character */
c_code = CharMap[c_code];
assert(c_code < R_FONT_CHARCOUNT);
/* Check if character is defined */
if ((draw_font->fce[c_code].index == 0) &&
(c_code != R_FONT_FIRSTCHAR)) {
# if R_FONT_SHOWUNDEFINED
if (c_code == R_FONT_CH_SPACE) {
text_x += draw_font->fce[c_code].tracking;
continue;
}
c_code = R_FONT_CH_QMARK;
# else
/* Character code is not defined, but advance tracking
* ( Not defined if offset is 0, except for 33 ('!') which
* is defined ) */
text_x += draw_font->fce[c_code].tracking;
continue;
#endif
}
/* Get length of character in bytes */
c_byte_len = ((draw_font->fce[c_code].width - 1) / 8) + 1;
row_limit = (ds->buf_h < (text_y + draw_font->hdr.c_height))
? ds->buf_h : text_y + draw_font->hdr.c_height;
char_row = 0;
for (row = text_y; row < row_limit; row++, char_row++) {
/* Clip negative rows */
if (row < 0) {
continue;
}
output_ptr = ds->buf + (ds->buf_pitch * row) + text_x;
output_ptr_min = ds->buf + (ds->buf_pitch * row) +
(text_x > 0 ? text_x : 0);
output_ptr_max = output_ptr + (ds->buf_pitch - text_x);
/* If character starts off the screen, jump to next character */
if (output_ptr < output_ptr_min) {
break;
}
c_data_ptr = draw_font->font_p +
char_row * draw_font->hdr.row_length +
draw_font->fce[c_code].index;
for (c_byte = 0; c_byte < c_byte_len;
c_byte++, c_data_ptr++) {
/* Check each bit, draw pixel if bit is set */
for (c_bit = 7;
c_bit >= 0
&& (output_ptr < output_ptr_max);
c_bit--) {
if ((*c_data_ptr >> c_bit) & 0x01) {
*output_ptr = (uchar) color;
}
output_ptr++;
} /* end per-bit processing */
} /* end per-byte processing */
} /* end per-row processing */
/* Advance tracking position */
text_x += draw_font->fce[c_code].tracking;
} /* end per-character processing */
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: font.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/font.h,v 1.1 2004/04/12 21:40:46 sev Exp $
*
*/
/*
Description:
Font management and font drawing header file
Notes:
*/
#ifndef SAGA_FONT_H__
#define SAGA_FONT_H__
namespace Saga {
#define R_FONT_DBGLVL R_DEBUG_NONE
#define R_FONT_SHOWUNDEFINED 1 /* Define to draw undefined characters
* as ?'s */
/* The first defined character (!) is the only one that may
have a valid offset of '0' */
#define R_FONT_FIRSTCHAR 33
#define R_FONT_CH_SPACE 32
#define R_FONT_CH_QMARK 63
/* Minimum font header size without font data
(6 + 512 + 256 + 256 + 256 ) */
#define R_FONT_DESCSIZE 1286
#define R_FONT_CHARCOUNT 256
#define R_FONT_CHARMASK 0xFFU
#define SAGA_FONT_HEADER_LEN 6
typedef struct R_FONT_HEADER_tag {
int c_height;
int c_width;
int row_length;
} R_FONT_HEADER;
typedef struct FONT_CHAR_ENTRY_TAG {
int index;
int byte_width;
int width;
int flag;
int tracking;
} FONT_CHAR_ENTRY;
typedef struct R_FONT_STYLE_tag {
R_FONT_HEADER hdr;
FONT_CHAR_ENTRY fce[256];
uchar *font_free_p;
uchar *font_p;
} R_FONT_STYLE;
typedef struct R_FONT_tag {
ulong font_rn;
int font_id;
int normal_loaded;
R_FONT_STYLE *normal;
int outline_loaded;
R_FONT_STYLE *outline;
uchar *res_data;
size_t res_len;
} R_FONT;
typedef struct R_FONT_MODULE_tag {
int init;
R_RSCFILE_CONTEXT *font_ctxt;
int n_fonts;
R_FONT **fonts;
int err_n;
const char *err_str;
} R_FONT_MODULE;
int FONT_Load(ulong font_rn, int font_id);
static R_FONT_STYLE *FONT_CreateOutline(R_FONT_STYLE * src_font);
int
FONT_Out(R_FONT_STYLE * font,
R_SURFACE * ds,
const char *draw_str,
size_t draw_str_ct, int text_x, int text_y, int color);
static int GetByteLen(int num_bits);
extern int CharMap[];
} // End of namespace Saga
#endif /* R_FONT_H__ */
/* end "r_font.h" */
--- NEW FILE: font_map.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/font_map.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Font module character mapping table ( MS CP-850 to ISO 8859-1 )
Notes:
Translation table derived from http://www.kostis.net/charsets/
*/
namespace Saga {
int CharMap[] = {
0, /* 0 */
1, /* 1 */
2, /* 2 */
3, /* 3 */
4, /* 4 */
5, /* 5 */
6, /* 6 */
7, /* 7 */
8, /* 8 */
9, /* 9 */
10, /* 10 */
11, /* 11 */
12, /* 12 */
13, /* 13 */
14, /* 14 */
15, /* 15 */
16, /* 16 */
17, /* 17 */
18, /* 18 */
19, /* 19 */
20, /* 20 */
21, /* 21 */
22, /* 22 */
23, /* 23 */
24, /* 24 */
25, /* 25 */
26, /* 26 */
27, /* 27 */
28, /* 28 */
29, /* 29 */
30, /* 30 */
31, /* 31 */
32, /* 32 */
33, /* 33 */
34, /* 34 */
35, /* 35 */
36, /* 36 */
37, /* 37 */
38, /* 38 */
39, /* 39 */
40, /* 40 */
41, /* 41 */
42, /* 42 */
43, /* 43 */
44, /* 44 */
45, /* 45 */
46, /* 46 */
47, /* 47 */
48, /* 48 */
49, /* 49 */
50, /* 50 */
51, /* 51 */
52, /* 52 */
53, /* 53 */
54, /* 54 */
55, /* 55 */
56, /* 56 */
57, /* 57 */
58, /* 58 */
59, /* 59 */
60, /* 60 */
61, /* 61 */
62, /* 62 */
63, /* 63 */
64, /* 64 */
65, /* 65 */
66, /* 66 */
67, /* 67 */
68, /* 68 */
69, /* 69 */
70, /* 70 */
71, /* 71 */
72, /* 72 */
73, /* 73 */
74, /* 74 */
75, /* 75 */
76, /* 76 */
77, /* 77 */
78, /* 78 */
79, /* 79 */
80, /* 80 */
81, /* 81 */
82, /* 82 */
83, /* 83 */
84, /* 84 */
85, /* 85 */
86, /* 86 */
87, /* 87 */
88, /* 88 */
89, /* 89 */
90, /* 90 */
91, /* 91 */
92, /* 92 */
93, /* 93 */
94, /* 94 */
95, /* 95 */
96, /* 96 */
97, /* 97 */
98, /* 98 */
99, /* 99 */
100, /* 100 */
101, /* 101 */
102, /* 102 */
103, /* 103 */
104, /* 104 */
105, /* 105 */
106, /* 106 */
107, /* 107 */
108, /* 108 */
109, /* 109 */
110, /* 110 */
111, /* 111 */
112, /* 112 */
113, /* 113 */
114, /* 114 */
115, /* 115 */
116, /* 116 */
117, /* 117 */
118, /* 118 */
119, /* 119 */
120, /* 120 */
121, /* 121 */
122, /* 122 */
123, /* 123 */
124, /* 124 */
125, /* 125 */
126, /* 126 */
127, /* 127 */
199, /* 128 LATIN CAPITAL LETTER C WITH CEDILLA */
252, /* 129 LATIN SMALL LETTER U WITH DIAERESIS */
233, /* 130 LATIN SMALL LETTER E WITH ACUTE */
226, /* 131 LATIN SMALL LETTER A WITH CIRCUMFLEX */
228, /* 132 LATIN SMALL LETTER A WITH DIAERESIS */
224, /* 133 LATIN SMALL LETTER A WITH GRAVE */
229, /* 134 LATIN SMALL LETTER A WITH RING ABOVE */
231, /* 135 LATIN SMALL LETTER C WITH CEDILLA */
234, /* 136 LATIN SMALL LETTER E WITH CIRCUMFLEX */
235, /* 137 LATIN SMALL LETTER E WITH DIAERESIS */
232, /* 138 LATIN SMALL LETTER E WITH GRAVE */
239, /* 139 LATIN SMALL LETTER I WITH DIAERESIS */
238, /* 140 LATIN SMALL LETTER I WITH CIRCUMFLEX */
236, /* 141 LATIN SMALL LETTER I WITH GRAVE */
196, /* 142 LATIN CAPITAL LETTER A WITH DIAERESIS */
197, /* 143 LATIN CAPITAL LETTER A WITH RING ABOVE */
201, /* 144 LATIN CAPITAL LETTER E WITH ACUTE */
230, /* 145 LATIN SMALL LETTER AE */
198, /* 146 LATIN CAPITAL LETTER AE */
244, /* 147 LATIN SMALL LETTER O WITH CIRCUMFLEX */
246, /* 148 LATIN SMALL LETTER O WITH DIAERESIS */
242, /* 149 LATIN SMALL LETTER O WITH GRAVE */
251, /* 150 LATIN SMALL LETTER U WITH CIRCUMFLEX */
249, /* 151 LATIN SMALL LETTER U WITH GRAVE */
255, /* 152 LATIN SMALL LETTER Y WITH DIAERESIS */
214, /* 153 LATIN CAPITAL LETTER O WITH DIAERESIS */
220, /* 154 LATIN CAPITAL LETTER U WITH DIAERESIS */
248, /* 155 LATIN SMALL LETTER O WITH STROKE */
163, /* 156 POUND SIGN */
216, /* 157 LATIN CAPITAL LETTER O WITH STROKE */
215, /* 158 MULTIPLICATION SIGN */
0, /* 159 LATIN SMALL LETTER F WITH HOOK */
225, /* 160 LATIN SMALL LETTER A WITH ACUTE */
237, /* 161 LATIN SMALL LETTER I WITH ACUTE */
243, /* 162 LATIN SMALL LETTER O WITH ACUTE */
250, /* 163 LATIN SMALL LETTER U WITH ACUTE */
241, /* 164 LATIN SMALL LETTER N WITH TILDE */
209, /* 165 LATIN CAPITAL LETTER N WITH TILDE */
170, /* 166 FEMININE ORDINAL INDICATOR */
186, /* 167 MASCULINE ORDINAL INDICATOR */
191, /* 168 INVERTED QUESTION MARK */
174, /* 169 REGISTERED SIGN */
172, /* 170 NOT SIGN */
189, /* 171 VULGAR FRACTION ONE HALF */
188, /* 172 VULGAR FRACTION ONE QUARTER */
161, /* 173 INVERTED EXCLAMATION MARK */
171, /* 174 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
187, /* 175 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
0, /* 176 LIGHT SHADE */
0, /* 177 MEDIUM SHADE */
0, /* 178 DARK SHADE */
0, /* 179 BOX DRAWINGS LIGHT VERTICAL */
0, /* 180 BOX DRAWINGS LIGHT VERTICAL AND LEFT */
193, /* 181 LATIN CAPITAL LETTER A WITH ACUTE */
194, /* 182 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
192, /* 183 LATIN CAPITAL LETTER A WITH GRAVE */
169, /* 184 COPYRIGHT SIGN */
0, /* 185 BOX DRAWINGS DOUBLE VERTICAL AND LEFT */
0, /* 186 BOX DRAWINGS DOUBLE VERTICAL */
0, /* 187 BOX DRAWINGS DOUBLE DOWN AND LEFT */
0, /* 188 BOX DRAWINGS DOUBLE UP AND LEFT */
162, /* 189 CENT SIGN */
165, /* 190 YEN SIGN */
0, /* 191 BOX DRAWINGS LIGHT DOWN AND LEFT */
0, /* 192 BOX DRAWINGS LIGHT UP AND RIGHT */
0, /* 193 BOX DRAWINGS LIGHT UP AND HORIZONTAL */
0, /* 194 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
0, /* 195 BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
0, /* 196 BOX DRAWINGS LIGHT HORIZONTAL */
0, /* 197 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
227, /* 198 LATIN SMALL LETTER A WITH TILDE */
195, /* 199 LATIN CAPITAL LETTER A WITH TILDE */
0, /* 200 BOX DRAWINGS DOUBLE UP AND RIGHT */
0, /* 201 BOX DRAWINGS DOUBLE DOWN AND RIGHT */
0, /* 202 BOX DRAWINGS DOUBLE UP AND HORIZONTAL */
0, /* 203 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL */
0, /* 204 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT */
0, /* 205 BOX DRAWINGS DOUBLE HORIZONTAL */
0, /* 206 BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL */
164, /* 207 CURRENCY SIGN */
240, /* 208 LATIN SMALL LETTER ETH */
208, /* 209 LATIN CAPITAL LETTER ETH */
202, /* 210 LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
203, /* 211 LATIN CAPITAL LETTER E WITH DIAERESIS */
200, /* 212 LATIN CAPITAL LETTER E WITH GRAVE */
305, /* 213 LATIN SMALL LETTER DOTLESS I */
205, /* 214 LATIN CAPITAL LETTER I WITH ACUTE */
206, /* 215 LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
207, /* 216 LATIN CAPITAL LETTER I WITH DIAERESIS */
0, /* 217 BOX DRAWINGS LIGHT UP AND LEFT */
0, /* 218 BOX DRAWINGS LIGHT DOWN AND RIGHT */
0, /* 219 FULL BLOCK */
0, /* 220 LOWER HALF BLOCK */
166, /* 221 BROKEN BAR */
204, /* 222 LATIN CAPITAL LETTER I WITH GRAVE */
0, /* 223 UPPER HALF BLOCK */
211, /* 224 LATIN CAPITAL LETTER O WITH ACUTE */
223, /* 225 LATIN SMALL LETTER SHARP S */
212, /* 226 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
210, /* 227 LATIN CAPITAL LETTER O WITH GRAVE */
245, /* 228 LATIN SMALL LETTER O WITH TILDE */
213, /* 229 LATIN CAPITAL LETTER O WITH TILDE */
181, /* 230 MICRO SIGN */
254, /* 231 LATIN SMALL LETTER THORN */
222, /* 232 LATIN CAPITAL LETTER THORN */
218, /* 233 LATIN CAPITAL LETTER U WITH ACUTE */
219, /* 234 LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
217, /* 235 LATIN CAPITAL LETTER U WITH GRAVE */
253, /* 236 LATIN SMALL LETTER Y WITH ACUTE */
221, /* 237 LATIN CAPITAL LETTER Y WITH ACUTE */
175, /* 238 MACRON */
180, /* 239 ACUTE ACCENT */
173, /* 240 SOFT HYPHEN */
177, /* 241 PLUS-MINUS SIGN */
0, /* 242 DOUBLE LOW LINE */
190, /* 243 VULGAR FRACTION THREE QUARTERS */
182, /* 244 PILCROW SIGN */
167, /* 245 SECTION SIGN */
247, /* 246 DIVISION SIGN */
184, /* 247 CEDILLA */
176, /* 248 DEGREE SIGN */
168, /* 249 DIAERESIS */
183, /* 250 MIDDLE DOT */
185, /* 251 SUPERSCRIPT ONE */
179, /* 252 SUPERSCRIPT THREE */
178, /* 253 SUPERSCRIPT TWO */
0, /* 254 BLACK SQUARE */
160 /* 255 NO-BREAK SPACE */
};
} // End of namespace Saga
--- NEW FILE: font_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/font_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Font management and font drawing module public header
Notes:
*/
#ifndef SAGA_FONT_MOD_H_
#define SAGA_FONT_MOD_H_
namespace Saga {
enum FONT_ID {
SMALL_FONT_ID,
MEDIUM_FONT_ID,
BIG_FONT_ID
};
enum FONT_EFFECT_FLAGS {
FONT_NORMAL = 0x00,
FONT_OUTLINE = 0x01,
FONT_SHADOW = 0x02,
FONT_BOLD = 0x04,
FONT_CENTERED = 0x08
};
int FONT_Init(void);
int FONT_Shutdown(void);
int FONT_Draw(int font_id,
R_SURFACE * ds,
const char *draw_str,
size_t draw_str_len,
int text_x, int text_y, int color, int effect_color, int flags);
int FONT_GetStringWidth(int font_id,
const char *test_str, size_t test_str_ct, int flags);
int FONT_GetHeight(int font_id);
} // End of namespace Saga
#endif /* R_FONT_MOD_H_ */
/* end "r_font_mod.h" */
--- NEW FILE: game.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/game.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game detection, general game parameters
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "rscfile_mod.h"
#include "cvar_mod.h"
#include "ite_introproc_mod.h"
#include "interface_mod.h"
/*
* Begin module component
\*--------------------------------------------------------------------------*/
#include "game_mod.h"
#include "game.h"
namespace Saga {
/*--------------------------------------------------------------------------*\
* Inherit the Earth - Demo version
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITEDEMO_GameFiles[] = {
{"ITE.RSC", R_GAME_RESOURCEFILE}
,
{"ITE.DMO", R_GAME_DEMOFILE}
,
{"SCRIPTS.RSC", R_GAME_SCRIPTFILE}
,
{"VOICES.RSC", R_GAME_SOUNDFILE | R_GAME_VOICEFILE}
};
R_GAME_FONTDESC ITEDEMO_GameFonts[] = {
{R_GAME_FONT_SMALL, 0}
,
{R_GAME_FONT_MEDIUM, 1}
};
R_GAME_SOUNDINFO ITEDEMO_GameSound = {
R_GAME_SOUND_VOC
};
/*--------------------------------------------------------------------------*\
* Inherit the Earth - Diskette version
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITEDISK_GameFiles[] = {
{"ITE.RSC", R_GAME_RESOURCEFILE}
,
{"SCRIPTS.RSC", R_GAME_SCRIPTFILE}
,
{"VOICES.RSC", R_GAME_SOUNDFILE | R_GAME_VOICEFILE}
};
R_GAME_FONTDESC ITEDISK_GameFonts[] = {
{R_GAME_FONT_MEDIUM, 0}
,
{R_GAME_FONT_LARGE, 1}
,
{R_GAME_FONT_SMALL, 2}
};
R_GAME_RESOURCEDESC ITE_Resources = {
ITE_SCENE_LUT, /* Scene lookup table RN */
ITE_SCRIPT_LUT, /* Script lookup table RN */
ITE_COMMAND_PANEL,
ITE_DIALOGUE_PANEL
};
R_GAME_SOUNDINFO ITE_GameSound = {
R_GAME_SOUND_VOC
};
/*--------------------------------------------------------------------------*\
* Inherit the Earth - CD Enhanced version
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITECD_GameFiles[] = {
{"ITE.RSC", R_GAME_RESOURCEFILE}
,
{"SCRIPTS.RSC", R_GAME_SCRIPTFILE}
,
{"SOUNDS.RSC", R_GAME_SOUNDFILE}
,
{"VOICES.RSC", R_GAME_VOICEFILE}
};
R_GAME_FONTDESC ITECD_GameFonts[] = {
{R_GAME_FONT_MEDIUM, 0}
,
{R_GAME_FONT_LARGE, 1}
,
{R_GAME_FONT_SMALL, 2}
};
R_GAME_SOUNDINFO ITECD_GameSound = {
R_GAME_SOUND_PCM,
22050,
16,
0
};
/*--------------------------------------------------------------------------*\
* I Have No Mouth and I Must Scream - Demo version
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC IHNMDEMO_GameFiles[] = {
{"SCREAM.RES", R_GAME_RESOURCEFILE}
,
{"SCRIPTS.RES", R_GAME_SCRIPTFILE}
,
{"SFX.RES", R_GAME_SOUNDFILE}
,
{"VOICESD.RES", R_GAME_VOICEFILE}
};
/*--------------------------------------------------------------------------*\
* I Have No Mouth and I Must Scream - Retail CD version
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC IHNMCD_GameFiles[] = {
{"MUSICFM.RES", R_GAME_MUSICFILE}
,
{"MUSICGM.RES", R_GAME_MUSICFILE}
,
{"SCREAM.RES", R_GAME_RESOURCEFILE}
,
{"SCRIPTS.RES", R_GAME_SCRIPTFILE}
,
{"SFX.RES", R_GAME_SOUNDFILE}
,
{"VOICES1.RES", R_GAME_VOICEFILE}
,
{"VOICES2.RES", R_GAME_VOICEFILE}
,
{"VOICES3.RES", R_GAME_VOICEFILE}
,
{"VOICES4.RES", R_GAME_VOICEFILE}
,
{"VOICES5.RES", R_GAME_VOICEFILE}
,
{"VOICES6.RES", R_GAME_VOICEFILE}
,
{"VOICESS.RES", R_GAME_VOICEFILE}
};
R_GAME_FONTDESC IHNMCD_GameFonts[] = {
{R_GAME_FONT_MEDIUM, 2}
,
{R_GAME_FONT_LARGE, 3}
,
{R_GAME_FONT_SMALL, 4}
,
{R_GAME_FONT_SMALL2, 5}
,
{R_GAME_FONT_MEDIUM2, 6}
,
{R_GAME_FONT_LARGE2, 7}
,
{R_GAME_FONT_LARGE3, 8}
};
R_GAME_RESOURCEDESC IHNM_Resources[] = {
IHNM_SCENE_LUT, /* Scene lookup table RN */
IHNM_SCRIPT_LUT, /* Script lookup table RN */
IHNM_COMMAND_PANEL,
IHNM_DIALOGUE_PANEL
};
R_GAME_SOUNDINFO IHNM_GameSound = {
R_GAME_SOUND_WAV
};
R_GAMEDESC GameDescs[] = {
/* Inherit the earth - Demo version
* \*------------------------------------------------------------- */
{
R_GAMETYPE_ITE,
R_GAME_ITE_DEMO, /* Game id */
"Inherit the Earth - Demo version", /* Game title */
320, 200, /* Logical resolution */
137, /* Scene viewport height */
ITE_DEFAULT_SCENE, /* Starting scene number */
&ITE_Resources,
YS_NELEMS(ITEDEMO_GameFiles), /* Game datafiles */
ITEDEMO_GameFiles,
YS_NELEMS(ITEDEMO_GameFonts),
ITEDEMO_GameFonts,
&ITEDEMO_GameSound,
Verify_ITEDEMO, /* Game verification func */
0 /* Game supported flag */
}
,
/* Inherit the earth - Disk version
* \*------------------------------------------------------------- */
{
R_GAMETYPE_ITE,
R_GAME_ITE_DISK,
"Inherit the Earth - Disk version",
320, 200,
137,
ITE_DEFAULT_SCENE,
&ITE_Resources,
YS_NELEMS(ITEDISK_GameFiles),
ITEDISK_GameFiles,
YS_NELEMS(ITEDISK_GameFonts),
ITEDISK_GameFonts,
&ITE_GameSound,
Verify_ITEDISK,
1}
,
/* Inherit the earth - CD version
* \*------------------------------------------------------------- */
{
R_GAMETYPE_ITE,
R_GAME_ITE_CD,
"Inherit the Earth - CD version",
320, 200,
137,
ITE_DEFAULT_SCENE,
&ITE_Resources,
YS_NELEMS(ITECD_GameFiles),
ITECD_GameFiles,
YS_NELEMS(ITECD_GameFonts),
ITECD_GameFonts,
&ITECD_GameSound,
NULL,
1}
,
/* I Have No Mouth And I Must Scream - Demo version
* \*------------------------------------------------------------- */
{
R_GAMETYPE_IHNM,
R_GAME_IHNM_DEMO,
"I Have No Mouth - Demo version",
640, 480,
304,
0,
IHNM_Resources,
YS_NELEMS(IHNMDEMO_GameFiles),
IHNMDEMO_GameFiles,
0,
NULL,
&IHNM_GameSound,
NULL,
0}
,
/* I Have No Mouth And I Must Scream - CD version
* \*------------------------------------------------------------- */
{
R_GAMETYPE_IHNM,
R_GAME_IHNM_CD,
"I Have No Mouth - CD version",
640, 480,
304,
1,
IHNM_Resources,
YS_NELEMS(IHNMCD_GameFiles),
IHNMCD_GameFiles,
YS_NELEMS(IHNMCD_GameFonts),
IHNMCD_GameFonts,
&IHNM_GameSound,
NULL,
1}
};
static R_GAMEMODULE GameModule;
void GAME_setGameDirectory(const char *gamedir) {
assert(gamedir != NULL);
debug(0, "Using game data path: %s", gamedir);
strcpy(GameModule.game_dir, gamedir);
strcpy(GameModule.data_dir, ".");
}
int GAME_Register(void)
{
return R_SUCCESS;
/* Register "gamedir" cfg cvar
* \*----------------------------------------- */
strncpy(GameModule.game_dir, "./", R_MAXPATH);
if (CVAR_Register_S(GameModule.game_dir,
"gamedir", NULL, R_CVAR_CFG, R_MAXPATH) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "datadir" cfg cvar
* \*----------------------------------------- */
strncpy(GameModule.data_dir, "./", R_MAXPATH);
if (CVAR_Register_S(GameModule.data_dir,
"datadir", NULL, R_CVAR_CFG, R_MAXPATH) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "g_language" cfg cvar
* \*----------------------------------------- */
strncpy(GameModule.game_dir, "us", R_MAXPATH);
if (CVAR_Register_S(GameModule.game_language,
"g_language",
NULL, R_CVAR_CFG, R_GAME_LANGSTR_LIMIT) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "g_skipintro" cfg cvar
* \*----------------------------------------- */
if (CVAR_Register_I(&GameModule.g_skipintro,
"g_skipintro", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
return R_FAILURE;
}
return R_SUCCESS;
}
int GAME_Init(void)
{
uint game_n;
char *game_dir;
game_dir = GameModule.game_dir;
if (DetectGame(game_dir, &game_n) != R_SUCCESS) {
GameModule.err_str = "No valid games were found in the "
"specified directory.";
return R_FAILURE;
}
if (!GameDescs[game_n].gd_supported) {
GameModule.err_str = "This game is not currently supported.";
return R_FAILURE;
}
if (LoadGame(game_dir, game_n) != R_SUCCESS) {
GameModule.err_str = "Error loading game resource files.";
return R_FAILURE;
}
/* Load dialogue file
* \*------------------------------------------------------------- */
LoadLanguage();
return R_SUCCESS;
}
int LoadLanguage(void)
{
char lang_file[R_MAXPATH];
char lang_path[R_MAXPATH];
uint game_n;
FILE *test_fp;
game_n = GameModule.game_number;
if (GameDescs[game_n].gd_game_type == R_GAMETYPE_ITE) {
snprintf(lang_file, R_MAXPATH,
"%s%s.%s",
R_GAME_ITE_LANG_PREFIX,
GameModule.game_language, R_GAME_LANG_EXT);
SYSFS_GetFQFN(GameModule.data_dir,
lang_file, lang_path, R_MAXPATH);
test_fp = fopen(lang_path, "r");
if (test_fp == NULL) {
R_printf(R_STDOUT,
"Couldn't open language file %s. "
"Using default (US English)\n", lang_path);
return R_SUCCESS;
}
fclose(test_fp);
if (INTERFACE_RegisterLang() != R_SUCCESS) {
R_printf(R_STDERR,
"Error registering interface language cvars.");
return R_FAILURE;
}
if (ITE_IntroRegisterLang() != R_SUCCESS) {
R_printf(R_STDERR,
"Error registering intro sequence language cvars.");
return R_FAILURE;
}
R_printf(R_STDOUT, "Using language file %s.\n", lang_path);
// FIXME
//CFG_Read(lang_path);
} else {
R_printf(R_STDOUT,
"Language support for this game not implemented.\n");
}
return R_SUCCESS;
}
int GAME_GetErrN(void)
{
return 0;
}
const char *GAME_GetErrS(void)
{
return GameModule.err_str == NULL
? "No error description." : GameModule.err_str;
}
int GAME_GetFileContext(R_RSCFILE_CONTEXT ** ctxt_p, uint r_type, int param)
{
R_RSCFILE_CONTEXT *found_ctxt = NULL;
uint i;
YS_IGNORE_PARAM(param);
if (ctxt_p == NULL) {
return R_FAILURE;
}
for (i = 0; i < GameModule.gfile_n; i++) {
if (GameModule.gfile_data[i].file_types & r_type) {
found_ctxt = GameModule.gfile_data[i].file_ctxt;
}
}
if (found_ctxt != NULL) {
*ctxt_p = found_ctxt;
} else {
*ctxt_p = NULL;
}
return R_SUCCESS;
}
int DetectGame(const char *game_dir, uint * game_n_p)
{
char game_fpath[R_GAME_PATH_LIMIT] = { 0 };
uint game_count = YS_NELEMS(GameDescs);
uint game_n;
uint file_count;
uint file_n;
FILE *test_fp;
int file_missing = 0;
int found_game = 0;
int error;
if ((game_dir == NULL) || (game_n_p == NULL)) {
return R_FAILURE;
}
for (game_n = 0; (game_n < game_count) && !found_game; game_n++) {
file_count = GameDescs[game_n].gd_filect;
file_missing = 0;
/* Try to open all files for this game */
for (file_n = 0; file_n < file_count; file_n++) {
SYSFS_GetFQFN(game_dir,
GameDescs[game_n].gd_filedescs[file_n].gf_fname,
game_fpath, R_GAME_PATH_LIMIT);
test_fp = fopen(game_fpath, "rb");
if (test_fp == NULL) {
file_missing = 1;
break;
}
fclose(test_fp);
}
/* Try the next game, couldn't find all files for the current
* game */
if (file_missing) {
continue;
}
/* If there's a verification function for this game, use it,
* otherwise assume we've found the game if all files are found. */
found_game = 1;
if (GameDescs[game_n].gd_verifyf != NULL &&
GameDescs[game_n].gd_verifyf(game_dir) != R_SUCCESS) {
found_game = 0;
}
if (found_game) {
R_printf(R_STDOUT,
"Found game: %s\n", GameDescs[game_n].gd_title);
*game_n_p = game_n;
return R_SUCCESS;
}
}
return R_FAILURE;
}
int LoadGame(const char *game_dir, uint game_n)
{
R_RSCFILE_CONTEXT *load_ctxt;
uint game_count = YS_NELEMS(GameDescs);
char game_fpath[R_GAME_PATH_LIMIT] = { 0 };
const char *game_fname;
uint game_filect;
uint i;
if ((game_dir == NULL) || (game_n >= game_count)) {
return R_FAILURE;
}
game_filect = GameDescs[game_n].gd_filect;
GameModule.gfile_data = (R_GAME_FILEDATA *)malloc(game_filect *
sizeof *GameModule.gfile_data);
if (GameModule.gfile_data == NULL) {
return R_MEM;
}
GameModule.gfile_n = game_filect;
/* Load game resource files
* \*------------------------------------------------------------- */
for (i = 0; i < game_filect; i++) {
load_ctxt = RSC_CreateContext();
game_fname = GameDescs[game_n].gd_filedescs[i].gf_fname;
SYSFS_GetFQFN(game_dir,
game_fname, game_fpath, R_GAME_PATH_LIMIT);
if (RSC_OpenContext(load_ctxt, game_fpath) != R_SUCCESS) {
return R_FAILURE;
}
R_printf(R_STDOUT, "Opened resource file: %s\n", game_fname);
GameModule.gfile_data[i].file_ctxt = load_ctxt;
GameModule.gfile_data[i].file_types =
GameDescs[game_n].gd_filedescs[i].gf_type;
GameModule.gfile_data[i].file_flags = 0;
}
/* Load game font data
* \*------------------------------------------------------------- */
GameModule.gd_fontct = GameDescs[game_n].gd_fontct;
GameModule.gd_fontdescs = GameDescs[game_n].gd_fontdescs;
/* Finish initialization
* \*------------------------------------------------------------- */
GameModule.game_number = game_n;
GameModule.gamedesc = &GameDescs[game_n];
GameModule.game_init = 1;
return R_SUCCESS;
}
int GAME_GetResourceInfo(R_GAME_RESOURCEDESC * rsc_desc)
{
assert(rsc_desc != NULL);
*rsc_desc = *GameModule.gamedesc->gd_resource_desc;
return R_SUCCESS;
}
int GAME_GetSoundInfo(R_GAME_SOUNDINFO * snd_info)
{
assert(snd_info != NULL);
*snd_info = *GameModule.gamedesc->gd_soundinfo;
return R_SUCCESS;
}
int GAME_GetDisplayInfo(R_GAME_DISPLAYINFO * disp_info)
{
int game_n;
assert(disp_info != NULL);
if (!GameModule.game_init) {
return R_FAILURE;
}
game_n = GameModule.game_number;
disp_info->logical_w = GameDescs[game_n].gd_logical_w;
disp_info->logical_h = GameDescs[game_n].gd_logical_h;
disp_info->scene_h = GameDescs[game_n].gd_scene_h;
return R_SUCCESS;
}
int GAME_GetFontInfo(R_GAME_FONTDESC ** gf_desc, int *font_n)
{
assert((gf_desc != NULL) && (font_n != NULL));
*gf_desc = GameModule.gd_fontdescs;
*font_n = GameModule.gd_fontct;
return R_SUCCESS;
}
int GAME_GetSceneInfo(R_GAME_SCENEDESC * gs_desc)
{
assert(gs_desc != NULL);
gs_desc->first_scene = GameModule.gamedesc->gd_startscene;
gs_desc->scene_lut_rn =
GameModule.gamedesc->gd_resource_desc->scene_lut_rn;
return R_SUCCESS;
}
int GAME_GetGame(void)
{
return GameModule.gamedesc->gd_game_id;
}
int GAME_GetGameType(void)
{
return GameModule.gamedesc->gd_game_type;
}
int Verify_ITEDEMO(const char *game_dir)
{
YS_IGNORE_PARAM(game_dir);
return R_SUCCESS;
}
int Verify_ITEDISK(const char *game_dir)
{
R_RSCFILE_CONTEXT *test_ctx;
char fpath[R_GAME_PATH_LIMIT] = { 0 };
ulong script_lut_len;
ulong script_lut_rn;
int verified = 0;
test_ctx = RSC_CreateContext();
SYSFS_GetFQFN(game_dir, "ITE.RSC", fpath, R_GAME_PATH_LIMIT);
if (RSC_OpenContext(test_ctx, fpath) != R_SUCCESS) {
return R_FAILURE;
}
script_lut_rn =
GameDescs[R_GAME_ITE_DISK].gd_resource_desc->script_lut_rn;
if (RSC_GetResourceSize(test_ctx,
script_lut_rn, &script_lut_len) != R_SUCCESS) {
RSC_DestroyContext(test_ctx);
return R_FAILURE;
}
RSC_DestroyContext(test_ctx);
if (script_lut_len % R_SCR_LUT_ENTRYLEN_ITEDISK == 0) {
verified = 1;
}
if (!verified) {
return R_FAILURE;
}
return R_SUCCESS;
}
int Verify_ITECD(const char *game_dir)
{
YS_IGNORE_PARAM(game_dir);
return R_SUCCESS;
}
int Verify_IHNMDEMO(const char *game_dir)
{
YS_IGNORE_PARAM(game_dir);
return R_SUCCESS;
}
int Verify_IHNMCD(const char *game_dir)
{
YS_IGNORE_PARAM(game_dir);
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: game.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/game.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game detection, general game parameters
Notes:
*/
#ifndef SAGA_GAME_H_
#define SAGA_GAME_H_
namespace Saga {
#define R_GAME_LANGSTR_LIMIT 3
#define R_GAME_PATH_LIMIT 512
#define R_GAME_ITE_LANG_PREFIX "ite_"
#define R_GAME_LANG_EXT "lng"
/* Script lookup table entry sizes for game verification */
#define R_SCR_LUT_ENTRYLEN_ITECD 22
#define R_SCR_LUT_ENTRYLEN_ITEDISK 16
typedef int (*R_GAME_VERIFYFUNC) (const char *);
typedef struct R_GAME_FILEDESC_tag {
const char *gf_fname;
uint gf_type;
} R_GAME_FILEDESC;
typedef struct R_GAMEDESC_tag {
int gd_game_type;
int gd_game_id;
const char *gd_title;
int gd_logical_w;
int gd_logical_h;
int gd_scene_h;
int gd_startscene;
R_GAME_RESOURCEDESC *gd_resource_desc;
int gd_filect;
R_GAME_FILEDESC *gd_filedescs;
int gd_fontct;
R_GAME_FONTDESC *gd_fontdescs;
R_GAME_SOUNDINFO *gd_soundinfo;
R_GAME_VERIFYFUNC gd_verifyf;
int gd_supported;
} R_GAMEDESC;
typedef struct R_GAME_FILEDATA_tag {
R_RSCFILE_CONTEXT *file_ctxt;
uint file_types;
uint file_flags;
} R_GAME_FILEDATA;
typedef struct R_GAMEMODULE_tag {
int game_init;
int game_number;
R_GAMEDESC *gamedesc;
int g_skipintro;
char game_dir[R_MAXPATH];
char data_dir[R_MAXPATH];
char game_language[R_GAME_LANGSTR_LIMIT];
uint gfile_n;
R_GAME_FILEDATA *gfile_data;
uint gd_fontct;
R_GAME_FONTDESC *gd_fontdescs;
int err_n;
const char *err_str;
} R_GAMEMODULE;
int LoadLanguage(void);
int DetectGame(const char *game_dir, uint * game_n_p);
int LoadGame(const char *game_dir, uint game_n_p);
int Verify_ITEDEMO(const char *game_dir);
int Verify_ITEDISK(const char *game_dir);
int Verify_ITECD(const char *game_dir);
int Verify_IHNMDEMO(const char *game_dir);
int Verify_IHNMCD(const char *game_dit);
} // End of namespace Saga
#endif /* R_GAME_H_ */
/* end "r_game.h" */
--- NEW FILE: game_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/game_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game detection, general game parameters - module header
Notes:
*/
#ifndef SAGA_GAME_MOD_H__
#define SAGA_GAME_MOD_H__
namespace Saga {
enum R_GAME_BASETYPES {
R_GAMETYPE_ITE,
R_GAMETYPE_IHNM
};
enum R_GAME_IDS {
R_GAME_ITE_DEMO = 0,
R_GAME_ITE_DISK = 1,
R_GAME_ITE_CD = 2,
R_GAME_IHNM_DEMO = 3,
R_GAME_IHNM_CD = 4
};
enum R_GAME_FILETYPES {
R_GAME_RESOURCEFILE = 0x01,
R_GAME_SCRIPTFILE = 0x02,
R_GAME_SOUNDFILE = 0x04,
R_GAME_VOICEFILE = 0x08,
R_GAME_DEMOFILE = 0x10,
R_GAME_MUSICFILE = 0x20
};
enum R_GAME_SOUNDINFO_TYPES {
R_GAME_SOUND_PCM = 0,
R_GAME_SOUND_VOC,
R_GAME_SOUND_WAV
};
enum R_GAME_FONT_IDS {
R_GAME_FONT_SMALL = 0,
R_GAME_FONT_MEDIUM,
R_GAME_FONT_LARGE,
R_GAME_FONT_SMALL2,
R_GAME_FONT_MEDIUM2,
R_GAME_FONT_LARGE2,
R_GAME_FONT_LARGE3
};
typedef struct R_GAME_DISPLAYINFO_tag {
int logical_w;
int logical_h;
int scene_h;
} R_GAME_DISPLAYINFO;
typedef struct R_GAMESOUND_INFO_tag {
int res_type;
long freq;
int sample_size;
int stereo;
} R_GAME_SOUNDINFO;
typedef struct R_GAMEFONT_DESC_tag {
uint font_id;
ulong font_rn;
} R_GAME_FONTDESC;
typedef struct R_GAMESCENE_DESC_tag {
ulong scene_lut_rn;
ulong first_scene;
} R_GAME_SCENEDESC;
typedef struct R_GAMERESOURCE_DESC_tag {
ulong scene_lut_rn;
ulong script_lut_rn;
ulong command_panel_rn;
ulong dialogue_panel_rn;
} R_GAME_RESOURCEDESC;
int GAME_Register(void);
int GAME_Init(void);
int GAME_GetFileContext(R_RSCFILE_CONTEXT ** ctxt_p, uint r_type, int param);
int GAME_GetFontInfo(R_GAME_FONTDESC **, int *);
int GAME_GetResourceInfo(R_GAME_RESOURCEDESC *);
int GAME_GetSoundInfo(R_GAME_SOUNDINFO *);
int GAME_GetDisplayInfo(R_GAME_DISPLAYINFO *);
int GAME_GetSceneInfo(R_GAME_SCENEDESC *);
int GAME_GetGame(void);
int GAME_GetGameType(void);
int GAME_GetErrN(void);
void GAME_setGameDirectory(const char *gamedir);
const char *GAME_GetErrS(void);
} // End of namespace Saga
#endif /* R_GAME_MOD_H__ */
/* end "r_game_mod.h" */
--- NEW FILE: gfx.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
[...1059 lines suppressed...]
write_p += ds->buf_pitch;
}
write_p += x_vector;
/***********/
}
/* Vertical seg */
for (k = 0; k < end_run; k++) {
*write_p = (uchar) color;
write_p += ds->buf_pitch;
}
write_p += x_vector;
/***********/
return;
}
return;
}
} // End of namespace Saga
--- NEW FILE: gfx.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/gfx.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Graphics maniuplation routines - private header file
Notes:
*/
#ifndef SAGA_GFX_H_
#define SAGA_GFX_H_
namespace Saga {
#define R_CURSOR_W 7
#define R_CURSOR_H 7
#define R_CURSOR_ORIGIN_X 4
#define R_CURSOR_ORIGIN_Y 4
#define R_CLAMP(a, min, max) \
(a = (a < (min)) ? (min) : ((a > max) ? (max) : a ))
#define R_CLAMP_RECT( rect, xmin, xmax, ymin, ymax ) \
R_CLAMP( rect->x1, xmin, xmax ); \
R_CLAMP( rect->x2, xmin, xmax ); \
R_CLAMP( rect->y1, ymin, ymax ); \
R_CLAMP( rect->y2, ymin, ymax )
} // End of namespace Saga
#endif /* R_GFX_H_ */
/* end "r_gfx_h_ */
--- NEW FILE: gfx_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/gfx_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Graphics manipulation routines - module header file
Notes:
*/
#ifndef SAGA_GFX_MOD_H_
#define SAGA_GFX_MOD_H_
namespace Saga {
typedef struct R_CLIPINFO_tag {
/* input members */
const R_RECT *src_rect;
const R_RECT *dst_rect;
const R_POINT *dst_pt;
/* output members */
int nodraw;
int src_draw_x;
int src_draw_y;
int dst_draw_x;
int dst_draw_y;
int draw_w;
int draw_h;
} R_CLIPINFO;
int GFX_SimpleBlit(R_SURFACE * dst_s, R_SURFACE * src_s);
int GFX_Scale2x(R_SURFACE * dst_s, R_SURFACE * src_s);
int GFX_Scale2x8(R_SURFACE * dst_s, R_SURFACE * src_s);
int GFX_Scale2x16(R_SURFACE * dst_s, R_SURFACE * src_s);
int GFX_SLScale2x16(char *dest_buf,
int dest_w,
int dest_p, int dst_h, char *src_buf, int src_w, int src_p, int src_h);
int GFX_ClearSurface(char *buf, int w, int h, int p);
int GFX_ClearSurface16(char *buf, int w, int h, int p);
int GFX_DrawPalette(R_SURFACE * dst_s);
int GFX_BufToSurface(R_SURFACE * ds,
const uchar * src,
int src_w, int src_h, R_RECT * src_rect, R_POINT * dst_pt);
int
GFX_BufToBuffer(uchar * dst_buf,
int dst_w,
int dst_h,
const uchar * src,
int src_w, int src_h, R_RECT * src_rect, R_POINT * dst_pt);
int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1);
int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color);
int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color);
int GFX_DrawPolyLine(R_SURFACE * ds, R_POINT * pts, int pt_ct, int draw_color);
int GFX_GetClipInfo(R_CLIPINFO * clipinfo);
int
GFX_ClipLine(R_SURFACE * ds,
const R_POINT * src_p1,
const R_POINT * src_p2, R_POINT * dst_p1, R_POINT * dst_p2);
void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color);
} // End of namespace Saga
#endif /* R_GFX_MOD_H_ */
/* end "r_gfx_mod.h" */
--- NEW FILE: ihnm_introproc.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/ihnm_introproc.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
"I Have No Mouth" Intro sequence scene procedures
Notes:
*/
#include
#include
#include
#include "yslib.h"
#include "reinherit.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "animation_mod.h"
#include "cvar_mod.h"
#include "events_mod.h"
#include "font_mod.h"
#include "rscfile_mod.h"
#include "scene_mod.h"
#include "text_mod.h"
#include "palanim_mod.h"
/*
* Begin module:
\*--------------------------------------------------------------------------*/
#include "scene.h"
#include "ihnm_introproc.h"
namespace Saga {
R_SCENE_RESLIST IHNM_IntroMovie1RL[] = {
{30, SAGA_BG_IMAGE}
,
{31, SAGA_ANIM_1}
};
R_SCENE_DESC IHNM_IntroMovie1Desc = {
0, 0, 0, 0, 0, 0, 0, 0,
IHNM_IntroMovie1RL,
YS_NELEMS(IHNM_IntroMovie1RL)
};
R_SCENE_RESLIST IHNM_IntroMovie2RL[] = {
{32, SAGA_BG_IMAGE}
,
{33, SAGA_ANIM_1}
};
R_SCENE_DESC IHNM_IntroMovie2Desc = {
0, 0, 0, 0, 0, 0, 0, 0,
IHNM_IntroMovie2RL,
YS_NELEMS(IHNM_IntroMovie2RL)
};
R_SCENE_RESLIST IHNM_IntroMovie3RL[] = {
{34, SAGA_BG_IMAGE}
,
{35, SAGA_ANIM_1}
};
R_SCENE_DESC IHNM_IntroMovie3Desc = {
0, 0, 0, 0, 0, 0, 0, 0,
IHNM_IntroMovie3RL,
YS_NELEMS(IHNM_IntroMovie3RL)
};
R_SCENE_RESLIST IHNM_IntroMovie4RL[] = {
{1227, SAGA_BG_IMAGE}
,
{1226, SAGA_ANIM_1}
};
R_SCENE_DESC IHNM_IntroMovie4Desc = {
0, 0, 0, 0, 0, 0, 0, 0,
IHNM_IntroMovie4RL,
YS_NELEMS(IHNM_IntroMovie4RL)
};
R_SCENE_QUEUE IHNM_IntroList[] = {
{0, &IHNM_IntroMovie1Desc, BY_DESC, IHNM_IntroMovieProc1, 0}
,
{0, &IHNM_IntroMovie2Desc, BY_DESC, IHNM_IntroMovieProc2, 0}
,
{0, &IHNM_IntroMovie3Desc, BY_DESC, IHNM_IntroMovieProc3, 0}
,
{0, &IHNM_IntroMovie4Desc, BY_DESC, IHNM_HateProc, 0}
};
int IHNM_StartProc(void)
{
size_t n_introscenes;
size_t i;
n_introscenes = YS_NELEMS(IHNM_IntroList);
for (i = 0; i < n_introscenes; i++) {
SCENE_Queue(&IHNM_IntroList[i]);
}
return R_SUCCESS;
}
int IHNM_IntroMovieProc1(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event = { 0 };
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
/* Background for intro scene is the first frame of the
* intro animation; display it and set the palette
\*-----------------------------------------------------*/
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = SET_PALETTE;
event.time = 0;
EVENT_Queue(&event);
ANIM_SetFrameTime(0, R_IHNM_INTRO_FRAMETIME);
ANIM_SetFlag(0, ANIM_ENDSCENE);
ANIM_Play(0, 0);
break;
default:
break;
}
return 0;
}
int IHNM_IntroMovieProc2(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event = { 0 };
R_EVENT *q_event;
PALENTRY *pal;
static PALENTRY current_pal[R_PAL_ENTRIES];
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
/* Fade to black out of the intro CyberDreams logo anim
* \*----------------------------------------------------- */
SYSGFX_GetCurrentPal(current_pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_PALTOBLACK;
event.time = 0;
event.duration = R_IHNM_PALFADE_TIME;
event.data = current_pal;
q_event = EVENT_Queue(&event);
/* Background for intro scene is the first frame of the
* intro animation; display it but don't set palette
\*-----------------------------------------------------*/
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = NO_SET_PALETTE;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
/* Fade in from black to the scene background palette
* \*----------------------------------------------------- */
SCENE_GetBGPal(&pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_BLACKTOPAL;
event.time = 0;
event.duration = R_IHNM_PALFADE_TIME;
event.data = pal;
q_event = EVENT_Chain(q_event, &event);
ANIM_SetFlag(0, ANIM_LOOP);
ANIM_Play(0, R_IHNM_PALFADE_TIME * 2);
/* Queue end of scene after looping animation for a while
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = R_IHNM_DGLOGO_TIME;
q_event = EVENT_Chain(q_event, &event);
break;
default:
break;
}
return 0;
}
int IHNM_IntroMovieProc3(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event = { 0 };
R_EVENT *q_event;
PALENTRY *pal;
static PALENTRY current_pal[R_PAL_ENTRIES];
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
/* Fade to black out of the intro DG logo anim
* \*----------------------------------------------------- */
SYSGFX_GetCurrentPal(current_pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_PALTOBLACK;
event.time = 0;
event.duration = R_IHNM_PALFADE_TIME;
event.data = current_pal;
q_event = EVENT_Queue(&event);
/* Background for intro scene is the first frame of the
* intro animation; display it but don't set palette
\*-----------------------------------------------------*/
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = NO_SET_PALETTE;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
/* Fade in from black to the scene background palette
* \*----------------------------------------------------- */
SCENE_GetBGPal(&pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_BLACKTOPAL;
event.time = 0;
event.duration = R_IHNM_PALFADE_TIME;
event.data = pal;
q_event = EVENT_Chain(q_event, &event);
ANIM_Play(0, 0);
/* Queue end of scene after a while
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = R_IHNM_TITLE_TIME;
q_event = EVENT_Chain(q_event, &event);
break;
default:
break;
}
return 0;
}
int IHNM_HateProc(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event = { 0 };
R_EVENT *q_event;
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
/* Background for intro scene is the first frame of the
* intro animation; display it and set the palette
\*-----------------------------------------------------*/
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = SET_PALETTE;
event.time = 0;
q_event = EVENT_Queue(&event);
ANIM_SetFlag(0, ANIM_LOOP);
ANIM_Play(0, 0);
break;
default:
break;
}
return 0;
}
} // End of namespace Saga
--- NEW FILE: ihnm_introproc.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/ihnm_introproc.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Intro sequence scene procedures header file
Notes:
*/
#ifndef SAGA_ITE_INTRO_H_
#define SAGA_ITE_INTRO_H_
namespace Saga {
#define R_IHNM_PALFADE_TIME 1000
#define R_IHNM_INTRO_FRAMETIME 80
#define R_IHNM_DGLOGO_TIME 8000
#define R_IHNM_TITLE_TIME 16000
} // End of namespace Saga
#endif /* R_IHNM_INTRO_H_ */
/* end "r_ihnm_introproc.h */
--- NEW FILE: image.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/image.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
SAGA Image resource management routines
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "game_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "image_mod.h"
#include "image.h"
namespace Saga {
int
IMG_DecodeBGImage(const uchar * image_data,
size_t image_size,
uchar ** output_buf, size_t * output_buf_len, int *w, int *h)
{
R_IMAGE_HEADER hdr;
int modex_height;
const uchar *RLE_data_ptr;
size_t RLE_data_len;
uchar *decode_buf;
size_t decode_buf_len;
uchar *out_buf;
size_t out_buf_len;
const uchar *read_p = image_data;
if (image_size <= SAGA_IMAGE_DATA_OFFSET) {
/* Image size is way too small */
return R_FAILURE;
}
hdr.width = ys_read_u16_le(read_p, &read_p);
hdr.height = ys_read_u16_le(read_p, &read_p);
hdr.unknown4 = ys_read_u16_le(read_p, &read_p);
hdr.unknown6 = ys_read_u16_le(read_p, &read_p);
RLE_data_ptr = image_data + SAGA_IMAGE_DATA_OFFSET;
RLE_data_len = image_size - SAGA_IMAGE_DATA_OFFSET;
modex_height = Granulate(hdr.height, 4);
decode_buf_len = hdr.width * modex_height;
decode_buf = (uchar *)malloc(decode_buf_len);
out_buf_len = hdr.width * hdr.height;
out_buf = (uchar *)malloc(out_buf_len);
if (DecodeBGImageRLE(RLE_data_ptr,
RLE_data_len, decode_buf, decode_buf_len) != R_SUCCESS) {
free(decode_buf);
free(out_buf);
return R_FAILURE;
}
UnbankBGImage(out_buf, decode_buf, hdr.width, hdr.height);
/* For some reason bg images in IHNM are upside down
* \*------------------------------------------------------------- */
if (GAME_GetGameType() == R_GAMETYPE_IHNM) {
FlipImage(out_buf, hdr.width, hdr.height);
}
free(decode_buf);
*output_buf_len = out_buf_len;
*output_buf = out_buf;
*w = hdr.width;
*h = hdr.height;
return R_SUCCESS;
}
int
DecodeBGImageRLE(const uchar * inbuf,
size_t inbuf_len, uchar * outbuf, size_t outbuf_len)
{
const uchar *inbuf_ptr;
uchar *outbuf_ptr;
size_t inbuf_remain;
const uchar *inbuf_end;
uchar *outbuf_end;
size_t outbuf_remain;
uchar mark_byte;
int test_byte;
uint runcount;
uchar bitfield;
uchar bitfield_byte1;
uchar bitfield_byte2;
uchar *backtrack_ptr;
int backtrack_amount;
uint c, b;
int decode_err = 0;
inbuf_ptr = inbuf;
inbuf_remain = inbuf_len;
outbuf_ptr = outbuf;
outbuf_remain = outbuf_len;
inbuf_end = (inbuf + inbuf_len) - 1;
outbuf_end = (outbuf + outbuf_len) - 1;
memset(outbuf, 0, outbuf_len);
while ((inbuf_remain > 1) && (outbuf_remain > 0) && !decode_err) {
if ((inbuf_ptr > inbuf_end) || (outbuf_ptr > outbuf_end)) {
return R_FAILURE;
}
mark_byte = *inbuf_ptr++;
inbuf_remain--;
test_byte = mark_byte & 0xC0; /* Mask all but two high order bits */
switch (test_byte) {
case 0xC0: /* 1100 0000 */
/* Uncompressed run follows: Max runlength 63 */
runcount = mark_byte & 0x3f;
if ((inbuf_remain < runcount) ||
(outbuf_remain < runcount)) {
return R_FAILURE;
}
for (c = 0; c < runcount; c++) {
*outbuf_ptr++ = *inbuf_ptr++;
}
inbuf_remain -= runcount;
outbuf_remain -= runcount;
continue;
break;
case 0x80: /* 1000 0000 */
/* Compressed run follows: Max runlength 63 */
runcount = (mark_byte & 0x3f) + 3;
if (!inbuf_remain || (outbuf_remain < runcount)) {
return R_FAILURE;
}
for (c = 0; c < runcount; c++) {
*outbuf_ptr++ = *inbuf_ptr;
}
inbuf_ptr++;
inbuf_remain--;
outbuf_remain -= runcount;
continue;
break;
case 0x40: /* 0100 0000 */
/* Repeat decoded sequence from output stream:
* Max runlength 10 */
runcount = ((mark_byte >> 3) & 0x07U) + 3;
backtrack_amount = *inbuf_ptr;
if (!inbuf_remain ||
(backtrack_amount > (outbuf_ptr - outbuf)) ||
(runcount > outbuf_remain)) {
return R_FAILURE;
}
inbuf_ptr++;
inbuf_remain--;
backtrack_ptr = outbuf_ptr - backtrack_amount;
for (c = 0; c < runcount; c++) {
*outbuf_ptr++ = *backtrack_ptr++;
}
outbuf_remain -= runcount;
continue;
break;
default: /* 0000 0000 */
break;
}
/* Mask all but the third and fourth highest order bits */
test_byte = mark_byte & 0x30;
switch (test_byte) {
case 0x30: /* 0011 0000 */
/* Bitfield compression */
runcount = (mark_byte & 0x0F) + 1;
if ((inbuf_remain < (runcount + 2)) ||
(outbuf_remain < (runcount * 8))) {
return R_FAILURE;
}
bitfield_byte1 = *inbuf_ptr++;
bitfield_byte2 = *inbuf_ptr++;
for (c = 0; c < runcount; c++) {
bitfield = *inbuf_ptr;
for (b = 0; b < 8; b++) {
if (bitfield & 0x80) {
*outbuf_ptr = bitfield_byte2;
} else {
*outbuf_ptr = bitfield_byte1;
}
bitfield <<= 1;
outbuf_ptr++;
}
inbuf_ptr++;
}
inbuf_remain -= (runcount + 2);
outbuf_remain -= (runcount * 8);
continue;
break;
case 0x20: /* 0010 0000 */
/* Uncompressed run follows */
runcount = ((mark_byte & 0x0F) << 8) + *inbuf_ptr;
if ((inbuf_remain < (runcount + 1)) ||
(outbuf_remain < runcount)) {
return R_FAILURE;
}
inbuf_ptr++;
for (c = 0; c < runcount; c++) {
*outbuf_ptr++ = *inbuf_ptr++;
}
inbuf_remain -= (runcount + 1);
outbuf_remain -= runcount;
continue;
break;
case 0x10: /* 0001 0000 */
/* Repeat decoded sequence from output stream */
backtrack_amount =
((mark_byte & 0x0F) << 8) + *inbuf_ptr;
if (inbuf_remain < 2) {
return R_FAILURE;
}
inbuf_ptr++;
runcount = *inbuf_ptr++;
if ((backtrack_amount > (outbuf_ptr - outbuf)) ||
(outbuf_remain < runcount)) {
return R_FAILURE;
}
backtrack_ptr = outbuf_ptr - backtrack_amount;
for (c = 0; c < runcount; c++) {
*outbuf_ptr++ = *backtrack_ptr++;
}
inbuf_remain -= 2;
outbuf_remain -= runcount;
continue;
break;
default:
return R_FAILURE;
break;
}
} /* end while */
return R_SUCCESS;
}
int FlipImage(uchar * img_buf, int columns, int scanlines)
{
int line;
uchar *tmp_scan;
uchar *flip_p1;
uchar *flip_p2;
int flipcount = scanlines / 2;
tmp_scan = (uchar *)malloc(columns);
if (tmp_scan == NULL) {
return R_FAILURE;
}
flip_p1 = img_buf;
flip_p2 = img_buf + (columns * (scanlines - 1));
for (line = 0; line < flipcount; line++) {
memcpy(tmp_scan, flip_p1, columns);
memcpy(flip_p1, flip_p2, columns);
memcpy(flip_p2, tmp_scan, columns);
flip_p1 += columns;
flip_p2 -= columns;
}
free(tmp_scan);
return R_SUCCESS;
}
int
UnbankBGImage(uchar * dst_buf,
const uchar * src_buf, int columns, int scanlines)
{
int x, y;
int temp;
int quadruple_rows;
int remain_rows;
int rowjump_src;
int rowjump_dest;
const uchar *src_p;
uchar *dst_p;
const uchar *srcptr1, *srcptr2, *srcptr3, *srcptr4;
uchar *dstptr1, *dstptr2, *dstptr3, *dstptr4;
quadruple_rows = scanlines - (scanlines % 4);
remain_rows = scanlines - quadruple_rows;
assert(scanlines > 0);
src_p = src_buf;
dst_p = dst_buf + columns;
srcptr1 = src_p;
srcptr2 = src_p + 1;
srcptr3 = src_p + 2;
srcptr4 = src_p + 3;
dstptr1 = dst_buf;
dstptr2 = dst_buf + columns;
dstptr3 = dst_buf + columns * 2;
dstptr4 = dst_buf + columns * 3;
rowjump_src = columns * 4;
rowjump_dest = columns * 4;
/* Unbank groups of 4 first */
for (y = 0; y < quadruple_rows; y += 4) {
for (x = 0; x < columns; x++) {
temp = x * 4;
dstptr1[x] = srcptr1[temp];
dstptr2[x] = srcptr2[temp];
dstptr3[x] = srcptr3[temp];
dstptr4[x] = srcptr4[temp];
}
/* This is to avoid generating invalid pointers -
* usually innocuous, but undefined */
if (y < quadruple_rows - 4) {
dstptr1 += rowjump_dest;
dstptr2 += rowjump_dest;
dstptr3 += rowjump_dest;
dstptr4 += rowjump_dest;
srcptr1 += rowjump_src;
srcptr2 += rowjump_src;
srcptr3 += rowjump_src;
srcptr4 += rowjump_src;
}
}
/* Unbank rows remaining */
switch (remain_rows) {
case 1:
dstptr1 += rowjump_dest;
srcptr1 += rowjump_src;
for (x = 0; x < columns; x++) {
temp = x * 4;
dstptr1[x] = srcptr1[temp];
}
break;
case 2:
dstptr1 += rowjump_dest;
dstptr2 += rowjump_dest;
srcptr1 += rowjump_src;
srcptr2 += rowjump_src;
for (x = 0; x < columns; x++) {
temp = x * 4;
dstptr1[x] = srcptr1[temp];
dstptr2[x] = srcptr2[temp];
}
break;
case 3:
dstptr1 += rowjump_dest;
dstptr2 += rowjump_dest;
dstptr3 += rowjump_dest;
srcptr1 += rowjump_src;
srcptr2 += rowjump_src;
srcptr3 += rowjump_src;
for (x = 0; x < columns; x++) {
temp = x * 4;
dstptr1[x] = srcptr1[temp];
dstptr2[x] = srcptr2[temp];
dstptr3[x] = srcptr3[temp];
}
break;
default:
break;
}
return R_SUCCESS;
}
const uchar *IMG_GetImagePal(const uchar * image_data, size_t image_size)
{
if (image_size <= SAGA_IMAGE_HEADER_LEN) {
return NULL;
}
return image_data + SAGA_IMAGE_HEADER_LEN;
}
} // End of namespace Saga
--- NEW FILE: image.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/image.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
SAGA Image resource management header file
Notes:
*/
#ifndef SAGA_IMAGE_H__
#define SAGA_IMAGE_H__
namespace Saga {
#define R_MIN_IMG_RLECODE 3
#define MODEX_SCANLINE_LIMIT 200
#define SAGA_IMAGE_DATA_OFFSET 776
#define SAGA_IMAGE_HEADER_LEN 8
typedef struct R_IMAGE_HEADER_tag {
int width;
int height;
int unknown4;
int unknown6;
} R_IMAGE_HEADER;
int
DecodeBGImageRLE(const uchar * inbuf,
size_t inbuf_len, uchar * outbuf, size_t outbuf_len);
int FlipImage(uchar * img_buf, int columns, int scanlines);
int
UnbankBGImage(uchar * dest_buf,
const uchar * src_buf, int columns, int scanlines);
} // End of namespace Saga
#endif /* R_IMAGE_H__ */
/* end "r_image.h" */
--- NEW FILE: image_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/image_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
SAGA Image resource management routines
Notes:
*/
#ifndef SAGA_IMAGE_MOD_H_
#define SAGA_IMAGE_MOD_H_
namespace Saga {
int
IMG_DecodeBGImage(const uchar * image_data,
size_t image_size,
uchar ** output_buf, size_t * output_buf_len, int *w, int *h);
const uchar *IMG_GetImagePal(const uchar * image_data, size_t image_size);
} // End of namespace Saga
#endif /* R_IMAGE_MOD_H_ */
/* end "r_image_mod.h" */
--- NEW FILE: interface.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/interface.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game interface module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "game_mod.h"
#include "cvar_mod.h"
#include "actor_mod.h"
#include "console_mod.h"
#include "font_mod.h"
#include "gfx_mod.h"
#include "image_mod.h"
#include "objectmap_mod.h"
#include "rscfile_mod.h"
#include "script_mod.h"
#include "sprite_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "interface_mod.h"
#include "interface.h"
namespace Saga {
static R_INTERFACE_MODULE IfModule;
static R_VERB_DATA I_VerbData[] = {
{I_VERB_WALKTO, "verb_walkto", "Walk to", S_VERB_WALKTO},
{I_VERB_LOOKAT, "verb_lookat", "Look at", S_VERB_LOOKAT},
{I_VERB_PICKUP, "verb_pickup", "Pick up", S_VERB_PICKUP},
{I_VERB_TALKTO, "verb_talkto", "Talk to", S_VERB_TALKTO},
{I_VERB_OPEN, "verb_open", "Open", S_VERB_OPEN},
{I_VERB_CLOSE, "verb_close", "Close", S_VERB_CLOSE},
{I_VERB_USE, "verb_use", "Use", S_VERB_USE},
{I_VERB_GIVE, "verb_give", "Give", S_VERB_GIVE}
};
static R_INTERFACE_DESC ITE_interface = {
ITE_STATUS_Y,
ITE_STATUS_W,
ITE_STATUS_H,
ITE_STATUS_TEXT_Y,
ITE_STATUS_TXTCOL,
ITE_STATUS_BGCOL,
ITE_CMD_TEXT_COL,
ITE_CMD_TEXT_SHADOWCOL,
ITE_CMD_TEXT_HILITECOL,
COMMAND_DEFAULT_BUTTON,
ITE_LPORTRAIT_X,
ITE_LPORTRAIT_Y
};
static R_INTERFACE_BUTTON ITE_c_buttons[] = {
{5, 4, 46, 47, "Portrait", 0, 0, BUTTON_NONE, 0},
/* "Walk To" and "Talk To" share button sprites */
{52, 4, 109, 14, "Walk To", 1, 2, BUTTON_VERB, I_VERB_WALKTO},
{52, 15, 109, 25, "Look At", 3, 4, BUTTON_VERB, I_VERB_LOOKAT},
{52, 26, 109, 36, "Pick Up", 5, 6, BUTTON_VERB, I_VERB_PICKUP},
{52, 37, 109, 47, "Talk To", 1, 2, BUTTON_VERB, I_VERB_TALKTO},
{110, 4, 166, 14, "Open", 7, 8, BUTTON_VERB, I_VERB_OPEN},
{110, 15, 166, 25, "Close", 9, 10, BUTTON_VERB, I_VERB_CLOSE},
{110, 26, 166, 36, "Use", 11, 12, BUTTON_VERB, I_VERB_USE},
{110, 37, 166, 47, "Give", 13, 14, BUTTON_VERB, I_VERB_GIVE},
{181, 6, 206, 24, "Inv1", 0, 0, BUTTON_NONE, 0},
{213, 6, 240, 24, "Inv2", 0, 0, BUTTON_NONE, 0},
{245, 6, 272, 24, "Inv3", 0, 0, BUTTON_NONE, 0},
{277, 6, 304, 24, "Inv4", 0, 0, BUTTON_NONE, 0},
{181, 27, 208, 45, "Inv5", 0, 0, BUTTON_NONE, 0},
{213, 27, 240, 45, "Inv6", 0, 0, BUTTON_NONE, 0},
{245, 27, 272, 45, "Inv7", 0, 0, BUTTON_NONE, 0},
{277, 27, 304, 45, "Inv8", 0, 0, BUTTON_NONE, 0},
{306, 6, 314, 11, "InvUp", 0, 0, BUTTON_NONE, 0},
{306, 41, 314, 45, "InvDown", 0, 0, BUTTON_NONE, 0}
};
static R_INTERFACE_DESC IHNM_interface = {
IHNM_STATUS_Y,
IHNM_STATUS_W,
IHNM_STATUS_H,
IHNM_STATUS_TEXT_Y,
IHNM_STATUS_TXTCOL,
IHNM_STATUS_BGCOL,
IHNM_CMD_TEXT_COL,
IHNM_CMD_TEXT_SHADOWCOL,
IHNM_CMD_TEXT_HILITECOL,
COMMAND_DEFAULT_BUTTON,
IHNM_LPORTRAIT_X,
IHNM_LPORTRAIT_Y
};
static R_INTERFACE_BUTTON IHNM_c_buttons[] = {
{5, 4, 46, 47, "Portrait", 0, 0, 0, 0}
};
int INTERFACE_RegisterLang(void)
{
size_t i;
for (i = 0; i < YS_NELEMS(I_VerbData); i++) {
if (CVAR_Register_S(I_VerbData[i].verb_str,
I_VerbData[i].verb_cvar,
NULL, R_CVAR_CFG, R_VERB_STRLIMIT) != R_SUCCESS) {
return R_FAILURE;
}
assert(CVAR_Find(I_VerbData[i].verb_cvar) != NULL);
}
return R_SUCCESS;
}
int INTERFACE_Init(void)
{
R_GAME_RESOURCEDESC g_resdesc;
int game_type;
int result;
if (IfModule.init) {
return R_FAILURE;
}
IfModule.i_thread = STHREAD_Create();
if (IfModule.i_thread == NULL) {
R_printf(R_STDERR,
"Error creating script thread for game interface "
"module.\n");
return R_FAILURE;
}
/* Load interface module resource file context
* \*------------------------------------------------------------- */
result = GAME_GetFileContext(&IfModule.i_file_ctxt,
R_GAME_RESOURCEFILE, 0);
if (result != R_SUCCESS) {
return R_FAILURE;
}
/* Initialize interface data by game type
* \*------------------------------------------------------------- */
game_type = GAME_GetGameType();
if (game_type == R_GAMETYPE_ITE) {
/* Load Inherit the Earth interface desc */
IfModule.c_panel.buttons = ITE_c_buttons;
IfModule.c_panel.nbuttons = YS_NELEMS(ITE_c_buttons);
IfModule.i_desc = ITE_interface;
} else if (game_type == R_GAMETYPE_IHNM) {
/* Load I Have No Mouth interface desc */
IfModule.c_panel.buttons = IHNM_c_buttons;
IfModule.c_panel.nbuttons = YS_NELEMS(IHNM_c_buttons);
IfModule.i_desc = IHNM_interface;
} else {
return R_FAILURE;
}
/* Load interface resources
* \*------------------------------------------------------------- */
GAME_GetResourceInfo(&g_resdesc);
/* Load command panel resource */
result = RSC_LoadResource(IfModule.i_file_ctxt,
g_resdesc.command_panel_rn,
&IfModule.c_panel.res, &IfModule.c_panel.res_len);
if (result != R_SUCCESS) {
return R_FAILURE;
}
/* Load dialogue panel resource */
result = RSC_LoadResource(IfModule.i_file_ctxt,
g_resdesc.dialogue_panel_rn,
&IfModule.d_panel.res, &IfModule.d_panel.res_len);
if (result != R_SUCCESS) {
return R_FAILURE;
}
SPRITE_LoadList(ITE_COMMAND_BUTTONSPRITES, &IfModule.c_panel.sprites);
SPRITE_LoadList(ITE_DEFAULT_PORTRAITS, &IfModule.def_portraits);
IMG_DecodeBGImage(IfModule.c_panel.res,
IfModule.c_panel.res_len,
&IfModule.c_panel.img,
&IfModule.c_panel.img_len,
&IfModule.c_panel.img_w, &IfModule.c_panel.img_h);
IMG_DecodeBGImage(IfModule.d_panel.res,
IfModule.d_panel.res_len,
&IfModule.d_panel.img,
&IfModule.d_panel.img_len,
&IfModule.d_panel.img_w, &IfModule.d_panel.img_h);
IfModule.c_panel.x = 0;
IfModule.c_panel.y = 149;
IfModule.d_panel.x = 0;
IfModule.d_panel.y = 149;
IfModule.c_panel.set_button = COMMAND_DEFAULT_BUTTON;
IfModule.active_portrait = 0;
IfModule.active_verb = I_VERB_WALKTO;
IfModule.init = 1;
return R_SUCCESS;
}
int INTERFACE_Activate(void)
{
IfModule.active = 1;
INTERFACE_Draw();
return R_SUCCESS;
}
int INTERFACE_Deactivate(void)
{
IfModule.active = 0;
return R_SUCCESS;
}
int INTERFACE_SetStatusText(const char *new_txt)
{
assert(new_txt != NULL);
strncpy(IfModule.status_txt, new_txt, R_STATUS_TEXT_LEN);
return R_SUCCESS;
}
int INTERFACE_Draw(void)
{
R_GAME_DISPLAYINFO g_di;
R_SURFACE *back_buf;
int xbase;
int ybase;
int lportrait_x;
int lportrait_y;
R_RECT rect;
R_POINT origin;
back_buf = SYSGFX_GetBackBuffer();
if (!IfModule.active) {
return R_SUCCESS;
}
/* Get game display info
* \*------------------------------------------------------------- */
GAME_GetDisplayInfo(&g_di);
/* Erase background of status bar
* \*------------------------------------------------------------- */
rect.x1 = 0;
rect.y1 = IfModule.i_desc.status_y;
rect.x2 = g_di.logical_w - 1;
rect.y2 = IfModule.i_desc.status_h - 1;
GFX_DrawRect(back_buf, &rect, IfModule.i_desc.status_bgcol);
/* Draw command panel background
* \*------------------------------------------------------------- */
if (IfModule.panel_mode == PANEL_COMMAND) {
xbase = IfModule.c_panel.x;
ybase = IfModule.c_panel.y;
origin.x = 0;
origin.y = g_di.logical_h - IfModule.c_panel.img_h;
GFX_BufToSurface(back_buf,
IfModule.c_panel.img,
IfModule.c_panel.img_w,
IfModule.c_panel.img_h, NULL, &origin);
} else {
xbase = IfModule.d_panel.x;
ybase = IfModule.d_panel.y;
origin.x = 0;
origin.y = g_di.logical_h - IfModule.c_panel.img_h;
GFX_BufToSurface(back_buf,
IfModule.d_panel.img,
IfModule.d_panel.img_w,
IfModule.d_panel.img_h, NULL, &origin);
}
/* Draw character portrait
* \*------------------------------------------------------------- */
lportrait_x = xbase + IfModule.i_desc.lportrait_x;
lportrait_y = ybase + IfModule.i_desc.lportrait_y;
SPRITE_Draw(back_buf,
IfModule.def_portraits,
IfModule.active_portrait, lportrait_x, lportrait_y);
return R_SUCCESS;
}
int INTERFACE_Update(R_POINT * imouse_pt, int update_flag)
{
R_GAME_DISPLAYINFO g_di;
R_SURFACE *back_buf;
int imouse_x, imouse_y;
assert(imouse_pt != NULL);
if (!IfModule.active) {
return R_SUCCESS;
}
imouse_x = imouse_pt->x;
imouse_y = imouse_pt->y;
back_buf = SYSGFX_GetBackBuffer();
/* Get game display info
* \*------------------------------------------------------------- */
GAME_GetDisplayInfo(&g_di);
/* Update playfield space ( only if cursor is inside )
* \*------------------------------------------------------------- */
if (imouse_y < g_di.scene_h) {
/* Mouse is in playfield space */
if (update_flag == UPDATE_MOUSEMOVE) {
HandlePlayfieldUpdate(back_buf, imouse_pt);
} else if (update_flag == UPDATE_MOUSECLICK) {
HandlePlayfieldClick(back_buf, imouse_pt);
}
}
/* Update command space
* \*------------------------------------------------------------- */
if (update_flag == UPDATE_MOUSEMOVE) {
HandleCommandUpdate(back_buf, imouse_pt);
} else if (update_flag == UPDATE_MOUSECLICK) {
HandleCommandClick(back_buf, imouse_pt);
}
DrawStatusBar(back_buf);
return R_SUCCESS;
}
int DrawStatusBar(R_SURFACE * ds)
{
R_GAME_DISPLAYINFO g_di;
R_RECT rect;
int string_w;
/* Get game display info
* \*------------------------------------------------------------- */
GAME_GetDisplayInfo(&g_di);
/* Erase background of status bar
* \*------------------------------------------------------------- */
rect.x1 = 0;
rect.y1 = IfModule.i_desc.status_y;
rect.x2 = g_di.logical_w - 1;
rect.y2 = IfModule.i_desc.status_y + IfModule.i_desc.status_h - 1;
GFX_DrawRect(ds, &rect, IfModule.i_desc.status_bgcol);
string_w = FONT_GetStringWidth(SMALL_FONT_ID,
IfModule.status_txt, 0, 0);
FONT_Draw(SMALL_FONT_ID,
ds,
IfModule.status_txt,
0,
(IfModule.i_desc.status_w / 2) - (string_w / 2),
IfModule.i_desc.status_y + IfModule.i_desc.status_txt_y,
IfModule.i_desc.status_txt_col, 0, 0);
return R_SUCCESS;
}
int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt)
{
int hit_button;
int ibutton_num;
int x_base;
int y_base;
int button_x = 0;
int button_y = 0;
int old_set_button;
int set_button;
hit_button = INTERFACE_HitTest(imouse_pt, &ibutton_num);
if (hit_button != R_SUCCESS) {
/* Clicking somewhere other than a button doesn't do anything */
return R_SUCCESS;
}
x_base = IfModule.c_panel.x;
y_base = IfModule.c_panel.y;
if (IfModule.c_panel.buttons[ibutton_num].flags & BUTTON_SET) {
old_set_button = IfModule.c_panel.set_button;
set_button = ibutton_num;
IfModule.c_panel.set_button = set_button;
if (IfModule.c_panel.buttons[set_button].flags & BUTTON_VERB) {
IfModule.active_verb =
IfModule.c_panel.buttons[ibutton_num].data;
}
if (IfModule.c_panel.buttons[set_button].flags & BUTTON_BITMAP) {
button_x =
x_base + IfModule.c_panel.buttons[set_button].x1;
button_y =
y_base + IfModule.c_panel.buttons[set_button].y1;
SPRITE_Draw(ds,
IfModule.c_panel.sprites,
IfModule.c_panel.buttons[set_button].
active_sprite - 1, button_x, button_y);
}
if (IfModule.c_panel.buttons[old_set_button].
flags & BUTTON_BITMAP) {
button_x =
x_base +
IfModule.c_panel.buttons[old_set_button].x1;
button_y =
y_base +
IfModule.c_panel.buttons[old_set_button].y1;
SPRITE_Draw(ds,
IfModule.c_panel.sprites,
IfModule.c_panel.buttons[old_set_button].
inactive_sprite - 1, button_x, button_y);
}
}
return R_SUCCESS;
}
int HandleCommandUpdate(R_SURFACE * ds, R_POINT * imouse_pt)
{
int hit_button;
int ibutton_num;
int button_x = 0;
int button_y = 0;
int button_w = 0;
int verb_idx = 0;
int string_w = 0;
int color;
int i;
hit_button = INTERFACE_HitTest(imouse_pt, &ibutton_num);
if (hit_button == R_SUCCESS) {
/* Hovering over a command panel button */
INTERFACE_SetStatusText(I_VerbData[IfModule.active_verb].
verb_str);
}
for (i = 0; i < IfModule.c_panel.nbuttons; i++) {
if (!(IfModule.c_panel.buttons[i].flags & BUTTON_LABEL)) {
continue;
}
button_w = IfModule.c_panel.buttons[i].x2 -
IfModule.c_panel.buttons[i].x1;
verb_idx = IfModule.c_panel.buttons[i].data;
string_w = FONT_GetStringWidth(SMALL_FONT_ID,
I_VerbData[verb_idx].verb_str, 0, 0);
if (i == hit_button) {
color = IfModule.i_desc.cmd_txt_hilitecol;
} else {
color = IfModule.i_desc.cmd_txt_col;
}
button_x = IfModule.c_panel.x + IfModule.c_panel.buttons[i].x1;
button_y = IfModule.c_panel.y + IfModule.c_panel.buttons[i].y1;
FONT_Draw(SMALL_FONT_ID,
ds,
I_VerbData[verb_idx].verb_str,
0,
button_x + ((button_w / 2) - (string_w / 2)),
button_y + 1,
color, IfModule.i_desc.cmd_txt_shadowcol, FONT_SHADOW);
if ((i == IfModule.c_panel.set_button) &&
(IfModule.c_panel.buttons[i].flags & BUTTON_BITMAP)) {
SPRITE_Draw(ds,
IfModule.c_panel.sprites,
IfModule.c_panel.buttons[i].active_sprite - 1,
button_x, button_y);
}
}
return R_SUCCESS;
}
int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt)
{
int hit_object;
int object_num;
uint object_flags = 0;
int script_num;
R_POINT iactor_pt;
hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num);
if (hit_object != R_SUCCESS) {
/* Player clicked on empty spot - walk here regardless of verb */
ACTOR_StoA(&iactor_pt, imouse_pt);
ACTOR_WalkTo(0, &iactor_pt, 0, NULL);
return R_SUCCESS;
}
if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) {
CON_Print("Invalid object number: %d\n", object_num);
return R_FAILURE;
}
if (object_flags & R_OBJECT_NORMAL) {
if (OBJECTMAP_GetEPNum(object_num, &script_num) == R_SUCCESS) {
/* Set active verb in script module */
SDATA_PutWord(4, 4,
I_VerbData[IfModule.active_verb].s_verb);
/* Execute object script if present */
if (script_num != 0) {
STHREAD_Execute(IfModule.i_thread, script_num);
}
}
} else {
/* Not a normal scene object - walk to it as if it weren't there */
ACTOR_StoA(&iactor_pt, imouse_pt);
ACTOR_WalkTo(0, &iactor_pt, 0, NULL);
}
return R_SUCCESS;
}
int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt)
{
const char *object_name;
int object_num;
uint object_flags = 0;
char new_status[R_STATUS_TEXT_LEN];
int hit_object;
new_status[0] = 0;
hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num);
if (hit_object != R_SUCCESS) {
/* Cursor over nothing - just display current verb */
INTERFACE_SetStatusText(I_VerbData[IfModule.active_verb].
verb_str);
return R_SUCCESS;
}
if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) {
CON_Print("Invalid object number: %d\n", object_num);
return R_FAILURE;
}
OBJECTMAP_GetName(object_num, &object_name);
if (object_flags & R_OBJECT_NORMAL) {
/* Normal scene object - display as subject of verb */
snprintf(new_status,
R_STATUS_TEXT_LEN,
"%s %s",
I_VerbData[IfModule.active_verb].verb_str, object_name);
} else {
/* Not normal scene object - override verb as we can only
* walk to this object */
snprintf(new_status,
R_STATUS_TEXT_LEN,
"%s %s", I_VerbData[I_VERB_WALKTO].verb_str, object_name);
}
INTERFACE_SetStatusText(new_status);
return R_SUCCESS;
}
int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton)
{
R_INTERFACE_BUTTON *buttons;
int nbuttons;
int xbase;
int ybase;
int i;
buttons = IfModule.c_panel.buttons;
nbuttons = IfModule.c_panel.nbuttons;
xbase = IfModule.c_panel.x;
ybase = IfModule.c_panel.y;
for (i = 0; i < nbuttons; i++) {
if ((imouse_pt->x >= (xbase + buttons[i].x1)) &&
(imouse_pt->x < (xbase + buttons[i].x2)) &&
(imouse_pt->y >= (ybase + buttons[i].y1)) &&
(imouse_pt->y < (ybase + buttons[i].y2))) {
*ibutton = i;
return R_SUCCESS;
}
}
*ibutton = -1;
return R_FAILURE;
}
int INTERFACE_Shutdown(void)
{
if (!IfModule.init) {
return R_FAILURE;
}
IfModule.init = 0;
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: interface.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/interface.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game interface module private header file
Notes:
Module dependencies:
- r_script_mod
- r_sprite_mod
*/
#ifndef SAGA_INTERFACE_H__
#define SAGA_INTERFACE_H__
namespace Saga {
#define R_VERB_STRLIMIT 32
#define R_STATUS_TEXT_LEN 128
#define COMMAND_DEFAULT_BUTTON 1
/* Inherit the Earth interface values */
#define ITE_STATUS_Y 137
#define ITE_STATUS_W 320
#define ITE_STATUS_H 12
#define ITE_STATUS_TEXT_Y 2
#define ITE_STATUS_TXTCOL 186
#define ITE_STATUS_BGCOL 15
#define ITE_CMD_TEXT_COL 147
#define ITE_CMD_TEXT_SHADOWCOL 15
#define ITE_CMD_TEXT_HILITECOL 96
#define ITE_LPORTRAIT_X 5
#define ITE_LPORTRAIT_Y 4
/* IHNMAIMS interface values */
#define IHNM_STATUS_Y 304
#define IHNM_STATUS_W 640
#define IHNM_STATUS_H 24
#define IHNM_STATUS_TEXT_Y 8
#define IHNM_STATUS_TXTCOL 186
#define IHNM_STATUS_BGCOL 0
#define IHNM_CMD_TEXT_COL 147
#define IHNM_CMD_TEXT_SHADOWCOL 15
#define IHNM_CMD_TEXT_HILITECOL 96
#define IHNM_LPORTRAIT_X 5
#define IHNM_LPORTRAIT_Y 4
typedef enum R_PANEL_MODES_tag {
PANEL_COMMAND,
PANEL_DIALOGUE
} R_PANEL_MODES;
typedef enum R_BUTTON_FLAGS_tag {
BUTTON_NONE = 0x0,
BUTTON_LABEL = 0x01,
BUTTON_BITMAP = 0x02,
BUTTON_SET = 0x04
} R_BUTTON_FLAGS;
#define BUTTON_VERB ( BUTTON_LABEL | BUTTON_BITMAP | BUTTON_SET )
typedef struct R_INTERFACE_BUTTON_tag {
int x1;
int y1;
int x2;
int y2;
char *label;
int inactive_sprite;
int active_sprite;
int flags;
int data;
} R_INTERFACE_BUTTON;
typedef struct R_INTERFACE_PANEL_tag {
uchar *res;
size_t res_len;
int x;
int y;
uchar *img;
size_t img_len;
int img_w;
int img_h;
int set_button;
int nbuttons;
R_INTERFACE_BUTTON *buttons;
R_SPRITELIST *sprites;
} R_INTERFACE_PANEL;
typedef struct R_INTERFACE_DESC_tag {
int status_y;
int status_w;
int status_h;
int status_txt_y;
int status_txt_col;
int status_bgcol;
int cmd_txt_col;
int cmd_txt_shadowcol;
int cmd_txt_hilitecol;
int cmd_defaultbutton;
int lportrait_x;
int lportrait_y;
} R_INTERFACE_DESC;
typedef struct R_INTERFACE_MODULE_tag {
int init;
int active;
R_RSCFILE_CONTEXT *i_file_ctxt;
R_INTERFACE_DESC i_desc;
R_PANEL_MODES panel_mode;
R_INTERFACE_PANEL c_panel;
R_INTERFACE_PANEL d_panel;
char status_txt[R_STATUS_TEXT_LEN];
int active_portrait;
R_SPRITELIST *def_portraits;
int active_verb;
R_SCRIPT_THREAD *i_thread;
} R_INTERFACE_MODULE;
enum INTERFACE_VERBS {
I_VERB_WALKTO,
I_VERB_LOOKAT,
I_VERB_PICKUP,
I_VERB_TALKTO,
I_VERB_OPEN,
I_VERB_CLOSE,
I_VERB_USE,
I_VERB_GIVE
};
typedef struct R_VERB_DATA_tag {
int i_verb;
const char *verb_cvar;
char verb_str[R_VERB_STRLIMIT];
int s_verb;
} R_VERB_DATA;
int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton);
int DrawStatusBar(R_SURFACE * ds);
int HandleCommandUpdate(R_SURFACE * ds, R_POINT * imouse_pt);
int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt);
int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt);
int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt);
} // End of namespace Saga
#endif /* R_INTERFACE_H__ */
/* end "r_interface.h" */
--- NEW FILE: interface_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/interface_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Game interface module public header file
Notes:
*/
#ifndef SAGA_INTERFACE_MOD_H
#define SAGA_INTERFACE_MOD_H
namespace Saga {
typedef enum INTERFACE_UPDATE_FLAGS_tag {
UPDATE_MOUSEMOVE = 1,
UPDATE_MOUSECLICK
} INTERFACE_UPDATE_FLAGS;
int INTERFACE_RegisterLang(void);
int INTERFACE_Init(void);
int INTERFACE_Shutdown(void);
int INTERFACE_Activate(void);
int INTERFACE_Deactivate(void);
int INTERFACE_SetStatusText(const char *new_txt);
int INTERFACE_Draw(void);
int INTERFACE_Update(R_POINT * imouse_pt, int update_flag);
} // End of namespace Saga
#endif /* SAGA_INTERFACE_MOD_H */
--- NEW FILE: isomap.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Isometric level module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "game_mod.h"
#include "gfx_mod.h"
/*
* Begin module component
\*--------------------------------------------------------------------------*/
#include "isomap_mod.h"
#include "isomap.h"
namespace Saga {
static R_ISOMAP_MODULE IsoModule;
int ISOMAP_Init(void)
{
IsoModule.init = 1;
return R_SUCCESS;
}
int ISOMAP_LoadTileset(const uchar * tileres_p, size_t tileres_len)
{
R_ISOTILE_ENTRY first_entry;
R_ISOTILE_ENTRY *tile_tbl;
uint i;
const uchar *read_p = tileres_p;
size_t read_len = tileres_len;
assert((IsoModule.init) && (!IsoModule.tiles_loaded));
assert((tileres_p != NULL) && (tileres_len > 0));
read_p += 2;
first_entry.tile_offset = ys_read_u16_le(read_p, &read_p);
IsoModule.tile_ct = first_entry.tile_offset / SAGA_ISOTILE_ENTRY_LEN;
read_p = tileres_p;
read_len = tileres_len;
tile_tbl = (R_ISOTILE_ENTRY *)malloc(IsoModule.tile_ct * sizeof *tile_tbl);
if (tile_tbl == NULL) {
return R_MEM;
}
for (i = 0; i < IsoModule.tile_ct; i++) {
tile_tbl[i].tile_h = ys_read_u8(read_p, &read_p);
tile_tbl[i].unknown01 = ys_read_u8(read_p, &read_p);
tile_tbl[i].tile_offset = ys_read_u16_le(read_p, &read_p);
tile_tbl[i].unknown04 = ys_read_s16_le(read_p, &read_p);
tile_tbl[i].unknown06 = ys_read_s16_le(read_p, &read_p);
}
IsoModule.tiles_loaded = 1;
IsoModule.tile_tbl = tile_tbl;
IsoModule.tileres_p = tileres_p;
IsoModule.tileres_len = tileres_len;
return R_SUCCESS;
}
int ISOMAP_LoadMetaTileset(const uchar * mtileres_p, size_t mtileres_len)
{
R_ISO_METATILE_ENTRY *mtile_tbl;
const uchar *read_p = mtileres_p;
size_t read_len = mtileres_len;
uint mtile_ct;
uint ct;
int i;
assert(IsoModule.init);
assert((mtileres_p != NULL) && (mtileres_len > 0));
(void)read_len;
mtile_ct = mtileres_len / SAGA_METATILE_ENTRY_LEN;
mtile_tbl = (R_ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof *mtile_tbl);
if (mtile_tbl == NULL) {
return R_MEM;
}
for (ct = 0; ct < mtile_ct; ct++) {
mtile_tbl[ct].mtile_n = ys_read_u16_le(read_p, &read_p);
mtile_tbl[ct].unknown02 = ys_read_s16_le(read_p, &read_p);
mtile_tbl[ct].unknown04 = ys_read_s16_le(read_p, &read_p);
mtile_tbl[ct].unknown06 = ys_read_s16_le(read_p, &read_p);
for (i = 0; i < SAGA_METATILE_SIZE; i++) {
mtile_tbl[ct].tile_tbl[i] =
ys_read_u16_le(read_p, &read_p);
}
}
IsoModule.mtile_ct = mtile_ct;
IsoModule.mtile_tbl = mtile_tbl;
IsoModule.mtileres_p = mtileres_p;
IsoModule.mtileres_len = mtileres_len;
IsoModule.mtiles_loaded = 1;
return R_SUCCESS;
}
int ISOMAP_LoadMetamap(const uchar * mm_res_p, size_t mm_res_len)
{
const uchar *read_p = mm_res_p;
size_t read_len = mm_res_len;
int i;
(void)read_len;
IsoModule.metamap_n = ys_read_s16_le(read_p, &read_p);
for (i = 0; i < SAGA_METAMAP_SIZE; i++) {
IsoModule.metamap_tbl[i] = ys_read_u16_le(read_p, &read_p);
}
IsoModule.mm_res_p = mm_res_p;
IsoModule.mm_res_len = mm_res_len;
IsoModule.metamap_loaded = 1;
return R_SUCCESS;
}
int ISOMAP_Draw(R_SURFACE * dst_s)
{
R_GAME_DISPLAYINFO disp_info;
R_RECT iso_rect;
GAME_GetDisplayInfo(&disp_info);
iso_rect.x1 = 0;
iso_rect.y1 = 0;
iso_rect.x2 = disp_info.logical_w - 1;
iso_rect.y2 = disp_info.scene_h - 1;
GFX_DrawRect(dst_s, &iso_rect, 0);
ISOMAP_DrawMetamap(dst_s, -1000, -500);
return R_SUCCESS;
}
int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y)
{
int meta_base_x = map_x;
int meta_base_y = map_y;
int meta_xi;
int meta_yi;
int meta_x;
int meta_y;
int meta_idx;
for (meta_yi = SAGA_METAMAP_H - 1; meta_yi >= 0; meta_yi--) {
meta_x = meta_base_x;
meta_y = meta_base_y;
for (meta_xi = SAGA_METAMAP_W - 1; meta_xi >= 0; meta_xi--) {
meta_idx = meta_xi + (meta_yi * 16);
ISOMAP_DrawMetaTile(dst_s,
IsoModule.metamap_tbl[meta_idx], meta_x, meta_y);
meta_x += 128;
meta_y += 64;
}
meta_base_x -= 128;
meta_base_y += 64;
}
return R_SUCCESS;
}
int
ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint mtile_i, int mtile_x, int mtile_y)
{
int tile_xi;
int tile_yi;
int tile_x;
int tile_y;
int tile_base_x;
int tile_base_y;
int tile_i;
R_ISO_METATILE_ENTRY *mtile_p;
assert(IsoModule.init && IsoModule.mtiles_loaded);
if (mtile_i >= IsoModule.mtile_ct) {
return R_FAILURE;
}
mtile_p = &IsoModule.mtile_tbl[mtile_i];
tile_base_x = mtile_x;
tile_base_y = mtile_y;
for (tile_yi = SAGA_METATILE_H - 1; tile_yi >= 0; tile_yi--) {
tile_y = tile_base_y;
tile_x = tile_base_x;
for (tile_xi = SAGA_METATILE_W - 1; tile_xi >= 0; tile_xi--) {
tile_i = tile_xi + (tile_yi * SAGA_METATILE_W);
ISOMAP_DrawTile(dst_s,
mtile_p->tile_tbl[tile_i], tile_x, tile_y);
tile_x += SAGA_ISOTILE_WIDTH / 2;
tile_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
}
tile_base_x -= SAGA_ISOTILE_WIDTH / 2;
tile_base_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
}
return R_SUCCESS;
}
int ISOMAP_DrawTile(R_SURFACE * dst_s, uint tile_i, int tile_x, int tile_y)
{
const uchar *tile_p;
const uchar *read_p;
uchar *draw_p;
int draw_x;
int draw_y;
int tile_h;
int w_count = 0;
int row;
int bg_runct;
int fg_runct;
int ct;
assert(IsoModule.init && IsoModule.tiles_loaded);
if (tile_i >= IsoModule.tile_ct) {
return R_FAILURE;
}
/* temporary x clip */
if (tile_x < 0) {
return R_SUCCESS;
}
/* temporary x clip */
if (tile_x >= 320 - 32) {
return R_SUCCESS;
}
tile_p = IsoModule.tileres_p + IsoModule.tile_tbl[tile_i].tile_offset;
tile_h = IsoModule.tile_tbl[tile_i].tile_h;
read_p = tile_p;
draw_p = dst_s->buf + tile_x + (tile_y * dst_s->buf_pitch);
draw_x = tile_x;
draw_y = tile_y;
if (tile_h > SAGA_ISOTILE_BASEHEIGHT) {
draw_y = tile_y - (tile_h - SAGA_ISOTILE_BASEHEIGHT);
}
/* temporary y clip */
if (draw_y < 0) {
return R_SUCCESS;
}
for (row = 0; row < tile_h; row++) {
draw_p =
dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
w_count = 0;
/* temporary y clip */
if ((draw_y + row) >= 137) {
return R_SUCCESS;
}
for (;;) {
bg_runct = *read_p++;
w_count += bg_runct;
if (w_count >= SAGA_ISOTILE_WIDTH) {
break;
}
draw_p += bg_runct;
fg_runct = *read_p++;
w_count += fg_runct;
for (ct = 0; ct < fg_runct; ct++) {
*draw_p++ = *read_p++;
}
}
}
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: isomap.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/isomap.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Isometric level module - private header
Notes:
*/
#ifndef SAGA_ISOMAP_H_
#define SAGA_ISOMAP_H_
namespace Saga {
typedef struct R_ISOTILE_ENTRY_tag {
int tile_h;
int unknown01;
size_t tile_offset;
int unknown04;
int unknown06;
} R_ISOTILE_ENTRY;
#define SAGA_ISOTILE_ENTRY_LEN 8
#define SAGA_ISOTILE_WIDTH 32
#define SAGA_ISOTILE_BASEHEIGHT 15
#define SAGA_METATILE_W 8
#define SAGA_METATILE_H 8
#define SAGA_METATILE_SIZE 64
#define SAGA_METAMAP_W 16
#define SAGA_METAMAP_H 16
#define SAGA_METAMAP_SIZE 256
typedef struct R_ISO_METATILE_ENTRY_tag {
int mtile_n;
int unknown02;
int unknown04;
int unknown06;
int tile_tbl[SAGA_METATILE_SIZE];
} R_ISO_METATILE_ENTRY;
#define SAGA_METATILE_ENTRY_LEN 136
typedef struct R_ISOMAP_MODULE_tag {
int init;
int tiles_loaded;
const uchar *tileres_p;
size_t tileres_len;
uint tile_ct;
R_ISOTILE_ENTRY *tile_tbl;
int mtiles_loaded;
const uchar *mtileres_p;
size_t mtileres_len;
uint mtile_ct;
R_ISO_METATILE_ENTRY *mtile_tbl;
int metamap_loaded;
int metamap_n;
uint metamap_tbl[SAGA_METAMAP_SIZE];
const uchar *mm_res_p;
size_t mm_res_len;
} R_ISOMAP_MODULE;
int ISOMAP_DrawTile(R_SURFACE * dst_s, uint tile_i, int tile_x, int tile_y);
int
ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint mtile_i, int mtile_x, int mtile_y);
int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y);
} // End of namespace Saga
#endif /* SAGA_ISOMAP_H_ */
--- NEW FILE: isomap_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/isomap_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Isometric level module - public module header
Notes:
*/
#ifndef SAGA_ISOMAP_MOD_H_
#define SAGA_ISOMAP_MOD_H_
namespace Saga {
int ISOMAP_Init(void);
int ISOMAP_LoadTileset(const uchar *, size_t);
int ISOMAP_LoadMetaTileset(const uchar *, size_t);
int ISOMAP_LoadMetamap(const uchar * mm_res_p, size_t mm_res_len);
int ISOMAP_Draw(R_SURFACE * dst_s);
} // End of namespace Saga
#endif /* SAGA_ISOMAP_MOD_H_ */
--- NEW FILE: ite_introproc.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
[...1138 lines suppressed...]
event.time = 5000;
q_event = EVENT_Chain(q_event_start, &event);
break;
case SCENE_END:
break;
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
}
return 0;
}
} // End of namespace Saga
--- NEW FILE: ite_introproc.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/ite_introproc.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Intro sequence scene procedures header file
Notes:
*/
#ifndef SAGA_ITE_INTRO_H_
#define SAGA_ITE_INTRO_H_
namespace Saga {
#define R_INTRO_STRMAX 256
#define ITE_INTRO_FRAMETIME 90
#define INTRO_CAPTION_Y 170
#define VOICE_PAD 50
#define VOICE_LETTERLEN 90
#define PALETTE_FADE_DURATION 1000
#define DISSOLVE_DURATION 3000
#define CREDIT_DURATION1 4000
enum R_INTRO_SCENE_DIALOGUE_INFO {
INTRO_CAVE1_START = 0,
INTRO_CAVE1_END = 4,
INTRO_CAVE2_START = 4,
INTRO_CAVE2_END = 7,
INTRO_CAVE3_START = 7,
INTRO_CAVE3_END = 10,
INTRO_CAVE4_START = 10,
INTRO_CAVE4_END = 14
};
typedef struct R_INTRO_DIALOGUE_tag {
ulong i_voice_rn;
char *i_cvar_name;
char i_str[R_INTRO_STRMAX];
} R_INTRO_DIALOGUE;
typedef struct INTRO_CAPTION_tag {
int res_n;
char *caption;
} INTRO_CAPTION;
typedef struct INTRO_CREDIT_tag {
int text_x;
int text_y;
int delta_time;
int duration;
char *string;
int font_id;
} INTRO_CREDIT;
} // End of namespace Saga
#endif /* SAGA_ITE_INTRO_H_ */
--- NEW FILE: ite_introproc_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/ite_introproc_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Intro sequence scene procedures - public header file
Notes:
*/
#ifndef SAGA_ITE_INTROPROC_MOD_H_
#define SAGA_ITE_INTROPROC_MOD_H_
namespace Saga {
int ITE_IntroRegisterLang(void);
} // End of namespace Saga
#endif /* SAGA_ITE_INTROPROC_MOD_H_ */
--- NEW FILE: math.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/math.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Math routines
Notes:
*/
#include
#include
#include "reinherit.h"
namespace Saga {
int
MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point)
{
int yflag0;
int yflag1;
int inside_flag = 0;
unsigned int pt;
R_POINT *vtx0 = &points[npoints - 1];
R_POINT *vtx1 = &points[0];
yflag0 = (vtx0->y >= test_point.y);
for (pt = 0; pt < npoints; pt++, vtx1++) {
yflag1 = (vtx1->y >= test_point.y);
if (yflag0 != yflag1) {
if (((vtx1->y - test_point.y) * (vtx0->x - vtx1->x) >=
(vtx1->x - test_point.x) * (vtx0->y -
vtx1->y)) == yflag1) {
inside_flag = !inside_flag;
}
}
yflag0 = yflag1;
vtx0 = vtx1;
}
return inside_flag;
}
} // End of namespace Saga
--- NEW FILE: math.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/math.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Math routines implementation header
Notes:
*/
#ifndef SAGA_MATH_H__
#define SAGA_MATH_H__
#endif /* SAGA_MATH_H__ */
--- NEW FILE: math_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/math_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Math routines public header
Notes:
*/
#ifndef SAGA_MATH_MOD_H__
#define SAGA_MATH_MOD_H__
namespace Saga {
int
MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point);
} // End of namespace Saga
#endif /* SAGA_MATH_MOD_H__ */
--- NEW FILE: misc.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/misc.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Misc. routines
Notes:
*/
namespace Saga {
int Granulate(int value, int granularity)
{
int remainder;
if (value == 0)
return 0;
if (granularity == 0)
return 0;
remainder = value % granularity;
if (remainder == 0) {
return value;
} else {
return (granularity - remainder + value);
}
}
} // End of namespace Saga
--- NEW FILE: objectmap.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Object map / Object click-area module
Notes:
Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
appearing in Graphics Gems IV, "Point in Polygon Strategies."
p. 24-46, code: p. 34-45
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "cvar_mod.h"
#include "console_mod.h"
#include "gfx_mod.h"
#include "math_mod.h"
#include "font_mod.h"
/*
* Module options
\*--------------------------------------------------------------------------*/
#define R_OBJECTMAP_DEBUG R_DEBUG_INFO
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "objectmap_mod.h"
#include "objectmap.h"
namespace Saga {
static R_OBJECTMAP_INFO OMInfo;
int OBJECTMAP_Register(void)
{
CVAR_RegisterFunc(CF_object_info,
"object_info", NULL, R_CVAR_NONE, 0, 0);
return R_SUCCESS;
}
int OBJECTMAP_Init(void)
/*--------------------------------------------------------------------------*\
* Initializes the object map module, creates module allocation context
\*--------------------------------------------------------------------------*/
{
R_printf(R_STDOUT, "OBJECTMAP Module: Initializing...\n");
OMInfo.initialized = 1;
return R_SUCCESS;
}
int OBJECTMAP_Shutdown(void)
/*--------------------------------------------------------------------------*\
* Shuts down the object map module, destroys module allocation context
\*--------------------------------------------------------------------------*/
{
if (!OMInfo.initialized) {
return R_FAILURE;
}
R_printf(R_STDOUT, "OBJECTMAP Module: Shutting down...\n");
OBJECTMAP_Free();
OBJECTMAP_FreeNames();
R_printf(R_STDOUT, "OBJECTMAP Module: Shutdown AOK.\n");
OMInfo.initialized = 0;
return R_SUCCESS;
}
int OBJECTMAP_Load(const uchar * om_res, size_t om_res_len)
/*--------------------------------------------------------------------------*\
* Loads an object map resource ( objects ( clickareas ( points ) ) )
\*--------------------------------------------------------------------------*/
{
const unsigned char *read_p = om_res;
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
R_POINT *point;
int i, k, m;
YS_IGNORE_PARAM(om_res_len);
if (!OMInfo.initialized) {
R_printf(R_STDERR,
"Error: Object map module not initialized!\n");
return R_FAILURE;
}
if (OMInfo.objects_loaded) {
OBJECTMAP_Free();
}
/* Obtain object count N and allocate space for N objects
* \*------------------------------------------------------------- */
OMInfo.n_objects = ys_read_u16_le(read_p, &read_p);
OMInfo.object_maps =
(R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
if (OMInfo.object_maps == NULL) {
R_printf(R_STDERR, "Error: Memory allocation failed.\n");
return R_MEM;
}
/* Load all N objects
* \*------------------------------------------------------------- */
for (i = 0; i < OMInfo.n_objects; i++) {
object_map = &OMInfo.object_maps[i];
object_map->unknown0 = ys_read_u8(read_p, &read_p);
object_map->n_clickareas = ys_read_u8(read_p, &read_p);
object_map->flags = ys_read_u16_le(read_p, &read_p);
object_map->object_num = ys_read_u16_le(read_p, &read_p);
object_map->script_num = ys_read_u16_le(read_p, &read_p);
object_map->clickareas =
(R_CLICKAREA *)malloc(object_map->n_clickareas *
sizeof *(object_map->clickareas));
if (object_map->clickareas == NULL) {
R_printf(R_STDERR,
"Error: Memory allocation failed.\n");
return R_MEM;
}
/* Load all clickareas for this object */
for (k = 0; k < object_map->n_clickareas; k++) {
clickarea = &object_map->clickareas[k];
clickarea->n_points = ys_read_u16_le(read_p, &read_p);
assert(clickarea->n_points != 0);
clickarea->points =
(R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
if (clickarea->points == NULL) {
R_printf(R_STDERR,
"Error: Memory allocation failed.\n");
return R_MEM;
}
/* Load all points for this clickarea */
for (m = 0; m < clickarea->n_points; m++) {
point = &clickarea->points[m];
point->x = ys_read_s16_le(read_p, &read_p);
point->y = ys_read_s16_le(read_p, &read_p);
}
# if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
R_printf(R_STDOUT,
"OBJECTMAP_Load(): "
"Read %d points for clickarea %d in object %d.\n",
clickarea->n_points, k, object_map->object_num);
# endif
} /* End load all clickareas */
} /* End load all objects */
/*-------------------------------------------------------------*/
OMInfo.objects_loaded = 1;
return R_SUCCESS;
}
int OBJECTMAP_Free(void)
/*--------------------------------------------------------------------------*\
* Frees all storage allocated for the current object map data
\*--------------------------------------------------------------------------*/
{
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
int i, k;
if (!OMInfo.objects_loaded) {
return R_FAILURE;
}
for (i = 0; i < OMInfo.n_objects; i++) {
object_map = &OMInfo.object_maps[i];
for (k = 0; k < object_map->n_clickareas; k++) {
clickarea = &object_map->clickareas[k];
free(clickarea->points);
}
free(object_map->clickareas);
}
if (OMInfo.n_objects) {
free(OMInfo.object_maps);
}
OMInfo.objects_loaded = 0;
return R_SUCCESS;
}
int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
/*--------------------------------------------------------------------------*\
* Loads an object name list resource
\*--------------------------------------------------------------------------*/
{
YS_REG_FUNC(OBJECTMAP_LoadNames);
const unsigned char *read_p = onl_res;
int table_len;
int n_names;
size_t name_offset;
int i;
YS_IGNORE_PARAM(onl_res_len);
if (OMInfo.names_loaded) {
OBJECTMAP_FreeNames();
}
table_len = ys_read_u16_le(read_p, &read_p);
n_names = table_len / 2 - 2;
OMInfo.n_names = n_names;
#if 0
# if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
R_printf(R_STDOUT, "%s: Loading %d object names.\n", YS_FUNC, n_names);
# endif
#endif
OMInfo.names = (char **)malloc(n_names * sizeof *OMInfo.names);
if (OMInfo.names == NULL) {
R_printf(R_STDERR, "Error: Memory allocation failed.\n");
return R_MEM;
}
for (i = 0; i < n_names; i++) {
name_offset = ys_read_u16_le(read_p, &read_p);
OMInfo.names[i] = (char *)(onl_res + name_offset);
# if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
R_printf(R_STDOUT,
"Loaded object name string: %s\n", OMInfo.names[i]);
# endif
}
OMInfo.names_loaded = 1;
return R_SUCCESS;
}
int OBJECTMAP_FreeNames(void)
/*--------------------------------------------------------------------------*\
* Frees all storage allocated for the current object name list data
\*--------------------------------------------------------------------------*/
{
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
if (OMInfo.n_names) {
free(OMInfo.names);
}
OMInfo.names_loaded = 0;
return R_SUCCESS;
}
int OBJECTMAP_GetName(int object, const char **name)
/*--------------------------------------------------------------------------*\
* If 'object' is a valid object number in the currently loaded object
* name list resource, the funciton sets '*name' to the descriptive string
* corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
* R_FAILURE.
\*--------------------------------------------------------------------------*/
{
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
if ((object <= 0) || (object > OMInfo.n_names)) {
return R_FAILURE;
}
*name = OMInfo.names[object - 1];
return R_SUCCESS;
}
int OBJECTMAP_GetFlags(int object, uint * flags)
{
int i;
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
if ((object <= 0) || (object > OMInfo.n_names)) {
return R_FAILURE;
}
for (i = 0; i < OMInfo.n_objects; i++) {
if (OMInfo.object_maps[i].object_num == object) {
*flags = OMInfo.object_maps[i].flags;
return R_SUCCESS;
}
}
return R_FAILURE;
}
int OBJECTMAP_GetEPNum(int object, int *ep_num)
/*--------------------------------------------------------------------------*\
* If 'object' is a valid object number in the currently loaded object
* name list resource, the funciton sets '*ep_num' to the entrypoint number
* corresponding to 'object' and returns R_SUCCESS. Otherwise, it returns
* R_FAILURE.
\*--------------------------------------------------------------------------*/
{
int i;
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
if ((object < 0) || (object > (OMInfo.n_objects + 1))) {
return R_FAILURE;
}
for (i = 0; i < OMInfo.n_objects; i++) {
if (OMInfo.object_maps[i].object_num == object) {
*ep_num = OMInfo.object_maps[i].script_num;
return R_SUCCESS;
}
}
return R_FAILURE;
}
int OBJECTMAP_Draw(R_SURFACE * ds, R_POINT * imouse_pt, int color, int color2)
/*--------------------------------------------------------------------------*\
* Uses GFX_DrawLine to display all clickareas for each object in the
* currently loaded object map resource.
\*--------------------------------------------------------------------------*/
{
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
char txt_buf[32];
int draw_color = color;
int draw_txt = 0;
int hit_object = 0;
int object_num = 0;
int pointcount = 0;
int i, k;
assert(OMInfo.initialized);
if (!OMInfo.objects_loaded) {
return R_FAILURE;
}
if (imouse_pt != NULL) {
if (OBJECTMAP_HitTest(imouse_pt, &object_num) == R_SUCCESS) {
hit_object = 1;
}
}
for (i = 0; i < OMInfo.n_objects; i++) {
draw_color = color;
if (hit_object &&
(object_num == OMInfo.object_maps[i].object_num)) {
snprintf(txt_buf,
sizeof txt_buf,
"obj %d: ? %d, f %X",
OMInfo.object_maps[i].object_num,
OMInfo.object_maps[i].unknown0,
OMInfo.object_maps[i].flags);
draw_txt = 1;
draw_color = color2;
}
object_map = &OMInfo.object_maps[i];
for (k = 0; k < object_map->n_clickareas; k++) {
clickarea = &object_map->clickareas[k];
pointcount = 0;
if (clickarea->n_points == 2) {
/* 2 points represent a box */
GFX_DrawFrame(ds,
&clickarea->points[0],
&clickarea->points[1], draw_color);
} else if (clickarea->n_points > 2) {
/* Otherwise draw a polyline */
GFX_DrawPolyLine(ds,
clickarea->points,
clickarea->n_points, draw_color);
}
} /* end for() clickareas */
} /* end for() objects */
if (draw_txt) {
FONT_Draw(SMALL_FONT_ID,
ds,
txt_buf,
0,
2, 2, SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
}
return R_SUCCESS;
}
int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num)
{
R_POINT imouse;
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
R_POINT *points;
int n_points;
int i, k;
assert((imouse_pt != NULL) && (object_num != NULL));
imouse.x = imouse_pt->x;
imouse.y = imouse_pt->y;
/* Loop through all scene objects */
for (i = 0; i < OMInfo.n_objects; i++) {
object_map = &OMInfo.object_maps[i];
/* Hit-test all clickareas for this object */
for (k = 0; k < object_map->n_clickareas; k++) {
clickarea = &object_map->clickareas[k];
n_points = clickarea->n_points;
points = clickarea->points;
if (n_points == 2) {
/* Hit-test a box region */
if ((imouse.x > points[0].x) &&
(imouse.x <= points[1].x) &&
(imouse.y > points[0].y) &&
(imouse.y <= points[1].y)) {
*object_num = object_map->object_num;
return R_SUCCESS;
}
} else if (n_points > 2) {
/* Hit-test a polygon */
if (MATH_HitTestPoly(points, n_points, imouse)) {
*object_num = object_map->object_num;
return R_SUCCESS;
}
}
} /* end for() clickareas */
} /* end for() objects */
*object_num = 0;
return R_FAILURE;
}
static void CF_object_info(int argc, char *argv[])
{
int i;
YS_IGNORE_PARAM(argc);
YS_IGNORE_PARAM(argv);
if (!OMInfo.initialized) {
return;
}
CON_Print("%d objects loaded.", OMInfo.n_objects);
for (i = 0; i < OMInfo.n_objects; i++) {
CON_Print("%s:", OMInfo.names[i]);
CON_Print
("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d",
i, OMInfo.object_maps[i].unknown0,
OMInfo.object_maps[i].flags,
OMInfo.object_maps[i].object_num,
OMInfo.object_maps[i].script_num,
OMInfo.object_maps[i].n_clickareas);
}
return;
}
} // End of namespace Saga
--- NEW FILE: objectmap.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/objectmap.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Object map / Object click-area module header file
Notes:
*/
#ifndef SAGA_OBJECTMAP_H_
#define SAGA_OBJECTMAP_H_
namespace Saga {
typedef struct R_CLICKAREA_tag {
int n_points;
R_POINT *points;
} R_CLICKAREA;
typedef struct R_OBJECTMAP_ENTRY_tag {
int unknown0;
uint flags;
int object_num;
int script_num;
int n_clickareas;
R_CLICKAREA *clickareas;
} R_OBJECTMAP_ENTRY;
typedef struct R_OBJECTMAP_INFO_tag {
int initialized;
int objects_loaded;
int n_objects;
R_OBJECTMAP_ENTRY *object_maps;
int names_loaded;
int n_names;
char **names;
} R_OBJECTMAP_INFO;
static void CF_object_info(int argc, char *argv[]);
} // End of namespace Saga
#endif /* SAGA_OBJECTMAP_H_ */
--- NEW FILE: objectmap_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/objectmap_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Object map module public header file
Notes:
*/
#ifndef SAGA_OBJECTMAP_MOD_H__
#define SAGA_OBJECTMAP_MOD_H__
namespace Saga {
enum R_OBJECT_FLAGS {
R_OBJECT_NORMAL = 0x02
};
int OBJECTMAP_Register(void);
int OBJECTMAP_Init(void);
int OBJECTMAP_Shutdown(void);
int OBJECTMAP_Load(const uchar * om_res, size_t om_res_len);
int OBJECTMAP_Free(void);
int OBJECTMAP_LoadNames(const uchar * onl_res, size_t onl_res_len);
int OBJECTMAP_FreeNames(void);
int OBJECTMAP_GetName(int object, const char **name);
int OBJECTMAP_GetFlags(int object, uint * flags);
int OBJECTMAP_GetEPNum(int object, int *ep_num);
int
OBJECTMAP_Draw(R_SURFACE * draw_surface,
R_POINT * imouse_pt, int color, int color2);
int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num);
} // End of namespace Saga
#endif /* SAGA_OBJECTMAP_MOD_H__ */
--- NEW FILE: palanim.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/palanim.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Palette animation module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "events_mod.h"
#include "game_mod.h"
/*
* Begin module:
\*--------------------------------------------------------------------------*/
#include "palanim_mod.h"
#include "palanim.h"
namespace Saga {
static PALANIM_DATA PAnimData;
int PALANIM_Load(const uchar * resdata, size_t resdata_len)
{
const uchar *read_p = resdata;
void *test_p;
uint i;
YS_IGNORE_PARAM(resdata_len);
if (PAnimData.loaded) {
PALANIM_Free();
}
if (resdata == NULL) {
return R_FAILURE;
}
if (GAME_GetGameType() == R_GAMETYPE_IHNM) {
return R_SUCCESS;
}
PAnimData.entry_count = ys_read_u16_le(read_p, &read_p);
R_printf(R_STDOUT,
"PALANIM_Load(): Loading %d PALANIM entries.\n",
PAnimData.entry_count);
test_p = calloc(PAnimData.entry_count, sizeof(PALANIM_ENTRY));
if (test_p == NULL) {
R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n");
return R_MEM;
}
PAnimData.entries = (PALANIM_ENTRY *)test_p;
for (i = 0; i < PAnimData.entry_count; i++) {
int color_count;
int pal_count;
int p, c;
color_count = ys_read_u16_le(read_p, &read_p);
pal_count = ys_read_u16_le(read_p, &read_p);
PAnimData.entries[i].pal_count = pal_count;
PAnimData.entries[i].color_count = color_count;
# if 0
R_printf(R_STDOUT,
"PALANIM_Load(): Entry %d: Loading %d palette indices.\n",
i, pal_count);
#endif
test_p = calloc(1, sizeof(char) * pal_count);
if (test_p == NULL) {
R_printf(R_STDERR,
"PALANIM_Load(): Allocation failure.\n");
return R_MEM;
}
PAnimData.entries[i].pal_index = (uchar *)test_p;
# if 0
R_printf(R_STDOUT,
"PALANIM_Load(): Entry %d: Loading %d SAGA_COLOR "
"structures.\n", i, color_count);
# endif
test_p = calloc(1, sizeof(R_COLOR) * color_count);
if (test_p == NULL) {
R_printf(R_STDERR,
"PALANIM_Load(): Allocation failure.\n");
return R_MEM;
}
PAnimData.entries[i].colors = (R_COLOR *)test_p;
for (p = 0; p < pal_count; p++) {
PAnimData.entries[i].pal_index[p] =
(uchar) ys_read_u8(read_p, &read_p);
}
for (c = 0; c < color_count; c++) {
PAnimData.entries[i].colors[c].red =
(uchar) ys_read_u8(read_p, &read_p);
PAnimData.entries[i].colors[c].green =
(uchar) ys_read_u8(read_p, &read_p);
PAnimData.entries[i].colors[c].blue =
(uchar) ys_read_u8(read_p, &read_p);
}
}
PAnimData.loaded = 1;
return R_SUCCESS;
}
int PALANIM_CycleStart(void)
{
R_EVENT event;
if (!PAnimData.loaded) {
return R_FAILURE;
}
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTEP;
event.time = PALANIM_CYCLETIME;
EVENT_Queue(&event);
return R_SUCCESS;
}
int PALANIM_CycleStep(int vectortime)
{
R_SURFACE *back_buf;
static PALENTRY pal[256];
uint pal_index;
uint col_index;
uint i, j;
uint cycle;
uint cycle_limit;
R_EVENT event;
if (!PAnimData.loaded) {
return R_FAILURE;
}
SYSGFX_GetCurrentPal(pal);
back_buf = SYSGFX_GetBackBuffer();
for (i = 0; i < PAnimData.entry_count; i++) {
cycle = PAnimData.entries[i].cycle;
cycle_limit = PAnimData.entries[i].color_count;
for (j = 0; j < PAnimData.entries[i].pal_count; j++) {
pal_index =
(unsigned char)PAnimData.entries[i].pal_index[j];
col_index = (cycle + j) % cycle_limit;
pal[pal_index].red =
(uchar) PAnimData.entries[i].colors[col_index].red;
pal[pal_index].green =
(uchar) PAnimData.entries[i].colors[col_index].
green;
pal[pal_index].blue =
(uchar) PAnimData.entries[i].colors[col_index].
blue;
}
PAnimData.entries[i].cycle++;
if (PAnimData.entries[i].cycle == cycle_limit) {
PAnimData.entries[i].cycle = 0;
}
}
SYSGFX_SetPalette(back_buf, pal);
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTEP;
event.time = vectortime + PALANIM_CYCLETIME;
EVENT_Queue(&event);
return R_SUCCESS;
}
int PALANIM_Free(void)
{
uint i;
if (!PAnimData.loaded) {
return R_FAILURE;
}
for (i = 0; i < PAnimData.entry_count; i++) {
#if 0
R_printf(R_STDOUT,
"PALANIM_Free(): Entry %d: Freeing colors.\n", i);
#endif
free(PAnimData.entries[i].colors);
#if 0
R_printf(R_STDOUT,
"PALANIM_Free(): Entry %d: Freeing indices.\n", i);
#endif
free(PAnimData.entries[i].pal_index);
}
R_printf(R_STDOUT, "PALANIM_Free(): Freeing entries.\n", i);
free(PAnimData.entries);
PAnimData.loaded = 0;
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: palanim.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/palanim.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Palette animation module header file
Notes:
*/
#ifndef SAGA_PALANIM_H
#define SAGA_PALANIM_H
#include "reinherit.h"
namespace Saga {
#define PALANIM_CYCLETIME 100
typedef struct PALANIM_ENTRY_tag {
uint pal_count;
uint color_count;
uint cycle;
uchar *pal_index;
R_COLOR *colors;
} PALANIM_ENTRY;
typedef struct PALANIM_DATA_tag {
int loaded;
uint entry_count;
PALANIM_ENTRY *entries;
} PALANIM_DATA;
} // End of namespace Saga
#endif
--- NEW FILE: palanim_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/palanim_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Palette animation module public header file
Notes:
*/
#ifndef SAGA_PALANIM_MOD_H__
#define SAGA_PALANIM_MOD_H__
namespace Saga {
int PALANIM_Load(const uchar *, size_t);
int PALANIM_CycleStart(void);
int PALANIM_CycleStep(int vectortime);
int PALANIM_Free(void);
} // End of namespace Saga
#endif /* SAGA_PALANIM_MOD_H__ */
--- NEW FILE: reinherit.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/reinherit.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Main Header File
Notes:
*/
#ifndef SAGA_REINHERIT_H_
#define SAGA_REINHERIT_H_
#include "stdafx.h"
#include "base/engine.h"
/*
* Architecture conditionals
\*--------------------------------------------------------------------------*/
#include "x86_32.h"
/*
* Implementation conditionals
\*--------------------------------------------------------------------------*/
#define R_ENV_LINUX
#include "sys_interface.h"
namespace Saga {
#define R_MAXPATH 512
/* For debug message processing */
#define R_DEBUG_NONE 0
#define R_DEBUG_INFO 1
#define R_DEBUG_VERBOSE 2
#define R_DEBUG_PARANOID 3
#define R_MEMFAIL_MSG "Memory allocation error."
/*
* Define opaque types
\*--------------------------------------------------------------------------*/
/* r_rscfile */
typedef struct R_RSCFILE_CONTEXT_tag R_RSCFILE_CONTEXT;
/* r_script */
typedef struct R_SEMAPHORE_tag R_SEMAPHORE;
/*
* Define common data types
\*--------------------------------------------------------------------------*/
#ifndef HAVE_UCHAR
typedef unsigned char uchar;
#endif
#ifndef HAVE_ULONG
typedef unsigned long ulong;
#endif
#ifndef HAVE_UINT
typedef unsigned int uint;
#endif
typedef struct R_POINT_tag {
int x;
int y;
} R_POINT;
typedef struct R_RECT_tag {
int x1;
int y1;
int x2;
int y2;
} R_RECT;
#define R_MAKERECT( rect, x1, y1, x2, y2 ) \
( rect.x1 = x1, rect.y1 = y1, rect.x2 = x2, rect.y2 = y2, &rect )
typedef struct R_COLOR_tag {
int red;
int green;
int blue;
int alpha;
} R_COLOR;
typedef struct R_SURFACE_tag {
uchar *buf;
int buf_w;
int buf_h;
int buf_pitch;
int bpp;
R_RECT clip_rect;
void *impl_src;
} R_SURFACE;
typedef struct R_SOUNDBUFFER_tag {
uchar *res_data;
size_t res_len;
long s_freq;
int s_samplebits;
int s_stereo;
int s_signed;
uchar *s_buf;
size_t s_buf_len;
} R_SOUNDBUFFER;
#define R_RGB_RED 0x00FF0000UL
#define R_RGB_GREEN 0x0000FF00UL
#define R_RGB_BLUE 0x000000FFUL
typedef struct SAGA_COLOR_tag {
R_UINT8 r;
R_UINT8 g;
R_UINT8 b;
} SAGA_COLOR;
#define SAGA_COLOR_LEN 3
typedef struct PALENTRY_TAG {
R_UINT8 red;
R_UINT8 green;
R_UINT8 blue;
} PALENTRY;
enum R_ERRORCODE {
R_STOP = -3,
R_MEM = -2,
R_FAILURE = -1,
R_SUCCESS = 0
};
/*
* r_cmdline.c
\*--------------------------------------------------------------------------*/
typedef struct R_EXECINFO_tag {
int start_scene;
int no_verify;
int no_sound;
int no_music;
int windowed;
char *game_dir;
} R_EXECINFO;
int R_ReadCommandLine(int argc, char **argv, R_EXECINFO * execinfo);
/*
* r_main.c
\*--------------------------------------------------------------------------*/
int main(int argc, char *argv[]);
void R_Shutdown(int param);
/*
* r_misc.c
\*--------------------------------------------------------------------------*/
int Granulate(int value, int granularity);
/*
* r_transitions.c
\*--------------------------------------------------------------------------*/
int TRANSITION_Dissolve(uchar * dst_img,
int dst_w,
int dst_h,
int dst_p, const uchar * src_img, int src_p, int flags, double percent);
/*--------------------------------------------------------------------------*\
* System specific routines
\*--------------------------------------------------------------------------*/
/*
* System : IO
\*--------------------------------------------------------------------------*/
int SYSIO_Init(void);
int SYSIO_Shutdown(void);
/*
* System : Filesystem
\*--------------------------------------------------------------------------*/
int SYSFS_GetFileLen(FILE * file_p, ulong * len);
int SYSFS_GetFQFN(const char *f_dir,
const char *f_name, char *buf, size_t buf_len);
/*
* System : Sound
\*--------------------------------------------------------------------------*/
int SYSSOUND_Init(int enabled);
int SYSSOUND_Shutdown(void);
int SYSSOUND_Play(int sound_rn, int channel);
int SYSSOUND_Pause(int channel);
int SYSSOUND_Resume(int channel);
int SYSSOUND_Stop(int channel);
int SYSSOUND_PlayVoice(R_SOUNDBUFFER *);
int SYSSOUND_PauseVoice(void);
int SYSSOUND_ResumeVoice(void);
int SYSSOUND_StopVoice(void);
/*
* System : Music
\*--------------------------------------------------------------------------*/
enum SYSMUSIC_FLAGS {
R_MUSIC_LOOP = 0x01
};
int SYSMUSIC_Init(int enabled);
int SYSMUSIC_Shutdown(void);
int SYSMUSIC_Play(ulong music_rn, uint flags);
int SYSMUSIC_Pause(void);
int SYSMUSIC_Resume(void);
int SYSMUSIC_Stop(void);
/*
* System : Graphics
\*--------------------------------------------------------------------------*/
#define R_PAL_ENTRIES 256
typedef struct R_SYSGFX_INIT_tag {
int backbuf_w;
int backbuf_h;
int backbuf_bpp;
int screen_w;
int screen_h;
int screen_bpp;
int fullscreen;
} R_SYSGFX_INIT;
int SYSGFX_Init(R_SYSGFX_INIT *);
R_SURFACE *SYSGFX_GetScreenSurface(void);
R_SURFACE *SYSGFX_GetBackBuffer(void);
int SYSGFX_LockSurface(R_SURFACE * surface);
int SYSGFX_UnlockSurface(R_SURFACE * surface);
R_SURFACE *SYSGFX_CreateSurface(int w, int h, int bpp);
R_SURFACE *SYSGFX_FormatToDisplay(R_SURFACE * surface);
int SYSGFX_DestroySurface(R_SURFACE * surface);
int SYSGFX_GetWhite(void);
int SYSGFX_GetBlack(void);
int SYSGFX_MatchColor(unsigned long colormask);
int SYSGFX_SetPalette(R_SURFACE * surface, PALENTRY * pal);
int SYSGFX_GetCurrentPal(PALENTRY * src_pal);
int SYSGFX_PalToBlack(R_SURFACE * surface, PALENTRY * src_pal, double percent);
int SYSGFX_BlackToPal(R_SURFACE * surface, PALENTRY * src_pal, double percent);
/*
* System : Timer
\*--------------------------------------------------------------------------*/
typedef struct R_SYSTIMER_tag R_SYSTIMER;
typedef void (*R_SYSTIMER_CALLBACK) (unsigned long, void *);
int SYSTIMER_InitMSCounter(void);
unsigned long SYSTIMER_ReadMSCounter(void);
int SYSTIMER_ResetMSCounter(void);
int SYSTIMER_Sleep(uint msec);
int SYSTIMER_CreateTimer(R_SYSTIMER **,
unsigned long, void *, R_SYSTIMER_CALLBACK);
int SYSTIMER_DestroyTimer(R_SYSTIMER *);
/*
* System : Input
\*--------------------------------------------------------------------------*/
int SYSINPUT_Init(void);
int SYSINPUT_ProcessInput(void);
int SYSINPUT_GetMousePos(int *mouse_x, int *mouse_y);
int SYSINPUT_HideMouse(void);
int SYSINPUT_ShowMouse(void);
/*** sys_signal.c ***/
int ITESYS_CheckSignal(void);
} // End of namespace Saga
#endif /* SAGA_REINHERIT_H_ */
--- NEW FILE: render.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/render.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Main rendering loop
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
#include
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "actor_mod.h"
#include "console_mod.h"
#include "cvar_mod.h"
#include "font_mod.h"
#include "game_mod.h"
#include "gfx_mod.h"
#include "interface_mod.h"
#include "scene_mod.h"
#include "sprite_mod.h"
#include "text_mod.h"
#include "actionmap_mod.h"
#include "objectmap_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "render_mod.h"
#include "render.h"
namespace Saga {
static R_RENDER_MODULE RenderModule;
const char *test_txt = "The quick brown fox jumped over the lazy dog. "
"She sells sea shells down by the sea shore.";
int RENDER_Register(void)
{
/* Register "r_fullscreen" cfg cvar
* \*----------------------------------------- */
RenderModule.r_fullscreen = R_FULLSCREEN_DEFAULT;
if (CVAR_Register_I(&RenderModule.r_fullscreen,
"r_fullscreen", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "r_doubleres" cfg cvar
* \*----------------------------------------- */
RenderModule.r_doubleres = R_DOUBLERES_DEFAULT;
if (CVAR_Register_I(&RenderModule.r_doubleres,
"r_doubleres", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "r_hicolor" cfg cvar
* \*----------------------------------------- */
RenderModule.r_hicolor = R_HICOLOR_DEFAULT;
if (CVAR_Register_I(&RenderModule.r_hicolor,
"r_hicolor", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
return R_FAILURE;
}
/* Register "r_softcursor" cfg cvar
* \*----------------------------------------- */
RenderModule.r_softcursor = R_SOFTCURSOR_DEFAULT;
if (CVAR_Register_I(&RenderModule.r_softcursor,
"r_softcursor", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
return R_FAILURE;
}
return R_SUCCESS;
}
int RENDER_Init(void)
{
R_GAME_DISPLAYINFO disp_info = { 0 };
R_SYSGFX_INIT gfx_init = { 0 };
int result;
int tmp_w, tmp_h, tmp_bytepp;
/* Initialize system graphics
* \*------------------------------------------------------------- */
GAME_GetDisplayInfo(&disp_info);
gfx_init.backbuf_bpp = 8; /* all games are 8 bpp so far */
gfx_init.backbuf_w = disp_info.logical_w;
gfx_init.backbuf_h = disp_info.logical_h;
if (RenderModule.r_hicolor) {
gfx_init.screen_bpp = 16;
} else {
gfx_init.screen_bpp = 8;
}
gfx_init.screen_w = disp_info.logical_w;
gfx_init.screen_h = disp_info.logical_h;
/* Don't try to double a game exceeding the resolution limit
* (640x480 would get doubled to 1280 x 960!) */
if (disp_info.logical_w > R_DOUBLE_RESLIMIT) {
RenderModule.r_doubleres = 0;
}
if (RenderModule.r_doubleres) {
gfx_init.screen_w *= 2;
gfx_init.screen_h *= 2;
}
gfx_init.fullscreen = RenderModule.r_fullscreen;
if (SYSGFX_Init(&gfx_init) != R_SUCCESS) {
return R_FAILURE;
}
/* Initialize FPS timer callback
* \*------------------------------------------------------------- */
result = SYSTIMER_CreateTimer(&RenderModule.r_fps_timer,
1000, NULL, RENDER_FpsTimer);
if (result != R_SUCCESS) {
return R_FAILURE;
}
/* Create background buffer
* \*------------------------------------------------------------- */
RenderModule.r_bg_buf_w = disp_info.logical_w;
RenderModule.r_bg_buf_h = disp_info.logical_h;
RenderModule.r_bg_buf = (uchar *)calloc(disp_info.logical_w,
disp_info.logical_h);
if (RenderModule.r_bg_buf == NULL) {
return R_MEM;
}
/* Allocate temp buffer for animation decoding,
* graphics scalers (2xSaI), etc.
\*-------------------------------------------------------------*/
tmp_w = disp_info.logical_w;
tmp_h = disp_info.logical_h + 4; /* BG unbanking requres extra rows */
tmp_bytepp = 1;
if (RenderModule.r_doubleres) {
tmp_w *= 2;
tmp_h *= 2;
}
if (RenderModule.r_hicolor) {
tmp_bytepp = 2;
}
RenderModule.r_tmp_buf = (uchar *)calloc(1, tmp_w * tmp_h * tmp_bytepp);
if (RenderModule.r_tmp_buf == NULL) {
free(RenderModule.r_bg_buf);
return R_MEM;
}
RenderModule.r_tmp_buf_w = tmp_w;
RenderModule.r_tmp_buf_h = tmp_h;
RenderModule.r_screen_surface = SYSGFX_GetScreenSurface();
RenderModule.r_backbuf_surface = SYSGFX_GetBackBuffer();
/* Initialize cursor state
* \*------------------------------------------------------------- */
if (RenderModule.r_softcursor) {
SYSINPUT_HideMouse();
}
RenderModule.initialized = 1;
return R_SUCCESS;
}
int RENDER_DrawScene(void)
{
R_SURFACE *screen_surface;
R_SURFACE *backbuf_surface;
R_SURFACE *display_surface;
R_GAME_DISPLAYINFO disp_info = { 0 };
R_SCENE_INFO scene_info;
SCENE_BGINFO bg_info;
R_POINT bg_pt;
char txt_buf[20];
int fps_width;
R_POINT mouse_pt;
int mouse_x, mouse_y;
int surface_converted = 0;
if (!RenderModule.initialized) {
return R_FAILURE;
}
RenderModule.r_framecount++;
screen_surface = RenderModule.r_screen_surface;
backbuf_surface = RenderModule.r_backbuf_surface;
/* Get mouse coordinates
* \*------------------------------------------------------------- */
SYSINPUT_GetMousePos(&mouse_x, &mouse_y);
mouse_pt.x = mouse_x;
mouse_pt.y = mouse_y;
if (RenderModule.r_doubleres) {
mouse_pt.x /= 2;
mouse_pt.y /= 2;
}
SCENE_GetBGInfo(&bg_info);
GAME_GetDisplayInfo(&disp_info);
bg_pt.x = 0;
bg_pt.y = 0;
/* Display scene background
* \*--------------------------------------------------------- */
SCENE_Draw(backbuf_surface);
/* Display scene maps, if applicable
* \*--------------------------------------------------------- */
if (RENDER_GetFlags() & RF_OBJECTMAP_TEST) {
OBJECTMAP_Draw(backbuf_surface,
&mouse_pt, SYSGFX_GetWhite(), SYSGFX_GetBlack());
ACTIONMAP_Draw(backbuf_surface, SYSGFX_MatchColor(R_RGB_RED));
}
/* Draw queued actors
* \*--------------------------------------------------------- */
ACTOR_DrawList();
/* Draw queued text strings
* \*--------------------------------------------------------- */
SCENE_GetInfo(&scene_info);
TEXT_DrawList(scene_info.text_list, backbuf_surface);
/* Handle user input
* \*--------------------------------------------------------- */
SYSINPUT_ProcessInput();
/* Display rendering information
* \*--------------------------------------------------------- */
if (RenderModule.r_flags & RF_SHOW_FPS) {
sprintf(txt_buf, "%d", RenderModule.r_fps);
fps_width = FONT_GetStringWidth(SMALL_FONT_ID,
txt_buf, 0, FONT_NORMAL);
FONT_Draw(SMALL_FONT_ID,
backbuf_surface,
txt_buf,
0,
backbuf_surface->buf_w - fps_width, 2,
SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
switch (RenderModule.r_mode) {
case RM_SCANLINES:
FONT_Draw(SMALL_FONT_ID,
backbuf_surface,
"Scanlines",
0,
2, 2,
SYSGFX_GetWhite(),
SYSGFX_GetBlack(), FONT_OUTLINE);
break;
case RM_2XSAI:
FONT_Draw(SMALL_FONT_ID,
backbuf_surface,
"2xSaI",
0,
2, 2,
SYSGFX_GetWhite(),
SYSGFX_GetBlack(), FONT_OUTLINE);
break;
case RM_SUPER2XSAI:
FONT_Draw(SMALL_FONT_ID,
backbuf_surface,
"Super2xSaI",
0,
2, 2,
SYSGFX_GetWhite(),
SYSGFX_GetBlack(), FONT_OUTLINE);
break;
case RM_SUPEREAGLE:
FONT_Draw(SMALL_FONT_ID,
backbuf_surface,
"SuperEagle",
0,
2, 2,
SYSGFX_GetWhite(),
SYSGFX_GetBlack(), FONT_OUTLINE);
break;
}
}
/* Display "paused game" message, if applicable
* \*--------------------------------------------------------- */
if (RenderModule.r_flags & RF_RENDERPAUSE) {
int msg_len = strlen(R_PAUSEGAME_MSG);
int msg_w = FONT_GetStringWidth(BIG_FONT_ID,
R_PAUSEGAME_MSG,
msg_len,
FONT_OUTLINE);
FONT_Draw(BIG_FONT_ID,
backbuf_surface,
R_PAUSEGAME_MSG,
msg_len,
(backbuf_surface->buf_w - msg_w) / 2, 90,
SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
}
/* Update user interface
* \*--------------------------------------------------------- */
INTERFACE_Update(&mouse_pt, UPDATE_MOUSEMOVE);
if (RenderModule.r_softcursor) {
GFX_DrawCursor(backbuf_surface, &mouse_pt);
}
/* Display text formatting test, if applicable
* \*--------------------------------------------------------- */
if (RenderModule.r_flags & RF_TEXT_TEST) {
TEXT_Draw(MEDIUM_FONT_ID,
backbuf_surface,
test_txt,
mouse_pt.x, mouse_pt.y,
SYSGFX_GetWhite(),
SYSGFX_GetBlack(), FONT_OUTLINE | FONT_CENTERED);
}
/* Display palette test, if applicable
* \*--------------------------------------------------------- */
if (RenderModule.r_flags & RF_PALETTE_TEST) {
GFX_DrawPalette(backbuf_surface);
}
/* Draw console
* \*--------------------------------------------------------- */
CON_Draw(backbuf_surface);
/* Display the current frame
* \*--------------------------------------------------------- */
if (RenderModule.r_hicolor) {
display_surface = SYSGFX_FormatToDisplay(backbuf_surface);
if (display_surface == NULL) {
R_printf(R_STDERR,
"Error: Back buffer conversion failed!\n");
return R_FAILURE;
}
surface_converted = 1;
} else {
display_surface = backbuf_surface;
}
SYSGFX_LockSurface(screen_surface);
SYSGFX_LockSurface(display_surface);
switch (RenderModule.r_mode) {
case RM_SCANLINES:
break;
default:
if (RenderModule.r_doubleres) {
GFX_Scale2x(screen_surface, display_surface);
} else {
GFX_SimpleBlit(screen_surface, display_surface);
}
break;
}
SYSGFX_UnlockSurface(display_surface);
SYSGFX_UnlockSurface(screen_surface);
if (surface_converted) {
SYSGFX_DestroySurface(display_surface);
}
// FIXME
SDL_UpdateRect((SDL_Surface *)screen_surface->impl_src, 0, 0, 0, 0);
return R_SUCCESS;
}
unsigned int RENDER_GetFrameCount(void)
{
return RenderModule.r_framecount;
}
unsigned int RENDER_ResetFrameCount(void)
{
unsigned int framecount = RenderModule.r_framecount;
RenderModule.r_framecount = 0;
return framecount;
}
void RENDER_FpsTimer(unsigned long interval, void *param)
{
YS_IGNORE_PARAM(interval);
YS_IGNORE_PARAM(param);
RenderModule.r_fps = RenderModule.r_framecount;
RenderModule.r_framecount = 0;
return;
}
void RENDER_ConvertMousePt(R_POINT * mouse_pt)
{
assert(mouse_pt != NULL);
if (RenderModule.r_doubleres) {
mouse_pt->x /= 2;
mouse_pt->y /= 2;
}
return;
}
unsigned int RENDER_GetFlags(void)
{
return RenderModule.r_flags;
}
void RENDER_SetFlag(unsigned int flag)
{
RenderModule.r_flags |= flag;
return;
}
void RENDER_ToggleFlag(unsigned int flag)
{
RenderModule.r_flags ^= flag;
return;
}
int RENDER_SetMode(int mode)
{
switch (mode) {
case RM_SCANLINES:
if (!RenderModule.r_doubleres) {
return R_FAILURE;
}
break;
case RM_2XSAI:
if (!RenderModule.r_doubleres || !RenderModule.r_hicolor) {
return R_FAILURE;
}
break;
case RM_SUPER2XSAI:
if (!RenderModule.r_doubleres || !RenderModule.r_hicolor) {
return R_FAILURE;
}
break;
case RM_SUPEREAGLE:
if (!RenderModule.r_doubleres || !RenderModule.r_hicolor) {
return R_FAILURE;
}
break;
default:
break;
}
RenderModule.r_mode = mode;
return R_SUCCESS;
}
int RENDER_GetBufferInfo(R_BUFFER_INFO * r_bufinfo)
{
assert(r_bufinfo != NULL);
r_bufinfo->r_bg_buf = RenderModule.r_bg_buf;
r_bufinfo->r_bg_buf_w = RenderModule.r_bg_buf_w;
r_bufinfo->r_bg_buf_h = RenderModule.r_bg_buf_h;
r_bufinfo->r_tmp_buf = RenderModule.r_tmp_buf;
r_bufinfo->r_tmp_buf_w = RenderModule.r_tmp_buf_w;
r_bufinfo->r_tmp_buf_h = RenderModule.r_tmp_buf_h;
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: render.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/render.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Main rendering loop - private header
Notes:
*/
#ifndef SAGA_RENDER_H_
#define SAGA_RENDER_H_
namespace Saga {
/* Render module CVAR defaults */
#define R_FULLSCREEN_DEFAULT 0
#define R_DOUBLERES_DEFAULT 1
#define R_HICOLOR_DEFAULT 1
#define R_SOFTCURSOR_DEFAULT 1
#define R_DOUBLE_RESLIMIT 320
#define R_PAUSEGAME_MSG "PAWS GAME"
typedef struct R_RENDER_MODULE_tag {
int initialized;
/* Init cvars */
int r_fullscreen;
int r_doubleres;
int r_hicolor;
int r_softcursor;
/* Module data */
R_SURFACE *r_screen_surface;
R_SURFACE *r_display_surface;
R_SURFACE *r_backbuf_surface;
uchar *r_bg_buf;
int r_bg_buf_w;
int r_bg_buf_h;
uchar *r_tmp_buf;
int r_tmp_buf_w;
int r_tmp_buf_h;
R_SYSTIMER *r_fps_timer;
R_SPRITELIST *r_test_sprite;
unsigned int r_fps;
unsigned int r_framecount;
unsigned int r_flags;
int r_mode;
} R_RENDER_MODULE;
void RENDER_FpsTimer(unsigned long interval, void *param);
} // End of namespace Saga
#endif /* SAGA_RENDER_H_ */
--- NEW FILE: render_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/render_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Main rendering loop - public header
Notes:
*/
#ifndef SAGA_RENDER_MOD_H__
#define SAGA_RENDER_MOD_H__
namespace Saga {
enum RENDER_FLAGS {
RF_SHOW_FPS = 0x01,
RF_PALETTE_TEST = 0x02,
RF_TEXT_TEST = 0x04,
RF_OBJECTMAP_TEST = 0x08,
RF_RENDERPAUSE = 0x10,
RF_GAMEPAUSE = 0x20
};
enum RENDER_MODES {
RM_NORMAL,
RM_SCANLINES,
RM_SCANLINES50,
RM_2XSAI,
RM_SUPER2XSAI,
RM_SUPEREAGLE,
RM_BILINEAR
};
typedef struct R_BUFFER_INFO_tag {
uchar *r_bg_buf;
int r_bg_buf_w;
int r_bg_buf_h;
uchar *r_tmp_buf;
int r_tmp_buf_w;
int r_tmp_buf_h;
} R_BUFFER_INFO;
int RENDER_Register(void);
int RENDER_Init(void);
int RENDER_DrawScene(void);
void RENDER_ConvertMousePt(R_POINT *);
unsigned int RENDER_GetFlags(void);
void RENDER_SetFlag(unsigned int);
void RENDER_ToggleFlag(unsigned int);
int RENDER_SetMode(int);
unsigned int RENDER_GetFrameCount(void);
unsigned int RENDER_ResetFrameCount(void);
int RENDER_GetBufferInfo(R_BUFFER_INFO *);
} // End of namespace Saga
#endif /* SAGA_RENDER_MOD_H__ */
--- NEW FILE: rscfile.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
RSC Resource file management module
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "rscfile_mod.h"
#include "rscfile.h"
namespace Saga {
R_RSCFILE_CONTEXT *RSC_CreateContext(void)
{
R_RSCFILE_CONTEXT empty_context = { 0 };
R_RSCFILE_CONTEXT *new_context;
new_context = (R_RSCFILE_CONTEXT *)malloc(sizeof *new_context);
if (new_context == NULL) {
return NULL;
}
*new_context = empty_context;
return new_context;
}
int RSC_OpenContext(R_RSCFILE_CONTEXT * rsc_context, const char *fspec)
{
FILE *rsc_fp;
int result;
rsc_fp = fopen(fspec, "rb");
if (rsc_fp == NULL) {
return R_FAILURE;
}
if (rsc_context->rc_file_open) {
return R_FAILURE;
}
rsc_context->rc_file_fspec = fspec;
rsc_context->rc_file_p = rsc_fp;
result = ys_get_filesize(rsc_fp, &rsc_context->rc_file_size, NULL);
if (result != YS_E_SUCCESS) {
fclose(rsc_fp);
return R_FAILURE;
}
if (RSC_LoadRSC(rsc_context) != R_SUCCESS) {
return R_FAILURE;
}
rsc_context->rc_file_open = 1;
rsc_context->rc_file_loaded = 1;
return R_SUCCESS;
}
int RSC_CloseContext(R_RSCFILE_CONTEXT * rsc_context)
{
if (rsc_context->rc_file_open) {
fclose(rsc_context->rc_file_p);
}
rsc_context->rc_file_open = 0;
RSC_FreeRSC(rsc_context);
rsc_context->rc_file_loaded = 0;
return R_SUCCESS;
}
int RSC_DestroyContext(R_RSCFILE_CONTEXT * rsc_context)
{
RSC_CloseContext(rsc_context);
if (rsc_context->rc_file_loaded) {
free(rsc_context->rc_res_table);
}
free(rsc_context);
return R_SUCCESS;
}
int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc)
{
ulong res_tbl_ct;
ulong res_tbl_offset;
uchar tblinfo_buf[RSC_TABLEINFO_SIZE];
uchar *tbl_buf;
size_t tbl_len;
ulong i;
R_RSCFILE_RESOURCE *rsc_restbl;
const uchar *read_p;
read_p = tblinfo_buf;
if (rsc->rc_file_size < RSC_MIN_FILESIZE) {
return R_FAILURE;
}
/* Read resource table info from the rear end of file
* \*------------------------------------------------------------- */
fseek(rsc->rc_file_p, (long)(rsc->rc_file_size - 8), SEEK_SET);
if (fread(tblinfo_buf,
1, RSC_TABLEINFO_SIZE, rsc->rc_file_p) != RSC_TABLEINFO_SIZE) {
return R_FAILURE;
}
res_tbl_offset = ys_read_u32_le(read_p, &read_p);
res_tbl_ct = ys_read_u32_le(read_p, NULL);
/* Check for sane table offset
* \*------------------------------------------------------------- */
if (res_tbl_offset != rsc->rc_file_size - RSC_TABLEINFO_SIZE -
RSC_TABLEENTRY_SIZE * res_tbl_ct) {
return R_FAILURE;
}
/* Load resource table
* \*------------------------------------------------------------- */
tbl_len = RSC_TABLEENTRY_SIZE * res_tbl_ct;
tbl_buf = (uchar *)malloc(tbl_len);
if (tbl_buf == NULL) {
return R_FAILURE;
}
fseek(rsc->rc_file_p, (long)res_tbl_offset, SEEK_SET);
if (fread(tbl_buf, 1, tbl_len, rsc->rc_file_p) != tbl_len) {
free(tbl_buf);
return R_FAILURE;
}
rsc_restbl = (R_RSCFILE_RESOURCE *)malloc(res_tbl_ct * sizeof *rsc_restbl);
if (rsc_restbl == NULL) {
free(tbl_buf);
return R_FAILURE;
}
read_p = tbl_buf;
for (i = 0; i < res_tbl_ct; i++) {
rsc_restbl[i].res_offset = ys_read_u32_le(read_p, &read_p);
rsc_restbl[i].res_size = ys_read_u32_le(read_p, &read_p);
if ((rsc_restbl[i].res_offset > rsc->rc_file_size) ||
(rsc_restbl[i].res_size > rsc->rc_file_size)) {
free(tbl_buf);
free(rsc_restbl);
return R_FAILURE;
}
}
rsc->rc_res_table = rsc_restbl;
rsc->rc_res_ct = res_tbl_ct;
free(tbl_buf);
return R_SUCCESS;
}
int RSC_FreeRSC(R_RSCFILE_CONTEXT * rsc)
{
if (!rsc->rc_file_loaded) {
return R_FAILURE;
}
free(rsc->rc_res_table);
return R_SUCCESS;
}
ulong RSC_GetResourceCount(R_RSCFILE_CONTEXT * rsc)
{
return (rsc == NULL) ? 0 : rsc->rc_res_ct;
}
int
RSC_GetResourceSize(R_RSCFILE_CONTEXT * rsc, ulong res_num, ulong * res_size)
{
if ((rsc == NULL) || (res_size == NULL)) {
return R_FAILURE;
}
if (res_num > (rsc->rc_res_ct - 1)) {
return R_FAILURE;
}
*res_size = rsc->rc_res_table[res_num].res_size;
return R_SUCCESS;
}
int
RSC_GetResourceOffset(R_RSCFILE_CONTEXT * rsc,
ulong res_num, ulong * res_offset)
{
if ((rsc == NULL) || (res_offset == NULL)) {
return R_FAILURE;
}
if (res_num > (rsc->rc_res_ct - 1)) {
return R_FAILURE;
}
*res_offset = rsc->rc_res_table[res_num].res_offset;
return R_SUCCESS;
}
int
RSC_LoadResource(R_RSCFILE_CONTEXT * rsc,
ulong res_num, uchar ** res_p, size_t * res_size_p)
{
ulong res_offset;
size_t res_size;
uchar *res_buf;
if ((rsc == NULL) || (res_p == NULL)) {
return R_FAILURE;
}
if (res_num > (rsc->rc_res_ct - 1)) {
return R_FAILURE;
}
res_offset = rsc->rc_res_table[res_num].res_offset;
res_size = rsc->rc_res_table[res_num].res_size;
if (fseek(rsc->rc_file_p, (long)res_offset, SEEK_SET) != 0) {
return R_FAILURE;
}
res_buf = (uchar *)malloc(res_size);
if (res_buf == NULL) {
return R_MEM;
}
if (fread(res_buf, 1, res_size, rsc->rc_file_p) != res_size) {
free(res_buf);
return R_FAILURE;
}
*res_p = res_buf;
if (res_size_p != NULL) {
*res_size_p = res_size;
}
return R_SUCCESS;
}
int RSC_FreeResource(uchar * resource_ptr)
{
free(resource_ptr);
return R_SUCCESS;
}
} // End of namespace Saga
--- NEW FILE: rscfile.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/rscfile.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
RSC Resource file management header file
Notes:
*/
#ifndef SAGA_RSCFILE_H__
#define SAGA_RSCFILE_H__
namespace Saga {
#define RSC_TABLEINFO_SIZE 8
#define RSC_TABLEENTRY_SIZE 8
#define RSC_MIN_FILESIZE (RSC_TABLEINFO_SIZE + RSC_TABLEENTRY_SIZE + 1)
typedef struct R_RSCFILE_RESOURCE_tag {
int res_type;
size_t res_offset;
size_t res_size;
} R_RSCFILE_RESOURCE;
struct R_RSCFILE_CONTEXT_tag {
const char *rc_file_fspec;
FILE *rc_file_p;
int rc_file_open;
unsigned long rc_file_size;
int rc_file_loaded;
R_RSCFILE_RESOURCE *rc_res_table;
size_t rc_res_ct;
};
int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc_context);
int RSC_FreeRSC(R_RSCFILE_CONTEXT * rsc);
} // End of namespace Saga
#endif /* SAGA_RSCFILE_H__ */
--- NEW FILE: rscfile_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/rscfile_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
RSC Resource file management module public header file
Notes:
*/
#ifndef SAGA_RSCFILE_MOD_H__
#define SAGA_RSCFILE_MOD_H__
#include "resnames.h"
namespace Saga {
R_RSCFILE_CONTEXT *RSC_CreateContext(void);
int RSC_DestroyContext(R_RSCFILE_CONTEXT *);
int RSC_OpenContext(R_RSCFILE_CONTEXT *, const char *);
int RSC_CloseContext(R_RSCFILE_CONTEXT *);
ulong RSC_GetResourceCount(R_RSCFILE_CONTEXT *);
int RSC_GetResourceSize(R_RSCFILE_CONTEXT *, ulong, ulong *);
int RSC_GetResourceOffset(R_RSCFILE_CONTEXT *, ulong, ulong *);
int RSC_LoadResource(R_RSCFILE_CONTEXT *, ulong, uchar **, size_t *);
int RSC_FreeResource(uchar *);
} // End of namespace Saga
#endif /* SAGA_RSCFILE_MOD_H__ */
--- NEW FILE: scene.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
[...1120 lines suppressed...]
YS_IGNORE_PARAM(argc);
YS_IGNORE_PARAM(argv);
CON_Print(fmt, "Scene number:", SceneModule.scene_number);
CON_Print(fmt, "Descriptor R#:", SceneModule.scene_rn);
CON_Print("-------------------------");
CON_Print(fmt, "Unknown:", SceneModule.desc.unknown0);
CON_Print(fmt, "Resource list R#:", SceneModule.desc.res_list_rn);
CON_Print(fmt, "End slope:", SceneModule.desc.end_slope);
CON_Print(fmt, "Begin slope:", SceneModule.desc.begin_slope);
CON_Print(fmt, "Script resource:", SceneModule.desc.script_num);
CON_Print(fmt, "Scene script:", SceneModule.desc.scene_scriptnum);
CON_Print(fmt, "Start script:", SceneModule.desc.start_scriptnum);
CON_Print(fmt, "Music R#", SceneModule.desc.music_rn);
return;
}
} // End of namespace Saga
--- NEW FILE: scene.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/scene.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Scene management module private header file
Notes:
*/
#ifndef SAGA_SCENE_H
#define SAGA_SCENE_H
namespace Saga {
enum SCENE_LOAD_FLAGS {
BY_RESOURCE = 0,
BY_SCENE,
BY_DESC
};
enum SCENE_PROC_PARAMS {
SCENE_BEGIN = 0,
SCENE_END
};
/* Resource type numbers */
enum SAGA_RESOURCE_TYPES {
SAGA_BG_IMAGE = 2,
SAGA_BG_MASK = 3,
SAGA_OBJECT_NAME_LIST = 5,
SAGA_OBJECT_MAP = 6,
SAGA_ACTION_MAP = 7,
SAGA_ISO_TILESET = 8,
SAGA_ISO_METAMAP = 9,
SAGA_ISO_METATILESET = 10,
SAGA_ANIM_1 = 14,
SAGA_ANIM_2,
SAGA_ANIM_3,
SAGA_ANIM_4,
SAGA_ANIM_5,
SAGA_ANIM_6,
SAGA_ANIM_7,
SAGA_PAL_ANIM = 23
};
#define SAGA_SCENE_DESC_LEN 16
typedef struct R_SCENE_DESC_tag {
int unknown0;
int res_list_rn;
int end_slope;
int begin_slope;
int script_num;
int scene_scriptnum;
int start_scriptnum;
int music_rn;
struct R_SCENE_RESLIST_tag *res_list;
size_t res_list_ct;
} R_SCENE_DESC;
#define SAGA_RESLIST_ENTRY_LEN 4
typedef struct R_SCENE_RESLIST_tag {
ulong res_number;
int res_type;
uchar *res_data;
size_t res_data_len;
} R_SCENE_RESLIST;
typedef struct SCENE_IMAGE_tag {
int loaded;
int w;
int h;
int p;
uchar *buf;
size_t buf_len;
uchar *res_buf;
size_t res_len;
PALENTRY pal[256];
} SCENE_IMAGE;
typedef struct SCENE_ANIMINFO_tag {
int anim_res_number;
int anim_handle;
struct SCENE_ANIMINFO_tag *next;
} SCENE_ANIMINFO;
typedef struct R_SCENE_QUEUE_tag {
ulong scene_n;
R_SCENE_DESC *scene_desc;
int load_flag;
R_SCENE_PROC *scene_proc;
int scene_skiptarget;
} R_SCENE_QUEUE;
typedef struct R_SCENE_MODULE_tag {
int init;
R_RSCFILE_CONTEXT *scene_ctxt;
int *scene_lut;
int scene_count;
int scene_max;
YS_DL_LIST *scene_queue;
int first_scene;
int scene_loaded;
int scene_mode;
int scene_number;
int scene_rn;
int in_game;
int load_desc;
R_SCENE_DESC desc;
int reslist_loaded;
int reslist_entries;
R_SCENE_RESLIST *reslist;
int anim_entries;
YS_DL_LIST *anim_list;
R_SCENE_PROC *scene_proc;
R_TEXTLIST *text_list;
SCENE_IMAGE bg;
SCENE_IMAGE bg_mask;
} R_SCENE_MODULE;
int SCENE_Queue(R_SCENE_QUEUE * scene_queue);
int SCENE_ClearQueue(void);
int
SCENE_Load(int scene,
int load_flag, R_SCENE_PROC scene_proc, struct R_SCENE_DESC_tag *);
int LoadSceneDescriptor(ulong res_number);
int LoadSceneResourceList(ulong res_number);
int ProcessSceneResources(void);
void CF_scenechange(int argc, char *argv[]);
void CF_sceneinfo(int argc, char *argv[]);
/*
* r_sceneproc.c
\*--------------------------------------------------------------------------*/
int IHNM_StartProc(void);
int InitialSceneProc(int param, R_SCENE_INFO * scene_info);
int DefaultSceneProc(int param, R_SCENE_INFO * scene_info);
/*
* r_ite_introproc.c
\*--------------------------------------------------------------------------*/
int ITE_StartProc(void);
int ITE_IntroAnimProc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info);
int ITE_IntroFaireTentProc(int param, R_SCENE_INFO * scene_info);
/*
* r_ihnm_introproc.c
\*--------------------------------------------------------------------------*/
int IHNM_StartProc(void);
int IHNM_IntroMovieProc1(int param, R_SCENE_INFO * scene_info);
int IHNM_IntroMovieProc2(int param, R_SCENE_INFO * scene_info);
int IHNM_IntroMovieProc3(int param, R_SCENE_INFO * scene_info);
int IHNM_HateProc(int param, R_SCENE_INFO * scene_info);
} // End of namespace Saga
#endif /* SAGA_SCENE_H_ */
--- NEW FILE: scene_mod.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/scene_mod.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Scene management module public header file
Notes:
*/
#ifndef SAGA_SCENE_MOD_H__
#define SAGA_SCENE_MOD_H__
#include "text_mod.h"
namespace Saga {
/*
* r_scene.c
\*--------------------------------------------------------------------------*/
enum R_SCENE_MODES {
R_SCENE_MODE_INVALID,
R_SCENE_MODE_NORMAL,
R_SCENE_MODE_ISO
};
typedef struct SCENE_ZINFO_tag {
int begin_slope;
int end_slope;
} SCENE_ZINFO;
typedef struct SCENE_BGINFO_tag {
int bg_x;
int bg_y;
int bg_w;
int bg_h;
int bg_p;
uchar *bg_buf;
size_t bg_buflen;
} SCENE_BGINFO;
typedef struct R_SCENE_INFO_tag {
SCENE_ZINFO z_info;
SCENE_BGINFO bg_info;
R_TEXTLIST *text_list;
} R_SCENE_INFO;
typedef int (R_SCENE_PROC) (int, R_SCENE_INFO *);
int SCENE_Register(void);
int SCENE_Init(void);
int SCENE_Shutdown(void);
int SCENE_Start(void);
int SCENE_Next(void);
int SCENE_Skip(void);
int SCENE_End(void);
int SCENE_Draw(R_SURFACE *);
int SCENE_GetMode(void);
int SCENE_GetBGMaskInfo(int *w, int *h, uchar ** buf, size_t * buf_len);
int SCENE_IsBGMaskPresent(void);
int SCENE_GetBGInfo(SCENE_BGINFO * bginfo);
int SCENE_GetZInfo(SCENE_ZINFO * zinfo);
int SCENE_GetBGPal(PALENTRY ** pal);
int SCENE_GetInfo(R_SCENE_INFO * si);
} // End of namespace Saga
#endif /* SAGA_SCENE_MOD_H__ */
--- NEW FILE: sceneproc.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/sceneproc.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Initial and default scene procedures
Notes:
*/
#include
#include
#include
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "animation_mod.h"
#include "events_mod.h"
#include "scene_mod.h"
#include "palanim_mod.h"
/*
* Begin module
\*--------------------------------------------------------------------------*/
#include "scene.h"
#include "sceneproc.h"
namespace Saga {
int InitialSceneProc(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event = { 0 };
R_EVENT *q_event;
int delay_time = 0;
static PALENTRY current_pal[R_PAL_ENTRIES];
PALENTRY *pal;
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
SYSMUSIC_Stop();
SYSSOUND_StopVoice();
/* Fade palette to black from intro scene
* \*----------------------------------------------------- */
SYSGFX_GetCurrentPal(current_pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_PALTOBLACK;
event.time = 0;
event.duration = PALETTE_FADE_DURATION;
event.data = current_pal;
delay_time += PALETTE_FADE_DURATION;
q_event = EVENT_Queue(&event);
/* Activate user interface
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_INTERFACE_EVENT;
event.op = EVENT_ACTIVATE;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
/* Set first scene background w/o changing palette
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = NO_SET_PALETTE;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
/* Fade in to first scene background palette
* \*----------------------------------------------------- */
SCENE_GetBGPal(&pal);
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_BLACKTOPAL;
event.time = delay_time;
event.duration = PALETTE_FADE_DURATION;
event.data = pal;
q_event = EVENT_Chain(q_event, &event);
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
ANIM_SetFlag(0, ANIM_LOOP);
ANIM_Play(0, delay_time);
break;
case SCENE_END:
break;
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
}
return 0;
}
int DefaultSceneProc(int param, R_SCENE_INFO * scene_info)
{
R_EVENT event;
YS_IGNORE_PARAM(scene_info);
switch (param) {
case SCENE_BEGIN:
/* Set scene background
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = SET_PALETTE;
event.time = 0;
EVENT_Queue(&event);
/* Activate user interface
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_INTERFACE_EVENT;
event.op = EVENT_ACTIVATE;
event.time = 0;
EVENT_Queue(&event);
/* Begin palette cycle animation if present
* \*----------------------------------------------------- */
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
event.time = 0;
EVENT_Queue(&event);
break;
case SCENE_END:
break;
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
}
return 0;
}
} // End of namespace Saga
--- NEW FILE: sceneproc.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/sceneproc.h,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Initial and default scene procedures header file
Notes:
*/
#ifndef SAGA_SCENEPROC_H
#define SAGA_SCENEPROC_H
namespace Saga {
#define PALETTE_FADE_DURATION 1000
} // End of namespace Saga
#endif
--- NEW FILE: script.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/saga/script.cpp,v 1.1 2004/04/12 21:40:47 sev Exp $
*
*/
/*
Description:
Scripting module: Script resource handling functions
Notes:
*/
#include "reinherit.h"
#include "yslib.h"
/*
* Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "rscfile_mod.h"
#include "game_mod.h"
#include "text_mod.h"
#include "console_mod.h"
#include "cvar_mod.h"
/*
* Begin module component
\*--------------------------------------------------------------------------*/
#include "script_mod.h"
#include "script.h"
#include "sstack.h"
#include "sthread.h"
namespace Saga {
R_SCRIPT_MODULE ScriptModule;
int SCRIPT_Register(void)
{
CVAR_RegisterFunc(CF_script_info,
"script_info", NULL, R_CVAR_NONE, 0, 0);
CVAR_RegisterFunc(CF_script_exec,
"script_exec", "