PDA

View Full Version : [2.50.2]High level b-rangs trigger screen secret on flag 97



Lunaria
09-11-2018, 04:08 PM
I don't know the full extent of this bug but, throwing a high item level boomerang onto a screen flag 97 causes the secret sound to play and the screen secret happening.
In this scenario the B-rang is level 102, but I haven't tested other configurations. Since 97 is not a secret flag, and therefore does not go away when triggered this way, you can keep triggering it as well.

I'm not including a quest file here since it's like five mins max to replicate the scenario.
Video of the thing: https://cdn.discordapp.com/attachments/297673987813801997/489163712343834624/Stream_11-9-2018.mp4

ZC version 2.50.2

Edit: after some more testing I have narrowed it down a bit, this behaviour seem to start somewhere higher than item level 25, but below item level 40.

ZoriaRPG
09-11-2018, 05:27 PM
I don't know the full extent of this bug but, throwing a high item level boomerang onto a screen flag 97 causes the secret sound to play and the screen secret happening.
In this scenario the B-rang is level 102, but I haven't tested other configurations. Since 97 is not a secret flag, and therefore does not go away when triggered this way, you can keep triggering it as well.

I'm not including a quest file here since it's like five mins max to replicate the scenario.
Video of the thing: https://cdn.discordapp.com/attachments/297673987813801997/489163712343834624/Stream_11-9-2018.mp4

ZC version 2.50.2

Edit: after some more testing I have narrowed it down a bit, this behaviour seem to start somewhere higher than item level 25, but below item level 40.

That's utterly bizarre. I'll try to sort it ASAP.

This code, in weapons.cpp is suspicious:



for(int i=0; i<current_item(itype_brang); i++)
{
if(findentrance(x,y,mfBRANG+i,true)) dead=deadval;
}


It seems that someone was trying to simplify L1 to L3 triggers, except that no-one bothered to ever test it at higher levels!


Fix:



int brang_level = vbound(current_item(itype_brang),0,2);

for(int i=0; i<brang_level; i++) //clamp to legal FLAG VALUES!
{
if(findentrance(x,y,mfBRANG+i,true)) dead=deadval;
}


I'm pretty sure that the distinction between regular, magic, and fire is still based on level, although it could instead be based on range and power.

ZoriaRPG
09-12-2018, 04:39 AM
Should be fixed now.

Here is a Zelda.exe (2.53.0) Binary (http://timelord.insomnia247.nl/zc/zc_dev/zelda-w_253_beta_17--fix-boomerang-flags.exe) with the implemented fix, if anyone wishes to check for any continuing bugs or new issues.

I ended up going with this, so that future flags would be easier to implement:



int branglevel = itemsbuf[parentitem>-1 ? parentitem : current_item_id(itype_brang)].fam_type;

switch ( branglevel )
{
case 0:
case 1:
{
if(findentrance(x,y,mfBRANG,true)) dead=deadval; break;
}
case 2:
{
if(findentrance(x,y,mfBRANG,true)) dead=deadval;
if(findentrance(x,y,mfMBRANG,true)) dead=deadval;
break;
}
case 3:
{
goto brang_level_3_or_higher;
}
default: //level higher than 3
{
goto brang_level_3_or_higher;
}
brang_level_3_or_higher:
{
if(findentrance(x,y,mfBRANG,true)) dead=deadval;
if(findentrance(x,y,mfMBRANG,true)) dead=deadval;
if(findentrance(x,y,mfFBRANG,true)) dead=deadval;
break;
}
}