OpenTPW

Theme Park Inc guests: the native state machine#

Theme Park Inc's guests have their own state machine: 31 states (the word +0x2C0), a setter with an entry table and a dispatch. OpenTPW ports it in phases (the plan is kept outside the repository). This note records what each phase ports, with the addresses in the no-CD Game.exe.

The port runs on the shared Guest records inside the shared GuestSimulation sweep, for the guests that carry a Theme Park Inc record (Guest.Tpi, ThemeParkIncGuestRecord). The hidden switch GuestSimulation.ThemeParkIncNativeGuests turns it on, either from the command line (--tpi-native-guests) or from a test. The switch is off by default. With it off, Theme Park Inc guests keep Theme Park World's rules ([EXT:tpi-twp-guest-rules]), and Theme Park World and the default Theme Park Inc park behave exactly as before. Phase P4 turns the switch on by default.

The walk step, the route search, the wander and the speed stay Theme Park World's under [EXT:tpi-twp-guest-rules], as for the staff.

Files#

FileContents
World/Guests/ThemeParkInc/ThemeParkIncGuestStates.csstate numbers, the name table, the catch test, the queue predicate, the entry modes, the projection onto GuestState
World/Guests/ThemeParkInc/ThemeParkIncGuestRecord.csthe fields of the constructor 0x60C3F0 that Guest does not hold
World/Guests/ThemeParkInc/ThemeParkIncGuestSettings.csthe Standard words the states read, by address
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkInc.csthe setter, the dispatch, the pre-update, the weather rule, the thought pick, the constructor's tail, the P1 states
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkIncArrivals.csthe arrival guest, the vehicle dispatch, the pick-up test
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkIncIdle.csphase P2: idle (state 6), the spot animation, the bin search, the wander (7), the walk to a bin (9), the removal message
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkIncQueues.csphase P3a: the walk to a ride (13), the queue (14), the queue step (15), the queue functions and the ride's calls
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkIncVisit.csphase P3b: being loaded (16), the script's admission (17), the object's control (20), the exit, the use routine and its outcome, being unloaded (19)
Economy/ParkEconomy.ThemeParkIncVisits.csphase P3b: the economy's bookings of a native use (the income, the cost, the goods, the thing words)
World/Guests/ThemeParkInc/GuestSimulation.ThemeParkIncDecisions.csphase P3a: the major decision 0x610080, the minor decision 0x6114B0, the score's inputs
World/Guests/ThemeParkInc/ThemeParkIncAttractionScore.csthe attraction score 0x6101E0 (pure), the x87 single rounding
World/Guests/ThemeParkInc/IThemeParkIncGuestWorld.cswhat the native guests read of the park: the object list's bins, shows and attractions, a thing by id and its type, the entertainers
World/Level.ThemeParkIncGuests.csthe level's side of that view, rebuilt after a placement or a removal, and the removal message's hook
World/Guests/ThemeParkInc/ThemeParkIncGuestSnapshot.csthe save block (an optional member of guest snapshot schema 9)

The tick#

The kind switch 0x6375E0 (kind 1) calls the pre-update 0x619B50 and then the dispatch 0x619FF0, every turn, for every guest, inside the thing sweep (Level.RunThingSweep → GuestSimulation.SweepGuest). Between two turns a native guest runs nothing but its drawn point.

Pre-update 0x619B50.

  1. The speed average 0x60BC90. This is Theme Park World's 0x004FA870 (GuestSpeed.Update).

  2. On the guest's phase only, where (id & 3) == (turn & 3):

    • the weather rule 0x611050 (see below);

    • the exit counter +0x1E0 goes down by 1;

    • the region record's words +0, +2 and +4 (0x5D7420) are added to happiness, illness and hunger;

    • on a turn whose low four bits are 0, toilet grows by 1 and hunger and thirst by 2;

    • an illness, hunger or thirst byte of 100 costs 1 happiness each;

    • a toilet byte above 80 costs 1 happiness and sets the speed term to 25, unless an umbrella is up (0x60B3F0); a byte of 100 costs 1 more, and a byte of 95 asks the thought object for thought 4;

    • outside states 0x14 and 0x15 and on a park cell (0x60BE00): one world draw, and R % 10 == 0 runs the thought pick 0x60FC60. The balloon countdown +0x298 runs under the same test, so a guest on an object, a held guest or a guest outside the park keeps its balloon's time;

    • the thought object 0x6388F0.

  3. Every turn: outside the queue states 14..17 the queue words +0x2CC/+0x2CE are cleared (0x619EC3).

  4. Every 20th turn the history shifts (0x611D60 → 0x611D20). This shift is bug-compatible: its dword copy overlaps, so [a, b, c, d] becomes [0, a, b, b]. Theme Park World keeps c.

The oracle found the overlapping copy and the balloon countdown's place in the branch.

Thought pick 0x60FC60. Hunger and thirst bytes both above 90 give 3. Otherwise the first match of this list wins:

TestThought
toilet above ThoughtBubbleNeedTheLoo4
hunger above Hungry1
thirst above Thirsty2
illness above Sick14
the block's littered share above Mess (a float)7
happiness above Happy9
happiness below Unhappy11

Thought 4 is voiced (0x85) for one thing id in sixteen. Two parts run by Theme Park World's rules under [EXT:tpi-twp-guest-rules]:

Weather rule 0x611050.

Setter and dispatch#

The setter 0x61A540 stores the word, then runs the entry of the table 0x61AA54:

The entries of 21 and 26 read objects of the later phases and are not run yet.

The projection (ThemeParkIncGuestStates.Projection) writes Guest.State for the readers outside the simulation, by role and never by number. For example, TPI 18 waits at the infodesk while TPW 18 is the leaving state. The guard's catch test 0x614720 catches 6..0xD, 0x16 and any word outside the table; IGuardGuests.IsCatchable asks it for a native guest. The dispatch 0x619FF0 uses the table 0x61A3A8.

Phase P1: arrival and leaving#

Constructor tail 0x60C9F5..0x60CB7F.

The arrival update 0x5BCB10 is Theme Park World's 0x004CF3E0 step for step, with three differences:

The vehicles are the features bus, heli and mono. On the switch-on path the level gives the guests these vehicles, and no Bus is placed at setup ([EXT:tpi-bus-from-setup] holds only on the default path).

The states.

StateHandlerBehaviour
00x61A05Cwalk; arrived: heading 0x400, state 1 (unreachable: nothing writes 0)
10x61A082once the crossing gate 0x6501D0 allows: a booth from a draw, a point in it from two more, state 2 (unreachable)
20x615A80the speed term (50 while the bus waits at status 3, else 25 for one id in four), the walk; arrived: 4 with the park open, 3 closed
30x615B40closed or the gate shut: the wait counts down, and at 0 the walk to the bus stop and state 22. Open and paid, as the head of its cell's list: an entrance from a draw, state 5. Open and unpaid: the booth scan 0x615BEB (only id % N and its ^ 1 partner are compared, bug-compatible), state 2
40x615E90the verdict 0x6157D0 (BoothVerdict's formula over Theme Park Inc's words; 24-bit products: the exact integer times the single-precision factor, rounded once to single precision as fmuls does at control word 0x7F); see the list below
50x616790closed or the gate shut: the booth block 0x6168D6 (it compares the cell with booth k but routes to booth i, bug-compatible), state 3. Open: the walk; arrived: the visitor number, state 6
80x61A382the saved state comes back once the turn is past the stamp plus 10 (unreachable in P1)
220x618620the recall "Make up your mind!" (exit counter above 0, happiness byte nonzero, park open, on a park cell) gives state 6 and walk mask 0. Otherwise the walk: arrived, heading 0x7FF (heli or mono) or 0x400 and state 30; stuck, the bus stop again
230x61A307state 6
270x614830101 waits, then state 6
28, 290x61A3A0nothing (unreachable)
300x618790status 4: the guest leaves (beam, destroyed). Status 1..3, off BusStopA and its +X neighbour: one draw for the cell, two for the point, the walk, state 22

The verdict cases of state 4:

Walk to the bus stop 0x615D50.

0x60B7F0 and 0x60B8E0 are byte for byte Theme Park World's 0x004FA530 and 0x004FA5F0. Both have the stranded gate (RequestRoute, RouteToTpiPoint).

