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

📄 cl_tent.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 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);
        // magnitude := MSG_ReadShort (net_message);
        // color := r & $ff;
        color := $E0;
        magnitude := 60;
        CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude);
        S_StartSound(@pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
      end;

    TE_STEAM: CL_ParseSteam();

    TE_BUBBLETRAIL2:
      begin
        // cnt := MSG_ReadByte (net_message);
        cnt := 8;
        MSG_ReadPos(net_message, pos);
        MSG_ReadPos(net_message, pos2);
        CL_BubbleTrail2(pos, pos2, cnt);
        S_StartSound(@pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
      end;

    TE_MOREBLOOD:
      begin
        MSG_ReadPos(net_message, pos);
        MSG_ReadDir(net_message, dir);
        CL_ParticleEffect(pos, dir, $E8, 250);
      end;

    TE_CHAINFIST_SMOKE:
      begin
        dir[0] := 0;
        dir[1] := 0;
        dir[2] := 1;
        MSG_ReadPos(net_message, pos);
        CL_ParticleSmokeEffect(pos, dir, 0, 20, 20);
      end;

    TE_ELECTRIC_SPARKS:
      begin
        MSG_ReadPos(net_message, pos);
        MSG_ReadDir(net_message, dir);
        // CL_ParticleEffect (pos, dir, 109, 40);
        CL_ParticleEffect(pos, dir, $75, 40);
        //FIXME : replace or remove this sound
        S_StartSound(@pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
      end;

    TE_TRACKER_EXPLOSION:
      begin
        MSG_ReadPos(net_message, pos);
        CL_ColorFlash(pos, 0, 150, -1, -1, -1);
        CL_ColorExplosionParticles(pos, 0, 1);
        // CL_Tracker_Explode (pos);
        S_StartSound(@pos, 0, 0, cl_sfx_disrexp, 1, ATTN_NORM, 0);
      end;

    TE_TELEPORT_EFFECT, TE_DBALL_GOAL:
      begin
        MSG_ReadPos(net_message, pos);
        CL_TeleportParticles(pos);
      end;

    TE_WIDOWBEAMOUT: CL_ParseWidow();
    TE_NUKEBLAST: CL_ParseNuke();

    TE_WIDOWSPLASH:
      begin
        MSG_ReadPos(net_message, pos);
        CL_WidowSplash(pos);
      end;
    //PGM
    //=======
  else
    Com_Error(ERR_DROP, 'CL_ParseTEnt: bad type');
  end;
end;

{
=========
CL_AddBeams
=========
}

procedure CL_AddBeams;
var
  i, j: Integer;
  b: Beam_p;
  Dist, Org: Vec3_t;
  d: Single;
  Ent: Entity_t;
  Yaw, Pitch, Forward_, Len, Steps, Model_length: Single;
begin
  // update beams
  for i := 0 to MAX_BEAMS - 1 do
  begin
    b := @cl_beams[i];
    if (b^.model = nil) or (b^.endtime < cl.time) then
      continue;

    // if coming from the player, update the start position
    if b^.entity = (cl.playernum + 1) then
    begin                               // entity 0 is the world
      VectorCopy(vec3_t(cl.refdef.vieworg), b.start);
      b^.Start[2] := b^.Start[2] - 22;  // adjust for view height
    end;
    VectorAdd(b^.start, b^.offset, org);

    // calculate pitch and yaw
    VectorSubtract(b^.end_, org, dist);

    if (dist[1] = 0) and (dist[0] = 0) then
    begin
      yaw := 0;
      if (dist[2] > 0) then
        pitch := 90
      else
        pitch := 270;
    end
    else
    begin
      // PMM - fixed to correct for pitch of 0
      if (dist[0] <> 0) then
        // was yaw := (atan2(dist[1], dist[0]) * 180 / M_PI)
        yaw := (ArcTan2(dist[1], dist[0]) * 180 / M_PI)
      else if (dist[1] > 0) then
        yaw := 90
      else
        yaw := 270;
      if (yaw < 0) then
        Yaw := Yaw + 360;

      forward_ := sqrt(Sqr(dist[0]) + Sqr(dist[1]));
      pitch := (ArcTan(dist[2] / forward_) * -180.0 / M_PI);
      if (pitch < 0) then
        Pitch := Pitch + 360;
    end;

    // add new entities for the beams
    d := VectorNormalize(dist);

⌨️ 快捷键说明

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