Crossfire Client, Trunk  R21611
main.c File Reference
#include "client.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
#include "common.h"
#include "version.h"
+ Include dependency graph for main.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 
static int parse_input (char *data, int len)
 
static void print_quickhelp ()
 
static void print_usage ()
 
static void print_version ()
 

Variables

static bool debug = false
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main client entry point.

Definition at line 208 of file main.c.

References cf_snd_exit(), cf_snd_init(), debug, parse_input(), print_quickhelp(), print_usage(), and print_version().

+ Here is the call graph for this function:

◆ parse_input()

static int parse_input ( char *  data,
int  len 
)
static

Preliminary handler for Crossfire server sound2 and music commands that are received from the client via stdin.

The sound player differentiates sound2 and music commands by looking at the first parameter that comes in. Music commands consist of a single, quoted string that identifies the music to play, while a sound effect command has various numeric parameters followed by strings that identify what to play.

Sound2 data consists of whitespace delimited values: x, y, dir, vol, type, sound, and source. Type, sound, and source define what to play, while the other parameters may be used to figure out how to play it. x and y are offsets from the player to identify where the sound originated. dir can be set to indicate a direction that the source is travelling in. vol is an attenuation factor (0-100) that may be applied to the sound volume to make it possible, for example, to give map-designers the ability to suggest relative loudness of sounds in the environment.

FIXME: This is a work-in-progress. The sound2 was put into the server without a plan to fix the clients. cfsndserv is basically made obsolete by sound2. The basic fix resurrects some sound support but does not fully implement the features sound2 is supposed to provide.

Parameters
dataA text buffer that (hopefully) has a sound or music command.
lenThe length of the text data in the command buffer.
Returns
0 if the buffer contains a well-formed command, otherwise -1.

Definition at line 79 of file main.c.

References cf_play_music(), cf_play_sound(), and debug.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_quickhelp()

static void print_quickhelp ( )
static

Print a message stating how to get help.

Definition at line 37 of file main.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ print_usage()

static void print_usage ( )
static

Print out usage information.

Definition at line 42 of file main.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ print_version()

static void print_version ( )
static

Print detailed version information.

Definition at line 32 of file main.c.

References FULL_VERSION.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ debug

bool debug = false
static

Definition at line 29 of file main.c.

Referenced by main(), and parse_input().