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

📄 wizard.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html><head><title>wizard.qc</title></head><body bgcolor="#C0F0D0">
<base target=examine>
<pre>
<i>/*
==============================================================================

WIZARD

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


<b>$</b><a href="qc-mdl.htm#s_cd">cd</a> <b>/raid/quake/id1/models/a_wizard</b>
<b>$</b><a href="qc-mdl.htm#s_origin">origin</a> <b>0 0 24</b>
<b>$</b><a href="qc-mdl.htm#s_base">base</a> <b>wizbase	</b>
<b>$</b><a href="qc-mdl.htm#s_skin">skin</a> <b>wizbase</b>

<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>hover1 hover2 hover3 hover4 hover5 hover6 hover7 hover8</b>
<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>hover9 hover10 hover11 hover12 hover13 hover14 hover15</b>

<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>fly1 fly2 fly3 fly4 fly5 fly6 fly7 fly8 fly9 fly10</b>
<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>fly11 fly12 fly13 fly14</b>

<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>magatt1 magatt2 magatt3 magatt4 magatt5 magatt6 magatt7</b>
<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>magatt8 magatt9 magatt10 magatt11 magatt12 magatt13</b>

<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>pain1 pain2 pain3 pain4</b>

<b>$</b><a href="qc-mdl.htm#s_frame">frame</a> <b>death1 death2 death3 death4 death5 death6 death7 death8</b>

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

WIZARD

If the player moves behind cover before the missile is launched, launch it
at the last visible spot with no velocity leading, in hopes that the player
will duck back out and catch it.
==============================================================================
*/</i>


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

Sets the given entities velocity and angles so that it will hit self.enemy
if self.enemy maintains it's current velocity
0.1 is moderately accurate, 0.0 is totally accurate
=============
*/</i>

<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#entity">entity</a> missile, <a href="qc-types.htm#float">float</a> mspeed, <a href="qc-types.htm#float">float</a> accuracy) <b>LaunchMissile</b><a name="LaunchMissile">=</a>
{
	<b>local</b>	<a href="qc-types.htm#vector">vector</a>	vec, move;
	<b>local</b>	<a href="qc-types.htm#float">float</a>	fly;

	<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a>);
		
<i>// set missile speed</i>
	vec = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_origin">origin</a> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_mins">mins</a> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_size">size</a> * 0.7 - missile.<a href="qc-enty.htm#dot_origin">origin</a>;

<i>// calc aproximate time for missile to reach vec</i>
	fly = <a href="qc-built.htm#vlen">vlen</a> (vec) / mspeed;
	
<i>// get the entities xy velocity</i>
	move = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_velocity">velocity</a>;
	move_z = 0;

<i>// project the target forward in time</i>
	vec = vec + move * fly;
	
	vec = <a href="qc-built.htm#normalize">normalize</a>(vec);
	vec = vec + accuracy*<a href="qc-built.htm#v_up">v_up</a>*(<a href="qc-built.htm#random">random</a>()- 0.5) + accuracy*<a href="qc-built.htm#v_right">v_right</a>*(<a href="qc-built.htm#random">random</a>()- 0.5);
	
	missile.<a href="qc-enty.htm#dot_velocity">velocity</a> = vec * mspeed;

	missile.<a href="qc-enty.htm#dot_angles">angles</a> = '0 0 0';
	missile.angles_y = <a href="qc-built.htm#vectoyaw">vectoyaw</a>(missile.<a href="qc-enty.htm#dot_velocity">velocity</a>);

<i>// set missile duration</i>
	missile.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 5;
	missile.<a href="qc-enty.htm#dot_think">think</a> = <a href="subs.htm#SUB_Remove">SUB_Remove</a>;	
};


<a href="qc-types.htm#void">void</a>() <a href="wizard.htm#wiz_run1">wiz_run1</a>;
<a href="qc-types.htm#void">void</a>() <a href="wizard.htm#wiz_side1">wiz_side1</a>;

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

<a href="qc-types.htm#float">float</a>() <b>WizardCheckAttack</b><a name="WizardCheckAttack">=</a>
{
	<b>local</b> <a href="qc-types.htm#vector">vector</a>	spot1, spot2;	
	<b>local</b> <a href="qc-types.htm#entity">entity</a>	targ;
	<b>local</b> <a href="qc-types.htm#float">float</a>		chance;

	<b>if</b> (<a href="qc-glob.htm#time">time</a> &lt; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a>)
		return FALSE;
	<b>if</b> (!enemy_vis)
		return FALSE;

	<b>if</b> (enemy_range == <a href="defs.htm#RANGE_FAR">RANGE_FAR</a>)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> != <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>;
			<a href="wizard.htm#wiz_run1">wiz_run1</a> ();
		}
		return FALSE;
	}
		
	targ = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>;
	
<i>// see if any entities are in the way of the shot</i>
	spot1 = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_view_ofs">view_ofs</a>;
	spot2 = targ.<a href="qc-enty.htm#dot_origin">origin</a> + targ.<a href="qc-enty.htm#dot_view_ofs">view_ofs</a>;

	<a href="qc-built.htm#traceline">traceline</a> (spot1, spot2, <a href="defs.htm#FALSE">FALSE</a>, <a href="qc-glob.htm#self">self</a>);

	<b>if</b> (<a href="qc-built.htm#trace_ent">trace_ent</a> != targ)
	{	<i>// don't have a clear shot, so move to a side</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> != <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>;
			<a href="wizard.htm#wiz_run1">wiz_run1</a> ();
		}
		return FALSE;
	}
			
	<b>if</b> (enemy_range == <a href="defs.htm#RANGE_MELEE">RANGE_MELEE</a>)
		chance = 0.9;
	<b>else</b> <b>if</b> (enemy_range == <a href="defs.htm#RANGE_NEAR">RANGE_NEAR</a>)
		chance = 0.6;
	<b>else</b> <b>if</b> (enemy_range == <a href="defs.htm#RANGE_MID">RANGE_MID</a>)
		chance = 0.2;
	<b>else</b>
		chance = 0;

	<b>if</b> (<a href="qc-built.htm#random">random</a> () &lt; chance)
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_MISSILE">AS_MISSILE</a>;
		return TRUE;
	}

	<b>if</b> (enemy_range == <a href="defs.htm#RANGE_MID">RANGE_MID</a>)
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> != <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>;
			<a href="wizard.htm#wiz_run1">wiz_run1</a> ();
		}
	}
	<b>else</b>
	{
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> != <a href="defs.htm#AS_SLIDING">AS_SLIDING</a>)
		{
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_SLIDING">AS_SLIDING</a>;
			<a href="wizard.htm#wiz_side1">wiz_side1</a> ();
		}
	}
	
	return FALSE;
};

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

<a href="qc-types.htm#float">float</a>() <b>WizardAttackFinished</b><a name="WizardAttackFinished">=</a>
{
	<b>if</b> (enemy_range &gt;= <a href="defs.htm#RANGE_MID">RANGE_MID</a> || !enemy_vis)
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_STRAIGHT">AS_STRAIGHT</a>;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="wizard.htm#wiz_run1">wiz_run1</a>;
	}
	<b>else</b>
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_SLIDING">AS_SLIDING</a>;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="wizard.htm#wiz_side1">wiz_side1</a>;
	}
};

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

FAST ATTACKS

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


<a href="qc-types.htm#void">void</a>() <b>Wiz_FastFire</b><a name="Wiz_FastFire">=</a>
{
	<b>local</b> <a href="qc-types.htm#vector">vector</a>		vec;
	<b>local</b> <a href="qc-types.htm#vector">vector</a>		dst;

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>.<a href="qc-enty.htm#dot_health">health</a> &gt; 0)
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>.<a href="qc-enty.htm#dot_effects">effects</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>.<a href="qc-enty.htm#dot_effects">effects</a> | <a href="qc-defs.htm#EF_MUZZLEFLASH">EF_MUZZLEFLASH</a>;

		<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_angles">angles</a>);	
		dst = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_origin">origin</a> - 13*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movedir">movedir</a>;
	
		vec = <a href="qc-built.htm#normalize">normalize</a>(dst - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);

⌨️ 快捷键说明

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