Some code formating fixes

svn-id: r29409
This commit is contained in:
Sven Hesse 2007-11-04 13:01:41 +00:00
parent fa15952f09
commit 906a423fa7
8 changed files with 219 additions and 431 deletions

View file

@ -33,10 +33,8 @@ int16 mainProc13(int overlayIdx, int param1, actorStruct *pStartEntry, int param
while (pCurrentEntry) { while (pCurrentEntry) {
if ((pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) && if ((pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
(pCurrentEntry->idx == param1 || param1 == -1) && (pCurrentEntry->idx == param1 || param1 == -1) &&
(pCurrentEntry->type == param2 || param2 == -1)) (pCurrentEntry->type == param2 || param2 == -1)) {
{ if (pCurrentEntry->pathId != -2) {
if(pCurrentEntry->pathId != -2)
{
return 0; return 0;
} }
} }
@ -769,8 +767,7 @@ void processAnimation(void) {
while (currentActor) { while (currentActor) {
nextActor = currentActor->next; nextActor = currentActor->next;
if (!currentActor->freeze && ((currentActor->type == 0) || (currentActor->type == 1))) if (!currentActor->freeze && ((currentActor->type == 0) || (currentActor->type == 1))) {
{
getMultipleObjectParam(currentActor->overlayNumber, currentActor->idx, &params); getMultipleObjectParam(currentActor->overlayNumber, currentActor->idx, &params);
if (((animationStart && !currentActor->flag) || (!animationStart && currentActor->x_dest != -1 && currentActor->y_dest != -1)) && (currentActor->type == 0)) { if (((animationStart && !currentActor->flag) || (!animationStart && currentActor->x_dest != -1 && currentActor->y_dest != -1)) && (currentActor->type == 0)) {
@ -859,8 +856,7 @@ void processAnimation(void) {
if ((currentActor->counter >= 0) if ((currentActor->counter >= 0)
&& ((currentActor->phase == ANIM_PHASE_STATIC_END) && ((currentActor->phase == ANIM_PHASE_STATIC_END)
|| (currentActor->phase == ANIM_PHASE_STATIC))) || (currentActor->phase == ANIM_PHASE_STATIC))) {
{
int newA; int newA;
int inc = 1; int inc = 1;
int t_inc = currentActor->startDirection - 1; int t_inc = currentActor->startDirection - 1;

View file

@ -156,8 +156,7 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ
return newElement; return newElement;
} }
void createTextObject(cellStruct *pObject, int overlayIdx, int messageIdx, int x, int y, int width, int16 color, int backgroundPlane, int parentOvl, int parentIdx) void createTextObject(cellStruct *pObject, int overlayIdx, int messageIdx, int x, int y, int width, int16 color, int backgroundPlane, int parentOvl, int parentIdx) {
{
char *ax; char *ax;
cellStruct *savePObject = pObject; cellStruct *savePObject = pObject;

View file

@ -609,23 +609,18 @@ int buttonDown;
int selectDown = 0; int selectDown = 0;
int menuDown = 0; int menuDown = 0;
int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) {
{
char objectName[80]; char objectName[80];
cellStruct *currentObject = cellHead.prev; cellStruct *currentObject = cellHead.prev;
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); char* pObjectName = getObjectName(currentObject->idx, overlayTable[currentObject->overlay].ovlData->arrayNameObj);
if(pObjectName) if (pObjectName) {
{
strcpy(objectName, pObjectName); strcpy(objectName, pObjectName);
if (strlen(objectName) && (currentObject->freeze == 0)) if (strlen(objectName) && (currentObject->freeze == 0)) {
{
int objIdx = currentObject->idx; int objIdx = currentObject->idx;
int objOvl = currentObject->overlay; int objOvl = currentObject->overlay;
int linkedObjIdx = currentObject->followObjectIdx; int linkedObjIdx = currentObject->followObjectIdx;
@ -638,8 +633,7 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
int y2 = 0; int y2 = 0;
int j2 = 0; int j2 = 0;
if ((objOvl != linkedObjOvl) || (objIdx != linkedObjIdx)) if ((objOvl != linkedObjOvl) || (objIdx != linkedObjIdx)) {
{
getMultipleObjectParam(linkedObjOvl, linkedObjIdx, &params); getMultipleObjectParam(linkedObjOvl, linkedObjIdx, &params);
x2 = params.X; x2 = params.X;
@ -647,10 +641,8 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
j2 = params.fileIdx; j2 = params.fileIdx;
} }
if (params.var5 >= 0 && params.fileIdx >= 0) if (params.var5 >= 0 && params.fileIdx >= 0) {
{ if (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT) {
if (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT)
{
int x = params.X + x2; int x = params.X + x2;
int y = params.Y + y2; int y = params.Y + y2;
int j = params.fileIdx; int j = params.fileIdx;
@ -664,8 +656,7 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
int16* dataPtr = (int16*)filesDatabase[j].subData.ptr; int16* dataPtr = (int16*)filesDatabase[j].subData.ptr;
if (*dataPtr == 0) if (*dataPtr == 0) {
{
int16 offset; int16 offset;
int16 newX; int16 newX;
int16 newY; int16 newY;
@ -683,10 +674,8 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
offset += j; offset += j;
if (offset >= 0 ) if (offset >= 0 ) {
{ if (filesDatabase[offset].resType == 0 && filesDatabase[offset].subData.ptr) {
if (filesDatabase[offset].resType == 0 && filesDatabase[offset].subData.ptr)
{
dataPtr = (int16 *)filesDatabase[offset].subData.ptr; dataPtr = (int16 *)filesDatabase[offset].subData.ptr;
} }
} }
@ -696,23 +685,19 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
y -= newY; y -= newY;
} }
if(dataPtr && findPoly((char*)dataPtr, x, y, zoom, mouseX, mouseY)) if (dataPtr && findPoly((char*)dataPtr, x, y, zoom, mouseX, mouseY)) {
{
*outObjOvl = objOvl; *outObjOvl = objOvl;
*outObjIdx = objIdx; *outObjIdx = objIdx;
return (currentObject->type); return (currentObject->type);
} }
} } else {
else
{
int numBitPlanes = filesDatabase[j].resType; int numBitPlanes = filesDatabase[j].resType;
int nWidth; int nWidth;
int nHeight; int nHeight;
if (numBitPlanes == 1) if (numBitPlanes == 1) {
{
nWidth = filesDatabase[j].widthInColumn / 2; nWidth = filesDatabase[j].widthInColumn / 2;
} else { } else {
nWidth = filesDatabase[j].width; nWidth = filesDatabase[j].width;
@ -723,13 +708,9 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
int offsetX = mouseX - x; int offsetX = mouseX - x;
int offsetY = mouseY - y; int offsetY = mouseY - y;
if ((offsetX >= 0) && (offsetX < nWidth * 16) && (offsetY >= 0) && (nWidth <= nHeight) && filesDatabase[j].subData.ptr) if ((offsetX >= 0) && (offsetX < nWidth * 16) && (offsetY >= 0) && (nWidth <= nHeight) && filesDatabase[j].subData.ptr) {
{ if (numBitPlanes == 1) {
if (numBitPlanes == 1) } else {
{
}
else
{
} }
printf("should compare to mask in findObject...\n"); printf("should compare to mask in findObject...\n");
@ -742,16 +723,13 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx)
return currentObject->type; return currentObject->type;
} }
} }
} } else if (currentObject->type == OBJ_TYPE_VIRTUEL) {
else if (currentObject->type == OBJ_TYPE_VIRTUEL)
{
int x = params.X + x2; int x = params.X + x2;
int y = params.Y + y2; int y = params.Y + y2;
int width = params.fileIdx; int width = params.fileIdx;
int height = params.scale; int height = params.scale;
if ((mouseX >= x) && (mouseX <= x+width) && (mouseY >= y) && (mouseY <= y+height)) if ((mouseX >= x) && (mouseX <= x+width) && (mouseY >= y) && (mouseY <= y+height)) {
{
*outObjOvl = objOvl; *outObjOvl = objOvl;
*outObjIdx = objIdx; *outObjIdx = objIdx;
@ -879,8 +857,7 @@ menuElementSubStruct *getSelectedEntryInMenu(menuStruct *pMenu) {
return NULL; return NULL;
} }
bool findRelation(int objOvl, int objIdx, int x, int y) bool findRelation(int objOvl, int objIdx, int x, int y) {
{
bool found = false; bool found = false;
bool first = true; bool first = true;
int testState; int testState;
@ -891,15 +868,12 @@ bool findRelation(int objOvl, int objIdx, int x, int y)
getSingleObjectParam(objOvl, objIdx, 5, &objectState); getSingleObjectParam(objOvl, objIdx, 5, &objectState);
for (j = 1; j < numOfLoadedOverlay; j++) for (j = 1; j < numOfLoadedOverlay; j++) {
{ if (overlayTable[j].alreadyLoaded) {
if (overlayTable[j].alreadyLoaded)
{
int idHeader = overlayTable[j].ovlData->numMsgRelHeader; int idHeader = overlayTable[j].ovlData->numMsgRelHeader;
int i; int i;
for(i=0; i<idHeader; i++) for (i=0; i<idHeader; i++) {
{
linkDataStruct* ptrHead = &overlayTable[j].ovlData->arrayMsgRelHeader[i]; linkDataStruct* ptrHead = &overlayTable[j].ovlData->arrayMsgRelHeader[i];
int thisOvl = ptrHead->obj1Overlay; int thisOvl = ptrHead->obj1Overlay;
@ -909,8 +883,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y)
objDataStruct* pObject = getObjectDataFromOverlay(thisOvl, ptrHead->obj1Number); objDataStruct* pObject = getObjectDataFromOverlay(thisOvl, ptrHead->obj1Number);
if ((thisOvl == objOvl) && (objIdx ==ptrHead->obj1Number) && pObject && pObject->type != 3) if ((thisOvl == objOvl) && (objIdx ==ptrHead->obj1Number) && pObject && pObject->type != 3) {
{
int verbeOvl = ptrHead->verbOverlay; int verbeOvl = ptrHead->verbOverlay;
int obj1Ovl = ptrHead->obj1Overlay; int obj1Ovl = ptrHead->obj1Overlay;
int obj2Ovl = ptrHead->obj2Overlay; int obj2Ovl = ptrHead->obj2Overlay;
@ -937,40 +910,34 @@ bool findRelation(int objOvl, int objIdx, int x, int y)
ovlDataStruct *ovl3 = NULL; ovlDataStruct *ovl3 = NULL;
ovlDataStruct *ovl4 = NULL; ovlDataStruct *ovl4 = NULL;
if(verbeOvl > 0) if (verbeOvl > 0)
ovl2 = overlayTable[verbeOvl].ovlData; ovl2 = overlayTable[verbeOvl].ovlData;
if(obj1Ovl > 0) if (obj1Ovl > 0)
ovl3 = overlayTable[obj1Ovl].ovlData; ovl3 = overlayTable[obj1Ovl].ovlData;
if(obj2Ovl > 0) if (obj2Ovl > 0)
ovl4 = overlayTable[obj2Ovl].ovlData; ovl4 = overlayTable[obj2Ovl].ovlData;
if((ovl3) && (ptrHead->obj1Number >= 0)) if ((ovl3) && (ptrHead->obj1Number >= 0)) {
{
testState = ptrHead->field_1A; testState = ptrHead->field_1A;
if((first) && (ovl3->arrayNameObj) && ((testState ==-1) || (testState == objectState))) if ((first) && (ovl3->arrayNameObj) && ((testState ==-1) || (testState == objectState))) {
{
char *ptrName = getObjectName(ptrHead->obj1Number, ovl3->arrayNameObj); char *ptrName = getObjectName(ptrHead->obj1Number, ovl3->arrayNameObj);
menuTable[0] = createMenu(x, y, ptrName); menuTable[0] = createMenu(x, y, ptrName);
first = false; first = false;
} }
} }
if((ovl2) && (ptrHead->verbNumber>=0)) if ((ovl2) && (ptrHead->verbNumber>=0)) {
{ if (ovl2->nameVerbGlob) {
if(ovl2->nameVerbGlob)
{
char *ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob); 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))) {
{ if (!strlen(verbe_name))
if(!strlen(verbe_name))
attacheNewScriptToTail(&relHead, j, ptrHead->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL); attacheNewScriptToTail(&relHead, j, ptrHead->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
else if(ovl2->nameVerbGlob) else if (ovl2->nameVerbGlob) {
{
found = true; found = true;
ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob); ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob);
addSelectableMenuEntry(j, i, menuTable[0], 1, -1, ptr); addSelectableMenuEntry(j, i, menuTable[0], 1, -1, ptr);
@ -1012,48 +979,38 @@ int processInventory(void) {
return 0; return 0;
} }
void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
{ if (pMenuElement == NULL)
if(pMenuElement == NULL)
return; return;
menuElementSubStruct* pCurrent = pMenuElement; menuElementSubStruct* pCurrent = pMenuElement;
while(pCurrent != NULL) while (pCurrent != NULL) {
{
int ovlIdx = pCurrent->ovlIdx; int ovlIdx = pCurrent->ovlIdx;
int header = pCurrent->header; int header = pCurrent->header;
linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header]; linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header];
int obj2Ovl = pHeader->obj2Overlay; int obj2Ovl = pHeader->obj2Overlay;
if(obj2Ovl == 0) if (obj2Ovl == 0) {
{
obj2Ovl = ovlIdx; obj2Ovl = ovlIdx;
} }
if((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj)) if ((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj)) {
{
// int x = 60; // int x = 60;
// int y = 60; // int y = 60;
objectParamsQuery params; objectParamsQuery params;
memset(&params, 0, sizeof(objectParamsQuery)); // to remove warning memset(&params, 0, sizeof(objectParamsQuery)); // to remove warning
if(pHeader->obj2Number >= 0) if (pHeader->obj2Number >= 0) {
{
getMultipleObjectParam(obj2Ovl, pHeader->obj2Number, &params); getMultipleObjectParam(obj2Ovl, pHeader->obj2Number, &params);
} }
if((pHeader->field_1C != -1) || (params.scale == pHeader->field_1C)) if ((pHeader->field_1C != -1) || (params.scale == pHeader->field_1C)) {
{ if (pHeader->type == 30) {
if(pHeader->type == 30)
{
ASSERT(0); ASSERT(0);
} } else if (pHeader->type == 50) {
else
if(pHeader->type == 50)
{
ASSERT(0); ASSERT(0);
} }
} }
@ -1063,55 +1020,43 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj)
} }
} }
int findHighColor() int findHighColor() {
{
printf("Unimplemented findHighColor\n"); printf("Unimplemented findHighColor\n");
return 1; return 1;
} }
void callRelation(menuElementSubStruct *pMenuElement, int nObj2) void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
{ if (pMenuElement == NULL)
if(pMenuElement == NULL)
return; return;
menuElementSubStruct* pCurrent = pMenuElement; menuElementSubStruct* pCurrent = pMenuElement;
while(pCurrent != NULL) while (pCurrent != NULL) {
{
int ovlIdx = pCurrent->ovlIdx; int ovlIdx = pCurrent->ovlIdx;
int header = pCurrent->header; int header = pCurrent->header;
linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header]; linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header];
if(pHeader->obj2Number == nObj2) if (pHeader->obj2Number == nObj2) {
{
// REL // REL
if(pHeader->type == 30) if (pHeader->type == 30) {
{
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL); attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
if((narratorOvl > 0) && (pHeader->field_12 != -1) && (pHeader->field_14 != -1)) if ((narratorOvl > 0) && (pHeader->field_12 != -1) && (pHeader->field_14 != -1)) {
{
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0); actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
if(pTrack) if (pTrack) {
{
animationStart = false; animationStart = false;
if(pHeader->field_1E == 9999) if (pHeader->field_1E == 9999) {
{
ASSERT(0); ASSERT(0);
} } else if ((pHeader->field_12 == 9999) && (pHeader->field_14 == 9999)) {
else if((pHeader->field_12 == 9999) && (pHeader->field_14 == 9999))
{
objectParamsQuery naratorParams; objectParamsQuery naratorParams;
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams); getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
pTrack->x_dest = naratorParams.X; pTrack->x_dest = naratorParams.X;
pTrack->y_dest = naratorParams.Y; pTrack->y_dest = naratorParams.Y;
pTrack->endDirection = pHeader->field_1E; pTrack->endDirection = pHeader->field_1E;
} } else {
else
{
pTrack->x_dest = pHeader->field_12; pTrack->x_dest = pHeader->field_12;
pTrack->y_dest = pHeader->field_14; pTrack->y_dest = pHeader->field_14;
pTrack->endDirection = pHeader->field_1E; pTrack->endDirection = pHeader->field_1E;
@ -1124,44 +1069,33 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2)
changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998); changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998);
} }
} }
} } else if (pHeader->type == 50) { // MSG
// MSG
else if(pHeader->type == 50)
{
int obj1Ovl = pHeader->obj1Overlay; int obj1Ovl = pHeader->obj1Overlay;
if(!obj1Ovl) if (!obj1Ovl)
obj1Ovl = ovlIdx; obj1Ovl = ovlIdx;
int x = 60; int x = 60;
int y = 40; int y = 40;
if(pHeader->obj1Number >= 0) if (pHeader->obj1Number >= 0) {
{
objectParamsQuery params; objectParamsQuery params;
getMultipleObjectParam(obj1Ovl, pHeader->obj1Number, &params); getMultipleObjectParam(obj1Ovl, pHeader->obj1Number, &params);
if(narratorOvl > 0) if (narratorOvl > 0) {
{ if ((pHeader->field_12 !=-1) && (pHeader->field_14 != -1) && (pHeader->field_12 != 9999) && (pHeader->field_14 != 9999)) {
if((pHeader->field_12 !=-1) && (pHeader->field_14 != -1) && (pHeader->field_12 != 9999) && (pHeader->field_14 != 9999))
{
x = pHeader->field_12 - 100; x = pHeader->field_12 - 100;
y = pHeader->field_14 - 150; y = pHeader->field_14 - 150;
} } else {
else
{
getMultipleObjectParam(narratorOvl, narratorIdx, &params); getMultipleObjectParam(narratorOvl, narratorIdx, &params);
x = params.X - 100; x = params.X - 100;
y = params.Y - 150; y = params.Y - 150;
} }
} } else if (params.scale >= 0) {
else if(params.scale >= 0)
{
x = params.X - 100; x = params.X - 100;
y = params.Y - 40; y = params.Y - 40;
} }
if(pHeader->field_16 != -1) if (pHeader->field_16 != -1) {
{
ASSERT(0); ASSERT(0);
} }
} }
@ -1172,28 +1106,21 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2)
autoOvl = ovlIdx; autoOvl = ovlIdx;
autoMsg = pHeader->id; autoMsg = pHeader->id;
if((narratorOvl > 0) && (pHeader->field_12 != -1) && (pHeader->field_14 != -1)) if ((narratorOvl > 0) && (pHeader->field_12 != -1) && (pHeader->field_14 != -1)) {
{
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0); actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
if(pTrack) if (pTrack) {
{
animationStart = false; animationStart = false;
if(pHeader->field_1E == 9999) if (pHeader->field_1E == 9999) {
{
ASSERT(0); ASSERT(0);
} } else if ((pHeader->field_12 == 9999) && (pHeader->field_14 == 9999)) {
else if((pHeader->field_12 == 9999) && (pHeader->field_14 == 9999))
{
objectParamsQuery naratorParams; objectParamsQuery naratorParams;
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams); getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
pTrack->x_dest = naratorParams.X; pTrack->x_dest = naratorParams.X;
pTrack->y_dest = naratorParams.Y; pTrack->y_dest = naratorParams.Y;
pTrack->endDirection = pHeader->field_1E; pTrack->endDirection = pHeader->field_1E;
} } else {
else
{
pTrack->x_dest = pHeader->field_12; pTrack->x_dest = pHeader->field_12;
pTrack->y_dest = pHeader->field_14; pTrack->y_dest = pHeader->field_14;
pTrack->endDirection = pHeader->field_1E; pTrack->endDirection = pHeader->field_1E;
@ -1208,9 +1135,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2)
} }
} }
} }
} } else {
else
{
linkedRelation = pMenuElement; linkedRelation = pMenuElement;
} }
@ -1218,8 +1143,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2)
} }
} }
int processInput(void) int processInput(void) {
{
int16 mouseX = 0; int16 mouseX = 0;
int16 mouseY = 0; int16 mouseY = 0;
int16 button = 0; int16 button = 0;
@ -1231,20 +1155,16 @@ int processInput(void)
button = 0; button = 0;
if (sysKey != -1) if (sysKey != -1) {
{
button = sysKey; button = sysKey;
mouseX = sysX; mouseX = sysX;
mouseY = sysY; mouseY = sysY;
sysKey = -1; sysKey = -1;
} } else if (automaticMode == 0) {
else if (automaticMode == 0)
{
getMouseStatus(&main10, &mouseX, &button, &mouseY); getMouseStatus(&main10, &mouseX, &button, &mouseY);
} }
if (!button) if (!button) {
{
buttonDown = 0; buttonDown = 0;
} }
@ -1254,8 +1174,7 @@ int processInput(void)
} }
// test both buttons // test both buttons
if (((button & 3) == 3) || keyboardVar == 0x44 || keyboardVar == 0x53) if (((button & 3) == 3) || keyboardVar == 0x44 || keyboardVar == 0x53) {
{
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
keyboardVar = 0; keyboardVar = 0;
return (playerMenu(mouseX, mouseY)); return (playerMenu(mouseX, mouseY));
@ -1265,84 +1184,62 @@ int processInput(void)
return 0; return 0;
} }
if ((currentActiveMenu != -1) && menuTable[currentActiveMenu]) if ((currentActiveMenu != -1) && menuTable[currentActiveMenu]) {
{
updateMenuMouse(mouseX, mouseY, menuTable[currentActiveMenu]); updateMenuMouse(mouseX, mouseY, menuTable[currentActiveMenu]);
} }
if (dialogueEnabled) if (dialogueEnabled) {
{
ASSERT(0); ASSERT(0);
} } else if ((button & 1) && (buttonDown == 0)) {
else
if ((button & 1) && (buttonDown == 0))
{
// left click // left click
buttonDown = 1; buttonDown = 1;
// is there a relation // is there a relation
if (linkedRelation) if (linkedRelation) {
{
// call sub relation when clicking on an object // call sub relation when clicking on an object
if(menuDown == 0) if (menuDown == 0) {
{ if (menuTable[0]) {
if(menuTable[0])
{
int objOvl; int objOvl;
int objIdx; int objIdx;
int objType; int objType;
objType = findObject(mouseX, mouseY, &objOvl, &objIdx); objType = findObject(mouseX, mouseY, &objOvl, &objIdx);
if (objType != -1) if (objType != -1) {
{
callSubRelation(linkedRelation, objOvl, objIdx); callSubRelation(linkedRelation, objOvl, objIdx);
} }
freeMenu(menuTable[0]); freeMenu(menuTable[0]);
menuTable[0] = NULL; menuTable[0] = NULL;
} }
if(linkedMsgList) if (linkedMsgList) {
{
ASSERT(0); ASSERT(0);
// freeMsgList(linkedMsgList); // freeMsgList(linkedMsgList);
} }
linkedMsgList = NULL; linkedMsgList = NULL;
linkedRelation = NULL; linkedRelation = NULL;
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
} } else { // call sub relation when clicking in inventory
// call sub relation when clicking in inventory
else
{
ASSERT(0); ASSERT(0);
} }
} } else {
else
{
// manage click on object menu // manage click on object menu
if (menuDown == 0) if (menuDown == 0) {
{
// Handle left click on an object // Handle left click on an object
if (menuTable[0] == 0) if (menuTable[0] == 0) {
{
int objOvl; int objOvl;
int objIdx; int objIdx;
int objType; int objType;
objType = findObject(mouseX, mouseY, &objOvl, &objIdx); objType = findObject(mouseX, mouseY, &objOvl, &objIdx);
if (objType != -1) if (objType != -1) {
{
int relation = findRelation(objOvl, objIdx, mouseX, mouseY); int relation = findRelation(objOvl, objIdx, mouseX, mouseY);
if(menuTable[0]) if (menuTable[0]) {
{ if (relation) {
if(relation)
{
currentActiveMenu = 0; currentActiveMenu = 0;
selectDown = 1; selectDown = 1;
} } else {
else
{
// object has a name but no relation, just move the character // object has a name but no relation, just move the character
freeMenu(menuTable[0]); freeMenu(menuTable[0]);
menuTable[0] = NULL; menuTable[0] = NULL;
@ -1352,9 +1249,7 @@ int processInput(void)
animationStart = true; animationStart = true;
buttonDown = 0; buttonDown = 0;
} }
} } else {
else
{
aniX = mouseX; aniX = mouseX;
aniY = mouseY; aniY = mouseY;
animationStart = true; animationStart = true;
@ -1367,26 +1262,19 @@ int processInput(void)
animationStart = true; animationStart = true;
buttonDown = 0; buttonDown = 0;
} }
} } else {
else
{
// handle click in menu // handle click in menu
if (menuTable[0]) if (menuTable[0]) {
{
menuElementSubStruct *pMenuElementSub = getSelectedEntryInMenu(menuTable[0]); menuElementSubStruct *pMenuElementSub = getSelectedEntryInMenu(menuTable[0]);
callRelation(pMenuElementSub, -1); callRelation(pMenuElementSub, -1);
// if there is a linked relation, close menu // if there is a linked relation, close menu
if(!linkedRelation) if (!linkedRelation) {
{
freeMenu(menuTable[0]); freeMenu(menuTable[0]);
menuTable[0] = NULL; menuTable[0] = NULL;
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
} } else { // else create the message for the linked relation
// else create the message for the linked relation
else
{
char text[80]; char text[80];
strcpy(text, menuTable[0]->stringPtr); strcpy(text, menuTable[0]->stringPtr);
strcat(text, ":"); strcat(text, ":");
@ -1396,12 +1284,9 @@ int processInput(void)
} }
} }
} }
} } else {
else
{
// Handle left click in inventory // Handle left click in inventory
if (processInventory()) if (processInventory()) {
{
currentActiveMenu = 0; currentActiveMenu = 0;
selectDown = 1; selectDown = 1;
menuDown = 0; menuDown = 0;
@ -1411,12 +1296,8 @@ int processInput(void)
} }
} }
} }
} } else if ((button & 2) || (keyboardVar == 0x43) || (keyboardVar == 0x52)) { // test right button
// test right button if (buttonDown == 0) {
else if ((button & 2) || (keyboardVar == 0x43) || (keyboardVar == 0x52))
{
if (buttonDown == 0)
{
keyboardVar = 0; keyboardVar = 0;
// close object menu if there is no linked relation // close object menu if there is no linked relation
@ -1428,8 +1309,7 @@ int processInput(void)
currentActiveMenu = -1; currentActiveMenu = -1;
} }
if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL)) if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL)) {
{
buildInventory(mouseX, mouseY); buildInventory(mouseX, mouseY);
if (menuTable[1]) { if (menuTable[1]) {
@ -1449,8 +1329,7 @@ int currentMouseX = 0;
int currentMouseY = 0; int currentMouseY = 0;
int currentMouseButton = 0; int currentMouseButton = 0;
void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
{
*pMouseX = currentMouseX; *pMouseX = currentMouseX;
*pMouseY = currentMouseY; *pMouseY = currentMouseY;
*pMouseButton = currentMouseButton; *pMouseButton = currentMouseButton;
@ -1484,8 +1363,7 @@ void manageEvents() {
g_system->quit(); g_system->quit();
break; break;
case Common::EVENT_KEYUP: case Common::EVENT_KEYUP:
switch(event.kbd.keycode) switch (event.kbd.keycode) {
{
case 27: // ESC case 27: // ESC
currentMouseButton &= ~4; currentMouseButton &= ~4;
break; break;
@ -1494,8 +1372,7 @@ void manageEvents() {
} }
break; break;
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
switch(event.kbd.keycode) switch (event.kbd.keycode) {
{
case 27: // ESC case 27: // ESC
currentMouseButton |= 4; currentMouseButton |= 4;
break; break;
@ -1569,14 +1446,10 @@ void manageEvents() {
* break; * break;
* } * }
* break; */ * break; */
if (event.kbd.flags == Common::KBD_CTRL) if (event.kbd.flags == Common::KBD_CTRL) {
{ if (event.kbd.keycode == Common::KEYCODE_d) {
if (event.kbd.keycode == Common::KEYCODE_d)
{
// enable debugging stuff ? // enable debugging stuff ?
} } else if (event.kbd.keycode == Common::KEYCODE_f) {
else if (event.kbd.keycode == Common::KEYCODE_f)
{
bFastMode = !bFastMode; bFastMode = !bFastMode;
} }
} }
@ -1595,8 +1468,7 @@ void manageEvents() {
*/ */
g_system->updateScreen(); g_system->updateScreen();
if(!bFastMode) if (!bFastMode) {
{
g_system->delayMillis(40); g_system->delayMillis(40);
} }
} }
@ -1633,8 +1505,7 @@ void mainLoop(void) {
// readKeyboard(); // readKeyboard();
playerDontAskQuit = processInput(); playerDontAskQuit = processInput();
if (enableUser) if (enableUser) {
{
userEnabled = 1; userEnabled = 1;
enableUser = 0; enableUser = 0;
} }
@ -1665,8 +1536,7 @@ void mainLoop(void) {
initVar4 = 0; */ initVar4 = 0; */
} }
if (affichePasMenuJoueur) if (affichePasMenuJoueur) {
{
if (main5) if (main5)
fadeVar = 0; fadeVar = 0;
@ -1678,10 +1548,8 @@ void mainLoop(void) {
mainDraw(0); mainDraw(0);
flipScreen(); flipScreen();
if (userEnabled && !userWait && !autoTrack) if (userEnabled && !userWait && !autoTrack) {
{ if (currentActiveMenu == -1) {
if(currentActiveMenu == -1)
{
int16 mouseX; int16 mouseX;
int16 mouseY; int16 mouseY;
int16 mouseButton; int16 mouseButton;
@ -1691,8 +1559,7 @@ void mainLoop(void) {
getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
if (mouseX != oldMouseX && mouseY != oldMouseY) if (mouseX != oldMouseX && mouseY != oldMouseY) {
{
int objectType; int objectType;
int newCursor1; int newCursor1;
int newCursor2; int newCursor2;
@ -1702,36 +1569,24 @@ void mainLoop(void) {
objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2); objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
if (objectType == 9) if (objectType == 9) {
{
changeCursor(CURSOR_EXIT); changeCursor(CURSOR_EXIT);
} } else if (objectType != -1) {
else
if (objectType != -1)
{
changeCursor(CURSOR_MAGNIFYING_GLASS); changeCursor(CURSOR_MAGNIFYING_GLASS);
} } else {
else
{
changeCursor(CURSOR_WALK); changeCursor(CURSOR_WALK);
} }
} }
} } else {
else
{
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
} }
} } else {
else
{
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
} }
if (userWait) if (userWait) {
{
int16 button = 0; int16 button = 0;
while(!button) while (!button) {
{
manageScripts(&relHead); manageScripts(&relHead);
manageScripts(&procHead); manageScripts(&procHead);
@ -1755,31 +1610,24 @@ void mainLoop(void) {
} }
// wait for character to finish auto track // wait for character to finish auto track
if (autoTrack) if (autoTrack) {
{ if (mainProc13(narratorOvl, narratorIdx, &actorHead, 0)) {
if(mainProc13(narratorOvl, narratorIdx, &actorHead, 0)) if (autoMsg != -1) {
{
if(autoMsg != -1)
{
freezeCell(&cellHead, autoOvl, autoMsg, 5, -1, 9998, 0); freezeCell(&cellHead, autoOvl, autoMsg, 5, -1, 9998, 0);
char* pText = getText(autoMsg, autoOvl); char* pText = getText(autoMsg, autoOvl);
if(strlen(pText)) if (strlen(pText))
userWait = 1; userWait = 1;
} }
changeScriptParamInList(-1, -1, &relHead, 9998, 0); changeScriptParamInList(-1, -1, &relHead, 9998, 0);
autoTrack = 0; autoTrack = 0;
enableUser = 1; enableUser = 1;
} } else {
else
{
userEnabled = false; userEnabled = false;
} }
} } else if (autoMsg != -1) {
else if (autoMsg != -1)
{
removeCell(&cellHead, autoOvl, autoMsg, 5, currentActiveBackgroundPlane ); removeCell(&cellHead, autoOvl, autoMsg, 5, currentActiveBackgroundPlane );
autoMsg = -1; autoMsg = -1;
} }

View file

@ -232,7 +232,7 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
* *cx = var_2; * *cx = var_2;
* cx++; * cx++;
* var_E ++; * var_E ++;
* }while (di); * } while (di);
* *
* var_12 = cx; * var_12 = cx;
* } */ * } */
@ -280,7 +280,7 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
} }
int getNode(int nodeResult[2], int nodeId){ int getNode(int nodeResult[2], int nodeId){
if(nodeId < 0 || nodeId >= ctp_routeCoordCount) if (nodeId < 0 || nodeId >= ctp_routeCoordCount)
return -1; return -1;
nodeResult[0] = ctp_routeCoords[nodeId][0]; nodeResult[0] = ctp_routeCoords[nodeId][0];

View file

@ -1401,13 +1401,12 @@ int16 Op_SetObjectAtNode(void) {
int16 obj = popVar(); int16 obj = popVar();
int16 ovl = popVar(); int16 ovl = popVar();
if(!ovl) if (!ovl)
ovl = currentScriptPtr->overlayNumber;; ovl = currentScriptPtr->overlayNumber;;
int nodeInfo[2]; int nodeInfo[2];
if(!getNode(nodeInfo, node)) if (!getNode(nodeInfo, node)) {
{
setObjectPosition(ovl, obj, 0, nodeInfo[0]); setObjectPosition(ovl, obj, 0, nodeInfo[0]);
setObjectPosition(ovl, obj, 1, nodeInfo[1]); setObjectPosition(ovl, obj, 1, nodeInfo[1]);
setObjectPosition(ovl, obj, 2, nodeInfo[1]); setObjectPosition(ovl, obj, 2, nodeInfo[1]);

View file

@ -299,12 +299,12 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* siPtr+=4; * siPtr+=4;
* diPtr++; * diPtr++;
* }while (--cx); * } while (--cx);
* *
* diPtr += loc_1147; // interline * diPtr += loc_1147; // interline
* siPtr += loc_114B; * siPtr += loc_114B;
* bp = bpSave; * bp = bpSave;
* }while (--bp); * } while (--bp);
* } * }
* else // croped * else // croped
* { * {
@ -427,7 +427,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* siPtr += 4; * siPtr += 4;
* diPtr++; * diPtr++;
* }while (--bp); * } while (--bp);
* } * }
* *
* if (loc_122B == 0xF8) * if (loc_122B == 0xF8)
@ -481,7 +481,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* siPtr+=loc_12DD; * siPtr+=loc_12DD;
* bp = loc_12E1; * bp = loc_12E1;
* *
* }while (--bp); * } while (--bp);
* } */ * } */
{ {

View file

@ -109,10 +109,8 @@ void pixel(int x, int y, char color) {
} }
// this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1) // this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1)
void flipPoly(int fileId, int16 *dataPtr, int scale, char** newFrame, int X, int Y, int *outX, int *outY, int *outScale) void flipPoly(int fileId, int16 *dataPtr, int scale, char** newFrame, int X, int Y, int *outX, int *outY, int *outScale) {
{ if (*dataPtr == 0) {
if (*dataPtr == 0)
{
int16 offset; int16 offset;
int16 newX; int16 newX;
int16 newY; int16 newY;
@ -130,10 +128,8 @@ void flipPoly(int fileId, int16 *dataPtr, int scale, char** newFrame, int X, int
offset += fileId; offset += fileId;
if (offset >= 0 ) if (offset >= 0 ) {
{ if (filesDatabase[offset].resType == 0 && filesDatabase[offset].subData.ptr) {
if (filesDatabase[offset].resType == 0 && filesDatabase[offset].subData.ptr)
{
dataPtr = (int16 *)filesDatabase[offset].subData.ptr; dataPtr = (int16 *)filesDatabase[offset].subData.ptr;
} }
} }
@ -169,8 +165,7 @@ int16 XMIN_XMAX[404];
int16 polyBuffer4[512]; int16 polyBuffer4[512];
// this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2)
void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsigned char *dataPtr) void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsigned char *dataPtr) {
{
int upperBorder; int upperBorder;
int lowerBorder; int lowerBorder;
m_flipLeftRight = 0; m_flipLeftRight = 0;
@ -233,17 +228,14 @@ void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsi
int nbseg; int nbseg;
int16 nbligne; int16 nbligne;
void blitPolyMode1(char *dest, char *ptr, int16 * buffer, char color) void blitPolyMode1(char *dest, char *ptr, int16 * buffer, char color) {
{
ASSERT(0); ASSERT(0);
} }
void blitPolyMode2(char *dest, int16 * buffer, char color) void blitPolyMode2(char *dest, int16 * buffer, char color) {
{
int Y = XMIN_XMAX[0]; int Y = XMIN_XMAX[0];
for(int i=0; i<nbligne; i++) for (int i=0; i<nbligne; i++) {
{
int currentY = Y+i; int currentY = Y+i;
int XMIN = XMIN_XMAX[1+i*2]; int XMIN = XMIN_XMAX[1+i*2];
int XMAX = XMIN_XMAX[1+i*2+1]; int XMAX = XMIN_XMAX[1+i*2+1];
@ -268,19 +260,16 @@ int16 *A2ptr;
void buildSegment(void) void buildSegment(void) {
{
int16* pOut = XMIN_XMAX; int16* pOut = XMIN_XMAX;
if((polyXMin >= 320) || (polyXMax < 0) || (polyYMax < 0) || (polyYMin >= 200)) if ((polyXMin >= 320) || (polyXMax < 0) || (polyYMax < 0) || (polyYMin >= 200)) {
{
XMIN_XMAX[0] = -1; XMIN_XMAX[0] = -1;
nbligne = -1; nbligne = -1;
return; return;
} }
if(polyYMin == polyYMax) // line if (polyYMin == polyYMax) { // line
{
*(pOut++) = polyYMin; // store initial Y *(pOut++) = polyYMin; // store initial Y
int cx = nbseg-1; int cx = nbseg-1;
@ -292,25 +281,24 @@ void buildSegment(void)
XLeft = XRight = *pIn; // init to first X XLeft = XRight = *pIn; // init to first X
pIn+=2; pIn+=2;
do do {
{
int X = *pIn; int X = *pIn;
if(XLeft > X) if (XLeft > X)
XLeft = X; XLeft = X;
if(XRight < X) if (XRight < X)
XRight = X; XRight = X;
pIn+=2; pIn+=2;
}while(--cx); } while (--cx);
// now store left and right coordinates in XMIN_XMAX // now store left and right coordinates in XMIN_XMAX
int XMin = XLeft; int XMin = XLeft;
int XMax = XRight; int XMax = XRight;
if(XLeft < 0) if (XLeft < 0)
XMin = 0; XMin = 0;
if(XRight >= 320) if (XRight >= 320)
XMax = 319; XMax = 319;
*(pOut++) = XMin; *(pOut++) = XMin;
@ -325,14 +313,14 @@ void buildSegment(void)
int ydep; int ydep;
if(polyYMin < 0) if (polyYMin < 0)
ydep = 0; ydep = 0;
else else
ydep = polyYMin; ydep = polyYMin;
int yfin; int yfin;
if(polyYMax > 199) if (polyYMax > 199)
yfin = 199; yfin = 199;
else else
yfin = polyYMax; yfin = polyYMax;
@ -348,18 +336,16 @@ void buildSegment(void)
// init table with default values // init table with default values
int16* si = XMIN_XMAX + 1; int16* si = XMIN_XMAX + 1;
int tempCount = nbligne; int tempCount = nbligne;
do do {
{
si[0] = 5000; si[0] = 5000;
si[1] = -5000; si[1] = -5000;
si+=2; si+=2;
}while(--tempCount); } while (--tempCount);
int16* di = A2ptr; int16* di = A2ptr;
int segCount = nbseg; int segCount = nbseg;
do do {
{
int X2 = di[2]; int X2 = di[2];
int X1 = di[0]; int X1 = di[0];
int Y2 = di[3]; int Y2 = di[3];
@ -368,55 +354,46 @@ void buildSegment(void)
int tempAX = Y1; int tempAX = Y1;
int tempDX = Y2; int tempDX = Y2;
if(tempAX > tempDX) if (tempAX > tempDX) {
{
// swap // swap
tempAX = Y2; tempAX = Y2;
tempDX = Y1; tempDX = Y1;
} }
// is segment on screen ? // is segment on screen ?
if(!((tempAX > 199) || (tempDX < 0))) if (!((tempAX > 199) || (tempDX < 0))) {
{
int dx = Y1; int dx = Y1;
int cx = X2 - X1; int cx = X2 - X1;
if(cx == 0) if (cx == 0) {
{
// vertical line // vertical line
int CX = X2; int CX = X2;
if(CX < 0) if (CX < 0)
CX = 0; CX = 0;
int DX = X2; int DX = X2;
if(DX > 319) if (DX > 319)
DX = 319; DX = 319;
int16* BX = XMIN_XMAX + (Y2 - ydep) * 2 +1; int16* BX = XMIN_XMAX + (Y2 - ydep) * 2 +1;
int16* DI = XMIN_XMAX + (Y1 - ydep) * 2 +1; int16* DI = XMIN_XMAX + (Y1 - ydep) * 2 +1;
if(Y2 >= Y1) if (Y2 >= Y1) {
{
SWAP(BX, DI); SWAP(BX, DI);
} }
do do {
{ if ((BX <= ptrMax) && (BX >= ptrMini)) { // are we in screen ?
if((BX <= ptrMax) && (BX >= ptrMini)) // are we in screen ? if (CX < BX[0])
{
if(CX < BX[0])
BX[0] = CX; BX[0] = CX;
if(DX > BX[1]) if (DX > BX[1])
BX[1] = DX; BX[1] = DX;
} }
BX+=2; BX+=2;
}while(BX <= DI); } while (BX <= DI);
} } else {
else if ( cx < 0 ) {
{
if( cx < 0 )
{
cx = -cx; cx = -cx;
dx = Y2; dx = Y2;
@ -430,40 +407,34 @@ void buildSegment(void)
int dy = Y2 - Y1; int dy = Y2 - Y1;
if( dy == 0 ) if ( dy == 0 ) {
{
// hline // hline
int16* ptr = (Y1 - ydep) * 2 + XMIN_XMAX + 1; int16* ptr = (Y1 - ydep) * 2 + XMIN_XMAX + 1;
if((ptr <= ptrMax) && (ptr >= ptrMini)) // are we in screen ? if ((ptr <= ptrMax) && (ptr >= ptrMini)) { // are we in screen ?
{
int CX = X1; int CX = X1;
if(CX < 0) if (CX < 0)
CX = 0; CX = 0;
int SI = X2; int SI = X2;
if(SI > 319) if (SI > 319)
SI = 319; SI = 319;
if(CX < ptr[0]) if (CX < ptr[0])
ptr[0] = CX; ptr[0] = CX;
if(SI > ptr[1]) if (SI > ptr[1])
ptr[1] = SI; ptr[1] = SI;
} }
} } else {
else if ( dy < 0 ) {
{
if( dy < 0 )
{
dy = -dy; dy = -dy;
patchAdd = -2; patchAdd = -2;
} }
int stepType = 0; // small DY <= DX int stepType = 0; // small DY <= DX
if(dy > cx) if (dy > cx) {
{
stepType = 1; // DX < DY stepType = 1; // DX < DY
SWAP(dy, cx); SWAP(dy, cx);
@ -479,26 +450,23 @@ void buildSegment(void)
int16* ptr = (Y1 - ydep)*2 + XMIN_XMAX + 1; int16* ptr = (Y1 - ydep)*2 + XMIN_XMAX + 1;
if(stepType == 0) if (stepType == 0) {
{
// small step // small step
int BP = X2; int BP = X2;
int SI = BP; int SI = BP;
if(SI < 0) if (SI < 0)
SI = 0; SI = 0;
int DX = BP; int DX = BP;
if(DX > 319) if (DX > 319)
DX = 319; DX = 319;
do do {
{ if ((ptr <= ptrMax) && (ptr >= ptrMini)) { // are we in screen ?
if((ptr <= ptrMax) && (ptr >= ptrMini)) // are we in screen ? if (SI < ptr[0])
{
if(SI < ptr[0])
ptr[0] = SI; ptr[0] = SI;
if(DX > ptr[1]) if (DX > ptr[1])
ptr[1] = DX; ptr[1] = DX;
} }
@ -506,77 +474,65 @@ void buildSegment(void)
// test limits // test limits
SI = BP; SI = BP;
if(SI < 0) if (SI < 0)
SI = 0; SI = 0;
DX = BP; DX = BP;
if(DX > 319) if (DX > 319)
DX = 319; DX = 319;
if(d < 0) if (d < 0) {
{
d += patchinc1; d += patchinc1;
if( cx == 1 ) // last ? if ( cx == 1 ) { // last ?
{ if ((ptr <= ptrMax) && (ptr >= ptrMini)) { // are we in screen ?
if((ptr <= ptrMax) && (ptr >= ptrMini)) // are we in screen ? if (SI < ptr[0])
{
if(SI < ptr[0])
ptr[0] = SI; ptr[0] = SI;
if(DX > ptr[1]) if (DX > ptr[1])
ptr[1] = DX; ptr[1] = DX;
} }
} }
} } else {
else
{
d += patchinc2; d += patchinc2;
ptr+=patchAdd; ptr+=patchAdd;
} }
}while(--cx); } while (--cx);
} } else {
else
{
// big step // big step
int BP = X2; int BP = X2;
int SI = BP; int SI = BP;
if(SI < 0) if (SI < 0)
SI = 0; SI = 0;
int DX = BP; int DX = BP;
if(DX > 319) if (DX > 319)
DX = 319; DX = 319;
do do {
{ if ((ptr <= ptrMax) && (ptr >= ptrMini)) { // are we in screen ?
if((ptr <= ptrMax) && (ptr >= ptrMini)) // are we in screen ? if (SI < ptr[0])
{
if(SI < ptr[0])
ptr[0] = SI; ptr[0] = SI;
if(DX > ptr[1]) if (DX > ptr[1])
ptr[1] = DX; ptr[1] = DX;
} }
ptr += patchAdd; // next line ptr += patchAdd; // next line
if(d < 0) if (d < 0) {
{
d += patchinc1; d += patchinc1;
} } else {
else
{
d += patchinc2; d += patchinc2;
BP ++; BP ++;
// test limits // test limits
SI = BP; SI = BP;
if(SI < 0) if (SI < 0)
SI = 0; SI = 0;
DX = BP; DX = BP;
if(DX > 319) if (DX > 319)
DX = 319; DX = 319;
} }
}while(--cx); } while (--cx);
} }
} }
@ -584,7 +540,7 @@ void buildSegment(void)
} }
di+=2; di+=2;
}while(--segCount); } while (--segCount);
} }
unsigned char *drawPolyMode1(unsigned char *dataPointer, int linesToDraw) { unsigned char *drawPolyMode1(unsigned char *dataPointer, int linesToDraw) {
@ -637,8 +593,7 @@ unsigned char *drawPolyMode1(unsigned char *dataPointer, int linesToDraw) {
return dataPointer; return dataPointer;
} }
unsigned char *drawPolyMode2(unsigned char *dataPointer, int linesToDraw) unsigned char *drawPolyMode2(unsigned char *dataPointer, int linesToDraw) {
{
int index; int index;
int16 *pBufferDest; int16 *pBufferDest;
@ -824,8 +779,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
flipShort(&minimumScale); flipShort(&minimumScale);
if ((minimumScale <= scale)) if ((minimumScale <= scale)) {
{
if (m_flipLeftRight) { if (m_flipLeftRight) {
drawPolyMode1((unsigned char *)dataPointer, linesToDraw); drawPolyMode1((unsigned char *)dataPointer, linesToDraw);
} else { } else {
@ -850,8 +804,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
} while (*dataPointer != 0xFF); } while (*dataPointer != 0xFF);
} }
bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX, int mouseY) bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX, int mouseY) {
{
int counter = 0; // numbers of coordinates to process int counter = 0; // numbers of coordinates to process
int startX = 0; // first X in model int startX = 0; // first X in model
int startY = 0; // first Y in model int startY = 0; // first Y in model
@ -987,8 +940,7 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX
flipShort(&minimumScale); flipShort(&minimumScale);
if ((minimumScale <= scale)) if ((minimumScale <= scale)) {
{
if (m_flipLeftRight) { if (m_flipLeftRight) {
drawPolyMode1((unsigned char *)dataPointer, linesToDraw); drawPolyMode1((unsigned char *)dataPointer, linesToDraw);
} else { } else {
@ -998,14 +950,13 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX
int polygonYMin = XMIN_XMAX[0]; int polygonYMin = XMIN_XMAX[0];
int polygonYMax = polygonYMin + nbligne; int polygonYMax = polygonYMin + nbligne;
if((mouseY >= polygonYMin) && (mouseY <= polygonYMax)) if ((mouseY >= polygonYMin) && (mouseY <= polygonYMax)) {
{
int polygonLineNumber = mouseY - polygonYMin; int polygonLineNumber = mouseY - polygonYMin;
int XMIN = XMIN_XMAX[1+polygonLineNumber*2]; int XMIN = XMIN_XMAX[1+polygonLineNumber*2];
int XMAX = XMIN_XMAX[1+polygonLineNumber*2+1]; int XMAX = XMIN_XMAX[1+polygonLineNumber*2+1];
if((mouseX >= XMIN) && (mouseX <= XMAX)) if ((mouseX >= XMIN) && (mouseX <= XMAX))
return true; return true;
} }
} }
@ -1077,8 +1028,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *pObject, int X, int scale, int
cellStruct *pCurrentObject = pObject; cellStruct *pCurrentObject = pObject;
do { do {
if (pCurrentObject->type == OBJ_TYPE_BGMK) if (pCurrentObject->type == OBJ_TYPE_BGMK) {
{
// ASSERT(0); // ASSERT(0);
} }
@ -1501,10 +1451,7 @@ void mainDraw(int16 param) {
drawMenu(menuTable[currentActiveMenu]); drawMenu(menuTable[currentActiveMenu]);
return; return;
} }
} } else if ((linkedRelation) && (linkedMsgList)) {
else
if ((linkedRelation) && (linkedMsgList))
{
ASSERT(0); ASSERT(0);
// TODO: draw mouse here // TODO: draw mouse here
} }

View file

@ -150,8 +150,7 @@ void bsubline_4(int x1, int y1, int x2, int y2, char c) {
} }
} }
void line(int x1, int y1, int x2, int y2, char c) void line(int x1, int y1, int x2, int y2, char c) {
{
float k; float k;
if ((x1 == x2) && (y1 == y2)) { if ((x1 == x2) && (y1 == y2)) {