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

load image and sound file with dot in their extension-independent name #215

Merged
merged 1 commit into from Aug 5, 2019

Conversation

@illwieckz
Copy link
Member

commented Jul 23, 2019

At Quake 3 time it was common to add the .blend suffix to glow maps
so people made files named like:

  • textures/something/somename.blend.jpg

If the shader use the full path, the engine will find the file even
if it's shipped in another format, because the engine will look for:

  • textures/something/somename.blend.jpg
  • textures/something/somename.blend.crn
  • textures/something/somename.blend.png
  • etc.

But the shader use the extension-independent path, the engine will
not find the file because the .blend suffix will be mistakenly
removed like if it was an extension, and the engine will look for:

  • textures/something/somename.jpg
  • textures/something/somename.crn
  • textures/something/somename.png
  • etc.

The engine may either fail to load the file, or load the wrong file
given the somename.blend.jpg file is usually a sidecar for an
existing somename.jpg file.

With this change, the engine tries to load the file by appending
common file extensions before stripping the extension and retrying
with common file extension on stripped name.

Tremulous mappers usually followed Quake 3 methodology, so there is
hundreds or thousands of maps that use .blend picture suffix out
there. It would have been possible to write a workaround for those
special files, but it's far better to make the engine able to fully
support files with dot in their names.

The change is applied to the sound loader as well.

Show resolved Hide resolved src/engine/renderer/tr_image.cpp Outdated
Show resolved Hide resolved src/engine/renderer/tr_image.cpp Outdated
Show resolved Hide resolved src/engine/renderer/tr_image.cpp Outdated
Show resolved Hide resolved src/engine/audio/SoundCodec.cpp Outdated
Show resolved Hide resolved src/engine/audio/SoundCodec.cpp Outdated

@illwieckz illwieckz force-pushed the illwieckz:namedot branch from 4f741ba to 6894dee Jul 28, 2019

@illwieckz

This comment has been minimized.

Copy link
Member Author

commented Jul 29, 2019

I fixed stuff almost as requested 😏

@slipher
Copy link
Member

left a comment

LGTM other than //comments

Show resolved Hide resolved src/engine/audio/SoundCodec.cpp Outdated
Show resolved Hide resolved src/engine/renderer/tr_image.cpp Outdated

@illwieckz illwieckz force-pushed the illwieckz:namedot branch from 6894dee to 1ac7e21 Jul 30, 2019

load image and sound file with dot in their extension-independent name
At Quake 3 time it was common to add the .blend suffix to glow maps
so people made files named like:
	textures/something/somename.blend.jpg

If the shader use the full path, the engine will find the file even
if it's shipped in another format, because the engine will look for:
	textures/something/somename.blend.jpg
	textures/something/somename.blend.crn
	textures/something/somename.blend.png
	etc.

But the shader use the extension-independent path, the engine will
not find the file because the .blend suffix will be mistakenly
removed like if it was an extension, and the engine will look for:
	textures/something/somename.jpg
	textures/something/somename.crn
	textures/something/somename.png
	etc.

The engine may either fail to load the file, or load the wrong file
given the somename.blend.jpg file is usually a sidecar for an
existing somename.jpg file.

With this change, the engine tries to load the file by appending
common file extensions before stripping the extension and retrying
with common file extension on stripped name.

Tremulous mappers usually followed Quake 3 methodology, so there is
hundreds or thousands of maps that use .blend picture suffix out
there. It would have been possible to write a workaround for those
special files, but it's far better to make the engine able to fully
support files with dot in their names.

The change is applied to the sound loader as well.

@illwieckz illwieckz force-pushed the illwieckz:namedot branch from 1ac7e21 to 15815d4 Aug 5, 2019

@illwieckz illwieckz merged commit 15815d4 into DaemonEngine:master Aug 5, 2019

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.