Commit Graph

31 Commits (60841c1d96073b0adbb687f29dfc059619ad3919)

Author SHA1 Message Date
Lukas Werling 60841c1d96 Write text files with unix file endings
The old LineFeed constant caused problems with Qt. Using \n directly is
easier and I don't think there's a reason left to use \r\n anyways.
We've always converted the files in the repository. Nowadays, even
notepad.exe works with unix file endings.
2019-02-19 15:28:12 +01:00
Tushar Maheshwari a661eab867 Automatic fixes using clang-tidy for header files
A follow-up on a previous PR GH-41. The discussion in the forum can be
viewed at http://forum.openclonk.org/topic_show.pl?pid=33086.
Run clang-tidy (without auto, pass-by-value and using checks) to fix the
header files not modified in the previous PR.

Summary of the changes:

 - C++11 member initialization.
 - nullptr instead of 0 for pointers.
 - override for functions declared virtual in base class.
 - default trivial special member functions
2017-05-15 13:46:46 +02:00
Tushar Maheshwari 3a4f49ad90 Revisit #includes
Consolidate the include statements scattered across the code in accordance
with the comment in C4Include.h. The advantages are listed in the same
comment.
Furthermore, it follows llvm-include-order which is the logical
extrapolation of the project's style guideline wherever possible
(C4Include.h being the most-frequent exception).
2017-05-15 13:24:59 +02:00
Tushar Maheshwari e58a7884e4 Automatic fixes using clang-tidy
See http://forum.openclonk.org/topic_show.pl?tid=3376 for discussion.

Close GH-41
2017-05-03 20:30:45 +02:00
Lukas Werling f03a1d618d Use average texture color for BMP palette
Previously, it would just use first pixel of the texture image. With our
current textures, this is a pretty bad approximation. For example,
firestone ends up yellow rather than red.

Additionally, this helps tools like mape/ocmapgen which do not load any
texture graphics but just set the texture's average color.

This also fixes the sky color which was previously overwritten.
2017-04-01 20:20:10 +02:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Nicolas Hake 0cbb476daf Remove re namespace alias
This alias is a legacy from when we were using Boost.Regexp to
workaround a broken implementation in GCC's libstdc++ earlier than 4.9.
2016-07-25 18:39:44 +02:00
Lukas Werling e33066a4f2 Rename SafeRandom() to UnsyncedRandom() 2016-04-25 17:32:23 +02:00
Lukas Werling febc5f91bd Replace rand() with SafeRandom() 2016-04-20 22:42:00 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Nicolas Hake 4fdafbc78a Move StdColors.h ref from C4Surface.h to files that actually need it
C4Surface.h doesn't require anything from StdColors.h, so there's no
reason to reference the latter there.
2016-02-08 02:13:18 +01:00
Sven Eberhardt fe05fb5b1a Fix loading of shape textures from packed groups (#1421). 2015-10-15 20:29:56 -04:00
Sven Eberhardt 675db52e38 Texture shape coverage fix and mape build fix. 2015-10-09 14:49:31 -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
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
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
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 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 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
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01: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
Nicolas Hake 6a5d738f03 Validate texmap entries on load (#1060)
This makes sure texmap entries look correct, thus avoiding a crash that
happened when the entry referenced a material without specifying a
texture.

Closes #1060.
2014-03-25 18:30:11 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Armin Burgmeier b6bcc0d36e Make a texture's average color able to be set externally 2013-01-14 01:41:22 +01:00
Armin Burgmeier 257db99165 Merge remote-tracking branch 'new/master' into mape
Conflicts:
	CMakeLists.txt
	src/graphics/C4Draw.h
2013-01-14 01:38:03 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Peter Wortmann d1c28227f3 Normal map support for lights
- The light direction change isn't really consistent, as I can only give
  GL the vectors at the triangle edges. So for deep rays, the light
  distribution often ends up being significantly different than for short
  rays.

- I *am* distorting the normal map vectors, quite badly actually. I'll leave
  it for the moment, because it definetely looks best for the light vectors,
  but I will have to correct that a bit once I have the time.
2012-09-05 21:51:25 +01:00
Günther Brammer a5b83665af Store all channels of a color together in CStdPalette
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.
2012-08-16 00:45:27 +02:00
Günther Brammer 1a29f8625d Reorder engine source file organization a bit
This mostly consists of flattening the hierarchy, splitting the
graphics stuff out of platform, and a few smaller cleanups.
2012-04-27 19:04:43 +02:00