Ticket #8184: scummvm-bass.diff

File scummvm-bass.diff, 46.7 KB (added by joostp, 22 years ago)

Diff against CVS of 2003-03-04

  • backends/fs/morphos/.deps/abox-fs.d

    diff -urN scummvm/backends/fs/morphos/.deps/abox-fs.d scummvm-bass/backends/fs/morphos/.deps/abox-fs.d
    old new  
     1backends/fs/morphos/abox-fs.o: backends/fs/morphos/abox-fs.cpp
  • backends/fs/posix/.deps/posix-fs.d

    diff -urN scummvm/backends/fs/posix/.deps/posix-fs.d scummvm-bass/backends/fs/posix/.deps/posix-fs.d
    old new  
     1backends/fs/posix/posix-fs.o: backends/fs/posix/posix-fs.cpp backends/fs/fs.h common/list.h \
     2  common/scummsys.h /usr/include/SDL/SDL_byteorder.h common/str.h
  • backends/fs/windows/.deps/windows-fs.d

    diff -urN scummvm/backends/fs/windows/.deps/windows-fs.d scummvm-bass/backends/fs/windows/.deps/windows-fs.d
    old new  
     1backends/fs/windows/windows-fs.o: backends/fs/windows/windows-fs.cpp
  • build.rules

    diff -urN scummvm/build.rules scummvm-bass/build.rules
    old new  
     1# Build settings for the SDL backend
     2MODULES  += backends/sdl
     3DEFINES  += -DUNIX
     4INCLUDES += `sdl-config --cflags`
     5LIBS     += `sdl-config --libs`
     6OBJS     += backends/sdl/sdl-common.o
     7
     8# The normal (non OpenGL-accelerated) SDL backend
     9OBJS     += backends/sdl/sdl.o
     10
     11# Uncomment these lines (instead of the above) to use SDL with OpenGL
     12# OBJS     += backends/sdl/sdl_gl.o
     13# LIBS     += -lGL
     14
     15# Uncomment this in addition to the above if you compile on Mac OS X
     16# DEFINES += -DMACOSX
     17# LIBS  += -framework QuickTime -framework AudioUnit
  • common/engine.cpp

    diff -urN scummvm/common/engine.cpp scummvm-bass/common/engine.cpp
    old new  
    8787        } else if (detector->_gameId >= GID_SCUMM_FIRST && detector->_gameId <= GID_SCUMM_LAST) {
    8888                // Some kind of Scumm game
    8989                engine = Engine_SCUMM_create(detector, syst);
     90        } else if (detector->_gameId >= GID_SKY_FIRST && detector->_gameId <= GID_SKY_LAST) {
     91                // Beneath a Steel Sky
     92                engine = Engine_SKY_create(detector, syst);
    9093        } else {
    9194                // Unknown game
    9295        }
  • common/engine.h

    diff -urN scummvm/common/engine.h scummvm-bass/common/engine.h
    old new  
    7878// 2) Faster (compiler doesn't have to parse lengthy header files)
    7979extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst);
    8080extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst);
     81extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst);
    8182
    8283extern const VersionSettings *Engine_SIMON_targetList();
    8384extern const VersionSettings *Engine_SCUMM_targetList();
     85extern const VersionSettings *Engine_SKY_targetList();
    8486
    8587#endif
    8688
  • common/gameDetector.cpp

    diff -urN scummvm/common/gameDetector.cpp scummvm-bass/common/gameDetector.cpp
    old new  
    191191                // Gather & combine the target lists from the modules
    192192                const VersionSettings *scummVersions = Engine_SCUMM_targetList();
    193193                const VersionSettings *simonVersions = Engine_SIMON_targetList();
     194                const VersionSettings *skyVersions = Engine_SKY_targetList();
     195               
    194196                int scummCount = countVersions(scummVersions);
    195197                int simonCount = countVersions(simonVersions);
     198                int skyCount = countVersions(skyVersions);
    196199               
    197                 VersionSettings *v = (VersionSettings *)calloc(scummCount + simonCount + 1, sizeof(VersionSettings));
     200                VersionSettings *v = (VersionSettings *)calloc(scummCount + simonCount + skyCount + 1, sizeof(VersionSettings));
    198201                memcpy(v, scummVersions, scummCount * sizeof(VersionSettings));
    199202                memcpy(v+scummCount, simonVersions, simonCount * sizeof(VersionSettings));
     203                memcpy(v+skyCount, skyVersions, skyCount * sizeof(VersionSettings));
    200204                version_settings = v;
    201205        }
    202206}
  • common/gameDetector.h

    diff -urN scummvm/common/gameDetector.h scummvm-bass/common/gameDetector.h
    old new  
    4040
    4141        // Simon the Sorcerer
    4242        GID_SIMON_FIRST,
    43         GID_SIMON_LAST = GID_SIMON_FIRST + 99
     43        GID_SIMON_LAST = GID_SIMON_FIRST + 99,
     44
     45        // Beneath a Steel Sky
     46        GID_SKY_FIRST,
     47        GID_SKY_LAST = GID_SKY_FIRST + 99
    4448};
    4549
    4650// TODO: the GameFeatures really should be moved to scumm/scumm.h, too
  • config.h

    diff -urN scummvm/config.h scummvm-bass/config.h
    old new  
     1/* This file is automatically generated by configure */
     2/* DO NOT EDIT MANUALLY */
     3
     4#ifndef CONFIG_H
     5#define CONFIG_H
     6
     7#define UNIX
     8#define SCUMM_LITTLE_ENDIAN
     9
     10/* Data types */
     11typedef unsigned char byte;
     12typedef unsigned int uint;
     13typedef unsigned char uint8;
     14typedef unsigned short uint16;
     15typedef unsigned int uint32;
     16typedef signed char int8;
     17typedef signed short int16;
     18typedef signed int int32;
     19
     20#endif /* CONFIG_H */
  • Makefile

    diff -urN scummvm/Makefile scummvm-bass/Makefile
    old new  
    3232#######################################################################
    3333
    3434# Uncomment this to activate the MAD lib for compressed sound files
    35 DEFINES += -DUSE_MAD
    36 LIBS    += -lmad
     35#DEFINES += -DUSE_MAD
     36#LIBS    += -lmad
    3737
    3838# Uncomment this to activate the Ogg Vorbis lib for compressed sound files
    3939# DEFINES += -DUSE_VORBIS
  • Makefile.common

    diff -urN scummvm/Makefile.common scummvm-bass/Makefile.common
    old new  
    2323# module.mk of their parents. In fact the only reason they are listed here is to ensure the
    2424# DEPDIRS directive works correctly.
    2525MODULES += \
    26         scumm common simon gui backends sound \
     26        scumm common simon sky gui backends sound \
    2727        scumm/smush backends/fs/posix backends/fs/morphos backends/fs/windows backends/midi
    2828
    2929# Include the build instructions for all modules
  • scumm/smush/.deps/blitter.d

    diff -urN scummvm/scumm/smush/.deps/blitter.d scummvm-bass/scumm/smush/.deps/blitter.d
    old new  
     1scumm/smush/blitter.o: scumm/smush/blitter.cpp common/stdafx.h common/util.h \
     2  common/scummsys.h /usr/include/SDL/SDL_byteorder.h \
     3  scumm/smush/blitter.h scumm/smush/config.h common/rect.h \
     4  scumm/smush/chunk.h
  • scumm/smush/.deps/brenderer.d

    diff -urN scummvm/scumm/smush/.deps/brenderer.d scummvm-bass/scumm/smush/.deps/brenderer.d
    old new  
     1scumm/smush/brenderer.o: scumm/smush/brenderer.cpp common/stdafx.h \
     2  scumm/smush/brenderer.h scumm/smush/config.h common/scummsys.h \
     3  /usr/include/SDL/SDL_byteorder.h scumm/smush/renderer.h \
     4  scumm/smush/palette.h scumm/smush/color.h common/rect.h common/engine.h \
     5  common/system.h common/savefile.h
  • scumm/smush/.deps/chunk.d

    diff -urN scummvm/scumm/smush/.deps/chunk.d scummvm-bass/scumm/smush/.deps/chunk.d
    old new  
     1scumm/smush/chunk.o: scumm/smush/chunk.cpp common/stdafx.h scumm/smush/chunk.h \
     2  scumm/smush/config.h common/scummsys.h /usr/include/SDL/SDL_byteorder.h \
     3  common/engine.h common/system.h common/savefile.h common/file.h \
     4  common/str.h common/list.h
  • scumm/smush/.deps/codec1.d

    diff -urN scummvm/scumm/smush/.deps/codec1.d scummvm-bass/scumm/smush/.deps/codec1.d
    old new  
     1scumm/smush/codec1.o: scumm/smush/codec1.cpp common/stdafx.h scumm/smush/codec1.h \
     2  scumm/smush/config.h common/scummsys.h /usr/include/SDL/SDL_byteorder.h \
     3  scumm/smush/decoder.h common/rect.h scumm/smush/chunk.h \
     4  scumm/smush/blitter.h
  • scumm/smush/.deps/codec37.d

    diff -urN scummvm/scumm/smush/.deps/codec37.d scummvm-bass/scumm/smush/.deps/codec37.d
    old new  
     1scumm/smush/codec37.o: scumm/smush/codec37.cpp common/stdafx.h scumm/smush/codec37.h \
     2  scumm/smush/decoder.h scumm/smush/config.h common/scummsys.h \
     3  /usr/include/SDL/SDL_byteorder.h common/rect.h scumm/smush/chunk.h \
     4  scumm/smush/blitter.h common/engine.h common/system.h common/savefile.h
  • scumm/smush/.deps/codec44.d

    diff -urN scummvm/scumm/smush/.deps/codec44.d scummvm-bass/scumm/smush/.deps/codec44.d
    old new  
     1scumm/smush/codec44.o: scumm/smush/codec44.cpp common/stdafx.h scumm/smush/codec44.h \
     2  scumm/smush/decoder.h scumm/smush/config.h common/scummsys.h \
     3  /usr/include/SDL/SDL_byteorder.h common/rect.h scumm/smush/chunk.h \
     4  scumm/smush/blitter.h
  • scumm/smush/.deps/codec47.d

    diff -urN scummvm/scumm/smush/.deps/codec47.d scummvm-bass/scumm/smush/.deps/codec47.d
    old new  
     1scumm/smush/codec47.o: scumm/smush/codec47.cpp common/stdafx.h scumm/scumm.h \
     2  common/engine.h common/scummsys.h /usr/include/SDL/SDL_byteorder.h \
     3  common/system.h common/savefile.h common/gameDetector.h common/str.h \
     4  common/list.h common/file.h common/map.h common/timer.h common/util.h \
     5  scumm/gfx.h scumm/boxes.h scumm/smush/codec47.h scumm/smush/config.h \
     6  scumm/smush/decoder.h common/rect.h scumm/smush/chunk.h \
     7  scumm/smush/blitter.h
  • scumm/smush/.deps/color.d

    diff -urN scummvm/scumm/smush/.deps/color.d scummvm-bass/scumm/smush/.deps/color.d
    old new  
     1scumm/smush/color.o: scumm/smush/color.cpp common/stdafx.h scumm/smush/color.h \
     2  scumm/smush/config.h common/scummsys.h /usr/include/SDL/SDL_byteorder.h
  • scumm/smush/.deps/frenderer.d

    diff -urN scummvm/scumm/smush/.deps/frenderer.d scummvm-bass/scumm/smush/.deps/frenderer.d
    old new  
     1scumm/smush/frenderer.o: scumm/smush/frenderer.cpp common/stdafx.h common/util.h \
     2  common/scummsys.h /usr/include/SDL/SDL_byteorder.h common/engine.h \
     3  common/system.h common/savefile.h scumm/scumm.h common/gameDetector.h \
     4  common/str.h common/list.h common/file.h common/map.h common/timer.h \
     5  scumm/gfx.h scumm/boxes.h scumm/smush/frenderer.h scumm/smush/config.h \
     6  scumm/smush/brenderer.h scumm/smush/renderer.h scumm/smush/palette.h \
     7  scumm/smush/color.h common/rect.h scumm/smush/blitter.h
  • scumm/smush/.deps/imuse_channel.d

    diff -urN scummvm/scumm/smush/.deps/imuse_channel.d scummvm-bass/scumm/smush/.deps/imuse_channel.d
    old new  
     1scumm/smush/imuse_channel.o: scumm/smush/imuse_channel.cpp common/stdafx.h \
     2  scumm/smush/channel.h scumm/smush/config.h common/scummsys.h \
     3  /usr/include/SDL/SDL_byteorder.h common/engine.h common/system.h \
     4  common/savefile.h scumm/smush/chunk.h scumm/smush/chunk_type.h
  • scumm/smush/.deps/player.d

    diff -urN scummvm/scumm/smush/.deps/player.d scummvm-bass/scumm/smush/.deps/player.d
    old new  
     1scumm/smush/player.o: scumm/smush/player.cpp common/stdafx.h common/file.h \
     2  common/scummsys.h /usr/include/SDL/SDL_byteorder.h common/util.h \
     3  common/engine.h common/system.h common/savefile.h scumm/scumm.h \
     4  common/gameDetector.h common/str.h common/list.h common/map.h \
     5  common/timer.h scumm/gfx.h scumm/boxes.h sound/mixer.h \
     6  scumm/smush/player.h scumm/smush/config.h scumm/smush/chunk.h \
     7  scumm/smush/palette.h scumm/smush/color.h scumm/smush/codec1.h \
     8  scumm/smush/decoder.h common/rect.h scumm/smush/codec37.h \
     9  scumm/smush/codec44.h scumm/smush/codec47.h scumm/smush/mixer.h \
     10  scumm/smush/renderer.h scumm/smush/frenderer.h scumm/smush/brenderer.h \
     11  scumm/smush/blitter.h scumm/smush/channel.h scumm/smush/chunk_type.h
  • scumm/smush/.deps/saud_channel.d

    diff -urN scummvm/scumm/smush/.deps/saud_channel.d scummvm-bass/scumm/smush/.deps/saud_channel.d
    old new  
     1scumm/smush/saud_channel.o: scumm/smush/saud_channel.cpp common/stdafx.h \
     2  scumm/smush/channel.h scumm/smush/config.h common/scummsys.h \
     3  /usr/include/SDL/SDL_byteorder.h common/engine.h common/system.h \
     4  common/savefile.h scumm/smush/chunk.h scumm/smush/chunk_type.h
  • scumm/smush/.deps/scumm_renderer.d

    diff -urN scummvm/scumm/smush/.deps/scumm_renderer.d scummvm-bass/scumm/smush/.deps/scumm_renderer.d
    old new  
     1scumm/smush/scumm_renderer.o: scumm/smush/scumm_renderer.cpp common/stdafx.h \
     2  common/util.h common/scummsys.h /usr/include/SDL/SDL_byteorder.h \
     3  scumm/smush/scumm_renderer.h scumm/smush/config.h \
     4  scumm/smush/brenderer.h scumm/smush/renderer.h scumm/smush/palette.h \
     5  scumm/smush/color.h common/rect.h scumm/smush/channel.h common/engine.h \
     6  common/system.h common/savefile.h scumm/smush/mixer.h sound/mixer.h \
     7  scumm/scumm.h common/gameDetector.h common/str.h common/list.h \
     8  common/file.h common/map.h common/timer.h scumm/gfx.h scumm/boxes.h \
     9  scumm/sound.h scumm/imuse.h scumm/imuse_digi.h scumm/actor.h
  • sky/disk.cpp

    Binary files scummvm/scummvmbass20030304.tar and scummvm-bass/scummvmbass20030304.tar differ
    diff -urN scummvm/sky/disk.cpp scummvm-bass/sky/disk.cpp
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include "common/scummsys.h"
     21#include "common/engine.h"
     22#include "include.h"
     23#include "skymain.h"
     24
     25#define no_of_files_hd  1600
     26#define no_of_files_cd  5200
     27#define max_files_in_list       60
     28
     29extern uint16 UnpackM1(void *, void *, uint16);
     30
     31const char *data_file_name = "sky.dsk";
     32const char *dinner_file_name = "sky.dnr";
     33uint8 *dinner_table_area, *fixed_dest, *file_dest, *comp_dest;
     34uint32 dinner_table_size, file_flags, file_offset, file_size, decomp_size, comp_file;
     35uint16 build_list[max_files_in_list];
     36uint32 loaded_file_list[max_files_in_list];
     37
     38FILE *data_disk_handle;
     39FILE *dnr_handle;
     40
     41
     42void SkyState::initialise_disk()
     43{
     44    uint32 eax, bytes_read;
     45    char dinner_file[256];
     46    char disk_file[256];
     47   
     48    strcpy(dinner_file, _gameDataPath);
     49    strcat(dinner_file, dinner_file_name);
     50    strcpy(disk_file, _gameDataPath);
     51    strcat(disk_file, data_file_name);
     52   
     53    dinner_table_size = no_of_files_hd; //floppy version only! need to add check for cd
     54    dinner_table_area = (uint8 *)malloc(no_of_files_hd*8);
     55
     56    dnr_handle = fopen(dinner_file ,"r");
     57    if (dnr_handle == NULL)
     58        error("Could not open %s!\n", dinner_file);
     59   
     60    if (!(fread(&eax, 4, 1, dnr_handle)))
     61        error("Error reading from sky.dnr!\n"); //even though it was opened correctly?!
     62   
     63    if (_debugLevel > 1)
     64        printf("files_in_dnr/dinner_table_size: %d/%d\n", eax, dinner_table_size);
     65
     66    if (eax > dinner_table_size)
     67        error("No. of files in sky.dnr exceeds dinner_table_size! (AKA: Fixme, you're using the cd version.)\n");
     68   
     69    dinner_table_size = eax;
     70    bytes_read = fread(dinner_table_area, 8, dinner_table_size, dnr_handle);
     71
     72    if (bytes_read != dinner_table_size)
     73        warning("bytes_read != dinner_table_size. [%d/%d]\n", bytes_read, dinner_table_size);
     74       
     75    data_disk_handle = fopen(disk_file, "r");
     76    if (data_disk_handle == NULL)
     77        error("Error opening %s!\n", disk_file);
     78}
     79
     80//load in file file_nr to address dest
     81//if dest == NULL, then allocate memory for this file
     82uint16 *SkyState::load_file(uint16 file_nr, uint8 *dest)
     83{
     84    uint8 cflag;
     85    uint32 eax, ecx;
     86    int32 bytes_read, cur_pos;
     87    uint8 *file_ptr, *esiptr, *ediptr;
     88    s file_header;
     89
     90    #ifdef file_order_chk
     91        warning("File order checking not implemented yet!\n");
     92    #endif
     93   
     94    if (_debugLevel > 1) {
     95        comp_file = file_nr;
     96        printf("load file %d,%d (%d)\n", (file_nr>>11), (file_nr&2047), file_nr);
     97    }
     98
     99    file_ptr = (uint8 *)get_file_info(file_nr);
     100    if (file_ptr == NULL) {
     101        printf("File %d not found!\n", file_nr);
     102        return NULL;
     103    }
     104   
     105    eax = READ_LE_UINT32((file_ptr+5));
     106    file_flags = eax;
     107    eax &= 0x03fffff;
     108    file_size = eax;
     109
     110    ecx = READ_LE_UINT32((file_ptr+2));
     111    ecx &= 0x0ffffff;
     112
     113    cflag = (uint8)((ecx >> (23)) & 0x1);
     114    ecx = (((1 << (23)) ^ 0xFFFFFFFF) & ecx);
     115   
     116    if (cflag)
     117        ecx = ecx << 4;
     118       
     119    file_offset = ecx;
     120    fixed_dest = dest;
     121    file_dest = dest;
     122    comp_dest = dest;
     123
     124    if (dest == NULL) //we need to allocate memory for this file
     125        file_dest = (uint8 *)malloc(eax);
     126       
     127    cur_pos = fseek(data_disk_handle, file_offset, SEEK_SET);
     128
     129    #ifdef file_order_chk
     130        warning("File order checking not implemented yet!\n");
     131    #endif
     132
     133    if (cur_pos != 0)
     134        error("disk read error! (fseek)\n");
     135                   
     136    if (_debugLevel > 2)
     137        printf("Copying %d bytes from %s to 0x%08X\n", file_size, data_file_name, file_dest);
     138   
     139   
     140    //now read in the data
     141    bytes_read = fread(file_dest, 1, file_size, data_disk_handle);
     142   
     143    if (bytes_read != (int32)file_size)
     144        printf("ERROR: Unable to read %d bytes from datadisk (%d bytes read)\n", file_size, bytes_read);
     145   
     146    cflag = (uint8)((file_flags >> (23)) & 0x1);
     147   
     148    //if cflag == 0 then file is compressed, 1 == uncompressed
     149   
     150    if (!cflag)
     151    {
     152        if (_debugLevel > 1)
     153                printf("File is compressed...");
     154
     155        memcpy(&file_header, file_dest, sizeof(struct s));
     156        if ( (uint8)((file_header.flag >> (7)) & 0x1)  ) {
     157            if (_debugLevel > 1)
     158                printf("with RNC!\n");
     159           
     160            eax = file_header.flag;
     161            eax &= 0xFFFFFF00; //clear al
     162            eax = eax << 8;
     163            eax |= (uint16)file_header.s_tot_size;
     164
     165            decomp_size = eax;
     166           
     167            if (fixed_dest == NULL) // is this valid?
     168                comp_dest = (uint8 *)malloc(eax);
     169
     170            esiptr = file_dest;
     171            ediptr = comp_dest;
     172               
     173            if ( (uint8)(file_flags >> (22) & 0x1) ) //do we include the header?
     174                esiptr += sizeof(struct s);
     175            else {
     176                memcpy(ediptr, esiptr, sizeof(struct s));
     177                esiptr += sizeof(struct s);
     178                ediptr += sizeof(struct s);
     179            }
     180
     181            eax = UnpackM1(esiptr, ediptr, 0);
     182           
     183            if (_debugLevel > 2)
     184                printf("UnpackM1 returned: %d\n", eax);
     185
     186            if (eax == 0) { //Unpack returned 0: file was probably not packed.
     187                if (fixed_dest == NULL)
     188                    free(comp_dest);
     189           
     190                return (uint16 *)file_dest;
     191            }
     192           
     193            if (! (uint8)(file_flags >> (22) & 0x1) ) { //include header?
     194                eax += sizeof(struct s);
     195           
     196                if (_debugLevel > 1)
     197                    if (eax != decomp_size)
     198                    {
     199                        printf("ERROR: invalid decomp size! (was: %d, should be: %d)\n", eax, decomp_size);
     200                    }
     201            }
     202           
     203            if (fixed_dest == NULL)
     204                free(file_dest);
     205                   
     206        }
     207        else
     208                if (_debugLevel > 1)     
     209                        printf("but not with RNC! (?!)\n");
     210         
     211       
     212       
     213    }
     214    else
     215        return (uint16 *)file_dest;
     216       
     217    return (uint16 *)comp_dest;
     218}
     219
     220uint16 *SkyState::get_file_info(uint16 file_nr)
     221{
     222    uint16 i;
     223    uint16 *dnr_tbl_16_ptr = (uint16 *)dinner_table_area;
     224   
     225    for (i = 0; i < dinner_table_size/2; i++)
     226    {
     227        if (READ_LE_UINT16(dnr_tbl_16_ptr+(i*4)) == file_nr)
     228        {
     229            if (_debugLevel > 1)
     230                printf("file %d found!\n", file_nr);
     231            return (dnr_tbl_16_ptr+(i*4));
     232        }
     233    }
     234   
     235    //if file is speech file then return NULL if not found
     236    printf("get_file_info() - speech file support not implemented yet!\n");
     237    return (uint16 *)NULL;
     238}
     239
  • sky/include.h

    diff -urN scummvm/sky/include.h scummvm-bass/sky/include.h
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include "struc.h"
     21
     22//This file is incomplete, several flags still missing.
     23
     24#define key_buffer_size 80
     25#define sequence_count  3
     26
     27//screen/grid defines
     28#define game_screen_width       320
     29#define game_screen_height      192
     30#define full_screen_width       320
     31#define full_screen_height      200
     32
     33#define tot_no_grids    70
     34
     35#define grid_size       120
     36
     37#define GRID_X  20
     38#define GRID_Y  24
     39#define GRID_W  16
     40#define GRID_H  8
     41
     42#define GRID_W_SHIFT    4
     43#define GRID_H_SHIFT    3
     44
     45#define top_left_x      128
     46#define top_left_y      136
     47
     48//item list defines
     49#define section_0_item  119
     50
     51#define c_base_mode     0
     52#define c_base_mode56   56
     53#define c_action_mode   4
     54#define c_sp_colour     90
     55#define c_mega_set      112
     56#define c_grid_width    114
     57
     58//#define next_mega_set
     59
     60#define send_sync       -1
     61#define lf_start_fx     -2
     62#define safe_start_screen       0
     63
     64//autoroute defines
     65#define upy     0
     66#define downy   1
     67#define lefty   2
     68#define righty  3
     69
     70#define route_space     64
     71
     72#define l_script        1
     73#define l_ar    2
     74#define l_ar_anim       3
     75#define l_ar_turning    4
     76#define l_alt   5
     77#define l_mod_animate   6
     78#define l_turning       7
     79#define l_cursor        8
     80#define l_talk  9
     81#define l_listen        10
     82#define l_stopped       11
     83#define l_choose        12
     84#define l_frames        13
     85#define l_pause 14
     86#define l_wait_synch    15
     87#define l_simple_mod    16
     88
  • sky/intro.cpp

    diff -urN scummvm/sky/intro.cpp scummvm-bass/sky/intro.cpp
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include <string.h>
     21#include "common/scummsys.h"
     22#include "sky/skymain.h"
     23#include "include.h"
     24
     25#define intro_text_width        128
     26
     27#define fn_a_pal        60080
     28#define fn_1a_log       60081
     29#define fn_1a   60082
     30#define fn_1b   60083
     31#define fn_1c   60084
     32#define fn_1d   60085
     33#define fn_1e   60086
     34#define fn_4a   60087
     35#define fn_4b_log       60088
     36#define fn_4b   60089
     37#define fn_4c_log       60090
     38#define fn_4c   60091
     39#define fn_5_pal        60092
     40#define fn_5_log        60093
     41#define fn_5    60094
     42#define fn_6_pal        60095
     43#define fn_6_log        60096
     44#define fn_6a   60097
     45#define fn_6b   60098
     46
     47#ifdef short_intro_start
     48#define virgin_time_1   3
     49#define viring_time_2   3
     50#define rev_time        8
     51#define gibb_time       6
     52#else
     53#define virgin_time_1   (3*50)
     54#define virgin_time_2   ((3*50)+8)
     55#define rev_time        ((8*50)+8)
     56#define gibb_time       ((6*50)+8)
     57#endif
     58
     59void prepare_text(void);
     60void show_intro_text(void);
     61void remove_text(void);
     62void intro_fx(void);
     63void intro_vol(void);
     64
     65uint8 *seq1a_data;
     66uint8 *seq1b_data;
     67uint8 *seq1c_data;
     68uint8 *seq1d_data;
     69uint8 *seq1e_data;
     70uint8 *seq4a_data;
     71uint8 *seq4b_data;
     72uint8 *seq4c_data;
     73uint8 *seq5_data;
     74uint8 *seq6a_data;
     75uint8 *seq6b_data;
     76
     77
     78uint8 *vga_data;
     79uint8 *diff_data;
     80
     81uint8 *work_base;
     82uint8 *work_screen;
     83uint8 *work_screen_end;
     84
     85uint8 *intro_text_space;        //space for storing text messages
     86uint8 *intro_text_save; //save screen data here
     87
     88uint8 *vga_pointer;
     89uint8 *diff_pointer;
     90
     91uint32 no_frames;       //number of frames in scrolling intro
     92uint32 frame_counter;
     93
     94#define ic_prepare_text 0
     95#define ic_show_text    1
     96#define ic_remove_text  2
     97#define ic_make_sound   3
     98#define ic_fx_volume    4
     99
     100
     101typedef void (*pfc)(void);
     102pfc command_routines[] = { &prepare_text, &show_intro_text, &remove_text, &intro_fx, &intro_vol };
     103
     104uint32 cockpit_commands[] =
     105{
     106    1000,       //do straight away
     107    ic_prepare_text,
     108    77,
     109    220,
     110    ic_show_text, //radar detects jamming signal
     111    20,
     112    160,
     113    105,
     114    ic_remove_text,
     115    81,
     116    105,
     117    ic_show_text, //well switch to override you fool
     118    170,
     119    86,
     120    35,
     121    ic_remove_text,
     122    35,
     123    ic_prepare_text,
     124    477,
     125    35,
     126    ic_show_text,
     127    30,
     128    160,
     129    3,
     130    ic_remove_text
     131};
     132
     133uint32 zero_commands[] = { 0 };
     134
     135uint32 anim5_commands[] =
     136{
     137    31,
     138    ic_make_sound,
     139    2,
     140    127,
     141    0
     142};
     143
     144uint32 anim4a_commands[] =
     145{
     146    136,
     147    ic_make_sound,
     148    1,
     149    70,
     150    90,
     151    ic_fx_volume,
     152    80,
     153    50,
     154    ic_fx_volume,
     155    90,
     156    5,
     157    ic_fx_volume,
     158    100,
     159    0
     160};
     161
     162uint32 anim4c_commands[] =
     163{
     164    1000,
     165    ic_fx_volume,
     166    100,
     167    25,
     168    ic_fx_volume,
     169    110,
     170    15,
     171    ic_fx_volume,
     172    120,
     173    4,
     174    ic_fx_volume,
     175    127,
     176    0
     177};
     178
     179uint32 anim6a_commands[] =
     180{
     181    1000,
     182    ic_prepare_text,
     183    478,
     184    13,
     185    ic_show_text,
     186    175,
     187    155,
     188    0
     189};
     190
     191uint32 anim6b_commands[] =
     192{
     193    131,
     194    ic_remove_text,
     195    131,
     196    ic_prepare_text,
     197    479,
     198    74,
     199    ic_show_text,
     200    175,
     201    155,
     202    45,
     203    ic_remove_text,
     204    45,
     205    ic_prepare_text,
     206    162,
     207    44,
     208    ic_show_text,
     209    175,
     210    155,
     211    4,
     212    ic_remove_text,
     213    0
     214};
     215
     216uint32 *command_pointer = (uint32 *)zero_commands;
     217
     218
     219void SkyState::init_virgin()
     220{
     221    _temp_pal = (uint8 *)load_file(60111, NULL);
     222    if (_temp_pal != NULL)
     223            set_palette(_temp_pal);
     224
     225    _work_screen = (uint8 *)load_file(60110, NULL);
     226
     227    if (_work_screen != NULL)
     228            show_screen();
     229   
     230    //free the memory that was malloc'ed indirectly via load_file
     231    free (_work_screen);
     232    free (_temp_pal);
     233}
     234
     235void SkyState::show_screen(void)
     236{
     237        _system->copy_rect(_work_screen, 320, 0, 0, 320, 200);
     238        _system->update_screen();
     239}
     240
     241void prepare_text(void)
     242{
     243
     244}
     245
     246void show_intro_text(void)
     247{
     248
     249}
     250
     251void remove_text(void)
     252{
     253
     254}
     255
     256void intro_fx(void)
     257{
     258
     259}
     260
     261void intro_vol(void)
     262{
     263
     264}
  • sky/module.mk

    diff -urN scummvm/sky/module.mk scummvm-bass/sky/module.mk
    old new  
     1MODULE := sky
     2
     3MODULE_OBJS = \
     4        sky/skymain.o \
     5        sky/disk.o \
     6        sky/screen.o \
     7        sky/intro.o \
     8        sky/rnc_deco.o \
     9
     10# Include common rules
     11include common.rules
  • sky/rnc_deco.cpp

    diff -urN scummvm/sky/rnc_deco.cpp scummvm-bass/sky/rnc_deco.cpp
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include <string.h>
     21#include "common/scummsys.h"
     22
     23#define ROL(x, n) (((x) << (n)) | ((x) >> (16-(n))))
     24#define ROR(x, n) (((x) << (16-(n))) | ((x) >> (n)))
     25#define XCHG(a, b) (a ^=b, b ^= a, a ^= b)
     26
     27//conditional flags
     28#define CHECKSUMS       1
     29#define PROTECTED       0
     30
     31//return codes
     32#define NOT_PACKED      0
     33#define PACKED_CRC      -1
     34#define UNPACKED_CRC    -2
     35
     36//other defines
     37#define TABLE_SIZE      (16*8)
     38#define MIN_LENGTH      2
     39#define HEADER_LEN      18
     40
     41uint16 raw_table[TABLE_SIZE/2];
     42uint16 pos_table[TABLE_SIZE/2];
     43uint16 len_table[TABLE_SIZE/2];
     44
     45#ifdef CHECKSUMS
     46uint16 crc_table[0x100];
     47#endif
     48
     49uint32 unpack_len = 0;
     50uint32 pack_len = 0;
     51uint16 pack_paras = 0;
     52uint16 counts = 0;
     53uint16 bit_buffl = 0;
     54uint16 bit_buffh = 0;
     55uint8 blocks = 0;
     56uint8 bit_count = 0;
     57
     58#ifdef CHECKSUMS
     59uint16 crc_u = 0;
     60uint16 crc_p = 0;
     61#endif
     62
     63
     64uint8 *esiptr, *ediptr; //these need to be global because input_bits() uses them
     65
     66void init_crc(void)
     67{
     68        uint16 cnt=0;
     69        uint16 tmp1=0;
     70        uint16 tmp2=0;
     71
     72        for (tmp2 = 0; tmp2 < 0x100; tmp2++) {
     73                tmp1 = tmp2;
     74                for (cnt = 8; cnt > 0; cnt--) {
     75                        if (tmp1 % 2) {
     76                                tmp1 /= 2;
     77                                tmp1 ^= 0x0a001;
     78                        }
     79                        else
     80                                tmp1 /= 2;
     81                }
     82                crc_table[tmp2] = tmp1;
     83        }
     84}
     85
     86//calculate 16 bit crc of a block of memory
     87uint16 crc_block(uint8 *block, uint32 size)
     88{
     89        uint16 crc=0;
     90        uint8 *crcTable8 = (uint8 *)crc_table; //make a uint8* to crc_table
     91        uint8 tmp;
     92        uint32 i;
     93       
     94        for (i = 0; i < size; i++) {
     95                tmp = *block++;
     96                crc ^= tmp;
     97                tmp = (uint8)((crc>>8)&0x00FF);
     98                crc &= 0x00FF; 
     99                crc = crc << 1;
     100                crc = *(uint16 *)&crcTable8[crc];
     101                crc ^= tmp;
     102        }
     103
     104        return crc;
     105}
     106
     107uint16 input_bits(uint8 amount)
     108{
     109        uint16 newBitBuffh = bit_buffh;
     110        uint16 newBitBuffl = bit_buffl;
     111        int16 newBitCount = bit_count;
     112        uint16 remBits, returnVal;
     113
     114        returnVal = ((1 << amount) - 1) & newBitBuffl; 
     115        newBitCount -= amount;
     116
     117        if (newBitCount < 0) {
     118                newBitCount += amount;
     119                XCHG(newBitCount, amount);
     120                remBits = ROR((uint16)(((1 << amount) - 1) & newBitBuffh), amount);
     121                newBitBuffh >>= amount;
     122                newBitBuffl >>= amount;
     123                newBitBuffl |= remBits;
     124                esiptr += 2;
     125                newBitBuffh = READ_LE_UINT16(esiptr);
     126                XCHG(newBitCount, amount);
     127                amount -= newBitCount;
     128                newBitCount = 16 - amount;                             
     129        }
     130        remBits = ROR((uint16)(((1 << amount) - 1) & newBitBuffh), amount);
     131        bit_buffh = newBitBuffh >> amount;
     132        bit_buffl = (newBitBuffl >> amount) | remBits;
     133        bit_count = newBitCount;
     134
     135        return returnVal;
     136
     137}
     138
     139// RCL/RCR functions..operate on 16 bit ints only
     140uint16 rcl(uint16 reg, uint16 *cflag)
     141{
     142        uint16 lsb = *cflag;
     143        *cflag = reg >> 15;
     144        return (reg << 1) | lsb;
     145}
     146
     147uint16 rcr(uint16 reg, uint16 *cflag)
     148{
     149        uint16 msb = *cflag << 15;
     150        *cflag = reg & 1;
     151        return (reg >> 1) | msb;
     152}
     153
     154
     155
     156void make_huftable(uint16 *table)
     157{
     158        uint16 bitLength, i, j;
     159        uint16 numCodes = input_bits(5);
     160
     161        if (!numCodes)
     162                return;
     163
     164        uint8 huffLength[16];
     165        for (i = 0; i < numCodes; i++)
     166                huffLength[i] = (uint8)(input_bits(4) & 0x00FF);
     167
     168        uint16 huffCode = 0;
     169
     170        for (bitLength = 1; bitLength < 17; bitLength++) {
     171                for (i = 0; i < numCodes; i++) {
     172                        if (huffLength[i] == bitLength) {
     173                                *table++ = (1 << bitLength) - 1;
     174
     175                                uint16 b = huffCode >> (16 - bitLength);
     176                                uint16 a = 0;
     177                                uint16 carry = 0;
     178
     179                                for (j = 0; j < bitLength; j++) {
     180                                        b = rcr(b, &carry);
     181                                        a = rcl(a, &carry);
     182                                       
     183                                }
     184                                *table++ = a;
     185
     186                                *(table+0x1e) = (huffLength[i]<<8)|(i & 0x00FF);
     187                                huffCode += 1 << (16 - bitLength);
     188                        }
     189                }
     190        }
     191}
     192
     193
     194uint16 input_value(uint16 *table)
     195{
     196        uint16 valOne, valTwo, value = bit_buffl;
     197       
     198        do {
     199                valTwo = (*table++) & value;
     200                valOne = *table++;
     201       
     202        } while (valOne != valTwo);     
     203
     204        value = *(table+0x1e);
     205        input_bits((uint8)((value>>8)&0x00FF));
     206        value &= 0x00FF;
     207
     208        if (value >= 2) {
     209                value--;
     210                valOne = input_bits((uint8)value&0x00FF);
     211                valOne |= (1 << value);
     212                value = valOne;
     213        }
     214
     215        return value;
     216}
     217
     218int UnpackM1(void *input, void *output, uint16 key)
     219{
     220        uint8 cl;
     221        uint8 *inputHigh, *outputLow;
     222        uint32 eax, ebx, ecx, edx;       
     223        uint8 *inputptr = (uint8 *)input;
     224
     225        if (CHECKSUMS)
     226                init_crc();
     227
     228        //Check for "RNC "
     229        if (READ_BE_UINT32(inputptr) != 0x524e4301)
     230                return NOT_PACKED;
     231
     232        inputptr += 4;
     233
     234        // read unpacked/packed file length
     235        unpack_len = READ_BE_UINT32(inputptr); inputptr += 4;
     236        pack_len = READ_BE_UINT32(inputptr); inputptr += 4;
     237
     238        blocks = *(inputptr+5);
     239
     240        if (CHECKSUMS) {
     241                //read CRC's
     242                crc_u = READ_BE_UINT16(inputptr); inputptr += 2;
     243                crc_p = READ_BE_UINT16(inputptr); inputptr += 2;
     244               
     245                inputptr = (inputptr+HEADER_LEN-16);
     246               
     247                if (crc_block(inputptr, pack_len) != crc_p)
     248                        return PACKED_CRC;
     249
     250                inputptr = (((uint8 *)input)+HEADER_LEN);
     251                esiptr = inputptr;
     252
     253        }
     254
     255        inputHigh = ((uint8 *)input) + pack_len + HEADER_LEN;;
     256        outputLow = (uint8 *)output;
     257
     258        eax = *(((uint8 *)input)+16) + unpack_len;
     259
     260        if (! ((inputHigh <= outputLow ) || ((outputLow+eax) <= inputHigh )) ) {
     261                esiptr = inputHigh;
     262                ediptr = (outputLow+eax);
     263                memcpy((ediptr-pack_len), (esiptr-pack_len), pack_len);
     264                esiptr = (ediptr-pack_len);
     265        }
     266
     267
     268        //unpack3:
     269        ediptr = (uint8 *)output;
     270        bit_count = 0;
     271
     272        bit_buffl = READ_LE_UINT16(esiptr);
     273        /*eax =*/ input_bits(2);
     274
     275       
     276        //Argh! Labels!!
     277  unpack4:
     278        make_huftable(raw_table);
     279        make_huftable(pos_table);
     280        make_huftable(len_table);
     281
     282        counts = input_bits(16);
     283       
     284        goto unpack6;
     285
     286  unpack5:
     287
     288        eax = input_value(pos_table) + 1; //input offset
     289        ecx = input_value(len_table) + MIN_LENGTH; //input length
     290
     291        inputHigh = esiptr;
     292        esiptr = (ediptr-eax);
     293
     294        //Don't use memcpy here! because input and output overlap       
     295        while (ecx) {
     296                *ediptr++ = *esiptr++; ecx--;
     297        }
     298       
     299        esiptr = inputHigh;
     300
     301  unpack6:
     302       
     303        ecx = input_value(raw_table);
     304
     305        if (ecx == 0)
     306                goto unpack7;
     307
     308        memcpy(ediptr, esiptr, ecx); //memcpy is allowed here
     309        ediptr += ecx;
     310        esiptr += ecx;
     311        cl = bit_count;
     312        eax = READ_LE_UINT16(esiptr);
     313        ebx = eax;
     314        eax = ROL((uint16)eax, cl);
     315        edx = ((1 << cl) - 1) & 0x0000FFFF; //make sure we only get 16bits
     316        bit_buffl &= (uint16)edx;
     317        edx &= eax;
     318
     319        eax = READ_LE_UINT16((esiptr+2));
     320        ebx = (ebx << cl)&0x0000FFFF;
     321        eax = (eax << cl)&0x0000FFFF;
     322        eax |= edx;
     323        bit_buffl |= (uint16)ebx;
     324        bit_buffh = (uint16)eax;
     325 
     326  unpack7:
     327
     328        counts--;
     329        if (counts)
     330                goto unpack5;
     331
     332        blocks--;
     333        if (blocks)
     334                goto unpack4;
     335
     336        if (CHECKSUMS) {
     337                if (crc_block((uint8 *)output, unpack_len) != crc_u)
     338                        return UNPACKED_CRC;
     339        }
     340
     341        // all is done..return the amount of unpacked bytes
     342        return unpack_len;
     343}
  • sky/screen.cpp

    diff -urN scummvm/sky/screen.cpp scummvm-bass/sky/screen.cpp
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include <string.h>
     21#include "common/scummsys.h"
     22#include "sky/skymain.h"
     23#include "include.h"
     24
     25#define fade_jump       2
     26#define scroll_jump     16
     27
     28#define vga_colours     256
     29#define game_colours    240
     30
     31uint8 top_16_colours[] =
     32{
     33    0, 0, 0,
     34    38, 38, 38,
     35    63, 63, 63,
     36    0, 0, 0,
     37    0, 0, 0,
     38    0, 0, 0,
     39    0, 0, 0,
     40    54, 54, 54,
     41    45, 47, 49,
     42    32, 31, 41,
     43    29, 23, 37,
     44    23, 18, 30,
     45    49, 11, 11,
     46    39, 5, 5,
     47    29, 1, 1,
     48    63, 63, 63
     49};
     50
     51void SkyState::initialise_screen(void)
     52{
     53    int i;
     54    uint8 tmp_pal[1024];
     55   
     56    _system->init_size(full_screen_width, full_screen_height);
     57    _backscreen = (uint8 *)malloc(full_screen_width*full_screen_height);
     58    _game_grid = (uint8 *)malloc(GRID_X*GRID_Y*2);
     59    _work_palette = (uint8 *)malloc(vga_colours*3);
     60
     61    //blank the first 240 colors of the palette
     62    bzero(tmp_pal, game_colours*4);   
     63
     64    //set the remaining colors
     65    for (i=0; i<(vga_colours-game_colours); i++) {
     66        tmp_pal[game_colours+i*4] = top_16_colours[i*3] << 2;   
     67        tmp_pal[game_colours+i*4+1] = top_16_colours[i*3+1] << 2;
     68        tmp_pal[game_colours+i*4+2] = top_16_colours[i*3+2] << 2;
     69        tmp_pal[game_colours+i*4+3] = 0x00;
     70    }
     71
     72    //set the palette
     73    _system->set_palette(tmp_pal, 0, 256);
     74
     75}
     76
     77//set a new palette, pal is a pointer to dos vga rgb components 0..63
     78void SkyState::set_palette(uint8 *pal)
     79{
     80    convert_palette(pal, _palette);
     81    _system->set_palette(_palette, 0, 256);
     82}
     83
     84void SkyState::convert_palette(uint8 *inpal, uint8* outpal) //convert 3 byte 0..63 rgb to 4byte 0..255 rgbx
     85{
     86    int i;
     87
     88    for (i = 0; i < vga_colours; i++) {
     89        outpal[4*i] = inpal[3*i] << 2; // +3
     90        outpal[4*i+1] = inpal[3*i+1] << 2; // +3
     91        outpal[4*i+2] = inpal[3*i+2] << 2; // +3
     92        outpal[4*i+3] = 0x00;   
     93    }
     94}
  • sky/skymain.cpp

    diff -urN scummvm/sky/skymain.cpp scummvm-bass/sky/skymain.cpp
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#include "sky/skymain.h"
     21#include "include.h" //game specific defines
     22#include "common/file.h"
     23#include "common/gameDetector.h"
     24#include <errno.h>
     25#include <time.h>
     26
     27#ifdef _WIN32_WCE
     28
     29extern bool toolbar_drawn;
     30extern bool draw_keyboard;
     31
     32#endif
     33
     34static const VersionSettings sky_settings[] = {
     35        /* Beneath a Steel Sky */
     36        {"sky", "Beneath a Steel Sky", GID_SKY_FIRST, 99, 99, 99, 0, "sky.dsk" },
     37        {NULL, NULL, 0, 0, 0, 0, 0, NULL}
     38};
     39
     40const VersionSettings *Engine_SKY_targetList()
     41{
     42        return sky_settings;
     43}
     44
     45Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst)
     46{
     47        return new SkyState(detector, syst);
     48}
     49
     50SkyState::SkyState(GameDetector *detector, OSystem *syst)
     51        : Engine(detector, syst)
     52{
     53        _game = detector->_gameId;
     54
     55        _debugMode = detector->_debugMode;
     56        _debugLevel = detector->_debugLevel;
     57        _language = detector->_language;
     58}
     59
     60SkyState::~SkyState()
     61{
     62       
     63}
     64
     65void SkyState::pollMouseXY()
     66{
     67        _mouse_x = _sdl_mouse_x;
     68        _mouse_y = _sdl_mouse_y;
     69}
     70
     71void SkyState::go()
     72{
     73        if (!_dump_file)
     74                _dump_file = stdout;
     75
     76        initialise();
     77
     78        while (1) {
     79                delay(100);
     80        }
     81}
     82
     83void SkyState::initialise(void)
     84{
     85    //initialise_memory();
     86    //init_timer();
     87    //init_music();
     88    initialise_disk();
     89    initialise_screen();   
     90    init_virgin();
     91   
     92}
     93
     94void SkyState::delay(uint amount) //copied and mutilated from Simon.cpp
     95{
     96        OSystem::Event event;
     97
     98        uint32 start = _system->get_msecs();
     99        uint32 cur = start;
     100
     101        _rnd.getRandomNumber(2);
     102
     103        do {
     104                while (_system->poll_event(&event)) {
     105                        switch (event.event_code) {
     106                                case OSystem::EVENT_KEYDOWN:
     107                                        // Make sure backspace works right (this fixes a small issue on OS X)
     108                                        if (event.kbd.keycode == 8)
     109                                                _key_pressed = 8;
     110                                        else
     111                                                _key_pressed = (byte)event.kbd.ascii;
     112                                        break;
     113
     114                                case OSystem::EVENT_MOUSEMOVE:
     115                                        _sdl_mouse_x = event.mouse.x;
     116                                        _sdl_mouse_y = event.mouse.y;
     117                                        _mouse_pos_changed = true;
     118                                        break;
     119
     120                                        case OSystem::EVENT_LBUTTONDOWN:
     121                                        _left_button_down++;
     122#ifdef _WIN32_WCE
     123                                        _sdl_mouse_x = event.mouse.x;
     124                                        _sdl_mouse_y = event.mouse.y;
     125#endif
     126                                        break;
     127
     128                                case OSystem::EVENT_RBUTTONDOWN:
     129                                       
     130                                        break;
     131                        }
     132                }
     133
     134                if (amount == 0)
     135                        break;
     136
     137                {
     138                        uint this_delay = 20; // 1?
     139                        if (this_delay > amount)
     140                                this_delay = amount;
     141                        _system->delay_msecs(this_delay);
     142                }
     143                cur = _system->get_msecs();
     144        } while (cur < start + amount);
     145}
     146
  • sky/skymain.h

    diff -urN scummvm/sky/skymain.h scummvm-bass/sky/skymain.h
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20#ifndef SKYMAIN_H
     21#define SKYMAIN_H
     22
     23#include <stdio.h>
     24#include "common/engine.h"
     25#include "common/util.h"
     26
     27class SkyState : public Engine {
     28public:
     29       
     30        byte _game;
     31        byte _key_pressed;
     32
     33        uint16 _debugMode;
     34        uint16 _debugLevel;
     35        uint16 _language;
     36        uint _mouse_x, _mouse_y;
     37        uint _mouse_x_old, _mouse_y_old;
     38        bool _mouse_pos_changed;
     39        uint _left_button_down;
     40
     41        uint8 _palette[1024];
     42
     43        int _num_screen_updates;
     44
     45//      int _timer_id;
     46
     47        FILE *_dump_file;
     48
     49        int _number_of_savegames;
     50
     51        int _sdl_mouse_x, _sdl_mouse_y;
     52       
     53        byte *_work_screen;
     54        byte *_backscreen;
     55        byte *_temp_pal;
     56        byte *_work_palette;
     57        byte *_half_palette;
     58
     59        byte *_game_grid;
     60
     61        SkyState(GameDetector *detector, OSystem *syst);
     62        virtual ~SkyState();
     63
     64        void delay(uint amount);
     65        void pollMouseXY();
     66        void go();
     67        void convert_palette(uint8 *inpal, uint8* outpal);     
     68
     69        void initialise();
     70        void initialise_disk();
     71        void initialise_screen();
     72        void set_palette(uint8 *pal);
     73        uint16 *load_file(uint16 file_nr, uint8 *dest);
     74        uint16 *get_file_info(uint16 file_nr);
     75        void init_virgin();
     76        void show_screen();
     77
     78        static int CDECL game_thread_proc(void *param);
     79
     80        void shutdown();
     81       
     82        RandomSource _rnd;
     83
     84
     85};
     86
     87#endif
  • sky/struc.h

    diff -urN scummvm/sky/struc.h scummvm-bass/sky/struc.h
    old new  
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2003 The ScummVM project
     3 *
     4 * This program is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU General Public License
     6 * as published by the Free Software Foundation; either version 2
     7 * of the License, or (at your option) any later version.
     8
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     17 *
     18 */
     19
     20typedef struct s
     21{
     22    uint16 flag; // bit 0: set for colour data, clear for not
     23                 // bit 1: set for compressed, clear for uncompressed
     24                 // bit 2: set for 32 colours, clear for 16 colours
     25    uint16 s_x;
     26    uint16 s_y;
     27    uint16 s_width;
     28    uint16 s_height;
     29    uint16 s_sp_size;
     30    uint16 s_tot_size;
     31    uint16 s_n_sprites;
     32    uint16 s_offset_x;
     33    uint16 s_offset_y;
     34    uint16 s_compressed_size;
     35}s;
     36