Skip to content

Commit

Permalink
Merge pull request #156 from TheFakeMontyOnTheRun/120-change-ux-to-be…
Browse files Browse the repository at this point in the history
…-only-use-with-and-pickdrop

120 change ux to be only use with and pickdrop
  • Loading branch information
TheFakeMontyOnTheRun authored Jul 6, 2024
2 parents bf4f544 + a46d2e1 commit 0c3f651
Show file tree
Hide file tree
Showing 67 changed files with 467 additions and 3,030 deletions.
5 changes: 0 additions & 5 deletions common/src/Dungeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ struct GameSnapshot dungeonTick(const enum ECommand command) {
}
break;
case kCommandFire3: {
needsToRedrawHUD = TRUE;
}
break;

case kCommandFire4: {
struct ObjectNode *playerItems = getPlayerItems();
int index = 0;

Expand Down
18 changes: 10 additions & 8 deletions core/src/Derelict.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,17 @@ void inspectItemWithHelmetCallback(struct Item *helmet, struct Item *item) {
#endif
}

void useCommWithRank(struct Item *item) {
void useKeycardWith(struct Item *item1, struct Item *item2) {
if (item2 == getItemNamed("comm-terminal-1") ||
item2 == getItemNamed("comm-terminal-2") ||
item2 == getItemNamed("comm-terminal-3")) {

if (getPlayerRank() <= 1) {
defaultLogger("Insufficient rank to access");
defaultLogger("Computer node rebooted");
item2->active = TRUE;
return;
}
defaultLogger("Computer node rebooted");
item->active = !item->active;

defaultLogger("Keycard can't be used with that");
}

/**
Expand Down Expand Up @@ -652,6 +655,7 @@ void initStation(void) {
0,
#endif
TRUE, 21, 9);
newItem->useWithCallback = useKeycardWith;
newItem->pickCallback = keycardPickCallback;
newItem->dropCallback = keycardDropCallback;

Expand Down Expand Up @@ -690,7 +694,6 @@ void initStation(void) {
200,
#endif
FALSE, 7, 2);
newItem->useCallback = useCommWithRank;
addToRoom("hall-1", newItem);


Expand All @@ -702,7 +705,6 @@ void initStation(void) {
200,
#endif
FALSE, 6, 2);
newItem->useCallback = useCommWithRank;
addToRoom("hall-2", newItem);


Expand All @@ -714,7 +716,6 @@ void initStation(void) {
200,
#endif
FALSE, 7, 2);
newItem->useCallback = useCommWithRank;
addToRoom("hall-3", newItem);

/* Diaries */
Expand Down Expand Up @@ -812,6 +813,7 @@ void initStation(void) {
0,
#endif
TRUE, 23, 17);
newItem->useWithCallback = useKeycardWith;
newItem->pickCallback = keycardPickCallback;
newItem->dropCallback = keycardDropCallback;

Expand Down
27 changes: 1 addition & 26 deletions core/tests/TestDerelict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,6 @@ TEST_F(TestDerelict, keycardsCanElevatePlayerRankIfItsHigherThanCurrent) {
ASSERT_EQ(getPlayerRank(), 2);
}

TEST_F(TestDerelict, canOnlyUseCommWithHigherRanks) {
setPlayerLocation(getRoomIdByName("hall-2"));
addToRoom("hall-2", getItemNamed("hacked-keycard"));

parseCommand("use", "comm-terminal-2");
ASSERT_FALSE(getItemNamed("comm-terminal-2")->active);

parseCommand("pick", "low-rank-keycard");
parseCommand("use", "comm-terminal-2");
ASSERT_FALSE(getItemNamed("comm-terminal-2")->active);

parseCommand("pick", "hacked-keycard");
parseCommand("use", "comm-terminal-2");
ASSERT_TRUE(getItemNamed("comm-terminal-2")->active);
}


TEST_F(TestDerelict, cantUnlockSafeWithOfflineComputerNodes) {
setPlayerLocation(getRoomIdByName("situation-room"));

Expand Down Expand Up @@ -319,21 +302,13 @@ TEST_F(TestDerelict, usingTheReactorCoreWillCauseMeltdown) {
ASSERT_EQ(kBadVictory, getGameStatus());
}

TEST_F(TestDerelict, canToggleCommTerminal1) {
setPlayerLocation(getRoomIdByName("hall-1"));
setPlayerRank(5);
ASSERT_FALSE(getItemNamed("comm-terminal-1")->active);
parseCommand("use", "comm-terminal-1");
ASSERT_TRUE(getItemNamed("comm-terminal-1")->active);
}

TEST_F(TestDerelict, cantToggleMagneticBoots) {
ASSERT_TRUE(getItemNamed("magnetic-boots")->active);
parseCommand("use", "magnetic-boots");
ASSERT_TRUE(getItemNamed("magnetic-boots")->active);
}

TEST_F(TestDerelict, cantToggleCommTerminal1ByUsingWithOthers) {
TEST_F(TestDerelict, cantToggleCommTerminal1ByUsingWithHigherRankKeycards) {
setPlayerLocation(getRoomIdByName("hall-1"));
addToRoom("hall-1", getItemNamed("hacked-keycard"));
parseCommand("pick", "hacked-keycard");
Expand Down
2 changes: 1 addition & 1 deletion ee_frontend/NDK-version/app/src/main/cpp/native-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int soundToPlay = -1;

void stopSounds(void) {}

void playSound(const int action) {
void playSound(const uint8_t action) {
soundToPlay = action;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,16 @@ class GameActivity : AppCompatActivity() {
}

findViewById<Button>(R.id.btnUse).setOnClickListener {
DerelictJNI.sendCommand('x')
DerelictJNI.sendCommand('z')
}


findViewById<Button>(R.id.btnUseWith).setOnClickListener {
DerelictJNI.sendCommand('z')
DerelictJNI.sendCommand('x')
}


findViewById<Button>(R.id.btnNextItem).setOnClickListener {
DerelictJNI.sendCommand('v')
}


findViewById<Button>(R.id.btnItemInfo).setOnClickListener {
DerelictJNI.sendCommand('c')
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@
android:layout_weight="1"
android:text="Next item" />

<Button
android:id="@+id/btnItemInfo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Item info" />

</LinearLayout>

</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@
android:layout_weight="1"
android:text="Next Item" />

<Button
android:id="@+id/btnItemInfo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Item Info" />


</LinearLayout>

Expand Down
2 changes: 1 addition & 1 deletion ee_frontend/NDK-version/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ buildscript {
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.3.2" apply false
id("com.android.application") version "8.4.0" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 15 22:03:08 WET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 941}, {728, 44}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
Expand Down Expand Up @@ -77,7 +76,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {728, 913}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="IBUIContentMode">1</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
Expand All @@ -90,7 +88,6 @@
</array>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="198997569"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
Expand Down
Loading

0 comments on commit 0c3f651

Please sign in to comment.