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
88 changes: 88 additions & 0 deletions src/brogue/IO.c
Original file line number Diff line number Diff line change
Expand Up @@ -3925,6 +3925,94 @@ void refreshSideBar(short focusX, short focusY, boolean focusedEntityMustGoFirst
restoreRNG;
}

void levelSummarySidebar() {
short printY, oldPrintY, i, j, x, y, displayEntityCount;
item *theItem = NULL;
char buf[COLS];
const void *entityList[ROWS] = {0};
enum entityDisplayTypes entityType[ROWS] = {0};
char addedEntity[DCOLS][DROWS];
short oldRNG;

if (rogue.gameHasEnded || rogue.playbackFastForward) {
return;
}

oldRNG = rogue.RNG;
rogue.RNG = RNG_COSMETIC;
//assureCosmeticRNG;

printY = 0;

zeroOutGrid(addedEntity);

// Initialization.
displayEntityCount = 0;
for (i=0; i<ROWS*2; i++) {
rogue.sidebarLocationList[i] = INVALID_POS;
}

// Summary of game-stat collectables
sprintf(buf, " F%i L%i S%i E%i ", pmap[0][0].machineNumber, pmap[1][0].machineNumber, pmap[2][0].machineNumber, pmap[3][0].machineNumber );
printString(buf, 0, printY++, &white, &black, 0);

// Discovered Items
for (theItem = floorItems->nextItem; theItem != NULL && (displayEntityCount * 2) < ROWS; theItem = theItem->nextItem) {
if (!addedEntity[theItem->loc.x][theItem->loc.y]
&& (pmap[theItem->loc.x][theItem->loc.y].flags & DISCOVERED) ) {
addedEntity[theItem->loc.x][theItem->loc.y] = true;
entityList[displayEntityCount] = theItem;
entityType[displayEntityCount] = EDT_ITEM;
displayEntityCount++;
}
}

for (i=0; i<displayEntityCount && printY < ROWS - 1; i++) { // Bottom line is reserved for the depth.
oldPrintY = printY;

if (entityType[i] == EDT_ITEM) {
x = ((item *) entityList[i])->loc.x;
y = ((item *) entityList[i])->loc.y;

unsigned long flags = pmap[x][y].flags;
pmap[x][y].flags |= ANY_KIND_OF_VISIBLE;

short a = tmap[x][y].light[0];
short b = tmap[x][y].light[1];
short c = tmap[x][y].light[2];

tmap[x][y].light[0] = tmap[player.loc.x][player.loc.y].light[0];
tmap[x][y].light[1] = tmap[player.loc.x][player.loc.y].light[1];
tmap[x][y].light[2] = tmap[player.loc.x][player.loc.y].light[2];

printY = printItemInfo((item *) entityList[i],
printY,
false,
false);

pmap[x][y].flags = flags;
tmap[x][y].light[0] = a;
tmap[x][y].light[1] = b;
tmap[x][y].light[2] = c;

// Only one line
printY--;
}
for (j=oldPrintY; j<printY; j++) {
rogue.sidebarLocationList[j] = (pos){ x, y };
}
}

// Wrap things up.
for (i=printY; i< ROWS - 1; i++) {
printString(" ", 0, i, &white, &black, 0);
}
sprintf(buf, " -- Depth: %i --%s ", rogue.depthLevel, (rogue.depthLevel < 10 ? " " : ""));
printString(buf, 0, ROWS - 1, &white, &black, 0);

restoreRNG;
}

void printString(const char *theString, short x, short y, const color *foreColor, const color *backColor, screenDisplayBuffer *dbuf) {
short i;

Expand Down
21 changes: 21 additions & 0 deletions src/brogue/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ void populateItems(pos upstairs) {
randomDepthOffset += rand_range(-1, 1);
}

// TOTAL HACK!
pmap[0][0].machineNumber = 0; // Food
pmap[1][0].machineNumber = 0; // Life
pmap[2][0].machineNumber = 0; // Strength
pmap[3][0].machineNumber = 0; // Enchant

for (int i=0; i<numberOfItems; i++) {
short theCategory = ALL_ITEMS & ~GOLD; // gold is placed separately, below, so it's not a punishment
short theKind = -1;
Expand Down Expand Up @@ -697,10 +703,25 @@ void populateItems(pos upstairs) {
theItem->originDepth = rogue.depthLevel;

if (theItem->category & FOOD) {
pmap[0][0].machineNumber++;
rogue.foodSpawned += foodTable[theItem->kind].power;
if (D_MESSAGE_ITEM_GENERATION) printf("\n(:) Depth %i: generated food", rogue.depthLevel);
}

// Track how many were generated so they can be displayed on the level memory screen
// TODO: Actually need to track how many were discovered, not generated, but this will do for now..
if ((theItem->category & POTION) && (theItem->kind == POTION_LIFE)) {
pmap[1][0].machineNumber++;
}

if ((theItem->category & POTION) && (theItem->kind == POTION_STRENGTH)) {
pmap[2][0].machineNumber++;
}

if ((theItem->category & SCROLL) && (theItem->kind == SCROLL_ENCHANTING)) {
pmap[3][0].machineNumber++;
}

// Choose a placement location.
pos itemPlacementLoc = INVALID_POS;
if ((theItem->category & FOOD) || ((theItem->category & POTION) && theItem->kind == POTION_STRENGTH)) {
Expand Down
6 changes: 6 additions & 0 deletions src/brogue/Movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,12 @@ boolean useStairs(short stairDirection) {
boolean succeeded = false;
//screenDisplayBuffer fromBuf, toBuf;

levelSummarySidebar();
flashTemporaryAlert(" YOUR MEMORY OF THIS DEPTH ", 100); // Not sure why this is needed? Screen refresh delay?
if (takeScreenshot()) {
flashTemporaryAlert(" Screenshot saved in save directory ", 1000);
}

if (stairDirection == 1) {
if (rogue.depthLevel < gameConst->deepestLevel) {
rogue.cursorLoc = INVALID_POS;
Expand Down
1 change: 1 addition & 0 deletions src/brogue/Rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2911,6 +2911,7 @@ extern "C" {

char nextKeyPress(boolean textInput);
void refreshSideBar(short focusX, short focusY, boolean focusedEntityMustGoFirst);
void levelSummarySidebar(void);
void printHelpScreen(void);
void displayFeatsScreen(void);
void printDiscoveriesScreen(void);
Expand Down
4 changes: 3 additions & 1 deletion src/platform/sdl2-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ static boolean _takeScreenshot() {

// choose filename
char screenshotFilepath[BROGUE_FILENAME_MAX];
getAvailableFilePath(screenshotFilepath, "Screenshot", SCREENSHOT_SUFFIX);
char tryName[BROGUE_FILENAME_MAX];
sprintf(tryName, "S%llu D%d T%d", (unsigned long long)rogue.seed, rogue.depthLevel, rogue.absoluteTurnNumber );
getAvailableFilePath(screenshotFilepath, tryName, SCREENSHOT_SUFFIX);
strcat(screenshotFilepath, SCREENSHOT_SUFFIX);

// save to PNG
Expand Down