Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Importing source code for MicropolisJ, the Java rewrite of Micropolis.
This edition of Micropolis, written for the Java desktop platform, is fairly feature complete. I believe the only missing functionality is that of loading the built-in scenarios, and this can be implemented if there is any demand for it. I will soon update the home page at http://code.google.com/p/micropolis/ with downloadable packages of this edition of the software.
- Loading branch information
jason@long.name
committed
Feb 14, 2013
1 parent
6925322
commit 2b8f979
Showing
189 changed files
with
13,184 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Prerequisites | ||
============= | ||
|
||
To build MicropolisJ you will need | ||
* Java Development Kit (version 7), get it from http://oracle.com/technetwork/java | ||
* Apache Ant, get it from http://ant.apache.org | ||
|
||
|
||
Building the Package | ||
==================== | ||
|
||
1. `cd' to the directory containing the package's source code. | ||
|
||
2. Type `ant' to compile the package. | ||
|
||
|
||
Installing MicropolisJ | ||
====================== | ||
|
||
Everything you need to run the program is contained within the micropolisj.jar | ||
file, so just copy that file to wherever you like. | ||
|
||
|
||
Running MicropolisJ | ||
=================== | ||
|
||
Type `java -jar micropolisj.jar` to run the program. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
======================================================================== | ||
|
||
MicropolisJ (Micropolis in Java) | ||
|
||
======================================================================== | ||
|
||
MicropolisJ is Micropolis for the Java platform. | ||
Copyright (C) 2013 Jason Long (jason@long.name). | ||
Portions Copyright (C) 1989-2007 Electronic Arts Inc. | ||
|
||
MicropolisJ is based on Micropolis, Unix version, which was developed by | ||
Don Hopkins (dhopkins@DonHopkins.com, http://www.DonHopkins.com) for | ||
DUX Software under license from Maxis, in or around 1990. This version | ||
was later modified for inclusion in the One Laptop Per Child (OLPC) | ||
program, and released as free and open source software under the GPL in | ||
2008. | ||
Copyright (C) 1989-2007 Electronic Arts Inc. | ||
|
||
The original Micropolis game was designed and implemented by Will Wright. | ||
Copyright (C) 2002 by Electronic Arts. | ||
|
||
======================================================================== | ||
|
||
See the INSTALL file for instructions on building the program from this | ||
source code release. | ||
|
||
See the COPYING file for the full text copy of the GNU General Public | ||
License. | ||
|
||
If you need assistance with this program, you may contact: | ||
Jason Long (jason@long.name) | ||
|
||
======================================================================== | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or (at | ||
your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
General Public License for more details. You should have received a | ||
copy of the GNU General Public License along with this program. If | ||
not, see <http://www.gnu.org/licenses/>. | ||
|
||
ADDITIONAL TERMS per GNU GPL Section 7 | ||
|
||
No trademark or publicity rights are granted. This license does NOT | ||
give you any right, title or interest in the trademark SimCity or any | ||
other Electronic Arts trademark. You may not distribute any | ||
modification of this program using the trademark SimCity or claim any | ||
affliation or association with Electronic Arts Inc. or its employees. | ||
Any propagation or conveyance of this program must include this | ||
copyright notice and these terms. | ||
|
||
If you convey this program (or any modifications of it) and assume | ||
contractual liability for the program to recipients of it, you agree | ||
to indemnify Electronic Arts for any liability that those contractual | ||
assumptions impose on Electronic Arts. | ||
|
||
You may not misrepresent the origins of this program; modified | ||
versions of the program must be marked as such and not identified as | ||
the original program. | ||
|
||
This disclaimer supplements the one included in the General Public | ||
License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS | ||
PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY | ||
OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF | ||
SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS | ||
DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES, | ||
INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, | ||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY | ||
RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING, | ||
USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST | ||
INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL | ||
MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE | ||
UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE | ||
WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE | ||
CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR | ||
ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME | ||
JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED | ||
WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A | ||
CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY | ||
NOT APPLY TO YOU. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Autodoze- | ||
*Do not autodoze for roads,rails, or wire if not enough money to actually | ||
build it | ||
|
||
Budget dialog- | ||
*Press escape to close | ||
|
||
Coal powerplant- | ||
*When third tile of second row is on fire, something appears to revert it to | ||
the animated smoke stack. | ||
|
||
On Game Load- | ||
*All zones are unpowered for the first several ticks. I'd imagine there | ||
are similar problems with the landValueMap, pollutionMap, tfDensity, | ||
policeCoverage etc. I think what should happen is that the various methods | ||
that update these maps should be called at load time. | ||
*Evaluation data is not available. | ||
*cityTime may not match history.cityTime | ||
|
||
Mouse pointer- | ||
*Would be nice if tool dragging would help keep lines straight | ||
|
||
Disasters- | ||
*When running FAST or SUPER_FAST, automatically pause or slow down the | ||
simulation when a disaster occurs. | ||
|
||
City size notifications- | ||
*Pause and pop up a message the first time the city reaches 2000, 10000, | ||
50000, etc. people. | ||
|
||
Code janitor- | ||
*Rename fireZone() to killZone()... (I think that name might be better description.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!-- | ||
// This file is part of MicropolisJ. | ||
// Copyright (C) 2013 Jason Long | ||
// Portions Copyright (C) 1989-2007 Electronic Arts Inc. | ||
// | ||
// MicropolisJ is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU GPLv3, with additional terms. | ||
// See the README file, included in this distribution, for details. | ||
--> | ||
<project name="micropolisj" default="all"> | ||
|
||
<property name="package-version" value="1.0" /> | ||
|
||
<property name="srcdir" location="src" /> | ||
<property name="builddir" location="build" /> | ||
<property name="distfile" value="${ant.project.name}.jar" /> | ||
<property name="zipfile" value="${ant.project.name}-${package-version}.zip" /> | ||
|
||
<path id="build-classpath"> | ||
<fileset dir="extlib"> | ||
<include name="*.jar" /> | ||
</fileset> | ||
</path> | ||
|
||
<target name="init-builddir"> | ||
<mkdir dir="${builddir}" /> | ||
<mkdir dir="extlib" /> | ||
</target> | ||
|
||
<target name="copy-resources" depends="init-builddir"> | ||
<copy todir="${builddir}"> | ||
<fileset dir="resources" | ||
excludes="**/*.xcf **/Thumbs.db" | ||
/> | ||
</copy> | ||
<copy todir="${builddir}/micropolisj"> | ||
<fileset dir="strings" /> | ||
</copy> | ||
</target> | ||
|
||
<target name="compile" depends="init-builddir"> | ||
<javac srcdir="${srcdir}" | ||
destdir="${builddir}" | ||
classpathref="build-classpath" | ||
includeantruntime="false" | ||
debug="true" debuglevel="lines,vars,source" | ||
source="1.7" target="1.7" | ||
> | ||
<compilerarg value="-Xlint:unchecked" /> | ||
<compilerarg value="-Xlint:deprecation" /> | ||
</javac> | ||
</target> | ||
|
||
<target name="build" depends="copy-resources,compile"> | ||
<pathconvert property="runtime-classpath" pathsep=" " refid="build-classpath"> | ||
<map from="${basedir}" to="." /> | ||
</pathconvert> | ||
|
||
<jar destfile="${distfile}" basedir="${builddir}"> | ||
<manifest> | ||
<attribute name="Main-Class" value="micropolisj.Main" /> | ||
<attribute name="Class-Path" value="${runtime-classpath}" /> | ||
<attribute name="Implementation-Version" value="${package-version}" /> | ||
</manifest> | ||
</jar> | ||
</target> | ||
|
||
<target name="all" depends="build"> | ||
</target> | ||
|
||
<target name="clean"> | ||
<delete dir="${builddir}" /> | ||
<delete file="${distfile}" /> | ||
<delete> | ||
<fileset dir="." includes="${ant.project.name}*.zip" /> | ||
</delete> | ||
</target> | ||
|
||
<target name="dist" depends="build"> | ||
<zip destfile="${zipfile}"> | ||
<fileset dir="." includes="${distfile}, ${ant.project.name}.ico, README, COPYING" /> | ||
</zip> | ||
</target> | ||
|
||
<target name="javadoc"> | ||
<mkdir dir="docs/api" /> | ||
<javadoc sourcepath="src" destdir="docs/api" | ||
classpathref="build-classpath" | ||
Private="true" | ||
> | ||
<link href="http://docs.oracle.com/javase/7/docs/api" /> | ||
<link href="http://docs.oracle.com/cd/E17802_01/j2se/javase/technologies/desktop/java3d/forDevelopers/J3D_1_3_API/j3dapi" /> | ||
</javadoc> | ||
</target> | ||
|
||
</project> |
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This file is part of MicropolisJ. | ||
// Copyright (C) 2013 Jason Long | ||
// Portions Copyright (C) 1989-2007 Electronic Arts Inc. | ||
// | ||
// MicropolisJ is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU GPLv3, with additional terms. | ||
// See the README file, included in this distribution, for details. | ||
|
||
package micropolisj; | ||
|
||
import micropolisj.gui.MainWindow; | ||
|
||
public class Main | ||
{ | ||
public static void main(String [] args) | ||
{ | ||
MainWindow win = new MainWindow(); | ||
win.setVisible(true); | ||
win.doNewCity(true); | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
micropolis-java/src/micropolisj/engine/AirplaneSprite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// This file is part of MicropolisJ. | ||
// Copyright (C) 2013 Jason Long | ||
// Portions Copyright (C) 1989-2007 Electronic Arts Inc. | ||
// | ||
// MicropolisJ is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU GPLv3, with additional terms. | ||
// See the README file, included in this distribution, for details. | ||
|
||
package micropolisj.engine; | ||
|
||
public class AirplaneSprite extends Sprite | ||
{ | ||
int destX; | ||
int destY; | ||
|
||
// Note: frames 1-8 used for regular movement | ||
// 9-11 used for Taking off | ||
static int [] CDx = { 0, 0, 6, 8, 6, 0, -6, -8, -6, 8, 8, 8 }; | ||
static int [] CDy = { 0, -8, -6, 0, 6, 8, 6, 0, -6, 0, 0, 0 }; | ||
|
||
public AirplaneSprite(Micropolis engine, int xpos, int ypos) | ||
{ | ||
super(engine, SpriteKind.AIR); | ||
this.x = xpos * 16 + 8; | ||
this.y = ypos * 16 + 8; | ||
this.width = 48; | ||
this.height = 48; | ||
this.offx = -24; | ||
this.offy = -24; | ||
|
||
this.destY = this.y; | ||
if (xpos > engine.getWidth()-20) { | ||
// not enough room to east of airport for taking off | ||
this.destX = x - 200; | ||
this.frame = 7; | ||
} | ||
else { | ||
this.destX = x + 200; | ||
this.frame = 11; | ||
} | ||
} | ||
|
||
@Override | ||
public void moveImpl() | ||
{ | ||
int z = this.frame; | ||
|
||
if (city.acycle % 5 == 0) { | ||
if (z > 8) { //plane is still taking off | ||
z--; | ||
if (z < 9) { z = 3; } | ||
this.frame = z; | ||
} | ||
else { // go to destination | ||
int d = getDir(x, y, destX, destY); | ||
z = turnTo(z, d); | ||
this.frame = z; | ||
} | ||
} | ||
|
||
if (getDis(x, y, destX, destY) < 50) { // at destination | ||
//FIXME- original code allows destination to be off-the-map | ||
destX = city.PRNG.nextInt(city.getWidth()) * 16 + 8; | ||
destY = city.PRNG.nextInt(city.getHeight()) * 16 + 8; | ||
} | ||
|
||
if (!city.noDisasters) { | ||
boolean explode = false; | ||
|
||
for (Sprite s : city.allSprites()) { | ||
if (s != this && | ||
(s.kind == SpriteKind.AIR || s.kind == SpriteKind.COP) && | ||
checkSpriteCollision(s)) | ||
{ | ||
s.explodeSprite(); | ||
explode = true; | ||
} | ||
} | ||
if (explode) { | ||
explodeSprite(); | ||
} | ||
} | ||
|
||
this.x += CDx[z]; | ||
this.y += CDy[z]; | ||
} | ||
} |
Oops, something went wrong.