@@ -324,6 +324,10 @@ static bool MovePlane(PlaneMover *plane)
324
324
325
325
Sector *sec = plane->sector ;
326
326
327
+ // track if move went from start to dest in one move; if so
328
+ // do not interpolate the sector height
329
+ bool maybe_instant = false ;
330
+
327
331
if (plane->is_ceiling || plane->is_elevator )
328
332
sec->old_ceiling_height = sec->ceiling_height ;
329
333
if (!plane->is_ceiling )
@@ -336,9 +340,34 @@ static bool MovePlane(PlaneMover *plane)
336
340
break ;
337
341
338
342
case kPlaneDirectionDown :
343
+ if (plane->is_ceiling || plane->is_elevator )
344
+ {
345
+ if (AlmostEquals (plane->start_height , sec->ceiling_height ))
346
+ maybe_instant = true ;
347
+ }
348
+ if (!plane->is_ceiling )
349
+ {
350
+ if (AlmostEquals (plane->start_height , sec->floor_height ))
351
+ maybe_instant = true ;
352
+ }
353
+
339
354
res = AttemptMoveSector (sec, plane, HMM_MIN (plane->start_height , plane->destination_height ),
340
355
plane->is_ceiling ? plane->crush : 0 );
341
356
357
+ if (maybe_instant)
358
+ {
359
+ if (plane->is_ceiling || plane->is_elevator )
360
+ {
361
+ if (AlmostEquals (plane->destination_height , sec->ceiling_height ))
362
+ sec->old_ceiling_height = sec->ceiling_height ;
363
+ }
364
+ if (!plane->is_ceiling )
365
+ {
366
+ if (AlmostEquals (plane->destination_height , sec->floor_height ))
367
+ sec->old_floor_height = sec->floor_height ;
368
+ }
369
+ }
370
+
342
371
if (!AlmostEquals (plane->destination_height , plane->start_height ))
343
372
{
344
373
MakeMovingSound (&plane->sound_effect_started , plane->type ->sfxdown_ , &sec->sound_effects_origin );
@@ -445,9 +474,35 @@ static bool MovePlane(PlaneMover *plane)
445
474
break ;
446
475
447
476
case kPlaneDirectionUp :
477
+ if (plane->is_ceiling || plane->is_elevator )
478
+ {
479
+ if (AlmostEquals (plane->start_height , sec->ceiling_height ))
480
+ maybe_instant = true ;
481
+ }
482
+ if (!plane->is_ceiling )
483
+ {
484
+ if (AlmostEquals (plane->start_height , sec->floor_height ))
485
+ maybe_instant = true ;
486
+ }
487
+
488
+
448
489
res = AttemptMoveSector (sec, plane, HMM_MAX (plane->start_height , plane->destination_height ),
449
490
plane->is_ceiling ? 0 : plane->crush );
450
491
492
+ if (maybe_instant)
493
+ {
494
+ if (plane->is_ceiling || plane->is_elevator )
495
+ {
496
+ if (AlmostEquals (plane->destination_height , sec->ceiling_height ))
497
+ sec->old_ceiling_height = sec->ceiling_height ;
498
+ }
499
+ if (!plane->is_ceiling )
500
+ {
501
+ if (AlmostEquals (plane->destination_height , sec->floor_height ))
502
+ sec->old_floor_height = sec->floor_height ;
503
+ }
504
+ }
505
+
451
506
if (!AlmostEquals (plane->destination_height , plane->start_height ))
452
507
{
453
508
MakeMovingSound (&plane->sound_effect_started , plane->type ->sfxup_ , &sec->sound_effects_origin );
0 commit comments