- added support for Megaton's widescreen assets.

Fixes #386
This commit is contained in:
Christoph Oelckers 2020-09-10 00:05:10 +02:00
parent 0c55c61b17
commit 83eba019b8
6 changed files with 62 additions and 11 deletions

View file

@ -301,9 +301,9 @@ public:
}
};
void loadscreen(MapRecord* rec, CompletionFunc func)
void loadscreen(const char *caption, MapRecord* rec, CompletionFunc func)
{
JobDesc job = { Create<DBloodLoadScreen>(rec) };
JobDesc job = { Create<DBloodLoadScreen>(caption, rec) };
RunScreenJob(&job, 1, func);
}

View file

@ -787,7 +787,7 @@ static int32_t defsparser(scriptfile *script)
int32_t const orig_crc32 = tileGetCRC32(tile);
if (orig_crc32 != tile_crc32)
{
// Printf("CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d\n", tile, orig_crc32, tile_crc32);
Printf("CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d\n", tile, orig_crc32, tile_crc32);
break;
}
}

View file

@ -136,7 +136,7 @@ int scriptfile_getsymbol(scriptfile *sf, int32_t *num)
if (!t) return -1;
char * e;
int32_t v = strtol(t, &e, 10);
int32_t v = (int)strtoll(t, &e, 10); // beware of overflows! strtol can have quite unexpected behavior!.
if (*e)
{

View file

@ -44,6 +44,7 @@
#include "gamecontrol.h"
#include "palettecontainer.h"
#include "texturemanager.h"
#include "c_dispatch.h"
enum
{
@ -586,6 +587,14 @@ int32_t tileGetCRC32(int tileNum)
return crc;
}
CCMD(tilecrc)
{
if (argv.argc() > 1)
{
int tile = atoi(argv[1]);
Printf("%d\n", tileGetCRC32(tile));
}
}
//==========================================================================
//
@ -605,13 +614,9 @@ int tileImportFromTexture(const char* fn, int tilenum, int alphacut, int istextu
if (xsiz <= 0 || ysiz <= 0)
return -2;
TileFiles.tiledata[tilenum].texture = tex;
#pragma message("tileImportFromTexture needs rework!") // Reminder so that this place isn't forgotten.
//#if 0
// Does this make any difference when the texture gets *properly* inserted into the tile array? Answer: Yes, it affects how translations affect it.
//if (istexture)
tileSetHightileReplacement(tilenum, 0, fn, (float)(255 - alphacut) * (1.f / 255.f), 1.0f, 1.0f, 1.0, 1.0, 0); // At the moment this is the only way to load the texture. The texture creation code is not ready yet for downconverting an image.
//#endif
TileFiles.tiledata[tilenum].backup = TileFiles.tiledata[tilenum].texture = tex;
if (istexture)
tileSetHightileReplacement(tilenum, 0, fn, (float)(255 - alphacut) * (1.f / 255.f), 1.0f, 1.0f, 1.0, 1.0, 0);
return 0;
}

View file

@ -233,6 +233,13 @@ static void loaddefs()
cycle_t deftimer;
deftimer.Reset();
deftimer.Clock();
if (fileSystem.FindFile("duke3d-megaton.def") >= 0)
{
// We do not load the Megaton .defs because they do not have any CRC checks and also override other assets than the weapons.
// This engine provided .def uses CRCs to protect user replacements.
if (!loaddefinitionsfile("engine/megaton-widescreen.def"))
duke3d_globalflags |= DUKE3D_NO_WIDESCREEN_PINNING; // fixme - this needs to be smarter and done on a per-weapon basis.
}
if (!loaddefinitionsfile(defsfile))
{
deftimer.Unclock();

View file

@ -0,0 +1,39 @@
// HUD Knuckle Crack
tilefromtexture 2325 { file "tiles/duke3d/2325.png" xoffset 24 ifcrc -1031049892 }
tilefromtexture 2326 { file "tiles/duke3d/2326.png" xoffset 16 ifcrc -1415291705 }
// HUD Pistol
tilefromtexture 2529 { file "tiles/duke3d/2529.png" xoffset -70 yoffset 8 ifcrc 3581292866 }
// HUD RPG
tilefromtexture 2544 { file "tiles/duke3d/2544.png" xoffset -115 yoffset -67 ifcrc 260236986 }
// HUD Freezer
tilefromtexture 2548 { file "tiles/duke3d/2548.png" xoffset -60 yoffset 15 ifcrc 3417956724 }
tilefromtexture 2550 { file "tiles/duke3d/2550.png" xoffset -13 yoffset 25 ifcrc 1899181281 }
// HUD Expander
tilefromtexture 2554 { file "tiles/duke3d/2554.png" xoffset -4 ifcrc 72450690 }
tilefromtexture 2555 { file "tiles/duke3d/2555.png" xoffset -4 ifcrc 1675835376 }
// HUD Shrinker
tilefromtexture 2556 { file "tiles/duke3d/2556.png" xoffset -1 yoffset -2 ifcrc 3227576907 }
tilefromtexture 2557 { file "tiles/duke3d/2557.png" xoffset -1 yoffset -2 ifcrc 3133384900 }
// VACATION
// HUD Water Pistol
tilefromtexture 2529 { file "tiles/caribbean/2529.png" xoffset -70 ifcrc 616478591 }
// HUD Coconut Launcher
tilefromtexture 2544 { file "tiles/caribbean/2544.png" xoffset -98 yoffset -67 ifcrc 2729897970 }
// HUD Icemaker
tilefromtexture 2548 { file "tiles/caribbean/2548.png" xoffset -62 yoffset 15 ifcrc 2472520901 }
tilefromtexture 2550 { file "tiles/caribbean/2550.png" xoffset 1 yoffset 25 ifcrc 1768259669 }
// HUD Super Soak'em
tilefromtexture 2613 { file "tiles/caribbean/2613.png" xoffset -76 yoffset -45 ifcrc 518391601 }
tilefromtexture 2616 { file "tiles/caribbean/2616.png" xoffset -56 yoffset -40 ifcrc 487633089 }