Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Feb 3, 2024
2 parents ed8e89a + c2e8651 commit 1a934d2
Show file tree
Hide file tree
Showing 19 changed files with 261 additions and 96 deletions.
1 change: 1 addition & 0 deletions Celeste64.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<Platforms>x64</Platforms>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions Content/Maps/1.map
Original file line number Diff line number Diff line change
Expand Up @@ -3917,7 +3917,7 @@
}
// brush 422
{
( 3456 3104 576 ) ( 3456 3105 576 ) ( 3456 3104 577 ) rock_1 0 0 0 1 1
( 3456 3104 576 ) ( 3456 3105 576 ) ( 3456 3104 577 ) wood_3 0 0 0 1 1
( 3456 3104 576 ) ( 3456 3104 577 ) ( 3457 3104 576 ) rock_1 0 0 0 1 1
( 3584 3104 544 ) ( 3712 3616 288 ) ( 3584 3616 288 ) wall_ruined_2 0 0 0 1 1
( 3456 3104 288 ) ( 3457 3104 288 ) ( 3456 3105 288 ) rock_1 0 0 0 1 1
Expand Down Expand Up @@ -14991,12 +14991,12 @@
"_tb_layer" "3"
// brush 0
{
( 3136 3168 480 ) ( 3136 3169 480 ) ( 3136 3168 481 ) rock_1 0 0 0 1 1
( 3040 3360 480 ) ( 3040 3360 481 ) ( 3041 3360 480 ) rock_1 0 0 0 1 1
( 3040 3168 288 ) ( 3041 3168 288 ) ( 3040 3169 288 ) rock_1 0 0 0 1 1
( 3136 3296 480 ) ( 3136 3297 480 ) ( 3137 3296 480 ) wall_ruined_6 -64 0 0 1 1
( 3136 3518 512 ) ( 3137 3518 512 ) ( 3136 3518 513 ) wood_4 0 0 0 1 1
( 3264 3296 512 ) ( 3264 3296 513 ) ( 3264 3297 512 ) rock_1 0 0 0 1 1
( 3136 3360 480 ) ( 3136 3424 288 ) ( 3136 3518 288 ) rock_1 0 0 0 1 1
( 3264 3360 480 ) ( 3264 3424 288 ) ( 3136 3424 288 ) rock_1 0 0 0 1 1
( 3264 3424 288 ) ( 3264 3518 288 ) ( 3136 3518 288 ) rock_1 0 0 0 1 1
( 3136 3518 480 ) ( 3264 3518 480 ) ( 3264 3360 480 ) wall_ruined_6 -64 0 0 1 1
( 3264 3518 288 ) ( 3264 3518 480 ) ( 3136 3518 480 ) wood_4 0 0 0 1 1
( 3264 3360 480 ) ( 3264 3518 480 ) ( 3264 3518 288 ) rock_1 0 0 0 1 1
}
}
// entity 657
Expand Down
Binary file added Content/Sprites/Controls/PC/cancel.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 added Content/Sprites/Controls/PC/confirm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ You can find prebuilt version of the game on [itch.io](https://maddymakesgamesin

### Tools Used
- [TrenchBroom](https://trenchbroom.github.io/): For Level Editing
- [Blender](https://www.blender.org/): For creating 3D Model
- [Blender](https://www.blender.org/): For creating 3D Models
- [Aseprite](https://www.aseprite.org/): For drawing Textures

### Resources Used
- [khronos glTF Tutorials](https://github.khronos.org/glTF-Tutorials/gltfTutorial/gltfTutorial_020_Skins.html#the-joint-matrices): To figure out how Mesh Skins/Bones work
- [LearnOpenGL](https://learnopengl.com/Advanced-OpenGL/Depth-testing): For general rendering concepts / normalizing Depth
- [Kenny's Input Prompts](https://kenney.nl/assets/input-prompts): For UI Button Prompts
- [Renogare](https://www.dafont.com/renogare.font): Font for Text
- [Renogare](https://www.dafont.com/renogare.font): Main font

### Created By ...
- [Maddy Thorson](http://maddymakesgames.com/)
Expand Down
2 changes: 1 addition & 1 deletion Source/Actors/Badeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Badeline() : base(Assets.Models["badeline"])
mat.Color = hairColor;
mat.Effects = 0;
}
mat.Set("u_silhouette_color", hairColor);
mat.SilhouetteColor = hairColor;
}

hair = new()
Expand Down
26 changes: 20 additions & 6 deletions Source/Actors/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public void SetHairColor(Color color)
mat.Color = color;
mat.Effects = 0;
}
mat.Set("u_silhouette_color", color);
mat.SilhouetteColor = color;
}

Hair.Color = color;
Expand Down Expand Up @@ -1489,7 +1489,7 @@ private void StClimbingUpdate()

// don't climb over ledges into spikes
// (you can still climb up into spikes if they're on the same wall as you)
if (move.Z > 0 && World.Overlaps<SpikeBlock>(Position + Vec3.UnitZ * 6 + forward * (ClimbCheckDist + 1)))
if (move.Z > 0 && World.Overlaps<SpikeBlock>(Position + Vec3.UnitZ * ClimbCheckDist + forward * (ClimbCheckDist + 1)))
move.Z = 0;

// don't move left/right around into a spikes
Expand Down Expand Up @@ -2067,16 +2067,30 @@ private CoEnumerator StCassetteRoutine()

if (cassette != null)
{
if (World.Entry.Submap || !Assets.Maps.ContainsKey(cassette.Map))
if (World.Entry.Submap)
{
Game.Instance.Goto(new Transition()
Game.Instance.Goto(new Transition()
{
Mode = Transition.Modes.Pop,
ToPause = true,
ToBlack = new SpotlightWipe(),
StopMusic = true
});
}
}
//Saves and quits game if you collect a cassette with an empty map property when you're not in a submap
else if (!Assets.Maps.ContainsKey(cassette.Map))
{
Game.Instance.Goto(new Transition()
{
Mode = Transition.Modes.Replace,
Scene = () => new Overworld(true),
ToPause = true,
ToBlack = new SpotlightWipe(),
FromBlack = new SlideWipe(),
StopMusic = true,
Saving = true
});
}
else
{
Game.Instance.Goto(new Transition()
Expand Down Expand Up @@ -2282,4 +2296,4 @@ public bool CeilingCheck(out Vec3 pushout)
public void Stop() => velocity = Vec3.Zero;

#endregion
}
}
9 changes: 6 additions & 3 deletions Source/Controls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ public static void Consume()

private static string GetPromptLocation(string name)
{
var gamepad = Input.Controllers[0].Gamepad;
var gamepadPure = Input.Controllers[0];
var gamepad = gamepadPure.Gamepad;

if (!prompts.TryGetValue(gamepad, out var list))
prompts[gamepad] = list = new();

if (!list.TryGetValue(name, out var lookup))
list[name] = lookup = $"Controls/{GetControllerName(gamepad)}/{name}";
list[name] = lookup = !gamepadPure.Connected
? $"Controls/PC/{name}"
: $"Controls/{GetControllerName(gamepad)}/{name}";

return lookup;
}
Expand All @@ -113,4 +116,4 @@ public static Subtexture GetPrompt(VirtualButton button)
{
return Assets.Subtextures.GetValueOrDefault(GetPromptLocation(button));
}
}
}
9 changes: 3 additions & 6 deletions Source/Game.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Text.Json;
using Celeste64.SpeedrunUtils;

Expand Down Expand Up @@ -177,10 +177,7 @@ public override void Update()

// perform game save between transitions
if (transition.Saving)
{
using var stream = File.Create(Path.Join(App.UserPath, Save.FileName));
Save.Serialize(stream, Save.Instance);
}
Save.Instance.SaveToFile();

// perform transition
switch (transition.Mode)
Expand Down Expand Up @@ -337,7 +334,7 @@ public override void Render()

private FMOD.RESULT MusicTimelineCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, IntPtr _event, IntPtr parameters)
{
// notify that an audio event happend (but handle it on the main thread)
// notify that an audio event happened (but handle it on the main thread)
if (transitionStep == TransitionStep.None)
audioBeatCounterEvent = true;
return FMOD.RESULT.OK;
Expand Down
2 changes: 1 addition & 1 deletion Source/Graphics/Hair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public override void Render(ref RenderState state)
state.ModelMatrix = was;

Materials[0].Color = Color;
Materials[0].Set("u_silhouette_color", Color);
Materials[0].SilhouetteColor = Color;

// draw hair
var call = new DrawCommand(state.Camera.Target, mesh, Materials[0])
Expand Down
20 changes: 17 additions & 3 deletions Source/Graphics/Materials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public class DefaultMaterial : Material
public DefaultMaterial(Texture? texture = null)
: base(Assets.Shaders["Default"])
{
Debug.Assert(Shader != null && Shader.Has(MatrixUniformName), $"Shader '{Shader.Name}' is missing '{MatrixUniformName}' uniform");
if (!(Shader?.Has(MatrixUniformName) ?? false))
{
Log.Warning($"Shader '{Shader?.Name}' is missing '{MatrixUniformName}' uniform");
}

Texture = texture;
Color = Color.White;
Effects = 1.0f;
Expand All @@ -34,13 +38,23 @@ public DefaultMaterial(Texture? texture = null)
public Matrix MVP
{
get => matrix;
set => Set(MatrixUniformName, matrix = value);
set
{
matrix = value;
if (Shader?.Has(MatrixUniformName) ?? false)
Set(MatrixUniformName, value);
}
}

public Matrix Model
{
get => model;
set => Set("u_model", model = value);
set
{
model = value;
if (Shader?.Has("u_model") ?? false)
Set("u_model", value);
}
}

public Texture? Texture
Expand Down
12 changes: 8 additions & 4 deletions Source/Graphics/Skybox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ private static void AddFace(List<SpriteVertex> verts, List<int> indices, in Vec3
public void Render(in Camera camera, in Matrix transform, float size)
{
var mat = Matrix.CreateScale(size) * transform * camera.ViewProjection;
material.Set("u_matrix", mat);
material.Set("u_near", camera.NearPlane);
material.Set("u_far", camera.FarPlane);
material.Set("u_texture", Texture);
if (material.Shader?.Has("u_matrix") ?? false)
material.Set("u_matrix", mat);
if (material.Shader?.Has("u_near") ?? false)
material.Set("u_near", camera.NearPlane);
if (material.Shader?.Has("u_far") ?? false)
material.Set("u_far", camera.FarPlane);
if (material.Shader?.Has("u_texture") ?? false)
material.Set("u_texture", Texture);

DrawCommand cmd = new(camera.Target, mesh, material)
{
Expand Down
12 changes: 8 additions & 4 deletions Source/Graphics/SpriteRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ public void Render(ref RenderState state, List<Sprite> sprites, bool postEffects

spriteMesh.SetVertices<SpriteVertex>(CollectionsMarshal.AsSpan(spriteVertices));
spriteMesh.SetIndices<int>(CollectionsMarshal.AsSpan(spriteIndices));
spriteMaterial.Set("u_matrix", state.Camera.ViewProjection);
spriteMaterial.Set("u_far", state.Camera.FarPlane);
spriteMaterial.Set("u_near", state.Camera.NearPlane);
if (spriteMaterial.Shader?.Has("u_matrix") ?? false)
spriteMaterial.Set("u_matrix", state.Camera.ViewProjection);
if (spriteMaterial.Shader?.Has("u_far") ?? false)
spriteMaterial.Set("u_far", state.Camera.FarPlane);
if (spriteMaterial.Shader?.Has("u_near") ?? false)
spriteMaterial.Set("u_near", state.Camera.NearPlane);

foreach (var batch in spriteBatches)
{
spriteMaterial.Set("u_texture", batch.Texture);
if (spriteMaterial.Shader?.Has("u_texture") ?? false)
spriteMaterial.Set("u_texture", batch.Texture);

var call = new DrawCommand(state.Camera.Target, spriteMesh, spriteMaterial)
{
Expand Down
Loading

0 comments on commit 1a934d2

Please sign in to comment.