[Scummvm-cvs-logs] SF.net SVN: scummvm: [26605] scummvm/trunk/engines
yazoo at users.sourceforge.net
yazoo at users.sourceforge.net
Fri Apr 27 14:58:36 CEST 2007
Revision: 26605
http://scummvm.svn.sourceforge.net/scummvm/?rev=26605&view=rev
Author: yazoo
Date: 2007-04-27 05:58:35 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Add cruise source code for scummvm
Added Paths:
-----------
scummvm/trunk/engines/cruise/
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/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/loadSave.cpp
scummvm/trunk/engines/cruise/loadSave.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/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
Added: scummvm/trunk/engines/cruise/actor.cpp
===================================================================
--- scummvm/trunk/engines/cruise/actor.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/actor.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,1080 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "cruise/cruise.h"
+
+namespace Cruise {
+
+int16 mainProc13(int overlayIdx, int param1, actorStruct* pStartEntry, int param2)
+{
+ actorStruct* pCurrentEntry = pStartEntry->next;
+
+ while(pCurrentEntry)
+ {
+ if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
+ (pCurrentEntry->var4 == param1 || param1 == -1) &&
+ (pCurrentEntry->type == param2 || param2 == -1) &&
+ (pCurrentEntry->pathId != -2))
+ {
+ return 0;
+ }
+
+ pCurrentEntry = pCurrentEntry->next;
+ }
+
+ return 1;
+}
+
+actorStruct* findActor(int overlayIdx, int param1, actorStruct* pStartEntry, int param2)
+{
+ actorStruct* pCurrentEntry = pStartEntry->next;
+
+ while(pCurrentEntry)
+ {
+ if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
+ (pCurrentEntry->var4 == param1 || param1 == -1) &&
+ (pCurrentEntry->type == param2 || param2 == -1) )
+ {
+ return pCurrentEntry;
+ }
+
+ pCurrentEntry = pCurrentEntry->next;
+ }
+
+ return NULL;
+}
+
+int nclick_noeud;
+int flag_aff_chemin;
+
+void getPixel(int x, int y)
+{
+ int x_min, x_max, y_min, y_max;
+
+ ctpVar19Struct *polygone;
+ ctpVar19SubStruct *tableau;
+
+ polygone = ctpVar19; /* adr structure polygone */
+
+ 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;
+
+ 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;
+
+ //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;
+ }
+ }
+ polygone = polygone->field_0;
+ }
+
+ flag_obstacle=0;
+}
+
+int x_mouse;
+int y_mouse;
+
+int point_select;
+
+int table_ptselect[2][2];
+
+int X;
+int Y;
+
+int modelVar9;
+int modelVar10;
+
+void polydroite(int x1, int y1, int x2, int y2)
+{
+ int dx;
+ int dy;
+
+ int mD0;
+ int mD1;
+
+ int mA0;
+ int mA1;
+
+ int bp;
+ int cx;
+ int si;
+
+ int ax;
+ int bx;
+
+ modelVar9 = x1;
+ modelVar10 = y1;
+
+ dx = x2-x1;
+ dy = y2-y1;
+
+ mD0 = mD1 = 1;
+
+ if(dx<0)
+ {
+ dx = -dx;
+ mD0 = -1;
+ }
+
+ if(dy<0)
+ {
+ dy = -dy;
+ mD1 = -1;
+ }
+
+ if(dx<dy)
+ {
+ mA0 = 0;
+ bp = dx;
+ cx = dy;
+
+ mA1 = mD1;
+ }
+ else
+ {
+ mA1 = 0;
+ bp = dy;
+ cx = dx;
+
+ mA0 = mD0;
+ }
+
+ bp=bp*2;
+ dx=bp-cx;
+ si=dx-cx;
+
+ ax = modelVar9;
+ bx = modelVar10;
+
+ getPixel(modelVar9, modelVar10);
+
+ X = modelVar9;
+ Y = modelVar10;
+
+ if(flag_obstacle==0)
+ {
+ flag_obstacle = 1;
+ return;
+ }
+
+ while(--cx)
+ {
+ if(dx>0)
+ {
+ ax+=mD0;
+ bx+=mD1;
+ dx+=si;
+ }
+ else
+ {
+ ax+=mA0;
+ bx+=mA1;
+ dx+=bp;
+ }
+
+ getPixel(ax, bx);
+
+ X = ax;
+ Y = bx;
+
+ if(flag_obstacle==0)
+ {
+ flag_obstacle = 1;
+ return;
+ }
+ }
+
+ flag_obstacle = 0;
+}
+
+void poly2(int x1, int y1, int x2, int y2)
+{
+ int dx;
+ int dy;
+
+ int mD0;
+ int mD1;
+
+ int mA0;
+ int mA1;
+
+ int bp;
+ int cx;
+ int si;
+
+ int ax;
+ int bx;
+
+ modelVar9 = x1;
+ modelVar10 = y1;
+
+ dx = x2-x1;
+ dy = y2-y1;
+
+ mD0 = mD1 = 1;
+
+ if(dx<0)
+ {
+ dx = -dx;
+ mD0 = -1;
+ }
+
+ if(dy<0)
+ {
+ dy = -dy;
+ mD1 = -1;
+ }
+
+ if(dx<dy)
+ {
+ mA0 = 0;
+ bp = dx;
+ cx = dy;
+
+ mA1 = mD1;
+ }
+ else
+ {
+ mA1 = 0;
+ bp = dy;
+ cx = dx;
+
+ mA0 = mD0;
+ }
+
+ bp=bp*2;
+ dx=bp-cx;
+ si=dx-cx;
+
+ ax = modelVar9;
+ bx = modelVar10;
+
+ getPixel(modelVar9, modelVar10);
+
+ X = modelVar9;
+ Y = modelVar10;
+
+ if(flag_obstacle!=0)
+ {
+ flag_obstacle = 1;
+ return;
+ }
+
+ while(--cx)
+ {
+ if(dx>0)
+ {
+ ax+=mD0;
+ bx+=mD1;
+ dx+=si;
+ }
+ else
+ {
+ ax+=mA0;
+ bx+=mA1;
+ dx+=bp;
+ }
+
+ getPixel(ax, bx);
+
+ X = ax;
+ Y = bx;
+
+ if(flag_obstacle!=0)
+ {
+ flag_obstacle = 1;
+ return;
+ }
+ }
+
+ flag_obstacle = 0;
+}
+
+int point_proche( int16 table[][2] )
+{
+ int x1, y1, i, x, y, p;
+ int d1=1000;
+
+ ctpVar19 = ctpVar11;
+
+ if ( nclick_noeud == 1 )
+ {
+ x = x_mouse;
+ y = y_mouse;
+ x1 = table_ptselect[0][0];
+ y1 = table_ptselect[0][1];
+
+ ctpVar19 = ctpVar15;
+
+ getPixel( x, y );
+
+ if ( !flag_obstacle )
+ {
+ ctpVar19 = ctpVar11;
+
+ getPixel( x, y );
+
+ 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;
+ }
+ }
+ 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 );
+
+ if ( !flag_obstacle && ctp_routes[i][0] > 0 )
+ {
+ d1 = ctpVar14;
+ p = i;
+ }
+ }
+ }
+
+ return ( p );
+}
+
+#define NBNOEUD 20
+
+int16 select_noeud[3];
+char solution[20+1];
+
+int prem;
+int prem2;
+int dist_chemin;
+int idsol;
+int solmax;
+
+char fl[NBNOEUD+1];
+char sol[NBNOEUD+1];
+char Fsol[NBNOEUD+1];
+
+int D;
+
+void explore( int depart, int arrivee )
+{
+ int id1, id2, i;
+
+ id1 = depart;
+
+ fl[id1]++;
+ sol[idsol++] = (char)id1;
+
+ if ( idsol > solmax )
+ {
+ fl[id1]=-1;
+ idsol--;
+
+ return;
+ }
+
+ while ( (i=fl[id1]) < 20 )
+ {
+ id2 = ctp_routes[id1][i+1];
+
+ if ( id2 == arrivee )
+ {
+ if ( idsol < solmax )
+ {
+ sol[idsol] = (char)arrivee;
+ D=0;
+ for ( i=0; i < idsol; i++ )
+ {
+ D = D+ctp_routeCoords[sol[i]][sol[i+1]];
+ Fsol[i]=sol[i];
+ }
+ prem2=0;
+ if (!prem)
+ {
+ dist_chemin = D;
+ prem = 1;
+ for ( i=0; i <= idsol; i++ )
+ {
+ solution[i] = sol[i];
+ }
+ solution[i++]=-1;
+ solution[i]=-1;
+ }
+ else if ( D < dist_chemin )
+ {
+ dist_chemin = D;
+ for ( i=0; i <= idsol; i++ )
+ {
+ solution[i] = sol[i];
+ }
+ solution[i++]=-1;
+ solution[i]=-1;
+ }
+ }
+ fl[id1]=-1;
+ idsol--;
+
+ return;
+ }
+ else if ((id2!=-1) && ((int)fl[id2]==-1) )
+ explore(id2,arrivee);
+ else if (id2==-1)
+ {
+ fl[id1]=-1;
+ idsol--;
+
+ return;
+ }
+ fl[id1]++;
+ }
+
+ fl[id1]=-1;
+ idsol--;
+}
+
+void chemin0( int depart, int arrivee )
+{
+ int i;
+ int y=30;
+
+ prem = 0;
+ prem2 = 0;
+ dist_chemin=0;
+ idsol = 0;
+ solmax=999;
+
+ for ( i=0; i < 20+1; i++ ) fl[i] = -1;
+
+ X=0,Y=30;
+
+ 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;
+
+ table[*nclick]=p;
+ table[(*nclick)+1]=-1;
+ table_ptselect[*nclick][0]=x_mouse;
+ table_ptselect[*nclick][1]=y_mouse;
+ (*nclick)++;
+ ctpVar19=ctpVar11;
+
+ 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))
+ {
+ return;
+ }
+ 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;
+
+ 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;
+
+ 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]);
+
+ 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;
+ 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];
+ }
+ 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 ******/
+
+ 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);
+ i--;
+ }
+ flag_obstacle=1;
+ if (d!=i)
+ {
+ i++;
+ for (b=d+1;b<i;b++)
+ {
+ solution0[b][0]=-2;
+ }
+ }
+ 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;
+
+ if(!polyStruct)
+ {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
+
+ return -1;
+ }
+
+ if(oldPathId >= 0)
+ {
+ if(persoTable[oldPathId])
+ {
+ freePerso(oldPathId);
+ }
+ }
+
+ if(!flagCt)
+ {
+ int i;
+ int16* ptr;
+
+ for(i=0;i<10;i++) // 10 = num perso
+ {
+ if(!persoTable[i])
+ {
+ break;
+ }
+ }
+
+ if(i == 10)
+ {
+ pSolution[0] = -1;
+ pSolution[1] = -1;
+
+ return -1;
+ }
+
+ perso = persoTable[i] = (persoStruct*)malloc(sizeof(persoStruct));
+
+ ptr = perso->solution[0];
+
+ perso->inc_jo1 = stepX;
+ perso->inc_jo2 = stepY;
+
+ *(ptr++) = X;
+ *(ptr++) = Y;
+ *(ptr++) = pSolution[0] = destX;
+ *(ptr++) = pSolution[1] = destY;
+ *(ptr++) = -1;
+
+ pSolution[4] = computedVar14;
+
+ perso->inc_droite = 0;
+ perso->inc_chemin = 0;
+
+ return i;
+ }
+
+ nclick_noeud=0;
+ ctpVar19=ctpVar11;
+ flag_aff_chemin=0;
+
+ if (X==destX && Y==destY)
+ {
+ pSolution[0]=-1;
+ pSolution[1]=-1;
+
+ return(-1);
+ }
+
+/******* cherche le premier noeud ******/
+
+ getPixel(X,Y);
+
+ pSolution[4] = computedVar14;
+
+ x_mouse = X;
+ y_mouse = Y;
+
+ if (!flag_obstacle || (point_select=point_proche(ctp_routeCoords))==-1)
+ {
+ pSolution[0]=-1;
+ pSolution[1]=-1;
+
+ return(-1);
+ }
+
+ valide_noeud(select_noeud,point_select,&nclick_noeud,NULL);
+
+ flag_aff_chemin=0;
+
+/******* cherche le deuxieme noeud ******/
+
+ num=0;
+ while ( num < 10 && persoTable[num] != NULL ) num++;
+
+ 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;
+
+ x_mouse = destX;
+ y_mouse = destY;
+
+ 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);
+ }
+
+ 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;
+
+ newf = abs(mat)-1;
+
+ zoom = subOp22(y);
+ 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);
+}
+
+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_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 */
+
+};
+
+void processActors(void)
+{
+ objectParamsQuery params;
+ int16 returnVar2[5];
+ actorStruct* currentActor = &actorHead;
+
+ while(currentActor->next)
+ {
+ currentActor = currentActor->next;
+
+ if(!currentActor->freeze && ((currentActor->type == 0) || (currentActor->type == 1)))
+ {
+ getMultipleObjectParam(currentActor->overlayNumber,currentActor->var4,¶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;
+
+ currentActor->x_dest = -1;
+ currentActor->y_dest = -1;
+
+ currentActor->flag = 1;
+ }
+
+ 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);
+
+ 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;
+ }
+ }
+
+ animationStart = 0;
+
+ 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;
+ }
+
+ 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->counter>=0) && ((currentActor->phase==ANIM_PHASE_STATIC_END) || (currentActor->phase==ANIM_PHASE_STATIC)))
+ {
+ int newA;
+ int inc = 1;
+ int t_inc = currentActor->startDirection-1;
+
+ if (t_inc<0)
+ t_inc=3;
+
+ if (currentActor->nextDirection==t_inc)
+ inc=-1;
+
+ if (inc>0)
+ newA = raoul_stat[currentActor->startDirection][currentActor->counter++];
+ else
+ newA = raoul_invstat[currentActor->startDirection][currentActor->counter++];
+
+ if (newA==0)
+ {
+ currentActor->startDirection = currentActor->startDirection+inc;
+
+ if (currentActor->startDirection>3)
+ currentActor->startDirection=0;
+
+ if (currentActor->startDirection<0)
+ currentActor->startDirection=3;
+
+ currentActor->counter=0;
+
+ if (currentActor->startDirection==currentActor->nextDirection)
+ {
+ if (currentActor->phase == ANIM_PHASE_STATIC)
+ currentActor->phase = ANIM_PHASE_MOVE;
+ else
+ currentActor->phase = ANIM_PHASE_END;
+ }
+ else
+ {
+ newA = raoul_stat[currentActor->startDirection][currentActor->counter++];
+
+ if (inc==-1)
+ newA=-newA;
+
+ set_anim(currentActor->overlayNumber,currentActor->var4,currentActor->start,params.X,params.Y,newA,currentActor->poly);
+ break;
+ }
+ }
+ else
+ {
+ set_anim(currentActor->overlayNumber,currentActor->var4,currentActor->start,params.X,params.Y,newA,currentActor->poly);
+ 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;
+
+ 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->var4,currentActor->start,currentActor->x,currentActor->y,newA,currentActor->poly);
+ break;
+ }
+
+ break;
+ }
+ case ANIM_PHASE_END:
+ {
+ int newA = raoul_end[currentActor->startDirection][0];
+
+ set_anim(currentActor->overlayNumber,currentActor->var4,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 processActors()\n", currentActor->phase);
+ // exit(1);
+ }
+ }
+ }
+ }
+ }
+}
+} // End of namespace Cruise
\ No newline at end of file
Property changes on: scummvm/trunk/engines/cruise/actor.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/actor.h
===================================================================
--- scummvm/trunk/engines/cruise/actor.h (rev 0)
+++ scummvm/trunk/engines/cruise/actor.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,74 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _ACTOR_H_
+#define _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,
+};
+
+typedef enum animPhase animPhase;
+
+struct actorStruct {
+ struct actorStruct* next;
+ struct actorStruct* prev;
+
+ int16 var4;
+ int16 type;
+ int16 overlayNumber;
+ int16 x_dest;
+ int16 y_dest;
+ int16 x;
+ int16 y;
+ int16 startDirection;
+ int16 nextDirection;
+ int16 endDirection;
+ int16 stepX;
+ int16 stepY;
+ int16 pathId;
+ animPhase phase;
+ int16 counter;
+ int16 poly;
+ int16 flag;
+ int16 start;
+ int16 freeze;
+};
+
+typedef struct actorStruct actorStruct;
+
+int16 mainProc13(int overlayIdx, int param1, actorStruct* pStartEntry, int param2);
+actorStruct* findActor(int overlayIdx, int param1, actorStruct* pStartEntry, int param2);
+void processActors(void);
+void getPixel(int x, int y);
+} // End of namespace Cruise
+
+#endif
\ No newline at end of file
Property changes on: scummvm/trunk/engines/cruise/actor.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/background.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,220 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "cruise/cruise_main.h"
+
+namespace Cruise {
+
+uint8 colorMode = 0;
+
+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[] =
+{
+ hwPage,
+};
+
+short int cvtPalette[0x20];
+
+int loadMEN(uint8** ptr)
+{
+ char* localPtr = (char*)*ptr;
+
+ if(!strcmp(localPtr,"MEN"))
+ {
+ localPtr+=4;
+
+ video4 = *(localPtr++);
+ video3 = *(localPtr++);
+ video2 = *(localPtr++);
+ colorOfSelectedSaveDrive = *(localPtr++);
+
+ *ptr = (uint8*)localPtr;
+
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+int CVTLoaded;
+
+int loadCVT(uint8** ptr)
+{
+ char* localPtr = (char*)*ptr;
+
+ if(!strcmp(localPtr,"CVT"))
+ {
+ int i;
+ localPtr+=4;
+
+ for(i=0;i<0x20;i++)
+ {
+ cvtPalette[i] = *(localPtr++);
+ }
+
+ *ptr = (uint8*)localPtr;
+
+ CVTLoaded = 1;
+
+ return 1;
+ }
+ else
+ {
+ CVTLoaded = 0;
+ return 0;
+ }
+}
+
+extern int lastFileSize;
+
+int loadBackground(char* name, int idx)
+{
+ uint8* ptr;
+ uint8* ptr2;
+ uint8* ptrToFree;
+
+ printf("Loading BG: %s\n",name);
+
+ if(!backgroundPtrtable[idx])
+ {
+ //if(!gfxModuleData.useEGA && !gfxModuleData.useVGA)
+ {
+ backgroundPtrtable[idx] = (uint8*)mallocAndZero(320*200/*64000*/);
+ }
+/* else
+ {
+ backgroundPtrtable[idx] = hwMemAddr[idx];
+ } */
+ }
+
+ 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);
+
+ return(-18);
+ }
+
+ if(lastFileSize == 32078 || lastFileSize == 32080 || lastFileSize == 32034)
+ {
+ colorMode = 0;
+ }
+ else
+ {
+ colorMode = 1;
+ }
+
+ ptr = ptrToFree;
+ ptr2 = ptrToFree;
+
+ 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;
+
+ 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_setPal((uint8*)(palette + (idx << 6)));
+ }
+ else
+ if(ptr2[1] == 8)
+ {
+ int i;
+ ptr2+=2;
+
+ for(i=0;i<256*3;i++)
+ {
+ palette[i] = ptr2[i];
+ }
+ //memcpy(palette,ptr2,256*3);
+ ptr2+=256*3;
+
+ memcpy(backgroundPtrtable[idx], ptr2, 320*200);
+
+ gfxModuleData_setPal256(palette);
+ }
+ }
+
+ //if(ptrToFree != gfxModuleData.pPage10)
+ // free(ptrToFree);
+
+ if(gfxModuleData.useEGA || gfxModuleData.useTandy)
+ {
+ ASSERT(0);
+ }
+
+ if(gfxModuleData.useEGA || gfxModuleData.useTandy)
+ {
+ ASSERT(0);
+ }
+
+ strcpy(backgroundTable[idx].name, name);
+
+ return(0);
+}
+
+} // End of namespace Cruise
Property changes on: scummvm/trunk/engines/cruise/background.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/background.h
===================================================================
--- scummvm/trunk/engines/cruise/background.h (rev 0)
+++ scummvm/trunk/engines/cruise/background.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,46 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+#ifndef _BACKGROUND_H_
+#define _BACKGROUND_H_
+
+namespace Cruise {
+
+struct backgroundTableStruct
+{
+ char name[9];
+ char extention[6];
+};
+
+typedef struct backgroundTableStruct backgroundTableStruct;
+
+extern short int cvtPalette[0x20];
+extern int CVTLoaded;
+extern uint8* backgroundPtrtable[8];
+extern backgroundTableStruct backgroundTable[8];
+
+int loadBackground(char* name, int idx);
+} // End of namespace Cruise
+
+#endif
+
Property changes on: scummvm/trunk/engines/cruise/background.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,222 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "cruise/cruise_main.h"
+
+namespace Cruise {
+
+backgroundIncrustStruct backgroundIncrustHead;
+
+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);
+ }
+
+ 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;
+
+ getMultipleObjectParam(overlayIdx,objectIdx,¶ms);
+
+ ptr = filesDatabase[params.fileIdx].subData.ptr;
+
+ if(!ptr)
+ {
+ return NULL;
+ }
+
+ if(filesDatabase[params.fileIdx].subData.resourceType != 4 && filesDatabase[params.fileIdx].subData.resourceType != 8)
+ {
+ return NULL;
+ }
+
+ backgroundPtr = backgroundPtrtable[backgroundIdx];
+
+ if(!backgroundPtr)
+ {
+ ASSERT(0);
+ return NULL;
+ }
+
+ currentHead = pHead;
+ currentHead2 = currentHead->next;
+
+ while(currentHead2)
+ {
+ currentHead = currentHead2;
+ currentHead2 = currentHead->next;
+ }
+
+ newElement = (backgroundIncrustStruct*)mallocAndZero(sizeof(backgroundIncrustStruct));
+
+ if(!newElement)
+ return NULL;
+
+ newElement->next = currentHead->next;
+ currentHead->next = newElement;
+
+ if(!currentHead2)
+ {
+ currentHead2 = pHead;
+ }
+
+ 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);
+
+ 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;
+
+ 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 );
+ }
+
+ return newElement;
+}
+
+void loadBackgroundIncrustFromSave(FILE* fileHandle)
+{
+ int16 numEntry;
+ backgroundIncrustStruct* ptr1;
+ backgroundIncrustStruct* ptr2;
+ int32 i;
+
+ fread(&numEntry,2,1,fileHandle);
+
+ ptr1 = &backgroundIncrustHead;
+ ptr2 = &backgroundIncrustHead;
+
+ for(i=0;i<numEntry;i++)
+ {
+ backgroundIncrustStruct* current = (backgroundIncrustStruct*)mallocAndZero(sizeof(backgroundIncrustStruct));
+
+ fseek(fileHandle, 4, SEEK_CUR);
+
+ 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);
+
+ 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 freeBackgroundIncrustList(backgroundIncrustStruct* pHead)
+{
+ backgroundIncrustStruct* pCurrent = pHead->next;
+
+ while(pCurrent)
+ {
+ backgroundIncrustStruct* pNext = pCurrent->next;
+
+ if(pCurrent->ptr)
+ {
+ free(pCurrent->ptr);
+ }
+
+ free(pCurrent);
+
+ pCurrent = pNext;
+ }
+
+ resetBackgroundIncrustList(pHead);
+}
+
+} // End of namespace Cruise
Property changes on: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/backgroundIncrust.h
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.h (rev 0)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,66 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _BACKGROUNDINCRUST_H_
+#define _BACKGROUNDINCRUST_H_
+
+namespace Cruise {
+
+struct backgroundIncrustStruct {
+ struct backgroundIncrustStruct* next;
+ struct backgroundIncrustStruct* prev;
+
+ uint16 objectIdx;
+ uint16 field_6;
+ uint16 overlayIdx;
+ uint16 X;
+ uint16 Y;
+ uint16 field_E;
+ uint16 scale;
+ uint16 backgroundIdx;
+ uint16 scriptNumber;
+ uint16 scriptOverlayIdx;
+ uint8* ptr;
+ int32 field_1C;
+ int16 size;
+ uint16 field_22;
+ uint16 field_24;
+ char name[14];
+ uint16 var34;
+};
+
+typedef struct backgroundIncrustStruct backgroundIncrustStruct;
+
+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);
+
+} // End of namespace Cruise
+
+#endif
+
Property changes on: scummvm/trunk/engines/cruise/backgroundIncrust.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/cruise.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/cruise.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,111 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+#include "common/file.h"
+#include "common/fs.h"
+#include "common/savefile.h"
+#include "common/config-manager.h"
+#include "common/system.h"
+
+#include "graphics/cursorman.h"
+
+#include "sound/mididrv.h"
+#include "sound/mixer.h"
+
+#include "cruise/cruise.h"
+
+namespace Cruise {
+
+//SoundDriver *g_soundDriver;
+//SfxPlayer *g_sfxPlayer;
+Common::SaveFileManager *g_saveFileMan;
+
+CruiseEngine *g_cruise;
+
+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"));
+
+ g_cruise = this;
+}
+
+CruiseEngine::~CruiseEngine() {
+}
+
+int CruiseEngine::init() {
+ // Detect game
+ if (!initGame()) {
+ GUIErrorMessage("No valid games were found in the specified directory.");
+ return -1;
+ }
+
+ // Initialize backend
+ _system->beginGFXTransaction();
+ initCommonGFX(false);
+ _system->initSize(320, 200);
+ _system->endGFXTransaction();
+
+ initialize();
+
+ return 0;
+}
+
+int CruiseEngine::go() {
+ CursorMan.showMouse(true);
+
+ Cruise::mainLoop();
+
+ return 0;
+}
+
+
+void CruiseEngine::initialize() {
+
+ fadeVar = 0;
+ ptr_something = (ctpVar19Struct*)mallocAndZero(sizeof(ctpVar19Struct)*0x200);
+
+ /*volVar1 = 0;
+ fileData1 = 0;*/
+
+ /*PAL_fileHandle = -1;*/
+
+ // video init stuff
+
+ loadSystemFont();
+
+ // another bit of video init
+
+ readVolCnf();
+
+}
+
+} // End of namespace Cruise
Property changes on: scummvm/trunk/engines/cruise/cruise.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/cruise.h
===================================================================
--- scummvm/trunk/engines/cruise/cruise.h (rev 0)
+++ scummvm/trunk/engines/cruise/cruise.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,107 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CruisE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef CRUISE_H
+#define CRUISE_H
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/util.h"
+
+#include "engines/engine.h"
+
+#include "cruise/cruise_main.h"
+
+namespace Cruise {
+
+enum CruiseGameType {
+ GType_CRUISE = 1
+};
+
+struct CRUISEGameDescription;
+
+class CruiseEngine : public Engine {
+
+protected:
+ int init();
+ int go();
+ void shutdown();
+
+ bool initGame();
+
+public:
+ CruiseEngine(OSystem *syst);
+ virtual ~CruiseEngine();
+
+ int getGameType() const;
+ uint32 getFeatures() const;
+ Common::Language getLanguage() const;
+ Common::Platform getPlatform() const;
+
+ bool loadSaveDirectory(void);
+ void makeSystemMenu(void);
+
+ const CRUISEGameDescription *_gameDescription;
+
+private:
+ void initialize(void);
+ bool makeLoad(char *saveName);
+ void mainLoop(int bootScriptIdx);
+
+ bool _preLoad;
+};
+
+extern CruiseEngine *g_cruise;
+
+#define BOOT_PRC_NAME "AUTO00.PRC"
+
+enum {
+ VAR_MOUSE_X_MODE = 253,
+ VAR_MOUSE_X_POS = 249,
+ VAR_MOUSE_Y_MODE = 251,
+ VAR_MOUSE_Y_POS = 250
+};
+
+enum {
+ MOUSE_CURSOR_NORMAL = 0,
+ MOUSE_CURSOR_DISK,
+ MOUSE_CURSOR_CROSS
+};
+
+enum {
+ kCruiseDebugScript = 1 << 0
+};
+
+enum {
+ kCmpEQ = (1 << 0),
+ kCmpGT = (1 << 1),
+ kCmpLT = (1 << 2)
+};
+
+
+extern Common::SaveFileManager *g_saveFileMan; // TEMP
+
+} // End of namespace Cruise
+
+#endif
Property changes on: scummvm/trunk/engines/cruise/cruise.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,1688 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+#include "common/events.h"
+
+#include "cruise/cruise_main.h"
+#include <time.h>
+
+namespace Cruise {
+
+unsigned int timer = 0;
+
+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;
+ }
+ }
+}
+
+void drawBlackSolidBoxSmall()
+{
+// gfxModuleData.drawSolidBox(64,100,256,117,0);
+ drawSolidBox(64,100,256,117,0);
+}
+
+void resetRaster(uint8* rasterPtr, int32 rasterSize)
+{
+ memset(rasterPtr,0,rasterSize);
+}
+
+
+void drawInfoStringSmallBlackBox(uint8* string)
+{
+ //uint8 buffer[256];
+
+ gfxModuleData_field_90();
+ gfxModuleData_gfxWaitVSync();
+ drawBlackSolidBoxSmall();
+
+ drawString(10,100,string,gfxModuleData.pPage10,video4,300);
+
+ gfxModuleData_flip();
+
+ flipScreen();
+
+ while(1);
+}
+
+void loadPakedFileToMem(int fileIdx, uint8* buffer)
+{
+ //changeCursor(1);
+
+ 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);
+
+ ptr2 = overlayTable[scriptIdx].ovlData->objDataTable;
+
+ if(!ptr2)
+ return(0);
+
+ if(overlayTable[scriptIdx].ovlData->numObjData==0)
+ return(0);
+
+ counter = 0;
+
+ 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;
+
+ flipShort((int16*)ptr);
+}
+
+int16 loadShort(void* ptr)
+{
+ short int temp;
+
+ temp = *(int16*)ptr;
+
+ flipShort(&temp);
+
+ return(temp);
+}
+
+
+void resetFileEntryRange(int param1, int param2)
+{
+ int 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];
+
+ if(!overlayTable[overlayIdx].alreadyLoaded)
+ return 0;
+
+ if(!overlayTable[overlayIdx].ovlData)
+ return 0;
+
+ numExport = overlayTable[overlayIdx].ovlData->numExport;
+ exportDataPtr = overlayTable[overlayIdx].ovlData->exportDataPtr;
+ exportNamePtr = overlayTable[overlayIdx].ovlData->exportNamesPtr;
+
+ if(!exportNamePtr)
+ return 0;
+
+ 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);
+ }
+ }
+ }
+
+ 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;
+ }
+
+ pScriptInstance = pScriptInstance->nextScriptPtr;
+ }
+}
+
+
+void initBigVar3()
+{
+ int i;
+
+ 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.index = -1;
+ filesDatabase[i].subData.resourceType = 0;
+ }
+}
+
+void resetPtr2(scriptInstanceStruct* ptr)
+{
+ ptr->nextScriptPtr = NULL;
+ ptr->scriptNumber = -1;
+}
+
+void resetPtr(objectStruct* 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;
+
+ if(!ovlData)
+ {
+ return NULL;
+ }
+
+ if(param<0)
+ {
+ return NULL;
+ }
+
+ if(ovlData->numScripts1 <= param)
+ {
+ return NULL;
+ }
+
+ if(!ovlData->data3Table)
+ {
+ return NULL;
+ }
+
+ return(&ovlData->data3Table[param]);
+}
+
+ovlData3Struct* scriptFunc1Sub2(int32 scriptNumber, int32 param)
+{
+ ovlDataStruct* ovlData = overlayTable[scriptNumber].ovlData;
+
+ if(!ovlData)
+ {
+ return NULL;
+ }
+
+ if(param<0)
+ {
+ return NULL;
+ }
+
+ if(ovlData->numScripts2 <= param)
+ {
+ return NULL;
+ }
+
+ if(!ovlData->ptr1)
+ {
+ return NULL;
+ }
+
+ 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;
+ }
+ }
+ }
+}
+
+uint8* getDataFromData3(ovlData3Struct* ptr, int param)
+{
+ uint8* dataPtr;
+
+ if(!ptr)
+ return(NULL);
+
+ dataPtr = ptr->dataPtr;
+
+ 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(char* string)
+{
+}
+
+void waitForPlayerInput()
+{
+}
+
+void getFileExtention(const char* name,char* buffer)
+{
+ while(*name != '.' && *name)
+ {
+ name++;
+ }
+
+ strcpy(buffer,name);
+}
+
+void removeExtention(const char* name, char* buffer) // not like in original
+{
+ char* ptr;
+
+ strcpy(buffer,name);
+
+ 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);
+ }
+ }
+ }
+
+ getFileExtention((char*)name,buffer);
+
+ if(!strcmp(buffer,".SPL"))
+ {
+ removeExtention((char*)name,buffer);
+
+ // if(useH32)
+ {
+ strcatuint8(buffer,".H32");
+ }
+ /* else
+ if(useAdlib)
+ {
+ strcatuint8(buffer,".ADL");
+ }
+ else
+ {
+ strcatuint8(buffer,".HP");
+ }*/
+ }
+ else
+ {
+ strcpyuint8(buffer,name);
+ }
+
+ fileIdx = findFileInDisks((uint8*)buffer);
+
+ if(fileIdx<0)
+ return(-18);
+
+ unpackedSize = loadFileVar1 = volumePtrToFileDescriptor[fileIdx].extSize + 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);
+
+ loadPakedFileToMem(fileIdx,pakedBuffer);
+
+ realUnpackedSize = *(uint16*)(pakedBuffer+volumePtrToFileDescriptor[fileIdx].size-2);
+ flipShort((int16*)&realUnpackedSize);
+
+ lastFileSize = realUnpackedSize;
+
+ tempBuffer = (uint8*)mallocAndZero(realUnpackedSize);
+
+ decomp((uint8*)pakedBuffer+volumePtrToFileDescriptor[fileIdx].size-4,(uint8*)unpackedBuffer+realUnpackedSize,realUnpackedSize);
+
+ free(pakedBuffer);
+ }
+ else
+ {
+ loadPakedFileToMem(fileIdx,unpackedBuffer);
+ }
+
+ *ptr = unpackedBuffer;
+
+ return(1);
+}
+
+void resetFileEntry(int32 entryNumber)
+{
+ if(entryNumber>=257)
+ return;
+
+ if(!filesDatabase[entryNumber].subData.ptr)
+ return;
+
+ 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;
+
+}
+
+uint8* mainProc14(uint16 overlay, uint16 idx)
+{
+ ASSERT(0);
+
+ return NULL;
+}
+
+int initAllData(void)
+{
+ int i;
+
+ setupFuncArray();
+ setupOpcodeTable();
+ initOverlayTable();
+
+ setup1 = 0;
+ currentActiveBackgroundPlane = 0;
+
+ freeDisk();
+
+ initVar5[0] = -1;
+ initVar5[3] = -1;
+ initVar5[6] = -1;
+ initVar5[9] = -1;
+
+ menuTable[0] = NULL;
+
+ for(i=0;i<2000;i++)
+ {
+ globalVars[i] = 0;
+ }
+
+ for(i=0;i<8;i++)
+ {
+ backgroundTable[i].name[0] = 0;
+ }
+
+ for(i=0;i<257;i++)
+ {
+ filesDatabase[i].subData.ptr = NULL;
+ filesDatabase[i].subData.ptr2 = NULL;
+ }
+
+ initBigVar3();
+
+ resetPtr2(&scriptHandle2);
+ resetPtr2(&scriptHandle1);
+
+ resetPtr(&objectHead);
+
+ resetActorPtr(&actorHead);
+ resetBackgroundIncrustList(&backgroundIncrustHead);
+
+ bootOverlayNumber = loadOverlay((uint8*)"AUTO00");
+
+#ifdef DUMP_SCRIPT
+ loadOverlay("TITRE");
+ loadOverlay("TOM");
+ loadOverlay("XX2");
+ loadOverlay("SUPER");
+ loadOverlay("BEBE1");
+ loadOverlay("BIBLIO");
+ loadOverlay("BRACAGE");
+ loadOverlay("CONVERS");
+ loadOverlay("DAF");
+ loadOverlay("DAPHNEE");
+ loadOverlay("DESIRE");
+ loadOverlay("FAB");
+ loadOverlay("FABIANI");
+ loadOverlay("FIN");
+ loadOverlay("FIN01");
+ loadOverlay("FINBRAC");
+ loadOverlay("GEN");
+ loadOverlay("GENDEB");
+ loadOverlay("GIFLE");
+ loadOverlay("HECTOR");
+ loadOverlay("HECTOR2");
+ loadOverlay("I00");
+ loadOverlay("I01");
+ loadOverlay("I04");
+ loadOverlay("I06");
+ loadOverlay("I07");
+ loadOverlay("INVENT");
+ loadOverlay("JULIO");
+ loadOverlay("LOGO");
+ loadOverlay("MANOIR");
+ loadOverlay("MISSEL");
+ loadOverlay("POKER");
+ loadOverlay("PROJ");
+ loadOverlay("REB");
+ loadOverlay("REBECCA");
+ loadOverlay("ROS");
+ loadOverlay("ROSE");
+ loadOverlay("S01");
+ loadOverlay("S02");
+ loadOverlay("S03");
+ loadOverlay("S04");
+ loadOverlay("S06");
+ loadOverlay("S07");
+ loadOverlay("S08");
+ loadOverlay("S09");
+ loadOverlay("S10");
+ loadOverlay("S103");
+ loadOverlay("S11");
+ loadOverlay("S113");
+ loadOverlay("S12");
+ loadOverlay("S129");
+ loadOverlay("S131");
+ loadOverlay("S132");
+ loadOverlay("S133");
+ loadOverlay("int16");
+ loadOverlay("S17");
+ loadOverlay("S18");
+ loadOverlay("S19");
+ loadOverlay("S20");
+ loadOverlay("S21");
+ loadOverlay("S22");
+ loadOverlay("S23");
+ loadOverlay("S24");
+ loadOverlay("S25");
+ loadOverlay("S26");
+ loadOverlay("S27");
+ loadOverlay("S29");
+ loadOverlay("S30");
+ loadOverlay("S31");
+ loadOverlay("int32");
+ loadOverlay("S33");
+ loadOverlay("S33B");
+ loadOverlay("S34");
+ loadOverlay("S35");
+ loadOverlay("S36");
+ loadOverlay("S37");
+ loadOverlay("SHIP");
+ loadOverlay("SUPER");
+ loadOverlay("SUZAN");
+ loadOverlay("SUZAN2");
+ loadOverlay("TESTA1");
+ loadOverlay("TESTA2");
+ //exit(1);
+#endif
+
+ if(bootOverlayNumber)
+ {
+ positionInStack = 0;
+
+ attacheNewScriptToTail(bootOverlayNumber,&scriptHandle2,0,20,0,0,scriptType_20);
+ scriptFunc2(bootOverlayNumber,&scriptHandle2,1,0);
+ }
+
+ strcpyuint8(systemStrings.bootScriptName,"AUTO00");
+
+ return(bootOverlayNumber);
+}
+
+int removeFinishedScripts(scriptInstanceStruct* ptrHandle)
+{
+ scriptInstanceStruct* ptr = ptrHandle->nextScriptPtr; // can't destruct the head
+ scriptInstanceStruct* oldPtr = ptrHandle;
+
+ if(!ptr)
+ return(0);
+
+ do
+ {
+ if(ptr->scriptNumber == -1)
+ {
+ oldPtr->nextScriptPtr = ptr->nextScriptPtr;
+
+ if(ptr->var6 && ptr->varA)
+ {
+ // free(ptr->var6);
+ }
+
+ free(ptr);
+
+ 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;
+// int16 var_42;
+ int16 var_A;
+ int16 var_6;
+
+ char objectName[80];
+
+ objectStruct* currentObject = objectHead.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));
+
+ if(strlen(objectName))
+ {
+ if(currentObject->hide == 0)
+ {
+ var_2 = currentObject->idx;
+ var_4 = currentObject->overlay;
+ var_14 = currentObject->followObjectIdx;
+ var_16 = currentObject->followObjectOverlayIdx;
+
+ getMultipleObjectParam(currentObject->overlay, currentObject->idx, ¶ms);
+
+ var_10 = 0;
+ var_E = 0;
+ var_C = 0;
+
+ if((var_4 != var_16) && (var_2 != var_14))
+ {
+ objectParamsQuery params;
+ getMultipleObjectParam(var_16, var_14, ¶ms);
+
+ 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);
+
+ 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;
+
+ 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;
+
+ if(var_4 == 1)
+ {
+ var_C = filesDatabase[di].widthInColumn/2;
+ }
+ else
+ {
+ var_C = filesDatabase[di].width;
+ }
+
+ var_8 = filesDatabase[di].height;
+
+ 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
+ {
+ }
+
+ printf("should compare to mask in getCursorFromObject...\n");
+
+ *outX = var_16;
+ *outY = var_14;
+
+ printf("Selected: %s\n", objectName);
+
+ return currentObject->type;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ currentObject = currentObject->prev;
+ }
+
+ *outX = 0;
+ *outY = 0;
+
+ return -1;
+}
+
+char keyboardVar = 0;
+
+void freeStuff2(void)
+{
+ printf("implement freeStuff2\n");
+}
+
+void *allocAndZero(int size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ memset(ptr,0,size);
+
+ return ptr;
+}
+
+char* getObjectName(int index, uint8* string)
+{
+ int i;
+ char* ptr = (char*)string;
+
+ if(!string)
+ return NULL;
+
+ for(i=0;i<index;i++)
+ {
+ while(*ptr)
+ {
+ ptr++;
+ }
+ ptr++;
+ }
+ return ptr;
+}
+
+int buildInventorySub1(int overlayIdx, int objIdx)
+{
+ objDataStruct* pObjectData = getObjectDataFromOverlay(overlayIdx, objIdx);
+
+ if(pObjectData)
+ {
+ return pObjectData->var1;
+ }
+ else
+ {
+ return -11;
+ }
+}
+
+void buildInventory(int X, int Y)
+{
+ int numObjectInInventory;
+ menuStruct* pMenu;
+
+ pMenu = createMenu(X, Y, "Inventaire");
+
+ menuTable[1] = pMenu;
+
+ if(pMenu)
+ {
+ numObjectInInventory = 0;
+
+ if(numOfLoadedOverlay > 1)
+ {
+ int i;
+
+ for(i=1;i<numOfLoadedOverlay;i++)
+ {
+ ovlDataStruct* pOvlData = overlayTable[i].ovlData;
+
+ if(pOvlData && pOvlData->objDataTable)
+ {
+ int var_2;
+
+ var_2 = 0;
+
+ if(pOvlData->numObjData)
+ {
+ int j;
+
+ for(j=0;j<pOvlData->numObjData;j++)
+ {
+ if(buildInventorySub1(i,j) != 3)
+ {
+ int16 returnVar;
+
+ getSingleObjectParam(i,j,5,&returnVar);
+
+ if(returnVar<-1)
+ {
+ addSelectableMenuEntry(i,j,pMenu,1,-1,getObjectName(j, pOvlData->specialString2));
+ numObjectInInventory++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(numObjectInInventory == 0)
+ {
+ freeMenu(menuTable[1]);
+ menuTable[1] = NULL;
+ }
+}
+
+int currentMenuElementX;
+int currentMenuElementY;
+menuElementStruct* currentMenuElement;
+
+menuElementSubStruct* getSelectedEntryInMenu(menuStruct* pMenu)
+{
+ menuElementStruct* pMenuElement;
+
+ if(pMenu == NULL)
+ {
+ return NULL;
+ }
+
+ if(pMenu->numElements == 0)
+ {
+ return NULL;
+ }
+
+ pMenuElement = pMenu->ptrNextElement;
+
+ while(pMenuElement)
+ {
+ if(pMenuElement->varC)
+ {
+ currentMenuElementX = pMenuElement->x;
+ currentMenuElementY = pMenuElement->y;
+ currentMenuElement = pMenuElement;
+
+ return pMenuElement->ptrSub;
+ }
+
+ pMenuElement = pMenuElement->next;
+ }
+
+ return NULL;
+}
+
+int callInventoryObject(int param0, int param1, int x, int y)
+{
+ int var_2C;
+ int var_30;
+ int var_28;
+ int var_1E;
+ int16 returnVar;
+
+ var_30 = -1;
+
+ getSingleObjectParam(param0,param1,5,&returnVar);
+
+ var_2C = 0;
+ var_28 = 1;
+
+ for(var_1E=1;var_1E<numOfLoadedOverlay;var_1E++)
+ {
+ ovlDataStruct* var_2A = overlayTable[var_1E].ovlData;
+ if(var_2A->ptr1)
+ {
+ int var_18;
+ int var_14;
+
+ var_18 = var_2A->numLinkData;
+
+ if(var_18)
+ {
+ int var_16;
+
+ var_16 = 0;
+
+ for(var_14 = 0; var_14 < var_18;var_14++)
+ {
+ objDataStruct* pObject;
+ linkDataStruct* var_34;
+ int var_2;
+
+ var_34 = &var_2A->linkDataPtr[var_14];
+
+ var_2 = var_34->stringIdx;
+
+ if(!var_2)
+ {
+ var_2 = var_1E;
+ }
+
+ pObject = getObjectDataFromOverlay(var_2,var_34->stringNameOffset);
+
+ if(var_2 == param0)
+ {
+ if(param1 == var_34->stringNameOffset)
+ {
+ if(pObject)
+ {
+ if(pObject->var1 != 3)
+ {
+ char var_214[80];
+ char var_1C4[80];
+ char var_174[80];
+ char var_124[80];
+ char var_D4[80];
+ char var_84[80];
+
+ ovlDataStruct* var_12;
+ ovlDataStruct* var_22;
+
+ int var_E = var_34->varIdx;
+ int cx = var_34->stringIdx;
+ int var_C = var_34->procIdx;
+
+ int di = var_E;
+ if(var_E == 0)
+ di = var_1E;
+
+ var_2 = cx;
+ if(cx == 0)
+ var_2 = var_1E;
+
+ if(var_C == 0)
+ var_C = var_1E;
+
+ var_12 = NULL;
+ var_22 = NULL;
+
+ var_214[0] = 0;
+ var_1C4[0] = 0;
+ var_174[0] = 0;
+ var_124[0] = 0;
+ var_D4[0] = 0;
+ var_84[0] = 0;
+
+ if(di>0)
+ {
+ var_22 = overlayTable[di].ovlData;
+ }
+
+ if(var_2>0)
+ {
+ var_12 = overlayTable[var_2].ovlData;
+ }
+
+ if(var_12)
+ {
+ if(var_34->stringNameOffset)
+ {
+ var_30 = var_34->field_1A;
+ if(var_28)
+ {
+ if(var_12->specialString2)
+ {
+ if(var_30==-1 || var_30 == returnVar)
+ {
+ char* ptrName = getObjectName(var_34->stringNameOffset, var_12->specialString2);
+
+ menuTable[0] = createMenu(x,y,ptrName);
+ var_28 = 0;
+ }
+ }
+ }
+ }
+ }
+
+ if(var_22)
+ {
+ if(var_34->varNameOffset>=0)
+ {
+ if(var_22->specialString1)
+ {
+ char* ptr = getObjectName(var_34->varNameOffset, var_22->specialString1);
+
+ strcpy(var_214, ptr);
+
+ if(var_28 == 0)
+ {
+ if(var_30 ==-1 || var_30 == returnVar)
+ {
+ if(strlen(var_214))
+ {
+ attacheNewScriptToTail(var_1E,&scriptHandle1,var_34->field_2, 30, currentScriptPtr->scriptNumber,currentScriptPtr->overlayNumber, scriptType_30);
+ }
+ else
+ {
+ if(var_22->specialString1)
+ {
+ char* ptr = getObjectName(var_34->varNameOffset, var_22->specialString1);
+
+ var_2C = 1;
+
+ addSelectableMenuEntry(var_1E, var_14, menuTable[0], 1, -1, ptr);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return var_2C;
+}
+
+int processInventory(void)
+{
+ if(menuTable[1])
+ {
+ menuElementSubStruct* pMenuElementSub = getSelectedEntryInMenu(menuTable[1]);
+
+ if(pMenuElementSub)
+ {
+ int var2;
+ int var4;
+
+ var2 = pMenuElementSub->var2;
+ var4 = pMenuElementSub->var4;
+
+ freeMenu(menuTable[1]);
+ menuTable[1] = NULL;
+
+ callInventoryObject(var2, var4, currentMenuElementX+80, currentMenuElementY);
+
+ return 1;
+ }
+ else
+ {
+ freeMenu(menuTable[1]);
+ menuTable[1] = NULL;
+ }
+ }
+
+ return 0;
+}
+
+int processInput(void)
+{
+ menuStruct* var_5C;
+
+ int16 mouseX;
+ int16 mouseY;
+ int16 button;
+
+ /*if(inputSub1keyboad())
+ {
+ return 1;
+ }*/
+
+ button = 0;
+
+ if(sysKey != -1)
+ {
+ button = sysKey;
+ mouseX = var11;
+ mouseY = var12;
+ sysKey = -1;
+ }
+ else
+ {
+ if(automaticMode == 0)
+ {
+ getMouseStatus(&main10, &mouseX, &button, &mouseY);
+ }
+ }
+
+ if(button)
+ {
+ nePasAffichierMenuDialogue = 0;
+ }
+
+ if(userDelay)
+ {
+ userDelay--;
+ return 0;
+ }
+
+ // test both buttons
+
+ if(((button&3) == 3) || keyboardVar == 0x44 || keyboardVar == 0x53)
+ {
+ changeCursor(0);
+ keyboardVar = 0;
+ return(playerMenu(mouseX, mouseY));
+ }
+
+ if(!userEnabled)
+ {
+ return 0;
+ }
+
+ if(currentActiveMenu != -1)
+ {
+ var_5C = menuTable[currentActiveMenu];
+
+ if(var_5C)
+ {
+ updateMenuMouse(mouseX,mouseY,var_5C);
+ }
+ }
+
+ if(var6)
+ {
+ ASSERT(0);
+ }
+
+ if(button & 1)
+ {
+ if(nePasAffichierMenuDialogue == 0)
+ {
+ nePasAffichierMenuDialogue = 1;
+
+ if(mouseVar1)
+ {
+ ASSERT(0);
+ }
+
+ if(var38 == 0) // are we in inventory mode ?
+ {
+ if(menuTable[0] == 0)
+ {
+ int X;
+ int Y;
+ int objIdx;
+
+ objIdx = getCursorFromObject(mouseX, mouseY, &X, &Y);
+
+ if(objIdx != -1)
+ {
+ //ASSERT(0);
+ //moveActor(X,Y,mouseVar1);
+ }
+ else
+ {
+ var34 = mouseX;
+ var35 = mouseY;
+ animationStart=true;
+ var38=0;
+ }
+ }
+ //ASSERT(0);
+ }
+ else
+ {
+ if(processInventory())
+ {
+ var37 = 1;
+ currentActiveMenu = 0;
+ var38 = 0;
+ }
+ else
+ {
+ currentActiveMenu = -1;
+ var38 = 0;
+ }
+
+ return 0;
+ }
+
+ //ASSERT(0);
+ }
+ }
+
+ if((button & 2) || (keyboardVar == 0x43) || (keyboardVar == 0x52))
+ {
+ if(nePasAffichierMenuDialogue == 0)
+ {
+ keyboardVar = 0;
+
+ if((mouseVar1 == 0) && (menuTable[0]))
+ {
+ ASSERT(0);
+ freeMenu(menuTable[0]);
+ menuTable[0] = NULL;
+ var37 = 0;
+ var38 = 0;
+ currentActiveMenu = -1;
+ }
+
+ if(var37 || var38 || menuTable[1])
+ {
+ nePasAffichierMenuDialogue = 1;
+ return 0;
+ }
+
+ buildInventory(mouseX, mouseY);
+
+ if(menuTable[1])
+ {
+ currentActiveMenu = 1;
+ var38 = 1;
+ }
+ else
+ {
+ var38 = 1;
+ }
+
+ nePasAffichierMenuDialogue = 1;
+ return 0;
+ }
+ }
+ return 0;
+}
+
+int oldMouseX;
+int oldMouseY;
+
+void manageEvents(int count) {
+ Common::Event event;
+
+ Common::EventManager *eventMan = g_system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ /* case Common::EVENT_LBUTTONDOWN:
+ mouseLeft = 1;
+ break;
+ case Common::EVENT_RBUTTONDOWN:
+ mouseRight = 1;
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ break;*/
+ case Common::EVENT_QUIT:
+ g_system->quit();
+ break;
+ /* case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case '\n':
+ case '\r':
+ case 261: // Keypad 5
+ if (allowPlayerInput) {
+ mouseLeft = 1;
+ }
+ break;
+ case 27: // ESC
+ if (allowPlayerInput) {
+ mouseRight = 1;
+ }
+ break;
+ case 282: // F1
+ if (allowPlayerInput) {
+ playerCommand = 0; // EXAMINE
+ makeCommandLine();
+ }
+ break;
+ case 283: // F2
+ if (allowPlayerInput) {
+ playerCommand = 1; // TAKE
+ makeCommandLine();
+ }
+ break;
+ case 284: // F3
+ if (allowPlayerInput) {
+ playerCommand = 2; // INVENTORY
+ makeCommandLine();
+ }
+ break;
+ case 285: // F4
+ if (allowPlayerInput) {
+ playerCommand = 3; // USE
+ makeCommandLine();
+ }
+ break;
+ case 286: // F5
+ if (allowPlayerInput) {
+ playerCommand = 4; // ACTIVATE
+ makeCommandLine();
+ }
+ break;
+ case 287: // F6
+ if (allowPlayerInput) {
+ playerCommand = 5; // SPEAK
+ makeCommandLine();
+ }
+ break;
+ case 290: // F9
+ if (allowPlayerInput && !inMenu) {
+ makeActionMenu();
+ makeCommandLine();
+ }
+ break;
+ case 291: // F10
+ if (!disableSystemMenu && !inMenu) {
+ g_cine->makeSystemMenu();
+ }
+ break;
+ default:
+ //lastKeyStroke = event.kbd.keycode;
+ break;
+ }
+ break; */
+ default:
+ break;
+ }
+ }
+
+ /*if (count) {
+ mouseData.left = mouseLeft;
+ mouseData.right = mouseRight;
+ mouseLeft = 0;
+ mouseRight = 0;
+ }
+*/
+ int i;
+
+ for (i = 0; i < count; i++) {
+ //FIXME(?): Maybe there's a better way to "fix" this?
+ //
+ //Since not all backends/ports can update the screen
+ //100 times per second, only update the screen every
+ //other frame (1000 / 2 * 10 i.e. 50 times per second max.)
+ if (i % 2)
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ manageEvents(0);
+ }
+}
+
+void mainLoop(void)
+{
+ #define SPEED 40 /* Ticks per Frame */
+ #define SLEEP_MIN 20 /* Minimum time a sleep takes, usually 2*GRAN */
+ #define SLEEP_GRAN 1 /* Granularity of sleep */
+
+ int frames=0; /* Number of frames displayed */
+ int32 t_start,t_left;
+ uint32 t_end;
+ int32 q=0; /* Dummy */
+
+ int enableUser = 0;
+ int16 mouseX;
+ int16 mouseY;
+ int16 mouseButton;
+
+ scriptNameBuffer[0] = 0;
+ systemStrings.bootScriptName[0] = 0;
+ initVar4[0] = 0;
+ currentActiveMenu = -1;
+ main14 = -1;
+ mouseVar1 = 0;
+ main21 = 0;
+ main22 = 0;
+ main7 = 0;
+ main8 = 0;
+ main15 = 0;
+
+ if(initAllData())
+ {
+ int playerDontAskQuit = 1;
+ int quitValue2 = 1;
+ int quitValue = 0;
+
+ do
+ {
+ frames++;
+// t_start=Osystem_GetTicks();
+
+// readKeyboard();
+ playerDontAskQuit = processInput();
+
+ //if(enableUser)
+ {
+ userEnabled = 1;
+ enableUser = 0;
+ }
+
+ manageScripts(&scriptHandle1);
+ manageScripts(&scriptHandle2);
+
+ removeFinishedScripts(&scriptHandle1);
+ removeFinishedScripts(&scriptHandle2);
+
+ processActors();
+
+ if(var0)
+ {
+ ASSERT(0);
+ /* main3 = 0;
+ var24 = 0;
+ var23 = 0;
+
+ freeStuff2(); */
+ }
+
+ if(initVar4[0])
+ {
+ ASSERT(0);
+/* redrawStrings(0,&initVar4,8);
+
+ waitForPlayerInput();
+
+ initVar4 = 0; */
+ }
+
+ if(affichePasMenuJoueur)
+ {
+ if(main5)
+ fadeVar = 0;
+
+ /*if(fadeVar)
+ {
+ // TODO!
+ }*/
+
+ mainDraw(0);
+ flipScreen();
+
+ /* if(userEnabled && !main7 && !main15 && currentActiveMenu == -1)
+ {
+ getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
+
+ if(mouseX != oldMouseX && mouseY != oldMouseY)
+ {
+ int cursorType;
+ int newCursor1;
+ int newCursor2;
+
+ oldMouseX = mouseX;
+ oldMouseY = mouseY;
+
+ cursorType = getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2);
+
+ if(cursorType == 9)
+ {
+ changeCursor(5);
+ }
+ else
+ if(cursorType == -1)
+ {
+ changeCursor(6);
+ }
+ else
+ {
+ changeCursor(4);
+ }
+
+ }
+ }
+ else*/
+ {
+ changeCursor(0);
+ }
+
+ if(main7)
+ {
+ ASSERT(0);
+ }
+
+ if(main15)
+ {
+ ASSERT(0);
+ }
+
+ if(main14 != -1)
+ {
+ ASSERT(0);
+ }
+ }
+
+ // t_end = t_start+SPEED;
+// t_left=t_start-Osystem_GetTicks()+SPEED;
+#ifndef FASTDEBUG
+ /* if(t_left>0)
+ if(t_left>SLEEP_MIN)
+ Osystem_Delay(t_left-SLEEP_GRAN);
+ while(Osystem_GetTicks()<t_end){q++;}; */
+#endif
+ manageEvents(4);
+
+ }while(!playerDontAskQuit && quitValue2 && quitValue != 7);
+ }
+
+}
+
+int oldmain(int argc, char* argv[])
+{
+ printf("Cruise for a corpse recode\n");
+
+// OSystemInit();
+// osystem = new OSystem;
+
+ printf("Osystem Initialized\n");
+
+ printf("Initializing engine...\n");
+
+// initBuffer(scaledScreen,640,400);
+
+ fadeVar = 0;
+
+ //lowLevelInit();
+
+ // arg parser stuff
+
+ ptr_something = (ctpVar19Struct*)mallocAndZero(sizeof(ctpVar19Struct)*0x200);
+
+ /*volVar1 = 0;
+ fileData1 = 0;*/
+
+ /*PAL_fileHandle = -1;*/
+
+ // video init stuff
+
+ loadSystemFont();
+
+ // another bit of video init
+
+ if(!readVolCnf())
+ {
+ printf("Fatal: unable to load vol.cnf !\n");
+ return(-1);
+ }
+
+ printf("Entering main loop...\n");
+ mainLoop();
+
+ //freeStuff();
+
+ //freePtr(ptr_something);
+
+ return(0);
+}
+
+void changeCursor(uint16 cursorType)
+{
+ //printf("changeCursor %d\n", cursorType);
+}
+
+void* mallocAndZero(int32 size)
+{
+ void* ptr;
+
+ ptr = malloc(size);
+ memset(ptr,0,size);
+ return ptr;
+}
+
+} // End of namespace Cruise
Property changes on: scummvm/trunk/engines/cruise/cruise_main.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/cruise_main.h
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.h (rev 0)
+++ scummvm/trunk/engines/cruise/cruise_main.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,101 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _CRUISE_H_
+#define _CRUISE_H_
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+
+#include "cruise/overlay.h"
+#include "cruise/object.h"
+#include "cruise/ctp.h"
+#include "cruise/actor.h"
+#include "cruise/vars.h"
+#include "cruise/font.h"
+#include "cruise/volume.h"
+#include "cruise/fontCharacterTable.h"
+#include "cruise/stack.h"
+#include "cruise/script.h"
+#include "cruise/various.h"
+#include "cruise/stringSupport.h"
+#include "cruise/function.h"
+#include "cruise/loadSave.h"
+#include "cruise/linker.h"
+#include "cruise/mouse.h"
+#include "cruise/gfxModule.h"
+#include "cruise/dataLoader.h"
+#include "cruise/perso.h"
+#include "cruise/menu.h"
+
+#include "cruise/background.h"
+#include "cruise/backgroundIncrust.h"
+
+#include "cruise/mainDraw.h"
+
+namespace Cruise {
+
+/*#define DUMP_SCRIPT
+#define DUMP_OBJECT*/
+
+#define ASSERT_PTR assert
+#define ASSERT assert
+
+
+int32 decomp(uint8 * in, uint8 * out, int32 size);
+
+ovlData3Struct* getOvlData3Entry(int32 scriptNumber, int32 param);
+ovlData3Struct* scriptFunc1Sub2(int32 scriptNumber, int32 param);
+int16 loadShort(void* ptr);
+void resetFileEntry(int32 entryNumber);
+void saveShort(void* ptr, int16 var);
+void* mallocAndZero(int32 size);
+uint8* mainProc14(uint16 overlay, uint16 idx);
+void printInfoBlackBox(char* string);
+void waitForPlayerInput(void);
+int loadCtp(uint8* ctpName);
+void loadPakedFileToMem(int fileIdx, uint8* buffer);
+int loadScriptSub1(int scriptIdx, int param);
+void resetFileEntryRange(int param1, int param2);
+int getProcParam(int overlayIdx, int param2, uint8* name);
+void changeScriptParamInList(int param1, int param2, scriptInstanceStruct* pScriptInstance,int newValue, int param3);
+uint8* getDataFromData3(ovlData3Struct* ptr, int param);
+int32 prepareWordRender(int32 param, int32 var1,int16* out2, uint8* ptr3,uint8* string);
+void removeExtention(const char* name, char* buffer);
+void resetRaster(uint8* rasterPtr, int32 rasterSize);
+void changeCursor(uint16 cursorType);
+void resetPtr(objectStruct* ptr);
+void resetPtr2(scriptInstanceStruct* ptr);
+void getFileExtention(const char* name,char* buffer);
+void *allocAndZero(int size);
+void freeStuff2(void);
+char* getObjectName(int index, uint8* string);
+void mainLoop(void);
+} // End of namespace Cruise
+
+#endif
Property changes on: scummvm/trunk/engines/cruise/cruise_main.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/ctp.cpp
===================================================================
--- scummvm/trunk/engines/cruise/ctp.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/ctp.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,423 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "cruise/cruise_main.h"
+
+namespace Cruise {
+
+ctpVar19Struct* ptr_something;
+ctpVar19Struct* polyStruct;
+ctpVar19Struct* ctpVar11;
+ctpVar19Struct* ctpVar13;
+ctpVar19Struct* ctpVar15;
+
+uint8* ctpVar17;
+ctpVar19Struct* ctpVar19;
+
+int currentWalkBoxCenterX;
+int currentWalkBoxCenterY;
+int currentWalkBoxCenterXBis;
+int currentWalkBoxCenterYBis;
+
+int ctpVarUnk;
+uint8 walkboxTable[0x12];
+
+int ctpProc2(int varX, int varY, int paramX, int paramY)
+{
+ int diffX = abs(paramX - varX);
+ int diffY = abs(paramY - varY);
+
+ if(diffX > diffY)
+ {
+ diffY = diffX;
+ }
+
+ ctpVar14 = diffY; // highest difference
+ return(diffY);
+}
+
+// this function process path finding coordinates
+void loadCtpSub2(short int coordCount, short int* ptr) // coordCount = ctp_routeCoordCount, ptr = ctpVar8
+{
+ int i;
+ int offset = 0;
+
+ short int* cur_ctp_routeCoords = (short int*)ctp_routeCoords; // coordinates table
+ int8* cur_ctp_routes = (int8*)ctp_routes;
+
+ for(i = 0; i < coordCount; i++) // for i < ctp_routeCoordCount
+ {
+ int varX = cur_ctp_routeCoords[0]; // x
+ int varY = cur_ctp_routeCoords[1]; // y
+
+ int di = 0;
+ int var4Offset = 2;
+
+ while(*(int16*) cur_ctp_routes > di) // while (coordCount > counter++)
+ {
+ int idx = *(int16*)(cur_ctp_routes + var4Offset);
+ ptr[offset + idx] = ctpProc2(varX , varY, ctp_routeCoords[idx][0], ctp_routeCoords[idx * 2][1]);
+
+ var4Offset += 2;
+ di++;
+ }
+
+ offset += 10;
+ cur_ctp_routes += 20;
+ cur_ctp_routeCoords += 2;
+ }
+}
+
+void getWalkBoxCenter(int boxIdx, uint16* walkboxTable)
+{
+ int minX = 1000;
+ int minY = 1000;
+ int maxX = -1;
+ int maxY = -1;
+
+ ASSERT(boxIdx <= 15); // max number of walkboxes is 16
+ ASSERT(walkboxTable[boxIdx * 40]); // we should never have an empty walk box
+
+ if(walkboxTable[boxIdx * 40] > 0)
+ {
+ int numPoints = walkboxTable[boxIdx * 40];
+ uint16* pCurrentPtr = walkboxTable + (boxIdx * 40) + 1;
+
+ int i;
+
+ for(i = 0; i < numPoints; i++)
+ {
+ int X = *(pCurrentPtr++);
+ int Y = *(pCurrentPtr++);;
+
+ if(X < minX)
+ minX = X;
+
+ if(X > maxX)
+ maxX = X;
+
+ if(Y < minY)
+ minY = Y;
+
+ if(Y > maxY)
+ maxY = Y;
+ }
+ }
+
+ currentWalkBoxCenterX = ((maxX - minX) / 2) + minX;
+ currentWalkBoxCenterY = ((maxY - minY) / 2) + minY;
+}
+
+// ax dx bx
+void renderCTPWalkBox(int X1, int Y1, int X2, int scale, int Y2, uint16* walkboxData)
+{
+ int numPoints;
+ int wbSelf1;
+ int wbSelf2;
+ int i;
+ int16* destination;
+
+ wbSelf1 = upscaleValue(X1, scale) - X2;
+ wbSelf2 = upscaleValue(Y1, scale) - Y2;
+
+ numPoints = *(walkboxData++);
+
+ destination = polyBuffer2;
+
+ for(i = 0; i < numPoints; i++)
+ {
+ int pointX = *(walkboxData++);
+ int pointY = *(walkboxData++);
+
+ int scaledX = upscaleValue(pointX, scale) - wbSelf1;
+ int scaledY = upscaleValue(pointY, scale) - wbSelf2;
+
+ *(destination++) = scaledX >> 16;
+ *(destination++) = scaledY >> 16;
+ }
+
+ m_color = 0;
+ ctpVarUnk = 0;
+
+ for(i = 0; i < numPoints; i++)
+ {
+ walkboxTable[i] = i;
+ }
+
+ drawPolyMode2((char*)walkboxTable, numPoints);
+}
+
+// this process the walkboxes
+void loadCtpSub1(int boxIdx, int scale, uint16* walkboxTable, ctpVar19Struct* param4)
+{
+ int minX = 1000;
+ int minY = 1000;
+ int maxX = -1;
+ int maxY = -1;
+
+ ctpVar19Struct* var_1C;
+ ctpVar19Struct* var_12;
+ int16* var_18;
+ int16* si;
+ // int16* di;
+ // uint8* cx;
+ // int bx;
+ // int ax;
+ // int var_2;
+ int var_E;
+ int var_C = 1000;
+ int var_A = 0;
+ ctpVar19SubStruct* subStruct;
+
+ ASSERT(boxIdx <= 15);
+
+ if(walkboxTable[boxIdx * 40] > 0) // is walkbox used ?
+ {
+ getWalkBoxCenter(boxIdx, walkboxTable);
+
+ currentWalkBoxCenterYBis = currentWalkBoxCenterY;
+ currentWalkBoxCenterXBis = currentWalkBoxCenterX;
+ // + 512
+ renderCTPWalkBox(currentWalkBoxCenterX, currentWalkBoxCenterY, currentWalkBoxCenterX, scale + 0x200, currentWalkBoxCenterY, walkboxTable + boxIdx * 40);
+
+ var_1C = param4;
+ var_12 = var_1C + 1; // next
+
+ var_18 = polyBuffer3;
+ var_E = 0;
+
+ si = &polyBuffer3[1];
+ /* if(*si>=0)
+ {
+ di = si;
+ cx = var_12;
+
+ do
+ {
+ di++;
+ bx = di[-1];
+ ax = di[0];
+ di++;
+
+ var_2 = ax;
+ if(var_C < bx)
+ {
+ var_C = bx;
+ }
+
+ if(var_2 < var_A)
+ {
+ var_A = var_2;
+ }
+
+ *cx = bx;
+ cx++;
+ *cx = var_2;
+ cx++;
+ var_E ++;
+ }while(di);
+
+ var_12 = cx;
+ }*/
+
+ /*************/
+ {
+ int i;
+ int numPoints;
+ uint16* pCurrentPtr = walkboxTable + boxIdx * 40;
+
+ numPoints = *(pCurrentPtr++);
+
+ for(i = 0; i < numPoints; i++)
+ {
+ int X = *(pCurrentPtr++);
+ int Y = *(pCurrentPtr++);
+
+ if(X < minX)
+ minX = X;
+
+ if(X > maxX)
+ maxX = X;
+
+ if(Y < minY)
+ minY = Y;
+
+ if(Y > maxY)
+ maxY = Y;
+ }
+ }
+ /************/
+
+ var_1C->field_0 = var_12;
+ ctpVar13 = var_12;
+ var_12->field_0 = (ctpVar19Struct*)(-1);
+
+ subStruct = &var_1C->subStruct;
+
+ subStruct->boxIdx = boxIdx;
+ subStruct->type = walkboxType[boxIdx];
+ subStruct->minX = minX;
+ subStruct->maxX = maxX;
+ subStruct->minY = minY;
+ subStruct->maxY = maxY;
+ }
+}
+
+int loadCtp(uint8* ctpName)
+{
+ int walkboxCounter; // si
+ uint8* ptr;
+ uint8* dataPointer; // ptr2
+ char fileType[5]; // string2
+ short int segementSizeTable[7]; // tempTable
+ char string[32];
+
+ if(ctpVar1 == 0)
+ {
+ int i;
+
+ for(i = 0; i < 10; i++)
+ {
+ persoTable[i] = NULL;
+ }
+ }
+
+ if(!loadFileSub1(&ptr,ctpName,0))
+ {
+ free(ptr);
+ return(-18);
+ }
+
+ dataPointer = ptr;
+
+ fileType[4] = 0;
+ memcpy(fileType, dataPointer, 4); // get the file type, first 4 bytes of the CTP file
+ dataPointer += 4;
+
+ if(strcmp(fileType, "CTP "))
+ {
+ free(ptr);
+ return(0);
+ }
+
+ memcpy(&ctp_routeCoordCount , dataPointer, 2); // get the number of path-finding coordinates
+ dataPointer += 2;
+ flipShort(&ctp_routeCoordCount);
+
+ memcpy(segementSizeTable, dataPointer, 0xE);
+ dataPointer += 0xE; // + 14
+ flipGen(segementSizeTable, 0xE);
+
+ memcpy(ctp_routeCoords, dataPointer, segementSizeTable[0]); // get the path-finding coordinates
+ dataPointer += segementSizeTable[0];
+ flipGen(ctp_routeCoords, segementSizeTable[0]);
+
+ memcpy(ctp_routes, dataPointer, segementSizeTable[1]); // get the path-finding line informations (indexing the routeCoords array)
+ dataPointer += segementSizeTable[1];
+ flipGen(ctp_routes, segementSizeTable[1]);
+
+ memcpy(ctp_walkboxTable, dataPointer, segementSizeTable[2]);// get the walkbox coordinates and lines
+ dataPointer += segementSizeTable[2];
+ flipGen(ctp_walkboxTable, segementSizeTable[2]);
+
+ if(ctpVar1)
+ {
+ dataPointer += segementSizeTable[3];
+ dataPointer += segementSizeTable[4];
+ }
+ else
+ {
+ memcpy(walkboxType, dataPointer, segementSizeTable[3]); // get the walkbox type
+ dataPointer += segementSizeTable[3];
+ flipGen(walkboxType, segementSizeTable[3]); // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone
+
+ memcpy(walkboxChange, dataPointer, segementSizeTable[4]); // change indicator, walkbox type can change, i.e. blocked by object (values are either 0x00 or 0x01)
+ dataPointer += segementSizeTable[4];
+ flipGen(walkboxChange, segementSizeTable[4]);
+ }
+
+ memcpy(ctpVar6, dataPointer, segementSizeTable[5]); // unknown? always 2*16 bytes (used by S24.CTP, S33.CTP, S33_2.CTP, S34.CTP, S35.CTP, S36.CTP; values can be 0x00, 0x01, 0x03, 0x05)
+ dataPointer += segementSizeTable[5];
+ flipGen(ctpVar6,segementSizeTable[5]);
+
+ memcpy(ctp_scale, dataPointer, segementSizeTable[6]); // scale values for the walkbox coordinates (don't know why there is a need for scaling walkboxes)
+ dataPointer += segementSizeTable[6];
+ flipGen(ctp_scale, segementSizeTable[6]); // ok
+
+ free(ptr);
+
+ strcpyuint8(string, currentCtpName);
+
+ numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes
+
+ loadCtpSub2(ctp_routeCoordCount, ctpVar8); // process path-finding stuff
+
+ polyStruct = ctpVar11 = ctpVar13 = ptr_something;
+
+ ptr = (uint8*) polyStruct;
+
+ walkboxCounter = numberOfWalkboxes;
+
+ while((--walkboxCounter) >= 0)
+ {
+ loadCtpSub1(walkboxCounter, 0, ctp_walkboxTable, ctpVar13);
+ }
+
+ ctpVar15 = ctpVar13 + 1; // was after the -1 thing
+
+ walkboxCounter = numberOfWalkboxes;
+
+ while(--walkboxCounter)
+ {
+ loadCtpSub1(walkboxCounter, ctp_scale[walkboxCounter] * 20, ctp_walkboxTable, ctpVar13);
+ }
+
+ //ctpVar17 = ctpVar13 - ptr + 4;
+
+ {
+ int numOfUsedEntries = ctpVar13 - (ctpVar19Struct*) ptr;
+ numOfUsedEntries++;// there is a -1 entry at the end... Original was only mallocing numOfUsedEntries*sizeof(ctpVar19Struct)+4, but this is a bit ugly...
+ ctpVar13 = ctpVar11 = polyStruct = (ctpVar19Struct*)malloc(numOfUsedEntries * sizeof(ctpVar19Struct));
+ }
+
+ walkboxCounter = numberOfWalkboxes;
+ while((--walkboxCounter) >= 0)
+ {
+ loadCtpSub1(walkboxCounter, 0, ctp_walkboxTable, ctpVar13);
+ }
+
+ ctpVar15 = ctpVar13 + 1;
+
+ walkboxCounter = numberOfWalkboxes;
+ while(--walkboxCounter)
+ {
+ loadCtpSub1(walkboxCounter, ctp_scale[walkboxCounter] * 20, ctp_walkboxTable, ctpVar13);
+ }
+
+ ctpVar19 = ctpVar11;
+
+ return(1);
+}
+
+} // End of namespace Cruise
Property changes on: scummvm/trunk/engines/cruise/ctp.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/ctp.h
===================================================================
--- scummvm/trunk/engines/cruise/ctp.h (rev 0)
+++ scummvm/trunk/engines/cruise/ctp.h 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,64 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _CTP_H_
+#define _CTP_H_
+
+namespace Cruise {
+
+struct ctpVar19SubStruct
+{
+ uint16 boxIdx; //0
+ uint16 type; //2
+ uint16 minX; //4
+ uint16 maxX; //6
+ uint16 minY; //8
+ uint16 maxY; //A
+};
+
+typedef struct ctpVar19SubStruct ctpVar19SubStruct;
+
+struct ctpVar19Struct
+{
+ struct ctpVar19Struct* field_0; //0
+ ctpVar19SubStruct subStruct;
+};
+
+typedef struct ctpVar19Struct ctpVar19Struct;
+
+extern ctpVar19Struct* ptr_something;
+extern ctpVar19Struct* polyStruct;
+extern ctpVar19Struct* ctpVar11;
+extern ctpVar19Struct* ctpVar13;
+extern ctpVar19Struct* ctpVar15;
+
+extern uint8* ctpVar17;
+extern ctpVar19Struct* ctpVar19;
+
+int loadCtp(uint8* ctpName);
+int ctpProc2(int varX, int varY, int paramX, int paramY);
+
+} // End of namespace Cruise
+
+#endif
\ No newline at end of file
Property changes on: scummvm/trunk/engines/cruise/ctp.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Added: scummvm/trunk/engines/cruise/dataLoader.cpp
===================================================================
--- scummvm/trunk/engines/cruise/dataLoader.cpp (rev 0)
+++ scummvm/trunk/engines/cruise/dataLoader.cpp 2007-04-27 12:58:35 UTC (rev 26605)
@@ -0,0 +1,532 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "cruise/cruise_main.h"
+
+namespace Cruise {
+
+void loadSetEntry(uint8* name, uint8* ptr, int currentEntryIdx, int currentDestEntry);
+void loadFNTSub(uint8* ptr, int destIdx);
+
+enum fileTypeEnum
+{
+ type_UNK,
+ type_SPL,
+ type_SET,
+ type_FNT,
+};
+
+typedef enum fileTypeEnum fileTypeEnum;
+
+int loadSingleFile;
+
+// TODO: Unify decodeGfxFormat1, decodeGfxFormat4 and decodeGfxFormat5
+
+void decodeGfxFormat1(dataFileEntry* pCurrentFileEntry)
+{
+ uint8* buffer;
+ uint8* dataPtr = pCurrentFileEntry->subData.ptr;
+
+ int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn * 8;
+ int x = 0;
+
+ buffer = (uint8*)malloc(spriteSize);
+
+ while (x < spriteSize)
+ {
+ uint8 c;
+ uint16 p0;
+
+ p0 = (dataPtr[0] << 8) | dataPtr[1];
+
+ /* decode planes */
+ for (c = 0; c < 16; c++)
+ {
+ buffer[x+c] = ((p0 >> 15) & 1);
+
+ p0 <<= 1;
+ }
+
+ x+=16;
+
+ dataPtr+=2;
+ }
+
+ pCurrentFileEntry->subData.ptr = buffer;
+}
+
+
+void decodeGfxFormat4(dataFileEntry* pCurrentFileEntry)
+{
+ uint8* buffer;
+ uint8* dataPtr = pCurrentFileEntry->subData.ptr;
+
+ int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn * 2;
+ int x = 0;
+
+ buffer = (uint8*)malloc(spriteSize);
+
+ while (x < spriteSize)
+ {
+ uint8 c;
+ uint16 p0;
+ uint16 p1;
+ uint16 p2;
+ uint16 p3;
+
+ p0 = (dataPtr[0] << 8) | dataPtr[1];
+ p1 = (dataPtr[2] << 8) | dataPtr[3];
+ p2 = (dataPtr[4] << 8) | dataPtr[5];
+ p3 = (dataPtr[6] << 8) | dataPtr[7];
+
+ /* decode planes */
+ for (c = 0; c < 16; c++)
+ {
+ buffer[x+c] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8);
+
+ p0 <<= 1;
+ p1 <<= 1;
+ p2 <<= 1;
+ p3 <<= 1;
+ }
+
+ x+=16;
+
+ dataPtr+=8;
+ }
+
+ pCurrentFileEntry->subData.ptr = buffer;
+}
+
+void decodeGfxFormat5(dataFileEntry* pCurrentFileEntry)
+{
+ uint8* buffer;
+ uint8* dataPtr = pCurrentFileEntry->subData.ptr;
+
+ int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn;
+ int x = 0;
+ int range = pCurrentFileEntry->height * pCurrentFileEntry->width;
+
@@ 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