Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
FLAGS.. lets solve this problem together... #144885
08/01/07 04:18
08/01/07 04:18
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Lets face it guys...

For anyone going from Cscript to LiteC, the flags are a really big pain in the ass. Could one of you more experienced programmers shed some light on a very dim path?

HOW EXACTLY DO WE SET AND RESET AND DO WHATEVER... with the new flags?

Quote:


LC In C, C++, or Lite-C, a flag is set at runtime by OR-ing the flags parameter with the flag (material.flags |= TANGENT;); it is reset by AND-ing the flags parameter with the inverse flag (material.flags &= ~TANGENT;); and it is read by AND-ing the flags parameter with the flag and comparing the result with zero.
LC Entities have more than 32 flags and thus need several flag parameters in lite-C. The other parameters are flags2, eflags, emask, and smask. The parameter a flag belongs to is given in its Type field.





OH... that makes things much clearer... NOT!


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: FLAGS.. lets solve this problem together... [Re: PrenceOfDarkness] #144886
08/01/07 04:47
08/01/07 04:47
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I've found that all you really need to do is use the .flags parameter and just use = FLAG or = ~FLAG. the "~" is a bitwise inverter. it essentially reverses the effect of the flag (example: element.flags= VISIBLE; element is VISIBLE. element.flags= ~VISIBLE; element is now INVISIBLE).


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: FLAGS.. lets solve this problem together... [Re: PrenceOfDarkness] #144887
08/01/07 04:48
08/01/07 04:48
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline
Senior Member
oldschoolj  Offline
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
all I can say is yep...
had a movement code that used alot of flags. had to completely redo that code, because I'm not smart enoug hto figure it out...


you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: FLAGS.. lets solve this problem together... [Re: MrCode] #144888
08/01/07 05:31
08/01/07 05:31
Joined: Dec 2005
Posts: 478
India
M
msl_manni Offline
Senior Member
msl_manni  Offline
Senior Member
M

Joined: Dec 2005
Posts: 478
India
Quote:

I've found that all you really need to do is use the .flags parameter and just use = FLAG or = ~FLAG. the "~" is a bitwise inverter. it essentially reverses the effect of the flag (example: element.flags= VISIBLE; element is VISIBLE. element.flags= ~VISIBLE; element is now INVISIBLE).




This is purely a wrong way to toggle a bit flag. All other bits of other flags would be reset if done this way. A Flag is a variable whose every bit is pointing to a flag. So you have to alter only the bit of the flag you are interested in. & and | operators are necessary for this kind of operation. These preserve the other bits of the flag while altering the requested bits of the flag.


My Specialities Limited.
Re: FLAGS.. lets solve this problem together... [Re: msl_manni] #144889
08/01/07 07:52
08/01/07 07:52
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
element.flags |= VISIBLE;
element.flags &= ~VISIBLE;

It's always like this. Nothing more and nothing less.

Re: FLAGS.. lets solve this problem together... [Re: msl_manni] #144890
08/01/07 07:58
08/01/07 07:58
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Summary:

there are 4 standard operations in acknex for particular flags which are covered by convenience macros. If you use them, you don't need to write the slightly unhandy flag-code everywhere (it is better to read and better to understand.

Code:
#define set(obj,flag) obj.flags |= (flag)
#define reset(obj,flag) obj.flags &= ~(flag)
#define toggle(obj,flag) obj.flags ^= (flag)
#define is(obj,flag) (obj.flags & (flag))



In addition, flags can be combined like you wish, e.g.

Code:
set(my, VISIBLE | TRANSLUCENT | FAT | LOCAL);

or

my.flags |= (VISIBLE | TRANSLUCENT | FAT | LOCAL);



all available flags are listed in "atypes.h". This way you can define your own flags as well! But don't try to exceed the memoryspace of the variable which receives the flag(s) (a variable can store as much flags as bits it has).

I hope this helps.

Re: FLAGS.. lets solve this problem together... [Re: HeelX] #144891
08/01/07 19:27
08/01/07 19:27
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi guys!

With the help of D3D I've posted a 3 page table of flags in

Lite-C Contribution

under flags at a glance.

Hope this helps...I'm using it and making improvements to it as I go.

If you have any suggestions ...please do so.

Ottawa

Re: FLAGS.. lets solve this problem together... [Re: Ottawa] #144892
08/02/07 16:25
08/02/07 16:25
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
i want to use set,reset,toggle, and is, but i'm afraid in a week they wont support it any more and i have to go and re-freaking script everything again

set(obj,flag) is so easy... u guys think it's okay?


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: FLAGS.. lets solve this problem together... [Re: PrenceOfDarkness] #144893
08/02/07 16:53
08/02/07 16:53
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline
Senior Member
oldschoolj  Offline
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
those are macros and I think they are here to stay bud


you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: FLAGS.. lets solve this problem together... [Re: oldschoolj] #144894
08/08/07 01:54
08/08/07 01:54
Joined: Sep 2005
Posts: 96
L
lyingmime Offline
Junior Member
lyingmime  Offline
Junior Member
L

Joined: Sep 2005
Posts: 96
The frustrating part about flags is always having to look up what is grouped under flags, flags2, eflags, emask, and smask. The macros only work on the first group!

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1