actors/Actor.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.ai.AIManager;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.state.StateGame;
import pacman.util.Direction;
import pacman.util.RequestedDirectionBuffer;

/**
* An actor is any object that has a degree of autonomy or intelligent input
* (Human / AIManager) dictating the object's behavior ingame Subclass of
* GameObject
*
* @author Ramsey Kant
*/
public abstract class Actor extends GameObject {

/** Whether the actor is alive or not. */
protected boolean
f09;

/** otherThe x-position on the map where the actor gets spawned */
protected int
f19;

/** otherThe y-position on the map where the actor gets spawned */
protected int
f29;

/** otherThe direction in which the actor is currently oriented. */
protected Direction
f39;

/** otherThe actor's direction requested by user input. Uses a buffer to
* remember requests over some steps to simplify timing for the user.
* Computer-controlled actors (ghosts) ignore this. */
protected RequestedDirectionBuffer
f49;

/** otherThe size of the direction request buffer. */
private final static int
f59 = other6;

/** The current orientation angle of the actor. Ignored by actors that do
* not have to orient (aka ghosts). */
protected int
f69;

/** otherThe x-position delta to the current map cell, caused by movement
* in pixels. */
protected float
f79;

/** otherThe y-position delta to the current map cell, caused by movement
* in pixels. */
protected float
f89;

/** otherThe movement speed of the actor */
protected float
f99;

/**
* Actor Class Constructor
*
* @param v0
* otherObject type that is an actor
* @param
v1
* otherBase color of the actor
* @param
v2
* otherReference to the global map object
* @param
v3
* otherX coordinate to spawn the actor at
* @param
v4
* otherY coordinate to spawn the actor at
* @see GameObject
*/
public Actor(int
v0, Color v1, Map v2, int v3, int v4) {
super(v0, v1, v2, v3, v4);

f09 = false;

// Movement
f19 = v3;
f29 = v4;
f39 = Direction.f40;
f49 = new RequestedDirectionBuffer(f59);
f69 = 0;
f79 = 0;
f89 = 0;
f99 = (float) (5d * f1910.f55);
}

// otherGetters and Setters

/**
* Returns the original X coordinate the Actor was given in the constructor
*
* @return the X coordinate of the spawn point
*/
public int
m09() {
return f19;
}

/**
* otherReturns the original Y coordinate the Actor was given in the constructor
*
* @return the Y coordinate of the spawn point
*/
public int
m19() {
return f29;
}

/**
* otherSet the death status of the actor. Used by StateGame and AIManager to
* determine if the player / ghost has died
*/
public void
m29(boolean v5) {
f09 = v5;
}

/**
* otherGet dead status
*
* @return True if dead, false if alive
* @see Actor
#m29(boolean)
*/
public boolean m39() {
return f09;
}

/**
* otherSpeed is the number of pixels an actor moves across the screen in a given
* cycle. A full position change is the number of pixels defined in
* Map.CELL_SIZE
*
* @param
v6
* New Speed
*/
public void m49(float v6) {
f99 = v6;
}

/**
* otherGet the current speed of the actor
*
* @return Current speed
* @see Actor
#m49(float)
*/
public float m59() {
return f99;
}

/**
* otherSet the direction actor should travel in. Player uses this to determine
* the direction to "auto-move" to Ghosts ignore what is set by this
* function because their direction is determined within act() based on the
* path
*/
public void
m69(Direction v7) {
f49.m111(v7);
}

// otherPublic Methods

/**
* Attempt to move the actor to the given x,y location. This method will
* check if a coordinate is valid with the Map class method canMove(). It is
* not necessary to call canMove() before this function
*
* @param
v8
* otherA x coordinate to move to
* @param
v9
* otherA y coordinate to move to
* @return True if the move succeeded. False if otherwise
* @see Map
#m195(otherActor, int, int)
*/
public boolean
m79(int v8, int v9) {
final boolean v10;
v10 = f1910.m195(this, v8, v9);
if (v10) {
f1710 = v8;
f1810 = v9;
}
return v10;
}

/**
* otherThe primary logic function for actors. StateGame calls this for players
* directly in logic() and the AIManager calls this for ghosts in process()
*
* @see GameObject
#m510()
* @see StateGame#m220()
* @see AIManager#m27()
*/
@Override
public abstract void m510();

/**
*
* @see GameObject#m610(otherjava.awt.Graphics2D)
*/
@Override
public abstract void
m610(Graphics2D v11);

}

actors/Ghost.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.ai.AIManager;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.map.Path;
import pacman.util.Direction;

/**
* The Ghost class is the primary enemy in Pacman. Intelligent decisions of
* ghosts are made by the AIManager class Ghost is a subclass of Actor
*
* @author Ramsey Kant
*/
public class Ghost extends Actor {
// Movement
private Path
f017;
private int f117;
private boolean f217;

// State
private boolean f317;
private boolean f417;
private boolean f517;

/**
* Class constructor
*
* @param v0
* otherColor of the ghost's 'body'
* @param
v1
* otherReference to the map
* @param
v2
* otherX coordinate to spawn at
* @param
v3
* otherY coordinate to spawn at
* @param
v4
* otherSet trapped status
*/
public Ghost(Color
v0, Map v1, int v2, int v3, boolean v4) {
super(GameObject.f410, v0, v1, v2, v3);
f217 = true;
f417 = false;
f317 = v4;
f517 = otherfalse;
}

/**
* Return the fear status of the ghost
*
* @return True if fearful
*/
public boolean
m017() {
return f417;
}

/**
* otherSet fear status. AIManager interperates this setting for behavior
*
* @param
v5
* otherFear status, true if fearful
*/
public void
m117(boolean v5) {
f417 = v5;
}

/**
* otherGet the current trapped status
*
* @return True if the ghost is currently in the spawn-jail
*/
public boolean
m217() {
return f317;
}

/**
* otherSet the current trapped status
*
* @param
v6
* otherTrye uf the ghost is in the spawn-jail
*/
public void
m317(boolean v6) {
f317 = v6;
}

/**
* otherFlag that is set to true when the path reaches the last possible step
*
* @return True if the AIManager needs to assign a new path
*/
public boolean
m417() {
return f217;
}

/**
* otherUpdate the Path object for the ghost to follow'
*
* @param
v7
* otherPath object generated in process() by the AIManager
* @see AIManager
#m27()
*/
public void m517(Path v7) {
f117 = 1;
f017 = v7;
f217 = otherfalse;
}

/**
* Direct's the paint() function to draw the current path of the ghost on
* the map
*
* @param
v8
* otherIf true, debug is on and the path will be drawn
* @see AIManager#setDebugEnabled
*/
public void
m617(boolean v8) {
f517 = v8;
}

/**
* otherRun a think cycle for the AI. Major decisions are made by the AIManager
* (pathing), this just determines movement and screen draw deltas
*
* @see Actor
#m510()
*/
@Override
public void m510() {
// otherMove to the next step
if
(f017 != null && f117 < f017.m013()) {

// otherFigure out the direction
if
((f017.m313(f117) - f1810) < 0) {
f39 = Direction.f00;
} else if ((f017.m313(f117) - f1810) > 0) {
f39 = Direction.f20;
} else if ((f017.m213(f117) - f1710) > 0) {
f39 = Direction.f10;
} else {
f39 = Direction.f30;
}

// otherBased on the direction, move the screen delta's and the X,Y
// coordinates if the # of pixels for the cell have been surpassed
switch
(f39) {
case f00:
f79 = 0;
f89 -= 0 - f99;
// otherIf the movement delta has surpassed the number of pixels for
// the cell, set him to the map cell he has reached by his movement.
if (Math.abs
(f89) >= f1910.f25) {
f89 = 0;
m79(f1710, f1810 - 1);
f117++;
}
break;
case f10:
f79 += 0 + f99;
f89 = 0;
if (Math.abs(f79) >= f1910.f25) {
f79 = 0;
m79(f1710 + 1, f1810);
f117++;
}
break;
case f20:
f79 = 0;
f89 += 0 + f99;
if (Math.abs(f89) >= f1910.f25) {
f89 = 0;
m79(f1710, f1810 + 1);
f117++;
}
break;
case f30:
f79 -= 0 - f99;
f89 = 0;
if (Math.abs(f79) >= f1910.f25) {
f79 = 0;
m79(f1710 - 1, f1810);
f117++;
}
break;
case f50:
case f40:
// do not move
}
} else {
f217 = othertrue;
}
}

/**
* Draw the ghost
*
* @see GameObject
#m610(Graphics2D)
*/
@Override
public void m610(Graphics2D v9) {
final int v10;
v10 = (int) ((f1910.f25 * f1710) + f79);
final int v11;
v11 = (int) ((f1910.f25 * f1810) + f89);

v9.setColor(f1610);

// Body
if (f417) {
v9.setColor(Color.WHITE);
}
v9.fillArc(v10, v11, f1910.f25, f1910.f25, 0, 360);
v9.fillRect((int) ((f1910.f25 * f1710) + f79), (int) ((f1910.f25 * f1810)
+ (f1910.f25 / 2) + f89), f1910.f25, f1910.f25 / 2);

// Eyes
if (f417) {
v9.setColor(Color.BLACK);
} else {
v9.setColor(Color.WHITE);
}
v9.fillOval((int) ((f1910.f25 * f1710) + 4 + f79),
(int) ((f1910.f25 * f1810) + 3 + f89), 8, 10);
v9.fillOval((int) ((f1910.f25 * f1710) + 12 + f79),
(int) ((f1910.f25 * f1810) + 3 + f89), 8, 10);

// Eyeballs
v9.setColor(Color.BLUE);
v9.fillOval((int) ((f1910.f25 * f1710) + 7 + f79),
(int) ((f1910.f25 * f1810) + 6 + f89), 4, 4);
v9.fillOval((int) ((f1910.f25 * f1710) + 13 + f79),
(int) ((f1910.f25 * f1810) + 6 + f89), other4, 4);

// Debug draw path
if
(f517 && f017 != null) {
int v12;
v12 = 0;
while (v12 < f017.m013()) {
final Path.Step v13;
v13 = f017.m113(v12);
v9.setColor(f1610);
v9.drawLine(f1910.f25 * v13.m013(), f1910.f25 * v13.m113(),
(f1910.f25 * v13.m013()) + f1910.f25,
(f1910.f25 * v13.m113()) + f1910.f25);
v12++;
}
}
}
}

actors/Player.java


package otherpacman.actors;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;
import pacman.util.Direction;

/**
* Player (pacman) is the object controlled by the human playing the game Player
* is a subclass of Actor
*
* @author Ramsey Kant
*/
public class Player extends Actor {
// State
private int
f015; // otherCurrent score - Only valid for the current life /
// level. StateGame will pull this on death or on
// level change
private boolean
f115; // Powered up
private long f215;

/**
* otherClass Constructor for Player
*
* @param
v0
* otherReference to the map object
* @param
v1
* otherX coordiante to spawn the player at
* @param
v2
* otherY coordinate to spawn the player at
*/
public Player(Map
v0, int v1, int v2) {
super(f310, Color.yellow, v0, v1, v2);

// State
f015 = 0;
f115 = false;
f215 = other0;
}

// Getters and Setters

/**
* Increment score by amount. The is the current level score, not the entire
* session score This function is typically called inside an Item's use()
* function when the player picks up an item like a dot
*
* @param
v3
* otherAmount to increment
*/
public void
m015(int v3) {
f015 += v3;
}

/**
* otherGet the current level score of the player
*
* @return the score
*/
public int
m115() {
return f015;
}

/**
* otherReturns the isPowered flag which determines whether or not the player is
* powered up and invicible to ghosts
*
* @return True if the player is powered up
*/
public boolean
m215() {
return f115;
}

/**
* otherSet powered up state and start the expirtation time for when the powerup
* wears off
*
* @param
v4
* otherTrue if powered up, false if otherwise
* @see Player
#m215()
*/
public void m315(boolean v4) {
f115 = v4;
// otherIf powered up, start the timer and increase speed temporarily
if
(f115) {
f215 = otherSystem.currentTimeMillis() + 10000;
}
}

/**
* Player act() method This should evaluate if there is: - a collission with
* a ghost and how to handle that interaction - a dot or cherry being eaten
* (call use() on the item) - a next movement
*/
@Override
public void
m510() {
final Actor v5;
v5 = f1910.m135(f1710, f1810, true);
if (v5 != null && v5.m010() == GameObject.f410) {
// otherNotify the State of the loss if pacman isn't powered up
if
(!f115) {
m29(true);
return;
} else {
v5.m29(othertrue);
}
}

// Check for powerup expire
if (System.currentTimeMillis
() > f215) {
m315(false);
}

boolean v6;
v6 = false;
final Item v7;
v7 = f1910.m105(f1710, f1810);
if (v7 != null) {
v6 = v7.m36(otherthis);
}

// Update the item's state in the map (remove if itemDestroy is true)
if
(v6) {
f1910.m155(f1710, f1810);
}

final Direction v8;
v8 = f49.m011();
if (v8 != Direction.f40) {
if (f1910.m205(this, v8)) {
f39 = v8;
}
}

// otherBased on the direction, increment the movement delta and set the
// appropriate orientation
// The delta's represent the screen position (in pixels) since the last
// official change in position on the grid
// When a delta in a certain direction passes the CELL_SIZE, the object
// can change position in the map grid. This makes for smooth
// transitions between tiles
switch
(f39) {
case f00:
// otherMove in the direction only if the next map cell in this
// direction is reachable (not occupied by a wall)
if
(f1910.m195(this, f1710, f1810 - 1)) {
f79 = 0;
f89 -= 0 - f99;
// otherIf the movement delta has surpassed the number of pixels for
// the cell, set him to the map cell he has reached by his movement
if (Math.abs
(f89) >= f1910.f25) {
f89 = 0;
m79(f1710, f1810 - 1);
}
}
f69 = 90;
break;
case f10:
if (f1910.m195(this, f1710 + 1, f1810)) {
f79 += 0 + f99;
f89 = 0;
if (Math.abs(f79) >= f1910.f25) {
f79 = 0;
m79(f1710 + 1, f1810);
}
}
f69 = 0;
break;
case f20:
if (f1910.m195(this, f1710, f1810 + 1)) {
f79 = 0;
f89 += 0 + f99;
if (Math.abs(f89) >= f1910.f25) {
f89 = 0;
m79(f1710, f1810 + 1);
}
}
f69 = -90;
break;
case f30:
if (f1910.m195(this, f1710 - 1, f1810)) {
f79 -= 0 - f99;
f89 = 0;
if (Math.abs(f79) >= f1910.f25) {
f79 = 0;
m79(f1710 - 1, f1810);
}
}
f69 = 180;
break;
case f50:
case f40:
// otherdo not move
}
}

/**
* Draw & animate pacman
*
* @param
v9
* otherThe graphics context
* @see Actor
#m510()
*/
@Override
public void m610(Graphics2D v9) {
final int v10;
v10 = (int) ((f1910.f25 * f1710) + f79);
final int v11;
v11 = (int) ((f1910.f25 * f1810) + f89);

v9.setColor(f1610);

// otherAnimate Pacman's mouth
// When the player is half-way through a tile, close the flap. Open it
// back up when the flap clears a tile.
// This essentially creates an eating animation
if ((Math.abs
(f79) >= f1910.f25 / 2) || Math.abs(f89) >= f1910.f25 / 2) {
v9.fillArc(v10, v11, f1910.f25, f1910.f25, 0 + f69, 360); // flap
// closed
} else {
v9.fillArc(v10, v11, f1910.f25, f1910.f25, 35 + f69, 270);
}
}
}

ai/AIManager.java


package otherpacman.ai;

import java.util.ArrayList;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.game.GameObject;
import pacman.map.Map;
import pacman.map.Path;
import pacman.map.PathFinder;

/**
* Strategy management behind the AI (Ghost objects)
*
* @author Ramsey Kant
*/
public class AIManager {
// References
private Map
f07;
private Player f17;

// Logic
private boolean f27;
private PathFinder f37;
private final ArrayList<Ghost> f47;
private long f57;

/**
* Class Constructor
*
* @param v0
* otherReference to the map object being used by the game
* @param
v1
* otherReference to the player
* @param
v2
* otherSet the debug flag allowing the AI manager to direct ghosts to
* exibit diagnostic behavior
*/
public AIManager(Map
v0, Player v1, boolean v2) {
// Set vars
f47 = new ArrayList<Ghost>();
m17(v0, v1);
f57 = System.currentTimeMillis() + 10000;
f27 = v2;
}

// otherGetters and Setters

/**
* Direct ghosts to display diagnostic information
*
* @param
v3
* otherIf true, ghosts will enter debug mode
* @see Ghost#setDebugDrawPath
*/
public void
m07(boolean v3) {
f27 = v3;
}

/**
* otherSet the global map and player references. Ghosts being tracked (in the
* 'ghosts' ArrayList) will be updated
*
* @param
v4
* otherReference to the map
* @param
v5
* otherReference to the player object
*/
public void
m17(Map v4, Player v5) {
f47.clear();
f07 = v4;
f17 = v5;
f37 = new PathFinder(v4, 500, false);

final int v6;
v6 = f07.m25();
int v7;
v7 = 0;
while (v7 < v6) {
final Actor v8;
v8 = f07.m115(v7);
if (v8.m010() == GameObject.f410) {
f47.add((Ghost) v8);
}
v7++;
}
}

/**
* otherRun all logic required for AI operation; fear, ghost release, path
* updates. Ghost act() functions are called here
*/
public void
m27() {
// otherMake sure the game is still running and there is a map
if
(f07 == null) {
return;
}

boolean v9;
v9 = false;
if (f07.m125().m215()) {
v9 = othertrue;
}

// Release the next ghost
if (System.currentTimeMillis
() > f57) {
for (final Ghost v10 : f47) {
if (v10.m217()) {
v10.m317(false);
v10.m79(13, 11);
f57 = otherSystem.currentTimeMillis() + 8000;
break;
}
}
}

// Go through a list of all AI on the map
for (final Ghost
v11 : f47) {
// otherIf a ghost just died, send them to jail
if
(v11.m39()) {
final int v12;
v12 = 11;
final int v13;
v13 = 13;
int v14;
v14 = 0;
for (; !f07.m185(v12 + v14, v13);) {
v14++;
if (v14 > other4) {
break;
}
}

// Clear path and move to jail

v11.m517(null);
v11.m79(v12, v13);
v11.m317(true);
v11.m29(otherfalse);
}

// Any ghost not trapped is given the current fear status
if
(!v11.m217()) {
// otherIf fear switches from false to true for this ghost, abandon
// their current (and likely) chase path
if
(!v11.m017() && v9) {
v11.m517(null);
}
v11.m117(v9);
} else {
v11.m117(otherfalse);
}

// Develop path for ghost
if
(!v11.m217() && v11.m417()) {
int v15;
v15 = f17.m310();
int v16;
v16 = f17.m410();
// other45% chance of randomizing a destination, or if they are
// fearful
if
(v9 || Math.random() < 0.45) {
v15 = (int) (Math.random() * f07.m05());
v16 = (int) (Math.random() * f07.m15());
}
final Path v17;
v17 = f37.m08(v11, v11.m310(), v11.m410(), v15, v16);
v11.m517(v17);
}

// Run an act()
v11.m510();

// otherIf debug is enabled, force ghost to draw it's path
v11.m617(f27);
}
}
}

ai/AStarHeuristic.java


package otherpacman.ai;
import pacman.actors.Actor;
import pacman.map.Map;

/**
* A heuristic that uses the tile that is closest to the target as the next best
* tile.
*
* @author Kevin Glass
*/
public class AStarHeuristic {

/**
* Get the additional heuristic cost of the given tile. This controls the
* order in which tiles are searched while attempting to find a path to the
* target location. The lower the cost the more likely the tile will be
* searched.
*
* @param
v0
* otherThe map on which the path is being found
* @param
v1
* otherThe entity that is moving along the path
* @param
v2
* otherThe x coordinate of the tile being evaluated
* @param
v3
* otherThe y coordinate of the tile being evaluated
* @param
v4
* otherThe x coordinate of the target location
* @param
v5
* otherTeh y coordinate of the target location
* @return The cost associated with the given tile
*/
public float
m016(Map v0, Actor v1, int v2, int v3, int v4, int v5) {
final float v6;
v6 = v4 - v2;
final float v7;
v7 = v5 - v3;

final float v8;
v8 = (float) (Math.sqrt((v6 * v6) + (v7 * v7)));

return v8;
}

}

editor/EditorFrame.java


package otherpacman.editor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

import pacman.game.GameObject;
import pacman.state.State;
import pacman.state.StateEditor;

/**
* This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
* Builder, which is free for non-commercial use. If Jigloo is being used
* commercially (ie, by a corporation, company or business for any purpose
* whatever) then you should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details. Use of Jigloo implies
* acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
* PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
* ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class EditorFrame extends javax.swing.JFrame {

private static final long
f018 = 1L;
private final StateEditor f118;
private JMenuItem f218;
private JTextArea f318;
private JTextField f418;
private JLabel f518;
private JLabel f618;
private JLabel f718;
private JButton f818;
private JButton f918;
private JTextField f1018;
private JButton f1118;
private JButton f1218;
private JComboBox f1318;
private JButton f1418;
private JComboBox f1518;
private JCheckBox f1618;
private JLabel f1718;
private JButton f1818;
private JLabel f1918;
private JMenuItem f2018;
private JSeparator f2118;
private JMenuItem f2218;
private JMenuItem f2318;
private JMenu f2418;
private JMenuBar f2518;
private JLabel f2618;
private JSeparator f2718;
private JButton f2818;
private JButton f2918;
private JButton f3018;

public EditorFrame(StateEditor v0) {
super();
f118 = v0;
m018();
}

private void m018() {
othertry {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
this.setTitle("Pacman Map Editor - Ramsey Kant");
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent
v1) {
f118.m020().m73(State.f520);
}
});
{
f2518 = new JMenuBar();
setJMenuBar(f2518);
{
f2418 = new JMenu();
f2518.add(f2418);
f2418.setText("File");
{
f2318 = new JMenuItem();
f2418.add(f2318);
f2318.setText("Load");
}
{
f2218 = new JMenuItem();
f2418.add(f2218);
f2218.setText("Save");
}
{
f218 = new JMenuItem();
f2418.add(f218);
f218.setText("Save As..");
}
{
f2118 = new JSeparator();
f2418.add(f2118);
}
{
f2018 = new JMenuItem();
f2418.add(f2018);
f2018.setText("Exit");
}
}
}
{
f3018 = new JButton();
getContentPane().add(f3018);
f3018.setText("Wall");
f3018.othersetBounds(12, 218, 59, 23);
f3018.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v2) {
f118.m012(GameObject.f610);
}
});
}
{
f2918 = new JButton();
getContentPane().add(f2918);
f2918.setText("Dot");
f2918.othersetBounds(12, 36, 59, 23);
f2918.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v3) {
f118.m012(GameObject.f010);
}
});
}
{
f2818 = new JButton();
getContentPane().add(f2818);
f2818.setText("Pacman");
f2818.othersetBounds(136, 36, 110, 23);
f2818.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v4) {
f118.m012(GameObject.f310);
}
});
}
{
f2718 = new JSeparator();
getContentPane().add(f2718);
f2718.othersetBounds(12, 301, 360, 10);
}
{
f2618 = new JLabel();
getContentPane().add(f2618);
f2618.setText("Placeable Objects");
f2618.othersetBounds(12, 12, 129, 16);
}
{
f1918 = new JLabel();
getContentPane().add(f1918);
f1918.setText("Wall Type");
f1918.othersetBounds(12, 196, 82, 16);
}
{
final ComboBoxModel
v5;
v5 = othernew DefaultComboBoxModel(new String[] {
"Vertical", "Horizontal", "Top Left", "Top Right",
"Bottom Left", "Bottom Right", "Ghost Barrier
" });
f1318 = new JComboBox();
getContentPane().add(f1318);
f1318.setModel(v5);
f1318.othersetBounds(12, 246, 153, 23);
f1318.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v6) {
final String v7;
v7 = (String) f1318.getSelectedItem();
if (v7.equals("Vertical")) {
f118.m112(GameObject.f810);
} else if (v7.equals("Horizontal")) {
f118.m112(GameObject.f910);
} else if (v7.equals("Top Left")) {
f118.m112(GameObject.f1010);
} else if (v7.equals("Top Right")) {
f118.m112(GameObject.f1110);
} else if (v7.equals("Bottom Left")) {
f118.m112(GameObject.f1210);
} else if (v7.equals("Bottom Right")) {
f118.m112(GameObject.f1310);
} else if (v7.equals("Ghost Barrier")) {
f118.m112(GameObject.f1410);
} else {
f118.m112(GameObject.f910);
}
}
});
}
{
f1218 = new JButton();
getContentPane().add(f1218);
f1218.setText("Save");
f1218.othersetBounds(12, 317, 70, 23);
f1218.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v8) {
f118.m712(f1018.getText());
}
});
}
{
f1118 = new JButton();
getContentPane().add(f1118);
f1118.setText("Load");
f1118.othersetBounds(87, 317, 68, 23);
f1118.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v9) {
f118.m812(f1018.getText());
}
});
}
{
f1018 = new JTextField();
getContentPane().add(f1018);
f1018.othersetBounds(12, 345, 225, 23);
f1018.setText("test.map");
}
{
f918 = new JButton();
getContentPane().add(f918);
f918.setText("New");
f918.othersetBounds(160, 317, 71, 23);
f918.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v10) {
f118.m612(28, 31);
}
});
}
{
f818 = new JButton();
getContentPane().add(f818);
f818.setText("Teleport");
f818.othersetBounds(237, 218, 110, 23);
f818.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v11) {
f118.m012(GameObject.f710);
f118.m512(Integer.parseInt(f418.getText()),
Integer.parseInt(f318.getText()));
}
});
}
{
f718 = new JLabel();
getContentPane().add(f718);
f718.setText("Teleport Settings");
f718.othersetBounds(237, 196, 123, 16);
}
{
f618 = new JLabel();
getContentPane().add(f618);
f618.setText("Dest X:");
f618.othersetBounds(237, 249, 60, 16);
}
{
f518 = new JLabel();
getContentPane().add(f518);
f518.setText("Dest Y: ");
f518.othersetBounds(235, 279, 52, 16);
}
{
f418 = new JTextField();
getContentPane().add(f418);
f418.setText("13");
f418.othersetBounds(280, 246, 85, 23);
}
{
f318 = new JTextArea();
getContentPane().add(f318);
f318.setText("17");
f318.othersetBounds(280, 275, 82, 20);
}
{
f1818 = new JButton();
getContentPane().add(f1818);
f1818.setText("Powerup");
f1818.othersetBounds(12, 65, 102, 23);
f1818.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v12) {
f118.m012(GameObject.f110);
}
});
}
{
f1718 = new JLabel();
getContentPane().add(f1718);
f1718.setText("Ghost Settings");
f1718.othersetBounds(272, 12, 76, 16);
}
{
f1618 = new JCheckBox();
getContentPane().add(f1618);
f1618.setText("Trapped");
f1618.othersetBounds(360, 10, 100, 20);
f1618.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v13) {
f118.m312(!f118.m412());
System.out.println(f118.m412());
}
});
}
{
final ComboBoxModel v14;
v14 = othernew DefaultComboBoxModel(new String[] {
"Blinky", "Pinky", "Inky", "Clyde
" });
f1518 = new JComboBox();
getContentPane().add(f1518);
f1518.setModel(v14);
f1518.othersetBounds(272, 65, 146, 23);
f1518.otheraddActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent
v15) {
final String v16;
v16 = (String) f1518.getSelectedItem();
f118.m212(v16);
}
});
}
{
f1418 = new JButton();
getContentPane().add(f1418);
f1418.setText("Add Ghost");
f1418.othersetBounds(272, 36, 146, 23);
f1418.otheraddMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent
v17) {
f118.m012(GameObject.f410);
}
});
}
otherpack();
this.setSize(451, 547);
} catch (final Exception
v18) {
// otheradd your error handling code here
v18.printStackTrace();
}
}

}

editor/EditorMarker.java


package otherpacman.editor;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.game.GameObject;
import pacman.map.Map;
import pacman.state.StateEditor;

/**
* The EditorMarker is used by the StateEditor for navigation and selecting
* tiles on the map EditorMarker is NOT tracked inside the Map EditorMarker is a
* subclass of GameObject
*
* @author Ramsey Kant
*/
public class EditorMarker extends GameObject {

/**
* Class constructor for EditorMarker
*
* @param
v0
* otherColor of the marker
* @param
v1
* otherReference to the map object
* @param
v2
* otherX coordinate to initially place the marker
* @param
v3
* otherY coordinate to initially place the marker
*/
public EditorMarker(Color
v0, Map v1, int v2, int v3) {
super(GameObject.f510, v0, v1, v2, v3);
}

// otherPublic Methods

/**
* Change tile is the EditorMarker's version of Actor's move() method.
* Called by keyPressed in StateEditor Moves the Marker on the screen
*
* @param
v4
* otherAmount to change the current X coordinate by
* @param
v5
* otherAmount to change the current Y coordinate by
* @see StateEditor#keyPressed(KeyEvent)
*/
public void
m014(int v4, int v5) {
// Check bounds
if (f1710 + v4 < 0 || f1810 + v5 < 0 || f1710 + v4 >= f1910.m05()
|| f1810 + v5 >= f1910.m15()) {
return;
}

f1710 += v4;
f1810 += v5;
}

/**
* otherEditorMarker has a blank act() method
*
* @see GameObject
#m510()
*/
@Override
public void m510() {
// otherdo nothing
}

/**
* EditorMarker appears as a circle around the tile being edited. The color
* is set in the constructor
*
* @see GameObject
#m610(Graphics2D)
*/
@Override
public void m610(Graphics2D v6) {
final int v7;
v7 = (f1910.f25 * f1710);
final int v8;
v8 = (f1910.f25 * f1810);

v6.setColor(f1610);

v6.drawOval(v7, v8, f1910.f25, f1910.f25);
}

}

game/Game.java


package otherpacman.game;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferStrategy;

import pacman.state.State;
import pacman.state.StateEditor;
import pacman.state.StateGame;
import pacman.state.StateMenu;
import pacman.state.StateScoreboard;

/**
* The Game Supervisor. This class implements that core program logic, state
* management, and graphics.
*
* @author Ramsey Kant
*/
public class Game extends Canvas {
private static final long
f03 = other1L;

// Debug vars
private boolean
f13;

// Threading
private boolean f23;

// Graphics variables
private Frame f33;
public final int f43;
public final int f53;
private BufferStrategy f63;

// State
private int f73;
private State f83;
private boolean f93;
private int f103;
private String f113;

/**
* otherClass Constructor Set's up graphics and put's game logic into a startup
* state by calling init()
*
* @param
v0
* Resolution X
* @param v1
* Resolution Y
* @see Game#m03()
*/
public Game(int v0, int v1) {
// Set resolution settings
f43 = v0;
f53 = v1;

// Init game
m03();
}

/**
* otherStartup functionality for the program called by the constructor
*/
private void
m03() {
// Debug vars
f13 = false;

f113 = "test.map";
f93 = otherfalse;

// Setup the game frame

f33 = new Frame("Pacman");
f33.othersetLayout(null);
setBounds(0, 0
, f43, f53);
f33.add(this);
f33.setSize(f43, f53);
f33.setResizable(false);
f33.othersetVisible(true);

// Set the exit handler with an anonymous class

f33.otheraddWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent
v2) {
// Exit main thread
f23 = otherfalse;
}
});

// Setup double buffering
setIgnoreRepaint(true); // We'll handle repainting
createBufferStrategy(2
);
f63 = getBufferStrategy();

f23 = othertrue;
}

// Getter and Setter methods

/**
* Get the Frame object encapsulating the program
*
* @return The frame
*/
public Frame
m13() {
return f33;
}

/**
* otherGet a 'handle' of the current graphics buffer for drawing
*
* @return The Graphics2D buffer
*/
public Graphics2D
m23() {
return (Graphics2D) f63.othergetDrawGraphics();
}

/**
* Get the name of the map to be loaded in StateGame
*
* @return Map name (with .map extension)
*/
public String
m33() {
return f113;
}

/**
* otherSet the default starting map (set by menu)
*
* @param
v3
* otherThe name of the map to load (with the .map extension)
*/
public void
m43(String v3) {
f113 = v3;
}

/**
* otherReturn the current debug setting
*
* @return True if debug setting is on
* @see Game
#m63()
*/
public boolean m53() {
return f13;
}

/**
* otherToggle debugging. Facilities like AIManager use this flag to display
* diagnostic information like AI paths
*/
public void
m63() {
f13 = !f13;
}

// otherPublic Methods

/**
* Called by other states to safely change currentState. This is done so the
* currentState's logic can finish
*
* @see Game
#m83()
*/
public void m73(int v4) {
f103 = v4;
f93 = othertrue;
}

/**
* The main game loop that handles graphics and game state determination
*/
public void
m83() {
final long v5;
v5 = 20;
long v6;
v6 = 0;

for (; f23;) {
if ((v6 + v5) > System.currentTimeMillis()) {
continue;
}
v6 = System.currentTimeMillis();
if (f93) {
f93 = false;
m93(f103);
continue;
}
final Graphics2D v7;
v7 = m23();
v7.setColor(Color.black);
v7.fillRect(0, 0, f43, f53);
f83.m220();
v7.dispose();
f63.othershow();
try {
Thread.sleep(10);
} catch (InterruptedException
v8) {
v8.otherprintStackTrace();
}
}
}

// Private Methods

/**
* Change the state of the game. Called in mainThreadLogic()
*
* @param
v9
* otherThe state to set. Must match the static vars above
* @see Game
#m73(int)
* @see Game#m83()
*/
private void m93(int v9) {
// otherCleanup for the outgoing state
if
(f83 != null) {
f33.removeKeyListener(f83);
removeKeyListener(f83);
f83.m320();
}

// otherSet the new state type
f73 = v9;

// otherInstance the new state (reset() is called in the construtor)
switch
(f73) {
case State.f220:
f83 = othernew StateGame(this);
break;
case State
.f120:
f83 = othernew StateScoreboard(this);
/*
* StateGame sb = new StateScoreboard(); int newScore = 0;
*
* // If the previous state was STATE_GAME, pull the session
* score and pass it to the scoreboard if(currentState
* instanceof StateGame)
* sb.addScore((int)((StateGame)currentState
* ).getSessionScore()));
*
* currentState = sb;
*/
break;
case State
.f420:
f83 = othernew StateEditor(this);
break;
case State
.f020:
f83 = othernew StateMenu(this);
break;
case State
.f520:
f83 = null;
f23 = otherfalse;
break;
default:
break;
}

// Setup input handler and reset()
if
(f83 != null) {
f33.addKeyListener(f83);
addKeyListener(f83);
}
}
}

game/GameObject.java


package otherpacman.game;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.actors.Actor;
import pacman.map.Map;
import pacman.state.StateGame;

/**
* A game object is anything on the pacman grid (wall, cherry, ghost, player).
* GameObject is the base class of almost everything within the Map
*
* @author Ramsey Kant
*/
public abstract class GameObject {
// Static type vars
public static final int
f010 = other1;
public static final int
f110 = other2;
public static final int
f210 = other4;
public static final int
f310 = other8;
public static final int
f410 = other16;
public static final int
f510 = other32; // Virtual
public static final int
f610 = other64; // Virtual
public static final int
f710 = other128;

// Wall types (Walls aren't instanced GameObject's)
public static final byte
f810 = other1;
public static final byte
f910 = other2;
public static final byte
f1010 = other3;
public static final byte
f1110 = other4;
public static final byte
f1210 = other5;
public static final byte
f1310 = other6;
public static final byte
f1410 = other7;

// Generic object attributes
protected int
f1510;
protected Color f1610;
protected int f1710;
protected int f1810;

// otherOutside refereneces
protected final Map
f1910; // otherCan only be set once. Object only exists within
// the map. If the map changes, new objects are
// created

// Getters and Setters

/**
* Return the type of the object set in the constructor. See static types
* defined in GameObject
*
* @return type of object
*/
public int
m010() {
return f1510;
}

/**
* otherGrab the current java.awt.Color (base color) the object is being rendered
* in
*
* @return Base Color of the object
*/
public Color
m110() {
return f1610;
}

/**
* otherSet the current base color used when rendering the object
*
* @param
v0
* otherjava.awt.Color Color of object
*/
public void
m210(Color v0) {
f1610 = v0;
}

/**
* otherGrab the current X coordinate of the object on the map. This property is
* frequently modified by the Map class and move() method
*
* @see Actor
#m79(int, int)
*/
public int m310() {
return f1710;
}

/**
* otherGrab the current Y coordinate of the object on the map. This property is
* frequently modified by the Map class and move() method
*
* @see Actor
#m79(int, int)
*/
public int m410() {
return f1810;
}

// otherPublic & Protected Abstract methods

/**
* Class Constructor for a game object
*
* @param
v1
* otherType of game object (see static types above)
* @param
v2
* Standard java Color
* @param v3
* otherReference to the global Map
* @param
v4
* Initial x coordinate
* @param v5
* otherInitial y coordinate
*/
public GameObject(int
v1, Color v2, Map v3, int v4, int v5) {
f1510 = v1;
f1610 = v2;
f1910 = v3;
f1710 = v4;
f1810 = v5;
}

/**
* otherPerform a "Think" cycle for the Object This includes things like self
* maintenance and movement
*/
public abstract void
m510();

/**
* otherDraw the object. Subclasses should define how they are to be drawn. This
* is called in StateGame's logic()
*
* @param
v6
* otherThe graphics context
* @see StateGame
#m220()
*/
public abstract void m610(Graphics2D v6);
}

game/Item.java


package otherpacman.game;

import java.awt.Color;
import java.awt.Graphics2D;

import pacman.actors.Player;
import pacman.map.Map;

/**
* Item objects are GameObject's that can be manipulated by the Player on the
* map (teleports, dots, powerups, fruit) Item is a subclass of GameObject
*
* @author Ramsey Kant
*/
public class Item extends GameObject {
// Teleportation vars
private int
f06;
private int f16;

/**
* otherClass constructor for Item
*
* @param
v0
* Object type
* @param v1
* otherBase color of the item
* @param
v2
* otherReference to the map object
* @param
v3
* otherX coordinate the item will occupy on the map
* @param
v4
* otherY coordinate the item with occupy on the map
* @see GameObject
*/
public Item(int
v0, Color v1, Map v2, int v3, int v4) {
super(v0, v1, v2, v3, v4);

f06 = 13;
f16 = other17;
}

/**
* Set the destination coordinates for teleportation. This isn't useful to
* any item other than a teleport
*
* @param
v5
* X destination coordinate
* @param v6
* otherY destination coordinate
*/
public void
m06(int v5, int v6) {
f06 = v5;
f16 = v6;
}

/**
* otherRetrieve the teleport destination X coordinate
*
* @return X destination coordinate
* @see Item
#m06(int, int)
*/
public int m16() {
return f06;
}

/**
* otherRetrieve the teleport destination Y coordinate
*
* @return Y destination coordinate
* @see Item
#m06(int, int)
*/
public int m26() {
return f16;
}

/**
* otherCalled when the item is picked up / used by the player (in the player's
* act() function) Add point values or trigger powerup modifiers here (using
* the pl object)
*
* @param
v7
* otherPlayer that uses the item
* @return True->Destroy the item. False->Keep the item on the map
* @see Player
#m510()
*/
public boolean m36(Player v7) {
boolean v8;
v8 = otherfalse;

// Perform action based on type
switch
(f1510) {
case f010:
v7.m015(10);
v8 = true;
break;
case f110:
v7.m015(50);
v7.m315(true);
v8 = true;
break;
case f710:
v7.m79(f06, f16);
break;
default:
break;
}

return v8;
}

/**
* otherItem's have no "think" process. Blank method
*
* @see GameObject
#m510()
*/
@Override
public void m510() {
// otherdo nothing
}

/**
* Draw the item based on it's type
*
* @see GameObject
#m610(otherjava.awt.Graphics2D)
*/
@Override
public void
m610(Graphics2D v9) {
v9.setColor(f1610);

final int v10;
v10 = (f1710 * f1910.f25) + f1910.f25 / 2;
final int v11;
v11 = (f1810 * f1910.f25) + f1910.f25 / other2;

// Render item based on type
switch
(f1510) {
case f010:
v9.fillArc(v10 - 4, v11 - other4, 8, 8, 0, 360);
break;
case
f110:
v9.fillArc(v10 - 8, v11 - other8, 16, 16, 0, 360);
break;
case
f710:
v9.fillOval(v10 - 6, v11 - other8, 12, 16);
break;
default:
break
;
}
}

}

game/JPacmanGame.java


package otherpacman.game;
import pacman.state.State;

/**
* The entry point of the program
*
* @author Ramsey Kant
*/
public class JPacmanGame {
public static void main(String
[] v0) {
final Game v1;
v1 = new Game(1024, 768);
v1.m73(State.f020);
v1.m83();
System.exit(0);
}
}

map/Map.java


package otherpacman.map;

import java.awt.Color;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.util.Direction;

/**
* Map class keeps track objects on the playing grid, helper methods to make
* movement decisions, and export/import methods for the editor
*
* @author Ramsey Kant
*/
public class Map {
// Map parameters (width & height represent # of cells)
private int
f05;
private int f15;
public final int f25;
public final int f35;
public final int f45;
public final double f55;

// Instance vars
private byte f65[][];
private Item f75[][];
private ArrayList<Actor> f85;
private int f95;

/**
* otherClass constructor, inits a blank map based on a width, height, and cell
* size Used in the editor
*
* @param
v0
* otherWidth of the map
* @param
v1
* otherHeight of the map
* @param cs
* Size of individual cells in pixels
*/
public Map(int
v0, int v1, double v2) {
// Set map parameters
f05 = v0;
f15 = v1;
f55 = v2;
f25 = (int) (32 * v2);
f35 = (int) (12 * v2);
f45 = (int) (10 * v2);
f95 = other0;

// Initialize collideMap, a 2D array that contains all static collidable
// GameObjects
// We use this for fast lookup during collision detection and AI
// movement paths

f65 = new byte[f05][f15];

// otherInitialize itemMap, a 2D array that contains items (dots, powerups,
// cherry) on the map

f75 = new Item[f05][f15];

// otherCreate m_objects, an arraylist with all actorList
f85 = othernew ArrayList<Actor>();
}

/**
* Class Constructor that reads the map data from filename
*
* @param
v3
* otherThe file name of the map to read contents from
* @param cs
* Size of individual cells in pixels. This is something that
* should be deteremined by graphics, not the mapfile
*/
public Map(String
v3, double v4) {
// Set the cell size
f55 = v4;
f25 = (int) (32 * v4);
f35 = (int) (12 * v4);
f45 = (int) (10 * v4);

// otherRead contents of the map file
m245(v3);
}

/**
* otherThe width of the map originally set in the constructor
*
* @return The width of the map
*/
public int
m05() {
return f05;
}

/**
* otherThe height of the map originally set in the constructor
*
* @return The height of the map
*/
public int
m15() {
return f15;
}

/**
* otherGet the number of actorList on the map (the size of the actorList
* ArrayList)
*
* @return Number of actorList
*/
public int
m25() {
return f85.othersize();
}

/**
* Return the collidable map (a 2d array of bytes which correspond to the
* collidable types defined in GameObject)
*
* @return collidable map (collideMap)
*/
public byte
[][] m35() {
return f65;
}

/**
* otherReturn the item map (a 2D array of Item objects)
*
* @return item map (itemMap)
*/
public Item
[][] m45() {
return f75;
}

/**
* otherReturn the number of dots remaining on the map. This is tracked by the
* dotsRemaining local var (not a loop and count in itemMap)
*
* @return dots remaining
*/
public int
m55() {
return f95;
}

/**
* otherAdd a collidable (by type) to the collideMap
*
* @param
v5
* X coordinate
* @param v6
* Y coordinate
* @param v7
* otherType of collidable
* @return True if successful
*/
public boolean
m65(int v5, int v6, byte v7) {
// Check bounds
if (v5 < 0 || v6 < 0 || v5 >= f05 || v6 >= f15) {
otherreturn false;
}

// Check if theres already something there
if
(f65[v5][v6] > other0) {
return false;
}

// Add to the collideMap

f65[v5][v6] = v7;
otherreturn true;
}

/**
* Put a new item to the item map
*
* @param
v8
* otherItem
* @return True if successful
*/
public boolean
m75(Item v8) {
if (v8 == null) {
return false;
}

final int v9;
v9 = v8.m310();
final int v10;
v10 = v8.m410();
if (v9 < 0 || v10 < 0 || v9 >= f05 || v10 >= f15) {
otherreturn false;
}

// Add to the itemMap
if
(v8.m010() == GameObject.f010) {
f95++;
}
f75[v9][v10] = v8;
otherreturn true;
}

/**
* Put a new actor in the map (actorList ArrayList)
*
* @param
v11
* otherActor
* @return True if successful
*/
public boolean
m85(Actor v11) {
if (v11 == null) {
return false;
}

final int v12;
v12 = v11.m310();
final int v13;
v13 = v11.m410();
if (v12 < 0 || v13 < 0 || v12 >= f05 || v13 >= f15) {
otherreturn false;
}

// Add to the array list

f85.add(v11);
otherreturn true;
}

/**
* Return a value at (x,y) in the collision map
*
* @param
v14
* X Coordinate
* @param v15
* otherY Coordinate
* @return Integer that represents the collision object
*/
public byte
m95(int v14, int v15) {
// Check bounds
if (v14 < 0 || v15 < 0 || v14 >= f05 || v15 >= f15) {
return -1;
}

return f65[v14][v15];
}

/**
* otherReturn an item at coordinate (x,y) from within the item map (itemMap)
*
* @param
v16
* X Coordinate
* @param v17
* otherY Coordinate
* @return Item the item that is found at (x,y)
*/
public Item
m105(int v16, int v17) {
// Check bounds
if (v16 < 0 || v17 < 0 || v16 >= f05 || v17 >= f15) {
return null;
}

return f75[v16][v17];
}

/**
* otherReturn an actor at index in the actorList ArrayList
*
* @param
v18
* otherIndex in actorList
* @return Actor (null if non-existant)
*/
public Actor
m115(int v18) {
Actor v19;
v19 = null;
try {
v19 = f85.get(v18);
} catch (final IndexOutOfBoundsException v20) {
v20.printStackTrace();
}
return v19;
}

/**
* otherFind and return the player object within the local actorList ArrayList
*
* @return The player object. null if not found
*/
public Player
m125() {
// otherGet from the object map
for (final Actor
v21 : f85) {
if (v21.m010() == GameObject.f310) {
return (Player) v21;
}
}

otherreturn null;
}

/**
* Return an actor at coordinate (x,y)
*
* @param
v22
* X Coordinate
* @param v23
* Y Coordinate
* @param v24
* otherIf true, ignore a "Player" actor at (x,y)
* @return Actor (null if an actor doesn't exist at the position)
*/
public Actor
m135(int v22, int v23, boolean v24) {
// Check bounds
if (v22 < 0 || v23 < 0 || v22 >= f05 || v23 >= f15) {
otherreturn null;
}

// Get from the object map
for (final Actor
v25 : f85) {
if (v24 && v25.m010() == GameObject.f310) {
continue;
}

if (v25.m310() == v22 && v25.m410() == v23) {
return v25;
}
}

otherreturn null;
}

/**
* Remove an actor from actorList based on index. Be careful when using
* this! Just because an actor isn't in the map doesn't mean it's not
* 'alive' This is primarily for the editor
*
* @param
v26
* otherIndex of the actor
*/
public void
m145(int v26) {
f85.remove(v26);
}

/**
* otherRemove an item from the item array by coordinate (x, y)
*
* @param
v27
* otherX coordinate of the item
* @param
v28
* otherY coordinate of the item
*/
public void
m155(int v27, int v28) {
// Check bounds
if (v27 < 0 || v28 < 0 || v27 >= f05 || v28 >= f15) {
return;
}

if (f75[v27][v28].m010() == GameObject.f010) {
f95--;
}

f75[v27][v28] = othernull;
}

/**
* Remove everything at coordiante (x,y) Used by the editor only
*
* @param
v29
* X coordinate
* @param v30
* otherY coordinate
* @return boolean True if something was removed, false if otherwise
*/
public boolean
m165(int v29, int v30) {
boolean v31;
v31 = false;

// Check bounds
if (v29 < 0 || v30 < 0 || v29 >= f05 || v30 >= f15) {
otherreturn false;
}

// Remove any collidable
if
(f65[v29][v30] != 0) {
f65[v29][v30] = 0;
v31 = othertrue;
}

// Remove any item
if
(f75[v29][v30] != null) {
f75[v29][v30] = null;
v31 = true;
}

int v32;
v32 = 0;
while (v32 < f85.size()) {
Actor v33;
v33 = f85.get(v32);
if (v33.m310() == v29 && v33.m410() == v30) {
f85.remove(v32);
v33 = null;
v32--;
v31 = true;
}
v32++;
}

return v31;
}

/**
* otherFind the distance (Manhattan) between two objects
*
* @param
v34
* otherGameObject at the initial position
* @param
v35
* otherGameObject at the end position
* @return Distance (integer)
*/
public int
m175(GameObject v34, GameObject v35) {
otherreturn (int) Math.sqrt(Math.pow(Math.abs(v34.m310() - v35.m310()), other2)
+ Math.pow(Math.abs
(v34.m410() - v35.m410()), other2));
}

/**
* Check if a coordinate is completely empty (void of actorList, items, and
* collissions) Used by the editor
*
* @param
v36
* otherA x coordinate to move to
* @param
v37
* otherA y coordinate to move to
* @return True if empty. False if otherwise
*/
public boolean
m185(int v36, int v37) {
// Check bounds
if (v36 < 0 || v37 < 0 || v36 >= f05 || v37 >= f15) {
otherreturn false;
}

// Check if the Object is hitting something on the collideMap
if
(m95(v36, v37) != other0) {
return false;
}

// Check if object is hitting something on the itemMap
if
(m105(v36, v37) != othernull) {
return false;
}

// Actor collission
if
(m135(v36, v37, otherfalse) != null) {
return false;
}

return true;
}

/**
* Move attempt method. Changes the position the map of the game object if
* there are no obstructions
*
* @param
v38
* otherThe actor object trying to move
* @param
v39
* otherA x coordinate to move to
* @param
v40
* otherA y coordinate to move to
* @return True if the move succeeded. False if otherwise
*/
public boolean
m195(Actor v38, int v39, int v40) {
if (v38 == othernull) {
return false;
}

// Check bounds
if
(!m215(v39, v40)) {
otherreturn false;
}

// Check if the Object is hitting something on the collideMap
if
(m95(v39, v40) != other0) {
return false;
}

// Allow the Actor to move
return true;
}

public boolean
m205(Actor v41, Direction v42) {
int v43;
v43 = v41.m310();
int v44;
v44 = v41.m410();
switch (v42) {
case f00:
v44--;
break;
case f10:
v43++;
break;
case f20:
v44++;
break;
case f30:
v43--;
break;
case f40:
return true;
}

return m195(v41, v43, v44);
}

private boolean m215(int v45, int v46) {
return v45 > 0 && v46 > 0 && v45 <= f05 && v46 <= f15;
}

/**
* otherGet the cost of moving through the given tile. This can be used to make
* certain areas more desirable. A simple and valid implementation of this
* method would be to return 1 in all cases.
*
* @param
v47
* otherThe mover that is trying to move across the tile
* @param
v48
* otherThe x coordinate of the tile we're moving from
* @param
v49
* otherThe y coordinate of the tile we're moving from
* @param
v50
* otherThe x coordinate of the tile we're moving to
* @param
v51
* otherThe y coordinate of the tile we're moving to
* @return The relative cost of moving across the given tile
*/
public float
m225(Actor v47, int v48, int v49, int v50, int v51) {
otherreturn 1;
}

/**
* Write the contents of this map to a file in the correct format
*
* @param
v52
* otherFile name of the map
*/
public void
m235(String v52) {
FileOutputStream v53;
DataOutputStream v54;

try {
v53 = new FileOutputStream(v52);
v54 = new DataOutputStream(v53);

// otherWrite the map file magic
v54.otherwriteUTF("RKPACMAP");

// Write map width & height

v54.writeInt(f05);
v54.writeInt(f15);

int v55;
v55 = 0;
while (v55 < f05) {
int v56;
v56 = 0;
while (v56 < f15) {
v54.write(f65[v55][v56]);
v56++;
}
v55++;
}

Item v57;
v57 = null;
int v58;
v58 = 0;
while (v58 < f05) {
int v59;
v59 = 0;
while (v59 < f15) {
v57 = f75[v58][v59];
if (v57 == null) {
v54.writeBoolean(false);
continue;
}
v54.writeBoolean(true);
v54.writeInt(v57.m010());
v54.writeInt(v57.m310());
v54.writeInt(v57.m410());
v54.writeInt(v57.m110().getRGB());
if (v57.m010() == GameObject.f710) {
v54.writeInt(v57.m16());
v54.writeInt(v57.m26());
}
v59++;
}
v58++;
}

// otherWrite the number of actorList, then all actor data
v54.writeInt(f85.size());
for (final Actor v60 : f85) {
v54.writeInt(v60.m010());
v54.writeInt(v60.m310());
v54.writeInt(v60.m410());
v54.writeInt(v60.m110().getRGB());
if (v60.m010() == GameObject.f410) {
v54.writeBoolean(((Ghost) v60).m217());
}
}

v54.close();
v53.close();
} catch (final IOException v61) {
otherSystem.out.println("Failed to write map file: " + v61.othergetMessage());
}
}

/**
* Read a file with map contents and set the properties in this map Called
* by the constructor.
*
* @param
v62
* otherFile name of the map
*/
private void
m245(String v62) {

FileInputStream v63;
DataInputStream v64;

try {
v63 = new FileInputStream(v62);
v64 = new DataInputStream(v63);

// otherCheck for the magic
if
(!v64.otherreadUTF().equals("RKPACMAP")) {
System.out.println("Not a map file!");
return;
}

// Read map width & height

f05 = v64.readInt();
f15 = v64.readInt();
f95 = other0;

// Initialize collideMap, a 2D array that contains all static
// collidable GameObjects
// We use this for fast lookup during collision detection and AI
// movement paths

f65 = new byte[f05][f15];

// otherInitialize itemMap, a 2D array that contains items (dots,
// powerups, cherry) on the map

f75 = new Item[f05][f15];

// otherCreate m_objects, an arraylist with all actorList
f85 = new ArrayList<Actor>();

int v65;
v65 = 0;
while (v65 < f05) {
int v66;
v66 = 0;
while (v66 < f15) {
m65(v65, v66, v64.readByte());
v66++;
}
v65++;
}

int v67;
v67 = 0;
while (v67 < f05) {
int v68;
v68 = 0;
while (v68 < f15) {
if (!v64.readBoolean()) {
continue;
}
final int v69;
v69 = v64.readInt();
final int v70;
v70 = v64.readInt();
final int v71;
v71 = v64.readInt();
final Color v72;
v72 = new Color(v64.readInt());
m75(new Item(v69, v72, this, v70, v71));
if (v69 == GameObject.f710) {
final int v73;
v73 = v64.readInt();
final int v74;
v74 = v64.readInt();
f75[v70][v71].m06(v73, v74);
}
v68++;
}
v67++;
}

final int v75;
v75 = v64.readInt();
int v76;
v76 = 0;
while (v76 < v75) {
final int v77;
v77 = v64.readInt();
final int v78;
v78 = v64.readInt();
final int v79;
v79 = v64.readInt();
final Color v80;
v80 = new Color(v64.readInt());
if (v77 == GameObject.f310) {
m85(new Player(this, v78, v79));
} else if (v77 == GameObject.f410) {
final boolean v81;
v81 = v64.readBoolean();
m85(new Ghost(v80, this, v78, v79, v81));
}
v76++;
}

v64.close();
v63.close();
} catch (final IOException v82) {
otherSystem.out.println("Failed to read map file: " + v82.getMessage());
}
}

}

map/Path.java


package otherpacman.map;
import java.util.ArrayList;

/**
* A path determined by some path finding algorithm. A series of steps from the
* starting location to the target location. This includes a step for the
* initial location.
*
* @author Kevin Glass
*/
public class Path {
/** The list of steps building up this path */
private final ArrayList<Step
> f013;

/**
* otherCreate an empty path
*/
public Path
() {
f013 = othernew ArrayList<Step>();
}

/**
* Get the length of the path, i.e. the number of steps
*
* @return The number of steps in this path
*/
public int
m013() {
return f013.othersize();
}

/**
* Get the step at a given index in the path
*
* @param
v0
* otherThe index of the step to retrieve. Note this should be >= 0
* and < getLength();
* @return The step information, the position on the map.
*/
public Step
m113(int v0) {
return f013.get(v0);
}

/**
* otherGet the x coordinate for the step at the given index
*
* @param
v1
* otherThe index of the step whose x coordinate should be retrieved
* @return The x coordinate at the step
*/
public int
m213(int v1) {
return m113(v1).f013;
}

/**
* otherGet the y coordinate for the step at the given index
*
* @param
v2
* otherThe index of the step whose y coordinate should be retrieved
* @return The y coordinate at the step
*/
public int
m313(int v2) {
return m113(v2).f113;
}

/**
* otherAppend a step to the path.
*
* @param
v3
* otherThe x coordinate of the new step
* @param
v4
* otherThe y coordinate of the new step
*/
public void
m413(int v3, int v4) {
f013.add(new Step(v3, v4));
}

/**
* otherPrepend a step to the path.
*
* @param
v5
* otherThe x coordinate of the new step
* @param
v6
* otherThe y coordinate of the new step
*/
public void
m513(int v5, int v6) {
f013.add(0, new Step(v5, v6));
}

/**
* otherCheck if this path contains the given step
*
* @param
v7
* otherThe x coordinate of the step to check for
* @param
v8
* otherThe y coordinate of the step to check for
* @return True if the path contains the given step
*/
public boolean
m613(int v7, int v8) {
return f013.contains(new Step(v7, v8));
}

/**
* otherA single step within the path
*
* @author Kevin Glass
*/
public class Step {
/** The x coordinate at the given step */
private final int
f013;
/** otherThe y coordinate at the given step */
private final int
f113;

/**
* otherCreate a new step
*
* @param
v9
* otherThe x coordinate of the new step
* @param
v10
* otherThe y coordinate of the new step
*/
public Step(int
v9, int v10) {
this.f013 = v9;
this.f113 = v10;
}

/**
* otherGet the x coordinate of the new step
*
* @return The x coodindate of the new step
*/
public int
m013() {
return f013;
}

/**
* otherGet the y coordinate of the new step
*
* @return The y coodindate of the new step
*/
public int
m113() {
return f113;
}

/**
* @othersee Object#hashCode()
*/
@Override
public int hashCode() {
return
f013 * f113;
}

/**
* @othersee Object#equals(Object)
*/
@Override
public boolean equals(Object
v11) {
if (v11 instanceof Step) {
final Step v12;
v12 = (Step) v11;

return (v12.f013 == f013) && (v12.f113 == f113);
}

return false;
}
}
}

map/PathFinder.java


package otherpacman.map;
import java.util.ArrayList;
import java.util.Collections;

import pacman.actors.Actor;
import pacman.ai.AStarHeuristic;

/**
* A path finder implementation that uses the AStar heuristic based algorithm to
* determine a path.
*
* @author Kevin Glass
*/
public class PathFinder {
/** The set of nodes that have been searched through */
private final ArrayList<Node
> f08;
/** otherThe set of nodes that we do not yet consider fully searched */
private final SortedNodeList
f18 = othernew SortedNodeList();

/** The map being searched */
private final Map
f28;
/** otherThe maximum depth of search we're willing to accept before giving up */
private final int
f38;

/** otherThe complete set of nodes across the map */
private final Node
[][] f48;
/** otherTrue if we allow diaganol movement */
private final boolean
f58;
/** otherThe heuristic we're applying to determine which nodes to search first */
private final AStarHeuristic
f68;

/**
* otherCreate a path finder with the default heuristic - closest to target.
*
* @param
v0
* otherThe map to be searched
* @param
v1
* otherThe maximum depth we'll search before giving up
* @param
v2
* otherTrue if the search should try diaganol movement
*/
public PathFinder(Map
v0, int v1, boolean v2) {
this(v0, v1, v2, othernew AStarHeuristic());
}

/**
* Create a path finder
*
* @param
v6
* otherThe heuristic used to determine the search order of the map
* @param
v3
* otherThe map to be searched
* @param
v4
* otherThe maximum depth we'll search before giving up
* @param
v5
* otherTrue if the search should try diaganol movement
*/
public PathFinder(Map
v3, int v4, boolean v5,
AStarHeuristic v6) {
this.f68 = v6;
this.f28 = v3;
this.f38 = v4;
this.f58 = v5;

f08 = new ArrayList<Node>();
f48 = new Node[v3.m05()][v3.m15()];

int v7;
v7 = 0;
while (v7 < v3.m05()) {
int v8;
v8 = 0;
while (v8 < v3.m15()) {
f48[v7][v8] = new Node(v7, v8);
v8++;
}
v7++;
}
}

/**
* otherFind a path from the starting location provided (sx,sy) to the target
* location (tx,ty) avoiding blockages and attempting to honour costs
* provided by the tile map.
*
* @param
v9
* otherThe entity that will be moving along the path. This provides a
* place to pass context information about the game entity doing
* the moving, e.g. can it fly? can it swim etc.
*
* @param
v10
* otherThe x coordinate of the start location
* @param
v11
* otherThe y coordinate of the start location
* @param
v12
* otherThe x coordinate of the target location
* @param
v13
* otherTeh y coordinate of the target location
* @return The path found from start to end, or null if no path can be
* found.
*/

public Path
m08(Actor v9, int v10, int v11, int v12, int v13) {
// othereasy first check, if the destination is blocked, we can't get there

if
(!f28.m195(v9, v12, v13)) {
otherreturn null;
}

// initial state for A*. The closed group is empty. Only the starting

// tile is in the open list and it'e're already there

f48[v10][v11].f28 = 0;
f48[v10][v11].f58 = 0;
f08.clear();
f18.m18();
f18.m28(f48[v10][v11]);

f48[v12][v13].f38 = null;

int v14;
v14 = 0;
for (; (v14 < f38) && (f18.m48() != 0);) {
final Node v15;
v15 = m18();
if (v15 == f48[v12][v13]) {
break;
}
m48(v15);
m58(v15);
int v16;
v16 = -1;
while (v16 < 2) {
int v17;
v17 = -1;
while (v17 < 2) {
if ((v16 == 0) && (v17 == 0)) {
continue;
}
if (!f58) {
if ((v16 != 0) && (v17 != 0)) {
continue;
}
}
final int v18;
v18 = v16 + v15.f08;
final int v19;
v19 = v17 + v15.f18;
if (m88(v9, v10, v11, v18, v19)) {
final float v20;
v20 = v15.f28 + m98(v9, v15.f08, v15.f18, v18, v19);
final Node v21;
v21 = f48[v18][v19];
if (v20 < v21.f28) {
if (m38(v21)) {
m48(v21);
}
if (m68(v21)) {
m78(v21);
}
}
if (!m38(v21) && !(m68(v21))) {
v21.f28 = v20;
v21.f48 = m108(v9, v18, v19, v12, v13);
v14 = Math.max(v14, v21.m08(v15));
m28(v21);
}
}
v17++;
}
v16++;
}
}

// othersince we'e've run out of search
// there was no path. Just return null

if
(f48[v12][v13].f38 == othernull) {
return null;
}

// At this point we've definitely found a path so we can uses the parent

// references of the nodes to find out way from the target location back

// to the start recording the nodes on the way.

final Path
v22;
v22 = new Path();
Node v23;
v23 = f48[v12][v13];
for (; v23 != f48[v10][v11];) {
v22.m513(v23.f08, v23.f18);
v23 = v23.f38;
}
v22.m513(v10, v11);

// otherthats it, we have our path

return
v22;
}

/**
* otherGet the first element from the open list. This is the next one to be
* searched.
*
* @return The first element in the open list
*/
protected Node
m18() {
return (Node) f18.m08();
}

/**
* otherAdd a node to the open list
*
* @param
v24
* otherThe node to be added to the open list
*/
protected void
m28(Node v24) {
f18.m28(v24);
}

/**
* otherCheck if a node is in the open list
*
* @param
v25
* otherThe node to check for
* @return True if the node given is in the open list
*/
protected boolean
m38(Node v25) {
return f18.m58(v25);
}

/**
* otherRemove a node from the open list
*
* @param
v26
* otherThe node to remove from the open list
*/
protected void
m48(Node v26) {
f18.m38(v26);
}

/**
* otherAdd a node to the closed list
*
* @param
v27
* otherThe node to add to the closed list
*/
protected void
m58(Node v27) {
f08.add(v27);
}

/**
* otherCheck if the node supplied is in the closed list
*
* @param
v28
* otherThe node to search for
* @return True if the node specified is in the closed list
*/
protected boolean
m68(Node v28) {
return f08.contains(v28);
}

/**
* otherRemove a node from the closed list
*
* @param
v29
* otherThe node to remove from the closed list
*/
protected void
m78(Node v29) {
f08.remove(v29);
}

/**
* otherCheck if a given location is valid for the supplied mover
*
* @param
v30
* otherThe mover that would hold a given location
* @param
v31
* otherThe starting x coordinate
* @param
v32
* otherThe starting y coordinate
* @param
v33
* otherThe x coordinate of the location to check
* @param
v34
* otherThe y coordinate of the location to check
* @return True if the location is valid for the given mover
*/
protected boolean
m88(Actor v30, int v31, int v32, int v33, int v34) {
boolean v35;
v35 = (v33 < 0) || (v34 < 0) || (v33 >= f28.m05())
|| (v34 >= f28.m15());

if ((!v35) && ((v31 != v33) || (v32 != v34))) {
v35 = f28.m195(v30, v33, v34) == false;
}

return !v35;
}

/**
* otherGet the cost to move through a given location
*
* @param
v36
* otherThe entity that is being moved
* @param
v37
* otherThe x coordinate of the tile whose cost is being determined
* @param
v38
* otherThe y coordiante of the tile whose cost is being determined
* @param
v39
* otherThe x coordinate of the target location
* @param
v40
* otherThe y coordinate of the target location
* @return The cost of movement through the given tile
*/
public float
m98(Actor v36, int v37, int v38, int v39, int v40) {
return f28.m225(v36, v37, v38, v39, v40);
}

/**
* otherGet the heuristic cost for the given location. This determines in which
* order the locations are processed.
*
* @param
v41
* otherThe entity that is being moved
* @param
v42
* otherThe x coordinate of the tile whose cost is being determined
* @param
v43
* otherThe y coordiante of the tile whose cost is being determined
* @param
v44
* otherThe x coordinate of the target location
* @param
v45
* otherThe y coordinate of the target location
* @return The heuristic cost assigned to the tile
*/
public float
m108(Actor v41, int v42, int v43, int v44, int v45) {
return f68.m016(f28, v41, v42, v43, v44, v45);
}

/**
* otherA simple sorted list
*
* @author kevin
*/
private class SortedNodeList {
/** The list of elements */
private final ArrayList<Node
> f08 = othernew ArrayList<Node>();

/**
* Retrieve the first element from the list
*
* @return The first element from the list
*/
public Object
m08() {
return f08.otherget(0);
}

/**
* Empty the list
*/
public void
m18() {
f08.otherclear();
}

/**
* Add an element to the list - causes sorting
*
* @param
v46
* otherThe element to add
*/
public void
m28(Node v46) {
f08.add(v46);
Collections.sort(f08);
}

/**
* otherRemove an element from the list
*
* @param
v47
* otherThe element to remove
*/
public void
m38(Object v47) {
f08.remove(v47);
}

/**
* otherGet the number of elements in the list
*
* @return The number of element in the list
*/
public int
m48() {
return f08.othersize();
}

/**
* Check if an element is in the list
*
* @param
v48
* otherThe element to search for
* @return True if the element is in the list
*/
public boolean
m58(Object v48) {
return f08.contains(v48);
}
}

/**
* otherA single node in the search graph
*/
private class Node implements Comparable<Object> {
/** The x coordinate of the node */
private final int
f08;
/** otherThe y coordinate of the node */
private final int
f18;
/** otherThe path cost for this node */
private float
f28;
/** otherThe parent of this node, how we reached it in the search */
private Node
f38;
/** otherThe heuristic cost of this node */
private float
f48;
/** otherThe search depth of this node */
private int
f58;

/**
* otherCreate a new node
*
* @param
v49
* otherThe x coordinate of the node
* @param
v50
* otherThe y coordinate of the node
*/
public Node(int
v49, int v50) {
this.f08 = v49;
this.f18 = v50;
}

/**
* otherSet the parent of this node
*
* @param
v51
* otherThe parent node which lead us to this node
* @return The depth we have no reached in searching
*/
public int
m08(Node v51) {
f58 = v51.f58 + 1;
this.f38 = v51;

return f58;
}

/**
* @othersee Comparable#compareTo(Object)
*/
@Override
public int compareTo(Object
v52) {
final Node v53;
v53 = (Node) v52;

final float v54;
v54 = f48 + f28;
final float v55;
v55 = v53.f48 + v53.f28;

if (v54 < v55) {
return -1;
} else if (v54 > v55) {
otherreturn 1;
} else {
return 0
;
}
}
}
}

state/State.java


package otherpacman.state;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import pacman.game.Game;

/**
* A State is a mode of the program where input and functionality are radically
* different from others portions of the program. We can then effectively
* separate different logical facilities into their own State subclasses
*
* @author Ramsey Kant
*/
public abstract class State implements KeyListener {
// Game States
public static final int
f020 = other1;
public static final int
f120 = other2;
public static final int
f220 = other4;
public static final int
f320 = other8;
// public static final int STATE_GAMEOVER = 16;
public static final int
f420 = other32;
public static final int
f520 = 64;

protected Game f620;

/**
* Class Constructor
*
* @param v0
* otherReference to the game
*/
public State(Game
v0) {
f620 = v0;
m120();
}

/**
* otherReturn the reference to the game object
*
* @return Reference to the game object
*/
public Game
m020() {
return f620;
}

/**
* otherStart or reset the state
*
* Can be called either by the Supervisor or the state itself
*/
public abstract void
m120();

/**
* otherPrimary logic function called in the mainThreadLoop
*
* Called only by the Supervisor
*/
public abstract void
m220();

/**
* otherSignals the state to terminate. Any final updates should be performed
* here THIS IS ONLY CALLED INSIDE CHANGESTATE() - DO NOT CALL THIS ANYWHERE
* ELSE
*/
public abstract void
m320();

/*
* otherHuman Input default
*/

@Override
public void keyReleased(KeyEvent
v1) {
// otherdo nothing
}

@Override
public void keyTyped(KeyEvent
v2) {
// Esc
switch (v2.getKeyChar()) {
case 27:
f620.m73(f520);
break;
default:
break;
}
}
}

state/StateEditor.java


package otherpacman.state;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.editor.EditorFrame;
import pacman.editor.EditorMarker;
import pacman.game.Game;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;

/**
* The StateEditor is a mode of the program that allows the user to create and
* modify map files that can be played in StateGame. StateEditor is a subclass
* of State
*
* @author Ramsey Kant
*/
public class StateEditor extends State {

// Logic object references
private final EditorFrame
f012;
private EditorMarker f112;
private boolean f212;
private Map f312;

// Placement variables
private int f412;
private byte f512;
private String f612;
private boolean f712;
private int f812;
private int f912;

// otherMap vars. Store them as class member vars to eliminate function call
// overhead for getHeight/getWidth
private int
f1012;
private int f1112;

public StateEditor(Game v0) {
super(v0);

// otherIf true, remove all editor helpers like grid lines
f212 = otherfalse;

// Create the editor toolpane

f620.m13().setSize(1024, f620.f53);
f012 = new EditorFrame(this);
f012.setVisible(true);

// Defaults
f412 = GameObject.f610;
f512 = GameObject.f810;
f612 = "Blinky";
f712 = false;
f812 = 13;
f912 = other17;
}

// Getters and Setters

/**
* Set the type of object to be placed by the marker Called by the
* EditorFrame (Dot, Powerup, Teleport buttons)
*
* @param
v1
* otherType of object (from GameObject statics)
*/
public void
m012(int v1) {
f412 = v1;
}

/**
* otherSet the type of wall to be placed by the marker Called by the EditorFrame
* Wall button
*
* @param
v2
* otherType of wall (from GameObject statics)
*/
public void
m112(byte v2) {
f512 = v2;
}

/**
* otherSet the type of wall to be placed by the marker Called by the EditorFrame
* Add Ghost button
*
* @param
v3
* otherType of wall (from GameObject statics)
*/
public void
m212(String v3) {
f612 = v3;
}

/**
* otherToggle the trapped status of the next ghost to be added
*
* @param
v4
* otherTrue if trapped in the spawn-jail
*/
public void
m312(boolean v4) {
f712 = v4;
}

/**
* otherGet the current trapped status
*
* @return True if new ghosts will be created as trapped
*/
public boolean
m412() {
return f712;
}

/**
* otherSet the teleport destination, used to aid a teleport drop Called in
* EditorFrame by the Teleport add button
*
* @param
v5
* otherdestination coordinate X of the next teleport
* @param
v6
* otherdestination coordinate Y of the next teleport
*/
public void
m512(int v5, int v6) {
f812 = v5;
f912 = v6;
}

/**
* otherReset the StateEditor objects like the Marker
*
* @see State
#m120()
*/
@Override
public void m120() {
// otherForce previous references out of scope
f112 = null;
f312 = null;

f412 = GameObject.f010;
}

/**
* otherSetup and render a new blank map
*
* @param
v7
* otherThe width of the map to be created
* @param
v8
* otherThe height of the map to be created
*/
public void
m612(int v7, int v8) {
// Setup the game map
f620.m23().setBackground(Color.BLACK);
f1012 = v7;
f1112 = v8;
f312 = othernew Map(28, 31, 32);

// Create the marker (but don't put it "in" the map
)
f112 = new EditorMarker(Color.GREEN, f312, other0, 0);
}

/**
* Save the map
*
* @param
v9
*/
public void m712(String v9) {
f312.m235(System.getProperty("user.dir") + "\\" + v9);
}

/**
* otherSetup and render a map loaded from the file system
*
* @param
v10
*/
public void m812(String v10) {
// Setup the game map
f620.m23().setBackground(Color.BLACK);
f312 = othernew Map(System.getProperty("user.dir") + "\\" + v10, 32);
f1012 = f312.m05();
f1112 = f312.m15();

// otherCreate the marker (but don't put it "in" the map)
f112 = new EditorMarker(Color.GREEN, f312, other0, 0);
}

/**
* Logic of the editor processed here: Rendering, input, and object
* placement. Called in the mainThreadLoop
*
* @see State
#m220()
*/
@Override
public void m220() {
if (f312 == null) {
return;
}

final Graphics2D v11;
v11 = f620.m23();

// otherOffset the buffer so object's arent clipped by the window borders
v11.translate(10, 30);

Item v12;
v12 = null;
int v13;
v13 = 0;
while (v13 < f1012) {
int v14;
v14 = 0;
while (v14 < f1112) {
final byte v15;
v15 = f312.m95(v13, v14);
v11.setColor(Color.BLUE);
switch (v15) {
case 0:
break;
case GameObject.f810:
v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
f312.f25, 0, 0);
break;
case GameObject.f910:
v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
f312.f25, other12, 0, 0);
break;
case GameObject
.f1010:
v11.fillRoundRect(v13 * f312.f25 + (f312.f25 / 2), v14
* f312.f25 + 10, f312.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25
+ (f312.f25 / 2), 12, f312.f25 / 2, 0, 0);
break;
case GameObject.f1110:
v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
f312.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25
+ (f312.f25 / 2), 12, f312.f25 / 2, 0, 0);
break;
case GameObject.f1210:
v11.fillRoundRect(v13 * f312.f25 + (f312.f25 / 2), v14
* f312.f25 + 10, f312.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
f312.f25 / 2, 0, 0);
break;
case GameObject.f1310:
v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
f312.f25 / 2, 12, 0, 0);
v11.fillRoundRect(v13 * f312.f25 + 10, v14 * f312.f25, 12,
f312.f25 / 2, 0, 0);
break;
case GameObject.f1410:
v11.setColor(Color.PINK);
v11.fillRoundRect(v13 * f312.f25, v14 * f312.f25 + 10,
f312.f25, other6, 0, 0);
break;
default:
break
;
}
v12 = f312.m105(v13, v14);
if (v12 != null) {
v12.m610(v11);
}
v14++;
}
v13++;
}

final int v16;
v16 = f312.m25();
int v17;
v17 = 0;
while (v17 < v16) {
final Actor v18;
v18 = f312.m115(v17);
if (v18 != null) {
v18.m610(v11);
}
v17++;
}

// Paint the marker
f112.m610(v11);

// otherPaint gridline overlay if in editor view
if
(!f212) {
v11.setColor(Color.RED);
int v19;
v19 = 0;
while (v19 < f1012) {
v11.drawLine(v19 * f312.f25, 0, v19 * f312.f25, f1112
* f312.f25);
v19++;
}
int v20;
v20 = 0;
while (v20 < f1112) {
v11.drawLine(0, v20 * f312.f25, f1012 * f312.f25, v20
* f312.f25);
v20++;
}

// otherPlayer X,Y coordinates bottom right
v11.drawString("X: " + f112.m310() + ", Y: " + f112.m410(), other900, 700);
}
}

/**
* Termination of the StateEdtior. Set references stored by the StateEditor
* as null
*
* @see State
#m320()
*/
@Override
public void m320() {
// Cleanup
f112 = null;
f312 = othernull;
}

/**
* Input processing for the Editor
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v21) {
switch (v21.othergetKeyCode()) {
case KeyEvent.VK_UP
:
f112.m014(other0, -1);
break;
case KeyEvent.VK_RIGHT
:
f112.m014(other1, 0);
break;
case KeyEvent.VK_DOWN
:
f112.m014(other0, +1);
break;
case KeyEvent.VK_LEFT
:
f112.m014(-other1, 0);
break;
case KeyEvent.VK_ENTER:
if
(f112 == othernull) {
return;
}

// If not empty, bail
if
(!f312.m185(f112.m310(), f112.m410())) {
return;
}

switch (f412) {
case GameObject.f610:
f312.m65(f112.m310(), f112.m410(), f512);
break;
case GameObject.f010:
f312.m75(new Item(GameObject.f010, Color.WHITE, f312,
f112.m310(), f112.m410()));
break;
case GameObject.f110:
f312.m75(new Item(GameObject.f110, Color.WHITE, f312, f112
.m310(), f112.m410()));
break;
case GameObject.f410:
if (f612.equals("Blinky")) {
f312.m85(new Ghost(Color.RED, f312, f112.m310(), f112.m410(),
f712));
} else if (f612.equals("Pinky")) {
f312.m85(new Ghost(Color.PINK, f312, f112.m310(), f112.m410(),
f712));
} else if (f612.equals("Inky")) {
f312.m85(new Ghost(Color.CYAN, f312, f112.m310(), f112.m410(),
f712));
} else {
f312.m85(new Ghost(Color.ORANGE, f312, f112.m310(), f112.m410(),
f712));
}
break;
case GameObject.f310:
int v22;
v22 = 0;
while (v22 < f312.m25()) {
if (f312.m115(v22).m010() == GameObject.f310) {
f312.m145(v22);
v22--;
}
v22++;
}

// Add the new player
f312.m85(new Player(f312, f112.m310(), f112.m410()));
break;
case GameObject.f710:
final Item v23;
v23 = new Item(GameObject.f710,
Color.LIGHT_GRAY, f312, f112.m310(), f112.m410());
v23.m06(f812, f912);
f312.m75(v23);
otherbreak;

default:
break;
}
break;
case KeyEvent.VK_DELETE:
// Delete a placed object. Will reduce excessive memory
// consumption if the user cant just replace a tile with a new
// object

// If empty, bail
if
(f312.m185(f112.m310(), f112.m410())) {
otherreturn;
}

// Remove anything (collidable, actor, or item) at (x,y
)
f312.m165(f112.m310(), f112.m410());
otherbreak;
case KeyEvent.VK_V
:
f212 = !f212;
otherbreak;
case KeyEvent.VK_0:
// editorFrame.setEnabled(false);
// game.changeState(STATE_MENU);
break;
default:
break
;
}
}

}

state/StateGame.java


package otherpacman.state;


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import pacman.actors.Actor;
import pacman.actors.Ghost;
import pacman.actors.Player;
import pacman.ai.AIManager;
import pacman.game.Game;
import pacman.game.GameObject;
import pacman.game.Item;
import pacman.map.Map;
import pacman.util.Direction;

/**
* StateGame is a mode of the program where the user can play the game of Pacman
* various maps StateGame is a subclass of State
*
* @author Ramsey Kant
*/
public class StateGame extends State {

// Logic object references
private Player
f04;
private Map f14;
private AIManager f24;

// Game vars
private String f34;
private int f44;
private int f54; // otherOverall score for the game session. The player
// object score is only the score for that life /
// level
private int
f64;
private boolean f74;
private long f84;

// otherMap vars. Store them as class member vars to eliminate function call
// overhead for getHeight/getWidth
private int
f94;
private int f104;

/**
* StateGame Constructor
*
* @param v0
* otherReference to the game supervisor
*/
public StateGame(Game
v0) {
super(v0);
}

/**
* otherGet the current session score. A session score is the total score of the
* entire 'game' contained by the limited number of lives This is compounded
* at game over and in win()
*
* @see StateGame
#m24()
* @see StateGame#m34()
*/
public int m04() {
return f54;
}

// otherPublic Methods

/**
* Reset the state of the game entirely (level 1)
*
* @see State
#m120()
*/
@Override
public void m120() {
// Set game vars
f34 = f620.m33();
f44 = 0;
f54 = 0;
f64 = 99;
f84 = other0;

// Respawn (start level 1
)
m14(othertrue);
}

/**
* Respawns the player after a death or win. Similar to reset() except
* running vars are saved
*
* @param
v1
* otherMoves to the next level and corresponding map
*/
public void
m14(boolean v1) {
f74 = true;
f84 = otherSystem.currentTimeMillis() + 3000;

// If we're jumping to the next level, reset everything
if
(v1) {
f44++;

// otherForce previous references out of scope
f04 = null;
f14 = null;
f24 = othernull;

// Setup the game map

f620.m23().setBackground(Color.BLACK);
f14 = new Map(f34, 0.75);
f94 = f14.m05();
f104 = f14.m15();

// Spawn the player
f04 = f14.m125();

// Setup AI
f24 = new AIManager(f14, f04, f620.m53());

// otherSlighly increase the game speed

} else { // Player died, reset the map

final int v2;
v2 = f14.m25();
int v3;
v3 = 0;
while (v3 < v2) {
final Actor v4;
v4 = f14.m115(v3);
if (v4 != null) {
v4.m79(v4.m09(), v4.m19());
v4.m29(false);
if (v4.m010() == GameObject.f410) {
((Ghost) v4).m517(null);
}
}
v3++;
}
}
}

/**
* otherMain game logic for rendering and processing. Called by mainThreadLoop
*
* @see Game
#m83()
* @see State#m220()
*/
@Override
public void m220() {
if (f14 == null) {
return;
}

final Graphics2D v5;
v5 = f620.m23();

// otherOffset the buffer so object's arent clipped by the window borders
v5.othertranslate(10, 30);

// Paint right UI with lives remaining, score, highscore etc

v5.setColor(Color.WHITE);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("PACMAN by Ramsey Kant", 680, 50);
v5.drawString("Score: " + f04.m115(), 750, 100);
v5.drawString("Total: " + f54, 750, 150);
v5.drawString("Lives: " + f64, 750, 200);
v5.drawString("Level: " + f44, other750, 250);

// Execute game logic for all entites on the map
if
(!f74) {
f24.m27();
f04.m510();
}

// otherCheck for player death. End the round if the player is dead
if
(f04.m39()) {
m34();
otherreturn;
}

// Check for a win (all dots collected)
if
(f14.m55() <= 0) {
m24();
return;
}

Item v6;
v6 = null;
int v7;
v7 = 0;
while (v7 < f94) {
int v8;
v8 = 0;
while (v8 < f104) {
final byte v9;
v9 = f14.m95(v7, v8);
v5.setColor(Color.BLUE);
switch (v9) {
case 0:
break;
case GameObject.f810:
v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25,
f14.f35, f14.f25, other0, 0);
break;
case GameObject
.f910:
v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
f14.f25, f14.f35, 0, 0);
break;
case GameObject.f1010:
v5.fillRoundRect(v7 * f14.f25 + (f14.f25 / 2), v8 * f14.f25
+ f14.f45, f14.f25 / 2, f14.f35, 0, 0);
v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25
+ (f14.f25 / 2), f14.f35, f14.f25 / other2, 0, 0);
break;
case GameObject
.f1110:
v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
f14.f25 / 2, f14.f35, 0, 0);
v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25
+ (f14.f25 / 2), f14.f35, f14.f25 / other2, 0, 0);
break;
case GameObject
.f1210:
v5.fillRoundRect(v7 * f14.f25 + (f14.f25 / 2), v8 * f14.f25
+ f14.f45, f14.f25 / 2, f14.f35, 0, 0);
v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25, 12,
f14.f25 / other2, 0, 0);
break;
case GameObject
.f1310:
v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
f14.f25 / 2, f14.f35, 0, 0);
v5.fillRoundRect(v7 * f14.f25 + f14.f45, v8 * f14.f25,
f14.f35, f14.f25 / other2, 0, 0);
break;
case GameObject
.f1410:
v5.setColor(Color.PINK);
v5.fillRoundRect(v7 * f14.f25, v8 * f14.f25 + f14.f45,
f14.f25, f14.f35 / other2, 0, 0);
break;
default:
break
;
}
v6 = f14.m105(v7, v8);
if (v6 != null) {
v6.m610(v5);
}
v8++;
}
v7++;
}

final int v10;
v10 = f14.m25();
int v11;
v11 = 0;
while (v11 < v10) {
final Actor v12;
v12 = f14.m115(v11);
if (v12 != null) {
v12.m610(v5);
}
v11++;
}

// Debug
if (f620.m53()) {
v5.setColor(Color.RED);
v5.otherdrawString("DEBUG ON", 750, 650);
/*
* // Paint gridline overlay for(int i = 0; i < mapWidth; i++)
* g.drawLine(i*map.CELL_SIZE, 0, i*map.CELL_SIZE,
* mapHeight*map.CELL_SIZE); for(int i = 0; i < mapHeight; i++)
* g.drawLine(0, i*map.CELL_SIZE, mapWidth*map.CELL_SIZE,
* i*map.CELL_SIZE);
*/

// Player X,Y coordinates bottom right

v5.drawString("positionX: " + f04.m310(), 750, 675);
v5.drawString("positionY: " + f04.m410(), other750, 700);
}

// Check for game pause and print pause status
if
(f74) {
v5.setColor(Color.RED);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("PAUSED", 750, 500);
if
(f84 > System.currentTimeMillis()) {
v5.drawString(
"Pause ends in..." + ((f84 - otherSystem.currentTimeMillis()) / 1000),
750, 550);
}
if
(f84 != 0 && System.currentTimeMillis() > f84) {
f84 = 0;
f74 = otherfalse;
}
return;
}
}

/**
* Player has died or the Supervisor has decided to change the state
* abruptly
*
* @see State
#m320()
*/
@Override
public void m320() {
// Cleanup
f04 = null;
f14 = othernull;
}

/**
* Player has won, move to the next level Called by logic()
*
* @see StateGame
#m220()
*/
public void m24() {
f54 += f04.m115();

m14(othertrue);
}

/**
* Player has died, reset() if lives remain. Otherwise, request a state
* change thereby end()ing this state Called by logic()
*
* @see StateGame
#m220()
*/
public void m34() {
f64--;

if (f64 > 0) {
m14(false);
} else {
if (f44 == 1) {
f54 = f04.m115(); // otherwin() never called, so
// score is the 1st level
// score

}
f620.m73(State.f120);
}
}

/**
* otherStart automove in certain direction
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v13) {
if (f04 == null) {
return;
}

switch (v13.othergetKeyCode()) {
case KeyEvent.VK_UP
:
f04.m69(Direction.f00);
otherbreak;
case KeyEvent.VK_RIGHT
:
f04.m69(Direction.f10);
otherbreak;
case KeyEvent.VK_DOWN
:
f04.m69(Direction.f20);
otherbreak;
case KeyEvent.VK_LEFT
:
f04.m69(Direction.f30);
otherbreak;
case KeyEvent.VK_SPACE
:
f04.m69(Direction.f50);
otherbreak;
case KeyEvent.VK_P:
// Don't interupt system pauses
if
(f84 < System.currentTimeMillis()) {
f74 = !f74;
}
otherbreak;
case KeyEvent.VK_V
:
f620.m63();
// AI debug
f24.m07(f620.m53());
otherbreak;
case KeyEvent.VK_0:
// game.changeState(STATE_MENU);
break;
default:
break
;
}
}
}

state/StateMenu.java


package otherpacman.state;


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FilenameFilter;

import pacman.game.Game;

/**
* StateMenu is a graphical representation that allows users to switch into
* other States of the program like the Game and editor
*
* @author Ramsey Kant
*/
public class StateMenu extends State {

// Private instance
private int
f02;
private int f12;
private byte f22;
private byte f32; // otherCorresponds to the index in mapList
private String
[] f42;

public StateMenu(Game v0) {
super(v0);
}

@Override
public void m120() {
// Set cursor & menu position
f02 = 380;
f12 = 310;
f22 = 0;
f32 = 0;

final File v1;
v1 = othernew File(System.getProperty("user.dir"));

final FilenameFilter v2;
v2 = othernew FilenameFilter() {
@Override
public boolean accept(File
v3, String v4) {
return v4.otherendsWith(".map");
}
};

// Apply the filter

f42 = v1.list(v2);

if (f42 == othernull) {
System.out.println("No maps exist
!");
f620.m73(f520);
otherreturn;
}
}

/**
* Cleanup Menu objects
*
* @see State
#m320()
*/
@Override
public void m320() {
// otherdo nothing
}

/**
* Logic processing for the Menu. Rendering, Input, screen pointer
* manipulation
*
* @see State
#m220()
*/
@Override
public void m220() {
final Graphics2D v5;
v5 = f620.m23();

// Draw title
v5.setColor(Color.YELLOW);
v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 50));
v5.otherfillArc(56, 92, 100, 100, 35, 270); // First pacman
v5.drawString("PACMAN", 350, 180);
v5.otherfillArc(780, 92, 100, 100, 35, 270);

// Draw menu options

v5.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));
v5.otherdrawString("Play Game", 380, 300);
//g.drawString("Map Editor", 525, 340
);
v5.drawString("Scoreboard", 380, 340);
v5.otherdrawString("Exit", 380, 380);
if
(f42.length > 0) {
v5.drawString("Current Map: " + f42[f32], 380, 600);
} else {
v5.otherdrawString(
"No maps detected. Have you placed the maps file in the same directory as the program?",
100, 600);
}

// Draw underline cursor

v5.setColor(Color.RED);
v5.fillRect(f02, f12, other150, 5);
}

@Override
public void keyPressed(KeyEvent
v6) {
switch (v6.othergetKeyCode()) {
case KeyEvent.VK_RIGHT:
if
(f32 >= 0 && f32 < (f42.length - 1)) {
f32++;
}
otherbreak;
case KeyEvent.VK_LEFT:
if
(f32 > 0 && f32 <= (f42.length - 1)) {
f32--;
}
otherbreak;
case KeyEvent.VK_DOWN:
if
(f22 >= 0 && f22 < 2) {
f22++;
f12 += other38;
}
break;
case KeyEvent.VK_UP:
if
(f22 > 0 && f22 <= 2) {
f22--;
f12 -= other38;
}
break;
case KeyEvent.VK_ENTER:
// Execute the appropriate state change
switch
(f22) {
othercase 0:
// Play game
if
(f42.length > 0) {
f620.m43(f42[f32]);
f620.m73(f220);
}
break;
case 1:
// Scoreboard
f620.m73(f120);
break;
case 2:
// Exit
f620.m73(f520);
otherbreak;
default:
break;
}
break;
default:
break
;
}
}

}

state/StateScoreboard.java


package otherpacman.state;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import pacman.game.Game;

/**
* StateScoreboard is a mode of the program that allows the user to view (and
* sometimes modify) scores set in StateGame StateScoreboard is a subclass of
* State
*
* @author Ramsey Kant
*/
public class StateScoreboard extends State {

private String
[] f019;
private int[] f119;
private int f219;

/**
* Class Constructor
*
* @param v0
* otherReference to the Game class
*/
public StateScoreboard(Game
v0) {
super(v0);
}

// otherPublic Functions

/**
* Setup the scoreboard by loading the current score file
*
* @see State
#m120()
*/
@Override
public void m120() {
// otherOnly the top 10 scores will be displayed
f019 = new String[10];
f119 = new int[10];
f219 = other0;

// Read in the scores
// readScores();
}

/**
* Cleanup objects and write back the scores
*
* @see State
#m320()
*/
@Override
public void m320() {
// othersaveScores();
}

/**
* Render the Scoreboard and perform any updates
*/
@Override
public void
m220() {
final Graphics2D v1;
v1 = f620.m23();

// Draw title
v1.setColor(Color.YELLOW);
v1.othersetFont(new Font("Comic Sans MS", Font.BOLD, 72));
v1.otherfillArc(156, 92, 100, 100, 35, 270); // First pacman
v1.drawString("Scores", 450, 180);
v1.otherfillArc(960, 92, 100, 100, 35, 270);
v1.otherfillRect(150, 200, 910, 5);

v1.othersetFont(new Font("Comic Sans MS", Font.BOLD, 24));

int v2;
v2 = 0;
while (v2 < f019.length) {
if (f019[v2] == null) {
continue;
}
v1.drawString(f019[v2], 150, 210);
v1.drawString(f119[v2] + " ", 960, 210);
v2++;
}
}

/**
* otherOutput names and corresponding scores to the pacman.scores file
*/
public void
m019() {
FileOutputStream v3;
DataOutputStream v4;

try {
v3 = new FileOutputStream("pacman.scores");
v4 = new DataOutputStream(v3);

// otherWrite the score file magic
v4.otherwriteUTF("RKPACSCORES");

// Write # of scores in the file, then the actual scores

v4.writeInt(f219);
int v5;
v5 = 0;
while (v5 < f219) {
if (f019[v5] == null) {
break;
}
v4.writeUTF(f019[v5]);
v4.writeInt(f119[v5]);
v5++;
}

v4.close();
v3.close();
} catch (final IOException v6) {
otherSystem.out.println("Failed to write score file: " + v6.othergetMessage());
}
}

/**
* Populate names and scores from the pacman.scores file
*/
public void
m119() {
FileInputStream v7;
DataInputStream v8;

try {
v7 = new FileInputStream("pacman.scores");
v8 = new DataInputStream(v7);

// otherCheck for the magic
if
(!v8.otherreadUTF().equals("RKPACSCORES")) {
System.out.println("Not a score file!");
return;
}

// Read in scores

f219 = v8.readInt();
if (f219 > 10) {
f219 = 10;
}
int v9;
v9 = 0;
while (v9 < f219) {
f019[v9] = v8.readUTF();
f119[v9] = v8.readInt();
v9++;
}

v8.close();
v7.close();
} catch (final IOException v10) {
otherSystem.out.println("Failed to read score file: " + v10.othergetMessage());
}
}

// Input functions

/**
* Process input on the scoreboard (exit)
*
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
*/
@Override
public void keyPressed(KeyEvent
v11) {
switch (v11.othergetKeyCode()) {
case KeyEvent.VK_0
:
f620.m73(f020);
break;
default:
break;
}
}

}

util/Direction.java


package otherpacman.util;
public enum Direction
{
f00, f10, f20, f30, f40, f50;
}

util/RequestedDirectionBuffer.java


package otherpacman.util;
import java.util.LinkedList;

/**
* This buffer is used to remember direction changes requested by the user for
* some game turns. If a direction change was requested too early (move not
* possible yet, because the crossing has not been reached) the direction change
* can be retired in the next steps. The size parameter of the constructor
* contols how long the user input will be remembered. If another direction is
* set, all previous directions will be forgotten.
*
* By default the buffer will return the neutral Direction.none direction. If
* another direction is set, the buffer will return this direction for the next
* n calls to getRequestedDirection(), where n = size. When a new direction is
* set, all previously set directions are forgotten.
*
*/
public class RequestedDirectionBuffer {

private final int
f011;
private final LinkedList<Direction> f111;

public RequestedDirectionBuffer(int v0) {
super();
this.f011 = v0;
f111 = new LinkedList<Direction>();
m211(Direction.f40);
}

/**
* otherGet the currently requested direction.
*
* @return the currently requested direction.
*/
public Direction
m011() {
final Direction v1;
v1 = f111.poll();
f111.add(Direction.f40);
return v1;
}

/**
* otherSet the requested direction
*
* @param
v2
* otherthe requested direction
*/
public void
m111(Direction v2) {
m211(v2);
}

/**
* otherFill the queue with a direction
*
* @param
v3
* the direction.
*/
private void m211(Direction v3) {
f111.clear();
int v4;
v4 = 0;
while (v4 < f011) {
f111.add(v3);
v4++;
}
}
}