mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-17 17:00:35 +02:00
January's 26 stack-sentinel sites in hud_draw, hud_unit, hud_nav_points,
hud_weapon and motion_sensor share one inlined shape. Both asserts at each site
carry one line literal (a macro). January's 48-byte _check_stack_buffer has no
relocations anywhere, and the Sept-2001 map flags the helper as an inline COMDAT
('i hud_draw.obj'). hud_draw.h now carries the STACK_BUFFER constants, the
unchanged check_stack_buffer body as a header __inline, and the sentinel macro
match_assert_stack_frame (descriptive name: neither the /Od build nor HCEX has
the sentinel). The invented corrupt_stack_found/stack_buffer_checked gotos in
hud_unit are gone, and hud_nav_points and hud_weapon use the macro too (exact
callers). motion_sensor keeps its copy: its sentinel callers are residual, so a
new COMDAT there would break rule (i).
hud_unit (reviewer-amended 01RS + 02-04R): first-party names and storage; the
_fast_ftol rejection is retired (identical copy, pair links pass both ways).
DISCLOSED for an owner ruling: P7 drops rasterizer_xbox_models' dead
#include "interface/hud_draw.h" (project commit 635bd83d; no name used; raw-
and warning-inert). It is load-bearing only as declared-name shielding: the
inline adds ~9 names, which flips __rasterizer_model_transparent_geometry_submit.
Gate (full ninja, objdiff 3.3.1, 23 hud_draw.h consumers): Halo objects 378 ->
379; stable diff unchanged, 0 regressions; parks 86/0/0; admission 11/0/2/0;
pytest 1157 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
156 lines
3.9 KiB
C
156 lines
3.9 KiB
C
/*
|
|
HUD_DRAW.H
|
|
|
|
Narrow cross-translation-unit interface owned by HUD_DRAW.C.
|
|
*/
|
|
|
|
#ifndef __HUD_DRAW_H
|
|
#define __HUD_DRAW_H
|
|
#pragma once
|
|
|
|
#include "math/integer_math.h"
|
|
#include "math/real_math.h"
|
|
|
|
/* ---------- constants */
|
|
|
|
enum
|
|
{
|
|
STACK_BUFFER_LENGTH = 0x80,
|
|
STACK_BUFFER_FILL = 0x62626262,
|
|
};
|
|
|
|
enum hud_draw_flags
|
|
{
|
|
_hud_draw_flashing_bit = 0,
|
|
_hud_draw_disabled_bit,
|
|
_hud_draw_in_multiplayer_bit,
|
|
|
|
NUMBER_OF_HUD_DRAW_FLAGS
|
|
};
|
|
|
|
/* ---------- macros */
|
|
|
|
/* The stack sentinel: a guarded function starts with
|
|
long return_eip = get_return_eip();
|
|
long stack_buffer[STACK_BUFFER_LENGTH];
|
|
csmemset(stack_buffer, 0x62, sizeof(stack_buffer));
|
|
and ends with this check of both its return address and its fill pattern. */
|
|
#define match_assert_stack_frame(file, line) \
|
|
{ \
|
|
short corrupt_index = check_stack_buffer(stack_buffer); \
|
|
match_vassert(file, line, return_eip==get_return_eip(), "corrupt return address!"); \
|
|
match_vassert(file, line, corrupt_index==NONE, csprintf(temporary, "corrupt stack at %d!", corrupt_index)); \
|
|
}
|
|
|
|
/* ---------- structures */
|
|
|
|
struct bitmap_data;
|
|
struct hud_absolute_placement_definition;
|
|
struct hud_color_definition;
|
|
struct hud_placement_definition;
|
|
struct meter_hud_element_definition;
|
|
struct number_hud_element_definition;
|
|
struct static_hud_element_definition;
|
|
struct weapon_hud_overlay_definition;
|
|
|
|
/* ---------- prototypes/HUD_DRAW.C */
|
|
|
|
long get_return_eip(
|
|
void);
|
|
real hud_globals_get_scale(
|
|
boolean in_multiplayer);
|
|
void hud_retrieve_bitmap_and_bounding_rect(
|
|
long bitmap_group_index,
|
|
short sequence_index,
|
|
short frame_index,
|
|
struct bitmap_data const **bitmap,
|
|
real_rectangle2d const **clip);
|
|
long fast_ftol_C(
|
|
real value);
|
|
pixel32 real_alpha_intensity_to_pixel32(
|
|
real alpha,
|
|
real intensity);
|
|
void hud_calculate_point(
|
|
short local_player_index,
|
|
struct hud_absolute_placement_definition const *absolute_placement,
|
|
struct hud_placement_definition const *placement,
|
|
struct bitmap_data const *bitmap_data,
|
|
boolean in_multiplayer,
|
|
real override_scale,
|
|
point2d *result);
|
|
long get_flash_duration(
|
|
struct hud_color_definition const *hud_color);
|
|
pixel32 get_flash_color(
|
|
struct hud_color_definition const *hud_color,
|
|
long reference_value);
|
|
void hud_draw_weapon_overlays(
|
|
short local_player_index,
|
|
struct hud_absolute_placement_definition const *absolute_placement,
|
|
struct weapon_hud_overlay_definition const *overlays,
|
|
long type_flags,
|
|
long reference_time,
|
|
short draw_flags,
|
|
boolean in_multiplayer);
|
|
void hud_draw_bitmap(
|
|
struct bitmap_data const *bitmap,
|
|
struct hud_absolute_placement_definition const *absolute_placement,
|
|
struct hud_placement_definition const *placement,
|
|
real_rectangle2d const *clip,
|
|
real scale,
|
|
real theta,
|
|
pixel32 color,
|
|
boolean in_multiplayer,
|
|
boolean is_interface_bitmap,
|
|
boolean is_crosshair_bitmap);
|
|
void hud_draw_meter(
|
|
short local_player_index,
|
|
struct hud_absolute_placement_definition const *placement,
|
|
struct meter_hud_element_definition const *meter,
|
|
byte min_value,
|
|
byte max_value,
|
|
short draw_flags,
|
|
real reference_time,
|
|
real reference_value);
|
|
void hud_draw_static_element(
|
|
short local_player_index,
|
|
struct hud_absolute_placement_definition const *placement,
|
|
struct static_hud_element_definition const *static_element,
|
|
short draw_flags,
|
|
long flash_reference_time);
|
|
void hud_draw_bitmap_direct(
|
|
struct bitmap_data const *bitmap,
|
|
short placement,
|
|
point2d const *point,
|
|
real_rectangle2d const *clip,
|
|
real scale,
|
|
real theta,
|
|
pixel32 color,
|
|
boolean is_interface_bitmap);
|
|
void hud_draw_numbers(
|
|
short local_player_index,
|
|
struct hud_absolute_placement_definition const *absolute_placement,
|
|
struct number_hud_element_definition const *numbers,
|
|
short value,
|
|
short decimal_value,
|
|
short draw_flags,
|
|
long flash_reference_time,
|
|
real override_scale);
|
|
|
|
/* ---------- public code */
|
|
|
|
__inline short check_stack_buffer(
|
|
long *buffer)
|
|
{
|
|
short index;
|
|
|
|
for (index = STACK_BUFFER_LENGTH-1; index>=0; index--)
|
|
{
|
|
if (buffer[index]!=STACK_BUFFER_FILL)
|
|
return index;
|
|
}
|
|
|
|
return NONE;
|
|
}
|
|
|
|
#endif /* __HUD_DRAW_H */
|