NOTES -- party / friends / menu work (2026-10-14)
================================================
Written while the native client could not be built here. Python and menus
were tested; client_native changes need a Windows build and an in-game pass.

DONE
----
Main menu (client_menu/ui_mp/main_text.menu)
  PLAY replaces RANKED + SERVERS: opens the party screen (uiScript zealRanked).
  THEATER restored (open pc_theater_menu). Buttons: stock-sized 0.42 text,
  24 px rows. Unregistered players: PLAY shows the registration notice and
  opens the server browser (public servers need no account).

Party screen (BO2 style, client_native/Ranked.cpp + RankedMenus.hpp)
  Header PARTY, "n / 8 PLAYERS". Parties hold up to 8 (MAX_PARTY / MaxParty).
  FIND MATCH = Ranked, solo or duo only (RANKED_PARTY): 3+ get
  "Ranked is solo or duo. Leave the party or kick players to search."
  Bottom right: SERVER BROWSER, KICK SELECTED (leader, select a roster row),
  LEAVE PARTY, FRIENDS (n ONLINE).
  Follow the leader: when the leader joins a public server the client posts
  /v1/follow {address, name}; members get state.follow {address, name, seq}
  and Party::Connect to it once per seq. Leaving the server clears it.
  Ranked class locks (RankedClasses) are off while the party is on a public
  server. Status line wraps (autowrapped) inside the rank panel.
  Options menu entry "VOICE" -> "Voice" to match stock casing.

Friends (docs/FRIENDS.txt)
  Name | Online/Away/Offline | doing; INVITE (party has room), JOIN GAME
  (friend on a public server). Privacy: requests everyone/nobody, appear offline.

Lobby service actions added: follow, leaveparty, kick, social.
Tests: tests/test_ranked_lobby.py, tests/test_ranked_social.py (all lobby,
resume, controls, voice, profile, devices, rating suites pass).

Ranked loadout (Ynzie): secondaries, lethal and tactical grenades allowed
  Primary stays Intervention + FMJ; perks unchanged; deathstreaks stay off.
  - scripts/mp/ranked_loadout.gsc: secondary weapon + attachments, equipment
    ("perks", 0) and specialGrenade come from the player's class (default
    classes from the class table); equipment is given in apply_perks.
  - scripts/mp/loadout_and_reflector.gsc: grenades no longer stripped at spawn
    unless comp_strip_throwables 1 (same switch as IW4X-COMP). The damage hook
    still blocks every non-Intervention-FMJ hit, so they can't hurt, flash or
    stun players.
  - client_menu/build.py class_rules: no longer overwrites secondary,
    equipment or tactical (still forces Intervention FMJ, perks 2/3, no DS).
  - client_native/RankedClasses.hpp: Create-a-Class secondary / equipment /
    grenade buttons are no longer locked (deathstreak still is).
  - tests/native/restricted_loadout.gsc expects the injected Desert Eagle,
    frag and flash to be kept on custom classes. docs/QA.txt line 185 still
    describes the old "no secondary or grenades" result -- rerun the native QA.
  - Check the Create-a-Class preview panel: RankedClasses hides some preview
    rows (y < 268 or >= 376); the secondary/grenade rows may need showing.

Linked PCs (zeal_accounts/store.py, ranked_lobby, rating_service, website)
  One account, up to five IW4x keys, links permanent. Codes from Options in game, zeal.family or the staff
  dashboard; no client, GSC or bridge change. Lobby Member.account / voice
  Route.account carry the account; .guid stays the connecting key. Rating
  service resolves game GUIDs to accounts (begin/finish/profile/snapshot).
  Tests: tests/test_account_linking.py. Details: docs/ACCOUNTS.txt.

Ranked / Unranked split (1.36, 2026-10-16)
  Main menu: RANKED (uiScript zealRanked, solo/duo), UNRANKED (zealUnranked, 1-8)
  and SERVER BROWSER (pc_join_unranked, between MODS and OPTIONS). The party
  screen has no SERVER BROWSER (see "Owner agreement" below for FRIENDS).
  Lobby rooms carry mode; pool, invites, joins and queue are mode-scoped.
  GSC: comp_ranked_rated 0 = Unranked (party cap 8, splits a party only when no
  whole-party 4v4 exists, "UNRANKED MATCH - NO ELO", never begins a rating).
  zeal02-2 is the Unranked lobby. Tests: tests/test_unranked.py.
  The leader-follow-into-public-server code remains but has no entry point now.

NEEDS THE OTHER DEV / A BUILD
-----------------------------
0. Options > "Link another PC" (RankedMenus.hpp row at y=168, Defaults moved
   to 188; ZealAccounts.cpp LinkCode / uiScript zealLinkCode / zeal_link_code).
   Check the row fits the Options layout and the code popup wraps. The server
   side ("link" proof purpose) is live-ready and tested without the build.
1. Build client_native and play-test: menu sizes, PLAY, party of 3+, KICK,
   LEAVE, SERVER BROWSER follow (leader + 2 members), FRIENDS button/screen,
   JOIN GAME, Away after 5 min, privacy toggles, wrapped status text.
2. Deploy order: lobby service and clients together. A client from before
   this change rejects rosters above 2 ("Invalid party size"). Bump the
   client version / use client_update_required before 3+ parties are allowed.
3. PublicServerName() reads sv_hostname from config string 0 (assumed
   CS_SERVERINFO, as in Q3). Verify; otherwise fall back to the server list.
4. Party voice: _voice_routes only allows menu voice while nobody is in game,
   so party voice stops on public servers. Decide whether public-server
   parties should keep voice (route by party when all members share a server).
5. Voice icons on the roster exist for the first two rows only.

NOT DONE (design decisions for the team)
----------------------------------------
- Back from the party screen still Leave()s the session (old Ranked
  behaviour). BO2 keeps the party at the main menu; doing that means the
  session stays open everywhere. Before changing it, check RankedClasses and
  the ranked_class_rules menu: opening Ranked rewrites custom classes to the
  Ranked rules (build.py class_rules), which would then apply all the time.
- Presence only exists while the party session is open (PLAY pressed). A
  player who goes straight to a server without PLAY shows Offline. An
  always-on presence heartbeat from game start would fix it (same account
  ticket as Ranked open).
- Following into password-protected public servers: the follow carries no
  password; members get the normal password prompt.
- If the leader's server is full, members just fail to connect (no seat
  check for public servers).
- Privacy settings are in game only; add them to the zeal.family profile page.
- Party invites still require the invitee to be solo (no merging parties).

ALSO PENDING (Ynzie)
--------------------
- Tournament site on the ZAP webspace (PHP + MySQL): 8/16 teams, single and
  double elimination, Bo3, admin-entered teams. Needs the subdomain and DNS.
- Tournament servers stay on the old VPS (comp_ranked_auto 0) with fixed
  rosters (!match TeamA TeamB) -- separate from Ranked.

UPDATES 2026-10-15 (Ynzie)
==========================
Highlight reels (from IW4X-COMP)
  - tools/demo/merge.py + discord_bot/demo/merge.py (new): whole-match reel =
    every highlight of a match in order, each from that player's own demo, in
    one file. Switching players uses one gamestate ("spec" mode); the next
    player's baseline and first keyframe get the previous clip's last
    timestamp so the game cuts straight over (no pre-match flash, no camera
    slide). Tested in the Theatre (Scrapyard, 18 clips): clean switches.
  - reel.py: clips start on the FIRST keyframe of a cl_nodelta pulse and only
    on keyframes the next snapshots can continue from (fixed up to 5 s frozen
    picture at clip starts). Uses the 'v comp_kf_spawn' spawn mark when the
    demo has it. Loaded demos are shared between reels (full match ~4 s).
  - demo_keyframes.gsc: marks each spawn (comp_kf_spawn) right before the
    spawn keyframe so clips never start in a killcam. Not live-tested yet.
  - discord_bot/highlights.py: posts MATCH_<map>_<ts>.dm_13 first, then the
    per-player reels. config: highlights_match_reel, highlights_player_reels
    (default true); highlights_reels false turns every reel off.
  - Lead-in is 1.5 s before the first kill, but a clip can only start on a
    keyframe: with comp_demo_keyframe 20 most clips start at the spawn.

Performance finding (old VPS)
  - Every keyframe pulse showed up client-side (Com_TouchMemory in the console
    every 20 s) and players felt small hitches. Old servers now run
    comp_demo_keyframe 0 (IW4X-COMP default changed to 0), reels off there.
    This repo keeps the default 20 for the new servers -- watch for the same
    hitch on Psychz; if it shows, use 0 or spawn-only keyframes.
  - Pulsing every player at once (old 5 s version) caused the big lag spikes;
    the current version staggers players.

Other game scripts
  - Server_Core.gsc (CodCaster): F / X toggle didn't fire for some spectators
    (notifyOnPlayerCommand events don't always arrive). Added a Use-button
    poll as backup; one press can't toggle twice; the X "join open slot"
    prompt still wins. !caster unchanged.
  - notify_card.gsc (new): CSL-style card on the left (gold bar, "ZEAL |
    RETURNING / NEW PLAYER CONNECTED" + name), once per session, shown to
    everyone except the joiner. comp_card_connect 0 = off, comp_card_tag =
    prefix. Rebalancer.gsc messages now use cards (the hold-Reload prompt and
    countdown stay centred). Copy both files together.
  - loadout_and_reflector.gsc: [LAR_DEBUG] prints only with comp_lar_debug 1.
  - discord_bot/servers.py: scoreboard put players it couldn't match on
    Allies (showed 5v3 on a 4v4). Looser name match + a "Team ?" row.

Party / search screens (client_native/RankedMenus.hpp) -- needs the build
  - INVITE removed: it opened the same friends screen as FRIENDS. Only the
    bottom-right FRIENDS (n ONLINE) stays; the left-column rows under the old
    Invite row (Leaderboard, Options) move up 20 px. The search screen gets the
    same bottom-right FRIENDS instead of its left-column Invite. Inviting from
    the friends list still follows the two-player Ranked limit.
  - FRIENDS now sits on the same row as GAME SUMMARY (copies the stock
    "button_summary" item's y / alignment; on the search screen the warmup
    hint row). SERVER BROWSER / KICK / LEAVE stack above it.
  - Controller: Y / Triangle opens the friends list on the party and search
    screens (menu onKey K_BUTTON_Y). The label doesn't show a button glyph yet.
  - Check in game: no gap in the left column, FRIENDS not overlapping the
    bottom-right stack (SERVER BROWSER / KICK / LEAVE) or the search screen's
    warmup hint.

IW4MAdmin (Admin/ folder, see docs/IW4MADMIN.txt)
  - Admin/ holds the IW4MAdmin plugins and web files. Database.db and logs are
    ignored by .gitignore (*.db / *.log) -- they contain player IPs. Its
    Configuration/ (RCon passwords) is not in the repo and must stay out.
  - Welcome plugin removed on the live install: the connect card replaces
    its chat announcement.

Friends screen redesign (2026-10-16, needs the build)
  - STATUS is a dot, not text: grey offline, yellow away, green online.
    friend_dot_0..6 in ranked_friends.menu sit over the visible list rows;
    Ranked.cpp FriendDots() colours them every frame, follows the list's scroll
    position and hides them on request / blocked rows. Dot image:
    client_menu/artwork/status-dot.png (ranked/status-dot.png in the IWD),
    loaded like the other Ranked artwork; falls back to a small square.
  - DOING header removed; the activity text sits right of the dot. Requests
    read "Wants to be friends" / "Request sent", blocked rows "Blocked".
  - Bottom of the screen regrouped: SELECTED PLAYER row (Accept, Remove /
    Decline, Block, Unblock, Invite, Join Game), divider, username row (Add
    Friend, Report Username), join-by-code row + your lobby code, divider,
    PRIVACY row.
  - Check in game: dots line up with the rows (rect y 57 + 22 per row) and
    stay aligned while scrolling; nothing overlaps at 4:3 and widescreen.
  - Build + install for testing: tools/build_client.ps1 [-GameDir "..."], then
    start zeal-game.exe directly (the launcher restores the release files).

Party screen pass 2 (2026-10-16, tested build 1)
  - Title (stock "IWNET") now reads DISCORD.GG/PLANETZEAL (smaller text).
  - SERVER BROWSER moved to the left column right under FIND MATCH; the
    bottom-right stack is KICK SELECTED / LEAVE PARTY above FRIENDS.
  - FRIENDS / KICK / LEAVE are copies of the stock button moved to the right
    edge without changing size or text alignment (RightColumn), so the focus
    bar sits behind the text again (it was drawn below / left of it).
  - Friends screen: status dot has a black outline; ACCEPT / REMOVE / BLOCK /
    UNBLOCK centred under "SELECTED PLAYER", INVITE / JOIN GAME on the label
    line when available.

Pass 3 (2026-10-16)
  - FRIENDS row: the party menu has no "button_summary" item, so FRIENDS used
    the Invite row's Y (too high). Now matched to GAME SUMMARY by text, else
    one row above BACK. Label "FRIENDS (n ONLINE) - P" on keyboard/mouse, Y /
    Triangle glyph on pad; P and Y both open it (menu onKey).
  - Options: Voice moved under Audio, rows below shift down one, Link another
    PC last. Every row gets its own onFocus with its new Y -- the black bar is
    one shared item at localVar ui_optionRowY, so moved rows had no bar.
  - Friends screen: dot + STATUS header centred together, SELECTED PLAYER and
    PRIVACY labels centred, INVITE / JOIN GAME on the status line, JOIN BY CODE
    centred between ADD FRIEND and REPORT USERNAME, privacy buttons centred in
    each half. "RECEIVE FRIEND REQUESTS: YES / NO" (was EVERYONE / NOBODY).

Owner agreement (2026-10-16, installer 1.36.3)
  Cynic and Ynzie agreed on this layout; it replaces the conflicting notes above.
  - SERVER BROWSER lives only on the main menu, between MODS and OPTIONS. The
    party and search screens have no server browser button.
  - No DISCORD.GG/PLANETZEAL title on the party screens. Their titles read
    RANKED / UNRANKED (search screen: RANKED 4v4 / UNRANKED 4v4).
  - The Discord logo + https://Discord.gg/PlanetZeal link sits bottom left on
    every screen: main menu, Ranked and Unranked party, search lobby, Options,
    and inside the Friends popup (which covers the screen-wide footer).
    RankedMenus DiscordFooter() adds it to adapted menus; RankedBranding
    BindFooters() binds the logo for any item named zeal_discord / btn_discord
    and only moves left-aligned (screen-wide) footers to the screen edge.
  - Kept from Ynzie: the P / Y keybind for the friends screen, friend status
    dots, Options order. No FRIENDS button in the bottom-right corner (party or
    search screen); KICK SELECTED / LEAVE PARTY sit right under the roster
    again and only appear in a party (installer 1.36.4).
  - INVITE is back in the party screen's left column, directly above
    LEADERBOARD, and never disappears (installer 1.36.4). With a full party
    (Ranked 2, Unranked 8) INVITE in the friends screen stays available too;
    the click says "Your Ranked party is full (2 of 2)..." and sends nothing.
    The lobby service also refuses invites into a full party and accepts of
    an invite whose party filled up, so the invited player never joins.

UPDATES 2026-10-16 (Ynzie)
  - Create a Class: Secondary / Equipment / Special Grenade are greyed out like
    the other fixed rows. INTERVENTION + FMJ only opens the stock camo popup.
  - Unranked party screen hides the rank badge, rank name and Elo/placements.
  - Friends: status badges (client_menu/artwork/status-badges.png: OFFLINE,
    AFK, ONLINE, DND). MY STATUS cycles ONLINE / AFK / DND / OFFLINE; stored as
    social_settings.status (auto|away|dnd, column added on start-up) plus the
    old invisible flag. DND is sent as presence away + dnd so old clients still
    work; DND players cannot be invited (friend_dnd). Popup Discord link removed.
  - Animated menu backgrounds (client_native/RankedVideo.hpp):
    ranked/video/main.zvj plays behind the main menu (looped seamlessly: the
    last second is cross-faded into the start) and replaces the static Zeal logo;
    ranked/video/blank.zvj plays behind every other frontend screen. The stock
    "mw2_main_background" texture is pointed at the current frame and the fog /
    glow / soldier layers at a clear texture; everything is freed on connect,
    vid_restart and device recovery. Make new packs with
    tools/make_menu_video.py --size 1280x720 --crossfade 24 (needs ffmpeg + Pillow).
    Packs are JPEG frames (~14 MB), decoded and packed to DXT1 on up to 4
    threads the first time (best-of-several endpoint fits; flat smoke keeps its
    in-between colours), then cached in players/zeal_menu_cache/<hash>.dxt
    (~60 MB per clip) so later loads take a moment. ~120 MB RAM/VRAM, frontend only.
    Friends and leaderboard popups show the smoke under a dark shade
    (item zeal_video_bg). Frames get their own 2D materials; menu items are
    re-pointed (the stock material is never edited).
    Toggle: Options > Animated Menus: On/Off, under Optimal Video and Audio (dvar zeal_menu_video, saved,
    default OFF; on PCs with 6 GB+ RAM, 4+ threads and 1 GB+ video memory the
    disk cache is encoded in the background meanwhile, so turning it on is quick).
    Only screen-sized background items are swapped (CAC popup bands keep stock art). NO = classic background and static logo, textures freed.
    The camo popup opened from INTERVENTION gets a full-screen dim (zeal_cac_tint.menu).
  - Party screen: "1 player(s) in Ynzie's party."; GAME SUMMARY / BACK moved up
    16 so the ticker clears them. Main menu buttons: black selection bar, text
    centred in it, white like the party rows, font/size copied from them.
  - server_configs: comp_strip_throwables 0 so the fixed knife + stun grenade
    are kept (they were stripped at spawn).
  - Create a Class: fixed USP .45 / throwing knife / stun grenade (greyed out;
    scripts/mp/ranked_loadout.gsc + class_rules in build.py).
  - News ticker: MW2-style strip along the bottom of the Ranked / Unranked
    party screen (template items zeal_ticker* in main_text.menu, hidden there).
    Until the service has a message it shows "Ynzie Was Here <3". Text = the lobby service's "news_file" (service config),
    read on every request; clients refresh every 10 minutes, so edit the file
    on the server to change it - no release or restart. POST /v1/news, no session.
    Example: deploy/news.example.txt.
  - Animated Menus also tints the blurred bands (Create a Class, callsign) and the
    fog inside stock popup boxes (custom title, clan tag, reset/unlock stats):
    those items draw the video through a copy of their stock material, so the
    popup's stencil keeps it inside the band/box. Camo: INTERVENTION opens the
    stock stack (weapon class > sniper > attachments > camo) so the screen looks
    stock; backing out of camo closes the stack (zealCamoStack).
  - Barracks: PRESTIGE MODE replaced by SELECT PRESTIGE (0-10), our copy of
    IW4x's menu_online_barracks.menu + scriptmenus/zeal_select_prestige.menu.
  - Friends list request/blocked text is plain white (readable on the gold bar).
  - Stock popup boxes (quit, reset/unlock stats, custom title ...): the grey
    body shows the smoke fitted to the box and its fog layers are cleared.
  - Main menu: thin separators after UNRANKED, SERVER BROWSER and REGISTER.
  - Ticker: deploy/news.example.txt has the current lines (one per line on the
    server, shown 8 spaces apart, up to 1000 characters); the client shows the
    same lines until the service supplies its own.
  - Debug: zeal_dumpmenu <menu> prints a loaded menu's items to the console log.
  - Ticker shows one message at a time in random order (reshuffled each 10 min
    refresh), ~half a screen apart. /v1/news also returns "messages" (lines).
  - Camo popup (16:9): its band layers are widened so they reach the right edge.
  - Main menu separators are stock size (216 wide from the column's left edge).

Client 1.37.0 (2026-10-16)
  Anthony's animated menu backgrounds with Options > Animated Menus (zeal_menu_video,
  archived, off by default), prestige selector and barracks menu, friend status
  (away / do not disturb), fixed USP / throwing knife / stun kit (no damage through the
  reflector), main-menu news ticker from the lobby's news_file. Installer is ~29 MB
  because of the two menu videos. Server side: ranked_loadout.gsc + comp_strip_throwables 0
  on all hosts; MS-02 lobby serves /v1/news from /var/lib/zeal/news.txt.
