mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-01 14:11:01 +00:00
- chickenarrow and movefireball.
This commit is contained in:
parent
a3860de440
commit
c5f7c29ead
2 changed files with 32 additions and 29 deletions
|
@ -1553,30 +1553,32 @@ void movestandables_d(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static bool movefireball(int i)
|
static bool movefireball(DDukeActor* actor)
|
||||||
{
|
{
|
||||||
auto s = &sprite[i];
|
auto s = &actor->s;
|
||||||
auto ht = &hittype[i];
|
auto Owner = actor->GetOwner();
|
||||||
|
|
||||||
if (sector[s->sectnum].lotag == 2)
|
if (sector[s->sectnum].lotag == 2)
|
||||||
{
|
{
|
||||||
deletesprite(i);
|
deletesprite(actor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sprite[s->owner].picnum != FIREBALL)
|
if (!Owner || Owner->s.picnum != FIREBALL)
|
||||||
{
|
{
|
||||||
if (ht->temp_data[0] >= 1 && ht->temp_data[0] < 6)
|
if (actor->temp_data[0] >= 1 && actor->temp_data[0] < 6)
|
||||||
{
|
{
|
||||||
float siz = 1.0f - (ht->temp_data[0] * 0.2f);
|
float siz = 1.0f - (actor->temp_data[0] * 0.2f);
|
||||||
int trail = ht->temp_data[1];
|
// This still needs work- it stores an actor reference in a general purpose integer field.
|
||||||
int j = ht->temp_data[1] = fi.spawn(i, FIREBALL);
|
int trail = actor->temp_data[1];
|
||||||
|
auto ball = spawn(actor, FIREBALL);
|
||||||
auto spr = &sprite[j];
|
auto spr = &ball->s;
|
||||||
|
actor->temp_data[1] = ball->GetIndex();
|
||||||
|
|
||||||
spr->xvel = s->xvel;
|
spr->xvel = s->xvel;
|
||||||
spr->yvel = s->yvel;
|
spr->yvel = s->yvel;
|
||||||
spr->zvel = s->zvel;
|
spr->zvel = s->zvel;
|
||||||
if (ht->temp_data[0] > 1)
|
if (actor->temp_data[0] > 1)
|
||||||
{
|
{
|
||||||
FireProj* proj = fire.CheckKey(trail);
|
FireProj* proj = fire.CheckKey(trail);
|
||||||
if (proj != nullptr)
|
if (proj != nullptr)
|
||||||
|
@ -1589,15 +1591,16 @@ static bool movefireball(int i)
|
||||||
spr->zvel = proj->zv;
|
spr->zvel = proj->zv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spr->yrepeat = spr->xrepeat = (short)(sprite[i].xrepeat * siz);
|
spr->yrepeat = spr->xrepeat = (short)(s->xrepeat * siz);
|
||||||
spr->cstat = sprite[i].cstat;
|
spr->cstat = s->cstat;
|
||||||
spr->extra = 0;
|
spr->extra = 0;
|
||||||
|
|
||||||
FireProj proj = { spr->x, spr->y, spr->z, spr->xvel, spr->yvel, spr->zvel };
|
FireProj proj = { spr->x, spr->y, spr->z, spr->xvel, spr->yvel, spr->zvel };
|
||||||
fire.Insert(j, proj);
|
|
||||||
changespritestat((short)j, (short)4);
|
fire.Insert(ball->GetIndex(), proj);
|
||||||
|
changespritestat(ball, STAT_PROJECTILE);
|
||||||
}
|
}
|
||||||
ht->temp_data[0]++;
|
actor->temp_data[0]++;
|
||||||
}
|
}
|
||||||
if (s->zvel < 15000)
|
if (s->zvel < 15000)
|
||||||
s->zvel += 200;
|
s->zvel += 200;
|
||||||
|
@ -1799,7 +1802,7 @@ static void weaponcommon_d(int i)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIREBALL:
|
case FIREBALL:
|
||||||
if (movefireball(i)) return;
|
if (movefireball(&hittype[i])) return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1103,27 +1103,27 @@ void movestandables_r(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void chickenarrow(int i)
|
static void chickenarrow(DDukeActor* actor)
|
||||||
{
|
{
|
||||||
auto s = &sprite[i];
|
auto s = &actor->s;
|
||||||
s->hitag++;
|
s->hitag++;
|
||||||
if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
if (actor->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
||||||
{
|
{
|
||||||
int j = fi.spawn(i, SMALLSMOKE);
|
auto spawned = spawn(actor, SMALLSMOKE);
|
||||||
sprite[j].z += (1 << 8);
|
spawned->s.z += (1 << 8);
|
||||||
if ((krand() & 15) == 2)
|
if ((krand() & 15) == 2)
|
||||||
{
|
{
|
||||||
j = fi.spawn(i, 1310);
|
spawn(actor, MONEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sprite[s->lotag].extra <= 0)
|
auto ts = &hittype[s->lotag]; // Grrrr...
|
||||||
|
|
||||||
|
if (ts->s.extra <= 0)
|
||||||
s->lotag = 0;
|
s->lotag = 0;
|
||||||
if (s->lotag != 0 && s->hitag > 5)
|
if (s->lotag != 0 && s->hitag > 5)
|
||||||
{
|
{
|
||||||
spritetype* ts;
|
|
||||||
int ang, ang2, ang3;
|
int ang, ang2, ang3;
|
||||||
ts = &sprite[s->lotag];
|
ang = getangle(ts->s.x - s->x, ts->s.y - s->y);
|
||||||
ang = getangle(ts->x - s->x, ts->y - s->y);
|
|
||||||
ang2 = ang - s->ang;
|
ang2 = ang - s->ang;
|
||||||
ang3 = abs(ang2);
|
ang3 = abs(ang2);
|
||||||
if (ang2 < 100)
|
if (ang2 < 100)
|
||||||
|
@ -1401,7 +1401,7 @@ static void weaponcommon_r(int i)
|
||||||
break;
|
break;
|
||||||
case RPG2:
|
case RPG2:
|
||||||
if (!isRRRA()) break;
|
if (!isRRRA()) break;
|
||||||
chickenarrow(i);
|
chickenarrow(&hittype[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RRTILE1790:
|
case RRTILE1790:
|
||||||
|
|
Loading…
Reference in a new issue