summaryrefslogtreecommitdiffstats
path: root/SelectMark.c4d
diff options
context:
space:
mode:
Diffstat (limited to 'SelectMark.c4d')
-rw-r--r--SelectMark.c4d/ActMap.txt15
-rw-r--r--SelectMark.c4d/DefCore.txt7
-rw-r--r--SelectMark.c4d/Graphics.pngbin0 -> 209 bytes
-rw-r--r--SelectMark.c4d/Graphics2.pngbin0 -> 195 bytes
-rw-r--r--SelectMark.c4d/Script.c87
5 files changed, 109 insertions, 0 deletions
diff --git a/SelectMark.c4d/ActMap.txt b/SelectMark.c4d/ActMap.txt
new file mode 100644
index 0000000..d341582
--- /dev/null
+++ b/SelectMark.c4d/ActMap.txt
@@ -0,0 +1,15 @@
+[Action]
+Name=UpperLeft
+Facet=0,0,5,5
+
+[Action]
+Name=UpperRight
+Facet=5,0,5,5
+
+[Action]
+Name=LowerLeft
+Facet=10,0,5,5
+
+[Action]
+Name=LowerRight
+Facet=15,0,5,5
diff --git a/SelectMark.c4d/DefCore.txt b/SelectMark.c4d/DefCore.txt
new file mode 100644
index 0000000..0969bf5
--- /dev/null
+++ b/SelectMark.c4d/DefCore.txt
@@ -0,0 +1,7 @@
+[DefCore]
+id=SELM
+Name=SelectionMark
+Category=C4D_StaticBack|C4D_Foreground|C4D_IgnoreFoW|C4D_MouseIgnore
+Width=5
+Height=5
+Offset=-2,-2
diff --git a/SelectMark.c4d/Graphics.png b/SelectMark.c4d/Graphics.png
new file mode 100644
index 0000000..def080f
--- /dev/null
+++ b/SelectMark.c4d/Graphics.png
Binary files differ
diff --git a/SelectMark.c4d/Graphics2.png b/SelectMark.c4d/Graphics2.png
new file mode 100644
index 0000000..a263c6b
--- /dev/null
+++ b/SelectMark.c4d/Graphics2.png
Binary files differ
diff --git a/SelectMark.c4d/Script.c b/SelectMark.c4d/Script.c
new file mode 100644
index 0000000..1a0121c
--- /dev/null
+++ b/SelectMark.c4d/Script.c
@@ -0,0 +1,87 @@
+#strict 2
+
+local attachEffect;
+
+global func CreateSelectMark() { return CreateObject(SELM, 0, 0, GetOwner()); }
+
+func Padding(int forVal) { return (forVal < 3) * 2; }
+
+func Initialize()
+{
+ SetVisibility(VIS_Owner);
+ SetAction("UpperLeft");
+ Primary();
+}
+
+func MarkObject(object obj, int time)
+{
+ var id = GetID(obj);
+ var w = GetObjWidth(obj);
+ var h = GetObjHeight(obj);
+ var x = GetX(obj) + GetDefOffset(id) + (GetDefWidth(id) - w) / 2;
+ var y = GetY(obj) + GetDefOffset(id, 1) + (GetDefHeight(id) - h) / 2;
+ var xOff = 0;
+ var xPad = Padding(w);
+ var yPad = Padding(h);
+ if(x - xPad < 0)
+ {
+ x -= (xOff = -(w + 2 * xPad));
+ }
+ SetPosition(x - xPad, y - yPad);
+ SetObjDrawTransform(1000, 0, xOff * 1000, 0, 1000, 0, this, 0);
+ SetObjDrawTransform(1000, 0, (xOff + w + 2 * xPad) * 1000, 0, 1000, 0, this, 1);
+ SetObjDrawTransform(1000, 0, xOff * 1000, 0, 1000, (h + 2 * yPad) * 1000, this, 2);
+ SetObjDrawTransform(1000, 0, (xOff + w + 2 * xPad) * 1000, 0, 1000, (h + 2 * yPad) * 1000, this, 3);
+
+ if(time != -1)
+ {
+ if(attachEffect && attachEffect[0] != obj)
+ {
+ RemoveEffect(0, attachEffect[0], attachEffect[1]);
+ }
+ if(!attachEffect)
+ {
+ AddEffect("SelectionMarkAttach", obj, 1, 1, this, 0, time);
+ }
+ }
+ return this;
+}
+
+func FxSelectionMarkAttachStart(object target, int effectNumber, int temp, int time)
+{
+ attachEffect = [target, effectNumber];
+ EffectVar(0, target, effectNumber) = time;
+}
+
+func FxSelectionMarkAttachTimer(object target, int effectNumber, int effectTime)
+{
+ var time = EffectVar(0, target, effectNumber);
+ if(time && effectTime > time)
+ {
+ return RemoveObject();
+ }
+ MarkObject(target, -1);
+}
+
+func FxSelectionMarkAttachStop(object target, int effectNumber)
+{
+ attachEffect = 0;
+}
+
+func Primary()
+{
+ SetGraphics();
+ SetGraphics(0, this, GetID(), 1, GFXOV_MODE_Action, "UpperRight");
+ SetGraphics(0, this, GetID(), 2, GFXOV_MODE_Action, "LowerLeft");
+ SetGraphics(0, this, GetID(), 3, GFXOV_MODE_Action, "LowerRight");
+ return this;
+}
+
+func Secondary()
+{
+ SetGraphics("2");
+ SetGraphics("2", this, GetID(), 1, GFXOV_MODE_Action, "UpperRight");
+ SetGraphics("2", this, GetID(), 2, GFXOV_MODE_Action, "LowerLeft");
+ SetGraphics("2", this, GetID(), 3, GFXOV_MODE_Action, "LowerRight");
+ return this;
+}