📄 p_view.pas
字号:
end;
{$IFDEF CTF}
//ZOID
CTFEffects(ent);
if (ent^.client^.quad_framenum > level.framenum) AND (level.framenum & 8) then
//ZOID
{$ELSE}
if (ent^.client^.quad_framenum > level.framenum) then
{$ENDIF}
begin
remaining := trunc(ent^.client^.quad_framenum - level.framenum);
if (remaining > 30) OR ((remaining and 4) <> 0) then
ent^.s.effects := ent^.s.effects OR EF_QUAD;
end;
{$IFDEF CTF}
//ZOID
if (ent^.client^.invincible_framenum > level.framenum) AND (level.framenum & 8) then
//ZOID
{$ELSE}
if (ent^.client^.invincible_framenum > level.framenum) then
{$ENDIF}
begin
remaining := trunc(ent^.client^.invincible_framenum - level.framenum);
if (remaining > 30) OR ((remaining and 4) <> 0) then
ent^.s.effects := ent^.s.effects OR EF_PENT;
end;
// show cheaters!!!
if (ent^.flags AND FL_GODMODE) <> 0 then
begin
ent^.s.effects := ent^.s.effects OR EF_COLOR_SHELL;
ent^.s.renderfx := ent^.s.renderfx OR (RF_SHELL_RED OR RF_SHELL_GREEN OR RF_SHELL_BLUE);
end;
end;
{*
===============
G_SetClientEvent
===============
*}
procedure G_SetClientEvent (ent : edict_p); //only imp
begin
if (@ent^.s.event <> nil) then
Exit;
if (ent^.groundentity <> nil) and (xyspeed > 225) then
if ( trunc(current_client^.bobtime + bobmove) <> bobcycle ) then
ent^.s.event := EV_FOOTSTEP;
end;
{*
===============
G_SetClientSound
===============
*}
procedure G_SetClientSound (ent : edict_p); //only imp
var
weap : PChar;
begin
{$IFDEF CTF}
if (ent^.client^.resp.game_helpchanged <> game.helpchanged) then
begin
ent^.client^.resp.game_helpchanged := game.helpchanged;
ent^.client^.resp.helpchanged := 1;
end;
// help beep (no more than three times)
if (ent^.client^.resp.helpchanged) AND (ent^.client^.resp.helpchanged <= 3) AND ((level.framenum AND 63) = 0) ) then
begin
Inc(ent^.client^.resp.helpchanged);
gi.sound (ent, CHAN_VOICE, gi.soundindex ('misc/pc_up.wav'), 1, ATTN_STATIC, 0);
end;
{$ELSE}
if (ent^.client^.pers.game_helpchanged <> game.helpchanged) then
begin
ent^.client^.pers.game_helpchanged := game.helpchanged;
ent^.client^.pers.helpchanged := 1;
end;
// help beep (no more than three times)
if (ent^.client^.pers.helpchanged <> 0) and (ent^.client^.pers.helpchanged <= 3) and ((level.framenum and 63) = 0) then
begin
ent^.client^.pers.helpchanged := ent^.client^.pers.helpchanged + 1;
gi.sound (ent, CHAN_VOICE, gi.soundindex ('misc/pc_up.wav'), 1, ATTN_STATIC, 0);
end;
{$ENDIF}
if (ent^.client^.pers.weapon <> Nil) then
weap := ent^.client^.pers.weapon^.classname
else
weap := '';
if (ent^.waterlevel <> 0) and ((ent^.watertype and (CONTENTS_LAVA or CONTENTS_SLIME)) <> 0) then
ent^.s.sound := snd_fry
else if (strcmp(weap, 'weapon_railgun') = 0) then
ent^.s.sound := gi.soundindex('weapons/rg_hum.wav')
else if (strcmp(weap, 'weapon_bfg') = 0) then
ent^.s.sound := gi.soundindex('weapons/bfg_hum.wav')
else if (ent^.client^.weapon_sound <> 0) then
ent^.s.sound := ent^.client^.weapon_sound
else
ent^.s.sound := 0;
end;
{*
===============
G_SetClientFrame
===============
*}
procedure G_SetClientFrame (ent : edict_p); //only imp
var
client : gclient_p;
duck, run : qboolean;
label
newanim;
begin
if (ent^.s.modelindex <> 255) then
Exit; // not in the player model
client := ent^.client;
if (client^.ps.pmove.pm_flags AND PMF_DUCKED) <> 0 then
duck := true
else
duck := false;
if (xyspeed <> 0) then
run := true
else
run := false;
// check for stand/duck and stop/go transitions
if (duck <> client^.anim_duck) AND (client^.anim_priority < ANIM_DEATH) then
goto newanim;
if (run <> client^.anim_run) AND (client^.anim_priority = ANIM_BASIC) then
goto newanim;
if (ent^.groundentity = Nil) AND (client^.anim_priority <= ANIM_WAVE) then
goto newanim;
if(client^.anim_priority = ANIM_REVERSE) then
begin
if (ent^.s.frame > client^.anim_end) then
begin
Dec(ent^.s.frame);
Exit;
end
end
else if (ent^.s.frame < client^.anim_end) then
begin
// continue an animation
Inc(ent^.s.frame);
Exit;
end;
if (client^.anim_priority = ANIM_DEATH) then
Exit; // stay there
if (client^.anim_priority = ANIM_JUMP) then
begin
if (ent^.groundentity = Nil) then
Exit; // stay there
ent^.client^.anim_priority := ANIM_WAVE;
ent^.s.frame := FRAME_jump3;
ent^.client^.anim_end := FRAME_jump6;
Exit;
end;
newanim:
// return to either a running or standing frame
client^.anim_priority := ANIM_BASIC;
client^.anim_duck := duck;
client^.anim_run := run;
if (ent^.groundentity = Nil) then
begin
{$IFDEF CTF}
//ZOID: if on grapple, don't go into jump frame, go into standing
//frame
if (client.ctf_grapple) then
begin
ent.s.frame := FRAME_stand01;
client.anim_end := FRAME_stand40;
end
else begin
//ZOID
client.anim_priority := ANIM_JUMP;
if (ent.s.frame <> FRAME_jump2) then
ent.s.frame := FRAME_jump1;
client.anim_end := FRAME_jump2;
end;
{$ELSE}
client^.anim_priority := ANIM_JUMP;
if (ent^.s.frame <> FRAME_jump2) then
ent^.s.frame := FRAME_jump1;
client^.anim_end := FRAME_jump2;
{$ENDIF}
end
else if (run) then
begin
// running
if (duck) then
begin
ent^.s.frame := FRAME_crwalk1;
client^.anim_end := FRAME_crwalk6;
end
else
begin
ent^.s.frame := FRAME_run1;
client^.anim_end := FRAME_run6;
end
end
else
begin
// standing
if (duck) then
begin
ent^.s.frame := FRAME_crstnd01;
client^.anim_end := FRAME_crstnd19;
end
else begin
ent^.s.frame := FRAME_stand01;
client^.anim_end := FRAME_stand40;
end;
end;
end;//procedure (GAME <> CTF)
{*
=================
ClientEndServerFrame
Called for each player at the end of the server frame
and right after spawning
=================
*}
procedure ClientEndServerFrame (ent : edict_p); //for p_client
var
bobtime : Single;
i : integer;
{$IFDEF CTF}
e : edict_p;
{$ENDIF}
begin
current_player := ent;
current_client := ent^.client;
//
// If the origin or velocity have changed since ClientThink(),
// update the pmove values. This will happen when the client
// is pushed by a bmodel or kicked by an explosion.
//
// If it wasn't updated here, the view position would lag a frame
// behind the body position when pushed -- "sinking into plats"
//
for i := 0 to 2 do
begin
current_client^.ps.pmove.origin[i] := trunc(ent^.s.origin[i] * 8.0);
current_client^.ps.pmove.velocity[i] := trunc(ent^.velocity[i] * 8.0);
end;
//
// If the end of unit layout is displayed, don't give
// the player any normal movement attributes
//
if (level.intermissiontime <> 0) then
begin
// FIXME: add view drifting here?
current_client^.ps.blend[3] := 0;
current_client^.ps.fov := 90;
G_SetStats (ent);
Exit;
end;
AngleVectors (ent^.client^.v_angle, @forward_, @right, @up);
// burn from lava, etc
P_WorldEffects ();
//
// set model angles from view angles so other things in
// the world can tell which direction you are looking
//
if (ent^.client^.v_angle[PITCH] > 180) then
ent^.s.angles[PITCH] := (-360 + ent^.client^.v_angle[PITCH])/3
else
ent^.s.angles[PITCH] := ent^.client^.v_angle[PITCH]/3;
ent^.s.angles[YAW] := ent^.client^.v_angle[YAW];
ent^.s.angles[ROLL] := 0;
ent^.s.angles[ROLL] := SV_CalcRoll (ent^.s.angles, ent^.velocity)*4;
//
// calculate speed and cycle to be used for
// all cyclic walking effects
//
xyspeed := sqrt(ent^.velocity[0]*ent^.velocity[0] + ent^.velocity[1]*ent^.velocity[1]);
if (xyspeed < 5) then
begin
bobmove := 0;
current_client^.bobtime := 0; // start at beginning of cycle again
end
else if (ent^.groundentity <> Nil) then
begin
// so bobbing only cycles when on ground
if (xyspeed > 210) then
bobmove := 0.25
else if (xyspeed > 100) then
bobmove := 0.125
else
bobmove := 0.0625;
end;
current_client^.bobtime := current_client^.bobtime + bobmove;
bobtime := current_client^.bobtime;
if (current_client^.ps.pmove.pm_flags AND PMF_DUCKED) <> 0 then
bobtime := bobtime * 4;
bobcycle := Trunc(bobtime);
bobfracsin := abs(sin(bobtime*M_PI));
// detect hitting the floor
P_FallingDamage (ent);
// apply all the damage taken this frame
P_DamageFeedback (ent);
// determine the view offsets
SV_CalcViewOffset (ent);
// determine the gun offsets
SV_CalcGunOffset (ent);
// determine the full screen color blend
// must be after viewoffset, so eye contents can be
// accurately determined
// FIXME: with client prediction, the contents
// should be determined by the client
SV_CalcBlend (ent);
{$IFDEF CTF}
//ZOID
if (ent^.client^.chase_target=Nil) then
//ZOID
G_SetStats (ent);
//ZOID
//update chasecam follower stats
for i:=1 to Trunc(maxclients.value) do
begin
// edict_t *e = g_edicts + i;
if (NOT e.inuse) OR (e.client.chase_target <> ent) then
Continue;
memcpy (e.client.ps.stats,
ent.client.ps.stats,
sizeof(ent.client.ps.stats));
e.client.ps.stats[STAT_LAYOUTS] := 1;
Break;
end;
//ZOID
{$ELSE}
// chase cam stuff
if (ent^.client^.resp.spectator) then
G_SetSpectatorStats(ent)
else
G_SetStats (ent);
G_CheckChaseStats(ent);
{$ENDIF}
G_SetClientEvent (ent);
G_SetClientEffects (ent);
G_SetClientSound (ent);
G_SetClientFrame (ent);
VectorCopy (ent^.velocity, ent^.client^.oldvelocity);
VectorCopy (ent^.client^.ps.viewangles, ent^.client^.oldviewangles);
// clear weapon kicks
VectorClear (ent^.client^.kick_origin);
VectorClear (ent^.client^.kick_angles);
// if the scoreboard is up, update it
// if (ent.client.showscores) && !(level.framenum & 31) ) then
if (ent^.client^.showscores) AND ((level.framenum AND 31) = 0) then
begin
{$IFDEF CTF}
//ZOID
if (ent^.client^.menu)
then begin
PMenu_Do_Update(ent);
ent^.client^.menudirty := false;
ent^.client^.menutime := level.time;
end
else DeathmatchScoreboardMessage (ent, ent^.enemy);
gi.unicast (ent, false);
//ZOID
{$ELSE}
DeathmatchScoreboardMessage (ent, ent^.enemy);
gi.unicast (ent, false);
{$ENDIF}
end;//if
end;//procedure (GAME <> CTF)
// End of file
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -