Load .arena files not loading from directories, not just from paks.

Fix check of FL_REFLECT in M_CheckAttack() being overridden by other if blocks.
Changed falling armor damage to off by default.
Added sanity checks to cl_string.c->StringSetParams().
This commit is contained in:
Knightmare66 2019-08-18 02:38:19 -04:00
parent 801a8292b3
commit d6e78497f8
6 changed files with 84 additions and 8 deletions

View file

@ -100,6 +100,10 @@ StringSetParams
*/
qboolean StringSetParams (char modifier, int *red, int *green, int *blue, int *bold, int *shadow, int *italic, int *reset)
{
// sanity check
if (!red || !green || !blue || !bold || !shadow || !italic || !reset)
return false;
if (!alt_text_color)
alt_text_color = Cvar_Get ("alt_text_color", "2", CVAR_ARCHIVE);

View file

@ -1054,12 +1054,14 @@ qboolean M_CheckAttack (edict_t *self)
if (enemy_range == RANGE_FAR)
return false;
if (self->enemy->flags == FL_REFLECT)
// Knightmare- Shouldn't this be self->enemy->flags & FL_REFLECT?
// if (self->enemy->flags == FL_REFLECT)
if (self->enemy->flags & FL_REFLECT)
{
// no waiting for reflections - shoot 'em NOW
chance = 2.0;
}
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
else if (self->monsterinfo.aiflags & AI_STAND_GROUND)
{
chance = 0.4;
}

View file

@ -1290,7 +1290,7 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
}
else
{
//ZOID--added so rail goes through SOLID_BBOX entities (gibs, etc)
// ZOID--added so rail goes through SOLID_BBOX entities (gibs, etc)
if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client) ||
(tr.ent->solid == SOLID_BBOX))
ignore = tr.ent;

View file

@ -212,7 +212,7 @@ void InitLithiumVars (void)
add_velocity_throw = gi.cvar("add_velocity_throw", "0", CVAR_ARCHIVE);
falling_armor_damage = gi.cvar("falling_armor_damage", "1", CVAR_ARCHIVE);
falling_armor_damage = gi.cvar("falling_armor_damage", "0", CVAR_ARCHIVE);
player_jump_sounds = gi.cvar("player_jump_sounds", "1", CVAR_ARCHIVE);
player_max_speed = gi.cvar("player_max_speed", "300", 0);

View file

@ -55,6 +55,8 @@ Changes as of v0.20 update 8:
- Now ignores maps.lst file inside pak/pk3 files when the same file can be loaded from outside paks in the same game folder.
- Added support for loading .arena files from disk. Previously they were only loaded from inside pak/pk3 files.
- Removed target_animation from Lazarus DLL, as it breaks when loading/saving game and there's no good way
to implement it properly.

View file

@ -217,6 +217,12 @@ void UI_LoadArenas (void)
char *p, *s, *s2, *tok, *tok2;
char **arenafiles;
char **tmplist = 0;
char *path = NULL;
char findName[1024];
char shortname[MAX_TOKEN_CHARS];
char longname[MAX_TOKEN_CHARS];
char gametypes[MAX_TOKEN_CHARS];
char scratch[200];
int i, j, narenas = 0, narenanames = 0;
qboolean type_supported[NUM_MAPTYPES];
@ -235,6 +241,72 @@ void UI_LoadArenas (void)
tmplist = malloc( sizeof( char * ) * MAX_ARENAS );
memset( tmplist, 0, sizeof( char * ) * MAX_ARENAS );
//
// search in searchpaths for .arena files
//
path = FS_NextPath (path);
while (path)
{
Com_sprintf (findName, sizeof(findName), "%s/scripts/*.arena", path);
arenafiles = FS_ListFiles(findName, &narenas, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM);
for (i=0; i < narenas && narenanames < MAX_ARENAS; i++)
{
if (!arenafiles || !arenafiles[i])
continue;
p = arenafiles[i] + strlen(path) + 1; // skip over path and next slash
if (!strstr(p, ".arena"))
continue;
if (!FS_ItemInList(p, narenanames, tmplist)) // check if already in list
{
if (UI_ParseArenaFromFile (p, shortname, longname, gametypes, MAX_TOKEN_CHARS))
{
Com_sprintf(scratch, sizeof(scratch), "%s\n%s", longname, shortname);
for (j=0; j<NUM_MAPTYPES; j++)
type_supported[j] = false;
s = gametypes;
tok = strdup(COM_Parse (&s));
while (s != NULL)
{
for (j=0; j<NUM_MAPTYPES; j++)
{
s2 = gametype_names[j].tokens;
tok2 = COM_Parse (&s2);
while (s2 != NULL) {
if ( !Q_strcasecmp(tok, tok2) )
type_supported[j] = true;
tok2 = COM_Parse (&s2);
}
}
if (tok) free (tok);
tok = strdup(COM_Parse(&s));
}
if (tok) free (tok);
for (j=0; j<NUM_MAPTYPES; j++)
if (type_supported[j]) {
ui_svr_arena_mapnames[j][ui_svr_arena_nummaps[j]] = malloc(strlen(scratch) + 1);
// strncpy(ui_svr_arena_mapnames[j][ui_svr_arena_nummaps[j]], scratch);
Q_strncpyz(ui_svr_arena_mapnames[j][ui_svr_arena_nummaps[j]], scratch, strlen(scratch) + 1);
ui_svr_arena_nummaps[j]++;
}
// Com_Printf ("UI_LoadArenas: successfully loaded arena file %s: mapname: %s levelname: %s gametypes: %s\n", p, shortname, longname, gametypes);
narenanames++;
FS_InsertInList(tmplist, p, narenanames, 0); // add to list
}
}
}
if (narenas)
FS_FreeFileList (arenafiles, narenas);
path = FS_NextPath (path);
}
//
// check in paks for .arena files
//
@ -252,10 +324,6 @@ void UI_LoadArenas (void)
if (!FS_ItemInList(p, narenanames, tmplist)) // check if already in list
{
char shortname[MAX_TOKEN_CHARS];
char longname[MAX_TOKEN_CHARS];
char gametypes[MAX_TOKEN_CHARS];
char scratch[200];
if (UI_ParseArenaFromFile (p, shortname, longname, gametypes, MAX_TOKEN_CHARS))
{
Com_sprintf(scratch, sizeof(scratch), "%s\n%s", longname, shortname);