Ticket #1746: bs1_demo.diff
File bs1_demo.diff, 5.3 KB (added by , 20 years ago) |
---|
-
sword1/sound.cpp
diff -ur --exclude=CVS ScummVM/sword1/sound.cpp ScummVM+hack/sword1/sound.cpp
old new 31 31 #define SOUND_SPEECH_ID 1 32 32 #define SPEECH_FLAGS (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN) 33 33 34 Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan ) {34 Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan, bool isDemo) { 35 35 strcpy(_filePath, searchPath); 36 36 _mixer = mixer; 37 37 _resMan = pResMan; … … 39 39 _endOfQueue = 0; 40 40 _currentCowFile = 0; 41 41 _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192; 42 _isDemo = isDemo; 42 43 } 43 44 44 45 int Sound::addToQueue(int32 fxNo) { … … 185 186 while ((READ_BE_UINT32(fBuf + headerPos) != 'data') && (headerPos < 100)) 186 187 headerPos++; 187 188 if (headerPos < 100) { 188 uint32 resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1;189 int32 resSize; 189 190 // Demo uses slightly different headers 190 if ( resSize > cSize) {191 if (_isDemo) { 191 192 resSize = READ_LE_UINT32(fBuf + headerPos + 6) >> 1; 192 193 headerPos += 2; 193 } 194 194 } else 195 resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1; 195 196 int16 *srcData = (int16*)(fBuf + headerPos + 8); 196 197 int16 *dstData = (int16*)malloc(resSize * 2); 197 198 uint32 srcPos = 0; -
sword1/sound.h
diff -ur --exclude=CVS ScummVM/sword1/sound.h ScummVM+hack/sword1/sound.h
old new 60 60 61 61 class Sound { 62 62 public: 63 Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan );63 Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan, bool isDemo); 64 64 ~Sound(void); 65 65 void setSpeechVol(uint8 volL, uint8 volR) { _speechVolL = volL; _speechVolR = volR; }; 66 66 void setSfxVol(uint8 volL, uint8 volR) { _sfxVolL = volL; _sfxVolR = volR; }; … … 100 100 uint8 _endOfQueue; 101 101 SoundMixer *_mixer; 102 102 ResMan *_resMan; 103 bool _isDemo; 103 104 char _filePath[100]; 104 105 static const char _musicList[270]; 105 106 static const uint16 _roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM]; -
sword1/sword1.cpp
diff -ur --exclude=CVS ScummVM/sword1/sword1.cpp ScummVM+hack/sword1/sword1.cpp
old new 47 47 using namespace Sword1; 48 48 49 49 /* Broken Sword 1 */ 50 static const GameSettings sword1_setting = 51 {"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER}; 50 static const GameSettings sword1_settings[] = { 51 {"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER}, 52 {"sword1demo", "Broken Sword I (Demo)", GF_DEFAULT_TO_1X_SCALER | Sword1::GF_DEMO }, 53 { NULL, NULL, 0 } 54 }; 52 55 53 56 GameList Engine_SWORD1_gameList() { 57 const GameSettings *g = sword1_settings; 54 58 GameList games; 55 games.push_back(sword1_setting); 59 while (g->name) { 60 games.push_back(*g); 61 g++; 62 } 56 63 return games; 57 64 } 58 65 59 66 DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) { 60 67 DetectedGameList detectedGames; 68 const GameSettings *g = sword1_settings; 61 69 62 // Iterate over all files in the given directory 63 for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { 64 const char *gameName = file->displayName().c_str(); 65 66 if ((0 == scumm_stricmp("swordres.rif", gameName)) || 67 (0 == scumm_stricmp("cd1.id", gameName)) || 68 (0 == scumm_stricmp("cd2.id", gameName))) { 69 // Match found, add to list of candidates, then abort inner loop. 70 detectedGames.push_back(sword1_setting); 71 break; 70 // TODO: It would be nice if we had code here which distinguishes 71 // between the 'sword1' and 'sword1demo' targets. 72 73 while (g->name) { 74 // Iterate over all files in the given directory 75 for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { 76 const char *gameName = file->displayName().c_str(); 77 78 if ((0 == scumm_stricmp("swordres.rif", gameName)) || 79 (0 == scumm_stricmp("cd1.id", gameName)) || 80 (0 == scumm_stricmp("cd2.id", gameName))) { 81 // Match found, add to list of candidates, then abort inner loop. 82 detectedGames.push_back(*g); 83 break; 84 } 72 85 } 86 g++; 73 87 } 74 88 75 89 return detectedGames; … … 92 106 SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst) 93 107 : Engine(syst) { 94 108 109 _features = detector->_game.features; 110 95 111 if (!_mixer->isReady()) 96 112 warning("Sound initialization failed"); 97 113 } … … 122 138 _mouse = new Mouse(_system, _resMan, _objectMan); 123 139 _screen = new Screen(_system, _resMan, _objectMan); 124 140 _music = new Music(_system, _mixer); 125 _sound = new Sound("", _mixer, _resMan );141 _sound = new Sound("", _mixer, _resMan, (_features & GF_DEMO) != 0); 126 142 _menu = new Menu(_screen, _mouse); 127 143 _logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer); 128 144 _mouse->useLogicAndMenu(_logic, _menu); -
sword1/sword1.h
diff -ur --exclude=CVS ScummVM/sword1/sword1.h ScummVM+hack/sword1/sword1.h
old new 29 29 30 30 namespace Sword1 { 31 31 32 enum { 33 GF_DEMO = 1 << 0 34 }; 35 32 36 class Screen; 33 37 class Sound; 34 38 class Logic; … … 61 65 virtual ~SwordEngine(); 62 66 static SystemVars _systemVars; 63 67 void reinitialize(void); 68 69 uint32 _features; 64 70 protected: 65 71 void go(); 66 72 private: