Example #1
0
void UI_InitWindows (void)
{
	ui_sys_main = Cvar_Get("ui_sys_main", "", 0, "This is the main window id that is at the very first window stack - also see ui_sys_active");
	ui_sys_active = Cvar_Get("ui_sys_active", "", 0, "The active window we will return to when hitting esc once - also see ui_sys_main");

	/* add command */
	Cmd_AddCommand("ui_push", UI_PushWindow_f, "Push a window to the window stack");
	Cmd_AddParamCompleteFunction("ui_push", UI_CompleteWithWindow);
	Cmd_AddCommand("ui_push_dropdown", UI_PushDropDownWindow_f, "Push a dropdown window at a position");
	Cmd_AddCommand("ui_push_child", UI_PushChildWindow_f, "Push a window to the windowstack with a big dependency to a parent window");
	Cmd_AddCommand("ui_pop", UI_PopWindow_f, "Pops the current window from the stack");
	Cmd_AddCommand("ui_close", UI_CloseWindow_f, "Close a window");
	Cmd_AddCommand("ui_initstack", UI_InitStack_f, "Initialize the window stack with a main and an option window.");
	Cmd_AddCommand("ui_tree", UI_DebugTree_f, "Display a tree of nodes from a window into the console.");
	Cmd_AddParamCompleteFunction("ui_tree", UI_CompleteWithWindow);
}
Example #2
0
void M_Init (void)
{
	if (Cmd_Exists("music_change"))
		Cmd_RemoveCommand("music_change");
	Cmd_TableAddList(musicCmds);
	Cmd_AddParamCompleteFunction("music_play", M_CompleteMusic);
	snd_music = Cvar_Get("snd_music", "PsymongN3", 0, "Background music track");
	snd_music_volume = Cvar_Get("snd_music_volume", "128", CVAR_ARCHIVE, "Music volume - default is 128.");
	snd_music_volume->modified = true;
	snd_music_play = Cvar_Get ("snd_music_play", "1", CVAR_ARCHIVE, "Enable background music.");
	music.playing = snd_music_play->integer != 0;
}
Example #3
0
void Key_Init (void)
{
	int i;

	for (i = 0; i < MAXKEYLINES; i++) {
		keyLines[i][0] = CONSOLE_PROMPT_CHAR;
		keyLines[i][1] = 0;
	}
	keyLinePos = 1;

	/* register our functions */
	Cmd_AddCommand("bindui", Key_Bind_f, "Bind a key to a ui node");
	Cmd_AddCommand("bindmenu", Key_Bind_f, "Bind a key to a console command - only executed when hovering a menu");
	Cmd_AddCommand("bind", Key_Bind_f, "Bind a key to a console command");
	Cmd_AddCommand("bindbattle", Key_Bind_f, "Bind a key to a console command - only executed when in battlescape");
	Cmd_AddCommand("unbindmenu", Key_Unbind_f, "Unbind a key");
	Cmd_AddCommand("unbind", Key_Unbind_f, "Unbind a key");
	Cmd_AddCommand("unbindbattle", Key_Unbind_f, "Unbind a key");
	Cmd_AddParamCompleteFunction("bind", Key_CompleteKeyName);
	Cmd_AddParamCompleteFunction("unbind", Key_CompleteKeyName);
	Cmd_AddParamCompleteFunction("bindmenu", Key_CompleteKeyName);
	Cmd_AddParamCompleteFunction("unbindmenu", Key_CompleteKeyName);
	Cmd_AddParamCompleteFunction("bindbattle", Key_CompleteKeyName);
	Cmd_AddParamCompleteFunction("unbindbattle", Key_CompleteKeyName);
	Cmd_AddCommand("unbindallmenu", Key_Unbindall_f, "Delete all key bindings for the menu");
	Cmd_AddCommand("unbindall", Key_Unbindall_f, "Delete all key bindings");
	Cmd_AddCommand("unbindallbattle", Key_Unbindall_f, "Delete all key bindings for battlescape");
	Cmd_AddCommand("bindlist", Key_Bindlist_f, "Show all bindings on the game console");
	Cmd_AddCommand("savebind", Key_WriteBindings_f, "Saves key bindings to keys.cfg");
}
Example #4
0
void Cmd_Init (void)
{
	/* register our commands */
	Cmd_AddCommand("cmdlist", Cmd_List_f, "List all commands to game console");
	Cmd_AddCommand("exec", Cmd_Exec_f, "Execute a script file");
	Cmd_AddParamCompleteFunction("exec", Cmd_CompleteExecCommand);
	Cmd_AddCommand("echo", Cmd_Echo_f, "Print to game console");
	Cmd_AddCommand("wait", Cmd_Wait_f, NULL);
	Cmd_AddCommand("alias", Cmd_Alias_f, "Creates a new command that executes a command string");
	Cmd_AddCommand("aliasa", Cmd_Alias_f, "Creates a new, persistent command that executes a command string");
	Cmd_AddCommand("cmdclose", Cmd_Close_f, "Close the command buffer");
	Cmd_AddCommand("cmdopen", Cmd_Open_f, "Open the command buffer again");
#ifdef DEBUG
	Cmd_AddCommand("debug_cmdtest", Cmd_Test_f, "Calls every command in the current list");
#endif
}
Example #5
0
void UI_RegisterEditorNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "editor";
	behaviour->manager = new uiEditorNode();

	/* start edition mode */
	UI_RegisterNodeMethod(behaviour, "start", UI_EditorNodeStart);
	/* stop edition mode */
	UI_RegisterNodeMethod(behaviour, "stop", UI_EditorNodeStop);
	/* select the next node (according to the current one) */
	UI_RegisterNodeMethod(behaviour, "selectnext", UI_EditorNodeSelectNext);
	/* select the parent node (according to the current one) */
	UI_RegisterNodeMethod(behaviour, "selectparent", UI_EditorNodeSelectParent);
	/* select first child node (according to the current one) */
	UI_RegisterNodeMethod(behaviour, "selectfirstchild", UI_EditorNodeSelectFirstChild);

	Cmd_AddCommand("ui_extract", UI_EditorNodeExtract_f, "Extract position and size of nodes into a file");
	Cmd_AddParamCompleteFunction("ui_extract", UI_CompleteWithWindow);
}
Example #6
0
/**
 * @sa S_Shutdown
 * @sa S_Restart_f
 */
void S_Init (void)
{
    SDL_version version;
    char drivername[MAX_VAR];

    Com_Printf("\n------- sound initialization -------\n");

    OBJZERO(s_env);

    snd_init = Cvar_Get("snd_init", "1", CVAR_ARCHIVE, "Should the sound renderer get initialized");
    snd_init->modified = false; /* don't restart right away */
    Cmd_AddCommand("snd_restart", S_Restart_f, "Restart the sound renderer");

    if (!snd_init->integer) {
        Com_Printf("not initializing.\n");
        Cmd_AddCommand("music_change", Cmd_Dummy_f, "Dummy command if sound is disabled");
        Cvar_Get("snd_music", "PsymongN3", 0, "Background music track");
        return;
    }

    cl_soundSysPool = Mem_CreatePool("Client: Sound system");

    snd_distance_scale = Cvar_Get("snd_distance_scale", "0.1", 0, "Sound distance scale");
    snd_volume = Cvar_Get("snd_volume", "0.7", CVAR_ARCHIVE, "Sound volume - default is 0.7");
    snd_rate = Cvar_Get("snd_rate", "44100", CVAR_ARCHIVE, "Hz value for sound renderer - default is 44100");
    snd_chunkbufsize = Cvar_Get("snd_chunkbufsize", "1024", CVAR_ARCHIVE, "The sound buffer chunk size");
    /* set volumes to be changed so they are applied again for next sound/music playing */
    /** @todo implement the volume change for already loaded sample chunks */
    snd_volume->modified = true;

    Cmd_AddCommand("snd_play", S_Play_f, "Plays a sound fx file. Pass path relative to base/sound without file extension");
    Cmd_AddParamCompleteFunction("snd_play", S_CompleteSounds);

    if (SDL_WasInit(SDL_INIT_AUDIO) == 0) {
        if (SDL_Init(SDL_INIT_AUDIO) < 0) {
            Com_Printf("S_Init: %s.\n", SDL_GetError());
            return;
        }
    }

    MIX_VERSION(&version)
    Com_Printf("SDL_mixer version: %d.%d.%d\n", version.major, version.minor, version.patch);
    Com_Printf("... requested audio rate: %i\n", snd_rate->integer);

    if (Mix_OpenAudio(snd_rate->integer, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, snd_chunkbufsize->integer) == -1) {
        Com_Printf("S_Init: %s\n", Mix_GetError());
        return;
    }

    if (Mix_QuerySpec(&s_env.rate, &s_env.format, &s_env.numChannels) == 0) {
        Com_Printf("S_Init: %s\n", Mix_GetError());
        return;
    }

    if (SDL_AudioDriverName(drivername, sizeof(drivername)) == NULL)
        Q_strncpyz(drivername, "(UNKNOWN)", sizeof(drivername));
    Com_Printf("... driver: '%s'\n", drivername);

    if (Mix_AllocateChannels(MAX_CHANNELS) != MAX_CHANNELS) {
        Com_Printf("S_Init: %s\n", Mix_GetError());
        return;
    }

    Mix_ChannelFinished(S_FreeChannel);

    Com_Printf("... audio rate: %i\n", s_env.rate);
    Com_Printf("... audio channels: %i\n", s_env.numChannels);

#if COMPARE_VERSION(1, 2, 10)
    if (!(Mix_Init(MIX_INIT_OGG) & MIX_INIT_OGG))
        Com_Printf("... could not load ogg vorbis support\n");
    else
        Com_Printf("... loaded ogg vorbis support\n");
#endif

    s_env.initialized = true;

    M_Init();
    S_MumbleInit();
}