File: multi_pxo.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (173 lines) | stat: -rw-r--r-- 5,274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Copyright (C) Volition, Inc. 2005.  All rights reserved.
 * 
 * All source code herein is the property of Volition, Inc. You may not sell 
 * or otherwise commercially exploit the source or things you created based on the 
 * source.
 *
*/



#ifndef _PARALLAX_ONLINE_HEADER_FILE
#define _PARALLAX_ONLINE_HEADER_FILE

#include "playerman/player.h"

// ----------------------------------------------------------------------------------------------------
// PXO DEFINES/VARS
//

#define MAX_PXO_TEXT_LEN 255

// default url for PXO rankings
//#define MULTI_PXO_RANKINGS_URL				"http://www.volition-inc.com"
#define MULTI_PXO_RANKINGS_URL				"http://www.pxo.net/rankings/fs2full.cfm"


// default url for PXO account creation
//#define MULTI_PXO_CREATE_URL				"http://www.parallaxonline.com/register.html"
#define MULTI_PXO_CREATE_URL					"http://www.pxo.net/newaccount.cfm"

// default url for PXO account verification
//#define MULTI_PXO_VERIFY_URL				"http://www.parallaxonline.com/verify.html"
#define MULTI_PXO_VERIFY_URL					"http://www.pxo.net/verify.cfm"

// default url for PXO banners
#define MULTI_PXO_BANNER_URL					"http://www.pxo.net/files/banners"

// tracker and PXO addresses
#define MULTI_PXO_USER_TRACKER_IP		"ut.pxo.net"
#define MULTI_PXO_GAME_TRACKER_IP		"gt.pxo.com"
#define MULTI_PXO_CHAT_IP					"chat.pxo.net"

// channel related stuff -------------------------------------------
#define MAX_CHANNEL_NAME_LEN 32
#define MAX_CHANNEL_DESCRIPT_LEN 120

typedef struct pxo_channel {
	char name[MAX_CHANNEL_NAME_LEN + 1];     // name
	char desc[MAX_CHANNEL_DESCRIPT_LEN + 1]; // description
	short num_users;                         // # users, or -1 if not in use
	short num_servers;                       // the # of servers registered on this channel
} pxo_channel;

extern SCP_vector<pxo_channel> Multi_pxo_channels;

// channel we're currently connected to, num_users == -1, if we're not connected
extern pxo_channel Multi_pxo_channel_current;

// player related stuff -------------------------------------------
#define MAX_CHAT_LINES 500 //Abritrary size limit. After this number, old messages are removed from the start of the chat vector
#define MAX_PLAYER_NAME_LEN 32

extern SCP_vector<SCP_string> Multi_pxo_players;

// chat related stuff ----------------------------------------------
#define MAX_CHAT_LINE_LEN 256

// chat flags
#define CHAT_MODE_NORMAL 0         // normal chat from someone
#define CHAT_MODE_SERVER 1         // is from the server, display appropriately
#define CHAT_MODE_CARRY 2          // is a carryover from a previous line
#define CHAT_MODE_PRIVATE 3        // is a private message
#define CHAT_MODE_CHANNEL_SWITCH 4 // "switching channels" message - draw in red
#define CHAT_MODE_MOTD 5           // message of the day from the chat server

typedef struct chat_line {
	char text[MAX_CHAT_LINE_LEN + 1];
	int mode;
} chat_line;

extern SCP_list<chat_line> Multi_pxo_chat;

// banner related stuff --------------------------------------------
// banners
typedef struct pxo_banner {
	SCP_string ban_file;     // base filename of the banner
	SCP_string ban_file_url; // full url of the file to get (convenient)
	SCP_string ban_url;      // url to go to when clicked
	int ban_bitmap;          // banner bitmap
} pxo_banner;

// active pxo banner
extern pxo_banner Multi_pxo_banner;

// help page related stuff -----------------------------------------
#define MULTI_PXO_MAX_LINES_PP 57
#define MULTI_PXO_MAX_PAGES 5

// help text pages
typedef struct help_page {
	char* text[MULTI_PXO_MAX_LINES_PP];
	int num_lines;
} help_page;

extern help_page Multi_pxo_help_pages[MULTI_PXO_MAX_PAGES];

// Globals for the UI API

extern player Multi_pxo_pinfo_player;

// if we're connected
extern int Multi_pxo_connected;

// the status text itself
extern char Multi_pxo_status_text[MAX_PXO_TEXT_LEN];

// the motd text itself
extern char Pxo_motd[1024];

// ----------------------------------------------------------------------------------------------------
// PXO FUNCTIONS
//

// initialize the PXO screen
void multi_pxo_init(int use_last_channel, bool api_access = false);

// do frame for the PXO screen
void multi_pxo_do();

// close the PXO screen
void multi_pxo_close(bool api_access = false);

// initialize the PXO help screen
void multi_pxo_help_init();

// load the help file up
void multi_pxo_help_load();

// free the help text from memory
void multi_pxo_help_free();

// do frame for PXO help
void multi_pxo_help_do();

// close the pxo screen
void multi_pxo_help_close();

// open up a URL
void multi_pxo_url(const char *url);

// called from the game tracker API - server count update for a channel
void multi_pxo_channel_count_update(char *name,int count);

// run the networking api
void multi_pxo_api_process();

// run normally (no popups)
void multi_pxo_do_normal(bool api_access = false);

// process the various network list items
void multi_pxo_process_common(bool api_access = false);

// send a chat string to the current pxo channel
void multi_pxo_chat_send(const char* msg);

// try to join a channel
void multi_pxo_maybe_join_channel(pxo_channel* chan);

// public method to get a player's info. Returns true if successful, false otherwise
bool multi_pxo_maybe_get_player(const char* name);

#endif