File: multiui.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 (211 lines) | stat: -rw-r--r-- 8,192 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
 * Copyright (C) Volition, Inc. 1999.  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 MULTI_UI_H
#define MULTI_UI_H

#include "globalincs/globals.h"
#include "ui/ui.h"
#include "network/multi.h"


struct net_player;
struct net_addr;

void multi_common_add_text(const char *txt,int auto_scroll = 0);
void multi_common_set_text(const char *str,int auto_scroll = 0);
void multi_mission_desciption_set(const char* str_in, int index);

// time between sending refresh packets to known servers
#define MULTI_JOIN_REFRESH_TIME			45000			
#define MULTI_JOIN_REFRESH_TIME_LOCAL	5000
// this time must be longer than the MULTI_JOIN_REFRESH_TIME but shorter than twice the MULTI_JOIN_REFRESH_TIME
// so that it does not time out between refresh times, but cannot last more than 2 complete refreshed without
// timing out. Just trust me - DB
#define MULTI_JOIN_SERVER_TIMEOUT			(MULTI_JOIN_REFRESH_TIME + (MULTI_JOIN_REFRESH_TIME /2))
#define MULTI_JOIN_SERVER_TIMEOUT_LOCAL	(MULTI_JOIN_REFRESH_TIME_LOCAL + (MULTI_JOIN_REFRESH_TIME_LOCAL / 2))


typedef struct multi_create_info {
	char		filename[MAX_FILENAME_LEN];	// filename of the mission
	char		name[NAME_LENGTH];				// name of the mission
	int		flags;								// flags to tell what type of multiplayer game (coop, team v. team)
	uint     respawn;								//	mission specified respawn count
	ubyte		max_players;						// max players allowed for this file	
	char		valid_status;						// see MVALID_* defines above

	multi_create_info( )
		: flags( 0 ), respawn( 0 ), max_players( 0 ), valid_status( MVALID_STATUS_UNKNOWN )
	{
		filename[ 0 ] = 0;
		name[ 0 ] = 0;
	}
} multi_create_info;

// load all common icons
#define MULTI_NUM_COMMON_ICONS		12
#define MICON_VOICE_DENIED				0
#define MICON_VOICE_RECORDING			1
#define MICON_TEAM0						2
#define MICON_TEAM0_SELECT				3
#define MICON_TEAM1						4
#define MICON_TEAM1_SELECT				5
#define MICON_COOP						6
#define MICON_TVT							7
#define MICON_DOGFIGHT					8
#define MICON_VOLITION					9
#define MICON_VALID						10
#define MICON_CD							11

// text related defines
#define MULTI_COMMON_TEXT_META_CHAR '$'
#define MULTI_COMMON_TEXT_MAX_LINE_LENGTH 200
#define MULTI_COMMON_TEXT_MAX_LINES 20
#define MULTI_COMMON_MAX_TEXT (MULTI_COMMON_TEXT_MAX_LINES * MULTI_COMMON_TEXT_MAX_LINE_LENGTH)

// common icon stuff
extern int Multi_common_icons[MULTI_NUM_COMMON_ICONS];
extern int Multi_common_icon_dims[MULTI_NUM_COMMON_ICONS][2];
void multi_load_common_icons();
void multi_unload_common_icons();

extern const int MULTI_PING_MIN_RED; // for MULTI_LAG_VAL in multiutil.cpp

// initialize/display all bitmaps, etc related to displaying the voice system status
void multi_common_voice_display_status();

// multiplayer screen common palettes
void multi_common_load_palette();
void multi_common_set_palette();
void multi_common_unload_palette();

// variables to hold the mission and campaign lists
extern SCP_vector<multi_create_info> Multi_create_mission_list;
extern SCP_vector<multi_create_info> Multi_create_campaign_list;

extern int Multi_create_overlay_id;

void multi_create_list_load_missions();
void multi_create_list_load_campaigns();

// check if a mission is built-in from volition
bool multi_is_item_builtin_volition(const char*);

// returns an index into Multi_create_mission_list
int multi_create_lookup_mission(char *fname);

// returns an index into Multi_create_campaign_list
int multi_create_lookup_campaign(char *fname);

extern int Multi_sg_overlay_id;

void multi_sg_rank_build_name(const char *in,char *out);

extern int Multi_join_overlay_id;

extern char Multi_common_notify_text[200];
extern char Multi_common_all_text[MULTI_COMMON_MAX_TEXT];
extern UI_TIMESTAMP Multi_join_sent_stamp;
extern int Multi_join_should_send;
extern active_game* Multi_join_selected_item;

void multi_join_game_init(bool API_Access = false);
void multi_join_game_close(bool API_Access = false);
void multi_join_game_do_frame(bool API_Access = false);
void multi_join_eval_pong(net_addr *addr, fix pong_time);
void multi_join_reset_join_stamp();
void multi_join_clear_game_list();
void multi_join_notify_new_game();
void multi_join_send_join_request(int as_observer);
void multi_join_create_game();
void multi_join_maybe_update_selected(active_game* game);
void multi_join_game_set_status_text(active_game* game, SCP_string& status_text);
void multi_join_game_set_speed_text(active_game* game, int& con_type, SCP_string& speed_text);

int multi_join_warn_pxo();

extern netgame_info* Multi_sg_netgame;

void multi_start_game_init(bool API_Access = false);
void multi_start_game_do(bool API_Access = false);
void multi_start_game_close(bool API_Access = false);

void multi_create_game_init(bool API_Access = false);
void multi_create_game_do(bool API_Access = false);
void multi_create_game_close();
void multi_create_game_add_mission(char *fname,char *name, int flags);
void multi_create_list_set_item(int abs_index, int mode);
void multi_create_accept_hit(int mode, int select_index);
int multi_create_ok_to_commit(int select_index);

#define MULTI_CREATE_SHOW_MISSIONS			0
#define MULTI_CREATE_SHOW_CAMPAIGNS			1
void multi_create_setup_list_data(int mode);

void multi_create_handle_join(net_player *pl);

void multi_jw_handle_join(net_player *pl);

// maximum values for various input boxes (to notify user of overruns)
#define MULTI_HO_MAX_TIME_LIMIT 500
#define MULTI_HO_MAX_TOKEN_WAIT 5
#define MULTI_HO_MAX_KILL_LIMIT 9999
#define MULTI_HO_MAX_OBS 4

void multi_host_options_init();
void multi_host_options_do();
void multi_host_options_close();
void multi_ho_set_skill_level(int skill);
int multi_ho_get_skill_level();
void multi_ho_apply_options();

void multi_game_client_setup_init(bool API_Access = false);
void multi_game_client_setup_do_frame(bool API_Access = false);
void multi_game_client_setup_close();

#define MULTI_SYNC_PRE_BRIEFING		0		// moving from the join to the briefing stage
#define MULTI_SYNC_POST_BRIEFING		1		// moving from the briefing to the gameplay stage
#define MULTI_SYNC_INGAME				2		// ingame joiners data sync
extern int Multi_sync_mode;					// should always set this var before calling GS_EVENT_MULTI_MISSION_SYNC
extern int Multi_sync_countdown;				// time in seconds until the mission is going to be launched
void multi_sync_init(bool API_Access = false);
void multi_sync_do(bool API_Access = false);
void multi_sync_close(bool API_Access = false);
void multi_sync_start_countdown();			// start the countdown to launch when the launch button is pressed
SCP_string multi_sync_get_state_string(net_player* player);

// note : these functions are called from within missiondebrief.cpp - NOT from freespace.cpp
void multi_debrief_init();
void multi_debrief_do_frame();
void multi_debrief_close();
void multi_debrief_accept_hit();						// handle the accept button being hit
void multi_debrief_esc_hit();							// handle the ESC button being hit
void multi_debrief_replay_hit();						// handle the replay button being hit
void multi_debrief_server_left();					// call this when the server has left and we would otherwise be saying "contact lost with server"
void multi_debrief_stats_accept();					// call this to insure that stats are not undone when we leave the debriefing
void multi_debrief_stats_toss();						// call this to "toss" the stats packet
int multi_debrief_stats_accept_code();				// call this to determine the status of multiplayer stats acceptance
void multi_debrief_server_process();				// process all details regarding moving the netgame to its next state

// add a notification string, drawing appropriately depending on the state/screen we're in
void multi_common_add_notify(const char *str);

// bring up the password string popup, fill in passwd (return 1 if accept was pressed, 0 if cancel was pressed)
int multi_passwd_popup(char *passwd);

// read the list of IPs from the ip file
void multi_join_read_ip_address_file(SCP_list<SCP_string> &list);

// write the list of IPs to the ip file
bool multi_join_write_ip_address_file(SCP_list<SCP_string>& list);


#endif