* Quake Small Exploration Kit 1.0 * The Small Exploration Kit (SEK) provides missing fundamental extras to safely explore hostile areas like flashlight, radarsound, zoom or map. For Quake it will add flashlight, radarsound and fake chasecam maping! Instructions: 1. add to the beginning of weapons.qc ------------------------------------- .entity it_flashlight_entity; float it_flashlight_on; .float radar_on; float radar_time; float CHSCAM_ON = 1; float SVC_SETVIEWPORT = 5; float SVC_SETVIEWANGLES = 10; void() it_flashlight_aim = { local vector direction, src; local entity pl; local float temp; pl=self.owner; makevectors(pl.v_angle); src = pl.origin + v_forward*10; src_z = pl.absmin_z + pl.size_z * 0.7; direction=aim(pl, 100000); traceline(src, src + direction * 2048, FALSE, pl); src=0.1*src + 0.9*trace_endpos; setorigin(self, src); if (!pl.deadflag&&trace_ent.flags&FL_MONSTER&&!trace_ent.enemy) { trace_ent.enemy=pl; trace_ent.nextthink=time+0.2; trace_ent.think=FoundTarget; } self.nextthink=time+0.05; }; void() ToggleFlashlight = { local entity oldself; if (self.it_flashlight_on) { if (self.it_flashlight_entity) remove (self.it_flashlight_entity); self.it_flashlight_entity=world; self.it_flashlight_on=0; self.effects = self.effects - (self.effects & EF_DIMLIGHT); } else { self.it_flashlight_on=1; self.effects = self.effects | EF_DIMLIGHT; //ws oldself=self; self.it_flashlight_entity=spawn(); self=self.it_flashlight_entity; self.movetype= MOVETYPE_NONE; self.solid = SOLID_NOT; setmodel(self, "progs/s_bubble.spr"); //ws setsize (self, '0 0 0', '0 0 0'); self.effects=self.flags=EF_DIMLIGHT; self.owner=oldself; self.nextthink=time+1; self.think=it_flashlight_aim; it_flashlight_aim(); self=oldself; } }; void() DisplayCompass = { local float dir; dir = self.v_angle_y; if (dir > -22.5 && dir <= 22.5) centerprint (self, " É\n ø"); else if (dir > 22.5 && dir <= 67.5) centerprint(self, "Ü \n ø"); else if (dir > 67.5 && dir <= 112.5) centerprint(self, "\n­ø"); else if (dir > 112.5 && dir <= 157.5) centerprint(self, "\n ø\n¯ "); else if (dir > 157.5 || dir <= -157.5) centerprint(self, "\n ø\n É"); else if (dir > -157.5 && dir <= -112.5) centerprint(self, "\n ø\n Ü"); else if (dir > -112.5 && dir <= -67.5) centerprint(self, "\n ø­"); else centerprint(self, " ¯\n ø"); }; void() Keep_cam_chasing_owner; void() Start_chase_cam = { local entity chase_cam; chase_cam = spawn(); chase_cam.owner=self; chase_cam.owner.speed = chase_cam.owner.speed | CHSCAM_ON; chase_cam.solid = SOLID_NOT; chase_cam.movetype = MOVETYPE_STEP; chase_cam.flags = chase_cam.flags | FL_FLY; chase_cam.flags = chase_cam.flags | FL_MONSTER; chase_cam.angles = self.angles; setmodel (chase_cam, "progs/eyes.mdl" ); setsize (chase_cam, '-4 -4 -4', '4 4 4'); setorigin( chase_cam, self.origin + '0 0 32' ); chase_cam.classname = "chase_cam"; chase_cam.nextthink = time + 0.1; chase_cam.think = Keep_cam_chasing_owner; msg_entity = self; WriteByte (MSG_ONE, SVC_SETVIEWPORT); WriteEntity (MSG_ONE, chase_cam); WriteByte (MSG_ONE, SVC_SETVIEWANGLES); WriteAngle(MSG_ONE, chase_cam.angles_x); WriteAngle(MSG_ONE, chase_cam.angles_y); WriteAngle(MSG_ONE, chase_cam.angles_z); }; void() Remove_chase_cam = { local entity e; if ( (self.owner.speed & CHSCAM_ON) ) self.owner.speed = self.owner.speed - CHSCAM_ON; msg_entity = self.owner; WriteByte (MSG_ONE, SVC_SETVIEWPORT); WriteEntity (MSG_ONE, self.owner); e = self; self = self.owner; W_SetCurrentAmmo (); self = e; remove( self ); }; void() Keep_cam_chasing_owner = { local vector spot1, spot2, temp_spot; self.nextthink = time + 0.1; self.owner.weaponmodel = ""; if ( !(self.owner.speed & CHSCAM_ON) ) { Remove_chase_cam(); return; } if ( self.owner.v_angle_x < -47 ) { Remove_chase_cam(); return; } makevectors( self.owner.v_angle ); if ( self.owner.v_angle_x > 50 ) spot2 = ( self.owner.origin - (v_forward * 80) + '0 0 2400' ); else spot2 = ( self.owner.origin - (v_forward * 80) + '0 0 24' ); traceline (self.owner.origin, spot2, TRUE, self.owner); spot2 = trace_endpos + ( v_forward * 2 ); traceline (spot2, spot2 + '0 0 24', TRUE, self.owner ); if (trace_fraction < 1 ) spot2 = trace_endpos - '0 0 24'; temp_spot = self.owner.origin; if ( temp_spot == self.oldorigin ) { setorigin( self, spot2 ); return; } self.oldorigin = self.owner.origin; spot1 = self.origin - (( self.origin - spot2 ) * 0.25 ); traceline( self.origin, spot1, TRUE, self.owner ); if ( trace_fraction == 1 ) setorigin( self, spot1 ); else setorigin( self, spot2 ); }; void() Toggle_Mapcam = { if( (self.speed & CHSCAM_ON) ) { self.speed = self.speed - CHSCAM_ON; } else { Start_chase_cam(); } }; 2. add at the end of the ImpulseCommands routine ------------------------------------------------ if (self.impulse == MAPCAM) Toggle_Mapcam(); if (self.impulse == FLASHLIGHT) ToggleFlashlight (); if ( (self.impulse == RADARSOUND) ) { if (self.radar_on) self.radar_on = 0; else self.radar_on =1; } if (self.radar_on) { local entity head,selected; local float min,dist; DisplayCompass (); if (radar_time==0) radar_time=time; if (time>=radar_time) { min=2000; head = findradius(self.origin,1000); selected = world; while (head) { dist = vlen(self.origin - head.origin); if( (head.health > 1) && (head != self) && (head != self.owner) && (dist