Spatter veins in veinlook

develop
Petr Mrázek 2010-04-08 11:18:31 +02:00
parent 9180b77b89
commit 1476390f14
3 changed files with 116 additions and 80 deletions

@ -10,6 +10,8 @@
#include <cstdio>
using namespace std;
#include <DFVector.h>
void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
{
cout << "----==== " << name << " ====----" << endl;
@ -134,4 +136,84 @@ void print_bits ( T val, std::ostream& out )
}
}
// this is probably completely bogus
std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matgloss> &creature_types)
{
std::string ret;
switch (mat1)
{
case 0:
return "Rock";
break;
case 1:
return "Amber";
break;
case 2:
return "Coral";
break;
case 3:
return "Green Glass";
break;
case 4:
return "Clear Glass";
break;
case 5:
return "Crystal Glass";
break;
case 6:
return "Ice";
break;
case 7:
return "Coal";
break;
case 8:
return "Potash";
break;
case 9:
return "Ash";
break;
case 10:
return "Pearlash";
break;
case 11:
return "Lye";
break;
case 12:
return "Mud";
break;
case 13:
return "Vomit";
break;
case 14:
return "Salt";
break;
case 15:
return "Filth";
break;
case 16:
return "Frozen? Filth";
break;
case 18:
return "Grime";
break;
case 0xF2:
return "Very Specific Blood (references a named creature)";
break;
case 0x2A:
case 0x2B:
if(mat2 != -1)
{
ret += creature_types[mat2].id;
ret += " ";
}
ret += "Blood";
return ret;
break;
default:
return "Unknown";
break;
}
}
#endif

@ -24,81 +24,6 @@ using namespace std;
using namespace DFHack;
void PrintSplatterType (int16_t mat1, int32_t mat2, vector<t_matgloss> creature_types)
{
switch (mat1)
{
case 0:
cout <<"Rock";
break;
case 1:
cout <<"Amber";
break;
case 2:
cout <<"Coral";
break;
case 3:
cout <<"Green Glass";
break;
case 4:
cout <<"Clear Glass";
break;
case 5:
cout <<"Crystal Glass";
break;
case 6:
cout <<"Ice";
break;
case 7:
cout <<"Coal";
break;
case 8:
cout <<"Potash";
break;
case 9:
cout <<"Ash";
break;
case 10:
cout <<"Pearlash";
break;
case 11:
cout <<"Lye";
break;
case 12:
cout <<"Mud";
break;
case 13:
cout <<"Vomit";
break;
case 14:
cout <<"Salt";
break;
case 15:
cout <<"Filth";
break;
case 16:
cout <<"Frozen? Filth";
break;
case 18:
cout <<"Grime";
break;
case 0xF2:
cout << "Very Specific Blood (references a named creature)";
break;
case 0x2A:
case 0x2B:
if(mat2 != -1)
{
cout << creature_types[mat2].id << " ";
}
cout<<"Blood";
break;
default:
cout <<"Unknown";
break;
}
}
char shades[10] = {'#','$','O','=','+','|','-','^','.',' '};
int main (int numargs, const char ** args)
{
@ -158,8 +83,7 @@ int main (int numargs, const char ** args)
for(int i = 0; i < splatter.size(); i++)
{
printf("Splatter %d\nmat1: %d\nunknown: %d\nmat2: %d\nmat3: %d\n",i,splatter[i].mat1,splatter[i].unk1,splatter[i].mat2,splatter[i].mat3);
PrintSplatterType(splatter[i].mat1,splatter[i].mat2,creature_types);
cout << endl;
cout << PrintSplatterType(splatter[i].mat1,splatter[i].mat2,creature_types) << endl;
printf("Address 0x%08x\n",splatter[i].address_of);
for(uint32_t yyy = 0; yyy < 16; yyy++)
{

@ -21,6 +21,7 @@ using namespace std;
#include <DFMemInfo.h>
#include <modules/Maps.h>
#include <modules/Materials.h>
#include "miscutils.h"
using namespace DFHack;
@ -307,6 +308,7 @@ main(int argc, char *argv[])
materials.clear();
mapblock40d blocks[3][3];
vector<DFHack::t_matgloss> stonetypes;
vector<DFHack::t_matgloss> creature_types;
vector<DFHack::t_effect_df40d> effects;
vector< vector <uint16_t> > layerassign;
vector<t_vein> veinVector;
@ -355,6 +357,13 @@ main(int argc, char *argv[])
pDF = 0;
finish(0);
}
if(!Mats->ReadCreatureTypes(creature_types))
{
error = "Can't read stone types.";
pDF = 0;
finish(0);
}
/*
// get region geology
if(!DF.ReadGeology( layerassign ))
@ -558,11 +567,12 @@ main(int argc, char *argv[])
gotoxy(0,50);
uint32_t mineralsize = veinVector.size();
uint32_t icesize = IceVeinVector.size();
uint32_t totalVeinSize = mineralsize+ icesize;
uint32_t splattersize = splatter.size();
uint32_t totalVeinSize = mineralsize+ icesize + splattersize;
if(vein == totalVeinSize) vein = totalVeinSize - 1;
if(vein < -1) vein = -1;
cprintf("X %d/%d, Y %d/%d, Z %d/%d. Vein %d of %d",cursorX+1,x_max,cursorY+1,y_max,cursorZ,z_max,vein+1,totalVeinSize);
if(!veinVector.empty() || !IceVeinVector.empty())
if(!veinVector.empty() || !IceVeinVector.empty() || !splatter.empty())
{
if(vein != -1 && vein < totalVeinSize)
{
@ -595,7 +605,7 @@ main(int argc, char *argv[])
gotoxy(0,51);
cprintf("Mineral: %s",stonetypes[veinVector[vein].type].id);
}
else
else if (vein < mineralsize + icesize)
{
realvein = vein - mineralsize;
t_frozenliquidvein &frozen = IceVeinVector[realvein];
@ -615,6 +625,26 @@ main(int argc, char *argv[])
gotoxy(0,51);
cprintf("ICE");
}
else
{
realvein = vein - mineralsize - icesize;
t_spattervein &bloodmud = splatter[realvein];
for(uint32_t yyy = 0; yyy < 16; yyy++)
{
for(uint32_t xxx = 0; xxx < 16; xxx++)
{
uint8_t intensity = splatter[realvein].intensity[xxx][yyy];
if(intensity)
{
attron(A_STANDOUT);
putch(xxx+16,yyy+16,'*', COLOR_RED);
attroff(A_STANDOUT);
}
}
}
gotoxy(0,51);
cprintf("Spatter: %s",PrintSplatterType(splatter[realvein].mat1,splatter[realvein].mat2,creature_types).c_str());
}
}
}
gotoxy (0,52);