coastline 0.0.4
Loading...
Searching...
No Matches
packedvalue.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int FloatToSignedByteIndex (float fValue)
 Round -128 times a value to the nearest integer, limited to the range of a field of six bits.
int ConvertFloatToFixedAngle (float fValue)
 Round -32768 times a value to the nearest integer, limited to the range of a short.
int ConvertFloatToFixedAngleNoClamp (float fValue)
 Quantise a coordinate in steps of 1/8192 within the unsigned 24-bit range.
int FloatToByteIndex (float fValue)
 Round a value divided by 1.41015625 to the nearest integer, limited to the range of an unsigned byte.
int FloatToEngineRpmIndex (float fValue)
 Map engine speed from 400 to 8000 RPM to the nearest of 64 steps.
int ConvertFloatToFixed24 (float fValue)
 Round twice a value to the nearest integer, limited to the range of a field of 24 bits.
int ConvertFloatToFixedAngle16B (float fValue)
 Round 128 times a value to the nearest integer, limited to the range of a short.
int FloatToSignedShortIndex (float fValue)
 Round 256 times a value to the nearest integer, limited to the range of a short.
int ConvertFloatToSignedByte (float fValue)
 Round 8 times a value to the nearest integer, limited to the range of a signed byte.
unsigned char QuantizeFloatToLightIndex (float fScale)
 Get the light level of a brightness, the inverse of GetLightLevelScale().
int ConvertDoubleToSignedByte (double dValue)
 Round 128 times a value to the nearest integer, limited to the range of a signed byte.
float SignedByteToFloat (unsigned char bValue)
 Scale a signed field of six bits by -1/128.
float EngineRpmIndexToFloat (unsigned char bIndex)
 Map one of 64 steps to engine speed from 400 to 8000 RPM.
float GetLightLevelScale (char nLightLevel)
 Get the brightness of a light level.
float ConvertUintToScaledFloat (unsigned dwValue)
 Scale a field by 1/8192.
float Signed24BitToFloat (int nValue)
 Scale a signed field of 24 bits by 1/2.
float ConvertFixedAngleToFloat (short nValue)
 Scale a field of a packet of two bytes by -1/32768.
float ByteToFloat (unsigned char bValue)
 Scale a field of a packet of one unsigned byte by 1.41015625.
float FixedToRadians (short nValue)
 Scale a field of a packet of two bytes by 1/128.
float SignedShortToFloat (short nValue)
 Scale a field of a packet of two bytes by 1/256.
float ConvertCharToScaledFloat (signed char bValue)
 Scale a field of a packet of one signed byte by 1/8.

Function Documentation

◆ FloatToSignedByteIndex()

int FloatToSignedByteIndex ( float fValue)

Round -128 times a value to the nearest integer, limited to the range of a field of six bits.

Parameters
fValueThe value.
Returns
The field, from -32 to 31.
Ghidra address:
BRD3D: 0x100065a0
Ghidra address:
BRGlide: 0x10006910

◆ ConvertFloatToFixedAngle()

int ConvertFloatToFixedAngle ( float fValue)

Round -32768 times a value to the nearest integer, limited to the range of a short.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x100065e0
Ghidra address:
BRGlide: 0x10006950

◆ ConvertFloatToFixedAngleNoClamp()

int ConvertFloatToFixedAngleNoClamp ( float fValue)

Quantise a coordinate in steps of 1/8192 within the unsigned 24-bit range.

Parameters
fValueCoordinate.
Returns
Quantised coordinate.
Ghidra address:
BRD3D: 0x100066e0
Ghidra address:
BRGlide: 0x10006a50

◆ FloatToByteIndex()

int FloatToByteIndex ( float fValue)

Round a value divided by 1.41015625 to the nearest integer, limited to the range of an unsigned byte.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x10006620
Ghidra address:
BRGlide: 0x10006990

◆ FloatToEngineRpmIndex()

int FloatToEngineRpmIndex ( float fValue)

Map engine speed from 400 to 8000 RPM to the nearest of 64 steps.

Parameters
fValueEngine speed, in revolutions per minute.
Returns
The step, from 0 to 63.
Ghidra address:
BRD3D: 0x10006660
Ghidra address:
BRGlide: 0x100069d0

◆ ConvertFloatToFixed24()

int ConvertFloatToFixed24 ( float fValue)

Round twice a value to the nearest integer, limited to the range of a field of 24 bits.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x10006730
Ghidra address:
BRGlide: 0x10006aa0

◆ ConvertFloatToFixedAngle16B()

int ConvertFloatToFixedAngle16B ( float fValue)

Round 128 times a value to the nearest integer, limited to the range of a short.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x10006770
Ghidra address:
BRGlide: 0x10006ae0

◆ FloatToSignedShortIndex()

int FloatToSignedShortIndex ( float fValue)

Round 256 times a value to the nearest integer, limited to the range of a short.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x100067b0
Ghidra address:
BRGlide: 0x10006b20

◆ ConvertFloatToSignedByte()

int ConvertFloatToSignedByte ( float fValue)

Round 8 times a value to the nearest integer, limited to the range of a signed byte.

Parameters
fValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x100067f0
Ghidra address:
BRGlide: 0x10006b60

◆ QuantizeFloatToLightIndex()

unsigned char QuantizeFloatToLightIndex ( float fScale)

Get the light level of a brightness, the inverse of GetLightLevelScale().

Parameters
fScaleThe brightness.
Returns
0 below 128, 1 below 171, 2 below 213, and 3 otherwise.
Ghidra address:
BRD3D: 0x100066a0
Ghidra address:
BRGlide: 0x10006a10

◆ ConvertDoubleToSignedByte()

int ConvertDoubleToSignedByte ( double dValue)

Round 128 times a value to the nearest integer, limited to the range of a signed byte.

Parameters
dValueThe value.
Returns
The field.
Ghidra address:
BRD3D: 0x10030de0
Ghidra address:
BRGlide: 0x1002a490

◆ SignedByteToFloat()

float SignedByteToFloat ( unsigned char bValue)

Scale a signed field of six bits by -1/128.

Parameters
bValueThe field in the low six bits.
Returns
The value.
Ghidra address:
BRD3D: 0x10007250
Ghidra address:
BRGlide: 0x100075c0

◆ EngineRpmIndexToFloat()

float EngineRpmIndexToFloat ( unsigned char bIndex)

Map one of 64 steps to engine speed from 400 to 8000 RPM.

Parameters
bIndexThe step.
Returns
Engine speed, in revolutions per minute.
Ghidra address:
BRD3D: 0x100072c0
Ghidra address:
BRGlide: 0x10007630

◆ GetLightLevelScale()

float GetLightLevelScale ( char nLightLevel)

Get the brightness of a light level.

Parameters
nLightLevelThe level, from 0 to 3.
Returns
0, 170, 212, or 255.
Ghidra address:
BRD3D: 0x100072e0
Ghidra address:
BRGlide: 0x10007650

◆ ConvertUintToScaledFloat()

float ConvertUintToScaledFloat ( unsigned dwValue)

Scale a field by 1/8192.

Parameters
dwValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x10007310
Ghidra address:
BRGlide: 0x10007680

◆ Signed24BitToFloat()

float Signed24BitToFloat ( int nValue)

Scale a signed field of 24 bits by 1/2.

Parameters
nValueThe field in the low 24 bits.
Returns
The value.
Ghidra address:
BRD3D: 0x10007340
Ghidra address:
BRGlide: 0x100076b0

◆ ConvertFixedAngleToFloat()

float ConvertFixedAngleToFloat ( short nValue)

Scale a field of a packet of two bytes by -1/32768.

Parameters
nValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x10007280
Ghidra address:
BRGlide: 0x100075f0

◆ ByteToFloat()

float ByteToFloat ( unsigned char bValue)

Scale a field of a packet of one unsigned byte by 1.41015625.

Parameters
bValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x100072a0
Ghidra address:
BRGlide: 0x10007610

◆ FixedToRadians()

float FixedToRadians ( short nValue)

Scale a field of a packet of two bytes by 1/128.

Parameters
nValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x10007380
Ghidra address:
BRGlide: 0x100076f0

◆ SignedShortToFloat()

float SignedShortToFloat ( short nValue)

Scale a field of a packet of two bytes by 1/256.

Parameters
nValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x100073a0
Ghidra address:
BRGlide: 0x10007710

◆ ConvertCharToScaledFloat()

float ConvertCharToScaledFloat ( signed char bValue)

Scale a field of a packet of one signed byte by 1/8.

Parameters
bValueThe field.
Returns
The value.
Ghidra address:
BRD3D: 0x100073c0
Ghidra address:
BRGlide: 0x10007730