Skip to content

Commit

Permalink
Names can be configured to use nicknames and species (or not). Plain …
Browse files Browse the repository at this point in the history
…old names capitalised
  • Loading branch information
Kris Parker committed Jan 16, 2010
1 parent 9164194 commit 60bc008
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 65 deletions.
8 changes: 8 additions & 0 deletions Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ void parseConfigLine( string line ){
string result = parseStrFromLine( "SHOW_CREATURE_NAMES", line );
config.show_creature_names = (result == "YES");
}
if( line.find("NAMES_USE_NICKNAME") != -1){
string result = parseStrFromLine( "NAMES_USE_NICKNAME", line );
config.names_use_nick = (result == "YES");
}
if( line.find("NAMES_USE_SPECIES") != -1){
string result = parseStrFromLine( "NAMES_USE_SPECIES", line );
config.names_use_species = (result == "YES");
}
if( line.find("SHOW_OSD") != -1){
string result = parseStrFromLine( "SHOW_OSD", line );
config.show_osd = (result == "YES");
Expand Down
20 changes: 15 additions & 5 deletions Creatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ void DrawCreature( BITMAP* target, int drawx, int drawy, t_creature* creature ){
//if(creature->x == 151 && creature->y == 145)
// int j = 10;
if( config.show_creature_names )
/*if (creature->nick_name[0])
if (creature->nick_name[0] && config.names_use_nick)
{
textprintf(target, font, drawx, drawy-20, 0xFFffFF, "%s", creature->nick_name );
else */
if (creature->first_name[0])
textprintf(target, font, drawx, drawy-20, 0xFFffFF, "%s", creature->first_name );
else
}
else if (creature->first_name[0])
{
char buffer[128];
strncpy(buffer,creature->first_name,127);
buffer[127]=0;
if (buffer[0]>90)
buffer[0] -= 32;
textprintf(target, font, drawx, drawy-20, 0xFFffFF, "%s", buffer );
}
else if (config.names_use_species)
{
textprintf(target, font, drawx, drawy-20, 0xFFffFF, "[%s]", contentLoader.creatureNameStrings.at(creature->type).id);
}

BITMAP* creatureSheet;
if (sprite.fileIndex == -1)
Expand Down
122 changes: 62 additions & 60 deletions commonTypes.h
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
#pragma once



struct t_SpriteWithOffset{
int32_t sheetIndex;
int16_t x;
int16_t y;
int32_t fileIndex;
char animFrames;
} ;


typedef struct Crd2D {
int32_t x,y;
}Crd2D;
typedef struct Crd3D {
int32_t x,y,z;
}Crd3D;




typedef struct {
bool show_zones;
bool show_stockpiles;
bool show_osd;
bool single_layer_view;
bool shade_hidden_blocks;
bool show_hidden_blocks;
bool show_creature_names;
bool show_all_creatures;
bool load_ground_materials;
bool hide_outer_blocks;
bool debug_mode;
bool track_center;
int lift_segment_offscreen;
bool truncate_walls;
bool follow_DFscreen;
bool verbose_logging;
int viewXoffset;
int viewYoffset;
int viewZoffset;
int automatic_reload_time;
int automatic_reload_step;
int animation_step;

int screenWidth;
int screenHeight;
bool Fullscreen;
#pragma once



struct t_SpriteWithOffset{
int32_t sheetIndex;
int16_t x;
int16_t y;
int32_t fileIndex;
char animFrames;
} ;


typedef struct Crd2D {
int32_t x,y;
}Crd2D;
typedef struct Crd3D {
int32_t x,y,z;
}Crd3D;




typedef struct {
bool show_zones;
bool show_stockpiles;
bool show_osd;
bool single_layer_view;
bool shade_hidden_blocks;
bool show_hidden_blocks;
bool show_creature_names;
bool names_use_nick;
bool names_use_species;
bool show_all_creatures;
bool load_ground_materials;
bool hide_outer_blocks;
bool debug_mode;
bool track_center;
int lift_segment_offscreen;
bool truncate_walls;
bool follow_DFscreen;
bool verbose_logging;
int viewXoffset;
int viewYoffset;
int viewZoffset;
int automatic_reload_time;
int automatic_reload_step;
int animation_step;

int screenWidth;
int screenHeight;
bool Fullscreen;
bool show_intro;
int fogr;
int fogg;
Expand All @@ -56,14 +58,14 @@ typedef struct {
int backr;
int backg;
int backb;

Crd3D segmentSize;

} GameConfiguration;


enum enumCreatureSex{
eCreatureSex_NA,
eCreatureSex_Male,
eCreatureSex_Female

Crd3D segmentSize;

} GameConfiguration;


enum enumCreatureSex{
eCreatureSex_NA,
eCreatureSex_Male,
eCreatureSex_Female
};
4 changes: 4 additions & 0 deletions init.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ Follow DF window is on when Stonesense launches. (Toggle with 'f')
Shows creatures names floating above their sprites. (Toggle with 'n')
[SHOW_CREATURE_NAMES:YES]

Options to control how names are displayed (if SHOW_CREATURE_NAMES is set)
[NAMES_USE_NICKNAME:YES]
[NAMES_USE_SPECIES:YES]

Shows building graphics for zones. (Toggle with 'i')
[SHOW_ZONES:NO]

Expand Down

0 comments on commit 60bc008

Please sign in to comment.