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;
|
||||
_saveLoadSlot = 0;
|
||||
memset(_saveLoadName, 0, sizeof(_saveLoadName));
|
||||
memset(_saveBuf, 0, sizeof(_saveBuf));
|
||||
|
||||
_saveGameNameLen = 0;
|
||||
_saveLoadRowCurPos = 0;
|
||||
|
|
|
@ -584,6 +584,7 @@ protected:
|
|||
|
||||
byte _saveLoadType, _saveLoadSlot;
|
||||
char _saveLoadName[108];
|
||||
char _saveBuf[200];
|
||||
|
||||
Graphics::Surface *_backGroundBuf;
|
||||
Graphics::Surface *_backBuf;
|
||||
|
@ -834,6 +835,9 @@ protected:
|
|||
void displayBoxStars();
|
||||
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
|
||||
|
||||
virtual void handleMouseWheelUp();
|
||||
virtual void handleMouseWheelDown();
|
||||
|
||||
virtual void initMouse();
|
||||
virtual void handleMouseMoved();
|
||||
virtual void drawMousePointer();
|
||||
|
@ -1706,10 +1710,13 @@ protected:
|
|||
void setExitState(Item *i, uint16 n, uint16 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 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;
|
||||
};
|
||||
|
@ -1829,6 +1836,9 @@ protected:
|
|||
|
||||
virtual void clearName();
|
||||
|
||||
virtual void handleMouseWheelUp();
|
||||
virtual void handleMouseWheelDown();
|
||||
|
||||
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
|
||||
|
||||
virtual void initMouse();
|
||||
|
@ -1841,9 +1851,9 @@ protected:
|
|||
|
||||
virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
|
||||
|
||||
virtual void listSaveGames(char *dst);
|
||||
virtual void listSaveGames();
|
||||
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);
|
||||
|
||||
|
@ -1975,6 +1985,9 @@ protected:
|
|||
virtual void drawImage(VC10_state *state);
|
||||
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);
|
||||
virtual void initMouse();
|
||||
virtual void drawMousePointer();
|
||||
|
|
|
@ -520,6 +520,12 @@ void AGOSEngine::delay(uint amount) {
|
|||
case Common::EVENT_RTL:
|
||||
case Common::EVENT_QUIT:
|
||||
return;
|
||||
case Common::EVENT_WHEELUP:
|
||||
handleMouseWheelUp();
|
||||
break;
|
||||
case Common::EVENT_WHEELDOWN:
|
||||
handleMouseWheelDown();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -416,6 +416,93 @@ void AGOSEngine::hitarea_stuff_helper_2() {
|
|||
_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() {
|
||||
if (_mortalFlag)
|
||||
return;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue