aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities/ron.c
blob: 5c0eedb9beebf6b363f9b02c425b9cfafa093443 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "ron.h"
#include "ui.h"

void initRon(Entity* entity)
{
  entity->box = (BoundingBox){
    .min = (Vector3){-SHOPKEEPER_WIDTH, -SHOPKEEPER_HEIGHT,
                     -SHOPKEEPER_THICKNESS},
    .max = (Vector3){SHOPKEEPER_WIDTH, SHOPKEEPER_HEIGHT,
                     SHOPKEEPER_THICKNESS}
  };
}

void updateRon(Entity* entity, Game* game)
{
  DrawModel(game->assets.models[RON_MODEL], entity->position, 1.0, WHITE);
}

InteractionCommand handleRonMenu(Entity* entity, Game* game, int index)
{
  setInteractionChat(&game->interactionChat,
                     TextFormat("You selected test %d", index + 1));
  return INTERACTION_TALK;
}

InteractionCommand interactWithRon(Entity* entity, Game* game,
                                   Selection selection)
{
  InteractionMenu* menu = &game->interactionMenu;

  const InteractionItems items = {
    "test 1",
    "test 2",
    "test 3",
    "test 4",
    "test 5",
    "test 6",
    "test 7",
    "test 8",
    "test 9"
  };
  
  switch (selection)
  {
  case SELECTION_INTERACT:
    setInteractionMenu(menu, items, 9);
    return INTERACTION_SHOW_MENU;
  case SELECTION_LEAVE:
    return INTERACTION_END;
  case SELECTION_NEXT_MESSAGE:
    return INTERACTION_END;
  default:
    if (selection >= SELECTION_MENU_ITEM && selection < SELECTION_LEAVE)
    {
      return handleRonMenu(entity, game, getInteractionMenuIndex(selection));
    }

    return INTERACTION_DO_NOTHING;
  }
}