compat.h:

add defines for offsetof and varsizeof (could do with a better name. one
	possibility is varcalcsize).
mdl_sprite.h:
	initial stab at the shared sprite model loader. The gl texture is NOT
	created but everything should be in a sane state to do so.
This commit is contained in:
Bill Currie 2001-03-28 07:37:14 +00:00
parent 3cac9a7e29
commit 8e543b264d
2 changed files with 72 additions and 0 deletions

View file

@ -88,4 +88,10 @@ extern int vsnprintf(char *s, size_t maxlen, const char *format, va_list arg);
# define strncaseequal(a,b,c) (strncasecmp (a, b, c) == 0)
#endif
#if !defined(offsetof)
# define offsetof(t,f) ((size_t)&((t *)0)->f)
#endif
#define varsizeof(t,f,c) ((size_t)offsetof(t,f[c]))
#endif // __compat_h

66
include/mdl_sprite.h Normal file
View file

@ -0,0 +1,66 @@
/*
mdl_sprit.h
sprite model structures
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __mdl_sprite_h
#define __mdl_sprite_h
#include "qtypes.h"
#include "spritegn.h"
// FIXME: shorten these?
typedef struct mspriteframe_s
{
float up, down, left, right;
int gl_texturenum;
struct tex_s *texture;
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
int type;
int maxwidth;
int maxheight;
int numframes;
float beamlength;
mspriteframedesc_t frames[1];
} msprite_t;
#endif // __mdl_sprite_h