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

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

?? g_phys.c

?? 著名游戲quake2原代碼最新版本(vc6.0可以編譯的)
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
// g_phys.c

#include "g_local.h"

/*


pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move.

onground is set for toss objects when they come to a complete rest.  it is set for steping or walking objects 

doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH
bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS
corpses are SOLID_NOT and MOVETYPE_TOSS
crates are SOLID_BBOX and MOVETYPE_TOSS
walking monsters are SOLID_SLIDEBOX and MOVETYPE_STEP
flying/floating monsters are SOLID_SLIDEBOX and MOVETYPE_FLY

solid_edge items only clip against bsp models.

*/


/*
============
SV_TestEntityPosition

============
*/
edict_t	*SV_TestEntityPosition (edict_t *ent)
{
	trace_t	trace;
	int		mask;

	if (ent->clipmask)
		mask = ent->clipmask;
	else
		mask = MASK_SOLID;
	trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, ent->s.origin, ent, mask);
	
	if (trace.startsolid)
		return g_edicts;
		
	return NULL;
}


/*
================
SV_CheckVelocity
================
*/
void SV_CheckVelocity (edict_t *ent)
{
	int		i;

//
// bound velocity
//
	for (i=0 ; i<3 ; i++)
	{
		if (ent->velocity[i] > sv_maxvelocity->value)
			ent->velocity[i] = sv_maxvelocity->value;
		else if (ent->velocity[i] < -sv_maxvelocity->value)
			ent->velocity[i] = -sv_maxvelocity->value;
	}
}

/*
=============
SV_RunThink

Runs thinking code for this frame if necessary
=============
*/
qboolean SV_RunThink (edict_t *ent)
{
	float	thinktime;

	thinktime = ent->nextthink;
	if (thinktime <= 0)
		return true;
	if (thinktime > level.time+0.001)
		return true;
	
	ent->nextthink = 0;
	if (!ent->think)
		gi.error ("NULL ent->think");
	ent->think (ent);

	return false;
}

/*
==================
SV_Impact

Two entities have touched, so run their touch functions
==================
*/
void SV_Impact (edict_t *e1, trace_t *trace)
{
	edict_t		*e2;
//	cplane_t	backplane;

	e2 = trace->ent;

	if (e1->touch && e1->solid != SOLID_NOT)
		e1->touch (e1, e2, &trace->plane, trace->surface);
	
	if (e2->touch && e2->solid != SOLID_NOT)
		e2->touch (e2, e1, NULL, NULL);
}


/*
==================
ClipVelocity

Slide off of the impacting object
returns the blocked flags (1 = floor, 2 = step / wall)
==================
*/
#define	STOP_EPSILON	0.1

int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
{
	float	backoff;
	float	change;
	int		i, blocked;
	
	blocked = 0;
	if (normal[2] > 0)
		blocked |= 1;		// floor
	if (!normal[2])
		blocked |= 2;		// step
	
	backoff = DotProduct (in, normal) * overbounce;

	for (i=0 ; i<3 ; i++)
	{
		change = normal[i]*backoff;
		out[i] = in[i] - change;
		if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
			out[i] = 0;
	}

	return blocked;
}


/*
============
SV_FlyMove

The basic solid body movement clip that slides along multiple planes
Returns the clipflags if the velocity was modified (hit something solid)
1 = floor
2 = wall / step
4 = dead stop
============
*/
#define	MAX_CLIP_PLANES	5
int SV_FlyMove (edict_t *ent, float time, int mask)
{
	edict_t		*hit;
	int			bumpcount, numbumps;
	vec3_t		dir;
	float		d;
	int			numplanes;
	vec3_t		planes[MAX_CLIP_PLANES];
	vec3_t		primal_velocity, original_velocity, new_velocity;
	int			i, j;
	trace_t		trace;
	vec3_t		end;
	float		time_left;
	int			blocked;
	
	numbumps = 4;
	
	blocked = 0;
	VectorCopy (ent->velocity, original_velocity);
	VectorCopy (ent->velocity, primal_velocity);
	numplanes = 0;
	
	time_left = time;

	ent->groundentity = NULL;
	for (bumpcount=0 ; bumpcount<numbumps ; bumpcount++)
	{
		for (i=0 ; i<3 ; i++)
			end[i] = ent->s.origin[i] + time_left * ent->velocity[i];

		trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, end, ent, mask);

		if (trace.allsolid)
		{	// entity is trapped in another solid
			VectorCopy (vec3_origin, ent->velocity);
			return 3;
		}

		if (trace.fraction > 0)
		{	// actually covered some distance
			VectorCopy (trace.endpos, ent->s.origin);
			VectorCopy (ent->velocity, original_velocity);
			numplanes = 0;
		}

		if (trace.fraction == 1)
			 break;		// moved the entire distance

		hit = trace.ent;

		if (trace.plane.normal[2] > 0.7)
		{
			blocked |= 1;		// floor
			if ( hit->solid == SOLID_BSP)
			{
				ent->groundentity = hit;
				ent->groundentity_linkcount = hit->linkcount;
			}
		}
		if (!trace.plane.normal[2])
		{
			blocked |= 2;		// step
		}

//
// run the impact function
//
		SV_Impact (ent, &trace);
		if (!ent->inuse)
			break;		// removed by the impact function

		
		time_left -= time_left * trace.fraction;
		
	// cliped to another plane
		if (numplanes >= MAX_CLIP_PLANES)
		{	// this shouldn't really happen
			VectorCopy (vec3_origin, ent->velocity);
			return 3;
		}

		VectorCopy (trace.plane.normal, planes[numplanes]);
		numplanes++;

//
// modify original_velocity so it parallels all of the clip planes
//
		for (i=0 ; i<numplanes ; i++)
		{
			ClipVelocity (original_velocity, planes[i], new_velocity, 1);

			for (j=0 ; j<numplanes ; j++)
				if ((j != i) && !VectorCompare (planes[i], planes[j]))
				{
					if (DotProduct (new_velocity, planes[j]) < 0)
						break;	// not ok
				}
			if (j == numplanes)
				break;
		}
		
		if (i != numplanes)
		{	// go along this plane
			VectorCopy (new_velocity, ent->velocity);
		}
		else
		{	// go along the crease
			if (numplanes != 2)
			{
//				gi.dprintf ("clip velocity, numplanes == %i\n",numplanes);
				VectorCopy (vec3_origin, ent->velocity);
				return 7;
			}
			CrossProduct (planes[0], planes[1], dir);
			d = DotProduct (dir, ent->velocity);
			VectorScale (dir, d, ent->velocity);
		}

//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
		if (DotProduct (ent->velocity, primal_velocity) <= 0)
		{
			VectorCopy (vec3_origin, ent->velocity);
			return blocked;
		}
	}

	return blocked;
}


/*
============
SV_AddGravity

============
*/
void SV_AddGravity (edict_t *ent)
{
	ent->velocity[2] -= ent->gravity * sv_gravity->value * FRAMETIME;
}

/*
===============================================================================

PUSHMOVE

===============================================================================
*/

/*
============
SV_PushEntity

Does not change the entities velocity at all
============
*/
trace_t SV_PushEntity (edict_t *ent, vec3_t push)
{
	trace_t	trace;
	vec3_t	start;
	vec3_t	end;
	int		mask;

	VectorCopy (ent->s.origin, start);
	VectorAdd (start, push, end);

retry:
	if (ent->clipmask)
		mask = ent->clipmask;
	else
		mask = MASK_SOLID;

	trace = gi.trace (start, ent->mins, ent->maxs, end, ent, mask);
	
	VectorCopy (trace.endpos, ent->s.origin);
	gi.linkentity (ent);

	if (trace.fraction != 1.0)
	{
		SV_Impact (ent, &trace);

		// if the pushed entity went away and the pusher is still there
		if (!trace.ent->inuse && ent->inuse)
		{
			// move the pusher back and try again
			VectorCopy (start, ent->s.origin);
			gi.linkentity (ent);
			goto retry;
		}
	}

	if (ent->inuse)
		G_TouchTriggers (ent);

	return trace;
}					


typedef struct
{
	edict_t	*ent;
	vec3_t	origin;
	vec3_t	angles;
	float	deltayaw;
} pushed_t;
pushed_t	pushed[MAX_EDICTS], *pushed_p;

edict_t	*obstacle;

