2004-03-16 22:34:48 +00:00
|
|
|
#ifndef NetworkSyncManager_H
|
|
|
|
|
#define NetworkSyncManager_H
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: NetworkSyncManager (And netholder)
|
|
|
|
|
|
|
|
|
|
Desc: Uses ezsockets for primitive song syncing and score reporting.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2003-2004 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Charles Lohr
|
|
|
|
|
Joshua Allen
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2004-03-30 05:50:36 +00:00
|
|
|
|
2004-03-30 07:43:12 +00:00
|
|
|
#include "PlayerNumber.h"
|
2004-03-16 22:34:48 +00:00
|
|
|
|
2004-03-17 06:05:52 +00:00
|
|
|
class EzSockets;
|
2004-03-16 22:34:48 +00:00
|
|
|
|
|
|
|
|
class NetworkSyncManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
2004-03-17 06:05:52 +00:00
|
|
|
NetworkSyncManager(int argc, char **argv);
|
2004-03-16 22:34:48 +00:00
|
|
|
~NetworkSyncManager();
|
|
|
|
|
|
2004-03-17 13:31:42 +00:00
|
|
|
//If "useSMserver" then send score to server
|
2004-03-16 22:34:48 +00:00
|
|
|
void ReportScore(int playerID, int step, int score, int combo);
|
|
|
|
|
void ReportSongOver(); //Report to server that song is over
|
|
|
|
|
void StartRequest(); //Request a start. Block until granted.
|
2004-03-17 13:31:42 +00:00
|
|
|
bool Connect(const CString& addy, unsigned short port); // Connect to SM Server
|
2004-03-16 22:34:48 +00:00
|
|
|
|
2004-03-30 05:50:36 +00:00
|
|
|
int m_playerLife[NUM_PLAYERS]; //Life
|
|
|
|
|
|
2004-03-17 13:31:42 +00:00
|
|
|
private:
|
2004-03-16 22:34:48 +00:00
|
|
|
int m_playerID; //these are currently unused, but need to stay
|
|
|
|
|
int m_step;
|
|
|
|
|
int m_score;
|
|
|
|
|
int m_combo;
|
2004-03-30 05:50:36 +00:00
|
|
|
|
2004-03-31 04:18:44 +00:00
|
|
|
bool FlashXMLStyle; //Append 4 0s at end of packet.
|
2004-03-30 05:50:36 +00:00
|
|
|
//For FLASH client.
|
|
|
|
|
|
|
|
|
|
bool useSMserver;
|
|
|
|
|
|
2004-03-17 06:05:52 +00:00
|
|
|
EzSockets *NetPlayerClient;
|
2004-03-25 15:08:07 +00:00
|
|
|
|
|
|
|
|
int m_ServerVersion; //ServerVersion
|
2004-03-30 20:13:22 +00:00
|
|
|
|
|
|
|
|
bool Listen(unsigned short port);
|
|
|
|
|
|
2004-03-17 06:05:52 +00:00
|
|
|
|
|
|
|
|
struct netHolder //Data structure used for sending data to server
|
|
|
|
|
{
|
|
|
|
|
int m_playerID; //PID (also used for Commands)
|
|
|
|
|
int m_step; //SID (StepID, 0-6 for Miss to Marv, 7,8 for boo and ok)
|
|
|
|
|
int m_score; //Player's Score
|
|
|
|
|
int m_combo; //Player's Current Combo
|
2004-03-30 05:50:36 +00:00
|
|
|
int m_life; //Player's Life
|
2004-03-17 06:05:52 +00:00
|
|
|
};
|
2004-03-31 04:18:44 +00:00
|
|
|
|
|
|
|
|
struct netHolderFlash
|
|
|
|
|
{
|
|
|
|
|
char data[73];
|
|
|
|
|
};
|
2004-03-17 06:05:52 +00:00
|
|
|
|
2004-03-16 22:34:48 +00:00
|
|
|
};
|
|
|
|
|
|
2004-03-17 06:05:52 +00:00
|
|
|
extern NetworkSyncManager *NSMAN;
|
2004-03-16 22:34:48 +00:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|