int16 Op_RemoveProc() { int idx; int overlay; idx = popVar(); overlay = popVar(); if (!overlay) { overlay = currentScriptPtr->overlayNumber; } removeScript(overlay, idx, &procHead); return (0); }
int16 Op_RemoveMessage() { int idx; int overlay; idx = popVar(); overlay = popVar(); if (!overlay) { overlay = currentScriptPtr->overlayNumber; } removeCell(&cellHead, overlay, idx, 5, masterScreen); return (0); }
int16 Op_Inventory() { int si = var41; var41 = popVar(); return si; }
int16 Op_LoadBackground() { int result = 0; char bgName[36] = ""; char *ptr; int bgIdx; ptr = (char *) popPtr(); Common::strlcpy(bgName, ptr, sizeof(bgName)); bgIdx = popVar(); if (bgIdx >= 0 || bgIdx < NBSCREENS) { strToUpper(bgName); gfxModuleData_gfxWaitVSync(); gfxModuleData_gfxWaitVSync(); result = loadBackground(bgName, bgIdx); gfxModuleData_addDirtyRect(Common::Rect(0, 0, 320, 200)); } changeCursor(CURSOR_NORMAL); return result; }
int16 Op_InitializeState() { int param1 = popVar(); int objIdx = popVar(); int ovlIdx = popVar(); if (!ovlIdx) ovlIdx = currentScriptPtr->overlayNumber; #ifdef FUNCTION_DEBUG debug(1, "Init %s state to %d", getObjectName(objIdx, overlayTable[ovlIdx].ovlData->arrayNameObj), param1); #endif objInit(ovlIdx, objIdx, param1); return (0); }
int16 Op_LoopFX() { int volume = popVar(); int speed = popVar(); /*int channelNum = */popVar(); int sampleNum = popVar(); if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) { if (speed == -1) speed = filesDatabase[sampleNum].subData.transparency; _vm->sound().playSound(filesDatabase[sampleNum].subData.ptr, filesDatabase[sampleNum].width, volume); } return (0); }
int16 Op_LinkObjects() { int type = popVar(); int obj2 = popVar(); int ovl2 = popVar(); int obj = popVar(); int ovl = popVar(); if (!ovl) ovl = currentScriptPtr->overlayNumber; if (!ovl2) ovl2 = currentScriptPtr->overlayNumber; linkCell(&cellHead, ovl, obj, type, ovl2, obj2); return 0; }
int returnBook() { Var *varList = pushVar(); printf("\n... Returning Books ...\n"); printf("Thank you, %s! ", name); holdNum -= returnNum; if (1 == returnNum) printf("You've just returned [%d] book!\n", returnNum); else printf("You've just returned [%d] books!\n", returnNum); currentLimit = borrowLimit - holdNum; if (1 == currentLimit) printf("Now you can borrow [%d] more book.\n", currentLimit); else printf("Now you can borrow [%d] more books.\n", currentLimit); /* set the value for return */ varList[HOLDNUM].val.i = holdNum; popVar(varList); return holdNum; }
void Interpreter::storeCtxInt() { FunctionContext* ctx = topContext(); uint16_t ctxId = getNext2Bytes(); uint16_t id = getNext2Bytes(); StackVar var = _stack.top(); popVar(); ctx->storeInt(ctxId, id, var.i); }
int16 Op_FreezeOverlay() { //int var0; //int var1; int temp; int var0 = popVar(); int var1 = popVar(); if (!var1) { var1 = currentScriptPtr->overlayNumber; } temp = overlayTable[var1].executeScripts; overlayTable[var1].executeScripts = var0; return temp; }
int16 Op_UserDelay() { int delay = popVar(); if (delay >= 0) { userDelay = delay; } return userDelay; }
int16 Op_FindProc() { char name[36] = ""; char *ptr = (char *)popPtr(); Common::strlcpy(name, ptr, sizeof(name)); int param = getProcParam(popVar(), 20, name); return param; }
int16 Op_Random() { int var = popVar(); if (var < 2) { return (0); } return (_vm->_rnd.getRandomNumber(var - 1)); }
int16 Op_SetObjectAtNode() { int16 node = popVar(); int16 obj = popVar(); int16 ovl = popVar(); if (!ovl) ovl = currentScriptPtr->overlayNumber; int nodeInfo[2]; if (!getNode(nodeInfo, node)) { setObjectPosition(ovl, obj, 0, nodeInfo[0]); setObjectPosition(ovl, obj, 1, nodeInfo[1]); setObjectPosition(ovl, obj, 2, nodeInfo[1]); setObjectPosition(ovl, obj, 4, computeZoom(nodeInfo[1])); } return 0; }
int16 Op_XClick() { int x = popVar(); if (x != -1) { aniX = x; animationStart = true; } return aniX; }
int genbf_expr(struct expr *a, int lval, struct type **t) { if (!a->end) { genbf_expr(a->v1, lval, t); /* FIXME: this is a comma-separated list of expressions, it can't just * go anywhere ... */ popVar(); } return genbf_assignment_expr(a->v2, lval, t); }
int16 Op_UserOn() { int oldValue = userEnabled; int newValue = popVar(); if (newValue != -1) { userEnabled = newValue; } return oldValue; }
int16 Op_Display() { int oldValue = displayOn; int newValue = popVar(); if (newValue != -1) { displayOn = newValue; } return oldValue; }
int16 Op_YClick() { int y = popVar(); if (y != -1) { aniY = y; animationStart = true; } return aniY; }
int16 Op_ClearScreen() { int bgIdx = popVar(); if ((bgIdx >= 0) && (bgIdx < NBSCREENS) && (backgroundScreens[bgIdx])) { memset(backgroundScreens[bgIdx], 0, 320 * 200); backgroundChanged[bgIdx] = true; strcpy(backgroundTable[0].name, ""); } return 0; }
int16 Op_ProtectionFlag() { int16 temp = protectionCode; int16 newVar; newVar = popVar(); if (newVar != -1) { protectionCode = newVar; } return temp; }
int16 Op_GetNodeY() { int16 node = popVar(); int nodeInfo[2]; int result = getNode(nodeInfo, node); assert(result == 0); return nodeInfo[1]; }
int16 Op_AutoControl() { int oldValue = automaticMode; int newValue = popVar(); if (newValue >= 0) { automaticMode = newValue; activeMouse = newValue; } return oldValue; }
int16 Op_RemoveOverlay() { int overlayIdx; overlayIdx = popVar(); if (strlen(overlayTable[overlayIdx].overlayName)) { releaseOverlay(overlayTable[overlayIdx].overlayName); } return 0; }
int16 Op_GetNodeX() { int16 node = popVar(); int nodeInfo[2]; int result = getNode(nodeInfo, node); ASSERT(result == 0); return nodeInfo[0]; }
int16 Op_SetVolume() { int oldVolume = _vm->sound().getVolume(); int newVolume = popVar(); if (newVolume > 63) newVolume = 63; if (newVolume >= 0) { int volume = 63 - newVolume; _vm->sound().setVolume(volume); } return oldVolume >> 2; }
void professor() { Var *varList = pushVar(); borrowLimit = 10; printf("Dear Professor %s, you can borrow [%d] books in total! Enjoy the books!\n", name, borrowLimit); staff(); popVar(varList); }
int16 Op_Exec() { int scriptIdx; int ovlIdx; uint8 *ptr; uint8 *ptr2; int16 popTable[200]; int numOfArgToPop = popVar(); int i = 0; for (i = 0; i < numOfArgToPop; i++) { popTable[numOfArgToPop - i - 1] = popVar(); } scriptIdx = popVar(); ovlIdx = popVar(); if (!ovlIdx) { ovlIdx = currentScriptPtr->overlayNumber; } ptr = attacheNewScriptToTail(&procHead, ovlIdx, scriptIdx, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_MinusPROC); if (!ptr) return (0); if (numOfArgToPop <= 0) { return (0); } ptr2 = ptr; for (i = 0; i < numOfArgToPop; i++) { WRITE_BE_UINT16(ptr2, popTable[i]); ptr2 += 2; } return (0); }
int16 Op_TrackAnim() { // setup actor position actorStruct *pActor; int var0 = popVar(); int actorY = popVar(); int actorX = popVar(); int var1 = popVar(); int var2 = popVar(); int overlay = popVar(); if (!overlay) { overlay = currentScriptPtr->overlayNumber; } pActor = findActor(&actorHead, overlay, var2, var1); if (!pActor) { return 1; } animationStart = false; pActor->x_dest = actorX; pActor->y_dest = actorY; pActor->flag = 1; pActor->endDirection = var0; return 0; }
int16 Op_PlayFX() { int volume = popVar(); #if 0 int speed = popVar(); int channelNum = popVar(); #else popVar(); popVar(); #endif int sampleNum = popVar(); if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) { #if 0 if (speed == -1) speed = filesDatabase[sampleNum].subData.transparency; #endif _vm->sound().playSound(filesDatabase[sampleNum].subData.ptr, filesDatabase[sampleNum].width, volume); } return (0); }