Added hit offset, for better statistics for SMLAN/SMOnline.

This commit is contained in:
Charles Lohr
2004-08-10 06:39:25 +00:00
parent bdb15e07a7
commit 5929cf4e49
3 changed files with 30 additions and 0 deletions
+22
View File
@@ -183,6 +183,10 @@ bool NetworkSyncManager::Listen(unsigned short port)
}
void NetworkSyncManager::ReportTiming(float offset, int PlayerNumber)
{
m_lastOffset[PlayerNumber] = offset;
}
void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo)
{
@@ -205,6 +209,24 @@ void NetworkSyncManager::ReportScore(int playerID, int step, int score, int comb
Write2(m_packet, (uint16_t) m_playerLife[playerID]);
//Offset Info
//Note: if a 0 is sent, then disregard data.
//
//ASSUMED: No step will be more than 16 seconds off center
//If assumption false: read 16 seconds either direction
int iOffset = int((m_lastOffset[playerID]+16.384)*2000.0);
if (iOffset>65535)
iOffset=65535;
if (iOffset<1)
iOffset=1;
//Report 0 if hold, or miss (don't forget mines should report)
if (((step<TNS_BOO)||(step>TNS_MARVELOUS))&&(step!=TNS_HIT_MINE))
iOffset = 0;
Write2(m_packet, (uint16_t) iOffset);
NetPlayerClient->SendPack((char*)m_packet.Data, m_packet.Position);
}
+4
View File
@@ -17,6 +17,7 @@ public:
~NetworkSyncManager();
//If "useSMserver" then send score to server
void ReportTiming(float offset, int PlayerNumber);
void ReportScore(int playerID, int step, int score, int combo);
void ReportSongOver(); //Report to server that song is over
void StartRequest(short position); //Request a start. Block until granted.
@@ -39,6 +40,9 @@ private:
void StartUp();
float m_lastOffset[2]; //This is used to determine how much
//the last step was off.
int m_playerID; //these are currently unused, but need to stay
int m_step;
int m_score;
+4
View File
@@ -25,6 +25,7 @@
#include "StageStats.h"
#include "ArrowEffects.h"
#include "Game.h"
#include "NetworkSyncManager.h" //used for sending timing offset
CachedThemeMetricF GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
@@ -853,6 +854,9 @@ void PlayerMinus::Step( int col, RageTimer tm )
score >= TNS_GREAT )
HandleAutosync(fNoteOffset);
//Keep this here so we get the same data as Autosync
NSMAN->ReportTiming(fNoteOffset,m_PlayerNumber);
if( m_pPrimaryScoreKeeper )
m_pPrimaryScoreKeeper->HandleTapScore( score );
if( m_pSecondaryScoreKeeper )