diff options
| author | Japa Illo | 2012-03-04 17:04:27 +0530 |
|---|---|---|
| committer | Japa Illo | 2012-03-04 17:04:27 +0530 |
| commit | 50bbecc544aa227fb7bfc4a5c90c6b27369d8bcd (patch) | |
| tree | 5192971d0c752fe4da7504625c001ad3d60c7b19 | |
| parent | 624bef8817b277e340c2312d6d1b62cb50fcb589 (diff) | |
| download | stonesense-50bbecc544aa227fb7bfc4a5c90c6b27369d8bcd.tar.gz stonesense-50bbecc544aa227fb7bfc4a5c90c6b27369d8bcd.tar.bz2 stonesense-50bbecc544aa227fb7bfc4a5c90c6b27369d8bcd.tar.xz | |
Added support for reading and displaying creature and building inventories.
Todo: some way to use them.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
| -rw-r--r-- | Block.cpp | 8 | ||||
| -rw-r--r-- | Block.h | 21 | ||||
| -rw-r--r-- | Creatures.cpp | 144 | ||||
| -rw-r--r-- | GUI.cpp | 768 | ||||
| -rw-r--r-- | GUI.h | 6 | ||||
| -rw-r--r-- | SpriteObjects.cpp | 30 | ||||
| -rw-r--r-- | UserInput.cpp | 18 | ||||
| -rw-r--r-- | VegetationConfiguration.cpp | 1 | ||||
| -rw-r--r-- | common.h | 2 | ||||
| -rw-r--r-- | main.cpp | 6 |
10 files changed, 586 insertions, 418 deletions
@@ -33,6 +33,12 @@ void initRandomCube() randomCube[i][j][k] = rand();
}
+Worn_Item::Worn_Item()
+{
+ matt.index = -1;
+ matt.type = -1;
+}
+
Block::Block(WorldSegment* ownerSegment)
{
//clear out own memory
@@ -64,6 +70,8 @@ Block::Block(WorldSegment* ownerSegment) Block::~Block(void){
if( creature )
delete(creature);
+ if(inv)
+ delete(inv);
}
void* Block::operator new (size_t size){
@@ -15,8 +15,22 @@ struct Worn_Item {
DFHack::t_matglossPair matt;
int8_t rating;
+ Worn_Item();
};
+struct Unit_Inventory
+{
+ std::vector<Worn_Item> Weapons;
+ std::vector<Worn_Item> Armor;
+ std::vector<Worn_Item> Shoes;
+ std::vector<Worn_Item> Shield;
+ std::vector<Worn_Item> Helm;
+ std::vector<Worn_Item> Gloves;
+ std::vector<Worn_Item> Pants;
+};
+
+
+
class Block
{
public:
@@ -133,12 +147,7 @@ public: bool obscuringBuilding;
//These are actually applied to the creature standing here, but there's only one creature shown, so it's okay.
- Worn_Item Weapon;
- Worn_Item Armor;
- Worn_Item Shoes;
- Worn_Item Shield;
- Worn_Item Helm;
- Worn_Item Gloves;
+ Unit_Inventory * inv;
private:
diff --git a/Creatures.cpp b/Creatures.cpp index 24a11eb..0c5a906 100644 --- a/Creatures.cpp +++ b/Creatures.cpp @@ -380,26 +380,6 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment) break;
}
}
- // add the materials of what the creature's wearing.
- // FIXME: this is constructor material. Don't clutter normal code with this.
- b->Weapon.matt.index=INVALID_INDEX;
- b->Weapon.matt.type=INVALID_INDEX;
- b->Weapon.rating = 0;
- b->Armor.matt.index=INVALID_INDEX;
- b->Armor.matt.type=INVALID_INDEX;
- b->Armor.rating = 0;
- b->Shoes.matt.index=INVALID_INDEX;
- b->Shoes.matt.type=INVALID_INDEX;
- b->Shoes.rating = 0;
- b->Shield.matt.index=INVALID_INDEX;
- b->Shield.matt.type=INVALID_INDEX;
- b->Shield.rating = 0;
- b->Helm.matt.index=INVALID_INDEX;
- b->Helm.matt.type=INVALID_INDEX;
- b->Helm.rating = 0;
- b->Gloves.matt.index=INVALID_INDEX;
- b->Gloves.matt.type=INVALID_INDEX;
- b->Gloves.rating = 0;
for (auto iter = unit_ptr->inventory.begin(); iter != unit_ptr->inventory.end(); iter++)
{
df::unit_inventory_item * itemslot = *iter;
@@ -417,65 +397,77 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment) itemslot->mode != df::unit_inventory_item::T_mode::Worn)
continue;
+ //skip if there's no subtype. there should be, but who knows.
+ if(item->getSubtype() < 0)
+ continue;
+
item_type::item_type type = item->getType();
int8_t armor = item->getEffectiveArmorLevel();
- //FIXME: this could be made nicer. Somehow.
+ //FIXME: this could be made nicer. Somehow
switch (item->getType())
- {
- case item_type::WEAPON:
- //if(armor > b->Weapon.rating)
- //{
- b->Weapon.rating = armor;
- b->Weapon.matt.type = item->getActualMaterial();
- b->Weapon.matt.index = item->getActualMaterialIndex();
- //}
- break;
- case item_type::ARMOR:
- //if(armor > b->Weapon.rating)
- //{
- b->Armor.rating = armor;
- b->Armor.matt.type = item->getActualMaterial();
- b->Armor.matt.index = item->getActualMaterialIndex();
- //}
- break;
- case item_type::SHOES:
- //if(armor > b->Weapon.rating)
- //{
- b->Shoes.rating = armor;
- b->Shoes.matt.type = item->getActualMaterial();
- b->Shoes.matt.index = item->getActualMaterialIndex();
- //}
- break;
- case item_type::SHIELD:
- //if(armor > b->Weapon.rating)
- //{
- b->Shield.rating = armor;
- b->Shield.matt.type = item->getActualMaterial();
- b->Shield.matt.index = item->getActualMaterialIndex();
- //}
- break;
- case item_type::HELM:
- //if(armor > b->Weapon.rating)
- //{
- b->Helm.rating = armor;
- b->Helm.matt.type = item->getActualMaterial();
- b->Helm.matt.index = item->getActualMaterialIndex();
- //}
- break;
- case item_type::GLOVES:
- //if(armor > b->Weapon.rating)
- //{
- b->Gloves.rating = armor;
- b->Gloves.matt.type = item->getActualMaterial();
- b->Gloves.matt.index = item->getActualMaterialIndex();
- //}
- break;
- default:
- // something unexpected. Should we react at all?
- break;
- }
- }
- // need a new tempcreature now
+ {
+ case item_type::WEAPON:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Weapons.size() <= item->getSubtype())
+ b->inv->Weapons.resize(item->getSubtype()+1);
+ b->inv->Weapons[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Weapons[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::ARMOR:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Armor.size() <= item->getSubtype())
+ b->inv->Armor.resize(item->getSubtype()+1);
+ b->inv->Armor[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Armor[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::SHOES:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Shoes.size() <= item->getSubtype())
+ b->inv->Shoes.resize(item->getSubtype()+1);
+ b->inv->Shoes[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Shoes[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::SHIELD:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Shield.size() <= item->getSubtype())
+ b->inv->Shield.resize(item->getSubtype()+1);
+ b->inv->Shield[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Shield[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::HELM:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Helm.size() <= item->getSubtype())
+ b->inv->Helm.resize(item->getSubtype()+1);
+ b->inv->Helm[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Helm[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::GLOVES:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Gloves.size() <= item->getSubtype())
+ b->inv->Gloves.resize(item->getSubtype()+1);
+ b->inv->Gloves[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Gloves[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ case item_type::PANTS:
+ if(!b->inv)
+ b->inv = new(Unit_Inventory);
+ if(b->inv->Pants.size() <= item->getSubtype())
+ b->inv->Pants.resize(item->getSubtype()+1);
+ b->inv->Pants[item->getSubtype()].matt.type = item->getActualMaterial();
+ b->inv->Pants[item->getSubtype()].matt.index = item->getActualMaterialIndex();
+ break;
+ default:
+ // something unexpected. Should we react at all?
+ break;
+ }
+ }
+ // need a new tempcreature now
// old tempcreature should be deleted when b is
tempcreature = new t_unit;
}
@@ -16,6 +16,25 @@ using namespace std; #include "BlockFactory.h"
#include "Block.h"
+#include "df/ui.h"
+#include "df/building_actual.h"
+
+#include "df/itemdef.h"
+#include "df/itemdef_weaponst.h"
+#include "df/itemdef_trapcompst.h"
+#include "df/itemdef_toyst.h"
+#include "df/itemdef_toolst.h"
+#include "df/itemdef_instrumentst.h"
+#include "df/itemdef_armorst.h"
+#include "df/itemdef_ammost.h"
+#include "df/itemdef_siegeammost.h"
+#include "df/itemdef_glovesst.h"
+#include "df/itemdef_shoesst.h"
+#include "df/itemdef_shieldst.h"
+#include "df/itemdef_helmst.h"
+#include "df/itemdef_pantsst.h"
+#include "df/itemdef_foodst.h"
+
#define color_segmentoutline al_map_rgb(0,0,0)
extern ALLEGRO_FONT *font;
@@ -61,6 +80,46 @@ ALLEGRO_COLOR premultiply(ALLEGRO_COLOR input) return out;
}
+const char * get_item_subtype(item_type::item_type type, int subtype)
+{
+ if (subtype < 0)
+ return "?";
+ switch(type)
+ {
+ case item_type::WEAPON:
+ return df::global::world->raws.itemdefs.weapons[subtype]->id.c_str();
+ case item_type::TRAPCOMP:
+ return df::global::world->raws.itemdefs.trapcomps[subtype]->id.c_str();
+ case item_type::TOY:
+ return df::global::world->raws.itemdefs.toys[subtype]->id.c_str();
+ case item_type::TOOL:
+ return df::global::world->raws.itemdefs.tools[subtype]->id.c_str();
+ case item_type::INSTRUMENT:
+ return df::global::world->raws.itemdefs.instruments[subtype]->id.c_str();
+ case item_type::ARMOR:
+ return df::global::world->raws.itemdefs.armor[subtype]->id.c_str();
+ case item_type::AMMO:
+ return df::global::world->raws.itemdefs.ammo[subtype]->id.c_str();
+ case item_type::SIEGEAMMO:
+ return df::global::world->raws.itemdefs.siege_ammo[subtype]->id.c_str();
+ case item_type::GLOVES:
+ return df::global::world->raws.itemdefs.gloves[subtype]->id.c_str();
+ case item_type::SHOES:
+ return df::global::world->raws.itemdefs.shoes[subtype]->id.c_str();
+ case item_type::SHIELD:
+ return df::global::world->raws.itemdefs.shields[subtype]->id.c_str();
+ case item_type::HELM:
+ return df::global::world->raws.itemdefs.helms[subtype]->id.c_str();
+ case item_type::PANTS:
+ return df::global::world->raws.itemdefs.pants[subtype]->id.c_str();
+ case item_type::FOOD:
+ return df::global::world->raws.itemdefs.food[subtype]->id.c_str();
+ default:
+ return "?";
+ }
+}
+
+
void draw_diamond(float x, float y, ALLEGRO_COLOR color)
{
al_draw_filled_triangle(x, y, x+4, y+4, x-4, y+4, color);
@@ -338,8 +397,10 @@ void DrawCurrentLevelOutline(bool backPart){ }
}
-void drawDebugCursorAndInfo(WorldSegment * segment)
+void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
+ using df::global::ui;
+
if((config.dfCursorX != -30000) && config.follow_DFcursor)
{
int x = config.dfCursorX;
@@ -363,17 +424,12 @@ void drawDebugCursorAndInfo(WorldSegment * segment) //get block info
Block* b = segment->getBlockLocal( debugCursor.x, debugCursor.y, debugCursor.z+segment->sizez-2);
int i = 10;
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0, "Block 0x%x", b);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0, "Block 0x%x", b);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
"Coord:(%i,%i,%i)", debugCursor.x, debugCursor.y, debugCursor.z);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Game Mode:%i, Control Mode:%i", contentLoader->gameMode.g_mode, contentLoader->gameMode.g_type);
-
if(!b) return;
-
-
int ttype;
const char* tform = NULL;
if (b->tileShapeBasic==tiletype_shape_basic::Floor)
@@ -397,304 +453,438 @@ void drawDebugCursorAndInfo(WorldSegment * segment) tform="stair";
}
- if (tform != NULL)
- {
- const char* formName = lookupFormName(b->consForm);
- const char* matName = lookupMaterialTypeName(b->material.type);
- const char* subMatName = lookupMaterialName(b->material.type,b->material.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "%s %s:%i Material:%s%s%s (%d,%d)", formName, tform, ttype,
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"", b->material.type,b->material.index);
- }
- if (tform != NULL)
- {
- MaterialInfo mat;
- mat.decode(b->material.type, b->material.index);
- ALLEGRO_COLOR color = al_map_rgb_f(contentLoader->Mats->color[mat.material->state_color[0]].red, contentLoader->Mats->color[mat.material->state_color[0]].green, contentLoader->Mats->color[mat.material->state_color[0]].blue);
- draw_textf_border(font, color, 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "%s", mat.material->state_name[0].c_str());
- } //if (tform != NULL)
- //{
- // draw_textf_border(font, 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- // "MaterialType: %d, MaterialIndex: %d", b->material.type, b->material.index);
- //}
- if (tform != NULL)
+ switch(ui->main.mode)
{
- const char* matName = lookupMaterialTypeName(b->layerMaterial.type);
- const char* subMatName = lookupMaterialName(b->layerMaterial.type,b->layerMaterial.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Layer Material:%s%s%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if ((tform != NULL) && b->hasVein == 1)
- {
- const char* matName = lookupMaterialTypeName(b->veinMaterial.type);
- const char* subMatName = lookupMaterialName(b->veinMaterial.type,b->veinMaterial.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Vein Material:%s%s%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if (tform != NULL)//(b->grasslevel > 0)
- {
- const char* subMatName = lookupMaterialName(WOOD,b->grassmat);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Grass length:%d, Material: %s",
- b->grasslevel, subMatName?subMatName:"");
- }
- //for(int j = 0; j < b->grasslevels.size(); j++)
- //{
- // const char* subMatName = lookupMaterialName(WOOD,b->grassmats.at(j));
- // draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- // "Grass length:%d, Material: %s",
- // b->grasslevels.at(j), subMatName?subMatName:"");
- //}
-
- if(b->water.index > 0 || b->tree.index != 0)
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "tree:%i water:%i,%i", b->tree.index, b->water.type, b->water.index);
- if(b->tree.index != 0)
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "tree name:%s type:%i", lookupTreeName(b->tree.index), b->tree.type);
- if(b->building.sprites.size() != 0)
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "%i extra sprites.", b->building.sprites.size());
-
- // FIXME: classidstrings is no more
- //building
- if(b->building.info.type != BUILDINGTYPE_NA && b->building.info.type != BUILDINGTYPE_BLACKBOX && b->building.info.type != BUILDINGTYPE_TREE){
- const char* matName = lookupMaterialTypeName(b->building.info.material.type);
- const char* subMatName = lookupMaterialName(b->building.info.material.type,b->building.info.material.index);
- const char* subTypeName = lookupBuildingSubtype(b->building.info.type, b->building.info.subtype);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Building: game_type = %s(%i) game_subtype = %s(%i) Material: %s%s%s (%d,%d)",
- ENUM_KEY_STR(building_type, (building_type::building_type)b->building.info.type),
- b->building.info.type,
- subTypeName,
- b->building.info.subtype,
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
- b->building.info.material.type,b->building.info.material.index);
-
- //if(b->building.custom_building_type != -1)
- //{
- // draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- // "Custom workshop type %s (%d)", contentLoader->custom_workshop_types[b->building.custom_building_type].c_str(),b->building.custom_building_type);
- //}
- }
-
- //creatures
- if(b->creature != null){
- if(!config.skipCreatureTypes)
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
+ case ui_sidebar_mode::BuildingItems:
+ if(b->building.info.type != BUILDINGTYPE_NA && b->building.info.type != BUILDINGTYPE_BLACKBOX && b->building.info.type != BUILDINGTYPE_TREE)
+ {
+ auto Actual_building = virtual_cast<df::building_actual>(b->building.info.origin);
+ if(!Actual_building)
+ break;
+ c->Suspend();
+ Actual_building->contained_items.size(); //Item array.
+ std::string BuildingName;
+ Actual_building->getName(&BuildingName);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "%s",
+ BuildingName.c_str());
+ for(int index = 0; index < Actual_building->contained_items.size(); index++)
+ {
+ MaterialInfo mat;
+ mat.decode(Actual_building->contained_items[index]->item->getMaterial(), Actual_building->contained_items[index]->item->getMaterialIndex());
+ char stacknum[8] = {0};
+ sprintf(stacknum, " [%d]", Actual_building->contained_items[index]->item->getStackSize());
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "%s - %s%s%s%s%s",
+ mat.getToken().c_str(),
+ ENUM_KEY_STR(item_type, Actual_building->contained_items[index]->item->getType()),
+ (Actual_building->contained_items[index]->item->getSubtype()>=0)?"/":"",
+ (Actual_building->contained_items[index]->item->getSubtype()>=0)?get_item_subtype(Actual_building->contained_items[index]->item->getType(),Actual_building->contained_items[index]->item->getSubtype()):"",
+ Actual_building->contained_items[index]->item->getStackSize()>1?stacknum:"",
+ (Actual_building->contained_items[index]->use_mode == 2?" [B]":""));
+ }
+ c->Resume();
+ }
+ break;
+ case ui_sidebar_mode::ViewUnits:
+ //creatures
+ if(b->creature == null)
+ break;
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
"Creature:%s(%i) Caste:%s(%i) Job:%s",
contentLoader->Mats->race.at(b->creature->race).id.c_str(), b->creature->race,
contentLoader->Mats->raceEx.at(b->creature->race).castes.at(b->creature->caste).id.c_str(), b->creature->caste,
contentLoader->professionStrings.at(b->creature->profession).c_str());
- if(!config.skipCreatureTypes)
+ //Inventories!
+ if(b->inv)
{
- MaterialInfo wep;
- if(b->Weapon.matt.type >=0)
- wep.decode(b->Weapon.matt.type, b->Weapon.matt.index);
- MaterialInfo arm;
- if(b->Armor.matt.type >=0)
- arm.decode(b->Armor.matt.type, b->Armor.matt.index);
- MaterialInfo sho;
- if(b->Shoes.matt.type >=0)
- sho.decode(b->Shoes.matt.type, b->Shoes.matt.index);
- MaterialInfo shi;
- if(b->Shield.matt.type >=0)
- shi.decode(b->Shield.matt.type, b->Shield.matt.index);
- MaterialInfo hel;
- if(b->Helm.matt.type >=0)
- hel.decode(b->Helm.matt.type, b->Helm.matt.index);
- MaterialInfo glo;
- if(b->Gloves.matt.type >=0)
- glo.decode(b->Gloves.matt.type, b->Gloves.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Worn %s(%d,%d) weapon, %s(%d,%d) armor, %s(%d,%d) shoes, %s(%d,%d) shield, %s(%d,%d) helm, %s(%d,%d) gloves",
- b->Weapon.matt.type >=0?wep.material->state_name[0].c_str():"no", b->Weapon.matt.type, b->Weapon.matt.index,
- b->Armor.matt.type >=0?arm.material->state_name[0].c_str():"no", b->Armor.matt.type, b->Armor.matt.index,
- b->Shoes.matt.type >=0?sho.material->state_name[0].c_str():"no", b->Shoes.matt.type, b->Shoes.matt.index,
- b->Shield.matt.type >=0?shi.material->state_name[0].c_str():"no", b->Shield.matt.type, b->Shield.matt.index,
- b->Helm.matt.type >=0?hel.material->state_name[0].c_str():"no", b->Helm.matt.type, b->Helm.matt.index,
- b->Gloves.matt.type >=0?glo.material->state_name[0].c_str():"no", b->Gloves.matt.type, b->Gloves.matt.index);
+ if(!b->inv->Weapons.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Weapons:");
+ for(int ind = 0; ind < b->inv->Weapons.size(); ind++)
+ {
+ if(b->inv->Weapons[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Weapons[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Weapons[ind].matt.type,b->inv->Weapons[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::WEAPON),
+ get_item_subtype(item_type::WEAPON,ind));
+ }
+ }
+ if(!b->inv->Armor.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Armor:");
+ for(int ind = 0; ind < b->inv->Armor.size(); ind++)
+ {
+ if(b->inv->Armor[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Armor[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Armor[ind].matt.type,b->inv->Armor[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::ARMOR),
+ get_item_subtype(item_type::ARMOR,ind));
+ }
+ }
+ if(!b->inv->Shoes.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Shoes:");
+ for(int ind = 0; ind < b->inv->Shoes.size(); ind++)
+ {
+ if(b->inv->Shoes[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Shoes[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Shoes[ind].matt.type,b->inv->Shoes[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::SHOES),
+ get_item_subtype(item_type::SHOES,ind));
+ }
+ }
+ if(!b->inv->Shield.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Shield:");
+ for(int ind = 0; ind < b->inv->Shield.size(); ind++)
+ {
+ if(b->inv->Shield[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Shield[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Shield[ind].matt.type,b->inv->Shield[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::SHIELD),
+ get_item_subtype(item_type::SHIELD,ind));
+ }
+ }
+ if(!b->inv->Helm.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Headwear:");
+ for(int ind = 0; ind < b->inv->Helm.size(); ind++)
+ {
+ if(b->inv->Helm[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Helm[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Helm[ind].matt.type,b->inv->Helm[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::HELM),
+ get_item_subtype(item_type::HELM,ind));
+ }
+ }
+ if(!b->inv->Gloves.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Gloves:");
+ for(int ind = 0; ind < b->inv->Gloves.size(); ind++)
+ {
+ if(b->inv->Gloves[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Gloves[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Gloves[ind].matt.type,b->inv->Gloves[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::GLOVES),
+ get_item_subtype(item_type::GLOVES,ind));
+ }
+ }
+ if(!b->inv->Pants.empty())
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Pants:");
+ for(int ind = 0; ind < b->inv->Pants.size(); ind++)
+ {
+ if(b->inv->Pants[ind].matt.type < 0)
+ continue;
+ const char* matName = lookupMaterialTypeName(b->inv->Pants[ind].matt.type);
+ const char* subMatName = lookupMaterialName(b->inv->Pants[ind].matt.type,b->inv->Pants[ind].matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ " %s%s%s - %s/%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ ENUM_KEY_STR(item_type, item_type::PANTS),
+ get_item_subtype(item_type::PANTS,ind));
+ }
+ }
}
+ if(1) //just so it has it's own scope
+ {
char strCreature[150] = {0};
generateCreatureDebugString( b->creature, strCreature );
//memset(strCreature, -1, 50);
- /*
- // FIXME:: getJob is no more.
+ /*
+ // FIXME:: getJob is no more.
try{
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "flag1: %s Sex: %d Mood: %d Job: %s", strCreature, b->creature->sex + 1, b->creature->mood, (b->creature->current_job.active?contentLoader->MemInfo->getJob(b->creature->current_job.jobType).c_str():""));
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "flag1: %s Sex: %d Mood: %d Job: %s", strCreature, b->creature->sex + 1, b->creature->mood, (b->creature->current_job.active?contentLoader->MemInfo->getJob(b->creature->current_job.jobType).c_str():""));
}
catch(exception &e)
{
- WriteErr("DFhack exeption: %s\n", e.what());
+ WriteErr("DFhack exeption: %s\n", e.what());
}
*/
- if((!config.skipCreatureTypes) && (!config.skipCreatureTypesEx) && (!config.skipDescriptorColors))
+
+ int yy = (i++*al_get_font_line_height(font));
+ int xx = 2;
+ for(unsigned int j = 0; j<b->creature->nbcolors ; j++)
{
- int yy = al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font));
- int xx = 2;
- for(unsigned int j = 0; j<b->creature->nbcolors ; j++)
+ if(contentLoader->Mats->raceEx.at(b->creature->race).castes.at(b->creature->caste).ColorModifier.at(j).colorlist.size() > b->creature->color[j])
{
- if(contentLoader->Mats->raceEx.at(b->creature->race).castes.at(b->creature->caste).ColorModifier.at(j).colorlist.size() > b->creature->color[j])
+ uint32_t cr_color = contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].colorlist[b->creature->color[j]];
+ if(cr_color < contentLoader->Mats->color.size())
{
- uint32_t cr_color = contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].colorlist[b->creature->color[j]];
- if(cr_color < contentLoader->Mats->color.size())
- {
- draw_textf_border(font,
- al_map_rgb_f(
- contentLoader->Mats->color[cr_color].red,
- contentLoader->Mats->color[cr_color].green,
- contentLoader->Mats->color[cr_color].blue), xx, yy, 0,
- "%s ", contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].part.c_str());
- xx += get_textf_width(font, "%s ", contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].part.c_str());
- }
+ draw_textf_border(font,
+ al_map_rgb_f(
+ contentLoader->Mats->color[cr_color].red,
+ contentLoader->Mats->color[cr_color].green,
+ contentLoader->Mats->color[cr_color].blue), xx, yy, 0,
+ "%s ", contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].part.c_str());
+ xx += get_textf_width(font, "%s ", contentLoader->Mats->raceEx[b->creature->race].castes[b->creature->caste].ColorModifier[j].part.c_str());
}
}
}
- }
- if(b->designation.bits.traffic)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Traffic: %d", b->designation.bits.traffic);
- }
- if(b->designation.bits.pile)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Stockpile?");
- }
- if(b->designation.bits.water_table)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,"Water table");
- }
- if(b->designation.bits.rained)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,"Rained");
- }
- if(b->building.info.type != BUILDINGTYPE_BLACKBOX)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Temp1: %dU, %.2f'C, %d'F", b->temp1, (float)(b->temp1-10000)*5.0f/9.0f, b->temp1-9968);
- }
- if(b->snowlevel || b->mudlevel || b->bloodlevel)
- {
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Snow: %d, Mud: %d, Blood: %d", b->snowlevel, b->mudlevel, b->bloodlevel);
- }
- //borders
- /*
- int dray = al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font));
- draw_textf_border(font, al_map_rgb(255,255,255), 16, dray, 0,
- "Open: %d, floor: %d, Wall: %d, Ramp: %d Light: %d", b->openborders, b->floorborders, b->wallborders, b->rampborders, b->lightborders);
- draw_borders(8, dray, b->lightborders);
- */
+ }
+ break;
+ default:
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Game Mode:%i, Control Mode:%i", contentLoader->gameMode.g_mode, contentLoader->gameMode.g_type);
+ if (tform != NULL)
+ {
+ const char* formName = lookupFormName(b->consForm);
+ const char* matName = lookupMaterialTypeName(b->material.type);
+ const char* subMatName = lookupMaterialName(b->material.type,b->material.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "%s %s:%i Material:%s%s%s (%d,%d)", formName, tform, ttype,
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"", b->material.type,b->material.index);
+ }
+ if (tform != NULL)
+ {
+ MaterialInfo mat;
+ mat.decode(b->material.type, b->material.index);
+ ALLEGRO_COLOR color = al_map_rgb_f(contentLoader->Mats->color[mat.material->state_color[0]].red, contentLoader->Mats->color[mat.material->state_color[0]].green, contentLoader->Mats->color[mat.material->state_color[0]].blue);
+ draw_textf_border(font, color, 2, (i++*al_get_font_line_height(font)), 0,
+ "%s", mat.material->state_name[0].c_str());
+ } //if (tform != NULL)
+ //{
+ // draw_textf_border(font, 2, (i++*al_get_font_line_height(font)), 0,
+ // "MaterialType: %d, MaterialIndex: %d", b->material.type, b->material.index);
+ //}
+ if (tform != NULL)
+ {
+ const char* matName = lookupMaterialTypeName(b->layerMaterial.type);
+ const char* subMatName = lookupMaterialName(b->layerMaterial.type,b->layerMaterial.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Layer Material:%s%s%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if ((tform != NULL) && b->hasVein == 1)
+ {
+ const char* matName = lookupMaterialTypeName(b->veinMaterial.type);
+ const char* subMatName = lookupMaterialName(b->veinMaterial.type,b->veinMaterial.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Vein Material:%s%s%s",
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if (tform != NULL)//(b->grasslevel > 0)
+ {
+ const char* subMatName = lookupMaterialName(WOOD,b->grassmat);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Grass length:%d, Material: %s",
+ b->grasslevel, subMatName?subMatName:"");
+ }
+ //for(int j = 0; j < b->grasslevels.size(); j++)
+ //{
+ // const char* subMatName = lookupMaterialName(WOOD,b->grassmats.at(j));
+ // draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ // "Grass length:%d, Material: %s",
+ // b->grasslevels.at(j), subMatName?subMatName:"");
+ //}
+
+ if(b->water.index > 0 || b->tree.index != 0)
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "tree:%i water:%i,%i", b->tree.index, b->water.type, b->water.index);
+ if(b->tree.index != 0)
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "tree name:%s type:%i", lookupTreeName(b->tree.index), b->tree.type);
+ if(b->building.sprites.size() != 0)
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "%i extra sprites.", b->building.sprites.size());
+
+ // FIXME: classidstrings is no more
+ //building
+ if(b->building.info.type != BUILDINGTYPE_NA && b->building.info.type != BUILDINGTYPE_BLACKBOX && b->building.info.type != BUILDINGTYPE_TREE){
+ const char* matName = lookupMaterialTypeName(b->building.info.material.type);
+ const char* subMatName = lookupMaterialName(b->building.info.material.type,b->building.info.material.index);
+ const char* subTypeName = lookupBuildingSubtype(b->building.info.type, b->building.info.subtype);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Building: game_type = %s(%i) game_subtype = %s(%i) Material: %s%s%s (%d,%d)",
+ ENUM_KEY_STR(building_type, (building_type::building_type)b->building.info.type),
+ b->building.info.type,
+ subTypeName,
+ b->building.info.subtype,
+ matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ b->building.info.material.type,b->building.info.material.index);
+
+ //if(b->building.custom_building_type != -1)
+ //{
+ // draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ // "Custom workshop type %s (%d)", contentLoader->custom_workshop_types[b->building.custom_building_type].c_str(),b->building.custom_building_type);
+ //}
+ }
- if(b->Eff_Miasma.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Miasma.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Miasma.matt.type,b->Eff_Miasma.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Miasma: %d, Material:%s%s%s",
- b->Eff_Miasma.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Steam.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Steam.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Steam.matt.type,b->Eff_Steam.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Steam: %d, Material:%s%s%s",
- b->Eff_Steam.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Mist.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Mist.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Mist.matt.type,b->Eff_Mist.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Mist: %d, Material:%s%s%s",
- b->Eff_Mist.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_MaterialDust.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_MaterialDust.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_MaterialDust.matt.type,b->Eff_MaterialDust.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "MaterialDust: %d, Material:%s%s%s",
- b->Eff_MaterialDust.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_MagmaMist.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_MagmaMist.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_MagmaMist.matt.type,b->Eff_MagmaMist.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "MagmaMist: %d, Material:%s%s%s",
- b->Eff_MagmaMist.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Smoke.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Smoke.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Smoke.matt.type,b->Eff_Smoke.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Smoke: %d, Material:%s%s%s",
- b->Eff_Smoke.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Dragonfire.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Dragonfire.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Dragonfire.matt.type,b->Eff_Dragonfire.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Dragonfire: %d, Material:%s%s%s",
- b->Eff_Dragonfire.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Fire.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Fire.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Fire.matt.type,b->Eff_Fire.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Fire: %d, Material:%s%s%s",
- b->Eff_Fire.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_Web.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_Web.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_Web.matt.type,b->Eff_Web.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "Web: %d, Material:%s%s%s",
- b->Eff_Web.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_MaterialGas.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_MaterialGas.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_MaterialGas.matt.type,b->Eff_MaterialGas.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "MaterialGas: %d, Material:%s%s%s",
- b->Eff_MaterialGas.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_MaterialVapor.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_MaterialVapor.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_MaterialVapor.matt.type,b->Eff_MaterialVapor.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "MaterialVapor: %d, Material:%s%s%s",
- b->Eff_MaterialVapor.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_OceanWave.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_OceanWave.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_OceanWave.matt.type,b->Eff_OceanWave.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "OceanWave: %d, Material:%s%s%s",
- b->Eff_OceanWave.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
- }
- if(b->Eff_SeaFoam.density > 0)
- {
- const char* matName = lookupMaterialTypeName(b->Eff_SeaFoam.matt.type);
- const char* subMatName = lookupMaterialName(b->Eff_SeaFoam.matt.type,b->Eff_SeaFoam.matt.index);
- draw_textf_border(font, al_map_rgb(255,255,255), 2, al_get_bitmap_height(al_get_target_bitmap())-20-(i--*al_get_font_line_height(font)), 0,
- "SeaFoam: %d, Material:%s%s%s",
- b->Eff_SeaFoam.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ if(b->designation.bits.traffic)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Traffic: %d", b->designation.bits.traffic);
+ }
+ if(b->designation.bits.pile)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Stockpile?");
+ }
+ if(b->designation.bits.water_table)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,"Water table");
+ }
+ if(b->designation.bits.rained)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,"Rained");
+ }
+ if(b->building.info.type != BUILDINGTYPE_BLACKBOX)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Temp1: %dU, %.2f'C, %d'F", b->temp1, (float)(b->temp1-10000)*5.0f/9.0f, b->temp1-9968);
+ }
+ if(b->snowlevel || b->mudlevel || b->bloodlevel)
+ {
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Snow: %d, Mud: %d, Blood: %d", b->snowlevel, b->mudlevel, b->bloodlevel);
+ }
+ //borders
+ /*
+ int dray = (i++*al_get_font_line_height(font));
+ draw_textf_border(font, al_map_rgb(255,255,255), 16, dray, 0,
+ "Open: %d, floor: %d, Wall: %d, Ramp: %d Light: %d", b->openborders, b->floorborders, b->wallborders, b->rampborders, b->lightborders);
+ draw_borders(8, dray, b->lightborders);
+ */
+
+ if(b->Eff_Miasma.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Miasma.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Miasma.matt.type,b->Eff_Miasma.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Miasma: %d, Material:%s%s%s",
+ b->Eff_Miasma.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Steam.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Steam.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Steam.matt.type,b->Eff_Steam.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Steam: %d, Material:%s%s%s",
+ b->Eff_Steam.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Mist.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Mist.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Mist.matt.type,b->Eff_Mist.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Mist: %d, Material:%s%s%s",
+ b->Eff_Mist.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_MaterialDust.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_MaterialDust.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_MaterialDust.matt.type,b->Eff_MaterialDust.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "MaterialDust: %d, Material:%s%s%s",
+ b->Eff_MaterialDust.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_MagmaMist.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_MagmaMist.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_MagmaMist.matt.type,b->Eff_MagmaMist.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "MagmaMist: %d, Material:%s%s%s",
+ b->Eff_MagmaMist.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Smoke.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Smoke.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Smoke.matt.type,b->Eff_Smoke.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Smoke: %d, Material:%s%s%s",
+ b->Eff_Smoke.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Dragonfire.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Dragonfire.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Dragonfire.matt.type,b->Eff_Dragonfire.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Dragonfire: %d, Material:%s%s%s",
+ b->Eff_Dragonfire.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Fire.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Fire.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Fire.matt.type,b->Eff_Fire.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Fire: %d, Material:%s%s%s",
+ b->Eff_Fire.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_Web.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_Web.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_Web.matt.type,b->Eff_Web.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "Web: %d, Material:%s%s%s",
+ b->Eff_Web.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_MaterialGas.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_MaterialGas.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_MaterialGas.matt.type,b->Eff_MaterialGas.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "MaterialGas: %d, Material:%s%s%s",
+ b->Eff_MaterialGas.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_MaterialVapor.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_MaterialVapor.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_MaterialVapor.matt.type,b->Eff_MaterialVapor.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "MaterialVapor: %d, Material:%s%s%s",
+ b->Eff_MaterialVapor.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_OceanWave.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_OceanWave.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_OceanWave.matt.type,b->Eff_OceanWave.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "OceanWave: %d, Material:%s%s%s",
+ b->Eff_OceanWave.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ if(b->Eff_SeaFoam.density > 0)
+ {
+ const char* matName = lookupMaterialTypeName(b->Eff_SeaFoam.matt.type);
+ const char* subMatName = lookupMaterialName(b->Eff_SeaFoam.matt.type,b->Eff_SeaFoam.matt.index);
+ draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
+ "SeaFoam: %d, Material:%s%s%s",
+ b->Eff_SeaFoam.density, matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"");
+ }
+ break;
}
//basecon
@@ -799,7 +989,7 @@ void DrawSpriteIndexOverlay(int imageIndex){ }
-void DoSpriteIndexOverlay()
+void DoSpriteIndexOverlay(DFHack::Core * c)
{
DrawSpriteIndexOverlay(-1);
int index = 0;
@@ -828,10 +1018,10 @@ void DoSpriteIndexOverlay() }
//redraw screen again
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- paintboard();
+ paintboard(c);
}
-void paintboard()
+void paintboard(DFHack::Core * c)
{
uint32_t starttime = clock();
@@ -891,7 +1081,7 @@ void paintboard() draw_textf_border(font, al_map_rgb(255,255,255), 10, 6*al_get_font_line_height(font), 0, "D1: %i", blockFactory.getPoolSize());
draw_textf_border(font, al_map_rgb(255,255,255), 10, 7*al_get_font_line_height(font), 0, "%i/%i/%i, %i:%i", contentLoader->currentDay+1, contentLoader->currentMonth+1, contentLoader->currentYear, contentLoader->currentHour, (contentLoader->currentTickRel*60)/50);
draw_textf_border(font, al_map_rgb(255,255,255), 10, 8*al_get_font_line_height(font), 0, "%i Sprites drawn, %i tiles drawn, %.1f sprites per tile.", config.drawcount, config.tilecount, ((float)config.drawcount/(float)config.tilecount));
- drawDebugCursorAndInfo(segment);
+ drawDebugCursorAndInfo(segment, c);
}
config.drawcount = 0;
config.tilecount = 0;
@@ -1149,9 +1339,9 @@ int loadImgFile(ALLEGRO_PATH* filepath) return loadImgFile(al_path_cstr(filepath, ALLEGRO_NATIVE_PATH_SEP));
}
*/
-void saveScreenshot(){
+void saveScreenshot(DFHack::Core * c){
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- paintboard();
+ paintboard(c);
//get filename
char filename[20] ={0};
FILE* fp;
@@ -1174,7 +1364,7 @@ void saveScreenshot(){ al_set_target_bitmap(temp);
if(!config.transparentScreenshots)
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- paintboard();
+ paintboard(c);
al_save_bitmap(filename, temp);
al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
al_destroy_bitmap(temp);
@@ -8,7 +8,7 @@ Crd2D WorldBlockToScreen(int32_t x, int32_t y, int32_t z); Crd2D LocalBlockToScreen(int32_t x, int32_t y, int32_t z);
void DrawCurrentLevelOutline(bool backPart);
void DrawMinimap(WorldSegment *);
-void paintboard();
+void paintboard(DFHack::Core * c);
void draw_textf_border(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, const char *format, ...);
void draw_text_border(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, const char *ustr);
void draw_ustr_border(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, const ALLEGRO_USTR *ustr);
@@ -21,9 +21,9 @@ void DrawSpriteFromSheet( int spriteNum,ALLEGRO_BITMAP* spriteSheet, ALLEGRO_COL ALLEGRO_BITMAP * CreateSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet);
ALLEGRO_BITMAP* load_bitmap_withWarning(const char* path);
void DrawSpriteIndexOverlay(int i);
-void DoSpriteIndexOverlay();
+void DoSpriteIndexOverlay(DFHack::Core * c);
void loadGraphicsFromDisk();
-void saveScreenshot();
+void saveScreenshot(DFHack::Core * c);
void saveMegashot(bool tall);
void dumpSegment();
void saveImage(ALLEGRO_BITMAP* image);
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp index 464e2f1..2e3c749 100644 --- a/SpriteObjects.cpp +++ b/SpriteObjects.cpp @@ -961,36 +961,6 @@ ALLEGRO_COLOR c_sprite::get_color(void* block) else return al_map_rgb(255,255,255);
case ShadeBlood:
return b->bloodcolor;
- case ShadeWeapon:
- if(b->Weapon.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Weapon.matt.type, b->Weapon.matt.index);
- case ShadeArmor:
- if(b->Armor.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Armor.matt.type, b->Armor.matt.index);
- case ShadeShoes:
- if(b->Shoes.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Shoes.matt.type, b->Shoes.matt.index);
- case ShadeShield:
- if(b->Shield.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Shield.matt.type, b->Shield.matt.index);
- case ShadeHelm:
- if(b->Helm.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Helm.matt.type, b->Helm.matt.index);
- case ShadeGloves:
- if(b->Gloves.matt.type < 0)
- return al_map_rgba(0,0,0,0);
- else
- return lookupMaterialColor(b->Gloves.matt.type, b->Gloves.matt.index);
default:
return al_map_rgb(255, 255, 255);
} ;
diff --git a/UserInput.cpp b/UserInput.cpp index 45a83c6..4f7d190 100644 --- a/UserInput.cpp +++ b/UserInput.cpp @@ -198,7 +198,7 @@ void doKeys(){ }
}
-void doKeys(int Key)
+void doKeys(int Key, DFHack::Core * c)
{
al_get_keyboard_state(&keyboard);
if(Key == ALLEGRO_KEY_ENTER){
@@ -210,7 +210,7 @@ void doKeys(int Key) timeToReloadSegment = true;
}
if(Key == ALLEGRO_KEY_D){
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_G){
//contentLoader.reload_configs();
@@ -291,11 +291,11 @@ void doKeys(int Key) else if (al_key_down(&keyboard,ALLEGRO_KEY_ALT) || al_key_down(&keyboard,ALLEGRO_KEY_ALTGR))
dumpSegment();
else
- saveScreenshot();
+ saveScreenshot(c);
}
if(Key == ALLEGRO_KEY_PAD_PLUS){
config.automatic_reload_time += config.automatic_reload_step;
- paintboard();
+ paintboard(c);
initAutoReload();
}
if(Key == ALLEGRO_KEY_PAD_MINUS && config.automatic_reload_time){
@@ -309,7 +309,7 @@ void doKeys(int Key) }
else
initAutoReload();
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_F9)
{
@@ -321,22 +321,22 @@ void doKeys(int Key) if(Key == ALLEGRO_KEY_PAD_8){
config.follow_DFcursor = false;
debugCursor.y--;
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_PAD_2){
config.follow_DFcursor = false;
debugCursor.y++;
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_PAD_4){
config.follow_DFcursor = false;
debugCursor.x--;
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_PAD_6){
config.follow_DFcursor = false;
debugCursor.x++;
- paintboard();
+ paintboard(c);
}
if(Key == ALLEGRO_KEY_F10)
diff --git a/VegetationConfiguration.cpp b/VegetationConfiguration.cpp index 3abff89..c48f7bc 100644 --- a/VegetationConfiguration.cpp +++ b/VegetationConfiguration.cpp @@ -24,7 +24,6 @@ VegetationConfiguration::~VegetationConfiguration(void) bool addSingleVegetationConfig( TiXmlElement* elemRoot, vector<VegetationConfiguration>* vegetationConfigs, vector<t_matgloss>& plantNames )
{
- const char* sheetIndexStr;
int basefile = -1;
const char* filename = elemRoot->Attribute("file");
@@ -196,7 +196,7 @@ void correctBlockForRotation(int32_t& x, int32_t& y, int32_t& z, unsigned char r //from UserInput.cpp
void doKeys();
-void doKeys(int key);
+void doKeys(int key, DFHack::Core * c);
void initAutoReload();
void abortAutoReload();
@@ -250,14 +250,14 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL else if( timeToReloadSegment ){
reloadDisplayedSegment(core);
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- paintboard();
+ paintboard(core);
timeToReloadSegment = false;
animationFrameShown = true;
}
else if (animationFrameShown == false)
{
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- paintboard();
+ paintboard(core);
animationFrameShown = true;
}
doKeys();
@@ -310,7 +310,7 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL }
else
{
- doKeys(event.keyboard.keycode);
+ doKeys(event.keyboard.keycode, core);
redraw = true;
}
break;
|
