merge Mod_LoadSpriteFrame from gl and sw back into the common sprite loader

pulling the gl specific code (the loading of the texture into GL) into
a separate function (Mod_SpriteLoadTexture), which is just a stub in sw
This commit is contained in:
Bill Currie 2001-11-22 05:31:44 +00:00
parent 84bb78abe4
commit bd0ac4a38a
4 changed files with 48 additions and 85 deletions

View file

@ -27,57 +27,13 @@
static const char rcsid[] =
"$Id$";
// models are the only shared resource between a client and server running
// on the same machine.
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/sys.h"
#include "d_iface.h"
void *
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
void
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
int width, height, size, origin[2];
pinframe = (dspriteframe_t *) pin;
width = LittleLong (pinframe->width);
height = LittleLong (pinframe->height);
size = width * height;
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
*ppframe = pspriteframe;
pspriteframe->width = width;
pspriteframe->height = height;
origin[0] = LittleLong (pinframe->origin[0]);
origin[1] = LittleLong (pinframe->origin[1]);
pspriteframe->up = origin[1];
pspriteframe->down = origin[1] - height;
pspriteframe->left = origin[0];
pspriteframe->right = width + origin[0];
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
}