📄 cl_fx.pas
字号:
MZ2_WIDOW_PLASMABEAM,
MZ2_WIDOW2_BEAMER_1,
MZ2_WIDOW2_BEAMER_2,
MZ2_WIDOW2_BEAMER_3,
MZ2_WIDOW2_BEAMER_4,
MZ2_WIDOW2_BEAMER_5,
MZ2_WIDOW2_BEAM_SWEEP_1,
MZ2_WIDOW2_BEAM_SWEEP_2,
MZ2_WIDOW2_BEAM_SWEEP_3,
MZ2_WIDOW2_BEAM_SWEEP_4,
MZ2_WIDOW2_BEAM_SWEEP_5,
MZ2_WIDOW2_BEAM_SWEEP_6,
MZ2_WIDOW2_BEAM_SWEEP_7,
MZ2_WIDOW2_BEAM_SWEEP_8,
MZ2_WIDOW2_BEAM_SWEEP_9,
MZ2_WIDOW2_BEAM_SWEEP_10,
MZ2_WIDOW2_BEAM_SWEEP_11:
begin
dl.radius := 300 + (rand() and 100);
dl.color[0] := 1;
dl.color[1] := 1;
dl.color[2] := 0;
dl.die := cl.time + 200;
end;
// ROGUE
// ======
// --- Xian's shit ends ---
end;
end;
(*
===============
CL_AddDLights
===============
*)
procedure CL_AddDLights;
var
i: integer;
dl: cdlight_p;
label
continue1, continue2;
begin
dl := @cl_dlights;
//=====
//PGM
if (vidref_val = VIDREF_GL) then
begin
for i := 0 to MAX_DLIGHTS - 1 do
begin
if (dl.radius = 0) then
goto continue1;
V_AddLight(dl.origin, dl.radius,
dl.color[0], dl.color[1], dl.color[2]);
continue1:
Inc(dl);
end;
end
else
begin
for i := 0 to MAX_DLIGHTS - 1 do
begin
if (dl.radius = 0) then
goto continue2;
// negative light in software. only black allowed
if ((dl.color[0] < 0) or (dl.color[1] < 0) or (dl.color[2] < 0)) then
begin
dl.radius := -(dl.radius);
dl.color[0] := 1;
dl.color[1] := 1;
dl.color[2] := 1;
end;
V_AddLight(dl.origin, dl.radius,
dl.color[0], dl.color[1], dl.color[2]);
continue2:
Inc(dl);
end;
end;
//PGM
//=====
end;
(*
==============================================================
PARTICLE MANAGEMENT
==============================================================
*)
(*
===============
CL_ClearParticles
===============
*)
procedure CL_ClearParticles;
var
i: integer;
begin
free_particles := @particles[0];
active_particles := nil;
for i := 0 to cl_numparticles - 2 do
particles[i].next := @particles[i + 1];
particles[cl_numparticles - 1].next := nil;
end;
(*
===============
CL_ParticleEffect
Wall impact puffs
===============
*)
procedure CL_ParticleEffect(const org, dir: vec3_t; color, count: Integer);
var
i, j: integer;
p: cparticle_p;
d: single;
begin
for i := 0 to count - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := color + (rand() and 7);
d := rand() and 31;
for j := 0 to 2 do
begin
p.org[j] := org[j] + ((rand() and 7) - 4) + d * dir[j];
p.vel[j] := crand() * 20;
end;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -1.0 / (0.5 + frand() * 0.3);
end;
end;
(*
===============
CL_ParticleEffect2
===============
*)
procedure CL_ParticleEffect2(const org, dir: vec3_t; color, count: integer);
var
i, j: integer;
p: cparticle_p;
d: single;
begin
for i := 0 to count - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := color;
d := rand() and 7;
for j := 0 to 2 do
begin
p.org[j] := org[j] + ((rand() and 7) - 4) + d * dir[j];
p.vel[j] := crand() * 20;
end;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -1.0 / (0.5 + frand() * 0.3);
end;
end;
// RAFAEL
(*
===============
CL_ParticleEffect3
===============
*)
procedure CL_ParticleEffect3(const org, dir: vec3_t; color, count: integer);
var
i, j: integer;
p: cparticle_p;
d: single;
begin
for i := 0 to count - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := color;
d := rand() and 7;
for j := 0 to 2 do
begin
p.org[j] := org[j] + ((rand() and 7) - 4) + d * dir[j];
p.vel[j] := crand() * 20;
end;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -1.0 / (0.5 + frand() * 0.3);
end;
end;
(*
===============
CL_TeleporterParticles
===============
*)
procedure CL_TeleporterParticles(ent: entity_state_p);
var
i, j: integer;
p: cparticle_p;
begin
for i := 0 to 7 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := $DB;
for j := 0 to 1 do
begin
p.org[j] := ent.origin[j] - 16 + (rand() and 31);
p.vel[j] := crand() * 14;
end;
p.org[2] := ent.origin[2] - 8 + (rand() and 7);
p.vel[2] := 80 + (rand() and 7);
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -0.5;
end;
end;
(*
===============
CL_LogoutEffect
===============
*)
procedure CL_LogoutEffect(const org: vec3_t; type_: integer);
var
i, j: integer;
p: cparticle_p;
begin
for i := 0 to 500 - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
if (type_ = MZ_LOGIN) then
p.color := $D0 + (rand() and 7) // green
else if (type_ = MZ_LOGOUT) then
p.color := $40 + (rand() and 7) // red
else
p.color := $E0 + (rand() and 7); // yellow
p.org[0] := org[0] - 16 + frand() * 32;
p.org[1] := org[1] - 16 + frand() * 32;
p.org[2] := org[2] - 24 + frand() * 56;
for j := 0 to 2 do
p.vel[j] := crand() * 20;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -1.0 / (1.0 + frand() * 0.3);
end;
end;
(*
===============
CL_ItemRespawnParticles
===============
*)
procedure CL_ItemRespawnParticles(const org: vec3_t);
var
i, j: integer;
p: cparticle_p;
begin
for i := 0 to 64 - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := $D4 + (rand() and 3); // green
p.org[0] := org[0] + crand() * 8;
p.org[1] := org[1] + crand() * 8;
p.org[2] := org[2] + crand() * 8;
for j := 0 to 2 do
p.vel[j] := crand() * 8;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY * 0.2;
p.alpha := 1.0;
p.alphavel := -1.0 / (1.0 + frand() * 0.3);
end;
end;
(*
===============
CL_ExplosionParticles
===============
*)
procedure CL_ExplosionParticles(const org: vec3_t);
var
i, j: integer;
p: cparticle_p;
begin
for i := 0 to 256 - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := $E0 + (rand() and 7);
for j := 0 to 2 do
begin
p.org[j] := org[j] + ((rand() mod 32) - 16);
p.vel[j] := (rand() mod 384) - 192;
end;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -0.8 / (0.5 + frand() * 0.3);
end;
end;
(*
===============
CL_BigTeleportParticles
===============
*)
var
colortable: array[0..3] of integer = (2 * 8, 13 * 8, 21 * 8, 18 * 8);
procedure CL_BigTeleportParticles(const org: vec3_t);
var
i: integer;
p: cparticle_p;
angle, dist: single;
begin
for i := 0 to 4096 - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := colortable[rand() and 3];
angle := M_PI * 2 * (rand() and 1023) / 1023.0;
dist := rand() and 31;
p.org[0] := org[0] + cos(angle) * dist;
p.vel[0] := cos(angle) * (70 + (rand() and 63));
p.accel[0] := -cos(angle) * 100;
p.org[1] := org[1] + sin(angle) * dist;
p.vel[1] := sin(angle) * (70 + (rand() and 63));
p.accel[1] := -sin(angle) * 100;
p.org[2] := org[2] + 8 + (rand() mod 90);
p.vel[2] := -100 + (rand() and 31);
p.accel[2] := PARTICLE_GRAVITY * 4;
p.alpha := 1.0;
p.alphavel := -0.3 / (0.5 + frand() * 0.3);
end;
end;
(*
===============
CL_BlasterParticles
Wall impact puffs
===============
*)
procedure CL_BlasterParticles(const org, dir: vec3_t);
var
i, j: integer;
p: cparticle_p;
d: single;
count: integer;
begin
count := 40;
for i := 0 to count - 1 do
begin
if (free_particles = nil) then
exit;
p := free_particles;
free_particles := p.next;
p.next := active_particles;
active_particles := p;
p.time := cl.time;
p.color := $E0 + (rand() and 7);
d := rand() and 15;
for j := 0 to 2 do
begin
p.org[j] := org[j] + ((rand() and 7) - 4) + d * dir[j];
p.vel[j] := dir[j] * 30 + crand() * 40;
end;
p.accel[0] := 0;
p.accel[1] := 0;
p.accel[2] := -PARTICLE_GRAVITY;
p.alpha := 1.0;
p.alphavel := -1.0 / (0.5 + frand() * 0.3);
end;
end;
(*
===============
CL_BlasterTrail
===============
*)
procedure CL_BlasterTrail(const start, end_: vec3_t);
var
move, vec: vec3_t;
len: single;
j: integer;
p: cparticle_p;
dec: integer;
begin
VectorCopy(start, move);
VectorSubtract(end_, start, vec);
len := VectorNormalize(vec);
dec := 5;
VectorScale(vec, 5, vec);
// FIXME: this is a really silly way to have a loop
while (len > 0) do
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -