- floatified movetouchplate

This commit is contained in:
Christoph Oelckers 2022-09-11 23:16:06 +02:00
parent 8e4a3f1946
commit 81d4ca71d7
3 changed files with 15 additions and 15 deletions

View file

@ -1075,40 +1075,40 @@ void movedoorshock(DDukeActor* actor)
void movetouchplate(DDukeActor* actor, int plate)
{
auto sectp = actor->sector();
int x;
int p;
if (actor->temp_data[1] == 1 && actor->spr.hitag >= 0) //Move the sector floor
{
x = sectp->int_floorz();
double X = sectp->floorz;
double add = sectp->extra * zmaptoworld;
if (actor->temp_data[3] == 1)
{
if (x >= actor->temp_data[2])
if (X >= actor->temp_pos.Z)
{
sectp->set_int_floorz(x);
sectp->setfloorz(X);
actor->temp_data[1] = 0;
}
else
{
sectp->add_int_floorz(sectp->extra);
sectp->addfloorz(add);
p = checkcursectnums(actor->sector());
if (p >= 0) ps[p].pos.Z += sectp->extra * zmaptoworld;
if (p >= 0) ps[p].pos.Z += add;
}
}
else
{
if (x <= actor->int_pos().Z)
if (X <= actor->spr.pos.Z)
{
sectp->setfloorz(actor->spr.pos.Z);
actor->temp_data[1] = 0;
}
else
{
sectp->floorz -= sectp->extra * zmaptoworld;
sectp->floorz -= add;
p = checkcursectnums(actor->sector());
if (p >= 0)
ps[p].pos.Z -= sectp->extra * zmaptoworld;
ps[p].pos.Z -= add;
}
}
return;
@ -1117,7 +1117,7 @@ void movetouchplate(DDukeActor* actor, int plate)
if (actor->temp_data[5] == 1) return;
p = checkcursectnums(actor->sector());
if (p >= 0 && (ps[p].on_ground || actor->spr.angle == DAngle90))
if (p >= 0 && (ps[p].on_ground || actor->spr.intangle == 512))
{
if (actor->temp_data[0] == 0 && !check_activator_motion(actor->spr.lotag))
{

View file

@ -717,7 +717,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, 6);
break;
case TOUCHPLATE:
act->temp_data[2] = sectp->int_floorz();
act->temp_pos.Z = sectp->floorz;
if (sectp->lotag != 1 && sectp->lotag != 2)
sectp->setfloorz(act->spr.pos.Z);
if (!isWorldTour())
@ -743,11 +743,11 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case WATERBUBBLEMAKER:
if (act->spr.hitag && act->spr.picnum == WATERBUBBLEMAKER)
{ // JBF 20030913: Pisses off move(), eg. in bobsp2
Printf(TEXTCOLOR_YELLOW "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", act->GetIndex(), act->int_pos().X, act->int_pos().Y);
Printf(TEXTCOLOR_YELLOW "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", act->GetIndex(), int(act->spr.pos.X), int(act->spr.pos.Y));
act->spr.hitag = 0;
}
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
ChangeActorStat(act, 6);
ChangeActorStat(act, STAT_STANDABLE);
break;
case BOLT1:
case BOLT1 + 1:

View file

@ -715,7 +715,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, 6);
break;
case TOUCHPLATE:
act->temp_data[2] = sectp->int_floorz();
act->temp_pos.Z = sectp->floorz;
if (sectp->lotag != 1 && sectp->lotag != 2)
sectp->setfloorz(act->spr.pos.Z);
if (act->spr.pal && ud.multimode > 1)
@ -727,7 +727,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
[[fallthrough]];
case WATERBUBBLEMAKER:
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
ChangeActorStat(act, 6);
ChangeActorStat(act, STAT_STANDABLE);
break;
case BOLT1:
case BOLT1 + 1: