diff options
-rw-r--r-- | tools/create_lure/create_lure_dat.cpp | 84 | ||||
-rw-r--r-- | tools/create_lure/create_lure_dat.h | 17 | ||||
-rw-r--r-- | tools/create_lure/process_actions.cpp | 16 |
3 files changed, 89 insertions, 28 deletions
diff --git a/tools/create_lure/create_lure_dat.cpp b/tools/create_lure/create_lure_dat.cpp index 89a12be8e9..13f7c97964 100644 --- a/tools/create_lure/create_lure_dat.cpp +++ b/tools/create_lure/create_lure_dat.cpp @@ -121,7 +121,6 @@ void read_room_data(byte *&data, uint16 &totalSize) if ((FROM_LE_16(headerEntry.offset) != 0) && (FROM_LE_16(headerEntry.offset) != 0xffff) && - (FROM_LE_16(headerEntry.roomNumber) != 0xc09) && (FROM_LE_16(headerEntry.roomNumber) != 0)) { // Store offset of room entry *offsetPtr++ = TO_LE_16(offset); @@ -129,11 +128,10 @@ void read_room_data(byte *&data, uint16 &totalSize) // Copy over basic room details lure_exe.seek(DATA_SEGMENT + headerEntry.offset); lure_exe.read(&buffer, sizeof(RoomResource)); - RoomResourceOutput *rec = (RoomResourceOutput *) (data + offset); rec->hdrFlags = headerEntry.hdrFlags; rec->actions = FROM_LE_32(buffer.actions); - rec->roomNumber = headerEntry.roomNumber; + rec->roomNumber = index; rec->descId = headerEntry.descId; rec->numLayers = buffer.numLayers; memcpy(rec->layers, buffer.layers, 8); @@ -141,6 +139,8 @@ void read_room_data(byte *&data, uint16 &totalSize) rec->clippingXStart = TO_LE_16(FROM_LE_16(buffer.clippingXStart) - 0x80); rec->clippingXEnd = (FROM_LE_16(buffer.clippingXEnd) == 0) ? 0 : TO_LE_16(FROM_LE_16(buffer.clippingXEnd) - 0x80); + rec->exitTime = FROM_LE_32(buffer.exitTime); + rec->areaFlag = buffer.areaFlag; rec->numExits = 0; offset += sizeof(RoomResourceOutput); @@ -283,10 +283,15 @@ void read_hotspot_data(byte *&data, uint16 &totalSize) r->roomNumber = TO_LE_16(28); // Find the walk-to coordinates for the hotspot + uint16 findId = FROM_LE_16(r->hotspotId); walkCtr = 0; - while ((walkCtr < walkNumEntries) && - (FROM_LE_16(walkList[walkCtr].hotspotId) != FROM_LE_16(r->hotspotId))) + while (walkCtr < walkNumEntries) { + uint16 id = FROM_LE_16(walkList[walkCtr].hotspotId); + if ((id == findId) || ((findId == 1007) && (id == 0xffff))) + break; ++walkCtr; + } + if (walkCtr == walkNumEntries) { r->walkX = 0; r->walkY = 0; @@ -473,11 +478,33 @@ void read_room_exit_joins(byte *&data, uint16 &totalSize) { void read_anim_data(byte *&data, uint16 &totalSize) { // Add special pixel records - add_anim_record(0x5c95); - add_anim_record(0x5ce9); // Blacksmith in bar? + add_anim_record(0x55C0); // Player midswing animation + add_anim_record(0x55C9); // Player mid-level defend + add_anim_record(0x55D2); // Player high-level strike + add_anim_record(0x55DB); // Player high-level defend + add_anim_record(0x55E4); // Player low-level strike + add_anim_record(0x55ED); // Player low-level defend + add_anim_record(0x55F6); // Player fight animation + add_anim_record(0x55FF); // Pig fight animation + add_anim_record(0x5611); // Player mid-level strike + add_anim_record(0x5623); // Pig fight animation + add_anim_record(0x562C); // Misc fight animation + add_anim_record(0x5635); // Pig fight animation + add_anim_record(0x563E); // Player recoiling from hit + add_anim_record(0x5647); // Pig recoiling from hit + add_anim_record(0x5650); // Pig dies add_anim_record(0x5915); // Blacksmith hammering add_anim_record(0x59ED); // Ewan's alternate animation + add_anim_record(0x59FF); // Dragon breathing fire + add_anim_record(0x5A08); // Dragon breathing fire 2 + add_anim_record(0x5A11); // Dragon breathing fire 3 + add_anim_record(0x5A1A); // Player turning winch in room #48 + add_anim_record(0x5A59); // Player pulling lever in room #48 + add_anim_record(0x5A62); // Minnow pulling lever in room #48 + add_anim_record(0x5AAA); // Goewin mixing potion + add_anim_record(0x5C95); add_anim_record(0x5CAA); // Selena animation + add_anim_record(0x5CE9); // Blacksmith in bar? add_anim_record(0x5D28); // Goewin animation // Get the animation data records @@ -881,32 +908,40 @@ void read_room_exit_coordinate_data(byte *&data, uint16 &totalSize) { // Read in the exit coordinates list int roomNum, entryNum; + uint16 x, y; + RoomExitCoordinateEntryInputResource dataIn; - totalSize = EXIT_COORDINATES_NUM_ROOMS * sizeof(RoomExitCoordinateEntryResource) + 2; + totalSize = EXIT_COORDINATES_NUM_ROOMS * sizeof(RoomExitCoordinateEntryOutputResource) + 2; data = (byte *) malloc(totalSize); lure_exe.seek(DATA_SEGMENT + EXIT_COORDINATES_OFFSET); - lure_exe.read(data, totalSize - 2); WRITE_LE_UINT16(data + totalSize - 2, 0xffff); // Post process the list to adjust data - RoomExitCoordinateEntryResource *rec = (RoomExitCoordinateEntryResource *) data; + RoomExitCoordinateEntryOutputResource *rec = (RoomExitCoordinateEntryOutputResource *) data; for (roomNum = 1; roomNum <= EXIT_COORDINATES_NUM_ROOMS; ++roomNum, ++rec) { + lure_exe.read(&dataIn, sizeof(RoomExitCoordinateEntryInputResource)); + for (entryNum = 0; entryNum < ROOM_EXIT_COORDINATES_NUM_ENTRIES; ++entryNum) { - if ((rec->entries[entryNum].x != 0) || (rec->entries[entryNum].y != 0)) { - rec->entries[entryNum].x = TO_LE_16(FROM_LE_16(rec->entries[entryNum].x) - 0x80); - uint16 tempY = FROM_LE_16(rec->entries[entryNum].y); - rec->entries[entryNum].y = TO_LE_16( - ((tempY & 0xfff) - 0x80) | (tempY & 0xf000)); + x = FROM_LE_16(dataIn.entries[entryNum].x); + y = FROM_LE_16(dataIn.entries[entryNum].y); + if ((x != 0) || (y != 0)) { + x -= 0x80; + y = ((y & 0xfff) - 0x80) | (y & 0xf000); } + + RoomExitCoordinateResource *p = &rec->entries[entryNum]; + p->x = TO_LE_16(x); + p->y = TO_LE_16(y); + p->roomNumber = dataIn.entries[entryNum].roomNumber; } for (entryNum = 0; entryNum < ROOM_EXIT_COORDINATES_ENTRY_NUM_ROOMS; ++entryNum) { - rec->roomIndex[entryNum] = TO_LE_16(FROM_LE_16(rec->roomIndex[entryNum]) / 6); + rec->roomIndex[entryNum] = TO_LE_16(FROM_LE_16(dataIn.roomIndex[entryNum]) / 6); } - // Bugfix for the original game data to get to room #27 via rooms #10 or #11 + // WORKAROUND: Bugfix for the original game data to get to room #27 via rooms #10 or #11 if ((roomNum == 10) || (roomNum == 11)) - rec->roomIndex[26] = 1; + rec->roomIndex[26] = TO_LE_16(1); } } @@ -928,6 +963,14 @@ void read_room_exit_hotspots_data(byte *&data, uint16 &totalSize) { totalSize += sizeof(uint16); } +void save_fight_segment(byte *&data, uint16 &totalSize) { + lure_exe.seek(FIGHT_SEGMENT); + + totalSize = FIGHT_SEGMENT_SIZE; + data = (byte *) malloc(totalSize); + lure_exe.read(data, totalSize); +} + #define NUM_TEXT_ENTRIES 40 const char *text_strings[NUM_TEXT_ENTRIES] = { "Get", NULL, "Push", "Pull", "Operate", "Open", "Close", "Lock", "Unlock", "Use", @@ -1075,6 +1118,11 @@ void getEntry(uint8 entryIndex, uint16 &resourceId, byte *&data, uint16 &size) break; case 21: + // Save the fight segment data + save_fight_segment(data, size); + break; + + case 22: // Set up the list of text strings used by the game save_text_strings(data, size); break; diff --git a/tools/create_lure/create_lure_dat.h b/tools/create_lure/create_lure_dat.h index ed66909cd8..4429baf8bb 100644 --- a/tools/create_lure/create_lure_dat.h +++ b/tools/create_lure/create_lure_dat.h @@ -30,7 +30,7 @@ #include "common/endian.h" #define VERSION_MAJOR 1 -#define VERSION_MINOR 19 +#define VERSION_MINOR 20 #define ENGLISH_LURE #define DATA_SEGMENT 0xac50 @@ -53,6 +53,8 @@ #define SCRIPT_SEGMENT_SIZE 0x2c57 #define SCRIPT2_SEGMENT 0x19c70 #define SCRIPT2_SEGMENT_SIZE 0x2800 +#define FIGHT_SEGMENT 0x1C400 +#define FIGHT_SEGMENT_SIZE 0x1850 #define HOTSPOT_SCRIPT_LIST 0x57e0 #define HOTSPOT_SCRIPT_SIZE 0x30 @@ -200,7 +202,8 @@ struct RoomResource { byte numLayers; uint16 layers[4]; uint16 sequenceOffset; - byte unknown2[5]; + uint32 exitTime; + uint8 areaFlag; uint8 walkBoundsIndex; int16 clippingXStart; int16 clippingXEnd; @@ -227,6 +230,8 @@ struct RoomResourceOutput { uint16 sequenceOffset; int16 clippingXStart; int16 clippingXEnd; + uint32 exitTime; + uint8 areaFlag; RoomRectOut walkBounds; uint16 numExits; }; @@ -343,11 +348,17 @@ struct RoomExitIndexedHotspotResource { #define ROOM_EXIT_COORDINATES_NUM_ENTRIES 6 #define ROOM_EXIT_COORDINATES_ENTRY_NUM_ROOMS 52 -struct RoomExitCoordinateEntryResource { +struct RoomExitCoordinateEntryInputResource { RoomExitCoordinateResource entries[ROOM_EXIT_COORDINATES_NUM_ENTRIES]; uint8 roomIndex[ROOM_EXIT_COORDINATES_ENTRY_NUM_ROOMS]; }; +struct RoomExitCoordinateEntryOutputResource { + uint8 roomIndex[ROOM_EXIT_COORDINATES_ENTRY_NUM_ROOMS]; + RoomExitCoordinateResource entries[ROOM_EXIT_COORDINATES_NUM_ENTRIES]; +}; + + enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT, PROCESSING_PATH, WALKING}; diff --git a/tools/create_lure/process_actions.cpp b/tools/create_lure/process_actions.cpp index 8a194f2ac5..1521ce442d 100644 --- a/tools/create_lure/process_actions.cpp +++ b/tools/create_lure/process_actions.cpp @@ -33,9 +33,9 @@ enum Action { LOOK = 15, LOOK_AT = 16, LOOK_THROUGH = 17, ASK = 18, DRINK = 20, STATUS = 21, GO_TO = 22, RETURN = 23, BRIBE = 24, EXAMINE = 25, NPC_SET_ROOM_AND_BLOCKED_OFFSET = 28, NPC_HEY_SIR = 29, NPC_EXEC_SCRIPT = 30, - NPC_UNKNOWN2 = 31, NPC_SET_RAND_DEST = 32, NPC_WALKING_CHECK = 33, + NPC_RESET_PAUSED_LIST = 31, NPC_SET_RAND_DEST = 32, NPC_WALKING_CHECK = 33, NPC_SET_SUPPORT_OFFSET = 34, NPC_SUPPORT_OFFSET_COND = 35, - NPC_DISPATCH_ACTION = 36, NPC_UNKNOWN3 = 37, NPC_UNKNOWN4 = 38, + NPC_DISPATCH_ACTION = 36, NPC_TALK_NPC_TO_NPC = 37, NPC_PAUSE = 38, NPC_START_TALKING = 39, NPC_JUMP_ADDRESS = 40, NONE = 0 }; @@ -365,11 +365,13 @@ void read_action_sequence(byte *&data, uint16 &totalSize) // Handle required initial entries - the Lure engine refers to them directly by // index, so they need to be first, and in that order #ifdef ENGLISH_LURE - process_entry(0x13c2, data, totalSize); - process_entry(0xbb95, data, totalSize); - process_entry(0x7060, data, totalSize); - process_entry(0x728a, data, totalSize); - process_entry(0x76ec, data, totalSize); + process_entry(0x13c2, data, totalSize); // RETURN sequence + process_entry(0xbb95, data, totalSize); // Exit blocked sequence + process_entry(0x7060, data, totalSize); // Jump proc #2 - go to castle basement + process_entry(0x728a, data, totalSize); + process_entry(0x76ec, data, totalSize); + process_entry(0x4ebb, data, totalSize); // Goewin as a follower in cave + process_entry(0x7D9D, data, totalSize); // Goewin standard handler #endif // Process the script engine list |