Compare commits

..

No commits in common. "fa8592e377014dcc435b299d8d59f2564882d95b" and "a2b4ae8a159337eeca8b24ed37f15fa56f89a058" have entirely different histories.

9 changed files with 363 additions and 199 deletions

View File

@ -1,7 +1,6 @@
progs.dat
source/defs.qc
source/common.qc
source/fight.qc
source/subs.qc

View File

@ -90,6 +90,83 @@ void() t_movetarget = {
};
//============================================================================
/*
=============
range
returns the range catagorization of an entity reletive to self
0 melee range, will become hostile even if back is turned
1 visibility and infront, or visibility and show hostile
2 infront and show hostile
3 only triggered by damage
=============
*/
float(entity targ) range = {
vector spot1, spot2;
float r;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
r = vlen(spot1 - spot2);
if(r < 120) {
return RANGE_MELEE;
}
if(r < 500) {
return RANGE_NEAR;
}
if(r < 1000) {
return RANGE_MID;
}
return RANGE_FAR;
};
/*
=============
visible
returns 1 if the entity is visible to self, even if not infront()
=============
*/
float(entity targ) visible = {
vector spot1, spot2;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline(spot1, spot2, TRUE, self); // see through other monsters
if(trace_inopen && trace_inwater) {
return FALSE; // sight line crossed contents
}
if(trace_fraction == 1) {
return TRUE;
}
return FALSE;
};
/*
=============
infront
returns 1 if the entity is in front(in sight) of self
=============
*/
float(entity targ) infront = {
vector vec;
float dot;
makevectors(self.angles);
vec = normalize(targ.origin - self.origin);
dot = vec * v_forward;
if(dot > 0.3) {
return TRUE;
}
return FALSE;
};
//============================================================================
void() HuntTarget = {

View File

@ -1,82 +0,0 @@
// common.qc: common functions
float() crandom = {
return 2 * (random() - 0.5);
};
/*
=============
range
returns the range catagorization of an entity reletive to self
0 melee range, will become hostile even if back is turned
1 visibility and infront, or visibility and show hostile
2 infront and show hostile
3 only triggered by damage
=============
*/
float(entity targ) range = {
vector spot1, spot2;
float r;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
r = vlen(spot1 - spot2);
if(r < 120) {
return RANGE_MELEE;
}
if(r < 500) {
return RANGE_NEAR;
}
if(r < 1000) {
return RANGE_MID;
}
return RANGE_FAR;
};
/*
=============
visible
returns 1 if the entity is visible to self, even if not infront()
=============
*/
float(entity targ) visible = {
vector spot1, spot2;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline(spot1, spot2, TRUE, self); // see through other monsters
if(trace_inopen && trace_inwater) {
return FALSE; // sight line crossed contents
}
if(trace_fraction == 1) {
return TRUE;
}
return FALSE;
};
/*
=============
infront
returns 1 if the entity is in front(in sight) of self
=============
*/
float(entity targ) infront = {
vector vec;
float dot;
makevectors(self.angles);
vec = normalize(targ.origin - self.origin);
dot = vec * v_forward;
if(dot > 0.3) {
return TRUE;
}
return FALSE;
};
// EOF

View File

@ -127,7 +127,7 @@ void end_sys_globals; // flag for structure dumping
.float button1; // use
.float button2; // jump
.float impulse; // user commands
.float impulse; // weapon changes
.float fixangle;
.vector v_angle; // view / targeting angle for players
@ -216,8 +216,8 @@ string(string s) precache_sound = #19;
string(string s) precache_model = #20;
void(entity client, string s) stuffcmd = #21;
entity(vector org, float rad) findradius = #22;
void(string... s) bprint = #23;
void(entity client, string... s) sprint = #24;
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
void(string s) dprint = #25;
string(float f) ftos = #26;
string(vector v) vtos = #27;
@ -259,7 +259,7 @@ string(string s) precache_file = #68; // no effect except for -copy
void(entity e) makestatic = #69;
void(string s) changelevel = #70;
void(string var, string val) cvar_set = #72; // sets cvar.value
void(entity client, string... s) centerprint = #73; // sprint, but in middle
void(entity client, string s) centerprint = #73; // sprint, but in middle
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
string(string s) precache_model2 = #75; // registered version only
@ -467,12 +467,6 @@ enum {
AS_MELEE,
AS_MISSILE,
};
enum {
WORLD_MEDIEVAL,
WORLD_METAL,
WORLD_BASE,
};
#pragma noref 0
// globals -------------------------------------------------------------------|
@ -523,7 +517,7 @@ float sight_entity_time;
// world fields
.string wad;
.string map;
.float worldtype;
.float worldtype; // 0=medieval 1=metal 2=base
.string killtarget;
@ -682,7 +676,12 @@ void() ShalHome;
void() ShalMissile;
void() ShalMissileTouch;
float() crandom;
float(entity targ) infront;
float(entity targ) range;
float(entity targ) visible;
float(entity targ, entity attacker) SameTeam;
float(float v) anglemod;
void() DecodeLevelParms;
void(entity ent) CopyToBodyQue;
void() InitBodyQue;

View File

@ -201,11 +201,29 @@ void() door_touch = {
// FIXME: blink key on player's status bar
if((self.items & other.items) != self.items) {
switch(self.owner.items) {
case IT_KEY1: centerprint(other, "You need the ", Key1Name()); break;
case IT_KEY2: centerprint(other, "You need the ", Key2Name()); break;
if(self.owner.items == IT_KEY1) {
if(world.worldtype == 2) {
centerprint(other, "You need the silver keycard");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
} else if(world.worldtype == 1) {
centerprint(other, "You need the silver runekey");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
} else if(world.worldtype == 0) {
centerprint(other, "You need the silver key");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
} else {
if(world.worldtype == 2) {
centerprint(other, "You need the gold keycard");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
} else if(world.worldtype == 1) {
centerprint(other, "You need the gold runekey");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
} else if(world.worldtype == 0) {
centerprint(other, "You need the gold key");
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
}
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
return;
}
@ -370,26 +388,27 @@ Key doors are allways wait -1.
4) screechy metal
*/
void() func_door = {
switch(world.worldtype) {
case WORLD_MEDIEVAL:
precache_sound("doors/medtry.wav");
precache_sound("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
break;
case WORLD_METAL:
precache_sound("doors/runetry.wav");
precache_sound("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
break;
case WORLD_BASE:
precache_sound("doors/basetry.wav");
precache_sound("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
break;
void() func_door =
{
if(world.worldtype == 0) {
precache_sound("doors/medtry.wav");
precache_sound("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
} else if(world.worldtype == 1) {
precache_sound("doors/runetry.wav");
precache_sound("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
} else if(world.worldtype == 2) {
precache_sound("doors/basetry.wav");
precache_sound("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
} else {
dprint("no worldtype set!\n");
}
if(self.sounds == 0) {
precache_sound("misc/null.wav");

View File

@ -11,27 +11,27 @@ const string WEPNAME_LIGHTNING = "Thunderbolt";
string() Key1Name = {
switch(world.worldtype) {
case WORLD_MEDIEVAL:
return "silver key";
case WORLD_METAL:
return "silver runekey";
case WORLD_BASE:
return "silver keycard";
default:
return string_null;
case 0:
return "silver key";
case 1:
return "silver runekey";
case 2:
return "silver keycard";
default:
return string_null;
}
};
string() Key2Name = {
switch(world.worldtype) {
case WORLD_MEDIEVAL:
return "gold key";
case WORLD_METAL:
return "gold runekey";
case WORLD_BASE:
return "gold keycard";
default:
return string_null;
case 0:
return "gold key";
case 1:
return "gold runekey";
case 2:
return "gold keycard";
default:
return string_null;
}
};
@ -886,19 +886,17 @@ void() key_touch = {
void() key_setsounds = {
switch(world.worldtype) {
case WORLD_MEDIEVAL:
precache_sound("misc/medkey.wav");
self.noise = "misc/medkey.wav";
break;
case WORLD_METAL:
precache_sound("misc/runekey.wav");
self.noise = "misc/runekey.wav";
break;
case WORLD_BASE:
precache_sound2("misc/basekey.wav");
self.noise = "misc/basekey.wav";
break;
if(world.worldtype == 0) {
precache_sound("misc/medkey.wav");
self.noise = "misc/medkey.wav";
}
if(world.worldtype == 1) {
precache_sound("misc/runekey.wav");
self.noise = "misc/runekey.wav";
}
if(world.worldtype == 2) {
precache_sound2("misc/basekey.wav");
self.noise = "misc/basekey.wav";
}
};
@ -916,18 +914,18 @@ following:
void() item_key1 = {
self.netname = Key1Name();
switch(world.worldtype) {
case WORLD_MEDIEVAL:
precache_model("progs/w_s_key.mdl");
setmodel(self, "progs/w_s_key.mdl");
break;
case WORLD_METAL:
precache_model("progs/m_s_key.mdl");
setmodel(self, "progs/m_s_key.mdl");
break;
case WORLD_BASE:
precache_model2("progs/b_s_key.mdl");
setmodel(self, "progs/b_s_key.mdl");
break;
case 0:
precache_model("progs/w_s_key.mdl");
setmodel(self, "progs/w_s_key.mdl");
break;
case 1:
precache_model("progs/m_s_key.mdl");
setmodel(self, "progs/m_s_key.mdl");
break;
case 2:
precache_model2("progs/b_s_key.mdl");
setmodel(self, "progs/b_s_key.mdl");
break;
}
key_setsounds();
self.touch = key_touch;
@ -950,18 +948,18 @@ following:
void() item_key2 = {
self.netname = Key2Name();
switch(world.worldtype) {
case WORLD_MEDIEVAL:
precache_model("progs/w_g_key.mdl");
setmodel(self, "progs/w_g_key.mdl");
break;
case WORLD_METAL:
precache_model("progs/m_g_key.mdl");
setmodel(self, "progs/m_g_key.mdl");
break;
case WORLD_BASE:
precache_model2("progs/b_g_key.mdl");
setmodel(self, "progs/b_g_key.mdl");
break;
case 0:
precache_model("progs/w_g_key.mdl");
setmodel(self, "progs/w_g_key.mdl");
break;
case 1:
precache_model("progs/m_g_key.mdl");
setmodel(self, "progs/m_g_key.mdl");
break;
case 2:
precache_model2("progs/b_g_key.mdl");
setmodel(self, "progs/b_g_key.mdl");
break;
}
key_setsounds();
self.touch = key_touch;
@ -1313,33 +1311,33 @@ entity() DropBackpack = {
item.weapon = self.weapon;
switch(item.weapon) {
case IT_AXE:
item.netname = WEPNAME_AXE;
break;
case IT_SHOTGUN:
item.netname = WEPNAME_SHOTGUN;
break;
case IT_SUPER_SHOTGUN:
item.netname = WEPNAME_SUPER_SHOTGUN;
break;
case IT_NAILGUN:
item.netname = WEPNAME_NAILGUN;
break;
case IT_SUPER_NAILGUN:
item.netname = WEPNAME_SUPER_NAILGUN;
break;
case IT_GRENADE_LAUNCHER:
item.netname = WEPNAME_GRENADE_LAUNCHER;
break;
case IT_ROCKET_LAUNCHER:
item.netname = WEPNAME_ROCKET_LAUNCHER;
break;
case IT_LIGHTNING:
item.netname = WEPNAME_LIGHTNING;
break;
default:
item.netname = "";
break;
case IT_AXE:
item.netname = WEPNAME_AXE;
break;
case IT_SHOTGUN:
item.netname = WEPNAME_SHOTGUN;
break;
case IT_SUPER_SHOTGUN:
item.netname = WEPNAME_SUPER_SHOTGUN;
break;
case IT_NAILGUN:
item.netname = WEPNAME_NAILGUN;
break;
case IT_SUPER_NAILGUN:
item.netname = WEPNAME_SUPER_NAILGUN;
break;
case IT_GRENADE_LAUNCHER:
item.netname = WEPNAME_GRENADE_LAUNCHER;
break;
case IT_ROCKET_LAUNCHER:
item.netname = WEPNAME_ROCKET_LAUNCHER;
break;
case IT_LIGHTNING:
item.netname = WEPNAME_LIGHTNING;
break;
default:
item.netname = "";
break;
}
item.ammo_shells = self.ammo_shells;

View File

@ -211,7 +211,7 @@ void() finale_4 = {
remove(self);
// change cd track
// switch cd track
WriteByte(MSG_ALL, SVC_CDTRACK);
WriteByte(MSG_ALL, 3);
WriteByte(MSG_ALL, 3);

View File

@ -16,6 +16,10 @@ void() W_Precache = {
precache_sound("weapons/shotgn2.wav"); // super shotgun
};
float() crandom = {
return 2 * (random() - 0.5);
};
/*
================
W_FireAxe

View File

@ -1,8 +1,157 @@
// world.qc: basic entry point functions
void() main = {
dprint("main function\n");
// these are just commands the the prog compiler to copy these files
precache_file("progs.dat");
precache_file("gfx.wad");
precache_file("quake.rc");
precache_file("default.cfg");
precache_file("end1.bin");
precache_file2("end2.bin");
precache_file("demo1.dem");
precache_file("demo2.dem");
precache_file("demo3.dem");
//
// these are all of the lumps from the cached.ls files
//
precache_file("gfx/palette.lmp");
precache_file("gfx/colormap.lmp");
precache_file2("gfx/pop.lmp");
precache_file("gfx/complete.lmp");
precache_file("gfx/inter.lmp");
precache_file("gfx/ranking.lmp");
precache_file("gfx/vidmodes.lmp");
precache_file("gfx/finale.lmp");
precache_file("gfx/conback.lmp");
precache_file("gfx/qplaque.lmp");
precache_file("gfx/menudot1.lmp");
precache_file("gfx/menudot2.lmp");
precache_file("gfx/menudot3.lmp");
precache_file("gfx/menudot4.lmp");
precache_file("gfx/menudot5.lmp");
precache_file("gfx/menudot6.lmp");
precache_file("gfx/menuplyr.lmp");
precache_file("gfx/bigbox.lmp");
precache_file("gfx/dim_modm.lmp");
precache_file("gfx/dim_drct.lmp");
precache_file("gfx/dim_ipx.lmp");
precache_file("gfx/dim_tcp.lmp");
precache_file("gfx/dim_mult.lmp");
precache_file("gfx/mainmenu.lmp");
precache_file("gfx/box_tl.lmp");
precache_file("gfx/box_tm.lmp");
precache_file("gfx/box_tr.lmp");
precache_file("gfx/box_ml.lmp");
precache_file("gfx/box_mm.lmp");
precache_file("gfx/box_mm2.lmp");
precache_file("gfx/box_mr.lmp");
precache_file("gfx/box_bl.lmp");
precache_file("gfx/box_bm.lmp");
precache_file("gfx/box_br.lmp");
precache_file("gfx/sp_menu.lmp");
precache_file("gfx/ttl_sgl.lmp");
precache_file("gfx/ttl_main.lmp");
precache_file("gfx/ttl_cstm.lmp");
precache_file("gfx/mp_menu.lmp");
precache_file("gfx/netmen1.lmp");
precache_file("gfx/netmen2.lmp");
precache_file("gfx/netmen3.lmp");
precache_file("gfx/netmen4.lmp");
precache_file("gfx/netmen5.lmp");
precache_file("gfx/sell.lmp");
precache_file("gfx/help0.lmp");
precache_file("gfx/help1.lmp");
precache_file("gfx/help2.lmp");
precache_file("gfx/help3.lmp");
precache_file("gfx/help4.lmp");
precache_file("gfx/help5.lmp");
precache_file("gfx/pause.lmp");
precache_file("gfx/loading.lmp");
precache_file("gfx/p_option.lmp");
precache_file("gfx/p_load.lmp");
precache_file("gfx/p_save.lmp");
precache_file("gfx/p_multi.lmp");
// sounds loaded by C code
precache_sound("misc/menu1.wav");
precache_sound("misc/menu2.wav");
precache_sound("misc/menu3.wav");
precache_sound("ambience/water1.wav");
precache_sound("ambience/wind2.wav");
// shareware
precache_file("maps/start.bsp");
precache_file("maps/e1m1.bsp");
precache_file("maps/e1m2.bsp");
precache_file("maps/e1m3.bsp");
precache_file("maps/e1m4.bsp");
precache_file("maps/e1m5.bsp");
precache_file("maps/e1m6.bsp");
precache_file("maps/e1m7.bsp");
precache_file("maps/e1m8.bsp");
// registered
precache_file2("gfx/pop.lmp");
precache_file2("maps/e2m1.bsp");
precache_file2("maps/e2m2.bsp");
precache_file2("maps/e2m3.bsp");
precache_file2("maps/e2m4.bsp");
precache_file2("maps/e2m5.bsp");
precache_file2("maps/e2m6.bsp");
precache_file2("maps/e2m7.bsp");
precache_file2("maps/e3m1.bsp");
precache_file2("maps/e3m2.bsp");
precache_file2("maps/e3m3.bsp");
precache_file2("maps/e3m4.bsp");
precache_file2("maps/e3m5.bsp");
precache_file2("maps/e3m6.bsp");
precache_file2("maps/e3m7.bsp");
precache_file2("maps/e4m1.bsp");
precache_file2("maps/e4m2.bsp");
precache_file2("maps/e4m3.bsp");
precache_file2("maps/e4m4.bsp");
precache_file2("maps/e4m5.bsp");
precache_file2("maps/e4m6.bsp");
precache_file2("maps/e4m7.bsp");
precache_file2("maps/e4m8.bsp");
precache_file2("maps/end.bsp");
precache_file2("maps/dm1.bsp");
precache_file2("maps/dm2.bsp");
precache_file2("maps/dm3.bsp");
precache_file2("maps/dm4.bsp");
precache_file2("maps/dm5.bsp");
precache_file2("maps/dm6.bsp");
};
//=======================
/*QUAKED worldspawn(0 0 0) ?
Only used for the world entity.
Set message to the level name.
@ -13,6 +162,7 @@ World Types:
1: metal
2: base
*/
//=======================
void() worldspawn = {
lastspawn = world;
InitBodyQue();