Example #1
0
/**
 * @sa S_Init
 * @sa S_Restart_f
 */
void S_Shutdown (void)
{
	if (!s_env.initialized)
		return;

	M_Shutdown();

	S_Stop();

	Mix_AllocateChannels(0);

	S_FreeSamples();

	Mix_CloseAudio();

	if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_AUDIO)
		SDL_Quit();
	else
		SDL_QuitSubSystem(SDL_INIT_AUDIO);

	Mem_FreeTag(cl_soundSysPool, 0);

	Cmd_RemoveCommand("snd_play");
	Cmd_RemoveCommand("snd_restart");

#if COMPARE_VERSION(1, 2, 10)
	Mix_Quit();
#endif

	s_env.initialized = qfalse;
}
Example #2
0
/**
 * @brief Frees the model pool
 * @param complete If this is true the static mesh models are freed, too
 * @sa R_SwitchModelMemPoolTag
 */
void R_ShutdownModels (bool complete)
{
	int i;
	const int start = complete ? 0 : r_numModelsStatic;

	/* free the vertex buffer - but not for the static models
	 * the world, the submodels and all the misc_models are located in the
	 * r_models array */
	for (i = start; i < r_numModels; i++) {
		model_t *mod = &r_models[i];
		mBspModel_t *bsp = &mod->bsp;

		if (bsp->vertex_buffer)
			qglDeleteBuffers(1, &bsp->vertex_buffer);
		if (bsp->texcoord_buffer)
			qglDeleteBuffers(1, &bsp->texcoord_buffer);
		if (bsp->lmtexcoord_buffer)
			qglDeleteBuffers(1, &bsp->lmtexcoord_buffer);
		if (bsp->normal_buffer)
			qglDeleteBuffers(1, &bsp->normal_buffer);
		if (bsp->tangent_buffer)
			qglDeleteBuffers(1, &bsp->tangent_buffer);
		if (bsp->index_buffer)
			qglDeleteBuffers(1, &bsp->index_buffer);
	}

	/* don't free the static models with the tag MEM_TAG_STATIC_MODELS */
	if (complete) {
		if (vid_modelPool)
			Mem_FreePool(vid_modelPool);
		if (vid_lightPool)
			Mem_FreePool(vid_lightPool);
		r_numModels = 0;
		r_numModelsInline = 0;
		r_numMapTiles = 0;
		OBJZERO(r_models);
	} else {
		if (vid_modelPool)
			Mem_FreeTag(vid_modelPool, 0);
		if (vid_lightPool)
			Mem_FreeTag(vid_lightPool, 0);
		r_numModels = r_numModelsStatic;
	}
}
Example #3
0
/*
 * @brief Shuts down the renderer, freeing all resources belonging to it,
 * including the GL context.
 */
void R_Shutdown(void) {

	Cmd_RemoveAll(CMD_RENDERER);

	R_ShutdownPrograms();

	R_ShutdownContext();

	R_ShutdownState();

	Mem_FreeTag(MEM_TAG_RENDERER);
}
Example #4
0
/*
 * @brief Called when server is shutting down due to error or an explicit `quit`.
 */
void Sv_Shutdown(const char *msg) {

	Sv_ShutdownServer(msg);

	Sv_ShutdownConsole();

	memset(&svs, 0, sizeof(svs));

	Cmd_RemoveAll(CMD_SERVER);

	Mem_FreeTag(MEM_TAG_SERVER);
}
Example #5
0
/*
 * @brief Called when server is shutting down due to error or an explicit `quit`.
 */
void Sv_Shutdown(const char *msg) {

	Sv_ShutdownServer(msg);

	Sv_ShutdownMasters();

	Net_Config(NS_UDP_SERVER, false);

	Mem_InitBuffer(&net_message, net_message_buffer, sizeof(net_message_buffer));

	memset(&svs, 0, sizeof(svs));

	Cmd_RemoveAll(CMD_SERVER);

	Mem_FreeTag(MEM_TAG_SERVER);
}
Example #6
0
static void FreeAllInventory (void)
{
	Mem_FreeTag(com_genericPool, TAG_INVENTORY);
}
Example #7
0
/*
 * @brief Shuts down the AI subsystem.
 */
void Ai_Shutdown(void) {
	Mem_FreeTag(MEM_TAG_AI);
}