亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? listing1.cpp

?? 很好游戲代碼
?? CPP
字號:
/* Copyright (C) Tom Scutt and Core Design Ltd, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Tom Scutt and Core Design Ltd, 2001"
 */

// Swarm update. (Code reproduced by kind permission of Core Design Ltd.)

void UpdateAgents()
{
	AGENT_STRUCT	*agent;
	long	h, i, angle, dx, dy, dz, oldx, oldy, oldz;

	agent = &agents[0];

	for (i=0;i<MAX_AGENTS;i++,agent++)
	{
		//for each agent, check to see if it's active 
		if (agent->active)
		{
			//remember its current position
			oldx = agent->xpos;
			oldy = agent->ypos;
			oldz = agent->zpos;

			//update x and z pos depending on y-rotation and speed
			agent->xpos += agent->speed * SIN(agent->yrot);
			agent->zpos += agent->speed * COS(agent->yrot);

			//update y depending on fallspeed
			agent->ypos += agent->fallspeed;

			//update fallspeed by adding gravity
			agent->fallspeed += GRAVITY;

			//calculate the difference between the agent's 
			//position and the target position 
			dz = target->zpos - agent->zpos;
			dy = target->ypos - agent->ypos;
			dx = target->xpos - agent->xpos;

			//work out the *relative* angle of the target to the agent
			//if it's time for the agent to flee, reverse the angle
			//It's a good idea to initialize agents with the timer 
			//set to a small random value. That way, the swarm will 
			//gradually disperse over time.
			if (agent->timer < (RAT_LIFE_TIME - RAT_FLEE_TIME))
				angle = ATAN(dz, dx) - agent->yrot;
			else 
				angle = agent->yrot - ATAN(dz, dx);

			//It wasn't done here, but one could influence 
			//the swarm depending on the way the player is facing.
			//One could also extrapolate player movement to set up the 
			//player's likely future position as the target

			//Hit the player if within range 
			//(using your favored collision method)
			//Here: a simple collision box.
			if (abs(dz) < AGENT_HIT_RANGE && abs(dy) < AGENT_HIT_RANGE 
				&& abs(dx) < AGENT_HIT_RANGE)
				{target->hp-=AGENT_DAMAGE;}

			if (!agent->falling) 
			// steer because not the agent is not falling 
			{
				//if the target is outside your set range, 
				//go (roughly) towards it
				if (abs(dz) + abs(dx) > SWARM_RANGE) 
				{
					//increase speed to the maximum for this creature
					//give each creature a slightly different maximum
					//(done here by & the index with 0x1f)

					if (agent->speed < 24 + (i & 0x1f))
						agent->speed++;

					if (abs(angle) < AGENT_LOCK_ANGLE)
					{
						//vary the steering each cycle - more organic
						agent->yrot += (global_counter - i) << 3;
					}
					else if (angle < 0)
						agent->yrot -= AGENT_TURN_SPEED<<1;
					else
						agent->yrot += AGENT_TURN_SPEED<<1;
				}
				else
				//if the target is roughly within a short range, 
				//swirl around it
				{
					if (agent->speed & 0x1)
						agent->yrot += AGENT_TURN_SPEED;
					else
						agent->yrot -= AGENT_TURN_SPEED;

					//play around with the numbers in this next line 
					//to get a variety of different behaviors
					agent->speed = 48 - (abs(angle) >> 10);

				}
			}
			//end of steering

			h = FloorHeight(agent->x_pos,agent->y_pos,agent->z_pos);
			if (h < agent->ypos - AGENT_MAX_STEP)
			//If the agent's new position would be much higher 
			//than its current position, bounce it off the wall 
			//by resetting its position and changing its angle
			{
				//if the agent hits a wall while it's fleeing, 
				//deactivate it. This looks fine with small creatures
				if (agent->timer > (AGENT_LIFE_TIME - AGENT_FLEE_TIME))
					agent->active = 0;

				if (angle > 0)
					agent->yrot += 180_DEGREES;
				else
					agent->yrot -= 180_DEGREES;
				agent->xpos = oldx;
				agent->ypos = oldy;
				agent->zpos = oldz;
				agent->fallspeed = 0;
			}
			//If the agent's new position would take it onto a 
			//block of climbable height, angle its body upward,
			//reset its x and z position and move it upwards
			else if (h < agent->ypos - AGENT_IGNORE_STEP)
			{
				fx->pos.x_rot = AGENT_CLIMB_ANGLE;
				fx->pos.x_pos = oldx;
				fx->pos.y_pos = oldy - AGENT_CLIMB_SPEED;
				fx->pos.z_pos = oldz;
				fx->fallspeed = 0;
			}
     		else if (agent->ypos > h)
			//the agent is below the floor surface, so move it up to //the floor, reset its fallspeed and set falling to 0. //This happens every cycle the agent isn't in the air //(as we always try to change the y-pos due to gravity)
			{
				agent->ypos = h;
				agent->fallspeed = 0;
				agent->falling = 0;
			}

			if (agent->fallspeed < AGENT_MAX_FALLSPEED && 
				agent->timer < AGENT_LIFE_TIME)
			//tilt things as they fall
				agent->xrot = -(agent->fallspeed << 6);
			else
			//if they fall too fast or time's run out, kill them
				next_agent = agent->active = 0;

			agent->timer++;

		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合给合久久狠狠狠97色69| 一区二区三区中文字幕| 在线观看三级视频欧美| 99精品欧美一区二区三区小说| 国产精品一级片| 国产成人免费在线视频| 粉嫩嫩av羞羞动漫久久久| 国产精品一区在线| 成人av在线一区二区| 成人动漫视频在线| 99精品欧美一区二区三区小说| 99re视频精品| 欧美日韩精品欧美日韩精品一综合| 欧美日韩高清一区二区三区| 777亚洲妇女| 久久视频一区二区| 亚洲视频每日更新| 午夜激情一区二区| 久久99国产精品久久| 国产激情精品久久久第一区二区| 粉嫩13p一区二区三区| www.欧美亚洲| 6080午夜不卡| 国产欧美日韩综合| 国产精品久久久久久久久久久免费看 | 国产99精品国产| 一本大道久久a久久精二百| 欧美性视频一区二区三区| 日韩欧美一级片| 国产精品久久久久久福利一牛影视 | 国产在线播放一区三区四| 成人av一区二区三区| 欧美性高清videossexo| 久久综合九色综合97婷婷女人| 亚洲视频在线一区二区| 日韩一区精品视频| eeuss鲁片一区二区三区在线观看| 91天堂素人约啪| 日韩欧美美女一区二区三区| 中文字幕日韩一区二区| 日本不卡中文字幕| 色婷婷狠狠综合| 久久中文娱乐网| 亚洲成人在线观看视频| 成人激情午夜影院| 91精品国产一区二区人妖| 日本一区二区三级电影在线观看 | 日韩欧美一卡二卡| 一区二区三区小说| 国产盗摄精品一区二区三区在线| 欧美午夜精品电影| 综合久久综合久久| 国产在线视频不卡二| 91精品国产综合久久精品| 亚洲欧美日韩精品久久久久| 国产麻豆视频一区| 久久亚洲影视婷婷| 久久av资源网| 欧美一区二区三区影视| 亚洲va中文字幕| 91麻豆6部合集magnet| 中文字幕一区二区不卡| 国产精品一区二区在线看| 精品国产一区二区三区不卡| 日韩不卡一区二区三区| 欧美日韩和欧美的一区二区| 亚洲欧美电影一区二区| 成人18视频在线播放| 久久免费精品国产久精品久久久久| 婷婷综合久久一区二区三区| 色狠狠桃花综合| 一区二区三区精品视频在线| 国模少妇一区二区三区| 2017欧美狠狠色| 国产成人av一区二区| 日本一区二区视频在线| 成人一级片在线观看| 国产日本一区二区| 成人午夜电影网站| 国产精品久久午夜夜伦鲁鲁| 国产成人精品一区二区三区四区 | 国产精品一区二区果冻传媒| 精品精品国产高清a毛片牛牛| 久久爱www久久做| 国产亚洲一本大道中文在线| 国产成人啪午夜精品网站男同| 国产亚洲欧美一区在线观看| 国产不卡视频在线观看| 国产精品国产三级国产a| 92国产精品观看| 视频在线观看91| 精品久久久影院| eeuss国产一区二区三区| 亚洲精品欧美二区三区中文字幕| 欧美性感一区二区三区| 久久国产精品99久久久久久老狼| 久久久久久久久久久99999| 91在线免费视频观看| 一区二区三区成人| 欧美一级精品大片| 国产精品综合二区| 亚洲精品成人天堂一二三| 91麻豆精品国产91久久久更新时间| 另类小说图片综合网| 国产喂奶挤奶一区二区三区| 色综合久久中文字幕综合网| 亚洲成人av电影在线| 久久久国际精品| 欧美性大战久久| 国产成人午夜精品5599| 亚洲午夜久久久久久久久电影网 | 亚洲人成在线播放网站岛国| 欧美日韩一级大片网址| 成人精品高清在线| 日本女人一区二区三区| 亚洲婷婷综合久久一本伊一区| 欧美日韩国产综合一区二区三区| 国产成人午夜高潮毛片| 日本 国产 欧美色综合| 中文字幕欧美一| 久久综合色婷婷| 欧美吻胸吃奶大尺度电影| 国产成人在线视频播放| 老司机精品视频导航| 亚洲黄色av一区| 中文一区一区三区高中清不卡| 91精品国产一区二区三区香蕉| 99久久婷婷国产| 国产盗摄一区二区三区| 日本不卡视频一二三区| 亚洲综合视频网| 综合av第一页| 国产精品三级电影| 久久精品在线免费观看| 欧美一级欧美三级| 欧美午夜精品一区二区蜜桃| 99精品一区二区| 99国产精品久久久久久久久久| 国产大陆精品国产| 国产高清不卡一区| 国产黄色精品视频| 国产精品资源网| 国产乱子轮精品视频| 麻豆成人综合网| 久久99国内精品| 韩国理伦片一区二区三区在线播放 | 一本大道久久a久久综合婷婷| 国产suv精品一区二区三区| 国产揄拍国内精品对白| 国产永久精品大片wwwapp| 国产又粗又猛又爽又黄91精品| 久久成人综合网| 国产麻豆成人精品| 国产99久久久国产精品免费看| 国产白丝精品91爽爽久久| 国产suv精品一区二区三区| 丁香婷婷综合色啪| a在线欧美一区| 91九色02白丝porn| 在线观看一区日韩| 欧美精品18+| 精品少妇一区二区三区| 国产日韩欧美高清| 综合激情成人伊人| 五月婷婷色综合| 久久精品国产一区二区三区免费看| 美女在线视频一区| 国产一区二区免费在线| jlzzjlzz国产精品久久| 欧美日韩综合在线| 精品国产免费人成电影在线观看四季 | 亚洲成在人线在线播放| 一区二区三区电影在线播| 日韩精品乱码av一区二区| 奇米影视7777精品一区二区| 国产一区二区在线观看视频| 高清av一区二区| 欧美性色欧美a在线播放| 日韩西西人体444www| 亚洲国产经典视频| 亚洲综合免费观看高清在线观看| 日韩精品1区2区3区| 国产成人在线电影| 欧美亚洲国产bt| 精品国产三级a在线观看| 亚洲色图视频网| 乱一区二区av| 色综合网站在线| 精品国精品国产| 亚洲高清免费在线| 国产suv一区二区三区88区| 欧美在线免费播放| 国产欧美日本一区二区三区| 午夜一区二区三区在线观看| 国产一区欧美日韩| 欧美日韩的一区二区| 国产精品色婷婷| 麻豆freexxxx性91精品| 在线观看免费视频综合| 国产欧美一区二区三区鸳鸯浴 |