Commit Graph

4069 Commits (d84c9b174f9730d0e58844a29d4d17a7895be189)

Author SHA1 Message Date
Sven Eberhardt 20eaaa97b3 Fix chatting in editor lobby 2016-08-06 20:22:33 -04:00
Sven Eberhardt 1c90f9b2da Do not abort network round due to insufficient player count in editor mode 2016-08-06 15:45:56 -04:00
Sven Eberhardt c78a98d4b3 Fix crash on uninitialized pointer in Qt GL window initialization 2016-08-06 15:22:58 -04:00
Sven Eberhardt fc24969899 Add EditorPlacementLimit property
Limits the number of object instances that can be placed of a given def.
2016-08-06 02:36:53 -04:00
Sven Eberhardt a14f8597d2 Qt editor: Fix AsyncGet on bool delegate 2016-08-05 01:00:33 -04:00
Sven Eberhardt 6bd6c07195 Qt editor: Remove some debug logging 2016-08-04 22:22:14 -04:00
Sven Eberhardt bce09d272d Add EditorInitialize callback 2016-08-04 22:12:10 -04:00
Lukas Werling b7359e0c27 Remove the GTK platform (USE_GTK)
The GTK code does not work with the Qt editor. The simpler SDL2 platform
does, so we have little reason to keep the GTK code.

Note that GTK is still a dependency for mape.

Discussion: http://forum.openclonk.org/topic_show.pl?tid=3328
2016-08-03 16:25:46 +02:00
Sven Eberhardt 24a5dc33db Qt editor: Sort properties in property list by localized name and priority 2016-08-02 01:12:08 -04:00
Sven Eberhardt 1d566ec6c5 Add VIS_Editor visibility flag 2016-08-02 01:12:08 -04:00
Lukas Werling 582c82c159 Qt editor/Linux: Fix crash on player removal
See 69fff71abf
2016-08-01 13:54:35 +02:00
Sven Eberhardt e5f2e4e58a Fix StdBuf::Compare with iAt>0
This caused the clonk to sometimes walk in the air when jumping.
2016-08-01 00:37:19 -04:00
Sven Eberhardt 69fff71abf Qt editor: Fix crash on player removal 2016-07-31 23:22:09 -04:00
Sven Eberhardt d1e8bc39c5 Qt Editor: Fix enum property delegate option value lookup for undefined options 2016-07-31 10:35:15 -04:00
Sven Eberhardt b1a1df8dee Add eval parameter to not pass errors 2016-07-31 08:15:54 -04:00
Sven Eberhardt 18444c7e0d Add StringToIdentifier script function
Required to sanitize variables in the editor. Works by stripping all non-identifier characters and preprending a _ if necessery.
2016-07-30 21:43:01 -04:00
Sven Eberhardt 442b8e66df Qt Editor: Add short name for enum delegate options displayed as sub-delegate 2016-07-30 14:50:07 -04:00
Sven Eberhardt d55c988d2e Qt Editor: Support EmptyName enum delegate property for user-defined option lists
This can be used to clarify what happens e.g. when nil is selected in an object function delegate.
2016-07-30 14:13:23 -04:00
Sven Eberhardt 8840105f6c Qt editor: Auto-dropdown child enums on creation 2016-07-30 02:37:33 -04:00
Sven Eberhardt affa2aebb0 Qt Editor: Add point property delegate 2016-07-30 01:05:12 -04:00
Sven Eberhardt 37885a2e4f Qt Editor: Add AllowEditing flag for enum delegates.
Used for sound delegate
2016-07-28 00:24:28 -04:00
Sven Eberhardt b6fb7e884f Qt Editor: Put current selection name before EditorHelp/Description 2016-07-27 22:36:14 -04:00
Sven Eberhardt 73510d7fb1 Qt Editor: Add sound property delegate 2016-07-27 22:35:11 -04:00
Sven Eberhardt 11b317808f Qt Editor: Add toggle help button to "?" menu 2016-07-25 21:39:35 -04:00
Nicolas Hake 0cbb476daf Remove re namespace alias
This alias is a legacy from when we were using Boost.Regexp to
workaround a broken implementation in GCC's libstdc++ earlier than 4.9.
2016-07-25 18:39:44 +02:00
Nicolas Hake 5bdddff139 Remove MS CRT memory management debugging
Redefining new breaks perfectly valid code, but only on MSVC and only in
one particular configuration (Debug). This is very annoying because it
means people not using MSVC, or even people doing Release builds, can
write standards-conforming code which then may fail to build for other
people.
2016-07-25 18:39:44 +02:00
Sven Eberhardt 4246a72485 Qt Editor: Add EditorHelp for enum options 2016-07-25 01:05:15 -04:00
Sven Eberhardt ee88a36f73 Qt Editor: Rename EditorInfo to EditorHelp
Fits better with "UsageHelp" and is more precise.
2016-07-24 23:10:43 -04:00
Sven Eberhardt 3a6a7626c1 Qt Editor: Add help hover button to editor props 2016-07-24 23:00:24 -04:00
Sven Eberhardt 534e4cc745 Merge branch 'master' into qteditor
Conflicts:
	src/script/C4AulParse.cpp
