You can use SPACE to cycle between beams, ':' to hide the beam. Will probably need a future rewrite…getting this in for testing.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@893 c06c8d41-db1a-0410-9941-cceddc491573
VD4KDTGHVKCN35AWREYB4TEOUMCTW7SAUPAMTMF5ABC7VBHVKP4AC
V4WGXVERZ34B7CEINV4D3ZYEKKT2TUIUYTOX5FSOX6B26U3DPVLQC
FEGNPOJI2SALUA2PVIXIQ2CIXFLSXD7UB7CNUSAAKV4L3POXCRFQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
TJRYL3NXPW5IUGEV3YOC7JYWEXCZDBFPLT4AUG4P227WVKVB72ZAC
YAAJ6PTN6QUSWE52URI5AENOGD366FIHOIFUOXFUJLVZYE4OG6HQC
YHSVOROKPYS33Y4RYZRVZTE3G5LXOFX52HEDNLV6HIXOJYNOKH3QC
static int cyclic_offset( unsigned int ui, int cycle_dir, int startpoint,
int maxvalue )
{
const int i = (int)ui;
if ( startpoint < 0 )
return i;
switch ( cycle_dir )
{
case 1:
return (i + startpoint + 1) % maxvalue;
case -1:
return (i - 1 - startpoint + maxvalue) % maxvalue;
case 0:
default:
return i;
}
}
for ( unsigned int fullray = 0; fullray < fullrays.size();
cur_offset += raylengths[fullray++] ) {
for ( unsigned int fray = 0; fray < fullrays.size(); ++fray )
{
const int fullray = cyclic_offset( fray, cycle_dir, ray.fullray_idx,
fullrays.size() );
// yeah, yeah, this is O(n^2). I know.
cur_offset = 0;
for ( int i = 0; i < fullray; ++i )
cur_offset += raylengths[i];
};
struct ray_def
{
double accx;
double accy;
double slope;
// Quadrant 1: down-right
// Quadrant 2: down-left
// Quadrant 3: up-left
// Quadrant 4: up-right
int quadrant;
int fullray_idx; // for cycling: where did we come from?
int x() const { return (int)(accx); }
int y() const { return (int)(accy); }
int advance(); // returns the direction taken (0,1,2)
void advance_and_bounce();
void regress();
};
struct ray_def
{
double accx;
double accy;
double slope;
// Quadrant 1: down-right
// Quadrant 2: down-left
// Quadrant 3: up-left
// Quadrant 4: up-right
int quadrant;
int x() const { return (int)(accx); }
int y() const { return (int)(accy); }
int advance(); // returns the direction taken (0,1,2)
void advance_and_bounce();
void regress();
if ( need_beam_redraw )
{
viewwindow(true, false);
if ( show_beam &&
in_vlos(grid2viewX(moves.tx), grid2viewY(moves.ty)) )
{
// Draw the new ray
ray_def raycopy = ray;
textcolor(MAGENTA);
while ( raycopy.x() != moves.tx || raycopy.y() != moves.ty )
{
if ( raycopy.x() != you.x_pos || raycopy.y() != you.y_pos )
{
if ( !in_los(raycopy.x(), raycopy.y()) )
break;
gotoxy( grid2viewX(raycopy.x() + 1),
grid2viewY(raycopy.y()));
cprintf("*");
}
raycopy.advance();
}
textcolor(LIGHTGREY);
}
}