Changes made to run the game on modern platforms

This commit is contained in:
Robert Vokac 2025-01-11 10:49:51 +01:00
parent dc4dfaf782
commit 23b75dc5c7
17 changed files with 1360 additions and 1381 deletions

242
.gitignore vendored
View File

@ -1,242 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Xx]64/
[Xx]86/
[Bb]uild/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Un-comment the next line if you do not want to checkin
# your web deploy settings because they may include unencrypted
# passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# LightSwitch generated files
GeneratedArtifacts/
ModelManifest.xml
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/

View File

@ -1,41 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Speedy Blupi")]
[assembly: AssemblyProduct("Speedy Blupi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Dada Games")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
// Configuration
[assembly: AssemblyConfiguration("")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4b6c546f-6967-447a-8eda-c3236043dcf7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.5")]
[assembly: AssemblyFileVersion("1.0.0.0")]

794
Decor.cs

File diff suppressed because it is too large Load Diff

5
Def.cs
View File

@ -1,12 +1,15 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Def // WindowsPhoneSpeedyBlupi.Def
using Microsoft.Xna.Framework.Input;
using static WindowsPhoneSpeedyBlupi.Def;
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
{ {
public static class Def public static class Def
{ {
public enum Phase public enum Phase
{ {
None, None,
@ -24,7 +27,7 @@ namespace WindowsPhoneSpeedyBlupi
Ranking Ranking
} }
public enum ButtonGlygh public enum ButtonGlyph
{ {
None, None,
InitGamerA, InitGamerA,

25
Env.cs Normal file
View File

@ -0,0 +1,25 @@
using System;
using static WindowsPhoneSpeedyBlupi.Xna;
namespace WindowsPhoneSpeedyBlupi
{
public static class Env
{
public static bool DETAILED_DEBUGGING { get; set; }
public static Platform PLATFORM { get; private set; }
public static XnaImpl XNA_IMPL { get; private set; }
public static bool INITIALIZED { get; private set; }
public static void init(XnaImpl xnaImpl, Platform platformIn)
{
if(INITIALIZED)
{
throw new Exception("Env was already initialized. Cannot call the init method again.");
}
XNA_IMPL = xnaImpl;
PLATFORM = platformIn;
INITIALIZED = true;
}
}
}

317
Game1.cs
View File

@ -4,6 +4,7 @@ using System;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Media;
using WindowsPhoneSpeedyBlupi; using WindowsPhoneSpeedyBlupi;
using static System.Net.Mime.MediaTypeNames; using static System.Net.Mime.MediaTypeNames;
@ -19,18 +20,18 @@ namespace WindowsPhoneSpeedyBlupi
0.94, 91.0, 1.0, 100.0 0.94, 91.0, 1.0, 100.0
}; };
private static readonly Def.ButtonGlygh[] cheatGeste = new Def.ButtonGlygh[10] private static readonly Def.ButtonGlyph[] cheatGeste = new Def.ButtonGlyph[10]
{ {
Def.ButtonGlygh.Cheat12, Def.ButtonGlyph.Cheat12,
Def.ButtonGlygh.Cheat22, Def.ButtonGlyph.Cheat22,
Def.ButtonGlygh.Cheat32, Def.ButtonGlyph.Cheat32,
Def.ButtonGlygh.Cheat12, Def.ButtonGlyph.Cheat12,
Def.ButtonGlygh.Cheat11, Def.ButtonGlyph.Cheat11,
Def.ButtonGlygh.Cheat21, Def.ButtonGlyph.Cheat21,
Def.ButtonGlygh.Cheat22, Def.ButtonGlyph.Cheat22,
Def.ButtonGlygh.Cheat21, Def.ButtonGlyph.Cheat21,
Def.ButtonGlygh.Cheat31, Def.ButtonGlyph.Cheat31,
Def.ButtonGlygh.Cheat32 Def.ButtonGlyph.Cheat32
}; };
private readonly GraphicsDeviceManager graphics; private readonly GraphicsDeviceManager graphics;
@ -97,8 +98,18 @@ namespace WindowsPhoneSpeedyBlupi
public Game1() public Game1()
{ {
if(!Env.INITIALIZED)
{
throw new Exception("Fatal error: Not initialized. Env.init() was not called.");
}
Exiting += OnExiting;
if(!TouchPanel.GetCapabilities().IsConnected)
{
this.IsMouseVisible = true;
Mouse.SetCursor(MouseCursor.Arrow);
}
graphics = new GraphicsDeviceManager(this); graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true; graphics.IsFullScreen = false;
base.Content.RootDirectory = "Content"; base.Content.RootDirectory = "Content";
base.TargetElapsedTime = TimeSpan.FromTicks(500000L); base.TargetElapsedTime = TimeSpan.FromTicks(500000L);
base.InactiveSleepTime = TimeSpan.FromSeconds(1.0); base.InactiveSleepTime = TimeSpan.FromSeconds(1.0);
@ -157,10 +168,9 @@ namespace WindowsPhoneSpeedyBlupi
base.OnActivated(sender, args); base.OnActivated(sender, args);
} }
protected override void OnExiting(object sender, EventArgs args) protected void OnExiting(object sender, EventArgs args)
{ {
decor.CurrentDelete(); decor.CurrentDelete();
base.OnExiting(sender, args);
} }
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
@ -229,41 +239,41 @@ namespace WindowsPhoneSpeedyBlupi
return; return;
} }
inputPad.Update(); inputPad.Update();
Def.ButtonGlygh buttonPressed = inputPad.ButtonPressed; Def.ButtonGlyph buttonPressed = inputPad.ButtonPressed;
if (buttonPressed >= Def.ButtonGlygh.InitGamerA && buttonPressed <= Def.ButtonGlygh.InitGamerC) if (buttonPressed >= Def.ButtonGlyph.InitGamerA && buttonPressed <= Def.ButtonGlyph.InitGamerC)
{ {
SetGamer((int)(buttonPressed - 1)); SetGamer((int)(buttonPressed - 1));
return; return;
} }
switch (buttonPressed) switch (buttonPressed)
{ {
case Def.ButtonGlygh.InitSetup: case Def.ButtonGlyph.InitSetup:
SetPhase(Def.Phase.MainSetup); SetPhase(Def.Phase.MainSetup);
return; return;
case Def.ButtonGlygh.PauseSetup: case Def.ButtonGlyph.PauseSetup:
SetPhase(Def.Phase.PlaySetup); SetPhase(Def.Phase.PlaySetup);
return; return;
case Def.ButtonGlygh.SetupSounds: case Def.ButtonGlyph.SetupSounds:
gameData.Sounds = !gameData.Sounds; gameData.Sounds = !gameData.Sounds;
gameData.Write(); gameData.Write();
return; return;
case Def.ButtonGlygh.SetupJump: case Def.ButtonGlyph.SetupJump:
gameData.JumpRight = !gameData.JumpRight; gameData.JumpRight = !gameData.JumpRight;
gameData.Write(); gameData.Write();
return; return;
case Def.ButtonGlygh.SetupZoom: case Def.ButtonGlyph.SetupZoom:
gameData.AutoZoom = !gameData.AutoZoom; gameData.AutoZoom = !gameData.AutoZoom;
gameData.Write(); gameData.Write();
return; return;
case Def.ButtonGlygh.SetupAccel: case Def.ButtonGlyph.SetupAccel:
gameData.AccelActive = !gameData.AccelActive; gameData.AccelActive = !gameData.AccelActive;
gameData.Write(); gameData.Write();
return; return;
case Def.ButtonGlygh.SetupReset: case Def.ButtonGlyph.SetupReset:
gameData.Reset(); gameData.Reset();
gameData.Write(); gameData.Write();
return; return;
case Def.ButtonGlygh.SetupReturn: case Def.ButtonGlyph.SetupReturn:
if (playSetup) if (playSetup)
{ {
SetPhase(Def.Phase.Play, -1); SetPhase(Def.Phase.Play, -1);
@ -273,50 +283,50 @@ namespace WindowsPhoneSpeedyBlupi
SetPhase(Def.Phase.Init); SetPhase(Def.Phase.Init);
} }
return; return;
case Def.ButtonGlygh.InitPlay: case Def.ButtonGlyph.InitPlay:
SetPhase(Def.Phase.Play, 1); SetPhase(Def.Phase.Play, 1);
return; return;
case Def.ButtonGlygh.PlayPause: case Def.ButtonGlyph.PlayPause:
SetPhase(Def.Phase.Pause); SetPhase(Def.Phase.Pause);
return; return;
case Def.ButtonGlygh.WinLostReturn: case Def.ButtonGlyph.WinLostReturn:
case Def.ButtonGlygh.PauseMenu: case Def.ButtonGlyph.PauseMenu:
case Def.ButtonGlygh.ResumeMenu: case Def.ButtonGlyph.ResumeMenu:
SetPhase(Def.Phase.Init); SetPhase(Def.Phase.Init);
break; break;
} }
switch (buttonPressed) switch (buttonPressed)
{ {
case Def.ButtonGlygh.ResumeContinue: case Def.ButtonGlyph.ResumeContinue:
ContinueMission(); ContinueMission();
return; return;
case Def.ButtonGlygh.InitBuy: case Def.ButtonGlyph.InitBuy:
case Def.ButtonGlygh.TrialBuy: case Def.ButtonGlyph.TrialBuy:
Guide.ShowMarketplace(PlayerIndex.One); Guide.Show(PlayerIndex.One);
SetPhase(Def.Phase.Init); SetPhase(Def.Phase.Init);
return; return;
case Def.ButtonGlygh.InitRanking: case Def.ButtonGlyph.InitRanking:
SetPhase(Def.Phase.Ranking); SetPhase(Def.Phase.Ranking);
return; return;
case Def.ButtonGlygh.TrialCancel: case Def.ButtonGlyph.TrialCancel:
case Def.ButtonGlygh.RankingContinue: case Def.ButtonGlyph.RankingContinue:
SetPhase(Def.Phase.Init); SetPhase(Def.Phase.Init);
return; return;
case Def.ButtonGlygh.PauseBack: case Def.ButtonGlyph.PauseBack:
MissionBack(); MissionBack();
return; return;
case Def.ButtonGlygh.PauseRestart: case Def.ButtonGlyph.PauseRestart:
SetPhase(Def.Phase.Play, mission); SetPhase(Def.Phase.Play, mission);
return; return;
case Def.ButtonGlygh.PauseContinue: case Def.ButtonGlyph.PauseContinue:
SetPhase(Def.Phase.Play, -1); SetPhase(Def.Phase.Play, -1);
return; return;
case Def.ButtonGlygh.Cheat11: case Def.ButtonGlyph.Cheat11:
case Def.ButtonGlygh.Cheat12: case Def.ButtonGlyph.Cheat12:
case Def.ButtonGlygh.Cheat21: case Def.ButtonGlyph.Cheat21:
case Def.ButtonGlygh.Cheat22: case Def.ButtonGlyph.Cheat22:
case Def.ButtonGlygh.Cheat31: case Def.ButtonGlyph.Cheat31:
case Def.ButtonGlygh.Cheat32: case Def.ButtonGlyph.Cheat32:
if (buttonPressed == cheatGeste[cheatGesteIndex]) if (buttonPressed == cheatGeste[cheatGesteIndex])
{ {
cheatGesteIndex++; cheatGesteIndex++;
@ -338,7 +348,7 @@ namespace WindowsPhoneSpeedyBlupi
} }
break; break;
} }
if (buttonPressed >= Def.ButtonGlygh.Cheat1 && buttonPressed <= Def.ButtonGlygh.Cheat9) if (buttonPressed >= Def.ButtonGlyph.Cheat1 && buttonPressed <= Def.ButtonGlyph.Cheat9)
{ {
CheatAction(buttonPressed); CheatAction(buttonPressed);
} }
@ -415,35 +425,35 @@ namespace WindowsPhoneSpeedyBlupi
inputPad.StartMission(mission); inputPad.StartMission(mission);
} }
private void CheatAction(Def.ButtonGlygh glyph) private void CheatAction(Def.ButtonGlyph glyph)
{ {
switch (glyph) switch (glyph)
{ {
case Def.ButtonGlygh.Cheat1: case Def.ButtonGlyph.Cheat1:
decor.CheatAction(Tables.CheatCodes.OpenDoors); decor.CheatAction(Tables.CheatCodes.OpenDoors);
break; break;
case Def.ButtonGlygh.Cheat2: case Def.ButtonGlyph.Cheat2:
decor.CheatAction(Tables.CheatCodes.SuperBlupi); decor.CheatAction(Tables.CheatCodes.SuperBlupi);
break; break;
case Def.ButtonGlygh.Cheat3: case Def.ButtonGlyph.Cheat3:
decor.CheatAction(Tables.CheatCodes.ShowSecret); decor.CheatAction(Tables.CheatCodes.ShowSecret);
break; break;
case Def.ButtonGlygh.Cheat4: case Def.ButtonGlyph.Cheat4:
decor.CheatAction(Tables.CheatCodes.LayEgg); decor.CheatAction(Tables.CheatCodes.LayEgg);
break; break;
case Def.ButtonGlygh.Cheat5: case Def.ButtonGlyph.Cheat5:
gameData.Reset(); gameData.Reset();
break; break;
case Def.ButtonGlygh.Cheat6: case Def.ButtonGlyph.Cheat6:
simulateTrialMode = !simulateTrialMode; simulateTrialMode = !simulateTrialMode;
break; break;
case Def.ButtonGlygh.Cheat7: case Def.ButtonGlyph.Cheat7:
decor.CheatAction(Tables.CheatCodes.CleanAll); decor.CheatAction(Tables.CheatCodes.CleanAll);
break; break;
case Def.ButtonGlygh.Cheat8: case Def.ButtonGlyph.Cheat8:
decor.CheatAction(Tables.CheatCodes.AllTreasure); decor.CheatAction(Tables.CheatCodes.AllTreasure);
break; break;
case Def.ButtonGlygh.Cheat9: case Def.ButtonGlyph.Cheat9:
decor.CheatAction(Tables.CheatCodes.EndGoal); decor.CheatAction(Tables.CheatCodes.EndGoal);
break; break;
} }
@ -497,10 +507,10 @@ namespace WindowsPhoneSpeedyBlupi
{ {
num = (1.0 - num) * (1.0 - num); num = (1.0 - num) * (1.0 - num);
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = (int)(720.0 - 640.0 * num); tinyRect.LeftX = (int)(720.0 - 640.0 * num);
tinyRect.Right = (int)(1360.0 - 640.0 * num); tinyRect.RightX = (int)(1360.0 - 640.0 * num);
tinyRect.Top = 0; tinyRect.TopY = 0;
tinyRect.Bottom = 160; tinyRect.BottomY = 160;
rect = tinyRect; rect = tinyRect;
opacity = num * num; opacity = num * num;
} }
@ -508,10 +518,10 @@ namespace WindowsPhoneSpeedyBlupi
{ {
num = ((fadeOutPhase != 0) ? (1.0 - num * 2.0) : (1.0 - (1.0 - num) * (1.0 - num))); num = ((fadeOutPhase != 0) ? (1.0 - num * 2.0) : (1.0 - (1.0 - num) * (1.0 - num)));
TinyRect tinyRect2 = default(TinyRect); TinyRect tinyRect2 = default(TinyRect);
tinyRect2.Left = 80; tinyRect2.LeftX = 80;
tinyRect2.Right = 720; tinyRect2.RightX = 720;
tinyRect2.Top = (int)(-160.0 + num * 160.0); tinyRect2.TopY = (int)(-160.0 + num * 160.0);
tinyRect2.Bottom = (int)(0.0 + num * 160.0); tinyRect2.BottomY = (int)(0.0 + num * 160.0);
rect = tinyRect2; rect = tinyRect2;
opacity = 1.0; opacity = 1.0;
} }
@ -537,10 +547,10 @@ namespace WindowsPhoneSpeedyBlupi
num = 1.0 + num * 10.0; num = 1.0 + num * 10.0;
} }
TinyRect tinyRect3 = default(TinyRect); TinyRect tinyRect3 = default(TinyRect);
tinyRect3.Left = (int)(468.0 - 205.0 * num); tinyRect3.LeftX = (int)(468.0 - 205.0 * num);
tinyRect3.Right = (int)(468.0 + 205.0 * num); tinyRect3.RightX = (int)(468.0 + 205.0 * num);
tinyRect3.Top = (int)(280.0 - 190.0 * num); tinyRect3.TopY = (int)(280.0 - 190.0 * num);
tinyRect3.Bottom = (int)(280.0 + 190.0 * num); tinyRect3.BottomY = (int)(280.0 + 190.0 * num);
TinyRect rect = tinyRect3; TinyRect rect = tinyRect3;
pixmap.DrawIcon(16, 0, rect, opacity, 0.0, false); pixmap.DrawIcon(16, 0, rect, opacity, 0.0, false);
} }
@ -552,10 +562,10 @@ namespace WindowsPhoneSpeedyBlupi
double opacity = 1.0 - num; double opacity = 1.0 - num;
num = 1.0 + num * 10.0; num = 1.0 + num * 10.0;
TinyRect tinyRect4 = default(TinyRect); TinyRect tinyRect4 = default(TinyRect);
tinyRect4.Left = (int)(418.0 - 205.0 * num); tinyRect4.LeftX = (int)(418.0 - 205.0 * num);
tinyRect4.Right = (int)(418.0 + 205.0 * num); tinyRect4.RightX = (int)(418.0 + 205.0 * num);
tinyRect4.Top = (int)(190.0 - 190.0 * num); tinyRect4.TopY = (int)(190.0 - 190.0 * num);
tinyRect4.Bottom = (int)(190.0 + 190.0 * num); tinyRect4.BottomY = (int)(190.0 + 190.0 * num);
TinyRect rect = tinyRect4; TinyRect rect = tinyRect4;
pixmap.DrawIcon(16, 0, rect, opacity, 0.0, false); pixmap.DrawIcon(16, 0, rect, opacity, 0.0, false);
} }
@ -564,10 +574,10 @@ namespace WindowsPhoneSpeedyBlupi
double num = Math.Min((double)phaseTime / 20.0, 1.0); double num = Math.Min((double)phaseTime / 20.0, 1.0);
num *= num; num *= num;
TinyRect tinyRect5 = default(TinyRect); TinyRect tinyRect5 = default(TinyRect);
tinyRect5.Left = (int)(213.0 + 800.0 * num); tinyRect5.LeftX = (int)(213.0 + 800.0 * num);
tinyRect5.Right = (int)(623.0 + 800.0 * num); tinyRect5.RightX = (int)(623.0 + 800.0 * num);
tinyRect5.Top = 0; tinyRect5.TopY = 0;
tinyRect5.Bottom = 0; tinyRect5.BottomY = 0;
TinyRect rect = tinyRect5; TinyRect rect = tinyRect5;
pixmap.DrawIcon(16, 0, rect, 1.0, 0.0, false); pixmap.DrawIcon(16, 0, rect, 1.0, 0.0, false);
} }
@ -584,10 +594,10 @@ namespace WindowsPhoneSpeedyBlupi
num = 1.0 - num; num = 1.0 - num;
} }
TinyRect tinyRect6 = default(TinyRect); TinyRect tinyRect6 = default(TinyRect);
tinyRect6.Left = (int)(418.0 - 205.0 * num); tinyRect6.LeftX = (int)(418.0 - 205.0 * num);
tinyRect6.Right = (int)(418.0 + 205.0 * num); tinyRect6.RightX = (int)(418.0 + 205.0 * num);
tinyRect6.Top = (int)(190.0 - 190.0 * num); tinyRect6.TopY = (int)(190.0 - 190.0 * num);
tinyRect6.Bottom = (int)(190.0 + 190.0 * num); tinyRect6.BottomY = (int)(190.0 + 190.0 * num);
TinyRect rect = tinyRect6; TinyRect rect = tinyRect6;
double rotation = 0.0; double rotation = 0.0;
if (num < 1.0) if (num < 1.0)
@ -620,23 +630,23 @@ namespace WindowsPhoneSpeedyBlupi
num2 = 1.0 - num2; num2 = 1.0 - num2;
} }
TinyRect tinyRect7 = default(TinyRect); TinyRect tinyRect7 = default(TinyRect);
tinyRect7.Left = (int)(720.0 - 640.0 * num); tinyRect7.LeftX = (int)(720.0 - 640.0 * num);
tinyRect7.Right = (int)(1360.0 - 640.0 * num); tinyRect7.RightX = (int)(1360.0 - 640.0 * num);
tinyRect7.Top = 0; tinyRect7.TopY = 0;
tinyRect7.Bottom = 160; tinyRect7.BottomY = 160;
TinyRect rect = tinyRect7; TinyRect rect = tinyRect7;
pixmap.DrawIcon(15, 0, rect, num * num, false); pixmap.DrawIcon(15, 0, rect, num * num, false);
TinyRect tinyRect8 = default(TinyRect); TinyRect tinyRect8 = default(TinyRect);
tinyRect8.Left = 487; tinyRect8.LeftX = 487;
tinyRect8.Right = 713; tinyRect8.RightX = 713;
tinyRect8.Top = 148; tinyRect8.TopY = 148;
tinyRect8.Bottom = 374; tinyRect8.BottomY = 374;
TinyRect rect2 = tinyRect8; TinyRect rect2 = tinyRect8;
TinyRect tinyRect9 = default(TinyRect); TinyRect tinyRect9 = default(TinyRect);
tinyRect9.Left = 118; tinyRect9.LeftX = 118;
tinyRect9.Right = 570; tinyRect9.RightX = 570;
tinyRect9.Top = 268; tinyRect9.TopY = 268;
tinyRect9.Bottom = 720; tinyRect9.BottomY = 720;
TinyRect rect3 = tinyRect9; TinyRect rect3 = tinyRect9;
double opacity = 0.5 - num * 0.4; double opacity = 0.5 - num * 0.4;
double rotation = (0.0 - num2) * 100.0 * 2.5; double rotation = (0.0 - num2) * 100.0 * 2.5;
@ -647,10 +657,10 @@ namespace WindowsPhoneSpeedyBlupi
{ {
double num = Math.Min((double)phaseTime / 100.0, 1.0); double num = Math.Min((double)phaseTime / 100.0, 1.0);
TinyRect tinyRect10 = default(TinyRect); TinyRect tinyRect10 = default(TinyRect);
tinyRect10.Left = (int)(418.0 - 205.0 * num); tinyRect10.LeftX = (int)(418.0 - 205.0 * num);
tinyRect10.Right = (int)(418.0 + 205.0 * num); tinyRect10.RightX = (int)(418.0 + 205.0 * num);
tinyRect10.Top = (int)(238.0 - 190.0 * num); tinyRect10.TopY = (int)(238.0 - 190.0 * num);
tinyRect10.Bottom = (int)(238.0 + 190.0 * num); tinyRect10.BottomY = (int)(238.0 + 190.0 * num);
TinyRect rect = tinyRect10; TinyRect rect = tinyRect10;
double rotation = 0.0; double rotation = 0.0;
if (num < 1.0) if (num < 1.0)
@ -666,10 +676,10 @@ namespace WindowsPhoneSpeedyBlupi
{ {
double num = Math.Sin((double)phaseTime / 3.0) / 2.0 + 1.0; double num = Math.Sin((double)phaseTime / 3.0) / 2.0 + 1.0;
TinyRect tinyRect11 = default(TinyRect); TinyRect tinyRect11 = default(TinyRect);
tinyRect11.Left = (int)(418.0 - 205.0 * num); tinyRect11.LeftX = (int)(418.0 - 205.0 * num);
tinyRect11.Right = (int)(418.0 + 205.0 * num); tinyRect11.RightX = (int)(418.0 + 205.0 * num);
tinyRect11.Top = (int)(238.0 - 190.0 * num); tinyRect11.TopY = (int)(238.0 - 190.0 * num);
tinyRect11.Bottom = (int)(238.0 + 190.0 * num); tinyRect11.BottomY = (int)(238.0 + 190.0 * num);
TinyRect rect = tinyRect11; TinyRect rect = tinyRect11;
pixmap.DrawIcon(16, 0, rect, 1.0, 0.0, false); pixmap.DrawIcon(16, 0, rect, 1.0, 0.0, false);
} }
@ -683,17 +693,17 @@ namespace WindowsPhoneSpeedyBlupi
int width = drawBounds.Width; int width = drawBounds.Width;
int height = drawBounds.Height; int height = drawBounds.Height;
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = 10; tinyRect.LeftX = 10;
tinyRect.Right = 260; tinyRect.RightX = 260;
tinyRect.Top = height - 325; tinyRect.TopY = height - 325;
tinyRect.Bottom = height - 10; tinyRect.BottomY = height - 10;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
pixmap.DrawIcon(14, 15, rect, 0.3, false); pixmap.DrawIcon(14, 15, rect, 0.3, false);
TinyRect tinyRect2 = default(TinyRect); TinyRect tinyRect2 = default(TinyRect);
tinyRect2.Left = width - 170; tinyRect2.LeftX = width - 170;
tinyRect2.Right = width - 10; tinyRect2.RightX = width - 10;
tinyRect2.Top = height - ((IsTrialMode || IsRankingMode) ? 325 : 195); tinyRect2.TopY = height - ((IsTrialMode || IsRankingMode) ? 325 : 195);
tinyRect2.Bottom = height - 10; tinyRect2.BottomY = height - 10;
rect = tinyRect2; rect = tinyRect2;
pixmap.DrawIcon(14, 15, rect, 0.3, false); pixmap.DrawIcon(14, 15, rect, 0.3, false);
} }
@ -703,49 +713,49 @@ namespace WindowsPhoneSpeedyBlupi
{ {
if (phase == Def.Phase.Init) if (phase == Def.Phase.Init)
{ {
DrawButtonGamerText(Def.ButtonGlygh.InitGamerA, 0); DrawButtonGamerText(Def.ButtonGlyph.InitGamerA, 0);
DrawButtonGamerText(Def.ButtonGlygh.InitGamerB, 1); DrawButtonGamerText(Def.ButtonGlyph.InitGamerB, 1);
DrawButtonGamerText(Def.ButtonGlygh.InitGamerC, 2); DrawButtonGamerText(Def.ButtonGlyph.InitGamerC, 2);
DrawTextUnderButton(Def.ButtonGlygh.InitPlay, MyResource.TX_BUTTON_PLAY); DrawTextUnderButton(Def.ButtonGlyph.InitPlay, MyResource.TX_BUTTON_PLAY);
DrawTextRightButton(Def.ButtonGlygh.InitSetup, MyResource.TX_BUTTON_SETUP); DrawTextRightButton(Def.ButtonGlyph.InitSetup, MyResource.TX_BUTTON_SETUP);
if (IsTrialMode) if (IsTrialMode)
{ {
DrawTextUnderButton(Def.ButtonGlygh.InitBuy, MyResource.TX_BUTTON_BUY); DrawTextUnderButton(Def.ButtonGlyph.InitBuy, MyResource.TX_BUTTON_BUY);
} }
if (IsRankingMode) if (IsRankingMode)
{ {
DrawTextUnderButton(Def.ButtonGlygh.InitRanking, MyResource.TX_BUTTON_RANKING); DrawTextUnderButton(Def.ButtonGlyph.InitRanking, MyResource.TX_BUTTON_RANKING);
} }
} }
if (phase == Def.Phase.Pause) if (phase == Def.Phase.Pause)
{ {
DrawTextUnderButton(Def.ButtonGlygh.PauseMenu, MyResource.TX_BUTTON_MENU); DrawTextUnderButton(Def.ButtonGlyph.PauseMenu, MyResource.TX_BUTTON_MENU);
if (mission != 1) if (mission != 1)
{ {
DrawTextUnderButton(Def.ButtonGlygh.PauseBack, MyResource.TX_BUTTON_BACK); DrawTextUnderButton(Def.ButtonGlyph.PauseBack, MyResource.TX_BUTTON_BACK);
} }
DrawTextUnderButton(Def.ButtonGlygh.PauseSetup, MyResource.TX_BUTTON_SETUP); DrawTextUnderButton(Def.ButtonGlyph.PauseSetup, MyResource.TX_BUTTON_SETUP);
if (mission != 1 && mission % 10 != 0) if (mission != 1 && mission % 10 != 0)
{ {
DrawTextUnderButton(Def.ButtonGlygh.PauseRestart, MyResource.TX_BUTTON_RESTART); DrawTextUnderButton(Def.ButtonGlyph.PauseRestart, MyResource.TX_BUTTON_RESTART);
} }
DrawTextUnderButton(Def.ButtonGlygh.PauseContinue, MyResource.TX_BUTTON_CONTINUE); DrawTextUnderButton(Def.ButtonGlyph.PauseContinue, MyResource.TX_BUTTON_CONTINUE);
} }
if (phase == Def.Phase.Resume) if (phase == Def.Phase.Resume)
{ {
DrawTextUnderButton(Def.ButtonGlygh.ResumeMenu, MyResource.TX_BUTTON_MENU); DrawTextUnderButton(Def.ButtonGlyph.ResumeMenu, MyResource.TX_BUTTON_MENU);
DrawTextUnderButton(Def.ButtonGlygh.ResumeContinue, MyResource.TX_BUTTON_CONTINUE); DrawTextUnderButton(Def.ButtonGlyph.ResumeContinue, MyResource.TX_BUTTON_CONTINUE);
} }
if (phase == Def.Phase.MainSetup || phase == Def.Phase.PlaySetup) if (phase == Def.Phase.MainSetup || phase == Def.Phase.PlaySetup)
{ {
DrawTextRightButton(Def.ButtonGlygh.SetupSounds, MyResource.TX_BUTTON_SETUP_SOUNDS); DrawTextRightButton(Def.ButtonGlyph.SetupSounds, MyResource.TX_BUTTON_SETUP_SOUNDS);
DrawTextRightButton(Def.ButtonGlygh.SetupJump, MyResource.TX_BUTTON_SETUP_JUMP); DrawTextRightButton(Def.ButtonGlyph.SetupJump, MyResource.TX_BUTTON_SETUP_JUMP);
DrawTextRightButton(Def.ButtonGlygh.SetupZoom, MyResource.TX_BUTTON_SETUP_ZOOM); DrawTextRightButton(Def.ButtonGlyph.SetupZoom, MyResource.TX_BUTTON_SETUP_ZOOM);
DrawTextRightButton(Def.ButtonGlygh.SetupAccel, MyResource.TX_BUTTON_SETUP_ACCEL); DrawTextRightButton(Def.ButtonGlyph.SetupAccel, MyResource.TX_BUTTON_SETUP_ACCEL);
if (phase == Def.Phase.MainSetup) if (phase == Def.Phase.MainSetup)
{ {
string text = string.Format(MyResource.LoadString(MyResource.TX_BUTTON_SETUP_RESET), new string((char)(65 + gameData.SelectedGamer), 1)); string text = string.Format(MyResource.LoadString(MyResource.TX_BUTTON_SETUP_RESET), new string((char)(65 + gameData.SelectedGamer), 1));
DrawTextRightButton(Def.ButtonGlygh.SetupReset, text); DrawTextRightButton(Def.ButtonGlyph.SetupReset, text);
} }
} }
if (phase == Def.Phase.Trial) if (phase == Def.Phase.Trial)
@ -765,16 +775,16 @@ namespace WindowsPhoneSpeedyBlupi
Text.DrawText(pixmap, pos, MyResource.LoadString(MyResource.TX_TRIAL5), 0.7); Text.DrawText(pixmap, pos, MyResource.LoadString(MyResource.TX_TRIAL5), 0.7);
pos.Y += 25; pos.Y += 25;
Text.DrawText(pixmap, pos, MyResource.LoadString(MyResource.TX_TRIAL6), 0.7); Text.DrawText(pixmap, pos, MyResource.LoadString(MyResource.TX_TRIAL6), 0.7);
DrawTextUnderButton(Def.ButtonGlygh.TrialBuy, MyResource.TX_BUTTON_BUY); DrawTextUnderButton(Def.ButtonGlyph.TrialBuy, MyResource.TX_BUTTON_BUY);
DrawTextUnderButton(Def.ButtonGlygh.TrialCancel, MyResource.TX_BUTTON_BACK); DrawTextUnderButton(Def.ButtonGlyph.TrialCancel, MyResource.TX_BUTTON_BACK);
} }
if (phase == Def.Phase.Ranking) if (phase == Def.Phase.Ranking)
{ {
DrawTextUnderButton(Def.ButtonGlygh.RankingContinue, MyResource.TX_BUTTON_BACK); DrawTextUnderButton(Def.ButtonGlyph.RankingContinue, MyResource.TX_BUTTON_BACK);
} }
} }
private void DrawButtonGamerText(Def.ButtonGlygh glyph, int gamer) private void DrawButtonGamerText(Def.ButtonGlyph glyph, int gamer)
{ {
TinyRect buttonRect = inputPad.GetButtonRect(glyph); TinyRect buttonRect = inputPad.GetButtonRect(glyph);
int nbVies; int nbVies;
@ -782,45 +792,45 @@ namespace WindowsPhoneSpeedyBlupi
int secondaryDoors; int secondaryDoors;
gameData.GetGamerInfo(gamer, out nbVies, out mainDoors, out secondaryDoors); gameData.GetGamerInfo(gamer, out nbVies, out mainDoors, out secondaryDoors);
TinyPoint tinyPoint = default(TinyPoint); TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = buttonRect.Right + 5 - pixmap.Origin.X; tinyPoint.X = buttonRect.RightX + 5 - pixmap.Origin.X;
tinyPoint.Y = buttonRect.Top + 3 - pixmap.Origin.Y; tinyPoint.Y = buttonRect.TopY + 3 - pixmap.Origin.Y;
TinyPoint pos = tinyPoint; TinyPoint pos = tinyPoint;
string text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_TITLE), new string((char)(65 + gamer), 1)); string text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_TITLE), new string((char)(65 + gamer), 1));
Text.DrawText(pixmap, pos, text, 0.7); Text.DrawText(pixmap, pos, text, 0.7);
TinyPoint tinyPoint2 = default(TinyPoint); TinyPoint tinyPoint2 = default(TinyPoint);
tinyPoint2.X = buttonRect.Right + 5 - pixmap.Origin.X; tinyPoint2.X = buttonRect.RightX + 5 - pixmap.Origin.X;
tinyPoint2.Y = buttonRect.Top + 25 - pixmap.Origin.Y; tinyPoint2.Y = buttonRect.TopY + 25 - pixmap.Origin.Y;
pos = tinyPoint2; pos = tinyPoint2;
text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_MDOORS), mainDoors); text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_MDOORS), mainDoors);
Text.DrawText(pixmap, pos, text, 0.45); Text.DrawText(pixmap, pos, text, 0.45);
TinyPoint tinyPoint3 = default(TinyPoint); TinyPoint tinyPoint3 = default(TinyPoint);
tinyPoint3.X = buttonRect.Right + 5 - pixmap.Origin.X; tinyPoint3.X = buttonRect.RightX + 5 - pixmap.Origin.X;
tinyPoint3.Y = buttonRect.Top + 39 - pixmap.Origin.Y; tinyPoint3.Y = buttonRect.TopY + 39 - pixmap.Origin.Y;
pos = tinyPoint3; pos = tinyPoint3;
text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_SDOORS), secondaryDoors); text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_SDOORS), secondaryDoors);
Text.DrawText(pixmap, pos, text, 0.45); Text.DrawText(pixmap, pos, text, 0.45);
TinyPoint tinyPoint4 = default(TinyPoint); TinyPoint tinyPoint4 = default(TinyPoint);
tinyPoint4.X = buttonRect.Right + 5 - pixmap.Origin.X; tinyPoint4.X = buttonRect.RightX + 5 - pixmap.Origin.X;
tinyPoint4.Y = buttonRect.Top + 53 - pixmap.Origin.Y; tinyPoint4.Y = buttonRect.TopY + 53 - pixmap.Origin.Y;
pos = tinyPoint4; pos = tinyPoint4;
text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_LIFES), nbVies); text = string.Format(MyResource.LoadString(MyResource.TX_GAMER_LIFES), nbVies);
Text.DrawText(pixmap, pos, text, 0.45); Text.DrawText(pixmap, pos, text, 0.45);
} }
private void DrawTextRightButton(Def.ButtonGlygh glyph, int res) private void DrawTextRightButton(Def.ButtonGlyph glyph, int res)
{ {
DrawTextRightButton(glyph, MyResource.LoadString(res)); DrawTextRightButton(glyph, MyResource.LoadString(res));
} }
private void DrawTextRightButton(Def.ButtonGlygh glyph, string text) private void DrawTextRightButton(Def.ButtonGlyph glyph, string text)
{ {
TinyRect buttonRect = inputPad.GetButtonRect(glyph); TinyRect buttonRect = inputPad.GetButtonRect(glyph);
string[] array = text.Split('\n'); string[] array = text.Split('\n');
if (array.Length == 2) if (array.Length == 2)
{ {
TinyPoint tinyPoint = default(TinyPoint); TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = buttonRect.Right + 10 - pixmap.Origin.X; tinyPoint.X = buttonRect.RightX + 10 - pixmap.Origin.X;
tinyPoint.Y = (buttonRect.Top + buttonRect.Bottom) / 2 - 20 - pixmap.Origin.Y; tinyPoint.Y = (buttonRect.TopY + buttonRect.BottomY) / 2 - 20 - pixmap.Origin.Y;
TinyPoint pos = tinyPoint; TinyPoint pos = tinyPoint;
Text.DrawText(pixmap, pos, array[0], 0.7); Text.DrawText(pixmap, pos, array[0], 0.7);
pos.Y += 24; pos.Y += 24;
@ -829,19 +839,19 @@ namespace WindowsPhoneSpeedyBlupi
else else
{ {
TinyPoint tinyPoint2 = default(TinyPoint); TinyPoint tinyPoint2 = default(TinyPoint);
tinyPoint2.X = buttonRect.Right + 10 - pixmap.Origin.X; tinyPoint2.X = buttonRect.RightX + 10 - pixmap.Origin.X;
tinyPoint2.Y = (buttonRect.Top + buttonRect.Bottom) / 2 - 8 - pixmap.Origin.Y; tinyPoint2.Y = (buttonRect.TopY + buttonRect.BottomY) / 2 - 8 - pixmap.Origin.Y;
TinyPoint pos2 = tinyPoint2; TinyPoint pos2 = tinyPoint2;
Text.DrawText(pixmap, pos2, text, 0.7); Text.DrawText(pixmap, pos2, text, 0.7);
} }
} }
private void DrawTextUnderButton(Def.ButtonGlygh glyph, int res) private void DrawTextUnderButton(Def.ButtonGlyph glyph, int res)
{ {
TinyRect buttonRect = inputPad.GetButtonRect(glyph); TinyRect buttonRect = inputPad.GetButtonRect(glyph);
TinyPoint tinyPoint = default(TinyPoint); TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = (buttonRect.Left + buttonRect.Right) / 2 - pixmap.Origin.X; tinyPoint.X = (buttonRect.LeftX + buttonRect.RightX) / 2 - pixmap.Origin.X;
tinyPoint.Y = buttonRect.Bottom + 2 - pixmap.Origin.Y; tinyPoint.Y = buttonRect.BottomY + 2 - pixmap.Origin.Y;
TinyPoint pos = tinyPoint; TinyPoint pos = tinyPoint;
string text = MyResource.LoadString(res); string text = MyResource.LoadString(res);
Text.DrawTextCenter(pixmap, pos, text, 0.7); Text.DrawTextCenter(pixmap, pos, text, 0.7);
@ -963,5 +973,16 @@ namespace WindowsPhoneSpeedyBlupi
decor.MemorizeDoors(gameData); decor.MemorizeDoors(gameData);
gameData.Write(); gameData.Write();
} }
public void ToggleFullScreen()
{
this.graphics.ToggleFullScreen();
}
public bool IsFullScreen() { return this.graphics.IsFullScreen; }
public GraphicsDeviceManager getGraphics()
{
return graphics;
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -74,17 +74,17 @@ namespace WindowsPhoneSpeedyBlupi
if (!m_bHide) if (!m_bHide)
{ {
int num = m_level * 114 / 100; int num = m_level * 114 / 100;
rect.Left = 0; rect.LeftX = 0;
rect.Right = 124; rect.RightX = 124;
rect.Top = 0; rect.TopY = 0;
rect.Bottom = 22; rect.BottomY = 22;
m_pixmap.DrawPart(5, m_pos, rect, m_zoom); m_pixmap.DrawPart(5, m_pos, rect, m_zoom);
if (num > 0) if (num > 0)
{ {
rect.Left = 0; rect.LeftX = 0;
rect.Right = 6 + num; rect.RightX = 6 + num;
rect.Top = 22 * m_mode; rect.TopY = 22 * m_mode;
rect.Bottom = 22 * (m_mode + 1); rect.BottomY = 22 * (m_mode + 1);
m_pixmap.DrawPart(5, m_pos, rect, m_zoom); m_pixmap.DrawPart(5, m_pos, rect, m_zoom);
} }
} }

37
Misc.cs
View File

@ -1,8 +1,10 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Misc // WindowsPhoneSpeedyBlupi.Misc
using System; using System;
using System.Diagnostics;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using WindowsPhoneSpeedyBlupi; using WindowsPhoneSpeedyBlupi;
using static WindowsPhoneSpeedyBlupi.Def;
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
@ -75,49 +77,46 @@ namespace WindowsPhoneSpeedyBlupi
public static TinyRect Inflate(TinyRect rect, int value) public static TinyRect Inflate(TinyRect rect, int value)
{ {
TinyRect result = default(TinyRect); TinyRect result = default(TinyRect);
result.Left = rect.Left - value; result.LeftX = rect.LeftX - value;
result.Right = rect.Right + value; result.RightX = rect.RightX + value;
result.Top = rect.Top - value; result.TopY = rect.TopY - value;
result.Bottom = rect.Bottom + value; result.BottomY = rect.BottomY + value;
return result; return result;
} }
public static bool IsInside(TinyRect rect, TinyPoint p) public static bool IsInside(TinyRect rect, TinyPoint p)
{ {
if (p.X >= rect.Left && p.X <= rect.Right && p.Y >= rect.Top) return p.X >= rect.LeftX && p.X <= rect.RightX && p.Y >= rect.TopY && p.Y <= rect.BottomY;
{
return p.Y <= rect.Bottom;
}
return false;
} }
public static bool IntersectRect(out TinyRect dst, TinyRect src1, TinyRect src2) public static bool IntersectRect(out TinyRect dst, TinyRect src1, TinyRect src2)
{ {
dst = default(TinyRect); dst = default(TinyRect);
dst.Left = Math.Max(src1.Left, src2.Left); dst.LeftX = Math.Max(src1.LeftX, src2.LeftX);
dst.Right = Math.Min(src1.Right, src2.Right); dst.RightX = Math.Min(src1.RightX, src2.RightX);
dst.Top = Math.Max(src1.Top, src2.Top); dst.TopY = Math.Max(src1.TopY, src2.TopY);
dst.Bottom = Math.Min(src1.Bottom, src2.Bottom); dst.BottomY = Math.Min(src1.BottomY, src2.BottomY);
return !IsRectEmpty(dst); return !IsRectEmpty(dst);
} }
public static bool UnionRect(out TinyRect dst, TinyRect src1, TinyRect src2) public static bool UnionRect(out TinyRect dst, TinyRect src1, TinyRect src2)
{ {
dst = default(TinyRect); dst = default(TinyRect);
dst.Left = Math.Min(src1.Left, src2.Left); dst.LeftX = Math.Min(src1.LeftX, src2.LeftX);
dst.Right = Math.Max(src1.Right, src2.Right); dst.RightX = Math.Max(src1.RightX, src2.RightX);
dst.Top = Math.Min(src1.Top, src2.Top); dst.TopY = Math.Min(src1.TopY, src2.TopY);
dst.Bottom = Math.Max(src1.Bottom, src2.Bottom); dst.BottomY = Math.Max(src1.BottomY, src2.BottomY);
return !IsRectEmpty(dst); return !IsRectEmpty(dst);
} }
private static bool IsRectEmpty(TinyRect rect) private static bool IsRectEmpty(TinyRect rect)
{ {
if (rect.Left < rect.Right) if (rect.LeftX < rect.RightX)
{ {
return rect.Top >= rect.Bottom; return rect.TopY >= rect.BottomY;
} }
return true; return true;
} }
} }
} }

190
Pixmap.cs
View File

@ -1,10 +1,13 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Pixmap // WindowsPhoneSpeedyBlupi.Pixmap
using System; using System;
using System.Diagnostics;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using WindowsPhoneSpeedyBlupi; using WindowsPhoneSpeedyBlupi;
using static System.Net.Mime.MediaTypeNames; using static System.Net.Mime.MediaTypeNames;
using static WindowsPhoneSpeedyBlupi.Def;
using static WindowsPhoneSpeedyBlupi.Xna;
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
{ {
@ -63,26 +66,29 @@ namespace WindowsPhoneSpeedyBlupi
get get
{ {
TinyRect result = default(TinyRect); TinyRect result = default(TinyRect);
double num = graphics.GraphicsDevice.Viewport.Width; double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double num2 = graphics.GraphicsDevice.Viewport.Height; double screenHeight = graphics.GraphicsDevice.Viewport.Height;
if (num != 0.0 && num2 != 0.0) if(Env.PLATFORM == Platform.Android && screenHeight > 480) {
screenWidth = screenHeight * (640f / 480f);
}
if (screenWidth != 0.0 && screenHeight != 0.0)
{ {
double num3; double num3;
double num4; double num4;
if (num / num2 < 1.3333333333333333) if (screenWidth / screenHeight < 1.3333333333333333)
{ {
num3 = 640.0; num3 = 640.0;
num4 = 640.0 * (num2 / num); num4 = 640.0 * (screenHeight / screenWidth);
} }
else else
{ {
num3 = 480.0 * (num / num2); num3 = 480.0 * (screenWidth / screenHeight);
num4 = 480.0; num4 = 480.0;
} }
result.Left = 0; result.LeftX = 0;
result.Right = (int)num3; result.RightX = (int)num3;
result.Top = 0; result.TopY = 0;
result.Bottom = (int)num4; result.BottomY = (int)num4;
} }
return result; return result;
} }
@ -122,102 +128,102 @@ namespace WindowsPhoneSpeedyBlupi
hotSpotY = y; hotSpotY = y;
} }
public void DrawInputButton(TinyRect rect, Def.ButtonGlygh glyph, bool pressed, bool selected) public void DrawInputButton(TinyRect rect, Def.ButtonGlyph glyph, bool pressed, bool selected)
{ {
switch (glyph) switch (glyph)
{ {
case Def.ButtonGlygh.InitGamerA: case Def.ButtonGlyph.InitGamerA:
DrawIcon(14, selected ? 16 : 4, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, selected ? 16 : 4, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitGamerB: case Def.ButtonGlyph.InitGamerB:
DrawIcon(14, selected ? 17 : 5, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, selected ? 17 : 5, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitGamerC: case Def.ButtonGlyph.InitGamerC:
DrawIcon(14, selected ? 18 : 6, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, selected ? 18 : 6, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitSetup: case Def.ButtonGlyph.InitSetup:
case Def.ButtonGlygh.PauseSetup: case Def.ButtonGlyph.PauseSetup:
DrawIcon(14, 19, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 19, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitPlay: case Def.ButtonGlyph.InitPlay:
DrawIcon(14, 7, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 7, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.PauseMenu: case Def.ButtonGlyph.PauseMenu:
case Def.ButtonGlygh.ResumeMenu: case Def.ButtonGlyph.ResumeMenu:
DrawIcon(14, 11, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 11, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.PauseBack: case Def.ButtonGlyph.PauseBack:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.PauseRestart: case Def.ButtonGlyph.PauseRestart:
DrawIcon(14, 9, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 9, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.PauseContinue: case Def.ButtonGlyph.PauseContinue:
case Def.ButtonGlygh.ResumeContinue: case Def.ButtonGlyph.ResumeContinue:
DrawIcon(14, 10, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 10, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.WinLostReturn: case Def.ButtonGlyph.WinLostReturn:
DrawIcon(14, 3, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 3, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitBuy: case Def.ButtonGlyph.InitBuy:
case Def.ButtonGlygh.TrialBuy: case Def.ButtonGlyph.TrialBuy:
DrawIcon(14, 22, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 22, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.InitRanking: case Def.ButtonGlyph.InitRanking:
DrawIcon(14, 12, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 12, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.TrialCancel: case Def.ButtonGlyph.TrialCancel:
case Def.ButtonGlygh.RankingContinue: case Def.ButtonGlyph.RankingContinue:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.SetupSounds: case Def.ButtonGlyph.SetupSounds:
case Def.ButtonGlygh.SetupJump: case Def.ButtonGlyph.SetupJump:
case Def.ButtonGlygh.SetupZoom: case Def.ButtonGlyph.SetupZoom:
case Def.ButtonGlygh.SetupAccel: case Def.ButtonGlyph.SetupAccel:
DrawIcon(14, selected ? 13 : 21, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, selected ? 13 : 21, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.SetupReset: case Def.ButtonGlyph.SetupReset:
DrawIcon(14, 20, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 20, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.SetupReturn: case Def.ButtonGlyph.SetupReturn:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false); DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break; break;
case Def.ButtonGlygh.PlayJump: case Def.ButtonGlyph.PlayJump:
DrawIcon(14, 2, rect, pressed ? 0.6 : 1.0, false); DrawIcon(14, 2, rect, pressed ? 0.6 : 1.0, false);
break; break;
case Def.ButtonGlygh.PlayAction: case Def.ButtonGlyph.PlayAction:
DrawIcon(14, 12, rect, pressed ? 0.6 : 1.0, false); DrawIcon(14, 12, rect, pressed ? 0.6 : 1.0, false);
break; break;
case Def.ButtonGlygh.PlayDown: case Def.ButtonGlyph.PlayDown:
DrawIcon(14, 23, rect, pressed ? 0.6 : 1.0, false); DrawIcon(14, 23, rect, pressed ? 0.6 : 1.0, false);
break; break;
case Def.ButtonGlygh.PlayPause: case Def.ButtonGlyph.PlayPause:
DrawIcon(14, 3, rect, pressed ? 0.6 : 1.0, false); DrawIcon(14, 3, rect, pressed ? 0.6 : 1.0, false);
break; break;
case Def.ButtonGlygh.Cheat1: case Def.ButtonGlyph.Cheat1:
case Def.ButtonGlygh.Cheat2: case Def.ButtonGlyph.Cheat2:
case Def.ButtonGlygh.Cheat3: case Def.ButtonGlyph.Cheat3:
case Def.ButtonGlygh.Cheat4: case Def.ButtonGlyph.Cheat4:
case Def.ButtonGlygh.Cheat5: case Def.ButtonGlyph.Cheat5:
case Def.ButtonGlygh.Cheat6: case Def.ButtonGlyph.Cheat6:
case Def.ButtonGlygh.Cheat7: case Def.ButtonGlyph.Cheat7:
case Def.ButtonGlygh.Cheat8: case Def.ButtonGlyph.Cheat8:
case Def.ButtonGlygh.Cheat9: case Def.ButtonGlyph.Cheat9:
{ {
DrawIcon(14, 0, rect, pressed ? 0.6 : 1.0, false); DrawIcon(14, 0, rect, pressed ? 0.6 : 1.0, false);
TinyPoint tinyPoint = default(TinyPoint); TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = rect.Left + rect.Width / 2 - (int)originX; tinyPoint.X = rect.LeftX + rect.Width / 2 - (int)originX;
tinyPoint.Y = rect.Top + 28; tinyPoint.Y = rect.TopY + 28;
TinyPoint pos = tinyPoint; TinyPoint pos = tinyPoint;
Text.DrawTextCenter(this, pos, Decor.GetCheatTinyText(glyph), 1.0); Text.DrawTextCenter(this, pos, Decor.GetCheatTinyText(glyph), 1.0);
break; break;
} }
case Def.ButtonGlygh.Cheat11: case Def.ButtonGlyph.Cheat11:
case Def.ButtonGlygh.Cheat12: case Def.ButtonGlyph.Cheat12:
case Def.ButtonGlygh.Cheat21: case Def.ButtonGlyph.Cheat21:
case Def.ButtonGlygh.Cheat22: case Def.ButtonGlyph.Cheat22:
case Def.ButtonGlygh.Cheat31: case Def.ButtonGlyph.Cheat31:
case Def.ButtonGlygh.Cheat32: case Def.ButtonGlyph.Cheat32:
break; break;
} }
} }
@ -242,13 +248,17 @@ namespace WindowsPhoneSpeedyBlupi
private void UpdateGeometry() private void UpdateGeometry()
{ {
double num = graphics.GraphicsDevice.Viewport.Width; double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double num2 = graphics.GraphicsDevice.Viewport.Height; double screenHeight = graphics.GraphicsDevice.Viewport.Height;
double val = num / 640.0; if (Env.PLATFORM == Platform.Android && screenHeight > 480)
double val2 = num2 / 480.0; {
screenWidth = screenHeight * (640f / 480f);
}
double val = screenWidth / 640.0;
double val2 = screenHeight / 480.0;
zoom = Math.Min(val, val2); zoom = Math.Min(val, val2);
originX = (num - 640.0 * zoom) / 2.0; originX = (screenWidth - 640.0 * zoom) / 2.0;
originY = (num2 - 480.0 * zoom) / 2.0; originY = (screenHeight - 480.0 * zoom) / 2.0;
} }
public void BackgroundCache(string name) public void BackgroundCache(string name)
@ -269,11 +279,15 @@ namespace WindowsPhoneSpeedyBlupi
public void DrawBackground() public void DrawBackground()
{ {
double num = graphics.GraphicsDevice.Viewport.Width; double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double num2 = graphics.GraphicsDevice.Viewport.Height; double screenHeight = graphics.GraphicsDevice.Viewport.Height;
if (Env.PLATFORM == Platform.Android && screenHeight > 480)
{
screenWidth = screenHeight * (640f / 480f);
}
Texture2D bitmap = GetBitmap(3); Texture2D bitmap = GetBitmap(3);
Rectangle srcRectangle = GetSrcRectangle(bitmap, 10, 10, 10, 10, 0, 0); Rectangle srcRectangle = GetSrcRectangle(bitmap, 10, 10, 10, 10, 0, 0);
Rectangle destinationRectangle = new Rectangle(0, 0, (int)num, (int)num2); Rectangle destinationRectangle = new Rectangle(0, 0, (int)screenWidth, (int)screenHeight);
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(bitmap, destinationRectangle, srcRectangle, Color.White); spriteBatch.Draw(bitmap, destinationRectangle, srcRectangle, Color.White);
spriteBatch.End(); spriteBatch.End();
@ -282,10 +296,10 @@ namespace WindowsPhoneSpeedyBlupi
tinyPoint.Y = (int)originY; tinyPoint.Y = (int)originY;
TinyPoint dest = tinyPoint; TinyPoint dest = tinyPoint;
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = 0; tinyRect.LeftX = 0;
tinyRect.Top = 0; tinyRect.TopY = 0;
tinyRect.Right = 640; tinyRect.RightX = 640;
tinyRect.Bottom = 480; tinyRect.BottomY = 480;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
DrawPart(3, dest, rect); DrawPart(3, dest, rect);
} }
@ -295,10 +309,10 @@ namespace WindowsPhoneSpeedyBlupi
pos.X = (int)((double)pos.X + originX); pos.X = (int)((double)pos.X + originX);
pos.Y = (int)((double)pos.Y + originY); pos.Y = (int)((double)pos.Y + originY);
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = pos.X; tinyRect.LeftX = pos.X;
tinyRect.Top = pos.Y; tinyRect.TopY = pos.Y;
tinyRect.Right = pos.X + (int)(32.0 * size); tinyRect.RightX = pos.X + (int)(32.0 * size);
tinyRect.Bottom = pos.Y + (int)(32.0 * size); tinyRect.BottomY = pos.Y + (int)(32.0 * size);
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
DrawIcon(6, rank, rect, 1.0, false); DrawIcon(6, rank, rect, 1.0, false);
} }
@ -308,10 +322,10 @@ namespace WindowsPhoneSpeedyBlupi
pos.X = (int)((double)pos.X + originX); pos.X = (int)((double)pos.X + originX);
pos.Y = (int)((double)pos.Y + originY); pos.Y = (int)((double)pos.Y + originY);
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = pos.X; tinyRect.LeftX = pos.X;
tinyRect.Top = pos.Y; tinyRect.TopY = pos.Y;
tinyRect.Right = pos.X; tinyRect.RightX = pos.X;
tinyRect.Bottom = pos.Y; tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, 1.0, false); DrawIcon(channel, rank, rect, 1.0, false);
} }
@ -319,10 +333,10 @@ namespace WindowsPhoneSpeedyBlupi
public void QuickIcon(int channel, int rank, TinyPoint pos) public void QuickIcon(int channel, int rank, TinyPoint pos)
{ {
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = pos.X; tinyRect.LeftX = pos.X;
tinyRect.Top = pos.Y; tinyRect.TopY = pos.Y;
tinyRect.Right = pos.X; tinyRect.RightX = pos.X;
tinyRect.Bottom = pos.Y; tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, 1.0, true); DrawIcon(channel, rank, rect, 1.0, true);
} }
@ -330,10 +344,10 @@ namespace WindowsPhoneSpeedyBlupi
public void QuickIcon(int channel, int rank, TinyPoint pos, double opacity, double rotation) public void QuickIcon(int channel, int rank, TinyPoint pos, double opacity, double rotation)
{ {
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = pos.X; tinyRect.LeftX = pos.X;
tinyRect.Top = pos.Y; tinyRect.TopY = pos.Y;
tinyRect.Right = pos.X; tinyRect.RightX = pos.X;
tinyRect.Bottom = pos.Y; tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, opacity, rotation, true); DrawIcon(channel, rank, rect, opacity, rotation, true);
} }
@ -355,7 +369,7 @@ namespace WindowsPhoneSpeedyBlupi
dest.X = (int)((double)dest.X + originX); dest.X = (int)((double)dest.X + originX);
dest.Y = (int)((double)dest.Y + originY); dest.Y = (int)((double)dest.Y + originY);
} }
Rectangle value = new Rectangle(rect.Left, rect.Top, rect.Width, rect.Height); Rectangle value = new Rectangle(rect.LeftX, rect.TopY, rect.Width, rect.Height);
Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y, (int)((double)rect.Width * zoom), (int)((double)rect.Height * zoom)); Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y, (int)((double)rect.Width * zoom), (int)((double)rect.Height * zoom));
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(bitmap, destinationRectangle, value, Color.White); spriteBatch.Draw(bitmap, destinationRectangle, value, Color.White);
@ -498,8 +512,8 @@ namespace WindowsPhoneSpeedyBlupi
{ {
int num = ((rect.Width == 0) ? iconWidth : rect.Width); int num = ((rect.Width == 0) ? iconWidth : rect.Width);
int num2 = ((rect.Height == 0) ? iconHeight : rect.Height); int num2 = ((rect.Height == 0) ? iconHeight : rect.Height);
int num3 = (int)((double)rect.Left * zoom); int num3 = (int)((double)rect.LeftX * zoom);
int num4 = (int)((double)rect.Top * zoom); int num4 = (int)((double)rect.TopY * zoom);
int num5 = (int)((double)num3 + (double)num * zoom); int num5 = (int)((double)num3 + (double)num * zoom);
int num6 = (int)((double)num4 + (double)num2 * zoom); int num6 = (int)((double)num4 + (double)num2 * zoom);
if (useHotSpot && hotSpotZoom > 1.0) if (useHotSpot && hotSpotZoom > 1.0)

View File

@ -1,2 +0,0 @@
using var game = new Speedy_Blupi.Game1();
game.Run();

View File

@ -6,11 +6,10 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Resources; using System.Resources;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using WindowsPhoneSpeedyBlupi;
[DebuggerNonUserCode] //[DebuggerNonUserCode]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] //[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[CompilerGenerated] //[CompilerGenerated]
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
{ {
@ -25,7 +24,7 @@ namespace WindowsPhoneSpeedyBlupi
{ {
get get
{ {
if (object.ReferenceEquals(resourceMan, null)) if (ReferenceEquals(resourceMan, null))
{ {
ResourceManager resourceManager = new ResourceManager("WindowsPhoneSpeedyBlupi.Resource", typeof(Resource).Assembly); ResourceManager resourceManager = new ResourceManager("WindowsPhoneSpeedyBlupi.Resource", typeof(Resource).Assembly);
resourceMan = resourceManager; resourceMan = resourceManager;

View File

@ -1,12 +1,16 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Slider // WindowsPhoneSpeedyBlupi.Slider
using System; using System;
using WindowsPhoneSpeedyBlupi;
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
{ {
public class Slider public class Slider
{ {
public Slider(TinyPoint topLeftCorner, double value) {
TopLeftCorner = topLeftCorner;
value = Value;
}
public TinyPoint TopLeftCorner { get; set; } public TinyPoint TopLeftCorner { get; set; }
public double Value { get; set; } public double Value { get; set; }
@ -34,34 +38,34 @@ namespace WindowsPhoneSpeedyBlupi
tinyPoint.Y = TopLeftCorner.Y - pixmap.Origin.Y; tinyPoint.Y = TopLeftCorner.Y - pixmap.Origin.Y;
TinyPoint dest = tinyPoint; TinyPoint dest = tinyPoint;
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = 0; tinyRect.LeftX = 0;
tinyRect.Right = 124; tinyRect.RightX = 124;
tinyRect.Top = 0; tinyRect.TopY = 0;
tinyRect.Bottom = 22; tinyRect.BottomY = 22;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
pixmap.DrawPart(5, dest, rect, 2.0); pixmap.DrawPart(5, dest, rect, 2.0);
int num = (int)((double)(PosRight - PosLeft) * Value); int num = (int)((double)(PosRight - PosLeft) * Value);
int num2 = TopLeftCorner.Y + 22; int num2 = TopLeftCorner.Y + 22;
int num3 = 94; int num3 = 94;
TinyRect tinyRect2 = default(TinyRect); TinyRect tinyRect2 = default(TinyRect);
tinyRect2.Left = PosLeft + num - num3 / 2; tinyRect2.LeftX = PosLeft + num - num3 / 2;
tinyRect2.Right = PosLeft + num + num3 / 2; tinyRect2.RightX = PosLeft + num + num3 / 2;
tinyRect2.Top = num2 - num3 / 2; tinyRect2.TopY = num2 - num3 / 2;
tinyRect2.Bottom = num2 + num3 / 2; tinyRect2.BottomY = num2 + num3 / 2;
rect = tinyRect2; rect = tinyRect2;
pixmap.DrawIcon(14, 1, rect, 1.0, false); pixmap.DrawIcon(14, 1, rect, 1.0, false);
TinyRect tinyRect3 = default(TinyRect); TinyRect tinyRect3 = default(TinyRect);
tinyRect3.Left = TopLeftCorner.X - 65; tinyRect3.LeftX = TopLeftCorner.X - 65;
tinyRect3.Right = TopLeftCorner.X - 65 + 60; tinyRect3.RightX = TopLeftCorner.X - 65 + 60;
tinyRect3.Top = TopLeftCorner.Y - 10; tinyRect3.TopY = TopLeftCorner.Y - 10;
tinyRect3.Bottom = TopLeftCorner.Y - 10 + 60; tinyRect3.BottomY = TopLeftCorner.Y - 10 + 60;
rect = tinyRect3; rect = tinyRect3;
pixmap.DrawIcon(10, 37, rect, 1.0, false); pixmap.DrawIcon(10, 37, rect, 1.0, false);
TinyRect tinyRect4 = default(TinyRect); TinyRect tinyRect4 = default(TinyRect);
tinyRect4.Left = TopLeftCorner.X + 248 + 5; tinyRect4.LeftX = TopLeftCorner.X + 248 + 5;
tinyRect4.Right = TopLeftCorner.X + 248 + 5 + 60; tinyRect4.RightX = TopLeftCorner.X + 248 + 5 + 60;
tinyRect4.Top = TopLeftCorner.Y - 10; tinyRect4.TopY = TopLeftCorner.Y - 10;
tinyRect4.Bottom = TopLeftCorner.Y - 10 + 60; tinyRect4.BottomY = TopLeftCorner.Y - 10 + 60;
rect = tinyRect4; rect = tinyRect4;
pixmap.DrawIcon(10, 38, rect, 1.0, false); pixmap.DrawIcon(10, 38, rect, 1.0, false);
} }
@ -69,10 +73,10 @@ namespace WindowsPhoneSpeedyBlupi
public bool Move(TinyPoint pos) public bool Move(TinyPoint pos)
{ {
TinyRect tinyRect = default(TinyRect); TinyRect tinyRect = default(TinyRect);
tinyRect.Left = TopLeftCorner.X - 50; tinyRect.LeftX = TopLeftCorner.X - 50;
tinyRect.Right = TopLeftCorner.X + 248 + 50; tinyRect.RightX = TopLeftCorner.X + 248 + 50;
tinyRect.Top = TopLeftCorner.Y - 50; tinyRect.TopY = TopLeftCorner.Y - 50;
tinyRect.Bottom = TopLeftCorner.Y + 44 + 50; tinyRect.BottomY = TopLeftCorner.Y + 44 + 50;
TinyRect rect = tinyRect; TinyRect rect = tinyRect;
if (Misc.IsInside(rect, pos)) if (Misc.IsInside(rect, pos))
{ {

View File

@ -9,6 +9,11 @@ namespace WindowsPhoneSpeedyBlupi
public int Y; public int Y;
public TinyPoint(int x, int y)
{
X = x; Y = y;
}
public override string ToString() public override string ToString()
{ {
return string.Format("{0};{1}", X, Y); return string.Format("{0};{1}", X, Y);

View File

@ -5,19 +5,27 @@ namespace WindowsPhoneSpeedyBlupi
{ {
public struct TinyRect public struct TinyRect
{ {
public int Left; public int LeftX;
public int Right; public int RightX;
public int Top; public int TopY;
public int Bottom; public int BottomY;
public TinyRect(int leftX, int rightX, int topY, int bottomY)
{
LeftX = leftX;
RightX = rightX;
TopY = topY;
BottomY = bottomY;
}
public int Width public int Width
{ {
get get
{ {
return Right - Left; return RightX - LeftX;
} }
} }
@ -25,13 +33,13 @@ namespace WindowsPhoneSpeedyBlupi
{ {
get get
{ {
return Bottom - Top; return BottomY - TopY;
} }
} }
public override string ToString() public override string ToString()
{ {
return string.Format("{0};{1};{2};{3}", Left, Top, Right, Bottom); return string.Format("{0};{1};{2};{3}", LeftX, TopY, RightX, BottomY);
} }
} }

View File

@ -1,6 +1,7 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Worlds // WindowsPhoneSpeedyBlupi.Worlds
using System; using System;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.IO.IsolatedStorage; using System.IO.IsolatedStorage;
@ -41,14 +42,17 @@ namespace WindowsPhoneSpeedyBlupi
text = streamReader.ReadToEnd(); text = streamReader.ReadToEnd();
stream.Close(); stream.Close();
} }
catch catch (Exception e)
{ {
Debug.Write(e.Message);
Debug.Write("Fatal error. Loading world failed: " + worldFilename + "\n");
//Environment.Exit(1);
} }
if (text == null) if (text == null)
{ {
return null; return null;
} }
return text.Split('\n'); return text.Split("\n");
} }
private static string GetWorldFilename(int gamer, int rank) private static string GetWorldFilename(int gamer, int rank)
@ -271,38 +275,38 @@ namespace WindowsPhoneSpeedyBlupi
int num = text.IndexOf(name + "="); int num = text.IndexOf(name + "=");
if (num == -1) if (num == -1)
{ {
return default(TinyPoint); return default;
} }
num += name.Length + 1; num += name.Length + 1;
int num2 = text.IndexOf(";", num); int num2 = text.IndexOf(";", num);
if (num2 == -1) if (num2 == -1)
{ {
return default(TinyPoint); return default;
} }
int num3 = text.IndexOf(" ", num); int num3 = text.IndexOf(" ", num);
if (num3 == -1) if (num3 == -1)
{ {
return default(TinyPoint); return default;
} }
string s = text.Substring(num, num2 - num); string s = text.Substring(num, num2 - num);
string s2 = text.Substring(num2 + 1, num3 - num2 - 1); string s2 = text.Substring(num2 + 1, num3 - num2 - 1);
int result; int result;
if (!int.TryParse(s, out result)) if (!int.TryParse(s, out result))
{ {
return default(TinyPoint); return default;
} }
int result2; int result2;
if (!int.TryParse(s2, out result2)) if (!int.TryParse(s2, out result2))
{ {
return default(TinyPoint); return default;
} }
TinyPoint result3 = default(TinyPoint); TinyPoint result3 = default;
result3.X = result; result3.X = result;
result3.Y = result2; result3.Y = result2;
return result3; return result3;
} }
} }
return default(TinyPoint); return default;
} }
public static int? GetDecorField(string[] lines, string section, int x, int y) public static int? GetDecorField(string[] lines, string section, int x, int y)

61
Xna.cs Normal file
View File

@ -0,0 +1,61 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Def
using static WindowsPhoneSpeedyBlupi.Xna;
namespace WindowsPhoneSpeedyBlupi
{
public static class Xna
{
public enum Platform
{
Desktop,
Android,
iOS,
Web
}
public enum XnaImpl
{
MonoGame = ProgrammingLanguage.CSharp,
Fna = ProgrammingLanguage.CSharp,
Kni = ProgrammingLanguage.CSharp,
JXNA = ProgrammingLanguage.Java,
JSXN = ProgrammingLanguage.JavaScript
}
public enum ProgrammingLanguage
{
CSharp,
Java,
JavaScript
}
}
public static class Extensions
{
public static ProgrammingLanguage getProgrammingLanguage(this XnaImpl xnaImpl)
{
return (ProgrammingLanguage)((int)xnaImpl);
}
public static bool isDesktop(this Platform platform)
{
return platform == Platform.Desktop;
}
public static bool isAndroid(this Platform platform)
{
return platform == Platform.Android;
}
public static bool isIOS(this Platform platform)
{
return platform == Platform.iOS;
}
public static bool isWeb(this Platform platform)
{
return platform == Platform.Web;
}
}
}