This commit is contained in:
enderman0125 2024-03-10 20:27:00 -04:00
commit ec09dde345
2348 changed files with 98212 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
/glu2d3d.dll
/license.txt
/marbleBlast.exe
/ogg.dll
/openal32.dll
/OpenAL64.dll
/opengl2d3d.dll
/readme.txt
/vorbis.dll
/console.log

Binary file not shown.

View File

@ -0,0 +1,45 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Utility remap functions:
//------------------------------------------------------------------------------
function ActionMap::copyBind( %this, %otherMap, %command )
{
if ( !isObject( %otherMap ) )
{
error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" );
return;
}
%bind = %otherMap.getBinding( %command );
if ( %bind !$= "" )
{
%device = getField( %bind, 0 );
%action = getField( %bind, 1 );
%flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD";
%deadZone = %otherMap.getDeadZone( %device, %action );
%scale = %otherMap.getScale( %device, %action );
%this.bind( %device, %action, %flags, %deadZone, %scale, %command );
}
}
//------------------------------------------------------------------------------
function ActionMap::blockBind( %this, %otherMap, %command )
{
if ( !isObject( %otherMap ) )
{
error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" );
return;
}
%bind = %otherMap.getBinding( %command );
if ( %bind !$= "" )
%this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" );
}

48
common/client/audio.cs Normal file
View File

@ -0,0 +1,48 @@
//-----------------------------------------------------------------------------
// Torque Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
function OpenALInit()
{
OpenALShutdownDriver();
echo("");
echo("OpenAL Driver Init:");
echo ($pref::Audio::driver);
if($pref::Audio::driver $= "OpenAL")
{
if(!OpenALInitDriver())
{
error(" Failed to initialize driver.");
$Audio::initFailed = true;
}
}
echo(" Vendor: " @ alGetString("AL_VENDOR"));
echo(" Version: " @ alGetString("AL_VERSION"));
echo(" Renderer: " @ alGetString("AL_RENDERER"));
echo(" Extensions: " @ alGetString("AL_EXTENSIONS"));
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
for (%channel=1; %channel <= 8; %channel++)
alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);
echo("");
}
//--------------------------------------------------------------------------
function OpenALShutdown()
{
OpenALShutdownDriver();
//alxStopAll();
//AudioGui.delete();
//sButtonDown.delete();
//sButtonOver.delete();
}

BIN
common/client/audio.cs.dso Normal file

Binary file not shown.

59
common/client/canvas.cs Normal file
View File

@ -0,0 +1,59 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function to construct and initialize the default canvas window
// used by the games
function initCanvas(%windowName)
{
videoSetGammaCorrection($pref::OpenGL::gammaCorrection);
if (!createCanvas(%windowName)) {
quit();
return;
}
setOpenGLTextureCompressionHint( $pref::OpenGL::compressionHint );
setOpenGLAnisotropy( $pref::OpenGL::anisotropy );
setOpenGLMipReduction( $pref::OpenGL::mipReduction );
setOpenGLInteriorMipReduction( $pref::OpenGL::interiorMipReduction );
setOpenGLSkyMipReduction( $pref::OpenGL::skyMipReduction );
// Declare default GUI Profiles.
exec("~/ui/defaultProfiles.cs");
// Common GUI's
exec("~/ui/GuiEditorGui.gui");
exec("~/ui/ConsoleDlg.gui");
exec("~/ui/InspectDlg.gui");
exec("~/ui/LoadFileDlg.gui");
exec("~/ui/SaveFileDlg.gui");
exec("~/ui/MessageBoxOkDlg.gui");
exec("~/ui/MessageBoxYesNoDlg.gui");
exec("~/ui/MessageBoxOKCancelDlg.gui");
exec("~/ui/MessagePopupDlg.gui");
exec("~/ui/HelpDlg.gui");
exec("~/ui/RecordingsDlg.gui");
// Commonly used helper scripts
exec("./metrics.cs");
exec("./messageBox.cs");
exec("./screenshot.cs");
exec("./cursor.cs");
exec("./help.cs");
exec("./recordings.cs");
// Init the audio system
OpenALInit();
}
function resetCanvas()
{
if (isObject(Canvas))
{
Canvas.repaint();
}
}

BIN
common/client/canvas.cs.dso Normal file

Binary file not shown.

100
common/client/cursor.cs Normal file
View File

@ -0,0 +1,100 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Cursor Control
//------------------------------------------------------------------------------
$cursorControlled = true;
function cursorOff()
{
if ( $cursorControlled )
lockMouse(true);
Canvas.cursorOff();
}
function cursorOn()
{
if ( $cursorControlled )
lockMouse(false);
Canvas.cursorOn();
Canvas.setCursor(DefaultCursor);
}
// In the CanvasCursor package we add some additional functionality to the
// built-in GuiCanvas class, of which the global Canvas object is an instance.
// In this case, the behavior we want is for the cursor to automatically display,
// except when the only guis visible want no cursor - most notably,
// in the case of the example, the play gui.
// In order to override or extend an existing class, we use the script package
// feature.
package CanvasCursor
{
// The checkCursor method iterates through all the root controls on the canvas
// (basically the content control and any visible dialogs). If all of them
// have the .noCursor attribute set, the cursor is turned off, otherwise it is
// turned on.
function GuiCanvas::checkCursor(%this)
{
%cursorShouldBeOn = false;
for(%i = 0; %i < %this.getCount(); %i++)
{
%control = %this.getObject(%i);
if(%control.noCursor $= "")
{
%cursorShouldBeOn = true;
break;
}
}
if(%cursorShouldBeOn != %this.isCursorOn())
{
if(%cursorShouldBeOn)
cursorOn();
else
cursorOff();
}
}
// below, all functions which can alter which content controls are visible
// are extended to call the checkCursor function. For package'd functions,
// the Parent:: call refers to the original implementation of that function,
// or a version that was declared in a previously activated package.
// In this case the parent calls should point to the built in versions
// of GuiCanvas functions.
function GuiCanvas::setContent(%this, %ctrl)
{
Parent::setContent(%this, %ctrl);
%this.checkCursor();
}
function GuiCanvas::pushDialog(%this, %ctrl)
{
Parent::pushDialog(%this, %ctrl);
%this.checkCursor();
}
function GuiCanvas::popDialog(%this, %ctrl)
{
Parent::popDialog(%this, %ctrl);
%this.checkCursor();
}
function GuiCanvas::popLayer(%this, %layer)
{
Parent::popLayer(%this, %layer);
%this.checkCursor();
}
};
// activate the package when the script loads.
activatePackage(CanvasCursor);

BIN
common/client/cursor.cs.dso Normal file

Binary file not shown.

62
common/client/help.cs Normal file
View File

@ -0,0 +1,62 @@
//-----------------------------------------------------------------------------
// Torque Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
function HelpDlg::onWake(%this)
{
HelpFileList.entryCount = 0;
HelpFileList.clear();
for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl"))
{
HelpFileList.fileName[HelpFileList.entryCount] = %file;
HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file));
HelpFileList.entryCount++;
}
HelpFileList.sortNumerical(0);
HelpFileList.setSelectedRow(0);
}
function HelpFileList::onSelect(%this, %row)
{
%fo = new FileObject();
%fo.openForRead(%this.fileName[%row]);
%text = "";
while(!%fo.isEOF())
%text = %text @ %fo.readLine() @ "\n";
%fo.delete();
HelpText.setText(%text);
}
function getHelp(%helpName)
{
Canvas.pushDialog(HelpDlg);
if(%helpName !$= "")
{
%index = HelpFileList.findTextIndex(%helpName);
HelpFileList.setSelectedRow(%index);
}
}
function contextHelp()
{
for(%i = 0; %i < Canvas.getCount(); %i++)
{
if(Canvas.getObject(%i).getName() $= HelpDlg)
{
Canvas.popDialog(HelpDlg);
return;
}
}
%content = Canvas.getContent();
%helpPage = %content.getHelpPage();
getHelp(%helpPage);
}
function GuiControl::getHelpPage(%this)
{
return %this.helpPage;
}

BIN
common/client/help.cs.dso Normal file

Binary file not shown.

81
common/client/message.cs Normal file
View File

@ -0,0 +1,81 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Functions that process commands sent from the server.
// This function is for chat messages only; it is invoked on the client when
// the server does a commandToClient with the tag ChatMessage. (Cf. the
// functions chatMessage* in common/server/message.cs.)
// This just invokes onChatMessage, which the mod code must define.
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
onChatMessage(detag(%msgString), %voice, %pitch);
}
// Game event descriptions, which may or may not include text messages, can be
// sent using the message* functions in common/server/message.cs. Those
// functions do commandToClient with the tag ServerMessage, which invokes the
// function below.
// For ServerMessage messages, the client can install callbacks that will be
// run, according to the "type" of the message.
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
// Get the message type; terminates at any whitespace.
%tag = getWord(%msgType, 0);
// First see if there is a callback installed that doesn't have a type;
// if so, that callback is always executed when a message arrives.
for (%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++) {
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
// Next look for a callback for this particular type of ServerMessage.
if (%tag !$= "") {
for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++) {
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
}
}
// Called by the client to install a callback for a particular type of
// ServerMessage.
function addMessageCallback(%msgType, %func)
{
for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++) {
// If it already exists as a callback for this type,
// nothing to do.
if (%afunc $= %func) {
return;
}
}
// Set it up.
$MSGCB[%msgType, %i] = %func;
}
// The following is the callback that will be executed for every ServerMessage,
// because we're going to install it without a specified type. Any type-
// specific callbacks will be executed afterward.
// This just invokes onServerMessage, which the mod code must define.
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
onServerMessage(detag(%msgString));
}
// Register that default message handler now.
addMessageCallback("", defaultMessageCallback);

Binary file not shown.

Binary file not shown.

112
common/client/messagebox.cs Normal file
View File

@ -0,0 +1,112 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
function MessageCallback(%dlg,%callback)
{
Canvas.popDialog(%dlg);
eval(%callback);
}
// MBSetText resizes the message window, based on the change in size of the text
// area.
function MBSetText(%text, %frame, %msg)
{
%ext = %text.getExtent();
%text.setText("<just:center>" @ %msg);
%text.forceReflow();
%newExtent = %text.getExtent();
%deltaY = getWord(%newExtent, 1) - getWord(%ext, 1);
%windowPos = %frame.getPosition();
%windowExt = %frame.getExtent();
%frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2), getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY);
}
//-----------------------------------------------------------------------------
// MessageBox OK
//-----------------------------------------------------------------------------
function MessageBoxOK( %title, %message, %callback )
{
MBOKFrame.setText( %title );
MBOKTitle.setText( "<just:center>" @ %title );
Canvas.pushDialog( MessageBoxOKDlg );
MBSetText(MBOKText, MBOKFrame, %message);
MessageBoxOKDlg.callback = %callback;
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox OK/Cancel dialog:
//------------------------------------------------------------------------------
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
{
MBOKCancelFrame.setText( %title );
MBOKCancelTitle.setText( "<just:center>" @ %title );
Canvas.pushDialog( MessageBoxOKCancelDlg );
MBSetText(MBOKCancelText, MBOKCancelFrame, %message);
MessageBoxOKCancelDlg.callback = %callback;
MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox Yes/No dialog:
//------------------------------------------------------------------------------
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
{
MBYesNoFrame.setText( %title );
Canvas.pushDialog( MessageBoxYesNoDlg );
MBSetText(MBYesNoText, MBYesNoFrame, %message);
MessageBoxYesNoDlg.yesCallBack = %yesCallback;
MessageBoxYesNoDlg.noCallback = %noCallBack;
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onSleep( %this )
{
%this.yesCallback = "";
%this.noCallback = "";
}
//------------------------------------------------------------------------------
// Message popup dialog:
//------------------------------------------------------------------------------
function MessagePopup( %title, %message, %delay )
{
// Currently two lines max.
MessagePopFrame.setText( %title );
Canvas.pushDialog( MessagePopupDlg );
MBSetText(MessagePopText, MessagePopFrame, %message);
if ( %delay !$= "" )
schedule( %delay, 0, CloseMessagePopup );
}
//------------------------------------------------------------------------------
function CloseMessagePopup()
{
Canvas.popDialog( MessagePopupDlg );
}

179
common/client/metrics.cs Normal file
View File

@ -0,0 +1,179 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
// load gui used to display various metric outputs
exec("~/ui/FrameOverlayGui.gui");
function fpsMetricsCallback()
{
return " FPS: " @ $fps::real @
" mspf: " @ 1000 / $fps::real;
}
function terrainMetricsCallback()
{
return fpsMetricsCallback() @
" Terrain -" @
" L0: " @ $T2::levelZeroCount @
" FMC: " @ $T2::fullMipCount @
" DTC: " @ $T2::dynamicTextureCount @
" UNU: " @ $T2::unusedTextureCount @
" STC: " @ $T2::staticTextureCount @
" DTSU: " @ $T2::textureSpaceUsed @
" STSU: " @ $T2::staticTSU @
" FRB: " @ $T2::FogRejections;
}
function videoMetricsCallback()
{
return fpsMetricsCallback() @
" Video -" @
" TC: " @ $OpenGL::triCount0 + $OpenGL::triCount1 + $OpenGL::triCount2 + $OpenGL::triCount3 @
" PC: " @ $OpenGL::primCount0 + $OpenGL::primCount1 + $OpenGL::primCount2 + $OpenGL::primCount3 @
" T_T: " @ $OpenGL::triCount1 @
" T_P: " @ $OpenGL::primCount1 @
" I_T: " @ $OpenGL::triCount2 @
" I_P: " @ $OpenGL::primCount2 @
" TS_T: " @ $OpenGL::triCount3 @
" TS_P: " @ $OpenGL::primCount3 @
" ?_T: " @ $OpenGL::triCount0 @
" ?_P: " @ $OpenGL::primCount0;
}
function interiorMetricsCallback()
{
return fpsMetricsCallback() @
" Interior --" @
" NTL: " @ $Video::numTexelsLoaded @
" TRP: " @ $Video::texResidentPercentage @
" INP: " @ $Metrics::Interior::numPrimitives @
" INT: " @ $Matrics::Interior::numTexturesUsed @
" INO: " @ $Metrics::Interior::numInteriors;
}
function textureMetricsCallback()
{
return fpsMetricsCallback() @
" Texture --"@
" NTL: " @ $Video::numTexelsLoaded @
" TRP: " @ $Video::texResidentPercentage @
" TCM: " @ $Video::textureCacheMisses;
}
function waterMetricsCallback()
{
return fpsMetricsCallback() @
" Water --"@
" Tri#: " @ $T2::waterTriCount @
" Pnt#: " @ $T2::waterPointCount @
" Hz#: " @ $T2::waterHazePointCount;
}
function timeMetricsCallback()
{
return fpsMetricsCallback() @
" Time -- " @
" Sim Time: " @ getSimTime() @
" Mod: " @ getSimTime() % 32;
}
function vehicleMetricsCallback()
{
return fpsMetricsCallback() @
" Vehicle --"@
" R: " @ $Vehicle::retryCount @
" C: " @ $Vehicle::searchCount @
" P: " @ $Vehicle::polyCount @
" V: " @ $Vehicle::vertexCount;
}
function audioMetricsCallback()
{
return fpsMetricsCallback() @
" Audio --"@
" OH: " @ $Audio::numOpenHandles @
" OLH: " @ $Audio::numOpenLoopingHandles @
" AS: " @ $Audio::numActiveStreams @
" NAS: " @ $Audio::numNullActiveStreams @
" LAS: " @ $Audio::numActiveLoopingStreams @
" LS: " @ $Audio::numLoopingStreams @
" ILS: " @ $Audio::numInactiveLoopingStreams @
" CLS: " @ $Audio::numCulledLoopingStreams;
}
function debugMetricsCallback()
{
return fpsMetricsCallback() @
" Debug --"@
" NTL: " @ $Video::numTexelsLoaded @
" TRP: " @ $Video::texResidentPercentage @
" NP: " @ $Metrics::numPrimitives @
" NT: " @ $Metrics::numTexturesUsed @
" NO: " @ $Metrics::numObjectsRendered;
}
function marbleCallback()
{
return $testCount @ " V: " @ $MarbleVelocity @ " A: " @ $MarbleA @ " O: " @ $MarbleO @ " AR: " @ $Marbleal;
}
package Metrics
{
function onFrameAdvance(%time)
{
Parent::onFrameAdvance(%time);
if(TextOverlayControl.callback !$= "")
{
eval("$frameVal = " @ TextOverlayControl.callback @ ";");
TextOverlayControl.setText($frameVal);
}
}
};
activatePackage(Metrics);
function metrics(%expr)
{
switch$(%expr)
{
case "audio": %cb = "audioMetricsCallback()";
case "debug": %cb = "debugMetricsCallback()";
case "interior":
$fps::virtual = 0;
$Interior::numPolys = 0;
$Interior::numTextures = 0;
$Interior::numTexels = 0;
$Interior::numLightmaps = 0;
$Interior::numLumels = 0;
%cb = "interiorMetricsCallback()";
case "fps": %cb = "fpsMetricsCallback()";
case "time": %cb = "timeMetricsCallback()";
case "terrain": %cb = "terrainMetricsCallback()";
case "texture":
GLEnableMetrics(true);
%cb = "textureMetricsCallback()";
case "marble": %cb = "marbleCallback()";
case "video": %cb = "videoMetricsCallback()";
case "vehicle": %cb = "vehicleMetricsCallback()";
case "water": %cb = "waterMetricsCallback()";
}
if (%cb !$= "")
{
Canvas.pushDialog(FrameOverlayGui, 1000);
TextOverlayControl.callback = %cb;
}
else
{
GLEnableMetrics(false);
Canvas.popDialog(FrameOverlayGui);
}
}

Binary file not shown.

28
common/client/mission.cs Normal file
View File

@ -0,0 +1,28 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Mission start / end events sent from the server
//----------------------------------------------------------------------------
function clientCmdMissionStart(%seq)
{
// The client recieves a mission start right before
// being dropped into the game.
}
function clientCmdMissionEnd(%seq)
{
// Recieved when the current mission is ended.
//alxStopAll();
// Disable mission lighting if it's going, this is here
// in case the mission ends while we are in the process
// of loading it.
$lightingMission = false;
$sceneLighting::terminateLighting = true;
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,95 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Mission Loading
// Server download handshaking. This produces a number of onPhaseX
// calls so the game scripts can update the game's GUI.
//
// Loading Phases:
// Phase 1: Download Datablocks
// Phase 2: Download Ghost Objects
// Phase 3: Scene Lighting
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Phase 1
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase1(%seq, %missionName, %musicTrack)
{
// These need to come after the cls.
echo ("*** New Mission: " @ %missionName);
echo ("*** Phase 1: Download Datablocks & Targets");
onMissionDownloadPhase1(%missionName, %musicTrack);
commandToServer('MissionStartPhase1Ack', %seq);
}
function onDataBlockObjectReceived(%index, %total)
{
onPhase1Progress(%index / %total);
}
//----------------------------------------------------------------------------
// Phase 2
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase2(%seq,%missionName)
{
onPhase1Complete();
echo ("*** Phase 2: Download Ghost Objects");
purgeResources();
onMissionDownloadPhase2(%missionName);
commandToServer('MissionStartPhase2Ack', %seq);
}
function onGhostAlwaysStarted(%ghostCount)
{
$ghostCount = %ghostCount;
$ghostsRecvd = 0;
}
function onGhostAlwaysObjectReceived()
{
$ghostsRecvd++;
onPhase2Progress($ghostsRecvd / $ghostCount);
}
//----------------------------------------------------------------------------
// Phase 3
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase3(%seq,%missionName)
{
onPhase2Complete();
echo ("*** Phase 3: Mission Lighting");
$MSeq = %seq;
$Client::MissionFile = %missionName;
onMissionDownloadPhase3(%missionName);
onPhase3Complete();
// The is also the end of the mission load cycle.
onMissionDownloadComplete();
commandToServer('MissionStartPhase3Ack', $MSeq);
}
function updateLightingProgress()
{
onPhase3Progress($SceneLighting::lightingProgress);
if ($lightingMission)
$lightingProgressThread = schedule(1, 0, "updateLightingProgress");
}
function sceneLightingComplete()
{
echo("Mission lighting done");
onPhase3Complete();
// The is also the end of the mission load cycle.
onMissionDownloadComplete();
commandToServer('MissionStartPhase3Ack', $MSeq);
}

139
common/client/prefs.cs Normal file
View File

@ -0,0 +1,139 @@
$pref::Audio::channelVolume1 = "1";
$pref::Audio::channelVolume2 = "0.527897";
$pref::Audio::channelVolume3 = 0.8;
$pref::Audio::channelVolume4 = 0.8;
$pref::Audio::channelVolume5 = 0.8;
$pref::Audio::channelVolume6 = 0.8;
$pref::Audio::channelVolume7 = 0.8;
$pref::Audio::channelVolume8 = 0.8;
$pref::Audio::driver = "OpenAL";
$pref::Audio::environmentEnabled = 0;
$pref::Audio::forceMaxDistanceUpdate = 0;
$pref::Audio::masterVolume = 1;
$pref::backgroundSleepTime = "3000";
$pref::ChatHudLength = 1;
$pref::checkMOTDAndVersion = "1";
$pref::CloudOutline = "0";
$pref::CloudsOn = "1";
$pref::CurrentMOTD = "\n<html>\n<head><title>404 Not Found</title></head>\n<body>\n<h1>404 Not Found</h1>\n<ul>\n<li>Code: NoSuchKey</li>\n<li>Message: The specified key does not exist.</li>\n<li>Key: marbleblast/motd.html</li>\n<li>RequestId: C1QDCJ0XZ5P6PB6T</li>\n<li>HostId: eFdeXR0iBuB8A/crri0Mzy0sBNwmz47vywEaKd1HplI4nfsX1470/p4E2XtRdv4Nu+wY7enwDvE=</li>\n</ul>\n<hr/>\n</body>\n</html>";
$pref::Decal::decalTimeout = "5000";
$pref::Decal::maxNumDecals = "256";
$pref::decalsOn = "1";
$pref::Editor::visibleDistance = "2100";
$pref::enableBadWordFilter = "1";
$pref::environmentMaps = "1";
$pref::HudMessageLogSize = 40;
$pref::Input::AlwaysFreeLook = 0;
$pref::Input::InvertYAxis = 0;
$pref::Input::JoystickEnabled = "0";
$pref::Input::KeyboardEnabled = "1";
$pref::Input::KeyboardTurnSpeed = 0.025;
$pref::Input::LinkMouseSensitivity = 1;
$pref::Input::MouseEnabled = "1";
$pref::Input::MouseSensitivity = "0.75";
$pref::Interior::detailAdjust = "1";
$pref::Interior::DynamicLights = "1";
$pref::Interior::LightUpdatePeriod = "66";
$pref::Interior::lockArrays = "1";
$pref::Interior::sgDetailMaps = "1";
$pref::Interior::ShowEnvironmentMaps = "1";
$pref::Interior::TexturedFog = "0";
$pref::Interior::VertexLighting = "0";
$pref::LastReadMOTD = "\n<html>\n<head><title>404 Not Found</title></head>\n<body>\n<h1>404 Not Found</h1>\n<ul>\n<li>Code: NoSuchKey</li>\n<li>Message: The specified key does not exist.</li>\n<li>Key: marbleblast/motd.html</li>\n<li>RequestId: DXX6MJ35NJ7F8493</li>\n<li>HostId: f2+MV1j62/Iw34FscUbM/lSi8FtWzOp7ubIWBSeL+ira/VP32FY9Kqm9oHFijEwLj+kK3qPMGzM=</li>\n</ul>\n<hr/>\n</body>\n</html>";
$pref::LightManager::sgBlendedTerrainDynamicLighting = "1";
$pref::LightManager::sgDynamicLightingOcclusionQuality = "3";
$pref::LightManager::sgDynamicParticleSystemLighting = "1";
$pref::LightManager::sgDynamicShadowQuality = "0";
$pref::LightManager::sgLightingProfileAllowShadows = "1";
$pref::LightManager::sgLightingProfileQuality = "0";
$pref::LightManager::sgMaxBestLights = "10";
$pref::LightManager::sgMultipleDynamicShadows = "1";
$pref::LightManager::sgUseDynamicShadows = "1";
$pref::Master0 = "2:master.garagegames.com:28002";
$Pref::Net::LagThreshold = "400";
$pref::Net::PacketRateToClient = "10";
$pref::Net::PacketRateToServer = "32";
$pref::Net::PacketSize = "200";
$pref::NumCloudLayers = "3";
$pref::OpenGL::allowCompression = "0";
$pref::OpenGL::allowTexGen = "1";
$pref::OpenGL::disableARBMultitexture = "0";
$pref::OpenGL::disableARBTextureCompression = "0";
$pref::OpenGL::disableEXTCompiledVertexArray = "0";
$pref::OpenGL::disableEXTFogCoord = "0";
$pref::OpenGL::disableEXTPalettedTexture = "0";
$pref::OpenGL::disableEXTTexEnvCombine = "0";
$pref::OpenGL::disableSubImage = "0";
$pref::OpenGL::force16BitTexture = "0";
$pref::OpenGL::forcePalettedTexture = "0";
$pref::OpenGL::gammaCorrection = "0.5";
$pref::OpenGL::maxHardwareLights = 3;
$pref::OpenGL::noDrawArraysAlpha = "0";
$pref::OpenGL::noEnvColor = "0";
$pref::OpenGL::textureAnisotropy = "0";
$pref::OpenGL::textureTrilinear = "0";
$pref::Player::defaultFov = 90;
$pref::Player::Name = "Test Guy";
$pref::Player::renderMyItems = "1";
$pref::Player::renderMyPlayer = "1";
$pref::Player::zoomSpeed = 0;
$pref::QualifiedLevelAdvanced = 1;
$pref::QualifiedLevelBeginner = 1;
$pref::QualifiedLevelCustom = 1000;
$pref::QualifiedLevelIntermediate = 1;
$Pref::ResourceManager::excludedDirectories = ".svn;CVS";
$pref::sceneLighting::cacheLighting = 1;
$pref::sceneLighting::cacheSize = 20000;
$pref::sceneLighting::purgeMethod = "lastCreated";
$pref::sceneLighting::terrainGenerateLevel = 1;
$Pref::Server::AdminPassword = "";
$Pref::Server::BanTime = 1800;
$Pref::Server::ConnectionError = "ERROR";
$Pref::Server::FloodProtectionEnabled = 1;
$Pref::Server::Info = "This is a Torque Game Engine Test Server.";
$Pref::Server::KickBanTime = 300;
$Pref::Server::MaxChatLen = 120;
$Pref::Server::MaxPlayers = 64;
$Pref::Server::Name = "Torque Test Server";
$Pref::Server::Password = "";
$Pref::Server::Port = 28000;
$Pref::Server::RegionMask = 2;
$Pref::Server::TimeLimit = 20;
$pref::shadows = "2";
$pref::SkyOn = "1";
$pref::Terrain::dynamicLights = "1";
$pref::Terrain::enableDetails = "1";
$pref::Terrain::enableEmbossBumps = "1";
$pref::Terrain::screenError = "4";
$pref::Terrain::texDetail = "0";
$pref::Terrain::textureCacheSize = "512";
$pref::timeManagerProcessInterval = "0";
$pref::TS::autoDetail = "1";
$pref::TS::detailAdjust = "1";
$pref::TS::fogTexture = "0";
$pref::TS::screenError = "5";
$pref::TS::skipFirstFog = "0";
$pref::TS::skipLoadDLs = "0";
$pref::TS::skipRenderDLs = "0";
$pref::TS::UseTriangles = "0";
$Pref::Unix::OpenALFrequency = 44100;
$pref::useStencilShadows = 0;
$pref::Video::allowD3D = "1";
$pref::Video::allowOpenGL = "1";
$pref::Video::appliedPref = "1";
$pref::Video::clipHigh = "0";
$pref::Video::defaultsRenderer = "NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2";
$pref::Video::defaultsVendor = "NVIDIA Corporation";
$pref::Video::deleteContext = "1";
$pref::Video::disableVerticalSync = 1;
$pref::Video::displayDevice = "OpenGL";
$pref::Video::fullScreen = "0";
$pref::Video::monitorNum = 0;
$pref::Video::only16 = "0";
$pref::Video::preferOpenGL = "1";
$pref::Video::profiledRenderer = "NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2";
$pref::Video::profiledVendor = "NVIDIA Corporation";
$pref::Video::resolution = "1024 768 32";
$pref::Video::safeModeOn = "1";
$pref::Video::windowedRes = "800 600";
$pref::visibleDistanceMod = "1";

View File

@ -0,0 +1,58 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
function formatImageNumber(%number)
{
if(%number < 10)
%number = "0" @ %number;
if(%number < 100)
%number = "0" @ %number;
if(%number < 1000)
%number = "0" @ %number;
if(%number < 10000)
%number = "0" @ %number;
return %number;
}
//----------------------------------------
function recordMovie(%movieName, %fps)
{
$timeAdvance = 1000 / %fps;
$screenGrabThread = schedule("movieGrabScreen(" @ %movieName @ ", 0);", $timeAdvance);
}
function movieGrabScreen(%movieName, %frameNumber)
{
screenshot(%movieName @ formatImageNumber(%frameNumber) @ ".png");
$screenGrabThread = schedule("movieGrabScreen(" @ %movieName @ "," @ %frameNumber + 1 @ ");", $timeAdvance);
}
function stopMovie()
{
cancel($screenGrabThread);
}
//----------------------------------------
$screenshotNumber = 0;
function doScreenShot( %val )
{
if (%val)
{
$pref::interior::showdetailmaps = false;
screenShot("screenshot_" @ formatImageNumber($screenshotNumber++) @ ".png");
}
}
// bind key to take screenshots
GlobalActionMap.bind(keyboard, "ctrl p", doScreenShot);
GlobalActionMap.bindCmd(keyboard, "ctrl l", "", "doMiniShot();");

Binary file not shown.

0
common/debugger/_ Normal file
View File

26
common/editor/CVS/Entries Normal file
View File

@ -0,0 +1,26 @@
/AIEButtonBarDlg.gui/2.1/Wed Apr 21 04:27:34 2004//
/AIEFrameSetDlg.gui/2.1/Wed Apr 21 04:27:34 2004//
/AIEWorkingDlg.gui/2.1/Wed Apr 21 04:27:34 2004//
/AIEditorGui.gui/2.1/Wed Apr 21 04:27:34 2004//
/AIEditorToolBar.gui/2.1/Wed Apr 21 04:27:34 2004//
/CUR_3darrow.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_3ddiagleft.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_3ddiagright.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_3dleftright.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_3dupdown.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_grab.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_hand.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/CUR_rotate.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/DefaultHandle.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/EditorGui.cs/2.1/Wed Apr 21 04:27:34 2004//
/EditorGui.gui/2.1/Wed Apr 21 04:27:34 2004//
/LockedHandle.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/SelectHandle.png/2.1/Wed Apr 21 04:27:34 2004/-kb/
/TerrainEditorVSettingsGui.gui/2.1/Wed Apr 21 04:27:34 2004//
/WorldEditorSettingsDlg.gui/2.1/Wed Apr 21 04:27:34 2004//
/cursors.cs/2.1/Wed Apr 21 04:27:34 2004//
/editor.bind.cs/2.1/Wed Apr 21 04:27:34 2004//
/editor.cs/2.1/Wed Apr 21 04:27:34 2004//
/editorRender.cs/2.1/Wed Apr 21 04:27:34 2004//
/objectBuilderGui.gui/2.1/Wed Apr 21 04:27:34 2004//
D

View File

@ -0,0 +1,25 @@
/AIEButtonBarDlg.gui///
/AIEFrameSetDlg.gui///
/AIEWorkingDlg.gui///
/AIEditorGui.gui///
/AIEditorToolBar.gui///
/CUR_3darrow.png///
/CUR_3ddiagleft.png///
/CUR_3ddiagright.png///
/CUR_3dleftright.png///
/CUR_3dupdown.png///
/CUR_grab.png///
/CUR_hand.png///
/CUR_rotate.png///
/DefaultHandle.png///
/EditorGui.cs///
/EditorGui.gui///
/LockedHandle.png///
/SelectHandle.png///
/TerrainEditorVSettingsGui.gui///
/WorldEditorSettingsDlg.gui///
/cursors.cs///
/editor.bind.cs///
/editor.cs///
/editorRender.cs///
/objectBuilderGui.gui///

View File

@ -0,0 +1 @@
torque/example/common/editor

1
common/editor/CVS/Root Normal file
View File

@ -0,0 +1 @@
:pserver;proxy=210.26.112.136;proxyport=8080:norman@cvs.garagegames.com:/cvs/torque

Binary file not shown.

3387
common/editor/EditorGui.gui Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,272 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(TerrainEditorValuesSettingsGui) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "117 113";
extent = "408 247";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Terrain Action Values";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "Canvas.popDIalog(TerrainEditorValuesSettingsGui);";
new GuiControl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "198 27";
extent = "203 115";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "86 12";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "ETerrainEditor.adjustHeightVal";
command = "ETerrainEditor.adjustHeightVal = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "86 37";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "ETerrainEditor.setHeightVal";
command = "ETerrainEditor.setHeightVal = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "86 62";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "ETerrainEditor.scaleVal";
command = "ETerrainEditor.scaleVal = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "86 87";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "ETerrainEditor.smoothFactor";
command = "ETerrainEditor.smoothFactor = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "11 12";
extent = "64 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Adjust Height";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "11 37";
extent = "49 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Set Height";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "11 62";
extent = "60 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Scale Height";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 87";
extent = "70 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Smooth Factor";
maxLength = "255";
};
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "218 205";
extent = "80 20";
minExtent = "8 8";
visible = "1";
command = "Canvas.popDIalog(TerrainEditorValuesSettingsGui);";
helpTag = "0";
text = "OK";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiControl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "7 27";
extent = "188 212";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiFilterCtrl(TESoftSelectFilter) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "20 22";
extent = "155 162";
minExtent = "8 8";
visible = "1";
helpTag = "0";
controlPoints = "7";
filter = "1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "6 4";
extent = "67 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Soft Selection";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 189";
extent = "8 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "0";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 26";
extent = "8 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "1";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "60 190";
extent = "45 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "<Radius>";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "125 187";
extent = "50 18";
minExtent = "8 8";
visible = "1";
variable = "ETerrainEditor.softSelectRadius";
command = "ETerrainEditor.softSelectRadius = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
};
new GuiButtonCtrl(TESettingsApplyButton) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "307 205";
extent = "80 20";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Apply";
groupNum = "-1";
buttonType = "PushButton";
};
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

View File

@ -0,0 +1,620 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(WorldEditorSettingsDlg) {
profile = "GuiModelessDialogProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "90 55";
extent = "459 370";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "WorldEditor Settings";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "Canvas.popDialog(WorldEditorSettingsDlg);";
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "307 332";
extent = "80 20";
minExtent = "8 8";
visible = "1";
command = "Canvas.popDialog(WorldEditorSettingsDlg);";
helpTag = "0";
text = "OK";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiControl(WESettingsGeneralTab) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "231 27";
extent = "220 210";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 10";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.planarMovement";
command = "EWorldEditor.planarMovement = $ThisControl.getValue();";
helpTag = "0";
text = "Planar Movement";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 36";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.boundingBoxCollision";
command = "EWorldEditor.boundingBoxCollision = $ThisControl.getValue();";
helpTag = "0";
text = "Collide With Object\'s Bounding Box";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 88";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.axisGizmoActive";
command = "EWorldEditor.axisGizmoActive = $ThisControl.getValue();";
helpTag = "0";
text = "Axis Gizmo Active";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 62";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.objectsUseBoxCenter";
command = "EWorldEditor.objectsUseBoxCenter = $ThisControl.getValue();";
helpTag = "0";
text = "Objects Use Box Center";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 123";
extent = "83 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Min Scale Factor:";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 146";
extent = "83 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Min Scale Factor:";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "104 123";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.minScaleFactor";
command = "EWorldEditor.minScaleFactor = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "104 146";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.maxScaleFactor";
command = "EWorldEditor.maxScaleFactor = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 178";
extent = "80 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Visible Distance:";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "104 178";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "pref::Editor::visibleDistance";
command = "$pref::Editor::visibleDistance = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
};
new GuiControl(WESettingsDisplayTab) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "7 27";
extent = "220 210";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 10";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.renderPlane";
command = "EWorldEditor.renderPlane = $ThisControl.getValue();";
helpTag = "0";
text = "Render Plane";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 37";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.renderPlaneHashes";
command = "EWorldEditor.renderPlaneHashes = $ThisControl.getValue();";
helpTag = "0";
text = "Render Plane Hashes";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 64";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.renderObjText";
command = "EWorldEditor.renderObjText = $ThisControl.getValue();";
helpTag = "0";
text = "Render Object Text";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 119";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.renderSelectionBox";
command = "EWorldEditor.renderSelectionBox = $ThisControl.getValue();";
helpTag = "0";
text = "Render Selection Box";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "93 151";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.planeDim";
command = "EWorldEditor.planeDim = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "18 151";
extent = "59 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Plane Extent";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "18 175";
extent = "44 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Grid Size";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "93 175";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.gridSize";
command = "EWorldEditor.gridSize = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 90";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.renderObjHandle";
command = "EWorldEditor.renderObjHandle = $ThisControl.getValue();";
helpTag = "0";
text = "Render Object Handle";
groupNum = "-1";
buttonType = "ToggleButton";
};
};
new GuiControl(WESettingsSnapTab) {
profile = "GuiContentProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "6 52";
extent = "220 210";
minExtent = "8 8";
visible = "0";
helpTag = "0";
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "22 39";
extent = "44 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Grid Size";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "97 39";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.gridSize";
command = "EWorldEditor.gridSize = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 10";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.snapToGrid";
command = "EWorldEditor.snapToGrid = $ThisControl.getValue();";
helpTag = "0";
text = "Snap To Grid";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 66";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.snapRotations";
command = "EWorldEditor.snapRotations = $ThisControl.getValue();";
helpTag = "0";
text = "Snap Rotations";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "22 95";
extent = "56 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Snap Angle";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "97 95";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.rotationSnap";
command = "EWorldEditor.rotationSnap = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
};
new GuiControl(WESettingsMouseTab) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "7 241";
extent = "220 121";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 10";
extent = "200 24";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.showMousePopupInfo";
command = "EWorldEditor.showMousePopupInfo = $ThisControl.getValue();";
helpTag = "0";
text = "Show Mouse Popup Info";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "101 35";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.mouseMoveScale";
command = "EWorldEditor.mouseMoveScale = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "101 60";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.mouseRotateScale";
command = "EWorldEditor.mouseRotateScale = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "101 85";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.mouseScaleScale";
command = "EWorldEditor.mouseScaleScale = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 60";
extent = "61 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Rotate Scale";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 85";
extent = "57 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Scale Scale";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 35";
extent = "56 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Move Scale";
maxLength = "255";
};
};
new GuiControl(WESettingsMiscTab) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "231 241";
extent = "220 64";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 35";
extent = "78 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Project Distance";
maxLength = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 9";
extent = "89 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Gizmo Screen Len";
maxLength = "255";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "101 35";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.projectDistance";
command = "EWorldEditor.projectDistance = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "101 9";
extent = "107 18";
minExtent = "8 8";
visible = "1";
variable = "EWorldEditor.axisGizmoMaxScreenLen";
command = "EWorldEditor.axisGizmoMaxScreenLen = $ThisControl.getValue();";
helpTag = "0";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
};
};
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

BIN
common/editor/cur_grab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

BIN
common/editor/cur_hand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

63
common/editor/cursors.cs Normal file
View File

@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Editor Cursors
//------------------------------------------------------------------------------
new GuiCursor(EditorHandCursor)
{
hotSpot = "7 0";
bitmapName = "./CUR_hand.png";
};
new GuiCursor(EditorRotateCursor)
{
hotSpot = "11 18";
bitmapName = "./CUR_rotate.png";
};
new GuiCursor(EditorMoveCursor)
{
hotSpot = "9 13";
bitmapName = "./CUR_grab.png";
};
new GuiCursor(EditorArrowCursor)
{
hotSpot = "0 0";
bitmapName = "./CUR_3darrow.png";
};
new GuiCursor(EditorUpDownCursor)
{
hotSpot = "5 10";
bitmapName = "./CUR_3dupdown";
};
new GuiCursor(EditorLeftRightCursor)
{
hotSpot = "9 5";
bitmapName = "./CUR_3dleftright";
};
new GuiCursor(EditorDiagRightCursor)
{
hotSpot = "8 8";
bitmapName = "./CUR_3ddiagright";
};
new GuiCursor(EditorDiagLeftCursor)
{
hotSpot = "8 8";
bitmapName = "./CUR_3ddiagleft";
};
new GuiControl(EmptyControl)
{
profile = "GuiButtonProfile";
};

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -0,0 +1,116 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Mission Editor Manager
new ActionMap(EditorMap);
EditorMap.bindCmd(keyboard, "f2", "editor.setEditor(WorldEditor);", "");
EditorMap.bindCmd(keyboard, "f3", "editor.setEditor(TerrainEditor);", "");
EditorMap.bindCmd(keyboard, "f4", "editor.setEditor(Terraformer);", "");
EditorMap.bindCmd(keyboard, "f5", "editor.setEditor(AIEditor);", "");
EditorMap.bindCmd(keyboard, "alt s", "Canvas.pushDialog(EditorSaveMissionDlg);", "");
EditorMap.bindCmd(keyboard, "alt r", "lightScene(\"\", forceAlways);", "");
EditorMap.bindCmd(keyboard, "escape", "editor.close();", "");
// alt-#: set bookmark
for(%i = 0; %i < 9; %i++)
EditorMap.bindCmd(keyboard, "alt " @ %i, "editor.setBookmark(" @ %i @ ");", "");
// ctrl-#: goto bookmark
for(%i = 0; %i < 9; %i++)
EditorMap.bindCmd(keyboard, "ctrl " @ %i, "editor.gotoBookmark(" @ %i @ ");", "");
//------------------------------------------------------------------------------
// World Editor
new ActionMap(WorldEditorMap);
WorldEditorMap.bindCmd(keyboard, "space", "wEditor.nextMode();", "");
WorldEditorMap.bindCmd(keyboard, "delete", "wEditor.copySelection();wEditor.deleteSelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl c", "wEditor.copySelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl x", "wEditor.copySelection();wEditor.deleteSelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl v", "wEditor.pasteSelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl z", "wEditor.undo();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl y", "wEditor.redo();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl h", "wEditor.hideSelection(true);", "");
WorldEditorMap.bindCmd(keyboard, "alt h", "wEditor.hideSelection(false);", "");
WorldEditorMap.bindCmd(keyboard, "ctrl d", "wEditor.dropSelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl q", "wEditor.dropCameraToSelection();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl m", "wEditor.moveSelectionInPlace();", "");
WorldEditorMap.bindCmd(keyboard, "ctrl r", "wEditor.resetTransforms();", "");
WorldEditorMap.bindCmd(keyboard, "i", "Canvas.pushDialog(interiorDebugDialog);", "");
WorldEditorMap.bindCmd(keyboard, "o", "Canvas.pushDialog(WorldEditorSettingsDlg);", "");
//------------------------------------------------------------------------------
// Terrain Editor
new ActionMap(TerrainEditorMap);
TerrainEditorMap.bindCmd(keyboard, "ctrl z", "tEditor.undo();", "");
TerrainEditorMap.bindCmd(keyboard, "ctrl y", "tEditor.redo();", "");
TerrainEditorMap.bindCmd(keyboard, "left", "tEditor.offsetBrush(-1, 0);", "");
TerrainEditorMap.bindCmd(keyboard, "right", "tEditor.offsetBrush(1, 0);", "");
TerrainEditorMap.bindCmd(keyboard, "up", "tEditor.offsetBrush(0, 1);", "");
TerrainEditorMap.bindCmd(keyboard, "down", "tEditor.offsetBrush(0, -1);", "");
TerrainEditorMap.bindCmd(keyboard, "1", "TERaiseHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "2", "TELowerHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "3", "TESetHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "4", "TESetEmptyActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "5", "TEClearEmptyActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "6", "TEFlattenHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "7", "TESmoothHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "8", "TESetMaterialActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "9", "TEAdjustHeightActionRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "shift 1", "tEditor.processUsesBrush = true;TERaiseHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 2", "tEditor.processUsesBrush = true;TELowerHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 3", "tEditor.processUsesBrush = true;TESetHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 4", "tEditor.processUsesBrush = true;TESetEmptyActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 5", "tEditor.processUsesBrush = true;TEClearEmptyActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 6", "tEditor.processUsesBrush = true;TEFlattenHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 7", "tEditor.processUsesBrush = true;TESmoothHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 8", "tEditor.processUsesBrush = true;TESetMaterialActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "shift 9", "tEditor.processUsesBrush = true;TEAdjustHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", "");
TerrainEditorMap.bindCmd(keyboard, "h", "TESelectModeRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "j", "TEPaintModeRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "k", "TEAdjustModeRadio.setValue(1);", "");
TerrainEditorMap.bindCmd(keyboard, "i", "Canvas.pushDialog(interiorDebugDialog);", "");
TerrainEditorMap.bindCmd(keyboard, "o", "Canvas.pushDialog(TerrainEditorValuesSettingsGui, 99);", "");
TerrainEditorMap.bindCmd(keyboard, "m", "Canvas.pushDialog(TerrainEditorTextureSelectGui, 99);", "");
TerrainEditorMap.bindCmd(keyboard, "backspace", "tEditor.clearSelection();", "");
//------------------------------------------------------------------------------
// AI Editor
new ActionMap(AIEditorMap);
AIEditorMap.bindCmd(keyboard, "space", "aiEdit.nextMode();", "");
AIEditorMap.bindCmd(keyboard, "delete", "aiEdit.copySelection();aiEdit.deleteSelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl c", "aiEdit.copySelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl x", "aiEdit.copySelection();aiEdit.deleteSelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl v", "aiEdit.pasteSelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl h", "aiEdit.hideSelection(true);", "");
AIEditorMap.bindCmd(keyboard, "alt h", "aiEdit.hideSelection(false);", "");
AIEditorMap.bindCmd(keyboard, "ctrl d", "aiEdit.dropSelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl q", "aiEdit.dropCameraToSelection();", "");
AIEditorMap.bindCmd(keyboard, "ctrl m", "aiEdit.moveSelectionInPlace();", "");
AIEditorMap.bindCmd(keyboard, "ctrl r", "aiEdit.resetTransforms();", "");
AIEditorMap.bindCmd(keyboard, "i", "Canvas.pushDialog(interiorDebugDialog);", "");

Binary file not shown.

111
common/editor/editor.cs Normal file
View File

@ -0,0 +1,111 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Hard coded images referenced from C++ code
//------------------------------------------------------------------------------
// editor/SelectHandle.png
// editor/DefaultHandle.png
// editor/LockedHandle.png
//------------------------------------------------------------------------------
// Functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Mission Editor
//------------------------------------------------------------------------------
function Editor::create()
{
// Not much to do here, build it and they will come...
// Only one thing... the editor is a gui control which
// expect the Canvas to exist, so it must be constructed
// before the editor.
new EditManager(Editor)
{
profile = "GuiContentProfile";
horizSizing = "right";
vertSizing = "top";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
open = false;
};
}
function Editor::onAdd(%this)
{
// Basic stuff
exec("./cursors.cs");
// Tools
exec("./editor.bind.cs");
exec("./ObjectBuilderGui.gui");
// New World Editor
exec("./EditorGui.gui");
exec("./EditorGui.cs");
// World Editor
exec("./WorldEditorSettingsDlg.gui");
// Terrain Editor
exec("./TerrainEditorVSettingsGui.gui");
// do gui initialization...
EditorGui.init();
//
exec("./editorRender.cs");
}
function Editor::checkActiveLoadDone()
{
if(isObject(EditorGui) && EditorGui.loadingMission)
{
Canvas.setContent(EditorGui);
EditorGui.loadingMission = false;
return true;
}
return false;
}
//------------------------------------------------------------------------------
function toggleEditor(%make)
{
if (%make && $testCheats)
{
if (!$missionRunning)
{
MessageBoxOK("Mission Required", "You must load a mission before starting the Mission Editor.", "");
return;
}
if (!isObject(Editor))
{
Editor::create();
MissionCleanup.add(Editor);
}
if (Canvas.getContent() == EditorGui.getId())
Editor.close();
else
Editor.open();
}
}
//------------------------------------------------------------------------------
// The editor action maps are defined in editor.bind.cs
GlobalActionMap.bind(keyboard, "f11", toggleEditor);

BIN
common/editor/editor.cs.dso Normal file

Binary file not shown.

Binary file not shown.

2781
common/editor/editorgui.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Console onEditorRender functions:
//------------------------------------------------------------------------------
// Functions:
// - renderSphere([pos], [radius], <sphereLevel>);
// - renderCircle([pos], [normal], [radius], <segments>);
// - renderTriangle([pnt], [pnt], [pnt]);
// - renderLine([start], [end], <thickness>);
//
// Variables:
// - consoleFrameColor - line prims are rendered with this
// - consoleFillColor
// - consoleSphereLevel - level of polyhedron subdivision
// - consoleCircleSegments
// - consoleLineWidth
//------------------------------------------------------------------------------
function SpawnSphere::onEditorRender(%this, %editor, %selected, %expanded)
{
if(%selected $= "true")
{
%editor.consoleFrameColor = "255 0 0";
%editor.consoleFillColor = "0 0 0 0";
%editor.renderSphere(%this.getWorldBoxCenter(), %this.radius, 1);
}
}
function AudioEmitter::onEditorRender(%this, %editor, %selected, %expanded)
{
if(%selected $= "true" && %this.is3D && !%this.useProfileDescription)
{
%editor.consoleFillColor = "0 0 0 0";
%editor.consoleFrameColor = "255 0 0";
%editor.renderSphere(%this.getTransform(), %this.minDistance, 1);
%editor.consoleFrameColor = "0 0 255";
%editor.renderSphere(%this.getTransform(), %this.maxDistance, 1);
}
}
//function Item::onEditorRender(%this, %editor, %selected, %expanded)
//{
// if(%this.getDataBlock().getName() $= "MineDeployed")
// {
// %editor.consoleFillColor = "0 0 0 0";
// %editor.consoleFrameColor = "255 0 0";
// %editor.renderSphere(%this.getWorldBoxCenter(), 6, 1);
// }
//}

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

View File

@ -0,0 +1,650 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(ObjectBuilderGui) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
new GuiWindowCtrl(OBTargetWindow) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "217 74";
extent = "256 282";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
new GuiTextCtrl() {
profile = "GuiCenterTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 31";
extent = "84 25";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = "Object Name:";
};
new GuiTextEditCtrl(OBObjectName) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "105 31";
extent = "143 18";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
historySize = "0";
};
new GuiControl(OBContentWindow) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "8 56";
extent = "240 193";
minExtent = "0 0";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
};
new GuiButtonCtrl(OBOKButton) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "70 254";
extent = "80 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "ObjectBuilderGui.onOK();";
helpTag = "0";
text = "OK";
};
new GuiButtonCtrl(OBCancelButton) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "156 254";
extent = "80 20";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "ObjectBuilderGui.onCancel();";
helpTag = "0";
text = "Cancel";
};
};
};
//--- OBJECT WRITE END ---
function ObjectBuilderGui::init(%this)
{
%this.baseOffsetX = 9;
%this.baseOffsetY = 10;
%this.scriptFile = "editor/newObject.cs";
%this.defaultObjectName = "";
%this.defaultFieldStep = 26;
%this.columnOffset = 95;
%this.fieldNameExtent = "132 18";
%this.textEditExtent = "127 18";
%this.checkBoxExtent = "18 18";
%this.popupMenuExtent = "127 18";
%this.fileButtonExtent = "127 18";
//
%this.numControls = 0;
%this.reset();
}
function ObjectBuilderGui::reset(%this)
{
%this.curXPos = %this.baseOffsetX;
%this.curYPos = %this.baseOffsetY;
%this.createCallback = "";
%this.currentControl = 0;
//
OBObjectName.setValue(%this.defaultObjectName);
//
%this.newObject = 0;
%this.className = "";
%this.numFields = 0;
//
for(%i = 0; %i < %this.numControls; %i++)
{
%this.textControls[%i].delete();
%this.controls[%i].delete();
}
%this.numControls = 0;
}
//------------------------------------------------------------------------------
function ObjectBuilderGui::createFileType(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::createFileType: invalid field");
return;
}
//
if(%this.field[%index, text] $= "")
%name = %this.field[%index, name];
else
%name = %this.field[%index, text];
//
%this.textControls[%this.numControls] = new GuiTextCtrl() {
profile = "GuiTextProfile";
text = %name;
extent = %this.fieldNameExtent;
position = %this.curXPos @ " " @ %this.curYPos;
modal = "1";
};
//
%this.controls[%this.numControls] = new GuiButtonCtrl() {
profile = "GuiButtonProfile";
extent = %this.fileButtonExtent;
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
modal = "1";
command = %this @ ".getFileName(" @ %index @ ");";
};
%val = %this.field[%index, value];
%this.controls[%this.numControls].setValue(fileBase(%val) @ fileExt(%val));
%this.numControls++;
%this.curYPos += %this.defaultFieldStep;
}
function ObjectBuilderGui::getFileName(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::getFileName: invalid field");
return;
}
%val = %this.field[%index, value];
%path = filePath(%val);
%ext = fileExt(%val);
%this.currentControl = %index;
getLoadFilename(%path @ "*" @ %ext, %this @ ".gotFileName");
}
function ObjectBuilderGui::gotFileName(%this, %name)
{
%this.controls[%this.currentControl].setValue(%name);
}
//------------------------------------------------------------------------------
function ObjectBuilderGui::createDataBlockType(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::createDataBlockType: invalid field");
return;
}
//
if(%this.field[%index, text] $= "")
%name = %this.field[%index, name];
else
%name = %this.field[%index, text];
//
%this.textControls[%this.numControls] = new GuiTextCtrl() {
profile = "GuiTextProfile";
text = %name;
extent = %this.fieldNameExtent;
position = %this.curXPos @ " " @ %this.curYPos;
modal = "1";
};
//
%this.controls[%this.numControls] = new GuiPopupMenuCtrl() {
profile = "GuiPopUpMenuProfile";
extent = %this.popupMenuExtent;
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
modal = "1";
maxPopupHeight = "200";
};
%classname = getWord(%this.field[%index, value], 0);
%this.controls[%this.numControls].add("", -1);
// add the datablocks
for(%i = 0; %i < DataBlockGroup.getCount(); %i++)
{
%obj = DataBlockGroup.getObject(%i);
if(%obj.getClassName() $= %classname)
%this.controls[%this.numControls].add(%obj.getName(), %i);
}
%this.controls[%this.numControls].setValue(getWord(%this.field[%index, value], 1));
%this.numControls++;
%this.curYPos += %this.defaultFieldStep;
}
function ObjectBuilderGui::createBoolType(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::createBoolType: invalid field");
return;
}
//
if(%this.field[%index, value] $= "")
%value = 0;
else
%value = %this.field[%index, value];
//
if(%this.field[%index, text] $= "")
%name = %this.field[%index, name];
else
%name = %this.field[%index, text];
//
%this.textControls[%this.numControls] = new GuiTextCtrl() {
profile = "GuiTextProfile";
text = %name;
extent = %this.fieldNameExtent;
position = %this.curXPos @ " " @ %this.curYPos;
modal = "1";
};
//
%this.controls[%this.numControls] = new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
extent = %this.checkBoxExtent;
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
modal = "1";
};
%this.controls[%this.numControls].setValue(%value);
%this.numControls++;
%this.curYPos += %this.defaultFieldStep;
}
function ObjectBuilderGui::createStringType(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::createStringType: invalid field");
return;
}
//
if(%this.field[%index, text] $= "")
%name = %this.field[%index, name];
else
%name = %this.field[%index, text];
//
%this.textControls[%this.numControls] = new GuiTextCtrl() {
profile = "GuiTextProfile";
text = %name;
extent = %this.fieldNameExtent;
position = %this.curXPos @ " " @ %this.curYPos;
modal = "1";
};
//
%this.controls[%this.numControls] = new GuiTextEditCtrl() {
profile = "GuiTextEditProfile";
extent = %this.textEditExtent;
text = %this.field[%index, value];
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
modal = "1";
};
%this.numControls++;
%this.curYPos += %this.defaultFieldStep;
}
//------------------------------------------------------------------------------
function ObjectBuilderGui::adjustSizes(%this)
{
if(%this.numControls == 0)
%this.curYPos = 0;
OBTargetWindow.extent = "256 " @ %this.curYPos + 88;
OBContentWindow.extent = "240 " @ %this.curYPos;
OBOKButton.position = "70 " @ %this.curYPos + 62;
OBCancelButton.position = "156 " @ %this.curYPos + 62;
}
function ObjectBuilderGui::process(%this)
{
if(%this.className $= "")
{
error("ObjectBuilderGui::process: classname is not specified");
return;
}
OBTargetWindow.setValue("Building Object: " @ %this.className);
//
for(%i = 0; %i < %this.numFields; %i++)
{
switch$(%this.field[%i, type])
{
case "TypeBool":
%this.createBoolType(%i);
case "TypeDataBlock":
%this.createDataBlockType(%i);
case "TypeFile":
%this.createFileType(%i);
default:
%this.createStringType(%i);
}
}
// add the controls
for(%i = 0; %i < %this.numControls; %i++)
{
OBContentWindow.add(%this.textControls[%i]);
OBContentWindow.add(%this.controls[%i]);
}
//
%this.adjustSizes();
//
Canvas.pushDialog(%this);
}
function ObjectBuilderGui::processNewObject(%this, %obj)
{
if(%this.createCallback !$= "")
eval(%this.createCallback);
if(!isObject(EWorldEditor))
return;
$InstantGroup.add(%obj);
EWorldEditor.clearSelection();
EWorldEditor.selectObject(%obj);
EWorldEditor.dropSelection();
}
function ObjectBuilderGui::onOK(%this)
{
// get current values
for(%i = 0; %i < %this.numControls; %i++)
%this.field[%i, value] = %this.controls[%i].getValue();
//
%file = new FileObject();
%file.openForWrite(%this.scriptFile);
%file.writeLine(%this @ ".newObject = new " @ %this.className @ "(" @ OBObjectName.getValue() @ ") {");
for(%i = 0; %i < %this.numFields; %i++)
%file.writeLine(" " @ %this.field[%i, name] @ " = \"" @ %this.field[%i, value] @ "\";");
%file.writeLine("};");
%file.close();
%file.delete();
//
exec(%this.scriptFile);
if(%this.newObject != 0)
%this.processNewObject(%this.newObject);
%this.reset();
Canvas.popDialog(%this);
}
function ObjectBuilderGui::onCancel(%this)
{
%this.reset();
Canvas.popDialog(%this);
}
function ObjectBuilderGui::addField(%this, %name, %type, %text, %value)
{
%this.field[%this.numFields, name] = %name;
%this.field[%this.numFields, type] = %type;
%this.field[%this.numFields, text] = %text;
%this.field[%this.numFields, value] = %value;
%this.numFields++;
}
//------------------------------------------------------------------------------
// Environment
//------------------------------------------------------------------------------
function ObjectBuilderGui::buildSky(%this)
{
%this.className = "Sky";
%this.addField("materialList", "TypeFile", "Material list", "Lush_l4.dml");
%this.addField("cloudSpeed[0]", "TypePoint2", "Cloud0 Speed", "0.0000003 0.0000003");
%this.addField("cloudSpeed[1]", "TypePoint2", "Cloud1 Speed", "0.0000006 0.0000006");
%this.addField("cloudSpeed[2]", "TypePoint2", "Cloud2 Speed", "0.0000009 0.0000009");
%this.addField("cloudHeightPer[0]", "TypeFloat", "Cloud0 Height", "0.349971");
%this.addField("cloudHeightPer[1]", "TypeFloat", "Cloud1 Height", "0.25");
%this.addField("cloudHeightPer[2]", "TypeFloat", "Cloud2 Height", "0.199973");
%this.addField("visibleDistance", "TypeFloat", "Visible distance", "900");
%this.addField("fogDistance", "TypeFloat", "Fog distance", "600");
%this.addField("fogColor", "TypeColor", "Fog color", "0.5 0.5 0.5");
%this.addField("fogVolume1", "TypePoint3", "Fog volume", "120 0 100");
%this.addField("fogVolume2", "TypePoint3", "Fog volume", "0 0 0");
%this.addField("fogVolume3", "TypePoint3", "Fog volume", "0 0 0");
%this.process();
}
function ObjectBuilderGui::buildSun(%this)
{
%this.className = "Sun";
%this.addField("direction", "TypeVector", "Direction", "1 1 -1");
%this.addField("color", "TypeColor", "Sun color", "0.8 0.8 0.8");
%this.addField("ambient", "TypeColor", "Ambient color", "0.2 0.2 0.2");
%this.process();
}
function ObjectBuilderGui::buildLightning(%this)
{
%this.className = "Lightning";
%this.addField("dataBlock", "TypeDataBlock", "Data block", "LightningData DefaultStorm");
%this.process();
}
function ObjectBuilderGui::buildWater(%this)
{
%this.className = "WaterBlock";
// jff: this object needs some work!!
%this.addField("extent", "TypePoint3", "Extent", "100 100 10");
%this.addField("textureSize", "TypePoint2", "Texture size", "32 32");
%this.addField("params[0]", "TypePoint4", "Wave Param0", "0.32 -0.67 0.066 0.5");
%this.addField("params[1]", "TypePoint4", "Wave Param1", "0.63 -2.41 0.33 0.21");
%this.addField("params[2]", "TypePoint4", "Wave Param2", "0.39 0.39 0.2 0.133");
%this.addField("params[3]", "TypePoint4", "Wave Param3", "1.21 -0.61 0.13 -0.33");
%this.addField("floodFill", "TypeBool", "Flood fill?", "true");
%this.addField("seedPoints", "TypeString", "Seed points", "0 0 1 0 1 1 0 1");
%this.addField("surfaceTexture", "TypeString", "Surface Texture",
"fps/data/water/water");
%this.addField("envMapTexture", "TypeString", "Env Map Texture",
"fps/data/skies/sunset_0007");
%this.process();
}
function ObjectBuilderGui::buildTerrain(%this)
{
%this.className = "TerrainBlock";
%this.createCallback = "ETerrainEditor.attachTerrain();";
%this.addField("terrainFile", "TypeFile", "Terrain file", "terrains/terr1.ter");
%this.addField("squareSize", "TypeInt", "Square size", "8");
%this.process();
}
function ObjectBuilderGui::buildAudioEmitter(%this)
{
%this.className = "AudioEmitter";
%this.addField("profile", "TypeDataBlock", "Sound Profile", "AudioProfile");
%this.addField("description", "TypeDataBlock", "Sound Description", "AudioDescription");
%this.addField("fileName", "TypeFile", "Audio file", "");
%this.addField("useProfileDescription", "TypeBool", "Use profile's desc?", "false");
%this.addFIeld("volume", "TypeFloat", "Volume", "1.0");
%this.addField("isLooping", "TypeBool", "Looping?", "true");
%this.addField("is3D", "TypeBool", "Is 3D sound?", "true");
%this.addField("minDistance", "TypeFloat", "Min distance", "20.0");
%this.addField("maxDistance", "TypeFloat", "Max distance", "100.0");
%this.addField("coneInsideAngle", "TypeInt", "Cone inside angle", "360");
%this.addField("coneOutsideAngle", "TypeInt", "Cone outside angle", "360");
%this.addField("coneOutsideVolume", "TypeFloat", "Cone outside volume", "1.0");
%this.addField("coneVector", "TypePoint3", "Cone Vector", "0 0 1");
%this.addField("loopCount", "TypeInt", "Loop count", "-1");
%this.addField("minLoopGap", "TypeInt", "Min loop gap (ms)", "0");
%this.addField("maxLoopGap", "TypeInt", "Max loop gap (ms)", "0");
%this.addField("type", "TypeInt", "Audio type", $SimAudioType);
%this.process();
}
function ObjectBuilderGui::buildPrecipitation(%this)
{
%this.className = "Precipitation";
%this.addField("nameTag", "TypeString", "Name", "");
%this.addField("dataBlock", "TypeDataBlock", "Precipitation data", "PrecipitationData");
%this.process();
}
function ObjectBuilderGui::buildParticleEmitter(%this)
{
%this.className = "ParticleEmitterNode";
%this.addField("dataBlock", "TypeDataBlock", "datablock", "ParticleEmitterNodeData");
%this.addField("emitter", "TypeDataBlock", "Particle data", "ParticleEmitterData");
%this.process();
}
//------------------------------------------------------------------------------
// Mission
//------------------------------------------------------------------------------
function ObjectBuilderGui::buildMissionArea(%this)
{
%this.className = "MissionArea";
%this.addField("area", "TypeRect", "Bounding area", "0 0 1024 1024");
%this.process();
}
function ObjectBuilderGui::buildMarker(%this)
{
%this.className = "Marker";
%this.process();
}
//function ObjectBuilderGui::buildForcefield(%this)
//{
// %this.className = "ForcefieldBare";
// %this.addField("dataBlock", "TypeDataBlock", "Data Block", "ForceFieldBareData defaultForceFieldBare");
// %this.process();
//}
function ObjectBuilderGui::buildTrigger(%this)
{
%this.className = "Trigger";
%this.addField("dataBlock", "TypeDataBlock", "Data Block", "TriggerData defaultTrigger");
%this.addField("polyhedron", "TypeTriggerPolyhedron", "Polyhedron", "0 0 0 1 0 0 0 -1 0 0 0 1");
%this.process();
}
function ObjectBuilderGui::buildPhysicalZone(%this)
{
%this.className = "PhysicalZone";
%this.addField("polyhedron", "TypeTriggerPolyhedron", "Polyhedron", "0 0 0 1 0 0 0 -1 0 0 0 1");
%this.process();
}
function ObjectBuilderGui::buildCamera(%this)
{
%this.className = "Camera";
%this.addField("position", "TypePoint3", "Position", "0 0 0");
%this.addField("rotation", "TypePoint4", "Rotation", "1 0 0 0");
%this.addField("dataBlock", "TypeDataBlock", "Data block", "CameraData Observer");
%this.addField("team", "TypeInt", "Team", "0");
%this.process();
}
//------------------------------------------------------------------------------
// System
//------------------------------------------------------------------------------
function ObjectBuilderGui::buildSimGroup(%this)
{
%this.className = "SimGroup";
%this.process();
}
//------------------------------------------------------------------------------
// AI
//------------------------------------------------------------------------------
//function ObjectBuilderGui::buildObjective(%this)
//{
// %this.className = "AIObjective";
// %this.process();
//}
//function ObjectBuilderGui::buildNavigationGraph(%this)
//{
// %this.className = "NavigationGraph";
// %this.process();
//}

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

0
common/help/_ Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

147
common/main.cs Normal file
View File

@ -0,0 +1,147 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Load up defaults console values.
exec("./defaults.cs");
//-----------------------------------------------------------------------------
function initCommon()
{
// All mods need the random seed set
setRandomSeed();
// Very basic functions used by everyone
exec("./client/canvas.cs");
exec("./client/audio.cs");
}
function initBaseClient()
{
// Base client functionality
exec("./client/message.cs");
exec("./client/mission.cs");
exec("./client/missionDownload.cs");
exec("./client/actionMap.cs");
exec("./editor/editor.cs");
// There are also a number of support scripts loaded by the canvas
// when it's first initialized. Check out client/canvas.cs
}
function initBaseServer()
{
// Base server functionality
exec("./server/audio.cs");
exec("./server/server.cs");
exec("./server/message.cs");
exec("./server/commands.cs");
exec("./server/missionInfo.cs");
exec("./server/missionLoad.cs");
exec("./server/missionDownload.cs");
exec("./server/clientConnection.cs");
exec("./server/kickban.cs");
exec("./server/game.cs");
}
//-----------------------------------------------------------------------------
package Common {
function displayHelp() {
Parent::displayHelp();
error(
"Common Mod options:\n"@
" -fullscreen Starts game in full screen mode\n"@
" -windowed Starts game in windowed mode\n"@
" -autoVideo Auto detect video, but prefers OpenGL\n"@
" -openGL Force OpenGL acceleration\n"@
" -directX Force DirectX acceleration\n"@
" -voodoo2 Force Voodoo2 acceleration\n"@
" -noSound Starts game without sound\n"@
" -prefs <configFile> Exec the config file\n"
);
}
function parseArgs()
{
Parent::parseArgs();
// Arguments override defaults...
for (%i = 1; %i < $Game::argc ; %i++)
{
%arg = $Game::argv[%i];
%nextArg = $Game::argv[%i+1];
%hasNextArg = $Game::argc - %i > 1;
switch$ (%arg)
{
//--------------------
case "-fullscreen":
$pref::Video::fullScreen = 1;
$argUsed[%i]++;
//--------------------
case "-windowed":
$pref::Video::fullScreen = 0;
$argUsed[%i]++;
//--------------------
case "-noSound":
error("no support yet");
$argUsed[%i]++;
//--------------------
case "-openGL":
$pref::Video::displayDevice = "OpenGL";
$argUsed[%i]++;
//--------------------
case "-directX":
$pref::Video::displayDevice = "D3D";
$argUsed[%i]++;
//--------------------
case "-voodoo2":
$pref::Video::displayDevice = "Voodoo2";
$argUsed[%i]++;
//--------------------
case "-autoVideo":
$pref::Video::displayDevice = "";
$argUsed[%i]++;
//--------------------
case "-prefs":
$argUsed[%i]++;
if (%hasNextArg) {
exec(%nextArg, true, true);
$argUsed[%i+1]++;
%i++;
}
else
error("Error: Missing Command Line argument. Usage: -prefs <path/script.cs>");
}
}
}
function onStart()
{
Parent::onStart();
echo("\n--------- Initializing MOD: Common ---------");
initCommon();
}
function onExit()
{
OpenALShutdown();
Parent::onExit();
}
}; // Common package
activatePackage(Common);

BIN
common/main.cs.dso Normal file

Binary file not shown.

13
common/prefs.cs Normal file
View File

@ -0,0 +1,13 @@
$Pref::Server::AdminPassword = "";
$Pref::Server::BanTime = 1800;
$Pref::Server::ConnectionError = "ERROR";
$Pref::Server::FloodProtectionEnabled = 1;
$Pref::Server::Info = "This is a Torque Game Engine Test Server.";
$Pref::Server::KickBanTime = 300;
$Pref::Server::MaxChatLen = 120;
$Pref::Server::MaxPlayers = 64;
$Pref::Server::Name = "Torque Test Server";
$Pref::Server::Password = "";
$Pref::Server::Port = 28000;
$Pref::Server::RegionMask = 2;
$Pref::Server::TimeLimit = 20;

24
common/server/audio.cs Normal file
View File

@ -0,0 +1,24 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ServerPlay2D(%profile)
{
// Play the given sound profile on every client.
// The sounds will be transmitted as an event, not attached to any object.
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
ClientGroup.getObject(%idx).play2D(%profile);
}
function ServerPlay3D(%profile,%transform)
{
// Play the given sound profile at the given position on every client
// The sound will be transmitted as an event, not attached to any object.
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
ClientGroup.getObject(%idx).play3D(%profile,%transform);
}

BIN
common/server/audio.cs.dso Normal file

Binary file not shown.

0
common/server/banlist.cs Normal file
View File

Binary file not shown.

View File

@ -0,0 +1,207 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// This script function is called before a client connection
// is accepted. Returning "" will accept the connection,
// anything else will be sent back as an error to the client.
// All the connect args are passed also to onConnectRequest
//
function GameConnection::onConnectRequest( %client, %netAddress, %name )
{
echo("Connect request from: " @ %netAddress);
if($Server::PlayerCount >= $pref::Server::MaxPlayers)
return "CR_SERVERFULL";
return "";
}
//-----------------------------------------------------------------------------
// This script function is the first called on a client accept
//
function GameConnection::onConnect( %client, %name )
{
// Send down the connection error info, the client is
// responsible for displaying this message if a connection
// error occures.
messageClient(%client,'MsgConnectionError',"",$Pref::Server::ConnectionError);
// Send mission information to the client
sendLoadInfoToClient( %client );
// Simulated client lag for testing...
// %client.setSimulatedNetParams(0.1, 30);
// if hosting this server, set this client to superAdmin
if (%client.getAddress() $= "local") {
%client.isAdmin = true;
%client.isSuperAdmin = true;
}
// Get the client's unique id:
// %authInfo = %client.getAuthInfo();
// %client.guid = getField( %authInfo, 3 );
%client.guid = 0;
addToServerGuidList( %client.guid );
// Set admin status
%client.isAdmin = false;
%client.isSuperAdmin = false;
// Save client preferences on the connection object for later use.
%client.gender = "Male";
%client.armor = "Light";
%client.race = "Human";
%client.skin = addTaggedString( "base" );
%client.setPlayerName(%name);
%client.score = 0;
//
$instantGroup = ServerGroup;
$instantGroup = MissionCleanup;
echo("CADD: " @ %client @ " " @ %client.getAddress());
// Inform the client of all the other clients
%count = ClientGroup.getCount();
for (%cl = 0; %cl < %count; %cl++) {
%other = ClientGroup.getObject(%cl);
if ((%other != %client)) {
// These should be "silent" versions of these messages...
messageClient(%client, 'MsgClientJoin', "",
"",
%other,
%other.sendGuid,
%other.score,
%other.isAIControlled(),
%other.isAdmin,
%other.isSuperAdmin);
}
}
// Inform the client we've joined up
messageClient(%client,
'MsgClientJoin', "",
"",
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// Inform all the other clients of the new guy
messageAllExcept(%client, -1, 'MsgClientJoin', "",
"",
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// If the mission is running, go ahead download it to the client
if ($missionRunning)
%client.loadMission();
$Server::PlayerCount++;
}
//-----------------------------------------------------------------------------
// A player's name could be obtained from the auth server, but for
// now we use the one passed from the client.
// %realName = getField( %authInfo, 0 );
//
function GameConnection::setPlayerName(%client,%name)
{
%client.sendGuid = 0;
// Minimum length requirements
%name = stripTrailingSpaces( strToPlayerName( %name ) );
if ( strlen( %name ) < 3 )
%name = "Poser";
// Make sure the alias is unique, we'll hit something eventually
if (!isNameUnique(%name))
{
%isUnique = false;
for (%suffix = 1; !%isUnique; %suffix++) {
%nameTry = %name @ "." @ %suffix;
%isUnique = isNameUnique(%nameTry);
}
%name = %nameTry;
}
// Tag the name with the "smurf" color:
%client.nameBase = %name;
%client.name = addTaggedString("\cp\c8" @ %name @ "\co");
}
function isNameUnique(%name)
{
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%test = ClientGroup.getObject( %i );
%rawName = stripChars( detag( getTaggedString( %test.name ) ), "\cp\co\c6\c7\c8\c9" );
if ( strcmp( %name, %rawName ) == 0 )
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// This function is called when a client drops for any reason
//
function GameConnection::onDrop(%client, %reason)
{
%client.onClientLeaveGame();
removeFromServerGuidList( %client.guid );
messageAllExcept(%client, -1, 'MsgClientDrop', '\c1%1 has left the game.', %client.name, %client);
removeTaggedString(%client.name);
echo("CDROP: " @ %client @ " " @ %client.getAddress());
$Server::PlayerCount--;
// Reset the server if everyone has left the game
if( $Server::PlayerCount == 0 && $Server::Dedicated)
schedule(0, 0, "resetServerDefaults");
}
//-----------------------------------------------------------------------------
function GameConnection::startMission(%this)
{
// Inform the client the mission starting
commandToClient(%this, 'MissionStart', $missionSequence);
}
function GameConnection::endMission(%this)
{
// Inform the client the mission is done
commandToClient(%this, 'MissionEnd', $missionSequence);
}
//--------------------------------------------------------------------------
// Sync the clock on the client.
function GameConnection::syncClock(%client, %time)
{
commandToClient(%client, 'syncClock', %time);
}
//--------------------------------------------------------------------------
// Update all the clients with the new score
function GameConnection::incScore(%this,%delta)
{
%this.score += %delta;
messageAll('MsgClientScoreChanged', "", %this.score, %this);
}

47
common/server/commands.cs Normal file
View File

@ -0,0 +1,47 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Misc. server commands avialable to clients
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function serverCmdSAD( %client, %password )
{
if( %password !$= "" && %password $= $Pref::Server::AdminPassword)
{
%client.isAdmin = true;
%client.isSuperAdmin = true;
%name = getTaggedString( %client.name );
MessageAll( 'MsgAdminForce', "\c2" @ %name @ " has become Admin by force.", %client );
}
}
function serverCmdSADSetPassword(%client, %password)
{
if(%client.isSuperAdmin)
$Pref::Server::AdminPassword = %password;
}
//----------------------------------------------------------------------------
// Server chat message handlers
function serverCmdTeamMessageSent(%client, %text)
{
if(strlen(%text) >= $Pref::Server::MaxChatLen)
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
chatMessageTeam(%client, %client.team, '\c3%1: %2', %client.name, %text);
}
function serverCmdMessageSent(%client, %text)
{
if(strlen(%text) >= $Pref::Server::MaxChatLen)
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
chatMessageAll(%client, '\c4%1: %2', %client.name, %text);
}

Binary file not shown.

108
common/server/game.cs Normal file
View File

@ -0,0 +1,108 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Invoked from the common server & mission loading functions
//-----------------------------------------------------------------------------
function onServerCreated()
{
// Invoked by createServer(), when server is created and ready to go
// Server::GameType is sent to the master server.
// This variable should uniquely identify your game and/or mod.
$Server::GameType = "Test App";
// Server::MissionType sent to the master server. Clients can
// filter servers based on mission type.
$Server::MissionType = "Deathmatch";
// Load up all datablocks, objects etc. This function is called when
// a server is constructed.
// exec("./foo.cs");
// For backwards compatibility...
createGame();
}
function onServerDestroyed()
{
// Invoked by destroyServer(), right before the server is destroyed
destroyGame();
}
function onMissionLoaded()
{
// Called by loadMission() once the mission is finished loading
startGame();
}
function onMissionEnded()
{
// Called by endMission(), right before the mission is destroyed
endGame();
}
function onMissionReset()
{
// Called by resetMission(), after all the temporary mission objects
// have been deleted.
}
//-----------------------------------------------------------------------------
// These methods are extensions to the GameConnection class. Extending
// GameConnection make is easier to deal with some of this functionality,
// but these could also be implemented as stand-alone functions.
//-----------------------------------------------------------------------------
function GameConnection::onClientEnterGame(%this)
{
// Called for each client after it's finished downloading the
// mission and is ready to start playing.
// Tg: Should think about renaming this onClientEnterMission
}
function GameConnection::onClientLeaveGame(%this)
{
// Call for each client that drops
// Tg: Should think about renaming this onClientLeaveMission
}
//-----------------------------------------------------------------------------
// Functions that implement game-play
// These are here for backwards compatibilty only, games and/or mods should
// really be overloading the server and mission functions listed ubove.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function createGame()
{
// This function is called by onServerCreated (ubove)
}
function destroyGame()
{
// This function is called by onServerDestroyed (ubove)
}
//-----------------------------------------------------------------------------
function startGame()
{
// This is where the game play should start
// The default onMissionLoaded function starts the game.
}
function endGame()
{
// This is where the game play should end
// The default onMissionEnded function shuts down the game.
}

BIN
common/server/game.cs.dso Normal file

Binary file not shown.

26
common/server/kickban.cs Normal file
View File

@ -0,0 +1,26 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function kick(%client)
{
messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.name);
if (!%client.isAIControlled())
BanList::add(%client.guid, %client.getAddress(), $Pref::Server::KickBanTime);
%client.delete("You have been banned from this server");
}
function ban(%client)
{
messageAll('MsgAdminForce', '\c2The Admin has banned %1.', %client.name);
if (!%client.isAIControlled())
BanList::add(%client.guid, %client.getAddress(), $Pref::Server::BanTime);
%client.delete("You have been kicked from this server");
}

Binary file not shown.

151
common/server/message.cs Normal file
View File

@ -0,0 +1,151 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Server side message commands
//-----------------------------------------------------------------------------
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if(%recipient.team == %team)
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient.team == %team) && (%recipient != %client))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl = 0; %cl < %count; %cl++)
{
%client = ClientGroup.getObject(%cl);
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient != %client) && (%recipient.team != %team))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
//---------------------------------------------------------------------------
// Server side client chat'n
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// silly spam protection...
$SPAM_PROTECTION_PERIOD = 10000;
$SPAM_MESSAGE_THRESHOLD = 4;
$SPAM_PENALTY_PERIOD = 10000;
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
function GameConnection::spamMessageTimeout(%this)
{
if(%this.spamMessageCount > 0)
%this.spamMessageCount--;
}
function GameConnection::spamReset(%this)
{
%this.isSpamming = false;
}
function spamAlert(%client)
{
if($Pref::Server::FloodProtectionEnabled != true)
return(false);
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
{
%client.spamProtectStart = getSimTime();
%client.isSpamming = true;
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
}
if(%client.isSpamming)
{
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
messageClient(%client, "", $SPAM_MESSAGE, %wait);
return(true);
}
%client.spamMessageCount++;
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
return(false);
}
//---------------------------------------------------------------------------
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
//see if the client has muted the sender
if ( !%client.muted[%sender] )
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if(%sender.team != 0)
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
else
{
// message sender is an observer -- only send message to other observers
if(%obj.team == %sender.team)
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,119 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Mission Loading
// The server portion of the client/server mission loading process
//-----------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Loading Phases:
// Phase 1: Transmit Datablocks
// Transmit targets
// Phase 2: Transmit Ghost Objects
// Phase 3: Start Game
//
// The server invokes the client MissionStartPhase[1-3] function to request
// permission to start each phase. When a client is ready for a phase,
// it responds with MissionStartPhase[1-3]Ack.
function GameConnection::loadMission(%this)
{
// Send over the information that will display the server info
// when we learn it got there, we'll send the data blocks
%this.currentPhase = 0;
if (%this.isAIControlled())
{
// Cut to the chase...
%this.onClientEnterGame();
}
else
{
commandToClient(%this, 'MissionStartPhase1', $missionSequence,
$Server::MissionFile, MissionGroup.musicTrack);
echo("*** Sending mission load to client: " @ $Server::MissionFile);
}
}
function serverCmdMissionStartPhase1Ack(%client, %seq)
{
// Make sure to ignore calls from a previous mission load
if (%seq != $missionSequence || !$MissionRunning)
return;
if (%client.currentPhase != 0)
return;
%client.currentPhase = 1;
// Start with the CRC
%client.setMissionCRC( $missionCRC );
// Send over the datablocks...
// OnDataBlocksDone will get called when have confirmation
// that they've all been received.
%client.transmitDataBlocks($missionSequence);
}
function GameConnection::onDataBlocksDone( %this, %missionSequence )
{
// Make sure to ignore calls from a previous mission load
if (%missionSequence != $missionSequence)
return;
if (%this.currentPhase != 1)
return;
%this.currentPhase = 1.5;
// On to the next phase
commandToClient(%this, 'MissionStartPhase2', $missionSequence, $Server::MissionFile);
}
function serverCmdMissionStartPhase2Ack(%client, %seq)
{
// Make sure to ignore calls from a previous mission load
if (%seq != $missionSequence || !$MissionRunning)
return;
if (%client.currentPhase != 1.5)
return;
%client.currentPhase = 2;
// Update mod paths, this needs to get there before the objects.
%client.transmitPaths();
// Start ghosting objects to the client
%client.activateGhosting();
}
function GameConnection::clientWantsGhostAlwaysRetry(%client)
{
if($MissionRunning)
%client.activateGhosting();
}
function GameConnection::onGhostAlwaysFailed(%client)
{
}
function GameConnection::onGhostAlwaysObjectsReceived(%client)
{
// Ready for next phase.
commandToClient(%client, 'MissionStartPhase3', $missionSequence, $Server::MissionFile);
}
function serverCmdMissionStartPhase3Ack(%client, %seq)
{
// Make sure to ignore calls from a previous mission load
if(%seq != $missionSequence || !$MissionRunning)
return;
if(%client.currentPhase != 2)
return;
%client.currentPhase = 3;
// Server is ready to drop into the game
%client.startMission();
%client.onClientEnterGame();
}

View File

@ -0,0 +1,90 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Loading info is text displayed on the client side while the mission
// is being loaded. This information is extracted from the mission file
// and sent to each the client as it joins.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// clearLoadInfo
//
// Clears the mission info stored
//------------------------------------------------------------------------------
function clearLoadInfo() {
if (isObject(MissionInfo))
MissionInfo.delete();
}
//------------------------------------------------------------------------------
// buildLoadInfo
//
// Extract the map description from the .mis file
//------------------------------------------------------------------------------
function buildLoadInfo( %mission ) {
clearLoadInfo();
%infoObject = "";
%file = new FileObject();
if ( %file.openForRead( %mission ) ) {
%inInfoBlock = false;
while ( !%file.isEOF() ) {
%line = %file.readLine();
%line = trim( %line );
if( %line $= "new ScriptObject(MissionInfo) {" )
%inInfoBlock = true;
else if( %inInfoBlock && %line $= "};" ) {
%inInfoBlock = false;
%infoObject = %infoObject @ %line;
break;
}
if( %inInfoBlock )
%infoObject = %infoObject @ %line @ " ";
}
%file.close();
}
// Will create the object "MissionInfo"
eval( %infoObject );
%file.delete();
}
//------------------------------------------------------------------------------
// dumpLoadInfo
//
// Echo the mission information to the console
//------------------------------------------------------------------------------
function dumpLoadInfo()
{
echo( "Mission Name: " @ MissionInfo.name );
echo( "Mission Description:" );
for( %i = 0; MissionInfo.desc[%i] !$= ""; %i++ )
echo (" " @ MissionInfo.desc[%i]);
}
//------------------------------------------------------------------------------
// sendLoadInfoToClient
//
// Sends mission description to the client
//------------------------------------------------------------------------------
function sendLoadInfoToClient( %client )
{
messageClient( %client, 'MsgLoadInfo', "", MissionInfo.name );
// Send Mission Description a line at a time
for( %i = 0; MissionInfo.desc[%i] !$= ""; %i++ )
messageClient( %client, 'MsgLoadDescripition', "", MissionInfo.desc[%i] );
messageClient( %client, 'MsgLoadInfoDone' );
}

View File

@ -0,0 +1,150 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Server mission loading
//-----------------------------------------------------------------------------
// On every mission load except the first, there is a pause after
// the initial mission info is downloaded to the client.
$MissionLoadPause = 5000;
//-----------------------------------------------------------------------------
function loadMission( %missionName, %isFirstMission )
{
endMission();
echo("*** LOADING MISSION: " @ %missionName);
echo("*** Stage 1 load");
// Reset all of these
clearCenterPrintAll();
clearBottomPrintAll();
clearServerPaths();
// increment the mission sequence (used for ghost sequencing)
$missionSequence++;
$missionRunning = false;
$Server::MissionFile = %missionName;
// Extract mission info from the mission file,
// including the display name and stuff to send
// to the client.
buildLoadInfo( %missionName );
// Download mission info to the clients
%count = ClientGroup.getCount();
for( %cl = 0; %cl < %count; %cl++ ) {
%client = ClientGroup.getObject( %cl );
if (!%client.isAIControlled())
sendLoadInfoToClient(%client);
}
// if this isn't the first mission, allow some time for the server
// to transmit information to the clients:
if( %isFirstMission || $Server::ServerType $= "SinglePlayer" )
loadMissionStage2();
else
schedule( $MissionLoadPause, ServerGroup, loadMissionStage2 );
}
//-----------------------------------------------------------------------------
function loadMissionStage2()
{
// Create the mission group off the ServerGroup
echo("*** Stage 2 load");
$instantGroup = ServerGroup;
// Make sure the mission exists
%file = $Server::MissionFile;
if( !isFile( %file ) ) {
error( "Could not find mission " @ %file );
return;
}
// Calculate the mission CRC. The CRC is used by the clients
// to caching mission lighting.
$missionCRC = getFileCRC( %file );
// Exec the mission, objects are added to the ServerGroup
exec(%file);
// If there was a problem with the load, let's try another mission
if( !isObject(MissionGroup) ) {
error( "No 'MissionGroup' found in mission \"" @ $missionName @ "\"." );
schedule( 3000, ServerGroup, CycleMissions );
return;
}
// Mission cleanup group
new SimGroup( MissionCleanup );
$instantGroup = MissionCleanup;
// Construct MOD paths
pathOnMissionLoadDone();
// Mission loading done...
echo("*** Mission loaded");
// Start all the clients in the mission
$missionRunning = true;
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
ClientGroup.getObject(%clientIndex).loadMission();
// Go ahead and launch the game
onMissionLoaded();
purgeResources();
}
//-----------------------------------------------------------------------------
function endMission()
{
if (!isObject( MissionGroup ))
return;
echo("*** ENDING MISSION");
// Inform the game code we're done.
onMissionEnded();
// Inform the clients
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
// clear ghosts and paths from all clients
%cl = ClientGroup.getObject( %clientIndex );
%cl.endMission();
%cl.resetGhosting();
%cl.clearPaths();
}
// Delete everything
MissionGroup.delete();
MissionCleanup.delete();
$ServerGroup.delete();
$ServerGroup = new SimGroup(ServerGroup);
}
//-----------------------------------------------------------------------------
function resetMission()
{
echo("*** MISSION RESET");
// Remove any temporary mission objects
MissionCleanup.delete();
$instantGroup = ServerGroup;
new SimGroup( MissionCleanup );
$instantGroup = MissionCleanup;
//
onMissionReset();
}

13
common/server/prefs.cs Normal file
View File

@ -0,0 +1,13 @@
$Pref::Server::AdminPassword = "";
$Pref::Server::BanTime = 1800;
$Pref::Server::ConnectionError = "ERROR";
$Pref::Server::FloodProtectionEnabled = 1;
$Pref::Server::Info = "This is a Torque Game Engine Test Server.";
$Pref::Server::KickBanTime = 300;
$Pref::Server::MaxChatLen = 120;
$Pref::Server::MaxPlayers = 64;
$Pref::Server::Name = "Torque Test Server";
$Pref::Server::Password = "";
$Pref::Server::Port = 28000;
$Pref::Server::RegionMask = 2;
$Pref::Server::TimeLimit = 20;

146
common/server/server.cs Normal file
View File

@ -0,0 +1,146 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function portInit(%port)
{
%failCount = 0;
while(%failCount < 10 && !setNetPort(%port)) {
echo("Port init failed on port " @ %port @ " trying next port.");
%port++; %failCount++;
}
}
function createServer(%serverType, %mission)
{
if (%mission $= "") {
error("createServer: mission name unspecified");
return;
}
destroyServer();
//
$missionSequence = 0;
$Server::PlayerCount = 0;
$Server::ServerType = %serverType;
// Setup for multi-player, the network must have been
// initialized before now.
if (%serverType $= "MultiPlayer") {
echo("Starting multiplayer mode");
// Make sure the network port is set to the correct pref.
portInit($Pref::Server::Port);
allowConnections(true);
if ($pref::Net::DisplayOnMaster !$= "Never" )
schedule(0,0,startHeartbeat);
}
// Load the mission
$ServerGroup = new SimGroup(ServerGroup);
onServerCreated();
loadMission(%mission, true);
}
//-----------------------------------------------------------------------------
function destroyServer()
{
$Server::ServerType = "";
$missionRunning = false;
allowConnections(false);
stopHeartbeat();
// Clean up the game scripts
onServerDestroyed();
// Delete all the server objects
if (isObject(MissionGroup))
MissionGroup.delete();
if (isObject(MissionCleanup))
MissionCleanup.delete();
if (isObject($ServerGroup))
$ServerGroup.delete();
if (isObject(MissionInfo))
MissionInfo.delete();
// Delete all the connections:
while (ClientGroup.getCount())
{
%client = ClientGroup.getObject(0);
%client.delete();
}
$Server::GuidList = "";
// Delete all the data blocks...
deleteDataBlocks();
// Dump anything we're not using
purgeResources();
}
//--------------------------------------------------------------------------
function resetServerDefaults()
{
echo( "Resetting server defaults..." );
// Override server defaults with prefs:
exec( "~/defaults.cs" );
exec( "~/prefs.cs" );
loadMission( $Server::MissionFile );
}
//------------------------------------------------------------------------------
// Guid list maintenance functions:
function addToServerGuidList( %guid )
{
%count = getFieldCount( $Server::GuidList );
for ( %i = 0; %i < %count; %i++ )
{
if ( getField( $Server::GuidList, %i ) == %guid )
return;
}
$Server::GuidList = $Server::GuidList $= "" ? %guid : $Server::GuidList TAB %guid;
}
function removeFromServerGuidList( %guid )
{
%count = getFieldCount( $Server::GuidList );
for ( %i = 0; %i < %count; %i++ )
{
if ( getField( $Server::GuidList, %i ) == %guid )
{
$Server::GuidList = removeField( $Server::GuidList, %i );
return;
}
}
// Huh, didn't find it.
}
//-----------------------------------------------------------------------------
function onServerInfoQuery()
{
// When the server is queried for information, the value
// of this function is returned as the status field of
// the query packet. This information is accessible as
// the ServerInfo::State variable.
return "Doing Ok";
}

BIN
common/server/server.cs.dso Normal file

Binary file not shown.

74
common/ui/ConsoleDlg.gui Normal file
View File

@ -0,0 +1,74 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(ConsoleDlg) {
profile = "GuiDefaultProfile";
new GuiWindowCtrl()
{
profile = "GuiWindowProfile";
position = "0 0";
extent = "640 370";
text = "Console";
new GuiScrollCtrl()
{
profile = "GuiScrollProfile";
position = "0 0";
extent = "640 350";
hScrollBar = "alwaysOn";
vScrollBar = "alwaysOn";
horizSizing = "width";
vertSizing = "height";
new GuiConsole("testArrayCtrl")
{
profile = "GuiConsoleProfile";
position = "0 0";
};
};
new GuiConsoleEditCtrl("ConsoleEntry")
{
profile = "GuiTextEditProfile";
position = "0 350";
extent = "640 20";
historySize = 20;
altCommand = "ConsoleEntry::eval();";
horizSizing = "width";
vertSizing = "top";
};
};
};
//--- OBJECT WRITE END ---
$ConsoleActive = false;
function ConsoleEntry::eval()
{
%text = ConsoleEntry.getValue();
echo("==>" @ %text);
eval(%text);
ConsoleEntry.setValue("");
}
function ToggleConsole(%make)
{
if (%make)
{
if ($ConsoleActive)
{
if ( $enableDirectInput )
activateKeyboard();
Canvas.popDialog(ConsoleDlg);
$ConsoleActive = false;
}
else
{
if ( $enableDirectInput )
deactivateKeyboard();
Canvas.pushDialog(ConsoleDlg, 99);
$ConsoleActive = true;
}
}
}

Binary file not shown.

View File

@ -0,0 +1,29 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(FrameOverlayGui) {
profile = "GuiModelessDialogProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "True";
setFirstResponder = "True";
modal = "false";
helpTag = "0";
noCursor = true;
new GuiTextCtrl(TextOverlayControl) {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 5";
extent = "15 18";
minExtent = "8 8";
visible = "True";
setFirstResponder = "True";
modal = "True";
helpTag = "0";
expression = "10";
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

469
common/ui/GuiEditorGui.gui Normal file
View File

@ -0,0 +1,469 @@
//----------------------------------------------------------------
new GuiControlProfile (BackFillProfile)
{
opaque = true;
fillColor = "0 94 94";
border = true;
borderColor = "255 128 128";
fontType = "Arial";
fontSize = 12;
fontColor = "0 0 0";
fontColorHL = "32 100 100";
fixedExtent = true;
justify = "center";
};
new GuiControl(GuiEditorGui) {
profile = GuiDefaultProfile;
position = "0 0";
extent = "800 600";
helpPage = "3. Gui Editor";
new GuiControl() // background
{
profile = "BackFillProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
};
new GuiControl(GuiEditorContent)
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
};
new GuiEditCtrl(GuiEditor)
{
profile = "GuiTextEditProfile"; // so it's tabable
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
};
new GuiFrameSetCtrl()
{
position = "640 0";
extent = "160 600";
profile = "GuiButtonProfile";
horizSizing = "width";
vertSizing = "height";
columns = "0";
rows = "0 300";
//----------------------------------------
// Tree View
new GuiScrollCtrl()
{
profile = "GuiScrollProfile";
position = "0 0";
extent = "160 300";
horizSizing = "width";
vertSizing = "height";
vScrollBar = "alwaysOn";
hScrollBar = "dynamic";
new GuiTreeViewCtrl(GuiEditorTreeView)
{
profile = "GuiTreeViewProfile";
position = "0 0";
horizSizing = "width";
};
};
//----------------------------------------
// Inspector
new GuiControl() {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "160 300";
new GuiButtonCtrl () {
profile = "GuiButtonSmProfile";
position = "6, 16";
extent = "40 16";
font = "12 252 Arial";
fontHL = "12 253 Arial";
text = "APPLY";
command = "GuiEditorInspectApply();";
fillColor = "249";
borderColor = "249";
selectBorderColor = "255";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
position = "52 4";
extent = "30 16";
font = "12 244 Arial";
text = "Name:";
};
new GuiTextEditCtrl (GuiEditorInspectName) {
profile = "GuiTextEditProfile";
position = "84 3";
extent = "72 18";
text = "";
horizSizing = "width";
vertSizing = "bottom";
};
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
position = "0 24";
extent = "160 276";
horizSizing = "width";
vertSizing = "height";
vScrollBar = "alwaysOn";
hScrollBar = "alwaysOff";
new GuiInspector (GuiEditorInspectFields) {
profile = "GuiDefaultProfile";
position = "0 0";
extent = "140 0";
horizSizing = "width";
vertSizing = "bottom";
};
};
};
};
//----------------------------------------
// toolbar
new GuiControl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "height";
position = "0 480";
extent = "640 120";
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "4 24";
extent = "70 16";
text = "Align Left";
command = "GuiEditor.Justify(0);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "80 24";
extent = "70 16";
text = "Align Right";
command = "GuiEditor.Justify(2);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "156 24";
extent = "70 16";
text = "Center Horiz";
command = "GuiEditor.Justify(1);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "232 24";
extent = "70 16";
text = "Align Top";
command = "GuiEditor.Justify(3);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "308 24";
extent = "70 16";
text = "Align Bottom";
command = "GuiEditor.Justify(4);";
};
new GuiControlListPopup(GuiEditorClassPopup)
{
profile = "GuiEditorClassProfile";
position = "382 24";
extent = "180 16";
};
new GuiPopUpMenuCtrl(GuiEditorContentList)
{
profile = "GuiPopUpMenuProfile";
position = "382 44";
extent = "180 16";
};
new GuiButtonCtrl () {
profile = "GuiButtonSmProfile";
position = "570 24";
extent = "60 16";
text = "New...";
command = "GuiEditorStartCreate();";
};
new GuiButtonCtrl () {
profile = "GuiButtonSmProfile";
position = "570 44";
extent = "60 16";
text = "Save";
command = "GuiEditorSaveGui();";
};
new GuiButtonCtrl ("GuiEditorButtonToggle") {
profile = "GuiButtonSmProfile";
position = "4 44";
extent = "70 16";
text = "Help";
command = "getHelp(\"3. Gui Editor\");";
};
new GuiButtonCtrl () {
profile = "GuiButtonSmProfile";
position = "80 44";
extent = "70 16";
text = "Space Vert";
command = "GuiEditor.Justify(5);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "156 44";
extent = "70 16";
text = "Space Horiz";
command = "GuiEditor.Justify(6);";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "232 44";
extent = "70 16";
text = "Bring Front";
command = "GuiEditor.BringToFront();";
};
new GuiButtonCtrl() {
profile = "GuiButtonSmProfile";
position = "308 44";
extent = "70 16";
text = "Send Back";
command = "GuiEditor.PushToBack();";
};
};
};
//----------------------------------------
new GuiControl(NewGuiDialog)
{
profile = "GuiDialogProfile";
position = "0 0";
extent = "640 480";
new GuiWindowCtrl()
{
profile = "GuiWindowProfile";
position = "220 146";
extent = "200 188";
text = "Create new GUI";
canMove = "false";
canClose = "false";
canMinimize = "false";
canMaximize = "false";
horizSizing = "center";
vertSizing = "center";
new GuiTextCtrl()
{
profile = "GuiTextProfile";
position = "20 28";
text = "GUI Name:";
};
new GuiTextEditCtrl(NewGuiDialogName)
{
profile = "GuiTextEditProfile";
position = "20 44";
extent = "160 20";
};
new GuiTextCtrl()
{
profile = "GuiTextProfile";
position = "20 68";
text = "Class:";
};
new GuiControlListPopup(NewGuiDialogClass)
{
profile = "GuiControlListPopupProfile";
position = "20 84";
extent = "160 20";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
position = "56 156";
extent = "40 16";
text = "Create";
command = "GuiEditorCreate();";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
position = "104 156";
extent = "40 16";
text = "Cancel";
command = "Canvas.popDialog(NewGuiDialog);";
};
};
};
//----------------------------------------
function GuiEditorStartCreate()
{
NewGuiDialogClass.setText("GuiControl");
NewGuiDialogClass.sort();
NewGuiDialogName.setValue("NewGui");
Canvas.pushDialog(NewGuiDialog);
}
//----------------------------------------
function GuiEditorCreate()
{
%name = NewGuiDialogName.getValue();
%class = NewGuiDialogClass.getText();
Canvas.popDialog(NewGuiDialog);
%obj = eval("return new " @ %class @ "(" @ %name @ ");");
GuiEditorOpen(%obj);
}
//----------------------------------------
function GuiEditorSaveGui()
{
%obj = GuiEditorContent.getObject(0);
if(%obj == -1 || %obj.getName() $= "")
return;
%name = %obj.getName() @ ".gui";
getSaveFilename("*.gui", "GuiEditorSaveGuiCallback", %name);
}
function GuiEditorSaveGuiCallback(%name)
{
%obj = GuiEditorContent.getObject(0);
// make sure it is saved...
if(!%obj.save(%name))
{
MessageBoxOK("GuiEditor Save Failure", "Failed to save '" @ %name @ "'. The file may be read-only.");
}
}
//----------------------------------------
function GuiEdit(%val)
{
if(%val != 0 || !$testCheats)
return;
%content = Canvas.getContent();
if(%content == GuiEditorGui.getId())
{
//GlobalActionMap.bind(mouse, button1, mouselook);
%obj = GuiEditorContent.getObject(0);
if(%obj != -1)
{
GuiGroup.add(%obj);
Canvas.setContent(%obj);
}
GlobalActionMap.unbind( keyboard, "delete" );
}
else
{
//GlobalActionMap.unbind(mouse, button1);
GuiEditorOpen(%content);
}
}
//----------------------------------------
function GuiEditorOpen(%content)
{
Canvas.setContent(GuiEditorGui);
while((%obj = GuiEditorContent.getObject(0)) != -1)
GuiGroup.add(%obj); // get rid of anything being edited
%i = 0;
GuiEditorContentList.clear();
while((%obj = GuiGroup.getObject(%i)) != -1)
{
if(%obj.getName() !$= Canvas)
{
if(%obj.getName() $= "")
%name = "(unnamed) - " @ %obj;
else
%name = %obj.getName() @ " - " @ %obj;
GuiEditorContentList.add(%name, %obj);
}
%i++;
}
GuiEditorContent.add(%content);
GuiEditorContentList.sort();
GuiEditorClassPopup.sort();
if(%content.getName() $= "")
%name = "(unnamed) - " @ %content;
else
%name = %content.getName() @ " - " @ %content;
GuiEditorContentList.setText(%name);
GuiEditorClassPopup.setText("New Control");
GuiEditor.setRoot(%content);
%content.resize(0,0,640,480);
GuiEditorTreeView.open(%content);
}
//----------------------------------------
function GuiEditorContentList::onSelect(%this, %id)
{
GuiEditorOpen(%id);
}
//----------------------------------------
function GuiEditorClassPopup::onSelect(%this, %id)
{
%class = %this.getText();
%obj = eval("return new " @ %class @ "();");
GuiEditor.addNewCtrl(%obj);
GuiEditorClassPopup.setText("New Control");
}
//----------------------------------------
function GuiEditorTreeView::onSelect(%this, %obj, %rightMouse)
{
if(%rightMouse)
GuiEditor.setCurrentAddSet(%obj);
else
{
GuiEditorInspectFields.inspect(%obj);
GuiEditorInspectName.setValue(%obj.getName());
GuiEditor.select(%obj);
}
}
//----------------------------------------
function GuiEditorInspectApply()
{
GuiEditorInspectFields.apply(GuiEditorInspectName.getValue());
}
//----------------------------------------
function GuiEditor::onSelect(%this, %ctrl)
{
GuiEditorInspectFields.inspect(%ctrl);
GuiEditorInspectName.setValue(%ctrl.getName());
GuiEditor.select(%ctrl);
}
//----------------------------------------
function GuiEditorDeleteSelected( %val ) {
if( %val )
GuiEditor.deleteSelection();
}
GlobalActionMap.bind(keyboard, "f10", GuiEdit);

Binary file not shown.

110
common/ui/HelpDlg.gui Normal file
View File

@ -0,0 +1,110 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(HelpDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiBitmapCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
position = "93 28";
extent = "495 438";
minExtent = "300 200";
visible = "1";
helpTag = "0";
bitmap = "marble/client/ui/helpGui";
wrap = "0";
text = "Help";
canMove = "1";
minSize = "50 50";
maxLength = "255";
canClose = "1";
resizeWidth = "1";
canMinimize = "1";
resizeHeight = "1";
canMaximize = "1";
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "right";
vertSizing = "height";
position = "52 91";
extent = "132 229";
minExtent = "8 8";
visible = "1";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiTextListCtrl(HelpFileList) {
profile = "GuiTextListProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 2";
extent = "128 176";
minExtent = "8 8";
visible = "1";
helpTag = "0";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
};
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "width";
vertSizing = "height";
position = "192 91";
extent = "268 314";
minExtent = "8 8";
visible = "1";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiMLTextCtrl(HelpText) {
profile = "GuiMLTextProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "2 2";
extent = "250 760";
minExtent = "8 8";
visible = "1";
helpTag = "0";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
};
};
new GuiBitmapButtonCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "93 352";
extent = "47 41";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "marble/client/ui/ok";
command = "Canvas.popDialog(HelpDlg);";
};
};
};
//--- OBJECT WRITE END ---

BIN
common/ui/HelpDlg.gui.dso Normal file

Binary file not shown.

View File

@ -0,0 +1,103 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(InspectAddFieldDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "209 177";
extent = "221 125";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Add dynamic field...";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(InspectAddFieldDlg);";
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "22 32";
extent = "30 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Name:";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "21 58";
extent = "31 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Value:";
};
new GuiTextEditCtrl(InspectAddFieldValue) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "62 58";
extent = "146 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
historySize = "0";
maxLength = "255";
};
new GuiTextEditCtrl(InspectAddFieldName) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "62 32";
extent = "146 18";
minExtent = "8 8";
visible = "1";
helpTag = "0";
historySize = "0";
maxLength = "255";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 88";
extent = "73 20";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "OK";
command = "canvas.popDialog(InspectAddFieldDlg);InspectAddFieldDlg.doAction();";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "125 88";
extent = "73 20";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "CANCEL";
command = "canvas.popDialog(InspectAddFieldDlg);";
};
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

234
common/ui/InspectDlg.gui Normal file
View File

@ -0,0 +1,234 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(InspectDlg) {
profile = "GuiDialogProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "False";
helpTag = "0";
new GuiWindowCtrl(InspectTitle) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "20 20";
extent = "200 400";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
resizeWidth = "True";
resizeHeight = "True";
canMove = "True";
canClose = "True";
canMinimize = "True";
canMaximize = "True";
minSize = "50 50";
closeCommand = "Canvas.popDialog(InspectDlg);";
font = "12 244 Arial";
selectfillColor = "253";
fillColor = "250";
opaque = "true";
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "8 24";
extent = "40 16";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
command = "InspectApply();";
helpTag = "0";
text = "APPLY";
selectBorderColor = "255";
borderColor = "249";
fillColor = "249";
fontHL = "12 253 Arial";
font = "12 252 Arial";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "56 24";
extent = "29 18";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
text = "Name:";
font = "12 244 Arial";
};
new GuiTextEditCtrl(InspectObjectName) {
profile = "GuiTextEditProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "98 23";
extent = "72 18";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
historySize = "0";
};
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "width";
vertSizing = "height";
position = "8 44";
extent = "184 348";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
willFirstRespond = "True";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
constantThumbHeight = "False";
new GuiInspector(InspectFields) {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = "184 8";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
};
};
};
new GuiWindowCtrl(InspectTreeTitle) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "232 20";
extent = "200 400";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
text = "TREE VIEW";
resizeWidth = "True";
resizeHeight = "True";
canMove = "True";
canClose = "True";
canMinimize = "True";
canMaximize = "True";
minSize = "50 50";
closeCommand = "Canvas.popDialog(InspectDlg);";
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "width";
vertSizing = "height";
position = "8 24";
extent = "184 368";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
willFirstRespond = "True";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
constantThumbHeight = "False";
new GuiTreeViewCtrl(InspectTreeView) {
profile = "GuiTreeViewProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = "64 64";
minExtent = "8 8";
visible = "True";
setFirstResponder = "False";
modal = "True";
helpTag = "0";
};
};
};
};
//--- OBJECT WRITE END ---
exec("./InspectAddFieldDlg.gui");
function Inspect(%obj)
{
Canvas.popDialog("InspectDlg");
Canvas.pushDialog("InspectDlg", 30);
InspectFields.inspect(%obj);
InspectObjectName.setValue(%obj.getName());
InspectTitle.setValue(%obj.getId() @ ": " @ %obj.getName());
}
function InspectApply()
{
InspectFields.apply(InspectObjectName.getValue());
}
function InspectTreeView::onSelect(%this, %obj)
{
Inspect(%obj);
}
function Tree(%obj)
{
Canvas.popDialog("InspectDlg");
Canvas.pushDialog("InspectDlg", 20);
InspectTreeView.open(%obj);
}
// MM: Added Dynamic group toggle support.
function GuiInspector::toggleDynamicGroupScript(%this, %obj)
{
%this.toggleDynamicGroupExpand();
%this.inspect(%obj);
}
// MM: Added group toggle support.
function GuiInspector::toggleGroupScript(%this, %obj, %fieldName)
{
%this.toggleGroupExpand(%obj, %fieldName);
%this.inspect(%obj);
}
// MM: Set All Group State support.
function GuiInspector::setAllGroupStateScript(%this, %obj, %groupState)
{
%this.setAllGroupState(%groupState);
%this.inspect(%obj);
}
function GuiInspector::addDynamicField(%this, %obj)
{
InspectAddFieldDlg.object = %obj;
InspectAddFieldDlg.inspector = %this;
InspectAddFieldName.setValue("");
InspectAddFieldValue.setValue("");
Canvas.pushDialog(InspectAddFieldDlg, 99);
}
function InspectAddFieldDlg::doAction(%this)
{
if(InspectAddFieldName.getValue() $= "" || InspectAddFieldValue.getValue() $= "")
return;
eval(%this.object @ "." @ firstWord(InspectAddFieldName.getValue()) @ " = " @ InspectAddFieldValue.getValue() @ ";");
%this.inspector.inspect(%this.object);
}

Binary file not shown.

119
common/ui/LoadFileDlg.gui Normal file
View File

@ -0,0 +1,119 @@
//--- OBJECT WRITE BEGIN ---
new GuiControl(LoadFileDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "137 78";
extent = "378 326";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Load File...";
maxLength = "255";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(LoadFileDlg);";
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 26";
extent = "282 289";
minExtent = "8 8";
visible = "1";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
defaultLineHeight = "15";
childMargin = "0 0";
new GuiTextListCtrl(loadFileList) {
profile = "GuiTextArrayProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "161 8";
minExtent = "8 8";
visible = "1";
altCommand = "eval($loadFileCommand); Canvas.popDialog(LoadFileDlg);";
helpTag = "0";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
noDuplicates = "false";
};
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "303 268";
extent = "60 20";
minExtent = "8 8";
visible = "1";
command = "eval($loadFileCommand); Canvas.popDialog(LoadFileDlg);";
helpTag = "0";
text = "Load";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "303 294";
extent = "60 20";
minExtent = "8 8";
visible = "1";
command = "Canvas.popDialog(LoadFileDlg);";
helpTag = "0";
text = "Cancel";
};
};
};
//--- OBJECT WRITE END ---
function fillFileList(%filespec, %ctrl)
{
%ctrl.clear();
%i = 0;
%f = 0;
for(%fld = getField(%filespec, 0); %fld !$= ""; %fld = getField(%filespec, %f++))
{
for(%file = findFirstFile(%fld); %file !$= ""; %file = findNextFile(%fld))
if (getSubStr(%file, 0, 4) !$= "CVS/")
%ctrl.addRow(%i++, %file);
}
%ctrl.sort(0);
}
//------------------------------------------------------------------------------
// ex: getLoadFilename("stuff\*.*", loadStuff);
// -- calls 'loadStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function getLoadFilename(%filespec, %callback)
{
$loadFileCommand = "if(loadFileList.getSelectedId() >= 0)" @ %callback @ "(loadFileList.getValue());";
Canvas.pushDialog(LoadFileDlg, 99);
fillFileList(%filespec, loadFileList);
}

Some files were not shown because too many files have changed in this diff Show More