[Scummvm-cvs-logs] SF.net SVN: scummvm: [26631] scummvm/trunk/engines/cruise
sev at users.sourceforge.net
sev at users.sourceforge.net
Sat Apr 28 00:33:51 CEST 2007
Revision: 26631
http://scummvm.svn.sourceforge.net/scummvm/?rev=26631&view=rev
Author: sev
Date: 2007-04-27 15:33:45 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Fix code formatting (partially) and guard defines in includes.
Modified Paths:
--------------
scummvm/trunk/engines/cruise/actor.cpp
scummvm/trunk/engines/cruise/actor.h
scummvm/trunk/engines/cruise/background.cpp
scummvm/trunk/engines/cruise/background.h
scummvm/trunk/engines/cruise/backgroundIncrust.cpp
scummvm/trunk/engines/cruise/backgroundIncrust.h
scummvm/trunk/engines/cruise/cell.cpp
scummvm/trunk/engines/cruise/cell.h
scummvm/trunk/engines/cruise/cruise.cpp
scummvm/trunk/engines/cruise/cruise.h
scummvm/trunk/engines/cruise/cruise_main.cpp
scummvm/trunk/engines/cruise/cruise_main.h
scummvm/trunk/engines/cruise/ctp.cpp
scummvm/trunk/engines/cruise/ctp.h
scummvm/trunk/engines/cruise/dataLoader.cpp
scummvm/trunk/engines/cruise/dataLoader.h
scummvm/trunk/engines/cruise/decompiler.cpp
scummvm/trunk/engines/cruise/delphine-unpack.cpp
scummvm/trunk/engines/cruise/detection.cpp
scummvm/trunk/engines/cruise/font.cpp
scummvm/trunk/engines/cruise/font.h
scummvm/trunk/engines/cruise/fontCharacterTable.cpp
scummvm/trunk/engines/cruise/fontCharacterTable.h
scummvm/trunk/engines/cruise/function.cpp
scummvm/trunk/engines/cruise/function.h
scummvm/trunk/engines/cruise/gfxModule.cpp
scummvm/trunk/engines/cruise/gfxModule.h
scummvm/trunk/engines/cruise/linker.cpp
scummvm/trunk/engines/cruise/linker.h
scummvm/trunk/engines/cruise/mainDraw.cpp
scummvm/trunk/engines/cruise/mainDraw.h
scummvm/trunk/engines/cruise/menu.cpp
scummvm/trunk/engines/cruise/menu.h
scummvm/trunk/engines/cruise/mouse.cpp
scummvm/trunk/engines/cruise/mouse.h
scummvm/trunk/engines/cruise/object.cpp
scummvm/trunk/engines/cruise/object.h
scummvm/trunk/engines/cruise/overlay.cpp
scummvm/trunk/engines/cruise/overlay.h
scummvm/trunk/engines/cruise/perso.cpp
scummvm/trunk/engines/cruise/perso.h
scummvm/trunk/engines/cruise/polys.cpp
scummvm/trunk/engines/cruise/polys.h
scummvm/trunk/engines/cruise/saveload.cpp
scummvm/trunk/engines/cruise/saveload.h
scummvm/trunk/engines/cruise/script.cpp
scummvm/trunk/engines/cruise/script.h
scummvm/trunk/engines/cruise/stack.cpp
scummvm/trunk/engines/cruise/stack.h
scummvm/trunk/engines/cruise/stringSupport.cpp
scummvm/trunk/engines/cruise/stringSupport.h
scummvm/trunk/engines/cruise/various.cpp
scummvm/trunk/engines/cruise/various.h
scummvm/trunk/engines/cruise/vars.cpp
scummvm/trunk/engines/cruise/vars.h
scummvm/trunk/engines/cruise/volume.cpp
scummvm/trunk/engines/cruise/volume.h
Modified: scummvm/trunk/engines/cruise/actor.cpp
===================================================================
--- scummvm/trunk/engines/cruise/actor.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/actor.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -26,90 +26,85 @@
namespace Cruise {
-int16 mainProc13(int overlayIdx, int param1, actorStruct* pStartEntry, int param2)
-{
- actorStruct* pCurrentEntry = pStartEntry->next;
+int16 mainProc13(int overlayIdx, int param1, actorStruct *pStartEntry,
+ int param2) {
+ actorStruct *pCurrentEntry = pStartEntry->next;
- while(pCurrentEntry)
- {
- if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
- (pCurrentEntry->idx == param1 || param1 == -1) &&
- (pCurrentEntry->type == param2 || param2 == -1) &&
- (pCurrentEntry->pathId != -2))
- {
- return 0;
+ while (pCurrentEntry) {
+ if ((pCurrentEntry->overlayNumber == overlayIdx
+ || overlayIdx == -1) && (pCurrentEntry->idx == param1
+ || param1 == -1) && (pCurrentEntry->type == param2
+ || param2 == -1) && (pCurrentEntry->pathId != -2)) {
+ return 0;
+ }
+
+ pCurrentEntry = pCurrentEntry->next;
}
-
- pCurrentEntry = pCurrentEntry->next;
- }
- return 1;
+ return 1;
}
-actorStruct* findActor(int overlayIdx, int param1, actorStruct* pStartEntry, int param2)
-{
- actorStruct* pCurrentEntry = pStartEntry->next;
+actorStruct *findActor(int overlayIdx, int param1, actorStruct *pStartEntry,
+ int param2) {
+ actorStruct *pCurrentEntry = pStartEntry->next;
- while(pCurrentEntry)
- {
- if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
- (pCurrentEntry->idx == param1 || param1 == -1) &&
- (pCurrentEntry->type == param2 || param2 == -1) )
- {
- return pCurrentEntry;
+ while (pCurrentEntry) {
+ if ((pCurrentEntry->overlayNumber == overlayIdx
+ || overlayIdx == -1) && (pCurrentEntry->idx == param1
+ || param1 == -1) && (pCurrentEntry->type == param2
+ || param2 == -1)) {
+ return pCurrentEntry;
+ }
+
+ pCurrentEntry = pCurrentEntry->next;
}
-
- pCurrentEntry = pCurrentEntry->next;
- }
- return NULL;
+ return NULL;
}
int nclick_noeud;
int flag_aff_chemin;
-void getPixel(int x, int y)
-{
- int x_min, x_max, y_min, y_max;
+void getPixel(int x, int y) {
+ int x_min, x_max, y_min, y_max;
- ctpVar19Struct *polygone;
- ctpVar19SubStruct *tableau;
+ ctpVar19Struct *polygone;
+ ctpVar19SubStruct *tableau;
- polygone = ctpVar19; /* adr structure polygone */
+ polygone = ctpVar19; /* adr structure polygone */
- while ( polygone->field_0 != (ctpVar19Struct*)-1)
- {
- tableau = &polygone->subStruct;
+ while (polygone->field_0 != (ctpVar19Struct *) - 1) {
+ tableau = &polygone->subStruct;
- x_min = tableau->minX;
- x_max = tableau->maxX;
- y_min = tableau->minY;
- y_max = tableau->maxY;
+ x_min = tableau->minX;
+ x_max = tableau->maxX;
+ y_min = tableau->minY;
+ y_max = tableau->maxY;
- computedVar14 = tableau->boxIdx; /* numero polygone */
+ computedVar14 = tableau->boxIdx; /* numero polygone */
- if ( walkboxChange[computedVar14]==0 && ((x>=x_min && x<=x_max) && (y>=y_min && y<=y_max)) )
- {
- // click was in given box
- /* u = y-y_min;
+ if (walkboxChange[computedVar14] == 0 && ((x >= x_min
+ && x <= x_max) && (y >= y_min && y <= y_max))) {
+ // click was in given box
+ /* u = y-y_min;
+ *
+ * //tableau+=u;
+ * tableau = &polygone[u].subStruct;
+ *
+ * x_min = tableau->minX;
+ * x_max = tableau->maxX;
+ *
+ * if ( (x>=x_min && x<=x_max) ) */
+ {
+ flag_obstacle = walkboxType[computedVar14]; /* sa couleur */
- //tableau+=u;
- tableau = &polygone[u].subStruct;
-
- x_min = tableau->minX;
- x_max = tableau->maxX;
-
- if ( (x>=x_min && x<=x_max) ) */
- {
- flag_obstacle=walkboxType[computedVar14]; /* sa couleur */
-
- return;
- }
+ return;
+ }
+ }
+ polygone = polygone->field_0;
}
- polygone = polygone->field_0;
- }
- flag_obstacle=0;
+ flag_obstacle = 0;
}
int x_mouse;
@@ -125,281 +120,249 @@
int modelVar9;
int modelVar10;
-void polydroite(int x1, int y1, int x2, int y2)
-{
- int dx;
- int dy;
+void polydroite(int x1, int y1, int x2, int y2) {
+ int dx;
+ int dy;
- int mD0;
- int mD1;
+ int mD0;
+ int mD1;
- int mA0;
- int mA1;
+ int mA0;
+ int mA1;
- int bp;
- int cx;
- int si;
+ int bp;
+ int cx;
+ int si;
- int ax;
- int bx;
+ int ax;
+ int bx;
- modelVar9 = x1;
- modelVar10 = y1;
+ modelVar9 = x1;
+ modelVar10 = y1;
- dx = x2-x1;
- dy = y2-y1;
+ dx = x2 - x1;
+ dy = y2 - y1;
- mD0 = mD1 = 1;
+ mD0 = mD1 = 1;
- if(dx<0)
- {
- dx = -dx;
- mD0 = -1;
- }
+ if (dx < 0) {
+ dx = -dx;
+ mD0 = -1;
+ }
- if(dy<0)
- {
- dy = -dy;
- mD1 = -1;
- }
+ if (dy < 0) {
+ dy = -dy;
+ mD1 = -1;
+ }
- if(dx<dy)
- {
- mA0 = 0;
- bp = dx;
- cx = dy;
+ if (dx < dy) {
+ mA0 = 0;
+ bp = dx;
+ cx = dy;
- mA1 = mD1;
- }
- else
- {
- mA1 = 0;
- bp = dy;
- cx = dx;
+ mA1 = mD1;
+ } else {
+ mA1 = 0;
+ bp = dy;
+ cx = dx;
- mA0 = mD0;
- }
+ mA0 = mD0;
+ }
- bp=bp*2;
- dx=bp-cx;
- si=dx-cx;
+ bp = bp * 2;
+ dx = bp - cx;
+ si = dx - cx;
- ax = modelVar9;
- bx = modelVar10;
+ ax = modelVar9;
+ bx = modelVar10;
- getPixel(modelVar9, modelVar10);
+ getPixel(modelVar9, modelVar10);
- X = modelVar9;
- Y = modelVar10;
+ X = modelVar9;
+ Y = modelVar10;
- if(flag_obstacle==0)
- {
- flag_obstacle = 1;
- return;
- }
-
- while(--cx)
- {
- if(dx>0)
- {
- ax+=mD0;
- bx+=mD1;
- dx+=si;
+ if (flag_obstacle == 0) {
+ flag_obstacle = 1;
+ return;
}
- else
- {
- ax+=mA0;
- bx+=mA1;
- dx+=bp;
- }
- getPixel(ax, bx);
+ while (--cx) {
+ if (dx > 0) {
+ ax += mD0;
+ bx += mD1;
+ dx += si;
+ } else {
+ ax += mA0;
+ bx += mA1;
+ dx += bp;
+ }
- X = ax;
- Y = bx;
+ getPixel(ax, bx);
- if(flag_obstacle==0)
- {
- flag_obstacle = 1;
- return;
+ X = ax;
+ Y = bx;
+
+ if (flag_obstacle == 0) {
+ flag_obstacle = 1;
+ return;
+ }
}
- }
- flag_obstacle = 0;
+ flag_obstacle = 0;
}
-void poly2(int x1, int y1, int x2, int y2)
-{
- int dx;
- int dy;
+void poly2(int x1, int y1, int x2, int y2) {
+ int dx;
+ int dy;
- int mD0;
- int mD1;
+ int mD0;
+ int mD1;
- int mA0;
- int mA1;
+ int mA0;
+ int mA1;
- int bp;
- int cx;
- int si;
+ int bp;
+ int cx;
+ int si;
- int ax;
- int bx;
+ int ax;
+ int bx;
- modelVar9 = x1;
- modelVar10 = y1;
+ modelVar9 = x1;
+ modelVar10 = y1;
- dx = x2-x1;
- dy = y2-y1;
+ dx = x2 - x1;
+ dy = y2 - y1;
- mD0 = mD1 = 1;
+ mD0 = mD1 = 1;
- if(dx<0)
- {
- dx = -dx;
- mD0 = -1;
- }
+ if (dx < 0) {
+ dx = -dx;
+ mD0 = -1;
+ }
- if(dy<0)
- {
- dy = -dy;
- mD1 = -1;
- }
+ if (dy < 0) {
+ dy = -dy;
+ mD1 = -1;
+ }
- if(dx<dy)
- {
- mA0 = 0;
- bp = dx;
- cx = dy;
+ if (dx < dy) {
+ mA0 = 0;
+ bp = dx;
+ cx = dy;
- mA1 = mD1;
- }
- else
- {
- mA1 = 0;
- bp = dy;
- cx = dx;
+ mA1 = mD1;
+ } else {
+ mA1 = 0;
+ bp = dy;
+ cx = dx;
- mA0 = mD0;
- }
+ mA0 = mD0;
+ }
- bp=bp*2;
- dx=bp-cx;
- si=dx-cx;
+ bp = bp * 2;
+ dx = bp - cx;
+ si = dx - cx;
- ax = modelVar9;
- bx = modelVar10;
+ ax = modelVar9;
+ bx = modelVar10;
- getPixel(modelVar9, modelVar10);
+ getPixel(modelVar9, modelVar10);
- X = modelVar9;
- Y = modelVar10;
+ X = modelVar9;
+ Y = modelVar10;
- if(flag_obstacle!=0)
- {
- flag_obstacle = 1;
- return;
- }
-
- while(--cx)
- {
- if(dx>0)
- {
- ax+=mD0;
- bx+=mD1;
- dx+=si;
+ if (flag_obstacle != 0) {
+ flag_obstacle = 1;
+ return;
}
- else
- {
- ax+=mA0;
- bx+=mA1;
- dx+=bp;
- }
- getPixel(ax, bx);
+ while (--cx) {
+ if (dx > 0) {
+ ax += mD0;
+ bx += mD1;
+ dx += si;
+ } else {
+ ax += mA0;
+ bx += mA1;
+ dx += bp;
+ }
- X = ax;
- Y = bx;
+ getPixel(ax, bx);
- if(flag_obstacle!=0)
- {
- flag_obstacle = 1;
- return;
+ X = ax;
+ Y = bx;
+
+ if (flag_obstacle != 0) {
+ flag_obstacle = 1;
+ return;
+ }
}
- }
- flag_obstacle = 0;
+ flag_obstacle = 0;
}
-int point_proche( int16 table[][2] )
-{
- int x1, y1, i, x, y, p;
- int d1=1000;
+int point_proche(int16 table[][2]) {
+ int x1, y1, i, x, y, p;
+ int d1 = 1000;
- ctpVar19 = ctpVar11;
+ ctpVar19 = ctpVar11;
- if ( nclick_noeud == 1 )
- {
- x = x_mouse;
- y = y_mouse;
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
+ if (nclick_noeud == 1) {
+ x = x_mouse;
+ y = y_mouse;
+ x1 = table_ptselect[0][0];
+ y1 = table_ptselect[0][1];
- ctpVar19 = ctpVar15;
+ ctpVar19 = ctpVar15;
- getPixel( x, y );
+ getPixel(x, y);
- if ( !flag_obstacle )
- {
- ctpVar19 = ctpVar11;
+ if (!flag_obstacle) {
+ ctpVar19 = ctpVar11;
- getPixel( x, y );
+ getPixel(x, y);
- if ( flag_obstacle )
- {
- polydroite( x1, y1, x, y );
- }
- ctpVar19 = ctpVar15;
+ if (flag_obstacle) {
+ polydroite(x1, y1, x, y);
+ }
+ ctpVar19 = ctpVar15;
+ }
+ if (!flag_obstacle) { /* dans flag_obstacle --> couleur du point */
+ x1 = table_ptselect[0][0];
+ y1 = table_ptselect[0][1];
+
+ poly2(x, y, x1, y1);
+
+ x_mouse = X;
+ y_mouse = Y;
+ }
}
- if ( !flag_obstacle ) /* dans flag_obstacle --> couleur du point */
- {
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
+ ctpVar19 = ctpVar11;
- poly2( x, y, x1, y1 );
+ p = -1;
+ for (i = 0; i < ctp_routeCoordCount; i++) {
+ x = table[i][0];
+ y = table[i][1];
- x_mouse = X;
- y_mouse = Y;
- }
- }
- ctpVar19 = ctpVar11;
-
- p = -1;
- for ( i=0; i < ctp_routeCoordCount; i++ )
- {
- x = table[i][0];
- y = table[i][1];
+ ctpProc2(x_mouse, y_mouse, x, y);
+ if (ctpVar14 < d1) {
+ polydroite(x_mouse, y_mouse, x, y);
- ctpProc2( x_mouse, y_mouse, x, y );
- if ( ctpVar14 < d1 )
- {
- polydroite( x_mouse, y_mouse, x, y );
-
- if ( !flag_obstacle && ctp_routes[i][0] > 0 )
- {
- d1 = ctpVar14;
- p = i;
- }
+ if (!flag_obstacle && ctp_routes[i][0] > 0) {
+ d1 = ctpVar14;
+ p = i;
+ }
+ }
}
- }
- return ( p );
+ return (p);
}
#define NBNOEUD 20
int16 select_noeud[3];
-char solution[20+1];
+char solution[20 + 1];
int prem;
int prem2;
@@ -407,77 +370,66 @@
int idsol;
int solmax;
-char fl[NBNOEUD+1];
-char sol[NBNOEUD+1];
-char Fsol[NBNOEUD+1];
+char fl[NBNOEUD + 1];
+char sol[NBNOEUD + 1];
+char Fsol[NBNOEUD + 1];
int D;
-void explore( int depart, int arrivee )
-{
- int id1, id2, i;
+void explore(int depart, int arrivee) {
+ int id1, id2, i;
id1 = depart;
fl[id1]++;
sol[idsol++] = (char)id1;
- if ( idsol > solmax )
- {
- fl[id1]=-1;
+ if (idsol > solmax) {
+ fl[id1] = -1;
idsol--;
return;
}
- while ( (i=fl[id1]) < 20 )
- {
- id2 = ctp_routes[id1][i+1];
+ while ((i = fl[id1]) < 20) {
+ id2 = ctp_routes[id1][i + 1];
- if ( id2 == arrivee )
- {
- if ( idsol < solmax )
- {
+ if (id2 == arrivee) {
+ if (idsol < solmax) {
sol[idsol] = (char)arrivee;
- D=0;
- for ( i=0; i < idsol; i++ )
- {
- D = D+ctp_routeCoords[(int)sol[i]][(int)sol[i+1]];
- Fsol[i]=sol[i];
+ D = 0;
+ for (i = 0; i < idsol; i++) {
+ D = D +
+ ctp_routeCoords[(int)sol[i]][(int)
+ sol[i + 1]];
+ Fsol[i] = sol[i];
}
- prem2=0;
- if (!prem)
- {
+ prem2 = 0;
+ if (!prem) {
dist_chemin = D;
prem = 1;
- for ( i=0; i <= idsol; i++ )
- {
+ for (i = 0; i <= idsol; i++) {
solution[i] = sol[i];
}
- solution[i++]=-1;
- solution[i]=-1;
- }
- else if ( D < dist_chemin )
- {
+ solution[i++] = -1;
+ solution[i] = -1;
+ } else if (D < dist_chemin) {
dist_chemin = D;
- for ( i=0; i <= idsol; i++ )
- {
+ for (i = 0; i <= idsol; i++) {
solution[i] = sol[i];
}
- solution[i++]=-1;
- solution[i]=-1;
+ solution[i++] = -1;
+ solution[i] = -1;
}
}
- fl[id1]=-1;
+ fl[id1] = -1;
idsol--;
return;
- }
- else if ((id2!=-1) && ((int)fl[id2]==-1) )
- explore(id2,arrivee);
- else if (id2==-1)
- {
- fl[id1]=-1;
+ } else if ((id2 != -1) && ((int)fl[id2] == -1))
+ explore(id2, arrivee);
+ else if (id2 == -1) {
+ fl[id1] = -1;
idsol--;
return;
@@ -485,598 +437,737 @@
fl[id1]++;
}
- fl[id1]=-1;
+ fl[id1] = -1;
idsol--;
}
-void chemin0( int depart, int arrivee )
-{
- int i;
- //int y=30;
-
- prem = 0;
+void chemin0(int depart, int arrivee) {
+ int i;
+ //int y=30;
+
+ prem = 0;
prem2 = 0;
- dist_chemin=0;
+ dist_chemin = 0;
idsol = 0;
- solmax=999;
+ solmax = 999;
- for ( i=0; i < 20+1; i++ ) fl[i] = -1;
+ for (i = 0; i < 20 + 1; i++)
+ fl[i] = -1;
- X=0,Y=30;
+ X = 0, Y = 30;
- explore( depart, arrivee );
+ explore(depart, arrivee);
}
-void valide_noeud( int16 table[], int16 p, int *nclick, int16 solution0[20+3][2] )
-{
- int a, b, d, i, p1, x1, x2, y1, y2;
- //int y=30;
+void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2]) {
+ int a, b, d, i, p1, x1, x2, y1, y2;
+ //int y=30;
- table[*nclick]=p;
- table[(*nclick)+1]=-1;
- table_ptselect[*nclick][0]=x_mouse;
- table_ptselect[*nclick][1]=y_mouse;
+ table[*nclick] = p;
+ table[(*nclick) + 1] = -1;
+ table_ptselect[*nclick][0] = x_mouse;
+ table_ptselect[*nclick][1] = y_mouse;
(*nclick)++;
- ctpVar19=ctpVar11;
+ ctpVar19 = ctpVar11;
- if (*nclick==2) // second point
+ if (*nclick == 2) // second point
{
- x1=table_ptselect[0][0];
- y1=table_ptselect[0][1];
- x2=table_ptselect[1][0];
- y2=table_ptselect[1][1];
- if ( (x1==x2) && (y1==y2))
- {
+ x1 = table_ptselect[0][0];
+ y1 = table_ptselect[0][1];
+ x2 = table_ptselect[1][0];
+ y2 = table_ptselect[1][1];
+ if ((x1 == x2) && (y1 == y2)) {
return;
}
- flag_aff_chemin=1;
- ctpVar19=ctpVar15;
+ flag_aff_chemin = 1;
+ ctpVar19 = ctpVar15;
- // can we go there directly ?
- polydroite(x1,y1,x2,y2);
- ////////////////
- flag_obstacle = 0;
- ////////////////
- if (!flag_obstacle)
- {
- solution0[0][0]=x1;
- solution0[0][1]=y1;
- ctpVar19=ctpVar15;
+ // can we go there directly ?
+ polydroite(x1, y1, x2, y2);
+ ////////////////
+ flag_obstacle = 0;
+ ////////////////
+ if (!flag_obstacle) {
+ solution0[0][0] = x1;
+ solution0[0][1] = y1;
+ ctpVar19 = ctpVar15;
- poly2(x2,y2,ctp_routeCoords[select_noeud[1]][0],ctp_routeCoords[select_noeud[1]][1]);
+ poly2(x2, y2, ctp_routeCoords[select_noeud[1]][0],
+ ctp_routeCoords[select_noeud[1]][1]);
- solution0[1][0]=table_ptselect[1][0]=X;
- solution0[1][1]=table_ptselect[1][1]=Y;
- solution0[2][0]=-1;
+ solution0[1][0] = table_ptselect[1][0] = X;
+ solution0[1][1] = table_ptselect[1][1] = Y;
+ solution0[2][0] = -1;
- if ( (x1==X) && (y1==Y))
- {
- flag_aff_chemin=0;
+ if ((x1 == X) && (y1 == Y)) {
+ flag_aff_chemin = 0;
return;
}
- }
- else
- {
- // no, we take the fastest way
- solution[0]=-1;
- if (ctp_routes[select_noeud[0]][0]>0)
- chemin0(table[0],table[1]);
+ } else {
+ // no, we take the fastest way
+ solution[0] = -1;
+ if (ctp_routes[select_noeud[0]][0] > 0)
+ chemin0(table[0], table[1]);
- if (solution[0]==-1)
- {
- x1=table_ptselect[0][0];
- y1=table_ptselect[0][1];
- polydroite(x1,y1,x_mouse,y_mouse);
- solution0[0][0]=x1;
- solution0[0][1]=y1;
- solution0[1][0]=X;
- solution0[1][1]=Y;
+ if (solution[0] == -1) {
+ x1 = table_ptselect[0][0];
+ y1 = table_ptselect[0][1];
+ polydroite(x1, y1, x_mouse, y_mouse);
+ solution0[0][0] = x1;
+ solution0[0][1] = y1;
+ solution0[1][0] = X;
+ solution0[1][1] = Y;
- solution0[2][0]=-1;
- if ( (x1==X) && (y1==Y))
- {
- flag_aff_chemin=0;
+ solution0[2][0] = -1;
+ if ((x1 == X) && (y1 == Y)) {
+ flag_aff_chemin = 0;
return;
}
- }
- else
- {
- solution0[0][0]=x1;
- solution0[0][1]=y1;
- i=0;
- while (solution[i]!=-1)
- {
- p1=solution[i];
- solution0[i+1][0]=ctp_routeCoords[p1][0];
- solution0[++i][1]=ctp_routeCoords[p1][1];
+ } else {
+ solution0[0][0] = x1;
+ solution0[0][1] = y1;
+ i = 0;
+ while (solution[i] != -1) {
+ p1 = solution[i];
+ solution0[i + 1][0] =
+ ctp_routeCoords[p1][0];
+ solution0[++i][1] =
+ ctp_routeCoords[p1][1];
}
- ctpVar19=ctpVar15;
- poly2(x2,y2,ctp_routeCoords[select_noeud[1]][0],ctp_routeCoords[select_noeud[1]][1]);
- solution0[i+1][0]=table_ptselect[1][0]=X;
- solution0[i+1][1]=table_ptselect[1][1]=Y;
- solution0[i+2][0]=-1;
- if ( (x1==X) && (y1==Y))
- {
- flag_aff_chemin=0;
+ ctpVar19 = ctpVar15;
+ poly2(x2, y2,
+ ctp_routeCoords[select_noeud[1]][0],
+ ctp_routeCoords[select_noeud[1]][1]);
+ solution0[i + 1][0] = table_ptselect[1][0] = X;
+ solution0[i + 1][1] = table_ptselect[1][1] = Y;
+ solution0[i + 2][0] = -1;
+ if ((x1 == X) && (y1 == Y)) {
+ flag_aff_chemin = 0;
return;
}
- /****** COUPE LE CHEMIN ******/
+ /****** COUPE LE CHEMIN ******/
i++;
- d=0;
- a=i;
- flag_obstacle=1;
- while (d!=a)
- {
- x1=solution0[d][0];
- y1=solution0[d][1];
-
- while (flag_obstacle && i!=d)
- {
- x2=solution0[i][0];
- y2=solution0[i][1];
- ctpVar19=ctpVar15;
- polydroite(x1,y1,x2,y2);
+ d = 0;
+ a = i;
+ flag_obstacle = 1;
+ while (d != a) {
+ x1 = solution0[d][0];
+ y1 = solution0[d][1];
+
+ while (flag_obstacle && i != d) {
+ x2 = solution0[i][0];
+ y2 = solution0[i][1];
+ ctpVar19 = ctpVar15;
+ polydroite(x1, y1, x2, y2);
i--;
}
- flag_obstacle=1;
- if (d!=i)
- {
+ flag_obstacle = 1;
+ if (d != i) {
i++;
- for (b=d+1;b<i;b++)
- {
- solution0[b][0]=-2;
+ for (b = d + 1; b < i; b++) {
+ solution0[b][0] = -2;
}
- }
- else i++;
- d=i;
- i=a;
- }
- flag_obstacle=0;
+ } else
+ i++;
+ d = i;
+ i = a;
+ }
+ flag_obstacle = 0;
}
}
}
}
//computePathfinding(returnVar2, params.X, params.Y, var34, var35, currentActor->stepX, currentActor->stepY);
-int16 computePathfinding(int16* pSolution, int16 _X, int16 _Y, int16 destX, int16 destY, int16 stepX, int16 stepY, int16 oldPathId)
-{
- persoStruct* perso;
- int num;
+int16 computePathfinding(int16 *pSolution, 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;
+ if (!polyStruct) {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
- return -1;
- }
+ return -1;
+ }
- if(oldPathId >= 0)
- {
- if(persoTable[oldPathId])
- {
- freePerso(oldPathId);
+ if (oldPathId >= 0) {
+ if (persoTable[oldPathId]) {
+ freePerso(oldPathId);
+ }
}
- }
- if(!flagCt)
- {
- int i;
- int16* ptr;
+ if (!flagCt) {
+ int i;
+ int16 *ptr;
- for(i=0;i<10;i++) // 10 = num perso
- {
- if(!persoTable[i])
- {
- break;
- }
- }
+ for (i = 0; i < 10; i++) // 10 = num perso
+ {
+ if (!persoTable[i]) {
+ break;
+ }
+ }
- if(i == 10)
- {
- pSolution[0] = -1;
- pSolution[1] = -1;
+ if (i == 10) {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
- return -1;
- }
+ return -1;
+ }
- perso = persoTable[i] = (persoStruct*)malloc(sizeof(persoStruct));
+ perso = persoTable[i] =
+ (persoStruct *) malloc(sizeof(persoStruct));
- ptr = perso->solution[0];
+ ptr = perso->solution[0];
- perso->inc_jo1 = stepX;
- perso->inc_jo2 = stepY;
+ perso->inc_jo1 = stepX;
+ perso->inc_jo2 = stepY;
- *(ptr++) = _X;
- *(ptr++) = _Y;
- *(ptr++) = pSolution[0] = destX;
- *(ptr++) = pSolution[1] = destY;
- *(ptr++) = -1;
+ *(ptr++) = _X;
+ *(ptr++) = _Y;
+ *(ptr++) = pSolution[0] = destX;
+ *(ptr++) = pSolution[1] = destY;
+ *(ptr++) = -1;
- pSolution[4] = computedVar14;
+ pSolution[4] = computedVar14;
- perso->inc_droite = 0;
- perso->inc_chemin = 0;
+ perso->inc_droite = 0;
+ perso->inc_chemin = 0;
- return i;
- }
+ return i;
+ }
- nclick_noeud=0;
- ctpVar19=ctpVar11;
- flag_aff_chemin=0;
+ nclick_noeud = 0;
+ ctpVar19 = ctpVar11;
+ flag_aff_chemin = 0;
- if (_X==destX && _Y==destY)
- {
- pSolution[0]=-1;
- pSolution[1]=-1;
+ if (_X == destX && _Y == destY) {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
- return(-1);
+ return (-1);
}
/******* cherche le premier noeud ******/
- getPixel(_X,_Y);
+ getPixel(_X, _Y);
- pSolution[4] = computedVar14;
+ pSolution[4] = computedVar14;
- x_mouse = _X;
- y_mouse = _Y;
+ x_mouse = _X;
+ y_mouse = _Y;
- if (!flag_obstacle || (point_select=point_proche(ctp_routeCoords))==-1)
- {
- pSolution[0]=-1;
- pSolution[1]=-1;
+ if (!flag_obstacle
+ || (point_select = point_proche(ctp_routeCoords)) == -1) {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
- return(-1);
+ return (-1);
}
- valide_noeud(select_noeud,point_select,&nclick_noeud,NULL);
+ valide_noeud(select_noeud, point_select, &nclick_noeud, NULL);
- flag_aff_chemin=0;
+ flag_aff_chemin = 0;
/******* cherche le deuxieme noeud ******/
- num=0;
- while ( num < 10 && persoTable[num] != NULL ) num++;
+ num = 0;
+ while (num < 10 && persoTable[num] != NULL)
+ num++;
- if (num==10)
- {
- pSolution[0]=-1;
- pSolution[1]=-1;
- return(-1);
+ if (num == 10) {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
+ return (-1);
}
-
- perso = persoTable[num] = (persoStruct*)malloc(sizeof(persoStruct));
- perso->inc_jo1 = stepX;
- perso->inc_jo2 = stepY;
+ perso = persoTable[num] = (persoStruct *) malloc(sizeof(persoStruct));
- x_mouse = destX;
- y_mouse = destY;
+ perso->inc_jo1 = stepX;
+ perso->inc_jo2 = stepY;
- if((point_select=point_proche(ctp_routeCoords))!=-1)
- valide_noeud(select_noeud,point_select,&nclick_noeud,perso->solution);
+ x_mouse = destX;
+ y_mouse = destY;
- 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;
+ if ((point_select = point_proche(ctp_routeCoords)) != -1)
+ 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;
freePerso(num);
- return(-1);
+ return (-1);
}
-
- pSolution[0]=table_ptselect[1][0];
- pSolution[1]=table_ptselect[1][1];
- pSolution[4]=computedVar14;
- perso->inc_chemin=0;
- perso->inc_droite=0;
+ pSolution[0] = table_ptselect[1][0];
+ pSolution[1] = table_ptselect[1][1];
+ pSolution[4] = computedVar14;
+ perso->inc_chemin = 0;
+ perso->inc_droite = 0;
+
return (num);
}
-void set_anim( int ovl, int obj, int start, int x, int y, int mat, int state )
-{
- int newf, zoom;
+void set_anim(int ovl, int obj, int start, int x, int y, int mat, int state) {
+ int newf, zoom;
- newf = abs(mat)-1;
+ newf = abs(mat) - 1;
zoom = computeZoom(y);
- if (mat<0) zoom=-zoom;
+ if (mat < 0)
+ zoom = -zoom;
- setObjectPosition(ovl,obj,0, x);
- setObjectPosition(ovl,obj,1, y);
- setObjectPosition(ovl,obj,2, y);
- setObjectPosition(ovl,obj,4, zoom);
- setObjectPosition(ovl,obj,3, newf+start);
- setObjectPosition(ovl,obj,5, state);
+ setObjectPosition(ovl, obj, 0, x);
+ setObjectPosition(ovl, obj, 1, y);
+ setObjectPosition(ovl, obj, 2, y);
+ setObjectPosition(ovl, obj, 4, zoom);
+ setObjectPosition(ovl, obj, 3, newf + start);
+ setObjectPosition(ovl, obj, 5, state);
}
-int raoul_move[][13] =
-{
- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0 }, /* dos */
- { 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0 }, /* droite */
- { 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 0 }, /* face */
- {-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24, 0 } /* gauche */
+int raoul_move[][13] = {
+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0}, /* dos */
+ {13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0}, /* droite */
+ {25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 0}, /* face */
+ {-13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, 0} /* gauche */
};
-int raoul_end[][13] =
-{
- { 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* stat dos */
- { 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* stat droite */
- { 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* stat face */
- {-38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } /* stat gauche */
+int raoul_end[][13] = {
+ {37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* stat dos */
+ {38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* stat droite */
+ {39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* stat face */
+ {-38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* stat gauche */
};
-int raoul_stat[][13]=
-{
- { 53, 54, 55, 56, 57, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret dos-dr */
- { 59, 60, 62, 63, 78, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret dr-face */
- {-78,-63,-62,-60,-59, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret face-ga */
- {-57,-56,-55,-54,-53, 0, 0, 0, 0, 0, 0, 0, 0 } /* ret ga-dos */
+int raoul_stat[][13] = {
+ {53, 54, 55, 56, 57, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret dos-dr */
+ {59, 60, 62, 63, 78, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret dr-face */
+ {-78, -63, -62, -60, -59, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret face-ga */
+ {-57, -56, -55, -54, -53, 0, 0, 0, 0, 0, 0, 0, 0} /* ret ga-dos */
};
-int raoul_invstat[][13]=
-{
- {-53,-54,-55,-56,-57, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret dos-dr */
- { 57, 56, 55, 54, 53, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret ga-dos */
- { 78, 63, 62, 60, 59, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ret face-ga */
- {-59,-60,-62,-63,-78, 0, 0, 0, 0, 0, 0, 0, 0 } /* ret dr-face */
+int raoul_invstat[][13] = {
+ {-53, -54, -55, -56, -57, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret dos-dr */
+ {57, 56, 55, 54, 53, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret ga-dos */
+ {78, 63, 62, 60, 59, 0, 0, 0, 0, 0, 0, 0, 0}, /* ret face-ga */
+ {-59, -60, -62, -63, -78, 0, 0, 0, 0, 0, 0, 0, 0} /* ret dr-face */
};
-void processAnimation(void)
-{
- objectParamsQuery params;
- int16 returnVar2[5];
- actorStruct* currentActor = &actorHead;
- actorStruct* nextActor;
+void processAnimation(void) {
+ objectParamsQuery params;
+ int16 returnVar2[5];
+ actorStruct *currentActor = &actorHead;
+ actorStruct *nextActor;
- while(currentActor)
- {
- nextActor = currentActor->next;
+ while (currentActor) {
+ nextActor = currentActor->next;
- if(!currentActor->freeze && ((currentActor->type == 0) || (currentActor->type == 1)))
- {
- getMultipleObjectParam(currentActor->overlayNumber,currentActor->idx,¶ms);
+ if (!currentActor->freeze && ((currentActor->type == 0)
+ || (currentActor->type == 1))) {
+ getMultipleObjectParam(currentActor->overlayNumber,
+ currentActor->idx, ¶ms);
- if(((animationStart && !currentActor->flag) || (!animationStart && currentActor->x_dest != -1 && currentActor->y_dest != -1)) && (currentActor->type == 0))
- {
- // mouse animation
- if(!animationStart)
- {
- var34 = currentActor->x_dest;
- var35 = currentActor->y_dest;
+ if (((animationStart && !currentActor->flag)
+ || (!animationStart
+ && currentActor->x_dest != -1
+ && currentActor->y_dest != -1))
+ && (currentActor->type == 0)) {
+ // mouse animation
+ if (!animationStart) {
+ var34 = currentActor->x_dest;
+ var35 = currentActor->y_dest;
- currentActor->x_dest = -1;
- currentActor->y_dest = -1;
+ currentActor->x_dest = -1;
+ currentActor->y_dest = -1;
- currentActor->flag = 1;
- }
+ currentActor->flag = 1;
+ }
- currentActor->pathId = computePathfinding(returnVar2, params.X, params.Y, var34, var35, currentActor->stepX, currentActor->stepY, currentActor->pathId);
+ currentActor->pathId =
+ computePathfinding(returnVar2, params.X,
+ params.Y, var34, var35,
+ currentActor->stepX, currentActor->stepY,
+ currentActor->pathId);
- if(currentActor->pathId == -1)
- {
- if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection))
- {
- currentActor->phase = ANIM_PHASE_STATIC_END;
- currentActor->nextDirection = currentActor->endDirection;
- currentActor->endDirection = -1;
- currentActor->counter = 0;
- }
- else
- {
- currentActor->pathId = -2;
- currentActor->flag = 0;
- currentActor->endDirection = -1;
- currentActor->phase = ANIM_PHASE_WAIT;
- }
- }
- else
- {
- currentActor->phase = ANIM_PHASE_STATIC;
- currentActor->counter = -1;
- }
- }
- 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);
+ if (currentActor->pathId == -1) {
+ if ((currentActor->endDirection != -1)
+ && (currentActor->endDirection !=
+ currentActor->
+ startDirection)) {
+ currentActor->phase =
+ ANIM_PHASE_STATIC_END;
+ currentActor->nextDirection =
+ currentActor->endDirection;
+ currentActor->endDirection =
+ -1;
+ currentActor->counter = 0;
+ } else {
+ currentActor->pathId = -2;
+ currentActor->flag = 0;
+ currentActor->endDirection =
+ -1;
+ currentActor->phase =
+ ANIM_PHASE_WAIT;
+ }
+ } else {
+ currentActor->phase =
+ ANIM_PHASE_STATIC;
+ currentActor->counter = -1;
+ }
+ } 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->x_dest = -1;
- currentActor->y_dest = -1;
+ currentActor->x_dest = -1;
+ currentActor->y_dest = -1;
- if(currentActor->pathId == -1)
- {
- if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection))
- {
- currentActor->phase = ANIM_PHASE_STATIC_END;
- currentActor->nextDirection = currentActor->endDirection;
- currentActor->endDirection = -1;
- currentActor->counter = 0;
- }
- else
- {
- currentActor->pathId = -2;
- currentActor->flag = 0;
- currentActor->endDirection = -1;
- currentActor->phase = ANIM_PHASE_WAIT;
- }
- }
- else
- {
- currentActor->phase = ANIM_PHASE_STATIC;
- currentActor->counter = -1;
- }
- }
+ if (currentActor->pathId == -1) {
+ if ((currentActor->endDirection != -1)
+ && (currentActor->endDirection !=
+ currentActor->
+ startDirection)) {
+ currentActor->phase =
+ ANIM_PHASE_STATIC_END;
+ currentActor->nextDirection =
+ currentActor->endDirection;
+ currentActor->endDirection =
+ -1;
+ currentActor->counter = 0;
+ } else {
+ currentActor->pathId = -2;
+ currentActor->flag = 0;
+ currentActor->endDirection =
+ -1;
+ currentActor->phase =
+ ANIM_PHASE_WAIT;
+ }
+ } else {
+ currentActor->phase =
+ ANIM_PHASE_STATIC;
+ currentActor->counter = -1;
+ }
+ }
- animationStart = false;
+ animationStart = false;
- if(currentActor->pathId >= 0 || currentActor->phase == ANIM_PHASE_STATIC_END)
- {
- switch(currentActor->phase)
- {
- case ANIM_PHASE_STATIC_END:
- case ANIM_PHASE_STATIC:
- {
- if(currentActor->counter == -1 && currentActor->phase == ANIM_PHASE_STATIC)
- {
- affiche_chemin(currentActor->pathId, returnVar2);
+ if (currentActor->pathId >= 0
+ || currentActor->phase == ANIM_PHASE_STATIC_END) {
+ switch (currentActor->phase) {
+ case ANIM_PHASE_STATIC_END:
+ case ANIM_PHASE_STATIC:
+ {
+ if (currentActor->counter == -1
+ && currentActor->phase ==
+ ANIM_PHASE_STATIC) {
+ affiche_chemin
+ (currentActor->
+ pathId,
+ returnVar2);
- if(returnVar2[0] == -1)
- {
- currentActor->pathId = -2;
- currentActor->flag = 0;
- currentActor->endDirection = -1;
- currentActor->phase = ANIM_PHASE_WAIT;
- break;
- }
+ if (returnVar2[0] ==
+ -1) {
+ currentActor->
+ pathId =
+ -2;
+ currentActor->
+ flag = 0;
+ currentActor->
+ endDirection
+ = -1;
+ currentActor->
+ phase =
+ ANIM_PHASE_WAIT;
+ break;
+ }
- currentActor->x = returnVar2[0];
- currentActor->y = returnVar2[1];
- currentActor->nextDirection = returnVar2[2];
- currentActor->poly = returnVar2[4];
- currentActor->counter = 0;
+ currentActor->x =
+ returnVar2[0];
+ currentActor->y =
+ returnVar2[1];
+ currentActor->
+ nextDirection =
+ returnVar2[2];
+ currentActor->poly =
+ returnVar2[4];
+ currentActor->counter =
+ 0;
- if (currentActor->startDirection == currentActor->nextDirection)
- currentActor->phase = ANIM_PHASE_MOVE;
- }
+ if (currentActor->
+ startDirection ==
+ currentActor->
+ nextDirection)
+ currentActor->
+ phase =
+ ANIM_PHASE_MOVE;
+ }
- if ((currentActor->counter>=0) && ((currentActor->phase==ANIM_PHASE_STATIC_END) || (currentActor->phase==ANIM_PHASE_STATIC)))
- {
- int newA;
+ if ((currentActor->counter >=
+ 0)
+ && ((currentActor->phase ==
+ ANIM_PHASE_STATIC_END)
+ || (currentActor->
+ phase ==
+ ANIM_PHASE_STATIC)))
+ {
+ int newA;
int inc = 1;
- int t_inc = currentActor->startDirection-1;
+ int t_inc =
+ currentActor->
+ startDirection - 1;
- if (t_inc<0)
- t_inc=3;
+ if (t_inc < 0)
+ t_inc = 3;
- if (currentActor->nextDirection==t_inc)
- inc=-1;
+ if (currentActor->
+ nextDirection ==
+ t_inc)
+ inc = -1;
- if (inc>0)
- newA = raoul_stat[currentActor->startDirection][currentActor->counter++];
+ if (inc > 0)
+ newA =
+ raoul_stat
+ [currentActor->
+ startDirection]
+ [currentActor->
+ counter++];
else
- newA = raoul_invstat[currentActor->startDirection][currentActor->counter++];
+ newA =
+ raoul_invstat
+ [currentActor->
+ startDirection]
+ [currentActor->
+ counter++];
- if (newA==0)
- {
- currentActor->startDirection = currentActor->startDirection+inc;
+ if (newA == 0) {
+ currentActor->
+ startDirection
+ =
+ currentActor->
+ startDirection
+ + inc;
- if (currentActor->startDirection>3)
- currentActor->startDirection=0;
+ if (currentActor->startDirection > 3)
+ currentActor->
+ startDirection
+ =
+ 0;
- if (currentActor->startDirection<0)
- currentActor->startDirection=3;
+ if (currentActor->startDirection < 0)
+ currentActor->
+ startDirection
+ =
+ 3;
- currentActor->counter=0;
+ currentActor->
+ counter =
+ 0;
- if (currentActor->startDirection==currentActor->nextDirection)
- {
+ if (currentActor->startDirection == currentActor->nextDirection) {
if (currentActor->phase == ANIM_PHASE_STATIC)
- currentActor->phase = ANIM_PHASE_MOVE;
+ currentActor->
+ phase
+ =
+ ANIM_PHASE_MOVE;
else
- currentActor->phase = ANIM_PHASE_END;
- }
- else
- {
- newA = raoul_stat[currentActor->startDirection][currentActor->counter++];
+ currentActor->
+ phase
+ =
+ ANIM_PHASE_END;
+ } else {
+ newA =
+ raoul_stat
+ [currentActor->
+ startDirection]
+ [currentActor->
+ counter++];
- if (inc==-1)
- newA=-newA;
+ if (inc
+ ==
+ -1)
+ newA = -newA;
- set_anim(currentActor->overlayNumber,currentActor->idx,currentActor->start,params.X,params.Y,newA,currentActor->poly);
+ set_anim
+ (currentActor->
+ overlayNumber,
+ currentActor->
+ idx,
+ currentActor->
+ start,
+ params.
+ X,
+ params.
+ Y,
+ newA,
+ currentActor->
+ poly);
break;
}
+ } else {
+ set_anim
+ (currentActor->
+ overlayNumber,
+ currentActor->
+ idx,
+ currentActor->
+ start,
+ params.X,
+ params.Y,
+ newA,
+ currentActor->
+ poly);
+ break;
}
- else
- {
- set_anim(currentActor->overlayNumber,currentActor->idx,currentActor->start,params.X,params.Y,newA,currentActor->poly);
+ }
+ break;
+ }
+ case ANIM_PHASE_MOVE:
+ {
+ if (currentActor->counter >= 1) {
+ affiche_chemin
+ (currentActor->
+ pathId,
+ returnVar2);
+ if (returnVar2[0] ==
+ -1) {
+ if ((currentActor->endDirection == -1) || (currentActor->endDirection == currentActor->nextDirection)) {
+ currentActor->
+ phase
+ =
+ ANIM_PHASE_END;
+ } else {
+ currentActor->
+ phase
+ =
+ ANIM_PHASE_STATIC_END;
+ currentActor->
+ nextDirection
+ =
+ currentActor->
+ endDirection;
+ }
+ currentActor->
+ counter =
+ 0;
break;
+ } else {
+ currentActor->
+ x =
+ returnVar2
+ [0];
+ currentActor->
+ y =
+ returnVar2
+ [1];
+ currentActor->
+ nextDirection
+ =
+ returnVar2
+ [2];
+ currentActor->
+ poly =
+ returnVar2
+ [4];
+
+ /*
+ * if (pl->next_dir!=pl->start_dir)
+ * {
+ * pl->phase=PHASE_STATIC;
+ * pl->cnt=0;
+ * break;
+ * }
+ */
}
- }
- break;
- }
- case ANIM_PHASE_MOVE:
- {
- if (currentActor->counter>=1)
- {
- affiche_chemin(currentActor->pathId,returnVar2);
- if (returnVar2[0]==-1)
- {
- if ((currentActor->endDirection==-1) || (currentActor->endDirection==currentActor->nextDirection))
- {
- currentActor->phase=ANIM_PHASE_END;
- }
- else
- {
- currentActor->phase = ANIM_PHASE_STATIC_END;
- currentActor->nextDirection=currentActor->endDirection;
- }
- currentActor->counter=0;
- break;
- }
- else
- {
- currentActor->x = returnVar2[0];
- currentActor->y = returnVar2[1];
- currentActor->nextDirection = returnVar2[2];
- currentActor->poly = returnVar2[4];
+ }
- /*
- if (pl->next_dir!=pl->start_dir)
- {
- pl->phase=PHASE_STATIC;
- pl->cnt=0;
- break;
- }
- */
- }
- }
+ if (currentActor->phase ==
+ ANIM_PHASE_MOVE) {
+ int newA;
- if (currentActor->phase==ANIM_PHASE_MOVE)
- {
- int newA;
+ currentActor->
+ startDirection =
+ currentActor->
+ nextDirection;
- currentActor->startDirection = currentActor->nextDirection;
+ newA =
+ raoul_move
+ [currentActor->
+ startDirection]
+ [currentActor->
+ counter++];
+ if (!newA) {
+ currentActor->
+ counter =
+ 0;
+ newA =
+ raoul_move
+ [currentActor->
+ startDirection]
+ [currentActor->
+ counter++];
+ }
+ set_anim(currentActor->
+ overlayNumber,
+ currentActor->idx,
+ currentActor->
+ start,
+ currentActor->x,
+ currentActor->y,
+ newA,
+ currentActor->
+ poly);
+ break;
+ }
- newA = raoul_move[currentActor->startDirection][currentActor->counter++];
- if (!newA)
- {
- currentActor->counter=0;
- newA = raoul_move[currentActor->startDirection][currentActor->counter++];
- }
- set_anim(currentActor->overlayNumber,currentActor->idx,currentActor->start,currentActor->x,currentActor->y,newA,currentActor->poly);
- break;
- }
+ break;
+ }
+ case ANIM_PHASE_END:
+ {
+ int newA =
+ raoul_end[currentActor->
+ startDirection][0];
- break;
- }
- case ANIM_PHASE_END:
- {
- int newA = raoul_end[currentActor->startDirection][0];
+ set_anim(currentActor->
+ overlayNumber,
+ currentActor->idx,
+ currentActor->start,
+ currentActor->x,
+ currentActor->y, newA,
+ currentActor->poly);
- set_anim(currentActor->overlayNumber,currentActor->idx,currentActor->start,currentActor->x,currentActor->y,newA,currentActor->poly);
-
- currentActor->pathId = -2;
- currentActor->phase=ANIM_PHASE_WAIT;
- currentActor->flag=0;
- currentActor->endDirection=-1;
- break;
- }
- default:
- {
- printf("Unimplemented currentActor->phase=%d in processAnimation()\n", currentActor->phase);
- // exit(1);
- }
+ currentActor->pathId = -2;
+ currentActor->phase =
+ ANIM_PHASE_WAIT;
+ currentActor->flag = 0;
+ currentActor->endDirection =
+ -1;
+ break;
+ }
+ default:
+ {
+ printf
+ ("Unimplemented currentActor->phase=%d in processAnimation()\n",
+ currentActor->phase);
+ // exit(1);
+ }
+ }
+ }
}
- }
+ currentActor = nextActor;
}
- currentActor = nextActor;
- }
}
+
} // End of namespace Cruise
Modified: scummvm/trunk/engines/cruise/actor.h
===================================================================
--- scummvm/trunk/engines/cruise/actor.h 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/actor.h 2007-04-27 22:33:45 UTC (rev 26631)
@@ -22,25 +22,24 @@
*
*/
-#ifndef _ACTOR_H_
-#define _ACTOR_H_
+#ifndef CRUISE_ACTOR_H
+#define CRUISE_ACTOR_H
namespace Cruise {
-enum animPhase
-{
- ANIM_PHASE_WAIT = 0,
- ANIM_PHASE_STATIC = 1,
- ANIM_PHASE_MOVE = 2,
- ANIM_PHASE_STATIC_END = 3,
- ANIM_PHASE_END = 4
+enum animPhase {
+ ANIM_PHASE_WAIT = 0,
+ ANIM_PHASE_STATIC = 1,
+ ANIM_PHASE_MOVE = 2,
+ ANIM_PHASE_STATIC_END = 3,
+ ANIM_PHASE_END = 4
};
typedef enum animPhase animPhase;
struct actorStruct {
- struct actorStruct* next;
- struct actorStruct* prev;
+ struct actorStruct *next;
+ struct actorStruct *prev;
int16 idx;
int16 type;
@@ -65,10 +64,13 @@
typedef struct actorStruct actorStruct;
-int16 mainProc13(int overlayIdx, int param1, actorStruct* pStartEntry, int param2);
-actorStruct* findActor(int overlayIdx, int param1, actorStruct* pStartEntry, int param2);
+int16 mainProc13(int overlayIdx, int param1, actorStruct * pStartEntry,
+ int param2);
+actorStruct *findActor(int overlayIdx, int param1, actorStruct * pStartEntry,
+ int param2);
void processAnimation(void);
void getPixel(int x, int y);
+
} // End of namespace Cruise
#endif
Modified: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/background.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -28,193 +28,166 @@
uint8 colorMode = 0;
-uint8* backgroundPtrtable[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; // wasn't initialized in original, but it's probably better
+uint8 *backgroundPtrtable[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; // wasn't initialized in original, but it's probably better
backgroundTableStruct backgroundTable[8];
char hwPage[64000];
-char* hwMemAddr[] =
-{
+char *hwMemAddr[] = {
hwPage,
};
short int cvtPalette[0x20];
-int loadMEN(uint8** ptr)
-{
- char* localPtr = (char*)*ptr;
+int loadMEN(uint8 **ptr) {
+ char *localPtr = (char *)*ptr;
- if(!strcmp(localPtr,"MEN"))
- {
- localPtr+=4;
+ if (!strcmp(localPtr, "MEN")) {
+ localPtr += 4;
- video4 = *(localPtr++);
- video3 = *(localPtr++);
- video2 = *(localPtr++);
- colorOfSelectedSaveDrive = *(localPtr++);
+ video4 = *(localPtr++);
+ video3 = *(localPtr++);
+ video2 = *(localPtr++);
+ colorOfSelectedSaveDrive = *(localPtr++);
- *ptr = (uint8*)localPtr;
+ *ptr = (uint8 *) localPtr;
- return 1;
- }
- else
- {
- return 0;
- }
+ return 1;
+ } else {
+ return 0;
+ }
}
int CVTLoaded;
-int loadCVT(uint8** ptr)
-{
- char* localPtr = (char*)*ptr;
+int loadCVT(uint8 **ptr) {
+ char *localPtr = (char *)*ptr;
- if(!strcmp(localPtr,"CVT"))
- {
- int i;
- localPtr+=4;
+ if (!strcmp(localPtr, "CVT")) {
+ int i;
+ localPtr += 4;
- for(i=0;i<0x20;i++)
- {
- cvtPalette[i] = *(localPtr++);
- }
+ for (i = 0; i < 0x20; i++) {
+ cvtPalette[i] = *(localPtr++);
+ }
- *ptr = (uint8*)localPtr;
+ *ptr = (uint8 *) localPtr;
- CVTLoaded = 1;
+ CVTLoaded = 1;
- return 1;
- }
- else
- {
- CVTLoaded = 0;
- return 0;
- }
+ return 1;
+ } else {
+ CVTLoaded = 0;
+ return 0;
+ }
}
extern int lastFileSize;
-int loadBackground(char* name, int idx)
-{
- uint8* ptr;
- uint8* ptr2;
- uint8* ptrToFree;
+int loadBackground(char *name, int idx) {
+ uint8 *ptr;
+ uint8 *ptr2;
+ uint8 *ptrToFree;
- printf("Loading BG: %s\n",name);
+ printf("Loading BG: %s\n", name);
- if(!backgroundPtrtable[idx])
- {
+ if (!backgroundPtrtable[idx]) {
//if(!gfxModuleData.useEGA && !gfxModuleData.useVGA)
{
- backgroundPtrtable[idx] = (uint8*)mallocAndZero(320*200/*64000*/);
+ backgroundPtrtable[idx] =
+ (uint8 *) mallocAndZero(320 * 200 /*64000 */ );
}
/* else
{
backgroundPtrtable[idx] = hwMemAddr[idx];
} */
- }
+ }
- if(!backgroundPtrtable[idx])
- {
- backgroundTable[idx].name[0] = 0;
- return(-2);
- }
+ if (!backgroundPtrtable[idx]) {
+ backgroundTable[idx].name[0] = 0;
+ return (-2);
+ }
ptrToFree = gfxModuleData.pPage10;
- if(loadFileSub1(&ptrToFree,(uint8*)name,NULL)<0)
- {
- if(ptrToFree != gfxModuleData.pPage10)
- free(ptrToFree);
+ if (loadFileSub1(&ptrToFree, (uint8 *) name, NULL) < 0) {
+ if (ptrToFree != gfxModuleData.pPage10)
+ free(ptrToFree);
- return(-18);
+ return (-18);
}
- if(lastFileSize == 32078 || lastFileSize == 32080 || lastFileSize == 32034)
- {
+ if (lastFileSize == 32078 || lastFileSize == 32080
+ || lastFileSize == 32034) {
colorMode = 0;
- }
- else
- {
+ } else {
colorMode = 1;
}
ptr = ptrToFree;
- ptr2 = ptrToFree;
+ ptr2 = ptrToFree;
- if(!strcmpuint8(name,"LOGO.PI1"))
- {
- bgVar3=bgVar2;
- bgVar1=1;
- bgVar2=1;
- }
- else
- {
- if(bgVar1)
- {
- bgVar2=bgVar3;
- bgVar1=0;
- }
- }
+ if (!strcmpuint8(name, "LOGO.PI1")) {
+ bgVar3 = bgVar2;
+ bgVar1 = 1;
+ bgVar2 = 1;
+ } else {
+ if (bgVar1) {
+ bgVar2 = bgVar3;
+ bgVar1 = 0;
+ }
+ }
- if(!strcmpuint8(ptr,"PAL"))
- {
- printf("Pal loading unsupported !\n");
- exit(1);
- }
- else
- {
- if(!colorMode || ptr2[1] == 5)
- {
- ptr2+=2;
+ if (!strcmpuint8(ptr, "PAL")) {
+ printf("Pal loading unsupported !\n");
+ exit(1);
+ } else {
+ if (!colorMode || ptr2[1] == 5) {
+ ptr2 += 2;
- memcpy(palette,ptr2,0x20);
- ptr2+=0x20;
- flipGen(palette,0x20);
+ memcpy(palette, ptr2, 0x20);
+ ptr2 += 0x20;
+ flipGen(palette, 0x20);
ptr2 += 0x7D00;
loadMEN(&ptr2);
loadCVT(&ptr2);
- gfxModuleData_gfxClearFrameBuffer(backgroundPtrtable[idx]);
- gfxModuleData_field_60((char*)ptrToFree+34, 20, 200, (char*)backgroundPtrtable[idx], 0, 0);
+ gfxModuleData_gfxClearFrameBuffer(backgroundPtrtable
+ [idx]);
+ gfxModuleData_field_60((char *)ptrToFree + 34, 20, 200,
+ (char *)backgroundPtrtable[idx], 0, 0);
- gfxModuleData_setPal((uint8*)(palette + (idx << 6)));
- }
- else
- if(ptr2[1] == 8)
- {
+ gfxModuleData_setPal((uint8 *) (palette + (idx << 6)));
+ } else if (ptr2[1] == 8) {
int i;
- ptr2+=2;
+ ptr2 += 2;
- for(i=0;i<256*3;i++)
- {
+ for (i = 0; i < 256 * 3; i++) {
palette[i] = ptr2[i];
}
//memcpy(palette,ptr2,256*3);
- ptr2+=256*3;
+ ptr2 += 256 * 3;
- memcpy(backgroundPtrtable[idx], ptr2, 320*200);
+ memcpy(backgroundPtrtable[idx], ptr2, 320 * 200);
gfxModuleData_setPal256(palette);
}
- }
+ }
- //if(ptrToFree != gfxModuleData.pPage10)
- // free(ptrToFree);
+ //if(ptrToFree != gfxModuleData.pPage10)
+ // free(ptrToFree);
- if(gfxModuleData.useEGA || gfxModuleData.useTandy)
- {
+ if (gfxModuleData.useEGA || gfxModuleData.useTandy) {
ASSERT(0);
}
- if(gfxModuleData.useEGA || gfxModuleData.useTandy)
- {
+ if (gfxModuleData.useEGA || gfxModuleData.useTandy) {
ASSERT(0);
}
strcpy(backgroundTable[idx].name, name);
- return(0);
+ return (0);
}
} // End of namespace Cruise
Modified: scummvm/trunk/engines/cruise/background.h
===================================================================
--- scummvm/trunk/engines/cruise/background.h 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/background.h 2007-04-27 22:33:45 UTC (rev 26631)
@@ -21,13 +21,13 @@
* $Id$
*
*/
-#ifndef _BACKGROUND_H_
-#define _BACKGROUND_H_
+#ifndef CRUISE_BACKGROUND_H
+#define CRUISE_BACKGROUND_H
+
namespace Cruise {
-struct backgroundTableStruct
-{
+struct backgroundTableStruct {
char name[9];
char extention[6];
};
@@ -36,11 +36,11 @@
extern short int cvtPalette[0x20];
extern int CVTLoaded;
-extern uint8* backgroundPtrtable[8];
+extern uint8 *backgroundPtrtable[8];
extern backgroundTableStruct backgroundTable[8];
-int loadBackground(char* name, int idx);
+int loadBackground(char *name, int idx);
+
} // End of namespace Cruise
#endif
-
Modified: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -28,195 +28,192 @@
backgroundIncrustStruct backgroundIncrustHead;
-void resetBackgroundIncrustList(backgroundIncrustStruct* pHead)
-{
- pHead->next = NULL;
- pHead->prev = NULL;
+void resetBackgroundIncrustList(backgroundIncrustStruct *pHead) {
+ pHead->next = NULL;
+ pHead->prev = NULL;
}
// blit background to another one
-void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char* ptr2, int16 scale, char* destBuffer, char* dataPtr)
-{
- if(*dataPtr == 0)
- {
- ASSERT(0);
- }
+void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char *ptr2,
+ int16 scale, char *destBuffer, char *dataPtr) {
+ if (*dataPtr == 0) {
+ ASSERT(0);
+ }
- buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr);
+ buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr);
}
-backgroundIncrustStruct* addBackgroundIncrust(int16 overlayIdx,int16 objectIdx,backgroundIncrustStruct* pHead,int16 scriptNumber,int16 scriptOverlay, int16 backgroundIdx, int16 param4)
-{
- uint8* backgroundPtr;
- uint8* ptr;
- objectParamsQuery params;
- backgroundIncrustStruct* newElement;
- backgroundIncrustStruct* currentHead;
- backgroundIncrustStruct* currentHead2;
+backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx,
+ int16 objectIdx, backgroundIncrustStruct *pHead, int16 scriptNumber,
+ int16 scriptOverlay, int16 backgroundIdx, int16 param4) {
+ uint8 *backgroundPtr;
+ uint8 *ptr;
+ objectParamsQuery params;
+ backgroundIncrustStruct *newElement;
+ backgroundIncrustStruct *currentHead;
+ backgroundIncrustStruct *currentHead2;
- getMultipleObjectParam(overlayIdx,objectIdx,¶ms);
+ getMultipleObjectParam(overlayIdx, objectIdx, ¶ms);
- ptr = filesDatabase[params.fileIdx].subData.ptr;
+ ptr = filesDatabase[params.fileIdx].subData.ptr;
- if(!ptr)
- {
- return NULL;
- }
+ if (!ptr) {
+ return NULL;
+ }
- if(filesDatabase[params.fileIdx].subData.resourceType != 4 && filesDatabase[params.fileIdx].subData.resourceType != 8)
- {
- return NULL;
- }
+ if (filesDatabase[params.fileIdx].subData.resourceType != 4
+ && filesDatabase[params.fileIdx].subData.resourceType != 8) {
+ return NULL;
+ }
- backgroundPtr = backgroundPtrtable[backgroundIdx];
+ backgroundPtr = backgroundPtrtable[backgroundIdx];
- if(!backgroundPtr)
- {
- ASSERT(0);
- return NULL;
- }
+ if (!backgroundPtr) {
+ ASSERT(0);
+ return NULL;
+ }
- currentHead = pHead;
- currentHead2 = currentHead->next;
+ currentHead = pHead;
+ currentHead2 = currentHead->next;
- while(currentHead2)
- {
- currentHead = currentHead2;
- currentHead2 = currentHead->next;
- }
+ while (currentHead2) {
+ currentHead = currentHead2;
+ currentHead2 = currentHead->next;
+ }
- newElement = (backgroundIncrustStruct*)mallocAndZero(sizeof(backgroundIncrustStruct));
+ newElement =
+ (backgroundIncrustStruct *)
+ mallocAndZero(sizeof(backgroundIncrustStruct));
- if(!newElement)
- return NULL;
+ if (!newElement)
+ return NULL;
- newElement->next = currentHead->next;
- currentHead->next = newElement;
+ newElement->next = currentHead->next;
+ currentHead->next = newElement;
- if(!currentHead2)
- {
- currentHead2 = pHead;
- }
+ if (!currentHead2) {
+ currentHead2 = pHead;
+ }
- newElement->prev = currentHead2->prev;
- currentHead2->prev = newElement;
+ newElement->prev = currentHead2->prev;
+ currentHead2->prev = newElement;
- newElement->objectIdx = objectIdx;
- newElement->field_6 = param4;
- newElement->backgroundIdx = backgroundIdx;
- newElement->overlayIdx = overlayIdx;
- newElement->scriptNumber = scriptNumber;
- newElement->scriptOverlayIdx = scriptOverlay;
- newElement->X = params.X;
- newElement->Y = params.Y;
- newElement->scale = params.scale;
- newElement->field_E = params.fileIdx;
- newElement->var34 = filesDatabase[params.fileIdx].subData.index;
- newElement->ptr = NULL;
- strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
+ newElement->objectIdx = objectIdx;
+ newElement->field_6 = param4;
+ newElement->backgroundIdx = backgroundIdx;
+ newElement->overlayIdx = overlayIdx;
+ newElement->scriptNumber = scriptNumber;
+ newElement->scriptOverlayIdx = scriptOverlay;
+ newElement->X = params.X;
+ newElement->Y = params.Y;
+ newElement->scale = params.scale;
+ newElement->field_E = params.fileIdx;
+ newElement->var34 = filesDatabase[params.fileIdx].subData.index;
+ newElement->ptr = NULL;
+ strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
- if(filesDatabase[params.fileIdx].subData.resourceType == 4) // sprite
- {
- int width = filesDatabase[params.fileIdx].width;
- int height = filesDatabase[params.fileIdx].height;
+ if (filesDatabase[params.fileIdx].subData.resourceType == 4) // sprite
+ {
+ int width = filesDatabase[params.fileIdx].width;
+ int height = filesDatabase[params.fileIdx].height;
- currentTransparent = filesDatabase[params.fileIdx].subData.transparency;
- mainDrawSub4(width, height, NULL, (char*)filesDatabase[params.fileIdx].subData.ptr, newElement->Y, newElement->X, (char*)backgroundPtr, (char*)filesDatabase[params.fileIdx].subData.ptr);
- // ASSERT(0);
- }
- else // poly
- {
- /* if(param4 == 1)
- {
- int var_A;
- int var_8;
- int var_6;
- char* var_10;
+ currentTransparent =
+ filesDatabase[params.fileIdx].subData.transparency;
+ mainDrawSub4(width, height, NULL,
+ (char *)filesDatabase[params.fileIdx].subData.ptr,
+ newElement->Y, newElement->X, (char *)backgroundPtr,
+ (char *)filesDatabase[params.fileIdx].subData.ptr);
+ // ASSERT(0);
+ } else // poly
+ {
+ /* if(param4 == 1)
+ * {
+ * int var_A;
+ * int var_8;
+ * int var_6;
+ * char* var_10;
+ *
+ * mainDrawSub1Sub1(lvar[3], newElement->X, newElement->Y, &var_A, &var_8, &var_6, &var_10, lvar[4], filesDatabase[lvar[3]].subData.ptr);
+ * ASSERT(0);
+ * } */
- mainDrawSub1Sub1(lvar[3], newElement->X, newElement->Y, &var_A, &var_8, &var_6, &var_10, lvar[4], filesDatabase[lvar[3]].subData.ptr);
- ASSERT(0);
- }*/
+ addBackgroundIncrustSub1(params.fileIdx, newElement->X,
+ newElement->Y, NULL, params.scale, (char *)backgroundPtr,
+ (char *)filesDatabase[params.fileIdx].subData.ptr);
+ }
- addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, (char*)backgroundPtr, (char*)filesDatabase[params.fileIdx].subData.ptr );
- }
-
- return newElement;
+ return newElement;
}
-void loadBackgroundIncrustFromSave(FILE* fileHandle)
-{
- int16 numEntry;
- backgroundIncrustStruct* ptr1;
- backgroundIncrustStruct* ptr2;
- int32 i;
+void loadBackgroundIncrustFromSave(FILE *fileHandle) {
+ int16 numEntry;
+ backgroundIncrustStruct *ptr1;
+ backgroundIncrustStruct *ptr2;
+ int32 i;
- fread(&numEntry,2,1,fileHandle);
+ fread(&numEntry, 2, 1, fileHandle);
- ptr1 = &backgroundIncrustHead;
- ptr2 = &backgroundIncrustHead;
+ ptr1 = &backgroundIncrustHead;
+ ptr2 = &backgroundIncrustHead;
- for(i=0;i<numEntry;i++)
- {
- backgroundIncrustStruct* current = (backgroundIncrustStruct*)mallocAndZero(sizeof(backgroundIncrustStruct));
-
- fseek(fileHandle, 4, SEEK_CUR);
+ for (i = 0; i < numEntry; i++) {
+ backgroundIncrustStruct *current =
+ (backgroundIncrustStruct *)
+ mallocAndZero(sizeof(backgroundIncrustStruct));
- fread(¤t->objectIdx,2,1,fileHandle);
- fread(¤t->field_6,2,1,fileHandle);
- fread(¤t->overlayIdx,2,1,fileHandle);
- fread(¤t->X,2,1,fileHandle);
- fread(¤t->Y,2,1,fileHandle);
- fread(¤t->field_E,2,1,fileHandle);
- fread(¤t->scale,2,1,fileHandle);
- fread(¤t->backgroundIdx,2,1,fileHandle);
- fread(¤t->scriptNumber,2,1,fileHandle);
- fread(¤t->scriptOverlayIdx,2,1,fileHandle);
- fread(¤t->ptr,4,1,fileHandle);
- fread(¤t->field_1C,4,1,fileHandle);
- fread(¤t->size,2,1,fileHandle);
- fread(¤t->field_22,2,1,fileHandle);
- fread(¤t->field_24,2,1,fileHandle);
- fread(current->name,14,1,fileHandle);
- fread(¤t->var34,2,1,fileHandle);
+ fseek(fileHandle, 4, SEEK_CUR);
- if(current->size)
- {
- current->ptr = (uint8*)mallocAndZero(current->size);
- fread(current->ptr,current->size,1,fileHandle);
- }
+ fread(¤t->objectIdx, 2, 1, fileHandle);
+ fread(¤t->field_6, 2, 1, fileHandle);
+ fread(¤t->overlayIdx, 2, 1, fileHandle);
+ fread(¤t->X, 2, 1, fileHandle);
+ fread(¤t->Y, 2, 1, fileHandle);
+ fread(¤t->field_E, 2, 1, fileHandle);
+ fread(¤t->scale, 2, 1, fileHandle);
+ fread(¤t->backgroundIdx, 2, 1, fileHandle);
+ fread(¤t->scriptNumber, 2, 1, fileHandle);
+ fread(¤t->scriptOverlayIdx, 2, 1, fileHandle);
+ fread(¤t->ptr, 4, 1, fileHandle);
+ fread(¤t->field_1C, 4, 1, fileHandle);
+ fread(¤t->size, 2, 1, fileHandle);
+ fread(¤t->field_22, 2, 1, fileHandle);
+ fread(¤t->field_24, 2, 1, fileHandle);
+ fread(current->name, 14, 1, fileHandle);
+ fread(¤t->var34, 2, 1, fileHandle);
- current->next = NULL;
- ptr2 = current;
- current->prev = backgroundIncrustHead.prev;
- backgroundIncrustHead.prev = current;
- ptr2 = current->next;
- }
+ if (current->size) {
+ current->ptr = (uint8 *) mallocAndZero(current->size);
+ fread(current->ptr, current->size, 1, fileHandle);
+ }
+
+ current->next = NULL;
+ ptr2 = current;
+ current->prev = backgroundIncrustHead.prev;
+ backgroundIncrustHead.prev = current;
+ ptr2 = current->next;
+ }
}
-void regenerateBackgroundIncrust(backgroundIncrustStruct* pHead)
-{
- printf("Need to regenerate backgroundIncrust\n");
+void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
+ printf("Need to regenerate backgroundIncrust\n");
}
-void freeBackgroundIncrustList(backgroundIncrustStruct* pHead)
-{
- backgroundIncrustStruct* pCurrent = pHead->next;
+void freeBackgroundIncrustList(backgroundIncrustStruct *pHead) {
+ backgroundIncrustStruct *pCurrent = pHead->next;
- while(pCurrent)
- {
- backgroundIncrustStruct* pNext = pCurrent->next;
+ while (pCurrent) {
+ backgroundIncrustStruct *pNext = pCurrent->next;
- if(pCurrent->ptr)
- {
- free(pCurrent->ptr);
- }
+ if (pCurrent->ptr) {
+ free(pCurrent->ptr);
+ }
- free(pCurrent);
+ free(pCurrent);
- pCurrent = pNext;
- }
+ pCurrent = pNext;
+ }
- resetBackgroundIncrustList(pHead);
+ resetBackgroundIncrustList(pHead);
}
} // End of namespace Cruise
Modified: scummvm/trunk/engines/cruise/backgroundIncrust.h
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.h 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.h 2007-04-27 22:33:45 UTC (rev 26631)
@@ -22,14 +22,14 @@
*
*/
-#ifndef _BACKGROUNDINCRUST_H_
-#define _BACKGROUNDINCRUST_H_
+#ifndef CRUISE_BACKGROUNDINCRUST_H
+#define CRUISE_BACKGROUNDINCRUST_H
namespace Cruise {
struct backgroundIncrustStruct {
- struct backgroundIncrustStruct* next;
- struct backgroundIncrustStruct* prev;
+ struct backgroundIncrustStruct *next;
+ struct backgroundIncrustStruct *prev;
uint16 objectIdx;
uint16 field_6;
@@ -41,7 +41,7 @@
uint16 backgroundIdx;
uint16 scriptNumber;
uint16 scriptOverlayIdx;
- uint8* ptr;
+ uint8 *ptr;
int32 field_1C;
int16 size;
uint16 field_22;
@@ -54,13 +54,14 @@
extern backgroundIncrustStruct backgroundIncrustHead;
-void resetBackgroundIncrustList(backgroundIncrustStruct* pHead);
-backgroundIncrustStruct* addBackgroundIncrust(int16 overlayIdx,int16 param2,backgroundIncrustStruct* pHead,int16 scriptNumber,int16 scriptOverlay, int16 backgroundIdx, int16 param4);
-void loadBackgroundIncrustFromSave(FILE* fileHandle);
-void regenerateBackgroundIncrust(backgroundIncrustStruct* pHead);
-void freeBackgroundIncrustList(backgroundIncrustStruct* pHead);
+void resetBackgroundIncrustList(backgroundIncrustStruct * pHead);
+backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 param2,
+ backgroundIncrustStruct * pHead, int16 scriptNumber, int16 scriptOverlay,
+ int16 backgroundIdx, int16 param4);
+void loadBackgroundIncrustFromSave(FILE * fileHandle);
+void regenerateBackgroundIncrust(backgroundIncrustStruct * pHead);
+void freeBackgroundIncrustList(backgroundIncrustStruct * pHead);
} // End of namespace Cruise
#endif
-
Modified: scummvm/trunk/engines/cruise/cell.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cell.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/cell.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -27,133 +27,123 @@
namespace Cruise {
-void resetPtr(cellStruct* ptr)
-{
- ptr->next = NULL;
- ptr->prev = NULL;
+void resetPtr(cellStruct *ptr) {
+ ptr->next = NULL;
+ ptr->prev = NULL;
}
-void loadSavegameDataSub2(FILE * f)
-{
- unsigned short int n_chunks;
- int i;
- cellStruct *p;
- cellStruct *t;
+void loadSavegameDataSub2(FILE *f) {
+ unsigned short int n_chunks;
+ int i;
+ cellStruct *p;
+ cellStruct *t;
- cellHead.next = NULL; // Not in ASM code, but I guess the variable is defaulted
- // to this value in the .exe
+ cellHead.next = NULL; // Not in ASM code, but I guess the variable is defaulted
+ // to this value in the .exe
- fread(&n_chunks, 2, 1, f);
- // BIG ENDIAN MACHINES, PLEASE SWAP IT
+ fread(&n_chunks, 2, 1, f);
+ // BIG ENDIAN MACHINES, PLEASE SWAP IT
- p = &cellHead;
+ p = &cellHead;
- for (i = 0; i < n_chunks; i++)
- {
- t = (cellStruct *) mallocAndZero(sizeof(cellStruct));
+ for (i = 0; i < n_chunks; i++) {
+ t = (cellStruct *) mallocAndZero(sizeof(cellStruct));
- fseek(f, 4, SEEK_CUR);
- fread(&t->idx, 1, 0x30, f);
+ fseek(f, 4, SEEK_CUR);
+ fread(&t->idx, 1, 0x30, f);
- t->next = NULL;
+ t->next = NULL;
p->next = t;
- t->prev = cellHead.prev;
- cellHead.prev = t;
- p = t;
- }
+ t->prev = cellHead.prev;
+ cellHead.prev = t;
+ p = t;
+ }
}
-cellStruct* addCell(int16 overlayIdx,int16 param2,cellStruct* pHead,int16 scriptType,int16 scriptNumber,int16 scriptOverlay, int16 param3, int16 param4)
-{
- int16 var;
+cellStruct *addCell(int16 overlayIdx, int16 param2, cellStruct *pHead,
+ int16 scriptType, int16 scriptNumber, int16 scriptOverlay, int16 param3,
+ int16 param4) {
+ int16 var;
- cellStruct* newElement;
- cellStruct* currentHead = pHead;
- cellStruct* currentHead2;
- cellStruct* currentHead3;
+ cellStruct *newElement;
+ cellStruct *currentHead = pHead;
+ cellStruct *currentHead2;
+ cellStruct *currentHead3;
- if(getSingleObjectParam(overlayIdx,param2,2,&var)<0)
- {
- return 0;
- }
+ if (getSingleObjectParam(overlayIdx, param2, 2, &var) < 0) {
+ return 0;
+ }
- currentHead3 = currentHead;
- currentHead2 = currentHead->next;
+ currentHead3 = currentHead;
+ currentHead2 = currentHead->next;
- while(currentHead2)
- {
- if(currentHead2->type == 3)
- {
- break;
- }
+ while (currentHead2) {
+ if (currentHead2->type == 3) {
+ break;
+ }
- if(currentHead2->type != 5)
- {
- int16 lvar2;
+ if (currentHead2->type != 5) {
+ int16 lvar2;
- getSingleObjectParam(currentHead2->overlay,currentHead2->idx,2,&lvar2);
+ getSingleObjectParam(currentHead2->overlay,
+ currentHead2->idx, 2, &lvar2);
- if(lvar2 > var)
- break;
- }
+ if (lvar2 > var)
+ break;
+ }
- currentHead3 = currentHead2;
- currentHead2 = currentHead2->next;
- }
+ currentHead3 = currentHead2;
+ currentHead2 = currentHead2->next;
+ }
- if(currentHead2)
- {
- if( (currentHead2->overlay == overlayIdx) &&
- (currentHead2->backgroundPlane == param3) &&
- (currentHead2->idx == param2) &&
- (currentHead2->type == param4))
+ if (currentHead2) {
+ if ((currentHead2->overlay == overlayIdx) &&
+ (currentHead2->backgroundPlane == param3) &&
+ (currentHead2->idx == param2) &&
+ (currentHead2->type == param4))
- return NULL;
- }
+ return NULL;
+ }
- currentHead = currentHead2;
+ currentHead = currentHead2;
- newElement = (cellStruct*)mallocAndZero(sizeof(cellStruct));
+ newElement = (cellStruct *) mallocAndZero(sizeof(cellStruct));
- if(!newElement)
- return 0;
+ if (!newElement)
+ return 0;
- newElement->next = currentHead3->next;
- currentHead3->next = newElement;
+ newElement->next = currentHead3->next;
+ currentHead3->next = newElement;
- newElement->idx = param2;
- newElement->type = param4;
- newElement->backgroundPlane = param3;
- newElement->overlay = overlayIdx;
- newElement->freeze = 0;
- newElement->field_16 = scriptNumber;
- newElement->field_18 = scriptOverlay;
- newElement->gfxPtr = NULL;
- newElement->followObjectIdx = param2;
- newElement->followObjectOverlayIdx = overlayIdx;
- newElement->field_1A = scriptType;
- newElement->field_20 = 0;
- newElement->field_22 = 0;
- newElement->nextAnimDelay = 0;
- newElement->field_2C = 0;
- newElement->currentAnimDelay = 0;
- newElement->field_2A = 0;
- newElement->animStep = 0;
- newElement->field_30 = 0;
+ newElement->idx = param2;
+ newElement->type = param4;
+ newElement->backgroundPlane = param3;
+ newElement->overlay = overlayIdx;
+ newElement->freeze = 0;
+ newElement->field_16 = scriptNumber;
+ newElement->field_18 = scriptOverlay;
+ newElement->gfxPtr = NULL;
+ newElement->followObjectIdx = param2;
+ newElement->followObjectOverlayIdx = overlayIdx;
+ newElement->field_1A = scriptType;
+ newElement->field_20 = 0;
+ newElement->field_22 = 0;
+ newElement->nextAnimDelay = 0;
+ newElement->field_2C = 0;
+ newElement->currentAnimDelay = 0;
+ newElement->field_2A = 0;
+ newElement->animStep = 0;
+ newElement->field_30 = 0;
- if(currentHead)
- {
- newElement->prev = currentHead->prev;
- currentHead->prev = newElement;
- }
- else
- {
- newElement->prev = pHead->prev;
- pHead->prev = newElement;
- }
-
- return newElement;
-}
+ if (currentHead) {
+ newElement->prev = currentHead->prev;
+ currentHead->prev = newElement;
+ } else {
+ newElement->prev = pHead->prev;
+ pHead->prev = newElement;
+ }
-
+ return newElement;
}
+
+} // End of namespace Cruise
Modified: scummvm/trunk/engines/cruise/cell.h
===================================================================
--- scummvm/trunk/engines/cruise/cell.h 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/cell.h 2007-04-27 22:33:45 UTC (rev 26631)
@@ -22,8 +22,8 @@
*
*/
-#ifndef _CELL_H_
-#define _CELL_H_
+#ifndef CRUISE_CELL_H
+#define CRUISE_CELL_H
#include "common/stdafx.h"
#include "common/scummsys.h"
@@ -32,16 +32,15 @@
struct gfxEntryStruct;
-struct cellStruct
-{
- struct cellStruct* next;
- struct cellStruct* prev;
+struct cellStruct {
+ struct cellStruct *next;
+ struct cellStruct *prev;
int16 idx;
int16 type;
- int16 overlay ;
- int16 field_A ;
- int16 field_C ;
- int16 spriteIdx ;
+ int16 overlay;
+ int16 field_A;
+ int16 field_C;
+ int16 spriteIdx;
int16 field_10;
int16 backgroundPlane;
int16 freeze;
@@ -59,15 +58,17 @@
int16 field_2C;
int16 currentAnimDelay;
int16 field_30;
- gfxEntryStruct* gfxPtr;
+ gfxEntryStruct *gfxPtr;
};
extern cellStruct cellHead;
-void resetPtr(cellStruct* ptr);
+void resetPtr(cellStruct * ptr);
void loadSavegameDataSub2(FILE * f);
-cellStruct* addCell(int16 overlayIdx,int16 param2,cellStruct* pHead,int16 scriptType,int16 scriptNumber,int16 scriptOverlay, int16 param3, int16 param4);
+cellStruct *addCell(int16 overlayIdx, int16 param2, cellStruct * pHead,
+ int16 scriptType, int16 scriptNumber, int16 scriptOverlay, int16 param3,
+ int16 param4);
-}
+} // End of namespace Cruise
#endif
Modified: scummvm/trunk/engines/cruise/cruise.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/cruise.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -40,20 +40,23 @@
//SoundDriver *g_soundDriver;
//SfxPlayer *g_sfxPlayer;
-Common::SaveFileManager *g_saveFileMan;
+Common::SaveFileManager * g_saveFileMan;
CruiseEngine *g_cruise;
-CruiseEngine::CruiseEngine(OSystem *syst) : Engine(syst) {
- Common::addSpecialDebugLevel(kCruiseDebugScript, "Script", "Script debug level");
+CruiseEngine::CruiseEngine(OSystem * syst) : Engine(syst) {
+ Common::addSpecialDebugLevel(kCruiseDebugScript, "Script",
+ "Script debug level");
// Setup mixer
if (!_mixer->isReady()) {
warning("Sound initialization failed.");
}
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType,
+ ConfMan.getInt("sfx_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType,
+ ConfMan.getInt("music_volume"));
g_cruise = this;
}
@@ -64,10 +67,10 @@
int CruiseEngine::init() {
// Detect game
if (!initGame()) {
- GUIErrorMessage("No valid games were found in the specified directory.");
+ GUIErrorMessage
+ ("No valid games were found in the specified directory.");
return -1;
}
-
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
@@ -87,16 +90,16 @@
return 0;
}
-
void CruiseEngine::initialize() {
fadeVar = 0;
- ptr_something = (ctpVar19Struct*)mallocAndZero(sizeof(ctpVar19Struct)*0x200);
+ ptr_something =
+ (ctpVar19Struct *) mallocAndZero(sizeof(ctpVar19Struct) * 0x200);
/*volVar1 = 0;
- fileData1 = 0;*/
+ * fileData1 = 0; */
- /*PAL_fileHandle = -1;*/
+ /*PAL_fileHandle = -1; */
// video init stuff
Modified: scummvm/trunk/engines/cruise/cruise.h
===================================================================
--- scummvm/trunk/engines/cruise/cruise.h 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/cruise.h 2007-04-27 22:33:45 UTC (rev 26631)
@@ -22,8 +22,8 @@
*
*/
-#ifndef CRUISE_H
-#define CRUISE_H
+#ifndef CRUISE_CRUISE_H
+#define CRUISE_CRUISE_H
#include "common/stdafx.h"
#include "common/scummsys.h"
@@ -41,30 +41,30 @@
struct CRUISEGameDescription;
-class CruiseEngine : public Engine {
+class CruiseEngine:public Engine {
-protected:
+ protected:
int init();
int go();
void shutdown();
-
+
bool initGame();
-public:
- CruiseEngine(OSystem *syst);
- virtual ~CruiseEngine();
+ public:
+ CruiseEngine(OSystem * syst);
+ virtual ~ CruiseEngine();
int getGameType() const;
uint32 getFeatures() const;
- Common::Language getLanguage() const;
- Common::Platform getPlatform() const;
+ Common::Language getLanguage() const;
+ Common::Platform getPlatform() const;
bool loadSaveDirectory(void);
void makeSystemMenu(void);
const CRUISEGameDescription *_gameDescription;
-private:
+ private:
void initialize(void);
bool makeLoad(char *saveName);
void mainLoop(int bootScriptIdx);
@@ -99,9 +99,8 @@
kCmpLT = (1 << 2)
};
+extern Common::SaveFileManager * g_saveFileMan; // TEMP
-extern Common::SaveFileManager *g_saveFileMan; // TEMP
-
} // End of namespace Cruise
#endif
Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp 2007-04-27 22:12:46 UTC (rev 26630)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp 2007-04-27 22:33:45 UTC (rev 26631)
@@ -32,515 +32,464 @@
unsigned int timer = 0;
-void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color)
-{
- int32 i;
- int32 j;
+void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color) {
+ int32 i;
+ int32 j;
- for(i=x1;i<x2;i++)
- {
- for(j=y1;j<y2;j++)
- {
- globalScreen[j*320+i] = color;
- }
- }
+ for (i = x1; i < x2; i++) {
+ for (j = y1; j < y2; j++) {
+ globalScreen[j * 320 + i] = color;
+ }
+ }
}
-void drawBlackSolidBoxSmall()
-{
+void drawBlackSolidBoxSmall() {
// gfxModuleData.drawSolidBox(64,100,256,117,0);
- drawSolidBox(64,100,256,117,0);
+ drawSolidBox(64, 100, 256, 117, 0);
}
-void resetRaster(uint8* rasterPtr, int32 rasterSize)
-{
- memset(rasterPtr,0,rasterSize);
+void resetRaster(uint8 *rasterPtr, int32 rasterSize) {
+ memset(rasterPtr, 0, rasterSize);
}
+void drawInfoStringSmallBlackBox(uint8 *string) {
+ //uint8 buffer[256];
-void drawInfoStringSmallBlackBox(uint8* string)
-{
- //uint8 buffer[256];
-
- gfxModuleData_field_90();
- gfxModuleData_gfxWaitVSync();
- drawBlackSolidBoxSmall();
+ gfxModuleData_field_90();
+ gfxModuleData_gfxWaitVSync();
+ drawBlackSolidBoxSmall();
- drawString(10,100,string,gfxModuleData.pPage10,video4,300);
+ drawString(10, 100, string, gfxModuleData.pPage10, video4, 300);
- gfxModuleData_flip();
+ gfxModuleData_flip();
flipScreen();
- while(1);
+ while (1);
}
-void loadPakedFileToMem(int fileIdx, uint8* buffer)
-{
- //changeCursor(1);
+void loadPakedFileToMem(int fileIdx, uint8 *buffer) {
+ //changeCursor(1);
- currentVolumeFile.seek(volumePtrToFileDescriptor[fileIdx].offset,SEEK_SET);
- currentVolumeFile.read(buffer,volumePtrToFileDescriptor[fileIdx].size);
+ currentVolumeFile.seek(volumePtrToFileDescriptor[fileIdx].offset,
+ SEEK_SET);
+ currentVolumeFile.read(buffer,
+ volumePtrToFileDescriptor[fileIdx].size);
}
-int loadScriptSub1(int scriptIdx, int param)
-{
- objDataStruct* ptr2;
- int counter;
- int i;
-
- if(!overlayTable[scriptIdx].ovlData)
- return(0);
+int loadScriptSub1(int scriptIdx, int param) {
+ objDataStruct *ptr2;
+ int counter;
+ int i;
- ptr2 = overlayTable[scriptIdx].ovlData->objDataTable;
+ if (!overlayTable[scriptIdx].ovlData)
+ return (0);
- if(!ptr2)
- return(0);
+ ptr2 = overlayTable[scriptIdx].ovlData->objDataTable;
- if(overlayTable[scriptIdx].ovlData->numObjData==0)
- return(0);
+ if (!ptr2)
+ return (0);
- counter = 0;
+ if (overlayTable[scriptIdx].ovlData->numObjData == 0)
+ return (0);
- for(i=0;i<overlayTable[scriptIdx].ovlData->numObjData;i++)
- {
- if(ptr2[i].var0 == param)
- {
- counter++;
- }
- }
+ counter = 0;
- return(counter);
+ for (i = 0; i < overlayTable[scriptIdx].ovlData->numObjData; i++) {
+ if (ptr2[i].var0 == param) {
+ counter++;
+ }
+ }
+
+ return (counter);
}
-void saveShort(void* ptr, short int var)
-{
- *(int16*)ptr = var;
+void saveShort(void *ptr, short int var) {
+ *(int16 *) ptr = var;
- flipShort((int16*)ptr);
+ flipShort((int16 *) ptr);
}
-int16 loadShort(void* ptr)
-{
- short int temp;
+int16 loadShort(void *ptr) {
+ short int temp;
- temp = *(int16*)ptr;
+ temp = *(int16 *) ptr;
- flipShort(&temp);
+ flipShort(&temp);
- return(temp);
+ return (temp);
}
+void resetFileEntryRange(int param1, int param2) {
+ int i;
-void resetFileEntryRange(int param1, int param2)
-{
- int i;
-
- for(i=param1;i<param2;i++)
- {
- resetFileEntry(i);
- }
+ for (i = param1; i < param2; i++) {
+ resetFileEntry(i);
+ }
}
-int getProcParam(int overlayIdx, int param2, uint8* name)
-{
- int numExport;
- int i;
- exportEntryStruct* exportDataPtr;
- uint8* exportNamePtr;
- uint8 exportName[80];
+int getProcParam(int overlayIdx, int param2, uint8 *name) {
+ int numExport;
+ int i;
+ exportEntryStruct *exportDataPtr;
+ uint8 *exportNamePtr;
+ uint8 exportName[80];
- if(!overlayTable[overlayIdx].alreadyLoaded)
- return 0;
+ if (!overlayTable[overlayIdx].alreadyLoaded)
+ return 0;
- if(!overlayTable[overlayIdx].ovlData)
- return 0;
+ if (!overlayTable[overlayIdx].ovlData)
+ return 0;
- numExport = overlayTable[overlayIdx].ovlData->numExport;
- exportDataPtr = overlayTable[overlayIdx].ovlData->exportDataPtr;
- exportNamePtr = overlayTable[overlayIdx].ovlData->exportNamesPtr;
+ numExport = overlayTable[overlayIdx].ovlData->numExport;
+ exportDataPtr = overlayTable[overlayIdx].ovlData->exportDataPtr;
+ exportNamePtr = overlayTable[overlayIdx].ovlData->exportNamesPtr;
- if(!exportNamePtr)
- return 0;
+ if (!exportNamePtr)
+ return 0;
- for(i=0;i<numExport;i++)
- {
- if(exportDataPtr[i].var4 == param2)
- {
- strcpyuint8(exportName,exportDataPtr[i].offsetToName+exportNamePtr);
+ for (i = 0; i < numExport; i++) {
+ if (exportDataPtr[i].var4 == param2) {
+ strcpyuint8(exportName,
+ exportDataPtr[i].offsetToName + exportNamePtr);
- if(!strcmpuint8(exportName,name))
- {
- return(exportDataPtr[i].idx);
- }
- }
- }
+ if (!strcmpuint8(exportName, name)) {
+ return (exportDataPtr[i].idx);
+ }
+ }
+ }
- return 0;
+ return 0;
}
-void changeScriptParamInList(int param1, int param2, scriptInstanceStruct* pScriptInstance,int newValue, int param3)
-{
- pScriptInstance = pScriptInstance->nextScriptPtr;
- while(pScriptInstance)
- {
- if( (pScriptInstance->overlayNumber == param1 || param1 == -1)
- &&(pScriptInstance->scriptNumber == param2 || param2 == -1)
- &&(pScriptInstance->var12 == param3 || param3 == -1))
- {
- pScriptInstance->var12 = newValue;
- }
+void changeScriptParamInList(int param1, int param2,
+ scriptInstanceStruct *pScriptInstance, int newValue, int param3) {
+ pScriptInstance = pScriptInstance->nextScriptPtr;
+ while (pScriptInstance) {
+ if ((pScriptInstance->overlayNumber == param1 || param1 == -1)
+ && (pScriptInstance->scriptNumber == param2
+ || param2 == -1)
+ && (pScriptInstance->var12 == param3 || param3 == -1)) {
+ pScriptInstance->var12 = newValue;
+ }
- pScriptInstance = pScriptInstance->nextScriptPtr;
- }
+ pScriptInstance = pScriptInstance->nextScriptPtr;
+ }
}
+void initBigVar3() {
+ int i;
-void initBigVar3()
-{
- int i;
+ for (i = 0; i < 257; i++) {
+ if (filesDatabase[i].subData.ptr) {
+ free(filesDatabase[i].subData.ptr);
+ }
- for(i=0;i<257;i++)
- {
- if(filesDatabase[i].subData.ptr)
- {
- free(filesDatabase[i].subData.ptr);
- }
+ filesDatabase[i].subData.ptr = NULL;
+ filesDatabase[i].subData.ptr2 = NULL;
- filesDatabase[i].subData.ptr = NULL;
- filesDatabase[i].subData.ptr2 = NULL;
-
- filesDatabase[i].subData.index = -1;
- filesDatabase[i].subData.resourceType = 0;
- }
+ filesDatabase[i].subData.index = -1;
+ filesDatabase[i].subData.resourceType = 0;
+ }
}
-void resetPtr2(scriptInstanceStruct* ptr)
-{
- ptr->nextScriptPtr = NULL;
- ptr->scriptNumber = -1;
+void resetPtr2(scriptInstanceStruct *ptr) {
+ ptr->nextScriptPtr = NULL;
+ ptr->scriptNumber = -1;
}
-void resetActorPtr(actorStruct* ptr)
-{
- ptr->next = NULL;
- ptr->prev = NULL;
+void resetActorPtr(actorStruct *ptr) {
+ ptr->next = NULL;
+ ptr->prev = NULL;
}
-ovlData3Struct* getOvlData3Entry(int32 scriptNumber, int32 param)
-{
- ovlDataStruct* ovlData = overlayTable[scriptNumber].ovlData;
+ovlData3Struct *getOvlData3Entry(int32 scriptNumber, int32 param) {
+ ovlDataStruct *ovlData = overlayTable[scriptNumber].ovlData;
- if(!ovlData)
- {
- return NULL;
- }
+ if (!ovlData) {
+ return NULL;
+ }
- if(param<0)
- {
- return NULL;
- }
+ if (param < 0) {
+ return NULL;
+ }
- if(ovlData->numScripts1 <= param)
- {
- return NULL;
- }
+ if (ovlData->numScripts1 <= param) {
+ return NULL;
+ }
- if(!ovlData->data3Table)
- {
- return NULL;
- }
+ if (!ovlData->data3Table) {
+ return NULL;
+ }
- return(&ovlData->data3Table[param]);
+ return (&ovlData->data3Table[param]);
}
-ovlData3Struct* scriptFunc1Sub2(int32 scriptNumber, int32 param)
-{
- ovlDataStruct* ovlData = overlayTable[scriptNumber].ovlData;
+ovlData3Struct *scriptFunc1Sub2(int32 scriptNumber, int32 param) {
+ ovlDataStruct *ovlData = overlayTable[scriptNumber].ovlData;
- if(!ovlData)
- {
- return NULL;
- }
+ if (!ovlData) {
+ return NULL;
+ }
- if(param<0)
- {
- return NULL;
- }
+ if (param < 0) {
+ return NULL;
+ }
- if(ovlData->numScripts2 <= param)
- {
- return NULL;
- }
+ if (ovlData->numScripts2 <= param) {
+ return NULL;
+ }
- if(!ovlData->ptr1)
- {
- return NULL;
- }
+ if (!ovlData->ptr1) {
+ return NULL;
+ }
- return((ovlData3Struct*)(ovlData->ptr1+param*0x1C));
+ return ((ovlData3Struct *) (ovlData->ptr1 + param * 0x1C));
}
-void scriptFunc2(int scriptNumber,scriptInstanceStruct* scriptHandle, int param, int param2)
-{
- if(scriptHandle->nextScriptPtr)
- {
- if(scriptNumber == scriptHandle->nextScriptPtr->overlayNumber || scriptNumber != -1)
- {
- if(param2 == scriptHandle->nextScriptPtr->scriptNumber || param2 != -1)
- {
- scriptHandle->nextScriptPtr->sysKey = param;
- }
- }
- }
+void scriptFunc2(int scriptNumber, scriptInstanceStruct * scriptHandle,
+ int param, int param2) {
+ if (scriptHandle->nextScriptPtr) {
+ if (scriptNumber == scriptHandle->nextScriptPtr->overlayNumber
+ || scriptNumber != -1) {
+ if (param2 == scriptHandle->nextScriptPtr->scriptNumber
+ || param2 != -1) {
+ scriptHandle->nextScriptPtr->sysKey = param;
+ }
+ }
+ }
}
-uint8* getDataFromData3(ovlData3Struct* ptr, int param)
-{
- uint8* dataPtr;
-
- if(!ptr)
- return(NULL);
+uint8 *getDataFromData3(ovlData3Struct *ptr, int param) {
+ uint8 *dataPtr;
- dataPtr = ptr->dataPtr;
+ if (!ptr)
+ return (NULL);
- if(!dataPtr)
- return(NULL);
+ dataPtr = ptr->dataPtr;
- switch(param)
- {
- case 0:
- {
- return(dataPtr);
- }
- case 1:
- {
- return(dataPtr + ptr->offsetToSubData3); // strings
- }
- case 2:
- {
- return(dataPtr + ptr->offsetToSubData2);
- }
- case 3:
- {
- return(dataPtr + ptr->offsetToImportData); // import data
- }
- case 4:
- {
- return(dataPtr + ptr->offsetToImportName); // import names
- }
- case 5:
- {
- return(dataPtr + ptr->offsetToSubData5);
- }
- default:
- {
- return(NULL);
- }
- }
+ if (!dataPtr)
+ return (NULL);
+
+ switch (param) {
+ case 0:
+ {
+ return (dataPtr);
+ }
+ case 1:
+ {
+ return (dataPtr + ptr->offsetToSubData3); // strings
+ }
+ case 2:
+ {
+ return (dataPtr + ptr->offsetToSubData2);
+ }
+ case 3:
+ {
+ return (dataPtr + ptr->offsetToImportData); // import data
+ }
+ case 4:
+ {
+ return (dataPtr + ptr->offsetToImportName); // import names
+ }
+ case 5:
+ {
+ return (dataPtr + ptr->offsetToSubData5);
+ }
+ default:
+ {
+ return (NULL);
+ }
+ }
}
-void printInfoBlackBox(const char* string)
-{
+void printInfoBlackBox(const char *string) {
}
-void waitForPlayerInput()
-{
+void waitForPlayerInput() {
}
-void getFileExtention(const char* name,char* buffer)
-{
- while(*name != '.' && *name)
- {
- name++;
- }
+void getFileExtention(const char *name, char *buffer) {
+ while (*name != '.' && *name) {
+ name++;
+ }
- strcpy(buffer,name);
+ strcpy(buffer, name);
}
-void removeExtention(const char* name, char* buffer) // not like in original
-{
- char* ptr;
-
- strcpy(buffer,name);
+void removeExtention(const char *name, char *buffer) { // not like in original
+ char *ptr;
- ptr = strchr(buffer,'.');
+ strcpy(buffer, name);
- if(ptr)
- *ptr = 0;
+ ptr = strchr(buffer, '.');
+
+ if (ptr)
+ *ptr = 0;
}
int lastFileSize;
-int loadFileSub1(uint8** ptr, uint8* name, uint8* ptr2)
-{
- int i;
- char buffer[256];
- int fileIdx;
- int unpackedSize;
- uint8* unpackedBuffer;
-
- for(i=0;i<64;i++)
- {
- if(mediumVar[i].ptr)
- {
- if(!strcmpuint8(mediumVar[i].name,name))
- {
- printf("Unsupported code in loadFIleSub1 !\n");
- exit(1);
- }
- }
- }
+int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
+ int i;
+ char buffer[256];
+ int fileIdx;
+ int unpackedSize;
+ uint8 *unpackedBuffer;
- getFileExtention((char*)name,buffer);
+ for (i = 0; i < 64; i++) {
+ if (mediumVar[i].ptr) {
+ if (!strcmpuint8(mediumVar[i].name, name)) {
+ printf("Unsupported code in loadFIleSub1 !\n");
+ exit(1);
+ }
+ }
+ }
- if(!strcmp(buffer,".SPL"))
- {
- removeExtention((char*)name,buffer);
+ getFileExtention((char *)name, buffer);
- // if(useH32)
- {
- strcatuint8(buffer,".H32");
- }
- /* else
- if(useAdlib)
- {
- strcatuint8(buffer,".ADL");
- }
- else
- {
- strcatuint8(buffer,".HP");
- }*/
- }
- else
- {
- strcpyuint8(buffer,name);
- }
+ if (!strcmp(buffer, ".SPL")) {
+ removeExtention((char *)name, buffer);
- fileIdx = findFileInDisks((uint8*)buffer);
+ // if(useH32)
+ {
+ strcatuint8(buffer, ".H32");
+ }
+ /* else
+ * if(useAdlib)
+ * {
+ * strcatuint8(buffer,".ADL");
+ * }
+ * else
+ * {
+ * strcatuint8(buffer,".HP");
+ * } */
+ } else {
+ strcpyuint8(buffer, name);
+ }
- if(fileIdx<0)
- return(-18);
+ fileIdx = findFileInDisks((uint8 *) buffer);
- unpackedSize = loadFileVar1 = volumePtrToFileDescriptor[fileIdx].extSize + 2;
+ if (fileIdx < 0)
+ return (-18);
- // TODO: here, can unpack in gfx module buffer
- unpackedBuffer = (uint8*)mallocAndZero(unpackedSize);
+ unpackedSize = loadFileVar1 =
+ volumePtrToFileDescriptor[fileIdx].extSize + 2;
- if(!unpackedBuffer)
- {
- return(-2);
- }
+ // TODO: here, can unpack in gfx module buffer
+ unpackedBuffer = (uint8 *) mallocAndZero(unpackedSize);
+ if (!unpackedBuffer) {
+ return (-2);
+ }
+
lastFileSize = unpackedSize;
- if(volumePtrToFileDescriptor[fileIdx].size +2 != unpackedSize)
- {
- unsigned short int realUnpackedSize;
- uint8* tempBuffer;
- uint8* pakedBuffer = (uint8*) mallocAndZero(volumePtrToFileDescriptor[fileIdx].size +2);
+ if (volumePtrToFileDescriptor[fileIdx].size + 2 != unpackedSize) {
+ unsigned short int realUnpackedSize;
+ uint8 *tempBuffer;
+ uint8 *pakedBuffer =
+ (uint8 *) mallocAndZero(volumePtrToFileDescriptor[fileIdx].
+ size + 2);
- loadPakedFileToMem(fileIdx,pakedBuffer);
+ loadPakedFileToMem(fileIdx, pakedBuffer);
- realUnpackedSize = *(uint16*)(pakedBuffer+volumePtrToFileDescriptor[fileIdx].size-2);
- flipShort((int16*)&realUnpackedSize);
+ realUnpackedSize =
+ *(uint16 *) (pakedBuffer +
+ volumePtrToFileDescriptor[fileIdx].size - 2);
+ flipShort((int16 *) & realUnpackedSize);
- lastFileSize = realUnpackedSize;
+ lastFileSize = realUnpackedSize;
- tempBuffer = (uint8*)mallocAndZero(realUnpackedSize);
+ tempBuffer = (uint8 *) mallocAndZero(realUnpackedSize);
- decomp((uint8*)pakedBuffer+volumePtrToFileDescriptor[fileIdx].size-4,(uint8*)unpackedBuffer+realUnpackedSize,realUnpackedSize);
+ decomp((uint8 *) pakedBuffer +
+ volumePtrToFileDescriptor[fileIdx].size - 4,
+ (uint8 *) unpackedBuffer + realUnpackedSize,
+ realUnpackedSize);
- free(pakedBuffer);
- }
- else
- {
- loadPakedFileToMem(fileIdx,unpackedBuffer);
- }
+ free(pakedBuffer);
+ } else {
+ loadPakedFileToMem(fileIdx, unpackedBuffer);
+ }
- *ptr = unpackedBuffer;
+ *ptr = unpackedBuffer;
- return(1);
+ return (1);
}
-void resetFileEntry(int32 entryNumber)
-{
- if(entryNumber>=257)
- return;
+void resetFileEntry(int32 entryNumber) {
+ if (entryNumber >= 257)
+ return;
- if(!filesDatabase[entryNumber].subData.ptr)
- return;
+ if (!filesDatabase[entryNumber].subData.ptr)
+ return;
- free(filesDatabase[entryNumber].subData.ptr);
+ free(filesDatabase[entryNumber].subData.ptr);
- filesDatabase[entryNumber].subData.ptr = NULL;
- filesDatabase[entryNumber].subData.ptr2 = NULL;
- filesDatabase[entryNumber].widthInColumn = 0;
- filesDatabase[entryNumber].width = 0;
- filesDatabase[entryNumber].resType = 0;
- filesDatabase[entryNumber].height = 0;
- filesDatabase[entryNumber].subData.index = -1;
- filesDatabase[entryNumber].subData.resourceType = 0;
- filesDatabase[entryNumber].subData.field_1C = 0;
- filesDatabase[entryNumber].subData.name[0] = 0;
+ filesDatabase[entryNumber].subData.ptr = NULL;
+ filesDatabase[entryNumber].subData.ptr2 = NULL;
+ filesDatabase[entryNumber].widthInColumn = 0;
+ filesDatabase[entryNumber].width = 0;
+ filesDatabase[entryNumber].resType = 0;
+ filesDatabase[entryNumber].height = 0;
+ filesDatabase[entryNumber].subData.index = -1;
+ filesDatabase[entryNumber].subData.resourceType = 0;
+ filesDatabase[entryNumber].subData.field_1C = 0;
+ filesDatabase[entryNumber].subData.name[0] = 0;
}
-uint8* mainProc14(uint16 overlay, uint16 idx)
-{
- ASSERT(0);
-
- return NULL;
+uint8 *mainProc14(uint16 overlay, uint16 idx) {
+ ASSERT(0);
+
+ return NULL;
}
-int initAllData(void)
-{
- int i;
-
- setupFuncArray();
- setupOpcodeTable();
- initOverlayTable();
+int initAllData(void) {
+ int i;
- setup1 = 0;
- currentActiveBackgroundPlane = 0;
+ setupFuncArray();
+ setupOpcodeTable();
+ initOverlayTable();
- freeDisk();
+ setup1 = 0;
+ currentActiveBackgroundPlane = 0;
- initVar5[0] = -1;
- initVar5[3] = -1;
- initVar5[6] = -1;
- initVar5[9] = -1;
+ freeDisk();
- menuTable[0] = NULL;
+ initVar5[0] = -1;
+ initVar5[3] = -1;
+ initVar5[6] = -1;
+ initVar5[9] = -1;
- for(i=0;i<2000;i++)
- {
- globalVars[i] = 0;
- }
+ menuTable[0] = NULL;
- for(i=0;i<8;i++)
- {
- backgroundTable[i].name[0] = 0;
- }
+ for (i = 0; i < 2000; i++) {
+ globalVars[i] = 0;
+ }
- for(i=0;i<257;i++)
- {
- filesDatabase[i].subData.ptr = NULL;
- filesDatabase[i].subData.ptr2 = NULL;
- }
+ for (i = 0; i < 8; i++) {
+ backgroundTable[i].name[0] = 0;
+ }
- initBigVar3();
+ for (i = 0; i < 257; i++) {
+ filesDatabase[i].subData.ptr = NULL;
+ filesDatabase[i].subData.ptr2 = NULL;
+ }
- resetPtr2(&scriptHandle2);
- resetPtr2(&scriptHandle1);
+ initBigVar3();
- resetPtr(&cellHead);
+ resetPtr2(&scriptHandle2);
+ resetPtr2(&scriptHandle1);
- resetActorPtr(&actorHead);
- resetBackgroundIncrustList(&backgroundIncrustHead);
+ resetPtr(&cellHead);
- bootOverlayNumber = loadOverlay((uint8*)"AUTO00");
+ resetActorPtr(&actorHead);
+ resetBackgroundIncrustList(&backgroundIncrustHead);
+ bootOverlayNumber = loadOverlay((uint8 *) "AUTO00");
+
#ifdef DUMP_SCRIPT
loadOverlay("TITRE");
loadOverlay("TOM");
@@ -627,724 +576,801 @@
//exit(1);
#endif
- if(bootOverlayNumber)
- {
- positionInStack = 0;
+ if (bootOverlayNumber) {
+ positionInStack = 0;
- attacheNewScriptToTail(bootOverlayNumber,&scriptHandle2,0,20,0,0,scriptType_20);
- scriptFunc2(bootOverlayNumber,&scriptHandle2,1,0);
- }
+ attacheNewScriptToTail(bootOverlayNumber, &scriptHandle2, 0,
+ 20, 0, 0, scriptType_20);
+ scriptFunc2(bootOverlayNumber, &scriptHandle2, 1, 0);
+ }
- strcpyuint8(systemStrings.bootScriptName,"AUTO00");
+ strcpyuint8(systemStrings.bootScriptName, "AUTO00");
- return(bootOverlayNumber);
+ return (bootOverlayNumber);
}
-int removeFinishedScripts(scriptInstanceStruct* ptrHandle)
-{
- scriptInstanceStruct* ptr = ptrHandle->nextScriptPtr; // can't destruct the head
- scriptInstanceStruct* oldPtr = ptrHandle;
-
- if(!ptr)
- return(0);
+int removeFinishedScripts(scriptInstanceStruct *ptrHandle) {
+ scriptInstanceStruct *ptr = ptrHandle->nextScriptPtr; // can't destruct the head
+ scriptInstanceStruct *oldPtr = ptrHandle;
- do
- {
- if(ptr->scriptNumber == -1)
- {
- oldPtr->nextScriptPtr = ptr->nextScriptPtr;
+ if (!ptr)
+ return (0);
- if(ptr->var6 && ptr->varA)
- {
- // free(ptr->var6);
- }
+ do {
+ if (ptr->scriptNumber == -1) {
+ oldPtr->nextScriptPtr = ptr->nextScriptPtr;
- free(ptr);
+ if (ptr->var6 && ptr->varA) {
+ // free(ptr->var6);
+ }
- ptr = oldPtr->nextScriptPtr;
- }
- else
- {
- oldPtr = ptr;
- ptr = ptr->nextScriptPtr;
- }
- }while(ptr);
+ free(ptr);
- return(0);
+ ptr = oldPtr->nextScriptPtr;
+ } else {
+ oldPtr = ptr;
+ ptr = ptr->nextScriptPtr;
+ }
+ } while (ptr);
+
+ return (0);
}
int nePasAffichierMenuDialogue;
int var37 = 0;
int var38 = 0;
-int getCursorFromObject(int mouseX, int mouseY, int* outX, int* outY)
-{
- int16 var_2;
- int16 var_4;
- int16 var_14;
- int16 var_16;
- objectParamsQuery params;
- int16 var_10;
- int16 var_E;
- int16 var_C;
+int getCursorFromObject(int mouseX, int mouseY, int *outX, int *outY) {
+ int16 var_2;
+ int16 var_4;
+ int16 var_14;
+ int16 var_16;
+ objectParamsQuery params;
+ int16 var_10;
+ int16 var_E;
+ int16 var_C;
// int16 var_42;
- int16 var_A;
- int16 var_6;
+ int16 var_A;
+ int16 var_6;
- char objectName[80];
+ char objectName[80];
- cellStruct* currentObject = cellHead.prev;
+ cellStruct *currentObject = cellHead.prev;
- while(currentObject)
- {
- if(currentObject->overlay >= 0)
- {
- if(overlayTable[currentObject->overlay].alreadyLoaded)
- {
- if(currentObject->type == 4 || currentObject->type == 1 || currentObject->type == 9 || currentObject->type == 3)
- {
- strcpy(objectName, getObjectName(currentObject->idx, overlayTable[currentObject->overlay].ovlData->specialString2));
+ while (currentObject) {
+ if (currentObject->overlay >= 0) {
+ if (overlayTable[currentObject->overlay].alreadyLoaded) {
+ if (currentObject->type == 4
+ || currentObject->type == 1
+ || currentObject->type == 9
+ || currentObject->type == 3) {
+ strcpy(objectName,
+ getObjectName(currentObject->idx,
+ overlayTable[currentObject->
+ overlay].ovlData->
+ specialString2));
- if(strlen(objectName))
- {
- if(currentObject->freeze == 0)
- {
- var_2 = currentObject->idx;
- var_4 = currentObject->overlay;
- var_14 = currentObject->followObjectIdx;
- var_16 = currentObject->followObjectOverlayIdx;
+ if (strlen(objectName)) {
+ if (currentObject->freeze == 0) {
+ var_2 =
+ currentObject->idx;
+ var_4 =
+ currentObject->
+ overlay;
+ var_14 =
+ currentObject->
+ followObjectIdx;
+ var_16 =
+ currentObject->
+ followObjectOverlayIdx;
- getMultipleObjectParam(currentObject->overlay, currentObject->idx, ¶ms);
+ getMultipleObjectParam
+ (currentObject->
+ overlay,
+ currentObject->idx,
+ ¶ms);
- var_10 = 0;
- var_E = 0;
- var_C = 0;
+ var_10 = 0;
+ var_E = 0;
+ var_C = 0;
- if((var_4 != var_16) && (var_2 != var_14))
- {
- getMultipleObjectParam(var_16, var_14, ¶ms);
+ if ((var_4 != var_16)
+ && (var_2 !=
+ var_14)) {
+ getMultipleObjectParam
+ (var_16,
+ var_14,
+ ¶ms);
- var_C = params.X;
- var_E = params.Y;
- var_10 = params.fileIdx;
- }
+ var_C =
+ params.X;
+ var_E =
+ params.Y;
+ var_10 =
+ params.
+ fileIdx;
+ }
- if(params.var5 >= 0 && params.fileIdx >= 0)
- {
- if(currentObject->type == 3)
- {
- assert(0);
+ if (params.var5 >= 0
+ && params.
+ fileIdx >= 0) {
+ if (currentObject->type == 3) {
+ assert
+ (0);
- var_2 = params.scale;
- var_A = params.X + var_C;
+ var_2 =
+ params.
+ scale;
+ var_A =
+ params.
+ X +
+ var_C;
- // TODO: this var3 is stupid, investigate...
- if((var_A <= mouseX) && (var_A + params.fileIdx >= mouseX) && (mouseY >= params.Y + var_E) && (params.Y + var_E + var2 >= mouseY))
- {
- *outX = var_16;
- *outY = var_14;
-
- return(currentObject->type);
- }
- }
- else
- if(currentObject->type == 4 || currentObject->type == 1 || currentObject->type == 9 )
- {
- int si;
- int var_8;
- int di;
+ // TODO: this var3 is stupid, investigate...
+ if ((var_A <= mouseX) && (var_A + params.fileIdx >= mouseX) && (mouseY >= params.Y + var_E) && (params.Y + var_E + var2 >= mouseY)) {
+ *outX
+ =
+ var_16;
+ *outY
+ =
+ var_14;
- var_A = params.X + var_C;
- var_6 = params.Y + var_E;
-
- di = params.fileIdx;
+ return
+ (currentObject->
+ type);
+ }
+ } else
+ if
+ (currentObject->
+ type == 4
+ ||
+ currentObject->
+ type == 1
+ ||
+ currentObject->
+ type ==
+ 9) {
+ int si;
+ int var_8;
+ int di;
- if(di<0)
- {
- di += var_10;
- }
+ var_A =
+ params.
+ X +
+ var_C;
+ var_6 =
+ params.
+ Y +
+ var_E;
+ di = params.fileIdx;
+
+ if (di
+ <
+ 0)
+ {
+ di += var_10;
+ }
+
/* if((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr))
{
assert(0);
}
else */
- {
- var_4 = filesDatabase[di].resType;
+ {
+ var_4
+ =
+ filesDatabase
+ [di].
+ resType;
- if(var_4 == 1)
- {
- var_C = filesDatabase[di].widthInColumn/2;
- }
- else
- {
- var_C = filesDatabase[di].width;
- }
+ if (var_4 == 1) {
+ var_C
+ =
+ filesDatabase
+ [di].
+ widthInColumn
+ /
+ 2;
+ } else {
+ var_C
+ =
+ filesDatabase
+ [di].
+ width;
+ }
- var_8 = filesDatabase[di].height;
+ var_8
+ =
+ filesDatabase
+ [di].
+ height;
- var_2 = mouseX - var_A;
- si = mouseY - var_6;
+ var_2
+ =
+ mouseX
+ -
+ var_A;
+ si = mouseY - var_6;
- if(var_2>0)
- {
- if(var_C>var_2)
- {
- if(si>0)
- {
- if(var_8>=si)
- {
- if(filesDatabase[di].subData.ptr)
- {
- if(var_4 == 1)
- {
- }
- else
- {
- }
+ if (var_2 > 0) {
+ if (var_C > var_2) {
+ if (si > 0) {
+ if (var_8 >= si) {
+ if (filesDatabase[di].subData.ptr) {
+ if (var_4 == 1) {
+ } else {
+ }
- printf("should compare to mask in getCursorFromObject...\n");
+ printf
+ ("should compare to mask in getCursorFromObject...\n");
- *outX = var_16;
- *outY = var_14;
+ *outX
+ =
+ var_16;
+ *outY
+ =
+ var_14;
- printf("Selected: %s\n", objectName);
+ printf
+ ("Selected: %s\n",
+ objectName);
- return currentObject->type;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ return
@@ Diff output truncated at 100000 characters. @@
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