diff --git a/bin/RabiClone.jar b/bin/RabiClone.jar index 2f12d8c..f62d429 100644 Binary files a/bin/RabiClone.jar and b/bin/RabiClone.jar differ diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index bb826ca..8abf5ac 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -60,6 +60,7 @@ public class RabiClone { final static long TARGET_FRAMETIME = 8333333l; static long lastReportedTime = System.currentTimeMillis(); public static long TIME = 0; + public static long scaleTime; public static void main(String[] args) { System.setProperty("sun.java2d.transaccel", "True"); diff --git a/src/sig/engine/Panel.java b/src/sig/engine/Panel.java index 2c987ed..49e6061 100644 --- a/src/sig/engine/Panel.java +++ b/src/sig/engine/Panel.java @@ -197,7 +197,9 @@ public class Panel extends JPanel implements Runnable,KeyListener { public void paintComponent(Graphics g) { //super.paintComponent(g); // perform draws on pixels + long startTime = System.currentTimeMillis(); g.drawImage(this.imageBuffer,0,0,getWidth(),getHeight(),0,0,RabiClone.BASE_WIDTH,RabiClone.BASE_HEIGHT,this); + RabiClone.scaleTime=System.currentTimeMillis()-startTime; } /** diff --git a/src/sig/map/Map.java b/src/sig/map/Map.java index 09be4e9..43acdef 100644 --- a/src/sig/map/Map.java +++ b/src/sig/map/Map.java @@ -48,11 +48,13 @@ public class Map { public static Map LoadMap(Maps map) { try { - if (RabiClone.CURRENT_MAP!=map) { - resetMapData(RabiClone.CURRENT_MAP.getMap()); - } else { - resetAndReloadEventData(RabiClone.CURRENT_MAP); - return RabiClone.CURRENT_MAP.getMap(); + if (RabiClone.CURRENT_MAP!=null) { + if (RabiClone.CURRENT_MAP!=map) { + resetMapData(RabiClone.CURRENT_MAP.getMap()); + } else { + resetAndReloadEventData(RabiClone.CURRENT_MAP); + return RabiClone.CURRENT_MAP.getMap(); + } } RabiClone.CURRENT_MAP=map; Map newMap = RabiClone.CURRENT_MAP.getMap()!=null?RabiClone.CURRENT_MAP.getMap():new Map(); diff --git a/src/sig/objects/LevelRenderer.java b/src/sig/objects/LevelRenderer.java index c67e095..e9b1da3 100644 --- a/src/sig/objects/LevelRenderer.java +++ b/src/sig/objects/LevelRenderer.java @@ -44,7 +44,7 @@ public class LevelRenderer extends Object{ if (RabiClone.player!=null) { Draw_Animated_Object(RabiClone.player,RabiClone.player.facing_direction?Transform.HORIZONTAL:Transform.NONE); Draw_Text(4,4,new String(RabiClone.player.y_velocity),Font.PROFONT_12); - Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.player.slide_time3),Font.PROFONT_12); + Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.scaleTime),Font.PROFONT_12); } } diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index ee82ff5..553b953 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -59,8 +59,6 @@ public class Player extends AnimatedObject implements CollisionEntity { long spacebarPressed = RabiClone.TIME; long jump_slide_fall_StartAnimationTimer = -1; long slide_time = -1; - long slide_time2 = -1; - long slide_time3 = 0; long jumpHoldTime = TimeUtils.millisToNanos(150); final static long slideBufferTime = TimeUtils.millisToNanos(200); @@ -144,7 +142,6 @@ public class Player extends AnimatedObject implements CollisionEntity { facing_direction = RIGHT; } state = State.IDLE; - slide_time3 = (System.nanoTime() - slide_time2); } if (KeyHeld(Action.MOVE_LEFT) && !KeyHeld(Action.MOVE_RIGHT)) { if (facing_direction == LEFT && x_velocity > -sliding_velocity * 1.5 || @@ -244,7 +241,6 @@ public class Player extends AnimatedObject implements CollisionEntity { private void performSlide() { slide_time = RabiClone.TIME; - slide_time2 = System.nanoTime(); if (facing_direction) { x_velocity = sliding_velocity; } else {