forked from Mirrors/openclonk
Fix issues with Crash.ocs intro (#951)
parent
6ff632e2f2
commit
addf28a0ab
|
@ -47,6 +47,7 @@ global func FxIntIntroStart(object target, proplist effect)
|
||||||
effect.Pilot->SetDir(DIR_Left);
|
effect.Pilot->SetDir(DIR_Left);
|
||||||
effect.Pilot->SetObjectLayer(effect.Pilot);
|
effect.Pilot->SetObjectLayer(effect.Pilot);
|
||||||
effect.Dialog = effect.Pilot->SetDialogue("Pilot");
|
effect.Dialog = effect.Pilot->SetDialogue("Pilot");
|
||||||
|
effect.Dialog->SetInteraction(false);
|
||||||
|
|
||||||
effect.Plane->FaceRight();
|
effect.Plane->FaceRight();
|
||||||
effect.Plane->StartInstantFlight(90, 15);
|
effect.Plane->StartInstantFlight(90, 15);
|
||||||
|
@ -106,10 +107,11 @@ global func FxIntIntroTimer(object target, proplist effect, int time)
|
||||||
if(effect.Time == 500)
|
if(effect.Time == 500)
|
||||||
for(var i = 0; i < GetPlayerCount(); ++i)
|
for(var i = 0; i < GetPlayerCount(); ++i)
|
||||||
GetCursor(GetPlayerByIndex(i))->CloseMenu();
|
GetCursor(GetPlayerByIndex(i))->CloseMenu();
|
||||||
|
|
||||||
if(effect.Time >= 830)
|
if(effect.Time >= 830)
|
||||||
{
|
{
|
||||||
effect.Pilot->SetCommand("MoveTo", effect.Pilot, 120 - effect.Pilot->GetX(), 860 - effect.Pilot->GetY());
|
effect.Pilot->SetCommand("MoveTo", effect.Pilot, 120 - effect.Pilot->GetX(), 860 - effect.Pilot->GetY());
|
||||||
|
effect.Dialog->SetInteraction(true);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ MsgIntro1=Wow, it's very turbulent here...
|
||||||
MsgIntro2=Have a look at that lava lake!
|
MsgIntro2=Have a look at that lava lake!
|
||||||
MsgIntro3=Come on old girl, hang in there...
|
MsgIntro3=Come on old girl, hang in there...
|
||||||
MsgIntro4=Uh oh...
|
MsgIntro4=Uh oh...
|
||||||
MsgIntro5=Quick! The ejecter seats!
|
MsgIntro5=Quick! The ejection seats!
|
||||||
|
|
||||||
# NPC Pilot
|
# NPC Pilot
|
||||||
NamePilot=Pilot
|
NamePilot=Pilot
|
||||||
|
|
|
@ -4,6 +4,4 @@ Version=5,2,0,1
|
||||||
Category=C4D_StaticBack
|
Category=C4D_StaticBack
|
||||||
Width=8
|
Width=8
|
||||||
Height=20
|
Height=20
|
||||||
Offset=-4,-10
|
Offset=-4,-10
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ local dlg_name;
|
||||||
local dlg_info;
|
local dlg_info;
|
||||||
local dlg_progress;
|
local dlg_progress;
|
||||||
local dlg_status;
|
local dlg_status;
|
||||||
|
local dlg_interact;
|
||||||
|
|
||||||
static const DLG_Status_Active = 0;
|
static const DLG_Status_Active = 0;
|
||||||
static const DLG_Status_Stop = 1;
|
static const DLG_Status_Stop = 1;
|
||||||
|
@ -50,9 +51,10 @@ protected func Initialize()
|
||||||
{
|
{
|
||||||
// Dialogue progress to one.
|
// Dialogue progress to one.
|
||||||
dlg_progress = 1;
|
dlg_progress = 1;
|
||||||
|
// Dialogue allows interaction by default.
|
||||||
|
dlg_interact = true;
|
||||||
|
// Dialogue is active by default.
|
||||||
dlg_status = DLG_Status_Active;
|
dlg_status = DLG_Status_Active;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +87,12 @@ private func UpdateDialogue()
|
||||||
public func SetDialogueInfo()
|
public func SetDialogueInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public func SetInteraction(bool allow)
|
||||||
|
{
|
||||||
|
dlg_interact = allow;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +111,7 @@ public func SetDialogueStatus(int status)
|
||||||
/*-- Interaction --*/
|
/*-- Interaction --*/
|
||||||
|
|
||||||
// Players can talk to NPC via the interaction bar.
|
// Players can talk to NPC via the interaction bar.
|
||||||
public func IsInteractable() { return true; }
|
public func IsInteractable() { return dlg_interact; }
|
||||||
|
|
||||||
// Adapt appearance in the interaction bar.
|
// Adapt appearance in the interaction bar.
|
||||||
public func GetInteractionMetaInfo(object clonk)
|
public func GetInteractionMetaInfo(object clonk)
|
||||||
|
@ -119,6 +125,10 @@ public func GetInteractionMetaInfo(object clonk)
|
||||||
// Called on player interaction.
|
// Called on player interaction.
|
||||||
public func Interact(object clonk)
|
public func Interact(object clonk)
|
||||||
{
|
{
|
||||||
|
// Should not happen: not active -> stop interaction
|
||||||
|
if (!dlg_interact)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Currently in a dialogue: abort that dialogue.
|
// Currently in a dialogue: abort that dialogue.
|
||||||
if (InDialogue(clonk))
|
if (InDialogue(clonk))
|
||||||
clonk->CloseMenu();
|
clonk->CloseMenu();
|
||||||
|
@ -147,9 +157,7 @@ public func Interact(object clonk)
|
||||||
var progress = dlg_progress;
|
var progress = dlg_progress;
|
||||||
dlg_progress++;
|
dlg_progress++;
|
||||||
// Then call relevant functions.
|
// Then call relevant functions.
|
||||||
Call(Format("Dlg_%s_%d", dlg_name, progress), clonk);
|
Call(Format("Dlg_%s_%d", dlg_name, progress), clonk);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -176,11 +184,11 @@ private func MessageBox(string message, object clonk, object talker)
|
||||||
|
|
||||||
// Add NPC portrait.
|
// Add NPC portrait.
|
||||||
//var portrait = Format("%i", talker->GetID()); //, Dialogue, talker->GetColor(), "1");
|
//var portrait = Format("%i", talker->GetID()); //, Dialogue, talker->GetColor(), "1");
|
||||||
clonk->AddMenuItem("", "", Dialogue, nil, nil, nil, C4MN_Add_ImgObject, talker); //TextSpec);
|
clonk->AddMenuItem("", "MenuOK", Dialogue, nil, clonk, nil, C4MN_Add_ImgObject, talker); //TextSpec);
|
||||||
|
|
||||||
// Add NPC message.
|
// Add NPC message.
|
||||||
var msg = Format("<c %x>%s:</c> %s", talker->GetColor(), talker->GetName(), message);
|
var msg = Format("<c %x>%s:</c> %s", talker->GetColor(), talker->GetName(), message);
|
||||||
clonk->AddMenuItem(msg, "", nil, nil, nil, nil, C4MN_Add_ForceNoDesc);
|
clonk->AddMenuItem(msg, "MenuOK", nil, nil, clonk, nil, C4MN_Add_ForceNoDesc);
|
||||||
|
|
||||||
// Add answers.
|
// Add answers.
|
||||||
//for (var i = 0; i < GetLength(message.Answers); i++)
|
//for (var i = 0; i < GetLength(message.Answers); i++)
|
||||||
|
@ -203,6 +211,13 @@ private func MessageBox(string message, object clonk, object talker)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func MenuOK(proplist menu_id, object clonk)
|
||||||
|
{
|
||||||
|
// prevent the menu from closing when pressing MenuOK
|
||||||
|
if (dlg_interact)
|
||||||
|
Interact(clonk);
|
||||||
|
}
|
||||||
|
|
||||||
local ActMap = {
|
local ActMap = {
|
||||||
Dialogue = {
|
Dialogue = {
|
||||||
Prototype = Action,
|
Prototype = Action,
|
||||||
|
|
Loading…
Reference in New Issue