diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-04-29 19:21:12 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-04-29 19:21:12 -0400 |
commit | a64ba14ff2c6041a4d5b0413e524f2f7a7e3674e (patch) | |
tree | 63da170768def210ede25b1157a4edbcd57046a9 /clld.h | |
parent | 9797ea8be2220759eab9ec546f43c6b9a04c7cc5 (diff) |
Converted clld to a library.
I did this to not only make it smaller, but to also
make it faster, and to allow for other programs to use
it more efficiently.
Also, the original program is now in clld-test.c
Diffstat (limited to 'clld.h')
-rw-r--r-- | clld.h | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -0,0 +1,61 @@ +#include <stdint.h> + +enum {THM, AABB}; + +struct pos { + int x; + int y; + int z; + double fx; + double fy; + double fz; +}; + +struct colis { + /* Cursor/Floor's width, and height */ + int w; + int h; + + /* Cursor's X, and Y velocity. */ + double xvel; + double yvel; + + /* Cursor/Floor's coordinates. */ + struct pos pos; + + /* The four corners of either the Cursor, or the Floor. */ + int a1; + int a2; + int b1; + int b2; + + /* The four floating point corners of either the Cursor, or the Floor. */ + double c1; + double c2; + double d1; + double d2; + + /* Heightmap, used in Tile Heightmap collision. */ + uint8_t *heightmap; + + /* X axis collision. */ + unsigned int clx : 1; + + /* Y axis collision. */ + unsigned int cly : 1; + + /* Cursor is on the ground. */ + unsigned int gnded : 1; + + /* Vertical flip flag. */ + unsigned int flp : 1; +}; + +/* Tile Heightmap Collision. */ +extern void thm(int hmpeak, struct colis *cursor, struct colis *floor); +/* Floating point Tile Heightmap Collision. */ +extern void fthm(int hmpeak, struct colis *cursor, struct colis *floor); +/* Axis Aligned Bounding Box Collision. */ +extern void aabb(struct colis *cursor, struct colis *floor); +/* Floating point Axis Aligned Bounding Box Collision. */ +extern void faabb(struct colis *cursor, struct colis *floor); |