Replace BorderBound DefCore value with BorderBound object property

shapetextures
Günther Brammer 2016-01-01 18:53:34 +01:00 committed by Maikel de Vries
parent 690b4f9ba0
commit 00a4c6c428
60 changed files with 69 additions and 69 deletions

View File

@ -170,11 +170,6 @@
<col>Integer</col>
<col>0 or 1. If 1, the object can only move vertically.</col>
</row>
<row>
<literal_col>BorderBound</literal_col>
<col>Integer</col>
<col>Bit mask: bit 0 (value 1) stop at the sides, bit 1 (value 2) stop at the top, bit 2 (value 4) stop at the bottom.</col>
</row>
<row>
<literal_col>UprightAttach</literal_col>
<col>Integer</col>

View File

@ -174,6 +174,11 @@ Stand = {
<literal_col>EditCursorCommands</literal_col>
<col>Array</col>
<col>Array of functions made available in the context menu when right-clicking an object in the editor. Functions may be either strings (like "Explode(20)") or function pointers (like this.Hit). Function pointers are always called by name. Windows only.</col>
</row>
<row>
<literal_col>BorderBound</literal_col>
<col>Integer</col>
<col>Bit mask indicating object boundaries: stop at map sides (C4D_Border_Sides), stop at map top (C4D_Border_Top), stop at map bottom (C4D_Border_Sides), stop at object layer boundaries (C4D_Border_Layer). For example BorderBound = C4D_Border_Top | C4D_Border_Bottom.</col>
</row>
</table>
</text>

View File

@ -24,7 +24,7 @@
<param>
<type>bool</type>
<name>check_bounds</name>
<desc>Only applies to objects using the BorderBound flag. Ensures that the position is always within the limits specified by the object.</desc>
<desc>Only applies to objects using the <emlink href="definition/properties.html">BorderBound property</emlink>. Ensures that the position is always within the limits specified by the object.</desc>
<optional />
</param>
<param>

View File

@ -17,5 +17,4 @@ Components=Metal=2;Wood=1;
Collection=-12,-8,24,10
GrabPutGet=C4D_GrabGet|C4D_GrabPut
Rotate=30
UprightAttach=0
BorderBound=1
UprightAttach=0

View File

@ -140,4 +140,5 @@ func Definition(def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local Touchable = 1;
local BorderBound = C4D_Border_Sides;

View File

@ -14,5 +14,4 @@ Mass=3
ContactCalls=1
StretchGrowth=1
Oversize=1
IncompleteActivity=1
BorderBound=7
IncompleteActivity=1

View File

@ -460,7 +460,7 @@ private func Death()
// Remove behavior effect and play dead animation.
RemoveEffect("CoreBehaviour", this);
SetAction("Dead");
// Set border bound to zero when dead.
this.BorderBound = 0;
// Decay the dead bat.
@ -512,6 +512,7 @@ local MaxEnergy = 20000;
local MaxBreath = 180;
local NoBurnDecay = 1;
local ContactIncinerate = 10;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ActMap = {
Hang = {

View File

@ -13,6 +13,5 @@ VertexY=-2,1,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100
Float=1
BorderBound=7
StretchGrowth=1
IncompleteActivity=1

View File

@ -218,6 +218,7 @@ local MaxEnergy = 40000;
local MaxBreath = 125;
local Placement = 2;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(20,1,0,0),Trans_Rotate(70,0,1,0)), def);

View File

@ -14,7 +14,6 @@ Mass=30
ContactCalls=1
NoGet=1
Float=0
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -273,6 +273,7 @@ local MaxBreath = 10000;
local NoBurnDecay = 1;
local ContactIncinerate = 15;
local CorrosionResist = 1;
local BorderBound = C4D_Border_Sides;
local ActMap = {
Walk = {

View File

@ -13,7 +13,6 @@ VertexX=0,0,-3,3
VertexY=-3,3,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100,100,100
BorderBound=7
StretchGrowth=1
Oversize=1
IncompleteActivity=1

View File

@ -511,6 +511,7 @@ local MaxBreath = 180; // 180 = five seconds
local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
func IsPrey() { return true; }

View File

@ -12,5 +12,4 @@ VertexX=0,0,-1,1
VertexY=-1,1,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100
Float=1
BorderBound=7
Float=1

View File

@ -249,4 +249,5 @@ local Name = "$Name$";
local MaxEnergy = 20000;
local MaxBreath = 250;
local Placement = 2;
local NoBurnDecay = 1;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;

View File

@ -13,7 +13,6 @@ VertexX=0,0,-4,4
VertexY=-3,3,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100,100,100
BorderBound=7
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -117,6 +117,7 @@ local MaxEnergy = 50000;
local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
func IsPrey() { return false; }
func IsPredator() { return true; }

View File

@ -13,7 +13,6 @@ VertexX=0,0,-2,2
VertexY=-1,1,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100,100,100
BorderBound=7
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -14,7 +14,6 @@ Mass=30
ContactCalls=1
NoGet=1
Float=0
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -753,6 +753,7 @@ public func RejectLightningStrike() { return true; }
local MaxEnergy = 30000;
local MaxBreath = 10000;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides;
local ActMap = {
Walk = {

View File

@ -13,7 +13,6 @@ VertexX=0,0,-7,7
VertexY=-8,8,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100,100,100
BorderBound=7
StretchGrowth=1
Oversize=1
IncompleteActivity=1

View File

@ -554,6 +554,7 @@ local MaxBreath = 360; // 360 =ten seconds
local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
public func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(20,1,0,0),Trans_Rotate(70,0,1,0)), def);

View File

@ -13,7 +13,6 @@ VertexFriction=300,300,300,100,300,300,300
Mass=20
NoGet=1
Float=0
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -602,6 +602,7 @@ local MaxBreath = 720;
local NoBurnDecay = true;
local Collectible = true;
local ContactIncinerate = 10;
local BorderBound = C4D_Border_Sides;
protected func Definition(proplist def)
{

View File

@ -12,5 +12,4 @@ VertexX=0,0,-1,1
VertexY=-1,1,0,0
VertexCNAT=4,8,1,2
VertexFriction=100,100,100,100
Float=1
BorderBound=7
Float=1

View File

@ -246,4 +246,5 @@ local Name = "$Name$";
local MaxEnergy = 30000;
local MaxBreath = 250;
local Placement = 2;
local NoBurnDecay = 1;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;

View File

@ -17,7 +17,6 @@ CrewMember=1
NoGet=1
Float=-2
ColorByOwner=1
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -1171,6 +1171,7 @@ local JumpSpeed = 400;
local ThrowSpeed = 294;
local NoBurnDecay = 1;
local ContactIncinerate = 10;
local BorderBound = C4D_Border_Sides;
// Clonks are always shown in the interaction menu.
public func HasInteractionMenu() { return true; }

View File

@ -12,4 +12,3 @@ VertexFriction=50,50,50,50,50,50,50,50
VertexCNAT=16,4,1,2,8,9,10,24
ContactCalls=1
Mass=3
BorderBound=1

View File

@ -210,3 +210,4 @@ local ActMap = {
},
};
local Name = "$Name$";
local BorderBound = C4D_Border_Sides;

View File

@ -7,6 +7,4 @@ Offset=-2,-2
Vertices=1
VertexX=0
VertexY=0
VertexFriction=100
BorderBound=7
VertexFriction=100

View File

@ -116,6 +116,7 @@ public func DrawTransform() {
public func SaveScenarioObject() { return false; }
local Plane = 300;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ActMap = {

View File

@ -10,5 +10,4 @@ VertexX=1
VertexY=1
VertexFriction=0
VertexCNAT=6
SolidMask=0,0,6,4,0,0
BorderBound=7
SolidMask=0,0,6,4,0,0

View File

@ -4,6 +4,7 @@ protected func Initialize()
}
local Plane = 300;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ActMap = {
Floor = {
Prototype = Action,

View File

@ -18,5 +18,4 @@ SolidMask=0,0,24,3,0,23
Picture=24,0,128,128
HorizontalFix=1
NoPushEnter=1
ContactCalls=1
BorderBound=6
ContactCalls=1

View File

@ -746,3 +746,4 @@ local Description = "$Description$";
local Touchable = 2;
local HitPoints = 50;
local Plane = 250;
local BorderBound = C4D_Border_Top | C4D_Border_Bottom;

View File

@ -7,5 +7,4 @@ Offset=-5,-5
Vertices=3
VertexX=0,3,-3
VertexY=4,-4,-4
VertexFriction=10,10,10
BorderBound=1
VertexFriction=10,10,10

View File

@ -272,4 +272,5 @@ local ActMap = {
local Plane = 460;
local BlastIncinerate = 1;
local ContactIncinerate = 3;
local ContactIncinerate = 3;
local BorderBound = C4D_Border_Sides;

View File

@ -19,5 +19,4 @@ Entrance=-12,-12,24,24
Exclusive=1
RotatedEntrance=1
VehicleControl=1
NoStabilize=1
BorderBound=7
NoStabilize=1

View File

@ -538,3 +538,5 @@ func Definition(def)
local Name="$Name$";
local Description="$Description$";
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;

View File

@ -15,5 +15,4 @@ Mass=5000
Components=Metal=4;Wood=4;Cloth=2;
Float=-27;
SolidMask=0,0,36,4,11,49
Picture=128,0,128,128,0,0
BorderBound=7
Picture=128,0,128,128,0,0

View File

@ -350,3 +350,4 @@ local Description = "$Description$";
local Touchable = 2;
local Plane = 500;
local SolidMaskPlane = 275;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;

View File

@ -17,4 +17,3 @@ Components=Metal=4;Wood=2;
GrabPutGet=C4D_GrabGet|C4D_GrabPut
Rotate=30
UprightAttach=8
BorderBound=1

View File

@ -285,3 +285,4 @@ Roll = {
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;

View File

@ -17,5 +17,4 @@ Components=Metal=1;Wood=6;
Entrance=-12,-12,24,24
RotatedEntrance=1
GrabPutGet=C4D_GrabGet|C4D_GrabPut
UprightAttach=8
BorderBound=1
UprightAttach=8

View File

@ -271,6 +271,7 @@ func Definition(proplist def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;
local ActMap = {
Roll = {

View File

@ -17,5 +17,4 @@ Components=Metal=2;Wood=1;
Collection=-12,-8,24,10
GrabPutGet=C4D_GrabGet|C4D_GrabPut
Rotate=55
UprightAttach=8
BorderBound=1
UprightAttach=8

View File

@ -300,3 +300,5 @@ public func Definition(proplist def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;

View File

@ -36,7 +36,6 @@ global func GetDefGrabPutGet() { return GetDefCoreVal("GrabPutGet", "DefCore");
global func GetDefRotate() { return GetDefCoreVal("Rotate", "DefCore"); }
global func GetDefFloat() { return GetDefCoreVal("Float", "DefCore"); }
global func GetDefHorizontalFix() { return GetDefCoreVal("HorizontalFix", "DefCore"); }
global func GetDefBorderBound() { return GetDefCoreVal("BorderBound", "DefCore"); }
global func GetDefLiftTop() { return GetDefCoreVal("LiftTop", "DefCore"); }
global func GetDefUprightAttach() { return GetDefCoreVal("UprightAttach", "DefCore"); }
global func GetDefStretchGrowth() { return GetDefCoreVal("StretchGrowth", "DefCore"); }

View File

@ -17,7 +17,6 @@ CrewMember=1
NoGet=1
Float=-2
ColorByOwner=1
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -17,7 +17,6 @@ CrewMember=1
NoGet=1
Float=-2
ColorByOwner=1
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -17,7 +17,6 @@ CrewMember=1
NoGet=1
Float=-2
ColorByOwner=1
BorderBound=1
StretchGrowth=1
IncompleteActivity=1
Oversize=1

View File

@ -16,6 +16,5 @@ Mass=500
Components=Metal=4;Wood=1;
Rotate=15
UprightAttach=8
BorderBound=1
Entrance=-8,-10,16,20
RotatedEntrance=1

View File

@ -206,3 +206,4 @@ local MeshTransformation = [0, 580, 0, -15660, 580, 0, 0, 13920, 0, 0, 580, 0];
local PictureTransformation = [0, -940, -342, -18000, 1000, 0, 0, 27000, 0, -342, 940, 0];
local Name = "$Name$";
local Description = "$Description$";
local BorderBound = C4D_Border_Sides;

View File

@ -107,7 +107,6 @@ void C4Def::DefaultDefCore()
Float=0;
ColorByOwner=0;
NoHorizontalMove=0;
BorderBound=0;
LiftTop=0;
GrabPutGet=0;
UprightAttach=0;
@ -244,7 +243,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(Float, "Float", 0 ));
pComp->Value(mkNamingAdapt(ColorByOwner, "ColorByOwner", 0 ));
pComp->Value(mkNamingAdapt(NoHorizontalMove, "HorizontalFix", 0 ));
pComp->Value(mkNamingAdapt(BorderBound, "BorderBound", 0 ));
pComp->Value(mkNamingAdapt(LiftTop, "LiftTop", 0 ));
pComp->Value(mkNamingAdapt(UprightAttach, "UprightAttach", 0 ));
pComp->Value(mkNamingAdapt(GrowthType, "StretchGrowth", 0 ));

View File

@ -124,7 +124,6 @@ public:
int32_t Float;
int32_t ColorByOwner;
int32_t NoHorizontalMove;
int32_t BorderBound;
int32_t LiftTop;
int32_t GrabPutGet;
int32_t UprightAttach;

View File

@ -156,7 +156,7 @@ int32_t C4Object::ContactCheck(int32_t iAtX, int32_t iAtY, uint32_t *border_hack
void C4Object::SideBounds(C4Real &ctcox)
{
// layer bounds
if (Layer && Layer->Def->BorderBound & C4D_Border_Layer)
if (Layer && Layer->GetPropertyInt(P_BorderBound) & C4D_Border_Layer)
{
C4PropList* pActionDef = GetAction();
if (!pActionDef || pActionDef->GetPropertyP(P_Procedure) != DFA_ATTACH)
@ -168,19 +168,18 @@ void C4Object::SideBounds(C4Real &ctcox)
}
}
// landscape bounds
if (Def->BorderBound & C4D_Border_Sides)
{
C4Real lbound = itofix(0 - Shape.GetX()),
rbound = itofix(GBackWdt + Shape.GetX());
if (ctcox < lbound) StopAndContact(ctcox, lbound, xdir, CNAT_Left);
else if (ctcox > rbound) StopAndContact(ctcox, rbound, xdir, CNAT_Right);
}
C4Real lbound = itofix(0 - Shape.GetX()),
rbound = itofix(GBackWdt + Shape.GetX());
if (ctcox < lbound && GetPropertyInt(P_BorderBound) & C4D_Border_Sides)
StopAndContact(ctcox, lbound, xdir, CNAT_Left);
if (ctcox > rbound && GetPropertyInt(P_BorderBound) & C4D_Border_Sides)
StopAndContact(ctcox, rbound, xdir, CNAT_Right);
}
void C4Object::VerticalBounds(C4Real &ctcoy)
{
// layer bounds
if (Layer && Layer->Def->BorderBound & C4D_Border_Layer)
if (Layer && Layer->GetPropertyInt(P_BorderBound) & C4D_Border_Layer)
{
C4PropList* pActionDef = GetAction();
if (!pActionDef || pActionDef->GetPropertyP(P_Procedure) != DFA_ATTACH)
@ -194,10 +193,10 @@ void C4Object::VerticalBounds(C4Real &ctcoy)
// landscape bounds
C4Real tbound = itofix(0 - Shape.GetY()),
bbound = itofix(GBackHgt + Shape.GetY());
if (Def->BorderBound & C4D_Border_Top)
if (ctcoy < tbound) StopAndContact(ctcoy, tbound, ydir, CNAT_Top);
if (Def->BorderBound & C4D_Border_Bottom)
if (ctcoy > bbound) StopAndContact(ctcoy, bbound, ydir, CNAT_Bottom);
if (ctcoy < tbound && GetPropertyInt(P_BorderBound) & C4D_Border_Top)
StopAndContact(ctcoy, tbound, ydir, CNAT_Top);
if (ctcoy > bbound && GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)
StopAndContact(ctcoy, bbound, ydir, CNAT_Bottom);
}
void C4Object::DoMovement()
@ -579,7 +578,8 @@ bool C4Object::ExecMovement() // Every Tick1 by Execute
if (!Def->Rotateable) fix_r=Fix0;
// Out of bounds check
if ((!Inside<int32_t>(GetX(), -Shape.Wdt / 2, GBackWdt + Shape.Wdt / 2) && !(Def->BorderBound & C4D_Border_Sides)) || ((GetY() > GBackHgt + Shape.Hgt / 2) && !(Def->BorderBound & C4D_Border_Bottom)))
if ((!Inside<int32_t>(GetX(), -Shape.Wdt / 2, GBackWdt + Shape.Wdt / 2) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Sides))
|| ((GetY() > GBackHgt + Shape.Hgt / 2) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)))
{
C4PropList* pActionDef = GetAction();
// Never remove attached objects: If they are truly outside landscape, their target will be removed,

View File

@ -2412,6 +2412,11 @@ C4ScriptConstDef C4ScriptObjectConstMap[]=
{ "C4D_GrabGet" ,C4V_Int, C4D_Grab_Get},
{ "C4D_GrabPut" ,C4V_Int, C4D_Grab_Put},
{ "C4D_Border_Sides" ,C4V_Int, C4D_Border_Sides},
{ "C4D_Border_Top" ,C4V_Int, C4D_Border_Top},
{ "C4D_Border_Bottom" ,C4V_Int, C4D_Border_Bottom},
{ "C4D_Border_Layer" ,C4V_Int, C4D_Border_Layer},
{ "COMD_None" ,C4V_Int, COMD_None},
{ "COMD_Stop" ,C4V_Int, COMD_Stop},
{ "COMD_Up" ,C4V_Int, COMD_Up},

View File

@ -148,6 +148,7 @@ C4StringTable::C4StringTable()
P[P_Blasted] = "Blasted";
P[P_IncineratingObj] = "IncineratingObj";
P[P_Plane] = "Plane";
P[P_BorderBound] = "BorderBound";
P[P_SolidMaskPlane] = "SolidMaskPlane";
P[P_Tooltip] = "Tooltip";
P[P_Placement] = "Placement";

View File

@ -340,6 +340,7 @@ enum C4PropertyName
P_Blasted, // unused?
P_IncineratingObj, // unused?
P_Plane,
P_BorderBound,
P_SolidMaskPlane,
P_Tooltip,
P_Placement,