diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp index 0bd06b9c..6aabccbb 100644 --- a/desktop_version/src/CustomLevels.cpp +++ b/desktop_version/src/CustomLevels.cpp @@ -871,8 +871,8 @@ void customlevelclass::findstartpoint(void) else { //Start point spawn - int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40; - int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30; + int tx=customentities[testeditor].x/40; + int ty=customentities[testeditor].y/30; game.edsavex = ((customentities[testeditor].x%40)*8)-4; game.edsavey = (customentities[testeditor].y%30)*8; game.edsaverx = 100+tx; diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 850bf2e0..eeacf4d8 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -721,7 +721,7 @@ void editorrender(void) if(temp2==i) { graphics.bprint((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8)-8, - "("+help.String(((customentities[i].p1-int(customentities[i].p1%40))/40)+1)+","+help.String(((customentities[i].p2-int(customentities[i].p2%30))/30)+1)+")",210,210,255); + "("+help.String(customentities[i].p1/40 + 1)+","+help.String(customentities[i].p2/30 + 1)+")",210,210,255); } else { @@ -854,7 +854,7 @@ void editorrender(void) if(ed.tilex+(ed.levx*40)==customentities[i].p1 && ed.tiley+(ed.levy*30)==customentities[i].p2) { graphics.bprint((customentities[i].p1*8)- (ed.levx*40*8),(customentities[i].p2*8)- (ed.levy*30*8)-8, - "("+help.String(((customentities[i].x-int(customentities[i].x%40))/40)+1)+","+help.String(((customentities[i].y-int(customentities[i].y%30))/30)+1)+")",190,190,225); + "("+help.String(customentities[i].x/40 + 1)+","+help.String(customentities[i].y/30 + 1)+")",190,190,225); } else { @@ -2720,8 +2720,8 @@ void editorinput(void) //if() on screen if(customentities[i].t==16 && testeditor==-1) { - int tx=(customentities[i].x-(customentities[i].x%40))/40; - int ty=(customentities[i].y-(customentities[i].y%30))/30; + int tx=customentities[i].x/40; + int ty=customentities[i].y/30; if(tx==ed.levx && ty==ed.levy) { testeditor=i; @@ -2737,8 +2737,8 @@ void editorinput(void) //if() on screen if(customentities[i].t==10 && testeditor==-1) { - int tx=(customentities[i].x-(customentities[i].x%40))/40; - int ty=(customentities[i].y-(customentities[i].y%30))/30; + int tx=customentities[i].x/40; + int ty=customentities[i].y/30; if(tx==ed.levx && ty==ed.levy) { testeditor=i; @@ -2758,8 +2758,8 @@ void editorinput(void) if(startpoint==0) { //Checkpoint spawn - int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40; - int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30; + int tx=customentities[testeditor].x/40; + int ty=customentities[testeditor].y/30; game.edsavex = (customentities[testeditor].x%40)*8 - 4; game.edsavey = (customentities[testeditor].y%30)*8; game.edsaverx = 100+tx; @@ -2779,8 +2779,8 @@ void editorinput(void) else { //Start point spawn - int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40; - int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30; + int tx=customentities[testeditor].x/40; + int ty=customentities[testeditor].y/30; game.edsavex = (customentities[testeditor].x%40)*8 - 4; game.edsavey = (customentities[testeditor].y%30)*8; game.edsaverx = 100+tx; diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 4bdf8379..fba49cb1 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4076,8 +4076,7 @@ int entityclass::checkactivity(void) int entityclass::getgridpoint( int t ) { - t = (t - (t % 8)) / 8; - return t; + return t / 8; } bool entityclass::checkplatform(const SDL_Rect& temprect, int* px, int* py) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index d3a59d25..674034ca 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5779,7 +5779,7 @@ std::string Game::partimestring(void) std::string tempstring = ""; if (timetrialpar >= 60) { - tempstring = help.twodigits(int((timetrialpar - (timetrialpar % 60)) / 60)) + ":" + help.twodigits(timetrialpar % 60); + tempstring = help.twodigits(timetrialpar / 60) + ":" + help.twodigits(timetrialpar % 60); } else { @@ -5794,7 +5794,7 @@ std::string Game::resulttimestring(void) std::string tempstring = ""; if (timetrialresulttime >= 60) { - tempstring = help.twodigits(int((timetrialresulttime - (timetrialresulttime % 60)) / 60)) + ":" + tempstring = help.twodigits(timetrialresulttime / 60) + ":" + help.twodigits(timetrialresulttime % 60); } else @@ -5811,7 +5811,7 @@ std::string Game::timetstring( int t ) std::string tempstring = ""; if (t >= 60) { - tempstring = help.twodigits(int((t - (t % 60)) / 60)) + ":" + help.twodigits(t % 60); + tempstring = help.twodigits(t / 60) + ":" + help.twodigits(t % 60); } else { diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index cb6f35e4..00358146 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -1250,8 +1250,8 @@ void gamelogic(void) int edi=obj.entities[game.edteleportent].behave; int edj=obj.entities[game.edteleportent].para; int edi2, edj2; - edi2 = (edi-(edi%40))/40; - edj2 = (edj-(edj%30))/30; + edi2 = edi/40; + edj2 = edj/30; map.warpto(100+edi2, 100+edj2, obj.getplayer(), edi%40, (edj%30)+2); game.teleport = false; diff --git a/desktop_version/src/Tower.cpp b/desktop_version/src/Tower.cpp index 0c551196..eaa622d5 100644 --- a/desktop_version/src/Tower.cpp +++ b/desktop_version/src/Tower.cpp @@ -20,10 +20,7 @@ towerclass::towerclass(void) int towerclass::backat(int xp, int yp, int yoff) { - yp = yp * 8; - yp += yoff; - yoff = yp % 8; - yp = (yp - yoff) / 8; + yp = (yp*8 + yoff) / 8; if (xp >= 0 && xp < 40) { @@ -42,10 +39,7 @@ int towerclass::at(int xp, int yp, int yoff) } else { - yp = yp * 8; - yp += yoff; - yoff = yp % 8; - yp = (yp - yoff) / 8; + yp = (yp*8 + yoff) / 8; while (yp < 0) yp += 700; while (yp >= 700) yp -= 700; @@ -67,10 +61,7 @@ int towerclass::at(int xp, int yp, int yoff) int towerclass::miniat(int xp, int yp, int yoff) { - yp = yp * 8; - yp += yoff; - yoff = yp % 8; - yp = (yp - yoff) / 8; + yp = (yp*8 + yoff) / 8; while (yp < 0) yp += 100; while (yp >= 100) yp -= 100; diff --git a/desktop_version/src/UtilityClass.cpp b/desktop_version/src/UtilityClass.cpp index 0b58b5ef..7a576776 100644 --- a/desktop_version/src/UtilityClass.cpp +++ b/desktop_version/src/UtilityClass.cpp @@ -185,7 +185,7 @@ std::string UtilityClass::timestring( int t ) { //given a time t in frames, return a time in seconds std::string tempstring = ""; - int temp = (t - (t % 30)) / 30; + int temp = t / 30; if (temp < 60) //less than one minute { t = t % 30; @@ -193,7 +193,7 @@ std::string UtilityClass::timestring( int t ) } else { - int temp2 = (temp - (temp % 60)) / 60; + int temp2 = temp / 60; temp = temp % 60; t = t % 30; tempstring = String(temp2) + ":" + twodigits(temp) + ":" + twodigits(t * 100 / 30);