#Preliminary end game conditions; cinematic and trigger fixes
Cinematic editor is less clumsy. Forward and backward buttons now move the camera to the next and previous nodes. This was SVN commit r5000.
This commit is contained in:
parent
ab22765232
commit
684dbbe9ba
@ -922,6 +922,7 @@ A large landmass with rivers, forests and coastal fishing grounds.
|
||||
getCurrItemValue("pgSessionSetupMapName"),
|
||||
losSetting,
|
||||
fowEnabled,
|
||||
getCurrItemValue("pgSessionSetupGameMode"),
|
||||
getGUIObjectByName("pgSessionSetupScreenshotMode").checked,
|
||||
"pgSessionSetup");
|
||||
]]></action>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function startMap (mapName, losSetting, fogOfWar, screenshotMode, openWindow)
|
||||
function startMap (mapName, losSetting, fogOfWar, gameMode, screenshotMode, openWindow)
|
||||
{
|
||||
// Starts the map, closing the current window.
|
||||
// mapName: .pmp to load.
|
||||
@ -23,6 +23,7 @@ function startMap (mapName, losSetting, fogOfWar, screenshotMode, openWindow)
|
||||
g_GameAttributes.mapFile = mapName;
|
||||
g_GameAttributes.losSetting = losSetting;
|
||||
g_GameAttributes.fogOfWar = fogOfWar;
|
||||
g_GameAttributes.gameMode = gameMode
|
||||
g_GameAttributes.screenshotMode = screenshotMode;
|
||||
|
||||
// Close setup window
|
||||
|
@ -14,7 +14,7 @@
|
||||
</Parameter>
|
||||
<Parameter name ="awesome">
|
||||
<Window type="choice" position ="0,0" size="80, 20"/>
|
||||
<Choices>holy,crap,comma,seperated,choices</Choices>
|
||||
<Choices>holy,crap,comma,separated,choices</Choices>
|
||||
<ParameterOrder>0</ParameterOrder>
|
||||
</Parameter>
|
||||
</WindowRow>
|
||||
@ -76,6 +76,30 @@
|
||||
|
||||
</WindowRow>
|
||||
</Condition>
|
||||
|
||||
<Condition name = "Significant entities" function = "trigPlayerSigEntities" funcParameters = "1">
|
||||
<WindowRow>
|
||||
|
||||
<Parameter name = "Player">
|
||||
<Window type="choice" position = "0,0" size = "80, 20"/>
|
||||
<Choices>1,2,3,4,5,6</Choices>
|
||||
<ParameterOrder>0</ParameterOrder>
|
||||
</Parameter>
|
||||
|
||||
<Parameter name = "Operator">
|
||||
<Window type="choice" position = "5,0" size = "80, 20"/>
|
||||
<Choices><,<=,==,!=,>=,></Choices>
|
||||
<ParameterOrder>1</ParameterOrder>
|
||||
</Parameter>
|
||||
|
||||
<Parameter name = "Value">
|
||||
<Window type="text" position = "5,0" size = "80, 20"/>
|
||||
<InputType>int</InputType>
|
||||
<ParameterOrder>2</ParameterOrder>
|
||||
</Parameter>
|
||||
|
||||
</WindowRow>
|
||||
</Condition>
|
||||
|
||||
|
||||
<Effect name ="Text" function = "console.write" funcParameters = "1">
|
||||
|
@ -39,6 +39,51 @@ for(var i=0; i<players.length; i++)
|
||||
tech.applyEffects( false, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*var gameMode = getGameMode();
|
||||
//Create end game trigger based on game type
|
||||
|
||||
var endGameConquestFunction =
|
||||
function()
|
||||
{
|
||||
TODO: Needs player alliance information with team numbers for determining defeated teams.
|
||||
Also needs local player ID to end game on 'this' computer. Also, receive pplayer set
|
||||
size from somewhere, don't assume 6
|
||||
|
||||
var livePlayers = new Array();
|
||||
for ( var i = 1; i < 7; ++i )
|
||||
{
|
||||
if ( trigPlayerSigEntities(i) <= 0 )
|
||||
{
|
||||
//if ( isPlayerAlive(i) == true ) { killPlayer(i); }
|
||||
}
|
||||
else
|
||||
livePlayers[i] = true;
|
||||
}
|
||||
|
||||
var gameOver = true;
|
||||
var playerSet = getPlayerSet();
|
||||
|
||||
//Go through and find team numbers (of alliance) - test against every other team number for enemies - if found, game is not done.
|
||||
for ( var i = 0; i < livePlayers.length; ++i )
|
||||
{
|
||||
for ( var j = 0; j < livePlayers.length; ++j )
|
||||
{
|
||||
if ( playerSet[i].getDiplomaticStance(j) == DIPLOMACY_ENEMY )
|
||||
return;
|
||||
}
|
||||
}
|
||||
endGame()
|
||||
}
|
||||
|
||||
|
||||
if ( gameMode == "Conquest" )
|
||||
{
|
||||
registerTrigger(
|
||||
Trigger("END_GAME_TRIGGER", true, 0.0, -1, endGameConquestFunction, trigEndGame ) );
|
||||
}
|
||||
*/
|
||||
|
||||
console.write( "Game startup script done." );
|
||||
|
||||
|
@ -14,6 +14,19 @@ function trigPlayerUnitCount(player, unit)
|
||||
return unitCount;
|
||||
}
|
||||
|
||||
//Loop through player's unit list and check for significant entities i.e. units or buildings which can produce units
|
||||
function trigPlayerSigEntities(player)
|
||||
{
|
||||
var unitNames = new Array(3);
|
||||
Array[0] = "Unit";
|
||||
Array[1] = "Town";
|
||||
Array[2] = "CivilCentre"; //(May need to be expanded)
|
||||
var sum = 0;
|
||||
for ( var i = 0; i < unitNames.length; ++i )
|
||||
sum += getPlayerUnitCount(player, Array[i]);
|
||||
return sum;
|
||||
}
|
||||
|
||||
//Effects
|
||||
|
||||
function trigObjectTask(subjects, target, task)
|
||||
@ -29,3 +42,8 @@ function trigObjectGoto(subjects, destination)
|
||||
getEntityByUnitID(subjects[i]).orderFromTriggers(
|
||||
ORDER_GOTO, destination.x, destination.y);
|
||||
}
|
||||
|
||||
function trigEndGame()
|
||||
{
|
||||
console.write("The game has ended...We can pretend, anyway");
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ float CCinemaPath::EaseSine(float t) const
|
||||
|
||||
bool CCinemaPath::Validate()
|
||||
{
|
||||
if ( m_TimeElapsed < GetDuration() && m_TimeElapsed > 0.0f )
|
||||
if ( m_TimeElapsed <= GetDuration() && m_TimeElapsed >= 0.0f )
|
||||
{
|
||||
//Find current node and past "node time"
|
||||
float previousTime = 0.0f, cumulation = 0.0f;
|
||||
@ -209,7 +209,7 @@ bool CCinemaPath::Validate()
|
||||
for ( size_t i = 0; i < Node.size() - 1; ++i )
|
||||
{
|
||||
cumulation += Node[i].Distance;
|
||||
if ( m_TimeElapsed < cumulation )
|
||||
if ( m_TimeElapsed <= cumulation )
|
||||
{
|
||||
m_PreviousNodeTime = previousTime;
|
||||
m_PreviousRotation = Node[i].Rotation;
|
||||
@ -228,16 +228,19 @@ bool CCinemaPath::Play(float DeltaTime)
|
||||
m_TimeElapsed += m_Timescale*DeltaTime;
|
||||
|
||||
if (!Validate())
|
||||
{
|
||||
m_TimeElapsed = 0.0f;
|
||||
return false;
|
||||
}
|
||||
|
||||
MoveToPointAt( m_TimeElapsed / GetDuration(), GetNodeFraction(), m_PreviousRotation );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
CCinemaManager::CCinemaManager() : m_DrawCurrentSpline(false), m_Active(true)
|
||||
CCinemaManager::CCinemaManager() : m_DrawCurrentSpline(false), m_Active(true), m_ValidCurrent(false)
|
||||
{
|
||||
m_CurrentPath = m_Paths.end();
|
||||
m_CurrentPath = m_Paths.end();
|
||||
}
|
||||
|
||||
void CCinemaManager::AddPath(CCinemaPath path, const CStrW& name)
|
||||
@ -273,7 +276,11 @@ void CCinemaManager::SetAllPaths( const std::map<CStrW, CCinemaPath>& paths)
|
||||
}
|
||||
void CCinemaManager::SetCurrentPath(const CStrW& name, bool current, bool drawLines)
|
||||
{
|
||||
debug_assert(HasTrack(name));
|
||||
if ( !HasTrack(name) )
|
||||
m_ValidCurrent = false;
|
||||
else
|
||||
m_ValidCurrent = true;
|
||||
|
||||
m_CurrentPath = m_Paths.find(name);
|
||||
m_DrawCurrentSpline = current;
|
||||
m_DrawLines = drawLines;
|
||||
@ -287,7 +294,7 @@ bool CCinemaManager::HasTrack(const CStrW& name) const
|
||||
|
||||
void CCinemaManager::DrawSpline() const
|
||||
{
|
||||
if ( !(m_DrawCurrentSpline || m_CurrentPath != m_Paths.end()) )
|
||||
if ( !(m_DrawCurrentSpline && m_ValidCurrent) )
|
||||
return;
|
||||
static const int smoothness = 200;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
bool m_Active, m_DrawCurrentSpline, m_DrawLines;
|
||||
bool m_Active, m_DrawCurrentSpline, m_DrawLines, m_ValidCurrent;
|
||||
std::map<CStrW, CCinemaPath>::iterator m_CurrentPath;
|
||||
std::map<CStrW, CCinemaPath> m_Paths;
|
||||
std::list<CCinemaPath> m_PathQueue;
|
||||
|
@ -484,35 +484,19 @@ void CMapWriter::WriteTrigger(XMLWriter_File& xml_file_, const MapTrigger& trigg
|
||||
for ( std::list<CStrW>::const_iterator paramIter = it2->parameters.begin();
|
||||
paramIter != it2->parameters.end(); ++paramIter )
|
||||
{
|
||||
if ( it2->negated )
|
||||
XML_Attribute("not", "true");
|
||||
else
|
||||
XML_Attribute("not", "false");
|
||||
|
||||
XML_Setting("function", it2->functionName);
|
||||
XML_Setting("display", it2->displayName);
|
||||
for ( std::list<CStrW>::const_iterator paramIter = it2->parameters.begin();
|
||||
paramIter != it2->parameters.end(); ++paramIter )
|
||||
{
|
||||
CStrW paramString(*paramIter);
|
||||
paramString.Replace(CStrW(L"<"), CStrW(L"<"));
|
||||
paramString.Replace(CStrW(L">"), CStrW(L">"));
|
||||
XML_Setting("Parameter", paramString);
|
||||
}
|
||||
|
||||
if ( it2->linkLogic == 1 )
|
||||
{
|
||||
XML_Setting("LinkLogic", "AND");
|
||||
}
|
||||
else if ( it2->linkLogic == 2 )
|
||||
{
|
||||
XML_Setting("LinkLogic", "OR");
|
||||
}
|
||||
CStrW paramString(*paramIter);
|
||||
//paramString.Replace(CStrW(L"<"), CStrW(L"<"));
|
||||
//paramString.Replace(CStrW(L">"), CStrW(L">"));
|
||||
XML_Setting("Parameter", paramString);
|
||||
}
|
||||
if ( it2->linkLogic == 1 )
|
||||
XML_Setting("LinkLogic", "AND");
|
||||
else if ( it2->linkLogic == 2 )
|
||||
XML_Setting("LinkLogic", "OR");
|
||||
|
||||
if ( trigger.logicBlockEnds.find(distance) != trigger.logicBlockEnds.end() )
|
||||
{
|
||||
if ( trigger.logicBlockEnds.find(distance) != trigger.logicBlockEnds.end() )
|
||||
{
|
||||
XML_Element("LogicBlockEnd");
|
||||
}
|
||||
}
|
||||
}
|
||||
} //Read all conditions
|
||||
|
@ -223,14 +223,14 @@ bool CGame::Update(double deltaTime, bool doInterpolate)
|
||||
|
||||
// TODO Detect game over and bring up the summary screen or something
|
||||
// ^ Quick game over hack is implemented, no summary screen however
|
||||
if (m_World->GetEntityManager().GetDeath())
|
||||
/*if (m_World->GetEntityManager().GetDeath())
|
||||
{
|
||||
UpdateGameStatus();
|
||||
if (GameStatus != 0)
|
||||
EndGame();
|
||||
}
|
||||
//reset death event flag
|
||||
m_World->GetEntityManager().SetDeath(false);
|
||||
m_World->GetEntityManager().SetDeath(false);*/
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -239,6 +239,7 @@ bool CGame::Update(double deltaTime, bool doInterpolate)
|
||||
* Test player statistics and update game status as required.
|
||||
*
|
||||
**/
|
||||
/*
|
||||
void CGame::UpdateGameStatus()
|
||||
{
|
||||
bool EOG_lose = true;
|
||||
@ -275,7 +276,7 @@ void CGame::UpdateGameStatus()
|
||||
GameStatus = EOG_LOSE;
|
||||
else
|
||||
GameStatus = EOG_NEUTRAL;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* End of game console message creation.
|
||||
|
@ -187,6 +187,7 @@ CGameAttributes::CGameAttributes():
|
||||
m_StartingPhase("default"),
|
||||
m_LOSSetting(0),
|
||||
m_FogOfWar(true),
|
||||
m_GameMode("default"),
|
||||
m_ScreenshotMode(false),
|
||||
m_NumSlots(8),
|
||||
m_UpdateCB(NULL),
|
||||
@ -207,6 +208,7 @@ CGameAttributes::CGameAttributes():
|
||||
AddSynchedProperty(L"numSlots", &m_NumSlots, &CGameAttributes::OnNumSlotsUpdate);
|
||||
AddSynchedProperty(L"losSetting", &m_LOSSetting);
|
||||
AddSynchedProperty(L"fogOfWar", &m_FogOfWar);
|
||||
AddSynchedProperty(L"gameMode", &m_GameMode);
|
||||
AddSynchedProperty(L"screenshotMode", &m_ScreenshotMode);
|
||||
|
||||
CXeromyces XeroFile;
|
||||
|
@ -118,6 +118,7 @@ public:
|
||||
CStrW m_MapFile;
|
||||
CStrW m_ResourceLevel;
|
||||
CStrW m_StartingPhase;
|
||||
CStrW m_GameMode;
|
||||
uint m_LOSSetting;
|
||||
bool m_FogOfWar;
|
||||
bool m_ScreenshotMode;
|
||||
@ -167,6 +168,9 @@ public:
|
||||
inline uint GetSlotCount()
|
||||
{ return m_NumSlots; }
|
||||
|
||||
inline CStrW GetGameMode()
|
||||
{ return m_GameMode; }
|
||||
|
||||
// Remove all slots that are either opened or closed, so that all slots have
|
||||
// an assignment and a player. Player IDs will be assigned in the same order
|
||||
// as the slot indexes, but without holes in the numbering.
|
||||
|
@ -183,7 +183,7 @@ JSBool getPlayerUnitCount( JSContext* cx, JSObject*, uint argc, jsval* argv, jsv
|
||||
CStrW unitName = ToPrimitive<CStrW>( argv[1] );
|
||||
|
||||
unitCount = g_EntityManager.getPlayerUnitCount((size_t)playerNum, unitName);
|
||||
*rval = ToJSVal<int>( unitCount );
|
||||
*rval = ToJSVal( unitCount );
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -758,6 +758,13 @@ JSBool endGame(JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool getGameMode(JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval)
|
||||
{
|
||||
JSU_REQUIRE_NO_PARAMS();
|
||||
|
||||
*rval = ToJSVal( g_GameAttributes.GetGameMode() );
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Internationalization
|
||||
@ -1392,6 +1399,8 @@ JSFunctionSpec ScriptFunctionTable[] =
|
||||
JS_FUNC(removeFromFormation, removeFromFormation, 1)
|
||||
JS_FUNC(lockEntityFormation, lockEntityFormation, 1)
|
||||
JS_FUNC(isFormationLocked, isFormationLocked, 1)
|
||||
|
||||
JS_FUNC(registerTrigger, registerTrigger, 1)
|
||||
|
||||
//Tech
|
||||
JS_FUNC(getTechnology, getTechnology, 2)
|
||||
@ -1444,6 +1453,7 @@ JSFunctionSpec ScriptFunctionTable[] =
|
||||
// Game Setup
|
||||
JS_FUNC(startGame, startGame, 0)
|
||||
JS_FUNC(endGame, endGame, 0)
|
||||
JS_FUNC(getGameMode, getGameMode, 0)
|
||||
JS_FUNC(createClient, createClient, 0)
|
||||
JS_FUNC(createServer, createServer, 0)
|
||||
|
||||
|
@ -260,6 +260,8 @@ void CEntity::kill(bool keepActor)
|
||||
g_EntityManager.m_refd[me.m_handle] = false; // refd must be made false when DESTROYED is set
|
||||
g_EntityManager.SetDeath(true); // remember that a unit died this frame
|
||||
|
||||
g_EntityManager.removeUnitCount(this); //Decrease population
|
||||
|
||||
// If we have a death animation and want to keep the actor, play that animation
|
||||
if( keepActor && m_actor &&
|
||||
m_actor->HasAnimation( "death" ) )
|
||||
|
@ -123,6 +123,10 @@ void CEntityManager::AddEntityClassData(const HEntity& handle)
|
||||
++m_entityClassData[playerID][className];
|
||||
classList = classList.AfterFirst(L" ");
|
||||
}
|
||||
|
||||
//For last element
|
||||
if ( m_entityClassData[playerID].find(className) == m_entityClassData[playerID].end() )
|
||||
m_entityClassData[playerID][className] = 0;
|
||||
++m_entityClassData[playerID][className];
|
||||
}
|
||||
|
||||
@ -349,12 +353,9 @@ void CEntityManager::invalidateAll()
|
||||
m_entities[i].m_entity->invalidateActor();
|
||||
}
|
||||
|
||||
void CEntityManager::destroy( u16 handle )
|
||||
|
||||
void CEntityManager::removeUnitCount(CEntity* ent)
|
||||
{
|
||||
m_reaper.push_back( m_entities[handle].m_entity );
|
||||
|
||||
//Remove trigger-helper data
|
||||
CEntity* ent = m_entities[handle].m_entity;
|
||||
size_t playerID = (size_t)ent->GetPlayer()->GetPlayerID();
|
||||
CStrW className, classList = ent->m_classes.getMemberList();
|
||||
|
||||
@ -364,8 +365,10 @@ void CEntityManager::destroy( u16 handle )
|
||||
classList = classList.AfterFirst(L" ");
|
||||
}
|
||||
--m_entityClassData[playerID][className];
|
||||
|
||||
ent->me.m_handle = INVALID_HANDLE;
|
||||
}
|
||||
void CEntityManager::destroy( u16 handle )
|
||||
{
|
||||
m_reaper.push_back( m_entities[handle].m_entity );
|
||||
}
|
||||
|
||||
bool CEntityManager::m_extant = false;
|
||||
|
@ -82,8 +82,11 @@ public:
|
||||
|
||||
inline int getPlayerUnitCount( size_t player, const CStrW& name )
|
||||
{
|
||||
if ( m_entityClassData[player].find(name) == m_entityClassData[player].end() )
|
||||
m_entityClassData[player][name] = 0;
|
||||
return m_entityClassData[player][name];
|
||||
}
|
||||
void removeUnitCount(CEntity* ent); //Removes unit from population count
|
||||
void AddEntityClassData(const HEntity& handle);
|
||||
|
||||
void updateAll( size_t timestep );
|
||||
|
@ -54,8 +54,8 @@ JSBool CTrigger::Construct( JSContext* cx, JSObject* UNUSED(obj), uint argc, jsv
|
||||
CScriptObject effectFunc( JS_ValueToFunction(cx, argv[5]) );
|
||||
CTrigger* newTrigger = new CTrigger( ToPrimitive<CStr>( argv[0] ),
|
||||
ToPrimitive<bool>( argv[1] ),
|
||||
ToPrimitive<int>( argv[2] ),
|
||||
ToPrimitive<float>( argv[3] ),
|
||||
ToPrimitive<float>( argv[2] ),
|
||||
ToPrimitive<int>( argv[3]),
|
||||
condFunc, effectFunc );
|
||||
|
||||
g_TriggerManager.AddTrigger(newTrigger);
|
||||
@ -191,7 +191,7 @@ void CTriggerManager::Update(float delta_ms)
|
||||
//Remove all expired triggers
|
||||
for ( std::list<TriggerIter>::iterator it = expired.begin(); it != expired.end(); ++it )
|
||||
{
|
||||
delete (*it)->second;;
|
||||
delete (*it)->second;
|
||||
m_TriggerMap.erase(*it);
|
||||
}
|
||||
}
|
||||
|
@ -271,8 +271,11 @@ void SectionLayout::Build()
|
||||
ADD_SIDEBAR(TerrainSidebar, _T("terrain.png"), _("Terrain"));
|
||||
ADD_SIDEBAR(ObjectSidebar, _T("object.png"), _("Object"));
|
||||
ADD_SIDEBAR(EnvironmentSidebar, _T("environment.png"), _("Environment"));
|
||||
ADD_SIDEBAR(CinematicSidebar, _T("cinematic.png"), _("Cinema"));
|
||||
ADD_SIDEBAR(TriggerSidebar, _T("trigger.png"), _("Trigger"));
|
||||
|
||||
#ifndef ATLAS_PUBLIC_RELEASE
|
||||
ADD_SIDEBAR(CinematicSidebar, _T("cinematic.png"), _("Cinema"));
|
||||
ADD_SIDEBAR(TriggerSidebar, _T("trigger.png"), _("Trigger"));
|
||||
#endif
|
||||
|
||||
#undef ADD_SIDEBAR
|
||||
|
||||
|
@ -142,7 +142,7 @@ public:
|
||||
qGetCameraInfo qry;
|
||||
qry.Post();
|
||||
sCameraInfo info = qry.info;
|
||||
m_Sidebar->UpdateNode(info.pX, info.pY, info.pZ, info.rX, info.rY, info.rZ, -1.f);
|
||||
m_Sidebar->UpdateNode(info.pX, info.pY, info.pZ, info.rX, info.rY, info.rZ, true, -1.f);
|
||||
}
|
||||
void GotoNode()
|
||||
{
|
||||
@ -296,7 +296,7 @@ public:
|
||||
{
|
||||
m_Sidebar->UpdateNode( m_NodePositionX->GetValue(), m_NodePositionY->GetValue(),
|
||||
m_NodePositionZ->GetValue(), m_NodeRotationX->GetValue(),
|
||||
m_NodeRotationY->GetValue(), m_NodeRotationZ->GetValue(), m_OldT);
|
||||
m_NodeRotationY->GetValue(), m_NodeRotationZ->GetValue(), false, m_OldT);
|
||||
}
|
||||
|
||||
void OnText(wxCommandEvent& WXUNUSED(event))
|
||||
@ -304,7 +304,7 @@ public:
|
||||
m_OldT = CinemaTextFloat(*m_NodeT, 2, 0.f, 100.f, m_OldT);
|
||||
m_Sidebar->UpdateNode( m_NodePositionX->GetValue(), m_NodePositionY->GetValue(),
|
||||
m_NodePositionZ->GetValue(), m_NodeRotationX->GetValue(),
|
||||
m_NodeRotationY->GetValue(), m_NodeRotationZ->GetValue(), m_OldT );
|
||||
m_NodeRotationY->GetValue(), m_NodeRotationZ->GetValue(), false, m_OldT );
|
||||
}
|
||||
|
||||
void UpdateRotationSpinners(int x, int y, int z)
|
||||
@ -552,7 +552,7 @@ public:
|
||||
m_Timer.SetOwner(this);
|
||||
}
|
||||
|
||||
void Update(float interval)
|
||||
void Update()
|
||||
{
|
||||
if ( m_Sidebar->m_SelectedPath < 0 )
|
||||
return;
|
||||
@ -563,7 +563,18 @@ public:
|
||||
void OnTick(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
m_NewTime = m_HighResTimer.GetTime();
|
||||
Update(m_NewTime - m_OldTime);
|
||||
m_Sidebar->m_TimeElapsed += m_NewTime - m_OldTime;
|
||||
|
||||
if ( m_Sidebar->m_TimeElapsed >= m_Sidebar->GetCurrentPath()->duration )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Sidebar->m_TimeElapsed = 0.0f;
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
( *m_Sidebar->GetCurrentPath()->name, eCinemaEventMode::IMMEDIATE_PATH, 0.0f,
|
||||
m_Sidebar->m_InfoBox->GetDrawCurrent(), m_Sidebar->m_InfoBox->GetDrawLines()) );
|
||||
}
|
||||
|
||||
Update();
|
||||
m_OldTime = m_NewTime;
|
||||
}
|
||||
void OnScroll(wxScrollEvent& WXUNUSED(event));
|
||||
@ -633,21 +644,31 @@ public:
|
||||
}
|
||||
void OnPrevious(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( m_Parent->m_SelectedPath < 0 )
|
||||
return;
|
||||
|
||||
m_Parent->m_PathSlider->m_Timer.Stop();
|
||||
m_Parent->m_Playing = false;
|
||||
|
||||
if ( m_Parent->m_SelectedPath > 0)
|
||||
float timeSet = 0.0f;
|
||||
std::vector<sCinemaSplineNode> nodes = *m_Parent->GetCurrentPath()->nodes;
|
||||
|
||||
for ( size_t i = 0; i < nodes.size(); ++i )
|
||||
{
|
||||
m_Parent->m_TimeElapsed = 0.0f;
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
( m_Parent->GetSelectedPathName(), eCinemaEventMode::IMMEDIATE_PATH, 0.0f,
|
||||
m_Parent->m_InfoBox->GetDrawCurrent(), m_Parent->m_InfoBox->GetDrawLines()) );
|
||||
timeSet += nodes[i].t;
|
||||
if ( fabs((timeSet - m_Parent->m_TimeElapsed)) < .0001f )
|
||||
{
|
||||
timeSet -= nodes[i].t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Parent->m_PathSlider->Update(0);
|
||||
|
||||
m_Parent->m_TimeElapsed = timeSet;
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
( m_Parent->GetSelectedPathName(), eCinemaEventMode::IMMEDIATE_PATH, timeSet,
|
||||
m_Parent->m_InfoBox->GetDrawCurrent(), m_Parent->m_InfoBox->GetDrawLines()) );
|
||||
|
||||
m_Parent->m_PathSlider->Update();
|
||||
}
|
||||
//void OnRewind(wxCommandEvent& event)
|
||||
|
||||
//void OnReverse(wxCommandEvent& event)
|
||||
void OnStop(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( m_Parent->m_SelectedPath < 0)
|
||||
@ -656,7 +677,7 @@ public:
|
||||
m_Parent->m_PathSlider->m_Timer.Stop();
|
||||
m_Parent->m_Playing = false;
|
||||
m_Parent->m_TimeElapsed = 0.0f;
|
||||
m_Parent->m_PathSlider->Update(0.0f);
|
||||
m_Parent->m_PathSlider->Update();
|
||||
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
(m_Parent->GetSelectedPathName(), eCinemaEventMode::IMMEDIATE_PATH, 0.0f,
|
||||
@ -666,7 +687,7 @@ public:
|
||||
{
|
||||
if ( m_Parent->m_SelectedPath < 0 )
|
||||
return;
|
||||
|
||||
|
||||
m_Parent->m_PathSlider->m_Timer.Stop();
|
||||
m_Parent->m_PathSlider->PrepareTimers();
|
||||
|
||||
@ -692,8 +713,6 @@ public:
|
||||
if ( m_Parent->m_SelectedPath < 0 )
|
||||
return;
|
||||
m_Parent->m_PathSlider->m_Timer.Stop();
|
||||
//m_Parent->m_SliderBox->Reset();
|
||||
//m_Parent->m_NodeList->Thaw();
|
||||
m_Parent->m_Playing = false;
|
||||
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
@ -704,18 +723,28 @@ public:
|
||||
|
||||
void OnNext(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( m_Parent->m_SelectedPath < 0 )
|
||||
return;
|
||||
|
||||
m_Parent->m_PathSlider->m_Timer.Stop();
|
||||
m_Parent->m_Playing = false;
|
||||
std::wstring name = m_Parent->GetSelectedPathName();
|
||||
const sCinemaPath* path = m_Parent->GetCurrentPath();
|
||||
std::vector<sCinemaSplineNode> nodes = *m_Parent->GetCurrentPath()->nodes;
|
||||
float timeSet = 0.0f;
|
||||
|
||||
for ( size_t i = 0; i < nodes.size(); ++i )
|
||||
{
|
||||
timeSet += nodes[i].t;
|
||||
if ( timeSet > m_Parent->m_TimeElapsed )
|
||||
break;
|
||||
}
|
||||
m_Parent->m_TimeElapsed = timeSet;
|
||||
|
||||
m_Parent->m_TimeElapsed = path->duration;
|
||||
|
||||
POST_MESSAGE(CinemaEvent,
|
||||
( name, eCinemaEventMode::IMMEDIATE_PATH, path->duration,
|
||||
( name, eCinemaEventMode::IMMEDIATE_PATH, timeSet,
|
||||
m_Parent->m_InfoBox->GetDrawCurrent(), m_Parent->m_InfoBox->GetDrawLines()) );
|
||||
|
||||
m_Parent->m_PathSlider->Update(0);
|
||||
m_Parent->m_PathSlider->Update();
|
||||
}
|
||||
CinematicSidebar* m_Parent;
|
||||
wxStaticBoxSizer* m_Sizer;
|
||||
@ -939,8 +968,12 @@ void CinematicSidebar::DeleteNode()
|
||||
m_TimeElapsed = m_Paths[m_SelectedPath].duration;
|
||||
|
||||
nodes.erase( nodes.begin() + m_SelectedSplineNode );
|
||||
m_Paths[m_SelectedPath].nodes = nodes;
|
||||
ssize_t size = (ssize_t)nodes.size();
|
||||
|
||||
if ( m_SelectedSplineNode == 0 && size != 0 )
|
||||
nodes[m_SelectedSplineNode].t = 0; //Reset the first node's time to 0
|
||||
m_Paths[m_SelectedPath].nodes = nodes;
|
||||
|
||||
|
||||
if ( size == 0 )
|
||||
SelectSplineNode(-1);
|
||||
@ -960,10 +993,11 @@ void CinematicSidebar::UpdatePath(std::wstring name, float timescale)
|
||||
|
||||
m_Paths[m_SelectedPath].name = name;
|
||||
m_Paths[m_SelectedPath].timescale = timescale;
|
||||
m_PathList->SetItemText(m_SelectedPath, name.c_str());
|
||||
UpdateEngineData();
|
||||
}
|
||||
|
||||
void CinematicSidebar::UpdateNode(float px, float py, float pz, float rx, float ry, float rz, float t)
|
||||
void CinematicSidebar::UpdateNode(float px, float py, float pz, float rx, float ry, float rz, bool absoluteOveride, float t)
|
||||
{
|
||||
if ( m_SelectedPath < 0 || m_SelectedSplineNode < 0 )
|
||||
return;
|
||||
@ -977,7 +1011,7 @@ void CinematicSidebar::UpdateNode(float px, float py, float pz, float rx, float
|
||||
if ( t < 0 )
|
||||
t = nodes[m_SelectedSplineNode].t;
|
||||
|
||||
if ( m_RotationAbsolute )
|
||||
if ( m_RotationAbsolute || m_SelectedSplineNode == 0 || absoluteOveride )
|
||||
{
|
||||
nodes[m_SelectedSplineNode].rx = rx;
|
||||
nodes[m_SelectedSplineNode].ry = ry;
|
||||
@ -990,7 +1024,8 @@ void CinematicSidebar::UpdateNode(float px, float py, float pz, float rx, float
|
||||
nodes[m_SelectedSplineNode].rz = rz + nodes[m_SelectedSplineNode-1].rz;
|
||||
}
|
||||
|
||||
sCinemaSplineNode newNode(px, py, pz, rx, ry, rz);
|
||||
sCinemaSplineNode newNode(px, py, pz, nodes[m_SelectedSplineNode].rx,
|
||||
nodes[m_SelectedSplineNode].ry, nodes[m_SelectedSplineNode].rz);
|
||||
newNode.SetTime(t);
|
||||
float delta = newNode.t - nodes[m_SelectedSplineNode].t;
|
||||
m_Paths[m_SelectedPath].duration = m_Paths[m_SelectedPath].duration + delta;
|
||||
@ -1079,7 +1114,7 @@ void CinematicSidebar::GotoNode(ssize_t index)
|
||||
|
||||
//this is just an echo if false
|
||||
if ( m_TimeElapsed / GetCurrentPath()->duration < 1.f )
|
||||
m_PathSlider->Update(0.0f);
|
||||
m_PathSlider->Update();
|
||||
}
|
||||
|
||||
std::wstring CinematicSidebar::GetSelectedPathName() const
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
void AddPath(std::wstring& name, int count);
|
||||
void AddNode(float px, float py, float pz, float rx, float ry, float rz, int count);
|
||||
void UpdatePath(std::wstring name, float timescale);
|
||||
void UpdateNode(float px, float py, float pz, float rx, float ry, float rz, float t=-1);
|
||||
void UpdateNode(float px, float py, float pz, float rx, float ry, float rz, bool absoluteOveride, float t=-1);
|
||||
|
||||
void DeleteTrack();
|
||||
void DeletePath();
|
||||
|
@ -875,6 +875,8 @@ public:
|
||||
return;
|
||||
DestroyChildren();
|
||||
m_DependentStatus = NO_VIEW;
|
||||
m_Sidebar->m_ConditionPage->m_List->DeleteAllItems();
|
||||
m_Sidebar->m_EffectPage->m_List->DeleteAllItems();
|
||||
}
|
||||
|
||||
TriggerSidebar* m_Sidebar;
|
||||
@ -931,18 +933,12 @@ void TriggerTreeCtrl::onClick(wxMouseEvent& evt)
|
||||
|
||||
void TriggerListCtrl::onClick(wxMouseEvent& evt)
|
||||
{
|
||||
evt.Skip();
|
||||
if ( m_Condition )
|
||||
{
|
||||
//if ( m_Sidebar->m_TriggerBottom->GetDependentStatus() != TriggerBottomBar::CONDITION_VIEW )
|
||||
if ( m_Sidebar->m_SelectedCond < 0 )
|
||||
return;
|
||||
|
||||
/*if ( m_Sidebar->m_ConditionPage->m_List->GetItemText(m_Sidebar->m_SelectedCond)
|
||||
== m_Sidebar->m_LogicBlockEndString )
|
||||
{
|
||||
m_Sidebar->m_TriggerBottom->ToLogicEndView();
|
||||
|
||||
if ( m_Sidebar->m_SelectedCond != -1 )
|
||||
m_Sidebar->m_TriggerBottom->FillLogicEndData();
|
||||
}*/
|
||||
if ( m_Sidebar->m_ConditionPage->m_List->GetItemText(m_Sidebar->m_SelectedCond)
|
||||
== m_Sidebar->m_LogicBlockEndString )
|
||||
{
|
||||
@ -952,25 +948,21 @@ void TriggerListCtrl::onClick(wxMouseEvent& evt)
|
||||
== m_Sidebar->m_LogicBlockString )
|
||||
{
|
||||
m_Sidebar->m_TriggerBottom->ToLogicView();
|
||||
|
||||
if ( m_Sidebar->m_SelectedCond != -1 )
|
||||
m_Sidebar->m_TriggerBottom->FillLogicData();
|
||||
m_Sidebar->m_TriggerBottom->FillLogicData();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sidebar->m_TriggerBottom->ToConditionView();
|
||||
if ( m_Sidebar->m_SelectedCond != -1 )
|
||||
m_Sidebar->m_TriggerBottom->FillConditionData();
|
||||
m_Sidebar->m_TriggerBottom->FillConditionData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if ( m_Sidebar->m_TriggerBottom->GetDependentStatus() != TriggerBottomBar::EFFECT_VIEW )
|
||||
m_Sidebar->m_TriggerBottom->ToEffectView();
|
||||
m_Sidebar->m_TriggerBottom->ToEffectView();
|
||||
if ( m_Sidebar->m_SelectedEffect != -1 )
|
||||
m_Sidebar->m_TriggerBottom->FillEffectData();
|
||||
}
|
||||
evt.Skip();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,7 +139,6 @@ MESSAGEHANDLER(CinemaEvent)
|
||||
{
|
||||
CCinemaManager* manager = g_Game->GetView()->GetCinema();
|
||||
|
||||
|
||||
if ( msg->mode == eCinemaEventMode::SMOOTH )
|
||||
manager->OverridePath(*msg->path);
|
||||
else if ( msg->mode == eCinemaEventMode::IMMEDIATE_PATH )
|
||||
|
Loading…
Reference in New Issue
Block a user