Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed Jun 24, 2024
1 parent e1a0b71 commit c992d22
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 49 deletions.
Binary file modified Images/shot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/shot02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/shot03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/shot04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# mt-1.0-beta1 (Project [M]icro[T]erraria codename; 1.0-beta-uwp branch)
# mt-1.0.1-beta1 (Project [M]icro[T]erraria codename; 1.0-beta-uwp branch)
This is MINIMAL UWP Terraria app. It's my own attempt to RnD of Terraria XNA game mechanics.

:: Min. Win. os build (SDK): 10240 (Astoria compatibility not tested)
:: Min. Win. os build (SDK): 10240 (Astoria compatibility added)

## Screenshots
![](Images/shot01.png)
![](Images/shot02.png)
![](Images/shot03.png)
![](Images/shot04.png)
## Screenshot(s)
![Lumia 950](Images/shot01.png)
![Lumia 950](Images/shot02.png)
![Lumia 950](Images/shot03.png)
![Lumia 950](Images/shot04.png)

## Progress of porting to uwp

:: Firm Monogame 3.8 library added (my "custom Monogame" disabled/removed)

:: Touch control seems to be ok... but buggy =) After long play "finger touch" counting autoincrementing occccccccurs.... =))))

:: Background music recovered (but wavebank after xbox->pc convert. is HUGE at now!))
Expand All @@ -31,6 +29,8 @@ This is MINIMAL UWP Terraria app. It's my own attempt to RnD of Terraria XNA gam

:: Game save / restore settings (player/genworld data storage) seem to be fixed (?) too

:: Game Screen autoscaling (auto size adjusting) realized (!)

### Content
This repo contains the decompiled source of the Terraria client binaries, from version 1.0-beta founded at [Terraria-pc-version-archive site](https://archive.org/details/terraria-pc-version-archive). Decompiled with [JetBrains dotPeek](https://www.jetbrains.com/decompiler/).

Expand Down Expand Up @@ -58,7 +58,7 @@ I am just providing the decompiled code as a reference and making it easily acce
- https://habr.com/ru/articles/122839/ Игра «Terraria» и её «хорошая» система шифрования профайлов (in Rus.)

## ..
As is. No support. Educational use/purpose only. DIY
As is. No support. Educational use/purpose only. DIY!

## .
[m][e] 2024
135 changes: 124 additions & 11 deletions Src/MT1Beta/Main/Game1.cs → Src/MT1Beta/Main/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,16 @@ public class Game1 : Game
public static bool showItemOwner = false;
public static string defaultIP = "74.132.0.65";

//private GraphicsDeviceManager graphics;
//private SpriteBatch spriteBatch;

// Resources for drawing.
private GraphicsDeviceManager graphics;
private SpriteBatch spriteBatch;
Vector2 baseScreenSize = new Vector2(800, /*480*/600);
private Matrix globalTransformation;
int backbufferWidth, backbufferHeight;


public static MouseState mouseState1 = Mouse.GetState();
public static TouchCollection mouseState = TouchPanel.GetState();//Experimental
Expand Down Expand Up @@ -428,8 +436,33 @@ public class Game1 : Game
private int focusColor = 0;
private int colorDelay = 0;

//[DllImport("User32")]
private static /*extern*/ int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags)
// some helpful static properties
public static Game1 Instance { get; private set; }

public static Viewport Viewport
{
get
{
return Instance.GraphicsDevice.Viewport;
}
}

public static Vector2 ScreenSize
{
get
{
return new Vector2
(
480/*Viewport.Width*/,
800/*Viewport.Height*/
);
}
}



//[DllImport("User32")]
private static /*extern*/ int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags)
{
return default;
}
Expand Down Expand Up @@ -572,17 +605,40 @@ private static string nextLoadWorld()

public Game1()
{
this.graphics = new GraphicsDeviceManager((Game) this);
this.Content.RootDirectory = "Content";
//this.graphics = new GraphicsDeviceManager((Game) this);
//this.Content.RootDirectory = "Content";
Instance = this;

// here we define the screen
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferHeight = 800;//1080;
graphics.PreferredBackBufferWidth = 480;//1920;
graphics.IsFullScreen = true; // set it true for W10M

graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft
| DisplayOrientation.LandscapeRight | DisplayOrientation.Portrait;

Content.RootDirectory = "Content";

// these are to unlink it from MonoGame's default frame rate
// and to use variable timesteps for update cycles
Instance.IsFixedTimeStep = false;

}

