#include "game_types.h"

/* Render_Veneer2750 @ 0x08002750 (real 76B) -- gated bitmap + DMA render veneer. Mirrors src/matched/Render_Veneer2750.c. */
/* Zeroes the halfwords at +160/+162, stamps 0xFFFF at +164, and -- when
   the halfword at +134 exceeds 7 -- refreshes +164 from the gap call,
   drawing the bitmap on negative results before the DMA render. */
extern void Image_DrawBitmap(int a, int b, int c);
extern void Render_BitmapWithDMA(int *p);
extern int Veneer2750_GapCall(int x);

void Render_Veneer2750(int *p)
{
    int r;
    *(int *)((char *)p + 160) = 0;
    *(unsigned short *)((char *)p + 164) = 0xFFFF;
    if (*(short *)((char *)p + 134) <= 7)
        return;
    r = Veneer2750_GapCall(*(int *)0x0200005C);
    *(unsigned short *)((char *)p + 164) = (unsigned short)r;
    if ((short)r < 0)
        Image_DrawBitmap(0x08028180, 0x0802819C, 164);
    Render_BitmapWithDMA(p);
}
