aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-01-23 00:15:19 +1100
committerStrangerke2012-04-06 08:20:45 +0200
commit08b3b91f0f47c5a51e2cec4d3f7ede5a0152563a (patch)
treedfcc59c9c5779cd1f5fe07f89d75121628643530 /engines
parent02f2088d43adc2514895fd845bc9dce17fd1a36b (diff)
downloadscummvm-rg350-08b3b91f0f47c5a51e2cec4d3f7ede5a0152563a.tar.gz
scummvm-rg350-08b3b91f0f47c5a51e2cec4d3f7ede5a0152563a.tar.bz2
scummvm-rg350-08b3b91f0f47c5a51e2cec4d3f7ede5a0152563a.zip
MORTEVIELLE: Converted the demus assembly code to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/module.mk1
-rw-r--r--engines/mortevielle/ovd1.cpp3
-rw-r--r--engines/mortevielle/parole.cpp3
-rw-r--r--engines/mortevielle/sound.cpp56
-rw-r--r--engines/mortevielle/sound.h37
-rw-r--r--engines/mortevielle/var_mor.cpp5
-rw-r--r--engines/mortevielle/var_mor.h3
7 files changed, 99 insertions, 9 deletions
diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk
index 327c4ba3c9..b977c25273 100644
--- a/engines/mortevielle/module.mk
+++ b/engines/mortevielle/module.mk
@@ -23,6 +23,7 @@ MODULE_OBJS := \
parole2.o \
prog.o \
ques.o \
+ sound.o \
sprint.o \
taffich.o \
var_mor.o
diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp
index 283756948c..3c23a62b28 100644
--- a/engines/mortevielle/ovd1.cpp
+++ b/engines/mortevielle/ovd1.cpp
@@ -36,6 +36,7 @@
#include "mortevielle/outtext.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/parole.h"
+#include "mortevielle/sound.h"
#include "mortevielle/sprint.h"
#include "mortevielle/taffich.h"
#include "mortevielle/var_mor.h"
@@ -338,7 +339,7 @@ void ani50() {
fic.read(&mem[0x47a0 * 16 + 0], 123);
fic.close();
- demus(0x3800, 0x5000, 623);
+ demus(&mem[0x3800 * 16], &mem[0x5000 * 16], 623);
addfix = (float)((tempo_mus - addv[1])) / 256;
cctable(tbi);
diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp
index 76d6c9a177..768b021454 100644
--- a/engines/mortevielle/parole.cpp
+++ b/engines/mortevielle/parole.cpp
@@ -27,6 +27,7 @@
#include "common/file.h"
#include "mortevielle/parole.h"
+#include "mortevielle/sound.h"
namespace Mortevielle {
@@ -128,7 +129,7 @@ void veracf(byte b) {
f.read(&mem[0x7414 * 16 + 0], 273);
/*blockread(f,mem[adson * 16+0],300);
blockread(f,mem[adson * 16+2400+0],245);*/
- demus(0x7414, adson, 273);
+ demus(&mem[0x7414 * 16], &mem[adson * 16], 273);
f.close();
}
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp
new file mode 100644
index 0000000000..f2b70cf8ee
--- /dev/null
+++ b/engines/mortevielle/sound.cpp
@@ -0,0 +1,56 @@
+/* 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.
+ *
+ */
+
+/*
+ * This code is based on original Mortville Manor DOS source code
+ * Copyright (c) 1988-1989 Lankhor
+ */
+
+#include "common/scummsys.h"
+#include "mortevielle/sound.h"
+
+namespace Mortevielle {
+
+const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 };
+
+/**
+ * Decode music data
+ */
+void demus(const byte *PSrc, byte *PDest, int NbreSeg) {
+ int seed = 128;
+ int v;
+
+ for (int idx1 = 0; idx1 < (NbreSeg * 2); ++idx1) {
+ for (int idx2 = 0; idx2 < 64; ++idx2) {
+ byte srcByte = *PSrc++;
+ v = tab[srcByte >> 4];
+ seed += v;
+ *PDest++ = seed & 0xff;
+
+ v = tab[srcByte & 0xf];
+ seed += v;
+ *PDest++ = seed & 0xff;
+ }
+ }
+}
+
+} // End of namespace Mortevielle
diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h
new file mode 100644
index 0000000000..6e4f7b2a4d
--- /dev/null
+++ b/engines/mortevielle/sound.h
@@ -0,0 +1,37 @@
+/* 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.
+ *
+ */
+
+/*
+ * This code is based on original Mortville Manor DOS source code
+ * Copyright (c) 1988-1989 Lankhor
+ */
+
+#ifndef MORTEVIELLE_SOUND_H
+#define MORTEVIELLE_SOUND_H
+
+namespace Mortevielle {
+
+extern void demus(const byte *PSrc, byte *PDest, int NbreSeg);
+
+} // End of namespace Mortevielle
+
+#endif
diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp
index 34dc742144..38a374e82b 100644
--- a/engines/mortevielle/var_mor.cpp
+++ b/engines/mortevielle/var_mor.cpp
@@ -359,11 +359,6 @@ void musyc(tablint &tb, int nbseg, int att) {
warning("TODO: musyc");
}
-// (* external 'c:\mc\demus.com'; *)
-void demus(int Src, int Dst, int Tay) {
- warning("TODO: demus");
-}
-
// (* external 'c:\mc\phint.com'; *)
void litph(tablint &t, int typ, int tempo) {
warning("TODO: litph");
diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h
index 642ecefb2b..b8a18a1253 100644
--- a/engines/mortevielle/var_mor.h
+++ b/engines/mortevielle/var_mor.h
@@ -50,6 +50,7 @@ namespace Mortevielle {
*
* Address
* -------
+ * 5000:0 - Music data
* 6000:0 - Decompressed current image
* 7000:0+ - Compressed images
* 7000:2 - 16 words representing palette map
@@ -455,8 +456,6 @@ extern void decomp(int seg, int dep);
extern void afff(int Gd, int seg, int dep, int x, int y);
// (* external 'c:\mc\reusint.com'; *)
extern void musyc(tablint &tb, int nbseg, int att);
-// (* external 'c:\mc\demus.com'; *)
-extern void demus(int Src, int Dst, int Tay);
// (* external 'c:\mc\phint.com'; *)
extern void litph(tablint &t, int typ, int tempo);