Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
/* 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/adv_r/conv_io.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
void conv_play_curr() {
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
conv_play(conv_get_handle());
}
void conv_resume_curr() {
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
conv_resume(conv_get_handle());
}
} // namespace Burger
} // namespace M4

View File

@@ -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 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_CORE_CONV_H
#define M4_BURGER_CORE_CONV_H
#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
void conv_play_curr();
void conv_resume_curr();
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,218 @@
/* 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/core/play_break.h"
#include "m4/platform/sound/digi.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
static void set_next_series_play_break(int32 slot) {
seriesPlayer *player = &_G(seriesPlayers)[slot];
player->current_break = player->break_list[player->index]; // Grab the info from the list
player->digi_trigger = false; // Assume for now gSERIES_PLAY_BREAK trigger will come from series_ play not digi_play
while (player->current_break.firstFrame >= 0) {
// If there is a positive frame to play from (or to in the case of SERIES_BACKWARDS)
// if variable is null or variable = value then this break is valid
if ((!player->current_break.variable) || (*(player->current_break.variable) == player->current_break.value)) {
// Are the first and last frame numbers backwards?
if ((player->current_break.lastFrame != -1) && (player->current_break.firstFrame > player->current_break.lastFrame)) {
player->current_break.flags = player->current_break.flags | SERIES_BACKWARD; // make sure SERIES_BACKWARD is in flags
const int32 temp = player->current_break.firstFrame; // switch the first and last frame numbers
player->current_break.firstFrame = player->current_break.lastFrame;
player->current_break.lastFrame = temp;
}
if (player->current_break.flags & DIGI_STOP) {
// Should we do a digi_stop?
digi_stop(player->current_break.channel);
}
// Is there is a sound to play?
if (player->current_break.sound) {
// Should it be looped?
if (player->current_break.flags & DIGI_LOOP) {
digi_play_loop(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
} else {
// There is a sound to play and it is not looping (finite)
if (_G(seriesPlayers)[slot].current_break.loopCount == -1) { // Check if series is to loop as long as sound plays (loopCount = -1)
_G(seriesPlayers)[slot].digi_trigger = true; // Remember that the gSERIES_PLAY_BREAK will be a sound trigger
digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, kSERIES_PLAY_BREAK_0 + slot);
} else {
// Use the play break trigger
digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
}
}
} else {
// No sound to play so see if there is a trigger to dispatch
if (player->current_break.trigger != NO_TRIGGER) {
kernel_trigger_dispatchx(kernel_trigger_create(player->current_break.trigger));
}
}
// Play the series
if (player->digi_trigger) {
// Don't ask for the gSERIES_PLAY_BREAK trigger
player->series_machine = series_play(player->name, player->depth, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
} else { // ask for the gSERIES_PLAY_BREAK trigger
player->series_machine = series_play(player->name, player->depth, player->current_break.flags, (int16)slot + kSERIES_PLAY_BREAK_0,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
}
// play the shadow series if necessary
if (player->with_shadow) {
player->shadow_machine = series_play(player->shadow_name, player->depth + 1, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
}
++player->index; // set up index to the next break in list
break; // we have handled a break so don't look any farther
} else { // variable didn't equate to value so keep looking
++player->index; // go to the next break in list
player->current_break = player->break_list[player->index]; // grab the info from the list
}
}
if (player->current_break.firstFrame < 0) {
// There were no more breaks, so unload series/sounds and send off trigger
player->in_use = false;
series_unload(player->series);
if (player->with_shadow)
series_unload(player->shadow_series);
if (player->preload_sounds)
digi_unload_play_breaks(player->break_list);
kernel_trigger_dispatchx(player->trigger);
}
}
void handle_series_play_break(int32 slot) {
seriesPlayer *player = &_G(seriesPlayers)[slot];
if (player->digi_trigger) { // if this was caused by a digi_trigger
kernel_terminate_machine(player->series_machine);
if (player->with_shadow) {
kernel_terminate_machine(player->shadow_machine);
}
}
set_next_series_play_break(slot);
}
int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name, frac16 depth, int32 trigger, uint32 flags,
int32 framerate, int32 scale, int32 x, int32 y) {
int32 slot;
// look for a free player slot (MAX_SERIES_PLAYERS)
for (slot = 0; slot < MAX_SERIES_PLAYERS; ++slot) {
if (!(_G(seriesPlayers)[slot].in_use))
break;
}
if (slot >= MAX_SERIES_PLAYERS) {
// No free slots
term_message("**** all seriesPlayers are in use!");
return -1;
}
seriesPlayer *player = &_G(seriesPlayers)[slot];
player->in_use = true;
player->index = 0;
player->break_list = list;
player->name = name;
player->depth = depth;
player->trigger = kernel_trigger_create(trigger);
player->framerate = framerate;
player->scale = scale;
player->x = x;
player->y = y;
player->with_shadow = (bool)(flags & WITH_SHADOW);
player->preload_sounds = (bool)(flags & PRELOAD_SOUNDS);
player->series = series_load(name, -1, nullptr); // load sprite series
// Check if shadow sprites should be loaded
if (player->with_shadow) {
// Make shadow name by adding an "s" to the series name
Common::strcpy_s(player->shadow_name, name);
Common::strcat_s(player->shadow_name, "s\0");
player->shadow_series = series_load(player->shadow_name, -1, nullptr);
} else {
player->shadow_name[0] = '\0';
}
if (player->preload_sounds) { // check if sounds are to be preloaded
digi_preload_play_breaks(list);
}
set_next_series_play_break(slot);
term_message("series_play_with_breaks:%s shadow:%s preload_sounds:%d slot:%d",
player->name, player->shadow_name, player->preload_sounds, slot);
return slot;
}
void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll) {
int32 i = 0;
// While there is a legitimate frame to break on
while (list[i].firstFrame >= 0) {
// If variable is null or variable = value then this break is used
if ((!list[i].variable) || (*(list[i].variable) == list[i].value) || loadAll) {
// If there is a sound to load for this break
if (list[i].sound) {
if (!digi_preload(list[i].sound)) {
term_message("**** Couldn't load: %s.RAW", list[i].sound);
}
}
}
++i; // Next in list please
}
}
void digi_unload_play_breaks(const seriesPlayBreak list[]) {
int32 i = 0;
while (list[i].firstFrame >= 0) {
// If there is a sound to unload
if (list[i].sound) {
digi_unload(list[i].sound); // Unload it
}
++i; // Next in list please
}
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,62 @@
/* 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_PLAY_BREAK_H
#define M4_BURGER_PLAY_BREAK_H
#include "m4/m4_types.h"
#include "m4/adv_r/adv_trigger.h"
namespace M4 {
namespace Burger {
struct seriesPlayBreak {
int32 firstFrame;
int32 lastFrame;
const char *sound;
int32 channel;
int32 volume;
int32 trigger;
uint32 flags;
int32 loopCount;
int32 *variable;
int32 value;
};
enum {
WITH_SHADOW = 1,
PRELOAD_SOUNDS = 2
};
#define PLAY_BREAK_END { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name,
frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 6,
int32 scale = 100, int32 x = 0, int32 y = 0);
void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll = false);
void digi_unload_play_breaks(const seriesPlayBreak list[]);
void handle_series_play_break(int32 slot);
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,65 @@
/* 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/core/release_trigger.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
#define _GT(X) _G(releaseTrigger)._##X
void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue) {
_GT(released_digi_trigger) = kernel_trigger_create(trigger);
_GT(check_channels) = checkChannels;
_GT(match_value) = matchValue;
const KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_trigger_dispatch_now(kRELEASE_TRIGGER_DIGI_CHECK);
_G(kernel).trigger_mode = oldMode;
}
void release_trigger_digi_check() {
uint32 digi_state = 0;
// Set channel bits in digi_state that a sound is presently busy in each channel
for (uint32 i = 0; i < 3; ++i) {
if (digi_play_state(i + 1)) // Check if a sound is playing
digi_state |= (1 << i); // Set the bit that corresponds with this channel
}
term_message("%d %d %d", digi_state, _GT(check_channels), _GT(match_value));
// AND this with the channels we care about
digi_state &= _GT(check_channels);
term_message(" %d %d %d", digi_state, _GT(check_channels), _GT(match_value));
// Compare this with the match values
if (digi_state == _GT(match_value)) {
kernel_trigger_dispatchx(_GT(released_digi_trigger));
} else {
kernel_timing_trigger(TENTH_SECOND, kRELEASE_TRIGGER_DIGI_CHECK);
}
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,42 @@
/* 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_CORE_RELEASE_TRIGGER_H
#define M4_BURGER_CORE_RELEASE_TRIGGER_H
#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
struct ReleaseTrigger_Globals {
uint32 _released_digi_trigger = 0;
uint32 _check_channels = 0, _match_value = 0;
};
void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue = 0);
void release_trigger_digi_check();
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,144 @@
/* 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/core/stream_break.h"
#include "m4/platform/sound/digi.h"
#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
#define _GB(X) _G(streamBreak)._##X
static void set_next_series_stream_break() {
_GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
// While there is a positive frame to break on...
while (_GB(my_stream_break)->frame >= 0) {
// If variable is null or variable = value then this break is used
// Note: if Variable != value this break is skipped
if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) {
series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, kSERIES_STREAM_BREAK);
break;
}
// Go to the next break in list
++_GB(my_stream_break_index);
_GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
}
void handle_series_stream_break() {
int32 thisFrame = _GB(my_stream_break)->frame;
auto &streamBreak = _GB(my_stream_break);
// Handle all breaks for this frame number (only one series break can occur on each frame)
// There can be any number of things to do once we've broken on a particular frame.
while (thisFrame == streamBreak->frame) {
// If there is a variable check if equal value
if ((!streamBreak->variable) || (*(streamBreak->variable) == streamBreak->value)) {
// Should we do a digi_stop?
if (streamBreak->flags & DIGI_STOP) {
digi_stop(streamBreak->channel);
}
// Is there is a sound to play?
if (streamBreak->sound) {
// Should it be looped?
if (streamBreak->flags & DIGI_LOOP) {
digi_play_loop(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
} else {
digi_play(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
}
} else {
// No sound to play
// See if it's a volume channel
if (streamBreak->channel)
digi_change_volume(streamBreak->channel, streamBreak->volume);
// Is there is a trigger to dispatch
if (streamBreak->trigger != NO_TRIGGER) {
kernel_trigger_dispatchx(kernel_trigger_create(streamBreak->trigger));
}
}
}
// Go to next break in list
++_GB(my_stream_break_index);
streamBreak = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
// If we aren't at end of list yet, set up next stream break
if (streamBreak->frame >= 0)
set_next_series_stream_break();
}
machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger) {
_GB(my_stream_break_index) = 0;
_GB(my_stream_break_list) = list;
_GB(my_stream_viewer) = series_stream(name, framerate, depth, trigger);
set_next_series_stream_break();
return _GB(my_stream_viewer);
}
void digi_preload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
// While there is a legitimate frame to break on
while (list[i].frame >= 0) {
// If variable is null or variable = value then this break is used
if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
// Is there is a sound to load for this break
if (list[i].sound) {
digi_read_another_chunk();
// Load the sound
if (!digi_preload(list[i].sound)) {
term_message("Preload stream breaks failed: %s", list[i].sound);
}
}
}
++i; // Next in list please
}
}
void digi_unload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
while (list[i].frame >= 0) {
// Unload any sounds
if (list[i].sound)
digi_unload(list[i].sound);
++i;
}
}
void palette_prep_for_stream() {
gr_pal_clear(&_G(master_palette)[0]); // Clear out colours in palette
pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to zero percent instantly (0 ticks)
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,69 @@
/* 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_STREAM_BREAK_H
#define M4_BURGER_STREAM_BREAK_H
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"
namespace M4 {
namespace Burger {
struct seriesStreamBreak {
int32 frame;
const char *sound;
int32 channel;
int32 volume;
int32 trigger;
uint32 flags;
const int32 *variable;
int32 value;
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
// Flags for series_stream_with_breaks and series_play_with_breaks
#define DIGI_LOOP 1024 // these must be more than the series play flags
#define DIGI_STOP 2048
struct StreamBreak_Globals {
int32 _my_stream_break_index = 0; // Holds which line of the list currently waiting for a stream break
const seriesStreamBreak *_my_stream_break_list = nullptr; // Holds the list of breaks for digi plays
const seriesStreamBreak *_my_stream_break = nullptr;
machine *_my_stream_viewer = nullptr;
};
machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger);
void digi_preload_stream_breaks(const seriesStreamBreak list[]);
void digi_unload_stream_breaks(const seriesStreamBreak list[]);
void handle_series_stream_break();
/**
* Palette_prep_for_stream is called just before series_stream() for a full screen animation.
* It clears the palette, (debug: sets ui colors) and sets up a palette fade up from 0%
*/
void palette_prep_for_stream();
} // namespace Burger
} // namespace M4
#endif