Differentiated between starts. Added course support. Fixed course Crashing bug.

This commit is contained in:
Charles Lohr
2004-07-15 16:17:41 +00:00
parent 7b196e492e
commit cf5577455a
3 changed files with 24 additions and 8 deletions
+18 -2
View File
@@ -11,7 +11,7 @@ void NetworkSyncManager::PostStartUp( CString ServerIP ) { }
bool NetworkSyncManager::Connect(const CString& addy, unsigned short port) { return false; } bool NetworkSyncManager::Connect(const CString& addy, unsigned short port) { return false; }
void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo) { } void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo) { }
void NetworkSyncManager::ReportSongOver() { } void NetworkSyncManager::ReportSongOver() { }
void NetworkSyncManager::StartRequest() { } void NetworkSyncManager::StartRequest(int position) { }
void NetworkSyncManager::DisplayStartupStatus() { } void NetworkSyncManager::DisplayStartupStatus() { }
void NetworkSyncManager::Update( float fDeltaTime ) { } void NetworkSyncManager::Update( float fDeltaTime ) { }
@@ -22,6 +22,7 @@ void NetworkSyncManager::Update( float fDeltaTime ) { }
#include "StepMania.h" #include "StepMania.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "song.h" #include "song.h"
#include "Course.h"
#include "GameState.h" #include "GameState.h"
#include "StageStats.h" #include "StageStats.h"
#include "Steps.h" #include "Steps.h"
@@ -222,7 +223,7 @@ void NetworkSyncManager::ReportSongOver()
return; return;
} }
void NetworkSyncManager::StartRequest() void NetworkSyncManager::StartRequest(short position)
{ {
if (!useSMserver) if (!useSMserver)
return ; return ;
@@ -249,9 +250,24 @@ void NetworkSyncManager::StartRequest()
Write1(m_packet,ctr); Write1(m_packet,ctr);
//Notify server if this is for sync or not.
ctr = position*16;
Write1(m_packet,ctr);
if (GAMESTATE->m_pCurSong !=NULL) {
WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sMainTitle); WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sMainTitle);
WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sSubTitle); WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sSubTitle);
WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sArtist); WriteNT(m_packet,GAMESTATE->m_pCurSong->m_sArtist);
} else {
WriteNT(m_packet,"");
WriteNT(m_packet,"");
WriteNT(m_packet,"");
}
if (GAMESTATE->m_pCurCourse != NULL)
WriteNT(m_packet,GAMESTATE->m_pCurCourse->GetFullDisplayTitle());
else
WriteNT(m_packet,CString(""));
NetPlayerClient->SendPack((char*)&m_packet.Data, m_packet.Position); NetPlayerClient->SendPack((char*)&m_packet.Data, m_packet.Position);
+1 -1
View File
@@ -19,7 +19,7 @@ public:
//If "useSMserver" then send score to server //If "useSMserver" then send score to server
void ReportScore(int playerID, int step, int score, int combo); void ReportScore(int playerID, int step, int score, int combo);
void ReportSongOver(); //Report to server that song is over void ReportSongOver(); //Report to server that song is over
void StartRequest(); //Request a start. Block until granted. void StartRequest(short position); //Request a start. Block until granted.
bool Connect(const CString& addy, unsigned short port); // Connect to SM Server bool Connect(const CString& addy, unsigned short port); // Connect to SM Server
void PostStartUp(CString ServerIP); void PostStartUp(CString ServerIP);
+2 -2
View File
@@ -382,7 +382,7 @@ void ScreenGameplay::Init()
// if you wait too long at the second checkpoint, you will // if you wait too long at the second checkpoint, you will
// appear dead when you begin your game. // appear dead when you begin your game.
// //
NSMAN->StartRequest(); NSMAN->StartRequest(0);
@@ -1059,7 +1059,7 @@ float ScreenGameplay::StartPlayingSong(float MinTimeToNotes, float MinTimeToMusi
//Secondary (Precice) start request //Secondary (Precice) start request
//used for syncing up songs. //used for syncing up songs.
NSMAN->StartRequest(); NSMAN->StartRequest(1);
m_soundMusic.Play( &p ); m_soundMusic.Play( &p );