Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - devek

Pages: 1 ... 38 39 [40] 41 42 ... 51
586
DF Modding / Re: DFHack 0.4.0.7b - tools and memory access library
« on: August 28, 2010, 09:53:29 pm »
How hard would it be to get something better from item dump than "COPPER weapon" ?
In my books, the item dump doesn't work at all. The whole Items module is something that either needs a lot of work poured into it (documenting what's going on at least) or replacing with the old one, which could do almost the same with a lot less complexity. The old module determined item types by looking at the item's vtable pointer alone.

I'm not really certain it is dfhack that is broken, dwarf fortress is.. Toady's use of polymorphism is a sham. It is basically a bunch of objects put into an array that get dealt with by hand. When it looks at an item like a steel mace, it has to go through elaborate nested switch statements to figure out what the item is. The same applies to materials...

edit2: !#$#@, why do material names have to be at different offsets?!?!?!
* peterix doesn't understand.

Whoever wrote the materials module ran into the same problem...

If you look at the t_matgloss structure.. the char name[128] member isn't used! He started to read the data, but commented the code out. That is because the offset required based off the material also requires nested switch statements AND THEN you then a series of if/then statements. It isn't just the items module that needs to be fixed.

I'm divided between actually untangling the mess or rewriting my program to run inside of dwarf fortress and calling its own functions to get this information.

Look at this shit


That is the graph of code DF uses to figure out what an item is. That is more branches than all of dfhack put together, and it doesn't include the myriad of functions called from within that function..  it is just one function.

DF is chock full of this crap and I run into it wherever I go. I have no choice but to push ahead. Despite the fact this isn't my first rodeo, this is turning into the single most complicated piece of code I have untangled in my entire life.

587
DF Modding / Re: DFHack 0.4.0.7b - tools and memory access library
« on: August 28, 2010, 07:33:06 am »
How hard would it be to get something better from item dump than "COPPER weapon" ?

sigh,

OK, if you're using IDA the function that turns an item into a textual description is sub_CD7420.

it switches on the type multiple times...

so a weapon which is type 24 calls sub_B37750, which looks up the weapon name from unk_1d5a27c.
.....
edit: it looks kind of like..
Code: [Select]
    string item = "[";

    switch(dfitem.matdesc.itemType)
    {
        case 24: // weapon
        {
            string material = Materials->getDescription(dfitem.matdesc);
            transform(material.begin(), material.end(), material.begin(), ::tolower);
            item.append(material);
            item.append(" ");
        }
            break;
        default:
            item.append("unknown item]");
            return item;
    }

    switch(dfitem.matdesc.itemType)
    {
    case 24: //weapon
        {
            uint32_t a = p->readDWord(dfbase+0x12DA27C + 0x24);
            uint32_t b = p->readDWord(a + (dfitem.matdesc.subType * 4));
            item.append(p->readCString(b+0x28));
        }
        break;
    default:
        item.append("unknown item]");
        return item;

    }

    item.append("]");

which looks kind of ugly, but that is how toady has to do it :(
....
edit2: !#$#@, why do material names have to be at different offsets?!?!?!
....
Now, the only tool that will really benefit from getting exact textual representation of items is Dwarf Foreman. So I guess it is up to me to write it :/ It will be super annoying to do, so I hope you have a better idea peter :P It would require dfhack tracking lots of new offsets, but they will all be super easy to automate the finding of.

Thoughts?

588
DF Dwarf Mode Discussion / Re: Spears: two handed or one?
« on: August 28, 2010, 05:42:25 am »
If we wanted realistic, we would go outside.

589
A quick trip to the moathouse should weed someone out.

591
DF Gameplay Questions / Re: Stone or blocks?
« on: August 28, 2010, 12:39:32 am »
It is best to use blocks when constructing workshops so that you can forbid stones later without forbidding the workshop.

592
DF Adventure Mode Discussion / Re: Raw worshipping priest.
« on: August 27, 2010, 04:45:37 am »
aHR0cDovL29iamVjdGlvbi5tcmRpY3Rpb25hcnkubmV0L2dvLnBocD9uPTQyNDcyNjg=

593
Well, no D&D is brutal if you tweak and cheap your way through which ends up not being fun.

D&D is a game you have to "roleplay", not "rollplay".



594
I still have the cd for this somewhere.

Best game ever.

595
DF Gameplay Questions / Re: Stonemason with specific material
« on: August 27, 2010, 01:05:42 am »
First thing I do, is never build a workshop out of a material.. blocks only.

When I want to make something specific, I go into the stocks screen and forbid all the materials I don't want them to use.

596
DF Dwarf Mode Discussion / Re: "The Blender"
« on: August 27, 2010, 01:04:29 am »
I'm trying to design a repeatable cavein trap using magma+water to build the obsidian roof to cave in.


597
DF Modding / Re: DFHack 0.4.0.7b - tools and memory access library
« on: August 27, 2010, 12:31:32 am »
How hard would it be to get something better from item dump than "COPPER weapon" ?

598
It may not be that hard, sometimes we get stuck on something stupid and a fresh set of eyes is all it takes.

599
Ok, i'm a little bit stuck on figuring out how it DF lists all the possible manager jobs.

I can list the custom reactions just fine... but the hard coded ones are eluding me.

Any hackers out there bored and wanna take a shot at it?


600
General Discussion / Re: Acronyms and a/an
« on: August 22, 2010, 11:32:00 am »
A ATM Machine?  8)

Pages: 1 ... 38 39 [40] 41 42 ... 51