// democam v1.0
// original code by runar (and freaky?) + dynamix dev team for editor camera code
// retard version by andrew
//
// usage: add exec("plasdemocam.cs"); to your autoexec.cs
//
// hit 'p' while watching a demo to launch the demo
// camera. from there you have a few key options
//
// '1'->'9': alter demo cam movement speed (1=slowest, 9=fastest)
// w,a,s,d: move forward/back/left/right (standard fps controls)
// e,c: move up/down (necessary to get up from below terrain)
// up: demo speed normal
// down: pause demo
// left: slow down demo
// right: fast forward demo
//
// NOTE: demo cam moves independant of demo speed. you may pause
// the demo and fly around freely in the frozen world
//
// TIP: the cam spawns in rather random spots. if you find you can't locate
// the playing field, fire up hm.exe (perma indicators) and head
// in the direction of the triangles. hm.exe also gives you player
// name/health indicators for every player in sight. vanilla tribes
// gives nothing for non-triangled players
// edited by Plasmatic
// www.annihilation.info
// added multiple cameras, and switching through them by hitting spacebar.
// cleaned up the code some also..
editActionMap("playMap.sae");
bindCommand(keyboard0, make, "p", TO, "if($playingDemo)DemoCam::Create();");
function DemoCam::Create()
{
//remember the first cams id# (player perspective) -plasmatic.
$cam[0] = Group::getObject(9, 0);
$camnum++;
// create cam
%CameraID = newobject(DemoCam, EditCamera, "move.sae");
addtoset(9, %CameraID); // SimCameraSet
addtoset(6, %CameraID); // Simset
// Attach it
postAction(PlayGui, Attach, DemoCam);
focus(DemoCam);
// Default move speed
DemoCam::Move(12);
// Add the id of the current cam to list.. -plasmatic
$cam[$camnum] = %CameraID;
$camcurrent = $camnum;
}
// democam keybinds v1.0
// original code by runar (and freaky?)
// retard version by andrew
// Set up a default movement action map file
function DemoCam::Move( %speed, %posRot )
{
if( %speed == "" )
$MoveSpeed = 2;
else
$MoveSpeed = %speed;
if( %posRot == "" )
$PosRotation = 0.2;
else
$PosRotation = %posRot;
%NegRotation = strcat( "-", $PosRotation );
newActionMap("move.sae");
editActionMap("move.sae");
bindAction( keyboard, make, a, TO, IDACTION_MOVELEFT, $MoveSpeed );
bindAction( keyboard, break, a, TO, IDACTION_MOVELEFT, 0 );
bindAction( keyboard, make, d, TO, IDACTION_MOVERIGHT, $MoveSpeed );
bindAction( keyboard, break, d, TO, IDACTION_MOVERIGHT, 0 );
bindAction( keyboard, make, s, TO, IDACTION_MOVEBACK, $MoveSpeed );
bindAction( keyboard, break, s, TO, IDACTION_MOVEBACK, 0 );
bindAction( keyboard, make, w, TO, IDACTION_MOVEFORWARD, $MoveSpeed );
bindAction( keyboard, break, w, TO, IDACTION_MOVEFORWARD, 0 );
bindAction( keyboard, make, e, TO, IDACTION_MOVEUP, $MoveSpeed );
bindAction( keyboard, break, e, TO, IDACTION_MOVEUP, 0 );
bindAction( keyboard, make, c, TO, IDACTION_MOVEDOWN, $MoveSpeed );
bindAction( keyboard, break, c, TO, IDACTION_MOVEDOWN, 0 );
bindAction(mouse0, xaxis0, TO, IDACTION_YAW, Flip, Scale, 0.002005);
bindAction(mouse0, yaxis0, TO, IDACTION_PITCH, Flip, Scale, 0.002005);
bindCommand(keyboard0, make, "up", TO, "Demo::demoKey();");
bindCommand(keyboard0, break, "up", TO, "$Null = '';");
bindCommand(keyboard0, make, "down", TO, "Demo::demoKey(pause);");
bindCommand(keyboard0, break, "down", TO, "$Null = '';");
bindCommand(keyboard0, make, "left", TO, "Demo::demoKey(sd);");
bindCommand(keyboard0, break, "left", TO, "$Null = '';");
bindCommand(keyboard0, make, "right", TO, "Demo::demoKey(ff);");
bindCommand(keyboard0, break, "right", TO, "$Null = '';");
// modify space to switch cams -plasmatic
bindCommand(keyboard0, make, "space", TO, "DemoCam::switch();");
bindCommand(keyboard0, break, "space", TO, "$Null = '';");
bindCommand( keyboard, make, 1, to, "DemoCam::Move(1);");
bindCommand( keyboard, make, 2, to, "DemoCam::Move(3);");
bindCommand( keyboard, make, 3, to, "DemoCam::Move(6);");
bindCommand( keyboard, make, 4, to, "DemoCam::Move(12);");
bindCommand( keyboard, make, 5, to, "DemoCam::Move(24);");
bindCommand( keyboard, make, 6, to, "DemoCam::Move(50);");
bindCommand( keyboard, make, 7, to, "DemoCam::Move(100);");
bindCommand( keyboard, make, 8, to, "DemoCam::Move(200);");
bindCommand( keyboard, make, 9, to, "DemoCam::Move(400);");
pushActionMap("move.sae");
}
//cowboys code sup..
$Demo::Scale[0] = 0.0;
$Demo::Scale[1] = 0.00390625;
$Demo::Scale[2] = 0.0078125;
$Demo::Scale[3] = 0.015625;
$Demo::Scale[4] = 0.03125;
$Demo::Scale[5] = 0.0625;
$Demo::Scale[6] = 0.125;
$Demo::Scale[7] = 0.25;
$Demo::Scale[8] = 0.5;
$Demo::Scale[9] = 1;
$Demo::Scale[10] = 2;
$Demo::Scale[11] = 3;
$Demo::Scale[12] = 4;
$Demo::Scale[13] = 5;
$Demo::Scale[14] = 6;
$Demo::Scale[15] = 8;
$Demo::Scale[16] = 10;
$Demo::Scale[17] = 12;
$Demo::Scale[18] = 14;
$Demo::Scale[19] = 16;
$Demo::Scale[20] = 20;
$Demo::Scale[21] = 24;
$Demo::Scale[22] = 28;
$Demo::Scale[23] = 32;
$Demo::Scale[24] = 36;
$Demo::SpeedLimit = 24;
function Demo::demoKey(%demoFunc)
{
if ($playingDemo)
Demo::ChangeSpeed(%demoFunc);
}
function Demo::ChangeSpeed(%speed)
{
if ($PlayingDemo)
{
if (%speed == pause)
$Demo::CurrentScale = 0;
else if (%speed == sd)
$Demo::CurrentScale--;
else if (%speed == ff)
$Demo::CurrentScale++;
else
$Demo::CurrentScale = 9;
}
else
$Demo::CurrentScale = 9;
if ($Demo::CurrentScale < 0)
$Demo::CurrentScale = 0;
else if ($Demo::CurrentScale > $Demo::SpeedLimit)
$Demo::CurrentScale = $Demo::SpeedLimit;
$SimGame::TimeScale = $Demo::Scale[$Demo::CurrentScale];
}
$Demo::CurrentScale = 9;
//new here by plasmatic
function DemoCam::switch()
{
// unfocus($cam[$camcurrent]);
$camcurrent++;
if($camcurrent > $camnum)
$camcurrent = 0;
echo("switching to cam # "@$camcurrent@" id# "@$cam[$camcurrent]);
postAction(PlayGui, Attach, $cam[$camcurrent]);
focus($cam[$camcurrent]);
}
//load up the demo at speed 6 to save time -plasmatic
function ELM()
{
if($playingDemo)
{
$SimGame::TimeScale = 6.0;
setCursor(MainWindow, "Cur_Arrow.bmp");
disconnect();
startMainMenuScreen();
GuiLoadContentCtrl(MainWindow, "gui\\Recordings.gui");
}
else
{
$SimGame::TimeScale = 1.0;
$InLobbyMode = true;
GuiLoadContentCtrl(MainWindow, "gui\\Lobby.gui");
CursorOn(MainWindow);
}
}