Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / No Category (C4D_None)
- - By Maikel Date 2015-03-01 16:52
Currently objects can't not have a category and are then often made vehicle since they still need to be moved around: as famous example is the flag marker.

Objects then looking for vehicles, like teleglove, windbag, wormhole would do something to the marker which is bad. We could Introduce the category C4D_None for these objects and give them a float action which allows for moving them around while not falling out of the landscape when at their position.

Are there any problems to be foreseen by introducing this?
Parent - - By Zapper [de] Date 2015-03-01 20:22

>Currently objects can't not have a category


That's not true. SetCategory(0); is perfectly valid. And objects without a category can be moved around, can have a float actions etc. They only won't have a default Plane.
So I guess adding the additional definition of C4D_None set to 0 would suffice? (That would allow using that category in the DefCore, I guess)
Parent - - By Maikel Date 2015-03-01 20:56
That's true, and what I meant with not having a category, it is just not defined. What do we do about the plane issue? A C4D_None might as well default to Plane = 0.
Parent - By Zapper [de] Date 2015-03-01 22:08
Ah, ok.

Yeah, I guess the plane does not really matter for most of the objects (where the developer does not need to set a custom plane anyway) so the default can be quite arbitrary. 0 would mean that we would spot the cases where we do need a proper plane fast enough :)
- By Maikel Date 2015-03-02 20:49
This has now been added to the repos:

C4D_None objects don't receive any special treatment, to have them warning free you need to set a Plane (local Plane = x;), by default you get a warning and Plane = 1.

Also note that these objects are affected by gravity so they need a FLOAT procedure action, vertices or borderbound (I guess) to stay in the landscape. If you want an object which floats but never moves, use C4D_StaticBack (of course)!
- - By Maikel Date 2015-03-02 21:05
Possible open issue: this function and its friends below may not work if dwCategory = C4D_None = 0

Any opinions, fixes, drawbacks? This has not so much to do with introducing C4D_None but it has to do with setting the Category for an object to zero.
Parent - - By Sven2 Date 2015-03-03 10:27
Those will already return uncategorized objects on C4D_All, so I don't see a problem.

But there's a lot of places to check. I could imagine some parts of the code assuming (obj->Cateogry & C4D_All) to always yield nonzero e.g. when searching objects.
Parent - By Maikel Date 2015-03-03 11:27

>Those will already return uncategorized objects on C4D_All, so I don't see a problem.


Well if you search for C4D_None, you would at least expect to find all pure C4D_None objects, I am not sure if these functions are even used by C4Script, so it might not be a problem because they are never called with zero as an argument.

>But there's a lot of places to check. I could imagine some parts of the code assuming (obj->Cateogry & C4D_All) to always yield nonzero e.g. when searching objects.


Yes, there is those problems, unfortunately I don't have the tools to search for all of those occurrences.
Up Topic Development / Developer's Corner / No Category (C4D_None)

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill