-Cleanup strings
-Fix load saves from original interpreter -Add all background merge functions svn-id: r29467
This commit is contained in:
parent
83eec141c8
commit
faf78d582a
25 changed files with 457 additions and 337 deletions
|
@ -85,7 +85,7 @@ int loadCVT(uint8 **ptr) {
|
||||||
|
|
||||||
extern int lastFileSize;
|
extern int lastFileSize;
|
||||||
|
|
||||||
int loadBackground(char *name, int idx) {
|
int loadBackground(const char *name, int idx) {
|
||||||
uint8 *ptr;
|
uint8 *ptr;
|
||||||
uint8 *ptr2;
|
uint8 *ptr2;
|
||||||
uint8 *ptrToFree;
|
uint8 *ptrToFree;
|
||||||
|
@ -109,15 +109,14 @@ int loadBackground(char *name, int idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrToFree = gfxModuleData.pPage10;
|
ptrToFree = gfxModuleData.pPage10;
|
||||||
if (loadFileSub1(&ptrToFree, (uint8 *) name, NULL) < 0) {
|
if (loadFileSub1(&ptrToFree, name, NULL) < 0) {
|
||||||
if (ptrToFree != gfxModuleData.pPage10)
|
if (ptrToFree != gfxModuleData.pPage10)
|
||||||
free(ptrToFree);
|
free(ptrToFree);
|
||||||
|
|
||||||
return (-18);
|
return (-18);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastFileSize == 32078 || lastFileSize == 32080
|
if (lastFileSize == 32078 || lastFileSize == 32080 || lastFileSize == 32034) {
|
||||||
|| lastFileSize == 32034) {
|
|
||||||
colorMode = 0;
|
colorMode = 0;
|
||||||
} else {
|
} else {
|
||||||
colorMode = 1;
|
colorMode = 1;
|
||||||
|
@ -126,7 +125,7 @@ int loadBackground(char *name, int idx) {
|
||||||
ptr = ptrToFree;
|
ptr = ptrToFree;
|
||||||
ptr2 = ptrToFree;
|
ptr2 = ptrToFree;
|
||||||
|
|
||||||
if (!strcmpuint8(name, "LOGO.PI1")) {
|
if (!strcmp(name, "LOGO.PI1")) {
|
||||||
bgVar3 = bgVar2;
|
bgVar3 = bgVar2;
|
||||||
bgVar1 = 1;
|
bgVar1 = 1;
|
||||||
bgVar2 = 1;
|
bgVar2 = 1;
|
||||||
|
@ -137,7 +136,7 @@ int loadBackground(char *name, int idx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmpuint8(ptr, "PAL")) {
|
if (!strcmp((char*)ptr, "PAL")) {
|
||||||
printf("Pal loading unsupported !\n");
|
printf("Pal loading unsupported !\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -38,7 +38,7 @@ extern int CVTLoaded;
|
||||||
extern uint8 *backgroundPtrtable[8];
|
extern uint8 *backgroundPtrtable[8];
|
||||||
extern backgroundTableStruct backgroundTable[8];
|
extern backgroundTableStruct backgroundTable[8];
|
||||||
|
|
||||||
int loadBackground(char *name, int idx);
|
int loadBackground(const char *name, int idx);
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ void resetBackgroundIncrustList(backgroundIncrustStruct *pHead) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// blit background to another one
|
// blit background to another one
|
||||||
void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char *ptr2,
|
void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char *ptr2, int16 scale, char *destBuffer, char *dataPtr) {
|
||||||
int16 scale, char *destBuffer, char *dataPtr) {
|
|
||||||
if (*dataPtr == 0) {
|
if (*dataPtr == 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +43,50 @@ void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char *ptr2,
|
||||||
buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr);
|
buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx, backgroundIncrustStruct *pHead, int16 scriptNumber, int16 scriptOverlay, int16 backgroundIdx, int16 param4) {
|
void backupBackground(backgroundIncrustStruct *pIncrust, int X, int Y, int width, int height, uint8* pBackground)
|
||||||
|
{
|
||||||
|
pIncrust->saveWidth = width;
|
||||||
|
pIncrust->saveHeight = height;
|
||||||
|
pIncrust->saveSize = width*height;
|
||||||
|
pIncrust->savedX = X;
|
||||||
|
pIncrust->savedY = Y;
|
||||||
|
|
||||||
|
pIncrust->ptr = (uint8*)malloc(width*height);
|
||||||
|
for(int i=0; i<height; i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<width; j++)
|
||||||
|
{
|
||||||
|
pIncrust->ptr[i*width+j] = pBackground[(i+Y)*320+j+Y];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void restoreBackground(backgroundIncrustStruct *pIncrust)
|
||||||
|
{
|
||||||
|
if(pIncrust->type != 1)
|
||||||
|
return;
|
||||||
|
if(pIncrust->ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8* pBackground = backgroundPtrtable[pIncrust->backgroundIdx];
|
||||||
|
if(pBackground == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int X = pIncrust->savedX;
|
||||||
|
int Y = pIncrust->savedY;
|
||||||
|
int width = pIncrust->saveWidth;
|
||||||
|
int height = pIncrust->saveHeight;
|
||||||
|
|
||||||
|
for(int i=0; i<height; i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<width; j++)
|
||||||
|
{
|
||||||
|
pBackground[(i+Y)*320+j+Y] = pIncrust->ptr[i*width+j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx, backgroundIncrustStruct *pHead, int16 scriptNumber, int16 scriptOverlay, int16 backgroundIdx, int16 saveBuffer) {
|
||||||
uint8 *backgroundPtr;
|
uint8 *backgroundPtr;
|
||||||
uint8 *ptr;
|
uint8 *ptr;
|
||||||
objectParamsQuery params;
|
objectParamsQuery params;
|
||||||
|
@ -60,8 +102,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filesDatabase[params.fileIdx].subData.resourceType != 4
|
if (filesDatabase[params.fileIdx].subData.resourceType != 4 && filesDatabase[params.fileIdx].subData.resourceType != 8) {
|
||||||
&& filesDatabase[params.fileIdx].subData.resourceType != 8) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +121,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
currentHead2 = currentHead->next;
|
currentHead2 = currentHead->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
newElement =
|
newElement = (backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));
|
||||||
(backgroundIncrustStruct *)
|
|
||||||
mallocAndZero(sizeof(backgroundIncrustStruct));
|
|
||||||
|
|
||||||
if (!newElement)
|
if (!newElement)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -98,7 +137,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
currentHead2->prev = newElement;
|
currentHead2->prev = newElement;
|
||||||
|
|
||||||
newElement->objectIdx = objectIdx;
|
newElement->objectIdx = objectIdx;
|
||||||
newElement->type = param4;
|
newElement->type = saveBuffer;
|
||||||
newElement->backgroundIdx = backgroundIdx;
|
newElement->backgroundIdx = backgroundIdx;
|
||||||
newElement->overlayIdx = overlayIdx;
|
newElement->overlayIdx = overlayIdx;
|
||||||
newElement->scriptNumber = scriptNumber;
|
newElement->scriptNumber = scriptNumber;
|
||||||
|
@ -107,7 +146,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
newElement->Y = params.Y;
|
newElement->Y = params.Y;
|
||||||
newElement->scale = params.scale;
|
newElement->scale = params.scale;
|
||||||
newElement->field_E = params.fileIdx;
|
newElement->field_E = params.fileIdx;
|
||||||
newElement->aniX = filesDatabase[params.fileIdx].subData.index;
|
newElement->spriteId = filesDatabase[params.fileIdx].subData.index;
|
||||||
newElement->ptr = NULL;
|
newElement->ptr = NULL;
|
||||||
strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
|
strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
|
||||||
|
|
||||||
|
@ -115,19 +154,31 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
int width = filesDatabase[params.fileIdx].width;
|
int width = filesDatabase[params.fileIdx].width;
|
||||||
int height = filesDatabase[params.fileIdx].height;
|
int height = filesDatabase[params.fileIdx].height;
|
||||||
|
|
||||||
|
if(saveBuffer == 1) {
|
||||||
|
backupBackground(newElement, newElement->X, newElement->Y, width, height, backgroundPtr);
|
||||||
|
}
|
||||||
|
|
||||||
drawSprite(width, height, NULL, (char *)filesDatabase[params.fileIdx].subData.ptr, newElement->Y, newElement->X, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptrMask);
|
drawSprite(width, height, NULL, (char *)filesDatabase[params.fileIdx].subData.ptr, newElement->Y, newElement->X, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptrMask);
|
||||||
// ASSERT(0);
|
|
||||||
} else { // poly
|
} else { // poly
|
||||||
/* if (param4 == 1)
|
if (saveBuffer == 1) {
|
||||||
* {
|
int newX;
|
||||||
* int var_A;
|
int newY;
|
||||||
* int var_8;
|
int newScale;
|
||||||
* int var_6;
|
char *newFrame;
|
||||||
* char* var_10;
|
|
||||||
*
|
int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top
|
||||||
* mainDrawSub1Sub1(lvar[3], newElement->X, newElement->Y, &var_A, &var_8, &var_6, &var_10, lvar[4], filesDatabase[lvar[3]].subData.ptr);
|
|
||||||
* ASSERT(0);
|
// this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1)
|
||||||
* } */
|
flipPoly(params.fileIdx, (int16*)filesDatabase[params.fileIdx].subData.ptr, params.scale, &newFrame, newElement->X, newElement->Y, &newX, &newY, &newScale);
|
||||||
|
|
||||||
|
// this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2)
|
||||||
|
getPolySize(newX, newY, newScale, sizeTable, (unsigned char*)newFrame);
|
||||||
|
|
||||||
|
int width = (sizeTable[1]+2) - (sizeTable[0]-2) + 1;
|
||||||
|
int height = sizeTable[3]-sizeTable[2]+1;
|
||||||
|
|
||||||
|
backupBackground(newElement, newElement->X, newElement->Y, width, height, backgroundPtr);
|
||||||
|
}
|
||||||
|
|
||||||
addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptr);
|
addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptr);
|
||||||
}
|
}
|
||||||
|
@ -137,56 +188,104 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
|
||||||
|
|
||||||
void loadBackgroundIncrustFromSave(Common::File& currentSaveFile) {
|
void loadBackgroundIncrustFromSave(Common::File& currentSaveFile) {
|
||||||
int16 numEntry;
|
int16 numEntry;
|
||||||
backgroundIncrustStruct *ptr1;
|
|
||||||
backgroundIncrustStruct *ptr2;
|
|
||||||
int32 i;
|
int32 i;
|
||||||
|
|
||||||
numEntry = currentSaveFile.readSint16LE();
|
numEntry = currentSaveFile.readSint16LE();
|
||||||
|
|
||||||
ptr1 = &backgroundIncrustHead;
|
backgroundIncrustStruct *pl = &backgroundIncrustHead;
|
||||||
ptr2 = &backgroundIncrustHead;
|
backgroundIncrustStruct *pl1 = &backgroundIncrustHead;
|
||||||
|
|
||||||
for (i = 0; i < numEntry; i++) {
|
for (i = 0; i < numEntry; i++) {
|
||||||
backgroundIncrustStruct *current = (backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));
|
backgroundIncrustStruct *pl2 = (backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));
|
||||||
|
|
||||||
currentSaveFile.skip(2);
|
currentSaveFile.skip(2);
|
||||||
currentSaveFile.skip(2);
|
currentSaveFile.skip(2);
|
||||||
|
|
||||||
current->objectIdx = currentSaveFile.readSint16LE();
|
pl2->objectIdx = currentSaveFile.readSint16LE();
|
||||||
current->type = currentSaveFile.readSint16LE();
|
pl2->type = currentSaveFile.readSint16LE();
|
||||||
current->overlayIdx = currentSaveFile.readSint16LE();
|
pl2->overlayIdx = currentSaveFile.readSint16LE();
|
||||||
current->X = currentSaveFile.readSint16LE();
|
pl2->X = currentSaveFile.readSint16LE();
|
||||||
current->Y = currentSaveFile.readSint16LE();
|
pl2->Y = currentSaveFile.readSint16LE();
|
||||||
current->field_E = currentSaveFile.readSint16LE();
|
pl2->field_E = currentSaveFile.readSint16LE();
|
||||||
current->scale = currentSaveFile.readSint16LE();
|
pl2->scale = currentSaveFile.readSint16LE();
|
||||||
current->backgroundIdx = currentSaveFile.readSint16LE();
|
pl2->backgroundIdx = currentSaveFile.readSint16LE();
|
||||||
current->scriptNumber = currentSaveFile.readSint16LE();
|
pl2->scriptNumber = currentSaveFile.readSint16LE();
|
||||||
current->scriptOverlayIdx = currentSaveFile.readSint16LE();
|
pl2->scriptOverlayIdx = currentSaveFile.readSint16LE();
|
||||||
currentSaveFile.skip(4);
|
currentSaveFile.skip(4);
|
||||||
current->field_1C = currentSaveFile.readSint32LE();
|
pl2->saveWidth = currentSaveFile.readSint16LE()*2;
|
||||||
current->size = currentSaveFile.readSint16LE();
|
pl2->saveHeight = currentSaveFile.readSint16LE();
|
||||||
current->field_22 = currentSaveFile.readSint16LE();
|
pl2->saveSize = currentSaveFile.readUint16LE();
|
||||||
current->field_24 = currentSaveFile.readSint16LE();
|
pl2->savedX = currentSaveFile.readSint16LE();
|
||||||
currentSaveFile.read(current->name, 13);
|
pl2->savedY = currentSaveFile.readSint16LE();
|
||||||
|
currentSaveFile.read(pl2->name, 13);
|
||||||
currentSaveFile.skip(1);
|
currentSaveFile.skip(1);
|
||||||
current->aniX = currentSaveFile.readSint16LE();
|
pl2->spriteId = currentSaveFile.readSint16LE();
|
||||||
currentSaveFile.skip(2);
|
currentSaveFile.skip(2);
|
||||||
|
|
||||||
if (current->size) {
|
if (pl2->saveSize) {
|
||||||
current->ptr = (uint8 *) mallocAndZero(current->size);
|
/*pl2->ptr = (uint8 *) mallocAndZero(pl2->size);
|
||||||
currentSaveFile.read(current->ptr, current->size);
|
currentSaveFile.read(pl2->ptr, pl2->size);*/
|
||||||
|
|
||||||
|
currentSaveFile.skip(pl2->saveSize);
|
||||||
|
|
||||||
|
int width = pl2->saveWidth;
|
||||||
|
int height = pl2->saveHeight;
|
||||||
|
pl2->ptr = (uint8*)malloc(width * height);
|
||||||
|
memset(pl2->ptr, 0, width * height);
|
||||||
|
|
||||||
|
// TODO: convert graphic format here
|
||||||
}
|
}
|
||||||
|
|
||||||
current->next = NULL;
|
pl2->next = NULL;
|
||||||
ptr2 = current;
|
pl->next = pl2;
|
||||||
current->prev = backgroundIncrustHead.prev;
|
|
||||||
backgroundIncrustHead.prev = current;
|
pl2->prev = pl1->prev;
|
||||||
ptr2 = current->next;
|
pl1->prev = pl2;
|
||||||
|
|
||||||
|
pl = pl2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
|
void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
|
||||||
printf("Need to regenerate backgroundIncrust\n");
|
|
||||||
|
lastAni[0] = 0;
|
||||||
|
|
||||||
|
backgroundIncrustStruct* pl = pHead->next;
|
||||||
|
|
||||||
|
while(pl) {
|
||||||
|
backgroundIncrustStruct* pl2 = pl->next;
|
||||||
|
|
||||||
|
bool bLoad = false;
|
||||||
|
int frame = pl->field_E;
|
||||||
|
int screen = pl->backgroundIdx;
|
||||||
|
|
||||||
|
if((filesDatabase[frame].subData.ptr == NULL) || (strcmp(pl->name, filesDatabase[frame].subData.name))) {
|
||||||
|
frame = 257 - 1;
|
||||||
|
if(loadFile( pl->name, frame, pl->spriteId ) >= 0) {
|
||||||
|
bLoad = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frame = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( frame >= -1 )
|
||||||
|
{
|
||||||
|
if (filesDatabase[frame].subData.resourceType == 4) { // sprite
|
||||||
|
int width = filesDatabase[frame].width;
|
||||||
|
int height = filesDatabase[frame].height;
|
||||||
|
|
||||||
|
drawSprite(width, height, NULL, (char *)filesDatabase[frame].subData.ptr, pl->Y, pl->X, (char*)backgroundPtrtable[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptrMask);
|
||||||
|
} else { // poly
|
||||||
|
addBackgroundIncrustSub1(frame, pl->X, pl->Y, NULL, pl->scale, (char*)backgroundPtrtable[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pl = pl2;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastAni[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeBackgroundIncrustList(backgroundIncrustStruct *pHead) {
|
void freeBackgroundIncrustList(backgroundIncrustStruct *pHead) {
|
||||||
|
@ -223,9 +322,7 @@ void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHe
|
||||||
pCurrent = pHead->next;
|
pCurrent = pHead->next;
|
||||||
|
|
||||||
while (pCurrent) {
|
while (pCurrent) {
|
||||||
if ((pCurrent->overlayIdx == overlay || overlay == -1) &&
|
if ((pCurrent->overlayIdx == overlay || overlay == -1) && (pCurrent->objectIdx == idx || idx == -1) && (pCurrent->X == var_4) && (pCurrent->Y == var_6)) {
|
||||||
(pCurrent->objectIdx == idx || idx == -1) &&
|
|
||||||
(pCurrent->X == var_4) && (pCurrent->Y == var_6)) {
|
|
||||||
pCurrent->type = - 1;
|
pCurrent->type = - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,4 +362,32 @@ void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unmergeBackgroundIncrust(backgroundIncrustStruct * pHead, int ovl, int idx)
|
||||||
|
{
|
||||||
|
backgroundIncrustStruct *pl;
|
||||||
|
backgroundIncrustStruct *pl2;
|
||||||
|
|
||||||
|
objectParamsQuery params;
|
||||||
|
getMultipleObjectParam(ovl, idx, ¶ms);
|
||||||
|
|
||||||
|
int x = params.X;
|
||||||
|
int y = params.Y;
|
||||||
|
|
||||||
|
pl = pHead;
|
||||||
|
pl2 = pl;
|
||||||
|
pl = pl2->next;
|
||||||
|
|
||||||
|
while(pl)
|
||||||
|
{
|
||||||
|
pl2 = pl;
|
||||||
|
if((pl->overlayIdx == ovl) || (ovl == -1))
|
||||||
|
if((pl->objectIdx == idx) || (idx == -1))
|
||||||
|
if((pl->X == x) && (pl->Y == y))
|
||||||
|
restoreBackground(pl);
|
||||||
|
|
||||||
|
pl = pl2->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
|
@ -43,24 +43,24 @@ struct backgroundIncrustStruct {
|
||||||
uint16 scriptNumber;
|
uint16 scriptNumber;
|
||||||
uint16 scriptOverlayIdx;
|
uint16 scriptOverlayIdx;
|
||||||
uint8 *ptr;
|
uint8 *ptr;
|
||||||
int32 field_1C;
|
int16 saveWidth;
|
||||||
int16 size;
|
int16 saveHeight;
|
||||||
uint16 field_22;
|
uint16 saveSize;
|
||||||
uint16 field_24;
|
int16 savedX;
|
||||||
|
int16 savedY;
|
||||||
char name[13];
|
char name[13];
|
||||||
uint16 aniX;
|
uint16 spriteId;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern backgroundIncrustStruct backgroundIncrustHead;
|
extern backgroundIncrustStruct backgroundIncrustHead;
|
||||||
|
|
||||||
void resetBackgroundIncrustList(backgroundIncrustStruct * pHead);
|
void resetBackgroundIncrustList(backgroundIncrustStruct * pHead);
|
||||||
backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 param2,
|
backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 param2, backgroundIncrustStruct * pHead, int16 scriptNumber, int16 scriptOverlay, int16 backgroundIdx, int16 param4);
|
||||||
backgroundIncrustStruct * pHead, int16 scriptNumber, int16 scriptOverlay,
|
|
||||||
int16 backgroundIdx, int16 param4);
|
|
||||||
void loadBackgroundIncrustFromSave(Common::File& currentSaveFile);
|
void loadBackgroundIncrustFromSave(Common::File& currentSaveFile);
|
||||||
void regenerateBackgroundIncrust(backgroundIncrustStruct * pHead);
|
void regenerateBackgroundIncrust(backgroundIncrustStruct * pHead);
|
||||||
void freeBackgroundIncrustList(backgroundIncrustStruct * pHead);
|
void freeBackgroundIncrustList(backgroundIncrustStruct * pHead);
|
||||||
void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHead);
|
void removeBackgroundIncrust(int overlay, int idx, backgroundIncrustStruct * pHead);
|
||||||
|
void unmergeBackgroundIncrust(backgroundIncrustStruct * pHead, int ovl, int idx);
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
||||||
|
|
|
@ -130,12 +130,12 @@ void resetFileEntryRange(int param1, int param2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getProcParam(int overlayIdx, int param2, uint8 *name) {
|
int getProcParam(int overlayIdx, int param2, const char *name) {
|
||||||
int numSymbGlob;
|
int numSymbGlob;
|
||||||
int i;
|
int i;
|
||||||
exportEntryStruct *arraySymbGlob;
|
exportEntryStruct *arraySymbGlob;
|
||||||
uint8 *exportNamePtr;
|
char *exportNamePtr;
|
||||||
uint8 exportName[80];
|
char exportName[80];
|
||||||
|
|
||||||
if (!overlayTable[overlayIdx].alreadyLoaded)
|
if (!overlayTable[overlayIdx].alreadyLoaded)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -152,10 +152,9 @@ int getProcParam(int overlayIdx, int param2, uint8 *name) {
|
||||||
|
|
||||||
for (i = 0; i < numSymbGlob; i++) {
|
for (i = 0; i < numSymbGlob; i++) {
|
||||||
if (arraySymbGlob[i].var4 == param2) {
|
if (arraySymbGlob[i].var4 == param2) {
|
||||||
strcpyuint8(exportName,
|
strcpy(exportName, arraySymbGlob[i].offsetToName + exportNamePtr);
|
||||||
arraySymbGlob[i].offsetToName + exportNamePtr);
|
|
||||||
|
|
||||||
if (!strcmpuint8(exportName, name)) {
|
if (!strcmp(exportName, name)) {
|
||||||
return (arraySymbGlob[i].idx);
|
return (arraySymbGlob[i].idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,7 +329,7 @@ void removeExtention(const char *name, char *buffer) { // not like in original
|
||||||
|
|
||||||
int lastFileSize;
|
int lastFileSize;
|
||||||
|
|
||||||
int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
|
int loadFileSub1(uint8 **ptr, const char *name, uint8 *ptr2) {
|
||||||
int i;
|
int i;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int fileIdx;
|
int fileIdx;
|
||||||
|
@ -339,7 +338,7 @@ int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
|
||||||
|
|
||||||
for (i = 0; i < 64; i++) {
|
for (i = 0; i < 64; i++) {
|
||||||
if (mediumVar[i].ptr) {
|
if (mediumVar[i].ptr) {
|
||||||
if (!strcmpuint8(mediumVar[i].name, name)) {
|
if (!strcmp(mediumVar[i].name, name)) {
|
||||||
printf("Unsupported code in loadFIleSub1 !\n");
|
printf("Unsupported code in loadFIleSub1 !\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +352,7 @@ int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
|
||||||
|
|
||||||
// if (useH32)
|
// if (useH32)
|
||||||
{
|
{
|
||||||
strcatuint8(buffer, ".H32");
|
strcat(buffer, ".H32");
|
||||||
}
|
}
|
||||||
/* else
|
/* else
|
||||||
* if (useAdlib)
|
* if (useAdlib)
|
||||||
|
@ -365,10 +364,10 @@ int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
|
||||||
* strcatuint8(buffer,".HP");
|
* strcatuint8(buffer,".HP");
|
||||||
* } */
|
* } */
|
||||||
} else {
|
} else {
|
||||||
strcpyuint8(buffer, name);
|
strcpy(buffer, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileIdx = findFileInDisks((uint8 *) buffer);
|
fileIdx = findFileInDisks(buffer);
|
||||||
|
|
||||||
if (fileIdx < 0)
|
if (fileIdx < 0)
|
||||||
return (-18);
|
return (-18);
|
||||||
|
@ -478,7 +477,7 @@ int initAllData(void) {
|
||||||
resetActorPtr(&actorHead);
|
resetActorPtr(&actorHead);
|
||||||
resetBackgroundIncrustList(&backgroundIncrustHead);
|
resetBackgroundIncrustList(&backgroundIncrustHead);
|
||||||
|
|
||||||
bootOverlayNumber = loadOverlay((const uint8 *) "AUTO00");
|
bootOverlayNumber = loadOverlay("AUTO00");
|
||||||
|
|
||||||
#ifdef DUMP_SCRIPT
|
#ifdef DUMP_SCRIPT
|
||||||
loadOverlay("TITRE");
|
loadOverlay("TITRE");
|
||||||
|
@ -573,7 +572,7 @@ int initAllData(void) {
|
||||||
scriptFunc2(bootOverlayNumber, &procHead, 1, 0);
|
scriptFunc2(bootOverlayNumber, &procHead, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpyuint8(systemStrings.bootScriptName, "AUTO00");
|
strcpy(systemStrings.bootScriptName, "AUTO00");
|
||||||
|
|
||||||
return (bootOverlayNumber);
|
return (bootOverlayNumber);
|
||||||
}
|
}
|
||||||
|
@ -627,7 +626,7 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) {
|
||||||
|
|
||||||
while (currentObject) {
|
while (currentObject) {
|
||||||
if (currentObject->overlay >= 0 && overlayTable[currentObject->overlay].alreadyLoaded && (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT || currentObject->type == OBJ_TYPE_VIRTUEL)) {
|
if (currentObject->overlay >= 0 && overlayTable[currentObject->overlay].alreadyLoaded && (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT || currentObject->type == OBJ_TYPE_VIRTUEL)) {
|
||||||
char* pObjectName = getObjectName(currentObject->idx, overlayTable[currentObject->overlay].ovlData->arrayNameObj);
|
const char* pObjectName = getObjectName(currentObject->idx, overlayTable[currentObject->overlay].ovlData->arrayNameObj);
|
||||||
if (pObjectName) {
|
if (pObjectName) {
|
||||||
strcpy(objectName, pObjectName);
|
strcpy(objectName, pObjectName);
|
||||||
|
|
||||||
|
@ -764,9 +763,9 @@ void *allocAndZero(int size) {
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getObjectName(int index, uint8 *string) {
|
const char *getObjectName(int index, const char *string) {
|
||||||
int i;
|
int i;
|
||||||
char *ptr = (char *)string;
|
const char *ptr = string;
|
||||||
|
|
||||||
if (!string)
|
if (!string)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -920,7 +919,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
|
||||||
testState = ptrHead->obj1OldState;
|
testState = ptrHead->obj1OldState;
|
||||||
|
|
||||||
if ((first) && (ovl3->arrayNameObj) && ((testState ==-1) || (testState == objectState))) {
|
if ((first) && (ovl3->arrayNameObj) && ((testState ==-1) || (testState == objectState))) {
|
||||||
char *ptrName = getObjectName(ptrHead->obj1Number, ovl3->arrayNameObj);
|
const char *ptrName = getObjectName(ptrHead->obj1Number, ovl3->arrayNameObj);
|
||||||
|
|
||||||
menuTable[0] = createMenu(x, y, ptrName);
|
menuTable[0] = createMenu(x, y, ptrName);
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -928,7 +927,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
|
||||||
}
|
}
|
||||||
if ((ovl2) && (ptrHead->verbNumber>=0)) {
|
if ((ovl2) && (ptrHead->verbNumber>=0)) {
|
||||||
if (ovl2->nameVerbGlob) {
|
if (ovl2->nameVerbGlob) {
|
||||||
char *ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob);
|
const char *ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob);
|
||||||
strcpy(verbe_name, ptr);
|
strcpy(verbe_name, ptr);
|
||||||
|
|
||||||
if ( (!first) && ((testState==-1) || (testState==objectState))) {
|
if ( (!first) && ((testState==-1) || (testState==objectState))) {
|
||||||
|
@ -1478,7 +1477,7 @@ void mainLoop(void) {
|
||||||
|
|
||||||
int enableUser = 0;
|
int enableUser = 0;
|
||||||
|
|
||||||
scriptNameBuffer[0] = 0;
|
strcpy(currentOverlay, "");
|
||||||
systemStrings.bootScriptName[0] = 0;
|
systemStrings.bootScriptName[0] = 0;
|
||||||
initVar4[0] = 0;
|
initVar4[0] = 0;
|
||||||
currentActiveMenu = -1;
|
currentActiveMenu = -1;
|
||||||
|
@ -1493,7 +1492,7 @@ void mainLoop(void) {
|
||||||
initAllData();
|
initAllData();
|
||||||
|
|
||||||
// debug code: automaticaly load savegame 0 at startup
|
// debug code: automaticaly load savegame 0 at startup
|
||||||
loadSavegameData(0);
|
// loadSavegameData(0);
|
||||||
|
|
||||||
{
|
{
|
||||||
int playerDontAskQuit = 1;
|
int playerDontAskQuit = 1;
|
||||||
|
|
|
@ -91,23 +91,21 @@ void *mallocAndZero(int32 size);
|
||||||
uint8 *mainProc14(uint16 overlay, uint16 idx);
|
uint8 *mainProc14(uint16 overlay, uint16 idx);
|
||||||
void printInfoBlackBox(const char *string);
|
void printInfoBlackBox(const char *string);
|
||||||
void waitForPlayerInput(void);
|
void waitForPlayerInput(void);
|
||||||
int loadCtp(uint8 * ctpName);
|
int loadCtp(const char * ctpName);
|
||||||
void loadPakedFileToMem(int fileIdx, uint8 * buffer);
|
void loadPakedFileToMem(int fileIdx, uint8 * buffer);
|
||||||
int loadScriptSub1(int scriptIdx, int param);
|
int loadScriptSub1(int scriptIdx, int param);
|
||||||
void resetFileEntryRange(int param1, int param2);
|
void resetFileEntryRange(int param1, int param2);
|
||||||
int getProcParam(int overlayIdx, int param2, uint8 * name);
|
int getProcParam(int overlayIdx, int param2, const char * name);
|
||||||
void changeScriptParamInList(int param1, int param2,
|
void changeScriptParamInList(int param1, int param2, scriptInstanceStruct * pScriptInstance, int newValue, int param3);
|
||||||
scriptInstanceStruct * pScriptInstance, int newValue, int param3);
|
|
||||||
uint8 *getDataFromData3(ovlData3Struct * ptr, int param);
|
uint8 *getDataFromData3(ovlData3Struct * ptr, int param);
|
||||||
int32 prepareWordRender(int32 param, int32 var1, int16 * out2, uint8 * ptr3,
|
int32 prepareWordRender(int32 param, int32 var1, int16 * out2, uint8 * ptr3, const uint8 * string);
|
||||||
const uint8 * string);
|
|
||||||
void removeExtention(const char *name, char *buffer);
|
void removeExtention(const char *name, char *buffer);
|
||||||
void resetRaster(uint8 * rasterPtr, int32 rasterSize);
|
void resetRaster(uint8 * rasterPtr, int32 rasterSize);
|
||||||
void resetPtr2(scriptInstanceStruct * ptr);
|
void resetPtr2(scriptInstanceStruct * ptr);
|
||||||
void getFileExtention(const char *name, char *buffer);
|
void getFileExtention(const char *name, char *buffer);
|
||||||
void *allocAndZero(int size);
|
void *allocAndZero(int size);
|
||||||
void freeStuff2(void);
|
void freeStuff2(void);
|
||||||
char *getObjectName(int index, uint8 * string);
|
const char *getObjectName(int index, const char * string);
|
||||||
void mainLoop(void);
|
void mainLoop(void);
|
||||||
void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY);
|
void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY);
|
||||||
bool testMask(int x, int y, unsigned char* pData, int stride);
|
bool testMask(int x, int y, unsigned char* pData, int stride);
|
||||||
|
|
|
@ -289,7 +289,7 @@ int getNode(int nodeResult[2], int nodeId){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadCtp(uint8 *ctpName) {
|
int loadCtp(const char *ctpName) {
|
||||||
int walkboxCounter; // si
|
int walkboxCounter; // si
|
||||||
uint8 *ptr;
|
uint8 *ptr;
|
||||||
uint8 *dataPointer; // ptr2
|
uint8 *dataPointer; // ptr2
|
||||||
|
@ -363,7 +363,7 @@ int loadCtp(uint8 *ctpName) {
|
||||||
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
|
||||||
strcpyuint8(currentCtpName, ctpName);
|
strcpy(currentCtpName, ctpName);
|
||||||
|
|
||||||
numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes
|
numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern ctpVar19Struct *ctpVar15;
|
||||||
extern uint8 *ctpVar17;
|
extern uint8 *ctpVar17;
|
||||||
extern ctpVar19Struct *ctpVar19;
|
extern ctpVar19Struct *ctpVar19;
|
||||||
|
|
||||||
int loadCtp(uint8 * ctpName);
|
int loadCtp(const char * ctpName);
|
||||||
int ctpProc2(int varX, int varY, int paramX, int paramY);
|
int ctpProc2(int varX, int varY, int paramX, int paramY);
|
||||||
|
|
||||||
int getNode(int nodeResult[2], int nodeId);
|
int getNode(int nodeResult[2], int nodeId);
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
void loadSetEntry(uint8 * name, uint8 * ptr, int currentEntryIdx,
|
|
||||||
int currentDestEntry);
|
|
||||||
void loadFNTSub(uint8 * ptr, int destIdx);
|
|
||||||
|
|
||||||
enum fileTypeEnum {
|
enum fileTypeEnum {
|
||||||
type_UNK,
|
type_UNK,
|
||||||
type_SPL,
|
type_SPL,
|
||||||
|
@ -232,12 +228,12 @@ int createResFileEntry(int width, int height, int resType) {
|
||||||
return entryNumber;
|
return entryNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileTypeEnum getFileType(uint8 *name) {
|
fileTypeEnum getFileType(const char *name) {
|
||||||
char extentionBuffer[16];
|
char extentionBuffer[16];
|
||||||
|
|
||||||
fileTypeEnum newFileType = type_UNK;
|
fileTypeEnum newFileType = type_UNK;
|
||||||
|
|
||||||
getFileExtention((char *)name, extentionBuffer);
|
getFileExtention(name, extentionBuffer);
|
||||||
|
|
||||||
if (!strcmp(extentionBuffer, ".SPL")) {
|
if (!strcmp(extentionBuffer, ".SPL")) {
|
||||||
newFileType = type_SPL;
|
newFileType = type_SPL;
|
||||||
|
@ -259,7 +255,46 @@ int getNumMaxEntiresInSet(uint8 *ptr) {
|
||||||
return numEntries;
|
return numEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadFileMode2(uint8 *name, int startIdx, int currentEntryIdx, int numIdx) {
|
int loadFile(const char* name, int idx, int destIdx)
|
||||||
|
{
|
||||||
|
uint8 *ptr = NULL;
|
||||||
|
fileTypeEnum fileType;
|
||||||
|
|
||||||
|
fileType = getFileType(name);
|
||||||
|
|
||||||
|
loadFileSub1(&ptr, name, NULL);
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case type_SET:
|
||||||
|
{
|
||||||
|
|
||||||
|
int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr);
|
||||||
|
|
||||||
|
if (idx > numMaxEntriesInSet) {
|
||||||
|
return 0; // exit if limit is reached
|
||||||
|
}
|
||||||
|
return loadSetEntry(name, ptr, idx, destIdx );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case type_FNT:
|
||||||
|
{
|
||||||
|
return loadFNTSub(ptr, idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case type_UNK:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case type_SPL:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int loadFileRange(const char *name, int startIdx, int currentEntryIdx, int numIdx) {
|
||||||
uint8 *ptr = NULL;
|
uint8 *ptr = NULL;
|
||||||
fileTypeEnum fileType;
|
fileTypeEnum fileType;
|
||||||
|
|
||||||
|
@ -274,11 +309,10 @@ int loadFileMode2(uint8 *name, int startIdx, int currentEntryIdx, int numIdx) {
|
||||||
int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr);
|
int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr);
|
||||||
|
|
||||||
for (i = 0; i < numIdx; i++) {
|
for (i = 0; i < numIdx; i++) {
|
||||||
if ((currentEntryIdx + i) > numMaxEntriesInSet) {
|
if ((startIdx + i) > numMaxEntriesInSet) {
|
||||||
return 0; // exit if limit is reached
|
return 0; // exit if limit is reached
|
||||||
}
|
}
|
||||||
loadSetEntry(name, ptr, currentEntryIdx + i,
|
loadSetEntry(name, ptr, startIdx + i, currentEntryIdx + i );
|
||||||
startIdx + i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -300,7 +334,7 @@ int loadFileMode2(uint8 *name, int startIdx, int currentEntryIdx, int numIdx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadFullBundle(uint8 *name, int startIdx) {
|
int loadFullBundle(const char *name, int startIdx) {
|
||||||
uint8 *ptr = NULL;
|
uint8 *ptr = NULL;
|
||||||
fileTypeEnum fileType;
|
fileTypeEnum fileType;
|
||||||
|
|
||||||
|
@ -340,7 +374,7 @@ int loadFullBundle(uint8 *name, int startIdx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadFNTSub(uint8 *ptr, int destIdx) {
|
int loadFNTSub(uint8 *ptr, int destIdx) {
|
||||||
uint8 *ptr2 = ptr;
|
uint8 *ptr2 = ptr;
|
||||||
uint8 *destPtr;
|
uint8 *destPtr;
|
||||||
int fileIndex;
|
int fileIndex;
|
||||||
|
@ -384,16 +418,18 @@ void loadFNTSub(uint8 *ptr, int destIdx) {
|
||||||
currentPtr += 8;
|
currentPtr += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSetEntry(uint8 *name, uint8 *ptr, int currentEntryIdx, int currentDestEntry) {
|
int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentDestEntry) {
|
||||||
uint8 *ptr2;
|
uint8 *ptr2;
|
||||||
uint8 *ptr3;
|
uint8 *ptr3;
|
||||||
int offset;
|
int offset;
|
||||||
int sec = 0;
|
int sec = 0;
|
||||||
uint16 numIdx;
|
uint16 numIdx;
|
||||||
|
|
||||||
if (!strcmpuint8(ptr, "SEC")) {
|
if (!strcmp((char*)ptr, "SEC")) {
|
||||||
sec = 1;
|
sec = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +469,7 @@ void loadSetEntry(uint8 *name, uint8 *ptr, int currentEntryIdx, int currentDestE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileIndex < 0) {
|
if (fileIndex < 0) {
|
||||||
return; // TODO: buffer is not freed
|
return -1; // TODO: buffer is not freed
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr5 = ptr3 + localBuffer.field_0 + numIdx * 16;
|
ptr5 = ptr3 + localBuffer.field_0 + numIdx * 16;
|
||||||
|
@ -470,7 +506,7 @@ void loadSetEntry(uint8 *name, uint8 *ptr, int currentEntryIdx, int currentDestE
|
||||||
if (sec == 0) {
|
if (sec == 0) {
|
||||||
// TODO sec type 5 needs special conversion. cut out 2 bytes at every width/5 position.
|
// TODO sec type 5 needs special conversion. cut out 2 bytes at every width/5 position.
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
filesDatabase[fileIndex].subData.resourceType = 4;
|
filesDatabase[fileIndex].subData.resourceType = 4;
|
||||||
|
@ -495,7 +531,7 @@ void loadSetEntry(uint8 *name, uint8 *ptr, int currentEntryIdx, int currentDestE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpyuint8(filesDatabase[fileIndex].subData.name, name);
|
strcpy(filesDatabase[fileIndex].subData.name, name);
|
||||||
|
|
||||||
// create the mask
|
// create the mask
|
||||||
switch(localBuffer.type)
|
switch(localBuffer.type)
|
||||||
|
@ -530,7 +566,7 @@ void loadSetEntry(uint8 *name, uint8 *ptr, int currentEntryIdx, int currentDestE
|
||||||
|
|
||||||
// TODO: free
|
// TODO: free
|
||||||
|
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
|
@ -28,11 +28,13 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
int loadData(uint8 * name, int startIdx);
|
int loadFNTSub(uint8 *ptr, int destIdx);
|
||||||
int loadFileMode2(uint8 * name, int param, int startIdx, int numIdx);
|
int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentDestEntry);
|
||||||
int loadFileSub1(uint8 ** ptr, uint8 * name, uint8 * ptr2);
|
int loadFile(const char* name, int idx, int destIdx);
|
||||||
|
int loadData(const char * name, int startIdx);
|
||||||
int loadFullBundle(uint8 * name, int startIdx);
|
int loadFileRange(const char * name, int param, int startIdx, int numIdx);
|
||||||
|
int loadFileSub1(uint8 ** ptr, const char * name, uint8 * ptr2);
|
||||||
|
int loadFullBundle(const char * name, int startIdx);
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
||||||
|
|
|
@ -735,8 +735,8 @@ int decompSwapStack(void) {
|
||||||
stack1 = popDecomp();
|
stack1 = popDecomp();
|
||||||
stack2 = popDecomp();
|
stack2 = popDecomp();
|
||||||
|
|
||||||
strcpyuint8(buffer1, stack1);
|
strcpy(buffer1, stack1);
|
||||||
strcpyuint8(buffer2, stack2);
|
strcpy(buffer2, stack2);
|
||||||
|
|
||||||
pushDecomp(buffer1);
|
pushDecomp(buffer1);
|
||||||
pushDecomp(buffer2);
|
pushDecomp(buffer2);
|
||||||
|
|
|
@ -107,17 +107,17 @@ int32 getTextLineCount(int32 rightBorder_X, int32 wordSpacingWidth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadFNT(const void *fileNameChar) {
|
void loadFNT(const char *fileName) {
|
||||||
uint8 header[6];
|
uint8 header[6];
|
||||||
int32 fontSize;
|
int32 fontSize;
|
||||||
int32 data2;
|
int32 data2;
|
||||||
uint8 data3[6];
|
uint8 data3[6];
|
||||||
const uint8 *fileName = (const uint8 *)fileNameChar;
|
|
||||||
_systemFNT = NULL;
|
_systemFNT = NULL;
|
||||||
|
|
||||||
Common::File fontFileHandle;
|
Common::File fontFileHandle;
|
||||||
|
|
||||||
if (!fontFileHandle.exists((const char *)fileName)) {
|
if (!fontFileHandle.exists(fileName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void loadFNT(const void *fileNameChar) {
|
||||||
|
|
||||||
fontFileHandle.read(header, 4);
|
fontFileHandle.read(header, 4);
|
||||||
|
|
||||||
if (strcmpuint8(header, "FNT") == 0) {
|
if (strcmp((char*)header, "FNT") == 0) {
|
||||||
fontFileHandle.read(&fontSize, 4);
|
fontFileHandle.read(&fontSize, 4);
|
||||||
flipLong(&fontSize);
|
flipLong(&fontSize);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ void loadSystemFont(void) {
|
||||||
main5 = 0;
|
main5 = 0;
|
||||||
var22 = 0;
|
var22 = 0;
|
||||||
initVar2 = 0;
|
initVar2 = 0;
|
||||||
initVar3 = 0;
|
switchPal = 0;
|
||||||
currentActiveBackgroundPlane = 0;
|
currentActiveBackgroundPlane = 0;
|
||||||
|
|
||||||
//changeCursor();
|
//changeCursor();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
void loadFNT(const void *fileName);
|
void loadFNT(const char *fileName);
|
||||||
void loadSystemFont(void);
|
void loadSystemFont(void);
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
|
@ -33,34 +33,28 @@ namespace Cruise {
|
||||||
opcodeFunction opcodeTablePtr[256];
|
opcodeFunction opcodeTablePtr[256];
|
||||||
|
|
||||||
int16 Op_LoadOverlay(void) {
|
int16 Op_LoadOverlay(void) {
|
||||||
uint8 *originalScriptName;
|
char *pOverlayName;
|
||||||
uint8 scriptName[38];
|
char overlayName[38] = "";
|
||||||
int returnValue;
|
int overlayLoadResult;
|
||||||
|
|
||||||
scriptName[0] = 0;
|
pOverlayName = (char *) popPtr();
|
||||||
|
|
||||||
originalScriptName = (uint8 *) popPtr();
|
if(strlen(pOverlayName) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (originalScriptName) {
|
strcpy(overlayName, pOverlayName);
|
||||||
strcpyuint8(scriptName, originalScriptName);
|
strToUpper(overlayName);
|
||||||
}
|
|
||||||
|
|
||||||
if (!scriptName[0] || !originalScriptName) {
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
strToUpper(scriptName);
|
|
||||||
|
|
||||||
//gfxModuleData.field_84();
|
//gfxModuleData.field_84();
|
||||||
//gfxModuleData.field_84();
|
//gfxModuleData.field_84();
|
||||||
|
|
||||||
returnValue = loadOverlay(scriptName);
|
overlayLoadResult = loadOverlay(overlayName);
|
||||||
|
|
||||||
updateAllScriptsImports();
|
updateAllScriptsImports();
|
||||||
|
|
||||||
strcpyuint8(scriptNameBuffer, scriptName);
|
strcpy(currentOverlay, overlayName);
|
||||||
|
|
||||||
return (returnValue);
|
return(overlayLoadResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_strcpy(void) {
|
int16 Op_strcpy(void) {
|
||||||
|
@ -245,21 +239,17 @@ int16 Op_freeBackgroundInscrustList(void) {
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_removeBackground(void) {
|
|
||||||
int backgroundIdx = popVar();
|
|
||||||
int ovl;
|
|
||||||
|
|
||||||
ovl = popVar();
|
|
||||||
printf("Op_removeBackground: remove background %d\n", backgroundIdx);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 Op_UnmergeBackgroundIncrust(void) {
|
int16 Op_UnmergeBackgroundIncrust(void) {
|
||||||
int backgroundIdx = popVar();
|
int obj = popVar();
|
||||||
int ovl;
|
int ovl = popVar();
|
||||||
|
|
||||||
|
if (!ovl) {
|
||||||
|
ovl = currentScriptPtr->overlayNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
unmergeBackgroundIncrust(&backgroundIncrustHead, ovl, obj);
|
||||||
|
|
||||||
ovl = popVar();
|
|
||||||
printf("Op_UnmergeBackgroundIncrust: unmerge background %d\n", backgroundIdx);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,20 +277,20 @@ int16 Op_RemoveMessage(void) {
|
||||||
|
|
||||||
int16 Op_isFileLoaded(void) {
|
int16 Op_isFileLoaded(void) {
|
||||||
int16 i;
|
int16 i;
|
||||||
uint8 name[36] = "";
|
char name[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *) popPtr();
|
||||||
|
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpyuint8(name, ptr);
|
strcpy(name, ptr);
|
||||||
strToUpper(name);
|
strToUpper(name);
|
||||||
|
|
||||||
for (i = 0; i < 257; i++) {
|
for (i = 0; i < 257; i++) {
|
||||||
if (!strcmpuint8(name, filesDatabase[i].subData.name)) {
|
if (!strcmp(name, filesDatabase[i].subData.name)) {
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,12 +337,12 @@ int16 Op_RemoveProc(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_FreeOverlay(void) {
|
int16 Op_FreeOverlay(void) {
|
||||||
uint8 localName[36] = "";
|
char localName[36] = "";
|
||||||
uint8 *namePtr;
|
char *namePtr;
|
||||||
|
|
||||||
namePtr = (uint8 *) popPtr();
|
namePtr = (char *) popPtr();
|
||||||
|
|
||||||
strcpyuint8(localName, namePtr);
|
strcpy(localName, namePtr);
|
||||||
|
|
||||||
if (localName[0]) {
|
if (localName[0]) {
|
||||||
strToUpper(localName);
|
strToUpper(localName);
|
||||||
|
@ -363,13 +353,13 @@ int16 Op_FreeOverlay(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_2B(void) {
|
int16 Op_2B(void) {
|
||||||
uint8 name[36] = "";
|
char name[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
int param;
|
int param;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *)popPtr();
|
||||||
|
|
||||||
strcpyuint8(name, ptr);
|
strcpy(name, ptr);
|
||||||
|
|
||||||
param = getProcParam(popVar(), 20, name);
|
param = getProcParam(popVar(), 20, name);
|
||||||
|
|
||||||
|
@ -424,13 +414,13 @@ int16 Op_62(void) {
|
||||||
|
|
||||||
int16 Op_LoadBackground(void) {
|
int16 Op_LoadBackground(void) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
uint8 bgName[36] = "";
|
char bgName[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
int bgIdx;
|
int bgIdx;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *) popPtr();
|
||||||
|
|
||||||
strcpyuint8(bgName, ptr);
|
strcpy(bgName, ptr);
|
||||||
|
|
||||||
bgIdx = popVar();
|
bgIdx = popVar();
|
||||||
|
|
||||||
|
@ -440,7 +430,7 @@ int16 Op_LoadBackground(void) {
|
||||||
gfxModuleData_gfxWaitVSync();
|
gfxModuleData_gfxWaitVSync();
|
||||||
gfxModuleData_gfxWaitVSync();
|
gfxModuleData_gfxWaitVSync();
|
||||||
|
|
||||||
result = loadBackground((char *)bgName, bgIdx);
|
result = loadBackground(bgName, bgIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCursor(CURSOR_NORMAL);
|
changeCursor(CURSOR_NORMAL);
|
||||||
|
@ -468,12 +458,12 @@ int16 Op_loadFile(void) {
|
||||||
int param1;
|
int param1;
|
||||||
int param2;
|
int param2;
|
||||||
int param3;
|
int param3;
|
||||||
uint8 name[36] = "";
|
char name[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *) popPtr();
|
||||||
|
|
||||||
strcpyuint8(name, ptr);
|
strcpy(name, ptr);
|
||||||
|
|
||||||
param1 = popVar();
|
param1 = popVar();
|
||||||
param2 = popVar();
|
param2 = popVar();
|
||||||
|
@ -485,11 +475,11 @@ int16 Op_loadFile(void) {
|
||||||
gfxModuleData_gfxWaitVSync();
|
gfxModuleData_gfxWaitVSync();
|
||||||
gfxModuleData_gfxWaitVSync();
|
gfxModuleData_gfxWaitVSync();
|
||||||
|
|
||||||
saveVar6[0] = 0;
|
lastAni[0] = 0;
|
||||||
|
|
||||||
loadFileMode2(name, param3, param2, param1);
|
loadFileRange(name, param2, param3, param1);
|
||||||
|
|
||||||
saveVar6[0] = 0;
|
lastAni[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCursor(CURSOR_NORMAL);
|
changeCursor(CURSOR_NORMAL);
|
||||||
|
@ -500,13 +490,13 @@ int16 Op_LoadAbs(void) {
|
||||||
int param1;
|
int param1;
|
||||||
// int param2;
|
// int param2;
|
||||||
// int param3;
|
// int param3;
|
||||||
uint8 name[36] = "";
|
char name[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *) popPtr();
|
||||||
|
|
||||||
strcpyuint8(name, ptr);
|
strcpy(name, ptr);
|
||||||
|
|
||||||
param1 = popVar();
|
param1 = popVar();
|
||||||
|
|
||||||
|
@ -545,12 +535,11 @@ int16 Op_FadeOut(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 isOverlayLoaded(uint8 * name) {
|
int16 isOverlayLoaded(const char * name) {
|
||||||
int16 i;
|
int16 i;
|
||||||
|
|
||||||
for (i = 1; i < numOfLoadedOverlay; i++) {
|
for (i = 1; i < numOfLoadedOverlay; i++) {
|
||||||
if (!strcmpuint8(overlayTable[i].overlayName, name)
|
if (!strcmp(overlayTable[i].overlayName, name) && overlayTable[i].alreadyLoaded) {
|
||||||
&& overlayTable[i].alreadyLoaded) {
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,12 +548,12 @@ int16 isOverlayLoaded(uint8 * name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_FindOverlay(void) {
|
int16 Op_FindOverlay(void) {
|
||||||
uint8 name[36] = "";
|
char name[36] = "";
|
||||||
uint8 *ptr;
|
char *ptr;
|
||||||
|
|
||||||
ptr = (uint8 *) popPtr();
|
ptr = (char *) popPtr();
|
||||||
|
|
||||||
strcpyuint8(name, ptr);
|
strcpy(name, ptr);
|
||||||
strToUpper(name);
|
strToUpper(name);
|
||||||
|
|
||||||
return (isOverlayLoaded(name));
|
return (isOverlayLoaded(name));
|
||||||
|
@ -706,7 +695,7 @@ int16 Op_loadAudioResource(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_LoadCt(void) {
|
int16 Op_LoadCt(void) {
|
||||||
return loadCtp((uint8 *) popPtr());
|
return loadCtp((char*)popPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_loadMusic(void) {
|
int16 Op_loadMusic(void) {
|
||||||
|
@ -807,13 +796,33 @@ int16 Op_SetActiveBackgroundPlane(void) {
|
||||||
if (newPlane >= 0 && newPlane < 8) {
|
if (newPlane >= 0 && newPlane < 8) {
|
||||||
if (backgroundPtrtable[newPlane]) {
|
if (backgroundPtrtable[newPlane]) {
|
||||||
currentActiveBackgroundPlane = newPlane;
|
currentActiveBackgroundPlane = newPlane;
|
||||||
initVar3 = 1;
|
switchPal = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentPlane;
|
return currentPlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16 Op_removeBackground(void) {
|
||||||
|
int backgroundIdx = popVar();
|
||||||
|
|
||||||
|
if(backgroundIdx > 0 && backgroundIdx < 8) {
|
||||||
|
if(backgroundPtrtable[backgroundIdx])
|
||||||
|
free(backgroundPtrtable[backgroundIdx]);
|
||||||
|
|
||||||
|
if(currentActiveBackgroundPlane == backgroundIdx)
|
||||||
|
currentActiveBackgroundPlane = 0;
|
||||||
|
|
||||||
|
strcpy(backgroundTable[backgroundIdx].name, "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(backgroundTable[0].name, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
int op6AVar;
|
int op6AVar;
|
||||||
|
|
||||||
int16 Op_6A(void) {
|
int16 Op_6A(void) {
|
||||||
|
@ -1376,7 +1385,7 @@ int16 Op_InitializeState2(void) {
|
||||||
if (!var1)
|
if (!var1)
|
||||||
var1 = currentScriptPtr->overlayNumber;
|
var1 = currentScriptPtr->overlayNumber;
|
||||||
|
|
||||||
return getProcParam(var1, var0, (uint8 *) ptr);
|
return getProcParam(var1, var0, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_2A(void) {
|
int16 Op_2A(void) {
|
||||||
|
@ -1395,7 +1404,7 @@ int16 Op_2A(void) {
|
||||||
if (!overlayIdx)
|
if (!overlayIdx)
|
||||||
overlayIdx = currentScriptPtr->overlayNumber;
|
overlayIdx = currentScriptPtr->overlayNumber;
|
||||||
|
|
||||||
return getProcParam(overlayIdx, 40, (uint8 *) var_26);
|
return getProcParam(overlayIdx, 40, var_26);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Op_SetObjectAtNode(void) {
|
int16 Op_SetObjectAtNode(void) {
|
||||||
|
|
|
@ -27,34 +27,33 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
exportEntryStruct *parseExport(int *out1, int *pExportedFuncionIdx,
|
exportEntryStruct *parseExport(int *out1, int *pExportedFuncionIdx, char *buffer) {
|
||||||
char *buffer) {
|
|
||||||
char localBuffer[256];
|
char localBuffer[256];
|
||||||
uint8 functionName[256];
|
char functionName[256];
|
||||||
uint8 overlayName[256];
|
char overlayName[256];
|
||||||
char *dotPtr;
|
char *dotPtr;
|
||||||
char *ptr2;
|
char *ptr2;
|
||||||
int idx;
|
int idx;
|
||||||
int numSymbGlob;
|
int numSymbGlob;
|
||||||
exportEntryStruct *currentExportEntry;
|
exportEntryStruct *currentExportEntry;
|
||||||
uint8 *entity1Name;
|
char *entity1Name;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*out1 = 0;
|
*out1 = 0;
|
||||||
*pExportedFuncionIdx = 0;
|
*pExportedFuncionIdx = 0;
|
||||||
|
|
||||||
strcpyuint8(localBuffer, buffer);
|
strcpy(localBuffer, buffer);
|
||||||
dotPtr = strchr(localBuffer, '.');
|
dotPtr = strchr(localBuffer, '.');
|
||||||
|
|
||||||
if (dotPtr) {
|
if (dotPtr) {
|
||||||
strcpyuint8(functionName, dotPtr + 1);
|
strcpy(functionName, dotPtr + 1);
|
||||||
*dotPtr = 0;
|
*dotPtr = 0;
|
||||||
|
|
||||||
strcpyuint8(overlayName, localBuffer);
|
strcpy(overlayName, localBuffer);
|
||||||
} else {
|
} else {
|
||||||
overlayName[0] = 0;
|
overlayName[0] = 0;
|
||||||
|
|
||||||
strcpyuint8(functionName, buffer);
|
strcpy(functionName, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr2 = strchr((char *)functionName, ':');
|
ptr2 = strchr((char *)functionName, ':');
|
||||||
|
@ -89,13 +88,13 @@ exportEntryStruct *parseExport(int *out1, int *pExportedFuncionIdx,
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
for (i = 0; i < numSymbGlob; i++) {
|
for (i = 0; i < numSymbGlob; i++) {
|
||||||
uint8 exportedName[256];
|
char exportedName[256];
|
||||||
uint8 *name = entity1Name + currentExportEntry->offsetToName;
|
char *name = entity1Name + currentExportEntry->offsetToName;
|
||||||
|
|
||||||
strcpyuint8(exportedName, name);
|
strcpy(exportedName, name);
|
||||||
strToUpper(exportedName);
|
strToUpper(exportedName);
|
||||||
|
|
||||||
if (!strcmpuint8(functionName, exportedName)) {
|
if (!strcmp(functionName, exportedName)) {
|
||||||
*pExportedFuncionIdx = idx;
|
*pExportedFuncionIdx = idx;
|
||||||
|
|
||||||
return (currentExportEntry);
|
return (currentExportEntry);
|
||||||
|
@ -144,7 +143,7 @@ int updateScriptImport(int ovlIdx) {
|
||||||
if (var_32) {
|
if (var_32) {
|
||||||
do {
|
do {
|
||||||
importScriptStruct *ptrImportData;
|
importScriptStruct *ptrImportData;
|
||||||
uint8 *ptrImportName;
|
const char *ptrImportName;
|
||||||
uint8 *ptrData;
|
uint8 *ptrData;
|
||||||
|
|
||||||
int var_22 = 0;
|
int var_22 = 0;
|
||||||
|
@ -156,7 +155,7 @@ int updateScriptImport(int ovlIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrImportData = (importScriptStruct *) (pScript->dataPtr + pScript->offsetToImportData); // import data
|
ptrImportData = (importScriptStruct *) (pScript->dataPtr + pScript->offsetToImportData); // import data
|
||||||
ptrImportName = pScript->dataPtr + pScript->offsetToImportName; // import name
|
ptrImportName = (const char*)(pScript->dataPtr + pScript->offsetToImportName); // import name
|
||||||
ptrData = pScript->dataPtr;
|
ptrData = pScript->dataPtr;
|
||||||
|
|
||||||
var_22 = 0;
|
var_22 = 0;
|
||||||
|
@ -165,22 +164,15 @@ int updateScriptImport(int ovlIdx) {
|
||||||
int counter = pScript->numRelocGlob;
|
int counter = pScript->numRelocGlob;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int param2 =
|
int param2 = ptrImportData->type;
|
||||||
ptrImportData->type;
|
|
||||||
|
|
||||||
if (param2 != 70) {
|
if (param2 != 70) {
|
||||||
exportEntryStruct
|
exportEntryStruct * ptrDest2;
|
||||||
* ptrDest2;
|
|
||||||
int out1;
|
int out1;
|
||||||
int out2;
|
int out2;
|
||||||
|
|
||||||
strcpyuint8(buffer,
|
strcpy(buffer, ptrImportName + ptrImportData->offsetToName);
|
||||||
ptrImportName +
|
ptrDest2 = parseExport(&out1, &out2, buffer);
|
||||||
ptrImportData->
|
|
||||||
offsetToName);
|
|
||||||
ptrDest2 =
|
|
||||||
parseExport(&out1,
|
|
||||||
&out2, buffer);
|
|
||||||
|
|
||||||
if (ptrDest2 && out2) {
|
if (ptrDest2 && out2) {
|
||||||
int temp =
|
int temp =
|
||||||
|
@ -258,7 +250,7 @@ int updateScriptImport(int ovlIdx) {
|
||||||
int linkType;
|
int linkType;
|
||||||
int linkEntryIdx;
|
int linkEntryIdx;
|
||||||
|
|
||||||
strcpyuint8(buffer,
|
strcpy(buffer,
|
||||||
ovlData->arrayNameRelocGlob +
|
ovlData->arrayNameRelocGlob +
|
||||||
ovlData->arrayRelocGlob[i].nameOffset);
|
ovlData->arrayRelocGlob[i].nameOffset);
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,10 @@ int upscaleValue(int value, int scale);
|
||||||
void pixel(int x, int y, char color);
|
void pixel(int x, int y, char color);
|
||||||
void mainDraw(int16 param);
|
void mainDraw(int16 param);
|
||||||
void flipScreen(void);
|
void flipScreen(void);
|
||||||
void buildPolyModel(int X, int Y, int scale, char *ptr2, char *destBuffer,
|
void buildPolyModel(int X, int Y, int scale, char *ptr2, char *destBuffer, char *dataPtr);
|
||||||
char *dataPtr);
|
void drawSprite(int objX1, int var_6, cellStruct * currentObjPtr, char *data1, int objY2, int objX2, char *output, char *data2);
|
||||||
void drawSprite(int objX1, int var_6, cellStruct * currentObjPtr,
|
void flipPoly(int fileId, int16 *dataPtr, int scale, char** newFrame, int X, int Y, int *outX, int *outY, int *outScale);
|
||||||
char *data1, int objY2, int objX2, char *output, char *data2);
|
void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsigned char *dataPtr);
|
||||||
|
|
||||||
bool findPoly(char* dataPtr, int x, int y, int zoom, int mouseX, int mouseY);
|
bool findPoly(char* dataPtr, int x, int y, int zoom, int mouseX, int mouseY);
|
||||||
unsigned char *drawPolyMode2(unsigned char *dataPointer, int linesToDraw);
|
unsigned char *drawPolyMode2(unsigned char *dataPointer, int linesToDraw);
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
|
@ -43,11 +43,11 @@ void initOverlayTable(void) {
|
||||||
numOfLoadedOverlay = 1;
|
numOfLoadedOverlay = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadOverlay(const uint8 *scriptName) {
|
int loadOverlay(const char *scriptName) {
|
||||||
int newNumberOfScript;
|
int newNumberOfScript;
|
||||||
bool scriptNotLoadedBefore;
|
bool scriptNotLoadedBefore;
|
||||||
int scriptIdx;
|
int scriptIdx;
|
||||||
uint8 fileName[50];
|
char fileName[50];
|
||||||
int fileIdx;
|
int fileIdx;
|
||||||
int unpackedSize;
|
int unpackedSize;
|
||||||
char *unpackedBuffer;
|
char *unpackedBuffer;
|
||||||
|
@ -80,7 +80,7 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
if (!overlayTable[scriptIdx].ovlData)
|
if (!overlayTable[scriptIdx].ovlData)
|
||||||
return (-2);
|
return (-2);
|
||||||
|
|
||||||
strcpyuint8(overlayTable[scriptIdx].overlayName, scriptName);
|
strcpy(overlayTable[scriptIdx].overlayName, scriptName);
|
||||||
|
|
||||||
overlayTable[scriptIdx].alreadyLoaded = 1;
|
overlayTable[scriptIdx].alreadyLoaded = 1;
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
|
|
||||||
overlayTable[scriptIdx].ovlData->scriptNumber = scriptIdx;
|
overlayTable[scriptIdx].ovlData->scriptNumber = scriptIdx;
|
||||||
|
|
||||||
strcpyuint8(fileName, scriptName);
|
strcpy(fileName, scriptName);
|
||||||
|
|
||||||
strcatuint8(fileName, ".OVL");
|
strcat(fileName, ".OVL");
|
||||||
|
|
||||||
printf("Attempting to load overlay file %s...\n", fileName);
|
printf("Attempting to load overlay file %s...\n", fileName);
|
||||||
|
|
||||||
|
@ -192,15 +192,13 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ovlData->exportNamesSize) { // export names
|
if (ovlData->exportNamesSize) { // export names
|
||||||
ovlData->arrayNameSymbGlob =
|
ovlData->arrayNameSymbGlob = (char *) mallocAndZero(ovlData->exportNamesSize);
|
||||||
(uint8 *) mallocAndZero(ovlData->exportNamesSize);
|
|
||||||
|
|
||||||
if (!ovlData->arrayNameSymbGlob) {
|
if (!ovlData->arrayNameSymbGlob) {
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(ovlData->arrayNameSymbGlob, scriptPtr,
|
memcpy(ovlData->arrayNameSymbGlob, scriptPtr, ovlData->exportNamesSize);
|
||||||
ovlData->exportNamesSize);
|
|
||||||
scriptPtr += ovlData->exportNamesSize;
|
scriptPtr += ovlData->exportNamesSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,8 +229,7 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ovlData->nameExportSize) { // import name
|
if (ovlData->nameExportSize) { // import name
|
||||||
ovlData->arrayNameRelocGlob =
|
ovlData->arrayNameRelocGlob = (char *) mallocAndZero(ovlData->nameExportSize);
|
||||||
(uint8 *) mallocAndZero(ovlData->nameExportSize);
|
|
||||||
|
|
||||||
if (!ovlData->arrayNameRelocGlob) {
|
if (!ovlData->arrayNameRelocGlob) {
|
||||||
return (-2);
|
return (-2);
|
||||||
|
@ -521,9 +518,9 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
//uint8 fileName[50];
|
//uint8 fileName[50];
|
||||||
//char* unpackedBuffer;
|
//char* unpackedBuffer;
|
||||||
|
|
||||||
strcpyuint8(fileName, scriptName);
|
strcpy(fileName, scriptName);
|
||||||
|
|
||||||
strcatuint8(fileName, ".FR");
|
strcat(fileName, ".FR");
|
||||||
|
|
||||||
fileIdx = findFileInDisks(fileName);
|
fileIdx = findFileInDisks(fileName);
|
||||||
|
|
||||||
|
@ -564,9 +561,7 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
flipShort(&ovlData->specialString1Length); // recheck if needed
|
flipShort(&ovlData->specialString1Length); // recheck if needed
|
||||||
|
|
||||||
if (ovlData->specialString1Length) {
|
if (ovlData->specialString1Length) {
|
||||||
ovlData->nameVerbGlob =
|
ovlData->nameVerbGlob = (char *) mallocAndZero(ovlData->specialString1Length);
|
||||||
(uint8 *) mallocAndZero(ovlData->
|
|
||||||
specialString1Length);
|
|
||||||
|
|
||||||
if (!ovlData->nameVerbGlob) {
|
if (!ovlData->nameVerbGlob) {
|
||||||
/* releaseScript(scriptIdx,scriptName);
|
/* releaseScript(scriptIdx,scriptName);
|
||||||
|
@ -589,9 +584,7 @@ int loadOverlay(const uint8 *scriptName) {
|
||||||
flipShort(&ovlData->specialString2Length); // recheck if needed
|
flipShort(&ovlData->specialString2Length); // recheck if needed
|
||||||
|
|
||||||
if (ovlData->specialString2Length) {
|
if (ovlData->specialString2Length) {
|
||||||
ovlData->arrayNameObj =
|
ovlData->arrayNameObj = (char *) mallocAndZero(ovlData->specialString2Length);
|
||||||
(uint8 *) mallocAndZero(ovlData->
|
|
||||||
specialString2Length);
|
|
||||||
|
|
||||||
if (!ovlData->arrayNameObj) {
|
if (!ovlData->arrayNameObj) {
|
||||||
/* releaseScript(scriptIdx,scriptName);
|
/* releaseScript(scriptIdx,scriptName);
|
||||||
|
@ -717,11 +710,11 @@ int releaseOverlay(const char *name) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 findOverlayByName2(const uint8 *name) {
|
int32 findOverlayByName2(const char *name) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i < numOfLoadedOverlay; i++) {
|
for (i = 1; i < numOfLoadedOverlay; i++) {
|
||||||
if (!strcmpuint8(overlayTable[i].overlayName, name))
|
if (!strcmp(overlayTable[i].overlayName, name))
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,10 +135,10 @@ struct ovlDataStruct {
|
||||||
importDataStruct *arrayRelocGlob;
|
importDataStruct *arrayRelocGlob;
|
||||||
linkDataStruct *arrayMsgRelHeader;
|
linkDataStruct *arrayMsgRelHeader;
|
||||||
|
|
||||||
uint8 *nameVerbGlob;
|
char *nameVerbGlob;
|
||||||
uint8 *arrayNameObj;
|
char *arrayNameObj;
|
||||||
uint8 *arrayNameRelocGlob;
|
char *arrayNameRelocGlob;
|
||||||
uint8 *arrayNameSymbGlob;
|
char *arrayNameSymbGlob;
|
||||||
|
|
||||||
uint8 *data4Ptr;
|
uint8 *data4Ptr;
|
||||||
uint8 *ptr8;
|
uint8 *ptr8;
|
||||||
|
@ -178,8 +178,8 @@ extern overlayStruct overlayTable[90];
|
||||||
extern int numOfLoadedOverlay;
|
extern int numOfLoadedOverlay;
|
||||||
|
|
||||||
void initOverlayTable(void);
|
void initOverlayTable(void);
|
||||||
int loadOverlay(const uint8 * scriptName);
|
int loadOverlay(const char * scriptName);
|
||||||
int32 findOverlayByName2(const uint8 * name);
|
int32 findOverlayByName2(const char * name);
|
||||||
int findOverlayByName(const char *overlayName);
|
int findOverlayByName(const char *overlayName);
|
||||||
int releaseOverlay(const char *name);
|
int releaseOverlay(const char *name);
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
animationStart = false;
|
animationStart = false;
|
||||||
|
|
||||||
currentActiveBackgroundPlane = currentSaveFile.readSint16LE();
|
currentActiveBackgroundPlane = currentSaveFile.readSint16LE();
|
||||||
initVar3 = currentSaveFile.readSint16LE();
|
switchPal = currentSaveFile.readSint16LE();
|
||||||
initVar2 = currentSaveFile.readSint16LE();
|
initVar2 = currentSaveFile.readSint16LE();
|
||||||
var22 = currentSaveFile.readSint16LE();
|
var22 = currentSaveFile.readSint16LE();
|
||||||
main5 = currentSaveFile.readSint16LE();
|
main5 = currentSaveFile.readSint16LE();
|
||||||
|
@ -350,7 +350,7 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
for (int j = 1; j < numOfLoadedOverlay; j++) {
|
for (int j = 1; j < numOfLoadedOverlay; j++) {
|
||||||
if (overlayTable[j].alreadyLoaded) {
|
if (overlayTable[j].alreadyLoaded) {
|
||||||
overlayTable[j].alreadyLoaded = 0;
|
overlayTable[j].alreadyLoaded = 0;
|
||||||
loadOverlay((uint8 *) overlayTable[j].overlayName);
|
loadOverlay(overlayTable[j].overlayName);
|
||||||
|
|
||||||
if (overlayTable[j].alreadyLoaded) {
|
if (overlayTable[j].alreadyLoaded) {
|
||||||
ovlDataStruct *ovlData = overlayTable[j].ovlData;
|
ovlDataStruct *ovlData = overlayTable[j].ovlData;
|
||||||
|
@ -379,26 +379,18 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
|
|
||||||
updateAllScriptsImports();
|
updateAllScriptsImports();
|
||||||
|
|
||||||
saveVar6[0] = 0;
|
lastAni[0] = 0;
|
||||||
|
|
||||||
initVar1Save = initVar1;
|
initVar1Save = initVar1;
|
||||||
|
|
||||||
for (int j = 0; j < 257; j++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
if (filesDatabase[j].subData.ptr) {
|
if (filesDatabase[i].subData.ptr) {
|
||||||
int i;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
for (i = j + 1; i < 257; i++) {
|
for (j = i + 1; j < 257 && filesDatabase[j].subData.ptr && !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) && (filesDatabase[j].subData.index == (j-i)); j++);
|
||||||
if (filesDatabase[i].subData.ptr) {
|
|
||||||
if (strcmpuint8(filesDatabase[j].subData.name, filesDatabase[i].subData.name)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (k = j; k < i; k++) {
|
for (k = i; k < j; k++) {
|
||||||
if (filesDatabase[k].subData.ptrMask)
|
if (filesDatabase[k].subData.ptrMask)
|
||||||
initVar1 = 0;
|
initVar1 = 0;
|
||||||
|
|
||||||
|
@ -406,27 +398,26 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
filesDatabase[k].subData.ptrMask = NULL;
|
filesDatabase[k].subData.ptrMask = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < 2) {
|
if (j < 2) {
|
||||||
printf("Unsupported mono file load!\n");
|
printf("Unsupported mono file load!\n");
|
||||||
exit(1);
|
ASSERT(0);
|
||||||
//loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4);
|
//loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4);
|
||||||
} else {
|
} else {
|
||||||
loadFileMode2((uint8 *) filesDatabase[j].subData.name, filesDatabase[j].subData.index, j, i - j);
|
loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i);
|
||||||
j = i - 1;
|
i = j - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
initVar1 = initVar1Save;
|
initVar1 = initVar1Save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveVar6[0] = 0;
|
lastAni[0] = 0;
|
||||||
|
|
||||||
currentcellHead = cellHead.next;
|
currentcellHead = cellHead.next;
|
||||||
|
|
||||||
while (currentcellHead) {
|
while (currentcellHead) {
|
||||||
if (currentcellHead->type == 5) {
|
if (currentcellHead->type == 5) {
|
||||||
uint8 *ptr = mainProc14(currentcellHead->overlay,
|
uint8 *ptr = mainProc14(currentcellHead->overlay, currentcellHead->idx);
|
||||||
currentcellHead->idx);
|
|
||||||
|
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
|
|
||||||
|
@ -434,6 +425,7 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
//*(int16*)(currentcellHead->datas+0x2E) = getSprite(ptr,*(int16*)(currentcellHead->datas+0xE));
|
//*(int16*)(currentcellHead->datas+0x2E) = getSprite(ptr,*(int16*)(currentcellHead->datas+0xE));
|
||||||
} else {
|
} else {
|
||||||
|
ASSERT(0);
|
||||||
//*(int16*)(currentcellHead->datas+0x2E) = 0;
|
//*(int16*)(currentcellHead->datas+0x2E) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,7 +435,7 @@ int loadSavegameData(int saveGameIdx) {
|
||||||
|
|
||||||
//TODO: here, restart music
|
//TODO: here, restart music
|
||||||
|
|
||||||
if (strlen((char *)currentCtpName)) {
|
if (strlen(currentCtpName)) {
|
||||||
ctpVar1 = 1;
|
ctpVar1 = 1;
|
||||||
loadCtp(currentCtpName);
|
loadCtp(currentCtpName);
|
||||||
ctpVar1 = 0;
|
ctpVar1 = 0;
|
||||||
|
|
|
@ -27,16 +27,4 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
void strcpyuint8(void *dest, const void *source) {
|
|
||||||
strcpy((char *)dest, (const char *)source);
|
|
||||||
}
|
|
||||||
|
|
||||||
void strcatuint8(void *dest, const void *source) {
|
|
||||||
strcat((char *)dest, (const char *)source);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8 strcmpuint8(const void *string1, const void *string2) {
|
|
||||||
return strcmp((const char *)string1, (const char *)string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
|
@ -28,12 +28,6 @@
|
||||||
|
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
// TODO: Get rid of these and this file (either use strcpy directly, or switch to Common::String)
|
|
||||||
|
|
||||||
void strcpyuint8(void *dest, const void *source);
|
|
||||||
void strcatuint8(void *dest, const void *source);
|
|
||||||
uint8 strcmpuint8(const void *string1, const void *string2);
|
|
||||||
|
|
||||||
} // End of namespace Cruise
|
} // End of namespace Cruise
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,7 +36,7 @@ uint8 colorOfSelectedSaveDrive = 5;
|
||||||
|
|
||||||
int16 initVar1;
|
int16 initVar1;
|
||||||
int16 initVar2;
|
int16 initVar2;
|
||||||
int16 initVar3;
|
int16 switchPal;
|
||||||
uint8 initVar4[90];
|
uint8 initVar4[90];
|
||||||
|
|
||||||
int16 currentActiveBackgroundPlane;
|
int16 currentActiveBackgroundPlane;
|
||||||
|
@ -54,7 +54,7 @@ int32 volumeDataLoaded = 0;
|
||||||
|
|
||||||
int16 numOfDisks;
|
int16 numOfDisks;
|
||||||
|
|
||||||
uint8 scriptNameBuffer[15];
|
char currentOverlay[15];
|
||||||
int16 currentActiveMenu;
|
int16 currentActiveMenu;
|
||||||
int16 autoMsg;
|
int16 autoMsg;
|
||||||
menuElementSubStruct* linkedRelation;
|
menuElementSubStruct* linkedRelation;
|
||||||
|
@ -147,7 +147,7 @@ int16 palette[256 * 3];
|
||||||
|
|
||||||
systemStringsStruct systemStrings;
|
systemStringsStruct systemStrings;
|
||||||
|
|
||||||
uint8 currentCtpName[40];
|
char currentCtpName[40];
|
||||||
|
|
||||||
int16 saveVar1;
|
int16 saveVar1;
|
||||||
uint8 saveVar2[97]; // recheck size
|
uint8 saveVar2[97]; // recheck size
|
||||||
|
@ -156,7 +156,7 @@ int16 numberOfWalkboxes; // saveVar3
|
||||||
int16 walkboxType[15]; // saveVar4
|
int16 walkboxType[15]; // saveVar4
|
||||||
int16 walkboxChange[15]; // saveVar5
|
int16 walkboxChange[15]; // saveVar5
|
||||||
|
|
||||||
uint8 saveVar6[16];
|
uint8 lastAni[16];
|
||||||
|
|
||||||
int32 loadFileVar1;
|
int32 loadFileVar1;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ extern uint8 colorOfSelectedSaveDrive;
|
||||||
|
|
||||||
extern int16 initVar1;
|
extern int16 initVar1;
|
||||||
extern int16 initVar2;
|
extern int16 initVar2;
|
||||||
extern int16 initVar3;
|
extern int16 switchPal;
|
||||||
extern uint8 initVar4[90];
|
extern uint8 initVar4[90];
|
||||||
|
|
||||||
extern int16 currentActiveBackgroundPlane;
|
extern int16 currentActiveBackgroundPlane;
|
||||||
|
@ -69,7 +69,7 @@ extern int16 main5;
|
||||||
extern int16 var22;
|
extern int16 var22;
|
||||||
|
|
||||||
struct mediumVarStruct {
|
struct mediumVarStruct {
|
||||||
uint8 name[15];
|
char name[15];
|
||||||
int32 size;
|
int32 size;
|
||||||
int32 sourceSize;
|
int32 sourceSize;
|
||||||
uint8 *ptr;
|
uint8 *ptr;
|
||||||
|
@ -89,7 +89,7 @@ struct filesData2Struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fileName {
|
struct fileName {
|
||||||
uint8 name[13];
|
char name[13];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct setHeaderEntry {
|
struct setHeaderEntry {
|
||||||
|
@ -111,7 +111,7 @@ struct volumeDataStruct {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fileEntry {
|
struct fileEntry {
|
||||||
uint8 name[14];
|
char name[14];
|
||||||
int32 offset;
|
int32 offset;
|
||||||
int32 size;
|
int32 size;
|
||||||
int32 extSize;
|
int32 extSize;
|
||||||
|
@ -138,8 +138,8 @@ struct dataFileEntry {
|
||||||
|
|
||||||
struct systemStringsStruct {
|
struct systemStringsStruct {
|
||||||
int8 param;
|
int8 param;
|
||||||
uint8 string[12];
|
char string[12];
|
||||||
uint8 bootScriptName[8];
|
char bootScriptName[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern filesDataStruct filesData[90];
|
extern filesDataStruct filesData[90];
|
||||||
|
@ -153,7 +153,7 @@ extern int32 volumeDataLoaded;
|
||||||
|
|
||||||
extern int16 numOfDisks;
|
extern int16 numOfDisks;
|
||||||
|
|
||||||
extern uint8 scriptNameBuffer[15];
|
extern char currentOverlay[15];
|
||||||
extern int16 currentActiveMenu;
|
extern int16 currentActiveMenu;
|
||||||
extern int16 autoMsg;
|
extern int16 autoMsg;
|
||||||
extern menuElementSubStruct* linkedRelation;
|
extern menuElementSubStruct* linkedRelation;
|
||||||
|
@ -244,7 +244,7 @@ extern int16 palette[256 * 3];
|
||||||
|
|
||||||
extern systemStringsStruct systemStrings;
|
extern systemStringsStruct systemStrings;
|
||||||
|
|
||||||
extern uint8 currentCtpName[40];
|
extern char currentCtpName[40];
|
||||||
|
|
||||||
extern int16 saveVar1;
|
extern int16 saveVar1;
|
||||||
extern uint8 saveVar2[97]; // recheck size
|
extern uint8 saveVar2[97]; // recheck size
|
||||||
|
@ -253,7 +253,7 @@ extern int16 numberOfWalkboxes; // saveVar3
|
||||||
extern int16 walkboxType[15]; // saveVar4 // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone
|
extern int16 walkboxType[15]; // saveVar4 // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone
|
||||||
extern int16 walkboxChange[15]; // saveVar5 // walkbox can change its type: 0x00 - not changeable, 0x01 - changeable
|
extern int16 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
|
// Assumption: To change the type: walkboxType[i] -= walkboxChane[i] and vice versa
|
||||||
extern uint8 saveVar6[16];
|
extern uint8 lastAni[16];
|
||||||
|
|
||||||
extern int32 loadFileVar1;
|
extern int32 loadFileVar1;
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ int getVolumeDataEntry(volumeDataStruct *entry) {
|
||||||
|
|
||||||
askDisk(-1);
|
askDisk(-1);
|
||||||
|
|
||||||
strcpyuint8(buffer, entry->ident);
|
strcpy(buffer, entry->ident);
|
||||||
|
|
||||||
currentVolumeFile.open(buffer);
|
currentVolumeFile.open(buffer);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ int getVolumeDataEntry(volumeDataStruct *entry) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int searchFileInVolCnf(uint8 *fileName, int32 diskNumber) {
|
int searchFileInVolCnf(const char *fileName, int32 diskNumber) {
|
||||||
int foundDisk = -1;
|
int foundDisk = -1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -131,8 +131,7 @@ int searchFileInVolCnf(uint8 *fileName, int32 diskNumber) {
|
||||||
int numOfEntry = volumeData[i].size / 13;
|
int numOfEntry = volumeData[i].size / 13;
|
||||||
|
|
||||||
for (j = 0; j < numOfEntry; j++) {
|
for (j = 0; j < numOfEntry; j++) {
|
||||||
if (!strcmpuint8(volumeData[i].ptr[j].name,
|
if (!strcmp(volumeData[i].ptr[j].name, fileName)) {
|
||||||
fileName)) {
|
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +141,7 @@ int searchFileInVolCnf(uint8 *fileName, int32 diskNumber) {
|
||||||
return (foundDisk);
|
return (foundDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 findFileInDisksSub1(uint8 *fileName) {
|
int32 findFileInDisksSub1(const char *fileName) {
|
||||||
int foundDisk = -1;
|
int foundDisk = -1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ int32 findFileInDisksSub1(uint8 *fileName) {
|
||||||
int numOfEntry = volumeData[i].size / 13;
|
int numOfEntry = volumeData[i].size / 13;
|
||||||
|
|
||||||
for (j = 0; j < numOfEntry; j++) {
|
for (j = 0; j < numOfEntry; j++) {
|
||||||
if (!strcmpuint8(volumeData[i].ptr[j].name, fileName)) {
|
if (!strcmp(volumeData[i].ptr[j].name, fileName)) {
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +159,7 @@ int32 findFileInDisksSub1(uint8 *fileName) {
|
||||||
return (foundDisk);
|
return (foundDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strToUpper(uint8 *fileName) {
|
void strToUpper(char *fileName) {
|
||||||
char character;
|
char character;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -190,7 +189,7 @@ void freeDisk(void) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 findFileInList(uint8 *fileName) {
|
int16 findFileInList(char *fileName) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!currentVolumeFile.isOpen()) {
|
if (!currentVolumeFile.isOpen()) {
|
||||||
|
@ -204,7 +203,7 @@ int16 findFileInList(uint8 *fileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < volumeNumEntry; i++) {
|
for (i = 0; i < volumeNumEntry; i++) {
|
||||||
if (!strcmpuint8(volumePtrToFileDescriptor[i].name, fileName)) {
|
if (!strcmp(volumePtrToFileDescriptor[i].name, fileName)) {
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,9 +212,8 @@ int16 findFileInList(uint8 *fileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void askDisk(int16 discNumber) {
|
void askDisk(int16 discNumber) {
|
||||||
char diskNumberString[256];
|
char fileName[256];
|
||||||
uint8 fileName[256];
|
char string[256];
|
||||||
uint8 string[256];
|
|
||||||
char messageDrawn = 0;
|
char messageDrawn = 0;
|
||||||
|
|
||||||
if (discNumber != -1) {
|
if (discNumber != -1) {
|
||||||
|
@ -223,13 +221,9 @@ void askDisk(int16 discNumber) {
|
||||||
}
|
}
|
||||||
// skip drive selection stuff
|
// skip drive selection stuff
|
||||||
|
|
||||||
strcpyuint8(fileName, "VOL.");
|
sprintf(fileName, "VOL.%d", currentDiskNumber);
|
||||||
sprintf(diskNumberString, "%d", currentDiskNumber);
|
|
||||||
strcatuint8(fileName, diskNumberString);
|
|
||||||
|
|
||||||
strcpyuint8(string, "INSERER LE DISQUE ");
|
sprintf(string, "INSERER LE DISQUE %d EN ", currentDiskNumber);
|
||||||
strcatuint8(string, diskNumberString);
|
|
||||||
strcatuint8(string, " EN ");
|
|
||||||
|
|
||||||
//while (Common::File::exists((const char*)fileName))
|
//while (Common::File::exists((const char*)fileName))
|
||||||
{
|
{
|
||||||
|
@ -242,7 +236,7 @@ void askDisk(int16 discNumber) {
|
||||||
changeCursor(currentCursor);
|
changeCursor(currentCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 findFileInDisks(uint8 *fileName) {
|
int16 findFileInDisks(char *fileName) {
|
||||||
int disk;
|
int disk;
|
||||||
int fileIdx;
|
int fileIdx;
|
||||||
|
|
||||||
|
@ -449,7 +443,7 @@ int16 readVolCnf(void) {
|
||||||
|
|
||||||
///////////////////////////::
|
///////////////////////////::
|
||||||
|
|
||||||
void drawMsgString(uint8 *string) {
|
void drawMsgString(const char *string) {
|
||||||
//printf("%s\n",string);
|
//printf("%s\n",string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
namespace Cruise {
|
namespace Cruise {
|
||||||
|
|
||||||
int16 readVolCnf(void);
|
int16 readVolCnf(void);
|
||||||
int16 findFileInDisks(uint8 * fileName);
|
int16 findFileInDisks(char * fileName);
|
||||||
void freeDisk(void);
|
void freeDisk(void);
|
||||||
int16 findFileInList(uint8 * fileName);
|
int16 findFileInList(const char * fileName);
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
void strToUpper(uint8 * fileName);
|
void strToUpper(char * fileName);
|
||||||
void drawMsgString(uint8 * string);
|
void drawMsgString(const char * string);
|
||||||
void askDisk(int16 discNumber);
|
void askDisk(int16 discNumber);
|
||||||
void setObjectPosition(int16 param1, int16 param2, int16 param3, int16 param4);
|
void setObjectPosition(int16 param1, int16 param2, int16 param3, int16 param4);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue