⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cl_tent.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  i: Integer;
begin
  MSG_ReadPos(net_message, start);
  MSG_ReadPos(net_message, end_);

  l := @cl_lasers;
  for i := 0 to MAX_LASERS - 1 do
  begin
    if (l.endtime < cl.time) then
    begin
      l.ent.flags := RF_TRANSLUCENT or RF_BEAM;
      VectorCopy(start, vec3_t(l.ent.origin));
      VectorCopy(end_, vec3_t(l.ent.oldorigin));
      l.ent.alpha := 0.30;
      l.ent.skinnum := (colors shr ((rand() mod 4) * 8)) and $FF; // was (rand() % 4)
      l.ent.model := nil;
      l.ent.frame := 4;
      l.endtime := cl.time + 100;
      exit;
    end;
    Inc(l);
  end;
end;

//=======
//ROGUE

procedure CL_ParseSteam;
var
  pos, dir: vec3_t;
  id, i, r, cnt, color, magnitude: Integer;
  s, free_sustain: cl_sustain_p;
begin
  id := MSG_ReadShort (net_message);		// an id of -1 is an instant effect
  if (id <> -1) then begin // sustains
  // Com_Printf ('Sustain effect id %d\n', id);
    free_sustain := nil;
    for i := 0 to MAX_SUSTAINS - 1 do begin
      s := @cl_sustains[i];
      if (s.id = 0) then begin
        free_sustain := s;
        break;
      end;
    end;
    if (free_sustain <> nil) then begin
      s.id := id;
      s.count := MSG_ReadByte (net_message);
      MSG_ReadPos (net_message, s.org);
      MSG_ReadDir (net_message, s.dir);
      r := MSG_ReadByte (net_message);
      s.color := r and $FF;
      s.magnitude := MSG_ReadShort (net_message);
      s.endtime := cl.time + MSG_ReadLong (net_message);
      s.think := @CL_ParticleSteamEffect2;
      s.thinkinterval := 100;
      s.nextthink := cl.time;
    end else begin
      // Com_Printf ('No free sustains!\n');
      // FIXME - read the stuff anyway
      cnt := MSG_ReadByte (net_message);
      MSG_ReadPos (net_message, pos);
      MSG_ReadDir (net_message, dir);
      r := MSG_ReadByte (net_message);
      magnitude := MSG_ReadShort (net_message);
      magnitude := MSG_ReadLong (net_message); // really interval
    end;
  end else begin // instant
    cnt := MSG_ReadByte (net_message);
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    r := MSG_ReadByte (net_message);
    magnitude := MSG_ReadShort (net_message);
    color := r and $ff;
    CL_ParticleSteamEffect (pos, dir, color, cnt, magnitude);
   // S_StartSound (pos,  0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
  end;
end;

procedure CL_ParseWidow ;
var
  Pos: vec3_t;
  id, i: Integer;
  s, free_sustain: cl_sustain_p;
begin
  id := MSG_ReadShort (net_message);

  free_sustain := nil;
  for i := 0 to MAX_SUSTAINS - 1 do begin
    s := @cl_sustains[i];
    if (s.id = 0) then begin
      free_sustain := s;
      break;
    end;
  end;
  if (free_sustain <> nil) then begin
    s.id := id;
    MSG_ReadPos (net_message, s.org);
    s.endtime := cl.time + 2100;
    s.think := @CL_Widowbeamout;
    s.thinkinterval := 1;
    s.nextthink := cl.time;
  end else begin // no free sustains
    // FIXME - read the stuff anyway
    MSG_ReadPos (net_message, pos);
  end;
end;

procedure CL_ParseNuke;
var
  Pos: Vec3_t;
  id, i: Integer;
  s, free_sustain: cl_sustain_p;
begin
  free_sustain := nil;
  for i := 0 to MAX_SUSTAINS - 1 do begin
    s := @cl_sustains[i];
    if (s.id = 0) then begin
      free_sustain := s;
      break;
    end;
  end;
  if (free_sustain <> nil) then begin
    s.id := 21000;
    MSG_ReadPos (net_message, s.org);
    s.endtime := cl.time + 1000;
    s.think := @CL_Nukeblast;
    s.thinkinterval := 1;
    s.nextthink := cl.time;
  end else begin // no free sustains
    // FIXME - read the stuff anyway
    MSG_ReadPos (net_message, pos);
  end;
end;

//ROGUE
//=======

{
=========
CL_ParseTEnt
=========
}
const
  splash_color: array[0..6] of byte =
  ($00, $E0, $B0, $50, $D0, $E0, $E8);

procedure CL_ParseTEnt;
var
  type_: Integer;
  Pos, Pos2, Dir: vec3_t;
  Ex: Explosion_p;
  Cnt, Color, r, Ent, Magnitude: Integer;
begin
  type_ := MSG_ReadByte(net_message);

  case temp_event_t(type_) of
   TE_BLOOD:
   begin	// bullet hitting flesh
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    CL_ParticleEffect (pos, dir, $e8, 60);
   end;

   TE_GUNSHOT,			// bullet hitting wall
   TE_SPARKS,
   TE_BULLET_SPARKS:
   begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    if temp_event_t(type_) = TE_GUNSHOT then
     CL_ParticleEffect (pos, dir, 0, 40)
    else CL_ParticleEffect (pos, dir, $e0, 6);

    if (temp_event_t(type_) <> TE_SPARKS) then begin
     CL_SmokeAndFlash(pos);

     // impact sound
     cnt := rand() and 15;
     case cnt of
      1: S_StartSound (@pos, 0, 0, cl_sfx_ric1, 1, ATTN_NORM, 0);
      2: S_StartSound (@pos, 0, 0, cl_sfx_ric2, 1, ATTN_NORM, 0);
      3: S_StartSound (@pos, 0, 0, cl_sfx_ric3, 1, ATTN_NORM, 0);
     end;
    end;
   end;

   TE_SCREEN_SPARKS,
   TE_SHIELD_SPARKS: begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    if temp_event_t(type_) = TE_SCREEN_SPARKS then
     CL_ParticleEffect (pos, dir, $d0, 40)
    else
     CL_ParticleEffect (pos, dir, $b0, 40);
    //FIXME : replace or remove this sound
    S_StartSound (@pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
   end;

   TE_SHOTGUN: begin		// bullet hitting wall
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    CL_ParticleEffect (pos, dir, 0, 20);
    CL_SmokeAndFlash(pos);
   end;

   TE_SPLASH: begin		// bullet hitting water
    cnt := MSG_ReadByte (net_message);
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    r := MSG_ReadByte (net_message);
    if (r > 6) then
      color := $00
    else
      color := splash_color[r];
    CL_ParticleEffect (pos, dir, color, cnt);

    if (r = SPLASH_SPARKS) then begin
     r := rand() and 3;
     case r of
      0: S_StartSound (@pos, 0, 0, cl_sfx_spark5, 1, ATTN_STATIC, 0);
      1: S_StartSound (@pos, 0, 0, cl_sfx_spark6, 1, ATTN_STATIC, 0);
      else S_StartSound (@pos, 0, 0, cl_sfx_spark7, 1, ATTN_STATIC, 0);
     end;
    end;
   end;

   TE_LASER_SPARKS:
   begin
    cnt := MSG_ReadByte (net_message);
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    color := MSG_ReadByte (net_message);
    CL_ParticleEffect2 (pos, dir, color, cnt);
   end;

   // RAFAEL
   TE_BLUEHYPERBLASTER: begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadPos (net_message, dir);
    CL_BlasterParticles (pos, dir);
   end;

   TE_BLASTER: begin 	// blaster hitting wall
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    CL_BlasterParticles (pos, dir);

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.ent.angles[0] := arccos(dir[2])/M_PI*180;
    // PMM - fixed to correct for pitch of 0
    if (dir[0] <> 0) then
     // was ex^.ent.angles[1] := atan2(dir[1], dir[0])/M_PI*180
     ex^.ent.angles[1] := ArcTan2(dir[1], dir[0]) / M_PI * 180 // ???
    else if (dir[1] > 0) then ex^.ent.angles[1] := 90
    else if (dir[1] < 0) then ex^.ent.angles[1] := 270
    else ex^.ent.angles[1] := 0;

    ex^.type_ := ex_misc;
    ex^.ent.flags := RF_FULLBRIGHT or RF_TRANSLUCENT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 150;
    ex^.lightcolor[0] := 1;
    ex^.lightcolor[1] := 1;
    ex^.ent.model := cl_mod_explode;
    ex^.frames := 4;
    S_StartSound (@pos,  0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
   end;

   TE_RAILTRAIL: begin		// railgun effect
    MSG_ReadPos (net_message, pos);
    MSG_ReadPos (net_message, pos2);
    CL_RailTrail (pos, pos2);
    S_StartSound (@pos2, 0, 0, cl_sfx_railg, 1, ATTN_NORM, 0);
   end;

   TE_EXPLOSION2,
   TE_GRENADE_EXPLOSION,
   TE_GRENADE_EXPLOSION_WATER: begin
    MSG_ReadPos (net_message, pos);

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_poly;
    ex^.ent.flags := RF_FULLBRIGHT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 350;
    ex^.lightcolor[0] := 1.0;
    ex^.lightcolor[1] := 0.5;
    ex^.lightcolor[2] := 0.5;
    ex^.ent.model := cl_mod_explo4;
    ex^.frames := 19;
    ex^.baseframe := 30;
    ex^.ent.angles[1] := rand() mod 360;
    CL_ExplosionParticles (pos);
    if (temp_event_t(type_) = TE_GRENADE_EXPLOSION_WATER) then
     S_StartSound (@pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0)
    else S_StartSound (@pos, 0, 0, cl_sfx_grenexp, 1, ATTN_NORM, 0);
   end;

   // RAFAEL
   TE_PLASMA_EXPLOSION: begin
    MSG_ReadPos (net_message, pos);
    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_poly;
    ex^.ent.flags := RF_FULLBRIGHT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 350;
    ex^.lightcolor[0] := 1.0;
    ex^.lightcolor[1] := 0.5;
    ex^.lightcolor[2] := 0.5;
    ex^.ent.angles[1] := rand() mod 360;
    ex^.ent.model := cl_mod_explo4;
    if Random < 0.5 then // was (frand() < 0.5)
     ex^.baseframe := 15;
    ex^.frames := 15;
    CL_ExplosionParticles (pos);
    S_StartSound (@pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
   end;

   TE_EXPLOSION1,
   TE_EXPLOSION1_BIG,
   TE_ROCKET_EXPLOSION,
   TE_ROCKET_EXPLOSION_WATER,
   TE_EXPLOSION1_NP: begin						// PMM
    MSG_ReadPos (net_message, pos);

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_poly;
    ex^.ent.flags := RF_FULLBRIGHT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 350;
    ex^.lightcolor[0] := 1.0;
    ex^.lightcolor[1] := 0.5;
    ex^.lightcolor[2] := 0.5;
    ex^.ent.angles[1] := rand() mod 360;
    if (temp_event_t(type_) <> TE_EXPLOSION1_BIG) then				// PMM
      ex^.ent.model := cl_mod_explo4			// PMM
    else
      ex^.ent.model := cl_mod_explo4_big;
    if Random < 0.5 then // was (frand() < 0.5)
      ex^.baseframe := 15;
    ex^.frames := 15;
    if not (temp_event_t(type_) in [TE_EXPLOSION1_BIG, TE_EXPLOSION1_NP]) then		// PMM
      CL_ExplosionParticles (pos);									// PMM
    if (temp_event_t(type_) = TE_ROCKET_EXPLOSION_WATER) then
      S_StartSound (@pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0)
    else
      S_StartSound (@pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
   end;

   TE_BFG_EXPLOSION: begin
    MSG_ReadPos (net_message, pos);
    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_poly;
    ex^.ent.flags := RF_FULLBRIGHT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 350;
    ex^.lightcolor[0] := 0.0;
    ex^.lightcolor[1] := 1.0;
    ex^.lightcolor[2] := 0.0;
    ex^.ent.model := cl_mod_bfg_explo;
    ex^.ent.flags := ex^.ent.flags or RF_TRANSLUCENT;
    ex^.ent.alpha := 0.30;
    ex^.frames := 4;
   end;

   TE_BFG_BIGEXPLOSION: begin
    MSG_ReadPos (net_message, pos);
    CL_BFGExplosionParticles (pos);
   end;

   TE_BFG_LASER: CL_ParseLaser ($d0d1d2d3);

   TE_BUBBLETRAIL: begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadPos (net_message, pos2);
    CL_BubbleTrail (pos, pos2);
   end;

   TE_PARASITE_ATTACK, TE_MEDIC_CABLE_ATTACK:
    ent := CL_ParseBeam (cl_mod_parasite_segment);

   TE_BOSSTPORT: begin			// boss teleporting to station
    MSG_ReadPos (net_message, pos);
    CL_BigTeleportParticles (pos);
    S_StartSound (@pos, 0, 0, S_RegisterSound ('misc/bigtele.wav'), 1, ATTN_NONE, 0);
   end;

   TE_GRAPPLE_CABLE: ent := CL_ParseBeam2 (cl_mod_grapple_cable);

   // RAFAEL
   TE_WELDING_SPARKS: begin
    cnt := MSG_ReadByte (net_message);
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    color := MSG_ReadByte (net_message);
    CL_ParticleEffect2 (pos, dir, color, cnt);

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_flash;
    // note to self
    // we need a better no draw flag
    ex^.ent.flags := RF_BEAM;
    ex^.start := cl.frame.servertime - 0.1;
    ex^.light := 100 + (rand() mod 75);
    ex^.lightcolor[0] := 1.0;
    ex^.lightcolor[1] := 1.0;
    ex^.lightcolor[2] := 0.3;
    ex^.ent.model := cl_mod_flash;
    ex^.frames := 2;
   end;

   TE_GREENBLOOD: begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    CL_ParticleEffect2 (pos, dir, $df, 30);
   end;

   // RAFAEL
   TE_TUNNEL_SPARKS: begin
    cnt := MSG_ReadByte (net_message);
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
    color := MSG_ReadByte (net_message);
    CL_ParticleEffect3 (pos, dir, color, cnt);
   end;

  //=======
  //PGM
  // PMM -following code integrated for flechette (different color)
   TE_BLASTER2,			// green blaster hitting wall
   TE_FLECHETTE: begin 		// flechette
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);

    // PMM
    if (temp_event_t(type_) = TE_BLASTER2) then
     CL_BlasterParticles2 (pos, dir, $d0)
    else
     CL_BlasterParticles2 (pos, dir, $6f); // 75

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.ent.angles[0] := arccos(dir[2])/M_PI*180;
    // PMM - fixed to correct for pitch of 0
    if (dir[0] <> 0) then
     // was ex^.ent.angles[1] := atan2(dir[1], dir[0])/M_PI*180
     ex^.ent.angles[1] := ArcTan2(dir[1], dir[0]) / M_PI * 180 // ???
    else if (dir[1] > 0) then ex^.ent.angles[1] := 90
    else if (dir[1] < 0) then ex^.ent.angles[1] := 270
    else ex^.ent.angles[1] := 0;

    ex^.type_ := ex_misc;
    ex^.ent.flags := RF_FULLBRIGHT or RF_TRANSLUCENT;

    // PMM
    if (temp_event_t(type_) = TE_BLASTER2) then ex^.ent.skinnum := 1
    else ex^.ent.skinnum := 2; // flechette

    ex^.start := cl.frame.servertime - 100;
    ex^.light := 150;
    // PMM
    if (temp_event_t(type_) = TE_BLASTER2) then ex^.lightcolor[1] := 1
    else begin // flechette
     ex^.lightcolor[0] := 0.19;
     ex^.lightcolor[1] := 0.41;
     ex^.lightcolor[2] := 0.75;
    end;
    ex^.ent.model := cl_mod_explode;
    ex^.frames := 4;
    S_StartSound (@pos,  0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
   end;

   TE_LIGHTNING: begin
    ent := CL_ParseLightning (cl_mod_lightning);
    S_StartSound (nil, ent, CHAN_WEAPON, cl_sfx_lightning, 1, ATTN_NORM, 0);
   end;

   TE_DEBUGTRAIL: begin
    MSG_ReadPos (net_message, pos);
    MSG_ReadPos (net_message, pos2);
    CL_DebugTrail (pos, pos2);
   end;

   TE_PLAIN_EXPLOSION: begin
    MSG_ReadPos (net_message, pos);

    ex := CL_AllocExplosion ();
    VectorCopy (pos, vec3_t(ex^.ent.origin));
    ex^.type_ := ex_poly;
    ex^.ent.flags := RF_FULLBRIGHT;
    ex^.start := cl.frame.servertime - 100;
    ex^.light := 350;
    ex^.lightcolor[0] := 1.0;
    ex^.lightcolor[1] := 0.5;
    ex^.lightcolor[2] := 0.5;
    ex^.ent.angles[1] := rand() mod 360;
    ex^.ent.model := cl_mod_explo4;
    if Random < 0.5 then // was 'if (frand() < 0.5)'
     ex^.baseframe := 15;
    ex^.frames := 15;
    if (temp_event_t(type_) = TE_ROCKET_EXPLOSION_WATER) then
      S_StartSound (@pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0)
    else
      S_StartSound (@pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
   end;

   TE_FLASHLIGHT: begin
    MSG_ReadPos(net_message, pos);
    ent := MSG_ReadShort(net_message);
    CL_Flashlight(ent, pos);
   end;

   TE_FORCEWALL: begin
    MSG_ReadPos(net_message, pos);
    MSG_ReadPos(net_message, pos2);
    color := MSG_ReadByte (net_message);
    CL_ForceWall(pos, pos2, color);
   end;

   TE_HEATBEAM: ent := CL_ParsePlayerBeam (cl_mod_heatbeam);
   TE_MONSTER_HEATBEAM: ent := CL_ParsePlayerBeam (cl_mod_monster_heatbeam);

   TE_HEATBEAM_SPARKS: begin
  // cnt := MSG_ReadByte (net_message);
    cnt := 50;
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
  // r := MSG_ReadByte (net_message);
  // magnitude := MSG_ReadShort (net_message);
    r := 8;
    magnitude := 60;
    color := r and $ff;
    CL_ParticleSteamEffect (pos, dir, color, cnt, magnitude);
    S_StartSound (@pos,  0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
   end;

   TE_HEATBEAM_STEAM: begin
  // cnt := MSG_ReadByte (net_message);
    cnt := 20;
    MSG_ReadPos (net_message, pos);
    MSG_ReadDir (net_message, dir);
  // r := MSG_ReadByte (net_message);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -