summaryrefslogtreecommitdiff
path: root/src/game/player.h
blob: 7dfd0090ee59706f391d9b8d6908b5afab2ed653 (plain)
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
#pragma once
#include "object.h"
#include "camera.h"

struct PLAYER_INPUT {
  PLAYER_CAMERA cam;
  struct PLAYER* pobj;

  // for nulls
  U8 fwd_held{}, bk_held{}, left_held{}, right_held{};

  VEC2 move;
};

struct PLAYER : OBJECT {
  static const U32 CLASSID = OBJCLASS_PLAYER;
  U32 health;
  F32 fov{72.f};
  F32 eyeoffset{40.f};

  PLAYER_INPUT input;
  VEC3 mins;
  VEC3 maxs;

  F32 gravity{1.f};
  F32 maxspeed{70.f};
  F32 walkspeed{70.f};
  F32 stepsize{16.f};

  VEC3 velocity;
};

extern PLAYER* player_create( VEC3 origin, F32 yaw );
extern void player_input( struct GAME_DATA* game, PLAYER* player );
extern void player_move( struct GAME_DATA* game, PLAYER* player );
extern VEC3 player_get_view_pos( PLAYER* player );