From 9593ff3e486a750b1deb5e43fe95ff8a20155d4c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 20 Sep 2007 09:28:52 +0000 Subject: FIxed some warnings, cleanup svn-id: r28982 --- tools/create_lure/create_lure_dat.cpp | 14 +++++--------- tools/create_lure/create_lure_dat.h | 13 ++++++++++--- tools/create_lure/process_actions.cpp | 4 +--- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'tools/create_lure') diff --git a/tools/create_lure/create_lure_dat.cpp b/tools/create_lure/create_lure_dat.cpp index dbcd03faab..cc53c751f4 100644 --- a/tools/create_lure/create_lure_dat.cpp +++ b/tools/create_lure/create_lure_dat.cpp @@ -110,7 +110,6 @@ void read_room_data(byte *&data, uint16 &totalSize) uint16 offset = (ROOM_NUM_ENTRIES + 1) * sizeof(uint16); uint16 pixelOffset; RoomResource buffer; - int outputIndex = 0; RoomHeaderEntry headerEntry; RoomRectIn bounds; @@ -737,7 +736,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) { TalkEntry *entry = (TalkEntry *) data; uint16 offset = TALK_NUM_ENTRIES * sizeof(TalkEntry) + sizeof(uint16); - for (int entryCtr = 0; entryCtr < TALK_NUM_ENTRIES; ++entryCtr) { + for (entryCtr = 0; entryCtr < TALK_NUM_ENTRIES; ++entryCtr) { entry->hotspotId = entries[entryCtr].hotspotId; entry->offset = TO_LE_16(offset); ++entry; @@ -1248,20 +1247,17 @@ void validate_executable() { } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { + // FIXME: This is not portable const char *inFilename = (argc >= 2) ? argv[1] : "c:\\games\\lure\\lure.exe"; const char *outFilename = (argc == 3) ? argv[2] : "c:\\games\\lure\\lure.dat"; - if (!lure_exe.open(inFilename)) - { + if (!lure_exe.open(inFilename)) { if (argc == 1) printf("Format: %s input_exe_filename output_filename\n", argv[0]); else printf("Could not open file: %s\n", inFilename); - } - else - { + } else { validate_executable(); createFile(outFilename); lure_exe.close(); diff --git a/tools/create_lure/create_lure_dat.h b/tools/create_lure/create_lure_dat.h index 1c8e6ff2d0..20b67000d7 100644 --- a/tools/create_lure/create_lure_dat.h +++ b/tools/create_lure/create_lure_dat.h @@ -23,8 +23,8 @@ * */ -#ifndef __createlure_dat__ -#define __createlure_dat__ +#ifndef __CREATELURE_DAT__ +#define __CREATELURE_DAT__ #include "common/endian.h" @@ -90,7 +90,10 @@ #define SOUND_1_OFFSET 0x5671 #define SOUND_1_SIZE 265 -#pragma pack(1) +#include "common/pack-start.h" // START STRUCT PACKING + +// FIXME: Add PACKED_STRUCT to all structs which actually need packing, +// for increased portability // Rect currently copied from common/rect.h - if I try directly including it, // the link complains about an unresolved external token Common.String.__dtor @@ -368,6 +371,10 @@ extern void read_action_sequence(byte *&data, uint16 &totalSize); extern uint16 get_sequence_index(uint16 offset, int supportIndex = -1); +#include "common/pack-end.h" // END STRUCT PACKING + + + enum AccessMode { kFileReadMode = 1, kFileWriteMode = 2 diff --git a/tools/create_lure/process_actions.cpp b/tools/create_lure/process_actions.cpp index 2ebe1feafb..a4de8c8fe3 100644 --- a/tools/create_lure/process_actions.cpp +++ b/tools/create_lure/process_actions.cpp @@ -83,7 +83,7 @@ uint16 get_sequence_index(uint16 offset, int supportIndex) { } } - for (int index = 0; index <= numSupportEntries; ++index) { + for (index = 0; index <= numSupportEntries; ++index) { SupportStructure &rec = supportList[index]; if ((rec.numInstructions > 0) && @@ -294,7 +294,6 @@ struct RoomRandomActionSet { void read_action_sequence(byte *&data, uint16 &totalSize) { const uint16 hsOffset = 0x5d98; - const uint16 hsStartId = 0x3e8; uint16 hotspotIndex; HotspotHeaderEntry entryHeader; CurrentActionInput action; @@ -335,7 +334,6 @@ void read_action_sequence(byte *&data, uint16 &totalSize) randomActions[roomIndex].entries = new RoomRandomActionEntry[randomActions[roomIndex].numEntries]; // Loop through the entries - uint16 sequenceVal; uint16 offset = randomActions[roomIndex].offset + 1; for (uint8 entryCtr = 0; entryCtr < randomActions[roomIndex].numEntries; ++entryCtr) { -- cgit v1.2.3