Using Windows code to play HMP files on Windows build; Fixed Jukebox keys in help screen; Allow -noredundancy in Singleplayer; Fixed processing of Console keys if Console is not active; Added Multiplayer hints to README; Made INI wrapping safer and more accurate

This commit is contained in:
zicodxx 2008-06-01 12:53:03 +00:00
parent decaf3cc6d
commit 885074607c
13 changed files with 89 additions and 31 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20080601
--------
include/args.h, main/inferno.c, main/hud.c, main/game.c, main/gamecntl.c, misc/args.c, d2x.ini, README.txt, arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/digi_audio.c, arch/win32/include/hmpfile.h, arch/win32/hmpfile.c: Using Windows code to play HMP files on Windows build; Fixed Jukebox keys in help screen; Allow -noredundancy in Singleplayer; Fixed processing of Console keys if Console is not active; Added Multiplayer hints to README; Made INI wrapping safer and more accurate
20080528
--------
arch/sdl/rbaudio.c, main/songs.c: allow an audio CD to be played if it's inserted after D1X is launched, hopefully find the first audio CD if multiple CDs are inserted

View file

@ -53,12 +53,22 @@ For example:
See INSTALL.txt.
3. Legal stuff
3. Multiplayer
DXX-Rebirth supports Multiplayer over (obsoleted) IPX and UDP/IP.
Using UDP/IP works over LAN and Internet. Since the Networking code of the Descent Engine is Peer-to-Peer, it is necessary for
all players (Host and Clients) to open port UDP 31017.
Clients can put an offset to this port by using '-ip_baseport OFFSET'.
Hosts can also use option '-ip_relay' to route players with closed ports. Use this with caution. It will increase Lag and Ping drastically.
UDP/IP also supports IPv6 by compiling the game with the designated flag. Please note IPv4- and IPv6-builds cannot play together.
4. Legal stuff
See COPYING.txt
4. Contact
5. Contact
http://www.dxx-rebirth.de/
zicodxx [at] yahoo [dot] de

View file

@ -431,11 +431,6 @@ void digi_audio_end_sound(int channel)
SoundSlots[channel].persistent = 0;
}
#ifdef _WIN32
hmp_file *hmp = NULL;
static int digi_midi_song_playing = 0;
#endif
// MIDI stuff follows.
void digi_audio_set_midi_volume( int mvolume )
{

View file

@ -33,6 +33,10 @@
#include "gr.h" // needed for piggy.h
#include "piggy.h"
#ifdef _WIN32
#include "hmpfile.h"
#endif
#define MIX_DIGI_DEBUG 0
#define MIX_OUTPUT_FORMAT AUDIO_S16
#define MIX_OUTPUT_CHANNELS 2
@ -182,6 +186,23 @@ void digi_mixer_set_digi_volume( int dvolume )
}
void digi_mixer_set_midi_volume( int mvolume ) {
#ifdef _WIN32
int mm_volume;
if (mvolume < 0)
midi_volume = 0;
else if (mvolume > 127)
midi_volume = 127;
else
midi_volume = mvolume;
// scale up from 0-127 to 0-0xffff
mm_volume = (midi_volume << 1) | (midi_volume & 1);
mm_volume |= (mm_volume << 8);
if (hmp)
midiOutSetVolume((HMIDIOUT)hmp->hmidi, mm_volume | mm_volume << 16);
#endif
midi_volume = mvolume;
if (!digi_initialised) return;
mix_set_music_volume(mvolume);
@ -223,9 +244,21 @@ void digi_mixer_play_midi_song(char * filename, char * melodic_bank, char * drum
// use jukebox
jukebox_play(loop);
}
else {
else {
// standard song playback
mix_play_music(filename, loop);
#ifdef _WIN32
if (!GameArg.SndExternalMusic)
{
if ((hmp = hmp_open(filename)))
{
hmp_play(hmp,loop);
digi_midi_song_playing = 1;
digi_set_midi_volume(midi_volume);
}
}
else
#endif
mix_play_music(filename, loop);
}
}
@ -235,6 +268,14 @@ int digi_mixer_music_exists(const char *filename)
}
void digi_mixer_stop_current_song() {
#ifdef _WIN32
if (digi_midi_song_playing)
{
hmp_close(hmp);
hmp = NULL;
digi_midi_song_playing = 0;
}
#endif
jukebox_stop(); //stops jukebox as well as standard music
}

View file

