⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 5 页
字号:
		o.<a href="qc-enty.htm#dot_map">map</a> = <a href="qc-glob.htm#mapname">mapname</a>;
	}

	<a href="client.htm#nextmap">nextmap</a> = o.<a href="qc-enty.htm#dot_map">map</a>;
	
	<b>if</b> (o.<a href="qc-enty.htm#dot_nextthink">nextthink</a> &lt; <a href="qc-glob.htm#time">time</a>)
	{
		o.<a href="qc-enty.htm#dot_think">think</a> = <a href="client.htm#execute_changelevel">execute_changelevel</a>;
		o.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 0.1;
	}
};

<i>/*
============
CheckRules

Exit deathmatch games upon conditions
============
*/</i>

<a href="qc-types.htm#void">void</a>() <b>CheckRules</b><a name="CheckRules">=</a>
{
	<b>local</b>	<a href="qc-types.htm#float">float</a>		timelimit;
	<b>local</b>	<a href="qc-types.htm#float">float</a>		fraglimit;
	
	<b>if</b> (<a href="defs.htm#gameover">gameover</a>)	<i>// someone else quit the game already</i>
		<b>return</b>;
		
	timelimit = <a href="qc-built.htm#cvar">cvar</a>(<b>"timelimit"</b>) * 60;
	fraglimit = <a href="qc-built.htm#cvar">cvar</a>(<b>"fraglimit"</b>);
	
	<b>if</b> (timelimit &amp;&amp; <a href="qc-glob.htm#time">time</a> &gt;= timelimit)
	{
<a href="client.htm#NextLevel">NextLevel</a> ();
<i>/*
		gameover = TRUE;
		bprint ("\n\n\n==============================\n");
		bprint ("game exited after ");
		bprint (ftos(timelimit/60));
		bprint (" minutes\n");
		DumpScore ();
		localcmd ("killserver\n");
*/</i>

		<b>return</b>;
	}
	
	<b>if</b> (fraglimit &amp;&amp; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_frags">frags</a> &gt;= fraglimit)
	{
<a href="client.htm#NextLevel">NextLevel</a> ();
<i>/*
		gameover = TRUE;
		bprint ("\n\n\n==============================\n");
		bprint ("game exited after ");
		bprint (ftos(self.frags));
		bprint (" frags\n");
		DumpScore ();
		localcmd ("killserver\n");
*/</i>

		<b>return</b>;
	}	
};

<i>//============================================================================</i>

<a href="qc-types.htm#void">void</a>() <b>PlayerDeathThink</b><a name="PlayerDeathThink">=</a>
{
	<b>local</b> <a href="qc-types.htm#entity">entity</a>	old_self;
	<b>local</b> <a href="qc-types.htm#float">float</a>		forward;

	<b>if</b> ((<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_ONGROUND">FL_ONGROUND</a>))
	{
		forward = <a href="qc-built.htm#vlen">vlen</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a>);
		forward = forward - 20;
		<b>if</b> (forward &lt;= 0)
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = '0 0 0';
		<b>else</b>	
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = forward * <a href="qc-built.htm#normalize">normalize</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a>);
	}

<i>// wait for all buttons released</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_deadflag">deadflag</a> == <a href="qc-defs.htm#DEAD_DEAD">DEAD_DEAD</a>)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button2">button2</a> || <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button1">button1</a> || <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button0">button0</a>)
			<b>return</b>;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_deadflag">deadflag</a> = <a href="qc-defs.htm#DEAD_RESPAWNABLE">DEAD_RESPAWNABLE</a>;
		<b>return</b>;
	}

<i>// wait for any button down</i>
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button2">button2</a> &amp;&amp; !<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button1">button1</a> &amp;&amp; !<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button0">button0</a>)
		<b>return</b>;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button0">button0</a> = 0;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button1">button1</a> = 0;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button2">button2</a> = 0;
	<a href="client.htm#respawn">respawn</a>();
};


<a href="qc-types.htm#void">void</a>() <b>PlayerJump</b><a name="PlayerJump">=</a>
{
	<b>local</b> <a href="qc-types.htm#vector">vector</a> start, end;
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_WATERJUMP">FL_WATERJUMP</a>)
		<b>return</b>;
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> &gt;= 2)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_WATER">CONTENT_WATER</a>)
			<a href="qc-glob.htm#self">self</a>.velocity_z = 100;
		<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_SLIME">CONTENT_SLIME</a>)
			<a href="qc-glob.htm#self">self</a>.velocity_z = 80;
		<b>else</b>
			<a href="qc-glob.htm#self">self</a>.velocity_z = 50;

<i>// play swiming sound</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_swim_flag">swim_flag</a> &lt; <a href="qc-glob.htm#time">time</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_swim_flag">swim_flag</a> = <a href="qc-glob.htm#time">time</a> + 1;
			<b>if</b> (<a href="qc-built.htm#random">random</a>() &lt; 0.5)
				<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"misc/water1.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
			<b>else</b>
				<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"misc/water2.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		}

		<b>return</b>;
	}

	<b>if</b> (!(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_ONGROUND">FL_ONGROUND</a>))
		<b>return</b>;

	<b>if</b> ( !(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_JUMPRELEASED">FL_JUMPRELEASED</a>) )
		<b>return</b>;		<i>// don't pogo stick</i>

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_JUMPRELEASED">FL_JUMPRELEASED</a>);

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - <a href="defs.htm#FL_ONGROUND">FL_ONGROUND</a>;	<i>// don't stairwalk</i>
	
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button2">button2</a> = 0;
<i>// player jumping sound</i>
	<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"player/plyrjmp8.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
	<a href="qc-glob.htm#self">self</a>.velocity_z = <a href="qc-glob.htm#self">self</a>.velocity_z + 270;
};


<i>/*
===========
WaterMove

============
*/</i>

.<a href="qc-types.htm#dot_float">float</a>	dmgtime;

<a href="qc-types.htm#void">void</a>() <b>WaterMove</b><a name="WaterMove">=</a>
{
<i>//dprint (ftos(self.waterlevel));</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> == <a href="qc-defs.htm#MOVETYPE_NOCLIP">MOVETYPE_NOCLIP</a>)
		<b>return</b>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> &lt; 0)
		<b>return</b>;

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> != 3)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> &lt; <a href="qc-glob.htm#time">time</a>)
			<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <b>"player/gasp2.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> &lt; <a href="qc-glob.htm#time">time</a> + 9)
			<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <b>"player/gasp1.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> = <a href="qc-glob.htm#time">time</a> + 12;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> = 2;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> &lt; <a href="qc-glob.htm#time">time</a>)
	{	<i>// drown!</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pain_finished">pain_finished</a> &lt; <a href="qc-glob.htm#time">time</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> + 2;
			<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> &gt; 15)
				<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> = 10;
			<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#world">world</a>, <a href="qc-glob.htm#world">world</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a>);
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pain_finished">pain_finished</a> = <a href="qc-glob.htm#time">time</a> + 1;
		}
	}
	
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a>)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_INWATER">FL_INWATER</a>)
		{	
			<i>// play leave water sound</i>
			<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"misc/outwater.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - <a href="defs.htm#FL_INWATER">FL_INWATER</a>;
		}
		<b>return</b>;
	}

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_LAVA">CONTENT_LAVA</a>)
	{	<i>// do damage</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.dmgtime &lt; <a href="qc-glob.htm#time">time</a>)
		{
			<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_radsuit_finished">radsuit_finished</a> &gt; <a href="qc-glob.htm#time">time</a>)
				<a href="qc-glob.htm#self">self</a>.dmgtime = <a href="qc-glob.htm#time">time</a> + 1;
			<b>else</b>
				<a href="qc-glob.htm#self">self</a>.dmgtime = <a href="qc-glob.htm#time">time</a> + 0.2;

			<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#world">world</a>, <a href="qc-glob.htm#world">world</a>, 10*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a>);
		}
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_SLIME">CONTENT_SLIME</a>)
	{	<i>// do damage</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.dmgtime &lt; <a href="qc-glob.htm#time">time</a> &amp;&amp; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_radsuit_finished">radsuit_finished</a> &lt; <a href="qc-glob.htm#time">time</a>)
		{
			<a href="qc-glob.htm#self">self</a>.dmgtime = <a href="qc-glob.htm#time">time</a> + 1;
			<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#world">world</a>, <a href="qc-glob.htm#world">world</a>, 4*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a>);
		}
	}
	
	<b>if</b> ( !(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_INWATER">FL_INWATER</a>) )
	{	

<i>// player enter water sound</i>

		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_LAVA">CONTENT_LAVA</a>)
			<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"player/inlava.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -