plish
[carveJwlIkooP6JGAAIwe30JlM.git] / player.h
index e625b0baf735c95de4180c7af173a754afd77599..d744d192d06db58c16097a3c2df53fdfaa3f1f2e 100644 (file)
--- a/player.h
+++ b/player.h
@@ -1,3 +1,206 @@
+#ifndef PLAYER_H
+#define PLAYER_H
+
+#include "player_api.h"
+
+#include "player_common.h"
+#include "player_walk.h"
+#include "player_skate.h"
+//#include "player_dead.h"
+
+struct player_instance
+{
+   /* transform definition */
+   rigidbody rb;
+   v3f angles;
+
+   /*
+    * Camera management
+    * ---------------------------
+    */
+   camera cam; /* output final camera */
+
+   enum camera_mode
+   {
+      k_cam_firstperson = 0,
+      k_cam_thirdperson = 1
+   }
+   camera_mode;
+   float camera_type_blend;
+
+#if 0
+   struct
+   {
+      v3f co, angles;
+   }
+   cam1, cam3;
+#endif
+
+#if 0
+   v3f follow_pos,
+       follow_angles,
+       follow_pos_target,
+       follow_angles_target,
+       override_pos,
+       override_angles,
+       fpv_pos,
+       fpv_angles,
+       fpv_offset,
+       fpv_offset_target;
+
+   float cam_position_override_strength,
+         cam_angles_override_strength,
+         cam_land_punch,
+         cam_land_punch_v;
+#endif
+
+   v3f fpv_offset,         /* expressed relative to rigidbody */
+       tpv_offset,
+       fpv_viewpoint,      /* expressed relative to neck bone inverse final */
+       fpv_offset_smooth,
+       fpv_viewpoint_smooth,
+       tpv_offset_smooth,
+       tpv_lpf,
+       cam_velocity_smooth;
+
+   float cam_velocity_influence,
+         cam_velocity_coefficient,
+         cam_velocity_constant,
+         cam_velocity_coefficient_smooth,
+         cam_velocity_constant_smooth,
+         cam_velocity_influence_smooth,
+         cam_land_punch,
+         cam_land_punch_v;
+
+   teleport_gate *gate_waiting;
+
+   /*
+    * Input 
+    * --------------------------------
+    */
+   struct input_binding *input_js1h,
+                        *input_js1v,
+                        *input_js2h,
+                        *input_js2v,
+                        *input_jump,
+                        *input_push,
+                        *input_walk,
+                        *input_walkh,
+                        *input_walkv,
+                        *input_use,
+                        *input_reset,
+                        *input_grab,
+                        *input_camera;
+
+   /*
+    * Animation
+    * --------------------------------------------------
+    */
+
+   struct player_avatar  *playeravatar;
+   glmesh                *playermesh;
+   struct player_ragdoll  ragdoll;
+   vg_tex2d              *playertex;
+
+   /*
+    * Subsystems
+    * -------------------------------------------------
+    */
+
+   enum player_subsystem
+   {
+      k_player_subsystem_walk = 0,
+      k_player_subsystem_skate = 1,
+      k_player_subsystem_dead = 2
+   }
+   subsystem;
+
+   struct player_skate  _skate;
+   struct player_walk   _walk;
+   //struct player_dead   _dead;
+};
+
+/*
+ * Gameloop tables
+ * ---------------------------------------------------------
+ */
+
+VG_STATIC
+void (*_player_bind[])( player_instance *player ) =
+{
+   player__walk_bind,
+   player__skate_bind,
+   NULL
+};
+
+VG_STATIC
+void (*_player_reset[])( player_instance *player, struct respawn_point *rp ) =
+{
+   NULL,
+   player__skate_reset,
+   NULL
+};
+
+VG_STATIC
+void (*_player_pre_update[])( player_instance *player ) = 
+{
+   player__walk_pre_update,
+   player__skate_pre_update,
+   NULL
+};
+
+VG_STATIC
+void( *_player_update[])( player_instance *player ) =
+{
+   player__walk_update,
+   player__skate_update,
+   NULL
+};
+
+VG_STATIC 
+void( *_player_post_update[])( player_instance *player ) =
+{
+   player__walk_post_update,
+   player__skate_post_update,
+   NULL
+};
+
+VG_STATIC
+void( *_player_im_gui[])( player_instance *player ) =
+{
+   player__walk_im_gui,
+   player__skate_im_gui,
+   NULL
+};
+
+VG_STATIC
+void( *_player_animate[])( player_instance *player, player_animation *dest ) =
+{
+   player__walk_animate,
+   player__skate_animate,
+   NULL
+};
+
+VG_STATIC
+void( *_player_post_animate[])( player_instance *player ) =
+{
+   player__walk_post_animate,
+   player__skate_post_animate,
+   NULL
+};
+
+/* implementation */
+
+#include "player.c"
+#include "player_common.c"
+#include "player_walk.c"
+#include "player_skate.c"
+//#include "player_dead.c"
+
+#endif /* PLAYER_H */
+
+
+#if 0
 /*
  * Copyright (C) 2021-2023 Mt.ZERO Software, Harry Godden - All Rights Reserved
  */
 #include "bvh.h"
 
 
-VG_STATIC int freecam = 0;
-VG_STATIC int walk_grid_iterations = 1;
-VG_STATIC float fc_speed = 10.0f;
-VG_STATIC int cl_thirdperson = 0;
-
 /* 
  * -----------------------------------------------------------------------------
  *                                  Memory
@@ -913,3 +1111,4 @@ VG_STATIC void player_restore_frame(void)
 }
 
 #endif /* PLAYER_H */
+#endif