Decompile mapGlobalVariablesInit
This commit is contained in:
parent
980b40dcdd
commit
1d05bac7a1
35
src/map.cc
35
src/map.cc
|
@ -50,6 +50,7 @@ static void mapMakeMapsDirectory();
|
||||||
static void isoWindowRefreshRect(Rect* rect);
|
static void isoWindowRefreshRect(Rect* rect);
|
||||||
static void isoWindowRefreshRectGame(Rect* rect);
|
static void isoWindowRefreshRectGame(Rect* rect);
|
||||||
static void isoWindowRefreshRectMapper(Rect* rect);
|
static void isoWindowRefreshRectMapper(Rect* rect);
|
||||||
|
static int mapGlobalVariablesInit(int count);
|
||||||
static void mapGlobalVariablesFree();
|
static void mapGlobalVariablesFree();
|
||||||
static void mapLocalVariablesFree();
|
static void mapLocalVariablesFree();
|
||||||
static void _map_place_dude_and_mouse();
|
static void _map_place_dude_and_mouse();
|
||||||
|
@ -819,18 +820,13 @@ static int mapLoad(File* stream)
|
||||||
gMapHeader.localVariablesCount = 0;
|
gMapHeader.localVariablesCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = "Error loading global vars";
|
error = "Error allocating global vars";
|
||||||
mapGlobalVariablesFree();
|
// NOTE: Uninline.
|
||||||
|
if (mapGlobalVariablesInit(gMapHeader.globalVariablesCount) != 0) {
|
||||||
if (gMapHeader.globalVariablesCount != 0) {
|
goto err;
|
||||||
gMapGlobalVars = (int*)internal_malloc(sizeof(*gMapGlobalVars) * gMapHeader.globalVariablesCount);
|
|
||||||
if (gMapGlobalVars == NULL) {
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
gMapGlobalVarsLength = gMapHeader.globalVariablesCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = "Error loading global vars";
|
||||||
if (fileReadInt32List(stream, gMapGlobalVars, gMapGlobalVarsLength) != 0) {
|
if (fileReadInt32List(stream, gMapGlobalVars, gMapGlobalVarsLength) != 0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -1500,6 +1496,25 @@ static void isoWindowRefreshRectMapper(Rect* rect)
|
||||||
_obj_render_post_roof(&clampedDirtyRect, gElevation);
|
_obj_render_post_roof(&clampedDirtyRect, gElevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Inlined.
|
||||||
|
//
|
||||||
|
// 0x483FE4
|
||||||
|
static int mapGlobalVariablesInit(int count)
|
||||||
|
{
|
||||||
|
mapGlobalVariablesFree();
|
||||||
|
|
||||||
|
if (count != 0) {
|
||||||
|
gMapGlobalVars = (int*)internal_malloc(sizeof(*gMapGlobalVars) * count);
|
||||||
|
if (gMapGlobalVars == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gMapGlobalVarsLength = count;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// 0x484038
|
// 0x484038
|
||||||
static void mapGlobalVariablesFree()
|
static void mapGlobalVariablesFree()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue