summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/r_data.c
diff options
context:
space:
mode:
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 b5ff95a364..15e8361d7f 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
897// to avoid using alloca(), and to improve performance. 897// to avoid using alloca(), and to improve performance.
898// cph - new wad lump handling, calls cache functions but acquires no locks 898// cph - new wad lump handling, calls cache functions but acquires no locks
899 899
900// Structures from p_spec.c
901// Used to fully cache animations in the level -> avoids stalls on Hard Drive Systems
902typedef struct
903{
904 boolean istexture;
905 int picnum;
906 int basepic;
907 int numpics;
908 int speed;
909
910} anim_t;
911extern anim_t* anims;
912extern anim_t* lastanim;
913
914anim_t * isAnim(int flatnum, boolean texcheck)
915{
916 anim_t *checkf;
917 for(checkf=anims; checkf<lastanim; checkf++)
918 {
919 if((flatnum>=checkf->basepic || flatnum<=checkf->numpics)&&checkf->istexture==texcheck)
920 return checkf;
921 }
922 return 0;
923}
924
900void R_PrecacheLevel(void) 925void R_PrecacheLevel(void)
901{ 926{
902 register int i; 927 register int i, j;
903 register byte *hitlist; 928 register byte *hitlist;
929 anim_t *cacheanim;
904 930
905 if (demoplayback) 931 if (demoplayback)
906 return; 932 return;
@@ -916,6 +942,14 @@ void R_PrecacheLevel(void)
916 for (i = numsectors; --i >= 0; ) 942 for (i = numsectors; --i >= 0; )
917 hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1; 943 hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1;
918 944
945 // If flat is an animation, load those too
946 // Definately not the most efficient, but better then stalls in game
947 for(i=0; i<numflats; i++)
948 if(hitlist[i])
949 if((cacheanim=isAnim(i,0)))
950 for(j=0; j<cacheanim->numpics; j++)
951 hitlist[cacheanim->basepic+j]=1;
952
919 for (i = numflats; --i >= 0; ) 953 for (i = numflats; --i >= 0; )
920 if (hitlist[i]) 954 if (hitlist[i])
921 (W_CacheLumpNum)(firstflat + i, 0); 955 (W_CacheLumpNum)(firstflat + i, 0);
@@ -929,6 +963,14 @@ void R_PrecacheLevel(void)
929 hitlist[sides[i].toptexture] = 963 hitlist[sides[i].toptexture] =
930 hitlist[sides[i].midtexture] = 1; 964 hitlist[sides[i].midtexture] = 1;
931 965
966 // If texture is an animation, load those too
967 // Definately not the most efficient, but better then stalls in game
968 for(i=0; i<numsides; i++)
969 if(hitlist[i])
970 if((cacheanim=isAnim(i,1)))
971 for(j=0; j<cacheanim->numpics; j++)
972 hitlist[cacheanim->basepic+j]=1;
973
932 // Sky texture is always present. 974 // Sky texture is always present.
933 // Note that F_SKY1 is the name used to 975 // Note that F_SKY1 is the name used to
934 // indicate a sky floor/ceiling as a flat, 976 // indicate a sky floor/ceiling as a flat,