Forum

Three Quake1 Questions?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby Urre » Wed Sep 26, 2007 5:57 am

Dr. Shadowborg wrote:As for the separate entity method being ugly, I agree. For starters, whenever you shoot it up or down, it looks like you're shooting lightning from your eyes. And that's just for starters.

However, it is acceptable if you're going for a railgun.


Uh, you obviously alter the shot origin based on your view angles, to match up when looking up or down... Having shot origin at self.origin + '0 0 16', now that's evil. I'd much rather have it at self.origin + self.view_ofs + v_up*-8 or something, that'd make it always spawn slightly under the gun, no matter the angle.

EDIT: lolz, Sajt already said it...
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Dr. Shadowborg » Wed Sep 26, 2007 7:27 pm

And the problem from going up stairs/ramps and lifts while shooting beams?
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Dr. Shadowborg » Thu Sep 27, 2007 3:54 pm

Well, it's far from perfect, but you can try using this:

Code: Select all

Place at bottom of DEFS.QC
.entity owned;

Place at top of playerprethink and playerpostthink

local vector lgp;
local float norg;

place at bottom of playerprethink and playerpostthink

   if(!self.button0 && self.owned != world)
    {
     remove(self.owned);
     self.owned = world;
    }
   else if (self.button0 && self.owned != world)
    {
     if(self.origin_z > self.oldorigin_z && (other.solid == SOLID_BSP))
      norg = -18;
     else
      norg = -12;

     makevectors(self.v_angle);
     setorigin(self.owned, self.origin + self.view_ofs + v_up*norg + v_right*8);
     lgp = self.origin + self.view_ofs + v_up*norg + v_forward*600;
     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
     WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
     WriteEntity (MSG_BROADCAST, self.owned);
     WriteCoord (MSG_BROADCAST, self.owned.origin_x);
     WriteCoord (MSG_BROADCAST, self.owned.origin_y);
     WriteCoord (MSG_BROADCAST, self.owned.origin_z);
     WriteCoord (MSG_BROADCAST, lgp_x);
     WriteCoord (MSG_BROADCAST, lgp_y);
     WriteCoord (MSG_BROADCAST, lgp_z);
    }

   self.oldorigin = self.origin;

replace W_Firelightning in weapons.qc with this:

void() W_FireLightning =
{
    local   vector      org, org2;
   local   float      cells;

   if (self.ammo_cells < 1)
   {
      self.weapon = W_BestWeapon ();
      W_SetCurrentAmmo ();
      return;
   }

// explode if under water
   if (self.waterlevel > 1)
   {
      cells = self.ammo_cells;
      self.ammo_cells = 0;
      W_SetCurrentAmmo ();
      T_RadiusDamage (self, self, 35*cells, world);
      return;
   }

    makevectors(self.v_angle);

    if (self.t_width < time)
   {
      sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
      self.t_width = time + 0.6;
   }

    org = self.origin + self.view_ofs + v_up*-8 + v_right*8;
    org2 = self.origin + self.view_ofs + v_up*-8;

  if(!self.owned || self.owned == world)
   {
    newmis = spawn();
    self.owned = newmis;
    newmis.solid = SOLID_NOT;
    setsize(newmis, '-1 -1 -1', '1 1 1');
   }
    setorigin(self.owned, org);

    self.punchangle_x = -2;

   self.currentammo = self.ammo_cells = self.ammo_cells - 1;

    traceline (org2, org2 + v_forward*600, TRUE, self);

   WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
    WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
    WriteEntity (MSG_BROADCAST, self.owned);
   WriteCoord (MSG_BROADCAST, org_x);
   WriteCoord (MSG_BROADCAST, org_y);
   WriteCoord (MSG_BROADCAST, org_z);
   WriteCoord (MSG_BROADCAST, trace_endpos_x);
   WriteCoord (MSG_BROADCAST, trace_endpos_y);
   WriteCoord (MSG_BROADCAST, trace_endpos_z);

   LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
};



Feel free to tweak / point and laugh as needed.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Re: Three Quake1 Questions?

Postby smd » Sun Oct 14, 2007 4:11 pm

smd wrote:2. i have changed all my weapons to the right side...



but now i have changed all my old mdl weapons to new md3 weapons.
and so my question is, how is it possible to move my new weapons to the right side without edit the md3 file?

i mean is there a way in the weapons.qc file???

i have tried to modify the md3 in quark and gmax, but quark dont let me save md3 files. gmax save the modified md3, but without animations.
smd
 
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Re: Three Quake1 Questions?

Postby Entar » Sun Oct 14, 2007 6:10 pm

smd wrote:and so my question is, how is it possible to move my new weapons to the right side without edit the md3 file?

In FTEQW and Vr2, there's are cvars (cl_gunx, y, and z) that adjust the viewmodel's position on the screen. Dunno if DarkPlaces has that added or not.
User avatar
Entar
 
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer

Postby smd » Sun Oct 14, 2007 7:42 pm

thanks, but i need it for darkplaces!
smd
 
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Postby Sajt » Sun Oct 14, 2007 10:43 pm

You have to use entities for the weapons, not .weaponmodel. Spawn an entity and set its .viewmodelforclient to the player, and the entity's origin is relative to the player.

Of course it may be a bit of work to transfer your weapon system to entities.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby smd » Mon Oct 15, 2007 2:26 pm

ok thank you very much, will try that 8)
smd
 
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest