Files
Cesarus85--ringfall-mjolnir-vr/source/interface/event_manager.h
T
Jonas VolmanandClaude Fable 5 aec8a8bb8f event_manager complete: reconstruct code_000cb850 and event_manager_update, object 8/8 exact
event_manager_update (272 B) gated exact on first compile. code_000cb850
(768 B) needed three stacked levers: (1) the no-post arm is a NEGATED
else-if -- 'else if (!(crossed || crossed || repeat)) post = FALSE; else
{ post body }' -- which lays both xor-post blocks inline as fallthrough
stubs and keeps them un-cross-jumped, fixing the 16-byte size gap;
(2) 'boolean post = TRUE;' at declaration, so the live range crosses
system_milliseconds and post colors into BL, denying EBX to the time
local (January homes time in [ebp-4] and reloads at every use);
(3) one shared 'if (post) { insert }' tail instead of per-arm early
returns -- the type-0/3 paths constant-fold the test away, matching
January's straight jump into the insert.

Struct recoveries: event_record.data is a union (point2d stick /
{index,value} button), second field controller_index attested by
ui_widget_event_handler_functions' private copy; event_manager_globals
__unknown108 resolved as stick_event_times[2][4] +
previous_stick_axes[2][2][4] (0x108..0x167). Stick deadzone 29490
(0x7332), repeat window 250 ms, clamp writes via chained assignment
'x = event->data.stick.x = 32767' selected by a switch on
'x >= 0 ? 1 : -1'.

Inert alternatives measured: post declared before time (no move);
post = FALSE init at top (memory-homes post, restructures prologue);
guard-inverted arms without the negation (720 B collapse).

Board: 179/619 objects, 3,609 fns, 486,407 bytes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:05:06 -07:00

64 lines
908 B
C

/*
EVENT_MANAGER.H
header included in hcex build.
*/
#ifndef __EVENT_MANAGER_H
#define __EVENT_MANAGER_H
#pragma once
#include "math/integer_math.h"
/* ---------- constants */
/* ---------- macros */
/* ---------- structures */
struct event_record
{
short type;
short controller_index;
union event_record_data
{
point2d stick;
struct event_record_button
{
byte index;
byte value;
} button;
long value;
} data;
};
/* ---------- prototypes/EVENT_MANAGER.C */
void event_manager_initialize(
void);
void event_manager_dispose(
void);
void event_manager_suppress(
boolean suppress);
boolean get_next_event(
struct event_record *event,
short local_player_index);
unsigned long event_manager_time_of_last_event(
void);
void event_manager_flush(
void);
void event_manager_update(
void);
/* ---------- globals */
/* ---------- public code */
#endif // __EVENT_MANAGER_H