// main global script file
AudioChannel* Sifflet;
// called when the game starts, before the first room is loaded
function game_start()
{
Mouse.SetPosition(456, 772);
Game.MinimumTextDisplayTimeMs = 2800;
game.lipsync_speed = 10;
gInventaire.Visible = false;
aFroggy.Play();
}
function btnInvdroite_OnClick(GUIControl *control, MouseButton button)
{
Invcadre.ScrollDown();
}
function btnInvgauche_OnClick(GUIControl *control, MouseButton button)
{
Invcadre.ScrollUp();
}
function iSifflet_Look()
{
player.Say("Ça, c'est mon sifflet à moi.");
}
function BtnBille_OnClick(GUIControl *control, MouseButton button)
{
{
if (gInventaire.Visible == false) {
aInv.Play();
gInventaire.Visible = true;
}
else
{
aClac.Play();
gInventaire.Visible = false;
}
}}
function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info)
{
// Crée une zone de dimensions 200x200 à la position (50,100) pour les options
info.X = 320;
info.Y = 890;
info.Width = 1280;
info.Height = 400;
// Place l'analyseur de texte (parser) tout en bas (s'il est activé)
info.ParserTextBoxX = 0;
info.ParserTextBoxY = 800;
info.ParserTextBoxWidth = 0;
}
function dialog_options_render(DialogOptionsRenderingInfo *info)
{
// Remplit la zone en jaune
info.Surface.Clear(0);
int i = 1, ypos = 8;
// Affiche toutes les options disponibles
while (i <= info.DialogToRender.OptionCount)
{
if (info.DialogToRender.GetOptionState(i) == eOptionOn)
{
if (info.ActiveOptionID == i) info.Surface.DrawingColor = 65522;
else info.Surface.DrawingColor = 15615;
info.Surface.DrawStringWrapped(30, ypos, info.Width - 120,
eFontFont0, eAlignLeft, info.DialogToRender.GetOptionText(i));
ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontFont0, info.Width - 50);
}
i++;
}
}
function dialog_options_get_active(DialogOptionsRenderingInfo *info)
{
int i = 1, ypos = 0;
// Trouve l'option située où le joueur a cliqué
while (i <= info.DialogToRender.OptionCount)
{
if (info.DialogToRender.GetOptionState(i) == eOptionOn)
{
ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontFont0, info.Width - 300);
if ((mouse.y - info.Y) < ypos)
{
info.ActiveOptionID = i;
return;
}
}
i++;
}
}
function gestion_curseur()
{
//__________CURSEUR DYNAMIQUE_____________________________________________
Hotspot* hsurvol = Hotspot.GetAtScreenXY (mouse.x, mouse.y);
Object* osurvol = Object.GetAtScreenXY (mouse.x, mouse.y);
Character* csurvol = Character.GetAtScreenXY (mouse.x, mouse.y);
GUI* gsurvol = GUI.GetAtScreenXY (mouse.x, mouse.y);
InventoryItem* isurvol = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
// comportement survol RIEN
if ((hsurvol == hotspot[0])||(osurvol == null)||(csurvol == null))
{
if (mouse.IsModeEnabled(eModeAller))
{
mouse.ChangeModeGraphic(eModeAller,1);
}
if (mouse.IsModeEnabled(eModeRegarder))
{
mouse.ChangeModeGraphic(eModeRegarder,3);
}
if (mouse.IsModeEnabled(eModeMain))
{
mouse.ChangeModeGraphic(eModeMain,5);
}
if (mouse.IsModeEnabled (eModeParler))
{
mouse.ChangeModeGraphic(eModeParler,7);
}
}
// comportement survol SORTIES DE ROOM
if ((hsurvol != hotspot[0])&&(mouse.IsModeEnabled(eModeAller)))
{
if(hsurvol.GetProperty("Sortie")== true)
{
mouse.ChangeModeGraphic(eModeAller,2);
}
if((hsurvol.GetProperty("Sortie")== false)||(hsurvol.GetProperty("Choopa")== true))
{
mouse.ChangeModeGraphic(eModeAller,1);
}
}
// comportement survol POINTS CHAUDS
if ((hsurvol != hotspot[0])&&(hsurvol.GetProperty("Choopa")== true))
{
if (mouse.IsModeEnabled(eModeRegarder))
{
mouse.ChangeModeGraphic(eModeRegarder,4);
}
if (mouse.IsModeEnabled(eModeMain))
{
mouse.ChangeModeGraphic(eModeMain,6);
}
}
// comportement survol OBJETS
if (osurvol != null)
{
if (mouse.IsModeEnabled(eModeRegarder))
{
mouse.ChangeModeGraphic(eModeRegarder,4);
}
if (mouse.IsModeEnabled(eModeMain))
{
mouse.ChangeModeGraphic(eModeMain,6);
}
}
// comportement survol PERSONNAGES
if (csurvol != null)
{
if (mouse.IsModeEnabled(eModeRegarder))
{
mouse.ChangeModeGraphic(eModeRegarder,4);
}
if ((mouse.IsModeEnabled(eModeMain))&&(csurvol.GetProperty("Persomain")== false))
{
mouse.ChangeModeGraphic(eModeMain,5);
}
else if ((mouse.IsModeEnabled(eModeMain))&&(csurvol.GetProperty("Persomain")== true))
{
mouse.ChangeModeGraphic(eModeMain,6);
}
if (mouse.IsModeEnabled(eModeParler))
{
mouse.ChangeModeGraphic(eModeParler,
;
}
}
// gestion INVENTAIRE
if ((isurvol != null)||(gsurvol != null))
{
mouse.DisableMode(eModeAller);
mouse.DisableMode(eModeParler);
}
else
mouse.EnableMode(eModeParler);
mouse.EnableMode(eModeAller);
if ((mouse.IsModeEnabled(eModeRegarder)&&(isurvol != null)))
{
mouse.ChangeModeGraphic(eModeRegarder,4);
}
if ((mouse.IsModeEnabled(eModeMain)&&(isurvol != null)))
{
mouse.ChangeModeGraphic(eModeMain,6);
}
}
function unhandled_event(int what, int type) {
{
}}
// called on every game cycle, except when the game is blocked
function repeatedly_execute()
{
if (IsGamePaused() == 1) return;
gestion_curseur();
}
// called on every game cycle, even when the game is blocked
function repeatedly_execute_always()
{
}
// called when a key is pressed
function on_key_press(eKeyCode keycode)
{
if (IsGamePaused())
{
// game paused, so don't react to any keypresses
keycode = 0;
}
else if (keycode == eKeyEscape)
{
// Ctrl-Q will quit the game
QuitGame(1);
}
else if (keycode == eKeyF9)
{
// F9 will restart the game
RestartGame();
}
else if (keycode == eKeyF12)
{
// F12 will save a screenshot to the save game folder
SaveScreenShot("screenshot.pcx");
}
else if (keycode == eKeyCtrlS)
{
// Ctrl-S will give the player all defined inventory items
Debug(0, 0);
}
else if (keycode == eKeyCtrlV)
{
// Ctrl-V will show game engine version and build date
Debug(1, 0);
}
else if (keycode == eKeyCtrlA)
{
// Ctrl-A will show walkable areas
Debug(2, 0);
}
else if (keycode == eKeyCtrlX)
{
// Ctrl-X will let the player teleport to any room
Debug(3, 0);
}
else if (keycode == eKeyF1)
{
int alea=Random(5);
if (alea==0) Sifflet = aSifflet01.Play();
if (alea==1) Sifflet = aSifflet02.Play();
if (alea==2) Sifflet = aSifflet03.Play();
if (alea==3) Sifflet = aSifflet04.Play();
if (alea==4) Sifflet = aSifflet05.Play();
if (alea==5) Sifflet = aSifflet06.Play();
int DureeClipCycles = Sifflet.LengthMs/(1000/GetGameSpeed()) + 1;
Wait(DureeClipCycles);
}
}
// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
GUI* gsurvol = GUI.GetAtScreenXY (mouse.x, mouse.y);
InventoryItem* isurvol = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
if (IsGamePaused())
{
// game is paused, so do nothing (i.e. don't process mouse clicks)
}
else if (button == eMouseLeft)
{
// left-click, so try using the current mouse cursor mode at this position
Room.ProcessClick(mouse.x, mouse.y, mouse.Mode);
}
else if (button == eMouseRight)
{
// right-click, so cycle the mouse cursor mode
player.ActiveInventory = null;
mouse.SelectNextMode();
}
else if (button == eMouseWheelNorth)
{
// mouse wheel up will cycle the cursor mode backwards
mouse.SelectPreviousMode();
}
else if (button == eMouseWheelSouth)
{
// mouse wheel up will cycle the cursor mode backwards
mouse.SelectNextMode();
}
else if ((mouse.Mode==eModeRegarder)&&(button == eMouseRightInv))
{
mouse.Mode = eModeMain;
}
else if ((mouse.Mode==eModeMain)&&(button == eMouseRightInv))
{
mouse.Mode = eModeRegarder;
}
else if ((mouse.IsModeEnabled(eModeRegarder)&&(button == eMouseLeftInv)))
{
inventory[game.inv_activated].RunInteraction(eModeRegarder);
}
else if ((mouse.IsModeEnabled(eModeMain)&&(button == eMouseLeftInv)))
{
inventory[game.inv_activated].RunInteraction(eModeUseinv);
}
}
function iPierrePrecieuse_Look()
{
player.Say("En terme de pierre ça a l'air quand même vachement précieux...");
}
function dialog_request(int param) {
}
function cPierre_UseInv()
{
if(player.ActiveInventory == iPierrePrecieuse)
{
player.Say("Oups...");
}}
function cGarg_UseInv()
{
if(player.ActiveInventory == iSifflet)
{
int alea=Random(5);
if (alea==0) Sifflet = aSifflet01.Play();
if (alea==1) Sifflet = aSifflet02.Play();
if (alea==2) Sifflet = aSifflet03.Play();
if (alea==3) Sifflet = aSifflet04.Play();
if (alea==4) Sifflet = aSifflet05.Play();
if (alea==5) Sifflet = aSifflet06.Play();
int DureeClipCycles = Sifflet.LengthMs/(1000/GetGameSpeed()) + 1;
Wait(DureeClipCycles);
}
{
if(player.ActiveInventory == iPierrePrecieuse)
{
player.Say ("rien");
}
}
}
function cPierre_Talk()
{
player.FaceCharacter(cPierre);
dDialog1.Start();
}
function cGarg_Interact()
{
player.Say("La bienséance me l'inderdit.");
}
function cGarg_Talk()
{
player.Say("Je ne suis pas assez schizo pour parler tout seul.");
player.Say("Désolé.");
}