summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-22 19:20:40 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-22 19:20:40 +0000
commitf245d197538fd150995afa194789354b52a11001 (patch)
treeb5b8e6d9608dcf0818f70fa2d26bde2043a202c5
parentde72d35c7452cc8d1cd51ca799b3aeb579a19238 (diff)
downloadcrawl-ref-f245d197538fd150995afa194789354b52a11001.tar.gz
crawl-ref-f245d197538fd150995afa194789354b52a11001.zip
Resists screen is now colored.
Fixed a bug in the chardump output. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@76 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/chardump.cc78
-rw-r--r--crawl-ref/source/output.cc10
2 files changed, 54 insertions, 34 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index b14b5f410f..e025e9bfe0 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -1192,6 +1192,41 @@ bool dump_char( const char fname[30], bool show_prices ) // $$$ a try block?
return (succeeded);
} // end dump_char()
+static void set_resist_dump_color( const char* data ) {
+ while ( *data && *data != ':' )
+ ++data;
+ if ( *data == 0 )
+ return;
+ ++data;
+ int pluscount = 0;
+ while ( *data ) {
+ if ( *data == '+' )
+ ++pluscount;
+ if ( *data == 'x' )
+ --pluscount;
+ ++data;
+ }
+ switch ( pluscount ) {
+ case 3:
+ case 2:
+ textcolor(LIGHTGREEN);
+ break;
+ case 1:
+ textcolor(GREEN);
+ break;
+ case -1:
+ textcolor(RED);
+ break;
+ case -2:
+ case -3:
+ textcolor(LIGHTRED);
+ break;
+ default:
+ textcolor(LIGHTGREY);
+ break;
+ }
+}
+
void resists_screen() {
#ifdef DOS_TERM
char dosbuffer[4000];
@@ -1199,42 +1234,25 @@ void resists_screen() {
window( 1, 1, 80, 25 );
#endif
clrscr();
- textcolor( LIGHTGREY );
+ textcolor(LIGHTGREY);
char buffer[25*3][45];
- char text[4000];
- char str_pass[80];
- char* ptr_n;
- text[0] = 0;
get_full_detail(&buffer[0][0], false);
- for (int i = 0; i < 25; i++)
- {
- ptr_n = &buffer[i][0];
- if (buffer[i+25][0] == '\0' && buffer[i+50][0] == '\0')
- snprintf(&str_pass[0], 45, "%s", ptr_n);
- else
- snprintf(&str_pass[0], 45, "%-32s", ptr_n);
- strcat(text, str_pass);
-
- ptr_n = &buffer[i+25][0];
- if (buffer[i+50][0] == '\0')
- snprintf(&str_pass[0], 45, "%s", ptr_n);
- else
- snprintf(&str_pass[0], 45, "%-20s", ptr_n);
- strcat(text, str_pass);
-
- ptr_n = &buffer[i+50][0];
- if (buffer[i+50][0] != '\0')
- {
- snprintf(&str_pass[0], 45, "%s", ptr_n);
- strcat(text, str_pass);
- }
- strcat(text, EOL);
+ for (int line = 0; line < 25; ++line ) {
+ for ( int block = 0; block < 3; ++block ) {
+ int idx = block * 25 + line;
+ if ( buffer[idx][0] ) {
+ gotoxy( block == 2 ? 53 : block * 32 + 1, line+1 );
+ /* FIXME - hack - magic number 14 */
+ if ( block != 0 && line < 14 )
+ set_resist_dump_color(buffer[idx]);
+ cprintf("%s", buffer[idx] );
+ textcolor(LIGHTGREY);
+ }
+ }
}
- cprintf(text);
-
getch();
#ifdef DOS_TERM
puttext(1, 1, 80, 25, dosbuffer);
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index a6fba6c84a..d96c1ff338 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -559,10 +559,12 @@ unsigned char* itosym1(int stat)
unsigned char* itosym3(int stat)
{
return (unsigned char*)( (stat >= 3) ? "+ + +" :
- (stat == 2) ? "+ + ." :
- (stat == 1) ? "+ . ." :
- (stat == 0) ? ". . ." :
- "x . .");
+ (stat == 2) ? "+ + ." :
+ (stat == 1) ? "+ . ." :
+ (stat == 0) ? ". . ." :
+ (stat == -1) ? "x . ." :
+ (stat == -2) ? "x x ." :
+ "x x x");
}
static const char *s_equip_slot_names[] =