Esempio n. 1
0
void awp_draw_reel(int rno)
{
	int x = rno + 1;
	char rg[16];

	sprintf(rg,"reel%d", x);
	reelpos[rno] = stepper_get_position(rno);
	if (reelpos[rno] == output_get_value(rg))
	{
		// Not moved, no need to update.
	}
	else
	{
		output_set_value(rg,(reelpos[rno]));

		// if the reel isn't configured don't do this, otherwise you'll get DIV0
		if (stepper_get_max(rno))
		{
			sprintf(rg,"sreel%d", x); // our new scrolling reels are called 'sreel'
			// normalize the value
			int sreelpos = (reelpos[rno] * 0x10000) / stepper_get_max(rno);

			output_set_value(rg,sreelpos);
		}
	}
}
Esempio n. 2
0
void awp_draw_reel(int rno)
{
	int rsteps = steps[rno];
	int rsymbols = symbols[rno];
	int m;
	int x = rno + 1;
	char rg[16], rga[16], rgb[16];

	sprintf(rg,"reel%d", x);
	reelpos[rno] = stepper_get_position(rno);
	if (reelpos[rno] == output_get_value(rg))
	{
		// Not moved, no need to update.
	}
	else
	{
		reelpos[rno] = stepper_get_position(rno)%(stepper_get_max(rno)-1);
		for ( m = 0; m < (rsymbols-1); m++ )
		{
			{
				sprintf(rga,"reel%da%d", x, m);
				output_set_value(rga,(reelpos[rno] + rsteps * m)%stepper_get_max(rno));
			}

			{
				if ((reelpos[rno] - rsteps * m) < 0)
				{
					sprintf(rgb,"reel%db%d", x, m);
					output_set_value(rgb,(reelpos[rno] - (rsteps * m - stepper_get_max(rno))));
				}
				else
				{
					sprintf(rgb,"reel%db%d", x, m);
					output_set_value(rgb,(reelpos[rno] - rsteps * m));
				}
			}
		}
		output_set_value(rg,(reelpos[rno]));
	}
}