Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprite number replace with .tga files in pak2.pak #9

Open
Oesermaatra0069 opened this issue Sep 27, 2014 · 2 comments
Open

sprite number replace with .tga files in pak2.pak #9

Oesermaatra0069 opened this issue Sep 27, 2014 · 2 comments
Labels

Comments

@Oesermaatra0069
Copy link

When I was working on my mod of Wolfenstein3d. I want to change the sprite number 50 (or guard 1 to your sight) with sprt0050.tga in the Basewgl\pak2.pak. So it's quite logical that spritenr 50 I will replace with sprt0050.tga. But it doesn't work. When you want to replace spritenr 50 with a .tga file you 'lll yave to rename it sprt0054.tga. That's quite odd. Is this a bug?

@dcoshea
Copy link
Owner

dcoshea commented Nov 10, 2014

Sorry, I missed this request. I will try to get back to you soon.

@dcoshea
Copy link
Owner

dcoshea commented Nov 11, 2014

I think that the original game executables for the demo, registered version, Spear of Destiny, etc. all had their own identifiers for textures and sprites (and possibly other resources), so that 50 might be a different thing in the demo vs. SoD. I assume that these game executables were all compiled from the same source but with #ifdefs, so that at compile time it would select which texture/sprite/etc. number was used for what purpose.

NewWolf[Lives] has just one executable that can be used for all of these different games, so it has its own set of numbers for these resources which covers all of those games. I think it then maps those numbers to the original numbers if it's reading the original game resources, but probably uses the NewWolf numbering if it's reading from a .pak file.

I guess that for sprites, sprt_def.h contains an enumeration of all of the sprite numbers. If you're not familiar with C, the enumeration contains a comma-separated list of member names, where the first member will be assigned number 0, the second 1, etc., so given this snippet of that file:

enum
{
    SPR_DEMO,
    SPR_DEATHCAM,
//
// static sprites
//
    SPR_STAT_0,SPR_STAT_1,SPR_STAT_2,SPR_STAT_3,

SPR_STAT_0 = 2.

Further down the file, we see:

//#ifdef SPEAR
    SPR_STAT_48,SPR_STAT_49,SPR_STAT_50,SPR_STAT_51,
//#endif

//
// guard
//
    SPR_GRD_S_1,SPR_GRD_S_2,SPR_GRD_S_3,SPR_GRD_S_4,

It looks like this might be taken from the original iD source code, but the #ifdef is commented out so that those identifiers are always included in the enumeration when building NewWolf[Lives] rather than only being included when building a SoD executable. Note that there are 4 SoD-specific sprites before "GRD" which I assume is the guard, and I'm pretty sure SPR_GRD_S_1 = 54, which matches what you found above.

version.c seems to have the tables that map from those enumeration members to the sprite numbers found in the original game files. "spr_wolf" seems to be the mapping table for sprites for Wolfenstein 3-D, as opposed to the SoD table after it:

static int spr_wolf[]=
{// wl1, wl6
    0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
    31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,

// Spear only
    0,0,0,0,

    50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,

My reading of this is that entries 0-49 map exactly to the original game files for Wolf3D, then there are 4 entries that don't map at all because they are SoD sprites, and then 54 (SPR_GRD_S_1) maps to number 50 in the original game files.

I haven't looked yet to see if there is any documentation you can use to work out which numbers to use in the file names or if you have to look at this code (which isn't all that easy to interpret, who wants to count those numbers?).

Let me know if you're still interested in modding NewWolf[Lives] and I can try and generate a more readable table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants