Пример #1
0
void takeDrug()
{
	randNum = randw()%30; /* Random number modulo 30 is to dertermine fatality */
	drug = randNum%NUMDRUGS; /* Random number modulo 5 (current num of drugs) to dertermine which drug */
	name = drugName[drug]; /* String representing the name of current drug */
	/* Dertermine fatality based on what drug is choosen */
	switch(drug)
	{
		case 0: /* Weed is never fatal */
			fatal = 0;
			break;
		case 1: /* Legals have a 1/30 chance of fatal */
			fatal = (randNum == 5);
			break;
		case 2: /* Alcohol has a 2/30 chance of fatal */
			fatal = (randNum == 10 || randNum == 15);
			break;
		case 3: /* Amphetamine has a 3/30 chance of fatal */
			fatal = (randNum == 3 || randNum == 7 || randNum == 10);
			break;
		case 4: /* Shrooms also have 3/30 */
			fatal = (randNum == 5 || randNum ==9 || randNum == 1);
			break;
		default: /* Fail safe */
			fatal = 0;
			break;
	}
	/* If drug is fatal, inform player, and set mortality bit. Don't increment score */
	if(fatal)
	{ 
		printf("\n\nGOT SO MUNTED FROM\n%s\n",name);
		waitpad(J_A);
		printf("\nYOU WERE FOUND DEAD");
		waitpad(J_A);
		printf("\nIN A POOL OF PISS\n");
		dead=1;
	}
	/* If drug isn't fatal, update score and tell player */
	else 
	{
		++drugsTaken;
		munterPoints += drugPoints[drug];
		moneySpent += drugCost[drug];
		printf("\n\nMean you sussed\n%s\n",name);	
	}
	/* Display score */
	waitpad(J_A);
	printf("\nDrugs Taken:%d",drugsTaken);
	waitpad(J_A);
	printf("\nSpent:$%d ",moneySpent);
	waitpad(J_A);
	printf("\nPoints:%d",munterPoints);
	waitpad(J_A);

}
Пример #2
0
void initPipe() {
	//Setup
	i = PIPE_SPACE;
	pipe.x = 160;
	if(score < 5) {
		pipe.size = 5;
	} else if(score < 15) {
		pipe.size = 4;
	} else if(score < 40) {
		pipe.size = 3;
	} else  {
		pipe.size = 2;
	}
	pipe.gap = 1+(randw()%(7-pipe.size));
	
	pipe.top_y = (pipe.gap*16)+8;
	pipe.bottom_y = ((pipe.gap+pipe.size)*16)-8;
	
	pipe.counted = FALSE;
	
	//Top part
	for (y = 0; y < pipe.gap-1; y++) {
		set_sprite_tile(i, pipe_offset+2);
		set_sprite_tile(i+1, pipe_offset+6);
		set_sprite_tile(i+2, pipe_offset+10);
		
		set_sprite_prop(i, 0x00);
		set_sprite_prop(i+1, 0x00);
		set_sprite_prop(i+2, 0x00);
		
		i += 3;
	}
	
	//Top stop
	set_sprite_tile(i, pipe_offset);
	set_sprite_tile(i+1, pipe_offset+4);
	set_sprite_tile(i+2, pipe_offset+8);
	
	set_sprite_prop(i, S_FLIPY);
	set_sprite_prop(i+1, S_FLIPY);
	set_sprite_prop(i+2, S_FLIPY);
	
	i += 3;
	
	//Gap
	
	//Bottom stop
	set_sprite_tile(i, pipe_offset);
	set_sprite_tile(i+1, pipe_offset+4);
	set_sprite_tile(i+2, pipe_offset+8);
	
	set_sprite_prop(i, 0x00);
	set_sprite_prop(i+1, 0x00);
	set_sprite_prop(i+2, 0x00);
	i += 3;
	
	//Bottom part
	y += pipe.size+1;
	for (y; y < 7; y++) {
		set_sprite_tile(i, pipe_offset+2);
		set_sprite_tile(i+1, pipe_offset+6);
		set_sprite_tile(i+2, pipe_offset+10);
		
		set_sprite_prop(i, 0x00);
		set_sprite_prop(i+1, 0x00);
		set_sprite_prop(i+2, 0x00);
		i += 3;
	}
}