diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 0a16e8f4..fae901a8 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -70,7 +70,6 @@ namespace DanBias Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj; protocolData->object_ID = p[1].value.netInt; - char k = p[2].value.netChar; protocolData->path = p[2].value.netCharPtr; for(int i = 0; i< 16; i++) { diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 3426bce8..1d1e45a9 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -66,6 +66,8 @@ bool GameState::LoadModels(std::wstring mapFile) ModelInitData modelData; modelData.world = Oyster::Math3D::Float4x4::identity; + Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,-2,-2)); + modelData.world = modelData.world * translate; modelData.visible = true; modelData.modelPath = L"..\\Content\\worldDummy"; modelData.id = 0; @@ -74,7 +76,7 @@ bool GameState::LoadModels(std::wstring mapFile) privData->object.push_back(obj); privData->object[privData->object.size() -1 ]->Init(modelData); - Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,2,2)); + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,2,2)); modelData.world = modelData.world * translate; modelData.modelPath = L"..\\Content\\worldDummy"; modelData.id ++; @@ -262,21 +264,21 @@ void GameState::Protocol( ObjPos* pos ) } } -void GameState::Protocol( NewObj* pos ) +void GameState::Protocol( NewObj* newObj ) { Oyster::Math::Float4x4 world; for(int i = 0; i<16; i++) { - world[i] = pos->worldPos[i]; + world[i] = newObj->worldPos[i]; } ModelInitData modelData; modelData.world = world; modelData.visible = true; - modelData.id = pos->object_ID; + modelData.id = newObj->object_ID; //not sure if this is good parsing rom char* to wstring - const char* path = pos->path; + const char* path = newObj->path; modelData.modelPath = std::wstring(path, path + strlen(path)); // load models C_Object* player = new C_Player(); diff --git a/Code/Game/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 880b645d..2a538714 100644 --- a/Code/Game/GameProtocols/ObjectProtocols.h +++ b/Code/Game/GameProtocols/ObjectProtocols.h @@ -34,8 +34,9 @@ namespace GameLogic this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Int; this->protocol[1].type = Oyster::Network::NetAttributeType_Int; + this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray; - for (int i = 2; i <= 17; i++) + for (int i = 3; i <= 18; i++) { this->protocol[i].type = Oyster::Network::NetAttributeType_Float; } diff --git a/Code/Network/NetworkAPI/CustomNetProtocol.cpp b/Code/Network/NetworkAPI/CustomNetProtocol.cpp index 91fb7267..d34832d7 100644 --- a/Code/Network/NetworkAPI/CustomNetProtocol.cpp +++ b/Code/Network/NetworkAPI/CustomNetProtocol.cpp @@ -22,10 +22,10 @@ struct CustomNetProtocol::PrivateData size_t size = strlen(i->second.value.netCharPtr); if(size == 0) continue; - attributes[i->first]; attributes[i->first].value.netCharPtr = new char[size + 1]; //strcpy_s(attributes[i->first].value.netCharPtr, size + 1, i->second.value.netCharPtr); memcpy(&attributes[i->first].value.netCharPtr[0], &i->second.value.netCharPtr[0], size + 1); + attributes[i->first].type = NetAttributeType_CharArray; } else {