Added standard teleports to line prediction

- Added standard teleports to line prediction
- Menudef for line special prediction
This commit is contained in:
Edward Richardson 2014-08-26 22:29:39 +12:00
parent 53b6e7d4d5
commit 9e68983b44
3 changed files with 20 additions and 11 deletions

View File

@ -422,7 +422,8 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType)
BYTE special; BYTE special;
// Only predict a very specifc section of specials // Only predict a very specifc section of specials
if (line->special != Teleport_Line) if (line->special != Teleport_Line &&
line->special != Teleport)
{ {
return false; return false;
} }

View File

@ -96,6 +96,8 @@ void P_SpawnTeleportFog(fixed_t x, fixed_t y, fixed_t z, int spawnid)
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
bool useFog, bool sourceFog, bool keepOrientation, bool bHaltVelocity, bool keepHeight) bool useFog, bool sourceFog, bool keepOrientation, bool bHaltVelocity, bool keepHeight)
{ {
bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
fixed_t oldx; fixed_t oldx;
fixed_t oldy; fixed_t oldy;
fixed_t oldz; fixed_t oldz;
@ -181,19 +183,22 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
angle = thing->angle; angle = thing->angle;
} }
// Spawn teleport fog at source and destination // Spawn teleport fog at source and destination
if (sourceFog) if (sourceFog && !predicting)
{ {
fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
AActor *fog = Spawn<ATeleportFog> (oldx, oldy, oldz + fogDelta, ALLOW_REPLACE); AActor *fog = Spawn<ATeleportFog> (oldx, oldy, oldz + fogDelta, ALLOW_REPLACE);
fog->target = thing; fog->target = thing;
} }
if (useFog) if (useFog)
{
if (!predicting)
{ {
fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
an = angle >> ANGLETOFINESHIFT; an = angle >> ANGLETOFINESHIFT;
AActor *fog = Spawn<ATeleportFog> (x + 20*finecosine[an], AActor *fog = Spawn<ATeleportFog>(x + 20 * finecosine[an],
y + 20*finesine[an], thing->z + fogDelta, ALLOW_REPLACE); y + 20 * finesine[an], thing->z + fogDelta, ALLOW_REPLACE);
fog->target = thing; fog->target = thing;
}
if (thing->player) if (thing->player)
{ {
// [RH] Zoom player's field of vision // [RH] Zoom player's field of vision
@ -226,7 +231,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
return true; return true;
} }
static AActor *SelectTeleDest (int tid, int tag) static AActor *SelectTeleDest (int tid, int tag, bool norandom)
{ {
AActor *searcher; AActor *searcher;
@ -276,7 +281,7 @@ static AActor *SelectTeleDest (int tid, int tag)
} }
else else
{ {
if (count != 1) if (count != 1 && !norandom)
{ {
count = 1 + (pr_teleport() % count); count = 1 + (pr_teleport() % count);
} }
@ -323,6 +328,8 @@ static AActor *SelectTeleDest (int tid, int tag)
bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog,
bool sourceFog, bool keepOrientation, bool haltVelocity, bool keepHeight) bool sourceFog, bool keepOrientation, bool haltVelocity, bool keepHeight)
{ {
bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
AActor *searcher; AActor *searcher;
fixed_t z; fixed_t z;
angle_t angle = 0; angle_t angle = 0;
@ -342,7 +349,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
{ // Don't teleport if hit back of line, so you can get out of teleporter. { // Don't teleport if hit back of line, so you can get out of teleporter.
return 0; return 0;
} }
searcher = SelectTeleDest (tid, tag); searcher = SelectTeleDest(tid, tag, predicting);
if (searcher == NULL) if (searcher == NULL)
{ {
return false; return false;
@ -390,7 +397,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
thing->velx = FixedMul(velx, c) - FixedMul(vely, s); thing->velx = FixedMul(velx, c) - FixedMul(vely, s);
thing->vely = FixedMul(vely, c) + FixedMul(velx, s); thing->vely = FixedMul(vely, c) + FixedMul(velx, s);
} }
if ((velx | vely) == 0 && thing->player != NULL && thing->player->mo == thing) if ((velx | vely) == 0 && thing->player != NULL && thing->player->mo == thing && !predicting)
{ {
thing->player->mo->PlayIdle (); thing->player->mo->PlayIdle ();
} }

View File

@ -1611,6 +1611,7 @@ OptionMenu NetworkOptions
Title "NETWORK OPTIONS" Title "NETWORK OPTIONS"
StaticText "Local options", 1 StaticText "Local options", 1
Option "Movement prediction", "cl_noprediction", "OffOn" Option "Movement prediction", "cl_noprediction", "OffOn"
Option "Predict line actions", "cl_predict_specials", "OnOff"
StaticText " " StaticText " "
StaticText "Host options", 1 StaticText "Host options", 1
Option "Extra Tics", "net_extratic", "ExtraTicMode" Option "Extra Tics", "net_extratic", "ExtraTicMode"