Skip to content

Commit 4c9f13b

Browse files
Version 0.8.4. Logo added. Monster balance changes.
1 parent 3c79fa4 commit 4c9f13b

39 files changed

+777
-436
lines changed

Forays/Actor.cs

Lines changed: 200 additions & 144 deletions
Large diffs are not rendered by default.

Forays/Buffer.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,18 @@ public bool YesOrNoPrompt(string s,bool easy_cancel){
353353
MouseUI.PushButtonMap(MouseMode.YesNoPrompt);
354354
MouseUI.CreateButton(ConsoleKey.Y,false,2,Global.MAP_OFFSET_COLS + s.Length + 1,1,2);
355355
MouseUI.CreateButton(ConsoleKey.N,false,2,Global.MAP_OFFSET_COLS + s.Length + 4,1,2);
356-
if(MouseUI.descend_hack && UI.viewing_commands_idx == 0){ //todo hack fixme - this moved, so double check its new position.
357-
MouseUI.CreateStatsButton(ConsoleKey.N,false,16,1);
356+
if(MouseUI.descend_hack){
357+
for(int i=0;i<Global.SCREEN_H;++i){
358+
if(MouseUI.mouselook_objects[i,0] != null){
359+
Tile t = MouseUI.mouselook_objects[i,0] as Tile;
360+
if(t?.type == TileType.STAIRS){
361+
MouseUI.CreateStatsButton(ConsoleKey.N,false,i,1);
362+
}
363+
}
364+
}
365+
if(UI.viewing_commands_idx == 1){
366+
MouseUI.CreateStatsButton(ConsoleKey.N,false,Global.SCREEN_H-5,1);
367+
}
358368
MouseUI.descend_hack = false;
359369
}
360370
DisplayNow(s + " (y/n): ");

Forays/ConsoleForays.csproj

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Forays</RootNamespace>
1111
<AssemblyName>ConsoleForays</AssemblyName>
12-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1312
<FileAlignment>512</FileAlignment>
1413
<TargetFrameworkProfile />
1514
<PublishUrl>publish\</PublishUrl>
@@ -28,9 +27,10 @@
2827
<UseApplicationTrust>false</UseApplicationTrust>
2928
<BootstrapperEnabled>true</BootstrapperEnabled>
3029
<UseMSBuildEngine>False</UseMSBuildEngine>
30+
<ProductVersion>8.0.30703</ProductVersion>
31+
<SchemaVersion>2.0</SchemaVersion>
3132
</PropertyGroup>
3233
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
33-
<PlatformTarget>AnyCPU</PlatformTarget>
3434
<DebugSymbols>true</DebugSymbols>
3535
<DebugType>full</DebugType>
3636
<Optimize>false</Optimize>
@@ -69,9 +69,7 @@
6969
<Compile Include="Actor.cs" />
7070
<Compile Include="Buffer.cs" />
7171
<Compile Include="Effect.cs" />
72-
<Compile Include="GameWindow.cs" />
7372
<Compile Include="GL.cs" />
74-
<Compile Include="GLAnimation.cs" />
7573
<Compile Include="Global.cs" />
7674
<Compile Include="Help.cs" />
7775
<Compile Include="Item.cs" />
@@ -85,10 +83,15 @@
8583
<Compile Include="Spell.cs" />
8684
<Compile Include="Tile.cs" />
8785
<Compile Include="Utility.cs" />
86+
<Compile Include="PosArray.cs" />
87+
<Compile Include="Input.cs" />
88+
<Compile Include="UI.cs" />
89+
<Compile Include="MouseUI.cs" />
90+
<Compile Include="Color.cs" />
8891
</ItemGroup>
8992
<ItemGroup>
90-
<None Include="App.config" />
9193
<None Include="packages.config" />
94+
<None Include="App.config" />
9295
</ItemGroup>
9396
<ItemGroup>
9497
<Content Include="advanced_help.txt">
@@ -97,30 +100,14 @@
97100
<Content Include="feat_help.txt">
98101
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
99102
</Content>
100-
<Content Include="font12x24.bmp">
101-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
102-
</Content>
103-
<Content Include="font16x32.bmp">
104-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
105-
</Content>
106-
<Content Include="font6x12.bmp">
107-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
108-
</Content>
109-
<Content Include="font8x16.bmp">
110-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
111-
</Content>
112103
<Content Include="help.txt">
113104
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
114105
</Content>
115-
<Content Include="highscore.txt">
116-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
117-
</Content>
106+
<Content Include="highscore.txt" />
118107
<Content Include="item_help.txt">
119108
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
120109
</Content>
121-
<Content Include="options.txt">
122-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
123-
</Content>
110+
<Content Include="options.txt" />
124111
<Content Include="spell_help.txt">
125112
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
126113
</Content>
@@ -146,4 +133,19 @@
146133
<Target Name="AfterBuild">
147134
</Target>
148135
-->
136+
<ItemGroup>
137+
<EmbeddedResource Include="forays.ico" />
138+
<EmbeddedResource Include="logo.png" />
139+
<EmbeddedResource Include="font6x12.png" />
140+
<EmbeddedResource Include="font8x16.png" />
141+
<EmbeddedResource Include="font10x20.png" />
142+
<EmbeddedResource Include="font12x24.png" />
143+
<EmbeddedResource Include="font16x32.png" />
144+
<EmbeddedResource Include="font12x18.png" />
145+
<EmbeddedResource Include="font18x36.png" />
146+
<EmbeddedResource Include="font21x38.png" />
147+
<EmbeddedResource Include="font8x12.png" />
148+
<EmbeddedResource Include="font15x27.png" />
149+
<EmbeddedResource Include="font14x28.png" />
150+
</ItemGroup>
149151
</Project>

Forays/ConsoleForays.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleForays", "ConsoleForays.csproj", "{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{392222EF-9EEE-45F8-AFAE-260D9D06C4C9}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
EndGlobal

Forays/Forays.csproj

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
<UseApplicationTrust>false</UseApplicationTrust>
2828
<BootstrapperEnabled>true</BootstrapperEnabled>
2929
<UseMSBuildEngine>False</UseMSBuildEngine>
30+
<ApplicationIcon>forays.ico</ApplicationIcon>
3031
</PropertyGroup>
3132
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
32-
<PlatformTarget>AnyCPU</PlatformTarget>
3333
<DebugSymbols>true</DebugSymbols>
3434
<DebugType>full</DebugType>
3535
<Optimize>false</Optimize>
@@ -98,18 +98,6 @@
9898
<Content Include="feat_help.txt">
9999
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
100100
</Content>
101-
<Content Include="font12x24.bmp">
102-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
103-
</Content>
104-
<Content Include="font16x32.bmp">
105-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
106-
</Content>
107-
<Content Include="font6x12.bmp">
108-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
109-
</Content>
110-
<Content Include="font8x16.bmp">
111-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
112-
</Content>
113101
<Content Include="help.txt">
114102
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
115103
</Content>
@@ -143,4 +131,19 @@
143131
<Target Name="AfterBuild">
144132
</Target>
145133
-->
134+
<ItemGroup>
135+
<EmbeddedResource Include="forays.ico" />
136+
<EmbeddedResource Include="logo.png" />
137+
<EmbeddedResource Include="font6x12.png" />
138+
<EmbeddedResource Include="font8x16.png" />
139+
<EmbeddedResource Include="font10x20.png" />
140+
<EmbeddedResource Include="font12x24.png" />
141+
<EmbeddedResource Include="font16x32.png" />
142+
<EmbeddedResource Include="font12x18.png" />
143+
<EmbeddedResource Include="font18x36.png" />
144+
<EmbeddedResource Include="font21x38.png" />
145+
<EmbeddedResource Include="font8x12.png" />
146+
<EmbeddedResource Include="font15x27.png" />
147+
<EmbeddedResource Include="font14x28.png" />
148+
</ItemGroup>
146149
</Project>

Forays/GL.cs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The above copyright notice and this permission notice shall be included in all c
1212
using System.Collections.Generic;
1313
using System.Diagnostics;
1414
using System.Runtime.InteropServices;
15+
using System.IO;
16+
using System.Reflection;
1517
using OpenTK;
1618
using OpenTK.Graphics;
1719
using OpenTK.Graphics.OpenGL;
@@ -248,8 +250,6 @@ public void UpdatePositionVertexArray(Surface s,int start_index,IList<int> index
248250
}
249251
float width_ratio = 2.0f / (float)Viewport.Width;
250252
float height_ratio = 2.0f / (float)Viewport.Height;
251-
//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.
252-
//float height_ratio = 2.0f / (float)ClientRectangle.Height;
253253
int current_total = 0;
254254
foreach(int i in index_list){
255255
float x_offset = (float)s.layouts[layout_list[current_total]].HorizontalOffsetPx;
@@ -316,8 +316,6 @@ public void UpdatePositionSingleVertex(Surface s,int index,int layout = 0){
316316
float[] values = new float[4 * s.vbo.PositionDimensions]; //2 or 3 dimensions for 4 vertices
317317
float width_ratio = 2.0f / (float)Viewport.Width;
318318
float height_ratio = 2.0f / (float)Viewport.Height;
319-
//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.
320-
//float height_ratio = 2.0f / (float)ClientRectangle.Height;
321319
float x_offset = (float)s.layouts[layout].HorizontalOffsetPx;
322320
float y_offset = (float)s.layouts[layout].VerticalOffsetPx;
323321
float x_w = (float)s.layouts[layout].CellWidthPx;
@@ -562,16 +560,16 @@ public class Surface{
562560
public SurfaceUpdateMethod UpdateOtherDataOnlyMethod = null;
563561
protected Surface(){}
564562
public static Surface Create(GLWindow window_,string texture_filename,params int[] vertex_attrib_counts){
565-
return Create(window_,texture_filename,Shader.DefaultFS(),false,vertex_attrib_counts);
563+
return Create(window_,texture_filename,false,Shader.DefaultFS(),false,vertex_attrib_counts);
566564
}
567-
public static Surface Create(GLWindow window_,string texture_filename,string frag_shader,bool has_depth,params int[] vertex_attrib_counts){
565+
public static Surface Create(GLWindow window_,string texture_filename,bool loadTextureFromEmbeddedResource,string frag_shader,bool has_depth,params int[] vertex_attrib_counts){
568566
Surface s = new Surface();
569567
s.window = window_;
570568
int dims = has_depth? 3 : 2;
571569
s.UseDepthBuffer = has_depth;
572570
VertexAttributes attribs = VertexAttributes.Create(vertex_attrib_counts);
573571
s.vbo = VBO.Create(dims,attribs);
574-
s.texture = Texture.Create(texture_filename);
572+
s.texture = Texture.Create(texture_filename,null,loadTextureFromEmbeddedResource);
575573
s.shader = Shader.Create(frag_shader);
576574
if(window_ != null){
577575
window_.Surfaces.Add(s);
@@ -781,19 +779,19 @@ public class Texture{
781779
protected static int next_texture = 0;
782780
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!
783781
protected static Dictionary<string,Texture> texture_info = new Dictionary<string,Texture>(); //the Textures contained herein are used only to store index/height/width
784-
public static Texture Create(string filename,string textureToReplace = null){
782+
public static Texture Create(string filename,string textureToReplace = null,bool loadFromEmbeddedResource = false){
785783
Texture t = new Texture();
786784
t.Sprite = new List<SpriteType>();
787785
if(textureToReplace != null){
788-
t.ReplaceTexture(filename,textureToReplace);
786+
t.ReplaceTexture(filename,textureToReplace,loadFromEmbeddedResource);
789787
}
790788
else{
791-
t.LoadTexture(filename);
789+
t.LoadTexture(filename,loadFromEmbeddedResource);
792790
}
793791
return t;
794792
}
795793
protected Texture(){}
796-
protected void LoadTexture(string filename){
794+
protected void LoadTexture(string filename,bool loadFromEmbeddedResource = false){
797795
if(String.IsNullOrEmpty(filename)){
798796
throw new ArgumentException(filename);
799797
}
@@ -814,7 +812,13 @@ protected void LoadTexture(string filename){
814812
GL.ActiveTexture(TextureUnit.Texture0 + num);
815813
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.
816814
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.
817-
Bitmap bmp = new Bitmap(filename);
815+
Bitmap bmp;
816+
if(loadFromEmbeddedResource){
817+
bmp = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(filename));
818+
}
819+
else{
820+
bmp = new Bitmap(filename);
821+
}
818822
BitmapData bmp_data = bmp.LockBits(new Rectangle(0,0,bmp.Width,bmp.Height),ImageLockMode.ReadOnly,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
819823
GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.Rgba,bmp_data.Width,bmp_data.Height,0,OpenTK.Graphics.OpenGL.PixelFormat.Bgra,PixelType.UnsignedByte,bmp_data.Scan0);
820824
bmp.UnlockBits(bmp_data);
@@ -830,7 +834,7 @@ protected void LoadTexture(string filename){
830834
texture_info.Add(filename,t);
831835
}
832836
}
833-
protected void ReplaceTexture(string filename,string replaced){
837+
protected void ReplaceTexture(string filename,string replaced,bool loadFromEmbeddedResource = false){
834838
if(String.IsNullOrEmpty(filename)){
835839
throw new ArgumentException(filename);
836840
}
@@ -858,7 +862,13 @@ protected void ReplaceTexture(string filename,string replaced){
858862
GL.ActiveTexture(TextureUnit.Texture0 + num);
859863
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.
860864
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.
861-
Bitmap bmp = new Bitmap(filename);
865+
Bitmap bmp;
866+
if(loadFromEmbeddedResource){
867+
bmp = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(filename));
868+
}
869+
else{
870+
bmp = new Bitmap(filename);
871+
}
862872
BitmapData bmp_data = bmp.LockBits(new Rectangle(0,0,bmp.Width,bmp.Height),ImageLockMode.ReadOnly,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
863873
GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.Rgba,bmp_data.Width,bmp_data.Height,0,OpenTK.Graphics.OpenGL.PixelFormat.Bgra,PixelType.UnsignedByte,bmp_data.Scan0);
864874
bmp.UnlockBits(bmp_data);

0 commit comments

Comments
 (0)