Fix Male Assassin unable to use the Sniper Rifle.
Partially fixed the Stukabat being unable to move when target is unreachable. Removed zombie/gonome bullet resistance. Add Global Model Replacement and Global Sound Replacement. Update Tier milestones.
This commit is contained in:
121
src/dlls/globalreplace.cpp
Normal file
121
src/dlls/globalreplace.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
//=========================================================
|
||||
// Global Replacement:
|
||||
// Tool to replace all default models/sounds with a
|
||||
// customized list.
|
||||
//=========================================================
|
||||
#include "extdll.h"
|
||||
#include "dllapi.h"
|
||||
#include "meta_api.h"
|
||||
|
||||
#include "cmbase.h"
|
||||
#include "cmbasemonster.h"
|
||||
|
||||
namespace REPLACER
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
char source[128];
|
||||
char destination[128];
|
||||
} REPLACER;
|
||||
|
||||
REPLACER *GMR;
|
||||
REPLACER *GSR;
|
||||
int numModels;
|
||||
int numSounds;
|
||||
|
||||
void Init(void)
|
||||
{
|
||||
if ( GMR != NULL )
|
||||
{
|
||||
free( GMR );
|
||||
GMR = NULL;
|
||||
}
|
||||
if ( GSR != NULL )
|
||||
{
|
||||
free( GSR );
|
||||
GSR = NULL;
|
||||
}
|
||||
numModels = 0;
|
||||
numSounds = 0;
|
||||
}
|
||||
|
||||
bool AddGlobalModel(const char *from, const char *to)
|
||||
{
|
||||
if (numModels < MAX_REPLACEMENTS)
|
||||
{
|
||||
// allocate for the first time
|
||||
if (!numModels)
|
||||
GMR = (REPLACER*)calloc(MAX_REPLACEMENTS, sizeof(*GMR));
|
||||
|
||||
strcpy(GMR[numModels].source, from);
|
||||
strcpy(GMR[numModels].destination, to);
|
||||
|
||||
numModels++;
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_MESSAGE(PLID, "Can't replace model '%s', too many models in GMR.", from);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AddGlobalSound(const char *from, const char *to)
|
||||
{
|
||||
if (numSounds < MAX_REPLACEMENTS)
|
||||
{
|
||||
// allocate for the first time
|
||||
if (!numSounds)
|
||||
GSR = (REPLACER*)calloc(MAX_REPLACEMENTS, sizeof(*GSR));
|
||||
|
||||
strcpy(GSR[numSounds].source, from);
|
||||
strcpy(GSR[numSounds].destination, to);
|
||||
|
||||
numSounds++;
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_MESSAGE(PLID, "Can't replace sound '%s', too many sounds in GSR.", from);
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* FindModelReplacement( edict_t *pMonster, const char *from )
|
||||
{
|
||||
// Individually set models takes priority!
|
||||
if ( pMonster && !FStringNull(pMonster->v.model))
|
||||
return STRING(pMonster->v.model);
|
||||
|
||||
// Find the model
|
||||
for (int model = 0; model < numModels; model++)
|
||||
{
|
||||
if (strcmp(GMR[model].source, from) == 0)
|
||||
{
|
||||
// If found, use that model instead
|
||||
return GMR[model].destination;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found, stick with default
|
||||
return from;
|
||||
}
|
||||
|
||||
const char* FindSoundReplacement( edict_t *pMonster, const char *from )
|
||||
{
|
||||
// Individually set sounds takes priority!
|
||||
if ( pMonster )
|
||||
{
|
||||
CMBaseMonster *castMonster = GetClassPtr((CMBaseMonster *)VARS(pMonster));
|
||||
//placeholder for soundlist keyvalue;
|
||||
}
|
||||
|
||||
for (int sound = 0; sound < numSounds; sound++)
|
||||
{
|
||||
if (strcmp(GSR[sound].source, from) == 0)
|
||||
{
|
||||
// If found, use that model instead
|
||||
return GSR[sound].destination;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found, stick with default
|
||||
return from;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user