mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
commit
21483dc1bd
9 changed files with 106 additions and 24 deletions
|
@ -1129,6 +1129,20 @@ Key_Init(void)
|
|||
Cmd_AddCommand("bindlist", Key_Bindlist_f);
|
||||
}
|
||||
|
||||
void
|
||||
Key_Shutdown(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < K_LAST; ++i)
|
||||
{
|
||||
if (keybindings[i])
|
||||
{
|
||||
Z_Free(keybindings[i]);
|
||||
keybindings[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Called every frame for every detected keypress.
|
||||
* ASCII input for the console, the menu and the
|
||||
|
|
|
@ -310,6 +310,7 @@ extern qboolean chat_team;
|
|||
void Char_Event(int key);
|
||||
void Key_Event(int key, qboolean down, qboolean special);
|
||||
void Key_Init(void);
|
||||
void Key_Shutdown(void);
|
||||
void Key_WriteBindings(FILE *f);
|
||||
void Key_ReadConsoleHistory();
|
||||
void Key_WriteConsoleHistory();
|
||||
|
|
|
@ -1514,6 +1514,10 @@ IN_Shutdown(void)
|
|||
SDL_JoystickClose(joystick);
|
||||
joystick = NULL;
|
||||
}
|
||||
|
||||
const Uint32 subsystems = SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC;
|
||||
if (SDL_WasInit(subsystems) == subsystems)
|
||||
SDL_QuitSubSystem(subsystems);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
|
|
@ -440,7 +440,9 @@ GLimp_Shutdown(void)
|
|||
{
|
||||
ShutdownGraphics();
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO)
|
||||
// SDL_INIT_VIDEO implies SDL_INIT_EVENTS
|
||||
const Uint32 subsystems = SDL_INIT_VIDEO | SDL_INIT_EVENTS;
|
||||
if (SDL_WasInit(SDL_INIT_EVERYTHING) == subsystems)
|
||||
{
|
||||
SDL_Quit();
|
||||
}
|
||||
|
|
|
@ -1131,3 +1131,16 @@ Cmd_Init(void)
|
|||
Cmd_AddCommand("wait", Cmd_Wait_f);
|
||||
}
|
||||
|
||||
void
|
||||
Cmd_Shutdown(void)
|
||||
{
|
||||
cmdalias_t *next;
|
||||
|
||||
while (cmd_alias != NULL)
|
||||
{
|
||||
next = cmd_alias->next;
|
||||
Z_Free(cmd_alias->value);
|
||||
Z_Free(cmd_alias);
|
||||
cmd_alias = next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,6 +229,9 @@ Cvar_Get(char *var_name, char *var_value, int flags)
|
|||
{
|
||||
var->flags |= flags;
|
||||
|
||||
if (var->default_string)
|
||||
Z_Free(var->default_string);
|
||||
|
||||
if (!var_value)
|
||||
{
|
||||
var->default_string = CopyString("");
|
||||
|
@ -874,6 +877,7 @@ Cvar_Fini(void)
|
|||
cvar_t *c = var->next;
|
||||
Z_Free(var->string);
|
||||
Z_Free(var->name);
|
||||
Z_Free(var->default_string);
|
||||
Z_Free(var);
|
||||
var = c;
|
||||
}
|
||||
|
|
|
@ -687,6 +687,52 @@ FS_FreeFile(void *buffer)
|
|||
Z_Free(buffer);
|
||||
}
|
||||
|
||||
fsRawPath_t *FS_FreeRawPaths(fsRawPath_t *start, fsRawPath_t *end)
|
||||
{
|
||||
fsRawPath_t *cur = start;
|
||||
fsRawPath_t *next;
|
||||
|
||||
while (cur != end)
|
||||
{
|
||||
next = cur->next;
|
||||
Z_Free(cur);
|
||||
cur = next;
|
||||
}
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
fsSearchPath_t *FS_FreeSearchPaths(fsSearchPath_t *start, fsSearchPath_t *end)
|
||||
{
|
||||
fsSearchPath_t *cur = start;
|
||||
fsSearchPath_t *next;
|
||||
|
||||
while (cur != end)
|
||||
{
|
||||
if (cur->pack)
|
||||
{
|
||||
if (cur->pack->pak)
|
||||
{
|
||||
fclose(cur->pack->pak);
|
||||
}
|
||||
|
||||
if (cur->pack->pk3)
|
||||
{
|
||||
unzClose(cur->pack->pk3);
|
||||
}
|
||||
|
||||
Z_Free(cur->pack->files);
|
||||
Z_Free(cur->pack);
|
||||
}
|
||||
|
||||
next = cur->next;
|
||||
Z_Free(cur);
|
||||
cur = next;
|
||||
}
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes an explicit (not game tree related) path to a pak file.
|
||||
*
|
||||
|
@ -1680,7 +1726,6 @@ FS_BuildGameSpecificSearchPath(char *dir)
|
|||
char path[MAX_OSPATH];
|
||||
int i;
|
||||
fsRawPath_t *search;
|
||||
fsSearchPath_t *next;
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
// Write the config. Otherwise changes made by the
|
||||
|
@ -1705,28 +1750,7 @@ FS_BuildGameSpecificSearchPath(char *dir)
|
|||
// We may already have specialised directories in our search
|
||||
// path. This can happen if the server changes the mod. Let's
|
||||
// remove them.
|
||||
while (fs_searchPaths != fs_baseSearchPaths)
|
||||
{
|
||||
if (fs_searchPaths->pack)
|
||||
{
|
||||
if (fs_searchPaths->pack->pak)
|
||||
{
|
||||
fclose(fs_searchPaths->pack->pak);
|
||||
}
|
||||
|
||||
if (fs_searchPaths->pack->pk3)
|
||||
{
|
||||
unzClose(fs_searchPaths->pack->pk3);
|
||||
}
|
||||
|
||||
Z_Free(fs_searchPaths->pack->files);
|
||||
Z_Free(fs_searchPaths->pack);
|
||||
}
|
||||
|
||||
next = fs_searchPaths->next;
|
||||
Z_Free(fs_searchPaths);
|
||||
fs_searchPaths = next;
|
||||
}
|
||||
fs_searchPaths = FS_FreeSearchPaths(fs_searchPaths, fs_baseSearchPaths);
|
||||
|
||||
/* Close open files for game dir. */
|
||||
for (i = 0; i < MAX_HANDLES; i++)
|
||||
|
@ -1944,3 +1968,13 @@ FS_InitFilesystem(void)
|
|||
// Debug output
|
||||
Com_Printf("Using '%s' for writing.\n", fs_gamedir);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FS_ShutdownFilesystem(void)
|
||||
{
|
||||
fs_searchPaths = FS_FreeSearchPaths(fs_searchPaths, NULL);
|
||||
fs_rawPath = FS_FreeRawPaths(fs_rawPath, NULL);
|
||||
|
||||
fs_baseSearchPaths = NULL;
|
||||
}
|
|
@ -67,6 +67,7 @@ int curtime;
|
|||
|
||||
#ifndef DEDICATED_ONLY
|
||||
void Key_Init(void);
|
||||
void Key_Shutdown(void);
|
||||
void SCR_EndLoadingPlaque(void);
|
||||
#endif
|
||||
|
||||
|
@ -764,5 +765,12 @@ Qcommon_Frame(int usec)
|
|||
void
|
||||
Qcommon_Shutdown(void)
|
||||
{
|
||||
FS_ShutdownFilesystem();
|
||||
Cvar_Fini();
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
Key_Shutdown();
|
||||
#endif
|
||||
|
||||
Cmd_Shutdown();
|
||||
}
|
||||
|
|
|
@ -355,6 +355,7 @@ void Cbuf_InsertFromDefer(void);
|
|||
typedef void (*xcommand_t)(void);
|
||||
|
||||
void Cmd_Init(void);
|
||||
void Cmd_Shutdown(void);
|
||||
|
||||
void Cmd_AddCommand(char *cmd_name, xcommand_t function);
|
||||
|
||||
|
@ -677,6 +678,7 @@ char **FS_ListFiles2(char *findname, int *numfiles,
|
|||
void FS_FreeList(char **list, int nfiles);
|
||||
|
||||
void FS_InitFilesystem(void);
|
||||
void FS_ShutdownFilesystem(void);
|
||||
void FS_BuildGameSpecificSearchPath(char *dir);
|
||||
char *FS_Gamedir(void);
|
||||
char *FS_NextPath(char *prevpath);
|
||||
|
|
Loading…
Reference in a new issue