diff --git a/rehlds/engine/decals.cpp b/rehlds/engine/decals.cpp index 7f83f74..d5ee917 100644 --- a/rehlds/engine/decals.cpp +++ b/rehlds/engine/decals.cpp @@ -77,7 +77,7 @@ void Draw_CacheWadInitFromFile(FileHandle_t hFile, int len, char *name, int cach wadinfo_t header; FS_Read(&header, sizeof(wadinfo_t), 1, hFile); - if (Q_strncmp(header.identification, "WAD3", 4)) + if (*(uint32 *)header.identification != MAKEID('W', 'A', 'D', '3')) Sys_Error("Wad file %s doesn't have WAD3 id\n", name); wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs); @@ -115,7 +115,7 @@ qboolean Draw_CustomCacheWadInit(int cacheMax, cachewad_t *wad, void *raw, int n lumpinfo_t *lump_p; wadinfo_t header; header = *(wadinfo_t *)raw; - if (Q_strncmp(header.identification, "WAD3", 4)) + if (*(uint32 *)header.identification != MAKEID('W', 'A', 'D', '3')) { Con_Printf("Custom file doesn't have WAD3 id\n"); return FALSE; diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index 3058c8f..bb5b1aa 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -428,7 +428,7 @@ void Host_UpdateStats(void) lastcputicks = cputicks; if (lastrunticks) - cpuPercent = (cputicks - lastcputicks) / (runticks - lastrunticks); + cpuPercent = (double)(cputicks - lastcputicks) / (double)(runticks - lastrunticks); else lastrunticks = runticks; @@ -440,7 +440,7 @@ void Host_UpdateStats(void) } if (cpuPercent > 0.999) cpuPercent = 0.999; - if (cpuPercent < 0.1) + else if (cpuPercent < 0.0) cpuPercent = 0.0; last = Sys_FloatTime(); } diff --git a/rehlds/engine/net_chan.cpp b/rehlds/engine/net_chan.cpp index 78a6b7e..91abd9d 100644 --- a/rehlds/engine/net_chan.cpp +++ b/rehlds/engine/net_chan.cpp @@ -1007,7 +1007,7 @@ void Netchan_CreateFragments_(qboolean server, netchan_t *chan, sizebuf_t *msg) } // Compress if not done already - if (msg->data[0] != 'B' || msg->data[1] != 'Z' || msg->data[2] != '2' || msg->data[3] != 0) + if (*(uint32 *)msg->data != MAKEID('B', 'Z', '2', '\0')) { unsigned char compressed[65536]; char hdr[4] = "BZ2"; @@ -1383,7 +1383,7 @@ qboolean Netchan_CopyNormalFragments(netchan_t *chan) p = n; } - if (net_message.data[0] == 'B' && net_message.data[1] == 'Z' && net_message.data[2] == '2' && net_message.data[3] == 0) + if (*(uint32 *)net_message.data == MAKEID('B', 'Z', '2', '\0')) { char uncompressed[65536]; unsigned int uncompressedSize = 65536; diff --git a/rehlds/engine/wad.cpp b/rehlds/engine/wad.cpp index 4d22ec4..0728adb 100644 --- a/rehlds/engine/wad.cpp +++ b/rehlds/engine/wad.cpp @@ -79,11 +79,8 @@ int W_LoadWadFile(char *filename) Q_strncpy(wad->wadname, filename, sizeof(wad->wadname) - 1); wadinfo_t *header = (wadinfo_t *)wad->wad_base; wad->wadname[sizeof(wad->wadname) - 1] = 0; - wad->loaded = 1; - if (header->identification[0] != 'W' - || header->identification[1] != 'A' - || header->identification[2] != 'D' - || header->identification[3] != '3') + wad->loaded = TRUE; + if (*(uint32 *)header->identification != MAKEID('W', 'A', 'D', '3')) Sys_Error("Wad file %s doesn't have WAD3 id\n", filename); wad->wad_numlumps = LittleLong(header->numlumps);