[Scummvm-git-logs] scummvm master -> 045955ddb60980fe49fb20e2182d112d4833b8d6
sev-
sev at scummvm.org
Fri Jul 2 14:35:39 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
045955ddb6 SAGA2: Move Deejay to beegee.h
Commit: 045955ddb60980fe49fb20e2182d112d4833b8d6
https://github.com/scummvm/scummvm/commit/045955ddb60980fe49fb20e2182d112d4833b8d6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-02T16:35:14+02:00
Commit Message:
SAGA2: Move Deejay to beegee.h
Changed paths:
R engines/saga2/music.h
engines/saga2/beegee.cpp
engines/saga2/beegee.h
diff --git a/engines/saga2/beegee.cpp b/engines/saga2/beegee.cpp
index ade533f1d1..dd781bc4d6 100644
--- a/engines/saga2/beegee.cpp
+++ b/engines/saga2/beegee.cpp
@@ -27,7 +27,7 @@
#include "saga2/saga2.h"
#include "saga2/idtypes.h"
#include "saga2/tile.h"
-#include "saga2/music.h"
+#include "saga2/beegee.h"
#include "saga2/player.h"
#include "saga2/audtweak.h"
diff --git a/engines/saga2/beegee.h b/engines/saga2/beegee.h
index b4cf48bc46..72296daa25 100644
--- a/engines/saga2/beegee.h
+++ b/engines/saga2/beegee.h
@@ -65,6 +65,64 @@ private:
void playIntermittent(int soundNo);
};
+const int16 NoEnemy = -1;
+const int16 MaxThemes = 16;
+const uint32 FarAway = 250;
+
+/* ===================================================================== *
+ Types
+ * ===================================================================== */
+
+//-----------------------------------------------------------------------
+// Music selection brain
+
+class Deejay {
+private:
+ int enemy;
+ bool aggr;
+ bool day;
+ bool ugd;
+ bool susp;
+
+ static int current;
+ static int currentID;
+
+public:
+ Deejay() {
+ enemy = -1;
+ aggr = false;
+ day = true;
+ susp = false;
+ ugd = false;
+ }
+ ~Deejay() {}
+
+private:
+ void select(void);
+
+public:
+ void setEnemy(int16 enemyType = -1) {
+ enemy = enemyType;
+ select();
+ }
+ void setAggression(bool aggressive) {
+ aggr = aggressive;
+ select();
+ }
+ void setDaytime(bool daytime) {
+ day = daytime;
+ select();
+ }
+ void setSuspend(bool suspended) {
+ susp = suspended;
+ select();
+ }
+ void setWorld(bool underground) {
+ ugd = underground;
+ select();
+ }
+};
+
} // end of namespace Saga2
#endif
diff --git a/engines/saga2/music.h b/engines/saga2/music.h
deleted file mode 100644
index d9ee226bf7..0000000000
--- a/engines/saga2/music.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* 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.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#ifndef SAGA2_MUSIC_H
-#define SAGA2_MUSIC_H
-
-namespace Saga2 {
-
-const int16 NoEnemy = -1;
-const int16 MaxThemes = 16;
-const uint32 FarAway = 250;
-
-/* ===================================================================== *
- Types
- * ===================================================================== */
-
-//-----------------------------------------------------------------------
-// Music selection brain
-
-class Deejay {
-private:
- int enemy;
- bool aggr;
- bool day;
- bool ugd;
- bool susp;
-
- static int current;
- static int currentID;
-
-public:
- Deejay() {
- enemy = -1;
- aggr = false;
- day = true;
- susp = false;
- ugd = false;
- }
- ~Deejay() {}
-
-private:
- void select(void);
-
-public:
- void setEnemy(int16 enemyType = -1) {
- enemy = enemyType;
- select();
- }
- void setAggression(bool aggressive) {
- aggr = aggressive;
- select();
- }
- void setDaytime(bool daytime) {
- day = daytime;
- select();
- }
- void setSuspend(bool suspended) {
- susp = suspended;
- select();
- }
- void setWorld(bool underground) {
- ugd = underground;
- select();
- }
-};
-
-//-----------------------------------------------------------------------
-// General environmental audio selection brain
-
-typedef uint32 themeFrame;
-typedef uint16 ThemeID;
-
-inline ThemeID theme(themeFrame tf) {
- return tf & 0x0000FFFF;
-}
-
-inline TilePoint metaTileOffset(themeFrame tf) {
- TilePoint tp = TilePoint(0, 0, 0);
- tp.u = (tf & 0xFF000000) >> 24;
- tp.v = (tf & 0x00FF0000) >> 16;
- return tp;
-}
-
-inline TilePoint coordsInMetaTile(TilePoint tp) {
- return TilePoint(tp.u % kPlatShift, tp.v % kPlatShift, 0);
-}
-
-
-
-
-struct AudioSurroundings {
- int16 distance;
- int16 counts[MaxThemes];
- TilePoint avgDir[MaxThemes];
-
- void clear(void) {
- distance = FarAway;
- for (int i = 0; i < MaxThemes; i++) {
- counts[i] = 0;
- avgDir[i] = TilePoint(0, 0, 0);
- }
- }
-
- void addIn(int16 theme, TilePoint where) {
- avgDir[theme] = (avgDir[theme] * counts[theme]) + where;
- counts[theme]++;
- avgDir[theme] = avgDir[theme] / counts[theme];
- }
-
- int16 strongest(void) {
- int16 str = 0;
- int16 cnt = 0;
- for (int i = 1; i < MaxThemes; i++) {
- if (counts[i] > cnt) {
- str = i;
- cnt = counts[i];
- }
- }
- return str;
- }
-
- int16 relativeStrength(int16 theme) {
- int16 rs = counts[theme];
- for (int i = 1; i < MaxThemes; i++) {
- if (i != theme)
- rs -= counts[i];
- }
- return rs;
- }
-
-};
-
-} // end of namespace Saga2
-
-#endif
More information about the Scummvm-git-logs
mailing list