Atrinik Client  4.0
Data Structures | Typedefs | Functions | Variables
main.c File Reference
#include <global.h>
#include <toolkit/gitversion.h>
#include <region_map.h>
#include <toolkit/packet.h>
#include <toolkit/string.h>
#include <toolkit/clioptions.h>
#include <toolkit/path.h>
#include <resources.h>
#include <toolkit/signals.h>
#include <toolkit/colorspace.h>
#include <toolkit/binreloc.h>
#include <toolkit/datetime.h>
#include <toolkit/socket_crypto.h>
#include <toolkit/x11.h>
#include <cmake.h>

Go to the source code of this file.

Data Structures

struct  keepalive_data_struct
 

Typedefs

typedef struct
keepalive_data_struct 
keepalive_data_struct
 

Functions

static void keepalive_reset (void)
 
static void keepalive_send (void)
 
void keepalive_ping_stats (void)
 
void socket_command_keepalive (uint8_t *data, size_t len, size_t pos)
 
static void init_game_data (void)
 
static int game_status_chain (void)
 
static void play_action_sounds (void)
 
void list_vid_modes (void)
 
static void sound_background_hook (void)
 
void clioption_settings_deinit (void)
 
static bool clioptions_option_server (const char *arg, char **errmsg)
 
static bool clioptions_option_metaserver (const char *arg, char **errmsg)
 
static bool clioptions_option_connect (const char *arg, char **errmsg)
 
static bool clioptions_option_nometa (const char *arg, char **errmsg)
 
static bool clioptions_option_text_debug (const char *arg, char **errmsg)
 
static bool clioptions_option_widget_render_debug (const char *arg, char **errmsg)
 
static bool clioptions_option_game_news_url (const char *arg, char **errmsg)
 
static bool clioptions_option_reconnect (const char *arg, char **errmsg)
 
int main (int argc, char *argv[])
 

Variables

SDL_Surface * ScreenSurface
 
struct sockaddr_in insock
 
client_socket_t csocket
 
server_structselected_server = NULL
 
uint32_t LastTick
 
texture_structcursor_texture
 
int cursor_x = -1
 
int cursor_y = -1
 
int map_redraw_flag
 
int minimap_redraw_flag
 
_anim_tableanim_table = NULL
 
Animationsanimations = NULL
 
size_t animations_num = 0
 
struct screensize * Screensize
 
_face_struct FaceList [MAX_FACE_TILES]
 
struct msg_anim_struct msg_anim
 
static uint32_t last_keepalive
 
clioption_settings_struct clioption_settings
 
static keepalive_data_structkeepalive_data
 Keepalive data.
 
static int keepalive_id
 UID for sending keepalives.
 
static int keepalive_ping
 Last keepalive ping time.
 
static int keepalive_ping_avg
 Average keepalive ping time.
 
static int keepalive_ping_num
 Number of keepalive pings.
 
static const char *const clioptions_option_server_desc
 
static const char *const clioptions_option_metaserver_desc
 
static const char *const clioptions_option_connect_desc
 
static const char * clioptions_option_nometa_desc
 
static const char * clioptions_option_text_debug_desc
 
static const char * clioptions_option_widget_render_debug_desc
 
static const char * clioptions_option_game_news_url_desc
 
static const char * clioptions_option_reconnect_desc
 

Detailed Description

Client main related functions.

Definition in file main.c.

Typedef Documentation

Used to keep track of keepalive commands.

Function Documentation

static bool clioptions_option_connect ( const char *  arg,
char **  errmsg 
)
static

Definition at line 514 of file main.c.

static bool clioptions_option_game_news_url ( const char *  arg,
char **  errmsg 
)
static

Definition at line 583 of file main.c.

static bool clioptions_option_metaserver ( const char *  arg,
char **  errmsg 
)
static

Definition at line 488 of file main.c.

static bool clioptions_option_nometa ( const char *  arg,
char **  errmsg 
)
static

Definition at line 540 of file main.c.

static bool clioptions_option_reconnect ( const char *  arg,
char **  errmsg 
)
static

Definition at line 598 of file main.c.

static bool clioptions_option_server ( const char *  arg,
char **  errmsg 
)
static

Definition at line 466 of file main.c.

static bool clioptions_option_text_debug ( const char *  arg,
char **  errmsg 
)
static

