From 0ede3208ddc30e31e752f6ba48e69ff2310cf448 Mon Sep 17 00:00:00 2001
From: Alyssa Milburn <fuzzie@fuzzie.org>
Date: Fri, 21 May 2010 18:21:10 +0200
Subject: [PATCH] add support for BRA's part command
---
engines/parallaction/exec_br.cpp | 2 +-
engines/parallaction/parallaction.cpp | 1 +
engines/parallaction/parallaction.h | 1 +
engines/parallaction/parallaction_br.cpp | 21 +++++++++++++++++----
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 45e4827..aaad180 100644
a
|
b
|
DECLARE_COMMAND_OPCODE(text) {
|
293 | 293 | |
294 | 294 | |
295 | 295 | DECLARE_COMMAND_OPCODE(part) { |
296 | | warning("Parallaction_br::cmdOp_part not yet implemented"); |
| 296 | _vm->_nextPart = ctxt._cmd->_counterValue; |
297 | 297 | } |
298 | 298 | |
299 | 299 | |
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index ce75253..964880e 100644
a
|
b
|
Common::Error Parallaction::init() {
|
116 | 116 | _location._followerStartPosition.y = -1000; |
117 | 117 | _location._followerStartFrame = 0; |
118 | 118 | _objects = 0; |
| 119 | _nextPart = -1; |
119 | 120 | |
120 | 121 | _screenSize = _screenWidth * _screenHeight; |
121 | 122 | |
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 151bfd9..b5cc84d 100644
a
|
b
|
public:
|
323 | 323 | ZonePtr _zoneTrap; |
324 | 324 | ZonePtr _commentZone; |
325 | 325 | Common::String _newLocationName; |
| 326 | int _nextPart; |
326 | 327 | |
327 | 328 | protected: |
328 | 329 | void runGame(); |
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index e0fd89c..a0a90dc 100644
a
|
b
|
void Parallaction_br::cleanupGame() {
|
260 | 260 | _globalFlagsNames = 0; |
261 | 261 | _objectsNames = 0; |
262 | 262 | _countersNames = 0; |
| 263 | |
| 264 | memset(_zoneFlags, 0, sizeof(_zoneFlags)); |
263 | 265 | } |
264 | 266 | |
265 | 267 | |
… |
… |
void Parallaction_br::changeLocation() {
|
272 | 274 | strcpy(location, _newLocationName.c_str()); |
273 | 275 | |
274 | 276 | char *partStr = strrchr(location, '.'); |
275 | | if (partStr) { |
| 277 | if (partStr || _nextPart != -1) { |
276 | 278 | cleanupGame(); |
277 | 279 | |
278 | | int n = partStr - location; |
279 | | location[n] = '\0'; |
| 280 | // more cleanup needed for part changes (see also saveload) |
| 281 | _globalFlags = 0; |
| 282 | cleanInventory(true); |
| 283 | strcpy(_characterName1, "null"); |
| 284 | |
| 285 | if (partStr) { |
| 286 | int n = partStr - location; |
| 287 | location[n] = '\0'; |
| 288 | |
| 289 | _part = atoi(++partStr); |
| 290 | } else { |
| 291 | _part = _nextPart; |
| 292 | } |
280 | 293 | |
281 | | _part = atoi(++partStr); |
282 | 294 | if (getFeatures() & GF_DEMO) { |
283 | 295 | assert(_part == 1); |
284 | 296 | } else { |
… |
… |
void Parallaction_br::changeLocation() {
|
358 | 370 | |
359 | 371 | _engineFlags &= ~kEngineChangeLocation; |
360 | 372 | _newLocationName.clear(); |
| 373 | _nextPart = -1; |
361 | 374 | } |
362 | 375 | |
363 | 376 | // FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns. |