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

Add support for loading JKA assets. #159

Merged
merged 10 commits into from May 1, 2023
Merged

Conversation

Daggolin
Copy link
Member

@Daggolin Daggolin commented Apr 9, 2023

Add support for loading JKA assets:

  • cvar fs_assetsPathJKA; works similar to fs_assetsPath, but automatically tries to detect jka rather than jk2 (using registry keys on Windows and known paths on Mac)
  • new cvar fs_noJKA; disables loading of jka assets
  • jka assets are loaded before jk2 assets, thus jk2 files take precedence in case of conflicts
  • .shader files from jka assets are virtually renamed to .shader_jka and .shader_jka files are loaded with lower priority than .shader files
  • when trying to load an image the renderer tries to load all extensions without considering the jka assets and only includes jka assets if all extensions failed; this avoids cases of a higher priority extension images from the jka assets overriding jk2 images

Known (non-)issues:

  • as jka has intentionally been given a lower priority there can be cases where jka maps (or models) use jk2 versions of textures or shaders, making them look different than intended; this has already been the case before jka content was even available, making this irrelevant for this change
  • baseja supports entities that basejk doesn't support, as well as ICARUS scripting; jka maps may play different on jk2; adjusting this would be up to mods

To consider:

  • fs_noJKA defaults to "0", automatically enabling jka assets if available
  • fs_noJKA is currently not exposed on the menu; I think adding it to the menu would be a good idea, but we can do this after merging the branch so this can get some testing on development builds

Solves #80.

	- new cvar fs_assetsPathJKA; works similar to fs_assetsPath, but automatically tries to detect jka rather than jk2 (using registry keys on Windows and known paths on Mac)
	- new cvar fs_noJKA; disables loading of jka assets
	- jka assets are loaded before jk2 assets, thus jk2 files take precedence in case of conflicts
	- .shader files from jka assets are virtually renamed to .shader_jka and .shader_jka files are loaded with lower priority than .shader files
	- when trying to load an image the renderer tries to load all extensions without considering the jka assets and only includes jka assets if all extensions failed; this avoids cases of a higher priority extension images from the jka assets overriding jk2 images
Copy link
Member

@aufau aufau left a comment

Choose a reason for hiding this comment

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

I'd like to see list of all base JKA asset types and give each type a thought. do you have such list? Maybe even use a whitelist when loading. You had to do some processing with .shader files, we may add some more stuff like this in the future.

It may be interesting to, for example, let player choose if he wants to use jka or jk2 player model. Same with model skins (harder).

I think trap_FS_GetFileList() returning JKA assets may mess up some mods, but it's not a deal breaker. There is always an option to use fs_noJKA.

src/qcommon/files.cpp Outdated Show resolved Hide resolved
src/qcommon/files.cpp Outdated Show resolved Hide resolved
src/qcommon/files.cpp Outdated Show resolved Hide resolved
src/qcommon/files.cpp Outdated Show resolved Hide resolved
src/qcommon/files.cpp Show resolved Hide resolved
CVARS.rst Outdated Show resolved Hide resolved
src/qcommon/files.cpp Outdated Show resolved Hide resolved
src/qcommon/files.cpp Outdated Show resolved Hide resolved
If fs_basejka is not explicitly set as launch argument:
	- if fs_assetspathjka is set on launch (either manually or via detection for non-portable versions) the fs_basejka cvar is set to "base"
	- if fs_assetspathjka is not set on launch the fs_basejka cvar is set to "basejka" to make it easier to manually provide assets
@Daggolin Daggolin merged commit 088774a into mvdevs:master May 1, 2023
19 checks passed
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.

None yet

2 participants