Skip to content

Commit a413c69

Browse files
committed
First pass at speech message priority for interrupting/blocking
1 parent f428261 commit a413c69

File tree

14 files changed

+306
-304
lines changed

14 files changed

+306
-304
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
jobs:
66

77
linux:
8-
runs-on: ubuntu-16.04
8+
runs-on: ubuntu-18.04
99
steps:
1010
- name: "Install dependencies"
1111
run: |
@@ -55,7 +55,7 @@ jobs:
5555
brew install --build-from-source ./macos/sdl2.rb
5656
cp -r $(brew --cellar)/sdl2 sdl2-cellar
5757
fi
58-
brew install sdl2_image dylibbundler
58+
brew install sdl2_image dylibbundler espeak-ng
5959
6060
- name: "Compile"
6161
run: |

src/brogue/Architect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3338,7 +3338,7 @@ boolean spawnDungeonFeature(short x, short y, dungeonFeature *feat, boolean refr
33383338

33393339
if (feat->description[0] && !feat->messageDisplayed && playerCanSee(x, y)) {
33403340
feat->messageDisplayed = true;
3341-
message(feat->description, 0);
3341+
message(feat->description, 0, 0);
33423342
}
33433343

33443344
zeroOutGrid(blockingMap);

src/brogue/Combat.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void splitMonster(creature *monst, short x, short y) {
255255

256256
if (canDirectlySeeMonster(monst)) {
257257
sprintf(buf, "%s splits in two!", monstName);
258-
message(buf, 0);
258+
message(buf, 0, 2);
259259
}
260260

261261
return;
@@ -393,7 +393,7 @@ void specialHit(creature *attacker, creature *defender, short damage) {
393393
equipItem(rogue.armor, true, NULL);
394394
itemName(rogue.armor, buf2, false, false, NULL);
395395
sprintf(buf, "your %s weakens!", buf2);
396-
messageWithColor(buf, &itemMessageColor, 0);
396+
messageWithColor(buf, &itemMessageColor, 0, 2);
397397
checkForDisenchantment(rogue.armor);
398398
}
399399
if (attacker->info.abilityFlags & MA_HIT_HALLUCINATE) {
@@ -461,7 +461,7 @@ void specialHit(creature *attacker, creature *defender, short damage) {
461461
monsterName(buf2, attacker, true);
462462
itemName(theItem, buf3, false, true, NULL);
463463
sprintf(buf, "%s stole %s!", buf2, buf3);
464-
messageWithColor(buf, &badMessageColor, 0);
464+
messageWithColor(buf, &badMessageColor, 0, 2);
465465
}
466466
}
467467
}
@@ -718,7 +718,7 @@ void magicWeaponHit(creature *defender, item *theItem, boolean backstabbed) {
718718
}
719719
updateVision(true);
720720

721-
message(buf, 0);
721+
message(buf, 0, 2);
722722
autoID = true;
723723
break;
724724
case W_SLOWING:
@@ -946,7 +946,7 @@ void applyArmorRunicEffect(char returnString[DCOLS], creature *attacker, short *
946946
case A_IMMOLATION:
947947
if (rand_percent(10)) {
948948
sprintf(returnString, "flames suddenly explode out of your %s!", armorName);
949-
message(returnString, runicKnown ? 0 : REQUIRE_ACKNOWLEDGMENT);
949+
message(returnString, runicKnown ? 0 : REQUIRE_ACKNOWLEDGMENT, 2);
950950
returnString[0] = '\0';
951951
spawnDungeonFeature(player.xLoc, player.yLoc, &(dungeonFeatureCatalog[DF_ARMOR_IMMOLATION]), true, false);
952952
runicDiscovered = true;
@@ -969,10 +969,10 @@ void decrementWeaponAutoIDTimer() {
969969

970970
rogue.weapon->flags |= ITEM_IDENTIFIED;
971971
updateIdentifiableItems();
972-
messageWithColor("you are now familiar enough with your weapon to identify it.", &itemMessageColor, 0);
972+
messageWithColor("you are now familiar enough with your weapon to identify it.", &itemMessageColor, 0, 2);
973973
itemName(rogue.weapon, buf2, true, true, NULL);
974974
sprintf(buf, "%s %s.", (rogue.weapon->quantity > 1 ? "they are" : "it is"), buf2);
975-
messageWithColor(buf, &itemMessageColor, 0);
975+
messageWithColor(buf, &itemMessageColor, 0, 2);
976976
}
977977
}
978978

@@ -1061,7 +1061,7 @@ boolean attack(creature *attacker, creature *defender, boolean lungeAttack) {
10611061
defender->bookkeepingFlags |= MB_SEIZED;
10621062
if (canSeeMonster(attacker) || canSeeMonster(defender)) {
10631063
sprintf(buf, "%s seizes %s!", attackerName, (defender == &player ? "your legs" : defenderName));
1064-
messageWithColor(buf, &white, 0);
1064+
messageWithColor(buf, &white, 0, 2);
10651065
}
10661066
return false;
10671067
}
@@ -1186,7 +1186,7 @@ boolean attack(creature *attacker, creature *defender, boolean lungeAttack) {
11861186
specialHit(attacker, defender, (attacker->info.abilityFlags & MA_POISONS) ? poisonDamage : damage);
11871187
}
11881188
if (armorRunicString[0]) {
1189-
message(armorRunicString, 0);
1189+
message(armorRunicString, 0, 2);
11901190
if (rogue.armor && (rogue.armor->flags & ITEM_RUNIC) && rogue.armor->enchant2 == A_BURDEN) {
11911191
strengthCheck(rogue.armor, true);
11921192
}
@@ -1221,7 +1221,7 @@ boolean attack(creature *attacker, creature *defender, boolean lungeAttack) {
12211221
equipItem(rogue.weapon, true, NULL);
12221222
itemName(rogue.weapon, buf2, false, false, NULL);
12231223
sprintf(buf, "your %s weakens!", buf2);
1224-
messageWithColor(buf, &itemMessageColor, 0);
1224+
messageWithColor(buf, &itemMessageColor, 0, 2);
12251225
checkForDisenchantment(rogue.weapon);
12261226
}
12271227

@@ -1311,12 +1311,12 @@ void displayCombatText() {
13111311
for (end = start; *end != '\0'; end++) {
13121312
if (*end == '\n') {
13131313
*end = '\0';
1314-
message(start, FOLDABLE | (rogue.cautiousMode ? REQUIRE_ACKNOWLEDGMENT : 0));
1314+
message(start, FOLDABLE | (rogue.cautiousMode ? REQUIRE_ACKNOWLEDGMENT : 0), 2);
13151315
start = end + 1;
13161316
}
13171317
}
13181318

1319-
message(start, FOLDABLE | (rogue.cautiousMode ? REQUIRE_ACKNOWLEDGMENT : 0));
1319+
message(start, FOLDABLE | (rogue.cautiousMode ? REQUIRE_ACKNOWLEDGMENT : 0), 2);
13201320

13211321
rogue.cautiousMode = false;
13221322
}
@@ -1647,7 +1647,7 @@ void killCreature(creature *decedent, boolean administrativeDeath) {
16471647
monsterName(monstName, decedent, true);
16481648
snprintf(buf, DCOLS * 3, "%s %s", monstName, monsterText[decedent->info.monsterID].DFMessage);
16491649
resolvePronounEscapes(buf, decedent);
1650-
message(buf, 0);
1650+
message(buf, 0, 2);
16511651
}
16521652
}
16531653

@@ -1661,7 +1661,7 @@ void killCreature(creature *decedent, boolean administrativeDeath) {
16611661
&& !(decedent->bookkeepingFlags & MB_BOUND_TO_LEADER)
16621662
&& !decedent->carriedMonster) {
16631663

1664-
messageWithColor("you feel a sense of loss.", &badMessageColor, 0);
1664+
messageWithColor("you feel a sense of loss.", &badMessageColor, 0, 2);
16651665
}
16661666
x = decedent->xLoc;
16671667
y = decedent->yLoc;

src/brogue/IO.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,9 +2384,9 @@ void exploreKey(const boolean controlKey) {
23842384
}
23852385

23862386
if (tooDark) {
2387-
message("It's too dark to explore!", 0);
2387+
message("It's too dark to explore!", 0, 2);
23882388
} else if (x == player.xLoc && y == player.yLoc) {
2389-
message("I see no path for further exploration.", 0);
2389+
message("I see no path for further exploration.", 0, 2);
23902390
} else if (proposeOrConfirmLocation(finalX, finalY, "I see no path for further exploration.")) {
23912391
explore(controlKey ? 1 : 20); // Do the exploring until interrupted.
23922392
hideCursor();
@@ -2443,7 +2443,7 @@ void nextBrogueEvent(rogueEvent *returnEvent, boolean textInput, boolean colorsD
24432443

24442444
if (returnEvent->eventType == EVENT_ERROR) {
24452445
rogue.playbackPaused = rogue.playbackMode; // pause if replaying
2446-
message("Event error!", REQUIRE_ACKNOWLEDGMENT);
2446+
message("Event error!", REQUIRE_ACKNOWLEDGMENT, 3);
24472447
}
24482448
}
24492449

@@ -2598,10 +2598,10 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
25982598
refreshSideBar(-1, -1, false);
25992599
if (rogue.trueColorMode) {
26002600
messageWithColor(KEYBOARD_LABELS ? "Color effects disabled. Press '\\' again to enable." : "Color effects disabled.",
2601-
&teal, 0);
2601+
&teal, 0, 0);
26022602
} else {
26032603
messageWithColor(KEYBOARD_LABELS ? "Color effects enabled. Press '\\' again to disable." : "Color effects enabled.",
2604-
&teal, 0);
2604+
&teal, 0, 0);
26052605
}
26062606
break;
26072607
case AGGRO_DISPLAY_KEY:
@@ -2610,10 +2610,10 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
26102610
refreshSideBar(-1, -1, false);
26112611
if (rogue.displayAggroRangeMode) {
26122612
messageWithColor(KEYBOARD_LABELS ? "Stealth range displayed. Press ']' again to hide." : "Stealth range displayed.",
2613-
&teal, 0);
2613+
&teal, 0, 0);
26142614
} else {
26152615
messageWithColor(KEYBOARD_LABELS ? "Stealth range hidden. Press ']' again to display." : "Stealth range hidden.",
2616-
&teal, 0);
2616+
&teal, 0, 0);
26172617
}
26182618
break;
26192619
case CALL_KEY:
@@ -2649,7 +2649,7 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
26492649
rogue.nextGame = NG_VIEW_RECORDING;
26502650
rogue.gameHasEnded = true;
26512651
} else {
2652-
message("File not found.", 0);
2652+
message("File not found.", 0, 0);
26532653
}
26542654
}
26552655
break;
@@ -2665,7 +2665,7 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
26652665
rogue.nextGame = NG_OPEN_GAME;
26662666
rogue.gameHasEnded = true;
26672667
} else {
2668-
message("File not found.", 0);
2668+
message("File not found.", 0, 0);
26692669
}
26702670
}
26712671
break;
@@ -2697,17 +2697,17 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
26972697
case TEXT_GRAPHICS:
26982698
messageWithColor(KEYBOARD_LABELS
26992699
? "Switched to text mode. Press 'G' again to enable tiles."
2700-
: "Switched to text mode.", &teal, 0);
2700+
: "Switched to text mode.", &teal, 0, 1);
27012701
break;
27022702
case TILES_GRAPHICS:
27032703
messageWithColor(KEYBOARD_LABELS
27042704
? "Switched to graphical tiles. Press 'G' again to enable hybrid mode."
2705-
: "Switched to graphical tiles.", &teal, 0);
2705+
: "Switched to graphical tiles.", &teal, 0, 1);
27062706
break;
27072707
case HYBRID_GRAPHICS:
27082708
messageWithColor(KEYBOARD_LABELS
27092709
? "Switched to hybrid mode. Press 'G' again to disable tiles."
2710-
: "Switched to hybrid mode.", &teal, 0);
2710+
: "Switched to hybrid mode.", &teal, 0, 1);
27112711
break;
27122712
}
27132713
}
@@ -2974,8 +2974,8 @@ boolean confirm(char *prompt, boolean alsoDuringPlayback) {
29742974
return true; // oh yes he did
29752975
}
29762976

2977-
playSpeech(prompt, false, true);
2978-
playSpeech("Yes... No", false, false);
2977+
playSpeech(prompt, 3);
2978+
playSpeech("Yes... No", 3);
29792979

29802980
encodeMessageColor(whiteColorEscape, 0, &white);
29812981
encodeMessageColor(yellowColorEscape, 0, KEYBOARD_LABELS ? &yellow : &white);
@@ -3441,17 +3441,17 @@ void temporaryMessage(const char *msg, enum messageFlags flags) {
34413441
}
34423442
restoreRNG;
34433443

3444-
playSpeech(msg, false, true);
3444+
playSpeech(msg, 1);
34453445
}
34463446

3447-
void messageWithColor(char *msg, color *theColor, enum messageFlags flags) {
3447+
void messageWithColor(char *msg, color *theColor, enum messageFlags flags, short speechPriority) {
34483448
char buf[COLS*2] = "";
34493449
short i;
34503450

34513451
i=0;
34523452
i = encodeMessageColor(buf, i, theColor);
34533453
strcpy(&(buf[i]), msg);
3454-
message(buf, flags);
3454+
message(buf, flags, speechPriority);
34553455
}
34563456

34573457
void flavorMessage(char *msg) {
@@ -3479,7 +3479,7 @@ void flavorMessage(char *msg) {
34793479
// arrived on the same turn, they may collapse. Alternately, they may collapse
34803480
// if the older message is the latest one in the archive and the new one is not
34813481
// semi-colon foldable (such as a combat message.)
3482-
void message(const char *msg, enum messageFlags flags) {
3482+
void message(const char *msg, enum messageFlags flags, short speechPriority) {
34833483
short i;
34843484
archivedMessage *archiveEntry;
34853485
boolean newMessage;
@@ -3549,7 +3549,7 @@ void message(const char *msg, enum messageFlags flags) {
35493549

35503550
restoreRNG;
35513551

3552-
playSpeech(msg, false, true);
3552+
playSpeech(msg, speechPriority);
35533553
}
35543554

35553555
// Only used for the "you die..." message, to enable posthumous inventory viewing.
@@ -4478,7 +4478,7 @@ void displayGrid(short **map) {
44784478
void printSeed() {
44794479
char buf[COLS];
44804480
snprintf(buf, COLS, "Dungeon seed #%llu; turn #%lu; version %s", (unsigned long long)rogue.seed, rogue.playerTurnNumber, BROGUE_VERSION_STRING);
4481-
message(buf, 0);
4481+
message(buf, 0, 0);
44824482
}
44834483

44844484
void printProgressBar(short x, short y, const char barLabel[COLS], long amtFilled, long amtMax, color *fillColor, boolean dim) {

0 commit comments

Comments
 (0)