removed RageNetwork*, added attract sequence
This commit is contained in:
@@ -717,9 +717,34 @@ Caution=Toggle whether the Caution screen is shown.
|
|||||||
SongGroup=Toggle whether the Select Group screen is shown.
|
SongGroup=Toggle whether the Select Group screen is shown.
|
||||||
WheelSections=If YES, songs are broken down into sections in the Select Music screen.
|
WheelSections=If YES, songs are broken down into sections in the Select Music screen.
|
||||||
|
|
||||||
[ScreenNetworkWaiting]
|
[ScreenUnlock]
|
||||||
ServerInfoX=320
|
SecondsToShow=10
|
||||||
ServerInfoY=120
|
NextScreen=ScreenHighScores
|
||||||
PlayerListX=320
|
|
||||||
PlayerListY=280
|
[ScreenHighScores]
|
||||||
HelpText=Press Up to join, Down to unjoin.::Wait for more players to enter the game before joining.
|
SecondsToShow=10
|
||||||
|
NextScreen=ScreenMemoryCard
|
||||||
|
|
||||||
|
[ScreenMemoryCard]
|
||||||
|
SecondsToShow=10
|
||||||
|
NextScreen=ScreenWarning
|
||||||
|
|
||||||
|
[ScreenWarning]
|
||||||
|
SecondsToShow=10
|
||||||
|
NextScreen=ScreenCompany
|
||||||
|
|
||||||
|
[ScreenCompany]
|
||||||
|
SecondsToShow=10
|
||||||
|
NextScreen=ScreenAlbums
|
||||||
|
|
||||||
|
[ScreenAlbums]
|
||||||
|
SecondsToShow=10
|
||||||
|
NextScreen=ScreenLogo
|
||||||
|
|
||||||
|
[ScreenLogo]
|
||||||
|
SecondsToShow=20
|
||||||
|
NextScreen=ScreenDemonstration
|
||||||
|
|
||||||
|
[ScreenDemonstration]
|
||||||
|
SecondsToShow=30
|
||||||
|
NextScreen=ScreenUnlock
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
/*
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Class: RageNetworkClient
|
|
||||||
|
|
||||||
Desc: See header.
|
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
||||||
Brendan Walker
|
|
||||||
Chris Danford
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RageNetworkClient.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
#include "RageException.h"
|
|
||||||
#include "RageLog.h"
|
|
||||||
#include "RageTimer.h"
|
|
||||||
#include "RageException.h"
|
|
||||||
#include "GameState.h" // remove this dependency later
|
|
||||||
#include "RageNetworkPacket.h"
|
|
||||||
|
|
||||||
#include "SDL_net-1.2.4/include/SDL_net.h"
|
|
||||||
//#ifdef _DEBUG
|
|
||||||
//#pragma comment(lib, "SDL_net-1.2.4/lib/SDL_netd.lib")
|
|
||||||
//#else
|
|
||||||
#pragma comment(lib, "SDL_net-1.2.4/lib/SDL_net.lib")
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
RageNetworkClient* CLIENT = NULL;
|
|
||||||
|
|
||||||
const int MAX_CLIENTS = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
///////////////////////////////
|
|
||||||
//
|
|
||||||
// THIS IS UNTESTED SINCE THE CONVERSION TO SDL_net!!!!!
|
|
||||||
//
|
|
||||||
///////////////////////////////
|
|
||||||
*/
|
|
||||||
|
|
||||||
RageNetworkClient::RageNetworkClient()
|
|
||||||
{
|
|
||||||
m_priSock = 0;
|
|
||||||
m_priSockSet = NULL;
|
|
||||||
|
|
||||||
/* Don't do this; it'll fire up things we might not want. Let StepMania.cpp
|
|
||||||
* do the initial SDL config. */
|
|
||||||
// SDL_Init(0); // this may have already been init'd somewhere else
|
|
||||||
|
|
||||||
if( SDLNet_Init() < 0 )
|
|
||||||
RageException::Throw("SDLNet_Init: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
// allocate socket sets
|
|
||||||
m_priSockSet = SDLNet_AllocSocketSet(1);
|
|
||||||
if(!m_priSockSet)
|
|
||||||
RageException::Throw("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
RageNetworkClient::~RageNetworkClient()
|
|
||||||
{
|
|
||||||
Disconnect();
|
|
||||||
SDLNet_FreeSocketSet( m_priSockSet );
|
|
||||||
SDLNet_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RageNetworkClient::Disconnect()
|
|
||||||
{
|
|
||||||
if( m_priSock == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SDLNet_TCP_DelSocket( m_priSockSet, m_priSock );
|
|
||||||
SDLNet_TCP_Close( m_priSock );
|
|
||||||
m_priSock = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkClient::Connect(CString host, unsigned short port)
|
|
||||||
{
|
|
||||||
Disconnect();
|
|
||||||
|
|
||||||
char szHost[1024];
|
|
||||||
strcpy( szHost, host );
|
|
||||||
|
|
||||||
IPaddress ip;
|
|
||||||
if( SDLNet_ResolveHost(&ip,szHost,port)==-1 )
|
|
||||||
{
|
|
||||||
LOG->Warn("SDLNet_ResolveHost: %s\n", SDLNet_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_priSock=SDLNet_TCP_Open(&ip);
|
|
||||||
if( !m_priSock )
|
|
||||||
{
|
|
||||||
LOG->Warn("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDLNet_TCP_AddSocket( m_priSockSet, m_priSock );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkClient::Update( float fDeltaTime )
|
|
||||||
{
|
|
||||||
// receive
|
|
||||||
int numready = SDLNet_CheckSockets(m_priSockSet, 0);
|
|
||||||
if(numready==-1)
|
|
||||||
{
|
|
||||||
// XXX sorry, this was really noisy ... - glenn
|
|
||||||
// LOG->Warn("SDLNet_CheckSockets: %s\n", SDLNet_GetError());
|
|
||||||
}
|
|
||||||
else if( numready )
|
|
||||||
{
|
|
||||||
if( SDLNet_SocketReady(m_priSock) )
|
|
||||||
{
|
|
||||||
RageNetworkPacket packet;
|
|
||||||
SDLNet_TCP_Recv( m_priSock, &packet, sizeof(RageNetworkPacket) );
|
|
||||||
|
|
||||||
switch( packet.type )
|
|
||||||
{
|
|
||||||
case RageNetworkPacket::update_game:
|
|
||||||
this->m_NetGameState = packet.game;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG->Warn( "Invalid packet received with type '%d'", packet.type );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkClient::SendMyPlayerState( NetPlayerState ps )
|
|
||||||
{
|
|
||||||
RageNetworkPacket packet;
|
|
||||||
packet.type = RageNetworkPacket::update_player;
|
|
||||||
packet.player = ps;
|
|
||||||
SendToServer( &packet );
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkClient::Send( TCPsocket& socket, RageNetworkPacket* pPacket )
|
|
||||||
{
|
|
||||||
int result = SDLNet_TCP_Send(socket,pPacket,sizeof(RageNetworkPacket));
|
|
||||||
if( result<int(sizeof(RageNetworkPacket)) )
|
|
||||||
{
|
|
||||||
LOG->Warn("SDLNet_TCP_Send: %s\n", SDLNet_GetError());
|
|
||||||
// It may be good to disconnect sock because it is likely invalid now.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkClient::SendToServer( RageNetworkPacket* pPacket )
|
|
||||||
{
|
|
||||||
Send( m_priSock, pPacket );
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#ifndef RAGENETWORKCLIENT_H
|
|
||||||
#define RAGENETWORKCLIENT_H
|
|
||||||
/*
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Class: RageNetworkClient
|
|
||||||
|
|
||||||
Desc: Network transport layer. Note that this currently has SM-specific
|
|
||||||
functionality. All SM stuff should be moved out eventually.
|
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
||||||
Chris Danford
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct _TCPsocket;
|
|
||||||
typedef struct _TCPsocket *TCPsocket;
|
|
||||||
|
|
||||||
struct _SDLNet_SocketSet;
|
|
||||||
typedef struct _SDLNet_SocketSet *SDLNet_SocketSet;
|
|
||||||
|
|
||||||
|
|
||||||
#include "NetGameState.h"
|
|
||||||
|
|
||||||
class RageNetworkPacket;
|
|
||||||
|
|
||||||
|
|
||||||
class RageNetworkClient
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RageNetworkClient();
|
|
||||||
~RageNetworkClient();
|
|
||||||
|
|
||||||
void Update( float fDeltaTime );
|
|
||||||
|
|
||||||
void Connect(CString ip, unsigned short port);
|
|
||||||
void Disconnect();
|
|
||||||
|
|
||||||
void SendMyPlayerState( NetPlayerState ps ); // calling this implies bReady = true
|
|
||||||
|
|
||||||
NetGameState m_NetGameState;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void SendToServer( RageNetworkPacket* pPacket );
|
|
||||||
void Send( TCPsocket& socket, RageNetworkPacket* pPacket );
|
|
||||||
|
|
||||||
|
|
||||||
TCPsocket m_priSock; // client: active socket. server: listen socket
|
|
||||||
SDLNet_SocketSet m_priSockSet;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern RageNetworkClient* CLIENT; // global and accessable from anywhere in our program
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#ifndef RAGENETWORKPACKET
|
|
||||||
#define RAGENETWORKPACKET
|
|
||||||
|
|
||||||
|
|
||||||
#include "NetGameState.h"
|
|
||||||
|
|
||||||
|
|
||||||
const int MAX_DATA_SIZE = sizeof(NetGameState);
|
|
||||||
|
|
||||||
class RageNetworkPacket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RageNetworkPacket() { type=invalid; }
|
|
||||||
~RageNetworkPacket() {}
|
|
||||||
|
|
||||||
enum {
|
|
||||||
invalid,
|
|
||||||
update_player, // sent by clients
|
|
||||||
update_game, // sent by server
|
|
||||||
go_to_next_screen // sent by server
|
|
||||||
} type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
// char data[MAX_DATA_SIZE];
|
|
||||||
NetGameState game;
|
|
||||||
NetPlayerState player;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
/*
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Class: RageNetworkServer
|
|
||||||
|
|
||||||
Desc: See header.
|
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
||||||
Brendan Walker
|
|
||||||
Chris Danford
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RageNetworkServer.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
#include "RageException.h"
|
|
||||||
#include "RageLog.h"
|
|
||||||
#include "RageException.h"
|
|
||||||
#include "RageNetworkPacket.h"
|
|
||||||
|
|
||||||
#include "SDL_net-1.2.4/include/SDL_net.h"
|
|
||||||
//#ifdef _DEBUG
|
|
||||||
//#pragma comment(lib, "SDL_net-1.2.4/lib/SDL_netd.lib")
|
|
||||||
//#else
|
|
||||||
#pragma comment(lib, "SDL_net-1.2.4/lib/SDL_net.lib")
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib")
|
|
||||||
#else
|
|
||||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmain.lib")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pull in all of our SDL libraries here. */
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLd.lib")
|
|
||||||
#pragma comment(lib, "SDL_image-1.2/SDL_imaged.lib")
|
|
||||||
#else
|
|
||||||
#pragma comment(lib, "SDL-1.2.5/lib/SDL.lib")
|
|
||||||
#pragma comment(lib, "SDL_image-1.2/SDL_image.lib")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
RageNetworkServer* SERVER = NULL;
|
|
||||||
|
|
||||||
const int MAX_CLIENTS = 16;
|
|
||||||
|
|
||||||
/*
|
|
||||||
///////////////////////////////
|
|
||||||
//
|
|
||||||
// THIS IS UNTESTED SINCE THE CONVERSION TO SDL_net!!!!!
|
|
||||||
//
|
|
||||||
///////////////////////////////
|
|
||||||
*/
|
|
||||||
|
|
||||||
RageNetworkServer::RageNetworkServer()
|
|
||||||
{
|
|
||||||
m_listenSock = 0;
|
|
||||||
m_listenSockSet = NULL;
|
|
||||||
m_clientSocksSet = NULL;
|
|
||||||
|
|
||||||
/* Don't do this; it'll fire up things we might not want. Let StepMania.cpp
|
|
||||||
* do the initial SDL config. */
|
|
||||||
// SDL_Init(0); // this may have already been init'd somewhere else
|
|
||||||
|
|
||||||
if( SDLNet_Init() < 0 )
|
|
||||||
RageException::Throw("SDLNet_Init: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
// allocate socket sets
|
|
||||||
m_listenSockSet = SDLNet_AllocSocketSet(1);
|
|
||||||
if(!m_listenSockSet)
|
|
||||||
RageException::Throw("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
m_clientSocksSet = SDLNet_AllocSocketSet(MAX_CLIENTS);
|
|
||||||
if(!m_clientSocksSet)
|
|
||||||
RageException::Throw("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
RageNetworkServer::~RageNetworkServer()
|
|
||||||
{
|
|
||||||
StopListening();
|
|
||||||
DisconnectAllClients();
|
|
||||||
SDLNet_FreeSocketSet( m_listenSockSet );
|
|
||||||
SDLNet_FreeSocketSet( m_clientSocksSet );
|
|
||||||
SDLNet_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RageNetworkServer::StopListening()
|
|
||||||
{
|
|
||||||
if( m_listenSock == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SDLNet_TCP_DelSocket( m_listenSockSet, m_listenSock );
|
|
||||||
SDLNet_TCP_Close( m_listenSock );
|
|
||||||
m_listenSock = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkServer::DisconnectAllClients()
|
|
||||||
{
|
|
||||||
// I hope passing NULL to these is OK...
|
|
||||||
for( unsigned int i=0; i<m_clientSocks.size(); i++ )
|
|
||||||
{
|
|
||||||
SDLNet_TCP_DelSocket( m_clientSocksSet, m_clientSocks[i] );
|
|
||||||
SDLNet_TCP_Close( m_clientSocks[i] );
|
|
||||||
}
|
|
||||||
m_clientSocks.erase( m_clientSocks.begin(), m_clientSocks.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RageNetworkServer::Listen(unsigned short port)
|
|
||||||
{
|
|
||||||
StopListening();
|
|
||||||
|
|
||||||
IPaddress ip;
|
|
||||||
if( SDLNet_ResolveHost(&ip,NULL,port)==-1 )
|
|
||||||
RageException::Throw("SDLNet_ResolveHost: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
m_listenSock=SDLNet_TCP_Open(&ip);
|
|
||||||
if( !m_listenSock )
|
|
||||||
RageException::Throw("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
SDLNet_TCP_AddSocket( m_listenSockSet, m_listenSock );
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkServer::Update( float fDeltaTime )
|
|
||||||
{
|
|
||||||
// accept
|
|
||||||
if( m_listenSock )
|
|
||||||
{
|
|
||||||
TCPsocket new_sock = SDLNet_TCP_Accept( m_listenSock ) ;
|
|
||||||
if( new_sock != 0 )
|
|
||||||
{
|
|
||||||
m_clientSocks.push_back( new_sock );
|
|
||||||
SDLNet_TCP_AddSocket( m_clientSocksSet, new_sock );
|
|
||||||
|
|
||||||
LOG->Trace( "Accepting new client." );
|
|
||||||
|
|
||||||
m_NetGameState.num_players = m_clientSocks.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// receive
|
|
||||||
if( m_clientSocks.size() > 0 ) // there are some clients connected
|
|
||||||
{
|
|
||||||
int numready = SDLNet_CheckSockets(m_clientSocksSet, 0);
|
|
||||||
if(numready==-1)
|
|
||||||
{
|
|
||||||
// XXX sorry, this was really noisy ... - glenn
|
|
||||||
// LOG->Warn("SDLNet_CheckSockets: %s\n", SDLNet_GetError());
|
|
||||||
}
|
|
||||||
else if( numready > 0 )
|
|
||||||
{
|
|
||||||
for( unsigned int i=0; i<m_clientSocks.size(); i++ )
|
|
||||||
{
|
|
||||||
if( SDLNet_SocketReady(m_clientSocks[i]) )
|
|
||||||
{
|
|
||||||
RageNetworkPacket packet;
|
|
||||||
SDLNet_TCP_Recv( m_clientSocks[i], &packet, sizeof(RageNetworkPacket) );
|
|
||||||
|
|
||||||
switch( packet.type )
|
|
||||||
{
|
|
||||||
case RageNetworkPacket::update_player:
|
|
||||||
m_NetGameState.player[i] = packet.player;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG->Warn( "Invalid packet received with type '%d'", packet.type );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkServer::TellClientsNetGameState()
|
|
||||||
{
|
|
||||||
// tell everyone about the new names
|
|
||||||
RageNetworkPacket packet;
|
|
||||||
packet.type = RageNetworkPacket::update_game;
|
|
||||||
packet.game = m_NetGameState;
|
|
||||||
this->SendToClients( &packet );
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkServer::Send( TCPsocket& socket, RageNetworkPacket* pPacket )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageNetworkServer::SendToClients( RageNetworkPacket* pPacket )
|
|
||||||
{
|
|
||||||
for( int i=m_clientSocks.size()-1; i>=0; i-- ) // iterate backwards in case we need to delete
|
|
||||||
{
|
|
||||||
int result = SDLNet_TCP_Send(m_clientSocks[i],pPacket,sizeof(RageNetworkPacket));
|
|
||||||
if( result<int(sizeof(RageNetworkPacket)) )
|
|
||||||
{
|
|
||||||
LOG->Warn("SDLNet_TCP_Send: %s\n", SDLNet_GetError());
|
|
||||||
|
|
||||||
LOG->Trace( "disconnecting %d", i );
|
|
||||||
SDLNet_TCP_DelSocket( m_clientSocksSet, m_clientSocks[i] );
|
|
||||||
SDLNet_TCP_Close( m_clientSocks[i] );
|
|
||||||
m_clientSocks.erase( m_clientSocks.begin() + i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#ifndef RAGENETWORKSERVER_H
|
|
||||||
#define RAGENETWORKSERVER_H
|
|
||||||
/*
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Class: RageNetworkServer
|
|
||||||
|
|
||||||
Desc: Network transport layer. Note that this currently has SM-specific
|
|
||||||
functionality. All SM stuff should be moved out eventually.
|
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
||||||
Chris Danford
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct _TCPsocket;
|
|
||||||
typedef struct _TCPsocket *TCPsocket;
|
|
||||||
|
|
||||||
struct _SDLNet_SocketSet;
|
|
||||||
typedef struct _SDLNet_SocketSet *SDLNet_SocketSet;
|
|
||||||
|
|
||||||
|
|
||||||
#include "NetGameState.h"
|
|
||||||
|
|
||||||
|
|
||||||
class RageNetworkPacket;
|
|
||||||
|
|
||||||
class RageNetworkServer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RageNetworkServer();
|
|
||||||
~RageNetworkServer();
|
|
||||||
|
|
||||||
void Update( float fDeltaTime );
|
|
||||||
|
|
||||||
void Listen(unsigned short port);
|
|
||||||
void StopListening();
|
|
||||||
|
|
||||||
void DisconnectAllClients();
|
|
||||||
|
|
||||||
void TellClientsNetGameState();
|
|
||||||
|
|
||||||
NetGameState m_NetGameState;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void Send( TCPsocket& socket, RageNetworkPacket* pPacket );
|
|
||||||
void SendToClients( RageNetworkPacket* pPacket );
|
|
||||||
|
|
||||||
TCPsocket m_listenSock;
|
|
||||||
SDLNet_SocketSet m_listenSockSet;
|
|
||||||
vector<TCPsocket> m_clientSocks;
|
|
||||||
SDLNet_SocketSet m_clientSocksSet;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern RageNetworkServer* SERVER; // global and accessable from anywhere in our program
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenAlbums
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenAlbums
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenAlbums : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Albums"; }; // used to loop up theme metrics
|
||||||
|
virtual CString GetElementName() { return "albums"; }; // used to loop up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenAttract
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
#include "ScreenManager.h"
|
||||||
|
#include "GameConstantsAndTypes.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "StepMania.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
#include "AnnouncerManager.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
#include "SDL_Utils.h"
|
||||||
|
#include "RageSoundManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SECONDS_TO_SHOW THEME->GetMetricF("Screen"+this->GetMetricName(),"SecondsToShow")
|
||||||
|
#define NEXT_SCREEN THEME->GetMetric("Screen"+this->GetMetricName(),"NextScreen")
|
||||||
|
|
||||||
|
const ScreenMessage SM_BeginFadingOut = ScreenMessage(SM_User+2);
|
||||||
|
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+3);
|
||||||
|
|
||||||
|
|
||||||
|
ScreenAttract::ScreenAttract()
|
||||||
|
{
|
||||||
|
LOG->Trace( "ScreenAttract::ScreenAttract()" );
|
||||||
|
|
||||||
|
m_bFirstUpdate = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// I think it's better to do all the initialization here rather than have it scattered
|
||||||
|
// about in all the global singleton classes
|
||||||
|
//
|
||||||
|
GAMESTATE->Reset();
|
||||||
|
PREFSMAN->ReadGamePrefsFromDisk();
|
||||||
|
INPUTMAPPER->ReadMappingsFromDisk();
|
||||||
|
GAMESTATE->m_bPlayersCanJoin = true;
|
||||||
|
|
||||||
|
if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) )
|
||||||
|
{
|
||||||
|
CStringArray asNoteSkinNames;
|
||||||
|
GAMEMAN->GetNoteSkinNames( asNoteSkinNames );
|
||||||
|
GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] );
|
||||||
|
}
|
||||||
|
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
|
||||||
|
{
|
||||||
|
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||||
|
if( THEME->DoesThemeExist( sGameName ) )
|
||||||
|
THEME->SwitchTheme( sGameName );
|
||||||
|
else
|
||||||
|
THEME->SwitchTheme( "default" );
|
||||||
|
}
|
||||||
|
PREFSMAN->SaveGamePrefsToDisk();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ScreenAttract::~ScreenAttract()
|
||||||
|
{
|
||||||
|
LOG->Trace( "ScreenAttract::~ScreenAttract()" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
|
{
|
||||||
|
// LOG->Trace( "ScreenAttract::Input()" );
|
||||||
|
|
||||||
|
if( m_Fade.IsClosing() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenAttract::Update( float fDelta )
|
||||||
|
{
|
||||||
|
// We have to do initialization in the first update because this->GetElementName() won't
|
||||||
|
// work until the object has been fully constructed.
|
||||||
|
if( m_bFirstUpdate )
|
||||||
|
{
|
||||||
|
m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations",this->GetElementName()) );
|
||||||
|
this->AddChild( &m_Background );
|
||||||
|
|
||||||
|
m_Fade.SetClosed();
|
||||||
|
m_Fade.OpenWipingRight( SM_None );
|
||||||
|
this->AddChild( &m_Fade );
|
||||||
|
|
||||||
|
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(this->GetElementName()) );
|
||||||
|
|
||||||
|
m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") );
|
||||||
|
|
||||||
|
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",this->GetElementName() + " music") );
|
||||||
|
|
||||||
|
this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW );
|
||||||
|
|
||||||
|
m_bFirstUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Screen::Update(fDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
switch( SM )
|
||||||
|
{
|
||||||
|
case SM_BeginFadingOut:
|
||||||
|
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
||||||
|
break;
|
||||||
|
case SM_GoToNextScreen:
|
||||||
|
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenAttract::MenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
GAMESTATE->m_bSideIsJoined[pn] = true;
|
||||||
|
GAMESTATE->m_MasterPlayerNumber = pn;
|
||||||
|
GAMESTATE->m_bPlayersCanJoin = false;
|
||||||
|
|
||||||
|
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") );
|
||||||
|
::Sleep( 1000 ); // do a little pause, like the arcade does
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#ifndef ScreenAttract_H
|
||||||
|
#define ScreenAttract_H
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenAttract
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Screen.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
#include "TransitionFade.h"
|
||||||
|
#include "RandomSample.h"
|
||||||
|
#include "BGAnimation.h"
|
||||||
|
#include "RageTimer.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenAttract : public Screen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenAttract();
|
||||||
|
virtual ~ScreenAttract();
|
||||||
|
|
||||||
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
|
virtual void Update( float fDelta );
|
||||||
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void MenuStart( PlayerNumber pn );
|
||||||
|
virtual CString GetMetricName() = 0; // used to loop up theme metrics
|
||||||
|
virtual CString GetElementName() = 0; // used to loop up theme elements
|
||||||
|
|
||||||
|
bool m_bFirstUpdate;
|
||||||
|
|
||||||
|
BGAnimation m_Background;
|
||||||
|
TransitionFade m_Fade;
|
||||||
|
RandomSample m_soundStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenCompany
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenCompany : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Company"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "company"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenDemonstration
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenDemonstration
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenDemonstration : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Demonstration"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "demonstration"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenHighScores
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenHighScores
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenHighScores : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "HighScores"; }; // used to loop up theme metrics
|
||||||
|
virtual CString GetElementName() { return "high scores"; }; // used to loop up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,42 +1,26 @@
|
|||||||
#ifndef SCREENHOWTOPLAY_H
|
|
||||||
#define SCREENHOWTOPLAY_H
|
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Class: ScreenHowToPlay
|
Class: ScreenHowToPlay
|
||||||
|
|
||||||
Desc: A grid of options, and the selected option is drawn with a highlight rectangle.
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
Chris Danford
|
Chris Danford
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
#include "Screen.h"
|
|
||||||
#include "Sprite.h"
|
|
||||||
#include "RandomSample.h"
|
|
||||||
#include "TransitionInvisible.h"
|
|
||||||
#include "MenuElements.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ScreenHowToPlay : public Screen
|
class ScreenHowToPlay : public ScreenAttract
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenHowToPlay();
|
|
||||||
virtual ~ScreenHowToPlay();
|
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
private:
|
||||||
virtual void DrawPrimitives();
|
virtual CString GetMetricName() { return "HowToPlay"; }; // used to look up theme metrics
|
||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual CString GetElementName() { return "how to play"; }; // used to look up theme elements
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
|
||||||
|
|
||||||
virtual void MenuBack( PlayerNumber pn );
|
|
||||||
virtual void MenuStart( PlayerNumber pn );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Sprite m_sprHowToPlay;
|
|
||||||
MenuElements m_Menu;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Class: ScreenHowToPlay
|
Class: ScreenInstructions
|
||||||
|
|
||||||
Desc: See header.
|
Desc: See header.
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ScreenHowToPlay.h"
|
#include "ScreenInstructions.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageSoundManager.h"
|
#include "RageSoundManager.h"
|
||||||
@@ -22,19 +22,19 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
|
||||||
#define HELP_TEXT THEME->GetMetric("ScreenHowToPlay","HelpText")
|
#define HELP_TEXT THEME->GetMetric("ScreenInstructions","HelpText")
|
||||||
#define TIMER_SECONDS THEME->GetMetricI("ScreenHowToPlay","TimerSeconds")
|
#define TIMER_SECONDS THEME->GetMetricI("ScreenInstructions","TimerSeconds")
|
||||||
#define NEXT_SCREEN_ARCADE THEME->GetMetric("ScreenHowToPlay","NextScreenArcade")
|
#define NEXT_SCREEN_ARCADE THEME->GetMetric("ScreenInstructions","NextScreenArcade")
|
||||||
#define NEXT_SCREEN_ONI THEME->GetMetric("ScreenHowToPlay","NextScreenOni")
|
#define NEXT_SCREEN_ONI THEME->GetMetric("ScreenInstructions","NextScreenOni")
|
||||||
|
|
||||||
|
|
||||||
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
|
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
|
||||||
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
|
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
|
||||||
|
|
||||||
|
|
||||||
ScreenHowToPlay::ScreenHowToPlay()
|
ScreenInstructions::ScreenInstructions()
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenHowToPlay::ScreenHowToPlay()" );
|
LOG->Trace( "ScreenInstructions::ScreenInstructions()" );
|
||||||
|
|
||||||
m_Menu.Load(
|
m_Menu.Load(
|
||||||
THEME->GetPathTo("BGAnimations","How To Play"),
|
THEME->GetPathTo("BGAnimations","How To Play"),
|
||||||
@@ -80,26 +80,26 @@ ScreenHowToPlay::ScreenHowToPlay()
|
|||||||
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","how to play music") );
|
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","how to play music") );
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenHowToPlay::~ScreenHowToPlay()
|
ScreenInstructions::~ScreenInstructions()
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenHowToPlay::~ScreenHowToPlay()" );
|
LOG->Trace( "ScreenInstructions::~ScreenInstructions()" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::Update( float fDeltaTime )
|
void ScreenInstructions::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
//LOG->Trace( "ScreenHowToPlay::Update(%f)", fDeltaTime );
|
//LOG->Trace( "ScreenInstructions::Update(%f)", fDeltaTime );
|
||||||
|
|
||||||
Screen::Update( fDeltaTime );
|
Screen::Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::DrawPrimitives()
|
void ScreenInstructions::DrawPrimitives()
|
||||||
{
|
{
|
||||||
m_Menu.DrawBottomLayer();
|
m_Menu.DrawBottomLayer();
|
||||||
m_Menu.DrawTopLayer();
|
m_Menu.DrawTopLayer();
|
||||||
Screen::DrawPrimitives(); // draw How To Play graphic on top of all the others!
|
Screen::DrawPrimitives(); // draw How To Play graphic on top of all the others!
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
void ScreenInstructions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
{
|
{
|
||||||
if( m_Menu.IsClosing() )
|
if( m_Menu.IsClosing() )
|
||||||
return;
|
return;
|
||||||
@@ -108,7 +108,7 @@ void ScreenHowToPlay::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenInstructions::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
switch( SM )
|
switch( SM )
|
||||||
{
|
{
|
||||||
@@ -135,12 +135,12 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::MenuBack( PlayerNumber pn )
|
void ScreenInstructions::MenuBack( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true );
|
m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHowToPlay::MenuStart( PlayerNumber pn )
|
void ScreenInstructions::MenuStart( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
|
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
|
||||||
|
|
||||||
@@ -1,43 +1,42 @@
|
|||||||
|
#ifndef ScreenInstructions_H
|
||||||
|
#define ScreenInstructions_H
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Class: ScreenNetworkWaiting
|
Class: ScreenInstructions
|
||||||
|
|
||||||
Desc: See header.
|
Desc: A grid of options, and the selected option is drawn with a highlight rectangle.
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
Chris Danford
|
Chris Danford
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Screen.h"
|
|
||||||
#include "SongSelector.h"
|
|
||||||
#include "BitmapText.h"
|
|
||||||
#include "TransitionFade.h"
|
|
||||||
#include "RandomSample.h"
|
|
||||||
|
|
||||||
class ScreenNetworkWaiting : public Screen
|
#include "Screen.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "RandomSample.h"
|
||||||
|
#include "TransitionInvisible.h"
|
||||||
|
#include "MenuElements.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenInstructions : public Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenNetworkWaiting();
|
ScreenInstructions();
|
||||||
virtual ~ScreenNetworkWaiting();
|
virtual ~ScreenInstructions();
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
virtual void MenuUp( PlayerNumber pn );
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
virtual void MenuDown( PlayerNumber pn );
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Sprite m_sprHowToPlay;
|
||||||
MenuElements m_Menu;
|
MenuElements m_Menu;
|
||||||
|
|
||||||
BitmapText m_textServerInfo;
|
|
||||||
BitmapText m_textPlayerList;
|
|
||||||
bool m_bReady;
|
|
||||||
float m_fUpdateTimer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenLogo
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenLogo : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Logo"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "logo"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -176,7 +176,6 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
|
|||||||
#include "ScreenMachineOptions.h"
|
#include "ScreenMachineOptions.h"
|
||||||
#include "ScreenMapControllers.h"
|
#include "ScreenMapControllers.h"
|
||||||
#include "ScreenMusicScroll.h"
|
#include "ScreenMusicScroll.h"
|
||||||
#include "ScreenNetworkWaiting.h"
|
|
||||||
#include "ScreenPlayerOptions.h"
|
#include "ScreenPlayerOptions.h"
|
||||||
#include "ScreenSandbox.h"
|
#include "ScreenSandbox.h"
|
||||||
#include "ScreenSelectCourse.h"
|
#include "ScreenSelectCourse.h"
|
||||||
@@ -190,7 +189,14 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
|
|||||||
#include "ScreenStage.h"
|
#include "ScreenStage.h"
|
||||||
#include "ScreenTitleMenu.h"
|
#include "ScreenTitleMenu.h"
|
||||||
#include "ScreenEz2SelectMusic.h"
|
#include "ScreenEz2SelectMusic.h"
|
||||||
|
#include "ScreenWarning.h"
|
||||||
|
#include "ScreenHighScores.h"
|
||||||
|
#include "ScreenMemoryCard.h"
|
||||||
|
#include "ScreenCompany.h"
|
||||||
|
#include "ScreenAlbums.h"
|
||||||
|
#include "ScreenLogo.h"
|
||||||
|
#include "ScreenUnlock.h"
|
||||||
|
#include "ScreenDemonstration.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
|
|
||||||
@@ -216,7 +222,6 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName )
|
|||||||
else if( 0==stricmp(sClassName, "ScreenMapControllers") ) ret = new ScreenMapControllers;
|
else if( 0==stricmp(sClassName, "ScreenMapControllers") ) ret = new ScreenMapControllers;
|
||||||
else if( 0==stricmp(sClassName, "ScreenInputOptions") ) ret = new ScreenInputOptions;
|
else if( 0==stricmp(sClassName, "ScreenInputOptions") ) ret = new ScreenInputOptions;
|
||||||
else if( 0==stricmp(sClassName, "ScreenMusicScroll") ) ret = new ScreenMusicScroll;
|
else if( 0==stricmp(sClassName, "ScreenMusicScroll") ) ret = new ScreenMusicScroll;
|
||||||
else if( 0==stricmp(sClassName, "ScreenNetworkWaiting") ) ret = new ScreenNetworkWaiting;
|
|
||||||
else if( 0==stricmp(sClassName, "ScreenPlayerOptions") ) ret = new ScreenPlayerOptions;
|
else if( 0==stricmp(sClassName, "ScreenPlayerOptions") ) ret = new ScreenPlayerOptions;
|
||||||
else if( 0==stricmp(sClassName, "ScreenSandbox") ) ret = new ScreenSandbox;
|
else if( 0==stricmp(sClassName, "ScreenSandbox") ) ret = new ScreenSandbox;
|
||||||
else if( 0==stricmp(sClassName, "ScreenSelectCourse") ) ret = new ScreenSelectCourse;
|
else if( 0==stricmp(sClassName, "ScreenSelectCourse") ) ret = new ScreenSelectCourse;
|
||||||
@@ -230,6 +235,14 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName )
|
|||||||
else if( 0==stricmp(sClassName, "ScreenStage") ) ret = new ScreenStage;
|
else if( 0==stricmp(sClassName, "ScreenStage") ) ret = new ScreenStage;
|
||||||
else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) ret = new ScreenTitleMenu;
|
else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) ret = new ScreenTitleMenu;
|
||||||
else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) ret = new ScreenEz2SelectMusic;
|
else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) ret = new ScreenEz2SelectMusic;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenWarning") ) ret = new ScreenWarning;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenHighScores") ) ret = new ScreenHighScores;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenMemoryCard") ) ret = new ScreenMemoryCard;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenCompany") ) ret = new ScreenCompany;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenAlbums") ) ret = new ScreenAlbums;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenLogo") ) ret = new ScreenLogo;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenUnlock") ) ret = new ScreenUnlock;
|
||||||
|
else if( 0==stricmp(sClassName, "ScreenDemonstration") ) ret = new ScreenDemonstration;
|
||||||
else
|
else
|
||||||
RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() );
|
RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() );
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenMemoryCard
|
||||||
|
|
||||||
|
Desc: .
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenMemoryCard : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "MemoryCard"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "memory card"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
/*
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Class: ScreenNetworkWaiting
|
|
||||||
|
|
||||||
Desc: The main title screen and menu.
|
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
||||||
Chris Danford
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ScreenNetworkWaiting.h"
|
|
||||||
#include "SongManager.h"
|
|
||||||
#include "ScreenManager.h"
|
|
||||||
#include "GameConstantsAndTypes.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
#include "PrefsManager.h"
|
|
||||||
#include "GameManager.h"
|
|
||||||
#include "RageLog.h"
|
|
||||||
#include "GameState.h"
|
|
||||||
#include "RageSoundManager.h"
|
|
||||||
#include "ThemeManager.h"
|
|
||||||
#include "RageNetworkClient.h"
|
|
||||||
#include "NetGameState.h"
|
|
||||||
#include "InputMapper.h"
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Defines specific to ScreenNetworkWaiting
|
|
||||||
//
|
|
||||||
const int SERVER_WAIT_TIMEOUT_SECS = 60;
|
|
||||||
const float REFRESH_SECONDS = 0.2f;
|
|
||||||
|
|
||||||
#define SERVER_INFO_X THEME->GetMetricF("ScreenNetworkWaiting","ServerInfoX")
|
|
||||||
#define SERVER_INFO_Y THEME->GetMetricF("ScreenNetworkWaiting","ServerInfoY")
|
|
||||||
#define PLAYER_LIST_X THEME->GetMetricF("ScreenNetworkWaiting","PlayerListX")
|
|
||||||
#define PLAYER_LIST_Y THEME->GetMetricF("ScreenNetworkWaiting","PlayerListY")
|
|
||||||
#define HELP_TEXT THEME->GetMetric("ScreenNetworkWaiting","HelpText")
|
|
||||||
|
|
||||||
const ScreenMessage SM_ServerGoToNextScreen = ScreenMessage(SM_User+1);
|
|
||||||
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+3);
|
|
||||||
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+4);
|
|
||||||
|
|
||||||
|
|
||||||
ScreenNetworkWaiting::ScreenNetworkWaiting()
|
|
||||||
{
|
|
||||||
LOG->Trace( "ScreenNetworkWaiting::ScreenNetworkWaiting()" );
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// I think it's better to do all the initialization here rather than have it scattered
|
|
||||||
// about in all the global singleton classes
|
|
||||||
//
|
|
||||||
GAMESTATE->Reset();
|
|
||||||
PREFSMAN->ReadGamePrefsFromDisk();
|
|
||||||
INPUTMAPPER->ReadMappingsFromDisk();
|
|
||||||
GAMESTATE->m_bPlayersCanJoin = true;
|
|
||||||
if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) )
|
|
||||||
{
|
|
||||||
CStringArray asNoteSkinNames;
|
|
||||||
GAMEMAN->GetNoteSkinNames( asNoteSkinNames );
|
|
||||||
GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] );
|
|
||||||
}
|
|
||||||
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
|
|
||||||
{
|
|
||||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
|
||||||
if( THEME->DoesThemeExist( sGameName ) )
|
|
||||||
THEME->SwitchTheme( sGameName );
|
|
||||||
else
|
|
||||||
THEME->SwitchTheme( "default" );
|
|
||||||
}
|
|
||||||
PREFSMAN->SaveGamePrefsToDisk();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_Menu.Load(
|
|
||||||
THEME->GetPathTo("BGAnimations","network waiting"),
|
|
||||||
THEME->GetPathTo("Graphics","network waiting top edge"),
|
|
||||||
HELP_TEXT, false, false, 99
|
|
||||||
);
|
|
||||||
this->AddChild( &m_Menu );
|
|
||||||
|
|
||||||
|
|
||||||
m_textServerInfo.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
|
|
||||||
m_textServerInfo.SetXY( SERVER_INFO_X, SERVER_INFO_Y );
|
|
||||||
m_textServerInfo.SetText( "Server Info" );
|
|
||||||
this->AddChild( &m_textServerInfo );
|
|
||||||
|
|
||||||
m_textPlayerList.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
|
|
||||||
m_textPlayerList.SetXY( PLAYER_LIST_X, PLAYER_LIST_Y );
|
|
||||||
this->AddChild( &m_textPlayerList );
|
|
||||||
|
|
||||||
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","network waiting music") );
|
|
||||||
|
|
||||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
|
||||||
|
|
||||||
m_bReady = false;
|
|
||||||
NetPlayerState ps = { "billy", 100, 100, m_bReady };
|
|
||||||
CLIENT->SendMyPlayerState( ps );
|
|
||||||
|
|
||||||
m_fUpdateTimer = REFRESH_SECONDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ScreenNetworkWaiting::~ScreenNetworkWaiting()
|
|
||||||
{
|
|
||||||
LOG->Trace( "ScreenNetworkWaiting::~ScreenNetworkWaiting()" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::Update( float fDeltaTime )
|
|
||||||
{
|
|
||||||
Screen::Update( fDeltaTime );
|
|
||||||
|
|
||||||
m_fUpdateTimer -= fDeltaTime;
|
|
||||||
if( m_fUpdateTimer < 0 )
|
|
||||||
{
|
|
||||||
CString s;
|
|
||||||
NetGameState& gns = CLIENT->m_NetGameState;
|
|
||||||
for( int i=0; i<gns.num_players; i++ )
|
|
||||||
{
|
|
||||||
s += gns.player[i].name;
|
|
||||||
s += gns.player[i].bReady ? " (Ready)" : " (Not Ready)";
|
|
||||||
s += '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
m_textPlayerList.SetText( s );
|
|
||||||
|
|
||||||
m_fUpdateTimer = REFRESH_SECONDS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::DrawPrimitives()
|
|
||||||
{
|
|
||||||
m_Menu.DrawBottomLayer();
|
|
||||||
Screen::DrawPrimitives();
|
|
||||||
m_Menu.DrawTopLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
||||||
{
|
|
||||||
LOG->Trace( "ScreenNetworkWaiting::Input()" );
|
|
||||||
|
|
||||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::HandleScreenMessage( const ScreenMessage SM )
|
|
||||||
{
|
|
||||||
switch( SM )
|
|
||||||
{
|
|
||||||
case SM_ServerGoToNextScreen:
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenNetworkMenu" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::MenuUp( PlayerNumber pn )
|
|
||||||
{
|
|
||||||
m_bReady = true;
|
|
||||||
NetPlayerState ps = { "billy", 100, 100, m_bReady };
|
|
||||||
CLIENT->SendMyPlayerState( ps );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenNetworkWaiting::MenuDown( PlayerNumber pn )
|
|
||||||
{
|
|
||||||
m_bReady = false;
|
|
||||||
NetPlayerState ps = { "billy", 100, 100, m_bReady };
|
|
||||||
CLIENT->SendMyPlayerState( ps );
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenUnlock
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenUnlock : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Unlock"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "unlock"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenWarning
|
||||||
|
|
||||||
|
Desc: Base class for all attraction screens.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenAttract.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenWarning : public ScreenAttract
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual CString GetMetricName() { return "Warning"; }; // used to look up theme metrics
|
||||||
|
virtual CString GetElementName() { return "warning"; }; // used to look up theme elements
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "RageInput.h"
|
#include "RageInput.h"
|
||||||
#include "RageTimer.h"
|
#include "RageTimer.h"
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "RageNetworkClient.h"
|
|
||||||
#include "RageMath.h"
|
#include "RageMath.h"
|
||||||
|
|
||||||
#include "arch/arch.h"
|
#include "arch/arch.h"
|
||||||
@@ -74,11 +73,6 @@ HWND g_hWndMain = NULL;
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
// command line arguments
|
|
||||||
CString g_sSongPath = "";
|
|
||||||
CString g_sServerIP = "";
|
|
||||||
|
|
||||||
const int SM_PORT = 573; // "Ko" + "na" + "mitsu"
|
|
||||||
|
|
||||||
static void ChangeToDirOfExecutable(const char *argv0)
|
static void ChangeToDirOfExecutable(const char *argv0)
|
||||||
{
|
{
|
||||||
@@ -144,16 +138,6 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
atexit(SDL_Quit); /* Clean up on exit */
|
atexit(SDL_Quit); /* Clean up on exit */
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle command line args.
|
|
||||||
* Only allow one command line arg so we can validate the number of
|
|
||||||
* parameters easier.
|
|
||||||
*/
|
|
||||||
if( argc > 1 )
|
|
||||||
g_sSongPath = argv[1];
|
|
||||||
if( argc > 2 )
|
|
||||||
g_sServerIP = argv[2];
|
|
||||||
|
|
||||||
SetUnhandledExceptionFilter(CrashHandler);
|
SetUnhandledExceptionFilter(CrashHandler);
|
||||||
InitThreadData("Main thread");
|
InitThreadData("Main thread");
|
||||||
VDCHECKPOINT;
|
VDCHECKPOINT;
|
||||||
@@ -202,7 +186,6 @@ int main(int argc, char* argv[])
|
|||||||
ANNOUNCER = new AnnouncerManager;
|
ANNOUNCER = new AnnouncerManager;
|
||||||
INPUTFILTER = new InputFilter;
|
INPUTFILTER = new InputFilter;
|
||||||
INPUTMAPPER = new InputMapper;
|
INPUTMAPPER = new InputMapper;
|
||||||
CLIENT = new RageNetworkClient;
|
|
||||||
INPUTQUEUE = new InputQueue;
|
INPUTQUEUE = new InputQueue;
|
||||||
SONGINDEX = new SongCacheIndex;
|
SONGINDEX = new SongCacheIndex;
|
||||||
/* depends on SONGINDEX: */
|
/* depends on SONGINDEX: */
|
||||||
@@ -237,23 +220,9 @@ int main(int argc, char* argv[])
|
|||||||
FONT = new FontManager;
|
FONT = new FontManager;
|
||||||
SCREENMAN = new ScreenManager;
|
SCREENMAN = new ScreenManager;
|
||||||
|
|
||||||
/*
|
|
||||||
* Load initial screen depending on network mode
|
// normal game
|
||||||
*/
|
SCREENMAN->SetNewScreen( "ScreenWarning" );
|
||||||
if( g_sServerIP != "" )
|
|
||||||
{
|
|
||||||
// immediately try to connect to server
|
|
||||||
GAMESTATE->m_pCurSong = SONGMAN->GetSongFromDir( g_sSongPath );
|
|
||||||
if( GAMESTATE->m_pCurSong == NULL )
|
|
||||||
RageException::Throw( "The song '%s' is required to play this network game.", g_sSongPath.GetString() );
|
|
||||||
CLIENT->Connect( (const char*)g_sServerIP, SM_PORT );
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenNetworkWaiting" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// normal game
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run the main loop. */
|
/* Run the main loop. */
|
||||||
GameLoop();
|
GameLoop();
|
||||||
@@ -281,7 +250,6 @@ int main(int argc, char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SAFE_DELETE( SCREENMAN );
|
SAFE_DELETE( SCREENMAN );
|
||||||
SAFE_DELETE( CLIENT );
|
|
||||||
SAFE_DELETE( INPUTQUEUE );
|
SAFE_DELETE( INPUTQUEUE );
|
||||||
SAFE_DELETE( INPUTMAPPER );
|
SAFE_DELETE( INPUTMAPPER );
|
||||||
SAFE_DELETE( INPUTFILTER );
|
SAFE_DELETE( INPUTFILTER );
|
||||||
@@ -428,7 +396,6 @@ static void GameLoop()
|
|||||||
|
|
||||||
TEXTUREMAN->Update( fDeltaTime );
|
TEXTUREMAN->Update( fDeltaTime );
|
||||||
SCREENMAN->Update( fDeltaTime );
|
SCREENMAN->Update( fDeltaTime );
|
||||||
CLIENT->Update( fDeltaTime );
|
|
||||||
SOUNDMAN->Update( fDeltaTime );
|
SOUNDMAN->Update( fDeltaTime );
|
||||||
HandleInputEvents( fDeltaTime );
|
HandleInputEvents( fDeltaTime );
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "SDL.h"
|
|
||||||
#include "RageNetworkServer.h"
|
|
||||||
#include "RageLog.h"
|
|
||||||
|
|
||||||
const int SM_PORT = 573; // "Ko" + "na" + "mitsu"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
SDL_Init(0); /* Fire up the SDL, but don't actually start any subsystems. */
|
|
||||||
|
|
||||||
LOG = new RageLog;
|
|
||||||
LOG->ShowConsole();
|
|
||||||
|
|
||||||
LOG->Trace( "smserver starting up..." );
|
|
||||||
|
|
||||||
|
|
||||||
SERVER = new RageNetworkServer;
|
|
||||||
SERVER->Listen( SM_PORT );
|
|
||||||
|
|
||||||
|
|
||||||
SDL_Event event;
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
// process all queued events
|
|
||||||
while(SDL_PollEvent(&event))
|
|
||||||
{
|
|
||||||
switch(event.type)
|
|
||||||
{
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
SERVER->DisconnectAllClients();
|
|
||||||
exit(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SERVER->Update( 0.1f );
|
|
||||||
SERVER->TellClientsNetGameState();
|
|
||||||
::Sleep( 100 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="smserver" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
|
||||||
|
|
||||||
CFG=smserver - Win32 Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "smserver.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "smserver.mak" CFG="smserver - Win32 Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "smserver - Win32 Release" (based on "Win32 (x86) Application")
|
|
||||||
!MESSAGE "smserver - Win32 Debug" (based on "Win32 (x86) Application")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
|
||||||
MTL=midl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "smserver - Win32 Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "Release"
|
|
||||||
# PROP Intermediate_Dir "Release"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "smserver - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "../"
|
|
||||||
# PROP Intermediate_Dir "Debug"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "smserver - Win32 Release"
|
|
||||||
# Name "smserver - Win32 Debug"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\NetGameState.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageException.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageException.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageLog.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageLog.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageNetworkPacket.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageNetworkServer.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageNetworkServer.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageUtil.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\RageUtil.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\smserver.cpp
|
|
||||||
# End Source File
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "smserver"=.\smserver.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user