forked from Mirrors/openclonk
Remove a bunch of dead code, mostly player control related
parent
52de8900dd
commit
e5f75c5a44
|
@ -27,7 +27,6 @@ const int
|
|||
C4MaxDefString = 100,
|
||||
C4MaxMessage = 256,
|
||||
C4RetireDelay = 60,
|
||||
C4MaxColor = 12,
|
||||
C4MaxKey = 12,
|
||||
C4MaxKeyboardSet = 4,
|
||||
C4MaxControlSet = C4MaxKeyboardSet+4, // keyboard sets+gamepads
|
||||
|
@ -57,26 +56,12 @@ const int C4D_MaxVertex = 30;
|
|||
|
||||
const int
|
||||
C4SymbolSize = 35,
|
||||
C4SymbolBorder = 5,
|
||||
C4UpperBoardHeight = 50,
|
||||
C4PictureSize = 64,
|
||||
C4MaxPictureSize = 150,
|
||||
C4MaxBigIconSize = 64;
|
||||
|
||||
const int C4P_MaxPosition = 4;
|
||||
|
||||
const int
|
||||
C4P_Control_None = -1,
|
||||
C4P_Control_Keyboard1 = 0,
|
||||
C4P_Control_Keyboard2 = 1,
|
||||
C4P_Control_Keyboard3 = 2,
|
||||
C4P_Control_Keyboard4 = 3,
|
||||
C4P_Control_GamePad1 = 4,
|
||||
C4P_Control_GamePad2 = 5,
|
||||
C4P_Control_GamePad3 = 6,
|
||||
C4P_Control_GamePad4 = 7,
|
||||
C4P_Control_GamePadMax = C4P_Control_GamePad4;
|
||||
|
||||
const int C4ViewportScrollBorder = 40; // scrolling past landscape allowed at range of this border
|
||||
|
||||
//============================= Engine Return Values ======================================
|
||||
|
@ -134,71 +119,8 @@ const BYTE // Directional
|
|||
|
||||
const BYTE CNAT_Flags = CNAT_MultiAttach | CNAT_NoCollision | CNAT_PhaseHalfVehicle; // all attchment flags that can be combined with regular attachment
|
||||
|
||||
//=============================== Keyboard Input Controls =====================================================
|
||||
|
||||
const int C4DoubleClick = 10;
|
||||
|
||||
//=================================== Control Commands ======================================================
|
||||
|
||||
const BYTE
|
||||
COM_Single = 64,
|
||||
COM_Double = 128;
|
||||
|
||||
const BYTE
|
||||
COM_None = 0,
|
||||
COM_Left = 1,
|
||||
COM_Right = 2,
|
||||
COM_Up = 3,
|
||||
COM_Down = 4,
|
||||
COM_Throw = 5,
|
||||
COM_Dig = 6,
|
||||
|
||||
COM_Special = 7,
|
||||
COM_Special2 = 8,
|
||||
|
||||
COM_Contents = 9,
|
||||
|
||||
COM_WheelUp = 10,
|
||||
COM_WheelDown= 11,
|
||||
|
||||
COM_Left_R = COM_Left + 16,
|
||||
COM_Right_R = COM_Right + 16,
|
||||
COM_Up_R = COM_Up + 16,
|
||||
COM_Down_R = COM_Down + 16,
|
||||
COM_Throw_R = COM_Throw + 16,
|
||||
COM_Dig_R = COM_Dig + 16,
|
||||
COM_Special_R = COM_Special + 16,
|
||||
COM_Special2_R = COM_Special2 + 16,
|
||||
COM_ReleaseFirst = COM_Left_R,
|
||||
COM_ReleaseLast = COM_Special2_R,
|
||||
|
||||
COM_Left_S = COM_Left | COM_Single,
|
||||
COM_Right_S = COM_Right | COM_Single,
|
||||
COM_Up_S = COM_Up | COM_Single,
|
||||
COM_Down_S = COM_Down | COM_Single,
|
||||
COM_Throw_S = COM_Throw | COM_Single,
|
||||
COM_Dig_S = COM_Dig | COM_Single,
|
||||
COM_Special_S = COM_Special | COM_Single,
|
||||
COM_Special2_S = COM_Special2 | COM_Single,
|
||||
|
||||
COM_Left_D = COM_Left | COM_Double,
|
||||
COM_Right_D = COM_Right | COM_Double,
|
||||
COM_Up_D = COM_Up | COM_Double,
|
||||
COM_Down_D = COM_Down | COM_Double,
|
||||
COM_Throw_D = COM_Throw | COM_Double,
|
||||
COM_Dig_D = COM_Dig | COM_Double,
|
||||
COM_Special_D = COM_Special | COM_Double,
|
||||
COM_Special2_D = COM_Special2 | COM_Double;
|
||||
|
||||
const BYTE
|
||||
COM_CursorLeft = 30,
|
||||
COM_CursorRight = 31;
|
||||
|
||||
const BYTE
|
||||
// COM_Help = 35, (obsolete, was: help-mode button)
|
||||
COM_PlayerMenu = 36,
|
||||
COM_Chat = 37;
|
||||
|
||||
const BYTE
|
||||
COM_MenuEnter = 38,
|
||||
COM_MenuEnterAll = 39,
|
||||
|
@ -208,29 +130,13 @@ const BYTE
|
|||
COM_MenuRight = 53,
|
||||
COM_MenuUp = 54,
|
||||
COM_MenuDown = 55,
|
||||
COM_MenuSelect = 60,
|
||||
|
||||
COM_MenuFirst = COM_MenuEnter,
|
||||
COM_MenuLast = COM_MenuSelect,
|
||||
|
||||
COM_MenuNavigation1 = COM_MenuShowText,
|
||||
COM_MenuNavigation2 = COM_MenuSelect;
|
||||
|
||||
//=================================== SendCommand ========================================
|
||||
const int32_t
|
||||
C4P_Command_None = 0,
|
||||
C4P_Command_Set = 1,
|
||||
C4P_Command_Add = 2,
|
||||
C4P_Command_Append = 4,
|
||||
C4P_Command_Range = 8;
|
||||
COM_MenuSelect = 60;
|
||||
|
||||
//=================================== Owners ==============================================
|
||||
|
||||
const int
|
||||
NO_OWNER = -1,
|
||||
ANY_OWNER = -2,
|
||||
BY_OWNER = 10000,
|
||||
BY_HOSTILE_OWNER = 20000;
|
||||
ANY_OWNER = -2;
|
||||
|
||||
//=================================== League (escape those damn circular includes =========
|
||||
|
||||
|
|
|
@ -497,44 +497,6 @@ void C4ControlPlayerMouse::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(old_obj, "OldObj"));
|
||||
}
|
||||
|
||||
// *** C4ControlPlayerCommand
|
||||
|
||||
C4ControlPlayerCommand::C4ControlPlayerCommand(int32_t iPlr, int32_t iCmd, int32_t iX, int32_t iY,
|
||||
C4Object *pTarget, C4Object *pTarget2, int32_t iData, int32_t iAddMode)
|
||||
: iPlr(iPlr), iCmd(iCmd), iX(iX), iY(iY),
|
||||
iTarget(pTarget ? pTarget->Number : 0), iTarget2(pTarget2 ? pTarget2->Number : 0),
|
||||
iData(iData), iAddMode(iAddMode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void C4ControlPlayerCommand::Execute() const
|
||||
{
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if (pPlr)
|
||||
{
|
||||
pPlr->CountControl(C4Player::PCID_Command, iCmd+iX+iY+iTarget+iTarget2);
|
||||
pPlr->ObjectCommand(iCmd,
|
||||
::Objects.ObjectPointer(iTarget),
|
||||
iX,iY,
|
||||
::Objects.ObjectPointer(iTarget2),
|
||||
C4Value(iData),
|
||||
iAddMode);
|
||||
}
|
||||
}
|
||||
|
||||
void C4ControlPlayerCommand::CompileFunc(StdCompiler *pComp)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(mkIntPackAdapt(iPlr), "Player", -1));
|
||||
pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCmd), "Cmd", 0));
|
||||
pComp->Value(mkNamingAdapt(iX, "X", 0));
|
||||
pComp->Value(mkNamingAdapt(iY, "Y", 0));
|
||||
pComp->Value(mkNamingAdapt(iTarget, "Target", 0));
|
||||
pComp->Value(mkNamingAdapt(iTarget2, "Target2", 0));
|
||||
pComp->Value(mkNamingAdapt(iData, "Data", 0));
|
||||
pComp->Value(mkNamingAdapt(mkIntPackAdapt(iAddMode), "AddMode", 0));
|
||||
C4ControlPacket::CompileFunc(pComp);
|
||||
}
|
||||
// *** C4ControlMenuCommand
|
||||
|
||||
C4ControlMenuCommand::C4ControlMenuCommand(int32_t actionID, int32_t player, int32_t menuID, int32_t subwindowID, C4Object *target, int32_t actionType)
|
||||
|
|
|
@ -259,19 +259,6 @@ public:
|
|||
DECLARE_C4CONTROL_VIRTUALS
|
||||
};
|
||||
|
||||
class C4ControlPlayerCommand : public C4ControlPacket // sync
|
||||
{
|
||||
public:
|
||||
C4ControlPlayerCommand()
|
||||
: iPlr(-1), iCmd(-1) { }
|
||||
C4ControlPlayerCommand(int32_t iPlr, int32_t iCmd, int32_t iX, int32_t iY,
|
||||
C4Object *pTarget, C4Object *pTarget2, int32_t iData, int32_t iAddMode);
|
||||
protected:
|
||||
int32_t iPlr, iCmd, iX, iY, iTarget, iTarget2, iData, iAddMode;
|
||||
public:
|
||||
DECLARE_C4CONTROL_VIRTUALS
|
||||
};
|
||||
|
||||
class C4ControlMenuCommand : public C4ControlPacket // sync
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -442,40 +442,6 @@ CStdFont &C4GraphicsResource::GetFontByHeight(int32_t iHgt, float *pfZoom)
|
|||
return *pUseFont;
|
||||
}
|
||||
|
||||
int32_t C4GraphicsResource::GetColorIndex(int32_t iColor, bool fLast)
|
||||
{
|
||||
// Returns first or last (hardcoded) index into the clonk color palette.
|
||||
|
||||
// Not a valid index
|
||||
if (!Inside<int32_t>(iColor,0,C4MaxColor-1)) return 32;
|
||||
|
||||
// Last index for this color
|
||||
if (fLast)
|
||||
{
|
||||
// Colors with 8 shades
|
||||
if (iColor<10) return GetColorIndex(iColor,false)+7;
|
||||
// Colors with 4 shades
|
||||
else return GetColorIndex(iColor,false)+3;
|
||||
}
|
||||
|
||||
// First index for this color
|
||||
switch (iColor)
|
||||
{
|
||||
// Blue, red, green, yellow, light brown, dark brown, red brown, orange
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
||||
return 32+8*iColor;
|
||||
// Black, white
|
||||
case 8: case 9:
|
||||
return 16+8*(iColor-8);
|
||||
// Cyan, purple
|
||||
case 10: case 11:
|
||||
return 96+4*(iColor-10);
|
||||
}
|
||||
|
||||
// Unreachable code
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool C4GraphicsResource::ReloadResolutionDependantFiles()
|
||||
{
|
||||
if(!fInitialized) return false;
|
||||
|
|
|
@ -105,7 +105,6 @@ public:
|
|||
// achievement graphics
|
||||
C4AchievementGraphics Achievements;
|
||||
public:
|
||||
int32_t GetColorIndex(int32_t iColor, bool fLast=false);
|
||||
CStdFont &GetFontByHeight(int32_t iHgt, float *pfZoom=NULL); // get optimal font for given control size
|
||||
void Default();
|
||||
void Clear();
|
||||
|
|
|
@ -957,38 +957,6 @@ void C4Menu::AdjustSelection()
|
|||
SetSelection(iSel, iSel != Selection, true);
|
||||
}
|
||||
|
||||
bool C4Menu::ConvertCom(int32_t &rCom, int32_t &rData, bool fAsyncConversion)
|
||||
{
|
||||
// This function converts normal Coms to menu Coms before they are send to the queue
|
||||
|
||||
// Menu not active
|
||||
if (!IsActive()) return false;
|
||||
|
||||
// Convert plain com control to menu com
|
||||
switch (rCom)
|
||||
{
|
||||
// Convert recognized menu coms
|
||||
case COM_Throw: rCom = COM_MenuEnter; break;
|
||||
case COM_Dig: rCom = COM_MenuClose; break;
|
||||
case COM_Special2: rCom = COM_MenuEnterAll; break;
|
||||
case COM_Up: rCom = COM_MenuUp; break;
|
||||
case COM_Left: rCom = COM_MenuLeft; break;
|
||||
case COM_Down: rCom = COM_MenuDown; break;
|
||||
case COM_Right: rCom = COM_MenuRight; break;
|
||||
// Not a menu com: do nothing
|
||||
default: return true;
|
||||
}
|
||||
|
||||
// If text is still progressing, any menu com will complete it first
|
||||
// Note: conversion to COM_MenuShowText is not synchronized because text lengths may vary
|
||||
// between clients. The above switch is used to determine whether the com was a menu com
|
||||
if (fTextProgressing && fAsyncConversion)
|
||||
rCom = COM_MenuShowText;
|
||||
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Menu::SetLocation(int32_t iX, int32_t iY)
|
||||
{
|
||||
// just set position...
|
||||
|
|
|
@ -154,7 +154,6 @@ protected:
|
|||
bool fEqualIconItemHeight; // for dialog menus only: If set, all options with an icon are forced to have the same height
|
||||
bool fActive; // set if menu is shown - independant of GUI to keep synchronized when there's no GUI
|
||||
public:
|
||||
bool ConvertCom(int32_t &rCom, int32_t &rData, bool fAsyncConversion);
|
||||
void ClearPointers(C4Object *pObj);
|
||||
bool Refill();
|
||||
void Execute();
|
||||
|
|
|
@ -729,47 +729,6 @@ void C4MouseControl::Wheel(DWORD dwFlags)
|
|||
{
|
||||
}
|
||||
|
||||
bool C4MouseControl::IsValidMenu(C4Menu *pMenu)
|
||||
{
|
||||
// Local control fullscreen menu
|
||||
if (pMenu == FullScreen.pMenu)
|
||||
if (pMenu->IsActive())
|
||||
return true;
|
||||
// Local control player menu
|
||||
C4Player *pPlr;
|
||||
for (int32_t cnt=0; (pPlr=::Players.Get(cnt)); cnt++)
|
||||
if (pMenu == &(pPlr->Menu))
|
||||
if (pMenu->IsActive())
|
||||
return true;
|
||||
// No match found
|
||||
return false;
|
||||
}
|
||||
|
||||
bool C4MouseControl::SendControl(int32_t iCom, int32_t iData)
|
||||
{
|
||||
// Activate player menu / fullscreen main menu (local control)
|
||||
if (iCom==COM_PlayerMenu)
|
||||
{
|
||||
if (IsPassive() && FullScreen.Active)
|
||||
FullScreen.ActivateMenuMain();
|
||||
else
|
||||
pPlayer->ActivateMenuMain();
|
||||
return true;
|
||||
}
|
||||
// Open chat
|
||||
if (iCom==COM_Chat)
|
||||
{
|
||||
C4ChatDlg::ShowChat();
|
||||
return true;
|
||||
}
|
||||
// other controls not valid in passive mode
|
||||
if (IsPassive()) return false;
|
||||
// Player control queue
|
||||
Game.Input.Add(CID_PlrControl, new C4ControlPlayerControl(Player,iCom,iData));
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4MouseControl::DragScript()
|
||||
{
|
||||
// script drag should update target and selection so selection highlight on drop target is visible
|
||||
|
@ -824,19 +783,6 @@ void C4MouseControl::ButtonUpDragScript()
|
|||
Game.Input.Add(CID_PlrMouseMove, C4ControlPlayerMouse::DragDrop(::Players.Get(Player), DropObject, DragObject));
|
||||
}
|
||||
|
||||
void C4MouseControl::SendCommand(int32_t iCommand, int32_t iX, int32_t iY, C4Object *pTarget, C4Object *pTarget2, int32_t iData, int32_t iAddMode)
|
||||
{
|
||||
// no commands in passive mode
|
||||
if (IsPassive()) return;
|
||||
// no commands if player is eliminated or doesn't exist any more
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
if (!pPlr || pPlr->Eliminated) return;
|
||||
// User add multiple command mode
|
||||
if (ShiftDown) iAddMode|=C4P_Command_Append;
|
||||
// Command to control queue
|
||||
Game.Input.Add(CID_PlrCommand, new C4ControlPlayerCommand(Player,iCommand,iX,iY,pTarget,pTarget2,iData,iAddMode));
|
||||
}
|
||||
|
||||
void C4MouseControl::RightUpDragNone()
|
||||
{
|
||||
|
||||
|
|
|
@ -119,7 +119,6 @@ public:
|
|||
void SetTooltipText(const StdStrBuf &text);
|
||||
void SetTooltipRectangle(const C4Rect &rectangle);
|
||||
protected:
|
||||
void SendPlayerSelectNext();
|
||||
void UpdateFogOfWar();
|
||||
void RightUpDragNone();
|
||||
void ButtonUpDragScript();
|
||||
|
@ -134,13 +133,7 @@ protected:
|
|||
void LeftDown();
|
||||
void UpdateScrolling();
|
||||
void UpdateCursorTarget();
|
||||
void SendCommand(int32_t iCommand, int32_t iX=0, int32_t iY=0, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iData=0, int32_t iAddMode=C4P_Command_Set);
|
||||
int32_t UpdateObjectSelection();
|
||||
int32_t UpdateCrewSelection();
|
||||
int32_t UpdateSingleSelection();
|
||||
bool SendControl(int32_t iCom, int32_t iData=0);
|
||||
bool IsValidMenu(C4Menu *pMenu);
|
||||
bool UpdatePutTarget(bool fVehicle);
|
||||
C4Object *GetTargetObject(); // get MouseSelection object at position
|
||||
bool IsPassive(); // return whether mouse is only used to look around
|
||||
void ScrollView(float iX, float iY, float ViewWdt, float ViewHgt); // in landscape coordinates
|
||||
|
|
|
@ -1329,7 +1329,7 @@ C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerL
|
|||
C4P.PrefColorDw = C4P.GetPrefColorValue(C4P.PrefColor);
|
||||
C4P.OldPrefControlStyle = 1;
|
||||
C4P.OldPrefAutoContextMenu = 1;
|
||||
C4P.OldPrefControl = C4P_Control_Keyboard1;
|
||||
C4P.OldPrefControl = 0;
|
||||
}
|
||||
const int32_t BetweenElementDist = 2;
|
||||
// use black fonts here
|
||||
|
|
|
@ -119,7 +119,6 @@ const C4PktHandlingData PktHandlingData[] =
|
|||
{ CID_RemovePlr, PC_Control, "Remove Player", false, true, 0, PKT_UNPACK(C4ControlRemovePlr) },
|
||||
{ CID_PlrSelect, PC_Control, "Player Select", false, true, 0, PKT_UNPACK(C4ControlPlayerSelect)},
|
||||
{ CID_PlrControl, PC_Control, "Player Control", false, true, 0, PKT_UNPACK(C4ControlPlayerControl)},
|
||||
{ CID_PlrCommand, PC_Control, "Player Command", false, true, 0, PKT_UNPACK(C4ControlPlayerCommand)},
|
||||
{ CID_PlrAction, PC_Control, "Player Self-Mgmt Action", false, true, 0, PKT_UNPACK(C4ControlPlayerAction)},
|
||||
{ CID_PlrMouseMove, PC_Control, "Player Mouse Movement", false, true, 0, PKT_UNPACK(C4ControlPlayerMouse)},
|
||||
{ CID_Message, PC_Control, "Message", false, true, 0, PKT_UNPACK(C4ControlMessage) },
|
||||
|
|
|
@ -158,7 +158,7 @@ enum C4PacketType
|
|||
|
||||
CID_PlrSelect = CID_First | 0x20,
|
||||
CID_PlrControl = CID_First | 0x21,
|
||||
CID_PlrCommand = CID_First | 0x22,
|
||||
|
||||
CID_Message = CID_First | 0x23,
|
||||
CID_PlrAction = CID_First | 0x24,
|
||||
CID_PlrMouseMove = CID_First | 0x25,
|
||||
|
|
|
@ -58,7 +58,7 @@ void C4PlayerInfoCore::Default(C4RankSystem *pRanks)
|
|||
PrefColor=0;
|
||||
PrefColorDw=0xff;
|
||||
PrefColor2Dw=0;
|
||||
OldPrefControl=C4P_Control_Keyboard1;
|
||||
OldPrefControl=0;
|
||||
PrefPosition=0;
|
||||
PrefMouse=1;
|
||||
OldPrefControlStyle = 0;
|
||||
|
@ -163,7 +163,7 @@ void C4PlayerInfoCore::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(PrefColor2Dw, "AlternateColorDw", 0u));
|
||||
pComp->Value(mkNamingAdapt(PrefPosition, "Position", 0));
|
||||
pComp->Value(mkNamingAdapt(PrefMouse, "Mouse", 1));
|
||||
pComp->Value(mkNamingAdapt(OldPrefControl, "Control", C4P_Control_Keyboard2));
|
||||
pComp->Value(mkNamingAdapt(OldPrefControl, "Control", 1));
|
||||
pComp->Value(mkNamingAdapt(OldPrefControlStyle, "AutoStopControl", 0));
|
||||
pComp->Value(mkNamingAdapt(OldPrefAutoContextMenu, "AutoContextMenu", -1)); // compiling default is -1 (if this is detected, AutoContextMenus will be defaulted by control style)
|
||||
pComp->Value(mkNamingAdapt(PrefControl, "ControlSet", StdStrBuf()));
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <C4GameObjects.h>
|
||||
|
||||
bool SimFlightHitsLiquid(C4Real fcx, C4Real fcy, C4Real xdir, C4Real ydir);
|
||||
bool CreateConstructionSite(int32_t ctx, int32_t bty, C4ID strid, int32_t owner, C4Object *pByObj);
|
||||
|
||||
bool ObjectActionWalk(C4Object *cObj)
|
||||
{
|
||||
|
@ -179,25 +178,6 @@ bool ObjectActionCornerScale(C4Object *cObj)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ObjectComMovement(C4Object *cObj, int32_t comdir)
|
||||
{
|
||||
cObj->Action.ComDir=comdir;
|
||||
|
||||
PlayerObjectCommand(cObj->Owner,C4CMD_Follow,cObj);
|
||||
// direkt turnaround if standing still
|
||||
if (!cObj->xdir && (cObj->GetProcedure() == DFA_WALK || cObj->GetProcedure() == DFA_HANGLE))
|
||||
switch (comdir)
|
||||
{
|
||||
case COMD_Left: case COMD_UpLeft: case COMD_DownLeft:
|
||||
cObj->SetDir(DIR_Left);
|
||||
break;
|
||||
case COMD_Right: case COMD_UpRight: case COMD_DownRight:
|
||||
cObj->SetDir(DIR_Right);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectComStop(C4Object *cObj)
|
||||
{
|
||||
// Cease current action
|
||||
|
@ -270,42 +250,6 @@ bool ObjectComLetGo(C4Object *cObj, int32_t xdirf)
|
|||
return ObjectActionJump(cObj,itofix(xdirf),Fix0,true);
|
||||
}
|
||||
|
||||
bool ObjectComEnter(C4Object *cObj) // by pusher
|
||||
{
|
||||
if (!cObj) return false;
|
||||
|
||||
// NoPushEnter
|
||||
if (cObj->Def->NoPushEnter) return false;
|
||||
|
||||
// Check object entrance, try command enter
|
||||
C4Object *pTarget;
|
||||
DWORD ocf=OCF_Entrance;
|
||||
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
|
||||
if (ocf & OCF_Entrance)
|
||||
{ cObj->SetCommand(C4CMD_Enter,pTarget); return true; }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ObjectComUp(C4Object *cObj) // by DFA_WALK or DFA_SWIM
|
||||
{
|
||||
if (!cObj) return false;
|
||||
|
||||
// Check object entrance, try command enter
|
||||
C4Object *pTarget;
|
||||
DWORD ocf=OCF_Entrance;
|
||||
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
|
||||
if (ocf & OCF_Entrance)
|
||||
return PlayerObjectCommand(cObj->Owner,C4CMD_Enter,pTarget);
|
||||
|
||||
// Try jump
|
||||
if (cObj->GetProcedure()==DFA_WALK)
|
||||
return PlayerObjectCommand(cObj->Owner,C4CMD_Jump);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ObjectComDig(C4Object *cObj) // by DFA_WALK
|
||||
{
|
||||
if (!ObjectActionDig(cObj))
|
||||
|
@ -486,13 +430,3 @@ bool ComDirLike(int32_t iComDir, int32_t iSample)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget, int32_t tx, int32_t ty)
|
||||
{
|
||||
C4Player *pPlr=::Players.Get(plr);
|
||||
if (!pPlr) return false;
|
||||
int32_t iAddMode = C4P_Command_Set;
|
||||
// Adjust for old-style keyboard throw/drop control: add & in range
|
||||
if (cmdf==C4CMD_Throw || cmdf==C4CMD_Drop) iAddMode = C4P_Command_Add | C4P_Command_Range;
|
||||
// Route to player
|
||||
return pPlr->ObjectCommand(cmdf,pTarget,tx,ty,NULL,C4VNull,iAddMode);
|
||||
}
|
||||
|
|
|
@ -21,12 +21,9 @@
|
|||
#define INC_C4ObjectCom
|
||||
|
||||
#include "C4Real.h"
|
||||
#include <C4Id.h>
|
||||
|
||||
bool ComDirLike(int32_t iComDir, int32_t iSample);
|
||||
|
||||
bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget=NULL, int32_t tx=0, int32_t ty=0);
|
||||
|
||||
bool ObjectActionWalk(C4Object *cObj);
|
||||
bool ObjectActionStand(C4Object *cObj);
|
||||
bool ObjectActionJump(C4Object *cObj, C4Real xdir, C4Real ydir, bool fByCom);
|
||||
|
@ -42,8 +39,6 @@ bool ObjectActionDig(C4Object *cObj);
|
|||
bool ObjectActionPush(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectActionCornerScale(C4Object *cObj);
|
||||
|
||||
bool ObjectComMovement(C4Object *cObj, int32_t iComDir);
|
||||
bool ObjectComTurn(C4Object *cObj);
|
||||
bool ObjectComStop(C4Object *cObj);
|
||||
bool ObjectComGrab(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
|
@ -52,11 +47,8 @@ bool ObjectComDrop(C4Object *cObj, C4Object *pThing=NULL);
|
|||
bool ObjectComUnGrab(C4Object *cObj);
|
||||
bool ObjectComJump(C4Object *cObj);
|
||||
bool ObjectComLetGo(C4Object *cObj, int32_t xdirf);
|
||||
bool ObjectComUp(C4Object *cObj);
|
||||
bool ObjectComDig(C4Object *cObj);
|
||||
bool ObjectComEnter(C4Object *cObj);
|
||||
bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
bool ObjectComTake(C4Object *cObj, C4ID id);
|
||||
bool ObjectComTake(C4Object *cObj); // carlo
|
||||
bool ObjectComTake2(C4Object *cObj); // carlo
|
||||
bool ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t iPunch=0);
|
||||
|
|
|
@ -1042,28 +1042,6 @@ void C4Player::AdjustCursorCommand()
|
|||
}
|
||||
}
|
||||
|
||||
bool C4Player::ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode)
|
||||
{
|
||||
// Eliminated
|
||||
if (Eliminated) return false;
|
||||
// Hide startup
|
||||
if (ShowStartup) ShowStartup=false;
|
||||
// Always apply to cursor, even if it's not in the crew
|
||||
if (Cursor && Cursor->Status && Cursor != pTarget)
|
||||
ObjectCommand2Obj(Cursor, iCommand, pTarget, iX, iY, pTarget2, iData, iMode);
|
||||
|
||||
// Success
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::ObjectCommand2Obj(C4Object *cObj, int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode)
|
||||
{
|
||||
// forward to object
|
||||
if (iMode & C4P_Command_Append) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,true,iData,true,0,NULL,C4CMD_Mode_Base); // append: by Shift-click and for dragging of multiple objects (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Add) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,true,iData,false,0,NULL,C4CMD_Mode_Base); // append: by context menu and keyboard throw command (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Set) cObj->SetCommand(iCommand,pTarget,iX,iY,pTarget2,true,iData);
|
||||
}
|
||||
|
||||
void C4Player::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers)
|
||||
{
|
||||
assert(ID);
|
||||
|
|
|
@ -170,8 +170,6 @@ public:
|
|||
void DrawHostility(C4Facet &cgo, int32_t iIndex);
|
||||
void AdjustCursorCommand();
|
||||
|
||||
bool ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iTx, int32_t iTy, C4Object *pTarget2=NULL, C4Value iData=C4VNull, int32_t iAddMode=C4P_Command_Set);
|
||||
void ObjectCommand2Obj(C4Object *cObj, int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode);
|
||||
bool DoScore(int32_t iChange);
|
||||
bool Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName, const char *szFilename, bool fScenarioInit, class C4PlayerInfo *pInfo, C4ValueNumbers *);
|
||||
bool ScenarioAndTeamInit(int32_t idTeam);
|
||||
|
|
Loading…
Reference in New Issue