aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge/builtin.cpp
diff options
context:
space:
mode:
authoryinsimei2017-05-27 20:16:54 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commit45dcfdfc0bad326800618d4d3edfd772d53c9fc6 (patch)
tree28ac6da0023fa94cb1c756ea77e50c1b2cbf9d6e /engines/sludge/builtin.cpp
parentf5b4cf680371b5b2098c766361b5efc6e0a68e91 (diff)
downloadscummvm-rg350-45dcfdfc0bad326800618d4d3edfd772d53c9fc6.tar.gz
scummvm-rg350-45dcfdfc0bad326800618d4d3edfd772d53c9fc6.tar.bz2
scummvm-rg350-45dcfdfc0bad326800618d4d3edfd772d53c9fc6.zip
SLUDGE: Replace standard file reading functions by Common functions
Diffstat (limited to 'engines/sludge/builtin.cpp')
-rw-r--r--engines/sludge/builtin.cpp1189
1 files changed, 594 insertions, 595 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 6f2660db0d..5d5c0fa3cf 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -99,11 +99,11 @@ extern unsigned int currentBlankColour;
extern unsigned int languageID;
extern unsigned char currentBurnR, currentBurnG, currentBurnB;
-int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY -> MOVEMOUSE
- -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS -> REMOVEREGION
- 2, 2, 0, 0, 2, // ANIMATE -> SETSCALE
+int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY->MOVEMOUSE
+ -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION
+ 2, 2, 0, 0, 2, // ANIMATE->SETSCALE
-1, 2, 1, 0, 0, 0, 1, 0, 3, // new/push/pop stack, status stuff
- 2, 0, 0, 3, 1, 0, 2, // delFromStack -> completeTimers
+ 2, 0, 0, 3, 1, 0, 2, // delFromStack->completeTimers
-1, -1, -1, 2, 2, 0, 3, 1, // anim, costume, pO, setC, wait, sS, substring, stringLength
0, 1, 1, 0, 2, // dark, save, load, quit, rename
1, 3, 3, 1, 2, 1, 1, 3, 1, 0, 0, 2, 1, // stackSize, pasteString, startMusic, defvol, vol, stopmus, stopsound, setfont, alignStatus, show x 2, pos'Status, setFloor
@@ -166,20 +166,20 @@ static builtReturn sayCore(int numParams, loadedFunction *fun, bool sayIt) {
switch (numParams) {
case 3:
- if (!getValueType(fileNum, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNum, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
// No break; here
case 2:
- newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ newText = getTextFromAnyVar(fun->stack->thisVar);
if (!newText) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objT, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ if (!getValueType(objT, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
p = wrapSpeech(newText, objT, fileNum, sayIt);
- fun -> timeLeft = p;
+ fun->timeLeft = p;
//debugOut ("BUILTIN: sayCore: %s (%i)\n", newText, p);
- fun -> isSpeech = true;
+ fun->isSpeech = true;
delete newText;
newText = NULL;
return BR_KEEP_AND_PAUSE;
@@ -206,7 +206,7 @@ builtIn(freeze) {
UNUSEDALL
freeze();
freezeSubs();
- fun -> freezerLevel = 0;
+ fun->freezerLevel = 0;
return BR_CONTINUE;
}
@@ -219,63 +219,63 @@ builtIn(unfreeze) {
builtIn(howFrozen) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, howFrozen());
+ setVariable(fun->reg, SVT_INT, howFrozen());
return BR_CONTINUE;
}
builtIn(setCursor) {
UNUSEDALL
- personaAnimation *aa = getAnimationFromVar(fun -> stack -> thisVar);
+ personaAnimation *aa = getAnimationFromVar(fun->stack->thisVar);
pickAnimCursor(aa);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(getMouseX) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, input.mouseX + cameraX);
+ setVariable(fun->reg, SVT_INT, input.mouseX + cameraX);
return BR_CONTINUE;
}
builtIn(getMouseY) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, input.mouseY + cameraY);
+ setVariable(fun->reg, SVT_INT, input.mouseY + cameraY);
return BR_CONTINUE;
}
builtIn(getMouseScreenX) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, input.mouseX * cameraZoom);
+ setVariable(fun->reg, SVT_INT, input.mouseX * cameraZoom);
return BR_CONTINUE;
}
builtIn(getMouseScreenY) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, input.mouseY * cameraZoom);
+ setVariable(fun->reg, SVT_INT, input.mouseY * cameraZoom);
return BR_CONTINUE;
}
builtIn(getStatusText) {
UNUSEDALL
- makeTextVar(fun -> reg, statusBarText());
+ makeTextVar(fun->reg, statusBarText());
return BR_CONTINUE;
}
builtIn(getMatchingFiles) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
if (!newText) return BR_ERROR;
- trimStack(fun -> stack);
- unlinkVar(fun -> reg);
+ trimStack(fun->stack);
+ unlinkVar(fun->reg);
// Return value
- fun -> reg.varType = SVT_STACK;
- fun -> reg.varData.theStack = new stackHandler;
- if (!checkNew(fun -> reg.varData.theStack)) return BR_ERROR;
- fun -> reg.varData.theStack -> first = NULL;
- fun -> reg.varData.theStack -> last = NULL;
- fun -> reg.varData.theStack -> timesUsed = 1;
- if (!getSavedGamesStack(fun -> reg.varData.theStack, newText)) return BR_ERROR;
+ fun->reg.varType = SVT_STACK;
+ fun->reg.varData.theStack = new stackHandler;
+ if (!checkNew(fun->reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varData.theStack->first = NULL;
+ fun->reg.varData.theStack->last = NULL;
+ fun->reg.varData.theStack->timesUsed = 1;
+ if (!getSavedGamesStack(fun->reg.varData.theStack, newText)) return BR_ERROR;
delete newText;
newText = NULL;
return BR_CONTINUE;
@@ -288,8 +288,8 @@ builtIn(saveGame) {
fatal("Can't save game state while the engine is frozen");
}
- loadNow = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ loadNow = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
char *aaaaa = encodeFilename(loadNow);
delete[] loadNow;
@@ -298,15 +298,15 @@ builtIn(saveGame) {
loadNow = joinStrings(":", aaaaa);
delete[] aaaaa;
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
saverFunc = fun;
return BR_KEEP_AND_PAUSE;
}
builtIn(fileExists) {
UNUSEDALL
- loadNow = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ loadNow = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
char *aaaaa = encodeFilename(loadNow);
delete loadNow;
if (failSecurityCheck(aaaaa)) return BR_ERROR;
@@ -328,7 +328,7 @@ builtIn(fileExists) {
}
#endif
// Return value
- setVariable(fun -> reg, SVT_INT, 0/*(fp != NULL)*/);//TODO:false value
+ setVariable(fun->reg, SVT_INT, 0/*(fp != NULL)*/);//TODO:false value
#if 0
if (fp) fclose(fp);
delete[] aaaaa;
@@ -339,24 +339,23 @@ builtIn(fileExists) {
builtIn(loadGame) {
UNUSEDALL
- char *aaaaa = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ char *aaaaa = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
loadNow = encodeFilename(aaaaa);
delete aaaaa;
if (frozenStuff) {
fatal("Can't load a saved game while the engine is frozen");
}
-#if ALLOW_FILE
if (failSecurityCheck(loadNow)) return BR_ERROR;
- FILE *fp = fopen(loadNow, "rb");
- if (fp) {
- fclose(fp);
+ Common::File fd;
+ if (fd.open(loadNow)) {
+ fd.close();
return BR_KEEP_AND_PAUSE;
}
delete loadNow;
loadNow = NULL;
-#endif
+
return BR_CONTINUE;
}
@@ -373,14 +372,14 @@ builtIn(blankScreen) {
builtIn(blankArea) {
UNUSEDALL
int x1, y1, x2, y2;
- if (!getValueType(y2, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x2, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(y1, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x1, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y2, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x2, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(y1, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x1, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
blankScreen(x1, y1, x2, y2);
return BR_CONTINUE;
}
@@ -394,12 +393,12 @@ builtIn(darkBackground) {
builtIn(addOverlay) {
UNUSEDALL
int fileNumber, xPos, yPos;
- if (!getValueType(yPos, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(xPos, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(yPos, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(xPos, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
loadBackDrop(fileNumber, xPos, yPos);
return BR_CONTINUE;
}
@@ -407,12 +406,12 @@ builtIn(addOverlay) {
builtIn(mixOverlay) {
UNUSEDALL
int fileNumber, xPos, yPos;
- if (!getValueType(yPos, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(xPos, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(yPos, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(xPos, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
mixBackDrop(fileNumber, xPos, yPos);
return BR_CONTINUE;
}
@@ -420,12 +419,12 @@ builtIn(mixOverlay) {
builtIn(pasteImage) {
UNUSEDALL
int x, y;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- personaAnimation *pp = getAnimationFromVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ personaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
+ trimStack(fun->stack);
if (pp == NULL) return BR_CONTINUE;
pasteCursor(x, y, pp);
@@ -438,10 +437,10 @@ builtIn(pasteImage) {
builtIn(setSceneDimensions) {
UNUSEDALL
int x, y;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (resizeBackdrop(x, y)) {
blankScreen(0, 0, x, y);
return BR_CONTINUE;
@@ -452,10 +451,10 @@ builtIn(setSceneDimensions) {
builtIn(aimCamera) {
UNUSEDALL
- if (!getValueType(cameraY, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(cameraX, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(cameraY, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(cameraX, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
cameraX -= (float)(winWidth >> 1) / cameraZoom;
cameraY -= (float)(winHeight >> 1) / cameraZoom;
@@ -471,8 +470,8 @@ builtIn(aimCamera) {
builtIn(zoomCamera) {
UNUSEDALL
int z;
- if (!getValueType(z, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(z, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
input.mouseX = input.mouseX * cameraZoom;
input.mouseY = input.mouseY * cameraZoom;
@@ -507,8 +506,8 @@ builtIn(pickOne) {
// Return value
while (numParams --) {
- if (i == numParams) copyVariable(fun -> stack -> thisVar, fun -> reg);
- trimStack(fun -> stack);
+ if (i == numParams) copyVariable(fun->stack->thisVar, fun->reg);
+ trimStack(fun->stack);
}
return BR_CONTINUE;
}
@@ -521,12 +520,12 @@ builtIn(substring) {
//debugOut ("BUILTIN: substring\n");
- if (!getValueType(length, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(start, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- wholeString = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ if (!getValueType(length, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(start, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ wholeString = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
if (u8_strlen(wholeString) < start + length) {
length = u8_strlen(wholeString) - start;
@@ -549,37 +548,37 @@ builtIn(substring) {
memcpy(newString, wholeString + startoffset, endoffset - startoffset);
newString[endoffset - startoffset] = 0;
- makeTextVar(fun -> reg, newString);
+ makeTextVar(fun->reg, newString);
delete newString;
return BR_CONTINUE;
}
builtIn(stringLength) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, stringLength(newText));
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, stringLength(newText));
delete[] newText;
return BR_CONTINUE;
}
builtIn(newStack) {
UNUSEDALL
- unlinkVar(fun -> reg);
+ unlinkVar(fun->reg);
// Return value
- fun -> reg.varType = SVT_STACK;
- fun -> reg.varData.theStack = new stackHandler;
- if (!checkNew(fun -> reg.varData.theStack)) return BR_ERROR;
- fun -> reg.varData.theStack -> first = NULL;
- fun -> reg.varData.theStack -> last = NULL;
- fun -> reg.varData.theStack -> timesUsed = 1;
+ fun->reg.varType = SVT_STACK;
+ fun->reg.varData.theStack = new stackHandler;
+ if (!checkNew(fun->reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varData.theStack->first = NULL;
+ fun->reg.varData.theStack->last = NULL;
+ fun->reg.varData.theStack->timesUsed = 1;
while (numParams --) {
- if (!addVarToStack(fun -> stack -> thisVar, fun -> reg.varData.theStack -> first)) return BR_ERROR;
- if (fun -> reg.varData.theStack -> last == NULL) {
- fun -> reg.varData.theStack -> last = fun -> reg.varData.theStack -> first;
+ if (!addVarToStack(fun->stack->thisVar, fun->reg.varData.theStack->first)) return BR_ERROR;
+ if (fun->reg.varData.theStack->last == NULL) {
+ fun->reg.varData.theStack->last = fun->reg.varData.theStack->first;
}
- trimStack(fun -> stack);
+ trimStack(fun->stack);
}
return BR_CONTINUE;
}
@@ -589,17 +588,17 @@ builtIn(newStack) {
builtIn(stackSize) {
UNUSEDALL
- switch (fun -> stack -> thisVar.varType) {
+ switch (fun->stack->thisVar.varType) {
case SVT_STACK:
// Return value
- setVariable(fun -> reg, SVT_INT, stackSize(fun -> stack -> thisVar.varData.theStack));
- trimStack(fun -> stack);
+ setVariable(fun->reg, SVT_INT, stackSize(fun->stack->thisVar.varData.theStack));
+ trimStack(fun->stack);
return BR_CONTINUE;
case SVT_FASTARRAY:
// Return value
- setVariable(fun -> reg, SVT_INT, fun -> stack -> thisVar.varData.fastArray -> size);
- trimStack(fun -> stack);
+ setVariable(fun->reg, SVT_INT, fun->stack->thisVar.varData.fastArray->size);
+ trimStack(fun->stack);
return BR_CONTINUE;
default:
@@ -611,147 +610,147 @@ builtIn(stackSize) {
builtIn(copyStack) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
// Return value
- if (!copyStack(fun -> stack -> thisVar, fun -> reg)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!copyStack(fun->stack->thisVar, fun->reg)) return BR_ERROR;
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(pushToStack) {
UNUSEDALL
- if (fun -> stack -> next -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->next->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack");
return BR_ERROR;
}
- if (!addVarToStack(fun -> stack -> thisVar, fun -> stack -> next -> thisVar.varData.theStack -> first))
+ if (!addVarToStack(fun->stack->thisVar, fun->stack->next->thisVar.varData.theStack->first))
return BR_ERROR;
- if (fun -> stack -> next -> thisVar.varData.theStack -> first -> next == NULL)
- fun -> stack -> next -> thisVar.varData.theStack -> last = fun -> stack -> next -> thisVar.varData.theStack -> first;
+ if (fun->stack->next->thisVar.varData.theStack->first->next == NULL)
+ fun->stack->next->thisVar.varData.theStack->last = fun->stack->next->thisVar.varData.theStack->first;
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(enqueue) {
UNUSEDALL
- if (fun -> stack -> next -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->next->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack");
return BR_ERROR;
}
- if (fun -> stack -> next -> thisVar.varData.theStack -> first == NULL) {
- if (!addVarToStack(fun -> stack -> thisVar, fun -> stack -> next -> thisVar.varData.theStack -> first))
+ if (fun->stack->next->thisVar.varData.theStack->first == NULL) {
+ if (!addVarToStack(fun->stack->thisVar, fun->stack->next->thisVar.varData.theStack->first))
return BR_ERROR;
- fun -> stack -> next -> thisVar.varData.theStack -> last = fun -> stack -> next -> thisVar.varData.theStack -> first;
+ fun->stack->next->thisVar.varData.theStack->last = fun->stack->next->thisVar.varData.theStack->first;
} else {
- if (!addVarToStack(fun -> stack -> thisVar,
- fun -> stack -> next -> thisVar.varData.theStack -> last -> next))
+ if (!addVarToStack(fun->stack->thisVar,
+ fun->stack->next->thisVar.varData.theStack->last->next))
return BR_ERROR;
- fun -> stack -> next -> thisVar.varData.theStack -> last = fun -> stack -> next -> thisVar.varData.theStack -> last -> next;
+ fun->stack->next->thisVar.varData.theStack->last = fun->stack->next->thisVar.varData.theStack->last->next;
}
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(deleteFromStack) {
UNUSEDALL
- if (fun -> stack -> next -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->next->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
// Return value
- setVariable(fun -> reg, SVT_INT,
- deleteVarFromStack(fun -> stack -> thisVar,
- fun -> stack -> next -> thisVar.varData.theStack -> first, false));
+ setVariable(fun->reg, SVT_INT,
+ deleteVarFromStack(fun->stack->thisVar,
+ fun->stack->next->thisVar.varData.theStack->first, false));
// Horrible hacking because 'last' value might now be wrong!
fun->stack->next->thisVar.varData.theStack->last = stackFindLast(fun->stack->next->thisVar.varData.theStack->first);
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(deleteAllFromStack) {
UNUSEDALL
- if (fun -> stack -> next -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->next->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
// Return value
- setVariable(fun -> reg, SVT_INT,
- deleteVarFromStack(fun -> stack -> thisVar,
- fun -> stack -> next -> thisVar.varData.theStack -> first, true));
+ setVariable(fun->reg, SVT_INT,
+ deleteVarFromStack(fun->stack->thisVar,
+ fun->stack->next->thisVar.varData.theStack->first, true));
// Horrible hacking because 'last' value might now be wrong!
fun->stack->next->thisVar.varData.theStack->last = stackFindLast(fun->stack->next->thisVar.varData.theStack->first);
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(popFromStack) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
- if (fun -> stack -> thisVar.varData.theStack -> first == NULL) {
+ if (fun->stack->thisVar.varData.theStack->first == NULL) {
fatal("The stack's empty.");
return BR_ERROR;
}
// Return value
- copyVariable(fun -> stack -> thisVar.varData.theStack -> first -> thisVar, fun -> reg);
- trimStack(fun -> stack -> thisVar.varData.theStack -> first);
- trimStack(fun -> stack);
+ copyVariable(fun->stack->thisVar.varData.theStack->first->thisVar, fun->reg);
+ trimStack(fun->stack->thisVar.varData.theStack->first);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(peekStart) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
- if (fun -> stack -> thisVar.varData.theStack -> first == NULL) {
+ if (fun->stack->thisVar.varData.theStack->first == NULL) {
fatal("The stack's empty.");
return BR_ERROR;
}
// Return value
- copyVariable(fun -> stack -> thisVar.varData.theStack -> first -> thisVar, fun -> reg);
- trimStack(fun -> stack);
+ copyVariable(fun->stack->thisVar.varData.theStack->first->thisVar, fun->reg);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(peekEnd) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->thisVar.varType != SVT_STACK) {
fatal("Parameter isn't a stack.");
return BR_ERROR;
}
- if (fun -> stack -> thisVar.varData.theStack -> first == NULL) {
+ if (fun->stack->thisVar.varData.theStack->first == NULL) {
fatal("The stack's empty.");
return BR_ERROR;
}
// Return value
- copyVariable(fun -> stack -> thisVar.varData.theStack -> last -> thisVar, fun -> reg);
- trimStack(fun -> stack);
+ copyVariable(fun->stack->thisVar.varData.theStack->last->thisVar, fun->reg);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
@@ -759,22 +758,22 @@ builtIn(random) {
UNUSEDALL
int num;
- if (!getValueType(num, SVT_INT, fun -> stack -> thisVar))
+ if (!getValueType(num, SVT_INT, fun->stack->thisVar))
return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
if (num <= 0) num = 1;
- setVariable(fun -> reg, SVT_INT, 0 /*rand() % num*/); //TODO:false value
+ setVariable(fun->reg, SVT_INT, 0 /*rand() % num*/); //TODO:false value
return BR_CONTINUE;
}
static bool getRGBParams(int &red, int &green, int &blue, loadedFunction *fun) {
- if (!getValueType(blue, SVT_INT, fun -> stack -> thisVar)) return false;
- trimStack(fun -> stack);
- if (!getValueType(green, SVT_INT, fun -> stack -> thisVar)) return false;
- trimStack(fun -> stack);
- if (!getValueType(red, SVT_INT, fun -> stack -> thisVar)) return false;
- trimStack(fun -> stack);
+ if (!getValueType(blue, SVT_INT, fun->stack->thisVar)) return false;
+ trimStack(fun->stack);
+ if (!getValueType(green, SVT_INT, fun->stack->thisVar)) return false;
+ trimStack(fun->stack);
+ if (!getValueType(red, SVT_INT, fun->stack->thisVar)) return false;
+ trimStack(fun->stack);
return true;
}
@@ -819,7 +818,7 @@ builtIn(setBlankColour) {
return BR_ERROR;
currentBlankColour = makeColour(red & 255, green & 255, blue & 255);
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
@@ -833,7 +832,7 @@ builtIn(setBurnColour) {
currentBurnR = red;
currentBurnG = green;
currentBurnB = blue;
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
@@ -841,16 +840,16 @@ builtIn(setBurnColour) {
builtIn(setFont) {
UNUSEDALL
int fileNumber, newHeight;
- if (!getValueType(newHeight, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
+ if (!getValueType(newHeight, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
// newDebug (" Height:", newHeight);
- trimStack(fun -> stack);
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ trimStack(fun->stack);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
if (!newText) return BR_ERROR;
// newDebug (" Character supported:", newText);
- trimStack(fun -> stack);
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
// newDebug (" File:", fileNumber);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
if (!loadFont(fileNumber, newText, newHeight)) return BR_ERROR;
// newDebug (" Done!");
delete newText;
@@ -860,25 +859,25 @@ builtIn(setFont) {
builtIn(inFont) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
if (!newText) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
// Return value
- setVariable(fun -> reg, SVT_INT, isInFont(newText));
+ setVariable(fun->reg, SVT_INT, isInFont(newText));
return BR_CONTINUE;
}
builtIn(pasteString) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
int y, x;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (x == IN_THE_CENTRE) x = (winWidth - stringWidth(newText)) >> 1;
fixFont(pastePalette);
pasteStringToBackdrop(newText, x, y, pastePalette);
@@ -894,12 +893,12 @@ builtIn(anim) {
}
// First store the frame numbers and take 'em off the stack
- personaAnimation *ba = createPersonaAnim(numParams - 1, fun -> stack);
+ personaAnimation *ba = createPersonaAnim(numParams - 1, fun->stack);
// Only remaining paramter is the file number
int fileNumber;
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
// Load the required sprite bank
loadedSpriteBank *sprBanky = loadBankForAnim(fileNumber);
@@ -907,7 +906,7 @@ builtIn(anim) {
setBankFile(ba, sprBanky);
// Return value
- newAnimationVariable(fun -> reg, ba);
+ newAnimationVariable(fun->reg, ba);
return BR_CONTINUE;
}
@@ -916,32 +915,32 @@ builtIn(costume) {
UNUSEDALL
persona *newPersona = new persona;
if (!checkNew(newPersona)) return BR_ERROR;
- newPersona -> numDirections = numParams / 3;
- if (numParams == 0 || newPersona -> numDirections * 3 != numParams) {
+ newPersona->numDirections = numParams / 3;
+ if (numParams == 0 || newPersona->numDirections * 3 != numParams) {
fatal("Illegal number of parameters (should be greater than 0 and divisible by 3)");
return BR_ERROR;
}
int iii;
- newPersona -> animation = new personaAnimation * [numParams];
- if (!checkNew(newPersona -> animation)) return BR_ERROR;
+ newPersona->animation = new personaAnimation * [numParams];
+ if (!checkNew(newPersona->animation)) return BR_ERROR;
for (iii = numParams - 1; iii >= 0; iii --) {
- newPersona -> animation[iii] = getAnimationFromVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ newPersona->animation[iii] = getAnimationFromVar(fun->stack->thisVar);
+ trimStack(fun->stack);
}
// Return value
- newCostumeVariable(fun -> reg, newPersona);
+ newCostumeVariable(fun->reg, newPersona);
return BR_CONTINUE;
}
builtIn(launch) {
UNUSEDALL
- char *newTextA = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newTextA = getTextFromAnyVar(fun->stack->thisVar);
if (!newTextA) return BR_ERROR;
char *newText = encodeFilename(newTextA);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
if (newTextA[0] == 'h' &&
newTextA[1] == 't' &&
newTextA[2] == 't' &&
@@ -963,7 +962,7 @@ builtIn(launch) {
}
delete newTextA;
setGraphicsWindow(false);
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
launchResult = &fun->reg;
return BR_KEEP_AND_PAUSE;
@@ -972,11 +971,11 @@ builtIn(launch) {
builtIn(pause) {
UNUSEDALL
int theTime;
- if (!getValueType(theTime, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(theTime, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (theTime > 0) {
- fun -> timeLeft = theTime - 1;
- fun -> isSpeech = false;
+ fun->timeLeft = theTime - 1;
+ fun->isSpeech = false;
return BR_KEEP_AND_PAUSE;
}
return BR_CONTINUE;
@@ -991,19 +990,19 @@ builtIn(completeTimers) {
builtIn(callEvent) {
UNUSEDALL
int obj1, obj2;
- if (!getValueType(obj2, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj1, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(obj2, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj1, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
int fNum = getCombinationFunction(obj1, obj2);
// Return value
if (fNum) {
- setVariable(fun -> reg, SVT_FUNC, fNum);
+ setVariable(fun->reg, SVT_FUNC, fNum);
return BR_CALLAFUNC;
}
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
@@ -1030,19 +1029,19 @@ builtIn(quitGame) {
// The old movie functions are deprecated and does nothing.
builtIn(_rem_movieStart) {
UNUSEDALL
- trimStack(fun -> stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
builtIn(_rem_movieAbort) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
builtIn(_rem_moviePlaying) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
@@ -1052,12 +1051,12 @@ builtIn(playMovie) {
if (movieIsPlaying) return BR_PAUSE;
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
r = playMovie(fileNumber);
- setVariable(fun -> reg, SVT_INT, r);
+ setVariable(fun->reg, SVT_INT, r);
if (r && (!fun->next)) {
restartFunction(fun);
@@ -1072,7 +1071,7 @@ builtIn(stopMovie) {
r = stopMovie();
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
@@ -1082,7 +1081,7 @@ builtIn(pauseMovie) {
r = pauseMovie();
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
@@ -1093,12 +1092,12 @@ builtIn(pauseMovie) {
builtIn(startMusic) {
UNUSEDALL
int fromTrack, musChan, fileNumber;
- if (!getValueType(fromTrack, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(musChan, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fromTrack, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(musChan, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (!playMOD(fileNumber, musChan, fromTrack)) return BR_CONTINUE; //BR_ERROR;
return BR_CONTINUE;
}
@@ -1106,8 +1105,8 @@ builtIn(startMusic) {
builtIn(stopMusic) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
stopMOD(v);
return BR_CONTINUE;
}
@@ -1115,10 +1114,10 @@ builtIn(stopMusic) {
builtIn(setMusicVolume) {
UNUSEDALL
int musChan, v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(musChan, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(musChan, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setMusicVolume(musChan, v);
return BR_CONTINUE;
}
@@ -1126,8 +1125,8 @@ builtIn(setMusicVolume) {
builtIn(setDefaultMusicVolume) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setDefaultMusicVolume(v);
return BR_CONTINUE;
}
@@ -1135,8 +1134,8 @@ builtIn(setDefaultMusicVolume) {
builtIn(playSound) {
UNUSEDALL
int fileNumber;
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (!startSound(fileNumber, false)) return BR_CONTINUE; // Was BR_ERROR
return BR_CONTINUE;
}
@@ -1149,8 +1148,8 @@ builtIn(loopSound) {
return BR_ERROR;
} else if (numParams < 2) {
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (!startSound(fileNumber, true)) return BR_CONTINUE; // Was BR_ERROR
return BR_CONTINUE;
} else {
@@ -1162,12 +1161,12 @@ builtIn(loopSound) {
// Should we loop?
if (fun->stack->thisVar.varType != SVT_FILE) {
- getValueType(doLoop, SVT_INT, fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ getValueType(doLoop, SVT_INT, fun->stack->thisVar);
+ trimStack(fun->stack);
numParams--;
}
while (numParams) {
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) {
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) {
fatal("Illegal parameter given built-in function loopSound().");
return BR_ERROR;
}
@@ -1198,8 +1197,8 @@ builtIn(loopSound) {
builtIn(stopSound) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
huntKillSound(v);
return BR_CONTINUE;
}
@@ -1207,8 +1206,8 @@ builtIn(stopSound) {
builtIn(setDefaultSoundVolume) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setDefaultSoundVolume(v);
return BR_CONTINUE;
}
@@ -1216,10 +1215,10 @@ builtIn(setDefaultSoundVolume) {
builtIn(setSoundVolume) {
UNUSEDALL
int musChan, v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(musChan, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(musChan, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setSoundVolume(musChan, v);
return BR_CONTINUE;
}
@@ -1228,12 +1227,12 @@ builtIn(setSoundVolume) {
builtIn(setSoundLoopPoints) {
UNUSEDALL
int musChan, theEnd, theStart;
- if (!getValueType(theEnd, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(theStart, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(musChan, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(theEnd, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(theStart, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(musChan, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setSoundLoop(musChan, theStart, theEnd);
return BR_CONTINUE;
}
@@ -1243,13 +1242,13 @@ builtIn(setSoundLoopPoints) {
builtIn(setFloor) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType == SVT_FILE) {
+ if (fun->stack->thisVar.varType == SVT_FILE) {
int v;
- getValueType(v, SVT_FILE, fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ getValueType(v, SVT_FILE, fun->stack->thisVar);
+ trimStack(fun->stack);
if (!setFloor(v)) return BR_ERROR;
} else {
- trimStack(fun -> stack);
+ trimStack(fun->stack);
setFloorNull();
}
return BR_CONTINUE;
@@ -1263,13 +1262,13 @@ builtIn(showFloor) {
builtIn(setZBuffer) {
UNUSEDALL
- if (fun -> stack -> thisVar.varType == SVT_FILE) {
+ if (fun->stack->thisVar.varType == SVT_FILE) {
int v;
- getValueType(v, SVT_FILE, fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ getValueType(v, SVT_FILE, fun->stack->thisVar);
+ trimStack(fun->stack);
if (!setZBuffer(v)) return BR_ERROR;
} else {
- trimStack(fun -> stack);
+ trimStack(fun->stack);
killZBuffer();
}
return BR_CONTINUE;
@@ -1279,22 +1278,22 @@ builtIn(setLightMap) {
UNUSEDALL
switch (numParams) {
case 2:
- if (!getValueType(lightMapMode, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(lightMapMode, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
lightMapMode %= LIGHTMAPMODE_NUM;
// No break;
case 1:
- if (fun -> stack -> thisVar.varType == SVT_FILE) {
+ if (fun->stack->thisVar.varType == SVT_FILE) {
int v;
- getValueType(v, SVT_FILE, fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ getValueType(v, SVT_FILE, fun->stack->thisVar);
+ trimStack(fun->stack);
if (!loadLightMap(v)) return BR_ERROR;
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
} else {
- trimStack(fun -> stack);
+ trimStack(fun->stack);
killLightMap();
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
break;
@@ -1311,8 +1310,8 @@ builtIn(setLightMap) {
builtIn(setSpeechMode) {
UNUSEDALL
- if (!getValueType(speechMode, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(speechMode, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (speechMode < 0 || speechMode > 2) {
fatal("Valid parameters are be SPEECHANDTEXT, SPEECHONLY or TEXTONLY");
return BR_ERROR;
@@ -1324,9 +1323,9 @@ builtIn(somethingSpeaking) {
UNUSEDALL
int i = isThereAnySpeechGoingOn();
if (i == -1) {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
} else {
- setVariable(fun -> reg, SVT_OBJTYPE, i);
+ setVariable(fun->reg, SVT_OBJTYPE, i);
}
return BR_CONTINUE;
}
@@ -1341,42 +1340,42 @@ builtIn(getOverObject) {
UNUSEDALL
if (overRegion)
// Return value
- setVariable(fun -> reg, SVT_OBJTYPE, overRegion -> thisType -> objectNum);
+ setVariable(fun->reg, SVT_OBJTYPE, overRegion->thisType->objectNum);
else
// Return value
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
builtIn(rename) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
int objT;
if (!newText) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objT, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ if (!getValueType(objT, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
objectType *o = findObjectType(objT);
- delete o -> screenName;
- o -> screenName = newText;
+ delete o->screenName;
+ o->screenName = newText;
return BR_CONTINUE;
}
builtIn(getObjectX) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *pers = findPerson(objectNumber);
if (pers) {
- setVariable(fun -> reg, SVT_INT, pers -> x);
+ setVariable(fun->reg, SVT_INT, pers->x);
} else {
screenRegion *la = getRegionForObject(objectNumber);
if (la) {
- setVariable(fun -> reg, SVT_INT, la -> sX);
+ setVariable(fun->reg, SVT_INT, la->sX);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
}
return BR_CONTINUE;
@@ -1385,18 +1384,18 @@ builtIn(getObjectX) {
builtIn(getObjectY) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *pers = findPerson(objectNumber);
if (pers) {
- setVariable(fun -> reg, SVT_INT, pers -> y);
+ setVariable(fun->reg, SVT_INT, pers->y);
} else {
screenRegion *la = getRegionForObject(objectNumber);
if (la) {
- setVariable(fun -> reg, SVT_INT, la -> sY);
+ setVariable(fun->reg, SVT_INT, la->sY);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
}
return BR_CONTINUE;
@@ -1406,22 +1405,22 @@ builtIn(getObjectY) {
builtIn(addScreenRegion) {
UNUSEDALL
int sX, sY, x1, y1, x2, y2, di, objectNumber;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(sY, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(sX, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(y2, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x2, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(y1, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x1, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(sY, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(sX, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(y2, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x2, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(y1, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x1, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (addScreenRegion(x1, y1, x2, y2, sX, sY, di, objectNumber)) return BR_CONTINUE;
return BR_ERROR;
@@ -1430,8 +1429,8 @@ builtIn(addScreenRegion) {
builtIn(removeScreenRegion) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
removeScreenRegion(objectNumber);
return BR_CONTINUE;
}
@@ -1453,16 +1452,16 @@ builtIn(addCharacter) {
persona *p;
int x, y, objectNumber;
- p = getCostumeFromVar(fun -> stack -> thisVar);
+ p = getCostumeFromVar(fun->stack->thisVar);
if (p == NULL) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (addPerson(x, y, objectNumber, p)) return BR_CONTINUE;
return BR_ERROR;
}
@@ -1470,8 +1469,8 @@ builtIn(addCharacter) {
builtIn(hideCharacter) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setShown(false, objectNumber);
return BR_CONTINUE;
}
@@ -1479,8 +1478,8 @@ builtIn(hideCharacter) {
builtIn(showCharacter) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setShown(true, objectNumber);
return BR_CONTINUE;
}
@@ -1495,36 +1494,36 @@ builtIn(removeAllCharacters) {
builtIn(setCharacterDrawMode) {
UNUSEDALL
int obj, di;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setDrawMode(di, obj);
return BR_CONTINUE;
}
builtIn(setCharacterTransparency) {
UNUSEDALL
int obj, x;
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setPersonTransparency(obj, x);
return BR_CONTINUE;
}
builtIn(setCharacterColourise) {
UNUSEDALL
int obj, r, g, b, mix;
- if (!getValueType(mix, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(b, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(g, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(r, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(mix, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(b, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(g, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(r, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setPersonColourise(obj, r, g, b, mix);
return BR_CONTINUE;
}
@@ -1532,10 +1531,10 @@ builtIn(setCharacterColourise) {
builtIn(setScale) {
UNUSEDALL
int val1, val2;
- if (!getValueType(val2, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(val1, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(val2, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(val1, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setScale((short int) val1, (short int) val2);
return BR_CONTINUE;
}
@@ -1543,35 +1542,35 @@ builtIn(setScale) {
builtIn(stopCharacter) {
UNUSEDALL
int obj;
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
// Return value
- setVariable(fun -> reg, SVT_INT, stopPerson(obj));
+ setVariable(fun->reg, SVT_INT, stopPerson(obj));
return BR_CONTINUE;
}
builtIn(pasteCharacter) {
UNUSEDALL
int obj;
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(obj);
if (thisPerson) {
personaAnimation *myAnim;
- myAnim = thisPerson -> myAnim;
- if (myAnim != thisPerson -> lastUsedAnim) {
- thisPerson -> lastUsedAnim = myAnim;
- thisPerson -> frameNum = 0;
- thisPerson -> frameTick = myAnim -> frames[0].howMany;
+ myAnim = thisPerson->myAnim;
+ if (myAnim != thisPerson->lastUsedAnim) {
+ thisPerson->lastUsedAnim = myAnim;
+ thisPerson->frameNum = 0;
+ thisPerson->frameTick = myAnim->frames[0].howMany;
}
- int fNum = myAnim -> frames[thisPerson -> frameNum].frameNum;
- fixScaleSprite(thisPerson -> x, thisPerson -> y, myAnim -> theSprites -> bank.sprites[abs(fNum)], myAnim -> theSprites -> bank.myPalette, thisPerson, 0, 0, fNum < 0);
- setVariable(fun -> reg, SVT_INT, 1);
+ int fNum = myAnim->frames[thisPerson->frameNum].frameNum;
+ fixScaleSprite(thisPerson->x, thisPerson->y, myAnim->theSprites->bank.sprites[abs(fNum)], myAnim->theSprites->bank.myPalette, thisPerson, 0, 0, fNum < 0);
+ setVariable(fun->reg, SVT_INT, 1);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -1579,24 +1578,24 @@ builtIn(pasteCharacter) {
builtIn(animate) {
UNUSEDALL
int obj;
- personaAnimation *pp = getAnimationFromVar(fun -> stack -> thisVar);
+ personaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
if (pp == NULL) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
animatePerson(obj, pp);
- setVariable(fun -> reg, SVT_INT, timeForAnim(pp));
+ setVariable(fun->reg, SVT_INT, timeForAnim(pp));
return BR_CONTINUE;
}
builtIn(setCostume) {
UNUSEDALL
int obj;
- persona *pp = getCostumeFromVar(fun -> stack -> thisVar);
+ persona *pp = getCostumeFromVar(fun->stack->thisVar);
if (pp == NULL) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
animatePerson(obj, pp);
return BR_CONTINUE;
}
@@ -1604,52 +1603,52 @@ builtIn(setCostume) {
builtIn(floatCharacter) {
UNUSEDALL
int obj, di;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, floatCharacter(di, obj));
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, floatCharacter(di, obj));
return BR_CONTINUE;
}
builtIn(setCharacterWalkSpeed) {
UNUSEDALL
int obj, di;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, setCharacterWalkSpeed(di, obj));
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, setCharacterWalkSpeed(di, obj));
return BR_CONTINUE;
}
builtIn(turnCharacter) {
UNUSEDALL
int obj, di;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, turnPersonToFace(obj, di));
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, turnPersonToFace(obj, di));
return BR_CONTINUE;
}
builtIn(setCharacterExtra) {
UNUSEDALL
int obj, di;
- if (!getValueType(di, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, setPersonExtra(obj, di));
+ if (!getValueType(di, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, setPersonExtra(obj, di));
return BR_CONTINUE;
}
builtIn(removeCharacter) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
removeOneCharacter(objectNumber);
return BR_CONTINUE;
}
@@ -1659,12 +1658,12 @@ static builtReturn moveChr(int numParams, loadedFunction *fun, bool force, bool
case 3: {
int x, y, objectNumber;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (force) {
if (forceWalkingPerson(x, y, objectNumber, fun, -1)) return BR_PAUSE;
@@ -1680,19 +1679,19 @@ static builtReturn moveChr(int numParams, loadedFunction *fun, bool force, bool
int toObj, objectNumber;
screenRegion *reggie;
- if (!getValueType(toObj, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(toObj, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
reggie = getRegionForObject(toObj);
if (reggie == NULL) return BR_CONTINUE;
if (force) {
- if (forceWalkingPerson(reggie -> sX, reggie -> sY, objectNumber, fun, reggie -> di)) return BR_PAUSE;
+ if (forceWalkingPerson(reggie->sX, reggie->sY, objectNumber, fun, reggie->di)) return BR_PAUSE;
} else if (immediate) {
- jumpPerson(reggie -> sX, reggie -> sY, objectNumber);
+ jumpPerson(reggie->sX, reggie->sY, objectNumber);
} else {
- if (makeWalkingPerson(reggie -> sX, reggie -> sY, objectNumber, fun, reggie -> di)) return BR_PAUSE;
+ if (makeWalkingPerson(reggie->sX, reggie->sY, objectNumber, fun, reggie->di)) return BR_PAUSE;
}
return BR_CONTINUE;
}
@@ -1738,9 +1737,9 @@ builtIn(addStatus) {
builtIn(statusText) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
if (!newText) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
setStatusBar(newText);
delete newText;
return BR_CONTINUE;
@@ -1749,8 +1748,8 @@ builtIn(statusText) {
builtIn(lightStatus) {
UNUSEDALL
int val;
- if (!getValueType(val, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(val, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
setLitStatus(val);
return BR_CONTINUE;
}
@@ -1758,10 +1757,10 @@ builtIn(lightStatus) {
builtIn(positionStatus) {
UNUSEDALL
int x, y;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
positionStatus(x, y);
return BR_CONTINUE;
}
@@ -1769,9 +1768,9 @@ builtIn(positionStatus) {
builtIn(alignStatus) {
UNUSEDALL
int val;
- if (!getValueType(val, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- nowStatus -> alignStatus = (short) val;
+ if (!getValueType(val, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ nowStatus->alignStatus = (short) val;
return BR_CONTINUE;
}
@@ -1782,8 +1781,8 @@ static bool getFuncNumForCallback(int numParams, loadedFunction *fun, int &funct
break;
case 1:
- if (!getValueType(functionNum, SVT_FUNC, fun -> stack -> thisVar)) return false;
- trimStack(fun -> stack);
+ if (!getValueType(functionNum, SVT_FUNC, fun->stack->thisVar)) return false;
+ trimStack(fun->stack);
break;
default:
@@ -1797,7 +1796,7 @@ builtIn(onLeftMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> leftMouseFunction = functionNum;
+ currentEvents->leftMouseFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1807,7 +1806,7 @@ builtIn(onLeftMouseUp) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> leftMouseUpFunction = functionNum;
+ currentEvents->leftMouseUpFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1817,7 +1816,7 @@ builtIn(onRightMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> rightMouseFunction = functionNum;
+ currentEvents->rightMouseFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1827,7 +1826,7 @@ builtIn(onRightMouseUp) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> rightMouseUpFunction = functionNum;
+ currentEvents->rightMouseUpFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1837,7 +1836,7 @@ builtIn(onFocusChange) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> focusFunction = functionNum;
+ currentEvents->focusFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1847,7 +1846,7 @@ builtIn(onMoveMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> moveMouseFunction = functionNum;
+ currentEvents->moveMouseFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1857,7 +1856,7 @@ builtIn(onKeyboard) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents -> spaceFunction = functionNum;
+ currentEvents->spaceFunction = functionNum;
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1890,12 +1889,12 @@ builtIn(cancelSub) {
builtIn(stringWidth) {
UNUSEDALL
- char *theText = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *theText = getTextFromAnyVar(fun->stack->thisVar);
if (!theText) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
// Return value
- setVariable(fun -> reg, SVT_INT, stringWidth(theText));
+ setVariable(fun->reg, SVT_INT, stringWidth(theText));
delete theText;
return BR_CONTINUE;
}
@@ -1903,8 +1902,8 @@ builtIn(stringWidth) {
builtIn(hardScroll) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
hardScroll(v);
return BR_CONTINUE;
}
@@ -1913,37 +1912,37 @@ builtIn(hardScroll) {
builtIn(isScreenRegion) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, getRegionForObject(objectNumber) != NULL);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, getRegionForObject(objectNumber) != NULL);
return BR_CONTINUE;
}
builtIn(setSpeechSpeed) {
UNUSEDALL
int number;
- if (!getValueType(number, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(number, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
speechSpeed = number * 0.01;
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
builtIn(setFontSpacing) {
UNUSEDALL
int fontSpaceI;
- if (!getValueType(fontSpaceI, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
+ if (!getValueType(fontSpaceI, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
fontSpace = fontSpaceI;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, 1);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
builtIn(transitionLevel) {
UNUSEDALL
int number;
- if (!getValueType(number, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(number, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (number < 0)
brightnessLevel = 0;
@@ -1952,15 +1951,15 @@ builtIn(transitionLevel) {
else
brightnessLevel = number;
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
builtIn(captureAllKeys) {
UNUSEDALL
- captureAllKeys = getBoolean(fun -> stack -> thisVar);
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, captureAllKeys);
+ captureAllKeys = getBoolean(fun->stack->thisVar);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, captureAllKeys);
return BR_CONTINUE;
}
@@ -1968,20 +1967,20 @@ builtIn(captureAllKeys) {
builtIn(spinCharacter) {
UNUSEDALL
int number, objectNumber;
- if (!getValueType(number, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(number, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
- thisPerson -> wantAngle = number;
- thisPerson -> spinning = true;
- thisPerson -> continueAfterWalking = fun;
- setVariable(fun -> reg, SVT_INT, 1);
+ thisPerson->wantAngle = number;
+ thisPerson->spinning = true;
+ thisPerson->continueAfterWalking = fun;
+ setVariable(fun->reg, SVT_INT, 1);
return BR_PAUSE;
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
}
@@ -1989,13 +1988,13 @@ builtIn(spinCharacter) {
builtIn(getCharacterDirection) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
- setVariable(fun -> reg, SVT_INT, thisPerson -> direction);
+ setVariable(fun->reg, SVT_INT, thisPerson->direction);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2003,24 +2002,24 @@ builtIn(getCharacterDirection) {
builtIn(isCharacter) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(objectNumber);
- setVariable(fun -> reg, SVT_INT, thisPerson != NULL);
+ setVariable(fun->reg, SVT_INT, thisPerson != NULL);
return BR_CONTINUE;
}
builtIn(normalCharacter) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
- thisPerson -> myAnim = thisPerson -> myPersona -> animation[thisPerson -> direction];
- setVariable(fun -> reg, SVT_INT, 1);
+ thisPerson->myAnim = thisPerson->myPersona->animation[thisPerson->direction];
+ setVariable(fun->reg, SVT_INT, 1);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2028,13 +2027,13 @@ builtIn(normalCharacter) {
builtIn(isMoving) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
- setVariable(fun -> reg, SVT_INT, thisPerson -> walking);
+ setVariable(fun->reg, SVT_INT, thisPerson->walking);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2042,18 +2041,18 @@ builtIn(isMoving) {
builtIn(fetchEvent) {
UNUSEDALL
int obj1, obj2;
- if (!getValueType(obj2, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(obj1, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(obj2, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(obj1, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
int fNum = getCombinationFunction(obj1, obj2);
// Return value
if (fNum) {
- setVariable(fun -> reg, SVT_FUNC, fNum);
+ setVariable(fun->reg, SVT_FUNC, fNum);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2061,12 +2060,12 @@ builtIn(fetchEvent) {
builtIn(deleteFile) {
UNUSEDALL
- char *namNormal = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ char *namNormal = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
char *nam = encodeFilename(namNormal);
delete namNormal;
if (failSecurityCheck(nam)) return BR_ERROR;
- setVariable(fun -> reg, SVT_INT, remove(nam));
+ setVariable(fun->reg, SVT_INT, remove(nam));
delete nam;
return BR_CONTINUE;
@@ -2076,19 +2075,19 @@ builtIn(renameFile) {
UNUSEDALL
char *temp;
- temp = getTextFromAnyVar(fun -> stack -> thisVar);
+ temp = getTextFromAnyVar(fun->stack->thisVar);
char *newnam = encodeFilename(temp);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
if (failSecurityCheck(newnam)) return BR_ERROR;
delete temp;
- temp = getTextFromAnyVar(fun -> stack -> thisVar);
+ temp = getTextFromAnyVar(fun->stack->thisVar);
char *nam = encodeFilename(temp);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
if (failSecurityCheck(nam)) return BR_ERROR;
delete temp;
- setVariable(fun -> reg, SVT_INT, rename(nam, newnam));
+ setVariable(fun->reg, SVT_INT, rename(nam, newnam));
delete nam;
delete newnam;
@@ -2099,21 +2098,21 @@ builtIn(renameFile) {
builtIn(cacheSound) {
UNUSEDALL
int fileNumber;
- if (!getValueType(fileNumber, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(fileNumber, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (cacheSound(fileNumber) == -1) return BR_ERROR;
return BR_CONTINUE;
}
builtIn(burnString) {
UNUSEDALL
- char *newText = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ char *newText = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
int y, x;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (x == IN_THE_CENTRE) x = (winWidth - stringWidth(newText)) >> 1;
fixFont(pastePalette);
burnStringToBackdrop(newText, x, y, pastePalette);
@@ -2124,18 +2123,18 @@ builtIn(burnString) {
builtIn(setCharacterSpinSpeed) {
UNUSEDALL
int speed, who;
- if (!getValueType(speed, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(who, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(speed, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(who, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(who);
if (thisPerson) {
- thisPerson -> spinSpeed = speed;
- setVariable(fun -> reg, SVT_INT, 1);
+ thisPerson->spinSpeed = speed;
+ setVariable(fun->reg, SVT_INT, 1);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2143,18 +2142,18 @@ builtIn(setCharacterSpinSpeed) {
builtIn(setCharacterAngleOffset) {
UNUSEDALL
int angle, who;
- if (!getValueType(angle, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(who, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(angle, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(who, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *thisPerson = findPerson(who);
if (thisPerson) {
- thisPerson -> angleOffset = angle;
- setVariable(fun -> reg, SVT_INT, 1);
+ thisPerson->angleOffset = angle;
+ setVariable(fun->reg, SVT_INT, 1);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
@@ -2163,10 +2162,10 @@ builtIn(setCharacterAngleOffset) {
builtIn(transitionMode) {
UNUSEDALL
int n;
- if (!getValueType(n, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
+ if (!getValueType(n, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
fadeMode = n;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, 1);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
@@ -2174,41 +2173,41 @@ builtIn(transitionMode) {
// Removed function - does nothing
builtIn(_rem_updateDisplay) {
UNUSEDALL
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, true);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, true);
return BR_CONTINUE;
}
builtIn(getSoundCache) {
UNUSEDALL
- fun -> reg.varType = SVT_STACK;
- fun -> reg.varData.theStack = new stackHandler;
- if (!checkNew(fun -> reg.varData.theStack)) return BR_ERROR;
- fun -> reg.varData.theStack -> first = NULL;
- fun -> reg.varData.theStack -> last = NULL;
- fun -> reg.varData.theStack -> timesUsed = 1;
- if (!getSoundCacheStack(fun -> reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varType = SVT_STACK;
+ fun->reg.varData.theStack = new stackHandler;
+ if (!checkNew(fun->reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varData.theStack->first = NULL;
+ fun->reg.varData.theStack->last = NULL;
+ fun->reg.varData.theStack->timesUsed = 1;
+ if (!getSoundCacheStack(fun->reg.varData.theStack)) return BR_ERROR;
return BR_CONTINUE;
}
builtIn(saveCustomData) {
UNUSEDALL
// saveCustomData (thisStack, fileName);
- char *fileNameB = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *fileNameB = getTextFromAnyVar(fun->stack->thisVar);
if (!checkNew(fileNameB)) return BR_ERROR;
char *fileName = encodeFilename(fileNameB);
delete fileNameB;
if (failSecurityCheck(fileName)) return BR_ERROR;
- trimStack(fun -> stack);
+ trimStack(fun->stack);
- if (fun -> stack -> thisVar.varType != SVT_STACK) {
+ if (fun->stack->thisVar.varType != SVT_STACK) {
fatal("First parameter isn't a stack");
return BR_ERROR;
}
- if (!stackToFile(fileName, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!stackToFile(fileName, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
delete fileName;
return BR_CONTINUE;
}
@@ -2216,23 +2215,23 @@ builtIn(saveCustomData) {
builtIn(loadCustomData) {
UNUSEDALL
- char *newTextA = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *newTextA = getTextFromAnyVar(fun->stack->thisVar);
if (!checkNew(newTextA)) return BR_ERROR;
char *newText = encodeFilename(newTextA);
delete newTextA;
if (failSecurityCheck(newText)) return BR_ERROR;
- trimStack(fun -> stack);
-
- unlinkVar(fun -> reg);
- fun -> reg.varType = SVT_STACK;
- fun -> reg.varData.theStack = new stackHandler;
- if (!checkNew(fun -> reg.varData.theStack)) return BR_ERROR;
- fun -> reg.varData.theStack -> first = NULL;
- fun -> reg.varData.theStack -> last = NULL;
- fun -> reg.varData.theStack -> timesUsed = 1;
- if (!fileToStack(newText, fun -> reg.varData.theStack)) return BR_ERROR;
+ trimStack(fun->stack);
+
+ unlinkVar(fun->reg);
+ fun->reg.varType = SVT_STACK;
+ fun->reg.varData.theStack = new stackHandler;
+ if (!checkNew(fun->reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varData.theStack->first = NULL;
+ fun->reg.varData.theStack->last = NULL;
+ fun->reg.varData.theStack->timesUsed = 1;
+ if (!fileToStack(newText, fun->reg.varData.theStack)) return BR_ERROR;
delete newText;
return BR_CONTINUE;
}
@@ -2240,18 +2239,18 @@ builtIn(loadCustomData) {
builtIn(setCustomEncoding) {
UNUSEDALL
int n;
- if (!getValueType(n, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
+ if (!getValueType(n, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
saveEncoding = n;
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, 1);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
builtIn(freeSound) {
UNUSEDALL
int v;
- if (!getValueType(v, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(v, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
huntKillFreeSound(v);
return BR_CONTINUE;
}
@@ -2263,15 +2262,15 @@ builtIn(parallaxAdd) {
return BR_ERROR;
} else {
int wrapX, wrapY, v;
- if (!getValueType(wrapY, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(wrapX, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(v, SVT_FILE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(wrapY, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(wrapX, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(v, SVT_FILE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (!loadParallax(v, wrapX, wrapY)) return BR_ERROR;
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
}
return BR_CONTINUE;
}
@@ -2279,44 +2278,44 @@ builtIn(parallaxAdd) {
builtIn(parallaxClear) {
UNUSEDALL
killParallax();
- setVariable(fun -> reg, SVT_INT, 1);
+ setVariable(fun->reg, SVT_INT, 1);
return BR_CONTINUE;
}
builtIn(getPixelColour) {
UNUSEDALL
int x, y;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
- unlinkVar(fun -> reg);
- fun -> reg.varType = SVT_STACK;
- fun -> reg.varData.theStack = new stackHandler;
- if (!checkNew(fun -> reg.varData.theStack)) return BR_ERROR;
- fun -> reg.varData.theStack -> first = NULL;
- fun -> reg.varData.theStack -> last = NULL;
- fun -> reg.varData.theStack -> timesUsed = 1;
- if (!getRGBIntoStack(x, y, fun -> reg.varData.theStack)) return BR_ERROR;
+ unlinkVar(fun->reg);
+ fun->reg.varType = SVT_STACK;
+ fun->reg.varData.theStack = new stackHandler;
+ if (!checkNew(fun->reg.varData.theStack)) return BR_ERROR;
+ fun->reg.varData.theStack->first = NULL;
+ fun->reg.varData.theStack->last = NULL;
+ fun->reg.varData.theStack->timesUsed = 1;
+ if (!getRGBIntoStack(x, y, fun->reg.varData.theStack)) return BR_ERROR;
return BR_CONTINUE;
}
builtIn(makeFastArray) {
UNUSEDALL
- switch (fun -> stack -> thisVar.varType) {
+ switch (fun->stack->thisVar.varType) {
case SVT_STACK: {
- bool success = makeFastArrayFromStack(fun -> reg, fun -> stack -> thisVar.varData.theStack);
- trimStack(fun -> stack);
+ bool success = makeFastArrayFromStack(fun->reg, fun->stack->thisVar.varData.theStack);
+ trimStack(fun->stack);
return success ? BR_CONTINUE : BR_ERROR;
}
break;
case SVT_INT: {
- int i = fun -> stack -> thisVar.varData.intValue;
- trimStack(fun -> stack);
- return makeFastArraySize(fun -> reg, i) ? BR_CONTINUE : BR_ERROR;
+ int i = fun->stack->thisVar.varData.intValue;
+ trimStack(fun->stack);
+ return makeFastArraySize(fun->reg, i) ? BR_CONTINUE : BR_ERROR;
}
break;
@@ -2330,21 +2329,21 @@ builtIn(makeFastArray) {
builtIn(getCharacterScale) {
UNUSEDALL
int objectNumber;
- if (!getValueType(objectNumber, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
onScreenPerson *pers = findPerson(objectNumber);
if (pers) {
- setVariable(fun -> reg, SVT_INT, pers -> scale * 100);
+ setVariable(fun->reg, SVT_INT, pers->scale * 100);
} else {
- setVariable(fun -> reg, SVT_INT, 0);
+ setVariable(fun->reg, SVT_INT, 0);
}
return BR_CONTINUE;
}
builtIn(getLanguageID) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, gameSettings.languageID);
+ setVariable(fun->reg, SVT_INT, gameSettings.languageID);
return BR_CONTINUE;
}
@@ -2352,9 +2351,9 @@ builtIn(getLanguageID) {
builtIn(_rem_launchWith) {
UNUSEDALL
- trimStack(fun -> stack);
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, false);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, false);
return BR_CONTINUE;
@@ -2362,22 +2361,22 @@ builtIn(_rem_launchWith) {
builtIn(getFramesPerSecond) {
UNUSEDALL
- setVariable(fun -> reg, SVT_INT, lastFramesPerSecond);
+ setVariable(fun->reg, SVT_INT, lastFramesPerSecond);
return BR_CONTINUE;
}
builtIn(showThumbnail) {
UNUSEDALL
int x, y;
- if (!getValueType(y, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(x, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(y, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(x, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
// Encode the name!Encode the name!
- char *aaaaa = getTextFromAnyVar(fun -> stack -> thisVar);
+ char *aaaaa = getTextFromAnyVar(fun->stack->thisVar);
// deb ("Got name:", aaaaa;)
- trimStack(fun -> stack);
+ trimStack(fun->stack);
// deb ("About to encode", aaaaa);
char *file = encodeFilename(aaaaa);
// deb ("Made new name", file);
@@ -2391,10 +2390,10 @@ builtIn(showThumbnail) {
builtIn(setThumbnailSize) {
UNUSEDALL
- if (!getValueType(thumbHeight, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(thumbWidth, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(thumbHeight, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(thumbWidth, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
if (thumbWidth < 0 || thumbHeight < 0 || thumbWidth > winWidth || thumbHeight > winHeight) {
char buff[50];
sprintf(buff, "%d x %d", thumbWidth, thumbHeight);
@@ -2407,13 +2406,13 @@ builtIn(setThumbnailSize) {
builtIn(hasFlag) {
UNUSEDALL
int objNum, flagIndex;
- if (!getValueType(flagIndex, SVT_INT, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
- if (!getValueType(objNum, SVT_OBJTYPE, fun -> stack -> thisVar)) return BR_ERROR;
- trimStack(fun -> stack);
+ if (!getValueType(flagIndex, SVT_INT, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
+ if (!getValueType(objNum, SVT_OBJTYPE, fun->stack->thisVar)) return BR_ERROR;
+ trimStack(fun->stack);
objectType *objT = findObjectType(objNum);
if (!objT) return BR_ERROR;
- setVariable(fun -> reg, SVT_INT, objT->flags & (1 << flagIndex));
+ setVariable(fun->reg, SVT_INT, objT->flags & (1 << flagIndex));
return BR_CONTINUE;
}
@@ -2431,26 +2430,26 @@ builtIn(snapshotClear) {
builtIn(bodgeFilenames) {
UNUSEDALL
bool lastValue = allowAnyFilename;
- allowAnyFilename = getBoolean(fun -> stack -> thisVar);
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, lastValue);
+ allowAnyFilename = getBoolean(fun->stack->thisVar);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, lastValue);
return BR_CONTINUE;
}
// Deprecated - does nothing.
builtIn(_rem_registryGetString) {
UNUSEDALL
- trimStack(fun -> stack);
- trimStack(fun -> stack);
- setVariable(fun -> reg, SVT_INT, 0);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
+ setVariable(fun->reg, SVT_INT, 0);
return BR_CONTINUE;
}
builtIn(quitWithFatalError) {
UNUSEDALL
- char *mess = getTextFromAnyVar(fun -> stack -> thisVar);
- trimStack(fun -> stack);
+ char *mess = getTextFromAnyVar(fun->stack->thisVar);
+ trimStack(fun->stack);
fatal(mess);
return BR_ERROR;
}
@@ -2458,10 +2457,10 @@ builtIn(quitWithFatalError) {
builtIn(_rem_setCharacterAA) {
UNUSEDALL
- trimStack(fun -> stack);
- trimStack(fun -> stack);
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
}
@@ -2469,9 +2468,9 @@ builtIn(_rem_setCharacterAA) {
builtIn(_rem_setMaximumAA) {
UNUSEDALL
- trimStack(fun -> stack);
- trimStack(fun -> stack);
- trimStack(fun -> stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
+ trimStack(fun->stack);
return BR_CONTINUE;
@@ -2480,14 +2479,14 @@ builtIn(_rem_setMaximumAA) {
builtIn(setBackgroundEffect) {
UNUSEDALL
bool done = blur_createSettings(numParams, fun->stack);
- setVariable(fun -> reg, SVT_INT, done ? 1 : 0);
+ setVariable(fun->reg, SVT_INT, done ? 1 : 0);
return BR_CONTINUE;
}
builtIn(doBackgroundEffect) {
UNUSEDALL
bool done = blurScreen();
- setVariable(fun -> reg, SVT_INT, done ? 1 : 0);
+ setVariable(fun->reg, SVT_INT, done ? 1 : 0);
return BR_CONTINUE;
}
@@ -2516,11 +2515,11 @@ builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun) {
// fprintf (stderr, "Calling function %d: %s\n", whichFunc, builtInFunctionNames[whichFunc]); fflush (stderr);
if (numBIFNames) {
- // deb ("IN:", (fun -> originalNumber < numUserFunc) ? allUserFunc[fun -> originalNumber] : "Unknown user function");
+ // deb ("IN:", (fun->originalNumber < numUserFunc) ? allUserFunc[fun->originalNumber] : "Unknown user function");
// deb ("GO:", (whichFunc < numBIFNames) ? allBIFNames[whichFunc] : "Unknown built-in function");
setFatalInfo(
- (fun -> originalNumber < numUserFunc) ? allUserFunc[fun -> originalNumber] : "Unknown user function",
+ (fun->originalNumber < numUserFunc) ? allUserFunc[fun->originalNumber] : "Unknown user function",
(whichFunc < numBIFNames) ? allBIFNames[whichFunc] : "Unknown built-in function");
}