Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/fix-inventory-scrolling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow scrolling through inventory with arrow keys and 8/2 even when other actions are disabled. Applies to enchant/ID menu, replays, and the death screen.
1 change: 1 addition & 0 deletions changes/game-mode-mismatch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Loading a savegame will now place the game into the same mode the savegame was made in (i.e normal, wizard, easy).
1 change: 1 addition & 0 deletions changes/wand-staff-messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added messages to the game log for zapping wands and staffs.
2 changes: 1 addition & 1 deletion src/brogue/Combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ boolean inflictDamage(creature *attacker, creature *defender,
}

if (defender == &player
&& rogue.easyMode
&& rogue.mode == GAME_MODE_EASY
&& damage > 0) {
damage = max(1, damage/5);
}
Expand Down
41 changes: 18 additions & 23 deletions src/brogue/IO.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "GlobalsBase.h"
#include "Globals.h"

#define D_DISABLE_BACKGROUND_COLORS (rogue.wizard && 0)
#define D_DISABLE_BACKGROUND_COLORS (WIZARD_MODE && 0)

// Populates path[][] with a list of coordinates starting at origin and traversing down the map. Returns the number of steps in the path.
short getPlayerPathOnMap(pos path[1000], short **map, pos origin) {
Expand Down Expand Up @@ -275,7 +275,7 @@ static short actionMenu(short x, boolean playingBack) {
buttons[buttonCount].hotkey[0] = RETHROW_KEY;
buttonCount++;

if (!rogue.easyMode) {
if (!rogue.mode == GAME_MODE_EASY) {
if (KEYBOARD_LABELS) {
sprintf(buttons[buttonCount].text, " %s&: %sEasy mode ", yellowColorEscape, whiteColorEscape);
} else {
Expand Down Expand Up @@ -4396,9 +4396,9 @@ void printSeed() {
char buf[COLS];
char mode[14] = "";

if (rogue.easyMode) {
if (rogue.mode = GAME_MODE_EASY) {
strcpy(mode,"easy mode; ");
} else if (rogue.wizard) {
} else if (WIZARD_MODE) {
strcpy(mode,"wizard mode; ");
}
if (rogue.hideSeed) {
Expand Down Expand Up @@ -5099,27 +5099,22 @@ unsigned long printCarriedItemDetails(item *theItem,
buttons[b].hotkey[0] = RELABEL_KEY;
b++;
}

// Add invisible previous and next buttons, so up and down arrows can page through items.
// Previous
buttons[b].flags = B_ENABLED; // clear everything else
buttons[b].hotkey[0] = UP_KEY;
buttons[b].hotkey[1] = NUMPAD_8;
buttons[b].hotkey[2] = UP_ARROW;
b++;
// Next
buttons[b].flags = B_ENABLED; // clear everything else
buttons[b].hotkey[0] = DOWN_KEY;
buttons[b].hotkey[1] = NUMPAD_2;
buttons[b].hotkey[2] = DOWN_ARROW;
b++;
}
b = printTextBox(textBuf, x, y, width, &white, &interfaceBoxColor, buttons, b);
// Add invisible previous and next buttons, so up and down arrows can page through items.
// Previous
buttons[b].flags = B_ENABLED; // clear everything else
buttons[b].hotkey[0] = UP_KEY;
buttons[b].hotkey[1] = NUMPAD_8;
buttons[b].hotkey[2] = UP_ARROW;
b++;
// Next
buttons[b].flags = B_ENABLED; // clear everything else
buttons[b].hotkey[0] = DOWN_KEY;
buttons[b].hotkey[1] = NUMPAD_2;
buttons[b].hotkey[2] = DOWN_ARROW;
b++;

if (!includeButtons) {
waitForKeystrokeOrMouseClick();
return -1;
}
b = printTextBox(textBuf, x, y, width, &white, &interfaceBoxColor, buttons, b);

if (b >= 0) {
return buttons[b].hotkey[0];
Expand Down
15 changes: 12 additions & 3 deletions src/brogue/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -6543,7 +6543,7 @@ static void recordApplyItemCommand(item *theItem) {
}

static boolean useStaffOrWand(item *theItem) {
char buf[COLS], buf2[COLS];
char buf[COLS], buf2[COLS], buf3[COLS];
short maxDistance;
boolean autoID, confirmedTarget;
bolt theBolt;
Expand Down Expand Up @@ -6583,6 +6583,7 @@ static boolean useStaffOrWand(item *theItem) {

confirmedTarget = false;
}

if (confirmedTarget) {

recordApplyItemCommand(theItem);
Expand All @@ -6592,13 +6593,22 @@ static boolean useStaffOrWand(item *theItem) {
rogue.featRecord[FEAT_PURE_WARRIOR] = false;

if (theItem->charges > 0) {

creature *monst = monsterAtLoc(zapTarget);
if (monst) {
monsterName(buf3, monst, true);
sprintf(buf, "you zap your %s at %s.", buf2, buf3);
} else {
sprintf(buf, "you zap your %s.", buf2);
}
message(buf, 0);

autoID = zap(originLoc, zapTarget,
&theBolt,
!boltKnown, // hide bolt details
false);
if (autoID) {
if (!tableForItemCategory(theItem->category)[theItem->kind].identified) {
itemName(theItem, buf2, false, false, NULL);
sprintf(buf, "(Your %s must be ", buf2);
identifyItemKind(theItem);
itemName(theItem, buf2, false, true, NULL);
Expand All @@ -6608,7 +6618,6 @@ static boolean useStaffOrWand(item *theItem) {
}
}
} else {
itemName(theItem, buf2, false, false, NULL);
if (theItem->category == STAFF) {
sprintf(buf, "Your %s fizzles; it must be out of charges for now.", buf2);
} else {
Expand Down
13 changes: 5 additions & 8 deletions src/brogue/MainMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ static void drawMenuFlames(signed short flames[COLS][(ROWS + MENU_FLAME_ROW_PADD

versionStringLength = strLenWithoutEscapes(gameConst->versionString);

if (rogue.wizard) {
if (WIZARD_MODE) {
strcpy(gameModeString, "Wizard Mode");
} else if (rogue.easyMode) {
} else if (rogue.mode == GAME_MODE_EASY) {
strcpy(gameModeString, "Easy Mode");
}
gameModeStringLength = strLenWithoutEscapes(gameModeString);
Expand Down Expand Up @@ -456,14 +456,11 @@ static void chooseGameMode() {
gameMode = printTextBox(textBuf, 10, 5, 66, &white, &black, buttons, 3);
restoreDisplayBuffer(&rbuf);
if (gameMode == 0) {
rogue.wizard = true;
rogue.easyMode = false;
rogue.mode = GAME_MODE_WIZARD;
} else if (gameMode == 1) {
rogue.wizard = false;
rogue.easyMode = true;
rogue.mode = GAME_MODE_EASY;
} else if (gameMode == 2) {
rogue.wizard = false;
rogue.easyMode = false;
rogue.mode = GAME_MODE_NORMAL;
}

rogue.nextGame = NG_NOTHING;
Expand Down
2 changes: 1 addition & 1 deletion src/brogue/Monsters.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ void initializeGender(creature *monst) {

/// @brief Sets the character used to represent the player in the game, based on the game mode
void setPlayerDisplayChar() {
if (rogue.easyMode) {
if (rogue.mode == GAME_MODE_EASY) {
player.info.displayChar = G_DEMON;
} else {
player.info.displayChar = G_PLAYER;
Expand Down
2 changes: 1 addition & 1 deletion src/brogue/Movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ boolean startFighting(enum directions dir, boolean tillDeath) {
return false;
}
int expectedDamage = monst->info.damage.upperBound * monsterDamageAdjustmentAmount(monst) / FP_FACTOR;
if (rogue.easyMode) {
if (rogue.mode == GAME_MODE_EASY) {
expectedDamage /= 5;
}
rogue.blockCombatText = true;
Expand Down
38 changes: 5 additions & 33 deletions src/brogue/Recordings.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static void writeHeaderInfo(char *path) {
for (i = 0; rogue.versionString[i] != '\0'; i++) {
c[i] = rogue.versionString[i];
}
c[15] = rogue.wizard;
c[15] = rogue.mode;
i = 16;
numberToString(rogue.seed, 8, &c[i]);
i += 8;
Expand Down Expand Up @@ -468,7 +468,7 @@ void initRecording() {
}

short i;
boolean wizardMode;
enum gameMode mode;
unsigned short recPatch;
char buf[1000], *versionString = rogue.versionString;
FILE *recordFile;
Expand Down Expand Up @@ -502,7 +502,7 @@ void initRecording() {
for (i=0; i<15; i++) {
versionString[i] = recallChar();
}
wizardMode = recallChar();
rogue.mode = recallChar();

if (getPatchVersion(versionString, &recPatch) && recPatch <= gameConst->patchVersion) {
// Major and Minor match ours, Patch is less than or equal to ours: we are compatible.
Expand All @@ -527,34 +527,6 @@ void initRecording() {
rogue.gameExitStatusCode = EXIT_STATUS_FAILURE_RECORDING_WRONG_VERSION;
}

if (wizardMode != rogue.wizard) {
// wizard game cannot be played in normal mode and vice versa
rogue.playbackMode = false;
rogue.playbackFastForward = false;
if (wizardMode) {
if (!nonInteractivePlayback) {
sprintf(buf, "This game was played in wizard mode. You must start Brogue in wizard mode to replay it.");
dialogAlert(buf);
} else {
printf("This game was played in wizard mode. You must start Brogue in wizard mode to replay it.");
}
} else {
if (!nonInteractivePlayback) {
sprintf(buf, "To play this regular recording, please restart Brogue without the wizard mode option.");
dialogAlert(buf);
} else {
printf("To play this regular recording, please restart Brogue without the wizard mode option.");
}
}

rogue.playbackMode = true;
rogue.playbackPaused = true;
rogue.playbackFastForward = false;
rogue.playbackOOS = false;
rogue.gameHasEnded = true;
rogue.gameExitStatusCode = EXIT_STATUS_FAILURE_RECORDING_WRONG_VERSION;
}

rogue.seed = recallNumber(8); // master random seed
rogue.howManyTurns = recallNumber(4); // how many turns are in this recording
maxLevelChanges = recallNumber(4); // how many times the player changes depths
Expand Down Expand Up @@ -1182,9 +1154,9 @@ static void getDefaultFilePath(char *defaultPath, boolean gameOver) {
} else {
sprintf(defaultPath, "%s #%s Escaped the dungeons", gameConst->versionString, seed);
}
if (rogue.wizard) {
if (rogue.mode == GAME_MODE_WIZARD) {
strcat(defaultPath, " (wizard)");
} else if (rogue.easyMode) {
} else if (rogue.mode == GAME_MODE_EASY) {
strcat(defaultPath, " (easy)");
}
}
Expand Down
36 changes: 21 additions & 15 deletions src/brogue/Rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,25 @@
// Macro to compare BROGUE_MAJOR.BROGUE_MINOR.patchVersion to a.b.c
#define BROGUE_VERSION_ATLEAST(a,b,c) (BROGUE_MAJOR != (a) ? BROGUE_MAJOR > (a) : BROGUE_MINOR != (b) ? BROGUE_MINOR > (b) : rogue.patchVersion >= (c))

#define DEBUG if (rogue.wizard)
#define MONSTERS_ENABLED (!rogue.wizard || 1) // Quest room monsters can be generated regardless.
#define ITEMS_ENABLED (!rogue.wizard || 1)
#define WIZARD_MODE (rogue.mode == GAME_MODE_WIZARD)

#define D_BULLET_TIME (rogue.wizard && 0)
#define D_WORMHOLING (rogue.wizard && 1)
#define D_IMMORTAL (rogue.wizard && 1)
#define DEBUG if (WIZARD_MODE)
#define MONSTERS_ENABLED (!WIZARD_MODE || 1) // Quest room monsters can be generated regardless.
#define ITEMS_ENABLED (!WIZARD_MODE || 1)

#define D_SAFETY_VISION (rogue.wizard && 0)
#define D_SCENT_VISION (rogue.wizard && 0)
#define D_OMNISCENCE (rogue.wizard && 0)
#define D_BULLET_TIME (WIZARD_MODE && 0)
#define D_WORMHOLING (WIZARD_MODE && 1)
#define D_IMMORTAL (WIZARD_MODE && 1)

#define D_INSPECT_LEVELGEN (rogue.wizard && 0)
#define D_INSPECT_MACHINES (rogue.wizard && 0)
#define D_SAFETY_VISION (WIZARD_MODE && 0)
#define D_SCENT_VISION (WIZARD_MODE && 0)
#define D_OMNISCENCE (WIZARD_MODE && 0)

#define D_MESSAGE_ITEM_GENERATION (rogue.wizard && 0)
#define D_MESSAGE_MACHINE_GENERATION (rogue.wizard && 0)
#define D_INSPECT_LEVELGEN (WIZARD_MODE && 0)
#define D_INSPECT_MACHINES (WIZARD_MODE && 0)

#define D_MESSAGE_ITEM_GENERATION (WIZARD_MODE && 0)
#define D_MESSAGE_MACHINE_GENERATION (WIZARD_MODE && 0)

// If enabled, runs a benchmark for the performance of repeatedly updating the screen at the start of the game.
// #define SCREEN_UPDATE_BENCHMARK
Expand Down Expand Up @@ -2424,10 +2426,15 @@ typedef struct gameConstants {
const int mainMenuTitleWidth; // width of the title screen in characters
} gameConstants;

enum gameMode {
GAME_MODE_NORMAL,
GAME_MODE_WIZARD,
GAME_MODE_EASY
};

// these are basically global variables pertaining to the game state and player's unique variables:
typedef struct playerCharacter {
boolean wizard; // in wizard mode
enum gameMode mode; // in wizard/easy mode

short depthLevel; // which dungeon level are we on
short deepestLevel;
Expand All @@ -2446,7 +2453,6 @@ typedef struct playerCharacter {
boolean updatedAllySafetyMapThisTurn; // so it's updated no more than once per turn
boolean updatedMapToSafeTerrainThisTurn;// so it's updated no more than once per turn
boolean updatedMapToShoreThisTurn; // so it's updated no more than once per turn
boolean easyMode; // enables easy mode
boolean inWater; // helps with the blue water filter effect
boolean heardCombatThisTurn; // so you get only one "you hear combat in the distance" per turn
boolean creaturesWillFlashThisTurn; // there are creatures out there that need to flash before the turn ends
Expand Down
Loading