From 4ba9954eb8f12b8fe06610f0536f144f5e72979e Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 28 Apr 2020 21:32:53 -0700 Subject: [PATCH] Move cursor delay update logic to maplogic() Otherwise it'll go really really fast. Incidentally this also basically de-duplicates it and results in less copy-pasted code overall. --- desktop_version/src/Logic.cpp | 13 +++++++++++ desktop_version/src/Render.cpp | 40 ++-------------------------------- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 89c68e11..7a6a4340 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -61,6 +61,19 @@ void maplogic() graphics.menuoffset = 0; } } + + if (map.cursorstate == 0){ + map.cursordelay++; + if (map.cursordelay > 10){ + map.cursorstate = 1; + map.cursordelay = 0; + } + }else if (map.cursorstate == 1){ + map.cursordelay++; + if (map.cursordelay > 30) map.cursorstate = 2; + }else if (map.cursorstate == 2){ + map.cursordelay++; + } } diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 3f3da98f..66bf397e 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1786,19 +1786,6 @@ void maprender() } } - if (map.cursorstate == 0){ - map.cursordelay++; - if (map.cursordelay > 10){ - map.cursorstate = 1; - map.cursordelay = 0; - } - }else if (map.cursorstate == 1){ - map.cursordelay++; - if (map.cursordelay > 30) map.cursorstate = 2; - }else if (map.cursorstate == 2){ - map.cursordelay++; - } - //normal size maps if(map.customzoom==4){ if(map.cursorstate==1){ @@ -1857,18 +1844,8 @@ void maprender() if (game.roomx == 109) { //tower!instead of room y, scale map.ypos - if (map.cursorstate == 0) + if (map.cursorstate == 1) { - map.cursordelay++; - if (map.cursordelay > 10) - { - map.cursorstate = 1; - map.cursordelay = 0; - } - } - else if (map.cursorstate == 1) - { - map.cursordelay++; if (int(map.cursordelay / 4) % 2 == 0) { graphics.drawrect(40 + ((game.roomx - 100) * 12) , 21 , 12, 180, 255,255,255); @@ -1878,7 +1855,6 @@ void maprender() } else if (map.cursorstate == 2) { - map.cursordelay++; if (int(map.cursordelay / 15) % 2 == 0) { graphics.drawrect(40 + ((game.roomx - 100) * 12) + 2 , 21 + 2, 12 - 4, 180 - 4,16, 245 - (help.glow), 245 - (help.glow)); @@ -1887,28 +1863,16 @@ void maprender() } else { - if (map.cursorstate == 0) + if (map.cursorstate == 1) { - map.cursordelay++; - if (map.cursordelay > 10) - { - map.cursorstate = 1; - map.cursordelay = 0; - } - } - else if (map.cursorstate == 1) - { - map.cursordelay++; if (int(map.cursordelay / 4) % 2 == 0) { graphics.drawrect(40 + ((game.roomx - 100) * 12) , 21 + ((game.roomy - 100) * 9) , 12 , 9 , 255,255,255); graphics.drawrect(40 + ((game.roomx - 100) * 12) + 2, 21 + ((game.roomy - 100) * 9) + 2, 12 - 4, 9 - 4, 255,255,255); } - if (map.cursordelay > 30) map.cursorstate = 2; } else if (map.cursorstate == 2) { - map.cursordelay++; if (int(map.cursordelay / 15) % 2 == 0) { graphics.drawrect(40 + ((game.roomx - 100) * 12) + 2, 21 + ((game.roomy - 100) * 9) + 2, 12 - 4, 9 - 4, 16, 245 - (help.glow), 245 - (help.glow));