Skip to content

Commit

Permalink
Added different modes to 'Playthrough' console application to randoml…
Browse files Browse the repository at this point in the history
…y send mouse input events / trigger game object interactions; minor fixes for main game
  • Loading branch information
jonas committed Jul 5, 2018
1 parent 1a4f1e9 commit 813bd39
Show file tree
Hide file tree
Showing 31 changed files with 259 additions and 21 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Game/GameLogic/Properties/Basement.Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
<value>Might as well keep it with me. Maybe it's good luck.</value>
</data>
<data name="Move_the_mouse_to_rotate_Left_click_to_confirm_Right_click_to_abort" xml:space="preserve">
<value>Move the mouse to rotate. Left click to confirm. Right click to abort.</value>
<value>Move the mouse to rotate until the line color is green. Left click to confirm. Right click to abort.</value>
</data>
<data name="Left_click_to_place_the_antenna_Right_click_to_abort" xml:space="preserve">
<value>Left click to place the antenna. Right click to abort.</value>
Expand Down
9 changes: 9 additions & 0 deletions src/Game/GameLogic/Properties/Items.Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Game/GameLogic/Properties/Items.Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -586,4 +586,7 @@
<data name="Two_batteries_are_installed" xml:space="preserve">
<value>Two batteries are installed.</value>
</data>
<data name="I_dont_see_the_point_in_making_the_drone_fly_to_that" xml:space="preserve">
<value>I don't see the point in making the drone fly to that.</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/Game/GameLogic/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Game/GameLogic/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,7 @@
<data name="Menu_AddExitConfirmationWindow_No" xml:space="preserve">
<value>No</value>
</data>
<data name="Credits" xml:space="preserve">
<value>Credits</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Game/GameLogic/Properties/Resources_Session_6.resx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<comment>Session 6</comment>
</data>
<data name="No_No_its_not_I_asked_her_who_who_did_this__and_she_kept_crying_and_telling_me_to_keep_my_voice_down_and_thats" xml:space="preserve">
<value>No. No it's not. I asked her, "who? who did this ?" and she kept crying and telling me to keep my voice down, and that's...</value>
<value>No. No it's not. I asked her, "who? who did this?" and she kept crying and telling me to keep my voice down, and that's...</value>
<comment>Session 6</comment>
</data>
<data name="Thats_when_you_realized_he_was_in_the_house_with_you" xml:space="preserve">
Expand Down
4 changes: 4 additions & 0 deletions src/Game/GameLogic/base/Components/TracerLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public Vector2 Target
}

private Vector3 _Collider;
/// <summary>
/// (x,y) center position
/// z radius
/// </summary>
public Vector3 Collider
{
get
Expand Down
7 changes: 6 additions & 1 deletion src/Game/GameLogic/content/build.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

REM ------------------------------------------------------------------------------
REM <auto-generated>
REM This code was generated by a tool on 25.05.2018 11:40:42.
REM This code was generated by a tool on 05.07.2018 22:35:55.
REM
REM Changes to this file may cause incorrect behavior and will be lost if
REM the code is regenerated.
Expand All @@ -12,6 +12,9 @@ copy "audio\basement.ogg" "bin\audio\basement.ogg"
copy "audio\intro.ogg" "bin\audio\intro.ogg"
copy "audio\session2.ogg" "bin\audio\session2.ogg"
copy "audio\session3.ogg" "bin\audio\session3.ogg"
copy "audio\session4.ogg" "bin\audio\session4.ogg"
copy "audio\session5.ogg" "bin\audio\session5.ogg"
copy "audio\session6.ogg" "bin\audio\session6.ogg"
copy "audio\spectres.ogg" "bin\audio\spectres.ogg"
ContentCompiler.exe audio\battery_insert.wav bin\audio\battery_insert WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\battery_remove.wav bin\audio\battery_remove WavImporter SoundEffectProcessor true
Expand Down Expand Up @@ -45,7 +48,9 @@ ContentCompiler.exe audio\hammer_wood.wav bin\audio\hammer_wood WavImporter Soun
ContentCompiler.exe audio\light_off.wav bin\audio\light_off WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\light_on.wav bin\audio\light_on WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\lock_pick.wav bin\audio\lock_pick WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\menu_click-backup1.wav bin\audio\menu_click-backup1 WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\menu_click.wav bin\audio\menu_click WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\menu_focus-backup1.wav bin\audio\menu_focus-backup1 WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\menu_focus.wav bin\audio\menu_focus WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\mouse_eat.wav bin\audio\mouse_eat WavImporter SoundEffectProcessor true
ContentCompiler.exe audio\open_panel.wav bin\audio\open_panel WavImporter SoundEffectProcessor true
Expand Down
5 changes: 4 additions & 1 deletion src/Game/GameLogic/content/tree.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool on 25.05.2018 11:40:44.
// This code was generated by a tool on 05.07.2018 22:40:34.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -19,6 +19,9 @@ public static partial class audio
public const string intro = "audio\\intro";
public const string session2 = "audio\\session2";
public const string session3 = "audio\\session3";
public const string session4 = "audio\\session4";
public const string session5 = "audio\\session5";
public const string session6 = "audio\\session6";
public const string spectres = "audio\\spectres";
public const string battery_insert = "audio\\battery_insert";
public const string battery_remove = "audio\\battery_remove";
Expand Down
2 changes: 2 additions & 0 deletions src/Game/GameLogic/gui/dialog/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public Script StartSelectionScript(Scripts scripts)
/// </summary>
private IEnumerator WaitForSelection(bool setInteractive = true)
{
Game.StopSkipping();

while (State != DialogMenuState.Open && State != DialogMenuState.Closed)
{
yield return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/Game/GameLogic/gui/positionselection/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Label()
.SetFont(content.fonts.pixeloperator_outline_BMF)
.SetAlign(Alignment.Top)
.SetWidth(Game.VIRTUAL_WIDTH)
.SetWordWrap(false);
.SetWordWrap(true);

Transform
.Create(this)
Expand All @@ -31,7 +31,7 @@ public override void OnBeginDraw(Renderer renderer)
{
if (renderer.Stage == RenderStage.PostBloom)
{
renderer.SpriteBatch.Draw(renderer.WhitePixelTexture, new Rectangle(0, 0, Game.VIRTUAL_WIDTH, 20), new Color(0, 0, 0, 0.5f));
renderer.SpriteBatch.Draw(renderer.WhitePixelTexture, new Rectangle(0, 0, Game.VIRTUAL_WIDTH, 18 * Get<Text>().Lines.Count), new Color(0, 0, 0, 0.5f));
}

base.OnBeginDraw(renderer);
Expand Down
2 changes: 2 additions & 0 deletions src/Game/GameLogic/gui/positionselection/Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public Script StartSelectionScript(Scripts scripts, IPositionable entityToPositi
/// <returns></returns>
private IEnumerator WaitForSelection(IPositionable entityToPosition, bool setInteractive = true, bool abortable = true, int mode = 0)
{
Game.StopSkipping();

Aborted = false;
Enabled = true;
Visible = true;
Expand Down
10 changes: 10 additions & 0 deletions src/Game/GameLogic/items/Drone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@ protected override Interactions GetInteractions()
{
return Interactions
.Create()
.For(Any.Object)
.Add(Verbs.Use, UseScript(), Game.Ego)
.For(Game.Ego)
.Add(Verbs.Look, LookScript());
}

IEnumerator UseScript()
{
using (Game.CutsceneBlock())
{
yield return Game.Ego.Say(Items_Res.I_dont_see_the_point_in_making_the_drone_fly_to_that);
}
}

IEnumerator LookScript()
{
yield return Game.Ego.StartScript(DronePackage.LookScript());
Expand Down
2 changes: 2 additions & 0 deletions src/Game/GameLogic/items/Envelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ IEnumerator OpenScript()
Tree.Letter.Scene.Visible = true;
Tree.GUI.Interaction.Scene.Interactive = false;

Game.StopSkipping();

while (Tree.Letter.Scene.Enabled)
{
yield return 1;
Expand Down
16 changes: 11 additions & 5 deletions src/Game/GameLogic/items/RFIDAntenna.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public IEnumerator UseScript(bool reset, bool doCheck)
// place
yield return Game.Ego.StartScript(PlaceScript(AntennaFloor, RFIDAntennaFloor.POSITIONMODE_POSITION));

if (AntennaFloor.WasPlacedTooClose)
if (AntennaFloor.WasPlacedTooClose && !SelectionAborted)
{
yield return Game.Ego.Say(Items_Res.I_need_to_place_the_other_antenna_with_more_distance_for_the_triangulation_to_work);
}
Expand All @@ -109,6 +109,7 @@ public IEnumerator UseScript(bool reset, bool doCheck)
yield return Game.Ego.StartScript(PlaceScript(AntennaFloor, RFIDAntennaFloor.POSITIONMODE_ROTATION));
}

// this needs to be evaluated here again
if (!SelectionAborted)
{
if (HitCollider)
Expand Down Expand Up @@ -143,13 +144,18 @@ public IEnumerator UseScript(bool reset, bool doCheck)
}
}
}

yield return Game.Ego.GoTo(AntennaFloor);
yield return Game.Ego.StartUse();
if (!SelectionAborted)
{
yield return Game.Ego.GoTo(AntennaFloor);
yield return Game.Ego.StartUse();
}
Placed = false;
AntennaFloor.Visible = false;
AntennaFloor.Enabled = false;
yield return Game.Ego.StopUse();
if (!SelectionAborted)
{
yield return Game.Ego.StopUse();
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions src/Game/GameLogic/menu/MainMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using STACK;
using System;
using TomShane.Neoforce.Controls;
Expand All @@ -14,6 +15,8 @@ public partial class Menu : IDisposable
private Label MainMenuLabel;
private SoundEffect FocusSound, ClickSound;

public Song MenuSong { get; private set; }

public void Show()
{
RefreshSaveGames();
Expand Down Expand Up @@ -69,17 +72,28 @@ public void Dispose()
{
FocusSound.Dispose();
}

if (null != MenuSong)
{
//MenuSong.Dispose();
}
}

public Menu(StackEngine engine)
{
FocusSound = engine.EngineContent.Load<SoundEffect>(content.audio.menu_click);
ClickSound = engine.EngineContent.Load<SoundEffect>(content.audio.menu_focus);
MenuSong = engine.EngineContent.Load<Song>(content.audio.session6);

MediaPlayer.Play(MenuSong);
MediaPlayer.IsRepeating = true;

Engine = engine;
GameSettings = engine.GameSettings;

var GUI = engine.Renderer.GUIManager;

GUI.Input.KeyDown += new KeyEventHandler(OnKeyDown);
var Cursor = CreateCursor();

GUI.ShowSoftwareCursor = true;
Expand Down Expand Up @@ -116,5 +130,13 @@ public Menu(StackEngine engine)

ShowLogo(true);
}

private void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Microsoft.Xna.Framework.Input.Keys.Escape && GameRunning)
{
ContinueGame();
}
}
}
}
13 changes: 9 additions & 4 deletions src/Game/GameLogic/menu/MenuItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ private bool GameRunning
}
}

private void ContinueGame()
{
MainMenuBackground.Hide();
Engine.Resume();
Engine.Renderer.GUIManager.ShowSoftwareCursor = false;
}

IEnumerable<Item> GetMenuItems()
{
// Quit
Expand All @@ -51,7 +58,7 @@ IEnumerable<Item> GetMenuItems()
yield return Item;

// Credits
Item = new Item("Credits");
Item = new Item(GlblRes.Credits);
Item.OnClick = () =>
{
CreditsWindow.Show();
Expand Down Expand Up @@ -98,9 +105,7 @@ IEnumerable<Item> GetMenuItems()
Item = new Item(GlblRes.Continue);
Item.OnClick = () =>
{
MainMenuBackground.Hide();
Engine.Resume();
Engine.Renderer.GUIManager.ShowSoftwareCursor = false;
ContinueGame();
};
Item.IsVisible = () => { return GameRunning; };
yield return Item;
Expand Down
2 changes: 2 additions & 0 deletions src/Game/GameLogic/menu/SaveLoadGame.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using STACK;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -105,6 +106,7 @@ void AddLoadGameWindow(Manager gui)

LoadGameWindow.Close();
MainMenuBackground.Hide();
MediaPlayer.Stop();
Engine.Resume();
Engine.Renderer.GUIManager.ShowSoftwareCursor = false;
};
Expand Down
1 change: 1 addition & 0 deletions src/Game/GameLogic/rooms/basement/RFIDAntennaFloor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public void BeginPosition(int mode)
Tree.GUI.PositionSelection.Label.LabelText = Basement_Res.Left_click_to_place_the_antenna_Right_click_to_abort;
Get<SpriteData>().Color = new Color(0, 0, 1f, 0.3f);
Get<TracerLine>().SetVisible(false);
WasPlacedTooClose = false;
}

Visible = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Game/GameLogic/rooms/basement/WoodenPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WoodenPanel : Entity
/// <summary>
/// Colliding circle, z equals radius
/// </summary>
public static readonly Vector3 Collider = new Vector3(621, 275, 5);
public static readonly Vector3 Collider = new Vector3(621, 275, 8);

public bool Uncovered { get; private set; }

Expand Down
2 changes: 2 additions & 0 deletions src/Game/GameLogic/sessions/Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public Script StartSession(Sessions session)
Tree.Cutscenes.Scene.Visible = true;
Tree.Cutscenes.Scene.Enabled = true;

Log.WriteLine("Starting Session " + session.ToString());

return Get<Scripts>().Start(GetSessionScript(session));
}

Expand Down
Loading

0 comments on commit 813bd39

Please sign in to comment.