minor cleanup
This commit is contained in:
parent
cdb0d2bf58
commit
81c4b10def
10
src/config.h
10
src/config.h
@ -5,15 +5,15 @@
|
|||||||
* system. */
|
* system. */
|
||||||
#define RESOURCES_EMBEDDED !(DEVELOPER)
|
#define RESOURCES_EMBEDDED !(DEVELOPER)
|
||||||
|
|
||||||
#define DEFAULT_CAMERA_WIDTH (7)
|
#define DEFAULT_CAMERA_WIDTH (7.0)
|
||||||
#define DEFAULT_CAMERA_HEIGHT (DEFAULT_CAMERA_WIDTH / (16.0 / 9.0))
|
#define DEFAULT_CAMERA_HEIGHT (DEFAULT_CAMERA_WIDTH / (16.0 / 9.0))
|
||||||
|
|
||||||
#define PIXELS_PER_UNIT 256
|
#define PIXELS_PER_UNIT 256.0
|
||||||
|
|
||||||
#define GAME_FPS 50
|
#define GAME_FPS 50.0
|
||||||
#define GAME_TIMESCALE 1
|
#define GAME_TIMESCALE 1.0
|
||||||
|
|
||||||
#define USER_FRAME_LIMIT 300
|
#define USER_FRAME_LIMIT 300.0
|
||||||
|
|
||||||
/* How many ticks back in time should the user blend between?
|
/* How many ticks back in time should the user blend between?
|
||||||
* Delay ms = USER_INTERP_OFFSET_TICK_RATIO * Game tick rate
|
* Delay ms = USER_INTERP_OFFSET_TICK_RATIO * Game tick rate
|
||||||
|
|||||||
12
src/game.c
12
src/game.c
@ -136,8 +136,8 @@ INTERNAL void game_update(void)
|
|||||||
struct string sprite_name = STR("res/graphics/tim.ase");
|
struct string sprite_name = STR("res/graphics/tim.ase");
|
||||||
struct string sprite_tag_name = STR("UNARMED");
|
struct string sprite_tag_name = STR("UNARMED");
|
||||||
struct sheet *sheet = sheet_load(sprite_name);
|
struct sheet *sheet = sheet_load(sprite_name);
|
||||||
f32 meters_width = sheet->frame_size.x / PIXELS_PER_UNIT;
|
f32 meters_width = sheet->frame_size.x / (f32)PIXELS_PER_UNIT;
|
||||||
f32 meters_height = sheet->frame_size.y / PIXELS_PER_UNIT;
|
f32 meters_height = sheet->frame_size.y / (f32)PIXELS_PER_UNIT;
|
||||||
|
|
||||||
struct v2 sprite_pos = V2(0, 0);
|
struct v2 sprite_pos = V2(0, 0);
|
||||||
f32 sprite_rot = 0;
|
f32 sprite_rot = 0;
|
||||||
@ -187,8 +187,8 @@ INTERNAL void game_update(void)
|
|||||||
struct string sprite_name = STR("res/graphics/tim.ase");
|
struct string sprite_name = STR("res/graphics/tim.ase");
|
||||||
struct string sprite_tag_name = STR("UNARMED");
|
struct string sprite_tag_name = STR("UNARMED");
|
||||||
struct sheet *sheet = sheet_load(sprite_name);
|
struct sheet *sheet = sheet_load(sprite_name);
|
||||||
f32 meters_width = sheet->frame_size.x / PIXELS_PER_UNIT;
|
f32 meters_width = sheet->frame_size.x / (f32)PIXELS_PER_UNIT;
|
||||||
f32 meters_height = sheet->frame_size.y / PIXELS_PER_UNIT;
|
f32 meters_height = sheet->frame_size.y / (f32)PIXELS_PER_UNIT;
|
||||||
|
|
||||||
struct v2 sprite_pos = V2(0, 0);
|
struct v2 sprite_pos = V2(0, 0);
|
||||||
f32 sprite_rot = 0;
|
f32 sprite_rot = 0;
|
||||||
@ -256,8 +256,8 @@ INTERNAL void game_update(void)
|
|||||||
|
|
||||||
struct string sprite_name = STR("res/graphics/sound.ase");
|
struct string sprite_name = STR("res/graphics/sound.ase");
|
||||||
struct sheet *sheet = sheet_load(sprite_name);
|
struct sheet *sheet = sheet_load(sprite_name);
|
||||||
f32 meters_width = sheet->frame_size.x / PIXELS_PER_UNIT;
|
f32 meters_width = sheet->frame_size.x / (f32)PIXELS_PER_UNIT;
|
||||||
f32 meters_height = sheet->frame_size.y / PIXELS_PER_UNIT;
|
f32 meters_height = sheet->frame_size.y / (f32)PIXELS_PER_UNIT;
|
||||||
|
|
||||||
struct v2 sprite_size = V2(meters_width, meters_height);
|
struct v2 sprite_size = V2(meters_width, meters_height);
|
||||||
e->sprite_quad_xform = xform_with_scale(XFORM_IDENT, sprite_size);
|
e->sprite_quad_xform = xform_with_scale(XFORM_IDENT, sprite_size);
|
||||||
|
|||||||
@ -264,7 +264,7 @@ INLINE f32 math_exp(f32 x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
f32 t = x * x;
|
f32 t = x * x;
|
||||||
f32 c = x - t * (1.6666625440e-1f + t * -2.7667332906e-3f);
|
f32 c = x - t * (1.6666625440e-1f + t * -2.7667332906e-3f);
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
return 1.0f - ((x * c) / (c - 2.0f) - x);
|
return 1.0f - ((x * c) / (c - 2.0f) - x);
|
||||||
} else {
|
} else {
|
||||||
@ -633,10 +633,8 @@ INLINE struct mat4x4 mat4x4_mul(struct mat4x4 m1, struct mat4x4 m2)
|
|||||||
/* Takes a translation, rotation, and scale as optional parameters for constructing an xform */
|
/* Takes a translation, rotation, and scale as optional parameters for constructing an xform */
|
||||||
#define XFORM_TRS(...) xform_from_trs((struct trs) { .t = V2(0,0), .s = V2(1, 1), .r = 0, __VA_ARGS__ })
|
#define XFORM_TRS(...) xform_from_trs((struct trs) { .t = V2(0,0), .s = V2(1, 1), .r = 0, __VA_ARGS__ })
|
||||||
|
|
||||||
INLINE struct xform xform_translate(struct xform xf, struct v2 v);
|
|
||||||
INLINE struct xform xform_rotate(struct xform xf, f32 angle);
|
INLINE struct xform xform_rotate(struct xform xf, f32 angle);
|
||||||
INLINE struct xform xform_scale(struct xform xf, struct v2 v);
|
INLINE struct xform xform_scale(struct xform xf, struct v2 v);
|
||||||
INLINE struct xform xform_invert(struct xform xf);
|
|
||||||
INLINE struct v2 xform_basis_mul_v2(struct xform xf, struct v2 v);
|
INLINE struct v2 xform_basis_mul_v2(struct xform xf, struct v2 v);
|
||||||
INLINE struct v2 xform_mul_v2(struct xform xf, struct v2 v);
|
INLINE struct v2 xform_mul_v2(struct xform xf, struct v2 v);
|
||||||
INLINE struct xform xform_with_scale(struct xform xf, struct v2 s);
|
INLINE struct xform xform_with_scale(struct xform xf, struct v2 s);
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
struct sound;
|
struct sound;
|
||||||
|
|
||||||
#define MIXER_FLAG_NONE 0x0
|
#define MIXER_FLAG_NONE 0x0
|
||||||
#define MIXER_FLAG_SPATIALIZE 0x1
|
#define MIXER_FLAG_SPATIALIZE 0x1
|
||||||
|
|
||||||
#define MIXER_DESC(...) ((struct mixer_desc) { \
|
#define MIXER_DESC(...) ((struct mixer_desc) { \
|
||||||
.flags = 0, \
|
.flags = 0, \
|
||||||
@ -19,8 +19,8 @@ struct sound;
|
|||||||
})
|
})
|
||||||
struct mixer_desc {
|
struct mixer_desc {
|
||||||
u32 flags;
|
u32 flags;
|
||||||
f32 volume; /* 0 -> 1.0+ scale */
|
f32 volume; /* 0 -> 1.0+ */
|
||||||
f32 speed; /* 0 -> 1.0+ scale */
|
f32 speed; /* 0 -> 1.0+ */
|
||||||
b32 looping;
|
b32 looping;
|
||||||
|
|
||||||
/* MIXER_FLAG_SPATIALIZE */
|
/* MIXER_FLAG_SPATIALIZE */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user