DOOM64-RE

DOOM 64 Reverse Engineering
Log | Files | Refs | README | LICENSE

r_data.c (1773B)


      1 /* R_data.c */
      2 
      3 #include "doomdef.h"
      4 #include "r_local.h"
      5 #include "p_local.h"
      6 
      7 int			firsttex;				// 800A632C
      8 int			lasttex;				// 800A6330
      9 int			numtextures;			// 800A6334
     10 int			firstswx;				// 800A6338
     11 int    	    *textures;				// 800A633C
     12 
     13 int			firstsprite;			// 800A6320
     14 int			lastsprite;				// 800A6324
     15 int			numsprites;				// 800A6328
     16 
     17 int	        skytexture;             // 800A5f14
     18 
     19 void R_InitTextures(void);
     20 void R_InitSprites(void);
     21 /*============================================================================ */
     22 
     23 #define PI_VAL 3.141592653589793
     24 
     25 /*
     26 ================
     27 =
     28 = R_InitData
     29 =
     30 = Locates all the lumps that will be used by all views
     31 = Must be called after W_Init
     32 =================
     33 */
     34 
     35 void R_InitData (void) // 80023180
     36 {
     37     int i;
     38     int val;
     39 
     40     for(i = 0; i < (5*FINEANGLES/4); i++)
     41     {
     42         finesine[i] = (fixed_t) (sinf((((f64) val * (f64) PI_VAL) / 8192.0)) * 65536.0);
     43         val += 2;
     44     }
     45 
     46 	R_InitTextures();
     47     R_InitSprites();
     48 }
     49 
     50 /*
     51 ==================
     52 =
     53 = R_InitTextures
     54 =
     55 = Initializes the texture list with the textures from the world map
     56 =
     57 ==================
     58 */
     59 
     60 void R_InitTextures(void) // 8002327C
     61 {
     62 	int lump, swx, i;
     63 
     64 	firsttex = W_GetNumForName("T_START") + 1;
     65 	lasttex = W_GetNumForName("T_END") - 1;
     66 	numtextures = (lasttex - firsttex) + 1;
     67 
     68 	textures = Z_Malloc(numtextures * sizeof(int), PU_STATIC, NULL);
     69 
     70 	for (i = 0; i < numtextures; i++)
     71 	{
     72 	    textures[i] = (i + firsttex) << 4;
     73 	}
     74 
     75     swx = W_CheckNumForName("SWX", 0x7fffff00, 0);
     76     firstswx = (swx - firsttex);
     77 }
     78 
     79 /*
     80 ================
     81 =
     82 = R_InitSprites
     83 =
     84 =================
     85 */
     86 
     87 void R_InitSprites(void) // 80023378
     88 {
     89 	firstsprite = W_GetNumForName("S_START") + 1;
     90 	lastsprite = W_GetNumForName("S_END") - 1;
     91 	numsprites = (lastsprite - firstsprite) + 1;
     92 }