[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.110,1.111 actor.h,1.59,1.60 events.cpp,1.47,1.48 game.cpp,1.58,1.59 isomap.cpp,1.38,1.39 itedata.h,1.1,1.2 objectmap.cpp,1.38,1.39 saga.cpp,1.100,1.101 saga.h,1.82,1.83 scene.cpp,1.91,1.92 scene.h,1.46,1.47 script.cpp,1.61,1.62 sfuncs.cpp,1.94,1.95
Andrew Kurushin
h00ligan at users.sourceforge.net
Fri Mar 18 09:12:40 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: tools descumm.cpp,1.96,1.97
- Next message: [Scummvm-cvs-logs] CVS: residual font.cpp,NONE,1.1 Makefile.common,1.17,1.18 driver_gl.cpp,1.36,1.37 font.h,1.2,1.3 lua.cpp,1.107,1.108 resource.cpp,1.22,1.23 resource.h,1.14,1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27788
Modified Files:
actor.cpp actor.h events.cpp game.cpp isomap.cpp itedata.h
objectmap.cpp saga.cpp saga.h scene.cpp scene.h script.cpp
sfuncs.cpp
Log Message:
- changescene on fair for tents
- some memory deallocation fixup
todo: fix follower stuckiness in tents
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- actor.cpp 13 Mar 2005 17:43:49 -0000 1.110
+++ actor.cpp 18 Mar 2005 17:11:34 -0000 1.111
@@ -62,6 +62,9 @@
static int tileCommonObjectCompare(const CommonObjectDataPointer& obj1, const CommonObjectDataPointer& obj2) {
int p1 = -obj1->location.u() - obj1->location.v() - obj1->location.z;
int p2 = -obj2->location.u() - obj2->location.v() - obj2->location.z;
+ //TODO: for kObjNotFlat obj Height*3 of sprite should be adde to p1 and p2
+ //if (validObjId(obj1->id)) {
+
if (p1 == p2) {
return 0;
} else {
@@ -248,15 +251,15 @@
debug(9, "init obj id=%d index=%d", obj->id, obj->index);
obj->nameIndex = ITE_ObjectTable[i].nameIndex;
obj->scriptEntrypointNumber = ITE_ObjectTable[i].scriptEntrypointNumber;
- obj->spriteListResourceId = ITE_ObjectTable[i].spriteListResourceId;
+ obj->frameNumber = ITE_ObjectTable[i].frameNumber;
obj->sceneNumber = ITE_ObjectTable[i].sceneIndex;
obj->interactBits = ITE_ObjectTable[i].interactBits;
obj->flags = 0;
- obj->frameNumber = 0;
obj->location.x = ITE_ObjectTable[i].x;
obj->location.y = ITE_ObjectTable[i].y;
obj->location.z = ITE_ObjectTable[i].z;
+ obj->disabled = false;
}
} else {
@@ -352,7 +355,7 @@
resourceId = actor->spriteListResourceId;
debug(9, "Loading sprite resource id %d", resourceId);
if (_vm->_sprite->loadList(resourceId, actor->spriteList) != SUCCESS) {
- warning("Unable to load sprite list");
+ warning("loadActorResources: Unable to load sprite list");
return false;
}
@@ -439,7 +442,7 @@
angle = location.x & 15;
distance = location.y;
- location.x = (angleLUT[angle][0] * distance) >> 6; //fixme - call real angle calc
+ location.x = (angleLUT[angle][0] * distance) >> 6;
location.y = (angleLUT[angle][1] * distance) >> 6;
}
}
@@ -506,6 +509,9 @@
obj = _objs[objIdToIndex(objId)];
+ if (obj->disabled)
+ error("Actor::getObj disabled objId 0x%X", objId);
+
return obj;
}
@@ -525,7 +531,7 @@
actor = _actors[actorIdToIndex(actorId)];
if (actor->disabled)
- warning("Actor::getActor disabled actorId 0x%X", actorId);
+ error("Actor::getActor disabled actorId 0x%X", actorId);
return actor;
}
@@ -841,7 +847,6 @@
case kActionWalkToPoint:
case kActionWalkToLink:
- // tiled stuff
if (_vm->_scene->getFlags() & kSceneFlagISO) {
actor->partialTarget.delta(actor->location, delta);
@@ -979,7 +984,6 @@
break;
case kActionWalkDir:
- // tiled stuff
if (_vm->_scene->getFlags() & kSceneFlagISO) {
actor->location.u() += tileDirectionLUT[actor->actionDirection][0];
actor->location.v() += tileDirectionLUT[actor->actionDirection][1];
@@ -1092,7 +1096,7 @@
if ((actor->currentAction >= kActionWalkToPoint) && (actor->currentAction <= kActionWalkDir)) {
hitZone = NULL;
- // tiled stuff
+
if (_vm->_scene->getFlags() & kSceneFlagISO) {
actor->location.toScreenPointUV(hitPoint);
} else {
@@ -1198,13 +1202,14 @@
if (actor->disabled) continue;
if (actor->sceneNumber != _vm->_scene->currentSceneNumber()) continue;
- _drawOrderList.pushBack(actor, compareFunction);
+ _drawOrderList.pushBack(actor, compareFunction);
calcScreenPosition(actor);
}
for (i = 0; i < _objsCount; i++) {
obj = _objs[i];
+ if (obj->disabled) continue;
if (obj->sceneNumber != _vm->_scene->currentSceneNumber()) continue;
_drawOrderList.pushBack(obj, compareFunction);
@@ -1223,13 +1228,17 @@
spriteList = &_vm->_sprite->_mainSprites;
} else {
frameNumber = commonObjectData->frameNumber;
- spriteList = &commonObjectData->spriteList;
+ if (validActorId(commonObjectData->id)) {
+ spriteList = &((ActorData*)commonObjectData)->spriteList;
+ } else {
+ spriteList = &_vm->_sprite->_mainSprites;
+ }
+
}
+
+
if ((frameNumber < 0) || (spriteList->spriteCount <= frameNumber)) {
- if (_vm->_scene->getFlags() & kSceneFlagISO) { // TODO: remove it
- return false;
- }
warning("Actor::getSpriteParams frameNumber invalid for object id 0x%X", commonObjectData->id);
return false;
}
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- actor.h 13 Mar 2005 17:43:50 -0000 1.59
+++ actor.h 18 Mar 2005 17:11:34 -0000 1.60
@@ -186,6 +186,7 @@
class CommonObjectData {
public:
+ bool disabled; // disabled in init section
int index; // index in local array
uint16 id; // object id
uint16 flags; // initial flags
@@ -198,9 +199,6 @@
int screenDepth; //
int screenScale; //
- SpriteList spriteList; // sprite list data
- int spriteListResourceId; // sprite list resource id
-
int frameNumber; // current frame number
CommonObjectData() {
@@ -208,6 +206,7 @@
flags = 0;
frameNumber = 0;
}
+
};
typedef CommonObjectData *CommonObjectDataPointer;
@@ -221,7 +220,7 @@
class ActorData: public CommonObjectData {
public:
- bool disabled; // Actor disabled in init section
+
byte speechColor; // Actor dialogue color
uint16 actorFlags; // dynamic flags
@@ -237,12 +236,13 @@
uint8 cycleTimeCount;
uint8 cycleFlags;
+ SpriteList spriteList; // sprite list data
+ int spriteListResourceId; // sprite list resource id
+
ActorFrameSequence *frames; // Actor's frames
int framesCount; // Actor's frames count
int frameListResourceId; // Actor's frame list resource id
- //int walkPath[ACTOR_STEPS_MAX]; //todo: will gone
-
int tileDirectionsAlloced;
byte *tileDirections;
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- events.cpp 21 Jan 2005 21:55:52 -0000 1.47
+++ events.cpp 18 Mar 2005 17:11:34 -0000 1.48
@@ -408,8 +408,6 @@
sthread->_threadVars[kThreadVarWithObject] = TO_LE_16(event->param5);
sthread->_threadVars[kThreadVarActor] = TO_LE_16(event->param6);
-// _vm->_script->executeThread(sthread, event->param);
-
if (event->op == EVENT_EXEC_BLOCKING)
_vm->_script->completeThread();
Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- game.cpp 8 Mar 2005 10:59:31 -0000 1.58
+++ game.cpp 18 Mar 2005 17:11:34 -0000 1.59
@@ -108,8 +108,8 @@
};
static GameFontDescription ITEMACDEMO_GameFonts[] = {
- {0},
- {2}
+ {2},
+ {0}
};
// Inherit the Earth - Wyrmkeep Win32 Demo version
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- isomap.cpp 13 Mar 2005 17:43:50 -0000 1.38
+++ isomap.cpp 18 Mar 2005 17:11:35 -0000 1.39
@@ -257,14 +257,19 @@
void IsoMap::freeMem() {
free(_tileData);
+ _tileData = NULL;
_tilesCount = 0;
free(_tilePlatformList);
+ _tilePlatformList = NULL;
_tilePlatformsCount = 0;
free(_metaTileList);
+ _metaTileList = NULL;
_metaTilesCount = 0;
free(_multiTable);
+ _multiTable = NULL;
_multiCount = 0;
free(_multiTableData);
+ _multiTableData = NULL;
_multiDataCount = 0;
}
Index: itedata.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/itedata.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- itedata.h 28 Jan 2005 12:54:09 -0000 1.1
+++ itedata.h 18 Mar 2005 17:11:36 -0000 1.2
@@ -71,7 +71,7 @@
int16 x;
int16 y;
int16 z;
- int32 spriteListResourceId;
+ int32 frameNumber;
byte scriptEntrypointNumber;
uint16 interactBits;
};
Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- objectmap.cpp 27 Jan 2005 20:07:01 -0000 1.38
+++ objectmap.cpp 18 Mar 2005 17:11:36 -0000 1.39
@@ -34,6 +34,9 @@
#include "saga/interface.h"
#include "saga/objectmap.h"
#include "saga/stream.h"
+#include "saga/actor.h"
+#include "saga/scene.h"
+#include "saga/isomap.h"
namespace Saga {
@@ -57,7 +60,7 @@
for (i = 0; i < _clickAreasCount; i++) {
clickArea = &_clickAreas[i];
- clickArea->pointsCount = readStream->readUint16();
+ clickArea->pointsCount = readStream->readUint16LE();
assert(clickArea->pointsCount);
@@ -189,6 +192,7 @@
free(_hitZoneList);
_hitZoneList = NULL;
}
+ _hitZoneListCount = 0;
}
@@ -197,8 +201,17 @@
int i;
int hitZoneIndex;
char txtBuf[32];
+ Point pickPoint;
+ Location pickLocation;
+ pickPoint = testPoint;
+ if (_vm->_scene->getFlags() & kSceneFlagISO) {
+ assert(_vm->_actor->_protagonist);
+ pickPoint.y -= _vm->_actor->_protagonist->location.z;
+ _vm->_isoMap->screenPointToTileCoords(pickPoint, pickLocation);
+ pickLocation.toScreenPointUV(pickPoint);
+ }
- hitZoneIndex = hitTest(testPoint);
+ hitZoneIndex = hitTest(pickPoint);
for (i = 0; i < _hitZoneListCount; i++) {
_hitZoneList[i]->draw(ds, (hitZoneIndex == i) ? color2 : color);
Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- saga.cpp 9 Mar 2005 18:12:40 -0000 1.100
+++ saga.cpp 18 Mar 2005 17:11:36 -0000 1.101
@@ -120,6 +120,24 @@
_gameFileContexts = NULL;
_quit = false;
+ _sndRes = NULL;
+ _events = NULL;
+ _font = NULL;
+ _sprite = NULL;
+ _anim = NULL;
+ _script = NULL;
+ _interface = NULL;
+ _actor = NULL;
+ _palanim = NULL;
+ _scene = NULL;
+ _isoMap = NULL;
+ _gfx = NULL;
+ _console = NULL;
+ _render = NULL;
+ _music = NULL;
+ _sound = NULL;
+
+
// The Linux version of Inherit the Earth puts all data files in an
// 'itedata' sub-directory, except for voices.rsc
File::addDefaultDirectory(_gameDataPath + "itedata/");
@@ -147,23 +165,54 @@
SagaEngine::~SagaEngine() {
int i;
- delete _scene;
- delete _actor;
- delete _script;
- delete _sprite;
- delete _font;
- delete _console;
- delete _events;
- delete _palanim;
-
- delete _interface;
- delete _render;
- delete _isoMap;
- delete _sndRes;
- // Shutdown system modules */
- delete _music;
- delete _sound;
- delete _anim;
+ if (_sndRes != NULL) {
+ delete _sndRes;
+ }
+ if (_events != NULL) {
+ delete _events;
+ }
+ if (_font != NULL) {
+ delete _font;
+ }
+ if (_sprite != NULL) {
+ delete _sprite;
+ }
+ if (_anim != NULL) {
+ delete _anim;
+ }
+ if (_script != NULL) {
+ delete _script;
+ }
+ if (_interface != NULL) {
+ delete _interface;
+ }
+ if (_actor != NULL) {
+ delete _actor;
+ }
+ if (_palanim != NULL) {
+ delete _palanim;
+ }
+ if (_scene != NULL) {
+ delete _scene;
+ }
+ if (_isoMap != NULL) {
+ delete _isoMap;
+ }
+ if (_render != NULL) {
+ delete _render;
+ }
+ if (_music != NULL) {
+ delete _music;
+ }
+ if (_sound != NULL) {
+ delete _sound;
+ }
+ if (_gfx != NULL) {
+ delete _gfx;
+ }
+ if (_console != NULL) {
+ delete _console;
+ }
if (_gameFileContexts != NULL) {
for (i = 0; i < _gameDescription->filesCount; i++) {
@@ -197,7 +246,7 @@
// Detect game and open resource files
if (initGame() != SUCCESS) {
- return -1;
+ return FAILURE;
}
// Initialize engine modules
@@ -215,8 +264,7 @@
if (!_scene->initialized()) {
warning("Couldn't initialize scene module");
- // TODO/FIXME: We are leaking here
- return -1;
+ return FAILURE;
}
// System initialization
@@ -253,8 +301,7 @@
_render = new Render(this, _system);
if (!_render->initialized()) {
- // TODO/FIXME: We are leaking here
- return -1;
+ return FAILURE;
}
// Initialize system specific sound
@@ -266,7 +313,7 @@
_interface->converseInit();
_script->setVerb(kVerbWalkTo);
- return 0;
+ return SUCCESS;
}
int SagaEngine::go() {
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- saga.h 21 Jan 2005 23:16:38 -0000 1.82
+++ saga.h 18 Mar 2005 17:11:36 -0000 1.83
@@ -81,7 +81,7 @@
struct StringList;
enum ERRORCODE {
- MEM = -2,
+ MEM = -2,//todo: remove
FAILURE = -1,
SUCCESS = 0
};
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- scene.cpp 24 Feb 2005 08:03:47 -0000 1.91
+++ scene.cpp 18 Mar 2005 17:11:36 -0000 1.92
@@ -283,7 +283,7 @@
return SUCCESS;
}
-int Scene::changeScene(int sceneNumber, int actorsEntrance) {
+int Scene::changeScene(int sceneNumber, int actorsEntrance, int fadeIn) {
assert(_initialized);
if (!_sceneLoaded) {
@@ -302,7 +302,7 @@
}
endScene();
- loadScene(sceneNumber, BY_SCENE, SC_defaultScene, NULL, SCENE_NOFADE, actorsEntrance);
+ loadScene(sceneNumber, BY_SCENE, SC_defaultScene, NULL, fadeIn, actorsEntrance);
return SUCCESS;
}
@@ -965,6 +965,7 @@
_actionMap->freeMem();
_entryList.freeMem();
_sceneStrings.freeMem();
+ _vm->_isoMap->freeMem();
_animList.clear();
Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- scene.h 28 Jan 2005 19:25:40 -0000 1.46
+++ scene.h 18 Mar 2005 17:11:36 -0000 1.47
@@ -254,7 +254,7 @@
void getSlopes(int &beginSlope, int &endSlope);
int clearSceneQueue(void);
- int changeScene(int sceneNumber, int actorsEntrance);
+ int changeScene(int sceneNumber, int actorsEntrance, int fadeIn = SCENE_NOFADE);
bool initialized() { return _initialized; }
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- script.cpp 9 Mar 2005 07:29:15 -0000 1.61
+++ script.cpp 18 Mar 2005 17:11:37 -0000 1.62
@@ -677,10 +677,10 @@
int newRightButtonVerb;
uint16 newObjectId;
ActorData *actor;
+ Point pickPoint;
Location pickLocation;
int hitZoneIndex;
const HitZone * hitZone;
- Point tempPoint;
objectId = ID_NOTHING;
objectFlags = 0;
@@ -719,17 +719,16 @@
}
if (newObjectId == ID_NOTHING) {
+
+ pickPoint = mousePoint;
+
if (_vm->_scene->getFlags() & kSceneFlagISO) {
- tempPoint = mousePoint;
- tempPoint.y -= _vm->_actor->_protagonist->location.z;
- _vm->_isoMap->screenPointToTileCoords(tempPoint, pickLocation);
- } else {
- pickLocation.x = mousePoint.x;
- pickLocation.y = mousePoint.y;
- pickLocation.z = 0;
+ pickPoint.y -= _vm->_actor->_protagonist->location.z;
+ _vm->_isoMap->screenPointToTileCoords(pickPoint, pickLocation);
+ pickLocation.toScreenPointUV(pickPoint);
}
- hitZoneIndex = _vm->_scene->_objectMap->hitTest(mousePoint);
+ hitZoneIndex = _vm->_scene->_objectMap->hitTest(pickPoint);
if ((hitZoneIndex != -1)) {
hitZone = _vm->_scene->_objectMap->getHitZone(hitZoneIndex);
Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- sfuncs.cpp 8 Mar 2005 15:28:01 -0000 1.94
+++ sfuncs.cpp 18 Mar 2005 17:11:37 -0000 1.95
@@ -504,11 +504,14 @@
// This is used for latter demos where all places on world map except
// Tent Faire are substituted with LBM picture and short description
// TODO: implement
- for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++)
- if (sceneSubstitutes[i].sceneId == sceneNumber)
+ for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) {
+
+ if (sceneSubstitutes[i].sceneId == sceneNumber) {
debug(0, "Scene %d substitute exists", sceneNumber);
+ }
+ }
-// _vm->_scene->loadScene(sceneNumber, BY_SCENE, _vm->_scene->SC_defaultScene, NULL, (sceneNumber = RID_ITE_ENDCREDIT_SCENE_1) ? SCENE_FADE : SCENE_NOFADE, entrance);
+ _vm->_scene->changeScene(sceneNumber, entrance, (sceneNumber == RID_ITE_ENDCREDIT_SCENE_1) ? SCENE_FADE : SCENE_NOFADE);
//TODO: placard stuff
_pendingVerb = kVerbNone;
@@ -913,7 +916,7 @@
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
if (frameRange->frameCount <= frameOffset) {
- // frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
+ frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
error("Wrong frameOffset 0x%X", frameOffset);
}
@@ -1012,8 +1015,9 @@
if (frameType >= 0) {
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
- if (frameRange->frameCount <= frameOffset)
+ if (frameRange->frameCount <= frameOffset) {
error("Wrong frameOffset 0x%X", frameOffset);
+ }
actor->frameNumber = frameRange->frameIndex + frameOffset;
actor->currentAction = kActionFreeze;
- Previous message: [Scummvm-cvs-logs] CVS: tools descumm.cpp,1.96,1.97
- Next message: [Scummvm-cvs-logs] CVS: residual font.cpp,NONE,1.1 Makefile.common,1.17,1.18 driver_gl.cpp,1.36,1.37 font.h,1.2,1.3 lua.cpp,1.107,1.108 resource.cpp,1.22,1.23 resource.h,1.14,1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list