feat(net+ui): Phase G.1 — server time sync + debug controls

WorldSession now surfaces the server's PortalYearTicks via a new
ServerTimeUpdated event, fired from two sources per r12 §12:
  1. Initial ConnectRequest handshake (ConnectRequestServerTime field
     of the optional block — seeds the clock on login).
  2. Every subsequent packet carrying the TimeSync header flag
     (0x01000000) — keeps the client clock within one TimeSync period
     of authoritative server time.

GameWindow subscribes the event into WorldTimeService.SyncFromServer,
so the day/night cycle + keyframe interpolation runs from real server
time in live mode. Offline mode (ACDREAM_LIVE=0) still uses the
seeded-to-noon fallback from OnLoad.

DebugOverlay now exposes sky + weather + lighting state:
  time  0.50  Midsong    (day fraction + hour name)
  wx    Clear parts 0   (weather kind + live particle count)
  lit   1/4            (active / registered lights)

F7 cycles a debug time override through
  (none → midnight → dawn → noon → dusk → none)
F10 cycles weather through
  (Clear → Overcast → Rain → Snow → Storm).

These keybinds satisfy the visual-verification tier so a user can
flip through every state from the running client without touching
the code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-19 10:51:03 +02:00
parent 7b9a66c9ea
commit cd89e9a498
3 changed files with 116 additions and 3 deletions

View file

@ -101,7 +101,14 @@ public sealed class DebugOverlay
int StreamingRadius,
float MouseSensitivity,
float ChaseDistance,
bool RmbOrbit);
bool RmbOrbit,
// Phase G.1/G.2 — sky + weather + lighting
string HourName = "",
float DayFraction = 0f,
string Weather = "Clear",
int ActiveLights = 0,
int RegisteredLights = 0,
int ParticleCount = 0);
public DebugOverlay(TextRenderer text, BitmapFont font)
{
@ -205,6 +212,10 @@ public sealed class DebugOverlay
($"lb {s.LandblocksVisible,3}/{s.LandblocksTotal,3} visible", White),
($"ent {s.EntityCount,4} anim {s.AnimatedCount,3}", White),
($"coll {s.ShadowObjectCount,5} radius {s.StreamingRadius}", White),
// Phase G: sky + weather + dynamic lighting surface.
($"time {s.DayFraction,5:F2} {s.HourName}", Cyan),
($"wx {s.Weather,-8} parts {s.ParticleCount,5}", Cyan),
($"lit {s.ActiveLights}/{s.RegisteredLights} ", Cyan),
};
float pad = 10f;
@ -277,6 +288,8 @@ public sealed class DebugOverlay
("F4", "toggle debug HUD info panel"),
("F5", "toggle stats panel"),
("F6", "toggle compass"),
("F7", "cycle time-of-day override (none/midnight/dawn/noon/dusk)"),
("F10", "cycle weather (clear/overcast/rain/snow/storm)"),
("F", "toggle fly camera"),
("Tab", "toggle player mode (requires login)"),
("W A S D", "move (player mode) / fly"),
@ -388,7 +401,7 @@ public sealed class DebugOverlay
private void DrawHintBar(Vector2 screenSize)
{
string hint = "F1 help F2 wireframes F3 dump F4/F5/F6 panels F8/F9 sens Tab player Hold RMB orbit Wheel zoom";
string hint = "F1 help F2 wires F3 dump F4/F5/F6 panels F7 time F8/F9 sens F10 weather Tab player RMB orbit Wheel zoom";
float w = _font.MeasureWidth(hint);
float pad = 10f;
float y = screenSize.Y - _font.LineHeight - pad;