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 bxt_lightstyle #92

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Add bxt_lightstyle #92

merged 5 commits into from
Feb 15, 2024

Conversation

khanghugo
Copy link
Contributor

aka night vision

No need for mat_fullbright 1 and -75% fps if use this one instead. No need for tweaking gamma and brightness either. Most importantly, no need to restart the map.

@khanghugo
Copy link
Contributor Author

I have had some weirdly random crashes at map startup while testing on Windows but I am not sure if this is the cause as I don't see any backtrace. Might as well attribute it to WINE. After 5 minutes of restarting the game, it just stopped. Might be nothing but it might be something in the future if we want to see where to point our fingers at.

src/modules/lightstyle.rs Show resolved Hide resolved
src/modules/lightstyle.rs Outdated Show resolved Hide resolved
src/modules/lightstyle.rs Show resolved Hide resolved
src/modules/lightstyle.rs Outdated Show resolved Hide resolved
src/modules/lightstyle.rs Outdated Show resolved Hide resolved
src/modules/lightstyle.rs Outdated Show resolved Hide resolved
src/modules/lightstyle.rs Show resolved Hide resolved
@khanghugo
Copy link
Contributor Author

I did a more testing and I see that a named light won't be overridden by this. But general lighting would be affected.

Comment on lines 134 to 138
let cl_lightstyle = &mut unsafe { *engine::cl_lightstyle.get(marker) };

// More often a map's default lightstyle will be empty.
*ORIGINAL_LIGHTSTYLE.borrow_mut(marker) = cl_lightstyle[0].map.to_vec();
apply_from_cvars(marker);
Copy link
Owner

Choose a reason for hiding this comment

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

This is holding a &mut reference on lightstyle while it is modified in apply_from_cvars, which is UB. Limit the scope of the &mut.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting.

@YaLTeR YaLTeR merged commit 349d7ca into YaLTeR:master Feb 15, 2024
12 checks passed
@YaLTeR
Copy link
Owner

YaLTeR commented Feb 15, 2024

Thanks

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