- attack()

This commit is contained in:
Christoph Oelckers 2021-11-14 18:23:08 +01:00
parent e8101ed970
commit 486066e02d
14 changed files with 27 additions and 27 deletions

View file

@ -678,7 +678,7 @@ void skullycastspell(PLAYER& plr, int i) {
spawned.backuploc();
}
void attack(PLAYER& plr, int const i) {
void attack(PLAYER& plr, DWHActor* actor) {
int s = 0;
if (plr.invincibletime > 0 || plr.godMode)
return;
@ -688,7 +688,6 @@ void attack(PLAYER& plr, int const i) {
// if ((krand() & (15 < plr.armortype ? 11 : 10)) != 0)
// return;
auto actor = &whActors[i];
auto& spr = actor->s();
auto& pspr = sprite[plr.spritenum];

View file

@ -128,7 +128,7 @@ int checkfluid(DWHActor* i, Collision& florhit);
void processfluid(DWHActor* i, Collision& florHit, boolean fly);
void castspell(PLAYER& plr, DWHActor* i);
void skullycastspell(PLAYER& plr, int i);
void attack(PLAYER& plr, int i);
void attack(PLAYER& plr, DWHActor* i);
int checkmove(DWHActor* actor, int dax, int day);
boolean checkdist(PLAYER& plr, DWHActor* i);
boolean checkdist(DWHActor* i, int x, int y, int z);

View file

@ -6,7 +6,7 @@ BEGIN_WH_NS
static int checksight_x, checksight_y = 0;
static void dragonAttack2(PLAYER& plr, DWHActor* i);
static void firebreath(PLAYER& plr, int i, int a, int b, int c);
static void firebreath(PLAYER& plr, DWHActor*, int a, int b, int c);
static void chasedragon(PLAYER& plr, DWHActor* actor)
{
@ -143,7 +143,7 @@ static void castdragon(PLAYER& plr, DWHActor* actor)
else
spritesound(S_FIREBALL, actor);
firebreath(plr, i, 1, 2, LOW);
firebreath(plr, actor, 1, 2, LOW);
break;
case DRAGONATTACK + 18:
case DRAGONATTACK + 5:
@ -152,7 +152,7 @@ static void castdragon(PLAYER& plr, DWHActor* actor)
else
spritesound(S_FIREBALL, actor);
firebreath(plr, i, 2, 1, LOW);
firebreath(plr, actor, 2, 1, LOW);
break;
case DRAGONATTACK + 19:
case DRAGONATTACK + 6:
@ -161,15 +161,15 @@ static void castdragon(PLAYER& plr, DWHActor* actor)
else
spritesound(S_FIREBALL, actor);
firebreath(plr, i, 4, 0, LOW);
firebreath(plr, actor, 4, 0, LOW);
break;
case DRAGONATTACK + 20:
case DRAGONATTACK + 7:
firebreath(plr, i, 2, -1, LOW);
firebreath(plr, actor, 2, -1, LOW);
break;
case DRAGONATTACK + 21:
case DRAGONATTACK + 8:
firebreath(plr, i, 1, -2, LOW);
firebreath(plr, actor, 1, -2, LOW);
break;
case DRAGONATTACK2 + 2:
@ -178,10 +178,10 @@ static void castdragon(PLAYER& plr, DWHActor* actor)
else
spritesound(S_FIREBALL, actor);
firebreath(plr, i, 1, -1, HIGH);
firebreath(plr, actor, 1, -1, HIGH);
break;
case DRAGONATTACK2 + 3:
firebreath(plr, i, 2, 0, HIGH);
firebreath(plr, actor, 2, 0, HIGH);
break;
case DRAGONATTACK2 + 5:
@ -337,14 +337,15 @@ static void dragonAttack2(PLAYER& plr, DWHActor* actor)
checksector6(actor);
}
static void firebreath(PLAYER& plr, int i, int a, int b, int c)
static void firebreath(PLAYER& plr, DWHActor* actor, int a, int b, int c)
{
auto& spr = sprite[i];
auto& spr = actor->s();
for (int k = 0; k <= a; k++) {
int j = insertsprite(spr.sectnum, MISSILE);
if (j == -1)
return;
auto& spawned = sprite[j];
auto spawnedactor = &whActors[j];
auto& spawned = spawnedactor->s();
spawned.x = spr.x;
spawned.y = spr.y;
@ -370,7 +371,7 @@ static void firebreath(PLAYER& plr, int i, int a, int b, int c)
else
spawned.zvel = (short)((((plr.z + (8 << 8)) - spawned.z) << 7) / discrim);// NEW
spawned.owner = (short)i;
spawned.owner = actor->GetSpriteIndex();
spawned.clipdist = 16;
spawned.lotag = 512;
spawned.hitag = 0;

View file

@ -105,7 +105,7 @@ static void attackfish(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -205,7 +205,7 @@ static void attackfred(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -250,7 +250,7 @@ static void attackgoblin(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -388,7 +388,7 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
@ -420,7 +420,7 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -305,7 +305,7 @@ static void attackgron(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -254,7 +254,7 @@ static void attackimp(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -223,7 +223,7 @@ static void attackkobold(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -227,7 +227,7 @@ static void attackminotaur(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -294,7 +294,7 @@ static void attacknewguy(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -231,7 +231,7 @@ static void attackskeleton(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
}
}
else if (spr.lotag < 0) {

View file

@ -204,7 +204,7 @@ static void attackspider(PLAYER& plr, DWHActor* actor)
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
attack(plr, i);
attack(plr, actor);
if (krand() % 100 > ((plr.lvl * 7) + 20)) {
spritesound(S_SPIDERBITE, actor);
plr.poisoned = 1;