mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
A ring that is not full holds records 0..count-1: the engine's writer fills them in order from an empty ring, and only a full ring wraps. ScrollOffset and ScrollToOffset wrap by the count, and ScrollToTop (0x00788690) lays out from record 0 unless the ring is full, so each one is right only for that layout. BackFillMessage wrote the new oldest message to the record before the oldest, as 4.3.4's addToTop does. In a ring that is not full, that record wraps to the end of the array. From then on, GetScrollOffset, SetScrollOffset, ScrollByAmount and ScrollToTop read the wrong offset. pfUI's chat wheel scrolled up into the backfilled lines and then could not scroll back down. RemoveMessagesByPredicate compacted from the oldest's record, so after a removal from a full ring the kept messages began anywhere in the array. BackFillMessage now rotates records 0..count by one, so the free record comes round to 0, and writes the message there. RemoveMessagesByPredicate first turns the ring so that the oldest is record 0, then compacts. Whole records move, so every text keeps one owner. Clear leaves a free record's old text for the writer to free. The extra-argument tables and the scroll record (OFF_SCROLLINGMESSAGEFRAME_SCROLL_RECORD, +0x348) move with their records. A scrolled-up frame is laid out again from its moved scroll record, so the view stays. A model of the engine's three functions agrees on 377,485 random add, backfill, remove and scroll states. Not yet verified in game.