misc fixes

svn-id: r8355
This commit is contained in:
Robert Göffringmann 2003-06-06 16:40:44 +00:00
parent 64ffbe6021
commit 09b1baf731
3 changed files with 34 additions and 19 deletions

View File

@ -1044,7 +1044,7 @@ void SkyLogic::initScriptVariables() {
_scriptVariables[709] = 1;
_scriptVariables[710] = 1;
_scriptVariables[711] = 1;
_scriptVariables[79] = 1;
_scriptVariables[719] = 1;
_scriptVariables[720] = 1;
_scriptVariables[793] = 1;
_scriptVariables[797] = 1;
@ -1067,6 +1067,15 @@ void SkyLogic::initScriptVariables() {
memcpy(_scriptVariables + 505, forwardList5b, sizeof(forwardList5b));
}
uint16 SkyLogic::mouseScript(uint32 scrNum, Compact *scriptComp) {
Compact *tmpComp = _compact;
_compact = scriptComp;
uint16 retVal = script((uint16)(scrNum & 0xFFFF), (uint16)(scrNum >> 16));
_compact = tmpComp;
return retVal;
};
/**
* \fn uint32 SkyLogic::script(uint16 scriptNo, uint16 offset)
* \brief This is the actual script engine.
@ -1374,11 +1383,13 @@ bool SkyLogic::fnCursorUp(uint32 a, uint32 b, uint32 c) {
}
bool SkyLogic::fnOpenHand(uint32 a, uint32 b, uint32 c) {
error("Stub: fnOpenHand");
warning("Stub: fnOpenHand");
return true;
}
bool SkyLogic::fnCloseHand(uint32 a, uint32 b, uint32 c) {
error("Stub: fnCloseHand");
warning("Stub: fnCloseHand");
return true;
}
bool SkyLogic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) {
@ -1740,10 +1751,10 @@ bool SkyLogic::fnStartMenu(uint32 firstObject, uint32 b, uint32 c) {
cpt->xcood = rollingX;
rollingX += 24;
if (_scriptVariables[MENU] == 2)
//if (_scriptVariables[MENU] == 2)
cpt->ycood = 136;
else
cpt->ycood = 112;
/*else
cpt->ycood = 112;*/
}
return true;
@ -1958,7 +1969,9 @@ bool SkyLogic::fnPersonHere(uint32 id, uint32 room, uint32 c) {
}
bool SkyLogic::fnToggleMouse(uint32 a, uint32 b, uint32 c) {
error("Stub: fnToggleMouse");
SkyState::fetchCompact(a)->status ^= ST_MOUSE;
return true;
}
bool SkyLogic::fnMouseOn(uint32 a, uint32 b, uint32 c) {
@ -2233,12 +2246,12 @@ bool SkyLogic::fnQuitToDos(uint32 a, uint32 b, uint32 c) {
}
bool SkyLogic::fnPauseFx(uint32 a, uint32 b, uint32 c) {
warning("Stub: fnPauseFx");
//warning("Stub: fnPauseFx");
return true;
}
bool SkyLogic::fnUnPauseFx(uint32 a, uint32 b, uint32 c) {
warning("Stub: fnUnPauseFx");
//warning("Stub: fnUnPauseFx");
return true;
}

View File

@ -92,7 +92,7 @@ public:
void pause();
void waitSync();
void simpleAnim();
uint16 script(uint32 num) { return script((uint16)(num & 0xFFFF), (uint16)(num >> 16)); };
uint16 mouseScript(uint32 scrNum, Compact *scriptComp);
uint16 script(uint16 scriptNo, uint16 offset);
bool fnCacheChip(uint32 a, uint32 b, uint32 c);

View File

@ -135,7 +135,7 @@ bool SkyMouse::fnAddHuman(void) {
//surely this script should be run just in case
//I am going to try it anyway
if (SkyLogic::_scriptVariables[GET_OFF])
_skyLogic->script(SkyLogic::_scriptVariables[GET_OFF]);
_skyLogic->script((uint16)SkyLogic::_scriptVariables[GET_OFF],(uint16)(SkyLogic::_scriptVariables[GET_OFF] >> 16));
SkyLogic::_scriptVariables[SPECIAL_ITEM] = 0xFFFFFFFF;
SkyLogic::_scriptVariables[GET_OFF] = RESET_MOUSE;
@ -239,18 +239,19 @@ void SkyMouse::pointerEngine(void) {
Compact *itemData = SkyState::fetchCompact(itemNum);
currentList++;
if ((itemData->screen == SkyLogic::_scriptVariables[SCREEN]) && (itemData->status & 16)) {
if (itemData->xcood + itemData->mouseRelX > _tMouseX) continue;
if (itemData->xcood + itemData->mouseRelX + itemData->mouseSizeX < _tMouseX) continue;
if (itemData->ycood + itemData->mouseRelY > _tMouseY) continue;
if (itemData->ycood + itemData->mouseRelY + itemData->mouseSizeY < _tMouseY) continue;
if (itemData->xcood + ((int16)itemData->mouseRelX) > _tMouseX) continue;
if (itemData->xcood + ((int16)itemData->mouseRelX) + itemData->mouseSizeX < _tMouseX) continue;
if (itemData->ycood + ((int16)itemData->mouseRelY) > _tMouseY) continue;
if (itemData->ycood + ((int16)itemData->mouseRelY) + itemData->mouseSizeY < _tMouseY) continue;
// we've hit the item
if (SkyLogic::_scriptVariables[SPECIAL_ITEM] == itemNum)
return;
SkyLogic::_scriptVariables[SPECIAL_ITEM] = itemNum;
if (SkyLogic::_scriptVariables[GET_OFF])
_skyLogic->script(SkyLogic::_scriptVariables[GET_OFF]);
_skyLogic->mouseScript(SkyLogic::_scriptVariables[GET_OFF], itemData);
SkyLogic::_scriptVariables[GET_OFF] = itemData->mouseOff;
if (itemData->mouseOn) _skyLogic->script(itemData->mouseOn);
if (itemData->mouseOn)
_skyLogic->mouseScript(itemData->mouseOn, itemData);
return;
}
}
@ -259,8 +260,9 @@ void SkyMouse::pointerEngine(void) {
} while (*currentList != 0);
if (SkyLogic::_scriptVariables[SPECIAL_ITEM] != 0) {
SkyLogic::_scriptVariables[SPECIAL_ITEM] = 0;
if (SkyLogic::_scriptVariables[GET_OFF])
_skyLogic->script(SkyLogic::_scriptVariables[GET_OFF]);
_skyLogic->script((uint16)SkyLogic::_scriptVariables[GET_OFF],(uint16)(SkyLogic::_scriptVariables[GET_OFF] >> 16));
SkyLogic::_scriptVariables[GET_OFF] = 0;
}
}
@ -275,7 +277,7 @@ void SkyMouse::buttonEngine1(void) {
if (SkyLogic::_scriptVariables[SPECIAL_ITEM]) { //over anything?
Compact *item = SkyState::fetchCompact(SkyLogic::_scriptVariables[SPECIAL_ITEM]);
if (item->mouseClick)
_skyLogic->script(item->mouseClick, 0);
_skyLogic->mouseScript(item->mouseClick, item);
}
}
}