Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow point rendering not matching stable #115

Open
Beyley opened this issue Apr 20, 2021 · 0 comments
Open

Follow point rendering not matching stable #115

Beyley opened this issue Apr 20, 2021 · 0 comments

Comments

@Beyley
Copy link
Contributor

Beyley commented Apr 20, 2021

This has been an issue for awhile and has only been slightly fixed by capping the amount to 30 and distributing it (previously it would render hundreds if the follow point image was too small)

For those who arent up to spec on how follow points are rendered in stable and droid
droid: calculate the amount to fill the distance (cap to 30) then distribute evenly
stable: place a follow point every 32 pixels(?) until you reach the end

In the following code block it shows how stable renders its follow points

	internal void AddFollowPoints(int startIndex = 0, int endIndex = -1) {
            if (endIndex == -1) endIndex = this.hitObjectsCount - 1;

            pTexture[] fptextures = TextureManager.LoadAll(@"followpoint");
            
            int followPointIndex = 0;
            for (int i = startIndex + 1; i <= endIndex; i++) {
                HitObject currHitObject = this.hitObjects[i];
                
                //Draw connection lines
                if (!currHitObject.NewCombo && !this.hitObjects[i - 1].IsType(HitObjectType.Spinner) && !this.hitObjects[i].IsType(HitObjectType.Spinner)) {
                    Vector2 pos1 = this.hitObjects[i - 1].EndPosition;
                    int time1 = this.hitObjects[i - 1].EndTime;
                    Vector2 pos2 = currHitObject.Position;
                    int time2 = currHitObject.StartTime;

                    int distance = (int)Vector2.Distance(pos1, pos2);
                    Vector2 distanceVector = pos2 - pos1;
                    int length = time2 - time1;

                    float angle = (float)Math.Atan2(pos2.Y - pos1.Y, pos2.X - pos1.X);
                    
                    for (int j = (int)(FollowLineDistance * 1.5); j < distance - FollowLineDistance; j += FollowLineDistance) {
                        float fraction = (float)j / distance;
                        Vector2 posStart = pos1 + (fraction - 0.1f) * distanceVector;
                        Vector2 pos = pos1 + fraction * distanceVector;
                        int fadein = (int)(time1 + fraction * length) - FollowLinePreEmpt;
                        int fadeout = (int)(time1 + fraction * length);
                        
                        pAnimation dot;
                        if (followPointIndex < this.followPoints.Count) {
                            dot = this.followPoints[followPointIndex];
                            dot.Position = pos;
                            
                            foreach (Transformation t in dot.Transformations) {
                                if (t.Type == TransformationType.Fade && t.EndFloat == 0) {
                                    t.Time1 = fadeout;
                                    t.Time2 = fadeout + FadeIn;
                                }
                                else {
                                    t.Time1 = fadein;
                                    t.Time2 = fadein + FadeIn;
                                }
                                
                                if (t.Type == TransformationType.Movement) {
                                    t.StartVector = posStart;
                                    t.EndVector = pos;
                                }
                                
                            }

                            dot.ResetAnimation();
                        }
                        else {
                            dot = new pAnimation(fptextures, Fields.Gamefield, Origins.Centre, Clocks.Audio, pos, 0, false, Color.White, null);
                            dot.SetFramerateFromSkin();
                            dot.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, fadein, fadein + FadeIn));
                            if (SkinManager.IsDefault && GameBase.NewGraphicsAvailable) {
                                dot.Transformations.Add(new Transformation(TransformationType.Scale, 1.5f, 1, fadein, fadein + FadeIn, EasingTypes.Out));
                                dot.Transformations.Add(new Transformation(TransformationType.Movement, posStart, pos, fadein, fadein + FadeIn, EasingTypes.Out));
                            }
                            
                            dot.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, fadeout, fadeout + FadeIn));
                            
                            if (GameBase.Mode == OsuModes.Edit) this.followPoints.Add(dot);
                            
                        }
                        
                        dot.Rotation = angle;
                        this.spriteManager.Add(dot);

                        followPointIndex++;
                    }
                }
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant