sirjuddington / SLADE

It's a Doom editor
https://slade.mancubus.net
GNU General Public License v2.0
713 stars 111 forks source link

Feature request: Camera eye height setting for 3D view #1283

Closed novaplusplus closed 2 years ago

novaplusplus commented 3 years ago

This is a change I've made for my own personal tweaked version, but I figured I might as well put it forward here. Because some projects (...such as mine...) use a different player eye height than the default, it would be nice to be able to configure that to get an accurate view of the level with gravity turned on instead of having to fly up to about the right height manually.

My implementation is pretty dumb and simple:

In src/MapEditor/Renderer/MapRenderer3D.cpp:

First a new CVAR: CVAR(Int, camera_3d_eye_height, 41, CVar::Flag::Save) near the start

And then here at https://github.com/sirjuddington/SLADE/blob/master/src/MapEditor/Renderer/MapRenderer3D.cpp#L434 replacing int view_height = (map_->currentFormat() == MapFormat::Doom64) ? 56 : 41; int fheight = sector->floor().plane.heightAt(cam_position_.get2d()) + view_height;

with simply

int fheight = sector->floor().plane.heightAt(cam_position_.get2d()) + camera_3d_eye_height;

Guess it wouldn't hurt to have some sanity checks, or a GUI option, etc. But it is a pretty niche feature, so...

I searched around for anything about this but couldn't find anything. This is the part where someone immediately points me to someplace someone already mentioned it.

Gaerzi commented 3 years ago

It might make more sense to put it as a game configuration variable (to replace hardcoded check on Doom 64 map format), and then you can set the value you need in your custom game configuration.

novaplusplus commented 3 years ago

It might make more sense to put it as a game configuration variable (to replace hardcoded check on Doom 64 map format), and then you can set the value you need in your custom game configuration.

Yeah, I like that idea more.