Commit Graph

985 Commits (master)

Author SHA1 Message Date
Sven Eberhardt cf7134e60e Fix a few warnings / possible divisions by zero 2016-10-08 20:51:51 -04:00
Sven Eberhardt 9e150f2bfb Viewport zoom towards center and fix scrolling 2016-10-08 19:15:26 -04:00
Lukas Werling eff406a181 Fix plain --lobby not working 2016-10-06 21:19:31 +02:00
Maikel de Vries 679eedaf50 GetPathLength: add optional depth parameter
This is also exposed by the PathFinder defcore entry.
2016-09-25 21:48:19 +02:00
Lukas Werling f7376169b9 Fix crash when starting a game in fullscreen mode 2016-09-08 21:26:59 +02:00
Sven Eberhardt b95d1387a4 Editor: Add "reset to saved scenario" command 2016-09-07 01:53:54 -04:00
Sven Eberhardt 2c20204021 Add C4SECT_ReinitScenario flag for LoadScenarioSection
This also resets the script engine and does player init callbacks. Useful to restart the scenario in the editor.
2016-09-07 01:53:53 -04:00
Sven Eberhardt d70506ee2e Improve GetDefinitionGroupPath script function
* Now works on _this instead of parameter
* Now works before editor window opened
2016-09-05 18:30:04 -04:00
Sven Eberhardt 41dde5e7d0 Add script function GetDefinitionGroupPath 2016-09-05 02:00:01 -04:00
Sven Eberhardt 6ac3bde3de Fix possible crash in viewport drawing 2016-08-30 18:56:27 -04:00
Sven Eberhardt b763982f45 Fix scenario saving as network client to not delete saved scenario after game end (#1814) 2016-08-28 00:56:15 -04:00
Sven Eberhardt 4869eff787 Allow joining to editor games through startup network dialogue 2016-08-10 19:35:39 -04:00
Lukas Werling ec128bede4 Qt editor: Fix freeze during lobby and loading on Linux 2016-08-08 17:24:44 +02: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 534e4cc745 Merge branch 'master' into qteditor
Conflicts:
	src/script/C4AulParse.cpp
2016-07-24 10:23:57 -04:00
Sven Eberhardt f4ea3359d0 Add InitializePlayers callback after all initial players have joined 2016-07-22 00:13:57 -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
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
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
Lukas Werling fc10992ab7 Fix crash when starting a game in fullscreen mode 2016-06-20 16:55:23 +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
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
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 183ab4c4a0 remove unused function ComposeContents 2016-05-21 13:34:33 +02:00
Günther Brammer c0d32f8f4e Remove redundant target parameters from effect implementation 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 b00b8554ab Merge branch script 2016-04-28 03:25:44 +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 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 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
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 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
Lukas Werling 7005eae55d Use PCG as random number generator 2016-04-20 22:42:00 +02: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
Sven Eberhardt 2a2fc68e3f Qt Editor: Add user properties 2016-04-09 14:29:02 -04:00
Sven Eberhardt 879d501592 Merge remote-tracking branch 'remotes/origin/qteditor' into qteditor
Conflicts:
	src/editor/C4ConsoleQtPropListViewer.cpp
	src/editor/C4ConsoleQtPropListViewer.h
	src/script/C4ValueArray.cpp
2016-04-04 19:34:02 -04:00
Sven Eberhardt 98c36e5955 Qt Editor: Implement setting of properties 2016-04-03 23:46:58 -04:00
Nicolas Hake 9dddf289db Merge branch 'master' into qteditor 2016-04-03 21:06:32 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Nicolas Hake 0537df5f23 C4Object: Move C4Def.h dep out of header
C4Def is only ever used as a pointer inside C4Object.h, so we don't need
to include C4Def.h from it.
2016-04-03 13:24:26 +02:00
Nicolas Hake 735f9cc06b C4Landscape: Pull everything private out of the header
Since LTCG is enabled now, we don't have to define every function inside
the headers for ~xXx super speed xXx~, which means we can strip the
headers down to their bare minimum and reduce interdependencies and
therefore recompilation times by a lot.
2016-04-03 13:24:24 +02:00
Lukas Werling a12e485458 Qt Editor: Add scroll bars to the viewports 2016-03-28 22:07:43 +02:00
Lukas Werling 6d9aef33c2 Merge branch 'qteditor-sdl' into qteditor 2016-03-26 20:57:10 +01:00
Sven Eberhardt f2daa51fa7 Qt Editor: Add "Welcome" dock widget 2016-03-26 01:36:40 -04:00
Maikel de Vries dc1e828cfb add callback OnLineChange when line changes its vertices or vertex positions 2016-03-22 21:53:32 +01:00
Maikel de Vries fc008241cd rename LineBreak callback to OnLineBreak 2016-03-22 18:58:55 +01:00
Lukas Werling eefa8749a8 Fix viewport Zoom getting set to NaN 2016-03-22 16:49:39 +01:00
Lukas Werling 19caa65b7b Merge branch 'sdl-gamecontroller' (pull request GH-17) 2016-03-21 16:39:28 +01:00
Lukas Werling 75f62e52f2 Make Qt editor work with the SDL engine
Viewport rendering doesn't quite work yet, though.
2016-03-20 21:16:52 +01:00
Sven Eberhardt ed0647866e Qt Editor: Add preview for new object placement 2016-03-19 14:40:22 -04:00
Sven Eberhardt 4f70fdbfc8 Qt Editor landscape drawing fixes and improvements. Add brush size preview. 2016-03-18 00:26:14 -04:00
Sven Eberhardt f6ce50e9e7 Qt Editor: Use qt widgets for viewports 2016-03-10 00:07:17 -05:00
Sven Eberhardt 80549ca2cc Qt Editor: Add object creator 2016-03-06 13:06:29 -05:00
Günther Brammer b54ddc7663 Merge branch script 2016-03-01 03:04:17 +01:00
Lukas Werling e52bf6962b Fix gamepads only working after game start
This affected all platforms other than SDL.
2016-02-23 20:20:41 +01:00
Lukas Werling 9e0143b998 Remove gamepad ids from key codes
We want one gamepad key mapping to work with multiple gamepads, so
including the id there doesn't make sense.

Additionally, the gamepad id may change during the game (controller
hot-plugging).
2016-02-21 18:27:02 +01:00
Lukas Werling 9f69c650d6 Use icons for all controller buttons
The icons currently only show Xbox 360 controller labeling. The icon set
also includes icons for PlayStation controllers, so we could extend this
in the future.
2016-02-21 18:27:02 +01:00
Lukas Werling 24622f3a9c Update main menu GUI gamepad control bindings
It is now possible to control all GUI menus using the left stick or the
dpad, along with the A and B buttons on the controller.

This also doubles the button emulation dead zone to make navigating the
menus with the stick easier.
2016-02-21 18:26:44 +01:00
Lukas Werling 24ef8b43af Grab the mouse while in-game (#1637)
This only implements this for the SDL port for now.
2016-02-12 21:09:40 +01:00
David Dormagen 91391c64af draw global particles on plane 900
Previously, global particles would be drawn even in front of Plane 1000+ (GUI) objects. Additionally, it was impossible to specify particles that were supposed to always be in front of all other particles (e.g. fog, clouds, emulated FoW, ...).
Now, you can attach particles to an object on plane 901+ and have them be in front of everything else.
2016-02-09 20:43:23 +01:00
Sven Eberhardt 439b1f481c Register Objects.c script as global constant to make it accessible from outside 2016-02-06 21:12:22 -05:00
Günther Brammer 2fe0beebdb Move contents of src/gamescript into other directories
C4Effect will get moved into the ScriptEngine, and just three source files
is a bit too little for one directory.
2016-02-02 02:57:46 +01:00
Nicolas Hake e9cf0f6fdc Stop pretending we support 16 bit color
The GTK and OS X platforms already ignored the requested bit depth and
always used 32 bit. Windows and SDL would set a 16 bit color depth for
the screen, but still did all of the rendering short of the final
present in 32 bit.
2016-02-02 00:00:23 +01:00
Nicolas Hake 0c3811fe66 Keep rendering while unfocused (#1638)
In windowed mode, we shouldn't stop rendering just because we have lost
focus. However, we don't need to render at full framerate; throttling to
5 fps should be sufficient. Note though that we still have to calculate
game ticks at full speed so network games don't slow down when a player
tabs out of the game.
2016-02-01 20:48:17 +01:00
Günther Brammer 03d11cd596 Merge script branch 2016-01-31 21:51:58 +01:00
Maikel de Vries 4bcdfc451e block construction sites based on Exclusive and not on planes (#1534)
This makes more sense, exclusive object block all other construction sites, irrespective of their planes.
2016-01-30 14:46:14 +01:00
Günther Brammer 9dadfba5af Move GlobalNamed.SetNameList call after Link() into Link()
It isn't clear whether that call is necessary since the C4AulScriptEngine
constructor already does this, but it is clear that duplicating the call
all over is a bad idea.
2016-01-25 00:00:58 +01:00
Günther Brammer 68c436576e Simplify construction of C4AulParSets 2016-01-25 00:00:57 +01:00
Günther Brammer 6b6dd96719 Move GameScript.GRBroadCast to Game.GRBroadCast
This avoids a dependency on ::Objects from C4ScriptHost.
2016-01-24 02:09:14 +01:00
Günther Brammer e1a38ee010 Move references to ::Objects and ::MaterialMap from C4AulLink to C4Game
This changes the order in which the various parts of the engine are updated
after a definition reload, but they should not interfere with each other.
2016-01-24 02:09:14 +01:00
Günther Brammer 93f12150c4 CMake: Remove obsolete USE_X11 option and add USE_WIN32_WINDOWS
USE_WIN32_WINDOWS was previously defined in PlatformAbstraction.h. Move it
to CMakeLists.txt and config.h like its peers. Replace USE_X11 with USE_GTK
or GDK_WINDOWING_X11 as appropriate.
2016-01-23 20:36:34 +01:00
Günther Brammer 11bbeb2a5b Rename WITH_DEVELOPER_MODE to USE_GTK
This mirrors USE_WIN32_WINDOWS, USE_SDL_MAINLOOP and USE_COCOA.
2016-01-23 20:36:33 +01:00
Armin Burgmeier e13cda4bd0 Use an IBO for the particle system
glDrawElements needs an IBO when using a core profile. The particle
system's IBO is actually quite static since it's always a triangle
strip with 2 triangles followed by a PRI. Therefore, this reduces the
amount of data we have to send to the GPU compared to the previous
solution.

Also, remove the workaround when glPrimitiveRestartIndex is not
available since it is always available with OpenGL 3.1 and when using
a core profile we are guaranteed to have OpenGL 3.1 anyway.
2016-01-17 11:37:17 -08:00
Sven Eberhardt 148073a956 Fix black NO_OWNER viewport in network mode. 2016-01-16 16:29:23 -05:00
Sven Eberhardt 4eddeba9aa Fix crash when drawing zero-sized viewports (may happen during editor viewport initialization) 2016-01-15 08:53:00 -05:00
Sven Eberhardt c569036d1d Make NO_OWNER viewports black in fullscreen+non-debug for non-observers #1557 2016-01-10 09:50:21 -05:00
Sven Eberhardt 6ea51e9f7a Fix order of initialization of C4Game/C4GraphicsSystem.
Game.GraphicsSystem could be constructed after Game, but was accessed in C4Game::Default.
2016-01-07 23:42:18 -04:00
Günther Brammer 16ef28e05f Drop unused C4VERSIONBUILDNAME and C4ENGINEINFO
This was used to name snapshot releases of the Network2 branch, and has
seen almost no use since.

C4ENGINEINFO(LONG) was a duplicate of C4ENGINENAME and C4ENGINECAPTION.
2015-12-29 15:47:55 +01:00
Nicolas Hake ddd068c830 C4Viewport: Turn some owned pointers into std::unique_ptr 2015-12-28 21:45:14 +01:00
Nicolas Hake 3590dda85a C4Viewport: Merge ctor/Default, dtor/Clear 2015-12-28 21:43:03 +01:00
Nicolas Hake d737dc1b05 Remove C4Video, StdVideo
Video recording and playback only worked on Windows, and recording only
handled video, not game audio. As such, it was of fairly limited use,
and there's lots of software available these days that handle both.
2015-12-28 11:43:41 +01:00
Nicolas Hake 7475b89bd2 C4MessageBoard: Merge Default/Clear into ctor/dtor 2015-12-28 11:43:40 +01:00
Nicolas Hake fc1189dfe4 C4UpperBoard: Remove empty Default/Clear 2015-12-28 11:43:38 +01:00
Nicolas Hake d65af91694 C4GraphicsSystem: Remove unused function 2015-12-28 11:43:37 +01:00
Nicolas Hake 3c625a00dd C4Game: Turn some owned pointers into std::unique_ptr
Using std::unique_ptr instead of raw pointers makes ownership clear and
avoids leaks.
2015-12-28 11:43:37 +01:00
Nicolas Hake d063e02a3c C4FullScreen: Remove several unimplemented function declarations 2015-12-27 16:49:41 +01:00
Nicolas Hake 4980572c79 C4Game: Remove several unimplemented function declarations 2015-12-27 16:49:41 +01:00
Nicolas Hake 33e2626649 Win32: Stop trying to steal focus from other apps
If the user switched away from OC while it was loading, there was
probably a reason for that. We'll no longer assume we're the most
important app in the world and steal the focus away from whatever the
user was doing.
2015-12-27 13:22:18 +01:00
Nicolas Hake f0eeb3f6b3 Make headless build compile again 2015-12-15 19:45:32 +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