Skip to content

Commit 300bfe5

Browse files
author
dashodanger
committed
Sector interpolation updates
1 parent 008851c commit 300bfe5

File tree

4 files changed

+19
-26
lines changed

4 files changed

+19
-26
lines changed

source_files/edge/p_plane.cc

+17-21
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,8 @@ static bool MovePlane(PlaneMover *plane)
324324

325325
Sector *sec = plane->sector;
326326

327-
if (sec->old_game_tic != game_tic)
328-
{
329-
plane->sector->old_ceiling_height = plane->sector->ceiling_height;
330-
plane->sector->old_floor_height = plane->sector->floor_height;
331-
plane->sector->old_game_tic = game_tic;
332-
}
327+
sec->old_ceiling_height = sec->ceiling_height;
328+
sec->old_floor_height = sec->floor_height;
333329

334330
switch (plane->direction)
335331
{
@@ -338,29 +334,29 @@ static bool MovePlane(PlaneMover *plane)
338334
break;
339335

340336
case kPlaneDirectionDown:
341-
res = AttemptMoveSector(plane->sector, plane, HMM_MIN(plane->start_height, plane->destination_height),
337+
res = AttemptMoveSector(sec, plane, HMM_MIN(plane->start_height, plane->destination_height),
342338
plane->is_ceiling ? plane->crush : 0);
343339

344340
if (!AlmostEquals(plane->destination_height, plane->start_height))
345341
{
346-
MakeMovingSound(&plane->sound_effect_started, plane->type->sfxdown_, &plane->sector->sound_effects_origin);
342+
MakeMovingSound(&plane->sound_effect_started, plane->type->sfxdown_, &sec->sound_effects_origin);
347343
}
348344

349345
if (res == RES_PastDest)
350346
{
351347
if (!AlmostEquals(plane->destination_height, plane->start_height))
352348
{
353-
StartSoundEffect(plane->type->sfxstop_, kCategoryLevel, &plane->sector->sound_effects_origin);
349+
StartSoundEffect(plane->type->sfxstop_, kCategoryLevel, &sec->sound_effects_origin);
354350
}
355351

356352
plane->speed = plane->type->speed_up_;
357353

358354
if (plane->new_special != -1)
359355
{
360-
SectorChangeSpecial(plane->sector, plane->new_special);
356+
SectorChangeSpecial(sec, plane->new_special);
361357
}
362358

363-
SECPIC(plane->sector, plane->is_ceiling, plane->new_image);
359+
SECPIC(sec, plane->is_ceiling, plane->new_image);
364360

365361
switch (plane->type->type_)
366362
{
@@ -372,7 +368,7 @@ static bool MovePlane(PlaneMover *plane)
372368
break;
373369

374370
case kPlaneMoverMoveWaitReturn:
375-
if (AlmostEquals(HEIGHT(plane->sector, plane->is_ceiling), plane->start_height))
371+
if (AlmostEquals(HEIGHT(sec, plane->is_ceiling), plane->start_height))
376372
{
377373
return true; // REMOVE ME
378374
}
@@ -420,12 +416,12 @@ static bool MovePlane(PlaneMover *plane)
420416
int dir;
421417
float dest;
422418

423-
if (AlmostEquals(HEIGHT(plane->sector, plane->is_ceiling), plane->destination_height))
419+
if (AlmostEquals(HEIGHT(sec, plane->is_ceiling), plane->destination_height))
424420
dest = plane->start_height;
425421
else
426422
dest = plane->destination_height;
427423

428-
if (HEIGHT(plane->sector, plane->is_ceiling) > dest)
424+
if (HEIGHT(sec, plane->is_ceiling) > dest)
429425
{
430426
dir = kPlaneDirectionDown;
431427
plane->speed = plane->type->speed_down_;
@@ -438,7 +434,7 @@ static bool MovePlane(PlaneMover *plane)
438434

439435
if (dir)
440436
{
441-
StartSoundEffect(plane->type->sfxstart_, kCategoryLevel, &plane->sector->sound_effects_origin);
437+
StartSoundEffect(plane->type->sfxstart_, kCategoryLevel, &sec->sound_effects_origin);
442438
}
443439

444440
plane->direction = dir; // time to go back
@@ -447,27 +443,27 @@ static bool MovePlane(PlaneMover *plane)
447443
break;
448444

449445
case kPlaneDirectionUp:
450-
res = AttemptMoveSector(plane->sector, plane, HMM_MAX(plane->start_height, plane->destination_height),
446+
res = AttemptMoveSector(sec, plane, HMM_MAX(plane->start_height, plane->destination_height),
451447
plane->is_ceiling ? 0 : plane->crush);
452448

453449
if (!AlmostEquals(plane->destination_height, plane->start_height))
454450
{
455-
MakeMovingSound(&plane->sound_effect_started, plane->type->sfxup_, &plane->sector->sound_effects_origin);
451+
MakeMovingSound(&plane->sound_effect_started, plane->type->sfxup_, &sec->sound_effects_origin);
456452
}
457453

458454
if (res == RES_PastDest)
459455
{
460456
if (!AlmostEquals(plane->destination_height, plane->start_height))
461457
{
462-
StartSoundEffect(plane->type->sfxstop_, kCategoryLevel, &plane->sector->sound_effects_origin);
458+
StartSoundEffect(plane->type->sfxstop_, kCategoryLevel, &sec->sound_effects_origin);
463459
}
464460

465461
if (plane->new_special != -1)
466462
{
467-
SectorChangeSpecial(plane->sector, plane->new_special);
463+
SectorChangeSpecial(sec, plane->new_special);
468464
}
469465

470-
SECPIC(plane->sector, plane->is_ceiling, plane->new_image);
466+
SECPIC(sec, plane->is_ceiling, plane->new_image);
471467

472468
switch (plane->type->type_)
473469
{
@@ -479,7 +475,7 @@ static bool MovePlane(PlaneMover *plane)
479475
break;
480476

481477
case kPlaneMoverMoveWaitReturn:
482-
if (AlmostEquals(HEIGHT(plane->sector, plane->is_ceiling), plane->start_height))
478+
if (AlmostEquals(HEIGHT(sec, plane->is_ceiling), plane->start_height))
483479
{
484480
return true; // REMOVE ME
485481
}

source_files/edge/p_setup.cc

-2
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ static void LoadSectors(int lump)
505505
ss->interpolated_floor_height = ss->floor_height;
506506
ss->old_ceiling_height = ss->ceiling_height;
507507
ss->interpolated_ceiling_height = ss->ceiling_height;
508-
ss->old_game_tic = 0;
509508

510509
// -AJA- 1999/07/29: Keep sectors with same tag in a list.
511510
GroupSectorTags(ss, level_sectors, i);
@@ -1755,7 +1754,6 @@ static void LoadUDMFSectors()
17551754
ss->interpolated_floor_height = ss->floor_height;
17561755
ss->old_ceiling_height = ss->ceiling_height;
17571756
ss->interpolated_ceiling_height = ss->ceiling_height;
1758-
ss->old_game_tic = 0;
17591757

17601758
// -AJA- 1999/07/29: Keep sectors with same tag in a list.
17611759
GroupSectorTags(ss, level_sectors, cur_sector);

source_files/edge/r_defs.h

-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ struct Sector
228228
// Uncapped test - Dasho
229229
float old_floor_height, old_ceiling_height;
230230
float interpolated_floor_height, interpolated_ceiling_height;
231-
int old_game_tic;
232231

233232
MapSurface floor, ceiling;
234233

source_files/edge/r_render.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1987,12 +1987,12 @@ static void UpdateSectorInterpolation(Sector *sector)
19871987
if (uncapped_frames.d_ && !time_stop_active && !paused && !erraticism_active && !menu_active && !rts_menu_active)
19881988
{
19891989
// Interpolate between current and last floor/ceiling position.
1990-
if (sector->floor_move && !AlmostEquals(sector->floor_height, sector->old_floor_height))
1990+
if (!AlmostEquals(sector->floor_height, sector->old_floor_height))
19911991
sector->interpolated_floor_height =
19921992
HMM_Lerp(sector->old_floor_height, fractional_tic, sector->floor_height);
19931993
else
19941994
sector->interpolated_floor_height = sector->floor_height;
1995-
if (sector->ceiling_move && !AlmostEquals(sector->ceiling_height, sector->old_ceiling_height))
1995+
if (!AlmostEquals(sector->ceiling_height, sector->old_ceiling_height))
19961996
sector->interpolated_ceiling_height =
19971997
HMM_Lerp(sector->old_ceiling_height, fractional_tic, sector->ceiling_height);
19981998
else

0 commit comments

Comments
 (0)