#include "game_types.h"

/* Sub_0800A448 @ 0x0800A448 (real 110B) -- table-gated bitmap plus flag-bit set and init. Mirrors src/matched/Sub_0800A448.c. */
/* When word 4 is zero: resolves the table entry (stride 60 from p+412),
   draws the bitmap past tag 7, sets the (tag>>5, tag&31) bit in the
   base+0x9A4 bitset, inits the +9344 block, and pins words 2/3 to 2/-1. */
extern void Image_DrawBitmap(int a, int b, int c);
extern void Collectible_Init(int *p);

void Sub_0800A448(int *p)
{
    int *r5;
    int tag;
    int *slot;
    if (p[4] != 0)
        return;
    r5 = (int *)(0x08028518 + *(int *)((char *)p + 412) * 60);
    if (r5[14] > 7)
        Image_DrawBitmap(0x0802A094, 0x0802A0B4, 300);
    tag = r5[14];
    slot = (int *)((char *)*(int *)0x02000134 + 0x9A4 + (tag >> 5) * 4);
    *slot |= 1 << (tag & 31);
    Collectible_Init((int *)((char *)p + 9344));
    p[2] = 2;
    p[3] = -1;
}
