From 4c5294550f719b267f78ad1a54ebd83843473e7f Mon Sep 17 00:00:00 2001 From: Juice <5415811+etojuice@users.noreply.github.com> Date: Mon, 9 Oct 2023 00:16:21 +0300 Subject: [PATCH] Update IGameEvent (#155) Co-authored-by: GAMMACASE <31375974+GAMMACASE@users.noreply.github.com> --- public/igameevents.h | 413 +++++++++++++++++++++++------------------- tier1/generichash.cpp | 52 +++++- 2 files changed, 277 insertions(+), 188 deletions(-) diff --git a/public/igameevents.h b/public/igameevents.h index 08f4b957..d8b9f741 100644 --- a/public/igameevents.h +++ b/public/igameevents.h @@ -1,187 +1,226 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $Workfile: $ -// $Date: $ -// -//----------------------------------------------------------------------------- -// $Log: $ -// -// $NoKeywords: $ -//=============================================================================// -#if !defined( IGAMEEVENTS_H ) -#define IGAMEEVENTS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "interfaces/interfaces.h" -#include "tier1/bitbuf.h" - -class CMsgSource1LegacyGameEvent; -class CPlayerSlot; -class CBasePlayer; -class CEntityIndex; -class CEntityHandle; -class CBaseEntity; -//----------------------------------------------------------------------------- -// Purpose: Engine interface into global game event management -//----------------------------------------------------------------------------- - -/* - -The GameEventManager keeps track and fires of all global game events. Game events -are fired by game.dll for events like player death or team wins. Each event has a -unique name and comes with a KeyValue structure providing informations about this -event. Some events are generated also by the engine. - -Events are networked to connected clients and invoked there to. Therefore you -have to specify all data fields and there data types in an public resource -file which is parsed by server and broadcasted to it's clients. A typical game -event is defined like this: - - "game_start" // a new game starts - { - "roundslimit" "long" // max round - "timelimit" "long" // time limit - "fraglimit" "long" // frag limit - "objective" "string" // round objective - } - -All events must have unique names (case sensitive) and may have a list -of data fields. each data field must specify a data type, so the engine -knows how to serialize/unserialize that event for network transmission. -Valid data types are string, float, long, short, byte & bool. If a -data field should not be broadcasted to clients, use the type "local". -*/ - - -#define MAX_EVENT_NAME_LENGTH 32 // max game event name length -#define MAX_EVENT_BITS 9 // max bits needed for an event index -#define MAX_EVENT_NUMBER (1<= 4) + { + uint32 k = LittleDWord( *(uint32 *)data ); + + k *= m; + k ^= k >> r; + k *= m; + + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + // Handle the last few bytes of the input array + + switch(len) + { + case 3: h ^= data[2] << 16; + case 2: h ^= data[1] << 8; + case 1: h ^= data[0]; + h *= m; + }; + + // Do a few final mixes of the hash to ensure the last few + // bytes are well-incorporated. + + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return h; +}