Skip to content

Commit

Permalink
First committed version
Browse files Browse the repository at this point in the history
  • Loading branch information
greed committed Apr 28, 2017
0 parents commit 3624c4b
Show file tree
Hide file tree
Showing 213 changed files with 147,322 additions and 0 deletions.
Binary file added SDL.dll
Binary file not shown.
Binary file added fonts/Thumbs.db
Binary file not shown.
Binary file added fonts/font-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-13.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/font-9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55,427 changes: 55,427 additions & 0 deletions gBrogue Source/Brogue seed catalog.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions gBrogue Source/Makefile
@@ -0,0 +1,32 @@
LIBTCODDIR=libtcod-1.5.2
SDLDIR=SDL-1.2.14
CFLAGS=$(FLAGS) -I$(LIBTCODDIR)/include -I$(SDLDIR)/include -IBrogueCode -IPlatformCode -DBROGUE_TCOD -Wall

%.o : %.c
gcc $(CFLAGS) -O2 -s -o $@ -c $<

OBJS=BrogueCode/Architect.o \
BrogueCode/Combat.o \
BrogueCode/Dijkstra.o \
BrogueCode/Globals.o \
BrogueCode/IO.o \
BrogueCode/Buttons.o \
BrogueCode/MainMenu.o \
BrogueCode/Items.o \
BrogueCode/Light.o \
BrogueCode/Monsters.o \
BrogueCode/Movement.o \
BrogueCode/RogueMain.o \
BrogueCode/Random.o \
BrogueCode/Recordings.o \
PlatformCode/main.o \
PlatformCode/platformdependent.o \
PlatformCode/tcod-platform.o

all : brogue

brogue-icon.o : brogue-icon.ico icon.rc
windres icon.rc brogue-icon.o

brogue : ${OBJS} brogue-icon.o
g++ -o brogue.exe ${OBJS} brogue-icon.o -L. -ltcod-mingw -lSDL -L$(LIBTCODDIR)/ -static-libgcc -static-libstdc++ -mwindows
29 changes: 29 additions & 0 deletions gBrogue Source/PlatformCode/PlatformDefines.h
@@ -0,0 +1,29 @@
/*
* PlatformDefines.h
* Brogue
*
* Created by Brian Walker on 5/22/10.
* Copyright 2010. All rights reserved.
*
* This file is part of Brogue.
*
* Brogue is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Brogue is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Brogue. If not, see <http://www.gnu.org/licenses/>.
*/

// Any platform-dependent defines that must be accessible in the game code
// should go in here.

#define BROGUE_LIBTCOD
#define PLAY_AGAIN_STRING "Press space to play again."

229 changes: 229 additions & 0 deletions gBrogue Source/PlatformCode/curses-platform.c
@@ -0,0 +1,229 @@
#ifdef BROGUE_CURSES
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "term.h"
#include <sys/timeb.h>
#include <stdint.h>
#include <signal.h>
#include "platform.h"

extern playerCharacter rogue;

static void gameLoop() {
signal(SIGINT, SIG_DFL); // keep SDL from overriding the default ^C handler when it's linked

if (!Term.start()) {
return;
}
Term.title("Brogue " BROGUE_VERSION_STRING);
Term.resize(COLS, ROWS);

rogueMain();

Term.end();
}

static void curses_plotChar(uchar ch,
short xLoc, short yLoc,
short foreRed, short foreGreen, short foreBlue,
short backRed, short backGreen, short backBlue) {

fcolor fore;
fcolor back;

fore.r = (float) foreRed / 100;
fore.g = (float) foreGreen / 100;
fore.b = (float) foreBlue / 100;
back.r = (float) backRed / 100;
back.g = (float) backGreen / 100;
back.b = (float) backBlue / 100;

#ifdef USE_UNICODE
// because we can't look at unicode and ascii without messing with Rogue.h, reinterpret until some later version comes along:
switch (ch) {
case FLOOR_CHAR: ch = '.'; break;
case CHASM_CHAR: ch = ':'; break;
case TRAP_CHAR: ch = '%'; break;
case FIRE_CHAR: ch = '^'; break;
case FOLIAGE_CHAR: ch = '&'; break;
case AMULET_CHAR: ch = ','; break;
case SCROLL_CHAR: ch = '?'; break;
case RING_CHAR: ch = '='; break;
case WEAPON_CHAR: ch = '('; break;
case GEM_CHAR: ch = '+'; break;
case TOTEM_CHAR: ch = '0'; break;
case BAD_MAGIC_CHAR: ch = '+'; break;
case GOOD_MAGIC_CHAR: ch = '$'; break;

// case UP_ARROW_CHAR: ch = '^'; break; // same as WEAPON_CHAR
case DOWN_ARROW_CHAR: ch = 'v'; break;
case LEFT_ARROW_CHAR: ch = '<'; break;
case RIGHT_ARROW_CHAR: ch = '>'; break;

case UP_TRIANGLE_CHAR: ch = '^'; break;
case DOWN_TRIANGLE_CHAR: ch = 'v'; break;

case CHARM_CHAR: ch = '7'; break;

case OMEGA_CHAR: ch = '<'; break;
case THETA_CHAR: ch = '0'; break;
case LAMDA_CHAR: ch = '^'; break;
case KOPPA_CHAR: ch = '0'; break;

case LOZENGE_CHAR: ch = 'o'; break;
case CROSS_PRODUCT_CHAR: ch = 'x'; break;

case STATUE_CHAR: ch = '5'; break;
case MOLOCH_CHAR: ch = '&'; break;
case UNICORN_CHAR: ch = 'U'; break;
case PET_DOG_CHAR: ch = 'q'; break;
}
#endif

if (ch < ' ' || ch > 127) ch = ' ';
Term.put(xLoc, yLoc, ch, &fore, &back);
}


struct mapsymbol {
int in_c, out_c;
struct mapsymbol *next;
};

static struct mapsymbol *keymap = NULL;

static int rewriteKey(int key, boolean text) {
if (text) return key;

struct mapsymbol *s = keymap;
while (s != NULL) {
if (s->in_c == key) {
return s->out_c;
}

s = s->next;
}
return key;
}


#define PAUSE_BETWEEN_EVENT_POLLING 34//17

static uint32_t getTime() {
struct timeb time;
ftime(&time);
return 1000 * time.time + time.millitm;
}

static boolean curses_pauseForMilliseconds(short milliseconds) {
Term.refresh();
Term.wait(milliseconds);

// hasKey returns true if we have a mouse event, too.
return Term.hasKey();
}

static void curses_nextKeyOrMouseEvent(rogueEvent *returnEvent, boolean textInput, boolean colorsDance) {
int key;
// TCOD_mouse_t mouse;
uint32_t theTime, waitTime;
// short x, y;

Term.refresh();

if (noMenu && rogue.nextGame == NG_NOTHING) rogue.nextGame = NG_NEW_GAME;

for (;;) {
theTime = getTime(); //TCOD_sys_elapsed_milli();

/*if (TCOD_console_is_window_closed()) {
rogue.gameHasEnded = true; // causes the game loop to terminate quickly
returnEvent->eventType = KEYSTROKE;
returnEvent->param1 = ACKNOWLEDGE_KEY;
return;
}*/

if (colorsDance) {
shuffleTerrainColors(3, true);
commitDraws();
}


key = Term.getkey();
if (key == TERM_MOUSE) {
if (Term.mouse.x > 0 && Term.mouse.y > 0 && Term.mouse.x < COLS && Term.mouse.y < ROWS) {
returnEvent->param1 = Term.mouse.x;
returnEvent->param2 = Term.mouse.y;
returnEvent->eventType = KEYSTROKE;
if (Term.mouse.justReleased) returnEvent->eventType = MOUSE_UP;
if (Term.mouse.justPressed) returnEvent->eventType = MOUSE_DOWN;
if (Term.mouse.justMoved) returnEvent->eventType = MOUSE_ENTERED_CELL;
returnEvent->controlKey = Term.mouse.control;
returnEvent->shiftKey = Term.mouse.shift;
if (returnEvent->eventType != KEYSTROKE) return;
}
} else if (key != TERM_NONE) {
key = rewriteKey(key, textInput);

returnEvent->eventType = KEYSTROKE;
returnEvent->controlKey = 0; //(key.rctrl || key.lctrl);
returnEvent->shiftKey = 0; //key.shift;
returnEvent->param1 = key;

if (key == Term.keys.backspace || key == Term.keys.del) returnEvent->param1 = DELETE_KEY;
else if (key == Term.keys.up) returnEvent->param1 = UP_ARROW;
else if (key == Term.keys.down) returnEvent->param1 = DOWN_ARROW;
else if (key == Term.keys.left) returnEvent->param1 = LEFT_ARROW;
else if (key == Term.keys.right) returnEvent->param1 = RIGHT_ARROW;
else if (key == Term.keys.quit) {
rogue.gameHasEnded = true;
rogue.nextGame = NG_QUIT; // causes the menu to drop out immediately
}
else if ((key >= 'A' && key <= 'Z')) {
returnEvent->shiftKey = 1;
// returnEvent->param1 += 'a' - 'A';
}
// we could try to catch control keys, where possible, but we'll catch keys we mustn't
/* else if ((key >= 'A'-'@' && key <= 'Z'-'@')) {
returnEvent->controlKey = 1;
returnEvent->param1 += 'a' - ('A'-'@');
} */

return;
}

waitTime = PAUSE_BETWEEN_EVENT_POLLING + theTime - getTime();

if (waitTime > 0 && waitTime <= PAUSE_BETWEEN_EVENT_POLLING) {
curses_pauseForMilliseconds(waitTime);
}
}
}

static void curses_remap(const char *input_name, const char *output_name) {
struct mapsymbol *sym = malloc(sizeof(*sym));

if (sym == NULL) return; // out of memory? seriously?

sym->in_c = Term.keycodeByName(input_name);
sym->out_c = Term.keycodeByName(output_name);

sym->next = keymap;
keymap = sym;
}

static boolean modifier_held(int modifier) {
return 0;
}

struct brogueConsole cursesConsole = {
gameLoop,
curses_pauseForMilliseconds,
curses_nextKeyOrMouseEvent,
curses_plotChar,
curses_remap,
modifier_held
};
#endif

0 comments on commit 3624c4b

Please sign in to comment.