Commit faa76f57 authored by Steven Fuller's avatar Steven Fuller

wl_draw.c: DeCompileSprite no longer relies on a struct

parent 55f2fbd3
......@@ -28,8 +28,6 @@ works alright at some res, but breaks on most others currently
* would be nice if Quit() used vsnprintf, etc
* actor walking through door is drawn in front of door: near end of E1M1 for
example
* SDL version will have all the features for now, xlib will just be a
320x200 window
* getenv so that you can point an env. var to the proper dir
* rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode
* fix config file and savegames
......@@ -42,13 +40,6 @@ code, it really needs to be cleaned up
* rewrite id_ca.c: uniform memory handling system
* clean up header files, especially wl_def.h, where some declarations aren't
in the right place
* every structure that is read/written must be PACKED, with datatypes
specifially set to correct size
* or have PACKED versions of read/write structures, and transfer
to/from just for reading, so only non-packed structures are used during
actual gameplay/etc.
this isn't as much of a big deal since compensating for endianness will
require major changes also
* is that memory intro screen needed anymore? probably not, although it
would be nice to show what version is loaded, but doom just printed text
and the intro screen which came with wolf3d has copyrighted/trademarked images
......@@ -84,7 +75,4 @@ at a time
* systems with no sound should still have working WaitSoundDone.. it's
possible to calculate the sound lengths in terms of 70Hz (adlib sound len / 2,
pcm sound len / 100).
Things to try:
* Create a native palette format instead of doing conversions each frame
------------------------------------------------------------------------------
......@@ -755,22 +755,16 @@ static void ScaleLineTrans(unsigned int height, byte *source, int x)
static unsigned char *spritegfx[SPR_TOTAL];
typedef struct
{
word leftpix, rightpix;
word dataofs[64];
/* table data after dataofs[rightpix-leftpix+1] */
} PACKED t_compshape;
static void DeCompileSprite(int shapenum)
{
t_compshape *ptr;
unsigned char *ptr;
unsigned char *buf;
int srcx;
unsigned short int *cmdptr;
short int *linecmds;
unsigned char *cmdptr;
unsigned char *pixels;
short int yoff; /* int16_t */
int y, y0, y1;
int x, left, right;
int cmd;
MM_GetPtr((void *)&buf, 64 * 64);
......@@ -778,23 +772,37 @@ static void DeCompileSprite(int shapenum)
ptr = PM_GetSpritePage(shapenum);
cmdptr = &ptr->dataofs[0];
for (srcx = ptr->leftpix; srcx <= ptr->rightpix; srcx++) {
linecmds = (short *)((unsigned char *)ptr + *cmdptr++);
while (linecmds[0]) {
y0 = linecmds[2] / 2;
y1 = linecmds[0] / 2;
pixels = (unsigned char *)ptr + y0 + linecmds[1];
/* left = ptr[0] | (ptr[1] << 8); */
left = ptr[0];
/* right = ptr[2] | (ptr[3] << 8); */
right = ptr[2];
cmdptr = &ptr[4];
for (x = left; x <= right; x++) {
cmd = cmdptr[0] | (cmdptr[1] << 8);
cmdptr += 2;
/* while (ptr[cmd+0] | (ptr[cmd+1] << 8)) { */
while (ptr[cmd+0]) {
/* y1 = (ptr[cmd+0] | (ptr[cmd+1] << 8)) / 2; */
y1 = ptr[cmd+0] / 2;
yoff = ptr[cmd+2] | (ptr[cmd+3] << 8);
/* y0 = (ptr[cmd+4] | (ptr[cmd+5] << 8)) / 2; */
y0 = ptr[cmd+4] / 2;
pixels = &ptr[y0 + yoff];
for (y = y0; y < y1; y++) {
//*(buf + slinex + (y*64)) = *pixels;
*(buf + (srcx*64) + y) = *pixels;
/* *(buf + x + (y*64)) = *pixels; */
*(buf + (x*64) + y) = *pixels;
pixels++;
}
linecmds += 3;
cmd += 6;
}
}
spritegfx[shapenum] = buf;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment