~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/engine/eCamera.cpp

  • Committer: SwagTron
  • Date: 2019-03-05 07:13:03 UTC
  • Revision ID: swagtron-20190305071303-5m4cn9hs6h8ydsgf
- Ported toggle from 0.4. Seems kind of hacky. Had to add another FindConfigItem of type tConfItemBase due to tab completion using the previous tString function. Plan to change this later, but I really needed the toggle function. Tried to cast the two, but that did not work out. Seemed like the bug-less option for the time being. Those unfamiliar with this function, you can now toggle boolean commands (Ex. toggle text_out)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
static bool se_visibilityLowerWall = true; // flag indicating whether walls should be lowerd when they block the view
60
60
static bool se_visibilityLowerWallSmart = false; // same specially for the smart camera
61
61
 
62
 
static tConfItem<REAL> se_viscs("CAMERA_VISIBILITY_RECOVERY_SPEED", se_hitCacheSpeed );
63
 
static tConfItem<REAL> se_viswd("CAMERA_VISIBILITY_WALL_DISTANCE", se_visibilityWallDistance );
64
 
static tConfItem<REAL> se_viss("CAMERA_VISIBILITY_CLIP_SPEED", se_visibilitySpeed );
65
 
static tConfItem<REAL> se_vise("CAMERA_VISIBILITY_EXTENSION", se_visibilityExtension );
66
 
static tConfItem<REAL> se_vissk("CAMERA_VISIBILITY_SIDESKEW", se_visibilitySidewaysSkew );
67
 
static tConfItem<bool> se_vislw("CAMERA_VISIBILITY_LOWER_WALL", se_visibilityLowerWall );
68
 
static tConfItem<bool> se_vislws("CAMERA_VISIBILITY_LOWER_WALL_SMART", se_visibilityLowerWallSmart );
 
62
static tSettingItem<REAL> se_viscs("CAMERA_VISIBILITY_RECOVERY_SPEED", se_hitCacheSpeed );
 
63
static tSettingItem<REAL> se_viswd("CAMERA_VISIBILITY_WALL_DISTANCE", se_visibilityWallDistance );
 
64
static tSettingItem<REAL> se_viss("CAMERA_VISIBILITY_CLIP_SPEED", se_visibilitySpeed );
 
65
static tSettingItem<REAL> se_vise("CAMERA_VISIBILITY_EXTENSION", se_visibilityExtension );
 
66
static tSettingItem<REAL> se_vissk("CAMERA_VISIBILITY_SIDESKEW", se_visibilitySidewaysSkew );
 
67
static tSettingItem<bool> se_vislw("CAMERA_VISIBILITY_LOWER_WALL", se_visibilityLowerWall );
 
68
static tSettingItem<bool> se_vislws("CAMERA_VISIBILITY_LOWER_WALL_SMART", se_visibilityLowerWallSmart );
69
69
 
70
70
//static bool se_customGlance = true; // use the custom camera settings for glancing in the smart camera
71
71
//static tSettingItem<bool> se_cg("CAMERA_SMART_GLANCE_CUSTOM", se_customGlance );
231
231
static REAL s_startSmartX = 10, s_startSmartY = 30, s_startSmartZ = 2;
232
232
static REAL s_startFreeX =  10, s_startFreeY = -70, s_startFreeZ = 100;
233
233
 
234
 
static tConfItem<REAL> s_foX("CAMERA_FOLLOW_START_X", s_startFollowX);
235
 
static tConfItem<REAL> s_smX("CAMERA_SMART_START_X", s_startSmartX);
236
 
static tConfItem<REAL> s_frX("CAMERA_FREE_START_X", s_startFreeX);
237
 
 
238
 
static tConfItem<REAL> s_foY("CAMERA_FOLLOW_START_Y", s_startFollowY);
239
 
static tConfItem<REAL> s_smY("CAMERA_SMART_START_Y", s_startSmartY);
240
 
