From 6da3a0d3cfd18f3395855fe62bda2e451d06c629 Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Sat, 1 Nov 2003 21:33:26 +0000 Subject: [PATCH] Source Cleanup and Compiler Fixes. --- zsnes/src/Makefile.in | 20 +- zsnes/src/effects/burn.c | 302 +++++++++++++++++++++++++++ zsnes/src/effects/fixsin.h | 415 +++++++++++++++++++++++++++++++++++++ zsnes/src/effects/smoke.c | 185 +++++++++++++++++ zsnes/src/effects/water.c | 399 +++++++++++++++++++++++++++++++++++ zsnes/src/link.win32 | 2 +- zsnes/src/makefile.dos | 18 +- zsnes/src/makefile.win | 18 +- 8 files changed, 1335 insertions(+), 24 deletions(-) create mode 100644 zsnes/src/effects/burn.c create mode 100644 zsnes/src/effects/fixsin.h create mode 100644 zsnes/src/effects/smoke.c create mode 100644 zsnes/src/effects/water.c diff --git a/zsnes/src/Makefile.in b/zsnes/src/Makefile.in index b1d45a1b..31d10a50 100644 --- a/zsnes/src/Makefile.in +++ b/zsnes/src/Makefile.in @@ -1,4 +1,4 @@ -#Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) +#Copyright (C) 1997-2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License @@ -23,6 +23,7 @@ VIDEODIR=video WINDIR=linux OBJDIR=obj ZIPDIR=zip +EFFECTSDIR=effects CHIPSOBJ=${CHIPDIR}/sfxproc.o ${CHIPDIR}/fxemu2.o ${CHIPDIR}/dsp1proc.o\ ${CHIPDIR}/fxemu2b.o ${CHIPDIR}/fxemu2c.o ${CHIPDIR}/fxtable.o\ @@ -57,9 +58,11 @@ WINDOSOBJ=${DOSDIR}/debug.o ${DOSDIR}/joy.o ${DOSDIR}/modemrtn.o ${DOSDIR}/vesa2 ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o ${ZIPDIR}/zpng.o -MAINOBJ=cfgload.o endmem.o fixsin.o init.o initc.o uic.o patch.o ui.o vcache.o water.o smoke.o burn.o version.o +EFFECTSOBJ=${EFFECTSDIR}/burn.o ${EFFECTSDIR}/water.o ${EFFECTSDIR}/smoke.o -OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} +MAINOBJ=cfgload.o endmem.o init.o initc.o uic.o patch.o ui.o vcache.o version.o + +OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${MAINOBJ} ${ZIPOBJ} ${EFFECTSOBJ} .SUFFIXES: .c .asm @@ -77,10 +80,9 @@ ALL: @ZSNESEXE@ ${ZIPDIR}/zpng.o: ${ZIPDIR}/zpng.c ${ZIPDIR}/zpng.h ${ZIPDIR}/unzip.o: ${ZIPDIR}/unzip.c ${ZIPDIR}/zunzip.h ${ZIPDIR}/zzip.o: ${ZIPDIR}/zzip.c ${ZIPDIR}/zunzip.h -fixsin.o: fixsin.c -water.o: water.c -smoke.o: smoke.c -burn.o: burn.c +${EFFECTSDIR}/water.o: ${EFFECTSDIR}/water.c ${EFFECTSDIR}/fixsin.h gblhdr.h +${EFFECTSDIR}/smoke.o: ${EFFECTSDIR}/smoke.c +${EFFECTSDIR}/burn.o: ${EFFECTSDIR}/burn.c ${VIDEODIR}/procvid.o: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xsaimmx.inc ${VIDEODIR}/sw_draw.obj: ${VIDEODIR}/sw_draw.asm macros.mac ${VIDEODIR}/hq3x16.obj: ${VIDEODIR}/hq3x16.asm macros.mac @@ -188,10 +190,10 @@ uninstall: rm -f @prefix@/bin/$(notdir @ZSNESEXE@) @prefix@/man/man5/zsnes.5 clean: - rm -f ${CHIPDIR}/*.o ${CPUDIR}/*.o ${VIDEODIR}/*.o ${GUIDIR}/*.o ${DOSDIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o *.o @ZSNESEXE@ + rm -f ${CHIPDIR}/*.o ${CPUDIR}/*.o ${VIDEODIR}/*.o ${GUIDIR}/*.o ${DOSDIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${EFFECTSDIR}/*.o *.o @ZSNESEXE@ distclean: - rm -f ${CHIPDIR}/*.o ${CPUDIR}/*.o ${VIDEODIR}/*.o ${GUIDIR}/*.o ${DOSDIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o *.o @ZSNESEXE@ Makefile config.cache config.log config.status config.h + rm -f ${CHIPDIR}/*.o ${CPUDIR}/*.o ${VIDEODIR}/*.o ${GUIDIR}/*.o ${DOSDIR}/*.o ${WINDIR}/*.o ${ZIPDIR}/*.o ${EFFECTSDIR}/*.o *.o @ZSNESEXE@ Makefile config.cache config.log config.status config.h diff --git a/zsnes/src/effects/burn.c b/zsnes/src/effects/burn.c new file mode 100644 index 00000000..d6885c0d --- /dev/null +++ b/zsnes/src/effects/burn.c @@ -0,0 +1,302 @@ +#include +#include +#include +#include + +#ifndef M_PI +#ifndef PI +#define M_PI 3.1415926535897932384626433832795 +#else +#define M_PI PI +#endif +#endif + +/* + +Hi guys, try this, use it in your code, but please credit + +Frank Jan Sorensen Alias:Frank Patxi (fjs@lab.jt.dk) for the +fireroutine. + +*/ + +/* + +Hi again, guys! + +If you use this code, please also credit me, Joachim Fenkes, 'cause I added +the following speedups: + + -Replaced one tiny loop with a faster Move(...) (not much speedup) + -Wrote the main display loop in 100% assembler, including a faster random + number generator (the RNG is only a more or less optimized version of + Borland's generator (see MEGARAND.ASM), but with the advantage of the + ultimate crash if you call it normally :-) + -Changed version number into 1.10 (this isn't a speedup, but necessary :-) + +*/ + +/* + Bcoz of the knowledge that reading from videocards is much slower than + writing to them, I changed some things to write and read from/to a pointer + and put the result with 32-Bit moves to the screen + + Also I added now a much more faster randommer. + + The result of this change is more than 3 times fast than before + Stefan Goehler + Please credit me! + ... + to JF: your bug is fixed! +*/ + +/* + Oops, silly me, I removed all of the assembly code, so I can let the compiler + have at it. Also makes it more portable... even though I am doing this to add + to a project that is very non-portable. +*/ + +#define BUF_WIDTH 288 +#define BUF_HEIGHT 224 + +const int rootrand = 20; /* Max/Min decrease of the root of the flames */ +const int decay = 5; /* How far should the flames go up on the screen? */ + /* This MUST be positive - JF */ +const int miny = 0; /* Startingline of the flame routine. + (should be adjusted along with MinY above) */ +const int smooth = 1; /* How descrete can the flames be?*/ +const int minfire = 50; /* limit between the "starting to burn" and + the "is burning" routines */ +const int xstart = 0; /* Startingpos on the screen, should be divideable by 4 without remain!*/ +const int xend = 287; /* Guess! */ +const int width = 1 + 287; /* +xend-xstart; Well- */ +const int maxcolor = 110; /* Constant for the MakePal procedure */ +const int fireincrease = 3; /*3 = Wood, 90 = Gazolin*/ + +typedef struct colorvalue +{ + unsigned char r, g, b; +} colorvalue; +typedef colorvalue vgapalettetype[256]; + +void hsi2rgb(double h, double s, double i, struct colorvalue *c) +/*Convert (Hue, Saturation, Intensity) -> (RGB)*/ +{ + double t; + double rv, gv, bv; + + t = h; + rv = 1 + s * sin(t - 2 * M_PI / 3); + gv = 1 + s * sin(t); + bv = 1 + s * sin(t + 2 * M_PI / 3); + t = 255.999 * i / 2; + { + c->r = (unsigned char) floor(rv * t); + c->g = (unsigned char) floor(gv * t); + c->b = (unsigned char) floor(bv * t); + } +} + +void genpal() +{ + int i; + vgapalettetype pal; + + memset(pal, 0, 3); + for( i=1; i <= maxcolor; i ++) + hsi2rgb(4.6-1.5*i/maxcolor,(double)(i)/maxcolor,(double)(i)/maxcolor,&pal[i]); + for( i=maxcolor; i <= 255; i ++) + { + pal[i]=pal[i-1]; + { + struct colorvalue *with = &pal[i]; + + if (with->r<255) with->r += 1; + if (with->r<255) with->r += 1; + if ((~i & 1) && (with->g<215)) with->g += 1; + if ((~i & 1) && (with->b<255)) with->b += 1; + } + } + +} + +int started = 0; + +#if 0 // emulating Turbo Pascal + +unsigned int randseed; +const unsigned modulus = 2147483647; +const unsigned factor = 397204094; + +void Randomize() +{ + randseed = time(NULL); +} + +unsigned int randint(unsigned range) +{ + randseed = randseed * factor % modulus; + return range ? randseed % range : 0; +} + +double randreal() +{ + randseed = randseed * factor % modulus; + return (double)randseed / modulus; +} + +int rand1(int r) /* Return a random number between -R And R*/ +{ + int result; + result=randint(r*2+1)-r; + return result; +} +#else +#define Randomize() +#define randint(a) (rand() % (a)) +#define randreal() (((double)rand()) / ((double)RAND_MAX)) +#define rand1(a) ((randint(a*2+1))-a) +#endif + +unsigned char flamearray[BUF_WIDTH]; +int morefire; +extern unsigned char *vidbuffer; + +/* damn, this seems like such a waste */ +static unsigned char pt[BUF_WIDTH * BUF_HEIGHT]; + +#if 0 + +int burn_init() +{ + int i; + + if (flamearray) return 1; + + flamearray = (unsigned char *) malloc(BUF_WIDTH); + + for( i=xstart; i <= xend; i++) + flamearray[i]=0; + + Randomize(); + + morefire=1; + genpal(); + + return 0; +} + +void burn_shutdown() +{ + if (flamearray) + { + free(flamearray); + flamearray = NULL; + } +} + +#endif + +void DrawBurn() +{ +int i,j; +int x,p; +int v; + + if (!started) + { + started = 1; + + for( i=xstart; i <= xend; i++) + flamearray[i]=0; + + Randomize(); + + morefire=1; + + memset(pt, 0, BUF_HEIGHT * BUF_WIDTH); + /* genpal(); */ + } + +/* + for (x=0; x < BUF_WIDTH*BUF_HEIGHT; x++) + { + i = pt[x]; + j = vidbuffer[x] << 2; + + if (i > j) pt[x] = i; + else pt[x] = (i + j) >> 1; + } +*/ + + /* Put the values from FlameArray on the bottom line of the screen */ + memcpy(pt+((BUF_HEIGHT-1)*BUF_WIDTH)+xstart,flamearray, width); + + /* This loop makes the actual flames */ + + for( i=xstart; i <= xend; i++) + for( j=miny; j <= (BUF_HEIGHT-1); j ++) + { + v = pt[j*BUF_WIDTH + i]; + if ((v==0) || + (v=xend)) + pt[(j-1)*BUF_WIDTH + i] = 0; + else + pt[((j-1)*BUF_WIDTH) + (i-(randint(3)-1))] = v - randint(decay); + } + + /*Match?*/ + if (randint(150)==0) + memset(flamearray + xstart + randint(xend-xstart-5),255,5); + + /*This loop controls the "root" of the + flames ie. the values in FlameArray.*/ + for( i=xstart; i <= xend; i++) + { + x=flamearray[i]; + + if (x10) x += randint(fireincrease); + } + else + /* Otherwise randomize and increase by intensity (is burning)*/ + x += rand1(rootrand)+morefire; + if (x>255) x=255; /* X Too large ?*/ + flamearray[i]=x; + } + + + /* Pour a little water on both sides of + the fire to make it look nice on the sides*/ +/* + for( i=1; i <= width / 8; i ++) + { + x=floor(sqrt(randreal())*width/8); + flamearray[xstart+x]=0; + flamearray[xend-x]=0; + } +*/ + + /*Smoothen the values of FrameArray to avoid "descrete" flames*/ + p=0; + for( i=xstart+smooth; i <= xend-smooth; i++) + { + x=0; + for( j=-smooth; j <= smooth; j++) x += flamearray[i+j]; + flamearray[i] = x / ((smooth << 1) + 1); + } + + for (x=0; x < BUF_WIDTH*BUF_HEIGHT; x++) + { + i = vidbuffer[x]; + j = pt[x] >> 3; + + if (j > i) vidbuffer[x] = j; + else vidbuffer[x] = ((i + j) >> 1) + 1; + } +} + diff --git a/zsnes/src/effects/fixsin.h b/zsnes/src/effects/fixsin.h new file mode 100644 index 00000000..1a0dbc9d --- /dev/null +++ b/zsnes/src/effects/fixsin.h @@ -0,0 +1,415 @@ +/* +Copyright (C) 1997-2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define FSINMAX 2047 +#define FSin(x) FSinTab[(x)&FSINMAX] +#define FCos(x) FCosTab[(x)&FSINMAX] + +int FSinTab[2048] = +{ +0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, 2613, +2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, 5222, +5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, 7822, +8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, 10410, +10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, 12588, +12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, 14751, +14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, 16897, +17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, 19024, +19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, 21129, +21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, 23210, +23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, 25265, +25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, 27291, +27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, 29285, +29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, 31247, +31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, 33173, +33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, 35061, +35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, 36909, +37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, 38716, +38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, 40478, +40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, 42194, +42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, 43862, +44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, 45480, +45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, 47046, +47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, 48558, +48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, 50016, +50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, 51416, +51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, 52758, +52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, 54040, +54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, 55260, +55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, 56417, +56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, 57510, +57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, 58538, +58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, 59499, +59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, 60392, +60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, 61216, +61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, 61971, +62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, 62655, +62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, 63268, +63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, 63808, +63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, 64276, +64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, 64671, +64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, 64992, +65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, 65239, +65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, 65412, +65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, 65511, +65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535, 65536, 65535, 65534, +65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, 65498, 65491, 65483, +65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, 65386, 65372, 65358, +65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, 65200, 65179, 65158, +65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, 64939, 64912, 64884, +64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, 64605, 64571, 64536, +64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, 64197, 64156, 64115, +64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, 63715, 63668, 63620, +63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, 63162, 63108, 63053, +62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, 62536, 62475, 62414, +62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, 61839, 61772, 61705, +61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, 61071, 60998, 60924, +60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, 60235, 60155, 60075, +59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, 59329, 59243, 59157, +59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, 58356, 58264, 58172, +58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, 57316, 57219, 57120, +57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, 56212, 56108, 56004, +55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, 55043, 54933, 54823, +54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, 53811, 53696, 53581, +53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, 52518, 52398, 52277, +52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, 51166, 51040, 50914, +50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, 49755, 49624, 49492, +49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, 48288, 48151, 48015, +47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, 46765, 46624, 46482, +46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, 45189, 45043, 44897, +44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, 43562, 43412, 43261, +43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, 41885, 41730, 41575, +41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, 40161, 40002, 39842, +39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, 38390, 38227, 38064, +37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, 36576, 36409, 36242, +36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, 34721, 34550, 34379, +34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, 32826, 32651, 32477, +32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, 30893, 30715, 30538, +30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, 28925, 28745, 28564, +28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, 26925, 26741, 26557, +26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, 24893, 24707, 24521, +24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, 22833, 22645, 22456, +22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, 20748, 20557, 20366, +20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, 18638, 18446, 18253, +18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, 16508, 16313, 16118, +15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, 14359, 14162, 13966, +13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, 12193, 11995, 11797, +11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, 10013, 9814, 9616, 9417, +9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, 7423, 7223, 7023, 6823, +6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, 4821, 4620, 4420, 4219, +4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, 2211, 2010, 1809, 1608, +1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, -603, -804, -1005, -1206, +-1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, -3014, -3215, -3416, +-3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, -5222, -5422, -5622, +-5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, -7423, -7623, -7822, +-8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, -9616, -9814, -10013, +-10212, -10410, -10609, -10807, -11006, -11204, -11402, -11600, -11797, -11995, +-12193, -12390, -12588, -12785, -12982, -13179, -13376, -13573, -13769, -13966, +-14162, -14359, -14555, -14751, -14946, -15142, -15338, -15533, -15728, -15923, +-16118, -16313, -16508, -16702, -16897, -17091, -17285, -17479, -17672, -17866, +-18059, -18253, -18446, -18638, -18831, -19024, -19216, -19408, -19600, -19792, +-19983, -20175, -20366, -20557, -20748, -20938, -21129, -21319, -21509, -21699, +-21889, -22078, -22267, -22456, -22645, -22833, -23022, -23210, -23398, -23586, +-23773, -23960, -24147, -24334, -24521, -24707, -24893, -25079, -25265, -25450, +-25635, -25820, -26005, -26189, -26373, -26557, -26741, -26925, -27108, -27291, +-27473, -27656, -27838, -28020, -28201, -28383, -28564, -28745, -28925, -29105, +-29285, -29465, -29645, -29824, -30003, -30181, -30360, -30538, -30715, -30893, +-31070, -31247, -31424, -31600, -31776, -31952, -32127, -32302, -32477, -32651, +-32826, -32999, -33173, -33346, -33519, -33692, -33864, -34036, -34208, -34379, +-34550, -34721, -34891, -35061, -35231, -35400, -35569, -35738, -35906, -36074, +-36242, -36409, -36576, -36743, -36909, -37075, -37241, -37406, -37571, -37736, +-37900, -38064, -38227, -38390, -38553, -38716, -38878, -39039, -39201, -39362, +-39522, -39682, -39842, -40002, -40161, -40319, -40478, -40636, -40793, -40950, +-41107, -41263, -41419, -41575, -41730, -41885, -42040, -42194, -42347, -42501, +-42653, -42806, -42958, -43110, -43261, -43412, -43562, -43712, -43862, -44011, +-44160, -44308, -44456, -44603, -44750, -44897, -45043, -45189, -45335, -45480, +-45624, -45768, -45912, -46055, -46198, -46340, -46482, -46624, -46765, -46906, +-47046, -47186, -47325, -47464, -47602, -47740, -47878, -48015, -48151, -48288, +-48423, -48558, -48693, -48828, -48961, -49095, -49228, -49360, -49492, -49624, +-49755, -49886, -50016, -50146, -50275, -50403, -50532, -50660, -50787, -50914, +-51040, -51166, -51291, -51416, -51541, -51665, -51788, -51911, -52033, -52155, +-52277, -52398, -52518, -52639, -52758, -52877, -52996, -53114, -53231, -53348, +-53465, -53581, -53696, -53811, -53926, -54040, -54153, -54266, -54379, -54491, +-54602, -54713, -54823, -54933, -55043, -55152, -55260, -55368, -55475, -55582, +-55688, -55794, -55899, -56004, -56108, -56212, -56315, -56417, -56519, -56621, +-56722, -56822, -56922, -57022, -57120, -57219, -57316, -57414, -57510, -57606, +-57702, -57797, -57892, -57986, -58079, -58172, -58264, -58356, -58447, -58538, +-58628, -58718, -58807, -58895, -58983, -59070, -59157, -59243, -59329, -59414, +-59499, -59583, -59666, -59749, -59831, -59913, -59994, -60075, -60155, -60235, +-60313, -60392, -60470, -60547, -60624, -60700, -60775, -60850, -60924, -60998, +-61071, -61144, -61216, -61288, -61359, -61429, -61499, -61568, -61637, -61705, +-61772, -61839, -61905, -61971, -62036, -62100, -62164, -62228, -62291, -62353, +-62414, -62475, -62536, -62596, -62655, -62714, -62772, -62829, -62886, -62942, +-62998, -63053, -63108, -63162, -63215, -63268, -63320, -63371, -63422, -63473, +-63522, -63571, -63620, -63668, -63715, -63762, -63808, -63854, -63899, -63943, +-63987, -64030, -64073, -64115, -64156, -64197, -64237, -64276, -64315, -64353, +-64391, -64428, -64465, -64501, -64536, -64571, -64605, -64638, -64671, -64703, +-64735, -64766, -64796, -64826, -64855, -64884, -64912, -64939, -64966, -64992, +-65018, -65043, -65067, -65091, -65114, -65136, -65158, -65179, -65200, -65220, +-65239, -65258, -65276, -65294, -65311, -65327, -65343, -65358, -65372, -65386, +-65400, -65412, -65424, -65436, -65446, -65457, -65466, -65475, -65483, -65491, +-65498, -65505, -65511, -65516, -65520, -65524, -65528, -65531, -65533, -65534, +-65535, -65536, -65535, -65534, -65533, -65531, -65528, -65524, -65520, -65516, +-65511, -65505, -65498, -65491, -65483, -65475, -65466, -65457, -65446, -65436, +-65424, -65412, -65400, -65386, -65372, -65358, -65343, -65327, -65311, -65294, +-65276, -65258, -65239, -65220, -65200, -65179, -65158, -65136, -65114, -65091, +-65067, -65043, -65018, -64992, -64966, -64939, -64912, -64884, -64855, -64826, +-64796, -64766, -64735, -64703, -64671, -64638, -64605, -64571, -64536, -64501, +-64465, -64428, -64391, -64353, -64315, -64276, -64237, -64197, -64156, -64115, +-64073, -64030, -63987, -63943, -63899, -63854, -63808, -63762, -63715, -63668, +-63620, -63571, -63522, -63473, -63422, -63371, -63320, -63268, -63215, -63162, +-63108, -63053, -62998, -62942, -62886, -62829, -62772, -62714, -62655, -62596, +-62536, -62475, -62414, -62353, -62291, -62228, -62164, -62100, -62036, -61971, +-61905, -61839, -61772, -61705, -61637, -61568, -61499, -61429, -61359, -61288, +-61216, -61144, -61071, -60998, -60924, -60850, -60775, -60700, -60624, -60547, +-60470, -60392, -60313, -60235, -60155, -60075, -59994, -59913, -59831, -59749, +-59666, -59583, -59499, -59414, -59329, -59243, -59157, -59070, -58983, -58895, +-58807, -58718, -58628, -58538, -58447, -58356, -58264, -58172, -58079, -57986, +-57892, -57797, -57702, -57606, -57510, -57414, -57316, -57219, -57120, -57022, +-56922, -56822, -56722, -56621, -56519, -56417, -56315, -56212, -56108, -56004, +-55899, -55794, -55688, -55582, -55475, -55368, -55260, -55152, -55043, -54933, +-54823, -54713, -54602, -54491, -54379, -54266, -54153, -54040, -53926, -53811, +-53696, -53581, -53465, -53348, -53231, -53114, -52996, -52877, -52758, -52639, +-52518, -52398, -52277, -52155, -52033, -51911, -51788, -51665, -51541, -51416, +-51291, -51166, -51040, -50914, -50787, -50660, -50532, -50403, -50275, -50146, +-50016, -49886, -49755, -49624, -49492, -49360, -49228, -49095, -48961, -48828, +-48693, -48558, -48423, -48288, -48151, -48015, -47878, -47740, -47602, -47464, +-47325, -47186, -47046, -46906, -46765, -46624, -46482, -46340, -46198, -46055, +-45912, -45768, -45624, -45480, -45335, -45189, -45043, -44897, -44750, -44603, +-44456, -44308, -44160, -44011, -43862, -43712, -43562, -43412, -43261, -43110, +-42958, -42806, -42653, -42501, -42347, -42194, -42040, -41885, -41730, -41575, +-41419, -41263, -41107, -40950, -40793, -40636, -40478, -40319, -40161, -40002, +-39842, -39682, -39522, -39362, -39201, -39039, -38878, -38716, -38553, -38390, +-38227, -38064, -37900, -37736, -37571, -37406, -37241, -37075, -36909, -36743, +-36576, -36409, -36242, -36074, -35906, -35738, -35569, -35400, -35231, -35061, +-34891, -34721, -34550, -34379, -34208, -34036, -33864, -33692, -33519, -33346, +-33173, -32999, -32826, -32651, -32477, -32302, -32127, -31952, -31776, -31600, +-31424, -31247, -31070, -30893, -30715, -30538, -30360, -30181, -30003, -29824, +-29645, -29465, -29285, -29105, -28925, -28745, -28564, -28383, -28201, -28020, +-27838, -27656, -27473, -27291, -27108, -26925, -26741, -26557, -26373, -26189, +-26005, -25820, -25635, -25450, -25265, -25079, -24893, -24707, -24521, -24334, +-24147, -23960, -23773, -23586, -23398, -23210, -23022, -22833, -22645, -22456, +-22267, -22078, -21889, -21699, -21509, -21319, -21129, -20938, -20748, -20557, +-20366, -20175, -19983, -19792, -19600, -19408, -19216, -19024, -18831, -18638, +-18446, -18253, -18059, -17866, -17672, -17479, -17285, -17091, -16897, -16702, +-16508, -16313, -16118, -15923, -15728, -15533, -15338, -15142, -14946, -14751, +-14555, -14359, -14162, -13966, -13769, -13573, -13376, -13179, -12982, -12785, +-12588, -12390, -12193, -11995, -11797, -11600, -11402, -11204, -11006, -10807, +-10609, -10410, -10212, -10013, -9814, -9616, -9417, -9218, -9019, -8819, -8620, +-8421, -8221, -8022, -7822, -7623, -7423, -7223, -7023, -6823, -6623, -6423, +-6223, -6023, -5823, -5622, -5422, -5222, -5021, -4821, -4620, -4420, -4219, +-4018, -3818, -3617, -3416, -3215, -3014, -2814, -2613, -2412, -2211, -2010, +-1809, -1608, -1407, -1206, -1005, -804, -603, -402, -201 +}; +int FCosTab[2048] = +{ +65536, 65535, 65534, 65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, +65498, 65491, 65483, 65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, +65386, 65372, 65358, 65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, +65200, 65179, 65158, 65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, +64939, 64912, 64884, 64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, +64605, 64571, 64536, 64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, +64197, 64156, 64115, 64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, +63715, 63668, 63620, 63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, +63162, 63108, 63053, 62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, +62536, 62475, 62414, 62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, +61839, 61772, 61705, 61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, +61071, 60998, 60924, 60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, +60235, 60155, 60075, 59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, +59329, 59243, 59157, 59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, +58356, 58264, 58172, 58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, +57316, 57219, 57120, 57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, +56212, 56108, 56004, 55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, +55043, 54933, 54823, 54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, +53811, 53696, 53581, 53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, +52518, 52398, 52277, 52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, +51166, 51040, 50914, 50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, +49755, 49624, 49492, 49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, +48288, 48151, 48015, 47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, +46765, 46624, 46482, 46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, +45189, 45043, 44897, 44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, +43562, 43412, 43261, 43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, +41885, 41730, 41575, 41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, +40161, 40002, 39842, 39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, +38390, 38227, 38064, 37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, +36576, 36409, 36242, 36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, +34721, 34550, 34379, 34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, +32826, 32651, 32477, 32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, +30893, 30715, 30538, 30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, +28925, 28745, 28564, 28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, +26925, 26741, 26557, 26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, +24893, 24707, 24521, 24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, +22833, 22645, 22456, 22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, +20748, 20557, 20366, 20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, +18638, 18446, 18253, 18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, +16508, 16313, 16118, 15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, +14359, 14162, 13966, 13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, +12193, 11995, 11797, 11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, +10013, 9814, 9616, 9417, 9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, +7423, 7223, 7023, 6823, 6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, +4821, 4620, 4420, 4219, 4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, +2211, 2010, 1809, 1608, 1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, +-603, -804, -1005, -1206, -1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, +-3014, -3215, -3416, -3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, +-5222, -5422, -5622, -5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, +-7423, -7623, -7822, -8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, +-9616, -9814, -10013, -10212, -10410, -10609, -10807, -11006, -11204, -11402, +-11600, -11797, -11995, -12193, -12390, -12588, -12785, -12982, -13179, -13376, +-13573, -13769, -13966, -14162, -14359, -14555, -14751, -14946, -15142, -15338, +-15533, -15728, -15923, -16118, -16313, -16508, -16702, -16897, -17091, -17285, +-17479, -17672, -17866, -18059, -18253, -18446, -18638, -18831, -19024, -19216, +-19408, -19600, -19792, -19983, -20175, -20366, -20557, -20748, -20938, -21129, +-21319, -21509, -21699, -21889, -22078, -22267, -22456, -22645, -22833, -23022, +-23210, -23398, -23586, -23773, -23960, -24147, -24334, -24521, -24707, -24893, +-25079, -25265, -25450, -25635, -25820, -26005, -26189, -26373, -26557, -26741, +-26925, -27108, -27291, -27473, -27656, -27838, -28020, -28201, -28383, -28564, +-28745, -28925, -29105, -29285, -29465, -29645, -29824, -30003, -30181, -30360, +-30538, -30715, -30893, -31070, -31247, -31424, -31600, -31776, -31952, -32127, +-32302, -32477, -32651, -32826, -32999, -33173, -33346, -33519, -33692, -33864, +-34036, -34208, -34379, -34550, -34721, -34891, -35061, -35231, -35400, -35569, +-35738, -35906, -36074, -36242, -36409, -36576, -36743, -36909, -37075, -37241, +-37406, -37571, -37736, -37900, -38064, -38227, -38390, -38553, -38716, -38878, +-39039, -39201, -39362, -39522, -39682, -39842, -40002, -40161, -40319, -40478, +-40636, -40793, -40950, -41107, -41263, -41419, -41575, -41730, -41885, -42040, +-42194, -42347, -42501, -42653, -42806, -42958, -43110, -43261, -43412, -43562, +-43712, -43862, -44011, -44160, -44308, -44456, -44603, -44750, -44897, -45043, +-45189, -45335, -45480, -45624, -45768, -45912, -46055, -46198, -46340, -46482, +-46624, -46765, -46906, -47046, -47186, -47325, -47464, -47602, -47740, -47878, +-48015, -48151, -48288, -48423, -48558, -48693, -48828, -48961, -49095, -49228, +-49360, -49492, -49624, -49755, -49886, -50016, -50146, -50275, -50403, -50532, +-50660, -50787, -50914, -51040, -51166, -51291, -51416, -51541, -51665, -51788, +-51911, -52033, -52155, -52277, -52398, -52518, -52639, -52758, -52877, -52996, +-53114, -53231, -53348, -53465, -53581, -53696, -53811, -53926, -54040, -54153, +-54266, -54379, -54491, -54602, -54713, -54823, -54933, -55043, -55152, -55260, +-55368, -55475, -55582, -55688, -55794, -55899, -56004, -56108, -56212, -56315, +-56417, -56519, -56621, -56722, -56822, -56922, -57022, -57120, -57219, -57316, +-57414, -57510, -57606, -57702, -57797, -57892, -57986, -58079, -58172, -58264, +-58356, -58447, -58538, -58628, -58718, -58807, -58895, -58983, -59070, -59157, +-59243, -59329, -59414, -59499, -59583, -59666, -59749, -59831, -59913, -59994, +-60075, -60155, -60235, -60313, -60392, -60470, -60547, -60624, -60700, -60775, +-60850, -60924, -60998, -61071, -61144, -61216, -61288, -61359, -61429, -61499, +-61568, -61637, -61705, -61772, -61839, -61905, -61971, -62036, -62100, -62164, +-62228, -62291, -62353, -62414, -62475, -62536, -62596, -62655, -62714, -62772, +-62829, -62886, -62942, -62998, -63053, -63108, -63162, -63215, -63268, -63320, +-63371, -63422, -63473, -63522, -63571, -63620, -63668, -63715, -63762, -63808, +-63854, -63899, -63943, -63987, -64030, -64073, -64115, -64156, -64197, -64237, +-64276, -64315, -64353, -64391, -64428, -64465, -64501, -64536, -64571, -64605, +-64638, -64671, -64703, -64735, -64766, -64796, -64826, -64855, -64884, -64912, +-64939, -64966, -64992, -65018, -65043, -65067, -65091, -65114, -65136, -65158, +-65179, -65200, -65220, -65239, -65258, -65276, -65294, -65311, -65327, -65343, +-65358, -65372, -65386, -65400, -65412, -65424, -65436, -65446, -65457, -65466, +-65475, -65483, -65491, -65498, -65505, -65511, -65516, -65520, -65524, -65528, +-65531, -65533, -65534, -65535, -65536, -65535, -65534, -65533, -65531, -65528, +-65524, -65520, -65516, -65511, -65505, -65498, -65491, -65483, -65475, -65466, +-65457, -65446, -65436, -65424, -65412, -65400, -65386, -65372, -65358, -65343, +-65327, -65311, -65294, -65276, -65258, -65239, -65220, -65200, -65179, -65158, +-65136, -65114, -65091, -65067, -65043, -65018, -64992, -64966, -64939, -64912, +-64884, -64855, -64826, -64796, -64766, -64735, -64703, -64671, -64638, -64605, +-64571, -64536, -64501, -64465, -64428, -64391, -64353, -64315, -64276, -64237, +-64197, -64156, -64115, -64073, -64030, -63987, -63943, -63899, -63854, -63808, +-63762, -63715, -63668, -63620, -63571, -63522, -63473, -63422, -63371, -63320, +-63268, -63215, -63162, -63108, -63053, -62998, -62942, -62886, -62829, -62772, +-62714, -62655, -62596, -62536, -62475, -62414, -62353, -62291, -62228, -62164, +-62100, -62036, -61971, -61905, -61839, -61772, -61705, -61637, -61568, -61499, +-61429, -61359, -61288, -61216, -61144, -61071, -60998, -60924, -60850, -60775, +-60700, -60624, -60547, -60470, -60392, -60313, -60235, -60155, -60075, -59994, +-59913, -59831, -59749, -59666, -59583, -59499, -59414, -59329, -59243, -59157, +-59070, -58983, -58895, -58807, -58718, -58628, -58538, -58447, -58356, -58264, +-58172, -58079, -57986, -57892, -57797, -57702, -57606, -57510, -57414, -57316, +-57219, -57120, -57022, -56922, -56822, -56722, -56621, -56519, -56417, -56315, +-56212, -56108, -56004, -55899, -55794, -55688, -55582, -55475, -55368, -55260, +-55152, -55043, -54933, -54823, -54713, -54602, -54491, -54379, -54266, -54153, +-54040, -53926, -53811, -53696, -53581, -53465, -53348, -53231, -53114, -52996, +-52877, -52758, -52639, -52518, -52398, -52277, -52155, -52033, -51911, -51788, +-51665, -51541, -51416, -51291, -51166, -51040, -50914, -50787, -50660, -50532, +-50403, -50275, -50146, -50016, -49886, -49755, -49624, -49492, -49360, -49228, +-49095, -48961, -48828, -48693, -48558, -48423, -48288, -48151, -48015, -47878, +-47740, -47602, -47464, -47325, -47186, -47046, -46906, -46765, -46624, -46482, +-46340, -46198, -46055, -45912, -45768, -45624, -45480, -45335, -45189, -45043, +-44897, -44750, -44603, -44456, -44308, -44160, -44011, -43862, -43712, -43562, +-43412, -43261, -43110, -42958, -42806, -42653, -42501, -42347, -42194, -42040, +-41885, -41730, -41575, -41419, -41263, -41107, -40950, -40793, -40636, -40478, +-40319, -40161, -40002, -39842, -39682, -39522, -39362, -39201, -39039, -38878, +-38716, -38553, -38390, -38227, -38064, -37900, -37736, -37571, -37406, -37241, +-37075, -36909, -36743, -36576, -36409, -36242, -36074, -35906, -35738, -35569, +-35400, -35231, -35061, -34891, -34721, -34550, -34379, -34208, -34036, -33864, +-33692, -33519, -33346, -33173, -32999, -32826, -32651, -32477, -32302, -32127, +-31952, -31776, -31600, -31424, -31247, -31070, -30893, -30715, -30538, -30360, +-30181, -30003, -29824, -29645, -29465, -29285, -29105, -28925, -28745, -28564, +-28383, -28201, -28020, -27838, -27656, -27473, -27291, -27108, -26925, -26741, +-26557, -26373, -26189, -26005, -25820, -25635, -25450, -25265, -25079, -24893, +-24707, -24521, -24334, -24147, -23960, -23773, -23586, -23398, -23210, -23022, +-22833, -22645, -22456, -22267, -22078, -21889, -21699, -21509, -21319, -21129, +-20938, -20748, -20557, -20366, -20175, -19983, -19792, -19600, -19408, -19216, +-19024, -18831, -18638, -18446, -18253, -18059, -17866, -17672, -17479, -17285, +-17091, -16897, -16702, -16508, -16313, -16118, -15923, -15728, -15533, -15338, +-15142, -14946, -14751, -14555, -14359, -14162, -13966, -13769, -13573, -13376, +-13179, -12982, -12785, -12588, -12390, -12193, -11995, -11797, -11600, -11402, +-11204, -11006, -10807, -10609, -10410, -10212, -10013, -9814, -9616, -9417, +-9218, -9019, -8819, -8620, -8421, -8221, -8022, -7822, -7623, -7423, -7223, +-7023, -6823, -6623, -6423, -6223, -6023, -5823, -5622, -5422, -5222, -5021, +-4821, -4620, -4420, -4219, -4018, -3818, -3617, -3416, -3215, -3014, -2814, +-2613, -2412, -2211, -2010, -1809, -1608, -1407, -1206, -1005, -804, -603, -402, +-201, 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, +2613, 2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, +5222, 5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, +7822, 8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, +10410, 10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, +12588, 12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, +14751, 14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, +16897, 17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, +19024, 19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, +21129, 21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, +23210, 23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, +25265, 25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, +27291, 27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, +29285, 29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, +31247, 31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, +33173, 33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, +35061, 35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, +36909, 37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, +38716, 38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, +40478, 40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, +42194, 42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, +43862, 44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, +45480, 45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, +47046, 47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, +48558, 48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, +50016, 50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, +51416, 51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, +52758, 52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, +54040, 54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, +55260, 55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, +56417, 56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, +57510, 57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, +58538, 58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, +59499, 59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, +60392, 60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, +61216, 61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, +61971, 62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, +62655, 62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, +63268, 63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, +63808, 63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, +64276, 64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, +64671, 64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, +64992, 65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, +65239, 65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, +65412, 65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, +65511, 65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535 +}; diff --git a/zsnes/src/effects/smoke.c b/zsnes/src/effects/smoke.c new file mode 100644 index 00000000..0536b7cb --- /dev/null +++ b/zsnes/src/effects/smoke.c @@ -0,0 +1,185 @@ + + +# include +# include +# include + + +/* + +Ripped from an Allegro example (exflame.c). :) + +Should be fire, but looks more like smoke in ZSNES. + +*/ + + +#define MIN(x, y) \ + (((x) < (y)) ? (x) : (y)) + +#define ABS(x) \ + (((x) >= 0) ? (x) : ( - (x))) + + +#define FIRE_HOTSPOTS 80 + +static int fire_hotspot [FIRE_HOTSPOTS]; + + +extern char * vidbuffer; + + +#define SCRW 288 + +#define SCRH 224 + + +static unsigned char fire_line [SCRW]; + +static unsigned char fire_buffer [SCRW * SCRH]; + + +static int fire_init_flag; + + +static void draw_bottom_line_of_fire (void) +{ + int count, count2; + + + memset ((& fire_line), 0, SCRW); + + + for (count = 0; count < FIRE_HOTSPOTS; count ++) + { + for (count2 = (fire_hotspot [count] - 20); + count2 < (fire_hotspot [count] + 20); count2 ++) + { + if ((count2 >= 0) && (count2 < SCRW)) + { + fire_line [count2] = + MIN ((fire_line [count2] + 20) - + ABS (fire_hotspot [count] - count2), 256); + } + } + + + fire_hotspot [count] += ((rand () & 7) - 3); + + + if (fire_hotspot [count] < 0) + { + fire_hotspot [count] += SCRW; + } + else if (fire_hotspot [count] >= SCRW) + { + fire_hotspot [count] -= SCRW; + } + } + + + for (count = 0; count < SCRW; count ++) + { + fire_buffer [((SCRH - 1) * + (SCRW)) + count] = fire_line [count]; + } +} + + +static void init_fire (void) +{ + int x, y, pixel, count; + + + srand (time (0)); + + + for (count = 0; count < FIRE_HOTSPOTS; count ++) + { + fire_hotspot [count] = (rand () % SCRW); + } + + + for (count = 0; count < SCRH; count ++) + { + draw_bottom_line_of_fire (); + + + for (y = 0; y < (SCRH - 1); y ++) + { + for (x = 0; x < SCRW; x ++) + { + pixel = fire_buffer [((y + 1) * SCRW) + x]; + + + if (pixel > 0) + { + pixel --; + } + + + fire_buffer [(y * SCRW) + x] = pixel; + } + } + } + + + fire_init_flag = 1; +} + + +/* void DrawFire (void) */ + +void DrawSmoke (void) +{ + int x, y, pixel, pixel2; + + + if (! fire_init_flag) + { + init_fire (); + } + + + draw_bottom_line_of_fire (); + + + for (y = 0; y < (SCRH - 1); y ++) + { + for (x = 0; x < SCRW; x ++) + { + pixel = fire_buffer [((y + 1) * SCRW) + x]; + + + if (pixel > 0) + { + pixel --; + } + + + fire_buffer [(y * SCRW) + x] = pixel; + } + } + + + for (y = 0; y < SCRH; y ++) + { + for (x = 0; x < SCRW; x ++) + { + pixel = vidbuffer [(y * SCRW) + x]; + + pixel2 = (fire_buffer [(y * SCRW) + x] / 8); + + + if (pixel2 > pixel) + { + vidbuffer [(y * SCRW) + x] = pixel2; + } + else + { + vidbuffer [(y * SCRW) + x] = + (((pixel + pixel2) / 2) + 1); + } + } + } +} diff --git a/zsnes/src/effects/water.c b/zsnes/src/effects/water.c new file mode 100644 index 00000000..f7f21f2a --- /dev/null +++ b/zsnes/src/effects/water.c @@ -0,0 +1,399 @@ +/* +Copyright (C) 1997-2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef __LINUX__ +#include "../gblhdr.h" +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "fixsin.h" + +extern char *vidbuffer; + +#define SCRW 288 +#define SCRH 224 + +static unsigned char vscr[SCRW*SCRH]; + + +static int Height[2][SCRW*SCRH]; + +extern char NetPlayNoMore; + +/* static void DrawWaterNoLight(int *ptr); */ +static void DrawWaterWithLight(int *ptr,int light); +static void SineBlob(int x, int y, int radius, int height, int page); +static void CalcWater(int *nptr,int *optr,int density); + +//static int x,y; +static int ox=80,oy=60; +static int xang,yang; +static int density=5; +static int Hpage=0; +static int mode=0x0001; +static int offset; +static int pheight=400; +static int radius=30; + +extern char GUIEffect; + +void DrawWater(void) +{ + // tslast=tscurrent; +// tscurrent=time(NULL); + + /* + if (NetPlayNoMore == 1) + { + DrawWaterNoLight(Height[Hpage]); + } + else + { + DrawWaterWithLight(Height[Hpage],1); + } + */ + +#if 0 + DrawWaterNoLight(Height[Hpage]); +#else + DrawWaterWithLight(Height[Hpage],1); +#endif + + if (GUIEffect==2) { mode=0x0001; } + else { mode = 0x0004; } + + if(mode&2) // && (tscurrent-tslast)) + { + int x,y; + x=rand()%(SCRW-2)+1; + y=rand()%(SCRH-2)+1; + Height[Hpage][y*SCRW+x]=rand()%(pheight<<2); + } + + /* the surfer */ + if(mode&1) + { + int x,y; + x = (SCRW/2) + + ((((FSin( (xang* 65) >>8) >>8) + * (FSin( (xang*349) >>8) >>8)) + * ((SCRW-8)/2)) >> 16); + + y = (SCRH/2) + + ((((FSin( (yang*377) >>8) >>8) + *(FSin( (yang* 84) >>8) >>8)) + * ((SCRH-8)/2)) >> 16); + xang += 13; + yang += 12; + + if(mode & 0x4000) + { + offset = (oy+y)/2*SCRW + (ox+x)/2; + Height[Hpage][offset] = pheight; + Height[Hpage][offset + 1] = + Height[Hpage][offset - 1] = + Height[Hpage][offset + SCRW] = + Height[Hpage][offset - SCRW] = pheight >> 1; + + offset = y*SCRW + x; + Height[Hpage][offset] = pheight<<1; + Height[Hpage][offset + 1] = + Height[Hpage][offset - 1] = + Height[Hpage][offset + SCRW] = + Height[Hpage][offset - SCRW] = pheight; + } + else + { + SineBlob((ox+x)/2, (oy+y)/2, 3, -1200, Hpage); + SineBlob(x, y, 4, -2000, Hpage); + + } + + ox = x; + oy = y; + + } + + if(mode&4) + { + int x,y; + srand(time(0)); + if(rand()%14 == 7) + { +/* + if(mode & 0x4000) +// HeightBlob(-1, -1, radius/2, pheight, Hpage); + else +*/ + x=rand()%(SCRW-2)+1; + y=rand()%(SCRH-2)+1; + SineBlob(x, y, radius, -pheight*6, Hpage); + } + } + CalcWater(Height[Hpage^1], Height[Hpage], density); + Hpage ^= 1; /* flip flop */ + +} + + +#if 0 +void DrawWaterNoLight(int *ptr) +{ + int dx,dy; + int x,y; + int c; + int p; + + int offset = SCRW+1; + if(ptr == NULL) + { + return; + } + + for(y=((SCRH-1)*SCRW); offset < y; offset+=2) + { + for(x = offset+SCRW-2;offset>3)+(dx>>3); +/* if(p>(SCRH*SCRW)) + { + for(;p<(SCRH*SCRW);p-=SCRW); + } + if(p<0) + { + for(;p>0;p+=SCRW); + } +*/ + if(p >= (SCRW*SCRH) ) + { + p=(SCRW*SCRH)-1; + } + else + { + if(p < 0) + { + p=0; + } + } + c=vidbuffer[p]; + (c<1) ? c=1 : (c > 31) ? c=31 : 0; + vscr[offset]=c; + offset++; + dx=ptr[offset]-ptr[offset+1]; + dy=ptr[offset]-ptr[offset+SCRW]; + p=offset+SCRW*(dy>>3)+(dx>>3); +/* + if(p>(SCRH*SCRW)) + { + for(;p<(SCRH*SCRW);p-=SCRW); + } + if(p<0) + { + for(;p>=0;p+=SCRW); + } +*/ + if(p >= (SCRW*SCRH) ) + { + p=(SCRW*SCRH)-1; + } + else + { + if(p < 0) + { + p=0; + } + } + + c=vidbuffer[p]; + (c<1) ? c=1 : (c > 31) ? c=31 : 0; + vscr[offset]=c; + } + } + + memcpy( vidbuffer,vscr,SCRW*SCRH); +// frames++; + +} +#endif + +void DrawWaterWithLight(int *ptr,int light) +{ + int dx,dy; + int x,y; + int c; + int p; + + int offset = SCRW+1; + if(ptr == NULL) + { + return; + } + + for(y=((SCRH-1)*SCRW); offset < y; offset+=2) + { + for(x = offset+SCRW-2;offset>3)+(dx>>3); + if (p>(SCRH*SCRW)) p = (p % SCRW) + ((SCRH-((p - (SCRH*SCRW)) / SCRW)) * SCRW); + if (p<0) p = (SCRW + (p % SCRW)) + abs(p / SCRW) * SCRW; +/* + if(p >= (SCRW*SCRH) ) + { + p=(SCRW*SCRH)-1; + } + else + { + if(p < 0) + { + p=0; + } + } +*/ + c=vidbuffer[p]; + c-=(dx>>light); + (c<1) ? c=1 : (c > 31) ? c=31 : 0; + vscr[offset]=c; + offset++; + dx=ptr[offset]-ptr[offset+1]; + dy=ptr[offset]-ptr[offset+SCRW]; + p=offset+SCRW*(dy>>3)+(dx>>3); + if (p>(SCRH*SCRW)) p = (p % SCRW) + ((SCRH-((p - (SCRH*SCRW)) / SCRW)) * SCRW); + if (p<0) p = (SCRW + (p % SCRW)) + abs(p / SCRW) * SCRW; +/* + if(p >= (SCRW*SCRH) ) + { + p=(SCRW*SCRH)-1; + } + else + { + if(p < 0) + { + p=0; + } + } +*/ + c=vidbuffer[p]; + + c-=(dx>>light); + (c<1) ? c=1 : (c > 31) ? c=31 : 0; + vscr[offset]=c; + } + } + + memcpy( vidbuffer,vscr,SCRW*SCRH); +// memcpy( VGLDisplay->Bitmap,vscr,SCRW*SCRH); +// frames++; + + +} + +void CalcWater(int *nptr,int *optr,int density) +{ + int newh; + int count = SCRW+1; + int x,y; + + for(y = (SCRH-1) * SCRW;count> 2) + - nptr[count]; + + nptr[count] = newh - (newh >> density); + } + } + +} + +void SineBlob(int x, int y, int radius, int height, int page) +{ + int cx, cy; + int left,top,right,bottom; + int square, dist; + int radsquare = radius * radius; + float length = (1024.0f/(float)radius)*(1024.0f/(float)radius); + + if(x<0) x = 1+radius+ rand()%(SCRW-2*radius-1); + if(y<0) y = 1+radius+ rand()%(SCRH-2*radius-1); + + +// radsquare = (radius*radius) << 8; + radsquare = (radius*radius); + + /* + if (NetPlayNoMore == 1) + { + radsquare = (radius*radius); + } + else + { + radsquare = (radius*radius) << 8; + height /= 8; + } + */ + + radsquare = (radius*radius); + + height /= 8; + + left=-radius; right = radius; + top=-radius; bottom = radius; + + + // Perform edge clipping... + if(x - radius < 1) left -= (x-radius-1); + if(y - radius < 1) top -= (y-radius-1); + if(x + radius > SCRW-1) right -= (x+radius-SCRW+1); + if(y + radius > SCRH-1) bottom-= (y+radius-SCRH+1); + + for(cy = top; cy < bottom; cy++) + { + for(cx = left; cx < right; cx++) + { + square = cy*cy + cx*cx; + if(square < radsquare) + { + dist = (int) sqrt(square*length); + Height[page][SCRW*(cy+y) + cx+x] + += (int)((FCos(dist)+0xffff)*(height)) >> 19; + } + } + } +} diff --git a/zsnes/src/link.win32 b/zsnes/src/link.win32 index 59862eff..e9a2287f 100644 --- a/zsnes/src/link.win32 +++ b/zsnes/src/link.win32 @@ -1,3 +1,3 @@ -/Fezsnesw.exe chips\dsp1proc.obj dos\sw.obj dos\gppro.obj dos\vesa12.obj dos\zsipx.obj dos\modemrtn.obj dos\joy.obj dos\debug.obj dos\vesa2.obj dos\initvid.obj cfgload.obj endmem.obj fixsin.obj init.obj initc.obj uic.obj patch.obj ui.obj vcache.obj water.obj smoke.obj burn.obj version.obj video\procvid.obj win\copyvwin.obj win\winintrf.obj win\winlink.obj win\zloaderw.obj win\ztcp.obj win\zfilew.obj win\zipxw.obj video\makev16b.obj video\makev16t.obj video\makevid.obj video\mode716.obj video\mode716b.obj video\mode716d.obj video\mode716e.obj video\mode716t.obj video\mode7.obj video\mode7ext.obj video\mv16tms.obj video\newg162.obj video\newgfx16.obj video\newgfx2.obj video\newgfx.obj video\m716text.obj video\2xsaiw.obj video\sw_draw.obj video/hq3x16.obj video/hq3x32.obj gui\gui.obj gui\menu.obj cpu\addrni.obj cpu\dma.obj cpu\dsp.obj cpu\dspproc.obj cpu\execute.obj cpu\irq.obj cpu\memory.obj cpu\spc700.obj cpu\stable.obj cpu\table.obj cpu\tableb.obj cpu\tablec.obj chips\dsp1emu.obj chips\fxemu2.obj chips\fxemu2b.obj chips\fxemu2c.obj chips\fxtable.obj chips\sa1proc.obj chips\sa1regs.obj chips\sfxproc.obj zip\unzip.obj zip\zzip.obj zip\zpng.obj zlib.lib libpng.lib wsock32.lib user32.lib gdi32.lib shell32.lib winmm.lib ddraw.lib dsound.lib dinput8.lib d3dx.lib /link /section:.text,erw +/Fezsnesw.exe chips\dsp1proc.obj dos\sw.obj dos\gppro.obj dos\vesa12.obj dos\zsipx.obj dos\modemrtn.obj dos\joy.obj dos\debug.obj dos\vesa2.obj dos\initvid.obj cfgload.obj endmem.obj init.obj initc.obj uic.obj patch.obj ui.obj vcache.obj effects\water.obj effects\smoke.obj effects\burn.obj version.obj video\procvid.obj win\copyvwin.obj win\winintrf.obj win\winlink.obj win\zloaderw.obj win\ztcp.obj win\zfilew.obj win\zipxw.obj video\makev16b.obj video\makev16t.obj video\makevid.obj video\mode716.obj video\mode716b.obj video\mode716d.obj video\mode716e.obj video\mode716t.obj video\mode7.obj video\mode7ext.obj video\mv16tms.obj video\newg162.obj video\newgfx16.obj video\newgfx2.obj video\newgfx.obj video\m716text.obj video\2xsaiw.obj video\sw_draw.obj video/hq3x16.obj video/hq3x32.obj gui\gui.obj gui\menu.obj cpu\addrni.obj cpu\dma.obj cpu\dsp.obj cpu\dspproc.obj cpu\execute.obj cpu\irq.obj cpu\memory.obj cpu\spc700.obj cpu\stable.obj cpu\table.obj cpu\tableb.obj cpu\tablec.obj chips\dsp1emu.obj chips\fxemu2.obj chips\fxemu2b.obj chips\fxemu2c.obj chips\fxtable.obj chips\sa1proc.obj chips\sa1regs.obj chips\sfxproc.obj zip\unzip.obj zip\zzip.obj zip\zpng.obj zlib.lib libpng.lib wsock32.lib user32.lib gdi32.lib shell32.lib winmm.lib ddraw.lib dsound.lib dinput8.lib d3dx.lib /link /section:.text,erw diff --git a/zsnes/src/makefile.dos b/zsnes/src/makefile.dos index 8df97df1..f9c6c504 100644 --- a/zsnes/src/makefile.dos +++ b/zsnes/src/makefile.dos @@ -1,4 +1,4 @@ -#Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) +#Copyright (C) 1997-2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License @@ -23,6 +23,7 @@ VIDEODIR=video WINDIR=win OBJDIR=obj ZIPDIR=zip +EFFECTSDIR=effects CHIPSOBJ=${CHIPDIR}/dsp1emu.o ${CHIPDIR}/fxemu2.o ${CHIPDIR}/sfxproc.o\ ${CHIPDIR}/fxemu2b.o ${CHIPDIR}/fxemu2c.o ${CHIPDIR}/fxtable.o\ @@ -55,10 +56,12 @@ PREOBJ=${OBJDIR}/dosbuff.o ${OBJDIR}/ipx.o ${OBJDIR}/zipx.o ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o ${ZIPDIR}/zpng.o -MAINOBJ=cfgload.o endmem.o fixsin.o init.o initc.o uic.o patch.o ui.o vcache.o water.o smoke.o burn.o version.o +EFFECTSOBJ=${EFFECTSDIR}/burn.o ${EFFECTSDIR}/water.o ${EFFECTSDIR}/smoke.o + +MAINOBJ=cfgload.o endmem.o init.o initc.o uic.o patch.o ui.o vcache.o version.o -OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${ZIPOBJ} +OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${ZIPOBJ} ${EFFECTSOBJ} LIBS=-lz -lm -lpng #CFLAGS=-O2 -Wall -Wno-unused -D__MSDOS__ CFLAGS=-O3 -march=i586 -fno-exceptions -ffast-math\ @@ -91,10 +94,10 @@ zsnesd.exe: ${OBJS} ${CC} -Ws -o zsnesd.exe ${OBJS} ${LIBS} ${DOSDIR}/zloader.o: ${DOSDIR}/zloader.c -fixsin.o: fixsin.c -water.o: water.c -smoke.o: smoke.c -burn.o: burn.c + +${EFFECTSDIR}/water.o: ${EFFECTSDIR}/water.c ${EFFECTSDIR}/fixsin.h +${EFFECTSDIR}/smoke.o: ${EFFECTSDIR}/smoke.c +${EFFECTSDIR}/burn.o: ${EFFECTSDIR}/burn.c ${DOSDIR}/zfile.o: ${DOSDIR}/zfile.c ${ZIPDIR}/unzip.o: ${ZIPDIR}/unzip.c ${ZIPDIR}/zunzip.h ${ZIPDIR}/zzip.o: ${ZIPDIR}/zzip.c ${ZIPDIR}/zunzip.h @@ -202,6 +205,7 @@ clean: del ${GUIDIR}\*.o del ${DOSDIR}\*.o del ${ZIPDIR}\*.o + del ${EFFECTSDIR}\*.o del zsnes.exe diff --git a/zsnes/src/makefile.win b/zsnes/src/makefile.win index 4148e2d8..96b64ba6 100644 --- a/zsnes/src/makefile.win +++ b/zsnes/src/makefile.win @@ -1,4 +1,4 @@ -#Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) +#Copyright (C) 1997-2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) # #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ VIDEODIR=video WINDIR=win OBJDIR=obj ZIPDIR=zip +EFFECTSDIR=effects CHIPSOBJ=${CHIPDIR}/sfxproc.obj ${CHIPDIR}/fxemu2.obj ${CHIPDIR}/dsp1proc.obj\ ${CHIPDIR}/fxemu2b.obj ${CHIPDIR}/fxemu2c.obj ${CHIPDIR}/fxtable.obj\ @@ -64,9 +65,12 @@ PREOBJ= ZIPOBJ=${ZIPDIR}/zzip.obj ${ZIPDIR}/unzip.obj ${ZIPDIR}/zpng.obj -MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj initc.obj uic.obj patch.obj ui.obj vcache.obj water.obj smoke.obj burn.obj version.obj +EFFECTSOBJ=${EFFECTSDIR}/burn.obj ${EFFECTSDIR}/water.obj ${EFFECTSDIR}/smoke.obj -OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ} +MAINOBJ=cfgload.obj endmem.obj init.obj initc.obj uic.obj patch.obj ui.obj vcache.obj version.obj + + +OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ} ${EFFECTSOBJ} LIBS= CFLAGS=/Ox /G6 /c /D__WIN32__ ASM=nasm @@ -110,10 +114,9 @@ ${DOSDIR}/vesa2.obj: ${DOSDIR}/vesa2.asm macros.mac ${DOSDIR}/gppro.o: ${DOSDIR}/gppro.asm macros.mac ${DOSDIR}/sw.o: ${DOSDIR}/sw.asm macros.mac ${DOSDIR}/vesa12.o: ${DOSDIR}/vesa12.asm macros.mac -fixsin.obj: fixsin.c -water.obj: water.c -smoke.obj: smoke.c -burn.obj: burn.c +${EFFECTSDIR}/water.obj: ${EFFECTSDIR}/water.c ${EFFECTSDIR}/fixsin.h +${EFFECTSDIR}/smoke.obj: ${EFFECTSDIR}/smoke.c +${EFFECTSDIR}/burn.obj: ${EFFECTSDIR}/burn.c ${VIDEODIR}/2xsaiw.obj: ${VIDEODIR}/2xsaiw.asm macros.mac ${VIDEODIR}/procvid.obj: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xSaImmx.inc ${VIDEODIR}/sw_draw.obj: ${VIDEODIR}/sw_draw.asm macros.mac @@ -225,6 +228,7 @@ clean: del ${WINDIR}\zsnes.res del ${ZIPDIR}\*.obj del ${DOSDIR}\*.obj + del ${EFFECTSDIR}\*.o del zsnesw.exe