Skip to content

Material library rendering in ship dealer preview window #11

@BC46

Description

@BC46

Currently in the ship preview window, the material library for the selected ship is not applied. As a result, the ship looks dull. It would be nice if the material library could be rendered such that the ship gets a shine which already happens in all other scenes. However, it is important that the environment map performance option is honored (see example here 0x539A6A). Additionally, the material name must be dynamically obtained per ship.

2025-02-08_00-58-08.mp4

Here's an ugly patch I came up with to record the above video:

>freelancer.exe
001845DA:68->E9
001845DB:00->5A
001845DC:03->19
001845DD:00->04
001C5F39:00->52
001C5F3A:00->50
001C5F3B:00->51
001C5F3C:00->68
001C5F3D:00->E0
001C5F3E:00->59
001C5F3F:00->58
001C5F40:00->06
001C5F41:00->52
001C5F42:00->E8
001C5F43:00->39
001C5F44:00->D9
001C5F45:00->F6
001C5F46:00->FF
001C5F47:00->83
001C5F48:00->C4
001C5F49:00->08
001C5F4A:00->59
001C5F4B:00->58
001C5F4C:00->5A
001C5F4D:00->90
001C5F4E:00->90
001C5F4F:00->90
001C5F50:00->90
001C5F51:00->90
001C5F52:00->C7
001C5F53:00->44
001C5F54:00->24
001C5F55:00->04
001C5F56:00->68
001C5F57:00->55
001C5F58:00->77
001C5F59:00->02
001C5F5A:00->68
001C5F5C:00->03
001C5F5F:00->E9
001C5F60:00->7B
001C5F61:00->E6
001C5F62:00->FB
001C5F63:00->FF

Note that it hardcodes the material name and requires manual edits as it assumes a dynamic address.

Get ship arch for ship dealer ships: 0x4B766C
Get player ship arch: 0x4B7EBB
[&archetype + 0x4] = FlMaterial
[flMaterial + 0x10] = envmap_material value

Use arch::get_engine_index to get the engine index
Material renderer types (DWORD enum): 4 = envMapMaterial, 3 = cloakMaterial
00539AD9: bool GetMaterialRenderer(type, MaterialRenderer**);
00539AE7: bool RenderMatOnEngInstance(long engineIndex, materialRenderer);

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions