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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? g_phys.c

?? 著名游戲quake2原代碼最新版本(vc6.0可以編譯的)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/*
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))
		{

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一区在线观看| 欧美色图在线观看| 国产亚洲自拍一区| 国产综合色视频| 国产精品日日摸夜夜摸av| 99精品欧美一区二区三区小说| 国产精品女人毛片| 91福利精品第一导航| 午夜在线电影亚洲一区| 欧美一级久久久| 国产一区美女在线| 亚洲国产精品成人综合色在线婷婷| 不卡视频一二三四| 亚洲国产精品一区二区久久恐怖片| 欧美一区二区三区思思人| 国产成人欧美日韩在线电影| 亚洲欧美另类小说视频| 3d动漫精品啪啪1区2区免费| 国产一区二区三区美女| 一色屋精品亚洲香蕉网站| 欧美日韩国产系列| 国产一区二区久久| 一区二区三区小说| 日韩欧美你懂的| 96av麻豆蜜桃一区二区| 婷婷丁香久久五月婷婷| 国产欧美一区二区精品婷婷| 91国产精品成人| 国产精品夜夜嗨| 无吗不卡中文字幕| 国产精品网友自拍| 在线成人av影院| 波多野结衣在线aⅴ中文字幕不卡| 亚洲国产综合色| 中文字幕亚洲电影| 日韩精品一区二区三区中文精品| 成人黄色片在线观看| 美国毛片一区二区| 国产精品国产自产拍在线| 欧美日韩精品免费| av电影一区二区| 亚洲五月六月丁香激情| 久久综合成人精品亚洲另类欧美 | 精品一区二区影视| 一区二区三区欧美视频| 日韩三级精品电影久久久| 91蜜桃婷婷狠狠久久综合9色| 蜜臀久久久99精品久久久久久| 亚洲丝袜美腿综合| 中文字幕国产一区| 欧美大片拔萝卜| 欧美巨大另类极品videosbest | 国产人成亚洲第一网站在线播放| 欧美伦理电影网| 在线观看视频一区二区欧美日韩| 国产91精品入口| 激情另类小说区图片区视频区| 亚洲影院理伦片| 亚洲精品水蜜桃| 亚洲欧洲日本在线| 国产精品久久久久桃色tv| 久久综合资源网| 日韩免费视频一区| 欧美一级免费大片| 欧美电影在线免费观看| 91麻豆精东视频| 99久久久久久| av不卡一区二区三区| 成人听书哪个软件好| 高清不卡在线观看| 懂色一区二区三区免费观看| 精品综合免费视频观看| 免费在线观看不卡| 首页国产欧美久久| 蜜臀va亚洲va欧美va天堂| 亚洲成a人在线观看| 午夜伦欧美伦电影理论片| 亚洲国产中文字幕| 亚洲 欧美综合在线网络| 一级女性全黄久久生活片免费| **欧美大码日韩| 一区二区三区成人| 亚洲一区二区三区国产| 久国产精品韩国三级视频| 久久99国产精品久久99| 国产精品一区二区在线观看网站| 国产在线国偷精品产拍免费yy| 国产剧情在线观看一区二区| 国产成人精品三级| 成人黄色av电影| 日本福利一区二区| 欧美精品一级二级| 欧美大片在线观看| 久久蜜桃av一区二区天堂| 欧美国产日韩亚洲一区| 亚洲精品伦理在线| 午夜av一区二区三区| 丝袜美腿亚洲综合| 国产综合色精品一区二区三区| 成人自拍视频在线| 欧美午夜免费电影| 日韩精品中文字幕在线一区| 久久久噜噜噜久噜久久综合| 日韩理论在线观看| 日韩av一区二区在线影视| 国产在线精品免费| 色呦呦国产精品| 欧美一级理论片| 中文字幕一区二区三区蜜月| 亚洲午夜精品一区二区三区他趣| 日本免费在线视频不卡一不卡二| 麻豆精品在线看| 99精品桃花视频在线观看| 欧美一级淫片007| 国产精品国产精品国产专区不片| 一区二区久久久| 国产一区 二区 三区一级| 一本到不卡精品视频在线观看| 欧美一级午夜免费电影| 一区在线观看免费| 免费在线看成人av| 一本大道av一区二区在线播放| 欧美一区二视频| 综合欧美一区二区三区| 激情偷乱视频一区二区三区| 欧美性生活久久| 欧美经典一区二区| 奇米888四色在线精品| 99久久夜色精品国产网站| 精品美女一区二区三区| 亚洲激情综合网| 国产jizzjizz一区二区| 欧美一区二区在线不卡| 亚洲综合网站在线观看| 丁香天五香天堂综合| 日韩午夜三级在线| 亚洲国产精品一区二区久久恐怖片 | 久久这里只有精品首页| 亚洲成人黄色小说| 日本韩国欧美三级| 国产精品三级久久久久三级| 激情五月婷婷综合| 欧美一区二区高清| 亚洲国产精品尤物yw在线观看| jlzzjlzz欧美大全| 国产欧美1区2区3区| 紧缚捆绑精品一区二区| 欧美放荡的少妇| 亚洲无线码一区二区三区| 91麻豆精品在线观看| 国产精品日韩成人| 福利电影一区二区| 国产三级欧美三级日产三级99| 蜜桃av一区二区| 67194成人在线观看| 亚洲6080在线| 欧美日韩国产首页| 亚洲成人av在线电影| 欧洲精品一区二区三区在线观看| 中文字幕在线播放不卡一区| 成人理论电影网| 中国色在线观看另类| 国产a精品视频| 国产精品网站一区| 成人av免费在线播放| 中文字幕色av一区二区三区| 国产·精品毛片| 国产精品不卡在线观看| 99久久99精品久久久久久| 国产精品热久久久久夜色精品三区| 国产成人精品综合在线观看 | 国产成人啪午夜精品网站男同| 久久婷婷久久一区二区三区| 国模套图日韩精品一区二区| 2019国产精品| 成人ar影院免费观看视频| 亚洲人成影院在线观看| 在线免费精品视频| 亚洲bt欧美bt精品| 欧美一卡二卡在线观看| 激情深爱一区二区| 国产精品成人午夜| 91丝袜美腿高跟国产极品老师 | 色视频一区二区| 亚洲国产精品一区二区久久| 制服丝袜激情欧洲亚洲| 久久99久久久久久久久久久| 久久女同精品一区二区| 99免费精品在线观看| 性感美女久久精品| www成人在线观看| av网站一区二区三区| 一区二区三区在线观看视频| 制服丝袜中文字幕一区| 韩国成人精品a∨在线观看| 国产精品国产自产拍高清av| 日本韩国精品一区二区在线观看| 日本v片在线高清不卡在线观看| 精品成人在线观看| 91色婷婷久久久久合中文|