Commit Graph

3365 Commits (b7cffa5e82d70aec265830dff5102f45d1990424)

Author SHA1 Message Date
Nicolas Hake f0eeb3f6b3 Make headless build compile again 2015-12-15 19:45:32 +01:00
Sven Eberhardt e0bcaf8d7d Sound UI::Confirmed (instead of Objects::Connect) 2015-12-15 01:41:25 -05:00
Sven Eberhardt 1d7c5c00c8 Add some missing UI sounds.
Still missing UI::Error.
2015-12-15 00:25:44 -05: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
Nicolas Hake 72002cc366 Kill netpuncher
Another piece of code that hasn't been tested in ages, gone. The default
puncher address was still pointing to clonk.de, which I'm very certain
isn't providing UDP hole punching services anymore.

Instead of a bespoke hole punching implementation we should use a STUN
lib.
2015-12-13 16:11:08 +01:00
Sven Eberhardt 3174d0b156 Remove WindLoop sound from engine.
It was almost never appropriate (played underground etc.), could not be turned off and was very repetitive. Mountain scenarios with lots of wind may activate the sound.
2015-12-13 01:22:00 -05:00
Sven Eberhardt 42a0c5d188 Increase wealth cap to ONE BILLION!!!
It makes sense to have a cap because of integer overflow, but it was set very low. Increase it to the largest round number below MAX_INT.
2015-12-12 15:52:22 -05:00
Sven Eberhardt 499959fa14 Fix team distribution of savegame resume and initial script players #1494 2015-12-12 14:09:42 -05:00
Sven Eberhardt 171080cbd5 Play frontend music by tag. 2015-12-12 12:08:45 -05:00
David Dormagen fa10a214b5 replaced two missing sounds
..which were easy to find due to the new missing-sound-warning. Hah!
We have cool wind now.
2015-12-10 19:36:54 +01:00
David Dormagen 35fe8f8683 sound system: warn about missing sounds (in debug mode only) 2015-12-10 19:35:55 +01:00
Sven Eberhardt 1cf188bb45 Fix music system running into infinite pause after playlist changes #1460 #1485
A playlist change would reset SCounter and eventually cause all songs to be non-eligable.

