[Scummvm-cvs-logs] SF.net SVN: scummvm:[39087] scummvm/trunk/engines/cruise
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Tue Mar 3 11:10:38 CET 2009
Revision: 39087
http://scummvm.svn.sourceforge.net/scummvm/?rev=39087&view=rev
Author: dreammaster
Date: 2009-03-03 10:10:35 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
Changed the int16[5] array used in pathfinding to a structure with explicitly named fields
Modified Paths:
--------------
scummvm/trunk/engines/cruise/actor.cpp
scummvm/trunk/engines/cruise/cruise_main.cpp
scummvm/trunk/engines/cruise/perso.cpp
scummvm/trunk/engines/cruise/perso.h
Modified: scummvm/trunk/engines/cruise/actor.cpp
===================================================================
--- scummvm/trunk/engines/cruise/actor.cpp 2009-03-03 09:00:49 UTC (rev 39086)
+++ scummvm/trunk/engines/cruise/actor.cpp 2009-03-03 10:10:35 UTC (rev 39087)
@@ -580,13 +580,13 @@
/**
* Computes a path for an actor to walk between a given source and destination position
*/
-int16 computePathfinding(int16 *pSolution, int16 x, int16 y, int16 destX, int16 destY, int16 stepX, int16 stepY, int16 oldPathId) {
+int16 computePathfinding(MovementEntry &solution, int16 x, int16 y, int16 destX, int16 destY, int16 stepX, int16 stepY, int16 oldPathId) {
persoStruct *perso;
int num;
if (!polyStruct) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
return -1;
}
@@ -608,8 +608,8 @@
}
if (i == NUM_PERSONS) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
return -1;
}
@@ -623,11 +623,11 @@
*(ptr++) = x;
*(ptr++) = y;
- *(ptr++) = pSolution[0] = destX;
- *(ptr++) = pSolution[1] = destY;
+ *(ptr++) = solution.x = destX;
+ *(ptr++) = solution.y = destY;
*(ptr++) = -1;
- pSolution[4] = computedVar14;
+ solution.poly = computedVar14;
perso->inc_droite = 0;
perso->inc_chemin = 0;
@@ -640,8 +640,8 @@
flag_aff_chemin = 0;
if (x == destX && y == destY) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
return (-1);
}
@@ -650,14 +650,14 @@
getPixel(x, y);
- pSolution[4] = computedVar14;
+ solution.poly = computedVar14;
x_mouse = x;
y_mouse = y;
if (!flag_obstacle || (point_select = point_proche(ctp_routeCoords)) == -1) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
return (-1);
}
@@ -673,8 +673,8 @@
num++;
if (num == NUM_PERSONS) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
return (-1);
}
@@ -690,16 +690,16 @@
valide_noeud(select_noeud, point_select, &nclick_noeud, perso->solution);
if ((!flag_aff_chemin) || ((table_ptselect[0][0] == table_ptselect[1][0]) && (table_ptselect[0][1] == table_ptselect[1][1]))) {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ solution.x = -1;
+ solution.y = -1;
freePerso(num);
return (-1);
}
- pSolution[0] = table_ptselect[1][0];
- pSolution[1] = table_ptselect[1][1];
- pSolution[4] = computedVar14;
+ solution.x = table_ptselect[1][0];
+ solution.y = table_ptselect[1][1];
+ solution.poly = computedVar14;
perso->inc_chemin = 0;
perso->inc_droite = 0;
@@ -728,7 +728,7 @@
*/
void processAnimation(void) {
objectParamsQuery params;
- int16 returnVar2[5];
+ MovementEntry moveInfo;
actorStruct *currentActor = actorHead.next;
actorStruct *nextActor;
@@ -750,7 +750,7 @@
currentActor->flag = 1;
}
- currentActor->pathId = computePathfinding(returnVar2, params.X, params.Y,
+ currentActor->pathId = computePathfinding(moveInfo, params.X, params.Y,
aniX, aniY, currentActor->stepX, currentActor->stepY, currentActor->pathId);
if (currentActor->pathId == ANIM_WAIT) {
@@ -772,7 +772,7 @@
} else
if ((currentActor->type == 1) && (currentActor->x_dest != -1) && (currentActor->y_dest != -1)) {
// track animation
- currentActor->pathId = computePathfinding(returnVar2, params.X, params.Y, currentActor->x_dest, currentActor->y_dest, currentActor->stepX, currentActor->stepY, currentActor->pathId);
+ currentActor->pathId = computePathfinding(moveInfo, params.X, params.Y, currentActor->x_dest, currentActor->y_dest, currentActor->stepX, currentActor->stepY, currentActor->pathId);
currentActor->x_dest = -1;
currentActor->y_dest = -1;
@@ -809,9 +809,9 @@
// In-place (on the spot) animationos
if ((currentActor->counter == -1) && (currentActor->phase == ANIM_PHASE_STATIC)) {
- affiche_chemin(currentActor->pathId, returnVar2);
+ affiche_chemin(currentActor->pathId, moveInfo);
- if (returnVar2[0] == -1) {
+ if (moveInfo.x == -1) {
currentActor->pathId = ANIM_FINISH;
currentActor->flag = 0;
currentActor->endDirection = -1;
@@ -819,10 +819,10 @@
break;
}
- currentActor->x = returnVar2[0];
- currentActor->y = returnVar2[1];
- currentActor->nextDirection = returnVar2[2];
- currentActor->poly = returnVar2[4];
+ currentActor->x = moveInfo.x;
+ currentActor->y = moveInfo.y;
+ currentActor->nextDirection = moveInfo.direction;
+ currentActor->poly = moveInfo.poly;
currentActor->counter = 0;
if (currentActor->startDirection == currentActor->nextDirection)
@@ -886,9 +886,9 @@
// Walk animations
if (currentActor->counter >= 1) {
- affiche_chemin(currentActor->pathId, returnVar2);
+ affiche_chemin(currentActor->pathId, moveInfo);
- if (returnVar2[0] == -1) {
+ if (moveInfo.x == -1) {
if ((currentActor->endDirection == -1) || (currentActor->endDirection == currentActor->nextDirection)) {
currentActor->phase = ANIM_PHASE_END;
} else {
@@ -898,10 +898,10 @@
currentActor->counter = 0;
break;
} else {
- currentActor->x = returnVar2[0];
- currentActor->y = returnVar2[1];
- currentActor->nextDirection = returnVar2[2];
- currentActor->poly = returnVar2[4];
+ currentActor->x = moveInfo.x;
+ currentActor->y = moveInfo.y;
+ currentActor->nextDirection = moveInfo.direction;
+ currentActor->poly = moveInfo.poly;
}
}
Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp 2009-03-03 09:00:49 UTC (rev 39086)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp 2009-03-03 10:10:35 UTC (rev 39087)
@@ -1829,7 +1829,7 @@
// wait for character to finish auto track
if (autoTrack) {
- if (isAnimFinished(narratorOvl, narratorIdx, &actorHead, 0)) {
+ if (isAnimFinished(narratorOvl, narratorIdx, &actorHead, ATP_MOUSE)) {
if (autoMsg != -1) {
freezeCell(&cellHead, autoOvl, autoMsg, 5, -1, 9998, 0);
Modified: scummvm/trunk/engines/cruise/perso.cpp
===================================================================
--- scummvm/trunk/engines/cruise/perso.cpp 2009-03-03 09:00:49 UTC (rev 39086)
+++ scummvm/trunk/engines/cruise/perso.cpp 2009-03-03 10:10:35 UTC (rev 39087)
@@ -168,7 +168,7 @@
return numOutput;
}
-void processActorWalk(int16 resx_y[4], int16 *inc_droite, int16 *inc_droite0,
+void processActorWalk(MovementEntry &resx_y, int16 *inc_droite, int16 *inc_droite0,
int16 *inc_chemin, point* cor_joueur,
int16 solution0[NUM_NODES + 3][2], int16 *inc_jo1, int16 *inc_jo2,
int16 *dir_perso, int16 *inc_jo0, int16 num) {
@@ -190,15 +190,15 @@
x2 = solution0[i][0];
y2 = solution0[i][1];
if ((x1 == x2) && (y1 == y2)) {
- resx_y[0] = -1;
- resx_y[1] = -1;
+ resx_y.x = -1;
+ resx_y.y = -1;
freePerso(num);
return;
}
*inc_droite0 = cor_droite(x1, y1, x2, y2, cor_joueur);
- *dir_perso = resx_y[2] = direction(x1, y1, x2, y2, *inc_jo1, *inc_jo2);
+ *dir_perso = resx_y.direction = direction(x1, y1, x2, y2, *inc_jo1, *inc_jo2);
*inc_jo0 = inc_jo;
u = 1;
} else
@@ -207,8 +207,8 @@
} while (solution0[i][0] != -1 && !u);
}
if (!u) {
- resx_y[0] = -1;
- resx_y[1] = -1;
+ resx_y.x = -1;
+ resx_y.y = -1;
freePerso(num);
return;
@@ -216,33 +216,33 @@
*inc_chemin = i;
}
- resx_y[0] = cor_joueur[*inc_droite].x;
- resx_y[1] = cor_joueur[*inc_droite].y;
- resx_y[2] = *dir_perso;
- resx_y[3] = computeZoom(resx_y[1]);
+ resx_y.x = cor_joueur[*inc_droite].x;
+ resx_y.y = cor_joueur[*inc_droite].y;
+ resx_y.direction = *dir_perso;
+ resx_y.zoom = computeZoom(resx_y.y);
- getPixel(resx_y[0], resx_y[1]);
- resx_y[4] = computedVar14;
+ getPixel(resx_y.x, resx_y.y);
+ resx_y.poly = computedVar14;
- u = subOp23(resx_y[3], inc_jo);
+ u = subOp23(resx_y.zoom, inc_jo);
if (!u)
u = 1;
*inc_droite += u;
if ((*inc_droite) >= (*inc_droite0)) {
*inc_droite = 0;
- resx_y[0] = solution0[*inc_chemin][0];
- resx_y[1] = solution0[*inc_chemin][1];
+ resx_y.x = solution0[*inc_chemin][0];
+ resx_y.y = solution0[*inc_chemin][1];
}
}
-void affiche_chemin(int16 persoIdx, int16 *returnVar) {
+void affiche_chemin(int16 persoIdx, MovementEntry &data) {
persoStruct *pPerso = persoTable[persoIdx];
ASSERT(pPerso);
- processActorWalk(returnVar, &pPerso->inc_droite, &pPerso->inc_droite0,
+ processActorWalk(data, &pPerso->inc_droite, &pPerso->inc_droite0,
&pPerso->inc_chemin, pPerso->coordinates, pPerso->solution,
&pPerso->inc_jo1, &pPerso->inc_jo2, &pPerso->dir_perso,
&pPerso->inc_jo0, persoIdx);
Modified: scummvm/trunk/engines/cruise/perso.h
===================================================================
--- scummvm/trunk/engines/cruise/perso.h 2009-03-03 09:00:49 UTC (rev 39086)
+++ scummvm/trunk/engines/cruise/perso.h 2009-03-03 10:10:35 UTC (rev 39087)
@@ -50,13 +50,21 @@
int16 inc_jo0; // 2
};
+struct MovementEntry {
+ int16 x;
+ int16 y;
+ int16 direction;
+ int16 zoom;
+ int16 poly;
+};
+
extern persoStruct *persoTable[NUM_PERSONS];
extern int16 computedVar14;
int cor_droite(int x1, int y1, int x2, int y2, point* outputTable);
void freePerso(int persoIdx);
void freeCTP(void);
-void affiche_chemin(int16 persoIdx, int16 * returnVar);
+void affiche_chemin(int16 persoIdx, MovementEntry &data);
int direction(int x1, int y1, int x2, int y2, int inc_jo1, int inc_jo2);
} // End of namespace Cruise
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list