Skip to content

Commit d29095d

Browse files
committed
Remove all remnants of Multiplayer
1 parent 9c1fae6 commit d29095d

File tree

4 files changed

+24
-64
lines changed

4 files changed

+24
-64
lines changed

src/com/redomar/game/Game.java

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
import com.redomar.game.entities.Dummy;
44
import com.redomar.game.entities.Player;
5-
import com.redomar.game.entities.PlayerMP;
65
import com.redomar.game.entities.Vendor;
76
import com.redomar.game.gfx.Screen;
87
import com.redomar.game.gfx.SpriteSheet;
98
import com.redomar.game.level.LevelHandler;
109
import com.redomar.game.lib.Font;
1110
import com.redomar.game.lib.Music;
1211
import 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;
1612
import com.redomar.game.script.PrintTypes;
1713
import com.redomar.game.script.Printing;
1814
import 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);

src/com/redomar/game/WindowHandler.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import java.awt.event.WindowEvent;
44
import java.awt.event.WindowListener;
55

6-
import com.redomar.game.net.packets.Packet01Disconnect;
7-
86
public class WindowHandler implements WindowListener {
97

108
@SuppressWarnings("unused")
@@ -27,9 +25,7 @@ public void windowClosed(WindowEvent event) {
2725

2826
@Override
2927
public void windowClosing(WindowEvent event) {
30-
Packet01Disconnect packet = new Packet01Disconnect(Game.getPlayer()
31-
.getUsername());
32-
packet.writeData(Game.getSocketClient());
28+
3329
}
3430

3531
@Override

src/com/redomar/game/entities/Player.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public void tick() {
101101
(int) this.getX(), (int) this.getY(), this.numSteps, this.isMoving,
102102
this.movingDir);
103103
Game.getGame();
104-
packet.writeData(Game.getSocketClient());
105104

106105
} else {
107106
isMoving = false;

src/com/redomar/game/level/LevelHandler.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.redomar.game.level;
22

3-
import com.redomar.game.Game;
43
import com.redomar.game.entities.Entity;
54
import com.redomar.game.entities.Player;
65
import com.redomar.game.entities.PlayerMP;
76
import com.redomar.game.gfx.Screen;
87
import com.redomar.game.level.tiles.Tile;
98
import com.redomar.game.lib.utils.Vector2i;
10-
import com.redomar.game.net.packets.Packet01Disconnect;
119
import com.redomar.game.scenes.Scene;
1210
import com.redomar.game.script.PrintTypes;
1311
import com.redomar.game.script.Printing;
@@ -210,15 +208,13 @@ public void removeProjectileEntities(Entity entity) {
210208
public void removeEntity(String username) {
211209
int index = 0;
212210
for (Entity e : entities) {
213-
if (e instanceof PlayerMP
214-
&& ((PlayerMP) e).getUsername().equalsIgnoreCase(username)) {
211+
if (e instanceof Player
212+
&& ((Player) e).getUsername().equalsIgnoreCase(username)) {
215213
break;
216214
}
217215
index++;
218216
}
219217
this.entities.remove(index);
220-
Packet01Disconnect packet = new Packet01Disconnect(Game.getPlayer().getUsername());
221-
packet.writeData(Game.getSocketClient());
222218
}
223219

224220
private int getPlayerMPIndex(String username) {

0 commit comments

Comments
 (0)