aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sword1/logic.h3
-rw-r--r--sword1/menu.cpp6
-rw-r--r--sword1/mouse.cpp8
-rw-r--r--sword1/mouse.h5
-rw-r--r--sword1/sworddefs.h1
5 files changed, 15 insertions, 8 deletions
diff --git a/sword1/logic.h b/sword1/logic.h
index bde258203a..9ef9c3c131 100644
--- a/sword1/logic.h
+++ b/sword1/logic.h
@@ -60,6 +60,8 @@ public:
int fnMegaSet (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnNoSprite (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+// public for mouse (menu looking)
+ int cfnPresetScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
private:
ObjectMan *_objMan;
ResMan *_resMan;
@@ -124,7 +126,6 @@ private:
int cfnClickInteract(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int cfnSetScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int cfnPresetScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnInteract (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnIssueEvent (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
diff --git a/sword1/menu.cpp b/sword1/menu.cpp
index 451325106d..6ea311b4d5 100644
--- a/sword1/menu.cpp
+++ b/sword1/menu.cpp
@@ -125,6 +125,12 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
} else {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
if (_objects[cnt]->wasClicked(x, y))
+ if (mouseEvent & BS1R_BUTTON_DOWN) { // looking at item
+ SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+ SwordLogic::_scriptVars[MENU_LOOKING] = 1;
+ SwordLogic::_scriptVars[DEFAULT_ICON_TEXT] = _objectDefs[_menuList[cnt]].textDesc;
+ refreshMenus = true;
+ }
if (mouseEvent & BS1L_BUTTON_DOWN) {
if (SwordLogic::_scriptVars[OBJECT_HELD]) {
if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt]) {
diff --git a/sword1/mouse.cpp b/sword1/mouse.cpp
index 26fd07fde1..a402f68f21 100644
--- a/sword1/mouse.cpp
+++ b/sword1/mouse.cpp
@@ -152,8 +152,12 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
} else
SwordLogic::_scriptVars[SPECIAL_ITEM] = 0;
if (_state & MOUSE_DOWN_MASK) {
- if (_inTopMenu && SwordLogic::_scriptVars[SECOND_ITEM])
- _logic->runMouseScript(NULL, _menu->_objectDefs[SwordLogic::_scriptVars[SECOND_ITEM]].useScript);
+ if (_inTopMenu) {
+ if (SwordLogic::_scriptVars[SECOND_ITEM])
+ _logic->runMouseScript(NULL, _menu->_objectDefs[SwordLogic::_scriptVars[SECOND_ITEM]].useScript);
+ if (SwordLogic::_scriptVars[MENU_LOOKING])
+ _logic->cfnPresetScript(NULL, -1, PLAYER, SCR_menu_look, 0, 0, 0, 0);
+ }
SwordLogic::_scriptVars[MOUSE_BUTTON] = _state & MOUSE_DOWN_MASK;
if (SwordLogic::_scriptVars[SPECIAL_ITEM]) {
diff --git a/sword1/mouse.h b/sword1/mouse.h
index 92424a0fbf..d04184121c 100644
--- a/sword1/mouse.h
+++ b/sword1/mouse.h
@@ -75,7 +75,6 @@ public:
void animate(void);
void engine(uint16 x, uint16 y, uint16 eventFlags);
uint16 testEvent(void);
- //void flushEvents(void);
void giveCoords(uint16 *x, uint16 *y);
void fnNoHuman(void);
void fnAddHuman(void);
@@ -96,13 +95,9 @@ private:
uint32 _currentPtrId, _currentLuggageId, _frame;
MousePtr *_currentPtr;
- //uint8 _mouseCount;
uint16 _numObjs;
uint16 _lastState, _state;
uint32 _getOff;
- //uint32 _specialPtrId; // for special mouse cursors which aren't in the _pointers[] array.
- //MousePtr *_specialPtr;
- //MousePtr *_pointers[17];
bool _inTopMenu, _mouseOverride;
};
diff --git a/sword1/sworddefs.h b/sword1/sworddefs.h
index 65bd482dc1..45cbaace0f 100644
--- a/sword1/sworddefs.h
+++ b/sword1/sworddefs.h
@@ -1551,6 +1551,7 @@ enum ScriptVariableNames {
#define GUARD_ROOF_63 4128781
#define LEFT_TREE_POINTER_71 4653058
#define RIGHT_TREE_POINTER_71 4653059
+#define SCR_menu_look (0*0x10000 + 24)
#define SCR_icon_combine_script (0*0x10000 + 25)
#endif //SWORDDEFS_H