mehah / otclient

An alternative tibia client for otserv written in C++20 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
263 stars 206 forks source link

Item (96x96) disappears when you move behind the field of view #513

Closed poxis closed 1 year ago

poxis commented 1 year ago

Priority

Low

Area

What happened?

Description in the video:

https://imgur.com/a/XmWOZXP

this happens on the top and left side

What OS are you seeing the problem on?

Windows

Code of Conduct

mehah commented 1 year ago

the ideal is 64x64, as Tibia's border only contains 2 SQMs, 96x96 will occupy 3 SQMS.

but to fix your problem, put true in that line: https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/mapview.cpp#L526

but again, it will cause other problems, which there will be no solution, just that you put more tile to draw.

mehah commented 1 year ago

@poxis

try this:

in: https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/tile.cpp#L779

change to:

else if ((cameraPosition.y - checkPos.y >= viewPort.top) || (checkPos.y - cameraPosition.y == viewPort.bottom && !hasTallThings() && !hasWideThings() && !hasDisplacement() && !hasThingWithElevation() && m_walkingCreatures.empty()))
poxis commented 1 year ago

@mehah THANKS! work it, but again when we are at the top you can't see it, I did as in the old version and for me this solution works (I don't know if something doesn't cause other problems, I will test)

https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/mapview.cpp#L791 change to:

        vp.top = m_posInfo.awareRange.top;
        vp.right = m_posInfo.awareRange.right;
        vp.bottom = vp.top+1;
        vp.left = vp.right+1;
mehah commented 1 year ago

@poxis

the "problem" is not there.

edit this: https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/tile.cpp#L777

change to

 if ((cameraPosition.x - checkPos.x >= viewPort.left) || (checkPos.x - cameraPosition.x == viewPort.right && !hasWideThings() && !hasTallThings() && !hasDisplacement() && !hasThingWithElevation() && m_walkingCreatures.empty()))

and

https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/tile.cpp#L781

change to

        else if ((checkPos.x - cameraPosition.x > viewPort.right && (!hasWideThings() || !hasTallThings() || !hasDisplacement() || !hasThingWithElevation())) || (checkPos.y - cameraPosition.y > viewPort.bottom))
poxis commented 1 year ago

first if ((cameraPosition.x - checkPos.x .. no work

second else if ((checkPos.x - ca no work

work for me change only: https://github.com/mehah/otclient/blob/9ac32648210a31239c27dee63b2ad5e099b9aff1/src/client/tile.cpp#L781

to else if (((checkPos.x - cameraPosition.x > viewPort.right && (!hasWideThings() || !hasDisplacement() || !hasThingWithElevation())) || (checkPos.y - cameraPosition.y > viewPort.bottom)) && !hasTallThings())

works without changing the first if ((cameraPosition.x - checkPos.x ..

mehah commented 1 year ago

@poxis can you test this fix?

poxis commented 1 year ago

@mehah work, but I think you've already checked

mehah commented 1 year ago

@poxis

this fix is for items occupying 3sqms, with the old method, objects occupying 2sqms will be drawn even if they don't show up in your view.

and tibia doesn't have 96x96 objects (3 sqms) so there's no way for me to test.