/*
============
SV_Push

Objects need to be moved back on a failed push,
otherwise riders would continue to slide.
============
*/
qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
{
	int			i, e;
	edict_t		*check, *block;
	vec3_t		mins, maxs;
	pushed_t	*p;
	vec3_t		org, org2, move2, forward, right, up;

	// clamp the move to 1/8 units, so the position will
	// be accurate for client side prediction
	for (i=0 ; i<3 ; i++)
	{
		float	temp;
		temp = move[i]*8.0;
		if (temp > 0.0)
			temp += 0.5;
		else
			temp -= 0.5;
		move[i] = 0.125 * (int)temp;
	}

	// find the bounding box
	for (i=0 ; i<3 ; i++)
	{
		mins[i] = pusher->absmin[i] + move[i];
		maxs[i] = pusher->absmax[i] + move[i];
	}

// we need this for pushing things later
	VectorSubtract (vec3_origin, amove, org);
	AngleVectors (org, forward, right, up);

// save the pusher's original position
	pushed_p->ent = pusher;
	VectorCopy (pusher->s.origin, pushed_p->origin);
	VectorCopy (pusher->s.angles, pushed_p->angles);
	if (pusher->client)
		pushed_p->deltayaw = pusher->client->ps.pmove.delta_angles[YAW];
	pushed_p++;

// move the pusher to it's final position
	VectorAdd (pusher->s.origin, move, pusher->s.origin);
	VectorAdd (pusher->s.angles, amove, pusher->s.angles);
	gi.linkentity (pusher);

// see if any solid entities are inside the final position
	check = g_edicts+1;
	for (e = 1; e < globals.num_edicts; e++, check++)
	{
		if (!check->inuse)
			continue;
		if (check->movetype == MOVETYPE_PUSH
		|| check->movetype == MOVETYPE_STOP
		|| check->movetype == MOVETYPE_NONE
		|| check->movetype == MOVETYPE_NOCLIP)
			continue;

		if (!check->area.prev)
			continue;		// not linked in anywhere

	// if the entity is standing on the pusher, it will definitely be moved
		if (check->groundentity != pusher)
		{
			// see if the ent needs to be tested
			if ( check->absmin[0] >= maxs[0]
			|| check->absmin[1] >= maxs[1]
			|| check->absmin[2] >= maxs[2]
			|| check->absmax[0] <= mins[0]
			|| check->absmax[1] <= mins[1]
			|| check->absmax[2] <= mins[2] )
				continue;

			// see if the ent's bbox is inside the pusher's final position
			if (!SV_TestEntityPosition (check))
				continue;
		}

		if ((pusher->movetype == MOVETYPE_PUSH) || (check->groundentity == pusher))
		{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区中文在线| 亚洲欧洲99久久| 丁香婷婷综合激情五月色| 国产精品久久久久久久午夜片| 91麻豆免费观看| 亚洲成人www| 亚洲同性gay激情无套| 91精品国产综合久久福利软件| 粗大黑人巨茎大战欧美成人| 亚洲高清不卡在线观看| 久久一日本道色综合| 国产精品自拍网站| 亚洲午夜电影网| 欧美激情一区二区三区不卡| 91麻豆精品91久久久久同性| 丰满少妇久久久久久久| 精品在线亚洲视频| 亚洲一区二区视频| 欧美极品美女视频| 日韩视频永久免费| 欧美日本一区二区三区四区| 日本电影亚洲天堂一区| 国产一区二区剧情av在线| 天堂久久一区二区三区| 一区二区三区精品视频在线| 欧美性生活大片视频| 国产乱国产乱300精品| 精品一区二区成人精品| 国产美女在线精品| 国产成+人+日韩+欧美+亚洲| 成人av动漫网站| 99久久99久久精品免费看蜜桃| 国产91高潮流白浆在线麻豆| 岛国精品在线观看| 色94色欧美sute亚洲13| 制服丝袜av成人在线看| 26uuu精品一区二区三区四区在线| 久久日韩粉嫩一区二区三区| 国产精品美女视频| 亚洲动漫第一页| 国产在线播放一区二区三区 | 久久精品人人做人人综合| 精品国产一区二区三区忘忧草| 26uuu亚洲| 婷婷综合另类小说色区| 国产一区二区在线观看免费| 成人一区二区视频| 日韩精品自拍偷拍| 亚洲五码中文字幕| 成人免费av资源| 欧美成人福利视频| 亚洲国产精品自拍| 成人av电影在线观看| 99在线热播精品免费| 欧美一卡2卡3卡4卡| 一区二区三区在线免费观看| 国产精品一区二区男女羞羞无遮挡 | 国产在线视频不卡二| 欧美日韩激情在线| 亚洲精品日产精品乱码不卡| 成人综合在线网站| 日本一区二区高清| 成人伦理片在线| 久久久精品tv| 成人一区二区三区在线观看| 国产欧美日韩精品在线| 国产精品77777| 国产精品麻豆一区二区| 99国产欧美另类久久久精品 | 日韩精品一区二区三区四区视频| 国产一区91精品张津瑜| 久久久久久久久久电影| 波多野结衣中文字幕一区 | 色综合中文字幕国产| 日韩精品专区在线影院重磅| 日韩vs国产vs欧美| 日韩欧美一二三区| 男男gaygay亚洲| 久久免费视频色| 成人黄色在线看| 亚洲一区电影777| 日韩精品中文字幕一区| 99久久精品国产精品久久| 亚洲综合色成人| 日韩免费成人网| 99国产精品视频免费观看| 亚洲激情五月婷婷| 日韩欧美久久久| 成a人片亚洲日本久久| 亚洲综合另类小说| 一本色道久久综合亚洲91| 午夜婷婷国产麻豆精品| 国产精品素人一区二区| 欧美肥胖老妇做爰| 91在线看国产| 国产99精品国产| 亚洲国产日韩综合久久精品| 久久久激情视频| 精品国产污污免费网站入口| 91麻豆高清视频| 国产精品资源网| 精品一区二区三区久久| 性欧美大战久久久久久久久| 亚洲嫩草精品久久| 最近中文字幕一区二区三区| 国产欧美日韩在线| 久久久激情视频| 国产精品国产馆在线真实露脸 | 精品系列免费在线观看| 亚洲啪啪综合av一区二区三区| 欧美一区二区女人| 成人av免费观看| 成人免费视频app| 色婷婷av一区二区三区软件| 色综合久久久久综合99| 色先锋资源久久综合| 欧美亚洲尤物久久| 在线不卡a资源高清| 欧美一区二区在线免费观看| 91精品国产综合久久香蕉的特点 | 久久99精品久久久久久 | 国产成人精品影视| 91福利小视频| 日韩一区二区三区视频在线观看| 日韩一区二区麻豆国产| 精品国产免费一区二区三区香蕉| 中文天堂在线一区| 肉丝袜脚交视频一区二区| 国产一区二区不卡在线| 国产综合久久久久影院| 色欧美乱欧美15图片| 日韩亚洲欧美综合| 亚洲激情图片一区| 精品一区二区三区在线播放视频| 国产精品综合在线视频| 99精品热视频| 日韩精品一区二区在线观看| 国产精品另类一区| 舔着乳尖日韩一区| 91在线无精精品入口| 久久免费看少妇高潮| 日韩av高清在线观看| 91福利资源站| 亚洲欧洲av在线| 国产精品一二三区| 欧美大片一区二区三区| 亚洲成人免费看| 欧美高清视频www夜色资源网| 国产精品色一区二区三区| 国产盗摄一区二区三区| 国产亚洲精品精华液| 狠狠色综合色综合网络| 欧美日韩一区二区在线观看视频| 国产精品嫩草久久久久| 99re热视频这里只精品| 亚洲欧美中日韩| 91视频91自| 亚洲成人你懂的| 91精品国产综合久久香蕉麻豆| 一区二区高清在线| 欧美少妇一区二区| 老司机免费视频一区二区三区| 91精品国产色综合久久不卡电影 | 久久久亚洲精华液精华液精华液| 国产精品91xxx| 亚洲欧美偷拍另类a∨色屁股| 国产成人欧美日韩在线电影| 国产精品国产a级| 欧美一区二区三区视频| 久久精品国产亚洲高清剧情介绍| 欧美一卡二卡在线| 成人av电影免费观看| 亚洲成人你懂的| 在线观看网站黄不卡| 九色porny丨国产精品| 一区二区三区小说| 久久久精品综合| 欧美人妖巨大在线| av中文字幕一区| 久久99国产精品久久| 亚洲欧美日本在线| 久久麻豆一区二区| 日韩欧美中文字幕一区| 一本到高清视频免费精品| 国产成都精品91一区二区三| 毛片一区二区三区| 亚洲va欧美va天堂v国产综合| 国产精品久久久久久久久免费桃花| 欧美高清hd18日本| 日本乱人伦aⅴ精品| 97久久超碰国产精品电影| 国产精品一区二区你懂的| 日本亚洲最大的色成网站www| 国产精品欧美一区二区三区| 精品久久久久久综合日本欧美| 欧美日韩五月天| 欧美精品在线视频| 欧美精品v日韩精品v韩国精品v| 成人午夜免费电影| 国产一区二区三区久久久|