Skip to content

Commit

Permalink
feat: add 'Script1'-'Script10' shield blockflags, to block *specific*…
Browse files Browse the repository at this point in the history
… scripted weapons.
  • Loading branch information
EmilyV99 authored and connorjclark committed Jan 1, 2024
1 parent 7ca9310 commit de1cb2b
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 484 deletions.
49 changes: 39 additions & 10 deletions resources/include/std_zh/std_constants.zh
Expand Up @@ -3612,16 +3612,45 @@ enum ComboTrigFlag
TRIGFLAG_MAX = 32*6
};

DEFINE BLOCKFLAG_ROCK = 0x001;
DEFINE BLOCKFLAG_ARROW = 0x002;
DEFINE BLOCKFLAG_BRANG = 0x004;
DEFINE BLOCKFLAG_FIREBALL = 0x008;
DEFINE BLOCKFLAG_SWORD = 0x010;
DEFINE BLOCKFLAG_MAGIC = 0x020;
DEFINE BLOCKFLAG_FLAME = 0x040;
DEFINE BLOCKFLAG_SCRIPT = 0x080;
DEFINE BLOCKFLAG_FIREBALL2 = 0x100;
DEFINE BLOCKFLAG_LIGHTBEAM = 0x200;
DEFINE BLOCKFLAG_ROCK = 0x00001;
DEFINE BLOCKFLAG_ARROW = 0x00002;
DEFINE BLOCKFLAG_BRANG = 0x00004;
DEFINE BLOCKFLAG_FIREBALL = 0x00008;
DEFINE BLOCKFLAG_SWORD = 0x00010;
DEFINE BLOCKFLAG_MAGIC = 0x00020;
DEFINE BLOCKFLAG_FLAME = 0x00040;
DEFINE BLOCKFLAG_SCRIPT = 0x00080; //blocks or reflects ALL script weapons
DEFINE BLOCKFLAG_FIREBALL2 = 0x00100;
DEFINE BLOCKFLAG_LIGHTBEAM = 0x00200;
DEFINE BLOCKFLAG_SCRIPT1 = 0x00400;
DEFINE BLOCKFLAG_SCRIPT2 = 0x00800;
DEFINE BLOCKFLAG_SCRIPT3 = 0x01000;
DEFINE BLOCKFLAG_SCRIPT4 = 0x02000;
DEFINE BLOCKFLAG_SCRIPT5 = 0x04000;
DEFINE BLOCKFLAG_SCRIPT6 = 0x08000;
DEFINE BLOCKFLAG_SCRIPT7 = 0x10000;
//Higher blockflag bits are too high for zscript! Use long access...

DEFINEL L_BLOCKFLAG_ROCK = 0x00000001L;
DEFINEL L_BLOCKFLAG_ARROW = 0x00000002L;
DEFINEL L_BLOCKFLAG_BRANG = 0x00000004L;
DEFINEL L_BLOCKFLAG_FIREBALL = 0x00000008L;
DEFINEL L_BLOCKFLAG_SWORD = 0x00000010L;
DEFINEL L_BLOCKFLAG_MAGIC = 0x00000020L;
DEFINEL L_BLOCKFLAG_FLAME = 0x00000040L;
DEFINEL L_BLOCKFLAG_SCRIPT = 0x00000080L; //blocks or reflects ALL script weapons
DEFINEL L_BLOCKFLAG_FIREBALL2 = 0x00000100L;
DEFINEL L_BLOCKFLAG_LIGHTBEAM = 0x00000200L;
DEFINEL L_BLOCKFLAG_SCRIPT1 = 0x00000400L;
DEFINEL L_BLOCKFLAG_SCRIPT2 = 0x00000800L;
DEFINEL L_BLOCKFLAG_SCRIPT3 = 0x00001000L;
DEFINEL L_BLOCKFLAG_SCRIPT4 = 0x00002000L;
DEFINEL L_BLOCKFLAG_SCRIPT5 = 0x00004000L;
DEFINEL L_BLOCKFLAG_SCRIPT6 = 0x00008000L;
DEFINEL L_BLOCKFLAG_SCRIPT7 = 0x00010000L;
DEFINEL L_BLOCKFLAG_SCRIPT8 = 0x00020000L;
DEFINEL L_BLOCKFLAG_SCRIPT9 = 0x00040000L;
DEFINEL L_BLOCKFLAG_SCRIPT10 = 0x00080000L;

enum SwitchEffect
{
Expand Down
35 changes: 25 additions & 10 deletions src/base/zdefs.h
Expand Up @@ -739,16 +739,31 @@ enum // value matters bec
};

// Shield projectile blocking
#define shROCK 0x001
#define shARROW 0x002
#define shBRANG 0x004
#define shFIREBALL 0x008
#define shSWORD 0x010
#define shMAGIC 0x020
#define shFLAME 0x040
#define shSCRIPT 0x080
#define shFIREBALL2 0x100 // Boss fireball, not ewFireball2
#define shLIGHTBEAM 0x200 //Light puzzle beams
#define shROCK 0x00000001
#define shARROW 0x00000002
#define shBRANG 0x00000004
#define shFIREBALL 0x00000008
#define shSWORD 0x00000010
#define shMAGIC 0x00000020
#define shFLAME 0x00000040
#define shSCRIPT 0x00000080 // If set, blocks all of Script1 through Script10
#define shFIREBALL2 0x00000100 // Boss fireball, not ewFireball2
#define shLIGHTBEAM 0x00000200 // Light puzzle beams
//Individual script blockers:
#define shSCRIPT1 0x00000400
#define shSCRIPT2 0x00000800
#define shSCRIPT3 0x00001000
#define shSCRIPT4 0x00002000
#define shSCRIPT5 0x00004000
#define shSCRIPT6 0x00008000
#define shSCRIPT7 0x00010000
#define shSCRIPT8 0x00020000
#define shSCRIPT9 0x00040000
#define shSCRIPT10 0x00080000


#define sh_ALL_SCR 0x000FFC00



// item sets
Expand Down
4 changes: 2 additions & 2 deletions src/defdata.cpp
Expand Up @@ -241,7 +241,7 @@ itemdata default_items[iLast]=
{0,0,0,0,0,0,0, itype_sword, i_sword, 1, ITEM_FLAG1|ITEM_FLAG2|ITEM_GAMEDATA|ITEM_FLAG4, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, wSWORD, wSWORDSLASH, wSWORD, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_SWORD },
{0,0,0,0,0,0,0, itype_sword, i_wsword, 2, ITEM_FLAG1|ITEM_FLAG2|ITEM_GAMEDATA|ITEM_FLAG4, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, wWSWORD, wWSWORDSLASH, wWSWORD, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_SWORD },
{0,0,0,0,0,0,0, itype_sword, i_msword, 4, ITEM_FLAG1|ITEM_FLAG2|ITEM_GAMEDATA|ITEM_FLAG4, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, wMSWORD, wMSWORDSLASH, wMSWORD, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_SWORD },
{0,0,0,0,0,0,0, itype_shield, i_largeshield, 0, ITEM_GAMEDATA|ITEM_EDIBLE|ITEM_KEEPOLD, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, shROCK|shARROW|shBRANG|shFIREBALL|shSWORD|shMAGIC|shSCRIPT, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_CHINK },
{0,0,0,0,0,0,0, itype_shield, i_largeshield, 0, ITEM_GAMEDATA|ITEM_EDIBLE|ITEM_KEEPOLD, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, shROCK|shARROW|shBRANG|shFIREBALL|shSWORD|shMAGIC|sh_ALL_SCR, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_CHINK },
{0,0,0,0,0,0,0, itype_key, 1, 0, 0, 0, 5, 1, 0, 0, WAV_PLINK, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, 0 },
{0,0,0,0,0,0,0, itype_candle, i_bcandle, 1, ITEM_GAMEDATA|ITEM_FLAG1, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, wFIRE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_FIRE },
{0,0,0,0,0,0,0, itype_candle, i_rcandle, 1, ITEM_GAMEDATA, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, wFIRE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_FIRE },
Expand Down Expand Up @@ -270,7 +270,7 @@ itemdata default_items[iLast]=
{0,0,0,0,0,0,0, itype_fairy, 1, 0, 0, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 50, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_SCALE },
{0,0,0,0,0,0,0, itype_brang, i_fbrang, 2, ITEM_GAMEDATA, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, wFBRANG, 0, wFSPARKLE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, shBRANG|shROCK|shARROW|shFIREBALL|shSWORD|shMAGIC, shFIREBALL|shSWORD|shMAGIC, 0, 0, 0, 0, 0, 0, {0,0}, WAV_BRANG },
{0,0,0,0,0,0,0, itype_sword, i_xsword, 8, ITEM_FLAG1|ITEM_FLAG2|ITEM_GAMEDATA|ITEM_FLAG4, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, wXSWORD, wXSWORDSLASH, wXSWORD, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_SWORD },
{0,0,0,0,0,0,0, itype_shield, i_mirrorshield, 0, ITEM_GAMEDATA|ITEM_KEEPOLD, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, shROCK|shARROW|shBRANG|shFIREBALL|shSWORD|shMAGIC|shFLAME|shSCRIPT, shFIREBALL|shMAGIC|shSCRIPT, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_CHINK },
{0,0,0,0,0,0,0, itype_shield, i_mirrorshield, 0, ITEM_GAMEDATA|ITEM_KEEPOLD, 0, -1, 0, 0, 0, WAV_SCALE, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, shROCK|shARROW|shBRANG|shFIREBALL|shSWORD|shMAGIC|shFLAME|sh_ALL_SCR|shLIGHTBEAM, shFIREBALL|shMAGIC|sh_ALL_SCR|shLIGHTBEAM, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, WAV_CHINK },
{0,0,0,0,0,0,0, itype_rupee, i_20rupee, 0, 0, 0, 1, 20|0x8000, 0, 0, WAV_CHIME, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, 0 },
{0,0,0,0,0,0,0, itype_rupee, i_50rupee, 0, 0, 0, 1, 50|0x8000, 0, 0, WAV_CHIME, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, 0 },
{0,0,0,0,0,0,0, itype_rupee, i_200rupee, 0, 0, 0, 1, 200|0x8000, 0, 0, WAV_CHIME, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0}, 0 },
Expand Down
21 changes: 14 additions & 7 deletions src/dialog/itemeditor.cpp
Expand Up @@ -156,9 +156,11 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
}
case itype_shield:
{
_SET(misc[0], "Block Flags:", "(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script=128, Fireball2=256, Lightbeam=512)\n"
_SET(misc[0], "Block Flags:", "(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Fireball2=256, Lightbeam=512,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons and lightbeams with their flags set will be blocked from in front of the player.");
_SET(misc[1], "Reflect Flags:", "(Rock=1, Fireball=8, Sword=16, Magic=32, Script=128, Fireball2=256, Lightbeam=512)\n"
_SET(misc[1], "Reflect Flags:", "(Rock=1, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Fireball2=256, Lightbeam=512,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons and lightbeams with their flags set will be reflected from in front of the player.\n"
"Weapons are only reflected if their value is in both 'Block Flags' and 'Reflect Flags'.");
_SET(actionsnd[0], "De/Reflection Sound:", "Plays when the shield successfully blocks or reflects a weapon");
Expand Down Expand Up @@ -536,10 +538,12 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
if(FLAG(6))
{
_SET(misc[2], "Block Flags:",
"(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script=128, Fireball2=256)\n"
"(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Firebal2=256,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons with their flags set will be blocked by the weapon.");
_SET(misc[3], "Reflect Flags:",
"(Rock=1, Fireball=8, Sword=16, Magic=32, Script=128, Fireball2=256)\n"
"(Rock=1, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Firebal2=256,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons with their flags set will be reflected by the weapon.\n"
"Weapons are only reflected if their value is in both 'Block Flags' and 'Reflect Flags'.");
}
Expand Down Expand Up @@ -574,10 +578,12 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
if(FLAG(6))
{
_SET(misc[2], "Block Flags:",
"(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script=128, Fireball2=256)\n"
"(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Firebal2=256,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons with their flags set will be blocked by the weapon.");
_SET(misc[3], "Reflect Flags:",
"(Rock=1, Fireball=8, Sword=16, Magic=32, Script=128, Fireball2=256)\n"
"(Rock=1, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Firebal2=256,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons with their flags set will be reflected by the weapon.\n"
"Weapons are only reflected if their value is in both 'Block Flags' and 'Reflect Flags'.");
}
Expand Down Expand Up @@ -864,7 +870,8 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
if(FLAG(1))
_SET(misc[0], "Bounce Power:", "Amount of jump power gained from a bounce."
" This value is equal to setting Player->Jump by value divided by 100");
_SET(misc[1], "Block Flags:", "(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script=128, Fireball2=256)\n"
_SET(misc[1], "Block Flags:", "(Rock=1, Arrow=2, BRang=4, Fireball=8, Sword=16, Magic=32, Flame=64, Script(All)=128, Firebal2=256,\n"
"Script1=1024, Script2=2048, Script3=4096, Script4=8192, Script5=16384, Script6=32768, Script7=65536, Script8=131072, Script9=262144, Script10=524288)\n"
"Sum all of the values you want to apply. Weapons with their flags set will be blocked if the player lands on them.");
break;
}
Expand Down

0 comments on commit de1cb2b

Please sign in to comment.