diff options
-rw-r--r-- | apps/plugins/doom/p_spec.c | 4 | ||||
-rw-r--r-- | apps/plugins/doom/r_data.c | 44 | ||||
-rw-r--r-- | apps/plugins/doom/w_wad.c | 7 |
3 files changed, 51 insertions, 4 deletions
diff --git a/apps/plugins/doom/p_spec.c b/apps/plugins/doom/p_spec.c index 6270928de0..c8c04fa7e2 100644 --- a/apps/plugins/doom/p_spec.c +++ b/apps/plugins/doom/p_spec.c | |||
@@ -95,8 +95,8 @@ typedef struct | |||
95 | 95 | ||
96 | #define MAXANIMS 32 // no longer a strict limit -- killough | 96 | #define MAXANIMS 32 // no longer a strict limit -- killough |
97 | 97 | ||
98 | static anim_t* lastanim; | 98 | anim_t* lastanim; |
99 | static anim_t* anims; // new structure w/o limits -- killough | 99 | anim_t* anims; // new structure w/o limits -- killough |
100 | static size_t maxanims; | 100 | static size_t maxanims; |
101 | 101 | ||
102 | // killough 3/7/98: Initialize generalized scrolling | 102 | // killough 3/7/98: Initialize generalized scrolling |
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 | ||
902 | typedef struct | ||
903 | { | ||
904 | boolean istexture; | ||
905 | int picnum; | ||
906 | int basepic; | ||
907 | int numpics; | ||
908 | int speed; | ||
909 | |||
910 | } anim_t; | ||
911 | extern anim_t* anims; | ||
912 | extern anim_t* lastanim; | ||
913 | |||
914 | anim_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 | |||
900 | void R_PrecacheLevel(void) | 925 | void 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, |
diff --git a/apps/plugins/doom/w_wad.c b/apps/plugins/doom/w_wad.c index 4bd3807191..18da216dcf 100644 --- a/apps/plugins/doom/w_wad.c +++ b/apps/plugins/doom/w_wad.c | |||
@@ -494,7 +494,7 @@ int W_LumpLength (int lump) | |||
494 | // Loads the lump into the given buffer, | 494 | // Loads the lump into the given buffer, |
495 | // which must be >= W_LumpLength(). | 495 | // which must be >= W_LumpLength(). |
496 | // | 496 | // |
497 | 497 | #undef DEBUGCACHE | |
498 | void W_ReadLump(int lump, void *dest) | 498 | void W_ReadLump(int lump, void *dest) |
499 | { | 499 | { |
500 | lumpinfo_t *l = lumpinfo + lump; | 500 | lumpinfo_t *l = lumpinfo + lump; |
@@ -512,6 +512,11 @@ void W_ReadLump(int lump, void *dest) | |||
512 | { | 512 | { |
513 | int c; | 513 | int c; |
514 | 514 | ||
515 | #if DEBUGCACHE | ||
516 | if(gamestate==GS_LEVEL) | ||
517 | printf("Loading %s\n", lumpinfo[lump].name); | ||
518 | #endif | ||
519 | |||
515 | // killough 1/31/98: Reload hack (-wart) removed | 520 | // killough 1/31/98: Reload hack (-wart) removed |
516 | 521 | ||
517 | lseek(l->handle, l->position, SEEK_SET); | 522 | lseek(l->handle, l->position, SEEK_SET); |