crosshair

This commit is contained in:
onezplpl 2024-07-18 17:04:40 -04:00
parent 328be44ed0
commit e799d50f77
No known key found for this signature in database
GPG key ID: 7EC026A136F9EEC3
5 changed files with 94 additions and 18 deletions

37
cubes.c
View file

@ -22,6 +22,38 @@ int oz = -1024;
struct chunk *chunk_old = NULL;
void cubes_rect(struct v3f *cube, int *i, double x1, double x2, double y1,
double y2, int is_text, int text_x, int text_y) {
struct v3f a2 = {{x1, y1, 0}};
if (is_text) {
a2.pos[0] = TEXT_GAP_H * text_x;
a2.pos[1] = TEXT_GAP_V * text_y;
a2.pos[2] = 0;
}
struct v3f b = a2;
struct v3f c = a2;
struct v3f d = a2;
if (is_text) {
b.pos[0] += TEXT_GAP_H;
c.pos[1] += TEXT_GAP_V;
d.pos[0] += TEXT_GAP_H;
d.pos[1] += TEXT_GAP_V;
} else {
b.pos[0]++;
c.pos[1]++;
d.pos[0]++;
d.pos[1]++;
}
cube[*i] = a2;
cube[*i + 1] = b;
cube[*i + 2] = c;
cube[*i + 3] = c;
cube[*i + 4] = b;
cube[*i + 5] = d;
}
void cubes_face(struct v3f *cube, int i, int x, int y, int z, int x2, int y2,
int z2, int *j, int is_text, struct chunk dat, int ci, int a3) {
struct v3i a = {{x, y, z}};
@ -137,11 +169,12 @@ void cubes_free() { free(chunk_old); }
void cubes_refresh(int x, int y, int z, struct chunk dat) {
for (int i = 0; i < CHUNK_ALL; i++) {
if (chunk_old[i].exists != 0 && abs(((int)chunk_old[i].x) - x) <= 1 &&
abs(((int)chunk_old[i].y) - y) <= 1 && abs(((int)chunk_old[i].z) - z) <= 1) {
abs(((int)chunk_old[i].y) - y) <= 1 &&
abs(((int)chunk_old[i].z) - z) <= 1) {
chunk_old[i].exists = 0;
}
}
gen_save(dat);
gen_save(dat);
}
int cubes_vert(struct v3f *cube, struct v3f *text, struct v3f *cubeO,