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

Support FTE_PEXT_TRANS and FTE_PEXT_COLOURMOD. #145

Merged
merged 6 commits into from
Jan 4, 2025

Conversation

dsvensson
Copy link
Collaborator

@dsvensson dsvensson commented Nov 13, 2024

FTE_PEXT_TRANS was broken when implemented long ago. This finishes the implementation, and also adds FTE_PEXT_COLOURMOD which was mostly declared in the protocol header, but not implemented. The latter is a convenient extension field for mappers to use when dealing with alpha brushes later on. For example using the same glass texture with alpha, but tint it via colormod field.

Broken clients (all ezQ versions) will be demoted to opaque entities based on revision.

When no entity has modified alpha or colormod, the additional bytes are not written. The PF_EXTRA_PFS will however still write one extra byte due to the moving of PF_ONGROUND and PF_SOLID. This is only a problem for buggy clients that have cl_pext_alpha set to 1, and somehow trick the server side check that would disable it if the client is too old, ie you get what you ask for.

For not fully connected usecases mvd and outdated qtv clients should remain unaffected by this change as long as no alpha nor colormod is used as it doesn't follow the networked player info packet structure. If for example using translucent spawn markers, these are only shown before demo recording usually begins so demos on maps without alpha entities will be playable in any old client.

MapExtFieldPtr takes a parameter name and returns an opaque field
token. In agreement with FTE this token contains some random bits
that are verified and stripped on use to avoid mods hardcoding field
offsets, which would over time lead to engine incompatibilities.

SetExtFieldPtr takes an entnum, a field token, a pointer to some
data as well as size which, if token and size is valid, performs a
memcpy of the data to the field referenced.

GetExtFieldPtr is the inverse of SetExtFieldPtr with same parameters.

Availability of above functions is determined via Map_Extension.
Allows entities to add three bytes of color modifiers where 0
is unset, 32 is 1.0f thus no color changes, and above 1.0 goes
into overbright territory.
As outdated clients have a broken implementation of FTE_PEXT_TRANS
these will not read the PF_EXTRA_PFS byte and the network protocol
will go out of sync unless this extension is disabled.

Once disabled, the client will work just fine, just that transparent
entities will be opaque.

Another workaround is for the client to set cl_pext_alpha to 0.
@dsvensson dsvensson requested a review from qqshka November 19, 2024 12:45
@dsvensson dsvensson merged commit 1fdfa60 into QW-Group:master Jan 4, 2025
6 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.

1 participant