From 50486480cbce7b38b976d9f339e6d86aa880ddd5 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 7 Oct 2005 06:59:49 +0000 Subject: FF starts VGA script. svn-id: r18953 --- simon/saveload.cpp | 7 ++++++- simon/simon.cpp | 30 ++++++++++++++++++++++-------- simon/vga.cpp | 16 ++++++++++++++-- simon/vga.h | 26 ++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 11 deletions(-) diff --git a/simon/saveload.cpp b/simon/saveload.cpp index 8d09144477..4cee4631f0 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -487,7 +487,12 @@ bool SimonEngine::save_game(uint slot, char *caption) { char *SimonEngine::gen_savename(int slot) { static char buf[15]; - if (_game & GF_SIMON2) { + if (_game == GAME_FEEBLEFILES) { + if (slot == 999) + sprintf(buf, "save.%.3d", slot); + else + sprintf(buf, "feeble.%.3d", slot); + } else if (_game & GF_SIMON2) { sprintf(buf, "simon2.%.3d", slot); } else { sprintf(buf, "simon1.%.3d", slot); diff --git a/simon/simon.cpp b/simon/simon.cpp index cd5032ac46..06fc1d4a3e 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -75,7 +75,7 @@ static const SimonGameSettings simon_settings[] = { {"simon2mac", "Simon the Sorcerer 2 Talkie (Amiga or Mac)", GAME_SIMON2WIN, 0}, {"simon1cd32", "Simon the Sorcerer 1 Talkie (Amiga CD32)", GAME_SIMON1CD32, "gameamiga"}, {"simon1demo", "Simon the Sorcerer 1 (DOS Demo)", GAME_SIMON1DEMO, "GDEMO"}, - {"ff", "The Feeble Files", GAME_FEEBLEFILES, "GAME22"}, + {"feeble", "The Feeble Files", GAME_FEEBLEFILES, "GAME22"}, {NULL, NULL, 0, NULL} }; @@ -2477,7 +2477,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { uint num, num_lines; VgaPointersEntry *vpe; byte *bb, *b; - uint16 c; + // uint16 c; const byte *vc_ptr_org; _windowNum = mode; @@ -2510,12 +2510,22 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { // ensure flipping complete bb = _curVgaFile1; - b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start); - c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1); - b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs); - while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id) - b += sizeof(VgaFile1Struct0x8); + if (_game == GAME_FEEBLEFILES) { + b = bb + READ_LE_UINT16(&((FFVgaFile1Header *) bb)->hdr2_start); + //c = READ_LE_UINT16(&((FFVgaFile1Header2 *) b)->unk1); + b = bb + READ_LE_UINT16(&((FFVgaFile1Header2 *) b)->unk2_offs); + + while (READ_LE_UINT16(&((FFVgaFile1Struct0x8 *) b)->id) != vga_res_id) + b += sizeof(FFVgaFile1Struct0x8); + } else { + b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start); + //c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1); + b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs); + + while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id) + b += sizeof(VgaFile1Struct0x8); + } if (!(_game & GF_SIMON2)) { if (num == 16300) { @@ -2534,7 +2544,11 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { vc_ptr_org = _vcPtr; - _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs); + if (_game == GAME_FEEBLEFILES) { + _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((FFVgaFile1Struct0x8 *) b)->script_offs); + } else { + _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs); + } //dump_vga_script(_vcPtr, num, vga_res_id); run_vga_script(); _vcPtr = vc_ptr_org; diff --git a/simon/vga.cpp b/simon/vga.cpp index 937da0b117..72ac5e6e95 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -147,7 +147,12 @@ int SimonEngine::vc_read_var_or_word() { } uint SimonEngine::vc_read_next_word() { - uint a = READ_BE_UINT16(_vcPtr); + uint a; + if (_game == GAME_FEEBLEFILES) { + a = READ_LE_UINT16(_vcPtr); + } else { + a = READ_BE_UINT16(_vcPtr); + } _vcPtr += 2; return a; } @@ -623,10 +628,17 @@ void SimonEngine::vc10_draw() { p2 = _curVgaFile2 + state.image * 8; state.depack_src = _curVgaFile2 + READ_BE_UINT32(p2); - width = READ_BE_UINT16(p2 + 6) >> 4; + if (_game == GAME_FEEBLEFILES) { + width = READ_LE_UINT16(p2 + 6); + } else { + width = READ_BE_UINT16(p2 + 6) >> 4; + } + height = p2[5]; flags = p2[4]; + debug(1, "Width %d Height %d Flags 0x%x\n", width, height, flags); + if (height == 0 || width == 0) return; diff --git a/simon/vga.h b/simon/vga.h index e20f32f034..bdf78f5cc7 100644 --- a/simon/vga.h +++ b/simon/vga.h @@ -28,6 +28,32 @@ namespace Simon { #pragma START_PACK_STRUCTS #endif +// Feeble Files +struct FFVgaFile1Header { + uint16 x_1; + uint16 hdr2_start; + uint16 x_2, x_3; +} GCC_PACK; + +struct FFVgaFile1Header2 { + uint16 unk1; + uint16 x_2; + uint16 id_count; + uint16 x_3; + uint16 unk2_offs; + uint16 x_4; + uint16 id_table; + uint16 x_5; +} GCC_PACK; + +struct FFVgaFile1Struct0x8 { + uint16 id; + uint16 x_1; + uint16 script_offs; + uint16 x_2; +} GCC_PACK; + +// Simon 1/2 struct VgaFile1Header { uint16 x_1, x_2; uint16 hdr2_start; -- cgit v1.2.3