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

@@ -24,6 +24,7 @@
#include "game/impl/world.c"
#include "game/impl/npc.c"
#include "game/impl/bandit.c"
#include "game/impl/outfit.c"
int main(int argc, char **argv)
{
@@ -101,7 +102,7 @@ int main(int argc, char **argv)
game->world = world;
world->arena = arena;
world->random = Random_Seed(29237489723847);
world->npcCount = 127;
world->npcCount = 12;
for(U32 i = 0; i < world->npcCount; i++) {
NPC *npc1 = &world->npcs[i];
npc1->collision.pos.x = 0;
@@ -114,6 +115,7 @@ int main(int argc, char **argv)
npc1->waitTime = 0;
npc1->maxWaitTime = 1;
npc1->currentNavNode = 0;
GenOutfit(&npc1->outfit,world,game);
}
Bandit *badman = &world->bandit;
@@ -127,7 +129,7 @@ int main(int argc, char **argv)
badman->maxWaitTime = 2;
badman->poiCount = 2;
badman->shootoutTimer = 1.5;
badman->agroRadius = 600.0;
badman->agroRadius = 6.0;
badman->bullets = 6;
badman->shootDelay = 1;
badman->accuracyRange = 0.25;
@@ -135,6 +137,8 @@ int main(int argc, char **argv)
badman->reloadTimer = 0;
badman->pointsOfInterest[0] = 937;
badman->pointsOfInterest[1] = 12;
badman->outfitChoices = GenOutfit(&badman->outfit, world, game);
badman->currentArea = WORLD_AREA_OUTSIDE;
world->npcPOI[0] = 100;
@@ -247,6 +251,7 @@ int main(int argc, char **argv)
Player *player = &game->world->player;
switch (e.key.key) {
case SDLK_R: { PlayerInit(game, player); } break;
case SDLK_F: {game->world->showPoster=!game->world->showPoster;}break;
}
}
@@ -420,6 +425,12 @@ int main(int argc, char **argv)
D_Begin(&game->draw, frame, D_MAX_RECTS);
RenderWorld(game->world, &game->draw);
if(game->world->showPoster){
D_Rect(&game->draw, G_CameraBounds(&game->camera).min.x+4.8, G_CameraBounds(&game->camera).min.y+6.4, .texture=D_ImageHandle(&game->draw, S("poster")), .scale=12.0);
}
for(int i = 0; i < game->world->player.health; i++){
D_Rect(&game->draw, (G_CameraBounds(&game->camera).max.x-3)+i, G_CameraBounds(&game->camera).min.y+1.0, .texture=D_ImageHandle(&game->draw, S("heart")), .scale=1.0);
}
//D_Text(&game->draw, game->draw.fonts, S("Small Test"), 0, 0);