Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small mapbase fixes #322

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

z33ky
Copy link

@z33ky z33ky commented Sep 5, 2024

A couple of small, unrelated fixes that should be pretty uncontroversial.


Does this PR close any issues?

PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

This function is used to color impact particles.
On Linux I've noticed that this function sometimes is not successful on
retrieving the surface color, leaving an odd color to render the
particles with. The engine function TraceLineMaterialAndLighting() even
has a boolean return value indicating success.
GetModelMaterialColorAndLighting() does not though, but I still observe
failures (the color parameter is not modified). The color is initialized
with an invalid value. If it detects that retrieving the color failed
(engine function said so or the invalid value was left in place), this
now hamfistedly assumes a lightish grey color, but at least still
correctly (presumably) incorporates lighting information.
When this situation is detected, a warning is also printed to the
console. Because why not.
…Data()

GCC warns about attempting to delete a void-pointer, since it will not
be able to invoke its destructor. Fix by casing it to the expected
type.
Crashes on Linux. Apparently returns incorrect values on Windows.
@@ -1001,7 +1001,11 @@ class CSoundEmitterSystem : public CBaseGameSystem

if ( duration )
{
*duration = enginesound->GetSoundDuration( pSample );
if ( Q_stristr( pSample, ".mp3" ) ) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the commit message states, this crashes on Linux. I guess it doesn't on Windows, but doesn't return reliable values, taking the following comment from https://www.moddb.com/mods/sourceworld (scripts/vscript/music_manager.nut):

// The price for not using WAV format for looped music, ladies and gents. Manually writing all durations because the engine can't read duration of mp3s correctly.
::SW_MUS<-{}
::SW_MUS.DurTable<-{
	hordeslayer_01=5.6411
	hordeslayer_02=5.6411
	hl2_song1=60
	...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant