Fixes for Rainbow Treasure OP #428
Conversation
…going to a new map.
| } | ||
|
|
||
| int Game_Character::GetScreenY() const { | ||
| int y = (real_y - Game_Map::GetDisplayY() + 3) / (SCREEN_TILE_WIDTH / TILE_SIZE) + TILE_SIZE; | ||
| int y = real_y / (SCREEN_TILE_WIDTH / TILE_SIZE) - Game_Map::GetDisplayY() / (SCREEN_TILE_WIDTH / TILE_SIZE) + TILE_SIZE; |
Ghabry
Feb 26, 2015
Member
This can be simplified to
(real_y - Game_Map::GetDisplayY()) / (SCREEN_TILE_WIDTH / TILE_SIZE) + TILE_SIZE;
(same for x)
This can be simplified to
(real_y - Game_Map::GetDisplayY()) / (SCREEN_TILE_WIDTH / TILE_SIZE) + TILE_SIZE;
(same for x)
Zegeri
Feb 26, 2015
Member
a / (b / c) = a * c / b. So that can be rewritten as:
((real_y - Game_Map::GetDisplayY()) / SCREEN_TILE_WIDTH + 1) * TILE_SIZE;
a / (b / c) = a * c / b. So that can be rewritten as:
((real_y - Game_Map::GetDisplayY()) / SCREEN_TILE_WIDTH + 1) * TILE_SIZE;
Ghabry
Feb 26, 2015
Member
Finally a practical use for school math.
Finally a practical use for school math.
scurest
Feb 26, 2015
Author
Contributor
Unfortunately integer division doesn't distribute over addition, eg. take SCREEN_TILE_WIDTH/TILE_SIZE=16, GetDisplayY()=1, and real_y=16. Then 16/16 - 1/16 = 1, but (16-1)/16 = 0.
Unfortunately integer division doesn't distribute over addition, eg. take SCREEN_TILE_WIDTH/TILE_SIZE=16, GetDisplayY()=1, and real_y=16. Then 16/16 - 1/16 = 1, but (16-1)/16 = 0.
|
Thanks scurest, about the swear drop issue is possibly related with #333. |
|
+1 for this really detailed pull request. |
|
I'm pretty sure no open issues are closed by this one, haha. By the way... (I've never used Github before) would it have been better to open individual issues for all these and put details there? |
|
I think there are a good collection of visible bugs not reported in the issue tracker which can be fixed "on the fly" without needing to open a separated bug before and it saves development time. They can be reported before, but I think it is not necessary in the current development stage. A lot of code contributed didn't have an issue previously opened and it can be discussed in pull requests too :) . |
|
I usually only open issues for problems where I'm certain that there won't be a fix from my side soon. |
Fixes the errors I noticed in the Rainbow Treasure OP.
Character placement off f1fe079
Some events are drawn off by one pixel. Caused by the formula in
Game_Character::GetScreenX()andY(). Changed to take the difference in pixels, not real coordinates, which I think is correct. Can someone check?Pan speed too slow be05554
The pan drags behind the characters during the OP. Changed just by increasing the pan speed, but also changed to use
SCREEN_TILE_WIDTH / 128instead of2, like for characters, I think it goes here too: @Ghabry, you made that change for character speed, what do you think?Pan jumps after map teleport 8efd1a5
Caused by the pan in
Game_Playerbeing reset too early. I think this also fixes a bug where the pan is lost when teleporting within the same map (?).Parallax BGs don't scroll backwards 28cedf8
Manganese's OP uses a parallax background to make it look like she's walking, but it goes the wrong way! Just a missing sign in
UpdateParallaxbut I also usedSCREEN_TILE_WIDTH / 128here and sped it up.Jumping in place 716623d
Discussed here.
There's also #356 and one more I just noticed—the old man in front of the chest's sweat drop is drawn behind him when it should be drawn in front—that I didn't fix.