172 lines
6.0 KiB
C++
172 lines
6.0 KiB
C++
|
|
#include "..\C-Engine\CHeader.hpp"
|
|
#include "control.hpp"
|
|
#include "IaGhost.hpp"
|
|
#include "GUI.hpp"
|
|
|
|
void SetDecor( Engine * Game);
|
|
int Jeu();
|
|
|
|
void Menu()
|
|
{
|
|
const unsigned char smenu[]={0xff, 0x80, 0x20, 0x1, 0xf0, 0x0, 0x10, 0x8, 0x4, 0x2, 0xf, 0x80, 0xc0, 0x20, 0x6, 0xc, 0x0, 0x18, 0x18, 0x4, 0x3, 0x9, 0x80, 0x40, 0x50, 0x8, 0x2, 0x0, 0x14, 0x28, 0xa, 0x2, 0x89, 0x9e, 0x40, 0x50, 0x10, 0x64, 0x0, 0x12, 0x48, 0xa, 0x2, 0x49, 0x92, 0x40, 0x88, 0x10, 0x68, 0x0, 0x11, 0x88, 0x11, 0x2, 0x29, 0x9e, 0x40, 0x88, 0x20, 0x10, 0x0, 0x10, 0x8, 0x11, 0x2, 0x19, 0x80, 0x41, 0x4, 0x20, 0x20, 0x7f, 0x10, 0x8, 0x20, 0x82, 0x1, 0x80, 0xc1, 0x24, 0x20, 0x40, 0x41, 0x10, 0x8, 0x24, 0x82, 0x1, 0x9f, 0x82, 0x52, 0x20, 0x20, 0x7f, 0x10, 0x8, 0x4a, 0x42, 0x1, 0x90, 0x2, 0x72, 0x20, 0x10, 0x0, 0x11, 0x88, 0x4e, 0x42, 0x41, 0x90, 0x4, 0x1, 0x10, 0x8, 0x0, 0x12, 0x48, 0x80, 0x22, 0x61, 0x90, 0x4, 0x1, 0x10, 0x4, 0x0, 0x12, 0x48, 0x80, 0x22, 0x51, 0x90, 0x8, 0x70, 0x88, 0x2, 0x0, 0x12, 0x49, 0xe, 0x12, 0x49, 0x90, 0x8, 0x88, 0x86, 0xc, 0x0, 0x12, 0x49, 0x11, 0x12, 0x49, 0xf0, 0xf, 0x7, 0x81, 0xf0, 0x0, 0x1e, 0x79, 0xe0, 0xf3, 0xcf, 0x0, 0x0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, 0x91, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x80, 0x48, 0x88, 0x91, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x0, 0xff, 0xcf, 0x7, 0x9e, 0x0, 0x0, 0x0, };
|
|
|
|
while(input_press(K_EXE)){}
|
|
|
|
while(!input_press(K_EXIT))
|
|
{
|
|
|
|
input_update();
|
|
|
|
ML_clear_vram();
|
|
ML_bmp_or(smenu,20,14,88,36);
|
|
ML_display_vram();
|
|
|
|
if(input_trigger(K_SHIFT) || input_trigger(K_EXE))Jeu();
|
|
}
|
|
|
|
}
|
|
|
|
int Jeu()
|
|
{
|
|
#include "Sprite.hpp" // Inclusion des sprites.
|
|
|
|
//*****************Creation des objects******************
|
|
|
|
Object * PacMan = new Object;
|
|
PacMan->GetTransforms()->SetXY( 116, 57);
|
|
PacMan->GetRender()->SetRender(A_PacMan,2);
|
|
PacMan->AddRigibody();
|
|
PacMan->AffectTag("PacMan");
|
|
|
|
Control * Script_PacMan = new Control;
|
|
PacMan->AffectScript(Script_PacMan);
|
|
|
|
|
|
Object * Ghost1 = new Object;
|
|
Ghost1->GetTransforms()->SetXY( 99, 129);
|
|
Ghost1->GetRender()->SetRender(A_Ghost,2);
|
|
Ghost1->AddRigibody();
|
|
Ghost1->AffectTag("Ghost");
|
|
|
|
Object * Ghost2 = new Object;
|
|
Ghost2->GetTransforms()->SetXY( 116, 129);
|
|
Ghost2->GetRender()->SetRender(A_Ghost,2);
|
|
Ghost2->AddRigibody();
|
|
Ghost2->AffectTag("Ghost");
|
|
|
|
Object * Ghost3 = new Object;
|
|
Ghost3->GetTransforms()->SetXY( 133, 129);
|
|
Ghost3->GetRender()->SetRender(A_Ghost,2);
|
|
Ghost3->AddRigibody();
|
|
Ghost3->AffectTag("Ghost");
|
|
|
|
Object * Ghost4 = new Object;
|
|
Ghost4->GetTransforms()->SetXY( 116, 156);
|
|
Ghost4->GetRender()->SetRender(A_Ghost,2);
|
|
Ghost4->AddRigibody();
|
|
Ghost4->AffectTag("Ghost");
|
|
|
|
Object * TP1 = new Object;
|
|
TP1->GetTransforms()->SetXY( -14, 140);
|
|
TP1->AddRigibody();
|
|
TP1->GetRigibody()->UseFixeBody(15,15);
|
|
TP1->AffectTag("TP1");
|
|
|
|
Object * TP2 = new Object;
|
|
TP2->GetTransforms()->SetXY( 245, 140);
|
|
TP2->AddRigibody();
|
|
TP2->GetRigibody()->UseFixeBody(15,15);
|
|
TP2->AffectTag("TP2");
|
|
|
|
Object * Jail = new Object;
|
|
Jail->GetTransforms()->SetXY(31 * 3, (91 - 48) * 3);
|
|
Jail->AddRigibody();
|
|
Jail->GetRigibody()->UseFixeBody(60, 36);
|
|
Jail->AffectTag("Jail");
|
|
|
|
|
|
IAG * Script_Ghost1 = new IAG;
|
|
IAG * Script_Ghost2 = new IAG;
|
|
IAG * Script_Ghost3 = new IAG;
|
|
IAG * Script_Ghost4 = new IAG;
|
|
|
|
Ghost1->AffectScript(Script_Ghost1);
|
|
Ghost2->AffectScript(Script_Ghost2);
|
|
Ghost3->AffectScript(Script_Ghost3);
|
|
Ghost4->AffectScript(Script_Ghost4);
|
|
|
|
Script_Ghost1->SetGhost(1);
|
|
Script_Ghost2->SetGhost(2);
|
|
Script_Ghost3->SetGhost(3);
|
|
Script_Ghost4->SetGhost(4);
|
|
|
|
Script_Ghost1->pacmandirection = &Script_PacMan->direction;
|
|
Script_Ghost2->pacmandirection = &Script_PacMan->direction;
|
|
Script_Ghost3->pacmandirection = &Script_PacMan->direction;
|
|
Script_Ghost4->pacmandirection = &Script_PacMan->direction;
|
|
|
|
//***********Creation de la map***************
|
|
|
|
Map Niveau1;
|
|
Niveau1.SetMap(tileset ,level , tileprop , 3 , 3 , 82 ,91);
|
|
|
|
|
|
//**************Assignation des objects************
|
|
|
|
Engine Game;
|
|
|
|
Game.AddObject( PacMan);
|
|
Game.AddObject( Ghost1);
|
|
Game.AddObject( Ghost2);
|
|
Game.AddObject( Ghost3);
|
|
Game.AddObject( Ghost4);
|
|
Game.AddObject( TP1);
|
|
Game.AddObject( TP2);
|
|
Game.AddObject( Jail);
|
|
|
|
Game.AffectMap( &Niveau1);
|
|
|
|
Niveau1.AffectEngine( &Game);
|
|
|
|
Script_GUI SGUI;
|
|
Game.AffectScript(SGUI);
|
|
|
|
Script_PacMan->Initialisation(&SGUI);
|
|
Script_Ghost1->Initialisation(&SGUI);
|
|
Script_Ghost2->Initialisation(&SGUI);
|
|
Script_Ghost3->Initialisation(&SGUI);
|
|
Script_Ghost4->Initialisation(&SGUI);
|
|
|
|
Game.SetFpsWish(45);
|
|
Game.Game();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
extern "C"
|
|
{
|
|
int AddIn_main(int isAppli, unsigned short OptionNum)
|
|
{
|
|
Menu();
|
|
return 1;
|
|
}
|
|
|
|
|
|
#pragma section _BR_Size
|
|
unsigned long BR_Size;
|
|
#pragma section
|
|
|
|
|
|
#pragma section _TOP
|
|
|
|
int InitializeSystem(int isAppli, unsigned short OptionNum)
|
|
{
|
|
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
|
|
}
|
|
|
|
#pragma section
|
|
}
|
|
|