forked from Mirrors/openclonk
docs updates, complete new player controls ~work, SetCursor returns false if trying to select a disabled crew member, HUD fixes
parent
8e5bac5071
commit
669db3fe6e
|
@ -4,7 +4,6 @@
|
|||
<funcs>
|
||||
<func>
|
||||
<title>Call</title>
|
||||
<deprecated />
|
||||
<category>Script</category><subcat>Funktionsaufruf</subcat>
|
||||
<version>4.6.5.0 CP</version>
|
||||
<syntax>
|
||||
|
@ -14,7 +13,7 @@
|
|||
<param><type>any</type><name>...</name><desc>Parameter der Funktion.</desc></param>
|
||||
</params>
|
||||
</syntax>
|
||||
<desc>Ruft die lokale Funktion szFunction auf. Stattdessen sollte dieselbe Syntax wie bei engineinternen Funktionen genutzt werden.</desc>
|
||||
<desc>Ruft die lokale Funktion szFunction auf. Wird "~" vor den Funktionsnamen gesetzt, wird der Aufruf failsafe durchgeführt.</desc>
|
||||
<related>
|
||||
<funclink>ProtectedCall</funclink>
|
||||
<funclink>PrivateCall</funclink>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<param><type>int</type><name>iIndex</name><desc>Index des Clonks in der Crew</desc></param>
|
||||
</params>
|
||||
</syntax>
|
||||
<desc>Gibt ein Mannschaftsmitglied eines Spielers zurück.</desc>
|
||||
<desc>Gibt ein Mannschaftsmitglied eines Spielers zurück. Wird ein ungültiger Index angegeben, gibt die Funktion nil zurück.</desc>
|
||||
<examples>
|
||||
<example>
|
||||
<code>var i=<funclink>GetCrewCount</funclink>(0); <funclink>while</funclink> (i--) <funclink>Kill</funclink>(GetCrew(0, i));</code>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<param><type>bool</type><name>fNoSelectArrow</name><desc>Wenn ungleich 0, wird bei der Anwahl kein Auswahlpfeil angezeigt. Ab CE.</desc><optional /></param>
|
||||
</params>
|
||||
</syntax>
|
||||
<desc>Setzt die Auswahlmarkierung eines Spielers auf ein Zielobjekt und aktiviert dieses für die Steuerung.</desc>
|
||||
<desc>Setzt die Auswahlmarkierung eines Spielers auf ein Zielobjekt und aktiviert dieses für die Steuerung. Gibt false zurück falls das Zielobjekt momentan durch <funclink>SetCrewEnabled</funclink> deaktiviert ist.</desc>
|
||||
<related>
|
||||
<funclink>GetCursor</funclink>
|
||||
<funclink>SelectCrew</funclink>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
|
@ -1,6 +1,7 @@
|
|||
/*-- Der Clonk --*/
|
||||
|
||||
#strict 2
|
||||
#include HUDS
|
||||
|
||||
// Zauberei - ben<65>tigt, wenn der Clonk Zielzauber z.B. aus dem Zauberturm zaubert
|
||||
// Auch ben<65>tigt f<>r den K<>nig
|
||||
|
@ -43,6 +44,8 @@ protected func Swimming2()
|
|||
protected func Recruitment(int iPlr) {
|
||||
// Broadcast f<>r Crew
|
||||
GameCallEx("OnClonkRecruitment", this, iPlr);
|
||||
|
||||
_inherited(...);
|
||||
}
|
||||
|
||||
/* Kontext */
|
||||
|
@ -73,82 +76,12 @@ public func FindTree()
|
|||
|
||||
/* Steuerung */
|
||||
|
||||
public func GetInteractionTarget()
|
||||
{
|
||||
// Contained interaction target
|
||||
var container = Contained();
|
||||
if (container)
|
||||
{
|
||||
if (container->GetCategory() & (C4D_Structure | C4D_Vehicle)) return container;
|
||||
}
|
||||
// Procedure interaction target
|
||||
// (Except for FIGHT, of course. You can't control your enemy ;))
|
||||
var proc = GetProcedure();
|
||||
if (proc == "PUSH" || proc == "PULL" || proc == "BUILD") return GetActionTarget();
|
||||
// First contents object interaction target
|
||||
return Contents(0);
|
||||
}
|
||||
|
||||
public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
// Generic movement
|
||||
if (inherited(plr, ctrl, x, y, strength, repeat, release)) return true;
|
||||
var proc = GetProcedure();
|
||||
// Handled by InteractionTarget?
|
||||
var interaction_target = GetInteractionTarget();
|
||||
if (interaction_target)
|
||||
{
|
||||
if (interaction_target->ObjectControl(plr, ctrl, x,y, strength, repeat, release)) return true;
|
||||
}
|
||||
// Dolphin jump
|
||||
if (ctrl == CON_DolphinJump) return DolphinJump();
|
||||
// Context menu
|
||||
else if (ctrl == CON_Context)
|
||||
{
|
||||
// Context menu of interaction target (fallback to this if no interaction target)
|
||||
if (!interaction_target) interaction_target = this;
|
||||
SetCommand(this,"Context",0,0,0,interaction_target);
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Throw
|
||||
else if (ctrl == CON_Throw)
|
||||
{
|
||||
// During Scale+Hangle, this means "Drop". During dig, this means object dig out request. Otherwise, throw.
|
||||
if (proc == "DIG")
|
||||
return SetActionData(!GetActionData());
|
||||
else if (proc == "SCALE" || proc == "HANGLE")
|
||||
return PlayerObjectCommand(plr, false, "Drop");
|
||||
else
|
||||
return PlayerObjectCommand(plr, false, "Throw");
|
||||
}
|
||||
// Dig
|
||||
else if (ctrl == CON_Dig)
|
||||
{
|
||||
if (proc == "DIG")
|
||||
{
|
||||
// Currently, another press on dig ends digging. Maybe changed once we have the shovel system?
|
||||
SetAction("Walk");
|
||||
return true;
|
||||
}
|
||||
else if (proc == "WALK")
|
||||
{
|
||||
if (!GetPhysical("Dig")) return false;
|
||||
if (!SetAction("Dig")) return false;
|
||||
SetActionData(0);
|
||||
return true;
|
||||
}
|
||||
// Can't dig now
|
||||
return false;
|
||||
}
|
||||
// Unhandled
|
||||
return false;
|
||||
}
|
||||
|
||||
private func DolphinJump()
|
||||
{
|
||||
// nur wenn an Meeresoberfl<66>che
|
||||
if(!InLiquid()) return 0;
|
||||
if(GBackSemiSolid(0,-1)) return 0;
|
||||
if(!InLiquid()) return false;
|
||||
if(GBackSemiSolid(0,-1)) return false;
|
||||
// Nicht wenn deaktiviert (z.B. Ohnmacht)
|
||||
if (GetID()->GetActMapVal("ObjectDisabled", GetAction())) return false;
|
||||
// herausspringen
|
||||
|
@ -160,6 +93,8 @@ private func DolphinJump()
|
|||
if(SimFlight(iX,iY,iXDir,iYDir,25,50))
|
||||
if(GBackLiquid(iX-GetX(),iY-GetY()) && GBackLiquid(iX-GetX(),iY+9-GetY()))
|
||||
SetAction("Dive");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected func ControlCommand(szCommand, pTarget, iTx, iTy, pTarget2, Data)
|
||||
|
|
|
@ -29,8 +29,8 @@ public func SetBarOffset(int x, int y, int num)
|
|||
public func RemoveBarLayers(int la)
|
||||
{
|
||||
// remove layers
|
||||
SetGraphics(nil,nil,nil,la);
|
||||
SetGraphics(nil,nil,nil,la+1);
|
||||
SetGraphics(nil,nil,la);
|
||||
SetGraphics(nil,nil,la+1);
|
||||
}
|
||||
|
||||
public func SetBarLayers(int la, int num)
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO: Graphical feedback for disabled crew members (grey?)
|
||||
*/
|
||||
|
||||
local crew, breathbar, magicbar, hotkey;
|
||||
|
||||
public func BarSpacing() { return -5; }
|
||||
|
@ -72,7 +76,8 @@ public func MouseSelection(int plr)
|
|||
{
|
||||
if(!crew) return false;
|
||||
if(plr != GetOwner()) return false;
|
||||
|
||||
if(!(crew->GetCrewEnabled())) false;
|
||||
|
||||
// select this clonk
|
||||
crew->SetCursor(plr);
|
||||
|
||||
|
@ -99,7 +104,7 @@ public func SetHotkey(int num)
|
|||
{
|
||||
if(num < 0 || num > 9)
|
||||
{
|
||||
SetGraphics(nil,nil,nil,12);
|
||||
SetGraphics(nil,nil,12);
|
||||
hotkey = false;
|
||||
return;
|
||||
}
|
||||
|
@ -146,7 +151,7 @@ public func UpdateRank()
|
|||
var ranky = -15000;
|
||||
|
||||
SetGraphics(nil,RANK,10,GFXOV_MODE_Action,Format("Rank%d",nrank));
|
||||
SetObjDrawTransform(1000,0,rankx,0,1000,ranky, nil, 10);
|
||||
SetObjDrawTransform(1000,0,rankx,0,1000,ranky, 10);
|
||||
|
||||
// extra rank (the star if the clonk is too experienced for normal ranks)
|
||||
if(brank > 0)
|
||||
|
@ -246,7 +251,7 @@ private func AddBreathBar()
|
|||
SetBarLayers(4,1);
|
||||
SetBarOffset(0,BarOffset(1),1);
|
||||
SetBarDimensions(GetDefWidth(),BreathBarHeight(),1);
|
||||
SetClrModulation(RGB(0,200,200),nil,5);
|
||||
SetClrModulation(RGB(0,200,200),5);
|
||||
|
||||
breathbar = true;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#strict 2
|
||||
#appendto CLNK
|
||||
|
||||
local selector;
|
||||
|
||||
|
@ -23,6 +21,5 @@ protected func Recruitment(int iPlr)
|
|||
{
|
||||
if(!FindObject(Find_ID(HUDC),Find_Owner(iPlr)))
|
||||
CreateObject(HUDC,10,10,iPlr);
|
||||
|
||||
return _inherited(...);
|
||||
|
||||
}
|
|
@ -8,24 +8,87 @@
|
|||
// Return whether handled
|
||||
global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
//Log("%d, %s, %i, %d, %d, %d, %v, %v", plr, GetPlayerControlName(ctrl), spec_id, x,y,strength, repeat, release);
|
||||
// Control handled by definition? Forward
|
||||
if (spec_id) return spec_id->PlayerControl(plr, ctrl, x, y, strength, repeat, release);
|
||||
// Forward control to cursor
|
||||
var cursor = GetCursor(plr);
|
||||
if (cursor)
|
||||
{
|
||||
// Object controlled by plr
|
||||
cursor->SetController(plr);
|
||||
// Overload by effect?
|
||||
if (cursor->Control2Effect(plr, ctrl, x, y, strength, repeat, release)) return true;
|
||||
return cursor->ObjectControl(plr, ctrl, x,y, strength, repeat, release);
|
||||
}
|
||||
// No cursor? Nothing to handle control then
|
||||
return false;
|
||||
Log("%d, %s, %i, %d, %d, %d, %v, %v", plr, GetPlayerControlName(ctrl), spec_id, x,y,strength, repeat, release);
|
||||
// Control handled by definition? Forward
|
||||
if (spec_id) return spec_id->PlayerControl(plr, ctrl, x, y, strength, repeat, release);
|
||||
|
||||
// Forward control to player
|
||||
if (Control2Player(plr,ctrl, x, y, strength, repeat, release)) return true;
|
||||
|
||||
// Forward control to cursor
|
||||
var cursor = GetCursor(plr);
|
||||
if (cursor)
|
||||
{
|
||||
// Object controlled by plr
|
||||
cursor->SetController(plr);
|
||||
// Overload by effect?
|
||||
if (cursor->Control2Effect(plr, ctrl, x, y, strength, repeat, release)) return true;
|
||||
|
||||
return cursor->ObjectControl(plr, ctrl, x,y, strength, repeat, release);
|
||||
}
|
||||
// No cursor? Nothing to handle control then
|
||||
return false;
|
||||
}
|
||||
|
||||
// Control2Player
|
||||
// Player-wide controls
|
||||
global func Control2Player(int plr, int ctrl, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
// select previous or next
|
||||
if (ctrl == CON_PreviousCrew)
|
||||
return ShiftCursor(plr, true);
|
||||
if (ctrl == CON_NextCrew)
|
||||
return ShiftCursor(plr, false);
|
||||
|
||||
// all those hotkeys...
|
||||
var hotkey = 0;
|
||||
if (ctrl == CON_PlayerHotkey0) hotkey = 10;
|
||||
if (ctrl == CON_PlayerHotkey1) hotkey = 1;
|
||||
if (ctrl == CON_PlayerHotkey2) hotkey = 2;
|
||||
if (ctrl == CON_PlayerHotkey3) hotkey = 3;
|
||||
if (ctrl == CON_PlayerHotkey4) hotkey = 4;
|
||||
if (ctrl == CON_PlayerHotkey5) hotkey = 5;
|
||||
if (ctrl == CON_PlayerHotkey6) hotkey = 6;
|
||||
if (ctrl == CON_PlayerHotkey7) hotkey = 7;
|
||||
if (ctrl == CON_PlayerHotkey8) hotkey = 8;
|
||||
if (ctrl == CON_PlayerHotkey9) hotkey = 9;
|
||||
|
||||
if (hotkey > 0)
|
||||
{
|
||||
// valid crew number?
|
||||
var crew = GetCrew(plr,hotkey-1);
|
||||
if (!crew) return false;
|
||||
// stop previously selected crew
|
||||
StopSelected();
|
||||
|
||||
// set cursor if not disabled etc.
|
||||
UnselectCrew(plr);
|
||||
return SetCursor(plr,crew);
|
||||
}
|
||||
|
||||
// select the complete crew
|
||||
if (ctrl == CON_AllCrew)
|
||||
{
|
||||
for(var i = 0; i < GetCrewCount(plr); ++i)
|
||||
{
|
||||
var crew = GetCrew(plr,i);
|
||||
SelectCrew(plr,crew, true);
|
||||
}
|
||||
StopSelected(plr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
global func StopSelected(int plr)
|
||||
{
|
||||
var cursor;
|
||||
for(var i = 0; cursor = GetCursor(plr,i); ++i)
|
||||
{
|
||||
cursor->SetCommand("None");
|
||||
cursor->SetComDir(COMD_Stop);
|
||||
}
|
||||
}
|
||||
|
||||
/* Object functions */
|
||||
// To be called in an object context only!
|
||||
|
@ -33,20 +96,60 @@ global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int stren
|
|||
// Control2Effect
|
||||
// Call control function in all effects that have "Control" in their name
|
||||
global func Control2Effect(int ctrl, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
// Count down from EffectCount, in case effects get deleted
|
||||
var i = GetEffectCount("*Control*", this), iEffect;
|
||||
var res;
|
||||
while (i--)
|
||||
{
|
||||
iEffect = GetEffect("*Control*", this, i);
|
||||
if ( GetEffect(0, this, iEffect, 1) )
|
||||
if (EffectCall(this, iEffect, "Control", ctrl, x,y,strength, repeat, release))
|
||||
return true;
|
||||
}
|
||||
// No effect handled the control
|
||||
return false;
|
||||
}
|
||||
{
|
||||
if (!this) return false;
|
||||
|
||||
// Count down from EffectCount, in case effects get deleted
|
||||
var i = GetEffectCount("*Control*", this), iEffect;
|
||||
var res;
|
||||
while (i--)
|
||||
{
|
||||
iEffect = GetEffect("*Control*", this, i);
|
||||
if ( GetEffect(0, this, iEffect, 1) )
|
||||
if (EffectCall(this, iEffect, "Control", ctrl, x,y,strength, repeat, release))
|
||||
return true;
|
||||
}
|
||||
// No effect handled the control
|
||||
return false;
|
||||
}
|
||||
|
||||
// Control redirected to script
|
||||
global func Control2Script(int ctrl, int x, int y, int strength, bool repeat, bool release, string control, object obj)
|
||||
{
|
||||
// for the use command
|
||||
if (ctrl == CON_Use)
|
||||
{
|
||||
var handled = false;
|
||||
|
||||
if(!release && !repeat)
|
||||
handled = obj->Call(Format("~%sUse",control),this,x,y);
|
||||
else if(release)
|
||||
handled = obj->Call(Format("~%sUseStop",control),this,x,y);
|
||||
else
|
||||
handled = obj->Call(Format("~%sUseHolding",control),this,x,y);
|
||||
|
||||
return handled;
|
||||
}
|
||||
// overloads of movement commandos
|
||||
else if (ctrl == CON_Left || ctrl == CON_Right || ctrl == CON_Down || ctrl == CON_Up)
|
||||
{
|
||||
if (release)
|
||||
{
|
||||
// if any movement key has been released, ControlStop is called
|
||||
if (obj->Call(Format("~%sStop",control),this)) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Control*
|
||||
if (ctrl == CON_Left) if (obj->Call(Format("~%sLeft",control),this)) return true;
|
||||
if (ctrl == CON_Right) if (obj->Call(Format("~%sRight",control),this)) return true;
|
||||
if (ctrl == CON_Up) if (obj->Call(Format("~%sUp",control),this)) return true;
|
||||
if (ctrl == CON_Down) if (obj->Call(Format("~%sDown",control),this)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ObjectControl
|
||||
// Called from PlayerControl when a control is issued to the cursor
|
||||
|
@ -54,15 +157,199 @@ global func Control2Effect(int ctrl, int x, int y, int strength, bool repeat, bo
|
|||
// To be overloaded by specific objects to enable additional controls
|
||||
global func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
// Any control resets a previously given command
|
||||
SetCommand(this, "None");
|
||||
// Movement controls
|
||||
if (ctrl==CON_Left || ctrl==CON_Right || ctrl==CON_Up || ctrl==CON_Down)
|
||||
{
|
||||
return ObjectControlMovement(plr, ctrl, strength, release);
|
||||
}
|
||||
// Unhandled control
|
||||
return false;
|
||||
if (!this) return false;
|
||||
|
||||
// Any control resets a previously given command
|
||||
SetCommand("None");
|
||||
|
||||
// hotkeys (inventory, vehicle and structure control)
|
||||
var hot = 0;
|
||||
if (ctrl == CON_Hotkey0) hot = 10;
|
||||
if (ctrl == CON_Hotkey1) hot = 1;
|
||||
if (ctrl == CON_Hotkey2) hot = 2;
|
||||
if (ctrl == CON_Hotkey3) hot = 3;
|
||||
if (ctrl == CON_Hotkey4) hot = 4;
|
||||
if (ctrl == CON_Hotkey5) hot = 5;
|
||||
if (ctrl == CON_Hotkey6) hot = 6;
|
||||
if (ctrl == CON_Hotkey7) hot = 7;
|
||||
if (ctrl == CON_Hotkey8) hot = 8;
|
||||
if (ctrl == CON_Hotkey9) hot = 9;
|
||||
|
||||
if (hot > 0) return this->~ControlHotkey(hot-1);
|
||||
|
||||
var proc = GetProcedure();
|
||||
|
||||
// building, vehicle, contents control
|
||||
var house = Contained();
|
||||
var vehicle = GetActionTarget();
|
||||
var contents = nil;
|
||||
// TODO
|
||||
|
||||
if (house)
|
||||
{
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Contained", house))
|
||||
return true;
|
||||
}
|
||||
else if (vehicle)
|
||||
{
|
||||
// control to grabbed vehicle or riding etc.
|
||||
if (proc == "PUSH" || proc == "ATTACH")
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Control", vehicle))
|
||||
return true;
|
||||
}
|
||||
else if (contents)
|
||||
{
|
||||
// out of convencience we call Control2Script, even though it can handle
|
||||
// left, right, up and down, too. We don't want that, so this is why we
|
||||
// check that ctrl is Use.
|
||||
if (ctrl == CON_Use)
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Control", contents))
|
||||
return true;
|
||||
}
|
||||
// clonk control
|
||||
else
|
||||
{
|
||||
// for standard controls
|
||||
if(Control2Script(ctrl, x, y, strength, repeat, release, "Control", this)) return true;
|
||||
// and a few more...
|
||||
if(ctrl == CON_Throw) if(this->~ControlThrow(this,x,y)) return true;
|
||||
if(ctrl == CON_Jump) if(this->~ControlJump(this)) return true;
|
||||
}
|
||||
|
||||
// everything down from here:
|
||||
// standard controls that are called if not overloaded via script
|
||||
|
||||
// Movement controls
|
||||
if (ctrl == CON_Left || ctrl == CON_Right || ctrl == CON_Up || ctrl == CON_Down || ctrl == CON_Jump)
|
||||
return ObjectControlMovement(plr, ctrl, strength, release);
|
||||
|
||||
// Push controls
|
||||
if (ctrl == CON_Grab || ctrl == CON_Ungrab || ctrl == CON_PushEnter || ctrl == CON_GrabPrevious || ctrl == CON_GrabNext)
|
||||
return ObjectControlPush(plr, ctrl);
|
||||
|
||||
// Entrance controls
|
||||
if (ctrl == CON_Enter || CON_Exit)
|
||||
return ObjectControlEntrance(plr,ctrl);
|
||||
|
||||
// Inventory control
|
||||
if (ctrl == CON_NextItem)
|
||||
{
|
||||
ShiftContents(false);
|
||||
return true;
|
||||
}
|
||||
if (ctrl == CON_PreviousItem)
|
||||
{
|
||||
ShiftContents(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// only if not in house, not grabbing a vehicle and an item selected
|
||||
if(!house && !vehicle && contents)
|
||||
{
|
||||
// throw
|
||||
if (ctrl == CON_Throw)
|
||||
{
|
||||
if (proc == "SCALE" || proc == "HANGLE")
|
||||
return PlayerObjectCommand(plr, false, "Drop");
|
||||
else
|
||||
return PlayerObjectCommand(plr, false, "Throw");
|
||||
}
|
||||
// drop
|
||||
if (ctrl == CON_Drop)
|
||||
{
|
||||
return PlayerObjectCommand(plr, false, "Drop");
|
||||
}
|
||||
}
|
||||
|
||||
// Unhandled control
|
||||
return false;
|
||||
}
|
||||
|
||||
// ObjectControlEntrance
|
||||
// Handles enter and exit
|
||||
global func ObjectControlEntrance(int plr, int ctrl)
|
||||
{
|
||||
var proc = GetProcedure();
|
||||
|
||||
// enter
|
||||
if (ctrl == CON_Enter)
|
||||
{
|
||||
// enter only if... one can
|
||||
if (proc != "WALK" && proc != "SWIM" && proc != "SCALE" &&
|
||||
proc != "HANGLE" && proc != "FLOAT" && proc != "FLIGHT") return false;
|
||||
|
||||
// a building with an entrance at right position is there?
|
||||
var obj = GetEntranceObject();
|
||||
if (!obj) return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "Enter", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
// exit
|
||||
if (ctrl == CON_Exit)
|
||||
{
|
||||
if (!Contained()) return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "Exit");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ObjectControlPush
|
||||
// Handles push controls
|
||||
global func ObjectControlPush(int plr, int ctrl)
|
||||
{
|
||||
if (!this) return false;
|
||||
|
||||
var proc = GetProcedure();
|
||||
|
||||
// grabbing
|
||||
if (ctrl == CON_Grab)
|
||||
{
|
||||
// grab only if he walks
|
||||
if (proc != "WALK") return false;
|
||||
|
||||
// only if there is someting to grab
|
||||
var obj = FindObject(Find_OCF(OCF_Grab), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
if (!obj) return false;
|
||||
|
||||
// grab
|
||||
PlayerObjectCommand(plr, false, "Grab", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
// grab next/previous
|
||||
if (ctrl == CON_GrabNext)
|
||||
return ShiftVehicle(plr, false);
|
||||
if (ctrl == CON_GrabPrevious)
|
||||
return ShiftVehicle(plr, true);
|
||||
|
||||
// ungrabbing
|
||||
if (ctrl == CON_Ungrab)
|
||||
{
|
||||
// ungrab only if he pushes
|
||||
if (proc != "PUSH") return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "Ungrab");
|
||||
return true;
|
||||
}
|
||||
|
||||
// push into building
|
||||
if (ctrl == CON_PushEnter)
|
||||
{
|
||||
if (proc != "PUSH") return false;
|
||||
|
||||
// a building with an entrance at right position is there?
|
||||
var obj = GetActionTarget()->GetEntranceObject();
|
||||
if (!obj) return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "PushTo", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ObjectControlMovement
|
||||
|
@ -70,39 +357,36 @@ global func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
// Return whether handled
|
||||
global func ObjectControlMovement(int plr, int ctrl, int strength, bool release)
|
||||
{
|
||||
var proc = GetProcedure();
|
||||
// Some specific movement controls
|
||||
if (!release)
|
||||
{
|
||||
// Jump control
|
||||
if (ctrl == CON_Up && proc == "WALK")
|
||||
{
|
||||
return PlayerObjectCommand(plr, false, "Jump");
|
||||
}
|
||||
if (proc == "SCALE") // Let go from scaling a wall
|
||||
{
|
||||
if (ctrl == CON_Left && GetDir() == DIR_Right) return ObjectComLetGo(-10);
|
||||
if (ctrl == CON_Right && GetDir() == DIR_Left) return ObjectComLetGo(+10);
|
||||
}
|
||||
else if (proc == "HANGLE") // Let go from hangling the ceiling
|
||||
{
|
||||
if (ctrl == CON_Down) return ObjectComLetGo(0,0);
|
||||
}
|
||||
else if (proc == "FIGHT") // Clonk-to-Clonk-fight. Might want to implement some more sophisticated behaviour here?
|
||||
{
|
||||
// stop, but don't abort ComDir processing. May want to do Stop while holding a direction to run away?
|
||||
if (ctrl == CON_Down) ObjectComStop();
|
||||
}
|
||||
// Make sure other selected Clonks are following
|
||||
PlayerObjectCommand(plr, true, "Follow", this, GetX(), GetY());
|
||||
// Direct turnaround if object is standing still. Valid for any procedure in OC
|
||||
if (!GetXDir())
|
||||
{
|
||||
if (ctrl == CON_Left) SetDir(DIR_Left);
|
||||
else if (ctrl == CON_Right) SetDir(DIR_Right);
|
||||
}
|
||||
}
|
||||
return ObjectControlUpdateComdir(plr);
|
||||
if (!this) return false;
|
||||
|
||||
var proc = GetProcedure();
|
||||
// Some specific movement controls
|
||||
if (!release)
|
||||
{
|
||||
// Jump control
|
||||
if (ctrl == CON_Jump && proc == "WALK")
|
||||
{
|
||||
return PlayerObjectCommand(plr, false, "Jump");
|
||||
}
|
||||
if (proc == "SCALE") // Let go from scaling a wall
|
||||
{
|
||||
if (ctrl == CON_Left && GetDir() == DIR_Right) return ObjectComLetGo(-10);
|
||||
if (ctrl == CON_Right && GetDir() == DIR_Left) return ObjectComLetGo(+10);
|
||||
}
|
||||
else if (proc == "HANGLE") // Let go from hangling the ceiling
|
||||
{
|
||||
if (ctrl == CON_Down) return ObjectComLetGo(0,0);
|
||||
}
|
||||
// Make sure other selected Clonks are following
|
||||
PlayerObjectCommand(plr, true, "Follow", this, GetX(), GetY());
|
||||
// Direct turnaround if object is standing still. Valid for any procedure in OC
|
||||
if (!GetXDir())
|
||||
{
|
||||
if (ctrl == CON_Left) SetDir(DIR_Left);
|
||||
else if (ctrl == CON_Right) SetDir(DIR_Right);
|
||||
}
|
||||
}
|
||||
return ObjectControlUpdateComdir(plr);
|
||||
}
|
||||
|
||||
// ObjectControlUpdateComdir
|
||||
|
@ -110,119 +394,270 @@ global func ObjectControlMovement(int plr, int ctrl, int strength, bool release)
|
|||
// Return whether actual, effective direction of movement changed
|
||||
global func ObjectControlUpdateComdir(int plr)
|
||||
{
|
||||
// Generic movement: Update ComDir based on current control state
|
||||
var new_comdir = GetPlayerConDir(plr, CON_Left, CON_Up, CON_Right, CON_Down);
|
||||
var old_comdir = GetComDir();
|
||||
if (new_comdir != old_comdir)
|
||||
{
|
||||
// ComDir changed. Update.
|
||||
SetComDir(new_comdir);
|
||||
//var s = "";
|
||||
//if (GetPlayerControlState(plr, CON_Left)) s = Format("%sL", s);
|
||||
//if (GetPlayerControlState(plr, CON_Up)) s = Format("%sU", s);
|
||||
//if (GetPlayerControlState(plr, CON_Right)) s = Format("%sR", s);
|
||||
//if (GetPlayerControlState(plr, CON_Down)) s = Format("%sD", s);
|
||||
//s = Format("%s %s", s, ["Stop", "Up", "UpRight", "Right", "DownRight", "Down", "DownLeft", "Left", "UpLeft"][new_comdir]);
|
||||
//Message("@%s", this, s);
|
||||
// The control is only handled if it had an actual effect on the current movement direction of the Clonk
|
||||
var old_cx,old_cy,new_cx,new_cy;
|
||||
ComDir2XY(old_comdir, old_cx, old_cy);
|
||||
ComDir2XY(new_comdir, new_cx, new_cy);
|
||||
var is_handled;
|
||||
var proc = GetProcedure();
|
||||
if (proc == "WALK" || proc == "HANGLE" || proc == "PUSH" || proc == "PULL")
|
||||
// Only horizontal movement changed actual direction
|
||||
// Also, enfore clear Left/Right commands without leftover Up/Down
|
||||
// CON_Down is never handled this way, thus forcing a CON_Stop
|
||||
is_handled = (old_cx != new_cx) && !new_cy;
|
||||
else if (proc == "SCALE")
|
||||
// Only vertical movement changed actual direction
|
||||
// Also, enfore clear Up/Down to prevent "Zuppel" in corner
|
||||
is_handled = (old_cy != new_cy) && !new_cx;
|
||||
else if (proc == "SWIM" || proc == "FLOAT" || proc == "DIG")
|
||||
is_handled = (old_cx != new_cx || old_cy != new_cy); // Free 360 degree movement
|
||||
else
|
||||
is_handled = false;
|
||||
return is_handled;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ComDir did not change. -> The control was not handled
|
||||
//Log("NoChange");
|
||||
return false;
|
||||
}
|
||||
if (!this) return false;
|
||||
|
||||
// Generic movement: Update ComDir based on current control state
|
||||
var new_comdir = GetPlayerConDir(plr, CON_Left, CON_Up, CON_Right, CON_Down);
|
||||
var old_comdir = GetComDir();
|
||||
if (new_comdir != old_comdir)
|
||||
{
|
||||
// ComDir changed. Update.
|
||||
SetComDir(new_comdir);
|
||||
//var s = "";
|
||||
//if (GetPlayerControlState(plr, CON_Left)) s = Format("%sL", s);
|
||||
//if (GetPlayerControlState(plr, CON_Up)) s = Format("%sU", s);
|
||||
//if (GetPlayerControlState(plr, CON_Right)) s = Format("%sR", s);
|
||||
//if (GetPlayerControlState(plr, CON_Down)) s = Format("%sD", s);
|
||||
//s = Format("%s %s", s, ["Stop", "Up", "UpRight", "Right", "DownRight", "Down", "DownLeft", "Left", "UpLeft"][new_comdir]);
|
||||
//Message("@%s", this, s);
|
||||
// The control is only handled if it had an actual effect on the current movement direction of the Clonk
|
||||
var old_cx, old_cy, new_cx, new_cy;
|
||||
ComDir2XY(old_comdir, old_cx, old_cy);
|
||||
ComDir2XY(new_comdir, new_cx, new_cy);
|
||||
var is_handled;
|
||||
var proc = GetProcedure();
|
||||
if (proc == "WALK" || proc == "HANGLE" || proc == "PUSH" || proc == "PULL")
|
||||
// Only horizontal movement changed actual direction
|
||||
// Also, enfore clear Left/Right commands without leftover Up/Down
|
||||
// CON_Down is never handled this way, thus forcing a CON_Stop
|
||||
is_handled = (old_cx != new_cx) && !new_cy;
|
||||
else if (proc == "SCALE")
|
||||
// Only vertical movement changed actual direction
|
||||
// Also, enfore clear Up/Down to prevent "Zuppel" in corner
|
||||
is_handled = (old_cy != new_cy) && !new_cx;
|
||||
else if (proc == "SWIM" || proc == "FLOAT" || proc == "DIG")
|
||||
is_handled = (old_cx != new_cx || old_cy != new_cy); // Free 360 degree movement
|
||||
else
|
||||
is_handled = false;
|
||||
return is_handled;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ComDir did not change. -> The control was not handled
|
||||
//Log("NoChange");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ShiftCursor
|
||||
// selects the next/previous crew member (that is not disabled)
|
||||
global func ShiftCursor(int plr, bool back)
|
||||
{
|
||||
// get index of currently selected crew
|
||||
var index = 0;
|
||||
while (index < GetCrewCount(plr))
|
||||
{
|
||||
if (GetCursor(plr) == GetCrew(plr,index)) break;
|
||||
index++;
|
||||
}
|
||||
|
||||
// a short explanation here:
|
||||
// when shifting the cursor to the next crew member, this crew member
|
||||
// might be disabled via SetCrewEnabled. That is why we have to go to
|
||||
// the crew after the next and perhaps even the crew after the next
|
||||
// after the next. Also, we need to stop this skipping after all crew
|
||||
// members have been checked in the special case that all crew members
|
||||
// are disabled
|
||||
var maxcycle = GetCrewCount(plr);
|
||||
var cycle = 0;
|
||||
|
||||
do {
|
||||
if (back)
|
||||
{
|
||||
--index;
|
||||
if (index < 0) index = GetCrewCount(plr)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
++index;
|
||||
if (index >= GetCrewCount(plr)) index = 0;
|
||||
}
|
||||
++cycle;
|
||||
} while (!(GetCrew(plr,index)->GetCrewEnabled()) && cycle < maxcycle);
|
||||
|
||||
StopSelected();
|
||||
|
||||
UnselectCrew(plr);
|
||||
return SetCursor(plr, GetCrew(plr,index));
|
||||
}
|
||||
|
||||
// ShiftVehicle
|
||||
// grabs the next/previous vehicle (if there is any)
|
||||
global func ShiftVehicle(int plr, bool back)
|
||||
{
|
||||
if (!this) return false;
|
||||
|
||||
if (GetProcedure() != "PUSH") return false;
|
||||
|
||||
var lorry = GetActionTarget();
|
||||
// get all grabbable objects
|
||||
var objs = FindObjects(Find_OCF(OCF_Grab), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
|
||||
// nothing to switch to (there is no other grabbable object)
|
||||
if (GetLength(objs) <= 1) return false;
|
||||
|
||||
// find out at what index of the array objs the vehicle is located
|
||||
var index = 0;
|
||||
for(var obj in objs)
|
||||
{
|
||||
if (obj == lorry) break;
|
||||
index++;
|
||||
}
|
||||
|
||||
// get the next/previous vehicle
|
||||
if (back)
|
||||
{
|
||||
--index;
|
||||
if (index < 0) index = GetLength(objs)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
++index;
|
||||
if (index >= GetLength(objs)) index = 0;
|
||||
}
|
||||
|
||||
PlayerObjectCommand(plr, false, "Grab", objs[index]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// GetEntranceObject
|
||||
// Find an object with an entrance in front of this object whose entrance is at
|
||||
// the right position
|
||||
global func GetEntranceObject()
|
||||
{
|
||||
if (!this) return nil;
|
||||
|
||||
// object with an entrance on target position
|
||||
var obj = FindObject(Find_OCF(OCF_Entrance), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
if (!obj) return nil;
|
||||
|
||||
var x = obj->GetDefCoreVal("Entrance","DefCore",0) + obj->GetX();
|
||||
var y = obj->GetDefCoreVal("Entrance","DefCore",1) + obj->GetY();
|
||||
var wdt = obj->GetDefCoreVal("Entrance","DefCore",2);
|
||||
var hgt = obj->GetDefCoreVal("Entrance","DefCore",3);
|
||||
|
||||
// entrance is on the vehicle?
|
||||
if (!Inside(GetX(), x, x+wdt)) return nil;
|
||||
if (!Inside(GetY(), y, y+hgt)) return nil;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
// Temporarily used for Debugging!
|
||||
// GetPlayerControlName
|
||||
// Helper function to turn CON_*-constants into strings
|
||||
global func GetPlayerControlName(int ctrl)
|
||||
{
|
||||
if (ctrl == CON_Left ) return "Left";
|
||||
if (ctrl == CON_Right ) return "Right";
|
||||
if (ctrl == CON_Up ) return "Up";
|
||||
if (ctrl == CON_Down ) return "Down";
|
||||
if (ctrl == CON_Throw ) return "Throw";
|
||||
if (ctrl == CON_Dig ) return "Dig";
|
||||
return Format("Unknown(%d)", ctrl);
|
||||
if (ctrl == CON_Left) return "Left";
|
||||
if (ctrl == CON_Right) return "Right";
|
||||
if (ctrl == CON_Up) return "Up";
|
||||
if (ctrl == CON_Down) return "Down";
|
||||
if (ctrl == CON_Throw) return "Throw";
|
||||
if (ctrl == CON_Jump) return "Jump";
|
||||
if (ctrl == CON_MenuLeft) return "MenuLeft";
|
||||
if (ctrl == CON_MenuRight) return "MenuRight";
|
||||
if (ctrl == CON_MenuOK) return "MenuOK";
|
||||
if (ctrl == CON_MenuUp) return "MenuUp";
|
||||
if (ctrl == CON_MenuDown) return "MenuDown";
|
||||
if (ctrl == CON_NextItem) return "NextItem";
|
||||
if (ctrl == CON_PreviousItem) return "PreviousItem";
|
||||
if (ctrl == CON_Use) return "Use";
|
||||
if (ctrl == CON_Drop) return "Drop";
|
||||
if (ctrl == CON_NextCrew) return "NextCrew";
|
||||
if (ctrl == CON_PreviousCrew) return "PreviousCrew";
|
||||
if (ctrl == CON_MenuCancel) return "MenuCancel";
|
||||
if (ctrl == CON_PlayerMenu) return "PlayerMenu";
|
||||
if (ctrl == CON_GrabNext) return "GrabNext";
|
||||
if (ctrl == CON_GrabPrevious) return "GrabPrevious";
|
||||
if (ctrl == CON_Grab) return "Grab";
|
||||
if (ctrl == CON_Ungrab) return "Ungrab";
|
||||
if (ctrl == CON_AllCrew) return "AllCrew";
|
||||
if (ctrl == CON_PushEnter) return "PushEnter";
|
||||
if (ctrl == CON_Enter) return "Enter";
|
||||
if (ctrl == CON_Exit) return "Exit";
|
||||
if (ctrl == CON_Hotkey0) return "Hotkey0";
|
||||
if (ctrl == CON_Hotkey1) return "Hotkey1";
|
||||
if (ctrl == CON_Hotkey2) return "Hotkey2";
|
||||
if (ctrl == CON_Hotkey3) return "Hotkey3";
|
||||
if (ctrl == CON_Hotkey4) return "Hotkey4";
|
||||
if (ctrl == CON_Hotkey5) return "Hotkey5";
|
||||
if (ctrl == CON_Hotkey6) return "Hotkey6";
|
||||
if (ctrl == CON_Hotkey7) return "Hotkey7";
|
||||
if (ctrl == CON_Hotkey8) return "Hotkey8";
|
||||
if (ctrl == CON_Hotkey9) return "Hotkey9";
|
||||
if (ctrl == CON_PlayerHotkey0) return "PlayerHotkey0";
|
||||
if (ctrl == CON_PlayerHotkey1) return "PlayerHotkey1";
|
||||
if (ctrl == CON_PlayerHotkey2) return "PlayerHotkey2";
|
||||
if (ctrl == CON_PlayerHotkey3) return "PlayerHotkey3";
|
||||
if (ctrl == CON_PlayerHotkey4) return "PlayerHotkey4";
|
||||
if (ctrl == CON_PlayerHotkey5) return "PlayerHotkey5";
|
||||
if (ctrl == CON_PlayerHotkey6) return "PlayerHotkey6";
|
||||
if (ctrl == CON_PlayerHotkey7) return "PlayerHotkey7";
|
||||
if (ctrl == CON_PlayerHotkey8) return "PlayerHotkey8";
|
||||
if (ctrl == CON_PlayerHotkey9) return "PlayerHotkey9";
|
||||
|
||||
return Format("Unknown(%d)", ctrl);
|
||||
}
|
||||
|
||||
// GetPlayerConDir
|
||||
// Return COMD_*-constant corresponding to current state of passed directional controls
|
||||
global func GetPlayerConDir(int plr, int con_left, int con_up, int con_right, int con_down)
|
||||
{
|
||||
var x,y;
|
||||
if (GetPlayerControlState(plr, con_left)) --x;
|
||||
if (GetPlayerControlState(plr, con_up)) --y;
|
||||
if (GetPlayerControlState(plr, con_right)) ++x;
|
||||
if (GetPlayerControlState(plr, con_down)) ++y;
|
||||
// Creating an array here for every keypress/release
|
||||
// Would be so cool to have this static const. Guenther?
|
||||
var dir_coms = [COMD_UpLeft, COMD_Up, COMD_UpRight, COMD_Left, COMD_None, COMD_Right, COMD_DownLeft, COMD_Down, COMD_DownRight];
|
||||
return dir_coms[y*3+x+4];
|
||||
var x,y;
|
||||
if (GetPlayerControlState(plr, con_left)) --x;
|
||||
if (GetPlayerControlState(plr, con_up)) --y;
|
||||
if (GetPlayerControlState(plr, con_right)) ++x;
|
||||
if (GetPlayerControlState(plr, con_down)) ++y;
|
||||
// Creating an array here for every keypress/release
|
||||
// Would be so cool to have this static const. Guenther?
|
||||
var dir_coms = [COMD_UpLeft, COMD_Up, COMD_UpRight, COMD_Left, COMD_None, COMD_Right, COMD_DownLeft, COMD_Down, COMD_DownRight];
|
||||
return dir_coms[y*3+x+4];
|
||||
}
|
||||
|
||||
// ComDir2XY
|
||||
// Returns coordinate directions associated with a COMD_Constant
|
||||
global func ComDir2XY(int comd, &x, &y)
|
||||
{
|
||||
// Creating an array here for every keypress/release
|
||||
// Would be so cool to have this static const. Guenther?
|
||||
x = [0,0,1,1,1,0,-1,-1,-1][comd];
|
||||
y = [0,-1,-1,0,1,1,1,0,-1][comd];
|
||||
return true;
|
||||
// Creating an array here for every keypress/release
|
||||
// Would be so cool to have this static const. Guenther?
|
||||
x = [0,0,1,1,1,0,-1,-1,-1][comd];
|
||||
y = [0,-1,-1,0,1,1,1,0,-1][comd];
|
||||
return true;
|
||||
}
|
||||
|
||||
// PlayerObjectCommand
|
||||
// Give a command to all selected Clonks of a player
|
||||
global func PlayerObjectCommand(int plr, bool exclude_cursor, string command, object target, int tx, int ty, object target2)
|
||||
{
|
||||
for (var i=exclude_cursor; i<GetSelectCount(plr); ++i)
|
||||
{
|
||||
var follow_clonk = GetCursor(plr, i);
|
||||
if (follow_clonk)
|
||||
{
|
||||
SetCommand(follow_clonk,command,target,tx,ty);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
for (var i=exclude_cursor; i<GetSelectCount(plr); ++i)
|
||||
{
|
||||
var follow_clonk = GetCursor(plr, i);
|
||||
if (follow_clonk)
|
||||
{
|
||||
follow_clonk->SetCommand(command,target,tx,ty);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ObjectComStop
|
||||
// Stop action and ComDir
|
||||
global func ObjectComStop()
|
||||
{
|
||||
SetComDir();
|
||||
SetAction("Idle");
|
||||
if (!SetAction("Walk")) return false;
|
||||
SetXDir(); SetYDir();
|
||||
return true;
|
||||
SetComDir();
|
||||
SetAction("Idle");
|
||||
if (!SetAction("Walk")) return false;
|
||||
SetXDir(); SetYDir();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ObjectComLetGo
|
||||
// Let go from scaling or hangling
|
||||
global func ObjectComLetGo(int vx, int vy)
|
||||
{
|
||||
if (!SetAction("Jump")) return false;
|
||||
SetXDir(vx); SetYDir(vy);
|
||||
return true;
|
||||
if (!SetAction("Jump")) return false;
|
||||
SetXDir(vx); SetYDir(vy);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,222 +1,538 @@
|
|||
[ControlDefs]
|
||||
|
||||
[ControlDef]
|
||||
Identifier=None
|
||||
[ControlDef]
|
||||
Identifier=None
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Left
|
||||
GUIName=Left
|
||||
GUIDesc=Move left
|
||||
Hold=1
|
||||
# Summary
|
||||
# --------
|
||||
# Left Right Up Down Jump
|
||||
# Throw Drop Use
|
||||
#
|
||||
# NextItem PreviousItem
|
||||
#
|
||||
# Grab Ungrab GrabPrevious GrabNext PushEnter
|
||||
#
|
||||
# Enter Exit
|
||||
#
|
||||
# Hotkey1 Hotkey2 Hotkey3 Hotkey4 Hotkey5 Hotkey6 Hotkey7 Hotkey8 Hotkey9
|
||||
# Hotkey0
|
||||
#
|
||||
# NextCrew PreviousCrew AllCrew
|
||||
# PlayerHotkey1 PlayerHotkey2 PlayerHotkey3 PlayerHotkey4 PlayerHotkey5 PlayerHotkey6
|
||||
# PlayerHotkey7 PlayerHotkey8 PlayerHotkey9 PlayerHotkey0
|
||||
#
|
||||
# MenuCancel MenuOK MenuDown MenuUp MenuLeft MenuRight
|
||||
# PlayerMenu
|
||||
|
||||
|
||||
# Movement
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Left
|
||||
GUIName=Left
|
||||
GUIDesc=Move left
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Right
|
||||
GUIName=Right
|
||||
GUIDesc=Move right
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Up
|
||||
GUIName=Up
|
||||
GUIDesc=Move up or jump
|
||||
Hold=1
|
||||
[ControlDef]
|
||||
Identifier=Right
|
||||
GUIName=Right
|
||||
GUIDesc=Move right
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Up
|
||||
GUIName=Up
|
||||
GUIDesc=Move up
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Down
|
||||
GUIName=Down
|
||||
GUIDesc=Move down
|
||||
Hold=1
|
||||
[ControlDef]
|
||||
Identifier=Down
|
||||
GUIName=Down
|
||||
GUIDesc=Move down
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Throw
|
||||
GUIName=Throw
|
||||
GUIDesc=Get rid of your selected inventory
|
||||
Hold=1
|
||||
RepeatDelay=5
|
||||
InitialRepeatDelay=35
|
||||
[ControlDef]
|
||||
Identifier=Jump
|
||||
GUIName=Jump
|
||||
GUIDesc=Do the mario!
|
||||
|
||||
# Inventory
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Throw
|
||||
GUIName=Throw
|
||||
GUIDesc=Throw selected inventory item
|
||||
Hold=1
|
||||
RepeatDelay=5
|
||||
InitialRepeatDelay=35
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Dig
|
||||
GUIName=Dig
|
||||
GUIDesc=Delve through the earth
|
||||
|
||||
[ControlDef]
|
||||
Identifier=DolphinJump
|
||||
GUIName=Dolphin Jump
|
||||
GUIDesc=Jump out of the water while swimming
|
||||
[ControlDef]
|
||||
Identifier=Drop
|
||||
GUIName=Drop
|
||||
GUIDesc=Drop selected inventory item
|
||||
Hold=1
|
||||
RepeatDelay=5
|
||||
InitialRepeatDelay=35
|
||||
|
||||
[ControlDef]
|
||||
Identifier=NextItem
|
||||
GUIName=Select next
|
||||
GUIDesc=Select next inventory item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PreviousItem
|
||||
GUIName=Select previous
|
||||
GUIDesc=Select previous inventory item
|
||||
|
||||
|
||||
# Controlling (contents, vehicles, structures)
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Use
|
||||
GUIName=Use
|
||||
GUIDesc=Use selected or controlled item
|
||||
Hold=1
|
||||
RepeatDelay=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Grab
|
||||
GUIName=Grab
|
||||
GUIDesc=Grab vehicle
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Ungrab
|
||||
GUIName=Let go
|
||||
GUIDesc=Let go vehicle
|
||||
|
||||
[ControlDef]
|
||||
Identifier=GrabPrevious
|
||||
GUIName=Grab previous
|
||||
GUIDesc=Grab the previous vehicle on the same spot
|
||||
|
||||
[ControlDef]
|
||||
Identifier=GrabNext
|
||||
GUIName=Grab next
|
||||
GUIDesc=Grab the next vehicle on the same spot
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PushEnter
|
||||
GUIName=Push into building
|
||||
GUIDesc=Push the vehicle into the building
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Enter
|
||||
GUIName=Enter
|
||||
GUIDesc=Go into the building
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Exit
|
||||
GUIName=Exit
|
||||
GUIDesc=Exit the building
|
||||
|
||||
|
||||
# Hotkeys (lower bar)
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey1
|
||||
GUIName=Select first
|
||||
GUIDesc=Select first item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey2
|
||||
GUIName=Select second
|
||||
GUIDesc=Select second item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey3
|
||||
GUIName=Select third
|
||||
GUIDesc=Select third item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey4
|
||||
GUIName=Select fourth
|
||||
GUIDesc=Select fourth item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey5
|
||||
GUIName=Select fifth
|
||||
GUIDesc=Select fifth item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Context
|
||||
GUIName=Context menu
|
||||
GUIDesc=Open context menu of current interaction target
|
||||
[ControlDef]
|
||||
Identifier=Hotkey6
|
||||
GUIName=Select sixth
|
||||
GUIDesc=Select sixth item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey7
|
||||
GUIName=Select seventh
|
||||
GUIDesc=Select seventh item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey8
|
||||
GUIName=Select eighth
|
||||
GUIDesc=Select eighth item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey9
|
||||
GUIName=Select ninth
|
||||
GUIDesc=Select ninth item
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey0
|
||||
GUIName=Select tenth
|
||||
GUIDesc=Select tenth item
|
||||
|
||||
# the stuff for the second item comes later
|
||||
|
||||
# Crew
|
||||
|
||||
[ControlDef]
|
||||
Identifier=NextCrew
|
||||
GUIName=Next crew member
|
||||
GUIDesc=Control next crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PreviousCrew
|
||||
GUIName=Previous crew member
|
||||
GUIDesc=Control previous crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=AllCrew
|
||||
GUIName=All the crew
|
||||
GUIDesc=Control all crew member at the same time
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey1
|
||||
GUIName=Control first
|
||||
GUIDesc=Control first crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey2
|
||||
GUIName=Control second
|
||||
GUIDesc=Control second crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey3
|
||||
GUIName=Control third
|
||||
GUIDesc=Control third crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey4
|
||||
GUIName=Control fourth
|
||||
GUIDesc=Control fourth crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey5
|
||||
GUIName=Control fifth
|
||||
GUIDesc=Control fifth crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey6
|
||||
GUIName=Control sixth
|
||||
GUIDesc=Control sixth crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey7
|
||||
GUIName=Control seventh
|
||||
GUIDesc=Control seventh crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey8
|
||||
GUIName=Control eighth
|
||||
GUIDesc=Control eighth crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey9
|
||||
GUIName=Control ninth
|
||||
GUIDesc=Control ninth crew member
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerHotkey0
|
||||
GUIName=Control tenth
|
||||
GUIDesc=Control tenth crew member
|
||||
|
||||
|
||||
# Menu control
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuOK
|
||||
GUIName=OK
|
||||
GUIDesc=Confirm in menus
|
||||
Action=MenuOK
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuCancel
|
||||
GUIName=Cancel
|
||||
GUIDesc=Cancel or close the menu
|
||||
Action=MenuCancel
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuLeft
|
||||
GUIName=Left
|
||||
GUIDesc=In the menu
|
||||
Action=MenuLeft
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuRight
|
||||
GUIName=Right
|
||||
GUIDesc=In the menu
|
||||
Action=MenuRight
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuUp
|
||||
GUIName=Up
|
||||
GUIDesc=In the menu
|
||||
Action=MenuUp
|
||||
|
||||
[ControlDef]
|
||||
Identifier=MenuDown
|
||||
GUIName=Down
|
||||
GUIDesc=In the menu
|
||||
Action=MenuDown
|
||||
|
||||
# Extra buttons...
|
||||
|
||||
[ControlDef]
|
||||
Identifier=PlayerMenu
|
||||
GUIName=Player menu
|
||||
GUIDesc=Open player menu
|
||||
Action=Menu
|
||||
|
||||
|
||||
|
||||
[ControlSets]
|
||||
|
||||
[ControlSet]
|
||||
Name=Keyboard2
|
||||
# x = DONE
|
||||
|
||||
[Assignment]
|
||||
Key=A
|
||||
Control=Left
|
||||
# Summary
|
||||
# --------
|
||||
# MenuLeft, Left x A
|
||||
# MenuRight, Right x D
|
||||
# MenuUp, Up, Jump x W
|
||||
# MenuDown, Down x S
|
||||
#
|
||||
# NextItem x Scrollwheel-Up (now: Down)
|
||||
# PreviousItem x Scrollwheel-Down (now: Up)
|
||||
# Hotkey0-9 x (0-9)
|
||||
#
|
||||
# Use, Throw x Left mouse button (now: Left)
|
||||
# Throw x Shift+Left mouse button (now: X+Left)
|
||||
# Drop x S+Left mouse button (now: S+Left)
|
||||
#
|
||||
# PushEnter, GrabNext, Ungrab,
|
||||
# Grab, Exit, Enter x Space
|
||||
#
|
||||
# PlayerHotkey0-9 x X+(0-9)
|
||||
# NextCrew x E
|
||||
# PreviousCrew x Q
|
||||
#
|
||||
# MenuOK x Return
|
||||
# MenuCancel x Backspace
|
||||
#
|
||||
# PlayerMenu x End
|
||||
#
|
||||
# GrabPrevious, AllCrew x Unassigned
|
||||
|
||||
|
||||
[Assignment]
|
||||
Key=D
|
||||
Control=Right
|
||||
[ControlSet]
|
||||
Name=Keyboard2Classic
|
||||
|
||||
[Assignment]
|
||||
Key=S
|
||||
Control=Down
|
||||
[Assignment]
|
||||
Key=A
|
||||
Priority=50
|
||||
Control=Left
|
||||
|
||||
[Assignment]
|
||||
Key=W
|
||||
Control=Up
|
||||
TriggerMode=Hold
|
||||
[Assignment]
|
||||
Key=D
|
||||
Priority=50
|
||||
Control=Right
|
||||
|
||||
[ControlSet]
|
||||
Name=Keyboard2Classic
|
||||
|
||||
[Assignment]
|
||||
Key=A
|
||||
Control=Left
|
||||
TriggerMode=Hold
|
||||
[Assignment]
|
||||
Key=S
|
||||
Priority=50
|
||||
Control=Down
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Left
|
||||
Control=Right
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
[Assignment]
|
||||
Key=W
|
||||
Priority=50
|
||||
Control=Up
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Left
|
||||
Control=Up
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
[Assignment]
|
||||
Key=W
|
||||
Priority=10
|
||||
Control=Jump
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Left
|
||||
Control=Down
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
[Assignment]
|
||||
Key=A
|
||||
Priority=100
|
||||
Control=MenuLeft
|
||||
|
||||
[Assignment]
|
||||
Key=D
|
||||
Control=Right
|
||||
TriggerMode=Hold
|
||||
[Assignment]
|
||||
Key=D
|
||||
Priority=100
|
||||
Control=MenuRight
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Right
|
||||
Control=Left
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
[Assignment]
|
||||
Key=S
|
||||
Priority=100
|
||||
Control=MenuDown
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Right
|
||||
Control=Up
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Right
|
||||
Control=Down
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=S
|
||||
Control=Down
|
||||
TriggerMode=Hold
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Down
|
||||
Control=Up
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Down
|
||||
Control=Left
|
||||
TriggerMode=Release
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Down
|
||||
Control=Right
|
||||
TriggerMode=Release
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Down
|
||||
Control=Down
|
||||
TriggerMode=Release
|
||||
Priority=-10
|
||||
|
||||
[Assignment]
|
||||
Key=W
|
||||
Control=Up
|
||||
TriggerMode=Hold
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Up
|
||||
Control=Down
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Up
|
||||
Control=Left
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Up
|
||||
Control=Right
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=-5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Dig
|
||||
Control=Down
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Dig
|
||||
Control=Left
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Dig
|
||||
Control=Right
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
[Assignment]
|
||||
Key=CON_Dig
|
||||
Control=Up
|
||||
TriggerMode=Release | AlwaysUnhandled
|
||||
Priority=5
|
||||
|
||||
|
||||
[ControlSet]
|
||||
Name=Keyboard2*
|
||||
|
||||
[Assignment]
|
||||
Key=Q
|
||||
Control=Throw
|
||||
|
||||
[Assignment]
|
||||
Key=E
|
||||
Control=Dig
|
||||
|
||||
[Assignment]
|
||||
Key=Up,Up
|
||||
ComboIsSequence=1
|
||||
Control=DolphinJump
|
||||
Priority=10
|
||||
|
||||
[Assignment]
|
||||
Key=F
|
||||
Control=Context
|
||||
[Assignment]
|
||||
Key=W
|
||||
Priority=100
|
||||
Control=MenuUp
|
||||
|
||||
[Assignment]
|
||||
Key=Return
|
||||
Control=MenuOK
|
||||
|
||||
[Assignment]
|
||||
Key=Back
|
||||
Control=MenuCancel
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=45
|
||||
Control=PushEnter
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=40
|
||||
Control=GrabNext
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=35
|
||||
Control=Ungrab
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=30
|
||||
Control=Grab
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=25
|
||||
Control=Exit
|
||||
|
||||
[Assignment]
|
||||
Key=Space
|
||||
Priority=20
|
||||
Control=Enter
|
||||
|
||||
[Assignment]
|
||||
Key=0
|
||||
Control=Hotkey0
|
||||
|
||||
[Assignment]
|
||||
Key=1
|
||||
Control=Hotkey1
|
||||
|
||||
[Assignment]
|
||||
Key=2
|
||||
Control=Hotkey2
|
||||
|
||||
[Assignment]
|
||||
Key=3
|
||||
Control=Hotkey3
|
||||
|
||||
[Assignment]
|
||||
Key=4
|
||||
Control=Hotkey4
|
||||
|
||||
[Assignment]
|
||||
Key=5
|
||||
Control=Hotkey5
|
||||
|
||||
[Assignment]
|
||||
Key=6
|
||||
Control=Hotkey6
|
||||
|
||||
[Assignment]
|
||||
Key=7
|
||||
Control=Hotkey7
|
||||
|
||||
[Assignment]
|
||||
Key=8
|
||||
Control=Hotkey8
|
||||
|
||||
[Assignment]
|
||||
Key=9
|
||||
Control=Hotkey9
|
||||
|
||||
[Assignment]
|
||||
Key=X,0
|
||||
Control=Hotkey0
|
||||
|
||||
[Assignment]
|
||||
Key=X,1
|
||||
Control=PlayerHotkey1
|
||||
|
||||
[Assignment]
|
||||
Key=X,2
|
||||
Control=PlayerHotkey2
|
||||
|
||||
[Assignment]
|
||||
Key=X,3
|
||||
Control=PlayerHotkey3
|
||||
|
||||
[Assignment]
|
||||
Key=X,4
|
||||
Control=PlayerHotkey4
|
||||
|
||||
[Assignment]
|
||||
Key=X,5
|
||||
Control=PlayerHotkey5
|
||||
|
||||
[Assignment]
|
||||
Key=X,6
|
||||
Control=PlayerHotkey6
|
||||
|
||||
[Assignment]
|
||||
Key=X,7
|
||||
Control=PlayerHotkey7
|
||||
|
||||
[Assignment]
|
||||
Key=X,8
|
||||
Control=PlayerHotkey8
|
||||
|
||||
[Assignment]
|
||||
Key=X,9
|
||||
Control=PlayerHotkey9
|
||||
|
||||
[Assignment]
|
||||
Key=Q
|
||||
Control=PreviousCrew
|
||||
|
||||
[Assignment]
|
||||
Key=E
|
||||
Control=NextCrew
|
||||
|
||||
[Assignment]
|
||||
Key=End
|
||||
Control=PlayerMenu
|
||||
|
||||
[Assignment]
|
||||
Key=Up
|
||||
Control=PreviousItem
|
||||
|
||||
[Assignment]
|
||||
Key=Down
|
||||
Control=NextItem
|
||||
|
||||
[Assignment]
|
||||
Key=Left
|
||||
Priority=100
|
||||
Control=Use
|
||||
|
||||
[Assignment]
|
||||
Key=Left
|
||||
Priority=50
|
||||
Control=Throw
|
||||
|
||||
[Assignment]
|
||||
Key=X,Left
|
||||
Control=Throw
|
||||
|
||||
[Assignment]
|
||||
Key=S,Left
|
||||
Control=Drop
|
||||
|
|
|
@ -18,9 +18,9 @@ Rules=CNMT=1
|
|||
|
||||
[Player1]
|
||||
Wealth=50,0,0,250
|
||||
Crew=CLNK=1
|
||||
Buildings=HUT2=1
|
||||
Material=FLAG=1
|
||||
Crew=CLNK=2
|
||||
Buildings=TWKS=1
|
||||
Material=ROCK=3;LORY=2
|
||||
Knowledge=HUT2=0;HUT3=0;ELEV=0;SAWM=0;CST1=0
|
||||
HomeBaseMaterial=CNKT=5;LOAM=5;WOOD=10;METL=5;FLNT=5;TFLN=5;LORY=1;CATA=1;BALN=1;CLNK=2
|
||||
HomeBaseProduction=CNKT=5;LOAM=5;WOOD=10;METL=5;FLNT=5;TFLN=5;LORY=1;CATA=1
|
||||
|
|
|
@ -2741,7 +2741,7 @@ static C4Object *FnGetCaptain(C4AulContext *cthr, long iPlr)
|
|||
static bool FnSetCursor(C4AulContext *cthr, long iPlr, C4Object *pObj, bool fNoSelectMark, bool fNoSelectArrow, bool fNoSelectCrew)
|
||||
{
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr || (pObj && !pObj->Status)) return false;
|
||||
if (!pPlr || (pObj && !pObj->Status) || (pObj && pObj->CrewDisabled)) return false;
|
||||
pPlr->SetCursor(pObj, !fNoSelectMark, !fNoSelectArrow);
|
||||
if (!fNoSelectCrew) pPlr->SelectCrew(pObj, true);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue