From 0f72288207523d9aea6ea8c4d347992e34ae860f Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Wed, 18 Jun 2008 20:07:59 +0100 Subject: [PATCH] Fix bug with stars going straight upwards --- config.h.in | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/Menu.cpp | 14 ++++-- 2 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 config.h.in diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..59a05b1 --- /dev/null +++ b/config.h.in @@ -0,0 +1,139 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the `SDL_image' library (-lSDL_image). */ +#undef HAVE_LIBSDL_IMAGE + +/* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */ +#undef HAVE_LIBSDL_MIXER + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `sqrt' function. */ +#undef HAVE_SQRT + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t diff --git a/src/Menu.cpp b/src/Menu.cpp index eb7198b..ddbdf35 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -274,11 +274,15 @@ MenuStar::MenuStar() const int screenWidth = OpenGL::GetInstance().GetWidth(); const int screenHeight = OpenGL::GetInstance().GetHeight(); - pos = Position((float)(rand()%(screenWidth/2) + screenWidth/4), - (float)(rand()%(screenHeight/2) + screenHeight/4)); - - float ratio = (pos.GetY() - screenHeight/2) / (pos.GetX() - screenWidth/2); - float angle = atanf(ratio); + double x = (double)(rand()%(screenWidth/2) + screenWidth/4); + double y; + do + y = (double)(rand()%(screenHeight/2) + screenHeight/4); + while (y == 0); + pos = Position(x, y); + + double ratio = (pos.GetY() - screenHeight/2) / (pos.GetX() - screenWidth/2); + double angle = atan(ratio); vel = Velocity::Project(SPEED, angle); } -- 2.39.2