- Duke: eighth batch

This commit is contained in:
Christoph Oelckers 2022-01-31 00:02:46 +01:00
parent f97bae8d23
commit 9bf94cbc1c
4 changed files with 26 additions and 36 deletions

View file

@ -1172,16 +1172,16 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
switch (lLabelID)
{
case ACTOR_X:
if (bSet) act->spr.pos.X = lValue;
else SetGameVarID(lVar2, act->spr.pos.X, sActor, sPlayer);
/*if (bSet) act->spr.pos.X = lValue;
else*/ SetGameVarID(lVar2, act->spr.pos.X, sActor, sPlayer);
break;
case ACTOR_Y:
if (bSet) act->spr.pos.Y = lValue;
else SetGameVarID(lVar2, act->spr.pos.Y, sActor, sPlayer);
/*if (bSet) act->spr.pos.Y = lValue;
else*/ SetGameVarID(lVar2, act->spr.pos.Y, sActor, sPlayer);
break;
case ACTOR_Z:
if (bSet) act->spr.pos.Z = lValue;
else SetGameVarID(lVar2, act->spr.pos.Z, sActor, sPlayer);
/*if (bSet) act->spr.pos.Z = lValue;
else*/ SetGameVarID(lVar2, act->spr.pos.Z, sActor, sPlayer);
break;
case ACTOR_CSTAT:
if (bSet) act->spr.cstat = ESpriteFlags::FromInt(lValue);
@ -1994,7 +1994,7 @@ int ParseState::parse(void)
case concmd_larrybird:
insptr++;
ps[g_p].pos.Z = ps[g_p].GetActor()->sector()->ceilingz;
ps[g_p].GetActor()->spr.pos.Z = ps[g_p].pos.Z;
ps[g_p].GetActor()->set_int_z(ps[g_p].pos.Z);
break;
case concmd_destroyit:
insptr++;
@ -2238,9 +2238,7 @@ int ParseState::parse(void)
{
// I am not convinced this is even remotely smart to be executed from here..
pickrandomspot(g_p);
g_ac->spr.pos.X = ps[g_p].bobpos.X = ps[g_p].opos.X = ps[g_p].pos.X;
g_ac->spr.pos.Y = ps[g_p].bobpos.Y = ps[g_p].opos.Y = ps[g_p].pos.Y;
g_ac->spr.pos.Z = ps[g_p].opos.Z = ps[g_p].pos.Z;
g_ac->set_int_pos({ ps[g_p].bobpos.X = ps[g_p].opos.X = ps[g_p].pos.X, ps[g_p].bobpos.Y = ps[g_p].opos.Y = ps[g_p].pos.Y, ps[g_p].opos.Z = ps[g_p].pos.Z });
g_ac->backuppos();
updatesector(ps[g_p].pos.X, ps[g_p].pos.Y, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), { ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z + gs.playerheight });

View file

@ -611,7 +611,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
}
else
{
actor->spr.pos.Z -= 512;
actor->add_int_z(-512);
actor->spr.zvel = -348;
}
@ -1054,9 +1054,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
spawned->spr.xvel = -12;
auto delta = hit.hitWall->delta();
spawned->spr.ang = getangle(-delta.X, -delta.Y) + 512; // note the '-' sign here!
spawned->spr.pos.X = hit.hitpos.X;
spawned->spr.pos.Y = hit.hitpos.Y;
spawned->spr.pos.Z = hit.hitpos.Z;
spawned->set_int_pos(hit.hitpos);
spawned->spr.cstat |= randomXFlip();
ssp(spawned, CLIPMASK0);
SetActor(spawned, spawned->spr.pos);

View file

