crossbow:: fixed Z-fighting and arrow paths not visible in FPP

This commit is contained in:
Zeno Rogue 2023-10-29 09:57:19 +01:00
parent 0c6d286fa8
commit 8185657768
3 changed files with 19 additions and 13 deletions

View File

@ -2727,13 +2727,15 @@ void celldrawer::draw_bowpath() {
color_t arrow_color_trans = arrow_color & 0xFFFFFF00;
if(bow::fire_mode) arrow_color = gradient(arrow_color_trans, arrow_color, 0, 0.25, 1);
auto V1 = shmup::at_missile_level(V);
if(birth) {
if(t > 0.8) {
hyperpoint h = h1 + t1 * (1-t);
hyperpoint tg = -t1;
poly_outline = OUTLINE_TRANS;
queuepoly(V * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, gradient(arrow_color_trans, arrow_color, 0.8, t, 1));
queuepoly(V1 * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, gradient(arrow_color_trans, arrow_color, 0.8, t, 1));
poly_outline = OUTLINE_DEFAULT;
}
}
@ -2745,7 +2747,7 @@ void celldrawer::draw_bowpath() {
hyperpoint tg = (h1 - h0) * 6 * t * (1-t) + (3 * t*t - 4*t + 1) * t0 + (2*t-3*t*t) * t1;
poly_outline = OUTLINE_TRANS;
queuepoly(V * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, arrow_color);
queuepoly(V1 * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, arrow_color);
poly_outline = OUTLINE_DEFAULT;
}
}

View File

@ -1423,10 +1423,12 @@ EX void drawPlayer(eMonster m, cell *where, const shiftmatrix& V, color_t col, d
if(ti <= 0) ti = 0;
else ti = 1 + ti / 500;
}
if(ti <= 1) queuepoly(VWPN, cgi.shCrossbowstringLoaded, fc(314, cs.bowcolor2, 3));
else if(ti <= 2) queuepoly(VWPN, cgi.shCrossbowstringSemiloaded, fc(314, cs.bowcolor2, 3));
else queuepoly(VWPN, cgi.shCrossbowstringUnloaded, fc(314, cs.bowcolor2, 3));
if(ti == 0) queuepoly(VWPN, cgi.shCrossbowBolt, fc(314, cs.swordcolor, 3));
shiftmatrix VWPN1 = VWPN, VWPN2 = VWPN;
if(GDIM == 3) { ld h = cgi.human_height; VWPN1 = VWPN * lzpush(-h/60); VWPN2 = VWPN * lzpush(-h/30); }
if(ti <= 1) queuepoly(VWPN1, cgi.shCrossbowstringLoaded, fc(314, cs.bowcolor2, 3));
else if(ti <= 2) queuepoly(VWPN1, cgi.shCrossbowstringSemiloaded, fc(314, cs.bowcolor2, 3));
else queuepoly(VWPN1, cgi.shCrossbowstringUnloaded, fc(314, cs.bowcolor2, 3));
if(ti == 0) queuepoly(VWPN2, cgi.shCrossbowBolt, fc(314, cs.swordcolor, 3));
}
else if(items[itOrbThorns])
queuepoly(VWPN, cgi.shHedgehogBladePlayer, items[itOrbDiscord] ? watercolor(0) : 0x00FF00FF);
@ -1549,10 +1551,12 @@ void drawMimic(eMonster m, cell *where, const shiftmatrix& V, color_t col, doubl
if(ti <= 0) ti = 0;
else ti = 1 + ti / 500;
}
if(ti <= 1) queuepoly(VWPN, cgi.shCrossbowstringLoaded, col1);
else if(ti <= 2) queuepoly(VWPN, cgi.shCrossbowstringSemiloaded, col1);
else queuepoly(VWPN, cgi.shCrossbowstringUnloaded, col1);
if(ti == 0) queuepoly(VWPN, cgi.shCrossbowBolt, col1);
shiftmatrix VWPN1 = VWPN, VWPN2 = VWPN;
if(GDIM == 3) { ld h = cgi.human_height; VWPN1 = VWPN * lzpush(-h/60); VWPN2 = VWPN * lzpush(-h/30); }
if(ti <= 1) queuepoly(VWPN1, cgi.shCrossbowstringLoaded, col1);
else if(ti <= 2) queuepoly(VWPN1, cgi.shCrossbowstringSemiloaded, col1);
else queuepoly(VWPN1, cgi.shCrossbowstringUnloaded, col1);
if(ti == 0) queuepoly(VWPN2, cgi.shCrossbowBolt, col1);
}
else if(!shmup::on) {
bool emp = items[itOrbEmpathy] && m != moShadow;

View File

@ -2977,14 +2977,14 @@ auto hooksw = addHook(hooks_swapdim, 100, [] {
});
#endif
}
shiftmatrix at_missile_level(const shiftmatrix& T) {
EX shiftmatrix at_missile_level(const shiftmatrix& T) {
if(WDIM == 3) return T;
if(GDIM == 3) return orthogonal_move(T, cgi.BODY);
return at_smart_lof(T, 1.15);
}
EX }
bool celldrawer::draw_shmup_monster() {
using namespace shmup;
#if CAP_SHAPES