IS STA
Introduction
The STAte packet contains information about the current game state and is sent any time the information included in the packet changes. To request for an IS_STA packet to be sent, send an IS_TINY with a SubT of TINY_STA.
| Type | Name | Description |
|---|---|---|
| byte | Size | 28 |
| byte | Type | ISP_STA |
| byte | ReqI | ReqI if replying to a request packet |
| byte | Zero | |
| float | ReplaySpeed | 4-byte float - 1.0 is normal speed |
| word | Flags | ISS state flags (see below) |
| byte | InGameCam | Which type of camera is selected (see below) |
| byte | ViewPLID | Unique ID of viewed player (0 = none) |
| byte | NumP | Number of players in race |
| byte | NumConns | Number of connections including host |
| byte | NumFinished | Number finished or qualified |
| byte | RaceInProg | 0 - no race / 1 - race / 2 - qualifying |
| byte | QualMins | |
| byte | RaceLaps | see "RaceLaps" near the top of this document |
| byte | Spare2 | |
| byte | Spare3 | |
| char | Track[6] | short name for track e.g. FE2R |
| byte | Weather | 0,1,2... |
| byte | Wind | 0=off 1=weak 2=strong |
Packet Details
Size
The size of the packet, always 28.
Type
The packet type from the ISP_ enumeration, always ISP_STA.
ReqI
Zero if sent directly by LFS, otherwise equal to the ReqI provided in the request for the IS_STA packet.
Replay Speed
The current replay speed as a floating point number, with 1.0 as normal speed. Only set when playing back a replay.
Flags
The ISS_ bit flags.
- ISS_GAME: In game or playing MPR (multiplayer replay)
- ISS_REPLAY: In SPR (singleplayer replay)
- ISS_PAUSED: Game is paused
- ISS_SHIFTU: In SHIFT+U mode
- ISS_DIALOG: In a dialog
- ISS_SHIFTU_FOLLOW: Following a car
- ISS_SHIFTU_NO_OPT: In SHIFT+U mode but buttons hidden
- ISS_SHOW_2D: 2D on-screen display visible
- ISS_FRONT_END: On game entry screen
- ISS_MULTI: In multiplayer mode
- ISS_MPSPEEDUP: Multiplayer speedup option active
- ISS_WINDOWED: LFS running in windowed mode (SHIFT+F4)
- ISS_SOUND_MUTE: Sound is turned off
- ISS_VIEW_OVERRIDE: Override user view
- ISS_VISIBLE: InSim buttons are currently visible
- ISS_TEXT_ENTRY: In a text entry dialog
InGameCam
Which type of in-game camera is being used, from the VIEW_ enumeration.
- VIEW_FOLLOW: Chase camera (arcade) view
- VIEW_HELI: Helicopter view
- VIEW_CAM: Track-side (TV) camera view
- VIEW_DRIVER: Cockpit view
- VIEW_CUSTOM: Custom view
- VIEW_ANOTHER: Viewing another car
ViewPLID
Unique player ID (PLID) of the car currently being viewed (0 = none).
NumP
Number of players currently in the race.
NumConns
Number of players currently connected to the server, including the host.
NumFinished
Number of players currently finished the race or qualifying session.
RaceInProg
Whether the race is currently in progress.
- 0: No race
- 1: Race
- 2: Qualifying
QualMins
Number of minutes for the qualifying session, if set.
RaceLaps
The number of laps in the race. This value has various meanings depending on its range.
- 0: Practice session
- 1-99: Number of laps
- 100-190: 100 to 1000 laps (laps = (rl - 100) * 10 + 100)
- 191-238: 1 to 48 hours (hours = rl - 190)
Here is an example of determining the laps and/or hours:
int getLaps(int raceLaps)
{
if (raceLaps >= 1 && raceLaps <= 99)
{
return raceLaps;
}
else if (raceLaps >= 100 && raceLaps <= 190)
{
return (raceLaps - 100) * 10 + 100;
}
return 0;
}
int getHours(int raceLaps)
{
if (raceLaps >= 191 && raceLaps <= 238)
{
return raceLaps - 190;
}
return 0;
}
ServerStatus
The status of the connection to the server.
- 0: Unknown
- 1: Success
- > 1: Fail
Track
The short name for the track, e.g. BL1R or FE3.
Weather
The weather settings in game.
- 0: Bright or clear
- 1: Overcast
- 2: Cloudy, sunset or dusk
Wind
The wind settings in game.
- 0: None
- 1: Low
- 2: High