31 lines
922 B
C
31 lines
922 B
C
|
|
|
|
U32* GenOutfit(G_Outfit *o, World *world, G_State *game)
|
|
{
|
|
U32 *outfitChoices = M_ArenaPush(world->arena, U32, .count = 8);
|
|
G_Outfit *outfit = o;
|
|
|
|
D_AnimationInit(&outfit->state, 0, 1, 4, 1.0f / 6.0f);
|
|
|
|
M_TempScope(0, 0)
|
|
{
|
|
for (U32 it = 0; it < G_OUTFIT_COMPONENT_COUNT; ++it)
|
|
{
|
|
U32 idx = Random_Next(&world->random) % __outfit_counts[it];
|
|
|
|
// We just allow face, hair and hat to default to 0 meaning the player doesn't have one
|
|
if (idx != 0 || it < 2 || it > 4)
|
|
{
|
|
outfit->front.e[it] = OUTFIT_IMG(front, idx);
|
|
outfit->side.e[it] = OUTFIT_IMG(side, idx);
|
|
|
|
if ((idx + 1) <= __outfit_counts[it])
|
|
{
|
|
outfit->back.e[it] = OUTFIT_IMG(back, idx);
|
|
}
|
|
}
|
|
outfitChoices[it] = idx;
|
|
}
|
|
}
|
|
return outfitChoices;
|
|
} |