Since playlists can now select differently sized subsets, the old way of selecting random songs without too much repetition no longer works. Rewrite to use a more robust algorithm.
2015-12-10 00:31:20 -05:00
Sven Eberhardt afac3a4572 Fix music system debug message unit for pause length. 2015-12-08 23:42:08 -05:00
Sven Eberhardt d736b613b3 Keep and compile Objects.c file in savegames #1077
Just don't call the InitializeObjects() function. But the file should be left there because it may contain static variables required in scripts.
2015-12-08 22:22:52 -05:00
Nicolas Hake 617a0828fb Aul: Throw exceptions by value, not by pointer
Throwing values instead of pointers simplifies memory management at the
catch site.
2015-12-08 13:17:40 +01:00
Nicolas Hake 96fcf1389a Aul: Make engine not automatically log error summary
Getting the error summary written to the log/console automatically may
be useful for general game usage, but when testing Aul we just end up
with thousands of useless messages in the output. Let the caller log the
message if it's really desired.
2015-12-08 13:17:39 +01:00
Nicolas Hake c5440b1d86 C4NameList: Remove unused Read and Write functions 2015-12-08 13:17:36 +01:00
Sven Eberhardt 310daf8b3f Fix static const arrays (#906) 2015-12-07 23:38:40 -05:00
Sven Eberhardt ad2de2e012 Do not interpret all .ocg files in definitions and scenarios as sound subgroups. 2015-12-07 00:11:29 -05:00
Sven Eberhardt 7f6c13084a Register definition-local sounds into definition namespace (id::Soundname) #1185.
Also move all object sounds to global Sound.ocg so they are still played.

This is to prevent naming collisions. All sounds are moved because otherwise all scripts would have to be adjusted. Also, the distinction between sounds in definitions and sounds in Sound.ocg was rather arbitrary.

It will also ensure most sounds are reloaded when sound is turned off temporarily, although that should better be fixed properly.
2015-12-07 00:08:24 -05:00
Sven Eberhardt 96082569bd Allow sounds in subfolders and create namespaces for them (#1185) 2015-12-06 23:44:41 -05:00
Sven Eberhardt 8b2dd0a8bb Win32: Fix "beep" on handled hotkeys (Alt+[key]) in fullscreen mode #1488 2015-12-06 22:32:47 -05:00
Sven Eberhardt 019cc0d583 Enable immediate tooltips on mouse-over-event for unlabeled icons in lobby and scenario selection (#1132). 2015-12-06 21:03:54 -05:00
Sven Eberhardt d48f590dfb Fix conversion buffer access for DrawMaterialQuad with DMQ_Bridge (#1478). 2015-12-05 14:41:56 -05:00
Sven Eberhardt d758c85028 Add max memory time to music resume feature (#1461) 2015-12-03 19:17:41 -05:00
Sven Eberhardt cbb7b0ba2c Log music system info if Config.Sound.Verbose is enabled. 2015-12-02 23:08:50 -05:00
Sven Eberhardt cc12230d56 Add "immediate" parameter to SetPlrView and ResetCursorView script functions to force viewport scroll position to the target. 2015-12-02 22:11:28 -05:00
Sven Eberhardt 3fdf7142b5 Fix custom viewport zoom initialization done in InitilizePlayer in fullscreen mode. 2015-12-02 21:24:57 -05:00
Sven Eberhardt 46a7d653d8 Fix two typos in comments. 2015-12-02 20:27:39 -05:00
Sven Eberhardt 8c3e61c3da Fix NO_OWNER global sound modifier on savegame resume (#1462) 2015-12-02 20:27:38 -05:00
Nicolas Hake 812e40f0d0 Denumerate sound modifier values after player reload (#1462)
Deserializing players neglected to turn an enumerated proplist back into
a live one. This would explode later during player initialization when
someone didn't check that the deserialized value was a real, live
proplist.
2015-12-02 16:55:04 +01:00
Nicolas Hake 871811eac8 Move some private shape calculating functions out of C4Landscape
None of these functions require access to any state of C4Landscape, and
they've only been used from within C4Landscape.cpp, so don't need to be
part of the header.
2015-12-02 01:48:13 +01:00
Nicolas Hake e8a90e7d23 Temporarily remove solid masks before clearing landscape (#1472)
When clearing parts of the landscape, solid masks must be disabled
beforehand because we don't want to remove the actual solid mask itself.
Theoretically we should also temp remove solid masks before DigFree,
ShakeFree, and all of the other landscape modifiers, just in case
someone overrides the Vehicle material with stupid values.
2015-12-02 01:41:47 +01:00
Nicolas Hake 6738ef1f4c Clear object pointers in inactive objects (#1238, #1452)
Instead of iterating through the main object list twice to check for
pointers, iterate through both the main list and the inactive list.
2015-12-01 23:46:46 +01:00
Nicolas Hake eb22e357b1 Win32: Prevent Alt key presses from opening the system menu (#1468)
Pressing the Alt key enters the menu modal loop, which takes control of
the thread that everything happens on. As a quick fix, we'll suppress
this loop for simple Alt key presses, but this will still happen when
the system menu gets opened by Alt+Space or clicking the icon in the
window's title bar.

A more permanent solution would be to detach the message loop from
everything else, by having rendering etc. run in a separate background
thread.
2015-11-30 21:33:36 +01:00
Nicolas Hake f6efb9d219 Landscape renderer: make sure pixel accesses are within bounds
The landscape renderer didn't check that the material pixel it was
getting placement information about wasn't outside the left landscape
border.
2015-11-22 13:38:12 +01:00
Sven Eberhardt 6e4c7a2c2d Lobby ready button: Prevent message spam, improve icon updating and some small fixes.
* Show max one message per second per client
* Do not show ready message locally
* Fix observer flag reset by ready state change
* Reflect ready state change in client list immediately
2015-11-21 23:58:40 -05:00
Sven Eberhardt 7f827d4b15 Add optional debug logging for shape texture loading.
Set Config.Developer.DebugShapeTextures to 1 for testing.
2015-11-20 20:35:05 -05:00
dylanstrategie d284f49b6b Add "ready" button for clients in game lobby.
Signed-off-by: Sven Eberhardt <sven2@goldwipf.de>
2015-11-18 22:49:59 -05:00
Nicolas Hake 0067a6dbfe Drop several unused string manipulation functions
To wit: SCompare, SCopyPrecedingIdentifier, SCopyNamedSegment,
SSearchIdentifier, SSearchFunction and SRemoveComments.
2015-11-15 16:16:36 +01:00
Nicolas Hake a3b7b66386 Drop "Toggle" helper function
Toggling a boolean is trivial enough to not really warrant a helper
function.
2015-11-15 16:15:25 +01:00
Nicolas Hake 24b54211c5 Drop Min, Max, Swap for std::min, std::max, std::swap
The C++ standard library comes with perfectly fine implementations of
these functions, so there's no point in reimplementing them just for the
hell of it.
2015-11-15 13:53:01 +01:00
Nicolas Hake 8fc57b69c3 Don't ZeroMem non-POD types
Using memset to initialize non-POD types doesn't work. Or rather, it may
work right now, but will fail when somebody adds a member that relies on
its constructor doing something (like for example any STL container).
Either way it's undefined behavior and needs to go. Furthermore, using
it to reinitialize an object also prevents any dtors from doing their
work when needed.

A new helper function InplaceReconstruct will take an object of nothrow-
default-constructible type, and call the dtor to properly clean up
before placement-new reconstructing the object in the same location.
This is still bad design, but unfortunately removing the Default/Clear
functions from every object currently using them is a herculean task.
2015-11-14 16:43:19 +01:00
Nicolas Hake 1bc2d41368 C4Group: Remove unused time offset
Four years ago, we made c4group stop caring about time. Now it doesn't
need to carry a completely unused offset value around anymore.
2015-11-14 16:19:58 +01:00
Nicolas Hake 715d3f34dd Remove obsolete declaration of C4Group_SetOriginal
This function hasn't existed for five years. It's time for the
declaration to go away.
2015-11-14 16:19:58 +01:00
Armin Burgmeier 6af3e4e639 Fix one-pixel edge at bottom or right of landscape (#771)
The problem comes from the fact that the landscape texture can be larger
than the actual landscape, and that for the last row or column of pixels
drawn at the edge of the landscape, the shader might access a texel that's
beyond the landscape boundaries, at least as part of its interpolation
when accessing a texture.

This patch fixes this by always making the landscape surface the same size
as the landscape, and then GL_CLAMP_TO_EDGE behaviour will prevent access to
pixels beyond the edge of the landscape. Modern hardware should handle
NPOT textures just fine, and they are already used in other places in Clonk.

If this becomes a problem and needs to be reverted, we could instead upload
the "real" landscape size to the shader, and clamp the texture coordinates
there to make sure to not read beyond the actually filled landscape surface.
2015-11-13 15:05:26 -08:00
Armin Burgmeier 4d36f43025 gtk editor: keep scroll position when updating property dialog (#566)
This is still not quite optimal since we need to wait for line validation.
There does not seem to be a way to trigger immediate validation.
2015-11-12 16:04:28 -08:00
Peter Wortmann b2150234d0 Smoother material border calculation
Before, material normal bias was calculated only from a column/row of pixels right
next to the pixel in question. This sometimes led to "lines" appearing in edge cases.
The new code modified this approach to look at a whole rectangle instead, which
gives a *lot* smoother results and is only marginally more expensive.
2015-11-12 22:18:53 +00:00
David Dormagen f701dfd703 UpdateOCF: also update OCF_Inflammable, which can be manipulated by scripts
Previously, changing the ContactIncinerate property in a script would trigger an assertion in a debug build.
2015-11-10 19:13:52 +01:00
David Dormagen 8af7897c52 fixed wrong mouse cursor offset in developers mode (#646)
Steps: open player menu (F), hover over entries -> mouse cursor was drawn at a wrong position.
2015-11-09 10:48:34 +01:00
Sven Eberhardt cf6f66469c Pass last dead clonk as parameter to global RelaunchPlayer callback. 2015-11-08 17:15:34 -05:00
Armin Burgmeier 236759b1db Don't update relights array while relighting (#1371)
Removing solidmasks temporarily as part of the relighting procedure caused
a landscape update which modified the list of to-be-relighted regions that
is currently being iterated over. This could cause relighting of a region in
which solidmasks have not been removed, leading to vehicle pixels in the
landscape surface used by the landscape shader, which show up pink on the
screen.

Fixed this by introducing C4Landscape::_SetPix2Tmp, which changes a pixel
without causing relighting (or material count updates), and use that when
temporarily removing or putting solidmasks. This should also avoid unnecessary
computations (relighting, material count updates) when updating the landscape
or moving objects with solidmasks.
2015-11-08 13:48:19 -08:00
David Dormagen a1cefd2681 reduced volume of default splashing sound
Which was much louder than other sounds and felt a bit weird.
2015-11-05 20:49:57 +01:00
Armin Burgmeier 12ae83cfe4 Re-initialize shaders after changing anti-alias setting (#1286) 2015-10-31 21:12:45 -06:00
David Dormagen 4d85c8ffc9 fixed deleting objects at the bottom of the map (#1435)
Instead of Y - Hgt > LandscapeHeight (or, equivalently, Y > LandscapeHeight + Hgt), it was checked for Y + Hgt > LandscapeHeight, which would remove objects too early.
2015-10-26 19:05:59 +01:00
Julius Michaelis f356c9053a Invert the functionality of CNAT_CollideHalfVehicle 2015-10-21 22:15:33 +02:00
Tupone Alfredo 67558a8511 Build with jpeg-9
Gentoo bug #520884 by flameeyes@gentoo.org
2015-10-21 11:55:20 +02:00
Armin Burgmeier bbdec40075 Fix a free/delete/g_free mismatch 2015-10-18 14:45:52 -04:00
Armin Burgmeier ef4ea2d931 Drop support for GTK+ 2
The minimum GTK version is now GTK+ 3.4, which is available since 2012.
It's part of Ubuntu LTS 12.04, and so should be available on any halfway
modern linux distribution.

This should allow getting rid of using deprecated GTK+ API much easier.
2015-10-18 14:45:52 -04:00
Sven Eberhardt 2a54409384 Fix PXS movement on moving SolidMasks (#862). 2015-10-17 22:26:34 -04:00
Armin Burgmeier 4addc62467 Open Graphics.ocg before reloading a definition (#1428)
We might need to load shader slices when reloading mesh materials.
2015-10-17 19:05:23 -04:00
Armin Burgmeier 70fd6d20bf Keep parallax objects fixed on full map screenshots (#1042) 2015-10-17 17:38:50 -04:00
Armin Burgmeier 10249d9a87 mape: fix another free/g_free mismatch 2015-10-17 13:20:19 -04:00
Armin Burgmeier ac2be1866f mape: fix an uninitialized variable in mape_disk_view_load_materials 2015-10-17 13:14:36 -04:00
Armin Burgmeier 84015e5eef mape: fix a free/g_free mismatch 2015-10-17 13:12:23 -04:00
Peter Wortmann f0561cc150 Generate sensible normals for textures with them
Using (0,0,0) violates normalisation assumptions, which shifts the weight
between landscape and texture normals quite massively. The new normal
code should represent a "flat" texture properly.
2015-10-17 09:30:36 +01:00
Sven Eberhardt b060874732 C4MapScriptMatTexMask: Rename fg_mask and bg_mask to sky_mask and tunnel_mask.
This gets closer to what they are representing.

More precise would be fg_mask_if_bg_is_sky and fg_mask_of_bg_is_not_sky. But fg_mask and bg_mask were terribly misleading, because sky background didn't mean the material was "in front".
2015-10-16 00:24:15 -04:00
Sven Eberhardt fe05fb5b1a Fix loading of shape textures from packed groups (#1421). 2015-10-15 20:29:56 -04:00
David Dormagen 4556fbe011 documented GetPlayerControlState 2015-10-15 18:05:21 +02:00
David Dormagen a6d11d67f5 custom GUI: grid layout now checks remaining row length before adding another element
Previously it was checked after adding an element. Long elements would thus be in the same row as the other elements even if they wouldn't fit. Not long elements get their own row.
2015-10-13 07:35:04 +02:00
Nicolas Hake 9f03209ed7 Stop checking for nullptr
We're already requiring the compiler to implement C++11, so checking for
nullptr support again is useless.
2015-10-12 17:34:28 +02:00
Nicolas Hake 0c1abe69f9 Get rid of FMOD
Not only is FMOD neither free (libre) nor free (gratis), the version we
support(ed) is also impossible to legally obtain anymore. So there's no
reason we should keep code around that (pretends to) support a library
nobody can use or test.
2015-10-12 17:34:26 +02:00
Sven Eberhardt 2a31fe72f8 Initialize new player viewports with proper zoom and zoom limits (#1419). 2015-10-10 21:47:09 -04:00
Sven Eberhardt f49dc93d44 Fix full map screenshot saving.
It was partly overwritten by a regular screenshot being saved in parallel.
2015-10-09 23:06:02 -04:00
Armin Burgmeier d28913a1cb Optimize loading of ogg files
Try to load the whole data in one go instead of re-allocating a vector every
8K bytes. This otherwise results in a lot of reallocations for O(MB)
(uncompressed) sound data.

This speeds up engine initialization by about a second for me.
2015-10-09 18:43:10 -04:00
Armin Burgmeier 63bff7914e Fix the mape build 2015-10-09 18:43:02 -04:00
Sven Eberhardt d136dc22c0 Implement landscape inflammation.
It used to create the non-existent FLAM objects from the engine. Use a script callback to a global function that creates Flame objects instead.
2015-10-09 16:24:16 -04:00
Sven Eberhardt cb25282350 Fix mape again. 2015-10-09 14:55:43 -04:00
Sven Eberhardt 675db52e38 Texture shape coverage fix and mape build fix. 2015-10-09 14:49:31 -04:00
Sven Eberhardt a81249438a Win32 editor: Fix selection of textures with names included in other texture names (e.g. rock and rock_smooth). 2015-10-09 00:51:07 -04:00
Sven Eberhardt 47e422f452 Rework and document texture shapes.
* Renamed from material shapes to textures shapes
* No per-texture, so the same material can use different shapes with different textures
* Load a shape image instead of text file with vector components
* Allow texture sizes that are not multiple of the map zoom
* Add minimum overlap parameter to draw shapes only when the given overlap is reached.
2015-10-09 00:16:24 -04:00
Sven Eberhardt cc5d43d0b0 Localize loading message for scenario local player control definitions. 2015-10-05 22:38:45 -04:00
Peter Wortmann 1ce2f8fe77 Warning fix 2015-10-04 14:26:00 +01:00
Peter Wortmann 86679d2fb0 Allow all shaders to refresh
The solution is slightly hacky and not entirely stable, but for fine-
tuning this functionality is essential.

While I was at it, also reduced refresh interval so it doesn't have a
chance to lag the game.
2015-10-04 14:25:56 +01:00
Peter Wortmann beef0369e7 Fix OC_SKY definition
Lost in the merge...
2015-10-04 14:24:49 +01:00
Sven Eberhardt f5a0ff3d8f Script GUI: Process double click as second single click. 2015-10-03 22:43:06 -04:00
Sven Eberhardt 7725a379c2 Fix display of player-colored charts (/chart). 2015-10-03 21:37:41 -04:00
Armin Burgmeier fb68624686 Try to compile vertex shader before trying work-around (#1368)
It looks like sometimes graphics drivers don't report the correct number for
maximum uniforms, since the workaround was enabled even though Newton
confirmed disabling the workaround worked just fine on his GPU. Therefore,
don't listen to what the graphics driver is saying but just try to compile the
shader, and fall back to the workaround if the compilation fails.
2015-10-03 14:45:54 -04:00
Armin Burgmeier b8ed577c0f Rotate the OGRE coordinate frame by 90 degrees in X
Also rotate all meshes backwards so that everything keeps working. This should
make it more convenient for modellers to create new meshes.
See http://forum.openclonk.org/topic_show.pl?pid=29410#pid29410.
2015-10-03 11:39:08 -04:00
Armin Burgmeier 745683c860 Small shader preprocessor fixes 2015-10-03 11:18:47 -04:00
Peter Wortmann df6d564d2d Remove "ColorAnimation"
Not used any more
2015-10-03 15:32:39 +01:00
Peter Wortmann cf4ed1b0b7 Shiny materials, shader reorganisation
This implements the proposal made in the forum for "shiny" materials -
material can now determine the angle at which the most light is reflected.
Shiny materials might set this lower to approximate a "reflection" effect,
and increase the "spottiness" at the same time. To compensate for the
lack of brightness without light, "emittance" can be used.

Not sure this is the most elegant way to model this - the "proper" way
here would be to have emittance, shading and specular as three separate
light parameters instead of molding one into the other and using the third
to compensate.

Furthermore, this reorganises shaders in a major way: We reduce the
number of shader files down to three, pushing a number of possible
configurations into preprocessor. I believe this should be easier to
understand, which for the moment trumps theoretical extensibility
benefits.
2015-10-03 15:32:39 +01:00
Peter Wortmann f0030e33e0 Warning fixes
Actually pretty sure a few of them were bugs. Hopefully no new
ones were introduced here.
2015-10-03 15:32:39 +01:00
Julius Michaelis 2ad045f8d6 Replace strtod with stringstreams in C4ScriptGuiWindow::SetPositionStringProperties to avoid locale problems (second attempt)
Also added warnings and fixed a few whitespacing errors.
2015-10-03 13:17:17 +02:00
Sven Eberhardt 5b47a26d30 Perform DugOut callback also on non-collectibles and on objects not created through Dig2Object mechanism. 2015-10-01 22:43:01 -04:00
Nicolas Hake c8e1a38950 Revert "Replace strtod with strtof_l ..."
This reverts commit 139dee9874.

The commit introduced a memory leak on glibc, and broke the build on all
other platforms.
2015-10-01 20:50:40 +02:00
Julius Michaelis 139dee9874 Replace strtod with strtof_l in C4ScriptGuiWindow::SetPositionStringProperties to avoid locale problems
(That function could still use some more love, though: Error messages and not accepting ridiculous things when parsing.)
2015-10-01 19:50:05 +02:00
Sven Eberhardt b5fe6ea02a Fix mac build. 2015-10-01 00:22:43 -04:00
Sven Eberhardt 3d7d848eea When fading from running songs, fade out and then start new songs directly instead of fading into them.
For songs that start abruptly, fading into them often ruins the beginning.
2015-10-01 00:08:35 -04:00
Sven Eberhardt 17e0e2f423 Add breaks between music. 2015-09-30 22:50:18 -04:00
Julius Michaelis 9a7d57c0d2 Fix assertion firing in C4ConsoleGUI::SetInputFunctions introduced by 9e771ac 2015-09-30 14:35:50 +02:00
Sven Eberhardt fc7d16b2aa Fix mac build (I hope). 2015-09-29 21:31:13 -04:00
Sven Eberhardt 737b1fd8fd Save screenshots in background thread (#998, #1104).
Also ensure music keeps streaming while collecting data for full map screenshot.
2015-09-29 20:48:34 -04:00
Sven Eberhardt 3159793dfc MSVC build fix 2015-09-29 20:38:15 -04:00
Julius Michaelis ee859d85e0 Remove boost any usage of boost libraries 2015-09-30 00:16:12 +02:00
David Dormagen 6756db2768 C4ScriptGuiWindow: fix copyright header
The remaining old header has now been adjusted to the new one.
See e0dc30c59a for details.
2015-09-29 19:13:12 +02:00
Sven Eberhardt 8614ce46c4 Create default ambience controller in all scenarios.
Can be overloaded by providing a custom function InitializeAmbience either globally or in the Scenario proplist.
2015-09-28 20:20:31 -04:00
Sven Eberhardt 59d7c761fc Screenshot fixes and optimizations.
* There was an off-by-one-error causing a blank line at the screen upper screen border.
* Remove ApplyGamma. It is always applied because Gamma is just part of the drawing shaders now.
* Save by copying rows instead of pixels for whole map screenshots.
2015-09-28 18:54:34 -04:00
Sven Eberhardt edf66783aa Announce the name of each music piece only once. 2015-09-28 16:29:36 -04:00
Sven Eberhardt d6f16a0890 Change music switch due to playlist change to prefer to resume pieces that were recently played. 2015-09-28 16:29:36 -04:00
Sven Eberhardt 3f6cacade4 Add parameters to Music and SetPlayList to resume a piece from where it was last interrupted. 2015-09-27 20:58:37 -04:00
Sven Eberhardt 9e771acfd1 Editor: Add most recently entered script lines to dropdown list.
This also enables easier auto-completion via arrow-down.
2015-09-27 15:28:17 -04:00
Sven Eberhardt d3ee2fac57 Fix sorting of script and engine functions in dropdown menu in editor. 2015-09-26 20:10:55 -04:00
David Dormagen 439cfac129 custom GUIs: do not break text when style flag NoCrop is set and set NoCrop for HP display 2015-09-25 15:01:24 +02:00
Sven Eberhardt 7fc7790257 Fix object drawing clipping at left and top screen border for models with action but without action facet set. 2015-09-25 00:51:36 -04:00
Sven Eberhardt 88167a03a8 Add support for hidden scenarios.
If C4S.Head.Secret is set and mission access to the scenario has not been gained, it is hidden in the scenario selection list.
2015-09-24 23:51:16 -04:00
Sven Eberhardt 15336a7ea8 Allow scenario saving onto same file when launched from an unpacked folder. 2015-09-24 22:36:45 -04:00
Julius Michaelis d57a8fd62c Fix two small memleaks 2015-09-24 14:35:50 +02:00
Sven Eberhardt 9d5d8f7506 Fix control mode display and availability in lobby. 2015-09-23 21:48:37 -04:00
Sven Eberhardt 5b19294d76 Use ANY_OWNER instead of INT_MAX to label GUI elements shown to everyone.
Mostly to make the code more readable because there's no way to know that INT_MAX means "anyone".
2015-09-23 18:08:44 -04:00
David Dormagen f4f9afa477 custom guis: for the Player property, distinguish between NO_OWNER and nil
NO_OWNER means the message will be visible for noone (can f.e. be used to hide a ui window). nil means the message won't have visibility restrictions. This is probably what the scripter expects.
Previously, a value of "nil" would have been read as 0. So not setting the Player property and setting it to nil would mean two different things.
2015-09-23 22:03:29 +02:00
Sven Eberhardt 1f46a9004c Fix some erroneous file orders causing group rewinds. 2015-09-22 23:47:06 -04:00
Sven Eberhardt 28fab953f5 Do not try to load a definition directly from within .ocf and .ocs folders.
Definitions should be only in .ocd files. Although it might be nice e.g. to have mesh material directly in the scenario instead of in a .ocd subfolder, the engine tried to load the map image files as potential textures. It was also undocumented behavior.
2015-09-22 23:46:26 -04:00
Sven Eberhardt 08f4d29d02 Fix memory leak by editor preview surface (#1405). 2015-09-22 22:54:16 -04:00
Armin Burgmeier b750ac6537 Remove outdated comment 2015-09-22 22:28:38 -04:00
Armin Burgmeier f4a87d5d2f Fix image aspect of meshes embedded in messages (#1380) 2015-09-22 22:26:12 -04:00
Armin Burgmeier 703f028392 Fix animation when position is beyond last keyframe (#1406)
In this case, an interpolation between the last and the first keyframe is
performed, so that the animation can be looped smoothly.
2015-09-22 22:11:55 -04:00
Julius Michaelis 6755a11c39 Fix dedicated server build 2015-09-22 16:43:05 +02:00
Nicolas Hake 6a11e3e811 Stop checking for rvalue ref support
We already require support for std::unique_ptr, which itself requires
support for rvalue references. As such, we know we can use rvalue
references, and thus don't have to keep carrying dead code around.
2015-09-20 13:27:14 +02:00
Nicolas Hake d1313f622f Drop hack that allowed taking a reference to a temporary value
This has never been legal C++, and the compilers where it was necessary
are no longer supported.
2015-09-20 13:27:13 +02:00
Sven Eberhardt 26dff21b8a Fix tool picker on materials with sky background.
It selected an invalid texture before.
2015-09-19 22:37:45 -04:00
Sven Eberhardt 95da770892 Move GetDefWidth and GetDefHeight script functions to engine.
They started to appear in script profiler runs and the GetDefVal-implementation is very inefficient.
2015-09-19 21:22:55 -04:00
Armin Burgmeier 653680b296 Revert "Add Scale parameter in materials"
This reverts commit 8ef1f908cc. This seems to be
a performance bottleneck on some graphics cards and/or drivers. Clonkonaut
reports issues with a Radeon HD 7800.

This feature is not vital since textures can always be drawn such that they
tile properly at 512x512. While that particular problem with the Radeon card
could probably be worked around, it's just not worth it.
2015-09-19 17:26:46 -04:00
Sven Eberhardt 4020769e23 Don't delete objects with partial shape still in viewport (#1404).
This will allow better graphics for the clouds movement when wrapping the landscape.

There is some potential for weird behavior; e.g. objects hidden just out of view outside the landscape. But we don't have any goals like Clonk Rage gold mine where you would have to find that nugget lying hidden in that place. Besides, the current behavior of just removing stuff even though it was just halfway out is worse.
2015-09-19 17:22:43 -04:00
Sven Eberhardt 3f100cffb0 Fix possible sync loss on seasonal temperature change. 2015-09-19 13:37:51 -04:00
Armin Burgmeier 6d226e30ed mape: fix memory corruption when setting filename (#1256) 2015-09-19 11:39:20 -04:00
Armin Burgmeier 8ef1f908cc Add Scale parameter in materials
This allows to scale textures up or down from their initial size, allowing
them to tile at intervals other than 512x512.
2015-09-19 10:48:28 -04:00
Sven Eberhardt e4eedf3c45 Unify directory separators of filenames given on command line (#1066) 2015-09-19 00:06:42 -04:00
Armin Burgmeier fd285f6656 Create mipmaps only for static textures that are expected to be zoomed
Hopefully fixes #1403.
2015-09-18 21:10:39 -04:00
Sven Eberhardt bdad81d2d1 Show "gl: Create context" messages on first context only.
They would clutter the log whenever you switched tools, created viewports, etc.
2015-09-18 09:50:06 -04:00
Nicolas Hake ab4f1d7258 Win32: Update crash handler for MSVC 2015 2015-09-18 15:02:33 +02:00
Nicolas Hake a11135e4ac Win32: Properly clean up tools dialog after use (#1377)
When switching dialogs in editor mode, the (paint) tools dialog wouldn't
be properly cleared, instead only destroying the dialog window. Thus,
the next time it would be used, it'd try painting onto a device context
which did no longer correspond to any existing window, which made OpenGL
sad.
2015-09-18 15:02:31 +02:00
Nicolas Hake 51eb389739 Win32: Actually delete all of the landscape dlg bitmaps on close
We used to leak a bunch of HBITMAPs when the langscape tools dialog
closed, because for some reason we only destroyed a few instead of all.
2015-09-18 15:02:30 +02:00
Sven Eberhardt 9f4391ff0a Fix ModeBack initialization on editor startup.
It would be set by state and then immediately reset in Default(). This had the effect that if you used the color picker on sky before ever selecting a background material, the wrong background would be used.
2015-09-17 22:25:46 -04:00
Armin Burgmeier c3b491ad6c Enable mipmapping for sprites
This should improve the appearance of sprite graphics when zoomed out.
2015-09-17 20:09:21 -04:00
Armin Burgmeier 5107e23905 Select sane defaults for background material and texture in editor (#1402) 2015-09-17 20:03:53 -04:00
Armin Burgmeier 5d2e36149b Don't warn if a smaller material texture is perfectly tileable 2015-09-17 18:55:41 -04:00
Sven Eberhardt aac23e6bc7 Fix landscape renderer and ambience level on savegame resume (#1400). 2015-09-16 22:11:39 -04:00
Armin Burgmeier c28c63ce0d Remove some now unused code in C4LandscapeRender.cpp 2015-09-16 22:01:51 -04:00
Armin Burgmeier 790219ac7e Replace 3D texture in landscape shader by a 2D texture array
A texture array is conceptionally what should be used in this case. One
advantage of this is that we don't have to generate mipmaps ourselves but can
let the graphics driver take care of it. Same for selection of the mipmap
level. This would even allow to choose different mipmap levels for different
textures.

This is a somewhat experimental change since it makes OpenGL 3.0 a hard
requirement for OpenClonk. I expect that this is fine, but if this causes
failures during landscape creation on common hardware/drivers we should
revisit.
2015-09-16 21:45:30 -04:00
Armin Burgmeier 061305c0c7 Don't enable textures in C4ShaderCall::AllocTexUnit
This was only necessary with the fixed function pipeline, but not when
using shaders.
2015-09-16 21:45:30 -04:00
Sven Eberhardt b683e47499 Add LightOffset property to allow light sources to origin from locations other than the object center. 2015-09-16 21:14:08 -04:00
Sven Eberhardt 5b539a5b34 Fix manipulation of multiple objects in editor.
It would only do work on the last (and possibly random objects because initialized memory was accessed).
2015-09-15 21:29:26 -04:00
Armin Burgmeier 3eb6b277e4 Buildfix 2015-09-15 18:25:13 -04:00
Sven Eberhardt cc0a139ff9 Fix landscape reinitialization on saved section load (#1379). 2015-09-15 00:13:45 -04:00
Sven Eberhardt 73a42fef92 Suppress warning messages for undefined fields when returning to main section in LoadScenarioSection. 2015-09-14 23:01:09 -04:00
Sven Eberhardt 3ff1bbf5f6 Fix /todo fallback on write error. 2015-09-14 21:39:51 -04:00
Armin Burgmeier 9197acbb62 Generate mipmaps by default, and use them for mesh textures 2015-09-14 20:36:08 -04:00
Armin Burgmeier f54067c819 DetachMesh: remove mesh from direct parent, not from top-level parent
This fixes a crash in calls to DetachMesh() on nested attached meshes.
2015-09-13 16:46:27 -04:00
Armin Burgmeier 77ad9c89b5 Fix parameter order when calling StdMeshInstance::AttachMesh in FnAttachMesh
I don't like default parameters.
2015-09-13 16:46:27 -04:00
Armin Burgmeier dc38e61139 Fix rendering of colorfade (non-bitmap) sky 2015-09-13 16:46:27 -04:00
Sven Eberhardt 34a4586a16 Reduce default music volume.
The music is beautiful but it's louder than all the other sounds somehow.
2015-09-13 00:34:18 -04:00
Sven Eberhardt 288de8c89f Fix /todo failing when launching from program folder without proper access permissions.
Write the TODO.txt at user path instead.
2015-09-13 00:14:42 -04:00
Armin Burgmeier a40792013f Add "AttachNumber" parameter to AttachMesh
This allows to create nested definition-based attached meshes.
2015-09-12 19:57:00 -04:00
Armin Burgmeier 380724a017 Choose attach mesh number uniquely from entire (owned) attach tree 2015-09-12 19:28:53 -04:00
Armin Burgmeier 20eb0615ee Custom shader for drawing sky
Add a C4ShaderCall parameter to tho most important drawing functions, and
make C4DrawGL's CreateSpriteShader public with additional parameters to
specify additional defines and shader slices. C4Sky uses this to compile its
own shader with OC_SKY defined.
2015-09-12 18:15:34 -04:00
Armin Burgmeier e0d7d44948 Optimize drawing of tiled surfaces
Instead of one draw call for each tile, do the whole operation with a single
draw call by setting GL_REPEAT on the texture. This affects sky, the upper
board and the background.

This also allows to remove some code that was making sure surfaces are big
enough.
2015-09-12 16:11:50 -04:00
David Dormagen cd82b41c06 particles: added CollisionDensity to specify with which kind of material a particle will collide 2015-09-12 10:53:23 +02:00
Sven Eberhardt e229090141 Fix memory leak in GetWorkingDirectory.
It was just one leak per engine launch so it's not relevant. But there's no reason to do manual buffer management when StdStrBuf is used anyway.
2015-09-12 03:05:16 -04:00
Sven Eberhardt d6751bff84 Fix crash on context or dropdown menu in GUI dialogues in editor mode (#856). 2015-09-12 02:51:55 -04:00
Maikel de Vries a7480ba0ef fix crash for Translate on strings without translation
Thanks to Isilkor
2015-09-12 00:11:24 +02:00
Sven Eberhardt f48c7cc454 Fix source file name in error messages arising during compilation of ParameterDefs files. 2015-09-10 22:34:21 -04:00
Sven Eberhardt 80fe1aa658 Avoid some C4Group rewinds in scenario list and player loading. 2015-09-10 22:32:51 -04:00
Armin Burgmeier 80791ec5ec Add a low-level PerformMultiBlt function to C4Draw
This allows drawing with custom sprite shaders. Plan is to make the sky draw
with a separate shader.
2015-09-10 20:45:42 -04:00
Armin Burgmeier f3da8525d0 Prefix most shader defines with "OC_" 2015-09-10 19:45:43 -04:00
Sven Eberhardt 3723024e2f Added implicit layer check to local calls of FindObjects-family functions (#1383).
Also fixed some docs links. Note that GetObjectLayer and SetObjectLayer are still not documented.
2015-09-09 20:19:45 -04:00
Sven Eberhardt 5a7e110e1e Fix clonks and objects falling off airships on vertical movement (#1391).
The sub-pixel position adjustment on SolidMask movement caused much smoother visuals on objects on an airship, but at the cost of things falling down because object vertices wouldn't cross the sub-pixel barrier to the next pixel value at the same time as the SolidMask.

The smooth movement is kept for horizontal.

Also fix a bug that caused objects to be added to the SolidMask movement list twice.
2015-09-08 20:20:29 -04:00
Sven Eberhardt e3213812a9 Implement GetStartupTeamCount() script function (#1246).
Returns number of teams containing active players at game start.
2015-09-06 23:29:22 -04:00
Sven Eberhardt 5f0b96d11b Fix empty controlled statement on undefined BREAKPOINT_HERE. 2015-09-06 22:56:14 -04:00
Sven Eberhardt c22157c04b Simplified implementation of StartupPlayerCount.
Setting it by player filenames in the beginning is not necessery (and wrong for invalid files). Also copying it through C4S.Head didn't serve any purpose because PlayerInfo is synchronized in network and replays and startup player count can be deduced from that.

Tested in standalone, network, savegames, runtime join and replays from standalone, savegames and runtime join (Some replays of network games were bugged but that's an unrelated error).
2015-09-06 22:31:04 -04: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
Sven Eberhardt 283277ac82 Do not pre-load file contents from unpacked music folders ($1378).
Removes several seconds from startup time and ~150MB memory usage. Note that tags are still loaded so all file headers do have to be accessed.
2015-09-06 00:02:17 -04:00
Sven Eberhardt ec0b9a0dd1 Fix deleted object usage when script gui close call is issued in response to deleted parent object. 2015-09-05 20:37:12 -04:00
David Dormagen 4682b6c668 script GUIs: fixed a fistful of memory leaks
There are some ownership rules (PropList::GetProperties, Ui::Element..) which are not very clear imo. But there also was at least one clear oversight (name retaining, that is).
The only issue would be an assertion firing at game exit.
2015-09-05 11:01:58 +02:00
Sven Eberhardt 0ceda6734b Fix memory leak in TextureMap initialization.
The Default call from C4Game is issued before construction of all members, which causes a memory leak when TextureMap is actually constructed.

Just merge Default() into Clear(). The separation into two calls serves no other purpose than putting the class into an inconsistent state between them.

It actually does that in almost all other subclasses as well but they don't allocate memory.
2015-09-04 21:49:36 -04:00
Sven Eberhardt c6518cc203 Fix out-of-bounds vector access in map script mask specification calculation. 2015-09-04 21:45:15 -04:00
Sven Eberhardt cb995eb158 Fix several memory leaks in script gui. 2015-09-04 21:08:28 -04:00
Martin Plicht b15f6bfb38 mac: Sprinkle some #include <GL/glew.h> onto 2 .mm files to make compiler happy
Also a break in a switch because clang told me so!
2015-09-04 18:28:57 +02:00
Nicolas Hake 4ae2d9f70b C4Script: Allow executing strings from cmdline instead of only files 2015-09-04 13:40:27 +02:00
Nicolas Hake 2b876a6cb6 C4Script: Split stubs from script runner 2015-09-04 13:21:06 +02:00
Nicolas Hake 082b3e7360 C4AulParse: Properly escape strings when dumping bytecode
Instead of just writing the raw string to stderr, escape them first so
newlines and other control characters don't result in strangely
formatted output.
2015-09-04 12:57:30 +02:00
Sven Eberhardt 0b308e75fe Remove duplicate sound system initialization. 2015-09-03 23:47:41 -04:00
Sven Eberhardt a4629e0758 Clear container of contents prior to removing them.
The container had already set Status==0 and cleared these objects from its contents, which can cause access to dead objects when anything container-relevant is done in the destruction callback.
2015-09-03 23:39:06 -04:00
Sven Eberhardt 8f4494745d Fix C4ScriptGuiWindow MouseInput/MouseEnter/MouseLeave overloads.
MouseInput silently shadowed the variant in C4GUI::Element and MouseEnter/MouseLeave were never called without parameters.
2015-09-03 23:27:20 -04:00
Sven Eberhardt 3edcc2b043 GUI: Readded "using Window::MouseInput;" in Screen to make the overload clear.
It got lost when moving some functions from protected to public.
2015-09-03 23:04:26 -04:00
Sven Eberhardt 3e4b30b2ba Added parentheses to clarify when an assignment result was intentionally used as truth value.
To silence some warnings.
2015-09-03 22:54:08 -04:00
Sven Eberhardt 36fbbb34a4 Change deactivated MenuDebugLogF to a definition that does not evaluate its parameters. 2015-09-03 22:50:58 -04:00
Sven Eberhardt 9e6f7896ac Make MouseInput, MouseEnter and MouseLeave public in GUI elements.
They were public in some and protected in other classes and they're also called from several places outside the GUI.
2015-09-03 22:42:29 -04:00
Sven Eberhardt b74750f1cb Fix sound modifier parameter in SoundAt script function.
The modifier was created but not applied.
2015-09-03 21:26:50 -04:00
Sven Eberhardt 20d3de46cd Fix some unused variables. 2015-09-03 21:26:49 -04:00