protected override void Initialize()
{
if (Game1.rand == null)
Game1.rand = new Random((int) DateTime.Now.Ticks);

if (WorldGen.genRand == null)
WorldGen.genRand = new Random((int) DateTime.Now.Ticks);

//RnD
ScalePresentationArea();

this.OpenSettings();

int num = Game1.rand.Next(3);
if (num == 0)
this.Window.Title = "Terraria: Dig Peon, Dig!";
Expand Down Expand Up @@ -860,10 +916,37 @@ protected override void Initialize()
Game1.RemoveMenu(systemMenu, menuItemCount - 1, 1024);
}



// load the base initialize first
base.Initialize();

// all other initializations come after base
// TODO: test this zone!

Star.SpawnStars();
}


public void ScalePresentationArea()
{
//Work out how much we need to scale our graphics to fill the screen
backbufferWidth = GraphicsDevice.PresentationParameters.BackBufferWidth - 0; // 40 - dirty hack for Astoria!
backbufferHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;

float horScaling = backbufferWidth / baseScreenSize.X;
float verScaling = backbufferHeight / baseScreenSize.Y;

Vector3 screenScalingFactor = new Vector3(horScaling, verScaling, 1);

globalTransformation = Matrix.CreateScale(screenScalingFactor);

System.Diagnostics.Debug.WriteLine("Screen Size - Width["
+ GraphicsDevice.PresentationParameters.BackBufferWidth + "] " +
"Height [" + GraphicsDevice.PresentationParameters.BackBufferHeight + "]");
}


protected override void LoadContent()
{
Game1.engine = new AudioEngine("Content\\TerrariaMusic.xgs");
Expand All @@ -873,7 +956,10 @@ protected override void LoadContent()
for (int index = 1; index < 6; ++index)
Game1.music[index] = Game1.soundBank.GetCue("Music_" + (object) index);

//!
this.spriteBatch = new SpriteBatch(this.GraphicsDevice);


for (int index = 0; index < 76; ++index)
Game1.tileTexture[index] = this.Content.Load<Texture2D>("Images\\Tiles_" + (object) index);
for (int index = 1; index < 13; ++index)
Expand Down Expand Up @@ -1087,9 +1173,20 @@ protected void UpdateMusic()

protected override void Update(GameTime gameTime)
{
// *****************
//Confirm the screen has not been resized by the user
if (backbufferHeight != GraphicsDevice.PresentationParameters.BackBufferHeight ||
backbufferWidth != GraphicsDevice.PresentationParameters.BackBufferWidth)
{
ScalePresentationArea();
}
// *****************

this.UpdateMusic();

if (Game1.rand == null)//(Game1.rand.Next(99999) == 0)
Game1.rand = new Random((int) DateTime.Now.Ticks);

++Game1.updateTime;
if (Game1.updateTime >= 60)
{
Expand Down Expand Up @@ -6048,10 +6145,16 @@ public static void CursorColor()

protected override void Draw(GameTime gameTime)
{

if (!this.IsActive)
return;

int pX = 0;
//RnD
this.GraphicsDevice.Clear(Color.Black);
this.spriteBatch.Begin(SpriteSortMode.Immediate, null,
null, null, null, null, globalTransformation);

int pX = 0;
int pY = 0;
if (Game1.mouseState.Count > 0)
{
Expand Down Expand Up @@ -6127,25 +6230,35 @@ protected override void Draw(GameTime gameTime)
Game1.screenPosition.Y = (float) ((double) Game1.bottomWorld - (double) Game1.screenHeight - 336.0 - 32.0);
}

this.GraphicsDevice.Clear(Color.Black);
//this.GraphicsDevice.Clear(Color.Black);

//this.spriteBatch.Begin();


base.Draw(gameTime);
this.spriteBatch.Begin();


double num3 = 0.5;
int num4 = (int) (-Math.IEEERemainder((double) Game1.screenPosition.X * num3,
(double) Game1.backgroundWidth[Game1.background]) - (double) (Game1.backgroundWidth[Game1.background] / 2));
(double) Game1.backgroundWidth[Game1.background])
- (double) (Game1.backgroundWidth[Game1.background] / 2));

int num5 = Game1.screenWidth / Game1.backgroundWidth[Game1.background] + 2;
int y1 = (int) (-(double) Game1.screenPosition.Y / (Game1.worldSurface * 16.0 -
(double) Game1.screenHeight) * (double) (Game1.backgroundHeight[Game1.background] - Game1.screenHeight));
(double) Game1.screenHeight) * (double) (
Game1.backgroundHeight[Game1.background] - Game1.screenHeight));

if (Game1.gameMenu || Game1.netMode == 2)
y1 = -200;
Color white1 = Color.White;
int x1 = (int) (Game1.time / 54000.0 * (double) (Game1.screenWidth + Game1.sunTexture.Width * 2)) - Game1.sunTexture.Width;
int x1 = (int) (Game1.time / 54000.0 * (double) (Game1.screenWidth
+ Game1.sunTexture.Width * 2)) - Game1.sunTexture.Width;
int num6 = 0;
Color white2 = Color.White;
float scale1 = 1f;
float rotation1 = (float) (Game1.time / 54000.0 * 2.0 - 7.3000001907348633);
int x2 = (int) (Game1.time / 32400.0 * (double) (Game1.screenWidth + Game1.moonTexture.Width * 2)) - Game1.moonTexture.Width;
int x2 = (int) (Game1.time / 32400.0 * (double) (Game1.screenWidth
+ Game1.moonTexture.Width * 2)) - Game1.moonTexture.Width;
int num7 = 0;
Color white3 = Color.White;
float scale2 = 1f;
Expand Down
6 changes: 3 additions & 3 deletions Src/MT1Beta/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp iot">
<Identity Name="ME.MT1Beta1" Publisher="CN=mediaexplorer" Version="1.0.0.0" />
<Identity Name="ME.MT1Beta1" Publisher="CN=Admin" Version="1.0.1.0" />
<mp:PhoneIdentity PhoneProductId="5e06543d-af2a-4105-4a80-eb18c64e4724" PhonePublisherId="50000045-6565-4035-4000-200280350024" />
<Properties>
<DisplayName>MTerraria v1-beta1</DisplayName>
<DisplayName>MTerraria v1.0.1-beta</DisplayName>
<PublisherDisplayName>mediaexplorer</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
Expand All @@ -15,7 +15,7 @@
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="GameManager.App">
<uap:VisualElements DisplayName="MTerraria 1-beta" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="Jumping and Gravity UWP sample" BackgroundColor="#464646">
<uap:VisualElements DisplayName="MTerraria 1.0.1-beta" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="MicroTerraria game sample (UWP app)" BackgroundColor="#464646">
<uap:SplashScreen Image="Assets\SplashScreen.png" />
<uap:DefaultTile Square71x71Logo="Assets\SmallTile.png" Wide310x150Logo="Assets\WideTile.png" Square310x310Logo="Assets\LargeTile.png">
</uap:DefaultTile>
Expand Down
50 changes: 25 additions & 25 deletions Src/MT1Beta/mt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<AppxBundle>Always</AppxBundle>
<AppxBundle>Never</AppxBundle>
<AppxBundlePlatforms>arm</AppxBundlePlatforms>
<AppInstallerUpdateFrequency>0</AppInstallerUpdateFrequency>
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
<PackageCertificateThumbprint>9799F1FE49F3C3576A892AD5A413ECFEDAB3DD9C</PackageCertificateThumbprint>
<PackageCertificateThumbprint>
</PackageCertificateThumbprint>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
Expand Down Expand Up @@ -140,7 +141,7 @@
<Compile Include="Main\Lighting.cs" />
<Compile Include="Main\Liquid.cs" />
<Compile Include="Main\LiquidBuffer.cs" />
<Compile Include="Main\Game1.cs" />
<Compile Include="Main\Game.cs" />
<Compile Include="Main\messageBuffer.cs" />
<Compile Include="Main\NetMessage.cs" />
<Compile Include="Main\Netplay.cs" />
Expand Down Expand Up @@ -235,28 +236,6 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite">
<Version>1.1.4</Version>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<Version>1.1.4</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="MonoGame.Framework.WindowsUniversal">
<Version>3.8.0.1641</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="System.Threading.Thread">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="Content\Fonts\Combat_Text.xnb" />
<Content Include="Content\Fonts\Death_Text.xnb" />
Expand Down Expand Up @@ -1880,6 +1859,27 @@
<Content Include="Content\Wave Bank.xwb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite">
<Version>1.1.4</Version>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<Version>1.1.4</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="MonoGame.Framework.WindowsUniversal">
<Version>3.8.0.1641</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="mt_TemporaryKey.pfx" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
Expand Down

0 comments on commit c992d22

Please sign in to comment.