Pre-release-0.7: "Tweaky Update"

Check forum for changelog!
master
azekillDIABLO 2019-07-01 17:39:04 +02:00
parent b2fa703427
commit 9c985c86e2
28 changed files with 3286 additions and 2791 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
config.txt Normal file
View File

@ -0,0 +1,7 @@
SHOW_LIGHTS 1
SHOW_ITEM 1
SHOW_CROSSHAIRS 1
SHOW_INFO_TEXT 1
SHOW_CHAT_TEXT 1
SHOW_PLAYER_NAMES 1
FONT_SIZE 16

BIN
omicron

Binary file not shown.

View File

@ -24,33 +24,34 @@ void main() {
discard; discard;
} }
float df = cloud ? 1.0 - diffuse * 0.2 : diffuse; float df = cloud ? 1.0 - diffuse * 0.2 : diffuse;
float ao = cloud ? 1.0 - (1.0 - fragment_ao) * 0.2 : fragment_ao; float ao = cloud ? 1.0 - (1.0 - fragment_ao) * 0.3 : fragment_ao;
ao = min(1.0, ao + fragment_light); ao = min(1.0, ao + fragment_light);
df = min(1.0, df + fragment_light); df = min(1.0, df + fragment_light);
float value = max(0.3, daylight + fragment_light); float value = max(0.3, daylight + fragment_light);
value = (value*0.5+0.2) + (value*0.3+0.1) * df; value = (value*0.5+0.2) + (value*0.3+0.1) * df;
value = (value*1.2) * (ao*0.7); value = (value*1.2) * (ao*0.7);
vec4 light_color = vec4(value, value, value, 1.0); vec4 light_color = vec4(value, value, value, 1.0);
vec3 a = vec3(texture2D(sky_sampler, vec2(timer, fog_height))) * sky_tint; vec3 a = vec3(texture2D(sky_sampler, vec2(timer, fog_height))) * sky_tint;
vec4 sky_color = vec4(a, 1.0); vec4 sky_color = vec4(a, 1.0);
if (color == vec4(1.0, 0.0, 1.0, 1.0)) {
discard;
}
if (color == vec4(1.0, 0.0, 1.0, 1.0)) {
discard;
}
if (color.a < 1.0) { if (color.a < 1.0) {
//color.a = 0.0; //color.a = 0.0;
//color = vec4(0.0); //color = vec4(0.0);
discard; discard;
} else { } else {
color.a = 1.0; color.a = 1.0;
} }
color = color * light_color;
color = mix(color, sky_color, fog_factor);
gl_FragColor = vec4(color); color = color * light_color;
color = mix(color, sky_color, fog_factor);
gl_FragColor = vec4(color);
} }

View File

@ -12,8 +12,8 @@ void main() {
discard; discard;
} }
//else { else {
//color.a = max(color.a, 0.4); color.a = max(color.a, 0.4);
//} }
gl_FragColor = color; gl_FragColor = color;
} }

View File

@ -1,6 +1,10 @@
#ifndef _config_h_ #ifndef _config_h_
#define _config_h_ #define _config_h_
// TODO: Transfer the maximum of stuff to ingame tweakable config (main.c)
//game //game
#define FLY_SPEED 70 #define FLY_SPEED 70
#define WALK_SPEED 6 #define WALK_SPEED 6
@ -16,9 +20,9 @@
// app parameters // app parameters
#define DEBUG 1 #define DEBUG 1
#define FULLSCREEN 0 //put to zero, fullscreen bugs #define FULLSCREEN 0 //put to zero, fullscreen bugs
#define WINDOW_WIDTH 1024 #define WINDOW_WIDTH 1366
#define WINDOW_HEIGHT 768 #define WINDOW_HEIGHT 768
#define VSYNC 1 #define VSYNC 0
#define SCROLL_THRESHOLD 0.1 #define SCROLL_THRESHOLD 0.1
#define MAX_MESSAGES 10 #define MAX_MESSAGES 10
#define DB_PATH "world/omicron-world.db" #define DB_PATH "world/omicron-world.db"
@ -26,17 +30,9 @@
#define DAY_LENGTH 500 #define DAY_LENGTH 500
#define INVERT_MOUSE 0 #define INVERT_MOUSE 0
// rendering options // rendering options
#define SHOW_LIGHTS 1 // were transfered to
#define SHOW_PLANTS 1 // options in main.c
#define SHOW_CLOUDS 1
#define SHOW_TREES 1
#define SHOW_ITEM 1
#define SHOW_CROSSHAIRS 1
#define SHOW_INFO_TEXT 1
#define SHOW_CHAT_TEXT 1
#define SHOW_PLAYER_NAMES 1
#define FONT_SIZE 16 // 12 small, 16 average, 24, big
// key bindings // key bindings
#define CRAFT_KEY_FORWARD 'W' #define CRAFT_KEY_FORWARD 'W'
@ -57,10 +53,10 @@
#define CRAFT_KEY_SIGN '-' #define CRAFT_KEY_SIGN '-'
// advanced parameters // advanced parameters
#define CREATE_CHUNK_RADIUS 10 #define CREATE_CHUNK_RADIUS 5
#define RENDER_CHUNK_RADIUS 6 #define RENDER_CHUNK_RADIUS 4
#define RENDER_SIGN_RADIUS 6 #define RENDER_SIGN_RADIUS 1.5
#define DELETE_CHUNK_RADIUS 14 #define DELETE_CHUNK_RADIUS 6
#define CHUNK_SIZE 32 #define CHUNK_SIZE 32
#define COMMIT_INTERVAL 5 #define COMMIT_INTERVAL 5

View File

@ -10,6 +10,14 @@ void make_cube_faces(
int wleft, int wright, int wtop, int wbottom, int wfront, int wback, int wleft, int wright, int wtop, int wbottom, int wfront, int wback,
float x, float y, float z, float scale, NonCubeType noncube) float x, float y, float z, float scale, NonCubeType noncube)
{ {
/*static const float positions[6][4][3] = {
{{-1, -1, -1}, {-1, -1, +1}, {-1, +1, -1}, {-1, +1, +1}},
{{+1, -1, -1}, {+1, -1, +1}, {+1, +1, -1}, {+1, +1, +1}},
{{-1, +1, -1}, {-1, +1, +1}, {+1, +1, -1}, {+1, +1, +1}},
{{-1, -1, -1}, {-1, -1, +1}, {+1, -1, -1}, {+1, -1, +1}},
{{-1, -1, -1}, {-1, +1, -1}, {+1, -1, -1}, {+1, +1, -1}},
{{-1, -1, +1}, {-1, +1, +1}, {+1, -1, +1}, {+1, +1, +1}}
};*/
static const float positions[6][4][3] = { static const float positions[6][4][3] = {
{{-1, -1, -1}, {-1, -1, +1}, {-1, +1, -1}, {-1, +1, +1}}, {{-1, -1, -1}, {-1, -1, +1}, {-1, +1, -1}, {-1, +1, +1}},
{{+1, -1, -1}, {+1, -1, +1}, {+1, +1, -1}, {+1, +1, +1}}, {{+1, -1, -1}, {+1, -1, +1}, {+1, +1, -1}, {+1, +1, +1}},
@ -18,6 +26,7 @@ void make_cube_faces(
{{-1, -1, -1}, {-1, +1, -1}, {+1, -1, -1}, {+1, +1, -1}}, {{-1, -1, -1}, {-1, +1, -1}, {+1, -1, -1}, {+1, +1, -1}},
{{-1, -1, +1}, {-1, +1, +1}, {+1, -1, +1}, {+1, +1, +1}} {{-1, -1, +1}, {-1, +1, +1}, {+1, -1, +1}, {+1, +1, +1}}
}; };
static const float normals[6][3] = { static const float normals[6][3] = {
{-1, 0, 0}, {-1, 0, 0},
{+1, 0, 0}, {+1, 0, 0},
@ -185,6 +194,7 @@ void make_plant(
mat_apply(data, ma, 24, 0, 10); mat_apply(data, ma, 24, 0, 10);
} }
// Player model
void make_player( void make_player(
float *data, float *data,
float x, float y, float z, float rx, float ry) float x, float y, float z, float rx, float ry)

View File

@ -21,6 +21,7 @@ const int items[] = {
Item_COBBLE, Item_COBBLE,
Item_LIGHT_STONE, Item_LIGHT_STONE,
Item_DARK_STONE, Item_DARK_STONE,
Item_TORCH,
Item_CHEST, Item_CHEST,
Item_TNT, Item_TNT,
Item_LEAVES, Item_LEAVES,
@ -191,6 +192,7 @@ const int blocks[256][6] = {
{0, 0, 0, 0, 0, 0}, // 88 {0, 0, 0, 0, 0, 0}, // 88
{19, 19, 35, 0, 19, 19}, // 89 - swamp dirt {19, 19, 35, 0, 19, 19}, // 89 - swamp dirt
{0, 0, 0, 0, 0, 0}, // 90 {0, 0, 0, 0, 0, 0}, // 90
{0, 0, 0, 0, 0, 16}, // 91
{0, 0, 0, 0, 0, 0} // - empty {0, 0, 0, 0, 0, 0} // - empty
}; };
@ -221,12 +223,13 @@ const int plants[256] = {
58, // 87 - mushroom 58, // 87 - mushroom
59, // 88 - mushroom patch 59, // 88 - mushroom patch
0, 0,
60 // 90 - swamp tall grass 60, // 90 - swamp tall grass
96 // 91 - torch
}; };
const int obj[256] = { const int obj[256] = {
60 // 90 - swamp tall grass 6 // test
}; };
int is_plant(int w) { int is_plant(int w) {
@ -244,6 +247,7 @@ int is_plant(int w) {
case Item_MUSHROOM: case Item_MUSHROOM:
case Item_MUSHROOMS: case Item_MUSHROOMS:
case Item_SWAMP_TALL_GRASS: case Item_SWAMP_TALL_GRASS:
case Item_TORCH:
return 1; return 1;
default: default:
return 0; return 0;
@ -262,6 +266,7 @@ int is_obstacle(int w) {
case Item_EMPTY: case Item_EMPTY:
case Item_CLOUD: case Item_CLOUD:
case Item_WATER: case Item_WATER:
case Item_TORCH:
return 0; return 0;
default: default:
return 1; return 1;
@ -284,6 +289,7 @@ int is_transparent(int w) {
case Item_GLASS: case Item_GLASS:
//case Item_LEAVES: //for better performance (8 fps -> 60fps OPTIMIZATION NEEDED!) //case Item_LEAVES: //for better performance (8 fps -> 60fps OPTIMIZATION NEEDED!)
case Item_WATER: //Just to stop Xray-ing case Item_WATER: //Just to stop Xray-ing
case Item_TORCH:
return 1; return 1;
default: default:
return 0; return 0;
@ -322,6 +328,7 @@ int buildable_to(int w) {
switch (w) { switch (w) {
case Item_WATER: case Item_WATER:
case Item_CLOUD: case Item_CLOUD:
case Item_TORCH:
return 0; return 0;
default: default:
return 1; return 1;

View File

@ -84,6 +84,7 @@ typedef enum {
Item_MUSHROOMS, Item_MUSHROOMS,
Item_SWAMP_GRASS, Item_SWAMP_GRASS,
Item_SWAMP_TALL_GRASS, Item_SWAMP_TALL_GRASS,
Item_TORCH,
Item_max Item_max
} Item; } Item;

5920
src/main.c

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ void generateBaseTerrain(int dx, int dz, int x, int z, int start_h, int h, int f
} }
} }
// Caves // Caves
for (int y = 1; y < 37; y++) { for (int y = 1; y < 37; y++) {
if (simplex3( if (simplex3(
@ -46,5 +46,6 @@ void generateBaseTerrain(int dx, int dz, int x, int z, int start_h, int h, int f
func(x, y, z, 0 * flag, arg); func(x, y, z, 0 * flag, arg);
} }
} }
} }
} }

View File

@ -7,7 +7,7 @@ void generateTemperate(int dx, int dz, int x, int z, int start_h, int h, int fla
for (int y = start_h; y < h - 1; y++) { for (int y = start_h; y < h - 1; y++) {
func(x, y, z, Item_STONE * flag, arg); func(x, y, z, Item_STONE * flag, arg);
} }
for (int y = 0; y < 5; y++) { for (int y = 0; y < 3; y++) {
func(x, h-y-1, z, Item_SAND * flag, arg); func(x, h-y-1, z, Item_SAND * flag, arg);
} }

View File

@ -33,12 +33,28 @@ void create_world(int p, int q, world_func func, void *arg) {
int mh = g * simplex2(-x * 0.0005, -z * 0.0005, 2, 16.0, 2); int mh = g * simplex2(-x * 0.0005, -z * 0.0005, 2, 16.0, 2);
mh += simplex2(-x * 0.0002, -z * 0.0002, 2, 16.0, 2) * simplex2(-x * 0.002, -z * 0.002, 2, 16.0, 2) * 100; mh += simplex2(-x * 0.0002, -z * 0.0002, 2, 16.0, 2) * simplex2(-x * 0.002, -z * 0.002, 2, 16.0, 2) * 100;
mh += 16; mh += simplex2(-x * 0.02, -z * 0.02, 3, 8.0, 2);
if (simplex2(-x * 0.0004, -z * 0.0004, 4, 4.0, 3)> 0.59) {
mh += 8;
}
int h = f * mh; int h = f * mh;
// Floating balls test
/*for (int y = 0; y < 25; y++) {
if (simplex3(
x * 0.001, (y+h) * 0.001, z * 0.001, 6, 1, 2) > 0.52)
{
if (y < 255) {
func(x, (y+h), z, Item_COLOR_13 * flag, arg);
}
}
}*/
// Ocean system (generates water under y == 45) // Ocean system (generates water under y == 45)
for (int y = 22; y < 45; y++) { for (int y = 22; y < 45; y++) {
func(x, y, z, Item_WATER * flag, arg); func(x, y, z, Item_WATER * flag, arg);
@ -46,9 +62,9 @@ void create_world(int p, int q, world_func func, void *arg) {
// ice on frigid biomes // ice on frigid biomes
float biomen = simplex3(-x * 0.0005 * (1 / BIOME_SIZE), -z * 0.0005 * (1 / BIOME_SIZE), q * 0.001, 2, 16.0, 1); float biomen = simplex3(-x * 0.0005 * (1 / BIOME_SIZE), -z * 0.0005 * (1 / BIOME_SIZE), q * 0.001, 2, 16.0, 1);
if(biomen > (4.0f/5.0f) && biomen < (5.0f/5.0f)) { if(biomen > (1.0f/6.0f) && biomen < (2.0f/6.0f)) {
// 2 ice layers on water // 2 ice layers on water
if (simplex2(x * 0.0004, z * 0.0004, 8, 1.5, 2) > 0.6) { if (simplex2(x * 0.0004, z * 0.0004, 8, 1.5, 2) > 0.59) {
func(x, 43, z, Item_ICE * flag, arg); func(x, 43, z, Item_ICE * flag, arg);
func(x, 44, z, Item_ICE * flag, arg); func(x, 44, z, Item_ICE * flag, arg);
} }
@ -78,7 +94,7 @@ void create_world(int p, int q, world_func func, void *arg) {
// clouds // clouds
for (int y = 120; y < 200; y++) { for (int y = 100; y < 180; y++) {
if (simplex3( if (simplex3(
x * 0.001, y * 0.004, z * 0.001, 6, 1, 2) > 0.7) x * 0.001, y * 0.004, z * 0.001, 6, 1, 2) > 0.7)
{ {
@ -108,23 +124,23 @@ Biome biome_at_pos(int q, int x, int z) {
Biome biome = Biome_max; Biome biome = Biome_max;
if(biomen > (1.0f/6.0f)) { if(biomen > (1.0f/6.0f)) {
biome = Biome_TEMPERATE; biome = Biome_TAIGA;
} }
if(biomen > (2.0f/6.0f)) { if(biomen > (2.0f/6.0f)) {
biome = Biome_DESERT; biome = Biome_SWAMP;
} }
if(biomen > (3.0f/6.0f)) { if(biomen > (3.0f/6.0f)) {
biome = Biome_RAINFOREST; biome = Biome_TEMPERATE;
} }
if(biomen > (4.0f/6.0f)) { if(biomen > (4.0f/6.0f)) {
biome = Biome_TAIGA; biome = Biome_RAINFOREST;
} }
if(biome == (5.0/6.0)) { if(biome == (5.0/6.0)) {
biome = Biome_MESA; biome = Biome_DESERT;
} }
if(biome == (Biome_max)) { if(biome == (Biome_max)) {
biome = Biome_SWAMP; biome = Biome_MESA;
} }
return biome; return biome;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 825 KiB

BIN
textures/font-alt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
textures/logo-ugly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB