Skip to content

Saber Trails Missing on Release Builds #415

Description

@Futuza

For some reason saber trails randomly disappeared. However, this does not happen on debug builds, release with debug information builds, or on Mint, just Windows release builds when either /O2 or /Ox speed optimizations are enabled in the MP Client project.

Basically what's happening is, in cg_players.cpp

You have this check that sets the actual saberTrail drawing:
if ( cg.time > saberTrail->lastTime + 2 || cg_saberTrail.integer == 2 ) // 2ms

which is getting skipped because saberTrail->lastTime is set to some high integer value (eg: 118677726 - its never the same number, just on the high end, probably just some random garbage value from not being initialized.)

Anyway to fix it, I just added an explicit set when switching weapons (in CG_CheckPlayerG2Weapons() of cg_weapons.cpp:

cgs.clientinfo[ps->clientNum].saber[0].blade[0].trail.lastTime = cg.time; //prevent undefined behavior: explicitly set sabertrail timer

That seems to have worked, but am not sure if the issue is really fixed or there's an underlying problem that got missed. Trying to do more testing to make sure I didn't miss anything before I push. Need to try it on an AMD CPU on linux as well, maybe its just a really weird AMD bug.

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugDoesn't work as intended.potentially-fixedThis is probably fixed, but requires further testing to be sure.priority:highFix first.

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions