Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sealedoff #1

Closed
wants to merge 9 commits into from
File renamed without changes.
File renamed without changes.
132 changes: 66 additions & 66 deletions Game.agf

Large diffs are not rendered by default.

97 changes: 14 additions & 83 deletions GlobalScript.asc
Expand Up @@ -19,13 +19,20 @@ function repeatedly_execute_always()
{
}

void ShowOptions()
{
Verbs.UpdateActionBar();
OptionGui.ShowOptions();
}



// called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode)
{
if (keycode == eKeyF5) {
//gOptions.Visible=true; // F5 - OPTIONS
Verbs.UpdateActionBar();
OptionGui.ShowOptions();
ShowOptions();
}

if (keycode == eKeyCtrlC || keycode == eKeyCtrlQ) gQuit.Visible=true; // Ctrl-C or CTRL-Q QUIT
Expand Down Expand Up @@ -68,99 +75,23 @@ function ScrollInv_Click(GUIControl *control, MouseButton button) {

function btnShowOptions_OnClick(GUIControl *control, MouseButton button)
{
Verbs.UpdateActionBar();
OptionGui.ShowOptions();
}

function btnOptionsDefault_OnClick(GUIControl *control, MouseButton button)
{
sldOptionsMusic.Value = 80;
sldOptionsSound.Value = 90;
sldOptionsStyle.Value = 1;
Game.SetAudioTypeVolume(eAudioTypeMusic, sldOptionsMusic.Value, eVolExistingAndFuture);
Game.SetAudioTypeVolume(eAudioTypeSound, sldOptionsSound.Value, eVolExistingAndFuture);
Game.SetAudioTypeVolume(eAudioTypeAmbientSound, sldOptionsSound.Value, eVolExistingAndFuture);
}


function btnOptions_Click(GUIControl *control, MouseButton button)
{
// Save
if (control==btnOptionsSave) {
gOptions.Visible=false;
OptionGui.ShowSaveDialog();
}
// Load
else if (control==btnOptionsLoad) {
gOptions.Visible=false;
OptionGui.ShowLoadDialog();
}
// Resume
else if (control==btnOptionsResume || control == btnOptionsClose) {
gOptions.Visible=false;
}
// Quit
else if (control==btnOptionsQuit) {
gOptions.Visible=false;
gQuit.Visible=true;
}
}

function sldOptionsMusic_OnChange(GUIControl *control)
{
Game.SetAudioTypeVolume(eAudioTypeMusic, sldOptionsMusic.Value, eVolExistingAndFuture);
ShowOptions();
}

function sldOptionsSound_OnChange(GUIControl *control)
{
Game.SetAudioTypeVolume(eAudioTypeSound, sldOptionsSound.Value, eVolExistingAndFuture);
Game.SetAudioTypeVolume(eAudioTypeAmbientSound, sldOptionsSound.Value, eVolExistingAndFuture);
}

function sldOptionsStyle_OnChange(GUIControl *control)
{
Verbs.ToogleGuiStyle(sldOptionsStyle.Value);
}

function btnSaveSlot_OnClick(GUIControl *control, MouseButton button)
function btnOptions_OnClick(GUIControl *control, MouseButton button)
{
OptionGui.SelectSaveSlot(control.ID);
OptionGui.OnClick(control, button);
}

function btnSaveOk_OnClick(GUIControl *control, MouseButton button)
function btnOptions_OnSliderChange(GUIControl *control)
{
OptionGui.SaveYes();
OptionGui.OnSliderChange(control);
}

function btnSaveNo_OnClick(GUIControl *control, MouseButton button)
{
OptionGui.SaveNo();
}

function btnSaveCancel_OnClick(GUIControl *control, MouseButton button)
{
OptionGui.SaveCancel();
}

function btnLoadSlot_OnClick(GUIControl *control, MouseButton button)
{
OptionGui.SelectLoadSlot(control.ID);
}

function btnLoadCancel_OnClick(GUIControl *control, MouseButton button)
{
OptionGui.LoadCancel();
}

function btnQuitYes_OnClick(GUIControl *control, MouseButton button)
{
QuitGame(0);
}

function btnQuitNo_OnClick(GUIControl *control, MouseButton button)
{
gQuit.Visible = false;
}
////////////////////////////////////////////////////////////////////////////////////
// End of GUI handling
////////////////////////////////////////////////////////////////////////////////////
Expand Down
55 changes: 49 additions & 6 deletions TemplateSettings.asc
@@ -1,9 +1,35 @@
#ifdef __OPTION_GUI_MODULE__ //make sure module's dependencies are here

function set_options()
{
/***********************************************************************
* Setup all the template options for the Verb GUI
***********************************************************************/

// Tell what global Guis to use
Verbs.BindGuis(gAction, gMain, gPause, gQuit);

// Tell what buttons match what verb actions
Verbs.MapButtons();
//Alternatively you can go into details :
/*
Verbs.SetActionButton(eGA_Open, verbsData.guiMain.Controls[0].AsButton);
Verbs.SetActionButton(eGA_Close, verbsData.guiMain.Controls[1].AsButton);
Verbs.SetActionButton(eGA_GiveTo, verbsData.guiMain.Controls[2].AsButton);
Verbs.SetActionButton(eGA_PickUp, verbsData.guiMain.Controls[3].AsButton);
Verbs.SetActionButton(eGA_LookAt, verbsData.guiMain.Controls[4].AsButton);
Verbs.SetActionButton(eGA_TalkTo, verbsData.guiMain.Controls[5].AsButton);
Verbs.SetActionButton(eGA_Push, verbsData.guiMain.Controls[6].AsButton);
Verbs.SetActionButton(eGA_Pull, verbsData.guiMain.Controls[7].AsButton);
Verbs.SetActionButton(eGA_Use, verbsData.guiMain.Controls[8].AsButton);
*/

//Customize verbs buttons grapics and shortcuts
Verbs.Localize(); //Alternatively you may call Verbs.LocalizeActionButton separately for each button, to set custom graphics and shortcuts.

// Tell what fonts to use
Verbs.SetFonts(eFontTumbleText, eFontTumbleTextOut, eFontTumbleSpeech, eFontTumbleOutlineSpeech);

// Default template Language, currently supported languages:
// eLangEN (English), eLangDE (German), eLangES (Spanish), eLangFR (French)
// eLangIT (Italian), eLangPT (Portuguese), eLangNL (Dutch)
Expand Down Expand Up @@ -68,7 +94,7 @@ function set_options()
// 1 = no speedup at all, 2 = double speed and so on
Verbs.VerbGuiOptions[eVerbGuiRunSpeedupRate] = 2;


/***********************************************************************
* Setup unhandled event messages
* %s is a placeholder for the location (characters, hotspots etc.)
Expand Down Expand Up @@ -108,9 +134,15 @@ function set_options()
/***********************************************************************
* Setup background graphic for save slots
***********************************************************************/
OptionGui.slotSprite = 81;
OptionGui.slotSpriteHi = 96;

CustomSave.SetGui(gSave, gSaveConfirm);
CustomSave.slotSprite = 81;
CustomSave.slotSpriteHi = 96;
CustomSave.font = eFontTumbleTiny;

CustomLoad.SetGui(gLoad, null); //null because this Load GUI does not have a "confirm" button
CustomLoad.slotSprite = 81;
CustomLoad.slotSpriteHi = 96;
CustomLoad.font = eFontTumbleTiny;
/***********************************************************************
* Setup all the template options for the dialog GUI
***********************************************************************/
Expand All @@ -132,7 +164,7 @@ function set_options()
CustomDialogGui.DialogGuiOptions[eDialogGui_xscreenborder] = 0;

// The font
CustomDialogGui.DialogGuiOptions[eDialogGui_text_font] = eFontText;
CustomDialogGui.DialogGuiOptions[eDialogGui_text_font] = eFontTumbleText;
CustomDialogGui.DialogGuiOptions[eDialogGui_text_alignment] = eAlignLeft;
CustomDialogGui.DialogGuiOptions[eDialogGui_text_color] = 23420;
CustomDialogGui.DialogGuiOptions[eDialogGui_text_color_active] = 24188;
Expand Down Expand Up @@ -250,4 +282,15 @@ function game_start()
Verbs.SetDefaultAction(eGA_WalkTo);
Verbs.HandleInvArrows();

}
}

#endif

#ifndef __OPTION_GUI_MODULE__ //a dependency is missing

void game_start()
{
AbortGame("Missing module 'OptionGui'");
}

#endif
4 changes: 3 additions & 1 deletion TemplateSettings.ash
@@ -1 +1,3 @@
// new module header
#ifdef __OPTION_GUI_MODULE__ //make sure module's dependencies are here
#define __TEMPLATESETTINGS_MODULE__ //Tell the other modules that this module is available
#endif