From 96fa57eb6b9e0852283a5d9ac705cd2fb52021e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Sun, 2 Jan 2011 23:55:48 +0100 Subject: [PATCH] objects: Replace Grab defcore value with Touchable property --- .../Boomshire.c4s/ArrowWheel.c4d/DefCore.txt | 1 - .../BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/Script.c | 1 + .../Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/DefCore.txt | 1 - .../Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/Script.c | 1 + planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/DefCore.txt | 1 - planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c | 1 + planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/DefCore.txt | 1 - planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c | 1 + src/game/object/C4Command.cpp | 4 ++-- src/game/object/C4Def.cpp | 2 -- src/game/object/C4Def.h | 1 - src/game/object/C4Object.cpp | 4 ++-- src/script/C4StringTable.cpp | 1 + src/script/C4StringTable.h | 1 + tools/convert_cr_to_oc.py | 4 ++-- 15 files changed, 12 insertions(+), 13 deletions(-) diff --git a/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/DefCore.txt b/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/DefCore.txt index dbe4e1892..d855d8754 100644 --- a/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/DefCore.txt +++ b/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/DefCore.txt @@ -11,5 +11,4 @@ VertexY=8,8,0 VertexFriction=100,100,100 Value=20 Mass=1000 -Grab=2 Components=Wood=3;Metal=1; diff --git a/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/Script.c b/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/Script.c index 34185efa5..f6807fef3 100644 --- a/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/Script.c +++ b/planet/BackToTheRocks.c4f/Boomshire.c4s/ArrowWheel.c4d/Script.c @@ -60,3 +60,4 @@ func Definition(def) { SetProperty("PictureTransformation", Trans_Mul(Trans_Scale(800), Trans_Translate(0,0,0),Trans_Rotate(-20,1,0,0),Trans_Rotate(-30,0,1,0)), def); SetProperty("MeshTransformation", Trans_Rotate(-13,0,1,0)); } +local Touchable = 2; diff --git a/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/DefCore.txt b/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/DefCore.txt index 09b4cc1e8..6a25ad0a7 100644 --- a/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/DefCore.txt +++ b/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/DefCore.txt @@ -11,5 +11,4 @@ VertexY=8,8,0 VertexFriction=100,100,100 Value=20 Mass=1000 -Grab=2 Components=Wood=3;Metal=1; diff --git a/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/Script.c b/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/Script.c index c9d30e71d..f3256e51f 100644 --- a/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/Script.c +++ b/planet/Objects.c4d/Structures.c4d/StoneDoor.c4d/SpinWheel.c4d/Script.c @@ -67,3 +67,4 @@ func Definition(def) { SetProperty("PictureTransformation", Trans_Mul(Trans_Scale(800), Trans_Translate(0,0,0),Trans_Rotate(-20,1,0,0),Trans_Rotate(-30,0,1,0)), def); SetProperty("MeshTransformation", Trans_Rotate(-13,0,1,0)); } +local Touchable = 2; diff --git a/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/DefCore.txt b/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/DefCore.txt index 2674977b9..8d111da11 100644 --- a/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/DefCore.txt +++ b/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/DefCore.txt @@ -15,7 +15,6 @@ Value=50 Mass=125 Components=Metal=4;Wood=2; Rebuy=1 -Grab=1 GrabPutGet=C4D_GrabGet|C4D_GrabPut Rotate=30 UprightAttach=8 diff --git a/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c b/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c index e1d85027d..a3ca4637a 100644 --- a/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c +++ b/planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c @@ -346,3 +346,4 @@ func Definitio(def) local Name = "$Name$"; local Description = "$Description$"; +local Touchable = 1; diff --git a/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/DefCore.txt b/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/DefCore.txt index 5a7b2cf54..3dcef3a53 100644 --- a/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/DefCore.txt +++ b/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/DefCore.txt @@ -16,7 +16,6 @@ Mass=75 Components=Metal=2;Wood=1; Collection=-12,-8,24,10 Rebuy=1 -Grab=1 GrabPutGet=C4D_GrabGet|C4D_GrabPut Rotate=30 UprightAttach=8 diff --git a/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c b/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c index 3d5c577b7..ae040d8b5 100644 --- a/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c +++ b/planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c @@ -119,3 +119,4 @@ func Definition(def) local Name = "$Name$"; local Description = "$Description$"; +local Touchable = 1; diff --git a/src/game/object/C4Command.cpp b/src/game/object/C4Command.cpp index 2138f5647..477b83121 100644 --- a/src/game/object/C4Command.cpp +++ b/src/game/object/C4Command.cpp @@ -292,7 +292,7 @@ void C4Command::MoveTo() // Pushing grab only or not desired: let go (pulling, too?) if (cObj->GetProcedure()==DFA_PUSH) if (cObj->Action.Target) - if (cObj->Action.Target->Def->Grab == 2 || !(Data.getInt() & C4CMD_MoveTo_PushTarget)) + if (cObj->Action.Target->GetPropertyInt(P_Touchable) == 2 || !(Data.getInt() & C4CMD_MoveTo_PushTarget)) { // Re-evaluate this command because vehicle control might have blocked evaluation Evaluated=false; @@ -568,7 +568,7 @@ void C4Command::Enter() // Pushing grab only or pushing not desired: let go if (cObj->GetProcedure()==DFA_PUSH) if (cObj->Action.Target) - if (cObj->Action.Target->Def->Grab == 2 || !(Data.getInt() & C4CMD_Enter_PushTarget)) + if (cObj->Action.Target->GetPropertyInt(P_Touchable) == 2 || !(Data.getInt() & C4CMD_Enter_PushTarget)) { cObj->AddCommand(C4CMD_UnGrab,NULL,0,0,50); return; } // Pushing target: let go diff --git a/src/game/object/C4Def.cpp b/src/game/object/C4Def.cpp index c0fc8f986..4efbb3c38 100644 --- a/src/game/object/C4Def.cpp +++ b/src/game/object/C4Def.cpp @@ -71,7 +71,6 @@ void C4Def::DefaultDefCore() ContactIncinerate=0; BlastIncinerate=0; Constructable=0; - Grab=0; Rotateable=0; RotatedEntrance=0; Float=0; @@ -243,7 +242,6 @@ void C4Def::CompileFunc(StdCompiler *pComp) pComp->Value(mkNamingAdapt(Rebuyable, "Rebuy", 0 )); pComp->Value(mkNamingAdapt(Constructable, "Construction", 0 )); pComp->Value(mkNamingAdapt(BuildTurnTo, "ConstructTo", C4ID::None )); - pComp->Value(mkNamingAdapt(Grab, "Grab", 0 )); const StdBitfieldEntry GrabPutGetTypes[] = { diff --git a/src/game/object/C4Def.h b/src/game/object/C4Def.h index 77948cbaa..f2f1a747f 100644 --- a/src/game/object/C4Def.h +++ b/src/game/object/C4Def.h @@ -128,7 +128,6 @@ public: int32_t ContactIncinerate; // 0 off 1 high - 5 low int32_t BlastIncinerate; // 0 off 1 - x if > damage int32_t Constructable; - int32_t Grab; // 0 not 1 push 2 grab only int32_t Rotateable; int32_t Float; int32_t ColorByOwner; diff --git a/src/game/object/C4Object.cpp b/src/game/object/C4Object.cpp index 64ca98579..eba5779ec 100644 --- a/src/game/object/C4Object.cpp +++ b/src/game/object/C4Object.cpp @@ -765,7 +765,7 @@ void C4Object::SetOCF() && (r==0) && !OnFire) OCF|=OCF_Construct; // OCF_Grab: Can be pushed - if (Def->Grab && !(Category & C4D_StaticBack)) + if (GetPropertyInt(P_Touchable)) OCF|=OCF_Grab; // OCF_Carryable: Can be picked up if (GetPropertyInt(P_Collectible)) @@ -1560,7 +1560,7 @@ bool C4Object::Push(C4Real txdir, C4Real dforce, bool fStraighten) // Valid check if (!Status || !Def || Contained || !(OCF & OCF_Grab)) return false; // Grabbing okay, no pushing - if (Def->Grab==2) return true; + if (GetPropertyInt(P_Touchable)==2) return true; // Mobilization check (pre-mobilization zero) if (!Mobile) { xdir=ydir=Fix0; } diff --git a/src/script/C4StringTable.cpp b/src/script/C4StringTable.cpp index ce1cae3ac..caeff1f9c 100644 --- a/src/script/C4StringTable.cpp +++ b/src/script/C4StringTable.cpp @@ -91,6 +91,7 @@ C4StringTable::C4StringTable() P[P_CommandTarget] = "CommandTarget"; P[P_Time] = "Time"; P[P_Collectible] = "Collectible"; + P[P_Touchable] = "Touchable"; P[P_ActMap] = "ActMap"; P[P_Procedure] = "Procedure"; P[P_Speed] = "Speed"; diff --git a/src/script/C4StringTable.h b/src/script/C4StringTable.h index 326b4ea4c..5dcd98ae8 100644 --- a/src/script/C4StringTable.h +++ b/src/script/C4StringTable.h @@ -179,6 +179,7 @@ enum C4PropertyName P_CommandTarget, P_Time, P_Collectible, + P_Touchable, P_ActMap, P_Attach, P_Visibility, diff --git a/tools/convert_cr_to_oc.py b/tools/convert_cr_to_oc.py index 5d41d958d..90dbcfe21 100644 --- a/tools/convert_cr_to_oc.py +++ b/tools/convert_cr_to_oc.py @@ -87,8 +87,8 @@ for root, dirs, files in os.walk('.'): properties["Name"] = convertname(root, files, m.group(2)) elif m and m.group(1) == "Collectible": properties["Collectible"] = m.group(2) - #elif m and m.group(1) == "Grab": - #properties["Touchable"] = m.group(2) + elif m and m.group(1) == "Grab": + properties["Touchable"] = m.group(2) else: f.write(line) f.write("\n")