#include "game_types.h"

/* Image_DrawScaled @ 0x080128EC (real 134B) -- LCG dither fill with bound 0x26F. Mirrors src/matched/Image_DrawScaled.c. */
/* Fills dst[0..623] from the LCG (mult 0x10DCD, +1): each word packs two
   successive high halfwords; dst[624] = 624. Mid-pools sit after the branch
   (while-loop back-edge target). */
void Image_DrawScaled(int *dst, unsigned acc)
{
    int i;
    for (i = 0; i <= 0x26F; i++) {
        unsigned h = (acc >> 16) & 0xFFFF;
        dst[i] = (int)(h << 16);
        acc = acc * 0x10DCDu + 1;
        dst[i] |= (int)((acc >> 16) & 0xFFFF);
        acc = acc * 0x10DCDu + 1;
    }
    dst[624] = 624;
}
