- replaced the deletesprite calls inside the item interface, also using actors in callbacks.

This commit is contained in:
Christoph Oelckers 2021-11-13 23:34:57 +01:00
parent 99f0c89e4e
commit 799cddfb66
2 changed files with 145 additions and 143 deletions

View file

@ -2,7 +2,7 @@
struct Item { struct Item {
using Callback = void (*)(PLAYER &plr, short i); using Callback = void (*)(PLAYER &plr, DWHActor* i);
int sizx, sizy; int sizx, sizy;
boolean treasures, cflag; boolean treasures, cflag;

View file

@ -13,26 +13,26 @@ boolean isItemSprite(int i) {
void InitItems() void InitItems()
{ {
int a = 0; int a = 0;
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // SILVERBAG items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // SILVERBAG
{ {
showmessage("Silver!", 360); showmessage("Silver!", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, krand() % 100 + 10); addscore(&plr, krand() % 100 + 10);
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // GOLDBAG items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // GOLDBAG
{ {
showmessage("Gold!", 360); showmessage("Gold!", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, krand() % 100 + 10); addscore(&plr, krand() % 100 + 10);
}); });
items[a++].Init(27, 28, true, false, [](PLAYER& plr, short i) // HELMET items[a++].Init(27, 28, true, false, [](PLAYER& plr, DWHActor* actor) // HELMET
{ {
showmessage("Hero Time", 360); showmessage("Hero Time", 360);
deletesprite(i); DeleteActor(actor);
if (!isWh2()) if (!isWh2())
addarmor(plr, 10); addarmor(plr, 10);
plr.helmettime = 7200; plr.helmettime = 7200;
@ -42,11 +42,11 @@ void InitItems()
addscore(&plr, 10); addscore(&plr, 10);
}); });
items[a++].Init(26, 26, true, false, [](PLAYER& plr, short i) // PLATEARMOR items[a++].Init(26, 26, true, false, [](PLAYER& plr, DWHActor* actor) // PLATEARMOR
{ {
if (plr.armor <= 149) { if (plr.armor <= 149) {
showmessage("Plate Armor", 360); showmessage("Plate Armor", 360);
deletesprite(i); DeleteActor(actor);
plr.armortype = 3; plr.armortype = 3;
plr.armor = 0; plr.armor = 0;
addarmor(plr, 150); addarmor(plr, 150);
@ -56,11 +56,11 @@ void InitItems()
} }
}); });
items[a++].Init(26, 26, true, false, [](PLAYER& plr, short i) // CHAINMAIL items[a++].Init(26, 26, true, false, [](PLAYER& plr, DWHActor* actor) // CHAINMAIL
{ {
if (plr.armor <= 99) { if (plr.armor <= 99) {
showmessage("Chain Mail", 360); showmessage("Chain Mail", 360);
deletesprite(i); DeleteActor(actor);
plr.armortype = 2; plr.armortype = 2;
plr.armor = 0; plr.armor = 0;
addarmor(plr, 100); addarmor(plr, 100);
@ -69,11 +69,11 @@ void InitItems()
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(47, 50, false, false, [](PLAYER& plr, short i) // LEATHERARMOR items[a++].Init(47, 50, false, false, [](PLAYER& plr, DWHActor* actor) // LEATHERARMOR
{ {
if (plr.armor <= 49) { if (plr.armor <= 49) {
showmessage("Leather Armor", 360); showmessage("Leather Armor", 360);
deletesprite(i); DeleteActor(actor);
plr.armortype = 1; plr.armortype = 1;
plr.armor = 0; plr.armor = 0;
addarmor(plr, 50); addarmor(plr, 50);
@ -82,11 +82,12 @@ void InitItems()
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(56, 49, true, false, [](PLAYER &plr, short i) // GIFTBOX items[a++].Init(56, 49, true, false, [](PLAYER &plr, DWHActor* actor) // GIFTBOX
{ {
sprite[i].detail = 0; auto& spr = actor->s();
spr.detail = 0;
treasuresfound++; treasuresfound++;
spritesound(S_TREASURE1, &sprite[i]); spritesound(S_TREASURE1, &spr);
int j = krand() % 8; int j = krand() % 8;
switch (j) { switch (j) {
case 0: case 0:
@ -137,7 +138,7 @@ void InitItems()
addscore(&plr, 30); addscore(&plr, 30);
break; break;
} }
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
break; break;
case 1: case 1:
switch (krand() % 8) { switch (krand() % 8) {
@ -206,10 +207,10 @@ void InitItems()
} }
break; break;
} }
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
break; break;
case 2: case 2:
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
addscore(&plr, (krand() % 400) + 100); addscore(&plr, (krand() % 400) + 100);
showmessage("Treasure Chest", 360); showmessage("Treasure Chest", 360);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
@ -266,7 +267,7 @@ void InitItems()
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7] = 1; plr.ammo[7] = 1;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 30); addscore(&plr, 30);
} }
@ -274,7 +275,7 @@ void InitItems()
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7]++; plr.ammo[7]++;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 30); addscore(&plr, 30);
} }
@ -283,7 +284,7 @@ void InitItems()
plr.weapon[7] = 1; plr.weapon[7] = 1;
plr.ammo[7] = 30; plr.ammo[7] = 30;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 7) if (plr.selectedgun < 7)
autoweaponchange(plr, 7); autoweaponchange(plr, 7);
@ -292,7 +293,7 @@ void InitItems()
} }
break; break;
} }
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
break; break;
case 4: case 4:
// random armor // random armor
@ -334,18 +335,18 @@ void InitItems()
} }
break; break;
} }
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
break; break;
case 5: case 5:
// poison chest // poison chest
if ((krand() & 2) == 0) { if ((krand() & 2) == 0) {
plr.poisoned = 1; plr.poisoned = 1;
plr.poisontime = 7200; plr.poisontime = 7200;
sprite[i].detail = GIFTBOXTYPE; spr.detail = GIFTBOXTYPE;
addhealth(plr, -10); addhealth(plr, -10);
showmessage("Poisoned Chest", 360); showmessage("Poisoned Chest", 360);
} else { } else {
deletesprite(i); DeleteActor(actor);
addscore(&plr, (krand() & 400) + 100); addscore(&plr, (krand() & 400) + 100);
showmessage("Treasure Chest", 360); showmessage("Treasure Chest", 360);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
@ -353,12 +354,12 @@ void InitItems()
break; break;
case 6: case 6:
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
explosion(i, sprite[i].x, sprite[i].y, sprite[i].z, sprite[i].owner); explosion(actor->GetSpriteIndex(), spr.x, spr.y, spr.z, spr.owner);
spritesound(S_EXPLODE, &sprite[i]); spritesound(S_EXPLODE, &spr);
deletesprite(i); DeleteActor(actor);
break; break;
default: default:
sprite[i].picnum = OPENCHEST; spr.picnum = OPENCHEST;
addscore(&plr, (krand() % 400) + 100); addscore(&plr, (krand() % 400) + 100);
showmessage("Experience Gained", 360); showmessage("Experience Gained", 360);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
@ -366,31 +367,31 @@ void InitItems()
} }
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // FLASKBLUE items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // FLASKBLUE
{ {
if (!potionspace(plr, 0)) if (!potionspace(plr, 0))
return; return;
showmessage("Health Potion", 360); showmessage("Health Potion", 360);
updatepotion(plr, HEALTHPOTION); updatepotion(plr, HEALTHPOTION);
plr.currentpotion = 0; plr.currentpotion = 0;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 10); addscore(&plr, 10);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // FLASKGREEN items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // FLASKGREEN
{ {
if (!potionspace(plr, 1)) if (!potionspace(plr, 1))
return; return;
showmessage("Strength Potion", 360); showmessage("Strength Potion", 360);
updatepotion(plr, STRENGTHPOTION); updatepotion(plr, STRENGTHPOTION);
plr.currentpotion = 1; plr.currentpotion = 1;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // FLASKOCHRE items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // FLASKOCHRE
{ {
if (!potionspace(plr, 2)) if (!potionspace(plr, 2))
@ -398,62 +399,62 @@ void InitItems()
showmessage("Cure Poison Potion", 360); showmessage("Cure Poison Potion", 360);
updatepotion(plr, ARMORPOTION); updatepotion(plr, ARMORPOTION);
plr.currentpotion = 2; plr.currentpotion = 2;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // FLASKRED items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // FLASKRED
{ {
if (!potionspace(plr, 3)) if (!potionspace(plr, 3))
return; return;
showmessage("Resist Fire Potion", 360); showmessage("Resist Fire Potion", 360);
updatepotion(plr, FIREWALKPOTION); updatepotion(plr, FIREWALKPOTION);
plr.currentpotion = 3; plr.currentpotion = 3;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 20); addscore(&plr, 20);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // FLASKTAN items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // FLASKTAN
{ {
if (!potionspace(plr, 4)) if (!potionspace(plr, 4))
return; return;
showmessage("Invisibility Potion", 360); showmessage("Invisibility Potion", 360);
updatepotion(plr, INVISIBLEPOTION); updatepotion(plr, INVISIBLEPOTION);
plr.currentpotion = 4; plr.currentpotion = 4;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 30); addscore(&plr, 30);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(14, 14, true, false, [](PLAYER& plr, short i) // DIAMONDRING items[a++].Init(14, 14, true, false, [](PLAYER& plr, DWHActor* actor) // DIAMONDRING
{ {
plr.treasure[TDIAMONDRING] = 1; plr.treasure[TDIAMONDRING] = 1;
showmessage("DIAMOND RING", 360); showmessage("DIAMOND RING", 360);
plr.armor = 0; plr.armor = 0;
addarmor(plr, 200); addarmor(plr, 200);
plr.armortype = 3; plr.armortype = 3;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 25); addscore(&plr, 25);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(30, 23, true, false, [](PLAYER& plr, short i) // SHADOWAMULET items[a++].Init(30, 23, true, false, [](PLAYER& plr, DWHActor* actor) // SHADOWAMULET
{ {
plr.treasure[TSHADOWAMULET] = 1; plr.treasure[TSHADOWAMULET] = 1;
showmessage("SHADOW AMULET", 360); showmessage("SHADOW AMULET", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
plr.shadowtime = 7500; plr.shadowtime = 7500;
addscore(&plr, 50); addscore(&plr, 50);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, false, [](PLAYER& plr, short i) // GLASSSKULL items[a++].Init(-1, -1, true, false, [](PLAYER& plr, DWHActor* actor) // GLASSSKULL
{ {
plr.treasure[TGLASSSKULL] = 1; plr.treasure[TGLASSSKULL] = 1;
showmessage("GLASS SKULL", 360); showmessage("GLASS SKULL", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
switch (plr.lvl) { switch (plr.lvl) {
@ -484,48 +485,48 @@ void InitItems()
} }
addscore(&plr, 10); addscore(&plr, 10);
}); });
items[a++].Init(51, 54, true, false, [](PLAYER& plr, short i) // AHNK items[a++].Init(51, 54, true, false, [](PLAYER& plr, DWHActor* actor) // AHNK
{ {
plr.treasure[TAHNK] = 1; plr.treasure[TAHNK] = 1;
showmessage("ANKH", 360); showmessage("ANKH", 360);
plr.health = 0; plr.health = 0;
addhealth(plr, 250); addhealth(plr, 250);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 100); addscore(&plr, 100);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(32, 32, true, false, [](PLAYER& plr, short i) // BLUESCEPTER items[a++].Init(32, 32, true, false, [](PLAYER& plr, DWHActor* actor) // BLUESCEPTER
{ {
plr.treasure[TBLUESCEPTER] = 1; plr.treasure[TBLUESCEPTER] = 1;
showmessage("Water walk scepter", 360); showmessage("Water walk scepter", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 10); addscore(&plr, 10);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(32, 32, true, false, [](PLAYER& plr, short i) // YELLOWSCEPTER items[a++].Init(32, 32, true, false, [](PLAYER& plr, DWHActor* actor) // YELLOWSCEPTER
{ {
plr.treasure[TYELLOWSCEPTER] = 1; plr.treasure[TYELLOWSCEPTER] = 1;
showmessage("Fire walk scepter", 360); showmessage("Fire walk scepter", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 10); addscore(&plr, 10);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(14, 14, true, false, [](PLAYER& plr, short i) // ADAMANTINERING items[a++].Init(14, 14, true, false, [](PLAYER& plr, DWHActor* actor) // ADAMANTINERING
{ {
// ring or protection +5 // ring or protection +5
plr.treasure[TADAMANTINERING] = 1; plr.treasure[TADAMANTINERING] = 1;
showmessage("ADAMANTINE RING", 360); showmessage("ADAMANTINE RING", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 30); addscore(&plr, 30);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(42, 28, true, false, [](PLAYER& plr, short i) // ONYXRING items[a++].Init(42, 28, true, false, [](PLAYER& plr, DWHActor* actor) // ONYXRING
{ {
// protection from missile // protection from missile
@ -533,12 +534,12 @@ void InitItems()
// dont forget to cleanup values // dont forget to cleanup values
plr.treasure[TONYXRING] = 1; plr.treasure[TONYXRING] = 1;
showmessage("ONYX RING", 360); showmessage("ONYX RING", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 35); addscore(&plr, 35);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(-1, -1, true, true, [](PLAYER& plr, short i) // PENTAGRAM items[a++].Init(-1, -1, true, true, [](PLAYER& plr, DWHActor* actor) // PENTAGRAM
{ {
if (sector[plr.sector].lotag == 4002) if (sector[plr.sector].lotag == 4002)
@ -546,13 +547,13 @@ void InitItems()
else { else {
plr.treasure[TPENTAGRAM] = 1; plr.treasure[TPENTAGRAM] = 1;
showmessage("PENTAGRAM", 360); showmessage("PENTAGRAM", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
addscore(&plr, 100); addscore(&plr, 100);
}); });
items[a++].Init(64, 64, true, false, [](PLAYER& plr, short i) // CRYSTALSTAFF items[a++].Init(64, 64, true, false, [](PLAYER& plr, DWHActor* actor) // CRYSTALSTAFF
{ {
plr.treasure[TCRYSTALSTAFF] = 1; plr.treasure[TCRYSTALSTAFF] = 1;
@ -562,23 +563,23 @@ void InitItems()
plr.armortype = 2; plr.armortype = 2;
plr.armor = 0; plr.armor = 0;
addarmor(plr, 300); addarmor(plr, 300);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
addscore(&plr, 150); addscore(&plr, 150);
}); });
items[a++].Init(26, 28, true, false, [](PLAYER& plr, short i) // AMULETOFTHEMIST items[a++].Init(26, 28, true, false, [](PLAYER& plr, DWHActor* actor) // AMULETOFTHEMIST
{ {
plr.treasure[TAMULETOFTHEMIST] = 1; plr.treasure[TAMULETOFTHEMIST] = 1;
showmessage("AMULET OF THE MIST", 360); showmessage("AMULET OF THE MIST", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
plr.invisibletime = 3200; plr.invisibletime = 3200;
addscore(&plr, 75); addscore(&plr, 75);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(64, 64, true, false, [](PLAYER& plr, short i) // HORNEDSKULL items[a++].Init(64, 64, true, false, [](PLAYER& plr, DWHActor* actor) // HORNEDSKULL
{ {
if (isWh2()) { if (isWh2()) {
@ -587,17 +588,17 @@ void InitItems()
} }
plr.treasure[THORNEDSKULL] = 1; plr.treasure[THORNEDSKULL] = 1;
showmessage("HORNED SKULL", 360); showmessage("HORNED SKULL", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_STING2); SND_Sound(S_STING2);
addscore(&plr, 750); addscore(&plr, 750);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(32, 32, true, false, [](PLAYER& plr, short i) // THEHORN items[a++].Init(32, 32, true, false, [](PLAYER& plr, DWHActor* actor) // THEHORN
{ {
plr.treasure[TTHEHORN] = 1; plr.treasure[TTHEHORN] = 1;
showmessage("Ornate Horn", 360); showmessage("Ornate Horn", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
plr.vampiretime = 7200; plr.vampiretime = 7200;
// gain 5-10 hp when you kill something // gain 5-10 hp when you kill something
@ -605,57 +606,57 @@ void InitItems()
addscore(&plr, 350); addscore(&plr, 350);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(30, 20, true, false, [](PLAYER& plr, short i) // SAPHIRERING items[a++].Init(30, 20, true, false, [](PLAYER& plr, DWHActor* actor) // SAPHIRERING
{ {
plr.treasure[TSAPHIRERING] = 1; plr.treasure[TSAPHIRERING] = 1;
showmessage("SAPPHIRE RING", 360); showmessage("SAPPHIRE RING", 360);
plr.armortype = 3; plr.armortype = 3;
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 25); addscore(&plr, 25);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(24, 24, true, false, [](PLAYER& plr, short i) // BRASSKEY items[a++].Init(24, 24, true, false, [](PLAYER& plr, DWHActor* actor) // BRASSKEY
{ {
plr.treasure[TBRASSKEY] = 1; plr.treasure[TBRASSKEY] = 1;
showmessage("BRASS KEY", 360); showmessage("BRASS KEY", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(24, 24, true, false, [](PLAYER& plr, short i) // BLACKKEY items[a++].Init(24, 24, true, false, [](PLAYER& plr, DWHActor* actor) // BLACKKEY
{ {
plr.treasure[TBLACKKEY] = 1; plr.treasure[TBLACKKEY] = 1;
showmessage("BLACK KEY", 360); showmessage("BLACK KEY", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
}); });
items[a++].Init(24, 24, true, false, [](PLAYER& plr, short i) // GLASSKEY items[a++].Init(24, 24, true, false, [](PLAYER& plr, DWHActor* actor) // GLASSKEY
{ {
plr.treasure[TGLASSKEY] = 1; plr.treasure[TGLASSKEY] = 1;
showmessage("GLASS KEY", 360); showmessage("GLASS KEY", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(24, 24, true, false, [](PLAYER& plr, short i) // IVORYKEY items[a++].Init(24, 24, true, false, [](PLAYER& plr, DWHActor* actor) // IVORYKEY
{ {
plr.treasure[TIVORYKEY] = 1; plr.treasure[TIVORYKEY] = 1;
showmessage("IVORY KEY", 360); showmessage("IVORY KEY", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 15); addscore(&plr, 15);
treasuresfound++; treasuresfound++;
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLSCARE items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLSCARE
{ {
if (plr.orbammo[0] < 10) { if (plr.orbammo[0] < 10) {
@ -663,12 +664,12 @@ void InitItems()
plr.orbammo[0]++; plr.orbammo[0]++;
changebook(plr, 0); changebook(plr, 0);
showmessage("Scare Scroll", 360); showmessage("Scare Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLNIGHT items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLNIGHT
{ {
if (plr.orbammo[1] < 10) { if (plr.orbammo[1] < 10) {
@ -676,12 +677,12 @@ void InitItems()
plr.orbammo[1]++; plr.orbammo[1]++;
changebook(plr, 1); changebook(plr, 1);
showmessage("Night Vision Scroll", 360); showmessage("Night Vision Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLFREEZE items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLFREEZE
{ {
if (plr.orbammo[2] < 10) { if (plr.orbammo[2] < 10) {
@ -689,12 +690,12 @@ void InitItems()
plr.orbammo[2]++; plr.orbammo[2]++;
changebook(plr, 2); changebook(plr, 2);
showmessage("Freeze Scroll", 360); showmessage("Freeze Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLMAGIC items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLMAGIC
{ {
if (plr.orbammo[3] < 10) { if (plr.orbammo[3] < 10) {
@ -702,12 +703,12 @@ void InitItems()
plr.orbammo[3]++; plr.orbammo[3]++;
changebook(plr, 3); changebook(plr, 3);
showmessage("Magic Arrow Scroll", 360); showmessage("Magic Arrow Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLOPEN items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLOPEN
{ {
if (plr.orbammo[4] < 10) { if (plr.orbammo[4] < 10) {
@ -715,12 +716,12 @@ void InitItems()
plr.orbammo[4]++; plr.orbammo[4]++;
changebook(plr, 4); changebook(plr, 4);
showmessage("Open Door Scroll", 360); showmessage("Open Door Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLFLY items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLFLY
{ {
if (plr.orbammo[5] < 10) { if (plr.orbammo[5] < 10) {
@ -728,12 +729,12 @@ void InitItems()
plr.orbammo[5]++; plr.orbammo[5]++;
changebook(plr, 5); changebook(plr, 5);
showmessage("Fly Scroll", 360); showmessage("Fly Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLFIREBALL items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLFIREBALL
{ {
if (plr.orbammo[6] < 10) { if (plr.orbammo[6] < 10) {
@ -741,12 +742,12 @@ void InitItems()
plr.orbammo[6]++; plr.orbammo[6]++;
changebook(plr, 6); changebook(plr, 6);
showmessage("Fireball Scroll", 360); showmessage("Fireball Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(35, 36, true, true, [](PLAYER& plr, short i) // SCROLLNUKE items[a++].Init(35, 36, true, true, [](PLAYER& plr, DWHActor* actor) // SCROLLNUKE
{ {
if (plr.orbammo[7] < 10) { if (plr.orbammo[7] < 10) {
@ -754,12 +755,12 @@ void InitItems()
plr.orbammo[7]++; plr.orbammo[7]++;
changebook(plr, 7); changebook(plr, 7);
showmessage("Nuke Scroll", 360); showmessage("Nuke Scroll", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
treasuresfound++; treasuresfound++;
} }
}); });
items[a++].Init(27, 27, false, false, [](PLAYER& plr, short i) // QUIVER items[a++].Init(27, 27, false, false, [](PLAYER& plr, DWHActor* actor) // QUIVER
{ {
if (plr.ammo[6] < 100) { if (plr.ammo[6] < 100) {
@ -767,12 +768,12 @@ void InitItems()
if (plr.ammo[6] > 100) if (plr.ammo[6] > 100)
plr.ammo[6] = 100; plr.ammo[6] = 100;
showmessage("Quiver of magic arrows", 360); showmessage("Quiver of magic arrows", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 10); addscore(&plr, 10);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WALLBOW BOW items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WALLBOW BOW
{ {
plr.weapon[6] = 1; plr.weapon[6] = 1;
@ -780,124 +781,125 @@ void InitItems()
if (plr.ammo[6] > 100) if (plr.ammo[6] > 100)
plr.ammo[6] = 100; plr.ammo[6] = 100;
showmessage("Magic bow", 360); showmessage("Magic bow", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 6) if (plr.selectedgun < 6)
autoweaponchange(plr, 6); autoweaponchange(plr, 6);
addscore(&plr, 10); addscore(&plr, 10);
}); });
items[a++].Init(34, 21, false, false, [](PLAYER& plr, short i) // WEAPON1 items[a++].Init(34, 21, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON1
{ {
if (plr.ammo[1] < 12) { if (plr.ammo[1] < 12) {
plr.weapon[1] = 1; plr.weapon[1] = 1;
plr.ammo[1] = 40; plr.ammo[1] = 40;
showmessage("Dagger", 360); showmessage("Dagger", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 1) if (plr.selectedgun < 1)
autoweaponchange(plr, 1); autoweaponchange(plr, 1);
addscore(&plr, 10); addscore(&plr, 10);
} }
}); });
items[a++].Init(34, 21, false, false, [](PLAYER& plr, short i) // WEAPON1A items[a++].Init(34, 21, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON1A
{ {
if (plr.ammo[1] < 12) { if (plr.ammo[1] < 12) {
plr.weapon[1] = 3; plr.weapon[1] = 3;
plr.ammo[1] = 80; plr.ammo[1] = 80;
showmessage("Jeweled Dagger", 360); showmessage("Jeweled Dagger", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
autoweaponchange(plr, 1); autoweaponchange(plr, 1);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(34, 21, false, false, [](PLAYER& plr, short i) // GOBWEAPON items[a++].Init(34, 21, false, false, [](PLAYER& plr, DWHActor* actor) // GOBWEAPON
{ {
if (plr.ammo[2] < 12) { if (plr.ammo[2] < 12) {
plr.weapon[2] = 1; plr.weapon[2] = 1;
plr.ammo[2] = 20; plr.ammo[2] = 20;
showmessage("Short sword", 360); showmessage("Short sword", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 2) if (plr.selectedgun < 2)
autoweaponchange(plr, 2); autoweaponchange(plr, 2);
addscore(&plr, 10); addscore(&plr, 10);
} }
}); });
items[a++].Init(26, 26, false, false, [](PLAYER& plr, short i) // WEAPON2 items[a++].Init(26, 26, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON2
{ {
if (plr.ammo[3] < 12) { if (plr.ammo[3] < 12) {
plr.weapon[3] = 1; plr.weapon[3] = 1;
plr.ammo[3] = 55; plr.ammo[3] = 55;
showmessage("Morning Star", 360); showmessage("Morning Star", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 3) if (plr.selectedgun < 3)
autoweaponchange(plr, 3); autoweaponchange(plr, 3);
addscore(&plr, 20); addscore(&plr, 20);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WALLSWORD WEAPON3A items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WALLSWORD WEAPON3A
{ {
if (plr.ammo[4] < 12) { if (plr.ammo[4] < 12) {
plr.weapon[4] = 1; plr.weapon[4] = 1;
plr.ammo[4] = 160; plr.ammo[4] = 160;
showmessage("Broad Sword", 360); showmessage("Broad Sword", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
autoweaponchange(plr, 4); autoweaponchange(plr, 4);
addscore(&plr, 60); addscore(&plr, 60);
} }
}); });
items[a++].Init(44, 39, false, false, [](PLAYER& plr, short i) // WEAPON3 items[a++].Init(44, 39, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON3
{ {
if (plr.ammo[4] < 12) { if (plr.ammo[4] < 12) {
plr.weapon[4] = 1; plr.weapon[4] = 1;
plr.ammo[4] = 80; plr.ammo[4] = 80;
showmessage("Broad Sword", 360); showmessage("Broad Sword", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 4) if (plr.selectedgun < 4)
autoweaponchange(plr, 4); autoweaponchange(plr, 4);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(25, 20, false, false, [](PLAYER& plr, short i) // WALLAXE WEAPON4 items[a++].Init(25, 20, false, false, [](PLAYER& plr, DWHActor* actor) // WALLAXE WEAPON4
{ {
if (plr.ammo[5] < 12) { if (plr.ammo[5] < 12) {
plr.weapon[5] = 1; plr.weapon[5] = 1;
plr.ammo[5] = 100; plr.ammo[5] = 100;
showmessage("Battle axe", 360); showmessage("Battle axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 5) if (plr.selectedgun < 5)
autoweaponchange(plr, 5); autoweaponchange(plr, 5);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // THROWHALBERD items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // THROWHALBERD
{ {
auto& spr = actor->s();
// EG fix: don't collect moving halberds, be hurt by them as you should be // EG fix: don't collect moving halberds, be hurt by them as you should be
// ...but only if you don't have the Onyx Ring // ...but only if you don't have the Onyx Ring
if (sprite[i].statnum != INACTIVE && plr.treasure[TONYXRING] == 0) { if (spr.statnum != INACTIVE && plr.treasure[TONYXRING] == 0) {
addhealth(plr, -((krand() % 20) + 5)); // Inflict pain addhealth(plr, -((krand() % 20) + 5)); // Inflict pain
// make it look and sound painful, too // make it look and sound painful, too
if ((krand() % 9) == 0) { if ((krand() % 9) == 0) {
spritesound(S_PLRPAIN1 + (rand() % 2), &sprite[i]); spritesound(S_PLRPAIN1 + (rand() % 2), &spr);
} }
startredflash(10); startredflash(10);
deletesprite(i); DeleteActor(actor);
return; return;
} }
if (sprite[i].statnum != INACTIVE && plr.treasure[TONYXRING] != 0) { if (spr.statnum != INACTIVE && plr.treasure[TONYXRING] != 0) {
// Can we grab? // Can we grab?
if (plr.ammo[9] < 12 && plr.weapon[9] != 3) { if (plr.ammo[9] < 12 && plr.weapon[9] != 3) {
// You grabbed a halberd out of midair, so go ahead and be smug about it // You grabbed a halberd out of midair, so go ahead and be smug about it
@ -907,7 +909,7 @@ void InitItems()
} }
else { else {
// Can't grab, so just block getting hit // Can't grab, so just block getting hit
deletesprite(i); DeleteActor(actor);
return; return;
} }
} }
@ -916,68 +918,68 @@ void InitItems()
plr.weapon[9] = 1; plr.weapon[9] = 1;
plr.ammo[9] = 30; plr.ammo[9] = 30;
showmessage("Halberd", 360); showmessage("Halberd", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 9) if (plr.selectedgun < 9)
autoweaponchange(plr, 9); autoweaponchange(plr, 9);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WEAPON5 items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON5
{ {
if (plr.ammo[9] < 12) { if (plr.ammo[9] < 12) {
plr.weapon[9] = 1; plr.weapon[9] = 1;
plr.ammo[9] = 30; plr.ammo[9] = 30;
showmessage("Halberd", 360); showmessage("Halberd", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 9) if (plr.selectedgun < 9)
autoweaponchange(plr, 9); autoweaponchange(plr, 9);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(12, 12, false, false, [](PLAYER& plr, short i) // GONZOBSHIELD items[a++].Init(12, 12, false, false, [](PLAYER& plr, DWHActor* actor) // GONZOBSHIELD
{ {
if (plr.shieldpoints < 100) { if (plr.shieldpoints < 100) {
plr.shieldtype = 2; plr.shieldtype = 2;
plr.shieldpoints = 200; plr.shieldpoints = 200;
droptheshield = false; droptheshield = false;
deletesprite(i); DeleteActor(actor);
showmessage("Magic Shield", 360); showmessage("Magic Shield", 360);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 50); addscore(&plr, 50);
} }
}); });
items[a++].Init(26, 26, false, false, [](PLAYER& plr, short i) // SHIELD items[a++].Init(26, 26, false, false, [](PLAYER& plr, DWHActor* actor) // SHIELD
{ {
if (plr.shieldpoints < 100) { if (plr.shieldpoints < 100) {
plr.shieldpoints = 100; plr.shieldpoints = 100;
plr.shieldtype = 1; plr.shieldtype = 1;
deletesprite(i); DeleteActor(actor);
showmessage("Shield", 360); showmessage("Shield", 360);
droptheshield = false; // EG 17 Oct 2017 droptheshield = false; // EG 17 Oct 2017
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 10); addscore(&plr, 10);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WEAPON5B items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON5B
{ {
if (plr.ammo[9] < 12) { // XXX orly? if (plr.ammo[9] < 12) { // XXX orly?
deletesprite(i); DeleteActor(actor);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WALLPIKE items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WALLPIKE
{ {
if (plr.weapon[7] == 1) { if (plr.weapon[7] == 1) {
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7] = 2; plr.ammo[7] = 2;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_PICKUPAXE); SND_Sound(S_PICKUPAXE);
addscore(&plr, 30); addscore(&plr, 30);
} }
@ -985,7 +987,7 @@ void InitItems()
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7]++; plr.ammo[7]++;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_PICKUPAXE); SND_Sound(S_PICKUPAXE);
// score(plr, 30); // score(plr, 30);
} }
@ -994,7 +996,7 @@ void InitItems()
plr.weapon[7] = 1; plr.weapon[7] = 1;
plr.ammo[7] = 30; plr.ammo[7] = 30;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 7) if (plr.selectedgun < 7)
autoweaponchange(plr, 7); autoweaponchange(plr, 7);
@ -1002,14 +1004,14 @@ void InitItems()
} }
} }
}); });
items[a++].Init(20, 15, false, true, [](PLAYER& plr, short i) // WEAPON6 items[a++].Init(20, 15, false, true, [](PLAYER& plr, DWHActor* actor) // WEAPON6
{ {
if (plr.weapon[7] == 1) { if (plr.weapon[7] == 1) {
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7] = 10; plr.ammo[7] = 10;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
addscore(&plr, 30); addscore(&plr, 30);
} }
@ -1017,7 +1019,7 @@ void InitItems()
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7] += 10; plr.ammo[7] += 10;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
// score(plr, 30); // score(plr, 30);
} }
@ -1026,7 +1028,7 @@ void InitItems()
plr.weapon[7] = 2; plr.weapon[7] = 2;
plr.ammo[7] = 10; plr.ammo[7] = 10;
showmessage("Pike axe", 360); showmessage("Pike axe", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 7) if (plr.selectedgun < 7)
autoweaponchange(plr, 7); autoweaponchange(plr, 7);
@ -1034,30 +1036,30 @@ void InitItems()
} }
} }
}); });
items[a++].Init(41, 36, false, true, [](PLAYER& plr, short i) // WEAPON7 items[a++].Init(41, 36, false, true, [](PLAYER& plr, DWHActor* actor) // WEAPON7
{ {
if (plr.ammo[8] < 12) { if (plr.ammo[8] < 12) {
plr.weapon[8] = 1; plr.weapon[8] = 1;
plr.ammo[8] = 250; plr.ammo[8] = 250;
showmessage("Magic sword", 360); showmessage("Magic sword", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
if (plr.selectedgun < 8) if (plr.selectedgun < 8)
autoweaponchange(plr, 8); autoweaponchange(plr, 8);
addscore(&plr, 30); addscore(&plr, 30);
} }
}); });
items[a++].Init(32, 18, false, false, [](PLAYER& plr, short i) // GYSER items[a++].Init(32, 18, false, false, [](PLAYER& plr, DWHActor* actor) // GYSER
{ {
if (plr.manatime < 1 && plr.invincibletime <= 0 && !plr.godMode) { if (plr.manatime < 1 && plr.invincibletime <= 0 && !plr.godMode) {
spritesound(S_FIREBALL, &sprite[i]); spritesound(S_FIREBALL, &actor->s());
addhealth(plr, -1); addhealth(plr, -1);
startredflash(30); startredflash(30);
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // SPIKEBLADE items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // SPIKEBLADE
{ {
if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) { if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) {
@ -1066,7 +1068,7 @@ void InitItems()
plr.spiked = 1; plr.spiked = 1;
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // SPIKE items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // SPIKE
{ {
if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) { if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) {
@ -1075,7 +1077,7 @@ void InitItems()
plr.spiked = 1; plr.spiked = 1;
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // SPIKEPOLE items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // SPIKEPOLE
{ {
if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) { if (plr.invincibletime <= 0 && !plr.godMode && !justteleported) {
@ -1084,20 +1086,20 @@ void InitItems()
plr.spiked = 1; plr.spiked = 1;
} }
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // MONSTERBALL items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // MONSTERBALL
{ {
if (plr.manatime < 1 && plr.invincibletime <= 0 && !plr.godMode) if (plr.manatime < 1 && plr.invincibletime <= 0 && !plr.godMode)
addhealth(plr, -1); addhealth(plr, -1);
}); });
items[a++].Init(-1, -1, false, false, [](PLAYER& plr, short i) // WEAPON8 items[a++].Init(-1, -1, false, false, [](PLAYER& plr, DWHActor* actor) // WEAPON8
{ {
if (plr.ammo[8] < 12) { if (plr.ammo[8] < 12) {
plr.weapon[8] = 1; plr.weapon[8] = 1;
plr.ammo[8] = 250; plr.ammo[8] = 250;
showmessage("Two Handed Sword", 360); showmessage("Two Handed Sword", 360);
deletesprite(i); DeleteActor(actor);
SND_Sound(S_POTION1); SND_Sound(S_POTION1);
autoweaponchange(plr, 8); autoweaponchange(plr, 8);
addscore(&plr, 30); addscore(&plr, 30);