Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: General comment cleanup #1313

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dGame/dComponents/PhantomPhysicsComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ void PhantomPhysicsComponent::SetDirection(const NiPoint3& pos) {
void PhantomPhysicsComponent::SpawnVertices() {
if (!m_dpEntity) return;

std::cout << m_Parent->GetObjectID() << std::endl;
LOG("%llu", m_Parent->GetObjectID());
auto box = static_cast<dpShapeBox*>(m_dpEntity->GetShape());
for (auto vert : box->GetVertices()) {
std::cout << vert.x << ", " << vert.y << ", " << vert.z << std::endl;
LOG("%f, %f, %f", vert.x, vert.y, vert.z);

EntityInfo info;
info.lot = 33;
Expand Down
12 changes: 0 additions & 12 deletions dGame/dGameMessages/GameMessageHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System

case eGameMessageType::REQUEST_RESURRECT: {
GameMessages::SendResurrect(entity);
/*auto* dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
if (dest) {
dest->SetHealth(4);
dest->SetArmor(0);
dest->SetImagination(6);
Game::entityManager->SerializeEntity(entity);
}*/
break;
}
case eGameMessageType::GET_HOT_PROPERTY_DATA: {
Expand Down Expand Up @@ -339,11 +332,8 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
RakNet::BitStream bitStreamLocal;
BitStreamUtils::WriteHeader(bitStreamLocal, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
bitStreamLocal.Write(entity->GetObjectID());
//bitStreamLocal.Write((unsigned short)eGameMessageType::ECHO_SYNC_SKILL);
//bitStreamLocal.Write(inStream);

SyncSkill sync = SyncSkill(inStream); // inStream replaced &bitStream
//sync.Serialize(&bitStreamLocal);

ostringstream buffer;

Expand All @@ -353,8 +343,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
buffer << setw(2) << hex << setfill('0') << (int)s << " ";
}

//cout << buffer.str() << endl;

if (usr != nullptr) {
RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)sync.sBitStream.c_str(), sync.sBitStream.size(), false);

Expand Down
8 changes: 4 additions & 4 deletions dGame/dUtilities/SlashCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,22 +1372,22 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit

ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(position.x)) + u", " + (GeneralUtils::to_u16string(position.y)) + u", " + (GeneralUtils::to_u16string(position.z)) + u">");

std::cout << position.x << ", " << position.y << ", " << position.z << std::endl;
LOG("Position: %f, %f, %f", position.x, position.y, position.z);
}

if (chatCommand == "rot" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
const auto rotation = entity->GetRotation();

ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(rotation.w)) + u", " + (GeneralUtils::to_u16string(rotation.x)) + u", " + (GeneralUtils::to_u16string(rotation.y)) + u", " + (GeneralUtils::to_u16string(rotation.z)) + u">");

std::cout << rotation.w << ", " << rotation.x << ", " << rotation.y << ", " << rotation.z << std::endl;
LOG("Rotation: %f, %f, %f, %f", rotation.w, rotation.x, rotation.y, rotation.z);
}

if (chatCommand == "locrow" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
const auto position = entity->GetPosition();
const auto rotation = entity->GetRotation();

std::cout << "<location x=\"" << position.x << "\" y=\"" << position.y << "\" z=\"" << position.z << "\" rw=\"" << rotation.w << "\" rx=\"" << rotation.x << "\" ry=\"" << rotation.y << "\" rz=\"" << rotation.z << "\" />" << std::endl;
LOG("<location x=\"%f\" y=\"%f\" z=\"%f\" rw=\"%f\" rx=\"%f\" ry=\"%f\" rz=\"%f\" />", position.x, position.y, position.z, rotation.w, rotation.x, rotation.y, rotation.z);
}

if (chatCommand == "playlvlfx" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
Expand Down Expand Up @@ -1652,7 +1652,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit

auto sphere = static_cast<dpShapeSphere*>(prox.second->GetShape());
auto pos = prox.second->GetPosition();
std::cout << prox.first << ", r: " << sphere->GetRadius() << ", pos: " << pos.x << "," << pos.y << "," << pos.z << std::endl;
LOG("Proximity: %s, r: %f, pos: %f, %f, %f", prox.first.c_str(), sphere->GetRadius(), pos.x, pos.y, pos.z);
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions dPhysics/dpEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dpEntity::dpEntity(const LWOOBJID& objectID, dpShapeType shapeType, bool isStati
break;

default:
std::cout << "No shape for shapeType: " << (int)shapeType << std::endl;
LOG("No shape for shapeType: %d", static_cast<int32_t>(shapeType));
}
}

Expand Down Expand Up @@ -83,15 +83,9 @@ void dpEntity::CheckCollision(dpEntity* other) {
if (isColliding && !wasFound) {
m_CurrentlyCollidingObjects.emplace(other->GetObjectID(), other);
m_NewObjects.push_back(other);

//if (m_CollisionShape->GetShapeType() == dpShapeType::Sphere && other->GetShape()->GetShapeType() == dpShapeType::Sphere)
//std::cout << "started sphere col at: " << other->GetPosition().x << ", " << other->GetPosition().y << ", " << other->GetPosition().z << std::endl;
} else if (!isColliding && wasFound) {
m_CurrentlyCollidingObjects.erase(other->GetObjectID());
m_RemovedObjects.push_back(other);

//if (m_CollisionShape->GetShapeType() == dpShapeType::Sphere && other->GetShape()->GetShapeType() == dpShapeType::Sphere)
// std::cout << "stopped sphere col at: " << other->GetPosition().x << ", " << other->GetPosition().y << ", " << other->GetPosition().z << std::endl;
}
}

Expand Down
2 changes: 0 additions & 2 deletions dPhysics/dpGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ dpGrid::dpGrid(int numCells, int cellSize) {
CELL_SIZE = cellSize;
m_DeleteGrid = true;

//dumb method but i can't be bothered

//fill x
for (int i = 0; i < NUM_CELLS; i++) {
m_Cells.push_back(std::vector<std::forward_list<dpEntity*>>());
Expand Down
4 changes: 2 additions & 2 deletions dPhysics/dpShapeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dpShapeBase::~dpShapeBase() {
}

bool dpShapeBase::IsColliding(dpShapeBase* other) {
std::cout << "Base shapes do not have any *shape* to them, and thus cannot be overlapping." << std::endl;
std::cout << "You should be using a shape class inherited from this base class." << std::endl;
LOG("Base shapes do not have any *shape* to them, and thus cannot be overlapping.");
LOG("You should be using a shape class inherited from this base class.");
return false;
}
5 changes: 1 addition & 4 deletions dPhysics/dpShapeBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool dpShapeBox::IsColliding(dpShapeBase* other) {
return dpCollisionChecks::CheckBoxes(m_ParentEntity, other->GetParentEntity());

default:
std::cout << "No collision detection for: " << (int)m_ShapeType << "-to-" << (int)other->GetShapeType() << " collision!" << std::endl;
LOG("No collision detection for: %i-to-%i collision!", static_cast<int32_t>(m_ShapeType), static_cast<int32_t>(other->GetShapeType()));
}

return false;
Expand Down Expand Up @@ -72,10 +72,7 @@ void dpShapeBox::SetScale(float scale) {
m_Height *= scale;
m_Depth *= scale;

//fuuuckkk yoouu
InitVertices();

//SetRotation(m_ParentEntity->GetRotation());
}

void dpShapeBox::SetRotation(const NiQuaternion& rotation) {
Expand Down
4 changes: 3 additions & 1 deletion dPhysics/dpShapeSphere.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "dpShapeSphere.h"
#include "dpCollisionChecks.h"
#include "Game.h"
#include "Logger.h"
#include <iostream>

dpShapeSphere::dpShapeSphere(dpEntity* parentEntity, float radius) :
Expand All @@ -22,7 +24,7 @@ bool dpShapeSphere::IsColliding(dpShapeBase* other) {
return dpCollisionChecks::CheckSphereBox(m_ParentEntity, other->GetParentEntity());

default:
std::cout << "No collision detection for: " << (int)m_ShapeType << "-to-" << (int)other->GetShapeType() << " collision!" << std::endl;
LOG("No collision detection for: %i-to-%i collision!", static_cast<int32_t>(m_ShapeType), static_cast<int32_t>(other->GetShapeType()));
}

return false;
Expand Down
35 changes: 0 additions & 35 deletions dPhysics/main.cpp

This file was deleted.

16 changes: 11 additions & 5 deletions dZoneManager/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
#include "AssetManager.h"
#include "dConfig.h"

void Level::SceneObjectDataChunk::PrintAllObjects() const {
for (const auto& [id, sceneObj] : objects) {
LOG("ID: %d LOT: %d", id, sceneObj.lot);
}
}

Level::Level(Zone* parentZone, const std::string& filepath) {
m_ParentZone = parentZone;

Expand All @@ -33,9 +39,9 @@ Level::Level(Zone* parentZone, const std::string& filepath) {
}

Level::~Level() {
for (std::map<uint32_t, Header>::iterator it = m_ChunkHeaders.begin(); it != m_ChunkHeaders.end(); ++it) {
if (it->second.id == Level::ChunkTypeID::FileInfo) delete it->second.fileInfo;
if (it->second.id == Level::ChunkTypeID::SceneObjectData) delete it->second.sceneObjects;
for (auto& [id, header] : m_ChunkHeaders) {
if (header.id == Level::ChunkTypeID::FileInfo) delete header.fileInfo;
if (header.id == Level::ChunkTypeID::SceneObjectData) delete header.sceneObjects;
}
}

Expand Down Expand Up @@ -248,8 +254,8 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
BinaryIO::BinaryRead(file, obj.id);
BinaryIO::BinaryRead(file, obj.lot);

/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.value1);
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.value2);
/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType);
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId);

BinaryIO::BinaryRead(file, obj.position);
BinaryIO::BinaryRead(file, obj.rotation);
Expand Down
6 changes: 1 addition & 5 deletions dZoneManager/Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ class Level {
struct SceneObjectDataChunk {
std::map<LWOOBJID, SceneObject> objects;

const void PrintAllObjects() {
for (std::map<LWOOBJID, SceneObject>::iterator it = objects.begin(); it != objects.end(); ++it) {
std::cout << "\t ID: " << it->first << " LOT: " << it->second.lot << std::endl;
}
}
void PrintAllObjects() const;

uint32_t GetObjectCount() { return objects.size(); }
};
Expand Down
2 changes: 2 additions & 0 deletions dZoneManager/Zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ struct PropertyPath {
float repMultiplier;
PropertyRentalPeriod rentalPeriod;
PropertyAchievmentRequired achievementRequired;

// Player respawn coordinates in the main zone (not the property zone)
NiPoint3 playerZoneCoords;
float maxBuildHeight;
};
Expand Down
4 changes: 2 additions & 2 deletions dZoneManager/dZMCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct mapCompareLwoSceneIDs {
struct SceneObject {
LWOOBJID id;
LOT lot;
uint32_t value1;
uint32_t value2;
uint32_t nodeType;
uint32_t glomId;
NiPoint3 position;
NiQuaternion rotation;
float scale = 1.0f;
Expand Down
10 changes: 0 additions & 10 deletions tests/dCommonTests/Amf3Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,15 @@ TEST(dCommonTests, AMF3InsertionAssociativeTest) {
array.Insert<std::vector<uint32_t>>("Undefined", {});
array.Insert("Null", nullptr);

std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<const char*>("CString")->GetValueType(), eAmf::String);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<std::string>("String")->GetValueType(), eAmf::String);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<bool>("False")->GetValueType(), eAmf::False);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<bool>("True")->GetValueType(), eAmf::True);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<int32_t>("Integer")->GetValueType(), eAmf::Integer);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<double>("Double")->GetValueType(), eAmf::Double);
std::cout << "test" << std::endl;
ASSERT_EQ(array.GetArray("Array")->GetValueType(), eAmf::Array);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<nullptr_t>("Null")->GetValueType(), eAmf::Null);
std::cout << "test" << std::endl;
ASSERT_EQ(array.Get<std::vector<uint32_t>>("Undefined")->GetValueType(), eAmf::Undefined);
std::cout << "test" << std::endl;
}

TEST(dCommonTests, AMF3InsertionDenseTest) {
Expand Down
Loading