Global Variables

The global variables subsystem is dynamically allocated and is used to track values across code segments.


// Allocate global variables | gameInfoDat->number_of_global_variables: Defined in GAMEINFO.DAT file as 99
int *dword_482CDC = (int *)malloc( sizeof(int) * gameInfoDat->number_of_global_variables );


/**
* \brief Sets the number value stored at key to value
* \param[in] key Variable to set.
* \param[in] value Value to set.
*/
void Global_Variable_Set( const int key, const int value )
{
    dword_482CDC[ key ] = value;
}


/**
* \brief Retrieves the number value stored at key
* \param[in] key Variable to retrieve.
* \return Return the value of the key
*/
int Global_Variable_Query( const int key )
{
    return dword_482CDC[ key ];
}


/**
* \brief Increments the number stored at key by increment
* \param[in] key Variable to increase.
* \param[in] increment Value to increase stored number by
* \return Return the value of the key after the increment.
*/
int Global_Variable_Increment( const int key, const int increment )
{
    dword_482CDC[ key ] += increment;
    return dword_482CDC[ key ];
}


/**
* \brief Decrements the number stored at key by decrement
* \param[in] key Variable to decrease.
* \param[in] decrement Value to decrease stored number by
* \return Return the value of the key after the decrement.
*/
int Global_Variable_Decrement( const int key, const int decrement )
{
    dword_482CDC[ key ] -= decrement;
    return dword_482CDC[ key ];
}


/**
* \brief Zeros the number stored at key
* \param[in] key Variable to reset.
*/
void Global_Variable_Reset( const int key )
{
    dword_482CDC[ key ] = 0;
}


Global Variable Key Description
0
1
2
3
4
5
6
7
8
9 Police Maze Score
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99