Menu screens: rock background, centred frame, logo, 3D hero

- Spielen hero panel shows the selected hero in 3D (cUI_NetGranny,
  game/ui/granny.h).
- All menu screens draw on the options' rock wall; the main menu's 1024
  frame is drawn centred over it, mouse and cursor shifted to match.
- The main menu's and options' own pictures and the main menu's 3D scene
  are left out (textures hidden by surface, scene call redirected).
- Logo top left: FX_SACREDLOGO.TGA, drawn added.
- Game textures by name (game/ui/texture.h), textured and added quads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-21 00:05:55 +02:00
1 parent 34a119433a
commit db87e276bf
16 files changed
+620 -69

No files matched your search

+45
View File
@@ -10,6 +10,12 @@ namespace game {
constexpr int kDeviceDrawPrimitive = 25; // IDirect3DDevice7 vtable slots
constexpr int kDeviceSetTexture = 35;
constexpr int kDeviceSetRenderState = 20;
constexpr int kDeviceGetRenderState = 21;
constexpr DWORD kStateSourceBlend = 19; // D3DRENDERSTATETYPE
constexpr DWORD kStateDestinationBlend = 20;
constexpr DWORD kStateAlphaBlendEnable = 27;
constexpr DWORD kBlendOne = 2; // D3DBLEND
constexpr DWORD kTriangleStrip = 5;
constexpr DWORD kFvfScreenColourTexture = 0x1c4; // XYZRHW | DIFFUSE | SPECULAR | TEX1
@@ -19,6 +25,45 @@ struct ScreenVertex {
float u, v;
};
// Draws (x0, y0)-(x1, y1) with `surface` (a texture's Direct3D surface,
// game/ui/texture.h) from (u0, v0) to (u1, v1), tinted by `colour`.
inline void DrawTextured(void* device, void* surface, float x0, float y0, float x1, float y1, float u0, float v0,
float u1, float v1, uint32_t colour = 0xffffffff) {
void** vtable = *static_cast<void***>(device);
using SetTextureFn = HRESULT(__stdcall*)(void*, DWORD, void*);
using DrawPrimitiveFn = HRESULT(__stdcall*)(void*, DWORD, DWORD, void*, DWORD, DWORD);
reinterpret_cast<SetTextureFn>(vtable[kDeviceSetTexture])(device, 0, surface);
ScreenVertex quad[4] = {{x0, y0, 0, 1, colour, 0, u0, v0},
{x1, y0, 0, 1, colour, 0, u1, v0},
{x0, y1, 0, 1, colour, 0, u0, v1},
{x1, y1, 0, 1, colour, 0, u1, v1}};
reinterpret_cast<DrawPrimitiveFn>(vtable[kDeviceDrawPrimitive])(device, kTriangleStrip, kFvfScreenColourTexture,
quad, 4, 0);
reinterpret_cast<SetTextureFn>(vtable[kDeviceSetTexture])(device, 0, nullptr);
}
// DrawTextured added onto what is drawn (source and destination blend ONE):
// for the effect textures, drawn on black without alpha.
inline void DrawTexturedAdded(void* device, void* surface, float x0, float y0, float x1, float y1, float u0,
float v0, float u1, float v1) {
void** vtable = *static_cast<void***>(device);
using SetRenderStateFn = HRESULT(__stdcall*)(void*, DWORD, DWORD);
using GetRenderStateFn = HRESULT(__stdcall*)(void*, DWORD, DWORD*);
const auto set = reinterpret_cast<SetRenderStateFn>(vtable[kDeviceSetRenderState]);
const auto get = reinterpret_cast<GetRenderStateFn>(vtable[kDeviceGetRenderState]);
DWORD blending = 0, source = 0, destination = 0;
get(device, kStateAlphaBlendEnable, &blending);
get(device, kStateSourceBlend, &source);
get(device, kStateDestinationBlend, &destination);
set(device, kStateAlphaBlendEnable, TRUE);
set(device, kStateSourceBlend, kBlendOne);
set(device, kStateDestinationBlend, kBlendOne);
DrawTextured(device, surface, x0, y0, x1, y1, u0, v0, u1, v1);
set(device, kStateAlphaBlendEnable, blending);
set(device, kStateSourceBlend, source);
set(device, kStateDestinationBlend, destination);
}
// Fills (x0, y0)-(x1, y1), ARGB colours per corner: top left, top right,
// bottom left, bottom right (blended between them).
inline void FillCorners(void* device, float x0, float y0, float x1, float y1, uint32_t topLeft, uint32_t topRight,