AGOS: Add initial support for mouse wheel.
This commit is contained in:
parent
418de45d9c
commit
83b32010b3
5 changed files with 138 additions and 29 deletions
|
@ -510,6 +510,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
|
||||||
_saveLoadType = 0;
|
_saveLoadType = 0;
|
||||||
_saveLoadSlot = 0;
|
_saveLoadSlot = 0;
|
||||||
memset(_saveLoadName, 0, sizeof(_saveLoadName));
|
memset(_saveLoadName, 0, sizeof(_saveLoadName));
|
||||||
|
memset(_saveBuf, 0, sizeof(_saveBuf));
|
||||||
|
|
||||||
_saveGameNameLen = 0;
|
_saveGameNameLen = 0;
|
||||||
_saveLoadRowCurPos = 0;
|
_saveLoadRowCurPos = 0;
|
||||||
|
|
|
@ -584,6 +584,7 @@ protected:
|
||||||
|
|
||||||
byte _saveLoadType, _saveLoadSlot;
|
byte _saveLoadType, _saveLoadSlot;
|
||||||
char _saveLoadName[108];
|
char _saveLoadName[108];
|
||||||
|
char _saveBuf[200];
|
||||||
|
|
||||||
Graphics::Surface *_backGroundBuf;
|
Graphics::Surface *_backGroundBuf;
|
||||||
Graphics::Surface *_backBuf;
|
Graphics::Surface *_backBuf;
|
||||||
|
@ -834,6 +835,9 @@ protected:
|
||||||
void displayBoxStars();
|
void displayBoxStars();
|
||||||
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
|
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
|
||||||
|
|
||||||
|
virtual void handleMouseWheelUp();
|
||||||
|
virtual void handleMouseWheelDown();
|
||||||
|
|
||||||
virtual void initMouse();
|
virtual void initMouse();
|
||||||
virtual void handleMouseMoved();
|
virtual void handleMouseMoved();
|
||||||
virtual void drawMousePointer();
|
virtual void drawMousePointer();
|
||||||
|
@ -1706,10 +1710,13 @@ protected:
|
||||||
void setExitState(Item *i, uint16 n, uint16 d, uint16 s);
|
void setExitState(Item *i, uint16 n, uint16 d, uint16 s);
|
||||||
void setSRExit(Item *i, int n, int d, uint16 s);
|
void setSRExit(Item *i, int n, int d, uint16 s);
|
||||||
|
|
||||||
virtual void listSaveGames(char *dst);
|
virtual void handleMouseWheelUp();
|
||||||
|
virtual void handleMouseWheelDown();
|
||||||
|
|
||||||
|
virtual void listSaveGames();
|
||||||
virtual bool confirmOverWrite(WindowBlock *window);
|
virtual bool confirmOverWrite(WindowBlock *window);
|
||||||
virtual void userGame(bool load);
|
virtual void userGame(bool load);
|
||||||
virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
|
virtual int userGameGetKey(bool *b, uint maxChar);
|
||||||
|
|
||||||
virtual Common::String genSaveName(int slot) const;
|
virtual Common::String genSaveName(int slot) const;
|
||||||
};
|
};
|
||||||
|
@ -1829,6 +1836,9 @@ protected:
|
||||||
|
|
||||||
virtual void clearName();
|
virtual void clearName();
|
||||||
|
|
||||||
|
virtual void handleMouseWheelUp();
|
||||||
|
virtual void handleMouseWheelDown();
|
||||||
|
|
||||||
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
|
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
|
||||||
|
|
||||||
virtual void initMouse();
|
virtual void initMouse();
|
||||||
|
@ -1841,9 +1851,9 @@ protected:
|
||||||
|
|
||||||
virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
|
virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
|
||||||
|
|
||||||
virtual void listSaveGames(char *dst);
|
virtual void listSaveGames();
|
||||||
virtual void userGame(bool load);
|
virtual void userGame(bool load);
|
||||||
virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
|
virtual int userGameGetKey(bool *b, uint maxChar);
|
||||||
|
|
||||||
virtual void playMusic(uint16 music, uint16 track);
|
virtual void playMusic(uint16 music, uint16 track);
|
||||||
|
|
||||||
|
@ -1975,6 +1985,9 @@ protected:
|
||||||
virtual void drawImage(VC10_state *state);
|
virtual void drawImage(VC10_state *state);
|
||||||
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
|
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
|
||||||
|
|
||||||
|
virtual void handleMouseWheelUp();
|
||||||
|
virtual void handleMouseWheelDown();
|
||||||
|
|
||||||
void drawMousePart(int image, byte x, byte y);
|
void drawMousePart(int image, byte x, byte y);
|
||||||
virtual void initMouse();
|
virtual void initMouse();
|
||||||
virtual void drawMousePointer();
|
virtual void drawMousePointer();
|
||||||
|
|
|
@ -520,6 +520,12 @@ void AGOSEngine::delay(uint amount) {
|
||||||
case Common::EVENT_RTL:
|
case Common::EVENT_RTL:
|
||||||
case Common::EVENT_QUIT:
|
case Common::EVENT_QUIT:
|
||||||
return;
|
return;
|
||||||
|
case Common::EVENT_WHEELUP:
|
||||||
|
handleMouseWheelUp();
|
||||||
|
break;
|
||||||
|
case Common::EVENT_WHEELDOWN:
|
||||||
|
handleMouseWheelDown();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,6 +416,93 @@ void AGOSEngine::hitarea_stuff_helper_2() {
|
||||||
_runScriptReturn1 = false;
|
_runScriptReturn1 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_AGOS2
|
||||||
|
void AGOSEngine_Feeble::handleMouseWheelUp() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine_Feeble::handleMouseWheelDown() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void AGOSEngine_Simon1::handleMouseWheelUp() {
|
||||||
|
HitArea *ha = findBox(206);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
if (_saveLoadRowCurPos != 1) {
|
||||||
|
if (_saveLoadRowCurPos < 7)
|
||||||
|
_saveLoadRowCurPos = 1;
|
||||||
|
else
|
||||||
|
_saveLoadRowCurPos -= 1;
|
||||||
|
|
||||||
|
_saveLoadEdit = false;
|
||||||
|
listSaveGames();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AGOSEngine::handleMouseWheelUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine_Simon1::handleMouseWheelDown() {
|
||||||
|
HitArea *ha = findBox(207);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
if (_saveDialogFlag) {
|
||||||
|
_saveLoadRowCurPos += 1;
|
||||||
|
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
||||||
|
_saveLoadRowCurPos = _numSaveGameRows;
|
||||||
|
|
||||||
|
_saveLoadEdit = false;
|
||||||
|
listSaveGames();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AGOSEngine::handleMouseWheelDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine_Elvira2::handleMouseWheelUp() {
|
||||||
|
HitArea *ha = findBox(224);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
_saveGameNameLen = 0;
|
||||||
|
|
||||||
|
if (_saveLoadRowCurPos < 3)
|
||||||
|
_saveLoadRowCurPos = 1;
|
||||||
|
else
|
||||||
|
_saveLoadRowCurPos -= 3;
|
||||||
|
|
||||||
|
listSaveGames();
|
||||||
|
} else {
|
||||||
|
AGOSEngine::handleMouseWheelUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine_Elvira2::handleMouseWheelDown() {
|
||||||
|
HitArea *ha = findBox(224);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
_saveGameNameLen = 0;
|
||||||
|
_saveLoadRowCurPos += 3;
|
||||||
|
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
||||||
|
_saveLoadRowCurPos = 1;
|
||||||
|
|
||||||
|
listSaveGames();
|
||||||
|
} else {
|
||||||
|
AGOSEngine::handleMouseWheelDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine::handleMouseWheelUp() {
|
||||||
|
HitArea *ha = findBox(0x7FFB);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
inventoryUp(ha->window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGOSEngine::handleMouseWheelDown() {
|
||||||
|
HitArea *ha = findBox(0x7FFC);
|
||||||
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
||||||
|
inventoryDown(ha->window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AGOSEngine::permitInput() {
|
void AGOSEngine::permitInput() {
|
||||||
if (_mortalFlag)
|
if (_mortalFlag)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -296,7 +296,7 @@ void AGOSEngine::userGame(bool load) {
|
||||||
const char *message1;
|
const char *message1;
|
||||||
int i = 0, numSaveGames;
|
int i = 0, numSaveGames;
|
||||||
char *name;
|
char *name;
|
||||||
char buf[10];
|
memset(_saveBuf, 0, sizeof(_saveBuf));
|
||||||
|
|
||||||
numSaveGames = countSaveGames();
|
numSaveGames = countSaveGames();
|
||||||
|
|
||||||
|
@ -325,8 +325,8 @@ restart:
|
||||||
for (; *message1; message1++)
|
for (; *message1; message1++)
|
||||||
windowPutChar(window, *message1);
|
windowPutChar(window, *message1);
|
||||||
|
|
||||||
memset(buf, 0, 10);
|
memset(_saveBuf, 0, 10);
|
||||||
name = buf;
|
name = _saveBuf;
|
||||||
_saveGameNameLen = 0;
|
_saveGameNameLen = 0;
|
||||||
|
|
||||||
while (!shouldQuit()) {
|
while (!shouldQuit()) {
|
||||||
|
@ -384,9 +384,10 @@ restart:
|
||||||
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
|
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGOSEngine_Elvira2::listSaveGames(char *dst) {
|
void AGOSEngine_Elvira2::listSaveGames() {
|
||||||
Common::InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
uint y, slot;
|
uint y, slot;
|
||||||
|
char *dst = _saveBuf;
|
||||||
|
|
||||||
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
|
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
|
||||||
|
|
||||||
|
@ -469,7 +470,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
|
||||||
int i, numSaveGames;
|
int i, numSaveGames;
|
||||||
char *name;
|
char *name;
|
||||||
bool b;
|
bool b;
|
||||||
char buf[200];
|
memset(_saveBuf, 0, sizeof(_saveBuf));
|
||||||
|
|
||||||
_saveOrLoad = load;
|
_saveOrLoad = load;
|
||||||
|
|
||||||
|
@ -485,28 +486,28 @@ void AGOSEngine_Elvira2::userGame(bool load) {
|
||||||
|
|
||||||
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
|
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
|
||||||
|
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
|
|
||||||
if (!load) {
|
if (!load) {
|
||||||
WindowBlock *window = _windowArray[num];
|
WindowBlock *window = _windowArray[num];
|
||||||
int16 slot = -1;
|
int16 slot = -1;
|
||||||
|
|
||||||
name = buf + 192;
|
name = _saveBuf + 192;
|
||||||
|
|
||||||
while (!shouldQuit()) {
|
while (!shouldQuit()) {
|
||||||
windowPutChar(window, 128);
|
windowPutChar(window, 128);
|
||||||
|
|
||||||
_saveLoadEdit = true;
|
_saveLoadEdit = true;
|
||||||
|
|
||||||
i = userGameGetKey(&b, buf, 128);
|
i = userGameGetKey(&b, 128);
|
||||||
if (b) {
|
if (b) {
|
||||||
if (i <= 223) {
|
if (i <= 223) {
|
||||||
if (!confirmOverWrite(window)) {
|
if (!confirmOverWrite(window)) {
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saveGame(_saveLoadRowCurPos + i, buf + i * 8))
|
if (!saveGame(_saveLoadRowCurPos + i, _saveBuf + i * 8))
|
||||||
fileError(_windowArray[num], true);
|
fileError(_windowArray[num], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +519,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
|
||||||
slot = matchSaveGame(name, numSaveGames);
|
slot = matchSaveGame(name, numSaveGames);
|
||||||
if (slot >= 0) {
|
if (slot >= 0) {
|
||||||
if (!confirmOverWrite(window)) {
|
if (!confirmOverWrite(window)) {
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,11 +541,11 @@ void AGOSEngine_Elvira2::userGame(bool load) {
|
||||||
if (slot < 0)
|
if (slot < 0)
|
||||||
slot = numSaveGames;
|
slot = numSaveGames;
|
||||||
|
|
||||||
if (!saveGame(slot, buf + 192))
|
if (!saveGame(slot, _saveBuf + 192))
|
||||||
fileError(_windowArray[num], true);
|
fileError(_windowArray[num], true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
i = userGameGetKey(&b, buf, 128);
|
i = userGameGetKey(&b, 128);
|
||||||
if (i != 225) {
|
if (i != 225) {
|
||||||
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
|
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
|
||||||
fileError(_windowArray[num], false);
|
fileError(_windowArray[num], false);
|
||||||
|
@ -560,7 +561,7 @@ get_out:;
|
||||||
restartAnimation();
|
restartAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
int AGOSEngine_Elvira2::userGameGetKey(bool *b, uint maxChar) {
|
||||||
HitArea *ha;
|
HitArea *ha;
|
||||||
*b = true;
|
*b = true;
|
||||||
|
|
||||||
|
@ -588,7 +589,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
||||||
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
||||||
_saveLoadRowCurPos = 1;
|
_saveLoadRowCurPos = 1;
|
||||||
|
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
} else if (ha->id < 224) {
|
} else if (ha->id < 224) {
|
||||||
return ha->id - 200;
|
return ha->id - 200;
|
||||||
}
|
}
|
||||||
|
@ -597,9 +598,10 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
||||||
return 225;
|
return 225;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGOSEngine_Simon1::listSaveGames(char *dst) {
|
void AGOSEngine_Simon1::listSaveGames() {
|
||||||
Common::InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
uint16 i, slot, lastSlot;
|
uint16 i, slot, lastSlot;
|
||||||
|
char *dst = _saveBuf;
|
||||||
|
|
||||||
disableFileBoxes();
|
disableFileBoxes();
|
||||||
|
|
||||||
|
@ -681,7 +683,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
|
||||||
WindowBlock *window;
|
WindowBlock *window;
|
||||||
char *name;
|
char *name;
|
||||||
bool b;
|
bool b;
|
||||||
char buf[108];
|
memset(_saveBuf, 0, sizeof(_saveBuf));
|
||||||
int maxChar = (_language == Common::HE_ISR) ? 155: 128;
|
int maxChar = (_language == Common::HE_ISR) ? 155: 128;
|
||||||
|
|
||||||
_saveOrLoad = load;
|
_saveOrLoad = load;
|
||||||
|
@ -704,7 +706,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
|
||||||
_saveLoadEdit = false;
|
_saveLoadEdit = false;
|
||||||
|
|
||||||
restart:;
|
restart:;
|
||||||
i = userGameGetKey(&b, buf, maxChar);
|
i = userGameGetKey(&b, maxChar);
|
||||||
|
|
||||||
if (i == 205)
|
if (i == 205)
|
||||||
goto get_out;
|
goto get_out;
|
||||||
|
@ -730,7 +732,7 @@ restart:;
|
||||||
}
|
}
|
||||||
window->textLength = 3;
|
window->textLength = 3;
|
||||||
|
|
||||||
name = buf + i * 18;
|
name = _saveBuf + i * 18;
|
||||||
|
|
||||||
// now process entire savegame name to get correct x offset for cursor
|
// now process entire savegame name to get correct x offset for cursor
|
||||||
_saveGameNameLen = 0;
|
_saveGameNameLen = 0;
|
||||||
|
@ -763,7 +765,7 @@ restart:;
|
||||||
|
|
||||||
_saveLoadEdit = true;
|
_saveLoadEdit = true;
|
||||||
|
|
||||||
i = userGameGetKey(&b, buf, maxChar);
|
i = userGameGetKey(&b, maxChar);
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
if (i == 205)
|
if (i == 205)
|
||||||
|
@ -814,7 +816,7 @@ restart:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saveGame(_saveLoadRowCurPos + result, buf + result * 18))
|
if (!saveGame(_saveLoadRowCurPos + result, _saveBuf + result * 18))
|
||||||
fileError(_windowArray[5], true);
|
fileError(_windowArray[5], true);
|
||||||
} else {
|
} else {
|
||||||
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
|
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
|
||||||
|
@ -827,12 +829,12 @@ get_out:;
|
||||||
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
|
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
int AGOSEngine_Simon1::userGameGetKey(bool *b, uint maxChar) {
|
||||||
HitArea *ha;
|
HitArea *ha;
|
||||||
*b = true;
|
*b = true;
|
||||||
|
|
||||||
if (!_saveLoadEdit) {
|
if (!_saveLoadEdit) {
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
}
|
}
|
||||||
|
|
||||||
_keyPressed.reset();
|
_keyPressed.reset();
|
||||||
|
@ -861,7 +863,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
||||||
_saveLoadRowCurPos -= 6;
|
_saveLoadRowCurPos -= 6;
|
||||||
|
|
||||||
_saveLoadEdit = false;
|
_saveLoadEdit = false;
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
}
|
}
|
||||||
} else if (ha->id == 207) {
|
} else if (ha->id == 207) {
|
||||||
if (_saveDialogFlag) {
|
if (_saveDialogFlag) {
|
||||||
|
@ -870,7 +872,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
|
||||||
_saveLoadRowCurPos = _numSaveGameRows;
|
_saveLoadRowCurPos = _numSaveGameRows;
|
||||||
|
|
||||||
_saveLoadEdit = false;
|
_saveLoadEdit = false;
|
||||||
listSaveGames(buf);
|
listSaveGames();
|
||||||
}
|
}
|
||||||
} else if (ha->id < 214) {
|
} else if (ha->id < 214) {
|
||||||
return ha->id - 208;
|
return ha->id - 208;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue