Merge remote-tracking branch 'origin/master' into CPArrow
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ Game::Game(int argc, char* argv[])
|
||||
m_EventBroker = new EventBroker();
|
||||
|
||||
// Create the renderer
|
||||
m_Renderer = new Renderer(m_EventBroker);
|
||||
m_Renderer = new Renderer(m_EventBroker, m_Config);
|
||||
m_Renderer->SetFullscreen(m_Config->Get<bool>("Video.Fullscreen", false));
|
||||
m_Renderer->SetVSYNC(m_Config->Get<bool>("Video.VSYNC", false));
|
||||
m_Renderer->SetResolution(Rectangle::Rectangle(
|
||||
|
||||
@@ -6,7 +6,7 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
|
||||
, PureSystem("CapturePoint")
|
||||
{
|
||||
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
||||
if (!IsClient) {
|
||||
if (IsServer) {
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
||||
@@ -18,7 +18,7 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
|
||||
//NOTE: needs to run each frame, since we're possibly modifying the captureTimer for the capturePoints by dt
|
||||
void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, ComponentWrapper& cCapturePoint, double dt)
|
||||
{
|
||||
if (IsClient) {
|
||||
if (!IsServer) {
|
||||
return;
|
||||
}
|
||||
if (m_WinnerWasFound) {
|
||||
@@ -102,6 +102,13 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
nextPossibleCapturePoint["Blue"] = i - 1;
|
||||
}
|
||||
}
|
||||
if (m_RecentlyCapturedNeedNextCapturePointNow) {
|
||||
m_CapturedEvent.NextCapturePoint = m_CapturedEvent.TeamNumberThatCapturedCapturePoint == blueTeam ?
|
||||
m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Blue"]] :
|
||||
m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Red"]];
|
||||
m_EventBroker->Publish(m_CapturedEvent);
|
||||
m_RecentlyCapturedNeedNextCapturePointNow = false;
|
||||
}
|
||||
|
||||
//reset timers and reset the bool that triggers this
|
||||
if (m_ResetTimers) {
|
||||
@@ -188,10 +195,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
teamComponent["Team"] = currentTeam;
|
||||
cCapturePoint["CaptureTimer"] = glm::sign((double)cCapturePoint["CaptureTimer"])*captureTimeToTakeOver;
|
||||
//publish Captured event
|
||||
Events::Captured e;
|
||||
e.CapturePointID = cCapturePoint.EntityID;
|
||||
e.TeamNumberThatCapturedCapturePoint = currentTeam;
|
||||
m_EventBroker->Publish(e);
|
||||
m_RecentlyCapturedNeedNextCapturePointNow = true;
|
||||
m_CapturedEvent.CapturePointTakenID = cCapturePoint.EntityID;
|
||||
m_CapturedEvent.TeamNumberThatCapturedCapturePoint = currentTeam;
|
||||
//NextPossibleCapturePoint will be calculated in the next update...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ bool SoundSystem::OnCaptured(const Events::Captured & e)
|
||||
if (!LocalPlayer.Valid()) {
|
||||
return false;
|
||||
}
|
||||
int homeTeam = (int)m_World->GetComponent(e.CapturePointID, "Team")["Team"];
|
||||
int homeTeam = (int)m_World->GetComponent(e.CapturePointTakenID, "Team")["Team"];
|
||||
int team = (int)m_World->GetComponent(LocalPlayer.ID, "Team")["Team"];
|
||||
Events::PlaySoundOnEntity ev;
|
||||
if (team == homeTeam) {
|
||||
|
||||
@@ -9,7 +9,9 @@ int main(int argc, char* argv[])
|
||||
|
||||
Game game(argc, argv);
|
||||
while (game.Running()) {
|
||||
PerformanceTimer::StartTimer("Game-Tick");
|
||||
game.Tick();
|
||||
PerformanceTimer::StopTimer("Game-Tick");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user