Commit Graph

2846 Commits (stable-6.1)

Author SHA1 Message Date
Armin Burgmeier ab4de05b4f Fix light/ambient drawing offset when upperboard is active 2014-12-07 21:54:12 -05:00
Armin Burgmeier ffed845849 Build fix 2014-12-07 14:59:38 -05:00
Sven Eberhardt 612a05fe40 New script function: GetPXSCount.
Counts number of loose pixels of a material in an area.
2014-12-07 19:52:05 +01:00
Mark 3971d60614 Match partial skeletons (#1177)
When using AttachMesh() with the flag AM_MatchSkeleton the behaviour was changed. The child mesh no longer uses the transformation of the bone in the parent skeleton by order, but by name.
2014-12-07 01:11:04 +01:00
Mark 1f4f280539 Bugfix: Missing AttachParent in AttachedMesh
On loading a savegame with attached meshes, the AttachParent of their child is NULL.
2014-12-07 01:11:02 +01:00
Armin Burgmeier 7a8778acca Make sure graphics resources are loaded before drawing anything
This was not required before, but now most drawing operations require
the shaders to be loaded from Graphics.ocg. Therefore, move the graphics
resource loading earlier in the startup sequence, and make sure we don't
initialize the message board prematurely in OnResolutionChanged().
2014-12-06 17:16:36 -05:00
Sven Eberhardt bbe01335d9 Fail scenario saving if object saving returned nil (#1182).
This usually means there was a script error in the scenario saving function. Better abort instead of overwriting the existing scenario with garbage data.
2014-12-06 22:45:38 +01:00
Armin Burgmeier e46c558671 Fix a delete / delete[] mismatch in C4ParticleSystem 2014-12-06 15:42:42 -05:00
Armin Burgmeier 377d8ab1d0 Set pack alignment to 1 before reading the GL pixel buffer (#1181)
Otherwise the default pack alignment is 4, and when the horizontal window dimension
is not a multiple of 4, glReadPixels() would read past the end of the buffer we
provided.
2014-12-06 15:42:42 -05:00
Armin Burgmeier f58f7ad770 Initialize all structures when writing BMP file
Otherwise, we would partly write files with uninitialized data, such as the
padding bytes in a BMP, or the palette if not specified explicitly. This
mostly fixes corresponding valgrind warnings, but also makes sure we obtain
the same BMP files everytime we store the same StdSurface8 object, bit-by-bit.
2014-12-06 15:42:42 -05:00
Armin Burgmeier dd16b2d588 Set useful name for in-memory CStdFiles
This fixes a valgrind warning when creating a savegame, since in that case
the file name is filled with uninitialized junk. It is not used at other
places, since it is an in-memory file, and therefore was probably harmless.

Now we give a useful name to in-memory files based on the address of the
StdBuf object, which might actually be useful when debugging.
2014-12-06 15:42:42 -05:00
Sven Eberhardt baf05264d1 Implement music fading.
Moved music system execution from game tick execution into main application execution so music fading works when the game is paused or lagging.
2014-12-06 18:04:55 +01:00
Tobias Zwick 1ad16efe23 fix intermediate fade point sometimes end up overlapping the fan 2014-12-06 01:44:18 +01:00
Sven Eberhardt 62e6da2f23 Add categories for .ogg music files that can be referenced in SetPlayList. 2014-12-06 00:06:08 +01:00
Mark d0a74d9af3 Merge remote-tracking branch 'origin/master' 2014-12-03 20:08:41 +01:00
Mark 0e9c0e9be4 AttachMesh with added functionality (#1177)
Simple implementation of matching skeletons/animations. Short description added to the documentation. More functionality to follow.
2014-12-03 20:05:36 +01:00
Mark dda9599003 Extracted skeleton from StdMesh.
Skeleton is now represented by the class StdMeshSkeleton.
2014-12-03 20:04:54 +01:00
Armin Burgmeier a792a1c6a2 Fix possible race condition in C4ParticleSystem construction
Previously, the calculation thread was initialized before the event it was
going to wait for after it is launched. However, since the thread starts its
execution in its constructor, it might access the event before the event
itself has been constructed.

This is fixed by making sure the event is fully constructed before the thread
is constructed (and launched).
2014-12-03 11:03:51 -05:00
Armin Burgmeier 254e1e4631 Apply drawtransform on sprite normal map
This makes the normals point into the correct direction for transformed
objects, which is for example the case when they are rotated with SetR.
2014-11-26 17:56:43 -05:00
Armin Burgmeier e58b62920c Change extension of shader files from .c to .glsl 2014-11-25 11:54:36 -05:00
Armin Burgmeier 5054322b6d Enable lighting shaders for particle rendering 2014-11-25 11:42:17 -05:00
Armin Burgmeier 56b19ac065 Fix brush preview in GTK+ developer mode
This looks like an artifact from when the alpha channel was inverted.
2014-11-24 16:32:25 -05:00
Armin Burgmeier 192dddec6f Use the new shader system for rendering sprites
This now also avoids the use of conditionals in shaders by using different
shaders instead.
2014-11-24 14:51:08 -05:00
Armin Burgmeier a06e5a4aee Add some more variants of the uniform setters 2014-11-24 14:51:08 -05:00
Armin Burgmeier 5c6ed34a3a C4Shader: Deactivate shader units in reverse order
This makes sure that GL_TEXTURE0 is the active texture unit
after the shader call. Some parts of the engine such as the
particle system rely on that.
2014-11-24 14:51:08 -05:00
Armin Burgmeier 292f8e8191 Improve GL error outputs 2014-11-24 14:51:08 -05:00
Armin Burgmeier a7f9ba1e91 Compute ambient texture coordinate based on fragment coordinate
This will allow to use the same shader slice also for the sprite and mesh
shaders.
2014-11-24 14:51:08 -05:00
Armin Burgmeier f550fcdf43 Add C4Draw::GetClipRect()
This will allow to avoid some code duplication when computing the coordinate
transform from fragment coordinates to ambient and light texture coordinates.
2014-11-24 14:51:08 -05:00
Tobias Zwick 3483d1f367 fix clipping problem for real 2014-11-23 22:50:49 +01:00
Tobias Zwick 117758848c Revert "fix clipping bug during the raytracing phase" (no fix after all)
This reverts commit 7a47c95c08.
2014-11-23 21:33:28 +01:00
Tobias Zwick 7a47c95c08 fix clipping bug during the raytracing phase 2014-11-23 21:23:58 +01:00
Tobias Zwick 43d7bbfa73 make Peter's change conform to the naming scheme 2014-11-23 18:39:24 +01:00
Tobias Zwick 256c86fccd Merge remote-tracking branch '_origin/lights' into lights
Conflicts:
	src/landscape/fow/C4FoWLight.cpp
	src/landscape/fow/C4FoWLight.h
2014-11-23 18:06:10 +01:00
Tobias Zwick 3a8fb34bea shorten and make intermediate fade triangle render code more performant 2014-11-23 17:50:21 +01:00
Tobias Zwick a1794359cc squash and simplify function to find cross-intersection again 2014-11-23 17:49:29 +01:00
Tobias Zwick e33ef90bba fix a bug in the intermediate fade triangle render code 2014-11-23 17:46:59 +01:00
Tobias Zwick 8850d2e755 replace algorithm to calculate the intermediate fade point with a more failsafe version 2014-11-23 17:45:53 +01:00
Tobias Zwick 294838e0a4 outsource translating coordinates of triangles into a function 2014-11-23 17:42:09 +01:00
Tobias Zwick 800885a21b add const keyword to some methods 2014-11-23 17:40:24 +01:00
Peter Wortmann 7dd4d1900b Split fan where the normal maxes out
This gives a more consistent normal distribution across directions.
I actually had to make the "normal region" of the light bigger, because
now the Clonk's face would be all dark otherwise. In the end,
everything looks smoother and less flashy now, which is probably as
it should be.

Also slight refactoring.
2014-11-21 15:32:33 +01:00
Tobias Zwick 6bd5beafde make certain fades a bit smoother by reimplementing PeterW's NEWER_INTERFADE_CODE. This is only a very slight effect, but visible 2014-11-20 23:43:14 +01:00
Tobias Zwick 1b96eaabf2 move find_cross function to a different class, reimplement 2014-11-20 23:43:13 +01:00
Tobias Zwick 815a61c540 fix a bug in intermediate fade generation 2014-11-20 23:43:12 +01:00
Armin Burgmeier db6df15377 Add SetAmbientBrightness and GetAmbientBrightness script functions 2014-11-20 17:07:31 -05:00
Armin Burgmeier d60c74c6b6 Fix viewport offset for lightmap lookup 2014-11-20 16:45:34 -05:00
Peter Wortmann 9672ae8947 Framebuffer update improvements
Now we use the shader to do a proper blend - this avoids some artefacts
that were visible before. Also after some hair-pulling the coordinate
transformation now seems to be more correct than before. Maybe even
with zoom. We'll see.
2014-11-20 21:48:46 +01:00
Peter Wortmann 7fea618221 Collected trivial bug-fixes
Turns out we actually can't optimise out the second texture normal
lookup - it makes a noticeable difference in-game. Also there was
possible slice collision, it might be worth warning about this kind
of stuff.

Also removed unused variable, and made error messages more consistent
in terms of whitespace.
2014-11-20 21:44:11 +01:00
Peter Wortmann 72289713f9 Modular shader system
The idea here is that we compose shaders out of "slices", which can
come from the engine ("built-in"), from files or possibly even from
models. This should allow us to more easily share the code between
different rendering shaders (e.g. for lights / normals).

TODO: Workarounds not yet implemented, so this might degrade less
gracefully.
2014-11-20 11:52:14 +01:00
Armin Burgmeier b43e1a9369 Fix ambient texture coords when viewport is smaller than full render target 2014-11-18 16:44:06 -05:00
Armin Burgmeier 48456f5f99 Fix transparency in regions with no ambient and low dynamic light 2014-11-18 16:33:27 -05:00
Armin Burgmeier 2df2ee22d6 Update ambient map on landscape changes 2014-11-18 15:42:53 -05:00
Armin Burgmeier 643ca7fd0a Add functionality to update the ambient map at runtime 2014-11-18 15:42:39 -05:00
Armin Burgmeier 39f5b6f15a Apply landscape re-lighting again in every frame
This was accidentally removed in commit
56bdeec585. It fixes the landscape being
only updated once every second when digging.
2014-11-18 15:42:22 -05:00
Armin Burgmeier ac75c7041b Remove two unused declarations in C4Landscape
There are no implementations anymore for these.
2014-11-18 15:42:22 -05:00
Armin Burgmeier 5ac6ea6a3c Fix FoW deinitialization in C4Landscape 2014-11-18 15:42:22 -05:00
Armin Burgmeier c8ea5d1f85 Explain the one-second relights in a comment
Should make it a bit quicker for the next person to figure out what is
going on there...
2014-11-18 15:42:22 -05:00
Armin Burgmeier 72255a7e04 Optimize generation of the ambient map
The new algorithm is ~25% faster
2014-11-18 11:06:26 -05:00
Armin Burgmeier ee33c58cfe Don't apply the dot product to transparency in lighting calculation
This fixes the transparency issue with the coconut tree.
2014-11-17 20:51:18 -05:00
Armin Burgmeier 86d2ba7d68 Fix the build 2014-11-17 20:30:41 -05:00
Tobias Zwick e7c9c176b1 fix clipping 2014-11-18 00:30:27 +01:00
Armin Burgmeier 0520c5fcdf Use a named enum for the internalformat parameter of glTexImage2D 2014-11-17 17:53:06 -05:00
Armin Burgmeier 34e100aeb6 ambient: fix some debug code 2014-11-17 17:53:06 -05:00
Armin Burgmeier 5ae426e7bf Fix too large radius when converting radius from landscape to ambient coords
This is basically a leftover to do rounding when the radius was an integer
and not a floating point number.
2014-11-17 17:53:06 -05:00
Armin Burgmeier fc67eca754 ambient: Clamp sample values outside the landscape to the landscape border
GetPix() already has some handling for outside values, however that does not
always give the desired result.
2014-11-17 17:53:06 -05:00
Tobias Zwick 239cd222e5 implement/fix clipping during rendering of light 2014-11-17 23:02:00 +01:00
Tobias Zwick 96729ef57c refactor C4FoWLightSection::CalculateTriangles to also use the C4FoWBeamTriangle data structure; refactor the variable names 2014-11-17 23:01:59 +01:00
Armin Burgmeier 88f8f75441 Add ambient lighting
This introduces a new texture, an ambient light map, that is generated
automatically at the beginning of the round by the sky portion of the
landscape. This basically makes everything that is close to sky visible
by default.

The shaders have been adapted so that they deploy direction-independent
lighting for the ambient component, and the current (diffuse) behaviour
for the diffuse component. This makes the shaders use an additional
texture unit that represents the ambient light. We can think about merging
this information into the light texture, but the coordinate systems are
different at the moment, so this could be performed at the stage of light
texture generation.

For meshes, the ambient material is not actually used, but instead a
diffuse light from the front is used. This makes many meshes look more
interesting, maybe also because the ambient material setting of most
meshes are not set correctly at the moment.
2014-11-17 09:35:50 -05:00
Armin Burgmeier e64875d1c7 C4Landscape: Make GetPix and _GetPix const 2014-11-17 09:13:01 -05:00
Tobias Zwick 7f1ca342c2 another build fix 2014-11-16 20:36:12 +01:00
Tobias Zwick eb6bba9c4e fix linker error for G++ and clang 2014-11-16 20:18:09 +01:00
Tobias Zwick fd0163ebc6 refactor and document: C4FoWLightSection only calculates the triangles now, C4FoWLight stitches everything together and renders
* intermediate fade triangles are now calculated in C4FoWLight
* rendering takes also place in C4FoWLight, using different C4FoWDrawStrategies
* solved an old TODO from Peter (int -> int32_t)
* refactor and simplify portions of the light vertex calculation code
2014-11-16 18:57:42 +01:00
Armin Burgmeier 00447dd524 Merge branch 'master' into lights 2014-11-12 08:47:43 -05:00
Armin Burgmeier fb5365c2b1 Fix possible crash when drawing empty pix or line PXS 2014-11-12 08:46:53 -05:00
Armin Burgmeier c3bcedfbf9 Don't attempt mouse hover callbacks when mouse control is passive (github #5) 2014-11-07 20:16:30 -05:00
Armin Burgmeier ebeeb534ce CreateParticleAtBone: Take object rotation into account (#1173) 2014-11-07 19:57:04 -05:00
Armin Burgmeier 137abb89df Implement normal maps for sprite graphics 2014-11-07 15:29:09 -05:00
Armin Burgmeier 672e343b84 Remove C4DefGraphics::CopyGraphicsFrom()
It is not used.
2014-11-07 15:28:13 -05:00
Armin Burgmeier 5b54a3d6ea Remove fixed-function lighting for meshes
The light direction is now taken from the light texture, so the only thing that is
still needed is the material definitions.
2014-11-07 12:08:06 -05:00
Armin Burgmeier aed907e30d Remove old fog of war 2014-11-07 11:53:10 -05:00
Armin Burgmeier 219fa8597c Implement light calculations for meshes 2014-11-06 15:56:19 -05:00
Armin Burgmeier 0795715465 Apply lighting on sprites 2014-11-06 15:56:19 -05:00
Armin Burgmeier a6d949d313 Merge branch 'master' into lights 2014-11-04 11:26:45 -05:00
Armin Burgmeier 73e4f5a89c Remove some unused code in C4Draw 2014-11-04 11:24:55 -05:00
Armin Burgmeier a1bafb937f Implement DrawQuadDw with PerformMultiTris
This simplifies the code further.
2014-11-04 11:02:40 -05:00
Armin Burgmeier 9e9f0cee9d Avoid setting oc_ClrModMap shader parameter when clrmodmap is not used
Otherwise, ResolveAutoParameter() does not set the correct parameter type, and
the code would try to set a sampler2D parameter as a float4. It does not matter
in principle since the shader would not use the texture anyway, but it
generates a GL error that is avoid this way.
2014-11-03 14:39:17 -05:00
Armin Burgmeier f89058f094 Remove config entries that are no longer used 2014-11-02 16:57:50 -05:00
Armin Burgmeier fe7897539a Remove unused code 2014-11-02 16:57:28 -05:00
Armin Burgmeier 233e5e7c13 Remove CStdGL::BlitLandscape
This code is only used for the low-resolution landscape that is hardly in use
anymore. The code was mostly a duplicate of the standard C4Surface blit
function, CStdGL::PerformBlt, with some added code for blitting material
textures with higher resolution. However, that code was not enabled anymore
by the classic landscape renderer either, so it seems safe to remove it.

The landscape is now simply drawn by C4Draw::Blit.
2014-11-02 11:15:06 -05:00
Armin Burgmeier 50769171f1 Remove manual clipping in C4Draw::BlitUnscaled
This was not working anymore correctly, since it now operated on unzoomed
coordinates. This could have been worked around by only applying it in the
unzoomed case, however I don't think the code is actually used much anymore.
In other cases of the rendering code, such as the mesh rendering, manual
clipping was never implemented and this did not seem to cause any problems.

Therefore, it can probably be removed safely.
2014-11-01 23:11:35 -04:00
Armin Burgmeier 373b992f45 Tweak the shader a bit 2014-11-01 22:45:14 -04:00
Armin Burgmeier 2b2bc56e77 Remove unused PerformBlt function 2014-11-01 22:28:03 -04:00
Armin Burgmeier 65a47623e4 Use PerformMultiTris in the standard blitting code
This makes blits with overlays to actually use a single pass only, and
applies the GLSL shader also to standard object blits, which might come
handy when the lighting calculations in the lights branch are applied
on sprite objects.

It also removes the last user of C4Draw::PerformBlt, which will be removed
in a subsequent commit.
2014-11-01 22:28:03 -04:00
Armin Burgmeier b58fde88aa Add option to draw overlay with PerformMultiTris
This allows drawing images with overlay in a single rendering pass.
2014-11-01 22:28:03 -04:00
Martin Plicht 1ddb8ebf39 mac: Quit from main menu also calls Application.Clear() 2014-11-01 15:47:04 +01:00
Martin Plicht d05c784478 C4GameObjects: Turn remaining explicit iterator use into for (x : list) loop 2014-11-01 15:47:04 +01:00
Martin Plicht f1f1627995 C4ObjectList: InsertLink, InsertLinkBefore and Clear also do some iterator adjusting 2014-11-01 15:47:03 +01:00
Armin Burgmeier b0f2f507b1 Fix execl invocation in C4UpdateDlg 2014-10-29 00:35:13 -04:00
Armin Burgmeier babb0b243b Load mesh material scripts also from .ocd folders without definition 2014-10-26 21:29:36 -04:00
Sven Eberhardt b310369b64 Initialize C4Game::CheckObjectEnumeration()::Check::maxNumber in ctor.
MSVC2012 build fix.
2014-10-26 20:44:06 +01:00
Sven Eberhardt a60bf33358 Rename C4DrawMeshGLProgramInstance::Parameter::Parameter to avoid name conflict.
MSVC doesn't like members having the same name as the enclosing class.
2014-10-26 20:41:45 +01:00
Martin Plicht 0bab7c17de C4Object: ShiftContents done with iterators 2014-10-25 21:26:07 +02:00
Martin Plicht afa6974f37 C4GameObjects: Sorting out objects with inactive state done with regular Remove/Add calls instead of manually doing linked list dance again 2014-10-25 21:26:07 +02:00
Martin Plicht 0219a40d2b C4GameObjects: PostLoad sanity Contents check done with iterators instead of direct C4ObjectLink access 2014-10-25 21:26:07 +02:00
Martin Plicht e375e4b30a C4GameObjects: When shelving contents of InactiveObjects temporarily, make a copy instead of setting InactiveObjects.First 2014-10-25 21:26:07 +02:00
Martin Plicht e05bdfbcb4 C4Game: Refactor CheckObjectEnumeration to not use manual list traversal 2014-10-25 21:26:07 +02:00
Martin Plicht 843d4039b1 C4GameObjects: Use this instead of ::Objects 2014-10-25 21:26:07 +02:00
Martin Plicht d84d42717e C4Object: Call Contents.GetLastObject() instead of accessing Last link directly 2014-10-25 21:26:06 +02:00
Martin Plicht b2fcc2ee32 C4EditCursor: Instead of manual list traversal use iterator 2014-10-25 21:26:06 +02:00
Martin Plicht f1808212db C4Player: Remove CursorLeft/Right (unused) 2014-10-25 21:26:06 +02:00
Martin Plicht 03f43f462b C4ObjectList: Replace trivial cases of manual list traversal with iterator usage 2014-10-25 21:25:52 +02:00
Martin Plicht cbf2136c58 C4ObjectList: Add more iterator functionality
This includes a reverse view on the list to iterate over and some utility iterator methods. An iterator now stores a copy of its current object link so that the copy's fields can be adjusted in case of object removal and pending iterations will not skip over some objects which would be the case when advancing the iterator position instead of adjusting the copy's fields.
2014-10-25 18:43:23 +02:00
Armin Burgmeier 178008928b Apply ClrModMap to meshes pixel-by-pixel
The support is not yet fully implemented; there are some transformations
missing. However, since the FoW support at the moment seems to be broken
(#1168) this feature cannot be tested properly.
2014-10-21 17:26:22 -04:00
Armin Burgmeier a34cd5711c Add support for custom shaders in mesh material scripts 2014-10-21 15:19:30 -04:00
Armin Burgmeier 2f6d1eaa1f Parse program definitions from the material file 2014-10-21 15:19:30 -04:00
Armin Burgmeier 99fe2eca4f Fix gcc warnings about missing initializers 2014-10-21 15:19:30 -04:00
Tobias Zwick e6348f0cee add check to clip ray trace calculation for beams outside of viewport 2014-10-19 21:35:15 +02:00
Tobias Zwick 6fda51903a change a macro into an inline function, add documentation, correct indentation 2014-10-19 21:32:04 +02:00
Tobias Zwick c823eea971 fix clipping bug and document more of C4FoWLightSection 2014-10-19 15:07:15 +02:00
Armin Burgmeier d1ea85d8d4 Remove now unused C4FacetEx::DrawLineDw 2014-10-18 13:41:06 -04:00
Armin Burgmeier 8146419e2d Use PerformMultiLines in C4Object::DrawLine 2014-10-18 13:35:20 -04:00
Armin Burgmeier 25b259ae20 Fix implementation of C4Draw::DrawLineDw (#1164) 2014-10-18 13:14:17 -04:00
Armin Burgmeier 45897241f2 Remove debug logs 2014-10-17 18:28:17 -04:00
Armin Burgmeier 45d090ae37 mape: initialize the landscape pixmaps (#1162) 2014-10-17 18:27:31 -04:00
Armin Burgmeier 6d983e5174 mape: use global texture map
Otherwise certain script functions would only access an empty texture map
2014-10-17 13:22:57 -04:00
Sven Eberhardt e6ed26cfc4 Fix pixel masks Solid/Liquid/Background in map scripts.
Solid/Liquid/Background depend on PixMaps in C4Landscape being updated to currently loaded materials.

PixMaps should really be functions of C4MaterialMap and C4TextureMap. It's probably still broken in mape.
2014-10-17 01:10:47 +02:00
Sven Eberhardt e23c009fd9 Fix thread guards to use thread IDs instead of handles (#1161)
GetCurrentThread() returns the same pseudo-handle for every thread. It cannot be used to determine if two calls were made from the same thread.
2014-10-16 20:22:38 +02:00
Philipp Kern 20701562e8 Allow distributions to use the system tinyxml.
Add a new cmake option WITH_SYSTEM_TINYXML=ON that allows to use the system
tinyxml library and header instead of the bundled copy. Adjust the include
path in the single source file referencing the header and add the thirdparty
path to the include search path if the use system option is unset or off.
2014-10-16 11:52:44 -04:00
Armin Burgmeier 5e43e595d3 Make attached meshes use their own blit parameters (#1095)
This might break some scenarios which for example change the color modulation
of a clonk and then expect that also its shovel or other objects get colored.
Such scenarios need to be fixed by also coloring the attached objects. This
might not be very convenient, and maybe we should introduce an option for
attached meshes to use the old behaviour (take blit parameters from main
object).

However, let's see how this change turns out in practise and then we see
whether further modifications are needed.
2014-10-16 11:50:30 -04:00
Tobias Zwick 5f99f9ca43 add documentation to C4FoWBeam 2014-10-12 21:04:44 +02:00
Tobias Zwick 3fd426dc04 revert my fix from yesterday 2014-10-12 13:00:52 +02:00
Tobias Zwick 7963065eb8 rename C4FoWRay to C4FoWBeam, add some documentation 2014-10-12 12:59:25 +02:00
Tobias Zwick d859789d96 fix some build problems 2014-10-12 02:17:05 +02:00
Tobias Zwick 4257f871c6 fix the brightness of "explored" areas does not reset to 0 2014-10-12 01:36:23 +02:00
Tobias Zwick 21e532da23 split up C4FoW header and source file into one file for each class
* added some class and method documentation, removed some superfluous comments like

	void C4FoW::Update(C4Rect r)
	{
		// Update all lights
		...

* added ASK comments that need clarification before proper documentation
2014-10-11 23:13:10 +02:00
Armin Burgmeier e5d1182cce Add the Anim_RDir AVP 2014-10-09 17:11:13 -04:00
Armin Burgmeier e4ad7ddc2d Rename Anim_RDir to Anim_AbsRDir 2014-10-09 17:07:52 -04:00
Armin Burgmeier 9fb0cdbdef Add a min_rdir parameter to Anim_RDir 2014-10-09 17:05:24 -04:00
Armin Burgmeier cbdc6040e7 Add the Anim_Dist AVP 2014-10-09 17:00:26 -04:00
Sven Eberhardt ca64fad8b5 Fix lobby team distribution settings hotkeys (#1133) 2014-10-09 20:40:01 +02:00
Sven Eberhardt 7450a83746 Add missing tuple header #include. 2014-10-09 20:35:43 +02:00
Armin Burgmeier de5e7d63db Render all PXS in one batch (#1135) 2014-10-08 18:33:46 -04:00
Armin Burgmeier b06e10e03b Add PerformMultiTris to draw many texturized triangles at once 2014-10-08 18:33:46 -04:00
Armin Burgmeier 2e03c3157b Remove C4Draw::PerformLine
It is no longer used
2014-10-08 18:33:46 -04:00
Armin Burgmeier a597dc28d7 Use PerformMultiLines where appropriate 2014-10-08 18:33:46 -04:00
Armin Burgmeier 9e81de1e77 Add the PerformMultiLines function
This function can be used to efficiently draw many lines
2014-10-08 18:33:46 -04:00
Armin Burgmeier 05a3e86472 Make C4EditCursor use PerformMultiPix instead of DrawPix for selection frame 2014-10-08 18:33:45 -04:00
Armin Burgmeier c1f1a623fb Remove PerformPix in favor of PerformMultiPix 2014-10-08 18:33:45 -04:00
Armin Burgmeier 1c7b8ba9b5 Add PerformMultiPix method to draw many pixels at once 2014-10-08 18:33:45 -04:00
Armin Burgmeier 1da4a9bd44 Move shader classes to C4DrawGL 2014-10-08 18:33:45 -04:00
Peter Wortmann c2f57db54b fix merge 2014-10-07 23:38:24 +02:00
Sven Eberhardt 787b7609c7 Change IRC default server to irc.euirc.net.
Was Hamburg server (which doesn't exist any more).
2014-10-07 21:19:52 +02:00
Armin Burgmeier 785c74015e Override std::exception destructor in C4DrawMeshGLError
Otherwise the default destructor does not always have the throw() attribute.
This (hopefully) fixes the autobuild on Linux.
2014-10-07 13:28:46 -04:00
Armin Burgmeier d47a416c0f Keep track of shaders in StdMeshMatManager
This replaces the fragile ShaderRef construction in StdMeshMaterialPass, and
it allows to re-use shaders and/or programs between different materials. This
is some more preparatory work for custom shaders.
2014-10-07 12:38:08 -04:00
Tobias Zwick b11e8d5d7a Merge branch 'master' into lights
Conflicts:
	planet/Graphics.ocg/LandscapeShader.c
	src/graphics/C4DrawGLMesh.cpp
	src/graphics/C4DrawGL.cpp
	src/landscape/C4Landscape.cpp
	src/landscape/C4Landscape.h
	src/landscape/C4LandscapeRender.cpp
	src/landscape/C4Scenario.cpp
	src/landscape/C4Scenario.h
2014-10-06 23:27:16 +02:00
Armin Burgmeier a03ec84374 Fix extraction of language names for language options (#1127)
At least in some implementations, std::regex does not treat $ and ^ as the
beginning or end of a line but as the beginning or end of the whole string.
2014-10-06 13:03:32 -04:00
Sven Eberhardt 840b9cd30a Fix off-by-one error in text line break code (#1122) 2014-10-05 18:10:23 +02:00
Sven Eberhardt ee80b46841 Fix possible race condition on update check in network game list.
Also avoid repeated parsing of update reply on every network event.
2014-10-05 15:11:06 +02:00
Sven Eberhardt e740938bbb Fix .ocu updates and allow direct download of installer for future updates. 2014-10-05 14:32:23 +02:00
Sven Eberhardt f8f232a275 Fix build without automatic updates. 2014-10-04 23:01:53 +02:00
Tobias Zwick 90b86dbf69 seperate update server from masterserver
Don't query the masterserver for a new version, instead ask the update server directly.
2014-10-04 22:50:46 +02:00
Armin Burgmeier f23d745b1d Reorder submeshes by opacity after material change (#1125) 2014-10-04 16:12:13 -04:00
Tobias Zwick 88c890eb74 change update server address 2014-10-04 17:43:12 +02:00
Sven Eberhardt ffdd2f37eb Fix recursions caused by modal league dialogues during game execution and game end (#1118). 2014-10-04 00:16:03 +02:00
Sven Eberhardt c86ea9ad53 Reset gamma ramp in game deinitialization (#1114). 2014-10-03 23:42:39 +02:00
Sven Eberhardt 828eb7f82a Don't save ControlTick and SyncRate in network savegames (#1058). 2014-10-03 23:12:55 +02:00
Armin Burgmeier 15c2497311 Serialize mesh materials in savegames (#1121) 2014-10-03 16:39:03 -04:00
Sven Eberhardt f815613ce8 Don't force league settings on scenario parameters if league is enabled during single player scenario selection (#1120). 2014-10-03 21:25:25 +02:00
Sven Eberhardt 3c731729b4 Fix bogus warning about missing AchvDone.png files (#1119) 2014-10-03 20:58:49 +02:00
Sven Eberhardt 91800fcfec Implement setting for forced values of parameters in league games. 2014-10-03 14:02:28 +02:00
Sven Eberhardt 05631742c8 Allow definition of achievements in parent (.ocf) folders.
Note that regular scenario parameters cannot be defined in folders because that would complicate savegames, records, etc.
2014-10-03 12:17:12 +02:00
Sven Eberhardt cd9d655ad9 Fix local scenario achievement graphics for achievement values larger than 1. 2014-10-03 00:49:03 +02:00
Sven Eberhardt 02150f7298 Change default master server to league server. 2014-09-30 20:59:16 +02:00
Martin Plicht e395e0741d C4Network2IRC: Remove call to boost::cref which seems to be unnecessary since C4GUI::Ico_Error is just an integer 2014-09-29 22:28:01 +02:00
Armin Burgmeier a2b7dd9e4b Fix crash in mape when unknown texture is encountered (#1113) 2014-09-28 16:34:41 -04:00
Sven Eberhardt 3fc1f02c6d Implement custom scenario parameter selection in startup scenario selection dialogue and by command line. 2014-09-27 16:05:32 +02:00
Sven Eberhardt 131cc016cb Fix C4PropList::RemoveCyclicPrototypes() declaration 2014-09-26 22:11:10 +02:00
David Dormagen c09764b3fd fixed CreateParticleAtBone (would create particles at a wrong position)
Also set "amount" to min. 1 because that's what intuition would dictate.
2014-09-26 21:32:08 +02:00
Sven Eberhardt 44e5c2542f Fix crash when loading proplists with non-static prototypes from saved games.
The code accessed a non-denumerated pointer.
2014-09-26 19:31:26 +02:00
Sven Eberhardt 58588fbc58 Replace !strncasecmp by SEqual2NoCase to fix MSVC build (strnicmp seems to not work on mac). 2014-09-25 15:15:50 +02:00
Sven Eberhardt 86bcd248a1 Fix crash in AddMenuItem if caption contains %s and pDef is NULL. 2014-09-25 15:14:51 +02:00
Martin Plicht 3144b74f36 C4GameScript: Add some explicit cast because clang 2014-09-24 23:41:36 +02:00
Martin Plicht 1dfa21daaa C4ScenarioParameters: Use strncasecmp instead of strnicmp because POSIX 2014-09-24 23:41:24 +02:00
Sven Eberhardt abab7be591 Added scenario achievements displayed as small symbols beside the scenario name in the startup selection screen.
They can be used e.g. to show that you have finished a scenario on different difficulty levels.
2014-09-24 23:08:40 +02:00
Sven Eberhardt 378bda5546 Added custom scenario parameters (SCENPAR_*).
Can currently only be set in network games in the lobby. In the future, maybe we can find a place somewhere in the scenario selection dialogue.
2014-09-23 23:02:52 +02:00
Sven Eberhardt ecdcb58bf6 Fix mouse cursor graphics when scrolling and outside viewport.
Cursor indexes were off by one.
2014-09-21 23:59:50 +02:00
Martin Plicht cf474e99aa mac: Rearrange sound toolkit includes and FindAudio.cmake so that sound+music works for OSX 2014-09-21 22:16:54 +02:00
Armin Burgmeier faa9667b66 mape: Add map zoom option 2014-08-24 13:20:23 -04:00
Sven Eberhardt 0f48e7ef44 Fix simultaneous setting of zoom value and zoom limits in SetPlayerZoom(ByViewRange)() script functions when new zoom value lies outside previous zoom limits.
Simply fixed by adjusting zoom limits first, then setting the zoom value afterwards.
2014-08-12 15:27:57 +02:00
Sven Eberhardt b1db0c7918 (Re)implement text completion in dialogue text windows as an async control. Default to Space, i.e. MenuOK. 2014-08-10 20:58:26 +02:00
Sven Eberhardt 9dd600c26b Add player parameter to SetPlayList (#1084) 2014-08-07 17:33:36 +02:00
Sven Eberhardt 144c8f8388 Implement music volume setting for OpenAL 2014-08-07 17:30:36 +02:00
Sven Eberhardt 271ef8ca09 Implement looping for OpenAL music.
Also added some error logging.
2014-08-07 15:51:58 +02:00
Sven Eberhardt cfe242b2b8 Implement ogg file playing for OpenAL-based audio system. (#1096) 2014-08-07 13:46:45 +02:00
Sven Eberhardt 4f1aa7c5cf Destroy single pixels of non-diggable material [ala] 2014-08-05 17:02:20 +02:00
Armin Burgmeier c6216ddef5 mape: Initialize random number generator (#1094) 2014-08-05 09:30:49 -04:00
Armin Burgmeier dbadd3bcbe mape: Show rendering time in statusbar 2014-08-04 16:27:07 -04:00
Armin Burgmeier 7339f7ae8d mape: Re-initialize script engine between renderings
Otherwise there are warnings when the user changes the value of a
constant, since it was initialized with a different value at the
time of the previous rendering.
2014-08-04 16:27:06 -04:00
Armin Burgmeier cee110de34 mape: Set output window size to size of generated map
This is useful when a Map.c script specifies the size of the map.
2014-08-04 16:27:06 -04:00
Armin Burgmeier 0c4bbfaf16 mape: Load the Library_Map script 2014-08-04 16:27:06 -04:00
Armin Burgmeier 428046400d mape: Implement minimalist C4DefList 2014-08-04 16:27:06 -04:00
Armin Burgmeier 4267d07616 mape: Also load syntax highlighting from current directory and repository 2014-08-04 16:27:06 -04:00
Armin Burgmeier 08cdf0e301 mape: Initialize script engine only once instead of per-rendering 2014-08-04 16:27:05 -04:00
Armin Burgmeier bac7a89ce1 mape: Make sure error messages from the linker are shown 2014-08-04 16:27:05 -04:00
Armin Burgmeier d32eb98ee1 mape: Fix crash when InitializeMap() returns false 2014-08-04 16:27:05 -04:00
Armin Burgmeier cd388ba178 mape: Add syntax highlighting for Map.c files 2014-08-04 16:27:05 -04:00
Armin Burgmeier afa32381ad mape: Default to the new map generator
Only use the C4MapCreatorS2, when the file is called "Landscape.txt".
2014-08-04 13:04:35 -04:00
Armin Burgmeier ade34f5efe mape: Add interface to run the new script map generator 2014-08-04 13:04:35 -04:00
Armin Burgmeier 6143f884f0 Allow MapScript generator to use non-global material and texture maps 2014-08-04 13:04:35 -04:00
Armin Burgmeier f25ec83568 Link C4MapScript into mape
Remove the two dependencies to ::Game from C4MapScript, so that ::Game
does not need to be linked into mape, which would basically drag the
whole rest of the engine after itself.
2014-08-04 13:04:35 -04:00
Armin Burgmeier 92720cf490 Allow C4ScriptHost to load a script from memory
This will allow mape to feed the Map.c that is being edited directly to
the map generator.
2014-08-04 13:04:34 -04:00
Nicolas Hake 227d3d760d Ship a fallback natupnp.h
MinGW doesn't bring a natupnp.h out of the box. Add one to the repository
so MinGW builds also support UPnP/NAT-PMP.
2014-08-03 21:48:53 +02:00
Armin Burgmeier 42c1826935 mape: Don't hold the GDK thread lock (#1091)
The lock was from times when the GTK+ widget was updated directly
from the render thread, but this is not the case anymore, so it
can be removed without substitution.
2014-08-03 12:44:02 -04:00
Nicolas Hake 642ce2eb9c Merge all of the audio provider switches into one
There's no point in splitting the audio library selection into multiple
CPP macros, since there can always only be one anyway. Merge all of them
into a single macro AUDIO_TK (for "toolkit") and have CMake select one
for the user, instead of making him choose (and potentially failing).
2014-08-01 23:37:42 +02:00
Sven Eberhardt fafa97e72b Fix memory leak in particle system.
Particle chunks were removed from the list (in the particle thread), but never deleted. They must be deleted from the main thread since it will delete GL objects. So simply delete empty chunks in the drawing proc.
2014-07-20 19:21:00 +02:00
Sven Eberhardt 6f1472e706 Revert pathfinder bug introduced in 086e3e9e10 2014-07-13 14:36:36 +02:00
Julius Michaelis 0476acef4f Fix landscape generation bug introduced by 2c7d9c0549
<Sven2> Your fix of the parent check for points in the landscape.txt parser. if (!(pToNode->Type() == MCN_Overlay))
<Sven2> It should also allow the poly algo in maps
<Sven2> i.e., make it if (!(pToNode->Type() == MCN_Overlay) && !(pToNode->Type() == MCN_Map))
<Sven2> Actually, better make it if (!pToNode->Overlay())
2014-07-09 17:02:02 +02:00
Sven Eberhardt ac395ba65f Increase display time of global messages.
Global messages are usually important and contain story elements, game goals, etc. So they should stay for a bit longer than e.g. object status messages.
2014-07-05 16:44:48 +02:00
Sven Eberhardt 5cd9b915b0 Added some dialogue functions and speaker portraits. UpdatedAddMenuItem and CustomMessage to allow more customization for picture graphics.
I would prefer to render the models for speaker portraits directly. However, it seems like it's not currently possible to clip or render models to offscreen surfaces.
2014-07-05 15:25:30 +02:00
Sven Eberhardt 4556cb4890 Add particle value provider function PV_Sin 2014-06-30 01:00:15 +02:00
David Dormagen fb1ee2f88f the Trans_* mesh-transformation-functions are now implemented in the Engine instead of System.ocg 2014-06-27 20:36:47 +02:00
Günther Brammer 8780a69b51 Improve the messages for path problems
C4Group::Open would sometimes overwrite more specific error messages or
not mention the problematic path. DirectoryIterator::Read also now mentions
more detail. Two superfluous messages were removed to make space.
2014-06-09 04:17:17 +02:00
Günther Brammer 42602fc79a Finish DEBUGREC compile option removal
Except for the DEBUGREC_RECRUITMENT option available in C4Include.h
2014-05-28 03:38:11 +02:00
Kevin Zheng 6a1a551d01 Clean up deprecated headers and functions
"gdk_pixbuf_unref has been deprecated since version 2.0 and should not be
used in newly-written code. Use g_object_unref()."

sys/timeb.h isn't used anymore since 2005.
2014-05-27 00:30:20 +02:00
Günther Brammer 38f6c1802b Remove unused MSVC project files for tstc4netio and netpuncher 2014-05-25 22:47:56 +02:00
Günther Brammer 130a275dea Correct a comment about GetDataString safety 2014-05-25 22:47:56 +02:00
Kevin Zheng f76856ae97 Use the Linux paths for everything that isn't a Mac or Windows
Specifically, FreeBSD. Assuming something POSIX-like if there is no
specific code for the target OS is a good idea in general, though.
2014-05-25 22:47:56 +02:00
Sven Eberhardt 91c2d49d2a Remember league login name and password token.
Also removed some CUID/Webcode authentification code from engine.
2014-05-18 15:10:00 +02:00
Sven Eberhardt efcdf6fa68 Fix hanging network thread due to timing calculation errors in UDP network class.
GetNextTick() may sometimes return a tick in the past, which calculations need to consider.

This might also fix #1076.
2014-05-18 13:41:47 +02:00
Günther Brammer b7a022852e Revert "Move C4Aul code into separate subdirectory"
The distinction between the "aul" and "non-aul" parts of
the script engine are mostly historical accident, and the
current organization of the source code does not use
sub-subdirectories. I'd like to keep it that way.

This reverts commit 69ba06b8d0.
2014-05-12 02:24:19 +02:00
Clonkonaut a5040fe0ad Fixed potential crash in certain doomsday scenarios. 2014-05-11 22:04:51 +02:00
Nicolas Hake 69ba06b8d0 Move C4Aul code into separate subdirectory 2014-05-11 16:17:48 +02:00
Sven Eberhardt 488044f266 Added script function GetPlayerZoomLimits (#1071). 2014-05-11 11:10:13 +02:00
Sven Eberhardt 893d5e87da Implement PLRZOOM_Set flag to allow setting current zoom and limits in the same call. 2014-05-11 10:30:41 +02:00
Nicolas Hake 0f48e0c4b9 Aul: ExtraWarn when turning a fn varargs in body
Par() calls and '...' in function calls make functions take varargs
without this being obvious from the header. ExtraWarn about this so people
who care about it can add an ellipsis to the parameter list.
2014-05-04 17:15:43 +02:00
Nicolas Hake 8ab7a83e3b Aul: Allow '...' as final parameter in func decls
Accepting an ellipsis as the final parameter in a function declaration
makes it immediately obvious that the function can take a variable number
of parameters
2014-05-04 17:15:42 +02:00
Sven Eberhardt 91db5d33c2 Added SolidMaskPlane property.
If an object moves and other objects are attached to its SolidMask, only objects in front of this plane are moved along with it. Defaults to Plane if zero.
2014-05-04 14:16:46 +02:00
Sven Eberhardt 4f43da9999 Fix SolidMasks defined in DefCore.txt for objects with mesh graphics.
There were a few leftover checks from when SolidMasks could only be defined for definitions with bitmap graphics.
2014-05-04 14:16:46 +02:00
Nicolas Hake 48c1f387f0 Require semicolon after 'do' loop
This makes C4Script consistent with C-based languages, and current usage
on master shows that in the majority of cases, the author expected to have
to place a semicolon after the loop anyway.
2014-05-03 10:07:41 +02:00
Sven Eberhardt 79edc9917a Fix crash on DugOut callback if an unloaded definition is referenced in material Dig2Object. 2014-05-01 17:15:14 +02:00
Clonkonaut bf0d6b7176 Reactivated EditCursorModeToggle key (formerly Space) now set to no key.
Can be set in KeyConfig.txt as requested by Sven2.
2014-05-01 01:17:58 +02:00
Clonkonaut 3d224c1207 Added new callback: DugOut(object object_by).
Called in a new object that is created from digging out material.
2014-05-01 01:04:41 +02:00
Sven Eberhardt 45f69abb6e Revert engine-side league localization
The engine cannot know about all future league strings. Instead, localize server-side using language id from http request.
2014-04-27 15:42:47 +02:00
Martin Plicht 9bcb313f3e C4GameScript: Do not use TRUE literal 2014-04-24 12:40:30 +02:00
Maikel de Vries 653b135919 Move contents ejection on death after Death Call
This allows the scripter to access the contents in OnClonkDeath and similar callbacks preventing solutions using effects or static variables.
2014-04-22 20:15:26 +02:00
Sven Eberhardt cd4b3610da Add script function SetPlayerZoom to set zoom factors directly instead of by view range (#1065) 2014-04-21 19:38:05 +02:00
Sven Eberhardt 1d0ebcd3a3 Added mode TopOpen=2: Pixels above landscape are partly free and partly solid depending on corresponding top row map IFT. Analogous to BottomOpen=2. 2014-04-21 02:01:17 +02:00
Sven Eberhardt bddd6d0a01 Fix assertion in SetLeagueProgressData without player ID set 2014-04-20 20:10:53 +02:00
Sven Eberhardt b8cd437fc9 Fix C4ID parameters to engine functions. 2014-04-20 18:43:29 +02:00
Sven Eberhardt 4266b370d6 Added script functions SetLeagueProgressData, GetLeagueProgressData, GetLeagueScore and SetLeaguePerformance. 2014-04-20 15:33:36 +02:00
Sven Eberhardt 445d759a72 Change == and != to do pointer comparison on arrays and proplists (formerly === and !==). Remove === and !=== and introduce function DeepEqual for contents comparison.
There have been some bugs and crashes related to unwanted deep comparison (e.g. in the maze scenario). Scripters very rarely need deep comparison, so it should not be the default for the most commonly used operator.

This also changes behaviour of GetIndexOf to do pointer comparison.

This change has Guenther's seal of approval.
2014-04-19 22:33:31 +02:00