clean up weird code

This commit is contained in:
alison wright 2019-09-18 10:54:42 -04:00
parent d7ef811865
commit fa8592e377
5 changed files with 116 additions and 277 deletions

View File

@ -127,7 +127,7 @@ void end_sys_globals; // flag for structure dumping
.float button1; // use .float button1; // use
.float button2; // jump .float button2; // jump
.float impulse; // weapon changes .float impulse; // user commands
.float fixangle; .float fixangle;
.vector v_angle; // view / targeting angle for players .vector v_angle; // view / targeting angle for players
@ -216,8 +216,8 @@ string(string s) precache_sound = #19;
string(string s) precache_model = #20; string(string s) precache_model = #20;
void(entity client, string s) stuffcmd = #21; void(entity client, string s) stuffcmd = #21;
entity(vector org, float rad) findradius = #22; entity(vector org, float rad) findradius = #22;
void(string s) bprint = #23; void(string... s) bprint = #23;
void(entity client, string s) sprint = #24; void(entity client, string... s) sprint = #24;
void(string s) dprint = #25; void(string s) dprint = #25;
string(float f) ftos = #26; string(float f) ftos = #26;
string(vector v) vtos = #27; 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(entity e) makestatic = #69;
void(string s) changelevel = #70; void(string s) changelevel = #70;
void(string var, string val) cvar_set = #72; // sets cvar.value 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; void(vector pos, string samp, float vol, float atten) ambientsound = #74;
string(string s) precache_model2 = #75; // registered version only string(string s) precache_model2 = #75; // registered version only
@ -467,6 +467,12 @@ enum {
AS_MELEE, AS_MELEE,
AS_MISSILE, AS_MISSILE,
}; };
enum {
WORLD_MEDIEVAL,
WORLD_METAL,
WORLD_BASE,
};
#pragma noref 0 #pragma noref 0
// globals -------------------------------------------------------------------| // globals -------------------------------------------------------------------|
@ -517,7 +523,7 @@ float sight_entity_time;
// world fields // world fields
.string wad; .string wad;
.string map; .string map;
.float worldtype; // 0=medieval 1=metal 2=base .float worldtype;
.string killtarget; .string killtarget;

View File

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

View File

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

View File

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

View File

@ -1,157 +1,8 @@
// world.qc: basic entry point functions // world.qc: basic entry point functions
void() main = { 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) ? /*QUAKED worldspawn(0 0 0) ?
Only used for the world entity. Only used for the world entity.
Set message to the level name. Set message to the level name.
@ -162,7 +13,6 @@ World Types:
1: metal 1: metal
2: base 2: base
*/ */
//=======================
void() worldspawn = { void() worldspawn = {
lastspawn = world; lastspawn = world;
InitBodyQue(); InitBodyQue();