That works, but I don't really understand why they would be setup that way... surely
Screen->Flags[SF_ITEMS] && SFI_HOLDUP
Is a much more readable / sensible logical check than
Screen->Flags[SF_ITEMS] && (1<<SFI_HOLDUP)
It seems like there was some confusion with this anyway since
//! These DMap Flag values do not return the expected results when compared via TraeS()ing what is anticipated!
is also right above all of these in std_constants.zh.
EDIT: Got curious, so I looked at the std.zh functions for these:
//Returns 1 if Screen Enemy Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
//Flags are numbered starting from 0
int ScreenEFlag(int category, int flag)
{
int catsizes[] = {5,5,4}; //this is what the editor shows.
//int catsizes[] = {1,5,4}; //this is what ffscript seems to think, anyway.
//int catsizes[] = {6,6,5}; //old value, plain wrong. -Z ( 12th February, 2019 )
if(flag < 0 || flag >= catsizes[category]) return -1;
return Screen->EFlags[category]&(1<<flag);
}
//Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
//Flags are numbered starting from 0
int ScreenFlag(int category, int flag)
{
int catsizes[] = {3,7,4,5,2,4,4,2,3,7}; //according to ffscript.cpp, the last flagset size is 3, but the editor is 7.
//int catsizes[] = {3,7,5,3,2,4,4,2,3,7}; //old value, plain wrong -Z ( 12th February, 2019 )
if(flag < 0 || flag >= catsizes[category]) return -1;
return Screen->Flags[category]&(1<<flag);
}
//Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
//Flags are numbered starting from 0
int ScreenFlag(int m, int scr, int category, int flag)
{
mapdata md = Game->LoadMapData(m,scr);
int catsizes[] = {3,7,4,5,2,4,4,2,3,7}; //according to ffscript.cpp, the last flagset size is 3, but the editor is 7.
//int catsizes[] = {3,7,5,3,2,4,4,2,3,7}; //old value, plain wrong -Z ( 12th February, 2019 )
if(flag < 0 || flag >= catsizes[category]) return -1;
return md->Flags[category]&(1<<flag);
}
//Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
//Flags are numbered starting from 0
int ScreenFlag(mapdata m, int category, int flag)
{
int catsizes[] = {3,7,4,5,2,4,4,2,3,7}; //according to ffscript.cpp, the last flagset size is 3, but the editor is 7.
//int catsizes[] = {3,7,5,3,2,4,4,2,3,7}; //old value, plain wrong -Z ( 12th February, 2019 )
if(flag < 0 || flag >= catsizes[category]) return -1;
return m->Flags[category]&(1<<flag);
}
These all left-shift to return the correct value, so I guess this is intended. Definitely should have clarification in the documentation since it's absolutely not what someone would expect by default.
Edited by Mitchfork, 10 March 2021 - 01:34 PM.