2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-06-29 16:11:13 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-06-29 16:11:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Verb and hitarea handling
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
|
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/agos.h"
|
|
|
|
#include "agos/intern.h"
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2004-07-31 10:14:05 +00:00
|
|
|
static const char *const russian_verb_names[] = {
|
|
|
|
"Ietj _",
|
|
|
|
"Qnotrft< pa",
|
|
|
|
"Nt_r[t<",
|
|
|
|
"Ecjdat<",
|
|
|
|
"Q=fst<",
|
|
|
|
"C^]t<",
|
|
|
|
"Ha_r[t<",
|
|
|
|
"Isqom<^ocat<",
|
|
|
|
"Docorjt<",
|
|
|
|
"Qp]t<",
|
|
|
|
"Neft<",
|
|
|
|
"Eat<"
|
|
|
|
};
|
|
|
|
|
2003-10-08 07:38:48 +00:00
|
|
|
static const char *const hebrew_verb_names[] = {
|
|
|
|
"LJ @L",
|
|
|
|
"DQZKL RL",
|
|
|
|
"TZG",
|
|
|
|
"DFF",
|
|
|
|
"@KEL",
|
|
|
|
"DXM",
|
|
|
|
"QBEX",
|
|
|
|
"DYZNY",
|
|
|
|
"CAX @L",
|
|
|
|
"DQX",
|
|
|
|
"LAY",
|
|
|
|
"ZO"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const spanish_verb_names[] = {
|
|
|
|
"Caminar",
|
|
|
|
"Mirar",
|
|
|
|
"Abrir",
|
|
|
|
"Mover",
|
|
|
|
"Consumir",
|
|
|
|
"Coger",
|
|
|
|
"Cerrar",
|
|
|
|
"Usar",
|
|
|
|
"Hablar",
|
|
|
|
"Quitar",
|
|
|
|
"Llevar",
|
|
|
|
"Dar"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const italian_verb_names[] = {
|
|
|
|
"Vai verso",
|
|
|
|
"Osserva",
|
|
|
|
"Apri",
|
|
|
|
"Sposta",
|
|
|
|
"Mangia",
|
|
|
|
"Raccogli",
|
|
|
|
"Chiudi",
|
|
|
|
"Usa",
|
|
|
|
"Parla a",
|
|
|
|
"Togli",
|
|
|
|
"Indossa",
|
|
|
|
"Dai"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const french_verb_names[] = {
|
|
|
|
"Aller vers",
|
|
|
|
"Regarder",
|
|
|
|
"Ouvrir",
|
|
|
|
"D/placer",
|
|
|
|
"Consommer",
|
|
|
|
"Prendre",
|
|
|
|
"Fermer",
|
|
|
|
"Utiliser",
|
|
|
|
"Parler ;",
|
|
|
|
"Enlever",
|
|
|
|
"Mettre",
|
|
|
|
"Donner"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const german_verb_names[] = {
|
|
|
|
"Gehe zu",
|
|
|
|
"Schau an",
|
|
|
|
";ffne",
|
|
|
|
"Bewege",
|
|
|
|
"Verzehre",
|
|
|
|
"Nimm",
|
|
|
|
"Schlie+e",
|
|
|
|
"Benutze",
|
|
|
|
"Rede mit",
|
|
|
|
"Entferne",
|
|
|
|
"Trage",
|
|
|
|
"Gib"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const english_verb_names[] = {
|
2002-10-31 01:27:05 +00:00
|
|
|
"Walk to",
|
|
|
|
"Look at",
|
|
|
|
"Open",
|
|
|
|
"Move",
|
|
|
|
"Consume",
|
|
|
|
"Pick up",
|
|
|
|
"Close",
|
|
|
|
"Use",
|
|
|
|
"Talk to",
|
|
|
|
"Remove",
|
|
|
|
"Wear",
|
|
|
|
"Give"
|
|
|
|
};
|
|
|
|
|
2008-03-29 13:27:25 +00:00
|
|
|
static const char *const czech_verb_names[] = {
|
|
|
|
"Jit",
|
|
|
|
"Podivat se",
|
|
|
|
"Otevrit",
|
|
|
|
"Pohnout s",
|
|
|
|
"Snist",
|
|
|
|
"Sebrat",
|
|
|
|
"Zavrit",
|
|
|
|
"Pouzit",
|
|
|
|
"Mluvit s",
|
|
|
|
"Odstranit",
|
|
|
|
"Oblect",
|
|
|
|
"Dat"
|
|
|
|
};
|
|
|
|
|
2004-07-31 10:14:05 +00:00
|
|
|
static const char *const russian_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "s yfn?",
|
|
|
|
"", "", "", "_onu ?"
|
|
|
|
};
|
|
|
|
|
2003-02-05 09:29:37 +00:00
|
|
|
static const char *const hebrew_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "RM ND ?",
|
|
|
|
"", "", "", "LNI ?"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const spanish_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
2003-03-31 13:30:45 +00:00
|
|
|
"", "", "", "^con qu/?",
|
|
|
|
"", "", "", "^a qui/n?"
|
2003-02-05 09:29:37 +00:00
|
|
|
};
|
|
|
|
|
2003-01-29 10:08:56 +00:00
|
|
|
static const char *const italian_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
2003-04-02 01:59:43 +00:00
|
|
|
"", "", "", "con cosa ?",
|
2003-01-29 10:08:56 +00:00
|
|
|
"", "", "", "a chi ?"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const french_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "avec quoi ?",
|
|
|
|
"", "", "", "; qui ?"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const german_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "mit was ?",
|
|
|
|
"", "", "", "zu wem ?"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const english_verb_prep_names[] = {
|
2002-10-31 01:27:05 +00:00
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "with what ?",
|
|
|
|
"", "", "", "to whom ?"
|
|
|
|
};
|
|
|
|
|
2008-03-29 13:27:25 +00:00
|
|
|
static const char *const czech_verb_prep_names[] = {
|
|
|
|
"", "", "", "",
|
|
|
|
"", "", "", "s cim ?",
|
|
|
|
"", "", "", "komu ?"
|
|
|
|
};
|
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-04-15 05:33:21 +00:00
|
|
|
void AGOSEngine_Feeble::clearName() {
|
|
|
|
stopAnimateSimon2(2, 6);
|
|
|
|
_lastNameOn = NULL;
|
2010-07-04 07:32:12 +00:00
|
|
|
_animatePointer = false;
|
2007-04-15 05:33:21 +00:00
|
|
|
_mouseAnim = 1;
|
|
|
|
return;
|
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2007-04-15 05:33:21 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
void AGOSEngine_Simon2::clearName() {
|
|
|
|
if (getBitFlag(79)) {
|
|
|
|
sendSync(202);
|
|
|
|
_lastNameOn = NULL;
|
2006-10-18 11:52:55 +00:00
|
|
|
return;
|
2008-03-23 23:18:43 +00:00
|
|
|
}
|
2006-10-18 11:52:55 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
AGOSEngine_Simon1::clearName();
|
|
|
|
}
|
2006-10-18 11:52:55 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
void AGOSEngine_Simon1::clearName() {
|
2002-06-29 16:11:13 +00:00
|
|
|
HitArea *ha;
|
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
if (_currentVerbBox == _lastVerbOn)
|
|
|
|
return;
|
2002-07-07 19:06:48 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
resetNameWindow();
|
|
|
|
_lastVerbOn = _currentVerbBox;
|
|
|
|
|
|
|
|
if (_currentVerbBox != NULL && (ha = findBox(200)) && (ha->flags & kBFBoxDead) && !(_currentVerbBox->flags & kBFBoxDead))
|
|
|
|
printVerbOf(_currentVerbBox->id);
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
void AGOSEngine::clearName() {
|
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
|
2002-06-29 16:11:13 +00:00
|
|
|
return;
|
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
if (_nameLocked || !_lastNameOn)
|
2008-03-23 23:18:43 +00:00
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2008-03-23 23:18:43 +00:00
|
|
|
resetNameWindow();
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::printVerbOf(uint hitarea_id) {
|
2002-06-29 16:11:13 +00:00
|
|
|
const char *txt;
|
2003-10-08 07:38:48 +00:00
|
|
|
const char * const *verb_names;
|
2003-02-05 19:21:23 +00:00
|
|
|
const char * const *verb_prep_names;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
|
|
|
hitarea_id -= 101;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
if (_showPreposition) {
|
2003-02-05 19:21:23 +00:00
|
|
|
switch (_language) {
|
2005-11-18 02:31:24 +00:00
|
|
|
case Common::RU_RUS:
|
|
|
|
verb_prep_names = russian_verb_prep_names;
|
|
|
|
break;
|
2010-04-12 21:21:06 +00:00
|
|
|
case Common::HE_ISR:
|
2005-11-18 02:31:24 +00:00
|
|
|
verb_prep_names = hebrew_verb_prep_names;
|
|
|
|
break;
|
|
|
|
case Common::ES_ESP:
|
|
|
|
verb_prep_names = spanish_verb_prep_names;
|
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
2007-09-19 08:40:12 +00:00
|
|
|
verb_prep_names = italian_verb_prep_names;
|
2005-11-18 02:31:24 +00:00
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
verb_prep_names = french_verb_prep_names;
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
verb_prep_names = german_verb_prep_names;
|
|
|
|
break;
|
2008-03-29 13:27:25 +00:00
|
|
|
case Common::CZ_CZE:
|
|
|
|
verb_prep_names = czech_verb_prep_names;
|
|
|
|
break;
|
2007-09-19 08:40:12 +00:00
|
|
|
default:
|
2005-11-18 02:31:24 +00:00
|
|
|
verb_prep_names = english_verb_prep_names;
|
|
|
|
break;
|
2003-01-29 10:08:56 +00:00
|
|
|
}
|
2003-02-09 00:20:52 +00:00
|
|
|
CHECK_BOUNDS(hitarea_id, english_verb_prep_names);
|
2003-02-05 19:50:10 +00:00
|
|
|
txt = verb_prep_names[hitarea_id];
|
2002-06-29 16:11:13 +00:00
|
|
|
} else {
|
2003-10-08 07:38:48 +00:00
|
|
|
switch (_language) {
|
2005-11-18 02:31:24 +00:00
|
|
|
case Common::RU_RUS:
|
|
|
|
verb_names = russian_verb_names;
|
|
|
|
break;
|
2010-04-12 21:21:06 +00:00
|
|
|
case Common::HE_ISR:
|
2005-11-18 02:31:24 +00:00
|
|
|
verb_names = hebrew_verb_names;
|
|
|
|
break;
|
|
|
|
case Common::ES_ESP:
|
|
|
|
verb_names = spanish_verb_names;
|
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
|
|
|
verb_names = italian_verb_names;
|
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
verb_names = french_verb_names;
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
verb_names = german_verb_names;
|
|
|
|
break;
|
2008-03-29 13:27:25 +00:00
|
|
|
case Common::CZ_CZE:
|
|
|
|
verb_names = czech_verb_names;
|
|
|
|
break;
|
2007-09-19 08:40:12 +00:00
|
|
|
default:
|
2005-11-18 02:31:24 +00:00
|
|
|
verb_names = english_verb_names;
|
|
|
|
break;
|
2003-10-08 07:38:48 +00:00
|
|
|
}
|
|
|
|
CHECK_BOUNDS(hitarea_id, english_verb_names);
|
2002-06-29 16:11:13 +00:00
|
|
|
txt = verb_names[hitarea_id];
|
|
|
|
}
|
2006-04-06 10:47:37 +00:00
|
|
|
showActionString((const byte *)txt);
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::showActionString(const byte *string) {
|
2006-04-05 02:45:28 +00:00
|
|
|
WindowBlock *window;
|
2006-04-06 10:47:37 +00:00
|
|
|
uint x;
|
2006-10-13 07:23:34 +00:00
|
|
|
const uint len = (getGameType() == GType_WW) ? 29 : 53;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-05 02:45:28 +00:00
|
|
|
window = _windowArray[1];
|
2009-02-07 01:11:51 +00:00
|
|
|
if (window == NULL || window->textColor == 0)
|
2002-06-29 16:11:13 +00:00
|
|
|
return;
|
|
|
|
|
2006-04-06 10:47:37 +00:00
|
|
|
// Arisme : hack for long strings in the French version
|
2006-10-13 07:23:34 +00:00
|
|
|
if ((strlen((const char*)string) - 1) <= len)
|
|
|
|
x = (len - (strlen((const char *)string) - 1)) * 3;
|
2006-04-06 10:47:37 +00:00
|
|
|
else
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
window->textColumn = x / 8;
|
2006-04-05 02:45:28 +00:00
|
|
|
window->textColumnOffset = x & 7;
|
2010-04-12 21:21:06 +00:00
|
|
|
if (_language == Common::HE_ISR && window->textColumnOffset != 0) {
|
2007-06-09 08:58:18 +00:00
|
|
|
window->textColumnOffset = 8 - window->textColumnOffset;
|
|
|
|
window->textColumn++;
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2002-07-07 19:06:48 +00:00
|
|
|
for (; *string; string++)
|
2006-04-13 14:26:46 +00:00
|
|
|
windowPutChar(window, *string);
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::handleVerbClicked(uint verb) {
|
2006-04-29 14:11:29 +00:00
|
|
|
Subroutine *sub;
|
|
|
|
int result;
|
|
|
|
|
2008-09-30 12:27:38 +00:00
|
|
|
if (shouldQuit())
|
2008-08-08 02:18:17 +00:00
|
|
|
return;
|
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
_objectItem = _hitAreaObjectItem;
|
|
|
|
if (_objectItem == _dummyItem2) {
|
|
|
|
_objectItem = me();
|
|
|
|
}
|
|
|
|
if (_objectItem == _dummyItem3) {
|
|
|
|
_objectItem = derefItem(me()->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
_subjectItem = _hitAreaSubjectItem;
|
|
|
|
if (_subjectItem == _dummyItem2) {
|
|
|
|
_subjectItem = me();
|
|
|
|
}
|
|
|
|
if (_subjectItem == _dummyItem3) {
|
|
|
|
_subjectItem = derefItem(me()->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_subjectItem) {
|
|
|
|
_scriptNoun1 = _subjectItem->noun;
|
|
|
|
_scriptAdj1 = _subjectItem->adjective;
|
|
|
|
} else {
|
|
|
|
_scriptNoun1 = -1;
|
|
|
|
_scriptAdj1 = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_objectItem) {
|
|
|
|
_scriptNoun2 = _objectItem->noun;
|
|
|
|
_scriptAdj2 = _objectItem->adjective;
|
|
|
|
} else {
|
|
|
|
_scriptNoun2 = -1;
|
|
|
|
_scriptAdj2 = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
_scriptVerb = _verbHitArea;
|
|
|
|
|
|
|
|
sub = getSubroutineByID(0);
|
|
|
|
if (sub == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
result = startSubroutine(sub);
|
|
|
|
if (result == -1)
|
|
|
|
showMessageFormat("I don't understand");
|
|
|
|
|
|
|
|
_runScriptReturn1 = false;
|
|
|
|
|
|
|
|
sub = getSubroutineByID(100);
|
|
|
|
if (sub)
|
|
|
|
startSubroutine(sub);
|
|
|
|
|
2006-09-29 03:25:08 +00:00
|
|
|
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP)
|
2006-04-29 14:11:29 +00:00
|
|
|
_runScriptReturn1 = false;
|
|
|
|
|
|
|
|
permitInput();
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::resetNameWindow() {
|
2006-04-05 02:45:28 +00:00
|
|
|
WindowBlock *window;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-06 10:47:37 +00:00
|
|
|
if (getGameType() == GType_SIMON2 && getBitFlag(79))
|
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-05 02:45:28 +00:00
|
|
|
window = _windowArray[1];
|
2009-02-07 01:11:51 +00:00
|
|
|
if (window != NULL && window->textColor != 0)
|
2006-04-05 02:45:28 +00:00
|
|
|
clearWindow(window);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-06 08:43:20 +00:00
|
|
|
_lastNameOn = NULL;
|
2006-04-06 10:47:37 +00:00
|
|
|
_lastVerbOn = NULL;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
HitArea *AGOSEngine::findBox(uint hitarea_id) {
|
2005-05-06 11:37:33 +00:00
|
|
|
HitArea *ha = _hitAreas;
|
|
|
|
uint count = ARRAYSIZE(_hitAreas);
|
2002-07-07 19:06:48 +00:00
|
|
|
|
|
|
|
do {
|
2006-10-27 01:55:06 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
|
|
|
if (ha->id == hitarea_id && ha->flags != 0)
|
|
|
|
return ha;
|
|
|
|
} else {
|
|
|
|
if (ha->id == hitarea_id)
|
|
|
|
return ha;
|
|
|
|
}
|
2002-07-07 19:06:48 +00:00
|
|
|
} while (ha++, --count);
|
2002-06-29 16:11:13 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
HitArea *AGOSEngine::findEmptyHitArea() {
|
2005-05-06 11:37:33 +00:00
|
|
|
HitArea *ha = _hitAreas;
|
2007-06-06 05:54:03 +00:00
|
|
|
uint count = ARRAYSIZE(_hitAreas) - 1;
|
2002-07-07 19:06:48 +00:00
|
|
|
|
|
|
|
do {
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha->flags == 0)
|
|
|
|
return ha;
|
2002-07-07 19:06:48 +00:00
|
|
|
} while (ha++, --count);
|
2007-06-06 05:54:03 +00:00
|
|
|
|
|
|
|
// The last box is overwritten, if too many boxes are allocated.
|
|
|
|
return ha;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-10-21 01:51:59 +00:00
|
|
|
void AGOSEngine::freeBox(uint index) {
|
2006-04-29 14:11:29 +00:00
|
|
|
CHECK_BOUNDS(index, _hitAreas);
|
|
|
|
_hitAreas[index].flags = 0;
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::enableBox(uint hitarea) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha != NULL)
|
2006-04-06 14:01:52 +00:00
|
|
|
ha->flags &= ~kBFBoxDead;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::disableBox(uint hitarea) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha != NULL) {
|
2006-04-06 14:01:52 +00:00
|
|
|
ha->flags |= kBFBoxDead;
|
|
|
|
ha->flags &= ~kBFBoxSelected;
|
2006-10-27 01:55:06 +00:00
|
|
|
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
|
|
|
|
hitarea == 102) {
|
2006-03-16 10:30:59 +00:00
|
|
|
resetVerbs();
|
2006-10-27 01:55:06 +00:00
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::moveBox(uint hitarea, int x, int y) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha != NULL) {
|
2006-09-29 03:25:08 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
2006-04-09 13:12:59 +00:00
|
|
|
ha->x += x;
|
|
|
|
ha->y += y;
|
|
|
|
} else {
|
|
|
|
ha->x = x;
|
|
|
|
ha->y = y;
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::undefineBox(uint hitarea) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha != NULL) {
|
|
|
|
ha->flags = 0;
|
2006-04-06 08:43:20 +00:00
|
|
|
if (ha == _lastNameOn)
|
|
|
|
clearName();
|
2005-05-06 11:37:33 +00:00
|
|
|
_needHitAreaRecalc++;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
bool AGOSEngine::isBoxDead(uint hitarea) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha == NULL)
|
|
|
|
return false;
|
2006-04-06 14:01:52 +00:00
|
|
|
return (ha->flags & kBFBoxDead) == 0;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
void AGOSEngine::defineBox(uint16 id, uint16 x, uint16 y, uint16 height, uint16 width, uint16 msg1, uint16 msg2, uint16 flags) {
|
|
|
|
HitArea *ha = _hitAreaList + id;
|
|
|
|
ha->x = x;
|
|
|
|
ha->y = y;
|
|
|
|
ha->width = width;
|
|
|
|
ha->height = height;
|
|
|
|
ha->msg1 = msg1;
|
|
|
|
ha->msg2 = msg2;
|
|
|
|
ha->flags = flags;
|
|
|
|
ha->id = ha->priority = id;
|
|
|
|
}
|
|
|
|
|
2009-02-07 01:11:51 +00:00
|
|
|
void AGOSEngine::defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *itemPtr) {
|
2002-06-29 16:11:13 +00:00
|
|
|
HitArea *ha;
|
2006-04-14 09:57:43 +00:00
|
|
|
undefineBox(id);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
|
|
|
ha = findEmptyHitArea();
|
|
|
|
ha->x = x;
|
|
|
|
ha->y = y;
|
|
|
|
ha->width = width;
|
|
|
|
ha->height = height;
|
2006-04-06 14:01:52 +00:00
|
|
|
ha->flags = flags | kBFBoxInUse;
|
2006-03-16 07:08:05 +00:00
|
|
|
ha->id = ha->priority = id;
|
|
|
|
ha->verb = verb;
|
2009-02-07 01:11:51 +00:00
|
|
|
ha->itemPtr = itemPtr;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-05-17 09:00:14 +00:00
|
|
|
if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
|
2006-04-09 04:53:31 +00:00
|
|
|
ha->data = _hyperLink;
|
2006-04-08 12:06:52 +00:00
|
|
|
ha->priority = 50;
|
|
|
|
}
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_needHitAreaRecalc++;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-04-15 05:33:21 +00:00
|
|
|
void AGOSEngine_PuzzlePack::resetVerbs() {
|
|
|
|
_verbHitArea = 300;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Feeble::resetVerbs() {
|
|
|
|
_verbHitArea = 300;
|
|
|
|
int cursor = 0;
|
|
|
|
int animMax = 16;
|
|
|
|
|
|
|
|
if (getBitFlag(203)) {
|
|
|
|
cursor = 14;
|
|
|
|
animMax = 9;
|
|
|
|
} else if (getBitFlag(204)) {
|
|
|
|
cursor = 15;
|
|
|
|
animMax = 9;
|
|
|
|
} else if (getBitFlag(207)) {
|
|
|
|
cursor = 26;
|
|
|
|
animMax = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
_mouseCursor = cursor;
|
|
|
|
_mouseAnimMax = animMax;
|
|
|
|
_mouseAnim = 1;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
|
|
|
|
if (getBitFlag(99)) {
|
|
|
|
setVerb(NULL);
|
|
|
|
}
|
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2007-04-15 05:33:21 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::resetVerbs() {
|
2006-10-16 11:20:20 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
|
|
|
|
return;
|
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
uint id;
|
|
|
|
HitArea *ha;
|
2006-04-04 10:12:22 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
|
|
|
id = 2;
|
|
|
|
if (!getBitFlag(79))
|
|
|
|
id = (_mouse.y >= 136) ? 102 : 101;
|
2002-06-29 16:11:13 +00:00
|
|
|
} else {
|
2007-04-15 05:33:21 +00:00
|
|
|
id = (_mouse.y >= 136) ? 102 : 101;
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
_defaultVerb = id;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
ha = findBox(id);
|
|
|
|
if (ha == NULL)
|
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
if (ha->flags & kBFBoxDead) {
|
|
|
|
_defaultVerb = 999;
|
|
|
|
_currentVerbBox = NULL;
|
|
|
|
} else {
|
|
|
|
_verbHitArea = ha->verb;
|
|
|
|
setVerb(ha);
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-04-15 05:33:21 +00:00
|
|
|
void AGOSEngine_Feeble::setVerb(HitArea *ha) {
|
|
|
|
int cursor = _mouseCursor;
|
|
|
|
if (_noRightClick)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (cursor > 13)
|
|
|
|
cursor = 0;
|
|
|
|
cursor++;
|
|
|
|
if (cursor == 5)
|
|
|
|
cursor = 1;
|
|
|
|
if (cursor == 4) {
|
|
|
|
if (getBitFlag(72)) {
|
2006-04-04 10:12:22 +00:00
|
|
|
cursor = 1;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2007-04-15 05:33:21 +00:00
|
|
|
} else if (cursor == 2) {
|
|
|
|
if (getBitFlag(99)) {
|
|
|
|
cursor = 3;
|
|
|
|
}
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
_mouseCursor = cursor;
|
|
|
|
_mouseAnimMax = (cursor == 4) ? 14: 16;
|
|
|
|
_mouseAnim = 1;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
_verbHitArea = cursor + 300;
|
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2006-04-04 08:50:35 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
void AGOSEngine::setVerb(HitArea *ha) {
|
|
|
|
HitArea *tmp = _currentVerbBox;
|
2006-04-04 10:12:22 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
if (ha == tmp)
|
|
|
|
return;
|
2006-04-04 10:12:22 +00:00
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
if (getGameType() == GType_SIMON1) {
|
|
|
|
if (tmp != NULL) {
|
|
|
|
tmp->flags |= kBFInvertTouch;
|
2008-03-25 08:03:32 +00:00
|
|
|
if (getFeatures() & GF_32COLOR)
|
|
|
|
invertBox(tmp, 212, 208, 212, 8);
|
|
|
|
else
|
|
|
|
invertBox(tmp, 213, 208, 213, 10);
|
2006-04-04 10:12:22 +00:00
|
|
|
}
|
2007-04-15 05:33:21 +00:00
|
|
|
|
2008-03-25 08:03:32 +00:00
|
|
|
if (ha->flags & kBFBoxSelected) {
|
|
|
|
if (getFeatures() & GF_32COLOR)
|
|
|
|
invertBox(ha, 216, 212, 212, 4);
|
|
|
|
else
|
|
|
|
invertBox(ha, 218, 213, 213, 5);
|
|
|
|
} else {
|
|
|
|
if (getFeatures() & GF_32COLOR)
|
|
|
|
invertBox(ha, 220, 216, 216, 8);
|
|
|
|
else
|
|
|
|
invertBox(ha, 223, 218, 218, 10);
|
|
|
|
}
|
2007-04-15 05:33:21 +00:00
|
|
|
|
|
|
|
ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
|
|
|
|
} else {
|
|
|
|
if (ha->id < 101)
|
|
|
|
return;
|
|
|
|
_mouseCursor = ha->id - 101;
|
|
|
|
_needHitAreaRecalc++;
|
2006-04-04 10:12:22 +00:00
|
|
|
}
|
2007-04-15 05:33:21 +00:00
|
|
|
_currentVerbBox = ha;
|
2006-04-04 08:50:35 +00:00
|
|
|
}
|
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-04-15 14:12:08 +00:00
|
|
|
void AGOSEngine_Feeble::hitarea_leave(HitArea *ha, bool state) {
|
|
|
|
invertBox(ha, state);
|
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2007-04-15 14:12:08 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::hitarea_leave(HitArea *ha, bool state) {
|
2007-04-15 14:12:08 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2006-05-03 01:11:50 +00:00
|
|
|
invertBox(ha, 231, 229, 230, 1);
|
2006-04-13 23:34:58 +00:00
|
|
|
} else {
|
2008-03-25 08:03:32 +00:00
|
|
|
if (getFeatures() & GF_32COLOR)
|
|
|
|
invertBox(ha, 220, 212, 216, 4);
|
|
|
|
else
|
|
|
|
invertBox(ha, 223, 213, 218, 5);
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::leaveHitAreaById(uint hitarea_id) {
|
2006-04-14 09:57:43 +00:00
|
|
|
HitArea *ha = findBox(hitarea_id);
|
2002-06-29 16:11:13 +00:00
|
|
|
if (ha)
|
|
|
|
hitarea_leave(ha);
|
|
|
|
}
|
|
|
|
|
2007-04-15 05:33:21 +00:00
|
|
|
void AGOSEngine::inventoryUp(WindowBlock *window) {
|
|
|
|
if (window->iconPtr->line == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mouseOff();
|
|
|
|
uint index = getWindowNum(window);
|
|
|
|
drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
|
|
|
|
mouseOn();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::inventoryDown(WindowBlock *window) {
|
|
|
|
mouseOff();
|
|
|
|
uint index = getWindowNum(window);
|
|
|
|
drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
|
|
|
|
mouseOn();
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::boxController(uint x, uint y, uint mode) {
|
2002-10-31 01:27:05 +00:00
|
|
|
HitArea *best_ha;
|
2005-05-06 11:37:33 +00:00
|
|
|
HitArea *ha = _hitAreas;
|
|
|
|
uint count = ARRAYSIZE(_hitAreas);
|
2006-03-16 07:08:05 +00:00
|
|
|
uint16 priority = 0;
|
2009-03-05 21:38:17 +00:00
|
|
|
|
|
|
|
best_ha = NULL;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (ha->flags & kBFBoxInUse) {
|
|
|
|
if (!(ha->flags & kBFBoxDead)) {
|
|
|
|
if (x >= ha->x && y >= ha->y &&
|
|
|
|
x - ha->x < ha->width && y - ha->y < ha->height && priority <= ha->priority) {
|
|
|
|
priority = ha->priority;
|
|
|
|
best_ha = ha;
|
|
|
|
} else {
|
|
|
|
if (ha->flags & kBFBoxSelected) {
|
|
|
|
hitarea_leave(ha , true);
|
|
|
|
ha->flags &= ~kBFBoxSelected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ha->flags &= ~kBFBoxSelected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (ha++, --count);
|
|
|
|
|
|
|
|
_currentBoxNum = 0;
|
|
|
|
_currentBox = best_ha;
|
|
|
|
|
|
|
|
if (best_ha == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_currentBoxNum = best_ha->id;
|
|
|
|
|
|
|
|
if (mode != 0) {
|
|
|
|
if (mode == 3) {
|
|
|
|
if (best_ha->verb & 0x4000) {
|
|
|
|
if (getGameType() == GType_ELVIRA1 && _variableArray[500] == 0) {
|
|
|
|
_variableArray[500] = best_ha->verb & 0xBFFF;
|
|
|
|
}
|
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
if (_clickOnly && best_ha->id < 8) {
|
2009-03-05 21:38:17 +00:00
|
|
|
uint id = best_ha->id;
|
|
|
|
if (id >= 4)
|
|
|
|
id -= 4;
|
|
|
|
|
|
|
|
invertBox(findBox(id), 0, 0, 0, 0);
|
2009-03-09 04:16:27 +00:00
|
|
|
_clickOnly = false;
|
2009-03-05 21:38:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best_ha->flags & kBFDragBox)
|
|
|
|
_lastClickRem = best_ha;
|
|
|
|
} else {
|
|
|
|
_lastHitArea = best_ha;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
if (_clickOnly)
|
2009-03-05 21:38:17 +00:00
|
|
|
return;
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2009-03-05 21:38:17 +00:00
|
|
|
if (best_ha->flags & kBFInvertTouch) {
|
|
|
|
if (!(best_ha->flags & kBFBoxSelected)) {
|
|
|
|
hitarea_leave(best_ha, false);
|
|
|
|
best_ha->flags |= kBFBoxSelected;
|
2009-03-07 19:24:31 +00:00
|
|
|
}
|
2009-03-05 21:38:17 +00:00
|
|
|
} else {
|
|
|
|
if (mode == 0)
|
|
|
|
return;
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2009-03-05 21:38:17 +00:00
|
|
|
if (!(best_ha->flags & kBFInvertSelect))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (best_ha->flags & kBFToggleBox) {
|
|
|
|
hitarea_leave(best_ha, false);
|
|
|
|
best_ha->flags ^= kBFInvertSelect;
|
|
|
|
} else if (!(best_ha->flags & kBFBoxSelected)) {
|
|
|
|
hitarea_leave(best_ha, false);
|
|
|
|
best_ha->flags |= kBFBoxSelected;
|
|
|
|
}
|
2009-03-07 19:24:31 +00:00
|
|
|
}
|
2009-03-05 21:38:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Waxworks::boxController(uint x, uint y, uint mode) {
|
|
|
|
HitArea *best_ha;
|
|
|
|
HitArea *ha = _hitAreas;
|
|
|
|
uint count = ARRAYSIZE(_hitAreas);
|
|
|
|
uint16 priority = 0;
|
2002-11-02 09:23:30 +00:00
|
|
|
uint16 x_ = x;
|
2006-04-06 08:43:20 +00:00
|
|
|
uint16 y_ = y;
|
2002-10-31 01:27:05 +00:00
|
|
|
|
2006-10-01 10:04:23 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
2006-04-06 08:43:20 +00:00
|
|
|
x_ += _scrollX;
|
|
|
|
y_ += _scrollY;
|
2006-10-01 10:04:23 +00:00
|
|
|
} else if (getGameType() == GType_SIMON2) {
|
2006-04-05 00:37:42 +00:00
|
|
|
if (getBitFlag(79) || y < 134) {
|
2005-10-05 11:37:26 +00:00
|
|
|
x_ += _scrollX * 8;
|
2002-11-02 09:23:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-31 01:27:05 +00:00
|
|
|
best_ha = NULL;
|
|
|
|
|
|
|
|
do {
|
2006-04-06 14:01:52 +00:00
|
|
|
if (ha->flags & kBFBoxInUse) {
|
|
|
|
if (!(ha->flags & kBFBoxDead)) {
|
2002-10-31 01:27:05 +00:00
|
|
|
if (x_ >= ha->x && y_ >= ha->y &&
|
2006-03-16 07:08:05 +00:00
|
|
|
x_ - ha->x < ha->width && y_ - ha->y < ha->height && priority <= ha->priority) {
|
|
|
|
priority = ha->priority;
|
2002-10-31 01:27:05 +00:00
|
|
|
best_ha = ha;
|
2002-06-29 16:11:13 +00:00
|
|
|
} else {
|
2006-04-06 14:01:52 +00:00
|
|
|
if (ha->flags & kBFBoxSelected) {
|
2006-04-13 23:34:58 +00:00
|
|
|
hitarea_leave(ha , true);
|
2006-04-06 14:01:52 +00:00
|
|
|
ha->flags &= ~kBFBoxSelected;
|
2002-10-31 01:27:05 +00:00
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2002-10-31 01:27:05 +00:00
|
|
|
} else {
|
2006-04-06 14:01:52 +00:00
|
|
|
ha->flags &= ~kBFBoxSelected;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2002-10-31 01:27:05 +00:00
|
|
|
}
|
|
|
|
} while (ha++, --count);
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2008-03-12 00:22:30 +00:00
|
|
|
_currentBoxNum = 0;
|
2006-10-22 13:04:34 +00:00
|
|
|
_currentBox = best_ha;
|
2008-03-12 00:22:30 +00:00
|
|
|
|
2002-06-29 16:11:13 +00:00
|
|
|
if (best_ha == NULL) {
|
2006-04-06 08:43:20 +00:00
|
|
|
clearName();
|
2006-10-18 12:23:43 +00:00
|
|
|
if (getGameType() == GType_WW && _mouseCursor >= 4) {
|
2006-10-18 11:52:55 +00:00
|
|
|
_mouseCursor = 0;
|
2006-10-18 12:23:43 +00:00
|
|
|
_needHitAreaRecalc++;
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-03-12 00:22:30 +00:00
|
|
|
_currentBoxNum = best_ha->id;
|
|
|
|
|
2006-10-22 13:04:34 +00:00
|
|
|
if (mode != 0) {
|
|
|
|
if (mode == 3) {
|
|
|
|
if (best_ha->flags & kBFDragBox) {
|
|
|
|
_lastClickRem = best_ha;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_lastHitArea = best_ha;
|
|
|
|
if (getGameType() == GType_PP) {
|
|
|
|
_variableArray[400] = x;
|
|
|
|
_variableArray[401] = y;
|
|
|
|
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 ||
|
|
|
|
getGameType() == GType_FF) {
|
|
|
|
_variableArray[1] = x;
|
|
|
|
_variableArray[2] = y;
|
2006-10-07 08:28:06 +00:00
|
|
|
}
|
2006-10-22 13:04:34 +00:00
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-10-18 11:52:55 +00:00
|
|
|
if ((getGameType() == GType_WW) && (_mouseCursor == 0 || _mouseCursor >= 4)) {
|
|
|
|
uint verb = best_ha->verb & 0x3FFF;
|
2009-02-07 01:11:51 +00:00
|
|
|
if (verb >= 239 && verb <= 242) {
|
2006-10-18 11:52:55 +00:00
|
|
|
uint cursor = verb - 235;
|
|
|
|
if (_mouseCursor != cursor) {
|
|
|
|
_mouseCursor = cursor;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
}
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
if (getGameType() != GType_WW || !_nameLocked) {
|
2006-10-23 11:17:25 +00:00
|
|
|
if (best_ha->flags & kBFNoTouchName) {
|
|
|
|
clearName();
|
|
|
|
} else if (best_ha != _lastNameOn) {
|
|
|
|
displayName(best_ha);
|
|
|
|
}
|
2008-03-23 23:18:43 +00:00
|
|
|
}
|
2006-10-18 11:52:55 +00:00
|
|
|
|
2006-04-06 14:01:52 +00:00
|
|
|
if (best_ha->flags & kBFInvertTouch && !(best_ha->flags & kBFBoxSelected)) {
|
2006-04-13 23:34:58 +00:00
|
|
|
hitarea_leave(best_ha, false);
|
2006-04-06 14:01:52 +00:00
|
|
|
best_ha->flags |= kBFBoxSelected;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::displayName(HitArea *ha) {
|
2007-05-17 09:00:14 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_PP)
|
2006-10-18 11:52:55 +00:00
|
|
|
return;
|
|
|
|
|
2002-06-29 16:11:13 +00:00
|
|
|
bool result;
|
2006-04-07 01:46:43 +00:00
|
|
|
int x = 0, y = 0;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2007-05-17 09:00:14 +00:00
|
|
|
if (getGameType() == GType_FF) {
|
2006-04-07 01:46:43 +00:00
|
|
|
if (ha->flags & kBFHyperBox) {
|
|
|
|
_lastNameOn = ha;
|
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2006-04-14 09:57:43 +00:00
|
|
|
if (findBox(50))
|
2006-04-07 01:46:43 +00:00
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-07 01:46:43 +00:00
|
|
|
if (getBitFlag(99))
|
2006-04-16 06:49:13 +00:00
|
|
|
_animatePointer = ((ha->flags & kBFTextBox) == 0);
|
2006-04-07 01:46:43 +00:00
|
|
|
else
|
2010-07-04 07:32:12 +00:00
|
|
|
_animatePointer = true;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-09 10:58:18 +00:00
|
|
|
if (!getBitFlag(73))
|
|
|
|
return;
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-07 01:46:43 +00:00
|
|
|
y = ha->y;
|
|
|
|
if (getBitFlag(99) && y > 288)
|
|
|
|
y = 288;
|
|
|
|
y -= 17;
|
|
|
|
if (y < 0)
|
|
|
|
y = 0;
|
|
|
|
y += 2;
|
|
|
|
x = ha->width / 2 + ha->x;
|
|
|
|
} else {
|
|
|
|
resetNameWindow();
|
|
|
|
}
|
2002-06-29 16:11:13 +00:00
|
|
|
|
2006-04-07 01:46:43 +00:00
|
|
|
if (ha->flags & kBFTextBox) {
|
|
|
|
result = printTextOf(ha->flags / 256, x, y);
|
|
|
|
} else {
|
2009-02-07 01:11:51 +00:00
|
|
|
result = printNameOf(ha->itemPtr, x, y);
|
2006-04-07 01:46:43 +00:00
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-07 01:46:43 +00:00
|
|
|
if (result)
|
|
|
|
_lastNameOn = ha;
|
2002-06-29 16:11:13 +00:00
|
|
|
}
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-04-15 14:12:08 +00:00
|
|
|
void AGOSEngine_Feeble::invertBox(HitArea *ha, bool state) {
|
2006-04-16 09:52:10 +00:00
|
|
|
if (getBitFlag(205) || getBitFlag(206)) {
|
2006-04-13 23:34:58 +00:00
|
|
|
if (state != 0) {
|
|
|
|
_mouseAnimMax = _oldMouseAnimMax;
|
|
|
|
_mouseCursor = _oldMouseCursor;
|
|
|
|
} else if (_mouseCursor != 18) {
|
|
|
|
_oldMouseCursor = _mouseCursor;
|
2010-07-04 07:32:12 +00:00
|
|
|
_animatePointer = false;
|
2006-04-13 23:34:58 +00:00
|
|
|
_oldMouseAnimMax = _mouseAnimMax;
|
|
|
|
_mouseAnimMax = 2;
|
|
|
|
_mouseCursor = 18;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (getBitFlag(207)) {
|
|
|
|
if (state != 0) {
|
|
|
|
_noRightClick = 0;
|
|
|
|
resetVerbs();
|
|
|
|
} else {
|
|
|
|
int cursor = ha->id + 9;
|
|
|
|
if (cursor >= 23)
|
|
|
|
cursor = 21;
|
|
|
|
_mouseCursor = cursor;
|
|
|
|
_mouseAnimMax = 8;
|
|
|
|
_noRightClick = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
VgaSprite *vsp = _vgaSprites;
|
|
|
|
|
|
|
|
int id = ha->id - 43;
|
|
|
|
while (vsp->id) {
|
|
|
|
if (vsp->id == id && vsp->zoneNum == 2) {
|
|
|
|
if (state == 0)
|
|
|
|
vsp->flags |= kDFShaded;
|
|
|
|
else
|
|
|
|
vsp->flags &= ~kDFShaded;
|
|
|
|
break;
|
|
|
|
}
|
2006-04-14 06:36:35 +00:00
|
|
|
vsp++;
|
2006-04-13 23:34:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2006-04-13 23:34:58 +00:00
|
|
|
|
2008-03-11 19:25:53 +00:00
|
|
|
void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) {
|
2006-05-03 01:11:50 +00:00
|
|
|
byte *src, color;
|
|
|
|
int w, h, i;
|
|
|
|
|
2009-03-08 10:08:09 +00:00
|
|
|
_videoLockOut |= 0x8000;
|
2007-06-21 03:14:20 +00:00
|
|
|
|
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
2009-07-06 06:21:59 +00:00
|
|
|
src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x;
|
2007-06-11 06:19:33 +00:00
|
|
|
|
|
|
|
// WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations
|
|
|
|
if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) {
|
|
|
|
src -= _scrollX * 8;
|
|
|
|
}
|
2006-05-03 01:11:50 +00:00
|
|
|
|
2006-10-24 08:11:43 +00:00
|
|
|
_litBoxFlag = true;
|
2006-05-03 01:11:50 +00:00
|
|
|
|
|
|
|
w = ha->width;
|
|
|
|
h = ha->height;
|
|
|
|
|
|
|
|
do {
|
|
|
|
for (i = 0; i != w; ++i) {
|
|
|
|
color = src[i];
|
2009-02-07 01:11:51 +00:00
|
|
|
if (getGameType() == GType_WW) {
|
2007-05-07 13:03:02 +00:00
|
|
|
if (!(color & 0xF) || (color & 0xF) == 10) {
|
|
|
|
color ^= 10;
|
2006-10-08 08:47:33 +00:00
|
|
|
src[i] = color;
|
|
|
|
}
|
2009-02-07 01:11:51 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA2) {
|
2006-10-08 08:57:26 +00:00
|
|
|
if (!(color & 1)) {
|
|
|
|
color ^= 2;
|
|
|
|
src[i] = color;
|
|
|
|
}
|
2009-02-07 01:11:51 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA1) {
|
2007-05-07 13:03:02 +00:00
|
|
|
if (color & 1) {
|
|
|
|
color ^= 2;
|
|
|
|
src[i] = color;
|
|
|
|
}
|
2009-03-08 08:45:21 +00:00
|
|
|
} else if (getGameType() == GType_PN) {
|
|
|
|
if (getPlatform() == Common::kPlatformPC) {
|
|
|
|
if (color != 15) {
|
|
|
|
color ^= 7;
|
|
|
|
src[i] = color;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (color != 14) {
|
|
|
|
color ^= 15;
|
|
|
|
src[i] = color;
|
|
|
|
}
|
|
|
|
}
|
2006-10-08 08:47:33 +00:00
|
|
|
} else {
|
|
|
|
if (a >= color && b < color) {
|
|
|
|
if (c >= color)
|
|
|
|
color += d;
|
|
|
|
else
|
|
|
|
color -= d;
|
|
|
|
src[i] = color;
|
|
|
|
}
|
2006-05-03 01:11:50 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-06 06:21:59 +00:00
|
|
|
src += screen->pitch;
|
2006-05-03 01:11:50 +00:00
|
|
|
} while (--h);
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
_system->unlockScreen();
|
|
|
|
|
2009-03-08 10:08:09 +00:00
|
|
|
_videoLockOut &= ~0x8000;
|
2006-05-03 01:11:50 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|