mirror of
https://github.com/yquake2/zaero.git
synced 2024-11-21 19:41:07 +00:00
Merge pull request #20 from devnexen/upd_to_levelup_with_main_repo
little update to level up with the other repositories.
This commit is contained in:
commit
7d3ee75e3b
5 changed files with 73 additions and 19 deletions
|
@ -874,10 +874,10 @@ void SP_worldspawn (edict_t *ent)
|
|||
if (ent->message && ent->message[0])
|
||||
{
|
||||
gi.configstring (CS_NAME, ent->message);
|
||||
strncpy (level.level_name, ent->message, sizeof(level.level_name));
|
||||
Q_strlcpy (level.level_name, ent->message, sizeof(level.level_name));
|
||||
}
|
||||
else
|
||||
strncpy (level.level_name, level.mapname, sizeof(level.level_name));
|
||||
Q_strlcpy (level.level_name, level.mapname, sizeof(level.level_name));
|
||||
|
||||
if (st.sky && st.sky[0])
|
||||
gi.configstring (CS_SKY, st.sky);
|
||||
|
|
|
@ -83,34 +83,49 @@ void SP_target_speaker (edict_t *ent)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!st.noise)
|
||||
if (!st.noise)
|
||||
{
|
||||
gi.dprintf("target_speaker with no noise set at %s\n", vtos(ent->s.origin));
|
||||
gi.dprintf("target_speaker with no noise set at %s\n",
|
||||
vtos(ent->s.origin));
|
||||
return;
|
||||
}
|
||||
if (!strstr (st.noise, ".wav"))
|
||||
Com_sprintf (buffer, sizeof(buffer), "%s.wav", st.noise);
|
||||
|
||||
if (!strstr(st.noise, ".wav"))
|
||||
{
|
||||
Com_sprintf(buffer, sizeof(buffer), "%s.wav", st.noise);
|
||||
}
|
||||
else
|
||||
strncpy (buffer, st.noise, sizeof(buffer));
|
||||
ent->noise_index = gi.soundindex (buffer);
|
||||
{
|
||||
Q_strlcpy(buffer, st.noise, sizeof(buffer));
|
||||
}
|
||||
|
||||
ent->noise_index = gi.soundindex(buffer);
|
||||
|
||||
if (!ent->volume)
|
||||
{
|
||||
ent->volume = 1.0;
|
||||
}
|
||||
|
||||
if (!ent->attenuation)
|
||||
{
|
||||
ent->attenuation = 1.0;
|
||||
else if (ent->attenuation == -1) // use -1 so 0 defaults to 1
|
||||
}
|
||||
else if (ent->attenuation == -1) /* use -1 so 0 defaults to 1 */
|
||||
{
|
||||
ent->attenuation = 0;
|
||||
}
|
||||
|
||||
// check for prestarted looping sound
|
||||
/* check for prestarted looping sound */
|
||||
if (ent->spawnflags & 1)
|
||||
{
|
||||
ent->s.sound = ent->noise_index;
|
||||
}
|
||||
|
||||
ent->use = Use_Target_Speaker;
|
||||
|
||||
// must link the entity so we get areas and clusters so
|
||||
// the server can determine who to send updates to
|
||||
gi.linkentity (ent);
|
||||
/* must link the entity so we get areas and clusters so
|
||||
the server can determine who to send updates to */
|
||||
gi.linkentity(ent);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -184,6 +184,9 @@ void Com_PageInMemory(byte *buffer, int size);
|
|||
int Q_stricmp(const char *s1, const char *s2);
|
||||
int Q_strcasecmp(char *s1, char *s2);
|
||||
int Q_strncasecmp(char *s1, char *s2, int n);
|
||||
/* portable safe string copy/concatenate */
|
||||
int Q_strlcpy(char *dst, const char *src, int size);
|
||||
int Q_strlcat(char *dst, const char *src, int size);
|
||||
|
||||
/* ============================================= */
|
||||
|
||||
|
|
|
@ -767,10 +767,10 @@ WriteGame(const char *filename, qboolean autosave)
|
|||
/* Savegame identification */
|
||||
memset(&sv, 0, sizeof(sv));
|
||||
|
||||
strncpy(sv.ver, SAVEGAMEVER, sizeof(sv.ver));
|
||||
strncpy(sv.game, GAMEVERSION, sizeof(sv.game));
|
||||
strncpy(sv.os, YQ2OSTYPE, sizeof(sv.os) - 1);
|
||||
strncpy(sv.arch, YQ2ARCH, sizeof(sv.arch));
|
||||
Q_strlcpy(sv.ver, SAVEGAMEVER, sizeof(sv.ver));
|
||||
Q_strlcpy(sv.game, GAMEVERSION, sizeof(sv.game));
|
||||
Q_strlcpy(sv.os, YQ2OSTYPE, sizeof(sv.os) - 1);
|
||||
Q_strlcpy(sv.arch, YQ2ARCH, sizeof(sv.arch));
|
||||
|
||||
fwrite(&sv, sizeof(sv), 1, f);
|
||||
|
||||
|
|
|
@ -1109,6 +1109,42 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
|
|||
strcpy(dest, bigbuffer);
|
||||
}
|
||||
|
||||
int
|
||||
Q_strlcpy(char *dst, const char *src, int size)
|
||||
{
|
||||
const char *s = src;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
if (size > 1)
|
||||
{
|
||||
*dst++ = *s;
|
||||
size--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
if (size > 0)
|
||||
{
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
return s - src;
|
||||
}
|
||||
|
||||
int
|
||||
Q_strlcat(char *dst, const char *src, int size)
|
||||
{
|
||||
char *d = dst;
|
||||
|
||||
while (size > 0 && *d)
|
||||
{
|
||||
size--;
|
||||
d++;
|
||||
}
|
||||
|
||||
return (d - dst) + Q_strlcpy(d, src, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* =====================================================================
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue