Skip to content

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.
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
	...
}

@Blixibon Blixibon merged commit b51c5c3 into mapbase-source:develop Jan 4, 2025
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.

2 participants