From 5f8254eb8a4cbb1e08678678b30e8011b504a95c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 26 Sep 2018 20:46:08 +1000 Subject: [PATCH] C client: Fix progress not being reset to 0 on showing loading screen --- src/Screens.c | 1 + src/Vorbis.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Screens.c b/src/Screens.c index f9ab58169..c014d34dd 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -592,6 +592,7 @@ struct Screen* LoadingScreen_MakeInstance(const String* title, const String* mes struct LoadingScreen* s = &LoadingScreen_Instance; s->LastState = NULL; s->VTABLE = &LoadingScreen_VTABLE; + s->Progress = 0.0f; String title_copy = String_FromArray(s->__TitleBuffer); String_AppendString(&title_copy, title); diff --git a/src/Vorbis.c b/src/Vorbis.c index de876c6eb..44c616552 100644 --- a/src/Vorbis.c +++ b/src/Vorbis.c @@ -188,7 +188,6 @@ static UInt32 Codebook_Lookup1Values(UInt32 entries, UInt32 dimensions) { return 0; } -#define CODEWORD_UNUSED UInt8_MaxValue static bool Codebook_CalcCodewords(struct Codebook* c, UInt8* len) { c->Codewords = Mem_Alloc(c->NumCodewords, sizeof(UInt32), "codewords"); c->CodewordLens = Mem_Alloc(c->NumCodewords, sizeof(UInt8), "raw codeword lens"); @@ -200,7 +199,7 @@ static bool Codebook_CalcCodewords(struct Codebook* c, UInt8* len) { /* add codeword 0 to tree */ for (i = 0; i < c->Entries; i++) { - if (len[i] == CODEWORD_UNUSED) continue; + if (!len[i]) continue; c->Codewords[0] = 0; c->CodewordLens[0] = len[i]; @@ -216,7 +215,7 @@ static bool Codebook_CalcCodewords(struct Codebook* c, UInt8* len) { i++; /* first codeword was already handled */ for (j = 1; i < c->Entries; i++) { UInt32 root = len[i]; - if (root == CODEWORD_UNUSED) continue; + if (!root) continue; /* per spec, find lowest possible value (leftmost) */ while (root && next_codewords[root] == 0) root--; @@ -252,7 +251,7 @@ static ReturnCode Codebook_DecodeSetup(struct VorbisState* ctx, struct Codebook* if (sparse) { Int32 flag = Vorbis_ReadBits(ctx, 1); if (!flag) { - codewordLens[i] = CODEWORD_UNUSED; + codewordLens[i] = 0; continue; /* unused entry */ } }