Fix dangling pointer
Fix low color background Fix input svn-id: r29897
This commit is contained in:
parent
993e5b9c24
commit
5cc1313ffe
4 changed files with 95 additions and 39 deletions
|
@ -1047,7 +1047,16 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
|
||||||
|
|
||||||
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);
|
{
|
||||||
|
if(currentScriptPtr)
|
||||||
|
{
|
||||||
|
attacheNewScriptToTail(&relHead, j, ptrHead->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attacheNewScriptToTail(&relHead, j, ptrHead->id, 30, 0, 0, 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);
|
||||||
|
@ -1120,39 +1129,46 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
|
||||||
|
|
||||||
if ((pHeader->obj2OldState == -1) || (params.scale == pHeader->obj2OldState)) {
|
if ((pHeader->obj2OldState == -1) || (params.scale == pHeader->obj2OldState)) {
|
||||||
if (pHeader->type == 30) { // REL
|
if (pHeader->type == 30) { // REL
|
||||||
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
|
if(currentScriptPtr)
|
||||||
|
{
|
||||||
if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) {
|
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
|
||||||
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
|
}
|
||||||
|
else
|
||||||
if (pTrack) {
|
{
|
||||||
animationStart = false;
|
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, 0, 0, scriptType_REL);
|
||||||
|
}
|
||||||
if (pHeader->trackDirection == 9999) {
|
|
||||||
objectParamsQuery naratorParams;
|
if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) {
|
||||||
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
|
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
|
||||||
pTrack->x_dest = naratorParams.X;
|
|
||||||
pTrack->y_dest = naratorParams.Y;
|
if (pTrack) {
|
||||||
pTrack->endDirection = direction(naratorParams.X, naratorParams.Y, pTrack->x_dest, pTrack->y_dest, 0, 0);
|
animationStart = false;
|
||||||
} else if ((pHeader->trackX == 9999) && (pHeader->trackY == 9999)) {
|
|
||||||
objectParamsQuery naratorParams;
|
if (pHeader->trackDirection == 9999) {
|
||||||
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
|
objectParamsQuery naratorParams;
|
||||||
pTrack->x_dest = naratorParams.X;
|
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
|
||||||
pTrack->y_dest = naratorParams.Y;
|
pTrack->x_dest = naratorParams.X;
|
||||||
pTrack->endDirection = pHeader->trackDirection;
|
pTrack->y_dest = naratorParams.Y;
|
||||||
} else {
|
pTrack->endDirection = direction(naratorParams.X, naratorParams.Y, pTrack->x_dest, pTrack->y_dest, 0, 0);
|
||||||
pTrack->x_dest = pHeader->trackX;
|
} else if ((pHeader->trackX == 9999) && (pHeader->trackY == 9999)) {
|
||||||
pTrack->y_dest = pHeader->trackY;
|
objectParamsQuery naratorParams;
|
||||||
pTrack->endDirection = pHeader->trackDirection;
|
getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams);
|
||||||
}
|
pTrack->x_dest = naratorParams.X;
|
||||||
|
pTrack->y_dest = naratorParams.Y;
|
||||||
pTrack->flag = 1;
|
pTrack->endDirection = pHeader->trackDirection;
|
||||||
|
} else {
|
||||||
autoTrack = true;
|
pTrack->x_dest = pHeader->trackX;
|
||||||
userEnabled = 0;
|
pTrack->y_dest = pHeader->trackY;
|
||||||
changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998);
|
pTrack->endDirection = pHeader->trackDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
pTrack->flag = 1;
|
||||||
|
|
||||||
|
autoTrack = true;
|
||||||
|
userEnabled = 0;
|
||||||
|
changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (pHeader->type == 50) {
|
} else if (pHeader->type == 50) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1199,14 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
|
||||||
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);
|
if(currentScriptPtr)
|
||||||
|
{
|
||||||
|
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, 0, 0, scriptType_REL);
|
||||||
|
}
|
||||||
|
|
||||||
if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) {
|
if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) {
|
||||||
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
|
actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
|
||||||
|
@ -1247,7 +1270,14 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), currentActiveBackgroundPlane, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber);
|
if(currentScriptPtr)
|
||||||
|
{
|
||||||
|
createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), currentActiveBackgroundPlane, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), currentActiveBackgroundPlane, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
userWait = 1;
|
userWait = 1;
|
||||||
autoOvl = ovlIdx;
|
autoOvl = ovlIdx;
|
||||||
|
|
|
@ -1550,6 +1550,30 @@ int16 Op_LinkObjects(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16 Op_UserDelay(void)
|
||||||
|
{
|
||||||
|
int delay = popVar();
|
||||||
|
|
||||||
|
if(delay >= 0)
|
||||||
|
{
|
||||||
|
userDelay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
return userDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16 Op_UserWait(void)
|
||||||
|
{
|
||||||
|
userWait = 1;
|
||||||
|
if (currentScriptPtr->type == scriptType_PROC) {
|
||||||
|
changeScriptParamInList(currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber, &procHead, -1, 9999);
|
||||||
|
} else if (currentScriptPtr->type == scriptType_REL) {
|
||||||
|
changeScriptParamInList(currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber, &relHead, -1, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void setupOpcodeTable(void) {
|
void setupOpcodeTable(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1577,7 +1601,7 @@ void setupOpcodeTable(void) {
|
||||||
opcodeTablePtr[0x12] = NULL; // used to be exec debug
|
opcodeTablePtr[0x12] = NULL; // used to be exec debug
|
||||||
opcodeTablePtr[0x13] = Op_AddMessage;
|
opcodeTablePtr[0x13] = Op_AddMessage;
|
||||||
opcodeTablePtr[0x14] = Op_RemoveMessage;
|
opcodeTablePtr[0x14] = Op_RemoveMessage;
|
||||||
opcodeTablePtr[0x15] = NULL; // user wait
|
opcodeTablePtr[0x15] = Op_UserWait;
|
||||||
opcodeTablePtr[0x16] = Op_FreezeCell;
|
opcodeTablePtr[0x16] = Op_FreezeCell;
|
||||||
opcodeTablePtr[0x17] = Op_LoadCt;
|
opcodeTablePtr[0x17] = Op_LoadCt;
|
||||||
opcodeTablePtr[0x18] = Op_AddAnimation;
|
opcodeTablePtr[0x18] = Op_AddAnimation;
|
||||||
|
@ -1604,6 +1628,7 @@ void setupOpcodeTable(void) {
|
||||||
opcodeTablePtr[0x32] = Op_freeBackgroundInscrustList;
|
opcodeTablePtr[0x32] = Op_freeBackgroundInscrustList;
|
||||||
opcodeTablePtr[0x33] = Op_DialogOn;
|
opcodeTablePtr[0x33] = Op_DialogOn;
|
||||||
opcodeTablePtr[0x34] = Op_DialogOff;
|
opcodeTablePtr[0x34] = Op_DialogOff;
|
||||||
|
opcodeTablePtr[0x35] = Op_UserDelay;
|
||||||
opcodeTablePtr[0x37] = Op_37;
|
opcodeTablePtr[0x37] = Op_37;
|
||||||
opcodeTablePtr[0x38] = Op_removeBackground;
|
opcodeTablePtr[0x38] = Op_removeBackground;
|
||||||
opcodeTablePtr[0x39] = Op_SetActiveBackgroundPlane;
|
opcodeTablePtr[0x39] = Op_SetActiveBackgroundPlane;
|
||||||
|
|
|
@ -62,11 +62,10 @@ void outputBit(char *buffer, int bitPlaneNumber, uint8 data) {
|
||||||
*(buffer + (8000 * bitPlaneNumber)) = data;
|
*(buffer + (8000 * bitPlaneNumber)) = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxModuleData_field_60(char *sourcePtr, int width, int height,
|
void gfxModuleData_field_60(char *sourcePtr, int width, int height, char *destPtr, int x_, int y_) {
|
||||||
char *destPtr, int x_, int y_) {
|
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
for (int x = 0; x < width / 8; ++x) {
|
for (int x = 0; x < width; ++x) {
|
||||||
for (int bit = 0; bit < 16; ++bit) {
|
for (int bit = 0; bit < 16; ++bit) {
|
||||||
uint8 color = 0;
|
uint8 color = 0;
|
||||||
for (int p = 0; p < 4; ++p) {
|
for (int p = 0; p < 4; ++p) {
|
||||||
|
|
|
@ -738,6 +738,8 @@ int executeScripts(scriptInstanceStruct *ptr) {
|
||||||
}
|
}
|
||||||
} while (!opcodeTypeTable[(opcodeType & 0xFB) >> 3] ());
|
} while (!opcodeTypeTable[(opcodeType & 0xFB) >> 3] ());
|
||||||
|
|
||||||
|
currentScriptPtr = NULL;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue