diff options
| author | oy <Tom_Adams@web.de> | 2011-12-04 14:34:27 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-12-04 14:39:47 +0100 |
| commit | 9a03989e84c8d2719801889738c6af68864aba10 (patch) | |
| tree | c63debba2e7d849d615f0d5db9f1f8f4a816838d | |
| parent | b2a825652d8588dfb7f1c793403ca05555b1d75f (diff) | |
| download | zcatch-9a03989e84c8d2719801889738c6af68864aba10.tar.gz zcatch-9a03989e84c8d2719801889738c6af68864aba10.zip | |
added "Make an option for each envelope: (a) synchronized (b) starting at join" by Choupom
| -rw-r--r-- | src/game/client/components/maplayers.cpp | 13 | ||||
| -rw-r--r-- | src/game/editor/editor.cpp | 11 | ||||
| -rw-r--r-- | src/game/editor/editor.h | 2 | ||||
| -rw-r--r-- | src/game/editor/io.cpp | 5 | ||||
| -rw-r--r-- | src/game/mapitems.h | 8 |
5 files changed, 33 insertions, 6 deletions
diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 48f11f26..a1e629a6 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -99,10 +99,15 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void } else { - if(pThis->m_pClient->m_Snap.m_pGameInfoObj) - Time = mix((pThis->Client()->PrevGameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), - (pThis->Client()->GameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), - pThis->Client()->IntraGameTick()); + if(pItem->m_Version < 2 || pItem->m_Synchronized) + { + if(pThis->m_pClient->m_Snap.m_pGameInfoObj) + Time = mix((pThis->Client()->PrevGameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), + (pThis->Client()->GameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(), + pThis->Client()->IntraGameTick()); + } + else + Time = pThis->Client()->LocalTime(); pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, Time+TimeOffset, pChannels); } } diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 4f4096a9..d2a00d0d 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -3179,6 +3179,17 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(DoButton_Editor(&s_aChannelButtons[i], s_paNames[pEnvelope->m_Channels-3][i], s_ActiveChannels&Bit, &Button, 0, paDescriptions[pEnvelope->m_Channels-3][i])) s_ActiveChannels ^= Bit; } + + // sync checkbox + ToolBar.VSplitLeft(15.0f, &Button, &ToolBar); + ToolBar.VSplitLeft(12.0f, &Button, &ToolBar); + static int s_SyncButton; + if(DoButton_Editor(&s_SyncButton, pEnvelope->m_Synchronized?"X":"", 0, &Button, 0, "Enable envelope synchronization between clients")) + pEnvelope->m_Synchronized = !pEnvelope->m_Synchronized; + + ToolBar.VSplitLeft(4.0f, &Button, &ToolBar); + ToolBar.VSplitLeft(80.0f, &Button, &ToolBar); + UI()->DoLabel(&Button, "Synchronized", 10.0f, -1, -1); } float EndTime = pEnvelope->EndTime(); diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h index 1f09b0bc..f5d43dae 100644 --- a/src/game/editor/editor.h +++ b/src/game/editor/editor.h @@ -51,6 +51,7 @@ public: array<CEnvPoint> m_lPoints; char m_aName[32]; float m_Bottom, m_Top; + bool m_Synchronized; CEnvelope(int Chan) { @@ -58,6 +59,7 @@ public: m_aName[0] = 0; m_Bottom = 0; m_Top = 0; + m_Synchronized = true; } void Resort() diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index 68330f03..aec7231b 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -342,10 +342,11 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) for(int e = 0; e < m_lEnvelopes.size(); e++) { CMapItemEnvelope Item; - Item.m_Version = 1; + Item.m_Version = CMapItemEnvelope::CURRENT_VERSION; Item.m_Channels = m_lEnvelopes[e]->m_Channels; Item.m_StartPoint = PointCount; Item.m_NumPoints = m_lEnvelopes[e]->m_lPoints.size(); + Item.m_Synchronized = m_lEnvelopes[e]->m_Synchronized; StrToInts(Item.m_aName, sizeof(Item.m_aName)/sizeof(int), m_lEnvelopes[e]->m_aName); df.AddItem(MAPITEMTYPE_ENVELOPE, e, sizeof(Item), &Item); @@ -601,6 +602,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag if(pItem->m_aName[0] != -1) // compatibility with old maps IntsToStr(pItem->m_aName, sizeof(pItem->m_aName)/sizeof(int), pEnv->m_aName); m_lEnvelopes.add(pEnv); + if(pItem->m_Version >= 2) + pEnv->m_Synchronized = pItem->m_Synchronized; } } } diff --git a/src/game/mapitems.h b/src/game/mapitems.h index 43005f75..bb2f4d19 100644 --- a/src/game/mapitems.h +++ b/src/game/mapitems.h @@ -178,7 +178,7 @@ struct CEnvPoint bool operator<(const CEnvPoint &Other) { return m_Time < Other.m_Time; } } ; -struct CMapItemEnvelope +struct CMapItemEnvelope_v1 { int m_Version; int m_Channels; @@ -187,4 +187,10 @@ struct CMapItemEnvelope int m_aName[8]; } ; +struct CMapItemEnvelope : public CMapItemEnvelope_v1 +{ + enum { CURRENT_VERSION=2 }; + int m_Synchronized; +}; + #endif |