| 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 | |
| 25 | void DrawCommandKey(C4Facet &cgo, int32_t iCom, |
| 26 | bool fPressed = false, |
| 27 | const char *szText = nullptr); |
| 28 | |
| 29 | void DrawControlKey(C4Facet &cgo, int32_t iControl, |
| 30 | bool fPressed = false, |
| 31 | const char *szText = nullptr); |
| 32 | |
| 33 | int32_t Control2Com(int32_t iControl, bool fUp); |
| 34 | int32_t Com2Control(int32_t iCom); |
| 35 | int32_t Coms2ComDir(int32_t iComs); |
| 36 | bool ComDirLike(int32_t iComDir, int32_t iSample); |
| 37 | const char *ComName(int32_t iCom); |
| 38 | int32_t ComOrder(int32_t iCom); |
| 39 | std::string PlrControlKeyName(int32_t iPlayer, int32_t iControl, bool fShort); |
| 40 | |
| 41 | const int32_t ComOrderNum = 24; |
| 42 | |
| 43 | bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget = nullptr, int32_t tx = 0, int32_t ty = 0); |
| 44 | |
| 45 | bool ObjectActionWalk(C4Object *cObj); |
| 46 | bool ObjectActionStand(C4Object *cObj); |
| 47 | bool ObjectActionJump(C4Object *cObj, C4Fixed xdir, C4Fixed ydir, bool fByCom); |
| 48 | bool ObjectActionDive(C4Object *cObj, C4Fixed xdir, C4Fixed ydir); |
| 49 | bool ObjectActionTumble(C4Object *cObj, int32_t dir, C4Fixed xdir, C4Fixed ydir); |
| 50 | bool ObjectActionGetPunched(C4Object *cObj, C4Fixed xdir, C4Fixed ydir); |
| 51 | bool ObjectActionKneel(C4Object *cObj); |
| 52 | bool ObjectActionFlat(C4Object *cObj, int32_t dir); |
| 53 | bool ObjectActionScale(C4Object *cObj, int32_t dir); |
| 54 | bool ObjectActionHangle(C4Object *cObj, int32_t dir); |
| 55 | bool ObjectActionThrow(C4Object *cObj, C4Object *pThing = nullptr); |
| 56 | bool ObjectActionDig(C4Object *cObj); |
| 57 | bool ObjectActionBuild(C4Object *cObj, C4Object *pTarget); |
| 58 | bool ObjectActionPush(C4Object *cObj, C4Object *pTarget); |
| 59 | bool ObjectActionChop(C4Object *cObj, C4Object *pTarget); |
| 60 | bool ObjectActionCornerScale(C4Object *cObj); |
| 61 | bool ObjectActionFight(C4Object *cObj, C4Object *pTarget); |
| 62 | |
| 63 | bool ObjectComMovement(C4Object *cObj, int32_t iComDir); |
| 64 | bool ObjectComStop(C4Object *cObj); |
| 65 | bool ObjectComGrab(C4Object *cObj, C4Object *pTarget); |
| 66 | bool ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing = nullptr); |
| 67 | bool ObjectComThrow(C4Object *cObj, C4Object *pThing = nullptr); |
| 68 | bool ObjectComDrop(C4Object *cObj, C4Object *pThing = nullptr); |
| 69 | bool ObjectComUnGrab(C4Object *cObj); |
| 70 | bool ObjectComJump(C4Object *cObj); |
| 71 | bool ObjectComLetGo(C4Object *cObj, int32_t xdirf); |
| 72 | bool ObjectComUp(C4Object *cObj); |
| 73 | bool ObjectComDig(C4Object *cObj); |
| 74 | bool ObjectComChop(C4Object *cObj, C4Object *pTarget); |
| 75 | bool ObjectComBuild(C4Object *cObj, C4Object *pTarget); |
| 76 | bool ObjectComEnter(C4Object *cObj); |
| 77 | bool ObjectComDownDouble(C4Object *cObj); |
| 78 | bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing = nullptr); |
| 79 | bool ObjectComTake(C4Object *cObj); // carlo |
| 80 | bool ObjectComTake2(C4Object *cObj); // carlo |
| 81 | bool ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t iPunch = 0); |
| 82 | bool ObjectComCancelAttach(C4Object *cObj); |
| 83 | void ObjectComDigDouble(C4Object *cObj); |
| 84 | void ObjectComStopDig(C4Object *cObj); |
| 85 | |
| 86 | bool Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, bool fShowErrors = true); |
| 87 | bool SellFromBase(int32_t iPlr, C4Object *pBase, C4ID id, C4Object *pSellObj); |
| 88 | |