I hate the linker

This commit is contained in:
andreja6
2020-03-06 22:40:00 -08:00
parent e419a4edcd
commit 6fb111067d
13 changed files with 297 additions and 31 deletions

View File

@@ -11,7 +11,7 @@ PartInstance::PartInstance(void) : _bevelSize(0.07f), _parseVert(0), _debugTimer
name = "Unnamed PVItem";
className = "Part";
canCollide = true;
anchored = true;
anchored = false;
size = Vector3(2,1,4);
setCFrame(CoordinateFrame(Vector3(0,0,0)));
color = Color3::gray();
@@ -26,6 +26,25 @@ PartInstance::PartInstance(void) : _bevelSize(0.07f), _parseVert(0), _debugTimer
shape = Enum::Shape::Block;
}
Vector3 PartInstance::getVelocity()
{
return velocity;
}
Vector3 PartInstance::getRotVelocity()
{
return rotVelocity;
}
void PartInstance::setVelocity(Vector3 v)
{
velocity = v;
}
void PartInstance::setRotVelocity(Vector3 v)
{
rotVelocity = v;
}
void PartInstance::postRender(RenderDevice *rd)
{
if(!nameShown)
@@ -57,6 +76,30 @@ void PartInstance::postRender(RenderDevice *rd)
}
}
void PartInstance::setParent(Instance* parent)
{
Instance * cparent = this->parent;
while(cparent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(parent))
{
workspace->physicalObjects.erase(std::remove(workspace->physicalObjects.begin(), workspace->physicalObjects.end(), this), workspace->physicalObjects.end());
break;
}
cparent = cparent->getParent();
}
Instance::setParent(parent);
while(parent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(parent))
{
workspace->physicalObjects.push_back(this);
break;
}
parent = parent->getParent();
}
}
PartInstance::PartInstance(const PartInstance &oinst) : _bevelSize(0.07f), _parseVert(0), _debugTimer(0)
{
PVInstance::PVInstance(oinst);
@@ -1048,6 +1091,11 @@ void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
color = Color3(GetRValue(item->lpCurValue)/255.0F,GetGValue(item->lpCurValue)/255.0F,GetBValue(item->lpCurValue)/255.0F);
changed=true;
}
if(strcmp(item->lpszPropName, "Anchored") == 0)
{
anchored=(bool)item->lpCurValue;
changed=true;
}
else if(strcmp(item->lpszPropName, "Offset") == 0)
{
std::string str = (LPTSTR)item->lpCurValue;
@@ -1127,8 +1175,13 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
RGB((color.r*255),(color.g*255),(color.b*255)),
PIT_COLOR
));
sprintf_s(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z);
properties.push_back(createPGI(
"Item",
"Anchored",
"Whether the block can move or not",
(LPARAM)anchored,
PIT_CHECK
));
properties.push_back(createPGI(
"Item",
"Offset",