diff options
| author | Karl Kurbjun <kkurbjun@gmail.com> | 2006-04-16 21:16:09 +0000 |
|---|---|---|
| committer | Karl Kurbjun <kkurbjun@gmail.com> | 2006-04-16 21:16:09 +0000 |
| commit | f7872ac61b60468510bf2cbd63f82c1a4ad14a94 (patch) | |
| tree | 30bb72a8c6379610a724250021e603ee45be2cfc /apps/plugins | |
| parent | 95325ff72a367714c74564da768c64aede0a6cb0 (diff) | |
| download | rockbox-f7872ac61b60468510bf2cbd63f82c1a4ad14a94.zip rockbox-f7872ac61b60468510bf2cbd63f82c1a4ad14a94.tar.gz rockbox-f7872ac61b60468510bf2cbd63f82c1a4ad14a94.tar.bz2 rockbox-f7872ac61b60468510bf2cbd63f82c1a4ad14a94.tar.xz | |
Decrease doom's code size and some code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9690 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/doom/i_sound.c | 5 | ||||
| -rw-r--r-- | apps/plugins/doom/r_main.c | 5 | ||||
| -rw-r--r-- | apps/plugins/doom/r_state.h | 161 |
3 files changed, 81 insertions, 90 deletions
diff --git a/apps/plugins/doom/i_sound.c b/apps/plugins/doom/i_sound.c index 471b0ee..2d0ebe9 100644 --- a/apps/plugins/doom/i_sound.c +++ b/apps/plugins/doom/i_sound.c @@ -62,7 +62,7 @@ // Basically, samples from all active internal channels // are modifed and added, and stored in the buffer // that is submitted to the audio device. -signed short mixbuffer[MIXBUFFERSIZE]; +signed short *mixbuffer=NULL; typedef struct { // SFX id of the playing sound effect. @@ -516,6 +516,9 @@ void I_InitSound() printf( " pre-cached all sound data\n"); + if(mixbuffer==NULL) + mixbuffer=malloc(sizeof(short)*MIXBUFFERSIZE); + // Now initialize mixbuffer with zero. for ( i = 0; i< MIXBUFFERSIZE; i++ ) mixbuffer[i] = 0; diff --git a/apps/plugins/doom/r_main.c b/apps/plugins/doom/r_main.c index 5afb85b..58fe9d0 100644 --- a/apps/plugins/doom/r_main.c +++ b/apps/plugins/doom/r_main.c @@ -80,7 +80,7 @@ angle_t clipangle; // flattening the arc to a flat projection plane. // There will be many angles mapped to the same X. -int viewangletox[FINEANGLES/2]; +int *viewangletox=0; // The xtoviewangleangle[] table maps a screen pixel // to the lowest viewangle that maps back to x ranges @@ -217,6 +217,9 @@ static void R_InitTextureMapping (void) // Calc focallength // so FIELDOFVIEW angles covers SCREENWIDTH. + if(viewangletox==NULL) + viewangletox=malloc(sizeof(int)*FINEANGLES/2); + focallength = FixedDiv(centerxfrac, finetangent[FINEANGLES/4+FIELDOFVIEW/2]); for (i=0 ; i<FINEANGLES/2 ; i++) diff --git a/apps/plugins/doom/r_state.h b/apps/plugins/doom/r_state.h index 2e11bb5..bca66d4 100644 --- a/apps/plugins/doom/r_state.h +++ b/apps/plugins/doom/r_state.h @@ -1,24 +1,33 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id$ -// -// Copyright (C) 1993-1996 by 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. -// -// DESCRIPTION: -// Refresh/render internal state variables (global). -// -//----------------------------------------------------------------------------- +/* Emacs style mode select -*- C++ -*- + *----------------------------------------------------------------------------- + * + * + * PrBoom a Doom port merged with LxDoom and LSDLDoom + * based on BOOM, a modified and improved DOOM engine + * Copyright (C) 1999 by + * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman + * Copyright (C) 1999-2000 by + * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze + * + * 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. + * + * DESCRIPTION: + * Refresh/render internal state variables (global). + * + *-----------------------------------------------------------------------------*/ #ifndef __R_STATE__ @@ -28,113 +37,89 @@ #include "d_player.h" #include "r_data.h" - - #ifdef __GNUG__ #pragma interface #endif - // // Refresh internal data structures, // for rendering. // // needed for texture pegging -extern fixed_t* textureheight; +extern fixed_t *textureheight; // needed for pre rendering (fracs) -extern fixed_t* spritewidth; +extern fixed_t *spritewidth; -extern fixed_t* spriteoffset; -extern fixed_t* spritetopoffset; +extern fixed_t *spriteoffset; +extern fixed_t *spritetopoffset; -extern int viewwidth; -extern int scaledviewwidth; -extern int viewheight; +extern int viewwidth; +extern int scaledviewwidth; +extern int viewheight; -extern int firstflat; +extern int firstflat; // for global animation -extern int* flattranslation; -extern int* texturetranslation; - +extern int *flattranslation; +extern int *texturetranslation; // Sprite.... -extern int firstspritelump; -extern int lastspritelump; -extern int numspritelumps; - - +extern int firstspritelump; +extern int lastspritelump; +extern int numspritelumps; // // Lookup tables for map data. // -extern int numsprites; -extern spritedef_t* sprites; +extern int numsprites; +extern spritedef_t *sprites; -extern int numvertexes; -extern vertex_t* vertexes; +extern int numvertexes; +extern vertex_t *vertexes; -extern int numsegs; -extern seg_t* segs; +extern int numsegs; +extern seg_t *segs; -extern int numsectors; -extern sector_t* sectors; +extern int numsectors; +extern sector_t *sectors; -extern int numsubsectors; -extern subsector_t* subsectors; +extern int numsubsectors; +extern subsector_t *subsectors; -extern int numnodes; -extern node_t* nodes; +extern int numnodes; +extern node_t *nodes; -extern int numlines; -extern line_t* lines; +extern int numlines; +extern line_t *lines; -extern int numsides; -extern side_t* sides; +extern int numsides; +extern side_t *sides; // // POV data. // -extern fixed_t viewx; -extern fixed_t viewy; -extern fixed_t viewz; - -extern angle_t viewangle; -extern player_t* viewplayer; - - -// ? -extern angle_t clipangle; - -extern int viewangletox[FINEANGLES/2]; -extern angle_t xtoviewangle[SCREENWIDTH+1]; -//extern fixed_t finetangent[FINEANGLES/2]; - -extern fixed_t rw_distance; -extern angle_t rw_normalangle; - - +extern fixed_t viewx; +extern fixed_t viewy; +extern fixed_t viewz; +extern angle_t viewangle; +extern player_t *viewplayer; +extern angle_t clipangle; +extern int *viewangletox; +extern angle_t xtoviewangle[SCREENWIDTH+1]; // killough 2/8/98 +extern fixed_t rw_distance; +extern angle_t rw_normalangle; // angle to line origin -extern int rw_angle1; +extern int rw_angle1; // Segs count? -extern int sscount; - -extern visplane_t* floorplane; -extern visplane_t* ceilingplane; +extern int sscount; +extern visplane_t *floorplane; +extern visplane_t *ceilingplane; #endif -//----------------------------------------------------------------------------- -// -// $Log$ -// Revision 1.1 2006/03/28 15:44:01 dave -// Patch #2969 - Doom! Currently only working on the H300. -// -// -//----------------------------------------------------------------------------- |