Commit Graph

69 Commits (92ed1537a0e79facded3c81f50f7767962d70d6f)

Author SHA1 Message Date
David Dormagen 684b0d0682 contents menu: fixed possible "use after deletion" error 2016-02-14 13:03:26 +01:00
David Dormagen 4493bfc3ab interaction menu: disallow interaction with outside world when contained (#1541)
The interaction with IsContainer objects is still flawed in a way: when a lorry is inside a (IsContainer-)hut, you can take the lorry into your hands. Since we don't have that possibility in the normal game, I leave it unchanged for now.

However, it is now possible to add a Chest (or a cupboard!) into a WoodenCabin and then store stuff inside of it.
2016-01-14 13:03:18 +01:00
Sven Eberhardt 62910aaada Remove dummy graphics of interaction menu. 2016-01-11 18:19:01 -05:00
David Dormagen 7f4f5fee58 added new vocals for three skins (by ala)
They are played e.g. when being hit by stuff, catching fire, killing teammates, idling, trying to put a shovel into the pump, and much more!
2015-12-16 23:01:29 +01:00
David Dormagen dcfb986e34 moved sounds into subfolders
This completes http://forum.openclonk.org/topic_show.pl?tid=3215
2015-12-13 22:14:55 +01:00
David Dormagen 6c5aaecbed interaction menu: allow objects to hide inventory
Some objects need to accept items (be IsContainer) but want a custom way to display their contents (e.g. because you can't take stuff out). For example the sawmill.
2015-12-07 20:52:14 +01:00
David Dormagen 7a0b170075 interaction menu: made menu-rejection errors a callback
Objects that prevent interaction just in some situations (hostility, dead Clonks, ..) should always be shown in the interaction menu (because otherwise players might suspect bugs) and TELL the player WHY they want no interaction.
For that, they might need to specify own error messages.

Known issues:
* The "OnOpen" callback is done even if interaction is disallowed, however just simply removing the callback might not be sufficient, because we might get a callback disbalance if objects change their attitude while the menu is opened and the menu is closed again.
* Some objects (which should) do not include the Library_Ownable. However, we have no base melees atm and since this might introduce new errors, postpone it to 8.0.
2015-12-06 21:28:03 +01:00
David Dormagen c02cce2c0c interaction menu: allow transfer of items only into IsContainer (#1484) 2015-12-06 16:55:48 +01:00
Sven Eberhardt 6bcb6bb53e Prevent interaction menu on dead clonks (#1483). 2015-12-06 01:50:38 -05:00
David Dormagen 7f5e85a82a interaction menu: do OnClose-callbacks if the Clonk/object moves out of range (#1466) 2015-11-30 10:17:31 +01:00
David Dormagen 02015cb610 interaction menu: properly call/remove menu entry callbacks when readding/removing items 2015-11-23 20:06:25 +01:00
David Dormagen d3bc228f9b interaction menu: added callback when viewing objects (e.g. for chest opening animation) (#1450)
OnContentMenuOpen is not used anymore.
There is a small issue: the callback is also done when the object can actually not be interacted with (e.g. because it's hostile / unfinished). Gotta think about that. But this should solve all our issues for now.
2015-11-22 22:37:58 +01:00
David Dormagen 601e0e7856 fixed nil access when stacking objects with custom overlay
Line 954 would try to set the stack count text but the structure of the UI windows differed from the normal ones. So things would break.
2015-11-22 11:01:56 +01:00
Sven Eberhardt b52686a6a7 Fix nil array access when opening interaction menu for unfinished or hostile structures. 2015-11-20 20:59:36 -05:00
David Dormagen 215c83c79b interaction: allow objects to be at a rect around the Clonk instead of just at the center
This allows to e.g. repair bridge segments on which you stand or interact with other objects that are shorter than half your height.
2015-11-12 10:18:45 +01:00
David Dormagen e29028457e fixed count display of stackable objects
The count was displayed twice in certain situations: in the picture AND as a number.
Now the responsibility for displaying the count is solely on the menus' side. The objects only show an additional overlay when their count is infinite (to not display an arbitrary "50" there).
2015-11-10 17:32:38 +01:00
David Dormagen ad69cd9293 enabled objects to provide a custom overlay for the inventory bar and the interaction menu
This can e.g. be used for the water barrel to show the fill-level. Or by an adventure scenario to highlight quest items.
Or by third-party packs to do other cool stuff.
2015-11-07 21:20:08 +01:00
David Dormagen adb828c9fb fixed possible nil-access
This happened to me ingame. I don't know why and I don't know how to reproduce.
So this is a quick in-place fix instead of a solution to the underlying issue of "entries" not being there.
2015-11-01 18:29:26 +01:00
David Dormagen b48bb31623 inventory menu: fixed shift+click
RemoveHoles returns the amount of items removed and works in-place. Meh.
It's not required here anyway..
2015-10-26 18:44:33 +01:00
David Dormagen 7baf2bcc1c added wealth display to the buy menu (#1425) 2015-10-24 10:44:01 +02:00
David Dormagen 5266962285 interaction menu: fix script error for sub-menus without extra_data 2015-10-23 18:49:12 +02:00
David Dormagen 1bd3354086 contents menu: changed stacking logic (#1424)
Objects now stack iff CanBeStackedWith returns true. The displayed symbol is now the first object of the stack (instead of the definition).
Also fixed barrel to not overwrite the custom name just after setting it.
2015-10-17 12:09:35 +02:00
David Dormagen a5d7f08e16 close interaction menu when clicking outside
According to Pyrit, this is standard behavior of menus in other games. And as I have no strong feelings regarding that issue, here you go.
2015-10-16 17:07:33 +02:00
David Dormagen e93630e083 interaction menu: added "close" button and unified layout of "minimize" and "close" buttons 2015-10-14 11:22:58 +02:00
David Dormagen 4964fb11ce shift+click support: used undocumented GetPlayerControlState instead of own memory for key state
One of Sven's private functions. I also renamed the control to CON_ModifierMenu1 (from CON_ModifierInventory1), because it's actually supposed to be the menu modifier in general - even if it's mapped on the inventory key.
2015-10-10 00:52:43 +02:00
David Dormagen b9420ce68c added shift+click support for menus
Or more generally: added support for any modifier key for any other command without the requirement to define a new command based on the old one plus the key. This can be helpful in situations where the player commands are decoupled from the script engine control handling (e.g. with menus).
Currently Shift+Click is only used by the inventory menu to transfer all items of a certain kind.
2015-10-09 13:14:27 +02:00
Sven Eberhardt c0222974dc Fix transfer from surroundings to container using interaction menu. 2015-10-03 22:26:10 -04:00
David Dormagen 42a5b8e0fe interaction menu: reworked "surrounding" internals (#1396)
The surrounding tab now uses the standard, mainstream contents display. That means that e.g. no ugly hacks are necessary to enable the "transfer all" buttons.
Previously, the surrounding menu was completely separate and always collected into the Clonk. Now you can also just put stuff directly from your surrounding into your lorry (i.e. just take everything around you into the lorry).
2015-09-24 21:27:52 +02:00
David Dormagen 7a6e8cdf90 interaction menu: simplified object-finding-logic greatly
This is mainly to get rid of IsContainerEx, because wtf.
The only reason why the categories were restricted was to prevent HasExtraSlot-objets from being found. Some C4D_Objects (or with wrong category in general) wanted to be found however. They are now found just like that.. like it was supposed to be.
2015-09-20 17:36:45 +02:00
Sven Eberhardt bf1596a229 Adjust interaction menu object ordering.
The clonk opening the menu should always have higher priority so the clonk is predictably selected on the left side even if standing behind e.g. a crate.

Other clonks should be behind because interaction with them is rare but having your fellow players stand in front of a building is very common. Allies also tend to run in front just when you opened that menu.
2015-09-15 21:13:53 -04:00
Sven Eberhardt 9ec3ca0304 Fix production menu entries in unowned producer buildings. 2015-09-15 20:50:50 -04:00
David Dormagen 35903e64d9 fixed possible nil-pointer access in interaction menu
I am still not 100% sure in which situation this occurs (see also old comment in line 168). I suspect it happens when an object is removed from the menu and the object check timer ticks just before the inventory timer.
It is possible that this should rather be resolved by removing the inventory check effects when the right conditions are met (aka the menu is removed). IF that is even the cause. Right now I don't think the current situation is too bad, because the check is very lightweight and superflous content check effects will be removed when a new menu is opened on either side anyway.
2015-09-15 21:27:26 +02:00
David Dormagen 673243c9dd properly handle QueryRejectDeparture everywhere (#1382) 2015-09-11 21:08:38 +02:00
Sven Eberhardt 261bef7120 Ignore invisible objects for interaction menu.
They were creating invisible tabs, which was a bit weird.
2015-09-09 19:46:55 -04:00
David Dormagen bfbca4065d inventory: fixed stacking containers displaying no stack count 2015-09-08 19:41:51 +02:00
David Dormagen cc3452bd0d custom guis: properly scale with font size now
Previously, the em <-> pixels conversion was a hardcoded value. Now the GUI scales with the font size that can be selected in the options.
Sadly, all scales were off since the hardcoded value was too low.
2015-09-06 19:02:31 +02:00
David Dormagen f856aa4968 interaction menu: added minimize button 2015-09-06 16:35:35 +02:00
David Dormagen 87a824b49d inventory & interaction: added Find_Layer where appropriate 2015-09-05 11:22:23 +02:00
David Dormagen 32923188b9 interaction menu: added name of object at the top of the menu
..and also increased speed of GUI_ObjectInteractionMenu::FxIntCheckObjectsTimer by around 10%.
2015-09-04 16:53:32 +02:00
David Dormagen d8b99b8a41 interaction menu: visually disable containers on one side if they are already open on the other 2015-08-07 16:48:28 +02:00
Maikel de Vries ec6d7c173e implement transfer all objects to surroundings 2015-06-07 19:04:43 +02:00
Maikel de Vries 1db961a92c make construction site a container for interaction menu 2015-06-07 12:53:59 +02:00
David Dormagen 9236ef265c interaction menu: added buttons for "transfer all items" 2015-04-12 20:24:45 +02:00
David Dormagen 4baf849c44 stackable: always take full stack from container, fix flickering in menu while standing on uncollectable stack 2015-04-04 20:37:06 +02:00
David Dormagen 0ef6bb306b added new progress bar style to replace old pie-chart in inventory slot (when f.e. reloading) 2015-04-04 11:23:25 +02:00
David Dormagen 916e587b68 improved UI support of stackable library & extra slot 2015-03-26 12:24:48 +01:00
David Dormagen ebcc397221 add proper support (inventory & interaction-menu contents) for extra slot library
Also fix bug with GuiScriptWindow where scrollbars would not be hidden in some cases (f.e. no-crop parent and negative-top child).
2015-03-19 16:22:06 +01:00
David Dormagen d740a79ba5 polished the updating behaviour of the interaction menu; added "Your Environment" tab into interaction menu 2015-03-05 18:53:52 +01:00
David Dormagen 700f332cc0 production menu: sort items by value; fix minor bug 2015-03-01 11:30:46 +01:00
David Dormagen 6466c6d45b adapted flagpole to the interaction menu; moved some frequent checks (completion/hostility) to the interaction menu; the flag is no longer static back 2015-03-01 11:20:33 +01:00