//cycle the flashing light for when mine destroyed void FlashFrame (void) { static fixang flash_ang = 0; if (!(gameData.reactor.bDestroyed || gameStates.gameplay.seismic.nMagnitude)) { gameStates.render.nFlashScale = I2X (1); return; } if (gameStates.app.bEndLevelSequence) return; if (paletteManager.BlueEffect () > 10) //whiting out return; // flash_ang += FixMul(FLASH_CYCLE_RATE, gameData.time.xFrame); if (gameStates.gameplay.seismic.nMagnitude) { fix xAddedFlash = abs(gameStates.gameplay.seismic.nMagnitude); if (xAddedFlash < I2X (1)) xAddedFlash *= 16; flash_ang += (fixang) FixMul (gameStates.render.nFlashRate, FixMul(gameData.time.xFrame, xAddedFlash+I2X (1))); FixFastSinCos (flash_ang, &gameStates.render.nFlashScale, NULL); gameStates.render.nFlashScale = (gameStates.render.nFlashScale + I2X (3))/4; // gets in range 0.5 to 1.0 } else { flash_ang += (fixang) FixMul (gameStates.render.nFlashRate, gameData.time.xFrame); FixFastSinCos (flash_ang, &gameStates.render.nFlashScale, NULL); gameStates.render.nFlashScale = (gameStates.render.nFlashScale + I2X (1))/2; if (gameStates.app.nDifficultyLevel == 0) gameStates.render.nFlashScale = (gameStates.render.nFlashScale+I2X (3))/4; } }
void WiggleObject (CObject *objP) { fix xWiggle; int nParent; CObject *pParent; if (gameStates.render.nShadowPass == 2) return; if (gameOpts->app.bEpilepticFriendly) return; if (!gameStates.app.bNostalgia && (!EGI_FLAG (nDrag, 0, 0, 0) || !EGI_FLAG (bWiggle, 1, 0, 1))) return; nParent = gameData.objs.parentObjs [objP->Index ()]; pParent = (nParent < 0) ? NULL : OBJECTS + nParent; FixFastSinCos (fix (gameData.time.xGame / gameStates.gameplay.slowmo [1].fSpeed), &xWiggle, NULL); if (gameData.time.xFrame < I2X (1))// Only scale wiggle if getting at least 1 FPS, to avoid causing the opposite problem. xWiggle = FixMul (xWiggle * 20, gameData.time.xFrame); //make wiggle fps-independent (based on pre-scaled amount of wiggle at 20 FPS) if (SPECTATOR (objP)) OBJPOS (objP)->vPos += (OBJPOS (objP)->mOrient.UVec () * FixMul (xWiggle, gameData.pig.ship.player->wiggle)) * (I2X (1) / 20); else if ((objP->info.nType == OBJ_PLAYER) || !pParent) objP->mType.physInfo.velocity += objP->info.position.mOrient.UVec () * FixMul (xWiggle, gameData.pig.ship.player->wiggle); else { objP->mType.physInfo.velocity += pParent->info.position.mOrient.UVec () * FixMul (xWiggle, gameData.pig.ship.player->wiggle); objP->info.position.vPos += objP->mType.physInfo.velocity * gameData.time.xFrame; } }