now two inventory items can be combined

svn-id: r11823
This commit is contained in:
Robert Göffringmann 2003-12-21 16:50:02 +00:00
parent 7c09bd869b
commit 5d8516f2ec
6 changed files with 25 additions and 34 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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]);

View File

@ -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);

View File

@ -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,