npc and bandit dressup, bits of UI added, WIP NPC interaction

This commit is contained in:
2025-10-06 23:08:15 +01:00
parent f18d9d2b0e
commit 7f77d7ad52
13 changed files with 166 additions and 58 deletions

View File

@@ -46,3 +46,23 @@ void UpdateNPC(F32 delta, NPC *npc, World *world) {
break;
}
}
void NPCDraw(D_Context *draw, NPC *npc)
{
G_Outfit *outfit = &npc->outfit;
R2f pframe = D_AnimationFrame(&outfit->state);
for (U32 it = 0; it < G_OUTFIT_COMPONENT_COUNT; ++it)
{
U32 flipped = (outfit->dir & G_OUTFIT_DIR_FLIPPED) != 0;
U32 dir = (outfit->dir & ~G_OUTFIT_DIR_FLIPPED);
U32 tid = outfit->e[dir].e[it];
if (tid != 0)
{
U32 flags = D_RECT_UV_ASPECT | (flipped ? D_RECT_FLIP_X : 0);
D_Rect(draw, npc->collision.pos.x, npc->collision.pos.y, .texture = tid, .uv = pframe, .flags = flags);
}
}
}