mirror of https://github.com/TTimo/GtkRadiant.git
cleanup: strcpy to strncpy, strcat to strncat...
This commit is contained in:
parent
9521a52442
commit
a44b3bdfe1
|
@ -36,8 +36,7 @@
|
||||||
// spaces to make label nice and big
|
// spaces to make label nice and big
|
||||||
#define NO_FILE_MSG " (no file loaded) "
|
#define NO_FILE_MSG " (no file loaded) "
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
// TTimo: THIS IS UGLY
|
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -124,17 +123,17 @@ void CBackgroundDialogPage::Browse(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( browsedir,ct );
|
Q_strncpyz( browsedir, ct, sizeof( browsedir ) );
|
||||||
// make sure we have a trailing /
|
// make sure we have a trailing /
|
||||||
if ( browsedir[strlen( browsedir ) - 1] != '/' ) {
|
if ( browsedir[strlen( browsedir ) - 1] != '/' ) {
|
||||||
strcat( browsedir,"/" );
|
strncat( browsedir, "/", sizeof( browsedir ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we dont have a file yet, don't try to use it for default dir
|
//if we dont have a file yet, don't try to use it for default dir
|
||||||
if ( m_bValidFile ) {
|
if ( m_bValidFile ) {
|
||||||
// filename should always be a nice clean unix style relative path
|
// filename should always be a nice clean unix style relative path
|
||||||
ct = gtk_label_get_text( GTK_LABEL( m_pFileLabel ) );
|
ct = gtk_label_get_text( GTK_LABEL( m_pFileLabel ) );
|
||||||
strcat( browsedir,ct );
|
strncat( browsedir, ct, sizeof( browsedir ) );
|
||||||
Syn_Printf( MSG_PREFIX "full path: %s\n",browsedir );
|
Syn_Printf( MSG_PREFIX "full path: %s\n",browsedir );
|
||||||
|
|
||||||
// lop off the file part
|
// lop off the file part
|
||||||
|
@ -171,7 +170,7 @@ void CBackgroundDialogPage::Browse(){
|
||||||
|
|
||||||
void CBackgroundDialogPage::SetPosLabel(){
|
void CBackgroundDialogPage::SetPosLabel(){
|
||||||
char s[64];
|
char s[64];
|
||||||
snprintf( s, sizeof( s ) - 1, _( "Size/Position (%d,%d) (%d,%d)" ),(int)( m_pImage->m_xmin ),
|
snprintf( s, sizeof( s ), _( "Size/Position (%d,%d) (%d,%d)" ),(int)( m_pImage->m_xmin ),
|
||||||
(int)( m_pImage->m_ymin ),(int)( m_pImage->m_xmax ),(int)( m_pImage->m_ymax ) );
|
(int)( m_pImage->m_ymin ),(int)( m_pImage->m_xmax ),(int)( m_pImage->m_ymax ) );
|
||||||
gtk_label_set_text( GTK_LABEL( m_pPosLabel ),s );
|
gtk_label_set_text( GTK_LABEL( m_pPosLabel ),s );
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,8 +313,8 @@ bool DBobView::CalculateTrajectory( vec3_t start, vec3_t apex, float multiplier,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBobView::Begin( const char* trigger, const char *target, float multiplier, int points, float varGravity, bool bNoUpdate, bool bShowExtra ){
|
void DBobView::Begin( const char* trigger, const char *target, float multiplier, int points, float varGravity, bool bNoUpdate, bool bShowExtra ){
|
||||||
strcpy( entTrigger, trigger );
|
Q_strncpyz( entTrigger, trigger, sizeof( entTrigger ) );
|
||||||
strcpy( entTarget, target );
|
Q_strncpyz( entTarget, target, sizeof( entTarget ) );
|
||||||
|
|
||||||
fMultiplier = multiplier;
|
fMultiplier = multiplier;
|
||||||
fVarGravity = varGravity;
|
fVarGravity = varGravity;
|
||||||
|
|
|
@ -683,9 +683,9 @@ void DBrush::SaveToFile( FILE *pFile ){
|
||||||
|
|
||||||
for ( list<DPlane *>::const_iterator pp = faceList.begin(); pp != faceList.end(); pp++ )
|
for ( list<DPlane *>::const_iterator pp = faceList.begin(); pp != faceList.end(); pp++ )
|
||||||
{
|
{
|
||||||
char buffer[512];
|
char buffer[720 + PATH_MAX];
|
||||||
|
|
||||||
sprintf( buffer, "( %.0f %.0f %.0f ) ( %.0f %.0f %.0f ) ( %.0f %.0f %.0f ) %s %.0f %.0f %f %f %.0f 0 0 0\n",
|
snprintf( buffer, sizeof( buffer ), "( %.0f %.0f %.0f ) ( %.0f %.0f %.0f ) ( %.0f %.0f %.0f ) %s %.0f %.0f %f %f %.0f 0 0 0\n",
|
||||||
( *pp )->points[0][0], ( *pp )->points[0][1], ( *pp )->points[0][2],
|
( *pp )->points[0][0], ( *pp )->points[0][1], ( *pp )->points[0][2],
|
||||||
( *pp )->points[1][0], ( *pp )->points[1][1], ( *pp )->points[1][2],
|
( *pp )->points[1][0], ( *pp )->points[1][1], ( *pp )->points[1][2],
|
||||||
( *pp )->points[2][0], ( *pp )->points[2][1], ( *pp )->points[2][2],
|
( *pp )->points[2][0], ( *pp )->points[2][1], ( *pp )->points[2][2],
|
||||||
|
@ -727,7 +727,7 @@ bool DBrush::ResetTextures( const char* textureName, float fScale[2], float f
|
||||||
{
|
{
|
||||||
if ( !strcmp( ( *resetPlane )->texInfo.m_TextureName, textureName ) ) {
|
if ( !strcmp( ( *resetPlane )->texInfo.m_TextureName, textureName ) ) {
|
||||||
if ( bResetTextureName ) {
|
if ( bResetTextureName ) {
|
||||||
strcpy( ( *resetPlane )->texInfo.m_TextureName, newTextureName );
|
Q_strncpyz( ( *resetPlane )->texInfo.m_TextureName, newTextureName, sizeof( ( *resetPlane )->texInfo.m_TextureName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bResetScale[0] ) {
|
if ( bResetScale[0] ) {
|
||||||
|
@ -758,7 +758,7 @@ bool DBrush::ResetTextures( const char* textureName, float fScale[2], float f
|
||||||
for ( list<DPlane *>::const_iterator resetPlane = faceList.begin(); resetPlane != faceList.end(); resetPlane++ )
|
for ( list<DPlane *>::const_iterator resetPlane = faceList.begin(); resetPlane != faceList.end(); resetPlane++ )
|
||||||
{
|
{
|
||||||
if ( bResetTextureName ) {
|
if ( bResetTextureName ) {
|
||||||
strcpy( ( *resetPlane )->texInfo.m_TextureName, newTextureName );
|
Q_strncpyz( ( *resetPlane )->texInfo.m_TextureName, newTextureName, sizeof( ( *resetPlane )->texInfo.m_TextureName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bResetScale[0] ) {
|
if ( bResetScale[0] ) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ char* getNextBracket( char* s ){
|
||||||
|
|
||||||
bool DEntity::LoadFromPrt( char *filename ){
|
bool DEntity::LoadFromPrt( char *filename ){
|
||||||
CPortals portals;
|
CPortals portals;
|
||||||
strcpy( portals.fn, filename );
|
Q_strncpyz( portals.fn, filename, sizeof( portals.fn ) );
|
||||||
portals.Load();
|
portals.Load();
|
||||||
|
|
||||||
if ( portals.node_count == 0 ) {
|
if ( portals.node_count == 0 ) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ DPatch::~DPatch(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void DPatch::SetTexture( const char *textureName ){
|
void DPatch::SetTexture( const char *textureName ){
|
||||||
strcpy( texture, textureName );
|
Q_strncpyz( texture, textureName, sizeof( texture ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyDrawVert( const drawVert_t* in, drawVert_t* out ){
|
void CopyDrawVert( const drawVert_t* in, drawVert_t* out ){
|
||||||
|
@ -124,7 +124,7 @@ void DPatch::RemoveFromRadiant(){
|
||||||
|
|
||||||
bool DPatch::ResetTextures( const char *oldTextureName, const char *newTextureName ){
|
bool DPatch::ResetTextures( const char *oldTextureName, const char *newTextureName ){
|
||||||
if ( !oldTextureName || !strcmp( texture, oldTextureName ) ) {
|
if ( !oldTextureName || !strcmp( texture, oldTextureName ) ) {
|
||||||
strcpy( texture, newTextureName );
|
Q_strncpyz( texture, newTextureName, sizeof( texture ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ bool DShape::BuildPit( vec3_t min, vec3_t max ){
|
||||||
int team = ( rand() % 10000 ) + 5000;
|
int team = ( rand() % 10000 ) + 5000;
|
||||||
|
|
||||||
// ************* SPEAKER ***************
|
// ************* SPEAKER ***************
|
||||||
sprintf( buffer, "t%i_1", team );
|
snprintf( buffer, sizeof( buffer ), "t%i_1", team );
|
||||||
|
|
||||||
// trigger for speaker
|
// trigger for speaker
|
||||||
vec3_t triggerVoiceBtm;
|
vec3_t triggerVoiceBtm;
|
||||||
|
@ -388,7 +388,7 @@ bool DShape::BuildPit( vec3_t min, vec3_t max ){
|
||||||
DEntity* targetVoice = m_Container.AddEntity( "target_speaker" );
|
DEntity* targetVoice = m_Container.AddEntity( "target_speaker" );
|
||||||
targetVoice->AddEPair( "targetname", buffer );
|
targetVoice->AddEPair( "targetname", buffer );
|
||||||
|
|
||||||
sprintf( buffer, "%f %f %f", voiceOrigin[0], voiceOrigin[1], voiceOrigin[2] );
|
snprintf( buffer, sizeof( buffer ), "%f %f %f", voiceOrigin[0], voiceOrigin[1], voiceOrigin[2] );
|
||||||
targetVoice->AddEPair( "origin", buffer );
|
targetVoice->AddEPair( "origin", buffer );
|
||||||
targetVoice->AddEPair( "spawnflags", "8" );
|
targetVoice->AddEPair( "spawnflags", "8" );
|
||||||
targetVoice->AddEPair( "noise", "*falling1.wav" );
|
targetVoice->AddEPair( "noise", "*falling1.wav" );
|
||||||
|
@ -397,7 +397,7 @@ bool DShape::BuildPit( vec3_t min, vec3_t max ){
|
||||||
// *********** END SPEAKER *************
|
// *********** END SPEAKER *************
|
||||||
|
|
||||||
// ********* POWERUP REMOVAL ***********
|
// ********* POWERUP REMOVAL ***********
|
||||||
sprintf( buffer, "t%i_2", team );
|
snprintf( buffer, sizeof( buffer ), "t%i_2", team );
|
||||||
|
|
||||||
// trigger for powerup removal
|
// trigger for powerup removal
|
||||||
vec3_t triggerPwrRmvTop, triggerPwrRmvBtm;
|
vec3_t triggerPwrRmvTop, triggerPwrRmvBtm;
|
||||||
|
@ -420,7 +420,7 @@ bool DShape::BuildPit( vec3_t min, vec3_t max ){
|
||||||
DEntity* targetPwrRmv = m_Container.AddEntity( "target_remove_powerups" );
|
DEntity* targetPwrRmv = m_Container.AddEntity( "target_remove_powerups" );
|
||||||
targetPwrRmv->AddEPair( "targetname", buffer );
|
targetPwrRmv->AddEPair( "targetname", buffer );
|
||||||
|
|
||||||
sprintf( buffer, "%f %f %f", pwrRmvOrigin[0], pwrRmvOrigin[1], pwrRmvOrigin[2] );
|
snprintf( buffer, sizeof( buffer ), "%f %f %f", pwrRmvOrigin[0], pwrRmvOrigin[1], pwrRmvOrigin[2] );
|
||||||
targetPwrRmv->AddEPair( "origin", buffer );
|
targetPwrRmv->AddEPair( "origin", buffer );
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ void DTrainDrawer::Draw2D( VIEWTYPE vt ) {
|
||||||
|
|
||||||
void AddSplineControl( const char* control, splinePoint_t* pSP ) {
|
void AddSplineControl( const char* control, splinePoint_t* pSP ) {
|
||||||
controlPoint_t cp;
|
controlPoint_t cp;
|
||||||
strncpy( cp.strName, control, 64 );
|
Q_strncpyz( cp.strName, control, sizeof( cp.strName ) );
|
||||||
|
|
||||||
pSP->m_pointList.push_front( cp );
|
pSP->m_pointList.push_front( cp );
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,8 @@ void DTrainDrawer::BuildPaths() {
|
||||||
AddSplineControl( control, pSP );
|
AddSplineControl( control, pSP );
|
||||||
|
|
||||||
for ( int j = 2;; j++ ) {
|
for ( int j = 2;; j++ ) {
|
||||||
char buffer[16];
|
char buffer[32];
|
||||||
sprintf( buffer, "control%i", j );
|
snprintf( buffer, sizeof( buffer ), "control%i", j );
|
||||||
|
|
||||||
e.SpawnString( buffer, NULL, &control );
|
e.SpawnString( buffer, NULL, &control );
|
||||||
if ( !control ) {
|
if ( !control ) {
|
||||||
|
@ -324,7 +324,7 @@ void DTrainDrawer::BuildPaths() {
|
||||||
void DTrainDrawer::AddControlPoint( const char* name, vec_t* origin ){
|
void DTrainDrawer::AddControlPoint( const char* name, vec_t* origin ){
|
||||||
controlPoint_t* pCP = new controlPoint_t;
|
controlPoint_t* pCP = new controlPoint_t;
|
||||||
|
|
||||||
strncpy( pCP->strName, name, 64 );
|
Q_strncpyz( pCP->strName, name, sizeof( pCP->strName ) );
|
||||||
VectorCopy( origin, pCP->vOrigin );
|
VectorCopy( origin, pCP->vOrigin );
|
||||||
|
|
||||||
m_pointList.push_back( pCP );
|
m_pointList.push_back( pCP );
|
||||||
|
@ -333,8 +333,8 @@ void DTrainDrawer::AddControlPoint( const char* name, vec_t* origin ){
|
||||||
splinePoint_t* DTrainDrawer::AddSplinePoint( const char* name, const char* target, vec_t* origin ){
|
splinePoint_t* DTrainDrawer::AddSplinePoint( const char* name, const char* target, vec_t* origin ){
|
||||||
splinePoint_t* pSP = new splinePoint_t;
|
splinePoint_t* pSP = new splinePoint_t;
|
||||||
|
|
||||||
strncpy( pSP->point.strName, name, 64 );
|
Q_strncpyz( pSP->point.strName, name, sizeof( pSP->point.strName ) );
|
||||||
strncpy( pSP->strTarget, target, 64 );
|
Q_strncpyz( pSP->strTarget, target, sizeof( pSP->strTarget ) );
|
||||||
VectorCopy( origin, pSP->point.vOrigin );
|
VectorCopy( origin, pSP->point.vOrigin );
|
||||||
m_splineList.push_back( pSP );
|
m_splineList.push_back( pSP );
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ bool DTreePlanter::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y ) {
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
DEntity e( m_entType );
|
DEntity e( m_entType );
|
||||||
|
|
||||||
sprintf( buffer, "%i %i %i", (int)vhit[0], (int)vhit[1], (int)vhit[2] );
|
snprintf( buffer, sizeof( buffer ), "%i %i %i", (int)vhit[0], (int)vhit[1], (int)vhit[2] );
|
||||||
e.AddEPair( "origin", buffer );
|
e.AddEPair( "origin", buffer );
|
||||||
|
|
||||||
if ( m_autoLink ) {
|
if ( m_autoLink ) {
|
||||||
|
@ -56,7 +56,7 @@ bool DTreePlanter::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y ) {
|
||||||
|
|
||||||
int entNum = -1, lastEntNum = -1, entpos;
|
int entNum = -1, lastEntNum = -1, entpos;
|
||||||
for ( int i = 0; i < 256; i++ ) {
|
for ( int i = 0; i < 256; i++ ) {
|
||||||
sprintf( buffer, m_linkName, i );
|
snprintf( buffer, sizeof( buffer ), m_linkName, i );
|
||||||
pThisEntity = FindEntityFromTargetname( buffer, &entNum );
|
pThisEntity = FindEntityFromTargetname( buffer, &entNum );
|
||||||
|
|
||||||
if ( pThisEntity ) {
|
if ( pThisEntity ) {
|
||||||
|
@ -67,10 +67,10 @@ bool DTreePlanter::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !pLastEntity ) {
|
if ( !pLastEntity ) {
|
||||||
sprintf( buffer, m_linkName, 0 );
|
snprintf( buffer, sizeof( buffer ), m_linkName, 0 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf( buffer, m_linkName, entpos + 1 );
|
snprintf( buffer, sizeof( buffer ), m_linkName, entpos + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
e.AddEPair( "targetname", buffer );
|
e.AddEPair( "targetname", buffer );
|
||||||
|
@ -88,7 +88,7 @@ bool DTreePlanter::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y ) {
|
||||||
int angleYaw = ( rand() % ( m_maxYaw - m_minYaw + 1 ) ) + m_minYaw;
|
int angleYaw = ( rand() % ( m_maxYaw - m_minYaw + 1 ) ) + m_minYaw;
|
||||||
int anglePitch = ( rand() % ( m_maxPitch - m_minPitch + 1 ) ) + m_minPitch;
|
int anglePitch = ( rand() % ( m_maxPitch - m_minPitch + 1 ) ) + m_minPitch;
|
||||||
|
|
||||||
sprintf( buffer, "%i %i 0", anglePitch, angleYaw );
|
snprintf( buffer, sizeof( buffer ), "%i %i 0", anglePitch, angleYaw );
|
||||||
e.AddEPair( "angles", buffer );
|
e.AddEPair( "angles", buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ bool DTreePlanter::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y ) {
|
||||||
if ( m_useScale ) {
|
if ( m_useScale ) {
|
||||||
float scale = ( ( ( rand() % 1000 ) * 0.001f ) * ( m_maxScale - m_minScale ) ) + m_minScale;
|
float scale = ( ( ( rand() % 1000 ) * 0.001f ) * ( m_maxScale - m_minScale ) ) + m_minScale;
|
||||||
|
|
||||||
sprintf( buffer, "%f", scale );
|
snprintf( buffer, sizeof( buffer ), "%f", scale );
|
||||||
e.AddEPair( "modelscale", buffer );
|
e.AddEPair( "modelscale", buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ void DTreePlanter::DropEntsToGround( void ) {
|
||||||
FindDropPoint( vec, out );
|
FindDropPoint( vec, out );
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf( buffer, "%f %f %f", out[0], out[1], out[2] );
|
snprintf( buffer, sizeof( buffer ), "%f %f %f", out[0], out[1], out[2] );
|
||||||
ent.AddEPair( "origin", buffer );
|
ent.AddEPair( "origin", buffer );
|
||||||
ent.RemoveFromRadiant();
|
ent.RemoveFromRadiant();
|
||||||
ent.BuildInRadiant( FALSE );
|
ent.BuildInRadiant( FALSE );
|
||||||
|
@ -221,17 +221,17 @@ void DTreePlanter::MakeChain( void ) {
|
||||||
for ( i = 0; i < m_linkNum; i++ ) {
|
for ( i = 0; i < m_linkNum; i++ ) {
|
||||||
DEntity e( "info_train_spline_main" );
|
DEntity e( "info_train_spline_main" );
|
||||||
|
|
||||||
sprintf( buffer, "%s_pt%i", m_linkName, i );
|
snprintf( buffer, sizeof( buffer ), "%s_pt%i", m_linkName, i );
|
||||||
e.AddEPair( "targetname", buffer );
|
e.AddEPair( "targetname", buffer );
|
||||||
|
|
||||||
sprintf( buffer, "0 %i 0", i * 64 );
|
snprintf( buffer, sizeof( buffer ), "0 %i 0", i * 64 );
|
||||||
e.AddEPair( "origin", buffer );
|
e.AddEPair( "origin", buffer );
|
||||||
|
|
||||||
if ( i != m_linkNum - 1 ) {
|
if ( i != m_linkNum - 1 ) {
|
||||||
sprintf( buffer, "%s_pt%i", m_linkName, i + 1 );
|
snprintf( buffer, sizeof( buffer ), "%s_pt%i", m_linkName, i + 1 );
|
||||||
e.AddEPair( "target", buffer );
|
e.AddEPair( "target", buffer );
|
||||||
|
|
||||||
sprintf( buffer, "%s_ctl%i", m_linkName, i );
|
snprintf( buffer, sizeof( buffer ), "%s_ctl%i", m_linkName, i );
|
||||||
e.AddEPair( "control", buffer );
|
e.AddEPair( "control", buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +241,10 @@ void DTreePlanter::MakeChain( void ) {
|
||||||
for ( i = 0; i < m_linkNum - 1; i++ ) {
|
for ( i = 0; i < m_linkNum - 1; i++ ) {
|
||||||
DEntity e( "info_train_spline_control" );
|
DEntity e( "info_train_spline_control" );
|
||||||
|
|
||||||
sprintf( buffer, "%s_ctl%i", m_linkName, i );
|
snprintf( buffer, sizeof( buffer ), "%s_ctl%i", m_linkName, i );
|
||||||
e.AddEPair( "targetname", buffer );
|
e.AddEPair( "targetname", buffer );
|
||||||
|
|
||||||
sprintf( buffer, "0 %i 0", ( i * 64 ) + 32 );
|
snprintf( buffer, sizeof( buffer ), "0 %i 0", ( i * 64 ) + 32 );
|
||||||
e.AddEPair( "origin", buffer );
|
e.AddEPair( "origin", buffer );
|
||||||
|
|
||||||
e.BuildInRadiant( FALSE );
|
e.BuildInRadiant( FALSE );
|
||||||
|
|
|
@ -66,7 +66,7 @@ DTreePlanter() {
|
||||||
m_world.LoadSelectedBrushes();
|
m_world.LoadSelectedBrushes();
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
GetFilename( buffer, "bt/tp_ent.txt" );
|
GetFilename( buffer, "bt/tp_ent.txt", sizeof( buffer ) );
|
||||||
|
|
||||||
FILE* file = fopen( buffer, "rb" );
|
FILE* file = fopen( buffer, "rb" );
|
||||||
if ( file ) {
|
if ( file ) {
|
||||||
|
|
|
@ -287,11 +287,11 @@ const char* CSynapseClientBobtoolz::GetInfo(){
|
||||||
return "bobToolz module built " __DATE__ " " RADIANT_VERSION;
|
return "bobToolz module built " __DATE__ " " RADIANT_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* GetFilename( char* buffer, const char* filename ) {
|
char* GetFilename( char* buffer, const char* filename, size_t length ) {
|
||||||
strcpy( buffer, g_pSynapseServer->GetModuleFilename( &g_SynapseClient ) );
|
Q_strncpyz( buffer, g_pSynapseServer->GetModuleFilename( &g_SynapseClient ), length );
|
||||||
StripFilename( buffer );
|
StripFilename( buffer );
|
||||||
strcat( buffer, "/" );
|
strncat( buffer, "/", length );
|
||||||
strcat( buffer, filename );
|
strncat( buffer, filename, length );
|
||||||
buffer = UnixToDosPath( buffer );
|
buffer = UnixToDosPath( buffer );
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ bool ValidateTextFloat( const char* pData, const char* error_title, float* value
|
||||||
|
|
||||||
bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
|
bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
|
||||||
char error_buffer[256];
|
char error_buffer[256];
|
||||||
sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
|
snprintf( error_buffer, sizeof( error_buffer ), "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
|
||||||
|
|
||||||
if ( pData ) {
|
if ( pData ) {
|
||||||
float testNum = (float)atof( pData );
|
float testNum = (float)atof( pData );
|
||||||
|
@ -152,7 +152,7 @@ bool ValidateTextFloatRange( const char* pData, float min, float max, const char
|
||||||
|
|
||||||
bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){
|
bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){
|
||||||
char error_buffer[256];
|
char error_buffer[256];
|
||||||
sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max );
|
snprintf( error_buffer, sizeof( error_buffer ), "Please Enter An Integer Between %i and %i", min, max );
|
||||||
|
|
||||||
if ( pData ) {
|
if ( pData ) {
|
||||||
int testNum = atoi( pData );
|
int testNum = atoi( pData );
|
||||||
|
@ -793,8 +793,8 @@ int DoBuildStairsBox( BuildStairsRS* rs ){
|
||||||
if ( ret == IDOK ) {
|
if ( ret == IDOK ) {
|
||||||
rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)checkUseDetail ) ? true : false;
|
rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)checkUseDetail ) ? true : false;
|
||||||
|
|
||||||
strcpy( rs->riserTexture, gtk_entry_get_text( (GtkEntry*)textRiserTex ) );
|
Q_strncpyz( rs->riserTexture, gtk_entry_get_text( (GtkEntry*)textRiserTex ), sizeof( rs->riserTexture ) );
|
||||||
strcpy( rs->mainTexture, gtk_entry_get_text( (GtkEntry*)textMainTex ) );
|
Q_strncpyz( rs->mainTexture, gtk_entry_get_text( (GtkEntry*)textMainTex ), sizeof( rs->mainTexture ) );
|
||||||
|
|
||||||
if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioNorth ) ) {
|
if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioNorth ) ) {
|
||||||
rs->direction = MOVE_NORTH;
|
rs->direction = MOVE_NORTH;
|
||||||
|
@ -864,8 +864,8 @@ int DoDoorsBox( DoorRS* rs ){
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
GList *listMainTextures = NULL;
|
GList *listMainTextures = NULL;
|
||||||
GList *listTrimTextures = NULL;
|
GList *listTrimTextures = NULL;
|
||||||
LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), &listMainTextures );
|
LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt", sizeof( buffer ) ), &listMainTextures );
|
||||||
LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), &listTrimTextures );
|
LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt", sizeof( buffer ) ), &listTrimTextures );
|
||||||
|
|
||||||
vbox = gtk_vbox_new( FALSE, 10 );
|
vbox = gtk_vbox_new( FALSE, 10 );
|
||||||
gtk_container_add( GTK_CONTAINER( window ), vbox );
|
gtk_container_add( GTK_CONTAINER( window ), vbox );
|
||||||
|
@ -1031,8 +1031,8 @@ int DoDoorsBox( DoorRS* rs ){
|
||||||
while ( loop )
|
while ( loop )
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
|
|
||||||
strcpy( rs->mainTexture, gtk_entry_get_text( GTK_ENTRY( textFrontBackTex ) ) );
|
Q_strncpyz( rs->mainTexture, gtk_entry_get_text( GTK_ENTRY( textFrontBackTex ) ), sizeof( rs->mainTexture ) );
|
||||||
strcpy( rs->trimTexture, gtk_entry_get_text( GTK_ENTRY( textTrimTex ) ) );
|
Q_strncpyz( rs->trimTexture, gtk_entry_get_text( GTK_ENTRY( textTrimTex ) ), sizeof( rs->trimTexture ) );
|
||||||
|
|
||||||
rs->bScaleMainH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainH ) ) ? true : false;
|
rs->bScaleMainH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainH ) ) ? true : false;
|
||||||
rs->bScaleMainV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainV ) ) ? true : false;
|
rs->bScaleMainV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainV ) ) ? true : false;
|
||||||
|
@ -1614,8 +1614,8 @@ int DoResetTextureBox( ResetTextureRS* rs ){
|
||||||
|
|
||||||
rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
|
rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
|
||||||
if ( rs->bResetTextureName ) {
|
if ( rs->bResetTextureName ) {
|
||||||
strcpy( rs->textureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexOld ) ) );
|
Q_strncpyz( rs->textureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexOld ) ), sizeof( rs->textureName ) );
|
||||||
strcpy( rs->newTextureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexNew ) ) );
|
Q_strncpyz( rs->newTextureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexNew ) ), sizeof( rs->newTextureName ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,13 +55,13 @@ DTreePlanter* g_TreePlanter = NULL;
|
||||||
//========================//
|
//========================//
|
||||||
|
|
||||||
void LoadLists(){
|
void LoadLists(){
|
||||||
char buffer[256];
|
char buffer[PATH_MAX];
|
||||||
|
|
||||||
if ( !el1Loaded ) {
|
if ( !el1Loaded ) {
|
||||||
el1Loaded = LoadExclusionList( GetFilename( buffer, "bt/bt-el1.txt" ), &exclusionList );
|
el1Loaded = LoadExclusionList( GetFilename( buffer, "bt/bt-el1.txt", sizeof( buffer ) ), &exclusionList );
|
||||||
}
|
}
|
||||||
if ( !el2Loaded ) {
|
if ( !el2Loaded ) {
|
||||||
el2Loaded = LoadExclusionList( GetFilename( buffer, "bt/bt-el2.txt" ), &exclusionList_Face );
|
el2Loaded = LoadExclusionList( GetFilename( buffer, "bt/bt-el2.txt", sizeof( buffer ) ), &exclusionList_Face );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ void DoResetTextures(){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texName = GetCurrentTexture();
|
texName = GetCurrentTexture();
|
||||||
strcpy( rs.textureName, GetCurrentTexture() );
|
Q_strncpyz( rs.textureName, GetCurrentTexture(), sizeof( rs.textureName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -216,7 +216,7 @@ void DoResetTextures(){
|
||||||
void DoBuildStairs( vec3_t vMin, vec3_t vMax ){
|
void DoBuildStairs( vec3_t vMin, vec3_t vMax ){
|
||||||
BuildStairsRS rs;
|
BuildStairsRS rs;
|
||||||
|
|
||||||
strcpy( rs.mainTexture, GetCurrentTexture() );
|
Q_strncpyz( rs.mainTexture, GetCurrentTexture(), sizeof( rs.mainTexture ) );
|
||||||
|
|
||||||
// ensure we have something selected
|
// ensure we have something selected
|
||||||
if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
|
if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
|
||||||
|
@ -319,7 +319,7 @@ void DoBuildDoors( vec3_t vMin, vec3_t vMax ){
|
||||||
// cant release until we delete the brush, if we do...
|
// cant release until we delete the brush, if we do...
|
||||||
|
|
||||||
DoorRS rs;
|
DoorRS rs;
|
||||||
strcpy( rs.mainTexture, GetCurrentTexture() );
|
Q_strncpyz( rs.mainTexture, GetCurrentTexture(), sizeof( rs.mainTexture ) );
|
||||||
|
|
||||||
if ( DoDoorsBox( &rs ) == IDOK ) {
|
if ( DoDoorsBox( &rs ) == IDOK ) {
|
||||||
g_FuncTable.m_pfnDeleteBrushHandle( brush );
|
g_FuncTable.m_pfnDeleteBrushHandle( brush );
|
||||||
|
@ -554,7 +554,7 @@ void DoVisAnalyse(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( filename, rad_filename );
|
Q_strncpyz( filename, rad_filename, sizeof( filename ) );
|
||||||
|
|
||||||
char* ext = strrchr( filename, '.' ) + 1;
|
char* ext = strrchr( filename, '.' ) + 1;
|
||||||
strcpy( ext, "bsp" ); // rename the extension
|
strcpy( ext, "bsp" ); // rename the extension
|
||||||
|
|
|
@ -39,7 +39,7 @@ char g_CurrentTexture[256] = "";
|
||||||
|
|
||||||
void ReadCurrentTexture(){
|
void ReadCurrentTexture(){
|
||||||
const char* textureName = g_FuncTable.m_pfnGetCurrentTexture();
|
const char* textureName = g_FuncTable.m_pfnGetCurrentTexture();
|
||||||
strcpy( g_CurrentTexture, textureName );
|
Q_strncpyz( g_CurrentTexture, textureName, sizeof( g_CurrentTexture ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetCurrentTexture(){
|
const char* GetCurrentTexture(){
|
||||||
|
@ -140,7 +140,7 @@ void Sys_ERROR( const char* text, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,text );
|
va_start( argptr,text );
|
||||||
vsprintf( buf, text,argptr );
|
vsnprintf( buf, sizeof( buf ), text, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_FPrintf( SYS_ERR, "BobToolz::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "BobToolz::ERROR->%s", buf );
|
||||||
|
@ -152,7 +152,7 @@ void Sys_ERROR( const char* text, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start (argptr,text);
|
va_start (argptr,text);
|
||||||
vsprintf (buf, text,argptr);
|
vsnprintf (buf, sizeof( buf ), text, argptr);
|
||||||
va_end (argptr);
|
va_end (argptr);
|
||||||
|
|
||||||
g_FuncTable.m_pfnSysMsg ( buf );
|
g_FuncTable.m_pfnSysMsg ( buf );
|
||||||
|
@ -248,19 +248,19 @@ bool Q_Exec( const char *pCmd, bool bCreateConsole ){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void StartBSP(){
|
void StartBSP(){
|
||||||
char exename[256];
|
char exename[PATH_MAX];
|
||||||
GetFilename( exename, "q3map" );
|
GetFilename( exename, "q3map", sizeof( exename ) );
|
||||||
UnixToDosPath( exename ); // do we want this done in linux version?
|
UnixToDosPath( exename ); // do we want this done in linux version?
|
||||||
|
|
||||||
char mapname[256];
|
char mapname[256];
|
||||||
const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" );
|
const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" );
|
||||||
|
|
||||||
strcpy( mapname, pn );
|
Q_strncpyz( mapname, pn, sizeof( mapname ) );
|
||||||
strcat( mapname, "/ac_prt.map" );
|
strncat( mapname, "/ac_prt.map", sizeof( mapname ) );
|
||||||
UnixToDosPath( mapname );
|
UnixToDosPath( mapname );
|
||||||
|
|
||||||
char command[1024];
|
char command[1024];
|
||||||
sprintf( command, "%s -nowater -fulldetail %s", exename, mapname );
|
snprintf( command, sizeof( command ), "%s -nowater -fulldetail %s", exename, mapname );
|
||||||
|
|
||||||
Q_Exec( command, TRUE );
|
Q_Exec( command, TRUE );
|
||||||
}
|
}
|
||||||
|
@ -272,11 +272,11 @@ void BuildMiniPrt( list<Str>* exclusionList ){
|
||||||
|
|
||||||
DEntity world;
|
DEntity world;
|
||||||
|
|
||||||
char buffer[128];
|
char buffer[PATH_MAX];
|
||||||
const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" );
|
const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" );
|
||||||
|
|
||||||
strcpy( buffer, pn );
|
Q_strncpyz( buffer, pn, sizeof( buffer ) );
|
||||||
strcat( buffer, "/ac_prt.map" );
|
strncat( buffer, "/ac_prt.map", sizeof( buffer ) );
|
||||||
FILE* pFile = fopen( buffer, "w" );
|
FILE* pFile = fopen( buffer, "w" );
|
||||||
|
|
||||||
// ahem, thx rr2
|
// ahem, thx rr2
|
||||||
|
@ -354,7 +354,7 @@ void FillDefaultTexture( _QERFaceData* faceData, vec3_t va, vec3_t vb, vec3_t vc
|
||||||
faceData->m_nFlags = 0;
|
faceData->m_nFlags = 0;
|
||||||
faceData->m_nValue = 0;
|
faceData->m_nValue = 0;
|
||||||
if ( *texture ) {
|
if ( *texture ) {
|
||||||
strcpy( faceData->m_TextureName, texture );
|
Q_strncpyz( faceData->m_TextureName, texture, sizeof( faceData->m_TextureName ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( faceData->m_TextureName, "textures/common/caulk" );
|
strcpy( faceData->m_TextureName, "textures/common/caulk" );
|
||||||
|
|
|
@ -37,7 +37,7 @@ entity_s* FindEntityFromTargetname( const char* targetname, int* entNum );
|
||||||
|
|
||||||
char* UnixToDosPath( char* path );
|
char* UnixToDosPath( char* path );
|
||||||
|
|
||||||
char* GetFilename( char* buffer, const char* filename );
|
char* GetFilename( char* buffer, const char* filename, size_t length );
|
||||||
char* GetGameFilename( char* buffer, const char* filename );
|
char* GetGameFilename( char* buffer, const char* filename );
|
||||||
|
|
||||||
float Determinant3x3( float a1, float a2, float a3,
|
float Determinant3x3( float a1, float a2, float a3,
|
||||||
|
|
|
@ -574,7 +574,7 @@ void BuildDoorsX2( vec3_t min, vec3_t max,
|
||||||
srand( (unsigned)time( NULL ) );
|
srand( (unsigned)time( NULL ) );
|
||||||
|
|
||||||
char teamname[256];
|
char teamname[256];
|
||||||
sprintf( teamname, "t%i", rand() );
|
snprintf( teamname, sizeof( teamname ), "t%i", rand() );
|
||||||
/*epair_t* epDoor13 = */ GetNextChainItem( epDoor12, "team", teamname );
|
/*epair_t* epDoor13 = */ GetNextChainItem( epDoor12, "team", teamname );
|
||||||
/*epair_t* epDoor23 = */ GetNextChainItem( epDoor22, "team", teamname );
|
/*epair_t* epDoor23 = */ GetNextChainItem( epDoor22, "team", teamname );
|
||||||
|
|
||||||
|
|
|
@ -220,10 +220,10 @@ static gint ci_apply( GtkWidget *widget, gpointer data ){
|
||||||
GetCurrentCam()->GetCam()->buildCamera();
|
GetCurrentCam()->GetCam()->buildCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getBaseTime() );
|
snprintf( buf, sizeof( buf ), "%.2f", GetCurrentCam()->GetCam()->getBaseTime() );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_pSecondsEntry ), buf );
|
gtk_entry_set_text( GTK_ENTRY( g_pSecondsEntry ), buf );
|
||||||
|
|
||||||
sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
snprintf( buf, sizeof( buf ), "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
||||||
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
||||||
gtk_label_set_text( g_pTotalTime, buf );
|
gtk_label_set_text( g_pTotalTime, buf );
|
||||||
|
|
||||||
|
@ -336,14 +336,14 @@ static void RefreshEventList( void ){
|
||||||
for ( i = 0; i < GetCurrentCam()->GetCam()->numEvents(); i++ ) {
|
for ( i = 0; i < GetCurrentCam()->GetCam()->numEvents(); i++ ) {
|
||||||
char rowbuf[3][128], *row[3];
|
char rowbuf[3][128], *row[3];
|
||||||
// FIXME: sort by time?
|
// FIXME: sort by time?
|
||||||
sprintf( rowbuf[0], "%li", GetCurrentCam()->GetCam()->getEvent( i )->getTime() ); row[0] = rowbuf[0];
|
snprintf( rowbuf[0], sizeof( rowbuf[0] ), "%li", GetCurrentCam()->GetCam()->getEvent( i )->getTime() ); row[0] = rowbuf[0];
|
||||||
strncpy( rowbuf[1], GetCurrentCam()->GetCam()->getEvent( i )->typeStr(), sizeof( rowbuf[0] ) ); row[1] = rowbuf[1];
|
Q_strncpyz( rowbuf[1], GetCurrentCam()->GetCam()->getEvent( i )->typeStr(), sizeof( rowbuf[0] ) ); row[1] = rowbuf[1];
|
||||||
strncpy( rowbuf[2], GetCurrentCam()->GetCam()->getEvent( i )->getParam(), sizeof( rowbuf[1] ) ); row[2] = rowbuf[2];
|
Q_strncpyz( rowbuf[2], GetCurrentCam()->GetCam()->getEvent( i )->getParam(), sizeof( rowbuf[1] ) ); row[2] = rowbuf[2];
|
||||||
gtk_clist_append( GTK_CLIST( g_pEventsList ), row );
|
gtk_clist_append( GTK_CLIST( g_pEventsList ), row );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total duration might have changed
|
// Total duration might have changed
|
||||||
sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
snprintf( buf, sizeof( buf ), "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
||||||
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
||||||
gtk_label_set_text( g_pTotalTime, buf );
|
gtk_label_set_text( g_pTotalTime, buf );
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
|
||||||
gtk_box_pack_start( GTK_BOX( hbox ), name, TRUE, TRUE, 0 );
|
gtk_box_pack_start( GTK_BOX( hbox ), name, TRUE, TRUE, 0 );
|
||||||
gtk_widget_show( name );
|
gtk_widget_show( name );
|
||||||
|
|
||||||
sprintf( buf, "target%i", GetCurrentCam()->GetCam()->numTargets() + 1 );
|
snprintf( buf, sizeof( buf ), "target%i", GetCurrentCam()->GetCam()->numTargets() + 1 );
|
||||||
gtk_entry_set_text( GTK_ENTRY( name ), buf );
|
gtk_entry_set_text( GTK_ENTRY( name ), buf );
|
||||||
|
|
||||||
// -------------------------- //
|
// -------------------------- //
|
||||||
|
@ -721,10 +721,10 @@ static gint ci_camlist_changed( GtkWidget *widget, gpointer data ){
|
||||||
gtk_label_set_text( g_pCamType, GetCurrentCam()->GetCam()->getPositionObj()->typeStr() );
|
gtk_label_set_text( g_pCamType, GetCurrentCam()->GetCam()->getPositionObj()->typeStr() );
|
||||||
|
|
||||||
// Set duration
|
// Set duration
|
||||||
sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getBaseTime() );
|
snprintf( buf, sizeof( buf ), "%.2f", GetCurrentCam()->GetCam()->getBaseTime() );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_pSecondsEntry ), buf );
|
gtk_entry_set_text( GTK_ENTRY( g_pSecondsEntry ), buf );
|
||||||
|
|
||||||
sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
snprintf( buf, sizeof( buf ), "%.2f", GetCurrentCam()->GetCam()->getTotalTime() );
|
||||||
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
gtk_label_set_text( g_pCurrentTime, "0.00" );
|
||||||
gtk_label_set_text( g_pTotalTime, buf );
|
gtk_label_set_text( g_pTotalTime, buf );
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,13 @@ static void DoNewCamera( idCameraPosition::positionType type ){
|
||||||
|
|
||||||
if ( cam ) {
|
if ( cam ) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
sprintf( buf, "camera%i", cam->GetCamNum() );
|
snprintf( buf, sizeof( buf ), "camera%i", cam->GetCamNum() );
|
||||||
|
|
||||||
cam->GetCam()->startNewCamera( type );
|
cam->GetCam()->startNewCamera( type );
|
||||||
cam->GetCam()->setName( buf );
|
cam->GetCam()->setName( buf );
|
||||||
cam->GetCam()->buildCamera();
|
cam->GetCam()->buildCamera();
|
||||||
|
|
||||||
sprintf( buf, "Unsaved Camera %i", cam->GetCamNum() );
|
snprintf( buf, sizeof( buf ), "Unsaved Camera %i", cam->GetCamNum() );
|
||||||
cam->SetFileName( buf, false );
|
cam->SetFileName( buf, false );
|
||||||
|
|
||||||
SetCurrentCam( cam );
|
SetCurrentCam( cam );
|
||||||
|
@ -99,7 +99,7 @@ void DoLoadCamera(){
|
||||||
CAMERA_ExtractFilePath( firstCam->GetFileName(), basepath );
|
CAMERA_ExtractFilePath( firstCam->GetFileName(), basepath );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( basepath, g_FuncTable.m_pfnGetGamePath() );
|
Q_strncpyz( basepath, g_FuncTable.m_pfnGetGamePath(), sizeof( basepath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *filename = g_FuncTable.m_pfnFileDialog( (GtkWidget *)g_pRadiantWnd, TRUE, "Open Camera File", basepath, "camera", NULL );
|
const gchar *filename = g_FuncTable.m_pfnFileDialog( (GtkWidget *)g_pRadiantWnd, TRUE, "Open Camera File", basepath, "camera", NULL );
|
||||||
|
@ -117,7 +117,7 @@ void DoLoadCamera(){
|
||||||
if ( !strcmp( fullpathtofile, checkCam->GetFileName() ) ) {
|
if ( !strcmp( fullpathtofile, checkCam->GetFileName() ) ) {
|
||||||
char error[PATH_MAX + 64];
|
char error[PATH_MAX + 64];
|
||||||
FreeCam( cam );
|
FreeCam( cam );
|
||||||
sprintf( error, "Camera file \'%s\' is already loaded", fullpathtofile );
|
snprintf( error, sizeof( error ), "Camera file \'%s\' is already loaded", fullpathtofile );
|
||||||
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
|
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
|
||||||
//g_free( filename );
|
//g_free( filename );
|
||||||
return;
|
return;
|
||||||
|
@ -135,7 +135,7 @@ void DoLoadCamera(){
|
||||||
else {
|
else {
|
||||||
char error[PATH_MAX + 64];
|
char error[PATH_MAX + 64];
|
||||||
FreeCam( cam );
|
FreeCam( cam );
|
||||||
sprintf( error, "An error occured during the loading of \'%s\'", fullpathtofile );
|
snprintf( error, sizeof( error ), "An error occured during the loading of \'%s\'", fullpathtofile );
|
||||||
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
|
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void DoSaveCamera() {
|
||||||
CAMERA_ExtractFilePath( GetCurrentCam()->GetFileName(), basepath );
|
CAMERA_ExtractFilePath( GetCurrentCam()->GetFileName(), basepath );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( basepath, g_FuncTable.m_pfnGetGamePath() );
|
Q_strncpyz( basepath, g_FuncTable.m_pfnGetGamePath(), sizeof( basepath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *filename = g_FuncTable.m_pfnFileDialog( (void *)g_pRadiantWnd, FALSE, "Save Camera File", basepath, "camera", NULL );
|
const gchar *filename = g_FuncTable.m_pfnFileDialog( (void *)g_pRadiantWnd, FALSE, "Save Camera File", basepath, "camera", NULL );
|
||||||
|
@ -171,7 +171,7 @@ void DoSaveCamera() {
|
||||||
// File dialog from windows (and maybe the gtk one from radiant) doesn't handle default extensions properly.
|
// File dialog from windows (and maybe the gtk one from radiant) doesn't handle default extensions properly.
|
||||||
// Add extension and check again if file exists
|
// Add extension and check again if file exists
|
||||||
if ( strcmp( fullpathtofile + ( strlen( fullpathtofile ) - 7 ), ".camera" ) ) {
|
if ( strcmp( fullpathtofile + ( strlen( fullpathtofile ) - 7 ), ".camera" ) ) {
|
||||||
strcat( fullpathtofile, ".camera" );
|
strncat( fullpathtofile, ".camera", sizeof( fullpathtofile ) );
|
||||||
|
|
||||||
if ( FileExists( fullpathtofile ) ) {
|
if ( FileExists( fullpathtofile ) ) {
|
||||||
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, "File already exists.\nOverwrite?", "Save Camera File", MB_YESNO, NULL ) == IDNO ) {
|
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, "File already exists.\nOverwrite?", "Save Camera File", MB_YESNO, NULL ) == IDNO ) {
|
||||||
|
@ -191,7 +191,7 @@ void DoSaveCamera() {
|
||||||
}
|
}
|
||||||
else if ( !strcmp( fullpathtofile, checkCam->GetFileName() ) ) {
|
else if ( !strcmp( fullpathtofile, checkCam->GetFileName() ) ) {
|
||||||
char error[PATH_MAX + 64];
|
char error[PATH_MAX + 64];
|
||||||
sprintf( error, "Camera file \'%s\' is currently loaded by GtkRadiant.\nPlease select a different filename.", fullpathtofile );
|
snprintf( error, sizeof( error ), "Camera file \'%s\' is currently loaded by GtkRadiant.\nPlease select a different filename.", fullpathtofile );
|
||||||
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Save error", MB_OK, NULL );
|
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Save error", MB_OK, NULL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -213,14 +213,14 @@ void DoUnloadCamera() {
|
||||||
|
|
||||||
if ( !GetCurrentCam()->HasBeenSaved() ) {
|
if ( !GetCurrentCam()->HasBeenSaved() ) {
|
||||||
char buf[PATH_MAX + 64];
|
char buf[PATH_MAX + 64];
|
||||||
sprintf( buf, "Do you want to save the changes for camera '%s'?", GetCurrentCam()->GetCam()->getName() );
|
snprintf( buf, sizeof( buf ), "Do you want to save the changes for camera '%s'?", GetCurrentCam()->GetCam()->getName() );
|
||||||
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, buf, "Warning", MB_YESNO, NULL ) == IDYES ) {
|
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, buf, "Warning", MB_YESNO, NULL ) == IDYES ) {
|
||||||
DoSaveCamera();
|
DoSaveCamera();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( GetCurrentCam()->HasBeenSaved() == 2 ) {
|
else if ( GetCurrentCam()->HasBeenSaved() == 2 ) {
|
||||||
char buf[PATH_MAX + 64];
|
char buf[PATH_MAX + 64];
|
||||||
sprintf( buf, "Do you want to save the changes made to camera file '%s'?", GetCurrentCam()->GetFileName() );
|
snprintf( buf, sizeof( buf ), "Do you want to save the changes made to camera file '%s'?", GetCurrentCam()->GetFileName() );
|
||||||
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, buf, "Warning", MB_YESNO, NULL ) == IDYES ) {
|
if ( g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, buf, "Warning", MB_YESNO, NULL ) == IDYES ) {
|
||||||
DoSaveCamera();
|
DoSaveCamera();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void Sys_ERROR( char* text, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,text );
|
va_start( argptr,text );
|
||||||
vsprintf( buf, text,argptr );
|
vsnprintf( buf, sizeof( buf ), text, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
||||||
|
@ -114,7 +114,7 @@ void CDECL Com_Error( int level, const char *error, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,error );
|
va_start( argptr,error );
|
||||||
vsprintf( buf, error,argptr );
|
vsnprintf( buf, sizeof( buf ), error, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
||||||
|
@ -125,7 +125,7 @@ void CDECL Com_Printf( const char* msg, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,msg );
|
va_start( argptr,msg );
|
||||||
vsprintf( buf, msg,argptr );
|
vsnprintf( buf, sizeof( buf ), msg, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_Printf( "Camera::%s", buf );
|
Sys_Printf( "Camera::%s", buf );
|
||||||
|
@ -137,7 +137,7 @@ void CDECL Com_DPrintf( const char* msg, ... ){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,msg );
|
va_start( argptr,msg );
|
||||||
vsprintf( buf, msg,argptr );
|
vsnprintf( buf, sizeof( buf ), msg, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_Printf( "Camera::%s", buf );
|
Sys_Printf( "Camera::%s", buf );
|
||||||
|
|
|
@ -442,7 +442,7 @@ bool OpenBitmap(){
|
||||||
g_print( "failed to load file gbmp %s\n",gbmp.name );
|
g_print( "failed to load file gbmp %s\n",gbmp.name );
|
||||||
char Text[256];
|
char Text[256];
|
||||||
|
|
||||||
sprintf( Text, "Error opening %s", gbmp.name );
|
snprintf( Text, sizeof( Text ), "Error opening %s", gbmp.name );
|
||||||
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "Bitmap", MB_ICONEXCLAMATION, NULL );
|
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "Bitmap", MB_ICONEXCLAMATION, NULL );
|
||||||
strcpy( gbmp.name, "" );
|
strcpy( gbmp.name, "" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1015,8 +1015,8 @@ void MakeBrushes( int NumTris, NODE *Node, TRI *Tri,bool surf,
|
||||||
|
|
||||||
for ( j = 0; j < 5; j++ )
|
for ( j = 0; j < 5; j++ )
|
||||||
{
|
{
|
||||||
strcpy( brush.face[j].texture,
|
Q_strncpyz( brush.face[j].texture,
|
||||||
( strlen( texture1 ) ? texture1 : texture0 ) );
|
( strlen( texture1 ) ? texture1 : texture0 ), sizeof( brush.face[j].texture ) );
|
||||||
brush.face[j].Shift[0] = (float)TexOffset[0];
|
brush.face[j].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[j].Shift[1] = (float)TexOffset[1];
|
brush.face[j].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[j].Rotate = 0.;
|
brush.face[j].Rotate = 0.;
|
||||||
|
@ -1038,14 +1038,14 @@ void MakeBrushes( int NumTris, NODE *Node, TRI *Tri,bool surf,
|
||||||
CrossProduct( t[0],t[1],SurfNormal );
|
CrossProduct( t[0],t[1],SurfNormal );
|
||||||
VectorNormalize( SurfNormal,SurfNormal );
|
VectorNormalize( SurfNormal,SurfNormal );
|
||||||
if ( DotProduct( SurfNormal,PlaneNormal ) < Steep ) {
|
if ( DotProduct( SurfNormal,PlaneNormal ) < Steep ) {
|
||||||
strcpy( brush.face[0].texture,texture2 );
|
Q_strncpyz( brush.face[0].texture, texture2, sizeof( brush.face[0].texture ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( brush.face[0].texture,texture0 );
|
Q_strncpyz( brush.face[0].texture, texture0, sizeof( brush.face[0].texture ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( brush.face[0].texture,texture0 );
|
Q_strncpyz( brush.face[0].texture, texture0, sizeof( brush.face[0].texture ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( surf ) {
|
if ( surf ) {
|
||||||
|
@ -1364,7 +1364,7 @@ void MapOut( int NumNodes,int NumTris, NODE *Node, TRI *Tri ){
|
||||||
} // switch (Plane)
|
} // switch (Plane)
|
||||||
for ( face = 0; face < 6; face++ )
|
for ( face = 0; face < 6; face++ )
|
||||||
{
|
{
|
||||||
strcpy( brush.face[face].texture,( face <= 1 ? skip : hint ) );
|
Q_strncpyz( brush.face[face].texture,( face <= 1 ? skip : hint ), sizeof( brush.face[face].texture ) );
|
||||||
brush.face[face].Shift[0] = 0;
|
brush.face[face].Shift[0] = 0;
|
||||||
brush.face[face].Shift[1] = 0;
|
brush.face[face].Shift[1] = 0;
|
||||||
brush.face[face].Rotate = 0.;
|
brush.face[face].Rotate = 0.;
|
||||||
|
|
|
@ -359,7 +359,7 @@ void UseFaceBounds(){
|
||||||
BestDot = Dot;
|
BestDot = Dot;
|
||||||
BestFace = i;
|
BestFace = i;
|
||||||
if ( strlen( QERFaceData->m_TextureName ) ) {
|
if ( strlen( QERFaceData->m_TextureName ) ) {
|
||||||
strcpy( Texture[Game][0],QERFaceData->m_TextureName );
|
Q_strncpyz( Texture[Game][0], QERFaceData->m_TextureName, sizeof( Texture[Game][0] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,8 +370,8 @@ void UseFaceBounds(){
|
||||||
}
|
}
|
||||||
QERFaceData = g_FuncTable.m_pfnGetFaceData( vp,i );
|
QERFaceData = g_FuncTable.m_pfnGetFaceData( vp,i );
|
||||||
if ( strlen( QERFaceData->m_TextureName ) ) {
|
if ( strlen( QERFaceData->m_TextureName ) ) {
|
||||||
if ( strcmp( Texture[Game][0],QERFaceData->m_TextureName ) ) {
|
if ( strcmp( Texture[Game][0], QERFaceData->m_TextureName ) ) {
|
||||||
strcpy( Texture[Game][1],QERFaceData->m_TextureName );
|
Q_strncpyz( Texture[Game][1], QERFaceData->m_TextureName, sizeof( Texture[Game][1] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,32 +281,32 @@ static void SetDlgValues( int tab ){
|
||||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( wave_radios[WaveType] ), TRUE );
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( wave_radios[WaveType] ), TRUE );
|
||||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "random" ) ),
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "random" ) ),
|
||||||
RandomSeed );
|
RandomSeed );
|
||||||
sprintf( Text, RForm, WaveLength );
|
snprintf( Text, sizeof( Text ), RForm, WaveLength );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "wavelength" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "wavelength" ) ), Text );
|
||||||
sprintf( Text, RForm, Amplitude );
|
snprintf( Text, sizeof( Text ), RForm, Amplitude );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "amplitude" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "amplitude" ) ), Text );
|
||||||
sprintf( Text, RForm, Roughness );
|
snprintf( Text, sizeof( Text ), RForm, Roughness );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "roughness" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "roughness" ) ), Text );
|
||||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_object_get_data
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_object_get_data
|
||||||
( G_OBJECT( g_pWnd ), "main_antialiasing" ) ), Antialiasing );
|
( G_OBJECT( g_pWnd ), "main_antialiasing" ) ), Antialiasing );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXTENTS_TAB:
|
case EXTENTS_TAB:
|
||||||
sprintf( Text,RForm,Hll );
|
snprintf( Text, sizeof( Text ), RForm, Hll );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "hmin" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "hmin" ) ), Text );
|
||||||
sprintf( Text,RForm,Vll );
|
snprintf( Text, sizeof( Text ), RForm, Vll );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "vmin" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "vmin" ) ), Text );
|
||||||
sprintf( Text,RForm,Hur );
|
snprintf( Text, sizeof( Text ), RForm, Hur );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "hmax" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "hmax" ) ), Text );
|
||||||
sprintf( Text,RForm,Vur );
|
snprintf( Text, sizeof( Text ), RForm, Vur );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "vmax" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "vmax" ) ), Text );
|
||||||
sprintf( Text,RForm,Z00 );
|
snprintf( Text, sizeof( Text ), RForm, Z00 );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z00" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z00" ) ), Text );
|
||||||
sprintf( Text,RForm,Z01 );
|
snprintf( Text, sizeof( Text ), RForm, Z01 );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z01" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z01" ) ), Text );
|
||||||
sprintf( Text,RForm,Z10 );
|
snprintf( Text, sizeof( Text ), RForm, Z10 );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z10" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z10" ) ), Text );
|
||||||
sprintf( Text,RForm,Z11 );
|
snprintf( Text, sizeof( Text ), RForm, Z11 );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z11" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "z11" ) ), Text );
|
||||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "nh" ) ), NH );
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "nh" ) ), NH );
|
||||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "nv" ) ), NV );
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "nv" ) ), NV );
|
||||||
|
@ -386,9 +386,9 @@ static void SetDlgValues( int tab ){
|
||||||
|
|
||||||
case BITMAP_TAB:
|
case BITMAP_TAB:
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), gbmp.name );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), gbmp.name );
|
||||||
sprintf( Text,"%g",gbmp.black_value );
|
snprintf( Text, sizeof( Text ), "%g", gbmp.black_value );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_black" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_black" ) ), Text );
|
||||||
sprintf( Text,"%g",gbmp.white_value );
|
snprintf( Text, sizeof( Text ), "%g", gbmp.white_value );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_white" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_white" ) ), Text );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -401,13 +401,13 @@ static void SetDlgValues( int tab ){
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texture3" ) ), Texture[Game][2] );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texture3" ) ), Texture[Game][2] );
|
||||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "tex_slant" ) ),
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "tex_slant" ) ),
|
||||||
SlantAngle );
|
SlantAngle );
|
||||||
sprintf( Text,RForm,TexOffset[0] );
|
snprintf( Text, sizeof( Text ), RForm, TexOffset[0] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texoffsetx" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texoffsetx" ) ), Text );
|
||||||
sprintf( Text,RForm,TexOffset[1] );
|
snprintf( Text, sizeof( Text ), RForm, TexOffset[1] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texoffsety" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texoffsety" ) ), Text );
|
||||||
sprintf( Text,RForm,TexScale[0] );
|
snprintf( Text, sizeof( Text ), RForm, TexScale[0] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texscalex" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texscalex" ) ), Text );
|
||||||
sprintf( Text,RForm,TexScale[1] );
|
snprintf( Text, sizeof( Text ), RForm, TexScale[1] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texscaley" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "texscaley" ) ), Text );
|
||||||
CHECK_WIDGET( "detail", UseDetail );
|
CHECK_WIDGET( "detail", UseDetail );
|
||||||
|
|
||||||
|
@ -727,14 +727,14 @@ static void main_go( GtkWidget *widget, gpointer data ){
|
||||||
|
|
||||||
ReadDlgValues( current_tab );
|
ReadDlgValues( current_tab );
|
||||||
if ( NH < 1 || NH > MAX_ROWS ) {
|
if ( NH < 1 || NH > MAX_ROWS ) {
|
||||||
sprintf( Text, "The number of divisions must be > 0 and no greater than %d.", MAX_ROWS );
|
snprintf( Text, sizeof( Text ), _( "The number of divisions must be > 0 and no greater than %d." ), MAX_ROWS );
|
||||||
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "GenSurf", MB_ICONEXCLAMATION, NULL );
|
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "GenSurf", MB_ICONEXCLAMATION, NULL );
|
||||||
gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB );
|
gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( NV < 1 || NV > MAX_ROWS ) {
|
if ( NV < 1 || NV > MAX_ROWS ) {
|
||||||
sprintf( Text, "The number of divisions must be > 0 and no greater than %d.", MAX_ROWS );
|
snprintf( Text, sizeof( Text ), _( "The number of divisions must be > 0 and no greater than %d." ), MAX_ROWS );
|
||||||
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "GenSurf", MB_ICONEXCLAMATION, NULL );
|
g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "GenSurf", MB_ICONEXCLAMATION, NULL );
|
||||||
gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB );
|
gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB );
|
||||||
return;
|
return;
|
||||||
|
@ -883,9 +883,9 @@ static void extents_snaptogrid_spin( GtkAdjustment *adj, int *data ){
|
||||||
static gint bitmap_file_entryfocusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
|
static gint bitmap_file_entryfocusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
|
||||||
char filename[NAME_MAX];
|
char filename[NAME_MAX];
|
||||||
|
|
||||||
strcpy( filename, gtk_entry_get_text( GTK_ENTRY( widget ) ) );
|
Q_strncpyz( filename, gtk_entry_get_text( GTK_ENTRY( widget ) ), sizeof( filename ) );
|
||||||
if ( strcmp( filename,gbmp.name ) ) {
|
if ( strcmp( filename,gbmp.name ) ) {
|
||||||
strcpy( gbmp.name,filename );
|
Q_strncpyz( gbmp.name, filename, sizeof( gbmp.name ) );
|
||||||
if ( strlen( gbmp.name ) ) {
|
if ( strlen( gbmp.name ) ) {
|
||||||
OpenBitmap();
|
OpenBitmap();
|
||||||
}
|
}
|
||||||
|
@ -901,12 +901,12 @@ static void bitmap_browse( GtkWidget *widget, gpointer data ){
|
||||||
filename = g_FuncTable.m_pfnFileDialog( g_pWnd, TRUE, "Bitmap File", gbmp.defpath, "gtkgensurf", NULL );
|
filename = g_FuncTable.m_pfnFileDialog( g_pWnd, TRUE, "Bitmap File", gbmp.defpath, "gtkgensurf", NULL );
|
||||||
|
|
||||||
if ( filename != NULL ) {
|
if ( filename != NULL ) {
|
||||||
strcpy( gbmp.name, filename );
|
Q_strncpyz( gbmp.name, filename, sizeof( gbmp.name ) );
|
||||||
|
|
||||||
ptr = (char *) strrchr( filename, G_DIR_SEPARATOR );
|
ptr = (char *) strrchr( filename, G_DIR_SEPARATOR );
|
||||||
if ( ptr != NULL ) {
|
if ( ptr != NULL ) {
|
||||||
*( ptr + 1 ) = '\0';
|
*( ptr + 1 ) = '\0';
|
||||||
strcpy( gbmp.defpath, filename );
|
Q_strncpyz( gbmp.defpath, filename, sizeof( gbmp.defpath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenBitmap();
|
OpenBitmap();
|
||||||
|
@ -915,7 +915,7 @@ static void bitmap_browse( GtkWidget *widget, gpointer data ){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bitmap_reload( GtkWidget *widget, gpointer data ){
|
static void bitmap_reload( GtkWidget *widget, gpointer data ){
|
||||||
strcpy( gbmp.name, gtk_entry_get_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ) ) );
|
Q_strncpyz( gbmp.name, gtk_entry_get_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ) ), sizeof( gbmp.name ) );
|
||||||
if ( strlen( gbmp.name ) ) {
|
if ( strlen( gbmp.name ) ) {
|
||||||
OpenBitmap();
|
OpenBitmap();
|
||||||
ENABLE_WIDGET( "go", ( gbmp.colors != NULL ? TRUE : FALSE ) );
|
ENABLE_WIDGET( "go", ( gbmp.colors != NULL ? TRUE : FALSE ) );
|
||||||
|
@ -936,7 +936,7 @@ static gint fix_value_entryfocusout( GtkWidget* widget, GdkEventFocus *event, gp
|
||||||
gdk_beep();
|
gdk_beep();
|
||||||
g_FuncTable.m_pfnMessageBox( g_pWnd, "The value must be between -65536 and 65536, inclusive.",
|
g_FuncTable.m_pfnMessageBox( g_pWnd, "The value must be between -65536 and 65536, inclusive.",
|
||||||
"GenSurf", MB_OK | MB_ICONEXCLAMATION, NULL );
|
"GenSurf", MB_OK | MB_ICONEXCLAMATION, NULL );
|
||||||
sprintf( Text, "%d", (int)xyz[Vertex[0].i][Vertex[0].j].fixed_value );
|
snprintf( Text, sizeof( Text ), "%d", (int)xyz[Vertex[0].i][Vertex[0].j].fixed_value );
|
||||||
gtk_entry_set_text( GTK_ENTRY( widget ), Text );
|
gtk_entry_set_text( GTK_ENTRY( widget ), Text );
|
||||||
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( widget ) ), widget );
|
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( widget ) ), widget );
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1006,7 @@ static void fix_freeall( GtkWidget *widget, gpointer data ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void vertex_selected(){
|
void vertex_selected(){
|
||||||
char Text[32];
|
char Text[64];
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
SetupControls();
|
SetupControls();
|
||||||
|
@ -1032,9 +1032,9 @@ void vertex_selected(){
|
||||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "fix_value" ) ),
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), "fix_value" ) ),
|
||||||
(int)xyz[Vertex[0].i][Vertex[0].j].fixed_value );
|
(int)xyz[Vertex[0].i][Vertex[0].j].fixed_value );
|
||||||
|
|
||||||
sprintf( Text,"%d",(int)xyz[Vertex[0].i][Vertex[0].j].range );
|
snprintf( Text, sizeof( Text ), "%d", (int)xyz[Vertex[0].i][Vertex[0].j].range );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "fix_range" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "fix_range" ) ), Text );
|
||||||
sprintf( Text,"%.5g",xyz[Vertex[0].i][Vertex[0].j].rate );
|
snprintf( Text, sizeof( Text ), "%.5g", xyz[Vertex[0].i][Vertex[0].j].rate );
|
||||||
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "fix_rate" ) ), Text );
|
gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "fix_rate" ) ), Text );
|
||||||
|
|
||||||
for ( k = 0; k < NumVerticesSelected; k++ )
|
for ( k = 0; k < NumVerticesSelected; k++ )
|
||||||
|
@ -1071,7 +1071,7 @@ static void texture_terrainent( GtkToggleButton *check, gpointer data ){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void texture_set( int index, const char* name ){
|
static void texture_set( int index, const char* name ){
|
||||||
strcpy( Texture[Game][index], name );
|
Q_strncpyz( Texture[Game][index], name, sizeof( Texture[Game][index] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint texture_entryfocusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
|
static gint texture_entryfocusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
|
||||||
|
@ -2230,8 +2230,8 @@ qboolean CALLBACK AboutDlgProc( HWND hwnd, unsigned msg, UINT wparam, LONG lpara
|
||||||
|
|
||||||
switch ( msg ) {
|
switch ( msg ) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
strcpy( szText,"About " );
|
Q_strncpyz( szText, "About ", sizeof( szText ) );
|
||||||
strcat( szText,gszCaption );
|
strncat( szText, gszCaption, sizeof( szText ) );
|
||||||
SetWindowText( hwnd,gszCaption );
|
SetWindowText( hwnd,gszCaption );
|
||||||
SetDlgItemText( hwnd,DLG_ABOUT_APP,szText );
|
SetDlgItemText( hwnd,DLG_ABOUT_APP,szText );
|
||||||
/* Application icon: */
|
/* Application icon: */
|
||||||
|
@ -2315,7 +2315,7 @@ qboolean CALLBACK AboutDlgProc( HWND hwnd, unsigned msg, UINT wparam, LONG lpara
|
||||||
void About(){
|
void About(){
|
||||||
if ( DialogBox( ghInst,"About", ghwnd_main, (DLGPROC)AboutDlgProc ) < 0 ) {
|
if ( DialogBox( ghInst,"About", ghwnd_main, (DLGPROC)AboutDlgProc ) < 0 ) {
|
||||||
char Text[256];
|
char Text[256];
|
||||||
sprintf( Text,"In About(), GetLastError()=0x%08x",GetLastError() );
|
snprintf( Text, sizeof( Text ),"In About(), GetLastError()=0x%08x",GetLastError() );
|
||||||
MessageBox( ghwnd_main,Text,"GenSurf",MB_ICONEXCLAMATION );
|
MessageBox( ghwnd_main,Text,"GenSurf",MB_ICONEXCLAMATION );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ int MapPatches(){
|
||||||
NH_patch -= 2;
|
NH_patch -= 2;
|
||||||
NH_remain -= ( NH_patch - 1 );
|
NH_remain -= ( NH_patch - 1 );
|
||||||
if ( NH_remain < 0 ) {
|
if ( NH_remain < 0 ) {
|
||||||
sprintf( szOops,"Oops... screwed up with NH=%d",NH );
|
snprintf( szOops, sizeof( szOops ), "Oops... screwed up with NH=%d", NH );
|
||||||
g_FuncTable.m_pfnMessageBox( NULL,szOops,"Uh oh", 0, NULL );
|
g_FuncTable.m_pfnMessageBox( NULL,szOops,"Uh oh", 0, NULL );
|
||||||
}
|
}
|
||||||
NV_remain = NV + 1;
|
NV_remain = NV + 1;
|
||||||
|
@ -233,7 +233,7 @@ int MapPatches(){
|
||||||
NV_patch -= 2;
|
NV_patch -= 2;
|
||||||
NV_remain -= ( NV_patch - 1 );
|
NV_remain -= ( NV_patch - 1 );
|
||||||
if ( NV_remain < 0 ) {
|
if ( NV_remain < 0 ) {
|
||||||
sprintf( szOops,"Oops... screwed up with NV=%d",NV );
|
snprintf( szOops, sizeof( szOops ), "Oops... screwed up with NV=%d", NV );
|
||||||
g_FuncTable.m_pfnMessageBox( NULL,szOops,"Uh oh", 0, NULL );
|
g_FuncTable.m_pfnMessageBox( NULL,szOops,"Uh oh", 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,9 +287,9 @@ void MapBrushes(){
|
||||||
BRUSH brush;
|
BRUSH brush;
|
||||||
XYZ v[8];
|
XYZ v[8];
|
||||||
|
|
||||||
strcpy( surftext,Texture[Game][0] );
|
Q_strncpyz( surftext, Texture[Game][0], sizeof( surftext ) );
|
||||||
strcpy( sidetext,( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
Q_strncpyz( sidetext,( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( sidetext ) );
|
||||||
strcpy( surftext2,( strlen( Texture[Game][2] ) ? Texture[Game][2] : Texture[Game][0] ) );
|
Q_strncpyz( surftext2,( strlen( Texture[Game][2] ) ? Texture[Game][2] : Texture[Game][0] ), sizeof( surftext2 ) );
|
||||||
|
|
||||||
// if surftext2 is identical to surftext, there's no need to
|
// if surftext2 is identical to surftext, there's no need to
|
||||||
// check surface angle
|
// check surface angle
|
||||||
|
@ -376,8 +376,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[0],&brush.face[0].v[0] );
|
XYZtoV( &v[0],&brush.face[0].v[0] );
|
||||||
XYZtoV( &v[3],&brush.face[0].v[1] );
|
XYZtoV( &v[3],&brush.face[0].v[1] );
|
||||||
XYZtoV( &v[4],&brush.face[0].v[2] );
|
XYZtoV( &v[4],&brush.face[0].v[2] );
|
||||||
strcpy( brush.face[0].texture,
|
Q_strncpyz( brush.face[0].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[0].texture ) );
|
||||||
brush.face[0].Shift[0] = (float)TexOffset[0];
|
brush.face[0].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[0].Shift[1] = (float)TexOffset[1];
|
brush.face[0].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[0].Rotate = 0.;
|
brush.face[0].Rotate = 0.;
|
||||||
|
@ -390,8 +390,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[1],&brush.face[1].v[0] );
|
XYZtoV( &v[1],&brush.face[1].v[0] );
|
||||||
XYZtoV( &v[4],&brush.face[1].v[1] );
|
XYZtoV( &v[4],&brush.face[1].v[1] );
|
||||||
XYZtoV( &v[5],&brush.face[1].v[2] );
|
XYZtoV( &v[5],&brush.face[1].v[2] );
|
||||||
strcpy( brush.face[1].texture,
|
Q_strncpyz( brush.face[1].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[1].texture ) );
|
||||||
brush.face[1].Shift[0] = (float)TexOffset[0];
|
brush.face[1].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[1].Shift[1] = (float)TexOffset[1];
|
brush.face[1].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[1].Rotate = 0.;
|
brush.face[1].Rotate = 0.;
|
||||||
|
@ -404,8 +404,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[2],&brush.face[2].v[0] );
|
XYZtoV( &v[2],&brush.face[2].v[0] );
|
||||||
XYZtoV( &v[5],&brush.face[2].v[1] );
|
XYZtoV( &v[5],&brush.face[2].v[1] );
|
||||||
XYZtoV( &v[3],&brush.face[2].v[2] );
|
XYZtoV( &v[3],&brush.face[2].v[2] );
|
||||||
strcpy( brush.face[2].texture,
|
Q_strncpyz( brush.face[2].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[2].texture ) );
|
||||||
brush.face[2].Shift[0] = (float)TexOffset[0];
|
brush.face[2].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[2].Shift[1] = (float)TexOffset[1];
|
brush.face[2].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[2].Rotate = 0.;
|
brush.face[2].Rotate = 0.;
|
||||||
|
@ -426,21 +426,21 @@ void MapBrushes(){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
XYZtoV( &v[3],&brush.face[3].v[0] );
|
XYZtoV( &v[3],&brush.face[3].v[0] );
|
||||||
XYZtoV( &v[5],&brush.face[3].v[1] );
|
XYZtoV( &v[5],&brush.face[3].v[1] );
|
||||||
XYZtoV( &v[4],&brush.face[3].v[2] );
|
XYZtoV( &v[4],&brush.face[3].v[2] );
|
||||||
strcpy( brush.face[3].texture,
|
Q_strncpyz( brush.face[3].texture,
|
||||||
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? surft : sidetext ) );
|
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? surft : sidetext ), sizeof( brush.face[3].texture ) );
|
||||||
brush.face[3].Shift[0] = (float)TexOffset[0];
|
brush.face[3].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[3].Shift[1] = (float)TexOffset[1];
|
brush.face[3].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[3].Rotate = 0.;
|
brush.face[3].Rotate = 0.;
|
||||||
|
@ -461,21 +461,21 @@ void MapBrushes(){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
XYZtoV( &v[0],&brush.face[4].v[0] );
|
XYZtoV( &v[0],&brush.face[4].v[0] );
|
||||||
XYZtoV( &v[1],&brush.face[4].v[1] );
|
XYZtoV( &v[1],&brush.face[4].v[1] );
|
||||||
XYZtoV( &v[2],&brush.face[4].v[2] );
|
XYZtoV( &v[2],&brush.face[4].v[2] );
|
||||||
strcpy( brush.face[4].texture,
|
Q_strncpyz( brush.face[4].texture,
|
||||||
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? sidetext : surft ) );
|
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? sidetext : surft ), sizeof( brush.face[4].texture ) );
|
||||||
brush.face[4].Shift[0] = (float)TexOffset[0];
|
brush.face[4].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[4].Shift[1] = (float)TexOffset[1];
|
brush.face[4].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[4].Rotate = 0.;
|
brush.face[4].Rotate = 0.;
|
||||||
|
@ -544,8 +544,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[0],&brush.face[0].v[0] );
|
XYZtoV( &v[0],&brush.face[0].v[0] );
|
||||||
XYZtoV( &v[3],&brush.face[0].v[1] );
|
XYZtoV( &v[3],&brush.face[0].v[1] );
|
||||||
XYZtoV( &v[4],&brush.face[0].v[2] );
|
XYZtoV( &v[4],&brush.face[0].v[2] );
|
||||||
strcpy( brush.face[0].texture,
|
Q_strncpyz( brush.face[0].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[0].texture ) );
|
||||||
brush.face[0].Shift[0] = (float)TexOffset[0];
|
brush.face[0].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[0].Shift[1] = (float)TexOffset[1];
|
brush.face[0].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[0].Rotate = 0.;
|
brush.face[0].Rotate = 0.;
|
||||||
|
@ -558,8 +558,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[1],&brush.face[1].v[0] );
|
XYZtoV( &v[1],&brush.face[1].v[0] );
|
||||||
XYZtoV( &v[4],&brush.face[1].v[1] );
|
XYZtoV( &v[4],&brush.face[1].v[1] );
|
||||||
XYZtoV( &v[5],&brush.face[1].v[2] );
|
XYZtoV( &v[5],&brush.face[1].v[2] );
|
||||||
strcpy( brush.face[1].texture,
|
Q_strncpyz( brush.face[1].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[1].texture ) );
|
||||||
brush.face[1].Shift[0] = (float)TexOffset[0];
|
brush.face[1].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[1].Shift[1] = (float)TexOffset[1];
|
brush.face[1].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[1].Rotate = 0.;
|
brush.face[1].Rotate = 0.;
|
||||||
|
@ -572,8 +572,8 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[2],&brush.face[2].v[0] );
|
XYZtoV( &v[2],&brush.face[2].v[0] );
|
||||||
XYZtoV( &v[5],&brush.face[2].v[1] );
|
XYZtoV( &v[5],&brush.face[2].v[1] );
|
||||||
XYZtoV( &v[3],&brush.face[2].v[2] );
|
XYZtoV( &v[3],&brush.face[2].v[2] );
|
||||||
strcpy( brush.face[2].texture,
|
Q_strncpyz( brush.face[2].texture,
|
||||||
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ) );
|
( strlen( Texture[Game][1] ) ? Texture[Game][1] : Texture[Game][0] ), sizeof( brush.face[2].texture ) );
|
||||||
brush.face[2].Shift[0] = (float)TexOffset[0];
|
brush.face[2].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[2].Shift[1] = (float)TexOffset[1];
|
brush.face[2].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[2].Rotate = 0.;
|
brush.face[2].Rotate = 0.;
|
||||||
|
@ -594,20 +594,20 @@ void MapBrushes(){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
XYZtoV( &v[3],&brush.face[3].v[0] );
|
XYZtoV( &v[3],&brush.face[3].v[0] );
|
||||||
XYZtoV( &v[5],&brush.face[3].v[1] );
|
XYZtoV( &v[5],&brush.face[3].v[1] );
|
||||||
XYZtoV( &v[4],&brush.face[3].v[2] );
|
XYZtoV( &v[4],&brush.face[3].v[2] );
|
||||||
strcpy( brush.face[3].texture,
|
Q_strncpyz( brush.face[3].texture,
|
||||||
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? surft : sidetext ) );
|
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? surft : sidetext ), sizeof( brush.face[3].texture ) );
|
||||||
brush.face[3].Shift[0] = (float)TexOffset[0];
|
brush.face[3].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[3].Shift[1] = (float)TexOffset[1];
|
brush.face[3].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[3].Rotate = 0.;
|
brush.face[3].Rotate = 0.;
|
||||||
|
@ -623,25 +623,25 @@ void MapBrushes(){
|
||||||
CrossProduct( t[0],t[1],SurfNormal );
|
CrossProduct( t[0],t[1],SurfNormal );
|
||||||
VectorNormalize( SurfNormal,SurfNormal );
|
VectorNormalize( SurfNormal,SurfNormal );
|
||||||
if ( DotProduct( SurfNormal,PlaneNormal ) < Steep ) {
|
if ( DotProduct( SurfNormal,PlaneNormal ) < Steep ) {
|
||||||
strcpy( surft,surftext2 );
|
Q_strncpyz( surft, surftext2, sizeof( surft ) );
|
||||||
surf = surface[2];
|
surf = surface[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( surft,surftext );
|
Q_strncpyz( surft, surftext, sizeof( surft ) );
|
||||||
surf = surface[0];
|
surf = surface[0];
|
||||||
}
|
}
|
||||||
XYZtoV( &v[0],&brush.face[4].v[0] );
|
XYZtoV( &v[0],&brush.face[4].v[0] );
|
||||||
XYZtoV( &v[1],&brush.face[4].v[1] );
|
XYZtoV( &v[1],&brush.face[4].v[1] );
|
||||||
XYZtoV( &v[2],&brush.face[4].v[2] );
|
XYZtoV( &v[2],&brush.face[4].v[2] );
|
||||||
strcpy( brush.face[4].texture,
|
Q_strncpyz( brush.face[4].texture,
|
||||||
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? sidetext : surft ) );
|
( Plane == PLANE_XZ0 || Plane == PLANE_XZ1 ? sidetext : surft ), sizeof( brush.face[4].texture ) );
|
||||||
brush.face[4].Shift[0] = (float)TexOffset[0];
|
brush.face[4].Shift[0] = (float)TexOffset[0];
|
||||||
brush.face[4].Shift[1] = (float)TexOffset[1];
|
brush.face[4].Shift[1] = (float)TexOffset[1];
|
||||||
brush.face[4].Rotate = 0.;
|
brush.face[4].Rotate = 0.;
|
||||||
|
@ -806,7 +806,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[0],&brush.face[0].v[0] );
|
XYZtoV( &v[0],&brush.face[0].v[0] );
|
||||||
XYZtoV( &v[1],&brush.face[0].v[1] );
|
XYZtoV( &v[1],&brush.face[0].v[1] );
|
||||||
XYZtoV( &v[2],&brush.face[0].v[2] );
|
XYZtoV( &v[2],&brush.face[0].v[2] );
|
||||||
strcpy( brush.face[0].texture,skip );
|
Q_strncpyz( brush.face[0].texture, skip, sizeof( brush.face[0].texture ) );
|
||||||
brush.face[0].Shift[0] = 0.;
|
brush.face[0].Shift[0] = 0.;
|
||||||
brush.face[0].Shift[1] = 0.;
|
brush.face[0].Shift[1] = 0.;
|
||||||
brush.face[0].Rotate = 0.;
|
brush.face[0].Rotate = 0.;
|
||||||
|
@ -819,7 +819,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[4],&brush.face[1].v[0] );
|
XYZtoV( &v[4],&brush.face[1].v[0] );
|
||||||
XYZtoV( &v[7],&brush.face[1].v[1] );
|
XYZtoV( &v[7],&brush.face[1].v[1] );
|
||||||
XYZtoV( &v[6],&brush.face[1].v[2] );
|
XYZtoV( &v[6],&brush.face[1].v[2] );
|
||||||
strcpy( brush.face[1].texture,skip );
|
Q_strncpyz( brush.face[1].texture, skip, sizeof( brush.face[1].texture ) );
|
||||||
brush.face[1].Shift[0] = 0.;
|
brush.face[1].Shift[0] = 0.;
|
||||||
brush.face[1].Shift[1] = 0.;
|
brush.face[1].Shift[1] = 0.;
|
||||||
brush.face[1].Rotate = 0.;
|
brush.face[1].Rotate = 0.;
|
||||||
|
@ -832,7 +832,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[0],&brush.face[2].v[0] );
|
XYZtoV( &v[0],&brush.face[2].v[0] );
|
||||||
XYZtoV( &v[4],&brush.face[2].v[1] );
|
XYZtoV( &v[4],&brush.face[2].v[1] );
|
||||||
XYZtoV( &v[5],&brush.face[2].v[2] );
|
XYZtoV( &v[5],&brush.face[2].v[2] );
|
||||||
strcpy( brush.face[2].texture,hint );
|
Q_strncpyz( brush.face[2].texture, hint, sizeof( brush.face[2].texture ) );
|
||||||
brush.face[2].Shift[0] = 0.;
|
brush.face[2].Shift[0] = 0.;
|
||||||
brush.face[2].Shift[1] = 0.;
|
brush.face[2].Shift[1] = 0.;
|
||||||
brush.face[2].Rotate = 0.;
|
brush.face[2].Rotate = 0.;
|
||||||
|
@ -845,7 +845,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[1],&brush.face[3].v[0] );
|
XYZtoV( &v[1],&brush.face[3].v[0] );
|
||||||
XYZtoV( &v[5],&brush.face[3].v[1] );
|
XYZtoV( &v[5],&brush.face[3].v[1] );
|
||||||
XYZtoV( &v[6],&brush.face[3].v[2] );
|
XYZtoV( &v[6],&brush.face[3].v[2] );
|
||||||
strcpy( brush.face[3].texture,hint );
|
Q_strncpyz( brush.face[3].texture, hint, sizeof( brush.face[3].texture ) );
|
||||||
brush.face[3].Shift[0] = 0.;
|
brush.face[3].Shift[0] = 0.;
|
||||||
brush.face[3].Shift[1] = 0.;
|
brush.face[3].Shift[1] = 0.;
|
||||||
brush.face[3].Rotate = 0.;
|
brush.face[3].Rotate = 0.;
|
||||||
|
@ -858,7 +858,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[2],&brush.face[4].v[0] );
|
XYZtoV( &v[2],&brush.face[4].v[0] );
|
||||||
XYZtoV( &v[6],&brush.face[4].v[1] );
|
XYZtoV( &v[6],&brush.face[4].v[1] );
|
||||||
XYZtoV( &v[7],&brush.face[4].v[2] );
|
XYZtoV( &v[7],&brush.face[4].v[2] );
|
||||||
strcpy( brush.face[4].texture,hint );
|
Q_strncpyz( brush.face[4].texture, hint, sizeof( brush.face[4].texture ) );
|
||||||
brush.face[4].Shift[0] = 0.;
|
brush.face[4].Shift[0] = 0.;
|
||||||
brush.face[4].Shift[1] = 0.;
|
brush.face[4].Shift[1] = 0.;
|
||||||
brush.face[4].Rotate = 0.;
|
brush.face[4].Rotate = 0.;
|
||||||
|
@ -871,7 +871,7 @@ void MapBrushes(){
|
||||||
XYZtoV( &v[3],&brush.face[5].v[0] );
|
XYZtoV( &v[3],&brush.face[5].v[0] );
|
||||||
XYZtoV( &v[7],&brush.face[5].v[1] );
|
XYZtoV( &v[7],&brush.face[5].v[1] );
|
||||||
XYZtoV( &v[4],&brush.face[5].v[2] );
|
XYZtoV( &v[4],&brush.face[5].v[2] );
|
||||||
strcpy( brush.face[5].texture,hint );
|
Q_strncpyz( brush.face[5].texture, hint, sizeof( brush.face[5].texture ) );
|
||||||
brush.face[5].Shift[0] = 0.;
|
brush.face[5].Shift[0] = 0.;
|
||||||
brush.face[5].Shift[1] = 0.;
|
brush.face[5].Shift[1] = 0.;
|
||||||
brush.face[5].Rotate = 0.;
|
brush.face[5].Rotate = 0.;
|
||||||
|
@ -892,7 +892,7 @@ void MapBrushes(){
|
||||||
brush.NumFaces = 5;
|
brush.NumFaces = 5;
|
||||||
for ( i = 0; i < 6; i++ )
|
for ( i = 0; i < 6; i++ )
|
||||||
{
|
{
|
||||||
strcpy( brush.face[i].texture,hint );
|
Q_strncpyz( brush.face[i].texture, hint, sizeof( brush.face[i].texture ) );
|
||||||
brush.face[i].Shift[0] = 0.;
|
brush.face[i].Shift[0] = 0.;
|
||||||
brush.face[i].Shift[1] = 0.;
|
brush.face[i].Shift[1] = 0.;
|
||||||
brush.face[i].Rotate = 0.;
|
brush.face[i].Rotate = 0.;
|
||||||
|
@ -2015,7 +2015,7 @@ void MakePatch( patchMesh_t *p ){
|
||||||
ret = g_FuncTable.m_pfnCreatePatchHandle();
|
ret = g_FuncTable.m_pfnCreatePatchHandle();
|
||||||
// strcpy(shadername, "textures/");
|
// strcpy(shadername, "textures/");
|
||||||
// strcpy(shadername+9, Texture[Game][0]);
|
// strcpy(shadername+9, Texture[Game][0]);
|
||||||
strcpy( shadername, Texture[Game][0] );
|
Q_strncpyz( shadername, Texture[Game][0], sizeof( shadername ) );
|
||||||
g_FuncTable.m_pfnCommitPatchHandleToMap( ret,p,shadername );
|
g_FuncTable.m_pfnCommitPatchHandleToMap( ret,p,shadername );
|
||||||
g_FuncTable.m_pfnReleasePatchHandles();
|
g_FuncTable.m_pfnReleasePatchHandles();
|
||||||
}
|
}
|
||||||
|
@ -2037,12 +2037,12 @@ void MakeBrush( BRUSH *brush ){
|
||||||
for ( i = 0; i < brush->NumFaces; i++ )
|
for ( i = 0; i < brush->NumFaces; i++ )
|
||||||
{
|
{
|
||||||
if ( !strncmp( brush->face[i].texture, "textures/", 9 ) ) {
|
if ( !strncmp( brush->face[i].texture, "textures/", 9 ) ) {
|
||||||
strcpy( QERFaceData.m_TextureName,brush->face[i].texture );
|
Q_strncpyz( QERFaceData.m_TextureName, brush->face[i].texture, sizeof( QERFaceData.m_TextureName ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( QERFaceData.m_TextureName,"textures/" );
|
strcpy( QERFaceData.m_TextureName, "textures/" );
|
||||||
strcpy( QERFaceData.m_TextureName + 9,brush->face[i].texture );
|
Q_strncpyz( QERFaceData.m_TextureName + 9,brush->face[i].texture, sizeof( QERFaceData.m_TextureName ) - 9 );
|
||||||
}
|
}
|
||||||
QERFaceData.m_nContents = brush->face[i].Contents;
|
QERFaceData.m_nContents = brush->face[i].Contents;
|
||||||
QERFaceData.m_nFlags = brush->face[i].Surface;
|
QERFaceData.m_nFlags = brush->face[i].Surface;
|
||||||
|
|
|
@ -100,15 +100,15 @@ char GameName[NUMGAMES][16] = {"Quake2", "Half-Life", "SiN", "Heretic2", "Kingpi
|
||||||
|
|
||||||
|
|
||||||
bool GenSurfInit(){
|
bool GenSurfInit(){
|
||||||
strcpy( gszVersion, "1.05" );
|
Q_strncpyz( gszVersion, "1.05", sizeof( gszVersion ) );
|
||||||
strcpy( gszCaption, "GtkGenSurf" );
|
Q_strncpyz( gszCaption, "GtkGenSurf", sizeof( gszCaption ) );
|
||||||
if ( strlen( gszVersion ) ) {
|
if ( strlen( gszVersion ) ) {
|
||||||
strcat( gszCaption, " v" );
|
strncat( gszCaption, " v", sizeof( gszCaption ) );
|
||||||
strcat( gszCaption, gszVersion );
|
strncat( gszCaption, gszVersion, sizeof( gszCaption ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( gszIni, g_FuncTable.m_pfnProfileGetDirectory() );
|
Q_strncpyz( gszIni, g_FuncTable.m_pfnProfileGetDirectory(), sizeof( gszIni ) );
|
||||||
strcat( gszIni, "gensurf.ini" );
|
strncat( gszIni, "gensurf.ini", sizeof( gszIni ) );
|
||||||
|
|
||||||
/*if (g_FuncTable.m_pfnReadProjectKey != NULL)
|
/*if (g_FuncTable.m_pfnReadProjectKey != NULL)
|
||||||
{
|
{
|
||||||
|
@ -273,9 +273,9 @@ void ReadIniFile( const char *file ){
|
||||||
for ( i = 0; i < NUMGAMES; i++ )
|
for ( i = 0; i < NUMGAMES; i++ )
|
||||||
{
|
{
|
||||||
// strcpy (gszOutputDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"OutputDir",""));
|
// strcpy (gszOutputDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"OutputDir",""));
|
||||||
strcpy( Texture[i][0], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture", "" ) );
|
Q_strncpyz( Texture[i][0], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture", "" ), sizeof( Texture[i][0] ) );
|
||||||
strcpy( Texture[i][1], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture2", "" ) );
|
Q_strncpyz( Texture[i][1], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture2", "" ), sizeof( Texture[i][1] ) );
|
||||||
strcpy( Texture[i][2], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture3", "" ) );
|
Q_strncpyz( Texture[i][2], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture3", "" ), sizeof( Texture[i][2] ) );
|
||||||
// strcpy (gszTextureDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"TextureDir",""));
|
// strcpy (gszTextureDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"TextureDir",""));
|
||||||
// UsePak[i] = GetPrivateProfileInt(GameName[i],"UsePak",0);
|
// UsePak[i] = GetPrivateProfileInt(GameName[i],"UsePak",0);
|
||||||
// strcpy (pakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"PakFile",""));
|
// strcpy (pakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"PakFile",""));
|
||||||
|
@ -312,7 +312,7 @@ void ReadIniFile( const char *file ){
|
||||||
if ( !strlen( Texture[QUAKE3][1] ) ) {
|
if ( !strlen( Texture[QUAKE3][1] ) ) {
|
||||||
strcpy( Texture[QUAKE3][1], "textures/common/caulk" );
|
strcpy( Texture[QUAKE3][1], "textures/common/caulk" );
|
||||||
}
|
}
|
||||||
strcpy( gbmp.name, g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","Filename","" ) );
|
Q_strncpyz( gbmp.name, g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","Filename","" ), sizeof( gbmp.name ) );
|
||||||
|
|
||||||
|
|
||||||
gbmp.colors = NULL;
|
gbmp.colors = NULL;
|
||||||
|
@ -320,7 +320,7 @@ void ReadIniFile( const char *file ){
|
||||||
OpenBitmap();
|
OpenBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( gbmp.defpath, g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","DefaultPath","" ) );
|
Q_strncpyz( gbmp.defpath, g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","DefaultPath","" ), sizeof( gbmp.defpath ) );
|
||||||
|
|
||||||
Text = g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","BlackValue","" );
|
Text = g_FuncTable.m_pfnProfileLoadString( file, "Bitmap","BlackValue","" );
|
||||||
if ( strlen( Text ) ) {
|
if ( strlen( Text ) ) {
|
||||||
|
@ -353,7 +353,7 @@ char *va( const char *format, ... ){
|
||||||
static char string[1024];
|
static char string[1024];
|
||||||
|
|
||||||
va_start( argptr, format );
|
va_start( argptr, format );
|
||||||
vsprintf( string, format,argptr );
|
vsnprintf( string, sizeof( string ), format, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
|
@ -423,22 +423,22 @@ void SaveSetup( GtkWidget *parent ){
|
||||||
g_FuncTable.m_pfnProfileGetDirectory(), "gtkgensurf", NULL );
|
g_FuncTable.m_pfnProfileGetDirectory(), "gtkgensurf", NULL );
|
||||||
|
|
||||||
if ( name != NULL ) {
|
if ( name != NULL ) {
|
||||||
char key[32], text[32];
|
char key[32], text[128];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
WriteIniFile( name );
|
WriteIniFile( name );
|
||||||
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"MapFile",gszMapFile );
|
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"MapFile",gszMapFile );
|
||||||
sprintf( text,"0x%04x",FileAppend );
|
snprintf( text, sizeof( text ), "0x%04x", FileAppend );
|
||||||
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"Append",text );
|
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"Append",text );
|
||||||
sprintf( text,"0x%04x",Decimate );
|
snprintf( text, sizeof( text ), "0x%04x", Decimate );
|
||||||
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"Decimate",text );
|
g_FuncTable.m_pfnProfileSaveString( name, OPTS_SECTION,"Decimate",text );
|
||||||
for ( i = 0; i <= NH; i++ )
|
for ( i = 0; i <= NH; i++ )
|
||||||
{
|
{
|
||||||
for ( j = 0; j <= NV; j++ )
|
for ( j = 0; j <= NV; j++ )
|
||||||
{
|
{
|
||||||
if ( xyz[i][j].fixed ) {
|
if ( xyz[i][j].fixed ) {
|
||||||
sprintf( key,"I%dJ%d",i,j );
|
snprintf( key, sizeof( key ), "I%dJ%d", i, j );
|
||||||
sprintf( text,"%g %g %g", xyz[i][j].fixed_value, xyz[i][j].range, xyz[i][j].rate );
|
snprintf( text, sizeof( text ), "%g %g %g", xyz[i][j].fixed_value, xyz[i][j].range, xyz[i][j].rate );
|
||||||
g_FuncTable.m_pfnProfileSaveString( name, "FixedPoints",key,text );
|
g_FuncTable.m_pfnProfileSaveString( name, "FixedPoints",key,text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ void OpenSetup( GtkWidget *parent, int UseDefaults ){
|
||||||
{
|
{
|
||||||
for ( j = 0; j <= NV; j++ )
|
for ( j = 0; j <= NV; j++ )
|
||||||
{
|
{
|
||||||
sprintf( key,"I%dJ%d",i,j );
|
snprintf( key, sizeof( key ), "I%dJ%d", i, j );
|
||||||
text = g_FuncTable.m_pfnProfileLoadString( name, "FixedPoints", key, "" );
|
text = g_FuncTable.m_pfnProfileLoadString( name, "FixedPoints", key, "" );
|
||||||
if ( strlen( text ) ) {
|
if ( strlen( text ) ) {
|
||||||
xyz[i][j].fixed = 1;
|
xyz[i][j].fixed = 1;
|
||||||
|
|
|
@ -313,6 +313,11 @@
|
||||||
#include "triangle.h"
|
#include "triangle.h"
|
||||||
#endif /* TRILIBRARY */
|
#endif /* TRILIBRARY */
|
||||||
|
|
||||||
|
#ifndef Q_strncpyz
|
||||||
|
#define Q_strncpyz(_dst, _source, _len) do { strncpy((_dst), (_source), (_len) - 1); if ((_len) > 0) (_dst)[(_len) - 1] = 0; } while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The following obscenity seems to be necessary to ensure that this program */
|
/* The following obscenity seems to be necessary to ensure that this program */
|
||||||
/* will port to Dec Alphas running OSF/1, because their stdio.h file commits */
|
/* will port to Dec Alphas running OSF/1, because their stdio.h file commits */
|
||||||
/* the unpardonable sin of including stdlib.h. Hence, malloc(), free(), and */
|
/* the unpardonable sin of including stdlib.h. Hence, malloc(), free(), and */
|
||||||
|
@ -2857,8 +2862,7 @@ char **argv;
|
||||||
}
|
}
|
||||||
#ifndef TRILIBRARY
|
#ifndef TRILIBRARY
|
||||||
} else {
|
} else {
|
||||||
strncpy( innodefilename, argv[i], FILENAMESIZE - 1 );
|
Q_strncpyz( innodefilename, argv[i], FILENAMESIZE );
|
||||||
innodefilename[FILENAMESIZE - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
#endif /* not TRILIBRARY */
|
#endif /* not TRILIBRARY */
|
||||||
}
|
}
|
||||||
|
@ -2907,11 +2911,11 @@ char **argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRILIBRARY
|
#ifndef TRILIBRARY
|
||||||
strcpy( inpolyfilename, innodefilename );
|
Q_strncpyz( inpolyfilename, innodefilename, sizeof( inpolyfilename ) );
|
||||||
strcpy( inelefilename, innodefilename );
|
Q_strncpyz( inelefilename, innodefilename, sizeof( inelefilename ) );
|
||||||
strcpy( areafilename, innodefilename );
|
Q_strncpyz( areafilename, innodefilename, sizeof( areafilename ) );
|
||||||
increment = 0;
|
increment = 0;
|
||||||
strcpy( workstring, innodefilename );
|
Q_strncpyz( workstring, innodefilename, sizeof( workstring ) );
|
||||||
j = 1;
|
j = 1;
|
||||||
while ( workstring[j] != '\0' ) {
|
while ( workstring[j] != '\0' ) {
|
||||||
if ( ( workstring[j] == '.' ) && ( workstring[j + 1] != '\0' ) ) {
|
if ( ( workstring[j] == '.' ) && ( workstring[j + 1] != '\0' ) ) {
|
||||||
|
@ -2933,64 +2937,64 @@ char **argv;
|
||||||
} while ( workstring[j] != '\0' );
|
} while ( workstring[j] != '\0' );
|
||||||
}
|
}
|
||||||
if ( noiterationnum ) {
|
if ( noiterationnum ) {
|
||||||
strcpy( outnodefilename, innodefilename );
|
Q_strncpyz( outnodefilename, innodefilename, sizeof( outnodefilename ) );
|
||||||
strcpy( outelefilename, innodefilename );
|
Q_strncpyz( outelefilename, innodefilename, sizeof( outelefilename ) );
|
||||||
strcpy( edgefilename, innodefilename );
|
Q_strncpyz( edgefilename, innodefilename, sizeof( edgefilename ) );
|
||||||
strcpy( vnodefilename, innodefilename );
|
Q_strncpyz( vnodefilename, innodefilename, sizeof( vnodefilename ) );
|
||||||
strcpy( vedgefilename, innodefilename );
|
Q_strncpyz( vedgefilename, innodefilename, sizeof( vedgefilename ) );
|
||||||
strcpy( neighborfilename, innodefilename );
|
Q_strncpyz( neighborfilename, innodefilename, sizeof( neighborfilename ) );
|
||||||
strcpy( offfilename, innodefilename );
|
Q_strncpyz( offfilename, innodefilename, sizeof( offfilename ) );
|
||||||
strcat( outnodefilename, ".node" );
|
strncat( outnodefilename, ".node", sizeof( outnodefilename ) );
|
||||||
strcat( outelefilename, ".ele" );
|
strncat( outelefilename, ".ele", sizeof( outelefilename ) );
|
||||||
strcat( edgefilename, ".edge" );
|
strncat( edgefilename, ".edge", sizeof( edgefilename ) );
|
||||||
strcat( vnodefilename, ".v.node" );
|
strncat( vnodefilename, ".v.node", sizeof( vnodefilename ) );
|
||||||
strcat( vedgefilename, ".v.edge" );
|
strncat( vedgefilename, ".v.edge", sizeof( vedgefilename ) );
|
||||||
strcat( neighborfilename, ".neigh" );
|
strncat( neighborfilename, ".neigh", sizeof( neighborfilename ) );
|
||||||
strcat( offfilename, ".off" );
|
strncat( offfilename, ".off", sizeof( offfilename ) );
|
||||||
}
|
}
|
||||||
else if ( increment == 0 ) {
|
else if ( increment == 0 ) {
|
||||||
strcpy( outnodefilename, innodefilename );
|
Q_strncpyz( outnodefilename, innodefilename, sizeof( outnodefilename ) );
|
||||||
strcpy( outpolyfilename, innodefilename );
|
Q_strncpyz( outpolyfilename, innodefilename, sizeof( outpolyfilename ) );
|
||||||
strcpy( outelefilename, innodefilename );
|
Q_strncpyz( outelefilename, innodefilename, sizeof( outelefilename ) );
|
||||||
strcpy( edgefilename, innodefilename );
|
Q_strncpyz( edgefilename, innodefilename, sizeof( edgefilename ) );
|
||||||
strcpy( vnodefilename, innodefilename );
|
Q_strncpyz( vnodefilename, innodefilename, sizeof( vnodefilename ) );
|
||||||
strcpy( vedgefilename, innodefilename );
|
Q_strncpyz( vedgefilename, innodefilename, sizeof( vedgefilename ) );
|
||||||
strcpy( neighborfilename, innodefilename );
|
Q_strncpyz( neighborfilename, innodefilename, sizeof( neighborfilename ) );
|
||||||
strcpy( offfilename, innodefilename );
|
Q_strncpyz( offfilename, innodefilename, sizeof( offfilename ) );
|
||||||
strcat( outnodefilename, ".1.node" );
|
strncat( outnodefilename, ".1.node", sizeof( outnodefilename ) );
|
||||||
strcat( outpolyfilename, ".1.poly" );
|
strncat( outpolyfilename, ".1.poly", sizeof( outpolyfilename ) );
|
||||||
strcat( outelefilename, ".1.ele" );
|
strncat( outelefilename, ".1.ele", sizeof( outelefilename ) );
|
||||||
strcat( edgefilename, ".1.edge" );
|
strncat( edgefilename, ".1.edge", sizeof( edgefilename ) );
|
||||||
strcat( vnodefilename, ".1.v.node" );
|
strncat( vnodefilename, ".1.v.node", sizeof( vnodefilename ) );
|
||||||
strcat( vedgefilename, ".1.v.edge" );
|
strncat( vedgefilename, ".1.v.edge", sizeof( vedgefilename ) );
|
||||||
strcat( neighborfilename, ".1.neigh" );
|
strncat( neighborfilename, ".1.neigh", sizeof( neighborfilename ) );
|
||||||
strcat( offfilename, ".1.off" );
|
strncat( offfilename, ".1.off", sizeof( offfilename ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
workstring[increment] = '%';
|
workstring[increment] = '%';
|
||||||
workstring[increment + 1] = 'd';
|
workstring[increment + 1] = 'd';
|
||||||
workstring[increment + 2] = '\0';
|
workstring[increment + 2] = '\0';
|
||||||
sprintf( outnodefilename, workstring, meshnumber + 1 );
|
snprintf( outnodefilename, sizeof( outnodefilename ), workstring, meshnumber + 1 );
|
||||||
strcpy( outpolyfilename, outnodefilename );
|
Q_strncpyz( outpolyfilename, outnodefilename, sizeof( outpolyfilename ) );
|
||||||
strcpy( outelefilename, outnodefilename );
|
Q_strncpyz( outelefilename, outnodefilename, sizeof( outelefilename ) );
|
||||||
strcpy( edgefilename, outnodefilename );
|
Q_strncpyz( edgefilename, outnodefilename, sizeof( edgefilename ) );
|
||||||
strcpy( vnodefilename, outnodefilename );
|
Q_strncpyz( vnodefilename, outnodefilename, sizeof( vnodefilename ) );
|
||||||
strcpy( vedgefilename, outnodefilename );
|
Q_strncpyz( vedgefilename, outnodefilename, sizeof( vedgefilename ) );
|
||||||
strcpy( neighborfilename, outnodefilename );
|
Q_strncpyz( neighborfilename, outnodefilename, sizeof( neighborfilename ) );
|
||||||
strcpy( offfilename, outnodefilename );
|
Q_strncpyz( offfilename, outnodefilename, sizeof( offfilename ) );
|
||||||
strcat( outnodefilename, ".node" );
|
strncat( outnodefilename, ".node", sizeof( outnodefilename ) );
|
||||||
strcat( outpolyfilename, ".poly" );
|
strncat( outpolyfilename, ".poly", sizeof( outpolyfilename ) );
|
||||||
strcat( outelefilename, ".ele" );
|
strncat( outelefilename, ".ele", sizeof( outelefilename ) );
|
||||||
strcat( edgefilename, ".edge" );
|
strncat( edgefilename, ".edge", sizeof( edgefilename ) );
|
||||||
strcat( vnodefilename, ".v.node" );
|
strncat( vnodefilename, ".v.node", sizeof( vnodefilename ) );
|
||||||
strcat( vedgefilename, ".v.edge" );
|
strncat( vedgefilename, ".v.edge", sizeof( vedgefilename ) );
|
||||||
strcat( neighborfilename, ".neigh" );
|
strncat( neighborfilename, ".neigh", sizeof( neighborfilename ) );
|
||||||
strcat( offfilename, ".off" );
|
strncat( offfilename, ".off", sizeof( offfilename ) );
|
||||||
}
|
}
|
||||||
strcat( innodefilename, ".node" );
|
strncat( innodefilename, ".node", sizeof( innodefilename ) );
|
||||||
strcat( inpolyfilename, ".poly" );
|
strncat( inpolyfilename, ".poly", sizeof( inpolyfilename ) );
|
||||||
strcat( inelefilename, ".ele" );
|
strncat( inelefilename, ".ele", sizeof( inelefilename ) );
|
||||||
strcat( areafilename, ".area" );
|
strncat( areafilename, ".area", sizeof( areafilename ) );
|
||||||
#endif /* not TRILIBRARY */
|
#endif /* not TRILIBRARY */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10046,7 +10050,7 @@ char *polyfilename;
|
||||||
printf( "Inserting segments into Delaunay triangulation.\n" );
|
printf( "Inserting segments into Delaunay triangulation.\n" );
|
||||||
}
|
}
|
||||||
#ifdef TRILIBRARY
|
#ifdef TRILIBRARY
|
||||||
strcpy( polyfilename, "input" );
|
Q_strncpyz( polyfilename, "input", sizeof( polyfilename ) );
|
||||||
segments = numberofsegments;
|
segments = numberofsegments;
|
||||||
segmentmarkers = segmentmarkerlist != (int *) NULL;
|
segmentmarkers = segmentmarkerlist != (int *) NULL;
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
|
@ -320,14 +320,14 @@ static void motion( GtkWidget *widget, GdkEventMotion *event, gpointer data ){
|
||||||
{
|
{
|
||||||
case PLANE_XZ0:
|
case PLANE_XZ0:
|
||||||
case PLANE_XZ1:
|
case PLANE_XZ1:
|
||||||
sprintf( Text," x=%d, z=%d ",(int)( floor( x - 0.5 ) + 1. ),(int)( floor( y - 0.5 ) + 1. ) );
|
snprintf( Text, sizeof( Text ), " x=%d, z=%d ", (int)( floor( x - 0.5 ) + 1. ), (int)( floor( y - 0.5 ) + 1. ) );
|
||||||
break;
|
break;
|
||||||
case PLANE_YZ0:
|
case PLANE_YZ0:
|
||||||
case PLANE_YZ1:
|
case PLANE_YZ1:
|
||||||
sprintf( Text," y=%d, z=%d ",(int)( floor( x - 0.5 ) + 1. ),(int)( floor( y - 0.5 ) + 1. ) );
|
snprintf( Text, sizeof( Text ), " y=%d, z=%d ", (int)( floor( x - 0.5 ) + 1. ), (int)( floor( y - 0.5 ) + 1. ) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf( Text," x=%d, y=%d ",(int)( floor( x - 0.5 ) + 1. ),(int)( floor( y - 0.5 ) + 1. ) );
|
snprintf( Text, sizeof( Text ), " x=%d, y=%d ", (int)( floor( x - 0.5 ) + 1. ), (int)( floor( y - 0.5 ) + 1. ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
texfont_write( Text, rcCoord.left, rcCoord.top );
|
texfont_write( Text, rcCoord.left, rcCoord.top );
|
||||||
|
|
|
@ -146,7 +146,7 @@ GSList *AddToWadList( GSList *wadlist, const char *shadername, const char *wad )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "HydraToolz: WARNING: Unknown wad file for shader %s\n",shadername );
|
Sys_FPrintf( SYS_WRN, "HydraToolz: WARNING: Unknown wad file for shader %s\n",shadername );
|
||||||
return wadlist;
|
return wadlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ void UpdateWadKeyPair( void ){
|
||||||
for ( pEpair = pEntity->epairs; pEpair != NULL; pEpair = pEpair->next )
|
for ( pEpair = pEntity->epairs; pEpair != NULL; pEpair = pEpair->next )
|
||||||
{
|
{
|
||||||
if ( stricmp( pEpair->key,"wad" ) == 0 ) {
|
if ( stricmp( pEpair->key,"wad" ) == 0 ) {
|
||||||
strcpy( wads,pEpair->value );
|
Q_strncpyz( wads, pEpair->value, sizeof( wads ) );
|
||||||
HYDRA_ConvertDOSToUnixName( wads,wads );
|
HYDRA_ConvertDOSToUnixName( wads,wads );
|
||||||
|
|
||||||
Sys_Printf( "HydraToolz: Current wad key is \"%s\"!\n",wads );
|
Sys_Printf( "HydraToolz: Current wad key is \"%s\"!\n",wads );
|
||||||
|
@ -295,18 +295,18 @@ void UpdateWadKeyPair( void ){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( wads[0] ) {
|
if ( wads[0] ) {
|
||||||
strcat( wads,";" );
|
strncat( wads, ";", sizeof( wads ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
actualwad = vfsGetFullPath( (char *)wadlist->data, 0, 0 );
|
actualwad = vfsGetFullPath( (char *)wadlist->data, 0, 0 );
|
||||||
|
|
||||||
if ( actualwad ) {
|
if ( actualwad ) {
|
||||||
strcat( wads, actualwad );
|
strncat( wads, actualwad, sizeof( wads ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_FPrintf( SYS_WRN, "WARNING: could not locate wad file %s\n",(char *)wadlist->data );
|
Sys_FPrintf( SYS_WRN, "WARNING: could not locate wad file %s\n",(char *)wadlist->data );
|
||||||
strcat( wads, (char *)wadlist->data );
|
strncat( wads, (char *)wadlist->data, sizeof( wads ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,17 +99,17 @@ static int DoColor( COLORREF *c ){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Set2DText( GtkWidget* label ){
|
static void Set2DText( GtkWidget* label ){
|
||||||
char s[40];
|
char s[64];
|
||||||
|
|
||||||
sprintf( s, "Line Width = %6.3f", portals.width_2d * 0.5f );
|
snprintf( s, sizeof( s ), "Line Width = %6.3f", portals.width_2d * 0.5f );
|
||||||
|
|
||||||
gtk_label_set_text( GTK_LABEL( label ), s );
|
gtk_label_set_text( GTK_LABEL( label ), s );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Set3DText( GtkWidget* label ){
|
static void Set3DText( GtkWidget* label ){
|
||||||
char s[40];
|
char s[64];
|
||||||
|
|
||||||
sprintf( s, "Line Width = %6.3f", portals.width_3d * 0.5f );
|
snprintf( s, sizeof( s ), "Line Width = %6.3f", portals.width_3d * 0.5f );
|
||||||
|
|
||||||
gtk_label_set_text( GTK_LABEL( label ), s );
|
gtk_label_set_text( GTK_LABEL( label ), s );
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ static void Set3DText( GtkWidget* label ){
|
||||||
static void Set3DTransText( GtkWidget* label ){
|
static void Set3DTransText( GtkWidget* label ){
|
||||||
char s[40];
|
char s[40];
|
||||||
|
|
||||||
sprintf( s, "Polygon transparency = %d%%", (int)portals.trans_3d );
|
snprintf( s, sizeof( s ), "Polygon transparency = %d%%", (int)portals.trans_3d );
|
||||||
|
|
||||||
gtk_label_set_text( GTK_LABEL( label ), s );
|
gtk_label_set_text( GTK_LABEL( label ), s );
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ static void Set3DTransText( GtkWidget* label ){
|
||||||
static void SetClipText( GtkWidget* label ){
|
static void SetClipText( GtkWidget* label ){
|
||||||
char s[40];
|
char s[40];
|
||||||
|
|
||||||
sprintf( s, "Cubic clip range = %d", (int)portals.clip_range * 64 );
|
snprintf( s, sizeof( s ), "Cubic clip range = %d", (int)portals.clip_range * 64 );
|
||||||
|
|
||||||
gtk_label_set_text( GTK_LABEL( label ), s );
|
gtk_label_set_text( GTK_LABEL( label ), s );
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,11 +159,11 @@ int DoLoadPortalFileDialog(){
|
||||||
gtk_widget_set_usize( button, 60, -2 );
|
gtk_widget_set_usize( button, 60, -2 );
|
||||||
|
|
||||||
char *fn = g_FuncTable.m_pfnGetMapName();
|
char *fn = g_FuncTable.m_pfnGetMapName();
|
||||||
strcpy( portals.fn, fn );
|
Q_strncpyz( portals.fn, fn, sizeof( portals.fn ) );
|
||||||
fn = strrchr( portals.fn, '.' );
|
fn = strrchr( portals.fn, '.' );
|
||||||
if ( fn != NULL ) {
|
if ( fn != NULL ) {
|
||||||
*fn = '\0';
|
*fn = '\0';
|
||||||
strcat( portals.fn, ".prt" );
|
strncat( portals.fn, ".prt", sizeof( portals.fn ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_entry_set_text( GTK_ENTRY( entry ), portals.fn );
|
gtk_entry_set_text( GTK_ENTRY( entry ), portals.fn );
|
||||||
|
|
|
@ -55,6 +55,8 @@ static char INIfn[NAME_MAX];
|
||||||
#define CLIP_RANGE "ClipRange"
|
#define CLIP_RANGE "ClipRange"
|
||||||
#define CLIP "Clip"
|
#define CLIP "Clip"
|
||||||
|
|
||||||
|
void *g_pMainWidget = NULL;
|
||||||
|
|
||||||
void InitInstance(){
|
void InitInstance(){
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char fn[_MAX_PATH];
|
char fn[_MAX_PATH];
|
||||||
|
@ -67,15 +69,15 @@ void InitInstance(){
|
||||||
|
|
||||||
_splitpath( fn, fn_drive, fn_dir, fn_name, fn_ext );
|
_splitpath( fn, fn_drive, fn_dir, fn_name, fn_ext );
|
||||||
|
|
||||||
strcpy( INIfn, fn_drive );
|
Q_strncpyz( INIfn, fn_drive, sizeof( INIfn ) );
|
||||||
strcat( INIfn, fn_dir );
|
strncat( INIfn, fn_dir, sizeof( INIfn ) );
|
||||||
strcat( INIfn, fn_name );
|
strncat( INIfn, fn_name, sizeof( INIfn ) );
|
||||||
strcat( INIfn, ".ini" );
|
strncat( INIfn, ".ini", sizeof( INIfn ) );
|
||||||
#else // if def __linux__
|
#else // if def __linux__
|
||||||
strcpy( INIfn, g_get_home_dir() );
|
Q_strncpyz( INIfn, g_get_home_dir(), sizeof( INIfn ) );
|
||||||
strcat( INIfn, "/.radiant/" );
|
strncat( INIfn, "/.radiant/", sizeof( INIfn ) );
|
||||||
strcat( INIfn, RADIANT_VERSION );
|
strncat( INIfn, RADIANT_VERSION, sizeof( INIfn ) );
|
||||||
strcat( INIfn, "/prtview.ini" );
|
strncat( INIfn, "/prtview.ini", sizeof( INIfn ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
portals.show_2d = INIGetInt( RENDER_2D, FALSE ) ? true : false;
|
portals.show_2d = INIGetInt( RENDER_2D, FALSE ) ? true : false;
|
||||||
|
@ -166,7 +168,7 @@ _QERQglTable g_QglTable;
|
||||||
|
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
|
|
||||||
static bool read_var( const char *filename, const char *section, const char *key, char *value ){
|
static bool read_var( const char *filename, const char *section, const char *key, char *value, size_t length ){
|
||||||
char line[1024], *ptr;
|
char line[1024], *ptr;
|
||||||
FILE *rc;
|
FILE *rc;
|
||||||
|
|
||||||
|
@ -199,7 +201,7 @@ static bool read_var( const char *filename, const char *section, const char *key
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
|
||||||
if ( strcmp( line, key ) == 0 ) {
|
if ( strcmp( line, key ) == 0 ) {
|
||||||
strcpy( value, ptr + 1 );
|
Q_strncpyz( value, ptr + 1, length );
|
||||||
fclose( rc );
|
fclose( rc );
|
||||||
|
|
||||||
while ( value[strlen( value ) - 1] == 10 ||
|
while ( value[strlen( value ) - 1] == 10 ||
|
||||||
|
@ -317,7 +319,7 @@ int INIGetInt( const char *key, int def ){
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
char value[1024];
|
char value[1024];
|
||||||
|
|
||||||
if ( read_var( INIfn, CONFIG_SECTION, key, value ) ) {
|
if ( read_var( INIfn, CONFIG_SECTION, key, value, sizeof( value ) ) ) {
|
||||||
return atoi( value );
|
return atoi( value );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -332,10 +334,10 @@ void INISetInt( const char *key, int val, const char *comment /* = NULL */ ){
|
||||||
char s[1000];
|
char s[1000];
|
||||||
|
|
||||||
if ( comment ) {
|
if ( comment ) {
|
||||||
sprintf( s, "%d ; %s", val, comment );
|
snprintf( s, sizeof( s ), "%d ; %s", val, comment );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
sprintf( s, "%d", val );
|
snprintf( s, sizeof( s ), "%d", val );
|
||||||
}
|
}
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
save_var( INIfn, CONFIG_SECTION, key, s );
|
save_var( INIfn, CONFIG_SECTION, key, s );
|
||||||
|
@ -387,7 +389,7 @@ extern "C" const char* QERPlug_GetCommandList(){
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
||||||
va_start (argptr,text);
|
va_start (argptr,text);
|
||||||
vsprintf (buf, text, argptr);
|
vsnprintf (buf, sizeof( buf ), text, argptr);
|
||||||
va_end (argptr);
|
va_end (argptr);
|
||||||
|
|
||||||
g_FuncTable.m_pfnSysMsg (buf);
|
g_FuncTable.m_pfnSysMsg (buf);
|
||||||
|
|
|
@ -33,6 +33,12 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#ifndef Q_strncpyz
|
||||||
|
#define Q_strncpyz(_dst, _source, _len) do { strncpy((_dst), (_source), (_len) - 1); (_dst)[(_len) - 1] = 0; } while( 0 )
|
||||||
|
#endif
|
||||||
// TTimo
|
// TTimo
|
||||||
// ideally the plugin API would be UI toolkit independent, but removing the dependency with GLib seems tricky right now..
|
// ideally the plugin API would be UI toolkit independent, but removing the dependency with GLib seems tricky right now..
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
|
@ -49,14 +49,26 @@
|
||||||
#define Q_mkdir( a,b ) mkdir( a,b )
|
#define Q_mkdir( a,b ) mkdir( a,b )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DefaultExtension( char *path, char *extension );
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined safe_malloc)
|
||||||
void DefaultPath( char *path, char *basepath );
|
void *safe_malloc( size_t size );
|
||||||
|
void *safe_malloc_info( size_t size, char* info );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#ifndef Q_strncpyz
|
||||||
|
#define Q_strncpyz(_dst, _source, _len) do { strncpy((_dst), (_source), (_len) - 1); if ((_len) > 0) (_dst)[(_len) - 1] = 0; } while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void DefaultExtension( char *path, char *extension, size_t length );
|
||||||
|
void DefaultPath( char *path, const char *basepath, size_t length );
|
||||||
void StripFilename( char *path );
|
void StripFilename( char *path );
|
||||||
void StripExtension( char *path );
|
void StripExtension( char *path );
|
||||||
void ExtractFilePath( const char *path, char *dest );
|
void ExtractFilePath( const char *path, char *dest, size_t size );
|
||||||
void ExtractFileName( const char *path, char *dest );
|
void ExtractFileName( const char *path, char *dest, size_t size );
|
||||||
void ExtractFileBase( const char *path, char *dest );
|
void ExtractFileBase( const char *path, char *dest, size_t size );
|
||||||
void ExtractFileExtension( const char *path, char *dest );
|
void ExtractFileExtension( const char *path, char *dest, size_t size );
|
||||||
/*!
|
/*!
|
||||||
\brief create all directories leading to a file path. if you pass a directory, terminate it with a '/'
|
\brief create all directories leading to a file path. if you pass a directory, terminate it with a '/'
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,14 +51,14 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateCo
|
||||||
case 0:
|
case 0:
|
||||||
// always concat the command on linux
|
// always concat the command on linux
|
||||||
if ( cmd ) {
|
if ( cmd ) {
|
||||||
strcpy( fullcmd, cmd );
|
Q_strncpyz( fullcmd, cmd, sizeof( fullcmd ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fullcmd[0] = '\0';
|
fullcmd[0] = '\0';
|
||||||
}
|
}
|
||||||
if ( cmdline ) {
|
if ( cmdline ) {
|
||||||
strcat( fullcmd, " " );
|
strncat( fullcmd, " ", sizeof( fullcmd ) );
|
||||||
strcat( fullcmd, cmdline );
|
strncat( fullcmd, cmdline, sizeof( fullcmd ) );
|
||||||
}
|
}
|
||||||
pCmd = fullcmd;
|
pCmd = fullcmd;
|
||||||
while ( *pCmd == ' ' )
|
while ( *pCmd == ' ' )
|
||||||
|
@ -159,7 +159,7 @@ int Q_filelength( FILE *f ){
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultExtension( char *path, char *extension ){
|
void DefaultExtension( char *path, char *extension, size_t length ){
|
||||||
char *src;
|
char *src;
|
||||||
//
|
//
|
||||||
// if path doesn't have a .EXT, append extension
|
// if path doesn't have a .EXT, append extension
|
||||||
|
@ -175,18 +175,18 @@ void DefaultExtension( char *path, char *extension ){
|
||||||
src--;
|
src--;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( path, extension );
|
strncat( path, extension, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultPath( char *path, char *basepath ){
|
void DefaultPath( char *path, const char *basepath, size_t length ){
|
||||||
char temp[128];
|
char temp[PATH_MAX];
|
||||||
|
|
||||||
if ( path[0] == PATHSEPERATOR ) {
|
if ( path[0] == PATHSEPERATOR ) {
|
||||||
return; // absolute path location
|
return; // absolute path location
|
||||||
}
|
}
|
||||||
strcpy( temp,path );
|
Q_strncpyz( temp, path, sizeof( temp ) );
|
||||||
strcpy( path,basepath );
|
Q_strncpyz( path, basepath, length );
|
||||||
strcat( path,temp );
|
strncat( path, temp, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,8 +221,9 @@ void StripExtension( char *path ){
|
||||||
Extract file parts
|
Extract file parts
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void ExtractFilePath( const char *path, char *dest ){
|
void ExtractFilePath( const char *path, char *dest, size_t size ){
|
||||||
const char *src;
|
const char *src;
|
||||||
|
size_t length;
|
||||||
|
|
||||||
src = path + strlen( path ) - 1;
|
src = path + strlen( path ) - 1;
|
||||||
|
|
||||||
|
@ -232,13 +233,20 @@ void ExtractFilePath( const char *path, char *dest ){
|
||||||
while ( src != path && *( src - 1 ) != '/' && *( src - 1 ) != '\\' )
|
while ( src != path && *( src - 1 ) != '/' && *( src - 1 ) != '\\' )
|
||||||
src--;
|
src--;
|
||||||
|
|
||||||
memcpy( dest, path, src - path );
|
length = src - path;
|
||||||
dest[src - path] = 0;
|
if( length + 1 > size )
|
||||||
|
{
|
||||||
|
length = size - 1;
|
||||||
|
}
|
||||||
|
memcpy( dest, path, length );
|
||||||
|
dest[length] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractFileName( const char *path, char *dest ){
|
void ExtractFileName( const char *path, char *dest, size_t size ){
|
||||||
const char *src;
|
const char *src;
|
||||||
|
|
||||||
|
if( size <= 0 )
|
||||||
|
return;
|
||||||
src = path + strlen( path ) - 1;
|
src = path + strlen( path ) - 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -250,7 +258,13 @@ void ExtractFileName( const char *path, char *dest ){
|
||||||
|
|
||||||
while ( *src )
|
while ( *src )
|
||||||
{
|
{
|
||||||
|
if( size == 1 )
|
||||||
|
{
|
||||||
|
*dest = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
|
size--;
|
||||||
}
|
}
|
||||||
*dest = 0;
|
*dest = 0;
|
||||||
}
|
}
|
||||||
|
@ -278,14 +292,18 @@ inline unsigned int filename_get_base_length( const char* filename ){
|
||||||
return ( last_period != NULL ) ? last_period - filename : strlen( filename );
|
return ( last_period != NULL ) ? last_period - filename : strlen( filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractFileBase( const char *path, char *dest ){
|
void ExtractFileBase( const char *path, char *dest, size_t size ){
|
||||||
const char* filename = path_get_filename_start( path );
|
const char* filename = path_get_filename_start( path );
|
||||||
unsigned int length = filename_get_base_length( filename );
|
unsigned int length = filename_get_base_length( filename );
|
||||||
|
if( length > size )
|
||||||
|
{
|
||||||
|
length = size - 1;
|
||||||
|
}
|
||||||
strncpy( dest, filename, length );
|
strncpy( dest, filename, length );
|
||||||
dest[length] = '\0';
|
dest[length] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractFileExtension( const char *path, char *dest ){
|
void ExtractFileExtension( const char *path, char *dest, size_t size ){
|
||||||
const char *src;
|
const char *src;
|
||||||
|
|
||||||
src = path + strlen( path ) - 1;
|
src = path + strlen( path ) - 1;
|
||||||
|
@ -300,7 +318,7 @@ void ExtractFileExtension( const char *path, char *dest ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( dest,src );
|
Q_strncpyz( dest, src, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,7 +356,7 @@ void CreateDirectoryPath( const char *path ) {
|
||||||
char *src;
|
char *src;
|
||||||
char back;
|
char back;
|
||||||
|
|
||||||
ExtractFilePath( path, base );
|
ExtractFilePath( path, base, sizeof( base ) );
|
||||||
|
|
||||||
src = base + 1;
|
src = base + 1;
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ void WinPrint( char *str, ... ){
|
||||||
char text[4096];
|
char text[4096];
|
||||||
|
|
||||||
va_start( argptr,str );
|
va_start( argptr,str );
|
||||||
vsprintf( text, str, argptr );
|
vsnprintf( text, sizeof( text ), str, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
printf("%s", text );
|
printf("%s", text );
|
||||||
|
|
|
@ -263,7 +263,7 @@ void _pico_printf( int level, const char *format, ... ){
|
||||||
|
|
||||||
/* format string */
|
/* format string */
|
||||||
va_start( argptr,format );
|
va_start( argptr,format );
|
||||||
vsprintf( str,format,argptr );
|
vsnprintf( str, sizeof( str ), format, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
/* remove linefeeds */
|
/* remove linefeeds */
|
||||||
|
@ -629,7 +629,7 @@ char *_pico_nopath( const char *path ){
|
||||||
* or filepath's filename portion. the given 'path' *is*
|
* or filepath's filename portion. the given 'path' *is*
|
||||||
* altered. leave 'ext' empty to remove extension. -sea
|
* altered. leave 'ext' empty to remove extension. -sea
|
||||||
*/
|
*/
|
||||||
char *_pico_setfext( char *path, const char *ext ){
|
char *_pico_setfext( char *path, const char *ext, size_t length ){
|
||||||
char *src;
|
char *src;
|
||||||
int remfext = 0;
|
int remfext = 0;
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ char *_pico_setfext( char *path, const char *ext ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcat( path,ext );
|
strncat( path, ext, length );
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,12 @@ extern "C"
|
||||||
|
|
||||||
#include "picomodel.h"
|
#include "picomodel.h"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#ifndef Q_strncpyz
|
||||||
|
#define Q_strncpyz(_dst, _source, _len) do { strncpy((_dst), (_source), (_len) - 1); if ((_len) > 0) (_dst)[(_len) - 1] = 0; } while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
/* os dependant replacements */
|
/* os dependant replacements */
|
||||||
#if WIN32 || _WIN32
|
#if WIN32 || _WIN32
|
||||||
|
@ -132,7 +138,7 @@ char *_pico_stristr( char *str, const char *substr );
|
||||||
void _pico_unixify( char *path );
|
void _pico_unixify( char *path );
|
||||||
int _pico_nofname( const char *path, char *dest, int destSize );
|
int _pico_nofname( const char *path, char *dest, int destSize );
|
||||||
char *_pico_nopath( const char *path );
|
char *_pico_nopath( const char *path );
|
||||||
char *_pico_setfext( char *path, const char *ext );
|
char *_pico_setfext( char *path, const char *ext, size_t length );
|
||||||
int _pico_getline( char *buf, int bufsize, char *dest, int destsize );
|
int _pico_getline( char *buf, int bufsize, char *dest, int destsize );
|
||||||
char *_pico_strlwr( char *str );
|
char *_pico_strlwr( char *str );
|
||||||
|
|
||||||
|
|
|
@ -212,11 +212,12 @@ picoModel_t *PicoLoadModel( char *fileName, int frameNum ){
|
||||||
/* apply model remappings from <model>.remap */
|
/* apply model remappings from <model>.remap */
|
||||||
if ( strlen( modelFileName ) ) {
|
if ( strlen( modelFileName ) ) {
|
||||||
/* alloc copy of model file name */
|
/* alloc copy of model file name */
|
||||||
remapFileName = _pico_alloc( strlen( modelFileName ) + 20 );
|
size_t length = strlen( modelFileName ) + 20;
|
||||||
|
remapFileName = _pico_alloc( length );
|
||||||
if ( remapFileName != NULL ) {
|
if ( remapFileName != NULL ) {
|
||||||
/* copy model file name and change extension */
|
/* copy model file name and change extension */
|
||||||
strcpy( remapFileName, modelFileName );
|
Q_strncpyz( remapFileName, modelFileName, length );
|
||||||
_pico_setfext( remapFileName, "remap" );
|
_pico_setfext( remapFileName, "remap", length );
|
||||||
|
|
||||||
/* try to remap model; we don't handle the result */
|
/* try to remap model; we don't handle the result */
|
||||||
PicoRemapModel( model, remapFileName );
|
PicoRemapModel( model, remapFileName );
|
||||||
|
@ -509,7 +510,7 @@ picoSurface_t *PicoNewSurface( picoModel_t *model ){
|
||||||
surface->model = model;
|
surface->model = model;
|
||||||
|
|
||||||
/* set default name */
|
/* set default name */
|
||||||
sprintf( surfaceName, "Unnamed_%d", model->numSurfaces );
|
snprintf( surfaceName, sizeof( surfaceName ), "Unnamed_%d", model->numSurfaces );
|
||||||
PicoSetSurfaceName( surface, surfaceName );
|
PicoSetSurfaceName( surface, surfaceName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -421,23 +421,23 @@ static int GetMeshShader( T3dsLoaderPers *pers ){
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
/* copy map name to local buffer */
|
/* copy map name to local buffer */
|
||||||
strcpy( mapName,mapNamePtr );
|
Q_strncpyz( mapName, mapNamePtr, sizeof( mapName ) );
|
||||||
|
|
||||||
/* extract file name */
|
/* extract file name */
|
||||||
name = _pico_nopath( mapName );
|
name = _pico_nopath( mapName );
|
||||||
strncpy( temp, name, sizeof( temp ) );
|
Q_strncpyz( temp, name, sizeof( temp ) );
|
||||||
|
|
||||||
/* remove file extension */
|
/* remove file extension */
|
||||||
/* name = _pico_setfext( name,"" ); */
|
/* name = _pico_setfext( name,"" ); */
|
||||||
|
|
||||||
/* assign default name if no name available */
|
/* assign default name if no name available */
|
||||||
if ( strlen( temp ) < 1 ) {
|
if ( strlen( temp ) < 1 ) {
|
||||||
strcpy( temp,pers->basename );
|
Q_strncpyz( temp, pers->basename, sizeof( temp ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build shader name */
|
/* build shader name */
|
||||||
_pico_strlwr( temp ); /* gaynux update -sea */
|
_pico_strlwr( temp ); /* gaynux update -sea */
|
||||||
sprintf( mapName,"models/mapobjects/%s/%s",pers->basename,temp );
|
snprintf( mapName, sizeof( mapName ), "models/mapobjects/%s/%s", pers->basename, temp );
|
||||||
|
|
||||||
/* set shader name */
|
/* set shader name */
|
||||||
/* PicoSetShaderName( shader,mapName ); */ /* ydnar: this will screw up the named shader */
|
/* PicoSetShaderName( shader,mapName ); */ /* ydnar: this will screw up the named shader */
|
||||||
|
@ -730,9 +730,8 @@ static picoModel_t *_3ds_load( PM_PARAMS_LOAD ){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* get model's base name (eg. jeep from c:\models\jeep.3ds) */
|
/* get model's base name (eg. jeep from c:\models\jeep.3ds) */
|
||||||
memset( basename,0,sizeof( basename ) );
|
Q_strncpyz( basename, _pico_nopath( fileName ), sizeof( basename ) );
|
||||||
strncpy( basename,_pico_nopath( fileName ),sizeof( basename ) );
|
_pico_setfext( basename, "", sizeof( basename ) );
|
||||||
_pico_setfext( basename,"" );
|
|
||||||
|
|
||||||
/* initialize persistant vars (formerly static) */
|
/* initialize persistant vars (formerly static) */
|
||||||
pers.model = model;
|
pers.model = model;
|
||||||
|
|
|
@ -400,7 +400,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* remember node name */
|
/* remember node name */
|
||||||
if ( !_pico_stricmp( p->token,"*node_name" ) ) {
|
if ( !_pico_stricmp( p->token, "*node_name" ) ) {
|
||||||
/* read node name */
|
/* read node name */
|
||||||
char *ptr = _pico_parse( p,0 );
|
char *ptr = _pico_parse( p,0 );
|
||||||
if ( ptr == NULL ) {
|
if ( ptr == NULL ) {
|
||||||
|
@ -408,10 +408,10 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remember node name */
|
/* remember node name */
|
||||||
strncpy( lastNodeName,ptr,sizeof( lastNodeName ) );
|
Q_strncpyz( lastNodeName, ptr, sizeof( lastNodeName ) );
|
||||||
}
|
}
|
||||||
/* model mesh (originally contained within geomobject) */
|
/* model mesh (originally contained within geomobject) */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh" ) ) {
|
else if ( !_pico_stricmp( p->token, "*mesh" ) ) {
|
||||||
/* finish existing surface */
|
/* finish existing surface */
|
||||||
//_ase_make_surface( model, &surface );
|
//_ase_make_surface( model, &surface );
|
||||||
_ase_submit_triangles( surface, model,materials,faces );
|
_ase_submit_triangles( surface, model,materials,faces );
|
||||||
|
@ -796,12 +796,13 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
/* parse material name */
|
/* parse material name */
|
||||||
else if ( !_pico_stricmp( p->token,"*material_name" ) ) {
|
else if ( !_pico_stricmp( p->token,"*material_name" ) ) {
|
||||||
char* name = _pico_parse( p,0 );
|
char* name = _pico_parse( p, 0 );
|
||||||
if ( name == NULL ) {
|
if ( name == NULL ) {
|
||||||
_ase_error_return( "Missing material name" );
|
_ase_error_return( "Missing material name" );
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( materialName, name );
|
Q_strncpyz( materialName, name, sizeof( materialName ) );
|
||||||
|
materialName[sizeof( materialName ) - 1] = 0;
|
||||||
/* skip rest and continue with next token */
|
/* skip rest and continue with next token */
|
||||||
_pico_parse_skip_rest( p );
|
_pico_parse_skip_rest( p );
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -350,7 +350,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
|
||||||
texCoord->t = _pico_little_short( texCoord[i].t );
|
texCoord->t = _pico_little_short( texCoord[i].t );
|
||||||
}
|
}
|
||||||
// set Skin Name
|
// set Skin Name
|
||||||
strncpy( skinname, (char *) fm.fm_skin, FM_SKINPATHSIZE );
|
Q_strncpyz( skinname, (char *) fm.fm_skin, FM_SKINPATHSIZE );
|
||||||
|
|
||||||
#ifdef FM_VERBOSE_DBG
|
#ifdef FM_VERBOSE_DBG
|
||||||
// Print out md2 values
|
// Print out md2 values
|
||||||
|
@ -358,7 +358,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// detox Skin name
|
// detox Skin name
|
||||||
_pico_setfext( skinname, "" );
|
_pico_setfext( skinname, "", sizeof( skinname ) );
|
||||||
_pico_unixify( skinname );
|
_pico_unixify( skinname );
|
||||||
|
|
||||||
/* create new pico model */
|
/* create new pico model */
|
||||||
|
|
|
@ -234,8 +234,8 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* detox and set shader name */
|
/* detox and set shader name */
|
||||||
strncpy( name, surface->name, sizeof( name ) );
|
Q_strncpyz( name, surface->name, sizeof( name ) );
|
||||||
_pico_setfext( name, "" );
|
_pico_setfext( name, "", sizeof( name ) );
|
||||||
_pico_unixify( name );
|
_pico_unixify( name );
|
||||||
PicoSetShaderName( picoShader, name );
|
PicoSetShaderName( picoShader, name );
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
|
|
||||||
// set Skin Name
|
// set Skin Name
|
||||||
strncpy( skinname, (char *) ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME );
|
Q_strncpyz( skinname, (char *) ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME );
|
||||||
|
|
||||||
// Print out md2 values
|
// Print out md2 values
|
||||||
_pico_printf( PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname );
|
_pico_printf( PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname );
|
||||||
|
@ -439,7 +439,8 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
|
||||||
// relative texture path - allows moving of models in game dir structure without changing the skinpath
|
// relative texture path - allows moving of models in game dir structure without changing the skinpath
|
||||||
// e.g. used in ufo:ai
|
// e.g. used in ufo:ai
|
||||||
if ( skinname[0] == '.' ) {
|
if ( skinname[0] == '.' ) {
|
||||||
strncpy( path, fileName, MD2_MAX_SKINNAME );
|
Q_strncpyz( path, fileName, MD2_MAX_SKINNAME );
|
||||||
|
|
||||||
for ( i = MD2_MAX_SKINNAME; i--; ) {
|
for ( i = MD2_MAX_SKINNAME; i--; ) {
|
||||||
// skip filename
|
// skip filename
|
||||||
if ( path[i] == '/' || path[i] == '\\' ) {
|
if ( path[i] == '/' || path[i] == '\\' ) {
|
||||||
|
@ -448,14 +449,14 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
|
||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
}
|
}
|
||||||
strncat( path, &skinname[1], MD2_MAX_SKINNAME );
|
strncat( path, &skinname[1], MD2_MAX_SKINNAME );
|
||||||
strncpy( skinname, path, MD2_MAX_SKINNAME );
|
Q_strncpyz( skinname, path, MD2_MAX_SKINNAME );
|
||||||
|
|
||||||
// Print out md2 values
|
// Print out md2 values
|
||||||
_pico_printf( PICO_VERBOSE,"Relative skin path converted to: \"%s\" (%s)\n", skinname, fileName );
|
_pico_printf( PICO_VERBOSE,"Relative skin path converted to: \"%s\" (%s)\n", skinname, fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
// detox Skin name
|
// detox Skin name
|
||||||
_pico_setfext( skinname, "" );
|
_pico_setfext( skinname, "", sizeof( skinname ) );
|
||||||
_pico_unixify( skinname );
|
_pico_unixify( skinname );
|
||||||
|
|
||||||
/* create new pico model */
|
/* create new pico model */
|
||||||
|
|
|
@ -344,7 +344,7 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
|
||||||
|
|
||||||
/* detox and set shader name */
|
/* detox and set shader name */
|
||||||
shader = (md3Shader_t*) ( (picoByte_t*) surface + surface->ofsShaders );
|
shader = (md3Shader_t*) ( (picoByte_t*) surface + surface->ofsShaders );
|
||||||
_pico_setfext( shader->name, "" );
|
_pico_setfext( shader->name, "", sizeof( shader->name ) );
|
||||||
_pico_unixify( shader->name );
|
_pico_unixify( shader->name );
|
||||||
PicoSetShaderName( picoShader, shader->name );
|
PicoSetShaderName( picoShader, shader->name );
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,7 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
|
||||||
|
|
||||||
/* detox and set shader name */
|
/* detox and set shader name */
|
||||||
shader = (mdcShader_t*) ( (picoByte_t*) surface + surface->ofsShaders );
|
shader = (mdcShader_t*) ( (picoByte_t*) surface + surface->ofsShaders );
|
||||||
_pico_setfext( shader->name, "" );
|
_pico_setfext( shader->name, "", sizeof( shader->name ) );
|
||||||
_pico_unixify( shader->name );
|
_pico_unixify( shader->name );
|
||||||
PicoSetShaderName( picoShader, shader->name );
|
PicoSetShaderName( picoShader, shader->name );
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
|
||||||
/* some obj exporters feel like they don't need to */
|
/* some obj exporters feel like they don't need to */
|
||||||
/* supply a group name. so we gotta handle it here */
|
/* supply a group name. so we gotta handle it here */
|
||||||
#if 1
|
#if 1
|
||||||
strcpy( p->token,"default" );
|
strcpy( p->token, "default" );
|
||||||
groupName = p->token;
|
groupName = p->token;
|
||||||
#else
|
#else
|
||||||
_obj_error_return( "Invalid or missing group name" );
|
_obj_error_return( "Invalid or missing group name" );
|
||||||
|
|
|
@ -136,7 +136,7 @@ idVec3 LerpVector( idVec3 &w1, idVec3 &w2, const float t ) {
|
||||||
*/
|
*/
|
||||||
char *idVec3::string( void ) {
|
char *idVec3::string( void ) {
|
||||||
static int index = 0;
|
static int index = 0;
|
||||||
static char str[ 8 ][ 36 ];
|
static char str[ 8 ][ 256 ];
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
// use an array so that multiple toString's won't collide
|
// use an array so that multiple toString's won't collide
|
||||||
|
|
|
@ -100,7 +100,7 @@ void Com_ScriptError( const char *msg, ... ) {
|
||||||
char string[32000];
|
char string[32000];
|
||||||
|
|
||||||
va_start( argptr, msg );
|
va_start( argptr, msg );
|
||||||
vsprintf( string, msg,argptr );
|
vsnprintf( string, sizeof( string ), msg, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Com_Error( ERR_DROP, "File %s, line %i: %s", pi->parseFile, pi->lines, string );
|
Com_Error( ERR_DROP, "File %s, line %i: %s", pi->parseFile, pi->lines, string );
|
||||||
|
@ -111,7 +111,7 @@ void Com_ScriptWarning( const char *msg, ... ) {
|
||||||
char string[32000];
|
char string[32000];
|
||||||
|
|
||||||
va_start( argptr, msg );
|
va_start( argptr, msg );
|
||||||
vsprintf( string, msg,argptr );
|
vsnprintf( string, sizeof( string ), msg, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Com_Printf( "File %s, line %i: %s", pi->parseFile, pi->lines, string );
|
Com_Printf( "File %s, line %i: %s", pi->parseFile, pi->lines, string );
|
||||||
|
|
|
@ -472,7 +472,7 @@ int Com_ParseInfos( const char *buf, int max, char infos[][MAX_INFO_STRING] ) {
|
||||||
if ( !token[0] ) {
|
if ( !token[0] ) {
|
||||||
token = "<NULL>";
|
token = "<NULL>";
|
||||||
}
|
}
|
||||||
Info_SetValueForKey( infos[count], key, token );
|
Info_SetValueForKey( infos[count], key, token, sizeof( infos[count] ) );
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... ) {
|
||||||
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
|
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
|
||||||
|
|
||||||
va_start( argptr,fmt );
|
va_start( argptr,fmt );
|
||||||
len = vsprintf( bigbuffer,fmt,argptr );
|
len = vsnprintf( bigbuffer, sizeof( bigbuffer ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
if ( len < 0 ) {
|
if ( len < 0 ) {
|
||||||
Com_Error( ERR_FATAL, "Com_sprintf: failed to write bigbuffer" );
|
Com_Error( ERR_FATAL, "Com_sprintf: failed to write bigbuffer" );
|
||||||
|
@ -729,7 +729,7 @@ char * QDECL va( const char *format, ... ) {
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
va_start( argptr, format );
|
va_start( argptr, format );
|
||||||
vsprintf( buf, format,argptr );
|
vsnprintf( buf, sizeof( string[index & 1] ), format, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -932,7 +932,7 @@ qboolean Info_Validate( const char *s ) {
|
||||||
Changes or adds a key/value pair
|
Changes or adds a key/value pair
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void Info_SetValueForKey( char *s, const char *key, const char *value ) {
|
void Info_SetValueForKey( char *s, const char *key, const char *value, size_t length ) {
|
||||||
char newi[MAX_INFO_STRING];
|
char newi[MAX_INFO_STRING];
|
||||||
|
|
||||||
if ( strlen( s ) >= MAX_INFO_STRING ) {
|
if ( strlen( s ) >= MAX_INFO_STRING ) {
|
||||||
|
@ -966,7 +966,7 @@ void Info_SetValueForKey( char *s, const char *key, const char *value ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( s, newi );
|
Q_strcat( s, length, newi );
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
|
@ -771,7 +771,7 @@ int Com_IndexForGrowListElement( const growList_t *list, const void *ele
|
||||||
//
|
//
|
||||||
char *Info_ValueForKey( const char *s, const char *key );
|
char *Info_ValueForKey( const char *s, const char *key );
|
||||||
void Info_RemoveKey( char *s, const char *key );
|
void Info_RemoveKey( char *s, const char *key );
|
||||||
void Info_SetValueForKey( char *s, const char *key, const char *value );
|
void Info_SetValueForKey( char *s, const char *key, const char *value, size_t length );
|
||||||
qboolean Info_Validate( const char *s );
|
qboolean Info_Validate( const char *s );
|
||||||
void Info_NextPair( const char *( *s ), char key[MAX_INFO_KEY], char value[MAX_INFO_VALUE] );
|
void Info_NextPair( const char *( *s ), char key[MAX_INFO_KEY], char value[MAX_INFO_VALUE] );
|
||||||
|
|
||||||
|
|
|
@ -553,8 +553,7 @@ bool idCameraDef::getCameraInfo( long time, idVec3 &origin, idVec3 &direction, f
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
else if ( events[i]->getType() == idCameraEvent::EVENT_FOV ) {
|
else if ( events[i]->getType() == idCameraEvent::EVENT_FOV ) {
|
||||||
memset( buff, 0, sizeof( buff ) );
|
Q_strncpyz( buff, events[i]->getParam(), sizeof( buff ) );
|
||||||
strcpy( buff, events[i]->getParam() );
|
|
||||||
const char *param1 = strtok( buff, " \t,\0" );
|
const char *param1 = strtok( buff, " \t,\0" );
|
||||||
const char *param2 = strtok( NULL, " \t,\0" );
|
const char *param2 = strtok( NULL, " \t,\0" );
|
||||||
float len = ( param2 ) ? atof( param2 ) : 0;
|
float len = ( param2 ) ? atof( param2 ) : 0;
|
||||||
|
@ -574,7 +573,7 @@ bool idCameraDef::getCameraInfo( long time, idVec3 &origin, idVec3 &direction, f
|
||||||
}
|
}
|
||||||
else if ( events[i]->getType() == idCameraEvent::EVENT_CAMERA ) {
|
else if ( events[i]->getType() == idCameraEvent::EVENT_CAMERA ) {
|
||||||
memset( buff, 0, sizeof( buff ) );
|
memset( buff, 0, sizeof( buff ) );
|
||||||
strcpy( buff, events[i]->getParam() );
|
Q_strncpyz( buff, events[i]->getParam(), sizeof( buff ) );
|
||||||
const char *param1 = strtok( buff, " \t,\0" );
|
const char *param1 = strtok( buff, " \t,\0" );
|
||||||
const char *param2 = strtok( NULL, " \t,\0" );
|
const char *param2 = strtok( NULL, " \t,\0" );
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ idStr operator+
|
||||||
const idStr& a,
|
const idStr& a,
|
||||||
const float b
|
const float b
|
||||||
){
|
){
|
||||||
char text[ 20 ];
|
char text[ 64 ];
|
||||||
|
|
||||||
idStr result( a );
|
idStr result( a );
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ idStr& idStr::operator+=
|
||||||
(
|
(
|
||||||
const float a
|
const float a
|
||||||
){
|
){
|
||||||
char text[ 20 ];
|
char text[ 64 ];
|
||||||
|
|
||||||
sprintf( text, "%f", a );
|
sprintf( text, "%f", a );
|
||||||
append( text );
|
append( text );
|
||||||
|
@ -371,6 +371,7 @@ void idStr::EnsureDataWritable
|
||||||
|
|
||||||
EnsureAlloced( len + 1, false );
|
EnsureAlloced( len + 1, false );
|
||||||
strncpy( m_data->data, olddata->data, len + 1 );
|
strncpy( m_data->data, olddata->data, len + 1 );
|
||||||
|
m_data->data[len] = 0;
|
||||||
m_data->len = len;
|
m_data->len = len;
|
||||||
|
|
||||||
olddata->DelRef();
|
olddata->DelRef();
|
||||||
|
@ -447,12 +448,13 @@ void idStr::snprintf
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
va_start( argptr,fmt );
|
va_start( argptr,fmt );
|
||||||
len = vsprintf( buffer,fmt,argptr );
|
len = vsnprintf( buffer, sizeof( buffer ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
assert( len < size );
|
assert( len < size );
|
||||||
|
|
||||||
strncpy( dst, buffer, size - 1 );
|
strncpy( dst, buffer, size - 1 );
|
||||||
|
dst[size - 1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -52,6 +52,15 @@
|
||||||
#define strcasecmp strcmpi
|
#define strcasecmp strcmpi
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Q_strncpyz
|
||||||
|
#define Q_strncpyz(_dst, _source, _len) do { strncpy((_dst), (_source), (_len) - 1); if ((_len) > 0) (_dst)[(_len) - 1] = 0; } while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// NOTE TTimo __StrDup was initially implemented in pakstuff.cpp
|
// NOTE TTimo __StrDup was initially implemented in pakstuff.cpp
|
||||||
// causing a bunch of issues for broader targets that use Str.h (such as plugins and modules)
|
// causing a bunch of issues for broader targets that use Str.h (such as plugins and modules)
|
||||||
// Q_StrDup should be used now, using a #define __StrDup for easy transition
|
// Q_StrDup should be used now, using a #define __StrDup for easy transition
|
||||||
|
|
|
@ -244,13 +244,13 @@ char *strlower( char *start ){
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *addstr( char *dest,const char *source ){
|
char *addstr( char *dest, const char *source ){
|
||||||
if ( dest ) {
|
if ( dest ) {
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int len = strlen( dest );
|
int len = strlen( dest );
|
||||||
ptr = (char *) malloc( len + strlen( source ) + 1 );
|
ptr = (char *) malloc( len + strlen( source ) + 1 );
|
||||||
strcpy( ptr,dest );
|
strcpy( ptr, dest );
|
||||||
strcpy( ptr + len,source );
|
strcpy( ptr + len, source );
|
||||||
free( dest );
|
free( dest );
|
||||||
dest = ptr;
|
dest = ptr;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ class_t *Find_Class( GSList *l,char *classname, class_t *ignore ){
|
||||||
Note: this is somewhat recursive, as a class can require a class that requires a class and so on..
|
Note: this is somewhat recursive, as a class can require a class that requires a class and so on..
|
||||||
*/
|
*/
|
||||||
void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
char color[128];
|
char color[256];
|
||||||
|
|
||||||
// We allocate 16k here, but only the memory actually used is kept allocated.
|
// We allocate 16k here, but only the memory actually used is kept allocated.
|
||||||
// this is just used for building the final comments string.
|
// this is just used for building the final comments string.
|
||||||
|
@ -382,8 +382,8 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
//represent the final values.
|
//represent the final values.
|
||||||
|
|
||||||
if ( bc->description ) {
|
if ( bc->description ) {
|
||||||
sprintf( newcomments,"%s\n",bc->description );
|
snprintf( newcomments, sizeof( newcomments ), "%s\n", bc->description );
|
||||||
e->comments = addstr( e->comments,newcomments );
|
e->comments = addstr( e->comments, newcomments );
|
||||||
newcomments[0] = 0; // so we don't add them twice.
|
newcomments[0] = 0; // so we don't add them twice.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,8 +420,8 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
// SIZE
|
// SIZE
|
||||||
if ( bc->gotsize ) {
|
if ( bc->gotsize ) {
|
||||||
e->fixedsize = true;
|
e->fixedsize = true;
|
||||||
memcpy( e->mins,bc->boundingbox[0],sizeof( vec3_t ) );
|
memcpy( e->mins, bc->boundingbox[0], sizeof( vec3_t ) );
|
||||||
memcpy( e->maxs,bc->boundingbox[1],sizeof( vec3_t ) );
|
memcpy( e->maxs, bc->boundingbox[1], sizeof( vec3_t ) );
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// Hydra: apparently, this would be bad.
|
// Hydra: apparently, this would be bad.
|
||||||
|
@ -449,8 +449,8 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
|
|
||||||
// COLOR
|
// COLOR
|
||||||
if ( bc->gotcolor ) {
|
if ( bc->gotcolor ) {
|
||||||
memcpy( e->color,bc->color,sizeof( vec3_t ) );
|
memcpy( e->color, bc->color, sizeof( vec3_t ) );
|
||||||
sprintf( color, "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
snprintf( color, sizeof( color ), "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
||||||
e->texdef.SetName( color );
|
e->texdef.SetName( color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,18 +463,22 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
if ( opt->optiontype != OPTION_FLAGS ) {
|
if ( opt->optiontype != OPTION_FLAGS ) {
|
||||||
// add some info to the comments.
|
// add some info to the comments.
|
||||||
if ( opt->optioninfo ) {
|
if ( opt->optioninfo ) {
|
||||||
sprintf( newcomments + strlen( newcomments ),"%s '%s' %s%s\n",
|
snprintf( newcomments + strlen( newcomments ),
|
||||||
opt->epairname,
|
sizeof( newcomments ) - strlen( newcomments ),
|
||||||
opt->optioninfo ? opt->optioninfo : "",
|
"%s '%s' %s%s\n",
|
||||||
opt->optiondefault ? ", Default: " : "",
|
opt->epairname,
|
||||||
opt->optiondefault ? opt->optiondefault : "" );
|
opt->optioninfo ? opt->optioninfo : "",
|
||||||
|
opt->optiondefault ? ", Default: " : "",
|
||||||
|
opt->optiondefault ? opt->optiondefault : "" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( newcomments + strlen( newcomments ),"%s %s%s\n",
|
snprintf( newcomments + strlen( newcomments ),
|
||||||
opt->epairname,
|
sizeof( newcomments ) - strlen( newcomments ),
|
||||||
opt->optiondefault ? ", Default: " : "",
|
"%s %s%s\n",
|
||||||
opt->optiondefault ? opt->optiondefault : "" );
|
opt->epairname,
|
||||||
|
opt->optiondefault ? ", Default: " : "",
|
||||||
|
opt->optiondefault ? opt->optiondefault : "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +494,7 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
int index = getindex( choice->value );
|
int index = getindex( choice->value );
|
||||||
index--;
|
index--;
|
||||||
if ( index < MAX_FLAGS ) {
|
if ( index < MAX_FLAGS ) {
|
||||||
strcpy( e->flagnames[index],choice->name );
|
Q_strncpyz( e->flagnames[index], choice->name, sizeof( e->flagnames[index] ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -499,11 +503,14 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPTION_CHOICES:
|
case OPTION_CHOICES:
|
||||||
strcat( newcomments," Choices:\n" );
|
strncat( newcomments, " Choices:\n", sizeof( newcomments ) );
|
||||||
for ( choicelst = opt->choices; choicelst != NULL; choicelst = choicelst->next )
|
for ( choicelst = opt->choices; choicelst != NULL; choicelst = choicelst->next )
|
||||||
{
|
{
|
||||||
choice_t *choice = (choice_t*) choicelst->data;
|
choice_t *choice = (choice_t*) choicelst->data;
|
||||||
sprintf( newcomments + strlen( newcomments )," %5d - %s\n",choice->value,choice->name );
|
snprintf( newcomments + strlen( newcomments ),
|
||||||
|
sizeof( newcomments ) - strlen( newcomments ),
|
||||||
|
" %5d - %s\n",
|
||||||
|
choice->value,choice->name );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -540,14 +547,14 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
e->color[1] = 0.5; // how about a nice bright pink, mmm, nice! :)
|
e->color[1] = 0.5; // how about a nice bright pink, mmm, nice! :)
|
||||||
e->color[2] = 1;
|
e->color[2] = 1;
|
||||||
|
|
||||||
sprintf( color, "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
snprintf( color, sizeof( color ), "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
||||||
e->texdef.SetName( color );
|
e->texdef.SetName( color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// COMMENTS
|
// COMMENTS
|
||||||
if ( newcomments[0] ) {
|
if ( newcomments[0] ) {
|
||||||
e->comments = addstr( e->comments,newcomments );
|
e->comments = addstr( e->comments, newcomments );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,12 +596,12 @@ void Create_EClasses( GSList *l_classes ){
|
||||||
|
|
||||||
if ( havespawnflags ) {
|
if ( havespawnflags ) {
|
||||||
char spawnline[80];
|
char spawnline[80];
|
||||||
e->comments = addstr( e->comments,"Spawnflags\n" );
|
e->comments = addstr( e->comments, "Spawnflags\n" );
|
||||||
for ( i = 0 ; i < MAX_FLAGS ; i++ )
|
for ( i = 0 ; i < MAX_FLAGS ; i++ )
|
||||||
{
|
{
|
||||||
if ( *e->flagnames[i] ) {
|
if ( *e->flagnames[i] ) {
|
||||||
sprintf( spawnline," %d - %s\n", 1 << i, e->flagnames[i] );
|
snprintf( spawnline, sizeof( spawnline ), " %d - %s\n", 1 << i, e->flagnames[i] );
|
||||||
e->comments = addstr( e->comments,spawnline );
|
e->comments = addstr( e->comments, spawnline );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,7 +656,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
}
|
}
|
||||||
} while ( token[0] != '@' );
|
} while ( token[0] != '@' );
|
||||||
|
|
||||||
strcpy( temp,token + 1 ); // skip the @
|
Q_strncpyz( temp, token + 1, sizeof( temp ) );// skip the @
|
||||||
|
|
||||||
classtype = CLASS_NOCLASS;
|
classtype = CLASS_NOCLASS;
|
||||||
if ( !stricmp( temp,"BaseClass" ) ) {
|
if ( !stricmp( temp,"BaseClass" ) ) {
|
||||||
|
@ -669,37 +676,37 @@ void Eclass_ScanFile( char *filename ){
|
||||||
|
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
GetTokenExtra( false,"(",false ); // option or =
|
GetTokenExtra( false, "(", false ); // option or =
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
|
|
||||||
if ( !strcmp( token,"=" ) ) {
|
if ( !strcmp( token, "=" ) ) {
|
||||||
UnGetToken();
|
UnGetToken();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strlower( token );
|
strlower( token );
|
||||||
if ( !strcmp( token,"base" ) ) {
|
if ( !strcmp( token, "base" ) ) {
|
||||||
GetTokenExtra( false,"(",true ); // (
|
GetTokenExtra( false, "(", true ); // (
|
||||||
|
|
||||||
if ( !strcmp( token,"(" ) ) {
|
if ( !strcmp( token, "(" ) ) {
|
||||||
while ( GetTokenExtra( false,",)",false ) ) // option) or option,
|
while ( GetTokenExtra( false, ",)", false ) ) // option) or option,
|
||||||
{
|
{
|
||||||
newclass->l_baselist = g_slist_append( newclass->l_baselist, strdup( token ) );
|
newclass->l_baselist = g_slist_append( newclass->l_baselist, strdup( token ) );
|
||||||
|
|
||||||
GetTokenExtra( false,",)",true ); // , or )
|
GetTokenExtra( false, ",)", true ); // , or )
|
||||||
if ( !strcmp( token,")" ) ) {
|
if ( !strcmp( token, ")" ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !strcmp( token,"size" ) ) {
|
else if ( !strcmp( token, "size" ) ) {
|
||||||
// parse (w h d) or (x y z, x y z)
|
// parse (w h d) or (x y z, x y z)
|
||||||
|
|
||||||
GetTokenExtra( false,"(",true ); // (
|
GetTokenExtra( false, "(", true ); // (
|
||||||
if ( !strcmp( token,"(" ) ) {
|
if ( !strcmp( token, "(" ) ) {
|
||||||
int sizedone = false;
|
int sizedone = false;
|
||||||
float w,h,d;
|
float w,h,d;
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
|
@ -707,7 +714,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
h = atof( token );
|
h = atof( token );
|
||||||
GetToken( false ); // number) or number ,
|
GetToken( false ); // number) or number ,
|
||||||
strcpy( temp,token );
|
Q_strncpyz( temp, token, sizeof( temp ) );
|
||||||
len = strlen( temp );
|
len = strlen( temp );
|
||||||
if ( temp[len - 1] == ')' ) {
|
if ( temp[len - 1] == ')' ) {
|
||||||
sizedone = true;
|
sizedone = true;
|
||||||
|
@ -743,16 +750,16 @@ void Eclass_ScanFile( char *filename ){
|
||||||
GetToken(false); // )
|
GetToken(false); // )
|
||||||
newclass->boundingbox[1][2] = atof(temp);
|
newclass->boundingbox[1][2] = atof(temp);
|
||||||
*/
|
*/
|
||||||
GetTokenExtra( false,")",false ); // number
|
GetTokenExtra( false, ")", false ); // number
|
||||||
newclass->boundingbox[1][2] = atof( token );
|
newclass->boundingbox[1][2] = atof( token );
|
||||||
newclass->gotsize = true;
|
newclass->gotsize = true;
|
||||||
GetTokenExtra( false,")",true ); // )
|
GetTokenExtra( false, ")", true ); // )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !strcmp( token,"color" ) ) {
|
else if ( !strcmp( token, "color" ) ) {
|
||||||
GetTokenExtra( false,"(",true ); // (
|
GetTokenExtra( false, "(", true ); // (
|
||||||
if ( !strcmp( token,"(" ) ) {
|
if ( !strcmp( token, "(" ) ) {
|
||||||
// get the color values (0-255) and normalize them if required.
|
// get the color values (0-255) and normalize them if required.
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
newclass->color[0] = atof( token );
|
newclass->color[0] = atof( token );
|
||||||
|
@ -765,7 +772,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
newclass->color[1] /= 255;
|
newclass->color[1] /= 255;
|
||||||
}
|
}
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
strcpy( temp,token );
|
Q_strncpyz( temp, token, sizeof( temp ) );
|
||||||
len = strlen( temp );
|
len = strlen( temp );
|
||||||
if ( temp[len - 1] == ')' ) {
|
if ( temp[len - 1] == ')' ) {
|
||||||
temp[len - 1] = 0;
|
temp[len - 1] = 0;
|
||||||
|
@ -777,22 +784,22 @@ void Eclass_ScanFile( char *filename ){
|
||||||
newclass->gotcolor = true;
|
newclass->gotcolor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !strcmp( token,"iconsprite" ) ) {
|
else if ( !strcmp( token, "iconsprite" ) ) {
|
||||||
GetTokenExtra( false,"(",true ); // (
|
GetTokenExtra( false, "(", true ); // (
|
||||||
if ( !strcmp( token,"(" ) ) {
|
if ( !strcmp( token, "(" ) ) {
|
||||||
GetTokenExtra( false,")",false ); // filename)
|
GetTokenExtra( false, ")", false ); // filename)
|
||||||
// the model plugins will handle sprites too.
|
// the model plugins will handle sprites too.
|
||||||
// newclass->sprite = strdup(token);
|
// newclass->sprite = strdup(token);
|
||||||
newclass->model = strdup( token );
|
newclass->model = strdup( token );
|
||||||
GetTokenExtra( false,")",true ); // )
|
GetTokenExtra( false, ")", true ); // )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !strcmp( token,"model" ) ) {
|
else if ( !strcmp( token, "model" ) ) {
|
||||||
GetTokenExtra( false,"(",true ); // (
|
GetTokenExtra( false, "(", true ); // (
|
||||||
if ( !strcmp( token,"(" ) ) {
|
if ( !strcmp( token, "(" ) ) {
|
||||||
GetTokenExtra( false,")",false ); // filename)
|
GetTokenExtra( false, ")", false ); // filename)
|
||||||
newclass->model = strdup( token );
|
newclass->model = strdup( token );
|
||||||
GetTokenExtra( false,")",true ); // )
|
GetTokenExtra( false, ")", true ); // )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -805,8 +812,8 @@ void Eclass_ScanFile( char *filename ){
|
||||||
}
|
}
|
||||||
|
|
||||||
GetToken( false ); // =
|
GetToken( false ); // =
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( !strcmp( token,"=" ) ) {
|
if ( !strcmp( token, "=" ) ) {
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
newclass->classname = strdup( token );
|
newclass->classname = strdup( token );
|
||||||
}
|
}
|
||||||
|
@ -814,7 +821,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
// Get the description
|
// Get the description
|
||||||
if ( newclass->classtype != CLASS_BASECLASS ) {
|
if ( newclass->classtype != CLASS_BASECLASS ) {
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
if ( !strcmp( token,":" ) ) {
|
if ( !strcmp( token, ":" ) ) {
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
newclass->description = strdup( token );
|
newclass->description = strdup( token );
|
||||||
}
|
}
|
||||||
|
@ -840,7 +847,8 @@ void Eclass_ScanFile( char *filename ){
|
||||||
}
|
}
|
||||||
// parse the data and build the option_t
|
// parse the data and build the option_t
|
||||||
|
|
||||||
strcpy( temp,token );
|
Q_strncpyz( temp, token, sizeof( temp ) );
|
||||||
|
|
||||||
len = strlen( temp );
|
len = strlen( temp );
|
||||||
char *ptr = strchr( temp,'(' );
|
char *ptr = strchr( temp,'(' );
|
||||||
|
|
||||||
|
@ -884,7 +892,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GetToken( false ); // :
|
GetToken( false ); // :
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( ( token[0] == ':' ) && ( strlen( token ) > 1 ) ) {
|
if ( ( token[0] == ':' ) && ( strlen( token ) > 1 ) ) {
|
||||||
newoption->optioninfo = strdup( token + 1 );
|
newoption->optioninfo = strdup( token + 1 );
|
||||||
}
|
}
|
||||||
|
@ -909,18 +917,18 @@ void Eclass_ScanFile( char *filename ){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPTION_CHOICES:
|
case OPTION_CHOICES:
|
||||||
GetTokenExtra( false,":",true ); // : or :"something like this" (bah!)
|
GetTokenExtra( false, ":", true ); // : or :"something like this" (bah!)
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( ( token[0] == ':' ) && ( strlen( token ) > 1 ) ) {
|
if ( ( token[0] == ':' ) && ( strlen( token ) > 1 ) ) {
|
||||||
if ( token[1] == '\"' ) {
|
if ( token[1] == '\"' ) {
|
||||||
strcpy( temp,token + 2 );
|
Q_strncpyz( temp, token + 2, sizeof( temp ) );
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
if ( !GetToken( false ) ) {
|
if ( !GetToken( false ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strcat( temp," " );
|
strncat( temp, " ", sizeof( temp ) );
|
||||||
strcat( temp,token );
|
strncat( temp, token, sizeof( temp ) );
|
||||||
len = strlen( temp );
|
len = strlen( temp );
|
||||||
if ( temp[len - 1] == '\"' ) {
|
if ( temp[len - 1] == '\"' ) {
|
||||||
temp[len - 1] = 0;
|
temp[len - 1] = 0;
|
||||||
|
@ -936,7 +944,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
newoption->optioninfo = strdup( token );
|
newoption->optioninfo = strdup( token );
|
||||||
}
|
}
|
||||||
GetToken( false ); // : or =
|
GetToken( false ); // : or =
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( !strcmp( token,":" ) ) {
|
if ( !strcmp( token,":" ) ) {
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
newoption->optiondefault = strdup( token );
|
newoption->optiondefault = strdup( token );
|
||||||
|
@ -948,13 +956,13 @@ void Eclass_ScanFile( char *filename ){
|
||||||
// And Follow on...
|
// And Follow on...
|
||||||
case OPTION_FLAGS:
|
case OPTION_FLAGS:
|
||||||
GetToken( false ); // : or =
|
GetToken( false ); // : or =
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( strcmp( token,"=" ) ) { // missing ?
|
if ( strcmp( token,"=" ) ) { // missing ?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetToken( true ); // [
|
GetToken( true ); // [
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( strcmp( token,"[" ) ) { // missing ?
|
if ( strcmp( token,"[" ) ) { // missing ?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -962,13 +970,13 @@ void Eclass_ScanFile( char *filename ){
|
||||||
choice_t *newchoice;
|
choice_t *newchoice;
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
GetTokenExtra( true,":",true ); // "]" or "number", or "number:"
|
GetTokenExtra( true, ":", true ); // "]" or "number", or "number:"
|
||||||
strcpy( token_debug,token );
|
Q_strncpyz( token_debug, token, sizeof( token_debug ) );
|
||||||
if ( !strcmp( token,"]" ) ) { // no more ?
|
if ( !strcmp( token, "]" ) ) { // no more ?
|
||||||
optioncomplete = true;
|
optioncomplete = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strcpy( temp,token );
|
Q_strncpyz( temp, token, sizeof( temp ) );
|
||||||
len = strlen( temp );
|
len = strlen( temp );
|
||||||
if ( temp[len - 1] == ':' ) {
|
if ( temp[len - 1] == ':' ) {
|
||||||
temp[len - 1] = 0;
|
temp[len - 1] = 0;
|
||||||
|
@ -976,7 +984,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetToken( false ); // :
|
GetToken( false ); // :
|
||||||
if ( strcmp( token,":" ) ) { // missing ?
|
if ( strcmp( token, ":" ) ) { // missing ?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1061,21 +1069,21 @@ void Eclass_ScanFile( char *filename ){
|
||||||
Sys_Printf( "%s", (char *)tmp->data );
|
Sys_Printf( "%s", (char *)tmp->data );
|
||||||
}
|
}
|
||||||
if ( tmpclass->gotsize ) {
|
if ( tmpclass->gotsize ) {
|
||||||
sprintf( temp,"(%.0f %.0f %.0f) - (%.0f %.0f %.0f)",tmpclass->boundingbox[0][0],
|
snprintf( temp, sizeof( temp ),"(%.0f %.0f %.0f) - (%.0f %.0f %.0f)",tmpclass->boundingbox[0][0],
|
||||||
tmpclass->boundingbox[0][1],
|
tmpclass->boundingbox[0][1],
|
||||||
tmpclass->boundingbox[0][2],
|
tmpclass->boundingbox[0][2],
|
||||||
tmpclass->boundingbox[1][0],
|
tmpclass->boundingbox[1][0],
|
||||||
tmpclass->boundingbox[1][1],
|
tmpclass->boundingbox[1][1],
|
||||||
tmpclass->boundingbox[1][2] );
|
tmpclass->boundingbox[1][2] );
|
||||||
}
|
}
|
||||||
else{ strcpy( temp,"No Size" ); }
|
else{ Q_strncpyz( temp, "No Size", sizeof( temp ) ); }
|
||||||
Sys_Printf( ") '%s' Size: %s",tmpclass->description ? tmpclass->description : "No description",temp );
|
Sys_Printf( ") '%s' Size: %s",tmpclass->description ? tmpclass->description : "No description",temp );
|
||||||
if ( tmpclass->gotcolor ) {
|
if ( tmpclass->gotcolor ) {
|
||||||
sprintf( temp,"(%d %d %d)",tmpclass->color[0],
|
snprintf( temp, sizeof( temp ), "(%d %d %d)", tmpclass->color[0],
|
||||||
tmpclass->color[1],
|
tmpclass->color[1],
|
||||||
tmpclass->color[2] );
|
tmpclass->color[2] );
|
||||||
}
|
}
|
||||||
else{ strcpy( temp,"No Color" ); }
|
else{ Q_strncpyz( temp, "No Color", sizeof( temp ) ); }
|
||||||
Sys_Printf( " Color: %s Options:\n",temp );
|
Sys_Printf( " Color: %s Options:\n",temp );
|
||||||
if ( !tmpclass->l_optionlist ) {
|
if ( !tmpclass->l_optionlist ) {
|
||||||
Sys_Printf( " No Options\n" );
|
Sys_Printf( " No Options\n" );
|
||||||
|
|
|
@ -35,17 +35,17 @@ void LoadM8( const char *name, unsigned char **pic, int *width, int *height ){
|
||||||
unsigned char *palette_ent, *buf_temp;
|
unsigned char *palette_ent, *buf_temp;
|
||||||
unsigned char *buffer, *m8_file_buffer;
|
unsigned char *buffer, *m8_file_buffer;
|
||||||
|
|
||||||
strcpy( text_buf, name );
|
Q_strncpyz( text_buf, name, sizeof( text_buf ) );
|
||||||
text_dot_pos = strchr( text_buf, '.' );
|
text_dot_pos = strchr( text_buf, '.' );
|
||||||
if ( text_dot_pos ) {
|
if ( text_dot_pos ) {
|
||||||
*text_dot_pos = 0;
|
*text_dot_pos = 0;
|
||||||
}
|
}
|
||||||
// Fix for .pcx.m8 extention
|
// Fix for .pcx.m8 extention
|
||||||
strcat( text_buf, ".pcx.m8" );
|
strncat( text_buf, ".pcx.m8", sizeof( text_buf ) );
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
if ( ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) ) == (unsigned int) -1 ) {
|
if ( ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) ) == (unsigned int) -1 ) {
|
||||||
strcpy( text_buf, name );
|
Q_strncpyz( text_buf, name, sizeof( text_buf ) );
|
||||||
for ( i = ( strlen( text_buf ) - 1 ); i > 0; i-- )
|
for ( i = ( strlen( text_buf ) - 1 ); i > 0; i-- )
|
||||||
{
|
{
|
||||||
if ( text_buf[i] == '.' ) {
|
if ( text_buf[i] == '.' ) {
|
||||||
|
@ -53,7 +53,7 @@ void LoadM8( const char *name, unsigned char **pic, int *width, int *height ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcat( text_buf, ".m8" );
|
strncat( text_buf, ".m8", sizeof( text_buf ) );
|
||||||
if ( ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) ) == (unsigned int) -1 ) {
|
if ( ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) ) == (unsigned int) -1 ) {
|
||||||
Sys_Printf( "Unable to open file %s\n",name );
|
Sys_Printf( "Unable to open file %s\n",name );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
// cmdlib
|
// cmdlib
|
||||||
extern void ExtractFileName( const char *path, char *dest );
|
extern void ExtractFileName( const char *path, char *dest, size_t size );
|
||||||
|
|
||||||
extern int g_MapVersion;
|
extern int g_MapVersion;
|
||||||
int abortcode; // see imap.h for values.
|
int abortcode; // see imap.h for values.
|
||||||
|
@ -65,7 +65,7 @@ void BuildWadList( char *wadstr ){
|
||||||
|
|
||||||
g_WadList = NULL;
|
g_WadList = NULL;
|
||||||
|
|
||||||
strcpy( wads,wadstr );
|
Q_strncpyz( wads, wadstr, sizeof( wads ) );
|
||||||
QE_ConvertDOSToUnixName( wads,wads );
|
QE_ConvertDOSToUnixName( wads,wads );
|
||||||
|
|
||||||
// ok, we got the list of ; delimited wads, now split it into a GSList that contains
|
// ok, we got the list of ; delimited wads, now split it into a GSList that contains
|
||||||
|
@ -81,7 +81,7 @@ void BuildWadList( char *wadstr ){
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( strchr( p1,'/' ) || strchr( p1,'\\' ) ) {
|
if ( strchr( p1,'/' ) || strchr( p1,'\\' ) ) {
|
||||||
ExtractFileName( p1,cleanwadname );
|
ExtractFileName( p1, cleanwadname, sizeof( cleanwadname ) );
|
||||||
|
|
||||||
trim( cleanwadname );
|
trim( cleanwadname );
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ void Patch_Parse( patchMesh_t *pPatch ){
|
||||||
GetToken( true );
|
GetToken( true );
|
||||||
str = new char[strlen( token ) + 10];
|
str = new char[strlen( token ) + 10];
|
||||||
strcpy( str, "textures/" );
|
strcpy( str, "textures/" );
|
||||||
strcpy( str + 9, token );
|
Q_strncpyz( str + 9, token, strlen( token ) + 10 - 9 );
|
||||||
pPatch->pShader = QERApp_Shader_ForName( str );
|
pPatch->pShader = QERApp_Shader_ForName( str );
|
||||||
pPatch->d_texture = pPatch->pShader->getTexture();
|
pPatch->d_texture = pPatch->pShader->getTexture();
|
||||||
delete [] str;
|
delete [] str;
|
||||||
|
@ -568,7 +568,7 @@ void Entity_Parse( entity_t *pEntity ){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
strcpy( temptoken, token );
|
Q_strncpyz( temptoken, token, sizeof( temptoken ) );
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
|
|
||||||
SetKeyValue( pEntity, temptoken, token );
|
SetKeyValue( pEntity, temptoken, token );
|
||||||
|
|
|
@ -218,7 +218,7 @@ void HandleXMLError( void* ctxt, const char* text, ... ){
|
||||||
static char buf[32768];
|
static char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,text );
|
va_start( argptr,text );
|
||||||
vsprintf( buf, text, argptr );
|
vsnprintf( buf, sizeof( buf ), text, argptr );
|
||||||
Sys_FPrintf( SYS_ERR, "XML %s\n", buf );
|
Sys_FPrintf( SYS_ERR, "XML %s\n", buf );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,15 @@ char *str_append_token( char *str1, const char *str2 ){
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void str_from_float( char *buf, float f ){
|
void str_from_float( char *buf, float f, size_t length ){
|
||||||
if ( f == (int)f ) {
|
if ( f == (int)f ) {
|
||||||
sprintf( buf, "%i", (int)f );
|
snprintf( buf, length, "%i", (int)f );
|
||||||
}
|
}
|
||||||
else{ sprintf( buf, "%f", f ); }
|
else{ snprintf( buf, length, "%f", f ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_XMLWrite( patchMesh_t *pPatch, xmlNodePtr surface ){
|
void Patch_XMLWrite( patchMesh_t *pPatch, xmlNodePtr surface ){
|
||||||
char buf[16];
|
char buf[64];
|
||||||
char *str;
|
char *str;
|
||||||
int i, j;
|
int i, j;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
|
@ -62,29 +62,29 @@ void Patch_XMLWrite( patchMesh_t *pPatch, xmlNodePtr surface ){
|
||||||
{
|
{
|
||||||
for ( j = 0; j < pPatch->height; j++ )
|
for ( j = 0; j < pPatch->height; j++ )
|
||||||
{
|
{
|
||||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[0] );
|
str_from_float( buf, pPatch->ctrl[i][j].xyz[0], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[1] );
|
str_from_float( buf, pPatch->ctrl[i][j].xyz[1], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[2] );
|
str_from_float( buf, pPatch->ctrl[i][j].xyz[2], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
str_from_float( buf, pPatch->ctrl[i][j].st[0] );
|
str_from_float( buf, pPatch->ctrl[i][j].st[0], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
str_from_float( buf, pPatch->ctrl[i][j].st[1] );
|
str_from_float( buf, pPatch->ctrl[i][j].st[1], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = xmlNewChild( surface, NULL, (xmlChar *)"matrix", (xmlChar *)str );
|
node = xmlNewChild( surface, NULL, (xmlChar *)"matrix", (xmlChar *)str );
|
||||||
delete [] str;
|
delete [] str;
|
||||||
sprintf( buf, "%i", pPatch->width );
|
snprintf( buf, sizeof( buf ), "%i", pPatch->width );
|
||||||
xmlSetProp( node, (xmlChar *)"width", (xmlChar *)buf );
|
xmlSetProp( node, (xmlChar *)"width", (xmlChar *)buf );
|
||||||
sprintf( buf, "%i", pPatch->height );
|
snprintf( buf, sizeof( buf ), "%i", pPatch->height );
|
||||||
xmlSetProp( node, (xmlChar *)"height", (xmlChar *)buf );
|
xmlSetProp( node, (xmlChar *)"height", (xmlChar *)buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = false ){
|
void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = false ){
|
||||||
char buf[16];
|
char buf[64];
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
int i, j;
|
int i, j;
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -98,7 +98,7 @@ void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = fa
|
||||||
{
|
{
|
||||||
for ( j = 0 ; j < 3 ; j++ )
|
for ( j = 0 ; j < 3 ; j++ )
|
||||||
{
|
{
|
||||||
str_from_float( buf, face->planepts[i][j] );
|
str_from_float( buf, face->planepts[i][j], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,15 +108,15 @@ void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = fa
|
||||||
|
|
||||||
if ( !bAlternateTexdef ) {
|
if ( !bAlternateTexdef ) {
|
||||||
// write texdef
|
// write texdef
|
||||||
sprintf( buf, "%i", (int)face->texdef.shift[0] );
|
snprintf( buf, sizeof( buf ), "%i", (int)face->texdef.shift[0] );
|
||||||
str = str_append_token( NULL, buf );
|
str = str_append_token( NULL, buf );
|
||||||
sprintf( buf, "%i", (int)face->texdef.shift[1] );
|
snprintf( buf, sizeof( buf ), "%i", (int)face->texdef.shift[1] );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
sprintf( buf, "%i", (int)face->texdef.rotate );
|
snprintf( buf, sizeof( buf ), "%i", (int)face->texdef.rotate );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
sprintf( buf, "%f", face->texdef.scale[0] );
|
snprintf( buf, sizeof( buf ), "%f", face->texdef.scale[0] );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
sprintf( buf, "%f", face->texdef.scale[1] );
|
snprintf( buf, sizeof( buf ), "%f", face->texdef.scale[1] );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
|
|
||||||
node = xmlNewChild( surface, NULL, (xmlChar *)"texdef", (xmlChar *)str );
|
node = xmlNewChild( surface, NULL, (xmlChar *)"texdef", (xmlChar *)str );
|
||||||
|
@ -130,7 +130,7 @@ void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = fa
|
||||||
{
|
{
|
||||||
for ( j = 0 ; j < 3 ; j++ )
|
for ( j = 0 ; j < 3 ; j++ )
|
||||||
{
|
{
|
||||||
str_from_float( buf, face->brushprimit_texdef.coords[i][j] );
|
str_from_float( buf, face->brushprimit_texdef.coords[i][j], sizeof( buf ) );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,11 +139,11 @@ void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = fa
|
||||||
}
|
}
|
||||||
|
|
||||||
// write flags
|
// write flags
|
||||||
sprintf( buf, "%i", face->texdef.contents );
|
snprintf( buf, sizeof( buf ), "%i", face->texdef.contents );
|
||||||
str = str_append_token( NULL, buf );
|
str = str_append_token( NULL, buf );
|
||||||
sprintf( buf, "%i", face->texdef.flags );
|
snprintf( buf, sizeof( buf ), "%i", face->texdef.flags );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
sprintf( buf, "%i", face->texdef.value );
|
snprintf( buf, sizeof( buf ), "%i", face->texdef.value );
|
||||||
str = str_append_token( str, buf );
|
str = str_append_token( str, buf );
|
||||||
|
|
||||||
node = xmlNewChild( surface, NULL, (xmlChar *)"flags", (xmlChar *)str );
|
node = xmlNewChild( surface, NULL, (xmlChar *)"flags", (xmlChar *)str );
|
||||||
|
|
|
@ -142,7 +142,7 @@ void init_filetypes(){
|
||||||
char buf[16];
|
char buf[16];
|
||||||
buf[0] = '*';
|
buf[0] = '*';
|
||||||
buf[1] = '.';
|
buf[1] = '.';
|
||||||
strcpy( buf + 2, *ext );
|
Q_strncpyz( buf + 2, *ext, sizeof( buf ) - 2 );
|
||||||
GetFileTypeRegistry()->addType( MODEL_MAJOR, filetype_t( module->displayName, buf ) );
|
GetFileTypeRegistry()->addType( MODEL_MAJOR, filetype_t( module->displayName, buf ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,15 +178,15 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool
|
||||||
else if ( !strcmp( p, "About" ) ) {
|
else if ( !strcmp( p, "About" ) ) {
|
||||||
const picoModule_t** modules = PicoModuleList( NULL );
|
const picoModule_t** modules = PicoModuleList( NULL );
|
||||||
char about_buf[1024];
|
char about_buf[1024];
|
||||||
strncpy( about_buf, PLUGIN_ABOUT, sizeof( about_buf ) - 1 );
|
Q_strncpyz( about_buf, PLUGIN_ABOUT, sizeof( about_buf ) );
|
||||||
while ( *modules != NULL ) {
|
while ( *modules != NULL ) {
|
||||||
const picoModule_t* module = *modules++;
|
const picoModule_t* module = *modules++;
|
||||||
strncat( about_buf, module->displayName, sizeof( about_buf ) - 1 );
|
strncat( about_buf, module->displayName, sizeof( about_buf ) );
|
||||||
strncat( about_buf, " (", sizeof( about_buf ) - 1 );
|
strncat( about_buf, " (", sizeof( about_buf ) );
|
||||||
strncat( about_buf, module->defaultExts[0], sizeof( about_buf ) - 1 );
|
strncat( about_buf, module->defaultExts[0], sizeof( about_buf ) );
|
||||||
strncat( about_buf, ")\n\t", sizeof( about_buf ) - 1 );
|
strncat( about_buf, ")\n\t", sizeof( about_buf ) );
|
||||||
strncat( about_buf, module->copyright, sizeof( about_buf ) - 1 );
|
strncat( about_buf, module->copyright, sizeof( about_buf ) );
|
||||||
strncat( about_buf, "\n", sizeof( about_buf ) - 1 );
|
strncat( about_buf, "\n", sizeof( about_buf ) );
|
||||||
}
|
}
|
||||||
g_FuncTable.m_pfnMessageBox( NULL, about_buf, "About", MB_OK, NULL );
|
g_FuncTable.m_pfnMessageBox( NULL, about_buf, "About", MB_OK, NULL );
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ void add_remap( const char *remap ){
|
||||||
else {
|
else {
|
||||||
pRemap = new remap_t;
|
pRemap = new remap_t;
|
||||||
|
|
||||||
strncpy( pRemap->m_remapbuff, remap, sizeof( pRemap->m_remapbuff ) );
|
Q_strncpyz( pRemap->m_remapbuff, remap, sizeof( pRemap->m_remapbuff ) );
|
||||||
|
|
||||||
pRemap->m_remapbuff[ch - remap] = '\0';
|
pRemap->m_remapbuff[ch - remap] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ const char *WINAPI QERApp_CleanTextureName( const char *name, bool bAddTexture =
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strcpy( stdName, name );
|
Q_strncpyz( stdName, name, sizeof( stdName ) );
|
||||||
g_FuncTable.m_pfnQE_ConvertDOSToUnixName( stdName, stdName );
|
g_FuncTable.m_pfnQE_ConvertDOSToUnixName( stdName, stdName );
|
||||||
if ( stdName[strlen( name ) - 4] == '.' ) {
|
if ( stdName[strlen( name ) - 4] == '.' ) {
|
||||||
// strip extension
|
// strip extension
|
||||||
|
@ -80,8 +80,8 @@ const char *WINAPI QERApp_CleanTextureName( const char *name, bool bAddTexture =
|
||||||
|
|
||||||
if ( bAddTexture ) {
|
if ( bAddTexture ) {
|
||||||
char aux[QER_MAX_NAMELEN];
|
char aux[QER_MAX_NAMELEN];
|
||||||
sprintf( aux, "textures/%s", stdName );
|
snprintf( aux, sizeof( aux ), "textures/%s", stdName );
|
||||||
strcpy( stdName, aux );
|
Q_strncpyz( stdName, aux, sizeof( stdName ) );
|
||||||
}
|
}
|
||||||
return stdName;
|
return stdName;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ CPtrArray PatchShaders;
|
||||||
void PushPatch( patchMesh_t * patch ){
|
void PushPatch( patchMesh_t * patch ){
|
||||||
patchEntry_t *pEntry = new patchEntry_s;
|
patchEntry_t *pEntry = new patchEntry_s;
|
||||||
pEntry->p = patch;
|
pEntry->p = patch;
|
||||||
strcpy( pEntry->name, patch->pShader->getName() );
|
Q_strncpyz( pEntry->name, patch->pShader->getName(), sizeof( pEntry->name ) );
|
||||||
PatchShaders.Add( pEntry );
|
PatchShaders.Add( pEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ qtexture_t *WINAPI QERApp_Try_Texture_ForName( const char *name ){
|
||||||
}
|
}
|
||||||
g_free( pPixels );
|
g_free( pPixels );
|
||||||
|
|
||||||
strcpy( q->name, name );
|
Q_strncpyz( q->name, name, sizeof( q->name ) );
|
||||||
// only strip extension if extension there is!
|
// only strip extension if extension there is!
|
||||||
if ( q->name[strlen( q->name ) - 4] == '.' ) {
|
if ( q->name[strlen( q->name ) - 4] == '.' ) {
|
||||||
q->name[strlen( q->name ) - 4] = '\0';
|
q->name[strlen( q->name ) - 4] = '\0';
|
||||||
|
@ -792,7 +792,7 @@ void CShader::CreateColor( const char *name ){
|
||||||
// copy this one
|
// copy this one
|
||||||
qtexture_t *q2 = new qtexture_t;
|
qtexture_t *q2 = new qtexture_t;
|
||||||
memcpy( q2, q1, sizeof( qtexture_t ) );
|
memcpy( q2, q1, sizeof( qtexture_t ) );
|
||||||
strcpy( q2->name, m_strTextureName.GetBuffer() );
|
Q_strncpyz( q2->name, m_strTextureName.GetBuffer(), sizeof( q2->name ) );
|
||||||
VectorCopy( m_vColor, q2->color );
|
VectorCopy( m_vColor, q2->color );
|
||||||
m_pTexture = q2;
|
m_pTexture = q2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ void IsFaceConflicting(){
|
||||||
|
|
||||||
tmp_texdef = &get_texdef_face_list()->texdef;
|
tmp_texdef = &get_texdef_face_list()->texdef;
|
||||||
|
|
||||||
strcpy( texture_name, tmp_texdef->GetName() );
|
Q_strncpyz( texture_name, tmp_texdef->GetName(), sizeof( texture_name ) );
|
||||||
|
|
||||||
texdef_SI_values.shift[0] = tmp_texdef->shift[0];
|
texdef_SI_values.shift[0] = tmp_texdef->shift[0];
|
||||||
texdef_SI_values.shift[1] = tmp_texdef->shift[1];
|
texdef_SI_values.shift[1] = tmp_texdef->shift[1];
|
||||||
|
@ -288,6 +288,7 @@ static void PopulateTextureComboList(){
|
||||||
texdef_to_face_t* temp_texdef_face_list;
|
texdef_to_face_t* temp_texdef_face_list;
|
||||||
char blank[1];
|
char blank[1];
|
||||||
GList *items = NULL;
|
GList *items = NULL;
|
||||||
|
GList *lst;
|
||||||
int num_of_list_items = 0;
|
int num_of_list_items = 0;
|
||||||
|
|
||||||
blank[0] = 0;
|
blank[0] = 0;
|
||||||
|
@ -295,14 +296,14 @@ static void PopulateTextureComboList(){
|
||||||
if ( texdef_face_list_empty() ) {
|
if ( texdef_face_list_empty() ) {
|
||||||
items = g_list_append( items, (gpointer) blank );
|
items = g_list_append( items, (gpointer) blank );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, blank );
|
Q_strncpyz( old_texture_entry, blank, sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
else if ( !is_TextureName_conflicting ) {
|
else if ( !is_TextureName_conflicting ) {
|
||||||
temp_texdef_face_list = get_texdef_face_list();
|
temp_texdef_face_list = get_texdef_face_list();
|
||||||
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
|
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
|
||||||
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
|
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, tmp_texdef->GetName() );
|
Q_strncpyz( old_texture_entry, tmp_texdef->GetName(), sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -322,7 +323,7 @@ static void PopulateTextureComboList(){
|
||||||
// If this isn't added last (to the top of the list), g_list_find freaks.
|
// If this isn't added last (to the top of the list), g_list_find freaks.
|
||||||
items = g_list_prepend( items, (gpointer) blank );
|
items = g_list_prepend( items, (gpointer) blank );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, blank );
|
Q_strncpyz( old_texture_entry, blank, sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
|
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
|
||||||
|
@ -1232,7 +1233,7 @@ void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
|
||||||
|
|
||||||
if ( !texdef_face_list_empty() && g_bListenChanged ) {
|
if ( !texdef_face_list_empty() && g_bListenChanged ) {
|
||||||
// activate only on entry change
|
// activate only on entry change
|
||||||
strcpy( text, gtk_entry_get_text( entry ) );
|
Q_strncpyz( text, gtk_entry_get_text( entry ), sizeof( text ) );
|
||||||
if ( strcmp( old_texture_entry, text ) ) {
|
if ( strcmp( old_texture_entry, text ) ) {
|
||||||
// Check for spaces in shader name
|
// Check for spaces in shader name
|
||||||
if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
|
if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
|
||||||
|
@ -1244,7 +1245,7 @@ void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
|
||||||
{
|
{
|
||||||
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
|
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
|
||||||
tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
|
tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
|
||||||
strcpy( old_texture_entry, text );
|
Q_strncpyz( old_texture_entry, text, sizeof( old_texture_entry ) );
|
||||||
tmp_texdef->SetName( text );
|
tmp_texdef->SetName( text );
|
||||||
}
|
}
|
||||||
GetTexMods();
|
GetTexMods();
|
||||||
|
|
|
@ -161,7 +161,7 @@ void IsFaceConflicting(){
|
||||||
|
|
||||||
tmp_texdef = &get_texdef_face_list()->texdef;
|
tmp_texdef = &get_texdef_face_list()->texdef;
|
||||||
|
|
||||||
strcpy( texture_name, tmp_texdef->GetName() );
|
Q_strncpyz( texture_name, tmp_texdef->GetName(), sizeof( texture_name ) );
|
||||||
|
|
||||||
texdef_SI_values.shift[0] = tmp_texdef->shift[0];
|
texdef_SI_values.shift[0] = tmp_texdef->shift[0];
|
||||||
texdef_SI_values.shift[1] = tmp_texdef->shift[1];
|
texdef_SI_values.shift[1] = tmp_texdef->shift[1];
|
||||||
|
@ -260,14 +260,14 @@ static void PopulateTextureComboList(){
|
||||||
if ( texdef_face_list_empty() ) {
|
if ( texdef_face_list_empty() ) {
|
||||||
items = g_list_append( items, (gpointer) blank );
|
items = g_list_append( items, (gpointer) blank );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, blank );
|
Q_strncpyz( old_texture_entry, blank, sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
else if ( !is_TextureName_conflicting ) {
|
else if ( !is_TextureName_conflicting ) {
|
||||||
temp_texdef_face_list = get_texdef_face_list();
|
temp_texdef_face_list = get_texdef_face_list();
|
||||||
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
|
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
|
||||||
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
|
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, tmp_texdef->GetName() );
|
Q_strncpyz( old_texture_entry, tmp_texdef->GetName(), sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -287,7 +287,7 @@ static void PopulateTextureComboList(){
|
||||||
// If this isn't added last (to the top of the list), g_list_find freaks.
|
// If this isn't added last (to the top of the list), g_list_find freaks.
|
||||||
items = g_list_prepend( items, (gpointer) blank );
|
items = g_list_prepend( items, (gpointer) blank );
|
||||||
// For Texture Entry, activate only on entry change
|
// For Texture Entry, activate only on entry change
|
||||||
strcpy( old_texture_entry, blank );
|
Q_strncpyz( old_texture_entry, blank, sizeof( old_texture_entry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
|
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
|
||||||
|
@ -879,7 +879,7 @@ void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
|
||||||
|
|
||||||
if ( !texdef_face_list_empty() && g_bListenChanged ) {
|
if ( !texdef_face_list_empty() && g_bListenChanged ) {
|
||||||
// activate only on entry change
|
// activate only on entry change
|
||||||
strcpy( text, gtk_entry_get_text( entry ) );
|
Q_strncpyz( text, gtk_entry_get_text( entry ), sizeof( text ) );
|
||||||
if ( strcmp( old_texture_entry, text ) ) {
|
if ( strcmp( old_texture_entry, text ) ) {
|
||||||
// Check for spaces in shader name
|
// Check for spaces in shader name
|
||||||
if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
|
if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
|
||||||
|
@ -891,7 +891,7 @@ void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
|
||||||
{
|
{
|
||||||
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
|
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
|
||||||
tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
|
tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
|
||||||
strcpy( old_texture_entry, text );
|
Q_strncpyz( old_texture_entry, text, sizeof( old_texture_entry ) );
|
||||||
tmp_texdef->SetName( text );
|
tmp_texdef->SetName( text );
|
||||||
}
|
}
|
||||||
GetTexMods();
|
GetTexMods();
|
||||||
|
|
|
@ -33,8 +33,7 @@ GtkWidget *notebook1;
|
||||||
// 32 bit is the max
|
// 32 bit is the max
|
||||||
#define MAX_BUTTONS 32
|
#define MAX_BUTTONS 32
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_MSC_VER) && _MSC_VER<1900 && !(defined snprintf)
|
||||||
// TTimo: THIS IS UGLY
|
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ void set_surface_flags_button_state( texdef_to_face_t *texdef_face_list, bool b_
|
||||||
int diff_contents = 0;
|
int diff_contents = 0;
|
||||||
int diff_flags = 0;
|
int diff_flags = 0;
|
||||||
gboolean diff_value = FALSE;
|
gboolean diff_value = FALSE;
|
||||||
char tex_buff[11];
|
char tex_buff[16];
|
||||||
texdef_t* tmp_texdef;
|
texdef_t* tmp_texdef;
|
||||||
texdef_to_face_t* temp_texdef_face_list;
|
texdef_to_face_t* temp_texdef_face_list;
|
||||||
int i;
|
int i;
|
||||||
|
@ -164,7 +163,7 @@ void set_surface_flags_button_state( texdef_to_face_t *texdef_face_list, bool b_
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
working_value = value;
|
working_value = value;
|
||||||
sprintf( tex_buff, "%d", value );
|
snprintf( tex_buff, sizeof( tex_buff ), "%d", value );
|
||||||
gtk_entry_set_text( (GtkEntry *)value_entry, tex_buff );
|
gtk_entry_set_text( (GtkEntry *)value_entry, tex_buff );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +301,7 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
|
||||||
GtkWidget *label6;
|
GtkWidget *label6;
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
const char *buttonLabel;
|
const char *buttonLabel;
|
||||||
char buffer[8];
|
char buffer[16];
|
||||||
|
|
||||||
frame1 = gtk_frame_new( _( "Flags" ) );
|
frame1 = gtk_frame_new( _( "Flags" ) );
|
||||||
gtk_widget_show( frame1 );
|
gtk_widget_show( frame1 );
|
||||||
|
@ -334,7 +333,7 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
x = i % 4;
|
x = i % 4;
|
||||||
snprintf( buffer, sizeof( buffer ) - 1, "surf%i", i + 1 );
|
snprintf( buffer, sizeof( buffer ), "surf%i", i + 1 );
|
||||||
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
|
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
|
||||||
//Sys_Printf( "%s: %s\n", buffer, buttonLabel );
|
//Sys_Printf( "%s: %s\n", buffer, buttonLabel );
|
||||||
surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
|
surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
|
||||||
|
@ -392,7 +391,7 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
x = i % 4;
|
x = i % 4;
|
||||||
snprintf( buffer, sizeof( buffer ) - 1, "cont%i", i + 1 );
|
snprintf( buffer, sizeof( buffer ), "cont%i", i + 1 );
|
||||||
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
|
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
|
||||||
content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
|
content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
|
||||||
gtk_signal_connect( GTK_OBJECT( content_buttons[i] ), "toggled", GTK_SIGNAL_FUNC( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) );
|
gtk_signal_connect( GTK_OBJECT( content_buttons[i] ), "toggled", GTK_SIGNAL_FUNC( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) );
|
||||||
|
|
|
@ -93,11 +93,11 @@ static bool g_bUsePak = true;
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
static void vfsAddSlash( char *str ){
|
static void vfsAddSlash( char *str, size_t length ){
|
||||||
int n = strlen( str );
|
int n = strlen( str );
|
||||||
if ( n > 0 ) {
|
if ( n > 0 ) {
|
||||||
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
||||||
strcat( str, "/" );
|
strncat( str, "/", length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,10 +182,10 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
|
||||||
|
|
||||||
dirname[0] = '\0';
|
dirname[0] = '\0';
|
||||||
if ( dir != NULL ) {
|
if ( dir != NULL ) {
|
||||||
strcat( dirname, dir );
|
strncat( dirname, dir, sizeof( dirname ) );
|
||||||
strlwr( dirname );
|
strlwr( dirname );
|
||||||
vfsFixDOSName( dirname );
|
vfsFixDOSName( dirname );
|
||||||
vfsAddSlash( dirname );
|
vfsAddSlash( dirname, sizeof( dirname ) );
|
||||||
Sys_Printf( "vfs dirname_1: %s\n", dirname );
|
Sys_Printf( "vfs dirname_1: %s\n", dirname );
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
|
@ -193,7 +193,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
|
||||||
dirlen = strlen( dirname );
|
dirlen = strlen( dirname );
|
||||||
|
|
||||||
if ( ext != NULL ) {
|
if ( ext != NULL ) {
|
||||||
strcpy( extension, ext );
|
Q_strncpyz( extension, ext, sizeof( extension ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
extension[0] = '\0';
|
extension[0] = '\0';
|
||||||
|
@ -259,11 +259,11 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( dirname, g_strDirs[i] );
|
Q_strncpyz( dirname, g_strDirs[i], sizeof( dirname ) );
|
||||||
strcat( dirname, dir );
|
strncat( dirname, dir, sizeof( dirname ) );
|
||||||
strlwr( dirname );
|
strlwr( dirname );
|
||||||
vfsFixDOSName( dirname );
|
vfsFixDOSName( dirname );
|
||||||
vfsAddSlash( dirname );
|
vfsAddSlash( dirname, sizeof( dirname ) );
|
||||||
|
|
||||||
diskdir = g_dir_open( dirname, 0, NULL );
|
diskdir = g_dir_open( dirname, 0, NULL );
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s%s", dirname, name );
|
snprintf( filename, sizeof( filename ), "%s%s", dirname, name );
|
||||||
stat( filename, &st );
|
stat( filename, &st );
|
||||||
Sys_Printf( "vfs FileName: %s\n", filename );
|
Sys_Printf( "vfs FileName: %s\n", filename );
|
||||||
|
|
||||||
|
@ -381,9 +381,9 @@ void vfsInitDirectory( const char *path ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( g_strDirs[g_numDirs], path );
|
Q_strncpyz( g_strDirs[g_numDirs], path, sizeof( g_strDirs[g_numDirs] ) );
|
||||||
vfsFixDOSName( g_strDirs[g_numDirs] );
|
vfsFixDOSName( g_strDirs[g_numDirs] );
|
||||||
vfsAddSlash( g_strDirs[g_numDirs] );
|
vfsAddSlash( g_strDirs[g_numDirs], sizeof( g_strDirs[g_numDirs] ) );
|
||||||
g_numDirs++;
|
g_numDirs++;
|
||||||
|
|
||||||
if ( g_bUsePak ) {
|
if ( g_bUsePak ) {
|
||||||
|
@ -417,9 +417,9 @@ void vfsInitDirectory( const char *path ){
|
||||||
while ( dirlist )
|
while ( dirlist )
|
||||||
{
|
{
|
||||||
GSList *cur = dirlist;
|
GSList *cur = dirlist;
|
||||||
char* name = (char*)cur->data;
|
gchar* name = (gchar*)cur->data;
|
||||||
|
|
||||||
sprintf( filename, "%s/%s", path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s", path, name );
|
||||||
vfsInitPakFile( filename );
|
vfsInitPakFile( filename );
|
||||||
|
|
||||||
g_free( name );
|
g_free( name );
|
||||||
|
@ -471,7 +471,7 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
char fixed[NAME_MAX], tmp[NAME_MAX];
|
char fixed[NAME_MAX], tmp[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -486,8 +486,8 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, fixed );
|
strncat( tmp, fixed, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -503,14 +503,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
*bufferptr = NULL;
|
*bufferptr = NULL;
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, filename );
|
strncat( tmp, filename, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
long len;
|
long len;
|
||||||
|
@ -646,11 +646,11 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( l_in,in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
}
|
}
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#else
|
#else
|
||||||
strcpy( l_in, in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#endif // ifdef WIN32
|
#endif // ifdef WIN32
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( check,g_strDirs[i] );
|
Q_strncpyz( check, g_strDirs[i], sizeof( check ) );
|
||||||
vfsCleanFileName( check );
|
vfsCleanFileName( check );
|
||||||
#ifdef DBG_RLTPATH
|
#ifdef DBG_RLTPATH
|
||||||
Sys_Printf( "Matching against %s\n", check );
|
Sys_Printf( "Matching against %s\n", check );
|
||||||
|
@ -669,7 +669,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
// try to find a match
|
// try to find a match
|
||||||
if ( strstr( l_in, check ) ) {
|
if ( strstr( l_in, check ) ) {
|
||||||
strcpy( out,l_in + strlen( check ) + 1 );
|
Q_strncpyz( out, l_in + strlen( check ) + 1, sizeof( out ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
char fixed[NAME_MAX];
|
char fixed[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, in );
|
Q_strncpyz( fixed, in, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
lastptr = ptr + 1;
|
lastptr = ptr + 1;
|
||||||
|
|
||||||
if ( strcmp( lastptr, fixed ) == 0 ) {
|
if ( strcmp( lastptr, fixed ) == 0 ) {
|
||||||
strncpy( out,file->name,PATH_MAX );
|
Q_strncpyz( out, file->name, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,11 +726,11 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, in );
|
strncat( tmp, in, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
strcpy( out, tmp );
|
Q_strncpyz( out, tmp, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
@ -762,7 +762,7 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this is the clean, not short version
|
// this is the clean, not short version
|
||||||
strcpy( out, in );
|
Q_strncpyz( out, in, sizeof( out ) );
|
||||||
vfsCleanFileName( out );
|
vfsCleanFileName( out );
|
||||||
for ( i = 0; i <= count; i++ )
|
for ( i = 0; i <= count; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,11 +86,11 @@ static bool g_bUsePak = true;
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
static void vfsAddSlash( char *str ){
|
static void vfsAddSlash( char *str, size_t length ){
|
||||||
int n = strlen( str );
|
int n = strlen( str );
|
||||||
if ( n > 0 ) {
|
if ( n > 0 ) {
|
||||||
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
||||||
strcat( str, "/" );
|
strncat( str, "/", length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,10 +174,10 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( refdir != NULL ) {
|
if ( refdir != NULL ) {
|
||||||
strcpy( dirname, refdir );
|
Q_strncpyz( dirname, refdir, sizeof( dirname ) );
|
||||||
strlwr( dirname );
|
strlwr( dirname );
|
||||||
vfsFixDOSName( dirname );
|
vfsFixDOSName( dirname );
|
||||||
vfsAddSlash( dirname );
|
vfsAddSlash( dirname, sizeof( dirname ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
dirname[0] = '\0';
|
dirname[0] = '\0';
|
||||||
|
@ -185,7 +185,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
dirlen = strlen( dirname );
|
dirlen = strlen( dirname );
|
||||||
|
|
||||||
if ( ext != NULL ) {
|
if ( ext != NULL ) {
|
||||||
strcpy( extension, ext );
|
Q_strncpyz( extension, ext, sizeof( extension ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
extension[0] = '\0';
|
extension[0] = '\0';
|
||||||
|
@ -252,8 +252,8 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( basedir, g_strDirs[i] );
|
Q_strncpyz( basedir, g_strDirs[i], sizeof( basedir ) );
|
||||||
strcat( basedir, dirname );
|
strncat( basedir, dirname, sizeof( basedir ) );
|
||||||
|
|
||||||
diskdir = g_dir_open( basedir, 0, NULL );
|
diskdir = g_dir_open( basedir, 0, NULL );
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s%s", basedir, name );
|
snprintf( filename, sizeof( filename ), "%s%s", basedir, name );
|
||||||
stat( filename, &st );
|
stat( filename, &st );
|
||||||
|
|
||||||
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
||||||
|
@ -394,9 +394,9 @@ void vfsInitDirectory( const char *path ){
|
||||||
iGameMode = 0;
|
iGameMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( g_strDirs[g_numDirs], path );
|
Q_strncpyz( g_strDirs[g_numDirs], path, sizeof( g_strDirs[g_numDirs] ) );
|
||||||
vfsFixDOSName( g_strDirs[g_numDirs] );
|
vfsFixDOSName( g_strDirs[g_numDirs] );
|
||||||
vfsAddSlash( g_strDirs[g_numDirs] );
|
vfsAddSlash( g_strDirs[g_numDirs], sizeof( g_strDirs[g_numDirs] ) );
|
||||||
g_numDirs++;
|
g_numDirs++;
|
||||||
|
|
||||||
if ( g_bUsePak ) {
|
if ( g_bUsePak ) {
|
||||||
|
@ -423,13 +423,13 @@ void vfsInitDirectory( const char *path ){
|
||||||
switch ( iGameMode )
|
switch ( iGameMode )
|
||||||
{
|
{
|
||||||
case 1: // SP
|
case 1: // SP
|
||||||
if ( strncmp( direntry,"sp_",3 ) == 0 ) {
|
if ( strncmp( direntry, "sp_", 3 ) == 0 ) {
|
||||||
memcpy( direntry,"zz",2 );
|
memcpy( direntry, "zz", 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // MP
|
case 2: // MP
|
||||||
if ( strncmp( direntry,"mp_",3 ) == 0 ) {
|
if ( strncmp( direntry, "mp_", 3 ) == 0 ) {
|
||||||
memcpy( direntry,"zz",2 );
|
memcpy( direntry, "zz", 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -451,28 +451,28 @@ void vfsInitDirectory( const char *path ){
|
||||||
switch ( iGameMode )
|
switch ( iGameMode )
|
||||||
{
|
{
|
||||||
case 1: // SP
|
case 1: // SP
|
||||||
if ( strncmp( name,"mp_",3 ) == 0 ) {
|
if ( strncmp( name, "mp_", 3 ) == 0 ) {
|
||||||
g_free( name );
|
g_free( name );
|
||||||
dirlist = g_slist_remove( cur, name );
|
dirlist = g_slist_remove( cur, name );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ( strncmp( name,"zz_",3 ) == 0 ) {
|
else if ( strncmp( name, "zz_", 3 ) == 0 ) {
|
||||||
memcpy( name,"sp",2 );
|
memcpy( name, "sp", 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // MP
|
case 2: // MP
|
||||||
if ( strncmp( name,"sp_",3 ) == 0 ) {
|
if ( strncmp( name, "sp_", 3 ) == 0 ) {
|
||||||
g_free( name );
|
g_free( name );
|
||||||
dirlist = g_slist_remove( cur, name );
|
dirlist = g_slist_remove( cur, name );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ( strncmp( name,"zz_",3 ) == 0 ) {
|
else if ( strncmp( name, "zz_", 3 ) == 0 ) {
|
||||||
memcpy( name,"mp",2 );
|
memcpy( name, "mp", 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s/%s", path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s", path, name );
|
||||||
vfsInitPakFile( filename );
|
vfsInitPakFile( filename );
|
||||||
|
|
||||||
g_free( name );
|
g_free( name );
|
||||||
|
@ -534,7 +534,7 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
char fixed[NAME_MAX], tmp[NAME_MAX];
|
char fixed[NAME_MAX], tmp[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -552,8 +552,8 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, fixed );
|
strncat( tmp, fixed, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -598,14 +598,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
*bufferptr = NULL;
|
*bufferptr = NULL;
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, filename );
|
strncat( tmp, filename, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
return vfsLoadFullPathFile( tmp,bufferptr );
|
return vfsLoadFullPathFile( tmp,bufferptr );
|
||||||
|
@ -684,11 +684,11 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( l_in,in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
}
|
}
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#else
|
#else
|
||||||
strcpy( l_in, in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#endif // ifdef WIN32
|
#endif // ifdef WIN32
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( check,g_strDirs[i] );
|
Q_strncpyz( check, g_strDirs[i], sizeof( check ) );
|
||||||
vfsCleanFileName( check );
|
vfsCleanFileName( check );
|
||||||
#ifdef DBG_RLTPATH
|
#ifdef DBG_RLTPATH
|
||||||
Sys_Printf( "Matching against %s\n", check );
|
Sys_Printf( "Matching against %s\n", check );
|
||||||
|
@ -707,7 +707,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
// try to find a match
|
// try to find a match
|
||||||
if ( strstr( l_in, check ) ) {
|
if ( strstr( l_in, check ) ) {
|
||||||
strcpy( out,l_in + strlen( check ) + 1 );
|
Q_strncpyz( out, l_in + strlen( check ) + 1, sizeof( out ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this is the clean, not short version
|
// this is the clean, not short version
|
||||||
strcpy( out, in );
|
Q_strncpyz( out, in, sizeof( out ) );
|
||||||
vfsCleanFileName( out );
|
vfsCleanFileName( out );
|
||||||
for ( i = 0; i <= count; i++ )
|
for ( i = 0; i <= count; i++ )
|
||||||
{
|
{
|
||||||
|
@ -788,7 +788,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
char fixed[NAME_MAX];
|
char fixed[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, in );
|
Q_strncpyz( fixed, in, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
lastptr = ptr + 1;
|
lastptr = ptr + 1;
|
||||||
|
|
||||||
if ( strcmp( lastptr, fixed ) == 0 ) {
|
if ( strcmp( lastptr, fixed ) == 0 ) {
|
||||||
strncpy( out,file->name,PATH_MAX );
|
Q_strncpyz( out, file->name, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -813,11 +813,11 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, in );
|
strncat( tmp, in, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
strcpy( out, tmp );
|
Q_strncpyz( out, tmp, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -85,11 +85,11 @@ static bool g_bUsePak = true;
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
static void vfsAddSlash( char *str ){
|
static void vfsAddSlash( char *str, size_t length ){
|
||||||
int n = strlen( str );
|
int n = strlen( str );
|
||||||
if ( n > 0 ) {
|
if ( n > 0 ) {
|
||||||
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
||||||
strcat( str, "/" );
|
strncat( str, "/", length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,10 +172,10 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( refdir != NULL ) {
|
if ( refdir != NULL ) {
|
||||||
strcpy( dirname, refdir );
|
Q_strncpyz( dirname, refdir, sizeof( dirname ) );
|
||||||
strlwr( dirname );
|
strlwr( dirname );
|
||||||
vfsFixDOSName( dirname );
|
vfsFixDOSName( dirname );
|
||||||
vfsAddSlash( dirname );
|
vfsAddSlash( dirname, sizeof( dirname ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
dirname[0] = '\0';
|
dirname[0] = '\0';
|
||||||
|
@ -183,7 +183,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
dirlen = strlen( dirname );
|
dirlen = strlen( dirname );
|
||||||
|
|
||||||
if ( ext != NULL ) {
|
if ( ext != NULL ) {
|
||||||
strcpy( extension, ext );
|
Q_strncpyz( extension, ext, sizeof( extension ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
extension[0] = '\0';
|
extension[0] = '\0';
|
||||||
|
@ -250,8 +250,8 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( basedir, g_strDirs[i] );
|
Q_strncpyz( basedir, g_strDirs[i], sizeof( basedir ) );
|
||||||
strcat( basedir, dirname );
|
strncat( basedir, dirname, sizeof( basedir ) );
|
||||||
|
|
||||||
diskdir = g_dir_open( basedir, 0, NULL );
|
diskdir = g_dir_open( basedir, 0, NULL );
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s%s", basedir, name );
|
snprintf( filename, sizeof( filename ), "%s%s", basedir, name );
|
||||||
stat( filename, &st );
|
stat( filename, &st );
|
||||||
|
|
||||||
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
||||||
|
@ -392,9 +392,9 @@ void vfsInitDirectory( const char *path ){
|
||||||
iGameMode = 0;
|
iGameMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( g_strDirs[g_numDirs], path );
|
Q_strncpyz( g_strDirs[g_numDirs], path, sizeof( g_strDirs[g_numDirs] ) );
|
||||||
vfsFixDOSName( g_strDirs[g_numDirs] );
|
vfsFixDOSName( g_strDirs[g_numDirs] );
|
||||||
vfsAddSlash( g_strDirs[g_numDirs] );
|
vfsAddSlash( g_strDirs[g_numDirs], sizeof( g_strDirs[g_numDirs] ) );
|
||||||
g_numDirs++;
|
g_numDirs++;
|
||||||
|
|
||||||
if ( g_bUsePak ) {
|
if ( g_bUsePak ) {
|
||||||
|
@ -470,7 +470,7 @@ void vfsInitDirectory( const char *path ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s/%s", path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s", path, name );
|
||||||
vfsInitPakFile( filename );
|
vfsInitPakFile( filename );
|
||||||
|
|
||||||
g_free( name );
|
g_free( name );
|
||||||
|
@ -532,7 +532,7 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
char fixed[NAME_MAX], tmp[NAME_MAX];
|
char fixed[NAME_MAX], tmp[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -550,8 +550,8 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, fixed );
|
strncat( tmp, fixed, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -596,14 +596,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
*bufferptr = NULL;
|
*bufferptr = NULL;
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, filename );
|
strncat( tmp, filename, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
return vfsLoadFullPathFile( tmp,bufferptr );
|
return vfsLoadFullPathFile( tmp,bufferptr );
|
||||||
|
@ -682,11 +682,11 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( l_in,in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
}
|
}
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#else
|
#else
|
||||||
strcpy( l_in, in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in );
|
||||||
#endif // ifdef WIN32
|
#endif // ifdef WIN32
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( check,g_strDirs[i] );
|
Q_strncpyz( check, g_strDirs[i], sizeof( check ) );
|
||||||
vfsCleanFileName( check );
|
vfsCleanFileName( check );
|
||||||
#ifdef DBG_RLTPATH
|
#ifdef DBG_RLTPATH
|
||||||
Sys_Printf( "Matching against %s\n", check );
|
Sys_Printf( "Matching against %s\n", check );
|
||||||
|
@ -705,7 +705,7 @@ char* vfsExtractRelativePath_short( const char *in, bool shorten ){
|
||||||
|
|
||||||
// try to find a match
|
// try to find a match
|
||||||
if ( strstr( l_in, check ) ) {
|
if ( strstr( l_in, check ) ) {
|
||||||
strcpy( out,l_in + strlen( check ) + 1 );
|
Q_strncpyz( out, l_in + strlen( check ) + 1, sizeof( out ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this is the clean, not short version
|
// this is the clean, not short version
|
||||||
strcpy( out, in );
|
Q_strncpyz( out, in, sizeof( out ) );
|
||||||
vfsCleanFileName( out );
|
vfsCleanFileName( out );
|
||||||
for ( i = 0; i <= count; i++ )
|
for ( i = 0; i <= count; i++ )
|
||||||
{
|
{
|
||||||
|
@ -786,7 +786,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
char fixed[NAME_MAX];
|
char fixed[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, in );
|
Q_strncpyz( fixed, in, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -801,7 +801,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
lastptr = ptr + 1;
|
lastptr = ptr + 1;
|
||||||
|
|
||||||
if ( strcmp( lastptr, fixed ) == 0 ) {
|
if ( strcmp( lastptr, fixed ) == 0 ) {
|
||||||
strncpy( out,file->name,PATH_MAX );
|
Q_strncpyz( out, file->name, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -811,11 +811,11 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, in );
|
strncat( tmp, in, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
strcpy( out, tmp );
|
Q_strncpyz( out, tmp, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -85,11 +85,11 @@ static int g_numDirs;
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
static void vfsAddSlash( char *str ){
|
static void vfsAddSlash( char *str, size_t length ){
|
||||||
int n = strlen( str );
|
int n = strlen( str );
|
||||||
if ( n > 0 ) {
|
if ( n > 0 ) {
|
||||||
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
||||||
strcat( str, "/" );
|
strncat( str, "/", length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ int vfsBuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){
|
||||||
int nResult = GetFullPathName( pPath, nBufferLen, pBuffer, &pFile );
|
int nResult = GetFullPathName( pPath, nBufferLen, pBuffer, &pFile );
|
||||||
nResult = GetShortPathName( pPath, pBuffer, nBufferLen );
|
nResult = GetShortPathName( pPath, pBuffer, nBufferLen );
|
||||||
if ( nResult == 0 ) {
|
if ( nResult == 0 ) {
|
||||||
strcpy( pBuffer, pPath ); // Use long filename
|
Q_strncpyz( pBuffer, pPath, nBufferLen ); // Use long filename
|
||||||
}
|
}
|
||||||
return nResult;
|
return nResult;
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,7 +162,7 @@ static void vfsInitPakFile( const char *filename ){
|
||||||
for ( i = strlen( filename ) - 1 ; i >= 0 && filename[i] != '\\' && filename[i] != '/' ; i-- )
|
for ( i = strlen( filename ) - 1 ; i >= 0 && filename[i] != '\\' && filename[i] != '/' ; i-- )
|
||||||
wadnameptr = (char *)filename + i;
|
wadnameptr = (char *)filename + i;
|
||||||
|
|
||||||
strcpy( wadname,wadnameptr );
|
Q_strncpyz( wadname, wadnameptr, sizeof( wadname ) );
|
||||||
wadname[strlen( wadname ) - 4] = 0; // ditch the .wad so everthing looks nice!
|
wadname[strlen( wadname ) - 4] = 0; // ditch the .wad so everthing looks nice!
|
||||||
strlwr( wadname );
|
strlwr( wadname );
|
||||||
|
|
||||||
|
@ -190,10 +190,10 @@ static void vfsInitPakFile( const char *filename ){
|
||||||
|
|
||||||
// texturenames in wad files don't have an extensions or paths, so we must add them!
|
// texturenames in wad files don't have an extensions or paths, so we must add them!
|
||||||
if ( wf->lpLump->type == WAD2_TYPE_MIP ) {
|
if ( wf->lpLump->type == WAD2_TYPE_MIP ) {
|
||||||
sprintf( filename_inwadfixed,"textures/%s/%s.mip",wadname,filename_inwad );
|
snprintf( filename_inwadfixed, sizeof( filename_inwadfixed ), "textures/%s/%s.mip", wadname,filename_inwad );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf( filename_inwadfixed,"textures/%s/%s.hlw",wadname,filename_inwad );
|
snprintf( filename_inwadfixed, sizeof( filename_inwadfixed ), "textures/%s/%s.hlw", wadname,filename_inwad );
|
||||||
}
|
}
|
||||||
|
|
||||||
//g_FuncTable.m_pfnSysFPrintf(SYS_WRN, " scanned %s\\%s\n", filename,filename_inwad);
|
//g_FuncTable.m_pfnSysFPrintf(SYS_WRN, " scanned %s\\%s\n", filename,filename_inwad);
|
||||||
|
@ -221,10 +221,10 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( refdir != NULL ) {
|
if ( refdir != NULL ) {
|
||||||
strcpy( dirname, refdir );
|
Q_strncpyz( dirname, refdir, sizeof( dirname ) );
|
||||||
strlwr( dirname );
|
strlwr( dirname );
|
||||||
vfsFixDOSName( dirname );
|
vfsFixDOSName( dirname );
|
||||||
vfsAddSlash( dirname );
|
vfsAddSlash( dirname, sizeof( dirname ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
dirname[0] = '\0';
|
dirname[0] = '\0';
|
||||||
|
@ -232,7 +232,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
dirlen = strlen( dirname );
|
dirlen = strlen( dirname );
|
||||||
|
|
||||||
if ( ext != NULL ) {
|
if ( ext != NULL ) {
|
||||||
strcpy( extension, ext );
|
Q_strncpyz( extension, ext, sizeof( extension ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
extension[0] = '\0';
|
extension[0] = '\0';
|
||||||
|
@ -299,8 +299,8 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( basedir, g_strDirs[i] );
|
Q_strncpyz( basedir, g_strDirs[i], sizeof( basedir ) );
|
||||||
strcat( basedir, dirname );
|
strncat( basedir, dirname, sizeof( basedir ) );
|
||||||
|
|
||||||
GDir* dir = g_dir_open( basedir, 0, NULL );
|
GDir* dir = g_dir_open( basedir, 0, NULL );
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s%s", basedir, name );
|
snprintf( filename, sizeof( filename ), "%s%s", basedir, name );
|
||||||
stat( filename, &st );
|
stat( filename, &st );
|
||||||
|
|
||||||
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
if ( ( S_ISDIR( st.st_mode ) != 0 ) != directories ) {
|
||||||
|
@ -366,9 +366,9 @@ void vfsInitDirectory( const char *path ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( g_strDirs[g_numDirs], path );
|
Q_strncpyz( g_strDirs[g_numDirs], path, sizeof( g_strDirs[g_numDirs] ) );
|
||||||
vfsFixDOSName( g_strDirs[g_numDirs] );
|
vfsFixDOSName( g_strDirs[g_numDirs] );
|
||||||
vfsAddSlash( g_strDirs[g_numDirs] );
|
vfsAddSlash( g_strDirs[g_numDirs], sizeof( g_strDirs[g_numDirs] ) );
|
||||||
g_numDirs++;
|
g_numDirs++;
|
||||||
|
|
||||||
// if (g_PrefsDlg.m_bPAK)
|
// if (g_PrefsDlg.m_bPAK)
|
||||||
|
@ -389,7 +389,7 @@ void vfsInitDirectory( const char *path ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( filename, "%s/%s", path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s", path, name );
|
||||||
vfsInitPakFile( filename );
|
vfsInitPakFile( filename );
|
||||||
}
|
}
|
||||||
g_dir_close( dir );
|
g_dir_close( dir );
|
||||||
|
@ -450,7 +450,7 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
char fixed[NAME_MAX], tmp[NAME_MAX];
|
char fixed[NAME_MAX], tmp[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -468,8 +468,8 @@ int vfsGetFileCount( const char *filename, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, fixed );
|
strncat( tmp, fixed, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -514,14 +514,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
*bufferptr = NULL;
|
*bufferptr = NULL;
|
||||||
strcpy( fixed, filename );
|
Q_strncpyz( fixed, filename, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, filename );
|
strncat( tmp, filename, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
return vfsLoadFullPathFile( tmp,bufferptr );
|
return vfsLoadFullPathFile( tmp,bufferptr );
|
||||||
|
@ -633,8 +633,8 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
Sys_Printf( "vfsExtractRelativePath: %s\n", in );
|
Sys_Printf( "vfsExtractRelativePath: %s\n", in );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strcpy( l_in,in );
|
Q_strncpyz( l_in, in, sizeof( l_in ) );
|
||||||
vfsCleanFileName( l_in );
|
vfsCleanFileName( l_in, sizeof( l_in ) );
|
||||||
|
|
||||||
#ifdef DBG_RLTPATH
|
#ifdef DBG_RLTPATH
|
||||||
Sys_Printf( "cleaned path: %s\n", l_in );
|
Sys_Printf( "cleaned path: %s\n", l_in );
|
||||||
|
@ -642,15 +642,15 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
|
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( check,g_strDirs[i] );
|
Q_strncpyz( check, g_strDirs[i], sizeof( check ) );
|
||||||
vfsCleanFileName( check );
|
vfsCleanFileName( check, sizeof( check ) );
|
||||||
#ifdef DBG_RLTPATH
|
#ifdef DBG_RLTPATH
|
||||||
Sys_Printf( "Matching against %s\n", check );
|
Sys_Printf( "Matching against %s\n", check );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// try to find a match
|
// try to find a match
|
||||||
if ( strstr( l_in, check ) ) {
|
if ( strstr( l_in, check ) ) {
|
||||||
strcpy( out,l_in + strlen( check ) + 1 );
|
Q_strncpyz( out, l_in + strlen( check ) + 1, sizeof( out ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,7 @@ char* vfsExtractRelativePath( const char *in ){
|
||||||
}
|
}
|
||||||
|
|
||||||
// removed CString usage
|
// removed CString usage
|
||||||
void vfsCleanFileName( char *in ){
|
void vfsCleanFileName( char *in, size_t length ){
|
||||||
char str[PATH_MAX];
|
char str[PATH_MAX];
|
||||||
vfsBuildShortPathName( in, str, PATH_MAX );
|
vfsBuildShortPathName( in, str, PATH_MAX );
|
||||||
strlwr( str );
|
strlwr( str );
|
||||||
|
@ -676,7 +676,7 @@ void vfsCleanFileName( char *in ){
|
||||||
if ( str[n - 1] == '/' ) {
|
if ( str[n - 1] == '/' ) {
|
||||||
str[n - 1] = '\0';
|
str[n - 1] = '\0';
|
||||||
}
|
}
|
||||||
strcpy( in, str );
|
Q_strncpyz( in, str, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
// HYDRA: this now searches VFS/PAK files in addition to the filesystem
|
// HYDRA: this now searches VFS/PAK files in addition to the filesystem
|
||||||
|
@ -694,7 +694,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
char fixed[NAME_MAX];
|
char fixed[NAME_MAX];
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
|
|
||||||
strcpy( fixed, in );
|
Q_strncpyz( fixed, in, sizeof( fixed ) );
|
||||||
vfsFixDOSName( fixed );
|
vfsFixDOSName( fixed );
|
||||||
strlwr( fixed );
|
strlwr( fixed );
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
lastptr = ptr + 1;
|
lastptr = ptr + 1;
|
||||||
|
|
||||||
if ( strcmp( lastptr, fixed ) == 0 ) {
|
if ( strcmp( lastptr, fixed ) == 0 ) {
|
||||||
strncpy( out,file->name,PATH_MAX );
|
Q_strncpyz( out, file->name, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,11 +719,11 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
|
||||||
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
if ( !flag || ( flag & VFS_SEARCH_DIR ) ) {
|
||||||
for ( i = 0; i < g_numDirs; i++ )
|
for ( i = 0; i < g_numDirs; i++ )
|
||||||
{
|
{
|
||||||
strcpy( tmp, g_strDirs[i] );
|
Q_strncpyz( tmp, g_strDirs[i], sizeof( tmp ) );
|
||||||
strcat( tmp, in );
|
strncat( tmp, in, sizeof( tmp ) );
|
||||||
if ( access( tmp, R_OK ) == 0 ) {
|
if ( access( tmp, R_OK ) == 0 ) {
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
strcpy( out, tmp );
|
Q_strncpyz( out, tmp, sizeof( out ) );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -51,7 +51,7 @@ int vfsLoadFullPathFile( const char *filename, void **buffer );
|
||||||
// on win32, will build the short path name
|
// on win32, will build the short path name
|
||||||
// directories will be cleaned, no ending filename seperator
|
// directories will be cleaned, no ending filename seperator
|
||||||
// we modify the entry directly, the size of the string can only go down
|
// we modify the entry directly, the size of the string can only go down
|
||||||
void vfsCleanFileName( char * );
|
void vfsCleanFileName( char *, size_t );
|
||||||
// these return a static char*, doesn't need to be freed or anything
|
// these return a static char*, doesn't need to be freed or anything
|
||||||
// get the base path to use when raising file dialogs
|
// get the base path to use when raising file dialogs
|
||||||
// we manually add "maps/" or "sounds/" or "mapobjects/models/" etc.
|
// we manually add "maps/" or "sounds/" or "mapobjects/models/" etc.
|
||||||
|
|
|
@ -37,7 +37,7 @@ const char* Brush_Name( brush_t *b ){
|
||||||
static char cBuff[1024];
|
static char cBuff[1024];
|
||||||
b->numberId = g_nBrushId++;
|
b->numberId = g_nBrushId++;
|
||||||
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
sprintf( cBuff, "Brush %i", b->numberId );
|
snprintf( cBuff, sizeof( cBuff ), "Brush %i", b->numberId );
|
||||||
Brush_SetEpair( b, "Name", cBuff );
|
Brush_SetEpair( b, "Name", cBuff );
|
||||||
}
|
}
|
||||||
return cBuff;
|
return cBuff;
|
||||||
|
@ -1536,13 +1536,13 @@ const char* Brush_GetKeyValue( brush_t *b, const char *pKey ){
|
||||||
temporary stuff, detect potential problems when saving the texture name
|
temporary stuff, detect potential problems when saving the texture name
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CheckName( face_t *fa, char *pname ){
|
void CheckName( face_t *fa, char *pname, size_t length ){
|
||||||
if ( !strlen( fa->texdef.GetName() ) ) {
|
if ( !strlen( fa->texdef.GetName() ) ) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_FPrintf( SYS_WRN, "WARNING: unexpected texdef.name is empty in Brush.cpp CheckName\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: unexpected texdef.name is empty in Brush.cpp CheckName\n" );
|
||||||
#endif
|
#endif
|
||||||
fa->texdef.SetName( SHADER_NOT_FOUND );
|
fa->texdef.SetName( SHADER_NOT_FOUND );
|
||||||
strcpy( pname, SHADER_NOT_FOUND );
|
Q_strncpyz( pname, SHADER_NOT_FOUND, length );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,11 +1550,11 @@ void CheckName( face_t *fa, char *pname ){
|
||||||
if ( strchr( fa->texdef.GetName(), ' ' ) ) {
|
if ( strchr( fa->texdef.GetName(), ' ' ) ) {
|
||||||
char Msg1[1024];
|
char Msg1[1024];
|
||||||
|
|
||||||
sprintf( Msg1, "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", fa->texdef.GetName() );
|
snprintf( Msg1, sizeof( Msg1 ), "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", fa->texdef.GetName() );
|
||||||
|
|
||||||
Sys_Printf( "%s\n", Msg1 );
|
Sys_Printf( "%s\n", Msg1 );
|
||||||
gtk_MessageBox( g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK );
|
gtk_MessageBox( g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK );
|
||||||
strcpy( pname, SHADER_NOT_FOUND );
|
Q_strncpyz( pname, SHADER_NOT_FOUND, length );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1566,10 +1566,10 @@ void CheckName( face_t *fa, char *pname ){
|
||||||
gtk_MessageBox( g_pParentWnd->m_pWidget, text, "Error saving map", MB_OK );
|
gtk_MessageBox( g_pParentWnd->m_pWidget, text, "Error saving map", MB_OK );
|
||||||
// need to cleanup this dead face name or we may loop endlessly
|
// need to cleanup this dead face name or we may loop endlessly
|
||||||
fa->texdef.SetName( SHADER_NOT_FOUND );
|
fa->texdef.SetName( SHADER_NOT_FOUND );
|
||||||
strcpy( pname, SHADER_NOT_FOUND );
|
Q_strncpyz( pname, SHADER_NOT_FOUND, length );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy( pname, fa->texdef.GetName() + 9 ); // remove "textures/"
|
Q_strncpyz( pname, fa->texdef.GetName() + 9, length ); // remove "textures/"
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3401,7 +3401,7 @@ void Brush_Move( brush_t *b, const vec3_t move, bool bSnap ){
|
||||||
if ( b->owner->eclass->fixedsize ) {
|
if ( b->owner->eclass->fixedsize ) {
|
||||||
char text[64];
|
char text[64];
|
||||||
VectorAdd( b->owner->origin, move, b->owner->origin );
|
VectorAdd( b->owner->origin, move, b->owner->origin );
|
||||||
sprintf( text, "%i %i %i",
|
snprintf( text, sizeof( text ), "%i %i %i",
|
||||||
(int)b->owner->origin[0], (int)b->owner->origin[1], (int)b->owner->origin[2] );
|
(int)b->owner->origin[0], (int)b->owner->origin[1], (int)b->owner->origin[2] );
|
||||||
SetKeyValue( b->owner, "origin", text );
|
SetKeyValue( b->owner, "origin", text );
|
||||||
//VectorAdd(b->maxs, b->mins, b->owner->origin);
|
//VectorAdd(b->maxs, b->mins, b->owner->origin);
|
||||||
|
|
|
@ -119,7 +119,7 @@ void Dialog::AddModalButton( GtkWidget *widget, int ret ) {
|
||||||
void Dialog::UpdateData( bool retrieve ){
|
void Dialog::UpdateData( bool retrieve ){
|
||||||
DLG_DATA *data;
|
DLG_DATA *data;
|
||||||
GSList *lst;
|
GSList *lst;
|
||||||
char buf[32];
|
char buf[64];
|
||||||
|
|
||||||
if ( retrieve ) {
|
if ( retrieve ) {
|
||||||
for ( lst = m_pDataList; lst != NULL; lst = g_slist_next( lst ) )
|
for ( lst = m_pDataList; lst != NULL; lst = g_slist_next( lst ) )
|
||||||
|
@ -221,11 +221,11 @@ void Dialog::UpdateData( bool retrieve ){
|
||||||
gtk_entry_set_text( GTK_ENTRY( data->object ), txt );
|
gtk_entry_set_text( GTK_ENTRY( data->object ), txt );
|
||||||
} break;
|
} break;
|
||||||
case DLG_ENTRY_FLOAT:
|
case DLG_ENTRY_FLOAT:
|
||||||
sprintf( buf, "%g", ( *(float*)data->buffer ) );
|
snprintf( buf, sizeof( buf ), "%g", ( *(float*)data->buffer ) );
|
||||||
gtk_entry_set_text( GTK_ENTRY( data->object ), buf );
|
gtk_entry_set_text( GTK_ENTRY( data->object ), buf );
|
||||||
break;
|
break;
|
||||||
case DLG_ENTRY_INT:
|
case DLG_ENTRY_INT:
|
||||||
sprintf( buf, "%d", ( *(int*)data->buffer ) );
|
snprintf( buf, sizeof( buf ), "%d", ( *(int*)data->buffer ) );
|
||||||
gtk_entry_set_text( GTK_ENTRY( data->object ), buf );
|
gtk_entry_set_text( GTK_ENTRY( data->object ), buf );
|
||||||
break;
|
break;
|
||||||
case DLG_SPIN_FLOAT:
|
case DLG_SPIN_FLOAT:
|
||||||
|
|
|
@ -282,14 +282,14 @@ void UpdateTarget( vec3_t origin, vec3_t dir ){
|
||||||
i = IntForKey( pe, "target" );
|
i = IntForKey( pe, "target" );
|
||||||
if ( i <= 0 ) {
|
if ( i <= 0 ) {
|
||||||
i = GetUniqueTargetId( 1 );
|
i = GetUniqueTargetId( 1 );
|
||||||
sprintf( sz, "%d", i );
|
snprintf( sz, sizeof( sz ), "%d", i );
|
||||||
|
|
||||||
SetKeyValue( pe, "target", sz );
|
SetKeyValue( pe, "target", sz );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the target # into our src
|
// set the target # into our src
|
||||||
|
|
||||||
sprintf( sz, "%d", i );
|
snprintf( sz, sizeof( sz ), "%d", i );
|
||||||
SetKeyValue( peLink, "targetname", sz );
|
SetKeyValue( peLink, "targetname", sz );
|
||||||
|
|
||||||
Sys_UpdateWindows( W_ENTITY );
|
Sys_UpdateWindows( W_ENTITY );
|
||||||
|
|
|
@ -227,7 +227,7 @@ void Eclass_CreateSpriteModelPaths(){
|
||||||
{
|
{
|
||||||
|
|
||||||
// strip the path/ and the .extension.
|
// strip the path/ and the .extension.
|
||||||
ExtractFileBase( (char *)pFile->data,filename );
|
ExtractFileBase( (char *)pFile->data, filename, sizeof( filename ) );
|
||||||
|
|
||||||
// does the eclass name match the filename?
|
// does the eclass name match the filename?
|
||||||
if ( stricmp( e->name,filename ) == 0 ) {
|
if ( stricmp( e->name,filename ) == 0 ) {
|
||||||
|
@ -269,7 +269,7 @@ void EClass_InitForFileList( GSList *pFiles, _EClassTable *pTable ){
|
||||||
// this allows to override baseq3/scripts/entities.def for instance
|
// this allows to override baseq3/scripts/entities.def for instance
|
||||||
char relPath[PATH_MAX];
|
char relPath[PATH_MAX];
|
||||||
strcpy( relPath, "scripts/" );
|
strcpy( relPath, "scripts/" );
|
||||||
strcat( relPath, (char*)pFile->data );
|
strncat( relPath, (char*)pFile->data, sizeof( relPath ) );
|
||||||
if ( !vfsGetFullPath( relPath, 0, 0 ) ) {
|
if ( !vfsGetFullPath( relPath, 0, 0 ) ) {
|
||||||
Sys_FPrintf( SYS_ERR, "Failed to find the full path for '%s' in the VFS\n", relPath );
|
Sys_FPrintf( SYS_ERR, "Failed to find the full path for '%s' in the VFS\n", relPath );
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void EClass_InitForFileList( GSList *pFiles, _EClassTable *pTable ){
|
||||||
*/
|
*/
|
||||||
eclass_t * EClass_Create( const char *name, float col1, float col2, float col3, const vec3_t *mins, const vec3_t *maxs, const char *comments ){
|
eclass_t * EClass_Create( const char *name, float col1, float col2, float col3, const vec3_t *mins, const vec3_t *maxs, const char *comments ){
|
||||||
eclass_t *e;
|
eclass_t *e;
|
||||||
char color[128];
|
char color[256];
|
||||||
|
|
||||||
e = (eclass_t*)malloc( sizeof( *e ) );
|
e = (eclass_t*)malloc( sizeof( *e ) );
|
||||||
memset( e, 0, sizeof( *e ) );
|
memset( e, 0, sizeof( *e ) );
|
||||||
|
@ -297,7 +297,7 @@ eclass_t * EClass_Create( const char *name, float col1, float col2, float col3,
|
||||||
e->color[0] = col1;
|
e->color[0] = col1;
|
||||||
e->color[1] = col2;
|
e->color[1] = col2;
|
||||||
e->color[2] = col3;
|
e->color[2] = col3;
|
||||||
sprintf( color, "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
snprintf( color, sizeof( color ), "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
||||||
e->texdef.SetName( color );
|
e->texdef.SetName( color );
|
||||||
|
|
||||||
// supplied size ?
|
// supplied size ?
|
||||||
|
@ -313,13 +313,13 @@ eclass_t * EClass_Create( const char *name, float col1, float col2, float col3,
|
||||||
// b) no entity definition files were found
|
// b) no entity definition files were found
|
||||||
// c) no entity definition file contained an entry for worldspawn.
|
// c) no entity definition file contained an entry for worldspawn.
|
||||||
|
|
||||||
if ( stricmp( name,"worldspawn" ) != 0 ) {
|
if ( stricmp( name, "worldspawn" ) != 0 ) {
|
||||||
e->fixedsize = true;
|
e->fixedsize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the sizes..
|
// copy the sizes..
|
||||||
memcpy( e->mins,mins,sizeof( vec3_t ) );
|
memcpy( e->mins, mins, sizeof( vec3_t ) );
|
||||||
memcpy( e->maxs,maxs,sizeof( vec3_t ) );
|
memcpy( e->maxs, maxs, sizeof( vec3_t ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( comments ) {
|
if ( comments ) {
|
||||||
|
@ -404,7 +404,7 @@ void Eclass_Init(){
|
||||||
// this allows to override baseq3/scripts/entities.def for instance
|
// this allows to override baseq3/scripts/entities.def for instance
|
||||||
char relPath[PATH_MAX];
|
char relPath[PATH_MAX];
|
||||||
strcpy( relPath, "scripts/" );
|
strcpy( relPath, "scripts/" );
|
||||||
strcat( relPath, (char*)pFile->data );
|
strncat( relPath, (char*)pFile->data, sizeof( relPath ) );
|
||||||
char *fullpath = vfsGetFullPath( relPath, 0, 0 );
|
char *fullpath = vfsGetFullPath( relPath, 0, 0 );
|
||||||
if ( !fullpath ) {
|
if ( !fullpath ) {
|
||||||
Sys_FPrintf( SYS_ERR, "Failed to find the full path for \"%s\" in the VFS\n", relPath );
|
Sys_FPrintf( SYS_ERR, "Failed to find the full path for \"%s\" in the VFS\n", relPath );
|
||||||
|
|
|
@ -113,8 +113,7 @@ void setSpecialLoad( eclass_t *e, const char* pWhat, char*& p ){
|
||||||
if ( where ) {
|
if ( where ) {
|
||||||
int len = ( where - pText );
|
int len = ( where - pText );
|
||||||
p = new char[len + 1];
|
p = new char[len + 1];
|
||||||
strncpy( p,pText,len );
|
Q_strncpyz( p, pText, len + 1 );
|
||||||
p[len] = 0; // just to make sure, as most implementations of strncpy don't null terminate
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
p = strdup( pText );
|
p = strdup( pText );
|
||||||
|
@ -129,7 +128,7 @@ eclass_t *Eclass_InitFromText( char *text ){
|
||||||
int r, i;
|
int r, i;
|
||||||
char parms[256], *p;
|
char parms[256], *p;
|
||||||
eclass_t *e;
|
eclass_t *e;
|
||||||
char color[128];
|
char color[256];
|
||||||
|
|
||||||
e = (eclass_t*)malloc( sizeof( *e ) );
|
e = (eclass_t*)malloc( sizeof( *e ) );
|
||||||
memset( e, 0, sizeof( *e ) );
|
memset( e, 0, sizeof( *e ) );
|
||||||
|
@ -147,7 +146,7 @@ eclass_t *Eclass_InitFromText( char *text ){
|
||||||
if ( r != 3 ) {
|
if ( r != 3 ) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
sprintf( color, "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
snprintf( color, sizeof( color ), "(%f %f %f)", e->color[0], e->color[1], e->color[2] );
|
||||||
//strcpy (e->texdef.name, color);
|
//strcpy (e->texdef.name, color);
|
||||||
e->texdef.SetName( color );
|
e->texdef.SetName( color );
|
||||||
|
|
||||||
|
@ -204,7 +203,12 @@ eclass_t *Eclass_InitFromText( char *text ){
|
||||||
if ( !p ) {
|
if ( !p ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strcpy( e->flagnames[i], Get_COM_Token() );
|
Q_strncpyz( e->flagnames[i], Get_COM_Token(), sizeof( e->flagnames[i] ) );
|
||||||
|
|
||||||
|
if( strlen( Get_COM_Token() ) > sizeof( e->flagnames[i] ) - 1 )
|
||||||
|
{
|
||||||
|
Syn_Printf( "Warning: spawnflag/parm/flagname too long for Eclass %s: %s\n", e->name, e->flagnames[i] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the length until close comment
|
// find the length until close comment
|
||||||
|
@ -289,7 +293,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
eclass_found = false;
|
eclass_found = false;
|
||||||
for ( i = 0 ; i < size ; i++ )
|
for ( i = 0 ; i < size ; i++ )
|
||||||
{
|
{
|
||||||
if ( !strncmp( data + i, "/*QUAKED",8 ) ) {
|
if ( !strncmp( data + i, "/*QUAKED", 8 ) ) {
|
||||||
e = Eclass_InitFromText( data + i );
|
e = Eclass_InitFromText( data + i );
|
||||||
if ( e ) {
|
if ( e ) {
|
||||||
Eclass_InsertAlphabetized( e );
|
Eclass_InsertAlphabetized( e );
|
||||||
|
|
|
@ -45,16 +45,16 @@ void Error( const char *error, ... ){
|
||||||
char text[4096];
|
char text[4096];
|
||||||
|
|
||||||
va_start( argptr,error );
|
va_start( argptr,error );
|
||||||
vsprintf( text, error,argptr );
|
vsnprintf( text, sizeof( text ), error, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
strcat( text, "\n" );
|
strncat( text, "\n", sizeof( text ) );
|
||||||
|
|
||||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||||
if ( errno != 0 ) {
|
if ( errno != 0 ) {
|
||||||
strcat( text, "errno: " );
|
strncat( text, "errno: ", sizeof( text ) );
|
||||||
strcat( text, strerror( errno ) );
|
strncat( text, strerror( errno ), sizeof( text ) );
|
||||||
strcat( text, "\n" );
|
strncat( text, "\n", sizeof( text ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void Error( const char *error, ... ){
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
strcat( text, "GetLastError: " );
|
strncat( text, "GetLastError: ", sizeof( text ) );
|
||||||
/*
|
/*
|
||||||
Gtk will only crunch 0<=char<=127
|
Gtk will only crunch 0<=char<=127
|
||||||
this is a bit hackish, but I didn't find useful functions in win32 API for this
|
this is a bit hackish, but I didn't find useful functions in win32 API for this
|
||||||
|
@ -90,7 +90,7 @@ void Error( const char *error, ... ){
|
||||||
}
|
}
|
||||||
next = CharNext( scan );
|
next = CharNext( scan );
|
||||||
} while ( next != scan );
|
} while ( next != scan );
|
||||||
strcat( text, "\n" );
|
strncat( text, "\n", sizeof( text ) );
|
||||||
LocalFree( lpMsgBuf );
|
LocalFree( lpMsgBuf );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,14 +103,14 @@ void Error( const char *error, ... ){
|
||||||
GLenum iGLError = qglGetError();
|
GLenum iGLError = qglGetError();
|
||||||
if ( iGLError != GL_NO_ERROR ) {
|
if ( iGLError != GL_NO_ERROR ) {
|
||||||
// use our own gluErrorString
|
// use our own gluErrorString
|
||||||
strcat( text, "qgluErrorString: " );
|
strncat( text, "qgluErrorString: ", sizeof( text ) );
|
||||||
strcat( text, (char*)qgluErrorString( iGLError ) );
|
strncat( text, (char*)qgluErrorString( iGLError ), sizeof( text ) );
|
||||||
strcat( text, "\n" );
|
strncat( text, "\n", sizeof( text ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( text, "An unrecoverable error has occured.\n"
|
strncat( text, "An unrecoverable error has occured.\n"
|
||||||
"Would you like to edit Preferences before exiting Radiant?" );
|
"Would you like to edit Preferences before exiting Radiant?", sizeof( text ) );
|
||||||
|
|
||||||
Sys_Printf( text );
|
Sys_Printf( text );
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void WINAPI Error( char *error, ... ){
|
||||||
char text[1024];
|
char text[1024];
|
||||||
|
|
||||||
va_start( argptr,error );
|
va_start( argptr,error );
|
||||||
vsprintf( text, error,argptr );
|
vsnprintf( text, sizeof( text ), error, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Error( (const char *)text );
|
Error( (const char *)text );
|
||||||
|
|
|
@ -229,7 +229,7 @@ void MemStream::printf( const char* s, ... ){
|
||||||
|
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
va_start( args, s );
|
va_start( args, s );
|
||||||
vsprintf( buffer, s, args );
|
vsnprintf( buffer, sizeof( buffer ), s, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
Write( buffer, strlen( buffer ) );
|
Write( buffer, strlen( buffer ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ void GetSpawnFlags( void ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( sz, "%i", f );
|
snprintf( sz, sizeof( sz ), "%i", f );
|
||||||
if ( multiple_entities ) {
|
if ( multiple_entities ) {
|
||||||
brush_t *b;
|
brush_t *b;
|
||||||
|
|
||||||
|
@ -564,13 +564,13 @@ bool GetSelectAllCriteria( CString &strKey, CString &strVal ){
|
||||||
void AssignSound(){
|
void AssignSound(){
|
||||||
char buffer[NAME_MAX];
|
char buffer[NAME_MAX];
|
||||||
|
|
||||||
strcpy( buffer, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buffer, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, "sound/" );
|
strncat( buffer, "sound/", sizeof( buffer ) );
|
||||||
|
|
||||||
if ( access( buffer, R_OK ) != 0 ) {
|
if ( access( buffer, R_OK ) != 0 ) {
|
||||||
// just go to fsmain
|
// just go to fsmain
|
||||||
strcpy( buffer, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buffer, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, "/" );
|
strncat( buffer, "/", sizeof( buffer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *filename = file_dialog( g_pGroupDlg->m_pWidget, TRUE, _( "Open Wav File" ), buffer, "sound" );
|
const char *filename = file_dialog( g_pGroupDlg->m_pWidget, TRUE, _( "Open Wav File" ), buffer, "sound" );
|
||||||
|
@ -595,13 +595,13 @@ void AssignSound(){
|
||||||
void AssignModel(){
|
void AssignModel(){
|
||||||
char buffer[NAME_MAX];
|
char buffer[NAME_MAX];
|
||||||
|
|
||||||
strcpy( buffer, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buffer, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, "models/" );
|
strncat( buffer, "models/", sizeof( buffer ) );
|
||||||
|
|
||||||
if ( access( buffer, R_OK ) != 0 ) {
|
if ( access( buffer, R_OK ) != 0 ) {
|
||||||
// just go to fsmain
|
// just go to fsmain
|
||||||
strcpy( buffer, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buffer, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, "/" );
|
strncat( buffer, "/", sizeof( buffer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *filename = file_dialog( g_pGroupDlg->m_pWidget, TRUE, _( "Open Model" ), buffer, MODEL_MAJOR );
|
const char *filename = file_dialog( g_pGroupDlg->m_pWidget, TRUE, _( "Open Model" ), buffer, MODEL_MAJOR );
|
||||||
|
|
|
@ -1393,7 +1393,7 @@ void DoMapInfo(){
|
||||||
{
|
{
|
||||||
entry = (map_t*)entitymap->data;
|
entry = (map_t*)entitymap->data;
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
sprintf( tmp, "%d", entry->count );
|
snprintf( tmp, sizeof( tmp ), "%d", entry->count );
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gtk_list_store_append( GTK_LIST_STORE( store ), &iter );
|
gtk_list_store_append( GTK_LIST_STORE( store ), &iter );
|
||||||
gtk_list_store_set( GTK_LIST_STORE( store ), &iter, 0, entry->name, 1, tmp, -1 );
|
gtk_list_store_set( GTK_LIST_STORE( store ), &iter, 0, entry->name, 1, tmp, -1 );
|
||||||
|
@ -1404,11 +1404,11 @@ void DoMapInfo(){
|
||||||
g_object_unref( G_OBJECT( store ) );
|
g_object_unref( G_OBJECT( store ) );
|
||||||
|
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
sprintf( tmp, "%d", TotalBrushes );
|
snprintf( tmp, sizeof( tmp ), "%d", TotalBrushes );
|
||||||
gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
|
gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
|
||||||
sprintf( tmp, "%d", TotalEntities );
|
snprintf( tmp, sizeof( tmp ), "%d", TotalEntities );
|
||||||
gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
|
gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
|
||||||
sprintf( tmp, "%d", Net );
|
snprintf( tmp, sizeof( tmp ), "%d", Net );
|
||||||
gtk_entry_set_text( GTK_ENTRY( net_entry ), tmp );
|
gtk_entry_set_text( GTK_ENTRY( net_entry ), tmp );
|
||||||
|
|
||||||
gtk_grab_add( dlg );
|
gtk_grab_add( dlg );
|
||||||
|
@ -3264,8 +3264,8 @@ int DoBSInputDlg( const char *fields[5], float values[5] ){
|
||||||
gtk_widget_show( entries[i] );
|
gtk_widget_show( entries[i] );
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), entries[i], TRUE, TRUE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), entries[i], TRUE, TRUE, 0 );
|
||||||
|
|
||||||
char buf[32];
|
char buf[64];
|
||||||
sprintf( buf, "%f", values[i] );
|
snprintf( buf, sizeof( buf ), "%f", values[i] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( entries[i] ), buf );
|
gtk_entry_set_text( GTK_ENTRY( entries[i] ), buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1493,11 +1493,11 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
|
||||||
|
|
||||||
// we expect an actual path below, if the path is NULL we might crash
|
// we expect an actual path below, if the path is NULL we might crash
|
||||||
if ( !path || path[0] == '\0' ) {
|
if ( !path || path[0] == '\0' ) {
|
||||||
strcpy( buf, g_pGameDescription->mEnginePath.GetBuffer() );
|
Q_strncpyz( buf, g_pGameDescription->mEnginePath.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( buf, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "/" );
|
strncat( buf, "/", sizeof( buf ) );
|
||||||
if ( baseSubDir ) {
|
if ( baseSubDir ) {
|
||||||
strcat( buf, baseSubDir );
|
strncat( buf, baseSubDir, sizeof( buf ) );
|
||||||
}
|
}
|
||||||
path = buf;
|
path = buf;
|
||||||
}
|
}
|
||||||
|
@ -1547,7 +1547,9 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gtk_dialog_run( GTK_DIALOG( file_sel ) ) == GTK_RESPONSE_ACCEPT ) {
|
if ( gtk_dialog_run( GTK_DIALOG( file_sel ) ) == GTK_RESPONSE_ACCEPT ) {
|
||||||
strcpy( szFile, gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ) );
|
gchar * filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) );
|
||||||
|
Q_strncpyz( szFile, filename, sizeof( szFile ) );
|
||||||
|
g_free( filename );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
szFile[0] = '\0';
|
szFile[0] = '\0';
|
||||||
|
|
107
radiant/main.cpp
107
radiant/main.cpp
|
@ -182,11 +182,11 @@ int loki_getmountpoint( const char *device, char *mntpt, int max_size ){
|
||||||
{
|
{
|
||||||
char *tmp, mntdev[1024];
|
char *tmp, mntdev[1024];
|
||||||
|
|
||||||
strcpy( mntdev, mntent->mnt_fsname );
|
Q_strncpyz( mntdev, mntent->mnt_fsname, sizeof( mntdev ) );
|
||||||
if ( strcmp( mntent->mnt_type, "supermount" ) == 0 ) {
|
if ( strcmp( mntent->mnt_type, "supermount" ) == 0 ) {
|
||||||
tmp = strstr( mntent->mnt_opts, "dev=" );
|
tmp = strstr( mntent->mnt_opts, "dev=" );
|
||||||
if ( tmp ) {
|
if ( tmp ) {
|
||||||
strcpy( mntdev, tmp + strlen( "dev=" ) );
|
Q_strcnpyz( mntdev, tmp + strlen( "dev=" ), sizeof( mntdev ) );
|
||||||
tmp = strchr( mntdev, ',' );
|
tmp = strchr( mntdev, ',' );
|
||||||
if ( tmp ) {
|
if ( tmp ) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
@ -310,61 +310,61 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( domain ) {
|
if ( domain ) {
|
||||||
strcpy( buf, domain );
|
Q_strncpyz( buf, domain, sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy( buf, "**" );
|
Q_strncpyz( buf, "**", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
strcat( buf, "-" );
|
strncat( buf, "-", sizeof( buf ) );
|
||||||
|
|
||||||
switch ( log_level )
|
switch ( log_level )
|
||||||
{
|
{
|
||||||
case G_LOG_LEVEL_ERROR:
|
case G_LOG_LEVEL_ERROR:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "ERROR (recursed) **: " );
|
strncat( buf, "ERROR (recursed) **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "ERROR **: " );
|
strncat( buf, "ERROR **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_CRITICAL:
|
case G_LOG_LEVEL_CRITICAL:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "CRITICAL (recursed) **: " );
|
strncat( buf, "CRITICAL (recursed) **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "CRITICAL **: " );
|
strncat( buf, "CRITICAL **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_WARNING:
|
case G_LOG_LEVEL_WARNING:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "WARNING (recursed) **: " );
|
strncat( buf, "WARNING (recursed) **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "WARNING **: " );
|
strncat( buf, "WARNING **: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_MESSAGE:
|
case G_LOG_LEVEL_MESSAGE:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "Message (recursed): " );
|
strncat( buf, "Message (recursed): ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "Message: " );
|
strncat( buf, "Message: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_INFO:
|
case G_LOG_LEVEL_INFO:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "INFO (recursed): " );
|
strncat( buf, "INFO (recursed): ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "INFO: " );
|
strncat( buf, "INFO: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_DEBUG:
|
case G_LOG_LEVEL_DEBUG:
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "DEBUG (recursed): " );
|
strncat( buf, "DEBUG (recursed): ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "DEBUG: " );
|
strncat( buf, "DEBUG: ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -372,10 +372,10 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
|
||||||
* try to make the best out of it.
|
* try to make the best out of it.
|
||||||
*/
|
*/
|
||||||
if ( in_recursion ) {
|
if ( in_recursion ) {
|
||||||
strcat( buf, "LOG (recursed:" );
|
strncat( buf, "LOG (recursed:", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "LOG (" );
|
strncat( buf, "LOG (", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
if ( log_level ) {
|
if ( log_level ) {
|
||||||
gchar string[] = "0x00): ";
|
gchar string[] = "0x00): ";
|
||||||
|
@ -390,19 +390,19 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
|
||||||
*p += 'A' - '9' - 1;
|
*p += 'A' - '9' - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( buf, string );
|
strncat( buf, string, sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "): " );
|
strncat( buf, "): ", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( buf, message );
|
strncat( buf, message, sizeof( buf ) );
|
||||||
if ( is_fatal ) {
|
if ( is_fatal ) {
|
||||||
strcat( buf, "\naborting...\n" );
|
strncat( buf, "\naborting...\n", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcat( buf, "\n" );
|
strncat( buf, "\n", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
printf( "%s\n", buf );
|
printf( "%s\n", buf );
|
||||||
|
@ -777,7 +777,7 @@ int mainRadiant( int argc, char* argv[] ) {
|
||||||
// remove the game prefs files
|
// remove the game prefs files
|
||||||
remove( g_PrefsDlg.m_inipath->str );
|
remove( g_PrefsDlg.m_inipath->str );
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
sprintf( buf, "%sSavedInfo.bin", g_PrefsDlg.m_rc_path->str );
|
snprintf( buf, sizeof( buf ), "%sSavedInfo.bin", g_PrefsDlg.m_rc_path->str );
|
||||||
remove( buf );
|
remove( buf );
|
||||||
// remove the global pref too
|
// remove the global pref too
|
||||||
g_PrefsDlg.mGamesDialog.Reset();
|
g_PrefsDlg.mGamesDialog.Reset();
|
||||||
|
@ -1004,12 +1004,12 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
|
||||||
char rsh[BIG_PATH_MAX];
|
char rsh[BIG_PATH_MAX];
|
||||||
char base[BIG_PATH_MAX];
|
char base[BIG_PATH_MAX];
|
||||||
|
|
||||||
strcpy( src, mapname );
|
Q_strncpyz( src, mapname, sizeof( src ) );
|
||||||
strlwr( src );
|
strlwr( src );
|
||||||
in = strstr( src, "maps/" );
|
in = strstr( src, "maps/" );
|
||||||
if ( in ) {
|
if ( in ) {
|
||||||
in += 5;
|
in += 5;
|
||||||
strcpy( base, in );
|
Q_strncpyz( base, in, sizeof( base ) );
|
||||||
out = base;
|
out = base;
|
||||||
while ( *out )
|
while ( *out )
|
||||||
{
|
{
|
||||||
|
@ -1021,7 +1021,7 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExtractFileName( mapname, base );
|
ExtractFileName( mapname, base, sizeof( base ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// this important step alters the map name to add fs_game
|
// this important step alters the map name to add fs_game
|
||||||
|
@ -1036,11 +1036,11 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
|
||||||
if ( g_pGameDescription->mGameFile != "hl.game" &&
|
if ( g_pGameDescription->mGameFile != "hl.game" &&
|
||||||
*ValueForKey( g_qeglobals.d_project_entity,"gamename" ) != '\0' ) {
|
*ValueForKey( g_qeglobals.d_project_entity,"gamename" ) != '\0' ) {
|
||||||
// set with fs_game
|
// set with fs_game
|
||||||
sprintf( src, "-fs_game %s \"%s\"", ValueForKey( g_qeglobals.d_project_entity,"gamename" ), mapname );
|
snprintf( src, sizeof( src ), "-fs_game %s \"%s\"", ValueForKey( g_qeglobals.d_project_entity,"gamename" ), mapname );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( src, "\"%s\"", mapname );
|
snprintf( src, sizeof( src ), "\"%s\"", mapname );
|
||||||
}
|
}
|
||||||
|
|
||||||
rsh[0] = 0;
|
rsh[0] = 0;
|
||||||
|
@ -1049,14 +1049,14 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
|
||||||
|
|
||||||
// initialise the first step
|
// initialise the first step
|
||||||
out = new char[BIG_PATH_MAX];
|
out = new char[BIG_PATH_MAX];
|
||||||
|
*out = 0;
|
||||||
g_ptr_array_add( out_array, out );
|
g_ptr_array_add( out_array, out );
|
||||||
|
|
||||||
in = ValueForKey( g_qeglobals.d_project_entity, bspaction );
|
in = ValueForKey( g_qeglobals.d_project_entity, bspaction );
|
||||||
while ( *in )
|
while ( *in )
|
||||||
{
|
{
|
||||||
if ( in[0] == '!' ) {
|
if ( in[0] == '!' ) {
|
||||||
strcpy( out, rsh );
|
strncat( out, rsh, BIG_PATH_MAX );
|
||||||
out += strlen( rsh );
|
|
||||||
in++;
|
in++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1066,36 +1066,39 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
|
||||||
if ( g_PrefsDlg.m_bWatchBSP ) {
|
if ( g_PrefsDlg.m_bWatchBSP ) {
|
||||||
// -connect global option (the only global option so far anyway)
|
// -connect global option (the only global option so far anyway)
|
||||||
strcpy( tmp, " -connect 127.0.0.1:39000 " );
|
strcpy( tmp, " -connect 127.0.0.1:39000 " );
|
||||||
strcpy( out, tmp );
|
strncat( out, tmp, BIG_PATH_MAX );
|
||||||
out += strlen( tmp );
|
|
||||||
}
|
}
|
||||||
in++;
|
in++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( in[0] == '$' ) {
|
if ( in[0] == '$' ) {
|
||||||
// $ expansion
|
// $ expansion
|
||||||
strcpy( out, src );
|
strncat( out, src, BIG_PATH_MAX );
|
||||||
out += strlen( src );
|
|
||||||
in++;
|
in++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( in[0] == '@' ) {
|
if ( in[0] == '@' ) {
|
||||||
*out++ = '"';
|
strncat( out, "\"", BIG_PATH_MAX );
|
||||||
in++;
|
in++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( in[0] == '&' ) {
|
if ( in[0] == '&' ) {
|
||||||
if ( in[1] == '&' ) {
|
if ( in[1] == '&' ) {
|
||||||
// start a new step
|
// start a new step
|
||||||
*out = 0;
|
|
||||||
in = in + 2;
|
in = in + 2;
|
||||||
out = new char[BIG_PATH_MAX];
|
out = new char[BIG_PATH_MAX];
|
||||||
|
*out = 0;
|
||||||
g_ptr_array_add( out_array, out );
|
g_ptr_array_add( out_array, out );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*out++ = *in++;
|
size_t len = strlen( out );
|
||||||
|
if( ( len + 1 ) < BIG_PATH_MAX )
|
||||||
|
{
|
||||||
|
out[len++] = *in;
|
||||||
|
out[len] = '\0';
|
||||||
|
}
|
||||||
|
in++;
|
||||||
}
|
}
|
||||||
*out = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReplace( CString& strContents, const char* pTag, const char* pValue ){
|
void FindReplace( CString& strContents, const char* pTag, const char* pValue ){
|
||||||
|
@ -1114,15 +1117,15 @@ void FindReplace( CString& strContents, const char* pTag, const char* pValue ){
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the map, deals with regioning
|
// save the map, deals with regioning
|
||||||
void SaveWithRegion( char *name ){
|
void SaveWithRegion( char *name, size_t length ){
|
||||||
strcpy( name, currentmap );
|
Q_strncpyz( name, currentmap, length );
|
||||||
if ( region_active ) {
|
if ( region_active ) {
|
||||||
// temporary cut the region to save regular map
|
// temporary cut the region to save regular map
|
||||||
region_active = false;
|
region_active = false;
|
||||||
Map_SaveFile( name, false );
|
Map_SaveFile( name, false );
|
||||||
region_active = true;
|
region_active = true;
|
||||||
StripExtension( name );
|
StripExtension( name );
|
||||||
strcat( name, ".reg" );
|
strncat( name, ".reg", length );
|
||||||
}
|
}
|
||||||
|
|
||||||
Map_SaveFile( name, region_active );
|
Map_SaveFile( name, region_active );
|
||||||
|
@ -1193,9 +1196,9 @@ void RunBsp( char *command ){
|
||||||
|
|
||||||
SetInspectorMode( W_CONSOLE );
|
SetInspectorMode( W_CONSOLE );
|
||||||
|
|
||||||
strcpy( temppath, g_strTempPath.GetBuffer() );
|
Q_strncpyz( temppath, g_strTempPath.GetBuffer(), sizeof( temppath ) );
|
||||||
|
|
||||||
SaveWithRegion( name );
|
SaveWithRegion( name, sizeof( name ) );
|
||||||
|
|
||||||
const char *rsh = ValueForKey( g_qeglobals.d_project_entity, "rshcmd" );
|
const char *rsh = ValueForKey( g_qeglobals.d_project_entity, "rshcmd" );
|
||||||
if ( rsh == NULL ) {
|
if ( rsh == NULL ) {
|
||||||
|
@ -1203,10 +1206,10 @@ void RunBsp( char *command ){
|
||||||
|
|
||||||
ExtractPath_and_Filename( name, strPath, strFile );
|
ExtractPath_and_Filename( name, strPath, strFile );
|
||||||
AddSlash( strPath );
|
AddSlash( strPath );
|
||||||
strncpy( cWork, strPath, 1024 );
|
Q_strncpyz( cWork, strPath, 1024 );
|
||||||
strcat( cWork, strFile );
|
strncat( cWork, strFile, sizeof( cWork ) );
|
||||||
} else {
|
} else {
|
||||||
strcpy( cWork, name );
|
Q_strncpyz( cWork, name, sizeof( cWork ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the array ready
|
// get the array ready
|
||||||
|
@ -1217,7 +1220,7 @@ void RunBsp( char *command ){
|
||||||
if ( g_PrefsDlg.m_bWatchBSP ) {
|
if ( g_PrefsDlg.m_bWatchBSP ) {
|
||||||
// grab the file name for engine running
|
// grab the file name for engine running
|
||||||
char *bspname = new char[1024];
|
char *bspname = new char[1024];
|
||||||
ExtractFileName( currentmap, bspname );
|
ExtractFileName( currentmap, bspname, 1024 );
|
||||||
StripExtension( bspname );
|
StripExtension( bspname );
|
||||||
g_pParentWnd->GetWatchBSP()->DoMonitoringLoop( sys, bspname );
|
g_pParentWnd->GetWatchBSP()->DoMonitoringLoop( sys, bspname );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1243,7 +1246,7 @@ void RunBsp( char *command ){
|
||||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||||
|
|
||||||
// write qe3bsp.sh
|
// write qe3bsp.sh
|
||||||
sprintf( batpath, "%sqe3bsp.sh", temppath );
|
snprintf( batpath, sizeof( batpath ), "%sqe3bsp.sh", temppath );
|
||||||
Sys_Printf( "Writing the compile script to '%s'\n", batpath );
|
Sys_Printf( "Writing the compile script to '%s'\n", batpath );
|
||||||
hFile = fopen( batpath, "w" );
|
hFile = fopen( batpath, "w" );
|
||||||
if ( !hFile ) {
|
if ( !hFile ) {
|
||||||
|
@ -1255,8 +1258,8 @@ void RunBsp( char *command ){
|
||||||
chmod( batpath, 0744 );
|
chmod( batpath, 0744 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined( _WIN32 ) || defined( __CYGWIN__ )
|
||||||
sprintf( batpath, "%sqe3bsp.bat", temppath );
|
snprintf( batpath, sizeof( batpath ), "%sqe3bsp.bat", temppath );
|
||||||
Sys_Printf( "Writing the compile script to '%s'\n", batpath );
|
Sys_Printf( "Writing the compile script to '%s'\n", batpath );
|
||||||
Sys_Printf( "The build output will be saved in '%sjunk.txt'\n", temppath );
|
Sys_Printf( "The build output will be saved in '%sjunk.txt'\n", temppath );
|
||||||
hFile = fopen( batpath, "w" );
|
hFile = fopen( batpath, "w" );
|
||||||
|
|
|
@ -2174,7 +2174,7 @@ void clipboard_paste(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#elif defined( WIN32 )
|
#elif defined( _WIN32 )
|
||||||
|
|
||||||
void clipboard_copy(){
|
void clipboard_copy(){
|
||||||
Clipboard_CopyMap();
|
Clipboard_CopyMap();
|
||||||
|
@ -3435,7 +3435,7 @@ void MainFrame::LoadCommandMap(){
|
||||||
|
|
||||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||||
strINI = g_PrefsDlg.m_rc_path->str;
|
strINI = g_PrefsDlg.m_rc_path->str;
|
||||||
#elif defined( WIN32 )
|
#elif defined( _WIN32 ) || defined( __CYGWIN__ )
|
||||||
strINI = g_strGameToolsPath;
|
strINI = g_strGameToolsPath;
|
||||||
#else
|
#else
|
||||||
#error "WTF are you compiling this on"
|
#error "WTF are you compiling this on"
|
||||||
|
@ -3450,7 +3450,7 @@ void MainFrame::LoadCommandMap(){
|
||||||
for ( int i = 0; i < g_nCommandCount; i++ )
|
for ( int i = 0; i < g_nCommandCount; i++ )
|
||||||
{
|
{
|
||||||
char value[1024];
|
char value[1024];
|
||||||
if ( read_var( strINI.GetBuffer(), "Commands", g_Commands[i].m_strCommand, value ) ) {
|
if ( read_var( strINI.GetBuffer(), "Commands", g_Commands[i].m_strCommand, value, sizeof( value ) ) ) {
|
||||||
if ( !bUserCmdList ) {
|
if ( !bUserCmdList ) {
|
||||||
Sys_Printf( "Found user's shortcuts list at %s\n", strINI.GetBuffer() );
|
Sys_Printf( "Found user's shortcuts list at %s\n", strINI.GetBuffer() );
|
||||||
bUserCmdList = true;
|
bUserCmdList = true;
|
||||||
|
@ -3683,10 +3683,10 @@ void MainFrame::CreateQEChildren(){
|
||||||
|
|
||||||
|
|
||||||
// check to see if the project template is versioned
|
// check to see if the project template is versioned
|
||||||
strcpy( buf, g_pGameDescription->mEnginePath.GetBuffer() );
|
Q_strncpyz( buf, g_pGameDescription->mEnginePath.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( buf, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "/scripts/" );
|
strncat( buf, "/scripts/", sizeof( buf ) );
|
||||||
strcat( buf, PROJECT_TEMPLATE_NAME );
|
strncat( buf, PROJECT_TEMPLATE_NAME, sizeof( buf ) );
|
||||||
templateVersion = QE_GetTemplateVersionForProject( buf );
|
templateVersion = QE_GetTemplateVersionForProject( buf );
|
||||||
|
|
||||||
r = g_PrefsDlg.m_strLastProject.GetBuffer();
|
r = g_PrefsDlg.m_strLastProject.GetBuffer();
|
||||||
|
@ -3697,10 +3697,10 @@ void MainFrame::CreateQEChildren(){
|
||||||
// try default project location
|
// try default project location
|
||||||
bTriedTemplate = true;
|
bTriedTemplate = true;
|
||||||
// for all OSes, we look for the template in the base installation (no homepath here)
|
// for all OSes, we look for the template in the base installation (no homepath here)
|
||||||
strcpy( buf, g_pGameDescription->mEnginePath.GetBuffer() );
|
Q_strncpyz( buf, g_pGameDescription->mEnginePath.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( buf, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "/scripts/" );
|
strncat( buf, "/scripts/", sizeof( buf ) );
|
||||||
strcat( buf, PROJECT_TEMPLATE_NAME );
|
strncat( buf, PROJECT_TEMPLATE_NAME, sizeof( buf ) );
|
||||||
r = buf;
|
r = buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3888,7 +3888,7 @@ void MainFrame::UpdateWindows( int nBits ){
|
||||||
#ifdef DBG_WINDOWPOS
|
#ifdef DBG_WINDOWPOS
|
||||||
static int bean_count = 0;
|
static int bean_count = 0;
|
||||||
char bean_buf[100];
|
char bean_buf[100];
|
||||||
sprintf( bean_buf,"UpdateWindows %d",bean_count );
|
snprintf( bean_buf, sizeof( bean_buf ), "UpdateWindows %d", bean_count );
|
||||||
CheckWatchit( bean_buf );
|
CheckWatchit( bean_buf );
|
||||||
bean_count++;
|
bean_count++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3923,7 +3923,7 @@ void MainFrame::UpdateWindows( int nBits ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DBG_WINDOWPOS
|
#ifdef DBG_WINDOWPOS
|
||||||
sprintf( bean_buf,"%d (end UpdateWidows)",bean_count );
|
snprintf( bean_buf, sizeof( bean_buf ), "%d (end UpdateWidows)", bean_count );
|
||||||
CheckWatchit( bean_buf );
|
CheckWatchit( bean_buf );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3932,7 +3932,7 @@ void MainFrame::RoutineProcessing(){
|
||||||
#ifdef DBG_WINDOWPOS
|
#ifdef DBG_WINDOWPOS
|
||||||
static int bean_count = 0;
|
static int bean_count = 0;
|
||||||
char bean_buf[100];
|
char bean_buf[100];
|
||||||
sprintf( bean_buf,"RoutineProcessing %d",bean_count );
|
snprintf( bean_buf, sizeof( bean_buf ), "RoutineProcessing %d", bean_count );
|
||||||
CheckWatchit( bean_buf );
|
CheckWatchit( bean_buf );
|
||||||
bean_count++;
|
bean_count++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -4009,7 +4009,7 @@ void MainFrame::RoutineProcessing(){
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
#ifdef DBG_WINDOWPOS
|
#ifdef DBG_WINDOWPOS
|
||||||
sprintf( bean_buf,"%d (end RoutineProcessing)",bean_count );
|
snprintf( bean_buf, sizeof( bean_buf ), "%d (end RoutineProcessing)", bean_count );
|
||||||
CheckWatchit( bean_buf );
|
CheckWatchit( bean_buf );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -4258,8 +4258,8 @@ void MainFrame::OnFileOpen(){
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
if ( !g_pGameDescription->noMapsInHome ) {
|
if ( !g_pGameDescription->noMapsInHome ) {
|
||||||
strcpy( buf, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "maps/" );
|
strncat( buf, "maps/", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -4268,7 +4268,7 @@ void MainFrame::OnFileOpen(){
|
||||||
str = file_dialog( m_pWidget, TRUE, _( "Open Map" ), buf, MAP_MAJOR, "maps/" );
|
str = file_dialog( m_pWidget, TRUE, _( "Open Map" ), buf, MAP_MAJOR, "maps/" );
|
||||||
|
|
||||||
if ( str != NULL ) {
|
if ( str != NULL ) {
|
||||||
strcpy( currentmap,str );
|
Q_strncpyz( currentmap, str, sizeof( currentmap ) );
|
||||||
MRU_AddFile( str );
|
MRU_AddFile( str );
|
||||||
Map_LoadFile( str );
|
Map_LoadFile( str );
|
||||||
}
|
}
|
||||||
|
@ -4279,8 +4279,8 @@ void MainFrame::OnFileImportmap(){
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
if ( !g_pGameDescription->noMapsInHome ) {
|
if ( !g_pGameDescription->noMapsInHome ) {
|
||||||
strcpy( buf, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "maps/" );
|
strncat( buf, "maps/", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -4307,8 +4307,8 @@ void MainFrame::OnFileSaveas(){
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
if ( !g_pGameDescription->noMapsInHome ) {
|
if ( !g_pGameDescription->noMapsInHome ) {
|
||||||
strcpy( buf, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "maps/" );
|
strncat( buf, "maps/", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -4317,7 +4317,7 @@ void MainFrame::OnFileSaveas(){
|
||||||
str = file_dialog( g_pParentWnd->m_pWidget, FALSE, _( "Save Map" ), buf, MAP_MAJOR, "maps/" );
|
str = file_dialog( g_pParentWnd->m_pWidget, FALSE, _( "Save Map" ), buf, MAP_MAJOR, "maps/" );
|
||||||
|
|
||||||
if ( str != NULL ) {
|
if ( str != NULL ) {
|
||||||
strcpy( currentmap, str );
|
Q_strncpyz( currentmap, str, sizeof( currentmap ) );
|
||||||
MRU_AddFile( str );
|
MRU_AddFile( str );
|
||||||
Map_SaveFile( str, false ); // ignore region
|
Map_SaveFile( str, false ); // ignore region
|
||||||
}
|
}
|
||||||
|
@ -4328,8 +4328,8 @@ void MainFrame::OnFileExportmap(){
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
if ( !g_pGameDescription->noMapsInHome ) {
|
if ( !g_pGameDescription->noMapsInHome ) {
|
||||||
strcpy( buf, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "maps/" );
|
strncat( buf, "maps/", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -4347,8 +4347,8 @@ void MainFrame::OnFileSaveregion(){
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
if ( !g_pGameDescription->noMapsInHome ) {
|
if ( !g_pGameDescription->noMapsInHome ) {
|
||||||
strcpy( buf, g_qeglobals.m_strHomeMaps.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeMaps.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, "maps/" );
|
strncat( buf, "maps/", sizeof( buf ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -5716,9 +5716,9 @@ void MainFrame::OnTexturesLoad(){
|
||||||
// FIXME
|
// FIXME
|
||||||
// check if that works with fs_game (I suspect some more design is needed)
|
// check if that works with fs_game (I suspect some more design is needed)
|
||||||
// see how this is done in 1.2?
|
// see how this is done in 1.2?
|
||||||
strcpy( def_path, g_pGameDescription->mEnginePath.GetBuffer() );
|
Q_strncpyz( def_path, g_pGameDescription->mEnginePath.GetBuffer(), sizeof( def_path ) );
|
||||||
strcat( def_path, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( def_path, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( def_path ) );
|
||||||
strcat( def_path, "/" );
|
strncat( def_path, "/", sizeof( def_path ) );
|
||||||
|
|
||||||
char *dir = dir_dialog( m_pWidget, _( "Load textures from path" ), def_path );
|
char *dir = dir_dialog( m_pWidget, _( "Load textures from path" ), def_path );
|
||||||
|
|
||||||
|
@ -5731,7 +5731,7 @@ void MainFrame::OnTexturesLoad(){
|
||||||
}
|
}
|
||||||
char *pouic = MAX( strrchr( dir, '/' ),strrchr( dir, '\\' ) );
|
char *pouic = MAX( strrchr( dir, '/' ),strrchr( dir, '\\' ) );
|
||||||
if ( pouic ) {
|
if ( pouic ) {
|
||||||
strcpy( texture_directory, pouic + 1 );
|
Q_strncpyz( texture_directory, pouic + 1, 128 );
|
||||||
Sys_Printf( "Loading '%s'\n", texture_directory );
|
Sys_Printf( "Loading '%s'\n", texture_directory );
|
||||||
Texture_ShowDirectory();
|
Texture_ShowDirectory();
|
||||||
}
|
}
|
||||||
|
@ -6156,8 +6156,8 @@ void MainFrame::OnMiscSelectentitycolor(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inspector_mode == W_ENTITY && ( DoColor( COLOR_ENTITY ) ) ) {
|
if ( inspector_mode == W_ENTITY && ( DoColor( COLOR_ENTITY ) ) ) {
|
||||||
char buffer[100];
|
char buffer[256];
|
||||||
sprintf( buffer, "%f %f %f", g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0],
|
snprintf( buffer, sizeof( buffer ), "%f %f %f", g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0],
|
||||||
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1],
|
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1],
|
||||||
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2] );
|
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2] );
|
||||||
|
|
||||||
|
|
|
@ -549,7 +549,7 @@ void Map_LoadFile( const char *filename ){
|
||||||
// used when conversion between standard map format and BP format is required and the user cancels the process
|
// used when conversion between standard map format and BP format is required and the user cancels the process
|
||||||
g_bCancel_Map_LoadFile = false;
|
g_bCancel_Map_LoadFile = false;
|
||||||
|
|
||||||
strcpy( currentmap, filename );
|
Q_strncpyz( currentmap, filename, sizeof( currentmap ) );
|
||||||
|
|
||||||
g_bScreenUpdates = false; // leo: avoid redraws while loading the map (see fenris:1952)
|
g_bScreenUpdates = false; // leo: avoid redraws while loading the map (see fenris:1952)
|
||||||
|
|
||||||
|
@ -778,9 +778,9 @@ void Map_SaveFile( const char *filename, qboolean use_region ){
|
||||||
char backup[1024];
|
char backup[1024];
|
||||||
|
|
||||||
// rename current to .bak
|
// rename current to .bak
|
||||||
strcpy( backup, filename );
|
Q_strncpyz( backup, filename, sizeof( backup ) );
|
||||||
StripExtension( backup );
|
StripExtension( backup );
|
||||||
strcat( backup, ".bak" );
|
strncat( backup, ".bak", sizeof( backup ) );
|
||||||
unlink( backup );
|
unlink( backup );
|
||||||
rename( filename, backup );
|
rename( filename, backup );
|
||||||
}
|
}
|
||||||
|
@ -830,7 +830,7 @@ void Map_New( void ){
|
||||||
Sys_Printf( "Map_New\n" );
|
Sys_Printf( "Map_New\n" );
|
||||||
Map_Free();
|
Map_Free();
|
||||||
|
|
||||||
strcpy( currentmap, "unnamed.map" );
|
Q_strncpyz( currentmap, "unnamed.map", sizeof( currentmap ) );
|
||||||
Sys_SetTitle( currentmap );
|
Sys_SetTitle( currentmap );
|
||||||
|
|
||||||
world_entity = (entity_s*)qmalloc( sizeof( *world_entity ) );
|
world_entity = (entity_s*)qmalloc( sizeof( *world_entity ) );
|
||||||
|
@ -932,9 +932,9 @@ void AddRegionBrushes( void ){
|
||||||
SetKeyValue( region_startpoint, "classname", "info_player_start" );
|
SetKeyValue( region_startpoint, "classname", "info_player_start" );
|
||||||
region_startpoint->eclass = Eclass_ForName( "info_player_start", false );
|
region_startpoint->eclass = Eclass_ForName( "info_player_start", false );
|
||||||
char sTmp[1024];
|
char sTmp[1024];
|
||||||
sprintf( sTmp, "%d %d %d", (int)vOrig[0], (int)vOrig[1], (int)vOrig[2] );
|
snprintf( sTmp, sizeof( sTmp ), "%d %d %d", (int)vOrig[0], (int)vOrig[1], (int)vOrig[2] );
|
||||||
SetKeyValue( region_startpoint, "origin", sTmp );
|
SetKeyValue( region_startpoint, "origin", sTmp );
|
||||||
sprintf( sTmp, "%d", (int)g_pParentWnd->GetCamWnd()->Camera()->angles[YAW] );
|
snprintf( sTmp, sizeof( sTmp ), "%d", (int)g_pParentWnd->GetCamWnd()->Camera()->angles[YAW] );
|
||||||
SetKeyValue( region_startpoint, "angle", sTmp );
|
SetKeyValue( region_startpoint, "angle", sTmp );
|
||||||
// empty array of children
|
// empty array of children
|
||||||
region_startpoint->pData = new CPtrArray;
|
region_startpoint->pData = new CPtrArray;
|
||||||
|
@ -1272,7 +1272,7 @@ void MemFile_fprintf( MemStream* pMemFile, const char* pText, ... ){
|
||||||
char Buffer[4096];
|
char Buffer[4096];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start( args,pText );
|
va_start( args,pText );
|
||||||
vsprintf( Buffer, pText, args );
|
vsnprintf( Buffer, sizeof( Buffer ), pText, args );
|
||||||
pMemFile->Write( Buffer, strlen( Buffer ) );
|
pMemFile->Write( Buffer, strlen( Buffer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool radCreateDirectory( const char *directory, bool fatal_on_error ) {
|
||||||
|
|
||||||
int GetFullPathName( const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart ){
|
int GetFullPathName( const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart ){
|
||||||
if ( lpFileName[0] == '/' ) {
|
if ( lpFileName[0] == '/' ) {
|
||||||
strcpy( lpBuffer, lpFileName );
|
Q_strncpyz( lpBuffer, lpFileName, nBufferLength );
|
||||||
*lpFilePart = strrchr( lpBuffer, '/' );
|
*lpFilePart = strrchr( lpBuffer, '/' );
|
||||||
return strlen( lpBuffer );
|
return strlen( lpBuffer );
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,9 @@ int GetFullPathName( const char *lpFileName, int nBufferLength, char *lpBuffer,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat( lpBuffer, "/" );
|
strncat( lpBuffer, "/", nBufferLength );
|
||||||
*lpFilePart = lpBuffer + strlen( lpBuffer );
|
*lpFilePart = lpBuffer + strlen( lpBuffer );
|
||||||
strcat( lpBuffer, lpFileName );
|
strncat( lpBuffer, lpFileName, nBufferLength );
|
||||||
|
|
||||||
char *scr = lpBuffer, *dst = lpBuffer;
|
char *scr = lpBuffer, *dst = lpBuffer;
|
||||||
for ( int i = 0; ( i < nBufferLength ) && ( *scr != 0 ); i++ )
|
for ( int i = 0; ( i < nBufferLength ) && ( *scr != 0 ); i++ )
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#endif
|
#endif
|
||||||
//#include "qe3.h"
|
//#include "qe3.h"
|
||||||
|
|
||||||
int QERApp_EClassScanDir( char *path, void* hPlug ){
|
int QERApp_EClassScanDir( const char *path, void* hPlug ){
|
||||||
char temp[NAME_MAX];
|
char temp[NAME_MAX];
|
||||||
char filebase[NAME_MAX];
|
char filebase[NAME_MAX];
|
||||||
char filename[NAME_MAX];
|
char filename[NAME_MAX];
|
||||||
|
@ -43,7 +43,7 @@ int QERApp_EClassScanDir( char *path, void* hPlug ){
|
||||||
struct dirent *dirlist;
|
struct dirent *dirlist;
|
||||||
|
|
||||||
QE_ConvertDOSToUnixName( temp, path );
|
QE_ConvertDOSToUnixName( temp, path );
|
||||||
strcpy( filebase, path );
|
Q_strncpyz( filebase, path, sizeof( filebase ) );
|
||||||
s = filebase + strlen( filebase ) - 1;
|
s = filebase + strlen( filebase ) - 1;
|
||||||
while ( *s != '\\' && *s != '/' && s != filebase )
|
while ( *s != '\\' && *s != '/' && s != filebase )
|
||||||
s--;
|
s--;
|
||||||
|
@ -53,7 +53,7 @@ int QERApp_EClassScanDir( char *path, void* hPlug ){
|
||||||
if ( dir != NULL ) {
|
if ( dir != NULL ) {
|
||||||
while ( ( dirlist = readdir( dir ) ) != NULL )
|
while ( ( dirlist = readdir( dir ) ) != NULL )
|
||||||
{
|
{
|
||||||
sprintf( filename, "%s/%s", filebase, dirlist->d_name );
|
snprintf( filename, sizeof( filename ), "%s/%s", filebase, dirlist->d_name );
|
||||||
Eclass_ScanFile( filename );
|
Eclass_ScanFile( filename );
|
||||||
|
|
||||||
if ( eclass_found ) {
|
if ( eclass_found ) {
|
||||||
|
|
|
@ -495,7 +495,11 @@ CPluginSlot::~CPluginSlot(){
|
||||||
void CPluginSlot::Init(){
|
void CPluginSlot::Init(){
|
||||||
CString str = mpTable->m_pfnQERPlug_GetCommandList();
|
CString str = mpTable->m_pfnQERPlug_GetCommandList();
|
||||||
char cTemp[1024];
|
char cTemp[1024];
|
||||||
strcpy( cTemp, str );
|
Q_strncpyz( cTemp, str, sizeof( cTemp ) );
|
||||||
|
if( str.GetLength() > sizeof( cTemp ) - 1 )
|
||||||
|
{
|
||||||
|
Sys_FPrintf( SYS_WRN, "WARNING: Temporary buffer is too small in CPluginSlot::Init\n" );
|
||||||
|
}
|
||||||
char* token = strtok( cTemp, ",;" );
|
char* token = strtok( cTemp, ",;" );
|
||||||
if ( token && *token == ' ' ) {
|
if ( token && *token == ' ' ) {
|
||||||
while ( *token == ' ' )
|
while ( *token == ' ' )
|
||||||
|
@ -1090,7 +1094,7 @@ _QERFaceData* WINAPI QERApp_GetFaceData( void* pv, int nFaceIndex ){
|
||||||
face.m_fShift[0] = f->texdef.shift[0];
|
face.m_fShift[0] = f->texdef.shift[0];
|
||||||
face.m_fShift[1] = f->texdef.shift[1];
|
face.m_fShift[1] = f->texdef.shift[1];
|
||||||
}
|
}
|
||||||
strcpy( face.m_TextureName, f->texdef.GetName() );
|
Q_strncpyz( face.m_TextureName, f->texdef.GetName(), sizeof( face.m_TextureName ) );
|
||||||
VectorCopy( f->planepts[0], face.m_v1 );
|
VectorCopy( f->planepts[0], face.m_v1 );
|
||||||
VectorCopy( f->planepts[1], face.m_v2 );
|
VectorCopy( f->planepts[1], face.m_v2 );
|
||||||
VectorCopy( f->planepts[2], face.m_v3 );
|
VectorCopy( f->planepts[2], face.m_v3 );
|
||||||
|
@ -1298,7 +1302,7 @@ char* WINAPI QERApp_GetTexture( int nIndex ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( n == nIndex ) {
|
if ( n == nIndex ) {
|
||||||
strcpy( name, pShader->getName() );
|
Q_strncpyz( name, pShader->getName(), sizeof( name ) );
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
|
@ -1308,7 +1312,7 @@ char* WINAPI QERApp_GetTexture( int nIndex ){
|
||||||
|
|
||||||
char* WINAPI QERApp_GetCurrentTexture(){
|
char* WINAPI QERApp_GetCurrentTexture(){
|
||||||
static char current_tex[1024];
|
static char current_tex[1024];
|
||||||
strcpy( current_tex,g_qeglobals.d_texturewin.texdef.GetName() );
|
Q_strncpyz( current_tex, g_qeglobals.d_texturewin.texdef.GetName(), sizeof( current_tex ) );
|
||||||
return current_tex;
|
return current_tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,7 +1522,7 @@ int QERApp_ScriptLine(){
|
||||||
// we save the map and return the name .. either .map or .reg to support region compiling
|
// we save the map and return the name .. either .map or .reg to support region compiling
|
||||||
char* QERApp_GetMapName(){
|
char* QERApp_GetMapName(){
|
||||||
static char name[PATH_MAX];
|
static char name[PATH_MAX];
|
||||||
SaveWithRegion( name );
|
SaveWithRegion( name, sizeof( name ) );
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4755,7 +4755,7 @@ void Patch_AdjustSelected( bool bInsert, bool bColumn, bool bFlag ){
|
||||||
strategies that call here too much are known to be slow
|
strategies that call here too much are known to be slow
|
||||||
patch 84 to bug 253 adds an additionnal check for textures/
|
patch 84 to bug 253 adds an additionnal check for textures/
|
||||||
*/
|
*/
|
||||||
void CheckName( patchMesh_t *p, char *pname ){
|
void CheckName( patchMesh_t *p, char *pname, size_t length ){
|
||||||
if ( strncmp( p->pShader->getName(), "textures/", 9 ) != 0 ) {
|
if ( strncmp( p->pShader->getName(), "textures/", 9 ) != 0 ) {
|
||||||
p->pShader = QERApp_Shader_ForName( SHADER_NOT_FOUND );
|
p->pShader = QERApp_Shader_ForName( SHADER_NOT_FOUND );
|
||||||
}
|
}
|
||||||
|
@ -4763,15 +4763,15 @@ void CheckName( patchMesh_t *p, char *pname ){
|
||||||
// some manage to get long filename textures (with spaces) in their maps
|
// some manage to get long filename textures (with spaces) in their maps
|
||||||
if ( strchr( p->pShader->getName(), ' ' ) ) {
|
if ( strchr( p->pShader->getName(), ' ' ) ) {
|
||||||
char Msg1[1024];
|
char Msg1[1024];
|
||||||
sprintf( Msg1, "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", p->pShader->getName() );
|
snprintf( Msg1, sizeof( Msg1 ), "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", p->pShader->getName() );
|
||||||
Sys_Printf( "%s\n", Msg1 );
|
Sys_Printf( "%s\n", Msg1 );
|
||||||
gtk_MessageBox( g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK );
|
gtk_MessageBox( g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK );
|
||||||
strcpy( pname, SHADER_NOT_FOUND );
|
Q_strncpyz( pname, SHADER_NOT_FOUND, length );
|
||||||
p->pShader = QERApp_Shader_ForName( SHADER_NOT_FOUND );
|
p->pShader = QERApp_Shader_ForName( SHADER_NOT_FOUND );
|
||||||
p->d_texture = p->pShader->getTexture();
|
p->d_texture = p->pShader->getTexture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy( pname, p->pShader->getName() + 9 ); // remove "textures/"
|
Q_strncpyz( pname, p->pShader->getName() + 9, length ); // remove "textures/"
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4784,7 +4784,7 @@ void Patch_Write( patchMesh_t *p, MemStream *file ){
|
||||||
|
|
||||||
MemFile_fprintf( file, " {\n patchDef2\n {\n" );
|
MemFile_fprintf( file, " {\n patchDef2\n {\n" );
|
||||||
|
|
||||||
CheckName( p, pname );
|
CheckName( p, pname, sizeof( pname ) );
|
||||||
MemFile_fprintf( file, " %s\n", pname );
|
MemFile_fprintf( file, " %s\n", pname );
|
||||||
MemFile_fprintf( file, " ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value );
|
MemFile_fprintf( file, " ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value );
|
||||||
|
|
||||||
|
@ -4823,7 +4823,7 @@ void Patch_Write( patchMesh_t *p, FILE *file ){
|
||||||
|
|
||||||
fprintf( file, " {\n patchDef2\n {\n" );
|
fprintf( file, " {\n patchDef2\n {\n" );
|
||||||
{
|
{
|
||||||
CheckName( p, pname );
|
CheckName( p, pname, sizeof( pname ) );
|
||||||
fprintf( file, " %s\n", pname );
|
fprintf( file, " %s\n", pname );
|
||||||
fprintf( file, " ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value );
|
fprintf( file, " ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value );
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,9 @@ void CPointfile::GenerateDisplayList(){
|
||||||
void Pointfile_Delete( void ){
|
void Pointfile_Delete( void ){
|
||||||
char name[1024];
|
char name[1024];
|
||||||
|
|
||||||
strcpy( name, currentmap );
|
Q_strncpyz( name, currentmap, sizeof( name ) );
|
||||||
StripExtension( name );
|
StripExtension( name );
|
||||||
strcat( name, ".lin" );
|
strncat( name, ".lin", sizeof( name ) );
|
||||||
|
|
||||||
remove( name );
|
remove( name );
|
||||||
}
|
}
|
||||||
|
@ -125,9 +125,9 @@ void WINAPI Pointfile_Check( void ){
|
||||||
int line = 1;
|
int line = 1;
|
||||||
vec3_t v;
|
vec3_t v;
|
||||||
|
|
||||||
strcpy( name, currentmap );
|
Q_strncpyz( name, currentmap, sizeof( name ) );
|
||||||
StripExtension( name );
|
StripExtension( name );
|
||||||
strcat( name, ".lin" );
|
strncat( name, ".lin", sizeof( name ) );
|
||||||
|
|
||||||
size = vfsLoadFullPathFile( name, (void**)&data );
|
size = vfsLoadFullPathFile( name, (void**)&data );
|
||||||
if ( size <= 0 ) {
|
if ( size <= 0 ) {
|
||||||
|
|
|
@ -229,7 +229,7 @@ void WindowPosition_Parse( window_position_t& m_value, const CString& value ){
|
||||||
|
|
||||||
void WindowPosition_Write( const window_position_t& m_value, CString& value ){
|
void WindowPosition_Write( const window_position_t& m_value, CString& value ){
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
sprintf( buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h );
|
snprintf( buffer, sizeof( buffer ), "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h );
|
||||||
value = buffer;
|
value = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ void CXMLPropertyBag::GetPref( const char *name, int *pV, int V ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char s[10];
|
char s[12];
|
||||||
sprintf( s, "%d", V );
|
snprintf( s, sizeof( s ), "%d", V );
|
||||||
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
||||||
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
||||||
*pV = V;
|
*pV = V;
|
||||||
|
@ -347,8 +347,8 @@ void CXMLPropertyBag::GetPref( const char *name, float *pV, float V ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char s[10];
|
char s[64];
|
||||||
sprintf( s, "%f", V );
|
snprintf( s, sizeof( s ), "%f", V );
|
||||||
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
||||||
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
||||||
*pV = V;
|
*pV = V;
|
||||||
|
@ -364,8 +364,8 @@ void CXMLPropertyBag::GetPref( const char *name, float* pV, float* V ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char s[128];
|
char s[256];
|
||||||
sprintf( s, "%f %f %f", V[0], V[1], V[2] );
|
snprintf( s, sizeof( s ), "%f %f %f", V[0], V[1], V[2] );
|
||||||
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
pNode = xmlNewChild( mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s );
|
||||||
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
xmlSetProp( pNode, (xmlChar *)"name", (xmlChar *)name );
|
||||||
pV[0] = V[0];
|
pV[0] = V[0];
|
||||||
|
@ -401,7 +401,7 @@ void CXMLPropertyBag::UpdatePrefTree(){
|
||||||
CPrefAssignment *pPref = &( *iPref );
|
CPrefAssignment *pPref = &( *iPref );
|
||||||
// look for the node
|
// look for the node
|
||||||
xmlNodePtr pNode;
|
xmlNodePtr pNode;
|
||||||
char s[64];
|
char s[256];
|
||||||
|
|
||||||
pNode = EpairForName( pPref->mName.GetBuffer() );
|
pNode = EpairForName( pPref->mName.GetBuffer() );
|
||||||
// we never expect that the node could not be found, because this is supposed to happen
|
// we never expect that the node could not be found, because this is supposed to happen
|
||||||
|
@ -416,11 +416,11 @@ void CXMLPropertyBag::UpdatePrefTree(){
|
||||||
xmlNodeSetContent( pNode, (const xmlChar *)( (Str *)pPref->mVal )->GetBuffer() );
|
xmlNodeSetContent( pNode, (const xmlChar *)( (Str *)pPref->mVal )->GetBuffer() );
|
||||||
break;
|
break;
|
||||||
case PREF_INT:
|
case PREF_INT:
|
||||||
sprintf( s, "%d", *(int *)pPref->mVal );
|
snprintf( s, sizeof( s ), "%d", *(int *)pPref->mVal );
|
||||||
xmlNodeSetContent( pNode, (xmlChar *)s );
|
xmlNodeSetContent( pNode, (xmlChar *)s );
|
||||||
break;
|
break;
|
||||||
case PREF_FLOAT:
|
case PREF_FLOAT:
|
||||||
sprintf( s, "%f", *(float *)pPref->mVal );
|
snprintf( s, sizeof( s ), "%f", *(float *)pPref->mVal );
|
||||||
xmlNodeSetContent( pNode, (xmlChar *)s );
|
xmlNodeSetContent( pNode, (xmlChar *)s );
|
||||||
break;
|
break;
|
||||||
case PREF_BOOL:
|
case PREF_BOOL:
|
||||||
|
@ -430,7 +430,7 @@ void CXMLPropertyBag::UpdatePrefTree(){
|
||||||
case PREF_VEC3:
|
case PREF_VEC3:
|
||||||
{
|
{
|
||||||
float* v = (float*)pPref->mVal;
|
float* v = (float*)pPref->mVal;
|
||||||
sprintf( s, "%f %f %f", v[0], v[1], v[2] );
|
snprintf( s, sizeof( s ), "%f %f %f", v[0], v[1], v[2] );
|
||||||
xmlNodeSetContent( pNode, (xmlChar *)s );
|
xmlNodeSetContent( pNode, (xmlChar *)s );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -501,7 +501,7 @@ qboolean CXMLPropertyBag::WriteXMLFile( const char* pFilename ){
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Widget callbacks for PrefsDlg
|
// Widget callbacks for PrefsDlg
|
||||||
|
|
||||||
#if !defined( WIN32 )
|
#if !defined( _WIN32 )
|
||||||
// browse for custom editor executable
|
// browse for custom editor executable
|
||||||
static void OnBtnBrowseEditor( GtkWidget *widget, gpointer data ){
|
static void OnBtnBrowseEditor( GtkWidget *widget, gpointer data ){
|
||||||
PrefsDlg *dlg = (PrefsDlg*)data;
|
PrefsDlg *dlg = (PrefsDlg*)data;
|
||||||
|
@ -523,7 +523,7 @@ static void OnBtnBrowseprefab( GtkWidget *widget, gpointer data ){
|
||||||
if ( strlen( path ) == 0 ) {
|
if ( strlen( path ) == 0 ) {
|
||||||
path = g_strGameToolsPath;
|
path = g_strGameToolsPath;
|
||||||
}
|
}
|
||||||
char *dir = dir_dialog( g_PrefsDlg.GetWidget(), _( "Set prefab path" ), path );
|
gchar *dir = dir_dialog( g_PrefsDlg.GetWidget(), _( "Set prefab path" ), path );
|
||||||
dlg->UpdateData( TRUE );
|
dlg->UpdateData( TRUE );
|
||||||
|
|
||||||
if ( dir != NULL ) {
|
if ( dir != NULL ) {
|
||||||
|
@ -564,7 +564,7 @@ static void OnButtonClean( GtkWidget *widget, gpointer data ){
|
||||||
g_qeglobals.disable_ini = true;
|
g_qeglobals.disable_ini = true;
|
||||||
remove( dlg->m_inipath->str );
|
remove( dlg->m_inipath->str );
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
sprintf( buf, "%sSavedInfo.bin", dlg->m_rc_path->str );
|
snprintf( buf, sizeof( buf ), "%sSavedInfo.bin", dlg->m_rc_path->str );
|
||||||
remove( buf );
|
remove( buf );
|
||||||
HandleCommand( NULL, GINT_TO_POINTER( ID_FILE_EXIT ) );
|
HandleCommand( NULL, GINT_TO_POINTER( ID_FILE_EXIT ) );
|
||||||
_exit( 0 );
|
_exit( 0 );
|
||||||
|
@ -729,9 +729,9 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
|
||||||
{
|
{
|
||||||
char full[PATH_MAX];
|
char full[PATH_MAX];
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
_fullpath( full, prop, PATH_MAX );
|
_fullpath( full, prop, sizeof( full ) );
|
||||||
#else
|
#else
|
||||||
strncpy( full, prop, PATH_MAX );
|
Q_strncpyz( full, prop, sizeof( full ) );
|
||||||
#endif
|
#endif
|
||||||
xmlFree( prop );
|
xmlFree( prop );
|
||||||
prop = NULL;
|
prop = NULL;
|
||||||
|
@ -822,9 +822,9 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
|
||||||
if ( prop != NULL ) {
|
if ( prop != NULL ) {
|
||||||
char full[PATH_MAX];
|
char full[PATH_MAX];
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
_fullpath( full, prop, PATH_MAX );
|
_fullpath( full, prop, sizeof( full ) );
|
||||||
#else
|
#else
|
||||||
strncpy( full, prop, PATH_MAX );
|
Q_strncpyz( full, prop, sizeof( full ) );
|
||||||
#endif
|
#endif
|
||||||
xmlFree( prop );
|
xmlFree( prop );
|
||||||
prop = NULL;
|
prop = NULL;
|
||||||
|
@ -844,12 +844,12 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
|
||||||
// if engine path was not specified in the .game, it implies we can guess it from the gametools path
|
// if engine path was not specified in the .game, it implies we can guess it from the gametools path
|
||||||
// on win32, and for most game package, the gametools are installed with the game
|
// on win32, and for most game package, the gametools are installed with the game
|
||||||
char aux_path[PATH_MAX]; // aux
|
char aux_path[PATH_MAX]; // aux
|
||||||
strcpy( aux_path, mGameToolsPath.GetBuffer() );
|
Q_strncpyz( aux_path, mGameToolsPath.GetBuffer(), sizeof( aux_path ) );
|
||||||
if ( ( aux_path[ strlen( aux_path ) - 1 ] == '/' ) || ( aux_path[ strlen( aux_path ) - 1 ] == '\\' ) ) {
|
if ( ( aux_path[ strlen( aux_path ) - 1 ] == '/' ) || ( aux_path[ strlen( aux_path ) - 1 ] == '\\' ) ) {
|
||||||
aux_path[strlen( aux_path ) - 1] = '\0'; // strip ending '/' if any
|
aux_path[strlen( aux_path ) - 1] = '\0'; // strip ending '/' if any
|
||||||
}
|
}
|
||||||
char up_path[PATH_MAX]; // up one level
|
char up_path[PATH_MAX]; // up one level
|
||||||
ExtractFilePath( aux_path, up_path );
|
ExtractFilePath( aux_path, up_path, sizeof( up_path ) );
|
||||||
mEnginePath = up_path;
|
mEnginePath = up_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3087,7 +3087,7 @@ void PrefsDlg::LoadPrefs(){
|
||||||
for ( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ )
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
sprintf( buf, "%s%d", FILE_KEY, i );
|
snprintf( buf, sizeof( buf ), "%s%d", FILE_KEY, i );
|
||||||
mLocalPrefs.GetPref( buf, &m_strMRUFiles[i], "" );
|
mLocalPrefs.GetPref( buf, &m_strMRUFiles[i], "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3130,7 +3130,7 @@ void PrefsDlg::LoadPrefs(){
|
||||||
|
|
||||||
for ( i = 0; i < 3; i++ ) {
|
for ( i = 0; i < 3; i++ ) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
sprintf( buf, "%s%d", SI_AXISCOLORS_KEY, i );
|
snprintf( buf, sizeof( buf ), "%s%d", SI_AXISCOLORS_KEY, i );
|
||||||
mLocalPrefs.GetPref( buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i] );
|
mLocalPrefs.GetPref( buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3154,7 +3154,7 @@ void PrefsDlg::LoadPrefs(){
|
||||||
|
|
||||||
for ( i = 0; i < COLOR_LAST; i++ ) {
|
for ( i = 0; i < COLOR_LAST; i++ ) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
sprintf( buf, "%s%d", SI_COLORS_KEY, i );
|
snprintf( buf, sizeof( buf ), "%s%d", SI_COLORS_KEY, i );
|
||||||
mLocalPrefs.GetPref( buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i] );
|
mLocalPrefs.GetPref( buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
||||||
bool read_var( const char *filename, const char *section, const char *key, char *value ){
|
bool read_var( const char *filename, const char *section, const char *key, char *value, size_t length ){
|
||||||
char line[1024], *ptr;
|
char line[1024], *ptr;
|
||||||
FILE *rc;
|
FILE *rc;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ bool read_var( const char *filename, const char *section, const char *key, char
|
||||||
line[strlen( line ) - 1] = '\0';
|
line[strlen( line ) - 1] = '\0';
|
||||||
|
|
||||||
if ( strcmp( line, key ) == 0 ) {
|
if ( strcmp( line, key ) == 0 ) {
|
||||||
strcpy( value, ptr + 1 );
|
Q_strncpyz( value, ptr + 1, length );
|
||||||
fclose( rc );
|
fclose( rc );
|
||||||
|
|
||||||
if ( value[strlen( value ) - 1] == 10 || value[strlen( value ) - 1] == 13 || value[strlen( value ) - 1] == 32 ) {
|
if ( value[strlen( value ) - 1] == 10 || value[strlen( value ) - 1] == 13 || value[strlen( value ) - 1] == 32 ) {
|
||||||
|
@ -187,13 +187,13 @@ static bool save_var( const char *filename, const char *section, const char *key
|
||||||
|
|
||||||
bool WINAPI profile_save_int( const char *filename, const char *section, const char *key, int value ){
|
bool WINAPI profile_save_int( const char *filename, const char *section, const char *key, int value ){
|
||||||
char buf[16];
|
char buf[16];
|
||||||
sprintf( buf, "%d", value );
|
snprintf( buf, sizeof( buf ), "%d", value );
|
||||||
return save_var( filename, section, key, buf );
|
return save_var( filename, section, key, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WINAPI profile_save_float( const char *filename, const char *section, const char *key, float value ){
|
bool WINAPI profile_save_float( const char *filename, const char *section, const char *key, float value ){
|
||||||
char buf[16];
|
char buf[64];
|
||||||
sprintf( buf, "%f", value );
|
snprintf( buf, sizeof( buf ), "%f", value );
|
||||||
return save_var( filename, section, key, buf );
|
return save_var( filename, section, key, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ bool WINAPI profile_save_string( const char * filename, const char *section, con
|
||||||
bool profile_save_buffer( const char * rc_path, const char *name, void *buffer, guint32 size ){
|
bool profile_save_buffer( const char * rc_path, const char *name, void *buffer, guint32 size ){
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
sprintf( filename, "%s/%s.bin", rc_path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s.bin", rc_path, name );
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
f = fopen( filename, "wb" );
|
f = fopen( filename, "wb" );
|
||||||
|
@ -222,7 +222,7 @@ bool profile_save_buffer( const char * rc_path, const char *name, void *buffer,
|
||||||
|
|
||||||
bool profile_load_buffer( const char * rc_path, const char *name, void *buffer, guint32 *plSize ){
|
bool profile_load_buffer( const char * rc_path, const char *name, void *buffer, guint32 *plSize ){
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
sprintf( filename, "%s/%s.bin", rc_path, name );
|
snprintf( filename, sizeof( filename ), "%s/%s.bin", rc_path, name );
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
guint32 len;
|
guint32 len;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -254,7 +254,7 @@ bool profile_load_buffer( const char * rc_path, const char *name, void *buffer,
|
||||||
int WINAPI profile_load_int( const char *filename, const char *section, const char *key, int default_value ){
|
int WINAPI profile_load_int( const char *filename, const char *section, const char *key, int default_value ){
|
||||||
char value[1024];
|
char value[1024];
|
||||||
|
|
||||||
if ( read_var( filename, section, key, value ) ) {
|
if ( read_var( filename, section, key, value, sizeof( value ) ) ) {
|
||||||
return atoi( value );
|
return atoi( value );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -265,7 +265,7 @@ int WINAPI profile_load_int( const char *filename, const char *section, const ch
|
||||||
float WINAPI profile_load_float( const char *filename, const char *section, const char *key, float default_value ){
|
float WINAPI profile_load_float( const char *filename, const char *section, const char *key, float default_value ){
|
||||||
char value[1024];
|
char value[1024];
|
||||||
|
|
||||||
if ( read_var( filename, section, key, value ) ) {
|
if ( read_var( filename, section, key, value, sizeof( value ) ) ) {
|
||||||
return atof( value );
|
return atof( value );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -277,7 +277,7 @@ char* WINAPI profile_load_string( const char *filename, const char *section, con
|
||||||
static Str ret;
|
static Str ret;
|
||||||
char value[1024];
|
char value[1024];
|
||||||
|
|
||||||
if ( read_var( filename, section, key, value ) ) {
|
if ( read_var( filename, section, key, value, sizeof( value ) ) ) {
|
||||||
ret = value;
|
ret = value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -100,7 +100,7 @@ void WINAPI QE_CheckOpenGLForErrors( void ){
|
||||||
int i = qglGetError();
|
int i = qglGetError();
|
||||||
if ( i != GL_NO_ERROR ) {
|
if ( i != GL_NO_ERROR ) {
|
||||||
if ( i == GL_OUT_OF_MEMORY ) {
|
if ( i == GL_OUT_OF_MEMORY ) {
|
||||||
sprintf( strMsg, "OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString( (GLenum)i ) );
|
snprintf( strMsg, sizeof( strMsg ), "OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString( (GLenum)i ) );
|
||||||
if ( gtk_MessageBox( g_pParentWnd->m_pWidget, strMsg, "Radiant Error", MB_YESNO ) == IDYES ) {
|
if ( gtk_MessageBox( g_pParentWnd->m_pWidget, strMsg, "Radiant Error", MB_YESNO ) == IDYES ) {
|
||||||
Map_SaveFile( NULL, false );
|
Map_SaveFile( NULL, false );
|
||||||
}
|
}
|
||||||
|
@ -126,14 +126,14 @@ char *ExpandReletivePath( char *p ){
|
||||||
}
|
}
|
||||||
|
|
||||||
base = ValueForKey( g_qeglobals.d_project_entity, "basepath" );
|
base = ValueForKey( g_qeglobals.d_project_entity, "basepath" );
|
||||||
sprintf( temp, "%s/%s", base, p );
|
snprintf( temp, sizeof( temp ), "%s/%s", base, p );
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *copystring( char *s ){
|
char *copystring( char *s ){
|
||||||
char *b;
|
char *b;
|
||||||
b = (char*)malloc( strlen( s ) + 1 );
|
b = (char*)malloc( strlen( s ) + 1 );
|
||||||
strcpy( b,s );
|
strcpy( b, s );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void Map_Snapshot(){
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
//sprintf( buf, "%s.%i", strNewPath.GetBuffer(), nCount );
|
//sprintf( buf, "%s.%i", strNewPath.GetBuffer(), nCount );
|
||||||
// snapshot will now end with a known ext.
|
// snapshot will now end with a known ext.
|
||||||
sprintf( buf, "%s.%i.%s", strNewPath.GetBuffer(), nCount, strOldEXT.GetBuffer() );
|
snprintf( buf, sizeof( buf ), "%s.%i.%s", strNewPath.GetBuffer(), nCount, strOldEXT.GetBuffer() );
|
||||||
strFile = buf;
|
strFile = buf;
|
||||||
bGo = DoesFileExist( strFile, lSize );
|
bGo = DoesFileExist( strFile, lSize );
|
||||||
nCount++;
|
nCount++;
|
||||||
|
@ -282,7 +282,7 @@ int BuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){
|
||||||
int nResult = GetFullPathName( pPath, nBufferLen, pBuffer, &pFile );
|
int nResult = GetFullPathName( pPath, nBufferLen, pBuffer, &pFile );
|
||||||
nResult = GetShortPathName( pPath, pBuffer, nBufferLen );
|
nResult = GetShortPathName( pPath, pBuffer, nBufferLen );
|
||||||
if ( nResult == 0 ) {
|
if ( nResult == 0 ) {
|
||||||
strcpy( pBuffer, pPath ); // Use long filename
|
Q_strncpyz( pBuffer, pPath, nBufferLen ); // Use long filename
|
||||||
}
|
}
|
||||||
return nResult;
|
return nResult;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ void HandleXMLError( void* ctxt, const char* text, ... ){
|
||||||
static char buf[32768];
|
static char buf[32768];
|
||||||
|
|
||||||
va_start( argptr,text );
|
va_start( argptr,text );
|
||||||
vsprintf( buf, text, argptr );
|
vsnprintf( buf, sizeof( buf ), text, argptr );
|
||||||
Sys_FPrintf( SYS_ERR, "XML %s\n", buf );
|
Sys_FPrintf( SYS_ERR, "XML %s\n", buf );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
}
|
}
|
||||||
|
@ -598,8 +598,9 @@ bool QE_LoadProject( const char *projectfile ){
|
||||||
int ver = IntForKey( g_qeglobals.d_project_entity, "version" );
|
int ver = IntForKey( g_qeglobals.d_project_entity, "version" );
|
||||||
if ( ver > PROJECT_VERSION ) {
|
if ( ver > PROJECT_VERSION ) {
|
||||||
char strMsg[1024];
|
char strMsg[1024];
|
||||||
sprintf( strMsg, "This is a version %d project file. This build only supports <=%d project files.\n"
|
snprintf( strMsg, sizeof( strMsg ),
|
||||||
"Please choose another project file or upgrade your version of Radiant.", ver, PROJECT_VERSION );
|
"This is a version %d project file. This build only supports <=%d project files.\n"
|
||||||
|
"Please choose another project file or upgrade your version of Radiant.", ver, PROJECT_VERSION );
|
||||||
gtk_MessageBox( g_pParentWnd->m_pWidget, strMsg, "Can't load project file", MB_ICONERROR | MB_OK );
|
gtk_MessageBox( g_pParentWnd->m_pWidget, strMsg, "Can't load project file", MB_ICONERROR | MB_OK );
|
||||||
// set the project file to nothing so we are sure we'll ask next time?
|
// set the project file to nothing so we are sure we'll ask next time?
|
||||||
g_PrefsDlg.m_strLastProject = "";
|
g_PrefsDlg.m_strLastProject = "";
|
||||||
|
@ -645,7 +646,7 @@ bool QE_LoadProject( const char *projectfile ){
|
||||||
|
|
||||||
if ( IntForKey( g_qeglobals.d_project_entity, "version" ) != PROJECT_VERSION ) {
|
if ( IntForKey( g_qeglobals.d_project_entity, "version" ) != PROJECT_VERSION ) {
|
||||||
char strMsg[2048];
|
char strMsg[2048];
|
||||||
sprintf( strMsg,
|
snprintf( strMsg, sizeof( strMsg ),
|
||||||
"The template project '%s' has version %d. The editor binary is configured for version %d.\n"
|
"The template project '%s' has version %d. The editor binary is configured for version %d.\n"
|
||||||
"This indicates a problem in your setup.\n"
|
"This indicates a problem in your setup.\n"
|
||||||
"I will keep going with this project till you fix this",
|
"I will keep going with this project till you fix this",
|
||||||
|
@ -654,19 +655,19 @@ bool QE_LoadProject( const char *projectfile ){
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the writable project file path
|
// create the writable project file path
|
||||||
strcpy( buf, g_qeglobals.m_strHomeGame.GetBuffer() );
|
Q_strncpyz( buf, g_qeglobals.m_strHomeGame.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( buf, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( buf ) );
|
||||||
strcat( buf, G_DIR_SEPARATOR_S "scripts" G_DIR_SEPARATOR_S );
|
strncat( buf, G_DIR_SEPARATOR_S "scripts" G_DIR_SEPARATOR_S, sizeof( buf ) );
|
||||||
// while the filename is already in use, increment the number we add to the end
|
// while the filename is already in use, increment the number we add to the end
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
char pUser[PATH_MAX];
|
char pUser[PATH_MAX];
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
sprintf( pUser, "%suser%d." PROJECT_FILETYPE, buf, counter );
|
snprintf( pUser, sizeof( pUser ), "%suser%d." PROJECT_FILETYPE, buf, counter );
|
||||||
counter++;
|
counter++;
|
||||||
if ( access( pUser, R_OK ) != 0 ) {
|
if ( access( pUser, R_OK ) != 0 ) {
|
||||||
// this is the one
|
// this is the one
|
||||||
strcpy( buf, pUser );
|
Q_strncpyz( buf, pUser, sizeof( buf ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1266,7 +1267,7 @@ void Sys_MarkMapModified( void ){
|
||||||
|
|
||||||
if ( modified != 1 ) {
|
if ( modified != 1 ) {
|
||||||
modified = true; // mark the map as changed
|
modified = true; // mark the map as changed
|
||||||
sprintf( title, "%s *", currentmap );
|
snprintf( title, sizeof( title ), "%s *", currentmap );
|
||||||
|
|
||||||
QE_ConvertDOSToUnixName( title, title );
|
QE_ConvertDOSToUnixName( title, title );
|
||||||
Sys_SetTitle( title );
|
Sys_SetTitle( title );
|
||||||
|
@ -1337,7 +1338,7 @@ void Sys_UpdateStatusBar( void ){
|
||||||
|
|
||||||
char numbrushbuffer[100] = "";
|
char numbrushbuffer[100] = "";
|
||||||
|
|
||||||
sprintf( numbrushbuffer, "Brushes: %d Entities: %d", g_numbrushes, g_numentities );
|
snprintf( numbrushbuffer, sizeof( numbrushbuffer ), "Brushes: %d Entities: %d", g_numbrushes, g_numentities );
|
||||||
g_pParentWnd->SetStatusText( 2, numbrushbuffer );
|
g_pParentWnd->SetStatusText( 2, numbrushbuffer );
|
||||||
//Sys_Status( numbrushbuffer, 2 );
|
//Sys_Status( numbrushbuffer, 2 );
|
||||||
}
|
}
|
||||||
|
@ -1372,11 +1373,11 @@ void buffer_write_escaped_mnemonic( char* buffer, const char* string ){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MRU_SetText( int index, const char *filename ){
|
static void MRU_SetText( int index, const char *filename ){
|
||||||
strcpy( MRU_filenames[index], filename );
|
Q_strncpyz( MRU_filenames[index], filename, sizeof( MRU_filenames[index] ) );
|
||||||
|
|
||||||
char mnemonic[PATH_MAX * 2 + 4];
|
char mnemonic[PATH_MAX * 2 + 4];
|
||||||
mnemonic[0] = '_';
|
mnemonic[0] = '_';
|
||||||
sprintf( mnemonic + 1, "%d", index + 1 );
|
snprintf( mnemonic + 1, sizeof( mnemonic ) - 1, "%d", index + 1 );
|
||||||
mnemonic[2] = '-';
|
mnemonic[2] = '-';
|
||||||
mnemonic[3] = ' ';
|
mnemonic[3] = ' ';
|
||||||
buffer_write_escaped_mnemonic( mnemonic + 4, filename );
|
buffer_write_escaped_mnemonic( mnemonic + 4, filename );
|
||||||
|
@ -1510,9 +1511,9 @@ void ProjectDialog(){
|
||||||
* store it in buffer.
|
* store it in buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
strcpy( buffer, g_qeglobals.m_strHomeGame.GetBuffer() );
|
Q_strncpyz( buffer, g_qeglobals.m_strHomeGame.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, g_pGameDescription->mBaseGame.GetBuffer() );
|
strncat( buffer, g_pGameDescription->mBaseGame.GetBuffer(), sizeof( buffer ) );
|
||||||
strcat( buffer, "/scripts/" );
|
strncat( buffer, "/scripts/", sizeof( buffer ) );
|
||||||
|
|
||||||
// Display the Open dialog box
|
// Display the Open dialog box
|
||||||
filename = file_dialog( NULL, TRUE, _( "Open File" ), buffer, "project" );
|
filename = file_dialog( NULL, TRUE, _( "Open File" ), buffer, "project" );
|
||||||
|
@ -1569,7 +1570,7 @@ void FillBSPMenu(){
|
||||||
if ( g_qeglobals.bBSPFrontendPlugin ) {
|
if ( g_qeglobals.bBSPFrontendPlugin ) {
|
||||||
CString str = g_BSPFrontendTable.m_pfnGetBSPMenu();
|
CString str = g_BSPFrontendTable.m_pfnGetBSPMenu();
|
||||||
char cTemp[1024];
|
char cTemp[1024];
|
||||||
strcpy( cTemp, str );
|
Q_strncpyz( cTemp, str, sizeof( cTemp ) );
|
||||||
char* token = strtok( cTemp, ",;" );
|
char* token = strtok( cTemp, ",;" );
|
||||||
if ( token && *token == ' ' ) {
|
if ( token && *token == ' ' ) {
|
||||||
while ( *token == ' ' )
|
while ( *token == ' ' )
|
||||||
|
|
|
@ -271,7 +271,7 @@ int WINAPI profile_load_int( const char *filename, const char *section, const ch
|
||||||
float WINAPI profile_load_float( const char *filename, const char *section, const char *key, float default_value );
|
float WINAPI profile_load_float( const char *filename, const char *section, const char *key, float default_value );
|
||||||
char* WINAPI profile_load_string( const char *filename, const char *section, const char *key, const char *default_value );
|
char* WINAPI profile_load_string( const char *filename, const char *section, const char *key, const char *default_value );
|
||||||
// used in the command map code
|
// used in the command map code
|
||||||
bool read_var( const char *filename, const char *section, const char *key, char *value );
|
bool read_var( const char *filename, const char *section, const char *key, char *value, size_t length );
|
||||||
|
|
||||||
//
|
//
|
||||||
// entityw.c
|
// entityw.c
|
||||||
|
@ -793,7 +793,7 @@ extern void CheckBspProcess();
|
||||||
extern void QE_CountBrushesAndUpdateStatusBar();
|
extern void QE_CountBrushesAndUpdateStatusBar();
|
||||||
extern void QE_CheckAutoSave();
|
extern void QE_CheckAutoSave();
|
||||||
extern qtexture_t *current_texture;
|
extern qtexture_t *current_texture;
|
||||||
extern void SaveWithRegion( char *name ); // save the current map, sets the map name in the name buffer (deals with regioning)
|
extern void SaveWithRegion( char *name, size_t length ); // save the current map, sets the map name in the name buffer (deals with regioning)
|
||||||
extern void RunBsp( char *command );
|
extern void RunBsp( char *command );
|
||||||
extern void Map_Snapshot();
|
extern void Map_Snapshot();
|
||||||
extern void WXY_Print();
|
extern void WXY_Print();
|
||||||
|
|
|
@ -755,7 +755,7 @@ void Select_ApplyMatrix( bool bSnap, bool bRotation, int nAxis, float fDeg ){ //
|
||||||
|
|
||||||
// update the origin key
|
// update the origin key
|
||||||
char text[64];
|
char text[64];
|
||||||
sprintf( text, "%i %i %i",
|
snprintf( text, sizeof( text ), "%i %i %i",
|
||||||
(int)b->owner->origin[0], (int)b->owner->origin[1], (int)b->owner->origin[2] );
|
(int)b->owner->origin[0], (int)b->owner->origin[1], (int)b->owner->origin[2] );
|
||||||
SetKeyValue( b->owner, "origin", text );
|
SetKeyValue( b->owner, "origin", text );
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ int WINAPI QERApp_GetFaceInfo( int iface, _QERFaceData *pFaceData, winding_t *pW
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
||||||
strcpy( pFaceData->m_TextureName, selFace->texdef.GetName() );
|
Q_strncpyz( pFaceData->m_TextureName, selFace->texdef.GetName(), sizeof( pFaceData->m_TextureName ) );
|
||||||
VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
|
VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
|
||||||
VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
|
VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
|
||||||
VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
|
VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
|
||||||
|
|
|
@ -929,12 +929,8 @@ void SurfaceDlg::SetTexMods(){
|
||||||
}
|
}
|
||||||
GtkAdjustment *adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
GtkAdjustment *adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
||||||
adjust->step_increment = l_pIncrement->shift[0];
|
adjust->step_increment = l_pIncrement->shift[0];
|
||||||
char buf[10]; // got into snprintf paranoia after BoundChecker detected a stack overrun
|
char buf[64]; // got into snprintf paranoia after BoundChecker detected a stack overrun
|
||||||
#ifdef _WIN32
|
snprintf( buf, sizeof( buf ), "%g", l_pIncrement->shift[0] );
|
||||||
// TTimo: THIS IS UGLY
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#endif
|
|
||||||
snprintf( buf, 10, "%g", l_pIncrement->shift[0] );
|
|
||||||
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "hshift_inc" ) ), buf );
|
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "hshift_inc" ) ), buf );
|
||||||
|
|
||||||
spin = GTK_SPIN_BUTTON( GetDlgWidget( "vshift" ) );
|
spin = GTK_SPIN_BUTTON( GetDlgWidget( "vshift" ) );
|
||||||
|
@ -947,7 +943,7 @@ void SurfaceDlg::SetTexMods(){
|
||||||
}
|
}
|
||||||
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
||||||
adjust->step_increment = l_pIncrement->shift[1];
|
adjust->step_increment = l_pIncrement->shift[1];
|
||||||
snprintf( buf, 10, "%g", l_pIncrement->shift[1] );
|
snprintf( buf, sizeof( buf ), "%g", l_pIncrement->shift[1] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "vshift_inc" ) ), buf );
|
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "vshift_inc" ) ), buf );
|
||||||
|
|
||||||
spin = GTK_SPIN_BUTTON( GetDlgWidget( "hscale" ) );
|
spin = GTK_SPIN_BUTTON( GetDlgWidget( "hscale" ) );
|
||||||
|
@ -956,7 +952,7 @@ void SurfaceDlg::SetTexMods(){
|
||||||
|
|
||||||
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
||||||
adjust->step_increment = l_pIncrement->scale[0];
|
adjust->step_increment = l_pIncrement->scale[0];
|
||||||
snprintf( buf, 10, "%g", l_pIncrement->scale[0] );
|
snprintf( buf, sizeof( buf ), "%g", l_pIncrement->scale[0] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "hscale_inc" ) ), buf );
|
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "hscale_inc" ) ), buf );
|
||||||
|
|
||||||
spin = GTK_SPIN_BUTTON( GetDlgWidget( "vscale" ) );
|
spin = GTK_SPIN_BUTTON( GetDlgWidget( "vscale" ) );
|
||||||
|
@ -965,7 +961,7 @@ void SurfaceDlg::SetTexMods(){
|
||||||
|
|
||||||
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
||||||
adjust->step_increment = l_pIncrement->scale[1];
|
adjust->step_increment = l_pIncrement->scale[1];
|
||||||
snprintf( buf, 10, "%g", l_pIncrement->scale[1] );
|
snprintf( buf, sizeof( buf ), "%g", l_pIncrement->scale[1] );
|
||||||
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "vscale_inc" ) ), buf );
|
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "vscale_inc" ) ), buf );
|
||||||
|
|
||||||
//++timo compute BProtate as int ..
|
//++timo compute BProtate as int ..
|
||||||
|
@ -975,7 +971,7 @@ void SurfaceDlg::SetTexMods(){
|
||||||
|
|
||||||
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
|
||||||
adjust->step_increment = l_pIncrement->rotate;
|
adjust->step_increment = l_pIncrement->rotate;
|
||||||
snprintf( buf, 10, "%g", l_pIncrement->rotate );
|
snprintf( buf, sizeof( buf ), "%g", l_pIncrement->rotate );
|
||||||
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "rotate_inc" ) ), buf );
|
gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "rotate_inc" ) ), buf );
|
||||||
|
|
||||||
g_bListenChanged = true;
|
g_bListenChanged = true;
|
||||||
|
@ -1036,7 +1032,7 @@ void SurfaceDlg::GetTexMods(){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( buffer, "textures/" );
|
strcpy( buffer, "textures/" );
|
||||||
strcpy( buffer + 9, text );
|
Q_strncpyz( buffer + 9, text, sizeof( buffer ) - 9 );
|
||||||
pt->SetName( buffer );
|
pt->SetName( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void Entity_Connect( entity_t *e1, entity_t *e2 ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf( newtarget, "t%i", maxtarget + 1 );
|
snprintf( newtarget, sizeof( newtarget ), "t%i", maxtarget + 1 );
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "Connecting entities with new target/targetname: %s\n", newtarget );
|
Sys_Printf( "Connecting entities with new target/targetname: %s\n", newtarget );
|
||||||
|
|
|
@ -494,7 +494,7 @@ void BuildShaderList(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_pGameDescription->mGameFile != "hl.game" ) {
|
if ( g_pGameDescription->mGameFile != "hl.game" ) {
|
||||||
strcpy( filename, g_pGameDescription->mShaderlist.GetBuffer() );
|
Q_strncpyz( filename, g_pGameDescription->mShaderlist.GetBuffer(), sizeof( filename ) );
|
||||||
count = vfsGetFileCount( filename, 0 );
|
count = vfsGetFileCount( filename, 0 );
|
||||||
if ( count == 0 ) {
|
if ( count == 0 ) {
|
||||||
Sys_FPrintf( SYS_ERR, "Couldn't find '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
|
Sys_FPrintf( SYS_ERR, "Couldn't find '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
|
||||||
|
@ -603,7 +603,7 @@ void FillTextureMenu( GSList** pArray ){
|
||||||
char shaderfile[PATH_MAX];
|
char shaderfile[PATH_MAX];
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
ExtractFileName( (char*)l_shaderfiles->data, shaderfile );
|
ExtractFileName( (char*)l_shaderfiles->data, shaderfile, sizeof( shaderfile ) );
|
||||||
StripExtension( shaderfile );
|
StripExtension( shaderfile );
|
||||||
strlwr( shaderfile );
|
strlwr( shaderfile );
|
||||||
|
|
||||||
|
@ -749,7 +749,7 @@ void Texture_ShowDirectory(){
|
||||||
|
|
||||||
// need this function "GSList *lst SynapseServer::GetMinorList(char *major_name);"
|
// need this function "GSList *lst SynapseServer::GetMinorList(char *major_name);"
|
||||||
|
|
||||||
sprintf( dirstring, "textures/%s", texture_directory );
|
snprintf( dirstring, sizeof( dirstring ), "textures/%s", texture_directory );
|
||||||
g_ImageManager.BeginExtensionsScan();
|
g_ImageManager.BeginExtensionsScan();
|
||||||
const char* ext;
|
const char* ext;
|
||||||
while ( ( ext = g_ImageManager.GetNextExtension() ) != NULL )
|
while ( ( ext = g_ImageManager.GetNextExtension() ) != NULL )
|
||||||
|
@ -759,7 +759,7 @@ void Texture_ShowDirectory(){
|
||||||
|
|
||||||
for ( temp = files; temp; temp = temp->next )
|
for ( temp = files; temp; temp = temp->next )
|
||||||
{
|
{
|
||||||
sprintf( name, "%s%s", texture_directory, (char*)temp->data );
|
snprintf( name, sizeof( name ), "%s%s", texture_directory, (char*)temp->data );
|
||||||
|
|
||||||
StripExtension( name );
|
StripExtension( name );
|
||||||
strTemp = name;
|
strTemp = name;
|
||||||
|
@ -792,7 +792,7 @@ void Texture_ShowDirectory(){
|
||||||
|
|
||||||
// build a texture name that fits the conventions for qtexture_t::name
|
// build a texture name that fits the conventions for qtexture_t::name
|
||||||
char stdName[1024];
|
char stdName[1024];
|
||||||
sprintf( stdName, "textures/%s", name );
|
snprintf( stdName, sizeof( stdName ), "textures/%s", name );
|
||||||
// check if this texture doesn't have a shader
|
// check if this texture doesn't have a shader
|
||||||
if ( !QERApp_ActiveShader_ForTextureName( stdName ) ) {
|
if ( !QERApp_ActiveShader_ForTextureName( stdName ) ) {
|
||||||
QERApp_CreateShader_ForTextureName( stdName );
|
QERApp_CreateShader_ForTextureName( stdName );
|
||||||
|
@ -808,7 +808,7 @@ void Texture_ShowDirectory(){
|
||||||
// sort for displaying
|
// sort for displaying
|
||||||
QERApp_SortActiveShaders();
|
QERApp_SortActiveShaders();
|
||||||
|
|
||||||
sprintf( name, "Textures: %s", texture_directory );
|
snprintf( name, sizeof( name ), "Textures: %s", texture_directory );
|
||||||
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
||||||
|
|
||||||
// select the first texture in the list
|
// select the first texture in the list
|
||||||
|
@ -831,7 +831,7 @@ void Texture_ShowDirectory(){
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void Texture_ShowDirectory( int menunum ){
|
void Texture_ShowDirectory( int menunum ){
|
||||||
strcpy( texture_directory, texture_menunames[menunum - CMD_TEXTUREWAD] );
|
Q_strncpyz( texture_directory, texture_menunames[menunum - CMD_TEXTUREWAD], sizeof( texture_directory ) );
|
||||||
Texture_ShowDirectory();
|
Texture_ShowDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,7 +911,7 @@ void Texture_ShowAll(){
|
||||||
QERApp_ActiveShaders_SetDisplayed( true );
|
QERApp_ActiveShaders_SetDisplayed( true );
|
||||||
g_bShowAllShaders = true;
|
g_bShowAllShaders = true;
|
||||||
// put some information in the texture window title?
|
// put some information in the texture window title?
|
||||||
sprintf( name, "Textures: in use" );
|
snprintf( name, sizeof( name ), "Textures: in use" );
|
||||||
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
||||||
Sys_UpdateWindows( W_TEXTURE );
|
Sys_UpdateWindows( W_TEXTURE );
|
||||||
}
|
}
|
||||||
|
@ -966,7 +966,7 @@ void WINAPI Texture_ShowInuse( void ){
|
||||||
// we are no longer showing everything
|
// we are no longer showing everything
|
||||||
g_bShowAllShaders = false;
|
g_bShowAllShaders = false;
|
||||||
// put some information in the texture window title?
|
// put some information in the texture window title?
|
||||||
sprintf( name, "Textures: in use" );
|
snprintf( name, sizeof( name ), "Textures: in use" );
|
||||||
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), name );
|
||||||
|
|
||||||
|
|
||||||
|
@ -1000,7 +1000,7 @@ void Texture_ShowStartupShaders(){
|
||||||
int nLen;
|
int nLen;
|
||||||
GSList *shaderfiles = NULL;
|
GSList *shaderfiles = NULL;
|
||||||
|
|
||||||
strcpy( filename, g_pGameDescription->mShaderlist.GetBuffer() );
|
Q_strncpyz( filename, g_pGameDescription->mShaderlist.GetBuffer(), sizeof( filename ) );
|
||||||
count = vfsGetFileCount( filename, 0 );
|
count = vfsGetFileCount( filename, 0 );
|
||||||
if ( count == 0 ) {
|
if ( count == 0 ) {
|
||||||
Sys_FPrintf( SYS_ERR, "Couldn't find '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
|
Sys_FPrintf( SYS_ERR, "Couldn't find '%s'\n", g_pGameDescription->mShaderlist.GetBuffer() );
|
||||||
|
@ -1023,7 +1023,7 @@ void Texture_ShowStartupShaders(){
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// each token should be a shader filename
|
// each token should be a shader filename
|
||||||
sprintf( dirstring, "%s.shader", token );
|
snprintf( dirstring, sizeof( dirstring ), "%s.shader", token );
|
||||||
|
|
||||||
for ( tmp = shaderfiles; tmp != NULL; tmp = tmp->next )
|
for ( tmp = shaderfiles; tmp != NULL; tmp = tmp->next )
|
||||||
{
|
{
|
||||||
|
@ -1036,7 +1036,7 @@ void Texture_ShowStartupShaders(){
|
||||||
|
|
||||||
if ( !found ) {
|
if ( !found ) {
|
||||||
shaderfiles = g_slist_append( l_shaderfiles, strdup( dirstring ) );
|
shaderfiles = g_slist_append( l_shaderfiles, strdup( dirstring ) );
|
||||||
strcpy( texture_directory, dirstring );
|
Q_strncpyz( texture_directory, dirstring, sizeof( texture_directory ) );
|
||||||
Texture_ShowDirectory();
|
Texture_ShowDirectory();
|
||||||
nLen++;
|
nLen++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ static void saxWarning( void *ctx, const char *msg, ... ){
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start( args, msg );
|
va_start( args, msg );
|
||||||
vsprintf( saxMsgBuffer, msg, args );
|
vsnprintf( saxMsgBuffer, sizeof( saxMsgBuffer ), msg, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
Sys_FPrintf( SYS_WRN, "XML warning: %s\n", saxMsgBuffer );
|
Sys_FPrintf( SYS_WRN, "XML warning: %s\n", saxMsgBuffer );
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ static void saxError( void *ctx, const char *msg, ... ){
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start( args, msg );
|
va_start( args, msg );
|
||||||
vsprintf( saxMsgBuffer, msg, args );
|
vsnprintf( saxMsgBuffer, sizeof( saxMsgBuffer ), msg, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
Sys_FPrintf( SYS_ERR, "XML error: %s\n", saxMsgBuffer );
|
Sys_FPrintf( SYS_ERR, "XML error: %s\n", saxMsgBuffer );
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ static void saxFatal( void *ctx, const char *msg, ... ){
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start( args, msg );
|
va_start( args, msg );
|
||||||
vsprintf( buffer, msg, args );
|
vsnprintf( buffer, sizeof( buffer ), msg, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
Sys_FPrintf( SYS_ERR, "XML fatal error: %s\n", buffer );
|
Sys_FPrintf( SYS_ERR, "XML fatal error: %s\n", buffer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,7 +430,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
|
||||||
if ( DoLightIntensityDlg( &intensity ) == IDOK ) {
|
if ( DoLightIntensityDlg( &intensity ) == IDOK ) {
|
||||||
g_PrefsDlg.m_iLastLightIntensity = intensity;
|
g_PrefsDlg.m_iLastLightIntensity = intensity;
|
||||||
char buf[30];
|
char buf[30];
|
||||||
sprintf( buf, "255 255 255 %d", intensity );
|
snprintf( buf, sizeof( buf ), "255 255 255 %d", intensity );
|
||||||
SetKeyValue( e, "_light", buf );
|
SetKeyValue( e, "_light", buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,8 +446,8 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
|
||||||
// prompt.GotoDlgCtrl( pWnd );
|
// prompt.GotoDlgCtrl( pWnd );
|
||||||
if ( DoLightIntensityDlg( &intensity ) == IDOK ) {
|
if ( DoLightIntensityDlg( &intensity ) == IDOK ) {
|
||||||
g_PrefsDlg.m_iLastLightIntensity = intensity;
|
g_PrefsDlg.m_iLastLightIntensity = intensity;
|
||||||
char buf[10];
|
char buf[12];
|
||||||
sprintf( buf, "%d", intensity );
|
snprintf( buf, sizeof( buf ), "%d", intensity );
|
||||||
SetKeyValue( e, "light", buf );
|
SetKeyValue( e, "light", buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2287,14 +2287,14 @@ void XYWnd::XY_DrawGrid(){
|
||||||
// This renders the numbers along varying X on top of the grid view (labels vertical grid lines).
|
// This renders the numbers along varying X on top of the grid view (labels vertical grid lines).
|
||||||
for ( x = xb - ( (int) xb ) % stepx; x <= xe; x += stepx ) {
|
for ( x = xb - ( (int) xb ) % stepx; x <= xe; x += stepx ) {
|
||||||
qglRasterPos2f( x + leftCushion, yPosLabelsTop );
|
qglRasterPos2f( x + leftCushion, yPosLabelsTop );
|
||||||
sprintf( text, "%i", (int) x );
|
snprintf( text, sizeof( text ), "%i", (int) x );
|
||||||
gtk_glwidget_print_string( text );
|
gtk_glwidget_print_string( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
// This renders the numbers along varying Y on the left of the grid view (labels horizontal grid lines).
|
// This renders the numbers along varying Y on the left of the grid view (labels horizontal grid lines).
|
||||||
for ( y = yb - ( (int) yb ) % stepy; y <= ye; y += stepy ) {
|
for ( y = yb - ( (int) yb ) % stepy; y <= ye; y += stepy ) {
|
||||||
qglRasterPos2f( xPosLabelsLeft, y + bottomOffset );
|
qglRasterPos2f( xPosLabelsLeft, y + bottomOffset );
|
||||||
sprintf( text, "%i", (int) y );
|
snprintf( text, sizeof( text ), "%i", (int) y );
|
||||||
gtk_glwidget_print_string( text );
|
gtk_glwidget_print_string( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2460,7 +2460,7 @@ void XYWnd::XY_DrawBlockGrid(){
|
||||||
for ( y = yb ; y < ye ; y += g_qeglobals.blockSize )
|
for ( y = yb ; y < ye ; y += g_qeglobals.blockSize )
|
||||||
{
|
{
|
||||||
qglRasterPos2f( x + ( g_qeglobals.blockSize / 2 ), y + ( g_qeglobals.blockSize / 2 ) );
|
qglRasterPos2f( x + ( g_qeglobals.blockSize / 2 ), y + ( g_qeglobals.blockSize / 2 ) );
|
||||||
sprintf( text, "%i,%i",(int)floor( x / g_qeglobals.blockSize ), (int)floor( y / g_qeglobals.blockSize ) );
|
snprintf( text, sizeof( text ), "%i,%i",(int)floor( x / g_qeglobals.blockSize ), (int)floor( y / g_qeglobals.blockSize ) );
|
||||||
gtk_glwidget_print_string( text );
|
gtk_glwidget_print_string( text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ void Z_DrawGrid( void ){
|
||||||
for ( zz = zb ; zz < ze ; zz += step )
|
for ( zz = zb ; zz < ze ; zz += step )
|
||||||
{
|
{
|
||||||
qglRasterPos2f( -w + ( 1 / z.scale ), zz );
|
qglRasterPos2f( -w + ( 1 / z.scale ), zz );
|
||||||
sprintf( text, "%i",(int)zz );
|
snprintf( text, sizeof( text ), "%i",(int)zz );
|
||||||
gtk_glwidget_print_string( text );
|
gtk_glwidget_print_string( text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -93,7 +93,7 @@ char archivedir[1024];
|
||||||
#define MAX_EX_ARGC 1024
|
#define MAX_EX_ARGC 1024
|
||||||
int ex_argc;
|
int ex_argc;
|
||||||
char *ex_argv[MAX_EX_ARGC];
|
char *ex_argv[MAX_EX_ARGC];
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
void ExpandWildcards( int *argc, char ***argv ){
|
void ExpandWildcards( int *argc, char ***argv ){
|
||||||
struct _finddata_t fileinfo;
|
struct _finddata_t fileinfo;
|
||||||
|
@ -328,7 +328,7 @@ double I_FloatTime( void ){
|
||||||
void Q_getwd( char *out ){
|
void Q_getwd( char *out ){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
_getcwd( out, 256 );
|
_getcwd( out, 256 );
|
||||||
strcat( out, "\\" );
|
strcat( out, "\\" );
|
||||||
#else
|
#else
|
||||||
|
@ -347,7 +347,7 @@ void Q_getwd( char *out ){
|
||||||
|
|
||||||
|
|
||||||
void Q_mkdir( const char *path ){
|
void Q_mkdir( const char *path ){
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if ( _mkdir( path ) != -1 ) {
|
if ( _mkdir( path ) != -1 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1128,7 @@ void CreatePath( const char *path ){
|
||||||
char c;
|
char c;
|
||||||
char dir[1024];
|
char dir[1024];
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int olddrive = -1;
|
int olddrive = -1;
|
||||||
|
|
||||||
if ( path[1] == ':' ) {
|
if ( path[1] == ':' ) {
|
||||||
|
@ -1151,7 +1151,7 @@ void CreatePath( const char *path ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if ( olddrive != -1 ) {
|
if ( olddrive != -1 ) {
|
||||||
_chdrive( olddrive );
|
_chdrive( olddrive );
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1177,7 @@ void QCopyFile( const char *from, const char *to ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Sleep( int n ){
|
void Sys_Sleep( int n ){
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
Sleep( n );
|
Sleep( n );
|
||||||
#endif
|
#endif
|
||||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#ifdef NDEBUG // Don't show in a Release build
|
#ifdef NDEBUG // Don't show in a Release build
|
||||||
#pragma warning(disable : 4305) // truncate from double to float
|
#pragma warning(disable : 4305) // truncate from double to float
|
||||||
#pragma warning(disable : 4244) // conversion from double to float
|
#pragma warning(disable : 4244) // conversion from double to float
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#pragma intrinsic( memset, memcpy )
|
#pragma intrinsic( memset, memcpy )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue