Daivuk / apdoom

Archipelago Doom is a fork of Crispy Doom to allow multi-world features from Archipelago
GNU General Public License v2.0
9 stars 11 forks source link

Fix off-by-one errors causing Heretic to never spawn ethereal arrows … #22

Closed sgrunt closed 3 months ago

sgrunt commented 3 months ago

…or quartz flasks in item shuffling

rand()%N returns a random number from 0 to N-1. In this block in Heretic's p_setup.c, there are two blocks with rand()%2 and case 0: [...] case 1: [...] case 2: [...] and rand()%6 with cases going up to 6, causing both of the last cases (Ethereal Arrows and Quartz Flasks) to never be rolled for item shuffle replacement. This change fixes both of these off-by-one errors to ensure both of those items can spawn.

KScl commented 3 months ago

Hm. I think this change actually reveals another underlying problem with this section of code; quartz flasks are omitted from that switch statement entirely, despite being taken into consideration when calculating the ratios above.

KScl commented 3 months ago

Thanks for looking into this!