-
Notifications
You must be signed in to change notification settings - Fork 14
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
Scale geomod crater texture PPM based on its resolution #293
base: master
Are you sure you want to change the base?
Conversation
return (cache_slot == -1) ? std::nullopt : std::optional<int>{cache_slot}; | ||
} | ||
|
||
int bm_get_width(int handle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's rf::bm::get_dimensions(bitmap_handle, &bm_w, &bm_h);
You really through that there would be no such function?
Also I have no idea why you didn't use BitmapEntry
structure definition and instead put a lot of magic numbers into that code...
@@ -44,6 +44,7 @@ Version 1.9.0 (not released yet) | |||
- Add level filename to "Level Initializing" console message | |||
- Properly handle WM_PAINT in dedicated server, may improve performance (DF bug) | |||
- Fix crash when `verify_level` command is run without a level being loaded | |||
- Add correct scaling for geomod crater texture based on resolution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how you describe this change. It doesn't fix anything for unmodded game (I assume default texture is 256x256). Instead it allows to add more details to crater texture in HD packs. There's a difference.
{ | ||
static auto& bm_bitmaps = addr_as_ref<void*>(0x017C80C4); | ||
static auto& bm_get_cache_slot = addr_as_ref<int(int)>(0x0050F440); | ||
static auto& geomod_crater_texture_handle = addr_as_ref<int>(0x00646000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have LevelInfo
already defined in Dash source...
using GSolid_SetAutotexture_Type = void __fastcall(rf::GSolid*, float); | ||
CallHook<GSolid_SetAutotexture_Type> set_geo_crater_ppm_hook{ | ||
0x00466BD4, [](rf::GSolid* solid, float ppm) { | ||
set_geo_crater_ppm_hook.call_target(solid, bm_calculate_ppm(rf::geomod_crater_texture_handle)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you always use level.default_rock_texture
but geomod uses another texture for ice. If someone changes only rock texture it will use wrong ppm for ice.
Selecting a texture is just a line below. It would be nice to make it work properly for ice too.
This PR adjusts the pixels per metre (PPM) value applied to geomod craters at creation such that it scales based on the resolution of the crater texture. Base game behaviour is to use a static PPM value of 32.0.
This is beneficial because custom geomod textures (either via HD texture mods or configuration by level author in Level Properties) will now display correctly. Stock game behaviour stretches them out if their resolution is >256. The new behaviour in this PR scales them based on the game's established standard of 32 PPM at 256px resolution. As a result, this PR has no effect whatsoever unless you either have a clientside mod that replaces
rock02.tga
or you load a map configured to not use the default geomod crater texture.Resolves #69
Here are some screenshots showing the behaviour with this PR:
256x256 crater texture (default)
512x512 crater texture
8192x8192 crater texture