diff options
author | Andrew Kurushin | 2005-01-05 19:03:49 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-01-05 19:03:49 +0000 |
commit | c93c1cab8f56d5f8bebaa61a4ac837c8c7453357 (patch) | |
tree | 5ee60f9b8238a9acee21c3c5262b793351e8de9b /saga/actor.h | |
parent | c53c4f13d915e5365d669823dfc95a1033ec1252 (diff) | |
download | scummvm-rg350-c93c1cab8f56d5f8bebaa61a4ac837c8c7453357.tar.gz scummvm-rg350-c93c1cab8f56d5f8bebaa61a4ac837c8c7453357.tar.bz2 scummvm-rg350-c93c1cab8f56d5f8bebaa61a4ac837c8c7453357.zip |
- path finding work in progress
svn-id: r16438
Diffstat (limited to 'saga/actor.h')
-rw-r--r-- | saga/actor.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/saga/actor.h b/saga/actor.h index e799635575..d0f7c2190a 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -34,8 +34,7 @@ namespace Saga { #define ACTOR_BARRIERS_MAX 16 -#define ACTOR_STEPS_COUNT 32 -#define ACTOR_STEPS_MAX (ACTOR_STEPS_COUNT*2) +#define ACTOR_MAX_STEPS_COUNT 32 #define ACTOR_DIALOGUE_HEIGHT 100 @@ -170,6 +169,14 @@ struct ActorLocation { y = (screenPoint.y * ACTOR_LMULT); z = 0; } + void toScreenPointXY(Point &screenPoint) const { + screenPoint.x = x / ACTOR_LMULT; + screenPoint.y = y / ACTOR_LMULT; + } + void toScreenPointXYZ(Point &screenPoint) const { + screenPoint.x = x / ACTOR_LMULT; + screenPoint.y = y / ACTOR_LMULT - z; + } }; struct ActorData { @@ -208,9 +215,12 @@ struct ActorData { int framesCount; // Actor's frames count int frameListResourceId; // Actor's frame list resource id - int walkPath[ACTOR_STEPS_MAX]; +// int walkPath[ACTOR_STEPS_MAX]; //todo: will gone int walkStepsCount; + int walkStepsAlloced; int walkStepIndex; + Point *walkStepsPoints; + ActorLocation finalTarget; ActorLocation partialTarget; int walkFrameSequence; @@ -219,15 +229,22 @@ struct ActorData { if (actionCycle >= cycleLimit) actionCycle = 0; } - void addWalkPath(int x, int y) { - if (walkStepsCount + 2 > ACTOR_STEPS_MAX) - error("walkStepsCount exceeds"); - walkPath[walkStepsCount++] = x; - walkPath[walkStepsCount++] = y; + + void addWalkStepPoint(const Point &point) { + if (walkStepsCount + 1 > walkStepsAlloced) { + walkStepsAlloced += 100; + walkStepsPoints = (Point*)realloc(walkStepsPoints, walkStepsAlloced * sizeof(*walkStepsPoints)); + } + walkStepsPoints[walkStepsCount++] = point; } ActorData() { memset(this, 0xFE, sizeof(*this)); + walkStepsPoints = NULL; + walkStepsAlloced = walkStepsCount = walkStepIndex = 0; + } + ~ActorData() { + free(walkStepsPoints); } }; |