diff options
author | Torbjörn Andersson | 2005-01-17 07:21:08 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-01-17 07:21:08 +0000 |
commit | f8865304bde2e79d25727abebcbc33033b051598 (patch) | |
tree | 80a4cde902bab4874dc094d7f1729fe318156586 /saga | |
parent | d6ea15bf1f50f9167cbd228df9f99e9ed67becbb (diff) | |
download | scummvm-rg350-f8865304bde2e79d25727abebcbc33033b051598.tar.gz scummvm-rg350-f8865304bde2e79d25727abebcbc33033b051598.tar.bz2 scummvm-rg350-f8865304bde2e79d25727abebcbc33033b051598.zip |
Initialize a few variables to fix Valgrind warnings. (I'm hoping they were
the reason the ITE intro crashed for me.) I still get read warnings in
Sprite::decodeRLEBuffer() though.
Also added a couple of hacks to keep the IHNM intro alive. Once we support
IHNM actors, we'll be able to remove them.
svn-id: r16579
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 51 | ||||
-rw-r--r-- | saga/script.cpp | 3 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 5 |
3 files changed, 42 insertions, 17 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index ed052f8c0e..095d245dcd 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -138,10 +138,6 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { debug(9, "Actor::Actor()"); _actors = NULL; - if (_vm->getGameType() == GType_IHNM) { - warning("Actors aren't implemented for IHNM yet"); - return; - } #ifdef ACTOR_DEBUG _debugPoints = NULL; @@ -156,7 +152,6 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { _pathDirectionListCount = 0; _pathDirectionListAlloced = 0; - _centerActor = _protagonist = NULL; _lastTickMsec = 0; @@ -165,25 +160,28 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { _pathCell = (int8*) malloc(_yCellCount * _xCellCount * sizeof(*_pathCell)); - _pathRect.left = 0; _pathRect.right = _vm->getDisplayWidth(); _pathRect.top = _vm->getDisplayInfo().pathStartY; _pathRect.bottom = _vm->getSceneHeight(); - // Get actor resource file context - _actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0); - if (_actorContext == NULL) { - error("Actor::Actor(): Couldn't load actor module resource context."); - } + if (_vm->getGameType() == GType_ITE) { + // Get actor resource file context + _actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0); + if (_actorContext == NULL) { + error("Actor::Actor(): Couldn't load actor module resource context."); + } - result = RSC_LoadResource(_actorContext, RID_ITE_ACTOR_NAMES, &stringsPointer, &stringsLength); // fixme: IHNM - if ((result != SUCCESS) || (stringsLength == 0)) { - error("Error loading strings list resource"); - } + result = RSC_LoadResource(_actorContext, RID_ITE_ACTOR_NAMES, &stringsPointer, &stringsLength); // fixme: IHNM + if ((result != SUCCESS) || (stringsLength == 0)) { + error("Error loading strings list resource"); + } - _vm->loadStrings(_actorsStrings, stringsPointer, stringsLength); - RSC_FreeResource(stringsPointer); + _vm->loadStrings(_actorsStrings, stringsPointer, stringsLength); + RSC_FreeResource(stringsPointer); + } else { + // TODO + } if (_vm->getGameType() == GType_ITE) { _actorsCount = ITE_ACTORCOUNT; @@ -217,6 +215,15 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { warning("Disabling actorId=%d index=%d", actor->actorId, actor->index); } } + } else { + // TODO. + static ActorData dummyActor; + + dummyActor.frames = NULL; + dummyActor.walkStepsPoints = NULL; + + _protagonist = &dummyActor; + _actorsCount = 0; } } @@ -1421,6 +1428,11 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, ActorData *actor; int i; + if (_vm->getGameType() == GType_IHNM) { + warning("Actors aren't implemented for IHNM yet"); + return; + } + actor = getActor(actorId); for (i = 0; i < stringsCount; i++) { _activeSpeech.strings[i] = strings[i]; @@ -1462,6 +1474,11 @@ void Actor::nonActorSpeech(const char **strings, int stringsCount, int speechFla void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags) { int i; + if (_vm->getGameType() == GType_IHNM) { + warning("Actors aren't implemented for IHNM yet"); + return; + } + for (i = 0; i < actorIdsCount; i++) { ActorData *actor; diff --git a/saga/script.cpp b/saga/script.cpp index f404c3abe3..8310049b35 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -63,6 +63,9 @@ Script::Script() { _abortEnabled = true; _skipSpeeches = false; + _firstObjectSet = false; + _secondObjectNeeded = false; + _pendingVerb = kVerbNone; _currentVerb = kVerbNone; _stickyVerb = kVerbWalkTo; _leftButtonVerb = kVerbNone; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index d3dc57858f..31ae5fd28e 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -934,6 +934,11 @@ int Script::sfPlaceActor(SCRIPTFUNC_PARAMS) { debug(1, "sfPlaceActor(%d, %d, %d, %d, %d, %d)", actorId, actorLocation.x, actorLocation.y, actorDirection, frameType, frameOffset); + if (_vm->getGameType() == GType_IHNM) { + warning("Actors aren't implemented for IHNM yet"); + return SUCCESS; + } + actor = _vm->_actor->getActor(actorId); actor->location.x = actorLocation.x; actor->location.y = actorLocation.y; |