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

fix: scaledelta is affected by zoom #2255

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ func (be BytecodeExp) run(c *Char) BytecodeValue {
case OC_pos_x:
sys.bcStack.PushF((c.pos[0]*(c.localscl/oc.localscl) - sys.cam.Pos[0]/oc.localscl))
case OC_pos_y:
sys.bcStack.PushF((c.pos[1] + c.groundLevel - c.platformPosY) * (c.localscl / oc.localscl))
sys.bcStack.PushF((c.pos[1] - c.groundLevel - c.platformPosY) * (c.localscl / oc.localscl))
case OC_power:
sys.bcStack.PushI(c.getPower())
case OC_powermax:
Expand Down
2 changes: 1 addition & 1 deletion src/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (bg backGround) draw(pos [2]float32, drawscl, bgscl, stglscl float32,
y := bg.start[1] - yScrollPos + bg.bga.offset[1]

// Calculate Y scaling based on vertical scroll position and delta
ys2 := bg.scaledelta[1] * pos[1] * bg.delta[1] * bgscl
ys2 := bg.scaledelta[1] * pos[1] * bg.delta[1] * bgscl / drawscl
ys := ((100-(pos[1])*bg.yscaledelta)*bgscl/bg.yscalestart)*bg.scalestart[1] + ys2
xs := bg.scaledelta[0] * pos[0] * bg.delta[0] * bgscl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NeatUnsou

I can't help but notice that this code implies that the y dimension of scaledelta is affected by zoom, but the x dimention is not. Is that actually the case? Does Mugen 1.1 behave this way? Or do I not understand this code correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After making it so that it also affects the x dimension, I confirmed a stage where a bug occurs.
Yes, I agree that it doesn't seem correct intuitively, but after testing with around 30 stages that use zoom and scaledelta, I couldn't find any issues, so that's why it ended up like this.
If you find any stages where bugs occur related to scaledelta, please create an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank You very much.

x *= bgscl
Expand Down
Loading