Commit Graph

108 Commits (7005eae55d8fe61edd21d366894f183595f7c199)

Author SHA1 Message Date
Lukas Werling 7005eae55d Use PCG as random number generator 2016-04-20 22:42:00 +02:00
Maikel de Vries 97f316a35a fix debug build 2016-04-10 09:48:42 +02:00
Nicolas Hake 267bb1c3f1 Landscape: Make script-edited maps work again 2016-04-03 17:23:00 +02:00
Nicolas Hake 5c0d8a9ce6 Landscape: Make script-generated maps work again
...by actually storing the result of the generator somewhere.
2016-04-03 17:02:41 +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
Nicolas Hake 893d4e295b C4Landscape: Set dynamic mode when map was successfully generated
...instead of when it failed to generate.
2016-04-01 14:38:47 +02:00
Nicolas Hake 0abef8dac5 Remove "High-res landscape" option
We're requiring shaders for everything else we render, so there's no
point in having a shader-free landscape renderer around.
2016-03-31 19:22:17 +02:00
Maikel de Vries e7c296104f set controller of dig2material objects when the digger exists
This ensures correct kill tracing for example a piece of coal falling on an enemy after being dug out.
2016-02-01 20:20:26 +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 68c436576e Simplify construction of C4AulParSets 2016-01-25 00:00:57 +01:00
Günther Brammer 9b7b4bf30a Remove unused variable in C4Landscape::DrawBrush
This was forgotten in 47e422f452.
2016-01-11 01:50:34 +01:00
Sven Eberhardt 8552b3a8f9 Change return value of InsertMaterial when inserting outside landscape bounds #1509
Fixes clogged pump when pumping outside map.
2016-01-08 01:05:22 -04:00
Armin Burgmeier eab0f2850a Clear Relight markers in C4Landscape::Clear (#1510)
Otherwise, when starting the next scenario, random spots would be initially
re-lighted. That's not necessarily a problem, but unnecessary work, and it
triggered the assertion in C4FowAmbient::UpdateFromLandscape if the relight
was scheduled for a region that's outside of the landscape boundaries of the
second scenario.
2015-12-21 19:35:43 -08:00
Sven Eberhardt d48f590dfb Fix conversion buffer access for DrawMaterialQuad with DMQ_Bridge (#1478). 2015-12-05 14:41:56 -05: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 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
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
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 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 5b47a26d30 Perform DugOut callback also on non-collectibles and on objects not created through Dig2Object mechanism. 2015-10-01 22:43:01 -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
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 aac23e6bc7 Fix landscape renderer and ambience level on savegame resume (#1400). 2015-09-16 22:11:39 -04:00
Sven Eberhardt cc0a139ff9 Fix landscape reinitialization on saved section load (#1379). 2015-09-15 00:13:45 -04:00
Sven Eberhardt 0d16e67066 Order mat-tex combinations by appearance in texture map instead of by palette index when zooming map to landscape.
This should simplify insertion of new textures at arbitrary drawing orders without reassigning palette indices (the latter would invalidate all old maps).
2015-08-10 00:34:43 -04:00
Armin Burgmeier cd2d525b5b Rename C4Landscape::TRANSPARENT to C4Landscape::Transparent
Some stupid windows header seems to have a #define for TRANSPARENT.
2015-08-04 23:15:52 -04:00
Armin Burgmeier 3ec53c2c40 Update GTK+ editor so that one can draw background materials 2015-08-04 21:21:24 -04:00
Armin Burgmeier 08ae643c2c Add a draw mode which shows the background 8-bit surface 2015-08-04 21:21:24 -04:00
Armin Burgmeier 51986b68ef Allow script functions to access background landscape
Add GetBackMaterial() and GetBackTexture(), and allow DrawMaterialQuad to
specify a background mat-tex combination.
2015-08-04 21:21:24 -04:00
Armin Burgmeier 1f6825fb4b Make solidmask not overwrite background material
Also, remove Landscape.SetPix in favor of Landscape.SetPix2
2015-08-04 21:21:24 -04:00
Armin Burgmeier b8343786b6 Make MapScript create a background map
This removes the last occurence of the IFT flag
2015-08-04 21:21:23 -04:00
Armin Burgmeier 006cf68874 Some refactoring, and restore support for Map.bmp
The new behaviour that allows 255 mat-tex combinations (once we increased
C4M_MaxTexCount...) is enabled with MapFg.bmp, and then MapBg.bmp can be
used to draw IFT or other fancy things.
2015-08-04 21:21:23 -04:00
Armin Burgmeier fe74cac663 Make the C4MapCreatorS2 create background maps 2015-08-04 21:21:23 -04:00
Armin Burgmeier eb98e73b76 Introduce background map
The background landscape is generated from the background map.
2015-08-04 21:21:23 -04:00
Armin Burgmeier 92f3a3e749 Remove GBackIFT in favor of a lookup in the background surface 2015-08-04 21:21:23 -04:00
Armin Burgmeier 73e1b33e65 Make massmover and PXS not overwrite the background material 2015-08-04 21:20:06 -04:00
Armin Burgmeier 54666aeb2d Introduce background landscape
The background landscape is a 8-bit landscape which stores the material
that a particular pixel will be replaced with when it is cleared, e.g.
by digging or blasting.

This is just the groundwork for this and does not offer much advantage
over the IFT flag that was used previously for that purpose. However,
additional features such as keeping the background material/texture
fixed when loam bridges are built, PXS are incorporated into the landscape
or the massmover is moving things around can be added.

See http://bugs.openclonk.org/view.php?id=1338 for more details.
2015-08-04 21:20:06 -04:00
Armin Burgmeier 45c3d1ff2e Remove dead/superfluous code in C4Landscape 2015-06-16 20:56:53 -04:00
Sven Eberhardt 21500a81a9 Fix pump to clear the last row of pixels (#1057) and allow pumping from pump without source pipe.
ExtractMaterial has been changed to be able to slurp in from the most distant horizontal position rather than the closest to the extraction top center.

Also speed up ExtractMaterial for the common case of no required horizontal shifts.
2015-05-01 18:13:41 +02:00
Armin Burgmeier cd80784140 Save ambient brightness value in savegames 2015-04-06 20:48:59 -04:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Nicolas Hake 344962797d Make ForLine take a functor instead of a raw pointer
This means we can drop the opaque parameter. Where additional data is
required, a lambda is the way to go here. It also means we don't have to
put half of the parameters into a global variable.
2015-02-23 14:00:22 +01:00
Nicolas Hake a2f06c6ac5 Move ForLine function into C4Landscape.cpp
C4Landscape is the sole consumer of this function, so there's no reason
to make it available outside.
2015-02-23 13:39:51 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Sven Eberhardt 7b8ffd79a4 Make Lava/DuroLava emit ambient light as a material property. (#1205) 2015-01-28 22:35:14 +01:00
Sven Eberhardt 8f866cceee Fix assertion on landscape changes outside landscape rectangle (#1232) 2015-01-25 18:23:43 +01:00
Sven Eberhardt 6be3796e33 Do DigOutObject callback when digging out new objects from material.
It was already done when blasting free and when digging out existing objects, but the case of digging out new materials was still missing. This helps collect firestones when digging in firestone material.
2015-01-25 14:19:39 +01:00