Skip to content

Commit 3bf267f

Browse files
committed
upstream updates
2 parents 6362287 + e90aa49 commit 3bf267f

File tree

15 files changed

+161
-70
lines changed

15 files changed

+161
-70
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
target/
44
*.o
55
DroidQuest
6+
.idea/
7+
*.iml

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MV = mvn
44
CFLAGS=-Wall -Werror -ggdb
55

66
BIN=DroidQuest
7-
JAR=dq-2.7.jar
7+
JAR=dq-2.8.jar
88

99
all:
1010
$(CC) $(CFLAGS) dq.c -o dq.o

README

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,50 @@ Droid Quest
33

44
A Java recreation of the classic game Robot Odyssey I
55

6+
=======
7+
Build with:
8+
9+
mvn install
10+
11+
Run the game:
12+
13+
MacOSX / Linux: ./start.sh
14+
Windows: start.bat (IN PROGRESS)
15+
OR
16+
java -jar target/dq-2.8.jar
17+
18+
Controls:
19+
20+
/ - contextual help
21+
arrows - normal movement
22+
control + arrows - fine-grained movement [OS X: command + arrows]
23+
space - pickup/drop
24+
C - game cursor
25+
H - hot cursor
26+
S - solder pen
27+
R - toggle radio
28+
P - paintbrush
29+
T - toolbox
30+
[, ] - rotate device
31+
F - flip
32+
L - load small chip
33+
E - enter robot
34+
X - exit robot
35+
36+
Cheat/debug:
37+
38+
shift + arrows - move rooms
39+
M - dump memory usage
40+
41+
Note: On OS X, control + arrow-keys are bound to Apple's "Mission Control". I switched to the 'shortcut' modifier which is control on windows and command on OS X. Alternatively, you can disable
42+
built in OS X shortcuts via System Preferences -> Keyboard -> Shorcuts.
43+
44+
645
Copyright (c) 2000 Thomas Foote
746

847
Optimization to compile, install, and run under linux:
948

10-
Copyright (c) 2015 Chris Cromer
49+
Copyright (c) 2015-2016 Chris Cromer
1150

1251
Permission is hereby granted, free of charge, to any person obtaining
1352
a copy of this software and associated documentation files (the

dq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <stdlib.h>
22

33
int main() {
4-
system("java -jar /usr/share/DroidQuest/dq-2.7.jar");
4+
system("java -jar /usr/share/DroidQuest/dq-2.8.jar");
55
return 0;
66
}

pom.xml

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.droidquest</groupId>
66
<artifactId>dq</artifactId>
7-
<version>2.7</version>
7+
<version>2.8</version>
88
<packaging>jar</packaging>
99

1010
<name>DroidQuest</name>
@@ -14,39 +14,34 @@
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

17-
<build>
18-
<sourceDirectory>src</sourceDirectory>
19-
<plugins>
20-
<plugin>
21-
<!-- Build an executable JAR -->
22-
<groupId>org.apache.maven.plugins</groupId>
23-
<artifactId>maven-jar-plugin</artifactId>
24-
<version>2.4</version>
25-
<configuration>
26-
<archive>
27-
<manifest>
28-
<addClasspath>true</addClasspath>
29-
<classpathPrefix>lib/</classpathPrefix>
30-
<mainClass>com.droidquest.DQ</mainClass>
31-
</manifest>
32-
</archive>
33-
</configuration>
34-
</plugin>
35-
</plugins>
36-
</build>
17+
<build>
18+
<sourceDirectory>src</sourceDirectory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.apache.maven.plugins</groupId>
22+
<artifactId>maven-compiler-plugin</artifactId>
23+
<version>3.3</version>
24+
<configuration>
25+
<source>1.6</source>
26+
<target>1.6</target>
27+
</configuration>
28+
</plugin>
29+
<plugin>
30+
<!-- Build an executable JAR -->
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-jar-plugin</artifactId>
33+
<version>2.4</version>
34+
<configuration>
35+
<archive>
36+
<manifest>
37+
<addClasspath>true</addClasspath>
38+
<classpathPrefix>lib/</classpathPrefix>
39+
<mainClass>com.droidquest.DQ</mainClass>
40+
</manifest>
41+
</archive>
42+
</configuration>
43+
</plugin>
44+
</plugins>
45+
</build>
3746

38-
<dependencies>
39-
<!--
40-
<dependency>
41-
<groupId>ch.qos.logback</groupId>
42-
<artifactId>logback-classic</artifactId>
43-
<version>1.0.13</version>
44-
</dependency>
45-
<dependency>
46-
<groupId>com.google.guava</groupId>
47-
<artifactId>guava</artifactId>
48-
<version>16.0</version>
49-
</dependency>
50-
-->
51-
</dependencies>
5247
</project>

src/com/droidquest/avatars/Player.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
public class Player extends Item implements Avatar {
1616

1717
private int keyRepeatRate = 5;
18-
18+
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
1919

2020
protected boolean handleSaveSmallChip() {
2121
return false;
@@ -363,16 +363,16 @@ else if (e.getKeyCode() == KeyEvent.VK_T && handleToolbox()) {
363363
else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) {
364364
return false;
365365
}
366-
else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), e.isControlDown())) {
366+
else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
367367
return true;
368368
}
369-
else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), e.isControlDown())) {
369+
else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
370370
return true;
371371
}
372-
else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), e.isControlDown())) {
372+
else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
373373
return true;
374374
}
375-
else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), e.isControlDown())) {
375+
else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
376376
return true;
377377
}
378378
else if (e.getKeyCode() == KeyEvent.VK_SPACE && handlePickupDrop()) {
@@ -456,22 +456,22 @@ protected boolean handleRepeatSpace() {
456456

457457
public boolean KeyDown(KeyEvent e) {
458458
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
459-
if (handleRepeatRight(e.isControlDown())) {
459+
if (handleRepeatRight((e.getModifiers() & shortcut_modifier) > 0)) {
460460
return true;
461461
}
462462
}
463463
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
464-
if (handleRepeatLeft(e.isControlDown())) {
464+
if (handleRepeatLeft((e.getModifiers() & shortcut_modifier) > 0)) {
465465
return true;
466466
}
467467
}
468468
else if (e.getKeyCode() == KeyEvent.VK_UP) {
469-
if (handleRepeatUp(e.isControlDown())) {
469+
if (handleRepeatUp((e.getModifiers() & shortcut_modifier) > 0)) {
470470
return true;
471471
}
472472
}
473473
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
474-
if (handleRepeatDown(e.isControlDown())) {
474+
if (handleRepeatDown((e.getModifiers() & shortcut_modifier) > 0)) {
475475
return true;
476476
}
477477
}

src/com/droidquest/avatars/Remote.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.awt.image.BufferedImage;
99

1010
public class Remote extends Item implements Avatar {
11+
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
12+
1113
public Remote() {
1214
width = 4;
1315
height = 20;
@@ -98,28 +100,28 @@ else if (e.getKeyCode() == KeyEvent.VK_SLASH) {
98100
}
99101
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
100102
if (carriedBy == null) {
101-
moveRight(e.isControlDown());
103+
moveRight((e.getModifiers() & shortcut_modifier) > 0);
102104
}
103105
repeating = 0;
104106
return true;
105107
}
106108
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
107109
if (carriedBy == null) {
108-
moveLeft(e.isControlDown());
110+
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
109111
}
110112
repeating = 0;
111113
return true;
112114
}
113115
else if (e.getKeyCode() == KeyEvent.VK_UP) {
114116
if (carriedBy == null) {
115-
moveUp(e.isControlDown());
117+
moveUp((e.getModifiers() & shortcut_modifier) > 0);
116118
}
117119
repeating = 0;
118120
return true;
119121
}
120122
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
121123
if (carriedBy == null) {
122-
moveDown(e.isControlDown());
124+
moveDown((e.getModifiers() & shortcut_modifier) > 0);
123125
}
124126
repeating = 0;
125127
return true;
@@ -134,31 +136,31 @@ public boolean KeyDown(KeyEvent e) {
134136
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
135137
repeating++;
136138
if (repeating > 10) {
137-
moveRight(e.isControlDown());
139+
moveRight((e.getModifiers() & shortcut_modifier) > 0);
138140
return true;
139141
}
140142
return false;
141143
}
142144
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
143145
repeating++;
144146
if (repeating > 10) {
145-
moveLeft(e.isControlDown());
147+
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
146148
return true;
147149
}
148150
return false;
149151
}
150152
else if (e.getKeyCode() == KeyEvent.VK_UP) {
151153
repeating++;
152154
if (repeating > 10) {
153-
moveUp(e.isControlDown());
155+
moveUp((e.getModifiers() & shortcut_modifier) > 0);
154156
return true;
155157
}
156158
return false;
157159
}
158160
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
159161
repeating++;
160162
if (repeating > 10) {
161-
moveDown(e.isControlDown());
163+
moveDown((e.getModifiers() & shortcut_modifier) > 0);
162164
return true;
163165
}
164166
return false;

src/com/droidquest/avatars/SolderingPen.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
public class SolderingPen extends Device implements Avatar {
1919
private boolean hot;
2020
private Port currentPort = null; // Port that Soldering pen is currently over
21+
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
2122

2223
public SolderingPen() {
2324
width = 22;
@@ -313,28 +314,28 @@ else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) {
313314
}
314315
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
315316
if (carriedBy == null) {
316-
moveRight(e.isControlDown());
317+
moveRight((e.getModifiers() & shortcut_modifier) > 0);
317318
}
318319
repeating = 0;
319320
return true;
320321
}
321322
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
322323
if (carriedBy == null) {
323-
moveLeft(e.isControlDown());
324+
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
324325
}
325326
repeating = 0;
326327
return true;
327328
}
328329
else if (e.getKeyCode() == KeyEvent.VK_UP) {
329330
if (carriedBy == null) {
330-
moveUp(e.isControlDown());
331+
moveUp((e.getModifiers() & shortcut_modifier) > 0);
331332
}
332333
repeating = 0;
333334
return true;
334335
}
335336
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
336337
if (carriedBy == null) {
337-
moveDown(e.isControlDown());
338+
moveDown((e.getModifiers() & shortcut_modifier) > 0);
338339
}
339340
repeating = 0;
340341
return true;
@@ -358,31 +359,31 @@ public boolean KeyDown(KeyEvent e) {
358359
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
359360
repeating++;
360361
if (repeating > 10) {
361-
moveRight(e.isControlDown());
362+
moveRight((e.getModifiers() & shortcut_modifier) > 0);
362363
return true;
363364
}
364365
return false;
365366
}
366367
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
367368
repeating++;
368369
if (repeating > 10) {
369-
moveLeft(e.isControlDown());
370+
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
370371
return true;
371372
}
372373
return false;
373374
}
374375
else if (e.getKeyCode() == KeyEvent.VK_UP) {
375376
repeating++;
376377
if (repeating > 10) {
377-
moveUp(e.isControlDown());
378+
moveUp((e.getModifiers() & shortcut_modifier) > 0);
378379
return true;
379380
}
380381
return false;
381382
}
382383
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
383384
repeating++;
384385
if (repeating > 10) {
385-
moveDown(e.isControlDown());
386+
moveDown((e.getModifiers() & shortcut_modifier) > 0);
386387
return true;
387388
}
388389
return false;
@@ -428,6 +429,8 @@ public boolean handleGameCursor() {
428429
}
429430
}
430431

432+
CheckPort();
433+
431434
level.roomdisplay.dq.selectCursor();
432435
return true;
433436
}
@@ -505,6 +508,8 @@ public boolean handlePaintbrush() {
505508

506509
handleRemote();
507510

511+
CheckPort();
512+
508513
return true;
509514
}
510515

src/com/droidquest/items/AutoWire.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void Animate() {
113113

114114
if (animation == 1) {
115115
if (portdevices[0].ports[0].myWire == null) { // Wiring
116-
portdevices[0].ports[0].myWire = new Wire(chip.ports[0], portdevices[0].ports[0]);
116+
portdevices[0].ports[0].myWire = new Wire(chip.ports[0], portdevices[0].ports[0]);
117117
}
118118
else { // Unwiring
119119
portdevices[0].ports[0].myWire.Remove();

0 commit comments

Comments
 (0)