mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
- henstand and bowling.
This commit is contained in:
parent
a31a19d430
commit
2ad31247ec
2 changed files with 198 additions and 207 deletions
|
@ -38,7 +38,7 @@ BEGIN_DUKE_NS
|
||||||
void dojaildoor();
|
void dojaildoor();
|
||||||
void moveminecart();
|
void moveminecart();
|
||||||
|
|
||||||
void ballreturn(short spr);
|
void ballreturn(DDukeActor* spr);
|
||||||
short pinsectorresetdown(short sect);
|
short pinsectorresetdown(short sect);
|
||||||
short pinsectorresetup(short sect);
|
short pinsectorresetup(short sect);
|
||||||
short checkpins(short sect);
|
short checkpins(short sect);
|
||||||
|
@ -2767,20 +2767,19 @@ DETONATEB:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static int henstand(int i)
|
static int henstand(DDukeActor *actor)
|
||||||
{
|
{
|
||||||
spritetype* s = &sprite[i];
|
auto s = &actor->s;
|
||||||
auto t = &hittype[i].temp_data[0];
|
auto t = &actor->temp_data[0];
|
||||||
int sect = s->sectnum;
|
int sect = s->sectnum;
|
||||||
int j;
|
|
||||||
|
|
||||||
if (s->picnum == HENSTAND || s->picnum == HENSTAND + 1)
|
if (s->picnum == HENSTAND || s->picnum == HENSTAND + 1)
|
||||||
{
|
{
|
||||||
s->lotag--;
|
s->lotag--;
|
||||||
if (s->lotag == 0)
|
if (s->lotag == 0)
|
||||||
{
|
{
|
||||||
fi.spawn(i, HEN);
|
spawn(actor, HEN);
|
||||||
deletesprite(i);
|
deletesprite(actor);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2788,32 +2787,33 @@ static int henstand(int i)
|
||||||
s->xvel = 0;
|
s->xvel = 0;
|
||||||
if (s->xvel)
|
if (s->xvel)
|
||||||
{
|
{
|
||||||
makeitfall(i);
|
makeitfall(actor);
|
||||||
j = fi.movesprite(i,
|
Collision coll;
|
||||||
|
movesprite_ex(actor,
|
||||||
(sintable[(s->ang + 512) & 2047] * s->xvel) >> 14,
|
(sintable[(s->ang + 512) & 2047] * s->xvel) >> 14,
|
||||||
(sintable[s->ang & 2047] * s->xvel) >> 14,
|
(sintable[s->ang & 2047] * s->xvel) >> 14,
|
||||||
s->zvel, CLIPMASK0);
|
s->zvel, CLIPMASK0, coll);
|
||||||
if (j & 49152)
|
if (coll.type)
|
||||||
{
|
{
|
||||||
if ((j & 49152) == 32768)
|
if (coll.type == kHitWall)
|
||||||
{
|
{
|
||||||
j &= (MAXWALLS - 1);
|
int j = coll.index;
|
||||||
int k = getangle(
|
int k = getangle(
|
||||||
wall[wall[j].point2].x - wall[j].x,
|
wall[wall[j].point2].x - wall[j].x,
|
||||||
wall[wall[j].point2].y - wall[j].y);
|
wall[wall[j].point2].y - wall[j].y);
|
||||||
s->ang = ((k << 1) - s->ang) & 2047;
|
s->ang = ((k << 1) - s->ang) & 2047;
|
||||||
}
|
}
|
||||||
else if ((j & 49152) == 49152)
|
else if (coll.type == kHitSprite)
|
||||||
{
|
{
|
||||||
j &= (MAXSPRITES - 1);
|
auto hitact = coll.actor;
|
||||||
fi.checkhitsprite(i, j);
|
fi.checkhitsprite(actor->GetIndex(), hitact->GetIndex());
|
||||||
if (sprite[j].picnum == HEN)
|
if (hitact->s.picnum == HEN)
|
||||||
{
|
{
|
||||||
int ns = fi.spawn(j, HENSTAND);
|
auto ns = spawn(hitact, HENSTAND);
|
||||||
deletesprite(j);
|
deletesprite(hitact);
|
||||||
sprite[ns].xvel = 32;
|
ns->s.xvel = 32;
|
||||||
sprite[ns].lotag = 40;
|
ns->s.lotag = 40;
|
||||||
sprite[ns].ang = s->ang;
|
ns->s.ang = s->ang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2834,18 +2834,18 @@ static int henstand(int i)
|
||||||
if (krand() & 1)
|
if (krand() & 1)
|
||||||
s->picnum = HENSTAND + 1;
|
s->picnum = HENSTAND + 1;
|
||||||
if (!s->xvel)
|
if (!s->xvel)
|
||||||
return 2;//deletesprite(i); still needs to run a script but should not do on a deleted object
|
return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object
|
||||||
}
|
}
|
||||||
if (s->picnum == RRTILE3440 || (s->picnum == RRTILE3440 + 1 && !s->xvel))
|
if (s->picnum == RRTILE3440 || (s->picnum == RRTILE3440 + 1 && !s->xvel))
|
||||||
{
|
{
|
||||||
return 2;//deletesprite(i); still needs to run a script but should not do on a deleted object
|
return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sector[s->sectnum].lotag == 900)
|
else if (sector[s->sectnum].lotag == 900)
|
||||||
{
|
{
|
||||||
if (s->picnum == BOWLINGBALL)
|
if (s->picnum == BOWLINGBALL)
|
||||||
ballreturn(i);
|
ballreturn(actor);
|
||||||
deletesprite(i);
|
deletesprite(actor);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3023,7 +3023,7 @@ void moveactors_r(void)
|
||||||
case HENSTAND:
|
case HENSTAND:
|
||||||
case HENSTAND+1:
|
case HENSTAND+1:
|
||||||
{
|
{
|
||||||
int todo = henstand(i);
|
int todo = henstand(&hittype[i]);
|
||||||
if (todo == 2) deleteafterexecute = true;
|
if (todo == 2) deleteafterexecute = true;
|
||||||
if (todo == 1) continue;
|
if (todo == 1) continue;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,25 +36,22 @@ BEGIN_DUKE_NS
|
||||||
short pinsectorresetdown(short sect);
|
short pinsectorresetdown(short sect);
|
||||||
|
|
||||||
|
|
||||||
void ballreturn(short spr)
|
void ballreturn(DDukeActor *ball)
|
||||||
{
|
{
|
||||||
int j, i;
|
DukeStatIterator it(STAT_BOWLING);
|
||||||
StatIterator it(STAT_BOWLING);
|
while (auto act = it.Next())
|
||||||
while ((i = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
auto si = &sprite[i];
|
if (act->s.picnum == RRTILE281 && ball->s.sectnum == act->s.sectnum)
|
||||||
if (si->picnum == RRTILE281 && sprite[spr].sectnum == si->sectnum)
|
|
||||||
{
|
{
|
||||||
StatIterator it2(STAT_BOWLING);
|
DukeStatIterator it2(STAT_BOWLING);
|
||||||
while ((j = it2.NextIndex()) >= 0)
|
while (auto act2 = it2.Next())
|
||||||
{
|
{
|
||||||
auto sj = &sprite[j];
|
if (act2->s.picnum == RRTILE282 && act->s.hitag == act2->s.hitag)
|
||||||
if (sj->picnum == RRTILE282 && si->hitag == sj->hitag)
|
spawn(act2, BOWLINGBALLSPRITE);
|
||||||
fi.spawn(j, BOWLINGBALLSPRITE);
|
if (act2->s.picnum == RRTILE280 && act->s.hitag == act2->s.hitag && act2->s.lotag == 0)
|
||||||
if (sj->picnum == RRTILE280 && si->hitag == sj->hitag && sj->lotag == 0)
|
|
||||||
{
|
{
|
||||||
sj->lotag = 100;
|
act2->s.lotag = 100;
|
||||||
sj->extra++;
|
act2->s.extra++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,15 +60,12 @@ void ballreturn(short spr)
|
||||||
|
|
||||||
short pinsectorresetdown(short sect)
|
short pinsectorresetdown(short sect)
|
||||||
{
|
{
|
||||||
int vel, j;
|
int j = getanimationgoal(anim_ceilingz, sect);
|
||||||
|
|
||||||
j = getanimationgoal(anim_ceilingz, sect);
|
|
||||||
|
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
j = sector[sect].floorz;
|
j = sector[sect].floorz;
|
||||||
vel = 64;
|
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||||
setanimation(sect, anim_ceilingz, sect, j, vel);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -79,15 +73,12 @@ short pinsectorresetdown(short sect)
|
||||||
|
|
||||||
short pinsectorresetup(short sect)
|
short pinsectorresetup(short sect)
|
||||||
{
|
{
|
||||||
int vel, j;
|
int j = getanimationgoal(anim_ceilingz, sect);
|
||||||
|
|
||||||
j = getanimationgoal(anim_ceilingz, sect);
|
|
||||||
|
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
j = sector[nextsectorneighborz(sect, sector[sect].ceilingz, -1, -1)].ceilingz;
|
j = sector[nextsectorneighborz(sect, sector[sect].ceilingz, -1, -1)].ceilingz;
|
||||||
vel = 64;
|
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||||
setanimation(sect, anim_ceilingz, sect, j, vel);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -103,17 +94,17 @@ short checkpins(short sect)
|
||||||
pin = 0;
|
pin = 0;
|
||||||
for (i = 0; i < 10; i++) pins[i] = 0;
|
for (i = 0; i < 10; i++) pins[i] = 0;
|
||||||
|
|
||||||
SectIterator it(sect);
|
DukeSectIterator it(sect);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto a2 = it.Next())
|
||||||
{
|
{
|
||||||
if (sprite[i].picnum == RRTILE3440)
|
if (a2->s.picnum == RRTILE3440)
|
||||||
{
|
{
|
||||||
pin++;
|
pin++;
|
||||||
pins[sprite[i].lotag] = 1;
|
pins[a2->s.lotag] = 1;
|
||||||
}
|
}
|
||||||
if (sprite[i].picnum == RRTILE280)
|
if (a2->s.picnum == RRTILE280)
|
||||||
{
|
{
|
||||||
tag = sprite[i].hitag;
|
tag = a2->s.hitag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,33 +169,33 @@ short checkpins(short sect)
|
||||||
|
|
||||||
void resetpins(short sect)
|
void resetpins(short sect)
|
||||||
{
|
{
|
||||||
short i, j, tag;
|
int i, tag;
|
||||||
int x, y;
|
int x, y;
|
||||||
SectIterator it(sect);
|
DukeSectIterator it(sect);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto a2 = it.Next())
|
||||||
{
|
{
|
||||||
if (sprite[i].picnum == 3440)
|
if (a2->s.picnum == RRTILE3440)
|
||||||
deletesprite(i);
|
deletesprite(a2);
|
||||||
}
|
}
|
||||||
it.Reset(sect);
|
it.Reset(sect);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto a2 = it.Next())
|
||||||
{
|
{
|
||||||
if (sprite[i].picnum == 283)
|
if (a2->s.picnum == 283)
|
||||||
{
|
{
|
||||||
j = fi.spawn(i,3440);
|
auto spawned = spawn(a2, RRTILE3440);
|
||||||
sprite[j].lotag = sprite[i].lotag;
|
spawned->s.lotag = a2->s.lotag;
|
||||||
if (sprite[j].lotag == 3 || sprite[j].lotag == 5)
|
if (spawned->s.lotag == 3 || spawned->s.lotag == 5)
|
||||||
{
|
{
|
||||||
sprite[j].clipdist = (1+(krand()%1))*16+32;
|
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprite[j].clipdist = (1+(krand()%1))*16+32;
|
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
|
||||||
}
|
}
|
||||||
sprite[j].ang -= ((krand()&32)-(krand()&64))&2047;
|
spawned->s.ang -= ((krand() & 32) - (krand() & 64)) & 2047;
|
||||||
}
|
}
|
||||||
if (sprite[i].picnum == 280)
|
if (a2->s.picnum == 280)
|
||||||
tag = sprite[i].hitag;
|
tag = a2->s.hitag;
|
||||||
}
|
}
|
||||||
if (tag)
|
if (tag)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue