1 2 void() InitBodyQue; 3 4 5 void() main = 6 { 7 dprint ("main function\n"); 8 9 // these are just commands the the prog compiler to copy these files 10 11 precache_file ("progs.dat"); 12 precache_file ("gfx.wad"); 13 precache_file ("quake.rc"); 14 precache_file ("default.cfg"); 15 16 precache_file ("end1.bin"); 17 precache_file2 ("end2.bin"); 18 19 precache_file ("demo1.dem"); 20 precache_file ("demo2.dem"); 21 precache_file ("demo3.dem"); 22 23 // 24 // these are all of the lumps from the cached.ls files 25 // 26 precache_file ("gfx/palette.lmp"); 27 precache_file ("gfx/colormap.lmp"); 28 29 precache_file2 ("gfx/pop.lmp"); 30 31 precache_file ("gfx/complete.lmp"); 32 precache_file ("gfx/inter.lmp"); 33 34 precache_file ("gfx/ranking.lmp"); 35 precache_file ("gfx/vidmodes.lmp"); 36 precache_file ("gfx/finale.lmp"); 37 precache_file ("gfx/conback.lmp"); 38 precache_file ("gfx/qplaque.lmp"); 39 40 precache_file ("gfx/menudot1.lmp"); 41 precache_file ("gfx/menudot2.lmp"); 42 precache_file ("gfx/menudot3.lmp"); 43 precache_file ("gfx/menudot4.lmp"); 44 precache_file ("gfx/menudot5.lmp"); 45 precache_file ("gfx/menudot6.lmp"); 46 47 precache_file ("gfx/menuplyr.lmp"); 48 precache_file ("gfx/bigbox.lmp"); 49 precache_file ("gfx/dim_modm.lmp"); 50 precache_file ("gfx/dim_drct.lmp"); 51 precache_file ("gfx/dim_ipx.lmp"); 52 precache_file ("gfx/dim_tcp.lmp"); 53 precache_file ("gfx/dim_mult.lmp"); 54 precache_file ("gfx/mainmenu.lmp"); 55 56 precache_file ("gfx/box_tl.lmp"); 57 precache_file ("gfx/box_tm.lmp"); 58 precache_file ("gfx/box_tr.lmp"); 59 60 precache_file ("gfx/box_ml.lmp"); 61 precache_file ("gfx/box_mm.lmp"); 62 precache_file ("gfx/box_mm2.lmp"); 63 precache_file ("gfx/box_mr.lmp"); 64 65 precache_file ("gfx/box_bl.lmp"); 66 precache_file ("gfx/box_bm.lmp"); 67 precache_file ("gfx/box_br.lmp"); 68 69 precache_file ("gfx/sp_menu.lmp"); 70 precache_file ("gfx/ttl_sgl.lmp"); 71 precache_file ("gfx/ttl_main.lmp"); 72 precache_file ("gfx/ttl_cstm.lmp"); 73 74 precache_file ("gfx/mp_menu.lmp"); 75 76 precache_file ("gfx/netmen1.lmp"); 77 precache_file ("gfx/netmen2.lmp"); 78 precache_file ("gfx/netmen3.lmp"); 79 precache_file ("gfx/netmen4.lmp"); 80 precache_file ("gfx/netmen5.lmp"); 81 82 precache_file ("gfx/sell.lmp"); 83 84 precache_file ("gfx/help0.lmp"); 85 precache_file ("gfx/help1.lmp"); 86 precache_file ("gfx/help2.lmp"); 87 precache_file ("gfx/help3.lmp"); 88 precache_file ("gfx/help4.lmp"); 89 precache_file ("gfx/help5.lmp"); 90 91 precache_file ("gfx/pause.lmp"); 92 precache_file ("gfx/loading.lmp"); 93 94 precache_file ("gfx/p_option.lmp"); 95 precache_file ("gfx/p_load.lmp"); 96 precache_file ("gfx/p_save.lmp"); 97 precache_file ("gfx/p_multi.lmp"); 98 99 // sounds loaded by C code 100 precache_sound ("misc/menu1.wav"); 101 precache_sound ("misc/menu2.wav"); 102 precache_sound ("misc/menu3.wav"); 103 104 precache_sound ("ambience/water1.wav"); 105 precache_sound ("ambience/wind2.wav"); 106 107 // shareware 108 precache_file ("maps/start.bsp"); 109 110 precache_file ("maps/e1m1.bsp"); 111 precache_file ("maps/e1m2.bsp"); 112 precache_file ("maps/e1m3.bsp"); 113 precache_file ("maps/e1m4.bsp"); 114 precache_file ("maps/e1m5.bsp"); 115 precache_file ("maps/e1m6.bsp"); 116 precache_file ("maps/e1m7.bsp"); 117 precache_file ("maps/e1m8.bsp"); 118 119 // registered 120 precache_file2 ("gfx/pop.lmp"); 121 122 precache_file2 ("maps/e2m1.bsp"); 123 precache_file2 ("maps/e2m2.bsp"); 124 precache_file2 ("maps/e2m3.bsp"); 125 precache_file2 ("maps/e2m4.bsp"); 126 precache_file2 ("maps/e2m5.bsp"); 127 precache_file2 ("maps/e2m6.bsp"); 128 precache_file2 ("maps/e2m7.bsp"); 129 130 precache_file2 ("maps/e3m1.bsp"); 131 precache_file2 ("maps/e3m2.bsp"); 132 precache_file2 ("maps/e3m3.bsp"); 133 precache_file2 ("maps/e3m4.bsp"); 134 precache_file2 ("maps/e3m5.bsp"); 135 precache_file2 ("maps/e3m6.bsp"); 136 precache_file2 ("maps/e3m7.bsp"); 137 138 precache_file2 ("maps/e4m1.bsp"); 139 precache_file2 ("maps/e4m2.bsp"); 140 precache_file2 ("maps/e4m3.bsp"); 141 precache_file2 ("maps/e4m4.bsp"); 142 precache_file2 ("maps/e4m5.bsp"); 143 precache_file2 ("maps/e4m6.bsp"); 144 precache_file2 ("maps/e4m7.bsp"); 145 precache_file2 ("maps/e4m8.bsp"); 146 147 precache_file2 ("maps/end.bsp"); 148 149 precache_file2 ("maps/dm1.bsp"); 150 precache_file2 ("maps/dm2.bsp"); 151 precache_file2 ("maps/dm3.bsp"); 152 precache_file2 ("maps/dm4.bsp"); 153 precache_file2 ("maps/dm5.bsp"); 154 precache_file2 ("maps/dm6.bsp"); 155 }; 156 157 158 entity lastspawn; 159 160 //======================= 161 /*QUAKED worldspawn (0 0 0) ? 162 Only used for the world entity. 163 Set message to the level name. 164 Set sounds to the cd track to play. 165 166 World Types: 167 0: medieval 168 1: metal 169 2: base 170 */ 171 //======================= 172 void() worldspawn = 173 { 174 lastspawn = world; 175 InitBodyQue (); 176 177 // custom map attributes 178 179 if (self.model == "maps/e1m8.bsp") 180 cvar_set ("sv_gravity", "100"); 181 else 182 cvar_set ("sv_gravity", "800"); 183 184 185 // the area based ambient sounds MUST be the first precache_sounds 186 187 // player precaches 188 W_Precache (); // get weapon precaches 189 190 // sounds used from C physics code 191 precache_sound ("demon/dland2.wav"); // landing thud 192 precache_sound ("misc/h2ohit1.wav"); // landing splash 193 194 // setup precaches allways needed 195 precache_sound ("items/itembk2.wav"); // item respawn sound 196 precache_sound ("player/plyrjmp8.wav"); // player jump 197 precache_sound ("player/land.wav"); // player landing 198 precache_sound ("player/land2.wav"); // player hurt landing 199 precache_sound ("player/drown1.wav"); // drowning pain 200 precache_sound ("player/drown2.wav"); // drowning pain 201 precache_sound ("player/gasp1.wav"); // gasping for air 202 precache_sound ("player/gasp2.wav"); // taking breath 203 precache_sound ("player/h2odeath.wav"); // drowning death 204 205 precache_sound ("misc/talk.wav"); // talk 206 precache_sound ("player/teledth1.wav"); // telefrag 207 precache_sound ("misc/r_tele1.wav"); // teleport sounds 208 precache_sound ("misc/r_tele2.wav"); 209 precache_sound ("misc/r_tele3.wav"); 210 precache_sound ("misc/r_tele4.wav"); 211 precache_sound ("misc/r_tele5.wav"); 212 precache_sound ("weapons/lock4.wav"); // ammo pick up 213 precache_sound ("weapons/pkup.wav"); // weapon up 214 precache_sound ("items/armor1.wav"); // armor up 215 precache_sound ("weapons/lhit.wav"); //lightning 216 precache_sound ("weapons/lstart.wav"); //lightning start 217 precache_sound ("items/damage3.wav"); 218 219 precache_sound ("misc/power.wav"); //lightning for boss 220 221 // player gib sounds 222 precache_sound ("player/gib.wav"); // player gib sound 223 precache_sound ("player/udeath.wav"); // player gib sound 224 precache_sound ("player/tornoff2.wav"); // gib sound 225 226 // player pain sounds 227 228 precache_sound ("player/pain1.wav"); 229 precache_sound ("player/pain2.wav"); 230 precache_sound ("player/pain3.wav"); 231 precache_sound ("player/pain4.wav"); 232 precache_sound ("player/pain5.wav"); 233 precache_sound ("player/pain6.wav"); 234 235 // player death sounds 236 precache_sound ("player/death1.wav"); 237 precache_sound ("player/death2.wav"); 238 precache_sound ("player/death3.wav"); 239 precache_sound ("player/death4.wav"); 240 precache_sound ("player/death5.wav"); 241 242 precache_sound ("boss1/sight1.wav"); 243 244 // ax sounds 245 precache_sound ("weapons/ax1.wav"); // ax swoosh 246 precache_sound ("player/axhit1.wav"); // ax hit meat 247 precache_sound ("player/axhit2.wav"); // ax hit world 248 249 precache_sound ("player/h2ojump.wav"); // player jumping into water 250 precache_sound ("player/slimbrn2.wav"); // player enter slime 251 precache_sound ("player/inh2o.wav"); // player enter water 252 precache_sound ("player/inlava.wav"); // player enter lava 253 precache_sound ("misc/outwater.wav"); // leaving water sound 254 255 precache_sound ("player/lburn1.wav"); // lava burn 256 precache_sound ("player/lburn2.wav"); // lava burn 257 258 precache_sound ("misc/water1.wav"); // swimming 259 precache_sound ("misc/water2.wav"); // swimming 260 261 // Invulnerability sounds 262 precache_sound ("items/protect.wav"); 263 precache_sound ("items/protect2.wav"); 264 precache_sound ("items/protect3.wav"); 265 266 267 precache_model ("progs/player.mdl"); 268 precache_model ("progs/eyes.mdl"); 269 precache_model ("progs/h_player.mdl"); 270 precache_model ("progs/gib1.mdl"); 271 precache_model ("progs/gib2.mdl"); 272 precache_model ("progs/gib3.mdl"); 273 274 precache_model ("progs/s_bubble.spr"); // drowning bubbles 275 precache_model ("progs/s_explod.spr"); // sprite explosion 276 277 precache_model ("progs/v_axe.mdl"); 278 precache_model ("progs/v_shot.mdl"); 279 precache_model ("progs/v_nail.mdl"); 280 precache_model ("progs/v_rock.mdl"); 281 precache_model ("progs/v_shot2.mdl"); 282 precache_model ("progs/v_nail2.mdl"); 283 precache_model ("progs/v_rock2.mdl"); 284 285 precache_model ("progs/bolt.mdl"); // for lightning gun 286 precache_model ("progs/bolt2.mdl"); // for lightning gun 287 precache_model ("progs/bolt3.mdl"); // for boss shock 288 precache_model ("progs/lavaball.mdl"); // for testing 289 290 precache_model ("progs/missile.mdl"); 291 precache_model ("progs/grenade.mdl"); 292 precache_model ("progs/spike.mdl"); 293 precache_model ("progs/s_spike.mdl"); 294 295 precache_model ("progs/backpack.mdl"); 296 297 precache_model ("progs/zom_gib.mdl"); 298 299 precache_model ("progs/v_light.mdl"); 300 301 302 // 303 // Setup light animation tables. 'a' is total darkness, 'z' is maxbright. 304 // 305 306 // 0 normal 307 lightstyle(0, "m"); 308 309 // 1 FLICKER (first variety) 310 lightstyle(1, "mmnmmommommnonmmonqnmmo"); 311 312 // 2 SLOW STRONG PULSE 313 lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); 314 315 // 3 CANDLE (first variety) 316 lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); 317 318 // 4 FAST STROBE 319 lightstyle(4, "mamamamamama"); 320 321 // 5 GENTLE PULSE 1 322 lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj"); 323 324 // 6 FLICKER (second variety) 325 lightstyle(6, "nmonqnmomnmomomno"); 326 327 // 7 CANDLE (second variety) 328 lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm"); 329 330 // 8 CANDLE (third variety) 331 lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); 332 333 // 9 SLOW STROBE (fourth variety) 334 lightstyle(9, "aaaaaaaazzzzzzzz"); 335 336 // 10 FLUORESCENT FLICKER 337 lightstyle(10, "mmamammmmammamamaaamammma"); 338 339 // 11 SLOW PULSE NOT FADE TO BLACK 340 lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); 341 342 // styles 32-62 are assigned by the light program for switchable lights 343 344 // 63 testing 345 lightstyle(63, "a"); 346 }; 347 348 void() StartFrame = 349 { 350 timelimit = cvar("timelimit") * 60; 351 fraglimit = cvar("fraglimit"); 352 teamplay = cvar("teamplay"); 353 deathmatch = cvar("deathmatch"); 354 355 framecount = framecount + 1; 356 }; 357 358 /* 359 ============================================================================== 360 361 BODY QUE 362 363 ============================================================================== 364 */ 365 366 entity bodyque_head; 367 368 void() bodyque = 369 { // just here so spawn functions don't complain after the world 370 // creates bodyques 371 }; 372 373 void() InitBodyQue = 374 { 375 local entity e; 376 377 bodyque_head = spawn(); 378 bodyque_head.classname = "bodyque"; 379 bodyque_head.owner = spawn(); 380 bodyque_head.owner.classname = "bodyque"; 381 bodyque_head.owner.owner = spawn(); 382 bodyque_head.owner.owner.classname = "bodyque"; 383 bodyque_head.owner.owner.owner = spawn(); 384 bodyque_head.owner.owner.owner.classname = "bodyque"; 385 bodyque_head.owner.owner.owner.owner = bodyque_head; 386 }; 387 388 389 // make a body que entry for the given ent so the ent can be 390 // respawned elsewhere 391 void(entity ent) CopyToBodyQue = 392 { 393 bodyque_head.angles = ent.angles; 394 bodyque_head.model = ent.model; 395 bodyque_head.modelindex = ent.modelindex; 396 bodyque_head.frame = ent.frame; 397 bodyque_head.colormap = ent.colormap; 398 bodyque_head.movetype = ent.movetype; 399 bodyque_head.velocity = ent.velocity; 400 bodyque_head.flags = 0; 401 setorigin (bodyque_head, ent.origin); 402 setsize (bodyque_head, ent.mins, ent.maxs); 403 bodyque_head = bodyque_head.owner; 404 }; 405 406 407