mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
- handle_se05, 08, 10.
This commit is contained in:
parent
2edc7168ca
commit
45905b9137
4 changed files with 56 additions and 57 deletions
|
@ -3423,63 +3423,64 @@ void handle_se04(DDukeActor *actor)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void handle_se05(int i, int FIRELASER)
|
void handle_se05(DDukeActor* actor, int FIRELASER)
|
||||||
{
|
{
|
||||||
spritetype* s = &sprite[i];
|
auto s = &actor->s;
|
||||||
auto t = &hittype[i].temp_data[0];
|
int* t = &actor->temp_data[0];
|
||||||
auto sc = §or[s->sectnum];
|
auto sc = §or[s->sectnum];
|
||||||
int st = s->lotag;
|
int st = s->lotag;
|
||||||
int sh = s->hitag;
|
int sh = s->hitag;
|
||||||
int j, l, q, m;
|
int j, l, m;
|
||||||
|
|
||||||
int x, p = findplayer(s, &x);
|
int x, p = findplayer(&actor->s, &x);
|
||||||
if (x < 8192)
|
if (x < 8192)
|
||||||
{
|
{
|
||||||
j = s->ang;
|
j = s->ang;
|
||||||
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
|
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
|
||||||
fi.shoot(i, FIRELASER);
|
fi.shoot(actor->GetIndex(), FIRELASER);
|
||||||
s->ang = j;
|
s->ang = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->owner == -1) //Start search
|
auto Owner = actor->GetOwner();
|
||||||
|
if (Owner == nullptr) //Start search
|
||||||
{
|
{
|
||||||
t[4] = 0;
|
t[4] = 0;
|
||||||
l = 0x7fffffff;
|
l = 0x7fffffff;
|
||||||
while (1) //Find the shortest dist
|
while (1) //Find the shortest dist
|
||||||
{
|
{
|
||||||
hittype[i].SetOwner(LocateTheLocator((short)t[4], -1)); //t[0] hold sectnum
|
auto NewOwner = LocateTheLocator(t[4], -1); //t[0] hold sectnum
|
||||||
|
if (NewOwner == nullptr) break;
|
||||||
|
|
||||||
if (s->owner == -1) break;
|
m = ldist(ps[p].GetActor(), NewOwner);
|
||||||
|
|
||||||
m = ldist(&sprite[ps[p].i], &sprite[s->owner]);
|
|
||||||
|
|
||||||
if (l > m)
|
if (l > m)
|
||||||
{
|
{
|
||||||
q = s->owner;
|
Owner = NewOwner;
|
||||||
l = m;
|
l = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
t[4]++;
|
t[4]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->owner = q;
|
actor->SetOwner(Owner);
|
||||||
s->zvel = ksgn(sprite[q].z - s->z) << 4;
|
if (!Owner) return; // Undefined case - was not checked.
|
||||||
|
s->zvel = ksgn(Owner->s.z - s->z) << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ldist(&sprite[s->owner], s) < 1024)
|
if (ldist(Owner, actor) < 1024)
|
||||||
{
|
{
|
||||||
short ta;
|
short ta;
|
||||||
ta = s->ang;
|
ta = s->ang;
|
||||||
s->ang = getangle(ps[p].posx - s->x, ps[p].posy - s->y);
|
s->ang = getangle(ps[p].posx - s->x, ps[p].posy - s->y);
|
||||||
s->ang = ta;
|
s->ang = ta;
|
||||||
s->owner = -1;
|
actor->SetOwner(nullptr);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
else s->xvel = 256;
|
else s->xvel = 256;
|
||||||
|
|
||||||
x = getangle(sprite[s->owner].x - s->x, sprite[s->owner].y - s->y);
|
x = getangle(Owner->s.x - s->x, Owner->s.y - s->y);
|
||||||
q = getincangle(s->ang, x) >> 3;
|
int q = getincangle(s->ang, x) >> 3;
|
||||||
s->ang += q;
|
s->ang += q;
|
||||||
|
|
||||||
if (rnd(32))
|
if (rnd(32))
|
||||||
|
@ -3493,7 +3494,7 @@ void handle_se05(int i, int FIRELASER)
|
||||||
getincangle(t[2] + 512, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2;
|
getincangle(t[2] + 512, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2;
|
||||||
sc->ceilingshade = 0;
|
sc->ceilingshade = 0;
|
||||||
}
|
}
|
||||||
j = fi.ifhitbyweapon(&hittype[i]);
|
j = fi.ifhitbyweapon(actor);
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
t[3]++;
|
t[3]++;
|
||||||
|
@ -3507,8 +3508,8 @@ void handle_se05(int i, int FIRELASER)
|
||||||
s->z += s->zvel;
|
s->z += s->zvel;
|
||||||
sc->ceilingz += s->zvel;
|
sc->ceilingz += s->zvel;
|
||||||
sector[t[0]].ceilingz += s->zvel;
|
sector[t[0]].ceilingz += s->zvel;
|
||||||
ms(i);
|
ms(actor);
|
||||||
setsprite(i, s->x, s->y, s->z);
|
setsprite(actor, s->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -3517,23 +3518,23 @@ void handle_se05(int i, int FIRELASER)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void handle_se08(int i, bool checkhitag1)
|
void handle_se08(DDukeActor *actor, bool checkhitag1)
|
||||||
{
|
{
|
||||||
// work only if its moving
|
// work only if its moving
|
||||||
spritetype* s = &sprite[i];
|
auto s = &actor->s;
|
||||||
auto t = &hittype[i].temp_data[0];
|
int* t = &actor->temp_data[0];
|
||||||
auto sc = §or[s->sectnum];
|
auto sc = §or[s->sectnum];
|
||||||
int st = s->lotag;
|
int st = s->lotag;
|
||||||
int sh = s->hitag;
|
int sh = s->hitag;
|
||||||
|
|
||||||
int x, j = -1;
|
int x, j = -1;
|
||||||
|
|
||||||
if (hittype[i].temp_data[4])
|
if (actor->temp_data[4])
|
||||||
{
|
{
|
||||||
hittype[i].temp_data[4]++;
|
actor->temp_data[4]++;
|
||||||
if (hittype[i].temp_data[4] > 8)
|
if (actor->temp_data[4] > 8)
|
||||||
{
|
{
|
||||||
deletesprite(i);
|
deletesprite(actor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
j = 1;
|
j = 1;
|
||||||
|
@ -3544,22 +3545,21 @@ void handle_se08(int i, bool checkhitag1)
|
||||||
{
|
{
|
||||||
short sn;
|
short sn;
|
||||||
|
|
||||||
if ((sc->lotag & 0x8000) || hittype[i].temp_data[4])
|
if ((sc->lotag & 0x8000) || actor->temp_data[4])
|
||||||
x = -t[3];
|
x = -t[3];
|
||||||
else
|
else
|
||||||
x = t[3];
|
x = t[3];
|
||||||
|
|
||||||
if (st == 9) x = -x;
|
if (st == 9) x = -x;
|
||||||
|
|
||||||
StatIterator it(STAT_EFFECTOR);
|
DukeStatIterator it(STAT_EFFECTOR);
|
||||||
while ((j = it.NextIndex()) >= 0)
|
while (auto ac = it.Next())
|
||||||
{
|
{
|
||||||
auto sj = &sprite[j];
|
if (((ac->s.lotag) == st) && (ac->s.hitag) == sh)
|
||||||
if (((sj->lotag) == st) && (sj->hitag) == sh)
|
|
||||||
{
|
{
|
||||||
sn = sj->sectnum;
|
sn = ac->s.sectnum;
|
||||||
auto sect = §or[sn];
|
auto sect = §or[sn];
|
||||||
int m = sj->shade;
|
int m = ac->s.shade;
|
||||||
|
|
||||||
auto wal = &wall[sect->wallptr];
|
auto wal = &wall[sect->wallptr];
|
||||||
|
|
||||||
|
@ -3571,8 +3571,8 @@ void handle_se08(int i, bool checkhitag1)
|
||||||
|
|
||||||
if (wal->shade < m)
|
if (wal->shade < m)
|
||||||
wal->shade = m;
|
wal->shade = m;
|
||||||
else if (wal->shade > hittype[j].temp_data[2])
|
else if (wal->shade > ac->temp_data[2])
|
||||||
wal->shade = hittype[j].temp_data[2];
|
wal->shade = ac->temp_data[2];
|
||||||
|
|
||||||
if (wal->nextwall >= 0)
|
if (wal->nextwall >= 0)
|
||||||
if (wall[wal->nextwall].hitag != 1)
|
if (wall[wal->nextwall].hitag != 1)
|
||||||
|
@ -3585,16 +3585,16 @@ void handle_se08(int i, bool checkhitag1)
|
||||||
|
|
||||||
if (sect->floorshade < m)
|
if (sect->floorshade < m)
|
||||||
sect->floorshade = m;
|
sect->floorshade = m;
|
||||||
else if (sect->floorshade > hittype[j].temp_data[0])
|
else if (sect->floorshade > ac->temp_data[0])
|
||||||
sect->floorshade = hittype[j].temp_data[0];
|
sect->floorshade = ac->temp_data[0];
|
||||||
|
|
||||||
if (sect->ceilingshade < m)
|
if (sect->ceilingshade < m)
|
||||||
sect->ceilingshade = m;
|
sect->ceilingshade = m;
|
||||||
else if (sect->ceilingshade > hittype[j].temp_data[1])
|
else if (sect->ceilingshade > ac->temp_data[1])
|
||||||
sect->ceilingshade = hittype[j].temp_data[1];
|
sect->ceilingshade = ac->temp_data[1];
|
||||||
|
|
||||||
if (checkhitag1 && sect->hitag == 1)
|
if (checkhitag1 && sect->hitag == 1)
|
||||||
sect->ceilingshade = hittype[j].temp_data[1];
|
sect->ceilingshade = ac->temp_data[1];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3607,10 +3607,10 @@ void handle_se08(int i, bool checkhitag1)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void handle_se10(int i, const int* specialtags)
|
void handle_se10(DDukeActor* actor, const int* specialtags)
|
||||||
{
|
{
|
||||||
spritetype* s = &sprite[i];
|
auto s = &actor->s;
|
||||||
auto t = &hittype[i].temp_data[0];
|
int* t = &actor->temp_data[0];
|
||||||
auto sc = §or[s->sectnum];
|
auto sc = §or[s->sectnum];
|
||||||
int st = s->lotag;
|
int st = s->lotag;
|
||||||
int sh = s->hitag;
|
int sh = s->hitag;
|
||||||
|
@ -3622,7 +3622,7 @@ void handle_se10(int i, const int* specialtags)
|
||||||
if ((sc->lotag & 0xff) != 27)
|
if ((sc->lotag & 0xff) != 27)
|
||||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||||
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
|
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
|
||||||
if (s->sectnum == sprite[ps[p].i].sectnum)
|
if (s->sectnum == ps[p].GetActor()->s.sectnum)
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
if (j == 1)
|
if (j == 1)
|
||||||
|
@ -3636,7 +3636,7 @@ void handle_se10(int i, const int* specialtags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fi.activatebysector(s->sectnum, i);
|
fi.activatebysector(s->sectnum, actor->GetIndex());
|
||||||
t[0] = 0;
|
t[0] = 0;
|
||||||
}
|
}
|
||||||
else t[0]++;
|
else t[0]++;
|
||||||
|
|
|
@ -3613,18 +3613,18 @@ void moveeffectors_d(void) //STATNUM 3
|
||||||
|
|
||||||
//BOSS
|
//BOSS
|
||||||
case SE_5_BOSS:
|
case SE_5_BOSS:
|
||||||
handle_se05(i, FIRELASER);
|
handle_se05(&hittype[i], FIRELASER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
||||||
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
||||||
handle_se08(i, false);
|
handle_se08(&hittype[i], false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SE_10_DOOR_AUTO_CLOSE:
|
case SE_10_DOOR_AUTO_CLOSE:
|
||||||
{
|
{
|
||||||
static const int tags[] = { 20, 21, 22, 26, 0};
|
static const int tags[] = { 20, 21, 22, 26, 0};
|
||||||
handle_se10(i, tags);
|
handle_se10(&hittype[i], tags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SE_11_SWINGING_DOOR:
|
case SE_11_SWINGING_DOOR:
|
||||||
|
|
|
@ -1519,7 +1519,6 @@ static void weaponcommon_r(int i)
|
||||||
}
|
}
|
||||||
if ((s->picnum == RPG || (isRRRA() && s->picnum == RPG2)) && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(184))
|
if ((s->picnum == RPG || (isRRRA() && s->picnum == RPG2)) && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(184))
|
||||||
fi.spawn(i, WATERBUBBLE);
|
fi.spawn(i, WATERBUBBLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -3578,17 +3577,17 @@ void moveeffectors_r(void) //STATNUM 3
|
||||||
|
|
||||||
//BOSS
|
//BOSS
|
||||||
case SE_5_BOSS:
|
case SE_5_BOSS:
|
||||||
handle_se05(i, FIRELASER);
|
handle_se05(&hittype[i], FIRELASER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
||||||
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
||||||
handle_se08(i, true);
|
handle_se08(&hittype[i], true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SE_10_DOOR_AUTO_CLOSE:
|
case SE_10_DOOR_AUTO_CLOSE:
|
||||||
|
|
||||||
handle_se10(i, nullptr);
|
handle_se10(&hittype[i], nullptr);
|
||||||
break;
|
break;
|
||||||
case SE_11_SWINGING_DOOR:
|
case SE_11_SWINGING_DOOR:
|
||||||
handle_se11(i);
|
handle_se11(i);
|
||||||
|
|
|
@ -70,9 +70,9 @@ void handle_se30(DDukeActor* i, int JIBS6);
|
||||||
void handle_se02(DDukeActor* i);
|
void handle_se02(DDukeActor* i);
|
||||||
void handle_se03(DDukeActor* i);
|
void handle_se03(DDukeActor* i);
|
||||||
void handle_se04(DDukeActor* i);
|
void handle_se04(DDukeActor* i);
|
||||||
void handle_se05(int i, int FIRELASER);
|
void handle_se05(DDukeActor* i, int FIRELASER);
|
||||||
void handle_se08(int i, bool checkhitag1);
|
void handle_se08(DDukeActor* i, bool checkhitag1);
|
||||||
void handle_se10(int i, const int *);
|
void handle_se10(DDukeActor* i, const int *);
|
||||||
void handle_se11(int i);
|
void handle_se11(int i);
|
||||||
void handle_se12(int i, int planeonly = 0);
|
void handle_se12(int i, int planeonly = 0);
|
||||||
void handle_se13(int i);
|
void handle_se13(int i);
|
||||||
|
|
Loading…
Reference in a new issue