aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README1
-rw-r--r--sky/cd_intro.cpp230
-rw-r--r--sky/disk.cpp13
-rw-r--r--sky/intro.cpp43
-rw-r--r--sky/module.mk2
-rw-r--r--sky/screen.cpp91
-rw-r--r--sky/sky.cpp11
-rw-r--r--sky/sky.h16
-rw-r--r--sky/sound.cpp43
-rw-r--r--sky/sound.h43
10 files changed, 487 insertions, 6 deletions
diff --git a/README b/README
index 12103d7fa3..da140e0466 100644
--- a/README
+++ b/README
@@ -653,6 +653,7 @@ Credits:
Peter Moraliyski - GP32 port
Nicolas Noble - Config file and ALSA support
Lionel Ulmer - X11 backend
+ Joost Peters - Beneath a Steel Sky support
Contributors:
Janne Huttunen - V3 actor mask support, Dig/FT SMUSH audio
diff --git a/sky/cd_intro.cpp b/sky/cd_intro.cpp
new file mode 100644
index 0000000000..a9f8f61b65
--- /dev/null
+++ b/sky/cd_intro.cpp
@@ -0,0 +1,230 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "sky/sky.h"
+#include "sky/skydefs.h"
+
+//CD intro file defines
+#define cdv_00 59500
+#define cd_pal 59501
+#define cd_1_log 59502
+#define cd_1 59503
+#define cdv_01 59504
+#define cdv_02 59505
+#define cd_2 59506
+#define cdv_03 59507
+#define cdv_04 59508
+#define cd_3 59509
+#define cdv_05 59510
+#define cdv_06 59511
+#define cd_5 59512
+#define cdv_07 59513
+#define cdv_08 59514
+#define cdv_09 59515
+#define cd_7 59516
+#define cdv_10 59518
+#define cd_11 59519
+#define cdv_11 59520
+#define cd_11_pal 59521
+#define cd_11_log 59522
+#define cdv_12 59523
+#define cd_13 59524
+#define cdv_13 59525
+#define cdv_14 59527
+#define cdv_15 59528
+#define cd_15_pal 59529
+#define cd_15_log 59530
+#define cdv_16 59531
+#define cd_17_log 59532
+#define cd_17 59533
+#define cdv_17 59534
+#define cdv_18 59535
+#define cdv_19 59536
+#define cd_19_pal 59537
+#define cd_19_log 59538
+#define cdv_20 59539
+#define cd_20_log 59540
+#define cdv_21 59541
+#define cd_21_log 59542
+#define cdv_22 59545
+#define cdv_23 59546
+#define cd_23_pal 59547
+#define cd_24_log 59550
+#define cdv_24 59551
+#define cdv_25 59554
+#define cdv_26 59556
+#define cd_27 59557
+#define cdv_27 59558
+#define cd_27_pal 59559
+#define cd_27_log 59560
+#define cdv_28 59561
+#define cdv_29 59562
+#define cdv_30 59563
+#define cdv_31 59565
+#define cdv_32 59566
+#define cdv_33 59567
+#define cdv_34 59568
+#define cd_35 59569
+#define cdv_35 59570
+#define cd_35_pal 59571
+#define cd_35_log 59572
+#define cdv_36 59574
+#define cd_37 59575
+#define cdv_37 59576
+#define cd_37_pal 59577
+#define cd_37_log 59578
+#define cdv_38 59579
+#define cdv_39 59581
+#define cdv_40 59583
+#define cd_40_pal 59584
+#define cd_40_log 59585
+#define cdv_41 59587
+#define cdv_42 59588
+#define cd_43 59589
+#define cdv_43 59590
+#define cd_43_pal 59591
+#define cd_43_log 59592
+#define cdv_44 59594
+#define cd_45 59595
+#define cdv_45 59596
+#define cd_45_pal 59597
+#define cd_45_log 59598
+#define cdv_46 59600
+#define cdv_47 59602
+#define cd_47_pal 59603
+#define cd_47_log 59604
+#define cd_48 59605
+#define cdv_48 59606
+#define cd_48_pal 59607
+#define cd_48_log 59608
+#define cd_49 59609
+#define cdv_49 59610
+#define cd_50 59611
+#define cdv_50 59612
+#define cdv_51 59613
+#define cdv_52 59614
+#define cdv_53 59615
+#define cdv_54 59616
+#define cdv_55 59618
+#define cd_55_pal 59619
+#define cd_55_log 59620
+#define cdv_56 59621
+#define cdv_57 59622
+#define cd_58 59623
+#define cdv_58 59624
+#define cd_58_pal 59625
+#define cd_58_log 59626
+#define cdv_59 59627
+#define cdv_60 59628
+#define cdv_61 59629
+#define cdv_62 59630
+#define cdv_63 59631
+#define cdv_64 59632
+#define cdv_65 59633
+#define cdv_66 59635
+#define cd_66_pal 59636
+#define cd_66_log 59637
+#define cdv_67 59639
+#define cd_67_pal 59640
+#define cd_67_log 59641
+#define cdv_68 59642
+#define cd_69 59643
+#define cdv_69 59644
+#define cd_69_pal 59645
+#define cd_69_log 59646
+#define cdv_70 59647
+#define cdv_71 59648
+#define cdv_72 59649
+#define cd_72_pal 59650
+#define cd_72_log 59651
+#define cd_73_pal 59652
+#define cd_73_log 59653
+#define cdv_73 59654
+#define cdv_74 59655
+#define cdv_75 59656
+#define cd_76_pal 59657
+#define cd_76_log 59658
+#define cdv_76 59659
+#define cdv_77 59660
+#define cd_78_pal 59661
+#define cd_78_log 59662
+#define cdv_78 59663
+#define cdv_79 59664
+#define cdv_80 59665
+#define cdv_81 59666
+#define cdv_82 59667
+#define cdv_83 59668
+#define cdv_84 59669
+#define cdv_85 59670
+#define cdv_86 59671
+#define cdv_87 59672
+#define cd_100 60087
+#define cd_101_log 60088
+#define cd_101 60099
+#define cd_102_log 60090
+#define cd_102 60091
+#define cd_103_pal 60092
+#define cd_103_log 60093
+#define cd_103 60094
+#define cd_104_pal 60095
+#define cd_104_log 60096
+#define cd_104 60097
+#define cd_105 60098
+
+
+void SkyState::doCDIntro() {
+
+ uint32 loadedVocSize, bgVocSize;
+ byte *vocBuffer, *bgVocBuffer, *cd2_seq_data_1;
+
+ vocBuffer = (byte *)loadFile(cdv_00, NULL);
+ loadedVocSize = _lastLoadedFileSize;
+
+ _tempPal = (byte *)loadFile(cd_pal, NULL);
+ _workScreen = (byte *)loadFile(cd_1_log, NULL);
+
+ cd2_seq_data_1 = (byte *)loadFile(cd_1, NULL);
+ bgVocBuffer = (byte *)loadFile(59499, NULL);
+ bgVocSize = _lastLoadedFileSize;
+
+ delay(2000); //keep gibbons screen up for 2 seconds
+ fn_fade_down(0); //and fade out
+
+ _sound->playVoice(vocBuffer, loadedVocSize);
+ _sound->playVoice(bgVocBuffer, bgVocSize);
+ free (vocBuffer);
+
+ vocBuffer = (byte *)loadFile(cdv_01, NULL);
+ loadedVocSize = _lastLoadedFileSize;
+
+ //waitForVoc(0);
+ delay(5500); //hack!
+
+ _sound->playVoice(vocBuffer, loadedVocSize);
+ _sound->playVoice(bgVocBuffer, bgVocSize);
+ free (vocBuffer);
+
+ showScreen();
+ paletteFadeUp(_tempPal);
+}
+
+
diff --git a/sky/disk.cpp b/sky/disk.cpp
index ec496f3cdb..876afb2194 100644
--- a/sky/disk.cpp
+++ b/sky/disk.cpp
@@ -52,6 +52,11 @@ void SkyState::initialiseDisk() {
debug(1, "Entries in dinner table: %d", dinnerTableEntries);
+ if (dinnerTableEntries < 400)
+ _isDemo = true;
+ else
+ _isDemo = false;
+
if (dinnerTableEntries > 1600)
_isCDVersion = true;
else
@@ -92,7 +97,8 @@ uint16 *SkyState::loadFile(uint16 fileNr, uint8 *dest) {
fileFlags = READ_LE_UINT32((filePtr + 5));
fileSize = fileFlags & 0x03fffff;
-
+ _lastLoadedFileSize = fileSize;
+
fileOffset = READ_LE_UINT32((filePtr + 2)) & 0x0ffffff;
cflag = (uint8)((fileOffset >> (23)) & 0x1);
@@ -168,6 +174,8 @@ uint16 *SkyState::loadFile(uint16 fileNr, uint8 *dest) {
}
}
+ _lastLoadedFileSize = decompSize; //including header
+
if (fixedDest == NULL)
free(fileDest);
@@ -191,8 +199,7 @@ uint16 *SkyState::getFileInfo(uint16 fileNr) {
}
}
- // if file is speech file then return NULL if not found
- printf("get_file_info() - speech file support not implemented yet!\n");
+ // if file not found return NULL
return (uint16 *)NULL;
}
diff --git a/sky/intro.cpp b/sky/intro.cpp
index 04761bf45b..6d4bd115d3 100644
--- a/sky/intro.cpp
+++ b/sky/intro.cpp
@@ -232,6 +232,49 @@ void SkyState::initVirgin() {
free(_tempPal);
}
+void SkyState::intro(void) {
+
+ _workScreen = (uint8 *)loadFile(60112, NULL); //while virgin screen is up, load rev screen
+ _tempPal = (uint8 *)loadFile(60113, NULL);
+
+ //loadSectionMusic(0);
+
+ delay(3000); //keep virgin screen up for 3 seconds
+
+ //if (!_isCDVersion)
+ // fn_start_music();
+
+ delay(3000); //and another 3 seconds.
+ fn_fade_down(0); //remove virgin screen
+ showScreen();
+ paletteFadeUp(_tempPal);
+ free (_tempPal);
+ free (_workScreen);
+
+ //while rev is up, load gibbons screen
+ _workScreen = (uint8 *)loadFile(60114, NULL);
+ _tempPal = (uint8 *)loadFile(60115, NULL);
+
+ intro_text_space = (uint8 *)malloc(10000);
+ intro_text_save = (uint8 *)malloc(10000);
+
+ //get_text(77);
+
+ delay(8000); // keep revolution up for 8 seconds
+
+ fn_fade_down(0);
+ showScreen();
+ paletteFadeUp(_tempPal);
+
+ free (_tempPal);
+ free (_workScreen);
+
+ if (_isCDVersion)
+ doCDIntro();
+
+
+}
+
void SkyState::showScreen(void) {
_system->copy_rect(_workScreen, 320, 0, 0, 320, 200);
diff --git a/sky/module.mk b/sky/module.mk
index 8e6bad9543..702c0c5daf 100644
--- a/sky/module.mk
+++ b/sky/module.mk
@@ -5,8 +5,10 @@ MODULE_OBJS = \
sky/disk.o \
sky/screen.o \
sky/intro.o \
+ sky/cd_intro.o \
sky/rnc_deco.o \
sky/grid.o \
+ sky/sound.o \
# Include common rules
include common.rules
diff --git a/sky/screen.cpp b/sky/screen.cpp
index cf8725fa4f..6bad94504c 100644
--- a/sky/screen.cpp
+++ b/sky/screen.cpp
@@ -25,7 +25,6 @@
#include "sky/skydefs.h"
#include "sky/sky.h"
-#define FADE_JUMP 2
#define SCROLL_JUMP 16
#define VGA_COLOURS 256
@@ -94,3 +93,93 @@ void SkyState::convertPalette(uint8 *inPal, uint8* outPal) { //convert 3 byte 0.
outPal[4 * i + 3] = 0x00;
}
}
+
+//action = 0, simply fade out
+//action = 1, scroll left
+//action = 2, scroll right
+void SkyState::fn_fade_down(uint8 action) {
+
+ if (action) {
+
+ //do scroll
+
+ } else {
+
+ int i = 32;
+
+ do {
+ palette_fadedown_helper((uint32 *)_palette, 256);
+ _system->set_palette(_palette, 0, 256);
+ _system->update_screen();
+ delay(10);
+
+ } while (--i);
+
+ }
+
+
+}
+
+void SkyState::palette_fadedown_helper(uint32 *pal, uint num) {
+ byte *p = (byte *)pal;
+
+ do {
+ if (p[0] >= 8)
+ p[0] -= 8;
+ else
+ p[0] = 0;
+ if (p[1] >= 8)
+ p[1] -= 8;
+ else
+ p[1] = 0;
+ if (p[2] >= 8)
+ p[2] -= 8;
+ else
+ p[2] = 0;
+ p += sizeof(uint32);
+ } while (--num);
+}
+
+void SkyState::paletteFadeUp(uint8 *pal) {
+
+ byte tmpPal[1024];
+
+ convertPalette(pal, tmpPal);
+
+ int i = 32;
+
+ do {
+
+ palette_fadeup_helper((uint32 *)_palette, (uint32 *)tmpPal, 256);
+ _system->set_palette(_palette, 0, 256);
+ _system->update_screen();
+ delay(10);
+ } while (--i);
+
+}
+
+void SkyState::palette_fadeup_helper(uint32 *realPal, uint32 *desiredPal, int num) {
+
+ byte *r = (byte *)realPal;
+ byte *d = (byte *)desiredPal;
+
+ do {
+ if (r[0] < d[0]-8)
+ r[0] += 8;
+ else
+ r[0] = d[0];
+ if (r[1] < d[1]-8)
+ r[1] += 8;
+ else
+ r[1] = d[1];
+ if (r[2] < d[2]-8)
+ r[2] += 8;
+ else
+ r[2] = d[2];
+
+ r += sizeof(uint32);
+ d += sizeof(uint32);
+ } while (--num);
+
+}
+
diff --git a/sky/sky.cpp b/sky/sky.cpp
index aa94406e06..af60c7f494 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -53,6 +53,11 @@ SkyState::SkyState(GameDetector *detector, OSystem *syst)
_game = detector->_gameId;
+ if (!_mixer->bindToSystem(syst))
+ warning("Sound initialisation failed.");
+
+ _mixer->setVolume(detector->_sfx_volume); //unnecessary?
+
_debugMode = detector->_debugMode;
_debugLevel = detector->_debugLevel;
_language = detector->_language;
@@ -78,7 +83,8 @@ void SkyState::go() {
_dump_file = stdout;
initialise();
-
+ intro();
+
while (1) {
delay(100);
}
@@ -89,6 +95,9 @@ void SkyState::initialise(void) {
//initialise_memory();
//init_timer();
//init_music();
+
+ _sound = new SkySound(_mixer);
+
initialiseDisk();
initialiseScreen();
initVirgin();
diff --git a/sky/sky.h b/sky/sky.h
index eeb50bbdce..7765d0a5b7 100644
--- a/sky/sky.h
+++ b/sky/sky.h
@@ -25,12 +25,15 @@
#include <stdio.h>
#include "common/engine.h"
#include "common/util.h"
+#include "sound/mixer.h"
+#include "sky/sound.h"
class SkyState : public Engine {
void errorString(const char *buf_input, char *buf_output);
protected:
byte _game;
bool _isCDVersion;
+ bool _isDemo;
byte _key_pressed;
uint16 _debugMode;
@@ -45,6 +48,8 @@ protected:
int _numScreenUpdates;
+ uint32 _lastLoadedFileSize;
+
// int _timer_id;
FILE *_dump_file;
@@ -52,13 +57,16 @@ protected:
int _number_of_savegames;
int _sdl_mouse_x, _sdl_mouse_y;
+
+ SkySound *_sound;
byte *_workScreen;
byte *_backScreen;
byte *_tempPal;
byte *_workPalette;
byte *_halfPalette;
-
+ byte *_scrollAddr;
+
byte *_gameGrid;
byte *_gameGrids;
@@ -77,9 +85,15 @@ protected:
void initialiseScreen();
void initialiseGrids();
void setPalette(uint8 *pal);
+ void fn_fade_down(uint8 action);
+ void palette_fadedown_helper(uint32 *pal, uint num);
+ void paletteFadeUp(uint8 *pal);
+ void palette_fadeup_helper(uint32 *realPal, uint32 *desiredPal, int num);
uint16 *loadFile(uint16 fileNr, uint8 *dest);
uint16 *getFileInfo(uint16 fileNr);
void initVirgin();
+ void intro();
+ void doCDIntro();
void showScreen();
static int CDECL game_thread_proc(void *param);
diff --git a/sky/sound.cpp b/sky/sound.cpp
new file mode 100644
index 0000000000..99f4106336
--- /dev/null
+++ b/sky/sound.cpp
@@ -0,0 +1,43 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "sky/sound.h"
+#include "sky/struc.h"
+#include "common/file.h"
+#include "common/engine.h"
+
+SkySound::SkySound(SoundMixer *mixer) {
+ _mixer = mixer;
+}
+
+int SkySound::playVoice(byte *sound, uint32 size) {
+
+ byte flags = 0;
+ flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE;
+ size -= sizeof(struct dataFileHeader);
+ byte *buffer = (byte *)malloc(size);
+ memcpy(buffer, sound+sizeof(struct dataFileHeader), size);
+
+ return _mixer->playRaw(NULL, buffer, size, 11025, flags);
+
+}
+
diff --git a/sky/sound.h b/sky/sound.h
new file mode 100644
index 0000000000..26d8d8080f
--- /dev/null
+++ b/sky/sound.h
@@ -0,0 +1,43 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+
+#include "sound/mixer.h"
+
+class SkySound {
+protected:
+
+ bool _voiceIsPlaying;
+
+public:
+
+ SoundMixer *_mixer;
+
+
+protected:
+
+
+public:
+ SkySound(SoundMixer *mixer);
+ int playVoice(byte *sound, uint32 size);
+
+};
+