forked from 0ad/0ad
Rough cinematic/triggers in map.
Fixed some issues with triggers. JS command execution in Atlas. This was SVN commit r4829.
This commit is contained in:
parent
8d0a7170f6
commit
117f3dfe4a
BIN
binaries/data/mods/official/maps/scenarios/cinematic.xml
(Stored with Git LFS)
BIN
binaries/data/mods/official/maps/scenarios/cinematic.xml
(Stored with Git LFS)
Binary file not shown.
@ -973,7 +973,7 @@ function damage( dmg, inflictor )
|
||||
if (this.traits.audio && this.traits.audio.path)
|
||||
{
|
||||
if(getGUIGlobal().newRandomSound) {
|
||||
curr_pain = getGUIGlobal().newRandomSound(
|
||||
var curr_pain = getGUIGlobal().newRandomSound(
|
||||
"voice", "pain", this.traits.audio.path);
|
||||
if (curr_pain) curr_pain.play();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ const float CGameView::defaultFOV = DEGTORAD(20.f);
|
||||
const float CGameView::defaultNear = 1.f;
|
||||
const float CGameView::defaultFar = 5000.f;
|
||||
|
||||
class CGameViewImpl : public CJSObject<CGameViewImpl>
|
||||
class CGameViewImpl : public CJSObject<CGameViewImpl>, boost::noncopyable
|
||||
{
|
||||
public:
|
||||
CGameViewImpl(CGame* game)
|
||||
|
@ -138,7 +138,7 @@ bool TriggerParameter::operator< ( const TriggerParameter& rhs ) const
|
||||
}
|
||||
//===========Trigger Manager===========
|
||||
|
||||
CTriggerManager::CTriggerManager() : m_UpdateRate(.80f), m_UpdateTime(.80f)
|
||||
CTriggerManager::CTriggerManager() : m_UpdateRate(.20f), m_UpdateTime(.20f)
|
||||
{
|
||||
}
|
||||
|
||||
@ -165,11 +165,12 @@ std::vector<std::wstring> CTriggerManager::GetTriggerTranslations(const std::wst
|
||||
return m_TriggerTranslations[name];
|
||||
}
|
||||
|
||||
void CTriggerManager::Update(float delta)
|
||||
void CTriggerManager::Update(float delta_ms)
|
||||
{
|
||||
float delta = delta_ms / 1000.f;
|
||||
m_UpdateTime -= delta;
|
||||
if ( m_UpdateTime < 0 )
|
||||
m_UpdateTime = m_UpdateRate;
|
||||
m_UpdateTime += m_UpdateRate;
|
||||
else
|
||||
return;
|
||||
|
||||
@ -178,7 +179,7 @@ void CTriggerManager::Update(float delta)
|
||||
{
|
||||
if ( it->second->ShouldFire() )
|
||||
{
|
||||
it->second->m_timeLeft -= delta;
|
||||
it->second->m_timeLeft -= m_UpdateRate;
|
||||
if ( it->second->m_timeLeft < 0 )
|
||||
{
|
||||
if ( !it->second->Fire() )
|
||||
|
@ -263,6 +263,7 @@ enum
|
||||
ID_MessageTrace,
|
||||
ID_Screenshot,
|
||||
ID_MediaPlayer,
|
||||
ID_JavaScript,
|
||||
|
||||
ID_Toolbar // must be last in the list
|
||||
};
|
||||
@ -284,6 +285,7 @@ BEGIN_EVENT_TABLE(ScenarioEditor, wxFrame)
|
||||
EVT_MENU(ID_MessageTrace, ScenarioEditor::OnMessageTrace)
|
||||
EVT_MENU(ID_Screenshot, ScenarioEditor::OnScreenshot)
|
||||
EVT_MENU(ID_MediaPlayer, ScenarioEditor::OnMediaPlayer)
|
||||
EVT_MENU(ID_JavaScript, ScenarioEditor::OnJavaScript)
|
||||
|
||||
EVT_IDLE(ScenarioEditor::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
@ -347,6 +349,7 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
|
||||
menuMisc->AppendCheckItem(ID_MessageTrace, _("Message debug trace"));
|
||||
menuMisc->Append(ID_Screenshot, _("&Screenshot"));
|
||||
menuMisc->Append(ID_MediaPlayer, _("&Media player"));
|
||||
menuMisc->Append(ID_JavaScript, _("&JS console"));
|
||||
}
|
||||
|
||||
|
||||
@ -603,6 +606,14 @@ void ScenarioEditor::OnMediaPlayer(wxCommandEvent& WXUNUSED(event))
|
||||
#endif
|
||||
}
|
||||
|
||||
void ScenarioEditor::OnJavaScript(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString cmd = ::wxGetTextFromUser(_T(""), _("JS command"), _T(""), this);
|
||||
if (cmd.IsEmpty())
|
||||
return;
|
||||
POST_MESSAGE(JavaScript, (cmd.c_str()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Position::Position(const wxPoint& pt)
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
void OnMessageTrace(wxCommandEvent& event);
|
||||
void OnScreenshot(wxCommandEvent& event);
|
||||
void OnMediaPlayer(wxCommandEvent& event);
|
||||
void OnJavaScript(wxCommandEvent& event);
|
||||
|
||||
static AtlasWindowCommandProc& GetCommandProc();
|
||||
|
||||
|
@ -35,6 +35,7 @@ QUERYHANDLER(CinemaRecord)
|
||||
manager->SetCurrentTrack(*msg->track, false, false, false);
|
||||
|
||||
const int w = 640, h = 480;
|
||||
|
||||
{
|
||||
g_Renderer.Resize(w, h);
|
||||
SViewPort vp = { 0, 0, w, h };
|
||||
@ -114,5 +115,10 @@ MESSAGEHANDLER(SimPlay)
|
||||
View::GetView_Game()->SetSpeedMultiplier(msg->speed);
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(JavaScript)
|
||||
{
|
||||
g_ScriptingHost.ExecuteScript(*msg->command, L"Atlas");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ MESSAGE(SetViewParamC,
|
||||
((Colour, value))
|
||||
);
|
||||
|
||||
MESSAGE(JavaScript,
|
||||
((std::wstring, command))
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MESSAGE(SimStateSave,
|
||||
|
Loading…
Reference in New Issue
Block a user