Adjusted a few comments

This commit is contained in:
Kayne Ruse
2014-04-21 23:45:50 +10:00
parent c534158c2e
commit e756289c2b
5 changed files with 7 additions and 26 deletions
+1 -4
View File
@@ -131,11 +131,11 @@ void InWorld::RenderFrame() {
// SDL_FillRect(GetScreen(), 0, 0); // SDL_FillRect(GetScreen(), 0, 0);
Render(GetScreen()); Render(GetScreen());
SDL_Flip(GetScreen()); SDL_Flip(GetScreen());
fps.Calculate();
} }
void InWorld::Render(SDL_Surface* const screen) { void InWorld::Render(SDL_Surface* const screen) {
//draw the map //draw the map
//TODO: figure out something to fix the region container access
for (auto it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); it++) { for (auto it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); it++) {
tileSheet.DrawRegionTo(screen, *it, camera.x, camera.y); tileSheet.DrawRegionTo(screen, *it, camera.x, camera.y);
} }
@@ -148,10 +148,7 @@ void InWorld::Render(SDL_Surface* const screen) {
//draw UI //draw UI
disconnectButton.DrawTo(screen); disconnectButton.DrawTo(screen);
shutDownButton.DrawTo(screen); shutDownButton.DrawTo(screen);
font.DrawStringTo(to_string_custom(fps.GetFrameRate()), screen, 0, 0); font.DrawStringTo(to_string_custom(fps.GetFrameRate()), screen, 0, 0);
fps.Calculate();
} }
//------------------------- //-------------------------
+2
View File
@@ -66,6 +66,8 @@ union SerialPacket {
//map data //map data
REGION_REQUEST = 13, REGION_REQUEST = 13,
REGION_CONTENT = 14, REGION_CONTENT = 14,
//TODO: combat packets
}; };
//metadata on the packet itself //metadata on the packet itself
+1 -15
View File
@@ -87,21 +87,7 @@ void EditorScene::FrameEnd() {
void EditorScene::Render(SDL_Surface* const screen) { void EditorScene::Render(SDL_Surface* const screen) {
tsheet.DrawRegionTo(screen, pager.GetRegion(0, 0), camera.x, camera.y); tsheet.DrawRegionTo(screen, pager.GetRegion(0, 0), camera.x, camera.y);
/* //debug
for (int i = 0; i < pager.GetRegionWidth()*2; i++) {
for (int j = 0; j < pager.GetRegionHeight()*2; j++) {
for (int k = 0; k < pager.GetRegionDepth(); k++) {
//TODO: skip the out-of-bounds regions
tsheet.DrawTo(
screen,
i*tsheet.GetTileW()-camera.x,
j*tsheet.GetTileH()-camera.y,
pager.GetTile(i,j,k)
);
}
}
}
*/
//draw a big bar across the top (hackish) //draw a big bar across the top (hackish)
buttonImage.SetClipY(0); buttonImage.SetClipY(0);
for (int i = 0; i < screen->w; i += buttonImage.GetClipW()) { for (int i = 0; i < screen->w; i += buttonImage.GetClipW()) {
+2 -7
View File
@@ -110,7 +110,6 @@ void ServerApplication::Proc() {
HandlePacket(packet); HandlePacket(packet);
} }
//give the computer a break //give the computer a break
//TODO: remove this delay?
SDL_Delay(10); SDL_Delay(10);
} }
} }
@@ -178,7 +177,6 @@ void ServerApplication::HandleBroadcastRequest(SerialPacket packet) {
packet.meta.type = SerialPacket::Type::BROADCAST_RESPONSE; packet.meta.type = SerialPacket::Type::BROADCAST_RESPONSE;
//pack the data //pack the data
//TODO: version info
snprintf(packet.serverInfo.name, PACKET_STRING_SIZE, "%s", config["server.name"].c_str()); snprintf(packet.serverInfo.name, PACKET_STRING_SIZE, "%s", config["server.name"].c_str());
packet.serverInfo.playerCount = playerMap.size(); packet.serverInfo.playerCount = playerMap.size();
packet.serverInfo.regionWidth = REGION_WIDTH; packet.serverInfo.regionWidth = REGION_WIDTH;
@@ -252,8 +250,6 @@ void ServerApplication::HandleSynchronize(SerialPacket packet) {
SerialPacket newPacket; SerialPacket newPacket;
char buffer[PACKET_BUFFER_SIZE]; char buffer[PACKET_BUFFER_SIZE];
//TODO: syncronize the map?
//players //players
newPacket.meta.type = SerialPacket::Type::PLAYER_UPDATE; newPacket.meta.type = SerialPacket::Type::PLAYER_UPDATE;
for (auto& it : playerMap) { for (auto& it : playerMap) {
@@ -296,8 +292,7 @@ void ServerApplication::HandlePlayerNew(SerialPacket packet) {
newPlayer.motion = {0,0}; newPlayer.motion = {0,0};
newPlayer.bbox = {0, 0, 0, 0}; newPlayer.bbox = {0, 0, 0, 0};
//stats //TODO: Add the statistic creation code here
//TODO
//push this player //push this player
playerMap[PlayerEntry::uidCounter] = newPlayer; playerMap[PlayerEntry::uidCounter] = newPlayer;
@@ -364,7 +359,7 @@ void ServerApplication::HandleRegionRequest(SerialPacket packet) {
} }
void ServerApplication::PumpPacket(SerialPacket packet) { void ServerApplication::PumpPacket(SerialPacket packet) {
//I don't really like this, but it'll do for now //NOTE: I don't really like this, but it'll do for now
char buffer[PACKET_BUFFER_SIZE]; char buffer[PACKET_BUFFER_SIZE];
serialize(&packet, buffer); serialize(&packet, buffer);
for (auto& it : clientMap) { for (auto& it : clientMap) {
+1
View File
@@ -88,6 +88,7 @@ private:
//maps //maps
//TODO: I need to handle multiple map objects //TODO: I need to handle multiple map objects
//TODO: Unload regions that are distant from any players
RegionPager<LuaAllocator, LuaFormat> regionPager; RegionPager<LuaAllocator, LuaFormat> regionPager;
//misc //misc