mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 07:31:40 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
150
Code/Tools/RenegadeSim/About.Java
Normal file
150
Code/Tools/RenegadeSim/About.Java
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// About.java
|
||||
import com.ms.wfc.app.*;
|
||||
import com.ms.wfc.core.*;
|
||||
import com.ms.wfc.ui.*;
|
||||
|
||||
/**
|
||||
* @author: Application Wizard
|
||||
* @version: 1.0
|
||||
* This class can take a variable number of parameters on the command
|
||||
* line. Program execution begins with the main() method. The class
|
||||
* constructor is not invoked unless an object of type '%FILENAME%'
|
||||
* created in the main() method.
|
||||
*/
|
||||
public class About extends Form
|
||||
{
|
||||
private void okButton_click(Object sender, Event e)
|
||||
{
|
||||
this.setDialogResult(DialogResult.OK);
|
||||
}
|
||||
|
||||
public About()
|
||||
{
|
||||
super();
|
||||
|
||||
//Required for Visual J++ Form Designer support
|
||||
initForm();
|
||||
|
||||
// Set Avail System Memory Information
|
||||
com.ms.win32.MEMORYSTATUS lpMemStat = new com.ms.win32.MEMORYSTATUS();
|
||||
GlobalMemoryStatus(lpMemStat);
|
||||
availableMemoryLabel.setText(Integer.toString(lpMemStat.dwTotalPhys/1024) + " KB");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* %FILENAME% overrides dispose so it can clean up the
|
||||
* component list.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
components.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: The following code is required by the Visual J++ form
|
||||
* designer. It can be modified using the form editor. Do not
|
||||
* modify it using the code editor.
|
||||
*/
|
||||
|
||||
Container components = new Container();
|
||||
Button okButton = new Button();
|
||||
Label titleLabel = new Label();
|
||||
Label versionLabel = new Label();
|
||||
Label nameLabel = new Label();
|
||||
Label memoryLabel = new Label();
|
||||
Label availableMemoryLabel = new Label();
|
||||
|
||||
private void initForm()
|
||||
{
|
||||
okButton.setLocation(new Point(208, 192));
|
||||
okButton.setSize(new Point(84, 23));
|
||||
okButton.setTabIndex(0);
|
||||
okButton.setText("OK");
|
||||
okButton.addOnClick(new EventHandler(this.okButton_click));
|
||||
|
||||
this.setText("RenegadeSim");
|
||||
this.setAcceptButton(okButton);
|
||||
this.setAutoScaleBaseSize(new Point(5, 13));
|
||||
this.setBorderStyle(FormBorderStyle.FIXED_TOOLWINDOW);
|
||||
this.setCancelButton(okButton);
|
||||
this.setClientSize(new Point(298, 241));
|
||||
this.setMaximizeBox(false);
|
||||
this.setMinimizeBox(false);
|
||||
this.setStartPosition(FormStartPosition.CENTER_SCREEN);
|
||||
|
||||
titleLabel.setFont(new Font("MS Sans Serif", 15.0f, FontSize.CHARACTERHEIGHT, FontWeight.BOLD, false, false, false));
|
||||
titleLabel.setLocation(new Point(10, 10));
|
||||
titleLabel.setSize(new Point(280, 40));
|
||||
titleLabel.setTabIndex(1);
|
||||
titleLabel.setTabStop(false);
|
||||
titleLabel.setText("Renegade Game Results Simulator");
|
||||
|
||||
versionLabel.setLocation(new Point(10, 60));
|
||||
versionLabel.setSize(new Point(280, 20));
|
||||
versionLabel.setTabIndex(3);
|
||||
versionLabel.setTabStop(false);
|
||||
versionLabel.setText("Version 0.1a");
|
||||
|
||||
nameLabel.setLocation(new Point(10, 90));
|
||||
nameLabel.setSize(new Point(280, 50));
|
||||
nameLabel.setTabIndex(4);
|
||||
nameLabel.setTabStop(false);
|
||||
nameLabel.setText("Randomly computes a set of scores given a bunch of Renegade players and calls a C++ DLL via JNI to deliver game results packets to the Renegade game results server.");
|
||||
|
||||
memoryLabel.setLocation(new Point(8, 160));
|
||||
memoryLabel.setSize(new Point(200, 24));
|
||||
memoryLabel.setTabIndex(2);
|
||||
memoryLabel.setTabStop(false);
|
||||
memoryLabel.setText("Memory available to system: ");
|
||||
|
||||
availableMemoryLabel.setLocation(new Point(212, 160));
|
||||
availableMemoryLabel.setSize(new Point(72, 24));
|
||||
availableMemoryLabel.setTabIndex(5);
|
||||
availableMemoryLabel.setTabStop(false);
|
||||
availableMemoryLabel.setText("");
|
||||
|
||||
this.setNewControls(new Control[] {
|
||||
nameLabel,
|
||||
versionLabel,
|
||||
titleLabel,
|
||||
memoryLabel,
|
||||
availableMemoryLabel,
|
||||
okButton});
|
||||
}
|
||||
|
||||
/**
|
||||
* The main entry point for the application.
|
||||
*
|
||||
* @param args Array of parameters passed to the application
|
||||
* via the command line.
|
||||
*/
|
||||
public static void main(String args[])
|
||||
{
|
||||
Application.run(new About());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dll.import("KERNEL32",auto)
|
||||
*/
|
||||
public static native void GlobalMemoryStatus(com.ms.win32.MEMORYSTATUS lpBuffer);
|
||||
}
|
||||
130
Code/Tools/RenegadeSim/ClientSetup.java
Normal file
130
Code/Tools/RenegadeSim/ClientSetup.java
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import com.ms.wfc.app.*;
|
||||
import com.ms.wfc.core.*;
|
||||
import com.ms.wfc.ui.*;
|
||||
import com.ms.wfc.html.*;
|
||||
|
||||
/**
|
||||
* This class can take a variable number of parameters on the command
|
||||
* line. Program execution begins with the main() method. The class
|
||||
* constructor is not invoked unless an object of type 'ClientSetup'
|
||||
* created in the main() method.
|
||||
*/
|
||||
public class ClientSetup extends Form
|
||||
{
|
||||
public ClientSetup()
|
||||
{
|
||||
super();
|
||||
|
||||
// Required for Visual J++ Form Designer support
|
||||
initForm();
|
||||
|
||||
// TODO: Add any constructor code after initForm call
|
||||
}
|
||||
|
||||
/**
|
||||
* ClientSetup overrides dispose so it can clean up the
|
||||
* component list.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
components.dispose();
|
||||
}
|
||||
|
||||
private void okButton_click(Object source, Event e)
|
||||
{
|
||||
this.setDialogResult(DialogResult.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: The following code is required by the Visual J++ form
|
||||
* designer. It can be modified using the form editor. Do not
|
||||
* modify it using the code editor.
|
||||
*/
|
||||
Container components = new Container();
|
||||
Button okButton = new Button();
|
||||
GroupBox groupBox1 = new GroupBox();
|
||||
Label label1 = new Label();
|
||||
Edit edit1 = new Edit();
|
||||
Label label2 = new Label();
|
||||
Edit edit2 = new Edit();
|
||||
|
||||
private void initForm()
|
||||
{
|
||||
this.setText("Client Setup");
|
||||
this.setAutoScaleBaseSize(new Point(5, 13));
|
||||
this.setClientSize(new Point(247, 135));
|
||||
|
||||
okButton.setLocation(new Point(168, 104));
|
||||
okButton.setSize(new Point(75, 23));
|
||||
okButton.setTabIndex(0);
|
||||
okButton.setText("Ok");
|
||||
okButton.addOnClick(new EventHandler(this.okButton_click));
|
||||
|
||||
groupBox1.setLocation(new Point(8, 8));
|
||||
groupBox1.setSize(new Point(232, 88));
|
||||
groupBox1.setTabIndex(1);
|
||||
groupBox1.setTabStop(false);
|
||||
groupBox1.setText("Game Results Server");
|
||||
|
||||
label1.setLocation(new Point(8, 24));
|
||||
label1.setSize(new Point(32, 16));
|
||||
label1.setTabIndex(0);
|
||||
label1.setTabStop(false);
|
||||
label1.setText("Host:");
|
||||
|
||||
edit1.setLocation(new Point(40, 24));
|
||||
edit1.setSize(new Point(184, 20));
|
||||
edit1.setTabIndex(2);
|
||||
edit1.setText("games2.westwood.com");
|
||||
|
||||
label2.setLocation(new Point(8, 56));
|
||||
label2.setSize(new Point(32, 16));
|
||||
label2.setTabIndex(3);
|
||||
label2.setTabStop(false);
|
||||
label2.setText("Port:");
|
||||
|
||||
edit2.setLocation(new Point(40, 56));
|
||||
edit2.setSize(new Point(40, 20));
|
||||
edit2.setTabIndex(1);
|
||||
edit2.setText("4850");
|
||||
|
||||
this.setNewControls(new Control[] {
|
||||
groupBox1,
|
||||
okButton});
|
||||
groupBox1.setNewControls(new Control[] {
|
||||
edit2,
|
||||
label2,
|
||||
edit1,
|
||||
label1});
|
||||
}
|
||||
|
||||
/**
|
||||
* The main entry point for the application.
|
||||
*
|
||||
* @param args Array of parameters passed to the application
|
||||
* via the command line.
|
||||
*/
|
||||
public static void main(String args[])
|
||||
{
|
||||
Application.run(new ClientSetup());
|
||||
}
|
||||
}
|
||||
64
Code/Tools/RenegadeSim/RenegadeNet.java
Normal file
64
Code/Tools/RenegadeSim/RenegadeNet.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
public class RenegadeNet extends Thread
|
||||
{
|
||||
private String[] _logins = null;
|
||||
private double[] _scores = null;
|
||||
private RenegadeNetCaller _caller = null;
|
||||
|
||||
static
|
||||
{
|
||||
System.loadLibrary("RenegadeGR");
|
||||
}
|
||||
|
||||
|
||||
private static native int _nativeSendGR(String[] logins, double[] scores);
|
||||
public static native void startWinSock();
|
||||
public static native void stopWinSock();
|
||||
|
||||
|
||||
public RenegadeNet(RenegadeNetCaller caller)
|
||||
{
|
||||
_caller = caller;
|
||||
}
|
||||
|
||||
|
||||
public void sendGameResults(String[] logins, double[] scores)
|
||||
{
|
||||
_logins = logins;
|
||||
_scores = scores;
|
||||
start();
|
||||
/*RenegadeNet thread = new RenegadeNet();
|
||||
thread.setRequest(caller, logins, scores);
|
||||
thread.run();*/
|
||||
}
|
||||
|
||||
/*public void setRequest(RenegadeNetCaller caller, String[] logins, double[] scores)
|
||||
{
|
||||
_caller = caller;
|
||||
_logins = logins;
|
||||
_scores = scores;
|
||||
}*/
|
||||
|
||||
public void run()
|
||||
{
|
||||
int packetlen = _nativeSendGR(_logins, _scores);
|
||||
_caller.grDoneCallback(packetlen);
|
||||
}
|
||||
}
|
||||
22
Code/Tools/RenegadeSim/RenegadeNetCaller.java
Normal file
22
Code/Tools/RenegadeSim/RenegadeNetCaller.java
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
public interface RenegadeNetCaller
|
||||
{
|
||||
abstract public void grDoneCallback(int packetlen);
|
||||
}
|
||||
526
Code/Tools/RenegadeSim/RenegadeSim.Java
Normal file
526
Code/Tools/RenegadeSim/RenegadeSim.Java
Normal file
@@ -0,0 +1,526 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//RenegadeSim.java
|
||||
import com.ms.wfc.app.*;
|
||||
import com.ms.wfc.core.*;
|
||||
import com.ms.wfc.ui.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author: Application Wizard
|
||||
* @version: 1.0
|
||||
* This class can take a variable number of parameters on the command
|
||||
* line. Program execution begins with the main() method. The class
|
||||
* constructor is not invoked unless an object of type 'RenegadeSim'
|
||||
* created in the main() method.
|
||||
*/
|
||||
|
||||
public class RenegadeSim extends Form implements RenegadeNetCaller
|
||||
{
|
||||
private Date _seed = new Date();
|
||||
private Random _rand = new Random(_seed.getSeconds());
|
||||
|
||||
|
||||
public void doNew(Object sender, Event e)
|
||||
{
|
||||
// New
|
||||
}
|
||||
|
||||
private void saveAsMenu_click(Object sender, Event e)
|
||||
{
|
||||
// Save As
|
||||
}
|
||||
|
||||
private void saveMenu_click(Object sender, Event e)
|
||||
{
|
||||
// Save
|
||||
}
|
||||
|
||||
private void doOpen(Object sender, Event e)
|
||||
{
|
||||
// Open
|
||||
}
|
||||
|
||||
public void wordWrapMenu_click(Object sender, Event e)
|
||||
{
|
||||
// WordWrap
|
||||
}
|
||||
|
||||
public void doDateTime(Object sender, Event e)
|
||||
{
|
||||
// Date/Time
|
||||
}
|
||||
|
||||
public void doPaste(Object sender, Event e)
|
||||
{
|
||||
// Paste
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception ecx)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void doCopy(Object sender, Event e)
|
||||
{
|
||||
// Copy
|
||||
}
|
||||
|
||||
public void doCut(Object sender, Event e)
|
||||
{
|
||||
// Cut
|
||||
}
|
||||
|
||||
public void exitMenu_click(Object sender, Event e)
|
||||
{
|
||||
// Exit
|
||||
Application.exit();
|
||||
}
|
||||
|
||||
private void aboutMenu_click(Object sender, Event e)
|
||||
{
|
||||
About myAbout = new About();
|
||||
myAbout.showDialog ();
|
||||
}
|
||||
|
||||
private void toolBar_buttonClick(Object source, ToolBarButtonClickEvent e)
|
||||
{
|
||||
if (e.button == openToolBarButton) {
|
||||
// Open
|
||||
doOpen(source,e);
|
||||
}
|
||||
else if (e.button == saveToolBarButton) {
|
||||
// Save
|
||||
doSave(source,e);
|
||||
}
|
||||
else if (e.button == setupToolBarButton) {
|
||||
// Setup
|
||||
ClientSetup myClientSetup = new ClientSetup();
|
||||
myClientSetup.showDialog();
|
||||
}
|
||||
else {
|
||||
; //nop
|
||||
}
|
||||
}
|
||||
|
||||
public RenegadeSim()
|
||||
{
|
||||
super();
|
||||
|
||||
//Required for Visual J++ Form Designer support
|
||||
initForm();
|
||||
|
||||
//TODO: Add any constructor code after initForm call
|
||||
RenegadeNet.startWinSock();
|
||||
_refreshButtonStates();
|
||||
Application.addOnIdle(new EventHandler(this.RenegadeSim_Idle));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RenegadeSim overrides dispose so it can clean up the
|
||||
* component list.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
components.dispose();
|
||||
RenegadeNet.stopWinSock();
|
||||
}
|
||||
|
||||
private void RenegadeSim_Idle(Object sender, Event e)
|
||||
{
|
||||
// Set the statusBarStates
|
||||
/*StatusBarPanel sbPanel[] = statusBar.getPanels ();
|
||||
if ((GetKeyState(VK_CAPITAL) & 1) == 1)
|
||||
sbPanel[1].setText ("CAP");
|
||||
else
|
||||
sbPanel[1].setText ("");
|
||||
if ((GetKeyState(VK_NUMLOCK) & 1) == 1)
|
||||
sbPanel[2].setText ("NUM");
|
||||
else
|
||||
sbPanel[2].setText (""); */
|
||||
}
|
||||
|
||||
private boolean doSave(Object sender, Event e)
|
||||
{
|
||||
boolean bRc = false;
|
||||
return bRc;
|
||||
}
|
||||
|
||||
|
||||
private void RenegadeSim_click(Object source, Event e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label1_click(Object source, Event e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void butSimulate_click(Object source, Event e)
|
||||
{
|
||||
int[] indices = lbPlayers.getSelectedIndices();
|
||||
int i = 0;
|
||||
|
||||
lbResults.removeAll();
|
||||
for(i = 0; i < lbPlayers.getItemCount(); i++)
|
||||
lbResults.addItem(new String("--"));
|
||||
|
||||
for(i = 0; i < indices.length; i++)
|
||||
{
|
||||
// Simulate a score. We want a score x such that -0.5 <= x <= 0.5
|
||||
// and we want to weight it slightly more towards the positive side.
|
||||
double score = _rand.nextDouble() - 0.3;
|
||||
if( score > 0.5 ) score = 0.5;
|
||||
if( score < -0.5 ) score = -0.5;
|
||||
lbResults.setItem(indices[i], new String("" + (_rand.nextDouble() - 0.5)));
|
||||
}
|
||||
|
||||
_refreshButtonStates();
|
||||
}
|
||||
|
||||
private void butSelectToggle_click(Object source, Event e)
|
||||
{
|
||||
int[] indices = lbPlayers.getSelectedIndices();
|
||||
for(int i = 0; i < lbPlayers.getItemCount(); i++)
|
||||
lbPlayers.setSelected(i, (indices.length == 0));
|
||||
_refreshButtonStates();
|
||||
}
|
||||
|
||||
|
||||
private void _refreshButtonStates()
|
||||
{
|
||||
boolean valid = false;
|
||||
|
||||
// Check for Send button
|
||||
for(int i = 0; i < lbResults.getItemCount(); i++)
|
||||
{
|
||||
String item = (String)lbResults.getItem(i);
|
||||
if( item.compareTo("--") != 0 )
|
||||
valid = true;
|
||||
}
|
||||
butSend.setEnabled(valid);
|
||||
|
||||
|
||||
// Check for simulate button
|
||||
int[] indices = lbPlayers.getSelectedIndices();
|
||||
butSimulate.setEnabled(indices.length > 0);
|
||||
}
|
||||
|
||||
private void lbPlayers_selectedIndexChanged(Object source, Event e)
|
||||
{
|
||||
_refreshButtonStates();
|
||||
}
|
||||
|
||||
private void butSend_click(Object source, Event e)
|
||||
{
|
||||
int[] indices = lbPlayers.getSelectedIndices();
|
||||
String logins[] = new String[indices.length];
|
||||
double scores[] = new double[indices.length];
|
||||
Double tmpDouble = null;
|
||||
|
||||
|
||||
for(int i = 0; i < indices.length; i++)
|
||||
{
|
||||
logins[i] = new String((String)lbPlayers.getItem(indices[i]));
|
||||
try
|
||||
{
|
||||
tmpDouble = new Double((String)lbResults.getItem(indices[i]));
|
||||
}
|
||||
catch( NumberFormatException exp )
|
||||
{
|
||||
/* TODO: Error dialog... */
|
||||
}
|
||||
scores[i] = tmpDouble.doubleValue();
|
||||
}
|
||||
|
||||
|
||||
_setStatusMessage("Connecting to games2.westwood.com:4608...");
|
||||
RenegadeNet net = new RenegadeNet(this);
|
||||
net.sendGameResults(logins, scores);
|
||||
}
|
||||
|
||||
|
||||
public void grDoneCallback(int packetlen)
|
||||
{
|
||||
if( packetlen <= 0 )
|
||||
_setStatusMessage("ERROR: " + packetlen + " (The server may be down)");
|
||||
else
|
||||
_setStatusMessage("Sent " + packetlen + " bytes to server successfully.");
|
||||
}
|
||||
|
||||
|
||||
private void _setStatusMessage(String s)
|
||||
{
|
||||
(statusBar.getPanels())[0].setText(s);
|
||||
}
|
||||
|
||||
private void setupMenu_click(Object source, Event e)
|
||||
{
|
||||
ClientSetup myClientSetup = new ClientSetup();
|
||||
myClientSetup.showDialog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NOTE: The following code is required by the Visual J++ form
|
||||
* designer. It can be modified using the form editor. Do not
|
||||
* modify it using the code editor.
|
||||
*/
|
||||
|
||||
Container components = new Container();
|
||||
MainMenu mainMenu1 = new MainMenu();
|
||||
MenuItem fileMenu = new MenuItem();
|
||||
MenuItem openMenu = new MenuItem();
|
||||
MenuItem saveMenu = new MenuItem();
|
||||
MenuItem seperator3Menu = new MenuItem();
|
||||
MenuItem exitMenu = new MenuItem();
|
||||
Label label1 = new Label();
|
||||
MenuItem helpMenu = new MenuItem();
|
||||
MenuItem aboutMenu = new MenuItem();
|
||||
MenuItem saveAsMenu = new MenuItem();
|
||||
StatusBar statusBar = new StatusBar();
|
||||
StatusBarPanel mainStatusBarPanel = new StatusBarPanel();
|
||||
ListBox lbResults = new ListBox();
|
||||
ToolBar toolBar = new ToolBar();
|
||||
ToolBarButton openToolBarButton = new ToolBarButton();
|
||||
ToolBarButton saveToolBarButton = new ToolBarButton();
|
||||
ToolBarButton toolBarButton1 = new ToolBarButton();
|
||||
ImageList toolBarImageList = new ImageList();
|
||||
Label label2 = new Label();
|
||||
Button butSend = new Button();
|
||||
Button butSimulate = new Button();
|
||||
ListBox lbPlayers = new ListBox();
|
||||
GroupBox groupBox1 = new GroupBox();
|
||||
Button butSelectToggle = new Button();
|
||||
MenuItem setupMenu = new MenuItem();
|
||||
MenuItem menuItem1 = new MenuItem();
|
||||
ToolBarButton setupToolBarButton = new ToolBarButton();
|
||||
|
||||
private void initForm()
|
||||
{
|
||||
// NOTE: This form is storing resource information in an
|
||||
// external file. Do not modify the string parameter to any
|
||||
// resources.getObject() function call. For example, do not
|
||||
// modify "foo1_location" in the following line of code
|
||||
// even if the name of the Foo object changes:
|
||||
// foo1.setLocation((Point)resources.getObject("foo1_location"));
|
||||
|
||||
IResourceManager resources = new ResourceManager(this, "RenegadeSim");
|
||||
openMenu.setShortcut(Shortcut.CTRL_O);
|
||||
openMenu.setText("&Open Results...");
|
||||
openMenu.addOnClick(new EventHandler(this.doOpen));
|
||||
|
||||
saveMenu.setShortcut(Shortcut.CTRL_S);
|
||||
saveMenu.setText("&Save Results...");
|
||||
saveMenu.addOnClick(new EventHandler(this.saveMenu_click));
|
||||
|
||||
seperator3Menu.setText("-");
|
||||
|
||||
exitMenu.setText("E&xit");
|
||||
exitMenu.addOnClick(new EventHandler(this.exitMenu_click));
|
||||
|
||||
label1.setLocation(new Point(16, 16));
|
||||
label1.setSize(new Point(72, 16));
|
||||
label1.setTabIndex(2);
|
||||
label1.setTabStop(false);
|
||||
label1.setText("Players:");
|
||||
label1.addOnClick(new EventHandler(this.label1_click));
|
||||
|
||||
aboutMenu.setText("&About...");
|
||||
aboutMenu.addOnClick(new EventHandler(this.aboutMenu_click));
|
||||
|
||||
helpMenu.setMenuItems(new MenuItem[] {
|
||||
aboutMenu});
|
||||
helpMenu.setText("&Help");
|
||||
|
||||
saveAsMenu.setText("Save &As...");
|
||||
saveAsMenu.addOnClick(new EventHandler(this.saveAsMenu_click));
|
||||
|
||||
mainStatusBarPanel.setAutoSize(StatusBarPanelAutoSize.SPRING);
|
||||
mainStatusBarPanel.setWidth(256);
|
||||
|
||||
statusBar.setBackColor(Color.CONTROL);
|
||||
statusBar.setLocation(new Point(0, 289));
|
||||
statusBar.setSize(new Point(272, 20));
|
||||
statusBar.setTabIndex(1);
|
||||
statusBar.setText("");
|
||||
statusBar.setShowPanels(true);
|
||||
statusBar.setPanels(new StatusBarPanel[] {
|
||||
mainStatusBarPanel});
|
||||
|
||||
lbResults.setLocation(new Point(120, 32));
|
||||
lbResults.setSize(new Point(128, 147));
|
||||
lbResults.setTabIndex(1);
|
||||
lbResults.setText("listBox1");
|
||||
lbResults.setUseTabStops(true);
|
||||
lbResults.setItems(new Object[] {
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--",
|
||||
"--"});
|
||||
|
||||
openToolBarButton.setImageIndex(1);
|
||||
openToolBarButton.setToolTipText("Open Results");
|
||||
|
||||
saveToolBarButton.setImageIndex(2);
|
||||
saveToolBarButton.setToolTipText("Save Results");
|
||||
|
||||
toolBarButton1.setStyle(ToolBarButtonStyle.SEPARATOR);
|
||||
toolBarButton1.setText("toolBarButton4");
|
||||
|
||||
toolBarImageList.setImageSize(new Point(16, 15));
|
||||
toolBarImageList.setImageStream((ImageListStreamer)resources.getObject("toolBarImageList_imageStream"));
|
||||
/* @designTimeOnly toolBarImageList.setLocation(new Point(176, 8)); */
|
||||
|
||||
label2.setLocation(new Point(120, 16));
|
||||
label2.setSize(new Point(48, 16));
|
||||
label2.setTabIndex(3);
|
||||
label2.setTabStop(false);
|
||||
label2.setText("Results:");
|
||||
|
||||
butSend.setLocation(new Point(184, 256));
|
||||
butSend.setSize(new Point(80, 23));
|
||||
butSend.setTabIndex(3);
|
||||
butSend.setText("Send Results");
|
||||
butSend.addOnClick(new EventHandler(this.butSend_click));
|
||||
|
||||
butSimulate.setLocation(new Point(128, 216));
|
||||
butSimulate.setSize(new Point(128, 16));
|
||||
butSimulate.setTabIndex(2);
|
||||
butSimulate.setText("Simulate Game Results");
|
||||
butSimulate.addOnClick(new EventHandler(this.butSimulate_click));
|
||||
|
||||
lbPlayers.setLocation(new Point(16, 32));
|
||||
lbPlayers.setSize(new Point(88, 147));
|
||||
lbPlayers.setTabIndex(0);
|
||||
lbPlayers.setText("listBox1");
|
||||
lbPlayers.setSelectionMode(SelectionMode.MULTI_SIMPLE);
|
||||
lbPlayers.setUseTabStops(true);
|
||||
lbPlayers.setItems(new Object[] {
|
||||
"test1",
|
||||
"test5",
|
||||
"test7",
|
||||
"test8",
|
||||
"test9",
|
||||
"test13",
|
||||
"test14",
|
||||
"test16",
|
||||
"noxstinky",
|
||||
"goodmach"});
|
||||
lbPlayers.addOnSelectedIndexChanged(new EventHandler(this.lbPlayers_selectedIndexChanged));
|
||||
|
||||
groupBox1.setLocation(new Point(8, 32));
|
||||
groupBox1.setSize(new Point(256, 216));
|
||||
groupBox1.setTabIndex(6);
|
||||
groupBox1.setTabStop(false);
|
||||
groupBox1.setText("Renegade Game Simulator");
|
||||
|
||||
butSelectToggle.setLocation(new Point(16, 184));
|
||||
butSelectToggle.setSize(new Point(88, 16));
|
||||
butSelectToggle.setTabIndex(4);
|
||||
butSelectToggle.setText("Select All / None");
|
||||
butSelectToggle.addOnClick(new EventHandler(this.butSelectToggle_click));
|
||||
|
||||
setupMenu.setText("&Client Setup");
|
||||
setupMenu.addOnClick(new EventHandler(this.setupMenu_click));
|
||||
|
||||
menuItem1.setText("-");
|
||||
|
||||
fileMenu.setMenuItems(new MenuItem[] {
|
||||
openMenu,
|
||||
saveMenu,
|
||||
saveAsMenu,
|
||||
seperator3Menu,
|
||||
setupMenu,
|
||||
menuItem1,
|
||||
exitMenu});
|
||||
fileMenu.setText("&File");
|
||||
|
||||
mainMenu1.setMenuItems(new MenuItem[] {
|
||||
fileMenu,
|
||||
helpMenu});
|
||||
/* @designTimeOnly mainMenu1.setLocation(new Point(80, 8)); */
|
||||
|
||||
this.setAnchor(ControlAnchor.ALL);
|
||||
this.setLocation(new Point(298, 88));
|
||||
this.setText("Renegade Simulator Applet");
|
||||
this.setAutoScaleBaseSize(new Point(5, 13));
|
||||
this.setBorderStyle(FormBorderStyle.FIXED_TOOLWINDOW);
|
||||
this.setClientSize(new Point(272, 309));
|
||||
this.setMaximizeBox(false);
|
||||
this.setMenu(mainMenu1);
|
||||
this.addOnClick(new EventHandler(this.RenegadeSim_click));
|
||||
|
||||
setupToolBarButton.setImageIndex(4);
|
||||
setupToolBarButton.setToolTipText("Client Setup");
|
||||
|
||||
toolBar.setSize(new Point(272, 25));
|
||||
toolBar.setTabIndex(0);
|
||||
toolBar.setButtons(new ToolBarButton[] {
|
||||
openToolBarButton,
|
||||
saveToolBarButton,
|
||||
toolBarButton1,
|
||||
setupToolBarButton});
|
||||
toolBar.setDropDownArrows(true);
|
||||
toolBar.setImageList(toolBarImageList);
|
||||
toolBar.setShowToolTips(true);
|
||||
toolBar.addOnButtonClick(new ToolBarButtonClickEventHandler(this.toolBar_buttonClick));
|
||||
|
||||
this.setNewControls(new Control[] {
|
||||
butSimulate,
|
||||
butSend,
|
||||
groupBox1,
|
||||
toolBar,
|
||||
statusBar});
|
||||
groupBox1.setNewControls(new Control[] {
|
||||
butSelectToggle,
|
||||
label2,
|
||||
label1,
|
||||
lbResults,
|
||||
lbPlayers});
|
||||
}
|
||||
|
||||
/**
|
||||
* The main entry point for the application.
|
||||
*
|
||||
* @param args Array of parameters passed to the application
|
||||
* via the command line.
|
||||
*/
|
||||
public static void main(String args[])
|
||||
{
|
||||
Application.run(new RenegadeSim());
|
||||
}
|
||||
|
||||
public static final int VK_CAPITAL = 0x14;
|
||||
public static final int VK_NUMLOCK = 0x90;
|
||||
/**
|
||||
* @dll.import("USER32",auto)
|
||||
*/
|
||||
public static native short GetKeyState(int nVirtKey);
|
||||
}
|
||||
13
Code/Tools/RenegadeSim/RenegadeSim.sln
Normal file
13
Code/Tools/RenegadeSim/RenegadeSim.sln
Normal file
@@ -0,0 +1,13 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 1.00
|
||||
Project("{66355F20-A65B-11D0-BFB5-00A0C91EBFA0}") = "RenegadeSim", "RenegadeSim.vjp", "{D7DCC2E1-0B15-11D4-A510-006008055BB5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(LocalDeployment) = postSolution
|
||||
StartupProject = {D7DCC2E1-0B15-11D4-A510-006008055BB5}
|
||||
EndGlobalSection
|
||||
GlobalSection(BuildOrder) = postSolution
|
||||
0 = {D7DCC2E1-0B15-11D4-A510-006008055BB5}
|
||||
EndGlobalSection
|
||||
GlobalSection(DeploymentRoot) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Code/Tools/RenegadeSim/RenegadeSim.vjp
Normal file
BIN
Code/Tools/RenegadeSim/RenegadeSim.vjp
Normal file
Binary file not shown.
Reference in New Issue
Block a user