in the decompilation project, there is tons of code like this:

if (GET_INFTABLE(INFTABLE_TOLD_EPONA_IS_SCARED)) {

}

which led to these macros:

#define INFTABLE_INDEX(flag) ((flag) >> 4)

#define INFTABLE_MASK(flag) (1 << ((flag) & 0xF))

#define GET_INFTABLE(flag) (gSaveContext.save.info.infTable[INFTABLE_INDEX(flag)] & INFTABLE_MASK(flag))

#define SET_INFTABLE(flag) (gSaveContext.save.info.infTable[INFTABLE_INDEX(flag)] |= INFTABLE_MASK(flag))

#define CLEAR_INFTABLE(flag) (gSaveContext.save.info.infTable[INFTABLE_INDEX(flag)] &= ~INFTABLE_MASK(flag))

// INFTABLE 0x0-0xF

#define INFTABLE_INDEX_0 0

#define INFTABLE_00 0x00

#define INFTABLE_01 0x01

#define INFTABLE_03 0x03

#define INFTABLE_05 0x05

...

I was curious what the INDEX and MASK thing were doing and then I realized it was a bitset/bitvector/bitmap

Reply to this note

Please Login to reply.

Discussion

No replies yet.