summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-10-29 09:06:10 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2023-10-29 09:06:10 +0100
commit2bcffc7def20dd1e660d742f54bd97307b9f193d (patch)
tree84443fceb1b067549874b4f14e0d4aa36b0630db /include
parentd2c3f612b3d7b0071e98e589777d495ba45eafe4 (diff)
grenade work
Diffstat (limited to 'include')
-rw-r--r--include/asset_defs.h3
-rw-r--r--include/audio.h5
-rw-r--r--include/throwables.h9
3 files changed, 16 insertions, 1 deletions
diff --git a/include/asset_defs.h b/include/asset_defs.h
index 7237a6d..65767c6 100644
--- a/include/asset_defs.h
+++ b/include/asset_defs.h
@@ -24,6 +24,7 @@ image* img_obj_wall1;
// Throwables
image* img_grenade;
+image* img_grenade_explode;
// Players
image* img_player;
@@ -39,6 +40,8 @@ image* img_tile_grass1;
// Sounds
Mix_Chunk* wav_throwable_bounce;
+Mix_Chunk* wav_grenade_explode;
+
Mix_Chunk* wav_shoot_mp5;
Mix_Chunk* wav_reload_mp5;
diff --git a/include/audio.h b/include/audio.h
index c7cb9c7..de76af8 100644
--- a/include/audio.h
+++ b/include/audio.h
@@ -2,6 +2,7 @@
#define INCLUDE_AUDIO_
#include <projectbase/project_base.h>
+#include "throwables.h"
#define NUMBER_OF_AUDIO_CHANNELS 64
@@ -9,11 +10,13 @@
#define CHANNEL_SHOOTING 1
#define CHANNEL_IMPACT 2
#define CHANNEL_RELOAD 3
+#define CHANNEL_EXPLODE 4
typedef enum t_audio_event_type {
EVENT_SHOOT,
EVENT_RELOAD,
EVENT_BOUNCE_THROWABLE,
+ EVENT_EXPLODE_THROWABLE,
EVENT_IMPACT,
} audio_event_type;
@@ -24,12 +27,14 @@ typedef struct t_audio_event {
vec3f position;
object_type obj;
zombie_type zombie;
+ throwable_type throwable;
} audio_event;
#define MAX_AUDIO_EVENTS 20
audio_event audio_events[MAX_AUDIO_EVENTS] = {0};
int max_audio_events = MAX_AUDIO_EVENTS;
+void add_throwable_audio_event_to_queue(audio_event_type event, throwable_type throwable, u32 playerid, vec3f position);
void add_zombie_audio_event_to_queue(audio_event_type event, zombie_type zombie, u32 playerid, vec3f position);
void add_object_audio_event_to_queue(audio_event_type event, object_type obj, u32 playerid, vec3f position);
void add_audio_event_to_queue(audio_event_type event, u32 playerid, vec3f position);
diff --git a/include/throwables.h b/include/throwables.h
index 16811b2..2106c94 100644
--- a/include/throwables.h
+++ b/include/throwables.h
@@ -14,20 +14,27 @@ typedef enum t_throwable_type
THROWABLE_GRENADE,
} throwable_type;
+typedef enum t_throwable_state
+{
+ THROWABLE_FLYING,
+ THROWABLE_EXPLODED,
+} throwable_state;
+
typedef struct t_throwable {
u32 player_id;
bool active;
+ throwable_state state;
throwable_type type;
vec3f position;
vec3f direction;
float alive_time;
int bounces;
+ sprite sprite;
} throwable;
throwable throwables[500] = {0};
int max_throwables = 500;
-void clear_throwables();
void throw_throwable(platform_window* window, u32 id, throwable_type type, float dirx, float diry);
void draw_throwables(platform_window* window);