Fixe de quelques bugs
This commit is contained in:
parent
22f45b7a59
commit
d893799c17
|
@ -34,7 +34,7 @@
|
|||
//#define CE_RPG
|
||||
#define CE_PLATEFORME
|
||||
//#define CE_NETWORK
|
||||
#define CE_DELTA1
|
||||
//#define CE_DELTA1
|
||||
|
||||
#ifdef CE_ALL
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class Engine
|
|||
void DrawLevel();
|
||||
|
||||
void SetCurrentLevel( int id);
|
||||
int GetIdCurrentLevel();
|
||||
Level * GetCurrentLevel();
|
||||
Level * GetLevel(int id);
|
||||
|
||||
|
|
|
@ -23,10 +23,11 @@ class Level
|
|||
|
||||
void SetMap( const unsigned char * userTileset , unsigned char * userMap , bool * userProperties, int userTileWidth , int userTileHeight , int userWorldWidth , int userWorldHeight);
|
||||
|
||||
int GetIdMap( int x, int y );
|
||||
int GetIdMap( int x, int y , bool relative = false);
|
||||
void ReplaceIdMap( int x , int y, char v );
|
||||
|
||||
void DrawMap();
|
||||
void DrawLevel();
|
||||
|
||||
Object ** GetListeObject();
|
||||
int GetNbObject();
|
||||
|
|
|
@ -69,15 +69,17 @@ class Trigger: public Object
|
|||
~Trigger();
|
||||
|
||||
void CreateTrigger(int x , int y , int width , int height );
|
||||
void SetDestination(int x , int y , int level);
|
||||
void SetDestination(int x , int y , int level , char * onlypass = NULL);
|
||||
|
||||
Vec2 GetDestination();
|
||||
int GetDestinationLevel();
|
||||
char * GetPass();
|
||||
|
||||
private:
|
||||
|
||||
Vec2 destination;
|
||||
int leveldestination;
|
||||
char * pass;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,6 +29,8 @@ Engine::Engine()
|
|||
nbLevel = 0;
|
||||
currentLevel = 0;
|
||||
time = 0;
|
||||
|
||||
engineScript = NULL;
|
||||
}
|
||||
|
||||
void Engine::StartGame()
|
||||
|
@ -367,6 +369,11 @@ void Engine::DrawLevel()
|
|||
if(tabLevel && currentLevel != -1 )tabLevel[currentLevel]->DrawMap();
|
||||
}
|
||||
|
||||
int Engine::GetIdCurrentLevel()
|
||||
{
|
||||
return currentLevel;
|
||||
}
|
||||
|
||||
Level * Engine::GetCurrentLevel()
|
||||
{
|
||||
if(currentLevel != -1)
|
||||
|
|
|
@ -56,13 +56,20 @@ void Level::SetMap( const unsigned char * userTileset , unsigned char * userMap
|
|||
|
||||
}
|
||||
|
||||
int Level::GetIdMap( int x , int y )
|
||||
int Level::GetIdMap( int x , int y , bool relative)
|
||||
{
|
||||
int id = *(map + levelWidth * y + x);
|
||||
int id;
|
||||
int dx = x / tileWidth;
|
||||
int dy = levelHeight - y / tileHeight - 1;
|
||||
|
||||
if(relative)
|
||||
id = *(map + levelWidth * dy + dx);
|
||||
else
|
||||
id = *(map + levelWidth * y + x);
|
||||
|
||||
#ifdef CE_DELTA1
|
||||
|
||||
id --;
|
||||
id --;
|
||||
|
||||
#endif // CE_DELTA1
|
||||
|
||||
|
@ -97,6 +104,18 @@ void Level::DrawMap()
|
|||
}
|
||||
}
|
||||
|
||||
void Level::DrawLevel()
|
||||
{
|
||||
DrawMap();
|
||||
|
||||
for( int i = 0 ; i < GetNbObject() ; i++ )
|
||||
{
|
||||
if( GetListeObject()[i]->GetEnable())
|
||||
if(GetListeObject()[i]->GetRender())
|
||||
GetListeObject()[i]->GetRender()->DrawObject();
|
||||
}
|
||||
}
|
||||
|
||||
Object ** Level::GetListeObject()
|
||||
{
|
||||
return listeObject;
|
||||
|
|
|
@ -40,11 +40,12 @@ void Trigger::CreateTrigger(int x , int y , int width , int height )
|
|||
ORigidBody->UseFixeBody(width,height);
|
||||
}
|
||||
|
||||
void Trigger::SetDestination(int x , int y , int level)
|
||||
void Trigger::SetDestination(int x , int y , int level , char * onlypass)
|
||||
{
|
||||
destination.x = x;
|
||||
destination.y = y;
|
||||
leveldestination = level;
|
||||
pass = onlypass;
|
||||
}
|
||||
|
||||
Vec2 Trigger::GetDestination()
|
||||
|
@ -57,6 +58,11 @@ int Trigger::GetDestinationLevel()
|
|||
return leveldestination;
|
||||
}
|
||||
|
||||
char * Trigger::GetPass()
|
||||
{
|
||||
return pass;
|
||||
}
|
||||
|
||||
void Trigger_Script::AffectTrigger(Trigger * TV)
|
||||
{
|
||||
TConteneur = TV;
|
||||
|
@ -77,8 +83,14 @@ void Trigger_Script::Update()
|
|||
{
|
||||
if(GetObject()->Collision(i, GetEngine()->GetCurrentLevel()))
|
||||
{
|
||||
if(GetEngine()->GetCurrentLevel()->GetListeObject()[i]->GetScript())
|
||||
GetEngine()->GetCurrentLevel()->GetListeObject()[i]->GetScript()->Teleport(TConteneur->GetDestination().x , TConteneur->GetDestination().y , TConteneur->GetDestinationLevel());
|
||||
if(GetTrigger()->GetPass())
|
||||
{
|
||||
if(!strcmp(GetEngine()->GetCurrentLevel()->GetListeObject()[i]->GetTag() , GetTrigger()->GetPass()))
|
||||
{
|
||||
if(GetEngine()->GetCurrentLevel()->GetListeObject()[i]->GetScript())
|
||||
GetEngine()->GetCurrentLevel()->GetListeObject()[i]->GetScript()->Teleport(TConteneur->GetDestination().x , TConteneur->GetDestination().y , TConteneur->GetDestinationLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue