#include "game_types.h"

/* Level_SetFlags @ 0x080085FC (real 66B) -- sign-chase chain clearing flag bits. Mirrors src/matched/Level_SetFlags.c. */
/* Chases the chain while (anchor ^ cursor) stays negative, clearing b's
   bits from each node's word 10. Sibling of Menu_HandleCredits (clear vs
   OR). */
void Level_SetFlags(int *a, int b)
{
    int *anchor = a + 25;
    int *cursor = (int *)a[23];
    int mask = ~b;
    while (((int)anchor ^ (int)cursor) < 0) {
        int *node = *(int **)((char *)cursor + 8);
        node[10] &= mask;
        cursor = (int *)((int *)cursor)[1];
    }
}
