Skip to content

Commit

Permalink
Fix decor hitbox being overriden twice
Browse files Browse the repository at this point in the history
  • Loading branch information
tmalahie committed Aug 12, 2024
1 parent a5d9948 commit f173e8a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions scripts/mk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3787,20 +3787,22 @@ function startGame() {
}
(function(decorBehavior) {
getCustomDecorData(customDecor, function(res) {
var sizeRatio = {
w: res.size.hd.w/res.original_size.hd.w,
h: res.size.hd.h/res.original_size.hd.h
}
decorBehavior.size_ratio = sizeRatio;
if (sizeRatio.w !== 1) {
var hitboxSize = decorBehavior.hitbox||DEFAULT_DECOR_HITBOX;
var hitboxConst = 1;
decorBehavior.hitbox = hitboxConst + (hitboxSize-hitboxConst)*sizeRatio.w;
}
if (sizeRatio.h !== 1) {
var hitboxHeight = decorBehavior.hitboxH||DEFAULT_DECOR_HITBOX_H;
var hitboxConst = 0.8;
decorBehavior.hitboxH = hitboxConst + (hitboxHeight-hitboxConst)*sizeRatio.h;
if (!decorBehavior.size_ratio) {
var sizeRatio = {
w: res.size.hd.w/res.original_size.hd.w,
h: res.size.hd.h/res.original_size.hd.h
}
decorBehavior.size_ratio = sizeRatio;
if (sizeRatio.w !== 1) {
var hitboxSize = decorBehavior.hitbox||DEFAULT_DECOR_HITBOX;
var hitboxConst = 1;
decorBehavior.hitbox = hitboxConst + (hitboxSize-hitboxConst)*sizeRatio.w;
}
if (sizeRatio.h !== 1) {
var hitboxHeight = decorBehavior.hitboxH||DEFAULT_DECOR_HITBOX_H;
var hitboxConst = 0.8;
decorBehavior.hitboxH = hitboxConst + (hitboxHeight-hitboxConst)*sizeRatio.h;
}
}
if (res.options) {
if (res.options.hitbox === 0)
Expand Down Expand Up @@ -4724,7 +4726,7 @@ function startGame() {
if (bMusic || iSfx)
countDownMusic.play();
document.body.style.cursor = "default";
//* gogogo
/* gogogo
fncHandler = setInterval(fncCount,1000);
//*/fncHandler = setInterval(fncCount,1);
}
Expand Down Expand Up @@ -4775,7 +4777,7 @@ function startGame() {
//*/setTimeout(fncCount,5);
}
else {
//* gogogo
/* gogogo
setTimeout(fncCount,bMusic?3000:1500);
//*/setTimeout(fncCount,bMusic?3:1.5);
}
Expand Down

0 comments on commit f173e8a

Please sign in to comment.