mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
sp2 in eine eigene Datei
This commit is contained in:
parent
ac31b9efa8
commit
719b958688
3 changed files with 74 additions and 40 deletions
4
Makefile
4
Makefile
|
@ -333,6 +333,7 @@ OPENGL_OBJS = \
|
|||
build/ref_gl/gl_scrap.o \
|
||||
build/ref_gl/gl_warp.o \
|
||||
build/ref_gl/files/pcx.o \
|
||||
build/ref_gl/files/sp2.o \
|
||||
build/ref_gl/files/tga.o \
|
||||
build/ref_gl/files/wal.o \
|
||||
|
||||
|
@ -804,6 +805,9 @@ build/ref_gl/gl_warp.o: src/refresh/gl_warp.c
|
|||
build/ref_gl/files/pcx.o: src/refresh/files/pcx.c
|
||||
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||
|
||||
build/ref_gl/files/sp2.o: src/refresh/files/sp2.c
|
||||
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||
|
||||
build/ref_gl/files/tga.o: src/refresh/files/tga.c
|
||||
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||
|
||||
|
|
70
src/refresh/files/sp2.c
Normal file
70
src/refresh/files/sp2.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 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 the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* .sp2 sprites
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include "../header/local.h"
|
||||
|
||||
extern int modfilelen;
|
||||
|
||||
void
|
||||
Mod_LoadSpriteModel ( model_t *mod, void *buffer )
|
||||
{
|
||||
dsprite_t *sprin, *sprout;
|
||||
int i;
|
||||
|
||||
sprin = (dsprite_t *) buffer;
|
||||
sprout = Hunk_Alloc( modfilelen );
|
||||
|
||||
sprout->ident = LittleLong( sprin->ident );
|
||||
sprout->version = LittleLong( sprin->version );
|
||||
sprout->numframes = LittleLong( sprin->numframes );
|
||||
|
||||
if ( sprout->version != SPRITE_VERSION )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, sprout->version, SPRITE_VERSION );
|
||||
}
|
||||
|
||||
if ( sprout->numframes > MAX_MD2SKINS )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has too many frames (%i > %i)",
|
||||
mod->name, sprout->numframes, MAX_MD2SKINS );
|
||||
}
|
||||
|
||||
/* byte swap everything */
|
||||
for ( i = 0; i < sprout->numframes; i++ )
|
||||
{
|
||||
sprout->frames [ i ].width = LittleLong( sprin->frames [ i ].width );
|
||||
sprout->frames [ i ].height = LittleLong( sprin->frames [ i ].height );
|
||||
sprout->frames [ i ].origin_x = LittleLong( sprin->frames [ i ].origin_x );
|
||||
sprout->frames [ i ].origin_y = LittleLong( sprin->frames [ i ].origin_y );
|
||||
memcpy( sprout->frames [ i ].name, sprin->frames [ i ].name, MAX_SKINNAME );
|
||||
mod->skins [ i ] = GL_FindImage( sprout->frames [ i ].name,
|
||||
it_sprite );
|
||||
}
|
||||
|
||||
mod->type = mod_sprite;
|
||||
}
|
||||
|
|
@ -1072,46 +1072,6 @@ Mod_LoadAliasModel ( model_t *mod, void *buffer )
|
|||
mod->maxs [ 2 ] = 32;
|
||||
}
|
||||
|
||||
void
|
||||
Mod_LoadSpriteModel ( model_t *mod, void *buffer )
|
||||
{
|
||||
dsprite_t *sprin, *sprout;
|
||||
int i;
|
||||
|
||||
sprin = (dsprite_t *) buffer;
|
||||
sprout = Hunk_Alloc( modfilelen );
|
||||
|
||||
sprout->ident = LittleLong( sprin->ident );
|
||||
sprout->version = LittleLong( sprin->version );
|
||||
sprout->numframes = LittleLong( sprin->numframes );
|
||||
|
||||
if ( sprout->version != SPRITE_VERSION )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, sprout->version, SPRITE_VERSION );
|
||||
}
|
||||
|
||||
if ( sprout->numframes > MAX_MD2SKINS )
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has too many frames (%i > %i)",
|
||||
mod->name, sprout->numframes, MAX_MD2SKINS );
|
||||
}
|
||||
|
||||
/* byte swap everything */
|
||||
for ( i = 0; i < sprout->numframes; i++ )
|
||||
{
|
||||
sprout->frames [ i ].width = LittleLong( sprin->frames [ i ].width );
|
||||
sprout->frames [ i ].height = LittleLong( sprin->frames [ i ].height );
|
||||
sprout->frames [ i ].origin_x = LittleLong( sprin->frames [ i ].origin_x );
|
||||
sprout->frames [ i ].origin_y = LittleLong( sprin->frames [ i ].origin_y );
|
||||
memcpy( sprout->frames [ i ].name, sprin->frames [ i ].name, MAX_SKINNAME );
|
||||
mod->skins [ i ] = GL_FindImage( sprout->frames [ i ].name,
|
||||
it_sprite );
|
||||
}
|
||||
|
||||
mod->type = mod_sprite;
|
||||
}
|
||||
|
||||
/*
|
||||
* Specifies the model that will be used as the world
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue