You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

266 lines
8.8 KiB

#include "..\C-Engine\CHeader.hpp"
#include "EScript.hpp"
void EngineControl::Update()
{
if(((int)GetEngine()->GetListeObject()[0]->GetTransforms()->GetX() % 12 < 3 && mini == false ) || ((int)GetEngine()->GetListeObject()[0]->GetTransforms()->GetX() % 8 < 3 && mini == true))
{
UpdateScenary();
}
}
void EngineControl::UpdateScenary()
{
int stop = GetEngine()->GetNbObject();
for(int i = 1; i < stop ; i++)
{
if(GetEngine()->GetListeObject()[i]->GetTransforms()->GetX() < (GetEngine()->GetListeObject()[0]->GetTransforms()->GetX() - 36))
{
GetEngine()->DelObject(GetEngine()->GetListeObject()[i]);
i--;
stop --;
}
}
if(!mini)SetDecor(((int)GetEngine()->GetListeObject()[0]->GetTransforms()->GetX() / 12) + 10);
else SetDecor(((int)GetEngine()->GetListeObject()[0]->GetTransforms()->GetX() / 8) + 10);
}
void EngineControl::SetDecor(int i)
{
int dify , difx, w , h , type;
if(GetEngine()->GetMap() == NULL)return;
if(!mini)
{
for( int j = 0 ; j < GetEngine()->GetMap()->nbtiles_hauteur_monde; j++)
{
w = 0 ; h = 0; difx = 0; dify = 0; type = 0;
//Type = 0 rien //Type = 1 pics //Type = 2 jump //Type = 3 doublejump //Type = 4 portail ->navette //Type = 5 portail ->cube
switch(GetEngine()->GetMap()->GetIdMap(i,j))
{
case 7: w = 10 ; h = 10; type = 1; difx = 1;break;//Triangle pics
case 8: w = 10 ; h = 10; type = 1;difx = 1;break;//Triangle pics
case 5: w = 12 ; h = 4; type = 1;break; //Pics
case 6: w = 12 ; h = 4; type = 1;break; //Pics
case 9: w = 10 ; h = 6; type = 1;difx = 1;break; //Petit triangle droit
case 10: w = 10 ; h = 6; dify = 6; type = 1;difx = 1;break; //Petit triangle renverse
case 11: w = 8 ; h = 4; type = 2; break; //jump
case 12: w = 12 ; h = 12; type = 3; break;//Doublejump
case 16: w = 10 ; h = 22; dify = 1; type = 4; break;//Portail
case 18: w = 10 ; h = 22; dify = 1; type = 5; break;
case 20: w = 10 ; h = 10; type = 1; difx = 2; dify = 1; break;
case 21: w = 10 ; h = 10; type = 1; difx = 2; dify = 1; break;
default: w = 0 ; h = 0; type = 0; break;
}
if(type == 1)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 12 + difx, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 12) - (j * 12) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("Pic");
GetEngine()->AddObject(Buffer);
}
if(type == 2)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 12 + 2 , ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 12) - (j * 12) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("Jump");
GetEngine()->AddObject(Buffer);
}
if(type == 3)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 12 , ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 12) - (j * 12) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("DJ");
GetEngine()->AddObject(Buffer);
}
if(type == 4)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 12 + 1, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 12) - (j * 12) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("PN");
GetEngine()->AddObject(Buffer);
}
if(type == 5)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 12 + 1, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 12) - (j * 12) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("PC");
GetEngine()->AddObject(Buffer);
}
}
}
else
{
for( int j = 0 ; j < GetEngine()->GetMap()->nbtiles_hauteur_monde; j++)
{
w = 0 ; h = 0; difx = 0; dify = 0; type = 0;
//Type = 0 rien //Type = 1 pics //Type = 2 jump //Type = 3 doublejump //Type = 4 portail ->navette //Type = 5 portail ->cube
switch(GetEngine()->GetMap()->GetIdMap(i,j))
{
case 7: w = 6 ; h = 6; type = 1; difx = 1;break;//Triangle pics
case 8: w = 6 ; h = 6; type = 1;difx = 1;break;//Triangle pics
case 5: w = 8 ; h = 3; type = 1;break; //Pics
case 6: w = 8 ; h = 3; type = 1;break; //Pics
case 9: w = 6 ; h = 4; type = 1;difx = 1;break; //Petit triangle droit
case 10: w = 6 ; h = 4; dify = 4; type = 1;difx = 1;break; //Petit triangle renverse
case 11: w = 6 ; h = 3; type = 2; break; //jump
case 12: w = 8 ; h = 8; type = 3; break;//Doublejump
case 16: w = 8 ; h = 22; dify = 1; type = 4; break;//Portail
case 18: w = 8 ; h = 22; dify = 1; type = 5; break;
case 20: w = 6; h = 6; type = 1; difx = 2; dify = 1; break;
case 21: w = 6; h = 6; type = 1; difx = 2; dify = 1; break;
default: w = 0 ; h = 0; type = 0; break;
}
if(type == 1)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 8 + difx, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 8) - (j * 8) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("Pic");
GetEngine()->AddObject(Buffer);
}
if(type == 2)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 8 + 2 , ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 8) - (j * 8) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("Jump");
GetEngine()->AddObject(Buffer);
}
if(type == 3)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 8 , ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 8) - (j * 8) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("DJ");
GetEngine()->AddObject(Buffer);
}
if(type == 4)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 8 + 1, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 8) - (j * 8) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("PN");
GetEngine()->AddObject(Buffer);
}
if(type == 5)
{
Object * Buffer = new Object;
Buffer->GetTransforms()->SetXY( i * 8 + 1, ((GetEngine()->GetMap()->nbtiles_hauteur_monde - 1)* 8) - (j * 8) + 2 + dify);
Buffer->AddRigibody();
Buffer->GetRigibody()->UseFixeBody(w,h);
Buffer->AffectTag("PC");
GetEngine()->AddObject(Buffer);
}
}
}
}