コード例 #1
0
ファイル: sv_game.c プロジェクト: chrisglass/ufoai
/**
 * @brief Called when either the entire server is being killed, or it is changing to a different game directory.
 * @sa G_Shutdown
 * @sa SV_InitGameProgs
 */
void SV_ShutdownGameProgs (void)
{
	uint32_t size;

	if (!svs.ge)
		return;

	Com_SetServerState(ss_game_shutdown);

	if (svs.gameThread) {
		Com_Printf("Shutdown the game thread\n");
		SDL_CondSignal(svs.gameFrameCond);
		SDL_WaitThread(svs.gameThread, NULL);
		SDL_DestroyCond(svs.gameFrameCond);
		svs.gameFrameCond = NULL;
		svs.gameThread = NULL;
	}

	svs.ge->Shutdown();

	size = Mem_PoolSize(sv->gameSysPool);
	if (size > 0) {
		Com_Printf("WARNING: Game memory leak (%u bytes)\n", size);
		Cmd_ExecuteString(va("mem_stats %s", sv->gameSysPool->name));
	}

	Mem_DeletePool(sv->gameSysPool);
	sv->gameSysPool = NULL;

	SV_UnloadGame();

	svs.ge = NULL;
}
コード例 #2
0
ファイル: s_main.cpp プロジェクト: jklemmack/ufoai
/**
 * @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_DeletePool(cl_soundSysPool);

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

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

    s_env.initialized = false;
}
コード例 #3
0
ファイル: cl_language.cpp プロジェクト: stavrossk/ufoai
void CL_LanguageShutdown (void)
{
	languageCount = 0;
	languageList = nullptr;
	Mem_DeletePool(cl_msgidPool);
	cl_msgidPool = nullptr;
	msgIDText = nullptr;
	numMsgIDs = 0;
	OBJZERO(msgIDHash);
}
コード例 #4
0
ファイル: mem.cpp プロジェクト: ibrahimmusba/ufoai
/**
 * @sa Mem_Init
 * @sa Mem_CreatePool
 * @sa Qcommon_Shutdown
 */
void Mem_Shutdown (void)
{
	memPool_t *pool;
	int i;

	/* don't use cvars, debug print or anything else inside of this loop
	 * the mem you are trying to use here might already be wiped away */
	for (i = 0, pool = &m_poolList[0]; i < m_numPools; pool++, i++) {
		if (!pool->inUse)
			continue;
		Mem_DeletePool(pool);
	}

	SDL_DestroyMutex(z_lock);
	z_lock = nullptr;
}
コード例 #5
0
ファイル: test_renderer.cpp プロジェクト: AresAndy/ufoai
TEST_F(RendererTest, LoadAllAnimationFiles)
{
	const char* pattern = "models/**.anm";
	const char* filename;
	mAliasModel_t mod;

	OBJZERO(mod);
	/* set a very high value to work around the error check in the loading function */
	mod.num_frames = 100000;

	while ((filename = FS_NextFileFromFileList(pattern)) != nullptr) {
		vid_modelPool = Mem_CreatePool("Vid Model Pool");
		Com_Printf("load anim file: %s\n", filename);
		R_ModLoadAnims(&mod, filename);
		Mem_DeletePool(vid_modelPool);
	}

	FS_NextFileFromFileList(nullptr);
}
コード例 #6
0
ファイル: test_renderer.cpp プロジェクト: AresAndy/ufoai
TEST_F(RendererTest, CharacterAnimationFiles)
{
	const char* pattern = "models/**.anm";
	const char* filename;
	mAliasModel_t mod;
	const char* bloodspider[] = { "death1", "death2", "death3", "dead1",
			"dead2", "dead3", "stand0", "stand1", "stand2", "stand3", "walk0",
			"walk1", "walk2", "walk3", "cstand0", "cstand1", "cstand2",
			"cstand3", "cwalk0", "cwalk1", "cwalk2", "cwalk3", "stand_menu",
			"panic0", nullptr };
	const char* hovernet[] = { "death1", "dead1", "death2","dead2", "death3",
			"dead3", "stand0", "walk0", "cstand0", "cwalk0", "stand1", "walk1",
			"cstand1", "cwalk1", "stand2", "walk2", "cstand2", "cwalk2",
			"stand3", "walk3", "cstand3", "cwalk3", "move_rifle", "shoot_rifle",
			"cmove_rifle", "cshoot_rifle", "stand_menu", "panic0", nullptr };
	const char* soldiers[] = { "death1", "death2", "death3", "dead1", "dead2",
			"dead3", "stand0", "stand1", "stand2", "stand3", "walk0", "walk1",
			"walk2", "walk3", "cstand0", "cstand1", "cstand2", "cstand3",
			"cwalk0", "cwalk1", "cwalk2", "cwalk3", "stand_menu", "panic0",
			"move_rifle", "shoot_rifle", "cmove_rifle", "cshoot_rifle",
			"move_biggun", "shoot_biggun", "cmove_biggun", "cshoot_biggun",
			"move_melee", "shoot_melee", "cmove_melee", "cshoot_melee",
			"stand_still", "move_pistol", "shoot_pistol", "cmove_pistol",
			"cshoot_pistol", "move_pistol_d", "shoot_pistol_d",
			"cmove_pistol_d", "cshoot_pistol_d", "move_grenade",
			"shoot_grenade", "cmove_grenade", "cshoot_grenade", "move_item",
			"shoot_item", "cmove_item", "cshoot_item", "move_rpg", "shoot_rpg",
			"cmove_rpg", "cshoot_rpg", nullptr };
	const char* civilians[] = { "death1", "dead1", "death2", "dead2", "death3",
			"dead3", "stand0", "walk0", "panic0", "stand1", "stand2",
			"stand_menu", "stand_still", nullptr };

	FS_BuildFileList(pattern);

	vid_modelPool = Mem_CreatePool("Vid Model Pool");

	while ((filename = FS_NextFileFromFileList(pattern)) != nullptr) {
		const char** animList;
		if (Q_strstart(filename, "models/soldiers/"))
			animList = soldiers;
		else if (Q_strstart(filename, "models/civilians/"))
			animList = civilians;
		else if (Q_strstart(filename, "models/aliens/bloodspider"))
			animList = bloodspider;
		else if (Q_strstart(filename, "models/aliens/hovernet"))
			animList = hovernet;
		else if (Q_strstart(filename, "models/aliens/"))
			animList = soldiers;
		else
			animList = nullptr;

		/** @todo remove this hack - but ugvs are just not ready yet */
		if (Q_strstart(filename, "models/soldiers/ugv_"))
			continue;
		/** @todo remove this hack - alientank is just not ready yet */
		if (Q_strstart(filename, "models/aliens/alientank/"))
			continue;

		if (animList != nullptr) {
			OBJZERO(mod);
			/* set a very high value to work around the error check in the loading function */
			mod.num_frames = 100000;

			Com_Printf("load character anim file: %s\n", filename);
			R_ModLoadAnims(&mod, filename);

			while (*animList != nullptr) {
				int i;
				for (i = 0; i < mod.num_anims; i++) {
					const mAliasAnim_t* a = &mod.animdata[i];
					if (Q_streq(a->name, *animList))
						break;
				}
				ASSERT_FALSE(i == mod.num_anims) << "anm file " << filename << " does not contain the needed animation definition " << *animList;

				animList++;
			}
		}
	}

	Mem_DeletePool(vid_modelPool);

	FS_NextFileFromFileList(nullptr);
}