From a2089c0ae1005017cb2ce3c85ddece8ca836d039 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Wed, 25 Sep 2019 10:50:50 -0500 Subject: [PATCH] Fixed demo feature crashing game --- lib/game_objects/entities/player.rb | 1 - lib/states/game_states/game.rb | 12 ++++++------ lib/states/game_states/loading_state.rb | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/game_objects/entities/player.rb b/lib/game_objects/entities/player.rb index 8cf2eca..acd338f 100644 --- a/lib/game_objects/entities/player.rb +++ b/lib/game_objects/entities/player.rb @@ -130,7 +130,6 @@ class IMICFPS end def turn_left - puts "CALLED" @orientation.y += @turn_speed * delta_time end diff --git a/lib/states/game_states/game.rb b/lib/states/game_states/game.rb index edfa781..d4edd0e 100644 --- a/lib/states/game_states/game.rb +++ b/lib/states/game_states/game.rb @@ -40,8 +40,8 @@ class IMICFPS @demo_index= 0 @demo_changed = false - @demo_last_pitch = @camera.pitch - @demo_last_yaw = @camera.yaw + @demo_last_pitch = @camera.orientation.z + @demo_last_yaw = @camera.orientation.y at_exit { @demo_file.close } end @@ -138,15 +138,15 @@ class IMICFPS end if ARGV.join.include?("--savedemo") - if @camera.pitch != @demo_last_pitch || @camera.yaw != @demo_last_yaw + if @camera.orientation.z != @demo_last_pitch || @camera.orientation.y != @demo_last_yaw unless @demo_last_written_index == @demo_index @demo_last_written_index = @demo_index @demo_file.puts("tick #{@demo_index}") end - @demo_file.puts("mouse #{@camera.z} #{@camera.y}") - @demo_last_pitch = @camera.z - @demo_last_yaw = @camera.y + @demo_file.puts("mouse #{@camera.orientation.z} #{@camera.orientation.y}") + @demo_last_pitch = @camera.orientation.z + @demo_last_yaw = @camera.orientation.y end @demo_changed = false diff --git a/lib/states/game_states/loading_state.rb b/lib/states/game_states/loading_state.rb index 2550833..c031f8c 100644 --- a/lib/states/game_states/loading_state.rb +++ b/lib/states/game_states/loading_state.rb @@ -5,6 +5,7 @@ class IMICFPS title "I-MIC FPS" @subheading = Text.new("Loading Map: #{@map.metadata.name}", y: 100, size: 50, alignment: :center) + @description = Text.new("Map created by: #{@map.metadata.authors.join(", ")}\n#{@map.metadata.description}", y: 180, size: 24, alignment: :center) @state = Text.new("Preparing...", y: window.height/2-40, size: 40, alignment: :center) @percentage = Text.new("0%", y: window.height - 100 + 25, size: 50, alignment: :center) @@ -33,6 +34,7 @@ class IMICFPS def draw super @subheading.draw + @description.draw @state.draw