@ -216,11 +216,11 @@ int findplayer(const DDukeActor* actor, int* d)
{
int j, closest_player;
int x, closest;
auto s = &actor->spr.pos;
const auto s = actor->spr.pos;
if (ud.multimode < 2)
{
if (d) *d = abs(ps[myconnectindex].opos.X - s->X) + abs(ps[myconnectindex].opos.Y - s->Y) + ((abs(ps[myconnectindex].opos.Z - s->Z + (28 << 8))) >> 4);
if (d) *d = abs(ps[myconnectindex].opos.X - s.X) + abs(ps[myconnectindex].opos.Y - s.Y) + ((abs(ps[myconnectindex].opos.Z - s.Z + (28 << 8))) >> 4);
return myconnectindex;
}
@ -229,7 +229,7 @@ int findplayer(const DDukeActor* actor, int* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
{
x = abs(ps[j].opos.X - s->X) + abs(ps[j].opos.Y - s->Y) + ((abs(ps[j].opos.Z - s->Z + (28 << 8))) >> 4);
x = abs(ps[j].opos.X - s.X) + abs(ps[j].opos.Y - s.Y) + ((abs(ps[j].opos.Z - s.Z + (28 << 8))) >> 4);
if (x < closest && ps[j].GetActor()->spr.extra > 0)
{
closest_player = j;
@ -394,7 +394,7 @@ void doanimations(void)
if (act->spr.statnum != STAT_EFFECTOR)
{
act->backupz();
act->spr.pos.Z += v;
act->add_int_z(v);
act->floorz = dasectp->floorz + v;
}
}

View file

@ -59,9 +59,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
SetupGameVarsForActor(act);
act->spr.pos.X = s_x;
act->spr.pos.Y = s_y;
act->spr.pos.Z = s_z;
act->set_int_pos({ s_x, s_y, s_z });
act->spr.cstat = 0;
act->spr.picnum = s_pn;
act->spr.shade = s_s;
@ -303,7 +301,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
{
act->spr.xrepeat = 31;
act->spr.yrepeat = 1;
act->spr.pos.Z = actj->sector()->floorz - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE);
act->set_int_z(actj->sector()->floorz - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE));
}
else
{
@ -409,7 +407,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* act)
act->spr.ang = actj->spr.ang;
}
act->spr.pos.Z = sect->floorz;
act->set_int_z(sect->floorz);
if (sect->lotag != 1 && sect->lotag != 2)
act->spr.xrepeat = act->spr.yrepeat = 32;
@ -435,17 +433,16 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
a = ps[snum].angle.ang.asbuild() - (krand() & 63) + 8; //Fine tune
act->temp_data[0] = krand() & 1;
act->spr.pos.Z = (3 << 8) + ps[snum].pyoff + ps[snum].pos.Z - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0);
act->set_int_z((3 << 8) + ps[snum].pyoff + ps[snum].pos.Z - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0));
act->spr.zvel = -(krand() & 255);
}
else
{
a = act->spr.ang;
act->spr.pos.Z = actj->spr.pos.Z - gs.playerheight + (3 << 8);
act->set_int_z(actj->spr.pos.Z - gs.playerheight + (3 << 8));
}
act->spr.pos.X = actj->spr.pos.X + bcos(a, -7);
act->spr.pos.Y = actj->spr.pos.Y + bsin(a, -7);
act->set_int_xy(actj->spr.pos.X + bcos(a, -7), actj->spr.pos.Y + bsin(a, -7));
act->spr.shade = -8;
@ -479,13 +476,11 @@ void initcrane(DDukeActor* actj, DDukeActor* act, int CRANEPOLE)
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ONE_SIDE;
act->spr.picnum += 2;
act->spr.pos.Z = sect->ceilingz + (48 << 8);
act->set_int_z(sect->ceilingz + (48 << 8));
act->temp_data[4] = cranes.Reserve(1);
auto& apt = cranes[act->temp_data[4]];
apt.pos.X = act->spr.pos.X;
apt.pos.Y = act->spr.pos.Y;
apt.pos.Z = act->spr.pos.Z;
apt.pos = act->spr.pos;
apt.poleactor = nullptr;
DukeStatIterator it(STAT_DEFAULT);
@ -530,16 +525,16 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
if (actj->spr.pal != 1)
{
actor->spr.pal = 2;
actor->spr.pos.Z -= (18 << 8);
actor->add_int_z(-(18 << 8));
}
else actor->spr.pos.Z -= (13 << 8);
else actor->add_int_z(-(13 << 8));
actor->spr.ang = getangle(ps[connecthead].pos.X - actor->spr.pos.X, ps[connecthead].pos.Y - actor->spr.pos.Y);
actor->spr.xvel = 48 - (krand() & 31);
ssp(actor, CLIPMASK0);
}
else if (!actj)
{
actor->spr.pos.Z += (4 << 8);
actor->add_int_z(4 << 8);
actor->temp_data[0] = actor->spr.pos.Z;
if (!isRR()) actor->temp_data[1] = krand() & 127;
}
@ -936,8 +931,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
{
if (actor->spr.ang == 512)
{
actor->spr.pos.X = act2->spr.pos.X;
actor->spr.pos.Y = act2->spr.pos.Y;
actor->set_int_xy(act2->spr.pos.X, act2->spr.pos.Y);
}
found = true;
actor->SetOwner(act2);