- Fixed: The VC++ project was not set up to redefine RM using del in

wadsrc/Makefile, nor did it use the makefile for cleaning.
- Added ST_NetMessage() for mixing miscellaneous messages with the network
  startup meter, since they get mixed in the same space on the Linux terminal
  and must be handled properly to avoid looking bad.


SVN r429 (trunk)
This commit is contained in:
Randy Heit 2006-12-29 02:21:47 +00:00
parent 4899fa91f1
commit ff65f75a8c
6 changed files with 319 additions and 169 deletions

View file

@ -1,6 +1,11 @@
December 28, 2006
- Fixed the new network status display for the Linux terminal.
December 28, 2006
- Fixed: The VC++ project was not set up to redefine RM using del in
wadsrc/Makefile, nor did it use the makefile for cleaning.
- Added ST_NetMessage() for mixing miscellaneous messages with the network
startup meter, since they get mixed in the same space on the Linux terminal
and must be handled properly to avoid looking bad.
- Fixed the new network status display for the Linux terminal.
December 25, 2006 (Changes by Graf Zahl)
- Converted the Communicator to DECORATE.
- Renamed the new armor properties to use the same names as Skulltag to avoid
@ -34,6 +39,9 @@ December 23, 2006 (Changes by Graf Zahl)
flags and the BlastRadius code doesn't set MF2_SLIDE anymore.
December 22, 2006
- Fixed: If anyone other than the most recently-connected player aborted
during i_net handshaking, everybody who connected after them would have
the wrong idea of what their player number was.
- Guests can now watch as other guests connect during i_net handshaking.
- Fixed: The host would let more than the desired number of players connect.
- Decreased the frequency of packets in ST_NetLoop() to two per second.

View file

@ -70,8 +70,6 @@
#define NOVTABLE
#endif
typedef long long __int64;
#ifdef _MSC_VER
typedef __int8 SBYTE;
typedef unsigned __int8 BYTE;

View file

@ -1,106 +1,158 @@
/*
** st_start.cpp
** Handles the startup screen.
**
**---------------------------------------------------------------------------
** Copyright 2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <termios.h>
#include "st_start.h"
/*
** st_start.cpp
** Handles the startup screen.
**
**---------------------------------------------------------------------------
** Copyright 2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <termios.h>
#include "st_start.h"
#include "doomdef.h"
#include "i_system.h"
static termios OldTermIOS;
static bool DidNetInit;
#include "i_system.h"
static termios OldTermIOS;
static bool DidNetInit;
static int NetProgressMax, NetProgressTicker;
static const char *NetMessage;
static char SpinnyProgressChars[8] = { '|', '/', '-', '\\', '|', '/', '-', '\\' };
static const char *NetMessage;
static char SpinnyProgressChars[8] = { '|', '/', '-', '\\', '|', '/', '-', '\\' };
//===========================================================================
//
// ST_Init
//
// Sets the size of the progress bar and displays the startup screen.
//
//===========================================================================
void ST_Init(int maxProgress)
{
}
void ST_Init(int maxProgress)
{
}
//===========================================================================
//
// ST_Done
//
// Called just before entering graphics mode to deconstruct the startup
// screen.
//
//===========================================================================
void ST_Done()
{
}
void ST_Done()
{
}
//===========================================================================
//
// ST_Progress
//
// Bumps the progress meter one notch.
//
//===========================================================================
void ST_Progress()
{
}
void ST_Progress()
{
}
//===========================================================================
//
// ST_NetInit
//
// Sets stdin for unbuffered I/O, displays the given message, and shows
// a progress meter.
//
//===========================================================================
void ST_NetInit(const char *message, int numplayers)
void ST_NetInit(const char *message, int numplayers)
{
if (!DidNetInit)
{
termios rawtermios;
fprintf (stderr, "Press 'Q' to abort network game synchronization.");
// Set stdin to raw mode so we can get keypresses in ST_CheckNetAbort()
// immediately without waiting for an EOL.
tcgetattr (STDIN_FILENO, &OldTermIOS);
termios rawtermios;
fprintf (stderr, "Press 'Q' to abort network game synchronization.");
// Set stdin to raw mode so we can get keypresses in ST_CheckNetAbort()
// immediately without waiting for an EOL.
tcgetattr (STDIN_FILENO, &OldTermIOS);
rawtermios = OldTermIOS;
rawtermios.c_lflag &= ~(ICANON | ECHO);
rawtermios.c_lflag &= ~(ICANON | ECHO);
tcsetattr (STDIN_FILENO, TCSANOW, &rawtermios);
DidNetInit = true;
atterm (ST_NetDone);
atterm (ST_NetDone);
}
if (numplayers == 1)
{
// Status message without any real progress info.
fprintf (stderr, "\n%s.", message);
}
else
{
fprintf (stderr, "\n%s: ", message);
if (numplayers == 1)
{
// Status message without any real progress info.
fprintf (stderr, "\n%s.", message);
}
fflush (stderr);
NetMessage = message;
NetProgressMax = numplayers;
NetProgressTicker = 0;
ST_NetProgress(1); // You always know about yourself
}
void ST_NetDone()
{
else
{
fprintf (stderr, "\n%s: ", message);
}
fflush (stderr);
NetMessage = message;
NetProgressMax = numplayers;
NetProgressTicker = 0;
ST_NetProgress(1); // You always know about yourself
}
//===========================================================================
//
// ST_NetDone
//
// Restores the old stdin tty settings.
//
//===========================================================================
void ST_NetDone()
{
// Restore stdin settings
if (DidNetInit)
{
tcsetattr (STDIN_FILENO, TCSANOW, &OldTermIOS);
{
tcsetattr (STDIN_FILENO, TCSANOW, &OldTermIOS);
printf ("\n");
DidNetInit = false;
}
}
}
}
//===========================================================================
//
// ST_NetMessage
//
// Call this between ST_NetInit() and ST_NetDone() instead of Printf() to
// display messages, because the progress meter is mixed in the same output
// stream as normal messages.
//
//===========================================================================
void ST_NetMessage(const char *format, ...)
{
@ -111,81 +163,100 @@ void ST_NetMessage(const char *format, ...)
str.VFormat (format, argptr);
va_end (argptr);
fprintf (stderr, "\r%-40s\n", str.GetChars());
if (NetMessage == 0)
{
NetMessage = 0;
}
}
//===========================================================================
//
// ST_NetProgress
//
// Sets the network progress meter. If count is 0, it gets bumped by 1.
// Otherwise, it is set to count.
//
//===========================================================================
void ST_NetProgress(int count)
{
int i;
if (count == 0)
{
NetProgressTicker++;
}
else if (count > 0)
{
NetProgressTicker = count;
}
if (NetProgressMax == 0)
{
// Spinny-type progress meter, because we're a guest waiting for the host.
void ST_NetProgress(int count)
{
int i;
if (count == 0)
{
NetProgressTicker++;
}
else if (count > 0)
{
NetProgressTicker = count;
}
if (NetProgressMax == 0)
{
// Spinny-type progress meter, because we're a guest waiting for the host.
fprintf (stderr, "\r%s: %c", NetMessage, SpinnyProgressChars[NetProgressTicker & 7]);
fflush (stderr);
}
else if (NetProgressMax > 1)
{
// Dotty-type progress meter.
fflush (stderr);
}
else if (NetProgressMax > 1)
{
// Dotty-type progress meter.
fprintf (stderr, "\r%s: ", NetMessage);
for (i = 0; i < NetProgressTicker; ++i)
{
fputc ('.', stderr);
}
fprintf (stderr, "%*c[%2d/%2d]", NetProgressMax + 1 - NetProgressTicker, ' ', NetProgressTicker, NetProgressMax);
fflush (stderr);
}
}
fflush (stderr);
}
}
//===========================================================================
//
// ST_NetLoop
//
// The timer_callback function is called at least two times per second
// and passed the userdata value. It should return true to stop the loop and
// return control to the caller or false to continue the loop.
//
// ST_NetLoop will return true if the loop was halted by the callback and
// false if the loop was halted because the user wants to abort the
// network synchronization.
//
//===========================================================================
bool ST_NetLoop(bool (*timer_callback)(void *), void *userdata)
{
fd_set rfds;
struct timeval tv;
int retval;
char k;
for (;;)
{
// Don't flood the network with packets on startup.
tv.tv_sec = 0;
tv.tv_usec = 500000;
FD_ZERO (&rfds);
FD_SET (STDIN_FILENO, &rfds);
retval = select (1, &rfds, NULL, NULL, &tv);
if (retval == -1)
{
// Error
}
else if (retval == 0)
{
if (timer_callback (userdata))
bool ST_NetLoop(bool (*timer_callback)(void *), void *userdata)
{
fd_set rfds;
struct timeval tv;
int retval;
char k;
for (;;)
{
// Don't flood the network with packets on startup.
tv.tv_sec = 0;
tv.tv_usec = 500000;
FD_ZERO (&rfds);
FD_SET (STDIN_FILENO, &rfds);
retval = select (1, &rfds, NULL, NULL, &tv);
if (retval == -1)
{
// Error
}
else if (retval == 0)
{
if (timer_callback (userdata))
{
fputc ('\n', stderr);
return true;
}
}
else if (read (STDIN_FILENO, &k, 1) == 1)
{
// Check input on stdin
if (k == 'q' || k == 'Q')
{
fprintf (stderr, "\nNetwork game synchronization aborted.");
return false;
}
}
}
}
fputc ('\n', stderr);
return true;
}
}
else if (read (STDIN_FILENO, &k, 1) == 1)
{
// Check input on stdin
if (k == 'q' || k == 'Q')
{
fprintf (stderr, "\nNetwork game synchronization aborted.");
return false;
}
}
}
}

View file

@ -54,6 +54,14 @@ int MaxPos, CurPos;
int NetMaxPos, NetCurPos;
LRESULT NetMarqueeMode;
//===========================================================================
//
// ST_Init
//
// Sets the size of the progress bar and displays the startup screen.
//
//===========================================================================
void ST_Init(int maxProgress)
{
ProgressBar = CreateWindowEx(0, PROGRESS_CLASS,
@ -66,6 +74,15 @@ void ST_Init(int maxProgress)
CurPos = 0;
}
//===========================================================================
//
// ST_Done
//
// Called just before entering graphics mode to deconstruct the startup
// screen.
//
//===========================================================================
void ST_Done()
{
if (ProgressBar != NULL)
@ -76,6 +93,14 @@ void ST_Done()
}
}
//===========================================================================
//
// ST_Progress
//
// Bumps the progress meter one notch.
//
//===========================================================================
void ST_Progress()
{
if (CurPos < MaxPos)
@ -156,6 +181,14 @@ void ST_NetInit(const char *message, int numplayers)
ST_NetProgress(1); // You always know about yourself
}
//===========================================================================
//
// ST_NetDone
//
// Removes the network startup pane.
//
//===========================================================================
void ST_NetDone()
{
if (NetStartPane != NULL)
@ -166,6 +199,36 @@ void ST_NetDone()
}
}
//===========================================================================
//
// ST_NetMessage
//
// Call this between ST_NetInit() and ST_NetDone() instead of Printf() to
// display messages, in case the progress meter is mixed in the same output
// stream as normal messages.
//
//===========================================================================
void ST_NetMessage(const char *format, ...)
{
FString str;
va_list argptr;
va_start (argptr, format);
str.VFormat (format, argptr);
va_end (argptr);
Printf ("%s\n", str.GetChars());
}
//===========================================================================
//
// ST_NetProgress
//
// Sets the network progress meter. If count is 0, it gets bumped by 1.
// Otherwise, it is set to count.
//
//===========================================================================
void ST_NetProgress(int count)
{
if (count == 0)
@ -199,7 +262,7 @@ void ST_NetProgress(int count)
//
// ST_NetLoop
//
// The timer_callback function is called approximately two times per second
// The timer_callback function is called at least two times per second
// and passed the userdata value. It should return true to stop the loop and
// return control to the caller or false to continue the loop.
//
@ -247,6 +310,15 @@ bool ST_NetLoop(bool (*timer_callback)(void *), void *userdata)
return false;
}
//===========================================================================
//
// NetStartPaneProc
//
// DialogProc for the network startup pane. It just waits for somebody to
// click a button, and the only button available is the abort one.
//
//===========================================================================
INT_PTR CALLBACK NetStartPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED)

View file

@ -7,10 +7,11 @@
# build the wad correctly with nmake. If you use GCC, then "make" is
# sufficient to build the wad.
MAKEWAD=../tools/makewad/makewad
XLATCC=../tools/xlatcc/xlatcc
DEHSUPP=../tools/dehsupp/dehsupp
RM=rm -f
SLASH=/
MAKEWAD=..$(SLASH)tools$(SLASH)makewad$(SLASH)makewad
XLATCC=..$(SLASH)tools$(SLASH)xlatcc$(SLASH)xlatcc
DEHSUPP=..$(SLASH)tools$(SLASH)dehsupp$(SLASH)dehsupp
makethewad: wadmake Makefile2
$(MAKE) $(NOLOGO) XLATCC=$(XLATCC) DEHSUPP=$(DEHSUPP) -f Makefile2
@ -19,11 +20,11 @@ wadmake: zdoom.lst
$(MAKEWAD) -make wadmake zdoom.lst
clean:
$(RM) wadmake zdoom.pk3 xlat/*.x dehsupp.lmp
$(RM) wadmake zdoom.pk3 xlat$(SLASH)*.x dehsupp.lmp
# This target is for Visual C++'s Rebuild All command
nrebuild: clean
$(MAKE) NOLOGO=$(NOLOGO) MAKEWAD=$(MAKEWAD) XLATCC=$(XLATCC) DEHSUPP=$(DEHSUPP)
$(MAKE) NOLOGO=$(NOLOGO) SLASH=$(SLASH)
copy zdoom.pk3 ..\..
# Copy the wad to my testing area

View file

@ -27,9 +27,9 @@
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad XLATCC=..\tools\xlatcc\xlatcc DEHSUPP=..\tools\dehsupp\dehsupp NOLOGO=/nologo andcopy"
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo XLATCC=..\tools\xlatcc\xlatcc DEHSUPP=..\tools\dehsupp\dehsupp nrebuild"
CleanCommandLine="del wadmake zdoom.pk3"
BuildCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ andcopy"
ReBuildCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ nrebuild"
CleanCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ clean"
Output="zdoom.pk3"
PreprocessorDefinitions=""
IncludeSearchPath=""
@ -69,9 +69,9 @@
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad XLATCC=..\tools\xlatcc\xlatcc DEHSUPP=..\tools\dehsupp\dehsupp NOLOGO=/nologo"
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo XLATCC=..\tools\xlatcc\xlatcc DEHSUPP=..\tools\dehsupp\dehsupp nrebuild"
CleanCommandLine="del wadmake zdoom.pk3"
BuildCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ andcopy"
ReBuildCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ nrebuild"
CleanCommandLine="nmake /nologo RM=&quot;del /f /q&quot; SLASH=\ clean"
Output="zdoom.pk3"
PreprocessorDefinitions=""
IncludeSearchPath=""