Skip to content
Browse files

Cache intermediate values in draw_mine_exit_cover

  • Loading branch information...
vLKp committed Aug 6, 2019
1 parent 7f4c57b commit ec234e0b8e2e92890b8eb2f7808dbffab2c0cfff
Showing with 27 additions and 22 deletions.
  1. +27 −22 similar/main/endlevel.cpp
@@ -139,7 +139,6 @@ static void draw_stars(grs_canvas &, const d_unique_endlevel_state::starfield_ty
static int find_exit_side(const object_base &obj);
static void generate_starfield(d_unique_endlevel_state::starfield_type &stars);
static void start_endlevel_flythrough(flythrough_data *flydata,const vmobjptr_t obj,fix speed);
static void draw_mine_exit_cover(grs_canvas &);

constexpr array<const char, 24> movie_table{{
@@ -898,34 +897,40 @@ static int find_exit_side(const object_base &obj)
return best_side;

inline void prepare_mine_exit_cover_point(g3s_point& p, const vms_vector &v, fix u, fix r)
static void draw_mine_exit_cover(grs_canvas &canvas)
vms_vector tv;
p = g3_rotate_point(tv);

void draw_mine_exit_cover(grs_canvas &canvas)
int of=10;
fix u=i2f(6),d=i2f(9),ur=i2f(14),dr=i2f(17);
const int of = 10;
const fix u = i2f(6), d = i2f(9), ur = i2f(14), dr = i2f(17);
const uint8_t color = BM_XRGB(0, 0, 0);
array<cg3s_point *, 4> pointlist;
vms_vector v;
g3s_point p0, p1, p2, p3;



pointlist[0] = &p0;
pointlist[1] = &p1;
pointlist[2] = &p2;
pointlist[3] = &p3;
auto mrd = mine_exit_orient.rvec;
vms_vector vu;
vm_vec_scale_add(vu, v, mine_exit_orient.uvec, u);
auto mru = mrd;
vm_vec_scale(mru, ur);
vms_vector p;
g3_rotate_point(p0, (vm_vec_add(p, vu, mru), p));
g3_rotate_point(p1, (vm_vec_sub(p, vu, mru), p));
vms_vector vd;
vm_vec_scale_add(vd, v, mine_exit_orient.uvec, -d);
vm_vec_scale(mrd, dr);
vms_vector p;
g3_rotate_point(p2, (vm_vec_sub(p, vd, mrd), p));
g3_rotate_point(p3, (vm_vec_add(p, vd, mrd), p));
const array<cg3s_point *, 4> pointlist{{

g3_draw_poly(canvas, pointlist.size(), pointlist, color);

0 comments on commit ec234e0

Please sign in to comment.
You can’t perform that action at this time.