Skip to content

Commit

Permalink
Update to latest main of HDest
Browse files Browse the repository at this point in the history
  • Loading branch information
dastrukar committed Jul 3, 2021
1 parent 5bda9e7 commit 9d67ab0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
All changes are sorted from top to bottom, Latest to Oldest.
Date format: DD/MM/YYYY
---
**3/07/2021**

Compat:
* Updated to latest main of Hideous Destructor.
---
**28/06/2021**

Compat:
Expand Down
16 changes: 9 additions & 7 deletions zscript/statusbar.zs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class HDStatusBar:DoomStatusBar{
let ang = 0.;

for(int i = 0; i < circleVertCount; i++){
let vx = sin(ang) / 2;
let vy = cos(ang) / 2;
let vx = sin(ang)*0.5;
let vy = cos(ang)*0.5;

let vert = (vx, vy);

Expand All @@ -75,6 +75,7 @@ class HDStatusBar:DoomStatusBar{
}

const circleVertCount = 24;
const PXLSTRETCH_DOOM = 1.2;

Shape2D circleShape;
vector2 circleVerts[circleVertCount];
Expand Down Expand Up @@ -1035,7 +1036,7 @@ class HDStatusBar:DoomStatusBar{
drawimage(cellsprite,(posx,posy),flags:flags,alpha:bttc?1.:0.3);
}

void DrawCircle(TextureID tex, vector2 pos, double scale = 1, vector2 uvOffset = (0, 0), double uvScale = 1, bool center = true){
void DrawCircle(TextureID tex, vector2 pos, double scale = 1, vector2 uvOffset = (0, 0), double uvScale = 1, bool center = true, bool squash=false){
let hudScale = GetHUDScale();

//convert sbar coords to screen coords
Expand All @@ -1058,28 +1059,29 @@ class HDStatusBar:DoomStatusBar{
uvOffset.y /= sy;

circleShape.Clear(Shape2D.C_Coords);
for(int i = 0; i < circleVertCount; i++)
for(int i = 0; i < circleVertCount; i++){
circleShape.PushCoord(circleVerts[i] / uvScale + uvOffset + (.5, .5));
}

uvDirty = true;
}

let trans = new('Shape2DTransform');

trans.Scale((sx * hudScale.x, sy * hudScale.y) * scale);
trans.Scale((sx * (squash?(hudScale.x*(1./PXLSTRETCH_DOOM)):hudScale.x), sy * hudScale.y) * scale);
trans.Translate(pos);

circleShape.SetTransform(trans);

screen.DrawShape(tex, false, circleShape);

trans.Destroy();

//reset to original UV coords
if(uvDirty){
circleShape.Clear(Shape2D.C_Coords);
for(int i = 0; i < circleVertCount; i++)
for(int i = 0; i < circleVertCount; i++){
circleShape.PushCoord(circleVerts[i] + (.5, .5));
}
}
}

Expand Down

0 comments on commit 9d67ab0

Please sign in to comment.