| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Uncapped framerate stuff |
| 31 |
* |
| 32 |
*--------------------------------------------------------------------- |
| 33 |
*/ |
| 34 |
|
| 35 |
#include "doomstat.h" |
| 36 |
#include "m_random.h" |
| 37 |
#include "r_defs.h" |
| 38 |
#include "r_state.h" |
| 39 |
#include "p_spec.h" |
| 40 |
#include "smooth.h" |
| 41 |
#include "r_fps.h" |
| 42 |
#include "i_system.h" |
| 43 |
#include "i_capture.h" |
| 44 |
#include "e6y.h" |
| 45 |
|
| 46 |
#include "dsda/aim.h" |
| 47 |
#include "dsda/build.h" |
| 48 |
#include "dsda/configuration.h" |
| 49 |
#include "dsda/pause.h" |
| 50 |
#include "dsda/scroll.h" |
| 51 |
#include "dsda/settings.h" |
| 52 |
|
| 53 |
#include "hexen/a_action.h" |
| 54 |
|
| 55 |
int movement_smooth; |
| 56 |
dboolean isExtraDDisplay = false; |
| 57 |
|
| 58 |
typedef enum |
| 59 |
{ |
| 60 |
INTERP_SectorFloor, |
| 61 |
INTERP_SectorCeiling, |
| 62 |
INTERP_WallPanning, |
| 63 |
INTERP_FloorPanning, |
| 64 |
INTERP_CeilingPanning |
| 65 |
} interpolation_type_e; |
| 66 |
|
| 67 |
typedef struct |
| 68 |
{ |
| 69 |
interpolation_type_e type; |
| 70 |
void *address; |
| 71 |
} interpolation_t; |
| 72 |
|
| 73 |
static int numinterpolations = 0; |
| 74 |
|
| 75 |
tic_vars_t tic_vars; |
| 76 |
|
| 77 |
static void R_DoAnInterpolation (int i, fixed_t smoothratio); |
| 78 |
|
| 79 |
void D_Display(fixed_t frac); |
| 80 |
|
| 81 |
void M_ChangeUncappedFrameRate(void) |
| 82 |
{ |
| 83 |
if (capturing_video) |
| 84 |
movement_smooth = true; |
| 85 |
else |
| 86 |
movement_smooth = (singletics ? false : dsda_IntConfig(dsda_config_uncapped_framerate)); |
| 87 |
} |
| 88 |
|
| 89 |
typedef fixed_t fixed2_t[2]; |
| 90 |
static fixed2_t *oldipos; |
| 91 |
static fixed2_t *bakipos; |
| 92 |
static interpolation_t *curipos; |
| 93 |
|
| 94 |
static dboolean NoInterpolateView; |
| 95 |
static dboolean didInterp; |
| 96 |
dboolean WasRenderedInTryRunTics; |
| 97 |
|
| 98 |
dboolean R_ViewInterpolation(void) { |
| 99 |
return !dsda_Paused() && movement_smooth; |
| 100 |
} |
| 101 |
|
| 102 |
void R_InterpolateView(player_t *player, fixed_t frac) |
| 103 |
{ |
| 104 |
static mobj_t *oviewer; |
| 105 |
int quake_intensity; |
| 106 |
|
| 107 |
dboolean NoInterpolate = dsda_CameraPaused() || dsda_PausedViaMenu(); |
| 108 |
|
| 109 |
quake_intensity = dsda_IntConfig(dsda_config_quake_intensity); |
| 110 |
|
| 111 |
viewplayer = player; |
| 112 |
|
| 113 |
if (player->mo != oviewer || NoInterpolate) |
| 114 |
{ |
| 115 |
R_ResetViewInterpolation(); |
| 116 |
oviewer = player->mo; |
| 117 |
} |
| 118 |
|
| 119 |
if (NoInterpolate) |
| 120 |
frac = FRACUNIT; |
| 121 |
tic_vars.frac = frac; |
| 122 |
|
| 123 |
if (movement_smooth) |
| 124 |
{ |
| 125 |
if (NoInterpolateView) |
| 126 |
{ |
| 127 |
NoInterpolateView = false; |
| 128 |
|
| 129 |
player->prev_viewz = player->viewz; |
| 130 |
player->prev_viewangle = player->mo->angle; |
| 131 |
player->prev_viewpitch = dsda_PlayerPitch(player); |
| 132 |
|
| 133 |
P_ResetWalkcam(); |
| 134 |
} |
| 135 |
|
| 136 |
if (walkcamera.type != 2) |
| 137 |
{ |
| 138 |
viewx = player->mo->PrevX + FixedMul (frac, player->mo->x - player->mo->PrevX); |
| 139 |
viewy = player->mo->PrevY + FixedMul (frac, player->mo->y - player->mo->PrevY); |
| 140 |
viewz = player->prev_viewz + FixedMul (frac, player->viewz - player->prev_viewz); |
| 141 |
} |
| 142 |
else |
| 143 |
{ |
| 144 |
viewx = walkcamera.PrevX + FixedMul (frac, walkcamera.x - walkcamera.PrevX); |
| 145 |
viewy = walkcamera.PrevY + FixedMul (frac, walkcamera.y - walkcamera.PrevY); |
| 146 |
viewz = walkcamera.PrevZ + FixedMul (frac, walkcamera.z - walkcamera.PrevZ); |
| 147 |
} |
| 148 |
|
| 149 |
if (walkcamera.type) |
| 150 |
{ |
| 151 |
viewangle = walkcamera.PrevAngle + FixedMul (frac, walkcamera.angle - walkcamera.PrevAngle); |
| 152 |
viewpitch = walkcamera.PrevPitch + FixedMul (frac, walkcamera.pitch - walkcamera.PrevPitch); |
| 153 |
} |
| 154 |
else |
| 155 |
{ |
| 156 |
viewangle = player->prev_viewangle + FixedMul (frac, R_SmoothPlaying_Get(player) - player->prev_viewangle); |
| 157 |
viewpitch = player->prev_viewpitch + FixedMul (frac, dsda_PlayerPitch(player) - player->prev_viewpitch); |
| 158 |
} |
| 159 |
} |
| 160 |
else |
| 161 |
{ |
| 162 |
if (walkcamera.type != 2) |
| 163 |
{ |
| 164 |
viewx = player->mo->x; |
| 165 |
viewy = player->mo->y; |
| 166 |
viewz = player->viewz; |
| 167 |
} |
| 168 |
else |
| 169 |
{ |
| 170 |
viewx = walkcamera.x; |
| 171 |
viewy = walkcamera.y; |
| 172 |
viewz = walkcamera.z; |
| 173 |
} |
| 174 |
if (walkcamera.type) |
| 175 |
{ |
| 176 |
viewangle = walkcamera.angle; |
| 177 |
viewpitch = walkcamera.pitch; |
| 178 |
} |
| 179 |
else |
| 180 |
{ |
| 181 |
viewangle = R_SmoothPlaying_Get(player); |
| 182 |
viewpitch = dsda_PlayerPitch(player); |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
if (localQuakeHappening[displayplayer] && !dsda_Paused()) |
| 187 |
{ |
| 188 |
static int x_displacement; |
| 189 |
static int y_displacement; |
| 190 |
static int last_leveltime = -1; |
| 191 |
|
| 192 |
if (leveltime != last_leveltime) |
| 193 |
{ |
| 194 |
int intensity = localQuakeHappening[displayplayer]; |
| 195 |
|
| 196 |
x_displacement = ((M_Random() % (intensity << 2)) - (intensity << 1)) << FRACBITS; |
| 197 |
y_displacement = ((M_Random() % (intensity << 2)) - (intensity << 1)) << FRACBITS; |
| 198 |
|
| 199 |
x_displacement = x_displacement * quake_intensity / 100; |
| 200 |
y_displacement = y_displacement * quake_intensity / 100; |
| 201 |
|
| 202 |
last_leveltime = leveltime; |
| 203 |
} |
| 204 |
|
| 205 |
viewx += x_displacement; |
| 206 |
viewy += y_displacement; |
| 207 |
} |
| 208 |
|
| 209 |
if (R_ViewInterpolation()) |
| 210 |
{ |
| 211 |
int i; |
| 212 |
|
| 213 |
didInterp = tic_vars.frac != FRACUNIT; |
| 214 |
if (didInterp) |
| 215 |
{ |
| 216 |
for (i = numinterpolations - 1; i >= 0; i--) |
| 217 |
{ |
| 218 |
R_DoAnInterpolation (i, tic_vars.frac); |
| 219 |
} |
| 220 |
} |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
void R_ResetViewInterpolation () |
| 225 |
{ |
| 226 |
NoInterpolateView = true; |
| 227 |
} |
| 228 |
|
| 229 |
static void R_CopyInterpToOld (int i) |
| 230 |
{ |
| 231 |
switch (curipos[i].type) |
| 232 |
{ |
| 233 |
case INTERP_SectorFloor: |
| 234 |
oldipos[i][0] = ((sector_t*)curipos[i].address)->floorheight; |
| 235 |
break; |
| 236 |
case INTERP_SectorCeiling: |
| 237 |
oldipos[i][0] = ((sector_t*)curipos[i].address)->ceilingheight; |
| 238 |
break; |
| 239 |
case INTERP_WallPanning: |
| 240 |
oldipos[i][0] = ((side_t*)curipos[i].address)->rowoffset; |
| 241 |
oldipos[i][1] = ((side_t*)curipos[i].address)->textureoffset; |
| 242 |
break; |
| 243 |
case INTERP_FloorPanning: |
| 244 |
oldipos[i][0] = ((sector_t*)curipos[i].address)->floor_xoffs; |
| 245 |
oldipos[i][1] = ((sector_t*)curipos[i].address)->floor_yoffs; |
| 246 |
break; |
| 247 |
case INTERP_CeilingPanning: |
| 248 |
oldipos[i][0] = ((sector_t*)curipos[i].address)->ceiling_xoffs; |
| 249 |
oldipos[i][1] = ((sector_t*)curipos[i].address)->ceiling_yoffs; |
| 250 |
break; |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
static void R_CopyBakToInterp (int i) |
| 255 |
{ |
| 256 |
switch (curipos[i].type) |
| 257 |
{ |
| 258 |
case INTERP_SectorFloor: |
| 259 |
((sector_t*)curipos[i].address)->floorheight = bakipos[i][0]; |
| 260 |
break; |
| 261 |
case INTERP_SectorCeiling: |
| 262 |
((sector_t*)curipos[i].address)->ceilingheight = bakipos[i][0]; |
| 263 |
break; |
| 264 |
case INTERP_WallPanning: |
| 265 |
((side_t*)curipos[i].address)->rowoffset = bakipos[i][0]; |
| 266 |
((side_t*)curipos[i].address)->textureoffset = bakipos[i][1]; |
| 267 |
break; |
| 268 |
case INTERP_FloorPanning: |
| 269 |
((sector_t*)curipos[i].address)->floor_xoffs = bakipos[i][0]; |
| 270 |
((sector_t*)curipos[i].address)->floor_yoffs = bakipos[i][1]; |
| 271 |
break; |
| 272 |
case INTERP_CeilingPanning: |
| 273 |
((sector_t*)curipos[i].address)->ceiling_xoffs = bakipos[i][0]; |
| 274 |
((sector_t*)curipos[i].address)->ceiling_yoffs = bakipos[i][1]; |
| 275 |
break; |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
static void R_DoAnInterpolation (int i, fixed_t smoothratio) |
| 280 |
{ |
| 281 |
fixed_t pos; |
| 282 |
fixed_t *adr1 = NULL; |
| 283 |
fixed_t *adr2 = NULL; |
| 284 |
|
| 285 |
switch (curipos[i].type) |
| 286 |
{ |
| 287 |
case INTERP_SectorFloor: |
| 288 |
adr1 = &((sector_t*)curipos[i].address)->floorheight; |
| 289 |
break; |
| 290 |
case INTERP_SectorCeiling: |
| 291 |
adr1 = &((sector_t*)curipos[i].address)->ceilingheight; |
| 292 |
break; |
| 293 |
case INTERP_WallPanning: |
| 294 |
adr1 = &((side_t*)curipos[i].address)->rowoffset; |
| 295 |
adr2 = &((side_t*)curipos[i].address)->textureoffset; |
| 296 |
break; |
| 297 |
case INTERP_FloorPanning: |
| 298 |
adr1 = &((sector_t*)curipos[i].address)->floor_xoffs; |
| 299 |
adr2 = &((sector_t*)curipos[i].address)->floor_yoffs; |
| 300 |
break; |
| 301 |
case INTERP_CeilingPanning: |
| 302 |
adr1 = &((sector_t*)curipos[i].address)->ceiling_xoffs; |
| 303 |
adr2 = &((sector_t*)curipos[i].address)->ceiling_yoffs; |
| 304 |
break; |
| 305 |
|
| 306 |
default: |
| 307 |
return; |
| 308 |
} |
| 309 |
|
| 310 |
if (adr1) |
| 311 |
{ |
| 312 |
pos = bakipos[i][0] = *adr1; |
| 313 |
*adr1 = oldipos[i][0] + FixedMul (pos - oldipos[i][0], smoothratio); |
| 314 |
} |
| 315 |
|
| 316 |
if (adr2) |
| 317 |
{ |
| 318 |
pos = bakipos[i][1] = *adr2; |
| 319 |
*adr2 = oldipos[i][1] + FixedMul (pos - oldipos[i][1], smoothratio); |
| 320 |
} |
| 321 |
|
| 322 |
switch (curipos[i].type) |
| 323 |
{ |
| 324 |
case INTERP_SectorFloor: |
| 325 |
case INTERP_SectorCeiling: |
| 326 |
gld_UpdateSplitData(((sector_t*)curipos[i].address)); |
| 327 |
break; |
| 328 |
default: |
| 329 |
break; |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
void R_UpdateInterpolations() |
| 334 |
{ |
| 335 |
int i; |
| 336 |
if (!movement_smooth) |
| 337 |
return; |
| 338 |
for (i = numinterpolations-1; i >= 0; --i) |
| 339 |
R_CopyInterpToOld (i); |
| 340 |
} |
| 341 |
|
| 342 |
int interpolations_max = 0; |
| 343 |
|
| 344 |
static void R_SetInterpolation(interpolation_type_e type, void *posptr) |
| 345 |
{ |
| 346 |
int *i; |
| 347 |
if (!movement_smooth) |
| 348 |
return; |
| 349 |
|
| 350 |
if (numinterpolations >= interpolations_max) { |
| 351 |
int prevmax = interpolations_max; |
| 352 |
|
| 353 |
interpolations_max = interpolations_max ? interpolations_max * 2 : 256; |
| 354 |
|
| 355 |
if (interpolations_max == prevmax) |
| 356 |
{ |
| 357 |
return; |
| 358 |
} |
| 359 |
|
| 360 |
oldipos = (fixed2_t*)Z_Realloc(oldipos, sizeof(*oldipos) * interpolations_max); |
| 361 |
bakipos = (fixed2_t*)Z_Realloc(bakipos, sizeof(*bakipos) * interpolations_max); |
| 362 |
curipos = (interpolation_t*)Z_Realloc(curipos, sizeof(*curipos) * interpolations_max); |
| 363 |
} |
| 364 |
|
| 365 |
i = NULL; |
| 366 |
switch (type) |
| 367 |
{ |
| 368 |
case INTERP_SectorFloor: |
| 369 |
i = &(((sector_t*)posptr)->INTERP_SectorFloor); |
| 370 |
break; |
| 371 |
case INTERP_SectorCeiling: |
| 372 |
i = &(((sector_t*)posptr)->INTERP_SectorCeiling); |
| 373 |
break; |
| 374 |
case INTERP_WallPanning: |
| 375 |
i = &(((side_t*)posptr)->INTERP_WallPanning); |
| 376 |
break; |
| 377 |
case INTERP_FloorPanning: |
| 378 |
i = &(((sector_t*)posptr)->INTERP_FloorPanning); |
| 379 |
break; |
| 380 |
case INTERP_CeilingPanning: |
| 381 |
i = &(((sector_t*)posptr)->INTERP_CeilingPanning); |
| 382 |
break; |
| 383 |
} |
| 384 |
|
| 385 |
if (i != NULL && (*i) == 0) |
| 386 |
{ |
| 387 |
curipos[numinterpolations].address = posptr; |
| 388 |
curipos[numinterpolations].type = type; |
| 389 |
R_CopyInterpToOld (numinterpolations); |
| 390 |
numinterpolations++; |
| 391 |
(*i) = numinterpolations; |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
static void R_StopInterpolation(interpolation_type_e type, void *posptr) |
| 396 |
{ |
| 397 |
int *i, *j; |
| 398 |
void *posptr_last; |
| 399 |
|
| 400 |
if (!movement_smooth) |
| 401 |
return; |
| 402 |
|
| 403 |
i = NULL; |
| 404 |
switch (type) |
| 405 |
{ |
| 406 |
case INTERP_SectorFloor: |
| 407 |
i = &(((sector_t*)posptr)->INTERP_SectorFloor); |
| 408 |
break; |
| 409 |
case INTERP_SectorCeiling: |
| 410 |
i = &(((sector_t*)posptr)->INTERP_SectorCeiling); |
| 411 |
break; |
| 412 |
case INTERP_WallPanning: |
| 413 |
i = &(((side_t*)posptr)->INTERP_WallPanning); |
| 414 |
break; |
| 415 |
case INTERP_FloorPanning: |
| 416 |
i = &(((sector_t*)posptr)->INTERP_FloorPanning); |
| 417 |
break; |
| 418 |
case INTERP_CeilingPanning: |
| 419 |
i = &(((sector_t*)posptr)->INTERP_CeilingPanning); |
| 420 |
break; |
| 421 |
} |
| 422 |
|
| 423 |
if (i != NULL && (*i) != 0) |
| 424 |
{ |
| 425 |
numinterpolations--; |
| 426 |
|
| 427 |
// we have +1 in index field of interpolation's parent |
| 428 |
oldipos[*i - 1][0] = oldipos[numinterpolations][0]; |
| 429 |
oldipos[*i - 1][1] = oldipos[numinterpolations][1]; |
| 430 |
bakipos[*i - 1][0] = bakipos[numinterpolations][0]; |
| 431 |
bakipos[*i - 1][1] = bakipos[numinterpolations][1]; |
| 432 |
curipos[*i - 1] = curipos[numinterpolations]; |
| 433 |
|
| 434 |
// swap indexes |
| 435 |
posptr_last = curipos[numinterpolations].address; |
| 436 |
j = NULL; |
| 437 |
switch (curipos[numinterpolations].type) |
| 438 |
{ |
| 439 |
case INTERP_SectorFloor: |
| 440 |
j = &(((sector_t*)posptr_last)->INTERP_SectorFloor); |
| 441 |
break; |
| 442 |
case INTERP_SectorCeiling: |
| 443 |
j = &(((sector_t*)posptr_last)->INTERP_SectorCeiling); |
| 444 |
break; |
| 445 |
case INTERP_WallPanning: |
| 446 |
j = &(((side_t*)posptr_last)->INTERP_WallPanning); |
| 447 |
break; |
| 448 |
case INTERP_FloorPanning: |
| 449 |
j = &(((sector_t*)posptr_last)->INTERP_FloorPanning); |
| 450 |
break; |
| 451 |
case INTERP_CeilingPanning: |
| 452 |
j = &(((sector_t*)posptr_last)->INTERP_CeilingPanning); |
| 453 |
break; |
| 454 |
} |
| 455 |
|
| 456 |
// swap |
| 457 |
if (j != NULL) |
| 458 |
{ |
| 459 |
*j = *i; |
| 460 |
} |
| 461 |
|
| 462 |
// reset |
| 463 |
*i = 0; |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
void R_StopAllInterpolations(void) |
| 468 |
{ |
| 469 |
int i; |
| 470 |
|
| 471 |
if (!movement_smooth) |
| 472 |
return; |
| 473 |
|
| 474 |
for(i=numinterpolations-1; i>= 0; --i) |
| 475 |
{ |
| 476 |
numinterpolations--; |
| 477 |
oldipos[i][0] = oldipos[numinterpolations][0]; |
| 478 |
oldipos[i][1] = oldipos[numinterpolations][1]; |
| 479 |
bakipos[i][0] = bakipos[numinterpolations][0]; |
| 480 |
bakipos[i][1] = bakipos[numinterpolations][1]; |
| 481 |
curipos[i] = curipos[numinterpolations]; |
| 482 |
} |
| 483 |
|
| 484 |
for(i = 0; i < numsectors; i++) |
| 485 |
{ |
| 486 |
sectors[i].INTERP_CeilingPanning = 0; |
| 487 |
sectors[i].INTERP_FloorPanning = 0; |
| 488 |
sectors[i].INTERP_SectorCeiling = 0; |
| 489 |
sectors[i].INTERP_SectorFloor = 0; |
| 490 |
} |
| 491 |
|
| 492 |
for(i = 0; i < numsides; i++) |
| 493 |
{ |
| 494 |
sides[i].INTERP_WallPanning = 0; |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
void R_RestoreInterpolations(void) |
| 499 |
{ |
| 500 |
int i; |
| 501 |
|
| 502 |
if (!movement_smooth) |
| 503 |
return; |
| 504 |
|
| 505 |
if (didInterp) |
| 506 |
{ |
| 507 |
didInterp = false; |
| 508 |
for (i = numinterpolations-1; i >= 0; --i) |
| 509 |
{ |
| 510 |
R_CopyBakToInterp (i); |
| 511 |
} |
| 512 |
} |
| 513 |
} |
| 514 |
|
| 515 |
void R_ActivateSectorInterpolations() |
| 516 |
{ |
| 517 |
int i; |
| 518 |
sector_t *sec; |
| 519 |
|
| 520 |
if (!movement_smooth) |
| 521 |
return; |
| 522 |
|
| 523 |
for (i=0, sec = sectors ; i<numsectors ; i++,sec++) |
| 524 |
{ |
| 525 |
if (sec->floordata) |
| 526 |
R_SetInterpolation (INTERP_SectorFloor, sec); |
| 527 |
if (sec->ceilingdata) |
| 528 |
R_SetInterpolation (INTERP_SectorCeiling, sec); |
| 529 |
} |
| 530 |
} |
| 531 |
|
| 532 |
static void R_InterpolationGetData(thinker_t *th, |
| 533 |
interpolation_type_e *type1, interpolation_type_e *type2, |
| 534 |
void **posptr1, void **posptr2) |
| 535 |
{ |
| 536 |
*posptr1 = NULL; |
| 537 |
*posptr2 = NULL; |
| 538 |
|
| 539 |
if (th->function == T_MoveFloor) |
| 540 |
{ |
| 541 |
*type1 = INTERP_SectorFloor; |
| 542 |
*posptr1 = ((floormove_t *)th)->sector; |
| 543 |
} |
| 544 |
else |
| 545 |
if (th->function == T_PlatRaise) |
| 546 |
{ |
| 547 |
*type1 = INTERP_SectorFloor; |
| 548 |
*posptr1 = ((plat_t *)th)->sector; |
| 549 |
} |
| 550 |
else |
| 551 |
if (th->function == T_MoveCeiling) |
| 552 |
{ |
| 553 |
*type1 = INTERP_SectorCeiling; |
| 554 |
*posptr1 = ((ceiling_t *)th)->sector; |
| 555 |
} |
| 556 |
else |
| 557 |
if (th->function == T_VerticalDoor) |
| 558 |
{ |
| 559 |
*type1 = INTERP_SectorCeiling; |
| 560 |
*posptr1 = ((vldoor_t *)th)->sector; |
| 561 |
} |
| 562 |
else |
| 563 |
if (th->function == T_MoveElevator) |
| 564 |
{ |
| 565 |
*type1 = INTERP_SectorFloor; |
| 566 |
*posptr1 = ((elevator_t *)th)->sector; |
| 567 |
*type2 = INTERP_SectorCeiling; |
| 568 |
*posptr2 = ((elevator_t *)th)->sector; |
| 569 |
} |
| 570 |
else |
| 571 |
if (th->function == dsda_UpdateSideScroller || th->function == dsda_UpdateControlSideScroller) |
| 572 |
{ |
| 573 |
*type1 = INTERP_WallPanning; |
| 574 |
*posptr1 = sides + ((scroll_t *)th)->affectee; |
| 575 |
} |
| 576 |
else |
| 577 |
if (th->function == dsda_UpdateFloorScroller || th->function == dsda_UpdateControlFloorScroller) |
| 578 |
{ |
| 579 |
*type1 = INTERP_FloorPanning; |
| 580 |
*posptr1 = sectors + ((scroll_t *)th)->affectee; |
| 581 |
} |
| 582 |
else |
| 583 |
if (th->function == dsda_UpdateCeilingScroller || th->function == dsda_UpdateControlCeilingScroller) |
| 584 |
{ |
| 585 |
*type1 = INTERP_CeilingPanning; |
| 586 |
*posptr1 = sectors + ((scroll_t *)th)->affectee; |
| 587 |
} |
| 588 |
} |
| 589 |
|
| 590 |
void R_ActivateThinkerInterpolations(thinker_t *th) |
| 591 |
{ |
| 592 |
void *posptr1; |
| 593 |
void *posptr2; |
| 594 |
interpolation_type_e type1, type2; |
| 595 |
|
| 596 |
if (!movement_smooth) |
| 597 |
return; |
| 598 |
|
| 599 |
R_InterpolationGetData(th, &type1, &type2, &posptr1, &posptr2); |
| 600 |
|
| 601 |
if(posptr1) |
| 602 |
{ |
| 603 |
R_SetInterpolation (type1, posptr1); |
| 604 |
|
| 605 |
if(posptr2) |
| 606 |
R_SetInterpolation (type2, posptr2); |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
void R_StopInterpolationIfNeeded(thinker_t *th) |
| 611 |
{ |
| 612 |
void *posptr1; |
| 613 |
void *posptr2; |
| 614 |
interpolation_type_e type1, type2; |
| 615 |
|
| 616 |
if (!movement_smooth) |
| 617 |
return; |
| 618 |
|
| 619 |
R_InterpolationGetData(th, &type1, &type2, &posptr1, &posptr2); |
| 620 |
|
| 621 |
if(posptr1) |
| 622 |
{ |
| 623 |
R_StopInterpolation (type1, posptr1); |
| 624 |
if(posptr2) |
| 625 |
R_StopInterpolation (type2, posptr2); |
| 626 |
} |
| 627 |
} |