Skip to content

Commit

Permalink
little changes
Browse files Browse the repository at this point in the history
  • Loading branch information
forked-from-1kasper committed Mar 6, 2024
1 parent c7685c5 commit 4db3faa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 3 additions & 5 deletions include/AceOfSpades/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ enum Extension {
};

enum HitEffectTarget {
HITEFFECT_GROUND = 0,
HITEFFECT_HEAD = 1,
HITEFFECT_TORSO = 2,
HITEFFECT_ARMS = 3,
HITEFFECT_LEGS = 4,
HITEFFECT_BLOCK = 0,
HITEFFECT_HEADSHOT = 1,
HITEFFECT_PLAYER = 2,
};

#define begin(T) typedef struct _##T T; struct _##T {
Expand Down
10 changes: 6 additions & 4 deletions src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,13 +1076,15 @@ void getPacketHitEffect(uint8_t * data, int len) {
Vector3f r = ntohv3f(p.pos);
Vector3i b = ntohv3i(p.block);

if (p.target != HITEFFECT_GROUND) {
WAV * wav = sound(p.target == HITEFFECT_HEAD ? SOUND_SPADE_WHACK : SOUND_HITPLAYER);
if (p.target != HITEFFECT_BLOCK) {
WAV * wav = sound(p.target == HITEFFECT_HEADSHOT ? SOUND_SPADE_WHACK : SOUND_HITPLAYER);
sound_create(SOUND_WORLD, wav, r.x, r.y, r.z);
} else if (b.y > 0) map_damage(b.x, b.y, b.z, 15);

TrueColor color = p.target == HITEFFECT_GROUND ? map_get(b.x, b.y, b.z) : Red;
particle_create(color, r.x, r.y, r.z, 2.5F, 1.0F, 8, 0.1F, 0.25F);
if (p.target == HITEFFECT_BLOCK)
particle_create(map_get(b.x, b.y, b.z), r.x, r.y, r.z, 2.5F, 1.0F, 4, 0.1F, 0.25F);
else
particle_create(Red, r.x, r.y, r.z, 3.5F, 1.0F, 8, 0.1F, 0.4F);
}

void network_updateColor() {
Expand Down
2 changes: 1 addition & 1 deletion src/weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void weapon_update() {
if (weapon_reload_inprogress) {
if (players[local_player.id].weapon == WEAPON_SHOTGUN) {
if (window_time() - weapon_reload_start >= 0.5F) {

WAV * wav = NULL;

if (local_player.ammo < 6 && local_player.ammo_reserved > 0) {
local_player.ammo++;
local_player.ammo_reserved--;
Expand Down

0 comments on commit 4db3faa

Please sign in to comment.