#include "game_types.h"

/* Player_InitState @ 0x080050C8 (real 114B) -- initializes the player state struct. Mirrors src/matched/Player_InitState.c. */
/* Clears the player state, links self pointers, stamps the pool constants,
   and selects the script slot by whether word 3 is set. Returns p. */
int *Player_InitState(int *p)
{
    int i;
    p[14] = 0x02000960;
    p[0] = 0;
    p[1] = 0;
    p[2] = (int)p;
    for (i = 0; i < 3; i++)
        p[5 - i] = 0;
    p[7] = 0;
    p[8] = 0;
    p[9] = 0;
    p[10] = 0;
    p[11] = 0;
    p[12] = 0;
    ((char *)p)[52] = 0;
    p[6] = (int)p;
    p[14] = 0x02000990;
    p[17] = 0;
    p[18] = 0;
    p[19] = 0;
    p[20] = 0;
    ((char *)p)[104] = 1;
    if (p[3] == 0) {
        p[3] = 0x0800561D;
        p[11] = 0;
    } else {
        p[5] = 0x02000990;
    }
    return p;
}
