#include "game_types.h"

/* Sub_0800F86C @ 0x0800F86C (real 122B) -- gap-call chains around tile-row render. Mirrors src/matched/Sub_0800F86C.c. */
/* Runs 7 gap calls, renders the tile row, stubs and mode-renders the
   0xA34 block, strobes 480 on the flag byte, then runs 8 more gap calls
   (first takes 1). Call lanes past r0 are residue. */
extern void Sub_0800F86C_GapA0(int *p);
extern void Sub_0800F86C_GapA1(int *p);
extern void Sub_0800F86C_GapA2(int *p);
extern void Sub_0800F86C_GapA3(int *p);
extern void Sub_0800F86C_GapA4(int *p);
extern void Sub_0800F86C_GapA5(int *p);
extern void Sub_0800F86C_GapA6(int *p);
extern void Text_RenderTileRow(int *p);
extern void BiosStub_080008CC(int *p, int mode);
extern void Object_RenderWithModes(int *p);
extern void Sub_0800F86C_GapB0(int x);
extern void Sub_0800F86C_GapB1(int x);
extern void Sub_0800F86C_GapB2(int x);
extern void Sub_0800F86C_GapB3(int x);
extern void Sub_0800F86C_GapB4(int x);
extern void Sub_0800F86C_GapB5(int x);
extern void Sub_0800F86C_GapB6(int x);
extern void Sub_0800F86C_GapB7(int x);

void Sub_0800F86C(int *p)
{
    Sub_0800F86C_GapA0(p);
    Sub_0800F86C_GapA1(p);
    Sub_0800F86C_GapA2(p);
    Sub_0800F86C_GapA3(p);
    Sub_0800F86C_GapA4(p);
    Sub_0800F86C_GapA5(p);
    Sub_0800F86C_GapA6(p);
    Text_RenderTileRow((int *)((char *)p + 2464));
    BiosStub_080008CC((int *)((char *)p + 0xA34), 1);
    Object_RenderWithModes((int *)((char *)p + 0xA34));
    if (*(unsigned char *)((char *)p + 7200) != 0)
        *(unsigned short *)0x5000000 = 480;
    Sub_0800F86C_GapB0(1);
    Sub_0800F86C_GapB1(1);
    Sub_0800F86C_GapB2(1);
    Sub_0800F86C_GapB3(1);
    Sub_0800F86C_GapB4(1);
    Sub_0800F86C_GapB5(1);
    Sub_0800F86C_GapB6(1);
    Sub_0800F86C_GapB7(1);
}
