Fix VSync not applying properly at startup in C client

This commit is contained in:
UnknownShadow200 2018-05-18 22:56:06 +10:00
parent ec690648f8
commit e9502882e1
2 changed files with 5 additions and 4 deletions

View File

@ -416,6 +416,7 @@ void Game_Load(void) {
IGameComponent comp;
Gfx_Init();
Gfx_SetVSync(true);
Gfx_MakeApiInfo();
Drawer2D_Init();

View File

@ -403,7 +403,7 @@ static void Classic_LevelInit(Stream* stream) {
if (cpe_fastMap) {
mapVolume = Stream_ReadI32_BE(stream);
gzHeader.Done = true;
mapSizeIndex = 4;
mapSizeIndex = sizeof(UInt32);
map = Platform_MemAlloc(mapVolume, sizeof(BlockID));
if (map == NULL) ErrorHandler_Fail("Failed to allocate memory for map");
}
@ -424,14 +424,14 @@ static void Classic_LevelDataChunk(Stream* stream) {
if (!gzHeader.Done) { GZipHeader_Read(&mapPartStream, &gzHeader); }
if (gzHeader.Done) {
if (mapSizeIndex < 4) {
if (mapSizeIndex < sizeof(UInt32)) {
UInt8* src = mapSize + mapSizeIndex;
UInt32 count = 4 - mapSizeIndex, modified = 0;
UInt32 count = sizeof(UInt32) - mapSizeIndex, modified = 0;
mapInflateStream.Read(&mapInflateStream, src, count, &modified);
mapSizeIndex += modified;
}
if (mapSizeIndex == 4) {
if (mapSizeIndex == sizeof(UInt32)) {
if (map == NULL) {
mapVolume = (mapSize[0] << 24) | (mapSize[1] << 16) | (mapSize[2] << 8) | mapSize[3];
map = Platform_MemAlloc(mapVolume, sizeof(BlockID));