From c5e985bc420ae65c1d4df9bd30604c3f33fe01c7 Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Wed, 20 Sep 2023 08:46:08 -0400 Subject: [PATCH] Deathmatch classic support --- README.org | 1 + src/game_detection.c | 6 ++++++ src/include/game_detection.h | 4 +++- src/main.c | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 393d35c..87c6255 100644 --- a/README.org +++ b/README.org @@ -15,6 +15,7 @@ Supported games: - [[https://store.steampowered.com/app/10/CounterStrike/][Counter-Strike 1.6]] - [[https://store.steampowered.com/app/20/Team_Fortress_Classic/][Team Fortress Classic]] - [[https://store.steampowered.com/app/30/Day_of_Defeat/][Day of Defeat]] +- [[https://store.steampowered.com/app/40/Deathmatch_Classic/][Deathmatch Classic]] This project was heavily inspired by [[https://github.com/UnkwUsr/hlhax][UnkwUsr/hlhax]], and would not have been possible without his help. Make sure to check out his repo too. diff --git a/src/game_detection.c b/src/game_detection.c index 31c2eb4..856d447 100644 --- a/src/game_detection.c +++ b/src/game_detection.c @@ -38,6 +38,8 @@ GameType get_current_game(void) { current_game = GAME_CS16; } else if (strcmp(gameTypeToken, "dod") == 0) { current_game = GAME_DAY_OF_DEFEAT; + } else if (strcmp(gameTypeToken, "dmc") == 0) { + current_game = GAME_DMC; } else if (strcmp(gameTypeToken, "tfc") == 0) { current_game = GAME_TFC; } @@ -66,3 +68,7 @@ int IsDayOfDefeat(void) { int IsTFC(void) { return get_current_game() == GAME_TFC; } + +int IsDeathmatchClassic(void) { + return get_current_game() == GAME_DMC; +} diff --git a/src/include/game_detection.h b/src/include/game_detection.h index b7df132..686c8e3 100644 --- a/src/include/game_detection.h +++ b/src/include/game_detection.h @@ -6,7 +6,8 @@ typedef enum { GAME_HALFLIFE, GAME_CS16, GAME_TFC, - GAME_DAY_OF_DEFEAT + GAME_DAY_OF_DEFEAT, + GAME_DMC } GameType; GameType get_current_game(void); @@ -14,5 +15,6 @@ int IsCS16(void); int IsHalfLife(void); int IsDayOfDefeat(void); int IsTFC(void); +int IsDeathmatchClassic(void); #endif diff --git a/src/main.c b/src/main.c index 4be8849..2f7f0c2 100644 --- a/src/main.c +++ b/src/main.c @@ -49,6 +49,9 @@ void load(void) { else if (IsTFC()) { i_engine->pfnClientCmd("play 'sound/misc/party2.wav'"); } + else if (IsDeathmatchClassic()) { + i_engine->pfnClientCmd("play 'sound/items/suit.wav'"); + } else { i_engine->pfnClientCmd("play 'valve/sound/vox/suit.wav'"); @@ -73,6 +76,9 @@ void load(void) { case GAME_TFC: i_engine->pfnClientCmd("echo \"Detected Game: Team Fortress Classic\""); break; + case GAME_DMC: + i_engine->pfnClientCmd("echo \"Detected Game: Deathmatch Classic\""); + break; default: i_engine->pfnClientCmd("echo \"Detected Game: Unknown Game\""); break;