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

Valve BSP, WAD, and external texture support #117

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

Toodles2You
Copy link
Contributor

Test map

Valve format support and external WAD texture support!

I originally implemented these changes for vkQuake. @vsonnier suggested porting them here to benefit the broader modding community.

Quick overview:

  • Textures are loaded from WADs if they aren't embedded within the map itself
  • WAD3 full color textures
  • BSP30 24-bit RGB lighting

See Novum/vkQuake#753 for more details. This PR contains all of the changes & fixes discussed there.

Test maps

@sezero
Copy link
Owner

sezero commented Dec 7, 2024

  • unnecessary whitespace changes in wad.h
  • unnecessarily (wrongly) dropped void from W_LoadWadFile()
    (C23 would reject that, for e.g.)
  • source_name must be const char* in Mod_LoadTextures()
    (C23 would reject that, for e.g.)
  • Mod_LoadWadFiles() must accept a qmodel_t* parameter
  • build failed without BSP29_VALVE defined
  • a few whitespace inconsistencies here and there

The attached patch (against yours) addresses those above, and makes
the diff a bit cleaner.

P.S.: TYP_MIPTEX_PALETTE clashes with TYP_SOUND, but I guess that's
unavoidable.

Please amend the changes and then let's see if others have anything
to say. E.g.:

cd quakespasm && patch -p1 < patch.txt
git commit -a --amend
git push --force

CC: @ericwa, @andrei-drexler, @Shpoike

patch.txt

@Toodles2You Toodles2You force-pushed the valve-formats branch 2 times, most recently from 2f62426 to a4827e3 Compare December 7, 2024 21:03
@Toodles2You
Copy link
Contributor Author

Toodles2You commented Dec 7, 2024

I reverted the changes to gfx.wad handling. You pointing out the dropped void from W_LoadWadFile made me realize they were unneeded remnants of an earlier iteration of the WAD loading.

@Toodles2You Toodles2You force-pushed the valve-formats branch 2 times, most recently from 89aad59 to b441e99 Compare December 7, 2024 23:19
@Toodles2You
Copy link
Contributor Author

Improved the safety checks for WAD3 texture loading.

Also, BSP embedded WAD3 textures are reloaded in memory. QS doesn't load all of the mip levels, so reloading textures (gl_fullbrights for example) caused them to load data from the wrong offset.

@sezero
Copy link
Owner

sezero commented Dec 10, 2024

@ericwa, @andrei-drexler, @Shpoike: Last call for a review for this before this weekend.

P.S.: There is a warning from my old compiler:

wad.c: In function 'W_AddWadFile':
wad.c:191:2: warning: dereferencing type-punned pointer will break strict-aliasing rules

It for that evil tyype-punning *(int *)&header.identification[0]
Maybe I'll do something for that later..

@sezero sezero merged commit 4efddb4 into sezero:master Dec 12, 2024
@sezero
Copy link
Owner

sezero commented Dec 12, 2024

OK, this is in now. Please create new tickets if any issues are found with it.

Thanks.

@Toodles2You
Copy link
Contributor Author

Awesome! I'll keep an eye out.

Thank you for your time, and for the code review.

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