Definition at line 554 of file main.c.

static bool clioptions_option_widget_render_debug ( const char *  arg,
char **  errmsg 
)
static

Definition at line 569 of file main.c.

static int game_status_chain ( void  )
static

Game status chain.

Returns
1.

Definition at line 216 of file main.c.

static void init_game_data ( void  )
static

Initialize game data.

Definition at line 188 of file main.c.

void keepalive_ping_stats ( void  )

Display ping statistics.

Definition at line 148 of file main.c.

static void keepalive_reset ( void  )
static

Reset keepalive data.

Definition at line 108 of file main.c.

static void keepalive_send ( void  )
static

Send a keepalive packet.

Definition at line 128 of file main.c.

void list_vid_modes ( void  )

List video modes available.

Definition at line 404 of file main.c.

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

The main function.

Parameters
argcNumber of arguments.
argv[]Arguments.
Returns
0

Definition at line 614 of file main.c.

static void play_action_sounds ( void  )
static

Play various action sounds.

Definition at line 378 of file main.c.

void socket_command_keepalive ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 159 of file main.c.

static void sound_background_hook ( void  )
static

Hook for detecting background music changes.

Definition at line 421 of file main.c.

Variable Documentation

_anim_table* anim_table = NULL

The stored "anim commands" we created out of anims.tmp.

Definition at line 68 of file main.c.

size_t animations_num = 0

Number of animations.

Definition at line 71 of file main.c.

clioption_settings_struct clioption_settings

Command line option settings.

Definition at line 87 of file main.c.

const char* const clioptions_option_connect_desc
static
Initial value:
=
"Automatically connects to a server.\n\n"
"Usage:\n"
" --connect=<server>:<account>:<password>:<character>\n\n"
"Everything past the server is optional; you could for example only specify "
"the account, or specify everything but leave the password field empty to "
"still get a prompt for the password but still select the character "
"automatically."

Description of the –connect command.

Definition at line 504 of file main.c.

const char* clioptions_option_game_news_url_desc
static
Initial value:
=
"Sets the game news URL. Typically this doesn't need to be changed."

Description of the –game_news_url command.

Definition at line 579 of file main.c.

const char* const clioptions_option_metaserver_desc
static
Initial value:
=
"Adds a metaserver to the list of metaserver that will be tried.\n\n"
"Usage:\n"
" --metaserver=example.com"

Description of the –metaserver command.

Definition at line 482 of file main.c.

const char* clioptions_option_nometa_desc
static
Initial value:
=
"Do not query the metaserver."

Description of the –nometa command.

Definition at line 536 of file main.c.

const char* clioptions_option_reconnect_desc
static
Initial value:
=
"On disconnect, will automatically attempt to reconnect to the "
"server/account/etc as specified with --connect."

Description of the –reconnect command.

Definition at line 593 of file main.c.

const char* const clioptions_option_server_desc
static
Initial value:
=
"Adds a server to the list of servers.\n\n"
"Usage:\n"
" --server=example.com"

Description of the –server command.

Definition at line 460 of file main.c.

const char* clioptions_option_text_debug_desc
static
Initial value:
=
"Enable text API debugging (shows bounding boxes for text that uses them)."

Description of the –text_debug command.

Definition at line 550 of file main.c.

const char* clioptions_option_widget_render_debug_desc
static
Initial value:
=
"Enable widget rendering debugging (highlights widgets whenever they get "
"re-rendered)."

Description of the –widget_render_debug command.

Definition at line 564 of file main.c.

client_socket_t csocket

Client socket.

Definition at line 51 of file main.c.

Face data

Definition at line 77 of file main.c.

struct sockaddr_in insock

Server's attributes

Definition at line 49 of file main.c.

uint32_t last_keepalive
static

Last time we sent keepalive command.

Definition at line 82 of file main.c.

uint32_t LastTick

System time counter in ms since program start.

Definition at line 57 of file main.c.

struct msg_anim_struct msg_anim

The message animation structure.

Definition at line 80 of file main.c.

struct screensize* Screensize

Size of the screen.

Definition at line 74 of file main.c.

SDL_Surface* ScreenSurface

The main screen surface.

Definition at line 47 of file main.c.

server_struct* selected_server = NULL

Our selected server that we want to connect to.

Definition at line 54 of file main.c.