Files
itgmania212121/stepmania/src/NetworkSyncManager.h
T

108 lines
3.3 KiB
C++
Raw Normal View History

2004-06-08 01:24:17 +00:00
/* NetworkSyncManager - Uses ezsockets for primitive song syncing and score reporting. */
#ifndef NetworkSyncManager_H
#define NetworkSyncManager_H
2004-03-30 07:43:12 +00:00
#include "PlayerNumber.h"
2004-03-17 06:05:52 +00:00
class EzSockets;
class NetworkSyncManager
{
public:
NetworkSyncManager();
~NetworkSyncManager();
2004-03-17 13:31:42 +00:00
//If "useSMserver" then send score to server
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
void SendSongs(); //Send song list to server (And exit)
void PostStartUp(CString ServerIP);
void CloseConnection();
void DisplayStartupStatus(); //Used to note user if connect attempt was sucessful or not.
int m_playerLife[NUM_PLAYERS]; //Life
void Update(float fDeltaTime);
2004-03-17 13:31:42 +00:00
private:
#if !defined(WITHOUT_NETWORKING)
void StartUp();
int m_playerID; //these are currently unused, but need to stay
int m_step;
int m_score;
int m_combo;
int m_startupStatus; //Used to see if attempt was sucessful or not.
bool useSMserver;
2004-03-17 06:05:52 +00:00
EzSockets *NetPlayerClient;
int m_ServerVersion; //ServerVersion
bool Listen(unsigned short port);
2004-03-17 06:05:52 +00:00
struct netHolder //Data structure used for sending data to server
{
//NOTICE: Order of variables in this struct matters
//if order is changed, server would need to be re-written
2004-03-17 06:05:52 +00:00
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-05-05 05:41:51 +00:00
int m_life; //Player's Life (AND GRADE)
//m_life = [16-bit int life] <- LSB [16-bit int grade] <-MSB
2004-03-17 06:05:52 +00:00
};
2004-03-31 04:18:44 +00:00
struct netName //Data structure used for 16-character strings.
{
int m_packID;
char m_data[16];
};
2004-03-31 04:18:44 +00:00
struct netHolderFlash
{
char data[73];
};
2004-06-15 02:21:16 +00:00
#endif
};
2004-03-17 06:05:52 +00:00
extern NetworkSyncManager *NSMAN;
#endif
2004-06-08 01:24:17 +00:00
/*
* (c) 2003-2004 Charles Lohr, Joshua Allen
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/