Make everything 2x smaller
This commit is contained in:
12
asteroids.c
12
asteroids.c
@@ -13,9 +13,9 @@
|
||||
#define MIN_VERTS 5
|
||||
#define VERT_RANGE (MAX_VERTS - MIN_VERTS)
|
||||
#define A_JITTER 0.8
|
||||
#define V_JITTER 0.001
|
||||
#define V_JITTER 0.0005
|
||||
#define ROT_JITTER 0.005
|
||||
#define R_JITTER 0.02
|
||||
#define R_JITTER 0.01
|
||||
#define MIN_DIST 0.8
|
||||
|
||||
#define REPLACE_MIN 3
|
||||
@@ -41,10 +41,10 @@ static unsigned count;
|
||||
static entry_t entries[MAX_ENTITIES];
|
||||
|
||||
static float radii[] = {
|
||||
[ASTEROID_SMALL] = 0.05f,
|
||||
[ASTEROID_MEDIUM] = 0.1f,
|
||||
[ASTEROID_LARGE] = 0.2f,
|
||||
[ASTEROID_HUGE] = 0.4f,
|
||||
[ASTEROID_SMALL] = 0.025f,
|
||||
[ASTEROID_MEDIUM] = 0.05f,
|
||||
[ASTEROID_LARGE] = 0.1f,
|
||||
[ASTEROID_HUGE] = 0.2f,
|
||||
};
|
||||
|
||||
static void update(unsigned new_entity_id, void *ref)
|
||||
|
||||
52
game.c
52
game.c
@@ -17,30 +17,29 @@
|
||||
|
||||
#define INIT_LEVEL 1
|
||||
|
||||
#define SHIP_COLLIDE_R 0.05
|
||||
#define SHIP_MASS 0.02
|
||||
#define SHIP_COLLIDE_R 0.025
|
||||
#define SHIP_MASS 0.01
|
||||
|
||||
#define FIRE_MEAN -0.15
|
||||
#define FIRE_JITTER 0.01
|
||||
#define FIRE_JITTER 0.005
|
||||
|
||||
#define LIN_PWR 0.0001
|
||||
#define LIN_PWR 0.00005
|
||||
#define ROT_PWR 0.002
|
||||
|
||||
#define SHOT_VEL 0.03
|
||||
#define SHOT_COLLIDE_R 0.03
|
||||
#define SHOT_MASS 0.001
|
||||
#define SHOT_VEL 0.015
|
||||
#define SHOT_COLLIDE_R 0.015
|
||||
#define SHOT_MASS 0.0005
|
||||
|
||||
#define ARROW_SCALE 0.025
|
||||
#define ARROW_SCALE 0.0125
|
||||
#define ARROW_WIDTH 4
|
||||
#define ARROW_HEIGHT 4
|
||||
#define COUNTER_MASK (1 << 6)
|
||||
|
||||
#define ITEM_SPAWN_R 0.9
|
||||
#define ITEM_COLLIDE_R 0.025
|
||||
#define ITEM_COLLIDE_R 0.0125
|
||||
#define ITEM_SPAWN_EXP_S 40
|
||||
#define ITEM_MIN_SCORE 32
|
||||
|
||||
#define ARMOUR_COEFF 5e-6
|
||||
#define ARMOUR_COEFF 2.5e-6
|
||||
|
||||
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
@@ -51,17 +50,17 @@ enum {
|
||||
};
|
||||
|
||||
static const vec2_t ship_verts[] = {
|
||||
{ 0.0, 0.11 },
|
||||
{ 0.05, -0.07 },
|
||||
{ 0.0, -0.04 },
|
||||
{ -0.05, -0.07 },
|
||||
{ 0.0, 0.055 },
|
||||
{ 0.025, -0.035 },
|
||||
{ 0.0, -0.02 },
|
||||
{ -0.025, -0.035 },
|
||||
};
|
||||
static const vec2_t fire_verts[] = {
|
||||
{ 0.0, -0.15 },
|
||||
{ 0.015, -0.07 },
|
||||
{ -0.015, -0.07 },
|
||||
{ 0.0, -0.075 },
|
||||
{ 0.0075, -0.035 },
|
||||
{ -0.0075, -0.035 },
|
||||
};
|
||||
static const vec2_t shot_verts[] = { { 0.0, -0.02 }, { 0.0, 0.02 } };
|
||||
static const vec2_t shot_verts[] = { { 0.0, -0.01 }, { 0.0, 0.01 } };
|
||||
|
||||
static const vec2_t arrow_verts[][MAX_VERTS] = {
|
||||
{ { 1, 2 }, { 2, 0 }, { 1, -2 } },
|
||||
@@ -70,8 +69,8 @@ static const vec2_t arrow_verts[][MAX_VERTS] = {
|
||||
static const unsigned arrow_counts[NELEMS(arrow_verts)] = { 3, 2 };
|
||||
|
||||
static const vec2_t item_verts[][MAX_VERTS] = {
|
||||
{ { -0.025, -0.025 }, { 0.025, 0.025 } },
|
||||
{ { -0.025, 0.025 }, { 0.025, -0.025 } },
|
||||
{ { -0.0125, -0.0125 }, { 0.0125, 0.0125 } },
|
||||
{ { -0.0125, 0.0125 }, { 0.0125, -0.0125 } },
|
||||
};
|
||||
static const unsigned item_counts[NELEMS(item_verts)] = { 2, 2 };
|
||||
|
||||
@@ -190,19 +189,13 @@ static void draw_arrow()
|
||||
{ tx, 0, 1 },
|
||||
};
|
||||
|
||||
const vec3_t c_mod = { 0, 0, 1 };
|
||||
const vec3_t s_mod = { ARROW_WIDTH + 2, ARROW_HEIGHT + 2, 0 };
|
||||
const vec3_t c = mat3_mul_vec3(m, c_mod);
|
||||
const vec3_t s = mat3_mul_vec3(m, s_mod);
|
||||
renderer_clear_rect(vec3_reduce(c), (vec2_t) { s.x, s.y });
|
||||
|
||||
for (unsigned i = 0; i < NELEMS(arrow_verts); ++i)
|
||||
renderer_draw(arrow_verts[i], arrow_counts[i], m, false);
|
||||
}
|
||||
|
||||
static void anim_fire(vec2_t *verts)
|
||||
{
|
||||
verts[0].y = FIRE_MEAN + FIRE_JITTER * rng_plusminus();
|
||||
verts[0].y = fire_verts[0].y + FIRE_JITTER * rng_plusminus();
|
||||
}
|
||||
|
||||
static void create_field()
|
||||
@@ -321,7 +314,8 @@ void game_update()
|
||||
|
||||
entities_purge();
|
||||
|
||||
const bool items_enabled = score >= ITEM_MIN_SCORE;
|
||||
const bool items_enabled
|
||||
= !clear && score >= ITEM_MIN_SCORE && armour_level < 9;
|
||||
if (items_enabled && !item
|
||||
&& rng_canon() < 1.0f / (60 * ITEM_SPAWN_EXP_S))
|
||||
add_item();
|
||||
|
||||
Reference in New Issue
Block a user