summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-10-28 11:12:22 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-10-28 11:12:22 +0200
commit4e378fe6a3aacb398d88865b833b12e3dbd194a3 (patch)
treeba245c0f0f52a81a77a76c927f4d5118e7b3c1ea /include
parent18c1dfbb78d98516f5480f8199910fe41ac904df (diff)
player reloading delay
Diffstat (limited to 'include')
-rw-r--r--include/asset_defs.h1
-rw-r--r--include/audio.h1
-rw-r--r--include/guns.h7
-rw-r--r--include/players.h7
4 files changed, 13 insertions, 3 deletions
diff --git a/include/asset_defs.h b/include/asset_defs.h
index 45df7b5..623c54d 100644
--- a/include/asset_defs.h
+++ b/include/asset_defs.h
@@ -36,6 +36,7 @@ image* img_tile_grass1;
// Sounds
Mix_Chunk* wav_throwable_bounce;
+Mix_Chunk* wav_shoot_mp5;
void load_assets();
diff --git a/include/audio.h b/include/audio.h
index 98cb356..850e74e 100644
--- a/include/audio.h
+++ b/include/audio.h
@@ -4,6 +4,7 @@
#include <projectbase/project_base.h>
#define CHANNEL_THROWABLES 0
+#define CHANNEL_SHOOTING 0
void play_sound(int channel, Mix_Chunk* wav);
void play_positioned_sound(int channel, Mix_Chunk* wav, vec3f pos, float max_audible_dist);
diff --git a/include/guns.h b/include/guns.h
index 2c22c00..2ea0d1e 100644
--- a/include/guns.h
+++ b/include/guns.h
@@ -18,12 +18,13 @@ typedef struct t_gun {
int bullets_per_shot;
float shots_per_second;
int damage;
+ float reload_time;
} gun;
gun guns[GUN_ALL] = {
- {GUN_DESERTEAGLE, "Desert Eagle", 8, 64, 0.0f, 1, 4.0f, 350},
- {GUN_MP5, "MP5", 30, 120, 0.1f, 1, 10.0f, 150},
- {GUN_NOVA, "Nova", 12, 80, 0.2f, 3, 1.2f, 600},
+ {GUN_DESERTEAGLE, "Desert Eagle", 8, 64, 0.0f, 1, 4.0f, 350, 1.0f},
+ {GUN_MP5, "MP5", 30, 120, 0.1f, 1, 10.0f, 150, 1.0f},
+ {GUN_NOVA, "Nova", 12, 80, 0.2f, 3, 1.2f, 600, 1.0f},
};
image* get_image_of_gun(gun_type type);
diff --git a/include/players.h b/include/players.h
index c4652f2..90fdc84 100644
--- a/include/players.h
+++ b/include/players.h
@@ -12,10 +12,17 @@
#define MAX_PLAYERS 10
+typedef enum t_player_interact_state {
+ INTERACT_IDLE,
+ INTERACT_RELOADING,
+} player_interact_state;
+
typedef struct t_player {
u32 id;
bool active;
float sec_since_last_shot;
+ player_interact_state interact_state;
+ float sec_since_interact_state_change;
float playerx;
float playery;
float gunx;