AGOS: Add initial support for mouse wheel.

This commit is contained in:
Kirben 2014-03-02 22:19:32 +11:00
parent 418de45d9c
commit 83b32010b3
5 changed files with 138 additions and 29 deletions

View file

@ -296,7 +296,7 @@ void AGOSEngine::userGame(bool load) {
const char *message1;
int i = 0, numSaveGames;
char *name;
char buf[10];
memset(_saveBuf, 0, sizeof(_saveBuf));
numSaveGames = countSaveGames();
@ -325,8 +325,8 @@ restart:
for (; *message1; message1++)
windowPutChar(window, *message1);
memset(buf, 0, 10);
name = buf;
memset(_saveBuf, 0, 10);
name = _saveBuf;
_saveGameNameLen = 0;
while (!shouldQuit()) {
@ -384,9 +384,10 @@ restart:
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
}
void AGOSEngine_Elvira2::listSaveGames(char *dst) {
void AGOSEngine_Elvira2::listSaveGames() {
Common::InSaveFile *in;
uint y, slot;
char *dst = _saveBuf;
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
@ -469,7 +470,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
int i, numSaveGames;
char *name;
bool b;
char buf[200];
memset(_saveBuf, 0, sizeof(_saveBuf));
_saveOrLoad = load;
@ -485,28 +486,28 @@ void AGOSEngine_Elvira2::userGame(bool load) {
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
listSaveGames(buf);
listSaveGames();
if (!load) {
WindowBlock *window = _windowArray[num];
int16 slot = -1;
name = buf + 192;
name = _saveBuf + 192;
while (!shouldQuit()) {
windowPutChar(window, 128);
_saveLoadEdit = true;
i = userGameGetKey(&b, buf, 128);
i = userGameGetKey(&b, 128);
if (b) {
if (i <= 223) {
if (!confirmOverWrite(window)) {
listSaveGames(buf);
listSaveGames();
continue;
}
if (!saveGame(_saveLoadRowCurPos + i, buf + i * 8))
if (!saveGame(_saveLoadRowCurPos + i, _saveBuf + i * 8))
fileError(_windowArray[num], true);
}
@ -518,7 +519,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
slot = matchSaveGame(name, numSaveGames);
if (slot >= 0) {
if (!confirmOverWrite(window)) {
listSaveGames(buf);
listSaveGames();
continue;
}
}
@ -540,11 +541,11 @@ void AGOSEngine_Elvira2::userGame(bool load) {
if (slot < 0)
slot = numSaveGames;
if (!saveGame(slot, buf + 192))
if (!saveGame(slot, _saveBuf + 192))
fileError(_windowArray[num], true);
}
} else {
i = userGameGetKey(&b, buf, 128);
i = userGameGetKey(&b, 128);
if (i != 225) {
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
fileError(_windowArray[num], false);
@ -560,7 +561,7 @@ get_out:;
restartAnimation();
}
int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
int AGOSEngine_Elvira2::userGameGetKey(bool *b, uint maxChar) {
HitArea *ha;
*b = true;
@ -588,7 +589,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
if (_saveLoadRowCurPos >= _numSaveGameRows)
_saveLoadRowCurPos = 1;
listSaveGames(buf);
listSaveGames();
} else if (ha->id < 224) {
return ha->id - 200;
}
@ -597,9 +598,10 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
return 225;
}
void AGOSEngine_Simon1::listSaveGames(char *dst) {
void AGOSEngine_Simon1::listSaveGames() {
Common::InSaveFile *in;
uint16 i, slot, lastSlot;
char *dst = _saveBuf;
disableFileBoxes();
@ -681,7 +683,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
WindowBlock *window;
char *name;
bool b;
char buf[108];
memset(_saveBuf, 0, sizeof(_saveBuf));
int maxChar = (_language == Common::HE_ISR) ? 155: 128;
_saveOrLoad = load;
@ -704,7 +706,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
_saveLoadEdit = false;
restart:;
i = userGameGetKey(&b, buf, maxChar);
i = userGameGetKey(&b, maxChar);
if (i == 205)
goto get_out;
@ -730,7 +732,7 @@ restart:;
}
window->textLength = 3;
name = buf + i * 18;
name = _saveBuf + i * 18;
// now process entire savegame name to get correct x offset for cursor
_saveGameNameLen = 0;
@ -763,7 +765,7 @@ restart:;
_saveLoadEdit = true;
i = userGameGetKey(&b, buf, maxChar);
i = userGameGetKey(&b, maxChar);
if (b) {
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);
} else {
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
@ -827,12 +829,12 @@ get_out:;
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
}
int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
int AGOSEngine_Simon1::userGameGetKey(bool *b, uint maxChar) {
HitArea *ha;
*b = true;
if (!_saveLoadEdit) {
listSaveGames(buf);
listSaveGames();
}
_keyPressed.reset();
@ -861,7 +863,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
_saveLoadRowCurPos -= 6;
_saveLoadEdit = false;
listSaveGames(buf);
listSaveGames();
}
} else if (ha->id == 207) {
if (_saveDialogFlag) {
@ -870,7 +872,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
_saveLoadRowCurPos = _numSaveGameRows;
_saveLoadEdit = false;
listSaveGames(buf);
listSaveGames();
}
} else if (ha->id < 214) {
return ha->id - 208;