it's compile
This commit is contained in:
parent
d97dab0ecc
commit
e5b1e63085
@ -3,7 +3,7 @@
|
|||||||
#include "../main_code.h"
|
#include "../main_code.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#define ZLEVEL 0
|
||||||
|
|
||||||
void TChipTemplateParams::Serialize(boost::property_tree::ptree& propertyTree)
|
void TChipTemplateParams::Serialize(boost::property_tree::ptree& propertyTree)
|
||||||
{
|
{
|
||||||
@ -34,6 +34,7 @@ void TChipTemplateParams::Serialize(boost::property_tree::ptree& propertyTree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TMatch3FieldParams::Serialize(boost::property_tree::ptree& propertyTree)
|
void TMatch3FieldParams::Serialize(boost::property_tree::ptree& propertyTree)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ TChip::~TChip()
|
|||||||
|
|
||||||
Eigen::Vector2f TChip::GetLeftBottomPos()
|
Eigen::Vector2f TChip::GetLeftBottomPos()
|
||||||
{
|
{
|
||||||
std::vector<Eigen::Vector3f>::iterator i = RenderPair->second.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift;
|
std::vector<Eigen::Vector3f>::iterator i = RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift;
|
||||||
|
|
||||||
return Eigen::Vector2f((*i)[0], (*i)[1]);
|
return Eigen::Vector2f((*i)[0], (*i)[1]);
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ void TChip::MoveLeftBottomPos(Eigen::Vector2f shift)
|
|||||||
{
|
{
|
||||||
for (int i=0; i<6; i++)
|
for (int i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
*(RenderPair->second.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift + i) += Eigen::Vector3f(shift, 0);
|
*(RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + VertexListShift + i) += Eigen::Vector3f(shift[0], shift[1], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,8 +231,6 @@ bool TMatch3Logic::ChipCanBeSelected(Eigen::Vector2i chip)
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
|
|
||||||
|
|
||||||
bool TMatch3Logic::ChipsCanBeSwapped(Eigen::Vector2i p1, Eigen::Vector2i p2)
|
bool TMatch3Logic::ChipsCanBeSwapped(Eigen::Vector2i p1, Eigen::Vector2i p2)
|
||||||
{
|
{
|
||||||
@ -347,26 +346,26 @@ void TMatch3Logic::ReplaceAnimation(Eigen::Vector2i p)
|
|||||||
|
|
||||||
TChip& chip = ChipMatrix[p[0]][p[1]];
|
TChip& chip = ChipMatrix[p[0]][p[1]];
|
||||||
|
|
||||||
if (ResourceManager->HalibutAnimationManager.AnimationExists(chip.AnimName))
|
if (SE::ResourceManager->HalibutAnimationManager.AnimationExists(chip.AnimName))
|
||||||
{
|
{
|
||||||
ResourceManager->HalibutAnimationManager.ReplaceAnimationObject(chip.AnimName, chip.RenderPair, chip.VertexListShift / 6);
|
SE::ResourceManager->HalibutAnimationManager.ReplaceAnimationObject(chip.AnimName, chip.RenderPair, chip.VertexListShift / 6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
THalibutExternalAnimObject testAnimObject(Match3FieldParams.ChipTemplateParamsArr[chip.ChipType].SelectedTemplateAnimObject);
|
SE::THalibutExternalAnimObject testAnimObject(Match3FieldParams.ChipTemplateParamsArr[chip.ChipType].SelectedTemplateAnimObject);
|
||||||
|
|
||||||
testAnimObject.ReplaceAnimObject(chip.RenderPair, chip.VertexListShift / 6);
|
testAnimObject.ReplaceAnimObject(chip.RenderPair, chip.VertexListShift / 6);
|
||||||
|
|
||||||
ResourceManager->HalibutAnimationManager.AddAnimationObject(chip.AnimName, testAnimObject);
|
SE::ResourceManager->HalibutAnimationManager.AddAnimationObject(chip.AnimName, testAnimObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceManager->HalibutAnimationManager.StopAnimation(chip.AnimName);
|
SE::ResourceManager->HalibutAnimationManager.StopAnimation(chip.AnimName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TMatch3Logic::MoveVertexListShiftBack(TRenderPairList::iterator renderPairItr, size_t moveFrom)
|
void TMatch3Logic::MoveVertexListShiftBack(SE::TRenderPairList::iterator renderPairItr, size_t moveFrom)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < ChipMatrix.size(); i++)
|
for (size_t i = 0; i < ChipMatrix.size(); i++)
|
||||||
{
|
{
|
||||||
@ -403,17 +402,17 @@ void TMatch3Logic::AddChipToUp(size_t colNum, int chipType, Eigen::Vector2f spaw
|
|||||||
renderPairIndex = chipType;
|
renderPairIndex = chipType;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTriangleList& triangleList = RenderPairIteratorVector[renderPairIndex]->second;
|
SE::TTriangleList& triangleList = RenderPairIteratorVector[renderPairIndex]->second;
|
||||||
|
|
||||||
std::vector<vec3> vertexCoordArr = MakeVertexCoordVec(posFrom, posTo);
|
std::vector<Eigen::Vector3f> vertexCoordArr = SE::MakeVertexCoordVec(posFrom, posTo, ZLEVEL);
|
||||||
|
|
||||||
std::vector<Eigen::Vector2f> texCoordArr = MakeTexCoordVec();
|
std::vector<Eigen::Vector2f> texCoordArr = SE::MakeTexCoordVec();
|
||||||
|
|
||||||
triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].insert(triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end());
|
triangleList.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].insert(triangleList.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end());
|
||||||
|
|
||||||
triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end());
|
triangleList.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end());
|
||||||
|
|
||||||
size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6;
|
size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].size()-6;
|
||||||
|
|
||||||
ChipMatrix[colNum].push_back(TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState));
|
ChipMatrix[colNum].push_back(TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState));
|
||||||
|
|
||||||
@ -433,17 +432,17 @@ void TMatch3Logic::InsertEmptyChip(size_t colNum, size_t rowNum, int chipType)
|
|||||||
|
|
||||||
TChip::TChipState chipState = TChip::CS_X;
|
TChip::TChipState chipState = TChip::CS_X;
|
||||||
|
|
||||||
TTriangleList& triangleList = RenderPairIteratorVector[renderPairIndex]->second;
|
SE::TTriangleList& triangleList = RenderPairIteratorVector[renderPairIndex]->second;
|
||||||
|
|
||||||
std::vector<vec3> vertexCoordArr = MakeVertexCoordVec(posFrom, posTo);
|
std::vector<Eigen::Vector3f> vertexCoordArr = SE::MakeVertexCoordVec(posFrom, posTo, ZLEVEL);
|
||||||
|
|
||||||
std::vector<Eigen::Vector2f> texCoordArr = MakeTexCoordVec();
|
std::vector<Eigen::Vector2f> texCoordArr = SE::MakeTexCoordVec();
|
||||||
|
|
||||||
triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].insert(triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end());
|
triangleList.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].insert(triangleList.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].end(), vertexCoordArr.begin(), vertexCoordArr.end());
|
||||||
|
|
||||||
triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end());
|
triangleList.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].insert(triangleList.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordArr.begin(), texCoordArr.end());
|
||||||
|
|
||||||
size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size()-6;
|
size_t vertexListShift = RenderPairIteratorVector[renderPairIndex]->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].size()-6;
|
||||||
|
|
||||||
ChipMatrix[colNum].insert(ChipMatrix[colNum].begin() + rowNum, TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState));
|
ChipMatrix[colNum].insert(ChipMatrix[colNum].begin() + rowNum, TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState));
|
||||||
|
|
||||||
@ -457,8 +456,6 @@ void TMatch3Logic::InsertEmptyChip(size_t colNum, size_t rowNum, int chipType)
|
|||||||
ChipDeletingVector.push_back(TChipDeletingData(Eigen::Vector2i(colNum, rowNum), pos));
|
ChipDeletingVector.push_back(TChipDeletingData(Eigen::Vector2i(colNum, rowNum), pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TMatch3Logic::UpdateChipSwapping(size_t dt)
|
void TMatch3Logic::UpdateChipSwapping(size_t dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -517,17 +514,20 @@ void TMatch3Logic::UpdateChipSwapping(size_t dt)
|
|||||||
TChip& chip1 = ChipMatrix[i->Chip1[0]][i->Chip1[1]];
|
TChip& chip1 = ChipMatrix[i->Chip1[0]][i->Chip1[1]];
|
||||||
TChip& chip2 = ChipMatrix[i->Chip2[0]][i->Chip2[1]];
|
TChip& chip2 = ChipMatrix[i->Chip2[0]][i->Chip2[1]];
|
||||||
|
|
||||||
vec3 newPosChip1 = vec3(i->Chip1RealPosFrom + (i->Chip2RealPosFrom - i->Chip1RealPosFrom) * i->T, 0);
|
auto x = i->Chip1RealPosFrom + (i->Chip2RealPosFrom - i->Chip1RealPosFrom) * i->T;
|
||||||
vec3 newPosChip2 = vec3(i->Chip2RealPosFrom + (i->Chip1RealPosFrom - i->Chip2RealPosFrom) * i->T, 0);
|
auto y = i->Chip2RealPosFrom + (i->Chip1RealPosFrom - i->Chip2RealPosFrom) * i->T;
|
||||||
|
|
||||||
vec3 shiftChip1 = newPosChip1 - chip1.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip1.VertexListShift];
|
Eigen::Vector3f newPosChip1 = Eigen::Vector3f(x[0], x[1], 0);
|
||||||
vec3 shiftChip2 = newPosChip2 - chip2.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip2.VertexListShift];
|
Eigen::Vector3f newPosChip2 = Eigen::Vector3f(y[0], y[1], 0);
|
||||||
|
|
||||||
|
Eigen::Vector3f shiftChip1 = newPosChip1 - chip1.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][chip1.VertexListShift];
|
||||||
|
Eigen::Vector3f shiftChip2 = newPosChip2 - chip2.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][chip2.VertexListShift];
|
||||||
|
|
||||||
for (int k = 0; k < 6; k++)
|
for (int k = 0; k < 6; k++)
|
||||||
{
|
{
|
||||||
|
|
||||||
chip1.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip1.VertexListShift + k] += shiftChip1;
|
chip1.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][chip1.VertexListShift + k] += shiftChip1;
|
||||||
chip2.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip2.VertexListShift + k] += shiftChip2;
|
chip2.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][chip2.VertexListShift + k] += shiftChip2;
|
||||||
}
|
}
|
||||||
|
|
||||||
chip1.RenderPair->second.NeedRefreshBuffer = true;
|
chip1.RenderPair->second.NeedRefreshBuffer = true;
|
||||||
@ -682,15 +682,15 @@ void TMatch3Logic::DestroyChip(Eigen::Vector2i p)
|
|||||||
{
|
{
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.NeedRefreshBuffer = true;
|
ChipMatrix[p[0]][p[1]].RenderPair->second.NeedRefreshBuffer = true;
|
||||||
|
|
||||||
ResourceManager->HalibutAnimationManager.DeleteAnimationObject(ChipMatrix[p[0]][p[1]].AnimName);
|
SE::ResourceManager->HalibutAnimationManager.DeleteAnimationObject(ChipMatrix[p[0]][p[1]].AnimName);
|
||||||
|
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].erase(
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].erase(
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift,
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift,
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6);
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6);
|
||||||
|
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].erase(
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].erase(
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift,
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift,
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6);
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].begin() + ChipMatrix[p[0]][p[1]].VertexListShift + 6);
|
||||||
|
|
||||||
MoveVertexListShiftBack(ChipMatrix[p[0]][p[1]].RenderPair, ChipMatrix[p[0]][p[1]].VertexListShift);
|
MoveVertexListShiftBack(ChipMatrix[p[0]][p[1]].RenderPair, ChipMatrix[p[0]][p[1]].VertexListShift);
|
||||||
|
|
||||||
@ -712,17 +712,17 @@ void TMatch3Logic::ChangeChipType(Eigen::Vector2i p)
|
|||||||
|
|
||||||
TChip& chip = ChipMatrix[p[0]][p[1]];
|
TChip& chip = ChipMatrix[p[0]][p[1]];
|
||||||
|
|
||||||
std::vector<vec3>::iterator vertexCoordItrBegin = chip.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].begin() + chip.VertexListShift;
|
std::vector<Eigen::Vector3f>::iterator vertexCoordItrBegin = chip.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].begin() + chip.VertexListShift;
|
||||||
std::vector<vec3>::iterator vertexCoordItrEnd = vertexCoordItrBegin + 6;
|
std::vector<Eigen::Vector3f>::iterator vertexCoordItrEnd = vertexCoordItrBegin + 6;
|
||||||
|
|
||||||
std::vector<Eigen::Vector2f>::iterator texCoordItrBegin = chip.RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].begin() + chip.VertexListShift;
|
std::vector<Eigen::Vector2f>::iterator texCoordItrBegin = chip.RenderPair->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].begin() + chip.VertexListShift;
|
||||||
std::vector<Eigen::Vector2f>::iterator texCoordItrEnd = texCoordItrBegin + 6;
|
std::vector<Eigen::Vector2f>::iterator texCoordItrEnd = texCoordItrBegin + 6;
|
||||||
|
|
||||||
std::vector<vec3> vertexCoordSubVec(vertexCoordItrBegin, vertexCoordItrEnd);
|
std::vector<Eigen::Vector3f> vertexCoordSubVec(vertexCoordItrBegin, vertexCoordItrEnd);
|
||||||
std::vector<Eigen::Vector2f> texCoordSubVec(texCoordItrBegin, texCoordItrEnd);
|
std::vector<Eigen::Vector2f> texCoordSubVec(texCoordItrBegin, texCoordItrEnd);
|
||||||
|
|
||||||
chip.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].erase(vertexCoordItrBegin, vertexCoordItrEnd);
|
chip.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].erase(vertexCoordItrBegin, vertexCoordItrEnd);
|
||||||
chip.RenderPair->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].erase(texCoordItrBegin, texCoordItrEnd);
|
chip.RenderPair->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].erase(texCoordItrBegin, texCoordItrEnd);
|
||||||
|
|
||||||
MoveVertexListShiftBack(chip.RenderPair, chip.VertexListShift);
|
MoveVertexListShiftBack(chip.RenderPair, chip.VertexListShift);
|
||||||
|
|
||||||
@ -730,16 +730,16 @@ void TMatch3Logic::ChangeChipType(Eigen::Vector2i p)
|
|||||||
|
|
||||||
chip.ChipType = newChipType;
|
chip.ChipType = newChipType;
|
||||||
|
|
||||||
RenderPairIteratorVector[newChipType]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].insert(RenderPairIteratorVector[newChipType]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].end(), vertexCoordSubVec.begin(), vertexCoordSubVec.end());
|
RenderPairIteratorVector[newChipType]->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].insert(RenderPairIteratorVector[newChipType]->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].end(), vertexCoordSubVec.begin(), vertexCoordSubVec.end());
|
||||||
RenderPairIteratorVector[newChipType]->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].insert(RenderPairIteratorVector[newChipType]->second.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordSubVec.begin(), texCoordSubVec.end());
|
RenderPairIteratorVector[newChipType]->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].insert(RenderPairIteratorVector[newChipType]->second.Data.Vec2CoordArr[SE::CONST_STRING_TEXCOORD_ATTRIB].end(), texCoordSubVec.begin(), texCoordSubVec.end());
|
||||||
|
|
||||||
RenderPairIteratorVector[newChipType]->second.NeedRefreshBuffer = true;
|
RenderPairIteratorVector[newChipType]->second.NeedRefreshBuffer = true;
|
||||||
|
|
||||||
chip.RenderPair = RenderPairIteratorVector[newChipType];
|
chip.RenderPair = RenderPairIteratorVector[newChipType];
|
||||||
chip.VertexListShift = RenderPairIteratorVector[newChipType]->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size() - 6;
|
chip.VertexListShift = RenderPairIteratorVector[newChipType]->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB].size() - 6;
|
||||||
|
|
||||||
//Hack to make sure animation is replaced by new one
|
//Hack to make sure animation is replaced by new one
|
||||||
ResourceManager->HalibutAnimationManager.DeleteAnimationObject(chip.AnimName);
|
SE::ResourceManager->HalibutAnimationManager.DeleteAnimationObject(chip.AnimName);
|
||||||
ReplaceAnimation(Eigen::Vector2i(p[0], p[1]));
|
ReplaceAnimation(Eigen::Vector2i(p[0], p[1]));
|
||||||
|
|
||||||
|
|
||||||
@ -888,13 +888,13 @@ void TMatch3Logic::ResetChipPos(Eigen::Vector2i p)
|
|||||||
Eigen::Vector2f posFrom(LeftBottomPosField[0] + p[0]*Match3FieldParams.CellWidth, LeftBottomPosField[1] + p[1]*Match3FieldParams.CellHeight);
|
Eigen::Vector2f posFrom(LeftBottomPosField[0] + p[0]*Match3FieldParams.CellWidth, LeftBottomPosField[1] + p[1]*Match3FieldParams.CellHeight);
|
||||||
Eigen::Vector2f posTo(LeftBottomPosField[0] + (p[0] + 1)*Match3FieldParams.CellWidth, LeftBottomPosField[1] + (p[1] + 1)*Match3FieldParams.CellHeight);
|
Eigen::Vector2f posTo(LeftBottomPosField[0] + (p[0] + 1)*Match3FieldParams.CellWidth, LeftBottomPosField[1] + (p[1] + 1)*Match3FieldParams.CellHeight);
|
||||||
|
|
||||||
std::vector<vec3> vertexCoordVec = MakeVertexCoordVec(posFrom, posTo);
|
std::vector<Eigen::Vector3f> vertexCoordVec = SE::MakeVertexCoordVec(posFrom, posTo, ZLEVEL);
|
||||||
|
|
||||||
TChip& chip = ChipMatrix[p[0]][p[1]];
|
TChip& chip = ChipMatrix[p[0]][p[1]];
|
||||||
|
|
||||||
for (size_t i = 0; i<vertexCoordVec.size(); i++)
|
for (size_t i = 0; i<vertexCoordVec.size(); i++)
|
||||||
{
|
{
|
||||||
chip.RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][chip.VertexListShift + i] = vertexCoordVec[i];
|
chip.RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][chip.VertexListShift + i] = vertexCoordVec[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
chip.RenderPair->second.NeedRefreshBuffer = true;
|
chip.RenderPair->second.NeedRefreshBuffer = true;
|
||||||
@ -936,11 +936,11 @@ void TMatch3Logic::UpdateLogic(size_t dt)
|
|||||||
|
|
||||||
Eigen::Vector2f centerPos = leftBottomPos + halfPos;
|
Eigen::Vector2f centerPos = leftBottomPos + halfPos;
|
||||||
|
|
||||||
std::vector<vec3> vertexCoordArr = MakeVertexCoordVec(centerPos - (1.f - i->T)*halfPos, centerPos + (1.f - i->T)*halfPos);
|
std::vector<Eigen::Vector3f> vertexCoordArr = SE::MakeVertexCoordVec(centerPos - (1.f - i->T)*halfPos, centerPos + (1.f - i->T)*halfPos, ZLEVEL);
|
||||||
|
|
||||||
for (int t = 0; t < 6; t++)
|
for (int t = 0; t < 6; t++)
|
||||||
{
|
{
|
||||||
ChipMatrix[p[0]][p[1]].RenderPair->second.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][ChipMatrix[p[0]][p[1]].VertexListShift + t] = vertexCoordArr[t];
|
ChipMatrix[p[0]][p[1]].RenderPair->second.Data.Vec3CoordArr[SE::CONST_STRING_POSITION_ATTRIB][ChipMatrix[p[0]][p[1]].VertexListShift + t] = vertexCoordArr[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -964,6 +964,7 @@ void TMatch3Logic::UpdateLogic(size_t dt)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TMatch3Logic::HitFieldWithPattern(Eigen::Vector2i pos, std::vector<std::vector<char> > pattern, std::vector<std::vector<char> > jumpingPattern)
|
void TMatch3Logic::HitFieldWithPattern(Eigen::Vector2i pos, std::vector<std::vector<char> > pattern, std::vector<std::vector<char> > jumpingPattern)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1079,57 +1080,58 @@ TMatch3Field::~TMatch3Field()
|
|||||||
|
|
||||||
void TMatch3Field::FillBasicChipMatrixAndTriangleList()
|
void TMatch3Field::FillBasicChipMatrixAndTriangleList()
|
||||||
{
|
{
|
||||||
TRenderParams renderParams;
|
SE::TRenderParams renderParams;
|
||||||
|
|
||||||
renderParams.Transparency = 1.f;
|
//renderParams.Transparency = 1.f;
|
||||||
|
renderParams.transparencyFlag = SE::TRenderParams::opaque;
|
||||||
|
|
||||||
|
auto px = SE::FileToPropertyTree("match3params.xml");
|
||||||
boost::shared_ptr<boost::property_tree::ptree> px(FileToPropertyTree("match3params.xml"));
|
|
||||||
Match3FieldParams.Serialize(*px);
|
Match3FieldParams.Serialize(*px);
|
||||||
|
|
||||||
std::vector<TRenderPairList::iterator> triangleListVec;
|
std::vector<SE::TRenderPairList::iterator> triangleListVec;
|
||||||
|
|
||||||
for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++)
|
for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++)
|
||||||
{
|
{
|
||||||
TriangleListVector.push_back(TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].SelectedRenderParams, TTriangleList()));
|
TriangleListVector.push_back(SE::TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].SelectedRenderParams, SE::TTriangleList()));
|
||||||
}
|
}
|
||||||
|
auto x = RenderPairIteratorVector.front()->first;
|
||||||
|
auto y = RenderPairIteratorVector.front()->second;
|
||||||
|
|
||||||
|
renderParams.SamplerMap[SE::CONST_STRING_TEXTURE_UNIFORM] = "chip1locked";
|
||||||
|
TriangleListVector.push_back(SE::TRenderPair(renderParams, SE::TTriangleList()));
|
||||||
|
|
||||||
renderParams.TexName = "chip1locked";
|
renderParams.SamplerMap[SE::CONST_STRING_TEXTURE_UNIFORM] = "chip2locked";
|
||||||
TriangleListVector.push_back(TRenderPair(renderParams, TTriangleList()));
|
TriangleListVector.push_back(SE::TRenderPair(renderParams, SE::TTriangleList()));
|
||||||
|
|
||||||
renderParams.TexName = "chip2locked";
|
renderParams.SamplerMap[SE::CONST_STRING_TEXTURE_UNIFORM] = "chip3locked";
|
||||||
TriangleListVector.push_back(TRenderPair(renderParams, TTriangleList()));
|
TriangleListVector.push_back(SE::TRenderPair(renderParams, SE::TTriangleList()));
|
||||||
|
|
||||||
renderParams.TexName = "chip3locked";
|
renderParams.SamplerMap[SE::CONST_STRING_TEXTURE_UNIFORM] = "chip4locked";
|
||||||
TriangleListVector.push_back(TRenderPair(renderParams, TTriangleList()));
|
TriangleListVector.push_back(SE::TRenderPair(renderParams, SE::TTriangleList()));
|
||||||
|
|
||||||
renderParams.TexName = "chip4locked";
|
|
||||||
TriangleListVector.push_back(TRenderPair(renderParams, TTriangleList()));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++)
|
for (size_t i = 0; i < Match3FieldParams.ChipTypeCount; i++)
|
||||||
{
|
{
|
||||||
TriangleListVector.push_back(TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].FinishingRenderParams, TTriangleList()));
|
TriangleListVector.push_back(SE::TRenderPair(Match3FieldParams.ChipTemplateParamsArr[i].FinishingRenderParams, SE::TTriangleList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TRenderPairList::iterator i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
for (SE::TRenderPairList::iterator i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
triangleListVec.push_back(i);
|
triangleListVec.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
LeftBottomPos = Eigen::Vector2f(150, 0);
|
LeftBottomPosField = Eigen::Vector2f(150, 0);
|
||||||
|
|
||||||
FillRandomChipMatrix(triangleListVec, LeftBottomPos);
|
FillRandomChipMatrix(triangleListVec, LeftBottomPosField);
|
||||||
|
|
||||||
//Init everything
|
//Init everything
|
||||||
selectedChip = Eigen::Vector2i(-1, -1);
|
selectedChip = Eigen::Vector2i(-1, -1);
|
||||||
|
|
||||||
for (TRenderPairList::iterator i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
for (SE::TRenderPairList::iterator i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
i->second.RefreshBuffer();
|
i->second.RefreshBuffer();
|
||||||
@ -1142,7 +1144,7 @@ Eigen::Vector2i TMatch3Field::PosToChip(Eigen::Vector2f pos)
|
|||||||
{
|
{
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
Eigen::Vector2f fieldPos = pos - LeftBottomPos;
|
Eigen::Vector2f fieldPos = pos - LeftBottomPosField;
|
||||||
x = static_cast<int>(fieldPos[0] / Match3FieldParams.CellWidth);
|
x = static_cast<int>(fieldPos[0] / Match3FieldParams.CellWidth);
|
||||||
y = static_cast<int>(fieldPos[1] / Match3FieldParams.CellHeight);
|
y = static_cast<int>(fieldPos[1] / Match3FieldParams.CellHeight);
|
||||||
|
|
||||||
@ -1156,7 +1158,7 @@ void TMatch3Field::Update(size_t dt)
|
|||||||
TMatch3Logic::UpdateLogic(dt);
|
TMatch3Logic::UpdateLogic(dt);
|
||||||
|
|
||||||
|
|
||||||
TRenderPairList::iterator i;
|
SE::TRenderPairList::iterator i;
|
||||||
for (i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
for (i = TriangleListVector.begin(); i != TriangleListVector.end(); ++i)
|
||||||
{
|
{
|
||||||
if (i->second.NeedRefreshBuffer)
|
if (i->second.NeedRefreshBuffer)
|
||||||
@ -1309,7 +1311,7 @@ void TMatch3Field::OnMove(Eigen::Vector2f shift)
|
|||||||
bool TMatch3Field::CheckClick(Eigen::Vector2f mousePos)
|
bool TMatch3Field::CheckClick(Eigen::Vector2f mousePos)
|
||||||
{
|
{
|
||||||
|
|
||||||
Eigen::Vector2f fieldPos = mousePos - LeftBottomPos;
|
Eigen::Vector2f fieldPos = mousePos - LeftBottomPosField;
|
||||||
if (fieldPos[0] >= 0 && fieldPos[0] <= Match3FieldParams.FieldWidth*Match3FieldParams.CellWidth)
|
if (fieldPos[0] >= 0 && fieldPos[0] <= Match3FieldParams.FieldWidth*Match3FieldParams.CellWidth)
|
||||||
{
|
{
|
||||||
if (fieldPos[1] >= 0 && fieldPos[1] <= Match3FieldParams.FieldHeight*Match3FieldParams.CellHeight)
|
if (fieldPos[1] >= 0 && fieldPos[1] <= Match3FieldParams.FieldHeight*Match3FieldParams.CellHeight)
|
||||||
@ -1332,9 +1334,7 @@ void TMatch3Field::HighlightMatch3()
|
|||||||
|
|
||||||
for (i = chips.begin(); i != chips.end(); ++i)
|
for (i = chips.begin(); i != chips.end(); ++i)
|
||||||
{
|
{
|
||||||
ResourceManager->HalibutAnimationManager.StartAnimation(ChipMatrix[i->v[0]][i->v[1]].AnimName);
|
SE::ResourceManager->HalibutAnimationManager.StartAnimation(ChipMatrix[(*i)[0]][(*i)[1]].AnimName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
@ -249,6 +249,8 @@ protected:
|
|||||||
|
|
||||||
Eigen::Vector2i PosToChip(Eigen::Vector2f pos);
|
Eigen::Vector2i PosToChip(Eigen::Vector2f pos);
|
||||||
|
|
||||||
|
SE::TRenderPairList TriangleListVector;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TMatch3Field();
|
TMatch3Field();
|
||||||
TMatch3Field(const TMatch3Field& m);
|
TMatch3Field(const TMatch3Field& m);
|
||||||
@ -270,5 +272,4 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user