From f871f569e61187c1ea350d9324c1be582f3f613a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 27 Aug 2006 11:38:55 +0000 Subject: Added data for room header flags and actions svn-id: r23781 --- engines/lure/res_struct.cpp | 29 ++++++++++++++++++++++------- engines/lure/res_struct.h | 15 ++++++++++++--- 2 files changed, 34 insertions(+), 10 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index b72f62d030..01f29b14ce 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -33,6 +33,10 @@ const char *actionList[] = {NULL, "Get", NULL, "Push", "Pull", "Operate", "Open" "Look", "Look at", "Look through", "Ask", NULL, "Drink", "Status", "Go to", "Return", "Bribe", "Examine"}; +const Action sortedActions[] = {ASK, BRIBE, BUY, CLOSE, DRINK, EXAMINE, GET, GIVE, + GO_TO, LOCK, LOOK, LOOK_AT, LOOK_THROUGH, OPEN, OPERATE, PULL, PUSH, RETURN, + STATUS, TALK_TO, TELL, UNLOCK, USE, NONE}; + int actionNumParams[NPC_JUMP_ADDRESS+1] = {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 1, 0, 1, 1, 1, 1, 0, 0, 2, 0, 1, 0, 0, 1, 1, 2, 2, 5, 2, 2, 1}; @@ -41,6 +45,9 @@ int actionNumParams[NPC_JUMP_ADDRESS+1] = {0, RoomData::RoomData(RoomResource *rec, MemoryBlock *pathData) { roomNumber = FROM_LE_16(rec->roomNumber); + hdrFlags = rec->hdrFlags; + actions = FROM_LE_32(rec->actions) & 0xfffffff; + flags = (FROM_LE_32(rec->actions) >> 24) & 0xf0; descId = FROM_LE_16(rec->descId); sequenceOffset = FROM_LE_16(rec->sequenceOffset); numLayers = FROM_LE_16(rec->numLayers); @@ -308,7 +315,7 @@ HotspotData::HotspotData(HotspotResource *rec) { pauseCtr = 0; useHotspotId = 0; v2b = 0; - v50 = 0; + actionHotspotId = 0; } // Hotspot override data @@ -538,6 +545,7 @@ CharacterScheduleEntry::CharacterScheduleEntry(Action theAction, ...) { _params[paramCtr] = (uint16) va_arg(u_Arg, int); va_end(u_Arg); + _numParams = actionNumParams[_action]; } CharacterScheduleEntry::CharacterScheduleEntry(CharacterScheduleSet *parentSet, @@ -548,15 +556,12 @@ CharacterScheduleEntry::CharacterScheduleEntry(CharacterScheduleSet *parentSet, error("Invalid action encountered reading NPC schedule"); _action = (Action) rec->action; - for (int index = 0; index < actionNumParams[_action]; ++index) + _numParams = actionNumParams[_action]; + for (int index = 0; index < _numParams; ++index) _params[index] = FROM_LE_16(rec->params[index]); rec = (CharacterScheduleResource *) ((byte *) rec + - (actionNumParams[_action] + 1) * sizeof(uint16)); -} - -int CharacterScheduleEntry::numParams() { - return actionNumParams[_action]; + (_numParams + 1) * sizeof(uint16)); } uint16 CharacterScheduleEntry::param(int index) { @@ -567,6 +572,7 @@ uint16 CharacterScheduleEntry::param(int index) { void CharacterScheduleEntry::setDetails(Action theAction, ...) { _action = theAction; + _numParams = actionNumParams[_action]; va_list list; va_start(list, theAction); @@ -577,6 +583,15 @@ void CharacterScheduleEntry::setDetails(Action theAction, ...) { va_end(list); } +void CharacterScheduleEntry::setDetails2(Action theAction, int numParamEntries, uint16 *paramList) { + _action = theAction; + _numParams = numParamEntries; + + assert((numParamEntries >= 0) && (numParamEntries < (MAX_TELL_COMMANDS * 3))); + for (int paramCtr = 0; paramCtr < numParamEntries; ++paramCtr) + _params[paramCtr] = paramList[paramCtr]; +} + CharacterScheduleEntry *CharacterScheduleEntry::next() { if (_parent) { CharacterScheduleSet::iterator i; diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index 6519e31262..c9ae4e783d 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -31,6 +31,7 @@ namespace Lure { using namespace Common; extern const char *actionList[]; +extern const Action sortedActions[]; /*-------------------------------------------------------------------------*/ /* Structure definitions */ @@ -115,6 +116,9 @@ struct RoomRect { struct RoomResource { uint16 roomNumber; + uint8 hdrFlags; + uint8 unused; + uint32 actions; uint16 descId; uint16 numLayers; uint16 layers[4]; @@ -318,6 +322,9 @@ public: RoomData(RoomResource *rec, MemoryBlock *pathData); uint16 roomNumber; + uint8 hdrFlags; + uint8 flags; + uint32 actions; uint16 descId; uint16 numLayers; uint16 layers[MAX_NUM_LAYERS]; @@ -427,7 +434,7 @@ public: uint16 useHotspotId; uint16 use2HotspotId; uint16 v2b; - uint16 v50; + uint16 actionHotspotId; void enable() { flags |= 0x80; } void disable() { flags &= 0x7F; } @@ -583,7 +590,8 @@ class CharacterScheduleEntry { private: CharacterScheduleSet *_parent; Action _action; - uint16 _params[MAX_SCHEDULE_ENTRY_PARAMS]; + uint16 _params[MAX_TELL_COMMANDS * 3]; + int _numParams; public: CharacterScheduleEntry() { _action = NONE; _parent = NULL; } CharacterScheduleEntry(Action theAction, ...); @@ -591,9 +599,10 @@ public: CharacterScheduleResource *&rec); Action action() { return _action; } - int numParams(); + int numParams() { return _numParams; } uint16 param(int index); void setDetails(Action theAction, ...); + void setDetails2(Action theAction, int numParamEntries, uint16 *paramList); CharacterScheduleEntry *next(); CharacterScheduleSet *parent() { return _parent; } uint16 id(); -- cgit v1.2.3