diff options
Diffstat (limited to 'sky/logic.cpp')
| -rw-r--r-- | sky/logic.cpp | 1099 | 
1 files changed, 1099 insertions, 0 deletions
| diff --git a/sky/logic.cpp b/sky/logic.cpp new file mode 100644 index 0000000000..1c39929912 --- /dev/null +++ b/sky/logic.cpp @@ -0,0 +1,1099 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2003 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. + * + * $Header$ + * + */ + +#include "sky/logic.h" +#include "sky/debug.h" +#include "sky/compact.h" +#include "sky/skydefs.h" + + +typedef void (SkyLogic::*LogicTable) (); +static const LogicTable logicTable[] = { +	&SkyLogic::lreturn, +	&SkyLogic::logicScript,	 // 1  script processor +	&SkyLogic::autoRoute,	 // 2  Make a route +	&SkyLogic::arAnim,	 // 3  Follow a route +	&SkyLogic::arTurn,	 // 4  Mega turns araound +	&SkyLogic::alt,		 // 5  Set up new get-to script +	&SkyLogic::anim,	 // 6  Follow a sequence +	&SkyLogic::turn,	 // 7  Mega turning +	&SkyLogic::cursor,	 // 8  id tracks the pointer +	&SkyLogic::talk,	 // 9  count down and animate +	&SkyLogic::listen,	 // 10 player waits for talking id +	&SkyLogic::stopped,	 // 11 wait for id to move +	&SkyLogic::choose,	 // 12 wait for player to click +	&SkyLogic::frames,	 // 13 animate just frames +	&SkyLogic::pause,	 // 14 Count down to 0 and go +	&SkyLogic::waitSync,	 // 15 Set to l_script when sync!=0 +	&SkyLogic::simpleAnim,	 // 16 Module anim without x,y's +}; + + +void SkyLogic::engine() { +#define logic_list_no 141 +	Compact *compact2 = SkyState::fetchCompact(141); // logic list + +	while (compact2->logic) { // 0 means end of list +		if (compact2->logic == 0xffff) { +			// Change logic data address +			compact2 = SkyState::fetchCompact(compact2->status); +			continue; +		} + +		// Process id eax +		//cur_id = compact2->logic; +		_compact = SkyState::fetchCompact(compact2->logic); + +		// check the id actually wishes to be processed +		if (!(_compact->status & (1 << 6))) +			continue; + +		// ok, here we process the logic bit system + +		if (_compact->status & (1 << 7)) +			warning("remove_object_from_walk unimplemented"); +		//	remove_object_from_walk(); + +		SkyDebug::logic(_compact->logic); +		(this->*logicTable[_compact->logic]) (); + +		if (_compact->status & (1 << 7)) +			warning("object_to_walk unimplemented"); +		//	object_to_walk(); + +		// a sync sent to the compact is available for one cycle +		// only. that cycle has just ended so remove the sync. +		// presumably the mega has just reacted to it. +		_compact->sync = 0; +	} +} + +void SkyLogic::lreturn() { +	error("lreturn: Is this really called?"); +} + +void SkyLogic::logicScript() { +	// Process the current mega's script +	// If the script finishes then drop back a level + +	for (;;) { +		uint16 mode = _compact->mode; // get pointer to current script +		printf("compact mode: %d\n", mode); +		// FIXME: not endian safe +		uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + mode); +		uint32 scr = *p; // get script number and offset + +		// FIXME: HACK ALERT!!!! +		if (scr == 0x27) +			scr = 0x9fa0027; + +		printf("script: 0x%X\n", scr); +		*p = script(_compact, scr); + +		if (!(*p & 0xffff0000)) // script finished +			_compact->mode -= 4; +		else if (_compact->mode == mode) +			return; +	} +} + +void SkyLogic::autoRoute() { +	error("autoRoute unimplented"); +	uint16 *route; +	route = 0; +	 +	warning("autoRoute unimplemented"); +	uint32 ret = 0; // = autoRoute(route); + +	_compact->logic = L_SCRIPT; // continue the script + +	if (ret != 1) // route failed +		_compact->downFlag = 1; // return fail to script +	else if (!route) // zero route +		_compact->downFlag = 2; // return fail to script +	else { +		_compact->grafixProg = route; // put graphic prog in +		_compact->downFlag = 0; // route ok +	} + +	logicScript(); +	return; +} + +void SkyLogic::arAnim() { +	error("Stub: SkyLogic::arAnim"); +} + +void SkyLogic::arTurn() { +	_compact->frame = *(uint16 *)(_compact->extCompact->turnProg); +	((uint16 *)(_compact->extCompact->turnProg))++; + +	if (!*(uint16 *)(_compact->extCompact->turnProg)) { // turn done? +		// Back to ar mode +		_compact->extCompact->arAnimIndex = 0; +		_compact->logic = L_AR_ANIM; +	} +} + +void SkyLogic::alt() { +	// change the current script + +	_compact->logic = L_SCRIPT; +	// FIXME: not endian safe +	uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode); +	*p = _compact->extCompact->alt; + +	logicScript(); +} + +void SkyLogic::anim() { +	error("Stub: SkyLogic::anim"); +} + +void SkyLogic::turn() { +	if (*(uint16 *)(_compact->extCompact->turnProg)) { +		_compact->frame = *(uint16 *)(_compact->extCompact->turnProg); +		((uint16 *)(_compact->extCompact->turnProg))++; +		return; +	} + +	// turn_to_script: + +	_compact->extCompact->arAnimIndex = 0; +	_compact->logic = L_SCRIPT; + +	logicScript(); +} + +void SkyLogic::cursor() { +	error("Stub: SkyLogic::cursor"); +} + +void SkyLogic::talk() { +	error("Stub: SkyLogic::talk"); +} + +void SkyLogic::listen() { +	error("Stub: SkyLogic::listen"); +} + +void SkyLogic::stopped() { +	error("Stub: SkyLogic::stopped"); +} + +void SkyLogic::choose() { +	error("Stub: SkyLogic::choose"); +} + +void SkyLogic::frames() { +	error("Stub: SkyLogic::frames"); +} + +void SkyLogic::pause() { +	error("Stub: SkyLogic::pause"); +} + +void SkyLogic::waitSync() { +	error("Stub: SkyLogic::waitSync"); +} + +void SkyLogic::simpleAnim() { +	error("Stub: SkyLogic::simpleAnim"); +} + + + +static uint16 *_moduleList[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static uint32 _stack[20]; +static byte _stackPtr = 0; +#define f_module_0	60400 + +void SkyLogic::checkModuleLoaded(uint32 moduleNo) { +	if (!_moduleList[moduleNo]) +		_moduleList[moduleNo] = (uint16 *)_skyDisk->loadFile(moduleNo + f_module_0, NULL); +} + +void SkyLogic::push(uint32 a) { +	assert(_stackPtr < 19); +	_stack[_stackPtr] = a; +	_stackPtr++; +} + +uint32 SkyLogic::pop() { +	assert(_stackPtr > 0); +	--_stackPtr; +	return _stack[_stackPtr]; +} + +typedef uint32 (SkyLogic::*McodeTable) (uint32, uint32, uint32); +static  McodeTable mcodeTable[] = { +	&SkyLogic::fnCacheChip, +	&SkyLogic::fnCacheFast, +	&SkyLogic::fnDrawScreen, +	&SkyLogic::fnAr, +	&SkyLogic::fnArAnimate, +	&SkyLogic::fnIdle, +	&SkyLogic::fnInteract, +	&SkyLogic::fnStartSub, +	&SkyLogic::fnTheyStartSub, +	&SkyLogic::fnAssignBase, +	&SkyLogic::fnDiskMouse, +	&SkyLogic::fnNormalMouse, +	&SkyLogic::fnBlankMouse, +	&SkyLogic::fnCrossMouse, +	&SkyLogic::fnCursorRight, +	&SkyLogic::fnCursorLeft, +	&SkyLogic::fnCursorDown, +	&SkyLogic::fnOpenHand, +	&SkyLogic::fnCloseHand, +	&SkyLogic::fnGetTo, +	&SkyLogic::fnSetToStand, +	&SkyLogic::fnTurnTo, +	&SkyLogic::fnArrived, +	&SkyLogic::fnLeaving, +	&SkyLogic::fnSetAlternate, +	&SkyLogic::fnAltSetAlternate, +	&SkyLogic::fnKillId, +	&SkyLogic::fnNoHuman, +	&SkyLogic::fnAddHuman, +	&SkyLogic::fnAddButtons, +	&SkyLogic::fnNoButtons, +	&SkyLogic::fnSetStop, +	&SkyLogic::fnClearStop, +	&SkyLogic::fnPointerText, +	&SkyLogic::fnQuit, +	&SkyLogic::fnSpeakMe, +	&SkyLogic::fnSpeakMeDir, +	&SkyLogic::fnSpeakWait, +	&SkyLogic::fnSpeakWaitDir, +	&SkyLogic::fnChooser, +	&SkyLogic::fnHighlight, +	&SkyLogic::fnTextKill, +	&SkyLogic::fnStopMode, +	&SkyLogic::fnWeWait, +	&SkyLogic::fnSendSync, +	&SkyLogic::fnSendFastSync, +	&SkyLogic::fnSendRequest, +	&SkyLogic::fnClearRequest, +	&SkyLogic::fnCheckRequest, +	&SkyLogic::fnStartMenu, +	&SkyLogic::fnUnhighlight, +	&SkyLogic::fnFaceId, +	&SkyLogic::fnForeground, +	&SkyLogic::fnBackground, +	&SkyLogic::fnNewBackground, +	&SkyLogic::fnSort, +	&SkyLogic::fnNoSpriteEngine, +	&SkyLogic::fnNoSpritesA6, +	&SkyLogic::fnResetId, +	&SkyLogic::fnToggleGrid, +	&SkyLogic::fnPause, +	&SkyLogic::fnRunAnimMod, +	&SkyLogic::fnSimpleMod, +	&SkyLogic::fnRunFrames, +	&SkyLogic::fnAwaitSync, +	&SkyLogic::fnIncMegaSet, +	&SkyLogic::fnDecMegaSet, +	&SkyLogic::fnSetMegaSet, +	&SkyLogic::fnMoveItems, +	&SkyLogic::fnNewList, +	&SkyLogic::fnAskThis, +	&SkyLogic::fnRandom, +	&SkyLogic::fnPersonHere, +	&SkyLogic::fnToggleMouse, +	&SkyLogic::fnMouseOn, +	&SkyLogic::fnMouseOff, +	&SkyLogic::fnFetchX, +	&SkyLogic::fnFetchY, +	&SkyLogic::fnTestList, +	&SkyLogic::fnFetchPlace, +	&SkyLogic::fnCustomJoey, +	&SkyLogic::fnSetPalette, +	&SkyLogic::fnTextModule, +	&SkyLogic::fnChangeName, +	&SkyLogic::fnMiniLoad, +	&SkyLogic::fnFlushBuffers, +	&SkyLogic::fnFlushChip, +	&SkyLogic::fnSaveCoods, +	&SkyLogic::fnPlotGrid, +	&SkyLogic::fnRemoveGrid, +	&SkyLogic::fnEyeball, +	&SkyLogic::fnCursorUp, +	&SkyLogic::fnLeaveSection, +	&SkyLogic::fnEnterSection, +	&SkyLogic::fnRestoreGame, +	&SkyLogic::fnRestartGame, +	&SkyLogic::fnNewSwingSeq, +	&SkyLogic::fnWaitSwingEnd, +	&SkyLogic::fnSkipIntroCode, +	&SkyLogic::fnBlankScreen, +	&SkyLogic::fnPrintCredit, +	&SkyLogic::fnLookAt, +	&SkyLogic::fnLincTextModule, +	&SkyLogic::fnTextKill2, +	&SkyLogic::fnSetFont, +	&SkyLogic::fnStartFx, +	&SkyLogic::fnStopFx, +	&SkyLogic::fnStartMusic, +	&SkyLogic::fnStopMusic, +	&SkyLogic::fnFadeDown, +	&SkyLogic::fnFadeUp, +	&SkyLogic::fnQuitToDos, +	&SkyLogic::fnPauseFx, +	&SkyLogic::fnUnPauseFx, +	&SkyLogic::fnPrintf, +}; + +#define RESULT 1 +void SkyLogic::initScriptVariables() { +	for (int i = 0; i < 838; i++) +		_scriptVariables[i] = 0; + +	_scriptVariables[3] = 141; +	_scriptVariables[110] = 62; +	_scriptVariables[146] = 1; +	_scriptVariables[147] = 2; +	_scriptVariables[451] = 8371; +	_scriptVariables[641] = 1; +	_scriptVariables[679] = 1; +	_scriptVariables[694] = 3; +	_scriptVariables[705] = 1; +	_scriptVariables[710] = 1; +	_scriptVariables[711] = 1; +	_scriptVariables[712] = 1; +	_scriptVariables[720] = 1; +	_scriptVariables[721] = 1; +	_scriptVariables[794] = 1; +	_scriptVariables[798] = 1; +	_scriptVariables[799] = 1; +	_scriptVariables[805] = 1; +	_scriptVariables[806] = 1; +	_scriptVariables[807] = 16731; +	_scriptVariables[808] = 1; +	_scriptVariables[809] = 2; +	_scriptVariables[818] = 1; +	_scriptVariables[819] = 1; +	_scriptVariables[820] = 1; +	_scriptVariables[821] = 1; +	_scriptVariables[822] = 1; +} + +uint32 SkyLogic::script(Compact *compact, uint32 script) { +script: +	// process a script +	// low level interface to interpreter + +	// script: +	// Bit  0-11 - Script number +	// Bit 12-15 - Module number +	// Bit 16-31 - Script offset (if any) + +	uint16 scriptNo = script & 0xffff; +	uint16 moduleNo = (script & 0xff00) >> 12; +	printf("scriptNo: %d, moduleNo: %d\n", scriptNo, moduleNo); +	uint16 *scriptData = _moduleList[moduleNo]; // get module address + +	printf("File: %d\n", moduleNo + f_module_0); +	if (!scriptData) { // The module has not been loaded +		scriptData = (uint16 *)_skyDisk->loadFile(moduleNo + f_module_0, NULL); +		_moduleList[moduleNo] = scriptData; // module has been loaded +	} + +	uint16 *moduleStart = scriptData; + +	// Check whether we have an offset or what +	if (script & 0xffff0000) +		scriptData = moduleStart + (script >> 16); +	else +		scriptData += *(scriptData + (script & 0x0fff)); + +	uint32 a, b, c; +	uint16 command, mcode, s; +	uint16 *tmp; +	int16 t; + +	for (;;) { +		command = *scriptData++; // get a command +		SkyDebug::script(command, scriptData); + +		switch (command) { +		case 0: // push_variable +			s = *scriptData++; // get variable number +			push( _scriptVariables[s/4] ); +			break; +		case 1: // less_than +			a = pop(); +			b = pop(); +			if (a < b) +				push(1); +			else +				push(0); +			break; +		case 2: // push_number +			push(*scriptData++); +			break; +		case 3: // not_equal +			a = pop(); +			b = pop(); +			if (a != b) +				push(1); +			else +				push(0); +			break; +		case 4: // if_and +			a = pop(); +			b = pop(); +			if (a && b) +				push(1); +			else +				push(0); +			break; +		case 5: // skip_zero +			s = *scriptData++; + +			a = pop(); +			if (!a) +				scriptData += s/2; +			break; +		case 6: // pop_var +			s = *scriptData++; +			_scriptVariables[s/4] = pop(); +			break; +		case 7: // minus +			a = pop(); +			b = pop(); +			push(b-a); +			break; +		case 8: // plus +			a = pop(); +			b = pop(); +			push(b+a); +			break; +		case 9: // skip_always +			s = *scriptData++; +			scriptData += s/2; +			break; +		case 10: // if_or +			a = pop(); +			b = pop(); +			if (a || b) +				push(1); +			else +				push(0); +			break; +		case 11: // call_mcode +			s = *scriptData++; + +			a = s; +			b = c = 0; +			assert(s <= 3); +			// No, I did not forget the "break"s +			switch (s) { +			case 3: +				c = pop(); +			case 2: +				b = pop(); +			case 1: +				a = pop(); +			} + +			// TODO: save stuff (compare asm code) +			mcode = *scriptData++/4; // get mcode number +			SkyDebug::mcode(mcode, a, b, c); + +			a = (this->*mcodeTable[mcode]) (a, b, c); + +			if (!(a & 0xffff)) +				return (((scriptData - moduleStart) << 15) | scriptNo); +			break; +		case 12: // more_than +			a = pop(); +			b = pop(); +			if (a > b) +				push(1); +			else +				push(0); +			break; +		case 14: // switch +			s = *scriptData++; // get number of cases + +			a = pop(); // and value to switch on + +			do { +				if (a == *scriptData) { +					scriptData += *(scriptData + 1)/2; +					scriptData++; +					break; +				} +				scriptData += 2; +			} while (--s); + +			s = *scriptData++; +			scriptData += s; // use the default +			scriptData--; +			break; +		case 15: // push_offset +			// Push a compact access +			s = *scriptData++; +			tmp = (uint16 *)SkyCompact::getCompactElem(compact, s); +			printf("push_offset: %d\n", *tmp); +			push(*tmp); +			break; +		case 16: // pop_offset +			// pop a value into a compact +			s = *scriptData++; +			tmp = (uint16 *)SkyCompact::getCompactElem(compact, s); +			*tmp = pop(); +			break; +		case 17: // is_equal +			a = pop(); +			b = pop(); +			if (a == b) +				push(1); +			else +				push(0); +			break; +		case 18: // skip_nz +			t = *scriptData++; +			a = pop(); +			if (a) +				scriptData += t/2; +			break; +		case 13: +		case 19: // script_exit +			return scriptNo; +		case 20: // restart_script +			goto script; +		default: +			error("Unknown script command: %d", command); +		} +	} +} + +#define C_ACTION_MODE 4 + +uint32 SkyLogic::fnCacheChip(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCacheChip"); +} + +uint32 SkyLogic::fnCacheFast(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCacheFast"); +} + +uint32 SkyLogic::fnDrawScreen(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnDrawScreen"); +} + +uint32 SkyLogic::fnAr(uint32 x, uint32 y, uint32 c) { +	_compact->downFlag = 1; // assume failure in-case logic is interupted by speech (esp Joey) + +	_compact->extCompact->arTargetX = x; +	_compact->extCompact->arTargetY = y; +	_compact->logic = L_AR; // Set to AR mode + +	_compact->xcood &= 0xfff8; +	_compact->ycood &= 0xfff8; + +	return 0; // drop out of script +} + +uint32 SkyLogic::fnArAnimate(uint32 a, uint32 b, uint32 c) { +	_compact->mood = 0; // high level 'not stood still' +	_compact->logic = L_AR_ANIM; +	return 0; // drop out of script +} + +uint32 SkyLogic::fnIdle(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnIdle"); +} + +uint32 SkyLogic::fnInteract(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnInteract"); +} + +uint32 SkyLogic::fnStartSub(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStartSub"); +} + +uint32 SkyLogic::fnTheyStartSub(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnTheyStartSub"); +} + +uint32 SkyLogic::fnAssignBase(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAssignBase"); +} + +uint32 SkyLogic::fnDiskMouse(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnDiskMouse"); +} + +uint32 SkyLogic::fnNormalMouse(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNormalMouse"); +} + +uint32 SkyLogic::fnBlankMouse(uint32 a, uint32 b, uint32 c) { +	warning("Stub: fnBlankMouse"); +	return 1; +} + +uint32 SkyLogic::fnCrossMouse(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCrossMouse"); +} + +uint32 SkyLogic::fnCursorRight(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCursorRight"); +} + +uint32 SkyLogic::fnCursorLeft(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCursorLeft"); +} + +uint32 SkyLogic::fnCursorDown(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCursorDown"); +} + +uint32 SkyLogic::fnOpenHand(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnOpenHand"); +} + +uint32 SkyLogic::fnCloseHand(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCloseHand"); +} + +uint32 SkyLogic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) { +	_compact->upFlag = mode; // save mode for action script +	_compact->mode += 4; // next level up +	Compact *compact2 = SkyState::fetchCompact(_compact->place); +	uint16 *getToTable = compact2->getToTable; + +	while (*getToTable != targetPlaceId) +		getToTable += 2; + +	// FIXME: not endian safe +	uint32 *p = (uint32 *)SkyCompact::getCompactElem(_compact, C_BASE_SUB + _compact->mode); +	*p = *(getToTable + 1); // get new script + +	return 0; // drop out of script +} + +uint32 SkyLogic::fnSetToStand(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetToStand"); +} + +uint32 SkyLogic::fnTurnTo(uint32 direction, uint32 b, uint32 c) { +	error("Stub: fnTurnTo"); +} + +uint32 SkyLogic::fnArrived(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnArrived"); +} + +uint32 SkyLogic::fnLeaving(uint32 a, uint32 b, uint32 c) { +	_compact->extCompact->atWatch = 0; + +	if (_compact->extCompact->leaving) { +		_scriptVariables[_compact->extCompact->leaving/4] -= 1; // decrement the script variable +		_compact->extCompact->leaving = 0; // I shall do this only once +	} + +	return 1; // keep going +} + +uint32 SkyLogic::fnSetAlternate(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetAlternate"); +} + +uint32 SkyLogic::fnAltSetAlternate(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAltSetAlternate"); +} + +uint32 SkyLogic::fnKillId(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnKillId"); +} + +uint32 SkyLogic::fnNoHuman(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNoHuman"); +} + +uint32 SkyLogic::fnAddHuman(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAddHuman"); +} + +uint32 SkyLogic::fnAddButtons(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAddButtons"); +} + +uint32 SkyLogic::fnNoButtons(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNoButtons"); +} + +uint32 SkyLogic::fnSetStop(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetStop"); +} + +uint32 SkyLogic::fnClearStop(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnClearStop"); +} + +uint32 SkyLogic::fnPointerText(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPointerText"); +} + +uint32 SkyLogic::fnQuit(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnQuit"); +} + +uint32 SkyLogic::fnSpeakMe(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSpeakMe"); +} + +uint32 SkyLogic::fnSpeakMeDir(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSpeakMeDir"); +} + +uint32 SkyLogic::fnSpeakWait(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSpeakWait"); +} + +uint32 SkyLogic::fnSpeakWaitDir(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSpeakWaitDir"); +} + +uint32 SkyLogic::fnChooser(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnChooser"); +} + +uint32 SkyLogic::fnHighlight(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnHighlight"); +} + +uint32 SkyLogic::fnTextKill(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnTextKill"); +} + +uint32 SkyLogic::fnStopMode(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStopMode"); +} + +uint32 SkyLogic::fnWeWait(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnWeWait"); +} + +uint32 SkyLogic::fnSendSync(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSendSync"); +} + +uint32 SkyLogic::fnSendFastSync(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSendFastSync"); +} + +uint32 SkyLogic::fnSendRequest(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSendRequest"); +} + +uint32 SkyLogic::fnClearRequest(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnClearRequest"); +} + +uint32 SkyLogic::fnCheckRequest(uint32 a, uint32 b, uint32 c) { +	// check for interaction request +	 +	a = (a & 0xffffff00) | 1; // assume script continue + +	ExtCompact *ecpt = _compact->extCompact; + +	if (!ecpt->request) +		return a; + +	_compact->mode = C_ACTION_MODE; // into action mode + +	ecpt->actionSub = ecpt->request; + +	ecpt->request = 0; // trash request +	return 0; // drop from script +} + +uint32 SkyLogic::fnStartMenu(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStartMenu"); +} + +uint32 SkyLogic::fnUnhighlight(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnUnhighlight"); +} + +uint32 SkyLogic::fnFaceId(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFaceId"); +} + +uint32 SkyLogic::fnForeground(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnForeground"); +} + +uint32 SkyLogic::fnBackground(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnBackground"); +} + +uint32 SkyLogic::fnNewBackground(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNewBackground"); +} + +uint32 SkyLogic::fnSort(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSort"); +} + +uint32 SkyLogic::fnNoSpriteEngine(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNoSpriteEngine"); +} + +uint32 SkyLogic::fnNoSpritesA6(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNoSpritesA6"); +} + +uint32 SkyLogic::fnResetId(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnResetId"); +} + +uint32 SkyLogic::fnToggleGrid(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnToggleGrid"); +} + +uint32 SkyLogic::fnPause(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPause"); +} + +uint32 SkyLogic::fnRunAnimMod(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRunAnimMod"); +} + +uint32 SkyLogic::fnSimpleMod(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSimpleMod"); +} + +uint32 SkyLogic::fnRunFrames(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRunFrames"); +} + +uint32 SkyLogic::fnAwaitSync(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAwaitSync"); +} + +uint32 SkyLogic::fnIncMegaSet(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnIncMegaSet"); +} + +uint32 SkyLogic::fnDecMegaSet(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnDecMegaSet"); +} + +uint32 SkyLogic::fnSetMegaSet(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetMegaSet"); +} + +uint32 SkyLogic::fnMoveItems(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnMoveItems"); +} + +uint32 SkyLogic::fnNewList(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNewList"); +} + +uint32 SkyLogic::fnAskThis(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnAskThis"); +} + +uint32 SkyLogic::fnRandom(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRandom"); +} + +uint32 SkyLogic::fnPersonHere(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPersonHere"); +} + +uint32 SkyLogic::fnToggleMouse(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnToggleMouse"); +} + +uint32 SkyLogic::fnMouseOn(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnMouseOn"); +} + +uint32 SkyLogic::fnMouseOff(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnMouseOff"); +} + +uint32 SkyLogic::fnFetchX(uint32 a, uint32 b, uint32 c) { +	Compact *cpt = SkyState::fetchCompact(a); +	_scriptVariables[RESULT] = cpt->xcood; +	return 1; +} + +uint32 SkyLogic::fnFetchY(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFetchY"); +} + +uint32 SkyLogic::fnTestList(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnTestList"); +} + +uint32 SkyLogic::fnFetchPlace(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFetchPlace"); +} + +uint32 SkyLogic::fnCustomJoey(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCustomJoey"); +} + +uint32 SkyLogic::fnSetPalette(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetPalette"); +} + +uint32 SkyLogic::fnTextModule(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnTextModule"); +} + +uint32 SkyLogic::fnChangeName(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnChangeName"); +} + +uint32 SkyLogic::fnMiniLoad(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnMiniLoad"); +} + +uint32 SkyLogic::fnFlushBuffers(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFlushBuffers"); +} + +uint32 SkyLogic::fnFlushChip(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFlushChip"); +} + +uint32 SkyLogic::fnSaveCoods(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSaveCoods"); +} + +uint32 SkyLogic::fnPlotGrid(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPlotGrid"); +} + +uint32 SkyLogic::fnRemoveGrid(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRemoveGrid"); +} + +uint32 SkyLogic::fnEyeball(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnEyeball"); +} + +uint32 SkyLogic::fnCursorUp(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnCursorUp"); +} + +uint32 SkyLogic::fnLeaveSection(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnLeaveSection"); +} + +uint32 SkyLogic::fnEnterSection(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnEnterSection"); +} + +uint32 SkyLogic::fnRestoreGame(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRestoreGame"); +} + +uint32 SkyLogic::fnRestartGame(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnRestartGame"); +} + +uint32 SkyLogic::fnNewSwingSeq(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnNewSwingSeq"); +} + +uint32 SkyLogic::fnWaitSwingEnd(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnWaitSwingEnd"); +} + +uint32 SkyLogic::fnSkipIntroCode(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSkipIntroCode"); +} + +uint32 SkyLogic::fnBlankScreen(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnBlankScreen"); +} + +uint32 SkyLogic::fnPrintCredit(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPrintCredit"); +} + +uint32 SkyLogic::fnLookAt(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnLookAt"); +} + +uint32 SkyLogic::fnLincTextModule(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnLincTextModule"); +} + +uint32 SkyLogic::fnTextKill2(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnTextKill2"); +} + +uint32 SkyLogic::fnSetFont(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnSetFont"); +} + +uint32 SkyLogic::fnStartFx(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStartFx"); +} + +uint32 SkyLogic::fnStopFx(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStopFx"); +} + +uint32 SkyLogic::fnStartMusic(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStartMusic"); +} + +uint32 SkyLogic::fnStopMusic(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnStopMusic"); +} + +uint32 SkyLogic::fnFadeDown(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFadeDown"); +} + +uint32 SkyLogic::fnFadeUp(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnFadeUp"); +} + +uint32 SkyLogic::fnQuitToDos(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnQuitToDos"); +} + +uint32 SkyLogic::fnPauseFx(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPauseFx"); +} + +uint32 SkyLogic::fnUnPauseFx(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnUnPauseFx"); +} + +uint32 SkyLogic::fnPrintf(uint32 a, uint32 b, uint32 c) { +	error("Stub: fnPrintf"); +} + | 
