before the storm
[carveJwlIkooP6JGAAIwe30JlM.git] / player_model.h
index e1e43a5770c48b338f43f24881a954fe94037d03..1673581a98aedb719d7c9dcc455328281d9202bb 100644 (file)
@@ -1,4 +1,8 @@
-#ifndef CHARACTER_H
+/*
+ * Copyright 2021-2022 (C) Mount0 Software, Harry Godden - All Rights Reserved
+ */
+
+#ifndef CHARACTER_H 
 #define CHARACTER_H
 
 #include "common.h"
@@ -10,6 +14,9 @@
 #include "skeleton_animator.h"
 #include "shaders/viewchar.h"
 
+static float k_ragdoll_floatyiness = 10.0f,
+             k_ragdoll_floatydrag  = 1.0f;
+
 vg_tex2d tex_characters = { .path = "textures/ch_gradient.qoi" };
 
 static void character_register(void)
@@ -31,7 +38,9 @@ struct character
                         *anim_slide,
                         *anim_air,
                         *anim_push, *anim_push_reverse,
-                        *anim_ollie;
+                        *anim_ollie, *anim_ollie_reverse,
+                        *anim_grabs, *anim_stop,
+                        *anim_walk, *anim_run, *anim_idle;
 
    u32 id_hip,
        id_ik_hand_l,
@@ -79,6 +88,11 @@ static int character_load( struct character *ch, const char *name )
    ch->anim_push  = skeleton_get_anim( &ch->sk, "push" );
    ch->anim_push_reverse = skeleton_get_anim( &ch->sk, "push_reverse" );
    ch->anim_ollie = skeleton_get_anim( &ch->sk, "ollie" );
+   ch->anim_ollie_reverse = skeleton_get_anim( &ch->sk, "ollie_reverse" );
+   ch->anim_grabs = skeleton_get_anim( &ch->sk, "grabs" );
+   ch->anim_walk  = skeleton_get_anim( &ch->sk, "walk" );
+   ch->anim_run   = skeleton_get_anim( &ch->sk, "run" );
+   ch->anim_idle  = skeleton_get_anim( &ch->sk, "idle_cycle" );
 
    ch->id_hip = skeleton_bone_id( &ch->sk, "hips" );
    ch->id_ik_hand_l = skeleton_bone_id( &ch->sk, "hand.IK.L" );
@@ -232,6 +246,10 @@ static void character_ragdoll_iter( struct character *ch )
             rb_debug_constraint_limits( &pj->rb, &pp->rb, lca, pj->limits );
          }
       }
+
+      v4f plane = {0.0f,1.0f,0.0f,0.0f};
+      rb_effect_simple_bouyency( &pj->rb, plane, k_ragdoll_floatyiness,
+                                                 k_ragdoll_floatydrag );
    }
 
    /* CONSTRAINTS */