alexxxxxxx
Active Member
- Joined
- Aug 16, 2015
- Messages
- 21
- Reaction score
- 34
- Location
- Brasil
- GitHub
- l3k0t
- YouTube
- UCMP25Br519j7dD1FF
Extended Screen for OTClient V8 (TFS 0.4)
Hello everyone, today I am bringing an extended screen for OTClient V8 in the latest version. I hope this will be useful for you! This version comes with code updates that are easy to understand. Tested on TFS 0.4.
Step 1: Modifications to the const.h
Open the file const.hand find:
LUA:
#define NETWORK_MAX_SIZE 49180
Code:
#define NETWORKMESSAGE_MAXSIZE 49180
Change to:
Code:
# define NETWORK_MAX_SIZE 49180
or depending on your source
# define NETWORKMESSAGE_MAXSIZE 49180
Step 2: Modifications to the Protocollgame.cpp
Against:
Code:
((x >= myPos.x - 8 + offsetz) && (x <= myPos.x + 9 + offsetz) &&
//(y >= myPos.y - 6 + offsetz) && (y <= myPos.y + 7 + offsetz));
Change to:
Code:
((x >= myPos.x - Map::maxClientViewportX + offsetz) && (x <= myPos.x + (Map::maxClientViewportX+1) + offsetz) &&
(y >= myPos.y - Map::maxClientViewportY + offsetz) && (y <= myPos.y + (Map::maxClientViewportY+1) + offsetz));
Step 3: Updates to map descriptions
Against:
Code:
GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 18, 14, msg);
Change to:
Code:
GetMapDescription(pos.x - Map::maxClientViewportX, pos.y - Map::maxClientViewportY, pos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, msg);
Step 4: Character movement updates
Against:
Code:
if(oldPos.y > newPos.y) // north, for old x
{
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 8, newPos.y - 6, newPos.z, 18, 1, msg);
}
else if(oldPos.y < newPos.y) // south, for old x
{
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 8, newPos.y + 7, newPos.z, 18, 1, msg);
}
if(oldPos.x < newPos.x) // east, [with new y]
{
msg->put<char>(0x66);
GetMapDescription(newPos.x + 9, newPos.y - 6, newPos.z, 1, 14, msg);
}
else if(oldPos.x > newPos.x) // west, [with new y]
{
msg->put<char>(0x68);
GetMapDescription(newPos.x - 8, newPos.y - 6, newPos.z, 1, 14, msg);
}
Change to:
Code:
if (oldPos.y > newPos.y) { // north, for old x
msg->put<char>(0x65);
GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, 1, msg);
}
else if (oldPos.y < newPos.y) { // south, for old x
msg->put<char>(0x67);
GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y + (Map::maxClientViewportY+1), newPos.z, (Map::maxClientViewportX+1)*2, 1, msg);
}
if (oldPos.x < newPos.x) { // east, [with new y]
msg->put<char>(0x66);
GetMapDescription(newPos.x + (Map::maxClientViewportX+1), newPos.y - Map::maxClientViewportY, newPos.z, 1, (Map::maxClientViewportY+1)*2, msg);
}
else if (oldPos.x > newPos.x) { // west, [with new y]
msg->put<char>(0x68);
GetMapDescription(newPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z, 1, (Map::maxClientViewportY+1)*2, msg);
}
Step 5: Updates to floor descriptions
Against:
Code:
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 5, 18, 14, 3, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 4, 18, 14, 4, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 3, 18, 14, 5, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 2, 18, 14, 6, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 1, 18, 14, 7, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 0, 18, 14, 8, skip);
Change to:
Code:
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 5, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 3, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 4, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 4, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 3, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 5, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 6, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 1, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 7, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 0, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 8, skip);
Step 6: Other modifications
Against:
Code:
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, oldPos.z - 3, 18, 14, 3, skip);
Change to:
Code:
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, oldPos.z - 3, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 3, skip);
Step 7: Additional modifications
Against:
Code:
GetMapDescription(oldPos.x - 8, oldPos.y + 1 - 6, newPos.z, 1, 14, msg);
Change to:
Code:
GetMapDescription(oldPos.x - Map::maxClientViewportX, oldPos.y - (Map::maxClientViewportY-1), newPos.z, 1, (Map::maxClientViewportY+1)*2, msg);
Step 9: Further modifications to floor descriptions
Against:
Code:
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z, 18, 14, -1, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 1, 18, 14, -2, skip);
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 2, 18, 14, -3, skip);
Change to:
Code:
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -1, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 1, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -2, skip);
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -3, skip);
Step 10: Last modifications
Against:
Code:
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 2, 18, 14, -3, skip);
Change to:
Code:
GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -3, skip);
Step 11: Final adjustments
Against:
Code:
GetMapDescription(oldPos.x + 9, oldPos.y - 1 - 6, newPos.z, 1, 14, msg);
Change to:
Code:
GetMapDescription(oldPos.x + Map::maxClientViewportX+1, oldPos.y - (Map::maxClientViewportY+1), newPos.z, 1, ((Map::maxClientViewportY+1)*2), msg);
Step 12: Updates inMAP.H
Open the MAP.Hserver file and find:
Code:
static const int32_t maxViewportX = 11; //min value: maxClientViewportX + 1
static const int32_t maxViewportY = 11; //min value: maxClientViewportY + 1
static const int32_t maxClientViewportX = 8;
static const int32_t maxClientViewportY = 6;
Change to:
Code:
static const int32_t maxViewportX = 15; //min value: maxClientViewportX + 1
static const int32_t maxViewportY = 15; //min value: maxClientViewportY + 1
static const int32_t maxClientViewportX = 14;
static const int32_t maxClientViewportY = 12;
Done, now just compile your server's sources in Rebuild mode to clear the cache.
Step 2: OTClient V8
Open the map.cpp OTClient V8 sources file and find:
Code:
void Map::resetAwareRange()
{
AwareRange range;
range.left = 8;
range.top = 6;
range.bottom = 7;
range.right = 9;
setAwareRange(range);
}
Change to:
Code:
void Map::resetAwareRange()
{
AwareRange range;
range.left = 14; //Change this to = maxClientViewportX
range.top = 12; //Change this to = maxClientViewportY
range.bottom = range.top+1;
range.right = range.left+1;
setAwareRange(range);
}
Compile the OTClient source also in Rebuild mode and that's it!