doom 0.11.1 → 0.11.2
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 +4 -4
- data/README.md +3 -0
- data/bin/doom +8 -3
- data/lib/doom/game/player_physics.rb +5 -3
- data/lib/doom/game/snapshot.rb +8 -4
- data/lib/doom/map/data.rb +9 -2
- data/lib/doom/render/hardware_renderer.rb +1 -1
- data/lib/doom/render/ray_tracing/bvh.rb +4 -2
- data/lib/doom/render/renderer.rb +3 -8
- data/lib/doom/version.rb +1 -1
- data/lib/doom/wad_downloader.rb +8 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f2114bdabac04335b93702676f54d54e26ae49a2c47250c90be096c2a827f763
|
|
4
|
+
data.tar.gz: 0df53b232c93033c26a3bf0e44894e4e525967417ca600915069f233f44c9ca5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abb268a3b9b6b8605de489c49fc47825d4460b2db849a13cf0f89d465950cf3617075cbd0e4064c04c9703ff9cac184485a11419587f43787d53f7e918d35024
|
|
7
|
+
data.tar.gz: bcdfff32f9101693e8067790e0e1031d6f3c540bf574d7ccfca1967ca52763479ca019844efc3e247eecb683d6f480c662d19e4c8a256519c41d8fdab77ed8d1
|
data/README.md
CHANGED
|
@@ -130,6 +130,9 @@ brew install sdl2
|
|
|
130
130
|
If an older installation reports `symbol not found in flat namespace _OBJC_CLASS_$_NSScreen`,
|
|
131
131
|
update the gem with `gem update doom`. This is fixed in Doom Ruby 0.11.1.
|
|
132
132
|
|
|
133
|
+
If the first-run WAD downloader fails with `uninitialized constant Doom::Net::HTTP`,
|
|
134
|
+
update to Doom Ruby 0.11.2.
|
|
135
|
+
|
|
133
136
|
**Ubuntu/Debian:**
|
|
134
137
|
```bash
|
|
135
138
|
sudo apt-get install build-essential libsdl2-dev libgl1-mesa-dev libopenal-dev libsndfile1-dev libmpg123-dev libfontconfig1-dev
|
data/bin/doom
CHANGED
|
@@ -131,13 +131,18 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby' && RUBY_PLATFORM.includ
|
|
|
131
131
|
%w[
|
|
132
132
|
/opt/homebrew/lib/libSDL2-2.0.0.dylib /opt/homebrew/lib/libSDL2.dylib
|
|
133
133
|
/usr/local/lib/libSDL2-2.0.0.dylib /usr/local/lib/libSDL2.dylib
|
|
134
|
-
].each
|
|
134
|
+
].each do |path|
|
|
135
|
+
next unless File.exist?(path)
|
|
136
|
+
|
|
137
|
+
Fiddle.dlopen(path)
|
|
138
|
+
break
|
|
139
|
+
end
|
|
135
140
|
rescue StandardError => e
|
|
136
141
|
warn "[doom] SDL2 preload for TruffleRuby failed (#{e.message}); the window may not open"
|
|
137
142
|
end
|
|
138
143
|
unless (ENV['JAVA_TOOL_OPTIONS'].to_s + ENV['TRUFFLERUBYOPT'].to_s).include?('XstartOnFirstThread')
|
|
139
|
-
warn
|
|
140
|
-
|
|
144
|
+
warn '[doom] on TruffleRuby/macOS the window needs the main thread: run with ' \
|
|
145
|
+
'`truffleruby --vm.XstartOnFirstThread bin/doom ...`'
|
|
141
146
|
end
|
|
142
147
|
end
|
|
143
148
|
|
|
@@ -284,9 +284,11 @@ module Doom
|
|
|
284
284
|
# Iterate linedefs that may interact with the player moving from
|
|
285
285
|
# (x1, y1) to (x2, y2). Uses BLOCKMAP when available; otherwise falls
|
|
286
286
|
# back to scanning all linedefs.
|
|
287
|
-
def each_nearby_linedef(x1, y1, x2, y2, &)
|
|
287
|
+
def each_nearby_linedef(x1, y1, x2, y2, &block)
|
|
288
|
+
return enum_for(__method__, x1, y1, x2, y2) unless block
|
|
289
|
+
|
|
288
290
|
unless @map.respond_to?(:blockmap_loaded?) && @map.blockmap_loaded?
|
|
289
|
-
@map.linedefs.each(&)
|
|
291
|
+
@map.linedefs.each(&block)
|
|
290
292
|
return
|
|
291
293
|
end
|
|
292
294
|
|
|
@@ -295,7 +297,7 @@ module Doom
|
|
|
295
297
|
max_x = [x1, x2].max + PLAYER_RADIUS
|
|
296
298
|
min_y = [y1, y2].min - PLAYER_RADIUS
|
|
297
299
|
max_y = [y1, y2].max + PLAYER_RADIUS
|
|
298
|
-
@map.each_linedef_near(min_x, min_y, max_x, max_y, &)
|
|
300
|
+
@map.each_linedef_near(min_x, min_y, max_x, max_y, &block)
|
|
299
301
|
end
|
|
300
302
|
|
|
301
303
|
def crosses_blocking_linedef?(x1, y1, x2, y2, linedef)
|
data/lib/doom/game/snapshot.rb
CHANGED
|
@@ -44,9 +44,11 @@ module Doom
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# length-prefixed homogeneous array
|
|
47
|
-
def list(items, &)
|
|
47
|
+
def list(items, &block)
|
|
48
|
+
return enum_for(__method__, items) unless block
|
|
49
|
+
|
|
48
50
|
u32(items.size)
|
|
49
|
-
items.each(&)
|
|
51
|
+
items.each(&block)
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
def to_s = @buf.dup
|
|
@@ -76,8 +78,10 @@ module Doom
|
|
|
76
78
|
take(u16)
|
|
77
79
|
end
|
|
78
80
|
|
|
79
|
-
def list(&)
|
|
80
|
-
|
|
81
|
+
def list(&block)
|
|
82
|
+
return enum_for(__method__) unless block
|
|
83
|
+
|
|
84
|
+
Array.new(u32, &block)
|
|
81
85
|
end
|
|
82
86
|
|
|
83
87
|
private
|
data/lib/doom/map/data.rb
CHANGED
|
@@ -302,9 +302,16 @@ module Doom
|
|
|
302
302
|
# Yield each linedef whose block overlaps the bounding box (min_x, min_y,
|
|
303
303
|
# max_x, max_y). Yields each linedef at most once per call. Falls back
|
|
304
304
|
# to iterating all linedefs if no blockmap is loaded.
|
|
305
|
-
|
|
305
|
+
# Avoid anonymous block forwarding: Ruby 4.0.9's parser rejects that form.
|
|
306
|
+
def each_linedef_near(min_x, min_y, max_x, max_y)
|
|
307
|
+
return enum_for(__method__, min_x, min_y, max_x, max_y) unless block_given?
|
|
308
|
+
|
|
306
309
|
unless @blockmap_blocks
|
|
307
|
-
|
|
310
|
+
line_index = 0
|
|
311
|
+
while line_index < @linedefs.size
|
|
312
|
+
yield @linedefs[line_index]
|
|
313
|
+
line_index += 1
|
|
314
|
+
end
|
|
308
315
|
return
|
|
309
316
|
end
|
|
310
317
|
|
data/lib/doom/render/renderer.rb
CHANGED
|
@@ -67,13 +67,8 @@ module Doom
|
|
|
67
67
|
# Opt-in: route the wall/floor/ceiling rasterisation through the
|
|
68
68
|
# spinel_native-compiled port of this renderer's hot path. Everything
|
|
69
69
|
# else (sprites, weapon, HUD, physics, sound) stays the real game.
|
|
70
|
-
@native_kernel = !ENV[
|
|
71
|
-
if @native_kernel
|
|
72
|
-
warn "[doom] compiling spinel_native render kernel (first run may take a few seconds)..."
|
|
73
|
-
@sn = build_native_renderer
|
|
74
|
-
@native_kernel = !@sn.nil?
|
|
75
|
-
warn "[doom] spinel_native renderer ready" if @sn
|
|
76
|
-
end
|
|
70
|
+
@native_kernel = !ENV['DOOM_NATIVE'].to_s.empty? && ENV['DOOM_NATIVE'] != '0'
|
|
71
|
+
warn '[doom] spinel_native renderer requested; loading it on first frame' if @native_kernel
|
|
77
72
|
@sprites = sprites
|
|
78
73
|
@animations = animations
|
|
79
74
|
@hidden_things = nil
|
|
@@ -309,7 +304,7 @@ module Doom
|
|
|
309
304
|
def build_native_renderer
|
|
310
305
|
# Dynamic form so the spinel AOT compiler ignores this require (it pulls
|
|
311
306
|
# in the spinel_native gem, irrelevant to an AOT build); CRuby is unaffected.
|
|
312
|
-
send(:require_relative,
|
|
307
|
+
send(:require_relative, 'spinel_native_renderer')
|
|
313
308
|
SpinelNativeRenderer.new(@map, @palette, @colormap, @textures, @flats_array)
|
|
314
309
|
rescue StandardError, LoadError => e
|
|
315
310
|
warn "[doom] spinel_native renderer unavailable, using Ruby renderer (#{e.message.lines.first.to_s.strip})"
|
data/lib/doom/version.rb
CHANGED
data/lib/doom/wad_downloader.rb
CHANGED
|
@@ -83,28 +83,28 @@ module Doom
|
|
|
83
83
|
def self.download_from_url(url, destination, redirect_limit: 5)
|
|
84
84
|
raise DownloadError, 'Too many redirects' if redirect_limit.negative?
|
|
85
85
|
|
|
86
|
-
uri = URI.parse(url)
|
|
86
|
+
uri = ::URI.parse(url)
|
|
87
87
|
ssl_opts = { use_ssl: uri.scheme == 'https' }
|
|
88
88
|
|
|
89
89
|
if ssl_opts[:use_ssl]
|
|
90
90
|
begin
|
|
91
|
-
Net::HTTP.start(uri.host, uri.port, **ssl_opts) { |h| h.head(uri) }
|
|
92
|
-
rescue OpenSSL::SSL::SSLError
|
|
91
|
+
::Net::HTTP.start(uri.host, uri.port, **ssl_opts) { |h| h.head(uri) }
|
|
92
|
+
rescue ::OpenSSL::SSL::SSLError
|
|
93
93
|
puts 'SSL certificate verification failed, retrying without verification...'
|
|
94
|
-
ssl_opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
|
|
94
|
+
ssl_opts[:verify_mode] = ::OpenSSL::SSL::VERIFY_NONE
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
downloaded = 0
|
|
99
|
-
Net::HTTP.start(uri.host, uri.port, **ssl_opts) do |http|
|
|
100
|
-
request = Net::HTTP::Get.new(uri)
|
|
99
|
+
::Net::HTTP.start(uri.host, uri.port, **ssl_opts) do |http|
|
|
100
|
+
request = ::Net::HTTP::Get.new(uri)
|
|
101
101
|
|
|
102
102
|
http.request(request) do |response|
|
|
103
103
|
case response
|
|
104
|
-
when Net::HTTPRedirection
|
|
104
|
+
when ::Net::HTTPRedirection
|
|
105
105
|
return download_from_url(response['location'], destination,
|
|
106
106
|
redirect_limit: redirect_limit - 1)
|
|
107
|
-
when Net::HTTPSuccess
|
|
107
|
+
when ::Net::HTTPSuccess
|
|
108
108
|
total_size = response['content-length']&.to_i || SHAREWARE_SIZE
|
|
109
109
|
|
|
110
110
|
File.open(destination, 'wb') do |file|
|