OpenTPW

Staff placement, pick-up and drawing#

Traced in tp.exe (Windows Sim Theme Park World v2.0); labels [BIN:TPW-EXE:...] in the code cite the routines. Code: World/Staff/StaffPlacement.cs (tools and rules), World/Staff/StaffSprites.cs (sprite banks and clips), World/Staff/StaffRenderer.cs (drawing), Hud/ParkHud.Staff.cs (window and buttons), Hud/ParkHud.cs (UpdateStaffTool).

Hire and place#

A hire (0x507bf0) creates no object: it builds the Place tool (CMMPlaceStaff) and flags the candidate as being placed. OpenTPW keeps the candidate in the pool (ParkStaff.PendingPlacementId, exempt from expiry); the staff window closes and the advisor's help 0x135 (309, place your new staff member) is posted as the original's hire handler does (0x49b9dd); the Place tool withdraws it when it ends (0x46c890). A click on a valid cell calls ParkEconomy.Hire and puts the member on the cell centre: state Idle, happiness and energy 100, patrol rectangle the whole map; the role's constructor then runs its first search inside the click (StaffWorldSimulation.Constructed, tp.exe 0x4D46D0 entertainer, 0x4D63D0 guard, 0x4D7100 handyman, 0x4DA5B0 mechanic, 0x502C70 researcher), so the first job is chosen at the click and the sweep's first update goes on from it (a headless economy without a staff world still searches on its first update). Right click or Escape (RmbCancel) only clears the flag.

Pointer timing#

The hire and carry tools are their own mode classes (vtables 0x6FEA40 and 0x6FEA70, not the tool object): they take the left press (slot +4: 0x46C8E0, 0x46CC40) and ignore the release, so a click on a valid cell completes at the press. The patrol tool (mode 0x36) is a tool object's and takes both corners on the release (0x524960, 0x525D..): press, release, press, release. A right click cancels on its release when it was quick (200 ms, 8 px). See docs/UI.md.

Pick up and drop#

The per-employee window (opened from the staff window's employee view) has a Pick up button (the original's control 0x50e, b_pick), enabled by CanBePickedUp (0x505bd0): refused on strike (states 4, 5), in hand (7), repairing (13: StaffJob.Repairing) and escorting (18: StaffMember.Escorting), and when the member's own cell is not type 0, 1, 3, 9 or 10. The member becomes StaffState.PickedUp; a mechanic's ride assignment and a handyman's litter and toilet claims are released at once. The Carry tool drops it on a valid cell (0x509af0 → 0x505ea0): cell centre, Navigation = null, Idle, idle stamp 0, no jobs; the patrol rectangle is untouched. Cancelling drops it back on the cell it came from; only one carry runs at a time (a new pick-up drops the previous member back); there is no guest pick-up.

