aboutsummaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-07-29 20:03:15 +0000
committerrodri <rgl@antares-labs.eu>2021-07-29 20:03:15 +0000
commitb57dba67153279a84a16bba40ae007c8ae710056 (patch)
tree62ff359275ae3c70b16d341fabf59c4df1431137 /dat.h
parent3241d4b8c80f9424a3f725b5905def22916fc854 (diff)
downloadmusw-b57dba67153279a84a16bba40ae007c8ae710056.tar.gz
musw-b57dba67153279a84a16bba40ae007c8ae710056.tar.bz2
musw-b57dba67153279a84a16bba40ae007c8ae710056.zip
incorporated libgeometry into the project.
transitioned the integrator from scalar to vector-based. added a packing procedure for Point2. created the structure to model bullets.
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/dat.h b/dat.h
index 9290562..6857e69 100644
--- a/dat.h
+++ b/dat.h
@@ -23,10 +23,10 @@ enum {
SCRHB = SCRH+2*Borderwidth
};
-typedef struct Vector Vector;
typedef struct VModel VModel;
typedef struct Sprite Sprite;
typedef struct Particle Particle;
+typedef struct Bullet Bullet;
typedef struct Ship Ship;
typedef struct Star Star;
typedef struct Universe Universe;
@@ -37,23 +37,18 @@ typedef struct Player Player;
typedef struct Lobby Lobby;
typedef struct Party Party;
-struct Vector
-{
- double x, y;
-};
-
/*
* Vector model - made out of lines and curves
*/
struct VModel
{
- Vector *pts;
+ Point2 *pts;
ulong npts;
/* WIP
* l(ine) → takes 2 points
* c(urve) → takes 3 points
*/
-// char *strokefmt;
+ char *strokefmt;
};
struct Sprite
@@ -72,18 +67,25 @@ struct Sprite
struct Particle
{
- Vector p, v;
+ Point2 p, v;
double yaw;
double mass;
};
+struct Bullet
+{
+ Particle;
+ ulong ttl; /* in s */
+ int fired; /* XXX: |v| != 0 */
+};
+
struct Ship
{
Particle;
Kind kind;
- uint ammo;
+ Bullet rounds[10];
VModel *mdl;
-// Matrix mdlxform;
+ Matrix mdlxform;
};
struct Star
@@ -103,12 +105,13 @@ struct Universe
struct GameState
{
double t, timeacc;
- double x, v;
+ Point2 p, v;
};
struct Derivative
{
- double dx, dv;
+ Point2 dx; /* v */
+ Point2 dv; /* a */
};
struct Conn