A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 103 lines 3.1 kB view raw
1/* Emacs style mode select -*- C++ -*- 2 *----------------------------------------------------------------------------- 3 * 4 * 5 * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 * based on BOOM, a modified and improved DOOM engine 7 * Copyright (C) 1999 by 8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 * Copyright (C) 1999-2000 by 10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 * 02111-1307, USA. 26 * 27 * DESCRIPTION: 28 * Lookup tables. 29 * Do not try to look them up :-). 30 * In the order of appearance: 31 * 32 * int finetangent[4096] - Tangens LUT. 33 * Should work with BAM fairly well (12 of 16bit, 34 * effectively, by shifting). 35 * 36 * int finesine[10240] - Sine lookup. 37 * Guess what, serves as cosine, too. 38 * Remarkable thing is, how to use BAMs with this? 39 * 40 * int tantoangle[2049] - ArcTan LUT, 41 * maps tan(angle) to angle fast. Gotta search. 42 * 43 *-----------------------------------------------------------------------------*/ 44 45#ifndef __TABLES__ 46#define __TABLES__ 47 48#include "m_fixed.h" 49#include "rockmacros.h" 50 51#define FINEANGLES 8192 52#define FINEMASK (FINEANGLES-1) 53 54// 0x100000000 to 0x2000 55#define ANGLETOFINESHIFT 19 56 57#ifndef ALL_IN_ONE 58 59// TABLES_AS_LUMPS causes the tables to be loaded from a wad lump, and the normal 60// data to be stored as a predefined lump. 61// Only really useful for dumping the trig tables or with NO_PREDEFINED_LUMPS 62#define TABLES_AS_LUMPS 63#endif 64 65// Binary Angle Measument, BAM. 66#define ANG45 0x20000000 67#define ANG90 0x40000000 68#define ANG180 0x80000000 69#define ANG270 0xc0000000 70 71#define SLOPERANGE 2048 72#define SLOPEBITS 11 73#define DBITS (FRACBITS-SLOPEBITS) 74 75typedef unsigned angle_t; 76 77// Load trig tables if needed 78#ifdef TABLES_AS_LUMPS 79void R_LoadTrigTables(void); 80#define TRIG_CONST 81#else 82#define TRIG_CONST const 83#endif 84 85// Effective size is 10240. 86extern TRIG_CONST fixed_t *finesine; 87 88// Re-use data, is just PI/2 phase shift. 89extern TRIG_CONST fixed_t *finecosine; 90 91// Effective size is 4096. 92extern TRIG_CONST fixed_t *finetangent; 93 94// Effective size is 2049; 95// The +1 size is to handle the case when x==y without additional checking. 96 97extern TRIG_CONST angle_t *tantoangle; 98 99// Utility function, called by R_PointToAngle. 100int SlopeDiv(unsigned num, unsigned den); 101 102#undef TRIG_CONST 103#endif