Skip to content

Commit

Permalink
Migrate to TICRATE from 35.0 fixed rate
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Aug 26, 2024
1 parent daf4fff commit ab3776c
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class H2HolyStrength: HXDDPowerupSphere {
self.A_StartSound("hexen2/items/artpkup");

// Give Health
int amountHealth = floor((1000.0 / 35.0) / tickDuration);
int amountHealth = floor((1000.0 / double(TICRATE)) / tickDuration);
HealThing(amountHealth);

// Give Ammo
int amount = floor((1000.0 / 35.0) / tickDuration);
int amount = floor((1000.0 / double(TICRATE)) / tickDuration);
self.GiveAmmoAmount(toucher, amount);
}
}
Expand Down Expand Up @@ -130,23 +130,23 @@ class H2SoulSphere: HXDDPowerupSphere {
self.A_StartSound("hexen2/items/artpkup");

// Give Health
int amountHealth = floor((1000.0 / 35.0) / tickDuration) * 2;
int amountHealth = floor((1000.0 / double(TICRATE)) / tickDuration) * 2;
HealThing(amountHealth);

// Give Ammo
int amount = 15 + floor((1000.0 / 35.0) / tickDuration);
int amount = 15 + floor((1000.0 / double(TICRATE)) / tickDuration);
self.GiveAmmoAmount(toucher, amount);
}

override void OnNeutralPickup(Actor toucher) {
self.A_StartSound("hexen2/items/artpkup");

// Give Health
int amountHealth = floor((1000.0 / 35.0) / tickDuration);
int amountHealth = floor((1000.0 / double(TICRATE)) / tickDuration);
HealThing(amountHealth);

// Give Ammo
int amount = floor((1000.0 / 35.0) / tickDuration);
int amount = floor((1000.0 / double(TICRATE)) / tickDuration);
self.GiveAmmoAmount(toucher, amount);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class AWeapGrenades_Grenade: Hexen2Projectile {
DeathSound "hexen2/weapons/explode";
Obituary "$OB_MPMWEAPFROST";

AWeapGrenades_Grenade.tickDuration (2.0 * 35.0);
AWeapGrenades_Grenade.tickDuration (2.0 * double(TICRATE));
}

States {
Expand Down Expand Up @@ -277,7 +277,7 @@ class AWeapGrenades_Grenade: Hexen2Projectile {
gren.SetOrigin(self.pos, false);
gren.isModified = self.isModified;
gren.ex_damage = ex_damage;
gren.ticNextExplosion = frandom(0.1, 0.6) * 35.0;
gren.ticNextExplosion = frandom(0.1, 0.6) * double(TICRATE);
gren.isMulti = (i == 0);

double x;
Expand Down Expand Up @@ -365,7 +365,7 @@ class AWeapGrenades_SuperGrenade: Hexen2Projectile {
gren.isMulti = self.isMulti;
gren.isModified = self.isModified;
gren.ex_damage = self.ex_damage;
gren.ticNextExplosion = frandom(0.1, 0.6) * 35.0;
gren.ticNextExplosion = frandom(0.1, 0.6) * double(TICRATE);

double x;
double y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CWeapIceMace_IceShot1 : Hexen2Projectile {
Obituary "$OB_MPMWEAPFROST";
Scale 1.5;

CWeapIceMace_IceShot1.tickDuration (4.0 * 35.0);
CWeapIceMace_IceShot1.tickDuration (4.0 * double(TICRATE));
}

States
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CWeapMeteorStaff_Meteor: Hexen2Projectile {
DeathSound "hexen2/weapons/explode";
Obituary "$OB_MPMWEAPFROST";

CWeapMeteorStaff_Meteor.tickDuration (5.0 * 35.0);
CWeapMeteorStaff_Meteor.tickDuration (5.0 * double(TICRATE));
}

States
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class NWeapSpellbook_Flash : Actor {
Alpha = self.Default.Alpha * (tickDuration / (0.75 * 0.5));
}

tickDuration -= 35.0f / 100.0f;
tickDuration -= double(TICRATE) / 100.0f;
}
}

Expand Down Expand Up @@ -541,7 +541,7 @@ class NWeapSpellbook_MagicMissile : Hexen2Projectile {
Destroy();
}

tickDuration -= 35.0f / 1000.0f;
tickDuration -= double(TICRATE) / 1000.0f;

Vector3 avelocity = (0, 0, frandom(300.0f,600.0f) / 32.0f);
if (!self.useNewModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class PWeapAxe_BladeProjectile : Hexen2Projectile {
A_DestroySelf();
}

tickDuration -= 35.0f / 1000.0f;
tickDuration -= double(TICRATE) / 1000.0f;
}

void A_OnBounce() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class PWeapPurifier_Missile: Actor {
DeathSound "hexen2/weapons/expsmall";
Obituary "$HXDD.HEXEN2.WEAPONS.PALADIN.PURIFIER.OBITUARY.1";

PWeapPurifier_Missile.tickDuration (2.5 * 35.0);
PWeapPurifier_Missile.tickDuration (2.5 * double(TICRATE));
}

States {
Expand Down Expand Up @@ -284,7 +284,7 @@ class PWeapPurifier_DragonBall: Actor {
DeathSound "hexen2/weapons/exphuge";
Obituary "$HXDD.HEXEN2.WEAPONS.PALADIN.PURIFIER.OBITUARY.1";

PWeapPurifier_DragonBall.tickDuration (2.5 * 35.0);
PWeapPurifier_DragonBall.tickDuration (2.5 * double(TICRATE));
}

States {
Expand All @@ -299,7 +299,7 @@ class PWeapPurifier_DragonBall: Actor {
void A_HandleHoming() {
if (self.delayHoming <= 0.0) {
self.A_SeekerMissile(2, 10, SMF_LOOK | SMF_CURSPEED, 50);
self.delayHoming = (0.15 * 35.0);
self.delayHoming = (0.15 * double(TICRATE));
return;
}
self.delayHoming--;
Expand All @@ -308,7 +308,7 @@ class PWeapPurifier_DragonBall: Actor {
override void PostBeginPlay() {
Super.PostBeginPlay();

self.delayHoming = ((1/3) * 35.0);
self.delayHoming = ((1/3) * double(TICRATE));

Vector3 avelocity = (-6.25, 6.25, -6.25);
angle += avelocity.x;
Expand Down Expand Up @@ -391,7 +391,7 @@ class PWeapPurifier_PuffRing: SpriteFXParticle {
override void Tick() {
Super.Tick();

self.duration -= 1.0 / 35.0;
self.duration -= 1.0 / double(TICRATE);

if (self.duration < 0.30) {
self.ChangeTexture(4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class PWeapVorpalSword_MissileWave : Hexen2Projectile {
Destroy();
}

tickDuration -= 35.0f / 1000.0f;
tickDuration -= double(TICRATE) / 1000.0f;

Vector3 facing = LemonUtil.GetEularFromVelocity(self.vel);
self.angle = facing.x;
Expand Down Expand Up @@ -564,7 +564,7 @@ class PWeapVorpalSword_Shock2 : Actor {
}

override void BeginPlay() {
self.lifeTime = 0.5 * 35.0;
self.lifeTime = 0.5 * double(TICRATE);
}

override void Tick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class SWeapAcidRune_Missile: Hexen2Projectile {
DeathSound "hexen2/succubus/acidhit";
Obituary "$OB_MPSWEAPACIDRUNE";

SWeapAcidRune_Missile.tickDuration (35.0 * 1.5);
SWeapAcidRune_Missile.tickDuration (double(TICRATE) * 1.5);
}

States {
Expand All @@ -274,7 +274,7 @@ class SWeapAcidRune_Missile: Hexen2Projectile {
if (self.isPowered) {
// TODO: make veer cvar value as dependant between modes
self.veerAmount = 30;
self.tickDuration = 35.0 * 5;
self.tickDuration = double(TICRATE) * 5;
self.Scale = (2.5, 2.5);

double avecz = frandom(0.0, 1.0) * -360.0 - 100.0;
Expand Down Expand Up @@ -338,7 +338,7 @@ class SWeapAcidRune_Missile: Hexen2Projectile {
sprfx.SetOrigin(self.pos, false);
self.nextTrail = 0.1;
} else {
self.nextTrail -= (1.0 / 35.0);
self.nextTrail -= (1.0 / double(TICRATE));
}
}

Expand Down Expand Up @@ -489,7 +489,7 @@ class SWeapAcidRune_PFX_Shimmer: Actor {
if (self.remove) {
self.Destroy();
}
self.delay -= (1.0 / 35.0);
self.delay -= (1.0 / double(TICRATE));
if (self.delay <= 0) {
ParticleGenerator pg = ParticleGenerator(Spawn("ParticleGenerator"));
pg.Attach(self);
Expand Down Expand Up @@ -621,7 +621,7 @@ class SWeapAcidRune_AcidDrop: Hexen2Projectile {
pgs.SetOrigin(self.pos, false);
SWeapAcidRune_PFX_Shimmer(pgs).delay = 0.6;

self.lifetime -= (1.0 / 35.0);
self.lifetime -= (1.0 / double(TICRATE));
if (self.lifetime <= 0) {
A_ExplodeAndDamage();
self.Destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class SWeapFireStorm_FlameStream: Hexen2Projectile {
DeathSound "hexen2/succubus/flampow";
Obituary "$OB_MPSWEAPFIRESTORM";

SWeapFireStorm_FlameStream.tickDuration (2.0 * 35.0);
SWeapFireStorm_FlameStream.tickDuration (2.0 * double(TICRATE));
}

States {
Expand Down Expand Up @@ -273,7 +273,7 @@ class SWeapFireStorm_FlameStream: Hexen2Projectile {
if (self.isPowered) {
// TODO: make veer cvar value as dependant between modes
self.veerAmount = 30;
self.tickDuration = 35.0 * 5;
self.tickDuration = double(TICRATE) * 5;
self.Scale = (2.5, 2.5);

double avecz = frandom(0.0, 1.0) * -360.0 - 100.0;
Expand Down Expand Up @@ -314,7 +314,7 @@ class SWeapFireStorm_FlameStream: Hexen2Projectile {
//self.roll += self.avelocity.z;

if (self.isPowered) {
self.nextTrail -= (1.0 / 35.0);
self.nextTrail -= (1.0 / double(TICRATE));
if (self.nextTrail <= 0.0) {
Actor sprfx = Spawn("AcidMuzzleFlash");
sprfx.SetOrigin(self.pos, false);
Expand Down Expand Up @@ -384,7 +384,7 @@ class SWeapFireStorm_Burner: Actor {
Height 0;
Radius 0;

SWeapFireStorm_Burner.tickDuration (5.0 * 35.0);
SWeapFireStorm_Burner.tickDuration (5.0 * double(TICRATE));
}

States {
Expand All @@ -396,7 +396,7 @@ class SWeapFireStorm_Burner: Actor {
override void PostBeginPlay() {
Super.PostBeginPlay();

self.tickDuration = (5 + random[swfs_burner](0, 5) * 35.0);
self.tickDuration = (5 + random[swfs_burner](0, 5) * double(TICRATE));
}

void AttachToActor(Actor nextTarget) {
Expand Down Expand Up @@ -429,7 +429,7 @@ class SWeapFireStorm_Burner: Actor {
pg.actorParticleTypes.push("FireWall2Particle");
pg.actorParticleTypes.push("FireWall3Particle");

self.nextDamage = frandom(0.0, 0.5) * 35.0;
self.nextDamage = frandom(0.0, 0.5) * double(TICRATE);
}

void SetOwner(Actor owner) {
Expand All @@ -456,7 +456,7 @@ class SWeapFireStorm_Burner: Actor {
self.burnTarget.DamageMobj(self, self.target, random[swfs_burndmg](2,3), 'Fire');
self.A_StartSound("hexen2/raven/fire1", CHAN_WEAPON, 1);

self.nextDamage = frandom(0.0, 0.5) * 35.0;
self.nextDamage = frandom(0.0, 0.5) * double(TICRATE);
}
}
}
Expand Down Expand Up @@ -606,7 +606,7 @@ class SWeapFireStorm_FlameBall: Hexen2Projectile {
DeathSound "hexen2/succubus/flampow";
Obituary "$OB_MPSWEAPFIRESTORM";

//SWeapFireStorm_FlameBall.tickDuration (2.0 * 35.0);
//SWeapFireStorm_FlameBall.tickDuration (2.0 * double(TICRATE));
}

States {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class Hexen2Weapon: Weapon {
** Dynamic Refire
** Simulates Hexen II's delay before allowing to fire again
**/
double ticRate; // used to count how many tics have passed in a fire loop
double ticRatePassed; // used to count how many tics have passed in a fire loop
double nextFire;
action void ResetCooldown(Weapon ReadyWeapon) {
Hexen2Weapon weap = Hexen2Weapon(ReadyWeapon);
Expand All @@ -255,7 +255,7 @@ class Hexen2Weapon: Weapon {

action void SetCooldown(Weapon ReadyWeapon, double seconds, double tics = 1) {
Hexen2Weapon weap = Hexen2Weapon(ReadyWeapon);
weap.ticRate = tics;
weap.ticRatePassed = tics;
weap.nextFire = seconds;
}

Expand All @@ -266,7 +266,7 @@ class Hexen2Weapon: Weapon {

action bool CooldownTick(Weapon ReadyWeapon, int frameTime = 1) {
Hexen2Weapon weap = Hexen2Weapon(ReadyWeapon);
weap.nextFire -= (frameTime / 35.0) * weap.ticRate;
weap.nextFire -= (frameTime / double(TICRATE)) * weap.ticRatePassed;
return (weap.nextFire > 0.0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ class HXDDHexen2StatusBar : BaseStatusBar {

if (!Level.NoInventoryBar && CPlayer.mo.InvSel != null) {
if (isInventoryBarVisible()) {
invTime = clamp(invTime + (1.0 / 35.0), 0.0, INV_FADE_DURATION);
invTime = clamp(invTime + (1.0 / double(TICRATE)), 0.0, INV_FADE_DURATION);
} else if (invTime != 0.0) {
invTime = clamp(invTime - (1.0 / 35.0), 0.0, INV_FADE_DURATION);
invTime = clamp(invTime - (1.0 / double(TICRATE)), 0.0, INV_FADE_DURATION);
}
if (invTime != 0.0) {
int width = diparms_sbar.boxsize.X * INV_NUM_FIELDS;
Expand Down Expand Up @@ -314,9 +314,9 @@ class HXDDHexen2StatusBar : BaseStatusBar {

if (!Level.NoInventoryBar && CPlayer.mo.InvSel != null) {
if (isInventoryBarVisible()) {
invTime = clamp(invTime + (1.0 / 35.0), 0.0, INV_FADE_DURATION);
invTime = clamp(invTime + (1.0 / double(TICRATE)), 0.0, INV_FADE_DURATION);
} else if (invTime != 0.0) {
invTime = clamp(invTime - (1.0 / 35.0), 0.0, INV_FADE_DURATION);
invTime = clamp(invTime - (1.0 / double(TICRATE)), 0.0, INV_FADE_DURATION);
}
if (invTime != 0.0) {
int width = diparms_sbar.boxsize.X * INV_NUM_FIELDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ class HXDDHereticSplitStatusBar : BaseStatusBar {

if (!Level.NoInventoryBar && CPlayer.mo.InvSel != null) {
if (isInventoryBarVisible()) {
invTime = clamp(invTime + (1.0 / 35.0), 0.0, invAnimationDuration);
invTime = clamp(invTime + (1.0 / double(TICRATE)), 0.0, invAnimationDuration);
} else if (invTime != 0.0) {
invTime = clamp(invTime - (1.0 / 35.0), 0.0, invAnimationDuration);
invTime = clamp(invTime - (1.0 / double(TICRATE)), 0.0, invAnimationDuration);
}
if (invTime != 0.0) {
double posInventory = LemonUtil.flerp(80.0, 0.0, LemonUtil.Easing_Quadradic_Out(invTime / invAnimationDuration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@ class HXDDHexen2SplitStatusBar : BaseStatusBar {
DrawImage("assets/ui/FS_HEXEN2_SBAR_RIGHT_ITEM.png", (anchorRight - 49, anchorBottom) + v2Right, DI_SCREEN_RIGHT_BOTTOM | DI_ITEM_RIGHT_BOTTOM);
if (!Level.NoInventoryBar && CPlayer.mo.InvSel != null) {
if (isInventoryBarVisible()) {
invTime = clamp(invTime + (1.0 / 35.0), 0.0, invAnimationDuration);
invTime = clamp(invTime + (1.0 / double(TICRATE)), 0.0, invAnimationDuration);
} else if (invTime != 0.0) {
invTime = clamp(invTime - (1.0 / 35.0), 0.0, invAnimationDuration);
invTime = clamp(invTime - (1.0 / double(TICRATE)), 0.0, invAnimationDuration);
}
if (invTime != 0.0) {
double posInventory = LemonUtil.flerp(80.0, 0.0, LemonUtil.Easing_Quadradic_Out(invTime / invAnimationDuration));
Expand Down

0 comments on commit ab3776c

Please sign in to comment.