Skip to content

Commit

Permalink
Version 0.8.4. Logo added. Monster balance changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickcreamer committed Nov 6, 2015
1 parent 3c79fa4 commit 4c9f13b
Show file tree
Hide file tree
Showing 39 changed files with 777 additions and 436 deletions.
344 changes: 200 additions & 144 deletions Forays/Actor.cs

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions Forays/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,18 @@ public bool YesOrNoPrompt(string s,bool easy_cancel){
MouseUI.PushButtonMap(MouseMode.YesNoPrompt);
MouseUI.CreateButton(ConsoleKey.Y,false,2,Global.MAP_OFFSET_COLS + s.Length + 1,1,2);
MouseUI.CreateButton(ConsoleKey.N,false,2,Global.MAP_OFFSET_COLS + s.Length + 4,1,2);
if(MouseUI.descend_hack && UI.viewing_commands_idx == 0){ //todo hack fixme - this moved, so double check its new position.
MouseUI.CreateStatsButton(ConsoleKey.N,false,16,1);
if(MouseUI.descend_hack){
for(int i=0;i<Global.SCREEN_H;++i){
if(MouseUI.mouselook_objects[i,0] != null){
Tile t = MouseUI.mouselook_objects[i,0] as Tile;
if(t?.type == TileType.STAIRS){
MouseUI.CreateStatsButton(ConsoleKey.N,false,i,1);
}
}
}
if(UI.viewing_commands_idx == 1){
MouseUI.CreateStatsButton(ConsoleKey.N,false,Global.SCREEN_H-5,1);
}
MouseUI.descend_hack = false;
}
DisplayNow(s + " (y/n): ");
Expand Down
48 changes: 25 additions & 23 deletions Forays/ConsoleForays.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Forays</RootNamespace>
<AssemblyName>ConsoleForays</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
Expand All @@ -28,9 +27,10 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<UseMSBuildEngine>False</UseMSBuildEngine>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand Down Expand Up @@ -69,9 +69,7 @@
<Compile Include="Actor.cs" />
<Compile Include="Buffer.cs" />
<Compile Include="Effect.cs" />
<Compile Include="GameWindow.cs" />
<Compile Include="GL.cs" />
<Compile Include="GLAnimation.cs" />
<Compile Include="Global.cs" />
<Compile Include="Help.cs" />
<Compile Include="Item.cs" />
Expand All @@ -85,10 +83,15 @@
<Compile Include="Spell.cs" />
<Compile Include="Tile.cs" />
<Compile Include="Utility.cs" />
<Compile Include="PosArray.cs" />
<Compile Include="Input.cs" />
<Compile Include="UI.cs" />
<Compile Include="MouseUI.cs" />
<Compile Include="Color.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="advanced_help.txt">
Expand All @@ -97,30 +100,14 @@
<Content Include="feat_help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font12x24.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font16x32.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font6x12.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font8x16.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="highscore.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="highscore.txt" />
<Content Include="item_help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="options.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="options.txt" />
<Content Include="spell_help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand All @@ -146,4 +133,19 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<EmbeddedResource Include="forays.ico" />
<EmbeddedResource Include="logo.png" />
<EmbeddedResource Include="font6x12.png" />
<EmbeddedResource Include="font8x16.png" />
<EmbeddedResource Include="font10x20.png" />
<EmbeddedResource Include="font12x24.png" />
<EmbeddedResource Include="font16x32.png" />
<EmbeddedResource Include="font12x18.png" />
<EmbeddedResource Include="font18x36.png" />
<EmbeddedResource Include="font21x38.png" />
<EmbeddedResource Include="font8x12.png" />
<EmbeddedResource Include="font15x27.png" />
<EmbeddedResource Include="font14x28.png" />
</ItemGroup>
</Project>
17 changes: 17 additions & 0 deletions Forays/ConsoleForays.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleForays", "ConsoleForays.csproj", "{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
29 changes: 16 additions & 13 deletions Forays/Forays.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<UseMSBuildEngine>False</UseMSBuildEngine>
<ApplicationIcon>forays.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand Down Expand Up @@ -98,18 +98,6 @@
<Content Include="feat_help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font12x24.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font16x32.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font6x12.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="font8x16.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="help.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -143,4 +131,19 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<EmbeddedResource Include="forays.ico" />
<EmbeddedResource Include="logo.png" />
<EmbeddedResource Include="font6x12.png" />
<EmbeddedResource Include="font8x16.png" />
<EmbeddedResource Include="font10x20.png" />
<EmbeddedResource Include="font12x24.png" />
<EmbeddedResource Include="font16x32.png" />
<EmbeddedResource Include="font12x18.png" />
<EmbeddedResource Include="font18x36.png" />
<EmbeddedResource Include="font21x38.png" />
<EmbeddedResource Include="font8x12.png" />
<EmbeddedResource Include="font15x27.png" />
<EmbeddedResource Include="font14x28.png" />
</ItemGroup>
</Project>
38 changes: 24 additions & 14 deletions Forays/GL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The above copyright notice and this permission notice shall be included in all c
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
using System.Reflection;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
Expand Down Expand Up @@ -248,8 +250,6 @@ public void UpdatePositionVertexArray(Surface s,int start_index,IList<int> index
}
float width_ratio = 2.0f / (float)Viewport.Width;
float height_ratio = 2.0f / (float)Viewport.Height;
//float width_ratio = 2.0f / (float)ClientRectangle.Width; //todo: eventually this part might not be based on the current window. Seems like a good idea.
//float height_ratio = 2.0f / (float)ClientRectangle.Height;
int current_total = 0;
foreach(int i in index_list){
float x_offset = (float)s.layouts[layout_list[current_total]].HorizontalOffsetPx;
Expand Down Expand Up @@ -316,8 +316,6 @@ public void UpdatePositionSingleVertex(Surface s,int index,int layout = 0){
float[] values = new float[4 * s.vbo.PositionDimensions]; //2 or 3 dimensions for 4 vertices
float width_ratio = 2.0f / (float)Viewport.Width;
float height_ratio = 2.0f / (float)Viewport.Height;
//float width_ratio = 2.0f / (float)ClientRectangle.Width; //todo: eventually this part might not be based on the current window. Seems like a good idea.
//float height_ratio = 2.0f / (float)ClientRectangle.Height;
float x_offset = (float)s.layouts[layout].HorizontalOffsetPx;
float y_offset = (float)s.layouts[layout].VerticalOffsetPx;
float x_w = (float)s.layouts[layout].CellWidthPx;
Expand Down Expand Up @@ -562,16 +560,16 @@ public class Surface{
public SurfaceUpdateMethod UpdateOtherDataOnlyMethod = null;
protected Surface(){}
public static Surface Create(GLWindow window_,string texture_filename,params int[] vertex_attrib_counts){
return Create(window_,texture_filename,Shader.DefaultFS(),false,vertex_attrib_counts);
return Create(window_,texture_filename,false,Shader.DefaultFS(),false,vertex_attrib_counts);
}
public static Surface Create(GLWindow window_,string texture_filename,string frag_shader,bool has_depth,params int[] vertex_attrib_counts){
public static Surface Create(GLWindow window_,string texture_filename,bool loadTextureFromEmbeddedResource,string frag_shader,bool has_depth,params int[] vertex_attrib_counts){
Surface s = new Surface();
s.window = window_;
int dims = has_depth? 3 : 2;
s.UseDepthBuffer = has_depth;
VertexAttributes attribs = VertexAttributes.Create(vertex_attrib_counts);
s.vbo = VBO.Create(dims,attribs);
s.texture = Texture.Create(texture_filename);
s.texture = Texture.Create(texture_filename,null,loadTextureFromEmbeddedResource);
s.shader = Shader.Create(frag_shader);
if(window_ != null){
window_.Surfaces.Add(s);
Expand Down Expand Up @@ -781,19 +779,19 @@ public class Texture{
protected static int next_texture = 0;
protected static int max_textures = -1; //Currently, max_textures serves only to crash in a better way. Eventually I'll figure out how to swap texture units around, todo!
protected static Dictionary<string,Texture> texture_info = new Dictionary<string,Texture>(); //the Textures contained herein are used only to store index/height/width
public static Texture Create(string filename,string textureToReplace = null){
public static Texture Create(string filename,string textureToReplace = null,bool loadFromEmbeddedResource = false){
Texture t = new Texture();
t.Sprite = new List<SpriteType>();
if(textureToReplace != null){
t.ReplaceTexture(filename,textureToReplace);
t.ReplaceTexture(filename,textureToReplace,loadFromEmbeddedResource);
}
else{
t.LoadTexture(filename);
t.LoadTexture(filename,loadFromEmbeddedResource);
}
return t;
}
protected Texture(){}
protected void LoadTexture(string filename){
protected void LoadTexture(string filename,bool loadFromEmbeddedResource = false){
if(String.IsNullOrEmpty(filename)){
throw new ArgumentException(filename);
}
Expand All @@ -814,7 +812,13 @@ protected void LoadTexture(string filename){
GL.ActiveTexture(TextureUnit.Texture0 + num);
int id = GL.GenTexture(); //todo: eventually i'll want to support more than 16 or 32 textures. At that time I'll need to store this ID somewhere.
GL.BindTexture(TextureTarget.Texture2D,id); //maybe a list of Scenes which are lists of textures needed, and then i'll bind all those and make sure to track their texture units.
Bitmap bmp = new Bitmap(filename);
Bitmap bmp;
if(loadFromEmbeddedResource){
bmp = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(filename));
}
else{
bmp = new Bitmap(filename);
}
BitmapData bmp_data = bmp.LockBits(new Rectangle(0,0,bmp.Width,bmp.Height),ImageLockMode.ReadOnly,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.Rgba,bmp_data.Width,bmp_data.Height,0,OpenTK.Graphics.OpenGL.PixelFormat.Bgra,PixelType.UnsignedByte,bmp_data.Scan0);
bmp.UnlockBits(bmp_data);
Expand All @@ -830,7 +834,7 @@ protected void LoadTexture(string filename){
texture_info.Add(filename,t);
}
}
protected void ReplaceTexture(string filename,string replaced){
protected void ReplaceTexture(string filename,string replaced,bool loadFromEmbeddedResource = false){
if(String.IsNullOrEmpty(filename)){
throw new ArgumentException(filename);
}
Expand Down Expand Up @@ -858,7 +862,13 @@ protected void ReplaceTexture(string filename,string replaced){
GL.ActiveTexture(TextureUnit.Texture0 + num);
int id = GL.GenTexture(); //todo: eventually i'll want to support more than 16 or 32 textures. At that time I'll need to store this ID somewhere.
GL.BindTexture(TextureTarget.Texture2D,id); //maybe a list of Scenes which are lists of textures needed, and then i'll bind all those and make sure to track their texture units.
Bitmap bmp = new Bitmap(filename);
Bitmap bmp;
if(loadFromEmbeddedResource){
bmp = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(filename));
}
else{
bmp = new Bitmap(filename);
}
BitmapData bmp_data = bmp.LockBits(new Rectangle(0,0,bmp.Width,bmp.Height),ImageLockMode.ReadOnly,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.Rgba,bmp_data.Width,bmp_data.Height,0,OpenTK.Graphics.OpenGL.PixelFormat.Bgra,PixelType.UnsignedByte,bmp_data.Scan0);
bmp.UnlockBits(bmp_data);
Expand Down
Loading

0 comments on commit 4c9f13b

Please sign in to comment.