M4: Beginnings of series_player.cpp

This commit is contained in:
Paul Gilbert authored and Eugene Sandulenko committed 2023-12-24 01:53:38 +01:00
1 parent cac6e2ba35
commit 13a1d6f9fd
5 files changed
+162 -7

No files matched your search

+1 -7
View File
@@ -59,13 +59,7 @@ void Room::shutdown() {
}
void Room::init_series_players() {
#ifdef TODO
term_message("Initializing %d series_players...", MAX_SERIES_PLAYERS);
for (int i = 0; i < MAX_SERIES_PLAYERS; ++i) {
seriesPlayer_clear(&series_player[i]);
}
#endif
_G(seriesPlayers).clear();
}
} // namespace Rooms
+47
View File
@@ -0,0 +1,47 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/series_player.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
void SeriesPlayers::clear() {
term_message("Initializing %d series_players...", MAX_SERIES_PLAYERS);
for (int i = 0; i < MAX_SERIES_PLAYERS; ++i)
_players[i].clear();
}
void seriesPlayer::clear() {
break_list = nullptr;
series_machine = nullptr;
shadow_machine = nullptr;
series = -1;
shadow_series = -1;
index = -1;
name = nullptr;
in_use = false;
}
} // namespace Burger
} // namespace M4
+111
View File
@@ -0,0 +1,111 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_SERIES_PLAYER_H
#define M4_BURGER_SERIES_PLAYER_H
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"
namespace M4 {
namespace Burger {
struct seriesStreamBreak {
int32 frame = 0;
char *sound = nullptr;
int32 channel = 0;
int32 volume = 0;
int32 trigger = 0;
uint32 flags = 0;
int32 *variable = nullptr;
int32 value = 0;
};
// Used as last line of seriesStreamBreak arrays
#define SERIES_STREAM_BREAK_END -1,nullptr,0,0,NO_TRIGGER,nullptr,nullptr,nullptr
struct seriesPlayBreak {
int32 firstFrame = 0;
int32 lastFrame = 0;
char *sound = nullptr;
int32 channel = 0;
int32 volume = 0;
int32 trigger = 0;
uint32 flags = 0;
int32 loopCount = 0;
int32 *variable = nullptr;
int32 value = 0;
};
#define WITH_SHADOW 1 // Flag for seriesPlayBreak
#define PRELOAD_SOUNDS 2 // Flag for seriesPlayBreak
#define SERIES_PLAY_BREAK_END -1,-1,nullptr,0,0,NO_TRIGGER,nullptr,0,nullptr,nullptr // used as last line of seriesPlayBreak arrays
struct seriesPlayer {
seriesPlayBreak *break_list = nullptr; // Holds the list of breaks for digi plays
seriesPlayBreak current_break; // Current play break
machine *series_machine = nullptr; // Series' playback machine
machine *shadow_machine = nullptr; // Shadow series' playback machine
int32 series = 0; // Holds the series handle upon loading so it can be unloaded at the end
int32 shadow_series = 0; // Holds the series handle for the shadow
int32 index = 0; // Holds which line of the list currently waiting for a play break
char *name = nullptr; // Name of series to play
char shadow_name[80] = { 0 };
int32 framerate = 0;
int32 trigger = 0;
frac16 depth = 0;
int32 scale = 0;
int32 x = 0;
int32 y = 0;
bool with_shadow = false; // True if a shadow is to be played in unison with series
bool preload_sounds = false; // True if you want to preload and unload the sounds automatically
bool digi_trigger = false; // True if gSERIES_PLAY_BREAK trigger has come from a digi_play and not a series_play
bool in_use = false; // Stops two calls from happening at the same time
/**
* Clear the player
*/
void clear();
};
#define MAX_SERIES_PLAYERS 3
class SeriesPlayers {
private:
seriesPlayer _players[MAX_SERIES_PLAYERS];
public:
seriesPlayer &operator[](uint idx) {
assert(idx < MAX_SERIES_PLAYERS);
return _players[idx];
}
const seriesPlayer &operator[](uint idx) const {
assert(idx < MAX_SERIES_PLAYERS);
return _players[idx];
}
/**
* Clear the players
*/
void clear();
};
} // namespace Burger
} // namespace M4
#endif
+2
View File
@@ -26,6 +26,7 @@
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
namespace M4 {
@@ -52,6 +53,7 @@ public:
Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
SeriesPlayers _seriesPlayers;
Burger::Walker _walker;
int _wilburTerm = 2;
const Common::String _wilbur = "WILBUR";
+1
View File
@@ -77,6 +77,7 @@ MODULE_OBJS = \
burger/hotkeys.o \
burger/inventory.o \
burger/other.o \
burger/series_player.o \
burger/vars.o \
burger/walker.o