FIxed some warnings, cleanup

svn-id: r28982
This commit is contained in:
Max Horn 2007-09-20 09:28:52 +00:00
parent 3cbf4ad98f
commit 9593ff3e48
3 changed files with 16 additions and 15 deletions

View file

@ -110,7 +110,6 @@ void read_room_data(byte *&data, uint16 &totalSize)
uint16 offset = (ROOM_NUM_ENTRIES + 1) * sizeof(uint16); uint16 offset = (ROOM_NUM_ENTRIES + 1) * sizeof(uint16);
uint16 pixelOffset; uint16 pixelOffset;
RoomResource buffer; RoomResource buffer;
int outputIndex = 0;
RoomHeaderEntry headerEntry; RoomHeaderEntry headerEntry;
RoomRectIn bounds; RoomRectIn bounds;
@ -737,7 +736,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) {
TalkEntry *entry = (TalkEntry *) data; TalkEntry *entry = (TalkEntry *) data;
uint16 offset = TALK_NUM_ENTRIES * sizeof(TalkEntry) + sizeof(uint16); 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->hotspotId = entries[entryCtr].hotspotId;
entry->offset = TO_LE_16(offset); entry->offset = TO_LE_16(offset);
++entry; ++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 *inFilename = (argc >= 2) ? argv[1] : "c:\\games\\lure\\lure.exe";
const char *outFilename = (argc == 3) ? argv[2] : "c:\\games\\lure\\lure.dat"; 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) if (argc == 1)
printf("Format: %s input_exe_filename output_filename\n", argv[0]); printf("Format: %s input_exe_filename output_filename\n", argv[0]);
else else
printf("Could not open file: %s\n", inFilename); printf("Could not open file: %s\n", inFilename);
} } else {
else
{
validate_executable(); validate_executable();
createFile(outFilename); createFile(outFilename);
lure_exe.close(); lure_exe.close();

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef __createlure_dat__ #ifndef __CREATELURE_DAT__
#define __createlure_dat__ #define __CREATELURE_DAT__
#include "common/endian.h" #include "common/endian.h"
@ -90,7 +90,10 @@
#define SOUND_1_OFFSET 0x5671 #define SOUND_1_OFFSET 0x5671
#define SOUND_1_SIZE 265 #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, // Rect currently copied from common/rect.h - if I try directly including it,
// the link complains about an unresolved external token Common.String.__dtor // 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); extern uint16 get_sequence_index(uint16 offset, int supportIndex = -1);
#include "common/pack-end.h" // END STRUCT PACKING
enum AccessMode { enum AccessMode {
kFileReadMode = 1, kFileReadMode = 1,
kFileWriteMode = 2 kFileWriteMode = 2

View file

@ -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]; SupportStructure &rec = supportList[index];
if ((rec.numInstructions > 0) && if ((rec.numInstructions > 0) &&
@ -294,7 +294,6 @@ struct RoomRandomActionSet {
void read_action_sequence(byte *&data, uint16 &totalSize) void read_action_sequence(byte *&data, uint16 &totalSize)
{ {
const uint16 hsOffset = 0x5d98; const uint16 hsOffset = 0x5d98;
const uint16 hsStartId = 0x3e8;
uint16 hotspotIndex; uint16 hotspotIndex;
HotspotHeaderEntry entryHeader; HotspotHeaderEntry entryHeader;
CurrentActionInput action; CurrentActionInput action;
@ -335,7 +334,6 @@ void read_action_sequence(byte *&data, uint16 &totalSize)
randomActions[roomIndex].entries = new RoomRandomActionEntry[randomActions[roomIndex].numEntries]; randomActions[roomIndex].entries = new RoomRandomActionEntry[randomActions[roomIndex].numEntries];
// Loop through the entries // Loop through the entries
uint16 sequenceVal;
uint16 offset = randomActions[roomIndex].offset + 1; uint16 offset = randomActions[roomIndex].offset + 1;
for (uint8 entryCtr = 0; entryCtr < randomActions[roomIndex].numEntries; ++entryCtr) for (uint8 entryCtr = 0; entryCtr < randomActions[roomIndex].numEntries; ++entryCtr)
{ {