static tConfItem<REAL> s_frY("CAMERA_FREE_START_Y", s_startFreeY);
241
 
 
242
 
static tConfItem<REAL> s_foZ("CAMERA_FOLLOW_START_Z", s_startFollowZ);
243
 
static tConfItem<REAL> s_smZ("CAMERA_SMART_START_Z", s_startSmartZ);
244
 
static tConfItem<REAL> s_frZ("CAMERA_FREE_START_Z", s_startFreeZ);
 
234
static tSettingItem<REAL> s_foX("CAMERA_FOLLOW_START_X", s_startFollowX);
 
235
static tSettingItem<REAL> s_smX("CAMERA_SMART_START_X", s_startSmartX);
 
236
static tSettingItem<REAL> s_frX("CAMERA_FREE_START_X", s_startFreeX);
 
237
 
 
238
static tSettingItem<REAL> s_foY("CAMERA_FOLLOW_START_Y", s_startFollowY);
 
239
static tSettingItem<REAL> s_smY("CAMERA_SMART_START_Y", s_startSmartY);
 
240
static tSettingItem<REAL> s_frY("CAMERA_FREE_START_Y", s_startFreeY);
 
241
 
 
242
static tSettingItem<REAL> s_foZ("CAMERA_FOLLOW_START_Z", s_startFollowZ);
 
243
static tSettingItem<REAL> s_smZ("CAMERA_SMART_START_Z", s_startSmartZ);
 
244
static tSettingItem<REAL> s_frZ("CAMERA_FREE_START_Z", s_startFreeZ);
245
245
 
246
246
// custom camera displacement
247
247
static REAL s_customBack = 30, s_customRise = 20, s_customBackSpeed = 0, s_customRiseSpeed = 0 , s_customPitch = -.7, s_customZoom = 0.5, s_customTurnSpeed=40, s_customTurnSpeed180 = 2;
250
250
static REAL s_serverGlanceBack = 30, s_serverGlanceRise = 20, s_serverGlanceBackSpeed = 0, s_serverGlanceRiseSpeed = 0, s_serverGlancePitch = -.7;
251
251
 
252
252
 
253
 
static tConfItem<REAL> s_iBack("CAMERA_CUSTOM_BACK", s_customBack);
254
 
static tConfItem<REAL> s_iRise("CAMERA_CUSTOM_RISE", s_customRise);
255
 
static tConfItem<REAL> s_iBackSpeed("CAMERA_CUSTOM_BACK_FROMSPEED", s_customBackSpeed);
256
 
static tConfItem<REAL> s_iRiseSpeed("CAMERA_CUSTOM_RISE_FROMSPEED", s_customRiseSpeed);
257
 
static tConfItem<REAL> s_iPitch("CAMERA_CUSTOM_PITCH", s_customPitch);
258
 
static tConfItem<REAL> s_iZoom("CAMERA_CUSTOM_ZOOM", s_customZoom);
259
 
static tConfItem<REAL> s_iCustomTurnSpeed("CAMERA_CUSTOM_TURN_SPEED", s_customTurnSpeed);
260
 
static tConfItem<REAL> s_iCustomTurnSpeed180("CAMERA_CUSTOM_TURN_SPEED_180", s_customTurnSpeed180);
 
253
static tSettingItem<REAL> s_iBack("CAMERA_CUSTOM_BACK", s_customBack);
 
254
static tSettingItem<REAL> s_iRise("CAMERA_CUSTOM_RISE", s_customRise);
 
255
static tSettingItem<REAL> s_iBackSpeed("CAMERA_CUSTOM_BACK_FROMSPEED", s_customBackSpeed);
 
256
static tSettingItem<REAL> s_iRiseSpeed("CAMERA_CUSTOM_RISE_FROMSPEED", s_customRiseSpeed);
 
257
static tSettingItem<REAL> s_iPitch("CAMERA_CUSTOM_PITCH", s_customPitch);
 
258
static tSettingItem<REAL> s_iZoom("CAMERA_CUSTOM_ZOOM", s_customZoom);
 
259
static tSettingItem<REAL> s_iCustomTurnSpeed("CAMERA_CUSTOM_TURN_SPEED", s_customTurnSpeed);
 
260
static tSettingItem<REAL> s_iCustomTurnSpeed180("CAMERA_CUSTOM_TURN_SPEED_180", s_customTurnSpeed180);
261
261
 
262
 
static tConfItem<REAL> s_iGBack("CAMERA_GLANCE_BACK", s_glanceBack);
263
 
static tConfItem<REAL> s_iGRise("CAMERA_GLANCE_RISE", s_glanceRise);
264
 
static tConfItem<REAL> s_iGBackSpeed("CAMERA_GLANCE_BACK_FROMSPEED", s_glanceBackSpeed);
265
 
static tConfItem<REAL> s_iGRiseSpeed("CAMERA_GLANCE_RISE_FROMSPEED", s_glanceRiseSpeed);
266
 
static tConfItem<REAL> s_iGPitch("CAMERA_GLANCE_PITCH", s_glancePitch);
 
262
static tSettingItem<REAL> s_iGBack("CAMERA_GLANCE_BACK", s_glanceBack);
 
263
static tSettingItem<REAL> s_iGRise("CAMERA_GLANCE_RISE", s_glanceRise);
 
264
static tSettingItem<REAL> s_iGBackSpeed("CAMERA_GLANCE_BACK_FROMSPEED", s_glanceBackSpeed);
 
265
static tSettingItem<REAL> s_iGRiseSpeed("CAMERA_GLANCE_RISE_FROMSPEED", s_glanceRiseSpeed);
 
266
static tSettingItem<REAL> s_iGPitch("CAMERA_GLANCE_PITCH", s_glancePitch);
267
267
 
268
268
static nSettingItem<REAL> s_iSBack("CAMERA_SERVER_CUSTOM_BACK", s_serverCustomBack);
269
269
static nSettingItem<REAL> s_iSRise("CAMERA_SERVER_CUSTOM_RISE", s_serverCustomRise);
281
281
 
282
282
// turn speed of internal camera
283
283
static REAL s_inTurnSpeed=40;
284
 
static tConfItem<REAL> s_iInTurnSpeed("CAMERA_IN_TURN_SPEED", s_inTurnSpeed);
 
284
static tSettingItem<REAL> s_iInTurnSpeed("CAMERA_IN_TURN_SPEED", s_inTurnSpeed);
285
285
 
286
286
bool eCamera::InterestingToWatch(eGameObject const *g){
287
287
    return g &&
1254
1254
 
1255
1255
// distance scale for tests measured relative to cycle speed
1256
1256
static REAL se_cameraSmartDistanceScale = .2;
1257
 
static tConfItem< REAL > se_confCameraSmartDistanceScale( "CAMERA_SMART_DISTANCESCALE", se_cameraSmartDistanceScale );
 
1257
static tSettingItem< REAL > se_confCameraSmartDistanceScale( "CAMERA_SMART_DISTANCESCALE", se_cameraSmartDistanceScale );
1258
1258
 
1259
1259
// minimal distance scale of tests in meters
1260
1260
static REAL se_cameraSmartMinDistanceScale = 5.0;
1261
 
static tConfItem< REAL > se_confCameraSmartMinDistanceScale( "CAMERA_SMART_MIN_DISTANCESCALE", se_cameraSmartMinDistanceScale );
 
1261
static tSettingItem< REAL > se_confCameraSmartMinDistanceScale( "CAMERA_SMART_MIN_DISTANCESCALE", se_cameraSmartMinDistanceScale );
1262
1262
 
1263
1263
// minimal distance of the camera to the cycle in meters
1264
1264
static REAL se_cameraSmartMinDistance = 10.0;
1265
 
static tConfItem< REAL > se_confCameraSmartMinDistance( "CAMERA_SMART_MIN_DISTANCE", se_cameraSmartMinDistance );
 
1265
static tSettingItem< REAL > se_confCameraSmartMinDistance( "CAMERA_SMART_MIN_DISTANCE", se_cameraSmartMinDistance );
1266
1266
 
1267
1267
// typical cycle speed
1268
1268
static REAL se_cameraSmartCycleSpeed = 20.0;
1269
 
static tConfItem< REAL > se_confCameraSmartCycleSpeed( "CAMERA_SMART_CYCLESPEED", se_cameraSmartCycleSpeed );
 
1269
static tSettingItem< REAL > se_confCameraSmartCycleSpeed( "CAMERA_SMART_CYCLESPEED", se_cameraSmartCycleSpeed );
1270
1270
 
1271
1271
// typical height in speed units
1272
1272
static REAL se_cameraSmartHeight = 2.0;
1273
 
static tConfItem< REAL > se_confCameraSmartHeight( "CAMERA_SMART_HEIGHT", se_cameraSmartHeight );
 
1273
static tSettingItem< REAL > se_confCameraSmartHeight( "CAMERA_SMART_HEIGHT", se_cameraSmartHeight );
1274
1274
// typical height in speed units
1275
1275
static REAL se_cameraSmartDistance = 4.0;
1276
 
static tConfItem< REAL > se_confCameraSmartDistance( "CAMERA_SMART_DISTANCE", se_cameraSmartDistance );
 
1276
static tSettingItem< REAL > se_confCameraSmartDistance( "CAMERA_SMART_DISTANCE", se_cameraSmartDistance );
1277
1277
// extra factor for height
1278
1278
static REAL se_cameraSmartHeightExtra = .5f;
1279
 
static tConfItem< REAL > se_confCameraSmartHeightExtra( "CAMERA_SMART_HEIGHT_EXTRA", se_cameraSmartHeightExtra );
 
1279
static tSettingItem< REAL > se_confCameraSmartHeightExtra( "CAMERA_SMART_HEIGHT_EXTRA", se_cameraSmartHeightExtra );
1280
1280
 
1281
1281
// influence of turning
1282
1282
static REAL se_cameraSmartHeightTurning = .5;
1283
 
static tConfItem< REAL > se_confCameraSmartHeightTurning( "CAMERA_SMART_HEIGHT_TURNING", se_cameraSmartHeightTurning );
 
1283
static tSettingItem< REAL > se_confCameraSmartHeightTurning( "CAMERA_SMART_HEIGHT_TURNING", se_cameraSmartHeightTurning );
1284
1284
 
1285
1285
// influence of grinding
1286
1286
static REAL se_cameraSmartHeightGrinding = 0;
1287
 
static tConfItem< REAL > se_confCameraSmartHeightGrinding( "CAMERA_SMART_HEIGHT_GRINDING", se_cameraSmartHeightGrinding );
 
1287
static tSettingItem< REAL > se_confCameraSmartHeightGrinding( "CAMERA_SMART_HEIGHT_GRINDING", se_cameraSmartHeightGrinding );
1288
1288
 
1289
1289
// influence of wall in front
1290
1290
static REAL se_cameraSmartHeightObstacle = 1.0;
1291
 
static tConfItem< REAL > se_confCameraSmartHeightObstacle( "CAMERA_SMART_HEIGHT_OBSTACLE", se_cameraSmartHeightObstacle );
 
1291
static tSettingItem< REAL > se_confCameraSmartHeightObstacle( "CAMERA_SMART_HEIGHT_OBSTACLE", se_cameraSmartHeightObstacle );
1292
1292
 
1293
1293
// factor moving the camera to the side if it is in front of the cycle
1294
1294
static REAL se_cameraSmartAvoidFront = 10.0;
1295
 
static tConfItem< REAL > se_confCameraSmartAvoidFront( "CAMERA_SMART_AVOID_FRONT", se_cameraSmartAvoidFront );
 
1295
static tSettingItem< REAL > se_confCameraSmartAvoidFront( "CAMERA_SMART_AVOID_FRONT", se_cameraSmartAvoidFront );
1296
1296
 
1297
1297
// factor moving the camera to the side if it is in front of the cycle
1298
1298
static REAL se_cameraSmartAvoidFront2 = 0.1;
1299
 
static tConfItem< REAL > se_confCameraSmartAvoidFront2( "CAMERA_SMART_AVOID_FRONT2", se_cameraSmartAvoidFront2 );
 
1299
static tSettingItem< REAL > se_confCameraSmartAvoidFront2( "CAMERA_SMART_AVOID_FRONT2", se_cameraSmartAvoidFront2 );
1300
1300
 
1301
1301
// amount of turning from grinding
1302
1302
static REAL se_cameraSmartTurn = 5.0;
1303
 
static tConfItem< REAL > se_confCameraSmartTurn( "CAMERA_SMART_TURN_GRINDING", se_cameraSmartTurn );
 
1303
static tSettingItem< REAL > se_confCameraSmartTurn( "CAMERA_SMART_TURN_GRINDING", se_cameraSmartTurn );
1304
1304
 
1305
1305
// speed of center pos smoothing
1306
1306
static REAL se_cameraSmartCenterPosSmooth = 6.0;
1307
 
static tConfItem< REAL > se_confCameraSmartCenterPosSmooth( "CAMERA_SMART_CENTER_POS_SMOOTH", se_cameraSmartCenterPosSmooth );
 
1307
static tSettingItem< REAL > se_confCameraSmartCenterPosSmooth( "CAMERA_SMART_CENTER_POS_SMOOTH", se_cameraSmartCenterPosSmooth );
1308
1308
 
1309
1309
// speed of center dir smoothing
1310
1310
static REAL se_cameraSmartCenterDirSmooth = 3.0;
1311
 
static tConfItem< REAL > se_confCameraSmartCenterDirSmooth( "CAMERA_SMART_CENTER_DIR_SMOOTH", se_cameraSmartCenterDirSmooth );
 
1311
static tSettingItem< REAL > se_confCameraSmartCenterDirSmooth( "CAMERA_SMART_CENTER_DIR_SMOOTH", se_cameraSmartCenterDirSmooth );
1312
1312
 
1313
1313
// amount of lookahead relative to speed
1314
1314
static REAL se_cameraSmartCenterLookahead = .5;
1315
 
static tConfItem< REAL > se_confCameraSmartCenterLookahead( "CAMERA_SMART_CENTER_LOOKAHEAD", se_cameraSmartCenterLookahead );
 
1315
static tSettingItem< REAL > se_confCameraSmartCenterLookahead( "CAMERA_SMART_CENTER_LOOKAHEAD", se_cameraSmartCenterLookahead );
1316
1316
 
1317
1317
// max amount of lookahead
1318
1318
static REAL se_cameraSmartCenterMaxLookahead = 5;
1319
 
static tConfItem< REAL > se_confCameraSmartCenterMaxLookahead( "CAMERA_SMART_CENTER_MAX_LOOKAHEAD", se_cameraSmartCenterMaxLookahead );
 
1319
static tSettingItem< REAL > se_confCameraSmartCenterMaxLookahead( "CAMERA_SMART_CENTER_MAX_LOOKAHEAD", se_cameraSmartCenterMaxLookahead );
1320
1320
 
1321
1321
 
1322
1322
/*
1538
1538
        netPlayer = localPlayer->netPlayer;
1539
1539
    }
1540
1540
 
1541
 
    // If our START_FOV_ value doesnt match our current fov, update.
1542
 
    if (fov != localPlayer->startFOV)
1543
 
    {
1544
 
        fov = localPlayer->startFOV;
1545
 
    }
1546
 
 
1547
1541
    // the best center is always our own vehicle. Focus on it if possible.
1548
1542
    if (netPlayer)
1549
1543
    {