Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
FinishSpawningItem(game/g_items.cpp), theIT_AMMOcheck has two bugs that prevent ammo packs from spawning properly:g_weaponDisable.bits & i):g_weaponDisable.bitsis a bitmask where weaponi(WP_BRYAR_PISTOL = 4,WP_BLASTER = 5,WP_DISRUPTOR = 6, ...,WP_ROCKET_LAUNCHER = 11) is represented by bit(1 << i), not the raw integeri. Testingg_weaponDisable.bits & icompares against the wrong bits (for example,WP_BLASTER = 5(0b101) checks bits 0 and 2 instead of bit 5).return;skips item initialization:When an enabled weapon is found, the
elsebranch returns immediately out ofFinishSpawningItem(). That skips the entire second half of the function — settingent->s.eType = ET_ITEM,ent->s.modelindex,ent->r.contents = CONTENTS_TRIGGER,ent->touch = Touch_Item, tracing to the floor, and callingtrap->LinkEntity(ent). As a result, ammo pickups whose weapons are enabled never appear or become pickable in the world.Fix
!(g_weaponDisable.bits & (1 << i))against the weapon's actual bit ing_weaponDisable.bits.weaponEnabled = qtrue; break;instead of returning early, so execution continues through the rest ofFinishSpawningItem()to spawn and link the item.G_FreeEntity(ent); return;when!weaponEnabled.Verification
Tested on
mp/ffa1withg_weaponDisable 0: previously 0ammo_*entities spawned/linked; with this fix, all 14ammo_*pickups spawn, render, and can be collected normally, and disabling a weapon's bit properly suppresses its ammo.