Add support for Space-Life

This commit is contained in:
Wizzard 2024-01-23 01:45:59 -05:00
parent 184e52dcbc
commit e53e7c5d37
4 changed files with 18 additions and 2 deletions

View File

@ -42,7 +42,9 @@ GameType get_current_game(void) {
current_game = GAME_DMC; current_game = GAME_DMC;
} else if (strcmp(gameTypeToken, "tfc") == 0) { } else if (strcmp(gameTypeToken, "tfc") == 0) {
current_game = GAME_TFC; current_game = GAME_TFC;
} } else if (strcmp(gameTypeToken, "SpaceLife") == 0) {
current_game = GAME_SL;
}
} else if (steamToken && tokensFound == 2) { } else if (steamToken && tokensFound == 2) {
// If only `-steam` is found and no `-game`, with only two tokens, assume it's Half-Life 1 // If only `-steam` is found and no `-game`, with only two tokens, assume it's Half-Life 1
current_game = GAME_HALFLIFE; current_game = GAME_HALFLIFE;
@ -72,3 +74,7 @@ int IsTFC(void) {
int IsDeathmatchClassic(void) { int IsDeathmatchClassic(void) {
return get_current_game() == GAME_DMC; return get_current_game() == GAME_DMC;
} }
int IsSpaceLife(void) {
return get_current_game() == GAME_SL;
}

View File

@ -7,7 +7,8 @@ typedef enum {
GAME_CS16, GAME_CS16,
GAME_TFC, GAME_TFC,
GAME_DAY_OF_DEFEAT, GAME_DAY_OF_DEFEAT,
GAME_DMC GAME_DMC,
GAME_SL
} GameType; } GameType;
GameType get_current_game(void); GameType get_current_game(void);
@ -16,5 +17,6 @@ int IsHalfLife(void);
int IsDayOfDefeat(void); int IsDayOfDefeat(void);
int IsTFC(void); int IsTFC(void);
int IsDeathmatchClassic(void); int IsDeathmatchClassic(void);
int IsSpaceLife(void);
#endif #endif

View File

@ -9,6 +9,7 @@ enum game_id {
CS = 1, /* Counter-Strike 1.6 */ CS = 1, /* Counter-Strike 1.6 */
TF = 2, /* Team Fortress Classic */ TF = 2, /* Team Fortress Classic */
DOD = 3, /* Day of Defeat */ DOD = 3, /* Day of Defeat */
SL = 4, /* Space Life: Finleys Revenge */
}; };
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/

View File

@ -1,4 +1,5 @@
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -51,6 +52,9 @@ void load(void) {
else if (IsDeathmatchClassic()) { else if (IsDeathmatchClassic()) {
i_engine->pfnClientCmd("play 'sound/items/suit.wav'"); i_engine->pfnClientCmd("play 'sound/items/suit.wav'");
} }
else if (IsSpaceLife()) {
i_engine->pfnClientCmd("play 'sound/finley/soccer_ball.wav'");
}
else else
{ {
i_engine->pfnClientCmd("play 'valve/sound/vox/suit.wav'"); i_engine->pfnClientCmd("play 'valve/sound/vox/suit.wav'");
@ -78,6 +82,9 @@ void load(void) {
case GAME_DMC: case GAME_DMC:
i_engine->pfnClientCmd("echo \"Detected Game: Deathmatch Classic\""); i_engine->pfnClientCmd("echo \"Detected Game: Deathmatch Classic\"");
break; break;
case GAME_SL:
i_engine->pfnClientCmd("echo \"Detected Game: Space Life: Finley's Revenge\"");
break;
default: default:
i_engine->pfnClientCmd("echo \"Detected Game: Unknown Game\""); i_engine->pfnClientCmd("echo \"Detected Game: Unknown Game\"");
break; break;