svn-id: r26858
This commit is contained in:
Travis Howell 2007-05-17 09:00:14 +00:00
parent 565d0d0a7d
commit d4191508f6
7 changed files with 157 additions and 130 deletions

View File

@ -762,7 +762,7 @@ protected:
void displayBoxStars();
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
void handleMouseMoved();
virtual void handleMouseMoved();
void initMouse();
virtual void drawMousePointer();
@ -815,10 +815,10 @@ protected:
void writeChar(WindowBlock *window, int x, int y, int offs, int val);
byte *allocBlock(uint32 size);
void checkNoOverWrite();
virtual void checkNoOverWrite();
void checkRunningAnims();
void checkAnims(uint a);
void checkZonePtrs();
virtual void checkAnims(uint a);
virtual void checkZonePtrs();
void setZoneBuffers();
void runVgaScript();
@ -1609,6 +1609,10 @@ protected:
void listSaveGames(int n);
void saveUserGame(int slot);
void windowBackSpace(WindowBlock *window);
virtual void checkNoOverWrite();
virtual void checkAnims(uint a);
virtual void checkZonePtrs();
};
class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@ -1646,6 +1650,7 @@ protected:
const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
virtual void handleMouseMoved();
virtual void drawMousePointer();
virtual void resetVerbs();

View File

@ -300,7 +300,7 @@ static const byte _mouseOffs[29 * 32] = {
0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
void AGOSEngine::handleMouseMoved() {
void AGOSEngine_PuzzlePack::handleMouseMoved() {
uint x;
if (getGameId() != GID_DIMP && _mouseHideCount) {
@ -311,6 +311,38 @@ void AGOSEngine::handleMouseMoved() {
CursorMan.showMouse(true);
_mouse = _eventMan->getMousePos();
x = 0;
if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
_verbHitArea = 300;
_leftButtonDown = 0;
x = 1;
}
if (_rightButtonDown != 0) {
_verbHitArea = (getGameId() == GID_DIMP) ? 301 : 300;
_rightButtonDown = 0;
x = 1;
}
boxController(_mouse.x, _mouse.y, x);
_lastHitArea3 = _lastHitArea;
if (x == 1 && _lastHitArea == NULL)
_lastHitArea3 = (HitArea *) -1;
drawMousePointer();
}
void AGOSEngine::handleMouseMoved() {
uint x;
if (_mouseHideCount) {
CursorMan.showMouse(false);
return;
}
CursorMan.showMouse(true);
_mouse = _eventMan->getMousePos();
if (_defaultVerb) {
uint id = 101;
if (_mouse.y >= 136)
@ -386,8 +418,6 @@ void AGOSEngine::handleMouseMoved() {
}
}
// FIXME: The value of _mouseOld is *never* changed and hence
// always equal to (0,0). This seems like a bug.
if (_mouse != _mouseOld)
_needHitAreaRecalc++;
@ -416,14 +446,8 @@ void AGOSEngine::handleMouseMoved() {
x = 0;
if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
if (getGameType() == GType_PP)
_verbHitArea = 300;
_leftButtonDown = 0;
x = 1;
} else if (getGameType() == GType_PP && _rightButtonDown != 0) {
_verbHitArea = 300;
_rightButtonDown = 0;
x = 1;
} else {
if (_litBoxFlag == 0 && _needHitAreaRecalc == 0)
goto get_out;
@ -436,6 +460,8 @@ boxstuff:
_lastHitArea3 = (HitArea *) -1;
get_out:
_mouseOld = _mouse;
drawMousePointer();
_needHitAreaRecalc = 0;

View File

@ -490,14 +490,14 @@ void AGOSEngine_Feeble::timer_proc1() {
return;
}
}
if (getGameType() == GType_FF) {
_moviePlay->nextFrame();
}
animateSprites();
}
if (getGameType() == GType_FF) {
_moviePlay->nextFrame();
}
animateSprites();
if (_copyPartialMode == 2) {
fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
_copyPartialMode = 0;

View File

@ -40,7 +40,7 @@ uint AGOSEngine::setVerbText(HitArea *ha) {
if (ha->flags & kBFTextBox) {
if (getGameType() == GType_PP)
id = ha->id;
else if (getGameType() == GType_FF && (_lastHitArea->flags & kBFHyperBox))
else if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
id = ha->data;
else
id = ha->flags / 256;
@ -160,6 +160,7 @@ out_of_here:
_lastHitArea3 = 0;
_lastHitArea = 0;
_lastNameOn = NULL;
_mouseCursor = 0;
_noRightClick = 0;
}
@ -191,9 +192,9 @@ void AGOSEngine::waitForInput() {
_dragAccept = 1;
for (;;) {
if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed == 35)
displayBoxStars();
if (processSpecialKeys() != 0) {
if (processSpecialKeys()) {
if ((getGameType() == GType_PP && getGameId() != GID_DIMP) ||
getGameType() == GType_WW)
goto out_of_here;
@ -203,14 +204,14 @@ void AGOSEngine::waitForInput() {
_lastHitArea3 = NULL;
_dragAccept = 1;
} else {
if (_lastHitArea3 != 0 || _dragMode != 0)
if (_lastHitArea3 || _dragMode)
break;
hitarea_stuff_helper();
delay(100);
}
}
if (_lastHitArea3 == 0 && _dragMode != 0) {
if (!_lastHitArea3 && _dragMode) {
ha = _lastClickRem;
if (ha == 0 || ha->item_ptr == NULL || !(ha->flags & kBFDragBox)) {
@ -254,11 +255,8 @@ void AGOSEngine::waitForInput() {
}
ha = _lastHitArea;
if (_lastHitArea == NULL) {
continue;
}
if (ha->id == 0x7FFB) {
if (ha == NULL) {
} else if (ha->id == 0x7FFB) {
inventoryUp(ha->window);
} else if (ha->id == 0x7FFC) {
inventoryDown(ha->window);
@ -298,7 +296,7 @@ void AGOSEngine::waitForInput() {
waitForSync(34);
}
}
if (ha->item_ptr && (ha->verb == 0 || _verbHitArea != 0 ||
if (ha->item_ptr && (!ha->verb || _verbHitArea ||
(_hitAreaSubjectItem != ha->item_ptr && (ha->flags & kBFBoxItem)))
) {
_hitAreaSubjectItem = ha->item_ptr;
@ -307,7 +305,7 @@ void AGOSEngine::waitForInput() {
displayName(ha);
_nameLocked = 1;
if (_verbHitArea != 0) {
if (_verbHitArea) {
break;
}
@ -318,8 +316,8 @@ void AGOSEngine::waitForInput() {
else if (getGameType() == GType_ELVIRA1)
lightMenuStrip(getUserFlag1(ha->item_ptr, 6));
} else {
if (ha->verb != 0) {
if (getGameType() == GType_WW && _mouseCursor != 0 && _mouseCursor < 4) {
if (ha->verb) {
if (getGameType() == GType_WW && _mouseCursor && _mouseCursor < 4) {
_hitAreaSubjectItem = ha->item_ptr;
break;
}
@ -371,7 +369,7 @@ void AGOSEngine::hitarea_stuff_helper() {
} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW ||
getGameType() == GType_SIMON1) {
uint subr_id = (uint16)_variableArray[254];
if (subr_id != 0) {
if (subr_id) {
Subroutine *sub = getSubroutineByID(subr_id);
if (sub != NULL) {
startSubroutineEx(sub);
@ -398,7 +396,7 @@ void AGOSEngine::hitarea_stuff_helper_2() {
Subroutine *sub;
subr_id = (uint16)_variableArray[249];
if (subr_id != 0) {
if (subr_id) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {
_variableArray[249] = 0;
@ -409,7 +407,7 @@ void AGOSEngine::hitarea_stuff_helper_2() {
}
subr_id = (uint16)_variableArray[254];
if (subr_id != 0) {
if (subr_id) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {
_variableArray[254] = 0;
@ -446,7 +444,7 @@ void AGOSEngine::permitInput() {
}
_curWindow = 0;
if (_windowArray[0] != 0) {
if (_windowArray[0]) {
_textWindow = _windowArray[0];
justifyStart();
}

View File

@ -465,8 +465,7 @@ void AGOSEngine::defineBox(int id, int x, int y, int width, int height, int flag
ha->verb = verb;
ha->item_ptr = item_ptr;
if ((getGameType() == GType_FF || getGameType() == GType_PP) &&
(ha->flags & kBFHyperBox)) {
if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
ha->data = _hyperLink;
ha->priority = 50;
}
@ -535,9 +534,6 @@ void AGOSEngine::resetVerbs() {
}
void AGOSEngine_Feeble::setVerb(HitArea *ha) {
if (getGameType() == GType_PP)
return;
int cursor = _mouseCursor;
if (_noRightClick)
return;
@ -736,27 +732,13 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) {
}
void AGOSEngine::displayName(HitArea *ha) {
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_PP)
return;
bool result;
int x = 0, y = 0;
if (getGameType() == GType_PP) {
if (ha->flags & kBFHyperBox) {
_lastNameOn = ha;
return;
}
if (findBox(50))
return;
y = ha->y;
y -= 17;
if (y < 0)
y = 0;
y += 2;
x = ha->width / 2 + ha->x;
} else if (getGameType() == GType_FF) {
if (getGameType() == GType_FF) {
if (ha->flags & kBFHyperBox) {
_lastNameOn = ha;
return;

View File

@ -177,7 +177,7 @@ void AGOSEngine::vc62_fastFadeOut() {
memcpy(_videoBuf1, _currentPalette, _fastFadeCount * 4);
if (getGameType() == GType_FF || getGameType() == GType_PP) {
if (getBitFlag(75)) {
if (getGameType() == GType_FF && getBitFlag(75)) {
fadeCount = 4;
fadeSize = 64;
} else {
@ -196,7 +196,7 @@ void AGOSEngine::vc62_fastFadeOut() {
}
if (getGameType() == GType_FF || getGameType() == GType_PP) {
clearSurfaces(480);
clearSurfaces(_screenHeight);
} else if (getGameType() == GType_WW) {
memset(getFrontBuf(), 0, _screenWidth * _screenHeight);
} else {

View File

@ -103,41 +103,10 @@ byte *AGOSEngine::allocBlock(uint32 size) {
}
}
void AGOSEngine::checkNoOverWrite() {
VgaPointersEntry *vpe;
if (_noOverWrite == 0xFFFF)
return;
vpe = &_vgaBufferPointers[_noOverWrite];
if (getGameType() == GType_FF || getGameType() == GType_PP) {
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1End;
} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile2End;
} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->sfxFileEnd;
} else {
_rejectBlock = false;
}
} else {
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
_rejectBlock = false;
}
}
}
void AGOSEngine::checkRunningAnims() {
VgaSprite *vsp;
if (getGameType() != GType_FF && getGameType() != GType_PP && (_lockWord & 0x20)) {
if (getGameType() != GType_FF && getGameType() != GType_PP &&
(_lockWord & 0x20)) {
return;
}
@ -148,32 +117,92 @@ void AGOSEngine::checkRunningAnims() {
}
}
void AGOSEngine_Feeble::checkNoOverWrite() {
VgaPointersEntry *vpe;
if (_noOverWrite == 0xFFFF)
return;
vpe = &_vgaBufferPointers[_noOverWrite];
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1End;
} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile2End;
} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->sfxFileEnd;
} else {
_rejectBlock = false;
}
}
void AGOSEngine_Feeble::checkAnims(uint a) {
VgaPointersEntry *vpe;
vpe = &_vgaBufferPointers[a];
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1End;
} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile2End;
} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->sfxFileEnd;
} else {
_rejectBlock = false;
}
}
void AGOSEngine_Feeble::checkZonePtrs() {
uint count = ARRAYSIZE(_vgaBufferPointers);
VgaPointersEntry *vpe = _vgaBufferPointers;
do {
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
vpe->vgaFile1 = NULL;
vpe->vgaFile1End = NULL;
vpe->vgaFile2 = NULL;
vpe->vgaFile2End = NULL;
vpe->sfxFile = NULL;
vpe->sfxFileEnd = NULL;
}
} while (++vpe, --count);
}
void AGOSEngine::checkNoOverWrite() {
VgaPointersEntry *vpe;
if (_noOverWrite == 0xFFFF)
return;
vpe = &_vgaBufferPointers[_noOverWrite];
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
_rejectBlock = false;
}
}
void AGOSEngine::checkAnims(uint a) {
VgaPointersEntry *vpe;
vpe = &_vgaBufferPointers[a];
if (getGameType() == GType_FF || getGameType() == GType_PP) {
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1End;
} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile2End;
} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
_rejectBlock = true;
_vgaMemPtr = vpe->sfxFileEnd;
} else {
_rejectBlock = false;
}
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
_rejectBlock = true;
_vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
_rejectBlock = false;
}
_rejectBlock = false;
}
}
@ -181,23 +210,10 @@ void AGOSEngine::checkZonePtrs() {
uint count = ARRAYSIZE(_vgaBufferPointers);
VgaPointersEntry *vpe = _vgaBufferPointers;
do {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
vpe->vgaFile1 = NULL;
vpe->vgaFile1End = NULL;
vpe->vgaFile2 = NULL;
vpe->vgaFile2End = NULL;
vpe->sfxFile = NULL;
vpe->sfxFileEnd = NULL;
}
} else {
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
vpe->vgaFile1 = NULL;
vpe->vgaFile2 = NULL;
}
if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
vpe->vgaFile1 = NULL;
vpe->vgaFile2 = NULL;
}
} while (++vpe, --count);
}