aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1
diff options
context:
space:
mode:
authorDavid Corrales2007-07-08 16:58:54 +0000
committerDavid Corrales2007-07-08 16:58:54 +0000
commit9bfe5d53540af7dc9bf0214202f4e35b272320ea (patch)
tree69dcaf6f735e9fd0913a3e2f163852d4b9af87e3 /engines/sword1
parent256e4d9521b79160d1f9ed670656097a96dc5a34 (diff)
parent17da12ca07a1f18f3fe1ef5b0c2c0cd9fd8359b4 (diff)
downloadscummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.tar.gz
scummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.tar.bz2
scummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.zip
Merged the FSNode branch with trunk r27681:27969
svn-id: r27970
Diffstat (limited to 'engines/sword1')
-rw-r--r--engines/sword1/control.cpp9
-rw-r--r--engines/sword1/mouse.h2
-rw-r--r--engines/sword1/object.h10
-rw-r--r--engines/sword1/router.h4
-rw-r--r--engines/sword1/sound.cpp30
-rw-r--r--engines/sword1/sound.h3
-rw-r--r--engines/sword1/staticres.cpp2
-rw-r--r--engines/sword1/sword1.cpp20
-rw-r--r--engines/sword1/sworddefs.h10
9 files changed, 58 insertions, 32 deletions
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 1ebfaedb2e..c5b968aabe 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -650,14 +650,7 @@ bool Control::getConfirm(const uint8 *title) {
}
bool Control::keyAccepted(uint16 ascii) {
- // this routine needs changes for Czech keys... No idea how to do that, though.
- // FIXME: It is not a good idea to put non-ASCII chars into a C source file,
- // since there is no way to specify which encoding you are using.
- // It is better to encode them as hex/octal. Although in this particular
- // case, it seems questionable to do this at all, since we currently
- // do not at all specify which encoding keyboard events use, so this
- // check here is probably not portable anyway...
- static const char allowedSpecials[] = "éèáàúùäöüÄÖÜß,.:-()?! \"\'";
+ static const char allowedSpecials[] = ",.:-()?! \"\'";
if (((ascii >= 'A') && (ascii <= 'Z')) ||
((ascii >= 'a') && (ascii <= 'z')) ||
((ascii >= '0') && (ascii <= '9')) ||
diff --git a/engines/sword1/mouse.h b/engines/sword1/mouse.h
index 92b26c3573..f2c800d63b 100644
--- a/engines/sword1/mouse.h
+++ b/engines/sword1/mouse.h
@@ -60,7 +60,7 @@ struct MousePtr {
uint16 hotSpotX;
uint16 hotSpotY;
uint8 dummyData[0x30];
-};
+} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
diff --git a/engines/sword1/object.h b/engines/sword1/object.h
index ba65002918..87cbce7b84 100644
--- a/engines/sword1/object.h
+++ b/engines/sword1/object.h
@@ -40,7 +40,7 @@ namespace Sword1 {
struct OEventSlot { //receiving event list in the compact -
int32 o_event; //array of these with O_TOTAL_EVENTS elements
int32 o_event_script;
-}; // size = 2*int32 = 8 bytes
+} PACKED_STRUCT; // size = 2*int32 = 8 bytes
#define TOTAL_script_levels 5
@@ -48,12 +48,12 @@ struct ScriptTree { //this is a logic tree, used by OBJECTs
int32 o_script_level; //logic level
int32 o_script_id[TOTAL_script_levels]; //script id's (are unique to each level)
int32 o_script_pc[TOTAL_script_levels]; //pc of script for each (if script_manager)
-}; // size = 11*int32 = 44 bytes
+} PACKED_STRUCT; // size = 11*int32 = 44 bytes
struct TalkOffset {
int32 x;
int32 y;
-}; // size = 2*int32 = 8 bytes
+} PACKED_STRUCT; // size = 2*int32 = 8 bytes
struct WalkData {
int32 frame;
@@ -61,7 +61,7 @@ struct WalkData {
int32 y;
int32 step;
int32 dir;
-}; // size = 5*int32 = 20 bytes
+} PACKED_STRUCT; // size = 5*int32 = 20 bytes
struct Object {
int32 o_type; // 0 broad description of type - object, floor, etc.
@@ -119,7 +119,7 @@ struct Object {
WalkData o_route[O_WALKANIM_SIZE]; // 340 size = 600*20 bytes = 12000
// mega size = 12340 bytes (+ 8 byte offset table + 20 byte header = 12368)
-};
+} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
diff --git a/engines/sword1/router.h b/engines/sword1/router.h
index 67be8d0593..60456cc5c8 100644
--- a/engines/sword1/router.h
+++ b/engines/sword1/router.h
@@ -44,7 +44,7 @@ struct BarData {
int16 dx; // x2 - x1
int16 dy; // y2 - y1
int32 co; // co = (y1*dx) - (x1*dy) from an equation for a line y*dx = x*dy + co
-};
+} PACKED_STRUCT;
struct NodeData {
int16 x;
@@ -52,7 +52,7 @@ struct NodeData {
int16 level;
int16 prev;
int16 dist;
-};
+} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 4d8601a0d8..492672fad8 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -33,6 +33,7 @@
#include "sword1/logic.h"
#include "sword1/sword1.h"
+#include "sound/flac.h"
#include "sound/mp3.h"
#include "sound/vorbis.h"
#include "sound/wave.h"
@@ -197,10 +198,10 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
if (data)
_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, speechVol, speechPan);
}
-#ifdef USE_MAD
- else if (_cowMode == CowMp3) {
+#ifdef USE_FLAC
+ else if (_cowMode == CowFlac) {
_cowFile.seek(index);
- _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
// with compressed audio, we can't calculate the wave volume.
// so default to talking.
for (int cnt = 0; cnt < 480; cnt++)
@@ -212,6 +213,19 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
else if (_cowMode == CowVorbis) {
_cowFile.seek(index);
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+ // with compressed audio, we can't calculate the wave volume.
+ // so default to talking.
+ for (int cnt = 0; cnt < 480; cnt++)
+ _waveVolume[cnt] = true;
+ _waveVolPos = 0;
+ }
+#endif
+#ifdef USE_MAD
+ else if (_cowMode == CowMp3) {
+ _cowFile.seek(index);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+ // with compressed audio, we can't calculate the wave volume.
+ // so default to talking.
for (int cnt = 0; cnt < 480; cnt++)
_waveVolume[cnt] = true;
_waveVolPos = 0;
@@ -332,6 +346,16 @@ void Sound::initCowSystem(void) {
/* look for speech1/2.clu in the data dir
and speech/speech.clu (running from cd or using cd layout)
*/
+#ifdef USE_FLAC
+ if (!_cowFile.isOpen()) {
+ sprintf(cowName, "SPEECH%d.CLF", SwordEngine::_systemVars.currentCD);
+ _cowFile.open(cowName);
+ if (_cowFile.isOpen()) {
+ debug(1, "Using Flac compressed Speech Cluster");
+ _cowMode = CowFlac;
+ }
+ }
+#endif
#ifdef USE_VORBIS
if (!_cowFile.isOpen()) {
sprintf(cowName, "SPEECH%d.CLV", SwordEngine::_systemVars.currentCD);
diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h
index fb608a9631..fafc9c2d06 100644
--- a/engines/sword1/sound.h
+++ b/engines/sword1/sound.h
@@ -66,8 +66,9 @@ class ResMan;
enum CowMode {
CowWave = 0,
- CowMp3,
+ CowFlac,
CowVorbis,
+ CowMp3,
CowDemo
};
diff --git a/engines/sword1/staticres.cpp b/engines/sword1/staticres.cpp
index 366e2c7608..08e6a108c4 100644
--- a/engines/sword1/staticres.cpp
+++ b/engines/sword1/staticres.cpp
@@ -5158,7 +5158,7 @@ const FxDef Sound::_fxList[312] = {
},
},
//------------------------
- // 198 Ambient sound for Montfauçon Square
+ // 198 Ambient sound for Montfaucon Square
{
FX_MONTAMB, // sampleId
FX_LOOP, // type
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index d899d25df5..b5152f33bc 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -355,14 +355,18 @@ const CdFile SwordEngine::_pcCdFileList[] = {
{ "cows.mad", FLAG_DEMO },
{ "speech1.clu", FLAG_SPEECH1 },
{ "speech2.clu", FLAG_SPEECH2 }
-#ifdef USE_MAD
- ,{ "speech1.cl3", FLAG_SPEECH1 },
- { "speech2.cl3", FLAG_SPEECH2 }
+#ifdef USE_FLAC
+ ,{ "speech1.clf", FLAG_SPEECH1 },
+ { "speech2.clf", FLAG_SPEECH2 }
#endif
#ifdef USE_VORBIS
,{ "speech1.clv", FLAG_SPEECH1 },
{ "speech2.clv", FLAG_SPEECH2 }
#endif
+#ifdef USE_MAD
+ ,{ "speech1.cl3", FLAG_SPEECH1 },
+ { "speech2.cl3", FLAG_SPEECH2 }
+#endif
};
const CdFile SwordEngine::_macCdFileList[] = {
@@ -383,14 +387,18 @@ const CdFile SwordEngine::_macCdFileList[] = {
{ "text.clm", FLAG_CD1 | FLAG_DEMO },
{ "speech1.clu", FLAG_SPEECH1 },
{ "speech2.clu", FLAG_SPEECH2 }
-#ifdef USE_MAD
- ,{ "speech1.cl3", FLAG_SPEECH1 },
- { "speech2.cl3", FLAG_SPEECH2 }
+#ifdef USE_FLAC
+ ,{ "speech1.clf", FLAG_SPEECH1 },
+ { "speech2.clf", FLAG_SPEECH2 }
#endif
#ifdef USE_VORBIS
,{ "speech1.clv", FLAG_SPEECH1 },
{ "speech2.clv", FLAG_SPEECH2 }
#endif
+#ifdef USE_MAD
+ ,{ "speech1.cl3", FLAG_SPEECH1 },
+ { "speech2.cl3", FLAG_SPEECH2 }
+#endif
};
diff --git a/engines/sword1/sworddefs.h b/engines/sword1/sworddefs.h
index aedc38ef7e..e90eafe825 100644
--- a/engines/sword1/sworddefs.h
+++ b/engines/sword1/sworddefs.h
@@ -100,7 +100,7 @@ struct Header {
uint32 comp_length;
char compression[4];
uint32 decomp_length;
-};
+} PACKED_STRUCT;
struct FrameHeader {
uint8 runTimeComp[4];
@@ -115,25 +115,25 @@ struct ParallaxHeader {
char type[16];
uint16 sizeX;
uint16 sizeY;
-};
+} PACKED_STRUCT;
struct AnimUnit {
uint32 animX;
uint32 animY;
uint32 animFrame;
-};
+} PACKED_STRUCT;
struct AnimSet {
uint32 cdt;
uint32 spr;
-};
+} PACKED_STRUCT;
struct WalkGridHeader {
int32 scaleA;
int32 scaleB;
int32 numBars;
int32 numNodes;
-};
+} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING