cine-cvs Mailing List for cinE - the cinematic Engine
Status: Pre-Alpha
Brought to you by:
yazoo
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(17) |
Jun
(9) |
Jul
(1) |
Aug
(7) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(66) |
May
(7) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(28) |
Nov
(7) |
Dec
(1) |
2006 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vincent H. <ya...@us...> - 2006-04-19 06:43:11
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31834/src Modified Files: actor.c actor.h mainDraw.c mouse.c Log Message: Index: actor.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/actor.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** actor.c 17 Apr 2006 23:25:19 -0000 1.7 --- actor.c 19 Apr 2006 06:42:58 -0000 1.8 *************** *** 494,498 **** ctpVar19=ctpVar11; ! if (*nclick==2) { x1=table_ptselect[0][0]; --- 494,498 ---- ctpVar19=ctpVar11; ! if (*nclick==2) // second point { x1=table_ptselect[0][0]; *************** *** 506,516 **** flag_aff_chemin=1; ctpVar19=ctpVar15; polydroite(x1,y1,x2,y2); ! if (!flag_obstacle) /* peut-on y aller directement ? */ { 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; --- 506,523 ---- 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; *************** *** 525,531 **** else { solution[0]=-1; if (ctp_routes[select_noeud[0]][0]>0) ! chemin0(table[0],table[1]); /* non, choisi le chemin le plus court */ if (solution[0]==-1) --- 532,539 ---- 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) *************** *** 828,832 **** if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) { ! currentActor->phase = 3; currentActor->nextDirection = currentActor->endDirection; currentActor->endDirection = -1; --- 836,840 ---- if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) { ! currentActor->phase = ANIM_PHASE_STATIC_END; currentActor->nextDirection = currentActor->endDirection; currentActor->endDirection = -1; *************** *** 838,847 **** currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = 0; } } else { ! currentActor->phase = 1; currentActor->counter = -1; } --- 846,855 ---- currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = ANIM_PHASE_WAIT; } } else { ! currentActor->phase = ANIM_PHASE_STATIC; currentActor->counter = -1; } *************** *** 860,864 **** if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) { ! currentActor->phase = 3; currentActor->nextDirection = currentActor->endDirection; currentActor->endDirection = -1; --- 868,872 ---- if((currentActor->endDirection != -1) && (currentActor->endDirection != currentActor->startDirection)) { ! currentActor->phase = ANIM_PHASE_STATIC_END; currentActor->nextDirection = currentActor->endDirection; currentActor->endDirection = -1; *************** *** 870,879 **** currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = 0; } } else { ! currentActor->phase = 1; currentActor->counter = -1; } --- 878,887 ---- currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = ANIM_PHASE_WAIT; } } else { ! currentActor->phase = ANIM_PHASE_STATIC; currentActor->counter = -1; } *************** *** 882,893 **** animationStart = 0; ! if(currentActor->pathId >= 0 || currentActor->phase == 3) { switch(currentActor->phase) { ! case 3: ! case 1: { ! if(currentActor->counter == -1 && currentActor->phase == 1) { affiche_chemin(currentActor->pathId, returnVar2); --- 890,901 ---- 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); *************** *** 898,902 **** currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = 0; break; } --- 906,910 ---- currentActor->flag = 0; currentActor->endDirection = -1; ! currentActor->phase = ANIM_PHASE_WAIT; break; } *************** *** 909,916 **** if (currentActor->startDirection == currentActor->nextDirection) ! currentActor->phase= 2; } ! if ((currentActor->counter>=0) && ((currentActor->phase==1) || (currentActor->phase==3))) { int newA; --- 917,924 ---- 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; *************** *** 943,950 **** if (currentActor->startDirection==currentActor->nextDirection) { ! if (currentActor->phase==1) ! currentActor->phase=2; else ! currentActor->phase=4; } else --- 951,958 ---- if (currentActor->startDirection==currentActor->nextDirection) { ! if (currentActor->phase == ANIM_PHASE_STATIC) ! currentActor->phase = ANIM_PHASE_MOVE; else ! currentActor->phase = ANIM_PHASE_END; } else *************** *** 967,971 **** break; } ! case 2: { if (currentActor->counter>=1) --- 975,979 ---- break; } ! case ANIM_PHASE_MOVE: { if (currentActor->counter>=1) *************** *** 976,980 **** if ((currentActor->endDirection==-1) || (currentActor->endDirection==currentActor->nextDirection)) { ! currentActor->phase=4; } else --- 984,988 ---- if ((currentActor->endDirection==-1) || (currentActor->endDirection==currentActor->nextDirection)) { ! currentActor->phase=ANIM_PHASE_END; } else *************** *** 988,991 **** --- 996,1000 ---- else { + assert(0); /* currentActor->x = returnVar2[0]; currentActor->y = returnVar2[1]; *************** *** 1004,1008 **** } ! if (currentActor->phase==2) { int newA; --- 1013,1017 ---- } ! if (currentActor->phase==ANIM_PHASE_MOVE) { int newA; *************** *** 1022,1029 **** break; } ! case 4: { 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=0; --- 1031,1040 ---- 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=0; Index: actor.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/actor.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** actor.h 22 Feb 2006 21:15:39 -0000 1.6 --- actor.h 19 Apr 2006 06:42:59 -0000 1.7 *************** *** 2,5 **** --- 2,16 ---- #define _ACTOR_H_ + 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; *************** *** 19,23 **** s16 stepY; s16 pathId; ! s16 phase; s16 counter; s16 poly; --- 30,34 ---- s16 stepY; s16 pathId; ! animPhase phase; s16 counter; s16 poly; Index: mouse.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mouse.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mouse.c 20 Oct 2005 09:13:00 -0000 1.6 --- mouse.c 19 Apr 2006 06:42:59 -0000 1.7 *************** *** 20,23 **** if(localStatus.middle) *pMouseButton |= 4; - } \ No newline at end of file --- 20,22 ---- Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mainDraw.c 10 Nov 2005 20:40:33 -0000 1.41 --- mainDraw.c 19 Apr 2006 06:42:59 -0000 1.42 *************** *** 1092,1099 **** //----------------------------------------------------------------------------------------------------------------// - #ifdef _DEBUG - // drawCtp(); - #endif - if(currentActiveMenu != -1) { --- 1092,1095 ---- *************** *** 1105,1108 **** --- 1101,1108 ---- } + #ifdef _DEBUG + //drawCtp(); + #endif + if(mouseVar1) { |
From: Vincent H. <ya...@us...> - 2006-04-17 23:25:26
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22532/src Modified Files: actor.c ctp.c function.c function.h perso.c vars.c vars.h Log Message: Early pathfinder and movement Index: function.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** function.h 13 Apr 2005 17:52:58 -0000 1.3 --- function.h 17 Apr 2006 23:25:19 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- #define _FUNCTION_H_ + extern int flag_obstacle; void setupOpcodeTable(void); s32 opcodeType8(void); Index: perso.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/perso.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** perso.c 22 Feb 2006 21:15:40 -0000 1.4 --- perso.c 17 Apr 2006 23:25:19 -0000 1.5 *************** *** 62,67 **** } ! void cor_droite(int x1,int y1,int x2,int y2,int cor_joueur) { } --- 62,151 ---- } ! void cor_droite(int x1,int y1,int x2,int y2, s16 cor_joueur[400][2]) { + s16* di = cor_joueur; + int dx; + int dy; + + int mD0; + int mD1; + + int mA0; + int mA1; + + int bp; + int cx; + int si; + + int ax; + int bx; + + di[0] = x1; + di[1] = y1; + di+=2; + + 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 = x1; + bx = y1; + + while(--cx) + { + if(dx<0) + { + ax+=mD0; + bx+=mD1; + dx+=si; + } + else + { + ax+=mA0; + bx+=mA1; + dx+=bp; + } + + di[0] = ax; + di[1] = bx; + di+=2; + } + + flag_obstacle = 0; + inc_droite2 = (di-(s16*)cor_joueur)/2; } Index: actor.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/actor.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** actor.c 22 Feb 2006 21:15:39 -0000 1.6 --- actor.c 17 Apr 2006 23:25:19 -0000 1.7 *************** *** 40,47 **** } //computePathfinding(returnVar2, params.X, params.Y, var34, var35, currentActor->stepX, currentActor->stepY); s16 computePathfinding(s16* pSolution, s16 X, s16 Y, s16 destX, s16 destY, s16 stepX, s16 stepY, s16 oldPathId) { ! persoStruct* pPerso; if(!polyStruct) --- 40,614 ---- } [...968 lines suppressed...] ! { ! 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 4: + { + 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=0; + currentActor->flag=0; + currentActor->endDirection=-1; break; } Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** function.c 22 Feb 2006 21:15:40 -0000 1.37 --- function.c 17 Apr 2006 23:25:19 -0000 1.38 *************** *** 1175,1179 **** } ! int boxType; // computedVar14Bis void checkCollisionWithWalkBoxesBoundingBoxes(int x, int y) --- 1175,1179 ---- } ! int flag_obstacle; // computedVar14Bis void checkCollisionWithWalkBoxesBoundingBoxes(int x, int y) *************** *** 1192,1196 **** if(-1 == (int) di->field_0) // ok, ugly, but it's in the original { ! boxType = 0; return; } --- 1192,1196 ---- if(-1 == (int) di->field_0) // ok, ugly, but it's in the original { ! flag_obstacle = 0; return; } *************** *** 1209,1213 **** /**************/ ! boxType = walkboxType[computedVar14]; /**************/ --- 1209,1213 ---- /**************/ ! flag_obstacle = walkboxType[computedVar14]; /**************/ *************** *** 1217,1221 **** } while(1); ! boxType = 0; } --- 1217,1221 ---- } while(1); ! flag_obstacle = 0; } Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** vars.h 22 Feb 2006 21:15:40 -0000 1.28 --- vars.h 17 Apr 2006 23:25:19 -0000 1.29 *************** *** 272,276 **** extern s16 ctpVar1; extern s16 ctp_routeCoordCount; // ctpVar2 // number of path-finding coordinates ! extern s16 ctp_routeCoords[40]; // ctpVar3 // path-finding coordinates array /* ctp_routeCoords: --- 272,276 ---- extern s16 ctpVar1; extern s16 ctp_routeCoordCount; // ctpVar2 // number of path-finding coordinates ! extern s16 ctp_routeCoords[20][2]; // ctpVar3 // path-finding coordinates array /* ctp_routeCoords: *************** *** 280,284 **** */ ! extern s8 ctp_routes[400]; // ctpVar4 // path-finding line information /* ctp_routes: --- 280,284 ---- */ ! extern s16 ctp_routes[20][10]; // path-finding line information /* ctp_routes: Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ctp.c 22 Feb 2006 21:15:40 -0000 1.11 --- ctp.c 17 Apr 2006 23:25:19 -0000 1.12 *************** *** 257,264 **** subStruct->boxIdx = boxIdx; subStruct->type = walkboxType[boxIdx]; ! subStruct->minX = maxX; ! subStruct->maxX = minX; ! subStruct->minY = maxY; ! subStruct->maxY = minY; } } --- 257,264 ---- subStruct->boxIdx = boxIdx; subStruct->type = walkboxType[boxIdx]; ! subStruct->minX = minX; ! subStruct->maxX = maxX; ! subStruct->minY = minY; ! subStruct->maxY = maxY; } } Index: vars.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** vars.c 22 Feb 2006 21:15:40 -0000 1.20 --- vars.c 17 Apr 2006 23:25:19 -0000 1.21 *************** *** 137,142 **** s16 ctpVar1 = 0; s16 ctp_routeCoordCount; // ctpVar2 ! s16 ctp_routeCoords[40]; // ctpVar3 ! s8 ctp_routes[400]; // ctpVar4 u16 ctp_walkboxTable[15 * 40]; // ctpVar5 s8 ctpVar6[32]; --- 137,142 ---- s16 ctpVar1 = 0; s16 ctp_routeCoordCount; // ctpVar2 ! s16 ctp_routeCoords[20][2]; // ctpVar3 ! s16 ctp_routes[20][10]; u16 ctp_walkboxTable[15 * 40]; // ctpVar5 s8 ctpVar6[32]; |
From: Vincent H. <ya...@us...> - 2006-02-22 21:15:48
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7502/src Modified Files: actor.c actor.h cruise.c ctp.c ctp.h function.c loadSave.c menu.c overlay.h perso.c perso.h script.c script.h vars.c vars.h Log Message: Resync with local Index: perso.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/perso.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** perso.c 20 Oct 2005 09:13:00 -0000 1.3 --- perso.c 22 Feb 2006 21:15:40 -0000 1.4 *************** *** 23,33 **** } ! if(ctpVar9) { ! free(ctpVar9); } ctpVar17 = NULL; ! ctpVar9 = NULL; strcpy(currentCtpName, ""); --- 23,33 ---- } ! if(polyStruct) { ! free(polyStruct); } ctpVar17 = NULL; ! polyStruct = NULL; strcpy(currentCtpName, ""); *************** *** 36,42 **** int pathVar0; ! void processActorWalk(s16 persoIdx, s16* returnVar, s16* var6A8, s16* var6A6, s16* var6A4, s16* var6A2, s16* var646, s16* var6, s16* var4, s16* var2, persoStruct* pPerso) { ! int var_10; s16* var_18; int var_12; --- 36,122 ---- int pathVar0; ! unsigned int inc_droite2,inc_jo; ! ! int direction( int x1, int y1, int x2, int y2, int inc_jo1, int inc_jo2 ) { ! int h, v, h1, v1; ! ! h1 = x1-x2; h = abs(h1); ! v1 = y1-y2; v = abs(v1); ! ! if ( v > h ) ! { ! if ( h > 30 ) inc_jo = inc_jo1-inc_jo2; ! else inc_jo = inc_jo2; ! ! if ( v1 < 0 ) return ( 2 ); ! else return ( 0 ); ! } ! else ! { ! inc_jo = inc_jo1; ! ! if ( h1 < 0 ) return ( 1 ); ! else return ( 3 ); ! } ! } ! ! void cor_droite(int x1,int y1,int x2,int y2,int cor_joueur) ! { ! } ! ! void processActorWalk(s16 resx_y[4], s16* inc_droite, s16* inc_droite0, s16* inc_chemin, s16 cor_joueur[400][2], s16 solution0[NUM_NODES+3][2], s16* inc_jo1, s16* inc_jo2, s16* dir_perso, s16* inc_jo0, s16 num) ! { ! int x1, x2, y1, y2; ! int i, u; ! ! u = 0; ! inc_jo = *inc_jo0; ! ! i = *inc_chemin; ! ! if ( ! *inc_droite ) ! { ! x1 = solution0[i][0]; ! y1 = solution0[i][1]; ! i++; ! if ( solution0[i][0] != -1 ) ! { ! do ! { ! if (solution0[i][0]!=-2) ! { ! x2 = solution0[i][0]; ! y2 = solution0[i][1]; ! if ( (x1==x2) && (y1==y2)) ! { ! resx_y[0]=-1; ! resx_y[1]=-1; ! freePerso(num); ! ! return; ! } ! cor_droite(x1,y1,x2,y2,cor_joueur); ! *inc_droite0=inc_droite2; ! *dir_perso=resx_y[2]=direction(x1,y1,x2,y2,*inc_jo1,*inc_jo2); ! *inc_jo0=inc_jo; ! u=1; ! } ! else i++; ! ! } while ( solution0[i][0] !=-1 && !u ); ! } ! if ( !u ) ! { ! resx_y[0]=-1; ! resx_y[1]=-1; ! freePerso(num); ! ! return; ! } ! *inc_chemin=i; ! } ! ! /* int var_10; s16* var_18; int var_12; *************** *** 47,51 **** pathVar0 = *var6A8; ! if(pPerso->var0 == 0) { int x1; --- 127,131 ---- pathVar0 = *var6A8; ! if(pPerso->inc_droite == 0) { int x1; *************** *** 81,85 **** } ! ASSERT(0); } --- 161,165 ---- } ! ASSERT(0);*/ } *************** *** 91,95 **** ASSERT(pPerso); ! processActorWalk(persoIdx, returnVar, &pPerso->var6A8, &pPerso->var6A6, &pPerso->var6A4, &pPerso->var6A2, pPerso->var646, &pPerso->var6, &pPerso->var4, &pPerso->var2, pPerso); } --- 171,175 ---- ASSERT(pPerso); ! processActorWalk(returnVar, &pPerso->inc_droite, &pPerso->inc_droite0, &pPerso->inc_chemin, pPerso->coordinates, pPerso->solution, &pPerso->inc_jo1, &pPerso->inc_jo2, &pPerso->dir_perso, &pPerso->inc_jo0, persoIdx); } Index: actor.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/actor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** actor.h 20 Oct 2005 09:12:59 -0000 1.5 --- actor.h 22 Feb 2006 21:15:39 -0000 1.6 *************** *** 7,28 **** s16 var4; ! s16 var6; s16 overlayNumber; ! s16 X; ! s16 Y; ! s16 field_E; ! s16 field_10; ! s16 field_12; ! s16 field_14; ! s16 field_16; ! s16 field_18; ! s16 field_1A; ! s16 field_1C; ! s16 field_1E; ! s16 field_20; ! s16 field_22; ! s16 field_24; ! s16 field_26; ! s16 var28; }; --- 7,28 ---- s16 var4; ! s16 type; s16 overlayNumber; ! s16 x_dest; ! s16 y_dest; ! s16 x; ! s16 y; ! s16 startDirection; ! s16 nextDirection; ! s16 endDirection; ! s16 stepX; ! s16 stepY; ! s16 pathId; ! s16 phase; ! s16 counter; ! s16 poly; ! s16 flag; ! s16 start; ! s16 freeze; }; Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** function.c 5 Nov 2005 19:11:21 -0000 1.36 --- function.c 22 Feb 2006 21:15:40 -0000 1.37 *************** *** 422,431 **** s16 Op_ChangeSaveAllowedState(void) { ! int oldValue = nonInteractiveSequence; int newValue = popVar(); if(newValue != -1) { ! nonInteractiveSequence = newValue; } --- 422,431 ---- s16 Op_ChangeSaveAllowedState(void) { ! int oldValue = userEnabled; int newValue = popVar(); if(newValue != -1) { ! userEnabled = newValue; } *************** *** 1116,1120 **** } ! actorStruct* op18Sub(int overlay, int idx, actorStruct* pHead2, int param, int param2) { actorStruct* pCurrent; --- 1116,1120 ---- } ! actorStruct* addAnimation(int overlay, int idx, actorStruct* pHead2, int param, int param2) { actorStruct* pCurrent; *************** *** 1136,1140 **** pCurrent = si; ! if(pCurrent && (pCurrent->overlayNumber == overlay) && (pCurrent->var4 == idx) && (pCurrent->var6 == param2)) { return NULL; --- 1136,1140 ---- pCurrent = si; ! if(pCurrent && (pCurrent->overlayNumber == overlay) && (pCurrent->var4 == idx) && (pCurrent->type == param2)) { return NULL; *************** *** 1160,1173 **** bx->prev = si; si->var4 = idx; ! si->var6 = param2; ! si->field_1C = -1; si->overlayNumber = overlay; ! si->field_12 = param; ! si->field_14 = -1; ! si->field_18 = 5; ! si->field_1A = 2; ! si->field_1E = 0; ! si->field_24 = 0; ! si->var28 = 0; return si; --- 1160,1173 ---- bx->prev = si; si->var4 = idx; ! si->type = param2; ! si->pathId = -1; si->overlayNumber = overlay; ! si->startDirection = param; ! si->nextDirection = -1; ! si->stepX = 5; ! si->stepY = 2; ! si->phase = 0; ! si->flag = 0; ! si->freeze = 0; return si; *************** *** 1220,1228 **** } s16 Op_18(void) { int var_C = popVar(); int var_E = popVar(); ! int di = popVar(); int var_8 = popVar(); int var_A = popVar(); --- 1220,1229 ---- } + // add animation s16 Op_18(void) { int var_C = popVar(); int var_E = popVar(); ! int direction = popVar(); int var_8 = popVar(); int var_A = popVar(); *************** *** 1235,1243 **** } ! if(di>=0 && di<=3) { actorStruct* si; ! si = op18Sub(overlay, var_2, &actorHead, di, var_A); if(si) --- 1236,1244 ---- } ! if(direction>=0 && direction<=3) { actorStruct* si; ! si = addAnimation(overlay, var_2, &actorHead, direction, var_A); if(si) *************** *** 1248,1266 **** getMultipleObjectParam(overlay, var_2, ¶ms); ! si->field_E = params.X; ! si->field_10 = params.Y; ! si->X = -1; ! si->Y = -1; ! si->field_16 = -1; ! ! si->field_26 = var_8; ! si->field_18 = var_E; ! si->field_1A = var_C; ! var_A = abs(actorTable1[di].data[0]) - 1; var_4 = subOp22(params.Y); ! if(actorTable1[di].data[0] < 0) { var_4 = - var_4; --- 1249,1266 ---- getMultipleObjectParam(overlay, var_2, ¶ms); ! si->x = params.X; ! si->y = params.Y; ! si->x_dest = -1; ! si->y_dest = -1; ! si->endDirection = -1; ! si->start = var_8; ! si->stepX = var_E; ! si->stepY = var_C; ! var_A = abs(actorTable1[direction].data[0]) - 1; var_4 = subOp22(params.Y); ! if(actorTable1[direction].data[0] < 0) { var_4 = - var_4; *************** *** 1273,1277 **** setObjectPosition(overlay, var_2, 5, computedVar14); ! var36 = 0; } } --- 1273,1277 ---- setObjectPosition(overlay, var_2, 5, computedVar14); ! animationStart = 0; } } *************** *** 1321,1330 **** } ! var36 = 0; ! pActor->X = actorX; ! pActor->Y = actorY; ! pActor->field_24 = 1; ! pActor->field_16 = var0; return 0; --- 1321,1330 ---- } ! animationStart = 0; ! pActor->x_dest = actorX; ! pActor->y_dest = actorY; ! pActor->flag = 1; ! pActor->endDirection = var0; return 0; *************** *** 1366,1370 **** void setVar49Value(int value) { ! var49 = value; } --- 1366,1370 ---- void setVar49Value(int value) { ! flagCt = value; } *************** *** 1486,1492 **** if(pActor) { ! if((pActor->var28 == var2) || (var2 == -1)) { ! pActor->var28 = var1; } } --- 1486,1492 ---- if(pActor) { ! if((pActor->freeze == var2) || (var2 == -1)) { ! pActor->freeze = var1; } } Index: script.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/script.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** script.h 15 May 2005 13:25:40 -0000 1.6 --- script.h 22 Feb 2006 21:15:40 -0000 1.7 *************** *** 20,24 **** s16 scriptNumber; s16 overlayNumber; ! s16 var10; s16 var12; scriptTypeEnum type; --- 20,24 ---- s16 scriptNumber; s16 overlayNumber; ! s16 sysKey; s16 var12; scriptTypeEnum type; Index: actor.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/actor.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** actor.c 20 Oct 2005 12:09:32 -0000 1.5 --- actor.c 22 Feb 2006 21:15:39 -0000 1.6 *************** *** 9,14 **** if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) && (pCurrentEntry->var4 == param1 || param1 == -1) && ! (pCurrentEntry->var6 == param2 || param2 == -1) && ! (pCurrentEntry->field_1C != -2)) { return 0; --- 9,14 ---- if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) && (pCurrentEntry->var4 == param1 || param1 == -1) && ! (pCurrentEntry->type == param2 || param2 == -1) && ! (pCurrentEntry->pathId != -2)) { return 0; *************** *** 29,33 **** if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) && (pCurrentEntry->var4 == param1 || param1 == -1) && ! (pCurrentEntry->var6 == param2 || param2 == -1) ) { return pCurrentEntry; --- 29,33 ---- if( (pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) && (pCurrentEntry->var4 == param1 || param1 == -1) && ! (pCurrentEntry->type == param2 || param2 == -1) ) { return pCurrentEntry; *************** *** 40,63 **** } ! s16 processActorsSub2(s16 Y1,s16 X1,s16* param3,s16 param4,s16 param5,s16 param6,s16 Y,s16 X) { persoStruct* pPerso; ! if(!ctpVar9) { ! param3[0] = -1; ! param3[1] = -1; return -1; } ! if(param4 > 0) { ! if(persoTable[param4]) { ! freePerso(param4); } } if(!var49) { --- 40,109 ---- } ! //computePathfinding(returnVar2, params.X, params.Y, var34, var35, currentActor->stepX, currentActor->stepY); ! s16 computePathfinding(s16* pSolution, s16 X, s16 Y, s16 destX, s16 destY, s16 stepX, s16 stepY, s16 oldPathId) { persoStruct* pPerso; ! if(!polyStruct) { ! pSolution[0] = -1; ! pSolution[1] = -1; return -1; } ! if(oldPathId >= 0) { ! if(persoTable[oldPathId]) { ! freePerso(oldPathId); } } + if(!flagCt) + { + int i; + s16* 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; + } + + pPerso = persoTable[i] = (persoStruct*)malloc(sizeof(persoStruct)); + + ptr = pPerso->solution; + + pPerso->inc_jo1 = stepX; + pPerso->inc_jo2 = stepY; + + *(ptr++) = X; + *(ptr++) = Y; + *(ptr++) = pSolution[0] = destX; + *(ptr++) = pSolution[1] = destY; + *(ptr++) = -1; + + pSolution[4] = computedVar14; + + pPerso->inc_droite = 0; + pPerso->inc_chemin = 0; + + return i; + } + + assert(0); + #if 0 + if(!var49) { *************** *** 105,109 **** ASSERT(0); } ! return 0; } --- 151,155 ---- ASSERT(0); } ! #endif return 0; } *************** *** 119,195 **** currentActor = currentActor->next; ! if(!currentActor->var28 && ((currentActor->var6 == 0) || (currentActor->var6 == 1))) { getMultipleObjectParam(currentActor->overlayNumber,currentActor->var4,¶ms); ! if(((var36 && !currentActor->field_24) || (!var36 && currentActor->X != -1 && currentActor->Y != -1)) && (!currentActor->var6)) { ! if(!var36) { ! var34 = currentActor->X; ! var35 = currentActor->Y; ! currentActor->X = -1; ! currentActor->Y = -1; ! currentActor->field_24 = 1; } ! currentActor->field_1C = processActorsSub2(params.X,params.Y,returnVar2,currentActor->field_1C,currentActor->field_1A,currentActor->field_18,var35,var34); ! if(currentActor->field_1C == -1) { ! if((currentActor->field_16 != -1) && (currentActor->field_16 != currentActor->field_12)) { ! currentActor->field_1E = 3; ! currentActor->field_14 = currentActor->field_16; ! currentActor->field_16 = -1; ! currentActor->field_20 = 0; } else { ! currentActor->field_1C = -2; ! currentActor->field_24 = 0; ! currentActor->field_16 = -1; ! currentActor->field_1E = 0; } } else { ! currentActor->field_1E = 1; ! currentActor->field_20 = -1; } ! var36 = 0; ! if(currentActor->field_1C >= 0 || currentActor->field_1E == 3) { ! switch(currentActor->field_1E) { ! case 1: { ! if(currentActor->field_20 == -1 && currentActor->field_1E == 1) { ! affiche_chemin(currentActor->field_1C, returnVar2); ! if(returnVar2[0] == -1) ! { ! currentActor->field_1C = -2; ! currentActor->field_24 = 0; ! currentActor->field_16 = -1; ! currentActor->field_1E = 0; ! } ! else ! { ! ASSERT(0); ! } } - break; - } - default: - { - printf("Unimplemented currentActor->field_1E=%d in processActors()\n", currentActor->field_1E); - // exit(1); } } } --- 165,258 ---- 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 = 3; ! currentActor->nextDirection = currentActor->endDirection; ! currentActor->endDirection = -1; ! currentActor->counter = 0; } else { ! currentActor->pathId = -2; ! currentActor->flag = 0; ! currentActor->endDirection = -1; ! currentActor->phase = 0; } } else { ! currentActor->phase = 1; ! 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); ! assert(0); ! } ! animationStart = 0; ! ! if(currentActor->pathId >= 0 || currentActor->phase == 3) ! { ! switch(currentActor->phase) { ! case 3: ! case 1: { ! if(currentActor->counter == -1 && currentActor->phase == 1) { ! affiche_chemin(currentActor->pathId, returnVar2); ! ! if(returnVar2[0] == -1) { ! currentActor->pathId = -2; ! currentActor->flag = 0; ! currentActor->endDirection = -1; ! currentActor->phase = 0; ! } ! else ! { ! 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= 2; } } + break; + } + default: + { + printf("Unimplemented currentActor->phase=%d in processActors()\n", currentActor->phase); + // exit(1); } } Index: ctp.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ctp.h 4 Nov 2005 22:01:55 -0000 1.4 --- ctp.h 22 Feb 2006 21:15:40 -0000 1.5 *************** *** 23,27 **** extern ctpVar19Struct* ptr_something; ! extern ctpVar19Struct* ctpVar9; extern ctpVar19Struct* ctpVar11; extern ctpVar19Struct* ctpVar13; --- 23,27 ---- extern ctpVar19Struct* ptr_something; ! extern ctpVar19Struct* polyStruct; extern ctpVar19Struct* ctpVar11; extern ctpVar19Struct* ctpVar13; Index: perso.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/perso.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** perso.h 20 Oct 2005 09:13:00 -0000 1.3 --- perso.h 22 Feb 2006 21:15:40 -0000 1.4 *************** *** 2,16 **** #define _PERSO_H_ struct persoStruct { ! s16 var0; ! s16 var2; ! s16 var4; ! s16 var6; ! s16 var646[46]; ! s16 var6A2; ! s16 var6A4; ! s16 var6A6; ! s16 var6A8; }; --- 2,18 ---- #define _PERSO_H_ + #define NUM_NODES 20 + struct persoStruct { ! s16 inc_droite; // 2 ! s16 inc_droite0; // 2 ! s16 inc_chemin; // 2 ! s16 coordinates[400][2]; // 1600 ! s16 solution[NUM_NODES+3][2]; //((20+3)*2*2) ! s16 inc_jo1; // 2 ! s16 inc_jo2; // 2 ! s16 dir_perso; // 2 ! s16 inc_jo0; // 2 }; *************** *** 22,26 **** void freePerso(int persoIdx); void freeAllPerso(void); - s16 processActorsSub2(s16 param1,s16 param2,s16* param3,s16 param4,s16 param5,s16 param6,s16 param7,s16 param8); void affiche_chemin(s16 persoIdx, s16* returnVar); --- 24,27 ---- Index: overlay.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/overlay.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** overlay.h 21 Oct 2005 22:20:37 -0000 1.15 --- overlay.h 22 Feb 2006 21:15:40 -0000 1.16 *************** *** 33,37 **** short int offsetToImportName; short int offsetToSubData5; ! short int var10; short int var12; short int numImport; --- 33,37 ---- short int offsetToImportName; short int offsetToSubData5; ! short int sysKey; short int var12; short int numImport; Index: script.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/script.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** script.c 21 Oct 2005 22:20:37 -0000 1.19 --- script.c 22 Feb 2006 21:15:40 -0000 1.20 *************** *** 678,682 **** } ! var_C = data3Ptr->var10; oldTail = scriptHandlePtr; --- 678,682 ---- } ! var_C = data3Ptr->sysKey; oldTail = scriptHandlePtr; *************** *** 708,716 **** if(scriptType == 20) // Obj or not ? { ! tempPtr->var10 = useArg3Neg; } else { ! tempPtr->var10 = 1; } --- 708,716 ---- if(scriptType == 20) // Obj or not ? { ! tempPtr->sysKey = useArg3Neg; } else { ! tempPtr->sysKey = 1; } *************** *** 816,827 **** if(!overlayTable[ptr->overlayNumber].executeScripts) { ! if(ptr->scriptNumber != -1 && ptr->var12 == 0 && ptr->var10 != 0) { executeScripts(ptr); } ! if(ptr->var10 == 0) { ! ptr->var10 = 1; } } --- 816,827 ---- if(!overlayTable[ptr->overlayNumber].executeScripts) { ! if(ptr->scriptNumber != -1 && ptr->var12 == 0 && ptr->sysKey != 0) { executeScripts(ptr); } ! if(ptr->sysKey == 0) { ! ptr->sysKey = 1; } } Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** vars.h 5 Nov 2005 19:11:21 -0000 1.27 --- vars.h 22 Feb 2006 21:15:40 -0000 1.28 *************** *** 221,231 **** extern s16 var3; extern s16 var4; ! extern s16 nonInteractiveSequence; extern s16 var5; extern s16 var6; extern s16 var7; extern s16 var8; ! extern s16 var9; ! extern s16 var10; extern s16 var11; extern s16 var12; --- 221,231 ---- extern s16 var3; extern s16 var4; ! extern s16 userEnabled; extern s16 var5; extern s16 var6; extern s16 var7; extern s16 var8; ! extern s16 userDelay; ! extern s16 sysKey; extern s16 var11; extern s16 var12; *************** *** 235,242 **** extern s16 var23; extern s16 var24; ! extern s16 var25; extern s16 var34; extern s16 var35; ! extern s16 var36; extern s16 main17; --- 235,242 ---- extern s16 var23; extern s16 var24; ! extern s16 automaticMode; extern s16 var34; extern s16 var35; ! extern s16 animationStart; extern s16 main17; *************** *** 250,254 **** extern s16 var47; extern s16 var48; ! extern s16 var49; extern s8 var50[64]; --- 250,254 ---- extern s16 var47; extern s16 var48; ! extern s16 flagCt; extern s8 var50[64]; Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ctp.c 5 Nov 2005 19:11:21 -0000 1.10 --- ctp.c 22 Feb 2006 21:15:40 -0000 1.11 *************** *** 2,6 **** ctpVar19Struct* ptr_something; ! ctpVar19Struct* ctpVar9; ctpVar19Struct* ctpVar11; ctpVar19Struct* ctpVar13; --- 2,6 ---- ctpVar19Struct* ptr_something; ! ctpVar19Struct* polyStruct; ctpVar19Struct* ctpVar11; ctpVar19Struct* ctpVar13; *************** *** 353,359 **** loadCtpSub2(ctp_routeCoordCount, ctpVar8); // process path-finding stuff ! ctpVar9 = ctpVar11 = ctpVar13 = ptr_something; ! ptr = (u8*) ctpVar9; walkboxCounter = numberOfWalkboxes; --- 353,359 ---- loadCtpSub2(ctp_routeCoordCount, ctpVar8); // process path-finding stuff ! polyStruct = ctpVar11 = ctpVar13 = ptr_something; ! ptr = (u8*) polyStruct; walkboxCounter = numberOfWalkboxes; *************** *** 378,382 **** 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 = ctpVar9 = malloc(numOfUsedEntries * sizeof(ctpVar19Struct)); } --- 378,382 ---- 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 = malloc(numOfUsedEntries * sizeof(ctpVar19Struct)); } Index: loadSave.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/loadSave.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** loadSave.c 4 Nov 2005 22:01:55 -0000 1.11 --- loadSave.c 22 Feb 2006 21:15:40 -0000 1.12 *************** *** 213,222 **** fread(&var3,2,1,fileHandle); fread(&var4,2,1,fileHandle); ! fread(&nonInteractiveSequence,2,1,fileHandle); fread(&var6,2,1,fileHandle); fread(&var7,2,1,fileHandle); fread(&var8,2,1,fileHandle); ! fread(&var9,2,1,fileHandle); ! fread(&var10,2,1,fileHandle); fread(&var11,2,1,fileHandle); fread(&var12,2,1,fileHandle); --- 213,222 ---- fread(&var3,2,1,fileHandle); fread(&var4,2,1,fileHandle); ! fread(&userEnabled,2,1,fileHandle); fread(&var6,2,1,fileHandle); fread(&var7,2,1,fileHandle); fread(&var8,2,1,fileHandle); ! fread(&userDelay,2,1,fileHandle); ! fread(&sysKey,2,1,fileHandle); fread(&var11,2,1,fileHandle); fread(&var12,2,1,fileHandle); *************** *** 228,232 **** fread(&var23,2,1,fileHandle); fread(&var24,2,1,fileHandle); ! fread(&var25,2,1,fileHandle); // video param (not loaded in EGA mode) --- 228,232 ---- fread(&var23,2,1,fileHandle); fread(&var24,2,1,fileHandle); ! fread(&automaticMode,2,1,fileHandle); // video param (not loaded in EGA mode) *************** *** 243,247 **** fread(&var34,2,1,fileHandle); fread(&var35,2,1,fileHandle); ! fread(&var36,2,1,fileHandle); fread(¤tActiveBackgroundPlane,2,1,fileHandle); fread(&initVar3,2,1,fileHandle); --- 243,247 ---- fread(&var34,2,1,fileHandle); fread(&var35,2,1,fileHandle); ! fread(&animationStart,2,1,fileHandle); fread(¤tActiveBackgroundPlane,2,1,fileHandle); fread(&initVar3,2,1,fileHandle); *************** *** 263,267 **** fread(&var47,2,1,fileHandle); fread(&var48,2,1,fileHandle); ! fread(&var49,2,1,fileHandle); fread(&var41,2,1,fileHandle); fread(&entrerMenuJoueur,2,1,fileHandle); --- 263,267 ---- fread(&var47,2,1,fileHandle); fread(&var48,2,1,fileHandle); ! fread(&flagCt,2,1,fileHandle); fread(&var41,2,1,fileHandle); fread(&entrerMenuJoueur,2,1,fileHandle); Index: vars.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** vars.c 5 Nov 2005 19:11:21 -0000 1.19 --- vars.c 22 Feb 2006 21:15:40 -0000 1.20 *************** *** 87,97 **** s16 var3; s16 var4; ! s16 nonInteractiveSequence; s16 var5; s16 var6; s16 var7; s16 var8; ! s16 var9; ! s16 var10 = -1; s16 var11 = 0; s16 var12; --- 87,97 ---- s16 var3; s16 var4; ! s16 userEnabled; s16 var5; s16 var6; s16 var7; s16 var8; ! s16 userDelay; ! s16 sysKey = -1; s16 var11 = 0; s16 var12; *************** *** 101,108 **** s16 var23; s16 var24; ! s16 var25; s16 var34; s16 var35; ! s16 var36; s16 main17; --- 101,108 ---- s16 var23; s16 var24; ! s16 automaticMode; s16 var34; s16 var35; ! s16 animationStart; s16 main17; *************** *** 115,119 **** s16 var47; s16 var48; ! s16 var49; s8 var50[64]; --- 115,119 ---- s16 var47; s16 var48; ! s16 flagCt; s8 var50[64]; Index: menu.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/menu.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** menu.c 30 Oct 2005 23:38:57 -0000 1.3 --- menu.c 22 Feb 2006 21:15:40 -0000 1.4 *************** *** 232,236 **** addSelectableMenuEntry(0, 3, menuTable[0], 1, -1, "Lecteur de Sauvegarde"); ! if(!nonInteractiveSequence) { addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, "Sauvegarde"); --- 232,236 ---- addSelectableMenuEntry(0, 3, menuTable[0], 1, -1, "Lecteur de Sauvegarde"); ! if(userEnabled) { addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, "Sauvegarde"); Index: cruise.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** cruise.c 29 Oct 2005 18:23:14 -0000 1.63 --- cruise.c 22 Feb 2006 21:15:39 -0000 1.64 *************** *** 268,272 **** if(param2 == scriptHandle->nextScriptPtr->scriptNumber || param2 != -1) { ! scriptHandle->nextScriptPtr->var10 = param; } } --- 268,272 ---- if(param2 == scriptHandle->nextScriptPtr->scriptNumber || param2 != -1) { ! scriptHandle->nextScriptPtr->sysKey = param; } } *************** *** 836,839 **** --- 836,842 ---- u8* ptr = string; + if(!string) + return; + for(i=0;i<index;i++) { *************** *** 1171,1184 **** button = 0; ! if(var10 != -1) { ! button = var10; mouseX = var11; mouseY = var12; ! var10 = -1; } else { ! if(var25 == 0) { getMouseStatus(&main10, &mouseX, &button, &mouseY); --- 1174,1187 ---- button = 0; ! if(sysKey != -1) { ! button = sysKey; mouseX = var11; mouseY = var12; ! sysKey = -1; } else { ! if(automaticMode == 0) { getMouseStatus(&main10, &mouseX, &button, &mouseY); *************** *** 1191,1200 **** } ! if(var9) { ! var9--; return 0; } if(((button&3) == 3) || keyboardVar == 0x44 || keyboardVar == 0x53) { --- 1194,1205 ---- } ! if(userDelay) { ! userDelay--; return 0; } + // test both buttons + if(((button&3) == 3) || keyboardVar == 0x44 || keyboardVar == 0x53) { *************** *** 1204,1208 **** } ! if(nonInteractiveSequence == 0) { return 0; --- 1209,1213 ---- } ! if(!userEnabled) { return 0; *************** *** 1247,1252 **** --- 1252,1265 ---- if(objIdx != -1) { + //ASSERT(0); //moveActor(X,Y,mouseVar1); } + else + { + var34 = mouseX; + var35 = mouseY; + animationStart=TRUE; + var38=0; + } } //ASSERT(0); *************** *** 1328,1332 **** s32 q=0; /* Dummy */ ! int di = 0; s16 mouseX; s16 mouseY; --- 1341,1345 ---- s32 q=0; /* Dummy */ ! int enableUser = 0; s16 mouseX; s16 mouseY; *************** *** 1359,1366 **** playerDontAskQuit = processInput(); ! if(di) { ! nonInteractiveSequence = 1; ! di = 0; } --- 1372,1379 ---- playerDontAskQuit = processInput(); ! //if(enableUser) { ! userEnabled = 1; ! enableUser = 0; } *************** *** 1406,1410 **** flipScreen(); ! if(nonInteractiveSequence && !main7 && !main15 && currentActiveMenu == -1) { getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); --- 1419,1423 ---- flipScreen(); ! /* if(userEnabled && !main7 && !main15 && currentActiveMenu == -1) { getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); *************** *** 1412,1415 **** --- 1425,1429 ---- if(mouseX != oldMouseX && mouseY != oldMouseY) { + int cursorType; int newCursor1; int newCursor2; *************** *** 1418,1425 **** oldMouseY = mouseY; ! getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2); } } ! else { changeCursor(0); --- 1432,1454 ---- 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); *************** *** 1522,1525 **** --- 1551,1555 ---- void changeCursor(u16 cursorType) { + printf("changeCursor %d\n", cursorType); } |
Update of /cvsroot/cine/cinE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16003/src Modified Files: flipSupport.c main.c part.c prc.c script.c sfxPlayer.c sfxPlayer.h soundDriver.c soundDriver.h various.c Log Message: Got rid of the 'OS' define, now LVDT/OS is autodetected Added some code to play music and sfx in OS (untested) Cleaned up the adlib sound driver code Index: soundDriver.h =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soundDriver.h 23 Oct 2005 17:15:47 -0000 1.3 --- soundDriver.h 29 Dec 2005 22:42:15 -0000 1.4 *************** *** 18,44 **** #define ADLIB_REG_WAVE_SELECT 0xE0 ! typedef void (*snd_driverSetupChannelPF)(int channelNum, const u8 *data, int instrumentNum); ! typedef void (*snd_driverSetChannelFrequencyPF)(int channelNum, int frequency); ! typedef void (*snd_driverStopChannelPF)(int channelNum); ! typedef void (*snd_driverPlaySoundPF)(u8 *data, int channelNum, int volume, int unk1, int unk2); - extern u8 snd_useAdlib, snd_useSpeaker, snd_useRoland; extern u16 snd_fadeOutCounter, snd_songTicksCounter; extern u8 *snd_adlibInstrumentsTable[4]; ! ! extern snd_driverSetupChannelPF snd_driverSetupChannel; ! extern snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; ! extern snd_driverStopChannelPF snd_driverStopChannel; ! extern snd_driverPlaySoundPF snd_driverPlaySound; extern void snd_adlibDriverInit(); extern void snd_adlibDriverExit(); - extern void snd_adlibDriverSetupChannel(int channelNum, const u8 *data, int instrumentNum); - extern void snd_adlibDriverSetChannelFrequency(int channelNum, int frequency); - extern void snd_adlibDriverStopChannel(int channelNum); extern void snd_adlibDriverStopSong(); - extern void snd_adlibInterrupt(void *param, u8 *buf, int len); - extern void snd_adlibDriverPlaySound(u8 *data, int channelNum, int volume, int unk1, int unk2); extern void snd_resetChannel(int channelNum); ! #endif --- 18,36 ---- #define ADLIB_REG_WAVE_SELECT 0xE0 ! typedef struct { ! void (*setupChannel)(int channelNum, const u8 *data, int instrumentNum); ! void (*setChannelFrequency)(int channelNum, int frequency); ! void (*stopChannel)(int channelNum); ! void (*playSound)(u8 *data, int channelNum, int volume); ! } sndDriverStruct; extern u16 snd_fadeOutCounter, snd_songTicksCounter; extern u8 *snd_adlibInstrumentsTable[4]; ! extern sndDriverStruct snd_driver; extern void snd_adlibDriverInit(); extern void snd_adlibDriverExit(); extern void snd_adlibDriverStopSong(); extern void snd_resetChannel(int channelNum); ! #endif /* _SNDDRIVER_H_ */ Index: prc.c =================================================================== RCS file: /cvsroot/cine/cinE/src/prc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** prc.c 15 Oct 2005 01:49:14 -0000 1.9 --- prc.c 29 Dec 2005 22:42:15 -0000 1.10 *************** *** 72,77 **** checkDataDisk(-1); ! #ifndef OS ! if(!strcmp(pPrcName,"AUTO00.PRC")) { unsigned char* readPtr = AUT000; --- 72,76 ---- checkDataDisk(-1); ! if (gameType == GAME_LVDT && !strcmp(pPrcName,"AUTO00.PRC")) { unsigned char* readPtr = AUT000; *************** *** 112,116 **** } else - #endif { #if 0 --- 111,114 ---- Index: flipSupport.c =================================================================== RCS file: /cvsroot/cine/cinE/src/flipSupport.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** flipSupport.c 15 Oct 2005 21:53:55 -0000 1.7 --- flipSupport.c 29 Dec 2005 22:42:15 -0000 1.8 *************** *** 38,52 **** } ! u16 readU16LE(const void *ptr) { const u8 *b = (const u8 *)ptr; return (b[1] << 8) | b[0]; } ! u16 readU16BE(const void *ptr) { const u8 *b = (const u8 *)ptr; return (b[0] << 8) | b[1]; } ! u32 readU32BE(const void *ptr) { const u8 *b = (const u8 *)ptr; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; --- 38,55 ---- } ! u16 readU16LE(const void *ptr) ! { const u8 *b = (const u8 *)ptr; return (b[1] << 8) | b[0]; } ! u16 readU16BE(const void *ptr) ! { const u8 *b = (const u8 *)ptr; return (b[0] << 8) | b[1]; } ! u32 readU32BE(const void *ptr) ! { const u8 *b = (const u8 *)ptr; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; Index: script.c =================================================================== RCS file: /cvsroot/cine/cinE/src/script.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** script.c 22 Oct 2005 22:15:34 -0000 1.31 --- script.c 29 Dec 2005 22:42:15 -0000 1.32 *************** *** 2013,2017 **** snd_stopSong(); if (flag == 0xFFFF) ! (*snd_driverPlaySound)(animDataTable[anim].ptr1, channel, volume, 0xFFFF, 0xA); else snd_resetChannel(channel); --- 2013,2017 ---- snd_stopSong(); if (flag == 0xFFFF) ! (*snd_driver.playSound)(animDataTable[anim].ptr1, channel, volume); else snd_resetChannel(channel); Index: soundDriver.c =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soundDriver.c 23 Oct 2005 17:15:47 -0000 1.4 --- soundDriver.c 29 Dec 2005 22:42:15 -0000 1.5 *************** *** 5,17 **** u8 snd_useAdlib = 0; - u8 snd_useSpeaker = 0; - u8 snd_useRoland = 0; u16 snd_fadeOutCounter = 0; u16 snd_songTicksCounter = 0; u8 *snd_adlibInstrumentsTable[4]; ! snd_driverSetupChannelPF snd_driverSetupChannel; ! snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; ! snd_driverStopChannelPF snd_driverStopChannel; ! snd_driverPlaySoundPF snd_driverPlaySound; static u8 snd_adlibVibrato = 0; --- 5,12 ---- u8 snd_useAdlib = 0; u16 snd_fadeOutCounter = 0; u16 snd_songTicksCounter = 0; u8 *snd_adlibInstrumentsTable[4]; ! sndDriverStruct snd_driver; static u8 snd_adlibVibrato = 0; *************** *** 23,27 **** }; ! static const u8 snd_adlibInitTable[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 --- 18,22 ---- }; ! static const u8 snd_adlibOpTable[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 *************** *** 50,54 **** ! void snd_adlibWriteData(int port, int value) { YM3812Write(0, 0, port); --- 45,49 ---- ! static void snd_adlibWriteData(int port, int value) { YM3812Write(0, 0, port); *************** *** 56,459 **** } ! void snd_adlibDriverInit() { ! int i; ! SDL_AudioSpec as; ! ! YM3812Init(1, OPL_INTERNAL_FREQ, SDL_OUTPUT_RATE); ! snd_adlibVibrato = 0x20; ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); ! snd_adlibWriteData(0x08, 0x40); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x40 + snd_adlibInitTable[i], 0); ! ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(0xB0 + i, 0); ! ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(0xC0 + i, 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x60 + snd_adlibInitTable[i], 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x80 + snd_adlibInitTable[i], 0); ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x20 + snd_adlibInitTable[i], 0); ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0xE0 + snd_adlibInitTable[i], 0); ! snd_adlibWriteData(1, 0x20); ! snd_adlibWriteData(1, 0); ! snd_driverSetupChannel = snd_adlibDriverSetupChannel; ! snd_driverSetChannelFrequency = snd_adlibDriverSetChannelFrequency; ! snd_driverStopChannel = snd_adlibDriverStopChannel; ! snd_driverPlaySound = snd_adlibDriverPlaySound; ! memset(&as, 0, sizeof(SDL_AudioSpec)); ! as.freq = SDL_OUTPUT_RATE; ! as.format = AUDIO_S16; ! as.channels = 1; ! as.samples = 4096; ! as.callback = snd_adlibInterrupt; ! if (SDL_OpenAudio(&as, NULL) != 0) { ! fprintf(stderr, "Error initializing adlib driver\n"); } else { ! snd_useAdlib = 1; ! SDL_PauseAudio(0); } ! for (i = 0; i < 4; ++i) { ! snd_adlibInstrumentsTable[i] = snd_emptyInstrument; ! } ! } ! void snd_adlibDriverExit() ! { ! YM3812Shutdown(); ! } ! void snd_adlibDriverSetupChannelHelper(const u8 *instrumentData, int channelNum) ! { ! const u8 *instr = instrumentData; ! u8 var2 = instr[0x36] & 3; ! u8 var1 = instr[0x38] & 3; ! ! u8 varB = *instrumentData++; ! u8 var4 = *instrumentData++; ! ! u8 _al; ! u16 varA, _di; ! s16 _ax, _si; ! instr += 2; ! if (varB != 0) { ! _al = snd_adlibNoteTable[var4 * 2 + 0]; ! _di = snd_adlibInitTable[_al]; ! _al = snd_adlibNoteTable[var4 * 2 + 1]; ! varA = snd_adlibInitTable[_al]; ! } else { ! _al = snd_adlibNoteTable[channelNum * 2 + 0]; ! _di = snd_adlibInitTable[_al]; ! _al = snd_adlibNoteTable[channelNum * 2 + 1]; ! varA = snd_adlibInitTable[_al]; ! } ! if (varB == 0 || var4 == 6) { ! _si = 0; ! if (readU16LE(instr + 0x12) != 0) { ! _si |= 0x80; ! } ! if (readU16LE(instr + 0x14) != 0) { ! _si |= 0x40; ! } ! if (readU16LE(instr + 0x0A) != 0) { ! _si |= 0x20; ! } ! if (readU16LE(instr + 0x16) != 0) { ! _si |= 0x10; ! } ! _si |= (readU16LE(instr + 0x2) & 0xF); ! snd_adlibWriteData(0x20 + _di, _si); ! ! _si = 0x3F - (readU16LE(instr + 0x10) & 0x3F); ! _si = snd_adlibChannelVolume[channelNum] * _si; ! _si += _si + 0x7F; ! _si = 0x3F - (_si / 0xFE); ! if (readU16LE(instr + 0x18) != 0) { ! _si = readU16LE(instr + 0x10) & 0x3F; } ! _si |= readU16LE(instr) << 6; ! snd_adlibWriteData(0x40 + _di, _si); ! ! _si = readU16LE(instr + 6) << 4; ! _si |= readU16LE(instr + 0xC) & 0xF; ! snd_adlibWriteData(0x60 + _di, _si); ! _si = readU16LE(instr + 8) << 4; ! _si |= readU16LE(instr + 0xE) & 0xF; ! snd_adlibWriteData(0x80 + _di, _si); ! if (varB != 0) { ! _ax = readU16LE(instr + 4) * 2; ! if (readU16LE(instr + 0x18) != 0) { ! _ax |= 0; ! } else { ! _ax |= 1; ! } ! snd_adlibWriteData(0xC0 + var4, _ax); ! } else { ! _ax = readU16LE(instr + 4) * 2; ! if (readU16LE(instr + 0x18) != 0) { ! _ax |= 0; ! } else { ! _ax |= 1; ! } ! snd_adlibWriteData(0xC0 + channelNum, _ax); } ! snd_adlibWriteData(0xE0 + _di, var2); ! instr += 0x1A; } ! _si = 0; ! if (readU16LE(instr + 0x12) != 0) { ! _si |= 0x80; ! } ! if (readU16LE(instr + 0x14) != 0) { ! _si |= 0x40; ! } ! if (readU16LE(instr + 0x0A) != 0) { ! _si |= 0x20; ! } ! if (readU16LE(instr + 0x16) != 0) { ! _si |= 0x10; ! } ! _si |= (readU16LE(instr + 0x2) & 0xF); ! snd_adlibWriteData(0x20 + varA, _si); ! ! _si = 0x3F - (readU16LE(instr + 0x10) & 0x3F); ! _si = snd_adlibChannelVolume[channelNum] * _si; ! _si += _si + 0x7F; ! _si = 0x3F - (_si / 0xFE); ! _si |= readU16LE(instr) << 6; ! snd_adlibWriteData(0x40 + varA, _si); ! _si = readU16LE(instr + 6) << 4; ! _si |= readU16LE(instr + 0xC) & 0xF; ! snd_adlibWriteData(0x60 + varA, _si); ! ! _si = readU16LE(instr + 8) << 4; ! _si |= readU16LE(instr + 0xE) & 0xF; ! snd_adlibWriteData(0x80 + varA, _si); ! snd_adlibWriteData(0xE0 + varA, var1); } ! void snd_adlibDriverSetupChannel(int channelNum, const u8 *data, int instrumentNum) { ! s16 a = snd_sfxMod.songData[instrumentNum]; ! if (a != 0 && a < 0x50) ! { ! a = 0x50; ! } ! a -= snd_fadeOutCounter; ! if (a < 0) ! { ! a = 0; ! } ! a += a / 4; ! if (a > 0x7F) { ! a = 0x7F; } - snd_adlibChannelVolume[channelNum] = a; - snd_adlibDriverSetupChannelHelper(data, channelNum); } ! void snd_adlibDriverSetChannelFrequencyHelper(int frequency, int *freq2, int *freq1) { ! int i, j; ! const s16 *noteFreq; ! if (frequency > 0x777) ! { ! i = 0; ! } ! else if (frequency > 0x3BB) ! { ! i = 1; ! } ! else if (frequency > 0x1DD) ! { ! i = 2; ! } ! else if (frequency > 0xEE) ! { ! i = 3; ! } ! else if (frequency > 0x77) ! { ! i = 4; ! } ! else if (frequency > 0x3B) ! { ! i = 5; ! } ! else if (frequency > 0x1D) ! { ! i = 6; ! } ! else ! { ! i = 7; ! } ! noteFreq = &snd_adlibNoteFreqTable[i * 0xC]; ! j = 0; ! while (*noteFreq++ > frequency && j < 0xC) ! { ! ++j; ! } ! if (j >= 0xC) ! { ! j = 0xB; ! } ! *freq1 = i; ! *freq2 = j; } ! void snd_adlibDriverSetChannelFrequency(int channelNum, int frequency) { ! u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! u8 var2 = *instr++; ! u8 var1 = *instr++; ! if (var2 != 0 && var1 == 6) ! { ! channelNum = 6; ! } ! if (var2 == 0 || channelNum == 6) ! { ! u16 f; ! u16 var8; ! int freq1, freq2; ! snd_adlibDriverSetChannelFrequencyHelper(frequency, &freq2, &freq1); ! if (channelNum == 6) ! { ! freq1 = 0; ! } ! freq2 = freq1 * 0xC + freq2; ! if (freq2 < 0) { ! freq2 = 0; ! } ! f = snd_adlibFreqTable[freq2 % 0xC]; ! snd_adlibWriteData(0xA0 + channelNum, f); /* freq_low */ ! var8 = ((freq2 / 0xC) << 2) | ((f & 0x300) >> 8); ! if (var2 == 0) { ! var8 |= 0x20; } - snd_adlibWriteData(0xB0 + channelNum, var8); /* freq_high */ - } - if (var2 != 0) - { - snd_adlibVibrato |= 1 << (10 - var1); - snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! void snd_adlibDriverStopChannel(int channelNum) { ! u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! u8 var2 = *instr++; ! u8 var1 = *instr++; ! if (var2 != 0 && var1 == 6) ! { channelNum = 6; ! } ! if (var2 == 0 || channelNum == 6) { ! snd_adlibWriteData(0xB0 + channelNum, 0); } ! if (var2 != 0) { ! snd_adlibVibrato &= (1 << (10 - var1)) ^ 0xFF; snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! void snd_adlibDriverStopSong() { ! int i; ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x40 + snd_adlibInitTable[i], 0x3F); ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(0xB0 + i, 0); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, 0); ! } ! void snd_adlibInterrupt(void *param, u8 *buf, int len) ! { ! static int samplesLeft = 0; ! while (len != 0) { ! int count; ! if (samplesLeft == 0) ! { ! if (snd_songIsPlaying || (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100)) ! { ! ++snd_songTicksCounter; ! if (snd_songTicksCounter > snd_eventsDelay * 2) ! { ! snd_handleEvents(); ! snd_songTicksCounter = 0; ! } ! } ! samplesLeft = SDL_OUTPUT_RATE / 55; ! } ! count = samplesLeft; ! if (count > len) ! { ! count = len; ! } ! YM3812UpdateOne(0, (s16 *)buf, count >> 1); ! samplesLeft -= count; ! len -= count; ! buf += count; } } ! void snd_adlibDriverPlaySound(u8 *data, int channelNum, int volume, int unk1, int unk2) { /* if (_snd_mute) return;*/ ! u8 var1, var2; assert(channelNum < 4); ! data += 0x101; snd_adlibInstrumentsTable[channelNum] = data; snd_resetChannel(channelNum); snd_adlibChannelVolume[channelNum] = 0x7F; ! snd_adlibDriverSetupChannelHelper(data, channelNum); ! var2 = *data++; ! var1 = *data++; ! if (var2 != 0 && var1 == 6) ! { channelNum = 6; ! } ! if (var2 == 0 || channelNum == 6) { ! s16 freq1, freq2; ! ! freq1 = snd_adlibFreqTable[0]; ! snd_adlibWriteData(0xA0 + channelNum, freq1); ! freq2 = 4 | ((freq1 & 0x300) >> 8); ! if (var2 == 0) ! { ! freq2 |= 0x20; ! } ! snd_adlibWriteData(0xB0 + channelNum, freq2); } ! if (var2 != 0) { ! snd_adlibVibrato = 1 << (10 - var1); snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! void snd_resetChannel(int channelNum) { ! (*snd_driverStopChannel)(channelNum); ! if (snd_useAdlib) ! { ! int i; ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(0x40 + snd_adlibInitTable[i], 0x3F); ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(0xB0 + i, 0); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, 0); } } --- 51,394 ---- } ! static void snd_adlibDriverSetupInstrument(const u8 *instrumentData, int channelNum) { ! s16 tmp; ! u8 waveSelect1 = instrumentData[54] & 3; /* var2 */ ! u8 waveSelect2 = instrumentData[56] & 3; /* var1 */ ! u8 fl = *instrumentData++; /* varB */ ! u8 ch = *instrumentData++; /* var4 */ ! u8 adlibOp1, adlibOp2; /* _di, varA */ ! if (fl != 0) { ! adlibOp1 = snd_adlibOpTable[snd_adlibNoteTable[ch * 2 + 0]]; ! adlibOp2 = snd_adlibOpTable[snd_adlibNoteTable[ch * 2 + 1]]; } else { ! adlibOp1 = snd_adlibOpTable[snd_adlibNoteTable[channelNum * 2 + 0]]; ! adlibOp2 = snd_adlibOpTable[snd_adlibNoteTable[channelNum * 2 + 1]]; } ! ! if (fl == 0 || ch == 6) { ! /* vibrato */ ! tmp = 0; ! if (readU16LE(instrumentData + 18) != 0) ! tmp |= 0x80; ! if (readU16LE(instrumentData + 20) != 0) ! tmp |= 0x40; ! if (readU16LE(instrumentData + 10) != 0) ! tmp |= 0x20; ! if (readU16LE(instrumentData + 22) != 0) ! tmp |= 0x10; ! tmp |= (readU16LE(instrumentData + 2) & 0xF); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_EG_KS + adlibOp1, tmp); ! /* key scaling */ ! tmp = 0x3F - (readU16LE(instrumentData + 16) & 0x3F); ! tmp = snd_adlibChannelVolume[channelNum] * tmp; ! tmp += tmp + 0x7F; ! tmp = 0x3F - (tmp / 0xFE); ! if (readU16LE(instrumentData + 24) != 0) ! tmp = readU16LE(instrumentData + 16) & 0x3F; ! tmp |= readU16LE(instrumentData) << 6; ! snd_adlibWriteData(ADLIB_REG_KEY_SCALING_OPERATOR_OUTPUT + adlibOp1, tmp); ! /* attack/decay rates */ ! tmp = (readU16LE(instrumentData + 6) << 4) | (readU16LE(instrumentData + 12) & 0xF); ! snd_adlibWriteData(ADLIB_REG_ATTACK_RATE_DECAY_RATE + adlibOp1, tmp); ! /* sustain/release rates */ ! tmp = (readU16LE(instrumentData + 8) << 4) | (readU16LE(instrumentData + 14) & 0xF); ! snd_adlibWriteData(ADLIB_REG_SUSTAIN_LEVEL_RELEASE_RATE_0 + adlibOp1, tmp); ! if (fl != 0) ! { ! tmp = readU16LE(instrumentData + 4) * 2; ! if (readU16LE(instrumentData + 24) == 0) ! tmp |= 1; ! ! snd_adlibWriteData(ADLIB_REG_FEEDBACK_STRENGTH_CONNECTION_TYPE + ch, tmp); } ! else ! { ! tmp = readU16LE(instrumentData + 4) * 2; ! if (readU16LE(instrumentData + 24) == 0) ! tmp |= 1; ! snd_adlibWriteData(ADLIB_REG_FEEDBACK_STRENGTH_CONNECTION_TYPE + channelNum, tmp); } ! snd_adlibWriteData(ADLIB_REG_WAVE_SELECT + adlibOp1, waveSelect1); ! instrumentData += 26; } ! /* vibrato */ ! tmp = 0; ! if (readU16LE(instrumentData + 18) != 0) ! tmp |= 0x80; ! if (readU16LE(instrumentData + 20) != 0) ! tmp |= 0x40; ! if (readU16LE(instrumentData + 10) != 0) ! tmp |= 0x20; ! if (readU16LE(instrumentData + 22) != 0) ! tmp |= 0x10; ! tmp |= (readU16LE(instrumentData + 2) & 0xF); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_EG_KS + adlibOp2, tmp); ! /* key scaling */ ! tmp = 0x3F - (readU16LE(instrumentData + 16) & 0x3F); ! tmp = snd_adlibChannelVolume[channelNum] * tmp; ! tmp += tmp + 0x7F; ! tmp = 0x3F - (tmp / 0xFE); ! tmp |= readU16LE(instrumentData) << 6; ! snd_adlibWriteData(ADLIB_REG_KEY_SCALING_OPERATOR_OUTPUT + adlibOp2, tmp); ! ! /* attack/decay rates */ ! tmp = (readU16LE(instrumentData + 6) << 4) | (readU16LE(instrumentData + 12) & 0xF); ! snd_adlibWriteData(ADLIB_REG_ATTACK_RATE_DECAY_RATE + adlibOp2, tmp); ! /* sustain/release rates */ ! tmp = (readU16LE(instrumentData + 8) << 4) | (readU16LE(instrumentData + 14) & 0xF); ! snd_adlibWriteData(ADLIB_REG_SUSTAIN_LEVEL_RELEASE_RATE_0 + adlibOp2, tmp); ! snd_adlibWriteData(ADLIB_REG_WAVE_SELECT + adlibOp2, waveSelect2); } ! static void snd_adlibInterrupt(void *param, u8 *buf, int len) { ! static int samplesLeft = 0; ! while (len != 0) { ! int count; ! if (samplesLeft == 0) ! { ! if (snd_songIsPlaying || (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100)) ! { ! ++snd_songTicksCounter; ! if (snd_songTicksCounter > snd_eventsDelay) ! { ! snd_handleEvents(); ! snd_songTicksCounter = 0; ! } ! } ! samplesLeft = SDL_OUTPUT_RATE / 55; ! } ! count = samplesLeft; ! if (count > len) ! count = len; ! ! YM3812UpdateOne(0, (s16 *)buf, count >> 1); ! samplesLeft -= count; ! len -= count; ! buf += count; } } ! static void snd_adlibDriverSetupChannel(int channelNum, const u8 *data, int instrumentNum) { ! s16 vol = snd_sfxState.songData[instrumentNum]; ! if (vol != 0 && vol < 0x50) ! vol = 0x50; ! vol -= snd_fadeOutCounter; ! if (vol < 0) ! vol = 0; ! ! vol += vol / 4; ! if (vol > 0x7F) ! vol = 0x7F; ! ! snd_adlibChannelVolume[channelNum] = vol; ! snd_adlibDriverSetupInstrument(data, channelNum); } ! static void snd_getAdlibFrequency(int frequency, int *adlibFreq) ! { ! int i; ! *adlibFreq = 95; ! for (i = 0; i < 96; ++i) ! { ! if (snd_adlibNoteFreqTable[i] <= frequency) { ! *adlibFreq = i; ! break; } } } ! static void snd_adlibDriverSetChannelFrequency(int channelNum, int frequency) ! { ! const u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! u8 fl = *instr++; /* var2 */ ! u8 ch = *instr++; /* var1 */ ! ! if (fl != 0 && ch == 6) channelNum = 6; ! ! if (fl == 0 || channelNum == 6) { ! u16 freqLow, freqHigh; /* var8 */ ! int adlibFreq; ! ! snd_getAdlibFrequency(frequency, &adlibFreq); ! if (channelNum == 6) ! adlibFreq %= 12; ! ! freqLow = snd_adlibFreqTable[adlibFreq % 12]; ! snd_adlibWriteData(ADLIB_REG_FREQUENCY_0 + channelNum, freqLow); ! freqHigh = ((adlibFreq / 12) << 2) | ((freqLow & 0x300) >> 8); ! if (fl == 0) ! freqHigh |= 0x20; ! ! snd_adlibWriteData(ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 + channelNum, freqHigh); } ! if (fl != 0) { ! snd_adlibVibrato |= 1 << (10 - ch); snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! static void snd_adlibDriverStopChannel(int channelNum) { ! const u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! u8 fl = *instr++; /* var2 */ ! u8 ch = *instr++; /* var1 */ ! if (fl != 0 && ch == 6) ! channelNum = 6; ! if (fl == 0 || channelNum == 6) ! snd_adlibWriteData(ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 + channelNum, 0); ! if (fl != 0) { ! snd_adlibVibrato &= (1 << (10 - ch)) ^ 0xFF; ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! static void snd_adlibDriverPlaySound(u8 *data, int channelNum, int volume) { /* if (_snd_mute) return;*/ ! u8 fl, ch; /* var2, var1 */ assert(channelNum < 4); ! data += 257; snd_adlibInstrumentsTable[channelNum] = data; snd_resetChannel(channelNum); snd_adlibChannelVolume[channelNum] = 0x7F; ! snd_adlibDriverSetupInstrument(data, channelNum); ! fl = *data++; ! ch = *data++; ! ! if (fl != 0 && ch == 6) channelNum = 6; ! ! if (fl == 0 || channelNum == 6) { ! u16 freqLow, freqHigh; ! freqLow = snd_adlibFreqTable[0]; ! snd_adlibWriteData(ADLIB_REG_FREQUENCY_0 + channelNum, freqLow); ! freqHigh = 4 | ((freqLow & 0x300) >> 8); ! if (fl == 0) ! freqHigh |= 0x20; ! ! snd_adlibWriteData(ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 + channelNum, freqHigh); } ! if (fl != 0) { ! snd_adlibVibrato = 1 << (10 - ch); snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } ! static sndDriverStruct snd_adlibDriver = ! { ! &snd_adlibDriverSetupChannel, ! &snd_adlibDriverSetChannelFrequency, ! &snd_adlibDriverStopChannel, ! &snd_adlibDriverPlaySound ! }; ! void snd_adlibDriverInit() ! { ! int i; ! SDL_AudioSpec as; ! ! YM3812Init(1, OPL_INTERNAL_FREQ, SDL_OUTPUT_RATE); ! snd_adlibVibrato = 0x20; ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); ! snd_adlibWriteData(0x08, 0x40); ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(ADLIB_REG_KEY_SCALING_OPERATOR_OUTPUT + snd_adlibOpTable[i], 0); ! ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 + i, 0); ! ! for (i = 0; i < 9; ++i) ! snd_adlibWriteData(ADLIB_REG_FEEDBACK_STRENGTH_CONNECTION_TYPE + i, 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(ADLIB_REG_ATTACK_RATE_DECAY_RATE + snd_adlibOpTable[i], 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(ADLIB_REG_SUSTAIN_LEVEL_RELEASE_RATE_0 + snd_adlibOpTable[i], 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_EG_KS + snd_adlibOpTable[i], 0); ! ! for (i = 0; i < 18; ++i) ! snd_adlibWriteData(ADLIB_REG_WAVE_SELECT + snd_adlibOpTable[i], 0); ! ! snd_adlibWriteData(1, 0x20); ! snd_adlibWriteData(1, 0); ! ! for (i = 0; i < 4; ++i) ! snd_adlibInstrumentsTable[i] = snd_nullInstrument; ! ! memset(&as, 0, sizeof(SDL_AudioSpec)); ! as.freq = SDL_OUTPUT_RATE; ! as.format = AUDIO_S16; ! as.channels = 1; ! as.samples = 4096; ! as.callback = snd_adlibInterrupt; ! if (SDL_OpenAudio(&as, NULL) != 0) ! { ! fprintf(stderr, "Error initializing adlib driver\n"); } + else + { + snd_useAdlib = 1; + snd_driver = snd_adlibDriver; + SDL_PauseAudio(0); + } + } + + void snd_adlibDriverExit() + { + YM3812Shutdown(); + } + + void snd_adlibDriverStopSong() + { + int i; + + for (i = 0; i < 18; ++i) + snd_adlibWriteData(ADLIB_REG_KEY_SCALING_OPERATOR_OUTPUT + snd_adlibOpTable[i], 0x3F); + + for (i = 0; i < 9; ++i) + snd_adlibWriteData(ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 + i, 0); + + snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, 0); + } + + void snd_resetChannel(int channelNum) + { + (*snd_driver.stopChannel)(channelNum); + if (snd_useAdlib) + snd_adlibDriverStopSong(); } Index: sfxPlayer.h =================================================================== RCS file: /cvsroot/cine/cinE/src/sfxPlayer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sfxPlayer.h 23 Oct 2005 17:15:47 -0000 1.2 --- sfxPlayer.h 29 Dec 2005 22:42:15 -0000 1.3 *************** *** 12,37 **** typedef struct { u8 *songData; ! } sfxModuleStruct; ! ! typedef struct { ! sfxModuleStruct *sfxMod; ! u16 currentInstrumentChannel[4]; u8 *instruments[15]; ! u16 currentOrder; ! u16 currentPos; ! u16 numOrders; } sfxStateStruct; - extern sfxModuleStruct snd_sfxMod; - extern u8 snd_emptyInstrument[]; extern u16 snd_eventsDelay; extern int snd_songIsPlaying; extern int snd_loadBasesonEntries(const char *fileName); ! extern int snd_findBasesonEntry(const char *entryName); extern void snd_stopSong(); extern void snd_freeSong(); - extern void snd_loadSongInstrument(int songInstrumentNum, int entryNum); - extern void snd_readBasesonEntry(int entryNum, u8 *dst); extern int snd_loadSong(const char *songName); extern void snd_fadeOutSong(); --- 12,31 ---- typedef struct { u8 *songData; ! int currentInstrumentChannel[4]; u8 *instruments[15]; ! int currentOrder; ! int currentPos; ! int numOrders; } sfxStateStruct; extern u16 snd_eventsDelay; extern int snd_songIsPlaying; + extern u8 snd_nullInstrument[]; + extern sfxStateStruct snd_sfxState; extern int snd_loadBasesonEntries(const char *fileName); ! extern void snd_clearBasesonEntries(); extern void snd_stopSong(); extern void snd_freeSong(); extern int snd_loadSong(const char *songName); extern void snd_fadeOutSong(); *************** *** 40,42 **** extern void snd_handlePattern(int channelNum, const u8 *patternData); ! #endif --- 34,36 ---- extern void snd_handlePattern(int channelNum, const u8 *patternData); ! #endif /* _SFXPLAYER_H_ */ Index: sfxPlayer.c =================================================================== RCS file: /cvsroot/cine/cinE/src/sfxPlayer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sfxPlayer.c 23 Oct 2005 17:15:47 -0000 1.4 --- sfxPlayer.c 29 Dec 2005 22:42:15 -0000 1.5 *************** *** 3,17 **** - sfxModuleStruct snd_sfxMod; - u8 snd_mute = 0; u16 snd_eventsDelay; int snd_songIsPlaying = 0; ! u8 snd_emptyInstrument[] = { 0, 0 }; ! static sfxStateStruct snd_sfxState; ! static u16 snd_numBasesonEntries; ! static BasesonEntryStruct *snd_basesonEntries; ! static FILE *snd_baseSndFile = 0; ! static char snd_songFileName[0x1E]; --- 3,17 ---- u16 snd_eventsDelay; int snd_songIsPlaying = 0; ! u8 snd_nullInstrument[] = { 0, 0 }; ! sfxStateStruct snd_sfxState; ! static u8 snd_mute = 0; ! static char snd_songFileName[30]; ! /* LVDT specific */ ! static FILE *snd_baseSndFile = NULL; ! static u16 snd_numBasesonEntries = 0; ! static BasesonEntryStruct *snd_basesonEntries = NULL; *************** *** 36,60 **** snd_baseSndFile = fopen(fileName, "rb"); if (!snd_baseSndFile) ! { ! fprintf(stderr, "Can't open '%s'\n", fileName); ! return 0; ! } snd_numBasesonEntries = fread_u16BE(snd_baseSndFile); fread_u16BE(snd_baseSndFile); /* entry_size */ snd_basesonEntries = (BasesonEntryStruct *)malloc(snd_numBasesonEntries * sizeof(BasesonEntryStruct)); ! assert(snd_basesonEntries); ! for (i = 0; i < snd_numBasesonEntries; ++i) { ! BasesonEntryStruct *be = &snd_basesonEntries[i]; ! fread(be->name, 14, 1, snd_baseSndFile); ! be->offset = fread_u32BE(snd_baseSndFile); ! be->size = fread_u32BE(snd_baseSndFile); ! be->unpackedSize = fread_u32BE(snd_baseSndFile); ! fread_u32BE(snd_baseSndFile); /* unused */ } ! return 1; } ! int snd_findBasesonEntry(const char *entryName) { int i; --- 36,72 ---- snd_baseSndFile = fopen(fileName, "rb"); if (!snd_baseSndFile) ! return -1; ! snd_numBasesonEntries = fread_u16BE(snd_baseSndFile); fread_u16BE(snd_baseSndFile); /* entry_size */ snd_basesonEntries = (BasesonEntryStruct *)malloc(snd_numBasesonEntries * sizeof(BasesonEntryStruct)); ! if (snd_basesonEntries) { ! for (i = 0; i < snd_numBasesonEntries; ++i) ! { ! BasesonEntryStruct *be = &snd_basesonEntries[i]; ! fread(be->name, 14, 1, snd_baseSndFile); ! be->offset = fread_u32BE(snd_baseSndFile); ! be->size = fread_u32BE(snd_baseSndFile); ! be->unpackedSize = fread_u32BE(snd_baseSndFile); ! fread_u32BE(snd_baseSndFile); /* unused */ ! } } ! return 0; } ! void snd_clearBasesonEntries() ! { ! if (snd_baseSndFile) ! { ! fclose(snd_baseSndFile); ! snd_baseSndFile = NULL; ! } ! free(snd_basesonEntries); ! snd_basesonEntries = NULL; ! snd_numBasesonEntries = 0; ! } ! ! static int snd_findBasesonEntry(const char *entryName) { int i; *************** *** 67,89 **** { if (*p >= 'a' && *p <= 'z') - { *p += 'A' - 'a'; - } } ! i = 0; ! while (i < snd_numBasesonEntries) { if (strcmp(snd_basesonEntries[i].name, basesonEntryName) == 0) - { return i; - } - else - { - ++i; - } } return -1; } void snd_stopSong() { --- 79,135 ---- { if (*p >= 'a' && *p <= 'z') *p += 'A' - 'a'; } ! ! for (i = 0; i < snd_numBasesonEntries; ++i) { if (strcmp(snd_basesonEntries[i].name, basesonEntryName) == 0) return i; } return -1; } + static u8 *snd_loadBasesonEntry(const char *entryName) + { + int entryNum; + u8 *entryData = NULL; + + if (gameType == GAME_OS) + { + entryNum = findFileInBundle((const u8*)entryName); + if (entryNum != -1) + entryData = readBundleFile(entryNum); + } + else + { + entryNum = snd_findBasesonEntry(entryName); + if (entryNum != -1 && entryNum < snd_numBasesonEntries) + { + const BasesonEntryStruct *be = &snd_basesonEntries[entryNum]; + entryData = (u8 *)malloc(be->unpackedSize); + if (entryData) + { + if (be->unpackedSize > be->size) + { + u8 *tempData = (u8 *)malloc(be->size); + if (tempData) + { + fseek(snd_baseSndFile, be->offset, SEEK_SET); + fread(tempData, be->size, 1, snd_baseSndFile); + decomp(tempData + be->size - 4, entryData + be->unpackedSize, be->unpackedSize); + free(tempData); + } + } + else + { + fseek(snd_baseSndFile, be->offset, SEEK_SET); + fread(entryData, be->size, 1, snd_baseSndFile); + } + } + } + } + return entryData; + } + void snd_stopSong() { *************** *** 95,103 **** for (i = 0; i < 4; ++i) ! (*snd_driverStopChannel)(i); ! ! if (snd_useAdlib) ! snd_adlibDriverStopSong(); snd_freeSong(); } --- 141,147 ---- for (i = 0; i < 4; ++i) ! (*snd_driver.stopChannel)(i); + snd_adlibDriverStopSong(); snd_freeSong(); } *************** *** 108,163 **** for (i = 0; i < 15; ++i) { ! if (snd_sfxState.instruments[i] != snd_emptyInstrument) ! { free(snd_sfxState.instruments[i]); - snd_sfxState.instruments[i] = 0; - } - } - free(snd_sfxMod.songData); - snd_sfxMod.songData = 0; - } - - void snd_loadSongInstrument(int instrumentNum, int entryNum) - { - if (!snd_useSpeaker) - { - BasesonEntryStruct *be; - - assert(entryNum < snd_numBasesonEntries); - be = &snd_basesonEntries[entryNum]; - snd_sfxState.instruments[instrumentNum] = (u8 *)malloc(be->unpackedSize); - if (snd_sfxState.instruments[instrumentNum]) - { - if (be->unpackedSize > be->size) - { - u8 *tempData = (u8 *)malloc(be->size); - assert(tempData); - snd_readBasesonEntry(entryNum, tempData); - decomp(tempData + be->size - 4, snd_sfxState.instruments[instrumentNum] + be->unpackedSize, be->unpackedSize); - free(tempData); - } - else - { - snd_readBasesonEntry(entryNum, snd_sfxState.instruments[instrumentNum]); - } - } - // if (snd_useRoland) { - // u8 *p = snd_sfxState.instruments[instrumentNum]; - // if (p[0] >= 0x80 && p[0] <= 0xC0) - // { - // snd_roland_init_instrument((instrumentNum << 9) + 8, p + 1, be->unpackedSize - 1); - // } - // } } ! } ! ! void snd_readBasesonEntry(int entryNum, u8 *dst) ! { ! BasesonEntryStruct *be; ! ! assert(entryNum < snd_numBasesonEntries); ! be = &snd_basesonEntries[entryNum]; ! fseek(snd_baseSndFile, be->offset, SEEK_SET); ! fread(dst, be->size, 1, snd_baseSndFile); } --- 152,160 ---- for (i = 0; i < 15; ++i) { ! if (snd_sfxState.instruments[i] != snd_nullInstrument) free(snd_sfxState.instruments[i]); } ! free(snd_sfxState.songData); ! memset(&snd_sfxState, 0, sizeof(snd_sfxState)); } *************** *** 165,233 **** { int i; - const u8 *p; - BasesonEntryStruct *be; while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) SDL_Delay(40); snd_fadeOutCounter = 0; if (snd_songIsPlaying) snd_stopSong(); strcpy(snd_songFileName, songName); ! i = snd_findBasesonEntry(songName); ! if (i == -1) ! { ! fprintf(stderr, "Invalid song name '%s'\n", songName); return 0; - } - be = &snd_basesonEntries[i]; - snd_sfxMod.songData = (u8 *)malloc(be->unpackedSize); - if (be->unpackedSize > be->size) - { - u8 *tempData = (u8 *)malloc(be->size); - assert(tempData); - snd_readBasesonEntry(i, tempData); - decomp(tempData + be->size - 4, snd_sfxMod.songData + be->unpackedSize, be->unpackedSize); - free(tempData); - } - else - { - snd_readBasesonEntry(i, snd_sfxMod.songData); - } - p = snd_sfxMod.songData + 0x14; for (i = 0; i < 15; ++i) { char instrumentName[13]; ! snd_sfxState.instruments[i] = snd_emptyInstrument; ! memcpy(instrumentName, p, 12); instrumentName[12] = '\0'; if (strlen(instrumentName) != 0) { - int sn; char *dot = strrchr(instrumentName, '.'); ! if (dot) { ! *dot = '\0'; ! } ! if (snd_useRoland) ! { ! strcat(instrumentName, ".H32"); ! } ! else if (snd_useSpeaker) ! { ! strcat(instrumentName, ".HP"); ! } else - { strcat(instrumentName, ".INS"); ! } ! sn = snd_findBasesonEntry(instrumentName); ! if (sn != -1) ! { ! snd_loadSongInstrument(i, sn); ! } } - p += 30; } return 1; --- 162,205 ---- { int i; while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) SDL_Delay(40); + snd_fadeOutCounter = 0; if (snd_songIsPlaying) snd_stopSong(); + + if (gameType == GAME_OS && strncmp(songName, "INTRO", 5) == 0) + return 0; + strcpy(snd_songFileName, songName); + if (gameType == GAME_OS) + strcat(snd_songFileName, ".IST"); ! snd_sfxState.songData = snd_loadBasesonEntry(songName); ! if (!snd_sfxState.songData) return 0; for (i = 0; i < 15; ++i) { char instrumentName[13]; ! memcpy(instrumentName, snd_sfxState.songData + 20 + i * 30, 12); instrumentName[12] = '\0'; + + snd_sfxState.instruments[i] = snd_nullInstrument; if (strlen(instrumentName) != 0) { char *dot = strrchr(instrumentName, '.'); ! if (dot) ! *dot = '\0'; ! ! if (gameType == GAME_OS) ! strcat(instrumentName, ".ADL"); else strcat(instrumentName, ".INS"); ! ! snd_sfxState.instruments[i] = snd_loadBasesonEntry(instrumentName); } } return 1; *************** *** 241,263 **** snd_songIsPlaying = 0; snd_fadeOutCounter = 1; - if (snd_useSpeaker != 0) - { - snd_fadeOutCounter = 100; - } } } ! void snd_playSong() { if (strlen(snd_songFileName) != 0) { ! snd_sfxState.sfxMod = &snd_sfxMod; ! snd_sfxState.currentInstrumentChannel[0] = 0xFFFF; ! snd_sfxState.currentInstrumentChannel[1] = 0xFFFF; ! snd_sfxState.currentInstrumentChannel[2] = 0xFFFF; ! snd_sfxState.currentInstrumentChannel[3] = 0xFFFF; snd_sfxState.currentOrder = 0; snd_sfxState.currentPos = 0; ! snd_sfxState.numOrders = snd_sfxMod.songData[0x1D6]; ! snd_eventsDelay = (252 - snd_sfxMod.songData[0x1D7]) * 55 / 1060; snd_songTicksCounter = 0; snd_songIsPlaying = 1; --- 213,231 ---- snd_songIsPlaying = 0; snd_fadeOutCounter = 1; } } ! void snd_playSong() ! { if (strlen(snd_songFileName) != 0) { ! snd_sfxState.currentInstrumentChannel[0] = -1; ! snd_sfxState.currentInstrumentChannel[1] = -1; ! snd_sfxState.currentInstrumentChannel[2] = -1; ! snd_sfxState.currentInstrumentChannel[3] = -1; snd_sfxState.currentOrder = 0; snd_sfxState.currentPos = 0; ! snd_sfxState.numOrders = snd_sfxState.songData[470]; ! snd_eventsDelay = (252 - snd_sfxState.songData[471]) * 55 * 2 / 1060; snd_songTicksCounter = 0; snd_songIsPlaying = 1; *************** *** 268,274 **** { int i; ! const u8 *patternData = snd_sfxState.sfxMod->songData + 0x258; ! const u8 *orderTable = snd_sfxState.sfxMod->songData + 0x1D8; u16 patternNum = orderTable[snd_sfxState.currentOrder] * 1024; for (i = 0; i < 4; ++i) { --- 236,243 ---- { int i; ! const u8 *patternData = snd_sfxState.songData + 600; ! const u8 *orderTable = snd_sfxState.songData + 472; u16 patternNum = orderTable[snd_sfxState.currentOrder] * 1024; + for (i = 0; i < 4; ++i) { *************** *** 276,283 **** patternData += 4; } if (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) - { snd_fadeOutCounter += 4; ! } snd_sfxState.currentPos += 16; if (snd_sfxState.currentPos >= 1024) --- 245,252 ---- patternData += 4; } + if (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) snd_fadeOutCounter += 4; ! snd_sfxState.currentPos += 16; if (snd_sfxState.currentPos >= 1024) *************** *** 286,292 **** ++snd_sfxState.currentOrder; if (snd_sfxState.currentOrder == snd_sfxState.numOrders) - { snd_sfxState.currentOrder = 0; - } } } --- 255,259 ---- *************** *** 294,329 **** void snd_handlePattern(int channelNum, const u8 *patternData) { ! u16 instrumentNumber = patternData[2] >> 4; ! snd_adlibInstrumentsTable[channelNum] = snd_emptyInstrument; ! if (instrumentNumber != 0) { ! assert(channelNum < 4); ! if (snd_sfxState.currentInstrumentChannel[channelNum] != instrumentNumber) { ! snd_sfxState.currentInstrumentChannel[channelNum] = instrumentNumber; ! (*snd_driverSetupChannel)(channelNum, snd_sfxState.instruments[instrumentNumber - 1], instrumentNumber - 1); } else if (snd_fadeOutCounter != 0) { ! instrumentNumber = snd_sfxState.currentInstrumentChannel[channelNum]; ! if (instrumentNumber != 0) ! { ! (*snd_driverSetupChannel)(channelNum, snd_sfxState.instruments[instrumentNumber - 1], instrumentNumber - 1); ! } } ! snd_adlibInstrumentsTable[channelNum] = snd_sfxState.instruments[instrumentNumber - 1]; } if (snd_mute != 0) ! { ! (*snd_driverStopChannel)(channelNum); ! } else { ! s16 freq = readU16BE(patternData); if (freq > 0) { ! (*snd_driverStopChannel)(channelNum); ! (*snd_driverSetChannelFrequency)(channelNum, freq); } ! } } --- 261,291 ---- void snd_handlePattern(int channelNum, const u8 *patternData) { ! u16 instrNum = patternData[2] >> 4; ! snd_adlibInstrumentsTable[channelNum] = snd_nullInstrument; ! if (instrNum != 0) { ! if (snd_sfxState.currentInstrumentChannel[channelNum] != instrNum) { ! snd_sfxState.currentInstrumentChannel[channelNum] = instrNum; ! (*snd_driver.setupChannel)(channelNum, snd_sfxState.instruments[instrNum - 1], instrNum - 1); } else if (snd_fadeOutCounter != 0) { ! instrNum = snd_sfxState.currentInstrumentChannel[channelNum]; ! if (instrNum != 0) ! (*snd_driver.setupChannel)(channelNum, snd_sfxState.instruments[instrNum - 1], instrNum - 1); } ! snd_adlibInstrumentsTable[channelNum] = snd_sfxState.instruments[instrNum - 1]; } if (snd_mute != 0) ! (*snd_driver.stopChannel)(channelNum); else { ! s16 freq = (s16)readU16BE(patternData); if (freq > 0) { ! (*snd_driver.stopChannel)(channelNum); ! (*snd_driver.setChannelFrequency)(channelNum, freq); } ! } } Index: part.c =================================================================== RCS file: /cvsroot/cine/cinE/src/part.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** part.c 15 Oct 2005 02:12:59 -0000 1.13 --- part.c 29 Dec 2005 22:42:15 -0000 1.14 *************** *** 75,81 **** } ! #ifndef OS ! loadPal(partName); ! #endif // openBaseSon("BASESON.SND"); --- 75,80 ---- } ! if (gameType == GAME_LVDT) ! loadPal(partName); // openBaseSon("BASESON.SND"); Index: various.c =================================================================== RCS file: /cvsroot/cine/cinE/src/various.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** various.c 23 Oct 2005 17:15:47 -0000 1.28 --- various.c 29 Dec 2005 22:42:15 -0000 1.29 *************** *** 19,27 **** #include "cinE.h" ! #ifdef OS ! gameTypeEnum gameType = GAME_OS; ! #else ! gameTypeEnum gameType = GAME_LVDT; ! #endif s16 allowSystemMenu = 0; --- 19,23 ---- #include "cinE.h" ! gameTypeEnum gameType; s16 allowSystemMenu = 0; Index: main.c =================================================================== RCS file: /cvsroot/cine/cinE/src/main.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** main.c 15 Oct 2005 21:53:55 -0000 1.19 --- main.c 29 Dec 2005 22:42:15 -0000 1.20 *************** *** 40,48 **** partBuffer = (partBufferStruct*)malloc(255*sizeof(animDataStruct)); ! // if(gameType == GAME_LVDT) ! loadTextData("texte.dat",textDataPtr); ! snd_loadBasesonEntries("BASESON.SND"); ! for(i=0;i<NUM_MAX_OBJECT;i++) --- 40,51 ---- partBuffer = (partBufferStruct*)malloc(255*sizeof(animDataStruct)); ! /* load the sound/music bundle for LVDT and detect the game */ ! /* we're trying to run at the same time */ ! if (snd_loadBasesonEntries("BASESON.SND") != -1) ! gameType = GAME_LVDT; ! else ! gameType = GAME_OS; + loadTextData("texte.dat",textDataPtr); for(i=0;i<NUM_MAX_OBJECT;i++) *************** *** 193,197 **** #endif mainLoop(1); ! snd_adlibDriverExit(); SDL_Quit(); --- 196,203 ---- #endif mainLoop(1); ! ! if (gameType == GAME_LVDT) ! snd_clearBasesonEntries(); ! snd_adlibDriverExit(); SDL_Quit(); |
From: Richard <tri...@us...> - 2005-11-10 20:40:45
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14232/src Modified Files: font.c font.h gfxModule.c mainDraw.c polys.c Log Message: - fixed cut letters in font drawing - other minor cleanup Index: font.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/font.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** font.h 7 Nov 2005 17:31:35 -0000 1.8 --- font.h 10 Nov 2005 20:40:33 -0000 1.9 *************** *** 10,19 **** void flipGen(void* var, s32 length); ! s32 getLineHeight(s16 charCount, u8* fontPtr, u8* fontPrt_Desc); // fontProc1 ! s32 getTextLineCount(s32 param1, s32 param2, u8* ptr, u8* textString); // fontProc2 ! void renderWord(u8* fontPtr_Data, u8* outBufferPtr, s32 drawPosPixel_X, s32 height, s32 param3, s32 param4, s32 stringRenderBufferSize, s32 width); ! gfxEntryStruct* renderText(int inRightBorder_X, u8* textString); void drawString(s32 x, s32 y, u8* string, u8* buffer, u8 color, s32 inRightBorder_X); ! #endif --- 10,19 ---- void flipGen(void* var, s32 length); ! s32 getLineHeight(s16 charCount, u8* fontPtr, u8* fontPrt_Desc); // fontProc1 ! s32 getTextLineCount(s32 rightBorder_X, s32 wordSpacingWidth, u8* ptr, u8* textString); // fontProc2 ! void renderWord(u8* fontPtr_Data, u8* outBufferPtr, s32 drawPosPixel_X, s32 heightOff, s32 height, s32 param4, s32 stringRenderBufferSize, s32 width , s32 charWidth); ! gfxEntryStruct* renderText(int inRightBorder_X, u8* string); void drawString(s32 x, s32 y, u8* string, u8* buffer, u8 color, s32 inRightBorder_X); ! #endif \ No newline at end of file Index: gfxModule.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/gfxModule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gfxModule.c 6 Nov 2005 01:25:13 -0000 1.4 --- gfxModule.c 10 Nov 2005 20:40:33 -0000 1.5 *************** *** 1,37 **** #include "cruise.h" ! char page00[320*200]; ! char page10[320*200]; ! char screen[320*200]; palEntry lpalette[256]; gfxModuleDataStruct gfxModuleData = { 0, // field_1 ! 0, // use Tandy ! 0, // use EGA ! 1, // use VGA ! page00, // pPage00 ! page10, // pPage10 }; void gfxModuleData_gfxClearFrameBuffer(u8* ptr) { ! memset(ptr,0,64000); } ! void gfxModuleData_gfxCopyScreen(char* sourcePtr,char* destPtr) { ! memcpy(destPtr,sourcePtr,64000); } ! void outputBit(char* buffer,int bitPlaneNumber, u8 data) { ! *(buffer+(8000*bitPlaneNumber)) = data; } - short globalAtariScreen[320*200/4]; void gfxModuleData_field_60(char* sourcePtr, int width, int height, char* destPtr, int x, int y) --- 1,37 ---- #include "cruise.h" ! char page00[320 * 200]; ! char page10[320 * 200]; ! char screen[320 * 200]; palEntry lpalette[256]; + short globalAtariScreen[320 * 200 / 4]; gfxModuleDataStruct gfxModuleData = { 0, // field_1 ! 0, // use Tandy ! 0, // use EGA ! 1, // use VGA ! page00, // pPage00 ! page10, // pPage10 }; void gfxModuleData_gfxClearFrameBuffer(u8* ptr) { ! memset(ptr, 0, 64000); } ! void gfxModuleData_gfxCopyScreen(char* sourcePtr, char* destPtr) { ! memcpy(destPtr, sourcePtr, 64000); } ! void outputBit(char* buffer, int bitPlaneNumber, u8 data) { ! *(buffer +(8000 * bitPlaneNumber)) = data; } void gfxModuleData_field_60(char* sourcePtr, int width, int height, char* destPtr, int x, int y) *************** *** 521,525 **** int i; ! for(i=0;i<256;i++) { R=*(ptr++); --- 521,525 ---- int i; ! for(i = 0; i < 256;i++) { R=*(ptr++); *************** *** 541,550 **** int B; ! for(i=0;i<16;i++) { #define convertRatio 36.571428571428571428571428571429 short int atariColor = *(s16*)ptr; //flipShort(&atariColor); ! ptr+=2; R = (int)(convertRatio*((atariColor & 0x700) >> 8)); --- 541,550 ---- int B; ! for(i = 0; i < 16; i++) { #define convertRatio 36.571428571428571428571428571429 short int atariColor = *(s16*)ptr; //flipShort(&atariColor); ! ptr += 2; R = (int)(convertRatio*((atariColor & 0x700) >> 8)); *************** *** 552,560 **** B = (int)(convertRatio*((atariColor & 0x007))); ! if(R>0xFF) R = 0xFF; ! if(G>0xFF) G = 0xFF; ! if(B>0xFF) B = 0xFF; --- 552,560 ---- B = (int)(convertRatio*((atariColor & 0x007))); ! if(R > 0xFF) R = 0xFF; ! if(G> 0xFF) G = 0xFF; ! if(B >0xFF) B = 0xFF; *************** *** 584,595 **** int j; ! x =0; y = 0; ! for(i=0;i<height;i++) { ! for(j=0;j<width;j++) { ! dest[(y+i)*320/4+x+j] = sourceBuffer[i*width+j]; } } --- 584,595 ---- int j; ! x = 0; y = 0; ! for(i = 0; i < height; i++) { ! for(j = 0; j < width; j++) { ! dest[(y + i) * 320 / 4 + x + j] = sourceBuffer[i * width + j]; } } *************** *** 603,624 **** } - void flip() { int i; ! char paletteRGBA[256*4]; u8* outPtr = scaledScreen; ! u8* inPtr = globalScreen; for(i=0;i<256;i++) { ! paletteRGBA[i*4] = lpalette[i].R; ! paletteRGBA[i*4+1] = lpalette[i].G; ! paletteRGBA[i*4+2] = lpalette[i].B; ! paletteRGBA[i*4+3] = 0xFF; } ! for(i=0;i<200;i++) { int j; --- 603,623 ---- } void flip() { int i; ! char paletteRGBA[256 * 4]; u8* outPtr = scaledScreen; ! u8* inPtr = globalScreen; for(i=0;i<256;i++) { ! paletteRGBA[i * 4 + 0] = lpalette[i].R; ! paletteRGBA[i * 4 + 1] = lpalette[i].G; ! paletteRGBA[i * 4 + 2] = lpalette[i].B; ! paletteRGBA[i * 4 + 3] = 0xFF; } ! for(i = 0; i < 200; i++) { int j; *************** *** 636,643 **** *(outPtr++) = *(copySource++); } ! } setPalette(paletteRGBA); ! Flip((u8*)scaledScreen); ! } --- 635,642 ---- *(outPtr++) = *(copySource++); } ! } setPalette(paletteRGBA); ! Flip((u8*) scaledScreen); ! } \ No newline at end of file Index: font.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/font.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** font.c 7 Nov 2005 17:31:35 -0000 1.13 --- font.c 10 Nov 2005 20:40:33 -0000 1.14 *************** *** 12,16 **** return(0); } ! dest = fontPrt_Desc + 6; // fontPtr + 20 for(i = 0; i < charCount; i++) --- 12,16 ---- return(0); } ! dest = fontPrt_Desc + 6; // fontPtr + 20 // char height for(i = 0; i < charCount; i++) *************** *** 25,29 **** } - // this function determins how many lines the text will have (old: fontProc2(s32 param1, s32 param2, u8* ptr, u8* string)) s32 getTextLineCount(s32 rightBorder_X, s32 wordSpacingWidth, u8* ptr, u8* textString) --- 25,28 ---- *************** *** 33,38 **** u8 character; ! s32 var_6 = 0; ! s32 var_4 = 0; u8* tempPtr; --- 32,37 ---- u8 character; ! s32 var_6 = 0; ! s32 lineLength = 0; u8* tempPtr; *************** *** 51,55 **** if(character == '|') { ! var_4 = rightBorder_X; localString = tempPtr; } --- 50,54 ---- if(character == '|') { ! lineLength = rightBorder_X; localString = tempPtr; } *************** *** 58,62 **** if(charData >= 0) { // + 0xA jump to last 2 bytes of the 12 bytes slice = letter width ! var_4 += wordSpacingWidth + *(s16*) (ptr + 0xA + charData * 12); } else --- 57,61 ---- if(charData >= 0) { // + 0xA jump to last 2 bytes of the 12 bytes slice = letter width ! lineLength += wordSpacingWidth + *(s16*) (ptr + 0xA + charData * 12); } else *************** *** 64,68 **** if(character == ' ') { ! var_4 += wordSpacingWidth + 5; localString = currentStringPtr; } --- 63,67 ---- if(character == ' ') { ! lineLength += wordSpacingWidth + 5; localString = currentStringPtr; } *************** *** 72,81 **** tempPtr = currentStringPtr; ! if(rightBorder_X <= var_4) { var_6 += rightBorder_X; currentStringPtr = localString; tempPtr = localString; ! var_4 = 0; } --- 71,80 ---- tempPtr = currentStringPtr; ! if(rightBorder_X <= lineLength) { var_6 += rightBorder_X; currentStringPtr = localString; tempPtr = localString; ! lineLength = 0; } *************** *** 85,89 **** } while(character); ! if(var_4 == 0) { return (var_6 / rightBorder_X); --- 84,88 ---- } while(character); ! if(lineLength == 0) { return (var_6 / rightBorder_X); *************** *** 141,150 **** currentPtr = _systemFNT + 14; ! for(i = 0; i < *(s16*) (_systemFNT+8); i++) { ! flipLong((s32*)currentPtr); currentPtr += 4; ! flipGen(currentPtr,8); currentPtr += 8; } --- 140,149 ---- currentPtr = _systemFNT + 14; ! for(i = 0; i < *(s16*) (_systemFNT + 8); i++) { ! flipLong((s32*) currentPtr); currentPtr += 4; ! flipGen(currentPtr, 8); currentPtr += 8; } *************** *** 164,168 **** colorOfSelectedSaveDrive = 10; ! for(i=0;i<64;i++) { mediumVar[i].ptr = 0; --- 163,167 ---- colorOfSelectedSaveDrive = 10; ! for(i = 0; i < 64; i++) { mediumVar[i].ptr = 0; *************** *** 182,186 **** loadFNT("system.fnt"); - } --- 181,184 ---- *************** *** 220,261 **** ! void renderWord(u8* fontPtr_Data, u8* outBufferPtr, s32 drawPosPixel_X, s32 height, s32 param3, s32 param4, s32 stringRenderBufferSize, s32 width) { int i; int j; ! u8* ptr2 = fontPtr_Data + param3 * 2; ! outBufferPtr += height * width * 2; // param2 = height , param6 = width ! outBufferPtr += drawPosPixel_X; // param1 = drawPosPixel_X ! for(i = 0; i < param3; i++) { ! u8 outputColor; ! u8 currentColor1 = *(fontPtr_Data++); ! u8 currentColor2 = *(ptr2++); ! fontPtr_Data++; ! ptr2++; ! for(j = 0; j < 8; j++) { ! outputColor = 0; ! if(currentColor1 & 0x80) ! { ! outputColor |= 1; ! } ! if(currentColor2 & 0x80) ! { ! outputColor |= 2; ! } ! ! *outBufferPtr |= outputColor; outBufferPtr++; ! ! currentColor1 <<= 1; ! currentColor2 <<= 1; } ! ! outBufferPtr += (width * 2) - 8; } } --- 218,247 ---- ! void renderWord(u8* fontPtr_Data, u8* outBufferPtr, s32 drawPosPixel_X, s32 heightOff, s32 height, s32 param4, s32 stringRenderBufferSize, s32 width, s32 charWidth) { int i; int j; ! u8* fontPtr_Data2 = fontPtr_Data + height * 2; ! outBufferPtr += heightOff * width * 2; // param2 = height , param6 = width ! outBufferPtr += drawPosPixel_X; // param1 = drawPosPixel_X ! for(i = 0; i < height; i++) // y++ { ! u16 currentColor1 = (*(fontPtr_Data) << 8) | *(fontPtr_Data + 1); ! u16 currentColor2 = (*(fontPtr_Data2) << 8) | *(fontPtr_Data2 + 1); ! fontPtr_Data += 2; ! fontPtr_Data2 += 2; ! for (j = 0; j < charWidth; j++) { ! *outBufferPtr = ((currentColor1 >> 15) & 1) | ((currentColor2 >> 14) & 2); outBufferPtr++; ! ! currentColor1 <<= 1; ! currentColor2 <<= 1; } ! outBufferPtr += (width * 2) - charWidth; } } *************** *** 343,347 **** // s32 var_8; // don't need that on s32 heightOffset; // var_12 ! s32 var_1E; int needFlip; --- 329,333 ---- // s32 var_8; // don't need that on s32 heightOffset; // var_12 ! s32 renderBufferSize; // var_1E int needFlip; *************** *** 435,439 **** // var_8 = 0; heightOffset = 0; ! var_1E = stringRenderBufferSize; do --- 421,425 ---- // var_8 = 0; heightOffset = 0; ! renderBufferSize = stringRenderBufferSize; do *************** *** 483,489 **** //int var_2 = si[5]; ! renderWord(fontPtr_Data + si[0], currentStrRenderBuffer, drawPosPixel_X, si[4] - si[3] + lineHeight + heightOffset, si[3], si[2], var_1E / 2, stringWidth * 2); ! drawPosPixel_X += var1 + si[5]; } } --- 469,475 ---- //int var_2 = si[5]; ! renderWord(fontPtr_Data + si[0], currentStrRenderBuffer, drawPosPixel_X, si[4] - si[3] + lineHeight + heightOffset, si[3], si[2], renderBufferSize / 2, stringWidth * 2, si[5]); ! drawPosPixel_X += wordSpacingWidth + si[5]; } } *************** *** 552,560 **** u8* currentStrRenderBuffer; // s32 var_8; // don't need that one ! s32 heightOffset; // var_12 // how much pixel lines have already been drawn // s32 var_1E; gfxEntryStruct* generatedGfxEntry; ! // check if string is emptys if(!string) { --- 538,546 ---- u8* currentStrRenderBuffer; // s32 var_8; // don't need that one ! s32 heightOffset; // var_12 // how much pixel-lines have already been drawn // s32 var_1E; gfxEntryStruct* generatedGfxEntry; ! // check if string is empty if(!string) { *************** *** 567,571 **** fontPtr = filesDatabase[fontFileIndex].subData.ptr; ! if(!fontPtr) { fontPtr = _systemFNT; } --- 553,558 ---- fontPtr = filesDatabase[fontFileIndex].subData.ptr; ! if(!fontPtr) ! { fontPtr = _systemFNT; } *************** *** 580,585 **** return NULL; } ! fontPtr_Data = fontPtr + *(s16*) (fontPtr + 4); // offset to the char data ! fontPtr_Desc = fontPtr + 14; // offset to decription lineHeight = getLineHeight(*(s16*) (fontPtr + 8), fontPtr, fontPtr_Desc); // ok --- 567,572 ---- return NULL; } ! fontPtr_Data = fontPtr + *(s16*) (fontPtr + 4); // offset to char data ! fontPtr_Desc = fontPtr + 14; // offset to char description lineHeight = getLineHeight(*(s16*) (fontPtr + 8), fontPtr, fontPtr_Desc); // ok *************** *** 611,615 **** currentStrRenderBuffer = (u8*) mallocAndZero(stringRenderBufferSize); ! resetRaster(currentStrRenderBuffer,stringRenderBufferSize); generatedGfxEntry = (gfxEntryStruct*) malloc(sizeof(gfxEntryStruct)); --- 598,602 ---- currentStrRenderBuffer = (u8*) mallocAndZero(stringRenderBufferSize); ! resetRaster(currentStrRenderBuffer, stringRenderBufferSize); generatedGfxEntry = (gfxEntryStruct*) malloc(sizeof(gfxEntryStruct)); *************** *** 655,659 **** //drawPosPixel_X = var_8; ! // draw line, character wise do { --- 642,646 ---- //drawPosPixel_X = var_8; ! // draw textline, character wise do { *************** *** 674,679 **** short int* si = (s16*) (fontPtr_Desc + charData * 12); // offset font data // int var_2 = si[5]; // don't need this ! // si[0] = pos in fontData ! renderWord(fontPtr_Data + si[0], currentStrRenderBuffer, drawPosPixel_X, si[4] - si[3] + lineHeight + heightOffset, si[3], si[2], stringRenderBufferSize, stringWidth / 2); drawPosPixel_X += wordSpacingWidth + si[5]; --- 661,667 ---- short int* si = (s16*) (fontPtr_Desc + charData * 12); // offset font data // int var_2 = si[5]; // don't need this ! ! // should ist be stringRenderBufferSize/2 for the second last param? ! renderWord(fontPtr_Data + si[0], currentStrRenderBuffer, drawPosPixel_X, si[4] - si[3] + lineHeight + heightOffset, si[3], si[2], stringRenderBufferSize, stringWidth / 2, si[5]); drawPosPixel_X += wordSpacingWidth + si[5]; Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** mainDraw.c 7 Nov 2005 17:31:35 -0000 1.40 --- mainDraw.c 10 Nov 2005 20:40:33 -0000 1.41 *************** *** 618,622 **** void mainSprite(int globalX, int globalY, gfxEntryStruct* pGfxPtr, u8* ouputPtr, int newColor, int idx) ! { if(pGfxPtr) { --- 618,624 ---- void mainSprite(int globalX, int globalY, gfxEntryStruct* pGfxPtr, u8* ouputPtr, int newColor, int idx) ! { ! // this is used for font only ! if(pGfxPtr) { *************** *** 656,660 **** if(color) { ! if(x >= 0 && x < 320 && y >= 0 && y < 200) { if(color == 1) --- 658,662 ---- if(color) { ! if((x >= 0) && (x < 320) && (y >= 0) && (y < 200)) { if(color == 1) *************** *** 668,672 **** } } - output++; } --- 670,673 ---- Index: polys.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/polys.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** polys.c 2 Nov 2005 22:37:24 -0000 1.3 --- polys.c 10 Nov 2005 20:40:33 -0000 1.4 *************** *** 174,179 **** switch (lineCount) { - default: // go on and draw polygon - break; case 0: // do nothing return; --- 174,177 ---- *************** *** 184,187 **** --- 182,187 ---- line(datas[0], datas[1], datas[2], datas[3], color); return; + default: // go on and draw polygon + break; } *************** *** 209,245 **** { // printf("Horizontal line. x1: %i, y1: %i, x2: %i, y2: %i\n", x1, y1, x2, y2); ! if (!dir) ! continue; ! putdot(x1, y1); ! dir = 0; ! continue; ! } ! ! step = (double) (x2 - x1) / (y2 - y1); ! // printf("x1: %i, y1 = %i, x2 = %i, y2 = %i, step: %f\n", x1, y1, x2, y2, step); ! curx = x1; ! if (y1 < y2) { ! for (j = y1; j < y2; j++, curx += step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == -1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = 1; ! } else { ! for (j = y1; j > y2; j--, curx -= step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == 1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); } - dir = -1; } } --- 209,247 ---- { // printf("Horizontal line. x1: %i, y1: %i, x2: %i, y2: %i\n", x1, y1, x2, y2); ! if (dir) ! { ! putdot(x1, y1); ! dir = 0; ! } ! } ! else ! { ! step = (double) (x2 - x1) / (y2 - y1); ! // printf("x1: %i, y1 = %i, x2 = %i, y2 = %i, step: %f\n", x1, y1, x2, y2, step); ! curx = x1; ! if (y1 < y2) { ! for (j = y1; j < y2; j++, curx += step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == -1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = 1; ! } else { ! for (j = y1; j > y2; j--, curx -= step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == 1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = -1; } } } |
From: Richard <tri...@us...> - 2005-11-07 17:31:46
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9092/src Modified Files: font.c font.h mainDraw.c object.h Log Message: - cleanup of the font functions Index: object.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/object.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** object.h 30 Oct 2005 23:38:57 -0000 1.5 --- object.h 7 Nov 2005 17:31:35 -0000 1.6 *************** *** 8,12 **** int fontIndex; int height; ! int field_C; }; --- 8,12 ---- int fontIndex; int height; ! int width; // for font: max right border; for sprite: just width }; Index: font.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/font.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** font.c 30 Oct 2005 23:38:57 -0000 1.12 --- font.c 7 Nov 2005 17:31:35 -0000 1.13 *************** *** 1,151 **** #include "cruise.h" ! s32 fontProc1(s16 param, u8* ptr1,u8* ptr2) { ! u8* dest; ! s32 best=0; ! s32 i; ! ! if(!param) ! return(0); [...1269 lines suppressed...] ! } ! else ! { ! stringFinished = 1; // character = 0x00 ! } ! ! // check if string already reached the end ! if(ptrStringEnd <= string) ! { ! break; ! } ! } while(!stringFinished); ! // var_8 = 0; ! heightOffset += wordSpacingHeight + lineHeight; ! }while(!stringFinished); ! return generatedGfxEntry; ! } \ No newline at end of file Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** mainDraw.c 4 Nov 2005 22:01:55 -0000 1.39 --- mainDraw.c 7 Nov 2005 17:31:35 -0000 1.40 *************** *** 167,171 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; - upperBorder -= positionX; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 167,170 ---- *************** *** 182,186 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; - upperBorder += positionX; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 181,184 ---- *************** *** 198,202 **** upperBorder = *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; - upperBorder -= positionY; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 196,199 ---- *************** *** 207,211 **** upperBorder -= *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; - upperBorder += positionY; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 204,207 ---- *************** *** 563,567 **** spriteY2 = sizeTable[2] - 2; // bottom border spriteY1 = sizeTable[3] + 2; // top border ! if(spriteX2 >= 320) return; --- 559,567 ---- spriteY2 = sizeTable[2] - 2; // bottom border spriteY1 = sizeTable[3] + 2; // top border ! ! if (X == 28 && Y == 80 && scale == 1024) { ! printf("0--> x1: %i, y1: %i, x2: %i, y2: %i\n", sizeTable[1], sizeTable[3], sizeTable[0], sizeTable[2]); ! printf("1--> x1: %i, y1: %i, x2: %i, y2: %i\n", spriteX1, spriteY1, spriteX2, spriteY2); ! } if(spriteX2 >= 320) return; *************** *** 629,633 **** u8* ptr = pGfxPtr->imagePtr; int height = pGfxPtr->height; ! int width = pGfxPtr->field_C; if(globalY < 0) --- 629,633 ---- u8* ptr = pGfxPtr->imagePtr; int height = pGfxPtr->height; ! int width = pGfxPtr->width; if(globalY < 0) *************** *** 763,767 **** y = pMenu->y; ! var_10 = pMenu->gfx->field_C / (199 - (pMenu->gfx->field_C * 2)); bx = var_10 / (pMenu->numElements + 1); // rustine... --- 763,767 ---- y = pMenu->y; ! var_10 = pMenu->gfx->width / (199 - (pMenu->gfx->width * 2)); bx = var_10 / (pMenu->numElements + 1); // rustine... Index: font.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/font.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** font.h 20 Oct 2005 12:09:33 -0000 1.7 --- font.h 7 Nov 2005 17:31:35 -0000 1.8 *************** *** 10,19 **** void flipGen(void* var, s32 length); ! s32 fontProc1(s16 param, u8* ptr1,u8* ptr2); ! s32 fontProc2(s32 param1,s32 param2,u8* ptr,u8* string); ! void renderWord(u8* ptr1, u8* outBufferPtr, s32 param1, s32 param2, s32 param3, s32 param4, s32 param5, s32 param6); ! gfxEntryStruct* renderText(int param, u8* string); ! void drawString(s32 x, s32 y, u8* string, u8* buffer, u8 color, s32 param); #endif --- 10,19 ---- void flipGen(void* var, s32 length); ! s32 getLineHeight(s16 charCount, u8* fontPtr, u8* fontPrt_Desc); // fontProc1 ! s32 getTextLineCount(s32 param1, s32 param2, u8* ptr, u8* textString); // fontProc2 ! void renderWord(u8* fontPtr_Data, u8* outBufferPtr, s32 drawPosPixel_X, s32 height, s32 param3, s32 param4, s32 stringRenderBufferSize, s32 width); ! gfxEntryStruct* renderText(int inRightBorder_X, u8* textString); ! void drawString(s32 x, s32 y, u8* string, u8* buffer, u8 color, s32 inRightBorder_X); #endif |
From: Richard <tri...@us...> - 2005-11-06 01:25:21
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27545/src Modified Files: Makefile.am Makefile.ps2 cruise.h gfxModule.c gfxModule.h Removed Files: pi1convert.c pi1convert.h Log Message: - moved flip function und rgb palette to gfxModule - removed unused pi1convert.c & pi1convert.h - updated makefiles (please check for unix format) Index: Makefile.ps2 =================================================================== RCS file: /cvsroot/cine/cruisE/src/Makefile.ps2,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.ps2 20 Oct 2005 09:12:59 -0000 1.2 --- Makefile.ps2 6 Nov 2005 01:25:13 -0000 1.3 *************** *** 17,21 **** osystemSDL.o \ overlay.o \ - pi1convert.o \ polys.o \ script.o \ --- 17,20 ---- Index: gfxModule.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/gfxModule.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gfxModule.h 15 May 2005 13:25:40 -0000 1.3 --- gfxModule.h 6 Nov 2005 01:25:13 -0000 1.4 *************** *** 13,19 **** --- 13,30 ---- }; + struct palEntry + { + u8 R; + u8 G; + u8 B; + u8 A; + }; + typedef struct gfxModuleDataStruct gfxModuleDataStruct; + typedef struct palEntry palEntry; extern gfxModuleDataStruct gfxModuleData; + extern palEntry lpalette[256]; + extern short globalAtariScreen[320*200/4]; void gfxModuleData_gfxClearFrameBuffer(u8* ptr); *************** *** 27,30 **** --- 38,42 ---- void gfxModuleData_flipScreen(void); void gfxModuleData_setPal256(s16* ptr); + void flip(void); #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/cine/cruisE/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 20 Oct 2005 09:12:59 -0000 1.5 --- Makefile.am 6 Nov 2005 01:25:12 -0000 1.6 *************** *** 1,51 **** ! bin_PROGRAMS = cruisE ! .h.gch: ! $(CXXCOMPILE) $< ! cruisE_SOURCES = \ ! background.c \ ! background.h \ ! backgroundIncrust.c \ ! backgroundIncrust.h \ ! cruise.c \ ! cruise.h \ ! dataLoader.c \ ! dataLoader.h \ ! decompiler.c \ ! delphine-unpack.c \ ! font.c \ ! font.h \ ! fontCharacterTable.c \ ! fontCharacterTable.h \ ! function.c \ ! function.h \ ! gfxModule.c \ ! gfxModule.h \ ! linker.c \ ! linker.h \ ! loadSave.c \ ! loadSave.h \ ! mainDraw.c \ ! mainDraw.h \ ! mouse.c \ ! mouse.h \ ! osystemSDL.c \ ! osystem.h \ ! overlay.c \ ! overlay.h \ ! pi1convert.c \ ! pi1convert.h \ ! polys.c \ ! polys.h \ ! script.c \ ! script.h \ ! stack.c \ ! stack.h \ ! stringSupport.c \ ! stringSupport.h \ ! various.c \ ! various.h \ ! vars.c \ ! vars.h \ ! volume.c \ ! volume.h ! --- 1,49 ---- ! bin_PROGRAMS = cruisE ! .h.gch: ! $(CXXCOMPILE) $< ! cruisE_SOURCES = \ ! background.c \ ! background.h \ ! backgroundIncrust.c \ ! backgroundIncrust.h \ ! cruise.c \ ! cruise.h \ ! dataLoader.c \ ! dataLoader.h \ ! decompiler.c \ ! delphine-unpack.c \ ! font.c \ ! font.h \ ! fontCharacterTable.c \ ! fontCharacterTable.h \ ! function.c \ ! function.h \ ! gfxModule.c \ ! gfxModule.h \ ! linker.c \ ! linker.h \ ! loadSave.c \ ! loadSave.h \ ! mainDraw.c \ ! mainDraw.h \ ! mouse.c \ ! mouse.h \ ! osystemSDL.c \ ! osystem.h \ ! overlay.c \ ! overlay.h \ ! polys.c \ ! polys.h \ ! script.c \ ! script.h \ ! stack.c \ ! stack.h \ ! stringSupport.c \ ! stringSupport.h \ ! various.c \ ! various.h \ ! vars.c \ ! vars.h \ ! volume.c \ ! volume.h ! --- pi1convert.c DELETED --- Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** cruise.h 22 Oct 2005 15:40:41 -0000 1.32 --- cruise.h 6 Nov 2005 01:25:13 -0000 1.33 *************** *** 67,71 **** #include "font.h" #include "volume.h" - #include "pi1convert.h" #include "fontCharacterTable.h" #include "stack.h" --- 67,70 ---- Index: gfxModule.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/gfxModule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gfxModule.c 1 May 2005 10:25:39 -0000 1.3 --- gfxModule.c 6 Nov 2005 01:25:13 -0000 1.4 *************** *** 5,8 **** --- 5,9 ---- char screen[320*200]; + palEntry lpalette[256]; gfxModuleDataStruct gfxModuleData = *************** *** 32,35 **** --- 33,38 ---- } + short globalAtariScreen[320*200/4]; + void gfxModuleData_field_60(char* sourcePtr, int width, int height, char* destPtr, int x, int y) {/* *************** *** 599,600 **** --- 602,643 ---- flip(); } + + + void flip() + { + int i; + char paletteRGBA[256*4]; + u8* outPtr = scaledScreen; + u8* inPtr = globalScreen; + + + for(i=0;i<256;i++) + { + paletteRGBA[i*4] = lpalette[i].R; + paletteRGBA[i*4+1] = lpalette[i].G; + paletteRGBA[i*4+2] = lpalette[i].B; + paletteRGBA[i*4+3] = 0xFF; + } + + for(i=0;i<200;i++) + { + int j; + u8* copySource = outPtr; + + for(j=0;j<320;j++) + { + *(outPtr++) = *(inPtr); + *(outPtr++) = *(inPtr++); + } + + // copy line + for(j=0;j<640;j++) + { + *(outPtr++) = *(copySource++); + } + + } + + setPalette(paletteRGBA); + Flip((u8*)scaledScreen); + } --- pi1convert.h DELETED --- |
From: Richard <tri...@us...> - 2005-11-05 19:11:34
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28675/src Modified Files: ctp.c function.c vars.c vars.h Log Message: - some more CTP clarifiying Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** function.c 4 Nov 2005 22:01:55 -0000 1.35 --- function.c 5 Nov 2005 19:11:21 -0000 1.36 *************** *** 1205,1209 **** computedVar14 = subStruct->boxIdx; // Box index ! if(!(saveVar5[subStruct->boxIdx]) && (minY >= x) && (maxY <= x) && (minX >= y) && (maxX <= y)) { /**************/ --- 1205,1209 ---- computedVar14 = subStruct->boxIdx; // Box index ! if(!(walkboxChange[subStruct->boxIdx]) && (minY >= x) && (maxY <= x) && (minX >= y) && (maxX <= y)) { /**************/ Index: vars.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** vars.c 4 Nov 2005 22:01:55 -0000 1.18 --- vars.c 5 Nov 2005 19:11:21 -0000 1.19 *************** *** 129,133 **** s16 numberOfWalkboxes; // saveVar3 s16 walkboxType[15]; // saveVar4 ! s16 saveVar5[15]; u8 saveVar6[16]; --- 129,133 ---- s16 numberOfWalkboxes; // saveVar3 s16 walkboxType[15]; // saveVar4 ! s16 walkboxChange[15]; // saveVar5 u8 saveVar6[16]; Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** vars.h 4 Nov 2005 22:01:55 -0000 1.26 --- vars.h 5 Nov 2005 19:11:21 -0000 1.27 *************** *** 262,269 **** extern u8 saveVar2[97]; // recheck size ! extern s16 numberOfWalkboxes; // saveVar3 ! extern s16 walkboxType[15]; // saveVar4 // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone ! extern s16 saveVar5[15]; ! extern u8 saveVar6[16]; --- 262,269 ---- extern u8 saveVar2[97]; // recheck size ! extern s16 numberOfWalkboxes; // saveVar3 ! extern s16 walkboxType[15]; // saveVar4 // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone ! extern s16 walkboxChange[15]; // saveVar5 // walkbox can change its type: 0x00 - not changeable, 0x01 - changeable ! // Assumption: To change the type: walkboxType[i] -= walkboxChane[i] and vice versa extern u8 saveVar6[16]; *************** *** 288,293 **** first 2 bytes of the slice indicate how many coordinates/lines are following (lineCount) after that there are lineCount * 2 bytes following with indexes pointing on the routeCoords table ! the root x,y for the lines is the coordinate int the routeCoords array, which fits to the current slice ! for the 20 * i slice the root x,y are routeCoords[i] the unused rest of the slice if filled up with 0xFF */ --- 288,293 ---- first 2 bytes of the slice indicate how many coordinates/lines are following (lineCount) after that there are lineCount * 2 bytes following with indexes pointing on the routeCoords table ! the root x,y for the lines is the coordinate in the routeCoords array, which fits to the current slice ! for the 20 * i slice the root x,y is routeCoords[i], routeCoords[i+2] the unused rest of the slice if filled up with 0xFF */ Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ctp.c 4 Nov 2005 22:01:55 -0000 1.9 --- ctp.c 5 Nov 2005 19:11:21 -0000 1.10 *************** *** 33,37 **** // this function process path finding coordinates ! void loadCtpSub2(short int coordCount, short int* ptr) // coordCount = ctp_routeCoordCount, ptr = ctpVar8 { int i; --- 33,37 ---- // this function process path finding coordinates ! void loadCtpSub2(short int coordCount, short int* ptr) // coordCount = ctp_routeCoordCount, ptr = ctpVar8 { int i; *************** *** 66,105 **** void getWalkBoxCenter(int boxIdx, u16* 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]; ! u16* 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; } --- 66,105 ---- void getWalkBoxCenter(int boxIdx, u16* 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]; ! u16* 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; } *************** *** 107,144 **** void renderCTPWalkBox(int X1, int Y1, int X2, int scale, int Y2, u16* walkboxData) { ! int numPoints; ! int wbSelf1; ! int wbSelf2; ! int i; ! s16* 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(walkboxTable, numPoints); } --- 107,144 ---- void renderCTPWalkBox(int X1, int Y1, int X2, int scale, int Y2, u16* walkboxData) { ! int numPoints; ! int wbSelf1; ! int wbSelf2; ! int i; ! s16* 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(walkboxTable, numPoints); } *************** *** 146,265 **** void loadCtpSub1(int boxIdx, int scale, u16* walkboxTable, ctpVar19Struct* param4) { ! int minX = 1000; ! int minY = 1000; ! int maxX = -1; ! int maxY = -1; ! ctpVar19Struct* var_1C; ! ctpVar19Struct* var_12; ! s16* var_18; ! s16* si; ! // s16* di; ! // u8* cx; ! // int bx; ! // int ax; ! // int var_2; ! int var_E; ! int var_C = 1000; ! int var_A = 0; ! ctpVar19SubStruct* subStruct; ! ASSERT(boxIdx <= 15); ! /****************/ ! scale = 0; ! /***************/ ! 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; ! u16* 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 = maxX; ! subStruct->maxX = minX; ! subStruct->minY = maxY; ! subStruct->maxY = minY; ! } } --- 146,265 ---- void loadCtpSub1(int boxIdx, int scale, u16* walkboxTable, ctpVar19Struct* param4) { ! int minX = 1000; ! int minY = 1000; ! int maxX = -1; ! int maxY = -1; ! ctpVar19Struct* var_1C; ! ctpVar19Struct* var_12; ! s16* var_18; ! s16* si; ! // s16* di; ! // u8* cx; ! // int bx; ! // int ax; ! // int var_2; ! int var_E; ! int var_C = 1000; ! int var_A = 0; ! ctpVar19SubStruct* subStruct; ! ASSERT(boxIdx <= 15); ! /****************/ ! scale = 0; ! /***************/ ! 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; ! u16* 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 = maxX; ! subStruct->maxX = minX; ! subStruct->minY = maxY; ! subStruct->maxY = minY; ! } } *************** *** 332,341 **** flipGen(walkboxType, segementSizeTable[3]); // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone ! memcpy(saveVar5, dataPointer, segementSizeTable[4]); // unknown? some values for the walkboxes (either 0x00 or 0x01) dataPointer += segementSizeTable[4]; ! flipGen(saveVar5, segementSizeTable[4]); } ! memcpy(ctpVar6, dataPointer, segementSizeTable[5]); // unknown? always 2*16 bytes dataPointer += segementSizeTable[5]; flipGen(ctpVar6,segementSizeTable[5]); --- 332,341 ---- 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]); |
From: Richard <tri...@us...> - 2005-11-04 22:02:06
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28219/src Modified Files: ctp.c ctp.h function.c loadSave.c mainDraw.c vars.c vars.h Log Message: - some demystifing the CTP functions (nothing too fancy, mostly variable renaming and comments) - drawCTP (debug) function shows now different walkbox types Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** vars.h 29 Oct 2005 18:23:14 -0000 1.25 --- vars.h 4 Nov 2005 22:01:55 -0000 1.26 *************** *** 262,267 **** extern u8 saveVar2[97]; // recheck size ! extern s16 saveVar3; ! extern s16 saveVar4[15]; extern s16 saveVar5[15]; --- 262,267 ---- extern u8 saveVar2[97]; // recheck size ! extern s16 numberOfWalkboxes; // saveVar3 ! extern s16 walkboxType[15]; // saveVar4 // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone extern s16 saveVar5[15]; *************** *** 271,280 **** extern s16 ctpVar1; ! extern s16 ctpVar2; ! extern s16 ctpVar3[40]; ! extern s8 ctpVar4[400]; ! extern u16 ctpVar5[15*40]; ! extern s8 ctpVar6[32]; ! extern s16 ctpVar7[15]; extern s16 ctpVar8[200]; --- 271,298 ---- extern s16 ctpVar1; ! extern s16 ctp_routeCoordCount; // ctpVar2 // number of path-finding coordinates ! extern s16 ctp_routeCoords[40]; // ctpVar3 // path-finding coordinates array ! ! /* ctp_routeCoords: ! ! correct size would be: ctp_routes[routeCoordCount * 4] ! coordinate information with x (2 bytes) and y (2 bytes) ! */ ! ! extern s8 ctp_routes[400]; // ctpVar4 // path-finding line information ! ! /* ctp_routes: ! ! correct size would be: ctp_routes[routeCoordCount * 20 * 2] ! array is seperate in 20 * 2 bytes slices. ! first 2 bytes of the slice indicate how many coordinates/lines are following (lineCount) ! after that there are lineCount * 2 bytes following with indexes pointing on the routeCoords table ! the root x,y for the lines is the coordinate int the routeCoords array, which fits to the current slice ! for the 20 * i slice the root x,y are routeCoords[i] ! the unused rest of the slice if filled up with 0xFF ! */ ! extern u16 ctp_walkboxTable[15 * 40]; // ctpVar5 // walkboxes coordinates and lines ! extern s8 ctpVar6[32]; ! extern s16 ctp_scale[15]; // ctpVar7 // scaling information for walkboxes extern s16 ctpVar8[200]; *************** *** 290,292 **** //extern OSystem *osystem; ! #endif --- 308,310 ---- //extern OSystem *osystem; ! #endif \ No newline at end of file Index: loadSave.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/loadSave.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** loadSave.c 29 Oct 2005 18:23:14 -0000 1.10 --- loadSave.c 4 Nov 2005 22:01:55 -0000 1.11 *************** *** 154,163 **** int i; ! fread(&saveVar3,2,1,fileHandle); ! if(saveVar3) { ! fread(saveVar4,saveVar3*2,1,fileHandle); ! fread(saveVar5,saveVar3*2,1,fileHandle); } --- 154,163 ---- int i; ! fread(&numberOfWalkboxes, 2, 1, fileHandle); ! if(numberOfWalkboxes) { ! fread(walkboxType, numberOfWalkboxes * 2, 1, fileHandle); ! fread(walkboxType, numberOfWalkboxes * 2, 1, fileHandle); } Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** function.c 21 Oct 2005 22:20:37 -0000 1.34 --- function.c 4 Nov 2005 22:01:55 -0000 1.35 *************** *** 1175,1179 **** } ! int computedVar14Bis; void checkCollisionWithWalkBoxesBoundingBoxes(int x, int y) --- 1175,1179 ---- } ! int boxType; // computedVar14Bis void checkCollisionWithWalkBoxesBoundingBoxes(int x, int y) *************** *** 1190,1196 **** ctpVar19SubStruct* subStruct; ! if(-1 == (int)di->field_0) // ok, ugly, but it's in the original { ! computedVar14Bis = 0; return; } --- 1190,1196 ---- ctpVar19SubStruct* subStruct; ! if(-1 == (int) di->field_0) // ok, ugly, but it's in the original { ! boxType = 0; return; } *************** *** 1203,1213 **** maxY = subStruct->maxY; ! computedVar14 = subStruct->boxIdx; ! if(!(saveVar5[subStruct->boxIdx]) && (minY>=x) && (maxY<=x) && (minX>=y) && (maxX<=y)) { /**************/ ! computedVar14Bis = saveVar4[computedVar14]; /**************/ --- 1203,1213 ---- maxY = subStruct->maxY; ! computedVar14 = subStruct->boxIdx; // Box index ! if(!(saveVar5[subStruct->boxIdx]) && (minY >= x) && (maxY <= x) && (minX >= y) && (maxX <= y)) { /**************/ ! boxType = walkboxType[computedVar14]; /**************/ *************** *** 1215,1221 **** di = di->field_0; ! }while(1); ! computedVar14Bis = 0; } --- 1215,1221 ---- di = di->field_0; ! } while(1); ! boxType = 0; } Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mainDraw.c 2 Nov 2005 22:37:24 -0000 1.38 --- mainDraw.c 4 Nov 2005 22:01:55 -0000 1.39 *************** *** 719,732 **** int i; ! if(ctpVar5) { for(i = 0; i < 15; i++) { ! u16* dataPtr = &ctpVar5[i * 40]; if(*dataPtr) { int j; ! fillpoly(dataPtr+1, *dataPtr, 10); for(j = 0; j < (*dataPtr - 1); j++) --- 719,733 ---- int i; ! if(ctp_walkboxTable) { for(i = 0; i < 15; i++) { ! u16* dataPtr = &ctp_walkboxTable[i * 40]; ! int type = walkboxType[i]; // show different types in different colors if(*dataPtr) { int j; ! fillpoly(dataPtr+1, *dataPtr, 10 + type); for(j = 0; j < (*dataPtr - 1); j++) *************** *** 1091,1095 **** #ifdef _DEBUG ! //drawCtp(); #endif --- 1092,1096 ---- #ifdef _DEBUG ! // drawCtp(); #endif Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ctp.c 1 Nov 2005 22:02:22 -0000 1.8 --- ctp.c 4 Nov 2005 22:01:55 -0000 1.9 *************** *** 16,66 **** int ctpVarUnk; ! u8 walkboxTable[0x12]; ! ! int ctpProc2(int var1, int var2, int param1, int param2) { ! int local1 = abs(param1 - var1); ! int local2 = abs(param2 - var2); ! ! if(local1>=local2) ! local2 = local1; ! ctpVar14 = local2; ! return(local2); } ! ! void loadCtpSub2(short int param,short int* ptr) { ! int i; ! int offset = 0; ! ! short int* currentCtpVar3 = ctpVar3; ! s8* currentCtpVar4 = ctpVar4; ! for(i=0;i<param;i++) ! { ! int var1 = currentCtpVar3[0]; ! int var2 = currentCtpVar3[1]; ! int di = 0; ! int var4Offset = 2; ! while(*(s16*)currentCtpVar4 > di) ! { ! int idx = *(s16*)(currentCtpVar4+var4Offset); ! ptr[offset+idx] = ctpProc2(var1,var2,ctpVar3[idx*2],ctpVar3[idx*2+1]); ! var4Offset += 2; ! di++; ! } ! offset += 10; ! currentCtpVar4 += 20; ! currentCtpVar3 += 2; ! } } --- 16,65 ---- int ctpVarUnk; + u8 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 = ctp_routeCoords; // coordinates table ! s8* cur_ctp_routes = 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(*(s16*) cur_ctp_routes > di) // while (coordCount > counter++) ! { ! int idx = *(s16*)(cur_ctp_routes + var4Offset); ! ptr[offset + idx] = ctpProc2(varX , varY, ctp_routeCoords[idx * 2], ctp_routeCoords[idx * 2 + 1]); ! var4Offset += 2; ! di++; ! } ! offset += 10; ! cur_ctp_routes += 20; ! cur_ctp_routeCoords += 2; ! } } *************** *** 72,114 **** int maxY = -1; ! ASSERT(boxIdx<=15); ! ASSERT(walkboxTable[boxIdx*40]); // we should never have an empty walk box ! if(walkboxTable[boxIdx*40] > 0) { ! int numPoints = walkboxTable[boxIdx*40]; ! u16* pCurrentPtr = walkboxTable + (boxIdx*40) + 1; int i; ! for(i=0;i<numPoints;i++) { ! int X; ! int Y; ! ! X = *(pCurrentPtr++); ! 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 param1, int Y2, u16* walkboxData ) { int numPoints; --- 71,109 ---- 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]; ! u16* 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, u16* walkboxData) { int numPoints; *************** *** 118,123 **** s16* destination; ! wbSelf1 = upscaleValue(X1, param1) - X2; ! wbSelf2 = upscaleValue(Y1, param1) - Y2; numPoints = *(walkboxData++); --- 113,118 ---- s16* destination; ! wbSelf1 = upscaleValue(X1, scale) - X2; ! wbSelf2 = upscaleValue(Y1, scale) - Y2; numPoints = *(walkboxData++); *************** *** 125,144 **** destination = polyBuffer2; ! for(i=0;i<numPoints;i++) { ! int pointX; ! int pointY; ! ! int scaledX; ! int scaledY; ! ! pointX = *(walkboxData++); ! pointY = *(walkboxData++); ! scaledX = upscaleValue(pointX, param1) - wbSelf1; ! scaledY = upscaleValue(pointY, param1) - wbSelf2; ! *(destination++) = scaledX>>16; ! *(destination++) = scaledY>>16; } --- 120,133 ---- 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; } *************** *** 146,158 **** ctpVarUnk = 0; ! for(i=0;i<numPoints;i++) { walkboxTable[i] = i; } ! drawPolyMode2(walkboxTable,numPoints); } ! void loadCtpSub1(int boxIdx, int param1, u16* walkboxTable, ctpVar19Struct* param4) { int minX = 1000; --- 135,148 ---- ctpVarUnk = 0; ! for(i = 0; i < numPoints; i++) { walkboxTable[i] = i; } ! drawPolyMode2(walkboxTable, numPoints); } ! // this process the walkboxes ! void loadCtpSub1(int boxIdx, int scale, u16* walkboxTable, ctpVar19Struct* param4) { int minX = 1000; *************** *** 175,186 **** ctpVar19SubStruct* subStruct; ! ASSERT(boxIdx<=15); /****************/ ! param1 = 0; /***************/ ! if(walkboxTable[boxIdx*40] > 0) // is walkbox used ? { getWalkBoxCenter(boxIdx, walkboxTable); --- 165,176 ---- ctpVar19SubStruct* subStruct; ! ASSERT(boxIdx <= 15); /****************/ ! scale = 0; /***************/ ! if(walkboxTable[boxIdx * 40] > 0) // is walkbox used ? { getWalkBoxCenter(boxIdx, walkboxTable); *************** *** 188,193 **** currentWalkBoxCenterYBis = currentWalkBoxCenterY; currentWalkBoxCenterXBis = currentWalkBoxCenterX; ! ! renderCTPWalkBox(currentWalkBoxCenterX, currentWalkBoxCenterY, currentWalkBoxCenterX, param1+ 0x200, currentWalkBoxCenterY, walkboxTable+boxIdx*40 ); var_1C = param4; --- 178,183 ---- currentWalkBoxCenterYBis = currentWalkBoxCenterY; currentWalkBoxCenterXBis = currentWalkBoxCenterX; ! // + 512 ! renderCTPWalkBox(currentWalkBoxCenterX, currentWalkBoxCenterY, currentWalkBoxCenterX, scale + 0x200, currentWalkBoxCenterY, walkboxTable + boxIdx * 40); var_1C = param4; *************** *** 195,199 **** var_18 = polyBuffer3; ! var_E = 0; si = &polyBuffer3[1]; --- 185,189 ---- var_18 = polyBuffer3; ! var_E = 0; si = &polyBuffer3[1]; *************** *** 235,260 **** int i; int numPoints; ! u16* pCurrentPtr = walkboxTable+boxIdx*40; numPoints = *(pCurrentPtr++); ! for(i=0;i<numPoints;i++) { ! int X; ! int Y; ! ! X = *(pCurrentPtr++); ! Y = *(pCurrentPtr++); ! if(X<minX) minX = X; ! if(X>maxX) maxX = X; ! if(Y<minY) minY = Y; ! if(Y>maxY) maxY = Y; } --- 225,247 ---- int i; int numPoints; ! u16* 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; } *************** *** 263,267 **** var_1C->field_0 = var_12; ! ctpVar13 = var_12; var_12->field_0 = (ctpVar19Struct*)(-1); --- 250,254 ---- var_1C->field_0 = var_12; ! ctpVar13 = var_12; var_12->field_0 = (ctpVar19Struct*)(-1); *************** *** 269,277 **** subStruct->boxIdx = boxIdx; ! subStruct->field_6 = saveVar4[boxIdx]; ! subStruct->minX = maxX; ! subStruct->maxX = minX; ! subStruct->minY = maxY; ! subStruct->maxY = minY; } } --- 256,264 ---- subStruct->boxIdx = boxIdx; ! subStruct->type = walkboxType[boxIdx]; ! subStruct->minX = maxX; ! subStruct->maxX = minX; ! subStruct->minY = maxY; ! subStruct->maxY = minY; } } *************** *** 279,411 **** int loadCtp(u8* ctpName) { ! int si; ! u8* ptr; ! u8* ptr2; ! char string2[5]; ! short int tempTable[7]; ! 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); ! } ! ptr2 = ptr; ! string2[4] = 0; ! memcpy(string2,ptr2,4); ! ptr2+=4; ! if(strcmp(string2,"CTP ")) ! { ! free(ptr); ! return(0); ! } ! memcpy(&ctpVar2,ptr2,2); ! ptr2+=2; ! flipShort(&ctpVar2); ! memcpy(tempTable,ptr2,0xE); ! ptr2+=0xE; ! flipGen(tempTable,0xE); ! memcpy(ctpVar3,ptr2,tempTable[0]); ! ptr2+=tempTable[0]; ! flipGen(ctpVar3,tempTable[0]); ! memcpy(ctpVar4,ptr2,tempTable[1]); ! ptr2+=tempTable[1]; ! flipGen(ctpVar4,tempTable[1]); ! memcpy(ctpVar5,ptr2,tempTable[2]); ! ptr2+=tempTable[2]; ! flipGen(ctpVar5,tempTable[2]); ! if(ctpVar1) ! { ! ptr2+=tempTable[3]; ! ptr2+=tempTable[4]; ! } ! else ! { ! memcpy(saveVar4,ptr2,tempTable[3]); ! ptr2+=tempTable[3]; ! flipGen(saveVar4,tempTable[3]); ! memcpy(saveVar5,ptr2,tempTable[4]); ! ptr2+=tempTable[4]; ! flipGen(saveVar5,tempTable[4]); ! } ! memcpy(ctpVar6,ptr2,tempTable[5]); ! ptr2+=tempTable[5]; ! flipGen(ctpVar6,tempTable[5]); ! memcpy(ctpVar7,ptr2,tempTable[6]); ! ptr2+=tempTable[6]; ! flipGen(ctpVar7,tempTable[6]); // ok ! free(ptr); ! strcpyU8(string,currentCtpName); ! saveVar3 = tempTable[6]/2; ! loadCtpSub2(ctpVar2,ctpVar8); ! ctpVar9 = ctpVar11 = ctpVar13 = ptr_something; ! ptr = (u8*)ctpVar9; ! si = saveVar3; ! while((--si)>=0) ! { ! loadCtpSub1(si,0,ctpVar5,ctpVar13); ! } ! ctpVar15 = ctpVar13+1; // was after the -1 thing ! si = saveVar3; ! while(--si) ! { ! loadCtpSub1(si,ctpVar7[si]*20,ctpVar5,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 = ctpVar9 = malloc(numOfUsedEntries*sizeof(ctpVar19Struct)); ! } ! si = saveVar3; ! while((--si)>=0) ! { ! loadCtpSub1(si,0,ctpVar5,ctpVar13); ! } ! ctpVar15 = ctpVar13+1; ! si = saveVar3; ! while(--si) ! { ! loadCtpSub1(si,ctpVar7[si]*20,ctpVar5,ctpVar13); ! } ! ctpVar19 = ctpVar11; ! return(1); ! } --- 266,400 ---- int loadCtp(u8* ctpName) { ! int walkboxCounter; // si ! u8* ptr; ! u8* 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(saveVar5, dataPointer, segementSizeTable[4]); // unknown? some values for the walkboxes (either 0x00 or 0x01) ! dataPointer += segementSizeTable[4]; ! flipGen(saveVar5, segementSizeTable[4]); ! } ! memcpy(ctpVar6, dataPointer, segementSizeTable[5]); // unknown? always 2*16 bytes ! 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); ! strcpyU8(string, currentCtpName); ! numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes ! loadCtpSub2(ctp_routeCoordCount, ctpVar8); // process path-finding stuff ! ctpVar9 = ctpVar11 = ctpVar13 = ptr_something; ! ptr = (u8*) ctpVar9; ! 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 = ctpVar9 = 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); ! } \ No newline at end of file Index: ctp.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ctp.h 20 Oct 2005 09:13:00 -0000 1.3 --- ctp.h 4 Nov 2005 22:01:55 -0000 1.4 *************** *** 4,13 **** struct ctpVar19SubStruct { ! u16 boxIdx; //0 ! u16 field_6; //2 ! u16 minX; //4 ! u16 maxX; //6 ! u16 minY; //8 ! u16 maxY; //A }; --- 4,13 ---- struct ctpVar19SubStruct { ! u16 boxIdx; //0 ! u16 type; //2 ! u16 minX; //4 ! u16 maxX; //6 ! u16 minY; //8 ! u16 maxY; //A }; Index: vars.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** vars.c 20 Oct 2005 09:13:00 -0000 1.17 --- vars.c 4 Nov 2005 22:01:55 -0000 1.18 *************** *** 127,132 **** u8 saveVar2[97]; // recheck size ! s16 saveVar3; ! s16 saveVar4[15]; s16 saveVar5[15]; --- 127,132 ---- u8 saveVar2[97]; // recheck size ! s16 numberOfWalkboxes; // saveVar3 ! s16 walkboxType[15]; // saveVar4 s16 saveVar5[15]; *************** *** 136,145 **** s16 ctpVar1 = 0; ! s16 ctpVar2; ! s16 ctpVar3[40]; ! s8 ctpVar4[400]; ! u16 ctpVar5[15*40]; ! s8 ctpVar6[32]; ! s16 ctpVar7[15]; s16 ctpVar8[200]; --- 136,145 ---- s16 ctpVar1 = 0; ! s16 ctp_routeCoordCount; // ctpVar2 ! s16 ctp_routeCoords[40]; // ctpVar3 ! s8 ctp_routes[400]; // ctpVar4 ! u16 ctp_walkboxTable[15 * 40]; // ctpVar5 ! s8 ctpVar6[32]; ! s16 ctp_scale[15]; // ctpVar7 s16 ctpVar8[200]; |
From: Richard <tri...@us...> - 2005-11-02 22:37:33
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1527/src Modified Files: mainDraw.c mainDraw.h polys.c polys.h Log Message: - even more cleanup - moved draw "line stuff" to poly.c Index: polys.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/polys.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** polys.h 20 Apr 2005 20:27:42 -0000 1.1 --- polys.h 2 Nov 2005 22:37:24 -0000 1.2 *************** *** 1,3 **** typedef char ColorP; ! void fillpoly(short int * datas, int n, ColorP c); \ No newline at end of file --- 1,4 ---- typedef char ColorP; ! void fillpoly(short int * datas, int n, ColorP c); ! void line(int x1, int y1, int x2, int y2, ColorP color); \ No newline at end of file Index: mainDraw.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mainDraw.h 1 Nov 2005 22:02:22 -0000 1.10 --- mainDraw.h 2 Nov 2005 22:37:24 -0000 1.11 *************** *** 8,11 **** --- 8,13 ---- int upscaleValue(int value, int scale); + + void pixel(int x, int y, char color); void mainDraw(s16 param); void flipScreen(void); Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** mainDraw.c 1 Nov 2005 22:02:22 -0000 1.37 --- mainDraw.c 2 Nov 2005 22:37:24 -0000 1.38 *************** *** 18,21 **** --- 18,22 ---- drawVar1Struct drawVar1; + void mainDraw6(void) { *************** *** 71,74 **** --- 72,81 ---- char* polyOutputBuffer; + void pixel(int x, int y, char color) + { + if(x >= 0 && x < 320 && y >= 0 && y < 200) + polyOutputBuffer[320*y+x] = color; + } + // this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1) void getPolyData(int fileIndex, int X, int Y, int *outScale, int *outY, int *outX, char **outDataPtr, int scale, char* dataPtr) *************** *** 147,151 **** { m_flipLeftRight = 1; ! scale = -scale; } --- 154,158 ---- { m_flipLeftRight = 1; ! scale = -scale; } *************** *** 229,392 **** s16* polyVar2; - #define SWAP(x,y) {int temp = x; x = y; y = temp;} - int MAX(x,y) {if(x>y){return x;}else{return y;}} - int MIN(x,y) {if(x<y){return x;}else{return y;}} - - void pixel(int x, int y, char color) - { - if(x >= 0 && x < 320 && y >= 0 && y < 200) - polyOutputBuffer[320*y+x] = color; - } - - void hline(int x1, int x2, int y, char c) { - for (; x1 <= x2; x1++) { - pixel(x1, y, c); - } - } - - void vline(int x, int y1, int y2, char c) { - for (; y1 <= y2; y1++) { - pixel(x, y1, c); - } - } - - void bsubline_1(int x1, int y1, int x2, int y2, char c) { - int x, y, ddx, ddy, e; - ddx = abs(x2 - x1); - ddy = abs(y2 - y1) << 1; - e = ddx - ddy; - ddx <<= 1; - - if (x1 > x2) { - SWAP(x1, x2); - SWAP(y1, y2); - } - - for (x = x1, y = y1; x <= x2; x++) { - - pixel(x, y, c); - if (e < 0) { - y++; - e += ddx - ddy; - } else { - e -= ddy; - } - } - - } - void bsubline_2(int x1, int y1, int x2, int y2, char c) { - - int x, y, ddx, ddy, e; - ddx = abs(x2 - x1) << 1; - ddy = abs(y2 - y1); - e = ddy - ddx; - ddy <<= 1; - - if (y1 > y2) { - SWAP(x1, x2); - SWAP(y1, y2); - } - - - for (y = y1, x = x1; y <= y2; y++) { - - pixel(x, y, c); - if (e < 0) { - x++; - e += ddy - ddx; - } else { - e -= ddx; - } - } - - } - - void bsubline_3(int x1, int y1, int x2, int y2, char c) { - - int x, y, ddx, ddy, e; - - ddx = abs(x1 - x2) << 1; - ddy = abs(y2 - y1); - e = ddy - ddx; - ddy <<= 1; - - if (y1 > y2) { - SWAP(x1, x2); - SWAP(y1, y2); - } - - - for (y = y1, x = x1; y <= y2; y++) { - - pixel(x, y, c); - if (e < 0) { - x--; - e += ddy - ddx; - } else { - e -= ddx; - } - } - - } - - void bsubline_4(int x1, int y1, int x2, int y2, char c) { - - int x, y, ddx, ddy, e; - - ddy = abs(y2 - y1) << 1; - ddx = abs(x1 - x2); - e = ddx - ddy; - ddx <<= 1; - - if (x1 > x2) { - SWAP(x1, x2); - SWAP(y1, y2); - } - - for (x = x1, y = y1; x <= x2; x++) { - - pixel(x, y, c); - if (e < 0) { - y--; - e += ddx - ddy; - } else { - e -= ddy; - } - } - } - - void line(int x1, int y1, int x2, int y2, char c) { - - float k; - - if ((x1 == x2) && (y1 == y2)) { - pixel(x1, y1, c); - return; - } - - if (x1 == x2) { - vline(x1, MIN(y1, y2), MAX(y1, y2), c); - return; - } - - if (y1 == y2) { - hline(MIN(x1, x2), MAX(x1, x2), y1, c); - return; - } - - k = (float)(y2 - y1) / (float)(x2 - x1); - - if ((k >= 0) && (k <= 1)) { - bsubline_1(x1, y1, x2, y2, c); - } else if (k > 1) { - bsubline_2(x1, y1, x2, y2, c); - } else if ((k < 0) && (k >= -1)) { - bsubline_4(x1, y1, x2, y2, c); - } else { - bsubline_3(x1, y1, x2, y2, c); - } - } - - void drawPolySub(void) { --- 236,239 ---- *************** *** 525,529 **** m_flipLeftRight = 0; ! m_useSmallScale = 0; m_lowerX = *(dataPointer + 3); m_lowerY = *(dataPointer + 4); --- 372,376 ---- m_flipLeftRight = 0; ! m_useSmallScale = 0; m_lowerX = *(dataPointer + 3); m_lowerY = *(dataPointer + 4); *************** *** 537,542 **** if(scale < 0x180) // If scale is smaller than 384 { ! m_useSmallScale = 1; ! m_scaleValue = scale << 1; // double scale } else --- 384,389 ---- if(scale < 0x180) // If scale is smaller than 384 { ! m_useSmallScale = 1; ! m_scaleValue = scale << 1; // double scale } else *************** *** 547,551 **** dataPointer += 5; ! m_coordCount = (*(dataPointer++)) + 1; m_first_X = *(dataPointer++); m_first_Y = *(dataPointer++); --- 394,398 ---- dataPointer += 5; ! m_coordCount = (*(dataPointer++)) + 1; // original uses +1 here but its later substracted again, we could skip it m_first_X = *(dataPointer++); m_first_Y = *(dataPointer++); *************** *** 582,586 **** ptrPoly_1_Buf[1] = 0; ptrPoly_1_Buf += 2; ! counter = m_coordCount - 2; // skip the first pair, we already have the values do --- 429,433 ---- ptrPoly_1_Buf[1] = 0; ptrPoly_1_Buf += 2; ! counter = m_coordCount - 1 - 1; // skip the first pair, we already have the values do *************** *** 589,593 **** y = *(dataPointer++) - m_first_Y; ! if(m_useSmallScale) // all shrink coordinates by factor 2 if a scale smaller than 384 is used { x >>= 1; --- 436,440 ---- y = *(dataPointer++) - m_first_Y; ! if(m_useSmallScale) // shrink all coordinates by factor 2 if a scale smaller than 384 is used { x >>= 1; *************** *** 613,617 **** ptrPoly_2_Buf = polyBuffer; ptrPoly_1_Buf = polyBuffer2; ! counter = m_coordCount - 1; // reset counter m_current_X = 0; m_current_Y = 0; --- 460,464 ---- ptrPoly_2_Buf = polyBuffer; ptrPoly_1_Buf = polyBuffer2; ! counter = m_coordCount - 1; // reset counter // process first pair two m_current_X = 0; m_current_Y = 0; *************** *** 649,670 **** if(linesToDraw > 1) // if value not zero { ! u16 tempU16; m_color = *dataPointer; // color dataPointer += 2; ! tempU16 = *(u16*) (dataPointer); dataPointer += 2; ! flipShort(&tempU16); ! if(tempU16 > scale) // is this part correct? seems strange, but no problems so far { ! dataPointer += linesToDraw; // skip ahead ! ! if(*dataPointer == 0xFF) ! { ! return; ! } } else --- 496,512 ---- if(linesToDraw > 1) // if value not zero { ! u16 minimumScale; m_color = *dataPointer; // color dataPointer += 2; ! minimumScale = *(u16*) (dataPointer); dataPointer += 2; ! flipShort(&minimumScale); ! if(minimumScale > scale) // if the scale is too small, for the model to be drawn ... { ! dataPointer += linesToDraw; // ... skip ahead } else *************** *** 690,698 **** } } - - if(*dataPointer == 0xFF) - { - return; - } } } --- 532,535 ---- *************** *** 700,710 **** { dataPointer += 4; - - if(*dataPointer == 0xFF) - { - return; - } } ! } while(1); } --- 537,542 ---- { dataPointer += 4; } ! } while(*dataPointer != 0xFF); } Index: polys.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/polys.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** polys.c 26 Apr 2005 22:27:12 -0000 1.2 --- polys.c 2 Nov 2005 22:37:24 -0000 1.3 *************** *** 6,143 **** typedef char ColorP; ! void hline(int x1, int x2, int y, ColorP c); ! void line(int x1, int y1, int x2, int y2, ColorP c); ! void pixel(int x, int y, ColorP c); #define SCREENHEIGHT 200 #define MAXPTS 10 #define putdot(x,y) {if ((y >= 0) && (y < SCREENHEIGHT)) dots[y][counters[y]++] = x;} ! #define swap(a,b) {int temp = x; x = y; y = temp;} ! void fillpoly(short int * datas, int n, ColorP c) { ! static int dots[SCREENHEIGHT][MAXPTS]; ! static int counters[SCREENHEIGHT]; ! short int x1, y1, x2, y2; ! int i, j, k, dir = -2; ! double step, curx; ! ! if (n <= 2) { ! switch (n) ! { ! case 0: ! return; ! case 1: ! pixel(datas[0], datas[1], c); ! return; ! case 2: ! line(datas[0], datas[1], datas[2], datas[3], c); ! return; } } ! // Reinit array counters ! ! for (i = 0; i < SCREENHEIGHT; i++) ! { ! counters[i] = 0; ! } ! // Drawing lines ! ! x2 = datas[n * 2 - 2]; ! y2 = datas[n * 2 - 1]; ! ! for (i = 0; i < n; i++) { ! x1 = x2; ! y1 = y2; ! x2 = datas[i * 2]; ! y2 = datas[i * 2 + 1]; ! ! // line(x1, y1, x2, y2, c); ! // continue; ! ! if (y1 == y2) ! { ! // printf("Horizontal line. x1: %i, y1: %i, x2: %i, y2: %i\n", x1, y1, x2, y2); ! if (!dir) ! continue; ! putdot(x1, y1); ! dir = 0; ! continue; ! } ! ! step = (double) (x2 - x1) / (y2 - y1); ! ! // printf("x1: %i, y1 = %i, x2 = %i, y2 = %i, step: %f\n", x1, y1, x2, y2, step); ! ! curx = x1; ! ! if (y1 < y2) { ! for (j = y1; j < y2; j++, curx += step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == -1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = 1; ! } else { ! for (j = y1; j > y2; j--, curx -= step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == 1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = -1; ! } ! } ! ! x1 = x2; ! y1 = y2; ! x2 = datas[0]; ! y2 = datas[1]; ! ! if (((y1 < y2) && (dir == -1)) || ((y1 > y2) && (dir == 1)) || ((y1 == y2) && (dir == 0))) { ! // printf("Adding final extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! ! // NOTE: all counters should be even now. If not, this is a bad (C) thing :-P ! ! // Sorting datas ! ! for (i = 0; i < SCREENHEIGHT; i++) { ! // Very bad sorting... but arrays are very small (0, 2 or 4), so it's no quite use... ! for (j = 0; j < (counters[i] - 1); j++) { ! for (k = 0; k < (counters[i] - 1); k++) { ! if (dots[i][k] > dots[i][k + 1]) ! { ! int temp; ! temp = dots[i][k]; ! dots[i][k] = dots[i][k + 1]; ! dots[i][k + 1] = temp; } ! } ! } ! } ! ! // Drawing. ! ! for (i = 0; i < SCREENHEIGHT; i++) { ! if (counters[i]) { ! // printf("%i dots on line %i\n", counters[i], i); ! for (j = 0; j < counters[i] - 1; j += 2) { ! // printf("Drawing line (%i, %i)-%i\n", dots[i][j], dots[i][j + 1], i); ! hline(dots[i][j], dots[i][j + 1], i, c); #ifdef DEBUGGING_POLYS ! if ((!dots[i][j]) || !(dots[i][j + 1])) { ! printf("fillpoly: BLARGH!\n"); ! exit(-1); ! } #endif ! } ! } ! } } --- 6,293 ---- typedef char ColorP; ! #define SCREENHEIGHT 200 #define MAXPTS 10 #define putdot(x,y) {if ((y >= 0) && (y < SCREENHEIGHT)) dots[y][counters[y]++] = x;} ! #define SWAP(x,y) {int temp = x; x = y; y = temp;} ! int MAX(x,y) {if(x>y){return x;}else{return y;}} ! int MIN(x,y) {if(x<y){return x;}else{return y;}} ! ! void hline(int x1, int x2, int y, char c) { ! for (; x1 <= x2; x1++) { ! pixel(x1, y, c); ! } ! } ! ! void vline(int x, int y1, int y2, char c) { ! for (; y1 <= y2; y1++) { ! pixel(x, y1, c); ! } ! } ! ! void bsubline_1(int x1, int y1, int x2, int y2, char c) { ! int x, y, ddx, ddy, e; ! ddx = abs(x2 - x1); ! ddy = abs(y2 - y1) << 1; ! e = ddx - ddy; ! ddx <<= 1; ! ! if (x1 > x2) { ! SWAP(x1, x2); ! SWAP(y1, y2); ! } ! ! for (x = x1, y = y1; x <= x2; x++) { ! ! pixel(x, y, c); ! if (e < 0) { ! y++; ! e += ddx - ddy; ! } else { ! e -= ddy; ! } ! } ! ! } ! void bsubline_2(int x1, int y1, int x2, int y2, char c) { ! ! int x, y, ddx, ddy, e; ! ddx = abs(x2 - x1) << 1; ! ddy = abs(y2 - y1); ! e = ddy - ddx; ! ddy <<= 1; ! ! if (y1 > y2) { ! SWAP(x1, x2); ! SWAP(y1, y2); ! } ! ! ! for (y = y1, x = x1; y <= y2; y++) { ! ! pixel(x, y, c); ! if (e < 0) { ! x++; ! e += ddy - ddx; ! } else { ! e -= ddx; ! } ! } ! ! } ! ! void bsubline_3(int x1, int y1, int x2, int y2, char c) { ! ! int x, y, ddx, ddy, e; ! ! ddx = abs(x1 - x2) << 1; ! ddy = abs(y2 - y1); ! e = ddy - ddx; ! ddy <<= 1; ! ! if (y1 > y2) { ! SWAP(x1, x2); ! SWAP(y1, y2); ! } ! ! ! for (y = y1, x = x1; y <= y2; y++) { ! ! pixel(x, y, c); ! if (e < 0) { ! x--; ! e += ddy - ddx; ! } else { ! e -= ddx; ! } ! } ! ! } ! ! void bsubline_4(int x1, int y1, int x2, int y2, char c) { ! ! int x, y, ddx, ddy, e; ! ! ddy = abs(y2 - y1) << 1; ! ddx = abs(x1 - x2); ! e = ddx - ddy; ! ddx <<= 1; ! ! if (x1 > x2) { ! SWAP(x1, x2); ! SWAP(y1, y2); ! } ! ! for (x = x1, y = y1; x <= x2; x++) { ! ! pixel(x, y, c); ! if (e < 0) { ! y--; ! e += ddx - ddy; ! } else { ! e -= ddy; ! } ! } ! } ! ! void line(int x1, int y1, int x2, int y2, char c) { ! ! float k; ! ! if ((x1 == x2) && (y1 == y2)) { ! pixel(x1, y1, c); ! return; ! } ! ! if (x1 == x2) { ! vline(x1, MIN(y1, y2), MAX(y1, y2), c); ! return; ! } ! ! if (y1 == y2) { ! hline(MIN(x1, x2), MAX(x1, x2), y1, c); ! return; ! } ! ! k = (float)(y2 - y1) / (float)(x2 - x1); ! ! if ((k >= 0) && (k <= 1)) { ! bsubline_1(x1, y1, x2, y2, c); ! } else if (k > 1) { ! bsubline_2(x1, y1, x2, y2, c); ! } else if ((k < 0) && (k >= -1)) { ! bsubline_4(x1, y1, x2, y2, c); ! } else { ! bsubline_3(x1, y1, x2, y2, c); ! } ! } ! ! void fillpoly(short int* datas, int lineCount, ColorP color) { ! static int dots[SCREENHEIGHT][MAXPTS]; ! static int counters[SCREENHEIGHT]; ! short int x1, y1, x2, y2; ! int i, j, k, dir = -2; ! double step, curx; ! ! switch (lineCount) ! { ! default: // go on and draw polygon ! break; ! case 0: // do nothing ! return; ! case 1: // draw pixel ! pixel(datas[0], datas[1], color); ! return; ! case 2: // draw line ! line(datas[0], datas[1], datas[2], datas[3], color); ! return; ! } ! ! // Reinit array counters ! ! for (i = 0; i < SCREENHEIGHT; i++) ! { ! counters[i] = 0; ! } ! // Drawing lines ! ! x2 = datas[lineCount * 2 - 2]; ! y2 = datas[lineCount * 2 - 1]; ! ! for (i = 0; i < lineCount; i++) { ! x1 = x2; ! y1 = y2; ! x2 = datas[i * 2]; ! y2 = datas[i * 2 + 1]; ! ! // line(x1, y1, x2, y2, color); ! // continue; ! ! if (y1 == y2) { ! // printf("Horizontal line. x1: %i, y1: %i, x2: %i, y2: %i\n", x1, y1, x2, y2); ! if (!dir) ! continue; ! putdot(x1, y1); ! dir = 0; ! continue; ! } ! ! step = (double) (x2 - x1) / (y2 - y1); ! ! // printf("x1: %i, y1 = %i, x2 = %i, y2 = %i, step: %f\n", x1, y1, x2, y2, step); ! ! curx = x1; ! ! if (y1 < y2) { ! for (j = y1; j < y2; j++, curx += step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == -1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! dir = 1; ! } else { ! for (j = y1; j > y2; j--, curx -= step) { ! // printf("j = %i, curx = %f\n", j, curx); ! putdot((int)(curx + 0.5), j); ! } ! if (dir == 1) { ! // printf("Adding extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); } + dir = -1; } ! } ! ! x1 = x2; ! y1 = y2; ! x2 = datas[0]; ! y2 = datas[1]; ! ! if (((y1 < y2) && (dir == -1)) || ((y1 > y2) && (dir == 1)) || ((y1 == y2) && (dir == 0))) { ! // printf("Adding final extra (%i, %i)\n", x1, y1); ! putdot(x1, y1); ! } ! ! // NOTE: all counters should be even now. If not, this is a bad (color) thing :-P ! ! // Sorting datas ! ! for (i = 0; i < SCREENHEIGHT; i++) { ! // Very bad sorting... but arrays are very small (0, 2 or 4), so it's no quite use... ! for (j = 0; j < (counters[i] - 1); j++) { ! for (k = 0; k < (counters[i] - 1); k++) { ! if (dots[i][k] > dots[i][k + 1]) ! { ! int temp; ! temp = dots[i][k]; ! dots[i][k] = dots[i][k + 1]; ! dots[i][k + 1] = temp; ! } ! } } ! } ! ! // Drawing. ! ! for (i = 0; i < SCREENHEIGHT; i++) { ! if (counters[i]) { ! // printf("%i dots on line %i\n", counters[i], i); ! for (j = 0; j < counters[i] - 1; j += 2) { ! // printf("Drawing line (%i, %i)-%i\n", dots[i][j], dots[i][j + 1], i); ! hline(dots[i][j], dots[i][j + 1], i, color); #ifdef DEBUGGING_POLYS ! if ((!dots[i][j]) || !(dots[i][j + 1])) { ! printf("fillpoly: BLARGH!\n"); ! exit(-1); ! } #endif ! } ! } ! } } |
From: Richard <tri...@us...> - 2005-11-01 22:02:37
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10867/src Modified Files: backgroundIncrust.c ctp.c mainDraw.c mainDraw.h Log Message: - more cleanup - small fixes Index: backgroundIncrust.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/backgroundIncrust.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** backgroundIncrust.c 29 Oct 2005 18:23:14 -0000 1.12 --- backgroundIncrust.c 1 Nov 2005 22:02:22 -0000 1.13 *************** *** 10,21 **** // blit background to another one ! void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char* ptr2, s16 arg2, char* ptr1, char* ptrFile) { ! if(*ptrFile == 0) { ASSERT(0); } ! mainDrawSub1Sub5(X, Y, arg2, ptr2, ptr1, ptrFile); } --- 10,21 ---- // blit background to another one ! void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char* ptr2, s16 scale, char* destBuffer, char* dataPtr) { ! if(*dataPtr == 0) { ASSERT(0); } ! buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr); } Index: mainDraw.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mainDraw.h 31 Oct 2005 12:47:05 -0000 1.9 --- mainDraw.h 1 Nov 2005 22:02:22 -0000 1.10 *************** *** 5,15 **** extern s16 polyBuffer3[404]; extern s16 polyBuffer2[512]; ! extern int modelVar11; int upscaleValue(int value, int scale); void mainDraw(s16 param); void flipScreen(void); ! void mainDrawSub1Sub5(int var_12, int var_14, int var_16, char* ptr2, char* destBuffer, char* dataPtr); ! void mainDrawSub1Sub1(int fileIndex, int X, int Y, int *var_16, int *var_14, int *var_12, char **var_1A, int param1, char* dataPtr); void mainDrawSub4(int objX1, int var_6, objectStruct* currentObjPtr, char* data1, int objY2, int objX2, char* output, char* data2); char* drawPolyMode2(char* si, int cx); --- 5,15 ---- extern s16 polyBuffer3[404]; extern s16 polyBuffer2[512]; ! extern int m_color; int upscaleValue(int value, int scale); void mainDraw(s16 param); void flipScreen(void); ! void buildPolyModel(int X, int Y, int scale, char* ptr2, char* destBuffer, char* dataPtr); ! void getPolyData(int fileIndex, int X, int Y, int *newScale, int *newY, int *newX, char **newDataPtr, int scale, char* dataPtr); void mainDrawSub4(int objX1, int var_6, objectStruct* currentObjPtr, char* data1, int objY2, int objX2, char* output, char* data2); char* drawPolyMode2(char* si, int cx); Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** mainDraw.c 31 Oct 2005 17:39:03 -0000 1.36 --- mainDraw.c 1 Nov 2005 22:02:22 -0000 1.37 *************** *** 121,125 **** int m_flipLeftRight; ! int modelVar2; int m_lowerX; int m_lowerY; --- 121,125 ---- int m_flipLeftRight; ! int m_useSmallScale; int m_lowerX; int m_lowerY; *************** *** 130,134 **** int m_current_X; int m_current_Y; ! int modelVar11; s16 polyBuffer[512]; --- 130,134 ---- int m_current_X; int m_current_Y; ! int m_color; s16 polyBuffer[512]; *************** *** 138,142 **** // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! void getPolySize(int spacingX, int spacingY, int scale, int sizeTable[4], unsigned char* dataPtr) { int upperBorder; --- 138,142 ---- // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsigned char* dataPtr) { int upperBorder; *************** *** 160,164 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= spacingX; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 160,164 ---- upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= positionX; upperBorder = -upperBorder; lowerBorder = upperBorder; *************** *** 175,179 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += spacingX; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 175,179 ---- upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += positionX; if(upperBorder < lowerBorder) // exchange borders if lower > upper *************** *** 191,195 **** upperBorder = *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= spacingY; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 191,195 ---- upperBorder = *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= positionY; upperBorder = -upperBorder; lowerBorder = upperBorder; *************** *** 200,204 **** upperBorder -= *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += spacingY; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 200,204 ---- upperBorder -= *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += positionY; if(upperBorder < lowerBorder) // exchange borders if lower > upper *************** *** 395,419 **** for(i = 0; i < polyVar1; i++) { ! line(polyBuffer4[i * 2], polyBuffer4[i * 2 + 1], polyBuffer4[(i + 1) * 2], polyBuffer4[(i + 1) * 2 + 1], modelVar11 & 0xF); } ! fillpoly(polyBuffer4, polyVar1, modelVar11&0xF); } ! char* drawPolyMode1(char* dataPointer, int curValue) { int index; s16* pBufferDest; ! polyVar1 = curValue; ! pBufferDest = &polyBuffer4[polyVar1 * 2]; ! index = *(dataPointer++); ! ! polySize1 = polySize2 = pBufferDest[-2] = pBufferDest[-2 + curValue * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[-1] = pBufferDest[-1 + curValue * 2] = polyBuffer2[(index * 2) + 1]; ! curValue--; pBufferDest -= 2; --- 395,417 ---- for(i = 0; i < polyVar1; i++) { ! line(polyBuffer4[i * 2], polyBuffer4[i * 2 + 1], polyBuffer4[(i + 1) * 2], polyBuffer4[(i + 1) * 2 + 1], m_color & 0xF); } ! fillpoly(polyBuffer4, polyVar1, m_color & 0xF); } ! char* drawPolyMode1(char* dataPointer, int linesToDraw) { int index; s16* pBufferDest; ! polyVar1 = linesToDraw; pBufferDest = &polyBuffer4[polyVar1 * 2]; + index = *(dataPointer++); ! polySize1 = polySize2 = pBufferDest[-2] = pBufferDest[-2 + linesToDraw * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[-1] = pBufferDest[-1 + linesToDraw * 2] = polyBuffer2[(index * 2) + 1]; ! linesToDraw--; pBufferDest -= 2; *************** *** 450,454 **** pBufferDest -= 2; ! } while(--curValue); drawPolySub(); --- 448,452 ---- pBufferDest -= 2; ! } while(--linesToDraw); drawPolySub(); *************** *** 457,461 **** } ! char* drawPolyMode2(char* dataPointer, int curValue) { int index; --- 455,459 ---- } ! char* drawPolyMode2(char* dataPointer, int linesToDraw) { int index; *************** *** 463,475 **** pBufferDest = polyBuffer4; ! polyVar1 = curValue; polyVar2 = polyBuffer4; ! index = *(dataPointer++); ! ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[curValue * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[1] = pBufferDest[curValue * 2 + 1] = polyBuffer2[(index * 2) + 1]; ! curValue--; pBufferDest += 2; --- 461,472 ---- pBufferDest = polyBuffer4; ! polyVar1 = linesToDraw; polyVar2 = polyBuffer4; + index = *(dataPointer++); ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[linesToDraw * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[1] = pBufferDest[linesToDraw * 2 + 1] = polyBuffer2[(index * 2) + 1]; ! linesToDraw--; pBufferDest += 2; *************** *** 505,509 **** pBufferDest += 2; ! } while(--curValue); drawPolySub(); --- 502,506 ---- pBufferDest += 2; ! } while(--linesToDraw); drawPolySub(); *************** *** 512,517 **** } ! // parse all ! void mainDrawSub1Sub5(int spacingX, int spacingY, int scale, char* ptr2, char* destBuffer, char* dataPtr) { int counter = 0; // numbers of coordinates to process --- 509,514 ---- } ! // this function builds the poly model and then calls the draw functions (OLD: mainDrawSub1Sub5) ! void buildPolyModel(int positionX, int positionY, int scale, char* ptr2, char* destBuffer, char* dataPtr) { int counter = 0; // numbers of coordinates to process *************** *** 528,532 **** m_flipLeftRight = 0; ! modelVar2 = 0; m_lowerX = *(dataPointer + 3); m_lowerY = *(dataPointer + 4); --- 525,529 ---- m_flipLeftRight = 0; ! m_useSmallScale = 0; m_lowerX = *(dataPointer + 3); m_lowerY = *(dataPointer + 4); *************** *** 540,544 **** if(scale < 0x180) // If scale is smaller than 384 { ! modelVar2 = 1; m_scaleValue = scale << 1; // double scale } --- 537,541 ---- if(scale < 0x180) // If scale is smaller than 384 { ! m_useSmallScale = 1; m_scaleValue = scale << 1; // double scale } *************** *** 556,560 **** startY = m_lowerY - m_first_Y; ! if(modelVar2) { startX >>= 1; --- 553,557 ---- startY = m_lowerY - m_first_Y; ! if(m_useSmallScale) { startX >>= 1; *************** *** 571,602 **** The original code continues here with using X, Y instead of startX and StartY. ! Since X, Y are actually spacing values it makes more sense to use startX and startY. ! Original code: ! X -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; ! Y -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; */ // get coordinates from data ! startX = spacingX - ((upscaleValue(startX, m_scaleValue) + 0x8000) >> 16); ! startY = spacingY - ((upscaleValue(startY, m_scaleValue) + 0x8000) >> 16); ptrPoly_1_Buf[0] = 0; ptrPoly_1_Buf[1] = 0; ptrPoly_1_Buf += 2; ! counter = m_coordCount - 2; // skip the first two, we already have the values do { - // X - x = *(dataPointer++) - m_first_X; y = *(dataPointer++) - m_first_Y; ! if(modelVar2) { ! x >>= 1; // scale down? ! y >>= 1; // scale down? } --- 568,596 ---- The original code continues here with using X, Y instead of startX and StartY. ! Original code: ! positionX -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; ! positionY -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; */ // get coordinates from data ! startX = positionX - ((upscaleValue(startX, m_scaleValue) + 0x8000) >> 16); ! startY = positionY - ((upscaleValue(startY, m_scaleValue) + 0x8000) >> 16); ptrPoly_1_Buf[0] = 0; ptrPoly_1_Buf[1] = 0; ptrPoly_1_Buf += 2; ! counter = m_coordCount - 2; // skip the first pair, we already have the values do { x = *(dataPointer++) - m_first_X; y = *(dataPointer++) - m_first_Y; ! if(m_useSmallScale) // all shrink coordinates by factor 2 if a scale smaller than 384 is used { ! x >>= 1; ! y >>= 1; } *************** *** 605,609 **** offsetXinModel = x; ! ptrPoly_1_Buf[0] = (offsetYinModel - y) * -1; ptrPoly_1_Buf++; offsetYinModel = y; --- 599,603 ---- offsetXinModel = x; ! ptrPoly_1_Buf[0] = -(offsetYinModel - y); ptrPoly_1_Buf++; offsetYinModel = y; *************** *** 619,623 **** ptrPoly_2_Buf = polyBuffer; ptrPoly_1_Buf = polyBuffer2; ! counter = m_coordCount; // reset counter m_current_X = 0; m_current_Y = 0; --- 613,617 ---- ptrPoly_2_Buf = polyBuffer; ptrPoly_1_Buf = polyBuffer2; ! counter = m_coordCount - 1; // reset counter m_current_X = 0; m_current_Y = 0; *************** *** 639,643 **** m_current_Y += upscaleValue(ptrPoly_2_Buf[1], m_scaleValue); ptrPoly_1_Buf[1] = ((m_current_Y + 0x8000) >> 16) + startY; // adjust Y value with start offset ! ///////////////// --- 633,637 ---- m_current_Y += upscaleValue(ptrPoly_2_Buf[1], m_scaleValue); ptrPoly_1_Buf[1] = ((m_current_Y + 0x8000) >> 16) + startY; // adjust Y value with start offset ! ///////////////// *************** *** 646,661 **** } while(--counter); ! // position of the dataPointer is m_coordCount * 2 do { ! int curValue = *dataPointer++; // some sort of index I guess? ! if(curValue > 1) // if value not zero { u16 tempU16; ! modelVar11 = *dataPointer; // put current value into modelVar11 dataPointer += 2; --- 640,655 ---- } while(--counter); ! // position of the dataPointer is m_coordCount * 2 do { ! int linesToDraw = *dataPointer++; ! if(linesToDraw > 1) // if value not zero { u16 tempU16; ! m_color = *dataPointer; // color dataPointer += 2; *************** *** 665,671 **** flipShort(&tempU16); ! if(tempU16 > scale) { ! dataPointer += curValue; if(*dataPointer == 0xFF) --- 659,665 ---- flipShort(&tempU16); ! if(tempU16 > scale) // is this part correct? seems strange, but no problems so far { ! dataPointer += linesToDraw; // skip ahead if(*dataPointer == 0xFF) *************** *** 678,686 **** if(m_flipLeftRight) { ! dataPointer = drawPolyMode1(dataPointer, curValue); } else { ! dataPointer = drawPolyMode2(dataPointer, curValue); } --- 672,680 ---- if(m_flipLeftRight) { ! dataPointer = drawPolyMode1(dataPointer, linesToDraw); } else { ! dataPointer = drawPolyMode2(dataPointer, linesToDraw); } *************** *** 689,697 **** if(ptr2) { ! blitPolyMode1(destBuffer, ptr2, polyBuffer3, modelVar11 & 0xF); } else { ! blitPolyMode2(destBuffer, polyBuffer3, modelVar11 & 0xF); } } --- 683,691 ---- if(ptr2) { ! blitPolyMode1(destBuffer, ptr2, polyBuffer3, m_color & 0xF); } else { ! blitPolyMode2(destBuffer, polyBuffer3, m_color & 0xF); } } *************** *** 787,791 **** } ! mainDrawSub1Sub5(newX, newY, newScale, ptr2, destBuffer, newDataPtr); } --- 781,786 ---- } ! // this function builds the poly model and then calls the draw functions (OLD: mainDrawSub1Sub5) ! buildPolyModel(newX, newY, newScale, ptr2, destBuffer, newDataPtr); } Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ctp.c 31 Oct 2005 12:47:05 -0000 1.7 --- ctp.c 1 Nov 2005 22:02:22 -0000 1.8 *************** *** 143,147 **** } ! modelVar11 = 0; ctpVarUnk = 0; --- 143,147 ---- } ! m_color = 0; ctpVarUnk = 0; |
From: Richard <tri...@us...> - 2005-10-31 17:39:15
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9657/src Modified Files: mainDraw.c Log Message: more cleanup (work in progress) Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** mainDraw.c 31 Oct 2005 12:47:05 -0000 1.35 --- mainDraw.c 31 Oct 2005 17:39:03 -0000 1.36 *************** *** 120,133 **** } ! int flipLeftRight; int modelVar2; ! int modelVar3; ! int modelVar4; ! int modelVar5; ! int modelVar6; ! int modelVar7; ! int modelVar8; ! int modelVar9; ! int modelVar10; int modelVar11; --- 120,133 ---- } ! int m_flipLeftRight; int modelVar2; ! int m_lowerX; ! int m_lowerY; ! int m_coordCount; ! int m_first_X; ! int m_first_Y; ! int m_scaleValue; ! int m_current_X; ! int m_current_Y; int modelVar11; *************** *** 138,150 **** // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! void getPolySize(int X, int Y, int scale, int sizeTable[4], unsigned char* dataPtr) { int upperBorder; int lowerBorder; ! flipLeftRight = 0; if(scale < 0) // flip left right { ! flipLeftRight = 1; scale = -scale; } --- 138,150 ---- // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! void getPolySize(int spacingX, int spacingY, int scale, int sizeTable[4], unsigned char* dataPtr) { int upperBorder; int lowerBorder; ! m_flipLeftRight = 0; if(scale < 0) // flip left right { ! m_flipLeftRight = 1; scale = -scale; } *************** *** 154,158 **** upperBorder = *(dataPtr + 3); ! if(flipLeftRight) { upperBorder = -upperBorder; --- 154,158 ---- upperBorder = *(dataPtr + 3); ! if(m_flipLeftRight) { upperBorder = -upperBorder; *************** *** 160,164 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= X; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 160,164 ---- upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= spacingX; upperBorder = -upperBorder; lowerBorder = upperBorder; *************** *** 167,173 **** upperBorder = *(dataPtr + 1); ! upperBorder -= *(dataPtr + 3) ; ! if(flipLeftRight) { upperBorder = -upperBorder; --- 167,173 ---- upperBorder = *(dataPtr + 1); ! upperBorder -= *(dataPtr + 3); ! if(m_flipLeftRight) { upperBorder = -upperBorder; *************** *** 175,179 **** upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += X; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 175,179 ---- upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += spacingX; if(upperBorder < lowerBorder) // exchange borders if lower > upper *************** *** 191,195 **** upperBorder = *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= Y; upperBorder = -upperBorder; lowerBorder = upperBorder; --- 191,195 ---- upperBorder = *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= spacingY; upperBorder = -upperBorder; lowerBorder = upperBorder; *************** *** 200,204 **** upperBorder -= *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += Y; if(upperBorder < lowerBorder) // exchange borders if lower > upper --- 200,204 ---- upperBorder -= *(dataPtr + 4); upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += spacingY; if(upperBorder < lowerBorder) // exchange borders if lower > upper *************** *** 401,419 **** } ! char* drawPolyMode1(char* si, int cx) { int index; s16* pBufferDest; ! polyVar1 = cx; pBufferDest = &polyBuffer4[polyVar1 * 2]; ! index = *(si++); ! polySize1 = polySize2 = pBufferDest[-2] = pBufferDest[-2 + cx * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[-1] = pBufferDest[-1 + cx * 2] = polyBuffer2[(index * 2) + 1]; ! cx--; pBufferDest -= 2; --- 401,419 ---- } ! char* drawPolyMode1(char* dataPointer, int curValue) { int index; s16* pBufferDest; ! polyVar1 = curValue; pBufferDest = &polyBuffer4[polyVar1 * 2]; ! index = *(dataPointer++); ! polySize1 = polySize2 = pBufferDest[-2] = pBufferDest[-2 + curValue * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[-1] = pBufferDest[-1 + curValue * 2] = polyBuffer2[(index * 2) + 1]; ! curValue--; pBufferDest -= 2; *************** *** 425,436 **** int value; ! index = *(si++); value = pBufferDest[-2] = pBufferDest[-2 + polyVar1 * 2] = polyBuffer2[index * 2]; ! if( value < polySize1 ) { polySize1 = value; } ! if( value > polySize2 ) { polySize2 = value; --- 425,436 ---- int value; ! index = *(dataPointer++); value = pBufferDest[-2] = pBufferDest[-2 + polyVar1 * 2] = polyBuffer2[index * 2]; ! if(value < polySize1) { polySize1 = value; } ! if(value > polySize2) { polySize2 = value; *************** *** 450,461 **** pBufferDest -= 2; ! } while(--cx); drawPolySub(); ! return si; } ! char* drawPolyMode2(char* si, int cx) { int index; --- 450,461 ---- pBufferDest -= 2; ! } while(--curValue); drawPolySub(); ! return dataPointer; } ! char* drawPolyMode2(char* dataPointer, int curValue) { int index; *************** *** 463,475 **** pBufferDest = polyBuffer4; ! polyVar1 = cx; polyVar2 = polyBuffer4; ! index = *(si++); ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[cx * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[1] = pBufferDest[cx * 2 + 1] = polyBuffer2[(index * 2) + 1]; ! cx--; pBufferDest += 2; --- 463,475 ---- pBufferDest = polyBuffer4; ! polyVar1 = curValue; polyVar2 = polyBuffer4; ! index = *(dataPointer++); ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[curValue * 2] = polyBuffer2[index * 2]; ! polySize1 = polySize2 = pBufferDest[1] = pBufferDest[curValue * 2 + 1] = polyBuffer2[(index * 2) + 1]; ! curValue--; pBufferDest += 2; *************** *** 479,483 **** int value; ! index = *(si++); value = pBufferDest[0] = pBufferDest[polyVar1 * 2] = polyBuffer2[index * 2]; --- 479,483 ---- int value; ! index = *(dataPointer++); value = pBufferDest[0] = pBufferDest[polyVar1 * 2] = polyBuffer2[index * 2]; *************** *** 505,690 **** pBufferDest += 2; ! } while(--cx); drawPolySub(); ! return si; } // parse all ! void mainDrawSub1Sub5(int X, int Y, int scale, char* ptr2, char* destBuffer, char* dataPtr) { ! int cx; ! int ax; ! int temp; ! int bx; ! int dx; unsigned char* dataPointer = dataPtr; ! s16* si2; ! s16* di = polyBuffer; ! ! polyOutputBuffer = destBuffer; ! flipLeftRight = 0; ! modelVar2 = 0; ! modelVar3 = *(dataPointer + 3); ! modelVar4 = *(dataPointer + 4); if(scale < 0) { ! scale = -scale; ! flipLeftRight = 1; } ! if(scale < 0x180) // 384 { ! modelVar2 = 1; } ! ! dataPointer += 5; ! ! modelVar5 = (*(dataPointer++)) + 1; ! modelVar6 = *(dataPointer++); ! modelVar7 = *(dataPointer++); ! ! di[0] = 0; ! di[1] = 0; ! di += 2; ! cx = modelVar5 - 2; ! bx = 0; ! dx = 0; ! ! do ! { ! ax = *(dataPointer++); ! ax -= modelVar6; ! ! if(modelVar2) ! { ! ax >>= 1; ! } ! ! bx -= ax; ! temp = ax; ! ax = bx; ! bx = temp; ! ! di[0] = ax; ! di++; ! ax = *(dataPointer++); ! ax -= modelVar7; ! ! if(modelVar2) ! { ! ax >>= 1; ! } ! dx -= ax; ! dx = -dx; ! ! temp = ax; ! ax = dx; ! dx = temp; ! ! di[0] = ax; ! di++; ! ! } while(--cx); ! ! ax = scale; ! ! if(modelVar2) { ! ax <<= 1; } ! modelVar8 = ax; ! ax = modelVar3 - modelVar6; if(modelVar2) { ! ax >>= 1; } ! if(flipLeftRight) { ! ax = -ax; } ! X -= (upscaleValue(ax, modelVar8) + 0x8000) >> 16; ! ax = modelVar4 - modelVar7; ! if(modelVar2) { ! ax >>= 1; ! } ! Y -= (upscaleValue(ax, modelVar8)+ 0x8000) >> 16; ! si2 = polyBuffer; ! di = polyBuffer2; ! di[0] = si2[0] + X; ! di[1] = si2[1] + Y; ! di += 2; ! si2 += 2; ! cx = modelVar5 - 2; ! modelVar9 = 0; ! modelVar10 = 0; do { ! ax = si2[0]; ! if(flipLeftRight == 0) { ! ax = -ax; } ////////////////// - /* { - int x1; - int y1; ! x1 = upscaleValue(ax, modelVar8); ! ! modelVar9 += x1; ! di[0] = ((modelVar9 + 0x8000) >> 16) + X; ! ax = si2[1]; ! y1 = upscaleValue(ax, modelVar8); ! modelVar10 += y1; ! di[1] = ((modelVar10 + 0x8000) >> 16) + Y; ! } ! */ ! { ! modelVar9 += upscaleValue(ax, modelVar8); ! di[0] = ((modelVar9 + 0x8000) >> 16) + X; - modelVar10 += upscaleValue(si2[1], modelVar8); - di[1] = ((modelVar10 + 0x8000) >> 16) + Y; - } ///////////////// ! di += 2; ! si2 += 2; ! } while(--cx); do { ! ax = *(dataPointer++); ! cx = ax; ! if(cx > 1) { u16 tempU16; ! modelVar11 = *dataPointer; dataPointer += 2; ! tempU16 = *(u16*)(dataPointer); dataPointer += 2; --- 505,664 ---- pBufferDest += 2; ! } while(--curValue); drawPolySub(); ! return dataPointer; } // parse all ! void mainDrawSub1Sub5(int spacingX, int spacingY, int scale, char* ptr2, char* destBuffer, char* dataPtr) { ! int counter = 0; // numbers of coordinates to process ! int startX = 0; // first X in model ! int startY = 0; // first Y in model ! int x = 0; // current X ! int y = 0; // current Y ! int offsetXinModel = 0; // offset of the X value in the model ! int offsetYinModel = 0; // offset of the Y value in the model unsigned char* dataPointer = dataPtr; ! s16* ptrPoly_1_Buf = polyBuffer; ! s16* ptrPoly_2_Buf; ! polyOutputBuffer = destBuffer; // global ! m_flipLeftRight = 0; ! modelVar2 = 0; ! m_lowerX = *(dataPointer + 3); ! m_lowerY = *(dataPointer + 4); if(scale < 0) { ! scale = -scale; // flip left right ! m_flipLeftRight = 1; } ! if(scale < 0x180) // If scale is smaller than 384 { ! modelVar2 = 1; ! m_scaleValue = scale << 1; // double scale } ! else { ! m_scaleValue = scale; } ! dataPointer += 5; ! m_coordCount = (*(dataPointer++)) + 1; ! m_first_X = *(dataPointer++); ! m_first_Y = *(dataPointer++); ! startX = m_lowerX - m_first_X; ! startY = m_lowerY - m_first_Y; if(modelVar2) { ! startX >>= 1; ! startY >>= 1; } ! ! if(m_flipLeftRight) { ! startX = -startX; } ! /* ! NOTE: ! The original code continues here with using X, Y instead of startX and StartY. ! Since X, Y are actually spacing values it makes more sense to use startX and startY. ! ! Original code: ! X -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; ! Y -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; ! */ ! ! // get coordinates from data ! startX = spacingX - ((upscaleValue(startX, m_scaleValue) + 0x8000) >> 16); ! startY = spacingY - ((upscaleValue(startY, m_scaleValue) + 0x8000) >> 16); ! ! ptrPoly_1_Buf[0] = 0; ! ptrPoly_1_Buf[1] = 0; ! ptrPoly_1_Buf += 2; ! counter = m_coordCount - 2; // skip the first two, we already have the values ! ! do { ! // X ! x = *(dataPointer++) - m_first_X; ! y = *(dataPointer++) - m_first_Y; ! ! if(modelVar2) ! { ! x >>= 1; // scale down? ! y >>= 1; // scale down? ! } ! ptrPoly_1_Buf[0] = offsetXinModel - x; ! ptrPoly_1_Buf++; ! offsetXinModel = x; ! ! ptrPoly_1_Buf[0] = (offsetYinModel - y) * -1; ! ptrPoly_1_Buf++; ! offsetYinModel = y; ! } while(--counter); ! // scale and adjust coordinates with offset (using two polybuffers by doing that) ! /* ! NOTE: Is there a need for having two, a scaled and unscaled polybuffer? ! */ ! ! ptrPoly_2_Buf = polyBuffer; ! ptrPoly_1_Buf = polyBuffer2; ! counter = m_coordCount; // reset counter ! m_current_X = 0; ! m_current_Y = 0; do { ! x = ptrPoly_2_Buf[0]; ! if(m_flipLeftRight == 0) { ! x = -x; } ////////////////// ! m_current_X += upscaleValue(x, m_scaleValue); ! ptrPoly_1_Buf[0] = ((m_current_X + 0x8000) >> 16) + startX; // adjust X value with start offset ! m_current_Y += upscaleValue(ptrPoly_2_Buf[1], m_scaleValue); ! ptrPoly_1_Buf[1] = ((m_current_Y + 0x8000) >> 16) + startY; // adjust Y value with start offset ///////////////// ! ptrPoly_1_Buf += 2; ! ptrPoly_2_Buf += 2; ! } while(--counter); ! ! // position of the dataPointer is m_coordCount * 2 do { ! int curValue = *dataPointer++; // some sort of index I guess? ! if(curValue > 1) // if value not zero { u16 tempU16; ! modelVar11 = *dataPointer; // put current value into modelVar11 dataPointer += 2; ! tempU16 = *(u16*) (dataPointer); dataPointer += 2; *************** *** 693,697 **** if(tempU16 > scale) { ! dataPointer += cx; if(*dataPointer == 0xFF) --- 667,671 ---- if(tempU16 > scale) { ! dataPointer += curValue; if(*dataPointer == 0xFF) *************** *** 702,712 **** else { ! if(flipLeftRight) { ! dataPointer = drawPolyMode1(dataPointer, cx); } else { ! dataPointer = drawPolyMode2(dataPointer, cx); } --- 676,686 ---- else { ! if(m_flipLeftRight) { ! dataPointer = drawPolyMode1(dataPointer, curValue); } else { ! dataPointer = drawPolyMode2(dataPointer, curValue); } *************** *** 715,723 **** if(ptr2) { ! blitPolyMode1(destBuffer, ptr2, polyBuffer3, modelVar11&0xF); } else { ! blitPolyMode2(destBuffer, polyBuffer3, modelVar11&0xF); } } --- 689,697 ---- if(ptr2) { ! blitPolyMode1(destBuffer, ptr2, polyBuffer3, modelVar11 & 0xF); } else { ! blitPolyMode2(destBuffer, polyBuffer3, modelVar11 & 0xF); } } *************** *** 731,736 **** else { ! cx += 4; ! dataPointer += cx; if(*dataPointer == 0xFF) --- 705,709 ---- else { ! dataPointer += 4; if(*dataPointer == 0xFF) |
From: Richard <tri...@us...> - 2005-10-31 12:47:13
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4604/src Modified Files: ctp.c mainDraw.c mainDraw.h Log Message: forgot to change this last night mulFixed is now upScaleValue Index: mainDraw.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mainDraw.h 20 Oct 2005 09:34:42 -0000 1.8 --- mainDraw.h 31 Oct 2005 12:47:05 -0000 1.9 *************** *** 7,11 **** extern int modelVar11; ! int mulFixed(int var1, int var2); void mainDraw(s16 param); void flipScreen(void); --- 7,11 ---- extern int modelVar11; ! int upscaleValue(int value, int scale); void mainDraw(s16 param); void flipScreen(void); Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** mainDraw.c 31 Oct 2005 02:56:13 -0000 1.34 --- mainDraw.c 31 Oct 2005 12:47:05 -0000 1.35 *************** *** 115,121 **** } ! int mulFixed(int sizeValue, int scale) { ! return (((sizeValue * scale) << 8) / 2); } --- 115,121 ---- } ! int upscaleValue(int value, int scale) { ! return (((value * scale) << 8) / 2); } *************** *** 142,146 **** int upperBorder; int lowerBorder; - int sizeTemp; flipLeftRight = 0; --- 142,145 ---- *************** *** 159,164 **** upperBorder = -upperBorder; } ! ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; upperBorder -= X; upperBorder = -upperBorder; --- 158,163 ---- upperBorder = -upperBorder; } ! ! upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; upperBorder -= X; upperBorder = -upperBorder; *************** *** 167,173 **** // X2 - sizeTemp = *(dataPtr + 3); upperBorder = *(dataPtr + 1); ! upperBorder -= sizeTemp ; if(flipLeftRight) --- 166,171 ---- // X2 upperBorder = *(dataPtr + 1); ! upperBorder -= *(dataPtr + 3) ; if(flipLeftRight) *************** *** 176,180 **** } ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; upperBorder += X; --- 174,178 ---- } ! upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; upperBorder += X; *************** *** 192,196 **** upperBorder = *(dataPtr + 4); ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; upperBorder -= Y; upperBorder = -upperBorder; --- 190,194 ---- upperBorder = *(dataPtr + 4); ! upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; upperBorder -= Y; upperBorder = -upperBorder; *************** *** 199,206 **** // Y2 - sizeTemp = *(dataPtr + 4); upperBorder = *(dataPtr + 2); ! upperBorder -= sizeTemp; ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; upperBorder += Y; --- 197,203 ---- // Y2 upperBorder = *(dataPtr + 2); ! upperBorder -= *(dataPtr + 4); ! upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16; upperBorder += Y; *************** *** 614,618 **** } ! X -= (mulFixed(ax, modelVar8) + 0x8000) >> 16; ax = modelVar4 - modelVar7; --- 611,615 ---- } ! X -= (upscaleValue(ax, modelVar8) + 0x8000) >> 16; ax = modelVar4 - modelVar7; *************** *** 623,627 **** } ! Y -= (mulFixed(ax, modelVar8)+ 0x8000) >> 16; si2 = polyBuffer; --- 620,624 ---- } ! Y -= (upscaleValue(ax, modelVar8)+ 0x8000) >> 16; si2 = polyBuffer; *************** *** 652,656 **** int y1; ! x1 = mulFixed(ax, modelVar8); modelVar9 += x1; --- 649,653 ---- int y1; ! x1 = upscaleValue(ax, modelVar8); modelVar9 += x1; *************** *** 658,662 **** ax = si2[1]; ! y1 = mulFixed(ax, modelVar8); modelVar10 += y1; di[1] = ((modelVar10 + 0x8000) >> 16) + Y; --- 655,659 ---- ax = si2[1]; ! y1 = upscaleValue(ax, modelVar8); modelVar10 += y1; di[1] = ((modelVar10 + 0x8000) >> 16) + Y; *************** *** 664,671 **** */ { ! modelVar9 += mulFixed(ax, modelVar8); di[0] = ((modelVar9 + 0x8000) >> 16) + X; ! modelVar10 += mulFixed(si2[1], modelVar8); di[1] = ((modelVar10 + 0x8000) >> 16) + Y; } --- 661,668 ---- */ { ! modelVar9 += upscaleValue(ax, modelVar8); di[0] = ((modelVar9 + 0x8000) >> 16) + X; ! modelVar10 += upscaleValue(si2[1], modelVar8); di[1] = ((modelVar10 + 0x8000) >> 16) + Y; } Index: ctp.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/ctp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ctp.c 20 Oct 2005 09:34:42 -0000 1.6 --- ctp.c 31 Oct 2005 12:47:05 -0000 1.7 *************** *** 118,123 **** s16* destination; ! wbSelf1 = (mulFixed(X1, param1)/2) - X2; ! wbSelf2 = (mulFixed(Y1, param1)/2) - Y2; numPoints = *(walkboxData++); --- 118,123 ---- s16* destination; ! wbSelf1 = upscaleValue(X1, param1) - X2; ! wbSelf2 = upscaleValue(Y1, param1) - Y2; numPoints = *(walkboxData++); *************** *** 136,141 **** pointY = *(walkboxData++); ! scaledX = (mulFixed(pointX, param1)/2) - wbSelf1; ! scaledY = (mulFixed(pointY, param1)/2) - wbSelf2; *(destination++) = scaledX>>16; --- 136,141 ---- pointY = *(walkboxData++); ! scaledX = upscaleValue(pointX, param1) - wbSelf1; ! scaledY = upscaleValue(pointY, param1) - wbSelf2; *(destination++) = scaledX>>16; |
From: Richard <tri...@us...> - 2005-10-31 02:56:25
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28141/src Modified Files: mainDraw.c Log Message: major cleanup of the draw function for the polys mainDrawSub1 is now mainDrawPolygons mainDrawSub1Sub1 is now getPolyData mainDrawSub1Sub2 is now getPolySize modelVar1 is now flipLeftRight ... much more Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** mainDraw.c 30 Oct 2005 23:38:57 -0000 1.33 --- mainDraw.c 31 Oct 2005 02:56:13 -0000 1.34 *************** *** 71,123 **** char* polyOutputBuffer; ! void mainDrawSub1Sub1(int fileIndex, int X, int Y, int *var_16, int *var_14, int *var_12, char **var_1A, int scale, char* dataPtr) { if(*(u16*) dataPtr == 0) { ! u16 var_6; ! u16 var_8; ! char* var_E; ! u16 var_A; ! dataPtr += 2; ! var_6 = *(u16*) dataPtr; ! flipShort(&var_6); dataPtr += 2; ! var_8 = *(u16*) dataPtr; ! flipShort(&var_8); ! var_E = dataPtr; ! var_A = *(u16*) (var_E + 2); ! flipShort(&var_A); ! var_6 += fileIndex; ! if(var_6 >= 0) { ! if(filesDatabase[var_6].resType == 0 && filesDatabase[var_6].subData.ptr) { ! dataPtr = filesDatabase[var_6].subData.ptr; } } scale = -scale; ! X -= var_8; ! Y -= var_A; } ! *var_1A = dataPtr; ! *var_12 = X; ! *var_14 = Y; ! *var_16 = scale; } ! int mulFixed(int var1, int var2) { ! return ((var1*var2)<<8); } ! int modelVar1; int modelVar2; int modelVar3; --- 71,124 ---- char* polyOutputBuffer; ! // this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1) ! void getPolyData(int fileIndex, int X, int Y, int *outScale, int *outY, int *outX, char **outDataPtr, int scale, char* dataPtr) { if(*(u16*) dataPtr == 0) { ! u16 newFileIndex; ! u16 newX; ! char* newDataPtr; // this one is quite useless ! u16 newY; ! dataPtr += 2; ! newFileIndex = *(u16*) dataPtr; ! flipShort(&newFileIndex); dataPtr += 2; ! newX = *(u16*) dataPtr; ! flipShort(&newX); ! newDataPtr = dataPtr; // useless ! newY = *(u16*) (newDataPtr + 2); ! flipShort(&newY); ! newFileIndex += fileIndex; ! if(newFileIndex >= 0) { ! if(filesDatabase[newFileIndex].resType == 0 && filesDatabase[newFileIndex].subData.ptr) { ! dataPtr = filesDatabase[newFileIndex].subData.ptr; } } scale = -scale; ! X -= newX; ! Y -= newY; } ! *outDataPtr = dataPtr; ! *outX = X; ! *outY = Y; ! *outScale = scale; } ! int mulFixed(int sizeValue, int scale) { ! return (((sizeValue * scale) << 8) / 2); } ! int flipLeftRight; int modelVar2; int modelVar3; *************** *** 136,221 **** s16 polyBuffer4[512]; ! void mainDrawSub1Sub2(int var_12, int var_14, int var_16, int sizeTable[4], unsigned char* var_1A) { ! int ax; ! int cx; ! int dx; ! modelVar1 = 0; ! if(var_16 < 0) // flip { ! modelVar1 = 1; ! var_16 = -var_16; } ! //// X1 ! ax = *(var_1A+3); ! if(modelVar1) { ! ax = -ax; } ! ax = ((mulFixed(ax, var_16) / 2) + 0x8000) >> 16; ! ! ax -= var_12; ! ax = -ax; ! cx = ax; ! ! //// X2 ! dx = *(var_1A + 3); ! ax = *(var_1A + 1); ! ax -= dx; ! if(modelVar1) { ! ax = -ax; } ! ax = ((mulFixed(ax, var_16) / 2) + 0x8000) >> 16; ! ax += var_12; ! if(ax < cx) { ! int temp = ax; ! ax = cx; ! cx = temp; } ! sizeTable[1] = ax; ! sizeTable[0] = cx; ! ! //// Y1 ! ! ax = *(var_1A+4); ! ! ax = ((mulFixed(ax, var_16) / 2)+0x8000) >> 16; ! ! ax -= var_14; ! ax = -ax; ! cx = ax; ! //// X2 ! dx = *(var_1A+4); ! ax = *(var_1A+2); ! ax -= dx; ! ax = ((mulFixed(ax, var_16) / 2) + 0x8000) >> 16; ! ax += var_14; ! if(ax < cx) { ! int temp = ax; ! ax = cx; ! cx = temp; } ! sizeTable[3] = ax; ! sizeTable[2] = cx; } --- 137,217 ---- s16 polyBuffer4[512]; ! // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! void getPolySize(int X, int Y, int scale, int sizeTable[4], unsigned char* dataPtr) { ! int upperBorder; ! int lowerBorder; ! int sizeTemp; ! flipLeftRight = 0; ! if(scale < 0) // flip left right { ! flipLeftRight = 1; ! scale = -scale; } ! // X1 ! upperBorder = *(dataPtr + 3); ! if(flipLeftRight) { ! upperBorder = -upperBorder; } ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= X; ! upperBorder = -upperBorder; ! lowerBorder = upperBorder; ! // X2 ! sizeTemp = *(dataPtr + 3); ! upperBorder = *(dataPtr + 1); ! upperBorder -= sizeTemp ; ! if(flipLeftRight) { ! upperBorder = -upperBorder; } ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += X; ! if(upperBorder < lowerBorder) // exchange borders if lower > upper { ! int temp = upperBorder; ! upperBorder = lowerBorder; ! lowerBorder = temp; } ! sizeTable[0] = lowerBorder; // left ! sizeTable[1] = upperBorder; // right ! // Y1 ! upperBorder = *(dataPtr + 4); ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; ! upperBorder -= Y; ! upperBorder = -upperBorder; ! lowerBorder = upperBorder; ! // Y2 ! sizeTemp = *(dataPtr + 4); ! upperBorder = *(dataPtr + 2); ! upperBorder -= sizeTemp; ! upperBorder = (mulFixed(upperBorder, scale) + 0x8000) >> 16; ! upperBorder += Y; ! if(upperBorder < lowerBorder) // exchange borders if lower > upper { ! int temp = upperBorder; ! upperBorder = lowerBorder; ! lowerBorder = temp; } ! sizeTable[2] = lowerBorder; // bottom ! sizeTable[3] = upperBorder; // top } *************** *** 402,406 **** for(i = 0; i < polyVar1; i++) { ! line(polyBuffer4[i*2], polyBuffer4[i*2+1], polyBuffer4[(i+1)*2], polyBuffer4[(i+1)*2+1], modelVar11&0xF); } --- 398,402 ---- for(i = 0; i < polyVar1; i++) { ! line(polyBuffer4[i * 2], polyBuffer4[i * 2 + 1], polyBuffer4[(i + 1) * 2], polyBuffer4[(i + 1) * 2 + 1], modelVar11 & 0xF); } *************** *** 520,524 **** // parse all ! void mainDrawSub1Sub5(int var_12, int var_14, int var_16, char* ptr2, char* destBuffer, char* dataPtr) { int cx; --- 516,520 ---- // parse all ! void mainDrawSub1Sub5(int X, int Y, int scale, char* ptr2, char* destBuffer, char* dataPtr) { int cx; *************** *** 527,531 **** int bx; int dx; ! unsigned char* si = dataPtr; s16* si2; s16* di = polyBuffer; --- 523,527 ---- int bx; int dx; ! unsigned char* dataPointer = dataPtr; s16* si2; s16* di = polyBuffer; *************** *** 533,559 **** polyOutputBuffer = destBuffer; ! modelVar1 = 0; ! modelVar2 = 0; ! modelVar3 = *(si+3); ! modelVar4 = *(si+4); ! ! ax = var_16; ! if(var_16 < 0) { ! var_16 = - var_16; ! modelVar1 = 1; } ! if(var_16 < 0x180) { modelVar2 = 1; } ! si+=5; ! modelVar5 = (*(si++)) + 1; ! modelVar6 = *(si++); ! modelVar7 = *(si++); di[0] = 0; --- 529,553 ---- polyOutputBuffer = destBuffer; ! flipLeftRight = 0; ! modelVar2 = 0; ! modelVar3 = *(dataPointer + 3); ! modelVar4 = *(dataPointer + 4); ! if(scale < 0) { ! scale = -scale; ! flipLeftRight = 1; } ! if(scale < 0x180) // 384 { modelVar2 = 1; } ! dataPointer += 5; ! modelVar5 = (*(dataPointer++)) + 1; ! modelVar6 = *(dataPointer++); ! modelVar7 = *(dataPointer++); di[0] = 0; *************** *** 566,570 **** do { ! ax = *(si++); ax -= modelVar6; --- 560,564 ---- do { ! ax = *(dataPointer++); ax -= modelVar6; *************** *** 581,585 **** di[0] = ax; di++; ! ax = *(si++); ax -= modelVar7; --- 575,579 ---- di[0] = ax; di++; ! ax = *(dataPointer++); ax -= modelVar7; *************** *** 598,604 **** di++; ! }while(--cx); ! ax = var_16; if(modelVar2) --- 592,598 ---- di++; ! } while(--cx); ! ax = scale; if(modelVar2) *************** *** 615,626 **** ax >>= 1; } ! if(modelVar1) { ax = -ax; } ! ax = ((mulFixed(ax, modelVar8) / 2) + 0x8000) >> 16; ! ! var_12 -= ax; ax = modelVar4 - modelVar7; --- 609,618 ---- ax >>= 1; } ! if(flipLeftRight) { ax = -ax; } ! X -= (mulFixed(ax, modelVar8) + 0x8000) >> 16; ax = modelVar4 - modelVar7; *************** *** 631,643 **** } ! ax = ((mulFixed(ax, modelVar8) / 2) + 0x8000) >> 16; ! ! var_14 -= ax; si2 = polyBuffer; di = polyBuffer2; ! di[0] = si2[0] + var_12; ! di[1] = si2[1] + var_14; di += 2; --- 623,633 ---- } ! Y -= (mulFixed(ax, modelVar8)+ 0x8000) >> 16; si2 = polyBuffer; di = polyBuffer2; ! di[0] = si2[0] + X; ! di[1] = si2[1] + Y; di += 2; *************** *** 652,656 **** ax = si2[0]; ! if(modelVar1 == 0) { ax = -ax; --- 642,646 ---- ax = si2[0]; ! if(flipLeftRight == 0) { ax = -ax; *************** *** 658,674 **** ////////////////// ! { ! int x; ! int y; ! x = ((mulFixed(ax, modelVar8) / 2)); ! modelVar9 += x; ! di[0] = ((modelVar9+0x8000) >> 16) + var_12; ax = si2[1]; ! y = ((mulFixed(ax, modelVar8) / 2)); ! modelVar10 += y; ! di[1] = ((modelVar10 + 0x8000) >> 16) + var_14; } ///////////////// --- 648,672 ---- ////////////////// ! /* { ! int x1; ! int y1; ! x1 = mulFixed(ax, modelVar8); ! modelVar9 += x1; ! di[0] = ((modelVar9 + 0x8000) >> 16) + X; ax = si2[1]; ! y1 = mulFixed(ax, modelVar8); ! modelVar10 += y1; ! di[1] = ((modelVar10 + 0x8000) >> 16) + Y; ! } ! */ ! { ! modelVar9 += mulFixed(ax, modelVar8); ! di[0] = ((modelVar9 + 0x8000) >> 16) + X; ! ! modelVar10 += mulFixed(si2[1], modelVar8); ! di[1] = ((modelVar10 + 0x8000) >> 16) + Y; } ///////////////// *************** *** 681,685 **** do { ! ax = *(si++); cx = ax; --- 679,683 ---- do { ! ax = *(dataPointer++); cx = ax; *************** *** 688,704 **** u16 tempU16; ! modelVar11 = *(si); ! si += 2; ! tempU16 = *(u16*)(si); ! si += 2; flipShort(&tempU16); ! if(tempU16 > var_16) { ! si += cx; ! if(*si == 0xFF) { return; --- 686,702 ---- u16 tempU16; ! modelVar11 = *dataPointer; ! dataPointer += 2; ! tempU16 = *(u16*)(dataPointer); ! dataPointer += 2; flipShort(&tempU16); ! if(tempU16 > scale) { ! dataPointer += cx; ! if(*dataPointer == 0xFF) { return; *************** *** 707,717 **** else { ! if(modelVar1) { ! si = drawPolyMode1(si, cx); } else { ! si = drawPolyMode2(si, cx); } --- 705,715 ---- else { ! if(flipLeftRight) { ! dataPointer = drawPolyMode1(dataPointer, cx); } else { ! dataPointer = drawPolyMode2(dataPointer, cx); } *************** *** 728,732 **** } ! if(*si == 0xFF) { return; --- 726,730 ---- } ! if(*dataPointer == 0xFF) { return; *************** *** 736,768 **** else { ! cx += 4; ! si += cx; ! if(*si == 0xFF) { return; } } ! }while(1); } ! // draw poly sprite ! void mainDrawSub1(int fileIndex, objectStruct* pObject, int X, int scale, int Y, char* destBuffer, char* dataPtr) { ! int var_12; ! int var_14; ! int var_16; ! char* var_1A; ! char* ptr2; ! int var_8; ! int sizeTable[4]; ! mainDrawSub1Sub1(fileIndex, X, Y, &var_16, &var_14, &var_12, &var_1A, scale, dataPtr); ! mainDrawSub1Sub2(var_12, var_14, var_16, sizeTable, var_1A); ! spriteX1 = sizeTable[1] + 18; ! spriteY2 = sizeTable[2] - 2; ! spriteY1 = sizeTable[3] + 2; ! spriteX2 = sizeTable[0] - 2; if(spriteX2 >= 320) --- 734,770 ---- else { ! cx += 4; ! dataPointer += cx; ! ! if(*dataPointer == 0xFF) { return; } } ! } while(1); } ! // draw poly sprite (OLD: mainDrawSub1) ! void mainDrawPolygons(int fileIndex, objectStruct* pObject, int X, int scale, int Y, char* destBuffer, char* dataPtr) { ! int newX; ! int newY; ! int newScale; ! char* newDataPtr; ! char* ptr2; // unused ! int var_8; // unused ! int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top ! // this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1) ! getPolyData(fileIndex, X, Y, &newScale, &newY, &newX, &newDataPtr, scale, dataPtr); ! ! // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) ! getPolySize(newX, newY, newScale, sizeTable, newDataPtr); ! spriteX2 = sizeTable[0] - 2; // left border ! spriteX1 = sizeTable[1] + 18; // right border ! spriteY2 = sizeTable[2] - 2; // bottom border ! spriteY1 = sizeTable[3] + 2; // top border if(spriteX2 >= 320) *************** *** 808,819 **** if(pCurrentObject->type == 2) { ! // ASSERT(0); } pCurrentObject = pCurrentObject->next; ! }while(pCurrentObject); } ! mainDrawSub1Sub5(var_12, var_14, var_16, ptr2, destBuffer, var_1A); } --- 810,821 ---- if(pCurrentObject->type == 2) { ! // ASSERT(0); } pCurrentObject = pCurrentObject->next; ! } while(pCurrentObject); } ! mainDrawSub1Sub5(newX, newY, newScale, ptr2, destBuffer, newDataPtr); } *************** *** 1161,1165 **** if(filesDatabase[fileIdx].subData.resourceType == 8) { ! mainDrawSub1(fileIdx, currentObjPtr, objX2, params.scale, objY2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); // poly } else if(filesDatabase[fileIdx].subData.resourceType == 6) --- 1163,1167 ---- if(filesDatabase[fileIdx].subData.resourceType == 8) { ! mainDrawPolygons(fileIdx, currentObjPtr, objX2, params.scale, objY2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); // poly } else if(filesDatabase[fileIdx].subData.resourceType == 6) |
From: Richard <tri...@us...> - 2005-10-30 23:39:05
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19362/src Modified Files: font.c mainDraw.c menu.c object.h Log Message: renamed gfxEntryStruct->field_A into gfxEntryStruct->height renamed param1 to scale in mainDraw.c reformated mainDraw.c for better readibility Index: object.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/object.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** object.h 20 Oct 2005 15:02:53 -0000 1.4 --- object.h 30 Oct 2005 23:38:57 -0000 1.5 *************** *** 7,11 **** int imageSize; int fontIndex; ! int field_A; int field_C; }; --- 7,11 ---- int imageSize; int fontIndex; ! int height; int field_C; }; Index: font.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/font.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** font.c 20 Oct 2005 12:09:33 -0000 1.11 --- font.c 30 Oct 2005 23:38:57 -0000 1.12 *************** *** 587,596 **** resetRaster(currentStringRenderBuffer,stringRenderBufferSize); ! generatedGfxEntry = (gfxEntryStruct*)malloc(sizeof(gfxEntryStruct)); ! generatedGfxEntry->imagePtr = currentStringRenderBuffer; generatedGfxEntry->imageSize = stringRenderBufferSize/2; generatedGfxEntry->fontIndex = fontFileIndex; ! generatedGfxEntry->field_A = stringHeight; ! generatedGfxEntry->field_C = var_1C; var_8 = 0; --- 587,596 ---- resetRaster(currentStringRenderBuffer,stringRenderBufferSize); ! generatedGfxEntry = (gfxEntryStruct*) malloc(sizeof(gfxEntryStruct)); ! generatedGfxEntry->imagePtr = currentStringRenderBuffer; generatedGfxEntry->imageSize = stringRenderBufferSize/2; generatedGfxEntry->fontIndex = fontFileIndex; ! generatedGfxEntry->height = stringHeight; ! generatedGfxEntry->field_C = var_1C; var_8 = 0; Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** mainDraw.c 29 Oct 2005 17:21:03 -0000 1.32 --- mainDraw.c 30 Oct 2005 23:38:57 -0000 1.33 *************** *** 6,15 **** struct drawVar1Struct { ! struct drawVar1Struct* next; ! short int field_2; ! short int field_4; ! short int field_6; ! short int field_8; ! objectStruct* field_A; }; [...2011 lines suppressed...] ! var20 = 1; } ! currentObjPtr = currentObjPtr->next; ! } //----------------------------------------------------------------------------------------------------------------// ! #ifdef _DEBUG ! //drawCtp(); #endif if(currentActiveMenu != -1) { ! if(menuTable[currentActiveMenu]) ! { ! drawMenu(menuTable[currentActiveMenu]); ! return; ! } } Index: menu.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/menu.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** menu.c 22 Oct 2005 15:40:41 -0000 1.2 --- menu.c 30 Oct 2005 23:38:57 -0000 1.3 *************** *** 113,118 **** if(pMenu->gfx) { ! int var_4 = pMenu->gfx->field_A; // rustine ! int var_2 = 0; menuElementStruct* pCurrentEntry = pMenu->ptrNextElement; --- 113,118 ---- if(pMenu->gfx) { ! int height = pMenu->gfx->height; // rustine ! int var_2 = 0; menuElementStruct* pCurrentEntry = pMenu->ptrNextElement; *************** *** 125,129 **** if((mouseX > pCurrentEntry->x) && ((pCurrentEntry->x + 160) >= mouseX)) { ! if((mouseY > pCurrentEntry->y) && ((pCurrentEntry->y + var_4) >= mouseY)) { var_2 = 1; --- 125,129 ---- if((mouseX > pCurrentEntry->x) && ((pCurrentEntry->x + 160) >= mouseX)) { ! if((mouseY > pCurrentEntry->y) && ((pCurrentEntry->y + height) >= mouseY)) { var_2 = 1; |
From: Richard <tri...@us...> - 2005-10-29 18:23:23
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12763/src Modified Files: backgroundIncrust.c cruise.c dataLoader.c loadSave.c vars.h Log Message: renamed param1/param2 to height and witdh in DataLoader added check in DataLoader if the maximum number of sprites is reached (check with disassembly) renamed subdata.var4 to subdata.index (symbolizes the index of this sprite in the SET-file) minor readability improvments and cleanups Index: dataLoader.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/dataLoader.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dataLoader.c 20 Oct 2005 15:02:53 -0000 1.7 --- dataLoader.c 29 Oct 2005 18:23:14 -0000 1.8 *************** *** 143,148 **** } ! // height width ! int updateResFileEntry(int param1, int param2, int entryNumber, int resType) { int div = 0; --- 143,147 ---- } ! int updateResFileEntry(int height, int width, int entryNumber, int resType) { int div = 0; *************** *** 153,189 **** filesDatabase[entryNumber].subData.field_1C = 0; ! size = param1*param2; // for sprites: width * height if(resType == 4) { ! div = size/4; ! } else if (resType == 5) { ! param2 = (param2 * 8) / 5; } ! filesDatabase[entryNumber].subData.ptr = (u8*)mallocAndZero(size+div); if(!filesDatabase[entryNumber].subData.ptr) return(-2); ! filesDatabase[entryNumber].widthInColumn = param2; ! filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! ! filesDatabase[entryNumber].width = param2 / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = param1; ! ! filesDatabase[entryNumber].subData.var4 = -1; ! return(entryNumber); } ! // width height ! int createResFileEntry(int param1, int param2, int resType) { int i; int entryNumber; ! int div; int size; --- 152,187 ---- filesDatabase[entryNumber].subData.field_1C = 0; ! size = height * width; // for sprites: width * height if(resType == 4) { ! div = size / 4; ! } ! else if (resType == 5) { ! width = (width * 8) / 5; } ! filesDatabase[entryNumber].subData.ptr = (u8*)mallocAndZero(size + div); if(!filesDatabase[entryNumber].subData.ptr) return(-2); ! filesDatabase[entryNumber].widthInColumn = width; ! filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! filesDatabase[entryNumber].width = width / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = height; ! filesDatabase[entryNumber].subData.index = -1; ! return entryNumber; } ! ! int createResFileEntry(int width, int height, int resType) { int i; int entryNumber; ! int div = 0; int size; *************** *** 191,195 **** exit(1); ! for(i=0;i<257;i++) { if(!filesDatabase[i].subData.ptr) --- 189,193 ---- exit(1); ! for(i = 0; i < 257; i++) { if(!filesDatabase[i].subData.ptr) *************** *** 197,234 **** } ! if(i>=257) return(-19); entryNumber = i; - div = 0; - filesDatabase[entryNumber].subData.field_1C = 0; ! size = param1*param2; // for sprites: width * height if(resType == 4) { ! div = size/4; ! } else if (resType == 5) { ! param1 = (param1 * 8) / 5; } ! filesDatabase[entryNumber].subData.ptr = (u8*)mallocAndZero(size+div); if(filesDatabase[entryNumber].subData.ptr) return(-2); ! filesDatabase[entryNumber].widthInColumn = param1; ! filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! ! filesDatabase[entryNumber].width = param1 / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = param2; ! ! filesDatabase[entryNumber].subData.var4 = -1; ! return(entryNumber); } --- 195,233 ---- } ! if(i >= 257) ! { return(-19); + } entryNumber = i; filesDatabase[entryNumber].subData.field_1C = 0; ! size = width * height; // for sprites: width * height if(resType == 4) { ! div = size / 4; ! } ! else if (resType == 5) { ! width = (width * 8) / 5; } ! filesDatabase[entryNumber].subData.ptr = (u8*)mallocAndZero(size + div); if(filesDatabase[entryNumber].subData.ptr) + { return(-2); + } ! filesDatabase[entryNumber].widthInColumn = width; ! filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr + size; ! filesDatabase[entryNumber].width = width / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = height; ! filesDatabase[entryNumber].subData.index = -1; ! return entryNumber; } *************** *** 263,269 **** int getNumMaxEntiresInSet(u8* ptr) { ! u16 numEntries; ! ! numEntries = *(u16*)(ptr+4); flipShort(&numEntries); --- 262,266 ---- int getNumMaxEntiresInSet(u8* ptr) { ! u16 numEntries = *(u16*)(ptr + 4); flipShort(&numEntries); *************** *** 271,275 **** } ! int loadFileMode2(u8* name, int startIdx, int param, int numIdx) { u8* ptr = NULL; --- 268,272 ---- } ! int loadFileMode2(u8* name, int startIdx, int currentEntryIdx, int numIdx) { u8* ptr = NULL; *************** *** 278,282 **** fileType = getFileType(name); ! loadFileSub1(&ptr,name,NULL); switch(fileType) --- 275,279 ---- fileType = getFileType(name); ! loadFileSub1(&ptr, name, NULL); switch(fileType) *************** *** 285,295 **** { int i; ! int numMaxEntriesInSet; ! numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); ! ! for(i=0;i<numIdx;i++) { ! loadSetEntry(name, ptr, param+i, startIdx+i); } --- 282,294 ---- { int i; ! int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); ! for(i = 0; i < numIdx; i++) { ! if ((currentEntryIdx + i) > numMaxEntriesInSet) ! { ! return 0; // exit if limit is reached ! } ! loadSetEntry(name, ptr, currentEntryIdx + i, startIdx + i); } *************** *** 321,327 **** int numMaxEntriesInSet; ! numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); ! for(i=0;i<numMaxEntriesInSet;i++) { loadSetEntry(name, ptr, i, startIdx+i); --- 320,326 ---- int numMaxEntriesInSet; ! numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); // get maximum number of sprites/animations in SET file ! for(i = 0; i < numMaxEntriesInSet; i++) { loadSetEntry(name, ptr, i, startIdx+i); *************** *** 342,350 **** void loadFNTSub(u8* ptr, int destIdx) { ! u8* ptr2 = ptr; char* destPtr; ! int fileIndex; ! int fontSize; ! ptr2+=4; memcpy(&loadFileVar1, ptr2, 4); --- 341,350 ---- void loadFNTSub(u8* ptr, int destIdx) { ! u8* ptr2 = ptr; char* destPtr; ! int fileIndex; ! int fontSize; ! ! ptr2 += 4; memcpy(&loadFileVar1, ptr2, 4); *************** *** 353,361 **** if(destIdx == -1) { ! fileIndex = createResFileEntry(loadFileVar1,1,1); } else { ! fileIndex = updateResFileEntry(loadFileVar1,1,destIdx,1); } --- 353,361 ---- if(destIdx == -1) { ! fileIndex = createResFileEntry(loadFileVar1, 1 ,1); } else { ! fileIndex = updateResFileEntry(loadFileVar1, 1, destIdx, 1); } *************** *** 365,369 **** memcpy(&fontSize,ptr2,4); ! flipLong(&fontSize); if(destPtr!=NULL) --- 365,369 ---- memcpy(&fontSize,ptr2,4); ! flipLong(&fontSize); if(destPtr!=NULL) *************** *** 372,390 **** u8* currentPtr; ! destPtr = filesDatabase[fileIndex].subData.ptr; ! flipLong((s32*)destPtr); ! flipLong((s32*)(destPtr+4)); ! flipGen(destPtr+8,6); currentPtr = destPtr + 14; ! for(i=0;i<*(s16*)(destPtr+8);i++) { ! flipLong((s32*)currentPtr); ! currentPtr+=4; ! flipGen(currentPtr,8); ! currentPtr+=8; } } --- 372,390 ---- u8* currentPtr; ! destPtr = filesDatabase[fileIndex].subData.ptr; ! flipLong((s32*) destPtr); ! flipLong((s32*) (destPtr + 4)); ! flipGen(destPtr + 8, 6); currentPtr = destPtr + 14; ! for(i = 0; i < *(s16*) (destPtr + 8); i++) { ! flipLong((s32*) currentPtr); ! currentPtr += 4; ! flipGen(currentPtr, 8); ! currentPtr += 8; } } *************** *** 424,429 **** memcpy(&localBuffer, ptr4, sizeof(setHeaderEntry)); ! flipLong((s32*)&localBuffer.field_0); ! flipGen(&localBuffer.width,12); if ((sec == 1) || (localBuffer.type == 5)) --- 424,429 ---- memcpy(&localBuffer, ptr4, sizeof(setHeaderEntry)); ! flipLong((s32*) &localBuffer.field_0); ! flipGen(&localBuffer.width, 12); if ((sec == 1) || (localBuffer.type == 5)) *************** *** 434,438 **** resourceSize = localBuffer.width * localBuffer.height; ! if(currentDestEntry==-1) { fileIndex = createResFileEntry(localBuffer.width,localBuffer.height,localBuffer.type); --- 434,438 ---- resourceSize = localBuffer.width * localBuffer.height; ! if(currentDestEntry == -1) { fileIndex = createResFileEntry(localBuffer.width,localBuffer.height,localBuffer.type); *************** *** 440,447 **** else { ! fileIndex = updateResFileEntry(localBuffer.height,localBuffer.width,currentDestEntry,localBuffer.type); } ! if(fileIndex<0) { return; // TODO: buffer is not freed --- 440,447 ---- else { ! fileIndex = updateResFileEntry(localBuffer.height, localBuffer.width, currentDestEntry, localBuffer.type); } ! if(fileIndex < 0) { return; // TODO: buffer is not freed *************** *** 496,500 **** } ! filesDatabase[fileIndex].subData.var4 = currentDestEntry; filesDatabase[fileIndex].subData.transparency = localBuffer.transparency; /*% 0x10*/; --- 496,500 ---- } ! filesDatabase[fileIndex].subData.index = currentDestEntry; filesDatabase[fileIndex].subData.transparency = localBuffer.transparency; /*% 0x10*/; Index: cruise.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** cruise.c 22 Oct 2005 15:40:41 -0000 1.62 --- cruise.c 29 Oct 2005 18:23:14 -0000 1.63 *************** *** 183,187 **** filesDatabase[i].subData.ptr2 = NULL; ! filesDatabase[i].subData.var4 = -1; filesDatabase[i].subData.resourceType = 0; } --- 183,187 ---- filesDatabase[i].subData.ptr2 = NULL; ! filesDatabase[i].subData.index = -1; filesDatabase[i].subData.resourceType = 0; } *************** *** 458,462 **** filesDatabase[entryNumber].resType = 0; filesDatabase[entryNumber].height = 0; ! filesDatabase[entryNumber].subData.var4 = -1; filesDatabase[entryNumber].subData.resourceType = 0; filesDatabase[entryNumber].subData.field_1C = 0; --- 458,462 ---- filesDatabase[entryNumber].resType = 0; filesDatabase[entryNumber].height = 0; ! filesDatabase[entryNumber].subData.index = -1; filesDatabase[entryNumber].subData.resourceType = 0; filesDatabase[entryNumber].subData.field_1C = 0; Index: loadSave.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/loadSave.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** loadSave.c 20 Oct 2005 12:09:33 -0000 1.9 --- loadSave.c 29 Oct 2005 18:23:14 -0000 1.10 *************** *** 378,382 **** else { ! loadFileMode2(filesDatabase[j].subData.name,filesDatabase[j].subData.var4,j,i-j); j = i-1; } --- 378,382 ---- else { ! loadFileMode2(filesDatabase[j].subData.name,filesDatabase[j].subData.index, j, i-j); j = i-1; } Index: backgroundIncrust.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/backgroundIncrust.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** backgroundIncrust.c 20 Oct 2005 15:02:53 -0000 1.11 --- backgroundIncrust.c 29 Oct 2005 18:23:14 -0000 1.12 *************** *** 86,90 **** newElement->scale = params.scale; newElement->field_E = params.fileIdx; ! newElement->var34 = filesDatabase[params.fileIdx].subData.var4; newElement->ptr = NULL; strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name); --- 86,90 ---- 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); Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** vars.h 20 Oct 2005 15:02:53 -0000 1.24 --- vars.h 29 Oct 2005 18:23:14 -0000 1.25 *************** *** 124,133 **** { u8* ptr; ! s16 var4; ! u8 name[14]; s16 transparency; // sprite transparency u8* ptr2; ! u8 resourceType; // sprite and image type 2,4,8 , fnt = 7, spl = 6 ! u8 field_1B; s16 field_1C; }; --- 124,133 ---- { u8* ptr; ! s16 index; // sprite index ! u8 name[14]; s16 transparency; // sprite transparency u8* ptr2; ! u8 resourceType; // sprite and image type 2,4,8 , fnt = 7, spl = 6 ! u8 field_1B; s16 field_1C; }; |
From: Richard <tri...@us...> - 2005-10-29 17:21:11
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30337/src Modified Files: mainDraw.c Log Message: some readability improvments; renamed var6 to spriteHeight Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** mainDraw.c 20 Oct 2005 22:31:03 -0000 1.31 --- mainDraw.c 29 Oct 2005 17:21:03 -0000 1.32 *************** *** 466,470 **** index = *(si++); ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[cx*2] = polyBuffer2[index*2]; polySize1 = polySize2 = pBufferDest[1] = pBufferDest[cx*2+1] = polyBuffer2[(index*2)+1]; --- 466,470 ---- index = *(si++); ! polySize1 = polySize2 = pBufferDest[0] = pBufferDest[cx*2] = polyBuffer2[index*2]; polySize1 = polySize2 = pBufferDest[1] = pBufferDest[cx*2+1] = polyBuffer2[(index*2)+1]; *************** *** 731,740 **** void mainDrawSub1(int fileIndex, objectStruct* pObject, int X, int param1, int Y, char* destBuffer, char* dataPtr) { ! int var_12; ! int var_14; ! int var_16; char* var_1A; char* ptr2; ! int var_8; int sizeTable[4]; --- 731,740 ---- void mainDrawSub1(int fileIndex, objectStruct* pObject, int X, int param1, int Y, char* destBuffer, char* dataPtr) { ! int var_12; ! int var_14; ! int var_16; char* var_1A; char* ptr2; ! int var_8; int sizeTable[4]; *************** *** 832,836 **** { output = initialOuput + 320*i; ! for(j=0;j<width;j++) { u8 color = *(ptr++); --- 832,836 ---- { output = initialOuput + 320*i; ! for(j = 0; j < width; j++) { u8 color = *(ptr++); *************** *** 859,876 **** void mainDrawSub4(int objX1, int var_6, objectStruct* currentObjPtr, char* data1, int objY2, int objX2, char* output, char* data2) { - int x = 0; int y = 0; ! for(y=0;y<var_6;y++) { ! for(x=0;x<objX1*8;x++) { u8 color = (data1[0]); data1++; ! if((x+objX2)>=0&&(x+objX2)<320 && (y+objY2)>=0&&(y+objY2)<200) ! if(color!=currentTransparent) ! output[320*(y+objY2)+x+objX2] = color; } } --- 859,879 ---- void mainDrawSub4(int objX1, int var_6, objectStruct* currentObjPtr, char* data1, int objY2, int objX2, char* output, char* data2) { int x = 0; int y = 0; ! for(y = 0; y < var_6; y++) { ! for(x = 0; x < objX1*8; x++) { u8 color = (data1[0]); data1++; ! if((x + objX2) >= 0 && (x + objX2) < 320 && (y + objY2) >= 0 && (y + objY2) < 200) ! { ! if(color != currentTransparent) ! { ! output[320 * (y + objY2) + x + objX2] = color; ! } ! } } } *************** *** 978,982 **** var_6 = (80 * (bx-1)) + x; ! if(var_6<=320) { mainSprite(var_6, y - height, pMenu->gfx, gfxModuleData.pPage10, video4, 320); --- 981,985 ---- var_6 = (80 * (bx-1)) + x; ! if(var_6 <= 320) { mainSprite(var_6, y - height, pMenu->gfx, gfxModuleData.pPage10, video4, 320); *************** *** 1000,1004 **** si->y = currentY; si->varA = 320; ! if(si->varC) { color = video3; --- 1003,1008 ---- si->y = currentY; si->varA = 320; ! ! if(si->varC) { color = video3; *************** *** 1032,1036 **** si = si->next; ! }while(si); } } --- 1036,1040 ---- si = si->next; ! } while(si); } } *************** *** 1068,1080 **** u8* bgPtr; objectStruct* currentObjPtr; ! s16 currentObjIdx; ! s16 objX1=0; ! s16 objY1=0; ! s16 objZ1=0; ! ! s16 objX2; ! s16 objY2; ! ! s16 var_6; --- 1072,1082 ---- u8* bgPtr; objectStruct* currentObjPtr; ! s16 currentObjIdx; ! s16 objX1 = 0; ! s16 objY1 = 0; ! s16 objZ1 = 0; ! s16 objX2; ! s16 objY2; ! s16 spriteHeight; *************** *** 1113,1177 **** } else ! { ! objectParamsQuery params; getMultipleObjectParam(currentObjPtr->followObjectOverlayIdx, currentObjPtr->followObjectIdx, ¶ms); ! objX1 = params.X; objY1 = params.Y; ! objZ1 = params.fileIdx; } getMultipleObjectParam(currentObjPtr->overlay, currentObjIdx, ¶ms); ! objX2 = objX1 + params.X; objY2 = objY1 + params.Y; ! fileIdx = params.fileIdx; ! if(fileIdx>=0) { fileIdx += objZ1; } ! if((params.var5 >= 0) && (fileIdx >= 0) && filesDatabase[fileIdx].subData.ptr) { if(filesDatabase[fileIdx].subData.resourceType == 8) { ! mainDrawSub1(fileIdx, currentObjPtr, objX2, params.scale, objY2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); // poly } else if(filesDatabase[fileIdx].subData.resourceType == 6) ! { ! } ! else if(filesDatabase[fileIdx].resType == 1) ! { ! } ! else if(filesDatabase[fileIdx].subData.resourceType == 4) ! { ! objX1 = filesDatabase[fileIdx].width; // width ! var_6 = filesDatabase[fileIdx].height; // height ! if(filesDatabase[fileIdx].subData.ptr) ! { ! currentTransparent = filesDatabase[fileIdx].subData.transparency; ! mainDrawSub4(objX1, var_6, currentObjPtr, filesDatabase[fileIdx].subData.ptr, objY2, objX2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); ! } ! } ! } if((currentObjPtr->field_26 !=0) && (param == 0)) { ! if(currentObjPtr->currentAnimDelay<=0) ! { ! int newVal; ! objX1 = 1; ! newVal = getValueFromObjectQuerry(¶ms,currentObjPtr->field_28) + currentObjPtr->field_26; ! if(currentObjPtr->field_26>0) { ! if(currentObjPtr->field_22<newVal) { ! if(currentObjPtr->field_30>=0) { s16 data2; --- 1115,1180 ---- } else ! { ! // Declaring this twice ? ! // objectParamsQuery params; getMultipleObjectParam(currentObjPtr->followObjectOverlayIdx, currentObjPtr->followObjectIdx, ¶ms); ! objX1 = params.X; objY1 = params.Y; ! objZ1 = params.fileIdx; } getMultipleObjectParam(currentObjPtr->overlay, currentObjIdx, ¶ms); ! objX2 = objX1 + params.X; objY2 = objY1 + params.Y; ! fileIdx = params.fileIdx; ! if(fileIdx >= 0) { fileIdx += objZ1; } ! if((params.var5 >= 0) && (fileIdx >= 0) && filesDatabase[fileIdx].subData.ptr) { if(filesDatabase[fileIdx].subData.resourceType == 8) { ! mainDrawSub1(fileIdx, currentObjPtr, objX2, params.scale, objY2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); // poly } else if(filesDatabase[fileIdx].subData.resourceType == 6) ! { ! } ! else if(filesDatabase[fileIdx].resType == 1) ! { ! } ! else if(filesDatabase[fileIdx].subData.resourceType == 4) ! { ! objX1 = filesDatabase[fileIdx].width; // width ! spriteHeight = filesDatabase[fileIdx].height; // height ! if(filesDatabase[fileIdx].subData.ptr) ! { ! currentTransparent = filesDatabase[fileIdx].subData.transparency; ! mainDrawSub4(objX1, spriteHeight, currentObjPtr, filesDatabase[fileIdx].subData.ptr, objY2, objX2, gfxModuleData.pPage10, filesDatabase[fileIdx].subData.ptr); ! } ! } ! } if((currentObjPtr->field_26 !=0) && (param == 0)) { ! if(currentObjPtr->currentAnimDelay<=0) ! { ! int newVal; ! objX1 = 1; ! newVal = getValueFromObjectQuerry(¶ms,currentObjPtr->field_28) + currentObjPtr->field_26; ! if(currentObjPtr->field_26 > 0) { ! if(currentObjPtr->field_22 < newVal) { ! if(currentObjPtr->field_30 >= 0) { s16 data2; |
From: Gregory M. <cy...@us...> - 2005-10-23 17:16:01
|
Update of /cvsroot/cine/cinE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3129/src Modified Files: sfxPlayer.c sfxPlayer.h soundDriver.c soundDriver.h various.c Log Message: Fixed song fading Index: soundDriver.h =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundDriver.h 22 Oct 2005 22:15:35 -0000 1.2 --- soundDriver.h 23 Oct 2005 17:15:47 -0000 1.3 *************** *** 21,28 **** typedef void (*snd_driverSetChannelFrequencyPF)(int channelNum, int frequency); typedef void (*snd_driverStopChannelPF)(int channelNum); ! typedef void (*snd_driverPlaySoundPF)(const u8 *data, int channelNum, int volume, int unk1, int unk2); extern u8 snd_useAdlib, snd_useSpeaker, snd_useRoland; ! extern u16 snd_fadeOutCounter; extern snd_driverSetupChannelPF snd_driverSetupChannel; --- 21,29 ---- typedef void (*snd_driverSetChannelFrequencyPF)(int channelNum, int frequency); typedef void (*snd_driverStopChannelPF)(int channelNum); ! typedef void (*snd_driverPlaySoundPF)(u8 *data, int channelNum, int volume, int unk1, int unk2); extern u8 snd_useAdlib, snd_useSpeaker, snd_useRoland; ! extern u16 snd_fadeOutCounter, snd_songTicksCounter; ! extern u8 *snd_adlibInstrumentsTable[4]; extern snd_driverSetupChannelPF snd_driverSetupChannel; *************** *** 38,42 **** extern void snd_adlibDriverStopSong(); extern void snd_adlibInterrupt(void *param, u8 *buf, int len); ! extern void snd_adlibDriverPlaySound(const u8 *data, int channelNum, int volume, int unk1, int unk2); extern void snd_resetChannel(int channelNum); --- 39,43 ---- extern void snd_adlibDriverStopSong(); extern void snd_adlibInterrupt(void *param, u8 *buf, int len); ! extern void snd_adlibDriverPlaySound(u8 *data, int channelNum, int volume, int unk1, int unk2); extern void snd_resetChannel(int channelNum); Index: soundDriver.c =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soundDriver.c 22 Oct 2005 22:15:35 -0000 1.3 --- soundDriver.c 23 Oct 2005 17:15:47 -0000 1.4 *************** *** 8,11 **** --- 8,13 ---- u8 snd_useRoland = 0; u16 snd_fadeOutCounter = 0; + u16 snd_songTicksCounter = 0; + u8 *snd_adlibInstrumentsTable[4]; snd_driverSetupChannelPF snd_driverSetupChannel; snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; *************** *** 107,110 **** --- 109,116 ---- SDL_PauseAudio(0); } + for (i = 0; i < 4; ++i) + { + snd_adlibInstrumentsTable[i] = snd_emptyInstrument; + } } *************** *** 373,377 **** void snd_adlibInterrupt(void *param, u8 *buf, int len) { - static int ticksCount = 0; static int samplesLeft = 0; while (len != 0) --- 379,382 ---- *************** *** 380,390 **** if (samplesLeft == 0) { ! if (snd_songIsPlaying) { ! ++ticksCount; ! if (ticksCount > snd_eventsDelay * 2) { snd_handleEvents(); ! ticksCount = 0; } } --- 385,395 ---- if (samplesLeft == 0) { ! if (snd_songIsPlaying || (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100)) { ! ++snd_songTicksCounter; ! if (snd_songTicksCounter > snd_eventsDelay * 2) { snd_handleEvents(); ! snd_songTicksCounter = 0; } } *************** *** 403,407 **** } ! void snd_adlibDriverPlaySound(const u8 *data, int channelNum, int volume, int unk1, int unk2) { /* if (_snd_mute) return;*/ u8 var1, var2; --- 408,412 ---- } ! void snd_adlibDriverPlaySound(u8 *data, int channelNum, int volume, int unk1, int unk2) { /* if (_snd_mute) return;*/ u8 var1, var2; Index: sfxPlayer.h =================================================================== RCS file: /cvsroot/cine/cinE/src/sfxPlayer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sfxPlayer.h 15 Oct 2005 21:53:55 -0000 1.1 --- sfxPlayer.h 23 Oct 2005 17:15:47 -0000 1.2 *************** *** 24,28 **** extern sfxModuleStruct snd_sfxMod; ! extern u8 *snd_adlibInstrumentsTable[4]; extern u16 snd_eventsDelay; extern int snd_songIsPlaying; --- 24,28 ---- extern sfxModuleStruct snd_sfxMod; ! extern u8 snd_emptyInstrument[]; extern u16 snd_eventsDelay; extern int snd_songIsPlaying; Index: sfxPlayer.c =================================================================== RCS file: /cvsroot/cine/cinE/src/sfxPlayer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sfxPlayer.c 22 Oct 2005 22:15:35 -0000 1.3 --- sfxPlayer.c 23 Oct 2005 17:15:47 -0000 1.4 *************** *** 4,11 **** sfxModuleStruct snd_sfxMod; - u8 *snd_adlibInstrumentsTable[4]; u8 snd_mute = 0; u16 snd_eventsDelay; int snd_songIsPlaying = 0; static sfxStateStruct snd_sfxState; --- 4,11 ---- sfxModuleStruct snd_sfxMod; u8 snd_mute = 0; u16 snd_eventsDelay; int snd_songIsPlaying = 0; + u8 snd_emptyInstrument[] = { 0, 0 }; static sfxStateStruct snd_sfxState; *************** *** 14,18 **** static FILE *snd_baseSndFile = 0; static char snd_songFileName[0x1E]; - static u8 snd_emptyInstrument[] = { 0, 0 }; --- 14,17 ---- *************** *** 169,173 **** BasesonEntryStruct *be; ! // while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) SDL_Delay(40); if (snd_songIsPlaying) --- 168,174 ---- BasesonEntryStruct *be; ! while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) ! SDL_Delay(40); ! snd_fadeOutCounter = 0; if (snd_songIsPlaying) *************** *** 178,182 **** if (i == -1) { ! printf("Invalid song name '%s'\n", songName); return 0; } --- 179,183 ---- if (i == -1) { ! fprintf(stderr, "Invalid song name '%s'\n", songName); return 0; } *************** *** 230,237 **** p += 30; } - for (i = 0; i < 4; ++i) - { - snd_adlibInstrumentsTable[i] = snd_emptyInstrument; - } return 1; } --- 231,234 ---- *************** *** 239,243 **** void snd_fadeOutSong() { - snd_stopSong(); /* disable fading for now */ if (snd_songIsPlaying) { --- 236,239 ---- *************** *** 264,267 **** --- 260,264 ---- snd_sfxState.numOrders = snd_sfxMod.songData[0x1D6]; snd_eventsDelay = (252 - snd_sfxMod.songData[0x1D7]) * 55 / 1060; + snd_songTicksCounter = 0; snd_songIsPlaying = 1; } *************** *** 281,285 **** if (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) { ! snd_fadeOutCounter += 2; } snd_sfxState.currentPos += 16; --- 278,282 ---- if (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) { ! snd_fadeOutCounter += 4; } snd_sfxState.currentPos += 16; Index: various.c =================================================================== RCS file: /cvsroot/cine/cinE/src/various.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** various.c 15 Oct 2005 02:12:59 -0000 1.27 --- various.c 23 Oct 2005 17:15:47 -0000 1.28 *************** *** 154,157 **** --- 154,158 ---- void stopSample(void) { + snd_stopSong(); } |
From: Gregory M. <cy...@us...> - 2005-10-22 22:15:43
|
Update of /cvsroot/cine/cinE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27815/src Modified Files: script.c sfxPlayer.c soundDriver.c soundDriver.h Log Message: Added sound effects playback for adlib driver. Index: soundDriver.h =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** soundDriver.h 15 Oct 2005 21:53:55 -0000 1.1 --- soundDriver.h 22 Oct 2005 22:15:35 -0000 1.2 *************** *** 6,12 **** --- 6,25 ---- #define SDL_OUTPUT_RATE 22050 + #define ADLIB_REG_TIMER_1_DATA 2 + #define ADLIB_REG_TIMER_CONTROL_FLAGS 4 + #define ADLIB_REG_AM_VIBRATO_EG_KS 0x20 + #define ADLIB_REG_KEY_SCALING_OPERATOR_OUTPUT 0x40 + #define ADLIB_REG_ATTACK_RATE_DECAY_RATE 0x60 + #define ADLIB_REG_SUSTAIN_LEVEL_RELEASE_RATE_0 0x80 + #define ADLIB_REG_FREQUENCY_0 0xA0 + #define ADLIB_REG_KEY_ON_OCTAVE_FREQUENCY_0 0xB0 + #define ADLIB_REG_AM_VIBRATO_RHYTHM 0xBD + #define ADLIB_REG_FEEDBACK_STRENGTH_CONNECTION_TYPE 0xC0 + #define ADLIB_REG_WAVE_SELECT 0xE0 + typedef void (*snd_driverSetupChannelPF)(int channelNum, const u8 *data, int instrumentNum); typedef void (*snd_driverSetChannelFrequencyPF)(int channelNum, int frequency); typedef void (*snd_driverStopChannelPF)(int channelNum); + typedef void (*snd_driverPlaySoundPF)(const u8 *data, int channelNum, int volume, int unk1, int unk2); extern u8 snd_useAdlib, snd_useSpeaker, snd_useRoland; *************** *** 16,19 **** --- 29,33 ---- extern snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; extern snd_driverStopChannelPF snd_driverStopChannel; + extern snd_driverPlaySoundPF snd_driverPlaySound; extern void snd_adlibDriverInit(); *************** *** 24,27 **** --- 38,43 ---- extern void snd_adlibDriverStopSong(); extern void snd_adlibInterrupt(void *param, u8 *buf, int len); + extern void snd_adlibDriverPlaySound(const u8 *data, int channelNum, int volume, int unk1, int unk2); + extern void snd_resetChannel(int channelNum); #endif Index: script.c =================================================================== RCS file: /cvsroot/cine/cinE/src/script.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** script.c 15 Oct 2005 21:53:55 -0000 1.30 --- script.c 22 Oct 2005 22:15:34 -0000 1.31 *************** *** 1968,1972 **** { DEBUG_SCRIPT(currentLine,"stopSample()"); ! //stopSample(); break; } --- 1968,1972 ---- { DEBUG_SCRIPT(currentLine,"stopSample()"); ! snd_stopSong(); break; } *************** *** 1975,1979 **** { DEBUG_SCRIPT(currentLine,"playSample()"); ! currentPosition+=9; break; } --- 1975,2020 ---- { DEBUG_SCRIPT(currentLine,"playSample()"); ! u8 anim, channel; ! s16 volume; ! u16 flag; ! ! anim = *(currentScriptPtr+currentPosition); ! currentPosition++; ! ! channel = *(currentScriptPtr+currentPosition); ! currentPosition++; ! ! /* unused */ ! currentPosition+=2; ! ! /* unused */ ! currentPosition++; ! ! volume = *(s16*)(currentScriptPtr+currentPosition); ! currentPosition+=2; ! flipU16(&volume); ! ! flag = *(u16*)(currentScriptPtr+currentPosition); ! currentPosition+=2; ! flipU16(&flag); ! ! if (volume > 63) ! volume = 63; ! if (volume < 0) ! volume = 63; ! ! if (animDataTable[anim].ptr1) ! { ! if (channel >= 10) ! channel -= 10; ! if (volume < 50) ! volume = 50; ! if (snd_songIsPlaying) ! snd_stopSong(); ! if (flag == 0xFFFF) ! (*snd_driverPlaySound)(animDataTable[anim].ptr1, channel, volume, 0xFFFF, 0xA); ! else ! snd_resetChannel(channel); ! } break; } Index: soundDriver.c =================================================================== RCS file: /cvsroot/cine/cinE/src/soundDriver.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundDriver.c 15 Oct 2005 22:17:03 -0000 1.2 --- soundDriver.c 22 Oct 2005 22:15:35 -0000 1.3 *************** *** 11,16 **** snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; snd_driverStopChannelPF snd_driverStopChannel; ! static u8 snd_adlibUnkVar = 0; static s16 snd_adlibChannelVolume[4]; --- 11,17 ---- snd_driverSetChannelFrequencyPF snd_driverSetChannelFrequency; snd_driverStopChannelPF snd_driverStopChannel; + snd_driverPlaySoundPF snd_driverPlaySound; ! static u8 snd_adlibVibrato = 0; static s16 snd_adlibChannelVolume[4]; *************** *** 59,64 **** YM3812Init(1, OPL_INTERNAL_FREQ, SDL_OUTPUT_RATE); ! snd_adlibUnkVar = 0x20; ! snd_adlibWriteData(0xBD, snd_adlibUnkVar); snd_adlibWriteData(0x08, 0x40); --- 60,65 ---- YM3812Init(1, OPL_INTERNAL_FREQ, SDL_OUTPUT_RATE); ! snd_adlibVibrato = 0x20; ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); snd_adlibWriteData(0x08, 0x40); *************** *** 89,93 **** snd_driverSetChannelFrequency = snd_adlibDriverSetChannelFrequency; snd_driverStopChannel = snd_adlibDriverStopChannel; ! /* snd_drv_func3 = snd_adlib_drv_stub3; */ memset(&as, 0, sizeof(SDL_AudioSpec)); --- 90,94 ---- snd_driverSetChannelFrequency = snd_adlibDriverSetChannelFrequency; snd_driverStopChannel = snd_adlibDriverStopChannel; ! snd_driverPlaySound = snd_adlibDriverPlaySound; memset(&as, 0, sizeof(SDL_AudioSpec)); *************** *** 113,124 **** } ! void snd_adlibDriverSetupChannelHelper(const u8 *instrument_data, int channelNum) { ! const u8 *instr = instrument_data; u8 var2 = instr[0x36] & 3; u8 var1 = instr[0x38] & 3; ! u8 varB = *instrument_data++; ! u8 var4 = *instrument_data++; u8 _al; --- 114,125 ---- } ! void snd_adlibDriverSetupChannelHelper(const u8 *instrumentData, int channelNum) { ! const u8 *instr = instrumentData; u8 var2 = instr[0x36] & 3; u8 var1 = instr[0x38] & 3; ! u8 varB = *instrumentData++; ! u8 var4 = *instrumentData++; u8 _al; *************** *** 319,324 **** freq1 = 0; } ! freq2 = freq1 * 0xC + freq2 + 0xC - 0xC; ! if (freq2 < 0) { freq2 = 0; } --- 320,325 ---- freq1 = 0; } ! freq2 = freq1 * 0xC + freq2; ! if (freq2 < 0) { freq2 = 0; } *************** *** 334,339 **** if (var2 != 0) { ! snd_adlibUnkVar |= 1 << (10 - var1); ! snd_adlibWriteData(0xBD, snd_adlibUnkVar); } } --- 335,340 ---- if (var2 != 0) { ! snd_adlibVibrato |= 1 << (10 - var1); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } *************** *** 341,361 **** void snd_adlibDriverStopChannel(int channelNum) { u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! if (instr) { ! u8 var2 = instr[0]; ! u8 var1 = instr[1]; ! if (var2 != 0 && var1 == 6) ! { ! channelNum = 6; ! } ! if (var2 == 0 || channelNum == 6) ! { ! snd_adlibWriteData(0xB0 + channelNum, 0); ! } ! if (var2 != 0) ! { ! snd_adlibUnkVar &= (1 << (10 - var1)) ^ 0xFF; ! snd_adlibWriteData(0xBD, snd_adlibUnkVar); ! } } } --- 342,359 ---- void snd_adlibDriverStopChannel(int channelNum) { u8 *instr = snd_adlibInstrumentsTable[channelNum]; ! u8 var2 = *instr++; ! u8 var1 = *instr++; ! if (var2 != 0 && var1 == 6) { ! channelNum = 6; ! } ! if (var2 == 0 || channelNum == 6) ! { ! snd_adlibWriteData(0xB0 + channelNum, 0); ! } ! if (var2 != 0) ! { ! snd_adlibVibrato &= (1 << (10 - var1)) ^ 0xFF; ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); } } *************** *** 370,374 **** snd_adlibWriteData(0xB0 + i, 0); ! snd_adlibWriteData(0xBD, 0); } --- 368,372 ---- snd_adlibWriteData(0xB0 + i, 0); ! snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, 0); } *************** *** 377,390 **** static int ticksCount = 0; static int samplesLeft = 0; ! while (snd_songIsPlaying && len != 0) { int count; if (samplesLeft == 0) { ! ++ticksCount; ! if (ticksCount > snd_eventsDelay * 2) { ! snd_handleEvents(); ! ticksCount = 0; } samplesLeft = SDL_OUTPUT_RATE / 55; --- 375,391 ---- static int ticksCount = 0; static int samplesLeft = 0; ! while (len != 0) { int count; if (samplesLeft == 0) { ! if (snd_songIsPlaying) { ! ++ticksCount; ! if (ticksCount > snd_eventsDelay * 2) ! { ! snd_handleEvents(); ! ticksCount = 0; ! } } samplesLeft = SDL_OUTPUT_RATE / 55; *************** *** 401,402 **** --- 402,454 ---- } } + + void snd_adlibDriverPlaySound(const u8 *data, int channelNum, int volume, int unk1, int unk2) { + /* if (_snd_mute) return;*/ + u8 var1, var2; + + assert(channelNum < 4); + data += 0x101; + snd_adlibInstrumentsTable[channelNum] = data; + snd_resetChannel(channelNum); + snd_adlibChannelVolume[channelNum] = 0x7F; + snd_adlibDriverSetupChannelHelper(data, channelNum); + var2 = *data++; + var1 = *data++; + if (var2 != 0 && var1 == 6) + { + channelNum = 6; + } + if (var2 == 0 || channelNum == 6) + { + s16 freq1, freq2; + + freq1 = snd_adlibFreqTable[0]; + snd_adlibWriteData(0xA0 + channelNum, freq1); + freq2 = 4 | ((freq1 & 0x300) >> 8); + if (var2 == 0) + { + freq2 |= 0x20; + } + snd_adlibWriteData(0xB0 + channelNum, freq2); + } + if (var2 != 0) + { + snd_adlibVibrato = 1 << (10 - var1); + snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, snd_adlibVibrato); + } + } + + void snd_resetChannel(int channelNum) { + (*snd_driverStopChannel)(channelNum); + if (snd_useAdlib) + { + int i; + for (i = 0; i < 18; ++i) + snd_adlibWriteData(0x40 + snd_adlibInitTable[i], 0x3F); + + for (i = 0; i < 9; ++i) + snd_adlibWriteData(0xB0 + i, 0); + + snd_adlibWriteData(ADLIB_REG_AM_VIBRATO_RHYTHM, 0); + } + } Index: sfxPlayer.c =================================================================== RCS file: /cvsroot/cine/cinE/src/sfxPlayer.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sfxPlayer.c 15 Oct 2005 22:28:31 -0000 1.2 --- sfxPlayer.c 22 Oct 2005 22:15:35 -0000 1.3 *************** *** 17,21 **** ! static u16 fread_u16BE(FILE *fp) { char data[2]; fread(data, 2, 1, fp); --- 17,22 ---- ! static u16 fread_u16BE(FILE *fp) ! { char data[2]; fread(data, 2, 1, fp); *************** *** 23,27 **** } ! static u32 fread_u32BE(FILE *fp) { char data[4]; fread(data, 4, 1, fp); --- 24,29 ---- } ! static u32 fread_u32BE(FILE *fp) ! { char data[4]; fread(data, 4, 1, fp); *************** *** 92,96 **** snd_songIsPlaying = 0; snd_fadeOutCounter = 0; ! for (i = 0; i < 4; ++i) (*snd_driverStopChannel)(i); --- 94,98 ---- snd_songIsPlaying = 0; snd_fadeOutCounter = 0; ! for (i = 0; i < 4; ++i) (*snd_driverStopChannel)(i); *************** *** 127,131 **** snd_sfxState.instruments[instrumentNum] = (u8 *)malloc(be->unpackedSize); if (snd_sfxState.instruments[instrumentNum]) ! { if (be->unpackedSize > be->size) { --- 129,133 ---- snd_sfxState.instruments[instrumentNum] = (u8 *)malloc(be->unpackedSize); if (snd_sfxState.instruments[instrumentNum]) ! { if (be->unpackedSize > be->size) { *************** *** 164,177 **** { int i; ! const char *p; BasesonEntryStruct *be; ! // while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) SDL_Delay(40); ! ! snd_stopSong(); strcpy(snd_songFileName, songName); i = snd_findBasesonEntry(songName); ! if (i == -1) { printf("Invalid song name '%s'\n", songName); return 0; --- 166,181 ---- { int i; ! const u8 *p; BasesonEntryStruct *be; ! // while (snd_fadeOutCounter != 0 && snd_fadeOutCounter < 100) SDL_Delay(40); ! ! if (snd_songIsPlaying) ! snd_stopSong(); strcpy(snd_songFileName, songName); i = snd_findBasesonEntry(songName); ! if (i == -1) ! { printf("Invalid song name '%s'\n", songName); return 0; *************** *** 226,229 **** --- 230,237 ---- p += 30; } + for (i = 0; i < 4; ++i) + { + snd_adlibInstrumentsTable[i] = snd_emptyInstrument; + } return 1; } *************** *** 231,234 **** --- 239,243 ---- void snd_fadeOutSong() { + snd_stopSong(); /* disable fading for now */ if (snd_songIsPlaying) { *************** *** 289,292 **** --- 298,302 ---- { u16 instrumentNumber = patternData[2] >> 4; + snd_adlibInstrumentsTable[channelNum] = snd_emptyInstrument; if (instrumentNumber != 0) { *************** *** 305,315 **** } } - } - if (instrumentNumber == 0) - { - snd_adlibInstrumentsTable[channelNum] = snd_emptyInstrument; - } - else - { snd_adlibInstrumentsTable[channelNum] = snd_sfxState.instruments[instrumentNumber - 1]; } --- 315,318 ---- |
From: Vincent H. <ya...@us...> - 2005-10-22 15:40:55
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4740/src Modified Files: cruise.c cruise.h menu.c Log Message: get object from mouse now partialy working Index: cruise.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** cruise.c 20 Oct 2005 22:31:03 -0000 1.61 --- cruise.c 22 Oct 2005 15:40:41 -0000 1.62 *************** *** 670,674 **** s16 var_6; ! // char objectName[80]; objectStruct* currentObject = objectHead.prev; --- 670,674 ---- s16 var_6; ! char objectName[80]; objectStruct* currentObject = objectHead.prev; *************** *** 682,688 **** 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) --- 682,688 ---- 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) *************** *** 713,716 **** --- 713,718 ---- if(currentObject->type == 3) { + assert(0); + var_2 = params.scale; var_A = params.X + var_C; *************** *** 728,731 **** --- 730,735 ---- if(currentObject->type == 4 || currentObject->type == 1 || currentObject->type == 9 ) { + int si; + int var_8; int di; *************** *** 740,745 **** } ! if(filesDatabase[di].subData.resourceType == 8) { } } --- 744,799 ---- } ! /* 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; + } + } + } + } + } } } *************** *** 751,755 **** } ! currentObject = currentObject->next; } --- 805,809 ---- } ! currentObject = currentObject->prev; } *************** *** 896,899 **** --- 950,955 ---- return pMenuElement->ptrSub; } + + pMenuElement = pMenuElement->next; } *************** *** 1356,1366 **** if(mouseX != oldMouseX && mouseY != oldMouseY) { ! /* int newCursor1; ! int newCursor2;*/ oldMouseX = mouseX; oldMouseY = mouseY; ! //getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2); } } --- 1412,1422 ---- if(mouseX != oldMouseX && mouseY != oldMouseY) { ! int newCursor1; ! int newCursor2; oldMouseX = mouseX; oldMouseY = mouseY; ! getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2); } } Index: menu.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/menu.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** menu.c 20 Oct 2005 12:09:33 -0000 1.1 --- menu.c 22 Oct 2005 15:40:41 -0000 1.2 *************** *** 246,251 **** } void freeMenu(menuStruct* pMenu) { ! printf("freeMenu: To implement..\n"); } --- 246,292 ---- } + void freeGfx(gfxEntryStruct* pGfx) + { + if(pGfx->imagePtr) + { + free(pGfx->imagePtr); + } + + free(pGfx); + } + void freeMenu(menuStruct* pMenu) { ! menuElementStruct* pElement = pMenu->ptrNextElement; ! ! while(pElement) ! { ! menuElementStruct* next; ! menuElementSubStruct* pSub = pElement->ptrSub; ! ! next = pElement->next; ! ! while(pSub) ! { ! menuElementSubStruct* next; ! ! next = pSub->pNext; ! ! free(pSub); ! ! pSub=next; ! } ! ! if(pElement->gfx) ! { ! freeGfx(pElement->gfx); ! } ! ! free(pElement); ! ! pElement = next; ! } ! ! freeGfx(pMenu->gfx); ! free(pMenu); } Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** cruise.h 21 Oct 2005 22:20:37 -0000 1.31 --- cruise.h 22 Oct 2005 15:40:41 -0000 1.32 *************** *** 115,118 **** --- 115,119 ---- void *allocAndZero(int size); void freeStuff2(void); + u8* getObjectName(int index, u8* string); #endif |
From: Vincent H. <ya...@us...> - 2005-10-21 22:20:45
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11428/src Modified Files: cruise.h function.c overlay.c overlay.h script.c Log Message: Map now shows up... Index: overlay.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/overlay.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** overlay.c 20 Oct 2005 22:31:03 -0000 1.25 --- overlay.c 21 Oct 2005 22:20:37 -0000 1.26 *************** *** 13,17 **** overlayTable[i].ovlData = NULL; overlayTable[i].alreadyLoaded = 0; ! overlayTable[i].field_26 = 0; } --- 13,17 ---- overlayTable[i].ovlData = NULL; overlayTable[i].alreadyLoaded = 0; ! overlayTable[i].executeScripts = 0; } Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** cruise.h 21 Oct 2005 12:14:19 -0000 1.30 --- cruise.h 21 Oct 2005 22:20:37 -0000 1.31 *************** *** 18,23 **** #endif ! #define DUMP_SCRIPT ! #define DUMP_OBJECT #ifndef _TAMTYPES_H_ --- 18,23 ---- #endif ! /*#define DUMP_SCRIPT ! #define DUMP_OBJECT*/ #ifndef _TAMTYPES_H_ Index: overlay.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/overlay.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** overlay.h 20 Oct 2005 12:09:33 -0000 1.14 --- overlay.h 21 Oct 2005 22:20:37 -0000 1.15 *************** *** 172,176 **** char field_24; char field_25; ! short int field_26; }; --- 172,176 ---- char field_24; char field_25; ! short int executeScripts; }; Index: script.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/script.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** script.c 20 Oct 2005 12:09:33 -0000 1.18 --- script.c 21 Oct 2005 22:20:37 -0000 1.19 *************** *** 814,818 **** do { ! if(!overlayTable[ptr->overlayNumber].field_26) { if(ptr->scriptNumber != -1 && ptr->var12 == 0 && ptr->var10 != 0) --- 814,818 ---- do { ! if(!overlayTable[ptr->overlayNumber].executeScripts) { if(ptr->scriptNumber != -1 && ptr->var12 == 0 && ptr->var10 != 0) Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** function.c 21 Oct 2005 12:14:19 -0000 1.33 --- function.c 21 Oct 2005 22:20:37 -0000 1.34 *************** *** 1348,1351 **** --- 1348,1579 ---- } + s16 Op_5E(void) + { + popVar(); + + printf("Partial op 5E (sound related)\n"); + + return 0; + } + + s16 Op_3E(void) + { + printf("Partial op 3E (sound related)\n"); + + return 0; + } + + void setVar49Value(int value) + { + var49 = value; + } + + s16 Op_3A(void) + { + setVar49Value(1); + return 0; + } + + s16 Op_3B(void) + { + setVar49Value(0); + return 0; + } + + s16 Op_3F(void) + { + printf("Partial op 3F (sound related)\n"); + return 0; + } + + s16 Op_40(void) + { + printf("Partial op 40 (sound related)\n"); + //freeStuff1(); + freeStuff2(); + + var24 = 0; + var23 = 0; + return 0; + } + + s16 Op_19(void) + { + popVar(); + popVar(); + popVar(); + + printf("Partial op 19 (remove actor)\n"); + + return 0; + } + + s16 Op_6C(void) + { + int var0; + int var1; + int temp; + + var0 = popVar(); + var1 = popVar(); + + if(!var1) + { + var1 = currentScriptPtr->overlayNumber; + } + + temp = overlayTable[var1].executeScripts; + overlayTable[var1].executeScripts = var0; + + return temp; + } + + void configureAllObjects(int overlayIdx, objectStruct* pObject, int var4, int var0, int var1, int var2, int var3) + { + while(pObject) + { + if((pObject->overlay == overlayIdx) || (overlayIdx == -1)) + { + if((pObject->idx == var4) || (var4 == -1)) + { + if((pObject->type == var3) || (var3 == -1)) + { + if((pObject->backgroundPlane == var2) || (var2 == -1)) + { + if((pObject->hide == var1) || (var1 == -1)) + { + pObject->hide = var0; + } + } + } + } + } + + pObject = pObject->next; + } + } + + s16 Op_16(void) + { + int var0; + int var1; + int var2; + int var3; + int var4; + int var5; + + var0 = popVar(); + var1 = popVar(); + var2 = popVar(); + var3 = popVar(); + var4 = popVar(); + var5 = popVar(); + + if(!var5) + { + var5 = currentScriptPtr->overlayNumber; + } + + configureAllObjects(var5, &objectHead, var4, var0, var1, var2, var3); + + return 0; + } + + void Op_60Sub(int overlayIdx, actorStruct* pActorHead, int var0, int var1, int var2, int var3) + { + actorStruct* pActor = findActor(overlayIdx, var0, pActorHead, var3); + + if(pActor) + { + if((pActor->var28 == var2) || (var2 == -1)) + { + pActor->var28 = var1; + } + } + } + + s16 Op_60(void) + { + int var0; + int var1; + int var2; + int var3; + int var4; + + var0 = popVar(); + var1 = popVar(); + var2 = popVar(); + var3 = popVar(); + var4 = popVar(); + + if(!var4) + { + var4 = currentScriptPtr->overlayNumber; + } + + Op_60Sub(var4, &actorHead, var3, var0, var1, var2); + + return 0; + } + + s16 Op_6F(void) + { + int numArgs = popVar(); + + assert(numArgs == 0); + + { + int var = popVar(); + char* string = popPtr(); + + printf("partial opcode 6F sprintf (%s)\n", string); + } + + return 0; + } + + s16 Op_6E(void) + { + char* ptr0 = popPtr(); + char* ptr1 = popPtr(); + + printf("partial opcode 6E (%s)(%s)\n", ptr0, ptr1); + + return 0; + } + + s16 Op_72(void) + { + int var0 = popVar(); + char* ptr = popPtr(); + int var1 = popVar(); + + if(!var1) + var1 = currentScriptPtr->overlayNumber; + + return getProcParam(var1, var0, ptr); + } + + s16 Op_2A(void) + { + char var_26[36]; + char* ptr = popPtr(); + int overlayIdx; + + var_26[0] = 0; + + if(ptr) + { + strcpy(var_26, ptr); + } + + overlayIdx = popVar(); + + if(!overlayIdx) + overlayIdx = currentScriptPtr->overlayNumber; + + return getProcParam(overlayIdx, 40, var_26); + } + void setupOpcodeTable(void) { *************** *** 1375,1380 **** --- 1603,1610 ---- opcodeTablePtr[0x13] = Op_message; opcodeTablePtr[0x14] = Op_14; + opcodeTablePtr[0x16] = Op_16; opcodeTablePtr[0x17] = Op_loadCtp; opcodeTablePtr[0x18] = Op_18; + opcodeTablePtr[0x19] = Op_19; opcodeTablePtr[0x1A] = Op_1A; opcodeTablePtr[0x1E] = Op_1E; *************** *** 1384,1387 **** --- 1614,1618 ---- opcodeTablePtr[0x28] = Op_ChangeSaveAllowedState; opcodeTablePtr[0x29] = Op_freeAllPerso; + opcodeTablePtr[0x2A] = Op_2A; opcodeTablePtr[0x2B] = Op_2B; opcodeTablePtr[0x2C] = Op_2C; *************** *** 1393,1398 **** --- 1624,1634 ---- opcodeTablePtr[0x38] = Op_removeBackground; opcodeTablePtr[0x39] = Op_SetActiveBackgroundPlane; + opcodeTablePtr[0x3A] = Op_3A; + opcodeTablePtr[0x3B] = Op_3B; opcodeTablePtr[0x3C] = Op_rand; opcodeTablePtr[0x3D] = Op_loadMusic; + opcodeTablePtr[0x3E] = Op_3E; + opcodeTablePtr[0x3F] = Op_3F; + opcodeTablePtr[0x40] = Op_40; opcodeTablePtr[0x41] = Op_isFileLoaded2; opcodeTablePtr[0x45] = Op_45; *************** *** 1405,1408 **** --- 1641,1646 ---- opcodeTablePtr[0x5B] = Op_regenerateBackgroundIncrust; opcodeTablePtr[0x5C] = Op_5C; + opcodeTablePtr[0x5E] = Op_5E; + opcodeTablePtr[0x60] = Op_60; opcodeTablePtr[0x61] = Op_61; opcodeTablePtr[0x62] = Op_62; *************** *** 1415,1421 **** --- 1653,1663 ---- opcodeTablePtr[0x6A] = Op_6A; opcodeTablePtr[0x6B] = Op_loadFile; + opcodeTablePtr[0x6C] = Op_6C; opcodeTablePtr[0x6D] = Op_strcpy; + opcodeTablePtr[0x6E] = Op_6E; + opcodeTablePtr[0x6F] = Op_6F; opcodeTablePtr[0x70] = Op_comment; opcodeTablePtr[0x71] = Op_drawLine; + opcodeTablePtr[0x72] = Op_72; opcodeTablePtr[0x74] = Op_GetInitVar1; opcodeTablePtr[0x76] = Op_76; |
From: Vincent H. <ya...@us...> - 2005-10-21 12:14:27
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20874/src Modified Files: cruise.h decompiler.c function.c osystemDummy.c Log Message: improve decompiler slightly Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** cruise.h 20 Oct 2005 22:31:03 -0000 1.29 --- cruise.h 21 Oct 2005 12:14:19 -0000 1.30 *************** *** 18,23 **** #endif ! /*#define DUMP_SCRIPT ! #define DUMP_OBJECT*/ #ifndef _TAMTYPES_H_ --- 18,23 ---- #endif ! #define DUMP_SCRIPT ! #define DUMP_OBJECT #ifndef _TAMTYPES_H_ Index: decompiler.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/decompiler.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** decompiler.c 20 Oct 2005 09:13:00 -0000 1.26 --- decompiler.c 21 Oct 2005 12:14:19 -0000 1.27 *************** *** 4,7 **** --- 4,25 ---- #ifdef DUMP_SCRIPT + #define numMaxLignes 100000 + #define lineMaxSize 10000 + + int currentLineType = 0; + + struct decompileLineStruct + { + int lineOffset; + char line[lineMaxSize]; + int indent; + int type; + int pendingElse; + }; + + struct decompileLineStruct decompileLineTable[numMaxLignes]; + + int positionInDecompileLineTable; + int failed; *************** *** 14,17 **** --- 32,37 ---- opcodeTypeFunction decompOpcodeTypeTable[64]; + int currentLineIdx = 0; + unsigned long int currentOffset; *************** *** 244,248 **** va_list va; ! fprintf(fHandle,"%d: ",currentOffset); va_start(va,string); --- 264,268 ---- va_list va; ! /* fprintf(fHandle,"%d: ",currentLineIdx); va_start(va,string); *************** *** 250,254 **** va_end(va); ! fprintf(fHandle,"\n"); /*printf("%d: ",currentOffset); --- 270,289 ---- va_end(va); ! fprintf(fHandle,"\n"); */ ! ! struct decompileLineStruct* pLineStruct = &decompileLineTable[positionInDecompileLineTable++]; ! ! pLineStruct->lineOffset = currentLineIdx; ! pLineStruct->indent = 0; ! pLineStruct->type = currentLineType; ! pLineStruct->line[0] = 0; ! pLineStruct->pendingElse = 0; ! ! va_start(va,string); ! vsprintf(pLineStruct->line, string,va); ! va_end(va); ! ! currentLineIdx = currentDecompScriptPtr->var4; ! currentLineType = 0; /*printf("%d: ",currentOffset); *************** *** 596,599 **** --- 631,635 ---- case 0: { + currentLineType = 1; addDecomp("test '!(bitMask & 1)' and goto %d",offset+oldOffset); break; *************** *** 601,604 **** --- 637,641 ---- case 1: { + currentLineType = 1; addDecomp("test '(bitMask & 1)' and goto %d",offset+oldOffset); break; *************** *** 606,609 **** --- 643,647 ---- case 2: { + currentLineType = 1; addDecomp("test '(bitMask & 2)' and goto %d",offset+oldOffset); break; *************** *** 611,614 **** --- 649,653 ---- case 3: { + currentLineType = 1; addDecomp("test '(bitMask & 3)' and goto %d",offset+oldOffset); break; *************** *** 616,619 **** --- 655,659 ---- case 4: { + currentLineType = 1; addDecomp("test '(bitMask & 4)' and goto %d",offset+oldOffset); break; *************** *** 621,624 **** --- 661,665 ---- case 5: { + currentLineType = 1; addDecomp("test '(bitMask & 5)' and goto %d",offset+oldOffset); break; *************** *** 626,629 **** --- 667,671 ---- case 6: { + currentLineType = 2; addDecomp("test 'never' and goto %d",offset+oldOffset); break; *************** *** 631,634 **** --- 673,677 ---- case 7: { + currentLineType = 3; addDecomp("goto %d",offset+oldOffset); break; *************** *** 636,639 **** --- 679,683 ---- } + return 0; } *************** *** 1305,1308 **** --- 1349,1405 ---- } + void generateIndentation(void) + { + int i; + + for(i=0;i<positionInDecompileLineTable;i++) + { + if(decompileLineTable[i].type != 0) + { + char* gotoStatement; + int destLine; + int destLineIdx; + + gotoStatement = strstr(decompileLineTable[i].line,"goto"); + assert(gotoStatement); + gotoStatement = strchr(gotoStatement,' ')+1; + + destLine = atoi(gotoStatement); + + { + int j; + + destLineIdx = -1; + + for(j=0;j<positionInDecompileLineTable;j++) + { + if(decompileLineTable[j].lineOffset == destLine) + { + destLineIdx = j; + break; + } + } + + assert(destLineIdx != -1); + + if(destLineIdx>i) + { + int j; + + for(j=i+1;j<destLineIdx;j++) + { + decompileLineTable[j].indent++; + } + + if(strstr(decompileLineTable[destLineIdx-1].line,"goto") == decompileLineTable[destLineIdx-1].line) + { + //decompileLineTable[destLineIdx-1].pendingElse = 1; + } + } + } + } + } + } + void dumpScript(u8* ovlName, ovlDataStruct* ovlData,int idx) { *************** *** 1326,1329 **** --- 1423,1430 ---- currentDecompScriptIdx = idx; + currentLineIdx = 0; + positionInDecompileLineTable = 0; + currentLineType = 0; + resolveVarName("0",0x20,temp, scriptName); *************** *** 1339,1343 **** stop = 0; ! sprintf(buffer,"%s-%d-%s.txt",ovlName,idx,scriptName); fHandle = fopen(buffer,"w+"); --- 1440,1444 ---- stop = 0; ! sprintf(buffer,"%s-%02d-%s.txt",ovlName,idx,scriptName); fHandle = fopen(buffer,"w+"); *************** *** 1391,1394 **** --- 1492,1517 ---- dumpIdx++; + generateIndentation(); + + for(i=0;i<positionInDecompileLineTable;i++) + { + int j; + + if(decompileLineTable[i].pendingElse) + { + fprintf(fHandle,"%05d:\t", decompileLineTable[i].lineOffset); + fprintf(fHandle,"else", decompileLineTable[i].line); + fprintf(fHandle,"\n"); + } + + fprintf(fHandle,"%05d:\t", decompileLineTable[i].lineOffset); + for(j=0;j<decompileLineTable[i].indent;j++) + { + fprintf(fHandle,"\t"); + } + fprintf(fHandle,"%s", decompileLineTable[i].line); + fprintf(fHandle,"\n"); + } + fclose(fHandle); } Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** function.c 20 Oct 2005 15:02:53 -0000 1.32 --- function.c 21 Oct 2005 12:14:19 -0000 1.33 *************** *** 1440,1444 **** if(opcodeTablePtr[opcode]) { ! printf("Function: %X\n",opcode); pushVar(opcodeTablePtr[opcode]()); return(0); --- 1440,1444 ---- if(opcodeTablePtr[opcode]) { ! //printf("Function: %X\n",opcode); pushVar(opcodeTablePtr[opcode]()); return(0); Index: osystemDummy.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/osystemDummy.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** osystemDummy.c 20 Oct 2005 09:34:42 -0000 1.6 --- osystemDummy.c 21 Oct 2005 12:14:19 -0000 1.7 *************** *** 26,32 **** } unsigned int Osystem_GetTicks() { ! return 0; } --- 26,34 ---- } + unsigned long int timeFake = 0; + unsigned int Osystem_GetTicks() { ! return timeFake+=10; } |
From: Vincent H. <ya...@us...> - 2005-10-20 22:31:20
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10810/src Modified Files: cruise.c cruise.h mainDraw.c object.c overlay.c Log Message: Temptative fix to inventory list, not quite that yet Index: overlay.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/overlay.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** overlay.c 20 Oct 2005 19:52:42 -0000 1.24 --- overlay.c 20 Oct 2005 22:31:03 -0000 1.25 *************** *** 650,656 **** ASSERT(fHandle); ! for(i=0;i<ovlData->numObjData;i++) { } --- 650,666 ---- ASSERT(fHandle); ! for(i=0;i<ovlData->numLinkData;i++) { + linkDataStruct* var_34; + var_34 = &ovlData->linkDataPtr[i]; + if(ovlData->specialString2) + { + fprintf(fHandle,"----- object %02d -----\n", i); + if(var_34->stringNameOffset != 0xFFFF) + { + fprintf(fHandle,"name: %s\n",getObjectName(var_34->stringNameOffset, ovlData->specialString2)); + } + } } Index: object.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/object.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** object.c 20 Oct 2005 15:02:53 -0000 1.7 --- object.c 20 Oct 2005 22:31:03 -0000 1.8 *************** *** 431,435 **** var_A = globalVars[ptr->var6]; ! ptr2 = &ovlData->objData2SourceTable[var_A + ptr->var5]; break; } --- 431,435 ---- var_A = globalVars[ptr->var6]; ! ptr2 = &ovlData->objData2SourceTable[ptr->var5]; break; } *************** *** 438,441 **** --- 438,442 ---- ptr2 = &ovlData->objData2WorkTable[ptr->var4]; + var_A = ptr2->var5; break; } *************** *** 476,480 **** case 5: { ! *returnParam = ptr2->var5; break; } --- 477,481 ---- case 5: { ! *returnParam = var_A; break; } Index: cruise.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** cruise.c 20 Oct 2005 15:02:53 -0000 1.60 --- cruise.c 20 Oct 2005 22:31:03 -0000 1.61 *************** *** 793,796 **** --- 793,810 ---- } + 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) { *************** *** 826,830 **** for(j=0;j<pOvlData->numObjData;j++) { ! //if(buildInventorySub1(i,j) != 3) { s16 returnVar; --- 840,844 ---- for(j=0;j<pOvlData->numObjData;j++) { ! if(buildInventorySub1(i,j) != 3) { s16 returnVar; Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** mainDraw.c 20 Oct 2005 15:02:53 -0000 1.30 --- mainDraw.c 20 Oct 2005 22:31:03 -0000 1.31 *************** *** 1270,1274 **** #ifdef _DEBUG ! drawCtp(); #endif --- 1270,1274 ---- #ifdef _DEBUG ! //drawCtp(); #endif Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** cruise.h 20 Oct 2005 19:52:42 -0000 1.28 --- cruise.h 20 Oct 2005 22:31:03 -0000 1.29 *************** *** 18,23 **** #endif ! #define DUMP_SCRIPT ! #define DUMP_OBJECT #ifndef _TAMTYPES_H_ --- 18,23 ---- #endif ! /*#define DUMP_SCRIPT ! #define DUMP_OBJECT*/ #ifndef _TAMTYPES_H_ |
From: Vincent H. <ya...@us...> - 2005-10-20 19:52:56
|
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1296/src Modified Files: cruise.h osystemSDL.c overlay.c Log Message: commit fix to sdl driver Index: overlay.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/overlay.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** overlay.c 20 Oct 2005 12:09:33 -0000 1.23 --- overlay.c 20 Oct 2005 19:52:42 -0000 1.24 *************** *** 640,643 **** --- 640,661 ---- } #endif + #ifdef DUMP_OBJECT + { + int i; + FILE* fHandle; + char nameBundle[100]; + sprintf(nameBundle, "%s-objs.txt",scriptName); + + fHandle = fopen(nameBundle, "w+"); + ASSERT(fHandle); + + for(i=0;i<ovlData->numObjData;i++) + { + + } + + fclose(fHandle); + } + #endif return(scriptIdx); Index: osystemSDL.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/osystemSDL.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** osystemSDL.c 14 Oct 2005 20:47:44 -0000 1.13 --- osystemSDL.c 20 Oct 2005 19:52:42 -0000 1.14 *************** *** 45,48 **** --- 45,58 ---- } + unsigned int Osystem_GetTicks(void) + { + return SDL_GetTicks(); + } + + void Osystem_Delay(int delay) + { + SDL_Delay(delay); + } + void updateImage() { Index: cruise.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** cruise.h 20 Oct 2005 12:09:33 -0000 1.27 --- cruise.h 20 Oct 2005 19:52:42 -0000 1.28 *************** *** 18,22 **** #endif ! //#define DUMP_SCRIPT #ifndef _TAMTYPES_H_ --- 18,23 ---- #endif ! #define DUMP_SCRIPT ! #define DUMP_OBJECT #ifndef _TAMTYPES_H_ |
Update of /cvsroot/cine/cruisE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26996/src Modified Files: backgroundIncrust.c backgroundIncrust.h cruise.c dataLoader.c function.c mainDraw.c object.c object.h various.c vars.h Log Message: More cleanup Index: backgroundIncrust.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/backgroundIncrust.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** backgroundIncrust.h 15 May 2005 13:25:39 -0000 1.4 --- backgroundIncrust.h 20 Oct 2005 15:02:53 -0000 1.5 *************** *** 6,19 **** struct backgroundIncrustStruct* prev; ! u16 field_4; u16 field_6; ! u16 field_8; u16 X; u16 Y; u16 field_E; ! u16 field_10; ! u16 field_12; ! u16 field_14; ! u16 field_16; u8* ptr; s32 field_1C; --- 6,19 ---- struct backgroundIncrustStruct* prev; ! u16 objectIdx; u16 field_6; ! u16 overlayIdx; u16 X; u16 Y; u16 field_E; ! u16 scale; ! u16 backgroundIdx; ! u16 scriptNumber; ! u16 scriptOverlayIdx; u8* ptr; s32 field_1C; Index: vars.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/vars.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** vars.h 20 Oct 2005 12:09:33 -0000 1.23 --- vars.h 20 Oct 2005 15:02:53 -0000 1.24 *************** *** 137,144 **** struct dataFileEntry { ! s16 field_0; ! s16 field_2; ! s16 field_4; ! s16 field_6; dataFileEntrySub subData; }; --- 137,144 ---- struct dataFileEntry { ! s16 widthInColumn; ! s16 width; ! s16 resType; ! s16 height; dataFileEntrySub subData; }; Index: dataLoader.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/dataLoader.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dataLoader.c 6 Jul 2005 21:44:40 -0000 1.6 --- dataLoader.c 20 Oct 2005 15:02:53 -0000 1.7 *************** *** 24,28 **** unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->field_6 * pCurrentFileEntry->field_0 * 8; int x = 0; --- 24,28 ---- unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn * 8; int x = 0; *************** *** 59,63 **** unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->field_6 * pCurrentFileEntry->field_0 * 2; int x = 0; --- 59,63 ---- unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn * 2; int x = 0; *************** *** 102,108 **** unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->field_6 * pCurrentFileEntry->field_0; int x = 0; ! int range = pCurrentFileEntry->field_6 * pCurrentFileEntry->field_2; buffer = (char*)malloc(spriteSize); --- 102,108 ---- unsigned char* dataPtr = pCurrentFileEntry->subData.ptr; ! int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn; int x = 0; ! int range = pCurrentFileEntry->height * pCurrentFileEntry->width; buffer = (char*)malloc(spriteSize); *************** *** 168,177 **** return(-2); ! filesDatabase[entryNumber].field_0 = param2; filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! filesDatabase[entryNumber].field_2 = param2 / 8; ! filesDatabase[entryNumber].field_4 = resType; ! filesDatabase[entryNumber].field_6 = param1; filesDatabase[entryNumber].subData.var4 = -1; --- 168,177 ---- return(-2); ! filesDatabase[entryNumber].widthInColumn = param2; filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! filesDatabase[entryNumber].width = param2 / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = param1; filesDatabase[entryNumber].subData.var4 = -1; *************** *** 221,230 **** return(-2); ! filesDatabase[entryNumber].field_0 = param1; filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! filesDatabase[entryNumber].field_2 = param1 / 8; ! filesDatabase[entryNumber].field_4 = resType; ! filesDatabase[entryNumber].field_6 = param2; filesDatabase[entryNumber].subData.var4 = -1; --- 221,230 ---- return(-2); ! filesDatabase[entryNumber].widthInColumn = param1; filesDatabase[entryNumber].subData.ptr2 = filesDatabase[entryNumber].subData.ptr+size; ! filesDatabase[entryNumber].width = param1 / 8; ! filesDatabase[entryNumber].resType = resType; ! filesDatabase[entryNumber].height = param2; filesDatabase[entryNumber].subData.var4 = -1; *************** *** 468,472 **** case 4: { ! filesDatabase[fileIndex].field_2 *= 2; filesDatabase[fileIndex].subData.resourceType = 4; decodeGfxFormat4(&filesDatabase[fileIndex]); --- 468,472 ---- case 4: { ! filesDatabase[fileIndex].width *= 2; filesDatabase[fileIndex].subData.resourceType = 4; decodeGfxFormat4(&filesDatabase[fileIndex]); Index: function.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/function.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** function.c 20 Oct 2005 12:09:33 -0000 1.31 --- function.c 20 Oct 2005 15:02:53 -0000 1.32 *************** *** 238,242 **** objectStruct* pNext = pCurrent->next; ! if(pCurrent->field_14 == 0) { free(pCurrent->gfxPtr); --- 238,242 ---- objectStruct* pNext = pCurrent->next; ! if(pCurrent->hide == 0) { free(pCurrent->gfxPtr); *************** *** 961,966 **** while(pCurrent) { ! if( (pCurrent->field_8 == overlay || overlay == -1) && ! (pCurrent->field_4 == idx || idx == -1) && (pCurrent->X == var_4) && (pCurrent->Y == var_6)) --- 961,966 ---- while(pCurrent) { ! if( (pCurrent->overlayIdx == overlay || overlay == -1) && ! (pCurrent->objectIdx == idx || idx == -1) && (pCurrent->X == var_4) && (pCurrent->Y == var_6)) Index: various.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/various.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** various.c 15 May 2005 13:25:40 -0000 1.21 --- various.c 20 Oct 2005 15:02:53 -0000 1.22 *************** *** 131,135 **** pNewElement->spriteIdx = oldVar2; pNewElement->field_10 = color; ! pNewElement->field_14 = 0; pNewElement->field_16 = scriptNumber; pNewElement->field_18 = scriptOverlayNumber; --- 131,135 ---- pNewElement->spriteIdx = oldVar2; pNewElement->field_10 = color; ! pNewElement->hide = 0; pNewElement->field_16 = scriptNumber; pNewElement->field_18 = scriptOverlayNumber; Index: object.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/object.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** object.c 20 Oct 2005 12:09:33 -0000 1.6 --- object.c 20 Oct 2005 15:02:53 -0000 1.7 *************** *** 84,88 **** returnParam->Y = ptr2->Y; returnParam->baseFileIdx = ptr2->baseFileIdx; ! returnParam->var3 = ptr2->var3; returnParam->scale = ptr2->scale; returnParam->var5 = var_14; --- 84,88 ---- returnParam->Y = ptr2->Y; returnParam->baseFileIdx = ptr2->baseFileIdx; ! returnParam->fileIdx = ptr2->var3; returnParam->scale = ptr2->scale; returnParam->var5 = var_14; *************** *** 155,164 **** newElement->backgroundPlane = param3; newElement->overlay = overlayIdx; ! newElement->field_14 = 0; newElement->field_16 = scriptNumber; newElement->field_18 = scriptOverlay; newElement->gfxPtr = NULL; ! newElement->field_1E = param2; ! newElement->field_1C = overlayIdx; newElement->field_1A = scriptType; newElement->field_20 = 0; --- 155,164 ---- newElement->backgroundPlane = param3; newElement->overlay = overlayIdx; ! newElement->hide = 0; newElement->field_16 = scriptNumber; newElement->field_18 = scriptOverlay; newElement->gfxPtr = NULL; ! newElement->followObjectIdx = param2; ! newElement->followObjectOverlayIdx = overlayIdx; newElement->field_1A = scriptType; newElement->field_20 = 0; Index: backgroundIncrust.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/backgroundIncrust.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** backgroundIncrust.c 20 Oct 2005 12:09:33 -0000 1.10 --- backgroundIncrust.c 20 Oct 2005 15:02:53 -0000 1.11 *************** *** 20,24 **** } ! backgroundIncrustStruct* addBackgroundIncrust(s16 overlayIdx,s16 param2,backgroundIncrustStruct* pHead,s16 scriptNumber,s16 scriptOverlay, s16 backgroundIdx, s16 param4) { u8* backgroundPtr; --- 20,24 ---- } ! backgroundIncrustStruct* addBackgroundIncrust(s16 overlayIdx,s16 objectIdx,backgroundIncrustStruct* pHead,s16 scriptNumber,s16 scriptOverlay, s16 backgroundIdx, s16 param4) { u8* backgroundPtr; *************** *** 29,35 **** backgroundIncrustStruct* currentHead2; ! getMultipleObjectParam(overlayIdx,param2,¶ms); ! ptr = filesDatabase[params.var3].subData.ptr; if(!ptr) --- 29,35 ---- backgroundIncrustStruct* currentHead2; ! getMultipleObjectParam(overlayIdx,objectIdx,¶ms); ! ptr = filesDatabase[params.fileIdx].subData.ptr; if(!ptr) *************** *** 38,42 **** } ! if(filesDatabase[params.var3].subData.resourceType != 4 && filesDatabase[params.var3].subData.resourceType != 8) { return NULL; --- 38,42 ---- } ! if(filesDatabase[params.fileIdx].subData.resourceType != 4 && filesDatabase[params.fileIdx].subData.resourceType != 8) { return NULL; *************** *** 76,100 **** currentHead2->prev = newElement; ! newElement->field_4 = param2; newElement->field_6 = param4; ! newElement->field_12 = backgroundIdx; ! newElement->field_8 = overlayIdx; ! newElement->field_14 = scriptNumber; ! newElement->field_16 = scriptOverlay; newElement->X = params.X; newElement->Y = params.Y; ! newElement->field_10 = params.scale; ! newElement->field_E = params.var3; ! newElement->var34 = filesDatabase[params.var3].subData.var4; newElement->ptr = NULL; ! strcpy(newElement->name, filesDatabase[params.var3].subData.name); ! if(filesDatabase[params.var3].subData.resourceType == 4) // sprite { ! int width = filesDatabase[params.var3].field_2; ! int height = filesDatabase[params.var3].field_6; ! currentTransparent = filesDatabase[params.var3].subData.transparency; ! mainDrawSub4(width, height, NULL, filesDatabase[params.var3].subData.ptr, newElement->Y, newElement->X, backgroundPtr, filesDatabase[params.var3].subData.ptr); // ASSERT(0); } --- 76,100 ---- 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.var4; 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, filesDatabase[params.fileIdx].subData.ptr, newElement->Y, newElement->X, backgroundPtr, filesDatabase[params.fileIdx].subData.ptr); // ASSERT(0); } *************** *** 112,116 **** }*/ ! addBackgroundIncrustSub1(params.var3, newElement->X, newElement->Y, NULL, params.scale, backgroundPtr, filesDatabase[params.var3].subData.ptr ); } --- 112,116 ---- }*/ ! addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, backgroundPtr, filesDatabase[params.fileIdx].subData.ptr ); } *************** *** 136,149 **** fseek(fileHandle, 4, SEEK_CUR); ! fread(¤t->field_4,2,1,fileHandle); fread(¤t->field_6,2,1,fileHandle); ! fread(¤t->field_8,2,1,fileHandle); fread(¤t->X,2,1,fileHandle); fread(¤t->Y,2,1,fileHandle); fread(¤t->field_E,2,1,fileHandle); ! fread(¤t->field_10,2,1,fileHandle); ! fread(¤t->field_12,2,1,fileHandle); ! fread(¤t->field_14,2,1,fileHandle); ! fread(¤t->field_16,2,1,fileHandle); fread(¤t->ptr,4,1,fileHandle); fread(¤t->field_1C,4,1,fileHandle); --- 136,149 ---- 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); Index: mainDraw.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/mainDraw.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mainDraw.c 20 Oct 2005 12:09:33 -0000 1.29 --- mainDraw.c 20 Oct 2005 15:02:53 -0000 1.30 *************** *** 97,101 **** if(var_6 >= 0) { ! if(filesDatabase[var_6].field_4 == 0 && filesDatabase[var_6].subData.ptr) { dataPtr = filesDatabase[var_6].subData.ptr; --- 97,101 ---- if(var_6 >= 0) { ! if(filesDatabase[var_6].resType == 0 && filesDatabase[var_6].subData.ptr) { dataPtr = filesDatabase[var_6].subData.ptr; *************** *** 1048,1052 **** return params->baseFileIdx; case 3: ! return params->var3; case 4: return params->scale; --- 1048,1052 ---- return params->baseFileIdx; case 3: ! return params->fileIdx; case 4: return params->scale; *************** *** 1099,1103 **** while(currentObjPtr) { ! if((currentActiveBackgroundPlane == currentObjPtr->backgroundPlane) && (currentObjPtr->field_14 == 0) && (currentObjPtr->type == 4)) { s16 fileIdx; --- 1099,1103 ---- while(currentObjPtr) { ! if((currentActiveBackgroundPlane == currentObjPtr->backgroundPlane) && (currentObjPtr->hide == 0) && (currentObjPtr->type == 4)) { s16 fileIdx; *************** *** 1106,1110 **** currentObjIdx = currentObjPtr->idx; ! if((currentObjPtr->field_1C == currentObjPtr->overlay) && (currentObjPtr->field_1E == currentObjPtr->idx)) { objX1 = 0; --- 1106,1110 ---- currentObjIdx = currentObjPtr->idx; ! if((currentObjPtr->followObjectOverlayIdx == currentObjPtr->overlay) && (currentObjPtr->followObjectIdx == currentObjPtr->idx)) { objX1 = 0; *************** *** 1116,1124 **** objectParamsQuery params; ! getMultipleObjectParam(currentObjPtr->field_1C, currentObjPtr->field_1E, ¶ms); objX1 = params.X; objY1 = params.Y; ! objZ1 = params.var3; } --- 1116,1124 ---- objectParamsQuery params; ! getMultipleObjectParam(currentObjPtr->followObjectOverlayIdx, currentObjPtr->followObjectIdx, ¶ms); objX1 = params.X; objY1 = params.Y; ! objZ1 = params.fileIdx; } *************** *** 1128,1132 **** objY2 = objY1 + params.Y; ! fileIdx = params.var3; if(fileIdx>=0) --- 1128,1132 ---- objY2 = objY1 + params.Y; ! fileIdx = params.fileIdx; if(fileIdx>=0) *************** *** 1144,1154 **** { } ! else if(filesDatabase[fileIdx].field_4 == 1) { } else if(filesDatabase[fileIdx].subData.resourceType == 4) { ! objX1 = filesDatabase[fileIdx].field_2; // width ! var_6 = filesDatabase[fileIdx].field_6; // height if(filesDatabase[fileIdx].subData.ptr) --- 1144,1154 ---- { } ! else if(filesDatabase[fileIdx].resType == 1) { } else if(filesDatabase[fileIdx].subData.resourceType == 4) { ! objX1 = filesDatabase[fileIdx].width; // width ! var_6 = filesDatabase[fileIdx].height; // height if(filesDatabase[fileIdx].subData.ptr) *************** *** 1259,1263 **** while(currentObjPtr) { ! if(currentObjPtr->type == 5 && currentObjPtr->field_14 == 0) { mainSprite(currentObjPtr->field_A, currentObjPtr->field_C, currentObjPtr->gfxPtr, gfxModuleData.pPage10, currentObjPtr->field_10, currentObjPtr->spriteIdx); --- 1259,1263 ---- while(currentObjPtr) { ! if(currentObjPtr->type == 5 && currentObjPtr->hide == 0) { mainSprite(currentObjPtr->field_A, currentObjPtr->field_C, currentObjPtr->gfxPtr, gfxModuleData.pPage10, currentObjPtr->field_10, currentObjPtr->spriteIdx); Index: object.h =================================================================== RCS file: /cvsroot/cine/cruisE/src/object.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** object.h 20 Oct 2005 12:09:33 -0000 1.3 --- object.h 20 Oct 2005 15:02:53 -0000 1.4 *************** *** 25,34 **** s16 field_10; s16 backgroundPlane; ! s16 field_14; s16 field_16; s16 field_18; s16 field_1A; ! s16 field_1C; ! s16 field_1E; s16 field_20; s16 field_22; --- 25,34 ---- s16 field_10; s16 backgroundPlane; ! s16 hide; s16 field_16; s16 field_18; s16 field_1A; ! s16 followObjectOverlayIdx; ! s16 followObjectIdx; s16 field_20; s16 field_22; *************** *** 50,54 **** s16 Y; s16 baseFileIdx; ! s16 var3; s16 scale; s16 var5; --- 50,54 ---- s16 Y; s16 baseFileIdx; ! s16 fileIdx; s16 scale; s16 var5; Index: cruise.c =================================================================== RCS file: /cvsroot/cine/cruisE/src/cruise.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** cruise.c 20 Oct 2005 12:09:33 -0000 1.59 --- cruise.c 20 Oct 2005 15:02:53 -0000 1.60 *************** *** 454,461 **** filesDatabase[entryNumber].subData.ptr = NULL; filesDatabase[entryNumber].subData.ptr2 = NULL; ! filesDatabase[entryNumber].field_0 = 0; ! filesDatabase[entryNumber].field_2 = 0; ! filesDatabase[entryNumber].field_4 = 0; ! filesDatabase[entryNumber].field_6 = 0; filesDatabase[entryNumber].subData.var4 = -1; filesDatabase[entryNumber].subData.resourceType = 0; --- 454,461 ---- 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.var4 = -1; filesDatabase[entryNumber].subData.resourceType = 0; *************** *** 686,695 **** //if(strlen(objectName)) { ! if(currentObject->field_14 == 0) { var_2 = currentObject->idx; var_4 = currentObject->overlay; ! var_14 = currentObject->field_1E; ! var_16 = currentObject->field_1C; getMultipleObjectParam(currentObject->overlay, currentObject->idx, ¶ms); --- 686,695 ---- //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); *************** *** 706,713 **** var_C = params.X; var_E = params.Y; ! var_10 = params.var3; } ! if(params.var5 >= 0 && params.var3 >= 0) { if(currentObject->type == 3) --- 706,713 ---- var_C = params.X; var_E = params.Y; ! var_10 = params.fileIdx; } ! if(params.var5 >= 0 && params.fileIdx >= 0) { if(currentObject->type == 3) *************** *** 716,720 **** var_A = params.X + var_C; ! if((var_A <= mouseX) && (var_A + params.var3 >= mouseX) && (mouseY >= params.Y + var_E) && (params.Y + var_E + var2 >= mouseY)) { *outX = var_16; --- 716,721 ---- 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; *************** *** 732,736 **** var_6 = params.Y + var_E; ! di = params.var3; if(di<0) --- 733,737 ---- var_6 = params.Y + var_E; ! di = params.fileIdx; if(di<0) |