Code-cleanup; Implemented new multi profile feature

This commit is contained in:
zicodxx 2007-09-20 14:22:57 +00:00
parent 7c2945b5b8
commit 9eb7dfc112
11 changed files with 405 additions and 589 deletions

View file

@ -1,7 +1,12 @@
D2X-Rebirth Changelog
20070918
--------
20070920
--------
d2x.ini, SConstruct, include/args.h, main/newmenu.c, main/network.c, main/multi.c, main/network.h, main/multi.h, main/inferno.c, misc/args.c: Code-cleanup; Implemented new multi profile feature
20070918
--------
SConstruct, main/inferno.c, main/digi.h, arch/sdl/include/digi_audio.h, arch/sdl/include/digi_mixer_music.h, arch/sdl/include/digi_mixer.h, arch/sdl/digi.c, arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/digi_audio.c : huge refactoring of sound system using function pointers, to allow sound backend selection at runtime and provide a common interface (digi.c)
include/args.h, main/args.c : handle SDL_mixer-specific args
arch/sdl/jukebox.c, arch/sdl/jukebox.c, include/dl_list.h, misc/dl_list.c : added jukebox functionality

View file

@ -130,6 +130,7 @@ common_sources = [
'main/mission.c',
'main/morph.c',
'main/movie.c',
'main/mprofile.c',
'main/multi.c',
'main/multibot.c',
'main/netmisc.c',

View file

@ -48,13 +48,13 @@
Multiplayer:
;-mprofile Enable multiplayer game profiles
;-norankings Disable multiplayer ranking system
;-noredundancy Do not send messages when picking up redundant items in multi
;-playermessages View only messages from other players in multi - overrides -noredundancy
;-packets <n> Specifies the number of packets per second
;-ipxnetwork <n> Use IPX network number <n>
;-ip_hostaddr <n> Use <n> as host ip address
;-ip_nogetmyaddr Prevent autodetection of local ip address
;-ip_myaddr <n> Use <a> as local ip address
;-ip_bind_addr <n> Bind to <a> instead of INADDR_ANY
;-ip_baseport <n> Use <p> as offset from normal port (allows multiple instances of d1x to be run on a single computer)
;-ip_baseport <n> Use <p> as offset from normal port

View file

@ -79,11 +79,12 @@ typedef struct Arg
int OglVoodooHack;
int OglFixedFont;
#endif
int MplGameProfile;
int MplNoRankings;
int MplNoRedundancy;
int MplPlayerMessages;
int MplPacketsPerSec;
const char *MplIpxNetwork;
int MplIPXSocketOffset;
char *MplIpHostAddr;
int MplIpNoGetMyAddr;
char *MplIpMyAddr;

View file

@ -197,15 +197,16 @@ void print_commandline_help()
#ifdef NETWORK
printf( "\n Multiplayer:\n\n");
printf( " -mprofile %s\n", "Enable multiplayer game profiles");
printf( " -norankings %s\n", "Disable multiplayer ranking system");
printf( " -noredundancy %s\n", "Do not send messages when picking up redundant items in multi");
printf( " -playermessages %s\n", "View only messages from other players in multi - overrides -noredundancy");
printf( " -packets <n> %s\n", "Specifies the number of packets per second\n");
printf( " -ipxnetwork <n> %s\n", "Use IPX network number <n>");
printf( " -ipxbasesocket <n> %s\n", "Use <n> as offset from normal IPX socket");
printf( " -ip_hostaddr <n> %s\n", "Use <n> as host ip address");
printf( " -ip_nogetmyaddr %s\n", "Prevent autodetection of local ip address");
printf( " -ip_myaddr <n> %s\n", "Use <a> as local ip address");
printf( " -ip_baseport <n> %s\n", "Use <p> as offset from normal port (allows multiple instances of d1x to be run on a single computer)");
printf( " -ip_myaddr <n> %s\n", "Use <n> as local ip address");
printf( " -ip_baseport <n> %s\n", "Use <n> as offset from normal port");
#endif // NETWORK
#ifdef EDITOR

View file

@ -118,7 +118,6 @@ extern char MarkerMessage[16][40];
extern char MarkerOwner[16][40];
extern int MarkerObject[];
int control_invul_time = 0;
int who_killed_controlcen = -1; // -1 = noone
//do we draw the kill list on the HUD?

View file

@ -238,8 +238,6 @@ extern void multi_send_orb_bonus( char pnum );
extern void multi_send_got_orb( char pnum );
extern void multi_add_lifetime_kills(void);
extern int control_invul_time;
#define N_PLAYER_SHIP_TEXTURES 6
extern bitmap_index multi_player_textures[MAX_NUM_NET_PLAYERS][N_PLAYER_SHIP_TEXTURES];

File diff suppressed because it is too large Load diff

View file

@ -54,6 +54,55 @@ extern int Network_game_type;
#define Network_game_type IPX_GAME
#endif
/* the following are the possible packet identificators.
* they are stored in the "type" field of the packet structs.
* they are offset 4 bytes from the beginning of the raw IPX data
* because of the "driver's" ipx_packetnum (see linuxnet.c).
*/
#define PID_LITE_INFO 43 // 0x2B lite game info
#define PID_SEND_ALL_GAMEINFO 44 // 0x2C plz send more than lite only
#define PID_PLAYERSINFO 45 // 0x2D here's my name & personal data
#define PID_REQUEST 46 // 0x2E may i join, plz send sync
#define PID_SYNC 47 // 0x2F master says: enter mine now!
#define PID_PDATA 48 // 0x30
#define PID_ADDPLAYER 49
#define PID_DUMP 51 // 0x33 you can't join this game
#define PID_ENDLEVEL 52
#define PID_QUIT_JOINING 54
#define PID_OBJECT_DATA 55 // array of bots, players, powerups, ...
#define PID_GAME_LIST 56 // 0x38 give me the list of your games
#define PID_GAME_INFO 57 // 0x39 here's a game i've started
#define PID_PING_SEND 58
#define PID_PING_RETURN 59
#define PID_GAME_UPDATE 60 // inform about new player/team change
#define PID_ENDLEVEL_SHORT 61
#define PID_NAKED_PDATA 62
#define PID_GAME_PLAYERS 63
#define PID_NAMES_RETURN 64 // 0x40
// new packet types to get a little bit more information about the netgame so we can show up some rules/flags - uses netgame_info instead of lite_info
#define PID_LITE_INFO_D2X 65 // like PID_LITE_INFO
#define PID_GAME_LIST_D2X 66 // like PID_GAME_LIST
#define NETGAME_ANARCHY 0
#define NETGAME_TEAM_ANARCHY 1
#define NETGAME_ROBOT_ANARCHY 2
#define NETGAME_COOPERATIVE 3
#define NETGAME_CAPTURE_FLAG 4
#define NETGAME_HOARD 5
#define NETGAME_TEAM_HOARD 6
/* The following are values for NetSecurityFlag */
#define NETSECURITY_OFF 0
#define NETSECURITY_WAIT_FOR_PLAYERS 1
#define NETSECURITY_WAIT_FOR_GAMEINFO 2
#define NETSECURITY_WAIT_FOR_SYNC 3
/* The NetSecurityNum and the "Security" field of the network structs
* identifies a netgame. It is a random number chosen by the network master
* (the one that did "start netgame").
*/
typedef struct sequence_packet {
ubyte type;
int Security;

View file

@ -1917,7 +1917,7 @@ int newmenu_get_filename(char *title, char *type, char *filename, int allow_abor
int i;
char **find;
char **f;
char *ext;
char *ext, filespec[3]="";
int NumFiles=0, key,done, citem, ocitem;
char * filenames = NULL;
int NumFiles_displayed = 8;
@ -1953,6 +1953,8 @@ int newmenu_get_filename(char *title, char *type, char *filename, int allow_abor
else if (!stricmp(type, "dem"))
demo_mode = 1;
sprintf(filespec,".%s",type);
ReadFileNames:
done = 0;
NumFiles=0;
@ -1967,12 +1969,12 @@ ReadFileNames:
find = PHYSFS_enumerateFiles(demo_mode ? DEMO_DIR : ((player_mode && GameArg.SysUsePlayersDir) ? "Players/" : ""));
for (f = find; *f != NULL; f++)
{
if (player_mode)
{
// if (player_mode)
// {
ext = strrchr(*f, '.');
if (!ext || strnicmp(ext, ".plr", 4))
if (!ext || strnicmp(ext, filespec, 4))
continue;
}
// }
if (NumFiles < MAX_FILES)
{
strncpy(&filenames[NumFiles*14], *f, FILENAME_LEN);

View file

@ -321,6 +321,11 @@ void ReadCmdArgs(void)
// Multiplayer Options
if (FindArg("-mprofile"))
GameArg.MplGameProfile = 1;
else
GameArg.MplGameProfile = 0;
if (FindArg("-norankings"))
GameArg.MplNoRankings = 1;
else
@ -336,16 +341,16 @@ void ReadCmdArgs(void)
else
GameArg.MplPlayerMessages = 0;
if ((t=FindArg("-packets")))
GameArg.MplPacketsPerSec = atoi(Args[t+1]);
else
GameArg.MplPacketsPerSec = 10;
if ((t=FindArg("-ipxnetwork")) && Args[t+1])
GameArg.MplIpxNetwork = Args[t+1];
else
GameArg.MplIpxNetwork = NULL;
if ((t=FindArg("-ipxbasesocket")) && Args[t+1])
GameArg.MplIPXSocketOffset = atoi(Args[t+1]);
else
GameArg.MplIPXSocketOffset = 0;
if ((t=FindArg("-ip_hostaddr")))
GameArg.MplIpHostAddr = Args[t+1];
else