Gameserver - Merged with Gamelogic
This commit is contained in:
commit
87b8c0c7bb
|
@ -70,7 +70,6 @@ namespace DanBias
|
||||||
|
|
||||||
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
|
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
|
||||||
protocolData->object_ID = p[1].value.netInt;
|
protocolData->object_ID = p[1].value.netInt;
|
||||||
char k = p[2].value.netChar;
|
|
||||||
protocolData->path = p[2].value.netCharPtr;
|
protocolData->path = p[2].value.netCharPtr;
|
||||||
for(int i = 0; i< 16; i++)
|
for(int i = 0; i< 16; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,6 +66,8 @@ bool GameState::LoadModels(std::wstring mapFile)
|
||||||
ModelInitData modelData;
|
ModelInitData modelData;
|
||||||
|
|
||||||
modelData.world = Oyster::Math3D::Float4x4::identity;
|
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.visible = true;
|
||||||
modelData.modelPath = L"..\\Content\\worldDummy";
|
modelData.modelPath = L"..\\Content\\worldDummy";
|
||||||
modelData.id = 0;
|
modelData.id = 0;
|
||||||
|
@ -74,7 +76,7 @@ bool GameState::LoadModels(std::wstring mapFile)
|
||||||
privData->object.push_back(obj);
|
privData->object.push_back(obj);
|
||||||
privData->object[privData->object.size() -1 ]->Init(modelData);
|
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.world = modelData.world * translate;
|
||||||
modelData.modelPath = L"..\\Content\\worldDummy";
|
modelData.modelPath = L"..\\Content\\worldDummy";
|
||||||
modelData.id ++;
|
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;
|
Oyster::Math::Float4x4 world;
|
||||||
for(int i = 0; i<16; i++)
|
for(int i = 0; i<16; i++)
|
||||||
{
|
{
|
||||||
world[i] = pos->worldPos[i];
|
world[i] = newObj->worldPos[i];
|
||||||
}
|
}
|
||||||
ModelInitData modelData;
|
ModelInitData modelData;
|
||||||
|
|
||||||
modelData.world = world;
|
modelData.world = world;
|
||||||
modelData.visible = true;
|
modelData.visible = true;
|
||||||
modelData.id = pos->object_ID;
|
modelData.id = newObj->object_ID;
|
||||||
//not sure if this is good parsing rom char* to wstring
|
//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));
|
modelData.modelPath = std::wstring(path, path + strlen(path));
|
||||||
// load models
|
// load models
|
||||||
C_Object* player = new C_Player();
|
C_Object* player = new C_Player();
|
||||||
|
|
|
@ -34,8 +34,9 @@ namespace GameLogic
|
||||||
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Int;
|
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
this->protocol[1].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;
|
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@ struct CustomNetProtocol::PrivateData
|
||||||
size_t size = strlen(i->second.value.netCharPtr);
|
size_t size = strlen(i->second.value.netCharPtr);
|
||||||
if(size == 0) continue;
|
if(size == 0) continue;
|
||||||
|
|
||||||
attributes[i->first];
|
|
||||||
attributes[i->first].value.netCharPtr = new char[size + 1];
|
attributes[i->first].value.netCharPtr = new char[size + 1];
|
||||||
//strcpy_s(attributes[i->first].value.netCharPtr, size + 1, i->second.value.netCharPtr);
|
//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);
|
memcpy(&attributes[i->first].value.netCharPtr[0], &i->second.value.netCharPtr[0], size + 1);
|
||||||
|
attributes[i->first].type = NetAttributeType_CharArray;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue