コード例 #1
0
bool BaseEnemy::CheckObstruct()
{
	int pxt = aio->player_input->GetXTilePos();
	unsigned char blkl;
	unsigned char blk;
	
	if(pxt < xtile)
	{
		for(int i=pxt; i <=xtile; i++)
		{
			blkl=aio->level_interface->GetLevelData(i, ytile-1);
			if(*(cblocks+blkl)) return true;
			blk = GetAIMapCord(i, ytile);
			if( blk == BLK_STOP || blk == BLK_STOPLEFT || blk == BLK_STOPRIGHT) return true;
		}
	}
	else
	{
		for(int i=xtile; i <=pxt; i++)
		{
			blkl=aio->level_interface->GetLevelData(i, ytile-1);
			if(*(cblocks+blkl)) return true;
			blk = GetAIMapCord(i, ytile);
			if( blk == BLK_STOP || blk == BLK_STOPLEFT || blk == BLK_STOPRIGHT) return true;
		}
	}

	return false;



}
コード例 #2
0
bool AIEnemyFlyingSentryA::IsStopBlock()
{
	unsigned char blk;
	unsigned char  tile;
	float vx, vy;
	
	
/*	if(aiinput->GetDirection())
		tile = aio->level_interface->GetLevelData(xtile+1, ytile);
	else
		tile = aio->level_interface->GetLevelData(xtile-1, ytile);*/


	
	
	aiinput->GetVelocityVector(&vx, &vy);
	if(vy < 0) 
	{

/*#ifdef _DEBUG
		char temp[512];
		sprintf(temp, "{AI}[sentryA] (vy:%f) (lyb:%d) (uyb:%d) (xt:%d) (yt:%d)", vy, aiinput->lower_patrol_y, aiinput->upper_patrol_y, xtile, ytile);
		OutputDebugString(temp);
#endif*/
		blk = GetAIMapCord(xtile, ytile - 1);
		if(blk == BLK_STOP) 
			return true;
		
		//if(use_patrol_bounds) if(ytile <= aiinput->upper_patrol_y) return true;
		
		//tile = aio->level_interface->GetLevelData(xtile, ytile-1);
	}
	else 
	{
		blk = GetAIMapCord(xtile, ytile + 1);
		if(blk == BLK_STOP) 
			return true;
		
		//if(use_patrol_bounds) if(ytile >= aiinput->lower_patrol_y) return true;
		//tile = aio->level_interface->GetLevelData(xtile, ytile+1);
	}

	//if(tile >= 1) return true;
	//else return false;
	return false;
//	unsigned char  tile;
	
//	float dx, dy;
//	aiinput->GetVelocityVector(&dx, &dy);

//	if(dy >= 0) tile = aio->level_interface->GetLevelData(xtile, ytile+1);
///	else tile = aio->level_interface->GetLevelData(xtile, ytile-1);
	
//	if(tile >= 1) return true;
//	else if(aiinput->GetYTilePos() >= aiinput->right_patrol_loc.y) return true;
//	else if(aiinput->GetYTilePos() <= aiinput->left_patrol_loc.y) return true;
//	else return false;
			
}
コード例 #3
0
bool AIEnemyFlyingSentryB::IsStopBlock()
{
/*	unsigned char  tile;
	
	if(aiinput->GetDirection())
		tile = aio->level_interface->GetLevelData(xtile+1, ytile);
	else
		tile = aio->level_interface->GetLevelData(xtile-1, ytile);
	
	
	if(tile >= 1) return true;
	else return false;*/

	unsigned char  tile;
	unsigned char  blk;// = GetAIMapCord(xtile, ytile);
	
//	float dx, dy;
//	aiinput->GetVelocityVector(&dx, &dy);

	if(aiinput->GetDirection()) 
	{
		if(use_patrol_bounds) if(xtile == aiinput->upper_patrol_x) return true;
		tile = aio->level_interface->GetLevelData(xtile+1, ytile-1);
		blk = GetAIMapCord(xtile+1, ytile);
	}
	else
	{
		if(use_patrol_bounds) if(xtile == aiinput->lower_patrol_x) return true;	
		tile = aio->level_interface->GetLevelData(xtile-1, ytile-1);
		blk = GetAIMapCord(xtile-1, ytile);
	}
	
	if(tile == 1) return true;
	
	if( aiinput->GetDirection()) if( (blk == BLK_STOP) || (blk == BLK_STOPRIGHT)) return true;
    if(!aiinput->GetDirection()) if( (blk == BLK_STOP) || (blk == BLK_STOPLEFT) ) return true;
	
	
	return false;
			
}
コード例 #4
0
bool AIEnemyAdvancedGeneticMonster2::IsStopBlock()
{
	int count=0;
	unsigned char blk= GetAIMapCord(xtile, ytile);
	unsigned char blkl;
	
	if(aiinput->GetDirection())
	{
		//check ai coding
		if( (blk == BLK_STOP) || (blk == BLK_STOPRIGHT)) return true;	
		if(use_patrol_bounds) if(xtile == aiinput->upper_patrol_x) return true;
		//check for blocks in the level in front of us
		
		for(count=0; count<=aiinput->GetTileHeight()+6; count++)
		{
			blkl=aio->level_interface->GetLevelData(xtile+3, ytile-count-1);
			if(*(cblocks+blkl)) return true;

//			if(count >=10) break;
		}
		
	}
	else
	{
		if( (blk == BLK_STOP) || (blk == BLK_STOPLEFT)) return true;
		if(use_patrol_bounds) if(xtile == aiinput->lower_patrol_x) return true;
		
		for(count=0; count<=aiinput->GetTileHeight()+6; count++)
		{
			
			blkl=aio->level_interface->GetLevelData(xtile-3, ytile-count-1);
			if(*(cblocks+blkl)) return true;

//			if(count >=10) break;
		}

	}

	return false;
}
コード例 #5
0
bool AIEnemyGMonster::IsStopBlock()
{

	int count=0;
	unsigned char blk;//= GetAIMapCord(xtile, ytile);
	unsigned char blkl;
	


	if(aiinput->GetDirection())
	{
		blk = GetAIMapCord(xtile + 1, ytile);
		//check ai coding
		if( (blk == BLK_STOP) || (blk == BLK_STOPRIGHT)) return true;	
	
		//check for blocks in the level in front of us
		
		/*
		for(count=0; count<aiinput->GetTileHeight(); count++)
		{
			blkl=aio->level_interface->GetLevelData(xtile+2, ytile-count-1);
			if(*(cblocks+blkl)) return true;

//			if(count >=10) break;
		}
		*/
		for (int i = 1; i <= 3; i++)
		{
			blk = aio->level_interface->GetLevelData(xtile + 1, ytile - i);
			if (blk != 0 &&
				blk != NONSIDEBASICBLOCK &&
				blk != CLIMBBLOCKLEFT &&
				blk != CLIMBBLOCKRIGHT &&
				blk != CLIMBLADDER &&
				blk != CLIMBROPE &&
				blk != SPAWNFLAG &&
				(blk < ENEMYFIRST || blk > ENEMYLAST)) return
				true;
		}
	}
	else
	{
		blk = GetAIMapCord(xtile - 1, ytile);
		if( (blk == BLK_STOP) || (blk == BLK_STOPLEFT)) return true;

		/*
		for(count=0; count<aiinput->GetTileHeight(); count++)
		{
			blkl=aio->level_interface->GetLevelData(xtile-2, ytile-count-1);
			if(*(cblocks+blkl)) return true;

//			if(count >=10) break;
		}*/
		
		for (int i = 1; i <= 3; i++)
		{
			blk = aio->level_interface->GetLevelData(xtile - 1, ytile - i);
			if (blk != 0 &&
				blk != NONSIDEBASICBLOCK &&
				blk != CLIMBBLOCKLEFT &&
				blk != CLIMBBLOCKRIGHT &&
				blk != CLIMBLADDER &&
				blk != CLIMBROPE &&
				blk != SPAWNFLAG &&
				(blk < ENEMYFIRST || blk > ENEMYLAST)) return true;
		}

	}

	return false;
}