Git Product home page Git Product logo

decdat's Introduction

DecDat

Originally built by Gottfried: original release post

While working on Phoenix I had to decompile compiled scripts from an older demo so it could be passed on to people doing alpha version research. To do this, I changed the source code of DecDat to work on the old .DAT file format.

When I was at it I fixed the string substitution feature and int to instance substitution.

String substitution

The decompiled code now shows the string literals instead of the const string of the string literal.

Before

description = ˙10722;

Now

description = "ENDE";

Instance substitution

Due to the way how Daedalus treats instances (they are basically symbol table indicies) the integers get decompiled back and the instance information is lost.

As a quick fix I introduced instance substitution, every integer higher than 60 is checked whether it is also an instance and then the substitution occurs. This is not a bullet proof solution, so the original integer is placed as a comment right after the substituted instance identifier.

Before

if(npc_knowsinfo(hero, 12408)) {
    return true;
};

After

if(npc_knowsinfo(hero, info_xardasdemon_intro /*12408*/)) {
    return true;
};

decdat's People

Contributors

auronen avatar fyryny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fyryny gelaos

decdat's Issues

Fix encoding

Set default encoding to windows-1252

All proposed encodings:

  • windows-1252 (German, English)
  • windows-1251 (Russian, Ukrainian)
  • windows-1250 (Czech, Polish)

Add settings for encoding.

Wrong decompilation of nested `if` in `else` blocks

This original function

func void B_SetNpcVisual (var C_NPC slf, var int gender, var string headMesh, var int faceTex, var int bodyTex, var int armorInstance)
{
	slf.aivar[AIV_Gender] = gender;

	Mdl_SetVisual (slf,"HUMANS.MDS");

	if (gender == MALE)
	{
               Mdl_SetVisualBody (slf,	"hum_body_Naked0", 	bodyTex,	0,			headMesh, 	faceTex,	0, 			armorInstance);
		
		if (slf.attribute[ATR_STRENGTH] < 50)
		{
			Mdl_SetModelScale		(slf, 0.9, 1, 1); 			//BREITE / Höhe / Tiefe
		};

		if (slf.attribute[ATR_STRENGTH] > 100)
		{
			Mdl_SetModelScale		(slf, 1.1, 1, 1);			//BREITE / Höhe / Tiefe
		};
	}
	else //gender == FEMALE
	{
		if (bodyTex >= 0) && (bodyTex <= 3) //MännerBodyTex angegeben
		{
			bodyTex = bodyTex + 4; // Females haben Variation 4-7 (Males 0-3)
		};
		Mdl_SetVisualBody (slf,	"Hum_Body_Babe0", 	bodyTex,	0,			headMesh, 	faceTex,  	0,			armorInstance);
	};
};

gets decomiled to this

func void b_setnpcvisual(var c_npc slf, var int gender, var string headmesh, var int facetex, var int bodytex, var int armorinstance) {
    slf.aivar[17] = gender;
    mdl_setvisual(slf, "HUMANS.MDS");
    if(gender == male) {
        mdl_setvisualbody(slf, "hum_body_Naked0", bodytex, 0, headmesh, facetex, 0, armorinstance);
        if(slf.attribute[4] < 50) {
            mdl_setmodelscale(slf, 0.9, 1.0, 1.0);
        };
        if(slf.attribute[4] > 100) {
            mdl_setmodelscale(slf, 1.1, 1.0, 1.0);
        };
    }
    else if((bodytex >= 0) && (bodytex <= 3)) {
            bodytex = bodytex + 4;
     };
     mdl_setvisualbody(slf, "Hum_Body_Babe0", bodytex, 0, headmesh, facetex, 0, armorinstance);
 
};

Add class filter

Add a button to show all class definitions and buttons to show instances of selected class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.