# Second review pass, 2026-10-22 (PORTING.md step 5) Method: GAME decompile read next to the port, branch by branch; float/double constants and strings read from the game binary (not from the decompile text); disassembly with llvm-objdump where the decompile was ambiguous. Verdicts: ok = identical, fixed = real difference corrected in this pass, unsure = noted, no change made. ## MapWindow.cpp (never reviewed before) - CollectPortData: fixed. The right-align threshold is 750.0f (@0x001ab73c), the port had 748.0f. Default popupX/popupY use (int)x / (int)y of the float coordinates (game), not the double map values. - All other MapWindow functions (ctor, dtor, Init, Draw, UpdateClouds, OnTaskAnimate, Pause/ResumeTravel, WindowToggleForeground, ToggleForeground, InitiateTravel, PostChildrenInit): ok. - TravelTask (ctor, SetMode, AddEvent, Animate) and TravelEvent::Trigger: ok (constants 180/360/0.5/12 checked). ## CoffeeFactory.cpp - Init: ok (all default constants, call order, argument order of IngredientQueue/Hopper/Grid/GunTask checked). - OnMessage: ok (message ids 0x3eb..0x3f2 match the enum). - ResetGame, StartGame, ResumeGame, PauseGame, SetGameState, MissedIngredient, OnTaskAnimate, OnMouseMove/Down, OnKeyDown, PostChildrenInit, ParseRecipe, Draw, ctor, dtor, ToggleForeground, CoffeeBonus ctor/Tick: ok. ## DookieDropper.cpp - Draw: ok except the table. weeksPerColumn is indexed by the player rank (1..7); rank 7 reads the float after the seven values. The binary holds 0.0f there (@0x00192b5c), so the table now has 8 entries (fixed; before it was an out-of-bounds read). - Draw text/PostChildrenInit defaults (itemx 18, itemy 86, ingredienty 58, barHeight 42, countx 57, county 86): ok. - Update, Animate, ctor, DookieCollector::Process: ok. unsure (no effect): the game deletes the per-factory table in LedgerWindow::UpdateLedger before/after Update; only a Lua reference release, order not observable. ## CoffeeGrid.cpp - CountVertical, CountHorizontal, GetSlotIndex x2, GetRelativeSlotPosition, GetSlotPosition, SetTargetImage, SetTargetPosition, ctor, Create, Reset, IsSlotEmpty, CanAccept, ShiftRows, RemoveIngredient, ClearGrid, ClearFrom, AddIngredient, CoffeeGridTask ctor/Reset/Pause/Restart/Animate: ok. The game's CoffeeGridTask ctor leaves oldT uninitialised, as the port does. ## CoffeeHopper.cpp - UpdateMeter, Release, Add, Reset, ctor (layout constants -53/65/81/106/32/56.5/-6.5/-3.5/11 checked), Create, HopperCollectionTask ctor/Reset/Animate/Add x2 (collectTime 250, target x - 75): ok. ## PortWindow.cpp - ctor, dtor, Init, PostChildrenInit, DoAnimation, ChangeMusic, Draw, TintBackground, CancelBuildingHighlight, FindBuilding, OnMouseMove/Up/Down, PausePortAnimations, WindowToggleForeground, CollectBuildingData, CollectSpriteData (path/static branches, PathMode values 0/2/3, htile tiles, tints): ok. ## LedgerWindow.cpp - ToggleForeground, UpdateMoney (thresholds 1e11/1e9/1e8), UpdateLedger (all branches), PrepareInstance, SetQuestIndicator, Animate, TLedgerAnimTask::Animate, Grab, Release, AnimateProduction, dtor: ok. - ctor: unsure (benign): the port sets pTask = NULL, the game leaves it uninitialised until Grab. ## RecipeDesigner.cpp - SetLayer: ok. Disassembly @0x3343e..3344a confirms `(nImage + size) % size` is a signed idivl (cltd; idivl %ecx) and the result is stored as the (signed) index. - GetLayerImage, SetRecipeType, OnTaskAnimate (1001/1501/1801 thresholds, RandRange lower bounds 0/1/2/0), RandomDesign, ctor/dtor: ok. ## Known deviations - Character.cpp PostChildrenInit: fixed. The scaled width/height use the game's clamped double->uint32 conversion (SseDoubleToUInt32, see sseconv.h) instead of a plain cast. - BitmapTint.cpp: fixed. Draw converts the window width/height with an unsigned->double conversion (game), Init tests `0 < (int)w && 0 < (int)h` through SseDoubleToInt32 (x87 fistp gives 0x80000000 out of range). TRectangle (Rectangle.cpp) was already correct ((float)(uint32_t) of the size, as in the game). - Curve.cpp `delete[]` on `new TVert[n]`: ok. TVert is trivially destructible, so `new[]` stores no cookie and `delete[]` calls the same operator delete as the game's __ZdlPv. CurveEditor.cpp has no such array. - Curve.cpp const_cast in GetLength/RenderCurve: ok. The game builds the divisions lazily through the const `this`; the objects are never const-defined (held by shared_ptr), so the cast is well-defined and identical.