crosshair
This commit is contained in:
parent
328be44ed0
commit
e799d50f77
5 changed files with 94 additions and 18 deletions
24
control.c
24
control.c
|
@ -134,8 +134,10 @@ struct v3f control_rtrace(double cx, double cy, vec3 pos, int mode) {
|
|||
|
||||
vec3_add(temp_pos, temp_pos, temp_dir);
|
||||
|
||||
if (gen_cube(temp_pos[0],temp_pos[1],temp_pos[2],placeChunk,0,-1) != 0) {
|
||||
if (mode == 0) vec3_sub(temp_pos,temp_pos,temp_dir);
|
||||
if (gen_cube(temp_pos[0], temp_pos[1], temp_pos[2], placeChunk, 0, -1) !=
|
||||
0) {
|
||||
if (mode == 0)
|
||||
vec3_sub(temp_pos, temp_pos, temp_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -149,15 +151,21 @@ struct v3f control_rtrace(double cx, double cy, vec3 pos, int mode) {
|
|||
void control_lclick(double cx, double cy, vec3 pos) {
|
||||
struct v3f highlighted = control_rtrace(cx, cy, pos, 1);
|
||||
struct chunk placeChunk;
|
||||
int cube = gen_cube(highlighted.pos[0],highlighted.pos[1],highlighted.pos[2],placeChunk,0,-1);
|
||||
if (cube == 0) return;
|
||||
gen_cube(highlighted.pos[0],highlighted.pos[1],highlighted.pos[2],placeChunk,0,0);
|
||||
int cube = gen_cube(highlighted.pos[0], highlighted.pos[1],
|
||||
highlighted.pos[2], placeChunk, 0, -1);
|
||||
if (cube == 0)
|
||||
return;
|
||||
gen_cube(highlighted.pos[0], highlighted.pos[1], highlighted.pos[2],
|
||||
placeChunk, 0, 0);
|
||||
}
|
||||
|
||||
void control_rclick(double cx, double cy, vec3 pos) {
|
||||
struct v3f highlighted = control_rtrace(cx, cy, pos, 0);
|
||||
struct chunk placeChunk;
|
||||
int cube = gen_cube(highlighted.pos[0],highlighted.pos[1],highlighted.pos[2],placeChunk,0,-1);
|
||||
if (cube != 0) return;
|
||||
gen_cube(highlighted.pos[0],highlighted.pos[1],highlighted.pos[2],placeChunk,0,1);
|
||||
int cube = gen_cube(highlighted.pos[0], highlighted.pos[1],
|
||||
highlighted.pos[2], placeChunk, 0, -1);
|
||||
if (cube != 0)
|
||||
return;
|
||||
gen_cube(highlighted.pos[0], highlighted.pos[1], highlighted.pos[2],
|
||||
placeChunk, 0, 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue