Skip to content

Commit

Permalink
ticrate fixes in zscript
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and madame-rachelle committed Dec 22, 2022
1 parent 9376c4d commit 4eb1f57
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 55 deletions.
6 changes: 3 additions & 3 deletions wadsrc/static/zscript/actors/actor.zs
Expand Up @@ -86,7 +86,7 @@ class Actor : Thinker native
const LARGE_MASS = 10000000; // not INT_MAX on purpose
const ORIG_FRICTION = (0xE800/65536.); // original value
const ORIG_FRICTION_FACTOR = (2048/65536.); // original value
const DEFMORPHTICS = 40 * TICRATE;
//const DEFMORPHTICS = 40 * TICRATE;
const MELEEDELTA = 20;


Expand Down Expand Up @@ -1146,8 +1146,8 @@ class Actor : Thinker native
native void A_FadeOut(double reduce = 0.1, int flags = 1); //bool remove == true
native void A_FadeTo(double target, double amount = 0.1, int flags = 0);
native void A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, double mult_h = 1, double mult_v = 1);
native void A_SpawnParticle(color color1, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
native void A_SpawnParticleEx(color color1, TextureID texture, int style = STYLE_None, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0, double startroll = 0, double rollvel = 0, double rollacc = 0);
native void A_SpawnParticle(color color1, int flags = 0, int lifetime = DEFAULT_TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
native void A_SpawnParticleEx(color color1, TextureID texture, int style = STYLE_None, int flags = 0, int lifetime = DEFAULT_TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0, double startroll = 0, double rollvel = 0, double rollacc = 0);
native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
native void A_DropInventory(class<Inventory> itemtype, int amount = -1);
native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.);
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/heretic/ironlich.zs
Expand Up @@ -123,7 +123,7 @@ class Ironlich : Actor
{
mo.AddZ(-32);
mo.tracer = targ;
mo.health = 20*TICRATE; // Duration
mo.health = 20*GameTicRate; // Duration
A_StartSound ("ironlich/attack3", CHAN_BODY);
}
}
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/heretic/weaponphoenix.zs
Expand Up @@ -66,7 +66,7 @@ class PhoenixRod : Weapon

class PhoenixRodPowered : PhoenixRod
{
const FLAME_THROWER_TICS = (10*TICRATE);
//const FLAME_THROWER_TICS = (10*TICRATE);

private int FlameCount; // for flamethrower duration

Expand Down Expand Up @@ -113,7 +113,7 @@ class PhoenixRodPowered : PhoenixRod
PhoenixRodPowered flamethrower = PhoenixRodPowered(player.ReadyWeapon);
if (flamethrower != null)
{
flamethrower.FlameCount = FLAME_THROWER_TICS;
flamethrower.FlameCount = (10*GameTicRate) /*FLAME_THROWER_TICS*/;
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions wadsrc/static/zscript/actors/hexen/heresiarch.zs
Expand Up @@ -26,7 +26,7 @@ class Heresiarch : Actor
const SORCBALL_SPEED_ROTATIONS = 5;
const SORC_DEFENSE_TIME = 255;
const SORC_DEFENSE_HEIGHT = 45;
const BOUNCE_TIME_UNIT = (35/2);
//const BOUNCE_TIME_UNIT = (35/2);
const SORCFX4_RAPIDFIRE_TIME = (6*3); // 3 seconds
const SORCFX4_SPREAD_ANGLE = 20;

Expand Down Expand Up @@ -453,7 +453,7 @@ class SorcBall : Actor
Actor mo = parent.SpawnMissileAngle("SorcFX4", ang1, 0);
if (mo)
{
mo.special2 = 35*5/2; // 5 seconds
mo.special2 = (gameTicRate * 5) /2; // 5 seconds
double dist = mo.DistanceBySpeed(dest, mo.Speed);
mo.Vel.Z = (dest.pos.z - mo.pos.z) / dist;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ class SorcBall : Actor
Vel.X = random[Heresiarch](-5, 4);
Vel.Y = random[Heresiarch](-5, 4);
Vel.Z = random[Heresiarch](2, 4);
args[4] = Heresiarch.BOUNCE_TIME_UNIT; // Bounce time unit
args[4] = (GameTicRate / 2) /*BOUNCE_TIME_UNIT*/;
args[3] = 5; // Bounce time in seconds
}

Expand All @@ -553,7 +553,7 @@ class SorcBall : Actor
}
else
{
args[4] = Heresiarch.BOUNCE_TIME_UNIT;
args[4] = (GameTicRate / 2) /*BOUNCE_TIME_UNIT*/;
}
}
}
Expand Down Expand Up @@ -608,15 +608,15 @@ class SorcBall1 : SorcBall
{
mo.target = parent;
mo.tracer = parent.target;
mo.args[4] = Heresiarch.BOUNCE_TIME_UNIT;
mo.args[4] = (GameTicRate / 2) /*BOUNCE_TIME_UNIT*/;
mo.args[3] = 15; // Bounce time in seconds
}
mo = parent.SpawnMissileAngle (cls, ang2, 0);
if (mo)
{
mo.target = parent;
mo.tracer = parent.target;
mo.args[4] = Heresiarch.BOUNCE_TIME_UNIT;
mo.args[4] = (GameTicRate / 2) /*BOUNCE_TIME_UNIT*/;
mo.args[3] = 15; // Bounce time in seconds
}
}
Expand Down Expand Up @@ -823,7 +823,7 @@ class SorcFX1 : Actor
}
else
{
args[4] = Heresiarch.BOUNCE_TIME_UNIT;
args[4] = (GameTicRate / 2) /*BOUNCE_TIME_UNIT*/;
}
}
A_SeekerMissile(2, 6);
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/hexen/korax.zs
Expand Up @@ -36,7 +36,7 @@ class Korax : Actor
const KORAX_COMMAND_HEIGHT = 120;
const KORAX_COMMAND_OFFSET = 27;

const KORAX_SPIRIT_LIFETIME = 5*TICRATE/5; // 5 seconds
//const KORAX_SPIRIT_LIFETIME = 5*TICRATE/5; // 5 seconds

Default
{
Expand Down Expand Up @@ -226,7 +226,7 @@ class Korax : Actor

private void KSpiritInit (Actor spirit)
{
spirit.health = KORAX_SPIRIT_LIFETIME;
spirit.health = (5*GameTicRate/5) /*KORAX_SPIRIT_LIFETIME*/;

spirit.tracer = self; // Swarm around korax
spirit.WeaveIndexZ = random[Kspiritnit](32, 39); // Float bob index
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/inventory/powerups.zs
Expand Up @@ -1353,7 +1353,7 @@ class PowerTargeter : Powerup
let player = Owner.player;

PositionAccuracy ();
if (EffectTics < 5*TICRATE)
if (EffectTics < 5*GameTicRate)
{
let stat = FindState("Targeter");

Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/morph.zs
Expand Up @@ -128,7 +128,7 @@ extend class Actor
morphed.RenderStyle = RenderStyle;
morphed.Score = Score;

morphed.UnmorphTime = level.time + ((duration) ? duration : DEFMORPHTICS) + random[morphmonst]();
morphed.UnmorphTime = level.time + ((duration) ? duration : (40 * GameTicRate) /*DEFMORPHTICS*/) + random[morphmonst]();
morphed.MorphStyle = style;
morphed.MorphExitFlash = (exit_flash) ? exit_flash : (class<Actor>)("TeleportFog");
morphed.FlagsSave = bSolid * 2 + bShootable * 4 + bInvisible * 0x40; // The factors are for savegame compatibility
Expand Down
6 changes: 3 additions & 3 deletions wadsrc/static/zscript/actors/player/player.zs
Expand Up @@ -14,7 +14,7 @@ class PlayerPawn : Actor
{
const CROUCHSPEED = (1./12);
// [RH] # of ticks to complete a turn180
const TURN180_TICKS = ((TICRATE / 4) + 1);
//const TURN180_TICKS = ((TICRATE / 4) + 1);
// 16 pixels of bob
const MAXBOB = 16.;

Expand Down Expand Up @@ -1250,7 +1250,7 @@ class PlayerPawn : Actor
if (player.turnticks)
{
player.turnticks--;
Angle += (180. / TURN180_TICKS);
Angle += (180. / ((GameTicRate / 4) + 1) /*TURN180_TICKS*/);
}
else
{
Expand Down Expand Up @@ -1486,7 +1486,7 @@ class PlayerPawn : Actor
// [RH] Check for fast turn around
if (player.cmd.buttons & BT_TURN180 && !(player.oldbuttons & BT_TURN180))
{
player.turnticks = TURN180_TICKS;
player.turnticks = ((GameTicRate / 4) + 1) /*TURN180_TICKS*/;
}

// Handle movement
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/player/player_inventory.zs
Expand Up @@ -78,7 +78,7 @@ extend class PlayerPawn
}
if (InvSel) InvSel.DisplayNameTag();
}
player.inventorytics = 5*TICRATE;
player.inventorytics = 5*GameTicRate;
if (old != InvSel)
{
A_StartSound("misc/invchange", CHAN_AUTO, CHANF_DEFAULT, 1., ATTN_NONE);
Expand Down
6 changes: 3 additions & 3 deletions wadsrc/static/zscript/actors/player/player_morph.zs
Expand Up @@ -120,7 +120,7 @@ extend class PlayerPawn
if (player.morphTics)
{ // Player is already a beast
if ((GetClass() == spawntype) && bCanSuperMorph
&& (player.morphTics < (((duration) ? duration : DEFMORPHTICS) - TICRATE))
&& (player.morphTics < (((duration) ? duration : (40 * GameTicRate) /*DEFMORPHTICS*/) - GameTicRate))
&& FindInventory('PowerWeaponLevel2', true) == null)
{ // Make a super chicken
GiveInventoryType ('PowerWeaponLevel2');
Expand Down Expand Up @@ -192,7 +192,7 @@ extend class PlayerPawn
bUnmorphed = true;
bInvisible = true;

p.morphTics = (duration) ? duration : DEFMORPHTICS;
p.morphTics = (duration) ? duration : (40 * GameTicRate) /*DEFMORPHTICS*/;

// [MH] Used by SBARINFO to speed up face drawing
p.MorphedPlayerClass = spawntype;
Expand Down Expand Up @@ -261,7 +261,7 @@ extend class PlayerPawn
{ // Didn't fit
altmo.bSolid = false;
bSolid = true;
player.morphTics = 2*TICRATE;
player.morphTics = 2*GameTicRate;
return false;
}

Expand Down
10 changes: 5 additions & 5 deletions wadsrc/static/zscript/actors/raven/minotaur.zs
@@ -1,6 +1,6 @@
class Minotaur : Actor
{
const MAULATORTICS = 25 * TICRATE;
//const MAULATORTICS = 25 * TICRATE;
const MNTR_CHARGE_SPEED =13.;
const MINOTAUR_LOOK_DIST = 16*54.;

Expand Down Expand Up @@ -223,7 +223,7 @@ class Minotaur : Actor
}
A_FaceTarget ();
VelFromAngle(MNTR_CHARGE_SPEED);
special1 = TICRATE/2; // Charge duration
special1 = GameTicRate/2; // Charge duration
}
else if (target.pos.z == target.floorz
&& dist < 9*64.
Expand Down Expand Up @@ -396,7 +396,7 @@ class Minotaur : Actor
let mf = MinotaurFriend(self);
if (mf)
{
if (mf.StartTime >= 0 && (level.maptime - mf.StartTime) >= MAULATORTICS)
if (mf.StartTime >= 0 && (level.maptime - mf.StartTime) >= (25 * GameTicRate) /*MAULATORTICS*/)
{
DamageMobj (null, null, TELEFRAG_DAMAGE, 'None');
return;
Expand Down Expand Up @@ -517,7 +517,7 @@ class Minotaur : Actor
// In case pain caused him to skip his fade in.
A_SetRenderStyle(1, STYLE_Normal);

if (mf.StartTime >= 0 && (level.maptime - mf.StartTime) >= MAULATORTICS)
if (mf.StartTime >= 0 && (level.maptime - mf.StartTime) >= (25 * GameTicRate) /*MAULATORTICS*/)
{
DamageMobj (null, null, TELEFRAG_DAMAGE, 'None');
return;
Expand Down Expand Up @@ -628,7 +628,7 @@ class MinotaurFriend : Minotaur
// [RH] Minotaurs can't be morphed, so this isn't needed
//if (!(mo.flags&MF_COUNTKILL)) continue; // for morphed minotaurs
if (mo.bCorpse) continue;
if (mo.StartTime >= 0 && (level.maptime - StartTime) >= MAULATORTICS) continue;
if (mo.StartTime >= 0 && (level.maptime - StartTime) >= (25 * GameTicRate) /*MAULATORTICS*/) continue;
if (mo.tracer != null && mo.tracer.player == tracer.player) break;
}

Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/shared/bridge.zs
Expand Up @@ -56,8 +56,8 @@ class BridgeBall : Actor
// If the bridge is custom, set non-default values if any.

// Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1°
if (target.args[3] > 128) rotationspeed = 45. / 32 * (target.args[3] - 256) / TICRATE;
else if (target.args[3] > 0) rotationspeed = 45. / 32 * (target.args[3]) / TICRATE;
if (target.args[3] > 128) rotationspeed = 45. / 32 * (target.args[3] - 256) / GameTicRate;
else if (target.args[3] > 0) rotationspeed = 45. / 32 * (target.args[3]) / GameTicRate;
// Set rotation radius
if (target.args[4]) rotationradius = ((target.args[4] * target.radius) / 100);

Expand Down
6 changes: 3 additions & 3 deletions wadsrc/static/zscript/actors/shared/camera.zs
Expand Up @@ -30,7 +30,7 @@ class SecurityCamera : Actor
Super.PostBeginPlay ();
Center = Angle;
if (args[2])
Delta = 360. / (args[2] * TICRATE / 8);
Delta = 360. / (args[2] * GameTicRate / 8);
else
Delta = 0.;
if (args[1])
Expand Down Expand Up @@ -63,8 +63,8 @@ class AimingCamera : SecurityCamera

args[2] = 0;
Super.PostBeginPlay ();
MaxPitchChange = double(changepitch) / TICRATE;
Range /= TICRATE;
MaxPitchChange = double(changepitch) / GameTicRate;
Range /= GameTicRate;

ActorIterator it = Level.CreateActorIterator(args[3]);
tracer = it.Next ();
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/shared/ice.zs
Expand Up @@ -122,7 +122,7 @@ extend class Actor
{
if (Vel != (0,0,0) && !bShattering)
{
tics = 3*TICRATE;
tics = 3*GameTicRate;
return;
}
Vel = (0,0,0);
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/shared/movingcamera.zs
Expand Up @@ -269,7 +269,7 @@ class PathFollower : Actor
bJustStepped = false;
if (CurrNode.args[2])
{
HoldTime = Level.maptime + CurrNode.args[2] * TICRATE / 8;
HoldTime = Level.maptime + CurrNode.args[2] * GameTicRate / 8;
SetXYZ(CurrNode.Pos);
}
}
Expand All @@ -293,7 +293,7 @@ class PathFollower : Actor

if (Interpolate ())
{
Time += (8. / (max(1, CurrNode.args[1]) * TICRATE));
Time += (8. / (max(1, CurrNode.args[1]) * GameTicRate));
if (Time > 1.)
{
Time -= 1.;
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/strife/programmer.zs
Expand Up @@ -207,7 +207,7 @@ class ProgLevelEnder : Inventory
{
if (special2 == 0)
{ // fade out over .66 second
special1 += 255 / (TICRATE*2/3);
special1 += 255 / (GameTicRate*2/3);
if (++special1 >= 255)
{
special1 = 255;
Expand All @@ -217,7 +217,7 @@ class ProgLevelEnder : Inventory
}
else
{ // fade in over two seconds
special1 -= 255 / (TICRATE*2);
special1 -= 255 / (GameTicRate*2);
if (special1 <= 0)
{
Destroy ();
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/doombase.zs
Expand Up @@ -185,7 +185,7 @@ class Thinker : Object native play

static clearscope int Tics2Seconds(int tics)
{
return int(tics / TICRATE);
return int(tics / GameTicRate);
}

}
Expand Down
5 changes: 4 additions & 1 deletion wadsrc/static/zscript/engine/base.zs
Expand Up @@ -710,7 +710,10 @@ struct SystemTime

class Object native
{
const TICRATE = 35;
const DEFAULT_TICRATE = 35;

/*deprecated("4.11","Use GameTicRate instead")*/ const TICRATE = 35;

native bool bDestroyed;

// These must be defined in some class, so that the compiler can find them. Object is just fine, as long as they are private to external code.
Expand Down

0 comments on commit 4eb1f57

Please sign in to comment.