Commit Graph

511 Commits (master)

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
Nicolas Hake 3edc6d9ead Fix misleading indentation on several controlled statements
The C++ standard doesn't require us to stuff multiple statements
onto the same line, so we should avoid this for readability reasons.
This is especially true if one of the statements is controlled and
others aren't.
2018-12-31 14:27:14 +01:00
Nicolas Hake dca6d2caaf C4Landscape: Correct really badly misleading indentation
Some code here was indented like it still belonged to the loop
above, but never did, and was never intended to. This is an
excellent argument for why braces are good, especially for
statements which span more than one line.
2018-12-31 14:17:23 +01:00
Lukas Werling 4a3c9f2fc2 Add EvaluateOnAbort scenario flag for Tower of Despair
In Tower of Despair, the scenario saves per-room progress in the
player files. Players win individual rooms, but never the whole
scenario. Consequently, they currently have to give up to make sure
they don't lose their progress. This is not intuitive at all. With the
new flag enabled, players will be saved even if the scenario is aborted.
2018-02-18 21:46:56 +01:00
Lukas Werling 5944146f2b Fix more broken entries in Scenario.txt (#1910) 2018-01-13 18:57:32 +01:00
Lukas Werling 54e5c6de38 Fix Sky definition not working (#1910) 2018-01-11 22:44:33 +01:00
Lukas Werling 4325de2084 Fix MCHalfVehic pixels in saved landscape
While saving the landscape, solid masks are temporarily removed. This
did not work for half solid masks, resulting in permanent solid masks
after restoring the save game.
2018-01-05 22:53:41 +01:00
Lukas Werling 91ff13b81f Clamp y coordinate when looking up Left/RightColPix, part 2 2017-12-28 23:20:56 +01:00
Lukas Werling 0167463c33 Change type of AutoScanSideOpen to int
This makes AutoScanSideOpen=2 actually possible.
2017-12-27 01:34:36 +01:00
Lukas Werling 75bd202ca9 Fix warnings in C4Landscape 2017-12-26 22:03:44 +01:00
Lukas Werling 2d7d7b86ae Clamp y coordinate when looking up Left/RightColPix 2017-12-26 14:31:43 +01:00
Lukas Werling 486c85ea76 Fix Left/RightColPix lookup 2017-12-26 14:14:17 +01:00
Lukas Werling d42e23a503 Change AutoScanSideOpen to check fg as well per default
The previous behaviour of only checking the background broke existing
maps and triggered some (performance?) bug in the mass mover. It is
still available by setting AutoScanSideOpen=2, for symmetry with
Top/BottomOpen.
2017-12-22 23:14:54 +01:00
Lukas Werling 9970b24375 Forgot to initialize RightColPix 2017-12-22 21:06:30 +01:00
Lukas Werling fa8f868ffb Change AutoScanSideOpen to be like Top/BottomOpen=2 (#1652) 2017-12-22 20:40:03 +01:00
Julius Michaelis be10e95698 Prevent SEGV on duplicate material names with different case (#1359) 2017-12-10 15:09:51 +01:00
Lukas Werling 5a652f23ef Fix missing C4PXSSystem::Clear implementation
On scenario section change, the old PXS would continue to exist.
2017-11-12 11:57:41 +01:00
Lukas Werling 587f5b5f0e Simplify C4PXSSystem
The old system allocated chunks of PXS on demand. I can't think of a
good reason to do this.

The savegame format changes slightly to not require saving full chunks,
however old savegames will still load fine (invalid PXS within chunks
are moved out during the next Execute() call).
2017-11-08 17:33:35 +01:00
Lukas Werling 607e8873e5 Fix landscape diff application (GH-58)
Savegames with a foreground material diff but no background material
diff would not apply the foreground diff at all. As the background
material rarely changes, this broke runtime joining for most scenarios.
2017-11-08 11:34:58 +01:00
Lukas Werling b94c3757a6 Fix water sliding on lava (#1946) 2017-10-14 17:46:04 +02:00
Kanibal e727d35202 Share time information (frameCounter and realtime) with landscape shaders 2017-08-23 23:53:55 +02: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
Nicolas Hake 95c31df9e9 Fix assertion-enabled build 2017-04-19 10:32:34 +02:00
Nicolas Hake c41bd063bd Stop disabling debugrec code by preprocessor
The optimizer is going to remove dead code anyway, and has the
additional advantage of doing syntax checking, so the code won't
silently break when someone changes something.
2017-04-19 09:47:21 +02:00
Nicolas Hake 81e49fe0f5 Fix several broken conversions from C4Fixed->bool->int (#1904)
This is why non-explicit operator bool is bad.
2017-04-19 09:24:27 +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
Nicolas Hake 007a05468e C4Scenario: Remove fixed char buffers 2017-03-23 16:35:25 +01:00
Nicolas Hake 41f4779d74 StdCompiler: Use terms "Serializer" and "Deserializer"
Instead of "Compiler" and "Decompiler", which make me look up what's
even going on each time I see them, use the standard terms "serializer"
and "deserializer".
2017-03-11 15:05:41 +01:00
Nicolas Hake d9f9d9ba38 C4MapCreator: Remove unused optional parameter
No code called C4MapCreator::Create with the fLayers parameter omitted
or set to false, so we can just remove it.
2017-03-11 11:35:33 +01:00
Sven Eberhardt 6937969175 Force pre-select definitions specified in [Definitions] section of editor template c4s (#1898) 2017-03-11 00:13:49 -05:00
Julius Michaelis d81a7f10e3 Silence a lot of inconsistent-missing-override warnings 2017-02-21 19:03:46 +01:00
Nicolas Hake 9a201441d5 Mat insertion: Fix broken conditional 2017-02-05 13:51:04 +01:00
Julius Michaelis 80c07d34e4 Add [Landscape] Secret to Scenario.txt to default-disable black NO_OWNER viewports
Related to: c569036d1d
2017-01-24 18:50:30 +01:00
Sven Eberhardt 771a82d879 Fix direct PXS insertion when multiple PXS are at the same location
When many PXS were at the same location (e.g. because of fast/multiple pumps pumping into a basin), only one PXS per frame could be inserted because insertion of one PXS would postpone insertion of additional PXS in the same frame until they finished their slide movement.

This caused some scenarios like Rapid Refining to become very frustrating, because adding extra pumps didn't actually do anything (unless you tricked the insertion by putting the output into the basin).

Now insert them directly if slide movement led to an insertion position.
2017-01-16 20:32:20 -05:00
Maikel de Vries ae6cdc6619 fix return value of InsertMaterial when a pixel is created
This is a partial fix for #1865. Also this return value still needs to be fixed for query_only == true, but that requires a bit more work in C4PXS.
2016-12-19 22:49:28 +01:00
Armin Burgmeier 88361ab606 Use NEAREST texture filtering for material map
The material map is 1D texture that contains information about every
material-texture combination. There is no point in linear filtering,
i.e. trying to interpolate between two materials such as gold and granite
or whichever two materials happen to be adjacent in the material map texture.

This might or might not be relevant to #1841, but should be more correct
behavior in any case.
2016-11-27 11:21:17 -08:00
Lukas Werling 6847e50e79 Implement setting shader uniforms from script (#1206)
Uniform variables are read from the "Uniforms" proplist set on Scenario
or on individual objects. Proplist keys are uniform names. Values can
either be an int or an array of one to four ints in C4Script. In GLSL,
the uniforms then need a matching type (int/ivec2/ivec3/ivec4). There is
no error reporting; uniforms are only set if both name and type match.

The implementation walks the "Uniforms" proplists on each Draw call. We
may need to cache the uniform maps if this turns out to be too slow.
2016-11-12 22:09:23 +01: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
Julius Michaelis 64dd72c380 Fix dedicated: Load JPEG surfaces so the texture shape information can be correctly generated 2016-10-30 21:36:29 +01:00
Lukas Werling 13fa0ab7b1 Implement adding/removing shaders from script
New script functions: AddFragmentShader, RemoveShader.

There is currently no support for adding vertex shaders.
2016-10-29 21:19:08 +02:00
Julius Michaelis 376ca5a9df Prevent using USE_CONSOLE in lib{misc,c4script} 2016-10-22 17:42:23 +02:00
Julius Michaelis 8d2f2846b5 Fix mac build
Also move some stuff around once again…
2016-10-21 01:25:48 +02:00
Julius Michaelis 34a9a1de8d Twiddle with header organization: lib{misc,c4script} do no longer include GL/glew.h
(Yes, it is just that complicated.)
2016-10-20 18:46:32 +02:00
Lukas Werling 59b5525a41 Rework sky definition parsing
This also adds a broken SetSky() script function which was the main
motivation for the rework. See #1827
2016-10-15 13:34:39 +02:00
Sven Eberhardt b95d1387a4 Editor: Add "reset to saved scenario" command 2016-09-07 01:53:54 -04:00
Sven Eberhardt 2c20204021 Add C4SECT_ReinitScenario flag for LoadScenarioSection
This also resets the script engine and does player init callbacks. Useful to restart the scenario in the editor.
2016-09-07 01:53:53 -04:00
Lukas Werling 3d5f2f012a Fix openclonk-server build 2016-09-06 22:12:06 +02:00
Sven Eberhardt a882a6e64b Fix black editor screen due to GL object creation and removal in wrong context 2016-09-06 02:45:17 -04:00