Begin TICRATE conversion.

- Moved TICRATE from Thinker to Object in ZScript so status bars have access to it.

# Conflicts:
#	src/p_effect.h
#	wadsrc/static/zscript/base.zs
This commit is contained in:
Major Cooke 2020-04-12 15:10:41 -05:00 committed by drfrag
parent 54482bf165
commit b9e2063a65
10 changed files with 23 additions and 22 deletions

View file

@ -953,7 +953,7 @@ DEFINE_MAP_OPTION(sky1, true)
{
parse.sc.Float /= 256;
}
info->skyspeed1 = float(parse.sc.Float * (35. / 1000.));
info->skyspeed1 = float(parse.sc.Float * (TICRATE / 1000.));
}
}
@ -967,7 +967,7 @@ DEFINE_MAP_OPTION(sky2, true)
{
parse.sc.Float /= 256;
}
info->skyspeed2 = float(parse.sc.Float * (35. / 1000.));
info->skyspeed2 = float(parse.sc.Float * (TICRATE / 1000.));
}
}

View file

@ -47,7 +47,7 @@ DLightningThinker::DLightningThinker ()
{
Stopped = false;
LightningFlashCount = 0;
NextLightningFlash = ((pr_lightning()&15)+5)*35; // don't flash at level start
NextLightningFlash = ((pr_lightning()&15)+5)*TICRATE; // don't flash at level start
LightningLightLevels.Resize(level.sectors.Size());
fillshort(&LightningLightLevels[0], LightningLightLevels.Size(), SHRT_MAX);
@ -171,11 +171,11 @@ void DLightningThinker::LightningFlash ()
{
if (pr_lightning() < 128 && !(level.time&32))
{
NextLightningFlash = ((pr_lightning()&7)+2)*35;
NextLightningFlash = ((pr_lightning()&7)+2)*TICRATE;
}
else
{
NextLightningFlash = ((pr_lightning()&15)+5)*35;
NextLightningFlash = ((pr_lightning()&15)+5)*TICRATE;
}
}
}

View file

@ -729,10 +729,10 @@ void SBarInfo::ParseSBarInfo(int lump)
popup.transition = Popup::TRANSITION_FADE;
sc.MustGetToken(',');
sc.MustGetToken(TK_FloatConst);
popup.speed = 1.0 / (35.0 * sc.Float);
popup.speed = 1.0 / (TICRATE * sc.Float);
sc.MustGetToken(',');
sc.MustGetToken(TK_FloatConst);
popup.speed2 = 1.0 / (35.0 * sc.Float);
popup.speed2 = 1.0 / (TICRATE * sc.Float);
}
else
sc.ScriptError("Unkown transition type: '%s'", sc.String);

View file

@ -6564,7 +6564,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
{
PalEntry color = args[0];
bool fullbright = argCount > 1 ? !!args[1] : false;
int lifetime = argCount > 2 ? args[2] : 35;
int lifetime = argCount > 2 ? args[2] : TICRATE;
double size = argCount > 3 ? args[3] : 1.;
int x = argCount > 4 ? args[4] : 0;
int y = argCount > 5 ? args[5] : 0;

View file

@ -711,7 +711,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
if (!p)
return;
int spiralduration = (duration == 0) ? 35 : duration;
int spiralduration = (duration == 0) ? TICRATE : duration;
p->alpha = 1.f;
p->ttl = spiralduration;

View file

@ -34,6 +34,7 @@
#pragma once
#include "vectors.h"
#include "doomdef.h"
#define FX_ROCKET 0x00000001
#define FX_GRENADE 0x00000002
@ -89,7 +90,7 @@ struct SPortalHit
DVector3 OutDir;
};
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = 0.);
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = TICRATE, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = 0.);
void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind);
void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);

View file

@ -263,7 +263,7 @@ void FTextureManager::InitAnimated (void)
}
// Speed is stored as tics, but we want ms so scale accordingly.
FAnimDef *adef = AddSimpleAnim (pic1, pic2 - pic1 + 1, Scale (animspeed, 1000, 35));
FAnimDef *adef = AddSimpleAnim (pic1, pic2 - pic1 + 1, Scale (animspeed, 1000, TICRATE));
if (adef != NULL) adef->AnimType = animtype;
}
}
@ -567,14 +567,14 @@ void FTextureManager::ParseTime (FScanner &sc, uint32_t &min, uint32_t &max)
if (sc.Compare ("tics"))
{
sc.MustGetFloat ();
min = max = uint32_t(sc.Float * 1000 / 35);
min = max = uint32_t(sc.Float * 1000 / TICRATE);
}
else if (sc.Compare ("rand"))
{
sc.MustGetFloat ();
min = uint32_t(sc.Float * 1000 / 35);
min = uint32_t(sc.Float * 1000 / TICRATE);
sc.MustGetFloat ();
max = uint32_t(sc.Float * 1000 / 35);
max = uint32_t(sc.Float * 1000 / TICRATE);
}
else
{

View file

@ -1076,7 +1076,7 @@ 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 = 35, 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_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_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.);

View file

@ -417,6 +417,7 @@ struct GameInfoStruct native
class Object native
{
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.
@ -497,7 +498,6 @@ class Thinker : Object native play
MAX_STATNUM = 127
}
const TICRATE = 35;
virtual native void Tick();
virtual native void PostBeginPlay();

View file

@ -318,10 +318,10 @@ class StrifeStatusBar : BaseStatusBar
int flags = item.Amount <= 0? DI_ITEM_OFFSETS|DI_DIM : DI_ITEM_OFFSETS;
if (item == CPlayer.mo.InvSel)
{
DrawTexture (Images[CursorImage], (42 + 35*i, 180), flags, 1. - itemflashFade);
DrawTexture (Images[CursorImage], (42 + TICRATE*i, 180), flags, 1. - itemflashFade);
}
DrawInventoryIcon (item, (48 + 35*i, 182), flags);
DrawString(mYelFont, FormatNumber(item.Amount, 3, 5), (75 + 35*i, 191), DI_TEXT_ALIGN_RIGHT);
DrawInventoryIcon (item, (48 + TICRATE*i, 182), flags);
DrawString(mYelFont, FormatNumber(item.Amount, 3, 5), (75 + TICRATE*i, 191), DI_TEXT_ALIGN_RIGHT);
i++;
}
}
@ -388,13 +388,13 @@ class StrifeStatusBar : BaseStatusBar
{
if (item == CPlayer.mo.InvSel)
{
DrawTexture(Images[CursorImage], (-90+i*35, -3), DI_SCREEN_CENTER_BOTTOM, 0.75);
DrawTexture(Images[CursorImage], (-90+i*TICRATE, -3), DI_SCREEN_CENTER_BOTTOM, 0.75);
}
if (item.Icon.isValid())
{
DrawInventoryIcon(item, (-90+i*35, -5), DI_SCREEN_CENTER_BOTTOM|DI_DIMDEPLETED, 0.75);
DrawInventoryIcon(item, (-90+i*TICRATE, -5), DI_SCREEN_CENTER_BOTTOM|DI_DIMDEPLETED, 0.75);
}
DrawString(mYelFont, FormatNumber(item.Amount, 3, 5), (-72 + i*35, -8), DI_TEXT_ALIGN_RIGHT|DI_SCREEN_CENTER_BOTTOM);
DrawString(mYelFont, FormatNumber(item.Amount, 3, 5), (-72 + i*TICRATE, -8), DI_TEXT_ALIGN_RIGHT|DI_SCREEN_CENTER_BOTTOM);
++i;
}
}