diff options
author | Nicola Mettifogo | 2008-07-26 02:09:50 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-07-26 02:09:50 +0000 |
commit | aee128467893daa3e3482ad3c9a90b66cbc1bcdf (patch) | |
tree | 7592267960614da197516beddad2011582d87827 /engines | |
parent | 1174296a664a7e796cf178297b4e65d6a56bb158 (diff) | |
download | scummvm-rg350-aee128467893daa3e3482ad3c9a90b66cbc1bcdf.tar.gz scummvm-rg350-aee128467893daa3e3482ad3c9a90b66cbc1bcdf.tar.bz2 scummvm-rg350-aee128467893daa3e3482ad3c9a90b66cbc1bcdf.zip |
BRA now parses path data from the scripts.
svn-id: r33295
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/graphics.cpp | 22 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 1 | ||||
-rw-r--r-- | engines/parallaction/objects.h | 18 | ||||
-rw-r--r-- | engines/parallaction/parser.h | 6 | ||||
-rw-r--r-- | engines/parallaction/parser_br.cpp | 61 | ||||
-rw-r--r-- | engines/parallaction/walk.h | 7 |
6 files changed, 108 insertions, 7 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 3afc05bdc1..7195d1c126 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -375,6 +375,13 @@ void Gfx::beginFrame() { } } + _varDrawPathZones = getVar("draw_path_zones"); + if (_varDrawPathZones == 1 && _vm->getGameType() != GType_BRA) { + setVar("draw_path_zones", 0); + _varDrawPathZones = 0; + warning("Path zones are supported only in Big Red Adventure"); + } + if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo.width)) { _varScrollX = 0; } else { @@ -420,6 +427,19 @@ void Gfx::updateScreen() { g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo.x, _backgroundInfo.y, w, h); } + if (_varDrawPathZones == 1) { + Graphics::Surface *surf = g_system->lockScreen(); + ZoneList::iterator b = _vm->_location._zones.begin(); + ZoneList::iterator e = _vm->_location._zones.end(); + for (; b != e; b++) { + ZonePtr z = *b; + if (z->_type & kZonePath) { + surf->frameRect(Common::Rect(z->_left, z->_top, z->_right, z->_bottom), 2); + } + } + g_system->unlockScreen(); + } + _varRenderMode = _varAnimRenderMode; // TODO: transform objects coordinates to be drawn with scrolling @@ -775,6 +795,8 @@ Gfx::Gfx(Parallaction* vm) : registerVar("anim_render_mode", 1); registerVar("misc_render_mode", 1); + registerVar("draw_path_zones", 0); + return; } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index b3745098c2..bba2d01d8a 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -564,6 +564,7 @@ protected: int32 _varAnimRenderMode; // 1 = normal, 2 = flat int32 _varMiscRenderMode; // 1 = normal, 2 = flat int32 _varRenderMode; + int32 _varDrawPathZones; // 0 = don't draw, 1 = draw Graphics::Surface _bitmapMask; int32 getRenderMode(const char *type); diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 19835da9d0..fd855f9dca 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -54,6 +54,7 @@ typedef Common::SharedPtr<Instruction> InstructionPtr; typedef Common::List<InstructionPtr> InstructionList; extern InstructionPtr nullInstructionPtr; +typedef Common::List<Common::Point> PointList; enum ZoneTypes { kZoneExamine = 1, // zone displays comment if activated @@ -67,7 +68,10 @@ enum ZoneTypes { kZoneNone = 0x100, // used to prevent parsing on peculiar Animations kZoneTrap = 0x200, // zone activated when character enters kZoneYou = 0x400, // marks the character - kZoneCommand = 0x800 + kZoneCommand = 0x800, + + // BRA specific + kZonePath = 0x1000 // defines nodes for assisting walk calculation routines }; @@ -256,6 +260,15 @@ struct MergeData { // size = 12 _obj1 = _obj2 = _obj3 = 0; } }; +#define MAX_WALKPOINT_LISTS 20 +struct PathData { + int _numLists; + PointList _lists[MAX_WALKPOINT_LISTS]; + + PathData() { + _numLists = 0; + } +}; struct TypeData { GetData *get; @@ -264,6 +277,8 @@ struct TypeData { DoorData *door; HearData *hear; MergeData *merge; + // BRA specific field + PathData *path; TypeData() { get = NULL; @@ -272,6 +287,7 @@ struct TypeData { door = NULL; hear = NULL; merge = NULL; + path = NULL; } }; diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 67515627d0..290a0815c8 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -192,7 +192,7 @@ protected: Question *parseQuestion(); void parseZone(ZoneList &list, char *name); - void parseZoneTypeBlock(ZonePtr z); + virtual void parseZoneTypeBlock(ZonePtr z); void parsePointList(PointList &list); void parseAnimation(AnimationList &list, char *name); void parseCommands(CommandList&); @@ -284,6 +284,9 @@ protected: DECLARE_UNQUALIFIED_ANIM_PARSER(moveto); DECLARE_UNQUALIFIED_ANIM_PARSER(endanimation); + virtual void parseZoneTypeBlock(ZonePtr z); + void parsePathData(ZonePtr z); + public: LocationParser_br(Parallaction_br *vm) : LocationParser_ns((Parallaction_ns*)vm), _vm(vm) { } @@ -307,6 +310,7 @@ protected: Parser *_parser; Parallaction_ns *_vm; + Script *_script; ProgramPtr _program; diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index defc917a72..7ed826d9f8 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -750,6 +750,67 @@ DECLARE_ZONE_PARSER(type) { _parser->popTables(); } +void LocationParser_br::parsePathData(ZonePtr z) { + + PathData *data = new PathData; + + do { + + if (!scumm_stricmp("zone", _tokens[0])) { + int id = atoi(_tokens[1]); + parsePointList(data->_lists[id]); + data->_numLists++; + } + + _script->readLineToken(true); + } while (scumm_stricmp("endzone", _tokens[0])); + + z->u.path = data; +} + +void LocationParser_br::parseZoneTypeBlock(ZonePtr z) { + debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type); + + switch (z->_type & 0xFFFF) { + case kZoneExamine: // examine Zone alloc + parseExamineData(z); + break; + + case kZoneDoor: // door Zone alloc + parseDoorData(z); + break; + + case kZoneGet: // get Zone alloc + parseGetData(z); + break; + + case kZoneMerge: // merge Zone alloc + parseMergeData(z); + break; + + case kZoneHear: // hear Zone alloc + parseHearData(z); + break; + + case kZoneSpeak: // speak Zone alloc + parseSpeakData(z); + break; + + // BRA specific zone + case kZonePath: + parsePathData(z); + break; + + default: + // eats up 'ENDZONE' line for unprocessed zone types + _script->readLineToken(true); + break; + } + + debugC(7, kDebugParser, "parseZoneTypeBlock() done"); + + return; +} DECLARE_ANIM_PARSER(file) { debugC(7, kDebugParser, "ANIM_PARSER(file) "); diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h index b68a7f585f..dddf2857be 100644 --- a/engines/parallaction/walk.h +++ b/engines/parallaction/walk.h @@ -29,12 +29,9 @@ #include "common/ptr.h" #include "common/list.h" -namespace Parallaction { - -struct Animation; - -typedef Common::List<Common::Point> PointList; +#include "parallaction/objects.h" +namespace Parallaction { class PathBuilder { |