Commit Graph

6686 Commits (48ae42f87e82f26e696ba62c1f4de82d90949522)
 

Author SHA1 Message Date
Peter Wortmann 48ae42f87e Hard-code line endings of shell scripts to LF
No idea whether this is the right way to do this.
2015-02-23 11:54:37 +01:00
Maikel de Vries bd9da84fcb allow developers to also let airplane face left 2015-02-23 11:13:02 +01:00
Peter Wortmann d976a4b2a7 Reworked CalculateTriangles, fixed descend collision
Descend collision was broken because of two reasons - one complicated and
one easy. Firstly, we would not re-visit beams after eliminations if they
were closer to the light source than the remaining beam. Especially nasty
because the comments claimed the opposite. Secondly, the coordinates
passed to find_cross were actually flipped.

I took the opportunity to clean up the control structure a bit, update
the comments (brr), and fix the bug in one swoop.
2015-02-22 23:12:12 +01:00
Peter Wortmann 52a2f4bb8e Added (optional) debug logging to CalculateTriangles
Sadly it's virtually impossible to tell what's going on without this kind
of thing.
2015-02-22 23:11:44 +01:00
Peter Wortmann 696ebb083f Decrease threshold for eliminating small rays
There's no point in having rays smaller than 1/10 px. This also, again,
prevents floating point rounding causing consistency problems.
2015-02-22 23:11:44 +01:00
Maikel de Vries 94019dd335 callback for projuct ejection in producer library 2015-02-22 19:03:30 +01:00
Nicolas Hake 72beae8100 Shortcut C4Surface::GetTexAt for unsplit texture
In the very common case where the C4Surface only uses a single texture
to store its data, a lot of work GetTexAt is actually unnecessary. Split
it up so we can inline the fast path and only fallback to the slow path
when the surface is split up into multiple textures.
2015-02-22 17:06:35 +01:00
Nicolas Hake 32ecf51029 Don't use std::auto_ptr
Ever.
2015-02-22 17:05:41 +01:00
Nicolas Hake 75c2b8e61c GL: Dump list of supported extensions with --debug-opengl
glGetString(GL_EXTENSIONS) is deprecated starting with OpenGL 3.0.
Instead, you're now supposed to retrieve the list of extensions one by
one with glGetStringi.
2015-02-22 15:52:38 +01:00
Nicolas Hake bc6ce0251f Make private funcs in C4ParticleValueProvider, well, private
We're not inheriting from C4PVP, and all of these internal functions
really shouldn't be called from outside the class. So private is what
they should be.
2015-02-22 11:30:12 +01:00
Nicolas Hake 39bbcbb9ee Win32: Don't hook assertion handler when debugging
Sven2 reports he can't get reliable stack traces from his debugger when
the assertion handler is installed. Since there's no need for the hook
when we're already running under a debugger, don't install it.
2015-02-21 19:40:35 +01:00
Nicolas Hake 0b55cea227 Disable assertions in non-debug builds
Making the engine terminate when an assertion fails is a good thing in
debug builds, but keeping them enabled in release builds only hurts our
users.
2015-02-20 23:36:36 +01:00
Nicolas Hake 6e41694495 GL: Check for OpenGL 2.1 on startup
We've been using OpenGL 2.1 features for some time now, and hardware has
started supporting OpenGL 2.1 in 2005. I doubt this will make anyone
unable to run the game, and it's certainly better than crashing because
of a nullpointer dereference when some GL function we use can't be
found.
2015-02-19 13:36:01 +01:00
Nicolas Hake bd4e772b7d Win32: Correctly deselect OpenGL context
The MSDN reference for wglMakeCurrent states that the first (hdc)
parameter is ignored when the second one is NULL. This is incorrect: it
checks validity of the hdc parameter before doing any work. Since we
have a DC anyway, it's no problem to pass that to wglMakeCurrent.
2015-02-19 13:04:30 +01:00
Nicolas Hake c1bb56e1f1 Win32: Don't write log to stdout in GUI apps
In applications targeting the GUI subsystem, stdout and stderr aren't
valid file handles, and trying to write to them sets the system error
code to ERROR_INVALID_HANDLE.
2015-02-19 13:02:16 +01:00
Nicolas Hake ceeb322a87 Win32: Keep GL error dialog from immediately closing
GL startup failures call Application.Clear(), which will at some point
before creating the error dialog post a WM_QUIT. When the dialog box's
message loop retrieves that message, it will shut down the dialog box,
thus ensuring that the user will never see it.
So before showing the dialog box, we have to dispatch any pending
messages, then retrieve the WM_QUIT ourselves, run the dialog box, then
re-post the WM_QUIT.
2015-02-18 23:02:34 +01:00
Maikel de Vries ba9a5fd757 fix fire spreading (#1276) thanks to Armin 2015-02-18 21:52:39 +01:00
Maikel de Vries 40e0ea7bfc fix door control for wooden cabin 2015-02-18 18:25:49 +01:00
Sven Eberhardt fe1ecd2424 Implement loading of serialized light sections. 2015-02-17 21:05:52 +01:00
Maikel de Vries 1687b34fd3 fix script runtime error in fire effect when object is deleted on incineration 2015-02-17 20:55:17 +01:00
Nicolas Hake 26043e7e81 GL: Return a reasonable string for GL_DEBUG_SEVERITY_NOTIFICATION 2015-02-17 19:45:08 +01:00
Sven Eberhardt 68eb45732e Log all relevant data for reproduction on tri.fanRY > tri.fanLY assertion.
Just compiling the logged light section and calling CalculateTriangles on it should be used to reproduce the assertion.
2015-02-17 01:31:10 +01:00
Nicolas Hake 9bfd232ab5 Test whether GLDEBUGPROCARB's userParam is const or not
Depending on how current your headers are, the userParam parameter to
GLDEBUGPROCARB may be const, or it may not. The ARB has added the const
qualifier at some point after publishing the specs. Hooray for breaking
API changes.
2015-02-16 21:21:31 +01:00
Maikel de Vries 15f75f072b show exit interaction when inside object (#1169) 2015-02-16 20:31:29 +01:00
Maikel de Vries d1577dce61 fix failure sequence for Chine.ocs 2015-02-16 20:29:45 +01:00
Nicolas Hake feb9513666 GL: Use GLAPIENTRY instead of APIENTRY
They're the same on Windows, but Linux doesn't have APIENTRY at all.
2015-02-16 18:48:35 +01:00
Nicolas Hake 4db690b0c6 Add copyright header to files that were missing it 2015-02-16 18:40:52 +01:00
Nicolas Hake 04df02c9df Win: Don't write a text crash dump if the log is already closed
Assertion failures or crashes during process shutdown must not write to
the log file if it is already closed, or the debugging CRT will raise
another assertion.
2015-02-16 18:14:29 +01:00
Nicolas Hake c809ab4ae3 gl: Use glDeleteTextures instead of glDeleteObject to delete textures
glDeleteObject doesn't delete textures, it deletes shader objects.
2015-02-16 18:07:03 +01:00
Nicolas Hake 50a81a8dc7 gl: Don't call glDeleteObjectARB on null objects
glDeleteObjectARB will flag GL_INVALID_PARAMETER when it's called with a
null parameter. Avoid this so the error list doesn't get tainted.
2015-02-16 17:45:17 +01:00
Nicolas Hake cac94659d0 wGL: Allow OpenGL debugging
This introduces a new command line parameter "--debug-opengl", which
will create special debug OpenGL contexts and attach a callback that the
driver will invoke when it detects a problem. The callback will then
write the error message to the logfile, and break into the debugger if
one is attached.
Currently only works on Windows.
2015-02-16 17:45:10 +01:00
Nicolas Hake 00a24846cc GL: cast gluErrorString rv to const char* before handing to StdStrBuf 2015-02-16 17:44:20 +01:00
Maikel de Vries d2988163f5 fix flag marker redrawing on owner change 2015-02-16 17:17:18 +01:00
Nicolas Hake eed1c43b8a GL: Correctly encode error strings
gluErrorString returns latin-1 encoded strings. Our code expects to
receive UTF-8 encoded strings everywhere, so make sure that the strings
are converted before passing them on.
2015-02-16 15:39:05 +01:00
Maikel de Vries 49997045f6 fixed burned wind generator radiusin Mine Rescue 2015-02-16 14:17:05 +01:00
Maikel de Vries 346d5cd709 another batch of Graphics.png removals 2015-02-15 22:37:08 +01:00
Maikel de Vries 41040eebfd clean up dynamite box and fix (#1265) 2015-02-15 21:33:52 +01:00
Nicolas Hake a70433b6a7 Skip drawing line objects with less than two vertices (#1263)
A line object must have at least two points to plot a line through. At
any vertex count less than that, we were accessing invalid memory by
dereferencing the first element of an empty vector (VtxNum==1), or
issuing an OOB read from the vertex data (VtxNum==0).
2015-02-15 14:23:44 +01:00
Maikel de Vries 7f79c77af6 fix javelin direction when aiming 2015-02-15 12:25:03 +01:00
Maikel de Vries 6cd3b9775c fixed power need symbol display for elevator 2015-02-15 09:34:45 +01:00
Sven Eberhardt a7ecc86dc4 Hide normal maps from landscape drawing texture list in editor. (#1255) 2015-02-14 23:45:16 +01:00
Nicolas Hake 9093bde491 Suppress -Wcast-align on clang
Alignment doesn't matter on any platform we support, and unlike gcc,
clang uses natural alignment instead of required alignment to emit this
warning.
2015-02-14 19:45:32 +01:00
Maikel de Vries a5b6066f25 fix removal of ownership on flag movement 2015-02-14 00:16:32 +01:00
Nicolas Hake cdd490b53c Set some warning flags when compiling with clang
The Clang warning flags are woefully underdocumented, so I've just
matched the g++ list in as much as I knew the flags existed.
2015-02-14 00:11:51 +01:00
Nicolas Hake 2b332f5a74 Adapt mape to C4Group changes 2015-02-13 20:22:41 +01:00
Nicolas Hake 09ad403d06 C4Group: Stop checking operator new return value
new throws std::bad_alloc on failure. It never returns NULL, so checking
for that is useless.
2015-02-13 19:46:11 +01:00
Nicolas Hake 48626ce7ae C4Group: Change int Status members to enums 2015-02-13 18:49:23 +01:00
Nicolas Hake 340e0e3f64 Remove unused C4Group::GetStatus 2015-02-13 18:37:20 +01:00
Nicolas Hake 413e66ff97 Move C4Group::PrintInternals out of C4Group
C4Group::PrintInternals is only used in the c4group command line tool.
Move the code there.
2015-02-13 18:25:21 +01:00
Nicolas Hake c1e113f1f9 c4group: Remove useless version history
A list of versions and dates isn't helping anyone, especially not if
no actual changelog is available.
2015-02-13 17:21:49 +01:00