P3: The ballistic ammo gauge shows weapon energy as empty unless it is completely full
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Độ rộng thanh Energy được tính trong hudtarget.cpp quanh dòng 6043, nơi fl2i cắt cụt tỷ lệ trước phép nhân; việc tra cứu nhãn gần dòng 6030 dùng số bank trong khi cần lớp vũ khí. Tái hiện với -ballistic_gauge và một vũ khí chính đạn đạo, kiểm tra thanh ở mức năng lượng một phần. Hoàn tất khi thanh co giãn theo năng lượng, nhãn dùng đúng lớp vũ khí và các bank rỗng (-1) bị bỏ qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
When the ballistic ammo gauge is on (-ballistic_gauge, on a ship with a ballistic primary), its Energy bar is either completely full or completely empty. Any weapon energy below 100% draws as an empty bar, so the gauge tells the player they have no energy when they may have almost all of it.
The bar's width is max_w * fl2i(energy / max_reserve) (hudtarget.cpp:6043 on master). fl2i truncates the ratio first, so it is 1 only at full energy and 0 otherwise. Multiplying before truncating (fl2i(max_w * energy / max_reserve)) gives the right width.
Steps to reproduce
- Current master (I used 8afa31842, Debug build), MediaVPs 5.0.2, launched with
-ballistic_gauge. - Use a mod that gives the player's ship a ballistic primary. I made a small test mod: a
weapons.tbmthat adds the"ballistic"flag and$Rearm Rate: 100to the Subach HL-7, and aships.tbmthat gives the GTF Ulysses$PBank Capacity: ( 1000, 1000 ). - Start SM1-01 and drain some weapon energy.
I set the energy from Lua and paused before each screenshot: at 150/150 the Energy bar is full; at 148.5/150 and at 75/150 it is empty.
Expected vs. actual behavior
Expected: the bar is drawn in proportion to the weapon energy left.
Actual: it's full at 100% and empty at anything less.
Two more problems in the same gauge, found by reading the code and not run:
hudtarget.cpp:6030looks upWeapon_infowithcurrent_primary_bank, a bank number rather than a weapon class, so the Energy label's brightness comes from the wrong weapon.hudtarget.cpp:5997and:6060readWeapon_info[primary_bank_weapons[bx]]without checking for -1, which other HUD code guards against for an empty bank. I haven't confirmed an empty primary bank can reach this gauge.
Proposed fixes
- Do the multiplication before the truncation in the bar width, as above. One line.
- Fix the other two lookups in the same pass: use the weapon class in the current bank for the label, and skip banks set to -1.
- Compute the ratio as a float clamped to 0..1, then scale it to the bar width, so energy above the reserve can't overdraw either.
- Ngôn ngữ chính
- C++
- Star
- 488
- Fork
- 184
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của scp-fs2open/fs2open.github.com
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
scp-fs2open/fs2open.github.com#7946 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 66/100
scp-fs2open/fs2open.github.com#7932 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
scp-fs2open/fs2open.github.com#7924 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
scp-fs2open/fs2open.github.com#7918 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
scp-fs2open/fs2open.github.com#7917 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của scp-fs2open/fs2open.github.com
Issue tương tự
-
bug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
chipsalliance/verible#2644 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
grafana/pyroscope-dotnet#470 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation P5 XS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
open-astro/AlpacaBridge#1848 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DiskANN AnnIterator returns unconverted IP distances after the graph walk runs out of candidatesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
zilliztech/knowhere#1933 ·
Maintainer thường phản hồi trong vòng 1 ngày