This might make the rendering a bit quicker, since the whole texture
environment setup that we do every frame is no longer required --
instead only the shader is bound and a few variables uploaded. However,
this was not the main motivation behind this change.
It also simplifies the code a bit. The texture environment setup is
replaced by GLSL code generation. Another small benefit is that for
texture units in material scripts that do not use an actual texture
image no hardware TIU is being used. This reduces the number of hardware
TIUs required for rendering the Clonk from 3 to 2.
The main benefit of this change, however, is that material specific
and clonk specific color variations can be applied correctly. This mainly
concerns ClrModulation and MOD2 drawing. Before, the ClrModulation was
mixed with the material color, which could lead to incorrect results
depending on what the texture units were doing. Now it is being applied
by the shader after all texture units in the material scripts have been
processed.
Another motivation of this change is to implement support for custom
shaders, which is already foreseen by OGRE material scripts. The
specification has only to be implemented. With this change in place,
both custom shaders and "fixed" processing can share the same code in
the engine, since both end up using a shader for the mesh rendering.
The shader currently works only for directional lights, but should be
easy to extend to also support point lights.
In no-gravity situations, SimFlight would enter an endless
loop when trying to project an unmoving object, waiting for
a collision that would never happen.
Similarly, in negative gravity, SimFlight would continue
calculating objects that left the top boundary of the land-
scape, only aborting the simulation once the coordinates
underflowed to values below the landscape.
C4AulParse::Host is now only used for local variables and named functions.
Global directexec functions have neither, so they won't need a scripthost
at all anymore.
The missing break meant that the freshly created copy of the proplist would
get overwritten by the original, which was thankfully caught and announced
with "internal error: constant proplist has the wrong parent".
Thanks to Zapper for the testcase.
This allows compiling and linking with it without pulling in whole
C4Game. This is useful for the mape map editor.
The only place where C4Game was used in C4Material.cpp was in
CrossMapMaterials where the name of the earth material is read from
Game.C4S. The code has been changed such that the earth material name is
now a parameter to the CrossMaterialMap function.
Apparently the C standard committee and Microsoft couldn't agree on how
swprintf should work.
We previously tried to work around the resulting breakage, but I just got
the following compilation error. It's really better to avoid that function
entirely. Since we only used it in windows-specific code, the
windows-specific _snwprintf is a nicely compiler-independent replacement.
src/platform/PlatformAbstraction.h: In function ‘int swprintf(wchar_t*, size_t, const wchar_t*, ...)’:
src/platform/PlatformAbstraction.h:243:12: error: redefinition of ‘int swprintf(wchar_t*, size_t, const wchar_t*, ...)’
/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/swprintf.inl:30:5: error: ‘int swprintf(wchar_t*, size_t, const wchar_t*, ...)’ previously defined here
A missing fixed conversion let the shape check happen at or around position 1/1 instead of at the actual object position.
Also removed a redundant contact check.
Technically this mark is incorrect; we do not handle things differently
on high DPI settings. On the other hand, marking OC DPI aware means that
Windows won't try to scale our drawing, clipping menus and rendering in
the process.
Somewhere in the future, OpenClonk should also add proper DPI awareness
and change the default zoom and menu scaling to match.
Instead, use the first connected output from the list of all outputs.
This happens on my computer, probably because the desktop environment
does not set the correct primary output.
Most of the processing was already done by C4MessageInput::ProcessInput and
C4MessageInput::ProcessCommand. Simply move the Lobby-only commands there,
too, and make them work without a Lobby MainDlg. This required almost only
cosmetic changes.
In practice, only the xrandr code path received any testing. Since Clonk
works fine without changing the resolution, this will not terribly
inconvenience anybody still stuck on old systems without xrandr.
Also only minimize the window when the resolution was changed.
The minimization is there to prevent accidental focus restoration
resulting in unwanted resolution switching.
OR'ing an enum value and a char with its highest bit set sign-extends the char.
On compilers with signed chars, this means you end up with a negative integer,
which can't be narrowed to uint8_t at initialization (which is what PacketHdr's
first member is).
This makes functions independent of their "Code Owner"s, which removes the
necessity to maintain that connection and carefully reset functions when
their scripthost is cleared.
Also set default to 8. This might be a pretty controversial change, but
the amounts of screenshots we have at zoom levels beyond 4 just calls for
a more high-res approach.
Pretty awkward compromise, but the array version seems to confuse a lot of
drivers, without causing an actual error. So this is probably better in
practice until better drivers are more common.
"Anon" referred to the fact that these proplists have neither a number,
like simple proplists, objects and effects, nor an ID like Definitions.
However, they now store the names of the global constant or property they
are in, so "Anon" is no longer appropriate.
There are now three classes of proplists:
- ordinary proplists (C4PropListScript) have a number only in the savegame
- objects and effects (C4PropListNumbered) always have a number
- proplists created during initialization (C4PropListStatic) have a path
So the function could be called NewNamed, but the source of the proplist
has been far more stable than the method used for serialization, and Static
somewhat describes the source.
This mostly simplifies things, since most other places use an 32 bit
integer to store colors, but might even improve performance through better
cache locality.
This fixes the lightbulb symbol from floundering around back and forth when
zoomed in and scrolling. Since C4Facets can be used to specify a target area
to draw into (such as in C4DefGraphics::Draw), and since this area can be
zoomed, sub-pixel precision can be achieved this way in such drawing
operations.
This makes Application.GetConfigWidth/Height simply return the appropriate
configuration value instead of mixing configuration and state in the same
function. The caller needing the state now uses C4Window::GetSize instead.
The FILEVERSION and PRODUCTVERSION components of VERSIONINFO blocks are 32 bit
integers, specified as four 8-bit integers. Apparently MinGW's windres chokes
on the definition if not all values are given.
C4Aul's Warn uses the format attribute to check for format string correctness.
Passing a dynamic string buffer from FormatString to it will break the build
with -Werror=format-string. Given that Warn already does the formatting itself,
just drop the use of FormatString
C4Set<T>::Sort() breaks the internals of the class which Guenther doesn't like. Now the sorted list is returned as a list of pointers into the original set.
Functions are refcounted now and might outlive their script. Fortunately,
the function destructor didn't really need the Owner. This further damages
the pretense of multiple scriptengines, but that could be repaired by
storing a pointer to the engine in the functions.
Conceptually, the landscape stretches infinitely on both left and right hand
borders of the map. So far, the "closed" part of the border only blocked objects
from passing through. (Additionally, there was a bug where you could scale the
border under certain circumstances.) This patch allows objects to properly
move around on the map borders, including scaling the fake terrain.
Not resetting t_attach leads to strange behavior in liquids since detaching from
the landscape usually happens via the Jump action which generally reverts to its
InLiquidAction before t_attach gets reset. By removing the shortcut return after
entering the InLiquidAction, we make sure t_attach gets reset correctly (as well
as immediately executing the correct action instead of doing so after a delay of
one frame).
For example, the solidmask removal is done in
UpdateFace, and might have been needed in Clonk 4 or Clonk Planet, but the
current solidmask code is fine with the call from there.
Mostly by changing functions to take a const reference, but also by using
move constructors. This helps with C4String leak debugging by reducing the
reference count changes.
Previously, only the outer proplist would be copied, but the parser expects
the inner proplists to also be present. Copy proplists deeply instead, as
is already done for functions, and in the linking step.
The old factor was chosen because the default gravity * 500 was exactly
100. But a lot of other engine interfaces use 1/100 px/tick or px/tick^2,
and that is a common scale for scripts to work in, too.
Since the script engine doesn't have an appropriate function to create the
proplist in, simply create it in the constructor and arrange for the
string table to be constructed first.
The precise rule is that only CNAT_Bottom vertices connect to the
landscape and connect at the bottom, too. It doesn't quite fit with
the other procedure-transitions because the movement code doesn't
consider the bottom vertex to touch the landscape in that situation,
but this is probably less weird than the old cornerscale teleportation.
Also don't transition from FLIGHT to Scale when the ComDir points
away from the wall. That tended to stop the Clonk in its tracks on
uneven ground.
This avoids some teleporting when there's some material behind the object
and in front of it. Especially useful for small bumps of material in front
of a wall with the new left/right attachment of the foot vertex of the
Clonk.
Instead of teleporting from sticking with the left/rightmost vertex to the
want to standing on the lowest one at the same position, the Clonk can now
climb using the lowest vertex alone. That means the teleport only needs to
cover only one pixel each in x and y direction to go from sticking to the
side of the landscape pixel to sticking on top of the same pixel.
Also remove some unnecessary x/ydir resets and make comdir in the direction
of the wall the Clonk is scaling keep the up/down direction instead of only
going up.
The rope will create a C4AulScript for the rope engine functions instead of
putting them into the global scope, and we might want to put C4Object-only
functions into a separate C4AulScript some day, too.
The STL and CRT headers use placement new on certain compilers, so move our
memory debugging code behind the inclusion of those libraries; those are very
unlikely to leak or corrupt memory anyway.
The map is currently only used in the parser for some warning heuristics.
Since it uses a hash table with separate chaining and the amount of
functions is fairly predictable, the hash table doesn't have to be
resizable.
The parser now copies the contents of the proplists in the order of their
source scripts into the final proplist. This way, local variable contents
get properly included, and the list of functions has one user less.
Also move C4AulDefFunc and C4ScriptFnDef to the same header the template
helper classes are in. Like them, these classes are a mostly invisible
implementation detail of the engine script functions.