Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Game->LItem[];

4 replies · 1,100 views · Started 07 February 2008

int LItems[]
* The level items of level i currently under the posession of the player,
* where i is the index used to access this array. Each element of this
* array consists of flags ORed (|) together; use the LI_ constants in
* std.zh to set or compare these values.

How do I use this?

Edit:
Right, so it uses binary.
And to check whether Link has the compass, I do something like this:

	int cmp = 0100b;
int curitems = Game->LItems[lvnum];
int chk = cmp & curitems;
if(chk == 0100b){

Correct?

However, apparently the Boss Key item is '16' in std.zh.
How am I supposed to express 16 in a 4-bit byte?
This is illogical.

Use more bits? Or use the LI_ constants in std.zh.

You can also just do


if(Game->LItems[lvnum] & LI_WHATEVER != 0)
{
//stuff
}

Can I just add more bits on if I want to?
I thought the size of the byte was standard and you have to use one of that size?

And that makes sense now I think about it, thankyou.

In C a byte is 8 bits, but the ZScript int is much bigger. (64 bits I believe, but don't quote me on that. Plenty enough to hold 16 = 10000b, is the point.)

Oh, so I can just stick extra bits on then.
Thanks, I thought I couldn't do that.

Well, not that I'll probably use it much again, but still.