Do actual domain resolution
[carveJwlIkooP6JGAAIwe30JlM.git] / player_effects.c
1 #include "player.h"
2 #include "player_effects.h"
3 #include "player_render.h"
4 #include "particle.h"
5
6 void effect_blink_apply( effect_blink *ef, player_pose *pose, f32 dt )
7 {
8 if( ef->t < 0.0f ){
9 ef->t = (1.0f-powf(vg_randf64(&vg.rand),4.0f))*4.0f;
10 ef->l = 0.08f;
11 }
12
13 pose->keyframes[ localplayer.id_eyes-1 ].s[1] = ef->l > 0.0f? 0.2f: 1.0f;
14
15 ef->t -= dt;
16 ef->l -= dt;
17 }
18
19 void effect_spark_apply( effect_spark *ef, v3f co, v3f v, f32 dt )
20 {
21 if( !ef->colour ) return;
22
23 if( ef->t < 0.0f ){
24 ef->t += 0.05f+vg_randf64(&vg.rand)*0.1f;
25
26 v3f dir;
27 v3_copy( v, dir );
28 dir[1] += 1.0f;
29 f32 l = v3_length(dir);
30 v3_muls( dir, 1.0f/l, dir );
31
32 particle_spawn_cone( &particles_grind, co, dir, VG_PIf/2.0f, l,
33 4.0f, ef->colour );
34 }
35 else
36 ef->t -= dt;
37 }