Commit Graph

2846 Commits (stable-6.1)

Author SHA1 Message Date
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
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
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
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
Sven Eberhardt a7ecc86dc4 Hide normal maps from landscape drawing texture list in editor. (#1255) 2015-02-14 23:45:16 +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
Nicolas Hake 73862d8fcb Move C4Group::View out of C4Group
C4Group::View is only used in the c4group command line tool, so the
right place for that code is inside the tool. Added two public constant
accessors to return the header data and entries.
2015-02-13 17:19:37 +01:00
Nicolas Hake ff263e5433 Fix potential buffer overflow in ssprintf
If vsnprintf fails for other reasons than too small a buffer, it returns
a negative value. Comparing that with a size_t value promotes the
negative value to unsigned, which makes for a very large result, almost
guaranteed to be larger than the buffer size.
2015-02-12 23:55:38 +01:00
Nicolas Hake 95641b5fb0 Add a dummy declaration to ssprintf
G++ doesn't allow attributes on function definitions for reasons. Add a
declaration immediately before the definition so it works.
2015-02-12 23:14:16 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Nicolas Hake 35e7ca509b Replace NoPointer struct with template parameter deduction
We're trying to ensure that no caller passes a char* to ssprintf, but a
char array instead. This is way easier done by using template parameter
deduction than a specialized class template.
2015-02-12 22:25:36 +01:00
Nicolas Hake ea354218bb Remove unused private field StdMeshMaterialShader::Type
We'll keep the parameter just in case we'll ever need the info.
2015-02-11 20:48:18 +01:00
Nicolas Hake 2d1e4caabc Remove a superfluous endianness test
We're not supporting BE systems, and even when we did, I'm not sure this
test could ever have done something.
2015-02-11 20:41:35 +01:00
Nicolas Hake 81f9ee1c85 Reset C4Group search after Add() to invalidate stale directory cache
Adding a file to an on-disk unpacked C4Group file needs to reset the
directory cache so C4Group doesn't return old state later.
2015-02-08 22:28:33 +01:00
Nicolas Hake 06d86f7666 Split a return into multiple statements to make it less unreadable
IOCCC is that way ------->
2015-02-08 22:28:32 +01:00
Nicolas Hake 1a1cecadd4 Update license texts
Some files, most notably ObjC and test cases, hadn't been updated to use
the new license header. Fix this.
2015-02-08 15:05:11 +01:00
Sven Eberhardt cd3b969fc4 Silence a few warnings in render and SolidMask code. 2015-02-08 12:37:00 +01:00
Sven Eberhardt 4e65dccb1f Fix memory leak on CID_Animation_BaseInfo mesh chunk type.
Detected by a -Wunused warning.
2015-02-08 12:35:45 +01:00
Sven Eberhardt df97b485f9 Fix group loading order for definitions, sounds and graphics (#1253).
Graphics are now pre-loaded and may then be accessed in random order. Reduces Objects.ocd load time from 20 seconds to 1 second for me.

Some ordering is still broken (e.g. material.ocg and player files).
2015-02-07 14:01:15 +01:00
Sven Eberhardt 91fdb82720 Remove dupliocate sound loading. 2015-02-07 14:01:15 +01:00
Sven Eberhardt c94814f374 Fix signed/unsigned comparison warning. 2015-02-07 14:01:14 +01:00
Nicolas Hake e2a8f6d303 Reorder some declarations and initializations to avoid order mismatch
While none of the mismatches were having a side-effect, this silences a
number of -Wreorder warnings which were drowning out potentially
important diagnostics.
2015-02-04 22:12:42 +01:00
Martin Plicht 2ca9a77cc4 mac: Do #include guessing dance until compile success 2015-02-04 21:52:04 +01:00
Sven Eberhardt a237caa467 Save config to disk at round end (#1260)
This should ensure that MissionAccess gained in this round is always saved even if a crash happens during scenario shutdown or in a following round.
2015-02-03 22:49:55 +01:00
Sven Eberhardt c714e5e3b2 Fix full map screenshots (#1220).
Fixed upperboard, borders when screenshotting while at the side of the map and issues when multiple viewports were open.
2015-02-03 01:00:16 +01:00
Sven Eberhardt 7b8ffd79a4 Make Lava/DuroLava emit ambient light as a material property. (#1205) 2015-01-28 22:35:14 +01:00
Sven Eberhardt e717dd0dab Fix MSVC build. 2015-01-26 18:46:41 +01:00
Günther Brammer 4f9bc068ad Merge #include cleanup and SDL-mainloop fix 2015-01-25 20:47:50 +01:00
Günther Brammer 36ce941e4d cmake: Restore SDL-Mainloop build 2015-01-25 19:05:06 +01:00
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01:00
Günther Brammer a92c22a7b3 Merge various build system fixes and cleanups 2015-01-25 18:50:29 +01:00
Sven Eberhardt b00ff573cd Fix leaked light and some possible dead pointers on game end and section switch. 2015-01-25 18:39:34 +01:00
Sven Eberhardt 1c4444d5fc Fix memory leaks on definitions without or with invalid bitmap graphics. 2015-01-25 18:24:27 +01:00
Sven Eberhardt 8f866cceee Fix assertion on landscape changes outside landscape rectangle (#1232) 2015-01-25 18:23:43 +01:00
Sven Eberhardt 089b4794a8 Fix a few warnings in Win64 build. 2015-01-25 16:43:51 +01:00
Sven Eberhardt e1a09298d4 Fix a few harmless warnings. 2015-01-25 16:16:06 +01:00
Sven Eberhardt 5e365e5236 Remove deprecated evaluation of CNMT rule in engine. 2015-01-25 14:35:18 +01:00
Sven Eberhardt 6be3796e33 Do DigOutObject callback when digging out new objects from material.
It was already done when blasting free and when digging out existing objects, but the case of digging out new materials was still missing. This helps collect firestones when digging in firestone material.
2015-01-25 14:19:39 +01:00
Nicolas Hake d994b893ba OSX: Fix capitalization of several imports and includes 2015-01-23 18:24:31 +01:00
Sven Eberhardt 3d59e77f48 Do object post-load actions after global prop list denumeration. (#1240)
Post-load would access the action proplist which might have a non-denumerated prototype.
2015-01-21 23:18:07 +01:00
Nicolas Hake 2ef2c637a7 Remove several instances of disabled legacy code 2015-01-18 22:59:45 +01:00
Nicolas Hake fef96eca9c Replace C4Surface::ppTex by a vector
This should improve cache coherency by having all surface tiles adjacent
instead of strewn across the heap. This will also remove an indirection
in the common case of only using one tile.
2015-01-18 22:59:44 +01:00
Nicolas Hake 57044a9eeb Move STATUS_ASSERTION_FAILURE definition to where it's actually needed 2015-01-18 21:55:16 +01:00
Sven Eberhardt f815d7ea6c Fix EditCursor selection and deselection callbacks when duplicating objects. 2015-01-17 22:53:21 +01:00
Sven Eberhardt 2cde706611 Object movement in editor respects Def->HorizontalFix and attachment procedure.
When moving attached objects, it will now move the attachment target along with the object. This makes moving elevator cases and wind generators a lot easier.
2015-01-17 21:19:56 +01:00
Sven Eberhardt cf9aca70fe Add callback EditCursorMoved. 2015-01-17 20:53:45 +01:00
Sven Eberhardt c00d8c7a4d Add next_selection parameter to EditCursorDeselection.
If an object is deselected due to a new object selection, that newly selected object is passed as next_selection.
2015-01-17 20:37:54 +01:00
Sven Eberhardt 8dddbe5a10 Allow definitions without graphics. 2015-01-17 18:10:21 +01:00
David Dormagen 7e7bbf17fa fixed additive blitting of particles (#1213)
This was accidentally removed by ck in 526b97c60c
2015-01-17 11:13:08 +01:00
Armin Burgmeier 166b5de519 Fix mape build 2015-01-15 14:42:22 -05:00
Nicolas Hake df7d19c7c5 Improve C4Landscape const correctness 2015-01-15 19:13:36 +01:00
Nicolas Hake f943866d36 Remove unused and unimplemented C4Landscape::FindMatPathPull
The function has been stubbed since we imported the code from CR.
2015-01-15 19:13:33 +01:00
Maikel de Vries 615b26b453 RemoveObject(true) first tries to put contents into parent container before exiting them 2015-01-15 17:46:54 +01:00
Maikel de Vries 4ea0cb0ca6 make ContainBlast a property instead of DefCore entry 2015-01-15 17:46:53 +01:00
Nicolas Hake aa6b1384a7 Fix build with C4NET2IO_DUMP_LEVEL > 1
Instead of using the preprocessor to filter out debugging code, we might
want to make more use of the optimizer's DCE. That way, renaming and
moving a function or variable won't immediately break a rarely tested
configuration.
2015-01-15 16:33:20 +01:00
Nicolas Hake f351e903ee Don't reset gamma with uninitialized graphics
When OC fails while in startup code, resetting the gamma ramp was trying
to use an uninitialized C4Draw, which would result in writes to invalid
memory.
2015-01-15 16:00:01 +01:00
Peter Wortmann 1aa8585fa1 Cosmetic light improvements
- Increase light fade-in/fade-out quite a bit (4 times stronger)
- Fixed normal jump when multiple lights intersect (will make things a
  little less nice with only one light, but this takes priority)
- Don't draw objects without light in light-debug mode
2015-01-15 12:30:50 +01:00
Nicolas Hake 8a729b4c6f Crash handler: Use PRIdPTR format where available
Printing pointers from the crash handler has been broken starting
with an update to MinGW at some point in the past, when they stopped
using printf from MSVCRT, instead replacing it with a private
implementation. Fix this by checking for inttypes.h availability, and
using it (and its format macro) when possible.
2015-01-15 10:18:37 +01:00
Armin Burgmeier f2830311a6 Fix crash on scenario section change (#1221) 2015-01-14 12:03:05 -05:00
Peter Wortmann e8bf04840f Fix some refactoring bugs (#1227)
The "b" value returned by the new find_cross function had basically
nothing to do with what the old version did (it was for the other
pair of coordinates *and* sign-switched). This is not cosmetical - the
algorithm depends quite a bit on this being consistent.

Additionally, most of the list modifications in CalculateTriangles were
wrong (didn't reprocess last triangle for ascend shadowing, and the descend
case was removing the wrong triangle). I admit the old code was probably a
bit too tricky with how it handled "i", so I attempted to refactor it to
make it less easy to screw up in future.
2015-01-14 14:23:26 +01:00
Sven Eberhardt b2501ed0e5 SetPlrKnowledge(nil, ...) sets/removes knowledge for all players (#1236)
Useful e.g. for ingame scripting when you want to grant extra construction plans. Additionally, this kind of behavior is known from some other functions with per-player parameters like e.g. Sound().
2015-01-14 00:36:44 +01:00
Mark deadfcf099 Initialize newzoom variable (#1217)
Fixes a problem with zoom in debug mode.
2015-01-13 21:29:01 +01:00
Mark f9369f9eb4 Different implementation of CreateObject() (#1214)
CreateObject() now does not reposition an object after it has been created, but rather grows it around the center of said object.
To that end a new parameter has been added to DoCon() and SetCon() and the documentation has been updated.
2015-01-13 21:03:27 +01:00
Armin Burgmeier a5c2e762f7 Fix memory leak when a viewport is re-initialized 2015-01-13 07:48:43 -05:00
Armin Burgmeier 57878a0604 Fix crash when viewing record with more than 2 players (#1228) 2015-01-12 16:37:51 -05:00
Mark 850bf1b9d4 CreateObject/CreateObjectAbove (#1214)
Renamed CreateObject() to CreateObjectAbove() and replaced all occurrences in script files.
Added CreateObject(), the function may need a rewrite though, see comment in code.
Updated documentation
2015-01-11 19:02:03 +01:00
Sven Eberhardt 1c994ad3c7 Windows: Do not deselect GL context when losing focus (#1208).
Fixes engine intialization when tabbing out.
2015-01-11 17:01:27 +01:00
Julius Michaelis 8e7001ba0f Fix self-overwrite in C4ValueArray::SetSlice (#1212: Array manipulation goes wrong ) 2015-01-09 15:09:36 +09:00
Mark 43c924d00e Restructuring of StdMeshSkeleton::MirrorAnimation
Mirroring the name happens in MirrorAnimation now, no double checks anymore, no double copying of buffers.
2015-01-07 22:48:04 +01:00
Armin Burgmeier e1d1d540c7 Allow independent viewport and light regions in C4FoWRegion (#1211)
With this change, an additional rectangle is stored in C4FoWRegion that
represents the area covered by the viewport in fractional floating point
coordinates. This allows the light texture to be created for an arbitrary
portion of the landscape, and the coordinate transformations for the
shaders will still work.

Also, since the additional rectangle uses floating point precision, the
computed coordinate transformations do now give the exact same result as for
the landscape pixel-by-pixel, and there should not be any offsets left.

I also hope that this change improves or fixes the single-pixel-lines of sky
that are sometimes seen at the edges of the viewport.
2015-01-07 19:44:31 +01:00
Armin Burgmeier 31c8c14e73 Fix viewport window size in light coordinate calculations (#1211)
The light rect is made larger than the viewport is by one pixel in
C4Viewport::Draw(), so correct for this.
2015-01-07 14:10:26 +01:00
Armin Burgmeier b8fa1dd191 Fix the mape build 2015-01-07 12:28:10 +01:00
Armin Burgmeier 434eb1c77b Fix Y offset when transforming fragment to light texture coordinates (#1211) 2015-01-07 12:28:10 +01:00
Armin Burgmeier 9580c46056 Fix assertion failure when definition to append/include does not exist 2015-01-06 19:33:33 +01:00
Mark af3efead76 Fix reloading of skeletons (#1180) 2015-01-06 18:35:16 +01:00
Mark 10b343dba9 Append and include skeletons (#1180)
Appending and including skeletons works now. Documentation updated.
Skins such as appendto.Clonk.Farmer.skeleton are handled as if the skin name were not included: appendto.Clonk.skeleton

This also changes a bit the structure of how meshes are reloaded in general,
in particular mesh materials are only reloaded once and not once per
C4DefGraphics instance. (Fix crash on reload with included skeletons, cherry picked from commit 2f69aa4850ab7a4b621e5f30cbc537d40f32c0df)

Fix linking of C4Script standalone tool (cherry picked from commit b03a332b73463b378c94e4e92b66d45b923b3b9c)
2015-01-06 18:25:08 +01:00
Mark fc402c18ab Central skeleton loader (#1180)
C4DefList now creates one StdMeshSkeletonLoader and stores all skeletons in this loader. Before this change every definition created its own loader.
2015-01-06 18:24:30 +01:00
Armin Burgmeier dffed48b3d Fix crash on ambient map update outside landscape bounds (#1216) 2015-01-06 11:47:25 +01:00
Martin Plicht b9c68f2208 mac: Fix build (C4Viewport ViewX/Y accessors) 2015-01-05 01:38:35 +01:00
Tobias Zwick 6cf5ba325a use true/false instead of 0/1 as return for a FnSetViewOffset 2015-01-04 22:09:01 +01:00
Armin Burgmeier d4ac1d0694 Fix possible crash after a mesh has been reloaded 2015-01-04 18:29:44 +01:00
Armin Burgmeier 039e03824a Fix buffer underflow in GetExtension() 2015-01-04 18:29:36 +01:00
Sven Eberhardt c2d9e1b46e Change MouseAutoScroll default to off for now. 2015-01-04 15:49:11 +01:00
Sven Eberhardt cce2eaa389 Fix emergency mode of MapLayer->FindPosition() finding positions outside search rect. 2015-01-04 15:43:51 +01:00
Armin Burgmeier 1c68526440 Remove unused function C4DrawGL::EnsureAnyContext() 2015-01-04 13:36:29 +01:00
Armin Burgmeier 338910949d Fix build with GTK+ 2015-01-04 12:13:48 +01:00
Sven Eberhardt 42b9ca4577 Add custom EditCursorCommands available in editor context menu.
Example: this.EditCursorCommands = ["Explode(20)"] on an item will offer a menu entry to explode the object. Commands may be either strings or function pointers, but function pointers will always be called by name.
2015-01-03 23:21:36 +01:00