Script bindings: Levels and game state¶
Verified against: SLUS_212.15 (NTSC-U, SHA1 e9cb2cc49aa046b9e494313dce2f5038ed17b2f4).
Bindings for level flow, checkpoints, difficulty, unlockables, stats, money and police: 90 in all. Conventions, the other categories and how to read an entry are on the masterlist.
| Binding | Returns | Scripts | Boot | Mission 1 | Evidence |
|---|---|---|---|---|---|
AddMoneyToBank |
- | 0 | no | no | confirmed (code) |
AdjustBossLizzies |
- | 0 | no | no | confirmed (code) |
CheckMultiplayer |
- | 1 | no | no | confirmed (code) |
CreateDongle |
number | 1 | no | no | confirmed (code) |
CreateDongleChallengeKey |
number | 1 | no | no | confirmed (code) |
CrimeIsHappening |
- | 12 | yes | no | confirmed (code) |
EnableGameOverCheck |
- | 3 | no | no | confirmed (code) |
EnterStore |
- | 2 | yes | yes | confirmed (code) |
ExitStore |
- | 1 | yes | yes | confirmed (code) |
ForceCrimeLevel |
- | 9 | no | no | confirmed (code) |
GameIsOver |
boolean | 2 | no | no | confirmed (code) |
GetCheckPoint |
number | 32 | yes | yes | confirmed (code) |
GetCurrentLevelIndex |
number | 3 | yes | no | confirmed (code) |
GetDifficulty |
number | 23 | yes | yes | confirmed (code) |
GetGameMode |
number | 1 | no | no | confirmed (code) |
GetGameTime |
number | 2 | no | no | confirmed (code) |
GetLanguage |
number | 92 | yes | yes | confirmed (code) |
GetLevelId |
number | 2 | yes | no | confirmed (code) |
GetLevelNamePacked |
string | 0 | no | no | confirmed (code) |
GetLUASaveDataBool |
boolean | 1 | yes | no | confirmed (code) |
GetLUASaveDataFloat |
number | 19 | no | no | confirmed (code) |
GetNumberOfLevelsPacked |
number | 0 | no | no | inferred |
GetProfileDifficulty |
number | 1 | yes | no | confirmed (code) |
GetRumbleModeData |
- | 33 | no | no | confirmed (code) |
GetRumbleModeGangName |
string | 33 | no | no | confirmed (code) |
GiveMoney |
- | 3 | no | yes | confirmed (code) |
InvGetMoney |
number | 12 | no | yes | confirmed (code) |
InvGetSpraycanCharges |
number | 9 | yes | yes | confirmed (code) |
InvGiveItem |
- | 6 | yes | yes | confirmed (code) |
InvGiveRevive |
- | 12 | yes | yes | confirmed (code) |
InvGiveSkeletonKey |
- | 1 | yes | yes | confirmed (code) |
InvNumberOf |
number | 7 | yes | yes | confirmed (code) |
InvNumberRevives |
number | 4 | yes | yes | confirmed (code) |
InvNumberSkeletonKeys |
number | 1 | yes | yes | confirmed (code) |
InvPlayerHasItem |
boolean | 1 | no | no | confirmed (code) |
InvSetMoney |
- | 7 | yes | yes | confirmed (code) |
InvSetSpraycanCharges |
- | 10 | yes | yes | confirmed (code) |
IsDongleValid |
boolean | 1 | no | no | confirmed (code) |
MenuLoadLevel |
- | 44 | yes | yes | confirmed (code) |
MissionComplete |
- | 0 | no | no | confirmed (code) |
PrecacheWorld |
- | 36 | no | no | confirmed (code) |
ProcessTag |
- | 10 | yes | no | confirmed (code) |
QueueFileToPrecache |
- | 34 | no | no | confirmed (code) |
Quit |
- | 0 | no | no | confirmed (code) |
ReportCrime |
- | 9 | no | yes | confirmed (code) |
ResetStore |
- | 1 | no | no | confirmed (code) |
SetCheckPoint |
- | 64 | yes | yes | confirmed (code) |
SetCopGuardArrestedRange |
- | 1 | yes | no | confirmed (code) |
SetCopSpawnMax |
- | 1 | no | no | confirmed (code) |
SetCopStation |
- | 0 | no | no | confirmed (code) |
SetCrimeLevel |
- | 0 | no | no | confirmed (code) |
SetCrimeSceneTimeLength |
- | 0 | no | no | confirmed (code) |
SetDifficulty |
- | 6 | yes | no | confirmed (code) |
SetGameMode |
- | 33 | no | no | confirmed (code) |
SetLoadPriority |
- | 1 | no | no | confirmed (code) |
SetLUASaveDataBool |
- | 1 | yes | no | confirmed (code) |
SetLUASaveDataFloat |
- | 21 | yes | no | confirmed (code) |
SetSpawnMax |
- | 48 | no | no | confirmed (code) |
SpawnCustomCrime |
- | 2 | no | no | confirmed (code) |
SSMC_detect |
- | 0 | no | no | confirmed (code) |
SSMC_format |
boolean | 0 | no | no | confirmed (code) |
SSMC_StartDeleteSequence |
- | 1 | yes | no | confirmed (code) |
SSMC_StartLoadSequence |
- | 1 | yes | no | confirmed (code) |
SSMC_StartSaveSequence |
- | 3 | no | no | confirmed (code) |
StatAdd |
- | 4 | yes | yes | confirmed (code) |
StatGetHighScore |
number | 0 | no | no | confirmed (code) |
StatGetPreviousHiScore |
number | 0 | no | no | inferred |
StatGetRank |
number | 0 | no | no | inferred |
StatGetScore |
number | 6 | yes | yes | confirmed (code) |
StatGetTotal |
number | 0 | no | no | confirmed (code) |
StatReset |
- | 1 | no | no | confirmed (code) |
StatResetPlayer |
- | 1 | yes | yes | confirmed (code) |
TakeMoney |
- | 5 | no | no | confirmed (code) |
UM_GetRecordData |
number | 4 | no | no | confirmed (code) |
UM_GetUnlockables |
- | 1 | no | no | confirmed (code) |
UM_GetUnlockablesByType |
- | 3 | no | no | confirmed (code) |
UM_IsDataDirty |
boolean | 2 | no | no | confirmed (code) |
UM_IsDataUnlocked |
boolean | 22 | yes | no | confirmed (code) |
UM_IsLevelComplete |
boolean | 3 | yes | yes | confirmed (code) |
UM_IsTypeDirty |
boolean | 2 | yes | no | confirmed (code) |
UM_IsUnlocked |
boolean | 1 | no | no | confirmed (code) |
UM_Reset |
- | 1 | yes | no | confirmed (code) |
UM_SetNumUnlockables |
- | 1 | yes | no | confirmed (code) |
UM_SetUnlockable |
- | 1 | yes | no | confirmed (code) |
UM_Unlock |
- | 28 | yes | yes | confirmed (code) |
UM_UnlockAll |
- | 1 | no | no | confirmed (code) |
W_GetStopWatchTime |
number | 5 | no | no | confirmed (code) |
W_SetStopWatch |
- | 32 | no | yes | confirmed (code) |
W_ShowStopWatch |
- | 30 | no | no | confirmed (code) |
W_StartStopWatch |
- | 37 | no | yes | confirmed (code) |
AddMoneyToBank¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | amount |
number, truncated to an unsigned integer | Dollars to add to the bank. |
Returns nothing.
Adds an amount to the bank total, the first word of the inventory block (W_GameState + 0x480). No shipped script calls
it.
Notes. That the word is a bank is inferred from the name; UM_UnlockAll sets it to 1,000,000.
- Evidence: confirmed (code) at
0x0041ef38; detail: brief - Wrapper
0x0037b420(registered byRegisterBindings); calls0x0041ef38 - Used by no script on the disc
- Coney: not implemented
AdjustBossLizzies¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | boss |
number, truncated to an unsigned integer | Handle of the boss; read but not used by the callee. |
| 2 | a |
number, truncated to an integer | First tuning value (16-bit), meaning not traced. |
| 3 | b |
number, truncated to an integer | Second tuning value (16-bit). |
| 4 | c |
number, truncated to an integer | Third tuning value (16-bit). |
| 5 | d |
number, truncated to an integer | Fourth tuning value (16-bit). |
Returns nothing.
Stores four tuning values for the Lizzies boss fight in globals (0x006e9424-0x006e942a) and resets three companions
to 1000, 50 and 1000. No shipped script calls it.
Notes. The first argument is ignored by 0x0029fb60; what reads the globals is not traced.
- Evidence: confirmed (code) at
0x0029fb60; detail: brief - Wrapper
0x00362768(registered byRegisterBindings); calls0x0029fb60 - Used by no script on the disc
- Coney: not implemented
CheckMultiplayer¶
No arguments.
Returns nothing.
Brings the player characters in line with the game's two-player setting (W_GameState +0x56ec, or +0x56f4 in the Armies of the Night levels): when two players are set but only player 1 exists, a Warrior of player 1's gang (the lowest rank byte +0x1b1, else any Warrior) becomes player 2 with split screen; when one player is set but a second exists, player 2 goes back to the AI. The multiplayer callback (SetMultiplayerCallback) is called with the human and true or false. The hub calls it after its menus.
Notes. Only while joining is allowed (CfgMultiplayerJoin, +0x56e8) and the game mode +0x158 is 0 or 3; otherwise, with two players present, it only refreshes their viewports. Each player-2 change rebuilds the split screen (0x00122ed0) and the war chief is reassigned at the end. Does nothing with no game state or no player. The same function runs with -1 after every level load.
- Evidence: confirmed (code) at
0x0041dd90,0x0041a460; detail: traced - Wrapper
0x0036e468(registered byRegisterBindings); calls0x0041dd90Game_CheckMultiplayer,0x0041a460GameState_SyncPlayers - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
CreateDongle¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | key |
string | A string, ignored. |
Returns number: Always 0.
Development dongle stub: ignores its argument and returns 0.
- Evidence: confirmed (code) at
0x00418520; detail: brief - Wrapper
0x0037b998(registered byRegisterBindings); calls0x00418520 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: yes
- Coney: not implemented
CreateDongleChallengeKey¶
No arguments.
Returns number: Always 0.
Development dongle stub: returns 0.
- Evidence: confirmed (code) at
0x00418528; detail: brief - Wrapper
0x0037b9e8(registered byRegisterBindings); calls0x00418528 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: yes
- Coney: not implemented
CrimeIsHappening¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | pos |
table of 3 numbers (t[1]..t[3]) | Table {x, y, z}, the crime's position in world units (metres); written back unchanged. |
| 2 | kind |
number, truncated to an integer | Crime type (16-bit); the scripts pass 1, 5, 7 and 12. |
| 3 | radius |
number (single precision) | A number read as a float but not passed on (the callee ignores it). |
| 4 | severity |
number, truncated to an integer | A value the scripts pass 0 or 100; never read (0x0041b6e0 takes it as an argument it does not use). |
| 5 | offender |
number, truncated to an unsigned integer | Handle of the human committing the crime. |
| 6 | victim |
number, truncated to an unsigned integer | Handle of the victim, or NilHandle. |
| 7 | flags |
number, truncated to an integer | A 16-bit value the scripts pass 0; passed to the report as its severity argument, which is never read. |
Returns nothing.
Reports a crime at a position so police and witnesses react (0x0041b8b0 on the game state). Used for scripted crimes
such as a mugging.
Notes. The position is transformed (0x00252ae0) before being passed on to the crime report 0x0041b8b0, which asks
for responders; what each type does: AI: crimes. Severity, radius and flags are
never read, confirmed (code) at 0x0037a2f8, 0x0041b6e0 and 0x0041b8b0 (Crimes:
wanted).
- Evidence: confirmed (code) at
0x0041b6e0; detail: traced - Wrapper
0x0037a2f8(registered byRegisterBindings); calls0x0041b6e0 - Used by 12 of 467 script chunks (18 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 22 of 28 levels, first
level87(mission 3) - Coney: implemented
EnableGameOverCheck¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | on |
boolean (nil or 0 is false) | true to let the game end the mission when the players are beaten or arrested, false to suspend that check (for scripted defeats). Missing counts as false. |
Returns nothing.
Switches the per-frame game-over check (W_GameState + 0x155, on after the level reset 0x00418c68). While it is on and
no level end is pending, GameState_CheckGameOver (0x004197a8, every frame from 0x0041a370) fails the mission when every
player is out or cuffed: a cuffed player holding a handcuff key (item 6) is
spared, and while a crew mate can still come to help the failure waits for four checks. The failure shows a reason
message (busted when cuffed, +0x118 = 1) through the HUD (0x001d1fb8) and sets the level end (+0x14c = 1).
Notes. 0x00223b70 tests state flag 0x20000, cuffed (0x002843f8 spends a handcuff key to clear it); the meanings of
0x00227dd8 (0x40000, or no state record) and 0x00227eb0 (0x100000000) are inferred as out of the fight. Any player
in the 0x100000000 state fails the mission at once.
- Evidence: confirmed (code) at
0x0041d890; detail: traced - Wrapper
0x0036c710(registered byRegisterBindings); calls0x0041d890GameState_EnableGameOverCheck - Used by 3 of 467 script chunks (6 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 2 of 28 levels, first
level51(mission 14) - Coney: implemented
EnterStore¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | colour |
table of 4 numbers (t[1]..t[4]) | Table {r, g, b, a}, each 0-1 (scaled to 0-255); the scripts pass {0, 0, 0, 0}. Written back unchanged. |
Returns nothing.
Called when the player enters a store: sets colour preset 10 of the two per-player colour controllers at 0x005fdeb8 to
the given colour and switches both to it with a 0.25 s blend. ExitStore switches them back to preset 9.
Notes. The code is confirmed (code) at 0x0018e6b8; that the two controllers are the players' screen tint is
inferred from the 0.25 s colour blend and their being indexed per player.
- Evidence: confirmed (code) at
0x0018e6b8; detail: traced - Wrapper
0x00368480(registered byRegisterBindings); calls0x0018e6b8 - Used by 2 of 467 script chunks (2 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 26 of 28 levels, first
level80(mission 2) - Coney: implemented
ExitStore¶
No arguments.
Returns nothing.
Called when the player leaves a store: switches both per-player colour controllers at 0x005fdeb8 back to preset 9 with
a 0.25 s blend, undoing EnterStore.
Notes. Code confirmed at 0x0018e780; the screen-tint reading is inferred, as for EnterStore.
- Evidence: confirmed (code) at
0x0018e780; detail: traced - Wrapper
0x00368530(registered byRegisterBindings); calls0x0018e780 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 26 of 28 levels, first
level80(mission 2) - Coney: implemented
ForceCrimeLevel¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | on |
boolean (nil or 0 is false); default true | true (default) to hold the heat where it is, false to let it fade again. |
Returns nothing.
Sets the forced flag (W_GameState + 0x28c). While on, every wanted gang's timer is held at 10 s from now, so the
police never lose interest (Gang_UpdateWanted, 0x001698f0), the crime level does not step down to 0 (Crime_UpdateLevel,
0x0041c0b8), and a police gang created meanwhile becomes hostile to the wanted gangs one-way only (Crimes:
wanted).
Notes. The last effect is in the police gang set-up (0x0016cdf0, at 0x0016cfe0): with the flag off the wanted gang also turns hostile to the police.
- Evidence: confirmed (code) at
0x0041d8d0; detail: traced - Wrapper
0x0037a630(registered byRegisterBindings); calls0x0041d8d0GameState_SetForceCrimeLevel - Used by 9 of 467 script chunks (9 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 3 of 28 levels, first
level34(mission 4) - Coney: implemented
GameIsOver¶
No arguments.
Returns boolean (1 for true, nil for false): true when a level end is under way (W_GameState + 0x14c not 0); nil
when playing or when there is no game state.
Tells a script whether the level is already on its way out: the level-end state is 1 (a failure, such as a fall out of the world), 2 (level completed, the next level queued) or 3 (a level load requested from a menu) (Level loading: leaving). Scripts check it before starting something that should not run during the exit countdown.
Notes. A story mission's own scripted ending does not set the state, so it reads false then. Once the state is not 0, messages stop reaching Lua anyway.
- Evidence: confirmed (code) at
0x0041ddb8; detail: traced - Wrapper
0x0037b670(registered byRegisterBindings); calls0x0041ddb8GameState_IsLevelEnding - Used by 2 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level81(mission 8) - Coney: not implemented
GetCheckPoint¶
No arguments.
Returns number: The current checkpoint number (W_GameState + 0x33a).
Returns the checkpoint the level was entered at; level scripts branch on it to set up the right part of the mission.
- Evidence: confirmed (code) at
0x0041abe8; detail: traced - Wrapper
0x0037b798(registered byRegisterBindings); calls0x0041abe8 - Used by 32 of 467 script chunks (48 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GetCurrentLevelIndex¶
No arguments.
Returns number: Index of the current level's record (W_GameState + 0x56dc, 16-bit); 0 at the front end.
Returns which level record is loaded; pass it to GetLevelId for the level number.
- Evidence: confirmed (code) at
0x0041d718; detail: traced - Wrapper
0x0036c5c0(registered byRegisterBindings); calls0x0041d718 - Used by 3 of 467 script chunks (9 references); boot to menu: yes; mission 1: no; result used: yes
- Coney: implemented
GetDifficulty¶
No arguments.
Returns number: The difficulty in force (W_GameState + 0x154): 0 easy, 1 normal, 2 hard, 3 fury, 4 rumble (the
values the config_<difficulty> scripts pass to SetDifficulty); 1 at the front end.
Returns the current difficulty level. global.lua reads it to tune its helpers.
Notes. Value names follow the five config scripts (config_easy 0, config_normal 1, config_hard 2,
config_fury 3, config_rumble 4); runtime value at the front end confirmed (runtime), see scripting.md.
- Evidence: confirmed (code) at
0x0041d800; detail: traced - Wrapper
0x0036c3d8(registered byRegisterBindings); calls0x0041d800 - Used by 23 of 467 script chunks (31 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 17 of 28 levels, first
level87(mission 3) - Coney: implemented
GetGameMode¶
No arguments.
Returns number: The game mode set by SetGameMode (W_GameState + 0x158); 0 in the story.
Returns the current game mode.
- Evidence: confirmed (code) at
0x0041d7e0; detail: brief - Wrapper
0x0036c378(registered byRegisterBindings); calls0x0041d7e0 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: yes
- Coney: implemented
GetGameTime¶
No arguments.
Returns number: Game time in milliseconds (GameTimer +0x48), an unsigned 32-bit count.
Returns the game clock in milliseconds, the clock the schedule and the stopwatch use: it advances 1/30 s per frame in fixed-step play, stops while the game is paused and skips the paused time, so scripts can time things in game time.
Notes. GameTimer (0x0050b734) virtual slot +0x30, Milliseconds (Boot: timers); converted as unsigned (values of 2^31 and over stay positive).
- Evidence: confirmed (code) at
0x003864b0; detail: traced - Wrapper
0x0036e050(registered byRegisterBindings); calls0x003864b0GameTimer_GetMilliseconds - Used by 2 of 467 script chunks (14 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
GetLanguage¶
No arguments.
Returns number: The language (W_GameState + 0x120): 0 English, 1 Spanish, 2 French, 3 Italian, 4 German (the order
of LanguageExt in config_preload2.lua); 0 on the NTSC-U disc.
Returns the game's text language. config_preload2.lua uses it to choose which config_strings_<lang> file to run and
global.lua to keep that language's string tables.
Notes. Values confirmed (runtime), see scripting.md.
- Evidence: confirmed (code) at
0x0041d7f0; detail: traced - Wrapper
0x0036c478(registered byRegisterBindings); calls0x0041d7f0 - Used by 92 of 467 script chunks (126 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
GetLevelId¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | index |
number, truncated to an unsigned integer | Index of a level record (0-based), as GetCurrentLevelIndex returns; record 0 is the front end. |
Returns number: That record's level number (record +0x04, the n of level<n>): 100 for record 0.
Returns the level number of a level record. global.lua combines it with GetCurrentLevelIndex to learn which level is
running.
Notes. Records are 0x84 bytes from W_GameState + 0x14d4; there is no bounds check. Values confirmed (runtime), see
scripting.md.
- Evidence: confirmed (code) at
0x0041d6f0; detail: traced - Wrapper
0x0036c568(registered byRegisterBindings); calls0x0041d6f0 - Used by 2 of 467 script chunks (8 references); boot to menu: yes; mission 1: no; result used: yes
- Coney: implemented
GetLevelNamePacked¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | A level number (as in level<n>), looked up in the level records by 0x0041f4d0. |
Returns string (nil for none): The name stored in that level's record (record +0x14).
Returns the stored name of a level record found by level number. No shipped script calls it.
Notes. What 0x0041f4d0 returns when the level is not found is not traced.
- Evidence: confirmed (code) at
0x0041d6a8; detail: brief - Wrapper
0x0036c518(registered byRegisterBindings); calls0x0041d6a8 - Used by no script on the disc
- Coney: not implemented
GetLUASaveDataBool¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | flag |
number, truncated to an integer | Flag number, 1 upwards. |
Returns boolean (1 for true, nil for false): true if the flag is set.
Reads a saved script flag.
- Evidence: confirmed (code) at
0x0041ad60; detail: traced - Wrapper
0x0037b910(registered byRegisterBindings); calls0x0041ad60 - Used by 1 of 467 script chunks (4 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 11 of 28 levels, first
level34(mission 4) - Coney: implemented
GetLUASaveDataFloat¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | slot |
number, truncated to an integer | Slot number, 1-8. |
Returns number: The number stored in that slot.
Reads a number from the saved script data (W_GameState + 0x570c + (slot - 1) x 4, no bounds check). The game state's
constructor zeroes the eight slots, so a slot never written reads 0. level5.lua restores its mission's progress bits
from slot 1 at every checkpoint above 1.
- Evidence: confirmed (code) at
0x0041ad00; detail: traced - Wrapper
0x0037b850(registered byRegisterBindings); calls0x0041ad00 - Used by 19 of 467 script chunks (51 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 14 of 28 levels, first
level87(mission 3) - Coney: implemented
GetNumberOfLevelsPacked¶
No arguments.
Returns number: A count kept in the game state (+0x56d8); inferred: the number of level records.
Returns the count at W_GameState + 0x56d8. No shipped script calls it.
Notes. The level-record table at +0x14d4 has its own count at +0x56d4 (used by StatGetHighScore); how +0x56d8
differs is not traced.
- Evidence: inferred; detail: brief
- Wrapper
0x0036c4d8(registered byRegisterBindings); calls0x0041d690 - Used by no script on the disc
- Coney: not implemented
GetProfileDifficulty¶
No arguments.
Returns number: The profile's difficulty byte (W_GameState + 0x43c): 0 easy, 1 normal, 2 hard, 3 fury, 4 rumble,
as for SetDifficulty; 1 at the front end.
Returns the difficulty stored with the player's profile, as opposed to the one currently in force (GetDifficulty).
global.lua reads it to pick which config_<difficulty> file to run. PM_Difficulty writes it (the menu's cursor
index) and the profile record saves it at 0x4ec; see Saving.
- Evidence: confirmed (code) at
0x0041d820; detail: traced - Wrapper
0x0035c770(registered byRegisterBindings); calls0x0041d820 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: yes
- Coney: implemented
GetRumbleModeData¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | data |
table of 23 numbers (t[1]..t[23]) | A table the binding fills with 23 numbers (indices 1-23): the Rumble (versus) mode set-up chosen in the menu, copied from 0x0063eec0. Any contents on entry are overwritten. |
Returns nothing.
Copies the Rumble mode set-up (23 unsigned 16-bit values: game type, gangs, players and options chosen on the Rumble
menu) into the given table. level101.lua and the other Rumble arenas read it at start-up.
Notes. The fields (C index = Lua index - 1): 0 players (3 one player against the computer, 2 versus, 1 co-op), 1 the
mode's RM_* number (12 is "1 ON 1"), 2 fighters per side, 3 and 4 each side's gang pack - 1, 5-13 side 1's nine
character types, 14-22 side 2's. The default 1 ON 1 set-up reads 3, 12, 1, 4, 2, then 91, 94, ... and 225, 226, ...
(confirmed (runtime)); see the front end page's Rumble set-up.
- Evidence: confirmed (code) at
0x001f26e0; detail: brief - Wrapper
0x0036b9f0(registered byRegisterBindings); calls0x001f26e0 - Used by 33 of 467 script chunks (33 references); boot to menu: no; mission 1: no; result used: no
- Coney: implemented
GetRumbleModeGangName¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | side |
number, truncated to an unsigned integer | 1 for the first side's gang, any other value for the second side's. |
Returns string (nil for none): The chosen gang's name (a string).
Returns the name of the gang a Rumble side chose (0x001fe048 for side 1, 0x001fe0c8 otherwise).
Notes. The display name the gang screen copied (at most 32 bytes) to 0x0063eef0 or 0x0063ef10, such as "BASEBALL
FURIES"; empty until the gangs are confirmed (confirmed (runtime)).
- Evidence: confirmed (code) at
0x001f26a8; detail: brief - Wrapper
0x0036bac0(registered byRegisterBindings); calls0x001f26a8 - Used by 33 of 467 script chunks (66 references); boot to menu: no; mission 1: no; result used: yes
- Coney: implemented
GiveMoney¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | amount |
number, truncated to an integer | Dollars to give (negative takes). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1); 0 or a value above 2 does nothing. |
Returns nothing.
Adds money to a player, clamped to the item's limits, then runs the inventory's money-changed Lua callback with (player index, amount) when one is set.
Notes. The money-changed callback is a name kept at inventory +0x1034; it receives the 0-based player index.
- Evidence: confirmed (code) at
0x0041ef00; detail: traced - Wrapper
0x0037b458(registered byRegisterBindings); calls0x0041ef00 - Used by 3 of 467 script chunks (7 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 1 of 28 levels, first
level86(mission 9) - Coney: implemented
InvGetMoney¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns number: The player's money in dollars (item 2).
Returns how much money a player carries.
- Evidence: confirmed (code) at
0x0041ee88; detail: traced - Wrapper
0x0037b358(registered byRegisterBindings); calls0x0041ee88 - Used by 12 of 467 script chunks (48 references); boot to menu: no; mission 1: yes; result used: yes
- Later in the story: 7 of 28 levels, first
level87(mission 3) - Coney: implemented
InvGetSpraycanCharges¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns number: How many spray-paint charges the player has (inventory item 3).
Returns a player's spray-can charges, the paint used for tags.
Notes. Inventory: two players of 23 item slots (0-22) at W_GameState + 0x480; a player number other than 1 or 2
returns 0.
- Evidence: confirmed (code) at
0x0041f000; detail: traced - Wrapper
0x0037b038(registered byRegisterBindings); calls0x0041f000 - Used by 9 of 467 script chunks (18 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvGiveItem¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | item |
number, truncated to an integer | Inventory item id (0-22), as for InvPlayerHasItem. |
| 2 | count |
number, truncated to an integer | How many to add (negative removes). |
| 3 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns nothing.
Adds any inventory item to a player, clamped to the item's limits, with the same side effects as the specific Give bindings.
- Evidence: confirmed (code) at
0x0041ef98; detail: traced - Wrapper
0x0037b5d8(registered byRegisterBindings); calls0x0041ef98 - Used by 6 of 467 script chunks (46 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvGiveRevive¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | count |
number, truncated to an integer | How many revives to add (negative removes). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns nothing.
Adds revives (item 1) to a player's inventory, clamped to the item's limits; with a certain unlockable (type 6, data 7) the cap is 4. Runs the inventory's item-added Lua callbacks when they are set.
- Evidence: confirmed (code) at
0x0041edb8; detail: traced - Wrapper
0x0037b178(registered byRegisterBindings); calls0x0041edb8 - Used by 12 of 467 script chunks (43 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvGiveSkeletonKey¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | count |
number, truncated to an integer | How many handcuff keys to add (negative removes). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns nothing.
Adds handcuff (skeleton) keys, item 6, to a player's inventory, clamped to the item's limits.
- Evidence: confirmed (code) at
0x0041ee20; detail: traced - Wrapper
0x0037b268(registered byRegisterBindings); calls0x0041ee20 - Used by 1 of 467 script chunks (4 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvNumberOf¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | item |
number, truncated to an integer | Inventory item id (0-22), as for InvPlayerHasItem. |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns number: How many of the item the player has (0 for a bad item or player).
Returns a player's count of any inventory item.
- Evidence: confirmed (code) at
0x0041efd0; detail: traced - Wrapper
0x0037b538(registered byRegisterBindings); calls0x0041efd0 - Used by 7 of 467 script chunks (32 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvNumberRevives¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns number: How many revives the player has.
Returns a player's revive count.
- Evidence: confirmed (code) at
0x0041edf0; detail: traced - Wrapper
0x0037b1e8(registered byRegisterBindings); calls0x0041edf0 - Used by 4 of 467 script chunks (4 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvNumberSkeletonKeys¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns number: How many handcuff keys the player has.
Returns a player's handcuff-key count.
- Evidence: confirmed (code) at
0x0041ee58; detail: traced - Wrapper
0x0037b2d8(registered byRegisterBindings); calls0x0041ee58 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvPlayerHasItem¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | item |
number, truncated to an integer | Inventory item id (0-22): 1 revive, 2 money, 3 spray-paint charges, 5 handcuffs, 6 handcuff keys, 7 the pass (level 11); other ids give nil. |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1); any other value gives nil. |
Returns boolean (1 for true, nil for false): true if the player's count of the item (block +0x24 + item × 0x2c) is
above 0, nil otherwise.
Tests whether a player holds an inventory item: it reads the item's count in that player's inventory block
(W_GameState+0x480+(player-1)×0x3f4) and answers whether it is positive.
Notes. Inventory layout: Player state; items: Inventory items.
- Evidence: confirmed (code) at
0x0041ed88,0x0041e3d8; detail: traced - Wrapper
0x0037b090(registered byRegisterBindings); calls0x0041ed88Inv_PlayerHasItem,0x0041e3d8Inv_HasItem - Used by 1 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level11(flashback 5) - Coney: implemented
InvSetMoney¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | amount |
number, truncated to an integer | New amount in dollars (negative becomes 0). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns nothing.
Sets a player's money, clamped to the item's limits, and clears a field of that player's object (+0xe20, inferred: the
HUD's money-change display).
- Evidence: confirmed (code) at
0x0041eeb8; detail: traced - Wrapper
0x0037b3b0(registered byRegisterBindings); calls0x0041eeb8 - Used by 7 of 467 script chunks (16 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
InvSetSpraycanCharges¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | charges |
number, truncated to an integer | New number of charges (negative becomes 0). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1). |
Returns nothing.
Sets a player's spray-paint charges, clamped to the item's limits (table at 0x0058b300). Setting a positive amount the
first time sets a game-state flag that later triggers a one-off HUD hint.
- Evidence: confirmed (code) at
0x0041f030; detail: traced - Wrapper
0x0037b108(registered byRegisterBindings); calls0x0041f030 - Used by 10 of 467 script chunks (19 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
IsDongleValid¶
No arguments.
Returns boolean (1 for true, nil for false): Always true.
A left-over of a development copy-protection dongle: always returns true (0x00418518).
- Evidence: confirmed (code) at
0x00418518; detail: brief - Wrapper
0x0037b960(registered byRegisterBindings); calls0x00418518 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: yes
- Coney: not implemented
MenuLoadLevel¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
string | The level's name, such as level99 or menu. |
Returns nothing.
Leaves the current level and loads the named one: sets the level-end state (W_GameState + 0x14c) to 3 and passes the
name to the level-change mode (0x0015c7b0). The front end's startRumbleMode and global.lua's runNextMission use
it.
Notes. The level unload remakes the Lua state (scripting.md), so code after this call in the same script runs only until the change happens.
- Evidence: confirmed (code) at
0x00160d78; detail: traced - Wrapper
0x0036df48(registered byRegisterBindings); calls0x00160d78 - Used by 44 of 467 script chunks (81 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
MissionComplete¶
No arguments.
Returns nothing.
Ends the mission as completed: sets the level-end state (W_GameState + 0x14c) to 2 and asks for the next level record
(current index + 1) to be loaded. No shipped script calls it: a story mission ends through its final scene and
HUDLaunchMissionComplete instead (scripting.md#level99). With state 2, mode 1 counts down its level-end countdown, then
pushes the mission-complete mode with kind 0.
- Evidence: confirmed (code) at
0x00160d00; detail: brief - Wrapper
0x0036df28(registered byRegisterBindings); calls0x00160d00 - Used by no script on the disc
- Coney: not implemented
PrecacheWorld¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | budgetMs |
number (single precision) | Time budget of the streaming loop in milliseconds, truncated to an integer; every call passes 10000. |
| 2 | radius |
number (single precision) | Distance in metres within which missing world sectors are waited for (the scripts pass 50 or 500); replaced by player 1's camera draw distance whenever that camera exists. |
| 3 | pack |
string | Name of a pack to load first, without extension: <pack>.pak is loaded when it exists (a level section or a Rumble pack name); nil for none. |
Returns nothing.
Blocks the game while the world around the camera is streamed in, before a script moves the player somewhere new: the
game clock is paused, <pack>.pak is loaded if present, the world streamer runs until the sectors within the radius are
in or the budget runs out, then every pack queued by QueueFileToPrecache is loaded. The preload indicator shows
meanwhile unless a loading screen already does.
Notes. Steps: Level loading: preload. Does nothing when no level is loaded (world manager +0x40 null), and then leaves the game clock paused if it was running (the resume sits inside the same test). A second call while a preload runs is refused. With a camera the radius argument is ignored (the callee's value argument is 0), so the scripts' 50 and 500 differ only with no camera.
- Evidence: confirmed (code) at
0x0040c948,0x0040e2d8; detail: traced - Wrapper
0x0036c7a0(registered byRegisterBindings); calls0x0040c948World_Precache,0x0040e2d8WorldManager_Preload - Used by 36 of 467 script chunks (136 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 2 of 28 levels, first
level95(the hub) - Coney: implemented
ProcessTag¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | tag |
number, truncated to an unsigned integer | Handle of a tag (graffiti) object. |
| 2 | second |
boolean (nil or 0 is false) | With instant false: true shows the tag fully painted at once (message 0x19 with state 6), false wipes it blank (state 4). With instant true: true makes the next spray paint the tag in (message 0x39), false makes it wipe the tag out (message 0x3a). |
| 3 | instant |
boolean (nil or 0 is false) | False sets the tag's look now; true only chooses what the next spray at it does (see second). |
Returns nothing.
Sets a graffiti tag spot's state through the world's message queue: painted or blank now, or whether the next spray
paints it in or wipes it out. global.lua's tag helpers call it when the player finishes a tag.
Notes. The object must report type bit 0x10 (a tag); otherwise nothing happens. What each message does to a
part_spray_tag (handler 0x003fc8d8): state 6 sets the painted fraction (+0xc8, the drawn opacity) to 1; state 4 sets
it to 0 and the spray mode to "paint in" (7); 0x39 sets the spray mode to 7, 0x3a to "wipe out" (5), without changing
the look. Crimes: tag spots has every message.
- Evidence: confirmed (code) at
0x0039bd50; detail: traced - Wrapper
0x00379540(registered byRegisterBindings); calls0x0039bd50 - Used by 10 of 467 script chunks (15 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 15 of 28 levels, first
level87(mission 3) - Coney: implemented
QueueFileToPrecache¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | file |
string | A file name with its extension, such as a character .pak pack; copied. |
Returns nothing.
Appends a file to the world manager's precache queue (+0x0c, an unbounded list). The next preload (PrecacheWorld, or the level load's own) loads every queued file that exists with the resource manager, in order, after its streaming, and empties the queue.
Notes. A name that does not exist is dropped silently at load time; nothing checks it when queued. The Rumble set-up queues the gangs' character packs this way (Front end).
- Evidence: confirmed (code) at
0x0040cc40,0x0040e1a0; detail: traced - Wrapper
0x0036c838(registered byRegisterBindings); calls0x0040cc40World_QueuePackToPrecache,0x0040e1a0WorldManager_QueuePack - Used by 34 of 467 script chunks (167 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
Quit¶
No arguments.
Returns nothing.
Ends the game session: selects level index 0 (the front end, 0x0041ce88), sets the level-end state W_GameState +
0x14c to 3 and the checkpoint back to 1 (0x0041cef0). Mode 1 then pops itself and mode 8's Resume reloads the front
end. No shipped script calls it.
- Evidence: confirmed (code) at
0x00160d38; detail: brief - Wrapper
0x0036df78(registered byRegisterBindings); calls0x00160d38 - Used by no script on the disc
- Coney: not implemented
ReportCrime¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | on |
boolean (nil or 0 is false) | true: crimes the player commits are reported to the police; false: they are not. |
Returns nothing.
Turns crime reporting on or off (W_GameState + 0x288). level99.lua turns it off for the tutorial.
Notes. The store is confirmed (code); its effect on the police is inferred from the name.
- Evidence: confirmed (code) at
0x0041b6a8; detail: traced - Wrapper
0x0037a600(registered byRegisterBindings); calls0x0041b6a8 - Used by 9 of 467 script chunks (12 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 7 of 28 levels, first
level87(mission 3) - Coney: implemented
ResetStore¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | store |
number, truncated to an unsigned integer | Handle of the store's front flag (a world flag of activity 14); any other handle does nothing. |
Returns nothing.
Undoes a break-in on a store: the store front's robbed bit (bit 16 of its group word +0xd8) is cleared, and the nearest
strobe object within 7 m of the store front is sent message 0x13 (inferred: the alarm light off), the counterpart of
the 0x12 a break-in sends.
Notes. The 7 m test is the strobe's distance from the store flag, not the player's (squared distance under 49 from 0x0039c7d8); crimes.md#stores says the player must be within 7 m, which is wrong. It also sets bits 8-15 of the group word to 0xff and the gang bits 18-22 to 31 (no gang). The browsers and buyers a break-in switched off are not switched back on here.
- Evidence: confirmed (code) at
0x0041ddd8; detail: traced - Wrapper
0x0036da10(registered byRegisterBindings); calls0x0041ddd8Store_Reset - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
SetCheckPoint¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | checkpoint |
number, truncated to an integer | Checkpoint number within the level (1-based; each level script defines its own, for example 1-3 in level 99). |
Returns nothing.
Sets the checkpoint the level will start from (W_GameState + 0x33a) and records it: the inventory and the stats take a
checkpoint copy and the world objects are told the checkpoint. Call it before MenuLoadLevel to enter a level at a
checkpoint.
Notes. Calls 0x0041e0b8 (copies the inventories at W_GameState + 0x484, 0x7e8 bytes, to +0x7ec), 0x00422c60
(copies the stats at 0x006fe490, 0x180 bytes) and 0x00397e88 (records the checkpoint and level index and moves a
35-word object list to its checkpoint copy). During a mission scripts call it to mark a chapter done; the checkpoint
picks the chapter when the level is next entered (scripting.md#level99). What a restart restores from the copies is not
traced.
- Evidence: confirmed (code) at
0x0041abc0; detail: traced - Wrapper
0x0037b760(registered byRegisterBindings); calls0x0041abc0 - Used by 64 of 467 script chunks (76 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
SetCopGuardArrestedRange¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | range |
number, truncated to an integer | Distance (world units, inferred metres) within which a guarding officer keeps an arrested character; global.lua passes 25. |
Returns nothing.
Sets the police guard range for arrests (W_GameState + 0x320, 16-bit).
Notes. The meaning of the range is inferred from the name.
- Evidence: confirmed (code) at
0x0041b6b8; detail: traced - Wrapper
0x0037a660(registered byRegisterBindings); calls0x0041b6b8 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: no
- Coney: not implemented
SetCopSpawnMax¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | count |
number, truncated to an integer | Most police that may be spawned as responders at once (16-bit); the level set-up resets it to 16. |
Returns nothing.
Sets the cap on spawned police (W_GameState + 0x326). A police gang (kind 1) runs its spawners only while the game's
police count (+0x324) is under this cap, and a police dispatch spawner makes a responder gang only then (AI:
spawners).
Notes. Reset to 16 on every level load (0x00418c68). The police count goes up by one per spawn in state 6 (0x001681a0) and down when a police gang's spawner in state 4 or 6 loses a human (0x001672a8). 0 stops police responders entirely (inferred).
- Evidence: confirmed (code) at
0x00299520; detail: traced - Wrapper
0x0035b0d8(registered byRegisterBindings); calls0x00299520GameState_SetCopSpawnMax - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level11(flashback 5) - Coney: implemented
SetCopStation¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | gang |
number, truncated to an integer | Gang id of the police gang. |
| 2 | spawner |
string | Name of one of that gang's spawners. |
| 3 | v1 |
number, truncated to an integer | First station setting (16-bit), meaning not traced. |
| 4 | v2 |
number, truncated to an integer | Station setting 2. |
| 5 | v3 |
number, truncated to an integer | Station setting 3. |
| 6 | v4 |
number, truncated to an integer | Station setting 4. |
| 7 | v5 |
number, truncated to an integer | Station setting 5. |
| 8 | v6 |
number, truncated to an integer | Station setting 6. |
| 9 | v7 |
number, truncated to an integer | Station setting 7. |
| 10 | v8 |
number, truncated to an integer | Station setting 8. |
| 11 | v9 |
number, truncated to an integer | Station setting 9. |
| 12 | v10 |
number, truncated to an integer | Station setting 10. |
| 13 | v11 |
number, truncated to an integer | Station setting 11. |
| 14 | v12 |
number, truncated to an integer | Station setting 12. |
Returns nothing.
Writes twelve 16-bit settings into a police gang's named spawner record (records of 0x130 bytes, fields
+0x90-+0xa6). No shipped script calls it.
Notes. Arguments 9-14 are passed to 0x0016db30 on the stack.
- Evidence: confirmed (code) at
0x0016db30; detail: brief - Wrapper
0x00370368(registered byRegisterBindings); calls0x0016db30 - Used by no script on the disc
- Coney: not implemented
SetCrimeLevel¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an integer | The crime (police heat) level, stored as a byte (W_GameState + 0x291). |
| 2 | seconds |
number, truncated to an unsigned integer | How long it lasts, in seconds; 0 for no time limit. |
Returns nothing.
Sets the police heat level, optionally expiring after a number of seconds (the expiry time, game time plus seconds ×
1000, goes to +0x2a8). The level then steps down at each expiry (0x0041c028) and selects a police station's settings;
no shipped script calls it, so it stays 0 (Crimes: wanted).
- Evidence: confirmed (code) at
0x0041ad90; detail: brief - Wrapper
0x003702f0(registered byRegisterBindings); calls0x0041ad90 - Used by no script on the disc
- Coney: not implemented
SetCrimeSceneTimeLength¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | seconds |
number, truncated to an integer | How long a crime scene stays active (units inferred). |
Returns nothing.
Sets the crime-scene duration (W_GameState + 0x2b0). No shipped script calls it.
- Evidence: confirmed (code) at
0x0041b6c8; detail: brief - Wrapper
0x0037a5c8(registered byRegisterBindings); calls0x0041b6c8 - Used by no script on the disc
- Coney: not implemented
SetDifficulty¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | 0 easy, 1 normal, 2 hard, 3 fury, 4 rumble (stored as a byte). |
Returns nothing.
Sets the difficulty in force (W_GameState + 0x154). Each config_<difficulty>.lua calls it with its own level;
global.lua runs the one matching the profile.
- Evidence: confirmed (code) at
0x0041d810; detail: traced - Wrapper
0x0036c440(registered byRegisterBindings); calls0x0041d810 - Used by 6 of 467 script chunks (6 references); boot to menu: yes; mission 1: no; result used: no
- Coney: not implemented
SetGameMode¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | mode |
number, truncated to an unsigned integer | Game mode number (W_GameState + 0x158); 0 is the story. 1 and 2 also set the flag at +0x56f0 (inferred: a two-player or versus mode); the Rumble arenas pass their own mode. |
| 2 | a |
number, truncated to an unsigned integer | First mode parameter (+0x15c); the Rumble arenas pass 3. |
| 3 | b |
number, truncated to an unsigned integer | Second mode parameter (+0x160); the Rumble arenas pass 19. |
| 4 | gangSize |
number, truncated to an unsigned integer | Third mode parameter (+0x164); the Rumble arenas pass their gang size. |
Returns nothing.
Sets the game mode and its three parameters in the game state; modes 1 and 2 set a flag at +0x56f0, every other mode
clears it. Used by the Rumble arenas.
Notes. The parameter meanings are inferred from the arena scripts' arguments.
- Evidence: confirmed (code) at
0x0041d788; detail: brief - Wrapper
0x0036c2b0(registered byRegisterBindings); calls0x0041d788 - Used by 33 of 467 script chunks (33 references); boot to menu: no; mission 1: no; result used: no
- Coney: implemented
SetLoadPriority¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | priority |
number (single precision) | Weight on the distance of the nearest model still to load; the level default is 0.001 and the only call passes 0.01. |
Returns nothing.
Sets how the world streamer weighs models against world sectors when choosing what to load next (global 0x005147cc).
The streamer's update (0x0040f8a0) multiplies the distance of the nearest model the resource manager still needs by this
value and loads a world sector first only when the sector is nearer than that product, so a larger value lets sectors go
ahead of models. The full level load (0x0040dbb8) resets it to 0.001; the Rumble menu mode raises it to 10 while open
(Front end).
Notes. The weighing is read from 0x0040f8a0's comparisons; how much it changes load order in play is inferred. The
same product below 75 m also sets an urgency flag (0x005147c8) whose reader was not traced.
- Evidence: confirmed (code) at
0x0040c938; detail: traced - Wrapper
0x0036e630(registered byRegisterBindings); calls0x0040c938WorldManager_SetLoadPriority - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level51(mission 14) - Coney: not implemented
SetLUASaveDataBool¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | flag |
number, truncated to an integer | Flag number, 1 upwards (the scripts use up to about 130: 100 + n for tags). |
| 2 | on |
boolean (nil or 0 is false) | true sets the flag, false clears it. |
Returns nothing.
Sets or clears a saved script flag: bit flag - 1 of the bit array at W_GameState + 0x572c. Flags 1-128 (four words)
are saved in the profile record at 0x4f4 (Saving).
Notes. Flags above 128 are written beyond the saved words and are not saved.
- Evidence: confirmed (code) at
0x0041ad28; detail: traced - Wrapper
0x0037b8a8(registered byRegisterBindings); calls0x0041ad28 - Used by 1 of 467 script chunks (3 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 12 of 28 levels, first
level95(the hub) - Coney: implemented
SetLUASaveDataFloat¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | slot |
number, truncated to an integer | Slot number, 1-8. |
| 2 | value |
number (single precision) | Number to store (as a 32-bit float). |
Returns nothing.
Stores a number in the script data (eight float slots at W_GameState + 0x570c). Despite the name these slots are
not in the profile record written to the memory card (Saving); they last while the
game runs, across checkpoints and levels.
Notes. No bounds check: slots outside 1-8 overwrite the neighbouring game-state fields (slot 9 is the first word of the saved flags).
- Evidence: confirmed (code) at
0x0041acd8; detail: traced - Wrapper
0x0037b7d8(registered byRegisterBindings); calls0x0041acd8 - Used by 21 of 467 script chunks (67 references); boot to menu: yes; mission 1: no; result used: no
- Later in the story: 15 of 28 levels, first
level87(mission 3) - Coney: implemented
SetSpawnMax¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | count |
number, truncated to an integer | Most gang members the non-police gangs' spawners may have alive at once in this level, all gangs together (16-bit; the scripts use 3 to 70). |
Returns nothing.
Sets the level's cap on spawned characters (W_GameState + 0x434). Each update a gang of any kind but police runs its
spawners (0x00166960) only while the count of spawned humans (+0x432) is below this cap; police spawners use their own
pair (+0x324 against +0x326).
Notes. Level scripts call it once while setting up; the level reset (0x00418c68) sets it to 16. Humans placed with
HuCreate are not limited by it (inferred: only the spawner path reads it). Each spawn adds 1 to +0x432 and
GangSpawner_OnHumanGone (0x001672a8) takes it off; the cap is asked once per gang update (0x00166708), so one gang's
spawners may pass it by one update's spawns (AI: spawners).
- Evidence: confirmed (code) at
0x00299510; detail: traced - Wrapper
0x0035b0a0(registered byRegisterBindings); calls0x00299510GameState_SetSpawnMax - Used by 48 of 467 script chunks (48 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 13 of 28 levels, first
level87(mission 3) - Coney: implemented
SpawnCustomCrime¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | pos |
table of 3 numbers (t[1]..t[3]) | Table {x, y, z}, the crime's position in metres; written back unchanged. |
| 2 | offender |
number, truncated to an unsigned integer | Handle of the offender (the scripts pass a player's human). |
| 3 | responders |
number, truncated to an unsigned integer | Number of police responders queued on the nearest spawner (the report's count, used as is for type 4); the scripts pass 1, 2 or a constant. |
| 4 | text |
string | Optional text key for the crime's name on the offender's HUD crime panel; nil keeps the panel's default. |
Returns nothing.
Reports a crime of type 4 (the custom crime) at a position with reporting mode 1, so police turn hostile to the
offender's gang, the crime callback runs and responders police are sent (AI:
crimes). When the offender is a player's human (human +0x1b0 not -1) the text is
first interned into that player's HUD crime panel (HUD 0x00600840 + 0x177d0 + player × 0xab0), which shows it in place
of a type name for type 4.
Notes. The position is transformed by 0x00252ae0 before the report, as in CrimeIsHappening. Victim is none, severity 0. Signature: arg 4 is a HUD text, not a sound. When the panel actually shows type 4 is not traced (0x001b2520).
- Evidence: confirmed (code) at
0x0041b7a0,0x0041b8b0,0x001aa678; detail: traced - Wrapper
0x0037a4a8(registered byRegisterBindings); calls0x0041b7a0GameState_SpawnCustomCrime,0x0041b8b0,0x001aa678HudCrimePanel_SetCustomText - Used by 2 of 467 script chunks (4 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level82(flashback 1) - Coney: not implemented
SSMC_detect¶
No arguments.
Returns nothing.
Asks the PS2 save system to detect memory cards (save-system vtable slot +0xf4: card state 2). No shipped script calls
it.
Notes. The binding pushes nothing even though detection presumably has a result.
- Evidence: confirmed (code) at
0x00422380; detail: brief - Wrapper
0x0037b708(registered byRegisterBindings); calls0x00422380 - Used by no script on the disc
- Coney: not implemented
SSMC_format¶
No arguments.
Returns boolean (1 for true, nil for false): The save system's answer to a format request (slot +0x11c): true when
a card is present and the format was started (card state 3).
Asks the PS2 save system to format the memory card. No shipped script calls it.
- Evidence: confirmed (code) at
0x004223b0; detail: brief - Wrapper
0x0037b728(registered byRegisterBindings); calls0x004223b0 - Used by no script on the disc
- Coney: not implemented
SSMC_StartDeleteSequence¶
No arguments.
Returns nothing.
Opens the memory-card delete screens (game mode 0x005e5810 in save kind with the delete flag 0x0050c700 set) unless
they are already up: the profiles marked deleted are written out. Called from the front end's menu.
- Evidence: confirmed (code) at
0x001553c0; detail: traced - Wrapper
0x0037b6e8(registered byRegisterBindings); calls0x001553c0 - Used by 1 of 467 script chunks (2 references); boot to menu: yes; mission 1: no; result used: no
- Coney: implemented
SSMC_StartLoadSequence¶
No arguments.
Returns nothing.
Opens the memory-card load screens (pushes game mode 0x005e5810 in load kind, the same as the boot's card check, with
the reload confirmation flag 0x0050c6fc set) unless they are already up. The front end's menu calls it. See
Saving.
- Evidence: confirmed (code) at
0x00155378; detail: traced - Wrapper
0x0037b6c8(registered byRegisterBindings); calls0x00155378 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: no
- Coney: implemented
SSMC_StartSaveSequence¶
No arguments.
Returns nothing.
Asks for an autosave (0x00155308): pushes game mode 6 (0x005e5810) in save kind when saving is enabled (save system
+0x124, set by the profile screens), the level index is not 0 or a new game was just started, and mode 6 is not
already on top. See Saving.
Notes. The hub (level95.lua) calls it.
- Evidence: confirmed (code) at
0x00155308; detail: traced - Wrapper
0x0037b6a8(registered byRegisterBindings); calls0x00155308 - Used by 3 of 467 script chunks (8 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
StatAdd¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | human |
number, truncated to an unsigned integer | Handle of the human the statistic belongs to (the player). |
| 2 | group |
number, truncated to an unsigned integer | Statistic group 0-5, each handled by its own function of the stats object; other values do nothing. |
| 3 | stat |
number, truncated to an unsigned integer | Statistic id within the group (16-bit). |
| 4 | amount |
number, truncated to an unsigned integer; default 1 | How much to add (default 1). |
Returns nothing.
Adds to one of a player's statistics (the stats object at 0x006fe490), for the end-of-mission stats screen;
global.lua adds tag statistics with it.
Notes. Group meanings are not traced; nothing happens if the handle is not a human.
- Evidence: confirmed (code) at
0x004224d8; detail: traced - Wrapper
0x0037c960(registered byRegisterBindings); calls0x004224d8 - Used by 4 of 467 script chunks (7 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 26 of 28 levels, first
level80(mission 2) - Coney: implemented
StatGetHighScore¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | A level number (as in level<n>), looked up in the level records. |
Returns number: The best score recorded for that level.
Returns the stored high score of a level. No shipped script calls it.
- Evidence: confirmed (code) at
0x00422758; detail: brief - Wrapper
0x0037cc68(registered byRegisterBindings); calls0x00422758 - Used by no script on the disc
- Coney: not implemented
StatGetPreviousHiScore¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | A level number or index (not traced which). |
Returns number: The previous high score for it.
Returns the high score that stood before the current run. No shipped script calls it.
- Evidence: inferred; detail: brief
- Wrapper
0x0037cb98(registered byRegisterBindings); calls0x00422670 - Used by no script on the disc
- Coney: not implemented
StatGetRank¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | human |
number, truncated to an unsigned integer | Handle of a player's human. |
Returns number: The player's rank from the stats object.
Returns a player's rank as the stats object computes it. No shipped script calls it.
- Evidence: inferred; detail: brief
- Wrapper
0x0037ca20(registered byRegisterBindings); calls0x004225f0 - Used by no script on the disc
- Coney: not implemented
StatGetScore¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | human |
number, truncated to an unsigned integer | Handle of a player's human. |
Returns number: The player's score.
Returns a player's score from the stats object; global.lua reads it for the end-of-mission screen.
Notes. 0x00422998 returns the player's running score (stats +0x00), or the Armies score in Armies levels; no
category sum is computed.
- Evidence: confirmed (code) at
0x00422630; detail: traced - Wrapper
0x0037cb20(registered byRegisterBindings); calls0x00422630 - Used by 6 of 467 script chunks (12 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
StatGetTotal¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | human |
number, truncated to an unsigned integer | Handle of a player's human. |
| 2 | stat |
number, truncated to an unsigned integer | Statistic id. |
Returns number: The statistic's total (16-bit), 0 when the handle is not a human.
Returns one statistic's value for a player. No shipped script calls it.
- Evidence: confirmed (code) at
0x004226a0; detail: brief - Wrapper
0x0037ca78(registered byRegisterBindings); calls0x004226a0 - Used by no script on the disc
- Coney: not implemented
StatReset¶
No arguments.
Returns nothing.
Clears both players' statistics in the stats object (0x006fe490, 0xc0 bytes per player): every event counter of the six categories and the per-player header word and flag, so every category score starts again from zero. The hub calls it.
Notes. The checkpoint copy SetCheckPoint takes is not touched. The word at player +0x04 is cleared only when the current level is 60 (the first Armies of the Night level); its meaning is not traced. Categories: Player state: statistics.
- Evidence: confirmed (code) at
0x004226f8,0x00422930,0x00420a70; detail: traced - Wrapper
0x0037cc10(registered byRegisterBindings); calls0x004226f8Stats_ResetAll,0x00422930Stats_ResetPlayers,0x00420a70PlayerStats_Reset - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
StatResetPlayer¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | human |
number, truncated to an unsigned integer | Handle of a player's human. |
Returns nothing.
Clears one player's statistics.
- Evidence: confirmed (code) at
0x00422718; detail: traced - Wrapper
0x0037cc30(registered byRegisterBindings); calls0x00422718 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
TakeMoney¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | amount |
number, truncated to an integer | Dollars to take (a negative amount gives). |
| 2 | player |
number, truncated to an integer; default 1 | Player 1 or 2 (default 1); 0 or a value above 2 does nothing. |
Returns nothing.
Takes money from a player: the same call as GiveMoney with the amount negated (Inventory_AddItem on the game state's
inventory, item 2, money), so the total is clamped to the item's limits (never below 0) and the inventory's
money-changed Lua callback, when set, runs with (player index, -amount). The HUD money counter shows the change.
Notes. Taking more than the player has empties the purse without error; the callback still receives the full negated amount (inferred from GiveMoney's path).
- Evidence: confirmed (code) at
0x0041ef60,0x0041ef00; detail: traced - Wrapper
0x0037b4c8(registered byRegisterBindings); calls0x0041ef60GameState_TakeMoney,0x0041ef00GameState_GiveMoney - Used by 5 of 467 script chunks (17 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 3 of 28 levels, first
level86(mission 9) - Coney: implemented
UM_GetRecordData¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | index |
number, truncated to an integer | 0-based record index (as UM_GetUnlockablesByType returns; the position in global.lua's list minus 1). |
| 2 | field |
number, truncated to an integer | 0 level, 1 group, 2 item, 3 type (bytes), 4 the 16-bit extra, 5 the 32-bit data id. |
Returns number: The field's value, unsigned; 0 for an index out of range, a field above 5 or no unlockables loaded.
Reads one field of an unlockable record (12 bytes in the manager at 0x006fe998), for example the level a story record unlocks or a clubhouse display's data id.
Notes. An index of 65535 (an unused UM_GetUnlockablesByType entry) is out of range and gives 0, which a script cannot tell from a real 0.
- Evidence: confirmed (code) at
0x004238e8,0x00423cf0; detail: traced - Wrapper
0x0037d318(registered byRegisterBindings); calls0x004238e8UM_GetRecordField,0x00423cf0Unlockables_GetRecord - Used by 4 of 467 script chunks (7 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
UM_GetUnlockables¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | Record byte 0 to match. |
| 2 | group |
number, truncated to an unsigned integer | Record byte 1 to match. |
| 3 | out |
table of 32 numbers (t[1]..t[32]) | A table the binding fills with 32 numbers: the indices of matching records (unused entries are filled by the manager, inferred -1). |
Returns nothing.
Lists the unlockable records of a level and group into a table. The front end's records screen uses it.
- Evidence: confirmed (code) at
0x00423768; detail: brief - Wrapper
0x0037ce78(registered byRegisterBindings); calls0x00423768 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: no
- Coney: not implemented
UM_GetUnlockablesByType¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | type |
number, truncated to an unsigned integer | Record type (low byte) to match: 0 story level, 1-4 Rumble, 6 upgrade and so on (Unlockables). |
| 2 | out |
table of 32 numbers (t[1]..t[32]) | A table whose entries 1-32 are overwritten: the 0-based indices of the matching records in table order, then 65535 for the unused entries. |
Returns nothing.
Lists the unlockable records of one type, locked or not: the indices of every record whose type byte matches are written
into out[1..32] in record order and the rest of the 32 entries are set to 65535. Use the indices with
UM_GetRecordData.
Notes. The 32 entries are read from the table first and then all overwritten. More than 32 matches overrun the binding's 32-entry buffer (no bound check). With no unlockables loaded every entry is 65535.
- Evidence: confirmed (code) at
0x004237a8,0x00423eb0; detail: traced - Wrapper
0x0037cf78(registered byRegisterBindings); calls0x004237a8UM_GetUnlockablesByType,0x00423eb0Unlockables_ListByType - Used by 3 of 467 script chunks (4 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
UM_IsDataDirty¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | type |
number, truncated to an unsigned integer | Record type (low byte). |
| 2 | data |
number, truncated to an unsigned integer | Record data id (record +8), as in UM_IsDataUnlocked. |
| 3 | clear |
boolean (nil or 0 is false); default true | true (default) also clears the record's new mark when it was set. |
Returns boolean (1 for true, nil for false): true (1) when the first record with this type and data has its new mark set; nil otherwise.
Asks whether an unlockable, found by type and data id, is marked new (newly unlocked and not yet shown), and by default clears the mark so the hub announces each unlock once. The marks are a bit set at 0x006fe948, one bit per record, separate from the locked set.
Notes. Only the first record with the type and data is looked at, as in the game's other tests. Who sets the mark (UM_Unlock, inferred) is not traced here.
- Evidence: confirmed (code) at
0x004239b0,0x00424958; detail: traced - Wrapper
0x0037d280(registered byRegisterBindings); calls0x004239b0UM_IsDataDirty,0x00424958Unlockables_TestDirtyByData - Used by 2 of 467 script chunks (9 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
UM_IsDataUnlocked¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | type |
number, truncated to an unsigned integer | Record type byte. |
| 2 | data |
number, truncated to an unsigned integer | Record data id. |
Returns boolean (1 for true, nil for false): true if the first record with that type and data id is unlocked; false if none matches.
Tests an unlockable by type and data id, the usual way scripts ask whether an extra (a move, an outfit, a cheat) is available.
- Evidence: confirmed (code) at
0x00423868; detail: traced - Wrapper
0x0037d140(registered byRegisterBindings); calls0x00423868 - Used by 22 of 467 script chunks (83 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 17 of 28 levels, first
level87(mission 3) - Coney: implemented
UM_IsLevelComplete¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | A level number (as in level<n>). |
Returns boolean (1 for true, nil for false): true if the level's completion record (level, group 0, item 0) is unlocked; false when it has none or the manager is absent.
Tells whether a story level has been completed. The front end and runNextMission use it to find where the story
stands.
- Evidence: confirmed (code) at
0x004238a8; detail: traced - Wrapper
0x0037d1c0(registered byRegisterBindings); calls0x004238a8 - Used by 3 of 467 script chunks (33 references); boot to menu: yes; mission 1: yes; result used: yes
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
UM_IsTypeDirty¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | type |
number, truncated to an unsigned integer | Record type byte. |
| 2 | clear |
boolean (nil or 0 is false); default true | true (default) also clears the 'new' marks of that type. |
Returns boolean (1 for true, nil for false): true if any record of the type was newly unlocked.
Asks whether anything of a type was unlocked since last asked, optionally clearing the marks.
- Evidence: confirmed (code) at
0x00423988; detail: traced - Wrapper
0x0037d210(registered byRegisterBindings); calls0x00423988 - Used by 2 of 467 script chunks (16 references); boot to menu: yes; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
UM_IsUnlocked¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | index |
number, truncated to an integer | Record index. |
Returns boolean (1 for true, nil for false): true if that record is unlocked (false when the manager has no records).
Tests one unlockable record by index.
- Evidence: confirmed (code) at
0x00423828; detail: brief - Wrapper
0x0037d0f0(registered byRegisterBindings); calls0x00423828 - Used by 1 of 467 script chunks (1 reference); boot to menu: no; mission 1: no; result used: yes
- Coney: not implemented
UM_Reset¶
No arguments.
Returns nothing.
Resets the unlockables manager (0x006fe998), dropping its records. global.lua calls it before rebuilding the table.
Notes. What 0x00423b88 frees is not traced in detail.
- Evidence: confirmed (code) at
0x004236d0; detail: traced - Wrapper
0x0037cce0(registered byRegisterBindings); calls0x004236d0 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: no
- Coney: implemented
UM_SetNumUnlockables¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | count |
number, truncated to an unsigned integer | Number of unlockable records to allocate (at most 640, the size of the lock bit sets). |
Returns nothing.
Sets how many unlockable records the manager will hold; ignored once the records exist.
- Evidence: confirmed (code) at
0x004236f0; detail: traced - Wrapper
0x0037cd00(registered byRegisterBindings); calls0x004236f0 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: no
- Coney: implemented
UM_SetUnlockable¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | index |
number, truncated to an integer | Record index (0-based). |
| 2 | level |
number, truncated to an unsigned integer | Record byte 0: the level the unlock belongs to (matched by UM_Unlock and UM_GetUnlockables). |
| 3 | group |
number, truncated to an unsigned integer | Record byte 1: a group within the level. |
| 4 | item |
number, truncated to an unsigned integer | Record byte 2: the item within the group (0 is the level-complete record). |
| 5 | type |
number, truncated to an unsigned integer | Record byte 3: the unlockable's type (matched by the ByType and Data bindings). |
| 6 | extra |
number, truncated to an unsigned integer | Record 16-bit field +4. |
| 7 | data |
number, truncated to an unsigned integer | Record 32-bit data id +8 (matched by UM_IsDataUnlocked). |
Returns nothing.
Fills one 12-byte record of the unlockables table (manager 0x006fe998), allocating the table first if it does not exist yet: level, group, item and type bytes, a 16-bit extra field and a 32-bit data id. global.lua fills the whole table this way from its Unlockables list, passing the list position minus one as the index.
Notes. Records are found by index through 0x00423cf0; an index past the table is ignored (the store returns false). The record fields are matched by the other UM_ bindings.
- Evidence: confirmed (code) at
0x00423718; detail: traced - Wrapper
0x0037cd38(registered byRegisterBindings); calls0x00423718 - Used by 1 of 467 script chunks (1 reference); boot to menu: yes; mission 1: no; result used: no
- Coney: implemented
UM_Unlock¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | level |
number, truncated to an unsigned integer | Record byte 0: the level number. |
| 2 | group |
number, truncated to an unsigned integer | Record byte 1. |
| 3 | item |
number, truncated to an unsigned integer | Record byte 2 (0: the level itself). |
Returns nothing.
Unlocks every record whose first three bytes match, and marks the newly unlocked ones as new ('dirty') so menus can
highlight them. global.lua uses it when a level is completed. Both bit sets are saved with the profile
(Saving), which is how story progress is kept.
- Evidence: confirmed (code) at
0x004237e8; detail: traced - Wrapper
0x0037d050(registered byRegisterBindings); calls0x004237e8 - Used by 28 of 467 script chunks (71 references); boot to menu: yes; mission 1: yes; result used: no
- Later in the story: 28 of 28 levels, first
level80(mission 2) - Coney: implemented
UM_UnlockAll¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | unlock |
boolean (nil or 0 is false) | true unlocks every record and marks all as new; false locks every record and clears the marks. |
Returns nothing.
A cheat/debug helper: unlocks or locks all 640 records at once, and in both cases sets the bank (inventory word at
W_GameState + 0x480) to 1,000,000.
- Evidence: confirmed (code) at
0x004239e0; detail: brief - Wrapper
0x0037d3c0(registered byRegisterBindings); calls0x004239e0 - Used by 1 of 467 script chunks (2 references); boot to menu: no; mission 1: no; result used: no
- Coney: not implemented
W_GetStopWatchTime¶
No arguments.
Returns number: The stopwatch's current time in milliseconds (stopwatch +0x08): the time left when counting down, the time reached when counting up.
Returns the mission stopwatch's current time in milliseconds, as last stepped by the frame update; it does not change while the stopwatch is stopped.
Notes. The stopwatch object is *0x0051504c (Scripts: the mission stopwatch).
- Evidence: confirmed (code) at
0x00423638; detail: traced - Wrapper
0x00370e28(registered byRegisterBindings); calls0x00423638StopWatch_GetTime - Used by 5 of 467 script chunks (6 references); boot to menu: no; mission 1: no; result used: yes
- Later in the story: 1 of 28 levels, first
level95(the hub) - Coney: implemented
W_SetStopWatch¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | time |
number, truncated to an integer | Starting time in milliseconds. |
| 2 | target |
number, truncated to an integer | Target time in milliseconds; the scripts pass 0 (a countdown to zero). |
| 3 | callback |
string | Name of the Lua function (dotted names allowed) to call when the stopwatch reaches the target. |
Returns nothing.
Sets up the mission stopwatch (the object at *0x0051504c): the current time (+0x08), the target (+0x0c) and the callback's name (kept as text, 0x004235a8); it also clears the warning window (+0x40 = 0) and sets the last beep time (+0x48 = 1000). Start it with W_StartStopWatch and show it with W_ShowStopWatch.
Notes. Each frame of play the time moves toward the target; on reaching it the watch stops and the callback is called with no arguments (0x004233f8, scripting.md#stopwatch). Confirmed (code).
- Evidence: confirmed (code) at
0x004235f0; detail: traced - Wrapper
0x00370d98(registered byRegisterBindings); calls0x004235f0 - Used by 32 of 467 script chunks (39 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 11 of 28 levels, first
level87(mission 3) - Coney: implemented
W_ShowStopWatch¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | show |
boolean (nil or 0 is false) | true shows the stopwatch on the HUD, false hides it. |
| 2 | label |
string | Text drawn before the time (may carry text-format tags); nil for none. |
| 3 | warnMs |
number, truncated to an integer; default 10000 | Warning window in milliseconds: while counting down within it, a beep plays at most once a second (default 10000). |
Returns nothing.
Shows or hides the mission stopwatch on the HUD. While shown, the HUD draws label followed by the time as
minutes:seconds (seconds truncated) each frame. Showing also arms the countdown warning beep for the last warnMs
milliseconds; hiding disarms it (window 0).
Notes. Writes stopwatch +0x40 (window) and +0x48 (window + 1000 when shown, 1000 when hidden), +0x18 (shown) and +0x1c (label). The label pointer is kept, not copied, so it must stay alive (the scripts pass constants). A HUD byte (+0x225d5, set when the HUD is built) switches to a whole-seconds display instead (0x001cd748); what sets it is not traced.
- Evidence: confirmed (code) at
0x00423670,0x004235e0,0x001cd5e8; detail: traced - Wrapper
0x00370e98(registered byRegisterBindings); calls0x00423670StopWatch_Show,0x004235e0StopWatch_SetDisplay,0x001cd5e8StopWatchHud_UpdateMinutes - Used by 30 of 467 script chunks (64 references); boot to menu: no; mission 1: no; result used: no
- Later in the story: 9 of 28 levels, first
level95(the hub) - Coney: implemented
W_StartStopWatch¶
| # | Argument | Read as | Meaning |
|---|---|---|---|
| 1 | run |
boolean (nil or 0 is false) | true to start (or resume) the stopwatch, false to stop it. |
Returns nothing.
Starts or stops the mission stopwatch (0x004233a8): stores the flag as its running state (+0x14) and takes the game
timer's reading, so a resumed watch does not count the time it was stopped.
Notes. The update steps the watch only while +0x14 is non-zero and clears it on reaching the target (0x004233f8, scripting.md#stopwatch).
- Evidence: confirmed (code) at
0x00423648; detail: traced - Wrapper
0x00370e68(registered byRegisterBindings); calls0x00423648 - Used by 37 of 467 script chunks (78 references); boot to menu: no; mission 1: yes; result used: no
- Later in the story: 11 of 28 levels, first
level87(mission 3) - Coney: implemented