1/*
2 * LegacyClonk
3 *
4 * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design)
5 * Copyright (c) 2017-2021, The LegacyClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16
17/* Lots of handler functions for object action */
18
19#pragma once
20
21#include "C4ForwardDeclarations.h"
22#include <C4Id.h>
23#include "Fixed.h"
24
25void DrawCommandKey(C4Facet &cgo, int32_t iCom,
26 bool fPressed = false,
27 const char *szText = nullptr);
28
29void DrawControlKey(C4Facet &cgo, int32_t iControl,
30 bool fPressed = false,
31 const char *szText = nullptr);
32
33int32_t Control2Com(int32_t iControl, bool fUp);
34int32_t Com2Control(int32_t iCom);
35int32_t Coms2ComDir(int32_t iComs);
36bool ComDirLike(int32_t iComDir, int32_t iSample);
37const char *ComName(int32_t iCom);
38int32_t ComOrder(int32_t iCom);
39std::string PlrControlKeyName(int32_t iPlayer, int32_t iControl, bool fShort);
40
41const int32_t ComOrderNum = 24;
42
43bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget = nullptr, int32_t tx = 0, int32_t ty = 0);
44
45bool ObjectActionWalk(C4Object *cObj);
46bool ObjectActionStand(C4Object *cObj);
47bool ObjectActionJump(C4Object *cObj, C4Fixed xdir, C4Fixed ydir, bool fByCom);
48bool ObjectActionDive(C4Object *cObj, C4Fixed xdir, C4Fixed ydir);
49bool ObjectActionTumble(C4Object *cObj, int32_t dir, C4Fixed xdir, C4Fixed ydir);
50bool ObjectActionGetPunched(C4Object *cObj, C4Fixed xdir, C4Fixed ydir);
51bool ObjectActionKneel(C4Object *cObj);
52bool ObjectActionFlat(C4Object *cObj, int32_t dir);
53bool ObjectActionScale(C4Object *cObj, int32_t dir);
54bool ObjectActionHangle(C4Object *cObj, int32_t dir);
55bool ObjectActionThrow(C4Object *cObj, C4Object *pThing = nullptr);
56bool ObjectActionDig(C4Object *cObj);
57bool ObjectActionBuild(C4Object *cObj, C4Object *pTarget);
58bool ObjectActionPush(C4Object *cObj, C4Object *pTarget);
59bool ObjectActionChop(C4Object *cObj, C4Object *pTarget);
60bool ObjectActionCornerScale(C4Object *cObj);
61bool ObjectActionFight(C4Object *cObj, C4Object *pTarget);
62
63bool ObjectComMovement(C4Object *cObj, int32_t iComDir);
64bool ObjectComStop(C4Object *cObj);
65bool ObjectComGrab(C4Object *cObj, C4Object *pTarget);
66bool ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing = nullptr);
67bool ObjectComThrow(C4Object *cObj, C4Object *pThing = nullptr);
68bool ObjectComDrop(C4Object *cObj, C4Object *pThing = nullptr);
69bool ObjectComUnGrab(C4Object *cObj);
70bool ObjectComJump(C4Object *cObj);
71bool ObjectComLetGo(C4Object *cObj, int32_t xdirf);
72bool ObjectComUp(C4Object *cObj);
73bool ObjectComDig(C4Object *cObj);
74bool ObjectComChop(C4Object *cObj, C4Object *pTarget);
75bool ObjectComBuild(C4Object *cObj, C4Object *pTarget);
76bool ObjectComEnter(C4Object *cObj);
77bool ObjectComDownDouble(C4Object *cObj);
78bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing = nullptr);
79bool ObjectComTake(C4Object *cObj); // carlo
80bool ObjectComTake2(C4Object *cObj); // carlo
81bool ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t iPunch = 0);
82bool ObjectComCancelAttach(C4Object *cObj);
83void ObjectComDigDouble(C4Object *cObj);
84void ObjectComStopDig(C4Object *cObj);
85
86bool Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, bool fShowErrors = true);
87bool SellFromBase(int32_t iPlr, C4Object *pBase, C4ID id, C4Object *pSellObj);
88