aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-21 16:50:02 +0000
committerRobert Göffringmann2003-12-21 16:50:02 +0000
commit5d8516f2ec76bdfe4f255601d8b47b345794cbb3 (patch)
treee049a7fbd999d193c06e7dccd258ea0562ca4170 /sword1
parent7c09bd869b920bac34ec49938af7fee4ecaafdbc (diff)
downloadscummvm-rg350-5d8516f2ec76bdfe4f255601d8b47b345794cbb3.tar.gz
scummvm-rg350-5d8516f2ec76bdfe4f255601d8b47b345794cbb3.tar.bz2
scummvm-rg350-5d8516f2ec76bdfe4f255601d8b47b345794cbb3.zip
now two inventory items can be combined
svn-id: r11823
Diffstat (limited to 'sword1')
-rw-r--r--sword1/logic.cpp10
-rw-r--r--sword1/menu.cpp20
-rw-r--r--sword1/menu.h3
-rw-r--r--sword1/mouse.cpp22
-rw-r--r--sword1/sword1.cpp2
-rw-r--r--sword1/sworddefs.h2
6 files changed, 25 insertions, 34 deletions
diff --git a/sword1/logic.cpp b/sword1/logic.cpp
index 076138646d..e86a97d6e9 100644
--- a/sword1/logic.cpp
+++ b/sword1/logic.cpp
@@ -856,7 +856,7 @@ int SwordLogic::fnFadeDown(BsObject *cpt, int32 id, int32 speed, int32 d, int32
}
int SwordLogic::fnFadeUp(BsObject *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
- //warning("fnFadeUp speed = %d", speed);
+ warning("fnFadeUp speed = %d", speed);
//_screen->fadeUpPalette();
return SCRIPT_CONT;
}
@@ -894,6 +894,9 @@ int SwordLogic::fnSetPaletteToCut(BsObject *cpt, int32 id, int32 c, int32 d, int
int SwordLogic::fnPlaySequence(BsObject *cpt, int32 id, int32 sequenceId, int32 d, int32 e, int32 f, int32 z, int32 x) {
warning("fnPlaySequence(%d) called", sequenceId);
+ _scriptVars[NEW_PALETTE] = 1;
+ /* the logic usually calls fnFadeDown before playing the sequence, so we have to
+ set NEW_PALETTE now to force a palette refresh */
return SCRIPT_CONT;
}
@@ -1539,9 +1542,8 @@ int SwordLogic::fnPreload(BsObject *cpt, int32 id, int32 resId, int32 b, int32 c
}
int SwordLogic::fnCheckCD(BsObject *cpt, int32 id, int32 screen, int32 b, int32 c, int32 d, int32 z, int32 x) {
- warning("fnCheckCd called");
- // Not sure if we really have to check that here. I think we can do it in the main loop
- // and leave a dummy here.
+ // only a dummy, here.
+ // the check is done in the mainloop
return SCRIPT_CONT;
}
diff --git a/sword1/menu.cpp b/sword1/menu.cpp
index 01f4e26438..e9998b1c92 100644
--- a/sword1/menu.cpp
+++ b/sword1/menu.cpp
@@ -93,7 +93,15 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
if (_objects[cnt]->wasClicked(x, y))
if (mouseEvent & BS1L_BUTTON_DOWN) {
- SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+ if (SwordLogic::_scriptVars[OBJECT_HELD]) {
+ if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt])
+ SwordLogic::_scriptVars[OBJECT_HELD] = 0; // reselected => deselect it
+ else { // the player is clicking another item on this one.
+ // run its use-script, if there is one
+ SwordLogic::_scriptVars[SECOND_ITEM] = _menuList[cnt];
+ }
+ } else
+ SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
buildMenu();
} else if (mouseEvent & BS1L_BUTTON_UP) {
if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt]) {
@@ -144,8 +152,8 @@ void SwordMenu::buildMenu(void) {
if (SwordLogic::_scriptVars[MENU_LOOKING] || _subjectBarShown) { // either we're in the chooser or we're doing a 'LOOK AT'
if ((!objHeld) || (objHeld == _menuList[menuSlot]))
_objects[menuSlot]->setSelect(true);
- } else if (_secondItem) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
- if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == _secondItem))
+ } else if (SwordLogic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
+ if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == SwordLogic::_scriptVars[SECOND_ITEM]))
_objects[menuSlot]->setSelect(true);
} else { // this object is selected - ie. GREYED OUT
if (objHeld != _menuList[menuSlot])
@@ -162,9 +170,9 @@ void SwordMenu::showMenu(uint8 menuType) {
}
void SwordMenu::fnStartMenu(void) {
- SwordLogic::_scriptVars[OBJECT_HELD] = 0; // icon no longer selected
- SwordLogic::_scriptVars[MENU_LOOKING] = 0; // second icon no longer selected (after using one on another)
- _secondItem = 0; // no longer 'looking at' an icon
+ SwordLogic::_scriptVars[OBJECT_HELD] = 0; // icon no longer selected
+ SwordLogic::_scriptVars[SECOND_ITEM] = 0; // second icon no longer selected (after using one on another)
+ SwordLogic::_scriptVars[MENU_LOOKING] = 0; // no longer 'looking at' an icon
buildMenu();
if (_inMenu > 0) { // if there's something in the object menu
_objectBarShown = true;
diff --git a/sword1/menu.h b/sword1/menu.h
index 7bb5e8e355..cd6eb3dee0 100644
--- a/sword1/menu.h
+++ b/sword1/menu.h
@@ -72,6 +72,7 @@ public:
void fnStartMenu(void);
void fnEndMenu(void);
void checkTopMenu(void);
+ static const MenuObject _objectDefs[TOTAL_pockets + 1];
private:
void buildSubjects(void);
@@ -87,12 +88,10 @@ private:
SwordMenuIcon *_objects[TOTAL_pockets];
uint32 _menuList[TOTAL_pockets];
uint32 _inMenu;
- uint32 _secondItem;
SwordScreen *_screen;
SwordMouse *_mouse;
static const Subject _subjectList[TOTAL_subjects];
- static const MenuObject _objectDefs[TOTAL_pockets + 1];
};
#endif //BSMENU_H
diff --git a/sword1/mouse.cpp b/sword1/mouse.cpp
index 083899ad1f..bbf15df9d4 100644
--- a/sword1/mouse.cpp
+++ b/sword1/mouse.cpp
@@ -35,24 +35,6 @@ SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_resMan = pResMan;
_objMan = pObjMan;
_system = system;
- /*_resMan->resOpen(MSE_POINTER); // normal mouse (1 frame anim)
- _resMan->resOpen(MSE_OPERATE);
- _resMan->resOpen(MSE_PICKUP);
- _resMan->resOpen(MSE_EXAMINE);
- _resMan->resOpen(MSE_MOUTH);
- _resMan->resOpen(MSE_BECKON_L);
- _resMan->resOpen(MSE_BECKON_R);
- _resMan->resOpen(MSE_ARROW0);
- _resMan->resOpen(MSE_ARROW1);
- _resMan->resOpen(MSE_ARROW2);
- _resMan->resOpen(MSE_ARROW3);
- _resMan->resOpen(MSE_ARROW4);
- _resMan->resOpen(MSE_ARROW5);
- _resMan->resOpen(MSE_ARROW6);
- _resMan->resOpen(MSE_ARROW7);
- _resMan->resOpen(MSE_ARROW8); // UPWARDS
- _resMan->resOpen(MSE_ARROW9);*/ // DOWNWARDS
- // luggage & chess stuff is opened dynamically
}
void SwordMouse::initialize(void) {
@@ -179,7 +161,9 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
} else
SwordLogic::_scriptVars[SPECIAL_ITEM] = 0;
if (_state & MOUSE_DOWN_MASK) {
- // todo: handle top menu?
+ if (_inTopMenu && SwordLogic::_scriptVars[SECOND_ITEM])
+ _logic->runMouseScript(NULL, _menu->_objectDefs[SwordLogic::_scriptVars[SECOND_ITEM]].useScript);
+
SwordLogic::_scriptVars[MOUSE_BUTTON] = _state & MOUSE_DOWN_MASK;
if (SwordLogic::_scriptVars[SPECIAL_ITEM]) {
BsObject *compact = _objMan->fetchObject(SwordLogic::_scriptVars[SPECIAL_ITEM]);
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index 7f68e95a98..a5cf8c18a5 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -1058,8 +1058,6 @@ void SwordEngine::go(void) {
} else if (controlRes == CONTROL_GAME_RESTORED) {
reinitialize(); // first clear anything which was loaded
control->doRestore(); // then actually load the savegame data.
- _mouse->fnUnlockMouse(); // and allow mouse movements.
- _mouse->fnAddHuman();
}
_systemVars.deathScreenFlag = 0;
} while (true);
diff --git a/sword1/sworddefs.h b/sword1/sworddefs.h
index 374c8d4f7c..c2b558bb07 100644
--- a/sword1/sworddefs.h
+++ b/sword1/sworddefs.h
@@ -396,7 +396,7 @@ enum ScriptVariableNames {
MAX_SCROLL_OFFSET_Y,
FEET_X,
FEET_Y,
- SECOND_ICON,
+ SECOND_ITEM, //SECOND_ICON,
SUBJECT_CHOSEN,
IN_SUBJECT,
DEBUG_FLAG_1,