indention fixed
svn-id: r6704
This commit is contained in:
parent
b525feba24
commit
32b84fe2ba
4 changed files with 240 additions and 243 deletions
281
sky/disk.cpp
281
sky/disk.cpp
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#define no_of_files_hd 1600
|
#define no_of_files_hd 1600
|
||||||
#define no_of_files_cd 5200
|
#define no_of_files_cd 5200
|
||||||
#define max_files_in_list 60
|
#define max_files_in_list 60
|
||||||
|
|
||||||
int UnpackM1(void *, void *, uint16);
|
int UnpackM1(void *, void *, uint16);
|
||||||
|
|
||||||
|
@ -44,169 +44,166 @@ File *dnr_handle = new File();
|
||||||
|
|
||||||
void SkyState::initialise_disk()
|
void SkyState::initialise_disk()
|
||||||
{
|
{
|
||||||
uint32 entries_read;
|
uint32 entries_read;
|
||||||
|
|
||||||
dnr_handle->open(dinner_file_name, _gameDataPath);
|
|
||||||
if (dnr_handle->isOpen() == false)
|
|
||||||
error("Could not open %s%s!\n", _gameDataPath, dinner_file_name);
|
|
||||||
|
|
||||||
if (!(dinner_table_size = dnr_handle->readUint32LE()))
|
|
||||||
error("Error reading from sky.dnr!\n"); //even though it was opened correctly?!
|
|
||||||
|
|
||||||
debug(1, "Entries in dinner table: %d", dinner_table_size);
|
|
||||||
|
|
||||||
dinner_table_area = (uint8 *)malloc(dinner_table_size*8);
|
|
||||||
entries_read = dnr_handle->read(dinner_table_area, 8*dinner_table_size) / 8;
|
|
||||||
|
|
||||||
if (entries_read != dinner_table_size)
|
dnr_handle->open(dinner_file_name, _gameDataPath);
|
||||||
warning("bytes_read != dinner_table_entries. [%d/%d]\n", entries_read, dinner_table_size);
|
if (dnr_handle->isOpen() == false)
|
||||||
|
error("Could not open %s%s!\n", _gameDataPath, dinner_file_name);
|
||||||
data_disk_handle->open(data_file_name, _gameDataPath);
|
|
||||||
if (data_disk_handle->isOpen() == false)
|
if (!(dinner_table_size = dnr_handle->readUint32LE()))
|
||||||
error("Error opening %s%s!\n", _gameDataPath, data_file_name);
|
error("Error reading from sky.dnr!\n"); //even though it was opened correctly?!
|
||||||
|
|
||||||
|
debug(1, "Entries in dinner table: %d", dinner_table_size);
|
||||||
|
|
||||||
|
dinner_table_area = (uint8 *)malloc(dinner_table_size*8);
|
||||||
|
entries_read = dnr_handle->read(dinner_table_area, 8*dinner_table_size) / 8;
|
||||||
|
|
||||||
|
if (entries_read != dinner_table_size)
|
||||||
|
warning("bytes_read != dinner_table_entries. [%d/%d]\n", entries_read, dinner_table_size);
|
||||||
|
|
||||||
|
data_disk_handle->open(data_file_name, _gameDataPath);
|
||||||
|
if (data_disk_handle->isOpen() == false)
|
||||||
|
error("Error opening %s%s!\n", _gameDataPath, data_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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::load_file(uint16 file_nr, uint8 *dest)
|
||||||
{
|
{
|
||||||
uint8 cflag;
|
uint8 cflag;
|
||||||
uint32 eax, ecx;
|
uint32 eax, ecx;
|
||||||
int32 bytes_read;
|
int32 bytes_read;
|
||||||
uint8 *file_ptr, *esiptr, *ediptr;
|
uint8 *file_ptr, *esiptr, *ediptr;
|
||||||
dataFileHeader file_header;
|
dataFileHeader file_header;
|
||||||
|
|
||||||
#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;
|
comp_file = file_nr;
|
||||||
debug(1, "load file %d,%d (%d)", (file_nr>>11), (file_nr&2047), file_nr);
|
debug(1, "load file %d,%d (%d)", (file_nr>>11), (file_nr&2047), file_nr);
|
||||||
|
|
||||||
|
|
||||||
file_ptr = (uint8 *)get_file_info(file_nr);
|
|
||||||
if (file_ptr == NULL) {
|
|
||||||
printf("File %d not found!\n", file_nr);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
eax = READ_LE_UINT32((file_ptr+5));
|
|
||||||
file_flags = eax;
|
|
||||||
eax &= 0x03fffff;
|
|
||||||
file_size = eax;
|
|
||||||
|
|
||||||
ecx = READ_LE_UINT32((file_ptr+2));
|
|
||||||
ecx &= 0x0ffffff;
|
|
||||||
|
|
||||||
cflag = (uint8)((ecx >> (23)) & 0x1);
|
|
||||||
ecx = (((1 << (23)) ^ 0xFFFFFFFF) & ecx);
|
|
||||||
|
|
||||||
if (cflag)
|
|
||||||
ecx = ecx << 4;
|
|
||||||
|
|
||||||
file_offset = ecx;
|
|
||||||
fixed_dest = dest;
|
file_ptr = (uint8 *)get_file_info(file_nr);
|
||||||
file_dest = dest;
|
if (file_ptr == NULL) {
|
||||||
comp_dest = dest;
|
printf("File %d not found!\n", file_nr);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
eax = READ_LE_UINT32((file_ptr+5));
|
||||||
|
file_flags = eax;
|
||||||
|
eax &= 0x03fffff;
|
||||||
|
file_size = eax;
|
||||||
|
|
||||||
if (dest == NULL) //we need to allocate memory for this file
|
ecx = READ_LE_UINT32((file_ptr+2));
|
||||||
file_dest = (uint8 *)malloc(eax);
|
ecx &= 0x0ffffff;
|
||||||
|
|
||||||
data_disk_handle->seek(file_offset, SEEK_SET);
|
|
||||||
|
|
||||||
#ifdef file_order_chk
|
cflag = (uint8)((ecx >> (23)) & 0x1);
|
||||||
warning("File order checking not implemented yet!\n");
|
ecx = (((1 << (23)) ^ 0xFFFFFFFF) & ecx);
|
||||||
#endif
|
|
||||||
|
if (cflag)
|
||||||
//now read in the data
|
ecx = ecx << 4;
|
||||||
bytes_read = data_disk_handle->read(file_dest, 1*file_size);
|
|
||||||
|
|
||||||
if (bytes_read != (int32)file_size)
|
|
||||||
printf("ERROR: Unable to read %d bytes from datadisk (%d bytes read)\n", file_size, bytes_read);
|
|
||||||
|
|
||||||
cflag = (uint8)((file_flags >> (23)) & 0x1);
|
|
||||||
|
|
||||||
//if cflag == 0 then file is compressed, 1 == uncompressed
|
|
||||||
|
|
||||||
if (!cflag)
|
|
||||||
{
|
|
||||||
debug(1, "File is compressed...");
|
|
||||||
|
|
||||||
memcpy(&file_header, file_dest, sizeof(struct dataFileHeader));
|
|
||||||
if ( (uint8)((FROM_LE_16(file_header.flag) >> 7) & 0x1) ) {
|
|
||||||
debug(1, "with RNC!");
|
|
||||||
|
|
||||||
eax = FROM_LE_16(file_header.flag);
|
|
||||||
eax &= 0xFFFFFF00; //clear al
|
|
||||||
eax = eax << 8;
|
|
||||||
eax |= FROM_LE_16((uint16)file_header.s_tot_size);
|
|
||||||
|
|
||||||
decomp_size = eax;
|
|
||||||
|
|
||||||
if (fixed_dest == NULL) // is this valid?
|
|
||||||
comp_dest = (uint8 *)malloc(eax);
|
|
||||||
|
|
||||||
esiptr = file_dest;
|
|
||||||
ediptr = comp_dest;
|
|
||||||
|
|
||||||
if ( (uint8)(file_flags >> (22) & 0x1) ) //do we include the header?
|
file_offset = ecx;
|
||||||
esiptr += sizeof(struct dataFileHeader);
|
fixed_dest = dest;
|
||||||
else {
|
file_dest = dest;
|
||||||
memcpy(ediptr, esiptr, sizeof(struct dataFileHeader));
|
comp_dest = dest;
|
||||||
esiptr += sizeof(struct dataFileHeader);
|
|
||||||
ediptr += sizeof(struct dataFileHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
eax = UnpackM1(esiptr, ediptr, 0);
|
if (dest == NULL) //we need to allocate memory for this file
|
||||||
|
file_dest = (uint8 *)malloc(eax);
|
||||||
debug(2, "UnpackM1 returned: %d", eax);
|
|
||||||
|
data_disk_handle->seek(file_offset, SEEK_SET);
|
||||||
|
|
||||||
if (eax == 0) { //Unpack returned 0: file was probably not packed.
|
#ifdef file_order_chk
|
||||||
if (fixed_dest == NULL)
|
warning("File order checking not implemented yet!\n");
|
||||||
free(comp_dest);
|
#endif
|
||||||
|
|
||||||
return (uint16 *)file_dest;
|
//now read in the data
|
||||||
}
|
bytes_read = data_disk_handle->read(file_dest, 1*file_size);
|
||||||
|
|
||||||
if (! (uint8)(file_flags >> (22) & 0x1) ) { //include header?
|
if (bytes_read != (int32)file_size)
|
||||||
eax += sizeof(struct dataFileHeader);
|
printf("ERROR: Unable to read %d bytes from datadisk (%d bytes read)\n", file_size, bytes_read);
|
||||||
|
|
||||||
if (eax != decomp_size)
|
cflag = (uint8)((file_flags >> (23)) & 0x1);
|
||||||
{
|
|
||||||
debug(1, "ERROR: invalid decomp size! (was: %d, should be: %d)", eax, decomp_size);
|
//if cflag == 0 then file is compressed, 1 == uncompressed
|
||||||
|
|
||||||
|
if (!cflag)
|
||||||
|
{
|
||||||
|
debug(1, "File is compressed...");
|
||||||
|
|
||||||
|
memcpy(&file_header, file_dest, sizeof(struct dataFileHeader));
|
||||||
|
if ( (uint8)((FROM_LE_16(file_header.flag) >> 7) & 0x1) ) {
|
||||||
|
debug(1, "with RNC!");
|
||||||
|
|
||||||
|
eax = FROM_LE_16(file_header.flag);
|
||||||
|
eax &= 0xFFFFFF00; //clear al
|
||||||
|
eax = eax << 8;
|
||||||
|
eax |= FROM_LE_16((uint16)file_header.s_tot_size);
|
||||||
|
|
||||||
|
decomp_size = eax;
|
||||||
|
|
||||||
|
if (fixed_dest == NULL) // is this valid?
|
||||||
|
comp_dest = (uint8 *)malloc(eax);
|
||||||
|
|
||||||
|
esiptr = file_dest;
|
||||||
|
ediptr = comp_dest;
|
||||||
|
|
||||||
|
if ( (uint8)(file_flags >> (22) & 0x1) ) //do we include the header?
|
||||||
|
esiptr += sizeof(struct dataFileHeader);
|
||||||
|
else {
|
||||||
|
memcpy(ediptr, esiptr, sizeof(struct dataFileHeader));
|
||||||
|
esiptr += sizeof(struct dataFileHeader);
|
||||||
|
ediptr += sizeof(struct dataFileHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
eax = UnpackM1(esiptr, ediptr, 0);
|
||||||
|
|
||||||
|
debug(2, "UnpackM1 returned: %d", eax);
|
||||||
|
|
||||||
|
if (eax == 0) { //Unpack returned 0: file was probably not packed.
|
||||||
|
if (fixed_dest == NULL)
|
||||||
|
free(comp_dest);
|
||||||
|
|
||||||
|
return (uint16 *)file_dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (uint8)(file_flags >> (22) & 0x1) ) { // include header?
|
||||||
|
eax += sizeof(struct dataFileHeader);
|
||||||
|
|
||||||
|
if (eax != decomp_size) {
|
||||||
|
debug(1, "ERROR: invalid decomp size! (was: %d, should be: %d)", eax, decomp_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fixed_dest == NULL)
|
||||||
|
free(file_dest);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
debug(1, "but not with RNC! (?!)");
|
||||||
if (fixed_dest == NULL)
|
|
||||||
free(file_dest);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
debug(1, "but not with RNC! (?!)");
|
return (uint16 *)file_dest;
|
||||||
|
|
||||||
}
|
return (uint16 *)comp_dest;
|
||||||
else
|
|
||||||
return (uint16 *)file_dest;
|
|
||||||
|
|
||||||
return (uint16 *)comp_dest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 *SkyState::get_file_info(uint16 file_nr)
|
uint16 *SkyState::get_file_info(uint16 file_nr)
|
||||||
{
|
{
|
||||||
uint16 i;
|
uint16 i;
|
||||||
uint16 *dnr_tbl_16_ptr = (uint16 *)dinner_table_area;
|
uint16 *dnr_tbl_16_ptr = (uint16 *)dinner_table_area;
|
||||||
|
|
||||||
for (i = 0; i < dinner_table_size/2; i++)
|
for (i = 0; i < dinner_table_size/2; i++) {
|
||||||
{
|
if (READ_LE_UINT16(dnr_tbl_16_ptr+(i*4)) == file_nr) {
|
||||||
if (READ_LE_UINT16(dnr_tbl_16_ptr+(i*4)) == file_nr)
|
debug(1, "file %d found!", file_nr);
|
||||||
{
|
return (dnr_tbl_16_ptr+(i*4));
|
||||||
debug(1, "file %d found!", file_nr);
|
}
|
||||||
return (dnr_tbl_16_ptr+(i*4));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// if file is speech file then return NULL if not found
|
||||||
//if file is speech file then return NULL if not found
|
printf("get_file_info() - speech file support not implemented yet!\n");
|
||||||
printf("get_file_info() - speech file support not implemented yet!\n");
|
return (uint16 *)NULL;
|
||||||
return (uint16 *)NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,38 +25,38 @@
|
||||||
#include "sky/skydefs.h"
|
#include "sky/skydefs.h"
|
||||||
#include "sky/sky.h"
|
#include "sky/sky.h"
|
||||||
|
|
||||||
#define intro_text_width 128
|
#define intro_text_width 128
|
||||||
|
|
||||||
#define fn_a_pal 60080
|
#define fn_a_pal 60080
|
||||||
#define fn_1a_log 60081
|
#define fn_1a_log 60081
|
||||||
#define fn_1a 60082
|
#define fn_1a 60082
|
||||||
#define fn_1b 60083
|
#define fn_1b 60083
|
||||||
#define fn_1c 60084
|
#define fn_1c 60084
|
||||||
#define fn_1d 60085
|
#define fn_1d 60085
|
||||||
#define fn_1e 60086
|
#define fn_1e 60086
|
||||||
#define fn_4a 60087
|
#define fn_4a 60087
|
||||||
#define fn_4b_log 60088
|
#define fn_4b_log 60088
|
||||||
#define fn_4b 60089
|
#define fn_4b 60089
|
||||||
#define fn_4c_log 60090
|
#define fn_4c_log 60090
|
||||||
#define fn_4c 60091
|
#define fn_4c 60091
|
||||||
#define fn_5_pal 60092
|
#define fn_5_pal 60092
|
||||||
#define fn_5_log 60093
|
#define fn_5_log 60093
|
||||||
#define fn_5 60094
|
#define fn_5 60094
|
||||||
#define fn_6_pal 60095
|
#define fn_6_pal 60095
|
||||||
#define fn_6_log 60096
|
#define fn_6_log 60096
|
||||||
#define fn_6a 60097
|
#define fn_6a 60097
|
||||||
#define fn_6b 60098
|
#define fn_6b 60098
|
||||||
|
|
||||||
#ifdef short_intro_start
|
#ifdef short_intro_start
|
||||||
#define virgin_time_1 3
|
#define virgin_time_1 3
|
||||||
#define viring_time_2 3
|
#define viring_time_2 3
|
||||||
#define rev_time 8
|
#define rev_time 8
|
||||||
#define gibb_time 6
|
#define gibb_time 6
|
||||||
#else
|
#else
|
||||||
#define virgin_time_1 (3*50)
|
#define virgin_time_1 (3*50)
|
||||||
#define virgin_time_2 ((3*50)+8)
|
#define virgin_time_2 ((3*50)+8)
|
||||||
#define rev_time ((8*50)+8)
|
#define rev_time ((8*50)+8)
|
||||||
#define gibb_time ((6*50)+8)
|
#define gibb_time ((6*50)+8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void prepare_text(void);
|
void prepare_text(void);
|
||||||
|
@ -85,20 +85,20 @@ uint8 *work_base;
|
||||||
uint8 *work_screen;
|
uint8 *work_screen;
|
||||||
uint8 *work_screen_end;
|
uint8 *work_screen_end;
|
||||||
|
|
||||||
uint8 *intro_text_space; //space for storing text messages
|
uint8 *intro_text_space; //space for storing text messages
|
||||||
uint8 *intro_text_save; //save screen data here
|
uint8 *intro_text_save; //save screen data here
|
||||||
|
|
||||||
uint8 *vga_pointer;
|
uint8 *vga_pointer;
|
||||||
uint8 *diff_pointer;
|
uint8 *diff_pointer;
|
||||||
|
|
||||||
uint32 no_frames; //number of frames in scrolling intro
|
uint32 no_frames; //number of frames in scrolling intro
|
||||||
uint32 frame_counter;
|
uint32 frame_counter;
|
||||||
|
|
||||||
#define ic_prepare_text 0
|
#define ic_prepare_text 0
|
||||||
#define ic_show_text 1
|
#define ic_show_text 1
|
||||||
#define ic_remove_text 2
|
#define ic_remove_text 2
|
||||||
#define ic_make_sound 3
|
#define ic_make_sound 3
|
||||||
#define ic_fx_volume 4
|
#define ic_fx_volume 4
|
||||||
|
|
||||||
|
|
||||||
typedef void (*pfc)(void);
|
typedef void (*pfc)(void);
|
||||||
|
@ -106,7 +106,7 @@ pfc command_routines[] = { &prepare_text, &show_intro_text, &remove_text, &intro
|
||||||
|
|
||||||
uint32 cockpit_commands[] =
|
uint32 cockpit_commands[] =
|
||||||
{
|
{
|
||||||
1000, //do straight away
|
1000, //do straight away
|
||||||
ic_prepare_text,
|
ic_prepare_text,
|
||||||
77,
|
77,
|
||||||
220,
|
220,
|
||||||
|
@ -223,22 +223,22 @@ void SkyState::init_virgin()
|
||||||
{
|
{
|
||||||
_temp_pal = (uint8 *)load_file(60111, NULL);
|
_temp_pal = (uint8 *)load_file(60111, NULL);
|
||||||
if (_temp_pal != NULL)
|
if (_temp_pal != NULL)
|
||||||
set_palette(_temp_pal);
|
set_palette(_temp_pal);
|
||||||
|
|
||||||
_work_screen = (uint8 *)load_file(60110, NULL);
|
_work_screen = (uint8 *)load_file(60110, NULL);
|
||||||
|
|
||||||
if (_work_screen != NULL)
|
if (_work_screen != NULL)
|
||||||
show_screen();
|
show_screen();
|
||||||
|
|
||||||
//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(_work_screen);
|
||||||
free (_temp_pal);
|
free(_temp_pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::show_screen(void)
|
void SkyState::show_screen(void)
|
||||||
{
|
{
|
||||||
_system->copy_rect(_work_screen, 320, 0, 0, 320, 200);
|
_system->copy_rect(_work_screen, 320, 0, 0, 320, 200);
|
||||||
_system->update_screen();
|
_system->update_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare_text(void)
|
void prepare_text(void)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
|
@ -25,73 +25,73 @@
|
||||||
#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 top_16_colours[] =
|
||||||
{
|
{
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
38, 38, 38,
|
38, 38, 38,
|
||||||
63, 63, 63,
|
63, 63, 63,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
54, 54, 54,
|
54, 54, 54,
|
||||||
45, 47, 49,
|
45, 47, 49,
|
||||||
32, 31, 41,
|
32, 31, 41,
|
||||||
29, 23, 37,
|
29, 23, 37,
|
||||||
23, 18, 30,
|
23, 18, 30,
|
||||||
49, 11, 11,
|
49, 11, 11,
|
||||||
39, 5, 5,
|
39, 5, 5,
|
||||||
29, 1, 1,
|
29, 1, 1,
|
||||||
63, 63, 63
|
63, 63, 63
|
||||||
};
|
};
|
||||||
|
|
||||||
void SkyState::initialise_screen(void)
|
void SkyState::initialise_screen(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8 tmp_pal[1024];
|
uint8 tmp_pal[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);
|
_game_grid = (uint8 *)malloc(GRID_X*GRID_Y*2);
|
||||||
_work_palette = (uint8 *)malloc(vga_colours*3);
|
_work_palette = (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(tmp_pal, 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);
|
tmp_pal[game_colours+i*4] = (top_16_colours[i*3] << 2) + (top_16_colours[i*3] & 3);
|
||||||
tmp_pal[game_colours+i*4+1] = (top_16_colours[i*3+1] << 2) + (top_16_colours[i*3+1] & 3);
|
tmp_pal[game_colours+i*4+1] = (top_16_colours[i*3+1] << 2) + (top_16_colours[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);
|
tmp_pal[game_colours+i*4+2] = (top_16_colours[i*3+2] << 2) + (top_16_colours[i*3+2] & 3);
|
||||||
tmp_pal[game_colours+i*4+3] = 0x00;
|
tmp_pal[game_colours+i*4+3] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the palette
|
//set the palette
|
||||||
_system->set_palette(tmp_pal, 0, 256);
|
_system->set_palette(tmp_pal, 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::set_palette(uint8 *pal)
|
||||||
{
|
{
|
||||||
convert_palette(pal, _palette);
|
convert_palette(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::convert_palette(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
sky/sky.cpp
18
sky/sky.cpp
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
|
@ -57,7 +57,7 @@ SkyState::SkyState(GameDetector *detector, OSystem *syst)
|
||||||
|
|
||||||
_debugMode = detector->_debugMode;
|
_debugMode = detector->_debugMode;
|
||||||
_debugLevel = detector->_debugLevel;
|
_debugLevel = detector->_debugLevel;
|
||||||
_language = detector->_language;
|
_language = detector->_language;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkyState::~SkyState()
|
SkyState::~SkyState()
|
||||||
|
@ -85,13 +85,13 @@ 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();
|
initialise_disk();
|
||||||
initialise_screen();
|
initialise_screen();
|
||||||
init_virgin();
|
init_virgin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyState::delay(uint amount) //copied and mutilated from Simon.cpp
|
void SkyState::delay(uint amount) //copied and mutilated from Simon.cpp
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue