Decompile mapLocalVariablesInit
This commit is contained in:
parent
d72a74f6c3
commit
0adc65054c
33
src/map.cc
33
src/map.cc
|
@ -53,6 +53,7 @@ static void isoWindowRefreshRectMapper(Rect* rect);
|
|||
static int mapGlobalVariablesInit(int count);
|
||||
static void mapGlobalVariablesFree();
|
||||
static int mapGlobalVariablesLoad(File* stream);
|
||||
static int mapLocalVariablesInit(int count);
|
||||
static void mapLocalVariablesFree();
|
||||
static void _map_place_dude_and_mouse();
|
||||
static void _square_reset();
|
||||
|
@ -833,18 +834,13 @@ static int mapLoad(File* stream)
|
|||
goto err;
|
||||
}
|
||||
|
||||
error = "Error loading local vars";
|
||||
mapLocalVariablesFree();
|
||||
|
||||
if (gMapHeader.localVariablesCount != 0) {
|
||||
gMapLocalVars = (int*)internal_malloc(sizeof(*gMapLocalVars) * gMapHeader.localVariablesCount);
|
||||
if (gMapLocalVars == NULL) {
|
||||
error = "Error allocating local vars";
|
||||
// NOTE: Uninline.
|
||||
if (mapLocalVariablesInit(gMapHeader.localVariablesCount) != 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
gMapLocalVarsLength = gMapHeader.localVariablesCount;
|
||||
}
|
||||
|
||||
error = "Error loading local vars";
|
||||
if (fileReadInt32List(stream, gMapLocalVars, gMapLocalVarsLength) != 0) {
|
||||
goto err;
|
||||
}
|
||||
|
@ -1539,6 +1535,25 @@ static int mapGlobalVariablesLoad(File* stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: Inlined.
|
||||
//
|
||||
// 0x484080
|
||||
static int mapLocalVariablesInit(int count)
|
||||
{
|
||||
mapLocalVariablesFree();
|
||||
|
||||
if (count != 0) {
|
||||
gMapLocalVars = (int*)internal_malloc(sizeof(*gMapLocalVars) * count);
|
||||
if (gMapLocalVars == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
gMapLocalVarsLength = count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x4840D4
|
||||
static void mapLocalVariablesFree()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue