Commit Graph

82 Commits (bce903ee0434ffae24bf02c898ab456adee9ffdf)

Author SHA1 Message Date
Clonkonaut 51a18f42b2 Expand ObjectInteractionMenu search radius one pixel lower (#1788).
I don't think this pixel will hurt too much.
2016-08-10 00:01:27 +02:00
Clonkonaut 05a814461f ObjectInteractionMenu: don't create infinite ExtraSlotTracker effects.
I think there's a bug in the effects system. It seems that effects are not removed properly if command_target is deleted. I will investigate.
2016-08-09 23:45:48 +02:00
Mark dfbeec20f8 ObjectInteractionMenu: More sensible use of the variables/if-clause
The original implementation is ok, but why check the value if it would not change anyway? In the new implementation the variable lives only where it can actually change, and so does the if-clause.
2016-04-05 21:09:04 +02:00
Mark fbfdcaf932 ObjectInteractionMenu: Extracted sounds 2016-04-05 20:59:00 +02:00
Mark 2fc89201ce ObjectInteractionMenu: Renamed variables
Variables have the same names in both functions.
2016-04-05 20:55:04 +02:00
Mark dc0c8b7361 ObjectInteractionMenu: Extract functions for transferring items
Transfer of items from one container to another is handled differently between the following actions: a) select items for transfer in the inventory box; b) transfer all items with the transfer-all-arrows.

This should be made consistent, especially since action a) seems to have an unnecessary special case (marked with TODO).

As a first step the methods were simply extracted.
2016-04-05 20:49:40 +02:00
Mark dd7bf3e89e Merge remote-tracking branch 'origin/master' into liquid_container
Conflicts will be merged in the next commit:
	planet/Objects.ocd/Items.ocd/Tools.ocd/Pipe.ocd/PipeLine.ocd/Script.c
	planet/Objects.ocd/Items.ocd/Tools.ocd/Pipe.ocd/Script.c
2016-03-25 17:15:39 +01:00
Mark d06f62398c Object Interaction Menu: Implementation should be discussed
There is one special case in the object interaction menu that should be handled by stackable already. Marked it with "TODO".
2016-03-18 17:20:00 +01:00
Mark ac8d40418c Refactoring: Stackable: Renamed TryPutInto() to MergeWithStacksIn()
The previous name suggested that the object actually gets put into another object. In fact it merges the stack count with other stacks, and it does not only try to (and reverts the state if it fails), but it actually changes other objects even if the function returns false.
2016-03-16 18:19:55 +01:00
David Dormagen 4465236d1b interaction menu: added contents count to "Inventory" (#1697)
..I am open to discuss the exact design of this.
2016-03-04 08:18:20 +01:00
Mark 8698aa25cf Object Interation Menu: Request displayed amount from objects
The special handling of the stackable library was moved from the interaction menu to that library. The reasoning behind this is that the menu should not have to know each and every object, but the objects should tell the menu how they are displayed.
Liquids are displayed by their liquid count now. It would be even better, if the max. capacity would be displayed without having to hover the description field.
2016-02-19 15:19:41 +01:00
David Dormagen 2dc291f8f6 contents menu: fixed possible "use after deletion" error 2016-01-25 20:21:28 +01:00
David Dormagen cd57e47493 script GUIs: fixed text clipping and scrolling (#1605, related to #1612)
Previously, text windows would just change their own size and leave cropping and scrolling to their parent. This made the code easier, but was apparently unintuitive for scripters.
Now text windows do not change their size but show a scrollbar themselves (unless GUI_FitChildren or GUI_NoCrop of course).

This implied some other changes, because now parents without a scroll bar need to clip, too. (Or the clipping needs to be moved to the child window. But then it would have to be made sure that menu decoration can still go out of the bounds.)
And this also needed some script fixes where scripters assumed the text windows would not scroll (and thus made them smaller than 1em).

related to https://git.openclonk.org/openclonk.git/commit/46ad28ea652fad34814a866f3b9c305aa7cc6faa
2016-01-18 21:39:54 +01:00
Sven Eberhardt eb333bd8db Fix extra slot object check in object interaction menu 2016-01-17 22:15:23 -05:00
Sven Eberhardt f6583ee754 Fix nil pointer in interaction menu when object transfer removes target container. 2016-01-17 22:09:27 -05: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
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