Compare commits

...

10 Commits

21 changed files with 19087 additions and 0 deletions

22
DDebug.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Diagnostics;
namespace WindowsPhoneSpeedyBlupi
{
public static class DDebug
{
private static bool detailedDebugging = false;
private static bool DetailedDebugging
{
get { return detailedDebugging; }
set { detailedDebugging = value; }
}
public static void WriteLine(String msg)
{
if (detailedDebugging)
{
Debug.WriteLine(msg);
}
}
}
}

10597
Decor.cs Normal file

File diff suppressed because it is too large Load Diff

703
Def.cs Normal file
View File

@ -0,0 +1,703 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Def
using Microsoft.Xna.Framework.Input;
using static WindowsPhoneSpeedyBlupi.Def;
namespace WindowsPhoneSpeedyBlupi
{
public static class Def
{
public enum Phase
{
None,
First,
Wait,
Init,
Play,
Pause,
Lost,
Win,
Trial,
MainSetup,
PlaySetup,
Resume,
Ranking
}
public enum ButtonGlyph
{
None,
InitGamerA,
InitGamerB,
InitGamerC,
InitSetup,
InitPlay,
InitBuy,
InitRanking,
WinLostReturn,
TrialBuy,
TrialCancel,
SetupSounds,
SetupJump,
SetupZoom,
SetupAccel,
SetupReset,
SetupReturn,
PauseMenu,
PauseBack,
PauseSetup,
PauseRestart,
PauseContinue,
PlayPause,
PlayJump,
PlayAction,
PlayDown,
ResumeMenu,
ResumeContinue,
RankingContinue,
Cheat11,
Cheat12,
Cheat21,
Cheat22,
Cheat31,
Cheat32,
Cheat1,
Cheat2,
Cheat3,
Cheat4,
Cheat5,
Cheat6,
Cheat7,
Cheat8,
Cheat9
}
public const int LXIMAGE = 640;
public const int LYIMAGE = 480;
public const int MAXCELX = 100;
public const int MAXCELY = 100;
public const int DIMOBJX = 64;
public const int DIMOBJY = 64;
public const int DIMBLUPIX = 60;
public const int DIMBLUPIY = 60;
public const int DIMEXPLOX = 128;
public const int DIMEXPLOY = 128;
public const int DIMBUTTONX = 40;
public const int DIMBUTTONY = 40;
public const int DIMJAUGEX = 124;
public const int DIMJAUGEY = 22;
public const int POSSTATX = 12;
public const int POSSTATY = 220;
public const int DIMSTATX = 60;
public const int DIMSTATY = 30;
public const int DIMTEXTX = 32;
public const int DIMTEXTY = 32;
public const int CHOBJECT = 1;
public const int CHBLUPI = 2;
public const int CHDECOR = 3;
public const int CHBUTTON = 4;
public const int CHJAUGE = 5;
public const int CHTEXT = 6;
public const int CHEXPLO = 9;
public const int CHELEMENT = 10;
public const int CHBLUPI1 = 11;
public const int CHBLUPI2 = 12;
public const int CHBLUPI3 = 13;
public const int CHPAD = 14;
public const int CHSPEEDYBLUPI = 15;
public const int CHBLUPIYOUPIE = 16;
public const int CHGEAR = 17;
public const int ACTION_STOP = 1;
public const int ACTION_MARCH = 2;
public const int ACTION_TURN = 3;
public const int ACTION_JUMP = 4;
public const int ACTION_AIR = 5;
public const int ACTION_DOWN = 6;
public const int ACTION_UP = 7;
public const int ACTION_VERTIGO = 8;
public const int ACTION_RECEDE = 9;
public const int ACTION_ADVANCE = 10;
public const int ACTION_CLEAR1 = 11;
public const int ACTION_SET = 12;
public const int ACTION_WIN = 13;
public const int ACTION_PUSH = 14;
public const int ACTION_STOPHELICO = 15;
public const int ACTION_MARCHHELICO = 16;
public const int ACTION_TURNHELICO = 17;
public const int ACTION_STOPNAGE = 18;
public const int ACTION_MARCHNAGE = 19;
public const int ACTION_TURNNAGE = 20;
public const int ACTION_STOPSURF = 21;
public const int ACTION_MARCHSURF = 22;
public const int ACTION_TURNSURF = 23;
public const int ACTION_DROWN = 24;
public const int ACTION_STOPJEEP = 25;
public const int ACTION_MARCHJEEP = 26;
public const int ACTION_TURNJEEP = 27;
public const int ACTION_STOPPOP = 28;
public const int ACTION_POP = 29;
public const int ACTION_BYE = 30;
public const int ACTION_STOPSUSPEND = 31;
public const int ACTION_MARCHSUSPEND = 32;
public const int ACTION_TURNSUSPEND = 33;
public const int ACTION_JUMPSUSPEND = 34;
public const int ACTION_HIDE = 35;
public const int ACTION_JUMPAIE = 36;
public const int ACTION_STOPSKATE = 37;
public const int ACTION_MARCHSKATE = 38;
public const int ACTION_TURNSKATE = 39;
public const int ACTION_JUMPSKATE = 40;
public const int ACTION_AIRSKATE = 41;
public const int ACTION_TAKESKATE = 42;
public const int ACTION_DEPOSESKATE = 43;
public const int ACTION_OUF1a = 44;
public const int ACTION_OUF1b = 45;
public const int ACTION_OUF2 = 46;
public const int ACTION_OUF3 = 47;
public const int ACTION_OUF4 = 48;
public const int ACTION_SUCETTE = 49;
public const int ACTION_STOPTANK = 50;
public const int ACTION_MARCHTANK = 51;
public const int ACTION_TURNTANK = 52;
public const int ACTION_FIRETANK = 53;
public const int ACTION_GLU = 54;
public const int ACTION_DRINK = 55;
public const int ACTION_CHARGE = 56;
public const int ACTION_ELECTRO = 57;
public const int ACTION_HELICOGLU = 58;
public const int ACTION_TURNAIR = 59;
public const int ACTION_STOPMARCH = 60;
public const int ACTION_STOPJUMP = 61;
public const int ACTION_STOPJUMPh = 62;
public const int ACTION_MOCKERY = 63;
public const int ACTION_MOCKERYi = 64;
public const int ACTION_OUF5 = 65;
public const int ACTION_BALLOON = 66;
public const int ACTION_STOPOVER = 67;
public const int ACTION_MARCHOVER = 68;
public const int ACTION_TURNOVER = 69;
public const int ACTION_RECEDEq = 70;
public const int ACTION_ADVANCEq = 71;
public const int ACTION_STOPECRASE = 72;
public const int ACTION_MARCHECRASE = 73;
public const int ACTION_TELEPORTE = 74;
public const int ACTION_CLEAR2 = 75;
public const int ACTION_CLEAR3 = 76;
public const int ACTION_CLEAR4 = 77;
public const int ACTION_CLEAR5 = 78;
public const int ACTION_CLEAR6 = 79;
public const int ACTION_CLEAR7 = 80;
public const int ACTION_CLEAR8 = 81;
public const int ACTION_SWITCH = 82;
public const int ACTION_MOCKERYp = 83;
public const int ACTION_NON = 84;
public const int ACTION_SLOWDOWNSKATE = 85;
public const int ACTION_TAKEDYNAMITE = 86;
public const int ACTION_PUTDYNAMITE = 87;
public const int DIR_LEFT = 1;
public const int DIR_RIGHT = 2;
public const int SEC_SHIELD = 1;
public const int SEC_POWER = 2;
public const int SEC_CLOUD = 3;
public const int SEC_HIDE = 4;
public const int TYPE_ASCENSEUR = 1;
public const int TYPE_BOMBEDOWN = 2;
public const int TYPE_BOMBEUP = 3;
public const int TYPE_BULLDOZER = 4;
public const int TYPE_TRESOR = 5;
public const int TYPE_EGG = 6;
public const int TYPE_GOAL = 7;
public const int TYPE_EXPLO1 = 8;
public const int TYPE_EXPLO2 = 9;
public const int TYPE_EXPLO3 = 10;
public const int TYPE_EXPLO4 = 11;
public const int TYPE_CAISSE = 12;
public const int TYPE_HELICO = 13;
public const int TYPE_PLOUF = 14;
public const int TYPE_BLUP = 15;
public const int TYPE_BOMBEMOVE = 16;
public const int TYPE_POISSON = 17;
public const int TYPE_TOMATES = 18;
public const int TYPE_JEEP = 19;
public const int TYPE_OISEAU = 20;
public const int TYPE_CLE = 21;
public const int TYPE_DOOR = 22;
public const int TYPE_BALLE = 23;
public const int TYPE_SKATE = 24;
public const int TYPE_SHIELD = 25;
public const int TYPE_POWER = 26;
public const int TYPE_MAGICTRACK = 27;
public const int TYPE_TANK = 28;
public const int TYPE_BULLET = 29;
public const int TYPE_DRINK = 30;
public const int TYPE_CHARGE = 31;
public const int TYPE_BLUPIHELICO = 32;
public const int TYPE_BLUPITANK = 33;
public const int TYPE_GLU = 34;
public const int TYPE_TIPLOUF = 35;
public const int TYPE_POLLUTION = 36;
public const int TYPE_CLEAR = 37;
public const int TYPE_ELECTRO = 38;
public const int TYPE_TRESORTRACK = 39;
public const int TYPE_INVERT = 40;
public const int TYPE_INVERTSTART = 41;
public const int TYPE_INVERTSTOP = 42;
public const int TYPE_GUEPE = 44;
public const int TYPE_OVER = 46;
public const int TYPE_ASCENSEURs = 47;
public const int TYPE_ASCENSEURsi = 48;
public const int TYPE_CLE1 = 49;
public const int TYPE_CLE2 = 50;
public const int TYPE_CLE3 = 51;
public const int TYPE_BRIDGE = 52;
public const int TYPE_TENTACULE = 53;
public const int TYPE_CREATURE = 54;
public const int TYPE_DYNAMITE = 55;
public const int TYPE_DYNAMITEf = 56;
public const int TYPE_SHIELDTRACK = 57;
public const int TYPE_HIDETRACK = 58;
public const int TYPE_EXPLO5 = 90;
public const int TYPE_EXPLO6 = 91;
public const int TYPE_EXPLO7 = 92;
public const int TYPE_EXPLO8 = 93;
public const int TYPE_EXPLO9 = 94;
public const int TYPE_EXPLO10 = 95;
public const int TYPE_BOMBEFOLLOW1 = 96;
public const int TYPE_BOMBEFOLLOW2 = 97;
public const int TYPE_SPLOUTCH1 = 98;
public const int TYPE_SPLOUTCH2 = 99;
public const int TYPE_SPLOUTCH3 = 100;
public const int TYPE_BOMBEPERSO1 = 200;
public const int TYPE_BOMBEPERSO2 = 201;
public const int TYPE_BOMBEPERSO3 = 202;
public const int TYPE_BOMBEPERSO4 = 203;
public const int STEP_STOPSTART = 1;
public const int STEP_ADVANCE = 2;
public const int STEP_STOPEND = 3;
public const int STEP_RECEDE = 4;
public const int DECOR_EXPLO1 = 1;
public const int DECOR_EXPLO2 = 2;
public const int DECOR_EXPLO3 = 3;
public const int DECOR_EXPLO4 = 4;
public const int DECOR_BALLOON = 5;
public const int SOUND_CLICK = 0;
public const int SOUND_JUMP1 = 1;
public const int SOUND_JUMP2 = 2;
public const int SOUND_JUMPEND = 3;
public const int SOUND_JUMPTOC = 4;
public const int SOUND_TURN = 5;
public const int SOUND_VERTIGO = 6;
public const int SOUND_DOWN = 7;
public const int SOUND_FALL = 8;
public const int SOUND_NEW = 9;
public const int SOUND_BOUM = 10;
public const int SOUND_TRESOR = 11;
public const int SOUND_EGG = 12;
public const int SOUND_ENDKO = 13;
public const int SOUND_ENDOK = 14;
public const int SOUND_HELICOSTART = 15;
public const int SOUND_HELICOHIGH = 16;
public const int SOUND_HELICOSTOP = 17;
public const int SOUND_HELICOLOW = 18;
public const int SOUND_LASTTRESOR = 19;
public const int SOUND_UP = 20;
public const int SOUND_LOOKUP = 21;
public const int SOUND_JUMP0 = 22;
public const int SOUND_PLOUF = 23;
public const int SOUND_BLUP = 24;
public const int SOUND_SURF = 25;
public const int SOUND_DROWN = 26;
public const int SOUND_ERROR = 27;
public const int SOUND_JEEPSTART = 28;
public const int SOUND_JEEPHIGH = 29;
public const int SOUND_JEEPSTOP = 30;
public const int SOUND_JEEPLOW = 31;
public const int SOUND_BYE = 32;
public const int SOUND_DOOR = 33;
public const int SOUND_SUSPENDTOC = 34;
public const int SOUND_SUSPENDJUMP = 35;
public const int SOUND_SINGE = 36;
public const int SOUND_PATIENT = 37;
public const int SOUND_PUSH = 38;
public const int SOUND_POP = 39;
public const int SOUND_JUMPAIE = 40;
public const int SOUND_RESSORT = 41;
public const int SOUND_STARTSHIELD = 42;
public const int SOUND_STOPSHIELD = 43;
public const int SOUND_STARTPOWER = 44;
public const int SOUND_STOPPOWER = 45;
public const int SOUND_OUF1 = 46;
public const int SOUND_OUF2 = 47;
public const int SOUND_OUF3 = 48;
public const int SOUND_OUF4 = 49;
public const int SOUND_SUCETTE = 50;
public const int SOUND_GLU = 51;
public const int SOUND_FIREOK = 52;
public const int SOUND_FIREKO = 53;
public const int SOUND_TAKEGLU = 54;
public const int SOUND_STARTCLOUD = 55;
public const int SOUND_STOPCLOUD = 56;
public const int SOUND_DRINK = 57;
public const int SOUND_CHARGE = 58;
public const int SOUND_ELECTRO = 59;
public const int SOUND_PERSOTAKE = 60;
public const int SOUND_PERSOPOSE = 61;
public const int SOUND_STARTHIDE = 62;
public const int SOUND_STOPHIDE = 63;
public const int SOUND_TIPLOUF = 64;
public const int SOUND_MOCKERY = 65;
public const int SOUND_INVERTSTART = 66;
public const int SOUND_INVERTSTOP = 67;
public const int SOUND_OVERSTOP = 68;
public const int SOUND_BLITZ = 69;
public const int SOUND_ECRASE = 70;
public const int SOUND_TELEPORTE = 71;
public const int SOUND_BRIDGE1 = 72;
public const int SOUND_BRIDGE2 = 73;
public const int SOUND_ANGEL = 74;
public const int SOUND_SCIE = 75;
public const int SOUND_SWITCHOFF = 76;
public const int SOUND_SWITCHON = 77;
public const int SOUND_JUMPENDb = 78;
public const int SOUND_JUMPTOCb = 79;
public const int SOUND_JUMPENDm = 80;
public const int SOUND_JUMPTOCm = 81;
public const int SOUND_JUMPENDg = 82;
public const int SOUND_JUMPTOCg = 83;
public const int SOUND_JUMPENDo = 84;
public const int SOUND_JUMPTOCo = 85;
public const int SOUND_JUMPENDk = 86;
public const int SOUND_JUMPTOCk = 87;
public const int SOUND_JUMPENDf = 88;
public const int SOUND_JUMPTOCf = 89;
public const int SOUND_JUMPENDh = 90;
public const int SOUND_JUMPTOCh = 91;
public const int SOUND_FOLLOW = 92;
public const int KEY_JUMP = 1;
public const int KEY_FIRE = 2;
public const int KEY_DOWN = 4;
public static bool HasSound
{
get
{
return true;
}
}
public static bool EasyMove
{
get
{
return true;
}
}
}
}

24
Env.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.Diagnostics;
using static WindowsPhoneSpeedyBlupi.EnvClasses;
namespace WindowsPhoneSpeedyBlupi
{
public static class Env
{
public static Platform PLATFORM { get; private set; }
public static Impl IMPL { get; private set; }
public static bool INITIALIZED { get; private set; }
public static void init(Impl impl, Platform platformIn)
{
if(INITIALIZED)
{
throw new Exception("Env was already initialized. Cannot call the init method again.");
}
IMPL = impl;
PLATFORM = platformIn;
INITIALIZED = true;
}
}
}

132
EnvClasses.cs Normal file
View File

@ -0,0 +1,132 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Def
using static WindowsPhoneSpeedyBlupi.EnvClasses;
namespace WindowsPhoneSpeedyBlupi
{
public static class EnvClasses
{
public enum Platform
{
Desktop,
Android,
iOS,
Web
}
public enum Impl
{
MonoGame,
FNA,
KNI,
JXNA,
JSXNA
}
public enum ProgrammingLanguage
{
CSharp,
Java,
JavaScript
}
}
public static class Extensions
{
public static ProgrammingLanguage getProgrammingLanguage(this Impl impl)
{
switch (impl)
{
case Impl.MonoGame: return ProgrammingLanguage.CSharp;
case Impl.FNA: return ProgrammingLanguage.CSharp;
case Impl.KNI: return ProgrammingLanguage.CSharp;
case Impl.JXNA: return ProgrammingLanguage.Java;
case Impl.JSXNA: return ProgrammingLanguage.JavaScript;
default: throw new System.Exception("Unsupported Impl: " + impl);
}
}
public static bool isMonoGame(this Impl impl)
{
return impl == Impl.MonoGame;
}
public static bool isFNA(this Impl impl)
{
return impl == Impl.FNA;
}
public static bool isKNI(this Impl impl)
{
return impl == Impl.KNI;
}
public static bool isJXNA(this Impl impl)
{
return impl == Impl.JXNA;
}
public static bool isJSXNA(this Impl impl)
{
return impl == Impl.JSXNA;
}
public static bool isNotMonoGame(this Impl impl)
{
return impl != Impl.MonoGame;
}
public static bool isNotFNA(this Impl impl)
{
return impl != Impl.FNA;
}
public static bool isNotKNI(this Impl impl)
{
return impl != Impl.KNI;
}
public static bool isNotJXNA(this Impl impl)
{
return impl != Impl.JXNA;
}
public static bool isNotJSXNA(this Impl impl)
{
return impl != Impl.JSXNA;
}
//
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;
}
public static bool isNotDesktop(this Platform platform)
{
return platform != Platform.Desktop;
}
public static bool isNotAndroid(this Platform platform)
{
return platform != Platform.Android;
}
public static bool isNotIOS(this Platform platform)
{
return platform != Platform.iOS;
}
public static bool isNotWeb(this Platform platform)
{
return platform != Platform.Web;
}
}
}

1009
Game1.cs Normal file

File diff suppressed because it is too large Load Diff

220
GameData.cs Normal file
View File

@ -0,0 +1,220 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.GameData
using System;
using WindowsPhoneSpeedyBlupi;
namespace WindowsPhoneSpeedyBlupi
{
public class GameData
{
private static readonly int HeaderLength = 10;
private static readonly int DoorsLength = 200;
private static readonly int GamerLength = 10 + DoorsLength;
private static readonly int MaxGamer = 3;
private static readonly int TotalLength = HeaderLength + GamerLength * MaxGamer;
private readonly byte[] data;
public int SelectedGamer
{
get
{
return data[2];
}
set
{
data[2] = (byte)value;
}
}
public bool Sounds
{
get
{
return data[3] == 1;
}
set
{
data[3] = (byte)(value ? 1u : 0u);
}
}
public bool JumpRight
{
get
{
return data[4] == 1;
}
set
{
data[4] = (byte)(value ? 1u : 0u);
}
}
public bool AutoZoom
{
get
{
return data[5] == 1;
}
set
{
data[5] = (byte)(value ? 1u : 0u);
}
}
public bool AccelActive
{
get
{
return data[6] == 1;
}
set
{
data[6] = (byte)(value ? 1u : 0u);
}
}
public double AccelSensitivity
{
get
{
return (double)(int)data[7] / 100.0;
}
set
{
value = Math.Max(value, 0.0);
value = Math.Min(value, 1.0);
data[7] = (byte)(value * 100.0);
}
}
public int NbVies
{
get
{
return data[GamerOffset];
}
set
{
data[GamerOffset] = (byte)value;
}
}
public int LastWorld
{
get
{
return data[GamerOffset + 1];
}
set
{
data[GamerOffset + 1] = (byte)value;
}
}
private int GamerOffset
{
get
{
return GetGamerOffset(SelectedGamer);
}
}
public GameData()
{
data = new byte[TotalLength];
Initialize();
}
public void Read()
{
Worlds.ReadGameData(data);
}
public void Write()
{
Worlds.WriteGameData(data);
}
public void Reset()
{
Initialize(SelectedGamer);
}
public void GetDoors(int[] doors)
{
for (int i = 0; i < DoorsLength; i++)
{
doors[i] = data[GamerOffset + 10 + i];
}
}
public void SetDoors(int[] doors)
{
for (int i = 0; i < DoorsLength; i++)
{
data[GamerOffset + 10 + i] = (byte)doors[i];
}
}
public void GetGamerInfo(int gamer, out int nbVies, out int mainDoors, out int secondaryDoors)
{
nbVies = data[GetGamerOffset(gamer)];
secondaryDoors = 0;
for (int i = 0; i < 180; i++)
{
if (data[GetGamerOffset(gamer) + 10 + i] == 1)
{
secondaryDoors++;
}
}
mainDoors = 0;
for (int j = 180; j < 200; j++)
{
if (data[GetGamerOffset(gamer) + 10 + j] == 1)
{
mainDoors++;
}
}
}
private void Initialize()
{
data[0] = 1;
data[1] = 1;
data[2] = 0;
data[3] = 1;
data[4] = 1;
data[5] = 1;
data[6] = 0;
data[7] = 50;
SelectedGamer = 0;
for (int i = 0; i < MaxGamer; i++)
{
Initialize(i);
}
}
private void Initialize(int gamer)
{
data[GetGamerOffset(gamer)] = 3;
data[GetGamerOffset(gamer) + 1] = 1;
for (int i = 0; i < DoorsLength; i++)
{
data[GetGamerOffset(gamer) + 10 + i] = 0;
}
}
private int GetGamerOffset(int gamer)
{
return HeaderLength + GamerLength * gamer;
}
}
}

1004
InputPad.cs Normal file

File diff suppressed because it is too large Load Diff

159
Jauge.cs Normal file
View File

@ -0,0 +1,159 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Jauge
using Microsoft.Xna.Framework.Media;
using WindowsPhoneSpeedyBlupi;
namespace WindowsPhoneSpeedyBlupi
{
public class Jauge
{
private Pixmap m_pixmap;
private Sound m_sound;
private bool m_bHide;
private TinyPoint m_pos;
private TinyPoint m_dim;
private int m_mode;
private int m_level;
private bool m_bMinimizeRedraw;
private bool m_bRedraw;
private double m_zoom;
public double Zoom
{
get
{
return m_zoom;
}
set
{
m_zoom = value;
}
}
public Jauge()
{
m_mode = 0;
m_bHide = true;
m_bMinimizeRedraw = false;
m_bRedraw = false;
m_zoom = 1.0;
}
public bool Create(Pixmap pixmap, Sound sound, TinyPoint pos, int mode, bool bMinimizeRedraw)
{
m_pixmap = pixmap;
m_sound = sound;
m_mode = mode;
m_bMinimizeRedraw = bMinimizeRedraw;
m_bHide = true;
m_pos = pos;
m_dim.X = 124;
m_dim.Y = 22;
m_level = 0;
m_bRedraw = true;
return true;
}
public void Draw()
{
TinyRect rect = default(TinyRect);
if (m_bMinimizeRedraw && !m_bRedraw)
{
return;
}
m_bRedraw = false;
if (!m_bHide)
{
int num = m_level * 114 / 100;
rect.LeftX = 0;
rect.RightX = 124;
rect.TopY = 0;
rect.BottomY = 22;
m_pixmap.DrawPart(5, m_pos, rect, m_zoom);
if (num > 0)
{
rect.LeftX = 0;
rect.RightX = 6 + num;
rect.TopY = 22 * m_mode;
rect.BottomY = 22 * (m_mode + 1);
m_pixmap.DrawPart(5, m_pos, rect, m_zoom);
}
}
}
public void Redraw()
{
m_bRedraw = true;
}
public int GetLevel()
{
return m_level;
}
public void SetLevel(int level)
{
if (level < 0)
{
level = 0;
}
if (level > 100)
{
level = 100;
}
if (m_level != level)
{
m_bRedraw = true;
}
m_level = level;
}
public int GetMode()
{
return m_mode;
}
public void SetMode(int mode)
{
if (m_mode != mode)
{
m_bRedraw = true;
}
m_mode = mode;
}
public bool GetHide()
{
return m_bHide;
}
public void SetHide(bool bHide)
{
if (m_bHide != bHide)
{
m_bRedraw = true;
}
m_bHide = bHide;
}
public TinyPoint GetPos()
{
return m_pos;
}
public void SetRedraw()
{
m_bRedraw = true;
}
}
}

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

122
Misc.cs Normal file
View File

@ -0,0 +1,122 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Misc
using System;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using WindowsPhoneSpeedyBlupi;
using static WindowsPhoneSpeedyBlupi.Def;
namespace WindowsPhoneSpeedyBlupi
{
public static class Misc
{
public static Rectangle RotateAdjust(Rectangle rect, double angle)
{
TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = rect.Width / 2;
tinyPoint.Y = rect.Height / 2;
TinyPoint p = tinyPoint;
TinyPoint tinyPoint2 = RotatePointRad(angle, p);
int num = tinyPoint2.X - p.X;
int num2 = tinyPoint2.Y - p.Y;
return new Rectangle(rect.Left - num, rect.Top - num2, rect.Width, rect.Height);
}
public static TinyPoint RotatePointRad(double angle, TinyPoint p)
{
return RotatePointRad(default(TinyPoint), angle, p);
}
public static TinyPoint RotatePointRad(TinyPoint center, double angle, TinyPoint p)
{
TinyPoint tinyPoint = default(TinyPoint);
TinyPoint result = default(TinyPoint);
tinyPoint.X = p.X - center.X;
tinyPoint.Y = p.Y - center.Y;
double num = Math.Sin(angle);
double num2 = Math.Cos(angle);
result.X = (int)((double)tinyPoint.X * num2 - (double)tinyPoint.Y * num);
result.Y = (int)((double)tinyPoint.X * num + (double)tinyPoint.Y * num2);
result.X += center.X;
result.Y += center.Y;
return result;
}
public static double DegToRad(double angle)
{
return angle * Math.PI / 180.0;
}
public static int Approch(int actual, int final, int step)
{
if (actual < final)
{
actual = Math.Min(actual + step, final);
}
else if (actual > final)
{
actual = Math.Max(actual - step, final);
}
return actual;
}
public static int Speed(double speed, int max)
{
if (speed > 0.0)
{
return Math.Max((int)(speed * (double)max), 1);
}
if (speed < 0.0)
{
return Math.Min((int)(speed * (double)max), -1);
}
return 0;
}
public static TinyRect Inflate(TinyRect rect, int value)
{
TinyRect result = default(TinyRect);
result.LeftX = rect.LeftX - value;
result.RightX = rect.RightX + value;
result.TopY = rect.TopY - value;
result.BottomY = rect.BottomY + value;
return result;
}
public static bool IsInside(TinyRect rect, TinyPoint p)
{
return p.X >= rect.LeftX && p.X <= rect.RightX && p.Y >= rect.TopY && p.Y <= rect.BottomY;
}
public static bool IntersectRect(out TinyRect dst, TinyRect src1, TinyRect src2)
{
dst = default(TinyRect);
dst.LeftX = Math.Max(src1.LeftX, src2.LeftX);
dst.RightX = Math.Min(src1.RightX, src2.RightX);
dst.TopY = Math.Max(src1.TopY, src2.TopY);
dst.BottomY = Math.Min(src1.BottomY, src2.BottomY);
return !IsRectEmpty(dst);
}
public static bool UnionRect(out TinyRect dst, TinyRect src1, TinyRect src2)
{
dst = default(TinyRect);
dst.LeftX = Math.Min(src1.LeftX, src2.LeftX);
dst.RightX = Math.Max(src1.RightX, src2.RightX);
dst.TopY = Math.Min(src1.TopY, src2.TopY);
dst.BottomY = Math.Max(src1.BottomY, src2.BottomY);
return !IsRectEmpty(dst);
}
private static bool IsRectEmpty(TinyRect rect)
{
if (rect.LeftX < rect.RightX)
{
return rect.TopY >= rect.BottomY;
}
return true;
}
}
}

776
MyResource.cs Normal file
View File

@ -0,0 +1,776 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.MyResource
using System.Collections.Generic;
using System.Globalization;
namespace WindowsPhoneSpeedyBlupi
{
public static class MyResource
{
public static readonly int TX_BUTTON_PLAY;
public static readonly int TX_BUTTON_MENU;
public static readonly int TX_BUTTON_BACK;
public static readonly int TX_BUTTON_RESTART;
public static readonly int TX_BUTTON_CONTINUE;
public static readonly int TX_BUTTON_BUY;
public static readonly int TX_BUTTON_SETUP;
public static readonly int TX_BUTTON_SETUP_SOUNDS;
public static readonly int TX_BUTTON_SETUP_JUMP;
public static readonly int TX_BUTTON_SETUP_ZOOM;
public static readonly int TX_BUTTON_SETUP_ACCEL;
public static readonly int TX_BUTTON_SETUP_RESET;
public static readonly int TX_BUTTON_RANKING;
public static readonly int TX_GAMER_TITLE;
public static readonly int TX_GAMER_MDOORS;
public static readonly int TX_GAMER_SDOORS;
public static readonly int TX_GAMER_LIFES;
public static readonly int TX_TRIAL1;
public static readonly int TX_TRIAL2;
public static readonly int TX_TRIAL3;
public static readonly int TX_TRIAL4;
public static readonly int TX_TRIAL5;
public static readonly int TX_TRIAL6;
public static readonly int TX_TRAINING101;
public static readonly int TX_TRAINING102;
public static readonly int TX_TRAINING103;
public static readonly int TX_TRAINING104;
public static readonly int TX_TRAINING105;
public static readonly int TX_TRAINING106;
public static readonly int TX_TRAINING107;
public static readonly int TX_TRAINING108;
public static readonly int TX_TRAINING109;
public static readonly int TX_TRAINING110;
public static readonly int TX_TRAINING111;
public static readonly int TX_TRAINING112;
public static readonly int TX_TRAINING113;
public static readonly int TX_TRAINING114;
public static readonly int TX_TRAINING115;
public static readonly int TX_TRAINING116;
public static readonly int TX_TRAINING117;
public static readonly int TX_TRAINING118;
public static readonly int TX_TRAINING119;
public static readonly int TX_TRAINING120;
public static readonly int TX_TRAINING121;
public static readonly int TX_TRAINING122;
public static readonly int TX_TRAINING123;
public static readonly int TX_TRAINING201;
public static readonly int TX_TRAINING202;
public static readonly int TX_TRAINING203;
public static readonly int TX_TRAINING204;
public static readonly int TX_TRAINING205;
public static readonly int TX_TRAINING206;
public static readonly int TX_TRAINING207;
public static readonly int TX_TRAINING208;
public static readonly int TX_TRAINING209;
public static readonly int TX_TRAINING210;
public static readonly int TX_TRAINING301;
public static readonly int TX_TRAINING302;
public static readonly int TX_TRAINING303;
public static readonly int TX_TRAINING304;
public static readonly int TX_TRAINING305;
public static readonly int TX_TRAINING306;
public static readonly int TX_TRAINING307;
public static readonly int TX_TRAINING308;
public static readonly int TX_TRAINING309;
public static readonly int TX_TRAINING310;
public static readonly int TX_TRAINING311;
public static readonly int TX_TRAINING401;
public static readonly int TX_TRAINING402;
public static readonly int TX_TRAINING403;
public static readonly int TX_TRAINING404;
public static readonly int TX_TRAINING405;
public static readonly int TX_TRAINING406;
public static readonly int TX_TRAINING407;
public static readonly int TX_TRAINING408;
public static readonly int TX_TRAINING409;
public static readonly int TX_TRAINING410;
public static readonly int TX_TRAINING101a;
public static readonly int TX_TRAINING102a;
public static readonly int TX_TRAINING103a;
public static readonly int TX_TRAINING104a;
public static readonly int TX_TRAINING105a;
public static readonly int TX_TRAINING106a;
public static readonly int TX_TRAINING107a;
public static readonly int TX_TRAINING108a;
public static readonly int TX_TRAINING109a;
public static readonly int TX_TRAINING110a;
public static readonly int TX_TRAINING111a;
public static readonly int TX_TRAINING112a;
public static readonly int TX_TRAINING113a;
public static readonly int TX_TRAINING114a;
public static readonly int TX_TRAINING115a;
public static readonly int TX_TRAINING116a;
public static readonly int TX_TRAINING117a;
public static readonly int TX_TRAINING118a;
public static readonly int TX_TRAINING119a;
public static readonly int TX_TRAINING120a;
public static readonly int TX_TRAINING121a;
public static readonly int TX_TRAINING122a;
public static readonly int TX_TRAINING123a;
public static readonly int TX_TRAINING201a;
public static readonly int TX_TRAINING202a;
public static readonly int TX_TRAINING203a;
public static readonly int TX_TRAINING204a;
public static readonly int TX_TRAINING205a;
public static readonly int TX_TRAINING206a;
public static readonly int TX_TRAINING207a;
public static readonly int TX_TRAINING208a;
public static readonly int TX_TRAINING209a;
public static readonly int TX_TRAINING210a;
public static readonly int TX_TRAINING301a;
public static readonly int TX_TRAINING302a;
public static readonly int TX_TRAINING303a;
public static readonly int TX_TRAINING304a;
public static readonly int TX_TRAINING305a;
public static readonly int TX_TRAINING306a;
public static readonly int TX_TRAINING307a;
public static readonly int TX_TRAINING308a;
public static readonly int TX_TRAINING309a;
public static readonly int TX_TRAINING310a;
public static readonly int TX_TRAINING311a;
public static readonly int TX_TRAINING401a;
public static readonly int TX_TRAINING402a;
public static readonly int TX_TRAINING403a;
public static readonly int TX_TRAINING404a;
public static readonly int TX_TRAINING405a;
public static readonly int TX_TRAINING406a;
public static readonly int TX_TRAINING407a;
public static readonly int TX_TRAINING408a;
public static readonly int TX_TRAINING409a;
public static readonly int TX_TRAINING410a;
private static Dictionary<int, string> resources;
public static string LoadString(int res)
{
string value;
if (resources.TryGetValue(res, out value))
{
return value;
}
return "???";
}
static MyResource()
{
TX_BUTTON_PLAY = 100;
TX_BUTTON_MENU = 101;
TX_BUTTON_BACK = 102;
TX_BUTTON_RESTART = 103;
TX_BUTTON_CONTINUE = 104;
TX_BUTTON_BUY = 105;
TX_BUTTON_SETUP = 107;
TX_BUTTON_SETUP_SOUNDS = 108;
TX_BUTTON_SETUP_JUMP = 109;
TX_BUTTON_SETUP_ZOOM = 110;
TX_BUTTON_SETUP_ACCEL = 111;
TX_BUTTON_SETUP_RESET = 112;
TX_BUTTON_RANKING = 113;
TX_GAMER_TITLE = 200;
TX_GAMER_MDOORS = 201;
TX_GAMER_SDOORS = 202;
TX_GAMER_LIFES = 203;
TX_TRIAL1 = 300;
TX_TRIAL2 = 301;
TX_TRIAL3 = 302;
TX_TRIAL4 = 303;
TX_TRIAL5 = 304;
TX_TRIAL6 = 305;
TX_TRAINING101 = 1000;
TX_TRAINING102 = 1001;
TX_TRAINING103 = 1002;
TX_TRAINING104 = 1003;
TX_TRAINING105 = 1004;
TX_TRAINING106 = 1005;
TX_TRAINING107 = 1006;
TX_TRAINING108 = 1007;
TX_TRAINING109 = 1008;
TX_TRAINING110 = 1009;
TX_TRAINING111 = 1010;
TX_TRAINING112 = 1011;
TX_TRAINING113 = 1012;
TX_TRAINING114 = 1013;
TX_TRAINING115 = 1014;
TX_TRAINING116 = 1015;
TX_TRAINING117 = 1016;
TX_TRAINING118 = 1017;
TX_TRAINING119 = 1018;
TX_TRAINING120 = 1019;
TX_TRAINING121 = 1020;
TX_TRAINING122 = 1021;
TX_TRAINING123 = 1022;
TX_TRAINING201 = 2000;
TX_TRAINING202 = 2001;
TX_TRAINING203 = 2002;
TX_TRAINING204 = 2003;
TX_TRAINING205 = 2004;
TX_TRAINING206 = 2005;
TX_TRAINING207 = 2006;
TX_TRAINING208 = 2007;
TX_TRAINING209 = 2008;
TX_TRAINING210 = 2009;
TX_TRAINING301 = 3000;
TX_TRAINING302 = 3001;
TX_TRAINING303 = 3002;
TX_TRAINING304 = 3003;
TX_TRAINING305 = 3004;
TX_TRAINING306 = 3005;
TX_TRAINING307 = 3006;
TX_TRAINING308 = 3007;
TX_TRAINING309 = 3008;
TX_TRAINING310 = 3009;
TX_TRAINING311 = 3010;
TX_TRAINING401 = 4000;
TX_TRAINING402 = 4001;
TX_TRAINING403 = 4002;
TX_TRAINING404 = 4003;
TX_TRAINING405 = 4004;
TX_TRAINING406 = 4005;
TX_TRAINING407 = 4006;
TX_TRAINING408 = 4007;
TX_TRAINING409 = 4008;
TX_TRAINING410 = 4009;
TX_TRAINING101a = 11000;
TX_TRAINING102a = 11001;
TX_TRAINING103a = 11002;
TX_TRAINING104a = 11003;
TX_TRAINING105a = 11004;
TX_TRAINING106a = 11005;
TX_TRAINING107a = 11006;
TX_TRAINING108a = 11007;
TX_TRAINING109a = 11008;
TX_TRAINING110a = 11009;
TX_TRAINING111a = 11010;
TX_TRAINING112a = 11011;
TX_TRAINING113a = 11012;
TX_TRAINING114a = 11013;
TX_TRAINING115a = 11014;
TX_TRAINING116a = 11015;
TX_TRAINING117a = 11016;
TX_TRAINING118a = 11017;
TX_TRAINING119a = 11018;
TX_TRAINING120a = 11019;
TX_TRAINING121a = 11020;
TX_TRAINING122a = 11021;
TX_TRAINING123a = 11022;
TX_TRAINING201a = 12000;
TX_TRAINING202a = 12001;
TX_TRAINING203a = 12002;
TX_TRAINING204a = 12003;
TX_TRAINING205a = 12004;
TX_TRAINING206a = 12005;
TX_TRAINING207a = 12006;
TX_TRAINING208a = 12007;
TX_TRAINING209a = 12008;
TX_TRAINING210a = 12009;
TX_TRAINING301a = 13000;
TX_TRAINING302a = 13001;
TX_TRAINING303a = 13002;
TX_TRAINING304a = 13003;
TX_TRAINING305a = 13004;
TX_TRAINING306a = 13005;
TX_TRAINING307a = 13006;
TX_TRAINING308a = 13007;
TX_TRAINING309a = 13008;
TX_TRAINING310a = 13009;
TX_TRAINING311a = 13010;
TX_TRAINING401a = 14000;
TX_TRAINING402a = 14001;
TX_TRAINING403a = 14002;
TX_TRAINING404a = 14003;
TX_TRAINING405a = 14004;
TX_TRAINING406a = 14005;
TX_TRAINING407a = 14006;
TX_TRAINING408a = 14007;
TX_TRAINING409a = 14008;
TX_TRAINING410a = 14009;
resources = new Dictionary<int, string>();
string text = CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToLower();
string text2;
if ((text2 = text) != null && text2 == "fr")
{
InitializeFR();
}
else
{
InitializeEN();
}
}
private static void InitializeFR()
{
resources.Add(TX_BUTTON_PLAY, "Jouer");
resources.Add(TX_BUTTON_MENU, "Menu");
resources.Add(TX_BUTTON_BACK, "Retour");
resources.Add(TX_BUTTON_RESTART, "Recommencer");
resources.Add(TX_BUTTON_CONTINUE, "Continuer");
resources.Add(TX_BUTTON_BUY, "Acheter");
resources.Add(TX_BUTTON_RANKING, "Classement");
resources.Add(TX_BUTTON_SETUP, "Réglages");
resources.Add(TX_BUTTON_SETUP_SOUNDS, "Bruitages");
resources.Add(TX_BUTTON_SETUP_JUMP, "Bouton de saut à droite");
resources.Add(TX_BUTTON_SETUP_ZOOM, "Zoom automatique sur l'action");
resources.Add(TX_BUTTON_SETUP_ACCEL, "Accéléromètre");
resources.Add(TX_BUTTON_SETUP_RESET, "Joueur {0} :\nEffacer la progression");
resources.Add(TX_GAMER_TITLE, "Joueur {0}");
resources.Add(TX_GAMER_MDOORS, "Portes principales : {0}/12");
resources.Add(TX_GAMER_SDOORS, "Portes secondaires : {0}/52");
resources.Add(TX_GAMER_LIFES, "Blupi : {0}");
resources.Add(TX_TRIAL1, "Achetez la version complète");
resources.Add(TX_TRIAL2, "\u000e 64 niveaux passionnants");
resources.Add(TX_TRIAL3, "\u000e Des décors variés");
resources.Add(TX_TRIAL4, "\u000e Une difficulté progressive");
resources.Add(TX_TRIAL5, "\u000e De nouveaux pièges");
resources.Add(TX_TRIAL6, "\u000e Un challenge fun");
resources.Add(TX_TRAINING101, "Utilise la roue directionnelle \0.");
resources.Add(TX_TRAINING102, "Appuie maintenant sur Saut \b.");
resources.Add(TX_TRAINING103, "Appuie à droite sur la roue directionnelle \0 et sur Saut \b.");
resources.Add(TX_TRAINING104, "Appuie sur Droite \0 et Saut \b.");
resources.Add(TX_TRAINING105, "Essaie de ne pas te mouiller avec \0 \b !");
resources.Add(TX_TRAINING106, "");
resources.Add(TX_TRAINING107, "Prend l'ascenseur calmement, sans sauter \0.");
resources.Add(TX_TRAINING108, "Saute sur l'ascenseur.");
resources.Add(TX_TRAINING109, "");
resources.Add(TX_TRAINING110, "Avance sans sauter et sans t'arrêter \0 !");
resources.Add(TX_TRAINING111, "");
resources.Add(TX_TRAINING112, "");
resources.Add(TX_TRAINING113, "Avance sur la plateforme \0.");
resources.Add(TX_TRAINING114, "Quitte la plateforme \0.");
resources.Add(TX_TRAINING115, "Encore une fois, mais plus vite...");
resources.Add(TX_TRAINING116, "Avance sur la plateforme \0 puis saute \0 \b.");
resources.Add(TX_TRAINING117, "Saute lorsque tu es sur la plateforme \0 \b.");
resources.Add(TX_TRAINING118, "Passe par en haut \0 \b.");
resources.Add(TX_TRAINING119, "Les oeufs te redonnent des vies.");
resources.Add(TX_TRAINING120, "Arrivé en haut, avance sur l'autre plateforme sans tarder...");
resources.Add(TX_TRAINING121, "Attrape le deuxième et dernier trésor.");
resources.Add(TX_TRAINING122, "Pour terminer, va sur la flèche rouge.");
resources.Add(TX_TRAINING201, "Pousse la caisse sur le point rouge avec \0.");
resources.Add(TX_TRAINING202, "Pratique, cette caisse, non ?");
resources.Add(TX_TRAINING203, "Tire la caisse sur le point rouge avec \u0003.");
resources.Add(TX_TRAINING204, "Empile les 2 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING205, "Empile 3 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING206, "");
resources.Add(TX_TRAINING207, "");
resources.Add(TX_TRAINING208, "");
resources.Add(TX_TRAINING209, "");
resources.Add(TX_TRAINING210, "");
resources.Add(TX_TRAINING301, "Prend un hélico avec \t.");
resources.Add(TX_TRAINING302, "Utilise \u0006 ou \b pour décoller. Dirige avec \u0004 et \0.");
resources.Add(TX_TRAINING303, "Quitte l'hélico avec \t, il n'aime pas l'eau !");
resources.Add(TX_TRAINING304, "Plonge. Utilise \u0004 \0 \u0002 \u0006 pour te diriger.");
resources.Add(TX_TRAINING305, "Prend un hélico \t puis décole avec \u0006 ou \b.");
resources.Add(TX_TRAINING306, "Attrape les 3 trésors puis monte.");
resources.Add(TX_TRAINING307, "Pour passer, va chercher un skate en haut à gauche.");
resources.Add(TX_TRAINING308, "Prend un skate avec \t.");
resources.Add(TX_TRAINING309, "Tu peux passer sans crainte avec ton skate \0.");
resources.Add(TX_TRAINING310, "Ton skate n'aime pas l'eau ! Utilise \0 \b.");
resources.Add(TX_TRAINING311, "Pose ton skate avec \t.");
resources.Add(TX_TRAINING401, "Prend la dynamite avec \t.");
resources.Add(TX_TRAINING402, "Ne pose surtout pas la dynamite ici avec \t !");
resources.Add(TX_TRAINING403, "Va chercher de la dynamite à gauche.");
resources.Add(TX_TRAINING404, "Pose la dynamite avec \t, puis barre-toi !");
resources.Add(TX_TRAINING405, "Pose encore de la dynamite pour passer.");
resources.Add(TX_TRAINING406, "");
resources.Add(TX_TRAINING407, "");
resources.Add(TX_TRAINING408, "");
resources.Add(TX_TRAINING409, "");
resources.Add(TX_TRAINING410, "");
resources.Add(TX_TRAINING101a, "Incline le téléphone à droite \v.");
resources.Add(TX_TRAINING102a, "Appuie maintenant sur Saut \b.");
resources.Add(TX_TRAINING103a, "\v et appuie sur Saut \b.");
resources.Add(TX_TRAINING104a, "\v et Saut \b.");
resources.Add(TX_TRAINING105a, "Essaie de ne pas te mouiller avec \v \b !");
resources.Add(TX_TRAINING106a, "");
resources.Add(TX_TRAINING107a, "Prend l'ascenseur calmement, sans sauter \v.");
resources.Add(TX_TRAINING108a, "Saute sur l'ascenseur.");
resources.Add(TX_TRAINING109a, "");
resources.Add(TX_TRAINING110a, "Avance sans sauter et sans t'arrêter \v !");
resources.Add(TX_TRAINING111a, "");
resources.Add(TX_TRAINING112a, "");
resources.Add(TX_TRAINING113a, "Avance sur la plateforme \v.");
resources.Add(TX_TRAINING114a, "Quitte la plateforme \v.");
resources.Add(TX_TRAINING115a, "Encore une fois, mais plus vite...");
resources.Add(TX_TRAINING116a, "Avance sur la plateforme \v puis saute \v \b.");
resources.Add(TX_TRAINING117a, "Saute lorsque tu es sur la plateforme \v \b.");
resources.Add(TX_TRAINING118a, "Passe par en haut \v \b.");
resources.Add(TX_TRAINING119a, "Les oeufs te redonnent des vies.");
resources.Add(TX_TRAINING120a, "Arrivé en haut, avance sur l'autre plateforme sans tarder...");
resources.Add(TX_TRAINING121a, "Attrape le deuxième et dernier trésor.");
resources.Add(TX_TRAINING122a, "Pour terminer, va sur la flèche rouge.");
resources.Add(TX_TRAINING201a, "Pousse la caisse sur le point rouge avec \v.");
resources.Add(TX_TRAINING202a, "Pratique, cette caisse, non ?");
resources.Add(TX_TRAINING203a, "Tire la caisse sur le point rouge avec \f et \n.");
resources.Add(TX_TRAINING204a, "Empile les 2 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING205a, "Empile 3 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING206a, "");
resources.Add(TX_TRAINING207a, "");
resources.Add(TX_TRAINING208a, "");
resources.Add(TX_TRAINING209a, "");
resources.Add(TX_TRAINING210a, "");
resources.Add(TX_TRAINING301a, "Prend un hélico avec \t.");
resources.Add(TX_TRAINING302a, "Utilise \b pour décoller. Dirige avec \f et \v.");
resources.Add(TX_TRAINING303a, "Quitte l'hélico avec \t, il n'aime pas l'eau !");
resources.Add(TX_TRAINING304a, "Plonge. Utilise \f \v \b \n pour te diriger.");
resources.Add(TX_TRAINING305a, "Prend un hélico \t puis décole avec \b.");
resources.Add(TX_TRAINING306a, "Attrape les 3 trésors puis monte.");
resources.Add(TX_TRAINING307a, "Pour passer, va chercher un skate en haut à gauche.");
resources.Add(TX_TRAINING308a, "Prend un skate avec \t.");
resources.Add(TX_TRAINING309a, "Tu peux passer sans crainte avec ton skate \v.");
resources.Add(TX_TRAINING310a, "Ton skate n'aime pas l'eau ! Utilise \v \b.");
resources.Add(TX_TRAINING311a, "Pose ton skate avec \t.");
resources.Add(TX_TRAINING401a, "Prend la dynamite avec \t.");
resources.Add(TX_TRAINING402a, "Ne pose surtout pas la dynamite ici avec \t !");
resources.Add(TX_TRAINING403a, "Va chercher de la dynamite à gauche.");
resources.Add(TX_TRAINING404a, "Pose la dynamite avec \t, puis barre-toi !");
resources.Add(TX_TRAINING405a, "Pose encore de la dynamite pour passer.");
resources.Add(TX_TRAINING406a, "");
resources.Add(TX_TRAINING407a, "");
resources.Add(TX_TRAINING408a, "");
resources.Add(TX_TRAINING409a, "");
resources.Add(TX_TRAINING410a, "");
}
private static void InitializeEN()
{
resources.Add(TX_BUTTON_PLAY, "Play");
resources.Add(TX_BUTTON_MENU, "Home");
resources.Add(TX_BUTTON_BACK, "Back");
resources.Add(TX_BUTTON_RESTART, "Restart");
resources.Add(TX_BUTTON_CONTINUE, "Continue");
resources.Add(TX_BUTTON_BUY, "Buy");
resources.Add(TX_BUTTON_RANKING, "Ranking");
resources.Add(TX_BUTTON_SETUP, "Setup");
resources.Add(TX_BUTTON_SETUP_SOUNDS, "Sound effects");
resources.Add(TX_BUTTON_SETUP_JUMP, "Jump button on the right");
resources.Add(TX_BUTTON_SETUP_ZOOM, "Automatic zoom on action");
resources.Add(TX_BUTTON_SETUP_ACCEL, "Accelerometer");
resources.Add(TX_BUTTON_SETUP_RESET, "Player {0} :\nErase progress");
resources.Add(TX_GAMER_TITLE, "Player {0}");
resources.Add(TX_GAMER_MDOORS, "Main gates : {0}/12");
resources.Add(TX_GAMER_SDOORS, "Secondary gates : {0}/52");
resources.Add(TX_GAMER_LIFES, "Blupi : {0}");
resources.Add(TX_TRIAL1, "Buy the full version");
resources.Add(TX_TRIAL2, "\u000e 64 exciting stages");
resources.Add(TX_TRIAL3, "\u000e Varied backgrounds");
resources.Add(TX_TRIAL4, "\u000e An increasing difficulty");
resources.Add(TX_TRIAL5, "\u000e New traps");
resources.Add(TX_TRIAL6, "\u000e Challenge and fun");
resources.Add(TX_TRAINING101, "Use the directional wheel \0.");
resources.Add(TX_TRAINING102, "Press Jump \b.");
resources.Add(TX_TRAINING103, "Press Right \0 and Jump \b.");
resources.Add(TX_TRAINING104, "Press Right \0 and Jump \b.");
resources.Add(TX_TRAINING105, "Don't fall into the water \0 \b !");
resources.Add(TX_TRAINING106, "");
resources.Add(TX_TRAINING107, "Take the elevator quietly, without jumping \0.");
resources.Add(TX_TRAINING108, "Jump on the elevator.");
resources.Add(TX_TRAINING109, "");
resources.Add(TX_TRAINING110, "Move forward without jumping nor stopping \0 !");
resources.Add(TX_TRAINING111, "");
resources.Add(TX_TRAINING112, "");
resources.Add(TX_TRAINING113, "Move forward on the platform \0.");
resources.Add(TX_TRAINING114, "Leave the platform \0.");
resources.Add(TX_TRAINING115, "Once again, but faster...");
resources.Add(TX_TRAINING116, "Move forward on the platform \0, then jump \0 \b.");
resources.Add(TX_TRAINING117, "Jump when you are on the platform \0 \b.");
resources.Add(TX_TRAINING118, "Choose the upper path \0 \b.");
resources.Add(TX_TRAINING119, "Eggs give you extra lives.");
resources.Add(TX_TRAINING120, "Once on the top, move forward on the other platform without delay...");
resources.Add(TX_TRAINING121, "Catch the second and last treasure.");
resources.Add(TX_TRAINING122, "Join the red arrow.");
resources.Add(TX_TRAINING201, "Push the box forward until the red dot with \0.");
resources.Add(TX_TRAINING202, "Practical, right?");
resources.Add(TX_TRAINING203, "Pull the box backward until the red dot with \u0003.");
resources.Add(TX_TRAINING204, "Stack both boxes up on the red dot to move on.");
resources.Add(TX_TRAINING205, "Stack the three boxes up on the red dot to move on.");
resources.Add(TX_TRAINING206, "");
resources.Add(TX_TRAINING207, "");
resources.Add(TX_TRAINING208, "");
resources.Add(TX_TRAINING209, "");
resources.Add(TX_TRAINING210, "");
resources.Add(TX_TRAINING301, "Take a helicopter with \t.");
resources.Add(TX_TRAINING302, "Use \u0006 or \b to take off. Direct with \u0004 and \0.");
resources.Add(TX_TRAINING303, "Leave the helicopter with \t, it dislikes water!");
resources.Add(TX_TRAINING304, "Plunge. Use \u0004 \0 \u0002 \u0006 to direct.");
resources.Add(TX_TRAINING305, "Take a helicopter \t then take off with \u0006 or \b.");
resources.Add(TX_TRAINING306, "Grab the three treasures, then go up.");
resources.Add(TX_TRAINING307, "Go and get a skate in the top left corner.");
resources.Add(TX_TRAINING308, "Take a skate with \t.");
resources.Add(TX_TRAINING309, "You can move on with your skate without fear \0.");
resources.Add(TX_TRAINING310, "Your skate dislikes water! Jump!");
resources.Add(TX_TRAINING311, "Leave your skate with \t.");
resources.Add(TX_TRAINING401, "Take the dynamite sticks with \t.");
resources.Add(TX_TRAINING402, "Do not put down the dynamite here!");
resources.Add(TX_TRAINING403, "Go and get the dynamite sticks on the left.");
resources.Add(TX_TRAINING404, "Put down the dynamite with \t, then clear off!");
resources.Add(TX_TRAINING405, "Put down another stick of dynamite here to move on.");
resources.Add(TX_TRAINING406, "");
resources.Add(TX_TRAINING407, "");
resources.Add(TX_TRAINING408, "");
resources.Add(TX_TRAINING409, "");
resources.Add(TX_TRAINING410, "");
resources.Add(TX_TRAINING101a, "Tilt the phone \v.");
resources.Add(TX_TRAINING102a, "Press Jump \b.");
resources.Add(TX_TRAINING103a, "\v and Jump \b.");
resources.Add(TX_TRAINING104a, "\v and Jump \b.");
resources.Add(TX_TRAINING105a, "Don't fall into the water \v \b !");
resources.Add(TX_TRAINING106a, "");
resources.Add(TX_TRAINING107a, "Take the elevator quietly, without jumping \v.");
resources.Add(TX_TRAINING108a, "Jump on the elevator.");
resources.Add(TX_TRAINING109a, "");
resources.Add(TX_TRAINING110a, "Move forward without jumping nor stopping \v !");
resources.Add(TX_TRAINING111a, "");
resources.Add(TX_TRAINING112a, "");
resources.Add(TX_TRAINING113a, "Move forward on the platform \v.");
resources.Add(TX_TRAINING114a, "Leave the platform \v.");
resources.Add(TX_TRAINING115a, "Once again, but faster...");
resources.Add(TX_TRAINING116a, "Move forward on the platform \v, then jump \v \b.");
resources.Add(TX_TRAINING117a, "Jump when you are on the platform \v \b.");
resources.Add(TX_TRAINING118a, "Choose the upper path \v \b.");
resources.Add(TX_TRAINING119a, "Eggs give you extra lives.");
resources.Add(TX_TRAINING120a, "Once on the top, move forward on the other platform without delay...");
resources.Add(TX_TRAINING121a, "Catch the second and last treasure.");
resources.Add(TX_TRAINING122a, "Join the red arrow.");
resources.Add(TX_TRAINING201a, "Push the box forward until the red dot with \v.");
resources.Add(TX_TRAINING202a, "Practical, right?");
resources.Add(TX_TRAINING203a, "Pull the box backward until the red dot with \f and \n.");
resources.Add(TX_TRAINING204a, "Stack both boxes up on the red dot to move on.");
resources.Add(TX_TRAINING205a, "Stack the three boxes up on the red dot to move on.");
resources.Add(TX_TRAINING206a, "");
resources.Add(TX_TRAINING207a, "");
resources.Add(TX_TRAINING208a, "");
resources.Add(TX_TRAINING209a, "");
resources.Add(TX_TRAINING210a, "");
resources.Add(TX_TRAINING301a, "Take a helicopter with \t.");
resources.Add(TX_TRAINING302a, "Use \b to take off. Direct with \f and \v.");
resources.Add(TX_TRAINING303a, "Leave the helicopter with \t, it dislikes water!");
resources.Add(TX_TRAINING304a, "Plunge. Use \f \v \b \n to direct.");
resources.Add(TX_TRAINING305a, "Take a helicopter \t then take off with \b.");
resources.Add(TX_TRAINING306a, "Grab the three treasures, then go up.");
resources.Add(TX_TRAINING307a, "Go and get a skate in the top left corner.");
resources.Add(TX_TRAINING308a, "Take a skate with \t.");
resources.Add(TX_TRAINING309a, "You can move on with your skate without fear \v.");
resources.Add(TX_TRAINING310a, "Your skate dislikes water! Jump!");
resources.Add(TX_TRAINING311a, "Leave your skate with \t.");
resources.Add(TX_TRAINING401a, "Take the dynamite sticks with \t.");
resources.Add(TX_TRAINING402a, "Do not put down the dynamite here!");
resources.Add(TX_TRAINING403a, "Go and get the dynamite sticks on the left.");
resources.Add(TX_TRAINING404a, "Put down the dynamite with \t, then clear off!");
resources.Add(TX_TRAINING405a, "Put down another stick of dynamite here to move on.");
resources.Add(TX_TRAINING406a, "");
resources.Add(TX_TRAINING407a, "");
resources.Add(TX_TRAINING408a, "");
resources.Add(TX_TRAINING409a, "");
resources.Add(TX_TRAINING410a, "");
}
private static void InitializeDE()
{
resources.Add(TX_BUTTON_PLAY, "Play");
resources.Add(TX_BUTTON_MENU, "Home");
resources.Add(TX_BUTTON_BACK, "Back");
resources.Add(TX_BUTTON_RESTART, "Restart");
resources.Add(TX_BUTTON_CONTINUE, "Continue");
resources.Add(TX_BUTTON_BUY, "Buy");
resources.Add(TX_BUTTON_RANKING, "Ranking");
resources.Add(TX_BUTTON_SETUP, "Setup");
resources.Add(TX_BUTTON_SETUP_SOUNDS, "Sounds");
resources.Add(TX_BUTTON_SETUP_JUMP, "Jump button to the right");
resources.Add(TX_BUTTON_SETUP_ZOOM, "Automatically zoom action");
resources.Add(TX_BUTTON_SETUP_ACCEL, "Accelerometer");
resources.Add(TX_BUTTON_SETUP_RESET, "Gamer {0} :\nReset progression");
resources.Add(TX_GAMER_TITLE, "Gamer {0}");
resources.Add(TX_GAMER_MDOORS, "Main doors : {0}/12");
resources.Add(TX_GAMER_SDOORS, "Secondary doors : {0}/52");
resources.Add(TX_GAMER_LIFES, "Blupi : {0}");
resources.Add(TX_TRIAL1, "Buy the full version");
resources.Add(TX_TRIAL2, "\u000e 64 niveaux passionnants");
resources.Add(TX_TRIAL3, "\u000e Des décors variés");
resources.Add(TX_TRIAL4, "\u000e Une difficulté progressive");
resources.Add(TX_TRIAL5, "\u000e De nouveaux pièges");
resources.Add(TX_TRIAL6, "\u000e Un challenge fun");
resources.Add(TX_TRAINING101, "Utilise la roue directionnelle \0 pour faire avancer Blupi.");
resources.Add(TX_TRAINING102, "Appuie maintenant sur le bouton de saut \b.");
resources.Add(TX_TRAINING103, "Appuie à droite sur la roue directionnelle \0 et sur Saut \b.");
resources.Add(TX_TRAINING104, "Appuie sur Droite \0 et Saut \b.");
resources.Add(TX_TRAINING105, "Essaie de ne pas te mouiller avec \0 \b !");
resources.Add(TX_TRAINING106, "");
resources.Add(TX_TRAINING107, "Prend l'ascenseur calmement, sans sauter \0.");
resources.Add(TX_TRAINING108, "Saute sur l'ascenseur.");
resources.Add(TX_TRAINING109, "");
resources.Add(TX_TRAINING110, "Avance sans sauter et sans t'arrêter \0 !");
resources.Add(TX_TRAINING111, "");
resources.Add(TX_TRAINING112, "");
resources.Add(TX_TRAINING113, "Avance sur la plateforme \0.");
resources.Add(TX_TRAINING114, "Quitte la plateforme \0.");
resources.Add(TX_TRAINING115, "Encore une fois, mais plus vite...");
resources.Add(TX_TRAINING116, "Avance sur la plateforme \0 puis saute \0 \b.");
resources.Add(TX_TRAINING117, "Saute lorsque tu es sur la plateforme \0 \b.");
resources.Add(TX_TRAINING118, "Passe par en haut \0 \b.");
resources.Add(TX_TRAINING119, "Les oeufs te redonnent des vies.");
resources.Add(TX_TRAINING120, "Arrivé en haut, avance sur l'autre plateforme sans tarder...");
resources.Add(TX_TRAINING121, "Attrape le deuxième et dernier trésor.");
resources.Add(TX_TRAINING122, "Pour terminer, va sur la flèche rouge.");
resources.Add(TX_TRAINING201, "Pousse la caisse sur le point rouge avec \0.");
resources.Add(TX_TRAINING202, "Utilise la caisse pour passer l'obstacle avec \0 \b.");
resources.Add(TX_TRAINING203, "Tire la caisse sur le point rouge avec \u0003.");
resources.Add(TX_TRAINING204, "Empile les 2 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING205, "Empile 3 caisses sur le point rouge pour passer.");
resources.Add(TX_TRAINING206, "");
resources.Add(TX_TRAINING207, "");
resources.Add(TX_TRAINING208, "");
resources.Add(TX_TRAINING209, "");
resources.Add(TX_TRAINING210, "");
resources.Add(TX_TRAINING301, "Prend un hélico avec \t.");
resources.Add(TX_TRAINING302, "Utilise \u0006 ou \b pour décoler. Dirige avec \u0004 et \0.");
resources.Add(TX_TRAINING303, "Quitte l'hélico avec \t, il n'aime pas l'eau !");
resources.Add(TX_TRAINING304, "Plonge. Utilise \u0004 \0 \u0002 \u0006 pour te diriger.");
resources.Add(TX_TRAINING305, "Prend un hélico \t puis décole avec \u0006 ou \b.");
resources.Add(TX_TRAINING306, "Attrape les 3 trésors puis monte.");
resources.Add(TX_TRAINING307, "Pour passer, va chercher un skate en haut à gauche.");
resources.Add(TX_TRAINING308, "Prend un skate avec \t.");
resources.Add(TX_TRAINING309, "Tu peux passer sans crainte avec ton skate \0.");
resources.Add(TX_TRAINING310, "Ton skate n'aime pas l'eau ! Utilise \0 \b.");
resources.Add(TX_TRAINING311, "Pose ton skate avec \t.");
resources.Add(TX_TRAINING401, "Prend la dynamite avec \t.");
resources.Add(TX_TRAINING402, "Ne pose surtout pas la dynamite ici avec \t !");
resources.Add(TX_TRAINING403, "Va chercher de la dynamite à gauche.");
resources.Add(TX_TRAINING404, "Pose la dynamite avec \t, puis barre-toi !");
resources.Add(TX_TRAINING405, "Pose encore de la dynamite pour passer.");
resources.Add(TX_TRAINING406, "");
resources.Add(TX_TRAINING407, "");
resources.Add(TX_TRAINING408, "");
resources.Add(TX_TRAINING409, "");
resources.Add(TX_TRAINING410, "");
}
}
}

590
Pixmap.cs Normal file
View File

@ -0,0 +1,590 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Pixmap
using System;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using WindowsPhoneSpeedyBlupi;
using static System.Net.Mime.MediaTypeNames;
using static WindowsPhoneSpeedyBlupi.Def;
using static WindowsPhoneSpeedyBlupi.EnvClasses;
namespace WindowsPhoneSpeedyBlupi
{
public class Pixmap
{
private readonly Game1 game1;
private readonly GraphicsDeviceManager graphics;
private double zoom;
private double originX;
private double originY;
private double hotSpotZoom;
private double hotSpotX;
private double hotSpotY;
private SpriteBatch spriteBatch;
private Texture2D bitmapText;
private Texture2D bitmapButton;
private Texture2D bitmapJauge;
private Texture2D bitmapBlupi;
private Texture2D bitmapBlupi1;
private Texture2D bitmapObject;
private Texture2D bitmapElement;
private Texture2D bitmapExplo;
private Texture2D bitmapPad;
private Texture2D bitmapSpeedyBlupi;
private Texture2D bitmapBlupiYoupie;
private Texture2D bitmapGear;
private Texture2D bitmapBackground;
private Vector2 origin;
private SpriteEffects effect;
public TinyRect DrawBounds
{
get
{
TinyRect result = default(TinyRect);
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
if(Env.PLATFORM == Platform.Android && screenHeight > 480) {
screenWidth = screenHeight * (640f / 480f);
}
if (screenWidth != 0.0 && screenHeight != 0.0)
{
double num3;
double num4;
if (screenWidth / screenHeight < 1.3333333333333333)
{
num3 = 640.0;
num4 = 640.0 * (screenHeight / screenWidth);
}
else
{
num3 = 480.0 * (screenWidth / screenHeight);
num4 = 480.0;
}
result.LeftX = 0;
result.RightX = (int)num3;
result.TopY = 0;
result.BottomY = (int)num4;
}
return result;
}
}
public TinyPoint Origin
{
get
{
TinyPoint result = default(TinyPoint);
result.X = (int)originX;
result.Y = (int)originY;
return result;
}
}
public Pixmap(Game1 game1, GraphicsDeviceManager graphics)
{
this.game1 = game1;
this.graphics = graphics;
origin = new Vector2(0f, 0f);
effect = SpriteEffects.None;
}
public TinyPoint HotSpotToHud(TinyPoint pos)
{
TinyPoint result = default(TinyPoint);
result.X = (int)((double)(pos.X - (int)hotSpotX) / hotSpotZoom) + (int)hotSpotX - (int)originX;
result.Y = (int)((double)(pos.Y - (int)hotSpotY) / hotSpotZoom) + (int)hotSpotY - (int)originY;
return result;
}
public void SetHotSpot(double zoom, double x, double y)
{
hotSpotZoom = zoom;
hotSpotX = x;
hotSpotY = y;
}
public void DrawInputButton(TinyRect rect, Def.ButtonGlyph glyph, bool pressed, bool selected)
{
switch (glyph)
{
case Def.ButtonGlyph.InitGamerA:
DrawIcon(14, selected ? 16 : 4, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitGamerB:
DrawIcon(14, selected ? 17 : 5, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitGamerC:
DrawIcon(14, selected ? 18 : 6, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitSetup:
case Def.ButtonGlyph.PauseSetup:
DrawIcon(14, 19, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitPlay:
DrawIcon(14, 7, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.PauseMenu:
case Def.ButtonGlyph.ResumeMenu:
DrawIcon(14, 11, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.PauseBack:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.PauseRestart:
DrawIcon(14, 9, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.PauseContinue:
case Def.ButtonGlyph.ResumeContinue:
DrawIcon(14, 10, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.WinLostReturn:
DrawIcon(14, 3, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitBuy:
case Def.ButtonGlyph.TrialBuy:
DrawIcon(14, 22, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.InitRanking:
DrawIcon(14, 12, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.TrialCancel:
case Def.ButtonGlyph.RankingContinue:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.SetupSounds:
case Def.ButtonGlyph.SetupJump:
case Def.ButtonGlyph.SetupZoom:
case Def.ButtonGlyph.SetupAccel:
DrawIcon(14, selected ? 13 : 21, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.SetupReset:
DrawIcon(14, 20, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.SetupReturn:
DrawIcon(14, 8, rect, pressed ? 0.8 : 1.0, false);
break;
case Def.ButtonGlyph.PlayJump:
DrawIcon(14, 2, rect, pressed ? 0.6 : 1.0, false);
break;
case Def.ButtonGlyph.PlayAction:
DrawIcon(14, 12, rect, pressed ? 0.6 : 1.0, false);
break;
case Def.ButtonGlyph.PlayDown:
DrawIcon(14, 23, rect, pressed ? 0.6 : 1.0, false);
break;
case Def.ButtonGlyph.PlayPause:
DrawIcon(14, 3, rect, pressed ? 0.6 : 1.0, false);
break;
case Def.ButtonGlyph.Cheat1:
case Def.ButtonGlyph.Cheat2:
case Def.ButtonGlyph.Cheat3:
case Def.ButtonGlyph.Cheat4:
case Def.ButtonGlyph.Cheat5:
case Def.ButtonGlyph.Cheat6:
case Def.ButtonGlyph.Cheat7:
case Def.ButtonGlyph.Cheat8:
case Def.ButtonGlyph.Cheat9:
{
DrawIcon(14, 0, rect, pressed ? 0.6 : 1.0, false);
TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = rect.LeftX + rect.Width / 2 - (int)originX;
tinyPoint.Y = rect.TopY + 28;
TinyPoint pos = tinyPoint;
Text.DrawTextCenter(this, pos, Decor.GetCheatTinyText(glyph), 1.0);
break;
}
case Def.ButtonGlyph.Cheat11:
case Def.ButtonGlyph.Cheat12:
case Def.ButtonGlyph.Cheat21:
case Def.ButtonGlyph.Cheat22:
case Def.ButtonGlyph.Cheat31:
case Def.ButtonGlyph.Cheat32:
break;
}
}
public void LoadContent()
{
spriteBatch = new SpriteBatch(game1.GraphicsDevice);
bitmapText = game1.Content.Load<Texture2D>("icons/text");
bitmapButton = game1.Content.Load<Texture2D>("icons/button");
bitmapJauge = game1.Content.Load<Texture2D>("icons/jauge");
bitmapBlupi = game1.Content.Load<Texture2D>("icons/blupi");
bitmapBlupi1 = game1.Content.Load<Texture2D>("icons/blupi1");
bitmapObject = game1.Content.Load<Texture2D>("icons/object-m");
bitmapElement = game1.Content.Load<Texture2D>("icons/element");
bitmapExplo = game1.Content.Load<Texture2D>("icons/explo");
bitmapPad = game1.Content.Load<Texture2D>("icons/pad");
bitmapSpeedyBlupi = game1.Content.Load<Texture2D>("backgrounds/speedyblupi");
bitmapBlupiYoupie = game1.Content.Load<Texture2D>("backgrounds/blupiyoupie");
bitmapGear = game1.Content.Load<Texture2D>("backgrounds/gear");
UpdateGeometry();
}
private void UpdateGeometry()
{
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
if (Env.PLATFORM == Platform.Android && screenHeight > 480)
{
screenWidth = screenHeight * (640f / 480f);
}
double val = screenWidth / 640.0;
double val2 = screenHeight / 480.0;
zoom = Math.Min(val, val2);
originX = (screenWidth - 640.0 * zoom) / 2.0;
originY = (screenHeight - 480.0 * zoom) / 2.0;
}
public void BackgroundCache(string name)
{
bitmapBackground = game1.Content.Load<Texture2D>("backgrounds/" + name);
}
public bool Start()
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
return true;
}
public bool Finish()
{
return true;
}
public void DrawBackground()
{
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
if (Env.PLATFORM == Platform.Android && screenHeight > 480)
{
screenWidth = screenHeight * (640f / 480f);
}
Texture2D bitmap = GetBitmap(3);
Rectangle srcRectangle = GetSrcRectangle(bitmap, 10, 10, 10, 10, 0, 0);
Rectangle destinationRectangle = new Rectangle(0, 0, (int)screenWidth, (int)screenHeight);
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(bitmap, destinationRectangle, srcRectangle, Color.White);
spriteBatch.End();
TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = (int)originX;
tinyPoint.Y = (int)originY;
TinyPoint dest = tinyPoint;
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = 0;
tinyRect.TopY = 0;
tinyRect.RightX = 640;
tinyRect.BottomY = 480;
TinyRect rect = tinyRect;
DrawPart(3, dest, rect);
}
public void DrawChar(int rank, TinyPoint pos, double size)
{
pos.X = (int)((double)pos.X + originX);
pos.Y = (int)((double)pos.Y + originY);
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = pos.X;
tinyRect.TopY = pos.Y;
tinyRect.RightX = pos.X + (int)(32.0 * size);
tinyRect.BottomY = pos.Y + (int)(32.0 * size);
TinyRect rect = tinyRect;
DrawIcon(6, rank, rect, 1.0, false);
}
public void HudIcon(int channel, int rank, TinyPoint pos)
{
pos.X = (int)((double)pos.X + originX);
pos.Y = (int)((double)pos.Y + originY);
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = pos.X;
tinyRect.TopY = pos.Y;
tinyRect.RightX = pos.X;
tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, 1.0, false);
}
public void QuickIcon(int channel, int rank, TinyPoint pos)
{
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = pos.X;
tinyRect.TopY = pos.Y;
tinyRect.RightX = pos.X;
tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, 1.0, true);
}
public void QuickIcon(int channel, int rank, TinyPoint pos, double opacity, double rotation)
{
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = pos.X;
tinyRect.TopY = pos.Y;
tinyRect.RightX = pos.X;
tinyRect.BottomY = pos.Y;
TinyRect rect = tinyRect;
DrawIcon(channel, rank, rect, opacity, rotation, true);
}
public bool DrawPart(int channel, TinyPoint dest, TinyRect rect)
{
return DrawPart(channel, dest, rect, 1.0);
}
public bool DrawPart(int channel, TinyPoint dest, TinyRect rect, double zoom)
{
Texture2D bitmap = GetBitmap(channel);
if (bitmap == null)
{
return false;
}
if (channel == 5)
{
dest.X = (int)((double)dest.X + originX);
dest.Y = (int)((double)dest.Y + originY);
}
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));
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(bitmap, destinationRectangle, value, Color.White);
spriteBatch.End();
return true;
}
public void DrawIcon(int channel, int icon, TinyRect rect, double opacity, bool useHotSpot)
{
DrawIcon(channel, icon, rect, opacity, 0.0, useHotSpot);
}
public void DrawIcon(int channel, int icon, TinyRect rect, double opacity, double rotationDeg, bool useHotSpot)
{
if (icon == -1)
{
return;
}
if (channel == 14 && !TouchPanel.GetCapabilities().IsConnected)
{
int[] padGameplayIconNumbers = new int[] { 0, 1, 2, 3, 30, 12, 23 };
foreach (int iconNumber in padGameplayIconNumbers)
{
if(iconNumber == icon)
{
if(iconNumber == 1 && rect.LeftX > 100) { continue; }
//Touch display is not connected and the icon is a gameplay icon. Nothing to do.
return;
}
}
}
Texture2D bitmap = GetBitmap(channel);
if (bitmap == null)
{
return;
}
int bitmapGridX;
int bitmapGridY;
int iconWidth;
int iconHeight;
int gap;
switch (channel)
{
case 2:
case 11:
case 12:
case 13:
bitmapGridX = 60;
bitmapGridY = 60;
iconWidth = 60;
iconHeight = 60;
gap = 0;
break;
case 1:
bitmapGridX = 64;
bitmapGridY = 64;
iconWidth = 64;
iconHeight = 64;
gap = 1;
break;
case 10:
bitmapGridX = 60;
bitmapGridY = 60;
iconWidth = 60;
iconHeight = 60;
gap = 0;
break;
case 9:
bitmapGridX = 144;
bitmapGridY = 144;
iconHeight = Tables.table_explo_size[icon];
iconWidth = Math.Max(iconHeight, 128);
gap = 0;
break;
case 6:
bitmapGridX = 32;
bitmapGridY = 32;
iconWidth = 32;
iconHeight = 32;
gap = 0;
break;
case 4:
bitmapGridX = 40;
bitmapGridY = 40;
iconWidth = 40;
iconHeight = 40;
gap = 0;
break;
case 14:
bitmapGridX = 140;
bitmapGridY = 140;
iconWidth = 140;
iconHeight = 140;
gap = 0;
break;
case 15:
bitmapGridX = 640;
bitmapGridY = 160;
iconWidth = 640;
iconHeight = 160;
gap = 0;
break;
case 16:
bitmapGridX = 410;
bitmapGridY = 380;
iconWidth = 410;
iconHeight = 380;
gap = 0;
break;
case 17:
bitmapGridX = 226;
bitmapGridY = 226;
iconWidth = 226;
iconHeight = 226;
gap = 0;
break;
default:
bitmapGridX = 0;
bitmapGridY = 0;
iconWidth = 0;
iconHeight = 0;
gap = 0;
break;
}
if (bitmapGridX != 0)
{
Rectangle srcRectangle = GetSrcRectangle(bitmap, bitmapGridX, bitmapGridY, iconWidth, iconHeight, gap, icon);
Rectangle rectangle = GetDstRectangle(rect, iconWidth, iconHeight, useHotSpot);
float rotationRad = 0f;
if (rotationDeg != 0.0)
{
rotationRad = (float)Misc.DegToRad(rotationDeg);
rectangle = Misc.RotateAdjust(rectangle, rotationRad);
}
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(bitmap, rectangle, srcRectangle, Color.FromNonPremultiplied(255, 255, 255, (int)(255.0 * opacity)), rotationRad, origin, effect, 0f);
spriteBatch.End();
}
}
private Rectangle GetSrcRectangle(Texture2D bitmap, int bitmapGridX, int bitmapGridY, int iconWidth, int iconHeight, int gap, int icon)
{
int width = bitmap.Bounds.Width;
int height = bitmap.Bounds.Height;
int num = icon % (width / bitmapGridX);
int num2 = icon / (width / bitmapGridX);
bitmapGridX += gap;
bitmapGridY += gap;
return new Rectangle(gap + num * bitmapGridX, gap + num2 * bitmapGridY, iconWidth, iconHeight);
}
private Rectangle GetDstRectangle(TinyRect rect, int iconWidth, int iconHeight, bool useHotSpot)
{
int num = ((rect.Width == 0) ? iconWidth : rect.Width);
int num2 = ((rect.Height == 0) ? iconHeight : rect.Height);
int num3 = (int)((double)rect.LeftX * zoom);
int num4 = (int)((double)rect.TopY * zoom);
int num5 = (int)((double)num3 + (double)num * zoom);
int num6 = (int)((double)num4 + (double)num2 * zoom);
if (useHotSpot && hotSpotZoom > 1.0)
{
num3 -= (int)hotSpotX;
num4 -= (int)hotSpotY;
num5 -= (int)hotSpotX;
num6 -= (int)hotSpotY;
num3 = (int)((double)num3 * hotSpotZoom);
num4 = (int)((double)num4 * hotSpotZoom);
num5 = (int)((double)num5 * hotSpotZoom);
num6 = (int)((double)num6 * hotSpotZoom);
num3 += (int)hotSpotX;
num4 += (int)hotSpotY;
num5 += (int)hotSpotX;
num6 += (int)hotSpotY;
}
return new Rectangle(num3, num4, num5 - num3, num6 - num4);
}
private Texture2D GetBitmap(int channel)
{
switch (channel)
{
case 2:
return bitmapBlupi;
case 11:
case 12:
case 13:
return bitmapBlupi1;
case 1:
return bitmapObject;
case 10:
return bitmapElement;
case 9:
return bitmapExplo;
case 6:
return bitmapText;
case 4:
return bitmapButton;
case 5:
return bitmapJauge;
case 14:
return bitmapPad;
case 15:
return bitmapSpeedyBlupi;
case 16:
return bitmapBlupiYoupie;
case 17:
return bitmapGear;
case 3:
return bitmapBackground;
default:
return null;
}
}
}
}

62
Resource.cs Normal file
View File

@ -0,0 +1,62 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Resource
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
//[DebuggerNonUserCode]
//[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
//[CompilerGenerated]
namespace WindowsPhoneSpeedyBlupi
{
internal class Resource
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (ReferenceEquals(resourceMan, null))
{
ResourceManager resourceManager = new ResourceManager("WindowsPhoneSpeedyBlupi.Resource", typeof(Resource).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static string Title
{
get
{
return ResourceManager.GetString("Title", resourceCulture);
}
}
internal Resource()
{
}
}
}

96
Slider.cs Normal file
View File

@ -0,0 +1,96 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Slider
using System;
namespace WindowsPhoneSpeedyBlupi
{
public class Slider
{
public Slider(TinyPoint topLeftCorner, double value) {
TopLeftCorner = topLeftCorner;
value = Value;
}
public TinyPoint TopLeftCorner { get; set; }
public double Value { get; set; }
private int PosLeft
{
get
{
return TopLeftCorner.X + 22;
}
}
private int PosRight
{
get
{
return TopLeftCorner.X + 248 - 22;
}
}
public void Draw(Pixmap pixmap)
{
TinyPoint tinyPoint = default(TinyPoint);
tinyPoint.X = TopLeftCorner.X - pixmap.Origin.X;
tinyPoint.Y = TopLeftCorner.Y - pixmap.Origin.Y;
TinyPoint dest = tinyPoint;
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = 0;
tinyRect.RightX = 124;
tinyRect.TopY = 0;
tinyRect.BottomY = 22;
TinyRect rect = tinyRect;
pixmap.DrawPart(5, dest, rect, 2.0);
int num = (int)((double)(PosRight - PosLeft) * Value);
int num2 = TopLeftCorner.Y + 22;
int num3 = 94;
TinyRect tinyRect2 = default(TinyRect);
tinyRect2.LeftX = PosLeft + num - num3 / 2;
tinyRect2.RightX = PosLeft + num + num3 / 2;
tinyRect2.TopY = num2 - num3 / 2;
tinyRect2.BottomY = num2 + num3 / 2;
rect = tinyRect2;
pixmap.DrawIcon(14, 1, rect, 1.0, false);
TinyRect tinyRect3 = default(TinyRect);
tinyRect3.LeftX = TopLeftCorner.X - 65;
tinyRect3.RightX = TopLeftCorner.X - 65 + 60;
tinyRect3.TopY = TopLeftCorner.Y - 10;
tinyRect3.BottomY = TopLeftCorner.Y - 10 + 60;
rect = tinyRect3;
pixmap.DrawIcon(10, 37, rect, 1.0, false);
TinyRect tinyRect4 = default(TinyRect);
tinyRect4.LeftX = TopLeftCorner.X + 248 + 5;
tinyRect4.RightX = TopLeftCorner.X + 248 + 5 + 60;
tinyRect4.TopY = TopLeftCorner.Y - 10;
tinyRect4.BottomY = TopLeftCorner.Y - 10 + 60;
rect = tinyRect4;
pixmap.DrawIcon(10, 38, rect, 1.0, false);
}
public bool Move(TinyPoint pos)
{
TinyRect tinyRect = default(TinyRect);
tinyRect.LeftX = TopLeftCorner.X - 50;
tinyRect.RightX = TopLeftCorner.X + 248 + 50;
tinyRect.TopY = TopLeftCorner.Y - 50;
tinyRect.BottomY = TopLeftCorner.Y + 44 + 50;
TinyRect rect = tinyRect;
if (Misc.IsInside(rect, pos))
{
double val = ((double)pos.X - (double)PosLeft) / (double)(PosRight - PosLeft);
val = Math.Max(val, 0.0);
val = Math.Min(val, 1.0);
if (Value != val)
{
Value = val;
return true;
}
}
return false;
}
}
}

260
Sound.cs Normal file
View File

@ -0,0 +1,260 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Sound
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Audio;
using WindowsPhoneSpeedyBlupi;
namespace WindowsPhoneSpeedyBlupi
{
public class Sound
{
private class Play
{
private readonly SoundEffectInstance sei;
private readonly int channel;
public int Channel
{
get
{
return channel;
}
}
public bool IsFree
{
get
{
return sei.State == SoundState.Stopped;
}
}
public Play(SoundEffect se, int channel, double volume, double balance, double? pitch, bool isLooped)
{
this.channel = channel;
int num = channel * 2;
if (num >= 0 && num < tableVolumePitch.Length)
{
volume *= tableVolumePitch[num];
pitch = tableVolumePitch[num + 1];
}
sei = se.CreateInstance();
sei.Volume = (float)volume;
sei.Pan = (float)balance;
sei.Pitch = (float)(pitch ?? 0.0);
sei.IsLooped = isLooped;
sei.Play();
}
public void Stop()
{
sei.Stop();
}
}
private static double[] tableVolumePitch = new double[200]
{
1.0, 0.0, 0.5, 1.0, 0.5, 1.0, 1.0, 0.2, 1.0, 0.2,
1.0, 0.1, 1.0, 0.3, 1.0, 0.2, 1.0, 0.3, 1.0, 0.5,
1.0, 0.2, 1.0, 0.2, 1.0, 0.1, 1.0, 0.2, 1.0, 0.2,
1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 0.7, 0.2, 1.0, 0.1, 1.0, 0.1,
1.0, 0.2, 1.0, 0.2, 1.0, 0.4, 1.0, 0.0, 1.0, 0.0,
1.0, 0.0, 1.0, 0.0, 1.0, 0.2, 1.0, 0.2, 0.7, 0.4,
1.0, 0.2, 1.0, 0.4, 1.0, 0.2, 0.5, 1.0, 0.5, 1.0,
1.0, 0.4, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 0.6, 0.4, 0.8, 0.1,
0.6, 0.5, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.0,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.0,
1.0, 0.2, 1.0, 0.2, 1.0, 0.0, 1.0, 0.0, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 0.6, 0.4,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2,
1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2
};
public static readonly int MAXVOLUME = 20;
private readonly Game1 game1;
private readonly GameData gameData;
private readonly List<SoundEffect> soundEffects;
private readonly List<Play> plays;
private double volume;
public Sound(Game1 game1, GameData gameData)
{
this.game1 = game1;
this.gameData = gameData;
soundEffects = new List<SoundEffect>();
plays = new List<Play>();
volume = 1.0;
SoundEffect.MasterVolume = 1f;
}
public void LoadContent()
{
if (Def.HasSound)
{
for (int i = 0; i <= 92; i++)
{
string assetName = string.Format("sounds/sound{0}", i.ToString("d3"));
SoundEffect item = game1.Content.Load<SoundEffect>(assetName);
soundEffects.Add(item);
}
}
}
public bool Create()
{
return true;
}
public void SetState(bool bState)
{
}
public void SetCDAudio(bool bAudio)
{
}
public bool GetEnable()
{
return true;
}
public void SetAudioVolume(int volume)
{
this.volume = (double)volume / (double)MAXVOLUME;
}
public int GetAudioVolume()
{
return (int)(volume * (double)MAXVOLUME);
}
public void SetMidiVolume(int volume)
{
}
public int GetMidiVolume()
{
return 0;
}
public void StopAll()
{
while (plays.Any())
{
plays[0].Stop();
plays.RemoveAt(0);
}
}
public bool PlayImage(int channel, TinyPoint pos)
{
return PlayImage(channel, pos, -1, false);
}
public bool PlayImage(int channel, TinyPoint pos, int rank, bool bLoop)
{
if (!gameData.Sounds)
{
return true;
}
if (channel >= 0 && channel < soundEffects.Count)
{
if (channel != 10 && plays.Where((Play x) => x.Channel == channel && !x.IsFree).Any())
{
return true;
}
if (plays.Count >= 10)
{
int num = 0;
while (num < plays.Count)
{
if (plays[num].IsFree)
{
plays.RemoveAt(num);
}
else
{
num++;
}
}
}
Play item = new Play(soundEffects[channel], channel, (float)GetVolume(pos), (float)GetBalance(pos), null, bLoop);
plays.Add(item);
}
return true;
}
public bool PosImage(int channel, TinyPoint pos)
{
return true;
}
public bool Stop(int channel)
{
int num = 0;
while (num < plays.Count)
{
if (plays[num].Channel == channel)
{
plays[num].Stop();
plays.RemoveAt(num);
}
else
{
num++;
}
}
return true;
}
private double GetVolume(TinyPoint pos)
{
double val = 1.0;
if (pos.X < 0)
{
val = 1.0 + (double)(pos.X / 640) * 2.0;
}
if (pos.X > 640)
{
pos.X -= 640;
val = 1.0 - (double)(pos.X / 640) * 2.0;
}
val = Math.Max(val, 0.0);
val = Math.Min(val, 1.0);
double val2 = 1.0;
if (pos.Y < 0)
{
val2 = 1.0 + (double)(pos.Y / 480) * 3.0;
}
if (pos.Y > 480)
{
pos.Y -= 480;
val2 = 1.0 - (double)(pos.Y / 480) * 3.0;
}
val2 = Math.Max(val2, 0.0);
val2 = Math.Min(val2, 1.0);
return Math.Min(val, val2) * volume;
}
private double GetBalance(TinyPoint pos)
{
double val = (double)pos.X * 2.0 / 640.0 - 1.0;
val = Math.Max(val, -1.0);
return Math.Min(val, 1.0);
}
}
}

1715
Tables.cs Normal file

File diff suppressed because it is too large Load Diff

295
Text.cs Normal file
View File

@ -0,0 +1,295 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Text
using WindowsPhoneSpeedyBlupi;
namespace WindowsPhoneSpeedyBlupi
{
public static class Text
{
private static short[] table_char = new short[1536]
{
0, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 2, 0, 0, -1, 0, 0, 3, 0,
0, -1, 0, 0, 4, 0, 0, -1, 0, 0,
5, 0, 0, -1, 0, 0, 6, 0, 0, -1,
0, 0, 7, 0, 0, -1, 0, 0, 8, 0,
0, -1, 0, 0, 9, 0, 0, -1, 0, 0,
10, 0, 0, -1, 0, 0, 11, 0, 0, -1,
0, 0, 12, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 14, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 32, 0, 0, -1, 0, 0, 33, 0,
0, -1, 0, 0, 34, 0, 0, -1, 0, 0,
35, 0, 0, -1, 0, 0, 36, 0, 0, -1,
0, 0, 37, 0, 0, -1, 0, 0, 38, 0,
0, -1, 0, 0, 39, 0, 0, -1, 0, 0,
40, 0, 0, -1, 0, 0, 41, 0, 0, -1,
0, 0, 42, 0, 0, -1, 0, 0, 43, 0,
0, -1, 0, 0, 44, 0, 0, -1, 0, 0,
45, 0, 0, -1, 0, 0, 46, 0, 0, -1,
0, 0, 47, 0, 0, -1, 0, 0, 48, 0,
0, -1, 0, 0, 49, 0, 0, -1, 0, 0,
50, 0, 0, -1, 0, 0, 51, 0, 0, -1,
0, 0, 52, 0, 0, -1, 0, 0, 53, 0,
0, -1, 0, 0, 54, 0, 0, -1, 0, 0,
55, 0, 0, -1, 0, 0, 56, 0, 0, -1,
0, 0, 57, 0, 0, -1, 0, 0, 58, 0,
0, -1, 0, 0, 59, 0, 0, -1, 0, 0,
60, 0, 0, -1, 0, 0, 61, 0, 0, -1,
0, 0, 62, 0, 0, -1, 0, 0, 63, 0,
0, -1, 0, 0, 64, 0, 0, -1, 0, 0,
65, 0, 0, -1, 0, 0, 66, 0, 0, -1,
0, 0, 67, 0, 0, -1, 0, 0, 68, 0,
0, -1, 0, 0, 69, 0, 0, -1, 0, 0,
70, 0, 0, -1, 0, 0, 71, 0, 0, -1,
0, 0, 72, 0, 0, -1, 0, 0, 73, 0,
0, -1, 0, 0, 74, 0, 0, -1, 0, 0,
75, 0, 0, -1, 0, 0, 76, 0, 0, -1,
0, 0, 77, 0, 0, -1, 0, 0, 78, 0,
0, -1, 0, 0, 79, 0, 0, -1, 0, 0,
80, 0, 0, -1, 0, 0, 81, 0, 0, -1,
0, 0, 82, 0, 0, -1, 0, 0, 83, 0,
0, -1, 0, 0, 84, 0, 0, -1, 0, 0,
85, 0, 0, -1, 0, 0, 86, 0, 0, -1,
0, 0, 87, 0, 0, -1, 0, 0, 88, 0,
0, -1, 0, 0, 89, 0, 0, -1, 0, 0,
90, 0, 0, -1, 0, 0, 91, 0, 0, -1,
0, 0, 92, 0, 0, -1, 0, 0, 93, 0,
0, -1, 0, 0, 94, 0, 0, -1, 0, 0,
95, 0, 0, -1, 0, 0, 96, 0, 0, -1,
0, 0, 97, 0, 0, -1, 0, 0, 98, 0,
0, -1, 0, 0, 99, 0, 0, -1, 0, 0,
100, 0, 0, -1, 0, 0, 101, 0, 0, -1,
0, 0, 102, 0, 0, -1, 0, 0, 103, 0,
0, -1, 0, 0, 104, 0, 0, -1, 0, 0,
105, 0, 0, -1, 0, 0, 106, 0, 0, -1,
0, 0, 107, 0, 0, -1, 0, 0, 108, 0,
0, -1, 0, 0, 109, 0, 0, -1, 0, 0,
110, 0, 0, -1, 0, 0, 111, 0, 0, -1,
0, 0, 112, 0, 0, -1, 0, 0, 113, 0,
0, -1, 0, 0, 114, 0, 0, -1, 0, 0,
115, 0, 0, -1, 0, 0, 116, 0, 0, -1,
0, 0, 117, 0, 0, -1, 0, 0, 118, 0,
0, -1, 0, 0, 119, 0, 0, -1, 0, 0,
120, 0, 0, -1, 0, 0, 121, 0, 0, -1,
0, 0, 122, 0, 0, -1, 0, 0, 123, 0,
0, -1, 0, 0, 124, 0, 0, -1, 0, 0,
125, 0, 0, -1, 0, 0, 126, 0, 0, -1,
0, 0, 127, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 5, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 4, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 16, 0, 0, -1, 0, 0,
97, 0, 0, 2, 2, 0, 17, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 27, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 29, 0, 0, -1,
0, 0, 19, 0, 0, -1, 0, 0, 18, 0,
0, -1, 0, 0, 21, 0, 0, -1, 0, 0,
20, 0, 0, -1, 0, 0, 1, 0, 0, -1,
0, 0, 105, 0, 0, 2, -1, 0, 23, 0,
0, -1, 0, 0, 22, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 110, 0, 0, 126,
-1, 0, 1, 0, 0, -1, 0, 0, 111, 0,
0, 2, 1, 0, 24, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0, 28, 0, 0, -1,
0, 0, 1, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 25, 0, 0, -1, 0, 0,
117, 0, 0, 2, 2, 0, 26, 0, 0, -1,
0, 0, 15, 0, 0, -1, 0, 0, 1, 0,
0, -1, 0, 0, 1, 0, 0, -1, 0, 0,
1, 0, 0, -1, 0, 0
};
private static short[] table_accents = new short[15]
{
252, 224, 226, 233, 232, 235, 234, 239, 238, 244,
249, 251, 228, 246, 231
};
private static short[] table_width = new short[128]
{
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 14, 13, 15, 15, 15, 15,
15, 15, 11, 12, 14, 13, 13, 15, 15, 14,
0, 0, 9, 5, 10, 25, 17, 22, 18, 5,
9, 9, 14, 13, 6, 10, 6, 14, 18, 10,
14, 14, 17, 16, 16, 17, 15, 16, 5, 6,
9, 12, 10, 14, 25, 18, 16, 17, 18, 16,
16, 19, 20, 15, 15, 15, 14, 24, 22, 22,
15, 24, 16, 18, 15, 19, 18, 29, 20, 18,
19, 8, 13, 8, 12, 20, 7, 15, 15, 13,
15, 15, 13, 14, 14, 6, 8, 14, 6, 21,
16, 14, 14, 13, 12, 14, 11, 13, 13, 19,
16, 15, 14, 10, 5, 11, 16, 0
};
public static void DrawTextLeft(Pixmap pixmap, TinyPoint pos, string text, double size)
{
if (!string.IsNullOrEmpty(text))
{
DrawText(pixmap, pos, text, size);
}
}
public static void DrawText(Pixmap pixmap, TinyPoint pos, string text, double size)
{
if (!string.IsNullOrEmpty(text))
{
foreach (char car in text)
{
DrawChar(pixmap, ref pos, car, size);
}
}
}
public static void DrawTextPente(Pixmap pixmap, TinyPoint pos, string text, int pente, double size)
{
if (!string.IsNullOrEmpty(text))
{
int y = pos.Y;
int num = 0;
foreach (char c in text)
{
int charWidth = GetCharWidth(c, size);
DrawChar(pixmap, ref pos, c, size);
num += charWidth;
pos.Y = y + num / pente;
}
}
}
public static void DrawTextCenter(Pixmap pixmap, TinyPoint pos, string text, double size)
{
if (!string.IsNullOrEmpty(text))
{
TinyPoint pos2 = default(TinyPoint);
pos2.X = pos.X - GetTextWidth(text, size) / 2;
pos2.Y = pos.Y;
DrawText(pixmap, pos2, text, size);
}
}
public static int GetTextWidth(string text, double size)
{
if (string.IsNullOrEmpty(text))
{
return 0;
}
int num = 0;
foreach (char c in text)
{
num += GetCharWidth(c, size);
}
return num;
}
private static int GetOffset(char c)
{
for (int i = 0; i < 15; i++)
{
if ((short)c == table_accents[i])
{
return 15 + i;
}
}
if (c < '\0' || c > '\u0080')
{
return 1;
}
return c;
}
private static void DrawChar(Pixmap pixmap, ref TinyPoint pos, char car, double size)
{
TinyPoint pos2 = default(TinyPoint);
int num = (short)car * 6;
int rank = table_char[num];
pos2.X = pos.X + table_char[num + 1];
pos2.Y = pos.Y + table_char[num + 2];
DrawCharSingle(pixmap, pos2, rank, size);
rank = table_char[num + 3];
if (rank != -1)
{
pos2.X = pos.X + table_char[num + 4];
pos2.Y = pos.Y + table_char[num + 5];
DrawCharSingle(pixmap, pos2, rank, size);
}
pos.X += GetCharWidth(car, size);
}
private static int GetCharWidth(char c, double size)
{
return (int)((double)(table_width[table_char[(short)c * 6]] + 1) * size);
}
private static void DrawCharSingle(Pixmap pixmap, TinyPoint pos, int rank, double size)
{
pixmap.DrawChar(rank, pos, size);
}
}
}

23
TinyPoint.cs Normal file
View File

@ -0,0 +1,23 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.TinyPoint
namespace WindowsPhoneSpeedyBlupi
{
public struct TinyPoint
{
public int X;
public int Y;
public TinyPoint(int x, int y)
{
X = x; Y = y;
}
public override string ToString()
{
return string.Format("{0};{1}", X, Y);
}
}
}

46
TinyRect.cs Normal file
View File

@ -0,0 +1,46 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.TinyRect
namespace WindowsPhoneSpeedyBlupi
{
public struct TinyRect
{
public int LeftX;
public int RightX;
public int TopY;
public int BottomY;
public TinyRect(int leftX, int rightX, int topY, int bottomY)
{
LeftX = leftX;
RightX = rightX;
TopY = topY;
BottomY = bottomY;
}
public int Width
{
get
{
return RightX - LeftX;
}
}
public int Height
{
get
{
return BottomY - TopY;
}
}
public override string ToString()
{
return string.Format("{0};{1};{2};{3}", LeftX, TopY, RightX, BottomY);
}
}
}

558
Worlds.cs Normal file
View File

@ -0,0 +1,558 @@
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
// WindowsPhoneSpeedyBlupi.Worlds
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.IsolatedStorage;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using WindowsPhoneSpeedyBlupi;
#if KNI && Web
using Microsoft.JSInterop;
using Microsoft.AspNetCore.Components;
using static System.Runtime.InteropServices.JavaScript.JSType;
#endif
namespace WindowsPhoneSpeedyBlupi
{
public static class Worlds
{
private static StringBuilder output = new StringBuilder();
private static string GameDataFilename
{
get
{
return "SpeedyBlupi";
}
}
private static string CurrentGameFilename
{
get
{
return "CurrentGame";
}
}
public static string[] ReadWorld(int gamer, int rank)
{
string worldFilename = GetWorldFilename(gamer, rank);
string text = null;
#if !(KNI && Web)
try
{
Stream stream = TitleContainer.OpenStream(worldFilename);
StreamReader streamReader = new StreamReader(stream);
text = streamReader.ReadToEnd();
stream.Close();
}
catch (Exception e)
{
Debug.Write(e.Message);
Debug.Write("Fatal error. Loading world failed: " + worldFilename + "\n");
//Environment.Exit(1);
}
#else
text = WorldTxt.getWorld(rank);
#endif
if (text == null)
{
return null;
}
return text.Split('\n');
}
private static string GetWorldFilename(int gamer, int rank)
{
return string.Format("worlds/world{0}.txt", rank.ToString("d3"));
}
public static bool ReadGameData(byte[] data)
{
Debug.WriteLine("ReadGameData");
#if !(KNI && WEB)
IsolatedStorageFile userStoreForApplication = getUserStoreForApplication();
if (userStoreForApplication.FileExists(GameDataFilename))
{
IsolatedStorageFileStream isolatedStorageFileStream = null;
try
{
isolatedStorageFileStream = userStoreForApplication.OpenFile(GameDataFilename, FileMode.Open);
}
catch (IsolatedStorageException)
{
return false;
}
if (isolatedStorageFileStream != null)
{
int count = Math.Min(data.Length, (int)isolatedStorageFileStream.Length);
isolatedStorageFileStream.Read(data, 0, count);
isolatedStorageFileStream.Close();
return true;
}
}
return false;
#else
if (true) return false;
string result = LocalStorageHelperHolder.LocalStorageHelper.ReadFromLocalStorageAsync(GameDataFilename).Result;
if (result == null || result.Length == 0) { return false; }
else
{
byte[] resultAsByteArray = Encoding.UTF8.GetBytes(result);
Array.Copy(resultAsByteArray, data, resultAsByteArray.Length);
return true;
}
#endif
}
public static void WriteGameData(byte[] data)
{
Debug.WriteLine("WriteGameData");
#if !(KNI && WEB)
IsolatedStorageFile userStoreForApplication = getUserStoreForApplication();
IsolatedStorageFileStream isolatedStorageFileStream = userStoreForApplication.OpenFile(GameDataFilename, FileMode.Create);
if (isolatedStorageFileStream != null)
{
isolatedStorageFileStream.Write(data, 0, data.Length);
isolatedStorageFileStream.Close();
}
#else
//LocalStorageHelperHolder.LocalStorageHelper.SaveToLocalStorageAsync(GameDataFilename, Encoding.UTF8.GetString(data));
#endif
}
public static void DeleteCurrentGame()
{
Debug.WriteLine("DeleteCurrentGame");
#if !KNI
IsolatedStorageFile userStoreForApplication = getUserStoreForApplication();
try
{
userStoreForApplication.DeleteFile(CurrentGameFilename);
}
catch
{
}
#else
//LocalStorageHelperHolder.LocalStorageHelper.DeleteFromLocalStorageAsync(GameDataFilename);
#endif
}
public static string ReadCurrentGame()
{
Debug.WriteLine("ReadCurrentGame");
#if !(KNI && WEB)
IsolatedStorageFile userStoreForApplication = getUserStoreForApplication();
if (userStoreForApplication.FileExists(CurrentGameFilename))
{
IsolatedStorageFileStream isolatedStorageFileStream = null;
try
{
isolatedStorageFileStream = userStoreForApplication.OpenFile(CurrentGameFilename, FileMode.Open);
}
catch (IsolatedStorageException)
{
return null;
}
if (isolatedStorageFileStream != null)
{
byte[] array = new byte[isolatedStorageFileStream.Length];
isolatedStorageFileStream.Read(array, 0, array.Length);
isolatedStorageFileStream.Close();
return Encoding.UTF8.GetString(array, 0, array.Length);
}
}
return null;
#else
if (true) return null;
return LocalStorageHelperHolder.LocalStorageHelper.ReadFromLocalStorageAsync(CurrentGameFilename).Result;
#endif
}
public static void WriteCurrentGame(string data)
{
Debug.WriteLine("WriteCurrentGame");
#if !(KNI && WEB)
IsolatedStorageFile userStoreForApplication = getUserStoreForApplication();
IsolatedStorageFileStream isolatedStorageFileStream = userStoreForApplication.OpenFile(CurrentGameFilename, FileMode.Create);
if (isolatedStorageFileStream != null)
{
isolatedStorageFileStream.Write(Encoding.UTF8.GetBytes(data), 0, data.Length);
isolatedStorageFileStream.Close();
}
#else
//LocalStorageHelperHolder.LocalStorageHelper.SaveToLocalStorageAsync(CurrentGameFilename, data);
#endif
}
private static IsolatedStorageFile getUserStoreForApplication() {
if(Env.IMPL.isFNA()) {
return IsolatedStorageFile.GetUserStoreForAssembly();
}
return IsolatedStorageFile.GetUserStoreForApplication();
}
public static void GetIntArrayField(string[] lines, string section, int rank, string name, int[] array)
{
foreach (string text in lines)
{
if (!text.StartsWith(section + ":") || rank-- != 0)
{
continue;
}
int num = text.IndexOf(name + "=");
if (num == -1)
{
break;
}
num += name.Length + 1;
int num2 = text.IndexOf(" ", num);
if (num2 == -1)
{
break;
}
string[] array2 = text.Substring(num, num2 - num).Split(',');
for (int j = 0; j < array2.Length; j++)
{
int result;
if (int.TryParse(array2[j], out result))
{
array[j] = result;
}
else
{
array[j] = 0;
}
}
}
}
public static bool GetBoolField(string[] lines, string section, int rank, string name)
{
foreach (string text in lines)
{
if (text.StartsWith(section + ":") && rank-- == 0)
{
int num = text.IndexOf(name + "=");
if (num == -1)
{
return false;
}
num += name.Length + 1;
int num2 = text.IndexOf(" ", num);
if (num2 == -1)
{
return false;
}
string value = text.Substring(num, num2 - num);
bool result;
if (bool.TryParse(value, out result))
{
return result;
}
return false;
}
}
return false;
}
public static int GetIntField(string[] lines, string section, int rank, string name)
{
foreach (string text in lines)
{
if (text.StartsWith(section + ":") && rank-- == 0)
{
int num = text.IndexOf(name + "=");
if (num == -1)
{
return 0;
}
num += name.Length + 1;
int num2 = text.IndexOf(" ", num);
if (num2 == -1)
{
return 0;
}
string s = text.Substring(num, num2 - num);
int result;
if (int.TryParse(s, out result))
{
return result;
}
return 0;
}
}
return 0;
}
public static double GetDoubleField(string[] lines, string section, int rank, string name)
{
foreach (string text in lines)
{
if (text.StartsWith(section + ":") && rank-- == 0)
{
int num = text.IndexOf(name + "=");
if (num == -1)
{
return 0.0;
}
num += name.Length + 1;
int num2 = text.IndexOf(" ", num);
if (num2 == -1)
{
return 0.0;
}
string s = text.Substring(num, num2 - num);
double result;
if (double.TryParse(s, out result))
{
return result;
}
return 0.0;
}
}
return 0.0;
}
public static TinyPoint GetPointField(string[] lines, string section, int rank, string name)
{
foreach (string text in lines)
{
if (text.StartsWith(section + ":") && rank-- == 0)
{
int num = text.IndexOf(name + "=");
if (num == -1)
{
return default;
}
num += name.Length + 1;
int num2 = text.IndexOf(";", num);
if (num2 == -1)
{
return default;
}
int num3 = text.IndexOf(" ", num);
if (num3 == -1)
{
return default;
}
string s = text.Substring(num, num2 - num);
string s2 = text.Substring(num2 + 1, num3 - num2 - 1);
int result;
if (!int.TryParse(s, out result))
{
return default;
}
int result2;
if (!int.TryParse(s2, out result2))
{
return default;
}
TinyPoint result3 = default;
result3.X = result;
result3.Y = result2;
return result3;
}
}
return default;
}
public static int? GetDecorField(string[] lines, string section, int x, int y)
{
for (int i = 0; i < lines.Length; i++)
{
string text = lines[i];
if (text.StartsWith(section + ":"))
{
text = lines[i + 1 + x];
string[] array = text.Split(',');
if (string.IsNullOrEmpty(array[y]))
{
return -1;
}
int result;
if (int.TryParse(array[y], out result))
{
return result;
}
return null;
}
}
return null;
}
public static void GetDoorsField(string[] lines, string section, int[] doors)
{
foreach (string text in lines)
{
if (!text.StartsWith(section + ":"))
{
continue;
}
string[] array = text.Substring(section.Length + 2).Split(',');
for (int j = 0; j < array.Length; j++)
{
int result;
if (string.IsNullOrEmpty(array[j]))
{
doors[j] = 1;
}
else if (int.TryParse(array[j], out result))
{
doors[j] = result;
}
}
}
}
public static void WriteClear()
{
output.Clear();
}
public static void WriteSection(string section)
{
output.Append(section);
output.Append(": ");
}
public static void WriteIntArrayField(string name, int[] array)
{
output.Append(name);
output.Append("=");
for (int i = 0; i < array.Length; i++)
{
if (array[i] != 0)
{
output.Append(array[i].ToString(CultureInfo.InvariantCulture));
}
if (i < array.Length - 1)
{
output.Append(",");
}
}
output.Append(" ");
}
public static void WriteBoolField(string name, bool n)
{
output.Append(name);
output.Append("=");
output.Append(n.ToString(CultureInfo.InvariantCulture));
output.Append(" ");
}
public static void WriteIntField(string name, int n)
{
output.Append(name);
output.Append("=");
output.Append(n.ToString(CultureInfo.InvariantCulture));
output.Append(" ");
}
public static void WriteDoubleField(string name, double n)
{
output.Append(name);
output.Append("=");
output.Append(n.ToString(CultureInfo.InvariantCulture));
output.Append(" ");
}
public static void WritePointField(string name, TinyPoint p)
{
output.Append(name);
output.Append("=");
output.Append(p.X.ToString(CultureInfo.InvariantCulture));
output.Append(";");
output.Append(p.Y.ToString(CultureInfo.InvariantCulture));
output.Append(" ");
}
public static void WriteDecorField(int[] line)
{
for (int i = 0; i < line.Length; i++)
{
if (line[i] != -1)
{
output.Append(line[i].ToString(CultureInfo.InvariantCulture));
}
if (i < line.Length - 1)
{
output.Append(",");
}
}
output.Append("\n");
}
public static void WriteDoorsField(int[] doors)
{
for (int i = 0; i < doors.Length; i++)
{
if (doors[i] != 1)
{
output.Append(doors[i].ToString(CultureInfo.InvariantCulture));
}
if (i < doors.Length - 1)
{
output.Append(",");
}
}
output.Append("\n");
}
public static void WriteEndSection()
{
output.Append("\n");
}
public static string GetWriteString()
{
return output.ToString();
}
}
#if KNI && WEB
public class LocalStorageHelper
{
private readonly IJSRuntime _jsRuntime;
// Constructor to inject IJSRuntime
public LocalStorageHelper(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public async Task SaveToLocalStorageAsync(string key, string data)
{
await _jsRuntime.InvokeVoidAsync("localStorage.setItem", key, data);
}
public async Task<string> ReadFromLocalStorageAsync(string key)
{
return await _jsRuntime.InvokeAsync<string>("localStorage.getItem", key);
}
public async Task DeleteFromLocalStorageAsync(string key)
{
await _jsRuntime.InvokeVoidAsync("localStorage.removeItem", key);
}
}
#endif
}