objects: Remove Chop command, OCF_Chop, CHOP procedure, Chop defcore val, FX_Call_DmgChop

Günther Brammer 2011-01-02 01:18:45 +01:00
parent 4984cd6b99
commit 877dfee49e
18 changed files with 4 additions and 149 deletions

View File

@ -12,7 +12,7 @@ public func ControlUse(object pByClonk, int iX, int iY)
Find_Layer(GetObjectLayer()), Find_NoContainer());
if( tree )
{
pByClonk->SetCommand("Chop", tree);
pByClonk->SetAction("Chop"); //FIXME: actually implement this
Sound("KnightConfirm*");
} else {
if(pByClonk->GetAction() == "Chop")

View File

@ -18,7 +18,6 @@ static const DFA_SWIM = "SWIM";
static const DFA_THROW = "THROW";
static const DFA_BRIDGE = "BRIDGE";
static const DFA_PUSH = "PUSH";
static const DFA_CHOP = "CHOP";
static const DFA_LIFT = "LIFT";
static const DFA_FLOAT = "FLOAT";
static const DFA_ATTACH = "ATTACH";

View File

@ -37,7 +37,6 @@ global func GetDefGrab() { return GetDefCoreVal("Grab", "DefCore"); }
global func GetDefGrabPutGet() { return GetDefCoreVal("GrabPutGet", "DefCore"); }
global func GetDefCollectible() { return GetDefCoreVal("Collectible", "DefCore"); }
global func GetDefRotate() { return GetDefCoreVal("Rotate", "DefCore"); }
global func GetDefChop() { return GetDefCoreVal("Chop", "DefCore"); }
global func GetDefFloat() { return GetDefCoreVal("Float", "DefCore"); }
global func GetDefContainBlast(){ return GetDefCoreVal("ContainBlast", "DefCore"); }
global func GetDefHorizontalFix() { return GetDefCoreVal("HorizontalFix", "DefCore"); }

View File

@ -91,7 +91,6 @@ IDS_COMM_ATTACK=Angreifen
IDS_COMM_BUILD=Bauen
IDS_COMM_BUY=Kaufen
IDS_COMM_CALL=Objektaufruf
IDS_COMM_CHOP=Fällen
IDS_COMM_CONSTRUCT=Konstruktion
IDS_COMM_CONTEXT=Kontext
IDS_COMM_DIG=Graben
@ -122,7 +121,6 @@ IDS_CON_BUILDINFO=Baumaterial
IDS_CON_BUILDMATNEED=%s|braucht noch
IDS_CON_BUILDMATNONE=%s braucht kein|weiteres Baumaterial.
IDS_CON_BUY=Kaufen
IDS_CON_CHOP=%s fällen.
IDS_CON_COLLECT=%s einsammeln.
IDS_CON_CONTENTS=Inhalt
IDS_CON_DIGOUT=%s ausgraben.
@ -1092,7 +1090,6 @@ IDS_OBJ_EMPTY=%s ist leer.
IDS_OBJ_HOSTILENOENTRANCE=%s verfeindet.|Eingang versperrt!
IDS_OBJ_LINEREMOVAL=%s abgenommen.
IDS_OBJ_NEWLINE=Konstruktion|%s.
IDS_OBJ_NOCHOP=%s kann|keine Bäume fällen.
IDS_OBJ_NOCON=%s kann nicht|gebaut werden!
IDS_OBJ_NOCONACTIV=%s ist noch nicht fertig|und kann noch nicht|aktiviert werden.
IDS_OBJ_NOCONNECT=Verbindung hier|nicht möglich.

View File

@ -91,7 +91,6 @@ IDS_COMM_ATTACK=Attack
IDS_COMM_BUILD=Build
IDS_COMM_BUY=Buy
IDS_COMM_CALL=Object call
IDS_COMM_CHOP=Chop
IDS_COMM_CONSTRUCT=Construction
IDS_COMM_CONTEXT=Context
IDS_COMM_DIG=Digging
@ -122,7 +121,6 @@ IDS_CON_BUILDINFO=Construction material
IDS_CON_BUILDMATNEED=%s|needs
IDS_CON_BUILDMATNONE=%s needs|no more material.
IDS_CON_BUY=Buy
IDS_CON_CHOP=Chop %s.
IDS_CON_COLLECT=Collect %s.
IDS_CON_CONTENTS=Contents
IDS_CON_DIGOUT=Dig out %s.
@ -1091,7 +1089,6 @@ IDS_OBJ_EMPTY=%s is empty.
IDS_OBJ_HOSTILENOENTRANCE=%s hostile.|No entrance!
IDS_OBJ_LINEREMOVAL=%s disconnected.
IDS_OBJ_NEWLINE=New|%s.
IDS_OBJ_NOCHOP=%s cannot|chop trees.
IDS_OBJ_NOCON=%s cannot|be built.
IDS_OBJ_NOCONACTIV=%s not completed.|Activation denied.
IDS_OBJ_NOCONNECT=Connection not possible.

View File

@ -103,7 +103,7 @@ const uint32_t
OCF_HitSpeed1 = 1<<5,
OCF_FullCon = 1<<6,
OCF_Inflammable = 1<<7,
OCF_Chop = 1<<8,
OCF_Rotate = 1<<9,
OCF_Exclusive = 1<<10,
OCF_Entrance = 1<<11,

View File

@ -61,7 +61,6 @@ const char *CommandName(int32_t iCommand)
case C4CMD_Exit: return "Exit";
case C4CMD_Grab: return "Grab";
case C4CMD_Throw: return "Throw";
case C4CMD_Chop: return "Chop";
case C4CMD_UnGrab: return "UnGrab";
case C4CMD_Jump: return "Jump";
case C4CMD_Wait: return "Wait";
@ -97,7 +96,6 @@ const char* CommandNameID(int32_t iCommand)
case C4CMD_Exit: return "IDS_COMM_EXIT";
case C4CMD_Grab: return "IDS_COMM_GRAB";
case C4CMD_Throw: return "IDS_COMM_THROW";
case C4CMD_Chop: return "IDS_COMM_CHOP";
case C4CMD_UnGrab: return "IDS_COMM_UNGRAB";
case C4CMD_Jump: return "IDS_COMM_JUMP";
case C4CMD_Wait: return "IDS_COMM_WAIT";
@ -313,8 +311,8 @@ void C4Command::MoveTo()
if (cObj->Action.Target)
{ cx=cObj->Action.Target->GetX(); cy=cObj->Action.Target->GetY(); }
break;
// Chop, build, dig, bridge: stop
case DFA_CHOP: case DFA_DIG: case DFA_BRIDGE:
// dig, bridge: stop
case DFA_DIG: case DFA_BRIDGE:
ObjectComStop(cObj);
break;
}
@ -462,10 +460,6 @@ void C4Command::Dig()
if (cObj->Contained)
{ cObj->AddCommand(C4CMD_Exit,NULL,0,0,50); return; }
// Building or chopping: stop
if (cObj->GetProcedure()==DFA_CHOP)
ObjectComStop(cObj);
// Scaling or hangling: let go
if ((cObj->GetProcedure()==DFA_SCALE) || (cObj->GetProcedure()==DFA_HANGLE))
ObjectComLetGo(cObj,(cObj->Action.Dir==DIR_Left) ? +1 : -1);
@ -570,10 +564,6 @@ void C4Command::Enter()
// Already in target object
if (cObj->Contained==Target) { Finish(true); return; }
// Building or chopping: stop
if (cObj->GetProcedure()==DFA_CHOP)
ObjectComStop(cObj);
// Digging: stop
if (cObj->GetProcedure()==DFA_DIG) ObjectComStop(cObj);
@ -676,9 +666,6 @@ void C4Command::Grab()
if (cObj->GetProcedure()==DFA_PUSH)
if (cObj->Action.Target==Target)
{ Finish(true); return; }
// Building or chopping: stop
if (cObj->GetProcedure()==DFA_CHOP)
ObjectComStop(cObj);
// Digging: stop
if (cObj->GetProcedure()==DFA_DIG) ObjectComStop(cObj);
// Grabbing: let go
@ -732,10 +719,6 @@ void C4Command::PushTo()
}
}
// Building or chopping: stop
if (cObj->GetProcedure()==DFA_CHOP)
ObjectComStop(cObj);
// Digging: stop
if (cObj->GetProcedure()==DFA_DIG) ObjectComStop(cObj);
@ -755,40 +738,6 @@ void C4Command::PushTo()
}
void C4Command::Chop()
{
DWORD ocf;
// No target: fail
if (!Target) { Finish(); return; }
// Target not chopable: done (assume was successfully chopped)
if (!(Target->OCF & OCF_Chop))
{ Finish(true); return; }
// Chopping target: wait
if ((cObj->GetProcedure()==DFA_CHOP) && (cObj->Action.Target==Target))
return;
// Grabbing: let go
if (cObj->GetProcedure()==DFA_PUSH)
{ cObj->AddCommand(C4CMD_UnGrab,NULL,0,0,50); return; }
// Building, digging or chopping other: stop
if ((cObj->GetProcedure()==DFA_DIG) || (cObj->GetProcedure()==DFA_CHOP))
{ ObjectComStop(cObj); return; }
// At target object, in correct shopping position
ocf=OCF_All;
if (!cObj->Contained && Target->At(cObj->GetX(),cObj->GetY(),ocf) && Inside<int32_t>(Abs(cObj->GetX() - Target->GetX()), 4, 9))
{
cObj->Action.ComDir=COMD_Stop;
ObjectComChop(cObj,Target);
}
// Else, move to object
else
{
cObj->AddCommand(C4CMD_MoveTo, NULL, (cObj->GetX() > Target->GetX()) ? Target->GetX()+6 : Target->GetX()-6, Target->GetY(), 50);
// Too close? Move away first.
if (Abs(cObj->GetX() - Target->GetX()) < 5)
cObj->AddCommand(C4CMD_MoveTo, NULL, (cObj->GetX() > Target->GetX()) ? Target->GetX()+15 : Target->GetX()-15, Target->GetY(), 50);
}
}
void C4Command::UnGrab()
{
ObjectComUnGrab(cObj);
@ -1393,7 +1342,6 @@ void C4Command::Execute()
case C4CMD_Grab: Grab(); break;
case C4CMD_UnGrab: UnGrab(); break;
case C4CMD_Throw: Throw(); break;
case C4CMD_Chop: Chop(); break;
case C4CMD_Jump: Jump(); break;
case C4CMD_Wait: Wait(); break;
case C4CMD_Get: Get(); break;
@ -2021,10 +1969,6 @@ int32_t C4Command::GetExpGain()
case C4CMD_Home:
return 2;
// advanced activities
case C4CMD_Chop:
return 5;
// victory!
case C4CMD_Attack:
return 15;

View File

@ -36,7 +36,6 @@ enum C4CMD
C4CMD_Exit,
C4CMD_Grab,
C4CMD_Throw,
C4CMD_Chop,
C4CMD_UnGrab,
C4CMD_Jump,
C4CMD_Wait,
@ -123,7 +122,6 @@ protected:
void Grab();
void UnGrab();
void Throw();
void Chop();
void Jump();
void Wait();
void Take();

View File

@ -75,7 +75,6 @@ void C4Def::DefaultDefCore()
Carryable=0;
Rotateable=0;
RotatedEntrance=0;
Chopable=0;
Float=0;
ColorByOwner=0;
NoHorizontalMove=0;
@ -262,7 +261,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(Carryable, "Collectible", 0 ));
pComp->Value(mkNamingAdapt(Rotateable, "Rotate", 0 ));
pComp->Value(mkNamingAdapt(RotatedEntrance, "RotatedEntrance", 0 ));
pComp->Value(mkNamingAdapt(Chopable, "Chop", 0 ));
pComp->Value(mkNamingAdapt(Float, "Float", 0 ));
pComp->Value(mkNamingAdapt(ContainBlast, "ContainBlast", 0 ));
pComp->Value(mkNamingAdapt(ColorByOwner, "ColorByOwner", 0 ));

View File

@ -131,7 +131,6 @@ public:
int32_t Grab; // 0 not 1 push 2 grab only
int32_t Carryable;
int32_t Rotateable;
int32_t Chopable;
int32_t Float;
int32_t ColorByOwner;
int32_t NoHorizontalMove;

View File

@ -781,12 +781,6 @@ void C4Object::SetOCF()
// OCF_FullCon: Is fully completed/grown
if (Con>=FullCon)
OCF|=OCF_FullCon;
// OCF_Chop: Can be chopped
DWORD cocf = OCF_Exclusive;
if (Def->Chopable)
if (Category & C4D_StaticBack) // Must be static back: this excludes trees that have already been chopped
if (!::Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
OCF|=OCF_Chop;
// OCF_Rotate: Can be rotated
if (Def->Rotateable)
// Don't rotate minimum (invisible) construction sites
@ -877,7 +871,6 @@ void C4Object::UpdateOCF()
#endif
// Keep the bits that only have to be updated with SetOCF (def, category, con, alive, onfire)
OCF=OCF & (OCF_Normal | OCF_Exclusive | OCF_Edible | OCF_Grab | OCF_FullCon
/*| OCF_Chop - now updated regularly, see below */
| OCF_Rotate | OCF_OnFire | OCF_Inflammable | OCF_Living | OCF_Alive
| OCF_Prey | OCF_CrewMember | OCF_AttractLightning);
// OCF_Carryable: Can be picked up
@ -891,12 +884,6 @@ void C4Object::UpdateOCF()
if ((Def->Entrance.Wdt>0) && (Def->Entrance.Hgt>0))
if ((OCF & OCF_FullCon) && ((Def->RotatedEntrance == 1) || (r <= Def->RotatedEntrance)))
OCF|=OCF_Entrance;
// OCF_Chop: Can be chopped
DWORD cocf = OCF_Exclusive;
if (Def->Chopable)
if (Category & C4D_StaticBack) // Must be static back: this excludes trees that have already been chopped
if (!::Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
OCF|=OCF_Chop;
// HitSpeeds
if (cspeed>=HitSpeed1) OCF|=OCF_HitSpeed1;
if (cspeed>=HitSpeed2) OCF|=OCF_HitSpeed2;
@ -1610,16 +1597,6 @@ bool C4Object::ActivateEntrance(int32_t by_plr, C4Object *by_obj)
return false;
}
bool C4Object::Chop(C4Object *pByObject)
{
// Valid check
if (!Status || !Def || Contained || !(OCF & OCF_Chop))
return false;
// Chop
if (!::Game.iTick10) DoDamage( +10, pByObject ? pByObject->Owner : NO_OWNER, C4FxCall_DmgChop);
return true;
}
bool C4Object::Push(C4Real txdir, C4Real dforce, bool fStraighten)
{
// Valid check
@ -3660,7 +3637,6 @@ bool ReduceLineSegments(C4Shape &rShape, bool fAlternate)
void C4Object::ExecAction()
{
Action.t_attach=CNAT_None;
DWORD ocf;
C4Real iTXDir;
C4Real lftspeed,tydir;
int32_t iTargetX;
@ -4090,25 +4066,6 @@ void C4Object::ExecAction()
break;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case DFA_CHOP:
// Valid check
if (!Action.Target) { ObjectActionStand(this); return; }
// Chop
if (!::Game.iTick3)
if (!Action.Target->Chop(this))
{ ObjectActionStand(this); return; }
// Valid check (again, target might have been destroyed)
if (!Action.Target) { ObjectActionStand(this); return; }
// AtObject check
ocf=OCF_Chop;
if (!Action.Target->At(GetX(),GetY(),ocf)) { ObjectActionStand(this); return; }
// Position
SetDir( (GetX()>Action.Target->GetX()) ? DIR_Left : DIR_Right );
xdir=ydir=0;
Action.t_attach|=CNAT_Bottom;
Mobile=1;
break;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case DFA_LIFT:
// Valid check
if (!Action.Target) { SetAction(0); return; }

View File

@ -312,7 +312,6 @@ public:
void DoExperience(int32_t change);
bool Promote(int32_t torank, bool exception, bool fForceRankName);
void Blast(int32_t iLevel, int32_t iCausedBy);
bool Chop(C4Object *pByObject);
bool Push(C4Real txdir, C4Real dforce, bool fStraighten);
bool Lift(C4Real tydir, C4Real dforce);
void Fling(C4Real txdir, C4Real tydir, bool fAddSpeed); // set/add given speed to current, setting jump/tumble-actions

View File

@ -168,11 +168,6 @@ bool ObjectActionPush(C4Object *cObj, C4Object *target)
return cObj->SetActionByName("Push",target);
}
bool ObjectActionChop(C4Object *cObj, C4Object *target)
{
return cObj->SetActionByName("Chop",target);
}
bool CornerScaleOkay(C4Object *cObj, int32_t iRangeX, int32_t iRangeY)
{
int32_t ctx,cty;
@ -378,24 +373,11 @@ bool ObjectComDig(C4Object *cObj) // by DFA_WALK
void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DFA_SWIM
{
C4Object *pTarget;
DWORD ocf;
// Contents activation (first contents object only)
if (cObj->Contents.GetObject())
if (!! cObj->Contents.GetObject()->Call(PSF_Activate,&C4AulParSet(C4VObj(cObj))))
return;
// Chop
ocf=OCF_Chop;
if (cObj->GetProcedure()!=DFA_SWIM)
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_Chop)
{
PlayerObjectCommand(cObj->Owner,C4CMD_Chop,pTarget);
return;
}
// Own activation call
if (!! cObj->Call(PSF_Activate, &C4AulParSet(C4VObj(cObj)))) return;
@ -487,13 +469,6 @@ bool ObjectComDrop(C4Object *cObj, C4Object *pThing)
return true;
}
bool ObjectComChop(C4Object *cObj, C4Object *pTarget)
{
if (!pTarget) return false;
if (cObj->GetProcedure()!=DFA_WALK) return false;
return ObjectActionChop(cObj,pTarget);
}
bool ObjectComBuild(C4Object *cObj, C4Object *pTarget)
{
if (!pTarget) return false;

View File

@ -53,7 +53,6 @@ bool ObjectActionThrow(C4Object *cObj, C4Object *pThing=NULL);
bool ObjectActionDig(C4Object *cObj);
bool ObjectActionBuild(C4Object *cObj, C4Object *pTarget);
bool ObjectActionPush(C4Object *cObj, C4Object *pTarget);
bool ObjectActionChop(C4Object *cObj, C4Object *pTarget);
bool ObjectActionCornerScale(C4Object *cObj);
bool ObjectComMovement(C4Object *cObj, int32_t iComDir);
@ -68,7 +67,6 @@ bool ObjectComJump(C4Object *cObj);
bool ObjectComLetGo(C4Object *cObj, int32_t xdirf);
bool ObjectComUp(C4Object *cObj);
bool ObjectComDig(C4Object *cObj);
bool ObjectComChop(C4Object *cObj, C4Object *pTarget);
bool ObjectComBuild(C4Object *cObj, C4Object *pTarget);
bool ObjectComEnter(C4Object *cObj);
bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);

View File

@ -53,7 +53,6 @@
#define C4FxCall_DmgScript 0 // damage through script call
#define C4FxCall_DmgBlast 1 // damage through blast
#define C4FxCall_DmgFire 2 // damage through fire
#define C4FxCall_DmgChop 3 // damage through chopping
// energy loss callbacks
#define C4FxCall_EngScript 32 // energy loss through script call

View File

@ -6025,7 +6025,6 @@ C4ScriptConstDef C4ScriptConstMap[]=
{ "OCF_HitSpeed1" ,C4V_Int, OCF_HitSpeed1},
{ "OCF_Fullcon" ,C4V_Int, OCF_FullCon},
{ "OCF_Inflammable" ,C4V_Int, OCF_Inflammable},
{ "OCF_Chop" ,C4V_Int, OCF_Chop},
{ "OCF_Rotate" ,C4V_Int, OCF_Rotate},
{ "OCF_Exclusive" ,C4V_Int, OCF_Exclusive},
{ "OCF_Entrance" ,C4V_Int, OCF_Entrance},
@ -6100,7 +6099,6 @@ C4ScriptConstDef C4ScriptConstMap[]=
{ "FX_Call_DmgScript" ,C4V_Int, C4FxCall_DmgScript }, // damage through script call
{ "FX_Call_DmgBlast" ,C4V_Int, C4FxCall_DmgBlast }, // damage through blast
{ "FX_Call_DmgFire" ,C4V_Int, C4FxCall_DmgFire }, // damage through fire
{ "FX_Call_DmgChop" ,C4V_Int, C4FxCall_DmgChop }, // damage through chopping
{ "FX_Call_Energy" ,C4V_Int, 32 }, // bitmask for generic energy loss
{ "FX_Call_EngScript" ,C4V_Int, C4FxCall_EngScript }, // energy loss through script call
{ "FX_Call_EngBlast" ,C4V_Int, C4FxCall_EngBlast }, // energy loss through blast

View File

@ -153,7 +153,6 @@ C4StringTable::C4StringTable()
P[DFA_THROW] = "THROW";
P[DFA_BRIDGE] = "BRIDGE";
P[DFA_PUSH] = "PUSH";
P[DFA_CHOP] = "CHOP";
P[DFA_LIFT] = "LIFT";
P[DFA_FLOAT] = "FLOAT";
P[DFA_ATTACH] = "ATTACH";

View File

@ -242,7 +242,6 @@ enum C4PropertyName
DFA_THROW,
DFA_BRIDGE,
DFA_PUSH,
DFA_CHOP,
DFA_LIFT,
DFA_FLOAT,
DFA_ATTACH,