Skip to content

Commit

Permalink
1.Add missing header files.
Browse files Browse the repository at this point in the history
2.Add file extension check in CRegexResourceReplaceEntry::GetReplacedFileName.
  • Loading branch information
hzqst committed Feb 19, 2024
1 parent f58562d commit 61658f3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Plugins/ResourceReplacer/ResourceReplacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ class CRegexResourceReplaceEntry : public IResourceReplaceEntry
std::cmatch match;
if (std::regex_match(szSourceFileName, match, m_Regex))
{
ReplacedFileName = std::regex_replace(szSourceFileName, m_Regex, m_Replacement);
return true;
std::string NewReplacedFileName = std::regex_replace(szSourceFileName, m_Regex, m_Replacement);

auto SourceExtension = V_GetFileExtension(szSourceFileName);
auto ReplaceExtension = V_GetFileExtension(NewReplacedFileName.c_str());

if (!stricmp(SourceExtension, ReplaceExtension))
{
ReplacedFileName = NewReplacedFileName;
return true;
}
}
return false;
}
Expand Down
40 changes: 40 additions & 0 deletions Plugins/ResourceReplacer/enginedef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include <com_model.h>

#define MAX_QPATH 64 // max length of a quake game pathname

typedef struct sfx_s
{
char name[MAX_QPATH];
cache_user_t cache;
int servercount;
}sfx_t;

typedef struct sfxcache_s
{
int length;
int loopstart;
int speed;
int width;
int stereo;
byte data[1]; // variable sized
} sfxcache_t;

typedef struct
{
sfx_t* sfx; // sfx number
int leftvol; // 0-255 volume
int rightvol; // 0-255 volume
int end; // end time in global paintsamples
int pos; // sample position in sfx
int looping; // where to loop, -1 = no looping
int entnum; // to allow overriding a specific sound
int entchannel; //
vec3_t origin; // origin of sound effect
vec_t dist_mult; // distance multiplier (attenuation/clipK)
int master_vol; // 0-255 master volume
int isentence;
int iword;
int pitch; // real-time pitch after any modulation or shift by dynamic data
} channel_t;

0 comments on commit 61658f3

Please sign in to comment.