Skip to content

Commit

Permalink
fix(zscript): 'Hero->Warp()' using current screen's warp return squar…
Browse files Browse the repository at this point in the history
…e value
  • Loading branch information
EmilyV99 committed Apr 5, 2024
1 parent e8d9031 commit 1f010f2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions resources/docs/ZScript_Additions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6355,6 +6355,12 @@ int Attack;
* Sets the extend value for all of Link's various actions.
*/

void Warp(int DMap, int screen);
* Warps link to the given screen in the given DMap, just like if he'd
* triggered an 'Insta-Warp'-type warp.
* Uses warp return square A, unless compat rule `Old 'Hero->Warp' Return Square' is on,
* in which case it uses the warp return square of the current screen's Sidewarp A.

void WarpEx(int ptr[])

* Similar to Link->Warp, but with more options. This takes an array, or
Expand Down
2 changes: 1 addition & 1 deletion src/base/qrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ enum
qr_SEPARATE_BOMBABLE_TAPPING_SFX, qr_BROKEN_BOMB_AMMO_COSTS, qr_CONVEYORS_ALL_LAYERS, qr_OLD_BROKEN_WARPEX_MUSIC,
qr_BROKEN_LIFTSWIM, qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING, qr_BROKEN_FLAME_ARROW_REFLECTING, qr_EW_FIRE_EMITS_LIGHT,
//55
qr_NEWDARK_TRANS_STACKING,
qr_NEWDARK_TRANS_STACKING, qr_OLD_HERO_WARP_RETSQUARE,
//EMILY SPOT
//60
//CONNOR SPOT qr_ = 60*8,
Expand Down
2 changes: 1 addition & 1 deletion src/base/zdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ enum {ENC_METHOD_192B104=0, ENC_METHOD_192B105, ENC_METHOD_192B185, ENC_METHOD_2
#define V_SFX 8
#define V_FAVORITES 4

#define V_COMPATRULE 66
#define V_COMPATRULE 67
#define V_ZINFO 3

//= V_SHOPS is under V_MISC
Expand Down
5 changes: 4 additions & 1 deletion src/dialog/quest_rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,9 @@ GUI::ListData bugfixRulesList
" will not work properly, and instead a mixture of the two settings will occur (Always resetting if it's off,"
" and always continuing if it's on)."
"\nIf disabled, the reset and continue flags will work separately, not using the old behavior." },
{ "Old 'Hero->Warp' Return Square", qr_OLD_HERO_WARP_RETSQUARE,
"If checked, 'Hero->Warp()' uses the return square of the current screen's Sidewarp A."
" Otherwise, it uses return square A." },
};

extern GUI::ListData compileSettingList;
Expand Down Expand Up @@ -1763,7 +1766,7 @@ void applyRuleTemplate(int32_t ruleTemplate, byte* qrptr)
qr_OLD_PRINTF_ARGS, qr_COMBODATA_INITD_MULT_TENK,
qr_OLDQUESTMISC, qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS,
qr_BROKEN_GETPIXEL_VALUE, qr_ZS_NO_NEG_ARRAY, qr_SCRIPT_CONTHP_IS_HEARTS,
qr_OLD_BROKEN_WARPEX_MUSIC,
qr_OLD_BROKEN_WARPEX_MUSIC, qr_OLD_HERO_WARP_RETSQUARE,
};
for(int qr : zsOnRules)
set_qr(qr, 1, qrptr);
Expand Down
2 changes: 2 additions & 0 deletions src/qst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3713,6 +3713,8 @@ int32_t readrules(PACKFILE *f, zquestheader *Header)
set_qr(qr_BROKEN_SIDEVIEW_SPRITE_JUMP,1);
if(compatrule_version < 66)
set_qr(qr_NEWDARK_TRANS_STACKING,1);
if(compatrule_version < 67)
set_qr(qr_OLD_HERO_WARP_RETSQUARE,1);

set_qr(qr_ANIMATECUSTOMWEAPONS,0);
if (s_version < 16)
Expand Down
10 changes: 10 additions & 0 deletions src/zc/ffscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30046,6 +30046,11 @@ void do_warp(bool v)
tmpscr->sidewarpdmap[0] = dmapid;
tmpscr->sidewarpscr[0] = screenid;
tmpscr->sidewarptype[0] = wtIWARP;
if(!get_qr(qr_OLD_HERO_WARP_RETSQUARE))
{
tmpscr->warpreturnc &= ~(3 << 8);
set_bit(&tmpscr->sidewarpoverlayflags,0,0);
}
Hero.ffwarp = true;
}

Expand All @@ -30072,6 +30077,11 @@ void do_pitwarp(bool v)
tmpscr->sidewarpdmap[0] = dmapid;
tmpscr->sidewarpscr[0] = screenid;
tmpscr->sidewarptype[0] = wtIWARP;
if(!get_qr(qr_OLD_HERO_WARP_RETSQUARE))
{
tmpscr->warpreturnc &= ~(3 << 8);
set_bit(&tmpscr->sidewarpoverlayflags,0,0);
}
Hero.ffwarp = true;
Hero.ffpit = true;
}
Expand Down

0 comments on commit 1f010f2

Please sign in to comment.