gemwarrior 0.15.15 → 0.15.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c996dc01e73e72519d15b88e1501ac75c3e532c0bdba8cac30a3f92fa0f95436
4
- data.tar.gz: db73dd1235537fe9bda964205b803ebb6a8c84aaec171cba53f93e25e0342c81
3
+ metadata.gz: b21fc1bd7f24fd89ea21249fc371813f8402a090114faea12335b91c28bd6d5f
4
+ data.tar.gz: 2ceaab667e6229e20feab0c5a25fb04786bd8ca9178bcf51376e89f9709fc492
5
5
  SHA512:
6
- metadata.gz: 59921e22525ab8b60f00a6c63a02ca916d4d5b38b7ac4d08e41da45ebfbabc1ae2ac6b98c945ba7896a4746c581077ec85d2edfbf8dc8dbc667b966156e7b829
7
- data.tar.gz: f11c5b5b659d488a4a6eb3e8ad9115a97723ed38c10547bb906f0809031f8e0e7f2b53a5a3db9241fb94e18648fc17f79f44207997b4b41f6a3e06e65798ab32
6
+ metadata.gz: c8d2531c9c2ad46dd10835502eba47ad1a80244a1e1f593e80adea0afdb92f279b83715c6bd58d320e3c68eb3f5b16ad5e7e861b4363792dddc5ef2b7d8f63cd
7
+ data.tar.gz: 4b266ac1ed49b04ec8a61bd646e31bce83d3f8070bb880174cdf8f27966c53e9945d54ba064d32dfa3ff5234c60a665758b04272d76269598dfc5a88eee086d8
data/Rakefile CHANGED
@@ -8,10 +8,11 @@ RSpec::Core::RakeTask.new(:spec) do |task|
8
8
  end
9
9
 
10
10
  task :deploy do |t|
11
- file = Dir.glob("pkg/*").max_by {|f| File.mtime(f)}
12
-
13
11
  sh "git push origin master"
14
12
  sh "rake build"
13
+
14
+ file = Dir.glob("pkg/*").max_by {|f| File.mtime(f)}
15
+
15
16
  sh "gem push #{file}"
16
17
  end
17
18
 
data/gemwarrior.gemspec CHANGED
@@ -34,13 +34,16 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency 'matrext', '~> 1.0'
35
35
  spec.add_runtime_dependency 'os', '~> 0.9', '>= 0.9.6'
36
36
  spec.add_runtime_dependency 'psych', '~> 5.1'
37
- ## sound systems
38
- #spec.add_runtime_dependency 'feep', '~> 0.1.3'
39
- #spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
40
- #spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
37
+
38
+ ## sound systems
39
+ # spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
40
+ # spec.add_runtime_dependency 'feep', '~> 0.1.3'
41
+ # spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
42
+
41
43
  # spec.platform = Gem::Platform::RUBY
42
44
  spec.post_install_message = "Type 'gemwarrior' to start adventuring!"
43
45
  # spec.require_paths = ['lib']
46
+
44
47
  ## development deps
45
48
  spec.add_development_dependency 'awesome_print', '~> 1.9'
46
49
  spec.add_development_dependency 'bundler', '~> 2.4'
@@ -49,7 +49,10 @@ module Gemwarrior
49
49
  # create new world based on yaml/marshall data
50
50
  self.world = init_world
51
51
 
52
- # update some player aspects to make more dynamic
52
+ # spawn bosses inside world
53
+ self.init_bosses
54
+
55
+ # update some aspects of world's player to make more dynamic
53
56
  self.world.player.name = world.player.generate_name
54
57
  self.world.player.face = world.player.generate_face
55
58
  self.world.player.hands = world.player.generate_hands
@@ -63,9 +66,6 @@ module Gemwarrior
63
66
  self.world.shifty_to_jewel = false
64
67
  self.world.shifty_has_jeweled = false
65
68
 
66
- # # spawn bosses
67
- self.init_bosses
68
-
69
69
  # mark home as visited
70
70
  self.world.location_by_name('home').visited = true
71
71
 
@@ -8,7 +8,11 @@ require_relative '../game_options'
8
8
  module Gemwarrior
9
9
  module Audio
10
10
  # CONSTANTS
11
- ERROR_SOUND_NOT_ENABLED = 'Sound is disabled! Enable in main options to hear sound.'
11
+ ERROR_SOUND_NOT_ENABLED = 'Sound is disabled! Enable in main options to hear sound.'
12
+ ERROR_SOUND_SYSTEM_NOT_CHOSEN = 'Sound system not chosen! Choose one in main options to hear sound.'
13
+ ERROR_BLOOPS_NOT_FOUND = 'bloopsaphone gem not found. Try \'gem install bloopsaphone\'.'
14
+ ERROR_FEEP_NOT_FOUND = 'feep gem not found. Try \'gem install feep\'.'
15
+ ERROR_WIN32_NOT_FOUND = 'win32-sound gem not found. Try \'gem install win32-sound\'.'
12
16
 
13
17
  def self.init
14
18
  if GameOptions.data['sound_system'].eql?('win32-sound')
@@ -49,76 +53,92 @@ module Gemwarrior
49
53
 
50
54
  def self.play_synth(audio_cue_symbol)
51
55
  if GameOptions.data['sound_enabled']
52
- case GameOptions.data['sound_system']
53
- when 'win32-sound'
54
- require_relative 'audio_cues'
55
- require_relative 'musical_notes'
56
+ if GameOptions.data['sound_system']
57
+ case GameOptions.data['sound_system']
58
+ when 'win32-sound'
59
+ if system('gem list -ie win32-sound')
60
+ require_relative 'audio_cues'
61
+ require_relative 'musical_notes'
56
62
 
57
- if AudioCues.cues[audio_cue_symbol]
58
- Thread.start do
59
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
60
- threads = []
61
- seq[:frequencies].split(',').each do |note|
62
- threads << Thread.new do
63
- Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
63
+ if AudioCues.cues[audio_cue_symbol]
64
+ Thread.start do
65
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
66
+ threads = []
67
+ seq[:frequencies].split(',').each do |note|
68
+ threads << Thread.new do
69
+ Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
70
+ end
71
+ end
72
+ threads.each { |th| th.join }
64
73
  end
65
74
  end
66
- threads.each { |th| th.join }
67
75
  end
76
+ else
77
+ GameOptions.data['errors'] = ERROR_WIN32_NOT_FOUND
68
78
  end
69
- end
70
- when 'feep'
71
- require_relative 'audio_cues'
79
+ when 'feep'
80
+ if system('gem list -ie feep')
81
+ require_relative 'audio_cues'
72
82
 
73
- feep_defaults = {
74
- frequencies: '440',
75
- waveform: 'sine',
76
- volume: GameOptions.data['sound_volume'],
77
- duration: 500,
78
- notext: true
79
- }
83
+ feep_defaults = {
84
+ frequencies: '440',
85
+ waveform: 'sine',
86
+ volume: GameOptions.data['sound_volume'],
87
+ duration: 500,
88
+ notext: true
89
+ }
80
90
 
81
- if AudioCues.cues[audio_cue_symbol]
82
- Thread.start do
83
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
84
- seq = feep_defaults.merge(seq)
91
+ if AudioCues.cues[audio_cue_symbol]
92
+ Thread.start do
93
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
94
+ seq = feep_defaults.merge(seq)
85
95
 
86
- Feep::Base.new({
87
- freq_or_note: seq[:frequencies],
88
- waveform: seq[:waveform],
89
- volume: seq[:volume],
90
- duration: seq[:duration],
91
- notext: seq[:notext]
92
- })
96
+ Feep::Base.new({
97
+ freq_or_note: seq[:frequencies],
98
+ waveform: seq[:waveform],
99
+ volume: seq[:volume],
100
+ duration: seq[:duration],
101
+ notext: seq[:notext]
102
+ })
103
+ end
104
+ end
93
105
  end
106
+ else
107
+ GameOptions.data['errors'] = ERROR_FEEP_NOT_FOUND
94
108
  end
95
- end
96
- when 'bloops'
97
- require_relative 'bloops_cues'
109
+ when 'bloops'
110
+ if system('gem list -ie bloops')
111
+ require_relative 'bloops_cues'
98
112
 
99
- if BloopsCues.cues[audio_cue_symbol]
100
- Thread.start do
101
- BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
102
- threads = []
113
+ if BloopsCues.cues[audio_cue_symbol]
114
+ Thread.start do
115
+ BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
116
+ threads = []
103
117
 
104
- seq.each do |note|
105
- threads << Thread.new do
106
- b = Bloops.new
107
- b.tempo = 240
108
- snd = b.sound Bloops::SQUARE
109
- snd.punch = GameOptions.data['sound_volume']/2
110
- snd.sustain = 0.7
111
- snd.decay = 0.2
112
- b.tune snd, note[1]
113
- b.play
114
- sleep 0.1 while !b.stopped?
118
+ seq.each do |note|
119
+ threads << Thread.new do
120
+ b = Bloops.new
121
+ b.tempo = 240
122
+ snd = b.sound Bloops::SQUARE
123
+ snd.punch = GameOptions.data['sound_volume']/2
124
+ snd.sustain = 0.7
125
+ snd.decay = 0.2
126
+ b.tune snd, note[1]
127
+ b.play
128
+ sleep 0.1 while !b.stopped?
129
+ end
130
+ end
131
+
132
+ threads.each { |th| th.join }
115
133
  end
116
134
  end
117
-
118
- threads.each { |th| th.join }
119
135
  end
136
+ else
137
+ GameOptions.data['errors'] = ERROR_BLOOPS_NOT_FOUND
120
138
  end
121
139
  end
140
+ else
141
+ GameOptions.data['errors'] = ERROR_SOUND_SYSTEM_NOT_CHOSEN
122
142
  end
123
143
  else
124
144
  GameOptions.data['errors'] = ERROR_SOUND_NOT_ENABLED
@@ -255,17 +255,21 @@ module Gemwarrior
255
255
  if OS.windows?
256
256
  puts answer
257
257
  GameOptions.add 'sound_system', 'win32-sound'
258
+ Audio.init
258
259
  else
259
- puts
260
+ puts answer
261
+ puts "Sorry, but your system doesn't seem to be running Windows."
260
262
  end
261
263
  print_options_sound_sytem
262
264
  when '2'
263
265
  puts answer
264
266
  GameOptions.add 'sound_system', 'feep'
267
+ Audio.init
265
268
  print_options_sound_sytem
266
269
  when '3'
267
270
  puts answer
268
271
  GameOptions.add 'sound_system', 'bloops'
272
+ Audio.init
269
273
  print_options_sound_sytem
270
274
  when 't'
271
275
  puts answer
@@ -304,6 +308,9 @@ module Gemwarrior
304
308
  when '1'
305
309
  print answer
306
310
  GameOptions.data['sound_enabled'] = !GameOptions.data['sound_enabled']
311
+ if GameOptions.data['sound_enabled']
312
+ Audio.init
313
+ end
307
314
  print_options
308
315
  when '2'
309
316
  print answer
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.15.15'
5
+ VERSION = '0.15.17'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.15
4
+ version: 0.15.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clocker