[Scummvm-cvs-logs] scummvm master -> 7bbe1a94c10f8e8f79e25434157469b39db8cc35

sev- sev at scummvm.org
Tue Feb 16 21:43:50 CET 2016


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a1e5c5a8cc WAGE: Moved sound code stubs to sound.cpp
57449d32d4 WAGE: Moved Sound class definition to sound.h
7bbe1a94c1 WAGE: Implement sound decoder


Commit: a1e5c5a8cc7ec04fd08a0b6af60c6399a33d326a
    https://github.com/scummvm/scummvm/commit/a1e5c5a8cc7ec04fd08a0b6af60c6399a33d326a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T21:41:41+01:00

Commit Message:
WAGE: Moved sound code stubs to sound.cpp

Changed paths:
  A engines/wage/sound.cpp
    engines/wage/module.mk
    engines/wage/wage.cpp



diff --git a/engines/wage/module.mk b/engines/wage/module.mk
index f91e841..548e440 100644
--- a/engines/wage/module.mk
+++ b/engines/wage/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
 	menu.o \
 	randomhat.o \
 	script.o \
+	sound.o \
 	util.o \
 	wage.o \
 	world.o
diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
new file mode 100644
index 0000000..0035550
--- /dev/null
+++ b/engines/wage/sound.cpp
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * MIT License:
+ *
+ * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "wage/wage.h"
+
+namespace Wage {
+
+void WageEngine::playSound(Common::String soundName) {
+	warning("STUB: WageEngine::playSound(%s)", soundName.c_str());
+}
+
+void WageEngine::updateSoundTimerForScene(Scene *scene, bool firstTime) {
+	//warning("STUB: WageEngine::updateSoundTimerForScene()");
+}
+
+
+} // End of namespace Wage
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 90aad2f..0a68ce4 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -189,10 +189,6 @@ void WageEngine::processEvents() {
 	}
 }
 
-void WageEngine::playSound(Common::String soundName) {
-	warning("STUB: WageEngine::playSound(%s)", soundName.c_str());
-}
-
 void WageEngine::setMenu(Common::String menu) {
 	_world->_commandsMenu = menu;
 
@@ -383,10 +379,6 @@ void WageEngine::redrawScene() {
 	}
 }
 
-void WageEngine::updateSoundTimerForScene(Scene *scene, bool firstTime) {
-	//warning("STUB: WageEngine::updateSoundTimerForScene()");
-}
-
 void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickInput) {
 	Scene *playerScene = _world->_player->_currentScene;
 	if (playerScene == _world->_storageScene)


Commit: 57449d32d423f8bd3ea57b306c2a4dcdae4843f1
    https://github.com/scummvm/scummvm/commit/57449d32d423f8bd3ea57b306c2a4dcdae4843f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T21:41:41+01:00

Commit Message:
WAGE: Moved Sound class definition to sound.h

Changed paths:
  A engines/wage/sound.h
    engines/wage/entities.h
    engines/wage/world.cpp
    engines/wage/world.h



diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 0f5016e..3010c8a 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -331,15 +331,6 @@ public:
 	const char *getFontName();
 };
 
-class Sound {
-public:
-	Sound(Common::String name, Common::SeekableReadStream *data) : _name(name), _data(data) {}
-	~Sound() { }
-
-	Common::String _name;
-	Common::SeekableReadStream *_data;
-};
-
 } // End of namespace Wage
 
 #endif
diff --git a/engines/wage/sound.h b/engines/wage/sound.h
new file mode 100644
index 0000000..76d9202
--- /dev/null
+++ b/engines/wage/sound.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * MIT License:
+ *
+ * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef WAGE_SOUND_H
+#define WAGE_SOUND_H
+
+namespace Wage {
+
+class Sound {
+public:
+	Sound(Common::String name, Common::SeekableReadStream *data) : _name(name), _data(data) {}
+	~Sound() { }
+
+	Common::String _name;
+	Common::SeekableReadStream *_data;
+};
+
+} // End of namespace Wage
+
+#endif
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index a387d95..cb6e806 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -50,6 +50,7 @@
 #include "wage/wage.h"
 #include "wage/entities.h"
 #include "wage/script.h"
+#include "wage/sound.h"
 #include "wage/world.h"
 
 namespace Wage {
@@ -296,6 +297,13 @@ bool World::loadWorld(Common::MacResManager *resMan) {
 	return true;
 }
 
+void World::addSound(Sound *sound) {
+	Common::String s = sound->_name;
+	s.toLowercase();
+	_sounds[s] = sound;
+	_orderedSounds.push_back(sound);
+}
+
 Common::StringArray *World::readMenu(Common::SeekableReadStream *res) {
 	res->skip(10);
 	int enableFlags = res->readUint32BE();
diff --git a/engines/wage/world.h b/engines/wage/world.h
index 1416fc3..e904113 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -52,6 +52,8 @@ namespace Wage {
 
 #define STORAGESCENE "STORAGE@"
 
+class Sound;
+
 class World {
 public:
 	World(WageEngine *engine);
@@ -125,12 +127,7 @@ public:
 		_orderedChrs.push_back(chr);
 	}
 
-	void addSound(Sound *sound) {
-		Common::String s = sound->_name;
-		s.toLowercase();
-		_sounds[s] = sound;
-		_orderedSounds.push_back(sound);
-	}
+	void addSound(Sound *sound);
 
 private:
 	Common::StringArray *readMenu(Common::SeekableReadStream *res);


Commit: 7bbe1a94c10f8e8f79e25434157469b39db8cc35
    https://github.com/scummvm/scummvm/commit/7bbe1a94c10f8e8f79e25434157469b39db8cc35
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-02-16T21:41:41+01:00

Commit Message:
WAGE: Implement sound decoder

Changed paths:
    engines/wage/sound.cpp
    engines/wage/sound.h



diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 0035550..bcb274c 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -45,10 +45,35 @@
  *
  */
 
+#include "common/stream.h"
+
 #include "wage/wage.h"
+#include "wage/sound.h"
 
 namespace Wage {
 
+static const int8 deltas[] = { 0,-49,-36,-25,-16,-9,-4,-1,0,1,4,9,16,25,36,49 };
+
+Sound::Sound(Common::String name, Common::SeekableReadStream *data) : _name(name) {
+	int size = data->size() - 20;
+	_data = (byte *)calloc(2 * size, 1);
+
+	data->skip(20); // Skip header
+
+	byte value = 0x80;
+	for (int i = 0; i < size; i++) {
+		byte d = data->readByte();
+		value += deltas[d & 0xf];
+		_data[i * 2] = value;
+		value += deltas[(d >> 4) & 0xf];
+		_data[i * 2 + 1] = value;
+	}
+}
+
+Sound::~Sound() {
+	free(_data);
+}
+
 void WageEngine::playSound(Common::String soundName) {
 	warning("STUB: WageEngine::playSound(%s)", soundName.c_str());
 }
diff --git a/engines/wage/sound.h b/engines/wage/sound.h
index 76d9202..eccfe33 100644
--- a/engines/wage/sound.h
+++ b/engines/wage/sound.h
@@ -52,11 +52,11 @@ namespace Wage {
 
 class Sound {
 public:
-	Sound(Common::String name, Common::SeekableReadStream *data) : _name(name), _data(data) {}
-	~Sound() { }
+	Sound(Common::String name, Common::SeekableReadStream *data);
+	~Sound();
 
 	Common::String _name;
-	Common::SeekableReadStream *_data;
+	byte *_data;
 };
 
 } // End of namespace Wage






More information about the Scummvm-git-logs mailing list