X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_sp%2FGlobals.c;h=0ca6500049f0c3cb1e07bed3428eea1ddd7a4cd9;hp=d3813f00c186bb4669e3423bfcafb6e33b48934f;hb=04a2a29c9811ca80be2123aaab0e56e569a6e3cc;hpb=115ce6f2da1914d68b0fe0e5f9082973190dacdd diff --git a/src/game_sp/Globals.c b/src/game_sp/Globals.c index d3813f00..0ca65000 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -5,6 +5,9 @@ #include "Globals.h" +static int *PlayField16Mem; +static byte *PlayField8Mem; + boolean LevelLoaded; boolean DemoAvailable; @@ -166,17 +169,23 @@ void InitGlobals(void) bPlaying = False; menBorder = False; - /* add preceding playfield buffer (as large as preceding memory area) */ - PlayField16 = checked_calloc((game_sp.preceding_buffer_size + - SP_MAX_PLAYFIELD_SIZE + - SP_HEADER_SIZE) * sizeof(int)); - PlayField16 = &PlayField16[game_sp.preceding_buffer_size]; - - /* add preceding playfield buffer (as large as one playfield row) */ - PlayField8 = checked_calloc((SP_MAX_PLAYFIELD_WIDTH + - SP_MAX_PLAYFIELD_SIZE + - SP_HEADER_SIZE) * sizeof(byte)); - PlayField8 = &PlayField8[SP_MAX_PLAYFIELD_WIDTH]; + // add preceding playfield buffer (as large as preceding memory area) + PlayField16Mem = checked_calloc((game_sp.preceding_buffer_size + + SP_MAX_PLAYFIELD_SIZE + + SP_HEADER_SIZE) * sizeof(int)); + PlayField16 = &PlayField16Mem[game_sp.preceding_buffer_size]; + + // add preceding playfield buffer (as large as one playfield row) + PlayField8Mem = checked_calloc((SP_MAX_PLAYFIELD_WIDTH + + SP_MAX_PLAYFIELD_SIZE + + SP_HEADER_SIZE) * sizeof(byte)); + PlayField8 = &PlayField8Mem[SP_MAX_PLAYFIELD_WIDTH]; +} + +void FreeGlobals(void) +{ + checked_free(PlayField16Mem); + checked_free(PlayField8Mem); } int GetSI(int X, int Y)