Commit Graph

4073 Commits (61962fe70abd22a665446cc09fcef163bf0e3862)

Author SHA1 Message Date
Lukas Werling 61962fe70a Add --check/-c parameter to c4script for syntax checking 2016-12-23 17:18:00 +01:00
Lukas Werling f9305a1526 Editor: Fix crash when trying to save scenario into itself 2016-12-19 23:14:49 +01:00
Maikel de Vries ae6cdc6619 fix return value of InsertMaterial when a pixel is created
This is a partial fix for #1865. Also this return value still needs to be fixed for query_only == true, but that requires a bit more work in C4PXS.
2016-12-19 22:49:28 +01:00
Lukas Werling 8d9eedffe4 Reset C4NET2IO_DUMP_LEVEL to 1 (#1869) 2016-12-19 17:30:19 +01:00
Lukas Werling d84c9b174f Add warning for non-UTF-8 files 2016-12-13 22:40:51 +01:00
Lukas Werling 4c51620dcf Fix UPnP/Linux crash when there is no UPnP device 2016-12-10 22:07:37 +01:00
Nicolas Hake 60829ae5e4 Aul: Don't let exceptions escape from constant resolver
Letting the constant resolver throw exceptions prevented us from doing
checking on later initializers anyway, so instead we'll send them to the
error handler. As a special bonus this makes it so we don't crash when
a global variable initializer has errors. Fixes #1850, #1855.
2016-11-30 13:37:33 +01:00
Armin Burgmeier 88361ab606 Use NEAREST texture filtering for material map
The material map is 1D texture that contains information about every
material-texture combination. There is no point in linear filtering,
i.e. trying to interpolate between two materials such as gold and granite
or whichever two materials happen to be adjacent in the material map texture.

This might or might not be relevant to #1841, but should be more correct
behavior in any case.
2016-11-27 11:21:17 -08:00
Armin Burgmeier 0340a28cdd editor: delete viewport widgets immediately
I don't know why the viewports are deleted with deleteLater(), but it leads
to an OpenGL context getting deselected behind our back, and so we don't know
when is a good time to re-select it. This leads to termination of the engine
when selecting File->Close (Ctrl+W) in the editor, because the graphics
re-initialization fails with no GL context active.

Instead, just delete the viewport widget immediately, which works fine at
least on Linux. This is also recommended by the Qt documentation at
http://doc.qt.io/qt-5/qopenglwidget.html.
2016-11-26 15:19:56 -08:00
Armin Burgmeier 75cbba8b7d editor: keep track of viewports properly
When removing a viewport, then also remove it from the internal list of
viewports. Otherwise, we might attempt to delete it again later. Fixes
crash on editor shutdown on Linux.
2016-11-26 15:19:56 -08:00
Armin Burgmeier 648309cf7e Make console destruction more deterministic
This fixes a crash on Linux when exiting the editor. It was caused by
C4Console::~C4Console being called by the C++ runtime after after main()
returned. The C4Console destructor then goes and deletes all the Qt
resources (QApplication and friends), and that caused a segfault, maybe
because some of the static Qt structures have already been deallocated.

Fix this by making the destruction of the Qt components deterministic. Add
a function "DeleteConsoleWindow" which deletes all the Qt components, and
call this function in C4Console::Clear.
2016-11-26 15:19:56 -08:00
Armin Burgmeier 7a8b01f7d5 Change return type of CreateConsoleWindow to bool
All implementations were just returning `this` anyway, and this makes it
easier to add a corresponding cleanup function.
2016-11-26 15:19:51 -08:00
Sven Eberhardt 5ccc932386 Editor: Disable packed export if no game is loaded 2016-11-22 22:28:19 -05:00
Sven Eberhardt 1cde52e060 Editor: Add "Export packed" file menu item 2016-11-20 22:43:44 -05:00
Sven Eberhardt d77206338c Editor: Fix pre-selection of last file and folder in save as dialogue 2016-11-20 22:43:15 -05:00
Sven Eberhardt 27272aea02 Fix mac build 2016-11-20 13:58:25 -05:00
Sven Eberhardt 04b5f82080 Editor: Add "open in network" to file menu and to new scenario dialogue 2016-11-20 13:24:09 -05:00
Sven Eberhardt 5e2c39da28 Editor: Fix shape edge and vertex properties when used within an enum 2016-11-20 13:15:00 -05:00
Sven Eberhardt e0d741079a Editor: Fix shape drag value updates 2016-11-20 13:15:00 -05:00
Sven Eberhardt 6793455119 Add drag_finished parameter to EditCursorMoved callback 2016-11-20 13:14:59 -05:00
Sven Eberhardt c5623aa7a2 Fix crash on script error in DirectExec scripts 2016-11-20 13:14:57 -05:00
Sven Eberhardt a46ecc7b5b Editor: Invalidate selection if EditCursorMoved()-callback returned true
This allows position-induced shape- or property-changes to be reflected immediately.
2016-11-16 01:11:55 -05:00
Nicolas Hake 34bdab6ba5 Aul: Don't force assertions active
Assertions are great for debugging, but in public builds they just kill
apps dead.
2016-11-13 11:07:22 +01:00
Nicolas Hake eda6cc9c7f Aul: Gracefully handle errors in codegen (#1840)
By continuing to generate bytecode even after an error is found, we're
able to find more syntax errors and will also be able to keep the value
stack at the expected height.
2016-11-13 11:07:21 +01:00
Nicolas Hake ff0325dfac Aul: Always reset the current function when a declaration ends (#1839)
When an error occurred during codegen of a function, the current
function pointer would not be reset to 0, leading to spurious warnings
about redeclaration of functions.
2016-11-13 11:07:01 +01:00
Sven Eberhardt 072e1dcde0 Editor graph delegate: Add update callback functionality for graph edits 2016-11-12 22:20:05 -05:00
Sven Eberhardt 83c1d25b84 Fix editor graph delegate vertex hit radius 2016-11-12 22:20:04 -05:00
Sven Eberhardt 1621e984a9 Editor shapes: Update shape if value changed by script 2016-11-12 22:20:04 -05:00
Sven Eberhardt 91af5a95be Editor graph delegate: Add HorizontalFix, VerticalFix and StructureFix constraints 2016-11-12 22:20:03 -05:00
Lukas Werling 3b2909fa95 Use glUniform*iv for setting script uniforms 2016-11-13 00:17:35 +01:00
Lukas Werling d720e648ce Fix compile error with libstdc++ 2016-11-13 00:13:04 +01:00
Lukas Werling 6847e50e79 Implement setting shader uniforms from script (#1206)
Uniform variables are read from the "Uniforms" proplist set on Scenario
or on individual objects. Proplist keys are uniform names. Values can
either be an int or an array of one to four ints in C4Script. In GLSL,
the uniforms then need a matching type (int/ivec2/ivec3/ivec4). There is
no error reporting; uniforms are only set if both name and type match.

The implementation walks the "Uniforms" proplists on each Draw call. We
may need to cache the uniform maps if this turns out to be too slow.
2016-11-12 22:09:23 +01:00
Lukas Werling b3772e6650 Fix assertions in C4ConsoleQtGraph 2016-11-11 18:00:21 +01:00
Sven Eberhardt bf9c940aa6 Editor graph delegate: Add edge and vertex properties. Remove graph storage options.
The different storage options weren't really needed and would not work with edge and vertex delegates.
2016-11-10 21:43:43 -05:00
Sven Eberhardt e13bd62f94 Editor: Keep current shape list separate from property holders
This prevents shapes from being re-created (and temporary state lost) if the holding property moves within the list.
2016-11-10 21:43:42 -05:00
Sven Eberhardt 1e52ed5a74 Remove unused variable ndx in C4AulParse::Parse_Expression 2016-11-10 21:43:41 -05:00
David Dormagen 8a8593e0ba Script GUI: added TightGridLayout style (requirement of #1842)
The TightGridLayout fills spaces more aggressively. This is slower but makes for a tighter layout. Finding the best layout is NP-complete. This here is just O(N^2) or so.
2016-11-05 15:35:15 +01:00
Julius Michaelis 7aeec3279c Fix 75289da and 55b6713 2016-11-03 13:09:54 +01:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Sven Eberhardt 54e8c14666 Editor: Add graph, polyline and polygon shape delegates 2016-11-02 09:54:31 -04:00
Julius Michaelis 75289dabb5 Always Log chat message 2016-11-01 19:26:38 +01:00
Lukas Werling 9c98227a03 Fix all -Wformat warnings 2016-10-31 23:39:45 +01:00
Sven Eberhardt f17046e1f0 Fix display of rotated meshes with MeshTransformation
Rotation used the wrong (untransformed) coordinates for the rotation center
2016-10-31 10:10:29 -04:00
Nicolas Hake 194e7d709b Aul codegen: Handle errors at codegen time better (#1837)
If a parse error occurs inside a declaration, the codegen should just go
on and deal with the next declaration instead of completely giving up on
the entire script.
2016-10-31 11:17:43 +01:00
Nicolas Hake f0f50ec402 Aul: Don't prepend "ERROR:" to parser error msgs
Further formatting of the error message should be the error handler's
job.
2016-10-31 11:16:14 +01:00
Nicolas Hake 3c13c88f56 Aul: Count errors and warnings properly
9caaf1e introduced an external error handler for easier testing of
error conditions. The default error handler needs to count errors and
warnings if we want to display them, but didn't.
2016-10-31 11:15:19 +01:00
Sven Eberhardt 5c5e1a5fa3 Fix editor selection after object duplication on remote clients
Also remove some remaining EditCursorSelection/EditCursorDeselection callbacks
2016-10-30 22:26:14 -04:00
Kanibal 97c8104ac8 Fix msvc build. 2016-10-30 21:46:29 -04:00
Sven Eberhardt 15fbb1ea99 Fix editor runtime join to use a file at the temporary path 2016-10-30 20:40:40 -04:00
Julius Michaelis 55b6713185 Dedicated server: stop game when there are less than 2 clients 2016-10-30 21:36:29 +01:00