R-PAGE
Resistance's Portable-Adventure-Game-Engine
easing.c
Go to the documentation of this file.
1 /* Resistance's Portable-Adventure-Game-Engine (R-PAGE), Copyright (C) 2019 François Gutherz, Resistance.no
2  Released under MIT License, see license.txt for details.
3 */
4 
5 #include "rpage/utils.h"
6 
7 const UWORD easing_table[] =
8 {
9  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10  0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
11  3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7,
12  7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12,
13  13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19,
14  20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28,
15  28, 29, 30, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38,
16  38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 48, 48, 49,
17  50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61,
18  62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75,
19  76, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 89, 89,
20  90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105,
21  106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
22  123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 140,
23  141, 142, 143, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 158,
24  160, 161, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 176, 177, 178,
25  179, 180, 181, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 195, 196, 197, 198,
26  199, 201, 202, 203, 204, 205, 207, 208, 209, 210, 212, 213, 214, 215, 217, 218, 219,
27  220, 222, 223, 224, 225, 227, 228, 229, 231, 232, 233, 234, 236, 237, 238, 240, 241,
28  242, 243, 245, 246, 247, 249, 250, 251, 253, 254, 255, 257, 258, 259, 261, 262, 263,
29  265, 266, 267, 269, 270, 271, 273, 274, 275, 277, 278, 279, 281, 282, 283, 285, 286,
30  287, 289, 290, 292, 293, 294, 296, 297, 298, 300, 301, 303, 304, 305, 307, 308, 310,
31  311, 312, 314, 315, 316, 318, 319, 321, 322, 324, 325, 326, 328, 329, 331, 332, 333,
32  335, 336, 338, 339, 340, 342, 343, 345, 346, 348, 349, 350, 352, 353, 355, 356, 358,
33  359, 361, 362, 363, 365, 366, 368, 369, 371, 372, 374, 375, 376, 378, 379, 381, 382,
34  384, 385, 387, 388, 390, 391, 392, 394, 395, 397, 398, 400, 401, 403, 404, 406, 407,
35  409, 410, 412, 413, 415, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432,
36  434, 435, 437, 438, 440, 441, 443, 444, 446, 447, 449, 450, 452, 453, 455, 456, 458,
37  459, 461, 462, 464, 465, 467, 468, 470, 471, 473, 474, 476, 477, 479, 480, 482, 483,
38  485, 486, 488, 489, 491, 492, 494, 495, 497, 498, 500, 501, 503, 504, 506, 507, 509,
39  510, 512, 513, 514, 516, 517, 519, 520, 522, 523, 525, 526, 528, 529, 531, 532, 534,
40  535, 537, 538, 540, 541, 543, 544, 546, 547, 549, 550, 552, 553, 555, 556, 558, 559,
41  561, 562, 564, 565, 567, 568, 570, 571, 573, 574, 576, 577, 579, 580, 582, 583, 585,
42  586, 588, 589, 591, 592, 594, 595, 597, 598, 600, 601, 603, 604, 606, 607, 608, 610,
43  611, 613, 614, 616, 617, 619, 620, 622, 623, 625, 626, 628, 629, 631, 632, 633, 635,
44  636, 638, 639, 641, 642, 644, 645, 647, 648, 649, 651, 652, 654, 655, 657, 658, 660,
45  661, 662, 664, 665, 667, 668, 670, 671, 673, 674, 675, 677, 678, 680, 681, 683, 684,
46  685, 687, 688, 690, 691, 692, 694, 695, 697, 698, 700, 701, 702, 704, 705, 707, 708,
47  709, 711, 712, 713, 715, 716, 718, 719, 720, 722, 723, 725, 726, 727, 729, 730, 731,
48  733, 734, 736, 737, 738, 740, 741, 742, 744, 745, 746, 748, 749, 750, 752, 753, 754,
49  756, 757, 758, 760, 761, 762, 764, 765, 766, 768, 769, 770, 772, 773, 774, 776, 777,
50  778, 780, 781, 782, 783, 785, 786, 787, 789, 790, 791, 792, 794, 795, 796, 798, 799,
51  800, 801, 803, 804, 805, 806, 808, 809, 810, 811, 813, 814, 815, 816, 818, 819, 820,
52  821, 822, 824, 825, 826, 827, 828, 830, 831, 832, 833, 834, 836, 837, 838, 839, 840,
53  842, 843, 844, 845, 846, 847, 849, 850, 851, 852, 853, 854, 856, 857, 858, 859, 860,
54  861, 862, 864, 865, 866, 867, 868, 869, 870, 871, 872, 874, 875, 876, 877, 878, 879,
55  880, 881, 882, 883, 884, 885, 886, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897,
56  898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914,
57  915, 916, 917, 918, 919, 920, 921, 922, 923, 923, 924, 925, 926, 927, 928, 929, 930,
58  931, 932, 933, 934, 934, 935, 936, 937, 938, 939, 940, 941, 941, 942, 943, 944, 945,
59  946, 947, 947, 948, 949, 950, 951, 951, 952, 953, 954, 955, 956, 956, 957, 958, 959,
60  959, 960, 961, 962, 963, 963, 964, 965, 966, 966, 967, 968, 968, 969, 970, 971, 971,
61  972, 973, 973, 974, 975, 975, 976, 977, 978, 978, 979, 980, 980, 981, 981, 982, 983,
62  983, 984, 985, 985, 986, 986, 987, 988, 988, 989, 989, 990, 991, 991, 992, 992, 993,
63  993, 994, 995, 995, 996, 996, 997, 997, 998, 998, 999, 999, 1000, 1000, 1001, 1001, 1002,
64  1002, 1003, 1003, 1004, 1004, 1004, 1005, 1005, 1006, 1006, 1007, 1007, 1007, 1008, 1008, 1009, 1009,
65  1009, 1010, 1010, 1011, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1013, 1014, 1014, 1014, 1015, 1015,
66  1015, 1016, 1016, 1016, 1016, 1017, 1017, 1017, 1017, 1018, 1018, 1018, 1018, 1019, 1019, 1019, 1019,
67  1020, 1020, 1020, 1020, 1020, 1021, 1021, 1021, 1021, 1021, 1021, 1022, 1022, 1022, 1022, 1022, 1022,
68  1022, 1022, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
69  1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
70  1023, 1023, 1023,
71 };
72 
73 const short sintab32[1024] =
74 {
75  0, 6, 13, 19, 25, 31, 38, 44,
76  50, 57, 63, 69, 75, 82, 88, 94,
77  100, 107, 113, 119, 125, 132, 138, 144,
78  150, 156, 163, 169, 175, 181, 187, 194,
79  200, 206, 212, 218, 224, 230, 237, 243,
80  249, 255, 261, 267, 273, 279, 285, 291,
81  297, 303, 309, 315, 321, 327, 333, 339,
82  345, 351, 357, 363, 369, 374, 380, 386,
83  392, 398, 403, 409, 415, 421, 426, 432,
84  438, 443, 449, 455, 460, 466, 472, 477,
85  483, 488, 494, 499, 505, 510, 516, 521,
86  526, 532, 537, 543, 548, 553, 558, 564,
87  569, 574, 579, 584, 590, 595, 600, 605,
88  610, 615, 620, 625, 630, 635, 640, 645,
89  650, 654, 659, 664, 669, 674, 678, 683,
90  688, 692, 697, 702, 706, 711, 715, 720,
91  724, 729, 733, 737, 742, 746, 750, 755,
92  759, 763, 767, 771, 775, 779, 784, 788,
93  792, 796, 799, 803, 807, 811, 815, 819,
94  822, 826, 830, 834, 837, 841, 844, 848,
95  851, 855, 858, 862, 865, 868, 872, 875,
96  878, 882, 885, 888, 891, 894, 897, 900,
97  903, 906, 909, 912, 915, 917, 920, 923,
98  926, 928, 931, 934, 936, 939, 941, 944,
99  946, 948, 951, 953, 955, 958, 960, 962,
100  964, 966, 968, 970, 972, 974, 976, 978,
101  980, 982, 983, 985, 987, 989, 990, 992,
102  993, 995, 996, 998, 999, 1000, 1002, 1003,
103  1004, 1006, 1007, 1008, 1009, 1010, 1011, 1012,
104  1013, 1014, 1015, 1016, 1016, 1017, 1018, 1018,
105  1019, 1020, 1020, 1021, 1021, 1022, 1022, 1022,
106  1023, 1023, 1023, 1024, 1024, 1024, 1024, 1024,
107  1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023,
108  1023, 1022, 1022, 1022, 1021, 1021, 1020, 1020,
109  1019, 1018, 1018, 1017, 1016, 1016, 1015, 1014,
110  1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006,
111  1004, 1003, 1002, 1000, 999, 998, 996, 995,
112  993, 992, 990, 989, 987, 985, 983, 982,
113  980, 978, 976, 974, 972, 970, 968, 966,
114  964, 962, 960, 958, 955, 953, 951, 948,
115  946, 944, 941, 939, 936, 934, 931, 928,
116  926, 923, 920, 917, 915, 912, 909, 906,
117  903, 900, 897, 894, 891, 888, 885, 882,
118  878, 875, 872, 868, 865, 862, 858, 855,
119  851, 848, 844, 841, 837, 834, 830, 826,
120  822, 819, 815, 811, 807, 803, 799, 796,
121  792, 788, 784, 779, 775, 771, 767, 763,
122  759, 755, 750, 746, 742, 737, 733, 729,
123  724, 720, 715, 711, 706, 702, 697, 692,
124  688, 683, 678, 674, 669, 664, 659, 654,
125  650, 645, 640, 635, 630, 625, 620, 615,
126  610, 605, 600, 595, 590, 584, 579, 574,
127  569, 564, 558, 553, 548, 543, 537, 532,
128  526, 521, 516, 510, 505, 499, 494, 488,
129  483, 477, 472, 466, 460, 455, 449, 443,
130  438, 432, 426, 421, 415, 409, 403, 398,
131  392, 386, 380, 374, 369, 363, 357, 351,
132  345, 339, 333, 327, 321, 315, 309, 303,
133  297, 291, 285, 279, 273, 267, 261, 255,
134  249, 243, 237, 230, 224, 218, 212, 206,
135  200, 194, 187, 181, 175, 169, 163, 156,
136  150, 144, 138, 132, 125, 119, 113, 107,
137  100, 94, 88, 82, 75, 69, 63, 57,
138  50, 44, 38, 31, 25, 19, 13, 6,
139  0, -6, -13, -19, -25, -31, -38, -44,
140  -50, -57, -63, -69, -75, -82, -88, -94,
141  -100, -107, -113, -119, -125, -132, -138, -144,
142  -150, -156, -163, -169, -175, -181, -187, -194,
143  -200, -206, -212, -218, -224, -230, -237, -243,
144  -249, -255, -261, -267, -273, -279, -285, -291,
145  -297, -303, -309, -315, -321, -327, -333, -339,
146  -345, -351, -357, -363, -369, -374, -380, -386,
147  -392, -398, -403, -409, -415, -421, -426, -432,
148  -438, -443, -449, -455, -460, -466, -472, -477,
149  -483, -488, -494, -499, -505, -510, -516, -521,
150  -526, -532, -537, -543, -548, -553, -558, -564,
151  -569, -574, -579, -584, -590, -595, -600, -605,
152  -610, -615, -620, -625, -630, -635, -640, -645,
153  -650, -654, -659, -664, -669, -674, -678, -683,
154  -688, -692, -697, -702, -706, -711, -715, -720,
155  -724, -729, -733, -737, -742, -746, -750, -755,
156  -759, -763, -767, -771, -775, -779, -784, -788,
157  -792, -796, -799, -803, -807, -811, -815, -819,
158  -822, -826, -830, -834, -837, -841, -844, -848,
159  -851, -855, -858, -862, -865, -868, -872, -875,
160  -878, -882, -885, -888, -891, -894, -897, -900,
161  -903, -906, -909, -912, -915, -917, -920, -923,
162  -926, -928, -931, -934, -936, -939, -941, -944,
163  -946, -948, -951, -953, -955, -958, -960, -962,
164  -964, -966, -968, -970, -972, -974, -976, -978,
165  -980, -982, -983, -985, -987, -989, -990, -992,
166  -993, -995, -996, -998, -999, -1000, -1002, -1003,
167  -1004, -1006, -1007, -1008, -1009, -1010, -1011, -1012,
168  -1013, -1014, -1015, -1016, -1016, -1017, -1018, -1018,
169  -1019, -1020, -1020, -1021, -1021, -1022, -1022, -1022,
170  -1023, -1023, -1023, -1024, -1024, -1024, -1024, -1024,
171  -1024, -1024, -1024, -1024, -1024, -1024, -1023, -1023,
172  -1023, -1022, -1022, -1022, -1021, -1021, -1020, -1020,
173  -1019, -1018, -1018, -1017, -1016, -1016, -1015, -1014,
174  -1013, -1012, -1011, -1010, -1009, -1008, -1007, -1006,
175  -1004, -1003, -1002, -1000, -999, -998, -996, -995,
176  -993, -992, -990, -989, -987, -985, -983, -982,
177  -980, -978, -976, -974, -972, -970, -968, -966,
178  -964, -962, -960, -958, -955, -953, -951, -948,
179  -946, -944, -941, -939, -936, -934, -931, -928,
180  -926, -923, -920, -917, -915, -912, -909, -906,
181  -903, -900, -897, -894, -891, -888, -885, -882,
182  -878, -875, -872, -868, -865, -862, -858, -855,
183  -851, -848, -844, -841, -837, -834, -830, -826,
184  -822, -819, -815, -811, -807, -803, -799, -796,
185  -792, -788, -784, -779, -775, -771, -767, -763,
186  -759, -755, -750, -746, -742, -737, -733, -729,
187  -724, -720, -715, -711, -706, -702, -697, -692,
188  -688, -683, -678, -674, -669, -664, -659, -654,
189  -650, -645, -640, -635, -630, -625, -620, -615,
190  -610, -605, -600, -595, -590, -584, -579, -574,
191  -569, -564, -558, -553, -548, -543, -537, -532,
192  -526, -521, -516, -510, -505, -499, -494, -488,
193  -483, -477, -472, -466, -460, -455, -449, -443,
194  -438, -432, -426, -421, -415, -409, -403, -398,
195  -392, -386, -380, -374, -369, -363, -357, -351,
196  -345, -339, -333, -327, -321, -315, -309, -303,
197  -297, -291, -285, -279, -273, -267, -261, -255,
198  -249, -243, -237, -230, -224, -218, -212, -206,
199  -200, -194, -187, -181, -175, -169, -163, -156,
200  -150, -144, -138, -132, -125, -119, -113, -107,
201  -100, -94, -88, -82, -75, -69, -63, -57,
202  -50, -44, -38, -31, -25, -19, -13, -6
203 };
204 
205 
const short sintab32[1024]
Definition: easing.c:73
const UWORD easing_table[]
Definition: easing.c:7
unsigned short UWORD
Definition: utils.h:28