Some cleanup, now follows the ScummVM coding guidelines more closely, also added initialiseGrids()
svn-id: r6741
This commit is contained in:
parent
7b9eba2264
commit
e7cb6ddb2e
8 changed files with 297 additions and 166 deletions
154
sky/disk.cpp
154
sky/disk.cpp
|
@ -27,122 +27,120 @@
|
||||||
#include "sky/sky.h"
|
#include "sky/sky.h"
|
||||||
#include "sky/rnc_deco.h"
|
#include "sky/rnc_deco.h"
|
||||||
|
|
||||||
#define no_of_files_hd 1600
|
#define MAX_FILES_IN_LIST 60
|
||||||
#define no_of_files_cd 5200
|
|
||||||
#define max_files_in_list 60
|
|
||||||
|
|
||||||
const char *data_file_name = "sky.dsk";
|
const char *dataFilename = "sky.dsk";
|
||||||
const char *dinner_file_name = "sky.dnr";
|
const char *dinnerFilename = "sky.dnr";
|
||||||
uint8 *dinner_table_area, *fixed_dest, *file_dest, *comp_dest;
|
uint8 *dinnerTableArea, *fixedDest, *fileDest, *compDest;
|
||||||
uint32 dinner_table_entries, file_flags, file_offset, file_size, decomp_size, comp_file;
|
uint32 dinnerTableEntries, fileFlags, fileOffset, fileSize, decompSize, compFile;
|
||||||
uint16 build_list[max_files_in_list];
|
uint16 buildList[MAX_FILES_IN_LIST];
|
||||||
uint32 loaded_file_list[max_files_in_list];
|
uint32 loadedFileList[MAX_FILES_IN_LIST];
|
||||||
|
|
||||||
File *data_disk_handle = new File();
|
File *dataDiskHandle = new File();
|
||||||
File *dnr_handle = new File();
|
File *dnrHandle = new File();
|
||||||
|
|
||||||
void SkyState::initialise_disk()
|
void SkyState::initialiseDisk() {
|
||||||
{
|
|
||||||
uint32 entries_read;
|
|
||||||
|
|
||||||
dnr_handle->open(dinner_file_name, _gameDataPath);
|
uint32 entriesRead;
|
||||||
if (dnr_handle->isOpen() == false)
|
|
||||||
error("Could not open %s%s!\n", _gameDataPath, dinner_file_name);
|
|
||||||
|
|
||||||
if (!(dinner_table_entries = dnr_handle->readUint32LE()))
|
dnrHandle->open(dinnerFilename, _gameDataPath);
|
||||||
|
if (dnrHandle->isOpen() == false)
|
||||||
|
error("Could not open %s%s!\n", _gameDataPath, dinnerFilename);
|
||||||
|
|
||||||
|
if (!(dinnerTableEntries = dnrHandle->readUint32LE()))
|
||||||
error("Error reading from sky.dnr!\n"); //even though it was opened correctly?!
|
error("Error reading from sky.dnr!\n"); //even though it was opened correctly?!
|
||||||
|
|
||||||
debug(1, "Entries in dinner table: %d", dinner_table_entries);
|
debug(1, "Entries in dinner table: %d", dinnerTableEntries);
|
||||||
|
|
||||||
if (dinner_table_entries > 1600)
|
if (dinnerTableEntries > 1600)
|
||||||
_isCDVersion = true;
|
_isCDVersion = true;
|
||||||
else
|
else
|
||||||
_isCDVersion = false;
|
_isCDVersion = false;
|
||||||
|
|
||||||
dinner_table_area = (uint8 *)malloc(dinner_table_entries * 8);
|
dinnerTableArea = (uint8 *)malloc(dinnerTableEntries * 8);
|
||||||
entries_read = dnr_handle->read(dinner_table_area, 8 * dinner_table_entries) / 8;
|
entriesRead = dnrHandle->read(dinnerTableArea, 8 * dinnerTableEntries) / 8;
|
||||||
|
|
||||||
if (entries_read != dinner_table_entries)
|
if (entriesRead != dinnerTableEntries)
|
||||||
warning("bytes_read != dinner_table_entries. [%d/%d]\n", entries_read, dinner_table_entries);
|
warning("entriesRead != dinnerTableEntries. [%d/%d]\n", entriesRead, dinnerTableEntries);
|
||||||
|
|
||||||
data_disk_handle->open(data_file_name, _gameDataPath);
|
dataDiskHandle->open(dataFilename, _gameDataPath);
|
||||||
if (data_disk_handle->isOpen() == false)
|
if (dataDiskHandle->isOpen() == false)
|
||||||
error("Error opening %s%s!\n", _gameDataPath, data_file_name);
|
error("Error opening %s%s!\n", _gameDataPath, dataFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
//load in file file_nr to address dest
|
//load in file file_nr to address dest
|
||||||
//if dest == NULL, then allocate memory for this file
|
//if dest == NULL, then allocate memory for this file
|
||||||
uint16 *SkyState::load_file(uint16 file_nr, uint8 *dest)
|
uint16 *SkyState::loadFile(uint16 fileNr, uint8 *dest) {
|
||||||
{
|
|
||||||
uint8 cflag;
|
uint8 cflag;
|
||||||
int32 bytes_read;
|
int32 bytesRead;
|
||||||
uint8 *file_ptr, *inputPtr, *outputPtr;
|
uint8 *filePtr, *inputPtr, *outputPtr;
|
||||||
dataFileHeader file_header;
|
dataFileHeader fileHeader;
|
||||||
|
|
||||||
#ifdef file_order_chk
|
#ifdef file_order_chk
|
||||||
warning("File order checking not implemented yet!\n");
|
warning("File order checking not implemented yet!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
comp_file = file_nr;
|
compFile = fileNr;
|
||||||
debug(1, "load file %d,%d (%d)", (file_nr >> 11), (file_nr & 2047), file_nr);
|
debug(1, "load file %d,%d (%d)", (fileNr >> 11), (fileNr & 2047), fileNr);
|
||||||
|
|
||||||
file_ptr = (uint8 *)get_file_info(file_nr);
|
filePtr = (uint8 *)getFileInfo(fileNr);
|
||||||
if (file_ptr == NULL) {
|
if (filePtr == NULL) {
|
||||||
printf("File %d not found!\n", file_nr);
|
printf("File %d not found!\n", fileNr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
file_flags = READ_LE_UINT32((file_ptr + 5));
|
fileFlags = READ_LE_UINT32((filePtr + 5));
|
||||||
file_size = file_flags & 0x03fffff;
|
fileSize = fileFlags & 0x03fffff;
|
||||||
|
|
||||||
file_offset = READ_LE_UINT32((file_ptr + 2)) & 0x0ffffff;
|
fileOffset = READ_LE_UINT32((filePtr + 2)) & 0x0ffffff;
|
||||||
|
|
||||||
cflag = (uint8)((file_offset >> (23)) & 0x1);
|
cflag = (uint8)((fileOffset >> (23)) & 0x1);
|
||||||
file_offset = (((1 << (23)) ^ 0xFFFFFFFF) & file_offset);
|
fileOffset = (((1 << (23)) ^ 0xFFFFFFFF) & fileOffset);
|
||||||
|
|
||||||
if (cflag)
|
if (cflag)
|
||||||
file_offset <<= 4;
|
fileOffset <<= 4;
|
||||||
|
|
||||||
fixed_dest = dest;
|
fixedDest = dest;
|
||||||
file_dest = dest;
|
fileDest = dest;
|
||||||
comp_dest = dest;
|
compDest = dest;
|
||||||
|
|
||||||
if (dest == NULL) //we need to allocate memory for this file
|
if (dest == NULL) //we need to allocate memory for this file
|
||||||
file_dest = (uint8 *)malloc(file_size);
|
fileDest = (uint8 *)malloc(fileSize);
|
||||||
|
|
||||||
data_disk_handle->seek(file_offset, SEEK_SET);
|
dataDiskHandle->seek(fileOffset, SEEK_SET);
|
||||||
|
|
||||||
#ifdef file_order_chk
|
#ifdef file_order_chk
|
||||||
warning("File order checking not implemented yet!\n");
|
warning("File order checking not implemented yet!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//now read in the data
|
//now read in the data
|
||||||
bytes_read = data_disk_handle->read(file_dest, 1*file_size);
|
bytesRead = dataDiskHandle->read(fileDest, 1 * fileSize);
|
||||||
|
|
||||||
if (bytes_read != (int32)file_size)
|
if (bytesRead != (int32)fileSize)
|
||||||
printf("ERROR: Unable to read %d bytes from datadisk (%d bytes read)\n", file_size, bytes_read);
|
printf("ERROR: Unable to read %d bytes from datadisk (%d bytes read)\n", fileSize, bytesRead);
|
||||||
|
|
||||||
cflag = (uint8)((file_flags >> (23)) & 0x1);
|
cflag = (uint8)((fileFlags >> (23)) & 0x1);
|
||||||
|
|
||||||
//if cflag == 0 then file is compressed, 1 == uncompressed
|
//if cflag == 0 then file is compressed, 1 == uncompressed
|
||||||
|
|
||||||
if (!cflag) {
|
if (!cflag) {
|
||||||
debug(1, "File is compressed...");
|
debug(1, "File is compressed...");
|
||||||
|
|
||||||
memcpy(&file_header, file_dest, sizeof(struct dataFileHeader));
|
memcpy(&fileHeader, fileDest, sizeof(struct dataFileHeader));
|
||||||
if ( (uint8)((FROM_LE_16(file_header.flag) >> 7) & 0x1) ) {
|
if ( (uint8)((FROM_LE_16(fileHeader.flag) >> 7) & 0x1) ) {
|
||||||
debug(1, "with RNC!");
|
debug(1, "with RNC!");
|
||||||
|
|
||||||
decomp_size = (FROM_LE_16(file_header.flag) & 0xFFFFFF00) << 8;
|
decompSize = (FROM_LE_16(fileHeader.flag) & 0xFFFFFF00) << 8;
|
||||||
decomp_size |= FROM_LE_16((uint16)file_header.s_tot_size);
|
decompSize |= FROM_LE_16((uint16)fileHeader.s_tot_size);
|
||||||
|
|
||||||
if (fixed_dest == NULL) // is this valid?
|
if (fixedDest == NULL) // is this valid?
|
||||||
comp_dest = (uint8 *)malloc(decomp_size);
|
compDest = (uint8 *)malloc(decompSize);
|
||||||
|
|
||||||
inputPtr = file_dest;
|
inputPtr = fileDest;
|
||||||
outputPtr = comp_dest;
|
outputPtr = compDest;
|
||||||
|
|
||||||
if ( (uint8)(file_flags >> (22) & 0x1) ) //do we include the header?
|
if ( (uint8)(fileFlags >> (22) & 0x1) ) //do we include the header?
|
||||||
inputPtr += sizeof(struct dataFileHeader);
|
inputPtr += sizeof(struct dataFileHeader);
|
||||||
else {
|
else {
|
||||||
memcpy(outputPtr, inputPtr, sizeof(struct dataFileHeader));
|
memcpy(outputPtr, inputPtr, sizeof(struct dataFileHeader));
|
||||||
|
@ -156,40 +154,40 @@ uint16 *SkyState::load_file(uint16 file_nr, uint8 *dest)
|
||||||
debug(2, "UnpackM1 returned: %d", unPackLen);
|
debug(2, "UnpackM1 returned: %d", unPackLen);
|
||||||
|
|
||||||
if (unPackLen == 0) { //Unpack returned 0: file was probably not packed.
|
if (unPackLen == 0) { //Unpack returned 0: file was probably not packed.
|
||||||
if (fixed_dest == NULL)
|
if (fixedDest == NULL)
|
||||||
free(comp_dest);
|
free(compDest);
|
||||||
|
|
||||||
return (uint16 *)file_dest;
|
return (uint16 *)fileDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (uint8)(file_flags >> (22) & 0x1) ) { // include header?
|
if (! (uint8)(fileFlags >> (22) & 0x1) ) { // include header?
|
||||||
unPackLen += sizeof(struct dataFileHeader);
|
unPackLen += sizeof(struct dataFileHeader);
|
||||||
|
|
||||||
if (unPackLen != (int32)decomp_size) {
|
if (unPackLen != (int32)decompSize) {
|
||||||
debug(1, "ERROR: invalid decomp size! (was: %d, should be: %d)", unPackLen, decomp_size);
|
debug(1, "ERROR: invalid decomp size! (was: %d, should be: %d)", unPackLen, decompSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixed_dest == NULL)
|
if (fixedDest == NULL)
|
||||||
free(file_dest);
|
free(fileDest);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
debug(1, "but not with RNC! (?!)");
|
debug(1, "but not with RNC! (?!)");
|
||||||
} else
|
} else
|
||||||
return (uint16 *)file_dest;
|
return (uint16 *)fileDest;
|
||||||
|
|
||||||
return (uint16 *)comp_dest;
|
return (uint16 *)compDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 *SkyState::get_file_info(uint16 file_nr)
|
uint16 *SkyState::getFileInfo(uint16 fileNr) {
|
||||||
{
|
|
||||||
uint16 i;
|
uint16 i;
|
||||||
uint16 *dnr_tbl_16_ptr = (uint16 *)dinner_table_area;
|
uint16 *dnrTbl16Ptr = (uint16 *)dinnerTableArea;
|
||||||
|
|
||||||
for (i = 0; i < dinner_table_entries; i++) {
|
for (i = 0; i < dinnerTableEntries; i++) {
|
||||||
if (READ_LE_UINT16(dnr_tbl_16_ptr + (i * 4)) == file_nr) {
|
if (READ_LE_UINT16(dnrTbl16Ptr + (i * 4)) == fileNr) {
|
||||||
debug(1, "file %d found!", file_nr);
|
debug(1, "file %d found!", fileNr);
|
||||||
return (dnr_tbl_16_ptr + (i * 4));
|
return (dnrTbl16Ptr + (i * 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
132
sky/grid.cpp
Normal file
132
sky/grid.cpp
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/* 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"
|
||||||
|
|
||||||
|
#define GRID_FILE_START 60000
|
||||||
|
|
||||||
|
int8 gridConvertTable[] = {
|
||||||
|
|
||||||
|
1, //1
|
||||||
|
2, //2
|
||||||
|
3, //3
|
||||||
|
4, //4
|
||||||
|
5, //5
|
||||||
|
6, //6
|
||||||
|
7, //7
|
||||||
|
8, //8
|
||||||
|
9, //9
|
||||||
|
10, //10
|
||||||
|
11, //11
|
||||||
|
12, //12
|
||||||
|
13, //13
|
||||||
|
14, //14
|
||||||
|
15, //15
|
||||||
|
16, //16
|
||||||
|
17, //17
|
||||||
|
18, //18
|
||||||
|
19, //19
|
||||||
|
20, //20
|
||||||
|
21, //21
|
||||||
|
22, //22
|
||||||
|
23, //23
|
||||||
|
24, //24
|
||||||
|
25, //25
|
||||||
|
26, //26
|
||||||
|
27, //27
|
||||||
|
28, //28
|
||||||
|
29, //29
|
||||||
|
30, //30
|
||||||
|
31, //31
|
||||||
|
32, //32
|
||||||
|
33, //33
|
||||||
|
34, //34
|
||||||
|
-1, //35
|
||||||
|
35, //36
|
||||||
|
36, //37
|
||||||
|
37, //38
|
||||||
|
38, //39
|
||||||
|
39, //40
|
||||||
|
40, //41
|
||||||
|
41, //42
|
||||||
|
-1, //43
|
||||||
|
42, //44
|
||||||
|
43, //45
|
||||||
|
44, //46
|
||||||
|
45, //47
|
||||||
|
46, //48
|
||||||
|
-1, //49
|
||||||
|
-1, //50
|
||||||
|
-1, //51
|
||||||
|
-1, //52
|
||||||
|
-1, //53
|
||||||
|
-1, //54
|
||||||
|
-1, //55
|
||||||
|
-1, //56
|
||||||
|
-1, //57
|
||||||
|
-1, //58
|
||||||
|
-1, //59
|
||||||
|
-1, //60
|
||||||
|
-1, //61
|
||||||
|
-1, //62
|
||||||
|
-1, //63
|
||||||
|
-1, //64
|
||||||
|
47, //65
|
||||||
|
TOT_NO_GRIDS, //66
|
||||||
|
48, //67
|
||||||
|
49, //68
|
||||||
|
50, //69
|
||||||
|
51, //70
|
||||||
|
52, //71
|
||||||
|
53, //72
|
||||||
|
54, //73
|
||||||
|
55, //74
|
||||||
|
56, //75
|
||||||
|
57, //76
|
||||||
|
58, //77
|
||||||
|
59, //78
|
||||||
|
60, //79
|
||||||
|
-1, //80
|
||||||
|
61, //81
|
||||||
|
62, //82
|
||||||
|
-1, //83
|
||||||
|
-1, //84
|
||||||
|
-1, //85
|
||||||
|
-1, //86
|
||||||
|
-1, //87
|
||||||
|
-1, //88
|
||||||
|
TOT_NO_GRIDS, //89
|
||||||
|
63, //90
|
||||||
|
64, //91
|
||||||
|
65, //92
|
||||||
|
66, //93
|
||||||
|
67, //94
|
||||||
|
68, //95
|
||||||
|
69, //96
|
||||||
|
};
|
||||||
|
|
||||||
|
void SkyState::initialiseGrids() {
|
||||||
|
|
||||||
|
_gameGrids = (byte *)malloc(TOT_NO_GRIDS * GRID_SIZE);
|
||||||
|
}
|
||||||
|
|
|
@ -216,25 +216,25 @@ uint32 anim6b_commands[] =
|
||||||
|
|
||||||
uint32 *command_pointer = (uint32 *)zero_commands;
|
uint32 *command_pointer = (uint32 *)zero_commands;
|
||||||
|
|
||||||
void SkyState::init_virgin()
|
void SkyState::initVirgin() {
|
||||||
{
|
|
||||||
_temp_pal = (uint8 *)load_file(60111, NULL);
|
_tempPal = (uint8 *)loadFile(60111, NULL);
|
||||||
if (_temp_pal != NULL)
|
if (_tempPal != NULL)
|
||||||
set_palette(_temp_pal);
|
setPalette(_tempPal);
|
||||||
|
|
||||||
_work_screen = (uint8 *)load_file(60110, NULL);
|
_workScreen = (uint8 *)loadFile(60110, NULL);
|
||||||
|
|
||||||
if (_work_screen != NULL)
|
if (_workScreen != NULL)
|
||||||
show_screen();
|
showScreen();
|
||||||
|
|
||||||
// free the memory that was malloc'ed indirectly via load_file
|
// free the memory that was malloc'ed indirectly via load_file
|
||||||
free(_work_screen);
|
free(_workScreen);
|
||||||
free(_temp_pal);
|
free(_tempPal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::show_screen(void)
|
void SkyState::showScreen(void) {
|
||||||
{
|
|
||||||
_system->copy_rect(_work_screen, 320, 0, 0, 320, 200);
|
_system->copy_rect(_workScreen, 320, 0, 0, 320, 200);
|
||||||
_system->update_screen();
|
_system->update_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ MODULE_OBJS = \
|
||||||
sky/screen.o \
|
sky/screen.o \
|
||||||
sky/intro.o \
|
sky/intro.o \
|
||||||
sky/rnc_deco.o \
|
sky/rnc_deco.o \
|
||||||
|
sky/grid.o \
|
||||||
|
|
||||||
# Include common rules
|
# Include common rules
|
||||||
include common.rules
|
include common.rules
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
#include "sky/skydefs.h"
|
#include "sky/skydefs.h"
|
||||||
#include "sky/sky.h"
|
#include "sky/sky.h"
|
||||||
|
|
||||||
#define fade_jump 2
|
#define FADE_JUMP 2
|
||||||
#define scroll_jump 16
|
#define SCROLL_JUMP 16
|
||||||
|
|
||||||
#define vga_colours 256
|
#define VGA_COLOURS 256
|
||||||
#define game_colours 240
|
#define GAME_COLOURS 240
|
||||||
|
|
||||||
uint8 top_16_colours[] =
|
uint8 top16Colours[] =
|
||||||
{
|
{
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
38, 38, 38,
|
38, 38, 38,
|
||||||
|
@ -51,46 +51,46 @@ uint8 top_16_colours[] =
|
||||||
63, 63, 63
|
63, 63, 63
|
||||||
};
|
};
|
||||||
|
|
||||||
void SkyState::initialise_screen(void)
|
void SkyState::initialiseScreen(void) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
uint8 tmp_pal[1024];
|
uint8 tmpPal[1024];
|
||||||
|
|
||||||
_system->init_size(full_screen_width, full_screen_height);
|
_system->init_size(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
|
||||||
_backscreen = (uint8 *)malloc(full_screen_width * full_screen_height);
|
_backScreen = (uint8 *)malloc(FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
|
||||||
_game_grid = (uint8 *)malloc(GRID_X * GRID_Y * 2);
|
_gameGrid = (uint8 *)malloc(GRID_X * GRID_Y * 2);
|
||||||
_work_palette = (uint8 *)malloc(vga_colours * 3);
|
_workPalette = (uint8 *)malloc(VGA_COLOURS * 3);
|
||||||
|
|
||||||
//blank the first 240 colors of the palette
|
//blank the first 240 colors of the palette
|
||||||
memset(tmp_pal, 0, game_colours * 4);
|
memset(tmpPal, 0, GAME_COLOURS * 4);
|
||||||
|
|
||||||
//set the remaining colors
|
//set the remaining colors
|
||||||
for (i = 0; i < (vga_colours-game_colours); i++) {
|
for (i = 0; i < (VGA_COLOURS-GAME_COLOURS); i++) {
|
||||||
tmp_pal[game_colours + i * 4] = (top_16_colours[i * 3] << 2) + (top_16_colours[i * 3] & 3);
|
tmpPal[GAME_COLOURS + i * 4] = (top16Colours[i * 3] << 2) + (top16Colours[i * 3] & 3);
|
||||||
tmp_pal[game_colours + i * 4 + 1] = (top_16_colours[i * 3 + 1] << 2) + (top_16_colours[i * 3 + 1] & 3);
|
tmpPal[GAME_COLOURS + i * 4 + 1] = (top16Colours[i * 3 + 1] << 2) + (top16Colours[i * 3 + 1] & 3);
|
||||||
tmp_pal[game_colours + i * 4 + 2] = (top_16_colours[i * 3 + 2] << 2) + (top_16_colours[i * 3 + 2] & 3);
|
tmpPal[GAME_COLOURS + i * 4 + 2] = (top16Colours[i * 3 + 2] << 2) + (top16Colours[i * 3 + 2] & 3);
|
||||||
tmp_pal[game_colours + i * 4 + 3] = 0x00;
|
tmpPal[GAME_COLOURS + i * 4 + 3] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the palette
|
//set the palette
|
||||||
_system->set_palette(tmp_pal, 0, 256);
|
_system->set_palette(tmpPal, 0, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set a new palette, pal is a pointer to dos vga rgb components 0..63
|
//set a new palette, pal is a pointer to dos vga rgb components 0..63
|
||||||
void SkyState::set_palette(uint8 *pal)
|
void SkyState::setPalette(uint8 *pal) {
|
||||||
{
|
|
||||||
convert_palette(pal, _palette);
|
convertPalette(pal, _palette);
|
||||||
_system->set_palette(_palette, 0, 256);
|
_system->set_palette(_palette, 0, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::convert_palette(uint8 *inpal, uint8* outpal) //convert 3 byte 0..63 rgb to 4byte 0..255 rgbx
|
void SkyState::convertPalette(uint8 *inPal, uint8* outPal) { //convert 3 byte 0..63 rgb to 4byte 0..255 rgbx
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < vga_colours; i++) {
|
for (i = 0; i < VGA_COLOURS; i++) {
|
||||||
outpal[4 * i] = (inpal[3 * i] << 2) + (inpal[3 * i] & 3);
|
outPal[4 * i] = (inPal[3 * i] << 2) + (inPal[3 * i] & 3);
|
||||||
outpal[4 * i + 1] = (inpal[3 * i + 1] << 2) + (inpal[3 * i + 1] & 3);
|
outPal[4 * i + 1] = (inPal[3 * i + 1] << 2) + (inPal[3 * i + 1] & 3);
|
||||||
outpal[4 * i + 2] = (inpal[3 * i + 2] << 2) + (inpal[3 * i + 2] & 3);
|
outPal[4 * i + 2] = (inPal[3 * i + 2] << 2) + (inPal[3 * i + 2] & 3);
|
||||||
outpal[4 * i + 3] = 0x00;
|
outPal[4 * i + 3] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
37
sky/sky.cpp
37
sky/sky.cpp
|
@ -40,19 +40,17 @@ static const VersionSettings sky_settings[] = {
|
||||||
{NULL, NULL, 0, 0, 0, 0, 0, NULL}
|
{NULL, NULL, 0, 0, 0, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
const VersionSettings *Engine_SKY_targetList()
|
const VersionSettings *Engine_SKY_targetList() {
|
||||||
{
|
|
||||||
return sky_settings;
|
return sky_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst)
|
Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) {
|
||||||
{
|
|
||||||
return new SkyState(detector, syst);
|
return new SkyState(detector, syst);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkyState::SkyState(GameDetector *detector, OSystem *syst)
|
SkyState::SkyState(GameDetector *detector, OSystem *syst)
|
||||||
: Engine(detector, syst)
|
: Engine(detector, syst) {
|
||||||
{
|
|
||||||
_game = detector->_gameId;
|
_game = detector->_gameId;
|
||||||
|
|
||||||
_debugMode = detector->_debugMode;
|
_debugMode = detector->_debugMode;
|
||||||
|
@ -60,19 +58,18 @@ SkyState::SkyState(GameDetector *detector, OSystem *syst)
|
||||||
_language = detector->_language;
|
_language = detector->_language;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkyState::~SkyState()
|
SkyState::~SkyState() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::pollMouseXY()
|
void SkyState::pollMouseXY() {
|
||||||
{
|
|
||||||
_mouse_x = _sdl_mouse_x;
|
_mouse_x = _sdl_mouse_x;
|
||||||
_mouse_y = _sdl_mouse_y;
|
_mouse_y = _sdl_mouse_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::go()
|
void SkyState::go() {
|
||||||
{
|
|
||||||
if (!_dump_file)
|
if (!_dump_file)
|
||||||
_dump_file = stdout;
|
_dump_file = stdout;
|
||||||
|
|
||||||
|
@ -83,18 +80,20 @@ void SkyState::go()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::initialise(void)
|
void SkyState::initialise(void) {
|
||||||
{
|
|
||||||
//initialise_memory();
|
//initialise_memory();
|
||||||
//init_timer();
|
//init_timer();
|
||||||
//init_music();
|
//init_music();
|
||||||
initialise_disk();
|
initialiseDisk();
|
||||||
initialise_screen();
|
initialiseScreen();
|
||||||
init_virgin();
|
initVirgin();
|
||||||
|
//initMouse();
|
||||||
|
initialiseGrids();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::delay(uint amount) //copied and mutilated from Simon.cpp
|
void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp
|
||||||
{
|
|
||||||
OSystem::Event event;
|
OSystem::Event event;
|
||||||
|
|
||||||
uint32 start = _system->get_msecs();
|
uint32 start = _system->get_msecs();
|
||||||
|
|
34
sky/sky.h
34
sky/sky.h
|
@ -43,7 +43,7 @@ protected:
|
||||||
|
|
||||||
uint8 _palette[1024];
|
uint8 _palette[1024];
|
||||||
|
|
||||||
int _num_screen_updates;
|
int _numScreenUpdates;
|
||||||
|
|
||||||
// int _timer_id;
|
// int _timer_id;
|
||||||
|
|
||||||
|
@ -53,14 +53,15 @@ protected:
|
||||||
|
|
||||||
int _sdl_mouse_x, _sdl_mouse_y;
|
int _sdl_mouse_x, _sdl_mouse_y;
|
||||||
|
|
||||||
byte *_work_screen;
|
byte *_workScreen;
|
||||||
byte *_backscreen;
|
byte *_backScreen;
|
||||||
byte *_temp_pal;
|
byte *_tempPal;
|
||||||
byte *_work_palette;
|
byte *_workPalette;
|
||||||
byte *_half_palette;
|
byte *_halfPalette;
|
||||||
|
|
||||||
byte *_game_grid;
|
|
||||||
|
|
||||||
|
byte *_gameGrid;
|
||||||
|
byte *_gameGrids;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SkyState(GameDetector *detector, OSystem *syst);
|
SkyState(GameDetector *detector, OSystem *syst);
|
||||||
virtual ~SkyState();
|
virtual ~SkyState();
|
||||||
|
@ -69,16 +70,17 @@ protected:
|
||||||
void delay(uint amount);
|
void delay(uint amount);
|
||||||
void pollMouseXY();
|
void pollMouseXY();
|
||||||
void go();
|
void go();
|
||||||
void convert_palette(uint8 *inpal, uint8* outpal);
|
void convertPalette(uint8 *inpal, uint8* outpal);
|
||||||
|
|
||||||
void initialise();
|
void initialise();
|
||||||
void initialise_disk();
|
void initialiseDisk();
|
||||||
void initialise_screen();
|
void initialiseScreen();
|
||||||
void set_palette(uint8 *pal);
|
void initialiseGrids();
|
||||||
uint16 *load_file(uint16 file_nr, uint8 *dest);
|
void setPalette(uint8 *pal);
|
||||||
uint16 *get_file_info(uint16 file_nr);
|
uint16 *loadFile(uint16 fileNr, uint8 *dest);
|
||||||
void init_virgin();
|
uint16 *getFileInfo(uint16 fileNr);
|
||||||
void show_screen();
|
void initVirgin();
|
||||||
|
void showScreen();
|
||||||
|
|
||||||
static int CDECL game_thread_proc(void *param);
|
static int CDECL game_thread_proc(void *param);
|
||||||
|
|
||||||
|
|
|
@ -23,18 +23,17 @@
|
||||||
|
|
||||||
//This file is incomplete, several flags still missing.
|
//This file is incomplete, several flags still missing.
|
||||||
|
|
||||||
#define key_buffer_size 80
|
#define KEY_BUFFER_SIZE 80
|
||||||
#define sequence_count 3
|
#define SEQUENCE_COUNT 3
|
||||||
|
|
||||||
//screen/grid defines
|
//screen/grid defines
|
||||||
#define game_screen_width 320
|
#define GAME_SCREEN_WIDTH 320
|
||||||
#define game_screen_height 192
|
#define GAME_SCREEN_HEIGHT 192
|
||||||
#define full_screen_width 320
|
#define FULL_SCREEN_WIDTH 320
|
||||||
#define full_screen_height 200
|
#define FULL_SCREEN_HEIGHT 200
|
||||||
|
|
||||||
#define tot_no_grids 70
|
#define TOT_NO_GRIDS 70 //total no. of grids supported
|
||||||
|
#define GRID_SIZE 120 //grid size in bytes
|
||||||
#define grid_size 120
|
|
||||||
|
|
||||||
#define GRID_X 20
|
#define GRID_X 20
|
||||||
#define GRID_Y 24
|
#define GRID_Y 24
|
||||||
|
@ -44,8 +43,8 @@
|
||||||
#define GRID_W_SHIFT 4
|
#define GRID_W_SHIFT 4
|
||||||
#define GRID_H_SHIFT 3
|
#define GRID_H_SHIFT 3
|
||||||
|
|
||||||
#define top_left_x 128
|
#define TOP_LEFT_X 128
|
||||||
#define top_left_y 136
|
#define TOP_LEFT_Y 136
|
||||||
|
|
||||||
//item list defines
|
//item list defines
|
||||||
#define section_0_item 119
|
#define section_0_item 119
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue