summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/r_data.c
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2006-04-17 19:42:08 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2006-04-17 19:42:08 +0000
commit08b417f149f061f7923d4acc2a950bcbaa49b6fa (patch)
tree9ebf9321f794b509edf2927cb95a2a1421d1c712 /apps/plugins/doom/r_data.c
parent239564c80e1edbc6641c03c636233c9ec813aa9a (diff)
downloadrockbox-08b417f149f061f7923d4acc2a950bcbaa49b6fa.zip
rockbox-08b417f149f061f7923d4acc2a950bcbaa49b6fa.tar.gz
rockbox-08b417f149f061f7923d4acc2a950bcbaa49b6fa.tar.bz2
rockbox-08b417f149f061f7923d4acc2a950bcbaa49b6fa.tar.xz
Properly cache animations at level start. Switches still need some caching code. Added a debug cache flag for use in the sim to w_wad.c. Should be taken out when switches are handled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9706 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom/r_data.c')
-rw-r--r--apps/plugins/doom/r_data.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/apps/plugins/doom/r_data.c b/apps/plugins/doom/r_data.c
index b5ff95a..15e8361 100644
--- a/apps/plugins/doom/r_data.c
+++ b/apps/plugins/doom/r_data.c
@@ -897,10 +897,36 @@ int R_TextureNumForName(const char *name) // const added -- killough
// to avoid using alloca(), and to improve performance.
// cph - new wad lump handling, calls cache functions but acquires no locks
+// Structures from p_spec.c
+// Used to fully cache animations in the level -> avoids stalls on Hard Drive Systems
+typedef struct
+{
+ boolean istexture;
+ int picnum;
+ int basepic;
+ int numpics;
+ int speed;
+
+} anim_t;
+extern anim_t* anims;
+extern anim_t* lastanim;
+
+anim_t * isAnim(int flatnum, boolean texcheck)
+{
+ anim_t *checkf;
+ for(checkf=anims; checkf<lastanim; checkf++)
+ {
+ if((flatnum>=checkf->basepic || flatnum<=checkf->numpics)&&checkf->istexture==texcheck)
+ return checkf;
+ }
+ return 0;
+}
+
void R_PrecacheLevel(void)
{
- register int i;
+ register int i, j;
register byte *hitlist;
+ anim_t *cacheanim;
if (demoplayback)
return;
@@ -916,6 +942,14 @@ void R_PrecacheLevel(void)
for (i = numsectors; --i >= 0; )
hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1;
+ // If flat is an animation, load those too
+ // Definately not the most efficient, but better then stalls in game
+ for(i=0; i<numflats; i++)
+ if(hitlist[i])
+ if((cacheanim=isAnim(i,0)))
+ for(j=0; j<cacheanim->numpics; j++)
+ hitlist[cacheanim->basepic+j]=1;
+
for (i = numflats; --i >= 0; )
if (hitlist[i])
(W_CacheLumpNum)(firstflat + i, 0);
@@ -929,6 +963,14 @@ void R_PrecacheLevel(void)
hitlist[sides[i].toptexture] =
hitlist[sides[i].midtexture] = 1;
+ // If texture is an animation, load those too
+ // Definately not the most efficient, but better then stalls in game
+ for(i=0; i<numsides; i++)
+ if(hitlist[i])
+ if((cacheanim=isAnim(i,1)))
+ for(j=0; j<cacheanim->numpics; j++)
+ hitlist[cacheanim->basepic+j]=1;
+
// Sky texture is always present.
// Note that F_SKY1 is the name used to
// indicate a sky floor/ceiling as a flat,