Skip to content

Commit

Permalink
Merge branch 'patch' into experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Nov 25, 2024
2 parents f5f7ff0 + b380cfe commit a0205c4
Show file tree
Hide file tree
Showing 203 changed files with 34,820 additions and 144 deletions.
Binary file modified MapFiles/Corssfire.rmf
Binary file not shown.
Binary file modified MapFiles/Crossfire.rmf
Binary file not shown.
Binary file modified MapFiles/Crossfire_Day.rmf
Binary file not shown.
Binary file added MapFiles/Penguin_Pit.rmf
Binary file not shown.
Binary file added MapFiles/Snark_Pit.rmf
Binary file not shown.
Binary file added MapFiles/Snowfire.rmf
Binary file not shown.
Binary file modified MapFiles/Subtransit.rmf
Binary file not shown.
33 changes: 21 additions & 12 deletions SourceCode/dlls/agsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,30 +635,39 @@ void AgSettings::CalcNextMap()
char szCommands[1500];
char szRules[1500];
int minplayers = 0, maxplayers = 0;
strcpy(szFirstMapInList, "boot_camp"); // the absolute default level is hldm1
strcpy(szFirstMapInList, "boot_camp"); // the absolute default level

int curplayers;
int curplayers;
BOOL do_cycle = TRUE;

// find the map to change to
char* mapcfile = (char*)CVAR_GET_STRING("mapcyclefile");
ASSERT(mapcfile != NULL);
// Sabian: Get the user input for mapcyclefile
char userInputMapCycleFile[256];
char* userInput = (char*)CVAR_GET_STRING("mapcyclefile");

// Sabian: Remove ".txt" if present in user input
size_t len = strlen(userInput);
if (len > 4 && strcmp(&userInput[len - 4], ".txt") == 0) {
userInput[len - 4] = '\0'; // Truncate the ".txt" part
}

// Sabian: Format the path as "mapcycles/%USERINPUT%.mc"
sprintf(userInputMapCycleFile, "mapcycles/%s.mc", userInput);

szCommands[0] = '\0';
szRules[0] = '\0';

curplayers = AgCountPlayers();

// Has the map cycle filename changed?
if (stricmp(mapcfile, szPreviousMapCycleFile))
// Check if the constructed map cycle filename has changed
if (stricmp(userInputMapCycleFile, szPreviousMapCycleFile))
{
strcpy(szPreviousMapCycleFile, mapcfile);
strcpy(szPreviousMapCycleFile, userInputMapCycleFile);

AgDestroyMapCycle(&mapcycle);

if (!AgReloadMapCycleFile(mapcfile, &mapcycle) || (!mapcycle.items))
if (!AgReloadMapCycleFile(userInputMapCycleFile, &mapcycle) || (!mapcycle.items))
{
ALERT(at_console, "Unable to load map cycle file %s\n", mapcfile);
ALERT(at_console, "Unable to load map cycle file %s\n", userInputMapCycleFile);
do_cycle = FALSE;
}
}
Expand Down Expand Up @@ -743,10 +752,10 @@ void AgSettings::CalcNextMap()
ALERT(at_console, "RULES: %s\n", szRules);
}

// Set the next map and rules for use in other parts of the code
g_sNextMap = szNextMap;
g_sNextRules = szCommands;
//No need to calc more.
m_bCalcNextMap = false;
m_bCalcNextMap = false; // Flag indicating calculation is complete
}


Expand Down
12 changes: 11 additions & 1 deletion SourceCode/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,16 @@ void ClientPrecache( void )
PRECACHE_SOUND("player/pl_wade3.wav");
PRECACHE_SOUND("player/pl_wade4.wav");

PRECACHE_SOUND("player/pl_wood1.wav"); // walk on wood
PRECACHE_SOUND("player/pl_wood2.wav");
PRECACHE_SOUND("player/pl_wood3.wav");
PRECACHE_SOUND("player/pl_wood4.wav");

PRECACHE_SOUND("player/pl_snow1.wav"); // walk on snow
PRECACHE_SOUND("player/pl_snow2.wav");
PRECACHE_SOUND("player/pl_snow3.wav");
PRECACHE_SOUND("player/pl_snow4.wav");

PRECACHE_SOUND("debris/wood1.wav"); // hit wood texture
PRECACHE_SOUND("debris/wood2.wav");
PRECACHE_SOUND("debris/wood3.wav");
Expand Down Expand Up @@ -902,7 +912,7 @@ void ClientPrecache( void )

// BlueNightHawk : Suit Energy Regeneration
PRECACHE_SOUND("buttons/blip1.wav");
PRECACHE_SOUND("buttons/bell1.wav");
PRECACHE_SOUND("plats/elevbell1.wav");
PRECACHE_SOUND("buttons/spark1.wav");

if (giPrecacheGrunt)
Expand Down
4 changes: 3 additions & 1 deletion SourceCode/dlls/hgrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,11 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )

case HGRUNT_AE_KICK:
{
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "hgrunt/gr_kick.wav", 1, ATTN_NORM);
CBaseEntity *pHurt = Kick();

if ( pHurt )
{
// SOUND HERE!
UTIL_MakeVectors( pev->angles );
pHurt->pev->punchangle.x = 15;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 100 + gpGlobals->v_up * 50;
Expand Down Expand Up @@ -1105,6 +1105,8 @@ void CHGrunt :: Precache()

PRECACHE_SOUND("zombie/claw_miss2.wav");// because we use the basemonster SWIPE animation event

PRECACHE_SOUND("hgrunt/gr_kick.wav");

// get voice pitch
if (RANDOM_LONG(0,1))
m_voicePitch = 109 + RANDOM_LONG(0,7);
Expand Down
99 changes: 54 additions & 45 deletions SourceCode/dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1701,64 +1701,73 @@ ChangeLevel
Server is changing to a new level, check mapcycle.txt for map name and setup info
==============
*/
void CHalfLifeMultiplay :: ChangeLevel( void )
void CHalfLifeMultiplay::ChangeLevel(void)
{
static char szPreviousMapCycleFile[ 256 ];
static char szPreviousMapCycleFile[256];
static mapcycle_t mapcycle;

char szNextMap[32];
char szFirstMapInList[32];
char szCommands[ 1500 ];
char szRules[ 1500 ];
char szCommands[1500];
char szRules[1500];
int minplayers = 0, maxplayers = 0;
strcpy( szFirstMapInList, "hldm1" ); // the absolute default level is hldm1
strcpy(szFirstMapInList, "hldm1"); // the absolute default level is hldm1

int curplayers;
int curplayers;
BOOL do_cycle = TRUE;

// find the map to change to
char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
ASSERT( mapcfile != NULL );
// Sabian: Get the user input for mapcyclefile
char userInputMapCycleFile[256];
char* userInput = (char*)CVAR_GET_STRING("mapcyclefile");

szCommands[ 0 ] = '\0';
szRules[ 0 ] = '\0';
// Sabian: Remove ".txt" if present in user input
size_t len = strlen(userInput);
if (len > 4 && strcmp(&userInput[len - 4], ".txt") == 0) {
userInput[len - 4] = '\0'; // Truncate the ".txt" part
}

// Sabian: Format the path as "mapcycles/%USERINPUT%.mc"
sprintf(userInputMapCycleFile, "mapcycles/%s.mc", userInput);

szCommands[0] = '\0';
szRules[0] = '\0';

curplayers = CountPlayers();

// Has the map cycle filename changed?
if ( stricmp( mapcfile, szPreviousMapCycleFile ) )
// Check if the constructed map cycle filename has changed
if (stricmp(userInputMapCycleFile, szPreviousMapCycleFile))
{
strcpy( szPreviousMapCycleFile, mapcfile );
strcpy(szPreviousMapCycleFile, userInputMapCycleFile);

DestroyMapCycle( &mapcycle );
DestroyMapCycle(&mapcycle);

if ( !ReloadMapCycleFile( mapcfile, &mapcycle ) || ( !mapcycle.items ) )
if (!ReloadMapCycleFile(userInputMapCycleFile, &mapcycle) || (!mapcycle.items))
{
ALERT( at_console, "Unable to load map cycle file %s\n", mapcfile );
ALERT(at_console, "Unable to load map cycle file %s\n", userInputMapCycleFile);
do_cycle = FALSE;
}
}

if ( do_cycle && mapcycle.items )
if (do_cycle && mapcycle.items)
{
BOOL keeplooking = FALSE;
BOOL found = FALSE;
mapcycle_item_s *item;
mapcycle_item_s* item;

// Assume current map
strcpy( szNextMap, STRING(gpGlobals->mapname) );
strcpy( szFirstMapInList, STRING(gpGlobals->mapname) );
strcpy(szNextMap, STRING(gpGlobals->mapname));
strcpy(szFirstMapInList, STRING(gpGlobals->mapname));

// Traverse list
for ( item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next )
for (item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next)
{
keeplooking = FALSE;

ASSERT( item != NULL );
ASSERT(item != NULL);

if ( item->minplayers != 0 )
if (item->minplayers != 0)
{
if ( curplayers >= item->minplayers )
if (curplayers >= item->minplayers)
{
found = TRUE;
minplayers = item->minplayers;
Expand All @@ -1769,9 +1778,9 @@ void CHalfLifeMultiplay :: ChangeLevel( void )
}
}

if ( item->maxplayers != 0 )
if (item->maxplayers != 0)
{
if ( curplayers <= item->maxplayers )
if (curplayers <= item->maxplayers)
{
found = TRUE;
maxplayers = item->maxplayers;
Expand All @@ -1782,49 +1791,49 @@ void CHalfLifeMultiplay :: ChangeLevel( void )
}
}

if ( keeplooking )
if (keeplooking)
continue;

found = TRUE;
break;
}

if ( !found )
if (!found)
{
item = mapcycle.next_item;
}
}

// Increment next item pointer
mapcycle.next_item = item->next;

// Perform logic on current item
strcpy( szNextMap, item->mapname );
strcpy(szNextMap, item->mapname);

ExtractCommandString( item->rulebuffer, szCommands );
strcpy( szRules, item->rulebuffer );
ExtractCommandString(item->rulebuffer, szCommands);
strcpy(szRules, item->rulebuffer);
}

if ( !IS_MAP_VALID(szNextMap) )
if (!IS_MAP_VALID(szNextMap))
{
strcpy( szNextMap, szFirstMapInList );
strcpy(szNextMap, szFirstMapInList);
}

g_fGameOver = TRUE;

ALERT( at_console, "CHANGE LEVEL: %s\n", szNextMap );
if ( minplayers || maxplayers )
ALERT(at_console, "CHANGE LEVEL: %s\n", szNextMap);
if (minplayers || maxplayers)
{
ALERT( at_console, "PLAYER COUNT: min %i max %i current %i\n", minplayers, maxplayers, curplayers );
ALERT(at_console, "PLAYER COUNT: min %i max %i current %i\n", minplayers, maxplayers, curplayers);
}
if ( strlen( szRules ) > 0 )
if (strlen(szRules) > 0)
{
ALERT( at_console, "RULES: %s\n", szRules );
ALERT(at_console, "RULES: %s\n", szRules);
}
CHANGE_LEVEL( szNextMap, NULL );
if ( strlen( szCommands ) > 0 )

CHANGE_LEVEL(szNextMap, NULL);
if (strlen(szCommands) > 0)
{
SERVER_COMMAND( szCommands );
SERVER_COMMAND(szCommands);
}
}

Expand Down
Loading

0 comments on commit a0205c4

Please sign in to comment.