State 6 ran a stub in P1 (only its leave gate); phase P2 ports the whole handler (below).

Not ported, gated under [EXT:tpi-capability-gates]:

The balloon's litter (phase P3b) drops wherever a held balloon (+0x294) goes with litter: the umbrella's carrying out (0x61413A, inline), state 20's entry at an umbrella shop (0x61A7D4) and the balloon prank (0x61507C), the last two through 0x613D00(1). The type is the colour's (+0x2A0) entry of 0x9D0614: 9, 0xC, 0xB and 0xA, Theme Park Inc's burst balloons (LitterType.BurstBalloon1..4; the drop's table 0x5D8EFC gives them the descriptors 0x9B0AD8..0x9B0B44, its SPR_LI slots 8..11). It lies on the guest's own cell (the bytes +5, +7) through the common drop 0x5D8C80 (ParkLitter.Drop): a cell that holds litter (+0x30 nonzero) takes none and nothing is drawn; otherwise the world generator is reseeded with the cell word (0x5D8DCF) and drawn twice (0x5D8E14, 0x5D8E42). The countdown's release (0x619EB6) passes 0 and leaves no litter. A Theme Park Inc park's save holds the types 1..0xC.

Phase P2: idle, wander, spot animations, litter#

State 6 0x614A40. One world draw A comes first; then, in order:

  1. Mood. The turn more than 100 past the spot stamp +0x230, a happiness byte above 80 and the umbrella down (+0x238 0 or 2): the mood animation 0x60CDD0 (a kid 5, a parent 6 female or 7 male, a grandparent 8 or 9; the gender is the sprite bank's byte +0x206, the ESP header's byte 0x10D) through the spot animation, and the update ends.

  2. Vomit. An illness byte of 100 and A % 3 == 0: the spot animation 0xC, vomit (litter 7) on the cell, the sound 0xCC, illness 0, and the update ends.

  3. Litter urge. A litter byte of 90 or more: draw B, and with B & 3 == 0 the bin search 0x618D10 of radius 3 (a bin: the target +0x204, state 9, end); else draw C and, on a cell without litter, litter C % 5 + 1 and the urge 0.

  4. Leave gate. As in P1, but the handler goes on (bug-compatible): a later step can overwrite state 22 in the same update.

  5. Show. The nearest show (UsageInfo.IsFireworks, the thing flag +0x42 bit 0x80) within a squared distance of 4 whose script variable 0 is 0 (0x6193B0): the heading 0x91E074(−dx, dy) unless dx + dy == 0, and the update ends.

  6. Entertainer reaction 0x614D41. An entertainer in the 3 × 3 cells (0x5B1B20, kind 6, radius 1) and the nearest one of the entertainers' list (0x619100) performing (+0x1B4 == 0x17): the heading towards him and +0x1B8 = 1, and the update ends; nothing else changes. On the diagonal (dx + dy == 0) +0x1B8 = 0 and the update goes on. The staff world gives the list (ThemeParkIncStaffWorld.Entertainers); this closes the gate the entertainer's port left.

  7. Prank gate 0x614E56. A happiness byte below PrankHappinessThreshold, +0x29C clear and A % 100 below PrankLikelihood (or the one-shot +0x2B1, always 0 in retail): +0x2B1 = 0, then the switch 0x615414 on the prank code − 1:

    • 0 (code 1): A % 100 below StinkbombLikelihood: a stinkbomb (litter 8), the sound 0xCF and the tail;

    • 1 (code 2): the toilet meter 80 and +0x29C = 1, which shuts the gate for good;

    • 2 (code 3): the bin search of radius 6 (its route requests included); a bin whose VAR_PRANKED (10) is 0 becomes the target +0x204 and the update ends (0x61510A), state 10's entry gated (below); no bin goes on;

    • 4 (code 5, which no birth gives): litter A % 5 + 1, the code 0, state 7 and the tail;

    • 6 and 7 (codes 7 and 8, 16 of the 20 adult entries of the prank table): the stand animation 3 (0x60B6E0) and the update ends (0x6151C8, 0x615188) with no draw and no decision; the entries of 25 and 24 and their words are gated (below);

    • 3 and 5: gated (below).

    The tail 0x614F14 posts the prank message (ThemeParkIncPrankPosted: kind 1, 5 or 6 and the guest's id) and adds 1 to happiness; the update goes on.

  8. Decision on A & 3 0x61523F.

    • 0 and 2: after 30 turns past +0x224, the major decision 0x610080 (phase P3a); a ride chosen sets state 13; with none the can't-decide pause (spot animation 4, or 3 with the umbrella up), SmallHappinessChange and the stamp.

    • 1: the wander destination 0x609F70; found: state 7, else the stamp.

    • 3: rand() < 0x3FFF, and when it passes a second one, towards another guest or an infodesk. Both are world draws world.Next(0x8000) < 0x3FFF under [EXT:tpi-staff-crt-rand] (the user's decision of 2026-11-22, the reduction decided 2026-11-23).

Spot animation 0x60FB30. The sound for one thing id in three (4: 0x7E, 5..9: 0x4D, 10: 0xD5), the animation on the sprite (+0x20), the state into +0x2C4, the turn into +0x230 and state 8, which restores the saved state ten turns later.

State 7 0x61A179. The walk; arrived or stuck, a world draw with G & 3 == 0 and a new wander destination keep the guest wandering, anything else makes it idle. The wander destination is Theme Park World's ([EXT:tpi-twp-guest-rules]); a walk it sets raises the wander flag +0xE8, which state 7's entry reads.

State 9 0x616F10. The walk. Arrived at a bin: the bin counts a customer (0x5E5DA0); unless its VAR_CONTENTS (4) reaches VAR_CAPACITY (3) or VAR_ONFIRE (5) is set, its VAR_USE (0) becomes 1. Otherwise (no bin, a full or burning bin, a stuck walk): a draw and litter D % 5 + 1 on the cell. The urge is emptied and the guest is idle.

Bin search 0x618D10. The object list's bins (+0x42 bit 0x40), the nearest below the radius whose VAR_PRANKED (10) and VAR_ONFIRE (5) are 0 and that the route request to its stand point reaches. The stand point (0x5E1300) is EntryCellStandPosX/Y in the entrance cell +0x46, turned with the object and times 255.0f at 24 bits. Every closer bin makes its own route request, so a failed request after a found bin leaves the walk on the failed one.

Removal message 0x60D120. A destroyed attraction thing (message 0xA, at the click): every native guest whose target +0x204 it is loses SmallHappinessChange and its target and becomes idle, whatever its state; +0x206 and the histories forget it.

Freeze 0x60FF40. Its only caller (through the thunk 0x407815, at 0x50467C and 0x5047F7) is 0x503FD0, a UI input handler of the park view: it reads the shift, control and alt keys (GetAsyncKeyState) and freezes the person it keeps in [0xA568F4] when that is a guest (kind 1) whose cell is the cell [0xA43494], then shows its info text. The freeze itself: not in the queue states (0x61AC40), on a park cell (0x60BE00) and outside the states 0x13, 0x14 and 0x1B, the old state goes into +0x2C4 (unless it is 23), state 23 and the heading 0. It is UI only and is not ported in P2; state 23's handler (P1) is.

Gated in P2 ([EXT:tpi-capability-gates]; none of them draws):

[EXT:tpi-no-maintenance-wear] keeps the bins' fill: a dirty bin's RegionFX row change (0x5E3990, rows 8 and 9 through 0x5D74D0/0x5D74A0) is not made, and the constructor puts no row 8 down either. The script itself runs, so VAR_USE reaches it.

Phase P3a: the ride choice, the walk to a ride, the queue#

The queue list. Theme Park Inc's ride keeps its queue as a list through the guests' words +0x2CC (next) and +0x2CE (previous), its head at +0x4C. The functions are Theme Park World's instruction for instruction, the field offsets aside, so the list is the ride bridge's (RideVisitorBridge), and the native guests' two words follow it:

FunctionTheme Park WorldWhat it does
0x5DFF500x004DDB90appends the guest (AppendToQueue)
0x5E01000x004DDD20unlinks it; the script's VAR_LETMEON naming it becomes 0 (LeaveQueue)
0x5E02800x004DDF50the guest's place, −1 when the walk from the head does not reach it; with id 0 the length. The walk stops at a guest outside the queue states (0x61AC40), which it still counts (TpiQueuePosition)
0x5DFDD00x004DDA20room: the length below 4 × the cells +0x50
0x5DFE000x004DDA40the limit: 100 without Info.HasQueue, else _ftol(max(QWTC × capacity × g / duration, 4.0)), g the speed over InitSpeed. Theme Park Inc multiplies in this order, at 24 bits (ThemeParkIncQueueLimit)
0x5DFF100x004DDB60too long: the length at least the limit
0x5E05200x004DE110the back-of-queue cell word
0x5E0C700x004DE7E0a place's queue slot, one world draw for the sideways byte (QueueSlotPoint)

+0x21B has two uses, one after the other: in states 14 to 16 it is the guest's place (FindQueueDestination 0x619530 writes it, state 14 compares it with 0x5E0280, and its entry sets +0x21C = _ftol(1.2f × +0x21B)); state 17's entry then overwrites it with the ride's roll 0x5E7A00, which the end of the visit reads. Theme Park World's +0x1F1 does the same (a sideshow's play, 0x004E2670).

FindQueueDestination 0x619530 stores the place in +0x21B, takes the slot and asks for the walk there (0x60B8E0); a walk sets state 15. The dismissal 0x619700 takes an argument: 0 plays the sound 0x80 for one thing id in eight and costs MediumHappinessChange, 1 neither. It clears +0x2CC, +0x2CE, +0x28C, +0x290, +0x220, +0x204 and +0x21B and sets state 6. The walk-away 0x5E5D70 raises the ride's walk-away count (mNumWalkAways, the economy's RecordWalkAway); Theme Park Inc calls it on every queue exit of state 14 and on state 13's refusal of a long queue, where Theme Park World calls it only for a refused price.

The score 0x6101E0 is Theme Park World's (0x004FCC30, AttractionScore) with these differences (ThemeParkIncAttractionScore):

The major decision 0x610080 (state 6, A & 3 0 or 2) clears the target and walks the object list newest first: a choosable thing (+0x42 bit 4) with a back cell and a score of at least 10 that beats the best (a tie on an odd turn) wins when it passes the counts test 0x5DFC90 (open, not broken down or condemned, room, the coaster and track words) and the route request to its back cell succeeds. A chosen ride sets state 13; none gives the can't-decide pause of phase P2.

The minor decision 0x6114B0 is tp.exe's 0x004FD570 over Theme Park Inc's score: the 4 × 4 cells round the guest nearer to the target's back cell, the best above 0, the route lengths from the target's access cell; it keeps the old target in +0x206.

State 13 0x616AC0, the walk to the ride. The walk step comes first. A closed ride (the open word +0x7C, which Theme Park World's state 10 does not read) or a stuck walk costs BigHappinessChange and makes the guest idle. Arrived:

While walking: a closed park costs BigHappinessChange and ends the walk; a balloon shop with the umbrella state 3 or 4 and an umbrella shop in fair weather end it with no happiness step; every twelfth update makes a minor decision.

State 14 0x6176C0, the queue.

Every exit away from the queue is 0x5E0100, 0x619700(0), the walk-away and state 6.

State 15 0x61A1DB, the queue step. The walk; arrived or stuck, state 14.

The ride's side. The bridge's admission calls a native guest when it stands at the front (0x619640: state 14, place 0) through OnAdmittance 0x619670 (+0x220 = 1). A closed or broken ride's head step 0x5E3CC0 sends the head away with the dismissal (0). The queue edit's re-evaluation 0x6197F0 sends a guest whose place the room no longer holds away (thought 13 for one thing id in three, then the dismissal), outside state 17. The removal message 0x60D120 now sends a queued guest away with the dismissal (0) before the small step.

State 16 onwards is phase P3b's (below). Phase P3a ran it as a bridged boarding: the guest kept the state word 16 through Theme Park World's boarding, waiting, ride and exit states. A phase P3a save of such a guest restores natively (see "Save").

Gated in P3a ([EXT:tpi-capability-gates]):

Phase P3b: the visit#

OnAdmittance 0x619670 now records the fee: +0x1B4 = the thing's price +0x94 (0x5E6200). Nothing clears it; the next call overwrites it.

State 16 0x617F80, being loaded. The walk to the stand point; a stuck walk (2) falls through as an arrival. Arrived:

  1. the price test 0x6120C0 (ThemeParkIncPriceTest, X62) on the guest's own expected byte +0x2A8: too expensive is thought 6, MediumHappinessChange, the ride lets go of the admitted guest (0x5E46A0), 0x5E0100, the dismissal 0x619700(0) (a second medium step), the walk-away and state 6;

  2. a weather reaction armed in the queue (+0x28C 1): a balloon (+0x294, +0x298) or a reaction due within 0.66 × SlowestWeatherChangeResponse quarter turns (the unsigned difference +0x290 − (turn >> 2) against the single fild × 0.66f at 24 bits, not below) leaves quietly (0x619700(1)); else +0x28C and +0x290 are cleared;

  3. AdmitPerson 0x5E4420 (the bridge's PresentForBoarding: a broken or closed ride refuses, the loading slot is cleared, a busy VAR_LETMEON refuses, else it takes the id): state 17;

  4. refused: FindQueueDestination 0x619530 (state 15), or "Couldn't rejoin FOQ even!": out of the list, the dismissal (0) and state 6.

State 17 0x61A21D, waiting for the script. The entry draws the ride's chance roll 0x5E7A00: one world draw R, and +0x21B = 1 when the thing's win byte +0x90 (100 − InitChanceOfLoosing, so 100 for most attractions) is at least R % 100; the result also goes into the script's VAR_PARAM (variable 11). This overwrites the queue place +0x21B held. The handler waits until the script has taken VAR_LETMEON (0x5E4630: VAR_LETMEON no longer the list's head), then the guest leaves the list (0x5E0100) and enters 20. A guest stays in the list until then, so the bridge keeps a native guest's link when its script boards it (IRideVisitorHost.KeepsBoardedGuestQueued), and the ride's admission sees a head in 17, which is not at the front. The ride's head step 0x5E3CC0 forces such a head onto the ride when VAR_LETMEON is no longer it (0x6182A0, IRideVisitorHost.ForcesAdmittedHead) instead of dismissing it.

State 20 0x61A292, under the object's control, does nothing. Its entry 0x61A77E:

The pre-update skips the thought draw and the balloon countdown in 20 (0x619E6A).

The exit 0x619980 is the ride's dismiss of VAR_LETMEOFF (the bridge's OnVisitorExitRide) for a guest in state 20; the let-off of a guest still in 17 is open (below). A guest with no target leaves at once and is not moved. Otherwise the guest is put at the exit's appear point and asked to walk to the cell beyond the exit (Theme Park World's ExitRide 0x005014E0, byte for byte: a queue or entrance cell beyond, 0x67F5D0, or no route closes the ride, 0x5E1620, and the guest stays). Then the use routine runs and the guest enters 19.

The use routine 0x6118D0:

  1. the thing id into the used history ([a, b, c, d] becomes [id, a, b, b]);

  2. the visit count of the kind (Info.WhichUIType 0, 1, 2: +0x1EC, +0x1F0, +0x1F4);

  3. the payment step 0x6126D0: a fee above 0 is booked (0x5E5DE0: the bank, the takings, a shop's message 0xC and sale events), the till sounds (0xD0), the purse falls and +0x1C4 rises;

  4. the customer (0x5E5DA0) and the fatigue +0x1DC −= UsageInfo.FatigueEffect;

  5. an attraction with Info.RideTypeStringIndex 0x17 reads its result back from VAR_PARAM into +0x21B;

  6. +0x21B 0, a lost use: MediumHappinessChange, +0x2E4 = 0, +0x2DC −= 35 and a sideshow's thought 6. Otherwise the outcome, then the record 3 × (byte(happiness) − byte(+0x234)) + 50 in the park statistics (a shop: categories 0xB..0xE by its special ingredient and 0x10..0x12 by its appearance; a sideshow: 0x14; 0x5AEDE0, IGuestPayments.PriceTested) and a sideshow's thought 5.

The outcome 0x612740, in this order:

  1. +0x2E4 = 1; a sideshow books its prize (+0x88, 0x5E60E0), the prize goes into the purse and +0x2DC += 50; a shop books its goods (0x5E63E0);

  2. the match step 0x611DA0: with a rating (the live excitement byte, 0x5E41D0) the difference to the guest's +0x2A8 picks PerfectRide, GoodRide or OKRide (below Perfect/Good/OKExcitementMatch), which +0x2E0 also takes (an OK match of a ride more exciting than wanted raises the declined ring +0x4C8); the illness rises by ((100 − byte(hunger)) / 20) × (rating / RideVomitDivisor), and a rise of its byte lowers +0x2E0;

  3. happiness += the gain and UsageInfo.HappinessEffect; the mood (a single) = their sum; illness += VomitEffect;

  4. a shop: thirst −= ThirstEffect, hunger −= HungerEffect (the larger plays 0x83 or 0x84); illness, happiness and the mood += the third slider byte +0x9C (50); litter += LitterEffect and += +0x9C; toilet += ToiletEffect;

  5. the small portions: a HungerEffect draws (0x612AEC) and (R & 7) + effect + amount below 30 (the amount byte +0x98) costs the small step (happiness and mood) and +0x2D0 −= 30, else +0x2D0 += 35; the same for ThirstEffect (0x612BCF) and +0x2D4;

  6. happiness and the mood += HappinessEffect × amount / 100;

  7. the special ingredient: Fat toilet += (FatEffect + 1) × amount / 100, Salt thirst += (SaltEffect + 1) × amount / 100, Ice thirst += (IceEffect + ThirstEffect) × amount / 100, Sugar the speed boost word +0xD8 += (SugarEffect + 1) × amount / 100;

  8. the appearance (AppearanceEffect): a balloon shop gives a balloon (the colour draw 0x690370(0xE): the draw >> 2 modulo the balloon bank's slot count +0x21E, which the ESP loader counts as the slots with frames (0x68EBEF; four in the shipped Spr_bl, read at the level's load), the countdown clamp(quality × 255 / 100, 25, 255) from the quality byte +0x8C) and judges the quality (a draw: below ComplainAboutThisQuality + R % 10 raises the declined ring and +0x2D8 by 33, else lowers it by 33); a costume shop puts a costume on (category 6, the variant draw 0x6902F0(6), a draw nothing reads, the judgement and +0x2D8 = 33) or takes it off (category 0 and the variant drawn after a reseed with the guest's id, bug-compatible: the guest becomes a kid's bank); an umbrella shop opens an umbrella (the colour draw 0x690370(0x13), the speed term 0, the judgement and +0x2D8 = 33);

  9. a relief object (the thing flag +0x42 bit 1): an illness byte above 90 is cured for −50 happiness, a worn toilet costs 20, else half the toilet byte is gained; the toilet meter goes to 0 and the speed term to 25;

  10. a won play: +0x1F8 += 1 and happiness and the mood += _ftol(ln(prize / price) / ln 2 × MediumHappinessChange) (a free play: an infinity, 0);

  11. the photo booth word +0x208 (a booth whose score passes PhotoThreshold): 0, since the thing's booth word +0x3A is 0 without add-ons;

  12. the mood: above HappyDiffForVGood thought 5 and the mood animation (umbrella down); below HappyDiffForVPoor thought 6 and animation 10; above HappyDiffForGood thought 5; below HappyDiffForPoor thought 6 and animation 10. The animation saves the state 20 and the exit's state 19 follows at once.

State 19 0x618380, being unloaded. The entry 0x61A69D gives the body back (mode 1 when a ride that draws it kept it), plays a teleporting ride's beam and gives a balloon kept through the ride back, unless a balloon shop has just given one. Before a teleporting ride's beam (0x61A716) the entry calls the sprite placement 0x60AE00(0) (0x61A70B), which also raises the stamp counter 0x5D81F0 (0x60AFFD) and clears the stranded mark +0x1B0 when the raised value is below it (0x60B002): with Theme Park Inc's navigator (--tpi-native-walk) that is ThemeParkIncPlacementStamp, as at the constructor's placement (TPI-NAVIGATOR.md); Theme Park World's walk counts the edits only and takes nothing here. The handler walks; stuck, the target is cleared and the guest is idle. Arrived:

No world draw is taken in 16, 19 or 20's entry; 17's entry takes one; the outcome takes one per nonzero hunger and thirst effect and one to three in the appearance step.

Gated in P3b ([EXT:tpi-capability-gates]; none of them draws):

[EXT:tpi-no-maintenance-wear] keeps the toilet's wear: a relief visit's 0x5E78E0 (the repair word +0x54 by the toilet byte and its RegionFX rows 1 and 6) is not made.

OpenTPW's own teardown (a ride whose script stopped or faulted) lets go of a native rider by the exit, and sets it down beyond the exit and idle when the exit is blocked; a guest still in 17 is taken out of the list and made idle the same way. A demolished ride's riders are the removal message's.

Deferred (review follow-ups of phases P2 and P3a):

Open: the let-off in state 17 (not yet ported, under research). The original's dismiss callers (0x5E4FFF, 0x5E5907, 0x5E5A96) call the exit 0x619980 without a state test, and neither the exit, the use routine 0x6118D0 nor the setter 0x61A540 calls the unlink 0x5E0100, so a guest let off while still in 17 leaves a ghost in the ride's queue list. The case is reachable: a script can take a guest and let it off before the guest's own update (RideVisitorBridge.KeepsBoardedGuestQueued). OpenTPW ignores that let-off for now: the guest is later forced into state 20 with no ride holding it and stays stuck, and a save of that park is refused ("state 20 but no attraction holds it aboard"). There is no crash, and the switch-off paths are not affected. The ghost's later fate in the original is being researched before a decision.

Save#

The guest snapshot stays at schema 9. A native guest writes an optional block GuestSnapshot.Tpi (ThemeParkIncGuestSnapshot) with every field of the record. A guest without it writes nothing new, so a save made with the switch off is byte for byte the save of a build without this phase. The block joins the state hashes only on a native guest, so the hashes and the determinism pins of every switch-off park are unchanged.

The snapshot also records whether the park ran the native machine, in the optional member GuestSimulationSnapshot.ThemeParkIncNativeGuests (written only when true). A restore refuses a save whose value (absent counts as false) differs from the running simulation's:

A restore also refuses a native guest in a state this build cannot run (10..12, 18, 21 and 24..26, or a spot animation 8 that returns to one), so a save of a later phase or an edited save never stops a guest's update mid-tick. A native guest in a queue state (14..17, or 8 returning to one) must be in the list of the ride it names and no other guest may be; a guest in 17 must also be named by the ride's written loading slot or held by the ride; a guest in 20 must be held by the ride it names; no other native guest may be held. Phase P3a adds no saved field. Phase P2 adds one optional member to the block, the wander flag +0xE8 (Wandered; absent in a phase P1 save, whose guests never wandered), and phase P3b five: the fee word +0x1B4 (Fee), the use flag +0x2E4 (UseSucceeded), the balloon colour +0x2A0 (BalloonColour) and the costume's sprite words +0x34/+0x30 (SpriteCategory, SpriteVariant; absent while the guest keeps the constructor's), all absent in an earlier phase's save, without a new schema. The block's balloon is no longer refused: a countdown above the balloon's life 255 is.

A phase P3a save can hold a guest of the bridged boarding: the state word 16 with Theme Park World's Boarding, WaitingToBoard, Using or ExitingRide. Boarding (the walk to the stand point) is state 16 itself and restores. A rider of the bridged boarding (WaitingToBoard, Using or ExitingRide) stands for 17, 20 or 19, whose chance roll +0x21B, fee +0x1B4 and mode the bridged boarding never kept: the restore refuses it, with the guest and its states named, rather than inventing them. A guest in 16 with any other projection is refused too.

Settings#

ThemeParkIncGuestSettings reads the Standard object (0xA01A60, ThemeParkIncStandard) by address. It reads:

A test checks every address against its key through the SAM binding.

The level reads these settings (GuestSettings.TpiNative) only when the switch is on; a switch-off park never loads them.

Verification#

Phases after P3b#

Source: docs/reverse/TPI-GUESTS.md in the project repository.