22
33import com .redomar .game .entities .Dummy ;
44import com .redomar .game .entities .Player ;
5- import com .redomar .game .entities .PlayerMP ;
65import com .redomar .game .entities .Vendor ;
76import com .redomar .game .gfx .Screen ;
87import com .redomar .game .gfx .SpriteSheet ;
98import com .redomar .game .level .LevelHandler ;
109import com .redomar .game .lib .Font ;
1110import com .redomar .game .lib .Music ;
1211import com .redomar .game .lib .Time ;
13- import com .redomar .game .net .GameClient ;
14- import com .redomar .game .net .GameServer ;
15- import com .redomar .game .net .packets .Packet00Login ;
1612import com .redomar .game .script .PrintTypes ;
1713import com .redomar .game .script .Printing ;
1814import org .apache .commons .lang3 .text .WordUtils ;
@@ -55,7 +51,6 @@ public class Game extends Canvas implements Runnable {
5551 private static boolean running = false ;
5652 private static InputHandler input ;
5753 private static MouseHandler mouse ;
58- private static GameClient socketClient ;
5954 private static InputContext context ;
6055 private int tickCount = 0 ;
6156 private BufferedImage image = new BufferedImage (WIDTH , HEIGHT ,
@@ -78,7 +73,6 @@ public class Game extends Canvas implements Runnable {
7873 private boolean notActive = true ;
7974 private boolean noAudioDevice = false ;
8075 private int trigger = 0 ;
81- private GameServer socketServer ;
8276 private Printing print = new Printing ();
8377
8478 /**
@@ -126,14 +120,6 @@ public static void setFrame(JFrame frame) {
126120 Game .frame = frame ;
127121 }
128122
129- public static GameClient getSocketClient () {
130- return socketClient ;
131- }
132-
133- public void setSocketClient (GameClient socketClient ) {
134- Game .socketClient = socketClient ;
135- }
136-
137123 public static Player getPlayer () {
138124 return game .player ;
139125 }
@@ -186,25 +172,6 @@ public static int getMap() {
186172 return map ;
187173 }
188174
189- public void setMap (String Map_str ) {
190- setLevel (new LevelHandler (Map_str ));
191- if (alternateCols [0 ]) {
192- Game .setShirtCol (240 );
193- }
194- if (!alternateCols [0 ]) {
195- Game .setShirtCol (111 );
196- }
197- if (alternateCols [1 ]) {
198- Game .setFaceCol (310 );
199- }
200- if (!alternateCols [1 ]) {
201- Game .setFaceCol (543 );
202- }
203- setPlayer (new PlayerMP (level , 100 , 100 , input ,
204- getJdata_UserName (), null , -1 , shirtCol , faceCol ));
205- level .addEntity (player );
206- }
207-
208175 public static void setMap (int map ) {
209176 Game .map = map ;
210177 }
@@ -317,6 +284,25 @@ public static void setClosing(boolean closing) {
317284 Game .closingMode = closing ;
318285 }
319286
287+ public void setMap (String Map_str ) {
288+ setLevel (new LevelHandler (Map_str ));
289+ if (alternateCols [0 ]) {
290+ Game .setShirtCol (240 );
291+ }
292+ if (!alternateCols [0 ]) {
293+ Game .setShirtCol (111 );
294+ }
295+ if (alternateCols [1 ]) {
296+ Game .setFaceCol (310 );
297+ }
298+ if (!alternateCols [1 ]) {
299+ Game .setFaceCol (543 );
300+ }
301+ setPlayer (new Player (level , 100 , 100 , input ,
302+ getJdata_UserName (), shirtCol , faceCol ));
303+ level .addEntity (player );
304+ }
305+
320306 public void init () {
321307 setGame (this );
322308 int index = 0 ;
@@ -337,15 +323,6 @@ public void init() {
337323 setWindow (new WindowHandler (this ));
338324 setMap ("/levels/custom_level.png" );
339325 setMap (1 );
340- Packet00Login loginPacket = new Packet00Login (player .getUsername (),
341- (int ) player .getX (), (int ) player .getY ());
342-
343- if (socketServer != null ) {
344- socketServer .addConnection ((PlayerMP ) getPlayer (), loginPacket );
345- }
346-
347- // socketClient.sendData("ping".getBytes());
348- loginPacket .writeData (getSocketClient ());
349326
350327 game .setVendor (new Vendor (level , "Vendor" , 215 , 215 , 304 , 543 ));
351328 level .addEntity (getVendor ());
@@ -354,14 +331,6 @@ public void init() {
354331 public synchronized void start () {
355332 Game .setRunning (true );
356333 new Thread (this , "GAME" ).start ();
357-
358- if (getJdata_Host () == 0 ) {
359- socketServer = new GameServer (this );
360- socketServer .start ();
361- }
362-
363- setSocketClient (new GameClient (this , getJdata_IP ()));
364- getSocketClient ().start ();
365334 }
366335
367336 public synchronized void stop () {
@@ -455,8 +424,8 @@ public void render() {
455424 }
456425 }
457426
458- if (noAudioDevice == false ) {
459- if (input .isPlayMusic () == true && notActive == true ) {
427+ if (! noAudioDevice ) {
428+ if (input .isPlayMusic () && notActive == true ) {
460429 int musicOption = JOptionPane .showConfirmDialog (this ,
461430 "You are about to turn on music and can be VERY loud" ,
462431 "Music Options" , 2 , 2 );
0 commit comments