@ -94,10 +94,10 @@ void mix_play_music(char *filename, int loop) {
// What is the extension of external files? If none, default to internal MIDI
if (GameArg.SndExternalMusic) {
sprintf(rel_filename, "%s/%s.%3s", basedir, music_title, GameArg.SndExternalMusic); // add extension
snprintf(rel_filename, strlen(basedir)+strlen(music_title)+6, "%s/%s.%s", basedir, music_title, GameArg.SndExternalMusic); // add extension
}
else {
sprintf(rel_filename, "%s/%s.mid", basedir, music_title);
snprintf(rel_filename, strlen(basedir)+strlen(music_title)+6, "%s/%s.mid", basedir, music_title);
convert_hmp(filename, rel_filename);
}

View file

@ -15,6 +15,8 @@
#endif
extern void PumpMessages(void);
hmp_file *hmp = NULL;
int digi_midi_song_playing = 0;
hmp_file *hmp_open(const char *filename) {
int i;

View file

@ -51,4 +51,7 @@ hmp_file *hmp_open(const char *filename);
int hmp_play(hmp_file *hmp, int bLoop);
void hmp_close(hmp_file *hmp);
extern hmp_file *hmp;
extern int digi_midi_song_playing;
#endif

View file

@ -12,6 +12,7 @@
;-autodemo Start in demo mode
;-notitles Skip title screens
;-window Run the game in a window
;-noredundancy Do not send messages when picking up redundant items
Controls:
@ -36,7 +37,6 @@
Multiplayer:
;-mprofile Enable multiplayer game profiles
;-noredundancy Do not send messages when picking up redundant items in multiplayer
;-playermessages View only messages from other players in multi - overrides -noredundancy
;-ipxnetwork <n> Use IPX network number <n>
;-ip_baseport <n> Use <p> as offset from normal port

View file

@ -52,6 +52,7 @@ typedef struct Arg
int SysWindow;
int SysAutoDemo;
int SysNoTitles;
int SysNoRedundancy;
int CtlNoMouse;
int CtlNoJoystick;
int CtlMouselook;
@ -67,7 +68,6 @@ typedef struct Arg
#endif
int EdiNoBm;
int MplGameProfile;
int MplNoRedundancy;
int MplPlayerMessages;
const char *MplIpxNetwork;
int MplIpBasePort;

View file

@ -1414,8 +1414,8 @@ void show_help()
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_1TO5;
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_6TO10;
#ifdef USE_SDLMIXER
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "Shift-F9/F10\t Play/Pause Jukebox";
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "Shift-F11/F12\t Previous/Next Song";
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "Alt-Shift-F9/F10\t Play/Pause Jukebox";
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "Alt-Shift-F11/F12\t Previous/Next Song";
#endif
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "";
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "MULTIPLAYER:";
@ -2508,11 +2508,9 @@ void ReadControls()
#endif
while ((key=key_inkey_time(&key_time)) != 0) {
if (con_events(key))
{
if (con_events(key) && con_render)
game_flush_inputs();
continue;
}
if (Player_is_dead)
HandleDeathKey(key);

View file

@ -163,7 +163,7 @@ int HUD_init_message_va(char * format, va_list args)
// Added by Leighton
if ((Game_mode & GM_MULTI) && GameArg.MplNoRedundancy)
if (GameArg.SysNoRedundancy)
if (!strnicmp ("You already",message,11) || !stricmp("your laser is maxed out!",message))
return 0;

View file

@ -148,6 +148,7 @@ void show_commandline_help()
printf( " -autodemo %s\n", "Start in demo mode");
printf( " -notitles %s\n", "Skip title screens");
printf( " -window %s\n", "Run the game in a window");
printf( " -noredundancy %s\n", "Do not send messages when picking up redundant items");
printf( "\n Controls:\n\n");
printf( " -nomouse %s\n", "Deactivate mouse");
@ -173,7 +174,6 @@ void show_commandline_help()
#ifdef NETWORK
printf( "\n Multiplayer:\n\n");
printf( " -mprofile %s\n", "Enable multiplayer game profiles");
printf( " -noredundancy %s\n", "Do not send messages when picking up redundant items in multiplayer");
printf( " -playermessages %s\n", "View only messages from other players in multi - overrides -noredundancy");
printf( " -ipxnetwork <n> %s\n", "Use IPX network number <n>");
printf( " -ip_baseport <n> %s\n", "Use <n> as offset from normal port (allows multiple instances of d1x to be run on a single computer)");

View file

@ -85,7 +85,8 @@ int FindResArg(char *prefix, int *sw, int *sh)
void AppendIniArgs(void)
{
PHYSFS_file *f;
char *line,*word;
char *line, *token;
char separator[] = " ";
f = PHYSFSX_openReadBuffered(INI_FILENAME);
@ -93,14 +94,18 @@ void AppendIniArgs(void)
while(!PHYSFS_eof(f) && Num_args < MAX_ARGS)
{
line=fgets_unlimited(f);
word=splitword(line,' ');
Args[Num_args++] = d_strdup(word);
if(line)
Args[Num_args++] = d_strdup(line);
d_free(line); d_free(word);
token = strtok(line, separator); /* first token in current line */
if (token)
Args[Num_args++] = d_strdup(token);
while( token != NULL )
{
token = strtok(NULL, separator); /* next tokens in current line */
if (token)
Args[Num_args++] = d_strdup(token);
}
d_free(line);
}
PHYSFS_close(f);
}
@ -142,6 +147,7 @@ void ReadCmdArgs(void)
GameArg.SysWindow = FindArg("-window");
GameArg.SysNoTitles = FindArg("-notitles");
GameArg.SysAutoDemo = FindArg("-autodemo");
GameArg.SysNoRedundancy = FindArg("-noredundancy");
// Control Options
@ -174,7 +180,6 @@ void ReadCmdArgs(void)
// Multiplayer Options
GameArg.MplGameProfile = FindArg("-mprofile");
GameArg.MplNoRedundancy = FindArg("-noredundancy");
GameArg.MplPlayerMessages = FindArg("-playermessages");
GameArg.MplIpxNetwork = get_str_arg("-ipxnetwork", NULL);
GameArg.MplIpBasePort = get_int_arg("-ip_baseport", 0);