2016-07-24 10:23:57 -04:00
Sven Eberhardt 4245f60e83 Qt Editor: Add help/description label for current selection 2016-07-24 10:12:38 -04:00
Kanibal a7d6a7dbd7 Use file selector instead of directory selector (select Scenario.txt for unpacked workspace) to select files 2016-07-23 22:47:15 -04:00
Kanibal 1e257c4e9e Allow C4Window to be constructed from Qt Widget on macOS 2016-07-23 22:47:14 -04:00
Kanibal 1c63c8cbe0 Fix off-by-one mistake in C4Landscape assertion 2016-07-23 22:47:13 -04:00
Martin Plicht 78f336c67c C4ConsoleQtViewport: Un-TODO some line for now 2016-07-23 18:20:36 +02:00
Martin Plicht 450619bac8 C4WindowController.mm: Only implement some viewport methods if not defined by qt editor implementation somewhere 2016-07-23 18:16:28 +02:00
Martin Plicht 2cfd743777 C4WindowMac.mm: Define some dummy K_* constants which weren't defined before for Cocoa 2016-07-23 18:16:28 +02:00
Sven Eberhardt 5bfd2b87c5 Qt Editor: Reorder array editing buttons below property action buttons 2016-07-23 02:34:08 -04:00
Sven Eberhardt 1f3e457ec2 Qt Editor: Fix enum child delegate value setting if a Set path is defined on the parent proplist 2016-07-23 01:40:51 -04:00
Sven Eberhardt 14d01cd5cd Qt Editor: Add EmptyName option for def property to rename the "nil" entry 2016-07-22 00:28:01 -04:00
Sven Eberhardt f4ea3359d0 Add InitializePlayers callback after all initial players have joined 2016-07-22 00:13:57 -04:00
Sven Eberhardt 4fad947980 Qt Editor: Add Set function options SetGlobal and SetRoot 2016-07-21 00:24:53 -04:00
Sven Eberhardt 16a770703a Add IsEditor script function
Returns if the host is running in editor (not adjusted in savegames).
2016-07-21 00:24:52 -04:00
Lukas Werling 513d51384f Fix nullptr -> bool conversion in return value
GCC does not like this, although both MSVC and clang accept it.
2016-07-19 17:21:23 +02:00
Sven Eberhardt 42e142b4d7 Qt Editor: Fix shape delegates as parameters to enum delegates 2016-07-18 19:24:53 -04:00
Sven Eberhardt 68358c0f87 Qt Editor: Improve display of object delegate 2016-07-14 00:45:18 -04:00
Sven Eberhardt d605bab0be Qt Editor: Move EditorActions from EditorAction_* to a proplist EditorAction.* 2016-07-14 00:17:53 -04:00
Sven Eberhardt 5a9e608f55 Qt Editor: Do not show properties of dead effects 2016-07-13 22:14:28 -04:00
Sven Eberhardt 59712bcea0 Qt Editor: Fix display of effect properties 2016-07-13 22:02:18 -04:00
Sven Eberhardt 28d2172b78 Qt Editor: Move editor props from EditorProp_* to an EditorProp proplist 2016-07-13 17:18:08 -04:00
Sven Eberhardt d9f31b006b Add ReplaceString script function 2016-07-13 02:12:31 -04:00
Sven Eberhardt dfb709df6b Qt Editor: Do not reset value to default parameter when re-selecting an already selected index 2016-07-12 23:28:51 -04:00
Sven Eberhardt 3c84f9e6f8 Qt Editor: Fix evaluation of ValueKey in enum option when changing child delegate value 2016-07-12 22:29:24 -04:00
Sven Eberhardt 0206e9a74a Qt Editor: Add HideInCreator DefCore setting
Hides internal definitions, libraries, etc. from the object creator in the editor.
2016-07-10 21:55:56 -04:00
Lukas Werling 2127e78db1 Fix c4script build 2016-07-07 22:50:13 +02:00
Lukas Werling 791315a54e Fix #include-in-#appendto, but discourage with a warning 2016-07-07 21:13:18 +02:00
Nicolas Hake dcd8d9676a Fix unloading scenarios with Map.c or System.ocg scripts (#1778)
Destruction order matters!
2016-07-07 14:39:18 +02:00
Nicolas Hake 4725043493 Def unload: Fix overloaded function refcount 2016-07-07 14:34:24 +02:00
Sven Eberhardt 85c5deb099 Qt Editor: Add option to auto-select objects created by an EditorAction
To be used by the dialogue so you can press a button on the clonk to add and immediately configure a dialogue.
2016-07-07 01:36:58 -04:00
Nicolas Hake 7ff8c4f95a Remove references to functions defined in unloading defs (#1776) 2016-07-06 14:41:22 +02:00
Sven Eberhardt 990b6ea8f1 Qt Editor: Add option to descend directly into a subpath from array and sequence property delegates 2016-07-06 00:56:08 -04:00
Sven Eberhardt 8bc5e1911d Qt Editor: When descending into array delegates, use the parent name as header. 2016-07-05 23:27:55 -04:00
Sven Eberhardt 343658db96 Fix MSVC build
Not sure why this builds elsewhere.
2016-07-05 22:54:19 -04:00
Sven Eberhardt 63c9bd78e7 Qt Editor: Fix crash and prop list/array display problems when switching prop lists.
Storing the pointer in QModelIndex could sometimes keep invalid memory on the persistent model indices. Because re-organizing these memory locations would be a nightmare and we only go two levels deep anyway, just store the parent index in the internal pointer and look up the actual property on the fly.
2016-07-05 22:53:41 -04:00
Sven Eberhardt 162a7cb331 Qt Editor: Resolve child delegates when evaluating proplist delegate display value 2016-07-04 13:21:31 -04:00
Sven Eberhardt 62c1f4bda5 Qt Editor: Add callback support for dynamic enum values in Enum delegates 2016-07-04 13:21:30 -04:00
Sven Eberhardt cfca3be7e2 Qt Editor: Fix log output widget settings
Make text non-editable, etc.
2016-07-04 13:21:29 -04:00
Lukas Werling 8ab5d35550 Fix crash due to invalid QApplication arguments
It would trigger on Linux when opening menus.
2016-06-30 22:23:21 +02:00
Nicolas Hake ad091fcfcf Fix shader code memory lifetime problem
I love StdBuf SO MUCH!
2016-06-27 12:40:35 +02:00
Nicolas Hake 9a45843828 WGL: Fall-back to a 3.1 context if 3.2 context creation fails
This is an emergency fallback for older Intel drivers on Windows, which
do not support OpenGL 3.2. As we're creating 3.2 contexts mostly to
access the Core profile, which was not available in earlier versions,
falling back to 3.1 should be fine; I don't think we're using anything
specific to 3.2.
2016-06-27 01:08:28 +02:00
Nicolas Hake cc595ec58d GL Legacy: Survive skinning meshes with no bones 2016-06-27 01:05:18 +02:00
Sven Eberhardt bc5eca903f Fix mac build 2016-06-24 20:27:53 -04:00
Sven Eberhardt 5c965aba2e Fix mape build 2016-06-22 01:47:45 -04:00
Sven Eberhardt ed368e128b Qt Editor: Ensure duplicated objects are moved to the cursor without extra mouse movement 2016-06-22 01:46:13 -04:00
Sven Eberhardt 8158cbf87c Qt Editor: Allow hotkey (F2) to duplicate selected objects.
Also reset cursor pos to center of duplicated objects to ensure they're on screen when duplicating by hotkey.
2016-06-22 01:04:14 -04:00
Sven Eberhardt b34ae09437 Fix utility builds 2016-06-21 21:48:10 -04:00
Sven Eberhardt a7aa89f168 Merge branch 'master' into qteditor
Conflicts:
	planet/Objects.ocd/Structures.ocd/StoneDoor.ocd/SpinWheel.ocd/Script.c
	src/platform/C4WindowSDL.cpp
	src/script/C4AulParse.cpp
	src/script/C4Effect.cpp
2016-06-20 22:27:03 -04:00
Sven Eberhardt 9d9db0d9d5 Qt Editor: Fix grouped item selection in enum property delegate 2016-06-20 19:48:02 -04:00
Sven Eberhardt e97491940f Qt Editor: Fix possible crash if am object is deleted while the object selection delegate combo box is open 2016-06-20 19:13:50 -04:00
Sven Eberhardt 068004d9af Remove unused variable in C4AulExec 2016-06-20 15:50:36 -04:00
Sven Eberhardt b6526d2f65 Qt Editor: Always duplicate contents with objects
Even if they are not selected, this is probably what the user expects.
2016-06-20 15:50:35 -04:00
Lukas Werling 302fa5e362 Qt Editor: Make main loop calls more efficient 2016-06-20 16:56:20 +02:00
Lukas Werling fc10992ab7 Fix crash when starting a game in fullscreen mode 2016-06-20 16:55:23 +02:00
Lukas Werling b853f99b28 Fix -Wc++11-narrowing error in clang 2016-06-20 16:08:37 +02:00
Sven Eberhardt 44d94d5043 Improve editor duplicate function to duplicate properties and object connections.
It serializes objects using a selective SaveScenarioObjects script callback and then just executes the generated script. This automatically saves important properties, connects switches and doors, etc.

This change also solves the problem that duplicating an elevator plus case would create two elevator cases.

If execution fails (e.g. because of script errors or because a non-saveable object was duplicated), the method falls back to the legacy duplication method of creating objects with the same prototypes at the same position.
2016-06-20 01:45:26 -04:00
Sven Eberhardt c6e4bfd585 Aul: Add DirectExec method for executing a complete function definition. 2016-06-20 01:37:04 -04:00
Sven Eberhardt e7be7d6acd Qt Editor: Add viewport context menu 2016-06-19 22:45:12 -04:00
Nicolas Hake e490428f29 Win32: Drastically improve load times with unpacked planet/
C4Group::SearchNextEntry would waste lots of cycles looking up file
attributes that were never inspected afterwards. Since all we want is
the file size, and we already get that for free from FindFirstFile and
FindNextFile, store it with the directory iterator instead of querying
it at every iteration.

This reduces load times on my machine by almost half, tested across
several different scenarios.
2016-06-19 17:08:50 +02:00
Nicolas Hake e9c5facf91 GL: Disable hardware-based skinning on old Intel devices
Our hardware-based skinning doesn't work on certain Intel graphics
devices. Fall back to software skinning on GPUs that return an OpenGL
3.1 context even though we explicitly request a 3.2 one.

Might fix #1459, #1689.
2016-06-19 13:45:12 +02:00
Nicolas Hake 9555bf737f GL: Bail earlier when encountering degenerate matrices 2016-06-19 11:22:04 +02:00
Sven Eberhardt 34289fa18a Qt Editor: Add EditorActions.
Replacing the old EditCursorCommands (which nobody knew). Objects now publish their commands directly on the property viewer.
2016-06-19 00:08:09 -04:00
Lukas Werling 19395b23ae Fix SetMatAdjust() (for kenny) 2016-06-18 17:17:43 +02:00
Sven Eberhardt 08b7980d69 Qt Editor: Fix shape relative default 2016-06-18 10:43:00 -04:00
Sven Eberhardt a598dee4e1 Qt Editor: Fix shape delegate parent object when delegate is provided by an effect 2016-06-18 10:41:15 -04:00
Sven Eberhardt 0162b4b21f Qt Editor: Make Relative=true the default for shape delegates.
It should be by far the more common setting.
2016-06-18 10:40:24 -04:00
Sven Eberhardt a7bd20a927 Fix server and utility build
Adding missing C4DefList::SortByPriority() stub
2016-06-18 10:35:54 -04:00
Sven Eberhardt 1b785da271 Fix non-Qt build 2016-06-18 10:33:08 -04:00
Sven Eberhardt 25fa57cabf Qt Editor: Add "Static Flat" landscape mode 2016-06-17 18:44:59 -04:00
Sven Eberhardt ec6998e530 Qt Editor: Fix some crashes and errors when switching between object and definition selection 2016-06-17 01:26:38 -04:00
Sven Eberhardt 2e412d1668 Qt Editor: Fix log output position 2016-06-17 00:56:23 -04:00
Sven Eberhardt b70882d7fa Editor: Object scaling+rotation 2016-06-17 00:07:49 -04:00
Sven Eberhardt f913b4d012 Qt Editor: Highlight objects hovered in object selection delegate in viewport 2016-06-16 16:15:15 -04:00
Sven Eberhardt 2f22a3a8fe Qt Editor: Add property delegate type "object" 2016-06-16 14:59:04 -04:00
Sven Eberhardt 9e4f036fe2 Qt Editor: Focus across columns in property editor 2016-06-16 13:19:35 -04:00
Sven Eberhardt a52857d073 qt editor: Add string delegate 2016-06-16 00:40:25 -04:00
Sven Eberhardt 2df6fdb52b qt editor: Improve grouped enum tree navigation 2016-06-16 00:09:53 -04:00
Sven Eberhardt e5837dc478 Qt Editor: Use definition grouping on "def" property delegate enum 2016-06-15 21:57:59 -04:00
Sven Eberhardt ad863836b3 Qt Editor: Add groups to enum 2016-06-15 00:15:47 -04:00
Lukas Werling 6b958fe88e Fix viewports on high-DPI screens 2016-06-11 22:36:48 +02:00
Lukas Werling 60671474a8 Use Qt's event loop instead of polling for events
This fixes slow input event handling execution on Linux. Additionally,
it seems to fix some crashes with the menu bar.
2016-06-11 21:52:50 +02:00
Sven Eberhardt 0767fd2616 Qt Editor: Auto-add PlayerStart object to scenarios created via "New..." option. 2016-06-08 22:27:32 -04:00
Sven Eberhardt 0bb910814d Qt Editor: Fix display and control of enum delegate parameters 2016-06-08 00:37:48 -04:00
Sven Eberhardt 5e4e6c9f7c Remove a debug log 2016-06-07 19:08:15 -04:00
Sven Eberhardt 397dbd867a Add DefinitionPriority property to control call order of Definition()-callbacks. 2016-06-07 18:22:43 -04:00
Sven Eberhardt f44cb9fa62 Qt Editor: Fix script errors on empty selection 2016-06-06 23:26:20 -04:00
Sven Eberhardt 16e31098b4 Qt Editor: Improve proplist and array display/editing
* Add/Remove element buttons
* Display customization of user delegates
2016-06-06 01:54:05 -04:00
Sven Eberhardt 4d04135cda Fix GetPropertyBool default value when descending into prototype [Guenther] 2016-06-03 20:17:20 -04:00
Lukas Werling 6bd26b047f Fix typo 2016-06-03 23:18:44 +02:00
Lukas Werling 4920ed743f UPnP: Another try for Debian compatibility 2016-06-03 22:16:39 +02:00
Lukas Werling 91e2c137d9 UPnP: Fix compatibility with Debian's old versions 2016-06-03 21:58:19 +02:00
Sven Eberhardt b10da0629d Qt Editor: More EditorProps types (string, array) and attributes (EditOnSelection, DefaultEditorProp) 2016-06-03 01:20:43 -04:00
Lukas Werling b1b72b003a Do Linux UPnP mappings asynchronously 2016-05-31 18:23:41 +02:00
Lukas Werling dbaaec268a Change C4Network2UPnPP forward declaration to class 2016-05-29 23:39:10 +02:00
Lukas Werling 07e8c75bac Replace libupnp with miniupnpc
- The new code works with my router while libupnp didn't. :)

 - There are some unexplainable crashes in libupnp: #1640

 - Using miniupnpc seems to be less complex than libupnp.

 - Apparently, miniupnpc also works on Windows, so we may be able to use
   it for all platforms.

Disadvantage: UPnP queries aren't asynchronous anymore, but they seem to
be pretty fast (< 1 s).
2016-05-29 23:38:12 +02:00
David Dormagen acde7c923a fix possible crash on cleaning up particles
It could happen that the objects were cleared (after evaluation screen / on section change) but a particle list would remain that would still point to an object (and would then access it).
I am not exactly sure how that could happen, because objects should clear their particle lists on removal (and thus shouldn't really need a ClearPointers).
There is a tiny chance that this points to another bug somewhere in the object removal - that's just a random guess though.

Anyway, this should fix the infamous Knüppeln crash.
2016-05-28 23:22:33 +02:00
Sven Eberhardt af2a74b6ec Qt Editor: Array editing 2016-05-28 09:30:54 -04:00
Sven Eberhardt d304b17028 Qt Editor: Editing of child proplists 2016-05-24 23:06:00 -04:00
Günther Brammer 57a35bf01b Don't crash on functions declared inside other functions
Declaring a local variable inside any function works the same way as
declaring it in top-level scope, which gets a bit weird if done inside a
function inside a constant proplist, but is at least consistent.

Thanks to Flinti for reporting this.
2016-05-25 01:06:10 +02:00
Sven Eberhardt 8a5dbdc73f Qt Editor: More shape prop storage options 2016-05-23 19:22:49 -04:00
Sven Eberhardt 747077b71b Qt Editor: Fix effect properties 2016-05-23 19:22:05 -04:00
Lukas Werling a71ca69f1d Make ingame mouse cursor size configurable
On High-DPI displays, the mouse cursor is very tiny. We'll probably want
some high-resolution cursor graphics at some point, but the current ones
scale good enough.
2016-05-23 21:14:03 +02:00
Lukas Werling 435fe98b71 SDL: Handle key repeats 2016-05-22 23:27:57 +02:00
Maikel de Vries 8291298af1 add script callback on completion change 2016-05-21 13:34:34 +02:00
Maikel de Vries 6794b3b630 remove object component functionality from the engine 2016-05-21 13:34:34 +02:00
Maikel de Vries accd897b91 rename NoComponentMass to NoMassFromContents
This had nothing to with components, and risk of backwards compatibility is minor.
2016-05-21 13:34:33 +02:00
Maikel de Vries 00d5a06ec0 remove option to display components in old style menus 2016-05-21 13:34:33 +02:00
Maikel de Vries fcd3678748 remove unused function ComponentAll 2016-05-21 13:34:33 +02:00
Maikel de Vries 183ab4c4a0 remove unused function ComposeContents 2016-05-21 13:34:33 +02:00
Maikel de Vries 5841b55f7e remove unused function GetNeededMatStr 2016-05-21 13:34:33 +02:00
Nicolas Hake 3fd1187833 Don't overload CompileNewFunc with rvalue reference parameters
We don't need to pass the C4ValueNumbers* as a rvalue reference, and
doing so needs const qualifiers on MSVC.
2016-05-21 12:56:57 +02:00
Günther Brammer d23ffde361 Merge script branch 2016-05-15 19:21:26 +02:00
Günther Brammer 6763f2b5c7 Silence complaints about missing functions in EffectCall (#1736)
All the other effect callbacks silently ignored missing functions, either
by using the Call variant that doesn't complain about it, or checking for
the missing function themselves.
2016-05-15 19:20:43 +02:00
Günther Brammer 0559a93f88 Script: CreateEffect effects do not get their target in callbacks
They can use the Target property instead.
2016-05-15 15:20:08 +02:00
Günther Brammer 3aa6978c4e Script: Effects have their target as a property "Target" 2016-05-15 15:17:18 +02:00
Günther Brammer c0d32f8f4e Remove redundant target parameters from effect implementation 2016-05-15 15:17:17 +02:00
Günther Brammer 6aaf7cd2ef Store a pointer to the effect target in the effect itself 2016-05-15 15:17:17 +02:00
Günther Brammer 3e5d982475 Allow modifications to Scenario local vars from /script 2016-05-15 15:17:17 +02:00
Günther Brammer 408ac90cd7 Scenario effects: Use Scenario and not Scenario->GetPrototype() as this() 2016-05-15 15:17:17 +02:00
Günther Brammer f927717458 CreateEffect initializes the name of the new effect
Effects with prototypes were supposed to inherit their names from the
prototype, but the effect prototypes are also supposed to get their names
from ParentKeyName, which is not inherited. Maybe that'll change, but for
now this matches how old effects work.
2016-05-15 15:17:17 +02:00
Günther Brammer 5c6a805fd5 Add move constructor to C4Value 2016-05-15 15:17:17 +02:00
Günther Brammer c2edd9b6fd Add noexcept to the Std*Buf move constructors
Apparently this is recommended so that a std::vector actually uses the
move constructor. In any case, the second parameter wasn't used, so this is
a nice simplification as well.
2016-05-15 15:17:16 +02:00
Günther Brammer 9e8d644a26 StdAdaptors: Make mkParAdapt(mkPtrAdaptNoNull(), Par1, Par2) work
Employ variadic template arguments and more rvalue references for this.
Sadly, StdParameterAdapt itself is even more complicated, since it has to
store the parameters instead of just forwarding them, so the limit is still
two parameters. But that's twice as much as before in many cases.
2016-05-14 22:59:59 +02:00
Nicolas Hake 511e3bbb36 Aul: Deprecate implicit conversion from 0 to object/proplist/def/string
Instead of (int)0, nil should be used to signify "no object" etc.
2016-05-13 16:28:45 +02:00
Nicolas Hake 370a1dd3d1 Aul: Re-enable parameter type checking after AST rewrite 2016-05-13 16:22:37 +02:00
Nicolas Hake 3217fbf55b C4AulScriptFunc::AddPar: Accept type in addition to name
This way, we don't have to first add the parameter and then set the type
afterwards via internal members.
2016-05-13 16:22:00 +02:00
Nicolas Hake eca8f2cce8 Aul: && returns either parameter, not bool 2016-05-13 16:20:17 +02:00
Nicolas Hake 43c6f946dd Aul: Split assignment op from standard BinOp
Assignment was special-cased everywhere, so it can just as well get a
separate AST node.
2016-05-13 13:50:29 +02:00
Nicolas Hake daf3424e63 Delete some commented-out legacy function parameters 2016-05-13 13:14:23 +02:00
Nicolas Hake 092a23c2f7 Aul: Parse scripts into an AST, then generate bytecode from that
This commit contains a fairly substantial rewrite of the C4Script code
generator. Instead of generating bytecode while parsing the script,
we're now parsing the script into a syntax tree, and have any further
processing happen on that instead of the raw source.

At this time, the code generator emits the same bytecode as the old
parser; there are several optimization opportunities that arise from the
new possibility to emit code out of order from its specification by the
author.

Compared to the old compiler, this one is still rather deficient when
dealing with incorrect code; it's also not emitting several warnings
that used to be diagnosed.
2016-05-12 19:43:48 +02:00
Nicolas Hake 78e5f8528d C4PropList::GetParent: make const 2016-05-12 18:47:53 +02:00
Nicolas Hake be2fdaaae3 C4Particles: Fix build with MSVC memory tracing 2016-05-12 18:47:52 +02:00
David Dormagen 771bd802f0 particles: re-added missing intialization of ibo_size
Thanks to ck, who noticed. Apparently it got lost when reverting some changes back and forth for testing, because I had one revision where I didn't need it anymore but I reverted most of that.
2016-05-12 10:03:02 +02:00
Nicolas Hake 13e02bb418 C4Random: Fix build with MSVC memory tracing 2016-05-11 17:15:47 +02:00
Nicolas Hake 5872b5e8ae C4AulFunc::GetFullName: make const 2016-05-11 17:15:47 +02:00
Nicolas Hake 10abb1bbdb Remove unused C4AUL_CodeBufSize 2016-05-11 17:15:47 +02:00
Nicolas Hake a100b93e7f DEBUG_BYTECODE_DUMP: Allow setting from build system 2016-05-11 17:15:47 +02:00
Nicolas Hake 16641d3841 C4AulScriptFunc::DumpByteCode: properly align BCC names
The old code just appended eight spaces when the type of the BCC was
shorter than eight chars.
2016-05-11 17:15:47 +02:00
David Dormagen 6bacdfcbb6 particles: fixed some particles not rendering under certain conditions
Some particles were visibly missing. The reason was apparently that the VAO was initialized with an IBO that was yet too small (because not all particles were created yet).
To be honest, I don't know why the IBO needs to be rebound as the identifier itself does not change(?) but maybe OpenGL optimizes some stuff and needs the size fixed?

Steps to reproduce: In OneMillionParticles.ocs, make Test3 be the first test (otherwise the IBO would have been large enough). You would now not see all of the fireworks.

The issue was introduced in e13cda4bd0
2016-05-10 22:26:34 +02:00
David Dormagen 29333ef87a particles: initialize primitive restart index IBO lazily
Otherwise the IBO is created from scratch for every particle that is e.g. created in a for loop. This is extremely slow and unnecessary.
The symptoms was that OneMillionParticles appeared to 'freeze' on the non-batch creation test. (Hint: it didn't freeze, it just took forever).
2016-05-10 21:46:32 +02:00
Nicolas Hake 26334cb4d7 Aul: Join AB_INT + AB_Neg 2016-05-09 12:33:59 +02:00
Nicolas Hake 34556e3e81 Aul: Join AB_STRING+AB_ARRAYA to AB_PROP 2016-05-09 12:33:58 +02:00
Nicolas Hake 33f7fb935f C4AulCompiler: Rename iStack to stack_height 2016-05-09 12:33:51 +02:00
Nicolas Hake 41000a8f9a C4AulCompiler: Rename pLoopStack to active_loops 2016-05-09 12:21:33 +02:00
Nicolas Hake d0dbe05876 C4AulCompiler: Rename fJump to at_jump_target
You have no idea how much I hate systems hungarian.
2016-05-09 12:21:33 +02:00
Nicolas Hake f0b4ef46a5 GetStackValue: Remove "default: /* unreachable */"
Without an explicit default case, the compiler can warn about unhandled
enum values inside the switch.
2016-05-09 12:21:33 +02:00
Nicolas Hake 7a135a060f C4AulParse: Take GetTokenName out of public interface 2016-05-09 12:21:33 +02:00
Nicolas Hake 0a3b31e735 C4AulParse::AddVarAccess: Move to C4AulCompiler 2016-05-09 12:21:33 +02:00
Nicolas Hake 0342711cd4 C4AulCompiler: Take GetStackValue out of public interface 2016-05-09 12:21:33 +02:00
Nicolas Hake 792e12adad C4AulCompiler: Split into separate file 2016-05-09 12:21:33 +02:00
Nicolas Hake c8d71d47c0 C4CodeGen: Rename to C4AulCompiler
I need to split up C4CodeGen into smaller parts, and having the bit that
actually generates the bytecode named C4CodeGenCodeGen would be silly.
2016-05-09 12:21:33 +02:00
Nicolas Hake 86729ea536 Declare C4AulBCC as class instead of struct
The C++ standard says that it doesn't matter whether you forward declare
something as struct or class and then define it using the other keyword.
Unfortunately MSVC adds those keywords to its name mangling scheme,
which breaks things.
2016-05-09 12:21:33 +02:00
Lukas Werling 042e3c9602 SDL: Fix crash when opening resolution selector 2016-05-07 22:03:25 +02:00
Lukas Werling 9fa16c5e14 SDL: Enable multisampling
Unfortunately, there doesn't seem to be an easy way to apply
multisampling changes in SDL. As a workaround, a message requesting the
player to restart the game is shown.
2016-05-07 12:25:11 +02:00
Lukas Werling 1919d81f9d SDL: Implement FlashWindow for X11 2016-05-07 00:33:26 +02:00
Julius Michaelis 30bb12164b gtk_window_set_urgency_hint 2016-05-05 22:20:52 +02:00
Günther Brammer 69427a484a C4AulParse: Check for function names after '->' with the helper function 2016-05-05 02:47:17 +02:00
Günther Brammer 994cb52cea C4AulParse: Don't escape spaces in bytecode dumps of strings 2016-05-05 02:38:36 +02:00
Günther Brammer 99f704fbb8 Script: Prevent writes to constant arrays 2016-05-05 02:10:41 +02:00
Lukas Werling 60e9383a42 Improve seeding of UnsyncedRandomRng 2016-05-01 19:21:09 +02:00
Günther Brammer 9741af42fd Replace all usages of the old local variables list with properties 2016-05-01 00:28:37 +02:00
Günther Brammer 7792acdff0 Script: Check for functions before keywords
This unifies the lookup for local variables and functions. Its slightly
awkward that global functions can overload if and Par now, but local
variables already could.
2016-05-01 00:28:37 +02:00
Günther Brammer 30f7457d89 Remove unused macros leftover from removed script features 2016-05-01 00:28:37 +02:00
Günther Brammer b8f2d0ca87 Script: Repeat the parser error message when executing a broken function 2016-05-01 00:28:37 +02:00
Günther Brammer 17b18da26c Make bytecode dump work again
Dumping the bytecode before adding EOFN while depending on that to signal
the end isn't such a hot idea.
2016-05-01 00:28:37 +02:00
Günther Brammer 904bf78d68 Don't crash when deserializing an effect with object command target (#1730) 2016-04-29 00:16:20 +02:00
Günther Brammer 4092911349 Move code generation into its own class 2016-04-28 03:25:47 +02:00
Günther Brammer b00b8554ab Merge branch script 2016-04-28 03:25:44 +02:00
Günther Brammer d45ac946fe Add C4AulParseError constructor and cease reusing it for warnings
The nontrivial code that formats the position is now a function of
C4AulParse used by both warnings and errors.
2016-04-28 02:59:12 +02:00
Nicolas Hake a8f4bd3960 C4AulParseError: Avoid the second string parameter
While I'm not a big fan of hiding flow control in a function, Error()
handles formatting and saves me from calling FormatString().getData() a
lot.
2016-04-28 02:59:12 +02:00
Günther Brammer 4b43576f83 Script: Complain about some attempts to Call nonexistant function again
This code got lost in the function pointer rewrite.
2016-04-28 02:59:12 +02:00
Nicolas Hake 072661239d GRBroadcast: Don't noisily fail when a callback function does not exist
Since GRBroadcast calls all goal and rule objects and the scenario,
there is a high likelyhood that not all of them implement whatever
arbitrary callback is called. Instead of throwing script errors about
calling undefined functions, just swallow that error and continue.
2016-04-28 02:59:12 +02:00
Günther Brammer 3760363a3b Script: Add GetPrototype and SetPrototype functions
This should eventually replace the Prototype property, so that proplists
can be used as a key-value-storage without any hidden gotchas.

The Prototype is such a magical property that any code dealing with all
properties has to special-case it anyway, and isn't even returned by
GetProperties().
2016-04-28 02:59:11 +02:00
Günther Brammer 525cdc11a3 Deduplicate calculation of the relative stack position of local variables 2016-04-28 02:59:11 +02:00
Günther Brammer 071feaa78f Deduplicate loop control handling in the script parser 2016-04-28 02:59:11 +02:00
Günther Brammer efd4724084 Script: Add Scenario effects
These work just like global effects, except that effects from CreateEffect
get the scenario as target parameter in the callbacks.
2016-04-28 02:53:21 +02:00
Günther Brammer 97406d24d2 Script: Add Construction and Destruction effect callbacks 2016-04-28 01:08:04 +02:00
Günther Brammer 50378ffda0 Script: CreateEffect starts effects that receive callbacks themselves 2016-04-28 01:08:04 +02:00
Sven Eberhardt 881534bee0 Qt Editor: Shape properties 2016-04-25 16:17:10 -04:00
Lukas Werling c349254d8b Remove C4Particles.h include from C4Object.h
This reduces the number of files indirectly including PCG from ~50 to 7.
2016-04-25 21:24:27 +02:00
Lukas Werling e33066a4f2 Rename SafeRandom() to UnsyncedRandom() 2016-04-25 17:32:23 +02:00
Lukas Werling e734f15117 Remove RNG implementation from C4Random.h 2016-04-25 17:28:04 +02:00
Lukas Werling aeabe28d82 Remove AsyncRandom() script function
We couldn't think of any reason you'd want to use this over regular
Random() in script.
2016-04-25 17:18:07 +02:00
Günther Brammer e5cfb1858f Script: GetName() can return the property a proplist was defined in
This means that the ActMaps do not need to repeat their name anymore,
provided that all Scripts use GetName() instead of directly accessing .Name.
2016-04-24 19:40:29 +02:00
Günther Brammer 5a470f51f8 Move Effect functions to C4Script.cpp 2016-04-24 19:40:29 +02:00
Günther Brammer 2cdf553953 Change effect list getting function parameter type to C4PropList*
This makes it possible to move the effect functions to C4Script.cpp.
2016-04-24 19:40:29 +02:00
Günther Brammer e8811a7b21 Move global effects from ::Game to ::ScriptEngine
This even enables some simplification in the CompileFuncs, since the global
effects were already put in the same section as the other ScriptEngine
parts. The callback for updates due to relinks also fits nicely.

The reset in C4Game::Default was redundant with C4Game::Clear already.
2016-04-24 19:40:28 +02:00
Günther Brammer e2c6c2a841 Do not use C4Object in C4Effect
Instead, the pointer to the effect list is passed to the functions that
previously used the object to determine it.
2016-04-24 19:40:28 +02:00
Günther Brammer c89e73608b Unite getting the effects list from a C4Object pointer into a function
This way, that function can be re-implemented in standalone c4script.
2016-04-24 19:40:28 +02:00
Günther Brammer 42a15e3be9 Convert C4Effect parameters that do not need to be C4Object* to C4PropList* 2016-04-24 19:40:28 +02:00
Günther Brammer bfb9b6b1fd Drop the roundtrip through C4ID for the effect C4Def command target
Unfortunately, this complicates the C4Effect::CompileFunc to stay
compatible.
2016-04-24 19:40:27 +02:00
Günther Brammer 632c5cbd0f Refactor effect callbacks into helper functions 2016-04-24 19:40:27 +02:00
Günther Brammer e22ca51f72 Don't leak references to Strings on script errors (#583) 2016-04-24 19:40:27 +02:00
Günther Brammer 5fbac346d3 Incompatible type warnings work for parameters with type declarations 2016-04-24 19:40:27 +02:00
Günther Brammer 55572720bc Make the C4ScriptHost a ComponentHost again 2016-04-24 19:40:27 +02:00
Günther Brammer fb76308812 Make C4ValueConv::Type a constexpr variable instead of an inline function 2016-04-24 19:40:26 +02:00
Nicolas Hake 19a3d43558 Fix definition of explicitly sized enums 2016-04-24 15:20:28 +02:00
Nicolas Hake baad3aef3c C4ScriptHost: add const proplist accessor
This accessor does not need to be virtual itself, because we don't want
people to override it; it calls the nonconst accessor anyway, which is
virtual.
2016-04-24 14:01:23 +02:00
Nicolas Hake 96223f154c C4ValueMapNames: mark GetItemNr const
It doesn't change anything, so callers don't need a nonconst object.
2016-04-24 14:01:23 +02:00
Nicolas Hake caf44e2473 Remove specious space from Aul operator table 2016-04-24 14:01:23 +02:00
Nicolas Hake 770be2dafe Aul: Allow AB_ERR to carry more detailed error information 2016-04-24 14:01:23 +02:00
Nicolas Hake 367f58b1cc C4AulParseError: Enable creation from host and source pointer
Instead of having a C4AulParseError constructor read the location data
from the parse state, allow explicit construction from a known location.
2016-04-24 14:01:23 +02:00
Nicolas Hake cfdb1142b8 Move C4AulParse declaration into separate header 2016-04-24 14:01:23 +02:00
Lukas Werling 5471fe6cff Fix randomness in particles with identical properties
Several issues:

 - The RNG wasn't copied with the value provider (which is always
   copied), resulting in unseeded RNGs.

 - Separate PCG streams with the same seed start with identical values.
   As particles often draw only a single value, we just always advance
   the RNG a bit to make the streams diverge.

 - The C++ specification requires a <= b for its distributions, but that
   wasn't guaranteed by the particle startValue/endValue.
2016-04-23 23:29:36 +02:00
Sven Eberhardt bc32456ac1 Fix crash on Random(0) 2016-04-22 16:44:35 -04:00
Lukas Werling b0c1d819af Reduce game list refresh limit to 1 second 2016-04-22 10:50:03 +02:00
Lukas Werling 0fefc7abae Merge branch 'pcg' 2016-04-21 20:47:34 +02:00
Lukas Werling e6a39392dd Use PCG for C4Particle 2016-04-21 20:39:40 +02:00
Lukas Werling febc5f91bd Replace rand() with SafeRandom() 2016-04-20 22:42:00 +02:00
Lukas Werling 1f9c15e388 Allow MapZoom values smaller than 5 2016-04-20 22:42:00 +02:00
Lukas Werling 7005eae55d Use PCG as random number generator 2016-04-20 22:42:00 +02:00
Sven Eberhardt f41d3b8869 Fix out-of-bounds memory access in C4Team [sphalerite] #1717 2016-04-19 21:16:47 -04:00
Lukas Werling abf32cf00b LoadScenarioSection: Allow reloading the current section 2016-04-18 23:03:35 +02:00
Lukas Werling 4a9553bd20 Fix LoadScenarioSection() resetting the Random seed 2016-04-18 22:57:38 +02:00
Nicolas Hake f09d26e39f Merge PR 20: Make memory allocation/deallocation more consistent 2016-04-18 13:49:37 +02:00
Linus Heckemann 042161a627 Fix subsequent deallocation to use free too 2016-04-17 22:56:36 +01:00
David Dormagen 60b9558b56 script GUIs: fixed clipping over parent's boundaries (#1718)
The window would always use its very own rectangle for clipping - bad luck if it was larger than the parent.
Now children can only additionally restrict the parent rectangle (which defaults to the whole screen at root).
2016-04-17 22:28:34 +02:00
Linus Heckemann 25fd930242 Fix some malloc/free mismatches
Discovered with valgrind. Previously, some memory that later gets freed using
free(...) (in StdBuf::Clear) was allocated with new char[...] rather than
malloc, in which case delete[] should be used to free them.
2016-04-17 20:13:33 +01:00
Nicolas Hake 8ffc1ab8cb Apply DrawTransform to meshes too
This will make lighting look weird again for meshes flipped via FlipDir.
Avoid doing that until we implement FlipDir for meshes via an internal
MeshTransform.
2016-04-17 17:56:56 +02:00
Sven Eberhardt f594737d7e Fix Definition() call order to prevent possible sync loss. 2016-04-16 23:00:31 -04:00
Sven Eberhardt 901399f5c2 MSVC compile warning fix 2016-04-16 22:05:37 -04:00