Hi
TFS 1.5 downgrades 8.60
Otclient v8 - GitHub - OTCv8/otcv8-dev: OTCv8 Development repository (source code) (https://github.com/OTCv8/otcv8-dev)
I have problem with floor view when im on floor 9+ everything work fine but when i restart client and login on floor -8(8,7,6,5,4,3,2,1,0) then i see black tiles relog doesn't help,but when i going out off screen and back then all back to normal until reset the client.
i follow this two threads
screens : that black tiles are on floor 8/7/6/5/4/3/2/1/0
Gyazo (https://gyazo.com/2f76ac3319f6bf4d9dfd23a614c033ed) - 6 floor
Gyazo (https://gyazo.com/f82b30455206680a18d1d5f6fb21b1d6) - 6 floor after visit 9/10/11/12 floors
Gyazo (https://gyazo.com/ad5665fcc9465f39cd4587a19995bd41) - 8 floor
Gyazo (https://gyazo.com/520a189d115fd23ec1cb9fb78e2678d9) - 8 floor after visit 9/10/11/12 floors
i think below its all what i edit for this floor view i want to see from floor 0 to 15 and 15 to 0 if available
tell me when you need other code or just full files.
Protocolgame.cpp (server side)
Client
Protocolgameparse.cpp
map.cpp
mapview.cpp
const.h
TFS 1.5 downgrades 8.60
Otclient v8 - GitHub - OTCv8/otcv8-dev: OTCv8 Development repository (source code) (https://github.com/OTCv8/otcv8-dev)
I have problem with floor view when im on floor 9+ everything work fine but when i restart client and login on floor -8(8,7,6,5,4,3,2,1,0) then i see black tiles relog doesn't help,but when i going out off screen and back then all back to normal until reset the client.
i follow this two threads
[C++] Ground-Underground Mapping and Sunshine
Hello everyone. I recently ran into some problems tring to create more complex landscapes using the forgotten server engine and set out to try and bypass, if not fix, these following issues 1a) The z =< 7 and z > 7 floors of the map don't communicate with each other. You can map something very...
otland.net
How to make the player who is on the 7th floor see who is on the 8th floor
I am trying to create transparent water, I have added the sprites on the client and activated the transparency in otclient, but by default it is not possible to see who is on floor 8 being on the 7th floor. I made several changes in the sources of the client more without result. mapview.ccp...
otland.net
screens : that black tiles are on floor 8/7/6/5/4/3/2/1/0
Gyazo (https://gyazo.com/2f76ac3319f6bf4d9dfd23a614c033ed) - 6 floor
Gyazo (https://gyazo.com/f82b30455206680a18d1d5f6fb21b1d6) - 6 floor after visit 9/10/11/12 floors
Gyazo (https://gyazo.com/ad5665fcc9465f39cd4587a19995bd41) - 8 floor
Gyazo (https://gyazo.com/520a189d115fd23ec1cb9fb78e2678d9) - 8 floor after visit 9/10/11/12 floors
i think below its all what i edit for this floor view i want to see from floor 0 to 15 and 15 to 0 if available
tell me when you need other code or just full files.
Protocolgame.cpp (server side)
C++:
void ProtocolGame::GetMapDescription(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height, NetworkMessage& msg)
{
int32_t skip = -1;
int32_t startz, endz, zstep = 0;
if (z > 7) {
startz = z - 8;
endz = std::min<int32_t>(MAP_MAX_LAYERS - 1, z + 8);
zstep = 1;
} else {
startz = 15;
endz = 0;
zstep = -1;
}
for (int32_t nz = startz; nz != endz + zstep; nz += zstep) {
GetFloorDescription(msg, x, y, nz, width, height, z - nz, skip);
}
if (skip >= 0) {
msg.addByte(skip);
msg.addByte(0xFF);
}
}
bool ProtocolGame::canSee(int32_t x, int32_t y, int32_t z) const
{
if (!player) {
return false;
}
const Position& myPos = player->getPosition();
if (myPos.z <= 7) {
//we are on ground level or above (7 -> 0)
//view is from 7 -> 0
if (z > 15) {
return false;
}
}
else {
if (myPos.z >= 8) {
//we are underground (8 -> 15)
//view is +/- 2 from the floor we stand on
if (std::abs(myPos.getZ() - z) > 8) {
return false;
}
}
}
Client
Protocolgameparse.cpp
C++:
void ProtocolGame::setMapDescription(const InputMessagePtr& msg, int x, int y, int z, int width, int height)
{
int startz, endz, zstep;
if (z > Otc::SEA_FLOOR) {
startz = z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
endz = std::min<int>(z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
zstep = 1;
} else {
startz = Otc::SEA_FLOOR+8;
endz = 0;
zstep = -1;
}
int skip = 0;
for (int nz = startz; nz != endz + zstep; nz += zstep)
skip = setFloorDescription(msg, x, y, nz, width, height, z - nz, skip);
}
map.cpp
Code:
int Map::getFirstAwareFloor()
{
if(m_centralPosition.z > Otc::SEA_FLOOR)
return m_centralPosition.z-Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
else
return 0;
}
int Map::getLastAwareFloor()
{
if(m_centralPosition.z > Otc::SEA_FLOOR)
return std::min<int>(m_centralPosition.z+Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
else
return Otc::SEA_FLOOR+8;
}
mapview.cpp
C++:
int MapView::calcLastVisibleFloor()
{
if(!m_multifloor)
return calcFirstVisibleFloor();
int z = 7;
Position cameraPosition = getCameraPosition();
// this could happens if the player is not known yet
if(cameraPosition.isValid()) {
// view only underground floors when below sea level
if(cameraPosition.z > Otc::SEA_FLOOR)
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
else
z = 15;
}
if(m_lockedFirstVisibleFloor != -1)
z = std::max<int>(m_lockedFirstVisibleFloor, z);
// just ensure the that the floor is in the valid range
z = stdext::clamp<int>(z, 0, (int)Otc::MAX_Z);
return z;
}
int MapView::calcFirstVisibleFloor(bool forFading)
{
int z = 7;
// return forced first visible floor
if(m_lockedFirstVisibleFloor != -1) {
z = m_lockedFirstVisibleFloor;
} else {
Position cameraPosition = getCameraPosition();
// this could happens if the player is not known yet
if(cameraPosition.isValid()) {
// avoid rendering multifloors in far views
if(!m_multifloor) {
z = cameraPosition.z;
} else {
// if nothing is limiting the view, the first visible floor is 0
int firstFloor = 0;
// limits to underground floors while under sea level
if (cameraPosition.z > Otc::SEA_FLOOR)
firstFloor = 0;
// loop in 3x3 tiles around the camera
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z && !forFading; ++ix) {
for(int iy = -1; iy <= 1 && firstFloor < cameraPosition.z; ++iy) {
Position pos = cameraPosition.translated(ix, iy);
// process tiles that we can look through, e.g. windows, doors
if((ix == 0 && iy == 0) || ((std::abs(ix) != std::abs(iy)) && g_map.isLookPossible(pos))) {
Position upperPos = pos;
Position coveredPos = pos;
while(coveredPos.coveredUp() && upperPos.up() && upperPos.z >= firstFloor) {
// check tiles physically above
TilePtr tile = g_map.getTile(upperPos);
if(tile && tile->limitsFloorsView(!g_map.isLookPossible(pos))) {
firstFloor = upperPos.z + 1;
break;
}
// check tiles geometrically above
tile = g_map.getTile(coveredPos);
if(tile && tile->limitsFloorsView(g_map.isLookPossible(pos))) {
firstFloor = coveredPos.z + 1;
break;
}
}
}
}
}
z = firstFloor;
}
}
}
// just ensure the that the floor is in the valid range
z = stdext::clamp<int>(z, 0, (int)Otc::MAX_Z);
return z;
}
int MapView::calcLastVisibleFloor()
{
if(!m_multifloor)
return calcFirstVisibleFloor();
int z = 7;
Position cameraPosition = getCameraPosition();
// this could happens if the player is not known yet
if(cameraPosition.isValid()) {
// view only underground floors when below sea level
if(cameraPosition.z > Otc::SEA_FLOOR)
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
else
z = 15;
}
if(m_lockedFirstVisibleFloor != -1)
z = std::max<int>(m_lockedFirstVisibleFloor, z);
// just ensure the that the floor is in the valid range
z = stdext::clamp<int>(z, 0, (int)Otc::MAX_Z);
return z;
}
const.h
C++:
{
enum : int {
MAX_ELEVATION = 24,
SEA_FLOOR = 7,
MAX_Z = 15,
UNDERGROUND_FLOOR = SEA_FLOOR+1,
AWARE_UNDEGROUND_FLOOR_RANGE = 8,
INVISIBLE_TICKS_PER_FRAME = 500,
INVISIBLE_TICKS_PER_FRAME_FAST = 100,
ITEM_TICKS_PER_FRAME = 500,
ITEM_TICKS_PER_FRAME_FAST = 100,
ANIMATED_TEXT_DURATION = 1000,
STATIC_DURATION_PER_CHARACTER = 60,
MIN_STATIC_TEXT_DURATION = 3000,
MAX_STATIC_TEXT_WIDTH = 200,
MAX_AUTOWALK_STEPS_RETRY = 10,
MAX_AUTOWALK_DIST = 127
};
Last edited: