Wolf3D-Mac/Refresh2.c

1 line
7.8 KiB
C

#include "WolfDef.h"
#include <stdlib.h>
Word MathSize; /* What size of math data is calculated? */
Word *scaleatzptr; /* Pointer to the scale table for z projection */
short *xtoviewangle; /* Screen x to view angle */
short *viewangletox; /* View angle to screen x */
short *finetangent; /* Fine tangent table */
short *finesine; /* Fine sine table */
fixed_t sintable[ANGLES] = {
0,3,6,9,13,16,19,22,25,28,31,34,37,41,44,47,
50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,
98,100,103,106,109,112,115,117,120,123,126,128,131,134,136,139,
142,144,147,149,152,154,157,159,162,164,167,169,171,174,176,178,
180,183,185,187,189,191,193,195,197,199,201,203,205,207,208,210,
212,214,215,217,219,220,222,223,225,226,228,229,231,232,233,234,
236,237,238,239,240,241,242,243,244,245,246,247,247,248,249,249,
250,251,251,252,252,253,253,253,254,254,254,255,255,255,255,255,
255,255,255,255,255,255,254,254,254,253,253,253,252,252,251,251,
250,249,249,248,247,247,246,245,244,243,242,241,240,239,238,237,
236,234,233,232,231,229,228,226,225,223,222,220,219,217,215,214,
212,210,208,207,205,203,201,199,197,195,193,191,189,187,185,183,
180,178,176,174,171,169,167,164,162,159,157,154,152,149,147,144,
142,139,136,134,131,128,126,123,120,117,115,112,109,106,103,100,
98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,
50,47,44,41,37,34,31,28,25,22,19,16,13,9,6,3,
0,-3,-6,-9,-13,-16,-19,-22,-25,-28,-31,-34,-37,-41,-44,-47,
-50,-53,-56,-59,-62,-65,-68,-71,-74,-77,-80,-83,-86,-89,-92,-95,
-98,-100,-103,-106,-109,-112,-115,-117,-120,-123,-126,-128,-131,-134,-136,-139,
-142,-144,-147,-149,-152,-154,-157,-159,-162,-164,-167,-169,-171,-174,-176,-178,
-180,-183,-185,-187,-189,-191,-193,-195,-197,-199,-201,-203,-205,-207,-208,-210,
-212,-214,-215,-217,-219,-220,-222,-223,-225,-226,-228,-229,-231,-232,-233,-234,
-236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-247,-247,-248,-249,-249,
-250,-251,-251,-252,-252,-253,-253,-253,-254,-254,-254,-255,-255,-255,-255,-255,
-255,-255,-255,-255,-255,-255,-254,-254,-254,-253,-253,-253,-252,-252,-251,-251,
-250,-249,-249,-248,-247,-247,-246,-245,-244,-243,-242,-241,-240,-239,-238,-237,
-236,-234,-233,-232,-231,-229,-228,-226,-225,-223,-222,-220,-219,-217,-215,-214,
-212,-210,-208,-207,-205,-203,-201,-199,-197,-195,-193,-191,-189,-187,-185,-183,
-180,-178,-176,-174,-171,-169,-167,-164,-162,-159,-157,-154,-152,-149,-147,-144,
-142,-139,-136,-134,-131,-128,-126,-123,-120,-117,-115,-112,-109,-106,-103,-100,
-98,-95,-92,-89,-86,-83,-80,-77,-74,-71,-68,-65,-62,-59,-56,-53,
-50,-47,-44,-41,-37,-34,-31,-28,-25,-22,-19,-16,-13,-9,-6,-3
};
fixed_t costable[ANGLES] = {
255,255,255,255,255,255,254,254,254,253,253,253,252,252,251,251,
250,249,249,248,247,247,246,245,244,243,242,241,240,239,238,237,
236,234,233,232,231,229,228,226,225,223,222,220,219,217,215,214,
212,210,208,207,205,203,201,199,197,195,193,191,189,187,185,183,
180,178,176,174,171,169,167,164,162,159,157,154,152,149,147,144,
142,139,136,134,131,128,126,123,120,117,115,112,109,106,103,100,
98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,
50,47,44,41,37,34,31,28,25,22,19,16,13,9,6,3,
0,-3,-6,-9,-13,-16,-19,-22,-25,-28,-31,-34,-37,-41,-44,-47,
-50,-53,-56,-59,-62,-65,-68,-71,-74,-77,-80,-83,-86,-89,-92,-95,
-98,-100,-103,-106,-109,-112,-115,-117,-120,-123,-126,-128,-131,-134,-136,-139,
-142,-144,-147,-149,-152,-154,-157,-159,-162,-164,-167,-169,-171,-174,-176,-178,
-180,-183,-185,-187,-189,-191,-193,-195,-197,-199,-201,-203,-205,-207,-208,-210,
-212,-214,-215,-217,-219,-220,-222,-223,-225,-226,-228,-229,-231,-232,-233,-234,
-236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-247,-247,-248,-249,-249,
-250,-251,-251,-252,-252,-253,-253,-253,-254,-254,-254,-255,-255,-255,-255,-255,
-255,-255,-255,-255,-255,-255,-254,-254,-254,-253,-253,-253,-252,-252,-251,-251,
-250,-249,-249,-248,-247,-247,-246,-245,-244,-243,-242,-241,-240,-239,-238,-237,
-236,-234,-233,-232,-231,-229,-228,-226,-225,-223,-222,-220,-219,-217,-215,-214,
-212,-210,-208,-207,-205,-203,-201,-199,-197,-195,-193,-191,-189,-187,-185,-183,
-180,-178,-176,-174,-171,-169,-167,-164,-162,-159,-157,-154,-152,-149,-147,-144,
-142,-139,-136,-134,-131,-128,-126,-123,-120,-117,-115,-112,-109,-106,-103,-100,
-98,-95,-92,-89,-86,-83,-80,-77,-74,-71,-68,-65,-62,-59,-56,-53,
-50,-47,-44,-41,-37,-34,-31,-28,-25,-22,-19,-16,-13,-9,-6,-3,
0,3,6,9,13,16,19,22,25,28,31,34,37,41,44,47,
50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,
98,100,103,106,109,112,115,117,120,123,126,128,131,134,136,139,
142,144,147,149,152,154,157,159,162,164,167,169,171,174,176,178,
180,183,185,187,189,191,193,195,197,199,201,203,205,207,208,210,
212,214,215,217,219,220,222,223,225,226,228,229,231,232,233,234,
236,237,238,239,240,241,242,243,244,245,246,247,247,248,249,249,
250,251,251,252,252,253,253,253,254,254,254,255,255,255,255,255
};
Word tantoangle[513] = {
0,20,40,61,81,101,122,142,162,183,203,224,244,264,285,305,
325,346,366,386,407,427,447,468,488,508,529,549,569,590,610,630,
651,671,691,711,732,752,772,792,813,833,853,873,894,914,934,954,
974,995,1015,1035,1055,1075,1096,1116,1136,1156,1176,1196,1216,1236,1256,1277,
1297,1317,1337,1357,1377,1397,1417,1437,1457,1477,1497,1517,1537,1556,1576,1596,
1616,1636,1656,1676,1696,1715,1735,1755,1775,1795,1814,1834,1854,1874,1893,1913,
1933,1952,1972,1992,2011,2031,2051,2070,2090,2109,2129,2148,2168,2187,2207,2226,
2246,2265,2285,2304,2323,2343,2362,2381,2401,2420,2439,2459,2478,2497,2516,2536,
2555,2574,2593,2612,2631,2650,2669,2688,2708,2727,2746,2765,2784,2802,2821,2840,
2859,2878,2897,2916,2935,2953,2972,2991,3010,3028,3047,3066,3084,3103,3122,3140,
3159,3177,3196,3214,3233,3251,3270,3288,3307,3325,3343,3362,3380,3398,3416,3435,
3453,3471,3489,3508,3526,3544,3562,3580,3598,3616,3634,3652,3670,3688,3706,3724,
3742,3759,3777,3795,3813,3831,3848,3866,3884,3901,3919,3937,3954,3972,3989,4007,
4024,4042,4059,4077,4094,4112,4129,4146,4164,4181,4198,4215,4233,4250,4267,4284,
4301,4318,4335,4352,4369,4386,4403,4420,4437,4454,4471,4488,4505,4521,4538,4555,
4572,4588,4605,4622,4638,4655,4671,4688,4704,4721,4737,4754,4770,4787,4803,4819,
4836,4852,4868,4884,4901,4917,4933,4949,4965,4981,4997,5013,5029,5045,5061,5077,
5093,5109,5125,5141,5156,5172,5188,5204,5219,5235,5251,5266,5282,5297,5313,5328,
5344,5359,5375,5390,5406,5421,5436,5452,5467,5482,5497,5513,5528,5543,5558,5573,
5588,5603,5618,5633,5648,5663,5678,5693,5708,5723,5738,5752,5767,5782,5797,5811,
5826,5841,5855,5870,5884,5899,5913,5928,5942,5957,5971,5985,6000,6014,6028,6043,
6057,6071,6085,6100,6114,6128,6142,6156,6170,6184,6198,6212,6226,6240,6254,6268,
6282,6295,6309,6323,6337,6350,6364,6378,6391,6405,6419,6432,6446,6459,6473,6486,
6500,6513,6527,6540,6553,6567,6580,6593,6606,6620,6633,6646,6659,6672,6685,6698,
6711,6724,6737,6750,6763,6776,6789,6802,6815,6828,6841,6853,6866,6879,6892,6904,
6917,6930,6942,6955,6967,6980,6992,7005,7017,7030,7042,7055,7067,7079,7092,7104,
7116,7129,7141,7153,7165,7177,7190,7202,7214,7226,7238,7250,7262,7274,7286,7298,
7310,7322,7333,7345,7357,7369,7381,7392,7404,7416,7428,7439,7451,7462,7474,7486,
7497,7509,7520,7532,7543,7555,7566,7577,7589,7600,7611,7623,7634,7645,7657,7668,
7679,7690,7701,7712,7724,7735,7746,7757,7768,7779,7790,7801,7812,7823,7833,7844,
7855,7866,7877,7888,7898,7909,7920,7931,7941,7952,7963,7973,7984,7994,8005,8015,
8026,8036,8047,8057,8068,8078,8089,8099,8109,8120,8130,8140,8151,8161,8171,8181,
8192};
/**********************************
Get the memory for the scale tables
**********************************/
void GetTableMemory(void)
{
#ifdef __MAC__ /* Only the mac version will calculate the tables */
/* All other versions will load precalc'd tables from disk */
scaleatzptr = (Word *)AllocSomeMem(sizeof(Word)*MAXZ);
viewangletox = (short *)AllocSomeMem(sizeof(short)*FINEANGLES/2);
xtoviewangle = (short *)AllocSomeMem(sizeof(short)*(1024+1));
finetangent = (short *)AllocSomeMem(sizeof(short)*FINEANGLES/2);
finesine = (short *) AllocSomeMem(sizeof(short)*FINEANGLES/2);
#endif
MathSize = -1; /* No math data is loaded... */
}