Valid cell: inside the map, not unowned, type grass, path, queue or queue end, with no track record of a track kind under it (tp.exe 0x46cc40 and the place click 0x46c8e0: the record test 0x5363f0 of a kart or water tile or station, a fence post or hoarding, an extension answering through its parent; so a path or queue cell over a straight or stub tile, and the cells beside a fence post, are refused), under no placed object or the prototype ride (the original refuses object footprints by cell type rather than by occupancy; the occupancy refusal stays for a world that keeps the cells it was given, [EXT:staff-drop-occupancy-refusal], user-approved 2026-10-18). An invalid click does nothing and the tool stays. The cursor is Input.CursorTypes.Carry (the original's cursor 9; [EXT:software-pointers]), an invalid hovered cell shows the blueprint's red ground marker (UI-099).

Saves#

A member in hand is saved dropped on its old cell, as the original's save does (it first ends the carry tool, whose exit 0x46cdc0 drops the member, 0x516c80); a pending hire is not saved. A member left in state PickedUp without a tool (an imported original save) is put back to Idle by StaffPlacement.Reconcile.

Drawing#

The hire and carry tools draw the person in hand every frame at the mouse's world point, 5 height units up (the constant -5.0 at 0x6fe974 is subtracted from the point's height), with heading 4 (0x46c480 reads the point 0x7a1c90 through 0x45d610 and places the tool's sprite with 0x475480), also while the pointer is over the HUD; the sprite pass adds the camera's yaw sector to the heading (0x542010), so the person turns with the camera. The sprite, created by the tool's enter 0x46c730 with 0x475a10, is script 0x15 (0x74ed98: slot 6, frames 0-3 looping) of the role's sprite type (mechanics 6, handymen 5, entertainers 4, guards 7, researchers 8 in the table 0x763f88) with the candidate's variant: the person's own bank, kicking its legs. The art is in the .TPC the game draws (GUESTS.md); every staff .FPC holds slot 6 as 2 x 2 pixel placeholders, which is why the person in hand was invisible while OpenTPW drew the FPC. The world point is the picker's nearest hit, the terrain's or an object model's (as tp.exe's 0x45bf90 gives it; World/Original/ObjectRayPick.cs); the sprite keeps that full point, including the height of a model hit, and lifts it along the height axis by the tool's 5 units and by the terrain's height under it (StaffPlacement.CursorEnginePoint, StaffRenderer.DangleAnchor), while hover and drop cells still use the cell only. The terrain's height comes on top because the tool stores the picker's absolute height plus 5 (0x46c480) where the sprite pass (0x542010) adds the terrain's height under the sprite (0x4527f0, at 0x5420f3) to the stored word of every sprite whose flag 0x1000000 is clear; the dangling script sets only 0x1200 (0x74ed98), and every other caller stores a height relative to the terrain (a guest 0x4f9e60, litter 0). The tool's pointer is the c_carry.ani cursor drawn at its hotspot (0, 0), the top-left corner of its 32 x 32 frames, as the pointer strip is. The PC video (81:30) shows the person just below the carry glove, where this placement puts it above the pointed ground point (GUEST-021, the only part still open: a capture of the original's carry over ground of known height is needed). The hire window closes with the hire (0x49b9dd) and the pick-up button closes the employee window, so no window covers the park while a tool runs.

Staff are sprites (esprites.wad), not MD2 models: Generic\Handymen SPR_HA; Generic\Mechanics SPR_FA, SPR_OM; Generic\Guards SPR_GU; Generic\Researchers SPR_RE; entertainers per theme (Jungle DI, EX, NA; Fantasy FL, GN, LA; Hallow DR, FK, HU; Space MO, SM, SP). tp.exe sorts a folder's banks by name (0x541210) and loads at most 1 bank of the handymen, mechanics, guards and researchers folders for a detail word (GameOptions.NUMKIDS) of 0 and 2 otherwise (0x41AA40; low.sam 0, med.sam and high.sam 2; the entertainers' folders load whole), so on the Low preset only SPR_FA of the mechanics is loaded. The candidate's draw (R >> 2) is reduced by the category's loaded count when it is made (0x541f70); a member's draw is reduced again by the loaded count of every load (the person serializer 0x4f8b10 at 0x4f93aa; the staff constructors copy a candidate's +9 raw, 0x4d6bed to 0x4d6c17), so a member made on Low keeps only the first mechanic bank for good; StaffMember.SpriteDraw and StaffCandidate.SpriteDraw keep that stored draw, outside the world hash like the guests' kid-set draw (the hashed Variant stays the draw modulo the folder's banks). The launcher machine class in front of 0x41aa40 (the flags word 0x79d86c, bit 0x4000, from the launcher file dialog.tcf, with memory sub-classes through 0x44a5d0, which returns only 8, 0x10 or 0x20) is filed under [EXT:no-launcher-machine-class]: OpenTPW always follows the graphics preset (bit 0x4000 only skips the class-preset load 0x44dc60; the software renderer path is chosen by bit 0x40, 0x44ddc0); GUEST-020 keeps open when the original reads the limit (its sprite system's start 0x540900). The same word limits the kid sets to 2, 4, 6 and 8 (0x41A9D0), which OpenTPW does not do yet. The bank is the candidate's drawn variant (0x541f70), a member of an original save keeps the mSpriteID its person record saves, reduced by the loaded banks (0x4f8b10), and only a candidate or member of an OpenTPW park save from before the variant was kept uses (NameIndex + Id) modulo the folder's banks. Clips are the programs of the table 0x75a418 (StaffSpritePrograms, docs/STAFF-SPRITE-VM.md): stand slot 0, walk slot 1 (the patrol walk shows each frame twice), run slot 2, work slot 4 (the sweep shows each of 4 frames twice, repair is an 8-frame loop, research loops 4 frames and four steps of frame 0), strike slot 5 (4 frames and six steps of frame 0, looping), the dangling person slot 6 frames 0-3 (from the .TPC, as the .FPC holds 2 x 2 placeholders there), the guard's catch then carry slots 7 and 8. Resting members have no sprite.

Sprite sources (GUEST-016 retired, UI-092's world sources). Every placed member has the original's sprite wrapper (the person's words +0xC handle, +0x10 pending template, +0x14 pending interval; StaffMember.Sprite, StaffSpriteState) and, while it shows a sprite, a source: the bounded sprite VM (StaffSpriteVm) over the decoded programs. The events are the original's (StaffSpriteEvents; each is read in tp.exe):

The hire window's figure and the employee window's portrait stay on the host's renderer-call clock (UI-082, UI-092). A member's interval is 62 over its speed (doubled for the walk, 0x4FA2A0): 20 steps a cell walking, 10 running, from the step's own displacement (the staff world's Walk); the drawn point is the sub-turn point between the position at the start of the member's turn and his current one (PersonInterpolation, 0x4F9F00, 0x4FA030, 0x4FA870). StaffRenderer draws one quad per member in one draw call with the guests' sprite shader and atlas loading and allocates nothing per frame once the members are known. A member's quad gets the original's depth pull of a pickable sprite, as a visitor's does (GUESTS.md, 0x589B50); the person in hand does not, as the tool's sprite has no pick flag.

Patrol areas (reviewed October 26, 2026)#

A staff member patrols a rectangle of cells, not a route. Every hired member starts with the whole map (corner cell ids +0x20A = 1 and +0x20C = 0x4000, 0x506E90; a cell id is y × 128 + x + 1).

How a player sets one. Open the employee's window (a click on the person, or a row of All Staff). Its footprint button (b_route, a toggle, help 86 "set a patrol area" / 87 "whole park") passes its new state to 0x4B5B50. Switched on, it holds the member (0x48C950), builds the tool object 0x46C580(0x36) (the generic tool class of the path tool, vtable 0x6FE9E0), makes it current (0x46C350, which sets mouse mode 0x36 and clears the stored corner), closes the window and posts help 193; the mode change withdraws it. Switched off it only clears the member's area (0x506E90) and the window stays. The refresh 0x4B5AB0 checks the button when 0x506EB0 finds an area of its own (corner words other than 1 and 0x4000) and posts help 212.

The two clicks (0x524960, mode 0x36, on the button release 0x46C610). The first stores the clicked cell (0x81EDE4/0x81EDE8) and the held member (0x48C920). The second orders the two cells (smaller x and y first, larger x and y second, both inclusive, so the same cell twice is a one-cell area), stores both cell ids on the held member (0x506E50), clears the stored corner and ends the tool (0x52F200(0, 0)). The only check is the preview's red verdict (below): a click while the ghost is red sets the refusal latch (0x533931 → 0x527940(1) → 0x816D48), and the release handler tests it at 0x524A63, plays cat_ui 0xAF (0x524AA7) and goes through the mode table (0x52766C, 0x527694: mode 0x36 is index 8) to 0x5266A3 = 0x52F200(0, 0), so the tool ends and nothing is set. A cell that is not a path or not reachable is not checked. Escape ends the tool as it ends every mode object other than the default (0x40C180). A quick right click (released within 200 ms, moved at most 8 px) ends the mode too with 0x52F200(0, 1) (0x488434) when RMBCancelOn ([0x78D911]) is set: the park view's mouse procedure 0x4881A0 reads it at 0x4881AE.

While it runs (0x5234D0, mode 0x36). Before the first click the hovered cell is marked, after it the four edges of the ordered rectangle (LayLine 0x536100, op 0x136: the top and bottom rows from x0 + 1 to x1 - 1 unless the rectangle is one column wide, the right and the left column). The markers are blue; they are red when every map cell of the rectangle is unowned land (flag 0x40) or a fence post (0x532A50, kept in 0x816D50, answered by the validator 0x535670 for the op 0x36). The cursor is the default one (0x52F950 sets none for this mode).

The highlight. The staff locator (Ctrl+S) draws the located member's rectangle with the same four lines in blue while the camera follows it (0x4B3640, message 0x1E of the locator panel 0x4B3790, flag 0x1000, staff types 4 to 8 with an own area). The employee window draws nothing.

What the area does. Only the wander 0x4F9490, used by the handyman, mechanic, entertainer, guard and researcher: a member outside the rectangle (0x506ED0, inclusive on both axes) first walks to a random reachable path cell inside it (0x506F30: up to 30 tries of two draws, "Could not find or reach a destination" and thought 22 when none); inside it the four neighbour candidates of every step that leave it are dropped, and when none is left the same walk into the area runs. Where the area cannot be reached the wander ignores it. The handyman's litter and toilet searches (0x4D7100), the mechanic's ride search, the guard's chases and the entertainer's performances never ask for the area, so a member leaves it for a job and walks back afterwards.

Save and load. The two words are part of the staff record (+0x20A, +0x20C); OpenTPW keeps them as the rectangle's cells and reads original saves' corner ids (OriginalEconomyImport.ImportPatrolArea).

Differences. Not patrol-specific: every OpenTPW park tool acts on the left press where the original acts on the release, and the pointer pick returns no cell off the grid where the original clamps the hover cell to the grid (0x45D560), so no off-map cell is ever stored; both are HUD-wide and out of scope here. Patrol-specific: the tool says its instruction in a message line besides help 193 ([EXT:strings] PatrolAreaHint).

Source: docs/STAFF-PLACEMENT.md in the project repository.